vinext 0.0.50 → 0.0.52
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/dist/build/google-fonts/fallback-metrics-data.js +14031 -0
- package/dist/build/google-fonts/fallback-metrics-data.js.map +1 -0
- package/dist/build/google-fonts/fallback-metrics.d.ts +13 -0
- package/dist/build/google-fonts/fallback-metrics.js +46 -0
- package/dist/build/google-fonts/fallback-metrics.js.map +1 -0
- package/dist/build/precompress.d.ts +13 -2
- package/dist/build/precompress.js +23 -13
- package/dist/build/precompress.js.map +1 -1
- package/dist/build/prerender.d.ts +4 -15
- package/dist/build/prerender.js +83 -53
- package/dist/build/prerender.js.map +1 -1
- package/dist/build/report.d.ts +5 -4
- package/dist/build/report.js +196 -348
- package/dist/build/report.js.map +1 -1
- package/dist/check.js +5 -0
- package/dist/check.js.map +1 -1
- package/dist/cli-args.d.ts +1 -0
- package/dist/cli-args.js +5 -0
- package/dist/cli-args.js.map +1 -1
- package/dist/cli.js +99 -3
- package/dist/cli.js.map +1 -1
- package/dist/client/navigation-runtime.d.ts +47 -0
- package/dist/client/navigation-runtime.js +156 -0
- package/dist/client/navigation-runtime.js.map +1 -0
- package/dist/client/pages-router-link-navigation.d.ts +26 -0
- package/dist/client/pages-router-link-navigation.js +14 -0
- package/dist/client/pages-router-link-navigation.js.map +1 -0
- package/dist/client/vinext-next-data.d.ts +12 -2
- package/dist/client/vinext-next-data.js +50 -1
- package/dist/client/vinext-next-data.js.map +1 -0
- package/dist/client/window-next.d.ts +3 -1
- package/dist/client/window-next.js.map +1 -1
- package/dist/cloudflare/kv-cache-handler.js +2 -1
- package/dist/cloudflare/kv-cache-handler.js.map +1 -1
- package/dist/config/config-matchers.d.ts +63 -16
- package/dist/config/config-matchers.js +143 -8
- package/dist/config/config-matchers.js.map +1 -1
- package/dist/config/dotenv.d.ts +11 -1
- package/dist/config/dotenv.js.map +1 -1
- package/dist/config/next-config.d.ts +107 -5
- package/dist/config/next-config.js +233 -7
- package/dist/config/next-config.js.map +1 -1
- package/dist/config/tsconfig-paths.d.ts +13 -0
- package/dist/config/tsconfig-paths.js +117 -0
- package/dist/config/tsconfig-paths.js.map +1 -0
- package/dist/deploy.js +104 -41
- package/dist/deploy.js.map +1 -1
- package/dist/entries/app-browser-entry.d.ts +2 -2
- package/dist/entries/app-browser-entry.js +34 -3
- package/dist/entries/app-browser-entry.js.map +1 -1
- package/dist/entries/app-rsc-entry.d.ts +19 -1
- package/dist/entries/app-rsc-entry.js +89 -23
- package/dist/entries/app-rsc-entry.js.map +1 -1
- package/dist/entries/app-rsc-manifest.d.ts +10 -0
- package/dist/entries/app-rsc-manifest.js +57 -7
- package/dist/entries/app-rsc-manifest.js.map +1 -1
- package/dist/entries/app-ssr-entry.d.ts +3 -3
- package/dist/entries/app-ssr-entry.js +4 -4
- package/dist/entries/app-ssr-entry.js.map +1 -1
- package/dist/entries/pages-client-entry.js +21 -7
- package/dist/entries/pages-client-entry.js.map +1 -1
- package/dist/entries/pages-server-entry.js +77 -9
- package/dist/entries/pages-server-entry.js.map +1 -1
- package/dist/entries/runtime-entry-module.d.ts +2 -1
- package/dist/entries/runtime-entry-module.js +9 -3
- package/dist/entries/runtime-entry-module.js.map +1 -1
- package/dist/index.js +260 -75
- package/dist/index.js.map +1 -1
- package/dist/plugins/client-reference-dedup.d.ts +15 -2
- package/dist/plugins/client-reference-dedup.js +138 -16
- package/dist/plugins/client-reference-dedup.js.map +1 -1
- package/dist/plugins/css-data-url.d.ts +7 -0
- package/dist/plugins/css-data-url.js +81 -0
- package/dist/plugins/css-data-url.js.map +1 -0
- package/dist/plugins/fonts.d.ts +2 -2
- package/dist/plugins/fonts.js +20 -9
- package/dist/plugins/fonts.js.map +1 -1
- package/dist/plugins/middleware-server-only.d.ts +54 -0
- package/dist/plugins/middleware-server-only.js +91 -0
- package/dist/plugins/middleware-server-only.js.map +1 -0
- package/dist/plugins/optimize-imports.js +4 -4
- package/dist/plugins/optimize-imports.js.map +1 -1
- package/dist/plugins/sass.d.ts +34 -0
- package/dist/plugins/sass.js +22 -0
- package/dist/plugins/sass.js.map +1 -0
- package/dist/plugins/strip-server-exports.js +5 -8
- package/dist/plugins/strip-server-exports.js.map +1 -1
- package/dist/routing/app-route-graph.d.ts +50 -2
- package/dist/routing/app-route-graph.js +140 -16
- package/dist/routing/app-route-graph.js.map +1 -1
- package/dist/routing/app-router.d.ts +2 -2
- package/dist/routing/app-router.js +2 -2
- package/dist/routing/app-router.js.map +1 -1
- package/dist/routing/route-pattern.d.ts +56 -1
- package/dist/routing/route-pattern.js +60 -1
- package/dist/routing/route-pattern.js.map +1 -1
- package/dist/routing/utils.d.ts +2 -1
- package/dist/routing/utils.js +4 -1
- package/dist/routing/utils.js.map +1 -1
- package/dist/server/api-handler.js +139 -37
- package/dist/server/api-handler.js.map +1 -1
- package/dist/server/app-browser-action-result.d.ts +27 -2
- package/dist/server/app-browser-action-result.js +63 -2
- package/dist/server/app-browser-action-result.js.map +1 -1
- package/dist/server/app-browser-entry.js +493 -195
- package/dist/server/app-browser-entry.js.map +1 -1
- package/dist/server/app-browser-hydration.d.ts +13 -1
- package/dist/server/app-browser-hydration.js +9 -1
- package/dist/server/app-browser-hydration.js.map +1 -1
- package/dist/server/app-browser-interception-context.d.ts +24 -0
- package/dist/server/app-browser-interception-context.js +32 -0
- package/dist/server/app-browser-interception-context.js.map +1 -0
- package/dist/server/app-browser-navigation-controller.d.ts +17 -2
- package/dist/server/app-browser-navigation-controller.js +33 -10
- package/dist/server/app-browser-navigation-controller.js.map +1 -1
- package/dist/server/app-browser-popstate.d.ts +16 -0
- package/dist/server/app-browser-popstate.js +17 -0
- package/dist/server/app-browser-popstate.js.map +1 -0
- package/dist/server/app-browser-rsc-redirect.d.ts +29 -0
- package/dist/server/app-browser-rsc-redirect.js +37 -0
- package/dist/server/app-browser-rsc-redirect.js.map +1 -0
- package/dist/server/app-browser-state.d.ts +28 -7
- package/dist/server/app-browser-state.js +63 -27
- package/dist/server/app-browser-state.js.map +1 -1
- package/dist/server/app-browser-stream.d.ts +9 -17
- package/dist/server/app-browser-stream.js +18 -13
- package/dist/server/app-browser-stream.js.map +1 -1
- package/dist/server/app-browser-visible-commit.d.ts +7 -1
- package/dist/server/app-browser-visible-commit.js +39 -5
- package/dist/server/app-browser-visible-commit.js.map +1 -1
- package/dist/server/app-elements-wire.d.ts +43 -6
- package/dist/server/app-elements-wire.js +189 -7
- package/dist/server/app-elements-wire.js.map +1 -1
- package/dist/server/app-elements.d.ts +3 -2
- package/dist/server/app-elements.js +3 -2
- package/dist/server/app-elements.js.map +1 -1
- package/dist/server/app-fallback-renderer.d.ts +10 -1
- package/dist/server/app-fallback-renderer.js +41 -3
- package/dist/server/app-fallback-renderer.js.map +1 -1
- package/dist/server/app-history-state.d.ts +26 -0
- package/dist/server/app-history-state.js +53 -0
- package/dist/server/app-history-state.js.map +1 -0
- package/dist/server/app-middleware.d.ts +13 -0
- package/dist/server/app-middleware.js +3 -1
- package/dist/server/app-middleware.js.map +1 -1
- package/dist/server/app-optimistic-routing.d.ts +54 -0
- package/dist/server/app-optimistic-routing.js +200 -0
- package/dist/server/app-optimistic-routing.js.map +1 -0
- package/dist/server/app-page-boundary-render.d.ts +10 -1
- package/dist/server/app-page-boundary-render.js +13 -6
- package/dist/server/app-page-boundary-render.js.map +1 -1
- package/dist/server/app-page-boundary.js +3 -2
- package/dist/server/app-page-boundary.js.map +1 -1
- package/dist/server/app-page-cache.d.ts +26 -1
- package/dist/server/app-page-cache.js +86 -14
- package/dist/server/app-page-cache.js.map +1 -1
- package/dist/server/app-page-dispatch.d.ts +7 -0
- package/dist/server/app-page-dispatch.js +96 -12
- package/dist/server/app-page-dispatch.js.map +1 -1
- package/dist/server/app-page-element-builder.d.ts +7 -0
- package/dist/server/app-page-element-builder.js +34 -5
- package/dist/server/app-page-element-builder.js.map +1 -1
- package/dist/server/app-page-execution.d.ts +28 -1
- package/dist/server/app-page-execution.js +91 -7
- package/dist/server/app-page-execution.js.map +1 -1
- package/dist/server/app-page-head.d.ts +7 -0
- package/dist/server/app-page-head.js +23 -3
- package/dist/server/app-page-head.js.map +1 -1
- package/dist/server/app-page-probe.d.ts +23 -1
- package/dist/server/app-page-probe.js +29 -1
- package/dist/server/app-page-probe.js.map +1 -1
- package/dist/server/app-page-render-observation.d.ts +35 -0
- package/dist/server/app-page-render-observation.js +68 -0
- package/dist/server/app-page-render-observation.js.map +1 -0
- package/dist/server/app-page-render.d.ts +7 -1
- package/dist/server/app-page-render.js +81 -4
- package/dist/server/app-page-render.js.map +1 -1
- package/dist/server/app-page-request.d.ts +1 -0
- package/dist/server/app-page-request.js.map +1 -1
- package/dist/server/app-page-response.js +7 -5
- package/dist/server/app-page-response.js.map +1 -1
- package/dist/server/app-page-route-wiring.d.ts +3 -1
- package/dist/server/app-page-route-wiring.js +59 -24
- package/dist/server/app-page-route-wiring.js.map +1 -1
- package/dist/server/app-page-stream.d.ts +5 -0
- package/dist/server/app-page-stream.js +2 -0
- package/dist/server/app-page-stream.js.map +1 -1
- package/dist/server/app-prerender-static-params.d.ts +2 -1
- package/dist/server/app-prerender-static-params.js +44 -8
- package/dist/server/app-prerender-static-params.js.map +1 -1
- package/dist/server/app-route-handler-cache.d.ts +2 -2
- package/dist/server/app-route-handler-cache.js +3 -2
- package/dist/server/app-route-handler-cache.js.map +1 -1
- package/dist/server/app-route-handler-dispatch.d.ts +6 -1
- package/dist/server/app-route-handler-dispatch.js +1 -1
- package/dist/server/app-route-handler-dispatch.js.map +1 -1
- package/dist/server/app-route-handler-execution.d.ts +17 -2
- package/dist/server/app-route-handler-execution.js.map +1 -1
- package/dist/server/app-route-handler-response.js +5 -4
- package/dist/server/app-route-handler-response.js.map +1 -1
- package/dist/server/app-router-entry.js +7 -15
- package/dist/server/app-router-entry.js.map +1 -1
- package/dist/server/app-rsc-cache-busting.d.ts +19 -1
- package/dist/server/app-rsc-cache-busting.js +36 -1
- package/dist/server/app-rsc-cache-busting.js.map +1 -1
- package/dist/server/app-rsc-embedded-chunks.d.ts +9 -0
- package/dist/server/app-rsc-embedded-chunks.js +34 -0
- package/dist/server/app-rsc-embedded-chunks.js.map +1 -0
- package/dist/server/app-rsc-errors.d.ts +4 -1
- package/dist/server/app-rsc-errors.js +1 -1
- package/dist/server/app-rsc-errors.js.map +1 -1
- package/dist/server/app-rsc-handler.d.ts +21 -5
- package/dist/server/app-rsc-handler.js +38 -15
- package/dist/server/app-rsc-handler.js.map +1 -1
- package/dist/server/app-rsc-render-mode.d.ts +4 -3
- package/dist/server/app-rsc-render-mode.js +7 -1
- package/dist/server/app-rsc-render-mode.js.map +1 -1
- package/dist/server/app-rsc-request-normalization.d.ts +4 -1
- package/dist/server/app-rsc-request-normalization.js +4 -1
- package/dist/server/app-rsc-request-normalization.js.map +1 -1
- package/dist/server/app-rsc-response-finalizer.d.ts +8 -1
- package/dist/server/app-rsc-response-finalizer.js +10 -3
- package/dist/server/app-rsc-response-finalizer.js.map +1 -1
- package/dist/server/app-rsc-route-matching.d.ts +23 -0
- package/dist/server/app-rsc-route-matching.js +47 -25
- package/dist/server/app-rsc-route-matching.js.map +1 -1
- package/dist/server/app-server-action-execution.d.ts +35 -3
- package/dist/server/app-server-action-execution.js +87 -33
- package/dist/server/app-server-action-execution.js.map +1 -1
- package/dist/server/app-ssr-entry.d.ts +3 -0
- package/dist/server/app-ssr-entry.js +83 -58
- package/dist/server/app-ssr-entry.js.map +1 -1
- package/dist/server/app-ssr-error-meta.d.ts +14 -0
- package/dist/server/app-ssr-error-meta.js +50 -0
- package/dist/server/app-ssr-error-meta.js.map +1 -0
- package/dist/server/app-ssr-stream.d.ts +7 -2
- package/dist/server/app-ssr-stream.js +26 -15
- package/dist/server/app-ssr-stream.js.map +1 -1
- package/dist/server/artifact-compatibility.d.ts +13 -3
- package/dist/server/artifact-compatibility.js +12 -8
- package/dist/server/artifact-compatibility.js.map +1 -1
- package/dist/server/cache-headers.d.ts +7 -0
- package/dist/server/cache-headers.js +19 -0
- package/dist/server/cache-headers.js.map +1 -0
- package/dist/server/cache-proof.d.ts +170 -5
- package/dist/server/cache-proof.js +472 -18
- package/dist/server/cache-proof.js.map +1 -1
- package/dist/server/client-reuse-manifest.d.ts +99 -0
- package/dist/server/client-reuse-manifest.js +212 -0
- package/dist/server/client-reuse-manifest.js.map +1 -0
- package/dist/server/default-global-error-module.d.ts +20 -0
- package/dist/server/default-global-error-module.js +20 -0
- package/dist/server/default-global-error-module.js.map +1 -0
- package/dist/server/dev-lockfile.d.ts +110 -0
- package/dist/server/dev-lockfile.js +180 -0
- package/dist/server/dev-lockfile.js.map +1 -0
- package/dist/server/dev-server.d.ts +9 -1
- package/dist/server/dev-server.js +76 -19
- package/dist/server/dev-server.js.map +1 -1
- package/dist/server/edge-api-runtime.d.ts +5 -0
- package/dist/server/edge-api-runtime.js +8 -0
- package/dist/server/edge-api-runtime.js.map +1 -0
- package/dist/server/file-based-metadata.d.ts +13 -0
- package/dist/server/file-based-metadata.js +49 -2
- package/dist/server/file-based-metadata.js.map +1 -1
- package/dist/server/headers.d.ts +20 -1
- package/dist/server/headers.js +22 -2
- package/dist/server/headers.js.map +1 -1
- package/dist/server/html.js +1 -1
- package/dist/server/html.js.map +1 -1
- package/dist/server/http-error-responses.d.ts +26 -1
- package/dist/server/http-error-responses.js +32 -2
- package/dist/server/http-error-responses.js.map +1 -1
- package/dist/server/isr-cache.d.ts +8 -3
- package/dist/server/isr-cache.js +24 -6
- package/dist/server/isr-cache.js.map +1 -1
- package/dist/server/metadata-route-response.js +22 -5
- package/dist/server/metadata-route-response.js.map +1 -1
- package/dist/server/metadata-routes.js +27 -8
- package/dist/server/metadata-routes.js.map +1 -1
- package/dist/server/middleware-runtime.d.ts +15 -0
- package/dist/server/middleware-runtime.js +60 -7
- package/dist/server/middleware-runtime.js.map +1 -1
- package/dist/server/middleware.d.ts +13 -1
- package/dist/server/middleware.js +16 -2
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/navigation-planner.d.ts +26 -6
- package/dist/server/navigation-planner.js +358 -24
- package/dist/server/navigation-planner.js.map +1 -1
- package/dist/server/navigation-trace.d.ts +9 -1
- package/dist/server/navigation-trace.js +8 -0
- package/dist/server/navigation-trace.js.map +1 -1
- package/dist/server/normalize-path.d.ts +2 -1
- package/dist/server/normalize-path.js +4 -1
- package/dist/server/normalize-path.js.map +1 -1
- package/dist/server/pages-api-route.d.ts +27 -1
- package/dist/server/pages-api-route.js +25 -3
- package/dist/server/pages-api-route.js.map +1 -1
- package/dist/server/pages-data-route.d.ts +77 -0
- package/dist/server/pages-data-route.js +97 -0
- package/dist/server/pages-data-route.js.map +1 -0
- package/dist/server/pages-i18n.d.ts +51 -1
- package/dist/server/pages-i18n.js +61 -1
- package/dist/server/pages-i18n.js.map +1 -1
- package/dist/server/pages-page-data.d.ts +32 -4
- package/dist/server/pages-page-data.js +52 -19
- package/dist/server/pages-page-data.js.map +1 -1
- package/dist/server/pages-page-response.d.ts +11 -1
- package/dist/server/pages-page-response.js +6 -4
- package/dist/server/pages-page-response.js.map +1 -1
- package/dist/server/prod-server.d.ts +26 -1
- package/dist/server/prod-server.js +150 -44
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/request-pipeline.d.ts +11 -2
- package/dist/server/request-pipeline.js +28 -11
- package/dist/server/request-pipeline.js.map +1 -1
- package/dist/server/seed-cache.d.ts +12 -31
- package/dist/server/seed-cache.js +22 -35
- package/dist/server/seed-cache.js.map +1 -1
- package/dist/server/server-action-not-found.d.ts +16 -3
- package/dist/server/server-action-not-found.js +27 -4
- package/dist/server/server-action-not-found.js.map +1 -1
- package/dist/server/server-globals.d.ts +5 -0
- package/dist/server/server-globals.js +37 -0
- package/dist/server/server-globals.js.map +1 -0
- package/dist/server/skip-cache-proof.d.ts +41 -0
- package/dist/server/skip-cache-proof.js +101 -0
- package/dist/server/skip-cache-proof.js.map +1 -0
- package/dist/server/static-file-cache.d.ts +1 -1
- package/dist/server/static-file-cache.js +7 -6
- package/dist/server/static-file-cache.js.map +1 -1
- package/dist/shims/cache-runtime.d.ts +19 -2
- package/dist/shims/cache-runtime.js +67 -11
- package/dist/shims/cache-runtime.js.map +1 -1
- package/dist/shims/cache.d.ts +5 -18
- package/dist/shims/cache.js +2 -0
- package/dist/shims/cache.js.map +1 -1
- package/dist/shims/client-locale.d.ts +15 -0
- package/dist/shims/client-locale.js +13 -0
- package/dist/shims/client-locale.js.map +1 -0
- package/dist/shims/default-global-error.d.ts +32 -0
- package/dist/shims/default-global-error.js +181 -0
- package/dist/shims/default-global-error.js.map +1 -0
- package/dist/shims/document.d.ts +59 -3
- package/dist/shims/document.js +36 -5
- package/dist/shims/document.js.map +1 -1
- package/dist/shims/error-boundary.d.ts +2 -2
- package/dist/shims/error-boundary.js +6 -8
- package/dist/shims/error-boundary.js.map +1 -1
- package/dist/shims/error.d.ts +18 -1
- package/dist/shims/error.js +56 -1
- package/dist/shims/error.js.map +1 -1
- package/dist/shims/fetch-cache.d.ts +4 -1
- package/dist/shims/fetch-cache.js +40 -5
- package/dist/shims/fetch-cache.js.map +1 -1
- package/dist/shims/font-google-base.d.ts +22 -8
- package/dist/shims/font-google-base.js +41 -71
- package/dist/shims/font-google-base.js.map +1 -1
- package/dist/shims/font-local.d.ts +3 -20
- package/dist/shims/font-local.js +23 -75
- package/dist/shims/font-local.js.map +1 -1
- package/dist/shims/font-utils.d.ts +51 -0
- package/dist/shims/font-utils.js +97 -0
- package/dist/shims/font-utils.js.map +1 -0
- package/dist/shims/form.js +13 -6
- package/dist/shims/form.js.map +1 -1
- package/dist/shims/hash-scroll.d.ts +7 -0
- package/dist/shims/hash-scroll.js +30 -0
- package/dist/shims/hash-scroll.js.map +1 -0
- package/dist/shims/headers.d.ts +8 -11
- package/dist/shims/headers.js +22 -2
- package/dist/shims/headers.js.map +1 -1
- package/dist/shims/image.d.ts +1 -0
- package/dist/shims/image.js +144 -78
- package/dist/shims/image.js.map +1 -1
- package/dist/shims/internal/app-router-context.d.ts +6 -6
- package/dist/shims/internal/app-router-context.js +17 -6
- package/dist/shims/internal/app-router-context.js.map +1 -1
- package/dist/shims/link-prefetch.d.ts +9 -1
- package/dist/shims/link-prefetch.js +11 -6
- package/dist/shims/link-prefetch.js.map +1 -1
- package/dist/shims/link.d.ts +33 -5
- package/dist/shims/link.js +205 -50
- package/dist/shims/link.js.map +1 -1
- package/dist/shims/metadata.d.ts +16 -30
- package/dist/shims/metadata.js +91 -32
- package/dist/shims/metadata.js.map +1 -1
- package/dist/shims/navigation.d.ts +164 -17
- package/dist/shims/navigation.js +355 -84
- package/dist/shims/navigation.js.map +1 -1
- package/dist/shims/navigation.react-server.d.ts +3 -2
- package/dist/shims/navigation.react-server.js +5 -2
- package/dist/shims/navigation.react-server.js.map +1 -1
- package/dist/shims/og.d.ts +18 -2
- package/dist/shims/og.js +49 -1
- package/dist/shims/og.js.map +1 -0
- package/dist/shims/pages-router-runtime.d.ts +7 -0
- package/dist/shims/pages-router-runtime.js +16 -0
- package/dist/shims/pages-router-runtime.js.map +1 -0
- package/dist/shims/request-state-types.d.ts +1 -1
- package/dist/shims/root-params.d.ts +3 -1
- package/dist/shims/root-params.js +11 -3
- package/dist/shims/root-params.js.map +1 -1
- package/dist/shims/router-state.d.ts +1 -0
- package/dist/shims/router-state.js.map +1 -1
- package/dist/shims/router.d.ts +40 -7
- package/dist/shims/router.js +355 -250
- package/dist/shims/router.js.map +1 -1
- package/dist/shims/script.js +110 -32
- package/dist/shims/script.js.map +1 -1
- package/dist/shims/server.d.ts +21 -4
- package/dist/shims/server.js +31 -10
- package/dist/shims/server.js.map +1 -1
- package/dist/shims/slot.d.ts +1 -0
- package/dist/shims/slot.js +45 -1
- package/dist/shims/slot.js.map +1 -1
- package/dist/shims/unified-request-context.d.ts +1 -1
- package/dist/shims/unified-request-context.js +2 -0
- package/dist/shims/unified-request-context.js.map +1 -1
- package/dist/shims/unrecognized-action-error.d.ts +35 -0
- package/dist/shims/unrecognized-action-error.js +41 -0
- package/dist/shims/unrecognized-action-error.js.map +1 -0
- package/dist/shims/url-safety.d.ts +23 -1
- package/dist/shims/url-safety.js +29 -2
- package/dist/shims/url-safety.js.map +1 -1
- package/dist/shims/url-utils.d.ts +21 -1
- package/dist/shims/url-utils.js +67 -3
- package/dist/shims/url-utils.js.map +1 -1
- package/dist/typegen.d.ts +10 -0
- package/dist/typegen.js +242 -0
- package/dist/typegen.js.map +1 -0
- package/dist/utils/asset-prefix.d.ts +97 -0
- package/dist/utils/asset-prefix.js +124 -0
- package/dist/utils/asset-prefix.js.map +1 -0
- package/dist/utils/base-path.d.ts +7 -1
- package/dist/utils/base-path.js +10 -1
- package/dist/utils/base-path.js.map +1 -1
- package/dist/utils/cache-control-metadata.d.ts +2 -1
- package/dist/utils/cache-control-metadata.js +1 -3
- package/dist/utils/cache-control-metadata.js.map +1 -1
- package/dist/utils/domain-locale.d.ts +2 -1
- package/dist/utils/domain-locale.js +9 -1
- package/dist/utils/domain-locale.js.map +1 -1
- package/dist/utils/lazy-chunks.d.ts +1 -1
- package/dist/utils/lazy-chunks.js +1 -1
- package/dist/utils/lazy-chunks.js.map +1 -1
- package/dist/utils/navigation-signal.d.ts +1 -2
- package/dist/utils/navigation-signal.js +1 -1
- package/dist/utils/navigation-signal.js.map +1 -1
- package/dist/utils/prerender-output-paths.d.ts +15 -0
- package/dist/utils/prerender-output-paths.js +24 -0
- package/dist/utils/prerender-output-paths.js.map +1 -0
- package/dist/utils/query.d.ts +17 -1
- package/dist/utils/query.js +36 -1
- package/dist/utils/query.js.map +1 -1
- package/dist/utils/record.d.ts +5 -0
- package/dist/utils/record.js +8 -0
- package/dist/utils/record.js.map +1 -0
- package/dist/utils/sorted-array.d.ts +9 -0
- package/dist/utils/sorted-array.js +22 -0
- package/dist/utils/sorted-array.js.map +1 -0
- package/package.json +13 -5
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/shims/default-global-error.tsx
|
|
5
|
+
const errorStyles = {
|
|
6
|
+
container: {
|
|
7
|
+
fontFamily: "system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"",
|
|
8
|
+
height: "100vh",
|
|
9
|
+
display: "flex",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
justifyContent: "center"
|
|
12
|
+
},
|
|
13
|
+
card: {
|
|
14
|
+
marginTop: "-32px",
|
|
15
|
+
maxWidth: "325px",
|
|
16
|
+
padding: "32px 28px",
|
|
17
|
+
textAlign: "left"
|
|
18
|
+
},
|
|
19
|
+
icon: { marginBottom: "24px" },
|
|
20
|
+
title: {
|
|
21
|
+
fontSize: "24px",
|
|
22
|
+
fontWeight: 500,
|
|
23
|
+
letterSpacing: "-0.02em",
|
|
24
|
+
lineHeight: "32px",
|
|
25
|
+
margin: "0 0 12px 0",
|
|
26
|
+
color: "var(--next-error-title)"
|
|
27
|
+
},
|
|
28
|
+
message: {
|
|
29
|
+
fontSize: "14px",
|
|
30
|
+
fontWeight: 400,
|
|
31
|
+
lineHeight: "21px",
|
|
32
|
+
margin: "0 0 20px 0",
|
|
33
|
+
color: "var(--next-error-message)"
|
|
34
|
+
},
|
|
35
|
+
form: { margin: 0 },
|
|
36
|
+
buttonGroup: {
|
|
37
|
+
display: "flex",
|
|
38
|
+
gap: "8px",
|
|
39
|
+
alignItems: "center"
|
|
40
|
+
},
|
|
41
|
+
button: {
|
|
42
|
+
display: "inline-flex",
|
|
43
|
+
alignItems: "center",
|
|
44
|
+
justifyContent: "center",
|
|
45
|
+
height: "32px",
|
|
46
|
+
padding: "0 12px",
|
|
47
|
+
fontSize: "14px",
|
|
48
|
+
fontWeight: 500,
|
|
49
|
+
lineHeight: "20px",
|
|
50
|
+
borderRadius: "6px",
|
|
51
|
+
cursor: "pointer",
|
|
52
|
+
color: "var(--next-error-btn-text)",
|
|
53
|
+
background: "var(--next-error-btn-bg)",
|
|
54
|
+
border: "var(--next-error-btn-border)"
|
|
55
|
+
},
|
|
56
|
+
buttonSecondary: {
|
|
57
|
+
display: "inline-flex",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
justifyContent: "center",
|
|
60
|
+
height: "32px",
|
|
61
|
+
padding: "0 12px",
|
|
62
|
+
fontSize: "14px",
|
|
63
|
+
fontWeight: 500,
|
|
64
|
+
lineHeight: "20px",
|
|
65
|
+
borderRadius: "6px",
|
|
66
|
+
cursor: "pointer",
|
|
67
|
+
color: "var(--next-error-btn-secondary-text)",
|
|
68
|
+
background: "var(--next-error-btn-secondary-bg)",
|
|
69
|
+
border: "var(--next-error-btn-secondary-border)"
|
|
70
|
+
},
|
|
71
|
+
digestFooter: {
|
|
72
|
+
position: "fixed",
|
|
73
|
+
bottom: "32px",
|
|
74
|
+
left: "0",
|
|
75
|
+
right: "0",
|
|
76
|
+
textAlign: "center",
|
|
77
|
+
fontFamily: "ui-monospace,SFMono-Regular,\"SF Mono\",Menlo,Consolas,monospace",
|
|
78
|
+
fontSize: "12px",
|
|
79
|
+
lineHeight: "18px",
|
|
80
|
+
fontWeight: 400,
|
|
81
|
+
margin: "0",
|
|
82
|
+
color: "var(--next-error-digest)"
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const errorThemeCss = `
|
|
86
|
+
:root {
|
|
87
|
+
--next-error-bg: #fff;
|
|
88
|
+
--next-error-text: #171717;
|
|
89
|
+
--next-error-title: #171717;
|
|
90
|
+
--next-error-message: #171717;
|
|
91
|
+
--next-error-digest: #666666;
|
|
92
|
+
--next-error-btn-text: #fff;
|
|
93
|
+
--next-error-btn-bg: #171717;
|
|
94
|
+
--next-error-btn-border: none;
|
|
95
|
+
--next-error-btn-secondary-text: #171717;
|
|
96
|
+
--next-error-btn-secondary-bg: transparent;
|
|
97
|
+
--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);
|
|
98
|
+
}
|
|
99
|
+
@media (prefers-color-scheme: dark) {
|
|
100
|
+
:root {
|
|
101
|
+
--next-error-bg: #0a0a0a;
|
|
102
|
+
--next-error-text: #ededed;
|
|
103
|
+
--next-error-title: #ededed;
|
|
104
|
+
--next-error-message: #ededed;
|
|
105
|
+
--next-error-digest: #a0a0a0;
|
|
106
|
+
--next-error-btn-text: #0a0a0a;
|
|
107
|
+
--next-error-btn-bg: #ededed;
|
|
108
|
+
--next-error-btn-border: none;
|
|
109
|
+
--next-error-btn-secondary-text: #ededed;
|
|
110
|
+
--next-error-btn-secondary-bg: transparent;
|
|
111
|
+
--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }
|
|
115
|
+
`.replace(/\n\s*/g, "");
|
|
116
|
+
function WarningIcon() {
|
|
117
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
118
|
+
width: "32",
|
|
119
|
+
height: "32",
|
|
120
|
+
viewBox: "-0.2 -1.5 32 32",
|
|
121
|
+
fill: "none",
|
|
122
|
+
style: errorStyles.icon,
|
|
123
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
124
|
+
d: "M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z",
|
|
125
|
+
fill: "var(--next-error-title)"
|
|
126
|
+
})
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function handleBackClick() {
|
|
130
|
+
if (typeof window === "undefined") return;
|
|
131
|
+
if (window.history.length > 1) window.history.back();
|
|
132
|
+
else window.location.href = "/";
|
|
133
|
+
}
|
|
134
|
+
function DefaultGlobalError({ error }) {
|
|
135
|
+
const digest = error?.digest;
|
|
136
|
+
const isServerError = !!digest;
|
|
137
|
+
const message = isServerError ? "A server error occurred. Reload to try again." : "Reload to try again, or go back.";
|
|
138
|
+
return /* @__PURE__ */ jsxs("html", {
|
|
139
|
+
id: "__next_error__",
|
|
140
|
+
children: [/* @__PURE__ */ jsx("head", { children: /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: errorThemeCss } }) }), /* @__PURE__ */ jsxs("body", { children: [/* @__PURE__ */ jsx("div", {
|
|
141
|
+
style: errorStyles.container,
|
|
142
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
143
|
+
style: errorStyles.card,
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ jsx(WarningIcon, {}),
|
|
146
|
+
/* @__PURE__ */ jsx("h1", {
|
|
147
|
+
style: errorStyles.title,
|
|
148
|
+
children: "This page couldn’t load"
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ jsx("p", {
|
|
151
|
+
style: errorStyles.message,
|
|
152
|
+
children: message
|
|
153
|
+
}),
|
|
154
|
+
/* @__PURE__ */ jsxs("div", {
|
|
155
|
+
style: errorStyles.buttonGroup,
|
|
156
|
+
children: [/* @__PURE__ */ jsx("form", {
|
|
157
|
+
style: errorStyles.form,
|
|
158
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
159
|
+
type: "submit",
|
|
160
|
+
style: errorStyles.button,
|
|
161
|
+
children: "Reload"
|
|
162
|
+
})
|
|
163
|
+
}), !isServerError && /* @__PURE__ */ jsx("button", {
|
|
164
|
+
type: "button",
|
|
165
|
+
style: errorStyles.buttonSecondary,
|
|
166
|
+
onClick: handleBackClick,
|
|
167
|
+
children: "Back"
|
|
168
|
+
})]
|
|
169
|
+
})
|
|
170
|
+
]
|
|
171
|
+
})
|
|
172
|
+
}), digest && /* @__PURE__ */ jsxs("p", {
|
|
173
|
+
style: errorStyles.digestFooter,
|
|
174
|
+
children: ["ERROR ", digest]
|
|
175
|
+
})] })]
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
//#endregion
|
|
179
|
+
export { DefaultGlobalError as default };
|
|
180
|
+
|
|
181
|
+
//# sourceMappingURL=default-global-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-global-error.js","names":[],"sources":["../../src/shims/default-global-error.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\n\n/**\n * Ported from Next.js's built-in default global error component:\n * https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/builtin/global-error.tsx\n *\n * Rendered when an unhandled error reaches the root error boundary and the\n * user has not supplied their own `app/global-error.tsx`. Matches the\n * markup, inline styles, and theme CSS that Next.js's\n * `test/e2e/app-dir/default-error-page-ui/default-error-page-ui.test.ts`\n * exercises:\n * - `<h1>` reads \"This page couldn't load\"\n * - `<p>` contains \"Reload to try again, or go back\" (client error) or\n * \"A server error occurred. Reload to try again.\" (server error)\n * - First `<button>` is \"Reload\" (form submit triggers a page reload)\n * - Second `<button>` is \"Back\" (only for client errors)\n * - Server errors render an \"ERROR <digest>\" footer\n * - SVG warning icon is 32x32\n */\n\ntype DefaultGlobalErrorProps = {\n error: { digest?: string } | null | undefined;\n reset?: () => void;\n};\n\nconst errorStyles = {\n container: {\n fontFamily:\n 'system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"',\n height: \"100vh\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n card: {\n marginTop: \"-32px\",\n maxWidth: \"325px\",\n padding: \"32px 28px\",\n textAlign: \"left\" as const,\n },\n icon: {\n marginBottom: \"24px\",\n },\n title: {\n fontSize: \"24px\",\n fontWeight: 500,\n letterSpacing: \"-0.02em\",\n lineHeight: \"32px\",\n margin: \"0 0 12px 0\",\n color: \"var(--next-error-title)\",\n },\n message: {\n fontSize: \"14px\",\n fontWeight: 400,\n lineHeight: \"21px\",\n margin: \"0 0 20px 0\",\n color: \"var(--next-error-message)\",\n },\n form: {\n margin: 0,\n },\n buttonGroup: {\n display: \"flex\",\n gap: \"8px\",\n alignItems: \"center\",\n },\n button: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n height: \"32px\",\n padding: \"0 12px\",\n fontSize: \"14px\",\n fontWeight: 500,\n lineHeight: \"20px\",\n borderRadius: \"6px\",\n cursor: \"pointer\",\n color: \"var(--next-error-btn-text)\",\n background: \"var(--next-error-btn-bg)\",\n border: \"var(--next-error-btn-border)\",\n },\n buttonSecondary: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n height: \"32px\",\n padding: \"0 12px\",\n fontSize: \"14px\",\n fontWeight: 500,\n lineHeight: \"20px\",\n borderRadius: \"6px\",\n cursor: \"pointer\",\n color: \"var(--next-error-btn-secondary-text)\",\n background: \"var(--next-error-btn-secondary-bg)\",\n border: \"var(--next-error-btn-secondary-border)\",\n },\n digestFooter: {\n position: \"fixed\" as const,\n bottom: \"32px\",\n left: \"0\",\n right: \"0\",\n textAlign: \"center\" as const,\n fontFamily: 'ui-monospace,SFMono-Regular,\"SF Mono\",Menlo,Consolas,monospace',\n fontSize: \"12px\",\n lineHeight: \"18px\",\n fontWeight: 400,\n margin: \"0\",\n color: \"var(--next-error-digest)\",\n },\n} as const;\n\nconst errorThemeCss = `\n:root {\n --next-error-bg: #fff;\n --next-error-text: #171717;\n --next-error-title: #171717;\n --next-error-message: #171717;\n --next-error-digest: #666666;\n --next-error-btn-text: #fff;\n --next-error-btn-bg: #171717;\n --next-error-btn-border: none;\n --next-error-btn-secondary-text: #171717;\n --next-error-btn-secondary-bg: transparent;\n --next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);\n}\n@media (prefers-color-scheme: dark) {\n :root {\n --next-error-bg: #0a0a0a;\n --next-error-text: #ededed;\n --next-error-title: #ededed;\n --next-error-message: #ededed;\n --next-error-digest: #a0a0a0;\n --next-error-btn-text: #0a0a0a;\n --next-error-btn-bg: #ededed;\n --next-error-btn-border: none;\n --next-error-btn-secondary-text: #ededed;\n --next-error-btn-secondary-bg: transparent;\n --next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);\n }\n}\nbody { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\n`.replace(/\\n\\s*/g, \"\");\n\nfunction WarningIcon() {\n return (\n <svg width=\"32\" height=\"32\" viewBox=\"-0.2 -1.5 32 32\" fill=\"none\" style={errorStyles.icon}>\n <path\n d=\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\"\n fill=\"var(--next-error-title)\"\n />\n </svg>\n );\n}\n\nfunction handleBackClick() {\n if (typeof window === \"undefined\") return;\n if (window.history.length > 1) {\n window.history.back();\n } else {\n window.location.href = \"/\";\n }\n}\n\nfunction DefaultGlobalError({ error }: DefaultGlobalErrorProps) {\n const digest: string | undefined = error?.digest;\n const isServerError = !!digest;\n\n const message = isServerError\n ? \"A server error occurred. Reload to try again.\"\n : \"Reload to try again, or go back.\";\n\n return (\n <html id=\"__next_error__\">\n <head>\n <style dangerouslySetInnerHTML={{ __html: errorThemeCss }} />\n </head>\n <body>\n <div style={errorStyles.container}>\n <div style={errorStyles.card}>\n <WarningIcon />\n <h1 style={errorStyles.title}>This page couldn’t load</h1>\n <p style={errorStyles.message}>{message}</p>\n <div style={errorStyles.buttonGroup}>\n <form style={errorStyles.form}>\n <button type=\"submit\" style={errorStyles.button}>\n Reload\n </button>\n </form>\n {!isServerError && (\n <button type=\"button\" style={errorStyles.buttonSecondary} onClick={handleBackClick}>\n Back\n </button>\n )}\n </div>\n </div>\n </div>\n {digest && <p style={errorStyles.digestFooter}>ERROR {digest}</p>}\n </body>\n </html>\n );\n}\n\nexport default DefaultGlobalError;\n"],"mappings":";;;;AA2BA,MAAM,cAAc;CAClB,WAAW;EACT,YACE;EACF,QAAQ;EACR,SAAS;EACT,YAAY;EACZ,gBAAgB;EACjB;CACD,MAAM;EACJ,WAAW;EACX,UAAU;EACV,SAAS;EACT,WAAW;EACZ;CACD,MAAM,EACJ,cAAc,QACf;CACD,OAAO;EACL,UAAU;EACV,YAAY;EACZ,eAAe;EACf,YAAY;EACZ,QAAQ;EACR,OAAO;EACR;CACD,SAAS;EACP,UAAU;EACV,YAAY;EACZ,YAAY;EACZ,QAAQ;EACR,OAAO;EACR;CACD,MAAM,EACJ,QAAQ,GACT;CACD,aAAa;EACX,SAAS;EACT,KAAK;EACL,YAAY;EACb;CACD,QAAQ;EACN,SAAS;EACT,YAAY;EACZ,gBAAgB;EAChB,QAAQ;EACR,SAAS;EACT,UAAU;EACV,YAAY;EACZ,YAAY;EACZ,cAAc;EACd,QAAQ;EACR,OAAO;EACP,YAAY;EACZ,QAAQ;EACT;CACD,iBAAiB;EACf,SAAS;EACT,YAAY;EACZ,gBAAgB;EAChB,QAAQ;EACR,SAAS;EACT,UAAU;EACV,YAAY;EACZ,YAAY;EACZ,cAAc;EACd,QAAQ;EACR,OAAO;EACP,YAAY;EACZ,QAAQ;EACT;CACD,cAAc;EACZ,UAAU;EACV,QAAQ;EACR,MAAM;EACN,OAAO;EACP,WAAW;EACX,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,YAAY;EACZ,QAAQ;EACR,OAAO;EACR;CACF;AAED,MAAM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Y;aAAtB,CAAoC,UAAO,OAAW;KAC5D,EAAA,CAAA,CACF"}
|
package/dist/shims/document.d.ts
CHANGED
|
@@ -29,9 +29,65 @@ declare function Main(): _$react_jsx_runtime0.JSX.Element;
|
|
|
29
29
|
*/
|
|
30
30
|
declare function NextScript(): _$react_jsx_runtime0.JSX.Element;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Loose stand-ins for Next.js's `DocumentContext` / `DocumentInitialProps`.
|
|
33
|
+
* The shim doesn't currently invoke `getInitialProps` on user `_document.tsx`
|
|
34
|
+
* files (separate gap), but the signatures here match Next.js's so subclasses
|
|
35
|
+
* that delegate via `await Document.getInitialProps(ctx)` typecheck against
|
|
36
|
+
* the same shape they'd see under real Next.js.
|
|
37
|
+
*
|
|
38
|
+
* @see https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/utils.ts
|
|
33
39
|
*/
|
|
34
|
-
|
|
40
|
+
type DocumentContext = {
|
|
41
|
+
renderPage?: (options?: {
|
|
42
|
+
enhanceApp?: (App: React.ComponentType<{
|
|
43
|
+
children?: React.ReactNode;
|
|
44
|
+
}>) => unknown;
|
|
45
|
+
enhanceComponent?: (Comp: React.ComponentType<unknown>) => unknown;
|
|
46
|
+
}) => {
|
|
47
|
+
html: string;
|
|
48
|
+
head?: ReadonlyArray<React.ReactElement>;
|
|
49
|
+
};
|
|
50
|
+
defaultGetInitialProps?: (ctx: DocumentContext, options?: {
|
|
51
|
+
nonce?: string;
|
|
52
|
+
}) => Promise<DocumentInitialProps>;
|
|
53
|
+
pathname?: string;
|
|
54
|
+
query?: Record<string, string | string[] | undefined>;
|
|
55
|
+
asPath?: string;
|
|
56
|
+
err?: any;
|
|
57
|
+
};
|
|
58
|
+
type DocumentInitialProps = {
|
|
59
|
+
html: string;
|
|
60
|
+
head?: ReadonlyArray<React.ReactElement>;
|
|
61
|
+
styles?: React.ReactElement[] | Iterable<React.ReactNode> | React.ReactElement;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Default Document component — also the base class user `_document.tsx` files
|
|
65
|
+
* `extend`. Must be a class (not a function) to match Next.js's `next/document`
|
|
66
|
+
* default export so `class MyDocument extends Document` produces a constructible
|
|
67
|
+
* class that React can instantiate during SSR. Returning a function here breaks
|
|
68
|
+
* any user `_document.tsx` that uses the class-based form because `extends`
|
|
69
|
+
* against a non-constructor produces a class that can only be called without
|
|
70
|
+
* `new`, which React refuses to do.
|
|
71
|
+
*
|
|
72
|
+
* @see https://github.com/vercel/next.js/blob/canary/packages/next/src/pages/_document.tsx
|
|
73
|
+
* Ported behavior: Next.js's default `Document` is a `class Document extends
|
|
74
|
+
* React.Component`. Custom documents extend it and override `getInitialProps`
|
|
75
|
+
* and `render`. Generic default matches Next.js (`P = {}`).
|
|
76
|
+
*/
|
|
77
|
+
declare class Document<P = {}> extends React.Component<P & {
|
|
78
|
+
children?: React.ReactNode;
|
|
79
|
+
}> {
|
|
80
|
+
/**
|
|
81
|
+
* `getInitialProps` is invoked by the SSR pipeline. The default implementation
|
|
82
|
+
* is a stub: vinext does not yet plumb the Pages Router `renderPage` /
|
|
83
|
+
* `defaultGetInitialProps` chain into the SSR entry, so subclasses that
|
|
84
|
+
* delegate via `await Document.getInitialProps(ctx)` receive an empty shell
|
|
85
|
+
* (`html: ""`). This matches the runtime contract user code expects without
|
|
86
|
+
* pretending the chain is wired up.
|
|
87
|
+
*/
|
|
88
|
+
static getInitialProps(_ctx: DocumentContext): Promise<DocumentInitialProps>;
|
|
89
|
+
render(): React.ReactNode;
|
|
90
|
+
}
|
|
35
91
|
//#endregion
|
|
36
|
-
export { Head, Html, Main, NextScript, Document as default };
|
|
92
|
+
export { DocumentContext, DocumentInitialProps, Head, Html, Main, NextScript, Document as default };
|
|
37
93
|
//# sourceMappingURL=document.d.ts.map
|
package/dist/shims/document.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import "react";
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
//#region src/shims/document.tsx
|
|
4
|
+
/**
|
|
5
|
+
* next/document shim
|
|
6
|
+
*
|
|
7
|
+
* Provides Html, Head, Main, NextScript components for custom _document.tsx.
|
|
8
|
+
* During SSR these render placeholder markers that the dev server replaces
|
|
9
|
+
* with actual content.
|
|
10
|
+
*/
|
|
4
11
|
function Html({ children, lang, ...props }) {
|
|
5
12
|
return /* @__PURE__ */ jsx("html", {
|
|
6
13
|
lang,
|
|
@@ -40,11 +47,35 @@ function NextScript() {
|
|
|
40
47
|
return /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: "<!-- __NEXT_SCRIPTS__ -->" } });
|
|
41
48
|
}
|
|
42
49
|
/**
|
|
43
|
-
* Default Document component
|
|
50
|
+
* Default Document component — also the base class user `_document.tsx` files
|
|
51
|
+
* `extend`. Must be a class (not a function) to match Next.js's `next/document`
|
|
52
|
+
* default export so `class MyDocument extends Document` produces a constructible
|
|
53
|
+
* class that React can instantiate during SSR. Returning a function here breaks
|
|
54
|
+
* any user `_document.tsx` that uses the class-based form because `extends`
|
|
55
|
+
* against a non-constructor produces a class that can only be called without
|
|
56
|
+
* `new`, which React refuses to do.
|
|
57
|
+
*
|
|
58
|
+
* @see https://github.com/vercel/next.js/blob/canary/packages/next/src/pages/_document.tsx
|
|
59
|
+
* Ported behavior: Next.js's default `Document` is a `class Document extends
|
|
60
|
+
* React.Component`. Custom documents extend it and override `getInitialProps`
|
|
61
|
+
* and `render`. Generic default matches Next.js (`P = {}`).
|
|
44
62
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
63
|
+
var Document = class extends React.Component {
|
|
64
|
+
/**
|
|
65
|
+
* `getInitialProps` is invoked by the SSR pipeline. The default implementation
|
|
66
|
+
* is a stub: vinext does not yet plumb the Pages Router `renderPage` /
|
|
67
|
+
* `defaultGetInitialProps` chain into the SSR entry, so subclasses that
|
|
68
|
+
* delegate via `await Document.getInitialProps(ctx)` receive an empty shell
|
|
69
|
+
* (`html: ""`). This matches the runtime contract user code expects without
|
|
70
|
+
* pretending the chain is wired up.
|
|
71
|
+
*/
|
|
72
|
+
static async getInitialProps(_ctx) {
|
|
73
|
+
return { html: "" };
|
|
74
|
+
}
|
|
75
|
+
render() {
|
|
76
|
+
return /* @__PURE__ */ jsxs(Html, { children: [/* @__PURE__ */ jsx(Head, {}), /* @__PURE__ */ jsxs("body", { children: [/* @__PURE__ */ jsx(Main, {}), /* @__PURE__ */ jsx(NextScript, {})] })] });
|
|
77
|
+
}
|
|
78
|
+
};
|
|
48
79
|
//#endregion
|
|
49
80
|
export { Head, Html, Main, NextScript, Document as default };
|
|
50
81
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","names":[],"sources":["../../src/shims/document.tsx"],"sourcesContent":["/**\n * next/document shim\n *\n * Provides Html, Head, Main, NextScript components for custom _document.tsx.\n * During SSR these render placeholder markers that the dev server replaces\n * with actual content.\n */\nimport React from \"react\";\n\nexport function Html({\n children,\n lang,\n ...props\n}: React.HTMLAttributes<HTMLHtmlElement> & { children?: React.ReactNode }) {\n return (\n <html lang={lang} {...props}>\n {children}\n </html>\n );\n}\n\n/**\n * Document Head - renders <head> with children.\n * The dev server injects meta tags, styles, etc.\n */\nexport function Head({ children }: { children?: React.ReactNode }) {\n return (\n <head>\n <meta charSet=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n {children}\n </head>\n );\n}\n\n/**\n * Main - renders the page content container.\n */\nexport function Main() {\n return <div id=\"__next\" dangerouslySetInnerHTML={{ __html: \"__NEXT_MAIN__\" }} />;\n}\n\n/**\n * NextScript - renders a placeholder that the dev-server replaces with\n * actual hydration scripts (__NEXT_DATA__ + entry module).\n * Uses dangerouslySetInnerHTML so the HTML comment survives renderToString.\n */\nexport function NextScript() {\n return <span dangerouslySetInnerHTML={{ __html: \"<!-- __NEXT_SCRIPTS__ -->\" }} />;\n}\n\n/**\n * Default Document component -
|
|
1
|
+
{"version":3,"file":"document.js","names":[],"sources":["../../src/shims/document.tsx"],"sourcesContent":["/**\n * next/document shim\n *\n * Provides Html, Head, Main, NextScript components for custom _document.tsx.\n * During SSR these render placeholder markers that the dev server replaces\n * with actual content.\n */\nimport React from \"react\";\n\nexport function Html({\n children,\n lang,\n ...props\n}: React.HTMLAttributes<HTMLHtmlElement> & { children?: React.ReactNode }) {\n return (\n <html lang={lang} {...props}>\n {children}\n </html>\n );\n}\n\n/**\n * Document Head - renders <head> with children.\n * The dev server injects meta tags, styles, etc.\n */\nexport function Head({ children }: { children?: React.ReactNode }) {\n return (\n <head>\n <meta charSet=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n {children}\n </head>\n );\n}\n\n/**\n * Main - renders the page content container.\n */\nexport function Main() {\n return <div id=\"__next\" dangerouslySetInnerHTML={{ __html: \"__NEXT_MAIN__\" }} />;\n}\n\n/**\n * NextScript - renders a placeholder that the dev-server replaces with\n * actual hydration scripts (__NEXT_DATA__ + entry module).\n * Uses dangerouslySetInnerHTML so the HTML comment survives renderToString.\n */\nexport function NextScript() {\n return <span dangerouslySetInnerHTML={{ __html: \"<!-- __NEXT_SCRIPTS__ -->\" }} />;\n}\n\n/**\n * Loose stand-ins for Next.js's `DocumentContext` / `DocumentInitialProps`.\n * The shim doesn't currently invoke `getInitialProps` on user `_document.tsx`\n * files (separate gap), but the signatures here match Next.js's so subclasses\n * that delegate via `await Document.getInitialProps(ctx)` typecheck against\n * the same shape they'd see under real Next.js.\n *\n * @see https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/utils.ts\n */\nexport type DocumentContext = {\n // The full `DocumentContext` includes `renderPage`, `defaultGetInitialProps`,\n // and the inherited `NextPageContext` (`pathname`, `query`, `req`, `res`,\n // `err`, `asPath`, ...). They're declared as optional here because vinext\n // does not yet plumb them through; widening to optional avoids forcing user\n // code to assert their presence.\n renderPage?: (options?: {\n enhanceApp?: (App: React.ComponentType<{ children?: React.ReactNode }>) => unknown;\n enhanceComponent?: (Comp: React.ComponentType<unknown>) => unknown;\n }) => { html: string; head?: ReadonlyArray<React.ReactElement> };\n defaultGetInitialProps?: (\n ctx: DocumentContext,\n options?: { nonce?: string },\n ) => Promise<DocumentInitialProps>;\n pathname?: string;\n query?: Record<string, string | string[] | undefined>;\n asPath?: string;\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n err?: any;\n};\n\nexport type DocumentInitialProps = {\n html: string;\n head?: ReadonlyArray<React.ReactElement>;\n styles?: React.ReactElement[] | Iterable<React.ReactNode> | React.ReactElement;\n};\n\n/**\n * Default Document component — also the base class user `_document.tsx` files\n * `extend`. Must be a class (not a function) to match Next.js's `next/document`\n * default export so `class MyDocument extends Document` produces a constructible\n * class that React can instantiate during SSR. Returning a function here breaks\n * any user `_document.tsx` that uses the class-based form because `extends`\n * against a non-constructor produces a class that can only be called without\n * `new`, which React refuses to do.\n *\n * @see https://github.com/vercel/next.js/blob/canary/packages/next/src/pages/_document.tsx\n * Ported behavior: Next.js's default `Document` is a `class Document extends\n * React.Component`. Custom documents extend it and override `getInitialProps`\n * and `render`. Generic default matches Next.js (`P = {}`).\n */\n// oxlint-disable-next-line @typescript-eslint/no-empty-object-type\nexport default class Document<P = {}> extends React.Component<P & { children?: React.ReactNode }> {\n /**\n * `getInitialProps` is invoked by the SSR pipeline. The default implementation\n * is a stub: vinext does not yet plumb the Pages Router `renderPage` /\n * `defaultGetInitialProps` chain into the SSR entry, so subclasses that\n * delegate via `await Document.getInitialProps(ctx)` receive an empty shell\n * (`html: \"\"`). This matches the runtime contract user code expects without\n * pretending the chain is wired up.\n */\n static async getInitialProps(_ctx: DocumentContext): Promise<DocumentInitialProps> {\n return { html: \"\" };\n }\n\n render(): React.ReactNode {\n return (\n <Html>\n <Head />\n <body>\n <Main />\n <NextScript />\n </body>\n </Html>\n );\n }\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,KAAK,EACnB,UACA,MACA,GAAG,SACsE;CACzE,OACE,oBAAC,QAAD;EAAY;EAAM,GAAI;EACnB;EACI,CAAA;;;;;;AAQX,SAAgB,KAAK,EAAE,YAA4C;CACjE,OACE,qBAAC,QAAD,EAAA,UAAA;EACE,oBAAC,QAAD,EAAM,SAAQ,SAAU,CAAA;EACxB,oBAAC,QAAD;GAAM,MAAK;GAAW,SAAQ;GAAwC,CAAA;EACrE;EACI,EAAA,CAAA;;;;;AAOX,SAAgB,OAAO;CACrB,OAAO,oBAAC,OAAD;EAAK,IAAG;EAAS,yBAAyB,EAAE,QAAQ,iBAAiB;EAAI,CAAA;;;;;;;AAQlF,SAAgB,aAAa;CAC3B,OAAO,oBAAC,QAAD,EAAM,yBAAyB,EAAE,QAAQ,6BAA6B,EAAI,CAAA;;;;;;;;;;;;;;;;AAsDnF,IAAqB,WAArB,cAA8C,MAAM,UAA8C;;;;;;;;;CAShG,aAAa,gBAAgB,MAAsD;EACjF,OAAO,EAAE,MAAM,IAAI;;CAGrB,SAA0B;EACxB,OACE,qBAAC,MAAD,EAAA,UAAA,CACE,oBAAC,MAAD,EAAQ,CAAA,EACR,qBAAC,QAAD,EAAA,UAAA,CACE,oBAAC,MAAD,EAAQ,CAAA,EACR,oBAAC,YAAD,EAAc,CAAA,CACT,EAAA,CAAA,CACF,EAAA,CAAA"}
|
|
@@ -32,7 +32,7 @@ declare class RedirectErrorBoundary extends React.Component<{
|
|
|
32
32
|
children?: React.ReactNode;
|
|
33
33
|
});
|
|
34
34
|
static getDerivedStateFromError(error: unknown): RedirectBoundaryState;
|
|
35
|
-
render(): string | number | bigint | boolean |
|
|
35
|
+
render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | _$react_jsx_runtime0.JSX.Element | null | undefined;
|
|
36
36
|
}
|
|
37
37
|
declare function RedirectBoundary({
|
|
38
38
|
children
|
|
@@ -49,7 +49,7 @@ declare class ErrorBoundaryInner extends React.Component<ErrorBoundaryInnerProps
|
|
|
49
49
|
static getDerivedStateFromProps(props: ErrorBoundaryInnerProps, state: ErrorBoundaryState): ErrorBoundaryState | null;
|
|
50
50
|
static getDerivedStateFromError(error: unknown): Partial<ErrorBoundaryState>;
|
|
51
51
|
reset: () => void;
|
|
52
|
-
render(): string | number | bigint | boolean |
|
|
52
|
+
render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | _$react_jsx_runtime0.JSX.Element | null | undefined;
|
|
53
53
|
}
|
|
54
54
|
declare function ErrorBoundary({
|
|
55
55
|
fallback,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { usePathname, useRouter } from "./navigation.js";
|
|
3
|
-
import {
|
|
2
|
+
import { isRedirectError, usePathname, useRouter } from "./navigation.js";
|
|
3
|
+
import { isNavigationSignalError } from "../utils/navigation-signal.js";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/shims/error-boundary.tsx
|
|
@@ -19,9 +19,6 @@ function shouldResetBoundary(nextResetState, previousResetState) {
|
|
|
19
19
|
if (nextResetKey !== null || previousResetKey !== null) return nextResetKey !== previousResetKey;
|
|
20
20
|
return nextResetState.previousPathname !== previousResetState.previousPathname;
|
|
21
21
|
}
|
|
22
|
-
function isRedirectError(error) {
|
|
23
|
-
return getErrorDigest(error)?.startsWith("NEXT_REDIRECT;") ?? false;
|
|
24
|
-
}
|
|
25
22
|
function decodeRedirectTarget(target) {
|
|
26
23
|
try {
|
|
27
24
|
return decodeURIComponent(target);
|
|
@@ -61,15 +58,16 @@ var RedirectErrorBoundary = class extends React.Component {
|
|
|
61
58
|
}
|
|
62
59
|
static getDerivedStateFromError(error) {
|
|
63
60
|
if (isRedirectError(error)) {
|
|
64
|
-
|
|
61
|
+
const redirectError = error;
|
|
62
|
+
if (redirectError.handled) return {
|
|
65
63
|
redirect: null,
|
|
66
64
|
redirectType: null
|
|
67
65
|
};
|
|
68
|
-
const url = getURLFromRedirectError(
|
|
66
|
+
const url = getURLFromRedirectError(redirectError);
|
|
69
67
|
if (url === null) throw error;
|
|
70
68
|
return {
|
|
71
69
|
redirect: url,
|
|
72
|
-
redirectType: getRedirectTypeFromError(
|
|
70
|
+
redirectType: getRedirectTypeFromError(redirectError)
|
|
73
71
|
};
|
|
74
72
|
}
|
|
75
73
|
throw error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-boundary.js","names":[],"sources":["../../src/shims/error-boundary.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\n// Import the local shim, not the public next/navigation alias. The built\n// package may execute this file before the plugin's resolveId hook is active.\nimport { usePathname, useRouter } from \"./navigation.js\";\nimport { getErrorDigest, isNavigationSignalError } from \"../utils/navigation-signal.js\";\n\nexport type ErrorBoundaryProps = {\n fallback: React.ComponentType<{ error: unknown; reset: () => void }>;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype CapturedError = {\n thrownValue: unknown;\n};\n\ntype RedirectBoundaryState = {\n redirect: string | null;\n redirectType: \"push\" | \"replace\" | null;\n};\n\ntype RedirectError = Error & {\n digest: string;\n handled?: boolean;\n};\n\ntype ErrorBoundaryInnerProps = {\n pathname: string;\n} & ErrorBoundaryProps;\n\nexport type ErrorBoundaryState = {\n error: CapturedError | null;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\ntype BoundaryResetProps = {\n pathname: string;\n resetKey?: string | null;\n};\n\ntype BoundaryResetState = {\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nfunction normalizeBoundaryResetKey(resetKey: string | null | undefined): string | null {\n return resetKey === undefined || resetKey === null || resetKey === \"\" ? null : resetKey;\n}\n\nfunction readBoundaryResetState(props: BoundaryResetProps): BoundaryResetState {\n return {\n previousPathname: props.pathname,\n previousResetKey: normalizeBoundaryResetKey(props.resetKey),\n };\n}\n\nfunction shouldResetBoundary(\n nextResetState: BoundaryResetState,\n previousResetState: BoundaryResetState,\n): boolean {\n const nextResetKey = normalizeBoundaryResetKey(nextResetState.previousResetKey);\n const previousResetKey = normalizeBoundaryResetKey(previousResetState.previousResetKey);\n\n if (nextResetKey !== null || previousResetKey !== null) {\n return nextResetKey !== previousResetKey;\n }\n\n return nextResetState.previousPathname !== previousResetState.previousPathname;\n}\n\nfunction isRedirectError(error: unknown): error is RedirectError {\n return getErrorDigest(error)?.startsWith(\"NEXT_REDIRECT;\") ?? false;\n}\n\nfunction decodeRedirectTarget(target: string): string {\n try {\n return decodeURIComponent(target);\n } catch {\n return target;\n }\n}\n\nfunction getURLFromRedirectError(error: RedirectError): string | null {\n const parts = error.digest.split(\";\");\n // vinext emits 3-part (redirect: `NEXT_REDIRECT;;<encoded>`) or 4-part\n // (permanentRedirect: `NEXT_REDIRECT;<type>;<encoded>;308`) digests;\n // Next.js emits 5-part digests (`NEXT_REDIRECT;<type>;<url>;<status>;<isClient>`).\n // vinext's `isRedirectError` is more permissive (just `startsWith(\"NEXT_REDIRECT;\")`)\n // so we branch on length rather than always using `slice(2, -2)`.\n const encodedTarget = parts.length >= 5 ? parts.slice(2, -2).join(\";\") : parts[2];\n return encodedTarget ? decodeRedirectTarget(encodedTarget) : null;\n}\n\nfunction getRedirectTypeFromError(error: RedirectError): \"push\" | \"replace\" {\n const type = error.digest.split(\";\", 2)[1];\n return type === \"push\" ? \"push\" : \"replace\";\n}\n\nfunction HandleRedirect({\n redirect,\n redirectType,\n}: {\n redirect: string;\n redirectType: \"push\" | \"replace\";\n}) {\n const router = useRouter();\n\n React.useEffect(() => {\n React.startTransition(() => {\n if (redirectType === \"push\") {\n router.push(redirect);\n } else {\n router.replace(redirect);\n }\n // Intentionally no reset() here. The boundary stays in its \"redirect\n // caught\" state (rendering this component, which returns null) until\n // router.push()/replace() triggers a new render at the destination\n // route. That naturally unmounts this boundary and mounts a fresh one.\n // Calling reset() would clear the boundary state, causing React to\n // re-render children — which re-mounts the page component that threw\n // redirect() in the first place. For deterministic redirects (e.g.\n // auth guards), that creates an infinite redirect loop.\n // Matches Next.js's HandleRedirect in redirect-boundary.tsx.\n });\n }, [redirect, redirectType, router]);\n\n return null;\n}\n\nexport class RedirectErrorBoundary extends React.Component<\n { children?: React.ReactNode },\n RedirectBoundaryState\n> {\n constructor(props: { children?: React.ReactNode }) {\n super(props);\n this.state = {\n redirect: null,\n redirectType: null,\n };\n }\n\n static getDerivedStateFromError(error: unknown): RedirectBoundaryState {\n if (isRedirectError(error)) {\n // Next.js parity: an outer RedirectBoundary that has already started\n // handling a redirect marks the error as `handled` so that, if React\n // re-throws the same error during a retry render, an inner boundary\n // doesn't re-dispatch the same `router.replace()`. Vinext doesn't\n // currently emit `handled` itself (we never assign it on the error\n // object), but we keep the branch so behavior matches Next.js if a\n // host or future change ever does.\n if (error.handled) {\n return {\n redirect: null,\n redirectType: null,\n };\n }\n\n const url = getURLFromRedirectError(error);\n if (url === null) {\n // Malformed digest (e.g. `NEXT_REDIRECT;push;` with an empty URL\n // segment). The server-side parser at next-error-digest.ts:51 also\n // rejects this. Re-throw so the error reaches a regular error\n // boundary instead of being silently swallowed.\n throw error;\n }\n\n return {\n redirect: url,\n redirectType: getRedirectTypeFromError(error),\n };\n }\n\n throw error;\n }\n\n render() {\n const { redirect, redirectType } = this.state;\n if (redirect !== null && redirectType !== null) {\n return <HandleRedirect redirect={redirect} redirectType={redirectType} />;\n }\n\n return this.props.children;\n }\n}\n\nexport function RedirectBoundary({ children }: { children?: React.ReactNode }) {\n return <RedirectErrorBoundary>{children}</RedirectErrorBoundary>;\n}\n\n/**\n * Generic ErrorBoundary used to wrap route segments with error.tsx.\n * This must be a client component since error boundaries use\n * componentDidCatch / getDerivedStateFromError.\n */\nexport class ErrorBoundaryInner extends React.Component<\n ErrorBoundaryInnerProps,\n ErrorBoundaryState\n> {\n constructor(props: ErrorBoundaryInnerProps) {\n super(props);\n this.state = { error: null, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: ErrorBoundaryInnerProps,\n state: ErrorBoundaryState,\n ): ErrorBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.error && shouldResetBoundary(nextResetState, state)) {\n return { error: null, ...nextResetState };\n }\n return { error: state.error, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<ErrorBoundaryState> {\n // notFound(), forbidden(), unauthorized(), and redirect() must propagate\n // past error boundaries. Re-throw them so they bubble up to the\n // framework's HTTP access fallback / redirect handler.\n if (isNavigationSignalError(error)) {\n throw error;\n }\n return { error: { thrownValue: error } };\n }\n\n reset = () => {\n this.setState({ error: null });\n };\n\n render() {\n if (this.state.error) {\n const FallbackComponent = this.props.fallback;\n return <FallbackComponent error={this.state.error.thrownValue} reset={this.reset} />;\n }\n return this.props.children;\n }\n}\n\nexport function ErrorBoundary({ fallback, children, resetKey }: ErrorBoundaryProps) {\n const pathname = usePathname();\n return (\n <ErrorBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </ErrorBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// NotFoundBoundary — catches notFound() on the client and renders not-found.tsx\n// ---------------------------------------------------------------------------\n\ntype NotFoundBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype NotFoundBoundaryInnerProps = {\n pathname: string;\n} & NotFoundBoundaryProps;\n\ntype NotFoundBoundaryState = {\n notFound: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\n/**\n * Inner class component that catches notFound() errors and renders the\n * not-found.tsx fallback. Resets on the caller's segment reset key when one is\n * provided, otherwise falls back to pathname changes for legacy callers.\n *\n * The ErrorBoundary above re-throws notFound errors so they propagate up to this\n * boundary. This must be placed above the ErrorBoundary in the component tree.\n */\nclass NotFoundBoundaryInner extends React.Component<\n NotFoundBoundaryInnerProps,\n NotFoundBoundaryState\n> {\n constructor(props: NotFoundBoundaryInnerProps) {\n super(props);\n this.state = { notFound: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: NotFoundBoundaryInnerProps,\n state: NotFoundBoundaryState,\n ): NotFoundBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.notFound && shouldResetBoundary(nextResetState, state)) {\n return { notFound: false, ...nextResetState };\n }\n return { notFound: state.notFound, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<NotFoundBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_NOT_FOUND\" || digest === \"NEXT_HTTP_ERROR_FALLBACK;404\") {\n return { notFound: true };\n }\n }\n // Not a notFound error — re-throw so it reaches an ErrorBoundary or propagates\n throw error;\n }\n\n render() {\n if (this.state.notFound) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\n/**\n * Wrapper that reads the current pathname and passes it to the inner class\n * component. Segment reset keys own App Router remount semantics when present.\n */\nexport function NotFoundBoundary({ fallback, children, resetKey }: NotFoundBoundaryProps) {\n const pathname = usePathname();\n return (\n <NotFoundBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </NotFoundBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// ForbiddenBoundary — catches forbidden() on the client and renders forbidden.tsx\n// ---------------------------------------------------------------------------\n\ntype ForbiddenBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype ForbiddenBoundaryInnerProps = {\n pathname: string;\n} & ForbiddenBoundaryProps;\n\ntype ForbiddenBoundaryState = {\n forbidden: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nexport class ForbiddenBoundaryInner extends React.Component<\n ForbiddenBoundaryInnerProps,\n ForbiddenBoundaryState\n> {\n constructor(props: ForbiddenBoundaryInnerProps) {\n super(props);\n this.state = { forbidden: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: ForbiddenBoundaryInnerProps,\n state: ForbiddenBoundaryState,\n ): ForbiddenBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.forbidden && shouldResetBoundary(nextResetState, state)) {\n return { forbidden: false, ...nextResetState };\n }\n return { forbidden: state.forbidden, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<ForbiddenBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_HTTP_ERROR_FALLBACK;403\") {\n return { forbidden: true };\n }\n }\n throw error;\n }\n\n render() {\n if (this.state.forbidden) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\nexport function ForbiddenBoundary({ fallback, children, resetKey }: ForbiddenBoundaryProps) {\n const pathname = usePathname();\n return (\n <ForbiddenBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </ForbiddenBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// UnauthorizedBoundary — catches unauthorized() on the client and renders unauthorized.tsx\n// ---------------------------------------------------------------------------\n\ntype UnauthorizedBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype UnauthorizedBoundaryInnerProps = {\n pathname: string;\n} & UnauthorizedBoundaryProps;\n\ntype UnauthorizedBoundaryState = {\n unauthorized: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nexport class UnauthorizedBoundaryInner extends React.Component<\n UnauthorizedBoundaryInnerProps,\n UnauthorizedBoundaryState\n> {\n constructor(props: UnauthorizedBoundaryInnerProps) {\n super(props);\n this.state = { unauthorized: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: UnauthorizedBoundaryInnerProps,\n state: UnauthorizedBoundaryState,\n ): UnauthorizedBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.unauthorized && shouldResetBoundary(nextResetState, state)) {\n return { unauthorized: false, ...nextResetState };\n }\n return { unauthorized: state.unauthorized, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<UnauthorizedBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_HTTP_ERROR_FALLBACK;401\") {\n return { unauthorized: true };\n }\n }\n throw error;\n }\n\n render() {\n if (this.state.unauthorized) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\nexport function UnauthorizedBoundary({ fallback, children, resetKey }: UnauthorizedBoundaryProps) {\n const pathname = usePathname();\n return (\n <UnauthorizedBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </UnauthorizedBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// DevRecoveryBoundary — dev-only top-level boundary inside BrowserRoot.\n// Catches any render error that isn't already handled by a user-defined\n// error.tsx (or the access-fallback boundaries above), renders nothing, and\n// keeps BrowserRoot mounted so HMR can dispatch a new RSC payload without a\n// full page reload. Resets on resetKey change — the caller bumps that key\n// (e.g. via treeState.renderId) when a fresh tree is dispatched.\n//\n// Routing sentinels are re-thrown so notFound()/redirect()/forbidden()/\n// unauthorized() still reach their dedicated boundaries above.\n// ---------------------------------------------------------------------------\n\nexport type DevRecoveryBoundaryProps = {\n resetKey: number;\n // Called from componentDidCatch with the current resetKey so the host can\n // run any pending side effects that NavigationCommitSignal would normally\n // drive on commit — most importantly the URL update for the in-flight\n // soft-nav. Without this, a navigation that fails mid-render leaves the\n // browser on the previous URL even though the boundary recovered.\n //\n // The error itself is intentionally not passed: React's onCaughtError option\n // already routes the error to the dev overlay, so this callback is only for\n // commit-side effects keyed by resetKey.\n onCatch?: (resetKey: number) => void;\n // Children come through React.Component's PropsWithChildren default; declared\n // optional so callers can pass them positionally to createElement without\n // tripping the eslint no-children-prop rule.\n children?: React.ReactNode;\n};\n\ntype DevRecoveryBoundaryState = {\n error: CapturedError | null;\n previousResetKey: number;\n};\n\nexport class DevRecoveryBoundary extends React.Component<\n DevRecoveryBoundaryProps,\n DevRecoveryBoundaryState\n> {\n constructor(props: DevRecoveryBoundaryProps) {\n super(props);\n this.state = { error: null, previousResetKey: props.resetKey };\n }\n\n static getDerivedStateFromProps(\n props: DevRecoveryBoundaryProps,\n state: DevRecoveryBoundaryState,\n ): DevRecoveryBoundaryState | null {\n if (props.resetKey === state.previousResetKey) {\n return null;\n }\n return { error: null, previousResetKey: props.resetKey };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<DevRecoveryBoundaryState> {\n // Re-throw routing sentinels so they still reach NotFoundBoundary /\n // RedirectBoundary / Forbidden / Unauthorized above.\n if (isNavigationSignalError(error)) {\n throw error;\n }\n return { error: { thrownValue: error } };\n }\n\n componentDidCatch(): void {\n this.props.onCatch?.(this.props.resetKey);\n }\n\n render() {\n if (this.state.error) {\n // Render nothing — the dev overlay (mounted in a separate React root)\n // shows the actual error to the developer. HMR pushing a new payload\n // bumps resetKey above, clearing this state and letting the children\n // re-render with the fixed code.\n return null;\n }\n return this.props.children;\n }\n}\n"],"mappings":";;;;;;AAgDA,SAAS,0BAA0B,UAAoD;CACrF,OAAO,aAAa,KAAA,KAAa,aAAa,QAAQ,aAAa,KAAK,OAAO;;AAGjF,SAAS,uBAAuB,OAA+C;CAC7E,OAAO;EACL,kBAAkB,MAAM;EACxB,kBAAkB,0BAA0B,MAAM,SAAS;EAC5D;;AAGH,SAAS,oBACP,gBACA,oBACS;CACT,MAAM,eAAe,0BAA0B,eAAe,iBAAiB;CAC/E,MAAM,mBAAmB,0BAA0B,mBAAmB,iBAAiB;CAEvF,IAAI,iBAAiB,QAAQ,qBAAqB,MAChD,OAAO,iBAAiB;CAG1B,OAAO,eAAe,qBAAqB,mBAAmB;;AAGhE,SAAS,gBAAgB,OAAwC;CAC/D,OAAO,eAAe,MAAM,EAAE,WAAW,iBAAiB,IAAI;;AAGhE,SAAS,qBAAqB,QAAwB;CACpD,IAAI;EACF,OAAO,mBAAmB,OA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AClC,MAAM,iBAAiB,uBAAuB,MAAM;EACpD,IAAI,MAAM,gBAAgB,oBAAoB,gBAAgB,MAAM,EAClE,OAAO;GAAE,cAAc;GAAO,GAAG;GAAgB;EAEnD,OAAO;GAAE,cAAc,MAAM;GAAc,GAAG;GAAgB;;CAGhE,OAAO,yBAAyB,OAAoD;EAClF,IAAI,SAAS,OAAO,UAAU,YAAY,YAAY;OACrC,OAAO,MAAM,OAClB,KAAK,gCACb,OAAO,EAAE,cAAc,MAAM;;EAGjC,MAAM;;CAGR,SAAS;EACP,IAAI,KAAK,MAAM,cACb,OAAO,KAAK,MAAM;EAEpB,OAAO,KAAK,MAAM;;;AAItB,SAAgB,qBAAqB,EAAE,UAAU,UAAU,YAAuC;CAEhG,OACE,oBAAC,2BAAD;EAA2B,UAFZ,aAE8B;EAAY;EAAoB;EAC1E;EACyB,CAAA;;AAuChC,IAAa,sBAAb,cAAyC,MAAM,UAG7C;CACA,YAAY,OAAiC;EAC3C,MAAM,MAAM;EACZ,KAAK,QAAQ;GAAE,OAAO;GAAM,kBAAkB,MAAM;GAAU;;CAGhE,OAAO,yBACL,OACA,OACiC;EACjC,IAAI,MAAM,aAAa,MAAM,kBAC3B,OAAO;EAET,OAAO;GAAE,OAAO;GAAM,kBAAkB,MAAM;GAAU;;CAG1D,OAAO,yBAAyB,OAAmD;EAGjF,IAAI,wBAAwB,MAAM,EAChC,MAAM;EAER,OAAO,EAAE,OAAO,EAAE,aAAa,OAAO,EAAE;;CAG1C,oBAA0B;EACxB,KAAK,MAAM,UAAU,KAAK,MAAM,SAAS;;CAG3C,SAAS;EACP,IAAI,KAAK,MAAM,OAKb,OAAO;EAET,OAAO,KAAK,MAAM"}
|
|
1
|
+
{"version":3,"file":"error-boundary.js","names":[],"sources":["../../src/shims/error-boundary.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\n// Import the local shim, not the public next/navigation alias. The built\n// package may execute this file before the plugin's resolveId hook is active.\nimport { isRedirectError, usePathname, useRouter } from \"./navigation.js\";\nimport { isNavigationSignalError } from \"../utils/navigation-signal.js\";\n\nexport type ErrorBoundaryProps = {\n fallback: React.ComponentType<{ error: unknown; reset: () => void }>;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype CapturedError = {\n thrownValue: unknown;\n};\n\ntype RedirectBoundaryState = {\n redirect: string | null;\n redirectType: \"push\" | \"replace\" | null;\n};\n\ntype RedirectError = Error & {\n digest: string;\n handled?: boolean;\n};\n\ntype ErrorBoundaryInnerProps = {\n pathname: string;\n} & ErrorBoundaryProps;\n\nexport type ErrorBoundaryState = {\n error: CapturedError | null;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\ntype BoundaryResetProps = {\n pathname: string;\n resetKey?: string | null;\n};\n\ntype BoundaryResetState = {\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nfunction normalizeBoundaryResetKey(resetKey: string | null | undefined): string | null {\n return resetKey === undefined || resetKey === null || resetKey === \"\" ? null : resetKey;\n}\n\nfunction readBoundaryResetState(props: BoundaryResetProps): BoundaryResetState {\n return {\n previousPathname: props.pathname,\n previousResetKey: normalizeBoundaryResetKey(props.resetKey),\n };\n}\n\nfunction shouldResetBoundary(\n nextResetState: BoundaryResetState,\n previousResetState: BoundaryResetState,\n): boolean {\n const nextResetKey = normalizeBoundaryResetKey(nextResetState.previousResetKey);\n const previousResetKey = normalizeBoundaryResetKey(previousResetState.previousResetKey);\n\n if (nextResetKey !== null || previousResetKey !== null) {\n return nextResetKey !== previousResetKey;\n }\n\n return nextResetState.previousPathname !== previousResetState.previousPathname;\n}\n\nfunction decodeRedirectTarget(target: string): string {\n try {\n return decodeURIComponent(target);\n } catch {\n return target;\n }\n}\n\nfunction getURLFromRedirectError(error: RedirectError): string | null {\n const parts = error.digest.split(\";\");\n // vinext emits 3-part (redirect: `NEXT_REDIRECT;;<encoded>`) or 4-part\n // (permanentRedirect: `NEXT_REDIRECT;<type>;<encoded>;308`) digests;\n // Next.js emits 5-part digests (`NEXT_REDIRECT;<type>;<url>;<status>;<isClient>`).\n // vinext's `isRedirectError` is more permissive (just `startsWith(\"NEXT_REDIRECT;\")`)\n // so we branch on length rather than always using `slice(2, -2)`.\n const encodedTarget = parts.length >= 5 ? parts.slice(2, -2).join(\";\") : parts[2];\n return encodedTarget ? decodeRedirectTarget(encodedTarget) : null;\n}\n\nfunction getRedirectTypeFromError(error: RedirectError): \"push\" | \"replace\" {\n const type = error.digest.split(\";\", 2)[1];\n return type === \"push\" ? \"push\" : \"replace\";\n}\n\nfunction HandleRedirect({\n redirect,\n redirectType,\n}: {\n redirect: string;\n redirectType: \"push\" | \"replace\";\n}) {\n const router = useRouter();\n\n React.useEffect(() => {\n React.startTransition(() => {\n if (redirectType === \"push\") {\n router.push(redirect);\n } else {\n router.replace(redirect);\n }\n // Intentionally no reset() here. The boundary stays in its \"redirect\n // caught\" state (rendering this component, which returns null) until\n // router.push()/replace() triggers a new render at the destination\n // route. That naturally unmounts this boundary and mounts a fresh one.\n // Calling reset() would clear the boundary state, causing React to\n // re-render children — which re-mounts the page component that threw\n // redirect() in the first place. For deterministic redirects (e.g.\n // auth guards), that creates an infinite redirect loop.\n // Matches Next.js's HandleRedirect in redirect-boundary.tsx.\n });\n }, [redirect, redirectType, router]);\n\n return null;\n}\n\nexport class RedirectErrorBoundary extends React.Component<\n { children?: React.ReactNode },\n RedirectBoundaryState\n> {\n constructor(props: { children?: React.ReactNode }) {\n super(props);\n this.state = {\n redirect: null,\n redirectType: null,\n };\n }\n\n static getDerivedStateFromError(error: unknown): RedirectBoundaryState {\n if (isRedirectError(error)) {\n // The public `isRedirectError` narrows to `Error & { digest: string }`.\n // Cast to the local `RedirectError` (which also carries the optional\n // `handled` field) so the parity logic below compiles. The cast is\n // safe because every error that matches the prefix predicate is — by\n // construction — produced by vinext's `redirect()` /\n // `permanentRedirect()` helpers, which yield `Error` instances.\n const redirectError = error as RedirectError;\n // Next.js parity: an outer RedirectBoundary that has already started\n // handling a redirect marks the error as `handled` so that, if React\n // re-throws the same error during a retry render, an inner boundary\n // doesn't re-dispatch the same `router.replace()`. Vinext doesn't\n // currently emit `handled` itself (we never assign it on the error\n // object), but we keep the branch so behavior matches Next.js if a\n // host or future change ever does.\n if (redirectError.handled) {\n return {\n redirect: null,\n redirectType: null,\n };\n }\n\n const url = getURLFromRedirectError(redirectError);\n if (url === null) {\n // Malformed digest (e.g. `NEXT_REDIRECT;push;` with an empty URL\n // segment). The server-side parser at next-error-digest.ts:51 also\n // rejects this. Re-throw so the error reaches a regular error\n // boundary instead of being silently swallowed.\n throw error;\n }\n\n return {\n redirect: url,\n redirectType: getRedirectTypeFromError(redirectError),\n };\n }\n\n throw error;\n }\n\n render() {\n const { redirect, redirectType } = this.state;\n if (redirect !== null && redirectType !== null) {\n return <HandleRedirect redirect={redirect} redirectType={redirectType} />;\n }\n\n return this.props.children;\n }\n}\n\nexport function RedirectBoundary({ children }: { children?: React.ReactNode }) {\n return <RedirectErrorBoundary>{children}</RedirectErrorBoundary>;\n}\n\n/**\n * Generic ErrorBoundary used to wrap route segments with error.tsx.\n * This must be a client component since error boundaries use\n * componentDidCatch / getDerivedStateFromError.\n */\nexport class ErrorBoundaryInner extends React.Component<\n ErrorBoundaryInnerProps,\n ErrorBoundaryState\n> {\n constructor(props: ErrorBoundaryInnerProps) {\n super(props);\n this.state = { error: null, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: ErrorBoundaryInnerProps,\n state: ErrorBoundaryState,\n ): ErrorBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.error && shouldResetBoundary(nextResetState, state)) {\n return { error: null, ...nextResetState };\n }\n return { error: state.error, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<ErrorBoundaryState> {\n // notFound(), forbidden(), unauthorized(), and redirect() must propagate\n // past error boundaries. Re-throw them so they bubble up to the\n // framework's HTTP access fallback / redirect handler.\n if (isNavigationSignalError(error)) {\n throw error;\n }\n return { error: { thrownValue: error } };\n }\n\n reset = () => {\n this.setState({ error: null });\n };\n\n render() {\n if (this.state.error) {\n const FallbackComponent = this.props.fallback;\n return <FallbackComponent error={this.state.error.thrownValue} reset={this.reset} />;\n }\n return this.props.children;\n }\n}\n\nexport function ErrorBoundary({ fallback, children, resetKey }: ErrorBoundaryProps) {\n const pathname = usePathname();\n return (\n <ErrorBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </ErrorBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// NotFoundBoundary — catches notFound() on the client and renders not-found.tsx\n// ---------------------------------------------------------------------------\n\ntype NotFoundBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype NotFoundBoundaryInnerProps = {\n pathname: string;\n} & NotFoundBoundaryProps;\n\ntype NotFoundBoundaryState = {\n notFound: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\n/**\n * Inner class component that catches notFound() errors and renders the\n * not-found.tsx fallback. Resets on the caller's segment reset key when one is\n * provided, otherwise falls back to pathname changes for legacy callers.\n *\n * The ErrorBoundary above re-throws notFound errors so they propagate up to this\n * boundary. This must be placed above the ErrorBoundary in the component tree.\n */\nclass NotFoundBoundaryInner extends React.Component<\n NotFoundBoundaryInnerProps,\n NotFoundBoundaryState\n> {\n constructor(props: NotFoundBoundaryInnerProps) {\n super(props);\n this.state = { notFound: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: NotFoundBoundaryInnerProps,\n state: NotFoundBoundaryState,\n ): NotFoundBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.notFound && shouldResetBoundary(nextResetState, state)) {\n return { notFound: false, ...nextResetState };\n }\n return { notFound: state.notFound, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<NotFoundBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_NOT_FOUND\" || digest === \"NEXT_HTTP_ERROR_FALLBACK;404\") {\n return { notFound: true };\n }\n }\n // Not a notFound error — re-throw so it reaches an ErrorBoundary or propagates\n throw error;\n }\n\n render() {\n if (this.state.notFound) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\n/**\n * Wrapper that reads the current pathname and passes it to the inner class\n * component. Segment reset keys own App Router remount semantics when present.\n */\nexport function NotFoundBoundary({ fallback, children, resetKey }: NotFoundBoundaryProps) {\n const pathname = usePathname();\n return (\n <NotFoundBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </NotFoundBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// ForbiddenBoundary — catches forbidden() on the client and renders forbidden.tsx\n// ---------------------------------------------------------------------------\n\ntype ForbiddenBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype ForbiddenBoundaryInnerProps = {\n pathname: string;\n} & ForbiddenBoundaryProps;\n\ntype ForbiddenBoundaryState = {\n forbidden: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nexport class ForbiddenBoundaryInner extends React.Component<\n ForbiddenBoundaryInnerProps,\n ForbiddenBoundaryState\n> {\n constructor(props: ForbiddenBoundaryInnerProps) {\n super(props);\n this.state = { forbidden: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: ForbiddenBoundaryInnerProps,\n state: ForbiddenBoundaryState,\n ): ForbiddenBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.forbidden && shouldResetBoundary(nextResetState, state)) {\n return { forbidden: false, ...nextResetState };\n }\n return { forbidden: state.forbidden, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<ForbiddenBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_HTTP_ERROR_FALLBACK;403\") {\n return { forbidden: true };\n }\n }\n throw error;\n }\n\n render() {\n if (this.state.forbidden) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\nexport function ForbiddenBoundary({ fallback, children, resetKey }: ForbiddenBoundaryProps) {\n const pathname = usePathname();\n return (\n <ForbiddenBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </ForbiddenBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// UnauthorizedBoundary — catches unauthorized() on the client and renders unauthorized.tsx\n// ---------------------------------------------------------------------------\n\ntype UnauthorizedBoundaryProps = {\n fallback: React.ReactNode;\n children: React.ReactNode;\n resetKey?: string | null;\n};\n\ntype UnauthorizedBoundaryInnerProps = {\n pathname: string;\n} & UnauthorizedBoundaryProps;\n\ntype UnauthorizedBoundaryState = {\n unauthorized: boolean;\n previousPathname: string;\n previousResetKey: string | null;\n};\n\nexport class UnauthorizedBoundaryInner extends React.Component<\n UnauthorizedBoundaryInnerProps,\n UnauthorizedBoundaryState\n> {\n constructor(props: UnauthorizedBoundaryInnerProps) {\n super(props);\n this.state = { unauthorized: false, ...readBoundaryResetState(props) };\n }\n\n static getDerivedStateFromProps(\n props: UnauthorizedBoundaryInnerProps,\n state: UnauthorizedBoundaryState,\n ): UnauthorizedBoundaryState | null {\n const nextResetState = readBoundaryResetState(props);\n if (state.unauthorized && shouldResetBoundary(nextResetState, state)) {\n return { unauthorized: false, ...nextResetState };\n }\n return { unauthorized: state.unauthorized, ...nextResetState };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<UnauthorizedBoundaryState> {\n if (error && typeof error === \"object\" && \"digest\" in error) {\n const digest = String(error.digest);\n if (digest === \"NEXT_HTTP_ERROR_FALLBACK;401\") {\n return { unauthorized: true };\n }\n }\n throw error;\n }\n\n render() {\n if (this.state.unauthorized) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\nexport function UnauthorizedBoundary({ fallback, children, resetKey }: UnauthorizedBoundaryProps) {\n const pathname = usePathname();\n return (\n <UnauthorizedBoundaryInner pathname={pathname} resetKey={resetKey} fallback={fallback}>\n {children}\n </UnauthorizedBoundaryInner>\n );\n}\n\n// ---------------------------------------------------------------------------\n// DevRecoveryBoundary — dev-only top-level boundary inside BrowserRoot.\n// Catches any render error that isn't already handled by a user-defined\n// error.tsx (or the access-fallback boundaries above), renders nothing, and\n// keeps BrowserRoot mounted so HMR can dispatch a new RSC payload without a\n// full page reload. Resets on resetKey change — the caller bumps that key\n// (e.g. via treeState.renderId) when a fresh tree is dispatched.\n//\n// Routing sentinels are re-thrown so notFound()/redirect()/forbidden()/\n// unauthorized() still reach their dedicated boundaries above.\n// ---------------------------------------------------------------------------\n\nexport type DevRecoveryBoundaryProps = {\n resetKey: number;\n // Called from componentDidCatch with the current resetKey so the host can\n // run any pending side effects that NavigationCommitSignal would normally\n // drive on commit — most importantly the URL update for the in-flight\n // soft-nav. Without this, a navigation that fails mid-render leaves the\n // browser on the previous URL even though the boundary recovered.\n //\n // The error itself is intentionally not passed: React's onCaughtError option\n // already routes the error to the dev overlay, so this callback is only for\n // commit-side effects keyed by resetKey.\n onCatch?: (resetKey: number) => void;\n // Children come through React.Component's PropsWithChildren default; declared\n // optional so callers can pass them positionally to createElement without\n // tripping the eslint no-children-prop rule.\n children?: React.ReactNode;\n};\n\ntype DevRecoveryBoundaryState = {\n error: CapturedError | null;\n previousResetKey: number;\n};\n\nexport class DevRecoveryBoundary extends React.Component<\n DevRecoveryBoundaryProps,\n DevRecoveryBoundaryState\n> {\n constructor(props: DevRecoveryBoundaryProps) {\n super(props);\n this.state = { error: null, previousResetKey: props.resetKey };\n }\n\n static getDerivedStateFromProps(\n props: DevRecoveryBoundaryProps,\n state: DevRecoveryBoundaryState,\n ): DevRecoveryBoundaryState | null {\n if (props.resetKey === state.previousResetKey) {\n return null;\n }\n return { error: null, previousResetKey: props.resetKey };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<DevRecoveryBoundaryState> {\n // Re-throw routing sentinels so they still reach NotFoundBoundary /\n // RedirectBoundary / Forbidden / Unauthorized above.\n if (isNavigationSignalError(error)) {\n throw error;\n }\n return { error: { thrownValue: error } };\n }\n\n componentDidCatch(): void {\n this.props.onCatch?.(this.props.resetKey);\n }\n\n render() {\n if (this.state.error) {\n // Render nothing — the dev overlay (mounted in a separate React root)\n // shows the actual error to the developer. HMR pushing a new payload\n // bumps resetKey above, clearing this state and letting the children\n // re-render with the fixed code.\n return null;\n }\n return this.props.children;\n }\n}\n"],"mappings":";;;;;;AAgDA,SAAS,0BAA0B,UAAoD;CACrF,OAAO,aAAa,KAAA,KAAa,aAAa,QAAQ,aAAa,KAAK,OAAO;;AAGjF,SAAS,uBAAuB,OAA+C;CAC7E,OAAO;EACL,kBAAkB,MAAM;EACxB,kBAAkB,0BAA0B,MAAM,SAAS;EAC5D;;AAGH,SAAS,oBACP,gBACA,oBACS;CACT,MAAM,eAAe,0BAA0B,eAAe,iBAAiB;CAC/E,MAAM,mBAAmB,0BAA0B,mBAAmB,iBAAiB;CAEvF,IAAI,iBAAiB,QAAQ,qBAAqB,MAChD,OAAO,iBAAiB;CAG1B,OAAO,eAAe,qBAAqB,mBAAmB;;AAGhE,SAAS,qBAAqB,QAAwB;CACpD,IAAI;EACF,OAAO,mBAAmB,OAAO;SAC3B;EACN,OAAO;;;AAIX,SAAS,wBAAwB,OAAqC;CACpE,MAAM,QAAQ,MAAM,OAAO,MAAM,IAAI;CAMrC,MAAM,gBAAgB,MAAM,UAAU,IAAI,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,MAAM;CAC/E,OAAO,gBAAgB,qBAAqB,cAAc,GAAG;;AAG/D,SAAS,yBAAyB,OAA0C;CAE1E,OADa,MAAM,OAAO,MAAM,KAAK,EAAE,CAAC,OACxB,SAAS,SAAS;;AAGpC,SAAS,eAAe,EACtB,UACA,gBAIC;CACD,MAAM,SAAS,WAAW;CAE1B,MAAM,gBAAgB;EACpB,MAAM,sBAAsB;GAC1B,IAAI,iBAAiB,QACnB,OAAO,KAAK,SAAS;QAErB,OAAO,QAAQ,SAAS;IAW1B;IACD;EAAC;EA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B;EAAY;EAAoB;EAC1E;EACyB,CAAA;;AAuChC,IAAa,sBAAb,cAAyC,MAAM,UAG7C;CACA,YAAY,OAAiC;EAC3C,MAAM,MAAM;EACZ,KAAK,QAAQ;GAAE,OAAO;GAAM,kBAAkB,MAAM;GAAU;;CAGhE,OAAO,yBACL,OACA,OACiC;EACjC,IAAI,MAAM,aAAa,MAAM,kBAC3B,OAAO;EAET,OAAO;GAAE,OAAO;GAAM,kBAAkB,MAAM;GAAU;;CAG1D,OAAO,yBAAyB,OAAmD;EAGjF,IAAI,wBAAwB,MAAM,EAChC,MAAM;EAER,OAAO,EAAE,OAAO,EAAE,aAAa,OAAO,EAAE;;CAG1C,oBAA0B;EACxB,KAAK,MAAM,UAAU,KAAK,MAAM,SAAS;;CAG3C,SAAS;EACP,IAAI,KAAK,MAAM,OAKb,OAAO;EAET,OAAO,KAAK,MAAM"}
|
package/dist/shims/error.d.ts
CHANGED
|
@@ -10,6 +10,23 @@ declare function ErrorComponent({
|
|
|
10
10
|
statusCode,
|
|
11
11
|
title
|
|
12
12
|
}: ErrorProps): React.ReactElement;
|
|
13
|
+
type ErrorInfo = {
|
|
14
|
+
error: unknown;
|
|
15
|
+
reset: () => void;
|
|
16
|
+
unstable_retry: () => void;
|
|
17
|
+
};
|
|
18
|
+
type _UserProps = Record<string, unknown>;
|
|
19
|
+
/**
|
|
20
|
+
* Wrap a fallback render function in a Component-level error boundary.
|
|
21
|
+
* Returns a Component that renders `children` and, on error, renders the
|
|
22
|
+
* supplied fallback with an `ErrorInfo` value.
|
|
23
|
+
*
|
|
24
|
+
* Ported from Next.js:
|
|
25
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/catch-error.tsx
|
|
26
|
+
*/
|
|
27
|
+
declare function unstable_catchError<P extends _UserProps>(fallback: (props: P, errorInfo: ErrorInfo) => React.ReactNode): React.ComponentType<P & {
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
}>;
|
|
13
30
|
//#endregion
|
|
14
|
-
export { ErrorComponent as default };
|
|
31
|
+
export { ErrorInfo, ErrorComponent as default, unstable_catchError };
|
|
15
32
|
//# sourceMappingURL=error.d.ts.map
|
package/dist/shims/error.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { appRouterInstance, isNextRouterError } from "./navigation.js";
|
|
1
2
|
import React from "react";
|
|
2
3
|
//#region src/shims/error.tsx
|
|
3
4
|
/**
|
|
@@ -6,6 +7,10 @@ import React from "react";
|
|
|
6
7
|
* Provides the default Next.js error page component.
|
|
7
8
|
* Used by apps that import `import Error from 'next/error'` for
|
|
8
9
|
* custom error handling in getServerSideProps or API routes.
|
|
10
|
+
*
|
|
11
|
+
* Also re-exports the unstable App Router error-boundary HOC
|
|
12
|
+
* (`unstable_catchError`) and its `ErrorInfo` type, mirroring
|
|
13
|
+
* `next/error`'s public surface.
|
|
9
14
|
*/
|
|
10
15
|
function ErrorComponent({ statusCode, title }) {
|
|
11
16
|
const displayTitle = title ?? (statusCode === 404 ? "This page could not be found" : "Internal Server Error");
|
|
@@ -33,7 +38,57 @@ function ErrorComponent({ statusCode, title }) {
|
|
|
33
38
|
margin: 0
|
|
34
39
|
} }, displayTitle + "."))));
|
|
35
40
|
}
|
|
41
|
+
var _CatchError = class extends React.Component {
|
|
42
|
+
static displayName = "unstable_catchError(Next.CatchError)";
|
|
43
|
+
state = { error: null };
|
|
44
|
+
static getDerivedStateFromError(thrownValue) {
|
|
45
|
+
if (isNextRouterError(thrownValue)) throw thrownValue;
|
|
46
|
+
return { error: { thrownValue } };
|
|
47
|
+
}
|
|
48
|
+
reset = () => {
|
|
49
|
+
this.setState({ error: null });
|
|
50
|
+
};
|
|
51
|
+
unstable_retry = () => {
|
|
52
|
+
if (typeof window === "undefined") throw new Error("`unstable_retry()` can only be used on the client. Call it from a user interaction handler inside the error fallback.");
|
|
53
|
+
React.startTransition(() => {
|
|
54
|
+
appRouterInstance.refresh();
|
|
55
|
+
this.reset();
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
render() {
|
|
59
|
+
if (this.state.error) {
|
|
60
|
+
const errorInfo = {
|
|
61
|
+
error: this.state.error.thrownValue,
|
|
62
|
+
reset: this.reset,
|
|
63
|
+
unstable_retry: this.unstable_retry
|
|
64
|
+
};
|
|
65
|
+
return this.props.fallback(this.props.forwardedProps, errorInfo);
|
|
66
|
+
}
|
|
67
|
+
return this.props.children;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Wrap a fallback render function in a Component-level error boundary.
|
|
72
|
+
* Returns a Component that renders `children` and, on error, renders the
|
|
73
|
+
* supplied fallback with an `ErrorInfo` value.
|
|
74
|
+
*
|
|
75
|
+
* Ported from Next.js:
|
|
76
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/catch-error.tsx
|
|
77
|
+
*/
|
|
78
|
+
function unstable_catchError(fallback) {
|
|
79
|
+
const TypedCatchError = _CatchError;
|
|
80
|
+
function CatchErrorBoundary(allProps) {
|
|
81
|
+
const { children, ...rest } = allProps;
|
|
82
|
+
const forwardedProps = rest;
|
|
83
|
+
return React.createElement(TypedCatchError, {
|
|
84
|
+
fallback,
|
|
85
|
+
forwardedProps
|
|
86
|
+
}, children);
|
|
87
|
+
}
|
|
88
|
+
CatchErrorBoundary.displayName = `unstable_catchError(${fallback.name || "CatchErrorFallback"})`;
|
|
89
|
+
return CatchErrorBoundary;
|
|
90
|
+
}
|
|
36
91
|
//#endregion
|
|
37
|
-
export { ErrorComponent as default };
|
|
92
|
+
export { ErrorComponent as default, unstable_catchError };
|
|
38
93
|
|
|
39
94
|
//# sourceMappingURL=error.js.map
|