@rangojs/router 0.0.0-experimental.35 → 0.0.0-experimental.358c376d
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/AGENTS.md +11 -3
- package/README.md +320 -735
- package/dist/bin/rango.js +983 -241
- package/dist/testing/vitest.js +82 -0
- package/dist/types/__internal.d.ts +127 -0
- package/dist/types/bin/rango.d.ts +1 -0
- package/dist/types/browser/action-coordinator.d.ts +57 -0
- package/dist/types/browser/action-fence.d.ts +33 -0
- package/dist/types/browser/app-shell.d.ts +34 -0
- package/dist/types/browser/app-version.d.ts +6 -0
- package/dist/types/browser/connection-warmup.d.ts +31 -0
- package/dist/types/browser/cookie-name.d.ts +66 -0
- package/dist/types/browser/dev-discovery.d.ts +11 -0
- package/dist/types/browser/event-controller.d.ts +231 -0
- package/dist/types/browser/history-state.d.ts +26 -0
- package/dist/types/browser/index.d.ts +1 -0
- package/dist/types/browser/intercept-utils.d.ts +30 -0
- package/dist/types/browser/invalidate-client-cache.d.ts +17 -0
- package/dist/types/browser/link-interceptor.d.ts +53 -0
- package/dist/types/browser/logging.d.ts +33 -0
- package/dist/types/browser/merge-segment-loaders.d.ts +38 -0
- package/dist/types/browser/navigation-bridge.d.ts +39 -0
- package/dist/types/browser/navigation-client.d.ts +17 -0
- package/dist/types/browser/navigation-store-handle.d.ts +25 -0
- package/dist/types/browser/navigation-store.d.ts +85 -0
- package/dist/types/browser/navigation-transaction.d.ts +75 -0
- package/dist/types/browser/network-error-handler.d.ts +35 -0
- package/dist/types/browser/notify-listeners.d.ts +2 -0
- package/dist/types/browser/partial-update.d.ts +61 -0
- package/dist/types/browser/prefetch/cache.d.ts +224 -0
- package/dist/types/browser/prefetch/default-strategy.d.ts +31 -0
- package/dist/types/browser/prefetch/fetch.d.ts +52 -0
- package/dist/types/browser/prefetch/invalidation.d.ts +6 -0
- package/dist/types/browser/prefetch/loader.d.ts +12 -0
- package/dist/types/browser/prefetch/observer.d.ts +24 -0
- package/dist/types/browser/prefetch/policy.d.ts +13 -0
- package/dist/types/browser/prefetch/queue.d.ts +48 -0
- package/dist/types/browser/prefetch/resource-ready.d.ts +28 -0
- package/dist/types/browser/prefetch/runtime.d.ts +2 -0
- package/dist/types/browser/rango-state.d.ts +56 -0
- package/dist/types/browser/react/Link.d.ts +132 -0
- package/dist/types/browser/react/NavigationProvider.d.ts +88 -0
- package/dist/types/browser/react/ScrollRestoration.d.ts +78 -0
- package/dist/types/browser/react/context.d.ts +57 -0
- package/dist/types/browser/react/filter-segment-order.d.ts +35 -0
- package/dist/types/browser/react/index.d.ts +1 -0
- package/dist/types/browser/react/location-state-shared.d.ts +162 -0
- package/dist/types/browser/react/location-state.d.ts +29 -0
- package/dist/types/browser/react/mount-context.d.ts +23 -0
- package/dist/types/browser/react/nonce-context.d.ts +14 -0
- package/dist/types/browser/react/shallow-equal.d.ts +5 -0
- package/dist/types/browser/react/use-action.d.ts +61 -0
- package/dist/types/browser/react/use-handle.d.ts +21 -0
- package/dist/types/browser/react/use-href.d.ts +32 -0
- package/dist/types/browser/react/use-link-status.d.ts +36 -0
- package/dist/types/browser/react/use-mount.d.ts +24 -0
- package/dist/types/browser/react/use-navigation.d.ts +15 -0
- package/dist/types/browser/react/use-params.d.ts +21 -0
- package/dist/types/browser/react/use-pathname.d.ts +13 -0
- package/dist/types/browser/react/use-reverse.d.ts +40 -0
- package/dist/types/browser/react/use-router.d.ts +23 -0
- package/dist/types/browser/react/use-search-params.d.ts +19 -0
- package/dist/types/browser/react/use-segments.d.ts +29 -0
- package/dist/types/browser/response-adapter.d.ts +58 -0
- package/dist/types/browser/rsc-router.d.ts +146 -0
- package/dist/types/browser/scroll-restoration.d.ts +103 -0
- package/dist/types/browser/segment-reconciler.d.ts +74 -0
- package/dist/types/browser/segment-structure-assert.d.ts +16 -0
- package/dist/types/browser/server-action-bridge.d.ts +29 -0
- package/dist/types/browser/types.d.ts +546 -0
- package/dist/types/browser/validate-redirect-origin.d.ts +28 -0
- package/dist/types/build/collect-fallback-refs.d.ts +5 -0
- package/dist/types/build/generate-manifest.d.ts +106 -0
- package/dist/types/build/generate-route-types.d.ts +8 -0
- package/dist/types/build/index.d.ts +21 -0
- package/dist/types/build/merge-full-manifests.d.ts +3 -0
- package/dist/types/build/prefix-tree-utils.d.ts +56 -0
- package/dist/types/build/route-trie.d.ts +20 -0
- package/dist/types/build/route-types/ast-helpers.d.ts +3 -0
- package/dist/types/build/route-types/ast-route-extraction.d.ts +13 -0
- package/dist/types/build/route-types/codegen.d.ts +16 -0
- package/dist/types/build/route-types/include-resolution.d.ts +74 -0
- package/dist/types/build/route-types/param-extraction.d.ts +13 -0
- package/dist/types/build/route-types/per-module-writer.d.ts +20 -0
- package/dist/types/build/route-types/router-processing.d.ts +81 -0
- package/dist/types/build/route-types/scan-filter.d.ts +17 -0
- package/dist/types/build/route-types/source-scan.d.ts +13 -0
- package/dist/types/build/runtime-discovery.d.ts +24 -0
- package/dist/types/cache/background-task.d.ts +21 -0
- package/dist/types/cache/cache-error.d.ts +71 -0
- package/dist/types/cache/cache-exec-scope.d.ts +31 -0
- package/dist/types/cache/cache-key-utils.d.ts +43 -0
- package/dist/types/cache/cache-policy.d.ts +59 -0
- package/dist/types/cache/cache-runtime.d.ts +51 -0
- package/dist/types/cache/cache-scope.d.ts +215 -0
- package/dist/types/cache/cache-tag.d.ts +79 -0
- package/dist/types/cache/cf/cf-base64.d.ts +4 -0
- package/dist/types/cache/cf/cf-cache-constants.d.ts +112 -0
- package/dist/types/cache/cf/cf-cache-store.d.ts +616 -0
- package/dist/types/cache/cf/cf-cache-types.d.ts +365 -0
- package/dist/types/cache/cf/cf-kv-utils.d.ts +43 -0
- package/dist/types/cache/cf/cf-tag-marker-memo.d.ts +15 -0
- package/dist/types/cache/cf/cf-zone-purge.d.ts +31 -0
- package/dist/types/cache/cf/index.d.ts +4 -0
- package/dist/types/cache/document-cache.d.ts +71 -0
- package/dist/types/cache/handle-capture.d.ts +23 -0
- package/dist/types/cache/handle-snapshot.d.ts +39 -0
- package/dist/types/cache/index.d.ts +9 -0
- package/dist/types/cache/memory-segment-store.d.ts +163 -0
- package/dist/types/cache/profile-registry.d.ts +40 -0
- package/dist/types/cache/read-through-swr.d.ts +61 -0
- package/dist/types/cache/search-params-filter.d.ts +64 -0
- package/dist/types/cache/segment-codec.d.ts +78 -0
- package/dist/types/cache/shell-snapshot.d.ts +186 -0
- package/dist/types/cache/tag-invalidation.d.ts +74 -0
- package/dist/types/cache/taint.d.ts +77 -0
- package/dist/types/cache/types.d.ts +503 -0
- package/dist/types/cache/vercel/index.d.ts +1 -0
- package/dist/types/cache/vercel/vercel-cache-store.d.ts +268 -0
- package/dist/types/client-urls/client-root.d.ts +38 -0
- package/dist/types/client-urls/client-urls.d.ts +5 -0
- package/dist/types/client-urls/navigation.d.ts +38 -0
- package/dist/types/client-urls/revalidation-protocol.d.ts +25 -0
- package/dist/types/client-urls/server-projection.d.ts +62 -0
- package/dist/types/client-urls/types.d.ts +144 -0
- package/dist/types/client.d.ts +191 -0
- package/dist/types/client.rsc.d.ts +41 -0
- package/dist/types/cloudflare/index.d.ts +7 -0
- package/dist/types/cloudflare/tracing.d.ts +57 -0
- package/dist/types/component-utils.d.ts +46 -0
- package/dist/types/components/DefaultDocument.d.ts +13 -0
- package/dist/types/context-var.d.ts +84 -0
- package/dist/types/debug.d.ts +57 -0
- package/dist/types/decode-loader-results.d.ts +42 -0
- package/dist/types/default-error-boundary.d.ts +10 -0
- package/dist/types/defer.d.ts +89 -0
- package/dist/types/deps/browser.d.ts +1 -0
- package/dist/types/deps/html-stream-client.d.ts +1 -0
- package/dist/types/deps/html-stream-server.d.ts +1 -0
- package/dist/types/deps/rsc.d.ts +1 -0
- package/dist/types/deps/ssr.d.ts +1 -0
- package/dist/types/dev-discovery-protocol.d.ts +5 -0
- package/dist/types/encode-kv.d.ts +35 -0
- package/dist/types/errors.d.ts +227 -0
- package/dist/types/escape-script.d.ts +44 -0
- package/dist/types/handle.d.ts +93 -0
- package/dist/types/handles/MetaTags.d.ts +17 -0
- package/dist/types/handles/Scripts.d.ts +38 -0
- package/dist/types/handles/breadcrumbs.d.ts +43 -0
- package/dist/types/handles/deferred-resolution.d.ts +53 -0
- package/dist/types/handles/is-thenable.d.ts +10 -0
- package/dist/types/handles/meta.d.ts +43 -0
- package/dist/types/handles/script.d.ts +139 -0
- package/dist/types/host/cookie-handler.d.ts +8 -0
- package/dist/types/host/errors.d.ts +40 -0
- package/dist/types/host/index.d.ts +33 -0
- package/dist/types/host/pattern-matcher.d.ts +30 -0
- package/dist/types/host/router.d.ts +12 -0
- package/dist/types/host/testing.d.ts +41 -0
- package/dist/types/host/types.d.ts +148 -0
- package/dist/types/host/utils.d.ts +20 -0
- package/dist/types/href-client.d.ts +214 -0
- package/dist/types/index.d.ts +113 -0
- package/dist/types/index.rsc.d.ts +52 -0
- package/dist/types/internal-debug.d.ts +1 -0
- package/dist/types/loader-redirect.d.ts +18 -0
- package/dist/types/loader-store.d.ts +193 -0
- package/dist/types/loader.d.ts +18 -0
- package/dist/types/loader.rsc.d.ts +18 -0
- package/dist/types/missing-id-error.d.ts +1 -0
- package/dist/types/outlet-context.d.ts +24 -0
- package/dist/types/outlet-provider.d.ts +14 -0
- package/dist/types/prerender/build-shell-capture.d.ts +104 -0
- package/dist/types/prerender/param-hash.d.ts +6 -0
- package/dist/types/prerender/shell-manifest-key.d.ts +18 -0
- package/dist/types/prerender/store.d.ts +63 -0
- package/dist/types/prerender.d.ts +292 -0
- package/dist/types/redirect-origin.d.ts +67 -0
- package/dist/types/regex-escape.d.ts +6 -0
- package/dist/types/render-error-thrower.d.ts +13 -0
- package/dist/types/response-utils.d.ts +35 -0
- package/dist/types/reverse.d.ts +206 -0
- package/dist/types/root-error-boundary.d.ts +32 -0
- package/dist/types/route-content-wrapper.d.ts +81 -0
- package/dist/types/route-definition/dsl-helpers.d.ts +130 -0
- package/dist/types/route-definition/helper-factories.d.ts +22 -0
- package/dist/types/route-definition/helpers-types.d.ts +404 -0
- package/dist/types/route-definition/index.d.ts +7 -0
- package/dist/types/route-definition/redirect.d.ts +48 -0
- package/dist/types/route-definition/resolve-handler-use.d.ts +19 -0
- package/dist/types/route-definition/use-item-types.d.ts +1 -0
- package/dist/types/route-definition.d.ts +1 -0
- package/dist/types/route-map-builder.d.ts +102 -0
- package/dist/types/route-name.d.ts +27 -0
- package/dist/types/route-types.d.ts +172 -0
- package/dist/types/router/basename.d.ts +10 -0
- package/dist/types/router/content-negotiation.d.ts +91 -0
- package/dist/types/router/debug-manifest.d.ts +7 -0
- package/dist/types/router/error-handling.d.ts +110 -0
- package/dist/types/router/find-match.d.ts +19 -0
- package/dist/types/router/handler-context.d.ts +41 -0
- package/dist/types/router/instrument.d.ts +191 -0
- package/dist/types/router/intercept-resolution.d.ts +91 -0
- package/dist/types/router/lazy-includes.d.ts +26 -0
- package/dist/types/router/loader-resolution.d.ts +85 -0
- package/dist/types/router/logging.d.ts +41 -0
- package/dist/types/router/manifest.d.ts +8 -0
- package/dist/types/router/match-api.d.ts +19 -0
- package/dist/types/router/match-context.d.ts +184 -0
- package/dist/types/router/match-handlers.d.ts +48 -0
- package/dist/types/router/match-middleware/background-revalidation.d.ts +113 -0
- package/dist/types/router/match-middleware/cache-lookup.d.ts +126 -0
- package/dist/types/router/match-middleware/cache-store.d.ts +112 -0
- package/dist/types/router/match-middleware/index.d.ts +80 -0
- package/dist/types/router/match-middleware/intercept-resolution.d.ts +116 -0
- package/dist/types/router/match-middleware/segment-resolution.d.ts +94 -0
- package/dist/types/router/match-pipelines.d.ts +103 -0
- package/dist/types/router/match-result.d.ts +114 -0
- package/dist/types/router/metrics.d.ts +6 -0
- package/dist/types/router/middleware-types.d.ts +74 -0
- package/dist/types/router/middleware.d.ts +116 -0
- package/dist/types/router/navigation-snapshot.d.ts +51 -0
- package/dist/types/router/params-util.d.ts +8 -0
- package/dist/types/router/parse-pattern.d.ts +38 -0
- package/dist/types/router/pattern-matching.d.ts +169 -0
- package/dist/types/router/prefetch-cache-ttl.d.ts +27 -0
- package/dist/types/router/prefetch-default.d.ts +28 -0
- package/dist/types/router/prefetch-limits.d.ts +20 -0
- package/dist/types/router/prerender-match.d.ts +53 -0
- package/dist/types/router/preview-match.d.ts +22 -0
- package/dist/types/router/request-classification.d.ts +104 -0
- package/dist/types/router/revalidation.d.ts +64 -0
- package/dist/types/router/route-snapshot.d.ts +112 -0
- package/dist/types/router/route-trie-builder.d.ts +77 -0
- package/dist/types/router/router-context.d.ts +137 -0
- package/dist/types/router/router-interfaces.d.ts +461 -0
- package/dist/types/router/router-options.d.ts +792 -0
- package/dist/types/router/router-registry.d.ts +15 -0
- package/dist/types/router/segment-resolution/fresh.d.ts +55 -0
- package/dist/types/router/segment-resolution/helpers.d.ts +93 -0
- package/dist/types/router/segment-resolution/loader-cache.d.ts +33 -0
- package/dist/types/router/segment-resolution/loader-mask.d.ts +44 -0
- package/dist/types/router/segment-resolution/loader-snapshot.d.ts +90 -0
- package/dist/types/router/segment-resolution/mask-nested.d.ts +53 -0
- package/dist/types/router/segment-resolution/revalidation.d.ts +85 -0
- package/dist/types/router/segment-resolution/static-store.d.ts +17 -0
- package/dist/types/router/segment-resolution/streamed-handler-telemetry.d.ts +16 -0
- package/dist/types/router/segment-resolution/view-transition-default.d.ts +27 -0
- package/dist/types/router/segment-resolution.d.ts +3 -0
- package/dist/types/router/segment-wrappers.d.ts +53 -0
- package/dist/types/router/state-cookie-name.d.ts +1 -0
- package/dist/types/router/substitute-pattern-params.d.ts +23 -0
- package/dist/types/router/telemetry-otel.d.ts +113 -0
- package/dist/types/router/telemetry.d.ts +216 -0
- package/dist/types/router/timeout.d.ts +107 -0
- package/dist/types/router/tracing.d.ts +139 -0
- package/dist/types/router/transition-when.d.ts +13 -0
- package/dist/types/router/trie-matching.d.ts +32 -0
- package/dist/types/router/types.d.ts +98 -0
- package/dist/types/router/url-params.d.ts +26 -0
- package/dist/types/router.d.ts +7 -0
- package/dist/types/rsc/capture-queue.d.ts +49 -0
- package/dist/types/rsc/full-payload.d.ts +22 -0
- package/dist/types/rsc/handler-context.d.ts +32 -0
- package/dist/types/rsc/handler.d.ts +9 -0
- package/dist/types/rsc/helpers.d.ts +127 -0
- package/dist/types/rsc/index.d.ts +17 -0
- package/dist/types/rsc/json-route-result.d.ts +20 -0
- package/dist/types/rsc/loader-fetch.d.ts +14 -0
- package/dist/types/rsc/manifest-init.d.ts +18 -0
- package/dist/types/rsc/nonce.d.ts +28 -0
- package/dist/types/rsc/origin-guard.d.ts +50 -0
- package/dist/types/rsc/progressive-enhancement.d.ts +19 -0
- package/dist/types/rsc/redirect-guard.d.ts +37 -0
- package/dist/types/rsc/render-pipeline.d.ts +148 -0
- package/dist/types/rsc/response-cache-serve.d.ts +46 -0
- package/dist/types/rsc/response-error.d.ts +19 -0
- package/dist/types/rsc/response-route-handler.d.ts +29 -0
- package/dist/types/rsc/routine-plan.d.ts +124 -0
- package/dist/types/rsc/rsc-rendering.d.ts +18 -0
- package/dist/types/rsc/runtime-warnings.d.ts +22 -0
- package/dist/types/rsc/server-action.d.ts +68 -0
- package/dist/types/rsc/shell-build-manifest.d.ts +90 -0
- package/dist/types/rsc/shell-capture-constants.d.ts +44 -0
- package/dist/types/rsc/shell-capture.d.ts +406 -0
- package/dist/types/rsc/shell-serve.d.ts +189 -0
- package/dist/types/rsc/ssr-setup.d.ts +73 -0
- package/dist/types/rsc/stream-idle.d.ts +60 -0
- package/dist/types/rsc/transition-gate.d.ts +23 -0
- package/dist/types/rsc/types.d.ts +328 -0
- package/dist/types/runtime-env.d.ts +1 -0
- package/dist/types/search-params.d.ts +125 -0
- package/dist/types/segment-content-promise.d.ts +13 -0
- package/dist/types/segment-fragments.d.ts +79 -0
- package/dist/types/segment-loader-promise.d.ts +22 -0
- package/dist/types/segment-system.d.ts +86 -0
- package/dist/types/serialize.d.ts +164 -0
- package/dist/types/server/context.d.ts +520 -0
- package/dist/types/server/cookie-parse.d.ts +10 -0
- package/dist/types/server/cookie-store.d.ts +107 -0
- package/dist/types/server/fetchable-loader-store.d.ts +20 -0
- package/dist/types/server/handle-store.d.ts +131 -0
- package/dist/types/server/loader-registry.d.ts +32 -0
- package/dist/types/server/request-context.d.ts +717 -0
- package/dist/types/server/root-layout.d.ts +3 -0
- package/dist/types/server.d.ts +16 -0
- package/dist/types/ssr/index.d.ts +233 -0
- package/dist/types/ssr/inject-rsc-eager.d.ts +3 -0
- package/dist/types/ssr/preinit-client-references.d.ts +71 -0
- package/dist/types/ssr/ssr-root.d.ts +69 -0
- package/dist/types/static-handler.d.ts +71 -0
- package/dist/types/testing/cache-status.d.ts +63 -0
- package/dist/types/testing/collect-handle.d.ts +20 -0
- package/dist/types/testing/dispatch.d.ts +127 -0
- package/dist/types/testing/dom.entry.d.ts +15 -0
- package/dist/types/testing/e2e/fixture.d.ts +37 -0
- package/dist/types/testing/e2e/index.d.ts +31 -0
- package/dist/types/testing/e2e/matchers.d.ts +17 -0
- package/dist/types/testing/e2e/page-helpers.d.ts +86 -0
- package/dist/types/testing/e2e/parity.d.ts +111 -0
- package/dist/types/testing/e2e/server.d.ts +35 -0
- package/dist/types/testing/flight-matchers.d.ts +55 -0
- package/dist/types/testing/flight-normalize.d.ts +1 -0
- package/dist/types/testing/flight-tree.d.ts +192 -0
- package/dist/types/testing/flight.d.ts +115 -0
- package/dist/types/testing/flight.entry.d.ts +27 -0
- package/dist/types/testing/generated-routes.d.ts +66 -0
- package/dist/types/testing/index.d.ts +54 -0
- package/dist/types/testing/internal/context.d.ts +225 -0
- package/dist/types/testing/internal/flight-client-globals.d.ts +1 -0
- package/dist/types/testing/internal/seed-vars.d.ts +30 -0
- package/dist/types/testing/render-handler.d.ts +160 -0
- package/dist/types/testing/render-route.d.ts +265 -0
- package/dist/types/testing/run-loader.d.ts +195 -0
- package/dist/types/testing/run-middleware.d.ts +132 -0
- package/dist/types/testing/run-transition-when.d.ts +78 -0
- package/dist/types/testing/shell-status.d.ts +81 -0
- package/dist/types/testing/vitest-stubs/cloudflare-email.d.ts +6 -0
- package/dist/types/testing/vitest-stubs/cloudflare-workers.d.ts +13 -0
- package/dist/types/testing/vitest-stubs/plugin-rsc.d.ts +7 -0
- package/dist/types/testing/vitest-stubs/version.d.ts +1 -0
- package/dist/types/testing/vitest.d.ts +205 -0
- package/dist/types/theme/ThemeProvider.d.ts +13 -0
- package/dist/types/theme/ThemeScript.d.ts +45 -0
- package/dist/types/theme/constants.d.ts +39 -0
- package/dist/types/theme/index.d.ts +29 -0
- package/dist/types/theme/theme-context.d.ts +21 -0
- package/dist/types/theme/theme-script.d.ts +26 -0
- package/dist/types/theme/types.d.ts +162 -0
- package/dist/types/theme/use-theme.d.ts +8 -0
- package/dist/types/types/boundaries.d.ts +110 -0
- package/dist/types/types/cache-types.d.ts +191 -0
- package/dist/types/types/error-types.d.ts +114 -0
- package/dist/types/types/global-namespace.d.ts +90 -0
- package/dist/types/types/handler-context.d.ts +658 -0
- package/dist/types/types/index.d.ts +11 -0
- package/dist/types/types/loader-types.d.ts +234 -0
- package/dist/types/types/request-scope.d.ts +93 -0
- package/dist/types/types/route-config.d.ts +105 -0
- package/dist/types/types/route-entry.d.ts +98 -0
- package/dist/types/types/segments.d.ts +246 -0
- package/dist/types/types.d.ts +1 -0
- package/dist/types/urls/include-helper.d.ts +17 -0
- package/dist/types/urls/include-provider.d.ts +27 -0
- package/dist/types/urls/index.d.ts +6 -0
- package/dist/types/urls/path-helper-types.d.ts +203 -0
- package/dist/types/urls/path-helper.d.ts +12 -0
- package/dist/types/urls/pattern-types.d.ts +166 -0
- package/dist/types/urls/response-types.d.ts +67 -0
- package/dist/types/urls/type-extraction.d.ts +157 -0
- package/dist/types/urls/urls-function.d.ts +24 -0
- package/dist/types/urls.d.ts +1 -0
- package/dist/types/use-loader.d.ts +150 -0
- package/dist/types/vercel/index.d.ts +10 -0
- package/dist/types/vercel/tracing.d.ts +71 -0
- package/dist/types/vite/debug.d.ts +80 -0
- package/dist/types/vite/discovery/bundle-postprocess.d.ts +12 -0
- package/dist/types/vite/discovery/client-urls-projection.d.ts +53 -0
- package/dist/types/vite/discovery/dev-prerender-cache.d.ts +65 -0
- package/dist/types/vite/discovery/discover-routers.d.ts +17 -0
- package/dist/types/vite/discovery/discovery-errors.d.ts +113 -0
- package/dist/types/vite/discovery/gate-state.d.ts +79 -0
- package/dist/types/vite/discovery/prerender-collection.d.ts +24 -0
- package/dist/types/vite/discovery/route-types-writer.d.ts +32 -0
- package/dist/types/vite/discovery/self-gen-tracking.d.ts +22 -0
- package/dist/types/vite/discovery/shell-prerender-phase.d.ts +40 -0
- package/dist/types/vite/discovery/state.d.ts +170 -0
- package/dist/types/vite/discovery/virtual-module-codegen.d.ts +15 -0
- package/dist/types/vite/encryption-key.d.ts +2 -0
- package/dist/types/vite/index.d.ts +11 -0
- package/dist/types/vite/inject-client-debug.d.ts +56 -0
- package/dist/types/vite/plugin-types.d.ts +298 -0
- package/dist/types/vite/plugins/cjs-to-esm.d.ts +6 -0
- package/dist/types/vite/plugins/client-ref-dedup.d.ts +40 -0
- package/dist/types/vite/plugins/client-ref-hashing.d.ts +35 -0
- package/dist/types/vite/plugins/cloudflare-protocol-stub.d.ts +64 -0
- package/dist/types/vite/plugins/expose-action-id.d.ts +18 -0
- package/dist/types/vite/plugins/expose-id-utils.d.ts +37 -0
- package/dist/types/vite/plugins/expose-ids/export-analysis.d.ts +19 -0
- package/dist/types/vite/plugins/expose-ids/handler-transform.d.ts +10 -0
- package/dist/types/vite/plugins/expose-ids/loader-transform.d.ts +8 -0
- package/dist/types/vite/plugins/expose-ids/router-transform.d.ts +13 -0
- package/dist/types/vite/plugins/expose-ids/types.d.ts +29 -0
- package/dist/types/vite/plugins/expose-internal-ids.d.ts +16 -0
- package/dist/types/vite/plugins/performance-tracks.d.ts +25 -0
- package/dist/types/vite/plugins/refresh-cmd.d.ts +20 -0
- package/dist/types/vite/plugins/server-ref-hashing.d.ts +24 -0
- package/dist/types/vite/plugins/server-reference-pattern.d.ts +1 -0
- package/dist/types/vite/plugins/use-cache-transform.d.ts +20 -0
- package/dist/types/vite/plugins/vercel-output.d.ts +85 -0
- package/dist/types/vite/plugins/version-injector.d.ts +21 -0
- package/dist/types/vite/plugins/version-plugin.d.ts +19 -0
- package/dist/types/vite/plugins/virtual-entries.d.ts +36 -0
- package/dist/types/vite/plugins/virtual-stub-plugin.d.ts +7 -0
- package/dist/types/vite/rango.d.ts +29 -0
- package/dist/types/vite/router-discovery.d.ts +23 -0
- package/dist/types/vite/utils/ast-handler-extract.d.ts +64 -0
- package/dist/types/vite/utils/banner.d.ts +2 -0
- package/dist/types/vite/utils/bundle-analysis.d.ts +28 -0
- package/dist/types/vite/utils/client-chunks.d.ts +55 -0
- package/dist/types/vite/utils/directive-prologue.d.ts +16 -0
- package/dist/types/vite/utils/forward-user-plugins.d.ts +37 -0
- package/dist/types/vite/utils/manifest-utils.d.ts +7 -0
- package/dist/types/vite/utils/package-resolution.d.ts +6 -0
- package/dist/types/vite/utils/prerender-utils.d.ts +32 -0
- package/dist/types/vite/utils/shared-utils.d.ts +67 -0
- package/dist/types.backup/__internal.d.ts +127 -0
- package/dist/types.backup/bin/rango.d.ts +1 -0
- package/dist/types.backup/browser/action-coordinator.d.ts +57 -0
- package/dist/types.backup/browser/action-fence.d.ts +33 -0
- package/dist/types.backup/browser/app-shell.d.ts +34 -0
- package/dist/types.backup/browser/app-version.d.ts +6 -0
- package/dist/types.backup/browser/connection-warmup.d.ts +31 -0
- package/dist/types.backup/browser/cookie-name.d.ts +66 -0
- package/dist/types.backup/browser/event-controller.d.ts +221 -0
- package/dist/types.backup/browser/history-state.d.ts +26 -0
- package/dist/types.backup/browser/index.d.ts +1 -0
- package/dist/types.backup/browser/intercept-utils.d.ts +30 -0
- package/dist/types.backup/browser/invalidate-client-cache.d.ts +17 -0
- package/dist/types.backup/browser/link-interceptor.d.ts +43 -0
- package/dist/types.backup/browser/logging.d.ts +33 -0
- package/dist/types.backup/browser/merge-segment-loaders.d.ts +38 -0
- package/dist/types.backup/browser/navigation-bridge.d.ts +27 -0
- package/dist/types.backup/browser/navigation-client.d.ts +17 -0
- package/dist/types.backup/browser/navigation-store-handle.d.ts +25 -0
- package/dist/types.backup/browser/navigation-store.d.ts +95 -0
- package/dist/types.backup/browser/navigation-transaction.d.ts +75 -0
- package/dist/types.backup/browser/network-error-handler.d.ts +35 -0
- package/dist/types.backup/browser/partial-update.d.ts +61 -0
- package/dist/types.backup/browser/prefetch/cache.d.ts +183 -0
- package/dist/types.backup/browser/prefetch/fetch.d.ts +52 -0
- package/dist/types.backup/browser/prefetch/observer.d.ts +27 -0
- package/dist/types.backup/browser/prefetch/policy.d.ts +13 -0
- package/dist/types.backup/browser/prefetch/queue.d.ts +48 -0
- package/dist/types.backup/browser/prefetch/resource-ready.d.ts +28 -0
- package/dist/types.backup/browser/rango-state.d.ts +52 -0
- package/dist/types.backup/browser/react/Link.d.ts +140 -0
- package/dist/types.backup/browser/react/NavigationProvider.d.ts +88 -0
- package/dist/types.backup/browser/react/ScrollRestoration.d.ts +78 -0
- package/dist/types.backup/browser/react/context.d.ts +54 -0
- package/dist/types.backup/browser/react/filter-segment-order.d.ts +35 -0
- package/dist/types.backup/browser/react/index.d.ts +1 -0
- package/dist/types.backup/browser/react/location-state-shared.d.ts +162 -0
- package/dist/types.backup/browser/react/location-state.d.ts +29 -0
- package/dist/types.backup/browser/react/mount-context.d.ts +23 -0
- package/dist/types.backup/browser/react/nonce-context.d.ts +14 -0
- package/dist/types.backup/browser/react/shallow-equal.d.ts +5 -0
- package/dist/types.backup/browser/react/use-action.d.ts +61 -0
- package/dist/types.backup/browser/react/use-handle.d.ts +21 -0
- package/dist/types.backup/browser/react/use-href.d.ts +32 -0
- package/dist/types.backup/browser/react/use-link-status.d.ts +36 -0
- package/dist/types.backup/browser/react/use-mount.d.ts +24 -0
- package/dist/types.backup/browser/react/use-navigation.d.ts +15 -0
- package/dist/types.backup/browser/react/use-params.d.ts +21 -0
- package/dist/types.backup/browser/react/use-pathname.d.ts +13 -0
- package/dist/types.backup/browser/react/use-reverse.d.ts +40 -0
- package/dist/types.backup/browser/react/use-router.d.ts +23 -0
- package/dist/types.backup/browser/react/use-search-params.d.ts +19 -0
- package/dist/types.backup/browser/react/use-segments.d.ts +29 -0
- package/dist/types.backup/browser/response-adapter.d.ts +58 -0
- package/dist/types.backup/browser/rsc-router.d.ts +141 -0
- package/dist/types.backup/browser/scroll-restoration.d.ts +103 -0
- package/dist/types.backup/browser/segment-reconciler.d.ts +74 -0
- package/dist/types.backup/browser/segment-structure-assert.d.ts +16 -0
- package/dist/types.backup/browser/server-action-bridge.d.ts +29 -0
- package/dist/types.backup/browser/types.d.ts +530 -0
- package/dist/types.backup/browser/validate-redirect-origin.d.ts +28 -0
- package/dist/types.backup/build/collect-fallback-refs.d.ts +5 -0
- package/dist/types.backup/build/generate-manifest.d.ts +100 -0
- package/dist/types.backup/build/generate-route-types.d.ts +8 -0
- package/dist/types.backup/build/index.d.ts +21 -0
- package/dist/types.backup/build/prefix-tree-utils.d.ts +56 -0
- package/dist/types.backup/build/route-trie.d.ts +89 -0
- package/dist/types.backup/build/route-types/ast-helpers.d.ts +3 -0
- package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +13 -0
- package/dist/types.backup/build/route-types/codegen.d.ts +16 -0
- package/dist/types.backup/build/route-types/include-resolution.d.ts +74 -0
- package/dist/types.backup/build/route-types/param-extraction.d.ts +13 -0
- package/dist/types.backup/build/route-types/per-module-writer.d.ts +18 -0
- package/dist/types.backup/build/route-types/router-processing.d.ts +82 -0
- package/dist/types.backup/build/route-types/scan-filter.d.ts +17 -0
- package/dist/types.backup/build/route-types/source-scan.d.ts +13 -0
- package/dist/types.backup/build/runtime-discovery.d.ts +24 -0
- package/dist/types.backup/cache/background-task.d.ts +21 -0
- package/dist/types.backup/cache/cache-error.d.ts +71 -0
- package/dist/types.backup/cache/cache-key-utils.d.ts +35 -0
- package/dist/types.backup/cache/cache-policy.d.ts +59 -0
- package/dist/types.backup/cache/cache-runtime.d.ts +51 -0
- package/dist/types.backup/cache/cache-scope.d.ts +134 -0
- package/dist/types.backup/cache/cache-tag.d.ts +79 -0
- package/dist/types.backup/cache/cf/cf-base64.d.ts +4 -0
- package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +105 -0
- package/dist/types.backup/cache/cf/cf-cache-store.d.ts +481 -0
- package/dist/types.backup/cache/cf/cf-cache-types.d.ts +300 -0
- package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +22 -0
- package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +15 -0
- package/dist/types.backup/cache/cf/index.d.ts +3 -0
- package/dist/types.backup/cache/document-cache.d.ts +69 -0
- package/dist/types.backup/cache/handle-capture.d.ts +23 -0
- package/dist/types.backup/cache/handle-snapshot.d.ts +39 -0
- package/dist/types.backup/cache/index.d.ts +7 -0
- package/dist/types.backup/cache/memory-segment-store.d.ts +163 -0
- package/dist/types.backup/cache/profile-registry.d.ts +40 -0
- package/dist/types.backup/cache/read-through-swr.d.ts +60 -0
- package/dist/types.backup/cache/segment-codec.d.ts +78 -0
- package/dist/types.backup/cache/shell-snapshot.d.ts +162 -0
- package/dist/types.backup/cache/tag-invalidation.d.ts +74 -0
- package/dist/types.backup/cache/taint.d.ts +71 -0
- package/dist/types.backup/cache/types.d.ts +407 -0
- package/dist/types.backup/cache/vercel/index.d.ts +1 -0
- package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +267 -0
- package/dist/types.backup/client.d.ts +184 -0
- package/dist/types.backup/client.rsc.d.ts +39 -0
- package/dist/types.backup/cloudflare/index.d.ts +7 -0
- package/dist/types.backup/cloudflare/tracing.d.ts +53 -0
- package/dist/types.backup/component-utils.d.ts +46 -0
- package/dist/types.backup/components/DefaultDocument.d.ts +13 -0
- package/dist/types.backup/context-var.d.ts +84 -0
- package/dist/types.backup/debug.d.ts +57 -0
- package/dist/types.backup/decode-loader-results.d.ts +5 -0
- package/dist/types.backup/default-error-boundary.d.ts +10 -0
- package/dist/types.backup/defer.d.ts +89 -0
- package/dist/types.backup/deps/browser.d.ts +1 -0
- package/dist/types.backup/deps/html-stream-client.d.ts +1 -0
- package/dist/types.backup/deps/html-stream-server.d.ts +1 -0
- package/dist/types.backup/deps/rsc.d.ts +1 -0
- package/dist/types.backup/deps/ssr.d.ts +1 -0
- package/dist/types.backup/encode-kv.d.ts +35 -0
- package/dist/types.backup/errors.d.ts +226 -0
- package/dist/types.backup/escape-script.d.ts +44 -0
- package/dist/types.backup/handle.d.ts +93 -0
- package/dist/types.backup/handles/MetaTags.d.ts +17 -0
- package/dist/types.backup/handles/Scripts.d.ts +38 -0
- package/dist/types.backup/handles/breadcrumbs.d.ts +43 -0
- package/dist/types.backup/handles/deferred-resolution.d.ts +53 -0
- package/dist/types.backup/handles/is-thenable.d.ts +12 -0
- package/dist/types.backup/handles/meta.d.ts +43 -0
- package/dist/types.backup/handles/script.d.ts +139 -0
- package/dist/types.backup/host/cookie-handler.d.ts +8 -0
- package/dist/types.backup/host/errors.d.ts +40 -0
- package/dist/types.backup/host/index.d.ts +33 -0
- package/dist/types.backup/host/pattern-matcher.d.ts +30 -0
- package/dist/types.backup/host/router.d.ts +12 -0
- package/dist/types.backup/host/testing.d.ts +41 -0
- package/dist/types.backup/host/types.d.ts +148 -0
- package/dist/types.backup/host/utils.d.ts +20 -0
- package/dist/types.backup/href-client.d.ts +214 -0
- package/dist/types.backup/index.d.ts +112 -0
- package/dist/types.backup/index.rsc.d.ts +51 -0
- package/dist/types.backup/internal-debug.d.ts +1 -0
- package/dist/types.backup/loader-store.d.ts +193 -0
- package/dist/types.backup/loader.d.ts +18 -0
- package/dist/types.backup/loader.rsc.d.ts +18 -0
- package/dist/types.backup/missing-id-error.d.ts +1 -0
- package/dist/types.backup/outlet-context.d.ts +12 -0
- package/dist/types.backup/outlet-provider.d.ts +12 -0
- package/dist/types.backup/prerender/build-shell-capture.d.ts +104 -0
- package/dist/types.backup/prerender/param-hash.d.ts +6 -0
- package/dist/types.backup/prerender/shell-manifest-key.d.ts +18 -0
- package/dist/types.backup/prerender/store.d.ts +62 -0
- package/dist/types.backup/prerender.d.ts +292 -0
- package/dist/types.backup/redirect-origin.d.ts +55 -0
- package/dist/types.backup/regex-escape.d.ts +6 -0
- package/dist/types.backup/render-error-thrower.d.ts +13 -0
- package/dist/types.backup/response-utils.d.ts +35 -0
- package/dist/types.backup/reverse.d.ts +206 -0
- package/dist/types.backup/root-error-boundary.d.ts +32 -0
- package/dist/types.backup/route-content-wrapper.d.ts +40 -0
- package/dist/types.backup/route-definition/dsl-helpers.d.ts +130 -0
- package/dist/types.backup/route-definition/helper-factories.d.ts +22 -0
- package/dist/types.backup/route-definition/helpers-types.d.ts +392 -0
- package/dist/types.backup/route-definition/index.d.ts +7 -0
- package/dist/types.backup/route-definition/redirect.d.ts +48 -0
- package/dist/types.backup/route-definition/resolve-handler-use.d.ts +19 -0
- package/dist/types.backup/route-definition/use-item-types.d.ts +1 -0
- package/dist/types.backup/route-definition.d.ts +1 -0
- package/dist/types.backup/route-map-builder.d.ts +127 -0
- package/dist/types.backup/route-name.d.ts +27 -0
- package/dist/types.backup/route-types.d.ts +172 -0
- package/dist/types.backup/router/basename.d.ts +10 -0
- package/dist/types.backup/router/content-negotiation.d.ts +91 -0
- package/dist/types.backup/router/debug-manifest.d.ts +7 -0
- package/dist/types.backup/router/error-handling.d.ts +76 -0
- package/dist/types.backup/router/find-match.d.ts +19 -0
- package/dist/types.backup/router/handler-context.d.ts +41 -0
- package/dist/types.backup/router/instrument.d.ts +161 -0
- package/dist/types.backup/router/intercept-resolution.d.ts +79 -0
- package/dist/types.backup/router/lazy-includes.d.ts +26 -0
- package/dist/types.backup/router/loader-resolution.d.ts +63 -0
- package/dist/types.backup/router/logging.d.ts +41 -0
- package/dist/types.backup/router/manifest.d.ts +8 -0
- package/dist/types.backup/router/match-api.d.ts +19 -0
- package/dist/types.backup/router/match-context.d.ts +184 -0
- package/dist/types.backup/router/match-handlers.d.ts +49 -0
- package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +113 -0
- package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +113 -0
- package/dist/types.backup/router/match-middleware/cache-store.d.ts +112 -0
- package/dist/types.backup/router/match-middleware/index.d.ts +80 -0
- package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +116 -0
- package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +94 -0
- package/dist/types.backup/router/match-pipelines.d.ts +103 -0
- package/dist/types.backup/router/match-result.d.ts +114 -0
- package/dist/types.backup/router/metrics.d.ts +6 -0
- package/dist/types.backup/router/middleware-types.d.ts +74 -0
- package/dist/types.backup/router/middleware.d.ts +116 -0
- package/dist/types.backup/router/navigation-snapshot.d.ts +22 -0
- package/dist/types.backup/router/params-util.d.ts +8 -0
- package/dist/types.backup/router/parse-pattern.d.ts +38 -0
- package/dist/types.backup/router/pattern-matching.d.ts +169 -0
- package/dist/types.backup/router/prefetch-cache-ttl.d.ts +27 -0
- package/dist/types.backup/router/prefetch-limits.d.ts +20 -0
- package/dist/types.backup/router/prerender-match.d.ts +50 -0
- package/dist/types.backup/router/preview-match.d.ts +22 -0
- package/dist/types.backup/router/request-classification.d.ts +104 -0
- package/dist/types.backup/router/revalidation.d.ts +57 -0
- package/dist/types.backup/router/route-snapshot.d.ts +112 -0
- package/dist/types.backup/router/router-context.d.ts +137 -0
- package/dist/types.backup/router/router-interfaces.d.ts +432 -0
- package/dist/types.backup/router/router-options.d.ts +738 -0
- package/dist/types.backup/router/router-registry.d.ts +15 -0
- package/dist/types.backup/router/segment-resolution/fresh.d.ts +55 -0
- package/dist/types.backup/router/segment-resolution/helpers.d.ts +93 -0
- package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +33 -0
- package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +44 -0
- package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +90 -0
- package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +53 -0
- package/dist/types.backup/router/segment-resolution/revalidation.d.ts +85 -0
- package/dist/types.backup/router/segment-resolution/static-store.d.ts +17 -0
- package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +16 -0
- package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +28 -0
- package/dist/types.backup/router/segment-resolution.d.ts +3 -0
- package/dist/types.backup/router/segment-wrappers.d.ts +53 -0
- package/dist/types.backup/router/state-cookie-name.d.ts +1 -0
- package/dist/types.backup/router/substitute-pattern-params.d.ts +23 -0
- package/dist/types.backup/router/telemetry-otel.d.ts +113 -0
- package/dist/types.backup/router/telemetry.d.ts +215 -0
- package/dist/types.backup/router/timeout.d.ts +68 -0
- package/dist/types.backup/router/tracing.d.ts +125 -0
- package/dist/types.backup/router/trie-matching.d.ts +32 -0
- package/dist/types.backup/router/types.d.ts +98 -0
- package/dist/types.backup/router/url-params.d.ts +26 -0
- package/dist/types.backup/router.d.ts +7 -0
- package/dist/types.backup/rsc/capture-queue.d.ts +6 -0
- package/dist/types.backup/rsc/full-payload.d.ts +22 -0
- package/dist/types.backup/rsc/handler-context.d.ts +31 -0
- package/dist/types.backup/rsc/handler.d.ts +9 -0
- package/dist/types.backup/rsc/helpers.d.ts +213 -0
- package/dist/types.backup/rsc/index.d.ts +17 -0
- package/dist/types.backup/rsc/json-route-result.d.ts +20 -0
- package/dist/types.backup/rsc/loader-fetch.d.ts +14 -0
- package/dist/types.backup/rsc/manifest-init.d.ts +18 -0
- package/dist/types.backup/rsc/nonce.d.ts +28 -0
- package/dist/types.backup/rsc/origin-guard.d.ts +50 -0
- package/dist/types.backup/rsc/progressive-enhancement.d.ts +19 -0
- package/dist/types.backup/rsc/redirect-guard.d.ts +35 -0
- package/dist/types.backup/rsc/response-cache-serve.d.ts +46 -0
- package/dist/types.backup/rsc/response-error.d.ts +19 -0
- package/dist/types.backup/rsc/response-route-handler.d.ts +29 -0
- package/dist/types.backup/rsc/rsc-rendering.d.ts +23 -0
- package/dist/types.backup/rsc/runtime-warnings.d.ts +22 -0
- package/dist/types.backup/rsc/server-action.d.ts +68 -0
- package/dist/types.backup/rsc/shell-build-manifest.d.ts +84 -0
- package/dist/types.backup/rsc/shell-capture-constants.d.ts +27 -0
- package/dist/types.backup/rsc/shell-capture.d.ts +374 -0
- package/dist/types.backup/rsc/shell-serve.d.ts +136 -0
- package/dist/types.backup/rsc/ssr-setup.d.ts +48 -0
- package/dist/types.backup/rsc/transition-gate.d.ts +27 -0
- package/dist/types.backup/rsc/types.d.ts +290 -0
- package/dist/types.backup/runtime-env.d.ts +1 -0
- package/dist/types.backup/search-params.d.ts +125 -0
- package/dist/types.backup/segment-content-promise.d.ts +13 -0
- package/dist/types.backup/segment-fragments.d.ts +56 -0
- package/dist/types.backup/segment-loader-promise.d.ts +22 -0
- package/dist/types.backup/segment-system.d.ts +84 -0
- package/dist/types.backup/serialize.d.ts +164 -0
- package/dist/types.backup/server/context.d.ts +494 -0
- package/dist/types.backup/server/cookie-parse.d.ts +10 -0
- package/dist/types.backup/server/cookie-store.d.ts +107 -0
- package/dist/types.backup/server/fetchable-loader-store.d.ts +20 -0
- package/dist/types.backup/server/handle-store.d.ts +100 -0
- package/dist/types.backup/server/loader-registry.d.ts +32 -0
- package/dist/types.backup/server/request-context.d.ts +596 -0
- package/dist/types.backup/server/root-layout.d.ts +3 -0
- package/dist/types.backup/server.d.ts +15 -0
- package/dist/types.backup/ssr/index.d.ts +233 -0
- package/dist/types.backup/ssr/inject-rsc-eager.d.ts +3 -0
- package/dist/types.backup/ssr/preinit-client-references.d.ts +71 -0
- package/dist/types.backup/ssr/ssr-root.d.ts +69 -0
- package/dist/types.backup/static-handler.d.ts +57 -0
- package/dist/types.backup/testing/cache-status.d.ts +63 -0
- package/dist/types.backup/testing/collect-handle.d.ts +20 -0
- package/dist/types.backup/testing/dispatch.d.ts +123 -0
- package/dist/types.backup/testing/dom.entry.d.ts +15 -0
- package/dist/types.backup/testing/e2e/fixture.d.ts +37 -0
- package/dist/types.backup/testing/e2e/index.d.ts +30 -0
- package/dist/types.backup/testing/e2e/matchers.d.ts +17 -0
- package/dist/types.backup/testing/e2e/page-helpers.d.ts +62 -0
- package/dist/types.backup/testing/e2e/parity.d.ts +111 -0
- package/dist/types.backup/testing/e2e/server.d.ts +35 -0
- package/dist/types.backup/testing/flight-matchers.d.ts +55 -0
- package/dist/types.backup/testing/flight-normalize.d.ts +1 -0
- package/dist/types.backup/testing/flight-tree.d.ts +192 -0
- package/dist/types.backup/testing/flight.d.ts +115 -0
- package/dist/types.backup/testing/flight.entry.d.ts +27 -0
- package/dist/types.backup/testing/generated-routes.d.ts +66 -0
- package/dist/types.backup/testing/index.d.ts +52 -0
- package/dist/types.backup/testing/internal/context.d.ts +225 -0
- package/dist/types.backup/testing/internal/flight-client-globals.d.ts +1 -0
- package/dist/types.backup/testing/internal/seed-vars.d.ts +30 -0
- package/dist/types.backup/testing/render-handler.d.ts +160 -0
- package/dist/types.backup/testing/render-route.d.ts +246 -0
- package/dist/types.backup/testing/run-loader.d.ts +186 -0
- package/dist/types.backup/testing/run-middleware.d.ts +132 -0
- package/dist/types.backup/testing/run-transition-when.d.ts +77 -0
- package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +6 -0
- package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +13 -0
- package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +7 -0
- package/dist/types.backup/testing/vitest-stubs/version.d.ts +1 -0
- package/dist/types.backup/testing/vitest.d.ts +205 -0
- package/dist/types.backup/theme/ThemeProvider.d.ts +13 -0
- package/dist/types.backup/theme/ThemeScript.d.ts +45 -0
- package/dist/types.backup/theme/constants.d.ts +39 -0
- package/dist/types.backup/theme/index.d.ts +29 -0
- package/dist/types.backup/theme/theme-context.d.ts +21 -0
- package/dist/types.backup/theme/theme-script.d.ts +26 -0
- package/dist/types.backup/theme/types.d.ts +162 -0
- package/dist/types.backup/theme/use-theme.d.ts +8 -0
- package/dist/types.backup/types/boundaries.d.ts +93 -0
- package/dist/types.backup/types/cache-types.d.ts +191 -0
- package/dist/types.backup/types/error-types.d.ts +114 -0
- package/dist/types.backup/types/global-namespace.d.ts +90 -0
- package/dist/types.backup/types/handler-context.d.ts +658 -0
- package/dist/types.backup/types/index.d.ts +11 -0
- package/dist/types.backup/types/loader-types.d.ts +182 -0
- package/dist/types.backup/types/request-scope.d.ts +93 -0
- package/dist/types.backup/types/route-config.d.ts +105 -0
- package/dist/types.backup/types/route-entry.d.ts +95 -0
- package/dist/types.backup/types/segments.d.ts +234 -0
- package/dist/types.backup/types.d.ts +1 -0
- package/dist/types.backup/urls/include-helper.d.ts +17 -0
- package/dist/types.backup/urls/include-provider.d.ts +27 -0
- package/dist/types.backup/urls/index.d.ts +6 -0
- package/dist/types.backup/urls/path-helper-types.d.ts +197 -0
- package/dist/types.backup/urls/path-helper.d.ts +12 -0
- package/dist/types.backup/urls/pattern-types.d.ts +166 -0
- package/dist/types.backup/urls/response-types.d.ts +67 -0
- package/dist/types.backup/urls/type-extraction.d.ts +157 -0
- package/dist/types.backup/urls/urls-function.d.ts +24 -0
- package/dist/types.backup/urls.d.ts +1 -0
- package/dist/types.backup/use-loader.d.ts +150 -0
- package/dist/types.backup/vercel/index.d.ts +10 -0
- package/dist/types.backup/vercel/tracing.d.ts +70 -0
- package/dist/types.backup/vite/debug.d.ts +80 -0
- package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +12 -0
- package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +65 -0
- package/dist/types.backup/vite/discovery/discover-routers.d.ts +17 -0
- package/dist/types.backup/vite/discovery/discovery-errors.d.ts +113 -0
- package/dist/types.backup/vite/discovery/gate-state.d.ts +79 -0
- package/dist/types.backup/vite/discovery/prerender-collection.d.ts +24 -0
- package/dist/types.backup/vite/discovery/route-types-writer.d.ts +32 -0
- package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +22 -0
- package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +40 -0
- package/dist/types.backup/vite/discovery/state.d.ts +162 -0
- package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +15 -0
- package/dist/types.backup/vite/index.d.ts +11 -0
- package/dist/types.backup/vite/inject-client-debug.d.ts +56 -0
- package/dist/types.backup/vite/plugin-types.d.ts +298 -0
- package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +6 -0
- package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +40 -0
- package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +35 -0
- package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +64 -0
- package/dist/types.backup/vite/plugins/expose-action-id.d.ts +18 -0
- package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +37 -0
- package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +19 -0
- package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +10 -0
- package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +8 -0
- package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +13 -0
- package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +29 -0
- package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +6 -0
- package/dist/types.backup/vite/plugins/performance-tracks.d.ts +25 -0
- package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +20 -0
- package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +20 -0
- package/dist/types.backup/vite/plugins/vercel-output.d.ts +85 -0
- package/dist/types.backup/vite/plugins/version-injector.d.ts +21 -0
- package/dist/types.backup/vite/plugins/version-plugin.d.ts +19 -0
- package/dist/types.backup/vite/plugins/virtual-entries.d.ts +36 -0
- package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +7 -0
- package/dist/types.backup/vite/rango.d.ts +29 -0
- package/dist/types.backup/vite/router-discovery.d.ts +23 -0
- package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +64 -0
- package/dist/types.backup/vite/utils/banner.d.ts +2 -0
- package/dist/types.backup/vite/utils/bundle-analysis.d.ts +28 -0
- package/dist/types.backup/vite/utils/client-chunks.d.ts +55 -0
- package/dist/types.backup/vite/utils/directive-prologue.d.ts +16 -0
- package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +37 -0
- package/dist/types.backup/vite/utils/manifest-utils.d.ts +7 -0
- package/dist/types.backup/vite/utils/package-resolution.d.ts +6 -0
- package/dist/types.backup/vite/utils/prerender-utils.d.ts +32 -0
- package/dist/types.backup/vite/utils/shared-utils.d.ts +55 -0
- package/dist/vite/index.js +10725 -3898
- package/dist/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
- package/package.json +129 -46
- package/skills/api-client/SKILL.md +211 -0
- package/skills/breadcrumbs/SKILL.md +117 -8
- package/skills/bundle-analysis/SKILL.md +159 -0
- package/skills/cache-guide/SKILL.md +255 -25
- package/skills/caching/SKILL.md +414 -17
- package/skills/catalog.json +289 -0
- package/skills/client-urls/SKILL.md +307 -0
- package/skills/cloudflare/SKILL.md +151 -0
- package/skills/cloudflare/agents/openai.yaml +4 -0
- package/skills/cloudflare/references/d1-and-local-dev.md +131 -0
- package/skills/cloudflare/references/streaming-and-deploy.md +107 -0
- package/skills/cloudflare/references/webhooks-and-crypto.md +147 -0
- package/skills/comparison/SKILL.md +50 -0
- package/skills/comparison/agents/openai.yaml +4 -0
- package/skills/comparison/references/framework-comparison.md +858 -0
- package/skills/composability/SKILL.md +124 -4
- package/skills/css/SKILL.md +76 -0
- package/skills/debug-manifest/SKILL.md +5 -11
- package/skills/defer-hydration/SKILL.md +235 -0
- package/skills/deployment-caching/SKILL.md +176 -0
- package/skills/document-cache/SKILL.md +116 -58
- package/skills/fonts/SKILL.md +1 -1
- package/skills/handler-use/SKILL.md +364 -0
- package/skills/hooks/SKILL.md +73 -691
- package/skills/hooks/data.md +282 -0
- package/skills/hooks/handle-and-actions.md +110 -0
- package/skills/hooks/navigation.md +110 -0
- package/skills/hooks/outlets.md +62 -0
- package/skills/hooks/state.md +228 -0
- package/skills/hooks/urls.md +135 -0
- package/skills/host-router/SKILL.md +129 -27
- package/skills/i18n/SKILL.md +276 -0
- package/skills/intercept/SKILL.md +94 -18
- package/skills/layout/SKILL.md +62 -19
- package/skills/links/SKILL.md +285 -17
- package/skills/loader/SKILL.md +415 -55
- package/skills/middleware/SKILL.md +92 -16
- package/skills/migrate-nextjs/SKILL.md +852 -0
- package/skills/migrate-nextjs/backend-host-swap.md +120 -0
- package/skills/migrate-react-router/SKILL.md +189 -0
- package/skills/migrate-react-router/component-migration.md +201 -0
- package/skills/migrate-react-router/data-and-actions.md +236 -0
- package/skills/migrate-react-router/route-mapping.md +284 -0
- package/skills/mime-routes/SKILL.md +55 -18
- package/skills/observability/SKILL.md +231 -0
- package/skills/parallel/SKILL.md +245 -10
- package/skills/ppr/SKILL.md +914 -0
- package/skills/prerender/SKILL.md +243 -135
- package/skills/rango/SKILL.md +325 -24
- package/skills/react-compiler/SKILL.md +168 -0
- package/skills/response-routes/SKILL.md +180 -52
- package/skills/route/SKILL.md +181 -9
- package/skills/router-setup/SKILL.md +154 -11
- package/skills/scripts/SKILL.md +189 -0
- package/skills/server-actions/SKILL.md +776 -0
- package/skills/shell-manifest/SKILL.md +194 -0
- package/skills/streams-and-websockets/SKILL.md +283 -0
- package/skills/tailwind/SKILL.md +28 -4
- package/skills/testing/SKILL.md +131 -0
- package/skills/testing/bindings.md +103 -0
- package/skills/testing/cache-prerender.md +172 -0
- package/skills/testing/client-components.md +131 -0
- package/skills/testing/e2e-parity.md +125 -0
- package/skills/testing/flight.md +91 -0
- package/skills/testing/handles.md +153 -0
- package/skills/testing/loader.md +130 -0
- package/skills/testing/middleware.md +99 -0
- package/skills/testing/render-handler.md +122 -0
- package/skills/testing/response-routes.md +95 -0
- package/skills/testing/reverse-and-types.md +85 -0
- package/skills/testing/server-actions.md +107 -0
- package/skills/testing/server-tree.md +128 -0
- package/skills/testing/setup.md +123 -0
- package/skills/theme/SKILL.md +9 -6
- package/skills/typesafety/SKILL.md +45 -616
- package/skills/typesafety/env-and-bindings.md +254 -0
- package/skills/typesafety/generated-files-and-cli.md +342 -0
- package/skills/typesafety/params-and-search.md +153 -0
- package/skills/typesafety/route-types.md +213 -0
- package/skills/use-cache/SKILL.md +121 -15
- package/skills/vercel/SKILL.md +149 -0
- package/skills/view-transitions/SKILL.md +341 -0
- package/src/__augment-tests__/augment.ts +81 -0
- package/src/__augment-tests__/augmented.check.ts +116 -0
- package/src/__internal.ts +1 -66
- package/src/browser/action-coordinator.ts +53 -36
- package/src/browser/action-fence.ts +47 -0
- package/src/browser/app-shell.ts +39 -0
- package/src/browser/app-version.ts +14 -0
- package/src/browser/connection-warmup.ts +134 -0
- package/src/browser/cookie-name.ts +140 -0
- package/src/browser/dev-discovery.ts +66 -0
- package/src/browser/event-controller.ts +405 -168
- package/src/browser/history-state.ts +21 -0
- package/src/browser/index.ts +3 -3
- package/src/browser/invalidate-client-cache.ts +52 -0
- package/src/browser/link-interceptor.ts +469 -20
- package/src/browser/logging.ts +28 -0
- package/src/browser/merge-segment-loaders.ts +6 -4
- package/src/browser/navigation-bridge.ts +209 -40
- package/src/browser/navigation-client.ts +284 -73
- package/src/browser/navigation-store-handle.ts +38 -0
- package/src/browser/navigation-store.ts +208 -329
- package/src/browser/navigation-transaction.ts +18 -66
- package/src/browser/network-error-handler.ts +34 -7
- package/src/browser/notify-listeners.ts +22 -0
- package/src/browser/partial-update.ts +278 -126
- package/src/browser/prefetch/cache.ts +362 -51
- package/src/browser/prefetch/default-strategy.ts +74 -0
- package/src/browser/prefetch/fetch.ts +453 -40
- package/src/browser/prefetch/invalidation.ts +30 -0
- package/src/browser/prefetch/loader.ts +111 -0
- package/src/browser/prefetch/observer.ts +50 -22
- package/src/browser/prefetch/policy.ts +6 -0
- package/src/browser/prefetch/queue.ts +144 -23
- package/src/browser/prefetch/resource-ready.ts +77 -0
- package/src/browser/prefetch/runtime.ts +6 -0
- package/src/browser/rango-state.ts +178 -75
- package/src/browser/react/Link.tsx +187 -75
- package/src/browser/react/NavigationProvider.tsx +249 -123
- package/src/browser/react/ScrollRestoration.tsx +10 -6
- package/src/browser/react/context.ts +11 -2
- package/src/browser/react/filter-segment-order.ts +66 -7
- package/src/browser/react/index.ts +0 -48
- package/src/browser/react/location-state-shared.ts +178 -8
- package/src/browser/react/location-state.ts +39 -14
- package/src/browser/react/use-action.ts +6 -15
- package/src/browser/react/use-handle.ts +23 -69
- package/src/browser/react/use-href.tsx +8 -1
- package/src/browser/react/use-link-status.ts +33 -8
- package/src/browser/react/use-navigation.ts +32 -7
- package/src/browser/react/use-params.ts +20 -10
- package/src/browser/react/use-reverse.ts +106 -0
- package/src/browser/react/use-router.ts +47 -12
- package/src/browser/react/use-search-params.ts +0 -5
- package/src/browser/react/use-segments.ts +11 -21
- package/src/browser/response-adapter.ts +99 -8
- package/src/browser/rsc-router.tsx +375 -84
- package/src/browser/scroll-restoration.ts +61 -47
- package/src/browser/segment-reconciler.ts +44 -7
- package/src/browser/segment-structure-assert.ts +2 -2
- package/src/browser/server-action-bridge.ts +270 -71
- package/src/browser/types.ts +166 -37
- package/src/browser/validate-redirect-origin.ts +43 -16
- package/src/build/collect-fallback-refs.ts +107 -0
- package/src/build/generate-manifest.ts +217 -188
- package/src/build/generate-route-types.ts +6 -1
- package/src/build/index.ts +11 -3
- package/src/build/merge-full-manifests.ts +161 -0
- package/src/build/prefix-tree-utils.ts +123 -0
- package/src/build/route-trie.ts +43 -254
- package/src/build/route-types/ast-route-extraction.ts +15 -8
- package/src/build/route-types/codegen.ts +16 -5
- package/src/build/route-types/include-resolution.ts +521 -65
- package/src/build/route-types/param-extraction.ts +6 -3
- package/src/build/route-types/per-module-writer.ts +33 -12
- package/src/build/route-types/router-processing.ts +411 -154
- package/src/build/route-types/scan-filter.ts +9 -2
- package/src/build/route-types/source-scan.ts +216 -0
- package/src/build/runtime-discovery.ts +32 -29
- package/src/cache/cache-error.ts +104 -0
- package/src/cache/cache-exec-scope.ts +47 -0
- package/src/cache/cache-key-utils.ts +73 -15
- package/src/cache/cache-policy.ts +108 -34
- package/src/cache/cache-runtime.ts +566 -117
- package/src/cache/cache-scope.ts +431 -112
- package/src/cache/cache-tag.ts +149 -0
- package/src/cache/cf/cf-base64.ts +33 -0
- package/src/cache/cf/cf-cache-constants.ts +134 -0
- package/src/cache/cf/cf-cache-store.ts +3250 -173
- package/src/cache/cf/cf-cache-types.ts +417 -0
- package/src/cache/cf/cf-kv-utils.ts +84 -0
- package/src/cache/cf/cf-tag-marker-memo.ts +108 -0
- package/src/cache/cf/cf-zone-purge.ts +101 -0
- package/src/cache/cf/index.ts +16 -17
- package/src/cache/document-cache.ts +202 -61
- package/src/cache/handle-snapshot.ts +92 -1
- package/src/cache/index.ts +33 -20
- package/src/cache/memory-segment-store.ts +286 -37
- package/src/cache/profile-registry.ts +46 -31
- package/src/cache/read-through-swr.ts +66 -16
- package/src/cache/search-params-filter.ts +118 -0
- package/src/cache/segment-codec.ts +80 -25
- package/src/cache/shell-snapshot.ts +516 -0
- package/src/cache/tag-invalidation.ts +230 -0
- package/src/cache/taint.ts +83 -9
- package/src/cache/types.ts +323 -100
- package/src/cache/vercel/index.ts +11 -0
- package/src/cache/vercel/vercel-cache-store.ts +1264 -0
- package/src/client-urls/client-root.tsx +161 -0
- package/src/client-urls/client-urls.ts +698 -0
- package/src/client-urls/navigation.ts +237 -0
- package/src/client-urls/revalidation-protocol.ts +56 -0
- package/src/client-urls/server-projection.ts +579 -0
- package/src/client-urls/types.ts +195 -0
- package/src/client.rsc.tsx +48 -21
- package/src/client.tsx +158 -294
- package/src/cloudflare/index.ts +11 -0
- package/src/cloudflare/tracing.ts +112 -0
- package/src/component-utils.ts +19 -0
- package/src/components/DefaultDocument.tsx +8 -2
- package/src/context-var.ts +84 -2
- package/src/debug.ts +2 -2
- package/src/decode-loader-results.ts +160 -0
- package/src/defer.ts +185 -0
- package/src/deps/ssr.ts +4 -2
- package/src/dev-discovery-protocol.ts +11 -0
- package/src/encode-kv.ts +49 -0
- package/src/errors.ts +44 -4
- package/src/escape-script.ts +52 -0
- package/src/handle.ts +104 -34
- package/src/handles/MetaTags.tsx +24 -53
- package/src/handles/Scripts.tsx +183 -0
- package/src/handles/breadcrumbs.ts +35 -8
- package/src/handles/deferred-resolution.ts +134 -0
- package/src/handles/is-thenable.ts +16 -0
- package/src/handles/meta.ts +14 -40
- package/src/handles/script.ts +244 -0
- package/src/host/cookie-handler.ts +9 -60
- package/src/host/errors.ts +13 -22
- package/src/host/index.ts +9 -2
- package/src/host/pattern-matcher.ts +23 -52
- package/src/host/router.ts +107 -99
- package/src/host/testing.ts +40 -27
- package/src/host/types.ts +37 -4
- package/src/host/utils.ts +1 -1
- package/src/href-client.ts +137 -22
- package/src/index.rsc.ts +111 -13
- package/src/index.ts +151 -19
- package/src/internal-debug.ts +11 -10
- package/src/loader-redirect.tsx +47 -0
- package/src/loader-store.ts +500 -0
- package/src/loader.rsc.ts +20 -13
- package/src/loader.ts +12 -11
- package/src/missing-id-error.ts +68 -0
- package/src/outlet-context.ts +13 -1
- package/src/outlet-provider.tsx +16 -6
- package/src/prerender/build-shell-capture.ts +453 -0
- package/src/prerender/param-hash.ts +16 -16
- package/src/prerender/shell-manifest-key.ts +20 -0
- package/src/prerender/store.ts +52 -42
- package/src/prerender.ts +215 -86
- package/src/redirect-origin.ts +143 -0
- package/src/regex-escape.ts +8 -0
- package/src/render-error-thrower.tsx +20 -0
- package/src/response-utils.ts +62 -0
- package/src/reverse.ts +65 -15
- package/src/root-error-boundary.tsx +1 -19
- package/src/route-content-wrapper.tsx +112 -78
- package/src/route-definition/dsl-helpers.ts +519 -307
- package/src/route-definition/helper-factories.ts +28 -140
- package/src/route-definition/helpers-types.ts +169 -78
- package/src/route-definition/index.ts +4 -2
- package/src/route-definition/redirect.ts +53 -12
- package/src/route-definition/resolve-handler-use.ts +160 -0
- package/src/route-definition/use-item-types.ts +29 -0
- package/src/route-map-builder.ts +102 -68
- package/src/route-types.ts +37 -46
- package/src/router/basename.ts +14 -0
- package/src/router/content-negotiation.ts +211 -22
- package/src/router/error-handling.ts +110 -29
- package/src/router/find-match.ts +130 -29
- package/src/router/handler-context.ts +105 -45
- package/src/router/instrument.ts +401 -0
- package/src/router/intercept-resolution.ts +108 -24
- package/src/router/lazy-includes.ts +90 -63
- package/src/router/loader-resolution.ts +529 -57
- package/src/router/logging.ts +5 -8
- package/src/router/manifest.ts +105 -56
- package/src/router/match-api.ts +190 -219
- package/src/router/match-context.ts +0 -22
- package/src/router/match-handlers.ts +268 -171
- package/src/router/match-middleware/background-revalidation.ts +66 -22
- package/src/router/match-middleware/cache-lookup.ts +368 -277
- package/src/router/match-middleware/cache-store.ts +175 -50
- package/src/router/match-middleware/intercept-resolution.ts +8 -28
- package/src/router/match-middleware/segment-resolution.ts +52 -18
- package/src/router/match-pipelines.ts +1 -42
- package/src/router/match-result.ts +135 -44
- package/src/router/metrics.ts +22 -36
- package/src/router/middleware-types.ts +26 -138
- package/src/router/middleware.ts +305 -177
- package/src/router/navigation-snapshot.ts +173 -0
- package/src/router/params-util.ts +23 -0
- package/src/router/parse-pattern.ts +115 -0
- package/src/router/pattern-matching.ts +181 -150
- package/src/router/prefetch-cache-ttl.ts +51 -0
- package/src/router/prefetch-default.ts +59 -0
- package/src/router/prefetch-limits.ts +37 -0
- package/src/router/prerender-match.ts +250 -60
- package/src/router/preview-match.ts +35 -103
- package/src/router/request-classification.ts +291 -0
- package/src/router/revalidation.ts +146 -83
- package/src/router/route-snapshot.ts +256 -0
- package/src/router/route-trie-builder.ts +334 -0
- package/src/router/router-context.ts +11 -29
- package/src/router/router-interfaces.ts +199 -37
- package/src/router/router-options.ts +271 -21
- package/src/router/router-registry.ts +2 -5
- package/src/router/segment-resolution/fresh.ts +367 -78
- package/src/router/segment-resolution/helpers.ts +116 -33
- package/src/router/segment-resolution/loader-cache.ts +188 -39
- package/src/router/segment-resolution/loader-mask.ts +60 -0
- package/src/router/segment-resolution/loader-snapshot.ts +259 -0
- package/src/router/segment-resolution/mask-nested.ts +99 -0
- package/src/router/segment-resolution/revalidation.ts +520 -385
- package/src/router/segment-resolution/static-store.ts +55 -15
- package/src/router/segment-resolution/streamed-handler-telemetry.ts +52 -0
- package/src/router/segment-resolution/view-transition-default.ts +60 -0
- package/src/router/segment-resolution.ts +5 -1
- package/src/router/segment-wrappers.ts +8 -5
- package/src/router/state-cookie-name.ts +33 -0
- package/src/router/substitute-pattern-params.ts +75 -0
- package/src/router/telemetry-otel.ts +171 -200
- package/src/router/telemetry.ts +106 -20
- package/src/router/timeout.ts +53 -22
- package/src/router/tracing.ts +235 -0
- package/src/router/transition-when.ts +76 -0
- package/src/router/trie-matching.ts +171 -59
- package/src/router/types.ts +10 -63
- package/src/router/url-params.ts +57 -0
- package/src/router.ts +301 -78
- package/src/rsc/capture-queue.ts +218 -0
- package/src/rsc/full-payload.ts +77 -0
- package/src/rsc/handler-context.ts +4 -2
- package/src/rsc/handler.ts +901 -519
- package/src/rsc/helpers.ts +245 -47
- package/src/rsc/index.ts +2 -5
- package/src/rsc/json-route-result.ts +38 -0
- package/src/rsc/loader-fetch.ts +129 -33
- package/src/rsc/manifest-init.ts +55 -52
- package/src/rsc/nonce.ts +10 -1
- package/src/rsc/origin-guard.ts +39 -25
- package/src/rsc/progressive-enhancement.ts +381 -74
- package/src/rsc/redirect-guard.ts +102 -0
- package/src/rsc/render-pipeline.ts +611 -0
- package/src/rsc/response-cache-serve.ts +259 -0
- package/src/rsc/response-error.ts +79 -12
- package/src/rsc/response-route-handler.ts +80 -206
- package/src/rsc/routine-plan.ts +359 -0
- package/src/rsc/rsc-rendering.ts +1625 -156
- package/src/rsc/runtime-warnings.ts +23 -10
- package/src/rsc/server-action.ts +424 -133
- package/src/rsc/shell-build-manifest.ts +336 -0
- package/src/rsc/shell-capture-constants.ts +45 -0
- package/src/rsc/shell-capture.ts +2063 -0
- package/src/rsc/shell-serve.ts +337 -0
- package/src/rsc/ssr-setup.ts +113 -18
- package/src/rsc/stream-idle.ts +137 -0
- package/src/rsc/transition-gate.ts +86 -0
- package/src/rsc/types.ts +100 -6
- package/src/runtime-env.ts +18 -0
- package/src/search-params.ts +35 -30
- package/src/segment-content-promise.ts +67 -0
- package/src/segment-fragments.ts +165 -0
- package/src/segment-loader-promise.ts +167 -0
- package/src/segment-system.tsx +507 -133
- package/src/serialize.ts +243 -0
- package/src/server/context.ts +581 -61
- package/src/server/cookie-parse.ts +32 -0
- package/src/server/cookie-store.ts +162 -15
- package/src/server/handle-store.ts +209 -70
- package/src/server/loader-registry.ts +38 -46
- package/src/server/request-context.ts +961 -186
- package/src/server.ts +7 -2
- package/src/ssr/index.tsx +631 -179
- package/src/ssr/inject-rsc-eager.ts +167 -0
- package/src/ssr/preinit-client-references.ts +106 -0
- package/src/ssr/ssr-root.tsx +262 -0
- package/src/static-handler.ts +45 -20
- package/src/testing/cache-status.ts +162 -0
- package/src/testing/collect-handle.ts +46 -0
- package/src/testing/dispatch.ts +951 -0
- package/src/testing/dom.entry.ts +22 -0
- package/src/testing/e2e/fixture.ts +188 -0
- package/src/testing/e2e/index.ts +147 -0
- package/src/testing/e2e/matchers.ts +35 -0
- package/src/testing/e2e/page-helpers.ts +319 -0
- package/src/testing/e2e/parity.ts +400 -0
- package/src/testing/e2e/server.ts +195 -0
- package/src/testing/flight-matchers.ts +97 -0
- package/src/testing/flight-normalize.ts +11 -0
- package/src/testing/flight-runtime.d.ts +57 -0
- package/src/testing/flight-tree.ts +682 -0
- package/src/testing/flight.entry.ts +52 -0
- package/src/testing/flight.ts +257 -0
- package/src/testing/generated-routes.ts +199 -0
- package/src/testing/index.ts +121 -0
- package/src/testing/internal/context.ts +380 -0
- package/src/testing/internal/flight-client-globals.ts +30 -0
- package/src/testing/internal/seed-vars.ts +54 -0
- package/src/testing/render-handler.ts +371 -0
- package/src/testing/render-route.tsx +667 -0
- package/src/testing/run-loader.ts +423 -0
- package/src/testing/run-middleware.ts +219 -0
- package/src/testing/run-transition-when.ts +197 -0
- package/src/testing/shell-status.ts +206 -0
- package/src/testing/vitest-stubs/cloudflare-email.ts +9 -0
- package/src/testing/vitest-stubs/cloudflare-workers.ts +21 -0
- package/src/testing/vitest-stubs/plugin-rsc.ts +16 -0
- package/src/testing/vitest-stubs/version.ts +5 -0
- package/src/testing/vitest.ts +305 -0
- package/src/theme/ThemeProvider.tsx +56 -84
- package/src/theme/ThemeScript.tsx +7 -9
- package/src/theme/constants.ts +52 -13
- package/src/theme/index.ts +0 -7
- package/src/theme/theme-context.ts +1 -5
- package/src/theme/theme-script.ts +22 -21
- package/src/theme/use-theme.ts +0 -3
- package/src/types/boundaries.ts +15 -35
- package/src/types/cache-types.ts +17 -8
- package/src/types/error-types.ts +30 -90
- package/src/types/global-namespace.ts +54 -41
- package/src/types/handler-context.ts +244 -81
- package/src/types/index.ts +4 -10
- package/src/types/loader-types.ts +99 -15
- package/src/types/request-scope.ts +112 -0
- package/src/types/route-config.ts +20 -52
- package/src/types/route-entry.ts +22 -7
- package/src/types/segments.ts +149 -14
- package/src/urls/include-helper.ts +59 -75
- package/src/urls/include-provider.ts +71 -0
- package/src/urls/index.ts +2 -11
- package/src/urls/path-helper-types.ts +118 -26
- package/src/urls/path-helper.ts +70 -115
- package/src/urls/pattern-types.ts +113 -19
- package/src/urls/response-types.ts +25 -22
- package/src/urls/type-extraction.ts +98 -154
- package/src/urls/urls-function.ts +1 -19
- package/src/use-loader.tsx +404 -86
- package/src/vercel/index.ts +11 -0
- package/src/vercel/tracing.ts +89 -0
- package/src/vite/debug.ts +185 -0
- package/src/vite/discovery/bundle-postprocess.ts +46 -45
- package/src/vite/discovery/client-urls-projection.ts +322 -0
- package/src/vite/discovery/dev-prerender-cache.ts +117 -0
- package/src/vite/discovery/discover-routers.ts +178 -147
- package/src/vite/discovery/discovery-errors.ts +255 -0
- package/src/vite/discovery/gate-state.ts +171 -0
- package/src/vite/discovery/prerender-collection.ts +243 -134
- package/src/vite/discovery/route-types-writer.ts +40 -84
- package/src/vite/discovery/self-gen-tracking.ts +27 -1
- package/src/vite/discovery/shell-prerender-phase.ts +397 -0
- package/src/vite/discovery/state.ts +116 -11
- package/src/vite/discovery/virtual-module-codegen.ts +226 -87
- package/src/vite/encryption-key.ts +29 -0
- package/src/vite/index.ts +16 -0
- package/src/vite/inject-client-debug.ts +88 -0
- package/src/vite/plugin-types.ts +267 -62
- package/src/vite/plugins/cjs-to-esm.ts +16 -19
- package/src/vite/plugins/client-ref-dedup.ts +16 -11
- package/src/vite/plugins/client-ref-hashing.ts +28 -15
- package/src/vite/plugins/cloudflare-protocol-loader-hook.d.mts +23 -0
- package/src/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
- package/src/vite/plugins/cloudflare-protocol-stub.ts +194 -0
- package/src/vite/plugins/expose-action-id.ts +51 -100
- package/src/vite/plugins/expose-id-utils.ts +96 -51
- package/src/vite/plugins/expose-ids/export-analysis.ts +101 -34
- package/src/vite/plugins/expose-ids/handler-transform.ts +15 -64
- package/src/vite/plugins/expose-ids/loader-transform.ts +14 -24
- package/src/vite/plugins/expose-ids/router-transform.ts +118 -29
- package/src/vite/plugins/expose-internal-ids.ts +599 -317
- package/src/vite/plugins/performance-tracks.ts +89 -0
- package/src/vite/plugins/refresh-cmd.ts +89 -27
- package/src/vite/plugins/server-ref-hashing.ts +74 -0
- package/src/vite/plugins/server-reference-pattern.ts +10 -0
- package/src/vite/plugins/use-cache-transform.ts +73 -83
- package/src/vite/plugins/vercel-output.ts +384 -0
- package/src/vite/plugins/version-injector.ts +39 -29
- package/src/vite/plugins/version-plugin.ts +54 -37
- package/src/vite/plugins/virtual-entries.ts +193 -30
- package/src/vite/rango.ts +403 -304
- package/src/vite/router-discovery.ts +1802 -187
- package/src/vite/utils/ast-handler-extract.ts +26 -35
- package/src/vite/utils/banner.ts +4 -4
- package/src/vite/utils/bundle-analysis.ts +10 -15
- package/src/vite/utils/client-chunks.ts +184 -0
- package/src/vite/utils/directive-prologue.ts +40 -0
- package/src/vite/utils/forward-user-plugins.ts +171 -0
- package/src/vite/utils/manifest-utils.ts +1 -59
- package/src/vite/utils/package-resolution.ts +21 -52
- package/src/vite/utils/prerender-utils.ts +123 -44
- package/src/vite/utils/shared-utils.ts +158 -44
- package/src/browser/action-response-classifier.ts +0 -99
- package/src/browser/react/use-client-cache.ts +0 -58
- package/src/browser/shallow.ts +0 -40
- package/src/handles/index.ts +0 -7
- package/src/network-error-thrower.tsx +0 -23
- package/src/router/middleware-cookies.ts +0 -55
package/dist/bin/rango.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __esm = (fn, res) => function __init() {
|
|
5
|
-
|
|
4
|
+
var __esm = (fn, res, err) => function __init() {
|
|
5
|
+
if (err) throw err[0];
|
|
6
|
+
try {
|
|
7
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
8
|
+
} catch (e) {
|
|
9
|
+
throw err = [e], e;
|
|
10
|
+
}
|
|
6
11
|
};
|
|
7
12
|
var __export = (target, all) => {
|
|
8
13
|
for (var name in all)
|
|
@@ -22,10 +27,10 @@ function extractParamsFromPattern(pattern) {
|
|
|
22
27
|
function formatRouteEntry(key, pattern, _params, search) {
|
|
23
28
|
const hasSearch = search && Object.keys(search).length > 0;
|
|
24
29
|
if (!hasSearch) {
|
|
25
|
-
return ` ${key}:
|
|
30
|
+
return ` ${key}: ${JSON.stringify(pattern)},`;
|
|
26
31
|
}
|
|
27
|
-
const searchBody = Object.entries(search).map(([k, v]) => `${k}:
|
|
28
|
-
return ` ${key}: { path:
|
|
32
|
+
const searchBody = Object.entries(search).map(([k, v]) => `${k}: ${JSON.stringify(v)}`).join(", ");
|
|
33
|
+
return ` ${key}: { path: ${JSON.stringify(pattern)}, search: { ${searchBody} } },`;
|
|
29
34
|
}
|
|
30
35
|
var init_param_extraction = __esm({
|
|
31
36
|
"src/build/route-types/param-extraction.ts"() {
|
|
@@ -59,8 +64,8 @@ var init_ast_helpers = __esm({
|
|
|
59
64
|
|
|
60
65
|
// src/build/route-types/ast-route-extraction.ts
|
|
61
66
|
import ts2 from "typescript";
|
|
62
|
-
function extractRoutesFromSource(code) {
|
|
63
|
-
const sourceFile = ts2.createSourceFile(
|
|
67
|
+
function extractRoutesFromSource(code, sourceFileArg) {
|
|
68
|
+
const sourceFile = sourceFileArg ?? ts2.createSourceFile(
|
|
64
69
|
"input.tsx",
|
|
65
70
|
code,
|
|
66
71
|
ts2.ScriptTarget.Latest,
|
|
@@ -139,7 +144,7 @@ function generatePerModuleTypesSource(routes) {
|
|
|
139
144
|
const valid = routes.filter(({ name }) => {
|
|
140
145
|
if (!name || /["'\\`\n\r]/.test(name)) {
|
|
141
146
|
console.warn(
|
|
142
|
-
`[
|
|
147
|
+
`[rango] Skipping route with invalid name: ${JSON.stringify(name)}`
|
|
143
148
|
);
|
|
144
149
|
return false;
|
|
145
150
|
}
|
|
@@ -149,7 +154,7 @@ function generatePerModuleTypesSource(routes) {
|
|
|
149
154
|
for (const { name, pattern, params, search } of valid) {
|
|
150
155
|
if (deduped.has(name)) {
|
|
151
156
|
console.warn(
|
|
152
|
-
`[
|
|
157
|
+
`[rango] Duplicate route name "${name}" \u2014 keeping first definition`
|
|
153
158
|
);
|
|
154
159
|
continue;
|
|
155
160
|
}
|
|
@@ -185,9 +190,13 @@ export const NamedRoutes = {
|
|
|
185
190
|
${objectBody}
|
|
186
191
|
} as const;
|
|
187
192
|
|
|
193
|
+
// Aliased so the augmentation below does not pay a homomorphic mapped-type
|
|
194
|
+
// instantiation per route; \`as const\` already makes the members readonly.
|
|
195
|
+
type NamedRoutesShape = typeof NamedRoutes;
|
|
196
|
+
|
|
188
197
|
declare global {
|
|
189
|
-
namespace
|
|
190
|
-
interface GeneratedRouteMap extends
|
|
198
|
+
namespace Rango {
|
|
199
|
+
interface GeneratedRouteMap extends NamedRoutesShape {}
|
|
191
200
|
}
|
|
192
201
|
}
|
|
193
202
|
`;
|
|
@@ -211,14 +220,15 @@ function findTsFiles(dir, filter) {
|
|
|
211
220
|
entries = readdirSync(dir, { withFileTypes: true });
|
|
212
221
|
} catch (err) {
|
|
213
222
|
console.warn(
|
|
214
|
-
`[
|
|
223
|
+
`[rango] Failed to scan directory ${dir}: ${err.message}`
|
|
215
224
|
);
|
|
216
225
|
return results;
|
|
217
226
|
}
|
|
218
227
|
for (const entry of entries) {
|
|
219
228
|
const fullPath = join(dir, entry.name);
|
|
220
229
|
if (entry.isDirectory()) {
|
|
221
|
-
if (entry.name === "node_modules" || entry.name.startsWith("."))
|
|
230
|
+
if (entry.name === "node_modules" || entry.name.startsWith(".") || entry.name === "dist" || entry.name === "build" || entry.name === "coverage")
|
|
231
|
+
continue;
|
|
222
232
|
results.push(...findTsFiles(fullPath, filter));
|
|
223
233
|
} else if ((entry.name.endsWith(".ts") || entry.name.endsWith(".tsx") || entry.name.endsWith(".js") || entry.name.endsWith(".jsx")) && !entry.name.includes(".gen.")) {
|
|
224
234
|
if (filter && !filter(fullPath)) continue;
|
|
@@ -237,6 +247,37 @@ var init_scan_filter = __esm({
|
|
|
237
247
|
import { readFileSync, existsSync } from "node:fs";
|
|
238
248
|
import { dirname, resolve } from "node:path";
|
|
239
249
|
import ts3 from "typescript";
|
|
250
|
+
function createScanMemo() {
|
|
251
|
+
return { files: /* @__PURE__ */ new Map(), blockSourceFiles: /* @__PURE__ */ new Map() };
|
|
252
|
+
}
|
|
253
|
+
function parseBlock(memo, block) {
|
|
254
|
+
if (memo) {
|
|
255
|
+
const cached = memo.blockSourceFiles.get(block);
|
|
256
|
+
if (cached) return cached;
|
|
257
|
+
}
|
|
258
|
+
const sf = ts3.createSourceFile(
|
|
259
|
+
"input.tsx",
|
|
260
|
+
block,
|
|
261
|
+
ts3.ScriptTarget.Latest,
|
|
262
|
+
true,
|
|
263
|
+
ts3.ScriptKind.TSX
|
|
264
|
+
);
|
|
265
|
+
if (memo) memo.blockSourceFiles.set(block, sf);
|
|
266
|
+
return sf;
|
|
267
|
+
}
|
|
268
|
+
function readSourceMemoized(memo, realPath) {
|
|
269
|
+
if (memo) {
|
|
270
|
+
const cached = memo.files.get(realPath);
|
|
271
|
+
if (cached !== void 0) return cached;
|
|
272
|
+
}
|
|
273
|
+
const source = readFileSync(realPath, "utf-8");
|
|
274
|
+
if (memo) memo.files.set(realPath, source);
|
|
275
|
+
return source;
|
|
276
|
+
}
|
|
277
|
+
function isUrlsDefinitionCall(node) {
|
|
278
|
+
const callee = node.expression;
|
|
279
|
+
return ts3.isIdentifier(callee) && (callee.text === "urls" || callee.text === "clientUrls");
|
|
280
|
+
}
|
|
240
281
|
function extractNamePrefixFromInclude(node) {
|
|
241
282
|
if (node.arguments.length >= 3) {
|
|
242
283
|
const thirdArg = node.arguments[2];
|
|
@@ -252,8 +293,95 @@ function extractNamePrefixFromInclude(node) {
|
|
|
252
293
|
}
|
|
253
294
|
return null;
|
|
254
295
|
}
|
|
255
|
-
function
|
|
256
|
-
const
|
|
296
|
+
function thenSelectsNonDefaultMember(expr) {
|
|
297
|
+
const findThenCall = (e) => {
|
|
298
|
+
if (ts3.isCallExpression(e) && ts3.isPropertyAccessExpression(e.expression) && e.expression.name.text === "then") {
|
|
299
|
+
return e;
|
|
300
|
+
}
|
|
301
|
+
if (ts3.isCallExpression(e) && ts3.isPropertyAccessExpression(e.expression)) {
|
|
302
|
+
return findThenCall(e.expression.expression);
|
|
303
|
+
}
|
|
304
|
+
if (ts3.isPropertyAccessExpression(e)) return findThenCall(e.expression);
|
|
305
|
+
if (ts3.isParenthesizedExpression(e)) return findThenCall(e.expression);
|
|
306
|
+
if (ts3.isAwaitExpression(e)) return findThenCall(e.expression);
|
|
307
|
+
return null;
|
|
308
|
+
};
|
|
309
|
+
const thenCall = findThenCall(expr);
|
|
310
|
+
if (!thenCall || thenCall.arguments.length === 0) return false;
|
|
311
|
+
const cb = thenCall.arguments[0];
|
|
312
|
+
if (!ts3.isArrowFunction(cb) && !ts3.isFunctionExpression(cb)) return false;
|
|
313
|
+
let ret;
|
|
314
|
+
if (ts3.isBlock(cb.body)) {
|
|
315
|
+
for (const stmt of cb.body.statements) {
|
|
316
|
+
if (ts3.isReturnStatement(stmt) && stmt.expression) {
|
|
317
|
+
ret = stmt.expression;
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
} else {
|
|
322
|
+
ret = cb.body;
|
|
323
|
+
}
|
|
324
|
+
if (!ret) return false;
|
|
325
|
+
if (ts3.isPropertyAccessExpression(ret)) {
|
|
326
|
+
return ret.name.text !== "default";
|
|
327
|
+
}
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
function extractDynamicImportSpecifier(node) {
|
|
331
|
+
let body;
|
|
332
|
+
if (ts3.isArrowFunction(node) || ts3.isFunctionExpression(node)) {
|
|
333
|
+
body = node.body;
|
|
334
|
+
}
|
|
335
|
+
if (!body) return null;
|
|
336
|
+
let expr;
|
|
337
|
+
if (ts3.isBlock(body)) {
|
|
338
|
+
for (const stmt of body.statements) {
|
|
339
|
+
if (ts3.isReturnStatement(stmt) && stmt.expression) {
|
|
340
|
+
expr = stmt.expression;
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
} else {
|
|
345
|
+
expr = body;
|
|
346
|
+
}
|
|
347
|
+
if (!expr) return null;
|
|
348
|
+
const findImportCall = (e) => {
|
|
349
|
+
if (ts3.isCallExpression(e) && e.expression.kind === ts3.SyntaxKind.ImportKeyword) {
|
|
350
|
+
return e;
|
|
351
|
+
}
|
|
352
|
+
if (ts3.isCallExpression(e) && ts3.isPropertyAccessExpression(e.expression)) {
|
|
353
|
+
return findImportCall(e.expression.expression);
|
|
354
|
+
}
|
|
355
|
+
if (ts3.isPropertyAccessExpression(e)) return findImportCall(e.expression);
|
|
356
|
+
if (ts3.isParenthesizedExpression(e)) return findImportCall(e.expression);
|
|
357
|
+
if (ts3.isAwaitExpression(e)) return findImportCall(e.expression);
|
|
358
|
+
return null;
|
|
359
|
+
};
|
|
360
|
+
const importCall = findImportCall(expr);
|
|
361
|
+
if (!importCall || importCall.arguments.length === 0) return null;
|
|
362
|
+
if (thenSelectsNonDefaultMember(expr)) return null;
|
|
363
|
+
return getStringValue(importCall.arguments[0]);
|
|
364
|
+
}
|
|
365
|
+
function resolveDefaultExportTarget(code, sourceFile) {
|
|
366
|
+
let result = null;
|
|
367
|
+
function visit(node) {
|
|
368
|
+
if (result) return;
|
|
369
|
+
if (ts3.isExportAssignment(node) && !node.isExportEquals) {
|
|
370
|
+
const expr = node.expression;
|
|
371
|
+
if (ts3.isIdentifier(expr)) {
|
|
372
|
+
result = { variableName: expr.text };
|
|
373
|
+
} else if (ts3.isCallExpression(expr) && isUrlsDefinitionCall(expr)) {
|
|
374
|
+
result = { inlineBlock: expr.getText(sourceFile) };
|
|
375
|
+
}
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
ts3.forEachChild(node, visit);
|
|
379
|
+
}
|
|
380
|
+
visit(sourceFile);
|
|
381
|
+
return result;
|
|
382
|
+
}
|
|
383
|
+
function extractIncludesWithDiagnostics(code, sourceFileArg) {
|
|
384
|
+
const sourceFile = sourceFileArg ?? ts3.createSourceFile(
|
|
257
385
|
"input.tsx",
|
|
258
386
|
code,
|
|
259
387
|
ts3.ScriptTarget.Latest,
|
|
@@ -277,12 +405,19 @@ function extractIncludesWithDiagnostics(code) {
|
|
|
277
405
|
}
|
|
278
406
|
const secondArg = node.arguments[1];
|
|
279
407
|
const namePrefix = extractNamePrefixFromInclude(node);
|
|
408
|
+
const dynamicImportSpec = extractDynamicImportSpecifier(secondArg);
|
|
280
409
|
if (ts3.isIdentifier(secondArg)) {
|
|
281
410
|
resolved.push({
|
|
282
411
|
pathPrefix,
|
|
283
412
|
variableName: secondArg.text,
|
|
284
413
|
namePrefix
|
|
285
414
|
});
|
|
415
|
+
} else if (dynamicImportSpec !== null) {
|
|
416
|
+
resolved.push({
|
|
417
|
+
pathPrefix,
|
|
418
|
+
moduleSpecifier: dynamicImportSpec,
|
|
419
|
+
namePrefix
|
|
420
|
+
});
|
|
286
421
|
} else if (ts3.isCallExpression(secondArg)) {
|
|
287
422
|
const callText = secondArg.expression.getText(sourceFile);
|
|
288
423
|
unresolvable.push({
|
|
@@ -307,7 +442,14 @@ function extractIncludesWithDiagnostics(code) {
|
|
|
307
442
|
return { resolved, unresolvable };
|
|
308
443
|
}
|
|
309
444
|
function resolveImportedVariable(code, localName) {
|
|
310
|
-
const
|
|
445
|
+
const defaultImportRegex = /import\s+([\w$]+)\s*(?:,\s*\{[^}]*\})?\s+from\s*["']([^"']+)["']/g;
|
|
446
|
+
let defaultMatch;
|
|
447
|
+
while ((defaultMatch = defaultImportRegex.exec(code)) !== null) {
|
|
448
|
+
if (defaultMatch[1] === localName) {
|
|
449
|
+
return { specifier: defaultMatch[2], exportedName: "default" };
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
const importRegex = /import\s*(?:[\w$]+\s*,\s*)?\{([^}]+)\}\s*from\s*["']([^"']+)["']/g;
|
|
311
453
|
let match;
|
|
312
454
|
while ((match = importRegex.exec(code)) !== null) {
|
|
313
455
|
const imports = match[1];
|
|
@@ -344,8 +486,8 @@ function resolveImportPath(importSpec, fromFile) {
|
|
|
344
486
|
}
|
|
345
487
|
return null;
|
|
346
488
|
}
|
|
347
|
-
function extractUrlsBlockForVariable(code, varName) {
|
|
348
|
-
const sourceFile = ts3.createSourceFile(
|
|
489
|
+
function extractUrlsBlockForVariable(code, varName, sourceFileArg) {
|
|
490
|
+
const sourceFile = sourceFileArg ?? ts3.createSourceFile(
|
|
349
491
|
"input.tsx",
|
|
350
492
|
code,
|
|
351
493
|
ts3.ScriptTarget.Latest,
|
|
@@ -356,8 +498,7 @@ function extractUrlsBlockForVariable(code, varName) {
|
|
|
356
498
|
function visit(node) {
|
|
357
499
|
if (result) return;
|
|
358
500
|
if (ts3.isVariableDeclaration(node) && ts3.isIdentifier(node.name) && node.name.text === varName && node.initializer && ts3.isCallExpression(node.initializer)) {
|
|
359
|
-
|
|
360
|
-
if (ts3.isIdentifier(callee) && callee.text === "urls") {
|
|
501
|
+
if (isUrlsDefinitionCall(node.initializer)) {
|
|
361
502
|
result = node.initializer.getText(sourceFile);
|
|
362
503
|
return;
|
|
363
504
|
}
|
|
@@ -367,67 +508,113 @@ function extractUrlsBlockForVariable(code, varName) {
|
|
|
367
508
|
visit(sourceFile);
|
|
368
509
|
return result;
|
|
369
510
|
}
|
|
370
|
-
function buildRouteMapFromBlock(block, fullSource, filePath, visited, searchSchemasOut, diagnosticsOut) {
|
|
511
|
+
function buildRouteMapFromBlock(block, fullSource, filePath, visited, searchSchemasOut, diagnosticsOut, memo) {
|
|
371
512
|
const routeMap = {};
|
|
372
|
-
const
|
|
513
|
+
const blockSourceFile = parseBlock(memo, block);
|
|
514
|
+
const localRoutes = extractRoutesFromSource(block, blockSourceFile);
|
|
373
515
|
for (const { name, pattern, search } of localRoutes) {
|
|
374
516
|
routeMap[name] = pattern;
|
|
375
517
|
if (search && searchSchemasOut) {
|
|
376
518
|
searchSchemasOut[name] = search;
|
|
377
519
|
}
|
|
378
520
|
}
|
|
379
|
-
const { resolved: includes, unresolvable } = extractIncludesWithDiagnostics(
|
|
521
|
+
const { resolved: includes, unresolvable } = extractIncludesWithDiagnostics(
|
|
522
|
+
block,
|
|
523
|
+
blockSourceFile
|
|
524
|
+
);
|
|
380
525
|
if (diagnosticsOut) {
|
|
381
526
|
for (const entry of unresolvable) {
|
|
382
527
|
diagnosticsOut.push({ ...entry, sourceFile: filePath });
|
|
383
528
|
}
|
|
384
529
|
}
|
|
385
|
-
for (const
|
|
530
|
+
for (const inc of includes) {
|
|
531
|
+
const { pathPrefix, namePrefix } = inc;
|
|
386
532
|
let childResult;
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
const targetFile = resolveImportPath(imported.specifier, filePath);
|
|
533
|
+
if (inc.moduleSpecifier) {
|
|
534
|
+
const targetFile = resolveImportPath(inc.moduleSpecifier, filePath);
|
|
390
535
|
if (!targetFile) {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
});
|
|
399
|
-
}
|
|
536
|
+
diagnosticsOut?.push({
|
|
537
|
+
pathPrefix,
|
|
538
|
+
namePrefix,
|
|
539
|
+
reason: "file-not-found",
|
|
540
|
+
sourceFile: filePath,
|
|
541
|
+
detail: `import("${inc.moduleSpecifier}") resolved to no file`
|
|
542
|
+
});
|
|
400
543
|
continue;
|
|
401
544
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
diagnosticsOut
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
545
|
+
let targetSource;
|
|
546
|
+
try {
|
|
547
|
+
targetSource = readSourceMemoized(memo, resolve(targetFile));
|
|
548
|
+
} catch (err) {
|
|
549
|
+
diagnosticsOut?.push({
|
|
550
|
+
pathPrefix,
|
|
551
|
+
namePrefix,
|
|
552
|
+
reason: "file-not-found",
|
|
553
|
+
sourceFile: filePath,
|
|
554
|
+
detail: `import("${inc.moduleSpecifier}") resolved to "${targetFile}" but reading it failed: ${err?.message ?? String(err)}`
|
|
555
|
+
});
|
|
556
|
+
continue;
|
|
557
|
+
}
|
|
558
|
+
const def = resolveDefaultExportTarget(
|
|
559
|
+
targetSource,
|
|
560
|
+
parseBlock(memo, targetSource)
|
|
412
561
|
);
|
|
413
|
-
if (!
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
});
|
|
422
|
-
}
|
|
562
|
+
if (!def) {
|
|
563
|
+
diagnosticsOut?.push({
|
|
564
|
+
pathPrefix,
|
|
565
|
+
namePrefix,
|
|
566
|
+
reason: "unresolvable-import",
|
|
567
|
+
sourceFile: filePath,
|
|
568
|
+
detail: `import("${inc.moduleSpecifier}") has no resolvable \`export default urls(...)\``
|
|
569
|
+
});
|
|
423
570
|
continue;
|
|
424
571
|
}
|
|
425
|
-
|
|
426
|
-
|
|
572
|
+
if (def.inlineBlock) {
|
|
573
|
+
childResult = buildCombinedRouteMapWithSearch(
|
|
574
|
+
targetFile,
|
|
575
|
+
void 0,
|
|
576
|
+
visited,
|
|
577
|
+
diagnosticsOut,
|
|
578
|
+
def.inlineBlock,
|
|
579
|
+
memo
|
|
580
|
+
);
|
|
581
|
+
} else {
|
|
582
|
+
const variableName = def.variableName;
|
|
583
|
+
const resolved = resolveIncludedVariable({
|
|
584
|
+
variableName,
|
|
585
|
+
resolutionFile: targetFile,
|
|
586
|
+
resolutionSource: targetSource,
|
|
587
|
+
reportFile: filePath,
|
|
588
|
+
memo,
|
|
589
|
+
visited,
|
|
590
|
+
diagnosticsOut,
|
|
591
|
+
pathPrefix,
|
|
592
|
+
namePrefix,
|
|
593
|
+
fileNotFoundDetail: (specifier) => `import("${inc.moduleSpecifier}") default re-exports "${variableName}" from "${specifier}", which resolved to no file`,
|
|
594
|
+
notFoundDetail: () => `import("${inc.moduleSpecifier}") default "${variableName}" not found in its imports or same-file scope`
|
|
595
|
+
});
|
|
596
|
+
if (!resolved) continue;
|
|
597
|
+
childResult = resolved;
|
|
598
|
+
}
|
|
599
|
+
} else if (inc.variableName) {
|
|
600
|
+
const variableName = inc.variableName;
|
|
601
|
+
const resolved = resolveIncludedVariable({
|
|
427
602
|
variableName,
|
|
603
|
+
resolutionFile: filePath,
|
|
604
|
+
resolutionSource: fullSource,
|
|
605
|
+
reportFile: filePath,
|
|
606
|
+
memo,
|
|
428
607
|
visited,
|
|
429
|
-
diagnosticsOut
|
|
430
|
-
|
|
608
|
+
diagnosticsOut,
|
|
609
|
+
pathPrefix,
|
|
610
|
+
namePrefix,
|
|
611
|
+
fileNotFoundDetail: (specifier) => `import "${specifier}" resolved to no file`,
|
|
612
|
+
notFoundDetail: () => `variable "${variableName}" not found in imports or same-file scope`
|
|
613
|
+
});
|
|
614
|
+
if (!resolved) continue;
|
|
615
|
+
childResult = resolved;
|
|
616
|
+
} else {
|
|
617
|
+
continue;
|
|
431
618
|
}
|
|
432
619
|
if (namePrefix === null) {
|
|
433
620
|
continue;
|
|
@@ -450,24 +637,131 @@ function buildRouteMapFromBlock(block, fullSource, filePath, visited, searchSche
|
|
|
450
637
|
}
|
|
451
638
|
return routeMap;
|
|
452
639
|
}
|
|
453
|
-
function
|
|
640
|
+
function resolveIncludedVariable(opts) {
|
|
641
|
+
const {
|
|
642
|
+
variableName,
|
|
643
|
+
resolutionFile,
|
|
644
|
+
resolutionSource,
|
|
645
|
+
reportFile,
|
|
646
|
+
memo,
|
|
647
|
+
visited,
|
|
648
|
+
diagnosticsOut,
|
|
649
|
+
pathPrefix,
|
|
650
|
+
namePrefix
|
|
651
|
+
} = opts;
|
|
652
|
+
const imported = resolveImportedVariable(resolutionSource, variableName);
|
|
653
|
+
if (imported) {
|
|
654
|
+
const targetFile = resolveImportPath(imported.specifier, resolutionFile);
|
|
655
|
+
if (!targetFile) {
|
|
656
|
+
diagnosticsOut?.push({
|
|
657
|
+
pathPrefix,
|
|
658
|
+
namePrefix,
|
|
659
|
+
reason: "file-not-found",
|
|
660
|
+
sourceFile: reportFile,
|
|
661
|
+
detail: opts.fileNotFoundDetail(imported.specifier)
|
|
662
|
+
});
|
|
663
|
+
return null;
|
|
664
|
+
}
|
|
665
|
+
return buildCombinedRouteMapWithSearch(
|
|
666
|
+
targetFile,
|
|
667
|
+
imported.exportedName,
|
|
668
|
+
visited,
|
|
669
|
+
diagnosticsOut,
|
|
670
|
+
void 0,
|
|
671
|
+
memo
|
|
672
|
+
);
|
|
673
|
+
}
|
|
674
|
+
const sameFileBlock = extractUrlsBlockForVariable(
|
|
675
|
+
resolutionSource,
|
|
676
|
+
variableName,
|
|
677
|
+
parseBlock(memo, resolutionSource)
|
|
678
|
+
);
|
|
679
|
+
if (!sameFileBlock) {
|
|
680
|
+
diagnosticsOut?.push({
|
|
681
|
+
pathPrefix,
|
|
682
|
+
namePrefix,
|
|
683
|
+
reason: "unresolvable-import",
|
|
684
|
+
sourceFile: reportFile,
|
|
685
|
+
detail: opts.notFoundDetail()
|
|
686
|
+
});
|
|
687
|
+
return null;
|
|
688
|
+
}
|
|
689
|
+
return buildCombinedRouteMapWithSearch(
|
|
690
|
+
resolutionFile,
|
|
691
|
+
variableName,
|
|
692
|
+
visited,
|
|
693
|
+
diagnosticsOut,
|
|
694
|
+
void 0,
|
|
695
|
+
memo
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
function buildCombinedRouteMapWithSearch(filePath, variableName, visited, diagnosticsOut, inlineBlock, memo) {
|
|
454
699
|
visited = visited ?? /* @__PURE__ */ new Set();
|
|
700
|
+
memo = memo ?? createScanMemo();
|
|
455
701
|
const realPath = resolve(filePath);
|
|
456
702
|
const key = variableName ? `${realPath}:${variableName}` : realPath;
|
|
457
703
|
if (visited.has(key)) {
|
|
458
|
-
console.warn(`[
|
|
704
|
+
console.warn(`[rango] Circular include detected, skipping: ${key}`);
|
|
459
705
|
return { routes: {}, searchSchemas: {} };
|
|
460
706
|
}
|
|
461
707
|
visited.add(key);
|
|
462
708
|
let source;
|
|
463
709
|
try {
|
|
464
|
-
source =
|
|
710
|
+
source = readSourceMemoized(memo, realPath);
|
|
465
711
|
} catch {
|
|
466
712
|
return { routes: {}, searchSchemas: {} };
|
|
467
713
|
}
|
|
468
714
|
let block;
|
|
469
|
-
if (
|
|
470
|
-
|
|
715
|
+
if (inlineBlock) {
|
|
716
|
+
block = inlineBlock;
|
|
717
|
+
} else if (variableName === "default") {
|
|
718
|
+
const defaultTarget = resolveDefaultExportTarget(
|
|
719
|
+
source,
|
|
720
|
+
parseBlock(memo, source)
|
|
721
|
+
);
|
|
722
|
+
if (!defaultTarget) {
|
|
723
|
+
visited.delete(key);
|
|
724
|
+
return { routes: {}, searchSchemas: {} };
|
|
725
|
+
}
|
|
726
|
+
if (defaultTarget.inlineBlock) {
|
|
727
|
+
block = defaultTarget.inlineBlock;
|
|
728
|
+
} else {
|
|
729
|
+
const targetName = defaultTarget.variableName;
|
|
730
|
+
const imported = resolveImportedVariable(source, targetName);
|
|
731
|
+
if (imported) {
|
|
732
|
+
const targetFile = resolveImportPath(imported.specifier, realPath);
|
|
733
|
+
if (!targetFile) {
|
|
734
|
+
visited.delete(key);
|
|
735
|
+
return { routes: {}, searchSchemas: {} };
|
|
736
|
+
}
|
|
737
|
+
const result = buildCombinedRouteMapWithSearch(
|
|
738
|
+
targetFile,
|
|
739
|
+
imported.exportedName,
|
|
740
|
+
visited,
|
|
741
|
+
diagnosticsOut,
|
|
742
|
+
void 0,
|
|
743
|
+
memo
|
|
744
|
+
);
|
|
745
|
+
visited.delete(key);
|
|
746
|
+
return result;
|
|
747
|
+
}
|
|
748
|
+
const extracted = extractUrlsBlockForVariable(
|
|
749
|
+
source,
|
|
750
|
+
targetName,
|
|
751
|
+
parseBlock(memo, source)
|
|
752
|
+
);
|
|
753
|
+
if (!extracted) {
|
|
754
|
+
visited.delete(key);
|
|
755
|
+
return { routes: {}, searchSchemas: {} };
|
|
756
|
+
}
|
|
757
|
+
block = extracted;
|
|
758
|
+
}
|
|
759
|
+
} else if (variableName) {
|
|
760
|
+
const extracted = extractUrlsBlockForVariable(
|
|
761
|
+
source,
|
|
762
|
+
variableName,
|
|
763
|
+
parseBlock(memo, source)
|
|
764
|
+
);
|
|
471
765
|
if (!extracted) return { routes: {}, searchSchemas: {} };
|
|
472
766
|
block = extracted;
|
|
473
767
|
} else {
|
|
@@ -480,7 +774,8 @@ function buildCombinedRouteMapWithSearch(filePath, variableName, visited, diagno
|
|
|
480
774
|
realPath,
|
|
481
775
|
visited,
|
|
482
776
|
searchSchemas,
|
|
483
|
-
diagnosticsOut
|
|
777
|
+
diagnosticsOut,
|
|
778
|
+
memo
|
|
484
779
|
);
|
|
485
780
|
visited.delete(key);
|
|
486
781
|
return { routes, searchSchemas };
|
|
@@ -508,7 +803,7 @@ function findUrlsVariableNames(code) {
|
|
|
508
803
|
function visit(node) {
|
|
509
804
|
if (ts4.isVariableDeclaration(node) && ts4.isIdentifier(node.name) && node.initializer && ts4.isCallExpression(node.initializer)) {
|
|
510
805
|
const callee = node.initializer.expression;
|
|
511
|
-
if (ts4.isIdentifier(callee) && callee.text === "urls") {
|
|
806
|
+
if (ts4.isIdentifier(callee) && (callee.text === "urls" || callee.text === "clientUrls")) {
|
|
512
807
|
names.push(node.name.text);
|
|
513
808
|
}
|
|
514
809
|
}
|
|
@@ -520,13 +815,21 @@ function findUrlsVariableNames(code) {
|
|
|
520
815
|
function writePerModuleRouteTypesForFile(filePath) {
|
|
521
816
|
try {
|
|
522
817
|
const source = readFileSync2(filePath, "utf-8");
|
|
523
|
-
if (!source.includes("urls(")) return;
|
|
818
|
+
if (!source.includes("urls(") && !source.includes("clientUrls(")) return;
|
|
524
819
|
const varNames = findUrlsVariableNames(source);
|
|
525
820
|
let routes;
|
|
526
821
|
if (varNames.length > 0) {
|
|
527
822
|
routes = [];
|
|
823
|
+
const memo = createScanMemo();
|
|
528
824
|
for (const varName of varNames) {
|
|
529
|
-
const { routes: routeMap, searchSchemas } = buildCombinedRouteMapWithSearch(
|
|
825
|
+
const { routes: routeMap, searchSchemas } = buildCombinedRouteMapWithSearch(
|
|
826
|
+
filePath,
|
|
827
|
+
varName,
|
|
828
|
+
void 0,
|
|
829
|
+
void 0,
|
|
830
|
+
void 0,
|
|
831
|
+
memo
|
|
832
|
+
);
|
|
530
833
|
for (const [name, pattern] of Object.entries(routeMap)) {
|
|
531
834
|
const params = extractParamsFromPattern(pattern);
|
|
532
835
|
routes.push({
|
|
@@ -540,12 +843,12 @@ function writePerModuleRouteTypesForFile(filePath) {
|
|
|
540
843
|
} else {
|
|
541
844
|
routes = extractRoutesFromSource(source);
|
|
542
845
|
}
|
|
543
|
-
const genPath = filePath.replace(/\.(tsx?)$/, ".gen.ts");
|
|
846
|
+
const genPath = filePath.replace(/\.(tsx?|jsx?)$/, ".gen.ts");
|
|
544
847
|
if (routes.length === 0) {
|
|
545
848
|
if (varNames.length > 0 && !existsSync2(genPath)) {
|
|
546
849
|
writeFileSync(genPath, generatePerModuleTypesSource([]));
|
|
547
850
|
console.log(
|
|
548
|
-
`[
|
|
851
|
+
`[rango] Generated route types (placeholder) -> ${genPath}`
|
|
549
852
|
);
|
|
550
853
|
}
|
|
551
854
|
return;
|
|
@@ -554,11 +857,11 @@ function writePerModuleRouteTypesForFile(filePath) {
|
|
|
554
857
|
const existing = existsSync2(genPath) ? readFileSync2(genPath, "utf-8") : null;
|
|
555
858
|
if (existing !== genSource) {
|
|
556
859
|
writeFileSync(genPath, genSource);
|
|
557
|
-
console.log(`[
|
|
860
|
+
console.log(`[rango] Generated route types -> ${genPath}`);
|
|
558
861
|
}
|
|
559
862
|
} catch (err) {
|
|
560
863
|
console.warn(
|
|
561
|
-
`[
|
|
864
|
+
`[rango] Failed to generate route types for ${filePath}: ${err.message}`
|
|
562
865
|
);
|
|
563
866
|
}
|
|
564
867
|
}
|
|
@@ -573,6 +876,131 @@ var init_per_module_writer = __esm({
|
|
|
573
876
|
}
|
|
574
877
|
});
|
|
575
878
|
|
|
879
|
+
// src/build/route-types/source-scan.ts
|
|
880
|
+
function isLineTerminator(ch) {
|
|
881
|
+
const c = ch.charCodeAt(0);
|
|
882
|
+
return c === 10 || c === 13 || c === 8232 || c === 8233;
|
|
883
|
+
}
|
|
884
|
+
function isRegexPositionAt(code, slashPos, prevChar) {
|
|
885
|
+
if (prevChar === void 0) return true;
|
|
886
|
+
if (prevChar === ")" || prevChar === "]" || prevChar === "}") return false;
|
|
887
|
+
if (!/[\w$]/.test(prevChar)) return true;
|
|
888
|
+
let k = slashPos - 1;
|
|
889
|
+
while (k >= 0 && /\s/.test(code[k])) k--;
|
|
890
|
+
const wordEnd = k + 1;
|
|
891
|
+
while (k >= 0 && /[\w$]/.test(code[k])) k--;
|
|
892
|
+
return REGEX_PRECEDING_KEYWORDS.has(code.slice(k + 1, wordEnd));
|
|
893
|
+
}
|
|
894
|
+
function makeCodeClassifier(code) {
|
|
895
|
+
const n = code.length;
|
|
896
|
+
let i = 0;
|
|
897
|
+
let skipStart = -1;
|
|
898
|
+
let skipEnd = -1;
|
|
899
|
+
let lastSig;
|
|
900
|
+
return (q) => {
|
|
901
|
+
if (q >= skipStart && q < skipEnd) return false;
|
|
902
|
+
while (i < n && i <= q) {
|
|
903
|
+
const c = code[i];
|
|
904
|
+
const d = i + 1 < n ? code[i + 1] : "";
|
|
905
|
+
let end = -1;
|
|
906
|
+
let transparent = false;
|
|
907
|
+
if (c === "/" && d === "/") {
|
|
908
|
+
let j = i + 2;
|
|
909
|
+
while (j < n && !isLineTerminator(code[j])) j++;
|
|
910
|
+
end = j;
|
|
911
|
+
transparent = true;
|
|
912
|
+
} else if (c === "/" && d === "*") {
|
|
913
|
+
let j = i + 2;
|
|
914
|
+
while (j < n && !(code[j] === "*" && code[j + 1] === "/")) j++;
|
|
915
|
+
end = Math.min(n, j + 2);
|
|
916
|
+
transparent = true;
|
|
917
|
+
} else if (c === '"' || c === "'" || c === "`") {
|
|
918
|
+
let j = i + 1;
|
|
919
|
+
while (j < n) {
|
|
920
|
+
if (code[j] === "\\") {
|
|
921
|
+
j += 2;
|
|
922
|
+
continue;
|
|
923
|
+
}
|
|
924
|
+
if (code[j] === c) {
|
|
925
|
+
j++;
|
|
926
|
+
break;
|
|
927
|
+
}
|
|
928
|
+
j++;
|
|
929
|
+
}
|
|
930
|
+
end = j;
|
|
931
|
+
} else if (c === "/" && d !== "/" && d !== "*" && isRegexPositionAt(code, i, lastSig)) {
|
|
932
|
+
let j = i + 1;
|
|
933
|
+
let inClass = false;
|
|
934
|
+
let closed = false;
|
|
935
|
+
while (j < n && !isLineTerminator(code[j])) {
|
|
936
|
+
const r = code[j];
|
|
937
|
+
if (r === "\\") {
|
|
938
|
+
j += 2;
|
|
939
|
+
continue;
|
|
940
|
+
}
|
|
941
|
+
if (r === "[") inClass = true;
|
|
942
|
+
else if (r === "]") inClass = false;
|
|
943
|
+
else if (r === "/" && !inClass) {
|
|
944
|
+
j++;
|
|
945
|
+
closed = true;
|
|
946
|
+
break;
|
|
947
|
+
}
|
|
948
|
+
j++;
|
|
949
|
+
}
|
|
950
|
+
if (closed) {
|
|
951
|
+
while (j < n && /[a-z]/.test(code[j])) j++;
|
|
952
|
+
end = j;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
if (end >= 0) {
|
|
956
|
+
if (q < end) {
|
|
957
|
+
skipStart = i;
|
|
958
|
+
skipEnd = end;
|
|
959
|
+
return false;
|
|
960
|
+
}
|
|
961
|
+
i = end;
|
|
962
|
+
if (!transparent) lastSig = "x";
|
|
963
|
+
} else {
|
|
964
|
+
if (!/\s/.test(c)) lastSig = c;
|
|
965
|
+
i++;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
return true;
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
function firstCodeMatchIndex(code, pattern) {
|
|
972
|
+
const inCode = makeCodeClassifier(code);
|
|
973
|
+
pattern.lastIndex = 0;
|
|
974
|
+
let m;
|
|
975
|
+
while ((m = pattern.exec(code)) !== null) {
|
|
976
|
+
if (inCode(m.index)) return m.index;
|
|
977
|
+
if (pattern.lastIndex <= m.index) pattern.lastIndex = m.index + 1;
|
|
978
|
+
}
|
|
979
|
+
return -1;
|
|
980
|
+
}
|
|
981
|
+
var REGEX_PRECEDING_KEYWORDS;
|
|
982
|
+
var init_source_scan = __esm({
|
|
983
|
+
"src/build/route-types/source-scan.ts"() {
|
|
984
|
+
"use strict";
|
|
985
|
+
REGEX_PRECEDING_KEYWORDS = /* @__PURE__ */ new Set([
|
|
986
|
+
"return",
|
|
987
|
+
"typeof",
|
|
988
|
+
"instanceof",
|
|
989
|
+
"in",
|
|
990
|
+
"of",
|
|
991
|
+
"new",
|
|
992
|
+
"delete",
|
|
993
|
+
"void",
|
|
994
|
+
"do",
|
|
995
|
+
"else",
|
|
996
|
+
"yield",
|
|
997
|
+
"await",
|
|
998
|
+
"case",
|
|
999
|
+
"throw"
|
|
1000
|
+
]);
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
|
|
576
1004
|
// src/build/route-types/router-processing.ts
|
|
577
1005
|
import {
|
|
578
1006
|
readFileSync as readFileSync3,
|
|
@@ -601,44 +1029,52 @@ function countPublicRouteEntries(source) {
|
|
|
601
1029
|
return count;
|
|
602
1030
|
}
|
|
603
1031
|
function isRoutableSourceFile(name) {
|
|
604
|
-
return (name.endsWith(".ts") || name.endsWith(".tsx") || name.endsWith(".js") || name.endsWith(".jsx")) && !name.includes(".gen.");
|
|
1032
|
+
return (name.endsWith(".ts") || name.endsWith(".tsx") || name.endsWith(".js") || name.endsWith(".jsx")) && !name.includes(".gen.") && !name.includes(".test.") && !name.includes(".spec.");
|
|
605
1033
|
}
|
|
606
|
-
function
|
|
1034
|
+
function isExcludedScanDir(name) {
|
|
1035
|
+
return name === "node_modules" || name === "dist" || name === "coverage" || name === "__tests__" || name === "__mocks__" || name.startsWith(".");
|
|
1036
|
+
}
|
|
1037
|
+
function findCallSiteFilesRecursive(dir, pattern, patternG, stopAtMatchDir, filter, results) {
|
|
607
1038
|
let entries;
|
|
608
1039
|
try {
|
|
609
1040
|
entries = readdirSync2(dir, { withFileTypes: true });
|
|
610
1041
|
} catch (err) {
|
|
611
1042
|
console.warn(
|
|
612
|
-
`[
|
|
1043
|
+
`[rango] Failed to scan directory ${dir}: ${err.message}`
|
|
613
1044
|
);
|
|
614
1045
|
return;
|
|
615
1046
|
}
|
|
616
1047
|
const childDirs = [];
|
|
617
|
-
const
|
|
1048
|
+
const matchesInDir = [];
|
|
618
1049
|
for (const entry of entries) {
|
|
619
1050
|
const fullPath = join2(dir, entry.name);
|
|
620
1051
|
if (entry.isDirectory()) {
|
|
621
|
-
if (entry.name
|
|
622
|
-
childDirs.push(fullPath);
|
|
1052
|
+
if (!isExcludedScanDir(entry.name)) childDirs.push(fullPath);
|
|
623
1053
|
continue;
|
|
624
1054
|
}
|
|
625
1055
|
if (!isRoutableSourceFile(entry.name)) continue;
|
|
626
1056
|
if (filter && !filter(fullPath)) continue;
|
|
627
1057
|
try {
|
|
628
1058
|
const source = readFileSync3(fullPath, "utf-8");
|
|
629
|
-
if (
|
|
630
|
-
|
|
1059
|
+
if (pattern.test(source) && firstCodeMatchIndex(source, patternG) >= 0) {
|
|
1060
|
+
matchesInDir.push(fullPath);
|
|
631
1061
|
}
|
|
632
1062
|
} catch {
|
|
633
1063
|
continue;
|
|
634
1064
|
}
|
|
635
1065
|
}
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
1066
|
+
results.push(...matchesInDir);
|
|
1067
|
+
if (!stopAtMatchDir || matchesInDir.length === 0) {
|
|
1068
|
+
for (const childDir of childDirs) {
|
|
1069
|
+
findCallSiteFilesRecursive(
|
|
1070
|
+
childDir,
|
|
1071
|
+
pattern,
|
|
1072
|
+
patternG,
|
|
1073
|
+
stopAtMatchDir,
|
|
1074
|
+
filter,
|
|
1075
|
+
results
|
|
1076
|
+
);
|
|
1077
|
+
}
|
|
642
1078
|
}
|
|
643
1079
|
}
|
|
644
1080
|
function findNestedRouterConflict(routerFiles) {
|
|
@@ -664,13 +1100,39 @@ function findNestedRouterConflict(routerFiles) {
|
|
|
664
1100
|
}
|
|
665
1101
|
return null;
|
|
666
1102
|
}
|
|
667
|
-
function formatNestedRouterConflictError(conflict, prefix = "[
|
|
1103
|
+
function formatNestedRouterConflictError(conflict, prefix = "[rango]") {
|
|
668
1104
|
return `${prefix} Nested router roots are not supported.
|
|
669
1105
|
Router root: ${conflict.ancestor}
|
|
670
1106
|
Nested router: ${conflict.nested}
|
|
671
1107
|
Move the nested router into a sibling directory or configure it as a separate app root.`;
|
|
672
1108
|
}
|
|
673
|
-
function
|
|
1109
|
+
function isCreateRouterCall(node) {
|
|
1110
|
+
if (!ts5.isCallExpression(node)) return false;
|
|
1111
|
+
const callee = node.expression;
|
|
1112
|
+
return ts5.isIdentifier(callee) && callee.text === "createRouter";
|
|
1113
|
+
}
|
|
1114
|
+
function extractUrlsArgument(node, sourceFile) {
|
|
1115
|
+
if (ts5.isIdentifier(node)) {
|
|
1116
|
+
return { kind: "variable", name: node.text };
|
|
1117
|
+
}
|
|
1118
|
+
if (ts5.isArrowFunction(node) || ts5.isFunctionExpression(node)) {
|
|
1119
|
+
return { kind: "inline", block: node.getText(sourceFile) };
|
|
1120
|
+
}
|
|
1121
|
+
return null;
|
|
1122
|
+
}
|
|
1123
|
+
function collectCreateRouterCallChain(endpoint) {
|
|
1124
|
+
const calls = [];
|
|
1125
|
+
let current = endpoint;
|
|
1126
|
+
while (true) {
|
|
1127
|
+
calls.push(current);
|
|
1128
|
+
if (isCreateRouterCall(current)) return calls.reverse();
|
|
1129
|
+
if (!ts5.isPropertyAccessExpression(current.expression)) return null;
|
|
1130
|
+
const receiver = current.expression.expression;
|
|
1131
|
+
if (!ts5.isCallExpression(receiver)) return null;
|
|
1132
|
+
current = receiver;
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
function extractAllUrlsFromRouter(code) {
|
|
674
1136
|
const sourceFile = ts5.createSourceFile(
|
|
675
1137
|
"router.tsx",
|
|
676
1138
|
code,
|
|
@@ -679,29 +1141,62 @@ function extractUrlsVariableFromRouter(code) {
|
|
|
679
1141
|
ts5.ScriptKind.TSX
|
|
680
1142
|
);
|
|
681
1143
|
let result = null;
|
|
682
|
-
function isCreateRouterCall(node) {
|
|
683
|
-
if (!ts5.isCallExpression(node)) return false;
|
|
684
|
-
const callee = node.expression;
|
|
685
|
-
return ts5.isIdentifier(callee) && callee.text === "createRouter";
|
|
686
|
-
}
|
|
687
1144
|
function visit(node) {
|
|
688
1145
|
if (result) return;
|
|
689
|
-
if (ts5.isCallExpression(node)
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
1146
|
+
if (ts5.isCallExpression(node)) {
|
|
1147
|
+
const chain = collectCreateRouterCallChain(node);
|
|
1148
|
+
if (chain) {
|
|
1149
|
+
const extracted = [];
|
|
1150
|
+
const createRouterCall = chain[0];
|
|
1151
|
+
for (const callArg of createRouterCall.arguments) {
|
|
1152
|
+
if (!ts5.isObjectLiteralExpression(callArg)) continue;
|
|
1153
|
+
for (const prop of callArg.properties) {
|
|
1154
|
+
if (!ts5.isPropertyAssignment(prop) || !ts5.isIdentifier(prop.name) || prop.name.text !== "urls") {
|
|
1155
|
+
continue;
|
|
1156
|
+
}
|
|
1157
|
+
const urls = extractUrlsArgument(prop.initializer, sourceFile);
|
|
1158
|
+
if (urls) extracted.push(urls);
|
|
1159
|
+
break;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
for (const call of chain.slice(1)) {
|
|
1163
|
+
if (!ts5.isPropertyAccessExpression(call.expression) || call.expression.name.text !== "routes" || call.arguments.length === 0) {
|
|
1164
|
+
continue;
|
|
1165
|
+
}
|
|
1166
|
+
const urls = extractUrlsArgument(call.arguments[0], sourceFile);
|
|
1167
|
+
if (urls) extracted.push(urls);
|
|
1168
|
+
}
|
|
1169
|
+
if (extracted.length > 0) {
|
|
1170
|
+
result = extracted;
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
697
1173
|
}
|
|
698
1174
|
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
1175
|
+
ts5.forEachChild(node, visit);
|
|
1176
|
+
}
|
|
1177
|
+
visit(sourceFile);
|
|
1178
|
+
return result ?? [];
|
|
1179
|
+
}
|
|
1180
|
+
function extractUrlsFromRouter(code) {
|
|
1181
|
+
const extractions = extractAllUrlsFromRouter(code);
|
|
1182
|
+
return extractions[extractions.length - 1] ?? null;
|
|
1183
|
+
}
|
|
1184
|
+
function extractBasenameFromRouter(code) {
|
|
1185
|
+
const sourceFile = ts5.createSourceFile(
|
|
1186
|
+
"router.tsx",
|
|
1187
|
+
code,
|
|
1188
|
+
ts5.ScriptTarget.Latest,
|
|
1189
|
+
true,
|
|
1190
|
+
ts5.ScriptKind.TSX
|
|
1191
|
+
);
|
|
1192
|
+
let result;
|
|
1193
|
+
function visit(node) {
|
|
1194
|
+
if (result !== void 0) return;
|
|
1195
|
+
if (ts5.isCallExpression(node) && ts5.isIdentifier(node.expression) && node.expression.text === "createRouter") {
|
|
1196
|
+
for (const arg of node.arguments) {
|
|
702
1197
|
if (ts5.isObjectLiteralExpression(arg)) {
|
|
703
1198
|
for (const prop of arg.properties) {
|
|
704
|
-
if (ts5.isPropertyAssignment(prop) && ts5.isIdentifier(prop.name) && prop.name.text === "
|
|
1199
|
+
if (ts5.isPropertyAssignment(prop) && ts5.isIdentifier(prop.name) && prop.name.text === "basename" && ts5.isStringLiteral(prop.initializer)) {
|
|
705
1200
|
result = prop.initializer.text;
|
|
706
1201
|
return;
|
|
707
1202
|
}
|
|
@@ -714,6 +1209,91 @@ function extractUrlsVariableFromRouter(code) {
|
|
|
714
1209
|
visit(sourceFile);
|
|
715
1210
|
return result;
|
|
716
1211
|
}
|
|
1212
|
+
function applyBasenameToRoutes(result, basename) {
|
|
1213
|
+
const prefixed = {};
|
|
1214
|
+
for (const [name, pattern] of Object.entries(result.routes)) {
|
|
1215
|
+
if (pattern === "/") {
|
|
1216
|
+
prefixed[name] = basename;
|
|
1217
|
+
} else if (basename.endsWith("/") && pattern.startsWith("/")) {
|
|
1218
|
+
prefixed[name] = basename + pattern.slice(1);
|
|
1219
|
+
} else {
|
|
1220
|
+
prefixed[name] = basename + pattern;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
return { routes: prefixed, searchSchemas: result.searchSchemas };
|
|
1224
|
+
}
|
|
1225
|
+
function resolveRouterUrlsExtraction(routerFilePath, routerSource, extraction, diagnosticsOut, memo) {
|
|
1226
|
+
if (extraction.kind === "inline") {
|
|
1227
|
+
return buildCombinedRouteMapWithSearch(
|
|
1228
|
+
routerFilePath,
|
|
1229
|
+
void 0,
|
|
1230
|
+
/* @__PURE__ */ new Set(),
|
|
1231
|
+
diagnosticsOut,
|
|
1232
|
+
extraction.block,
|
|
1233
|
+
memo
|
|
1234
|
+
);
|
|
1235
|
+
}
|
|
1236
|
+
const imported = resolveImportedVariable(routerSource, extraction.name);
|
|
1237
|
+
if (imported) {
|
|
1238
|
+
const targetFile = resolveImportPath(imported.specifier, routerFilePath);
|
|
1239
|
+
if (!targetFile) {
|
|
1240
|
+
diagnosticsOut?.push({
|
|
1241
|
+
pathPrefix: "/",
|
|
1242
|
+
namePrefix: null,
|
|
1243
|
+
reason: "file-not-found",
|
|
1244
|
+
sourceFile: routerFilePath,
|
|
1245
|
+
detail: `import "${imported.specifier}" resolved to no file`
|
|
1246
|
+
});
|
|
1247
|
+
return { routes: {}, searchSchemas: {} };
|
|
1248
|
+
}
|
|
1249
|
+
return buildCombinedRouteMapWithSearch(
|
|
1250
|
+
targetFile,
|
|
1251
|
+
imported.exportedName,
|
|
1252
|
+
/* @__PURE__ */ new Set(),
|
|
1253
|
+
diagnosticsOut,
|
|
1254
|
+
void 0,
|
|
1255
|
+
memo
|
|
1256
|
+
);
|
|
1257
|
+
}
|
|
1258
|
+
return buildCombinedRouteMapWithSearch(
|
|
1259
|
+
routerFilePath,
|
|
1260
|
+
extraction.name,
|
|
1261
|
+
/* @__PURE__ */ new Set(),
|
|
1262
|
+
diagnosticsOut,
|
|
1263
|
+
void 0,
|
|
1264
|
+
memo
|
|
1265
|
+
);
|
|
1266
|
+
}
|
|
1267
|
+
function mergeRouteMaps(target, source) {
|
|
1268
|
+
for (const [name, pattern] of Object.entries(source.routes)) {
|
|
1269
|
+
target.routes[name] = pattern;
|
|
1270
|
+
const search = source.searchSchemas[name];
|
|
1271
|
+
if (search) {
|
|
1272
|
+
target.searchSchemas[name] = search;
|
|
1273
|
+
} else {
|
|
1274
|
+
delete target.searchSchemas[name];
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
function genFileTsPath(sourceFile) {
|
|
1279
|
+
const base = pathBasename(sourceFile).replace(/\.(tsx?|jsx?)$/, "");
|
|
1280
|
+
return join2(dirname2(sourceFile), `${base}.named-routes.gen.ts`);
|
|
1281
|
+
}
|
|
1282
|
+
function resolveSearchSchemas(publicRouteNames, runtimeSchemas, sourceFile) {
|
|
1283
|
+
if (runtimeSchemas && Object.keys(runtimeSchemas).length > 0) {
|
|
1284
|
+
return runtimeSchemas;
|
|
1285
|
+
}
|
|
1286
|
+
const staticParsed = buildCombinedRouteMapForRouterFile(sourceFile);
|
|
1287
|
+
if (Object.keys(staticParsed.searchSchemas).length === 0) {
|
|
1288
|
+
return runtimeSchemas;
|
|
1289
|
+
}
|
|
1290
|
+
const filtered = {};
|
|
1291
|
+
for (const name of publicRouteNames) {
|
|
1292
|
+
const schema = staticParsed.searchSchemas[name];
|
|
1293
|
+
if (schema) filtered[name] = schema;
|
|
1294
|
+
}
|
|
1295
|
+
return Object.keys(filtered).length > 0 ? filtered : runtimeSchemas;
|
|
1296
|
+
}
|
|
717
1297
|
function buildCombinedRouteMapForRouterFile(routerFilePath) {
|
|
718
1298
|
let routerSource;
|
|
719
1299
|
try {
|
|
@@ -721,19 +1301,30 @@ function buildCombinedRouteMapForRouterFile(routerFilePath) {
|
|
|
721
1301
|
} catch {
|
|
722
1302
|
return { routes: {}, searchSchemas: {} };
|
|
723
1303
|
}
|
|
724
|
-
const
|
|
725
|
-
if (
|
|
1304
|
+
const extractions = extractAllUrlsFromRouter(routerSource);
|
|
1305
|
+
if (extractions.length === 0) {
|
|
726
1306
|
return { routes: {}, searchSchemas: {} };
|
|
727
1307
|
}
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
1308
|
+
const rawBasename = extractBasenameFromRouter(routerSource);
|
|
1309
|
+
const basename = rawBasename ? ("/" + rawBasename.replace(/^\/+|\/+$/g, "")).replace(/^\/$/, "") : void 0;
|
|
1310
|
+
const result = { routes: {}, searchSchemas: {} };
|
|
1311
|
+
const memo = createScanMemo();
|
|
1312
|
+
for (const extraction of extractions) {
|
|
1313
|
+
mergeRouteMaps(
|
|
1314
|
+
result,
|
|
1315
|
+
resolveRouterUrlsExtraction(
|
|
1316
|
+
routerFilePath,
|
|
1317
|
+
routerSource,
|
|
1318
|
+
extraction,
|
|
1319
|
+
void 0,
|
|
1320
|
+
memo
|
|
1321
|
+
)
|
|
1322
|
+
);
|
|
735
1323
|
}
|
|
736
|
-
|
|
1324
|
+
if (basename) {
|
|
1325
|
+
return applyBasenameToRoutes(result, basename);
|
|
1326
|
+
}
|
|
1327
|
+
return result;
|
|
737
1328
|
}
|
|
738
1329
|
function detectUnresolvableIncludes(routerFilePath) {
|
|
739
1330
|
const realPath = resolve2(routerFilePath);
|
|
@@ -743,37 +1334,19 @@ function detectUnresolvableIncludes(routerFilePath) {
|
|
|
743
1334
|
} catch {
|
|
744
1335
|
return [];
|
|
745
1336
|
}
|
|
746
|
-
const
|
|
747
|
-
if (
|
|
748
|
-
const imported = resolveImportedVariable(source, urlsVarName);
|
|
749
|
-
let targetFile;
|
|
750
|
-
let exportedName;
|
|
751
|
-
if (imported) {
|
|
752
|
-
const resolved = resolveImportPath(imported.specifier, realPath);
|
|
753
|
-
if (!resolved) {
|
|
754
|
-
return [
|
|
755
|
-
{
|
|
756
|
-
pathPrefix: "/",
|
|
757
|
-
namePrefix: null,
|
|
758
|
-
reason: "file-not-found",
|
|
759
|
-
sourceFile: realPath,
|
|
760
|
-
detail: `import "${imported.specifier}" resolved to no file`
|
|
761
|
-
}
|
|
762
|
-
];
|
|
763
|
-
}
|
|
764
|
-
targetFile = resolved;
|
|
765
|
-
exportedName = imported.exportedName;
|
|
766
|
-
} else {
|
|
767
|
-
targetFile = realPath;
|
|
768
|
-
exportedName = urlsVarName;
|
|
769
|
-
}
|
|
1337
|
+
const extractions = extractAllUrlsFromRouter(source);
|
|
1338
|
+
if (extractions.length === 0) return [];
|
|
770
1339
|
const diagnostics = [];
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
1340
|
+
const memo = createScanMemo();
|
|
1341
|
+
for (const extraction of extractions) {
|
|
1342
|
+
resolveRouterUrlsExtraction(
|
|
1343
|
+
realPath,
|
|
1344
|
+
source,
|
|
1345
|
+
extraction,
|
|
1346
|
+
diagnostics,
|
|
1347
|
+
memo
|
|
1348
|
+
);
|
|
1349
|
+
}
|
|
777
1350
|
return diagnostics;
|
|
778
1351
|
}
|
|
779
1352
|
function detectUnresolvableIncludesForUrlsFile(filePath) {
|
|
@@ -794,7 +1367,14 @@ function detectUnresolvableIncludesForUrlsFile(filePath) {
|
|
|
794
1367
|
}
|
|
795
1368
|
function findRouterFiles(root, filter) {
|
|
796
1369
|
const result = [];
|
|
797
|
-
|
|
1370
|
+
findCallSiteFilesRecursive(
|
|
1371
|
+
root,
|
|
1372
|
+
ROUTER_CALL_PATTERN,
|
|
1373
|
+
ROUTER_CALL_PATTERN_G,
|
|
1374
|
+
true,
|
|
1375
|
+
filter,
|
|
1376
|
+
result
|
|
1377
|
+
);
|
|
798
1378
|
return result;
|
|
799
1379
|
}
|
|
800
1380
|
function writeCombinedRouteTypes(root, knownRouterFiles, opts) {
|
|
@@ -803,7 +1383,7 @@ function writeCombinedRouteTypes(root, knownRouterFiles, opts) {
|
|
|
803
1383
|
if (existsSync3(oldCombinedPath)) {
|
|
804
1384
|
unlinkSync(oldCombinedPath);
|
|
805
1385
|
console.log(
|
|
806
|
-
`[
|
|
1386
|
+
`[rango] Removed stale combined route types: ${oldCombinedPath}`
|
|
807
1387
|
);
|
|
808
1388
|
}
|
|
809
1389
|
} catch {
|
|
@@ -815,38 +1395,22 @@ function writeCombinedRouteTypes(root, knownRouterFiles, opts) {
|
|
|
815
1395
|
throw new Error(formatNestedRouterConflictError(nestedRouterConflict));
|
|
816
1396
|
}
|
|
817
1397
|
for (const routerFilePath of routerFilePaths) {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
routerSource
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
const imported = resolveImportedVariable(routerSource, urlsVarName);
|
|
828
|
-
if (imported) {
|
|
829
|
-
const targetFile = resolveImportPath(imported.specifier, routerFilePath);
|
|
830
|
-
if (!targetFile) continue;
|
|
831
|
-
result = buildCombinedRouteMapWithSearch(
|
|
832
|
-
targetFile,
|
|
833
|
-
imported.exportedName
|
|
834
|
-
);
|
|
835
|
-
} else {
|
|
836
|
-
result = buildCombinedRouteMapWithSearch(routerFilePath, urlsVarName);
|
|
1398
|
+
const result = buildCombinedRouteMapForRouterFile(routerFilePath);
|
|
1399
|
+
if (Object.keys(result.routes).length === 0 && Object.keys(result.searchSchemas).length === 0) {
|
|
1400
|
+
let routerSource;
|
|
1401
|
+
try {
|
|
1402
|
+
routerSource = readFileSync3(routerFilePath, "utf-8");
|
|
1403
|
+
} catch {
|
|
1404
|
+
continue;
|
|
1405
|
+
}
|
|
1406
|
+
if (!extractUrlsFromRouter(routerSource)) continue;
|
|
837
1407
|
}
|
|
838
|
-
const
|
|
839
|
-
/\.(tsx?|jsx?)$/,
|
|
840
|
-
""
|
|
841
|
-
);
|
|
842
|
-
const outPath = join2(
|
|
843
|
-
dirname2(routerFilePath),
|
|
844
|
-
`${routerBasename}.named-routes.gen.ts`
|
|
845
|
-
);
|
|
1408
|
+
const outPath = genFileTsPath(routerFilePath);
|
|
846
1409
|
const existing = existsSync3(outPath) ? readFileSync3(outPath, "utf-8") : null;
|
|
847
1410
|
if (Object.keys(result.routes).length === 0) {
|
|
848
1411
|
if (!existing) {
|
|
849
1412
|
const emptySource = generateRouteTypesSource({});
|
|
1413
|
+
opts?.onWrite?.(outPath, emptySource);
|
|
850
1414
|
writeFileSync2(outPath, emptySource);
|
|
851
1415
|
}
|
|
852
1416
|
continue;
|
|
@@ -866,22 +1430,25 @@ function writeCombinedRouteTypes(root, knownRouterFiles, opts) {
|
|
|
866
1430
|
continue;
|
|
867
1431
|
}
|
|
868
1432
|
}
|
|
1433
|
+
opts?.onWrite?.(outPath, source);
|
|
869
1434
|
writeFileSync2(outPath, source);
|
|
870
1435
|
console.log(
|
|
871
|
-
`[
|
|
1436
|
+
`[rango] Generated route types (${Object.keys(result.routes).length} routes) -> ${outPath}`
|
|
872
1437
|
);
|
|
873
1438
|
}
|
|
874
1439
|
}
|
|
875
1440
|
}
|
|
876
|
-
var ROUTER_CALL_PATTERN;
|
|
1441
|
+
var ROUTER_CALL_PATTERN, ROUTER_CALL_PATTERN_G;
|
|
877
1442
|
var init_router_processing = __esm({
|
|
878
1443
|
"src/build/route-types/router-processing.ts"() {
|
|
879
1444
|
"use strict";
|
|
880
1445
|
init_codegen();
|
|
1446
|
+
init_source_scan();
|
|
881
1447
|
init_include_resolution();
|
|
882
1448
|
init_per_module_writer();
|
|
883
1449
|
init_route_name();
|
|
884
1450
|
ROUTER_CALL_PATTERN = /\bcreateRouter\s*[<(]/;
|
|
1451
|
+
ROUTER_CALL_PATTERN_G = /\bcreateRouter\s*[<(]/g;
|
|
885
1452
|
}
|
|
886
1453
|
});
|
|
887
1454
|
|
|
@@ -900,11 +1467,143 @@ var init_generate_route_types = __esm({
|
|
|
900
1467
|
}
|
|
901
1468
|
});
|
|
902
1469
|
|
|
1470
|
+
// src/build/merge-full-manifests.ts
|
|
1471
|
+
function clonePrefixNode(node) {
|
|
1472
|
+
return {
|
|
1473
|
+
staticPrefix: node.staticPrefix,
|
|
1474
|
+
fullPrefix: node.fullPrefix,
|
|
1475
|
+
...node.namePrefix === void 0 ? {} : { namePrefix: node.namePrefix },
|
|
1476
|
+
children: clonePrefixTree(node.children),
|
|
1477
|
+
routes: [...node.routes]
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
function clonePrefixTree(tree) {
|
|
1481
|
+
return Object.fromEntries(
|
|
1482
|
+
Object.entries(tree).map(([prefix, node]) => [
|
|
1483
|
+
prefix,
|
|
1484
|
+
clonePrefixNode(node)
|
|
1485
|
+
])
|
|
1486
|
+
);
|
|
1487
|
+
}
|
|
1488
|
+
function removeRoutesFromPrefixTree(tree, routeNames) {
|
|
1489
|
+
return Object.fromEntries(
|
|
1490
|
+
Object.entries(tree).map(([prefix, node]) => [
|
|
1491
|
+
prefix,
|
|
1492
|
+
{
|
|
1493
|
+
staticPrefix: node.staticPrefix,
|
|
1494
|
+
fullPrefix: node.fullPrefix,
|
|
1495
|
+
...node.namePrefix === void 0 ? {} : { namePrefix: node.namePrefix },
|
|
1496
|
+
children: removeRoutesFromPrefixTree(node.children, routeNames),
|
|
1497
|
+
routes: node.routes.filter((name) => !routeNames.has(name))
|
|
1498
|
+
}
|
|
1499
|
+
])
|
|
1500
|
+
);
|
|
1501
|
+
}
|
|
1502
|
+
function mergePrefixTrees(earlier, later) {
|
|
1503
|
+
const merged = clonePrefixTree(earlier);
|
|
1504
|
+
for (const [prefix, laterNode] of Object.entries(later)) {
|
|
1505
|
+
const earlierNode = merged[prefix];
|
|
1506
|
+
if (!earlierNode) {
|
|
1507
|
+
merged[prefix] = clonePrefixNode(laterNode);
|
|
1508
|
+
continue;
|
|
1509
|
+
}
|
|
1510
|
+
merged[prefix] = {
|
|
1511
|
+
staticPrefix: laterNode.staticPrefix,
|
|
1512
|
+
fullPrefix: laterNode.fullPrefix,
|
|
1513
|
+
...laterNode.namePrefix === void 0 ? {} : { namePrefix: laterNode.namePrefix },
|
|
1514
|
+
children: mergePrefixTrees(earlierNode.children, laterNode.children),
|
|
1515
|
+
routes: [.../* @__PURE__ */ new Set([...earlierNode.routes, ...laterNode.routes])]
|
|
1516
|
+
};
|
|
1517
|
+
}
|
|
1518
|
+
return merged;
|
|
1519
|
+
}
|
|
1520
|
+
function mergeRouteRecord(earlier, later, overwrittenRoutes, cloneValue) {
|
|
1521
|
+
const merged = {};
|
|
1522
|
+
for (const [name, value] of Object.entries(earlier ?? {})) {
|
|
1523
|
+
if (!overwrittenRoutes.has(name)) merged[name] = cloneValue(value);
|
|
1524
|
+
}
|
|
1525
|
+
for (const [name, value] of Object.entries(later ?? {})) {
|
|
1526
|
+
merged[name] = cloneValue(value);
|
|
1527
|
+
}
|
|
1528
|
+
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
1529
|
+
}
|
|
1530
|
+
function mergeRouteList(earlier, later, overwrittenRoutes) {
|
|
1531
|
+
const merged = [
|
|
1532
|
+
...(earlier ?? []).filter((name) => !overwrittenRoutes.has(name)),
|
|
1533
|
+
...later ?? []
|
|
1534
|
+
];
|
|
1535
|
+
const unique = [...new Set(merged)];
|
|
1536
|
+
return unique.length > 0 ? unique : void 0;
|
|
1537
|
+
}
|
|
1538
|
+
function mergeFullManifests(manifests) {
|
|
1539
|
+
let merged = {
|
|
1540
|
+
prefixTree: {},
|
|
1541
|
+
routeManifest: {}
|
|
1542
|
+
};
|
|
1543
|
+
for (const manifest of manifests) {
|
|
1544
|
+
const overwrittenRoutes = new Set(Object.keys(manifest.routeManifest));
|
|
1545
|
+
const prefixTreeWithoutOverwrites = removeRoutesFromPrefixTree(
|
|
1546
|
+
merged.prefixTree,
|
|
1547
|
+
overwrittenRoutes
|
|
1548
|
+
);
|
|
1549
|
+
merged = {
|
|
1550
|
+
prefixTree: mergePrefixTrees(
|
|
1551
|
+
prefixTreeWithoutOverwrites,
|
|
1552
|
+
manifest.prefixTree
|
|
1553
|
+
),
|
|
1554
|
+
routeManifest: {
|
|
1555
|
+
...merged.routeManifest,
|
|
1556
|
+
...manifest.routeManifest
|
|
1557
|
+
},
|
|
1558
|
+
routeTrailingSlash: mergeRouteRecord(
|
|
1559
|
+
merged.routeTrailingSlash,
|
|
1560
|
+
manifest.routeTrailingSlash,
|
|
1561
|
+
overwrittenRoutes,
|
|
1562
|
+
(value) => value
|
|
1563
|
+
),
|
|
1564
|
+
prerenderRoutes: mergeRouteList(
|
|
1565
|
+
merged.prerenderRoutes,
|
|
1566
|
+
manifest.prerenderRoutes,
|
|
1567
|
+
overwrittenRoutes
|
|
1568
|
+
),
|
|
1569
|
+
passthroughRoutes: mergeRouteList(
|
|
1570
|
+
merged.passthroughRoutes,
|
|
1571
|
+
manifest.passthroughRoutes,
|
|
1572
|
+
overwrittenRoutes
|
|
1573
|
+
),
|
|
1574
|
+
responseTypeRoutes: mergeRouteRecord(
|
|
1575
|
+
merged.responseTypeRoutes,
|
|
1576
|
+
manifest.responseTypeRoutes,
|
|
1577
|
+
overwrittenRoutes,
|
|
1578
|
+
(value) => value
|
|
1579
|
+
),
|
|
1580
|
+
routeSearchSchemas: mergeRouteRecord(
|
|
1581
|
+
merged.routeSearchSchemas,
|
|
1582
|
+
manifest.routeSearchSchemas,
|
|
1583
|
+
overwrittenRoutes,
|
|
1584
|
+
(value) => ({ ...value })
|
|
1585
|
+
),
|
|
1586
|
+
_prerenderDefs: mergeRouteRecord(
|
|
1587
|
+
merged._prerenderDefs,
|
|
1588
|
+
manifest._prerenderDefs,
|
|
1589
|
+
overwrittenRoutes,
|
|
1590
|
+
(value) => value
|
|
1591
|
+
)
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1594
|
+
return merged;
|
|
1595
|
+
}
|
|
1596
|
+
var init_merge_full_manifests = __esm({
|
|
1597
|
+
"src/build/merge-full-manifests.ts"() {
|
|
1598
|
+
"use strict";
|
|
1599
|
+
}
|
|
1600
|
+
});
|
|
1601
|
+
|
|
903
1602
|
// src/vite/plugins/virtual-entries.ts
|
|
904
1603
|
function getVirtualVersionContent(version) {
|
|
905
1604
|
return `export const VERSION = ${JSON.stringify(version)};`;
|
|
906
1605
|
}
|
|
907
|
-
var VIRTUAL_ENTRY_BROWSER,
|
|
1606
|
+
var VIRTUAL_ENTRY_BROWSER, VIRTUAL_IDS;
|
|
908
1607
|
var init_virtual_entries = __esm({
|
|
909
1608
|
"src/vite/plugins/virtual-entries.ts"() {
|
|
910
1609
|
"use strict";
|
|
@@ -919,7 +1618,7 @@ import {
|
|
|
919
1618
|
import { createElement, StrictMode } from "react";
|
|
920
1619
|
import { hydrateRoot } from "react-dom/client";
|
|
921
1620
|
import { rscStream } from "@rangojs/router/internal/deps/html-stream-client";
|
|
922
|
-
import { initBrowserApp,
|
|
1621
|
+
import { initBrowserApp, Rango } from "@rangojs/router/browser";
|
|
923
1622
|
|
|
924
1623
|
async function initializeApp() {
|
|
925
1624
|
const deps = {
|
|
@@ -930,29 +1629,30 @@ async function initializeApp() {
|
|
|
930
1629
|
createTemporaryReferenceSet,
|
|
931
1630
|
};
|
|
932
1631
|
|
|
933
|
-
|
|
1632
|
+
// initBrowserApp resolves the initial payload and returns the browser app
|
|
1633
|
+
// context, including strictMode (default true) from createRouter. StrictMode
|
|
1634
|
+
// is the default; createRouter({ strictMode: false }) ships the opt-out in the
|
|
1635
|
+
// payload metadata. StrictMode emits no DOM, so toggling never changes markup.
|
|
1636
|
+
const { strictMode, initialPayload } = await initBrowserApp({ rscStream, deps });
|
|
1637
|
+
|
|
1638
|
+
if (import.meta.hot) {
|
|
1639
|
+
const { startDevDiscoveryHandshake } = await import(
|
|
1640
|
+
"@rangojs/router/internal/browser/dev-discovery"
|
|
1641
|
+
);
|
|
1642
|
+
startDevDiscoveryHandshake(
|
|
1643
|
+
initialPayload.metadata?.devDiscoveryEpoch,
|
|
1644
|
+
import.meta.hot
|
|
1645
|
+
);
|
|
1646
|
+
}
|
|
934
1647
|
|
|
1648
|
+
const app = createElement(Rango);
|
|
935
1649
|
hydrateRoot(
|
|
936
1650
|
document,
|
|
937
|
-
createElement(StrictMode, null,
|
|
1651
|
+
strictMode === false ? app : createElement(StrictMode, null, app)
|
|
938
1652
|
);
|
|
939
1653
|
}
|
|
940
1654
|
|
|
941
1655
|
initializeApp().catch(console.error);
|
|
942
|
-
`.trim();
|
|
943
|
-
VIRTUAL_ENTRY_SSR = `
|
|
944
|
-
import { createFromReadableStream } from "@rangojs/router/internal/deps/ssr";
|
|
945
|
-
import { renderToReadableStream } from "react-dom/server.edge";
|
|
946
|
-
import { injectRSCPayload } from "@rangojs/router/internal/deps/html-stream-server";
|
|
947
|
-
import { createSSRHandler } from "@rangojs/router/ssr";
|
|
948
|
-
|
|
949
|
-
export const renderHTML = createSSRHandler({
|
|
950
|
-
createFromReadableStream,
|
|
951
|
-
renderToReadableStream,
|
|
952
|
-
injectRSCPayload,
|
|
953
|
-
loadBootstrapScriptContent: () =>
|
|
954
|
-
import.meta.viteRsc.loadBootstrapScriptContent("index"),
|
|
955
|
-
});
|
|
956
1656
|
`.trim();
|
|
957
1657
|
VIRTUAL_IDS = {
|
|
958
1658
|
browser: "virtual:rsc-router/entry.browser.js",
|
|
@@ -963,12 +1663,37 @@ export const renderHTML = createSSRHandler({
|
|
|
963
1663
|
}
|
|
964
1664
|
});
|
|
965
1665
|
|
|
1666
|
+
// src/vite/utils/directive-prologue.ts
|
|
1667
|
+
import { parseAst } from "vite";
|
|
1668
|
+
function hasUseClientDirective(source) {
|
|
1669
|
+
let program;
|
|
1670
|
+
try {
|
|
1671
|
+
program = parseAst(source, { lang: "tsx" });
|
|
1672
|
+
} catch {
|
|
1673
|
+
return false;
|
|
1674
|
+
}
|
|
1675
|
+
for (const node of program.body ?? []) {
|
|
1676
|
+
if (node?.type === "ExpressionStatement" && node.expression?.type === "Literal" && typeof node.expression.value === "string") {
|
|
1677
|
+
if (node.expression.value === "use client") return true;
|
|
1678
|
+
continue;
|
|
1679
|
+
}
|
|
1680
|
+
break;
|
|
1681
|
+
}
|
|
1682
|
+
return false;
|
|
1683
|
+
}
|
|
1684
|
+
var init_directive_prologue = __esm({
|
|
1685
|
+
"src/vite/utils/directive-prologue.ts"() {
|
|
1686
|
+
"use strict";
|
|
1687
|
+
}
|
|
1688
|
+
});
|
|
1689
|
+
|
|
966
1690
|
// src/vite/plugins/version-plugin.ts
|
|
967
1691
|
var version_plugin_exports = {};
|
|
968
1692
|
__export(version_plugin_exports, {
|
|
969
|
-
createVersionPlugin: () => createVersionPlugin
|
|
1693
|
+
createVersionPlugin: () => createVersionPlugin,
|
|
1694
|
+
isViteDepCachePath: () => isViteDepCachePath
|
|
970
1695
|
});
|
|
971
|
-
import { parseAst } from "vite";
|
|
1696
|
+
import { parseAst as parseAst2 } from "vite";
|
|
972
1697
|
function isCodeModule(id) {
|
|
973
1698
|
return /\.(tsx?|jsx?)($|\?)/.test(id);
|
|
974
1699
|
}
|
|
@@ -976,23 +1701,13 @@ function normalizeModuleId(id) {
|
|
|
976
1701
|
return id.split("?", 1)[0];
|
|
977
1702
|
}
|
|
978
1703
|
function getClientModuleSignature(source) {
|
|
1704
|
+
if (!hasUseClientDirective(source)) return void 0;
|
|
979
1705
|
let program;
|
|
980
1706
|
try {
|
|
981
|
-
program =
|
|
1707
|
+
program = parseAst2(source, { lang: "tsx" });
|
|
982
1708
|
} catch {
|
|
983
1709
|
return void 0;
|
|
984
1710
|
}
|
|
985
|
-
let isUseClient = false;
|
|
986
|
-
for (const node of program.body ?? []) {
|
|
987
|
-
if (node?.type === "ExpressionStatement" && node.expression?.type === "Literal" && typeof node.expression.value === "string") {
|
|
988
|
-
if (node.expression.value === "use client") {
|
|
989
|
-
isUseClient = true;
|
|
990
|
-
}
|
|
991
|
-
continue;
|
|
992
|
-
}
|
|
993
|
-
break;
|
|
994
|
-
}
|
|
995
|
-
if (!isUseClient) return void 0;
|
|
996
1711
|
const exports = /* @__PURE__ */ new Set();
|
|
997
1712
|
let hasDefault = false;
|
|
998
1713
|
let hasExportAll = false;
|
|
@@ -1061,10 +1776,12 @@ function createVersionPlugin() {
|
|
|
1061
1776
|
let currentVersion = buildVersion;
|
|
1062
1777
|
let isDev = false;
|
|
1063
1778
|
let server = null;
|
|
1779
|
+
let resolvedCacheDir;
|
|
1064
1780
|
const clientModuleSignatures = /* @__PURE__ */ new Map();
|
|
1781
|
+
let versionCounter = 0;
|
|
1065
1782
|
const bumpVersion = (reason) => {
|
|
1066
|
-
currentVersion = Date.now().toString(16);
|
|
1067
|
-
console.log(`[
|
|
1783
|
+
currentVersion = Date.now().toString(16) + String(++versionCounter);
|
|
1784
|
+
console.log(`[rango] ${reason}, version updated: ${currentVersion}`);
|
|
1068
1785
|
const rscEnv = server?.environments?.rsc;
|
|
1069
1786
|
const versionMod = rscEnv?.moduleGraph?.getModuleById(
|
|
1070
1787
|
"\0" + VIRTUAL_IDS.version
|
|
@@ -1076,8 +1793,16 @@ function createVersionPlugin() {
|
|
|
1076
1793
|
return {
|
|
1077
1794
|
name: "@rangojs/router:version",
|
|
1078
1795
|
enforce: "pre",
|
|
1796
|
+
// The build-time shell capture phase (producer B, #699) stamps entries
|
|
1797
|
+
// with THIS instance's version — the value folded into the shipped worker
|
|
1798
|
+
// — never the discovery temp server's own version-plugin value (a
|
|
1799
|
+
// different Date.now() stamp that would fail the serve-side gate).
|
|
1800
|
+
api: {
|
|
1801
|
+
getBuildVersion: () => currentVersion
|
|
1802
|
+
},
|
|
1079
1803
|
configResolved(config) {
|
|
1080
1804
|
isDev = config.command === "serve";
|
|
1805
|
+
resolvedCacheDir = config.cacheDir ? String(config.cacheDir).replace(/\\/g, "/") : void 0;
|
|
1081
1806
|
},
|
|
1082
1807
|
configureServer(devServer) {
|
|
1083
1808
|
server = devServer;
|
|
@@ -1114,11 +1839,14 @@ function createVersionPlugin() {
|
|
|
1114
1839
|
}
|
|
1115
1840
|
return null;
|
|
1116
1841
|
},
|
|
1117
|
-
// Track RSC module changes and update version
|
|
1118
1842
|
async hotUpdate(ctx) {
|
|
1119
1843
|
if (!isDev) return;
|
|
1120
1844
|
const isRscModule = this.environment?.name === "rsc";
|
|
1121
1845
|
if (!isRscModule) return;
|
|
1846
|
+
if (isViteDepCachePath(ctx.file, resolvedCacheDir)) return;
|
|
1847
|
+
if (ctx.modules.length === 1 && ctx.modules[0].id === "\0" + VIRTUAL_IDS.version) {
|
|
1848
|
+
return;
|
|
1849
|
+
}
|
|
1122
1850
|
if (isCodeModule(ctx.file)) {
|
|
1123
1851
|
const filePath = normalizeModuleId(ctx.file);
|
|
1124
1852
|
const previousSignature = clientModuleSignatures.get(filePath);
|
|
@@ -1145,10 +1873,22 @@ function createVersionPlugin() {
|
|
|
1145
1873
|
}
|
|
1146
1874
|
};
|
|
1147
1875
|
}
|
|
1876
|
+
function isViteDepCachePath(filePath, cacheDir) {
|
|
1877
|
+
if (!filePath) return false;
|
|
1878
|
+
const normalized = filePath.replace(/\\/g, "/");
|
|
1879
|
+
if (cacheDir) {
|
|
1880
|
+
const normalizedCacheDir = cacheDir.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
1881
|
+
if (normalized === normalizedCacheDir || normalized.startsWith(normalizedCacheDir + "/")) {
|
|
1882
|
+
return true;
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
return /\/node_modules\/\.vite[^/]*\//.test(normalized) || normalized.includes("/.vite-isolated/");
|
|
1886
|
+
}
|
|
1148
1887
|
var init_version_plugin = __esm({
|
|
1149
1888
|
"src/vite/plugins/version-plugin.ts"() {
|
|
1150
1889
|
"use strict";
|
|
1151
1890
|
init_virtual_entries();
|
|
1891
|
+
init_directive_prologue();
|
|
1152
1892
|
}
|
|
1153
1893
|
});
|
|
1154
1894
|
|
|
@@ -1190,7 +1930,7 @@ var runtime_discovery_exports = {};
|
|
|
1190
1930
|
__export(runtime_discovery_exports, {
|
|
1191
1931
|
discoverAndWriteRouteTypes: () => discoverAndWriteRouteTypes
|
|
1192
1932
|
});
|
|
1193
|
-
import {
|
|
1933
|
+
import { resolve as resolve3 } from "node:path";
|
|
1194
1934
|
import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
1195
1935
|
async function discoverAndWriteRouteTypes(opts) {
|
|
1196
1936
|
let createViteServer;
|
|
@@ -1267,17 +2007,28 @@ async function discoverAndWriteRouteTypes(opts) {
|
|
|
1267
2007
|
);
|
|
1268
2008
|
}
|
|
1269
2009
|
const buildMod = await rscEnv.runner.import("@rangojs/router/build");
|
|
1270
|
-
const
|
|
1271
|
-
if (!
|
|
1272
|
-
throw new Error(
|
|
2010
|
+
const generateManifestFull = buildMod.generateManifestFull;
|
|
2011
|
+
if (!generateManifestFull) {
|
|
2012
|
+
throw new Error(
|
|
2013
|
+
"generateManifestFull not found in @rangojs/router/build"
|
|
2014
|
+
);
|
|
1273
2015
|
}
|
|
1274
2016
|
const outputFiles = [];
|
|
1275
2017
|
let totalRouteCount = 0;
|
|
1276
|
-
let
|
|
2018
|
+
let globalMountIndex = 0;
|
|
2019
|
+
let routerCount = 0;
|
|
1277
2020
|
for (const [id, router] of registry) {
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
2021
|
+
const mounts = router.__urlpatternMounts ?? (router.urlpatterns ? [{ patterns: router.urlpatterns }] : []);
|
|
2022
|
+
if (mounts.length === 0) continue;
|
|
2023
|
+
const mountManifests = [];
|
|
2024
|
+
for (const mount of mounts) {
|
|
2025
|
+
mountManifests.push(
|
|
2026
|
+
await generateManifestFull(mount.patterns, globalMountIndex)
|
|
2027
|
+
);
|
|
2028
|
+
globalMountIndex++;
|
|
2029
|
+
}
|
|
2030
|
+
const manifest = mergeFullManifests(mountManifests);
|
|
2031
|
+
routerCount++;
|
|
1281
2032
|
const rawManifest = manifest.routeManifest;
|
|
1282
2033
|
const routeManifest = {};
|
|
1283
2034
|
for (const [name, pattern] of Object.entries(rawManifest)) {
|
|
@@ -1300,22 +2051,12 @@ This means createRouter() stack trace parsing matched an internal frame.
|
|
|
1300
2051
|
Set an explicit \`id\` on createRouter() or check the call site.`
|
|
1301
2052
|
);
|
|
1302
2053
|
}
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
if (schema) filtered[name] = schema;
|
|
1310
|
-
}
|
|
1311
|
-
if (Object.keys(filtered).length > 0) {
|
|
1312
|
-
routeSearchSchemas = filtered;
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
const routerDir = dirname3(sourceFile);
|
|
1317
|
-
const routerBasename = basename(sourceFile).replace(/\.(tsx?|jsx?)$/, "");
|
|
1318
|
-
const outPath = join3(routerDir, `${routerBasename}.named-routes.gen.ts`);
|
|
2054
|
+
routeSearchSchemas = resolveSearchSchemas(
|
|
2055
|
+
Object.keys(routeManifest),
|
|
2056
|
+
routeSearchSchemas,
|
|
2057
|
+
sourceFile
|
|
2058
|
+
);
|
|
2059
|
+
const outPath = genFileTsPath(sourceFile);
|
|
1319
2060
|
const source = generateRouteTypesSource(
|
|
1320
2061
|
routeManifest,
|
|
1321
2062
|
routeSearchSchemas && Object.keys(routeSearchSchemas).length > 0 ? routeSearchSchemas : void 0
|
|
@@ -1332,7 +2073,7 @@ Set an explicit \`id\` on createRouter() or check the call site.`
|
|
|
1332
2073
|
);
|
|
1333
2074
|
}
|
|
1334
2075
|
return {
|
|
1335
|
-
routerCount
|
|
2076
|
+
routerCount,
|
|
1336
2077
|
routeCount: totalRouteCount,
|
|
1337
2078
|
outputFiles
|
|
1338
2079
|
};
|
|
@@ -1346,13 +2087,14 @@ var init_runtime_discovery = __esm({
|
|
|
1346
2087
|
"src/build/runtime-discovery.ts"() {
|
|
1347
2088
|
"use strict";
|
|
1348
2089
|
init_generate_route_types();
|
|
2090
|
+
init_merge_full_manifests();
|
|
1349
2091
|
init_route_name();
|
|
1350
2092
|
}
|
|
1351
2093
|
});
|
|
1352
2094
|
|
|
1353
2095
|
// src/bin/rango.ts
|
|
1354
2096
|
init_generate_route_types();
|
|
1355
|
-
import { resolve as resolve4, dirname as
|
|
2097
|
+
import { resolve as resolve4, dirname as dirname3 } from "node:path";
|
|
1356
2098
|
import { readFileSync as readFileSync5, statSync, existsSync as existsSync5 } from "node:fs";
|
|
1357
2099
|
var [command, ...rawArgs] = process.argv.slice(2);
|
|
1358
2100
|
if (command === "generate") {
|
|
@@ -1423,12 +2165,12 @@ Examples:
|
|
|
1423
2165
|
);
|
|
1424
2166
|
}
|
|
1425
2167
|
function findProjectRoot(fromPath) {
|
|
1426
|
-
let dir =
|
|
1427
|
-
while (dir !==
|
|
2168
|
+
let dir = dirname3(resolve4(fromPath));
|
|
2169
|
+
while (dir !== dirname3(dir)) {
|
|
1428
2170
|
if (existsSync5(resolve4(dir, "package.json")) || existsSync5(resolve4(dir, "vite.config.ts")) || existsSync5(resolve4(dir, "vite.config.js"))) {
|
|
1429
2171
|
return dir;
|
|
1430
2172
|
}
|
|
1431
|
-
dir =
|
|
2173
|
+
dir = dirname3(dir);
|
|
1432
2174
|
}
|
|
1433
2175
|
return process.cwd();
|
|
1434
2176
|
}
|