void-plugin-hono-jsx 0.1.0-alpha.3 → 0.1.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +86 -28
  3. package/THIRD_PARTY_NOTICES.md +2 -2
  4. package/dist/browser/client.d.ts +2 -1
  5. package/dist/browser/client.d.ts.map +1 -1
  6. package/dist/browser/client.js +76 -22
  7. package/dist/browser/client.js.map +1 -1
  8. package/dist/browser/document-head.d.ts +1 -1
  9. package/dist/browser/document-head.d.ts.map +1 -1
  10. package/dist/browser/document-head.js +22 -1
  11. package/dist/browser/document-head.js.map +1 -1
  12. package/dist/browser/form-view.d.ts +11 -0
  13. package/dist/browser/form-view.d.ts.map +1 -0
  14. package/dist/browser/form-view.js +18 -0
  15. package/dist/browser/form-view.js.map +1 -0
  16. package/dist/browser/form.d.ts +28 -12
  17. package/dist/browser/form.d.ts.map +1 -1
  18. package/dist/browser/form.js +92 -23
  19. package/dist/browser/form.js.map +1 -1
  20. package/dist/browser/markdown.d.ts +15 -0
  21. package/dist/browser/markdown.d.ts.map +1 -0
  22. package/dist/browser/markdown.js +6 -0
  23. package/dist/browser/markdown.js.map +1 -0
  24. package/dist/browser/navigation.d.ts +13 -0
  25. package/dist/browser/navigation.d.ts.map +1 -0
  26. package/dist/browser/navigation.js +144 -0
  27. package/dist/browser/navigation.js.map +1 -0
  28. package/dist/browser/pages.d.ts +33 -3
  29. package/dist/browser/pages.d.ts.map +1 -1
  30. package/dist/browser/pages.js +76 -13
  31. package/dist/browser/pages.js.map +1 -1
  32. package/dist/plugins/compatibility.d.ts +2 -0
  33. package/dist/plugins/compatibility.d.ts.map +1 -1
  34. package/dist/plugins/compatibility.js +13 -4
  35. package/dist/plugins/compatibility.js.map +1 -1
  36. package/dist/plugins/hono-islands.d.ts +1 -1
  37. package/dist/plugins/hono-islands.d.ts.map +1 -1
  38. package/dist/plugins/hono-islands.js +208 -29
  39. package/dist/plugins/hono-islands.js.map +1 -1
  40. package/dist/plugins/hono-jsx.d.ts +11 -3
  41. package/dist/plugins/hono-jsx.d.ts.map +1 -1
  42. package/dist/plugins/hono-jsx.js +183 -18
  43. package/dist/plugins/hono-jsx.js.map +1 -1
  44. package/dist/plugins/hono-markdown.d.ts +4 -0
  45. package/dist/plugins/hono-markdown.d.ts.map +1 -0
  46. package/dist/plugins/hono-markdown.js +102 -0
  47. package/dist/plugins/hono-markdown.js.map +1 -0
  48. package/dist/plugins/jsx-transform.d.ts +4 -0
  49. package/dist/plugins/jsx-transform.d.ts.map +1 -0
  50. package/dist/plugins/jsx-transform.js +21 -0
  51. package/dist/plugins/jsx-transform.js.map +1 -0
  52. package/dist/plugins/markdown-api.d.ts +11 -0
  53. package/dist/plugins/markdown-api.d.ts.map +1 -0
  54. package/dist/plugins/markdown-api.js +13 -0
  55. package/dist/plugins/markdown-api.js.map +1 -0
  56. package/dist/plugins/markdown-compiler.d.ts +43 -0
  57. package/dist/plugins/markdown-compiler.d.ts.map +1 -0
  58. package/dist/plugins/markdown-compiler.js +91 -0
  59. package/dist/plugins/markdown-compiler.js.map +1 -0
  60. package/dist/plugins/resolve-component.d.ts +3 -0
  61. package/dist/plugins/resolve-component.d.ts.map +1 -0
  62. package/dist/plugins/resolve-component.js +15 -0
  63. package/dist/plugins/resolve-component.js.map +1 -0
  64. package/dist/plugins/runtime-paths.d.ts +1 -0
  65. package/dist/plugins/runtime-paths.d.ts.map +1 -1
  66. package/dist/plugins/runtime-paths.js +2 -0
  67. package/dist/plugins/runtime-paths.js.map +1 -1
  68. package/dist/server/form-view.d.ts +11 -0
  69. package/dist/server/form-view.d.ts.map +1 -0
  70. package/dist/server/form-view.js +18 -0
  71. package/dist/server/form-view.js.map +1 -0
  72. package/dist/server/form.d.ts +28 -12
  73. package/dist/server/form.d.ts.map +1 -1
  74. package/dist/server/form.js +92 -23
  75. package/dist/server/form.js.map +1 -1
  76. package/dist/server/markdown.d.ts +15 -0
  77. package/dist/server/markdown.d.ts.map +1 -0
  78. package/dist/server/markdown.js +6 -0
  79. package/dist/server/markdown.js.map +1 -0
  80. package/dist/server/pages.d.ts +33 -3
  81. package/dist/server/pages.d.ts.map +1 -1
  82. package/dist/server/pages.js +76 -13
  83. package/dist/server/pages.js.map +1 -1
  84. package/package.json +26 -8
  85. package/src/plugins/compatibility.ts +11 -4
  86. package/src/plugins/hono-islands.ts +158 -28
  87. package/src/plugins/hono-jsx.ts +176 -17
  88. package/src/plugins/hono-markdown.ts +88 -0
  89. package/src/plugins/jsx-transform.ts +20 -0
  90. package/src/plugins/markdown-api.ts +18 -0
  91. package/src/plugins/markdown-compiler.ts +77 -0
  92. package/src/plugins/resolve-component.ts +12 -0
  93. package/src/plugins/runtime-paths.ts +2 -0
  94. package/src/runtime/client.tsx +66 -24
  95. package/src/runtime/document-head.ts +20 -1
  96. package/src/runtime/form-view.tsx +27 -0
  97. package/src/runtime/form.ts +87 -41
  98. package/src/runtime/markdown.ts +7 -0
  99. package/src/runtime/navigation.ts +115 -0
  100. package/src/runtime/pages.tsx +77 -15
  101. package/dist/plugins/hono-pages.d.ts +0 -4
  102. package/dist/plugins/hono-pages.d.ts.map +0 -1
  103. package/dist/plugins/hono-pages.js +0 -150
  104. package/dist/plugins/hono-pages.js.map +0 -1
  105. package/src/plugins/hono-pages.ts +0 -143
