PoC: feat(jsx/dom): introduce jsx/dom/tiny. Some features are omit in this runtime, but the size is very small.
There are currently no plans to include this, but it is a PoC to show that it is possible to reduce the size.
The size of "jsx/dom" has increased considerably with the changes in #2960. For apps that do not need the features of #2960, it is possible to provide a smaller sized runtime that omits those features.
Usage
with full feature
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx/dom",
}
}
without title/script/style/meta elements feature https://react.dev/reference/react-dom/components
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx/dom/tiny",
}
}
Result
Compared with the code used in js-framework-benchmark.
% ls -lSr solid/dist/main.js preact/dist/main.js react-hooks/dist/main.js hono/dist/index.js hono-tiny/dist/index.js | awk '{print $NF, $5}'
solid/dist/main.js 11288
hono-tiny/dist/index.js 11930
hono/dist/index.js 16108
preact/dist/main.js 16612
react-hooks/dist/main.js 145439
The author should do the following, if applicable
The current ‘hono/jsx/dom’ is small enough that I see no need to merge this PR, but if this becomes an important point of comparison with other frameworks, I would consider merging it.
Codecov Report
Attention: Patch coverage is 95.55556% with 2 lines in your changes missing coverage. Please review.
Project coverage is 96.22%. Comparing base (
17c3b9e) to head (e0546f1).
| Files | Patch % | Lines |
|---|---|---|
| src/jsx/dom/jsx-dev-runtime.ts | 0.00% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #3295 +/- ##
==========================================
- Coverage 96.31% 96.22% -0.09%
==========================================
Files 151 154 +3
Lines 15368 15394 +26
Branches 2685 2696 +11
==========================================
+ Hits 14801 14813 +12
- Misses 567 581 +14
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hi @usualoma
Interesting. I also will consider it.