vinext 0.0.49 → 0.0.51
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/client-build-config.js.map +1 -1
- package/dist/build/google-fonts/build-url.js.map +1 -1
- 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/google-fonts/get-axes.js.map +1 -1
- package/dist/build/google-fonts/sort-variants.js.map +1 -1
- package/dist/build/google-fonts/validate.js.map +1 -1
- package/dist/build/layout-classification.js.map +1 -1
- package/dist/build/nitro-route-rules.js.map +1 -1
- package/dist/build/precompress.d.ts +13 -2
- package/dist/build/precompress.js +12 -3
- package/dist/build/precompress.js.map +1 -1
- package/dist/build/prerender.d.ts +17 -1
- package/dist/build/prerender.js +114 -23
- 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/build/route-classification-injector.js.map +1 -1
- package/dist/build/route-classification-manifest.js.map +1 -1
- package/dist/build/run-prerender.js.map +1 -1
- package/dist/build/server-manifest.js.map +1 -1
- package/dist/build/ssr-manifest.js.map +1 -1
- package/dist/build/standalone.js.map +1 -1
- package/dist/build/static-export.js.map +1 -1
- package/dist/check.js +2 -1
- package/dist/check.js.map +1 -1
- package/dist/cli-args.js.map +1 -1
- package/dist/cli.js +68 -7
- package/dist/cli.js.map +1 -1
- package/dist/client/instrumentation-client-state.js.map +1 -1
- package/dist/client/validate-module-path.js.map +1 -1
- package/dist/client/vinext-next-data.d.ts +5 -1
- package/dist/client/window-next.d.ts +151 -0
- package/dist/client/window-next.js +48 -0
- package/dist/client/window-next.js.map +1 -0
- package/dist/cloudflare/kv-cache-handler.js.map +1 -1
- package/dist/cloudflare/tpr.js +2 -1
- package/dist/cloudflare/tpr.js.map +1 -1
- package/dist/config/config-matchers.d.ts +3 -1
- package/dist/config/config-matchers.js +5 -4
- 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 +93 -6
- package/dist/config/next-config.js +233 -6
- 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 +16 -7
- package/dist/deploy.js.map +1 -1
- package/dist/entries/app-browser-entry.d.ts +3 -1
- package/dist/entries/app-browser-entry.js +36 -2
- 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 +49 -12
- package/dist/entries/app-rsc-entry.js.map +1 -1
- package/dist/entries/app-rsc-manifest.d.ts +9 -0
- package/dist/entries/app-rsc-manifest.js +8 -1
- package/dist/entries/app-rsc-manifest.js.map +1 -1
- package/dist/entries/app-ssr-entry.js.map +1 -1
- package/dist/entries/pages-client-entry.js +3 -5
- package/dist/entries/pages-client-entry.js.map +1 -1
- package/dist/entries/pages-entry-helpers.js.map +1 -1
- package/dist/entries/pages-server-entry.js +34 -1
- package/dist/entries/pages-server-entry.js.map +1 -1
- package/dist/entries/runtime-entry-module.js.map +1 -1
- package/dist/index.js +204 -53
- package/dist/index.js.map +1 -1
- package/dist/init.js.map +1 -1
- package/dist/plugins/async-hooks-stub.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/fonts.d.ts +2 -2
- package/dist/plugins/fonts.js +15 -6
- package/dist/plugins/fonts.js.map +1 -1
- package/dist/plugins/instrumentation-client.js.map +1 -1
- package/dist/plugins/og-assets.js.map +1 -1
- package/dist/plugins/optimize-imports.js.map +1 -1
- package/dist/plugins/postcss.js.map +1 -1
- package/dist/plugins/rsc-client-reference-loaders.d.ts +7 -0
- package/dist/plugins/rsc-client-reference-loaders.js +48 -0
- package/dist/plugins/rsc-client-reference-loaders.js.map +1 -0
- package/dist/plugins/rsc-client-shim-excludes.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/server-externals-manifest.js.map +1 -1
- package/dist/plugins/strip-server-exports.js.map +1 -1
- package/dist/routing/app-route-graph.d.ts +78 -6
- package/dist/routing/app-route-graph.js +241 -25
- package/dist/routing/app-route-graph.js.map +1 -1
- package/dist/routing/app-router.js.map +1 -1
- package/dist/routing/file-matcher.js.map +1 -1
- package/dist/routing/pages-router.js.map +1 -1
- package/dist/routing/route-matching.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/route-trie.js.map +1 -1
- package/dist/routing/route-validation.js.map +1 -1
- package/dist/routing/utils.js.map +1 -1
- package/dist/server/api-handler.js.map +1 -1
- package/dist/server/app-browser-action-result.d.ts +44 -0
- package/dist/server/app-browser-action-result.js +79 -0
- package/dist/server/app-browser-action-result.js.map +1 -0
- package/dist/server/app-browser-entry.js +330 -133
- package/dist/server/app-browser-entry.js.map +1 -1
- package/dist/server/app-browser-error.js.map +1 -1
- package/dist/server/app-browser-hydration.d.ts +31 -0
- package/dist/server/app-browser-hydration.js +30 -0
- package/dist/server/app-browser-hydration.js.map +1 -0
- package/dist/server/app-browser-navigation-controller.d.ts +20 -4
- package/dist/server/app-browser-navigation-controller.js +90 -23
- 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 +28 -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 +27 -23
- package/dist/server/app-browser-state.js +158 -54
- package/dist/server/app-browser-state.js.map +1 -1
- package/dist/server/app-browser-stream.d.ts +9 -4
- package/dist/server/app-browser-stream.js +29 -8
- package/dist/server/app-browser-stream.js.map +1 -1
- package/dist/server/app-browser-visible-commit.d.ts +11 -1
- package/dist/server/app-browser-visible-commit.js +69 -21
- package/dist/server/app-browser-visible-commit.js.map +1 -1
- package/dist/server/app-client-reference-preloader.js.map +1 -1
- package/dist/server/app-elements-wire.d.ts +43 -6
- package/dist/server/app-elements-wire.js +121 -5
- package/dist/server/app-elements-wire.js.map +1 -1
- package/dist/server/app-elements.d.ts +2 -2
- package/dist/server/app-elements.js +2 -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 +37 -1
- 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-hook-warning-suppression.js.map +1 -1
- package/dist/server/app-middleware.d.ts +1 -1
- package/dist/server/app-middleware.js +4 -9
- package/dist/server/app-middleware.js.map +1 -1
- package/dist/server/app-mounted-slots-header.js.map +1 -1
- package/dist/server/app-page-boundary-render.d.ts +11 -1
- package/dist/server/app-page-boundary-render.js +27 -19
- package/dist/server/app-page-boundary-render.js.map +1 -1
- package/dist/server/app-page-boundary.d.ts +1 -0
- package/dist/server/app-page-boundary.js +10 -7
- package/dist/server/app-page-boundary.js.map +1 -1
- package/dist/server/app-page-cache.d.ts +23 -3
- package/dist/server/app-page-cache.js +63 -27
- package/dist/server/app-page-cache.js.map +1 -1
- package/dist/server/app-page-dispatch.d.ts +11 -1
- package/dist/server/app-page-dispatch.js +85 -14
- package/dist/server/app-page-dispatch.js.map +1 -1
- package/dist/server/app-page-element-builder.d.ts +10 -1
- package/dist/server/app-page-element-builder.js +38 -6
- package/dist/server/app-page-element-builder.js.map +1 -1
- package/dist/server/app-page-execution.js +2 -3
- 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 +6 -1
- package/dist/server/app-page-head.js.map +1 -1
- package/dist/server/app-page-method.js.map +1 -1
- package/dist/server/app-page-params.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 +12 -2
- package/dist/server/app-page-render.js +90 -7
- 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 +2 -1
- package/dist/server/app-page-request.js.map +1 -1
- package/dist/server/app-page-response.d.ts +2 -0
- package/dist/server/app-page-response.js +18 -7
- package/dist/server/app-page-response.js.map +1 -1
- package/dist/server/app-page-route-wiring.d.ts +9 -3
- package/dist/server/app-page-route-wiring.js +91 -62
- package/dist/server/app-page-route-wiring.js.map +1 -1
- package/dist/server/app-page-segment-state.d.ts +10 -0
- package/dist/server/app-page-segment-state.js +87 -0
- package/dist/server/app-page-segment-state.js.map +1 -0
- package/dist/server/app-page-stream.d.ts +9 -2
- package/dist/server/app-page-stream.js +4 -1
- package/dist/server/app-page-stream.js.map +1 -1
- package/dist/server/app-post-middleware-context.js.map +1 -1
- package/dist/server/app-prerender-endpoints.js.map +1 -1
- package/dist/server/app-prerender-static-params.js.map +1 -1
- package/dist/server/app-render-dependency.js.map +1 -1
- package/dist/server/app-request-context.js.map +1 -1
- package/dist/server/app-route-handler-cache.js.map +1 -1
- package/dist/server/app-route-handler-dispatch.js +3 -1
- package/dist/server/app-route-handler-dispatch.js.map +1 -1
- package/dist/server/app-route-handler-execution.js.map +1 -1
- package/dist/server/app-route-handler-policy.js +1 -0
- package/dist/server/app-route-handler-policy.js.map +1 -1
- package/dist/server/app-route-handler-response.js +4 -3
- package/dist/server/app-route-handler-response.js.map +1 -1
- package/dist/server/app-route-handler-runtime.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 +23 -2
- package/dist/server/app-rsc-cache-busting.js +75 -19
- 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-error-handler.js.map +1 -1
- 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 +18 -1
- package/dist/server/app-rsc-handler.js +55 -16
- package/dist/server/app-rsc-handler.js.map +1 -1
- package/dist/server/app-rsc-render-mode.d.ts +11 -0
- package/dist/server/app-rsc-render-mode.js +21 -0
- package/dist/server/app-rsc-render-mode.js.map +1 -0
- package/dist/server/app-rsc-request-normalization.d.ts +4 -1
- package/dist/server/app-rsc-request-normalization.js +7 -2
- package/dist/server/app-rsc-request-normalization.js.map +1 -1
- package/dist/server/app-rsc-response-finalizer.d.ts +2 -1
- package/dist/server/app-rsc-response-finalizer.js +6 -1
- 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 +45 -23
- package/dist/server/app-rsc-route-matching.js.map +1 -1
- package/dist/server/app-segment-config.js.map +1 -1
- package/dist/server/app-server-action-execution.d.ts +51 -5
- package/dist/server/app-server-action-execution.js +161 -51
- package/dist/server/app-server-action-execution.js.map +1 -1
- package/dist/server/app-ssr-entry.d.ts +7 -0
- package/dist/server/app-ssr-entry.js +44 -14
- 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 +1 -1
- package/dist/server/app-ssr-stream.js +9 -12
- package/dist/server/app-ssr-stream.js.map +1 -1
- package/dist/server/app-static-generation.js.map +1 -1
- package/dist/server/artifact-compatibility.d.ts +12 -2
- package/dist/server/artifact-compatibility.js +12 -8
- package/dist/server/artifact-compatibility.js.map +1 -1
- package/dist/server/cache-control.js +1 -0
- package/dist/server/cache-control.js.map +1 -1
- package/dist/server/cache-proof.d.ts +124 -5
- package/dist/server/cache-proof.js +416 -18
- package/dist/server/cache-proof.js.map +1 -1
- package/dist/server/csp.js.map +1 -1
- package/dist/server/dev-error-overlay-store.js.map +1 -1
- package/dist/server/dev-error-overlay.js +5 -0
- package/dist/server/dev-error-overlay.js.map +1 -1
- 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-module-runner.js.map +1 -1
- package/dist/server/dev-origin-check.js.map +1 -1
- package/dist/server/dev-route-files.js.map +1 -1
- package/dist/server/dev-server.js +23 -10
- package/dist/server/dev-server.js.map +1 -1
- 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 +81 -0
- package/dist/server/headers.js +104 -0
- package/dist/server/headers.js.map +1 -0
- package/dist/server/html.js +1 -1
- package/dist/server/html.js.map +1 -1
- package/dist/server/http-error-responses.d.ts +10 -0
- package/dist/server/http-error-responses.js +11 -1
- package/dist/server/http-error-responses.js.map +1 -1
- package/dist/server/image-optimization.d.ts +11 -1
- package/dist/server/image-optimization.js.map +1 -1
- package/dist/server/implicit-tags.js +2 -1
- package/dist/server/implicit-tags.js.map +1 -1
- package/dist/server/instrumentation-runtime.js.map +1 -1
- package/dist/server/instrumentation.js.map +1 -1
- package/dist/server/isr-cache.d.ts +12 -2
- package/dist/server/isr-cache.js +16 -5
- package/dist/server/isr-cache.js.map +1 -1
- package/dist/server/metadata-route-build-data.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-matcher.js.map +1 -1
- package/dist/server/middleware-request-headers.d.ts +4 -1
- package/dist/server/middleware-request-headers.js +15 -8
- package/dist/server/middleware-request-headers.js.map +1 -1
- package/dist/server/middleware-response-headers.d.ts +2 -1
- package/dist/server/middleware-response-headers.js +1 -1
- package/dist/server/middleware-response-headers.js.map +1 -1
- package/dist/server/middleware-runtime.d.ts +1 -0
- package/dist/server/middleware-runtime.js +7 -3
- package/dist/server/middleware-runtime.js.map +1 -1
- package/dist/server/middleware.d.ts +12 -0
- package/dist/server/middleware.js +12 -0
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/navigation-planner.d.ts +133 -0
- package/dist/server/navigation-planner.js +432 -0
- package/dist/server/navigation-planner.js.map +1 -0
- package/dist/server/navigation-trace.d.ts +19 -2
- package/dist/server/navigation-trace.js +20 -1
- package/dist/server/navigation-trace.js.map +1 -1
- package/dist/server/next-error-digest.d.ts +3 -2
- package/dist/server/next-error-digest.js +4 -2
- package/dist/server/next-error-digest.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.js +1 -0
- package/dist/server/pages-api-route.js.map +1 -1
- package/dist/server/pages-i18n.js.map +1 -1
- package/dist/server/pages-media-type.js.map +1 -1
- package/dist/server/pages-node-compat.js.map +1 -1
- package/dist/server/pages-page-data.d.ts +3 -2
- package/dist/server/pages-page-data.js +27 -5
- package/dist/server/pages-page-data.js.map +1 -1
- package/dist/server/pages-page-response.js +2 -1
- package/dist/server/pages-page-response.js.map +1 -1
- package/dist/server/prerender-work-unit-setup.js +1 -1
- package/dist/server/prerender-work-unit-setup.js.map +1 -1
- package/dist/server/prod-server.d.ts +28 -1
- package/dist/server/prod-server.js +97 -22
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/request-log.js.map +1 -1
- package/dist/server/request-pipeline.d.ts +1 -13
- package/dist/server/request-pipeline.js +3 -25
- package/dist/server/request-pipeline.js.map +1 -1
- package/dist/server/rsc-stream-hints.js.map +1 -1
- 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 +22 -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/socket-error-backstop.js.map +1 -1
- package/dist/server/static-file-cache.js +1 -1
- package/dist/server/static-file-cache.js.map +1 -1
- package/dist/server/worker-utils.d.ts +0 -7
- package/dist/server/worker-utils.js +3 -2
- package/dist/server/worker-utils.js.map +1 -1
- package/dist/shims/amp.js.map +1 -1
- package/dist/shims/app.d.ts +37 -4
- package/dist/shims/app.js +50 -1
- package/dist/shims/app.js.map +1 -0
- package/dist/shims/cache-for-request.js.map +1 -1
- package/dist/shims/cache-runtime.d.ts +19 -2
- package/dist/shims/cache-runtime.js +87 -19
- package/dist/shims/cache-runtime.js.map +1 -1
- package/dist/shims/cache.d.ts +20 -21
- package/dist/shims/cache.js +101 -15
- package/dist/shims/cache.js.map +1 -1
- package/dist/shims/client-hook-error.js.map +1 -1
- package/dist/shims/compat-router.js.map +1 -1
- package/dist/shims/config.js.map +1 -1
- package/dist/shims/constants.js.map +1 -1
- package/dist/shims/document.js.map +1 -1
- package/dist/shims/dynamic.d.ts +18 -10
- package/dist/shims/dynamic.js +107 -51
- package/dist/shims/dynamic.js.map +1 -1
- package/dist/shims/error-boundary.d.ts +35 -6
- package/dist/shims/error-boundary.js +116 -33
- 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 +25 -1
- package/dist/shims/fetch-cache.js +159 -13
- 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 +3 -1
- 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/head-state.js.map +1 -1
- package/dist/shims/head.d.ts +3 -1
- package/dist/shims/head.js +28 -16
- package/dist/shims/head.js.map +1 -1
- package/dist/shims/headers.d.ts +11 -12
- package/dist/shims/headers.js +45 -8
- package/dist/shims/headers.js.map +1 -1
- package/dist/shims/i18n-context.js.map +1 -1
- package/dist/shims/i18n-state.js.map +1 -1
- package/dist/shims/image-config.d.ts +14 -1
- package/dist/shims/image-config.js +24 -1
- package/dist/shims/image-config.js.map +1 -1
- package/dist/shims/image.d.ts +1 -0
- package/dist/shims/image.js +159 -80
- package/dist/shims/image.js.map +1 -1
- package/dist/shims/internal/als-registry.js.map +1 -1
- package/dist/shims/internal/app-router-context.d.ts +7 -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/internal/cookie-serialize.js.map +1 -1
- package/dist/shims/internal/make-hanging-promise.d.ts +1 -1
- package/dist/shims/internal/make-hanging-promise.js +1 -1
- package/dist/shims/internal/make-hanging-promise.js.map +1 -1
- package/dist/shims/internal/parse-cookie-header.js.map +1 -1
- package/dist/shims/internal/utils.js.map +1 -1
- package/dist/shims/internal/work-unit-async-storage.js +2 -2
- package/dist/shims/internal/work-unit-async-storage.js.map +1 -1
- package/dist/shims/layout-segment-context.js.map +1 -1
- package/dist/shims/legacy-image.js.map +1 -1
- package/dist/shims/link-prefetch.d.ts +42 -0
- package/dist/shims/link-prefetch.js +45 -0
- package/dist/shims/link-prefetch.js.map +1 -0
- package/dist/shims/link.d.ts +37 -4
- package/dist/shims/link.js +156 -46
- package/dist/shims/link.js.map +1 -1
- package/dist/shims/metadata.d.ts +16 -30
- package/dist/shims/metadata.js +87 -28
- package/dist/shims/metadata.js.map +1 -1
- package/dist/shims/navigation-state.js.map +1 -1
- package/dist/shims/navigation.d.ts +172 -10
- package/dist/shims/navigation.js +335 -70
- 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/offline.js.map +1 -1
- 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/readonly-url-search-params.js.map +1 -1
- package/dist/shims/request-context.js.map +1 -1
- package/dist/shims/root-params.js.map +1 -1
- package/dist/shims/router-state.js.map +1 -1
- package/dist/shims/router.d.ts +69 -7
- package/dist/shims/router.js +232 -249
- package/dist/shims/router.js.map +1 -1
- package/dist/shims/script-nonce-context.js.map +1 -1
- package/dist/shims/script.js +110 -32
- package/dist/shims/script.js.map +1 -1
- package/dist/shims/server.js +12 -15
- package/dist/shims/server.js.map +1 -1
- package/dist/shims/slot.d.ts +7 -1
- package/dist/shims/slot.js +60 -7
- package/dist/shims/slot.js.map +1 -1
- package/dist/shims/thenable-params.js.map +1 -1
- package/dist/shims/unified-request-context.js +5 -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.js.map +1 -1
- package/dist/shims/url-utils.d.ts +22 -1
- package/dist/shims/url-utils.js +76 -3
- package/dist/shims/url-utils.js.map +1 -1
- package/dist/shims/use-merged-ref.js.map +1 -1
- package/dist/shims/web-vitals.d.ts +4 -21
- package/dist/shims/web-vitals.js +19 -6
- package/dist/shims/web-vitals.js.map +1 -1
- package/dist/utils/asset-prefix.d.ts +69 -0
- package/dist/utils/asset-prefix.js +91 -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.js.map +1 -1
- package/dist/utils/domain-locale.js.map +1 -1
- package/dist/utils/encode-cache-tag.d.ts +31 -0
- package/dist/utils/encode-cache-tag.js +38 -0
- package/dist/utils/encode-cache-tag.js.map +1 -0
- package/dist/utils/error-cause.js.map +1 -1
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/lazy-chunks.js.map +1 -1
- package/dist/utils/manifest-paths.js.map +1 -1
- package/dist/utils/mdx-scan.js.map +1 -1
- package/dist/utils/navigation-signal.d.ts +5 -0
- package/dist/utils/navigation-signal.js +14 -0
- package/dist/utils/navigation-signal.js.map +1 -0
- package/dist/utils/project.js.map +1 -1
- package/dist/utils/public-routes.js.map +1 -1
- package/dist/utils/query.js.map +1 -1
- package/dist/utils/safe-json-file.js.map +1 -1
- 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/dist/utils/text-stream.js.map +1 -1
- package/dist/utils/vinext-root.js.map +1 -1
- package/package.json +8 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../../src/shims/constants.ts"],"sourcesContent":["/**\n * next/constants shim\n *\n * Provides build/runtime phase constants used by next.config.js\n * and some third-party libraries.\n */\n\nexport const MODERN_BROWSERSLIST_TARGET = [\"chrome 111\", \"edge 111\", \"firefox 111\", \"safari 16.4\"];\n\nexport type ValueOf<T> = Required<T>[keyof T];\n\nexport const COMPILER_NAMES = {\n client: \"client\",\n server: \"server\",\n edgeServer: \"edge-server\",\n} as const;\n\nexport type CompilerNameValues = ValueOf<typeof COMPILER_NAMES>;\n\nexport const COMPILER_INDEXES: {\n [compilerKey in CompilerNameValues]: number;\n} = {\n [COMPILER_NAMES.client]: 0,\n [COMPILER_NAMES.server]: 1,\n [COMPILER_NAMES.edgeServer]: 2,\n} as const;\n\n// Re-export entry constants for backward compatibility\nexport const UNDERSCORE_NOT_FOUND_ROUTE = \"/_not-found\";\nexport const UNDERSCORE_NOT_FOUND_ROUTE_ENTRY = `${UNDERSCORE_NOT_FOUND_ROUTE}/page`;\nexport const UNDERSCORE_GLOBAL_ERROR_ROUTE = \"/_global-error\";\nexport const UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY = `${UNDERSCORE_GLOBAL_ERROR_ROUTE}/page`;\n\nexport enum AdapterOutputType {\n /**\n * `PAGES` represents all the React pages that are under `pages/`.\n */\n PAGES = \"PAGES\",\n\n /**\n * `PAGES_API` represents all the API routes under `pages/api/`.\n */\n PAGES_API = \"PAGES_API\",\n /**\n * `APP_PAGE` represents all the React pages that are under `app/` with the\n * filename of `page.{j,t}s{,x}`.\n */\n APP_PAGE = \"APP_PAGE\",\n\n /**\n * `APP_ROUTE` represents all the API routes and metadata routes that are under `app/` with the\n * filename of `route.{j,t}s{,x}`.\n */\n APP_ROUTE = \"APP_ROUTE\",\n\n /**\n * `PRERENDER` represents an ISR enabled route that might\n * have a seeded cache entry or fallback generated during build\n */\n PRERENDER = \"PRERENDER\",\n\n /**\n * `STATIC_FILE` represents a static file (ie /_next/static)\n */\n STATIC_FILE = \"STATIC_FILE\",\n\n /**\n * `MIDDLEWARE` represents the middleware output if present\n */\n MIDDLEWARE = \"MIDDLEWARE\",\n}\n\nexport const PHASE_EXPORT = \"phase-export\";\nexport const PHASE_ANALYZE = \"phase-analyze\";\nexport const PHASE_PRODUCTION_BUILD = \"phase-production-build\";\nexport const PHASE_PRODUCTION_SERVER = \"phase-production-server\";\nexport const PHASE_DEVELOPMENT_SERVER = \"phase-development-server\";\nexport const PHASE_TEST = \"phase-test\";\nexport const PHASE_INFO = \"phase-info\";\n\nexport type PHASE_TYPE =\n | typeof PHASE_INFO\n | typeof PHASE_TEST\n | typeof PHASE_EXPORT\n | typeof PHASE_ANALYZE\n | typeof PHASE_PRODUCTION_BUILD\n | typeof PHASE_PRODUCTION_SERVER\n | typeof PHASE_DEVELOPMENT_SERVER;\n\nexport const PAGES_MANIFEST = \"pages-manifest.json\";\nexport const APP_PATHS_MANIFEST = \"app-paths-manifest.json\";\nexport const APP_PATH_ROUTES_MANIFEST = \"app-path-routes-manifest.json\";\nexport const BUILD_MANIFEST = \"build-manifest.json\";\nexport const FUNCTIONS_CONFIG_MANIFEST = \"functions-config-manifest.json\";\nexport const SUBRESOURCE_INTEGRITY_MANIFEST = \"subresource-integrity-manifest\";\nexport const NEXT_FONT_MANIFEST = \"next-font-manifest\";\nexport const EXPORT_MARKER = \"export-marker.json\";\nexport const EXPORT_DETAIL = \"export-detail.json\";\nexport const PREFETCH_HINTS = \"prefetch-hints.json\";\nexport const PRERENDER_MANIFEST = \"prerender-manifest.json\";\nexport const ROUTES_MANIFEST = \"routes-manifest.json\";\nexport const IMAGES_MANIFEST = \"images-manifest.json\";\nexport const SERVER_FILES_MANIFEST = \"required-server-files\";\nexport const DEV_CLIENT_PAGES_MANIFEST = \"_devPagesManifest.json\";\nexport const MIDDLEWARE_MANIFEST = \"middleware-manifest.json\";\nexport const TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST = \"_clientMiddlewareManifest.js\";\nexport const TURBOPACK_CLIENT_BUILD_MANIFEST = \"client-build-manifest.json\";\nexport const DEV_CLIENT_MIDDLEWARE_MANIFEST = \"_devMiddlewareManifest.json\";\nexport const REACT_LOADABLE_MANIFEST = \"react-loadable-manifest.json\";\nexport const SERVER_DIRECTORY = \"server\";\nexport const CONFIG_FILES = [\n \"next.config.js\",\n \"next.config.mjs\",\n \"next.config.ts\",\n // process.features can be undefined on Edge runtime\n ...(process?.features?.typescript ? [\"next.config.mts\"] : []),\n];\nexport const BUILD_ID_FILE = \"BUILD_ID\";\nexport const BLOCKED_PAGES = [\"/_document\", \"/_app\", \"/_error\"];\nexport const CLIENT_PUBLIC_FILES_PATH = \"public\";\nexport const CLIENT_STATIC_FILES_PATH = \"static\";\nexport const STRING_LITERAL_DROP_BUNDLE = \"__NEXT_DROP_CLIENT_FILE__\";\nexport const NEXT_BUILTIN_DOCUMENT = \"__NEXT_BUILTIN_DOCUMENT__\";\nexport const BARREL_OPTIMIZATION_PREFIX = \"__barrel_optimize__\";\n\n// server/[entry]/page_client-reference-manifest.js\nexport const CLIENT_REFERENCE_MANIFEST = \"client-reference-manifest\";\n// server/server-reference-manifest\nexport const SERVER_REFERENCE_MANIFEST = \"server-reference-manifest\";\n// server/middleware-build-manifest.js\nexport const MIDDLEWARE_BUILD_MANIFEST = \"middleware-build-manifest\";\n// server/middleware-react-loadable-manifest.js\nexport const MIDDLEWARE_REACT_LOADABLE_MANIFEST = \"middleware-react-loadable-manifest\";\n// server/interception-route-rewrite-manifest.js\nexport const INTERCEPTION_ROUTE_REWRITE_MANIFEST = \"interception-route-rewrite-manifest\";\n// server/dynamic-css-manifest.js\nexport const DYNAMIC_CSS_MANIFEST = \"dynamic-css-manifest\";\n\n// static/runtime/main.js\nexport const CLIENT_STATIC_FILES_RUNTIME_MAIN = `main`;\nexport const CLIENT_STATIC_FILES_RUNTIME_MAIN_APP = `${CLIENT_STATIC_FILES_RUNTIME_MAIN}-app`;\n// next internal client components chunk for layouts\nexport const APP_CLIENT_INTERNALS = \"app-pages-internals\";\n// static/runtime/react-refresh.js\nexport const CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH = `react-refresh`;\n// static/runtime/webpack.js\nexport const CLIENT_STATIC_FILES_RUNTIME_WEBPACK = `webpack`;\n// static/runtime/polyfills.js\nexport const CLIENT_STATIC_FILES_RUNTIME_POLYFILLS = \"polyfills\";\nexport const CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL = Symbol(\n CLIENT_STATIC_FILES_RUNTIME_POLYFILLS,\n);\nexport const DEFAULT_RUNTIME_WEBPACK = \"webpack-runtime\";\nexport const EDGE_RUNTIME_WEBPACK = \"edge-runtime-webpack\";\nexport const STATIC_PROPS_ID = \"__N_SSG\";\nexport const SERVER_PROPS_ID = \"__N_SSP\";\nexport const DEFAULT_SERIF_FONT = {\n name: \"Times New Roman\",\n xAvgCharWidth: 821,\n azAvgWidth: 854.3953488372093,\n unitsPerEm: 2048,\n};\nexport const DEFAULT_SANS_SERIF_FONT = {\n name: \"Arial\",\n xAvgCharWidth: 904,\n azAvgWidth: 934.5116279069767,\n unitsPerEm: 2048,\n};\nexport const STATIC_STATUS_PAGES = [\"/500\"];\nexport const TRACE_OUTPUT_VERSION = 1;\n// in `MB`\nexport const TURBO_TRACE_DEFAULT_MEMORY_LIMIT = 6000;\n\nexport const RSC_MODULE_TYPES = {\n client: \"client\",\n server: \"server\",\n} as const;\n\n// comparing\n// https://nextjs.org/docs/api-reference/edge-runtime\n// with\n// https://nodejs.org/docs/latest/api/globals.html\nexport const EDGE_UNSUPPORTED_NODE_APIS = [\n \"clearImmediate\",\n \"setImmediate\",\n \"BroadcastChannel\",\n \"ByteLengthQueuingStrategy\",\n \"CompressionStream\",\n \"CountQueuingStrategy\",\n \"DecompressionStream\",\n \"DomException\",\n \"MessageChannel\",\n \"MessageEvent\",\n \"MessagePort\",\n \"ReadableByteStreamController\",\n \"ReadableStreamBYOBRequest\",\n \"ReadableStreamDefaultController\",\n \"TransformStreamDefaultController\",\n \"WritableStreamDefaultController\",\n];\n\nexport const SYSTEM_ENTRYPOINTS = new Set<string>([\n CLIENT_STATIC_FILES_RUNTIME_MAIN,\n CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH,\n CLIENT_STATIC_FILES_RUNTIME_MAIN_APP,\n]);\n"],"mappings":";;;;;;;AAOA,MAAa,6BAA6B;CAAC;CAAc;CAAY;CAAe;CAAc;AAIlG,MAAa,iBAAiB;CAC5B,QAAQ;CACR,QAAQ;CACR,YAAY;CACb;AAID,MAAa,mBAET;EACD,eAAe,SAAS;EACxB,eAAe,SAAS;EACxB,eAAe,aAAa;CAC9B;AAGD,MAAa,6BAA6B;AAC1C,MAAa,mCAAmC,GAAG,2BAA2B;AAC9E,MAAa,gCAAgC;AAC7C,MAAa,sCAAsC,GAAG,8BAA8B;AAEpF,IAAY,oBAAL,yBAAA,mBAAA;;;;
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../../src/shims/constants.ts"],"sourcesContent":["/**\n * next/constants shim\n *\n * Provides build/runtime phase constants used by next.config.js\n * and some third-party libraries.\n */\n\nexport const MODERN_BROWSERSLIST_TARGET = [\"chrome 111\", \"edge 111\", \"firefox 111\", \"safari 16.4\"];\n\nexport type ValueOf<T> = Required<T>[keyof T];\n\nexport const COMPILER_NAMES = {\n client: \"client\",\n server: \"server\",\n edgeServer: \"edge-server\",\n} as const;\n\nexport type CompilerNameValues = ValueOf<typeof COMPILER_NAMES>;\n\nexport const COMPILER_INDEXES: {\n [compilerKey in CompilerNameValues]: number;\n} = {\n [COMPILER_NAMES.client]: 0,\n [COMPILER_NAMES.server]: 1,\n [COMPILER_NAMES.edgeServer]: 2,\n} as const;\n\n// Re-export entry constants for backward compatibility\nexport const UNDERSCORE_NOT_FOUND_ROUTE = \"/_not-found\";\nexport const UNDERSCORE_NOT_FOUND_ROUTE_ENTRY = `${UNDERSCORE_NOT_FOUND_ROUTE}/page`;\nexport const UNDERSCORE_GLOBAL_ERROR_ROUTE = \"/_global-error\";\nexport const UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY = `${UNDERSCORE_GLOBAL_ERROR_ROUTE}/page`;\n\nexport enum AdapterOutputType {\n /**\n * `PAGES` represents all the React pages that are under `pages/`.\n */\n PAGES = \"PAGES\",\n\n /**\n * `PAGES_API` represents all the API routes under `pages/api/`.\n */\n PAGES_API = \"PAGES_API\",\n /**\n * `APP_PAGE` represents all the React pages that are under `app/` with the\n * filename of `page.{j,t}s{,x}`.\n */\n APP_PAGE = \"APP_PAGE\",\n\n /**\n * `APP_ROUTE` represents all the API routes and metadata routes that are under `app/` with the\n * filename of `route.{j,t}s{,x}`.\n */\n APP_ROUTE = \"APP_ROUTE\",\n\n /**\n * `PRERENDER` represents an ISR enabled route that might\n * have a seeded cache entry or fallback generated during build\n */\n PRERENDER = \"PRERENDER\",\n\n /**\n * `STATIC_FILE` represents a static file (ie /_next/static)\n */\n STATIC_FILE = \"STATIC_FILE\",\n\n /**\n * `MIDDLEWARE` represents the middleware output if present\n */\n MIDDLEWARE = \"MIDDLEWARE\",\n}\n\nexport const PHASE_EXPORT = \"phase-export\";\nexport const PHASE_ANALYZE = \"phase-analyze\";\nexport const PHASE_PRODUCTION_BUILD = \"phase-production-build\";\nexport const PHASE_PRODUCTION_SERVER = \"phase-production-server\";\nexport const PHASE_DEVELOPMENT_SERVER = \"phase-development-server\";\nexport const PHASE_TEST = \"phase-test\";\nexport const PHASE_INFO = \"phase-info\";\n\nexport type PHASE_TYPE =\n | typeof PHASE_INFO\n | typeof PHASE_TEST\n | typeof PHASE_EXPORT\n | typeof PHASE_ANALYZE\n | typeof PHASE_PRODUCTION_BUILD\n | typeof PHASE_PRODUCTION_SERVER\n | typeof PHASE_DEVELOPMENT_SERVER;\n\nexport const PAGES_MANIFEST = \"pages-manifest.json\";\nexport const APP_PATHS_MANIFEST = \"app-paths-manifest.json\";\nexport const APP_PATH_ROUTES_MANIFEST = \"app-path-routes-manifest.json\";\nexport const BUILD_MANIFEST = \"build-manifest.json\";\nexport const FUNCTIONS_CONFIG_MANIFEST = \"functions-config-manifest.json\";\nexport const SUBRESOURCE_INTEGRITY_MANIFEST = \"subresource-integrity-manifest\";\nexport const NEXT_FONT_MANIFEST = \"next-font-manifest\";\nexport const EXPORT_MARKER = \"export-marker.json\";\nexport const EXPORT_DETAIL = \"export-detail.json\";\nexport const PREFETCH_HINTS = \"prefetch-hints.json\";\nexport const PRERENDER_MANIFEST = \"prerender-manifest.json\";\nexport const ROUTES_MANIFEST = \"routes-manifest.json\";\nexport const IMAGES_MANIFEST = \"images-manifest.json\";\nexport const SERVER_FILES_MANIFEST = \"required-server-files\";\nexport const DEV_CLIENT_PAGES_MANIFEST = \"_devPagesManifest.json\";\nexport const MIDDLEWARE_MANIFEST = \"middleware-manifest.json\";\nexport const TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST = \"_clientMiddlewareManifest.js\";\nexport const TURBOPACK_CLIENT_BUILD_MANIFEST = \"client-build-manifest.json\";\nexport const DEV_CLIENT_MIDDLEWARE_MANIFEST = \"_devMiddlewareManifest.json\";\nexport const REACT_LOADABLE_MANIFEST = \"react-loadable-manifest.json\";\nexport const SERVER_DIRECTORY = \"server\";\nexport const CONFIG_FILES = [\n \"next.config.js\",\n \"next.config.mjs\",\n \"next.config.ts\",\n // process.features can be undefined on Edge runtime\n ...(process?.features?.typescript ? [\"next.config.mts\"] : []),\n];\nexport const BUILD_ID_FILE = \"BUILD_ID\";\nexport const BLOCKED_PAGES = [\"/_document\", \"/_app\", \"/_error\"];\nexport const CLIENT_PUBLIC_FILES_PATH = \"public\";\nexport const CLIENT_STATIC_FILES_PATH = \"static\";\nexport const STRING_LITERAL_DROP_BUNDLE = \"__NEXT_DROP_CLIENT_FILE__\";\nexport const NEXT_BUILTIN_DOCUMENT = \"__NEXT_BUILTIN_DOCUMENT__\";\nexport const BARREL_OPTIMIZATION_PREFIX = \"__barrel_optimize__\";\n\n// server/[entry]/page_client-reference-manifest.js\nexport const CLIENT_REFERENCE_MANIFEST = \"client-reference-manifest\";\n// server/server-reference-manifest\nexport const SERVER_REFERENCE_MANIFEST = \"server-reference-manifest\";\n// server/middleware-build-manifest.js\nexport const MIDDLEWARE_BUILD_MANIFEST = \"middleware-build-manifest\";\n// server/middleware-react-loadable-manifest.js\nexport const MIDDLEWARE_REACT_LOADABLE_MANIFEST = \"middleware-react-loadable-manifest\";\n// server/interception-route-rewrite-manifest.js\nexport const INTERCEPTION_ROUTE_REWRITE_MANIFEST = \"interception-route-rewrite-manifest\";\n// server/dynamic-css-manifest.js\nexport const DYNAMIC_CSS_MANIFEST = \"dynamic-css-manifest\";\n\n// static/runtime/main.js\nexport const CLIENT_STATIC_FILES_RUNTIME_MAIN = `main`;\nexport const CLIENT_STATIC_FILES_RUNTIME_MAIN_APP = `${CLIENT_STATIC_FILES_RUNTIME_MAIN}-app`;\n// next internal client components chunk for layouts\nexport const APP_CLIENT_INTERNALS = \"app-pages-internals\";\n// static/runtime/react-refresh.js\nexport const CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH = `react-refresh`;\n// static/runtime/webpack.js\nexport const CLIENT_STATIC_FILES_RUNTIME_WEBPACK = `webpack`;\n// static/runtime/polyfills.js\nexport const CLIENT_STATIC_FILES_RUNTIME_POLYFILLS = \"polyfills\";\nexport const CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL = Symbol(\n CLIENT_STATIC_FILES_RUNTIME_POLYFILLS,\n);\nexport const DEFAULT_RUNTIME_WEBPACK = \"webpack-runtime\";\nexport const EDGE_RUNTIME_WEBPACK = \"edge-runtime-webpack\";\nexport const STATIC_PROPS_ID = \"__N_SSG\";\nexport const SERVER_PROPS_ID = \"__N_SSP\";\nexport const DEFAULT_SERIF_FONT = {\n name: \"Times New Roman\",\n xAvgCharWidth: 821,\n azAvgWidth: 854.3953488372093,\n unitsPerEm: 2048,\n};\nexport const DEFAULT_SANS_SERIF_FONT = {\n name: \"Arial\",\n xAvgCharWidth: 904,\n azAvgWidth: 934.5116279069767,\n unitsPerEm: 2048,\n};\nexport const STATIC_STATUS_PAGES = [\"/500\"];\nexport const TRACE_OUTPUT_VERSION = 1;\n// in `MB`\nexport const TURBO_TRACE_DEFAULT_MEMORY_LIMIT = 6000;\n\nexport const RSC_MODULE_TYPES = {\n client: \"client\",\n server: \"server\",\n} as const;\n\n// comparing\n// https://nextjs.org/docs/api-reference/edge-runtime\n// with\n// https://nodejs.org/docs/latest/api/globals.html\nexport const EDGE_UNSUPPORTED_NODE_APIS = [\n \"clearImmediate\",\n \"setImmediate\",\n \"BroadcastChannel\",\n \"ByteLengthQueuingStrategy\",\n \"CompressionStream\",\n \"CountQueuingStrategy\",\n \"DecompressionStream\",\n \"DomException\",\n \"MessageChannel\",\n \"MessageEvent\",\n \"MessagePort\",\n \"ReadableByteStreamController\",\n \"ReadableStreamBYOBRequest\",\n \"ReadableStreamDefaultController\",\n \"TransformStreamDefaultController\",\n \"WritableStreamDefaultController\",\n];\n\nexport const SYSTEM_ENTRYPOINTS = new Set<string>([\n CLIENT_STATIC_FILES_RUNTIME_MAIN,\n CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH,\n CLIENT_STATIC_FILES_RUNTIME_MAIN_APP,\n]);\n"],"mappings":";;;;;;;AAOA,MAAa,6BAA6B;CAAC;CAAc;CAAY;CAAe;CAAc;AAIlG,MAAa,iBAAiB;CAC5B,QAAQ;CACR,QAAQ;CACR,YAAY;CACb;AAID,MAAa,mBAET;EACD,eAAe,SAAS;EACxB,eAAe,SAAS;EACxB,eAAe,aAAa;CAC9B;AAGD,MAAa,6BAA6B;AAC1C,MAAa,mCAAmC,GAAG,2BAA2B;AAC9E,MAAa,gCAAgC;AAC7C,MAAa,sCAAsC,GAAG,8BAA8B;AAEpF,IAAY,oBAAL,yBAAA,mBAAA;;;;CAIL,kBAAA,WAAA;;;;CAKA,kBAAA,eAAA;;;;;CAKA,kBAAA,cAAA;;;;;CAMA,kBAAA,eAAA;;;;;CAMA,kBAAA,eAAA;;;;CAKA,kBAAA,iBAAA;;;;CAKA,kBAAA,gBAAA;;KACD;AAED,MAAa,eAAe;AAC5B,MAAa,gBAAgB;AAC7B,MAAa,yBAAyB;AACtC,MAAa,0BAA0B;AACvC,MAAa,2BAA2B;AACxC,MAAa,aAAa;AAC1B,MAAa,aAAa;AAW1B,MAAa,iBAAiB;AAC9B,MAAa,qBAAqB;AAClC,MAAa,2BAA2B;AACxC,MAAa,iBAAiB;AAC9B,MAAa,4BAA4B;AACzC,MAAa,iCAAiC;AAC9C,MAAa,qBAAqB;AAClC,MAAa,gBAAgB;AAC7B,MAAa,gBAAgB;AAC7B,MAAa,iBAAiB;AAC9B,MAAa,qBAAqB;AAClC,MAAa,kBAAkB;AAC/B,MAAa,kBAAkB;AAC/B,MAAa,wBAAwB;AACrC,MAAa,4BAA4B;AACzC,MAAa,sBAAsB;AACnC,MAAa,uCAAuC;AACpD,MAAa,kCAAkC;AAC/C,MAAa,iCAAiC;AAC9C,MAAa,0BAA0B;AACvC,MAAa,mBAAmB;AAChC,MAAa,eAAe;CAC1B;CACA;CACA;CAEA,GAAI,SAAS,UAAU,aAAa,CAAC,kBAAkB,GAAG,EAAE;CAC7D;AACD,MAAa,gBAAgB;AAC7B,MAAa,gBAAgB;CAAC;CAAc;CAAS;CAAU;AAC/D,MAAa,2BAA2B;AACxC,MAAa,2BAA2B;AACxC,MAAa,6BAA6B;AAC1C,MAAa,wBAAwB;AACrC,MAAa,6BAA6B;AAG1C,MAAa,4BAA4B;AAEzC,MAAa,4BAA4B;AAEzC,MAAa,4BAA4B;AAEzC,MAAa,qCAAqC;AAElD,MAAa,sCAAsC;AAEnD,MAAa,uBAAuB;AAGpC,MAAa,mCAAmC;AAChD,MAAa,uCAAuC,GAAG,iCAAiC;AAExF,MAAa,uBAAuB;AAEpC,MAAa,4CAA4C;AAEzD,MAAa,sCAAsC;AAEnD,MAAa,wCAAwC;AACrD,MAAa,+CAA+C,OAC1D,sCACD;AACD,MAAa,0BAA0B;AACvC,MAAa,uBAAuB;AACpC,MAAa,kBAAkB;AAC/B,MAAa,kBAAkB;AAC/B,MAAa,qBAAqB;CAChC,MAAM;CACN,eAAe;CACf,YAAY;CACZ,YAAY;CACb;AACD,MAAa,0BAA0B;CACrC,MAAM;CACN,eAAe;CACf,YAAY;CACZ,YAAY;CACb;AACD,MAAa,sBAAsB,CAAC,OAAO;AAC3C,MAAa,uBAAuB;AAEpC,MAAa,mCAAmC;AAEhD,MAAa,mBAAmB;CAC9B,QAAQ;CACR,QAAQ;CACT;AAMD,MAAa,6BAA6B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,qBAAqB,IAAI,IAAY;CAChD;CACA;CACA;CACD,CAAC"}
|
|
@@ -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 - used when no custom _document.tsx exists.\n */\nexport default function Document() {\n return (\n <Html>\n <Head />\n <body>\n <Main />\n <NextScript />\n </body>\n </Html>\n );\n}\n"],"mappings":";;;AASA,SAAgB,KAAK,EACnB,UACA,MACA,GAAG,SACsE;
|
|
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 - used when no custom _document.tsx exists.\n */\nexport default function Document() {\n return (\n <Html>\n <Head />\n <body>\n <Main />\n <NextScript />\n </body>\n </Html>\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;;;;;AAMnF,SAAwB,WAAW;CACjC,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"}
|
package/dist/shims/dynamic.d.ts
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
import { ComponentType } from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/shims/dynamic.d.ts
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
ssr?: boolean;
|
|
4
|
+
type DynamicLoadingProps = {
|
|
5
|
+
error?: Error | null;
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
pastDelay?: boolean;
|
|
8
|
+
retry?: () => void;
|
|
9
|
+
timedOut?: boolean;
|
|
11
10
|
};
|
|
12
|
-
type
|
|
11
|
+
type ComponentModule<P> = {
|
|
13
12
|
default: ComponentType<P>;
|
|
14
|
-
}
|
|
13
|
+
};
|
|
14
|
+
type LoaderComponent<P> = Promise<ComponentModule<P> | ComponentType<P>>;
|
|
15
|
+
type LoaderFn<P> = () => LoaderComponent<P>;
|
|
16
|
+
type DynamicOptions<P> = {
|
|
17
|
+
loading?: ComponentType<DynamicLoadingProps>;
|
|
18
|
+
loader?: Loader<P>;
|
|
19
|
+
ssr?: boolean;
|
|
20
|
+
};
|
|
21
|
+
type Loader<P> = LoaderFn<P> | LoaderComponent<P>;
|
|
22
|
+
type DynamicInput<P> = DynamicOptions<P> | Loader<P>;
|
|
15
23
|
/**
|
|
16
24
|
* Wait for all pending dynamic() preloads to resolve, then clear the queue.
|
|
17
25
|
* Called by the Pages Router SSR handler before rendering.
|
|
18
26
|
* No-op for the App Router path which uses React.lazy + Suspense.
|
|
19
27
|
*/
|
|
20
28
|
declare function flushPreloads(): Promise<void[]>;
|
|
21
|
-
declare function dynamic<P extends object = object>(
|
|
29
|
+
declare function dynamic<P extends object = object>(dynamicInput: DynamicInput<P>, options?: DynamicOptions<P>): ComponentType<P>;
|
|
22
30
|
//#endregion
|
|
23
31
|
export { dynamic as default, flushPreloads };
|
|
24
32
|
//# sourceMappingURL=dynamic.d.ts.map
|
package/dist/shims/dynamic.js
CHANGED
|
@@ -15,10 +15,58 @@ import React from "react";
|
|
|
15
15
|
* - Client: React.lazy + Suspense (standard code splitting)
|
|
16
16
|
*
|
|
17
17
|
* Supports:
|
|
18
|
+
* - dynamic(import('./Component'))
|
|
18
19
|
* - dynamic(() => import('./Component'))
|
|
20
|
+
* - dynamic({ loader })
|
|
19
21
|
* - dynamic(() => import('./Component'), { loading: () => <Spinner /> })
|
|
20
22
|
* - dynamic(() => import('./Component'), { ssr: false })
|
|
21
23
|
*/
|
|
24
|
+
const noopRetry = () => {};
|
|
25
|
+
function createDynamicLoadingProps(overrides = {}) {
|
|
26
|
+
return {
|
|
27
|
+
error: null,
|
|
28
|
+
isLoading: true,
|
|
29
|
+
pastDelay: true,
|
|
30
|
+
retry: noopRetry,
|
|
31
|
+
timedOut: false,
|
|
32
|
+
...overrides
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function hasDefaultExport(mod) {
|
|
36
|
+
return (typeof mod === "object" || typeof mod === "function") && mod !== null && "default" in mod;
|
|
37
|
+
}
|
|
38
|
+
function normalizeLoader(loader) {
|
|
39
|
+
if (typeof loader === "function") return loader;
|
|
40
|
+
return () => loader;
|
|
41
|
+
}
|
|
42
|
+
function normalizeDynamicOptions(dynamicInput, options) {
|
|
43
|
+
let normalizedOptions;
|
|
44
|
+
if (dynamicInput instanceof Promise || typeof dynamicInput === "function") normalizedOptions = { loader: normalizeLoader(dynamicInput) };
|
|
45
|
+
else normalizedOptions = dynamicInput;
|
|
46
|
+
return {
|
|
47
|
+
...normalizedOptions,
|
|
48
|
+
...options
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function createLazyComponent(loader) {
|
|
52
|
+
return React.lazy(async () => {
|
|
53
|
+
const mod = await loader();
|
|
54
|
+
if (hasDefaultExport(mod)) return mod;
|
|
55
|
+
return { default: mod };
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function useRetryableLazyComponent(loader, initialLazyComponent) {
|
|
59
|
+
const [LazyComponent, setLazyComponent] = React.useState(() => initialLazyComponent);
|
|
60
|
+
const [retryKey, setRetryKey] = React.useState(0);
|
|
61
|
+
return {
|
|
62
|
+
LazyComponent,
|
|
63
|
+
retry: React.useCallback(() => {
|
|
64
|
+
setLazyComponent(() => createLazyComponent(loader));
|
|
65
|
+
setRetryKey((key) => key + 1);
|
|
66
|
+
}, [loader]),
|
|
67
|
+
retryKey
|
|
68
|
+
};
|
|
69
|
+
}
|
|
22
70
|
/**
|
|
23
71
|
* Lightweight error boundary that renders the loading component with the error
|
|
24
72
|
* when a dynamic() loader rejects. Without this, loader failures would propagate
|
|
@@ -35,17 +83,27 @@ function getDynamicErrorBoundary() {
|
|
|
35
83
|
DynamicErrorBoundary = class extends React.Component {
|
|
36
84
|
constructor(props) {
|
|
37
85
|
super(props);
|
|
38
|
-
this.state = {
|
|
86
|
+
this.state = {
|
|
87
|
+
error: null,
|
|
88
|
+
resetKey: props.resetKey
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
static getDerivedStateFromProps(props, state) {
|
|
92
|
+
if (props.resetKey !== state.resetKey) return {
|
|
93
|
+
error: null,
|
|
94
|
+
resetKey: props.resetKey
|
|
95
|
+
};
|
|
96
|
+
return null;
|
|
39
97
|
}
|
|
40
98
|
static getDerivedStateFromError(error) {
|
|
41
99
|
return { error: error instanceof Error ? error : new Error(String(error)) };
|
|
42
100
|
}
|
|
43
101
|
render() {
|
|
44
|
-
if (this.state.error) return React.createElement(this.props.fallback, {
|
|
102
|
+
if (this.state.error) return React.createElement(this.props.fallback, createDynamicLoadingProps({
|
|
45
103
|
isLoading: false,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
104
|
+
error: this.state.error,
|
|
105
|
+
retry: this.props.retry
|
|
106
|
+
}));
|
|
49
107
|
return this.props.children;
|
|
50
108
|
}
|
|
51
109
|
};
|
|
@@ -62,37 +120,33 @@ function flushPreloads() {
|
|
|
62
120
|
const pending = preloadQueue.splice(0);
|
|
63
121
|
return Promise.all(pending);
|
|
64
122
|
}
|
|
65
|
-
function dynamic(
|
|
66
|
-
const { loading: LoadingComponent, ssr = true } = options
|
|
123
|
+
function dynamic(dynamicInput, options) {
|
|
124
|
+
const { loader: dynamicLoader, loading: LoadingComponent, ssr = true } = normalizeDynamicOptions(dynamicInput, options);
|
|
125
|
+
const loader = dynamicLoader ? normalizeLoader(dynamicLoader) : () => Promise.resolve(() => null);
|
|
67
126
|
if (!ssr) {
|
|
68
127
|
if (isServer) {
|
|
69
|
-
const SSRFalse = (_props) => LoadingComponent ? React.createElement(LoadingComponent, {
|
|
70
|
-
isLoading: true,
|
|
71
|
-
pastDelay: true,
|
|
72
|
-
error: null
|
|
73
|
-
}) : null;
|
|
128
|
+
const SSRFalse = (_props) => LoadingComponent ? React.createElement(LoadingComponent, createDynamicLoadingProps({ pastDelay: false })) : null;
|
|
74
129
|
SSRFalse.displayName = "DynamicSSRFalse";
|
|
75
130
|
return SSRFalse;
|
|
76
131
|
}
|
|
77
|
-
const
|
|
78
|
-
const mod = await loader();
|
|
79
|
-
if ("default" in mod) return mod;
|
|
80
|
-
return { default: mod };
|
|
81
|
-
});
|
|
132
|
+
const InitialLazyComponent = createLazyComponent(loader);
|
|
82
133
|
const ClientSSRFalse = (props) => {
|
|
83
134
|
const [mounted, setMounted] = React.useState(false);
|
|
135
|
+
const { LazyComponent, retry, retryKey } = useRetryableLazyComponent(loader, InitialLazyComponent);
|
|
84
136
|
React.useEffect(() => setMounted(true), []);
|
|
85
|
-
if (!mounted) return LoadingComponent ? React.createElement(LoadingComponent, {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
137
|
+
if (!mounted) return LoadingComponent ? React.createElement(LoadingComponent, createDynamicLoadingProps({ retry })) : null;
|
|
138
|
+
const fallback = LoadingComponent ? React.createElement(LoadingComponent, createDynamicLoadingProps({ retry })) : null;
|
|
139
|
+
const lazyElement = React.createElement(LazyComponent, props);
|
|
140
|
+
let content = lazyElement;
|
|
141
|
+
if (LoadingComponent) {
|
|
142
|
+
const ErrorBoundary = getDynamicErrorBoundary();
|
|
143
|
+
if (ErrorBoundary) content = React.createElement(ErrorBoundary, {
|
|
144
|
+
fallback: LoadingComponent,
|
|
145
|
+
retry,
|
|
146
|
+
resetKey: retryKey
|
|
147
|
+
}, lazyElement);
|
|
148
|
+
}
|
|
149
|
+
return React.createElement(React.Suspense, { fallback }, content);
|
|
96
150
|
};
|
|
97
151
|
ClientSSRFalse.displayName = "DynamicClientSSRFalse";
|
|
98
152
|
return ClientSSRFalse;
|
|
@@ -107,37 +161,39 @@ function dynamic(loader, options) {
|
|
|
107
161
|
AsyncServerDynamic.displayName = "DynamicAsyncServer";
|
|
108
162
|
return AsyncServerDynamic;
|
|
109
163
|
}
|
|
110
|
-
const LazyServer =
|
|
111
|
-
const mod = await loader();
|
|
112
|
-
if ("default" in mod) return mod;
|
|
113
|
-
return { default: mod };
|
|
114
|
-
});
|
|
164
|
+
const LazyServer = createLazyComponent(loader);
|
|
115
165
|
const ServerDynamic = (props) => {
|
|
116
|
-
const fallback = LoadingComponent ? React.createElement(LoadingComponent,
|
|
117
|
-
isLoading: true,
|
|
118
|
-
pastDelay: true,
|
|
119
|
-
error: null
|
|
120
|
-
}) : null;
|
|
166
|
+
const fallback = LoadingComponent ? React.createElement(LoadingComponent, createDynamicLoadingProps()) : null;
|
|
121
167
|
const lazyElement = React.createElement(LazyServer, props);
|
|
122
|
-
|
|
123
|
-
|
|
168
|
+
let content = lazyElement;
|
|
169
|
+
if (LoadingComponent) {
|
|
170
|
+
const ErrorBoundary = getDynamicErrorBoundary();
|
|
171
|
+
if (ErrorBoundary) content = React.createElement(ErrorBoundary, {
|
|
172
|
+
fallback: LoadingComponent,
|
|
173
|
+
retry: noopRetry,
|
|
174
|
+
resetKey: 0
|
|
175
|
+
}, lazyElement);
|
|
176
|
+
}
|
|
124
177
|
return React.createElement(React.Suspense, { fallback }, content);
|
|
125
178
|
};
|
|
126
179
|
ServerDynamic.displayName = "DynamicServer";
|
|
127
180
|
return ServerDynamic;
|
|
128
181
|
}
|
|
129
|
-
const
|
|
130
|
-
const mod = await loader();
|
|
131
|
-
if ("default" in mod) return mod;
|
|
132
|
-
return { default: mod };
|
|
133
|
-
});
|
|
182
|
+
const InitialLazyComponent = createLazyComponent(loader);
|
|
134
183
|
const ClientDynamic = (props) => {
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
184
|
+
const { LazyComponent, retry, retryKey } = useRetryableLazyComponent(loader, InitialLazyComponent);
|
|
185
|
+
const fallback = LoadingComponent ? React.createElement(LoadingComponent, createDynamicLoadingProps({ retry })) : null;
|
|
186
|
+
const lazyElement = React.createElement(LazyComponent, props);
|
|
187
|
+
let content = lazyElement;
|
|
188
|
+
if (LoadingComponent) {
|
|
189
|
+
const ErrorBoundary = getDynamicErrorBoundary();
|
|
190
|
+
if (ErrorBoundary) content = React.createElement(ErrorBoundary, {
|
|
191
|
+
fallback: LoadingComponent,
|
|
192
|
+
retry,
|
|
193
|
+
resetKey: retryKey
|
|
194
|
+
}, lazyElement);
|
|
195
|
+
}
|
|
196
|
+
return React.createElement(React.Suspense, { fallback }, content);
|
|
141
197
|
};
|
|
142
198
|
ClientDynamic.displayName = "DynamicClient";
|
|
143
199
|
return ClientDynamic;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic.js","names":[],"sources":["../../src/shims/dynamic.ts"],"sourcesContent":["/**\n * next/dynamic shim\n *\n * SSR-safe dynamic imports. On the server, uses React.lazy + Suspense so that\n * renderToReadableStream suspends until the dynamically-imported component is\n * available. On the client, also uses React.lazy for code splitting.\n *\n * Works in RSC, SSR, and client environments:\n * - RSC: Uses React.lazy + Suspense (available in React 19.x react-server).\n * Falls back to async component pattern if a future React version\n * strips lazy from react-server.\n * - SSR: React.lazy + Suspense (renderToReadableStream suspends)\n * - Client: React.lazy + Suspense (standard code splitting)\n *\n * Supports:\n * - dynamic(() => import('./Component'))\n * - dynamic(() => import('./Component'), { loading: () => <Spinner /> })\n * - dynamic(() => import('./Component'), { ssr: false })\n */\nimport React, { type ComponentType } from \"react\";\n\ntype DynamicOptions = {\n loading?: ComponentType<{ error?: Error | null; isLoading?: boolean; pastDelay?: boolean }>;\n ssr?: boolean;\n};\n\ntype Loader<P> = () => Promise<{ default: ComponentType<P> } | ComponentType<P>>;\n\n/**\n * Lightweight error boundary that renders the loading component with the error\n * when a dynamic() loader rejects. Without this, loader failures would propagate\n * uncaught through React's rendering — this preserves the Next.js behavior where\n * the `loading` component can display errors.\n *\n * Lazily created because React.Component is not available in the RSC environment\n * (server components use a slimmed-down React that doesn't include class components).\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nlet DynamicErrorBoundary: any;\nfunction getDynamicErrorBoundary() {\n if (DynamicErrorBoundary) return DynamicErrorBoundary;\n if (!React.Component) return null;\n DynamicErrorBoundary = class extends (\n React.Component<\n {\n fallback: ComponentType<{ error?: Error | null; isLoading?: boolean; pastDelay?: boolean }>;\n children: React.ReactNode;\n },\n { error: Error | null }\n >\n ) {\n // oxlint-disable-next-line typescript/no-explicit-any\n constructor(props: any) {\n super(props);\n this.state = { error: null };\n }\n static getDerivedStateFromError(error: unknown) {\n return { error: error instanceof Error ? error : new Error(String(error)) };\n }\n render() {\n if (this.state.error) {\n return React.createElement(this.props.fallback, {\n isLoading: false,\n pastDelay: true,\n error: this.state.error,\n });\n }\n return this.props.children;\n }\n };\n return DynamicErrorBoundary;\n}\n\n// Detect server vs client\nconst isServer = typeof window === \"undefined\";\n\n// Legacy preload queue — kept for backward compatibility with Pages Router\n// which calls flushPreloads() before rendering. The App Router uses React.lazy\n// + Suspense instead, so this queue is no longer populated.\nconst preloadQueue: Promise<void>[] = [];\n\n/**\n * Wait for all pending dynamic() preloads to resolve, then clear the queue.\n * Called by the Pages Router SSR handler before rendering.\n * No-op for the App Router path which uses React.lazy + Suspense.\n */\nexport function flushPreloads(): Promise<void[]> {\n const pending = preloadQueue.splice(0);\n return Promise.all(pending);\n}\n\nfunction dynamic<P extends object = object>(\n loader: Loader<P>,\n options?: DynamicOptions,\n): ComponentType<P> {\n const { loading: LoadingComponent, ssr = true } = options ?? {};\n\n // ssr: false — render nothing on the server, lazy-load on client\n if (!ssr) {\n if (isServer) {\n // On the server (SSR or RSC), just render the loading state or nothing\n const SSRFalse = (_props: P) =>\n LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n SSRFalse.displayName = \"DynamicSSRFalse\";\n return SSRFalse;\n }\n\n // Client: use lazy with Suspense\n const LazyComponent = React.lazy(async () => {\n const mod = await loader();\n if (\"default\" in mod) return mod as { default: ComponentType<P> };\n return { default: mod as ComponentType<P> };\n });\n\n const ClientSSRFalse = (props: P) => {\n const [mounted, setMounted] = React.useState(false);\n React.useEffect(() => setMounted(true), []);\n\n if (!mounted) {\n return LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n }\n\n const fallback = LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n return React.createElement(\n React.Suspense,\n { fallback },\n React.createElement(LazyComponent, props),\n );\n };\n\n ClientSSRFalse.displayName = \"DynamicClientSSRFalse\";\n return ClientSSRFalse;\n }\n\n // SSR-enabled path\n if (isServer) {\n // Defensive fallback: if a future React version strips React.lazy from the\n // react-server condition, fall back to an async component pattern.\n // In React 19.x, React.lazy IS available in react-server, so this branch\n // does not execute — it exists for forward compatibility only.\n if (typeof React.lazy !== \"function\") {\n const AsyncServerDynamic = async (props: P) => {\n // Note: LoadingComponent is not used here — in the RSC environment,\n // async components suspend natively and parent <Suspense> boundaries\n // provide loading states. Error handling also defers to the nearest\n // error boundary in the component tree.\n const mod = await loader();\n const Component =\n \"default\" in mod\n ? (mod as { default: ComponentType<P> }).default\n : (mod as ComponentType<P>);\n return React.createElement(Component, props);\n };\n AsyncServerDynamic.displayName = \"DynamicAsyncServer\";\n // Cast is safe: async components are natively supported by the RSC renderer,\n // but TypeScript's ComponentType<P> doesn't account for async return types.\n return AsyncServerDynamic as unknown as ComponentType<P>;\n }\n\n // SSR path: Use React.lazy so that renderToReadableStream can suspend\n // until the dynamically-imported component is available.\n const LazyServer = React.lazy(async () => {\n const mod = await loader();\n if (\"default\" in mod) return mod as { default: ComponentType<P> };\n return { default: mod as ComponentType<P> };\n });\n\n const ServerDynamic = (props: P) => {\n const fallback = LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n const lazyElement = React.createElement(LazyServer, props);\n // Wrap with error boundary so loader rejections render the loading\n // component with the error instead of propagating uncaught.\n const ErrorBoundary = LoadingComponent ? getDynamicErrorBoundary() : null;\n const content = ErrorBoundary\n ? React.createElement(ErrorBoundary, { fallback: LoadingComponent }, lazyElement)\n : lazyElement;\n return React.createElement(React.Suspense, { fallback }, content);\n };\n\n ServerDynamic.displayName = \"DynamicServer\";\n return ServerDynamic;\n }\n\n // Client path: standard React.lazy with Suspense\n const LazyComponent = React.lazy(async () => {\n const mod = await loader();\n if (\"default\" in mod) return mod as { default: ComponentType<P> };\n return { default: mod as ComponentType<P> };\n });\n\n const ClientDynamic = (props: P) => {\n const fallback = LoadingComponent\n ? React.createElement(LoadingComponent, { isLoading: true, pastDelay: true, error: null })\n : null;\n return React.createElement(\n React.Suspense,\n { fallback },\n React.createElement(LazyComponent, props),\n );\n };\n\n ClientDynamic.displayName = \"DynamicClient\";\n return ClientDynamic;\n}\n\nexport default dynamic;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,IAAI;AACJ,SAAS,0BAA0B;AACjC,KAAI,qBAAsB,QAAO;AACjC,KAAI,CAAC,MAAM,UAAW,QAAO;AAC7B,wBAAuB,cACrB,MAAM,UAON;EAEA,YAAY,OAAY;AACtB,SAAM,MAAM;AACZ,QAAK,QAAQ,EAAE,OAAO,MAAM;;EAE9B,OAAO,yBAAyB,OAAgB;AAC9C,UAAO,EAAE,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC,EAAE;;EAE7E,SAAS;AACP,OAAI,KAAK,MAAM,MACb,QAAO,MAAM,cAAc,KAAK,MAAM,UAAU;IAC9C,WAAW;IACX,WAAW;IACX,OAAO,KAAK,MAAM;IACnB,CAAC;AAEJ,UAAO,KAAK,MAAM;;;AAGtB,QAAO;;AAIT,MAAM,WAAW,OAAO,WAAW;AAKnC,MAAM,eAAgC,EAAE;;;;;;AAOxC,SAAgB,gBAAiC;CAC/C,MAAM,UAAU,aAAa,OAAO,EAAE;AACtC,QAAO,QAAQ,IAAI,QAAQ;;AAG7B,SAAS,QACP,QACA,SACkB;CAClB,MAAM,EAAE,SAAS,kBAAkB,MAAM,SAAS,WAAW,EAAE;AAG/D,KAAI,CAAC,KAAK;AACR,MAAI,UAAU;GAEZ,MAAM,YAAY,WAChB,mBACI,MAAM,cAAc,kBAAkB;IAAE,WAAW;IAAM,WAAW;IAAM,OAAO;IAAM,CAAC,GACxF;AACN,YAAS,cAAc;AACvB,UAAO;;EAIT,MAAM,gBAAgB,MAAM,KAAK,YAAY;GAC3C,MAAM,MAAM,MAAM,QAAQ;AAC1B,OAAI,aAAa,IAAK,QAAO;AAC7B,UAAO,EAAE,SAAS,KAAyB;IAC3C;EAEF,MAAM,kBAAkB,UAAa;GACnC,MAAM,CAAC,SAAS,cAAc,MAAM,SAAS,MAAM;AACnD,SAAM,gBAAgB,WAAW,KAAK,EAAE,EAAE,CAAC;AAE3C,OAAI,CAAC,QACH,QAAO,mBACH,MAAM,cAAc,kBAAkB;IAAE,WAAW;IAAM,WAAW;IAAM,OAAO;IAAM,CAAC,GACxF;GAGN,MAAM,WAAW,mBACb,MAAM,cAAc,kBAAkB;IAAE,WAAW;IAAM,WAAW;IAAM,OAAO;IAAM,CAAC,GACxF;AACJ,UAAO,MAAM,cACX,MAAM,UACN,EAAE,UAAU,EACZ,MAAM,cAAc,eAAe,MAAM,CAC1C;;AAGH,iBAAe,cAAc;AAC7B,SAAO;;AAIT,KAAI,UAAU;AAKZ,MAAI,OAAO,MAAM,SAAS,YAAY;GACpC,MAAM,qBAAqB,OAAO,UAAa;IAK7C,MAAM,MAAM,MAAM,QAAQ;IAC1B,MAAM,YACJ,aAAa,MACR,IAAsC,UACtC;AACP,WAAO,MAAM,cAAc,WAAW,MAAM;;AAE9C,sBAAmB,cAAc;AAGjC,UAAO;;EAKT,MAAM,aAAa,MAAM,KAAK,YAAY;GACxC,MAAM,MAAM,MAAM,QAAQ;AAC1B,OAAI,aAAa,IAAK,QAAO;AAC7B,UAAO,EAAE,SAAS,KAAyB;IAC3C;EAEF,MAAM,iBAAiB,UAAa;GAClC,MAAM,WAAW,mBACb,MAAM,cAAc,kBAAkB;IAAE,WAAW;IAAM,WAAW;IAAM,OAAO;IAAM,CAAC,GACxF;GACJ,MAAM,cAAc,MAAM,cAAc,YAAY,MAAM;GAG1D,MAAM,gBAAgB,mBAAmB,yBAAyB,GAAG;GACrE,MAAM,UAAU,gBACZ,MAAM,cAAc,eAAe,EAAE,UAAU,kBAAkB,EAAE,YAAY,GAC/E;AACJ,UAAO,MAAM,cAAc,MAAM,UAAU,EAAE,UAAU,EAAE,QAAQ;;AAGnE,gBAAc,cAAc;AAC5B,SAAO;;CAIT,MAAM,gBAAgB,MAAM,KAAK,YAAY;EAC3C,MAAM,MAAM,MAAM,QAAQ;AAC1B,MAAI,aAAa,IAAK,QAAO;AAC7B,SAAO,EAAE,SAAS,KAAyB;GAC3C;CAEF,MAAM,iBAAiB,UAAa;EAClC,MAAM,WAAW,mBACb,MAAM,cAAc,kBAAkB;GAAE,WAAW;GAAM,WAAW;GAAM,OAAO;GAAM,CAAC,GACxF;AACJ,SAAO,MAAM,cACX,MAAM,UACN,EAAE,UAAU,EACZ,MAAM,cAAc,eAAe,MAAM,CAC1C;;AAGH,eAAc,cAAc;AAC5B,QAAO"}
|
|
1
|
+
{"version":3,"file":"dynamic.js","names":[],"sources":["../../src/shims/dynamic.ts"],"sourcesContent":["/**\n * next/dynamic shim\n *\n * SSR-safe dynamic imports. On the server, uses React.lazy + Suspense so that\n * renderToReadableStream suspends until the dynamically-imported component is\n * available. On the client, also uses React.lazy for code splitting.\n *\n * Works in RSC, SSR, and client environments:\n * - RSC: Uses React.lazy + Suspense (available in React 19.x react-server).\n * Falls back to async component pattern if a future React version\n * strips lazy from react-server.\n * - SSR: React.lazy + Suspense (renderToReadableStream suspends)\n * - Client: React.lazy + Suspense (standard code splitting)\n *\n * Supports:\n * - dynamic(import('./Component'))\n * - dynamic(() => import('./Component'))\n * - dynamic({ loader })\n * - dynamic(() => import('./Component'), { loading: () => <Spinner /> })\n * - dynamic(() => import('./Component'), { ssr: false })\n */\nimport React, { type ComponentType } from \"react\";\n\ntype DynamicLoadingProps = {\n error?: Error | null;\n isLoading?: boolean;\n pastDelay?: boolean;\n retry?: () => void;\n timedOut?: boolean;\n};\n\ntype ComponentModule<P> = { default: ComponentType<P> };\ntype LoaderComponent<P> = Promise<ComponentModule<P> | ComponentType<P>>;\ntype LoaderFn<P> = () => LoaderComponent<P>;\n\ntype DynamicOptions<P> = {\n loading?: ComponentType<DynamicLoadingProps>;\n loader?: Loader<P>;\n ssr?: boolean;\n};\n\ntype Loader<P> = LoaderFn<P> | LoaderComponent<P>;\ntype DynamicInput<P> = DynamicOptions<P> | Loader<P>;\n\nconst noopRetry = () => {};\n\nfunction createDynamicLoadingProps(\n overrides: Partial<DynamicLoadingProps> = {},\n): DynamicLoadingProps {\n return {\n error: null,\n isLoading: true,\n pastDelay: true,\n retry: noopRetry,\n timedOut: false,\n ...overrides,\n };\n}\n\nfunction hasDefaultExport<P>(\n mod: ComponentModule<P> | ComponentType<P>,\n): mod is ComponentModule<P> {\n return (typeof mod === \"object\" || typeof mod === \"function\") && mod !== null && \"default\" in mod;\n}\n\nfunction normalizeLoader<P extends object>(loader: Loader<P>): LoaderFn<P> {\n if (typeof loader === \"function\") {\n return loader;\n }\n return () => loader;\n}\n\nfunction normalizeDynamicOptions<P extends object>(\n dynamicInput: DynamicInput<P>,\n options?: DynamicOptions<P>,\n): DynamicOptions<P> {\n let normalizedOptions: DynamicOptions<P>;\n\n if (dynamicInput instanceof Promise || typeof dynamicInput === \"function\") {\n normalizedOptions = { loader: normalizeLoader(dynamicInput) };\n } else {\n normalizedOptions = dynamicInput;\n }\n\n return {\n ...normalizedOptions,\n ...options,\n };\n}\n\nfunction createLazyComponent<P extends object>(loader: LoaderFn<P>) {\n return React.lazy(async () => {\n const mod = await loader();\n if (hasDefaultExport(mod)) return mod;\n return { default: mod };\n });\n}\n\nfunction useRetryableLazyComponent<P extends object>(\n loader: LoaderFn<P>,\n initialLazyComponent: ReturnType<typeof createLazyComponent<P>>,\n) {\n const [LazyComponent, setLazyComponent] = React.useState(() => initialLazyComponent);\n const [retryKey, setRetryKey] = React.useState(0);\n const retry = React.useCallback(() => {\n setLazyComponent(() => createLazyComponent(loader));\n setRetryKey((key) => key + 1);\n }, [loader]);\n return { LazyComponent, retry, retryKey };\n}\n\ntype DynamicErrorBoundaryProps = {\n fallback: ComponentType<DynamicLoadingProps>;\n retry: () => void;\n resetKey: number;\n children?: React.ReactNode;\n};\n\ntype DynamicErrorBoundaryState = {\n error: Error | null;\n resetKey: number;\n};\n\n/**\n * Lightweight error boundary that renders the loading component with the error\n * when a dynamic() loader rejects. Without this, loader failures would propagate\n * uncaught through React's rendering — this preserves the Next.js behavior where\n * the `loading` component can display errors.\n *\n * Lazily created because React.Component is not available in the RSC environment\n * (server components use a slimmed-down React that doesn't include class components).\n */\nlet DynamicErrorBoundary: ComponentType<DynamicErrorBoundaryProps> | null | undefined;\nfunction getDynamicErrorBoundary() {\n if (DynamicErrorBoundary) return DynamicErrorBoundary;\n if (!React.Component) return null;\n DynamicErrorBoundary = class extends (\n React.Component<DynamicErrorBoundaryProps, DynamicErrorBoundaryState>\n ) {\n constructor(props: DynamicErrorBoundaryProps) {\n super(props);\n this.state = { error: null, resetKey: props.resetKey };\n }\n static getDerivedStateFromProps(\n props: DynamicErrorBoundaryProps,\n state: DynamicErrorBoundaryState,\n ) {\n if (props.resetKey !== state.resetKey) {\n return { error: null, resetKey: props.resetKey };\n }\n return null;\n }\n static getDerivedStateFromError(error: unknown) {\n return { error: error instanceof Error ? error : new Error(String(error)) };\n }\n render() {\n if (this.state.error) {\n return React.createElement(\n this.props.fallback,\n createDynamicLoadingProps({\n isLoading: false,\n error: this.state.error,\n retry: this.props.retry,\n }),\n );\n }\n return this.props.children;\n }\n };\n return DynamicErrorBoundary;\n}\n\n// Detect server vs client\nconst isServer = typeof window === \"undefined\";\n\n// Legacy preload queue — kept for backward compatibility with Pages Router\n// which calls flushPreloads() before rendering. The App Router uses React.lazy\n// + Suspense instead, so this queue is no longer populated.\nconst preloadQueue: Promise<void>[] = [];\n\n/**\n * Wait for all pending dynamic() preloads to resolve, then clear the queue.\n * Called by the Pages Router SSR handler before rendering.\n * No-op for the App Router path which uses React.lazy + Suspense.\n */\nexport function flushPreloads(): Promise<void[]> {\n const pending = preloadQueue.splice(0);\n return Promise.all(pending);\n}\n\nfunction dynamic<P extends object = object>(\n dynamicInput: DynamicInput<P>,\n options?: DynamicOptions<P>,\n): ComponentType<P> {\n const {\n loader: dynamicLoader,\n loading: LoadingComponent,\n ssr = true,\n } = normalizeDynamicOptions(dynamicInput, options);\n const loader = dynamicLoader ? normalizeLoader(dynamicLoader) : () => Promise.resolve(() => null);\n\n // ssr: false — render nothing on the server, lazy-load on client\n if (!ssr) {\n if (isServer) {\n // On the server (SSR or RSC), just render the loading state or nothing\n const SSRFalse = (_props: P) =>\n LoadingComponent\n ? React.createElement(LoadingComponent, createDynamicLoadingProps({ pastDelay: false }))\n : null;\n SSRFalse.displayName = \"DynamicSSRFalse\";\n return SSRFalse;\n }\n\n const InitialLazyComponent = createLazyComponent(loader);\n\n const ClientSSRFalse = (props: P) => {\n const [mounted, setMounted] = React.useState(false);\n const { LazyComponent, retry, retryKey } = useRetryableLazyComponent(\n loader,\n InitialLazyComponent,\n );\n React.useEffect(() => setMounted(true), []);\n\n if (!mounted) {\n return LoadingComponent\n ? React.createElement(LoadingComponent, createDynamicLoadingProps({ retry }))\n : null;\n }\n\n const fallback = LoadingComponent\n ? React.createElement(LoadingComponent, createDynamicLoadingProps({ retry }))\n : null;\n const lazyElement = React.createElement(LazyComponent, props);\n let content: React.ReactNode = lazyElement;\n if (LoadingComponent) {\n const ErrorBoundary = getDynamicErrorBoundary();\n if (ErrorBoundary) {\n content = React.createElement(\n ErrorBoundary,\n { fallback: LoadingComponent, retry, resetKey: retryKey },\n lazyElement,\n );\n }\n }\n return React.createElement(React.Suspense, { fallback }, content);\n };\n\n ClientSSRFalse.displayName = \"DynamicClientSSRFalse\";\n return ClientSSRFalse;\n }\n\n // SSR-enabled path\n if (isServer) {\n // Defensive fallback: if a future React version strips React.lazy from the\n // react-server condition, fall back to an async component pattern.\n // In React 19.x, React.lazy IS available in react-server, so this branch\n // does not execute — it exists for forward compatibility only.\n if (typeof React.lazy !== \"function\") {\n const AsyncServerDynamic = async (props: P) => {\n // Note: LoadingComponent is not used here — in the RSC environment,\n // async components suspend natively and parent <Suspense> boundaries\n // provide loading states. Error handling also defers to the nearest\n // error boundary in the component tree.\n const mod = await loader();\n const Component =\n \"default\" in mod\n ? (mod as { default: ComponentType<P> }).default\n : (mod as ComponentType<P>);\n return React.createElement(Component, props);\n };\n AsyncServerDynamic.displayName = \"DynamicAsyncServer\";\n // Cast is safe: async components are natively supported by the RSC renderer,\n // but TypeScript's ComponentType<P> doesn't account for async return types.\n return AsyncServerDynamic as unknown as ComponentType<P>;\n }\n\n // SSR path: Use React.lazy so that renderToReadableStream can suspend\n // until the dynamically-imported component is available.\n const LazyServer = createLazyComponent(loader);\n\n const ServerDynamic = (props: P) => {\n const fallback = LoadingComponent\n ? React.createElement(LoadingComponent, createDynamicLoadingProps())\n : null;\n const lazyElement = React.createElement(LazyServer, props);\n // Wrap with error boundary so loader rejections render the loading\n // component with the error instead of propagating uncaught.\n let content: React.ReactNode = lazyElement;\n if (LoadingComponent) {\n const ErrorBoundary = getDynamicErrorBoundary();\n if (ErrorBoundary) {\n content = React.createElement(\n ErrorBoundary,\n { fallback: LoadingComponent, retry: noopRetry, resetKey: 0 },\n lazyElement,\n );\n }\n }\n return React.createElement(React.Suspense, { fallback }, content);\n };\n\n ServerDynamic.displayName = \"DynamicServer\";\n return ServerDynamic;\n }\n\n const InitialLazyComponent = createLazyComponent(loader);\n\n const ClientDynamic = (props: P) => {\n const { LazyComponent, retry, retryKey } = useRetryableLazyComponent(\n loader,\n InitialLazyComponent,\n );\n const fallback = LoadingComponent\n ? React.createElement(LoadingComponent, createDynamicLoadingProps({ retry }))\n : null;\n const lazyElement = React.createElement(LazyComponent, props);\n let content: React.ReactNode = lazyElement;\n if (LoadingComponent) {\n const ErrorBoundary = getDynamicErrorBoundary();\n if (ErrorBoundary) {\n content = React.createElement(\n ErrorBoundary,\n { fallback: LoadingComponent, retry, resetKey: retryKey },\n lazyElement,\n );\n }\n }\n return React.createElement(React.Suspense, { fallback }, content);\n };\n\n ClientDynamic.displayName = \"DynamicClient\";\n return ClientDynamic;\n}\n\nexport default dynamic;\n"],"mappings":"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"}
|
|
@@ -8,17 +8,37 @@ type ErrorBoundaryProps = {
|
|
|
8
8
|
reset: () => void;
|
|
9
9
|
}>;
|
|
10
10
|
children: React.ReactNode;
|
|
11
|
+
resetKey?: string | null;
|
|
11
12
|
};
|
|
12
13
|
type CapturedError = {
|
|
13
14
|
thrownValue: unknown;
|
|
14
15
|
};
|
|
16
|
+
type RedirectBoundaryState = {
|
|
17
|
+
redirect: string | null;
|
|
18
|
+
redirectType: "push" | "replace" | null;
|
|
19
|
+
};
|
|
15
20
|
type ErrorBoundaryInnerProps = {
|
|
16
21
|
pathname: string;
|
|
17
22
|
} & ErrorBoundaryProps;
|
|
18
23
|
type ErrorBoundaryState = {
|
|
19
24
|
error: CapturedError | null;
|
|
20
25
|
previousPathname: string;
|
|
26
|
+
previousResetKey: string | null;
|
|
21
27
|
};
|
|
28
|
+
declare class RedirectErrorBoundary extends React.Component<{
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
}, RedirectBoundaryState> {
|
|
31
|
+
constructor(props: {
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
});
|
|
34
|
+
static getDerivedStateFromError(error: unknown): RedirectBoundaryState;
|
|
35
|
+
render(): string | number | bigint | boolean | _$react_jsx_runtime0.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
36
|
+
}
|
|
37
|
+
declare function RedirectBoundary({
|
|
38
|
+
children
|
|
39
|
+
}: {
|
|
40
|
+
children?: React.ReactNode;
|
|
41
|
+
}): _$react_jsx_runtime0.JSX.Element;
|
|
22
42
|
/**
|
|
23
43
|
* Generic ErrorBoundary used to wrap route segments with error.tsx.
|
|
24
44
|
* This must be a client component since error boundaries use
|
|
@@ -33,23 +53,27 @@ declare class ErrorBoundaryInner extends React.Component<ErrorBoundaryInnerProps
|
|
|
33
53
|
}
|
|
34
54
|
declare function ErrorBoundary({
|
|
35
55
|
fallback,
|
|
36
|
-
children
|
|
56
|
+
children,
|
|
57
|
+
resetKey
|
|
37
58
|
}: ErrorBoundaryProps): _$react_jsx_runtime0.JSX.Element;
|
|
38
59
|
type NotFoundBoundaryProps = {
|
|
39
60
|
fallback: React.ReactNode;
|
|
40
61
|
children: React.ReactNode;
|
|
62
|
+
resetKey?: string | null;
|
|
41
63
|
};
|
|
42
64
|
/**
|
|
43
65
|
* Wrapper that reads the current pathname and passes it to the inner class
|
|
44
|
-
* component.
|
|
66
|
+
* component. Segment reset keys own App Router remount semantics when present.
|
|
45
67
|
*/
|
|
46
68
|
declare function NotFoundBoundary({
|
|
47
69
|
fallback,
|
|
48
|
-
children
|
|
70
|
+
children,
|
|
71
|
+
resetKey
|
|
49
72
|
}: NotFoundBoundaryProps): _$react_jsx_runtime0.JSX.Element;
|
|
50
73
|
type ForbiddenBoundaryProps = {
|
|
51
74
|
fallback: React.ReactNode;
|
|
52
75
|
children: React.ReactNode;
|
|
76
|
+
resetKey?: string | null;
|
|
53
77
|
};
|
|
54
78
|
type ForbiddenBoundaryInnerProps = {
|
|
55
79
|
pathname: string;
|
|
@@ -57,6 +81,7 @@ type ForbiddenBoundaryInnerProps = {
|
|
|
57
81
|
type ForbiddenBoundaryState = {
|
|
58
82
|
forbidden: boolean;
|
|
59
83
|
previousPathname: string;
|
|
84
|
+
previousResetKey: string | null;
|
|
60
85
|
};
|
|
61
86
|
declare class ForbiddenBoundaryInner extends React.Component<ForbiddenBoundaryInnerProps, ForbiddenBoundaryState> {
|
|
62
87
|
constructor(props: ForbiddenBoundaryInnerProps);
|
|
@@ -66,11 +91,13 @@ declare class ForbiddenBoundaryInner extends React.Component<ForbiddenBoundaryIn
|
|
|
66
91
|
}
|
|
67
92
|
declare function ForbiddenBoundary({
|
|
68
93
|
fallback,
|
|
69
|
-
children
|
|
94
|
+
children,
|
|
95
|
+
resetKey
|
|
70
96
|
}: ForbiddenBoundaryProps): _$react_jsx_runtime0.JSX.Element;
|
|
71
97
|
type UnauthorizedBoundaryProps = {
|
|
72
98
|
fallback: React.ReactNode;
|
|
73
99
|
children: React.ReactNode;
|
|
100
|
+
resetKey?: string | null;
|
|
74
101
|
};
|
|
75
102
|
type UnauthorizedBoundaryInnerProps = {
|
|
76
103
|
pathname: string;
|
|
@@ -78,6 +105,7 @@ type UnauthorizedBoundaryInnerProps = {
|
|
|
78
105
|
type UnauthorizedBoundaryState = {
|
|
79
106
|
unauthorized: boolean;
|
|
80
107
|
previousPathname: string;
|
|
108
|
+
previousResetKey: string | null;
|
|
81
109
|
};
|
|
82
110
|
declare class UnauthorizedBoundaryInner extends React.Component<UnauthorizedBoundaryInnerProps, UnauthorizedBoundaryState> {
|
|
83
111
|
constructor(props: UnauthorizedBoundaryInnerProps);
|
|
@@ -87,7 +115,8 @@ declare class UnauthorizedBoundaryInner extends React.Component<UnauthorizedBoun
|
|
|
87
115
|
}
|
|
88
116
|
declare function UnauthorizedBoundary({
|
|
89
117
|
fallback,
|
|
90
|
-
children
|
|
118
|
+
children,
|
|
119
|
+
resetKey
|
|
91
120
|
}: UnauthorizedBoundaryProps): _$react_jsx_runtime0.JSX.Element;
|
|
92
121
|
type DevRecoveryBoundaryProps = {
|
|
93
122
|
resetKey: number;
|
|
@@ -106,5 +135,5 @@ declare class DevRecoveryBoundary extends React.Component<DevRecoveryBoundaryPro
|
|
|
106
135
|
render(): React.ReactNode;
|
|
107
136
|
}
|
|
108
137
|
//#endregion
|
|
109
|
-
export { DevRecoveryBoundary, DevRecoveryBoundaryProps, ErrorBoundary, ErrorBoundaryInner, ErrorBoundaryProps, ErrorBoundaryState, ForbiddenBoundary, ForbiddenBoundaryInner, NotFoundBoundary, UnauthorizedBoundary, UnauthorizedBoundaryInner };
|
|
138
|
+
export { DevRecoveryBoundary, DevRecoveryBoundaryProps, ErrorBoundary, ErrorBoundaryInner, ErrorBoundaryProps, ErrorBoundaryState, ForbiddenBoundary, ForbiddenBoundaryInner, NotFoundBoundary, RedirectBoundary, RedirectErrorBoundary, UnauthorizedBoundary, UnauthorizedBoundaryInner };
|
|
110
139
|
//# sourceMappingURL=error-boundary.d.ts.map
|