@rebask/core 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +18 -2
- package/dist/adapter-utils.d.ts +21 -0
- package/dist/adapter-utils.d.ts.map +1 -0
- package/dist/adapter-utils.js +4 -0
- package/dist/cache-handler.d.ts +2 -0
- package/dist/cache-handler.d.ts.map +1 -0
- package/dist/cache-handler.js +1 -0
- package/dist/cache.client.d.ts +5 -0
- package/dist/cache.client.d.ts.map +1 -0
- package/dist/cache.client.js +13 -0
- package/dist/cache.d.ts +60 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +72 -0
- package/dist/components/app-root.d.ts +9 -0
- package/dist/components/app-root.d.ts.map +1 -0
- package/dist/components/app-root.js +13 -0
- package/dist/components/cache-hints-marker.d.ts +15 -0
- package/dist/components/cache-hints-marker.d.ts.map +1 -0
- package/dist/components/cache-hints-marker.js +38 -0
- package/dist/components/cache-hints.d.ts +58 -0
- package/dist/components/cache-hints.d.ts.map +1 -0
- package/dist/components/cache-hints.js +28 -0
- package/dist/components/cache-slot.d.ts +14 -0
- package/dist/components/cache-slot.d.ts.map +1 -0
- package/dist/components/cache-slot.js +42 -0
- package/dist/components/delay.d.ts +4 -0
- package/dist/components/delay.d.ts.map +1 -0
- package/dist/components/delay.js +9 -0
- package/dist/components/dev-overlay.d.ts +2 -0
- package/dist/components/dev-overlay.d.ts.map +1 -0
- package/dist/components/dev-overlay.js +79 -0
- package/dist/components/error-boundary-client.d.ts +49 -0
- package/dist/components/error-boundary-client.d.ts.map +1 -0
- package/dist/components/error-boundary-client.js +71 -0
- package/dist/components/error-boundary.browser.d.ts +8 -0
- package/dist/components/error-boundary.browser.d.ts.map +1 -0
- package/dist/components/error-boundary.browser.js +6 -0
- package/dist/components/error-boundary.d.ts +12 -0
- package/dist/components/error-boundary.d.ts.map +1 -0
- package/dist/components/error-boundary.js +56 -0
- package/dist/components/error-pages.d.ts +3 -0
- package/dist/components/error-pages.d.ts.map +1 -0
- package/dist/components/error-pages.js +66 -0
- package/dist/components/error.d.ts +2 -0
- package/dist/components/error.d.ts.map +1 -0
- package/dist/components/error.js +5 -0
- package/dist/components/errors.d.ts +17 -0
- package/dist/components/errors.d.ts.map +1 -0
- package/dist/components/errors.js +18 -0
- package/dist/components/head.d.ts +27 -0
- package/dist/components/head.d.ts.map +1 -0
- package/dist/components/head.js +53 -0
- package/dist/components/image.d.ts +7 -0
- package/dist/components/image.d.ts.map +1 -0
- package/dist/components/image.js +202 -0
- package/dist/components/link.d.ts +9 -0
- package/dist/components/link.d.ts.map +1 -0
- package/dist/components/link.js +137 -0
- package/dist/components/not-found-activator.d.ts +11 -0
- package/dist/components/not-found-activator.d.ts.map +1 -0
- package/dist/components/not-found-activator.js +26 -0
- package/dist/components/not-found-boundary-client.d.ts +3 -0
- package/dist/components/not-found-boundary-client.d.ts.map +1 -0
- package/dist/components/not-found-boundary-client.js +20 -0
- package/dist/components/not-found-boundary.browser.d.ts +8 -0
- package/dist/components/not-found-boundary.browser.d.ts.map +1 -0
- package/dist/components/not-found-boundary.browser.js +4 -0
- package/dist/components/not-found-boundary.d.ts +8 -0
- package/dist/components/not-found-boundary.d.ts.map +1 -0
- package/dist/components/not-found-boundary.js +9 -0
- package/dist/components/not-found-thrower.d.ts +2 -0
- package/dist/components/not-found-thrower.d.ts.map +1 -0
- package/dist/components/not-found-thrower.js +7 -0
- package/dist/components/not-found.d.ts +2 -0
- package/dist/components/not-found.d.ts.map +1 -0
- package/dist/components/not-found.js +5 -0
- package/dist/components/prefetch-links.d.ts +5 -0
- package/dist/components/prefetch-links.d.ts.map +1 -0
- package/dist/components/prefetch-links.js +174 -0
- package/dist/components/revalidate-segment.d.ts +40 -0
- package/dist/components/revalidate-segment.d.ts.map +1 -0
- package/dist/components/revalidate-segment.js +90 -0
- package/dist/components/route-hints-marker.d.ts +5 -0
- package/dist/components/route-hints-marker.d.ts.map +1 -0
- package/dist/components/route-hints-marker.js +18 -0
- package/dist/components/route-hints.d.ts +12 -0
- package/dist/components/route-hints.d.ts.map +1 -0
- package/dist/components/route-hints.js +8 -0
- package/dist/components/rsc-segment-node.d.ts +7 -0
- package/dist/components/rsc-segment-node.d.ts.map +1 -0
- package/dist/components/rsc-segment-node.js +33 -0
- package/dist/components/segment-boundary.d.ts +16 -0
- package/dist/components/segment-boundary.d.ts.map +1 -0
- package/dist/components/segment-boundary.js +20 -0
- package/dist/components/status-page.d.ts +6 -0
- package/dist/components/status-page.d.ts.map +1 -0
- package/dist/components/status-page.js +61 -0
- package/dist/cookies.d.ts +60 -0
- package/dist/cookies.d.ts.map +1 -0
- package/dist/cookies.js +164 -0
- package/dist/deployment.d.ts +38 -0
- package/dist/deployment.d.ts.map +1 -0
- package/dist/deployment.js +85 -0
- package/dist/devtools.d.ts +106 -0
- package/dist/devtools.d.ts.map +1 -0
- package/dist/devtools.js +23 -0
- package/dist/entry.browser.d.ts +2 -0
- package/dist/entry.browser.d.ts.map +1 -0
- package/dist/entry.browser.js +99 -0
- package/dist/entry.rsc.d.ts +12 -0
- package/dist/entry.rsc.d.ts.map +1 -0
- package/dist/entry.rsc.js +41 -0
- package/dist/entry.ssr.d.ts +45 -0
- package/dist/entry.ssr.d.ts.map +1 -0
- package/dist/entry.ssr.js +149 -0
- package/dist/handler.d.ts +12 -0
- package/dist/handler.d.ts.map +1 -0
- package/dist/handler.js +21 -0
- package/dist/handlers/image.d.ts +2 -0
- package/dist/handlers/image.d.ts.map +1 -0
- package/dist/handlers/image.js +25 -0
- package/dist/handlers/index.d.ts +16 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +24 -0
- package/dist/handlers/route-handler.d.ts +3 -0
- package/dist/handlers/route-handler.d.ts.map +1 -0
- package/dist/handlers/route-handler.js +57 -0
- package/dist/handlers/rsc/background-render.d.ts +17 -0
- package/dist/handlers/rsc/background-render.d.ts.map +1 -0
- package/dist/handlers/rsc/background-render.js +121 -0
- package/dist/handlers/rsc/cache-html.d.ts +4 -0
- package/dist/handlers/rsc/cache-html.d.ts.map +1 -0
- package/dist/handlers/rsc/cache-html.js +26 -0
- package/dist/handlers/rsc/cache-lookup.d.ts +39 -0
- package/dist/handlers/rsc/cache-lookup.d.ts.map +1 -0
- package/dist/handlers/rsc/cache-lookup.js +187 -0
- package/dist/handlers/rsc/constants.d.ts +3 -0
- package/dist/handlers/rsc/constants.d.ts.map +1 -0
- package/dist/handlers/rsc/constants.js +2 -0
- package/dist/handlers/rsc/create-response.d.ts +3 -0
- package/dist/handlers/rsc/create-response.d.ts.map +1 -0
- package/dist/handlers/rsc/create-response.js +378 -0
- package/dist/handlers/rsc/errors.d.ts +13 -0
- package/dist/handlers/rsc/errors.d.ts.map +1 -0
- package/dist/handlers/rsc/errors.js +18 -0
- package/dist/handlers/rsc/index.d.ts +31 -0
- package/dist/handlers/rsc/index.d.ts.map +1 -0
- package/dist/handlers/rsc/index.js +204 -0
- package/dist/handlers/rsc/post-body.d.ts +20 -0
- package/dist/handlers/rsc/post-body.d.ts.map +1 -0
- package/dist/handlers/rsc/post-body.js +80 -0
- package/dist/handlers/rsc/render-request.d.ts +4 -0
- package/dist/handlers/rsc/render-request.d.ts.map +1 -0
- package/dist/handlers/rsc/render-request.js +131 -0
- package/dist/handlers/rsc/render-to-response.d.ts +7 -0
- package/dist/handlers/rsc/render-to-response.d.ts.map +1 -0
- package/dist/handlers/rsc/render-to-response.js +426 -0
- package/dist/handlers/rsc/render-with-retries.d.ts +4 -0
- package/dist/handlers/rsc/render-with-retries.d.ts.map +1 -0
- package/dist/handlers/rsc/render-with-retries.js +154 -0
- package/dist/handlers/rsc/retry-loop.d.ts +3 -0
- package/dist/handlers/rsc/retry-loop.d.ts.map +1 -0
- package/dist/handlers/rsc/retry-loop.js +145 -0
- package/dist/handlers/rsc/segment-shell.d.ts +9 -0
- package/dist/handlers/rsc/segment-shell.d.ts.map +1 -0
- package/dist/handlers/rsc/segment-shell.js +286 -0
- package/dist/handlers/rsc/ssr-entry.d.ts +3 -0
- package/dist/handlers/rsc/ssr-entry.d.ts.map +1 -0
- package/dist/handlers/rsc/ssr-entry.js +8 -0
- package/dist/handlers/rsc/state.d.ts +70 -0
- package/dist/handlers/rsc/state.d.ts.map +1 -0
- package/dist/handlers/rsc/state.js +120 -0
- package/dist/handlers/rsc/stream-rsc-payload.d.ts +9 -0
- package/dist/handlers/rsc/stream-rsc-payload.d.ts.map +1 -0
- package/dist/handlers/rsc/stream-rsc-payload.js +20 -0
- package/dist/handlers/rsc/types.d.ts +26 -0
- package/dist/handlers/rsc/types.d.ts.map +1 -0
- package/dist/handlers/rsc/types.js +7 -0
- package/dist/handlers/rsc.d.ts +20 -0
- package/dist/handlers/rsc.d.ts.map +1 -0
- package/dist/handlers/rsc.js +872 -0
- package/dist/handlers/segment.d.ts +6 -0
- package/dist/handlers/segment.d.ts.map +1 -0
- package/dist/handlers/segment.js +100 -0
- package/dist/handlers/server-functions.d.ts +22 -0
- package/dist/handlers/server-functions.d.ts.map +1 -0
- package/dist/handlers/server-functions.js +137 -0
- package/dist/handlers.d.ts +15 -0
- package/dist/handlers.d.ts.map +1 -0
- package/dist/handlers.js +9 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/integration.d.ts +14 -0
- package/dist/integration.d.ts.map +1 -0
- package/dist/integration.js +9 -0
- package/dist/lib/app-manifest.d.ts +31 -0
- package/dist/lib/app-manifest.d.ts.map +1 -0
- package/dist/lib/app-manifest.js +4 -0
- package/dist/lib/background-revalidation.d.ts +17 -0
- package/dist/lib/background-revalidation.d.ts.map +1 -0
- package/dist/lib/background-revalidation.js +56 -0
- package/dist/lib/body-size-limit.d.ts +2 -0
- package/dist/lib/body-size-limit.d.ts.map +1 -0
- package/dist/lib/body-size-limit.js +38 -0
- package/dist/lib/build-paths.d.ts +13 -0
- package/dist/lib/build-paths.d.ts.map +1 -0
- package/dist/lib/build-paths.js +25 -0
- package/dist/lib/cache-context.d.ts +34 -0
- package/dist/lib/cache-context.d.ts.map +1 -0
- package/dist/lib/cache-context.js +59 -0
- package/dist/lib/cache-key-tags.d.ts +17 -0
- package/dist/lib/cache-key-tags.d.ts.map +1 -0
- package/dist/lib/cache-key-tags.js +17 -0
- package/dist/lib/cache-keys.d.ts +5 -0
- package/dist/lib/cache-keys.d.ts.map +1 -0
- package/dist/lib/cache-keys.js +11 -0
- package/dist/lib/cache-payload.d.ts +5 -0
- package/dist/lib/cache-payload.d.ts.map +1 -0
- package/dist/lib/cache-payload.js +31 -0
- package/dist/lib/cache-storage.d.ts +145 -0
- package/dist/lib/cache-storage.d.ts.map +1 -0
- package/dist/lib/cache-storage.js +88 -0
- package/dist/lib/client-route-prediction.d.ts +40 -0
- package/dist/lib/client-route-prediction.d.ts.map +1 -0
- package/dist/lib/client-route-prediction.js +169 -0
- package/dist/lib/client-trace.d.ts +7 -0
- package/dist/lib/client-trace.d.ts.map +1 -0
- package/dist/lib/client-trace.js +30 -0
- package/dist/lib/config.d.ts +3 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +21 -0
- package/dist/lib/csrf-protection.d.ts +2 -0
- package/dist/lib/csrf-protection.d.ts.map +1 -0
- package/dist/lib/csrf-protection.js +34 -0
- package/dist/lib/dedupe-fetch.d.ts +2 -0
- package/dist/lib/dedupe-fetch.d.ts.map +1 -0
- package/dist/lib/dedupe-fetch.js +110 -0
- package/dist/lib/deployment-id.d.ts +4 -0
- package/dist/lib/deployment-id.d.ts.map +1 -0
- package/dist/lib/deployment-id.js +9 -0
- package/dist/lib/dev-module-load-race.d.ts +8 -0
- package/dist/lib/dev-module-load-race.d.ts.map +1 -0
- package/dist/lib/dev-module-load-race.js +31 -0
- package/dist/lib/dev-server.d.ts +22 -0
- package/dist/lib/dev-server.d.ts.map +1 -0
- package/dist/lib/dev-server.js +131 -0
- package/dist/lib/devtools-channels.d.ts +22 -0
- package/dist/lib/devtools-channels.d.ts.map +1 -0
- package/dist/lib/devtools-channels.js +13 -0
- package/dist/lib/document-route.d.ts +12 -0
- package/dist/lib/document-route.d.ts.map +1 -0
- package/dist/lib/document-route.js +21 -0
- package/dist/lib/durable-cache.d.ts +2 -0
- package/dist/lib/durable-cache.d.ts.map +1 -0
- package/dist/lib/durable-cache.js +143 -0
- package/dist/lib/environment-names.d.ts +11 -0
- package/dist/lib/environment-names.d.ts.map +1 -0
- package/dist/lib/environment-names.js +10 -0
- package/dist/lib/errors.d.ts +39 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +78 -0
- package/dist/lib/extract-segment-hints.d.ts +14 -0
- package/dist/lib/extract-segment-hints.d.ts.map +1 -0
- package/dist/lib/extract-segment-hints.js +112 -0
- package/dist/lib/fetch-dedupe-storage.d.ts +6 -0
- package/dist/lib/fetch-dedupe-storage.d.ts.map +1 -0
- package/dist/lib/fetch-dedupe-storage.js +13 -0
- package/dist/lib/fetch-tracker.d.ts +2 -0
- package/dist/lib/fetch-tracker.d.ts.map +1 -0
- package/dist/lib/fetch-tracker.js +31 -0
- package/dist/lib/file-system-cache.d.ts +25 -0
- package/dist/lib/file-system-cache.d.ts.map +1 -0
- package/dist/lib/file-system-cache.js +132 -0
- package/dist/lib/flight-headers.d.ts +9 -0
- package/dist/lib/flight-headers.d.ts.map +1 -0
- package/dist/lib/flight-headers.js +55 -0
- package/dist/lib/head/head-plugin.d.ts +3 -0
- package/dist/lib/head/head-plugin.d.ts.map +1 -0
- package/dist/lib/head/head-plugin.js +50 -0
- package/dist/lib/head/head-script.d.ts +2 -0
- package/dist/lib/head/head-script.d.ts.map +1 -0
- package/dist/lib/head/head-script.js +43 -0
- package/dist/lib/hmr.d.ts +2 -0
- package/dist/lib/hmr.d.ts.map +1 -0
- package/dist/lib/hmr.js +30 -0
- package/dist/lib/image-optimization/find-closest-quality.d.ts +3 -0
- package/dist/lib/image-optimization/find-closest-quality.d.ts.map +1 -0
- package/dist/lib/image-optimization/find-closest-quality.js +18 -0
- package/dist/lib/image-optimization/get-img-props.d.ts +61 -0
- package/dist/lib/image-optimization/get-img-props.d.ts.map +1 -0
- package/dist/lib/image-optimization/get-img-props.js +297 -0
- package/dist/lib/image-optimization/handler.d.ts +5 -0
- package/dist/lib/image-optimization/handler.d.ts.map +1 -0
- package/dist/lib/image-optimization/handler.js +165 -0
- package/dist/lib/image-optimization/image-blur-svg.d.ts +12 -0
- package/dist/lib/image-optimization/image-blur-svg.d.ts.map +1 -0
- package/dist/lib/image-optimization/image-blur-svg.js +17 -0
- package/dist/lib/image-optimization/image-config.d.ts +45 -0
- package/dist/lib/image-optimization/image-config.d.ts.map +1 -0
- package/dist/lib/image-optimization/image-config.js +11 -0
- package/dist/lib/image-optimization/image-loader.d.ts +7 -0
- package/dist/lib/image-optimization/image-loader.d.ts.map +1 -0
- package/dist/lib/image-optimization/image-loader.js +23 -0
- package/dist/lib/image-optimization/image-plugin.d.ts +15 -0
- package/dist/lib/image-optimization/image-plugin.d.ts.map +1 -0
- package/dist/lib/image-optimization/image-plugin.js +97 -0
- package/dist/lib/image-optimization/warn-once.d.ts +2 -0
- package/dist/lib/image-optimization/warn-once.d.ts.map +1 -0
- package/dist/lib/image-optimization/warn-once.js +8 -0
- package/dist/lib/initial-hash-scroll.d.ts.map +1 -0
- package/dist/lib/lru-cache.d.ts +51 -0
- package/dist/lib/lru-cache.d.ts.map +1 -0
- package/dist/lib/lru-cache.js +156 -0
- package/dist/lib/messages.d.ts +3 -0
- package/dist/lib/messages.d.ts.map +1 -0
- package/dist/lib/messages.js +8 -0
- package/dist/lib/not-found.d.ts +5 -0
- package/dist/lib/not-found.d.ts.map +1 -0
- package/dist/lib/not-found.js +7 -0
- package/dist/lib/pattern-segments.d.ts +8 -0
- package/dist/lib/pattern-segments.d.ts.map +1 -0
- package/dist/lib/pattern-segments.js +22 -0
- package/dist/lib/plugin-utils.d.ts +10 -0
- package/dist/lib/plugin-utils.d.ts.map +1 -0
- package/dist/lib/plugin-utils.js +22 -0
- package/dist/lib/ppr/hanging-promise.d.ts +8 -0
- package/dist/lib/ppr/hanging-promise.d.ts.map +1 -0
- package/dist/lib/ppr/hanging-promise.js +31 -0
- package/dist/lib/ppr/headers.d.ts +40 -0
- package/dist/lib/ppr/headers.d.ts.map +1 -0
- package/dist/lib/ppr/headers.js +62 -0
- package/dist/lib/ppr/postponed-state.d.ts +8 -0
- package/dist/lib/ppr/postponed-state.d.ts.map +1 -0
- package/dist/lib/ppr/postponed-state.js +58 -0
- package/dist/lib/ppr/types.d.ts +40 -0
- package/dist/lib/ppr/types.d.ts.map +1 -0
- package/dist/lib/ppr/types.js +13 -0
- package/dist/lib/prefetch-utils.d.ts +30 -0
- package/dist/lib/prefetch-utils.d.ts.map +1 -0
- package/dist/lib/prefetch-utils.js +59 -0
- package/dist/lib/prerender-params.d.ts +17 -0
- package/dist/lib/prerender-params.d.ts.map +1 -0
- package/dist/lib/prerender-params.js +77 -0
- package/dist/lib/prerender-paths.d.ts +44 -0
- package/dist/lib/prerender-paths.d.ts.map +1 -0
- package/dist/lib/prerender-paths.js +141 -0
- package/dist/lib/project-files.d.ts +10 -0
- package/dist/lib/project-files.d.ts.map +1 -0
- package/dist/lib/project-files.js +66 -0
- package/dist/lib/proxy/build-proxy.d.ts +4 -0
- package/dist/lib/proxy/build-proxy.d.ts.map +1 -0
- package/dist/lib/proxy/build-proxy.js +24 -0
- package/dist/lib/proxy/proxy-external.d.ts +5 -0
- package/dist/lib/proxy/proxy-external.d.ts.map +1 -0
- package/dist/lib/proxy/proxy-external.js +31 -0
- package/dist/lib/proxy/rewrite.d.ts +43 -0
- package/dist/lib/proxy/rewrite.d.ts.map +1 -0
- package/dist/lib/proxy/rewrite.js +58 -0
- package/dist/lib/proxy/types.d.ts +54 -0
- package/dist/lib/proxy/types.d.ts.map +1 -0
- package/dist/lib/proxy/types.js +7 -0
- package/dist/lib/render-context.d.ts +78 -0
- package/dist/lib/render-context.d.ts.map +1 -0
- package/dist/lib/render-context.js +106 -0
- package/dist/lib/render-dev-overlay.d.ts +5 -0
- package/dist/lib/render-dev-overlay.d.ts.map +1 -0
- package/dist/lib/render-dev-overlay.js +25 -0
- package/dist/lib/request-io.d.ts +3 -0
- package/dist/lib/request-io.d.ts.map +1 -0
- package/dist/lib/request-io.js +23 -0
- package/dist/lib/route-builder.d.ts +7 -0
- package/dist/lib/route-builder.d.ts.map +1 -0
- package/dist/lib/route-builder.js +217 -0
- package/dist/lib/route-matcher.d.ts +70 -0
- package/dist/lib/route-matcher.d.ts.map +1 -0
- package/dist/lib/route-matcher.js +47 -0
- package/dist/lib/route-prediction.d.ts +50 -0
- package/dist/lib/route-prediction.d.ts.map +1 -0
- package/dist/lib/route-prediction.js +58 -0
- package/dist/lib/route-renderer.d.ts +7 -0
- package/dist/lib/route-renderer.d.ts.map +1 -0
- package/dist/lib/route-renderer.js +78 -0
- package/dist/lib/route-specificity.d.ts +9 -0
- package/dist/lib/route-specificity.d.ts.map +1 -0
- package/dist/lib/route-specificity.js +30 -0
- package/dist/lib/route-tree.d.ts +7 -0
- package/dist/lib/route-tree.d.ts.map +1 -0
- package/dist/lib/route-tree.js +38 -0
- package/dist/lib/router-cache.d.ts +185 -0
- package/dist/lib/router-cache.d.ts.map +1 -0
- package/dist/lib/router-cache.js +665 -0
- package/dist/lib/router-types.d.ts +59 -0
- package/dist/lib/router-types.d.ts.map +1 -0
- package/dist/lib/router-types.js +1 -0
- package/dist/lib/rsc-request.d.ts +59 -0
- package/dist/lib/rsc-request.d.ts.map +1 -0
- package/dist/lib/rsc-request.js +228 -0
- package/dist/lib/scheduler-patch.d.ts +23 -0
- package/dist/lib/scheduler-patch.d.ts.map +1 -0
- package/dist/lib/scheduler-patch.js +77 -0
- package/dist/lib/scroll.d.ts +30 -0
- package/dist/lib/scroll.d.ts.map +1 -0
- package/dist/lib/scroll.js +151 -0
- package/dist/lib/segment-utils.d.ts +52 -0
- package/dist/lib/segment-utils.d.ts.map +1 -0
- package/dist/lib/segment-utils.js +124 -0
- package/dist/lib/server-router/get-router.d.ts +4 -0
- package/dist/lib/server-router/get-router.d.ts.map +1 -0
- package/dist/lib/server-router/get-router.js +174 -0
- package/dist/lib/server-router/types.d.ts +52 -0
- package/dist/lib/server-router/types.d.ts.map +1 -0
- package/dist/lib/server-router/types.js +6 -0
- package/dist/lib/server-router-contract.d.ts +42 -0
- package/dist/lib/server-router-contract.d.ts.map +1 -0
- package/dist/lib/server-router-contract.js +6 -0
- package/dist/lib/server-router-loader.d.ts +10 -0
- package/dist/lib/server-router-loader.d.ts.map +1 -0
- package/dist/lib/server-router-loader.js +180 -0
- package/dist/lib/server-router.d.ts +8 -0
- package/dist/lib/server-router.d.ts.map +1 -0
- package/dist/lib/server-router.js +173 -0
- package/dist/lib/shell-params.d.ts +25 -0
- package/dist/lib/shell-params.d.ts.map +1 -0
- package/dist/lib/shell-params.js +40 -0
- package/dist/lib/stream-utils.d.ts +24 -0
- package/dist/lib/stream-utils.d.ts.map +1 -0
- package/dist/lib/stream-utils.js +94 -0
- package/dist/lib/telemetry.d.ts +22 -0
- package/dist/lib/telemetry.d.ts.map +1 -0
- package/dist/lib/telemetry.js +139 -0
- package/dist/lib/types.d.ts +71 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +1 -0
- package/dist/lib/use-cache-plugin.d.ts +5 -0
- package/dist/lib/use-cache-plugin.d.ts.map +1 -0
- package/dist/lib/use-cache-plugin.js +62 -0
- package/dist/lib/use-cache-runtime.d.ts +2 -0
- package/dist/lib/use-cache-runtime.d.ts.map +1 -0
- package/dist/lib/use-cache-runtime.js +142 -0
- package/dist/lib/vite-error-overlay.d.ts +4 -0
- package/dist/lib/vite-error-overlay.d.ts.map +1 -0
- package/dist/lib/vite-error-overlay.js +42 -0
- package/dist/lib/write-behind-cache.d.ts +30 -0
- package/dist/lib/write-behind-cache.d.ts.map +1 -0
- package/dist/lib/write-behind-cache.js +116 -0
- package/dist/observe-navigations.d.ts +6 -0
- package/dist/observe-navigations.d.ts.map +1 -0
- package/dist/observe-navigations.js +60 -0
- package/dist/plugins/devtools.d.ts +4 -0
- package/dist/plugins/devtools.d.ts.map +1 -0
- package/dist/plugins/devtools.js +96 -0
- package/dist/plugins/ppr-upgrade.d.ts +36 -0
- package/dist/plugins/ppr-upgrade.d.ts.map +1 -0
- package/dist/plugins/ppr-upgrade.js +32 -0
- package/dist/plugins/ppr.d.ts +35 -0
- package/dist/plugins/ppr.d.ts.map +1 -0
- package/dist/plugins/ppr.js +35 -0
- package/dist/plugins/prerender.d.ts +45 -0
- package/dist/plugins/prerender.d.ts.map +1 -0
- package/dist/plugins/prerender.js +316 -0
- package/dist/plugins/proxy.d.ts +29 -0
- package/dist/plugins/proxy.d.ts.map +1 -0
- package/dist/plugins/proxy.js +186 -0
- package/dist/plugins/router/router-plugin.d.ts +41 -0
- package/dist/plugins/router/router-plugin.d.ts.map +1 -0
- package/dist/plugins/router/router-plugin.js +54 -0
- package/dist/plugins/router/wint-router.d.ts +9 -0
- package/dist/plugins/router/wint-router.d.ts.map +1 -0
- package/dist/plugins/router/wint-router.js +116 -0
- package/dist/plugins/server-only-plugin.d.ts +3 -0
- package/dist/plugins/server-only-plugin.d.ts.map +1 -0
- package/dist/plugins/server-only-plugin.js +41 -0
- package/dist/plugins/server-router-fallback.d.ts +15 -0
- package/dist/plugins/server-router-fallback.d.ts.map +1 -0
- package/dist/plugins/server-router-fallback.js +30 -0
- package/dist/proxy.d.ts +4 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/proxy.js +2 -0
- package/dist/request-context.d.ts +127 -0
- package/dist/request-context.d.ts.map +1 -0
- package/dist/request-context.js +127 -0
- package/dist/request.client.d.ts +4 -0
- package/dist/request.client.d.ts.map +1 -0
- package/dist/request.client.js +10 -0
- package/dist/request.d.ts +9 -0
- package/dist/request.d.ts.map +1 -0
- package/dist/request.js +95 -0
- package/dist/router.d.ts +192 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +944 -0
- package/dist/runtime-config.d.ts +2 -0
- package/dist/runtime-config.d.ts.map +1 -0
- package/dist/runtime-config.js +1 -0
- package/dist/server-router.d.ts +5 -0
- package/dist/server-router.d.ts.map +1 -0
- package/dist/server-router.js +2 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +57 -0
- package/dist/vite.d.ts +123 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +443 -0
- package/package.json +183 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Luis Alvarez D
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# rebask
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Vite plugin and runtime for React Server Components apps. It adds file-based routing, streaming HTML,
|
|
4
|
+
Partial Pre-Rendering (PPR), Server Functions, and soft navigations.
|
|
5
|
+
|
|
6
|
+
[Documentation](https://rebask.com/docs) · [Cheatsheet](https://rebask.com/cheatsheet)
|
|
7
|
+
|
|
8
|
+
## Getting started
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
# npm
|
|
12
|
+
npm create rebask-app@latest
|
|
13
|
+
|
|
14
|
+
# pnpm
|
|
15
|
+
pnpm create rebask-app
|
|
16
|
+
|
|
17
|
+
# bun
|
|
18
|
+
bunx create-rebask-app
|
|
19
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { copyBuildPaths, getBuildPaths } from "./lib/build-paths.js";
|
|
2
|
+
export { STATIC } from "./lib/cache-storage.js";
|
|
3
|
+
export { getPluginApi } from "./lib/plugin-utils.js";
|
|
4
|
+
export { compareRouteSegments } from "./lib/route-specificity.js";
|
|
5
|
+
/**
|
|
6
|
+
* Runs when a page or layout RSC payload was rendered and is cacheable, so an adapter can cache it.
|
|
7
|
+
* `url` is where the client fetches that payload, and `options` are the ones the adapter registered
|
|
8
|
+
* its hooks module with.
|
|
9
|
+
*/
|
|
10
|
+
export type OnCacheableRsc<Options = unknown> = (info: {
|
|
11
|
+
url: URL;
|
|
12
|
+
}, options: Options) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Runs after an HTML resume finished streaming, unless it is marked as not needing an upgrade, so
|
|
15
|
+
* an adapter can schedule that upgrade. `url` is the page the resume belongs to, and `options` are
|
|
16
|
+
* the ones the adapter registered its hooks module with.
|
|
17
|
+
*/
|
|
18
|
+
export type OnHtmlResume<Options = unknown> = (info: {
|
|
19
|
+
url: URL;
|
|
20
|
+
}, options: Options) => void;
|
|
21
|
+
//# sourceMappingURL=adapter-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-utils.d.ts","sourceRoot":"","sources":["../src/adapter-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAEjE;;;;GAIG;AACH,MAAM,MAAM,cAAc,CAAC,OAAO,GAAG,OAAO,IAAI,CAAC,IAAI,EAAE;IAAE,GAAG,EAAE,GAAG,CAAA;CAAE,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;AAE9F;;;;GAIG;AACH,MAAM,MAAM,YAAY,CAAC,OAAO,GAAG,OAAO,IAAI,CAAC,IAAI,EAAE;IAAE,GAAG,EAAE,GAAG,CAAA;CAAE,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-handler.d.ts","sourceRoot":"","sources":["../src/cache-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { cacheHandler } from "virtual:rebask/cache-handler";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.client.d.ts","sourceRoot":"","sources":["../src/cache.client.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,SAExB;AAED,wBAAgB,QAAQ,SAEvB;AAED,wBAAsB,aAAa,kBAElC;AAED,wBAAgB,YAAY,SAE3B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ServerOnlyApiError } from "./lib/errors.js";
|
|
2
|
+
export function cacheLife() {
|
|
3
|
+
throw new ServerOnlyApiError("cacheLife");
|
|
4
|
+
}
|
|
5
|
+
export function cacheTag() {
|
|
6
|
+
throw new ServerOnlyApiError("cacheTag");
|
|
7
|
+
}
|
|
8
|
+
export async function revalidateTag() {
|
|
9
|
+
throw new ServerOnlyApiError("revalidateTag");
|
|
10
|
+
}
|
|
11
|
+
export function durableCache() {
|
|
12
|
+
throw new ServerOnlyApiError("durableCache");
|
|
13
|
+
}
|
package/dist/cache.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type { CacheLife } from "./lib/cache-context.js";
|
|
2
|
+
export { BaseCacheStorage, type CacheEntry, type CacheEntryStatus, CacheEntryType, type CacheStorage, } from "./lib/cache-storage.js";
|
|
3
|
+
export { durableCache } from "./lib/durable-cache.js";
|
|
4
|
+
export { FilesystemCacheStorage } from "./lib/file-system-cache.js";
|
|
5
|
+
export { type LRUCacheOptions, withLRU } from "./lib/lru-cache.js";
|
|
6
|
+
export { isPageCacheKey } from "./lib/cache-keys.js";
|
|
7
|
+
/**
|
|
8
|
+
* Configure the cache lifetime for the current scope.
|
|
9
|
+
*
|
|
10
|
+
* Can be called inside a "use cache" function to control function-level caching,
|
|
11
|
+
* or directly in a server component to control page-level HTML/RSC caching.
|
|
12
|
+
*
|
|
13
|
+
* Aggregation rules:
|
|
14
|
+
* - revalidate and expire: minimum wins (most restrictive value across all calls)
|
|
15
|
+
* - tags: merged (union of all tags)
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* // Page-level: controls HTML and RSC segment cache
|
|
20
|
+
* export default async function ProductsPage() {
|
|
21
|
+
* cacheLife({ revalidate: 300, expire: 3600 })
|
|
22
|
+
* return <ProductList />
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* // Function-level: controls individual data cache
|
|
26
|
+
* async function getData() {
|
|
27
|
+
* 'use cache'
|
|
28
|
+
* cacheLife({ revalidate: 300, expire: 3600 })
|
|
29
|
+
* return fetch('/api/data')
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function cacheLife(config: {
|
|
34
|
+
revalidate: number;
|
|
35
|
+
expire?: number;
|
|
36
|
+
} | {
|
|
37
|
+
revalidate: number;
|
|
38
|
+
}): void;
|
|
39
|
+
/**
|
|
40
|
+
* Add cache tags for on-demand revalidation.
|
|
41
|
+
*
|
|
42
|
+
* Can be called inside a "use cache" function or directly in a server component.
|
|
43
|
+
*/
|
|
44
|
+
export declare function cacheTag(...tags: string[]): void;
|
|
45
|
+
/**
|
|
46
|
+
* Invalidate all cache entries associated with the given tag.
|
|
47
|
+
*
|
|
48
|
+
* After calling this, subsequent requests will treat entries tagged with
|
|
49
|
+
* this tag as stale, causing them to be regenerated.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { revalidateTag } from "@rebask/core/cache"
|
|
54
|
+
*
|
|
55
|
+
* // Invalidate all entries tagged with "products"
|
|
56
|
+
* await revalidateTag("products")
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function revalidateTag(tag: string): Promise<void>;
|
|
60
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EACN,gBAAgB,EAChB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,cAAc,EACd,KAAK,YAAY,GACjB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,KAAK,eAAe,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,SAAS,CACxB,MAAM,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,QAQxE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,QASzC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,iBAG9C"}
|
package/dist/cache.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { insideUseCache, setCacheLife } from "./lib/cache-context.js";
|
|
2
|
+
import { getCacheHandler } from "./lib/config.js";
|
|
3
|
+
import { revalidateTagChannel } from "./lib/devtools-channels.js";
|
|
4
|
+
import { insideRequestHandling } from "./request-context.js";
|
|
5
|
+
export { BaseCacheStorage, CacheEntryType, } from "./lib/cache-storage.js";
|
|
6
|
+
export { durableCache } from "./lib/durable-cache.js";
|
|
7
|
+
export { FilesystemCacheStorage } from "./lib/file-system-cache.js";
|
|
8
|
+
export { withLRU } from "./lib/lru-cache.js";
|
|
9
|
+
export { isPageCacheKey } from "./lib/cache-keys.js";
|
|
10
|
+
/**
|
|
11
|
+
* Configure the cache lifetime for the current scope.
|
|
12
|
+
*
|
|
13
|
+
* Can be called inside a "use cache" function to control function-level caching,
|
|
14
|
+
* or directly in a server component to control page-level HTML/RSC caching.
|
|
15
|
+
*
|
|
16
|
+
* Aggregation rules:
|
|
17
|
+
* - revalidate and expire: minimum wins (most restrictive value across all calls)
|
|
18
|
+
* - tags: merged (union of all tags)
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* // Page-level: controls HTML and RSC segment cache
|
|
23
|
+
* export default async function ProductsPage() {
|
|
24
|
+
* cacheLife({ revalidate: 300, expire: 3600 })
|
|
25
|
+
* return <ProductList />
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* // Function-level: controls individual data cache
|
|
29
|
+
* async function getData() {
|
|
30
|
+
* 'use cache'
|
|
31
|
+
* cacheLife({ revalidate: 300, expire: 3600 })
|
|
32
|
+
* return fetch('/api/data')
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function cacheLife(config) {
|
|
37
|
+
if (!insideUseCache() && !insideRequestHandling()) {
|
|
38
|
+
throw new Error('`cacheLife()` can only be called inside a server component or a "use cache" function.');
|
|
39
|
+
}
|
|
40
|
+
setCacheLife(config);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Add cache tags for on-demand revalidation.
|
|
44
|
+
*
|
|
45
|
+
* Can be called inside a "use cache" function or directly in a server component.
|
|
46
|
+
*/
|
|
47
|
+
export function cacheTag(...tags) {
|
|
48
|
+
if (!insideUseCache() && !insideRequestHandling()) {
|
|
49
|
+
throw new Error('`cacheTag()` can only be called inside a server component or a "use cache" function.');
|
|
50
|
+
}
|
|
51
|
+
if (tags.length === 0)
|
|
52
|
+
return;
|
|
53
|
+
setCacheLife({ tags: new Set(tags) });
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Invalidate all cache entries associated with the given tag.
|
|
57
|
+
*
|
|
58
|
+
* After calling this, subsequent requests will treat entries tagged with
|
|
59
|
+
* this tag as stale, causing them to be regenerated.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* import { revalidateTag } from "@rebask/core/cache"
|
|
64
|
+
*
|
|
65
|
+
* // Invalidate all entries tagged with "products"
|
|
66
|
+
* await revalidateTag("products")
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export async function revalidateTag(tag) {
|
|
70
|
+
revalidateTagChannel.publish({ tag });
|
|
71
|
+
await getCacheHandler().revalidateTag(tag);
|
|
72
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { RouterCache } from "../lib/router-cache.js";
|
|
3
|
+
/** Shared document root for SSR and client hydration. */
|
|
4
|
+
export declare function AppRoot({ cache, trailing, }: {
|
|
5
|
+
cache: RouterCache;
|
|
6
|
+
/** SSR-only sibling after the app tree (must not sit above CacheSlot). */
|
|
7
|
+
trailing?: ReactNode;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=app-root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-root.d.ts","sourceRoot":"","sources":["../../src/components/app-root.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AAElD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAOzD,yDAAyD;AACzD,wBAAgB,OAAO,CAAC,EACvB,KAAK,EACL,QAAQ,GACR,EAAE;IACF,KAAK,EAAE,WAAW,CAAA;IAClB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,SAAS,CAAA;CACpB,+BAcA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { StrictMode } from "react";
|
|
4
|
+
import { HMR } from "../lib/hmr.js";
|
|
5
|
+
import { ScrollHandler } from "../lib/scroll.js";
|
|
6
|
+
import { ObserveNavigations } from "../observe-navigations.js";
|
|
7
|
+
import { CacheSlot, RouterCacheProvider } from "./cache-slot.js";
|
|
8
|
+
import { ErrorBoundary } from "./error-boundary.js";
|
|
9
|
+
import { DefaultError } from "./error-pages.js";
|
|
10
|
+
/** Shared document root for SSR and client hydration. */
|
|
11
|
+
export function AppRoot({ cache, trailing, }) {
|
|
12
|
+
return (_jsx(StrictMode, { children: _jsxs(RouterCacheProvider, { value: cache, children: [_jsx(HMR, {}), _jsx(ObserveNavigations, {}), _jsx(ScrollHandler, {}), _jsx(ErrorBoundary, { root: true, fallback: _jsx(DefaultError, {}), children: _jsx(CacheSlot, { cache: cache }) }), trailing] }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CacheHintsProps } from "./cache-hints.js";
|
|
2
|
+
/**
|
|
3
|
+
* Client-side marker rendered by the server `<CacheHints>` component. Plays
|
|
4
|
+
* two roles:
|
|
5
|
+
*
|
|
6
|
+
* 1. Its props are serialized into the RSC payload, so the prefetch walker
|
|
7
|
+
* can find it (identity check on `elementType === CacheHintsMarker`) and
|
|
8
|
+
* register hints before the segment is rendered.
|
|
9
|
+
* 2. After hydration, its `useEffect` calls `router.setCacheHints()` so
|
|
10
|
+
* initial-page renders (which never go through prefetch) also register
|
|
11
|
+
* hints. The router uses the surrounding `<SegmentBoundary>` to target
|
|
12
|
+
* the right segment.
|
|
13
|
+
*/
|
|
14
|
+
export declare function CacheHintsMarker({ stale, tags, mustRevalidate }: CacheHintsProps): null;
|
|
15
|
+
//# sourceMappingURL=cache-hints-marker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-hints-marker.d.ts","sourceRoot":"","sources":["../../src/components/cache-hints-marker.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEvD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,eAAe,QAwBhF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { useRouter } from "../router.js";
|
|
4
|
+
/**
|
|
5
|
+
* Client-side marker rendered by the server `<CacheHints>` component. Plays
|
|
6
|
+
* two roles:
|
|
7
|
+
*
|
|
8
|
+
* 1. Its props are serialized into the RSC payload, so the prefetch walker
|
|
9
|
+
* can find it (identity check on `elementType === CacheHintsMarker`) and
|
|
10
|
+
* register hints before the segment is rendered.
|
|
11
|
+
* 2. After hydration, its `useEffect` calls `router.setCacheHints()` so
|
|
12
|
+
* initial-page renders (which never go through prefetch) also register
|
|
13
|
+
* hints. The router uses the surrounding `<SegmentBoundary>` to target
|
|
14
|
+
* the right segment.
|
|
15
|
+
*/
|
|
16
|
+
export function CacheHintsMarker({ stale, tags, mustRevalidate }) {
|
|
17
|
+
const router = useRouter();
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
let cancelled = false;
|
|
20
|
+
Promise.all([
|
|
21
|
+
Promise.resolve(stale),
|
|
22
|
+
Promise.resolve(tags),
|
|
23
|
+
Promise.resolve(mustRevalidate),
|
|
24
|
+
]).then(([resolvedStale, resolvedTags, resolvedMustRevalidate]) => {
|
|
25
|
+
if (!cancelled) {
|
|
26
|
+
router.setCacheHints({
|
|
27
|
+
stale: resolvedStale,
|
|
28
|
+
tags: resolvedTags,
|
|
29
|
+
mustRevalidate: resolvedMustRevalidate,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return () => {
|
|
34
|
+
cancelled = true;
|
|
35
|
+
};
|
|
36
|
+
}, [router, stale, tags, mustRevalidate]);
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolved cache hints stored on a cached segment and accepted by the
|
|
3
|
+
* imperative `useRouter().setCacheHints()` API.
|
|
4
|
+
*/
|
|
5
|
+
export interface ResolvedCacheHints {
|
|
6
|
+
stale?: number;
|
|
7
|
+
tags?: string[];
|
|
8
|
+
mustRevalidate?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface CacheHintsProps {
|
|
11
|
+
/**
|
|
12
|
+
* How long, in seconds, the client router should treat this segment's cached content as
|
|
13
|
+
* fresh, defaults to "fresh forever".
|
|
14
|
+
*
|
|
15
|
+
* After `stale` seconds, the next navigation to this route revalidates the segment in the
|
|
16
|
+
* background while serving the cached version (stale-while-revalidate).
|
|
17
|
+
*
|
|
18
|
+
* Values below `2` are clamped to `2`. The floor absorbs the latency between a hover stale check
|
|
19
|
+
* and the click that follows, so a single user interaction doesn't double-fetch the segment.
|
|
20
|
+
*/
|
|
21
|
+
stale?: number | PromiseLike<number>;
|
|
22
|
+
/**
|
|
23
|
+
* Client-side cache tags for this segment. These are independent from any server-side cache tags
|
|
24
|
+
* as they only affect the client router.
|
|
25
|
+
*
|
|
26
|
+
* If multiple `<CacheHints>` write tags onto the same segment, the last write replaces the
|
|
27
|
+
* previous one, tags are not merged.
|
|
28
|
+
*/
|
|
29
|
+
tags?: string[] | PromiseLike<string[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Opt out of stale-while-revalidate for this segment. When set, the suspending placeholder is
|
|
32
|
+
* written immediately and the nearest `<Suspense>` fallback shows while the new payload is in
|
|
33
|
+
* flight. Use it for segments whose stale data is unsafe to display.
|
|
34
|
+
*/
|
|
35
|
+
mustRevalidate?: boolean | PromiseLike<boolean>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Declares cache hints for the route segment (page, layout, or not-found)
|
|
39
|
+
* that renders it. Use it to tell the client router how long it can keep
|
|
40
|
+
* serving a segment's cached RSC payload before revalidating.
|
|
41
|
+
*
|
|
42
|
+
* Must be rendered from a server component.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* export default async function ProductsPage() {
|
|
47
|
+
* const data = await getProducts()
|
|
48
|
+
* return (
|
|
49
|
+
* <>
|
|
50
|
+
* <CacheHints stale={data.isDraft ? 0 : 300} />
|
|
51
|
+
* <ProductList items={data.items} />
|
|
52
|
+
* </>
|
|
53
|
+
* )
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function CacheHints(props: CacheHintsProps): import("react").JSX.Element;
|
|
58
|
+
//# sourceMappingURL=cache-hints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-hints.d.ts","sourceRoot":"","sources":["../../src/components/cache-hints.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,cAAc,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,MAAM,WAAW,eAAe;IAC/B;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;IACpC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAA;IACvC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;CAC/C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,+BAOhD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CacheHintsMarker } from "./cache-hints-marker.js";
|
|
3
|
+
/**
|
|
4
|
+
* Declares cache hints for the route segment (page, layout, or not-found)
|
|
5
|
+
* that renders it. Use it to tell the client router how long it can keep
|
|
6
|
+
* serving a segment's cached RSC payload before revalidating.
|
|
7
|
+
*
|
|
8
|
+
* Must be rendered from a server component.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* export default async function ProductsPage() {
|
|
13
|
+
* const data = await getProducts()
|
|
14
|
+
* return (
|
|
15
|
+
* <>
|
|
16
|
+
* <CacheHints stale={data.isDraft ? 0 : 300} />
|
|
17
|
+
* <ProductList items={data.items} />
|
|
18
|
+
* </>
|
|
19
|
+
* )
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function CacheHints(props) {
|
|
24
|
+
if (typeof window !== "undefined") {
|
|
25
|
+
throw new Error("<CacheHints> can only be used inside a server component.");
|
|
26
|
+
}
|
|
27
|
+
return (_jsx(CacheHintsMarker, { stale: props.stale, tags: props.tags, mustRevalidate: props.mustRevalidate }));
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { RouterCache } from "../lib/router-cache.js";
|
|
3
|
+
export declare function RouterCacheProvider({ value, children, }: {
|
|
4
|
+
value: RouterCache;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
export declare function useRouterCache(): RouterCache;
|
|
8
|
+
export declare function CacheSlot(props: {
|
|
9
|
+
cache: RouterCache;
|
|
10
|
+
}): ReactNode;
|
|
11
|
+
export declare function CacheSlot(props: {
|
|
12
|
+
slotKey: string;
|
|
13
|
+
}): ReactNode;
|
|
14
|
+
//# sourceMappingURL=cache-slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-slot.d.ts","sourceRoot":"","sources":["../../src/components/cache-slot.tsx"],"names":[],"mappings":"AAGA,OAAO,EAGN,KAAK,SAAS,EAMd,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAmBzD,wBAAgB,mBAAmB,CAAC,EACnC,KAAK,EACL,QAAQ,GACR,EAAE;IACF,KAAK,EAAE,WAAW,CAAA;IAClB,QAAQ,EAAE,SAAS,CAAA;CACnB,+BAEA;AAED,wBAAgB,cAAc,gBAI7B;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,WAAW,CAAA;CAAE,GAAG,SAAS,CAAA;AACnE,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Activity, createContext, startTransition, useContext, useEffect, useState, useSyncExternalStore, } from "react";
|
|
4
|
+
import { SegmentBoundary } from "./segment-boundary.js";
|
|
5
|
+
// We duplicate the `useAtom` hook to use `atom.get` as the third parameter
|
|
6
|
+
// of `useSyncExternalStore` instead of `atom.getInitial`. Without that we can't
|
|
7
|
+
// update the atom value on the server side when doing SSR.
|
|
8
|
+
function useAtom(atom) {
|
|
9
|
+
const value = useSyncExternalStore(atom.sub, atom.get, atom.get);
|
|
10
|
+
return [value, atom.set];
|
|
11
|
+
}
|
|
12
|
+
const RouterCacheContext = createContext(null);
|
|
13
|
+
export function RouterCacheProvider({ value, children, }) {
|
|
14
|
+
return _jsx(RouterCacheContext.Provider, { value: value, children: children });
|
|
15
|
+
}
|
|
16
|
+
export function useRouterCache() {
|
|
17
|
+
const cache = useContext(RouterCacheContext);
|
|
18
|
+
if (!cache)
|
|
19
|
+
throw new Error("useRouterCache must be used within a RouterCacheProvider");
|
|
20
|
+
return cache;
|
|
21
|
+
}
|
|
22
|
+
export function CacheSlot({ cache: cacheProp, slotKey = "" }) {
|
|
23
|
+
const cacheFromContext = useRouterCache();
|
|
24
|
+
const cache = cacheProp || cacheFromContext;
|
|
25
|
+
const cacheNode = cache.getNodeFromSlotKey(slotKey);
|
|
26
|
+
const [slots] = useAtom(cacheNode.slots);
|
|
27
|
+
if (slots.length === 0)
|
|
28
|
+
return null;
|
|
29
|
+
return slots.map((slotAtom) => (_jsx(SlotContent, { slotAtom: slotAtom }, cache.getSlotReactKey(slotAtom))));
|
|
30
|
+
}
|
|
31
|
+
function SlotContent({ slotAtom }) {
|
|
32
|
+
const [slot] = useAtom(slotAtom);
|
|
33
|
+
const [content, setContent] = useState(slot.content);
|
|
34
|
+
if (!slot.retainContent && content !== slot.content)
|
|
35
|
+
setContent(slot.content);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
// Keep the current content visible if the replacement suspends above its own Suspense boundaries.
|
|
38
|
+
if (slot.retainContent)
|
|
39
|
+
startTransition(() => setContent(slot.content));
|
|
40
|
+
}, [slot.content, slot.retainContent]);
|
|
41
|
+
return (_jsx(Activity, { mode: slot.active ? "visible" : "hidden", children: _jsx(SegmentBoundary, { path: slot.key, children: content }) }));
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../src/components/delay.tsx"],"names":[],"mappings":"AAOA,wBAAgB,KAAK,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;CAAE,+BAM3D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense, use } from "react";
|
|
3
|
+
function DelayContent({ promise }) {
|
|
4
|
+
use(promise);
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
export function Delay({ promise }) {
|
|
8
|
+
return (_jsx(Suspense, { children: _jsx(DelayContent, { promise: promise }) }));
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-overlay.d.ts","sourceRoot":"","sources":["../../src/components/dev-overlay.tsx"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,uCAgGzB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { reportDevtoolsError, showViteErrorOverlay } from "../lib/vite-error-overlay.js";
|
|
4
|
+
export function DevOverlay() {
|
|
5
|
+
const [warning, setWarning] = useState(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const onWindowError = (event) => {
|
|
8
|
+
if (event.error) {
|
|
9
|
+
reportDevtoolsError(event.error);
|
|
10
|
+
showViteErrorOverlay(event.error);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const onUnhandledRejection = (event) => {
|
|
14
|
+
reportDevtoolsError(event.reason);
|
|
15
|
+
};
|
|
16
|
+
const removeWindowListeners = () => {
|
|
17
|
+
window.removeEventListener("error", onWindowError);
|
|
18
|
+
window.removeEventListener("unhandledrejection", onUnhandledRejection);
|
|
19
|
+
};
|
|
20
|
+
window.addEventListener("error", onWindowError);
|
|
21
|
+
window.addEventListener("unhandledrejection", onUnhandledRejection);
|
|
22
|
+
if (!import.meta.hot)
|
|
23
|
+
return removeWindowListeners;
|
|
24
|
+
const onWarning = (data) => {
|
|
25
|
+
setWarning(data.message);
|
|
26
|
+
};
|
|
27
|
+
const onDevError = (data) => {
|
|
28
|
+
const error = new Error(data.message);
|
|
29
|
+
if (data.guidance) {
|
|
30
|
+
error.stack = [data.stack, `[rebask] ${data.guidance}`].filter(Boolean).join("\n\n");
|
|
31
|
+
}
|
|
32
|
+
else if (data.stack) {
|
|
33
|
+
error.stack = data.stack;
|
|
34
|
+
}
|
|
35
|
+
console.error(error);
|
|
36
|
+
showViteErrorOverlay(error);
|
|
37
|
+
};
|
|
38
|
+
// Rebask DevTools lists warnings in its messages, so the warning button is only a fallback.
|
|
39
|
+
if (!__REBASK_DEVTOOLS)
|
|
40
|
+
import.meta.hot.on("rebask:warning", onWarning);
|
|
41
|
+
// Listen for dev error updates
|
|
42
|
+
import.meta.hot.on("rebask:error", onDevError);
|
|
43
|
+
// Signal to server that we're ready to receive warnings
|
|
44
|
+
import.meta.hot.send("rebask:overlay-ready", {});
|
|
45
|
+
return () => {
|
|
46
|
+
removeWindowListeners();
|
|
47
|
+
import.meta.hot?.off("rebask:warning", onWarning);
|
|
48
|
+
import.meta.hot?.off("rebask:error", onDevError);
|
|
49
|
+
};
|
|
50
|
+
}, []);
|
|
51
|
+
if (!warning)
|
|
52
|
+
return null;
|
|
53
|
+
const styles = `
|
|
54
|
+
.rebask-warning-btn {
|
|
55
|
+
position: fixed;
|
|
56
|
+
bottom: 20px;
|
|
57
|
+
right: 20px;
|
|
58
|
+
z-index: 999999;
|
|
59
|
+
width: 48px;
|
|
60
|
+
height: 48px;
|
|
61
|
+
border-radius: 50%;
|
|
62
|
+
border: none;
|
|
63
|
+
background: #ff5555;
|
|
64
|
+
color: white;
|
|
65
|
+
font-size: 20px;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
pointer-events: auto;
|
|
68
|
+
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
|
|
69
|
+
transition: transform 0.2s, box-shadow 0.2s;
|
|
70
|
+
}
|
|
71
|
+
.rebask-warning-btn:hover {
|
|
72
|
+
transform: scale(1.1);
|
|
73
|
+
box-shadow: 0 6px 16px rgba(0,0,0,0.4);
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
return (_jsxs(_Fragment, { children: [_jsx("style", { children: styles }), _jsx("button", { "data-testid": "rebask-dev-overlay", type: "button", className: "rebask-warning-btn", onClick: () => {
|
|
77
|
+
showViteErrorOverlay(warning);
|
|
78
|
+
}, title: "Rebask Development Warning (click for details)", children: "!" })] }));
|
|
79
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Component, type ReactNode } from "react";
|
|
2
|
+
import type { RevisionSnapshot, RouterCache } from "../lib/router-cache.js";
|
|
3
|
+
type BoundaryRenderProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
fallback: ReactNode;
|
|
6
|
+
hasError?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type BoundaryClientProps = BoundaryRenderProps & {
|
|
9
|
+
boundaryKey: string;
|
|
10
|
+
};
|
|
11
|
+
type BoundaryCacheState = {
|
|
12
|
+
boundaryKey: string;
|
|
13
|
+
segmentPath: string;
|
|
14
|
+
snapshot: RevisionSnapshot;
|
|
15
|
+
failed: boolean;
|
|
16
|
+
};
|
|
17
|
+
type ErrorBoundaryClientInnerProps = BoundaryRenderProps & BoundaryCacheState;
|
|
18
|
+
type BoundaryCacheStateResult = BoundaryCacheState & {
|
|
19
|
+
acceptsServerError: boolean;
|
|
20
|
+
};
|
|
21
|
+
type ErrorBoundaryClientState = {
|
|
22
|
+
hasError: boolean;
|
|
23
|
+
snapshot: RevisionSnapshot;
|
|
24
|
+
};
|
|
25
|
+
export declare class ErrorBoundaryClientInner extends Component<ErrorBoundaryClientInnerProps, ErrorBoundaryClientState> {
|
|
26
|
+
static contextType: import("react").Context<RouterCache | null>;
|
|
27
|
+
context: RouterCache | null;
|
|
28
|
+
state: ErrorBoundaryClientState;
|
|
29
|
+
constructor(props: ErrorBoundaryClientInnerProps);
|
|
30
|
+
static getDerivedStateFromProps(props: ErrorBoundaryClientInnerProps, state: ErrorBoundaryClientState): {
|
|
31
|
+
hasError: boolean;
|
|
32
|
+
snapshot: RevisionSnapshot;
|
|
33
|
+
} | {
|
|
34
|
+
snapshot?: undefined;
|
|
35
|
+
hasError: boolean;
|
|
36
|
+
} | null;
|
|
37
|
+
static getDerivedStateFromError(error: Error): {
|
|
38
|
+
hasError: boolean;
|
|
39
|
+
};
|
|
40
|
+
componentDidMount(): void;
|
|
41
|
+
componentDidUpdate(_prevProps: ErrorBoundaryClientInnerProps, prevState: ErrorBoundaryClientState): void;
|
|
42
|
+
componentDidCatch(error: Error): void;
|
|
43
|
+
render(): ReactNode;
|
|
44
|
+
protected recordFailure(): void;
|
|
45
|
+
}
|
|
46
|
+
export declare function ErrorBoundaryClient(props: BoundaryClientProps): import("react").JSX.Element;
|
|
47
|
+
export declare function useBoundaryCacheState(boundaryKey: string): BoundaryCacheStateResult;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=error-boundary-client.d.ts.map
|