@rangojs/router 0.0.0-experimental.137 → 0.0.0-experimental.139
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.
- package/README.md +273 -924
- package/dist/bin/rango.js +265 -56
- package/dist/vite/index.js +710 -119
- package/package.json +16 -1
- package/skills/comparison/SKILL.md +50 -0
- package/skills/comparison/agents/openai.yaml +4 -0
- package/skills/comparison/references/framework-comparison.md +837 -0
- package/skills/composability/SKILL.md +50 -0
- package/skills/host-router/SKILL.md +45 -3
- package/skills/layout/SKILL.md +26 -9
- package/skills/middleware/SKILL.md +6 -2
- package/skills/migrate-nextjs/SKILL.md +12 -0
- package/skills/observability/SKILL.md +23 -1
- package/skills/parallel/SKILL.md +11 -3
- package/skills/rango/SKILL.md +76 -24
- package/skills/response-routes/SKILL.md +14 -0
- package/skills/route/SKILL.md +19 -3
- package/skills/router-setup/SKILL.md +13 -0
- package/skills/shell-manifest/SKILL.md +185 -0
- package/skills/testing/reverse-and-types.md +8 -7
- package/skills/vercel/SKILL.md +128 -0
- package/src/build/generate-manifest.ts +155 -131
- package/src/build/generate-route-types.ts +1 -0
- package/src/build/index.ts +3 -1
- package/src/build/route-types/include-resolution.ts +347 -47
- package/src/build/route-types/router-processing.ts +77 -27
- package/src/build/runtime-discovery.ts +4 -1
- package/src/cache/cf/cf-cache-store.ts +22 -0
- package/src/cache/index.ts +12 -0
- package/src/cache/vercel/index.ts +11 -0
- package/src/cache/vercel/vercel-cache-store.ts +948 -0
- package/src/host/errors.ts +15 -0
- package/src/host/index.ts +1 -0
- package/src/router/find-match.ts +71 -7
- package/src/router/lazy-includes.ts +64 -10
- package/src/router/manifest.ts +43 -6
- package/src/router/match-api.ts +2 -2
- package/src/router/navigation-snapshot.ts +7 -5
- package/src/router/prerender-match.ts +4 -2
- package/src/router/preview-match.ts +3 -1
- package/src/router/request-classification.ts +3 -1
- package/src/router/route-snapshot.ts +4 -2
- package/src/router/router-context.ts +3 -1
- package/src/router/router-interfaces.ts +9 -1
- package/src/router.ts +9 -2
- package/src/rsc/manifest-init.ts +1 -1
- package/src/testing/dispatch.ts +3 -3
- package/src/testing/generated-routes.ts +27 -11
- package/src/urls/include-helper.ts +10 -8
- package/src/urls/include-provider.ts +71 -0
- package/src/urls/path-helper-types.ts +25 -1
- package/src/vercel/index.ts +11 -0
- package/src/vercel/tracing.ts +88 -0
- package/src/vite/discovery/discover-routers.ts +1 -1
- package/src/vite/discovery/state.ts +1 -1
- package/src/vite/index.ts +2 -0
- package/src/vite/plugin-types.ts +84 -2
- package/src/vite/plugins/vercel-output.ts +384 -0
- package/src/vite/plugins/virtual-entries.ts +72 -0
- package/src/vite/rango.ts +128 -21
- package/src/vite/router-discovery.ts +8 -0
- package/src/vite/utils/shared-utils.ts +52 -2
- package/dist/__internal.d.ts +0 -83
- package/dist/__internal.d.ts.map +0 -1
- package/dist/__internal.js +0 -19
- package/dist/__internal.js.map +0 -1
- package/dist/__mocks__/version.d.ts +0 -7
- package/dist/__mocks__/version.d.ts.map +0 -1
- package/dist/__mocks__/version.js +0 -7
- package/dist/__mocks__/version.js.map +0 -1
- package/dist/__tests__/client-href.test.d.ts +0 -2
- package/dist/__tests__/client-href.test.d.ts.map +0 -1
- package/dist/__tests__/client-href.test.js +0 -74
- package/dist/__tests__/client-href.test.js.map +0 -1
- package/dist/__tests__/component-utils.test.d.ts +0 -2
- package/dist/__tests__/component-utils.test.d.ts.map +0 -1
- package/dist/__tests__/component-utils.test.js +0 -51
- package/dist/__tests__/component-utils.test.js.map +0 -1
- package/dist/__tests__/event-controller.test.d.ts +0 -2
- package/dist/__tests__/event-controller.test.d.ts.map +0 -1
- package/dist/__tests__/event-controller.test.js +0 -538
- package/dist/__tests__/event-controller.test.js.map +0 -1
- package/dist/__tests__/helpers/route-tree.d.ts +0 -118
- package/dist/__tests__/helpers/route-tree.d.ts.map +0 -1
- package/dist/__tests__/helpers/route-tree.js +0 -374
- package/dist/__tests__/helpers/route-tree.js.map +0 -1
- package/dist/__tests__/match-result.test.d.ts +0 -2
- package/dist/__tests__/match-result.test.d.ts.map +0 -1
- package/dist/__tests__/match-result.test.js +0 -154
- package/dist/__tests__/match-result.test.js.map +0 -1
- package/dist/__tests__/navigation-store.test.d.ts +0 -2
- package/dist/__tests__/navigation-store.test.d.ts.map +0 -1
- package/dist/__tests__/navigation-store.test.js +0 -440
- package/dist/__tests__/navigation-store.test.js.map +0 -1
- package/dist/__tests__/partial-update.test.d.ts +0 -2
- package/dist/__tests__/partial-update.test.d.ts.map +0 -1
- package/dist/__tests__/partial-update.test.js +0 -1009
- package/dist/__tests__/partial-update.test.js.map +0 -1
- package/dist/__tests__/reverse-types.test.d.ts +0 -8
- package/dist/__tests__/reverse-types.test.d.ts.map +0 -1
- package/dist/__tests__/reverse-types.test.js +0 -656
- package/dist/__tests__/reverse-types.test.js.map +0 -1
- package/dist/__tests__/route-definition.test.d.ts +0 -2
- package/dist/__tests__/route-definition.test.d.ts.map +0 -1
- package/dist/__tests__/route-definition.test.js +0 -55
- package/dist/__tests__/route-definition.test.js.map +0 -1
- package/dist/__tests__/router-helpers.test.d.ts +0 -2
- package/dist/__tests__/router-helpers.test.d.ts.map +0 -1
- package/dist/__tests__/router-helpers.test.js +0 -377
- package/dist/__tests__/router-helpers.test.js.map +0 -1
- package/dist/__tests__/router-integration-2.test.d.ts +0 -2
- package/dist/__tests__/router-integration-2.test.d.ts.map +0 -1
- package/dist/__tests__/router-integration-2.test.js +0 -426
- package/dist/__tests__/router-integration-2.test.js.map +0 -1
- package/dist/__tests__/router-integration.test.d.ts +0 -2
- package/dist/__tests__/router-integration.test.d.ts.map +0 -1
- package/dist/__tests__/router-integration.test.js +0 -1051
- package/dist/__tests__/router-integration.test.js.map +0 -1
- package/dist/__tests__/search-params.test.d.ts +0 -5
- package/dist/__tests__/search-params.test.d.ts.map +0 -1
- package/dist/__tests__/search-params.test.js +0 -306
- package/dist/__tests__/search-params.test.js.map +0 -1
- package/dist/__tests__/segment-system.test.d.ts +0 -2
- package/dist/__tests__/segment-system.test.d.ts.map +0 -1
- package/dist/__tests__/segment-system.test.js +0 -627
- package/dist/__tests__/segment-system.test.js.map +0 -1
- package/dist/__tests__/static-handler-types.test.d.ts +0 -8
- package/dist/__tests__/static-handler-types.test.d.ts.map +0 -1
- package/dist/__tests__/static-handler-types.test.js +0 -63
- package/dist/__tests__/static-handler-types.test.js.map +0 -1
- package/dist/__tests__/urls.test.d.ts +0 -2
- package/dist/__tests__/urls.test.d.ts.map +0 -1
- package/dist/__tests__/urls.test.js +0 -421
- package/dist/__tests__/urls.test.js.map +0 -1
- package/dist/__tests__/use-mount.test.d.ts +0 -2
- package/dist/__tests__/use-mount.test.d.ts.map +0 -1
- package/dist/__tests__/use-mount.test.js +0 -35
- package/dist/__tests__/use-mount.test.js.map +0 -1
- package/dist/bin/rango.d.ts +0 -2
- package/dist/bin/rango.d.ts.map +0 -1
- package/dist/bin/rango.js.map +0 -1
- package/dist/browser/event-controller.d.ts +0 -191
- package/dist/browser/event-controller.d.ts.map +0 -1
- package/dist/browser/event-controller.js +0 -559
- package/dist/browser/event-controller.js.map +0 -1
- package/dist/browser/index.d.ts +0 -2
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/index.js +0 -14
- package/dist/browser/index.js.map +0 -1
- package/dist/browser/link-interceptor.d.ts +0 -38
- package/dist/browser/link-interceptor.d.ts.map +0 -1
- package/dist/browser/link-interceptor.js +0 -99
- package/dist/browser/link-interceptor.js.map +0 -1
- package/dist/browser/logging.d.ts +0 -10
- package/dist/browser/logging.d.ts.map +0 -1
- package/dist/browser/logging.js +0 -29
- package/dist/browser/logging.js.map +0 -1
- package/dist/browser/lru-cache.d.ts +0 -17
- package/dist/browser/lru-cache.d.ts.map +0 -1
- package/dist/browser/lru-cache.js +0 -50
- package/dist/browser/lru-cache.js.map +0 -1
- package/dist/browser/merge-segment-loaders.d.ts +0 -39
- package/dist/browser/merge-segment-loaders.d.ts.map +0 -1
- package/dist/browser/merge-segment-loaders.js +0 -102
- package/dist/browser/merge-segment-loaders.js.map +0 -1
- package/dist/browser/navigation-bridge.d.ts +0 -102
- package/dist/browser/navigation-bridge.d.ts.map +0 -1
- package/dist/browser/navigation-bridge.js +0 -708
- package/dist/browser/navigation-bridge.js.map +0 -1
- package/dist/browser/navigation-client.d.ts +0 -25
- package/dist/browser/navigation-client.d.ts.map +0 -1
- package/dist/browser/navigation-client.js +0 -157
- package/dist/browser/navigation-client.js.map +0 -1
- package/dist/browser/navigation-store.d.ts +0 -101
- package/dist/browser/navigation-store.d.ts.map +0 -1
- package/dist/browser/navigation-store.js +0 -625
- package/dist/browser/navigation-store.js.map +0 -1
- package/dist/browser/partial-update.d.ts +0 -75
- package/dist/browser/partial-update.d.ts.map +0 -1
- package/dist/browser/partial-update.js +0 -426
- package/dist/browser/partial-update.js.map +0 -1
- package/dist/browser/react/Link.d.ts +0 -86
- package/dist/browser/react/Link.d.ts.map +0 -1
- package/dist/browser/react/Link.js +0 -128
- package/dist/browser/react/Link.js.map +0 -1
- package/dist/browser/react/NavigationProvider.d.ts +0 -63
- package/dist/browser/react/NavigationProvider.d.ts.map +0 -1
- package/dist/browser/react/NavigationProvider.js +0 -216
- package/dist/browser/react/NavigationProvider.js.map +0 -1
- package/dist/browser/react/ScrollRestoration.d.ts +0 -75
- package/dist/browser/react/ScrollRestoration.d.ts.map +0 -1
- package/dist/browser/react/ScrollRestoration.js +0 -57
- package/dist/browser/react/ScrollRestoration.js.map +0 -1
- package/dist/browser/react/context.d.ts +0 -46
- package/dist/browser/react/context.d.ts.map +0 -1
- package/dist/browser/react/context.js +0 -10
- package/dist/browser/react/context.js.map +0 -1
- package/dist/browser/react/index.d.ts +0 -11
- package/dist/browser/react/index.d.ts.map +0 -1
- package/dist/browser/react/index.js +0 -22
- package/dist/browser/react/index.js.map +0 -1
- package/dist/browser/react/location-state-shared.d.ts +0 -63
- package/dist/browser/react/location-state-shared.d.ts.map +0 -1
- package/dist/browser/react/location-state-shared.js +0 -81
- package/dist/browser/react/location-state-shared.js.map +0 -1
- package/dist/browser/react/location-state.d.ts +0 -23
- package/dist/browser/react/location-state.d.ts.map +0 -1
- package/dist/browser/react/location-state.js +0 -29
- package/dist/browser/react/location-state.js.map +0 -1
- package/dist/browser/react/mount-context.d.ts +0 -24
- package/dist/browser/react/mount-context.d.ts.map +0 -1
- package/dist/browser/react/mount-context.js +0 -24
- package/dist/browser/react/mount-context.js.map +0 -1
- package/dist/browser/react/use-action.d.ts +0 -64
- package/dist/browser/react/use-action.d.ts.map +0 -1
- package/dist/browser/react/use-action.js +0 -134
- package/dist/browser/react/use-action.js.map +0 -1
- package/dist/browser/react/use-client-cache.d.ts +0 -41
- package/dist/browser/react/use-client-cache.d.ts.map +0 -1
- package/dist/browser/react/use-client-cache.js +0 -39
- package/dist/browser/react/use-client-cache.js.map +0 -1
- package/dist/browser/react/use-handle.d.ts +0 -31
- package/dist/browser/react/use-handle.d.ts.map +0 -1
- package/dist/browser/react/use-handle.js +0 -144
- package/dist/browser/react/use-handle.js.map +0 -1
- package/dist/browser/react/use-href.d.ts +0 -33
- package/dist/browser/react/use-href.d.ts.map +0 -1
- package/dist/browser/react/use-href.js +0 -39
- package/dist/browser/react/use-href.js.map +0 -1
- package/dist/browser/react/use-link-status.d.ts +0 -37
- package/dist/browser/react/use-link-status.d.ts.map +0 -1
- package/dist/browser/react/use-link-status.js +0 -99
- package/dist/browser/react/use-link-status.js.map +0 -1
- package/dist/browser/react/use-mount.d.ts +0 -25
- package/dist/browser/react/use-mount.d.ts.map +0 -1
- package/dist/browser/react/use-mount.js +0 -30
- package/dist/browser/react/use-mount.js.map +0 -1
- package/dist/browser/react/use-navigation.d.ts +0 -27
- package/dist/browser/react/use-navigation.d.ts.map +0 -1
- package/dist/browser/react/use-navigation.js +0 -87
- package/dist/browser/react/use-navigation.js.map +0 -1
- package/dist/browser/react/use-segments.d.ts +0 -38
- package/dist/browser/react/use-segments.d.ts.map +0 -1
- package/dist/browser/react/use-segments.js +0 -130
- package/dist/browser/react/use-segments.js.map +0 -1
- package/dist/browser/request-controller.d.ts +0 -26
- package/dist/browser/request-controller.d.ts.map +0 -1
- package/dist/browser/request-controller.js +0 -147
- package/dist/browser/request-controller.js.map +0 -1
- package/dist/browser/rsc-router.d.ts +0 -129
- package/dist/browser/rsc-router.d.ts.map +0 -1
- package/dist/browser/rsc-router.js +0 -195
- package/dist/browser/rsc-router.js.map +0 -1
- package/dist/browser/scroll-restoration.d.ts +0 -93
- package/dist/browser/scroll-restoration.d.ts.map +0 -1
- package/dist/browser/scroll-restoration.js +0 -321
- package/dist/browser/scroll-restoration.js.map +0 -1
- package/dist/browser/segment-structure-assert.d.ts +0 -17
- package/dist/browser/segment-structure-assert.d.ts.map +0 -1
- package/dist/browser/segment-structure-assert.js +0 -59
- package/dist/browser/segment-structure-assert.js.map +0 -1
- package/dist/browser/server-action-bridge.d.ts +0 -26
- package/dist/browser/server-action-bridge.d.ts.map +0 -1
- package/dist/browser/server-action-bridge.js +0 -668
- package/dist/browser/server-action-bridge.js.map +0 -1
- package/dist/browser/shallow.d.ts +0 -12
- package/dist/browser/shallow.d.ts.map +0 -1
- package/dist/browser/shallow.js +0 -34
- package/dist/browser/shallow.js.map +0 -1
- package/dist/browser/types.d.ts +0 -369
- package/dist/browser/types.d.ts.map +0 -1
- package/dist/browser/types.js +0 -2
- package/dist/browser/types.js.map +0 -1
- package/dist/build/__tests__/generate-cli.test.d.ts +0 -2
- package/dist/build/__tests__/generate-cli.test.d.ts.map +0 -1
- package/dist/build/__tests__/generate-cli.test.js +0 -237
- package/dist/build/__tests__/generate-cli.test.js.map +0 -1
- package/dist/build/__tests__/generate-manifest.test.d.ts +0 -2
- package/dist/build/__tests__/generate-manifest.test.d.ts.map +0 -1
- package/dist/build/__tests__/generate-manifest.test.js +0 -119
- package/dist/build/__tests__/generate-manifest.test.js.map +0 -1
- package/dist/build/__tests__/generate-route-types.test.d.ts +0 -2
- package/dist/build/__tests__/generate-route-types.test.d.ts.map +0 -1
- package/dist/build/__tests__/generate-route-types.test.js +0 -620
- package/dist/build/__tests__/generate-route-types.test.js.map +0 -1
- package/dist/build/__tests__/per-router-manifest.test.d.ts +0 -2
- package/dist/build/__tests__/per-router-manifest.test.d.ts.map +0 -1
- package/dist/build/__tests__/per-router-manifest.test.js +0 -308
- package/dist/build/__tests__/per-router-manifest.test.js.map +0 -1
- package/dist/build/generate-manifest.d.ts +0 -81
- package/dist/build/generate-manifest.d.ts.map +0 -1
- package/dist/build/generate-manifest.js +0 -276
- package/dist/build/generate-manifest.js.map +0 -1
- package/dist/build/generate-route-types.d.ts +0 -115
- package/dist/build/generate-route-types.d.ts.map +0 -1
- package/dist/build/generate-route-types.js +0 -740
- package/dist/build/generate-route-types.js.map +0 -1
- package/dist/build/index.d.ts +0 -21
- package/dist/build/index.d.ts.map +0 -1
- package/dist/build/index.js +0 -21
- package/dist/build/index.js.map +0 -1
- package/dist/build/route-trie.d.ts +0 -71
- package/dist/build/route-trie.d.ts.map +0 -1
- package/dist/build/route-trie.js +0 -175
- package/dist/build/route-trie.js.map +0 -1
- package/dist/cache/__tests__/cache-scope.test.d.ts +0 -2
- package/dist/cache/__tests__/cache-scope.test.d.ts.map +0 -1
- package/dist/cache/__tests__/cache-scope.test.js +0 -208
- package/dist/cache/__tests__/cache-scope.test.js.map +0 -1
- package/dist/cache/__tests__/document-cache.test.d.ts +0 -2
- package/dist/cache/__tests__/document-cache.test.d.ts.map +0 -1
- package/dist/cache/__tests__/document-cache.test.js +0 -345
- package/dist/cache/__tests__/document-cache.test.js.map +0 -1
- package/dist/cache/__tests__/memory-segment-store.test.d.ts +0 -2
- package/dist/cache/__tests__/memory-segment-store.test.d.ts.map +0 -1
- package/dist/cache/__tests__/memory-segment-store.test.js +0 -425
- package/dist/cache/__tests__/memory-segment-store.test.js.map +0 -1
- package/dist/cache/__tests__/memory-store.test.d.ts +0 -2
- package/dist/cache/__tests__/memory-store.test.d.ts.map +0 -1
- package/dist/cache/__tests__/memory-store.test.js +0 -367
- package/dist/cache/__tests__/memory-store.test.js.map +0 -1
- package/dist/cache/cache-scope.d.ts +0 -102
- package/dist/cache/cache-scope.d.ts.map +0 -1
- package/dist/cache/cache-scope.js +0 -440
- package/dist/cache/cache-scope.js.map +0 -1
- package/dist/cache/cf/__tests__/cf-cache-store.test.d.ts +0 -2
- package/dist/cache/cf/__tests__/cf-cache-store.test.d.ts.map +0 -1
- package/dist/cache/cf/__tests__/cf-cache-store.test.js +0 -330
- package/dist/cache/cf/__tests__/cf-cache-store.test.js.map +0 -1
- package/dist/cache/cf/cf-cache-store.d.ts +0 -165
- package/dist/cache/cf/cf-cache-store.d.ts.map +0 -1
- package/dist/cache/cf/cf-cache-store.js +0 -242
- package/dist/cache/cf/cf-cache-store.js.map +0 -1
- package/dist/cache/cf/index.d.ts +0 -14
- package/dist/cache/cf/index.d.ts.map +0 -1
- package/dist/cache/cf/index.js +0 -17
- package/dist/cache/cf/index.js.map +0 -1
- package/dist/cache/document-cache.d.ts +0 -64
- package/dist/cache/document-cache.d.ts.map +0 -1
- package/dist/cache/document-cache.js +0 -228
- package/dist/cache/document-cache.js.map +0 -1
- package/dist/cache/index.d.ts +0 -19
- package/dist/cache/index.d.ts.map +0 -1
- package/dist/cache/index.js +0 -21
- package/dist/cache/index.js.map +0 -1
- package/dist/cache/memory-segment-store.d.ts +0 -110
- package/dist/cache/memory-segment-store.d.ts.map +0 -1
- package/dist/cache/memory-segment-store.js +0 -117
- package/dist/cache/memory-segment-store.js.map +0 -1
- package/dist/cache/memory-store.d.ts +0 -41
- package/dist/cache/memory-store.d.ts.map +0 -1
- package/dist/cache/memory-store.js +0 -191
- package/dist/cache/memory-store.js.map +0 -1
- package/dist/cache/types.d.ts +0 -317
- package/dist/cache/types.d.ts.map +0 -1
- package/dist/cache/types.js +0 -12
- package/dist/cache/types.js.map +0 -1
- package/dist/client.d.ts +0 -248
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -367
- package/dist/client.js.map +0 -1
- package/dist/client.rsc.d.ts +0 -26
- package/dist/client.rsc.d.ts.map +0 -1
- package/dist/client.rsc.js +0 -46
- package/dist/client.rsc.js.map +0 -1
- package/dist/component-utils.d.ts +0 -36
- package/dist/component-utils.d.ts.map +0 -1
- package/dist/component-utils.js +0 -61
- package/dist/component-utils.js.map +0 -1
- package/dist/components/DefaultDocument.d.ts +0 -13
- package/dist/components/DefaultDocument.d.ts.map +0 -1
- package/dist/components/DefaultDocument.js +0 -15
- package/dist/components/DefaultDocument.js.map +0 -1
- package/dist/debug.d.ts +0 -58
- package/dist/debug.d.ts.map +0 -1
- package/dist/debug.js +0 -157
- package/dist/debug.js.map +0 -1
- package/dist/default-error-boundary.d.ts +0 -11
- package/dist/default-error-boundary.d.ts.map +0 -1
- package/dist/default-error-boundary.js +0 -45
- package/dist/default-error-boundary.js.map +0 -1
- package/dist/deps/browser.d.ts +0 -2
- package/dist/deps/browser.d.ts.map +0 -1
- package/dist/deps/browser.js +0 -3
- package/dist/deps/browser.js.map +0 -1
- package/dist/deps/html-stream-client.d.ts +0 -2
- package/dist/deps/html-stream-client.d.ts.map +0 -1
- package/dist/deps/html-stream-client.js +0 -3
- package/dist/deps/html-stream-client.js.map +0 -1
- package/dist/deps/html-stream-server.d.ts +0 -2
- package/dist/deps/html-stream-server.d.ts.map +0 -1
- package/dist/deps/html-stream-server.js +0 -3
- package/dist/deps/html-stream-server.js.map +0 -1
- package/dist/deps/rsc.d.ts +0 -2
- package/dist/deps/rsc.d.ts.map +0 -1
- package/dist/deps/rsc.js +0 -4
- package/dist/deps/rsc.js.map +0 -1
- package/dist/deps/ssr.d.ts +0 -2
- package/dist/deps/ssr.d.ts.map +0 -1
- package/dist/deps/ssr.js +0 -3
- package/dist/deps/ssr.js.map +0 -1
- package/dist/errors.d.ts +0 -174
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -241
- package/dist/errors.js.map +0 -1
- package/dist/handle.d.ts +0 -78
- package/dist/handle.d.ts.map +0 -1
- package/dist/handle.js +0 -82
- package/dist/handle.js.map +0 -1
- package/dist/handles/MetaTags.d.ts +0 -14
- package/dist/handles/MetaTags.d.ts.map +0 -1
- package/dist/handles/MetaTags.js +0 -136
- package/dist/handles/MetaTags.js.map +0 -1
- package/dist/handles/index.d.ts +0 -6
- package/dist/handles/index.d.ts.map +0 -1
- package/dist/handles/index.js +0 -6
- package/dist/handles/index.js.map +0 -1
- package/dist/handles/meta.d.ts +0 -39
- package/dist/handles/meta.d.ts.map +0 -1
- package/dist/handles/meta.js +0 -202
- package/dist/handles/meta.js.map +0 -1
- package/dist/host/__tests__/errors.test.d.ts +0 -2
- package/dist/host/__tests__/errors.test.d.ts.map +0 -1
- package/dist/host/__tests__/errors.test.js +0 -76
- package/dist/host/__tests__/errors.test.js.map +0 -1
- package/dist/host/__tests__/pattern-comprehensive.test.d.ts +0 -2
- package/dist/host/__tests__/pattern-comprehensive.test.d.ts.map +0 -1
- package/dist/host/__tests__/pattern-comprehensive.test.js +0 -732
- package/dist/host/__tests__/pattern-comprehensive.test.js.map +0 -1
- package/dist/host/__tests__/pattern-matcher.test.d.ts +0 -2
- package/dist/host/__tests__/pattern-matcher.test.d.ts.map +0 -1
- package/dist/host/__tests__/pattern-matcher.test.js +0 -251
- package/dist/host/__tests__/pattern-matcher.test.js.map +0 -1
- package/dist/host/__tests__/router.test.d.ts +0 -2
- package/dist/host/__tests__/router.test.d.ts.map +0 -1
- package/dist/host/__tests__/router.test.js +0 -241
- package/dist/host/__tests__/router.test.js.map +0 -1
- package/dist/host/__tests__/testing.test.d.ts +0 -2
- package/dist/host/__tests__/testing.test.d.ts.map +0 -1
- package/dist/host/__tests__/testing.test.js +0 -64
- package/dist/host/__tests__/testing.test.js.map +0 -1
- package/dist/host/__tests__/utils.test.d.ts +0 -2
- package/dist/host/__tests__/utils.test.d.ts.map +0 -1
- package/dist/host/__tests__/utils.test.js +0 -29
- package/dist/host/__tests__/utils.test.js.map +0 -1
- package/dist/host/cookie-handler.d.ts +0 -34
- package/dist/host/cookie-handler.d.ts.map +0 -1
- package/dist/host/cookie-handler.js +0 -124
- package/dist/host/cookie-handler.js.map +0 -1
- package/dist/host/errors.d.ts +0 -56
- package/dist/host/errors.d.ts.map +0 -1
- package/dist/host/errors.js +0 -79
- package/dist/host/errors.js.map +0 -1
- package/dist/host/index.d.ts +0 -29
- package/dist/host/index.d.ts.map +0 -1
- package/dist/host/index.js +0 -32
- package/dist/host/index.js.map +0 -1
- package/dist/host/pattern-matcher.d.ts +0 -36
- package/dist/host/pattern-matcher.d.ts.map +0 -1
- package/dist/host/pattern-matcher.js +0 -172
- package/dist/host/pattern-matcher.js.map +0 -1
- package/dist/host/router.d.ts +0 -26
- package/dist/host/router.d.ts.map +0 -1
- package/dist/host/router.js +0 -218
- package/dist/host/router.js.map +0 -1
- package/dist/host/testing.d.ts +0 -36
- package/dist/host/testing.d.ts.map +0 -1
- package/dist/host/testing.js +0 -55
- package/dist/host/testing.js.map +0 -1
- package/dist/host/types.d.ts +0 -115
- package/dist/host/types.d.ts.map +0 -1
- package/dist/host/types.js +0 -7
- package/dist/host/types.js.map +0 -1
- package/dist/host/utils.d.ts +0 -21
- package/dist/host/utils.d.ts.map +0 -1
- package/dist/host/utils.js +0 -23
- package/dist/host/utils.js.map +0 -1
- package/dist/href-client.d.ts +0 -131
- package/dist/href-client.d.ts.map +0 -1
- package/dist/href-client.js +0 -64
- package/dist/href-client.js.map +0 -1
- package/dist/href-context.d.ts +0 -29
- package/dist/href-context.d.ts.map +0 -1
- package/dist/href-context.js +0 -21
- package/dist/href-context.js.map +0 -1
- package/dist/index.d.ts +0 -73
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -91
- package/dist/index.js.map +0 -1
- package/dist/index.rsc.d.ts +0 -32
- package/dist/index.rsc.d.ts.map +0 -1
- package/dist/index.rsc.js +0 -40
- package/dist/index.rsc.js.map +0 -1
- package/dist/internal-debug.d.ts +0 -2
- package/dist/internal-debug.d.ts.map +0 -1
- package/dist/internal-debug.js +0 -5
- package/dist/internal-debug.js.map +0 -1
- package/dist/loader.d.ts +0 -14
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js +0 -20
- package/dist/loader.js.map +0 -1
- package/dist/loader.rsc.d.ts +0 -19
- package/dist/loader.rsc.d.ts.map +0 -1
- package/dist/loader.rsc.js +0 -99
- package/dist/loader.rsc.js.map +0 -1
- package/dist/network-error-thrower.d.ts +0 -17
- package/dist/network-error-thrower.d.ts.map +0 -1
- package/dist/network-error-thrower.js +0 -14
- package/dist/network-error-thrower.js.map +0 -1
- package/dist/outlet-context.d.ts +0 -13
- package/dist/outlet-context.d.ts.map +0 -1
- package/dist/outlet-context.js +0 -3
- package/dist/outlet-context.js.map +0 -1
- package/dist/prerender/__tests__/param-hash.test.d.ts +0 -2
- package/dist/prerender/__tests__/param-hash.test.d.ts.map +0 -1
- package/dist/prerender/__tests__/param-hash.test.js +0 -148
- package/dist/prerender/__tests__/param-hash.test.js.map +0 -1
- package/dist/prerender/param-hash.d.ts +0 -16
- package/dist/prerender/param-hash.d.ts.map +0 -1
- package/dist/prerender/param-hash.js +0 -36
- package/dist/prerender/param-hash.js.map +0 -1
- package/dist/prerender/store.d.ts +0 -38
- package/dist/prerender/store.d.ts.map +0 -1
- package/dist/prerender/store.js +0 -61
- package/dist/prerender/store.js.map +0 -1
- package/dist/prerender.d.ts +0 -66
- package/dist/prerender.d.ts.map +0 -1
- package/dist/prerender.js +0 -57
- package/dist/prerender.js.map +0 -1
- package/dist/reverse.d.ts +0 -196
- package/dist/reverse.d.ts.map +0 -1
- package/dist/reverse.js +0 -78
- package/dist/reverse.js.map +0 -1
- package/dist/root-error-boundary.d.ts +0 -33
- package/dist/root-error-boundary.d.ts.map +0 -1
- package/dist/root-error-boundary.js +0 -165
- package/dist/root-error-boundary.js.map +0 -1
- package/dist/route-content-wrapper.d.ts +0 -46
- package/dist/route-content-wrapper.d.ts.map +0 -1
- package/dist/route-content-wrapper.js +0 -77
- package/dist/route-content-wrapper.js.map +0 -1
- package/dist/route-definition.d.ts +0 -421
- package/dist/route-definition.d.ts.map +0 -1
- package/dist/route-definition.js +0 -868
- package/dist/route-definition.js.map +0 -1
- package/dist/route-map-builder.d.ts +0 -155
- package/dist/route-map-builder.d.ts.map +0 -1
- package/dist/route-map-builder.js +0 -237
- package/dist/route-map-builder.js.map +0 -1
- package/dist/route-types.d.ts +0 -165
- package/dist/route-types.d.ts.map +0 -1
- package/dist/route-types.js +0 -7
- package/dist/route-types.js.map +0 -1
- package/dist/router/__tests__/handler-context.test.d.ts +0 -2
- package/dist/router/__tests__/handler-context.test.d.ts.map +0 -1
- package/dist/router/__tests__/handler-context.test.js +0 -65
- package/dist/router/__tests__/handler-context.test.js.map +0 -1
- package/dist/router/__tests__/loader-cycle-detection.test.d.ts +0 -2
- package/dist/router/__tests__/loader-cycle-detection.test.d.ts.map +0 -1
- package/dist/router/__tests__/loader-cycle-detection.test.js +0 -221
- package/dist/router/__tests__/loader-cycle-detection.test.js.map +0 -1
- package/dist/router/__tests__/match-context.test.d.ts +0 -2
- package/dist/router/__tests__/match-context.test.d.ts.map +0 -1
- package/dist/router/__tests__/match-context.test.js +0 -92
- package/dist/router/__tests__/match-context.test.js.map +0 -1
- package/dist/router/__tests__/match-pipelines.test.d.ts +0 -2
- package/dist/router/__tests__/match-pipelines.test.d.ts.map +0 -1
- package/dist/router/__tests__/match-pipelines.test.js +0 -417
- package/dist/router/__tests__/match-pipelines.test.js.map +0 -1
- package/dist/router/__tests__/match-result.test.d.ts +0 -2
- package/dist/router/__tests__/match-result.test.d.ts.map +0 -1
- package/dist/router/__tests__/match-result.test.js +0 -457
- package/dist/router/__tests__/match-result.test.js.map +0 -1
- package/dist/router/__tests__/on-error.test.d.ts +0 -2
- package/dist/router/__tests__/on-error.test.d.ts.map +0 -1
- package/dist/router/__tests__/on-error.test.js +0 -678
- package/dist/router/__tests__/on-error.test.js.map +0 -1
- package/dist/router/__tests__/pattern-matching.test.d.ts +0 -2
- package/dist/router/__tests__/pattern-matching.test.d.ts.map +0 -1
- package/dist/router/__tests__/pattern-matching.test.js +0 -629
- package/dist/router/__tests__/pattern-matching.test.js.map +0 -1
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.d.ts +0 -2
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.d.ts.map +0 -1
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.js +0 -155
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.js.map +0 -1
- package/dist/router/error-handling.d.ts +0 -77
- package/dist/router/error-handling.d.ts.map +0 -1
- package/dist/router/error-handling.js +0 -202
- package/dist/router/error-handling.js.map +0 -1
- package/dist/router/handler-context.d.ts +0 -20
- package/dist/router/handler-context.d.ts.map +0 -1
- package/dist/router/handler-context.js +0 -198
- package/dist/router/handler-context.js.map +0 -1
- package/dist/router/intercept-resolution.d.ts +0 -66
- package/dist/router/intercept-resolution.d.ts.map +0 -1
- package/dist/router/intercept-resolution.js +0 -246
- package/dist/router/intercept-resolution.js.map +0 -1
- package/dist/router/loader-resolution.d.ts +0 -64
- package/dist/router/loader-resolution.d.ts.map +0 -1
- package/dist/router/loader-resolution.js +0 -284
- package/dist/router/loader-resolution.js.map +0 -1
- package/dist/router/logging.d.ts +0 -15
- package/dist/router/logging.d.ts.map +0 -1
- package/dist/router/logging.js +0 -99
- package/dist/router/logging.js.map +0 -1
- package/dist/router/manifest.d.ts +0 -22
- package/dist/router/manifest.d.ts.map +0 -1
- package/dist/router/manifest.js +0 -181
- package/dist/router/manifest.js.map +0 -1
- package/dist/router/match-api.d.ts +0 -35
- package/dist/router/match-api.d.ts.map +0 -1
- package/dist/router/match-api.js +0 -406
- package/dist/router/match-api.js.map +0 -1
- package/dist/router/match-context.d.ts +0 -206
- package/dist/router/match-context.d.ts.map +0 -1
- package/dist/router/match-context.js +0 -17
- package/dist/router/match-context.js.map +0 -1
- package/dist/router/match-middleware/background-revalidation.d.ts +0 -127
- package/dist/router/match-middleware/background-revalidation.d.ts.map +0 -1
- package/dist/router/match-middleware/background-revalidation.js +0 -75
- package/dist/router/match-middleware/background-revalidation.js.map +0 -1
- package/dist/router/match-middleware/cache-lookup.d.ts +0 -112
- package/dist/router/match-middleware/cache-lookup.d.ts.map +0 -1
- package/dist/router/match-middleware/cache-lookup.js +0 -257
- package/dist/router/match-middleware/cache-lookup.js.map +0 -1
- package/dist/router/match-middleware/cache-store.d.ts +0 -113
- package/dist/router/match-middleware/cache-store.d.ts.map +0 -1
- package/dist/router/match-middleware/cache-store.js +0 -108
- package/dist/router/match-middleware/cache-store.js.map +0 -1
- package/dist/router/match-middleware/index.d.ts +0 -81
- package/dist/router/match-middleware/index.d.ts.map +0 -1
- package/dist/router/match-middleware/index.js +0 -80
- package/dist/router/match-middleware/index.js.map +0 -1
- package/dist/router/match-middleware/intercept-resolution.d.ts +0 -117
- package/dist/router/match-middleware/intercept-resolution.d.ts.map +0 -1
- package/dist/router/match-middleware/intercept-resolution.js +0 -134
- package/dist/router/match-middleware/intercept-resolution.js.map +0 -1
- package/dist/router/match-middleware/segment-resolution.d.ts +0 -99
- package/dist/router/match-middleware/segment-resolution.d.ts.map +0 -1
- package/dist/router/match-middleware/segment-resolution.js +0 -53
- package/dist/router/match-middleware/segment-resolution.js.map +0 -1
- package/dist/router/match-pipelines.d.ts +0 -147
- package/dist/router/match-pipelines.d.ts.map +0 -1
- package/dist/router/match-pipelines.js +0 -82
- package/dist/router/match-pipelines.js.map +0 -1
- package/dist/router/match-result.d.ts +0 -126
- package/dist/router/match-result.d.ts.map +0 -1
- package/dist/router/match-result.js +0 -93
- package/dist/router/match-result.js.map +0 -1
- package/dist/router/metrics.d.ts +0 -20
- package/dist/router/metrics.d.ts.map +0 -1
- package/dist/router/metrics.js +0 -47
- package/dist/router/metrics.js.map +0 -1
- package/dist/router/middleware.d.ts +0 -249
- package/dist/router/middleware.d.ts.map +0 -1
- package/dist/router/middleware.js +0 -434
- package/dist/router/middleware.js.map +0 -1
- package/dist/router/middleware.test.d.ts +0 -2
- package/dist/router/middleware.test.d.ts.map +0 -1
- package/dist/router/middleware.test.js +0 -816
- package/dist/router/middleware.test.js.map +0 -1
- package/dist/router/pattern-matching.d.ts +0 -149
- package/dist/router/pattern-matching.d.ts.map +0 -1
- package/dist/router/pattern-matching.js +0 -349
- package/dist/router/pattern-matching.js.map +0 -1
- package/dist/router/revalidation.d.ts +0 -44
- package/dist/router/revalidation.d.ts.map +0 -1
- package/dist/router/revalidation.js +0 -147
- package/dist/router/revalidation.js.map +0 -1
- package/dist/router/router-context.d.ts +0 -135
- package/dist/router/router-context.d.ts.map +0 -1
- package/dist/router/router-context.js +0 -36
- package/dist/router/router-context.js.map +0 -1
- package/dist/router/segment-resolution.d.ts +0 -127
- package/dist/router/segment-resolution.d.ts.map +0 -1
- package/dist/router/segment-resolution.js +0 -919
- package/dist/router/segment-resolution.js.map +0 -1
- package/dist/router/trie-matching.d.ts +0 -40
- package/dist/router/trie-matching.d.ts.map +0 -1
- package/dist/router/trie-matching.js +0 -127
- package/dist/router/trie-matching.js.map +0 -1
- package/dist/router/types.d.ts +0 -136
- package/dist/router/types.d.ts.map +0 -1
- package/dist/router/types.js +0 -7
- package/dist/router/types.js.map +0 -1
- package/dist/router.d.ts +0 -753
- package/dist/router.d.ts.map +0 -1
- package/dist/router.gen.d.ts +0 -6
- package/dist/router.gen.d.ts.map +0 -1
- package/dist/router.gen.js +0 -6
- package/dist/router.gen.js.map +0 -1
- package/dist/router.js +0 -1304
- package/dist/router.js.map +0 -1
- package/dist/rsc/__tests__/helpers.test.d.ts +0 -2
- package/dist/rsc/__tests__/helpers.test.d.ts.map +0 -1
- package/dist/rsc/__tests__/helpers.test.js +0 -140
- package/dist/rsc/__tests__/helpers.test.js.map +0 -1
- package/dist/rsc/handler.d.ts +0 -45
- package/dist/rsc/handler.d.ts.map +0 -1
- package/dist/rsc/handler.js +0 -1172
- package/dist/rsc/handler.js.map +0 -1
- package/dist/rsc/helpers.d.ts +0 -16
- package/dist/rsc/helpers.d.ts.map +0 -1
- package/dist/rsc/helpers.js +0 -55
- package/dist/rsc/helpers.js.map +0 -1
- package/dist/rsc/index.d.ts +0 -22
- package/dist/rsc/index.d.ts.map +0 -1
- package/dist/rsc/index.js +0 -23
- package/dist/rsc/index.js.map +0 -1
- package/dist/rsc/nonce.d.ts +0 -9
- package/dist/rsc/nonce.d.ts.map +0 -1
- package/dist/rsc/nonce.js +0 -18
- package/dist/rsc/nonce.js.map +0 -1
- package/dist/rsc/types.d.ts +0 -206
- package/dist/rsc/types.d.ts.map +0 -1
- package/dist/rsc/types.js +0 -8
- package/dist/rsc/types.js.map +0 -1
- package/dist/search-params.d.ts +0 -103
- package/dist/search-params.d.ts.map +0 -1
- package/dist/search-params.js +0 -74
- package/dist/search-params.js.map +0 -1
- package/dist/segment-system.d.ts +0 -75
- package/dist/segment-system.d.ts.map +0 -1
- package/dist/segment-system.js +0 -336
- package/dist/segment-system.js.map +0 -1
- package/dist/server/context.d.ts +0 -245
- package/dist/server/context.d.ts.map +0 -1
- package/dist/server/context.js +0 -197
- package/dist/server/context.js.map +0 -1
- package/dist/server/fetchable-loader-store.d.ts +0 -18
- package/dist/server/fetchable-loader-store.d.ts.map +0 -1
- package/dist/server/fetchable-loader-store.js +0 -18
- package/dist/server/fetchable-loader-store.js.map +0 -1
- package/dist/server/handle-store.d.ts +0 -85
- package/dist/server/handle-store.d.ts.map +0 -1
- package/dist/server/handle-store.js +0 -142
- package/dist/server/handle-store.js.map +0 -1
- package/dist/server/loader-registry.d.ts +0 -55
- package/dist/server/loader-registry.d.ts.map +0 -1
- package/dist/server/loader-registry.js +0 -132
- package/dist/server/loader-registry.js.map +0 -1
- package/dist/server/request-context.d.ts +0 -226
- package/dist/server/request-context.d.ts.map +0 -1
- package/dist/server/request-context.js +0 -290
- package/dist/server/request-context.js.map +0 -1
- package/dist/server/root-layout.d.ts +0 -4
- package/dist/server/root-layout.d.ts.map +0 -1
- package/dist/server/root-layout.js +0 -5
- package/dist/server/root-layout.js.map +0 -1
- package/dist/server.d.ts +0 -15
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -20
- package/dist/server.js.map +0 -1
- package/dist/ssr/__tests__/ssr-handler.test.d.ts +0 -2
- package/dist/ssr/__tests__/ssr-handler.test.d.ts.map +0 -1
- package/dist/ssr/__tests__/ssr-handler.test.js +0 -132
- package/dist/ssr/__tests__/ssr-handler.test.js.map +0 -1
- package/dist/ssr/index.d.ts +0 -98
- package/dist/ssr/index.d.ts.map +0 -1
- package/dist/ssr/index.js +0 -158
- package/dist/ssr/index.js.map +0 -1
- package/dist/static-handler.d.ts +0 -50
- package/dist/static-handler.d.ts.map +0 -1
- package/dist/static-handler.gen.d.ts +0 -5
- package/dist/static-handler.gen.d.ts.map +0 -1
- package/dist/static-handler.gen.js +0 -5
- package/dist/static-handler.gen.js.map +0 -1
- package/dist/static-handler.js +0 -29
- package/dist/static-handler.js.map +0 -1
- package/dist/theme/ThemeProvider.d.ts +0 -20
- package/dist/theme/ThemeProvider.d.ts.map +0 -1
- package/dist/theme/ThemeProvider.js +0 -240
- package/dist/theme/ThemeProvider.js.map +0 -1
- package/dist/theme/ThemeScript.d.ts +0 -48
- package/dist/theme/ThemeScript.d.ts.map +0 -1
- package/dist/theme/ThemeScript.js +0 -13
- package/dist/theme/ThemeScript.js.map +0 -1
- package/dist/theme/__tests__/theme.test.d.ts +0 -2
- package/dist/theme/__tests__/theme.test.d.ts.map +0 -1
- package/dist/theme/__tests__/theme.test.js +0 -103
- package/dist/theme/__tests__/theme.test.js.map +0 -1
- package/dist/theme/constants.d.ts +0 -29
- package/dist/theme/constants.d.ts.map +0 -1
- package/dist/theme/constants.js +0 -48
- package/dist/theme/constants.js.map +0 -1
- package/dist/theme/index.d.ts +0 -31
- package/dist/theme/index.d.ts.map +0 -1
- package/dist/theme/index.js +0 -36
- package/dist/theme/index.js.map +0 -1
- package/dist/theme/theme-context.d.ts +0 -40
- package/dist/theme/theme-context.d.ts.map +0 -1
- package/dist/theme/theme-context.js +0 -60
- package/dist/theme/theme-context.js.map +0 -1
- package/dist/theme/theme-script.d.ts +0 -27
- package/dist/theme/theme-script.d.ts.map +0 -1
- package/dist/theme/theme-script.js +0 -147
- package/dist/theme/theme-script.js.map +0 -1
- package/dist/theme/types.d.ts +0 -163
- package/dist/theme/types.d.ts.map +0 -1
- package/dist/theme/types.js +0 -11
- package/dist/theme/types.js.map +0 -1
- package/dist/theme/use-theme.d.ts +0 -12
- package/dist/theme/use-theme.d.ts.map +0 -1
- package/dist/theme/use-theme.js +0 -40
- package/dist/theme/use-theme.js.map +0 -1
- package/dist/types.d.ts +0 -1479
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -10
- package/dist/types.js.map +0 -1
- package/dist/urls.d.ts +0 -441
- package/dist/urls.d.ts.map +0 -1
- package/dist/urls.gen.d.ts +0 -8
- package/dist/urls.gen.d.ts.map +0 -1
- package/dist/urls.gen.js +0 -8
- package/dist/urls.gen.js.map +0 -1
- package/dist/urls.js +0 -443
- package/dist/urls.js.map +0 -1
- package/dist/use-loader.d.ts +0 -127
- package/dist/use-loader.d.ts.map +0 -1
- package/dist/use-loader.js +0 -237
- package/dist/use-loader.js.map +0 -1
- package/dist/vite/__tests__/ast-handler-extract.test.d.ts +0 -2
- package/dist/vite/__tests__/ast-handler-extract.test.d.ts.map +0 -1
- package/dist/vite/__tests__/ast-handler-extract.test.js +0 -294
- package/dist/vite/__tests__/ast-handler-extract.test.js.map +0 -1
- package/dist/vite/__tests__/expose-id-utils.test.d.ts +0 -2
- package/dist/vite/__tests__/expose-id-utils.test.d.ts.map +0 -1
- package/dist/vite/__tests__/expose-id-utils.test.js +0 -224
- package/dist/vite/__tests__/expose-id-utils.test.js.map +0 -1
- package/dist/vite/__tests__/expose-internal-ids.test.d.ts +0 -2
- package/dist/vite/__tests__/expose-internal-ids.test.d.ts.map +0 -1
- package/dist/vite/__tests__/expose-internal-ids.test.js +0 -647
- package/dist/vite/__tests__/expose-internal-ids.test.js.map +0 -1
- package/dist/vite/__tests__/expose-router-id.test.d.ts +0 -2
- package/dist/vite/__tests__/expose-router-id.test.d.ts.map +0 -1
- package/dist/vite/__tests__/expose-router-id.test.js +0 -39
- package/dist/vite/__tests__/expose-router-id.test.js.map +0 -1
- package/dist/vite/ast-handler-extract.d.ts +0 -49
- package/dist/vite/ast-handler-extract.d.ts.map +0 -1
- package/dist/vite/ast-handler-extract.js +0 -249
- package/dist/vite/ast-handler-extract.js.map +0 -1
- package/dist/vite/expose-action-id.d.ts +0 -19
- package/dist/vite/expose-action-id.d.ts.map +0 -1
- package/dist/vite/expose-action-id.js +0 -250
- package/dist/vite/expose-action-id.js.map +0 -1
- package/dist/vite/expose-id-utils.d.ts +0 -69
- package/dist/vite/expose-id-utils.d.ts.map +0 -1
- package/dist/vite/expose-id-utils.js +0 -289
- package/dist/vite/expose-id-utils.js.map +0 -1
- package/dist/vite/expose-internal-ids.d.ts +0 -22
- package/dist/vite/expose-internal-ids.d.ts.map +0 -1
- package/dist/vite/expose-internal-ids.js +0 -886
- package/dist/vite/expose-internal-ids.js.map +0 -1
- package/dist/vite/index.d.ts +0 -149
- package/dist/vite/index.d.ts.map +0 -1
- package/dist/vite/index.js.bak +0 -5448
- package/dist/vite/index.js.map +0 -1
- package/dist/vite/index.named-routes.gen.ts +0 -103
- package/dist/vite/package-resolution.d.ts +0 -43
- package/dist/vite/package-resolution.d.ts.map +0 -1
- package/dist/vite/package-resolution.js +0 -112
- package/dist/vite/package-resolution.js.map +0 -1
- package/dist/vite/virtual-entries.d.ts +0 -25
- package/dist/vite/virtual-entries.d.ts.map +0 -1
- package/dist/vite/virtual-entries.js +0 -110
- package/dist/vite/virtual-entries.js.map +0 -1
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vercel Build Output (Build Output API v3) emitter for `preset: "vercel"`.
|
|
3
|
+
*
|
|
4
|
+
* After the full app build, restructures dist/ into .vercel/output:
|
|
5
|
+
*
|
|
6
|
+
* .vercel/output/
|
|
7
|
+
* config.json routing: static first, else the function
|
|
8
|
+
* static/ dist/client (browser assets, served at /)
|
|
9
|
+
* functions/<name>.func/
|
|
10
|
+
* .vc-config.json Node serverless, response streaming
|
|
11
|
+
* index.mjs bundled launcher (srvx + @vercel/functions)
|
|
12
|
+
* rsc/ dist/rsc (self-contained RSC server bundle)
|
|
13
|
+
* ssr/ dist/ssr (rsc imports ../ssr/index.js)
|
|
14
|
+
*
|
|
15
|
+
* A prebuilt .vercel/output gets no `npm install`, so everything the function
|
|
16
|
+
* imports must physically live inside the .func directory. This relies on two
|
|
17
|
+
* things the vercel preset arranges (each is a failure only a real deploy — or
|
|
18
|
+
* the isolated smoke test — catches, since a local in-place run is masked by the
|
|
19
|
+
* app's own package.json + node_modules up the tree):
|
|
20
|
+
*
|
|
21
|
+
* 1. The rsc/ssr builds are fully bundled (`resolve.noExternal`, set in
|
|
22
|
+
* rango.ts for this preset). The node default externalizes node_modules
|
|
23
|
+
* deps, which works under `vite preview` but leaves bare imports
|
|
24
|
+
* (@vercel/functions, react-dom/server.edge, ...) that have no node_modules
|
|
25
|
+
* to resolve against on Vercel.
|
|
26
|
+
* 2. A `package.json` with `"type": "module"` is written into the .func dir.
|
|
27
|
+
* The rsc/ssr bundles are ESM but use a `.js` extension; without a
|
|
28
|
+
* type:module in scope the deployed (isolated) function loads them as
|
|
29
|
+
* CommonJS and fails on the first `import`.
|
|
30
|
+
*
|
|
31
|
+
* The launcher is bundled with srvx (the Web->Node streaming bridge, a
|
|
32
|
+
* @rangojs/router dependency) and @vercel/functions (resolved from the app)
|
|
33
|
+
* inlined, keeping the RSC bundle a runtime-relative external.
|
|
34
|
+
*
|
|
35
|
+
* Timing: this runs in the `buildApp` hook (order "post"), which fires once
|
|
36
|
+
* after every environment has built, so dist/{client,rsc,ssr} all exist.
|
|
37
|
+
* closeBundle is unusable here — it fires per environment, and twice for ssr
|
|
38
|
+
* (the server-reference scan and the real build), so it would run before
|
|
39
|
+
* dist/client exists. rango's own prerender/static emitters hardcode dist/rsc,
|
|
40
|
+
* so we build to dist/ and restructure here rather than retargeting outDir.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
import type { Plugin } from "vite";
|
|
44
|
+
import { rm, mkdir, cp, writeFile } from "node:fs/promises";
|
|
45
|
+
import { existsSync } from "node:fs";
|
|
46
|
+
import { resolve, join } from "node:path";
|
|
47
|
+
import { createRequire } from "node:module";
|
|
48
|
+
import { pathToFileURL } from "node:url";
|
|
49
|
+
import { escapeRegExp } from "../../regex-escape.js";
|
|
50
|
+
import type {
|
|
51
|
+
RangoVercelOptions,
|
|
52
|
+
VercelPresetOptions,
|
|
53
|
+
} from "../plugin-types.js";
|
|
54
|
+
|
|
55
|
+
// Minimal structural types for the esbuild API we use, resolved dynamically from
|
|
56
|
+
// the app so @rangojs/router does not depend on esbuild's type package.
|
|
57
|
+
interface EsbuildPluginBuild {
|
|
58
|
+
onResolve(
|
|
59
|
+
options: { filter: RegExp },
|
|
60
|
+
callback: () => { path: string; external: boolean },
|
|
61
|
+
): void;
|
|
62
|
+
}
|
|
63
|
+
type EsbuildBuild = (options: Record<string, unknown>) => Promise<unknown>;
|
|
64
|
+
interface EsbuildModule {
|
|
65
|
+
build?: EsbuildBuild;
|
|
66
|
+
default?: { build?: EsbuildBuild };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const LAUNCHER_SOURCE = `import { toNodeHandler } from "srvx/node";
|
|
70
|
+
import { waitUntil } from "@vercel/functions";
|
|
71
|
+
import rscHandler from "./rsc/index.js";
|
|
72
|
+
|
|
73
|
+
// The Vercel Node launcher invokes a Node (req, res) handler, not a Web fetch
|
|
74
|
+
// handler. srvx's toNodeHandler bridges the Rango Web fetch handler and pipes
|
|
75
|
+
// the streamed Response to the Node response (set supportsResponseStreaming).
|
|
76
|
+
const onVercel = Boolean(process.env.VERCEL);
|
|
77
|
+
|
|
78
|
+
const fetchHandler = (request) =>
|
|
79
|
+
rscHandler(request, {
|
|
80
|
+
env: process.env,
|
|
81
|
+
// Forward Vercel's waitUntil so cache writes / revalidation run off the
|
|
82
|
+
// response path. Omitted off-platform so those writes settle inline.
|
|
83
|
+
ctx: onVercel ? { waitUntil } : undefined,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export default toNodeHandler(fetchHandler);
|
|
87
|
+
`;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Reject a non-Node runtime for the vercel preset. The preset only emits a Node
|
|
91
|
+
* serverless function (launcherType "Nodejs", bundled Node APIs, response
|
|
92
|
+
* streaming). Vercel's Edge runtime needs a different Build Output primitive
|
|
93
|
+
* (EdgeFunction, a Web-handler entry, no node_modules) that this assembler does
|
|
94
|
+
* not produce, so a non-nodejs runtime would emit a config the platform rejects
|
|
95
|
+
* or mis-runs. Fail fast at build time instead of shipping a broken function.
|
|
96
|
+
*/
|
|
97
|
+
export function assertVercelNodeRuntime(runtime: string | undefined): void {
|
|
98
|
+
if (runtime != null && !runtime.startsWith("nodejs")) {
|
|
99
|
+
throw new Error(
|
|
100
|
+
`[rango] preset "vercel": runtime "${runtime}" is not supported. ` +
|
|
101
|
+
`This preset emits a Node serverless function; use a "nodejs*" runtime ` +
|
|
102
|
+
`(default "nodejs22.x"). The Edge runtime is not supported.`,
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The function name becomes a `.func` directory segment and the config.json
|
|
109
|
+
* route `dest` (`/${functionName}`). An empty or space/slash-containing value
|
|
110
|
+
* would land raw in both, producing a broken function path, so restrict it to a
|
|
111
|
+
* safe single path segment and fail loudly rather than emit unroutable output.
|
|
112
|
+
*/
|
|
113
|
+
export function assertValidVercelFunctionName(functionName: string): void {
|
|
114
|
+
if (!/^[A-Za-z0-9._-]+$/.test(functionName)) {
|
|
115
|
+
throw new Error(
|
|
116
|
+
`[rango] preset "vercel": invalid functionName ${JSON.stringify(
|
|
117
|
+
functionName,
|
|
118
|
+
)}. Use letters, digits, ".", "_" or "-" only (it becomes the .func directory and the routing dest).`,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** The `.vc-config.json` body: a Node serverless function with streaming. */
|
|
124
|
+
export function buildVercelVcConfig(
|
|
125
|
+
vercel: VercelPresetOptions,
|
|
126
|
+
): Record<string, unknown> {
|
|
127
|
+
const vcConfig: Record<string, unknown> = {
|
|
128
|
+
runtime: vercel.runtime ?? "nodejs22.x",
|
|
129
|
+
handler: "index.mjs",
|
|
130
|
+
launcherType: "Nodejs",
|
|
131
|
+
shouldAddHelpers: false,
|
|
132
|
+
supportsResponseStreaming: true,
|
|
133
|
+
maxDuration: vercel.maxDuration ?? 30,
|
|
134
|
+
};
|
|
135
|
+
if (vercel.memory != null) vcConfig.memory = vercel.memory;
|
|
136
|
+
if (vercel.regions != null) vcConfig.regions = vercel.regions;
|
|
137
|
+
return vcConfig;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The Build Output API v3 `config.json` body. Routes, in order: long-cache the
|
|
142
|
+
* content-hashed assets under `${assetsDir}/` (safe to serve `immutable`;
|
|
143
|
+
* without this Vercel serves them `max-age=0, must-revalidate` and browsers
|
|
144
|
+
* re-request every asset on each visit), then the filesystem handler, then
|
|
145
|
+
* everything to the function. The header route uses `continue: true` so it falls
|
|
146
|
+
* through to the filesystem handler that actually serves the file.
|
|
147
|
+
*
|
|
148
|
+
* Route `src` values are REGEXES on Vercel, so the prefix is regex-escaped
|
|
149
|
+
* (an unescaped `assetsDir: "static.v2"` would immutable-stamp any
|
|
150
|
+
* `/static?v2/...` path, including function-rendered pages). An empty
|
|
151
|
+
* assetsDir (assets at the outDir root) gets no header route at all: there is
|
|
152
|
+
* no prefix separating hashed from non-hashed files, so fall back to Vercel's
|
|
153
|
+
* safe default headers. Two accepted edges, matching what other framework
|
|
154
|
+
* adapters (Astro, SvelteKit) emit: files a user places in
|
|
155
|
+
* `public/${assetsDir}/` land under the same prefix and are also stamped
|
|
156
|
+
* immutable (assemble() warns about the collision), and a request for a
|
|
157
|
+
* MISSING asset falls through to the function whose 404 carries the header.
|
|
158
|
+
*/
|
|
159
|
+
export function buildVercelOutputConfig(
|
|
160
|
+
functionName: string,
|
|
161
|
+
assetsDir: string,
|
|
162
|
+
): { version: number; routes: unknown[] } {
|
|
163
|
+
const assetsPrefix = assetsDir.replace(/^\/+|\/+$/g, "");
|
|
164
|
+
const assetHeaderRoute = assetsPrefix
|
|
165
|
+
? [
|
|
166
|
+
{
|
|
167
|
+
src: `/${escapeRegExp(assetsPrefix)}/(.*)`,
|
|
168
|
+
headers: { "cache-control": "public, max-age=31536000, immutable" },
|
|
169
|
+
continue: true,
|
|
170
|
+
},
|
|
171
|
+
]
|
|
172
|
+
: [];
|
|
173
|
+
return {
|
|
174
|
+
version: 3,
|
|
175
|
+
routes: [
|
|
176
|
+
...assetHeaderRoute,
|
|
177
|
+
{ handle: "filesystem" },
|
|
178
|
+
{ src: "/(.*)", dest: `/${functionName}` },
|
|
179
|
+
],
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
async function assemble(
|
|
184
|
+
root: string,
|
|
185
|
+
options: RangoVercelOptions,
|
|
186
|
+
assetsDir: string,
|
|
187
|
+
publicDir: string,
|
|
188
|
+
): Promise<void> {
|
|
189
|
+
const vercel = options.vercel ?? {};
|
|
190
|
+
// Validate config before touching the build output.
|
|
191
|
+
assertVercelNodeRuntime(vercel.runtime);
|
|
192
|
+
|
|
193
|
+
// Files in public/<assetsDir>/ are copied into the same output prefix as the
|
|
194
|
+
// content-hashed build assets, so the immutable cache-control route stamps
|
|
195
|
+
// them too -- replacing such a file after a deploy never reaches returning
|
|
196
|
+
// visitors. Warn instead of silently pinning.
|
|
197
|
+
const assetsPrefix = assetsDir.replace(/^\/+|\/+$/g, "");
|
|
198
|
+
if (publicDir && assetsPrefix && existsSync(join(publicDir, assetsPrefix))) {
|
|
199
|
+
console.warn(
|
|
200
|
+
`[rango] preset "vercel": ${join(publicDir, assetsPrefix)} exists. ` +
|
|
201
|
+
`Files under public/${assetsPrefix}/ share the /${assetsPrefix}/ URL prefix ` +
|
|
202
|
+
`with hashed build assets and will be served with a one-year immutable ` +
|
|
203
|
+
`cache-control header. Move un-hashed public files out of "${assetsPrefix}/".`,
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const dist = join(root, "dist");
|
|
208
|
+
for (const dir of ["client", "rsc", "ssr"]) {
|
|
209
|
+
if (!existsSync(join(dist, dir))) {
|
|
210
|
+
throw new Error(
|
|
211
|
+
`[rango] preset "vercel": missing dist/${dir}. Run the production build first.`,
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
const functionName = vercel.functionName ?? "index";
|
|
216
|
+
assertValidVercelFunctionName(functionName);
|
|
217
|
+
const out = join(root, ".vercel", "output");
|
|
218
|
+
const funcDir = join(out, "functions", `${functionName}.func`);
|
|
219
|
+
|
|
220
|
+
await rm(out, { recursive: true, force: true });
|
|
221
|
+
await mkdir(funcDir, { recursive: true });
|
|
222
|
+
|
|
223
|
+
// 1. Static client assets -> served from the CDN at the root.
|
|
224
|
+
await cp(join(dist, "client"), join(out, "static"), { recursive: true });
|
|
225
|
+
|
|
226
|
+
// 2. Server bundle into the function. Preserve the rsc -> ../ssr/index.js
|
|
227
|
+
// relative import by mirroring the dist/{rsc,ssr} layout inside the func.
|
|
228
|
+
await cp(join(dist, "rsc"), join(funcDir, "rsc"), { recursive: true });
|
|
229
|
+
await cp(join(dist, "ssr"), join(funcDir, "ssr"), { recursive: true });
|
|
230
|
+
|
|
231
|
+
// Prerender/static payload manifests (present only when routes are prerendered).
|
|
232
|
+
if (existsSync(join(dist, "static"))) {
|
|
233
|
+
await cp(join(dist, "static"), join(funcDir, "static"), {
|
|
234
|
+
recursive: true,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// 3. Bundle the Node launcher. srvx (a @rangojs/router dependency) is aliased
|
|
239
|
+
// to its resolved path; @vercel/functions resolves from the app; the RSC
|
|
240
|
+
// server bundle stays a runtime-relative external.
|
|
241
|
+
const rangoRequire = createRequire(import.meta.url);
|
|
242
|
+
let srvxNodePath: string;
|
|
243
|
+
try {
|
|
244
|
+
srvxNodePath = rangoRequire.resolve("srvx/node");
|
|
245
|
+
} catch {
|
|
246
|
+
throw new Error(
|
|
247
|
+
'[rango] preset "vercel" requires "srvx" (a dependency of @rangojs/router). Reinstall dependencies.',
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// esbuild ships with Vite, so we never add it as a @rangojs/router dependency.
|
|
252
|
+
// It is a DIRECT dependency of Vite but only a TRANSITIVE one from the app's
|
|
253
|
+
// view, so under strict pnpm it is NOT resolvable from the app root. Resolve it
|
|
254
|
+
// through Vite's module location (Vite is a direct app dependency, and esbuild
|
|
255
|
+
// is a direct dependency of Vite). Minimal structural types avoid coupling to
|
|
256
|
+
// esbuild's type package at compile time.
|
|
257
|
+
const appRequire = createRequire(join(root, "package.json"));
|
|
258
|
+
const resolveEsbuildPath = (): string => {
|
|
259
|
+
try {
|
|
260
|
+
const viteRequire = createRequire(appRequire.resolve("vite"));
|
|
261
|
+
return viteRequire.resolve("esbuild");
|
|
262
|
+
} catch {
|
|
263
|
+
// Intentionally empty: fall through to the app/rango fallbacks below.
|
|
264
|
+
}
|
|
265
|
+
try {
|
|
266
|
+
return appRequire.resolve("esbuild");
|
|
267
|
+
} catch {
|
|
268
|
+
// Intentionally empty: last resort is @rangojs/router's own resolver.
|
|
269
|
+
}
|
|
270
|
+
return rangoRequire.resolve("esbuild");
|
|
271
|
+
};
|
|
272
|
+
let esbuildModule: EsbuildModule;
|
|
273
|
+
try {
|
|
274
|
+
esbuildModule = (await import(
|
|
275
|
+
pathToFileURL(resolveEsbuildPath()).href
|
|
276
|
+
)) as EsbuildModule;
|
|
277
|
+
} catch {
|
|
278
|
+
throw new Error(
|
|
279
|
+
'[rango] preset "vercel" requires "esbuild" to bundle the function launcher. It ships with Vite; reinstall dependencies (or add esbuild to your app dependencies).',
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
const esbuildBuild = esbuildModule.build ?? esbuildModule.default?.build;
|
|
283
|
+
if (typeof esbuildBuild !== "function") {
|
|
284
|
+
throw new Error('[rango] preset "vercel": could not load esbuild.build.');
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
try {
|
|
288
|
+
await esbuildBuild({
|
|
289
|
+
stdin: {
|
|
290
|
+
contents: LAUNCHER_SOURCE,
|
|
291
|
+
resolveDir: root,
|
|
292
|
+
sourcefile: "func-entry.mjs",
|
|
293
|
+
loader: "js",
|
|
294
|
+
},
|
|
295
|
+
outfile: join(funcDir, "index.mjs"),
|
|
296
|
+
bundle: true,
|
|
297
|
+
format: "esm",
|
|
298
|
+
platform: "node",
|
|
299
|
+
target: "node18",
|
|
300
|
+
alias: { "srvx/node": srvxNodePath },
|
|
301
|
+
plugins: [
|
|
302
|
+
{
|
|
303
|
+
name: "external-rsc-entry",
|
|
304
|
+
setup(b: EsbuildPluginBuild) {
|
|
305
|
+
b.onResolve({ filter: /^\.\/rsc\/index\.js$/ }, () => ({
|
|
306
|
+
path: "./rsc/index.js",
|
|
307
|
+
external: true,
|
|
308
|
+
}));
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
});
|
|
313
|
+
} catch (error) {
|
|
314
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
315
|
+
if (/@vercel\/functions/.test(message)) {
|
|
316
|
+
throw new Error(
|
|
317
|
+
'[rango] preset "vercel": could not resolve "@vercel/functions". Add it to your app dependencies (it also backs VercelCacheStore).\n' +
|
|
318
|
+
message,
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
throw error;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// 3b. Mark the function as ESM. The rsc/ssr bundles are .js ESM files with no
|
|
325
|
+
// package.json in scope on the deployed function (it is isolated at
|
|
326
|
+
// /var/task), so Node would load them as CommonJS and fail on `import`.
|
|
327
|
+
// Locally this is masked because the func inherits the app's
|
|
328
|
+
// "type": "module" up the tree; the deployed func has nothing above it.
|
|
329
|
+
await writeFile(
|
|
330
|
+
join(funcDir, "package.json"),
|
|
331
|
+
JSON.stringify({ type: "module" }, null, 2) + "\n",
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
// 4. Function config: Node serverless with response streaming.
|
|
335
|
+
await writeFile(
|
|
336
|
+
join(funcDir, ".vc-config.json"),
|
|
337
|
+
JSON.stringify(buildVercelVcConfig(vercel), null, 2) + "\n",
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
// 5. Routing config (immutable assets -> filesystem -> function).
|
|
341
|
+
await writeFile(
|
|
342
|
+
join(out, "config.json"),
|
|
343
|
+
JSON.stringify(buildVercelOutputConfig(functionName, assetsDir), null, 2) +
|
|
344
|
+
"\n",
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
console.log(
|
|
348
|
+
`[rango] assembled .vercel/output (function: ${functionName}.func)`,
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export function createVercelOutputPlugin(options: RangoVercelOptions): Plugin {
|
|
353
|
+
let root = process.cwd();
|
|
354
|
+
let isBuild = false;
|
|
355
|
+
// The client build's assetsDir (Vite default "assets"); used to scope the
|
|
356
|
+
// immutable cache-control route to the content-hashed asset output.
|
|
357
|
+
let assetsDir = "assets";
|
|
358
|
+
// Resolved publicDir ("" when disabled); used to warn when public/<assetsDir>
|
|
359
|
+
// exists, since its un-hashed files share the immutable-header prefix.
|
|
360
|
+
let publicDir = "";
|
|
361
|
+
return {
|
|
362
|
+
name: "@rangojs/router:vercel-output",
|
|
363
|
+
configResolved(config) {
|
|
364
|
+
root = resolve(config.root);
|
|
365
|
+
isBuild = config.command === "build";
|
|
366
|
+
assetsDir =
|
|
367
|
+
config.environments?.client?.build?.assetsDir ??
|
|
368
|
+
config.build?.assetsDir ??
|
|
369
|
+
"assets";
|
|
370
|
+
publicDir = config.publicDir || "";
|
|
371
|
+
},
|
|
372
|
+
// buildApp runs once after the whole multi-environment build (rsc, client,
|
|
373
|
+
// ssr), so dist/ is complete here. closeBundle is unusable for this: it
|
|
374
|
+
// fires per environment, and twice for ssr (the server-reference scan and
|
|
375
|
+
// the real build), so it would run before dist/client exists.
|
|
376
|
+
buildApp: {
|
|
377
|
+
order: "post",
|
|
378
|
+
async handler() {
|
|
379
|
+
if (!isBuild) return;
|
|
380
|
+
await assemble(root, options, assetsDir, publicDir);
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
};
|
|
384
|
+
}
|
|
@@ -125,6 +125,78 @@ export default function handler(request, env) {
|
|
|
125
125
|
`.trim();
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
export function getVirtualEntryRSCHost(hostEntryPath: string): string {
|
|
129
|
+
return `
|
|
130
|
+
import * as __hostEntry from "${hostEntryPath}";
|
|
131
|
+
import { isNoRouteMatchError } from "@rangojs/router/host";
|
|
132
|
+
|
|
133
|
+
// Register every sub-app's fetchable loaders + route manifests at startup, same
|
|
134
|
+
// as the single-router entry. Discovery's host fallback populates these for all
|
|
135
|
+
// mounted sub-apps, so the aggregate manifests cover the whole host tree.
|
|
136
|
+
import "virtual:rsc-router/loader-manifest";
|
|
137
|
+
import "virtual:rsc-router/routes-manifest";
|
|
138
|
+
|
|
139
|
+
// The host entry module must export the HostRouter instance (createHostRouter()),
|
|
140
|
+
// as a default export or a named \`hostRouter\`/\`router\` export. A Cloudflare-style
|
|
141
|
+
// \`export default { fetch }\` object is not a HostRouter and is rejected (on first
|
|
142
|
+
// request; see the lazy resolution below).
|
|
143
|
+
// We require BOTH .match() and .host(): a regular createRouter() also exposes
|
|
144
|
+
// .match(), so matching on .match() alone would accept an ordinary router and then
|
|
145
|
+
// return its MatchResult (not a Response) at runtime. .host() is unique to a
|
|
146
|
+
// HostRouter, so it disambiguates a mistaken \`hostRouter\` path.
|
|
147
|
+
// Exports are read dynamically (m[name]) so Rollup does not emit IMPORT_IS_UNDEFINED
|
|
148
|
+
// warnings for the named exports a default-only host module legitimately omits.
|
|
149
|
+
const __resolveHostRouter = (m) => {
|
|
150
|
+
for (const name of ["default", "hostRouter", "router"]) {
|
|
151
|
+
const candidate = m[name];
|
|
152
|
+
if (
|
|
153
|
+
candidate &&
|
|
154
|
+
typeof candidate.match === "function" &&
|
|
155
|
+
typeof candidate.host === "function"
|
|
156
|
+
)
|
|
157
|
+
return candidate;
|
|
158
|
+
}
|
|
159
|
+
return undefined;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// Resolve + validate the HostRouter lazily on first request, mirroring the
|
|
163
|
+
// single-router entry's \`_handler\`. During HMR the host module can re-evaluate
|
|
164
|
+
// before its createHostRouter() export has resolved; validating at module-
|
|
165
|
+
// evaluation time would then throw a spurious "must export a HostRouter" error
|
|
166
|
+
// overlay for a perfectly valid app. Resolving on first request lets the live
|
|
167
|
+
// binding settle first.
|
|
168
|
+
let _hostRouter;
|
|
169
|
+
|
|
170
|
+
// input = { env, ctx } from the launcher / node server. The host router threads
|
|
171
|
+
// it unchanged to each matched sub-app's handler and cache factory.
|
|
172
|
+
// On node/vercel rango owns this entry, so there is no user worker to translate
|
|
173
|
+
// an unmatched host into a response: catch NoRouteMatchError and return 404
|
|
174
|
+
// (parity with the documented Cloudflare catch). Other errors propagate.
|
|
175
|
+
export default async function handler(request, input) {
|
|
176
|
+
if (!_hostRouter) {
|
|
177
|
+
_hostRouter = __resolveHostRouter(__hostEntry);
|
|
178
|
+
if (!_hostRouter) {
|
|
179
|
+
throw new Error(
|
|
180
|
+
"[rango] The host entry (${hostEntryPath}) must export a HostRouter instance (createHostRouter()) for the node/vercel preset: a default export, or a named 'hostRouter'/'router' export. An ordinary createRouter() is not a host router (it has no .host()), and a Cloudflare-style 'export default { fetch }' object is not supported on this preset."
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
return await _hostRouter.match(request, input);
|
|
186
|
+
} catch (err) {
|
|
187
|
+
// isNoRouteMatchError also matches by name: a workspace with a duplicated
|
|
188
|
+
// @rangojs/router copy can throw a NoRouteMatchError whose prototype differs
|
|
189
|
+
// from this module's import, so a bare instanceof would turn an
|
|
190
|
+
// unmatched-host 404 into a 500.
|
|
191
|
+
if (isNoRouteMatchError(err)) {
|
|
192
|
+
return new Response("Not Found", { status: 404 });
|
|
193
|
+
}
|
|
194
|
+
throw err;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
`.trim();
|
|
198
|
+
}
|
|
199
|
+
|
|
128
200
|
export const VIRTUAL_IDS = {
|
|
129
201
|
browser: "virtual:rsc-router/entry.browser.js",
|
|
130
202
|
ssr: "virtual:rsc-router/entry.ssr.js",
|
package/src/vite/rango.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PluginOption } from "vite";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
2
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { exposeActionId } from "./plugins/expose-action-id.js";
|
|
5
5
|
import {
|
|
@@ -15,11 +15,15 @@ import {
|
|
|
15
15
|
getPublishedPackageName,
|
|
16
16
|
getVendorAliases,
|
|
17
17
|
} from "./utils/package-resolution.js";
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
findRouterFiles,
|
|
20
|
+
findHostRouterFiles,
|
|
21
|
+
} from "../build/generate-route-types.js";
|
|
19
22
|
import { createVersionPlugin } from "./plugins/version-plugin.js";
|
|
20
23
|
import {
|
|
21
24
|
sharedRolldownOptions,
|
|
22
25
|
createVirtualEntriesPlugin,
|
|
26
|
+
normalizeHostRouterEntry,
|
|
23
27
|
onwarn,
|
|
24
28
|
getManualChunks,
|
|
25
29
|
} from "./utils/shared-utils.js";
|
|
@@ -27,7 +31,12 @@ import {
|
|
|
27
31
|
resolveClientChunks,
|
|
28
32
|
type ClientChunkContext,
|
|
29
33
|
} from "./utils/client-chunks.js";
|
|
30
|
-
import type {
|
|
34
|
+
import type {
|
|
35
|
+
RangoOptions,
|
|
36
|
+
RangoNodeOptions,
|
|
37
|
+
RangoVercelOptions,
|
|
38
|
+
} from "./plugin-types.js";
|
|
39
|
+
import { createVercelOutputPlugin } from "./plugins/vercel-output.js";
|
|
31
40
|
import { printBanner, rangoVersion } from "./utils/banner.js";
|
|
32
41
|
import { createVersionInjectorPlugin } from "./plugins/version-injector.js";
|
|
33
42
|
import { createCjsToEsmPlugin } from "./plugins/cjs-to-esm.js";
|
|
@@ -110,10 +119,20 @@ export async function rango(options?: RangoOptions): Promise<PluginOption[]> {
|
|
|
110
119
|
const pkg = getPublishedPackageName();
|
|
111
120
|
const nested = (spec: string) => `${pkg} > ${spec}`;
|
|
112
121
|
|
|
113
|
-
// Mutable ref for
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
|
|
122
|
+
// Mutable ref for the served entry path (node/vercel presets only). Populated
|
|
123
|
+
// by the auto-discover config() hook using Vite's resolved root. `kind` selects
|
|
124
|
+
// the RSC entry template: "router" wraps a single createRouter() app in
|
|
125
|
+
// createRSCHandler; "host" wraps a createHostRouter() instance and serves it
|
|
126
|
+
// via hostRouter.match().
|
|
127
|
+
const routerRef: { path: string | undefined; kind: "router" | "host" } = {
|
|
128
|
+
path: undefined,
|
|
129
|
+
kind: "router",
|
|
130
|
+
};
|
|
131
|
+
// Explicit host-router entry (node/vercel `hostRouter` option), root-relative.
|
|
132
|
+
const explicitHostRouter =
|
|
133
|
+
preset !== "cloudflare"
|
|
134
|
+
? (resolvedOptions as RangoNodeOptions | RangoVercelOptions).hostRouter
|
|
135
|
+
: undefined;
|
|
117
136
|
|
|
118
137
|
// Build-time prerendering is enabled for both presets.
|
|
119
138
|
// Collection runs in-process via the RSC dev environment runner during discoverRouters().
|
|
@@ -238,20 +257,65 @@ export async function rango(options?: RangoOptions): Promise<PluginOption[]> {
|
|
|
238
257
|
const root = userConfig.root
|
|
239
258
|
? resolve(process.cwd(), userConfig.root)
|
|
240
259
|
: process.cwd();
|
|
260
|
+
const toRootRelative = (abs: string) =>
|
|
261
|
+
(abs.startsWith(root)
|
|
262
|
+
? "./" + abs.slice(root.length + 1)
|
|
263
|
+
: abs
|
|
264
|
+
).replaceAll("\\", "/");
|
|
265
|
+
const bulletList = (files: string[]) =>
|
|
266
|
+
files.map((f) => " - " + toRootRelative(f)).join("\n");
|
|
267
|
+
|
|
268
|
+
// 1. Explicit host entry wins: serve the createHostRouter() instance.
|
|
269
|
+
if (explicitHostRouter) {
|
|
270
|
+
routerRef.path = normalizeHostRouterEntry(
|
|
271
|
+
explicitHostRouter,
|
|
272
|
+
root,
|
|
273
|
+
existsSync,
|
|
274
|
+
);
|
|
275
|
+
routerRef.kind = "host";
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// 2. A createHostRouter() file means this is a multi-app host deploy:
|
|
280
|
+
// serve it via the host entry. Checked BEFORE single-router discovery,
|
|
281
|
+
// because a host app may compose just one createRouter() sub-app plus
|
|
282
|
+
// host middleware / domain rules / inline .map() routes -- and a lone
|
|
283
|
+
// sub-app must not shadow the host entry (it would bypass
|
|
284
|
+
// hostRouter.match()).
|
|
285
|
+
const hostCandidates = findHostRouterFiles(root);
|
|
286
|
+
if (hostCandidates.length === 1) {
|
|
287
|
+
const hostPath = toRootRelative(hostCandidates[0]);
|
|
288
|
+
// Auto-detection preempts single-router discovery, so name the winning
|
|
289
|
+
// file: a stale prototype still containing `createHostRouter(` would
|
|
290
|
+
// otherwise silently become the served entry in place of the app.
|
|
291
|
+
// eslint-disable-next-line no-console
|
|
292
|
+
console.info(
|
|
293
|
+
`[rango] Serving host router entry ${hostPath} (auto-detected). ` +
|
|
294
|
+
`Set the \`hostRouter\` option to override.`,
|
|
295
|
+
);
|
|
296
|
+
routerRef.path = hostPath;
|
|
297
|
+
routerRef.kind = "host";
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (hostCandidates.length > 1) {
|
|
301
|
+
throw new Error(
|
|
302
|
+
`[rango] Multiple host routers found:\n${bulletList(hostCandidates)}\n\n` +
|
|
303
|
+
`Set the \`hostRouter\` option to the entry to serve, e.g. rango({ preset: "${preset}", hostRouter: "./src/worker.rsc.tsx" }).`,
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// 3. No host entry: single createRouter() app.
|
|
241
308
|
const candidates = findRouterFiles(root);
|
|
242
309
|
if (candidates.length === 1) {
|
|
243
|
-
|
|
244
|
-
routerRef.
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
(
|
|
251
|
-
|
|
252
|
-
)
|
|
253
|
-
.join("\n");
|
|
254
|
-
throw new Error(`[rango] Multiple routers found:\n${list}`);
|
|
310
|
+
routerRef.path = toRootRelative(candidates[0]);
|
|
311
|
+
routerRef.kind = "router";
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (candidates.length > 1) {
|
|
315
|
+
throw new Error(
|
|
316
|
+
`[rango] Multiple routers found:\n${bulletList(candidates)}\n\n` +
|
|
317
|
+
`If this is a multi-app host router, export a createHostRouter() instance and set the \`hostRouter\` option (e.g. rango({ preset: "${preset}", hostRouter: "./src/worker.rsc.tsx" })), or use preset: "cloudflare" where you own the worker entry.`,
|
|
318
|
+
);
|
|
255
319
|
}
|
|
256
320
|
},
|
|
257
321
|
});
|
|
@@ -270,8 +334,34 @@ export async function rango(options?: RangoOptions): Promise<PluginOption[]> {
|
|
|
270
334
|
name: "@rangojs/router:rsc-integration",
|
|
271
335
|
enforce: "pre",
|
|
272
336
|
|
|
273
|
-
config() {
|
|
337
|
+
config(_userConfig, configEnv) {
|
|
338
|
+
// Fold NODE_ENV for the vercel preset's build. The cloudflare plugin
|
|
339
|
+
// does this automatically and node apps do it themselves; vercel has no
|
|
340
|
+
// platform plugin, so without this React's CJS dev branch survives and
|
|
341
|
+
// doubles the SSR/RSC bundle (Bundle Hygiene rule #2). Only the exact
|
|
342
|
+
// `process.env.NODE_ENV` token is replaced.
|
|
343
|
+
const vercelDefine =
|
|
344
|
+
preset === "vercel" && configEnv.command === "build"
|
|
345
|
+
? { "process.env.NODE_ENV": JSON.stringify("production") }
|
|
346
|
+
: undefined;
|
|
347
|
+
// The vercel preset's deployed function has no node_modules, so the
|
|
348
|
+
// server bundles must be fully self-contained. Bundle every dependency
|
|
349
|
+
// into the rsc + ssr builds instead of externalizing them (the node
|
|
350
|
+
// default, which only works because `vite preview` runs where
|
|
351
|
+
// node_modules exists). node: builtins stay external automatically.
|
|
352
|
+
//
|
|
353
|
+
// BUILD ONLY. In `vite dev` this must NOT apply: noExternal forces every
|
|
354
|
+
// server dependency through the RSC/SSR dev module runners, which cannot
|
|
355
|
+
// load many CJS packages (pg, mysql2, most SDKs, @vercel/functions) and
|
|
356
|
+
// crashes the dev server -- while the same app runs fine under
|
|
357
|
+
// preset: "node" and in the production build. Gating on `build` restores
|
|
358
|
+
// node-preset dev semantics (deps externalized to Node's require).
|
|
359
|
+
const vercelServerEnv =
|
|
360
|
+
preset === "vercel" && configEnv.command === "build"
|
|
361
|
+
? { resolve: { noExternal: true as const } }
|
|
362
|
+
: undefined;
|
|
274
363
|
return {
|
|
364
|
+
...(vercelDefine ? { define: vercelDefine } : {}),
|
|
275
365
|
optimizeDeps: {
|
|
276
366
|
exclude: excludeDeps,
|
|
277
367
|
rolldownOptions: sharedRolldownOptions,
|
|
@@ -314,6 +404,7 @@ export async function rango(options?: RangoOptions): Promise<PluginOption[]> {
|
|
|
314
404
|
},
|
|
315
405
|
},
|
|
316
406
|
ssr: {
|
|
407
|
+
...(vercelServerEnv ?? {}),
|
|
317
408
|
optimizeDeps: {
|
|
318
409
|
entries: [VIRTUAL_IDS.ssr],
|
|
319
410
|
include: [
|
|
@@ -332,6 +423,7 @@ export async function rango(options?: RangoOptions): Promise<PluginOption[]> {
|
|
|
332
423
|
},
|
|
333
424
|
},
|
|
334
425
|
rsc: {
|
|
426
|
+
...(vercelServerEnv ?? {}),
|
|
335
427
|
optimizeDeps: {
|
|
336
428
|
entries: [VIRTUAL_IDS.rsc],
|
|
337
429
|
include: [
|
|
@@ -363,7 +455,11 @@ export async function rango(options?: RangoOptions): Promise<PluginOption[]> {
|
|
|
363
455
|
? "preview"
|
|
364
456
|
: "dev"
|
|
365
457
|
: "build";
|
|
366
|
-
printBanner(
|
|
458
|
+
printBanner(
|
|
459
|
+
mode,
|
|
460
|
+
preset === "vercel" ? "vercel" : "node",
|
|
461
|
+
rangoVersion,
|
|
462
|
+
);
|
|
367
463
|
}
|
|
368
464
|
|
|
369
465
|
const rscMinimalCount = config.plugins.filter(
|
|
@@ -443,6 +539,17 @@ export async function rango(options?: RangoOptions): Promise<PluginOption[]> {
|
|
|
443
539
|
}),
|
|
444
540
|
);
|
|
445
541
|
|
|
542
|
+
// Vercel preset: assemble .vercel/output from dist/ after the build. Pushed
|
|
543
|
+
// last so its buildApp (order "post") hook runs after the discovery plugin's
|
|
544
|
+
// rsc-env postprocess. buildApp fires once after the whole multi-environment
|
|
545
|
+
// build, so dist/ is complete (closeBundle is unusable here -- it fires per
|
|
546
|
+
// environment, twice for ssr; see the plugin's own note).
|
|
547
|
+
if (preset === "vercel") {
|
|
548
|
+
plugins.push(
|
|
549
|
+
createVercelOutputPlugin(resolvedOptions as RangoVercelOptions),
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
|
|
446
553
|
debugConfig?.(
|
|
447
554
|
"rango(%s) setup done: %d plugin(s) (%sms)",
|
|
448
555
|
preset,
|