package/CHANGELOG.md CHANGED
@@ -1,5 +1,68 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.0-rc.0](https://github.com/ts-76/void-plugin-hono-jsx/compare/v0.1.0-alpha.4...v0.1.0-rc.0) (2026-10-17)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * the release candidate supports Void >=1.1.11 <1.2 and Node >=24.21.0 <25; old Void 0.x launchers are historical fixtures only.
9
+
10
+ ### Features
11
+
12
+ * consolidate the Void 1.1 release candidate ([#92](https://github.com/ts-76/void-plugin-hono-jsx/issues/92)) ([2793b54](https://github.com/ts-76/void-plugin-hono-jsx/commit/2793b54937a01a890d8df858f82ae2f612e5aacf))
13
+
14
+ ## [0.1.0-alpha.4](https://github.com/ts-76/void-plugin-hono-jsx/compare/v0.1.0-alpha.3...v0.1.0-alpha.4) (2026-10-17)
15
+
16
+
17
+ ### ⚠ BREAKING CHANGES
18
+
19
+ * Rename voidHonoPages to voidHonoJsx and HonoPagesOptions to HonoJsxOptions. The legacy names are removed without compatibility aliases.
20
+
21
+ ### Features
22
+
23
+ * **forms:** add bound forms and action helpers ([22899eb](https://github.com/ts-76/void-plugin-hono-jsx/commit/22899eb8105f626c87fc4dafd19785a9c637bf4c))
24
+ * **forms:** add bound forms and action helpers ([15f7e0d](https://github.com/ts-76/void-plugin-hono-jsx/commit/15f7e0d154ea38134a458385ac0eb65ce215f302))
25
+ * **forms:** support provider-free island actions ([b8020d8](https://github.com/ts-76/void-plugin-hono-jsx/commit/b8020d856bc2d65c8cecdc69c3ce6aa0cca46737))
26
+ * **forms:** support provider-free island actions ([7179d10](https://github.com/ts-76/void-plugin-hono-jsx/commit/7179d102455dcccb50d2bec2e48f284d3f908c29))
27
+ * **islands:** discover static component and layout graphs ([a93bf48](https://github.com/ts-76/void-plugin-hono-jsx/commit/a93bf482678908153722ad28ec117d2fca2cb62d))
28
+ * **islands:** discover static component and layout graphs ([cc5133d](https://github.com/ts-76/void-plugin-hono-jsx/commit/cc5133dd9d3273ebc02143f41fa79cb7e3dacb1d))
29
+ * **islands:** support visible idle and media policies ([3b6b296](https://github.com/ts-76/void-plugin-hono-jsx/commit/3b6b2965ddd5fefef2e16281e3d64083c1c7d42f))
30
+ * **islands:** support visible idle and media policies ([7d7d8f0](https://github.com/ts-76/void-plugin-hono-jsx/commit/7d7d8f00bc8c1d3b029af9e469005f358f866ab5))
31
+ * **markdown:** add optional Hono Markdown pages ([f27a6ab](https://github.com/ts-76/void-plugin-hono-jsx/commit/f27a6abec34afa9dd875de564454ca2bf1a840bc))
32
+ * **markdown:** add optional Hono Markdown pages ([471ed71](https://github.com/ts-76/void-plugin-hono-jsx/commit/471ed717ac31b8ac3192efed43cb34072913b049))
33
+ * **pages:** expose reactive navigation state ([b54476b](https://github.com/ts-76/void-plugin-hono-jsx/commit/b54476b6eb404530738a5d23397e453d468441d0))
34
+ * **pages:** expose reactive navigation state ([d7b1e04](https://github.com/ts-76/void-plugin-hono-jsx/commit/d7b1e041c751943e08eabeb7d5de54f1a8fb3038))
35
+ * **pages:** expose transition and prefetch options ([e3bf353](https://github.com/ts-76/void-plugin-hono-jsx/commit/e3bf353aa9ffbc7e734442af113a98503b5a0c67))
36
+ * **pages:** expose transition and prefetch options ([764c623](https://github.com/ts-76/void-plugin-hono-jsx/commit/764c623472c173bd4fb1485d32add7af07bc00d6))
37
+ * **pages:** integrate Hono Pages APIs and optional Markdown ([07d459b](https://github.com/ts-76/void-plugin-hono-jsx/commit/07d459b703bbff6cd46ea0f6a56eeea6ac9a97cc))
38
+ * **pages:** support Link navigation options and prefetch ([d32664d](https://github.com/ts-76/void-plugin-hono-jsx/commit/d32664d0f1291078aaad7b63807f98e8afb7b24c))
39
+ * **pages:** support Link navigation options and prefetch ([f2c87c0](https://github.com/ts-76/void-plugin-hono-jsx/commit/f2c87c0f2c1908b24fa064fa69630a62dd4bd025))
40
+ * rename plugin to voidHonoJsx and integrate Markdown sample ([4107cd8](https://github.com/ts-76/void-plugin-hono-jsx/commit/4107cd80ff2caac27acb67fd981634b4ac0e708a))
41
+
42
+
43
+ ### Bug Fixes
44
+
45
+ * **islands:** resolve directory index imports in static graphs ([17287b3](https://github.com/ts-76/void-plugin-hono-jsx/commit/17287b30d48646246f18c44e94d99387bc9107de))
46
+ * **markdown:** canonicalize symlinked island identities ([14d0fc7](https://github.com/ts-76/void-plugin-hono-jsx/commit/14d0fc7187d3b9c19b1bb29d10736cb79b126532))
47
+ * **markdown:** diagnose the upstream compiler integration gate ([2ac08ba](https://github.com/ts-76/void-plugin-hono-jsx/commit/2ac08ba6a170292c5a3f5d414046b6a7a01774d8))
48
+ * **pages:** own native transition lifecycle over the Void engine ([aae12c3](https://github.com/ts-76/void-plugin-hono-jsx/commit/aae12c3c1e54782db42f7e2839867e055c5dd1bf))
49
+ * **pages:** preserve navigation guards and recover failed renders ([c2ac900](https://github.com/ts-76/void-plugin-hono-jsx/commit/c2ac900d6bccfb53ad505624d12f976caad37e2d))
50
+ * **pages:** resolve relative Link destinations against the document ([1f0da26](https://github.com/ts-76/void-plugin-hono-jsx/commit/1f0da2637680b92606bef66510236624252c18dc))
51
+ * **release:** refresh pnpm publisher to patched rustls ([db2035e](https://github.com/ts-76/void-plugin-hono-jsx/commit/db2035eff876df04dd582b932b485f3a545e3cd1))
52
+ * **release:** refresh pnpm publisher to patched rustls ([38c9bdd](https://github.com/ts-76/void-plugin-hono-jsx/commit/38c9bdd5af42fe2819215340d6ed92284dce2d9c))
53
+
54
+
55
+ ### Documentation
56
+
57
+ * describe post-alpha.3 APIs without transient publication claims ([0341e4d](https://github.com/ts-76/void-plugin-hono-jsx/commit/0341e4dffcf09657ad564f77551fa4d9c9066a54))
58
+ * distinguish published alpha baseline and upcoming release evidence ([83cca46](https://github.com/ts-76/void-plugin-hono-jsx/commit/83cca464ccf35a0402e00ce6426e63fee5057451))
59
+ * **markdown:** include optional setup in the packed guide ([26e7dd5](https://github.com/ts-76/void-plugin-hono-jsx/commit/26e7dd59ecdef69e16e466c16b2c0bd962d4777b))
60
+
61
+
62
+ ### Release Automation
63
+
64
+ * accept scoped ZIP findings in the fixed-tarball publisher ([fb08d0b](https://github.com/ts-76/void-plugin-hono-jsx/commit/fb08d0b5c8c2d80f7f5e9072d36bf1f077f8c8f1))
65
+
3
66
  ## [0.1.0-alpha.3](https://github.com/ts-76/void-plugin-hono-jsx/compare/v0.1.0-alpha.2...v0.1.0-alpha.3) (2026-10-12)
4
67
 
5
68
 
package/README.md CHANGED
@@ -1,48 +1,54 @@
1
1
  # Experimental Hono Pages adapter for Void
2
2
 
3
- This experimental package integrates Hono JSX with Void Pages. The package name is `void-plugin-hono-jsx`. Alpha releases are published on the `next` dist-tag under the [MIT license](LICENSE). Use `@next` or an explicit alpha version. The maintainer also assigned `latest` to the published `0.1.0-alpha.1`; an unqualified install currently selects this experimental alpha, not a stable release. It is not an official Void adapter.
3
+ This package integrates Hono JSX with Void Pages. This source documents the upcoming 0.1.0 RC/normal release; published alpha.4 has a different compatibility contract. Prereleases use `next`; normal releases move to `latest` after public verification. Before registry approval, use a local tarball. The package is [MIT licensed](LICENSE) and is not an official Void adapter.
4
4
 
5
5
  ## Supported versions
6
6
 
7
7
  | Component | Accepted stable range | Full consumer fixtures |
8
8
  | --- | --- | --- |
9
- | Node.js | >=24.21.0 | 24.21.0 |
10
- | Void | >=0.26.1 <0.28.0 | 0.26.1, 0.27.0 |
9
+ | Node.js | >=24.21.0 <25.0.0 | 24.21.0 |
10
+ | Void | >=1.1.11 <1.2.0 | 1.1.11 |
11
11
  | Hono | >=4.13.13 <5.0.0 | 4.13.13 |
12
- | Vite | >=8.0.16 <9.0.0 | 8.0.16 (Vite Plus), 8.3.3, 8.3.4 |
13
- | Vite Plus | Host Vite must satisfy the Vite range | 0.1.24 (scaffold), 1.1.0 (latest) |
12
+ | Vite | >=8.0.16 <9.0.0 | 8.3.4 |
13
+ | Vite Plus | Host Vite must satisfy the Vite range | 1.3.0 |
14
14
  | TypeScript | Project tooling | 7.0.2 |
15
15
 
16
- The next release after alpha.2 broadens these peer ranges. Published alpha.1 and staged alpha.2 retain their exact-version gate; install a local candidate to test this change before its release. Stable Vite/Hono updates within the current major are admitted by compatibility policy; Void is pre-1.0, so the next minor (0.28) requires explicit validation. Prereleases are excluded. The fixture versions above were exercised individually; admitting a range does not mean every future version has already been tested. New upstream releases require refreshed fixtures, full checks and dependency audit review.
16
+ The upcoming RC targets Void 1.1 and Node 24 only. Published alpha.4 retains its earlier Void 0.x contract; it does not provide this support change or multipart transport. Old Void/launcher manifests remain historical comparison records, not release-selectable configurations. The two supported Hono-only consumers use Void 1.1.11 with plain Vite 8.3.4 or aligned Vite Plus 1.3.0 (host Vite 8.3.4). Ranges admit stable updates, but only locked fixtures are observed test results. New upstream releases require refreshed fixtures, full checks and audit review; prereleases and other Void minors are excluded.
17
+
18
+ Alpha.4 introduced the expanded Link/Form APIs, island forms and graphs, deferred contracts, page options and optional Markdown. This source adds the Void 1.1 contract and multipart transport for the RC; use the local tarball until the RC is approved. Do not combine the RC setup instructions with alpha.4.
17
19
 
18
20
  ## Install
19
21
 
20
- Use Node 24.21.0 or newer:
22
+ Use Node 24.21.0 or newer within Node 24:
23
+
24
+ The commands below target the RC line. Check registry availability after owner approval. Published alpha.4 does not accept Void 1.1; use a local tarball until the RC has been approved. Use Node >=24.21.0 <25.0.0.
21
25
 
22
26
  ```sh
23
- npm install void-plugin-hono-jsx@next hono@4.13.13
24
- npm install --save-dev void@0.27.0 vite@8.3.4 typescript@7.0.2
27
+ npm install void-plugin-hono-jsx@0.1.0-rc.0 hono@4.13.13
28
+ npm install --save-dev void@1.1.11 vite@8.3.4 typescript@7.0.2
25
29
  ```
26
30
 
27
31
  For a local validation tarball, in the repository, run `npm ci`, `npm run build:package`, then `npm pack ./packages/hono-pages`. Install the resulting tarball in your project alongside the supported peer versions:
28
32
 
29
33
  ```sh
30
34
  npm install ./void-plugin-hono-jsx-<version>.tgz hono@4.13.13
31
- npm install --save-dev void@0.27.0 vite@8.3.4 typescript@7.0.2
35
+ npm install --save-dev void@1.1.11 vite@8.3.4 typescript@7.0.2
32
36
  ```
33
37
 
34
38
  ## Configure
35
39
 
40
+ `voidHonoJsx()` and `HonoJsxOptions` replace the earlier `voidHonoPages()` and `HonoPagesOptions` names. This is a breaking alpha API change; the old names are not exported. Alpha.3 uses the earlier names. Use a local tarball or a release containing this rename for the configuration below.
41
+
36
42
  ```ts
37
43
  // vite.config.ts
38
44
  import { defineConfig } from 'vite';
39
45
  import { voidPlugin } from 'void';
40
- import { voidHonoPages } from 'void-plugin-hono-jsx/plugin';
46
+ import { voidHonoJsx } from 'void-plugin-hono-jsx/plugin';
41
47
 
42
- export default defineConfig({ plugins: [voidPlugin(), voidHonoPages()] });
48
+ export default defineConfig({ plugins: [voidPlugin(), voidHonoJsx()] });
43
49
  ```
44
50
 
45
- Configure project settings in `void.config.ts` using `defineConfig` from `void/config`. Run Vite from that project's root. `voidHonoPages()` includes the Hono JSX transform, so do not register a separate transform. Configure charset, viewport and favicon through Void's `head` settings.
51
+ Configure project settings in `void.config.ts` using `defineConfig` from `void/config`. Run Vite from that project's root. `voidHonoJsx()` includes the Hono JSX transform, so do not register a separate transform. Configure charset, viewport and favicon through Void's `head` settings.
46
52
 
47
53
  Use `jsx: "react-jsx"` and `jsxImportSource: "hono/jsx"` in TypeScript. The plugin chooses the server or DOM factory for application JSX; the plugin resolves package runtime exports using Vite's actual consumer environment. Cloudflare worker environments may enable the browser condition, so that condition alone cannot select the renderer.
48
54
 
@@ -50,7 +56,7 @@ Use `jsx: "react-jsx"` and `jsxImportSource: "hono/jsx"` in TypeScript. The plug
50
56
 
51
57
  The config hook reads `this.meta.viteVersion` from the Vite instance executing the hook. Resolving `vite/package.json` from the adapter or project is not evidence of the running host. The adapter also checks the actual Vite helper module it imports. Errors include the host version, helper version, and absolute adapter/project package.json paths; different pnpm peer copies therefore remain visible.
52
58
 
53
- Bundled launchers such as `vp dev` can execute another Vite even when the project has a direct `vite` dependency. The Void 0.27.0 scaffold requests `vite-plus: ^0.1.21`, resolving to 0.1.24 with host Vite 8.0.16. Latest Vite Plus 1.1.0 runs host Vite 8.3.3. The scaffold fixture retains direct npm Vite 8.3.4. Latest Vite Plus requires its official aligned toolchain: `vite` aliases `npm:@voidzero-dev/vite-plus-core@1.1.0`, and the fixture follows its documented consumer-only Vite/Vitest overrides (Vitest 5.0.3). Both are exercised in independent locked consumers, including dev, build and preview. These settings align the toolchain; they do not replace vulnerable transitive dependencies. Standard Vite 8.3.3/8.3.4 is also covered. Installing project Vite alone does not change a bundled host; unsupported host errors identify the launcher action separately from stale helper peer resolution.
59
+ Bundled launchers such as `vp dev` can execute another Vite even when a direct npm `vite` is installed. The supported Vite Plus 1.3.0 configuration aliases `vite` to `npm:@voidzero-dev/vite-plus-core@1.3.0` and uses `overrides: { vite: "$vite" }` to keep helper and host peers aligned. The real config-hook host is Vite 8.3.4. Plain Vite 8.3.4 is independently exercised. Installing npm Vite alone does not change a bundled host; diagnostics identify launcher and helper peer paths separately. Historical 0.x scaffold settings are outside RC support. The alias aligns the launcher; it is not a vulnerability override.
54
60
 
55
61
  If the project version is already correct, inspect the paths in the diagnostic and refresh stale adapter peer resolutions/lockfiles. Do not infer the host identity from the project dependency alone. Missing hook version information fails closed. [Vite plugin context metadata](https://vite.dev/guide/api-plugin.html#plugin-context-meta)
56
62
 
@@ -59,30 +65,53 @@ If the project version is already correct, inspect the paths in the diagnostic a
59
65
  Void's init wizard currently offers React, Vue, Svelte and Solid adapters rather than Hono JSX. A React scaffold can be adapted without replacing its Vite Plus scripts:
60
66
 
61
67
  1. Install this adapter and `hono`; use a candidate/new release with the support policy above.
62
- 2. Replace `voidReact()` / `@void/react/plugin` in `vite.config.ts` with `voidHonoPages()` / `void-plugin-hono-jsx/plugin`, keeping `voidPlugin()`.
68
+ 2. Replace `voidReact()` / `@void/react/plugin` in `vite.config.ts` with `voidHonoJsx()` / `void-plugin-hono-jsx/plugin`, keeping `voidPlugin()`.
63
69
  3. Set TypeScript `jsx` to `react-jsx` and `jsxImportSource` to `hono/jsx`. Change page/component React imports and hooks to Hono JSX APIs.
64
70
  4. Once React code is removed, uninstall `@void/react`, `react`, `react-dom`, `@types/react`, `@types/react-dom` and `oxc-transform-react` if they are otherwise unused. The Hono plugin supplies its own JSX transform.
65
71
  5. Keep `vp dev`, `vp build`, `vp preview`, or use the plain Vite scaffold. Verify the app's loaders/actions and database migrations locally.
66
72
 
67
- The latest consumer fixtures also install React scaffold dependencies (React/DOM/types 19.3.0, `@void/react` 0.27.0 and `oxc-transform-react` 0.153.0), showing that their presence does not block the Hono adapter. This is not a React-to-Hono source conversion or a claim that other UI frameworks run through this adapter.
73
+ The supported RC fixtures are Hono-only. Historical React/Void 0.x scaffold metadata is retained for comparison and is not a supported installation path.
68
74
 
69
75
  ## Source and debugging files
70
76
 
71
- The next alpha candidate includes the original `src/plugins/*.ts` and `src/runtime/*.{ts,tsx}` alongside compiled `dist` entries. Every JavaScript file has a `.js.map` with embedded original source; every declaration has a `.d.ts.map` pointing to the same packaged TypeScript files. Build-time import rewriting composes its map with the compiler map, so generated locations still refer to the original source. These additions require a new release; alpha.0 and alpha.1 remain unchanged.
77
+ Published alpha.2 and alpha.3 include the original `src/plugins/*.ts` and `src/runtime/*.{ts,tsx}` alongside compiled `dist` entries. Every JavaScript file has a `.js.map` with embedded original source; every declaration has a `.d.ts.map` pointing to the same packaged TypeScript files. Build-time import rewriting composes its map with the compiler map, so generated locations still refer to the original source. Alpha.0 and alpha.1 retain their original dist-only archives.
72
78
 
73
79
  Read source under `node_modules/void-plugin-hono-jsx/src`. Editors supporting declaration maps can navigate from exported types to those files, and debuggers/bundlers supporting source maps can show the original source. Application imports continue to use `/plugin`, `/pages` and `/form`; `src` is supplied for inspection and debugging, not as an additional runtime entry point. Candidate and clean-consumer checks reject missing/stale maps, external source references, changed source bytes and unexpected archive files.
74
80
 
75
81
  ## Runtime exports
76
82
 
77
83
  ```tsx
78
- import { Link, useRouter, useShared, useParams, useErrors } from 'void-plugin-hono-jsx/pages';
79
- import { useForm } from 'void-plugin-hono-jsx/form';
84
+ import { Link, useRouter, useShared, useParams, useErrors, useNavigation } from 'void-plugin-hono-jsx/pages';
85
+ import { Form, useForm, useIslandForm, action } from 'void-plugin-hono-jsx/form';
80
86
  ```
81
87
 
82
- `Link` and `useRouter` use Void's shared navigation protocol. Ordinary GET visits reset page state; refresh preserves it. Root/nested/named layouts retain state while they remain in the active chain. Shared data, route params and field errors are available in SSR and browser components. `useForm` supports all mutation methods, named actions, validation, duplicate suppression and cancellation. Cancellation does not undo server writes.
88
+ `Link` and `useRouter` use Void's shared navigation protocol. Link accepts `method`, `data`, `preserveScroll`, `preserveState`, `replace`, `reloadDocument` and cancellable `onNavigate`. GET data is serialized into its href; mutation links render buttons. Prefetch supports `true` (hover), `hover`, `click`, `mount`, `visible` or an array, with optional `cacheFor`. Prefetch and document reload are GET-only. User event handlers can prevent the adapter's action; external/download/target links retain native behavior. Ordinary GET visits reset page state; refresh preserves it. Root/nested/named layouts retain state while they remain in the active chain. Shared data, route params and field errors are available in SSR and browser components. `useNavigation()` returns Void's reactive `{ state, location, method }` (`idle`, `loading`, `submitting`); SSR starts idle and pending visits clear on completion, failure or cancellation. `useForm` supports all mutation methods, named actions, validation, duplicate suppression and cancellation. Existing `useForm(defaults)` with `post(url)` remains supported. The bound `useForm('/edit?save', defaults, options)` form also supports `post()`/`put()`/`patch()`/`delete()` and `<Form form={form}>`; provide `url` to Form for a legacy unbound model. `setData` accepts a complete object/updater or a typed field/value pair. `hasChanges`, `recentlySuccessful` (two seconds), selective `reset`/`clearErrors`, and `clearError` describe and reset state. A successful bound JSON submission becomes the new defaults. `Form` displays field/action errors (customizable with `renderError`), respects quota retry deadlines, and never automatically resubmits. The typed `action(url, options)` helper performs a single action through the initialized Pages router. Cancellation does not undo server writes.
83
89
 
84
90
  Head resolution and escaping follow Void. The adapter synchronizes document attributes and inert script metadata; navigation does not execute newly inserted scripts. Raw `script.innerHTML` is authored content. Serialize dynamic JSON-LD and escape `<` before assigning it.
85
91
 
92
+ If a page or layout throws during browser rendering, the visit rejects and navigation returns to idle. The URL and head remain on the last successful page. Recovery rebuilds that page and its layouts, resetting their local component state; a later visit can proceed normally. State preservation during successful navigation is unchanged.
93
+
94
+ ### Multipart forms (unreleased)
95
+
96
+ JSON remains the default: `<Form form={form}>` sends `form.data`. Opt into browser form fields with `encType="multipart/form-data"`. Give inputs a `name`; files, repeated names and the clicked submit button are included without converting them into a JSON object.
97
+
98
+ ```tsx
99
+ const form = useForm('/profile?save', { name: 'Initial' });
100
+ return <Form form={form} encType="multipart/form-data">
101
+ <input name="name" value="Native field" />
102
+ <input name="files" type="file" multiple />
103
+ <button name="intent" value="save">Save</button>
104
+ </Form>;
105
+ ```
106
+
107
+ For direct calls use `form.post(data)` on a bound form, `form.post('/profile?save', data)` with an explicit URL, or `form.submit('patch', data)`. All four mutation methods accept FormData. Unbound forms require a URL. For an island, use `useIslandForm(defaults)` and `<Form form={form} url="/profile?save" encType="multipart/form-data">`.
108
+
109
+ The adapter snapshots FormData at submission and leaves `Content-Type` unset so fetch generates the multipart boundary. Validation retains native field/file values. FormData submission does not replace the JSON model or its defaults: `data`, `hasChanges` and `reset()` continue to describe the JSON model, not uncontrolled DOM/file inputs. Use the native form's reset operation to clear those controls. Cancellation prevents a late response from updating the view, but cannot undo a server write.
110
+
111
+ Full Pages multipart uses a dedicated same-origin mutation request followed by **one explicit GET** through Void's public router on success. Void's public engine cannot consume a raw multipart body or an externally fetched page shell. The GET commits through normal Hono rendering, history, layout/head, navigation state and cancellation checks while preserving component state. It also reruns loaders and may re-evaluate deferred data; the resolved-deferred retention contract for JSON mutations does not apply to multipart. The destination must support a GET. Island multipart retains its existing success behavior: reload or redirect the document.
112
+
113
+ This API is part of the release preparation branch and is not in published alpha.4. It does not add a multipart-capable public transport hook to Void or change the one-shot `action()` helper's body contract.
114
+
86
115
  ## Static output and prerendering
87
116
 
88
117
  Set `output: 'static'` in `void.config.ts`, then run `vite build`. Void collects known page routes and dynamic `getPrerenderPaths()` results and generates HTML plus `/_void/pages/*.json` under `dist/client`. The Hono adapter supplies its renderer and enables the shared router's static-data mode. It adds no route crawler.
@@ -97,7 +126,7 @@ export const loader = defineHandler((c) => ({ id: c.req.param('id') }));
97
126
 
98
127
  Known routes auto-prerender in static output. `prerender = true` explicitly selects a route; `prerender = false` excludes it. Excluded routes and undeclared dynamic paths have no generated HTML or page-data file and require a server to work. Serve `dist/client` with clean URL mapping such as `/users/alice` to `users/alice.html`, including the generated assets and `/_void/pages` JSON files. Direct requests, reload and counters use the generated output; Pages links fetch the static JSON and keep the document.
99
128
 
100
- Actions and named actions require a server. The plugin rejects them during static discovery. Deferred props are unsupported in static output and produce an explicit renderer error. Void 0.26.1 reports failed prerender paths as warnings, continues the build, and omits that path's HTML; verify the expected file set before release. The consumer check exercises both diagnostics and rejects any unexpected prerender failures in the supported fixture.
129
+ Actions and named actions require a server. The plugin rejects them during static discovery. Deferred props are unsupported in static output and produce an explicit renderer error. The tested Void runtime reports failed prerender paths as warnings, continues the build, and omits that path's HTML; verify the expected file set before release. The consumer check exercises both diagnostics and rejects any unexpected prerender failures in the supported fixture.
101
130
 
102
131
  `fixtures/static` demonstrates loader-backed counters, declared dynamic paths and true/false overrides. `scripts/check-static-consumer.mjs`, called by `npm run check:consumer`, builds with Void's own collection and serves only generated files. ISR, CDN configuration and managed deployment are separate follow-up work.
103
132
 
@@ -118,11 +147,11 @@ The server renders immediate props and a loading state before the resolver compl
118
147
 
119
148
  A resolved value or error updates the current page without resetting page-local state or surviving layouts. Updates from a pending page are ignored until that page commits. Void aborts and disposes old navigation resources; the adapter additionally accepts only updates belonging to the rendered props object.
120
149
 
121
- Void 0.26.1 forwards ordinary deferred resolver error messages in development; production streams use `Internal Server Error`. Deliberate HTTP exception messages may be forwarded in production. The adapter turns the received message into an `Error` and exposes it through `error`; server stack traces are not included. Author deliberate HTTP exception messages suitable for display to users. This follows the verified streaming error behavior of the pinned Void version.
150
+ The tested Void runtime forwards ordinary deferred resolver error messages in development; production streams use `Internal Server Error`. Deliberate HTTP exception messages may be forwarded in production. The adapter turns the received message into an `Error` and exposes it through `error`; server stack traces are not included. Author deliberate HTTP exception messages suitable for display to users. This follows the verified streaming error behavior of the pinned Void version.
122
151
 
123
- The verified contract covers single deferred props during GET document requests and SPA navigation. Grouped deferred props, deferred prefetching, mutation-driven deferred refresh and deferred island pages are excluded. The ordinary Pages action APIs remain documented under runtime exports.
152
+ For JSON actions, the verified contract covers single and grouped deferred props during GET document requests and SPA navigation, successful prefetch followed by a visit, and retention of resolved values after actions. Void preserves these values until the next load/navigation; mutation actions do not rerun the deferred resolver. Failed deferred prefetch currently becomes a resolved `null` because Void does not transmit its error; use document/SPA streaming when error state is required. Grouped resolver projections require explicit prop types with the current Void `defer<T>` declaration. Deferred island pages and static deferred output remain unsupported. The ordinary Pages action APIs remain documented under runtime exports.
124
153
 
125
- ## Load-policy islands
154
+ ## Islands
126
155
 
127
156
  Use a `.island.tsx` or `.island.jsx` page for static server content and import an interactive component using Void's import attribute:
128
157
 
@@ -138,7 +167,30 @@ Place the counter outside the pages directory. It can use Hono hooks and event h
138
167
 
139
168
  A static-only island page emits no client script or module preload tags. Static page modules stay outside the normal Pages browser manifest. A project containing only static island pages builds empty client entry modules with no framework code. Void's own automatic prerender policy still applies to eligible island pages. Full static output and explicit prerender configuration follow the static output contract below.
140
169
 
141
- Only the `load` policy, a single default relative TSX/JSX import, and attributes directly in the island page are supported. Other policies and malformed imports fail during discovery. Island layouts, nested attributed imports and island form helpers are unsupported. Direct imports of `void-plugin-hono-jsx/form` in an island page or component fail with a diagnostic; `useForm` also requires a full Pages provider at runtime. Use ordinary document links in static island pages. Pages navigation falls back to a document request for island routes. Static layouts remain server content and do not retain interactive state.
170
+ The `load`, `visible`, `idle` and `media:(query)` policies use Void's shared scheduler. Use a single default relative TSX/JSX import, with attributes directly in the island page. Unknown policies and obvious malformed media queries fail discovery; the browser checks the media query through CSSOM before scheduling. Each island mounts once when its condition is met. Island layouts and attributed imports in their static TSX/JSX component graph are supported, including named layouts and repeated components with independent JSON props. The graph handles cycles and invalidates island entries when a known static component changes. Static chains without interactive imports emit no client script. Interactive components form a boundary: use ordinary imports inside them; another attributed island inside an already interactive component is rejected to avoid overlapping mounts. Full Pages cannot inherit an island layout (Void diagnoses the mixed mode). `useIslandForm(defaults)` provides the same data/dirty/error/submit/reset/clear state without a Pages provider. Submit to an explicit same-origin URL, or use `<Form form={form} url="/blog?save">`. Island success reloads or redirects the document, so state is rebuilt from SSR props. Duplicate submissions are suppressed; cancellation aborts the owned fetch but does not roll back a server write. Fields are sent as JSON by default; explicit FormData/multipart is described above. Ordinary `useForm` and the one-shot Pages `action` still require full Pages; use named imports of `useIslandForm`/`Form` in islands. Pages-only form imports (`useForm`, `action`) and ambiguous namespace/default form imports fail with a diagnostic in an island page or component. `useForm` also requires a full Pages provider at runtime. Use ordinary document links in static island pages. Pages navigation falls back to a document request for island routes. Static layouts remain server content and do not retain interactive state.
171
+
172
+ ## Optional Markdown
173
+
174
+ For this source and its Void 1.1 baseline, use the RC after approval or the local tarball steps above. Published alpha.4 has the Markdown exports but retains its earlier Void 0.x contract; alpha.3 predates this API. Add parser peers explicitly only when using Markdown:
175
+
176
+ ```sh
177
+ npm install markdown-exit@1.3.0 yaml@2.9.1
178
+ ```
179
+
180
+ ```ts
181
+ import { defineConfig } from 'vite';
182
+ import { voidPlugin } from 'void';
183
+ import { voidHonoJsx } from 'void-plugin-hono-jsx/plugin';
184
+ import { voidHonoMarkdown } from 'void-plugin-hono-jsx/markdown/plugin';
185
+
186
+ export default defineConfig({
187
+ plugins: [voidPlugin(), voidHonoJsx(), voidHonoMarkdown()],
188
+ });
189
+ ```
190
+
191
+ Create `.md` files in the Pages directory. Standard Markdown, tables, authored HTML, fenced code, heading anchors, YAML frontmatter, companion server loaders and TSX/JSX layouts are supported. Import `useFrontmatter()`, `useMarkdownHeadings()` and `useMarkdownProps()` from `void-plugin-hono-jsx/markdown` in layouts or islands. A leading `<script>` block before frontmatter may contain page-specific browser code and default relative TSX/JSX island imports. Islands use literal props and the load/visible/idle/media policies, including canonical identities for symlinked components. Frontmatter must be a JSON-serializable mapping; duplicate keys, invalid YAML and cycles fail compilation.
192
+
193
+ Markdown routes use document navigation, and static-only pages emit no executable script. Interactive/script pages reload on development edits; zero-script pages need a normal refresh. Raw HTML is preserved for repository-authored content, without sanitization for untrusted input. Markdown layout files, JSX-expression/tag-child island props, Shiki themes, footnotes, custom containers and a page-catalog virtual module are unsupported. Do not also configure `@void/md/plugin`. Ordinary Pages users do not need these parser peers. See the repository's [Markdown guide](https://github.com/ts-76/void-plugin-hono-jsx/blob/main/docs/markdown.md) for page examples, metadata scoping and the complete contract.
142
194
 
143
195
  ## Experimental limitations
144
196
 
@@ -146,13 +198,15 @@ The virtual renderer/client entries follow version-specific conventions observed
146
198
 
147
199
  ## Known upstream dependency advisory
148
200
 
201
+ The RC preparation reassessment on 2026-10-17 found the same single esbuild advisory on Void 1.1.11 in both supported consumers, including optional Markdown: Moderate 5 propagated entries, High/Critical 0. Its development-server path is outside the reviewed transform/loader path. No override is added. New or changed findings block upload, and fresh checks are required for every final candidate. The package does not ship the publisher tooling; its separate scoped findings do not imply a zero consumer audit. See the repository's `docs/rc-security-assessment.md` for evidence and limits.
202
+
149
203
  The initial alpha accepts [GHSA-67mh-4wv8-2f99](https://github.com/advisories/GHSA-67mh-4wv8-2f99) as a known limitation on the pinned peer baseline. The reviewed audits on 2026-10-11 reported Moderate findings propagated across multiple package entries from this single esbuild advisory; package-entry counts can differ between audit reports. The affected esbuild 0.18.20 is installed through Void 0.26.1 → drizzle-kit 0.31.11 → @esbuild-kit/esm-loader 2.6.5 → @esbuild-kit/core-utils 3.3.2.
150
204
 
151
205
  The advisory concerns esbuild's own development server. The adapter uses Vite/Oxc for JSX and TypeScript for package compilation; the inspected upstream loader uses esbuild transforms. No esbuild serve invocation was found in the adapter or these loader modules, but other upstream commands and consumer configurations have not been exhaustively assessed. Avoid the affected esbuild serve feature. This is an accepted audit finding, not a claim of overall security or an audit-zero result.
152
206
 
153
207
  The package adds no overrides and does not force changes to Void's internal dependencies. Consumers install the framework peers and their dependencies even though this archive contains no dependency implementation. Follow compatible upstream fixes; a peer upgrade requires renewed validation. New unreviewed advisories continue to block release preparation policy.
154
208
 
155
- The scaffold Vite Plus 0.1.24 additionally brings `oxfmt 0.52.0 → tinypool 2.1.0`. On 2026-10-12 its consumer audit reported three propagated Critical package entries from [GHSA-5gmw-xhrv-c9v3](https://github.com/advisories/GHSA-5gmw-xhrv-c9v3) and [GHSA-85c8-ppgw-ccpr](https://github.com/advisories/GHSA-85c8-ppgw-ccpr). These require prototype pollution followed by pool worker creation/run options; `oxfmt/dist/cli.js` imports Tinypool. Dev/build/preview worked, but that does not prove formatter paths safe. These advisories are unapproved and continue to block that stack's release plan. Prefer latest Vite Plus 1.1.0 with its aligned alias or plain Vite; both retain only the existing esbuild advisory in reviewed audits. No tinypool override or security exception was added. See the repository `docs/scaffold-compatibility.md` for the complete matrix and audit assessment.
209
+ The historical scaffold Vite Plus 0.1.24 brings unapproved tinypool Critical findings. It is outside the RC support range; use the tested Vite Plus 1.3.0/core alias or plain Vite 8.3.4. Old functional CI success does not accept those findings. See the repository `docs/scaffold-compatibility.md` for historical evidence.
156
210
 
157
211
  ## Verification
158
212
 
@@ -166,7 +220,7 @@ Page and companion-loader edits reload the document and reset page/layout state.
166
220
 
167
221
  In development, the SSR renderer eagerly imports server-rendered page and layout modules with their providers. This keeps in-flight requests within the same module generation during a reload. Server-side module initialization therefore happens when the renderer loads, including pages not yet visited. Browser-only page components are excluded from this server graph. Production keeps lazy component imports. The packed-consumer regression also sends parallel SSR requests during six simultaneous page/loader revisions and requires every response to succeed.
168
222
 
169
- The packed-consumer check edits a page, changes its loader value, adds and removes a route, checks counter interaction after reloading, and asserts that the server stays running. It also verifies resolved dependency paths and rejection of an unsupported running Vite even when a supported npm Vite is installed. Five locked consumers cover the original baseline, the Vite patch update, latest Void with plain Vite, the scaffold Vite Plus, and latest Vite Plus on Node 24.21.0. The existing required baseline context aggregates all five results. It also runs `npm run check:source` for navigation, persistent layouts, action forms and head metadata in development and production preview. Inspect the GitHub Actions result on the commit being reviewed.
223
+ The packed-consumer check edits pages/loaders, adds/removes routes and verifies interaction without restarting the server. It rejects old Void lines and an unsupported running Vite even when installed metadata is supported. Both required consumers use Node 24.21.0/Void 1.1.11: plain Vite 8.3.4 and Vite Plus/core 1.3.0. They run the complete dev/build/preview/browser/static/islands/deferred/Markdown/local-ISR checks on identical packed bytes. Local ISR checks do not guarantee production ISR.
170
224
 
171
225
  ## Local ISR
172
226
 
@@ -176,4 +230,8 @@ The fixture binds local `ISR_CACHE` storage for Void production preview. Real de
176
230
 
177
231
  ## Known local development limitation
178
232
 
179
- On the tested macOS Void/Miniflare development runtime, a POST to an undefined named action can reset the next request on a reused connection. Declared-action browser behavior is verified; this transport edge case remains unresolved upstream. Managed runtime behavior for the edge case is unverified. Review this limitation before adopting the initial alpha.
233
+ On the tested macOS Void/Miniflare development runtime, a POST to an undefined named action can reset the next request on a reused connection. Declared-action browser behavior is verified; this transport edge case remains unresolved upstream. Managed runtime behavior for the edge case is unverified. This historical local limitation must be rechecked on the selected RC baseline; it is not evidence about managed production behavior.
234
+
235
+ ## RC and normal-release policy
236
+
237
+ The planned first candidate is 0.1.0-rc.0 on next, followed by 0.1.0 after public-consumer and real Workers verification. It is not yet a published-release claim. Production ISR remains outside the initial guarantee. Patches in 0.1.x preserve documented APIs; breaking changes move to 0.2.0 or later. Read the [release contract](https://github.com/ts-76/void-plugin-hono-jsx/blob/main/docs/release-contract.md) and [security policy](https://github.com/ts-76/void-plugin-hono-jsx/blob/main/SECURITY.md). Report vulnerabilities [privately](https://github.com/ts-76/void-plugin-hono-jsx/security/advisories/new).
@@ -2,9 +2,9 @@
2
2
 
3
3
  The renderer/client entry conventions and provider integration were adapted from the published `@void/react` 0.26.0 adapter and Void 0.26.0. Both distributions include the following MIT notice. Hono is a peer dependency; its notice is included for reference. The project is separately licensed under MIT; these notices preserve upstream copyright attribution.
4
4
 
5
- ## Void and @void/react
5
+ ## Void, @void/react and @void/md
6
6
 
7
- Source distributions: `void@0.26.0` and `@void/react@0.26.0`, published npm packages. The adapter imports framework APIs rather than bundling the framework.
7
+ Source distributions: `void@0.26.0` and `@void/react@0.26.0`, published npm packages. Link, prefetch lifecycle and form API behavior also reference the published `@void/react@0.27.0` adapter. Hono's render/navigation integration uses the public `void@0.26.1` / `void@0.27.0` navigation engine and router facade, with lifecycle behavior adapted from Void's router. Markdown script extraction, component-tag splitting and entry conventions reference the published `@void/md@0.27.0` implementation; its MIT attribution is preserved here. Markdown parsing uses the public `markdown-exit` and `yaml` APIs as optional peers. No private `@void/md` module is imported. The adapter imports framework APIs rather than bundling the framework.
8
8
 
9
9
  MIT License
10
10
 
@@ -1,5 +1,6 @@
1
1
  import { type VoidRouterConfig } from 'void/pages-client';
2
+ type NavigationOptions = Pick<VoidRouterConfig, 'viewTransitions' | 'prefetchHoverDelay' | 'prefetchDefaultCacheFor'>;
2
3
  type Manifest = Pick<VoidRouterConfig, 'components' | 'layoutTree' | 'routeMeta' | 'matchRoute' | 'staticPageData' | 'staticPageDataFastPath'>;
3
- export declare function startHonoPages(manifest: Manifest): Promise<void>;
4
+ export declare function startHonoPages(manifest: Manifest, options: NavigationOptions): Promise<void>;
4
5
  export {};
5
6
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/runtime/client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAM5E,KAAK,QAAQ,GAAG,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,gBAAgB,GAAG,wBAAwB,CAAC,CAAC;AAO/I,wBAAsB,cAAc,CAAC,QAAQ,EAAE,QAAQ,iBAkEtD"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/runtime/client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA6C,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAMrG,KAAK,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,EAAE,iBAAiB,GAAG,oBAAoB,GAAG,yBAAyB,CAAC,CAAC;AAEtH,KAAK,QAAQ,GAAG,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,gBAAgB,GAAG,wBAAwB,CAAC,CAAC;AAO/I,wBAAsB,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,iBA0GlF"}
@@ -1,10 +1,10 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/dom/jsx-runtime";
2
- import { render } from 'hono/jsx/dom';
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "hono/jsx/dom/jsx-runtime";
2
+ import { ErrorBoundary, render } from 'hono/jsx/dom';
3
3
  import { jsx } from 'hono/jsx/dom/jsx-runtime';
4
4
  import { useLayoutEffect, useState } from 'hono/jsx';
5
- import { createVoidRouter } from 'void/pages-client';
6
- import { parseCacheFor } from 'void/pages-prefetch';
7
- import { PageContext, RouterContext } from "void-plugin-hono-jsx/pages";
5
+ import { idleNavigationState } from 'void/pages-client';
6
+ import { PageContext, RouterContext, NavigationContext, setActionRouter } from "void-plugin-hono-jsx/pages";
7
+ import { createHonoRouter } from './navigation.js';
8
8
  import { createDocumentHead } from './document-head.js';
9
9
  import { createDeferred, resolveDeferred, rejectDeferred, isLoading, bufferInitialDeferred } from './deferred.js';
10
10
  function pageComponent(component) {
@@ -12,16 +12,22 @@ function pageComponent(component) {
12
12
  throw new Error('Hono Pages: a page must export a component function.');
13
13
  return component;
14
14
  }
15
- export async function startHonoPages(manifest) {
15
+ export async function startHonoPages(manifest, options) {
16
16
  const root = document.getElementById('app');
17
17
  if (!root)
18
18
  throw new Error('Hono Pages: app root is missing.');
19
19
  let update;
20
20
  let revision = 0;
21
+ let commit = 0;
22
+ const pendingCommits = new Map();
23
+ let committedFrame;
24
+ const failedFrames = new Set();
25
+ let navigationState = idleNavigationState();
26
+ let updateNavigation;
21
27
  let applyDocumentHead;
22
28
  let renderedProps;
23
29
  let updateDeferred;
24
- const initialization = createVoidRouter({
30
+ const initialization = createHonoRouter({
25
31
  ...manifest,
26
32
  adapter: {
27
33
  createDeferred, resolveDeferred, rejectDeferred, isLoading,
@@ -37,37 +43,85 @@ export async function startHonoPages(manifest) {
37
43
  if (!options.preserveState)
38
44
  revision++;
39
45
  renderedProps = page.props;
40
- update({ page: { ...page, props: { ...page.props } }, component, layouts, revision });
41
- await new Promise((resolve) => requestAnimationFrame(() => resolve()));
42
- applyDocumentHead?.(page.head);
46
+ const nextCommit = ++commit;
47
+ const committed = new Promise((resolve, reject) => pendingCommits.set(nextCommit, { resolve, reject }));
48
+ update({ page: { ...page, props: { ...page.props } }, sourceProps: page.props, component, layouts, revision, commit: nextCommit });
49
+ await committed;
43
50
  },
44
51
  },
45
- viewTransitions: false,
46
- prefetchHoverDelay: 75,
47
- prefetchDefaultCacheFor: parseCacheFor('30s'),
52
+ ...options,
48
53
  cacheVisitedPageData: false,
49
- onNavigationChange(state) { root.dataset.navigation = state.state; },
54
+ onNavigationChange(state) { navigationState = state; updateNavigation?.(state); root.dataset.navigation = state.state; },
50
55
  });
51
56
  const releaseBuffer = bufferInitialDeferred();
52
57
  const navigation = await initialization.finally(releaseBuffer);
58
+ setActionRouter(navigation.router);
53
59
  renderedProps = navigation.initialPageData.props;
54
60
  applyDocumentHead = createDocumentHead(navigation.initialPageData.head);
61
+ const initialFrame = { page: { ...navigation.initialPageData, props: { ...navigation.initialPageData.props } }, sourceProps: navigation.initialPageData.props, component: navigation.initialComponent, layouts: navigation.initialLayouts, revision, commit };
62
+ function PageFrame({ frame }) {
63
+ useLayoutEffect(() => {
64
+ if (failedFrames.has(frame.commit))
65
+ return;
66
+ if (frame.commit > 0)
67
+ applyDocumentHead?.(frame.page.head);
68
+ committedFrame = frame;
69
+ for (const id of failedFrames)
70
+ if (id < frame.commit)
71
+ failedFrames.delete(id);
72
+ for (const [id, pending] of pendingCommits)
73
+ if (id <= frame.commit) {
74
+ pendingCommits.delete(id);
75
+ pending.resolve();
76
+ }
77
+ }, [frame]);
78
+ let content = jsx(pageComponent(frame.component), frame.page.props, String(frame.revision));
79
+ const ids = manifest.layoutTree[frame.page.component] ?? [];
80
+ for (let index = frame.layouts.length - 1; index >= 0; index--) {
81
+ content = jsx(pageComponent(frame.layouts[index]), { children: content }, ids[index]);
82
+ }
83
+ return _jsx(PageContext.Provider, { value: frame.page, children: content });
84
+ }
55
85
  function App() {
56
- const [frame, setFrame] = useState({ page: { ...navigation.initialPageData, props: { ...navigation.initialPageData.props } }, component: navigation.initialComponent, layouts: navigation.initialLayouts, revision });
86
+ const [frame, setFrame] = useState(initialFrame);
87
+ const [pendingNavigation, setNavigation] = useState(navigationState);
57
88
  const [failed, setFailed] = useState(false);
89
+ const [recovery, setRecovery] = useState(0);
58
90
  useLayoutEffect(() => {
91
+ updateNavigation = setNavigation;
92
+ setNavigation(navigationState);
59
93
  updateDeferred = (props) => setFrame((frame) => ({ ...frame, page: { ...frame.page, props } }));
60
94
  update = (next) => { setFailed(false); setFrame(next); };
61
95
  const onError = () => setFailed(true);
62
96
  window.addEventListener('hono-pages:navigation-error', onError);
63
- return () => { update = undefined; updateDeferred = undefined; window.removeEventListener('hono-pages:navigation-error', onError); };
97
+ return () => { for (const pending of pendingCommits.values())
98
+ pending.reject(new DOMException('Hono Pages: renderer unmounted.', 'AbortError')); pendingCommits.clear(); updateNavigation = undefined; update = undefined; updateDeferred = undefined; window.removeEventListener('hono-pages:navigation-error', onError); };
64
99
  }, []);
65
- let content = jsx(pageComponent(frame.component), frame.page.props, String(frame.revision));
66
- const ids = manifest.layoutTree[frame.page.component] ?? [];
67
- for (let index = frame.layouts.length - 1; index >= 0; index--) {
68
- content = jsx(pageComponent(frame.layouts[index]), { children: content }, ids[index]);
69
- }
70
- return _jsx(RouterContext.Provider, { value: navigation.router, children: _jsxs(PageContext.Provider, { value: frame.page, children: [failed && _jsx("p", { role: "alert", children: "The page could not be loaded. Please try again." }), content] }) });
100
+ const renderFailed = (error) => {
101
+ if (failedFrames.has(frame.commit))
102
+ return;
103
+ failedFrames.add(frame.commit);
104
+ queueMicrotask(() => {
105
+ // A rejected child never reaches PageFrame's commit effect. Roll back
106
+ // outside the render traversal, then reject every coalesced waiter.
107
+ if (commit === frame.commit) {
108
+ if (committedFrame) {
109
+ renderedProps = committedFrame.sourceProps;
110
+ setFrame(committedFrame);
111
+ }
112
+ // Discard the partially built Hono tree only after a render failure.
113
+ // Successful navigations keep the same boundary and layout state.
114
+ setRecovery(value => value + 1);
115
+ setFailed(true);
116
+ }
117
+ for (const [id, pending] of pendingCommits)
118
+ if (id <= frame.commit) {
119
+ pendingCommits.delete(id);
120
+ pending.reject(error);
121
+ }
122
+ });
123
+ };
124
+ return _jsx(RouterContext.Provider, { value: navigation.router, children: _jsxs(NavigationContext.Provider, { value: pendingNavigation, children: [failed && _jsx("p", { role: "alert", children: "The page could not be loaded. Please try again." }), _jsx(ErrorBoundary, { onError: renderFailed, fallback: _jsx(_Fragment, {}), children: _jsx(PageFrame, { frame: frame }) }, recovery)] }) });
71
125
  }
72
126
  render(_jsx(App, {}), root);
73
127
  navigation.start();
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B;AAC9C,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,UAAU;AACpD,OAAO,EAAE,gBAAgB,EAAyB,MAAM,mBAAmB;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB;AACnD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,4BAAa;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB;AACvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,eAAe;AAIjH,SAAS,aAAa,CAAC,SAAkB;IACvC,IAAI,OAAO,SAAS,KAAK,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC;IAC5G,OAAO,SAAS;AAClB;AAEA,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,QAAkB;IACrD,MAAM,IAAI,GAAG,QAAQ,CAAC,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port { jsx } from 'hono/jsx/dom/jsx-runtime';\nimport { useLayoutEffect, useState } from 'hono/jsx';\nimport { createVoidRouter, type VoidRouterConfig } from 'void/pages-client';\nimport { parseCacheFor } from 'void/pages-prefetch';\nimport { PageContext, RouterContext } from './pages.tsx';\nimport { createDocumentHead } from './document-head.ts';\nimport { createDeferred, resolveDeferred, rejectDeferred, isLoading, bufferInitialDeferred } from './deferred.ts';\n\ntype Manifest = Pick<VoidRouterConfig, 'components' | 'layoutTree' | 'routeMeta' | 'matchRoute' | 'staticPageData' | 'staticPageDataFastPath'>;\n\nfunction pageComponent(component: unknown) {\n if (typeof component !== 'function') throw new Error('Hono Pages: a page must export a component function.');\n return component;\n}\n\nexport async function startHonoPages(manifest: Manifest) {\n const root = document.getElementById('app');\n if (!root) throw new Error('Hono Pages: app root is missing.');\n type Frame = { page: Awaited<ReturnType<typeof createVoidRouter>>['initialPageData']; component: unknown; layouts: unknown[]; revision: number };\n let update: ((frame: Frame) => void) | undefined;\n let revision = 0;\n let applyDocumentHead: ReturnType<typeof createDocumentHead> | undefined;\n let renderedProps: Record<string, unknown> | undefined;\n let updateDeferred: ((props: Record<string, unknown>) => void) | undefined;\n const initialization = createVoidRouter({\n ...manifest,\n adapter: {\n createDeferred, resolveDeferred, rejectDeferred, isLoading,\n onDeferredUpdate(props) {\n if (props === renderedProps) updateDeferred?.({ ...props });\n },\n async applyUpdate(page, component, layouts, options) {\n layouts.forEach(pageComponent);\n pageComponent(component);\n if (!update) throw new Error('Hono Pages: page rendering has not started.');\n if (!options.preserveState) revision++;\n renderedProps = page.props;\n update({ page: { ...page, props: { ...page.props } }, component, layouts, revision });\n await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));\n applyDocumentHead?.(page.head);\n },\n },\n viewTransitions: false,\n prefetchHoverDelay: 75,\n prefetchDefaultCacheFor: parseCacheFor('30s'),\n cacheVisitedPageData: false,\n onNavigationChange(state) { root.dataset.navigation = state.state; },\n });\n const releaseBuffer = bufferInitialDeferred();\n const navigation = await initialization.finally(releaseBuffer);\n renderedProps = navigation.initialPageData.props;\n applyDocumentHead = createDocumentHead(navigation.initialPageData.head);\n\n function App() {\n const [frame, setFrame] = useState<Frame>({ page: { ...navigation.initialPageData, props: { ...navigation.initialPageData.props } }, component: navigation.initialComponent, layouts: navigation.initialLayouts, revision });\n const [failed, setFailed] = useState(false);\n useLayoutEffect(() => {\n updateDeferred = (props) => setFrame((frame) => ({ ...frame, page: { ...frame.page, props } }));\n update = (next) => { setFailed(false); setFrame(next); };\n const onError = () => setFailed(true);\n window.addEventListener('hono-pages:navigation-error', onError);\n return () => { update = undefined; updateDeferred = undefined; window.removeEventListener('hono-pages:navigation-error', onError); };\n }, []);\n let content = jsx(pageComponent(frame.component), frame.page.props, String(frame.revision));\n const ids = manifest.layoutTree[frame.page.component] ?? [];\n for (let index = frame.layouts.length - 1; index >= 0; index--) {\n content = jsx(pageComponent(frame.layouts[index]), { children: content }, ids[index]);\n }\n return <RouterContext.Provider value={navigation.router}>\n <PageContext.Provider value={frame.page}>\n {failed && <p role=\"alert\">The page could not be loaded. Please try again.</p>}\n {content}\n </PageContext.Provider>\n </RouterContext.Provider>;\n }\n\n render(<App />, root);\n navigation.start();\n navigation.commitInitialRender();\n root.dataset.navigation = 'idle';\n root.dataset.honoPages = 'mounted';\n}\n"]}
1
+ {"version":3,"file":"client.js","mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,cAAc;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B;AAC9C,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,UAAU;AACpD,OAAO,EAAE,mBAAmB,EAA+C,MAAM,mBAAmB;AACpG,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAAa;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB;AACvD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CAAC,KAAC,GAAG,KAAG,EAAE,IAAI,CAAC;IACrB,UAAU,CAAC,KAAK,EAAE;IAClB,UAAU,CAAC,mBAAmB,EAAE;IAChC,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM;IAChC,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS;AACpC","names":[],"ignoreList":[],"sources":["../../src/runtime/client.tsx"],"sourcesContent":["import { ErrorBoundary, render } from 'hono/jsx/dom';\nimport { jsx } from 'hono/jsx/dom/jsx-runtime';\nimport { useLayoutEffect, useState } from 'hono/jsx';\nimport { idleNavigationState, type NavigationState, type VoidRouterConfig } from 'void/pages-client';\nimport { PageContext, RouterContext, NavigationContext, setActionRouter } from './pages.tsx';\nimport { createHonoRouter } from './navigation.ts';\nimport { createDocumentHead } from './document-head.ts';\nimport { createDeferred, resolveDeferred, rejectDeferred, isLoading, bufferInitialDeferred } from './deferred.ts';\n\ntype NavigationOptions = Pick<VoidRouterConfig, 'viewTransitions' | 'prefetchHoverDelay' | 'prefetchDefaultCacheFor'>;\n\ntype Manifest = Pick<VoidRouterConfig, 'components' | 'layoutTree' | 'routeMeta' | 'matchRoute' | 'staticPageData' | 'staticPageDataFastPath'>;\n\nfunction pageComponent(component: unknown) {\n if (typeof component !== 'function') throw new Error('Hono Pages: a page must export a component function.');\n return component;\n}\n\nexport async function startHonoPages(manifest: Manifest, options: NavigationOptions) {\n const root = document.getElementById('app');\n if (!root) throw new Error('Hono Pages: app root is missing.');\n type Frame = { page: Awaited<ReturnType<typeof createHonoRouter>>['initialPageData']; sourceProps: Record<string, unknown>; component: unknown; layouts: unknown[]; revision: number; commit: number };\n let update: ((frame: Frame) => void) | undefined;\n let revision = 0;\n let commit = 0;\n const pendingCommits = new Map<number, { resolve(): void; reject(error: unknown): void }>();\n let committedFrame: Frame | undefined;\n const failedFrames = new Set<number>();\n let navigationState = idleNavigationState();\n let updateNavigation: ((state: NavigationState) => void) | undefined;\n let applyDocumentHead: ReturnType<typeof createDocumentHead> | undefined;\n let renderedProps: Record<string, unknown> | undefined;\n let updateDeferred: ((props: Record<string, unknown>) => void) | undefined;\n const initialization = createHonoRouter({\n ...manifest,\n adapter: {\n createDeferred, resolveDeferred, rejectDeferred, isLoading,\n onDeferredUpdate(props) {\n if (props === renderedProps) updateDeferred?.({ ...props });\n },\n async applyUpdate(page, component, layouts, options) {\n layouts.forEach(pageComponent);\n pageComponent(component);\n if (!update) throw new Error('Hono Pages: page rendering has not started.');\n if (!options.preserveState) revision++;\n renderedProps = page.props;\n const nextCommit = ++commit;\n const committed = new Promise<void>((resolve, reject) => pendingCommits.set(nextCommit, { resolve, reject }));\n update({ page: { ...page, props: { ...page.props } }, sourceProps: page.props, component, layouts, revision, commit: nextCommit });\n await committed;\n },\n },\n ...options,\n cacheVisitedPageData: false,\n onNavigationChange(state) { navigationState = state; updateNavigation?.(state); root.dataset.navigation = state.state; },\n });\n const releaseBuffer = bufferInitialDeferred();\n const navigation = await initialization.finally(releaseBuffer);\n setActionRouter(navigation.router);\n renderedProps = navigation.initialPageData.props;\n applyDocumentHead = createDocumentHead(navigation.initialPageData.head);\n\n const initialFrame: Frame = { page: { ...navigation.initialPageData, props: { ...navigation.initialPageData.props } }, sourceProps: navigation.initialPageData.props, component: navigation.initialComponent, layouts: navigation.initialLayouts, revision, commit };\n function PageFrame({ frame }: { frame: Frame }) {\n useLayoutEffect(() => {\n if (failedFrames.has(frame.commit)) return;\n if (frame.commit > 0) applyDocumentHead?.(frame.page.head);\n committedFrame = frame;\n for (const id of failedFrames) if (id < frame.commit) failedFrames.delete(id);\n for (const [id, pending] of pendingCommits) if (id <= frame.commit) { pendingCommits.delete(id); pending.resolve(); }\n }, [frame]);\n let content = jsx(pageComponent(frame.component), frame.page.props, String(frame.revision));\n const ids = manifest.layoutTree[frame.page.component] ?? [];\n for (let index = frame.layouts.length - 1; index >= 0; index--) {\n content = jsx(pageComponent(frame.layouts[index]), { children: content }, ids[index]);\n }\n return <PageContext.Provider value={frame.page}>{content}</PageContext.Provider>;\n }\n\n function App() {\n const [frame, setFrame] = useState<Frame>(initialFrame);\n const [pendingNavigation, setNavigation] = useState(navigationState);\n const [failed, setFailed] = useState(false);\n const [recovery, setRecovery] = useState(0);\n useLayoutEffect(() => {\n updateNavigation = setNavigation;\n setNavigation(navigationState);\n updateDeferred = (props) => setFrame((frame) => ({ ...frame, page: { ...frame.page, props } }));\n update = (next) => { setFailed(false); setFrame(next); };\n const onError = () => setFailed(true);\n window.addEventListener('hono-pages:navigation-error', onError);\n return () => { for (const pending of pendingCommits.values()) pending.reject(new DOMException('Hono Pages: renderer unmounted.', 'AbortError')); pendingCommits.clear(); updateNavigation = undefined; update = undefined; updateDeferred = undefined; window.removeEventListener('hono-pages:navigation-error', onError); };\n }, []);\n const renderFailed = (error: unknown) => {\n if (failedFrames.has(frame.commit)) return;\n failedFrames.add(frame.commit);\n queueMicrotask(() => {\n // A rejected child never reaches PageFrame's commit effect. Roll back\n // outside the render traversal, then reject every coalesced waiter.\n if (commit === frame.commit) {\n if (committedFrame) { renderedProps = committedFrame.sourceProps; setFrame(committedFrame); }\n // Discard the partially built Hono tree only after a render failure.\n // Successful navigations keep the same boundary and layout state.\n setRecovery(value => value + 1);\n setFailed(true);\n }\n for (const [id, pending] of pendingCommits) if (id <= frame.commit) { pendingCommits.delete(id); pending.reject(error); }\n });\n };\n return <RouterContext.Provider value={navigation.router}>\n <NavigationContext.Provider value={pendingNavigation}>\n {failed && <p role=\"alert\">The page could not be loaded. Please try again.</p>}\n <ErrorBoundary key={recovery} onError={renderFailed} fallback={<></>}>\n <PageFrame frame={frame} />\n </ErrorBoundary>\n </NavigationContext.Provider>\n </RouterContext.Provider>;\n }\n\n render(<App />, root);\n navigation.start();\n navigation.commitInitialRender();\n root.dataset.navigation = 'idle';\n root.dataset.honoPages = 'mounted';\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  import type { HeadDescriptor } from 'void';
2
- /** Complements Void's title/meta/link updates without executing navigation scripts. */
2
+ /** Synchronizes the snapshot before Void's idempotent post-render head commit. */
3
3
  export declare function createDocumentHead(initial: HeadDescriptor | undefined): (head: HeadDescriptor | undefined) => void;
4
4
  //# sourceMappingURL=document-head.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document-head.d.ts","sourceRoot":"","sources":["../../src/runtime/document-head.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAY3C,uFAAuF;AACvF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,UAgBtD,cAAc,GAAG,SAAS,UAazC"}
1
+ {"version":3,"file":"document-head.d.ts","sourceRoot":"","sources":["../../src/runtime/document-head.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAgB3C,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,UAgBtD,cAAc,GAAG,SAAS,UA4BzC"}