@rangojs/router 0.1.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/types/browser/prefetch/default-strategy.d.ts +22 -0
- package/dist/types/browser/prefetch/runtime.d.ts +0 -1
- package/dist/types/browser/react/Link.d.ts +8 -11
- package/dist/types/browser/types.d.ts +5 -0
- package/dist/types/cache/document-cache.d.ts +3 -1
- package/dist/types/cache/types.d.ts +10 -3
- package/dist/types/route-definition/helpers-types.d.ts +6 -6
- package/dist/types/router/match-handlers.d.ts +2 -3
- package/dist/types/router/prefetch-default.d.ts +28 -0
- package/dist/types/router/router-interfaces.d.ts +7 -0
- package/dist/types/router/router-options.d.ts +30 -0
- package/dist/types/router/segment-resolution/view-transition-default.d.ts +3 -4
- package/dist/types/router/transition-when.d.ts +13 -0
- package/dist/types/rsc/capture-queue.d.ts +6 -0
- package/dist/types/rsc/shell-capture.d.ts +15 -7
- package/dist/types/rsc/shell-serve.d.ts +6 -3
- package/dist/types/rsc/transition-gate.d.ts +10 -14
- package/dist/types/rsc/types.d.ts +2 -0
- package/dist/types/server/request-context.d.ts +5 -1
- package/dist/types/testing/e2e/index.d.ts +3 -3
- package/dist/types/testing/e2e/page-helpers.d.ts +24 -0
- package/dist/types/testing/index.d.ts +2 -2
- package/dist/types/testing/run-transition-when.d.ts +6 -5
- package/dist/types/testing/shell-status.d.ts +23 -3
- package/dist/types/types/segments.d.ts +27 -22
- package/dist/types/urls/path-helper-types.d.ts +4 -3
- 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 +5 -2
- package/package.json +20 -21
- package/skills/cache-guide/SKILL.md +6 -3
- package/skills/catalog.json +7 -1
- package/skills/comparison/references/framework-comparison.md +2 -1
- package/skills/deployment-caching/SKILL.md +176 -0
- package/skills/document-cache/SKILL.md +30 -3
- package/skills/ppr/SKILL.md +81 -34
- package/skills/prerender/SKILL.md +15 -8
- package/skills/rango/SKILL.md +20 -17
- package/skills/router-setup/SKILL.md +4 -0
- package/skills/testing/SKILL.md +1 -1
- package/skills/testing/cache-prerender.md +5 -1
- package/skills/vercel/SKILL.md +22 -1
- package/skills/view-transitions/SKILL.md +12 -8
- package/src/browser/prefetch/default-strategy.ts +34 -0
- package/src/browser/prefetch/loader.ts +6 -12
- package/src/browser/prefetch/runtime.ts +0 -1
- package/src/browser/react/Link.tsx +22 -21
- package/src/browser/rsc-router.tsx +8 -0
- package/src/browser/types.ts +5 -0
- package/src/cache/cache-scope.ts +6 -1
- package/src/cache/cf/cf-cache-store.ts +4 -0
- package/src/cache/document-cache.ts +4 -2
- package/src/cache/types.ts +10 -3
- package/src/cache/vercel/vercel-cache-store.ts +6 -1
- package/src/route-definition/helpers-types.ts +6 -6
- package/src/router/match-handlers.ts +44 -6
- package/src/router/match-middleware/cache-lookup.ts +10 -3
- package/src/router/prefetch-default.ts +59 -0
- package/src/router/router-interfaces.ts +8 -0
- package/src/router/router-options.ts +31 -0
- package/src/router/segment-resolution/view-transition-default.ts +9 -5
- package/src/router/transition-when.ts +76 -0
- package/src/router.ts +7 -0
- package/src/rsc/capture-queue.ts +24 -1
- package/src/rsc/full-payload.ts +1 -0
- package/src/rsc/handler.ts +1 -0
- package/src/rsc/progressive-enhancement.ts +9 -14
- package/src/rsc/rsc-rendering.ts +261 -48
- package/src/rsc/shell-capture.ts +94 -50
- package/src/rsc/shell-serve.ts +9 -4
- package/src/rsc/transition-gate.ts +37 -40
- package/src/rsc/types.ts +2 -0
- package/src/server/request-context.ts +6 -0
- package/src/testing/e2e/index.ts +11 -0
- package/src/testing/e2e/page-helpers.ts +47 -0
- package/src/testing/e2e/parity.ts +13 -0
- package/src/testing/index.ts +9 -1
- package/src/testing/run-transition-when.ts +42 -9
- package/src/testing/shell-status.ts +92 -3
- package/src/types/segments.ts +27 -22
- package/src/urls/path-helper-types.ts +4 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API for @rangojs/router/vite
|
|
3
|
+
*
|
|
4
|
+
* Exports: rango() plugin factory, poke() dev utility plugin,
|
|
5
|
+
* and related option types. All other utilities are internal implementation
|
|
6
|
+
* details consumed via direct imports within the package.
|
|
7
|
+
*/
|
|
8
|
+
export { rango } from "./rango.js";
|
|
9
|
+
export { poke } from "./plugins/refresh-cmd.js";
|
|
10
|
+
export { directoryClientChunks } from "./utils/client-chunks.js";
|
|
11
|
+
export type { RangoNodeOptions, RangoCloudflareOptions, RangoVercelOptions, VercelPresetOptions, RangoOptions, ClientChunks, ClientChunkMeta, HeadScriptsOption, BuildEnvOption, BuildEnvFactory, BuildEnvFactoryContext, BuildEnvResult, } from "./plugin-types.js";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Connect } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* Bake the resolved INTERNAL_RANGO_DEBUG value into the router's `internal-debug`
|
|
4
|
+
* module so the flag reaches the CLIENT debug logs by just setting the env var.
|
|
5
|
+
*
|
|
6
|
+
* internal-debug.ts normally reads the flag via `typeof __RANGO_DEBUG__`, a Vite
|
|
7
|
+
* define. That delivery is unreliable on the client: in dev Vite ships the define
|
|
8
|
+
* only as an injected global whose presence varies across consumer setups, so the
|
|
9
|
+
* module can fall through to `process.env` (undefined in the browser) and the FE
|
|
10
|
+
* debug flag silently stays false while the server logs work. A Vite `transform`
|
|
11
|
+
* runs on the module regardless of how (or whether) the define is delivered, in
|
|
12
|
+
* both dev and build and for every environment, so the discovery plugin uses this
|
|
13
|
+
* to replace the module with the resolved literal.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Scope to the router's own internal-debug module: the published package
|
|
17
|
+
* (`/@rangojs/router/`, incl. pnpm's nested layout) or the monorepo workspace
|
|
18
|
+
* (`/packages/rangojs-router/`). The package-anchored path avoids matching a
|
|
19
|
+
* consumer file that merely sits under a directory named `rangojs-router`.
|
|
20
|
+
* Accepts module ids and dev-server URLs (`/@fs/...internal-debug.ts?v=abc`).
|
|
21
|
+
*/
|
|
22
|
+
export declare function isRouterInternalDebugId(id: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Transform: replace the module with the resolved literal.
|
|
25
|
+
* Returns null for any module that is not the router's internal-debug module.
|
|
26
|
+
*/
|
|
27
|
+
export declare function injectClientDebugFlag(id: string): {
|
|
28
|
+
code: string;
|
|
29
|
+
map: null;
|
|
30
|
+
} | null;
|
|
31
|
+
/**
|
|
32
|
+
* Dev middleware companion: serve the internal-debug module `no-cache` so the
|
|
33
|
+
* browser revalidates it (etag) instead of trusting an immutable cache entry.
|
|
34
|
+
*
|
|
35
|
+
* Why: the transform bakes the flag into module CONTENT, but a published
|
|
36
|
+
* consumer resolves the module into node_modules, where dev serves it as
|
|
37
|
+
* `internal-debug.ts?v=<hash>` with `Cache-Control: max-age=31536000,immutable`.
|
|
38
|
+
* That `?v=` hash does not vary with env vars (verified on Vite 8: getConfigHash
|
|
39
|
+
* hashes NODE_ENV, resolve, plugin names, optimizeDeps -- not arbitrary env
|
|
40
|
+
* state), so toggling the flag changed the content under an unchanged immutable
|
|
41
|
+
* URL: a browser that ever loaded the app with the flag off kept the
|
|
42
|
+
* baked-`false` module across dev-server restarts, and INTERNAL_RANGO_DEBUG
|
|
43
|
+
* never reached the FE logs while the server logs worked. The monorepo was
|
|
44
|
+
* immune -- workspace source is outside node_modules and served no-cache --
|
|
45
|
+
* which is why this bit only npm consumers.
|
|
46
|
+
*
|
|
47
|
+
* internal-debug.ts is the ONLY flag-varying module in the graph (its importers
|
|
48
|
+
* are byte-identical across flag states), so forcing revalidation for this one
|
|
49
|
+
* tiny module is sufficient and costs one conditional request per session. The
|
|
50
|
+
* middleware is unconditional (not gated on the flag) so an already-poisoned
|
|
51
|
+
* cache heals in both directions. Alternatives that do not work: a plugin
|
|
52
|
+
* `resolveId` appending a flag query never fires in Vite 8 dev for
|
|
53
|
+
* fs-resolvable relative imports, and the pre-#621 `define` no longer rotates
|
|
54
|
+
* the optimizer hash (define contents are not part of getConfigHash).
|
|
55
|
+
*/
|
|
56
|
+
export declare function internalDebugNoCacheMiddleware(): Connect.NextHandleFunction;
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context passed to a buildEnv factory function.
|
|
3
|
+
* Provides Vite config details for conditional env setup.
|
|
4
|
+
*/
|
|
5
|
+
export interface BuildEnvFactoryContext {
|
|
6
|
+
/** Vite project root directory. */
|
|
7
|
+
root: string;
|
|
8
|
+
/** Vite mode (e.g. "development", "production"). */
|
|
9
|
+
mode: string;
|
|
10
|
+
/** Vite command ("serve" for dev, "build" for production). */
|
|
11
|
+
command: "serve" | "build";
|
|
12
|
+
/** Router deployment preset. */
|
|
13
|
+
preset: "node" | "cloudflare" | "vercel";
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Factory function that creates build-time environment bindings.
|
|
17
|
+
* Called once at plugin startup. Return `dispose` to clean up resources.
|
|
18
|
+
*/
|
|
19
|
+
export type BuildEnvFactory = (ctx: BuildEnvFactoryContext) => Promise<BuildEnvResult> | BuildEnvResult;
|
|
20
|
+
/**
|
|
21
|
+
* Result of resolving build-time environment bindings.
|
|
22
|
+
*/
|
|
23
|
+
export interface BuildEnvResult {
|
|
24
|
+
/** Environment bindings available to Prerender/Static handlers via ctx.env. */
|
|
25
|
+
env: Record<string, unknown>;
|
|
26
|
+
/** Called after build completes to clean up resources (e.g., miniflare). */
|
|
27
|
+
dispose?: () => Promise<void> | void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Build-time environment configuration for Prerender and Static handlers.
|
|
31
|
+
*
|
|
32
|
+
* - `false` (default): no build-time env, `ctx.env` throws.
|
|
33
|
+
* - `"auto"`: calls `wrangler.getPlatformProxy()` (cloudflare preset only).
|
|
34
|
+
* - Object: used directly as `ctx.env` during build.
|
|
35
|
+
* - Factory: called once at startup, must return `{ env, dispose? }`.
|
|
36
|
+
*/
|
|
37
|
+
export type BuildEnvOption = false | "auto" | Record<string, unknown> | BuildEnvFactory;
|
|
38
|
+
/**
|
|
39
|
+
* Metadata for one client ("use client") module, passed to a {@link ClientChunks}
|
|
40
|
+
* function. Mirrors the shape `@vitejs/plugin-rsc` passes to its own
|
|
41
|
+
* `clientChunks` option.
|
|
42
|
+
*/
|
|
43
|
+
export interface ClientChunkMeta {
|
|
44
|
+
/** Absolute module id of the "use client" file. */
|
|
45
|
+
id: string;
|
|
46
|
+
/** Normalized (posix) module id — convenient for path-based matching. */
|
|
47
|
+
normalizedId: string;
|
|
48
|
+
/**
|
|
49
|
+
* The RSC/server chunk that statically imports this client reference. This is
|
|
50
|
+
* the key used for the default grouping when no override is supplied: a single
|
|
51
|
+
* router that statically imports every route yields ONE `serverChunk`, hence
|
|
52
|
+
* one client chunk for all routes.
|
|
53
|
+
*/
|
|
54
|
+
serverChunk: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Controls how client ("use client") components are grouped into browser
|
|
58
|
+
* chunks, i.e. per-route / per-feature code splitting of the client bundle.
|
|
59
|
+
*
|
|
60
|
+
* Without splitting, a single router ships ONE client chunk containing every
|
|
61
|
+
* route's client components (and their CSS) — navigating to one route downloads
|
|
62
|
+
* every other route's client code. (Host sub-apps loaded via a dynamic `import()`
|
|
63
|
+
* are the exception: each forms its own chunk.) This option controls how that
|
|
64
|
+
* monolith is split.
|
|
65
|
+
*
|
|
66
|
+
* Behavior branches:
|
|
67
|
+
* - `true` / omitted (**default**, pre-1.0): Rango's built-in **directory
|
|
68
|
+
* strategy**. It splits app `"use client"` modules by **route id** — the segment
|
|
69
|
+
* after a route-root directory (`routes`, `app`, `pages`, `features`, `handlers`,
|
|
70
|
+
* …) — so `routes/dashboard/**` becomes `app-dashboard` at any nesting depth.
|
|
71
|
+
* Where it finds NO route structure (a flat `src/components/`, or host sub-apps
|
|
72
|
+
* already split by a dynamic `import()`), it inherits the default grouping
|
|
73
|
+
* unchanged — so the shared `src/components` chunk stays shared and host apps do
|
|
74
|
+
* not leak across each other. Shared runtime (React, the router, `node_modules`)
|
|
75
|
+
* is never split.
|
|
76
|
+
* - `false`: opt out — inherit `@vitejs/plugin-rsc`'s default grouping everywhere
|
|
77
|
+
* (one chunk per router / per host sub-app).
|
|
78
|
+
* - function: full override. Return a chunk group name, or `undefined` to fall
|
|
79
|
+
* back to the default grouping for that one module. Forwarded directly to
|
|
80
|
+
* `@vitejs/plugin-rsc`'s `clientChunks`.
|
|
81
|
+
*
|
|
82
|
+
* Every module maps to exactly one group, so there is no byte duplication: a
|
|
83
|
+
* component used by two routes lives in one group and is fetched whenever it
|
|
84
|
+
* renders. Put genuinely shared client components OUTSIDE route directories so
|
|
85
|
+
* they land in the shared group rather than one route's chunk.
|
|
86
|
+
*
|
|
87
|
+
* @default true
|
|
88
|
+
*/
|
|
89
|
+
export type ClientChunks = boolean | ((meta: ClientChunkMeta) => string | undefined);
|
|
90
|
+
/**
|
|
91
|
+
* Document script strategy. See {@link RangoBaseOptions.headScripts}.
|
|
92
|
+
*/
|
|
93
|
+
export type HeadScriptsOption = "preinit" | "preload";
|
|
94
|
+
/**
|
|
95
|
+
* Base options shared by all presets
|
|
96
|
+
*/
|
|
97
|
+
interface RangoBaseOptions {
|
|
98
|
+
/**
|
|
99
|
+
* Show startup banner. Set to false to disable.
|
|
100
|
+
* @default true
|
|
101
|
+
*/
|
|
102
|
+
banner?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Group client ("use client") components into browser chunks for per-route /
|
|
105
|
+
* per-feature code splitting. On by default (pre-1.0); pass `false` to opt out.
|
|
106
|
+
* See {@link ClientChunks}.
|
|
107
|
+
*
|
|
108
|
+
* @default true
|
|
109
|
+
*/
|
|
110
|
+
clientChunks?: ClientChunks;
|
|
111
|
+
/**
|
|
112
|
+
* How the document ships its JavaScript.
|
|
113
|
+
*
|
|
114
|
+
* - `"preinit"` (**default**): client-reference chunks render as EXECUTING
|
|
115
|
+
* `<script type="module" async>` tags hoisted into `<head>` (upgrading
|
|
116
|
+
* plugin-rsc's modulepreload hints in place), and the browser entry ships
|
|
117
|
+
* as Fizz `bootstrapModules` — a head `modulepreload fetchpriority=low`
|
|
118
|
+
* hint plus the executing end-of-shell `id="_R_"` module script. Chunk
|
|
119
|
+
* execution overlaps body streaming instead of waiting for the hydration
|
|
120
|
+
* import walk; under PPR everything lands in the stored shell prelude.
|
|
121
|
+
* - `"preload"`: the previous behavior — `<link rel="modulepreload">` hints
|
|
122
|
+
* only, entry as an inline `import()` script at end of shell. Chunks
|
|
123
|
+
* fetch+compile early but execute only when hydration imports them.
|
|
124
|
+
*
|
|
125
|
+
* Build-only for the chunk half: plugin-rsc resolves no JS deps per client
|
|
126
|
+
* reference in dev, so dev documents carry no head chunk scripts in either
|
|
127
|
+
* mode (the bootstrap conversion does apply in dev). Trades and upstream
|
|
128
|
+
* limits are documented in src/ssr/preinit-client-references.ts.
|
|
129
|
+
*
|
|
130
|
+
* Wired in the generated virtual SSR entry
|
|
131
|
+
* (`src/ssr/preinit-client-references.ts` has the mechanism); apps with a
|
|
132
|
+
* custom SSR entry choose per-handler via `SSRDependencies.headScripts` and
|
|
133
|
+
* `installClientReferencePreinit`.
|
|
134
|
+
*
|
|
135
|
+
* @default "preinit"
|
|
136
|
+
*/
|
|
137
|
+
headScripts?: HeadScriptsOption;
|
|
138
|
+
/**
|
|
139
|
+
* Filter which files route discovery scans, by glob. Paths are matched
|
|
140
|
+
* root-relative (e.g. `src/routes/**`). `include` restricts discovery to
|
|
141
|
+
* matching files; `exclude` removes matches (the defaults cover tests, dist,
|
|
142
|
+
* coverage, etc.). Mirrors the CLI's `--include`/`--exclude`.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* rango({ discovery: { include: ["src/routes/**"] } })
|
|
146
|
+
*/
|
|
147
|
+
discovery?: {
|
|
148
|
+
include?: string[];
|
|
149
|
+
exclude?: string[];
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* What to do when a `Prerender` route's or `Static` handler's render throws at
|
|
153
|
+
* build time. Otherwise the route error boundary catches it and the rendered
|
|
154
|
+
* error page is baked as the artifact, then served as an HTTP 200 — a silent,
|
|
155
|
+
* user-visible breakage (issue #587). Independent of this setting, a render may
|
|
156
|
+
* `throw new Skip()` (from `@rangojs/router`) to skip a single URL/handler.
|
|
157
|
+
*
|
|
158
|
+
* - `"fail"` (**default**): fail the build, naming the URL/handler and the
|
|
159
|
+
* original render error.
|
|
160
|
+
* - `"warn"`: log a warning and skip baking the artifact — it is never served as a
|
|
161
|
+
* baked 200 error page. `"warn"` is a build-unblock, NOT a runtime contract for
|
|
162
|
+
* the skipped entry: the route falls through to normal resolution, which may
|
|
163
|
+
* render live (its handler is still bundled — e.g. when nothing else baked) or
|
|
164
|
+
* 404 (once prerender handler eviction has run for other baked entries), so the
|
|
165
|
+
* outcome depends on the rest of the build, and a skipped `Static()` handler's
|
|
166
|
+
* evicted code can surface as an error. For DEFINED runtime behavior use
|
|
167
|
+
* `Passthrough()` (a live fallback) or `throw new Skip()` (an intentional skip);
|
|
168
|
+
* otherwise prefer the default `"fail"`.
|
|
169
|
+
*
|
|
170
|
+
* @default "fail"
|
|
171
|
+
*/
|
|
172
|
+
prerender?: {
|
|
173
|
+
onError?: "fail" | "warn";
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Options for Node.js deployment (default)
|
|
178
|
+
*/
|
|
179
|
+
export interface RangoNodeOptions extends RangoBaseOptions {
|
|
180
|
+
/**
|
|
181
|
+
* Deployment preset. Defaults to 'node' when not specified.
|
|
182
|
+
*/
|
|
183
|
+
preset?: "node";
|
|
184
|
+
/**
|
|
185
|
+
* Path to a host-router entry (a module that calls `createHostRouter()` and
|
|
186
|
+
* exports the instance) to serve instead of a single `createRouter()` app.
|
|
187
|
+
* Root-relative (e.g. `"./src/worker.rsc.tsx"`).
|
|
188
|
+
*
|
|
189
|
+
* Set this when the app is a multi-app host router: auto-discovery otherwise
|
|
190
|
+
* finds the sub-apps' multiple `createRouter()` files and cannot pick an entry.
|
|
191
|
+
* When omitted, rango auto-detects a single `createHostRouter()` file if the
|
|
192
|
+
* app has several `createRouter()` files. The host module must export the
|
|
193
|
+
* `HostRouter` instance (default export or a named `hostRouter`/`router`
|
|
194
|
+
* export), not a Cloudflare-style `{ fetch }` object.
|
|
195
|
+
*/
|
|
196
|
+
hostRouter?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Environment bindings available to Prerender and Static handlers at build
|
|
199
|
+
* time via `ctx.env`. Shared across all prerender invocations for the build.
|
|
200
|
+
*
|
|
201
|
+
* `"auto"` is Cloudflare-only (it resolves the wrangler platform proxy), so it
|
|
202
|
+
* is not accepted on the Node preset — pass an object or a factory instead.
|
|
203
|
+
*
|
|
204
|
+
* @default false
|
|
205
|
+
*/
|
|
206
|
+
buildEnv?: Exclude<BuildEnvOption, "auto">;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Options for Cloudflare Workers deployment
|
|
210
|
+
*/
|
|
211
|
+
export interface RangoCloudflareOptions extends RangoBaseOptions {
|
|
212
|
+
/**
|
|
213
|
+
* Deployment preset for Cloudflare Workers.
|
|
214
|
+
* When using cloudflare preset:
|
|
215
|
+
* - @vitejs/plugin-rsc IS still added by rango(), but with `serverHandler: false`
|
|
216
|
+
* (the cloudflare plugin owns the RSC worker/server entry); only `client` and
|
|
217
|
+
* `ssr` virtual entries are configured, no rsc entry
|
|
218
|
+
* - Your worker entry (e.g., worker.rsc.tsx) imports the router directly
|
|
219
|
+
* - Browser and SSR use virtual entries
|
|
220
|
+
* - Build-time manifest generation is auto-detected from the resolved RSC environment config
|
|
221
|
+
*/
|
|
222
|
+
preset: "cloudflare";
|
|
223
|
+
/**
|
|
224
|
+
* Environment bindings available to Prerender and Static handlers at build
|
|
225
|
+
* time via `ctx.env`. Shared across all prerender invocations for the build.
|
|
226
|
+
*
|
|
227
|
+
* `"auto"` resolves the Cloudflare platform proxy via wrangler
|
|
228
|
+
* `getPlatformProxy()`.
|
|
229
|
+
*
|
|
230
|
+
* @default false
|
|
231
|
+
*/
|
|
232
|
+
buildEnv?: BuildEnvOption;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Per-function knobs for the Vercel deployment, written into the generated
|
|
236
|
+
* `.vc-config.json` (and `config.json` for `functionName`).
|
|
237
|
+
*/
|
|
238
|
+
export interface VercelPresetOptions {
|
|
239
|
+
/** Node runtime for the function. @default "nodejs22.x" */
|
|
240
|
+
runtime?: string;
|
|
241
|
+
/** Max execution time in seconds. @default 30 */
|
|
242
|
+
maxDuration?: number;
|
|
243
|
+
/** Function memory in MB (platform default when omitted). */
|
|
244
|
+
memory?: number;
|
|
245
|
+
/** Regions to pin the function to (platform default when omitted). */
|
|
246
|
+
regions?: string[];
|
|
247
|
+
/**
|
|
248
|
+
* Function name — the `<name>.func` directory and the `config.json` route
|
|
249
|
+
* destination. @default "index"
|
|
250
|
+
*/
|
|
251
|
+
functionName?: string;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Options for Vercel Functions deployment.
|
|
255
|
+
*
|
|
256
|
+
* Builds like the node preset (Vercel runs Node Functions, not Workers): rango
|
|
257
|
+
* owns the RSC entry, `process.env.NODE_ENV` is folded for the build, and after
|
|
258
|
+
* the build a `.vercel/output` directory (Build Output API v3) is assembled from
|
|
259
|
+
* `dist/` — a single streaming Node Function plus the static client assets. The
|
|
260
|
+
* app must install `@vercel/functions` (used by `VercelCacheStore` and the
|
|
261
|
+
* generated function launcher).
|
|
262
|
+
*/
|
|
263
|
+
export interface RangoVercelOptions extends RangoBaseOptions {
|
|
264
|
+
/**
|
|
265
|
+
* Deployment preset for Vercel Functions.
|
|
266
|
+
*/
|
|
267
|
+
preset: "vercel";
|
|
268
|
+
/**
|
|
269
|
+
* Path to a host-router entry (a module that calls `createHostRouter()` and
|
|
270
|
+
* exports the instance) to serve instead of a single `createRouter()` app.
|
|
271
|
+
* Root-relative (e.g. `"./src/worker.rsc.tsx"`).
|
|
272
|
+
*
|
|
273
|
+
* Set this when the app is a multi-app host router: auto-discovery otherwise
|
|
274
|
+
* finds the sub-apps' multiple `createRouter()` files and cannot pick an entry.
|
|
275
|
+
* When omitted, rango auto-detects a single `createHostRouter()` file if the
|
|
276
|
+
* app has several `createRouter()` files. The host module must export the
|
|
277
|
+
* `HostRouter` instance (default export or a named `hostRouter`/`router`
|
|
278
|
+
* export), not a Cloudflare-style `{ fetch }` object. The Vercel function then
|
|
279
|
+
* runs `hostRouter.match()` for every request (single-function deploy).
|
|
280
|
+
*/
|
|
281
|
+
hostRouter?: string;
|
|
282
|
+
/**
|
|
283
|
+
* Environment bindings available to Prerender and Static handlers at build
|
|
284
|
+
* time via `ctx.env`. `"auto"` is Cloudflare-only; pass an object or a factory.
|
|
285
|
+
*
|
|
286
|
+
* @default false
|
|
287
|
+
*/
|
|
288
|
+
buildEnv?: Exclude<BuildEnvOption, "auto">;
|
|
289
|
+
/**
|
|
290
|
+
* Vercel function configuration written into the Build Output.
|
|
291
|
+
*/
|
|
292
|
+
vercel?: VercelPresetOptions;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Options for rango() Vite plugin
|
|
296
|
+
*/
|
|
297
|
+
export type RangoOptions = RangoNodeOptions | RangoCloudflareOptions | RangoVercelOptions;
|
|
298
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* Transform CJS vendor files from @vitejs/plugin-rsc to ESM for browser compatibility.
|
|
4
|
+
* The react-server-dom vendor files are shipped as CJS which doesn't work in browsers.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createCjsToEsmPlugin(): Plugin;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* Extract the bare package name from an absolute node_modules path.
|
|
4
|
+
* Handles scoped packages (@org/name) and nested node_modules.
|
|
5
|
+
* Returns null if the path doesn't contain a valid package reference.
|
|
6
|
+
*
|
|
7
|
+
* NOTE: This is a lossy transformation. It maps a specific submodule path
|
|
8
|
+
* (e.g., pkg/internal/context.js) to the package root (pkg). The load()
|
|
9
|
+
* hook then re-exports via the bare specifier, which resolves to the
|
|
10
|
+
* package entry point. This works for packages that barrel-export their
|
|
11
|
+
* "use client" symbols from the root, which covers the common case
|
|
12
|
+
* (component libraries like @mantine/core, @chakra-ui/react, etc.).
|
|
13
|
+
* Packages whose client symbols are only available from deep subpaths
|
|
14
|
+
* (not re-exported from the root) would lose those symbols after the
|
|
15
|
+
* rewrite. A more precise approach would resolve through the package's
|
|
16
|
+
* exports map to find the correct entry point, but that adds significant
|
|
17
|
+
* complexity for a rare edge case.
|
|
18
|
+
* See: https://github.com/cloudflare/vinext/pull/413
|
|
19
|
+
*/
|
|
20
|
+
export declare function extractPackageName(absolutePath: string): string | null;
|
|
21
|
+
/**
|
|
22
|
+
* Vite plugin that deduplicates client references from third-party packages
|
|
23
|
+
* in dev mode.
|
|
24
|
+
*
|
|
25
|
+
* When @vitejs/plugin-rsc encounters a "use client" submodule inside a
|
|
26
|
+
* package imported from a server component, it creates a
|
|
27
|
+
* client-in-server-package-proxy virtual module that re-exports from the
|
|
28
|
+
* absolute file path. In the client environment, this absolute path bypasses
|
|
29
|
+
* Vite's pre-bundling, while direct client imports of the same package go
|
|
30
|
+
* through .vite/deps/. Two separate module instances are created, breaking
|
|
31
|
+
* React contexts (createContext runs twice, provider/consumer mismatch).
|
|
32
|
+
*
|
|
33
|
+
* This plugin intercepts absolute node_modules imports from proxy modules
|
|
34
|
+
* in the client environment and rewrites them to bare specifier imports
|
|
35
|
+
* that go through pre-bundling, ensuring a single module instance.
|
|
36
|
+
*
|
|
37
|
+
* Dev-only: production builds use the SSR manifest which handles module
|
|
38
|
+
* identity correctly.
|
|
39
|
+
*/
|
|
40
|
+
export declare function clientRefDedup(): Plugin;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* Compute the production SHA-256 hash for a dev-mode client reference key.
|
|
4
|
+
* Mirrors the hashing logic in @vitejs/plugin-rsc's build mode:
|
|
5
|
+
* - Local files: hashString(toRelativeId(id)) where toRelativeId = relative(root, id)
|
|
6
|
+
* - Package proxies: hashString(packageSource)
|
|
7
|
+
* - client-in-server-package proxies: hashString(relative(root, decodedAbsPath))
|
|
8
|
+
*
|
|
9
|
+
* Returns the input unchanged if it doesn't match a known dev-mode pattern
|
|
10
|
+
* (e.g., already a production hash).
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The production client-reference key hash: `sha256(relativeId).slice(0,12)`,
|
|
14
|
+
* matching @vitejs/plugin-rsc's `hashString`. Exported so the client-chunks
|
|
15
|
+
* strategy can hash a `clientChunks` callback's `meta.normalizedId` (already the
|
|
16
|
+
* project-root-relative id) and compare it against fallback hashes collected
|
|
17
|
+
* during discovery.
|
|
18
|
+
*/
|
|
19
|
+
export declare function hashRefKey(relativeId: string): string;
|
|
20
|
+
export declare function computeProductionHash(projectRoot: string, refKey: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Transform source code by replacing dev-mode client reference keys with
|
|
23
|
+
* production hashes. Exported for testing; used internally by hashClientRefs.
|
|
24
|
+
* Returns null if no replacements were made.
|
|
25
|
+
*/
|
|
26
|
+
export declare function transformClientRefs(code: string, projectRoot: string): string | null;
|
|
27
|
+
/**
|
|
28
|
+
* Vite plugin that rewrites registerClientReference() calls in the RSC
|
|
29
|
+
* environment, replacing dev-mode reference keys with production hashes.
|
|
30
|
+
*
|
|
31
|
+
* This runs AFTER the RSC plugin's transform so the Flight serializer
|
|
32
|
+
* naturally emits production IDs, eliminating the need for post-build
|
|
33
|
+
* regex replacement of Flight payloads.
|
|
34
|
+
*/
|
|
35
|
+
export declare function hashClientRefs(projectRoot: string): Plugin;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* `globalThis` key the `cloudflare:workers` stub reads to populate its
|
|
4
|
+
* `env` export. Router discovery sets this to the resolved `buildEnv`
|
|
5
|
+
* proxy (from `wrangler.getPlatformProxy()` when `buildEnv: "auto"` is
|
|
6
|
+
* configured, or a user-supplied object otherwise) before importing the
|
|
7
|
+
* worker entry, and clears it after discovery disposes the proxy. When
|
|
8
|
+
* unset, the stub's `env` falls back to `{}`.
|
|
9
|
+
*
|
|
10
|
+
* Using `globalThis` is the only cross-module bridge that works here:
|
|
11
|
+
* the stub's `load` hook returns source text, not a live closure, but
|
|
12
|
+
* the stub module is evaluated in the same Node process as the
|
|
13
|
+
* discovery plugin — so reading a global at module-evaluation time
|
|
14
|
+
* reaches whatever the plugin assigned there. A symbol key would be
|
|
15
|
+
* cleaner in-process but awkward to name from the stub source.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare const BUILD_ENV_GLOBAL_KEY = "__rango_build_env__";
|
|
20
|
+
/**
|
|
21
|
+
* Stubs `cloudflare:*` imports for the discovery-time Node Vite server.
|
|
22
|
+
*
|
|
23
|
+
* Discovery only evaluates user module top-level code — it never invokes
|
|
24
|
+
* DurableObject / WorkerEntrypoint / Workflow handlers — so empty base
|
|
25
|
+
* classes are enough for `class X extends DurableObject {}` declarations
|
|
26
|
+
* to load in Node, where `cloudflare:*` is otherwise unresolvable.
|
|
27
|
+
*
|
|
28
|
+
* Interception point: a transform hook parses source with Rollup's
|
|
29
|
+
* plugin-context parser (`this.parse`) and rewrites only real import
|
|
30
|
+
* specifier spans (`import ... from "cloudflare:xxx"`,
|
|
31
|
+
* `import("cloudflare:xxx")`, `export ... from "cloudflare:xxx"`) to a
|
|
32
|
+
* plain virtual module name (`virtual:rango-cloudflare-stub-xxx`).
|
|
33
|
+
* This must be done in transform because Vite's module runner routes
|
|
34
|
+
* URL-scheme specifiers straight to Node's native ESM loader without
|
|
35
|
+
* consulting plugin `resolveId` hooks. Using the AST (instead of a
|
|
36
|
+
* text regex or a permissive lexer) guarantees that strings,
|
|
37
|
+
* comments, and template literals that merely contain import-like
|
|
38
|
+
* text are never mutated — the walker only looks at the four import
|
|
39
|
+
* node types.
|
|
40
|
+
*
|
|
41
|
+
* The transform runs on user source AND on compiled node_modules
|
|
42
|
+
* output: real-world CF packages (e.g. the Cloudflare Agents SDK)
|
|
43
|
+
* ship compiled JS that contains `import ... from "cloudflare:email"`
|
|
44
|
+
* and similar, so excluding node_modules would leave those imports
|
|
45
|
+
* unrewritten. Cost is small because the early exit (`code.includes`)
|
|
46
|
+
* skips files with no cloudflare: mention.
|
|
47
|
+
*
|
|
48
|
+
* The plugin intentionally runs at Vite's default ordering (no
|
|
49
|
+
* `enforce: "pre"`) so TS/JSX has already been compiled to plain JS
|
|
50
|
+
* by the time `this.parse` runs — acorn doesn't understand
|
|
51
|
+
* non-standard syntax.
|
|
52
|
+
*
|
|
53
|
+
* `cloudflare:workers`, `cloudflare:email`, `cloudflare:sockets`, and
|
|
54
|
+
* `cloudflare:workflows` each get curated stubs with the well-known
|
|
55
|
+
* symbols that appear in top-level `extends` positions. Any other
|
|
56
|
+
* `cloudflare:*` specifier falls back to an empty default export —
|
|
57
|
+
* discovery never executes the handlers, so an empty module is safe
|
|
58
|
+
* for anything the graph pulls in transitively.
|
|
59
|
+
*
|
|
60
|
+
* Only registered in the discovery temp server, not the user's runtime
|
|
61
|
+
* config.
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
export declare function createCloudflareProtocolStubPlugin(): Plugin;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* Vite plugin that exposes action IDs on server reference functions.
|
|
4
|
+
*
|
|
5
|
+
* When React Server Components creates server references via createServerReference(),
|
|
6
|
+
* the action ID (format: "hash#actionName") is passed as the first argument but not
|
|
7
|
+
* exposed on the returned function. This plugin transforms the output to attach
|
|
8
|
+
* the $id property to each server reference function, enabling the router to
|
|
9
|
+
* identify which action was called during revalidation.
|
|
10
|
+
*
|
|
11
|
+
* Server bundles (RSC/SSR) get file paths in $id for filtering (e.g., "src/actions.ts#add").
|
|
12
|
+
* Client bundles keep hashed IDs for security (e.g., "ec387bc704d4#add").
|
|
13
|
+
*
|
|
14
|
+
* Works in:
|
|
15
|
+
* - Build mode: uses renderChunk to transform bundled chunks
|
|
16
|
+
* - Dev mode: uses transform with enforce:"post" to transform after RSC plugin
|
|
17
|
+
*/
|
|
18
|
+
export declare function exposeActionId(): Plugin;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize path to forward slashes.
|
|
3
|
+
*/
|
|
4
|
+
export declare function normalizePath(p: string): string;
|
|
5
|
+
export declare function hashId(filePath: string, exportName: string): string;
|
|
6
|
+
export declare function makeStubId(filePath: string, exportName: string, isBuild: boolean): string;
|
|
7
|
+
export declare function hashInlineId(filePath: string, fnName: string, index: number): string;
|
|
8
|
+
export interface DetectedImports {
|
|
9
|
+
loader: boolean;
|
|
10
|
+
handle: boolean;
|
|
11
|
+
locationState: boolean;
|
|
12
|
+
prerenderHandler: boolean;
|
|
13
|
+
staticHandler: boolean;
|
|
14
|
+
router: boolean;
|
|
15
|
+
any: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function buildExportMap(program: any): Map<string, string[]>;
|
|
18
|
+
export declare function detectImports(code: string): DetectedImports;
|
|
19
|
+
export declare function skipStringOrComment(code: string, pos: number): number;
|
|
20
|
+
export declare function findMatchingParen(code: string, startPos: number): number;
|
|
21
|
+
export declare function countArgs(code: string, startPos: number, endPos: number): number;
|
|
22
|
+
export declare function findStatementEnd(code: string, pos: number): number;
|
|
23
|
+
export { escapeRegExp } from "../../regex-escape.js";
|
|
24
|
+
/**
|
|
25
|
+
* Given an index pointing just past a `create*` callee identifier, return the
|
|
26
|
+
* index of the call's opening `(`, accounting for an optional generic type
|
|
27
|
+
* argument list `<...>` with arbitrarily nested `<>`. Returns -1 when the next
|
|
28
|
+
* non-trivia token is neither `<` nor `(` (i.e. not a call site).
|
|
29
|
+
*
|
|
30
|
+
* Replaces the single-level `<[^>]*>` regex assumption, which stopped at the
|
|
31
|
+
* first `>` and so never reached `(` for `createRouter<Config<Env>>(`.
|
|
32
|
+
*
|
|
33
|
+
* Whitespace, comments, and strings between the callee and `(` are skipped via
|
|
34
|
+
* skipStringOrComment. The `<...>` scan only balances angle brackets; it does
|
|
35
|
+
* not attempt to parse full TS type syntax (sufficient for locating the paren).
|
|
36
|
+
*/
|
|
37
|
+
export declare function findCallParenAfterGenerics(code: string, afterCalleeIndex: number): number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CreateExportBinding } from "./types.js";
|
|
2
|
+
export declare function isExportOnlyFile(code: string, bindings: CreateExportBinding[]): boolean;
|
|
3
|
+
export declare function countCreateCallsForNames(code: string, fnNames: string[]): number;
|
|
4
|
+
export declare function offsetToLineColumn(code: string, index: number): {
|
|
5
|
+
line: number;
|
|
6
|
+
column: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function findUnsupportedCreateCallSites(code: string, fnNames: string[], supportedBindings: CreateExportBinding[]): Array<{
|
|
9
|
+
line: number;
|
|
10
|
+
column: number;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function getImportedFnNames(code: string, importedName: string): string[];
|
|
13
|
+
export declare function getCalledIdentifierFromCall(callExpr: any): string | null;
|
|
14
|
+
export declare function collectCreateExportBindingsFallback(code: string, fnNames: string[]): CreateExportBinding[];
|
|
15
|
+
export declare function collectCreateExportBindings(code: string, fnNames: string[], program?: any): CreateExportBinding[];
|
|
16
|
+
export declare function buildUnsupportedShapeWarning(filePath: string, fnName: string, sites?: Array<{
|
|
17
|
+
line: number;
|
|
18
|
+
column: number;
|
|
19
|
+
}>): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import MagicString from "magic-string";
|
|
2
|
+
import type { HandlerTransformConfig, CreateExportBinding } from "./types.js";
|
|
3
|
+
export declare function transformHandles(bindings: CreateExportBinding[], s: MagicString, filePath: string, isBuild: boolean): boolean;
|
|
4
|
+
export declare function transformLocationState(bindings: CreateExportBinding[], s: MagicString, filePath: string, isBuild: boolean): boolean;
|
|
5
|
+
export declare function generateWholeFileStubs(cfg: HandlerTransformConfig, bindings: CreateExportBinding[], code: string, filePath: string, isBuild: boolean): {
|
|
6
|
+
code: string;
|
|
7
|
+
map: null;
|
|
8
|
+
} | null;
|
|
9
|
+
export declare function stubHandlerExprs(cfg: HandlerTransformConfig, bindings: CreateExportBinding[], s: MagicString, filePath: string, isBuild: boolean): boolean;
|
|
10
|
+
export declare function transformHandlerIds(cfg: HandlerTransformConfig, bindings: CreateExportBinding[], s: MagicString, filePath: string, isBuild: boolean): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type MagicString from "magic-string";
|
|
2
|
+
import type { CreateExportBinding } from "./types.js";
|
|
3
|
+
export declare function hasCreateLoaderImport(code: string): boolean;
|
|
4
|
+
export declare function generateClientLoaderStubs(bindings: CreateExportBinding[], code: string, filePath: string, isBuild: boolean): {
|
|
5
|
+
code: string;
|
|
6
|
+
map?: undefined;
|
|
7
|
+
} | null;
|
|
8
|
+
export declare function transformLoaders(bindings: CreateExportBinding[], s: MagicString, filePath: string, isBuild: boolean): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
import MagicString from "magic-string";
|
|
3
|
+
export declare function transformRouter(code: string, filePath: string, routerFnNames: string[], absolutePath?: string, warn?: (message: string) => void): {
|
|
4
|
+
code: string;
|
|
5
|
+
map: ReturnType<MagicString["generateMap"]>;
|
|
6
|
+
} | null;
|
|
7
|
+
/**
|
|
8
|
+
* Inject stable $$id into createRouter() calls at compile time.
|
|
9
|
+
* This must be a separate plugin without enforce:"post" because running
|
|
10
|
+
* at "post" priority changes Vite's dep optimization timing and can cause
|
|
11
|
+
* ERR_OUTDATED_OPTIMIZED_DEP / React dual-instance issues.
|
|
12
|
+
*/
|
|
13
|
+
export declare function exposeRouterId(): Plugin;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface HandlerTransformConfig {
|
|
2
|
+
fnName: string;
|
|
3
|
+
brand: string;
|
|
4
|
+
}
|
|
5
|
+
export interface CreateExportBinding {
|
|
6
|
+
localName: string;
|
|
7
|
+
exportNames: string[];
|
|
8
|
+
callExprStart: number;
|
|
9
|
+
callOpenParenPos: number;
|
|
10
|
+
callCloseParenPos: number;
|
|
11
|
+
argCount: number;
|
|
12
|
+
statementEnd: number;
|
|
13
|
+
}
|
|
14
|
+
export interface StrictCreateTransformConfig {
|
|
15
|
+
fnName: "createLoader" | "createHandle" | "createLocationState";
|
|
16
|
+
}
|
|
17
|
+
export declare const PRERENDER_CONFIG: HandlerTransformConfig;
|
|
18
|
+
export declare const STATIC_CONFIG: HandlerTransformConfig;
|
|
19
|
+
export declare const STRICT_CREATE_CONFIGS: StrictCreateTransformConfig[];
|
|
20
|
+
export interface ExposeInternalIdsApi {
|
|
21
|
+
/** Tracks absolute module IDs that contain prerender handler exports.
|
|
22
|
+
* key: absolute module ID (filesystem path)
|
|
23
|
+
* value: array of export names (e.g., ["ArticlesIndex", "ArticleDetail"]) */
|
|
24
|
+
prerenderHandlerModules: Map<string, string[]>;
|
|
25
|
+
/** Tracks absolute module IDs that contain static handler exports.
|
|
26
|
+
* key: absolute module ID (filesystem path)
|
|
27
|
+
* value: array of export names (e.g., ["DocsNav", "DocShell"]) */
|
|
28
|
+
staticHandlerModules: Map<string, string[]>;
|
|
29
|
+
}
|