void-plugin-hono-jsx 0.1.0-alpha.1 → 0.1.0-alpha.3

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 (61) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +42 -12
  3. package/dist/browser/client.d.ts +1 -0
  4. package/dist/browser/client.d.ts.map +1 -0
  5. package/dist/browser/client.js +1 -0
  6. package/dist/browser/client.js.map +1 -0
  7. package/dist/browser/deferred.d.ts +1 -0
  8. package/dist/browser/deferred.d.ts.map +1 -0
  9. package/dist/browser/deferred.js +1 -0
  10. package/dist/browser/deferred.js.map +1 -0
  11. package/dist/browser/document-head.d.ts +1 -0
  12. package/dist/browser/document-head.d.ts.map +1 -0
  13. package/dist/browser/document-head.js +1 -0
  14. package/dist/browser/document-head.js.map +1 -0
  15. package/dist/browser/form.d.ts +1 -0
  16. package/dist/browser/form.d.ts.map +1 -0
  17. package/dist/browser/form.js +1 -0
  18. package/dist/browser/form.js.map +1 -0
  19. package/dist/browser/pages.d.ts +1 -0
  20. package/dist/browser/pages.d.ts.map +1 -0
  21. package/dist/browser/pages.js +1 -0
  22. package/dist/browser/pages.js.map +1 -0
  23. package/dist/plugins/compatibility.d.ts +13 -1
  24. package/dist/plugins/compatibility.d.ts.map +1 -0
  25. package/dist/plugins/compatibility.js +66 -22
  26. package/dist/plugins/compatibility.js.map +1 -0
  27. package/dist/plugins/hono-islands.d.ts +1 -0
  28. package/dist/plugins/hono-islands.d.ts.map +1 -0
  29. package/dist/plugins/hono-islands.js +1 -0
  30. package/dist/plugins/hono-islands.js.map +1 -0
  31. package/dist/plugins/hono-jsx.d.ts +1 -0
  32. package/dist/plugins/hono-jsx.d.ts.map +1 -0
  33. package/dist/plugins/hono-jsx.js +1 -0
  34. package/dist/plugins/hono-jsx.js.map +1 -0
  35. package/dist/plugins/hono-pages.d.ts +2 -1
  36. package/dist/plugins/hono-pages.d.ts.map +1 -0
  37. package/dist/plugins/hono-pages.js +5 -3
  38. package/dist/plugins/hono-pages.js.map +1 -0
  39. package/dist/plugins/runtime-paths.d.ts +1 -0
  40. package/dist/plugins/runtime-paths.d.ts.map +1 -0
  41. package/dist/plugins/runtime-paths.js +13 -6
  42. package/dist/plugins/runtime-paths.js.map +1 -0
  43. package/dist/server/form.d.ts +1 -0
  44. package/dist/server/form.d.ts.map +1 -0
  45. package/dist/server/form.js +1 -0
  46. package/dist/server/form.js.map +1 -0
  47. package/dist/server/pages.d.ts +1 -0
  48. package/dist/server/pages.d.ts.map +1 -0
  49. package/dist/server/pages.js +1 -0
  50. package/dist/server/pages.js.map +1 -0
  51. package/package.json +6 -5
  52. package/src/plugins/compatibility.ts +64 -0
  53. package/src/plugins/hono-islands.ts +105 -0
  54. package/src/plugins/hono-jsx.ts +20 -0
  55. package/src/plugins/hono-pages.ts +143 -0
  56. package/src/plugins/runtime-paths.ts +14 -0
  57. package/src/runtime/client.tsx +83 -0
  58. package/src/runtime/deferred.ts +34 -0
  59. package/src/runtime/document-head.ts +44 -0
  60. package/src/runtime/form.ts +71 -0
  61. package/src/runtime/pages.tsx +45 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## [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
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * support scaffold and current framework versions ([#46](https://github.com/ts-76/void-plugin-hono-jsx/issues/46)) ([4748044](https://github.com/ts-76/void-plugin-hono-jsx/commit/4748044cea8af423a77a6e51f0494c9b6d5a9a34))
9
+
10
+ ## [0.1.0-alpha.2](https://github.com/ts-76/void-plugin-hono-jsx/compare/v0.1.0-alpha.1...v0.1.0-alpha.2) (2026-10-12)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * include package sources and valid debug maps ([#42](https://github.com/ts-76/void-plugin-hono-jsx/issues/42)) ([2a69fa5](https://github.com/ts-76/void-plugin-hono-jsx/commit/2a69fa59d903f150e7b9906419283a5906282b62))
16
+
17
+
18
+ ### Documentation
19
+
20
+ * distinguish future candidate archives from published alpha ([#45](https://github.com/ts-76/void-plugin-hono-jsx/issues/45)) ([d2740cb](https://github.com/ts-76/void-plugin-hono-jsx/commit/d2740cbb0dfff652fa17b10ff0504f5e353b4aaf))
21
+ * record published alpha as the default npm tag ([#44](https://github.com/ts-76/void-plugin-hono-jsx/issues/44)) ([8c8ea9a](https://github.com/ts-76/void-plugin-hono-jsx/commit/8c8ea9aa1d10e7ee2ff8946dea789d6b407d1680))
22
+
3
23
  ## [0.1.0-alpha.1](https://github.com/ts-76/void-plugin-hono-jsx/compare/v0.1.0-alpha.0...v0.1.0-alpha.1) (2026-10-11)
4
24
 
5
25
 
package/README.md CHANGED
@@ -1,17 +1,19 @@
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`. `0.1.0-alpha.0` is published on the `next` dist-tag under the [MIT license](LICENSE). Use `@next`; `latest` remains a registration placeholder. It is not an official Void adapter.
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.
4
4
 
5
5
  ## Supported versions
6
6
 
7
- | Dependency | Verified version |
8
- | --- | --- |
9
- | Node.js | 24.21.0 or newer |
10
- | Void | 0.26.1 |
11
- | Hono | 4.13.13 |
12
- | Vite | 8.3.3 |
7
+ | Component | Accepted stable range | Full consumer fixtures |
8
+ | --- | --- | --- |
9
+ | Node.js | >=24.21.0 | 24.21.0 |
10
+ | Void | >=0.26.1 <0.28.0 | 0.26.1, 0.27.0 |
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) |
14
+ | TypeScript | Project tooling | 7.0.2 |
13
15
 
14
- Framework packages are exact peer dependencies. Other versions have not been validated; configuration fails with an install command when Void, Hono or Vite differs from this baseline.
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.
15
17
 
16
18
  ## Install
17
19
 
@@ -19,14 +21,14 @@ Use Node 24.21.0 or newer:
19
21
 
20
22
  ```sh
21
23
  npm install void-plugin-hono-jsx@next hono@4.13.13
22
- npm install --save-dev void@0.26.1 vite@8.3.3 typescript@7.0.2
24
+ npm install --save-dev void@0.27.0 vite@8.3.4 typescript@7.0.2
23
25
  ```
24
26
 
25
27
  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:
26
28
 
27
29
  ```sh
28
- npm install ./void-plugin-hono-jsx-0.1.0-alpha.0.tgz hono@4.13.13
29
- npm install --save-dev void@0.26.1 vite@8.3.3 typescript@7.0.2
30
+ 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
30
32
  ```
31
33
 
32
34
  ## Configure
@@ -44,6 +46,32 @@ Configure project settings in `void.config.ts` using `defineConfig` from `void/c
44
46
 
45
47
  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.
46
48
 
49
+ ## Running Vite and launcher diagnostics
50
+
51
+ 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
+
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.
54
+
55
+ 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
+
57
+ ## Adapting a Void scaffold
58
+
59
+ 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
+
61
+ 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()`.
63
+ 3. Set TypeScript `jsx` to `react-jsx` and `jsxImportSource` to `hono/jsx`. Change page/component React imports and hooks to Hono JSX APIs.
64
+ 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
+ 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
+
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.
68
+
69
+ ## Source and debugging files
70
+
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.
72
+
73
+ 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
+
47
75
  ## Runtime exports
48
76
 
49
77
  ```tsx
@@ -124,6 +152,8 @@ The advisory concerns esbuild's own development server. The adapter uses Vite/Ox
124
152
 
125
153
  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.
126
154
 
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.
156
+
127
157
  ## Verification
128
158
 
129
159
  `npm run check:consumer` packs the package, audits its file list, copies a fixture into a temporary directory, installs locked peer dependencies and the tarball, and checks types, development rendering, production build, preview rendering and browser interaction. The consumer uses only the documented package exports and does not import repository source files.
@@ -136,7 +166,7 @@ Page and companion-loader edits reload the document and reset page/layout state.
136
166
 
137
167
  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.
138
168
 
139
- 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 actionable diagnostics for unverified Void, Hono and Vite versions. Development and production preview are exercised on the exact baseline above; no additional framework versions are claimed. The active CI workflow covers that baseline on Node 24.21.0. 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.
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.
140
170
 
141
171
  ## Local ISR
142
172
 
@@ -2,3 +2,4 @@ import { type VoidRouterConfig } from 'void/pages-client';
2
2
  type Manifest = Pick<VoidRouterConfig, 'components' | 'layoutTree' | 'routeMeta' | 'matchRoute' | 'staticPageData' | 'staticPageDataFastPath'>;
3
3
  export declare function startHonoPages(manifest: Manifest): Promise<void>;
4
4
  export {};
5
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +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"}
@@ -75,3 +75,4 @@ export async function startHonoPages(manifest) {
75
75
  root.dataset.navigation = 'idle';
76
76
  root.dataset.honoPages = 'mounted';
77
77
  }
78
+ //# sourceMappingURL=client.js.map
@@ -0,0 +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,UAA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"sources":["../../src/runtime/client.tsx"],"sourcesContent":["import { render } from 'hono/jsx/dom';\nimport { 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"]}
@@ -11,3 +11,4 @@ declare global {
11
11
  }
12
12
  }
13
13
  export declare function bufferInitialDeferred(): () => void;
14
+ //# sourceMappingURL=deferred.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deferred.d.ts","sourceRoot":"","sources":["../../src/runtime/deferred.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAE1C,wBAAgB,cAAc,IAAI,aAAa,CAAC,KAAK,CAAC,CAErD;AACD,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,CAErF;AACD,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,CAEnF;AACD,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAE/C;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;QAC3D,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QAC1D,eAAe,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;KAClE;CACF;AACD,wBAAgB,qBAAqB,eASpC"}
@@ -20,3 +20,4 @@ export function bufferInitialDeferred() {
20
20
  window.__rejectDeferred = reject;
21
21
  };
22
22
  }
23
+ //# sourceMappingURL=deferred.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deferred.js","sourceRoot":"","sources":["../../src/runtime/deferred.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,cAAc;IAC5B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACrD,CAAC;AACD,MAAM,UAAU,eAAe,CAAC,IAAa,EAAE,KAAc;IAC3D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAChD,CAAC;AACD,MAAM,UAAU,cAAc,CAAC,IAAa,EAAE,OAAe;IAC3D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;AACpE,CAAC;AACD,MAAM,UAAU,SAAS,CAAC,GAAY;IACpC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,SAAS,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,KAAK,IAAI,CAAC;AAC7F,CAAC;AAWD,MAAM,UAAU,qBAAqB;IACnC,MAAM,OAAO,GAAG,MAAM,CAAC,iBAAiB,CAAC;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,gBAAgB,CAAC;IACvC,MAAM,CAAC,iBAAiB,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,eAAe,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAChG,MAAM,CAAC,gBAAgB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,eAAe,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IACpG,OAAO,GAAG,EAAE;QACV,MAAM,CAAC,iBAAiB,GAAG,OAAO,CAAC;QACnC,MAAM,CAAC,gBAAgB,GAAG,MAAM,CAAC;IACnC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { DeferredState } from 'void';\n\nexport function createDeferred(): DeferredState<never> {\n return { loading: true, value: null, error: null };\n}\nexport function resolveDeferred(_ref: unknown, value: unknown): DeferredState<unknown> {\n return { loading: false, value, error: null };\n}\nexport function rejectDeferred(_ref: unknown, message: string): DeferredState<never> {\n return { loading: false, value: null, error: new Error(message) };\n}\nexport function isLoading(ref: unknown): boolean {\n return typeof ref === 'object' && ref !== null && 'loading' in ref && ref.loading === true;\n}\n\n// Void installs its HTML callbacks before awaiting component imports. Keep early\n// messages in its existing queue until the initial deferred registry is ready.\ndeclare global {\n interface Window {\n __resolveDeferred?: (group: string, data: unknown) => void;\n __rejectDeferred?: (group: string, error: string) => void;\n __deferredQueue?: Array<[string, unknown] | [string, 0, string]>;\n }\n}\nexport function bufferInitialDeferred() {\n const resolve = window.__resolveDeferred;\n const reject = window.__rejectDeferred;\n window.__resolveDeferred = (group, data) => (window.__deferredQueue ??= []).push([group, data]);\n window.__rejectDeferred = (group, error) => (window.__deferredQueue ??= []).push([group, 0, error]);\n return () => {\n window.__resolveDeferred = resolve;\n window.__rejectDeferred = reject;\n };\n}\n"]}
@@ -1,3 +1,4 @@
1
1
  import type { HeadDescriptor } from 'void';
2
2
  /** Complements Void's title/meta/link updates without executing navigation scripts. */
3
3
  export declare function createDocumentHead(initial: HeadDescriptor | undefined): (head: HeadDescriptor | undefined) => void;
4
+ //# sourceMappingURL=document-head.d.ts.map
@@ -0,0 +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"}
@@ -42,3 +42,4 @@ export function createDocumentHead(initial) {
42
42
  script.remove();
43
43
  };
44
44
  }
45
+ //# sourceMappingURL=document-head.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-head.js","sourceRoot":"","sources":["../../src/runtime/document-head.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,SAAS,eAAe,CAAC,MAAyB;IAChD,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EA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scriptSignature(script: HTMLScriptElement) {\n return JSON.stringify([Array.from(script.attributes, ({ name, value }) => [name, value]).sort(), script.textContent]);\n}\n\nfunction scriptElements(head: HeadDescriptor | undefined) {\n const template = document.createElement('template');\n template.innerHTML = renderHeadToString({ script: head?.script });\n return Array.from(template.content.querySelectorAll('script'));\n}\n\n/** Complements Void's title/meta/link updates without executing navigation scripts. */\nexport function createDocumentHead(initial: HeadDescriptor | undefined) {\n let htmlKeys = Object.keys(initial?.htmlAttrs ?? {});\n let bodyKeys = Object.keys(initial?.bodyAttrs ?? {});\n let scripts: HTMLScriptElement[] = [];\n const existing = Array.from(document.head.querySelectorAll('script'));\n for (const desired of scriptElements(initial)) {\n const index = existing.findIndex((script) => scriptSignature(script) === scriptSignature(desired));\n if (index >= 0) scripts.push(...existing.splice(index, 1));\n }\n\n function attributes(element: HTMLElement, previous: string[], next: Record<string, string> = {}) {\n for (const key of previous) if (!(key in next)) element.removeAttribute(key);\n for (const [key, value] of Object.entries(next)) element.setAttribute(key, value);\n return Object.keys(next);\n }\n\n return (head: HeadDescriptor | undefined) => {\n htmlKeys = attributes(document.documentElement, htmlKeys, head?.htmlAttrs);\n bodyKeys = attributes(document.body, bodyKeys, head?.bodyAttrs);\n const remaining = [...scripts];\n scripts = scriptElements(head).map((desired) => {\n const index = remaining.findIndex((script) => scriptSignature(script) === scriptSignature(desired));\n if (index >= 0) return remaining.splice(index, 1)[0];\n // Template-parsed scripts remain inert when inserted. Head changes are metadata, not script execution.\n document.head.appendChild(desired);\n return desired;\n });\n for (const script of remaining) script.remove();\n };\n}\n"]}
@@ -14,3 +14,4 @@ export declare function useForm<T extends Record<string, unknown>>(initialData:
14
14
  patch: (url: string) => Promise<void>;
15
15
  delete: (url: string) => Promise<void>;
16
16
  };
17
+ //# sourceMappingURL=form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/runtime/form.ts"],"names":[],"mappings":"AACA,OAAO,EAA+C,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AASjG,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;;;;;;;qBAmBzC,UAAU,OAAO,MAAM;;;gBAoCvC,MAAM;eACP,MAAM;iBACJ,MAAM;kBACL,MAAM;EAEvB"}
@@ -78,3 +78,4 @@ export function useForm(initialData) {
78
78
  delete: (url) => submit('delete', url),
79
79
  };
80
80
  }
81
+ //# sourceMappingURL=form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.js","mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU;AACvD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAoC,MAAM,mBAAmB;AAChG,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,4BAAa;AAEjE,SAAS,WAAW,CAAC,KAAsB;IACzC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI;IACvB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI;QAAE,OAAO,EAAE;IAC1I,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAA6B,EAAE,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC;AACnI;AAEA,MAAM,UAAU,OAAO,CAAoC,WAAc;IACvE,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,4FAA4F,CAAC;IAC7I,MAAM,MAAM,GAAG,SAAS,EAAE;IAC1B,MAAM,aAAa,GAAG,S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AC,MAAM,EAAE,GAAG,CAAC;QAC1C,GAAG,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC;QACxC,KAAK,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC;QAC5C,MAAM,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC;KAC/C;AACH","names":[],"ignoreList":[],"sources":["../../src/runtime/form.ts"],"sourcesContent":["import { useContext, useRef, useState } from 'hono/jsx';\nimport { isAbortError, submitAction, VoidActionError, type FormMethod } from 'void/pages-client';\nimport { RouterContext, useErrors, useRouter } from './pages.tsx';\n\nfunction fieldErrors(error: VoidActionError): Record<string, string> {\n const body = error.body;\n if (typeof body !== 'object' || body === null || !('errors' in body) || typeof body.errors !== 'object' || body.errors === null) return {};\n return Object.fromEntries(Object.entries(body.errors).filter((entry): entry is [string, string] => typeof entry[1] === 'string'));\n}\n\nexport function useForm<T extends Record<string, unknown>>(initialData: T) {\n if (!useContext(RouterContext)) throw new Error('Hono Pages: useForm requires the full Pages renderer; island form helpers are unsupported.');\n const router = useRouter();\n const initialErrors = useErrors();\n const [data, updateData] = useState(initialData);\n const [errors, setErrors] = useState(initialErrors);\n const [pending, setPending] = useState(false);\n const [wasSuccessful, setSuccessful] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const active = useRef(false);\n const generation = useRef(0);\n\n const setData: typeof updateData = (next) => {\n updateData(next);\n setSuccessful(false);\n setErrors({});\n setError(null);\n };\n\n async function submit(method: FormMethod, url: string) {\n if (active.current) return;\n active.current = true;\n const id = ++generation.current;\n setPending(true);\n setSuccessful(false);\n setError(null);\n setErrors({});\n try {\n const result = await submitAction(router, url, { method: method.toUpperCase(), data, preserveScroll: true });\n if (id !== generation.current) return;\n if (result.ok) setSuccessful(true);\n else { setError(result.error); setErrors(fieldErrors(result.error)); }\n } catch (failure) {\n if (id === generation.current && !isAbortError(failure)) {\n setError(failure instanceof Error ? failure : new Error(String(failure)));\n }\n } finally {\n if (id === generation.current) { active.current = false; setPending(false); }\n }\n }\n\n function cancel() {\n if (!active.current) return;\n const id = ++generation.current;\n active.current = false;\n setPending(false);\n setSuccessful(false);\n void router.refresh().catch((failure: unknown) => {\n if (id === generation.current) setError(failure instanceof Error ? failure : new Error(String(failure)));\n });\n }\n\n return {\n data, setData, errors, pending, wasSuccessful, error, submit, cancel,\n reset() { setData(initialData); },\n post: (url: string) => submit('post', url),\n put: (url: string) => submit('put', url),\n patch: (url: string) => submit('patch', url),\n delete: (url: string) => submit('delete', url),\n };\n}\n"]}
@@ -15,3 +15,4 @@ type LinkProps = Omit<JSX.IntrinsicElements['a'], 'href' | 'onClick'> & {
15
15
  onClick?: (event: MouseEvent) => void;
16
16
  };
17
17
  export declare function Link({ href, reloadDocument, replace, onClick, ...attributes }: LinkProps): import("hono/jsx/dom/jsx-dev-runtime").JSX.Element;
18
+ //# sourceMappingURL=pages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/runtime/pages.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEtD,eAAO,MAAM,aAAa,+CAAyC,CAAC;AACpE,eAAO,MAAM,WAAW,+CAAyC,CAAC;AAQlE,wBAAgB,SAAS,4BAA+B;AACxD,wBAAgB,SAAS,2BAA+B;AACxD,wBAAgB,SAAS,2BAAqC;AAE9D,wBAAgB,SAAS,IAAI,UAAU,CAItC;AAED,KAAK,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,EAAE,SAAS,sDAaxF"}
@@ -34,3 +34,4 @@ export function Link({ href, reloadDocument, replace, onClick, ...attributes })
34
34
  });
