-
-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(jsx): rename Hono
to JSX
and export JSX
namespace
#2937
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2937 +/- ##
========================================
Coverage 94.42% 94.42%
========================================
Files 136 136
Lines 13343 13348 +5
Branches 2219 2325 +106
========================================
+ Hits 12599 12604 +5
Misses 744 744 ☔ View full report in Codecov by Sentry. |
Hey @usualoma What do you think of this PR? |
@yusukebe Thank you. |
@usualoma Thanks! I'll merge it. |
P.S. We can write like this instead of the document: https://hono.dev/guides/jsx#override-type-definitions declare module 'hono/jsx' {
namespace JSX {
interface IntrinsicElements {
'my-custom-element': HTMLAttributes & {
'x-event'?: 'click' | 'scroll'
}
}
}
} |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [hono](https://hono.dev/) ([source](https://github.com/honojs/hono)) | [`4.4.4` -> `4.4.7`](https://renovatebot.com/diffs/npm/hono/4.4.4/4.4.7) | [![age](https://developer.mend.io/api/mc/badges/age/npm/hono/4.4.7?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/hono/4.4.7?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/hono/4.4.4/4.4.7?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/hono/4.4.4/4.4.7?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>honojs/hono (hono)</summary> ### [`v4.4.7`](https://github.com/honojs/hono/releases/tag/v4.4.7) [Compare Source](https://github.com/honojs/hono/compare/v4.4.6...v4.4.7) #### What's Changed - use correct return type for c.html depending on input by [@​asmadsen](https://github.com/asmadsen) in [https://github.com/honojs/hono/pull/2973](https://github.com/honojs/hono/pull/2973) - test: test uncovered return statement by [@​yasuaki640](https://github.com/yasuaki640) in [https://github.com/honojs/hono/pull/2985](https://github.com/honojs/hono/pull/2985) - test: Update request.test.ts to remove duplicate checks by [@​JoaquimLey](https://github.com/JoaquimLey) in [https://github.com/honojs/hono/pull/2984](https://github.com/honojs/hono/pull/2984) - fix(types): env variables override ContextVariableMap by [@​KaelWD](https://github.com/KaelWD) in [https://github.com/honojs/hono/pull/2987](https://github.com/honojs/hono/pull/2987) #### New Contributors - [@​asmadsen](https://github.com/asmadsen) made their first contribution in [https://github.com/honojs/hono/pull/2973](https://github.com/honojs/hono/pull/2973) - [@​JoaquimLey](https://github.com/JoaquimLey) made their first contribution in [https://github.com/honojs/hono/pull/2984](https://github.com/honojs/hono/pull/2984) - [@​KaelWD](https://github.com/KaelWD) made their first contribution in [https://github.com/honojs/hono/pull/2987](https://github.com/honojs/hono/pull/2987) **Full Changelog**: honojs/hono@v4.4.6...v4.4.7 ### [`v4.4.6`](https://github.com/honojs/hono/releases/tag/v4.4.6) [Compare Source](https://github.com/honojs/hono/compare/v4.4.5...v4.4.6) ##### What's Changed - fix(aws-lambda): handle multiple cookies in streaming responses by [@​KnisterPeter](https://github.com/KnisterPeter) in [https://github.com/honojs/hono/pull/2926](https://github.com/honojs/hono/pull/2926) **Full Changelog**: honojs/hono@v4.4.5...v4.4.6 ### [`v4.4.5`](https://github.com/honojs/hono/releases/tag/v4.4.5) [Compare Source](https://github.com/honojs/hono/compare/v4.4.4...v4.4.5) ##### What's Changed - fix(cors): allow custom vary header by [@​fzn0x](https://github.com/fzn0x) in [https://github.com/honojs/hono/pull/2934](https://github.com/honojs/hono/pull/2934) - fix(jsx): rename `Hono` to `JSX` and export `JSX` namespace by [@​yusukebe](https://github.com/yusukebe) in [https://github.com/honojs/hono/pull/2937](https://github.com/honojs/hono/pull/2937) - refactor(hono-base): make 2nd arg of `app.route()` required by [@​yusukebe](https://github.com/yusukebe) in [https://github.com/honojs/hono/pull/2945](https://github.com/honojs/hono/pull/2945) - refactor(hono-base): don't check 1st argument of `app.on()` by [@​yusukebe](https://github.com/yusukebe) in [https://github.com/honojs/hono/pull/2946](https://github.com/honojs/hono/pull/2946) - refactor(context): remove unnecessary initialization add add tests for Context by [@​yusukebe](https://github.com/yusukebe) in [https://github.com/honojs/hono/pull/2949](https://github.com/honojs/hono/pull/2949) - test(hono-base): add tests for covering 100% by [@​yusukebe](https://github.com/yusukebe) in [https://github.com/honojs/hono/pull/2952](https://github.com/honojs/hono/pull/2952) - fix(context): default JSONRespond and TextRespond StatusCode generic arg by [@​EdamAme-x](https://github.com/EdamAme-x) in [https://github.com/honojs/hono/pull/2954](https://github.com/honojs/hono/pull/2954) - refactor(request): shorten `parseBody` and remove unnecessary check by [@​yusukebe](https://github.com/yusukebe) in [https://github.com/honojs/hono/pull/2947](https://github.com/honojs/hono/pull/2947) - refactor(jsx): reduce code size and improve maintainability by [@​usualoma](https://github.com/usualoma) in [https://github.com/honojs/hono/pull/2956](https://github.com/honojs/hono/pull/2956) **Full Changelog**: honojs/hono@v4.4.4...v4.4.5 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" in timezone America/Chicago, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/autoblocksai/cli). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjQxMC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Fixes #2927
Currently, the definition for HTML tags elements and attributes are exported as a namespace named
Hono
injsx/intrinsic-elements.ts
. This is not bad, but the namespaceHono
is not exported for users. So, it's impossible to extend the values such asHTMLAttributes
. In this PR, it will be exported fromhono/jsx
. And I renamedHono
toJSX
because the nameHono
will cause confusion. That namespace was not used in a global. So I think it will not be a breaking change.With this PR, you can write the JSX with the HTMX attribute with the following code:
By the way, it was exported in
global
beforev4.4.0
, but it was not valid for JSR publishing and polluted the global. So, it was changed to exported locally in the module.The author should do the following, if applicable
bun run format:fix && bun run lint:fix
to format the code