You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default this emits `React.createElement(...)` and `React.Fragment`. Override them when needed:
89
+
90
+
```ts
91
+
transpileJsxSource(input, {
92
+
createElement: '__jsx',
93
+
fragment: '__fragment',
94
+
})
95
+
```
96
+
71
97
### React runtime (`reactJsx`)
72
98
73
99
Need to compose React elements instead of DOM nodes? Import the dedicated helper from the `@knighted/jsx/react` subpath (React 18+ and `react-dom` are still required to mount the tree):
Copy file name to clipboardExpand all lines: docs/how-it-compares.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,21 +11,21 @@ Use this quick matrix to see how `@knighted/jsx` stacks up against other tagged-
11
11
| SSR / Node |`@knighted/jsx/node` bootstraps `linkedom`/`jsdom` automatically; fixtures cover Next.js, Lit + React hybrids, and plain Node usage. | Depends on the hyperscript target/framework to provide SSR. | Provides DOM-focused SSR utilities but no automatic shims or React interop. |
12
12
| TypeScript support | First-class typings for DOM + React runtimes, loader options, and Node helpers. | Community types only for the tag factory. | Minimal typings; templates rely on generic DOM types. |
13
13
| Component interoperability | Mix DOM helpers, React components, Lit roots, and loader-transformed calls in one file. | Primarily a JSX stand-in for Preact or hyperscript. | Focused on DOM updates, pairs with `uhtml/async` or low-level renderers. |
14
-
| Approx. size | DOM: ~11.3 kB raw / ~2.8 kB min+gzip. Lite DOM: ~10.1 kB raw / ~4.2 kB min+gzip. |~1 kB min+gzip. |~7 kB min+gzip. |
14
+
| Approx. size | DOM: ~11.5 kB raw / ~2.8 kB min+gzip. Lite DOM: ~10.4 kB raw / ~4.3 kB min+gzip. |~1 kB min+gzip. |~7 kB min+gzip. |
15
15
16
16
> `htm` and `uhtml` remain excellent when you only need lightweight hyperscript or DOM templating. `@knighted/jsx` trades a slightly larger runtime for full JSX semantics, React parity, loaders, and SSR tooling.
17
17
18
18
> [!NOTE]
19
-
> `@knighted/jsx` sizes were measured by gzipping `dist/jsx.js` (default runtime) and `dist/lite/index.js` from the latest build. The lite bundle packs the DOM helper and bootstrap code together, so raw bytes dropped while gzip remains ~1.4 kB larger than the split default entry.
19
+
> `@knighted/jsx` sizes were measured by gzipping `dist/jsx.js` (default runtime) and `dist/lite/index.js` from the latest build. The lite bundle packs the DOM helper and bootstrap code together, so raw bytes dropped while gzip remains ~1.5 kB larger than the split default entry.
20
20
21
21
## Detailed size breakdown
22
22
23
23
| Entry point | Raw size (bytes) | Min+gzip size (bytes) | Lite raw size (bytes) | Lite min+gzip size (bytes) | Notes |
| DOM runtime (`@knighted/jsx`) | 11,549 (`dist/jsx.js`) | 2,870| 10,337 (`dist/lite/index.js`) | 4,301| Lite bundle keeps helper + bootstrap inline, shaving raw bytes (~10 kB) while staying ~1.4 kB heavier once gzipped. |
26
-
| React runtime (`@knighted/jsx/react`) | 5,236 (`dist/react/react-jsx.js`) | 1,478| 6,777 (`dist/lite/react/index.js`) | 2,974| Lite React remains a single file with helpers + bootstrap, so gzip lands roughly 1.5 kB above the split default build. |
27
-
| Node DOM entry (`@knighted/jsx/node`) | 14,044 combined (`dist/jsx.js` + `dist/node/bootstrap.js` via dynamic import) |≈3,849| 11,500 (`dist/lite/node/index.js`) | 4,808| Lite node now reuses the trimmed DOM runtime, trimming ~1.3 kB raw compared to the previous monolithic build. |
28
-
| Node React entry (`@knighted/jsx/node/react`) | 7,731 combined (`dist/react/react-jsx.js` + `dist/node/bootstrap.js`) |≈2,457| 6,777 (`dist/lite/node/react/index.js`) | 2,974| Lite node/react shares the lite React runtime, so gzip matches that entry while the classic build loads two files. |
25
+
| DOM runtime (`@knighted/jsx`) | 11,549 (`dist/jsx.js`) | 2,843| 10,388 (`dist/lite/index.js`) | 4,295| Lite bundle keeps helper + bootstrap inline, shaving raw bytes (~10 kB) while staying ~1.5 kB heavier once gzipped. |
26
+
| React runtime (`@knighted/jsx/react`) | 5,236 (`dist/react/react-jsx.js`) | 1,461| 6,828 (`dist/lite/react/index.js`) | 2,979| Lite React remains a single file with helpers + bootstrap, so gzip lands roughly 1.5 kB above the split default build. |
27
+
| Node DOM entry (`@knighted/jsx/node`) | 14,044 combined (`dist/jsx.js` + `dist/node/bootstrap.js` via dynamic import) |3,803| 11,551 (`dist/lite/node/index.js`) | 4,796| Lite node now reuses the trimmed DOM runtime, trimming ~2.5 kB raw compared to the previous monolithic build. |
28
+
| Node React entry (`@knighted/jsx/node/react`) | 7,731 combined (`dist/react/react-jsx.js` + `dist/node/bootstrap.js`) |2,421| 6,828 (`dist/lite/node/react/index.js`) | 2,979| Lite node/react shares the lite React runtime, so gzip matches that entry while the classic build loads two files. |
29
29
30
30
> [!TIP]
31
31
> Numbers were captured using `gzip -c <file> | wc -c`. “Combined” entries include every file the non-lite entry loads at runtime so you can compare end-to-end costs.
0 commit comments