35
35
  } });
36
36
  }
37
+ //# sourceMappingURL=pages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pages.js","sourceRoot":"","sources":["../../src/runtime/pages.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAY,MAAM,UAAU,CAAC;AAK/D,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAoB,IAAI,CAAC,CAAC;AACpE,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAoB,IAAI,CAAC,CAAC;AAElE,SAAS,OAAO;IACd,MAAM,IAAI,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACrC,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAC9E,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,SAAS,KAAK,OAAO,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AACxD,MAAM,UAAU,SAAS,KAAK,OAAO,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AACxD,MAAM,UAAU,SAAS,KAAK,OAAO,OAAO,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;AAE9D,MAAM,UAAU,SAAS;IACvB,MAAM,MAAM,GAAG,UAAU,CAAC,aAAa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D,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,6BAA6B,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YAC1F,CAAC,CAAC,CAAC;QACL,CAAC,GAAI,CAAC;AACR,CAAC","sourcesContent":["import { createContext, useContext, type JSX } from 'hono/jsx';\nimport type { VoidRouter } from 'void/pages-client';\nimport type { PageObject } from 'void/pages-protocol';\nexport type { DeferredState as Deferred } from 'void';\n\nexport const RouterContext = createContext<VoidRouter | null>(null);\nexport const PageContext = createContext<PageObject | null>(null);\n\nfunction usePage() {\n const page = useContext(PageContext);\n if (!page) throw new Error('Hono Pages: page data requires a page provider.');\n return page;\n}\n\nexport function useShared() { return usePage().shared; }\nexport function useParams() { return usePage().params; }\nexport function useErrors() { return usePage().errors ?? {}; }\n\nexport function useRouter(): VoidRouter {\n const router = useContext(RouterContext);\n if (!router) throw new Error('Hono Pages: useRouter requires a page provider.');\n return router;\n}\n\ntype LinkProps = Omit<JSX.IntrinsicElements['a'], 'href' | 'onClick'> & {\n href: string;\n reloadDocument?: boolean;\n replace?: boolean;\n onClick?: (event: MouseEvent) => void;\n};\n\nexport function Link({ href, reloadDocument, replace, onClick, ...attributes }: LinkProps) {\n const router = useRouter();\n return <a {...attributes} href={href} onClick={(event: MouseEvent) => {\n onClick?.(event);\n if (event.defaultPrevented || reloadDocument || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;\n if (attributes.download !== undefined || (attributes.target && attributes.target !== '_self') || attributes.rel?.split(/\\s+/).includes('external')) return;\n const url = new URL(href, window.location.href);\n if (url.origin !== window.location.origin || !['http:', 'https:'].includes(url.protocol)) return;\n event.preventDefault();\n void router.visit(url, { replace }).catch((error: unknown) => {\n window.dispatchEvent(new CustomEvent('hono-pages:navigation-error', { detail: error }));\n });\n }} />;\n}\n"]}
@@ -1 +1,13 @@
1
- export declare function assertSupportedFrameworks(): void;
1
+ export declare const supportedFrameworkRanges: {
2
+ void: string;
3
+ hono: string;
4
+ vite: string;
5
+ };
6
+ export declare const supportedViteRange: string;
7
+ export declare function supportsFramework(name: keyof typeof supportedFrameworkRanges, version: unknown): boolean;
8
+ export declare const supportsVite: (version: unknown) => boolean;
9
+ export declare function assertSupportedFrameworks({ root, viteVersion }: {
10
+ root: string;
11
+ viteVersion: unknown;
12
+ }): void;
13
+ //# sourceMappingURL=compatibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compatibility.d.ts","sourceRoot":"","sources":["../../src/plugins/compatibility.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,wBAAwB;IACnC,IAAI;IACJ,IAAI;IACJ,IAAI;CACL,CAAC;AACF,eAAO,MAAM,kBAAkB,QAAgC,CAAC;AAIhE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,OAAO,wBAAwB,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CASxG;AACD,eAAO,MAAM,YAAY,YAAa,OAAO,KAAG,OAA6C,CAAC;AAwB9F,wBAAgB,yBAAyB,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,QAetG"}
@@ -1,29 +1,73 @@
1
1
  import { createRequire } from 'node:module';
2
2
  import { existsSync, readFileSync } from 'node:fs';
3
3
  import { dirname, join } from 'node:path';
4
- const supported = { void: '0.26.1', hono: '4.13.13', vite: '8.3.3' };
5
- export function assertSupportedFrameworks() {
6
- const require = createRequire(import.meta.url);
7
- for (const [name, expected] of Object.entries(supported)) {
8
- let directory = dirname(require.resolve(name));
9
- let version;
10
- while (true) {
11
- const path = join(directory, 'package.json');
12
- if (existsSync(path)) {
13
- const metadata = JSON.parse(readFileSync(path, 'utf8'));
14
- if (typeof metadata === 'object' && metadata !== null && 'name' in metadata && metadata.name === name) {
15
- if (!('version' in metadata) || typeof metadata.version !== 'string')
16
- throw new Error(`Hono Pages: ${name} package version is missing.`);
17
- version = metadata.version;
18
- break;
19
- }
4
+ import { version as helperViteVersion } from 'vite';
5
+ export const supportedFrameworkRanges = {
6
+ void: '>=0.26.1 <0.28.0',
7
+ hono: '>=4.13.13 <5.0.0',
8
+ vite: '>=8.0.16 <9.0.0',
9
+ };
10
+ export const supportedViteRange = supportedFrameworkRanges.vite;
11
+ // Only stable releases are admitted. Void is pre-1.0, so its next minor
12
+ // requires explicit validation; Hono and Vite use their current major lines.
13
+ export function supportsFramework(name, version) {
14
+ if (typeof version !== 'string')
15
+ return false;
16
+ const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(version);
17
+ if (!match)
18
+ return false;
19
+ const [major, minor, patch] = match.slice(1).map(Number);
20
+ if (![major, minor, patch].every(Number.isSafeInteger))
21
+ return false;
22
+ if (name === 'void')
23
+ return major === 0 && ((minor === 26 && patch >= 1) || minor === 27);
24
+ if (name === 'hono')
25
+ return major === 4 && (minor > 13 || (minor === 13 && patch >= 13));
26
+ return major === 8 && (minor > 0 || patch >= 16);
27
+ }
28
+ export const supportsVite = (version) => supportsFramework('vite', version);
29
+ function packageInfo(name, require) {
30
+ let directory = dirname(require.resolve(name));
31
+ while (true) {
32
+ const path = join(directory, 'package.json');
33
+ if (existsSync(path)) {
34
+ const metadata = JSON.parse(readFileSync(path, 'utf8'));
35
+ if (typeof metadata === 'object' && metadata !== null && 'name' in metadata && (metadata.name === name || (name === 'vite' && metadata.name === '@voidzero-dev/vite-plus-core'))) {
36
+ if (!('version' in metadata) || typeof metadata.version !== 'string')
37
+ throw new Error(`Hono Pages: ${name} package version is missing (${path}).`);
38
+ return { version: metadata.version, path };
20
39
  }
21
- const parent = dirname(directory);
22
- if (parent === directory)
23
- throw new Error(`Hono Pages: cannot locate ${name} package metadata.`);
24
- directory = parent;
25
40
  }
26
- if (version !== expected)
27
- throw new Error(`Hono Pages: ${name} ${version} is unverified; install ${name}@${expected}. The adapter requires void@0.26.1, hono@4.13.13 and vite@8.3.3.`);
41
+ const parent = dirname(directory);
42
+ if (parent === directory)
43
+ throw new Error(`Hono Pages: cannot locate ${name} package metadata from ${require.resolve(name)}.`);
44
+ directory = parent;
45
+ }
46
+ }
47
+ function describe(name, require) {
48
+ try {
49
+ const info = packageInfo(name, require);
50
+ return `${info.path} (metadata ${info.version})`;
51
+ }
52
+ catch {
53
+ return `not resolved from ${require.resolve.paths(name)?.join(', ') ?? 'this context'}`;
54
+ }
55
+ }
56
+ export function assertSupportedFrameworks({ root, viteVersion }) {
57
+ const adapter = createRequire(import.meta.url);
58
+ const project = createRequire(join(root, 'package.json'));
59
+ const diagnostic = () => `Running Vite from hook context: ${typeof viteVersion === 'string' ? viteVersion : 'unavailable'}. Adapter helper Vite: ${helperViteVersion}; package.json: ${describe('vite', adapter)}. Project Vite package.json: ${describe('vite', project)}. Package paths are diagnostics, not the running Vite identity.`;
60
+ if (!supportsVite(viteVersion)) {
61
+ throw new Error(`Hono Pages: running Vite ${typeof viteVersion === 'string' ? viteVersion : 'unavailable'} is unsupported; expected ${supportedViteRange}. ${diagnostic()} Update the CLI/launcher that executes Vite. For bundled launchers such as vp, installing project vite alone does not update the running Vite. For standard Vite, install vite@^8.3.4 and run vite directly.`);
62
+ }
63
+ if (!supportsVite(helperViteVersion)) {
64
+ throw new Error(`Hono Pages: adapter helper Vite ${helperViteVersion} is unsupported; expected ${supportedViteRange}. ${diagnostic()} Inspect the adapter's resolved peer copy; install vite@^8.3.4 and refresh the adapter's peer resolution/lockfile if a stale copy remains.`);
65
+ }
66
+ for (const name of ['void', 'hono']) {
67
+ const expected = supportedFrameworkRanges[name];
68
+ const info = packageInfo(name, adapter);
69
+ if (!supportsFramework(name, info.version))
70
+ throw new Error(`Hono Pages: ${name} ${info.version} is unsupported; install ${name}@"${expected}". Resolved package.json: ${info.path}. Project package.json: ${describe(name, project)}. ${diagnostic()}`);
28
71
  }
29
72
  }
73
+ //# sourceMappingURL=compatibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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kB,KAAK,UAAU,EAAE,8MAA8M,CAAC,CAAC;IAC3X,CAAC;IACD,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,mCAAmC,iBAAiB,6BAA6B,kBAAkB,KAAK,UAAU,EAAE,4IAA4I,CAAC,CAAC;IACpR,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,CAAU,EAAE,CAAC;QAC7C,MAAM,QAAQ,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,IAAI,IAAI,CAAC,OAAO,4BAA4B,IAAI,KAAK,QAAQ,6BAA6B,IAAI,CAAC,IAAI,2BAA2B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,UAAU,EAAE,EAAE,CAAC,CAAC;IAC3P,CAAC;AACH,CAAC","sourcesContent":["import { createRequire } from 'node:module';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { version as helperViteVersion } from 'vite';\n\nexport const supportedFrameworkRanges = {\n void: '>=0.26.1 <0.28.0',\n hono: '>=4.13.13 <5.0.0',\n vite: '>=8.0.16 <9.0.0',\n};\nexport const supportedViteRange = supportedFrameworkRanges.vite;\n\n// Only stable releases are admitted. Void is pre-1.0, so its next minor\n// requires explicit validation; Hono and Vite use their current major lines.\nexport function supportsFramework(name: keyof typeof supportedFrameworkRanges, version: unknown): boolean {\n if (typeof version !== 'string') return false;\n const match = /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$/.exec(version);\n if (!match) return false;\n const [major, minor, patch] = match.slice(1).map(Number);\n if (![major, minor, patch].every(Number.isSafeInteger)) return false;\n if (name === 'void') return major === 0 && ((minor === 26 && patch >= 1) || minor === 27);\n if (name === 'hono') return major === 4 && (minor > 13 || (minor === 13 && patch >= 13));\n return major === 8 && (minor > 0 || patch >= 16);\n}\nexport const supportsVite = (version: unknown): boolean => supportsFramework('vite', version);\n\ntype PackageInfo = { version: string; path: string };\nfunction packageInfo(name: string, require: NodeRequire): PackageInfo {\n let directory = dirname(require.resolve(name));\n while (true) {\n const path = join(directory, 'package.json');\n if (existsSync(path)) {\n const metadata: unknown = JSON.parse(readFileSync(path, 'utf8'));\n if (typeof metadata === 'object' && metadata !== null && 'name' in metadata && (metadata.name === name || (name === 'vite' && metadata.name === '@voidzero-dev/vite-plus-core'))) {\n if (!('version' in metadata) || typeof metadata.version !== 'string') throw new Error(`Hono Pages: ${name} package version is missing (${path}).`);\n return { version: metadata.version, path };\n }\n }\n const parent = dirname(directory);\n if (parent === directory) throw new Error(`Hono Pages: cannot locate ${name} package metadata from ${require.resolve(name)}.`);\n directory = parent;\n }\n}\nfunction describe(name: string, require: NodeRequire): string {\n try { const info = packageInfo(name, require); return `${info.path} (metadata ${info.version})`; }\n catch { return `not resolved from ${require.resolve.paths(name)?.join(', ') ?? 'this context'}`; }\n}\n\nexport function assertSupportedFrameworks({ root, viteVersion }: { root: string; viteVersion: unknown }) {\n const adapter = createRequire(import.meta.url);\n const project = createRequire(join(root, 'package.json'));\n const diagnostic = () => `Running Vite from hook context: ${typeof viteVersion === 'string' ? viteVersion : 'unavailable'}. Adapter helper Vite: ${helperViteVersion}; package.json: ${describe('vite', adapter)}. Project Vite package.json: ${describe('vite', project)}. Package paths are diagnostics, not the running Vite identity.`;\n if (!supportsVite(viteVersion)) {\n throw new Error(`Hono Pages: running Vite ${typeof viteVersion === 'string' ? viteVersion : 'unavailable'} is unsupported; expected ${supportedViteRange}. ${diagnostic()} Update the CLI/launcher that executes Vite. For bundled launchers such as vp, installing project vite alone does not update the running Vite. For standard Vite, install vite@^8.3.4 and run vite directly.`);\n }\n if (!supportsVite(helperViteVersion)) {\n throw new Error(`Hono Pages: adapter helper Vite ${helperViteVersion} is unsupported; expected ${supportedViteRange}. ${diagnostic()} Inspect the adapter's resolved peer copy; install vite@^8.3.4 and refresh the adapter's peer resolution/lockfile if a stale copy remains.`);\n }\n for (const name of ['void', 'hono'] as const) {\n const expected = supportedFrameworkRanges[name];\n const info = packageInfo(name, adapter);\n if (!supportsFramework(name, info.version)) throw new Error(`Hono Pages: ${name} ${info.version} is unsupported; install ${name}@\"${expected}\". Resolved package.json: ${info.path}. Project package.json: ${describe(name, project)}. ${diagnostic()}`);\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
1
  import { type Plugin } from 'vite';
2
2
  /** Narrow adapter for Void's load-on-page-load island convention. */
3
3
  export declare function honoIslands(): Plugin;
4
+ //# sourceMappingURL=hono-islands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hono-islands.d.ts","sourceRoot":"","sources":["../../src/plugins/hono-islands.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAI7D,qEAAqE;AACrE,wBAAgB,WAAW,IAAI,MAAM,CAiGpC"}
@@ -110,3 +110,4 @@ initIslands({ ${loaders} }, (element, module, props) => {
110
110
  },
111
111
  };
112
112
  }
113
+ //# sourceMappingURL=hono-islands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hono-islands.js","sourceRoot":"","sources":["../../src/plugins/hono-islands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,SAAS,EAAe,MAAM,MAAM,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAuB,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,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AkE,EAAE,CAAC,CAAC;QACvF,CAAC;QACD,IAAI,CAAC,EAAE;YACL,IAAI,EAAE,KAAK,KAAK,mBAAmB,EAAE,EAAE,CAAC;gBACtC,IAAI,CAAC,IAAI;oBAAE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;gBAC9E,MAAM,WAAW,GAAG,CAAC,GAAG,2BAA2B,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;gBAC3E,OAAO;8BACe,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;;;;EAIvD,CAAC;YACG,CAAC;YACD,IAAI,EAAE,KAAK,KAAK,uBAAuB,EAAE,EAAE,CAAC;gBAC1C,IAAI,CAAC,OAAO,CAAC,IAAI;oBAAE,OAAO,YAAY,CAAC;gBACvC,MAAM,OAAO,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACjI,OAAO;;;gBAGC,OAAO;;;;IAInB,CAAC;YACC,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { readFileSync, realpathSync } from 'node:fs';\nimport { join, relative } from 'node:path';\nimport { normalizePath, parseSync, type Plugin } from 'vite';\nimport { scanPages, resolvePagesDir, type PageScanResult } from 'void/pages';\nimport { findIslandImports, editIslandSource, resolveSpecifier, computePagesNeedingClientJS, ISLANDS_RENDERER_ID, ISLANDS_CLIENT_ENTRY_ID } from 'void/pages-islands-plugin';\n\n/** Narrow adapter for Void's load-on-page-load island convention. */\nexport function honoIslands(): Plugin {\n const root = process.cwd();\n const pagesDir = resolvePagesDir(root);\n const islands = new Map<string, string>();\n const pageFiles = new Set<string>();\n let scan: PageScanResult | undefined;\n\n function islandImports(code: string, filename: string) {\n const found = findIslandImports(code, filename);\n const attributed = parseSync(filename, code).program.body.filter((node) => node.type === 'ImportDeclaration' && node.attributes?.some(({ key }) => ('name' in key && key.name === 'island') || ('value' in key && key.value === 'island')));\n if (attributed.length !== found.length) throw new Error(`Hono islands: use one default import with exactly one island: 'load' attribute in ${filename}.`);\n return found;\n }\n\n function imports(code: string, filename: string) {\n const found = islandImports(code, filename);\n for (const entry of found) {\n if (entry.hydrate !== 'load') throw new Error(`Hono islands: unsupported policy '${entry.hydrate}' in ${filename}; use island: 'load'.`);\n if (!entry.specifier.startsWith('.')) throw new Error(`Hono islands: use a relative TSX/JSX component import in ${filename}.`);\n const path = resolveSpecifier(entry.specifier, join(filename, '..'), ['.tsx', '.jsx']);\n if (!path || !/\\.[jt]sx$/.test(path)) throw new Error(`Hono islands: cannot resolve TSX/JSX component ${entry.specifier} in ${filename}.`);\n const canonical = realpathSync(path);\n const id = normalizePath(relative(root, canonical));\n islands.set(id, canonical);\n }\n return found;\n }\n\n async function rescan() {\n scan = await scanPages(root, { pagesDir });\n islands.clear();\n pageFiles.clear();\n for (const page of scan.pages.filter((page) => page.island)) {\n const filename = realpathSync(join(pagesDir, page.componentPath));\n pageFiles.add(filename);\n imports(readFileSync(filename, 'utf8'), filename);\n }\n }\n\n return {\n name: 'void-hono:islands',\n enforce: 'pre',\n buildStart: rescan,\n async hotUpdate({ file }) {\n if (normalizePath(file).startsWith(normalizePath(pagesDir) + '/')) await rescan();\n },\n config() {\n return { build: { rollupOptions: { input: { 'islands-client': ISLANDS_CLIENT_ENTRY_ID } } } };\n },\n resolveId(id) {\n if (id === ISLANDS_RENDERER_ID || id === ISLANDS_CLIENT_ENTRY_ID) return `\\0${id}`;\n },\n transform(code, id) {\n const filename = id.split('?')[0];\n if (!/\\.[jt]sx$/.test(filename) || filename.includes('/node_modules/')) return;\n const canonical = realpathSync(filename);\n if ((pageFiles.has(canonical) || [...islands.values()].includes(canonical)) && parseSync(filename, code).program.body.some((node) => node.type === 'ImportDeclaration' && node.source.value === 'void-plugin-hono-jsx/form')) {\n throw new Error('Hono islands: form helpers are unsupported; use a full Pages component.');\n }\n const found = islandImports(code, filename);\n if (!found.length) return;\n if (!pageFiles.has(realpathSync(filename))) throw new Error('Hono islands: attributed imports are supported only directly in .island.tsx/.island.jsx pages.');\n imports(code, filename);\n return editIslandSource(code, found.map((entry) => {\n const path = resolveSpecifier(entry.specifier, join(filename, '..'), ['.tsx', '.jsx']);\n if (!path) throw new Error(`Hono islands: missing component ${entry.specifier}.`);\n const islandId = normalizePath(relative(root, realpathSync(path)));\n const component = `__honoIslandComponent${entry.start}`;\n return { start: entry.start, end: entry.end, text: `import ${component} from ${entry.specifierRaw};\nconst ${entry.importName} = (props) => __honoIslandJsx('div', { 'data-island': ${JSON.stringify(islandId)}, 'data-hydrate': 'load', 'data-props': JSON.stringify(props), children: __honoIslandJsx(${component}, props) });` };\n }), { prepend: \"import { jsx as __honoIslandJsx } from 'hono/jsx/jsx-runtime';\\n\" });\n },\n load(id) {\n if (id === `\\0${ISLANDS_RENDERER_ID}`) {\n if (!scan) throw new Error('Hono islands: page discovery has not completed.');\n const interactive = [...computePagesNeedingClientJS(scan, pagesDir, null)];\n return `import { renderPage } from 'virtual:void-pages-renderer';\nconst interactive = new Set(${JSON.stringify(interactive)});\nexport function renderIslandPage(page, assets) {\n if (page.deferred?.length || page.deferredKeys) throw new Error('Hono islands: deferred props are unsupported.');\n return renderPage(page, interactive.has(page.component) ? assets : { ...assets, preloads: '', body: '' });\n}`;\n }\n if (id === `\\0${ISLANDS_CLIENT_ENTRY_ID}`) {\n if (!islands.size) return 'export {};';\n const loaders = [...islands].map(([name, path]) => `${JSON.stringify(name)}: () => import(${JSON.stringify(path)})`).join(',\\n');\n return `import { initIslands } from 'void/pages-client';\nimport { jsx } from 'hono/jsx/dom/jsx-runtime';\nimport { render } from 'hono/jsx/dom';\ninitIslands({ ${loaders} }, (element, module, props) => {\n if (typeof module.default !== 'function') throw new Error('Hono islands: a component must export a default function.');\n render(jsx(module.default, props), element);\n element.setAttribute('data-hono-island', 'mounted');\n});`;\n }\n },\n };\n}\n"]}
@@ -1,3 +1,4 @@
1
1
  import { type Plugin } from 'vite';
2
2
  /** JSX factories differ by Vite environment; hooks can be shared via hono/jsx. */
3
3
  export declare function honoJsx(): Plugin;
4
+ //# sourceMappingURL=hono-jsx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hono-jsx.d.ts","sourceRoot":"","sources":["../../src/plugins/hono-jsx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAErD,kFAAkF;AAClF,wBAAgB,OAAO,IAAI,MAAM,CAgBhC"}
@@ -18,3 +18,4 @@ export function honoJsx() {
18
18
  },
19
19
  };
20
20
  }
21
+ //# sourceMappingURL=hono-jsx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hono-jsx.js","sourceRoot":"","sources":["../../src/plugins/hono-jsx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAe,MAAM,MAAM,CAAC;AAErD,kFAAkF;AAClF,MAAM,UAAU,OAAO;IACrB,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,KAAK;QACd,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE;YACtB,MAAM,QAAQ,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC;gBAAE,OAAO;YAC/E,OAAO,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE;gBACtC,GAAG,EAAE;oBACH,OAAO,EAAE,WAAW;oBACpB,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU;oBACzF,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,KAAK;iBAC7C;aACF,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { transformWithOxc, type Plugin } from 'vite';\n\n/** JSX factories differ by Vite environment; hooks can be shared via hono/jsx. */\nexport function honoJsx(): Plugin {\n return {\n name: 'poc:hono-jsx',\n enforce: 'pre',\n async transform(code, id) {\n const filename = id.split('?')[0];\n if (!/\\.[jt]sx$/.test(filename) || filename.includes('/node_modules/')) return;\n return transformWithOxc(code, filename, {\n jsx: {\n runtime: 'automatic',\n importSource: this.environment.config.consumer === 'client' ? 'hono/jsx/dom' : 'hono/jsx',\n development: this.environment.mode === 'dev',\n },\n });\n },\n };\n}\n"]}
@@ -1,3 +1,4 @@
1
1
  import type { Plugin } from 'vite';
2
- /** Experimental Pages contract verified against Void 0.26.1. */
2
+ /** Experimental Pages contract verified against Void 0.26.1 and 0.27.0. */
3
3
  export declare function voidHonoPages(): Plugin[];
4
+ //# sourceMappingURL=hono-pages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hono-pages.d.ts","sourceRoot":"","sources":["../../src/plugins/hono-pages.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAQnC,2EAA2E;AAC3E,wBAAgB,aAAa,IAAI,MAAM,EAAE,CAgIxC"}
@@ -1,4 +1,5 @@
1
1
  import { realpathSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
2
3
  import { normalizePath } from 'vite';
3
4
  import { pagesRuntimePath, clientRuntimePath, publicRuntimeModules } from './runtime-paths.js';
4
5
  import { generateComponentManifest, resolvePagesDir, resolveStaticPageDataBuildOptions, scanPages } from 'void/pages';
@@ -7,7 +8,7 @@ import { honoIslands } from './hono-islands.js';
7
8
  import { assertSupportedFrameworks } from './compatibility.js';
8
9
  const rendererId = 'virtual:void-pages-renderer';
9
10
  const clientId = 'virtual:void-pages-client';
10
- /** Experimental Pages contract verified against Void 0.26.1. */
11
+ /** Experimental Pages contract verified against Void 0.26.1 and 0.27.0. */
11
12
  export function voidHonoPages() {
12
13
  const root = process.cwd();
13
14
  const pagesDir = resolvePagesDir(root);
@@ -32,8 +33,8 @@ export function voidHonoPages() {
32
33
  return [honoIslands(), honoJsx(), {
33
34
  name: 'void-hono:pages',
34
35
  enforce: 'pre',
35
- config() {
36
- assertSupportedFrameworks();
36
+ config(config) {
37
+ assertSupportedFrameworks({ root: resolve(config.root ?? root), viteVersion: this?.meta?.viteVersion });
37
38
  return {
38
39
  resolve: { dedupe: ['hono'] },
39
40
  build: { manifest: true, rollupOptions: { input: { 'pages-client': clientId } } },
@@ -146,3 +147,4 @@ await startHonoPages({ components, layoutTree, routeMeta, matchRoute, staticPage
146
147
  },
147
148
  }];
148
149
  }
150
+ //# sourceMappingURL=hono-pages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hono-pages.js","sourceRoot":"","sources":["../../src/plugins/hono-pages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,yBAAyB,EAAE,eAAe,EAAE,iCAAiC,EAAE,SAAS,EAAuB,MAAM,YAAY,CAAC;AAE3I,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,UAAU,GAAG,6BAA6B,CAAC;AACjD,MAAM,QAAQ,GAAG,2BAA2B,CA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C8E,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,6BAA6B,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC;CACzL,CAAC;YACE,CAAC;SACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { realpathSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { normalizePath } from 'vite';\nimport { pagesRuntimePath, clientRuntimePath, publicRuntimeModules } from './runtime-paths.ts';\nimport { generateComponentManifest, resolvePagesDir, resolveStaticPageDataBuildOptions, scanPages, type PageScanResult } from 'void/pages';\nimport type { Plugin } from 'vite';\nimport { honoJsx } from './hono-jsx.ts';\nimport { honoIslands } from './hono-islands.ts';\nimport { assertSupportedFrameworks } from './compatibility.ts';\n\nconst rendererId = 'virtual:void-pages-renderer';\nconst clientId = 'virtual:void-pages-client';\n\n/** Experimental Pages contract verified against Void 0.26.1 and 0.27.0. */\nexport function voidHonoPages(): Plugin[] {\n const root = process.cwd();\n const pagesDir = resolvePagesDir(root);\n const staticData = resolveStaticPageDataBuildOptions(root);\n let scan: PageScanResult | undefined;\n\n async function rescan() {\n scan = await scanPages(root, { pagesDir });\n for (const layout of [...scan.layouts, ...scan.namedLayouts]) {\n if (layout.island || !/\\.[jt]sx$/.test(layout.filePath)) throw new Error('Hono Pages: only standard TSX/JSX layouts are supported.');\n }\n for (const page of scan.pages) {\n if (!/\\.[jt]sx$/.test(page.componentPath)) {\n throw new Error(`Hono Pages: only standard TSX/JSX pages are supported: ${page.componentPath}.`);\n }\n if (staticData.enabled && page.methods.some((method) => method === 'action' || method === 'actions')) {\n throw new Error(`Hono Pages: actions require a server and cannot be used with static output: ${page.componentPath}.`);\n }\n }\n return scan;\n }\n\n return [honoIslands(), honoJsx(), {\n name: 'void-hono:pages',\n enforce: 'pre',\n config(config) {\n assertSupportedFrameworks({ root: resolve(config.root ?? root), viteVersion: this?.meta?.viteVersion });\n return {\n resolve: { dedupe: ['hono'] },\n build: { manifest: true, rollupOptions: { input: { 'pages-client': clientId } } },\n };\n },\n configEnvironment() {\n const modules = Object.keys(publicRuntimeModules);\n const packages = [...new Set(modules.map((id) => id.slice(0, id.lastIndexOf('/'))))];\n return { optimizeDeps: { exclude: ['hono', ...modules] }, resolve: { noExternal: ['hono', ...packages] } };\n },\n async buildStart() {\n await rescan();\n },\n configureServer(server) {\n const clear = (file: string) => {\n if (normalizePath(file).startsWith(normalizePath(pagesDir) + '/')) scan = undefined;\n };\n server.watcher.on('add', clear);\n server.watcher.on('unlink', clear);\n server.httpServer?.once('close', () => { server.watcher.off('add', clear); server.watcher.off('unlink', clear); });\n },\n async hotUpdate({ file, type, modules, timestamp }) {\n if (!normalizePath(file).startsWith(normalizePath(pagesDir) + '/')) return;\n await rescan();\n if (type !== 'update') return [];\n const invalidated = new Set<(typeof modules)[number]>();\n for (const module of modules) this.environment.moduleGraph.invalidateModule(module, invalidated, timestamp, true);\n for (const id of [rendererId, clientId]) {\n const module = this.environment.moduleGraph.getModuleById(`\\0${id}`);\n if (module) this.environment.moduleGraph.invalidateModule(module, invalidated, timestamp, true);\n }\n this.environment.hot.send({ type: 'full-reload' });\n return [];\n },\n resolveId(id) {\n if (id === rendererId || id === clientId) return `\\0${id}`;\n if (id === pagesRuntimePath || id === clientRuntimePath) return { id: realpathSync(id), external: false };\n const runtime = publicRuntimeModules[id];\n if (runtime) return { id: realpathSync(this.environment.config.consumer === 'client' ? runtime.client : runtime.server), external: false };\n },\n async load(id) {\n if (id !== `\\0${rendererId}` && id !== `\\0${clientId}`) return;\n const currentScan = scan ?? await rescan();\n const serverSnapshot = id === `\\0${rendererId}` && this.environment.mode === 'dev';\n const manifestScan = id === `\\0${clientId}`\n ? { ...currentScan, pages: currentScan.pages.filter((page) => !page.island) }\n : serverSnapshot ? { ...currentScan, pages: currentScan.pages.filter((page) => page.renderMode !== 'client') } : currentScan;\n let manifest = generateComponentManifest(manifestScan, pagesDir);\n if (serverSnapshot) {\n // A request can retain the old renderer while the worker module runner\n // reloads. Capture components with its providers instead of importing\n // a new generation into an in-flight render. Browser-only pages remain\n // absent from this server graph; production keeps lazy imports.\n const imports: string[] = [];\n manifest = manifest.replace(/\\(\\) => import\\((\"(?:[^\"\\\\]|\\\\.)*\")\\)/g, (_, path: string) => {\n const name = `__honoPageSnapshot${imports.length}`;\n imports.push(`import * as ${name} from ${path};`);\n return `() => ${name}`;\n });\n manifest = imports.join('\\n') + '\\n' + manifest;\n }\n if (id === `\\0${clientId}` && !currentScan.pages.some((page) => !page.island)) return 'export {};';\n if (id === `\\0${rendererId}`) {\n return `\nimport { jsx } from 'hono/jsx';\nimport { createSsrRouter } from 'void/pages-client';\nimport { PageContext, RouterContext } from ${JSON.stringify(pagesRuntimePath)};\nimport { serializePageData } from 'void/pages-server';\nimport { renderHeadToString, renderHtmlAttrs, renderBodyAttrs } from 'void/pages-head';\n${manifest}\nexport async function renderPage(pageObj, assetTags) {\n if (${JSON.stringify(staticData.enabled)} && pageObj.deferredKeys) throw new Error('Hono Pages: deferred props cannot be statically prerendered; remove defer().');\n const load = components[pageObj.component];\n if (!load) throw new Error('Hono Pages: unknown page component ' + pageObj.component);\n const { default: Page } = await load();\n if (typeof Page !== 'function') throw new Error('Hono Pages: a page must export a component function.');\n let content = jsx(Page, pageObj.props);\n const ids = layoutTree[pageObj.component] ?? [];\n const layouts = await Promise.all(ids.map(async (id) => (await components[id]()).default));\n for (const Layout of layouts.reverse()) {\n if (typeof Layout !== 'function') throw new Error('Hono Pages: a layout must export a component function.');\n content = jsx(Layout, { children: content });\n }\n const markup = await jsx(RouterContext.Provider, { value: createSsrRouter(pageObj.url, pageObj.params), children: jsx(PageContext.Provider, { value: pageObj, children: content }) }).toString();\n const head = pageObj.head;\n const body = pageObj.deferredKeys ? assetTags.body.replaceAll('<script type=\"module\"', '<script async type=\"module\"') : assetTags.body;\n return '<!doctype html><html' + (head ? renderHtmlAttrs(head) : '') + '><head>'\n + (head ? renderHeadToString(head) : '') + assetTags.css + assetTags.preloads\n + '</head><body' + (head ? renderBodyAttrs(head) : '') + '>'\n + '<script id=\"__VOID_PAGE_DATA__\" type=\"application/json\">' + serializePageData(pageObj) + '</script>'\n + '<div id=\"app\">' + markup + '</div>' + body + '</body></html>';\n}\n`;\n }\n return `\nimport { startHonoPages } from ${JSON.stringify(clientRuntimePath)};\n${manifest}\nawait startHonoPages({ components, layoutTree, routeMeta, matchRoute, staticPageData: ${JSON.stringify(staticData.enabled)}, staticPageDataFastPath: ${JSON.stringify(staticData.fastPath)} });\n`;\n },\n }];\n}\n"]}
@@ -4,3 +4,4 @@ export declare const publicRuntimeModules: Record<string, {
4
4
  server: string;
5
5
  client: string;
6
6
  }>;
7
+ //# sourceMappingURL=runtime-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-paths.d.ts","sourceRoot":"","sources":["../../src/plugins/runtime-paths.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,QAAoG,CAAC;AAClI,eAAO,MAAM,iBAAiB,QAAuG,CAAC;AACtI,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAM9E,CAAC"}