vinext 1.2.1 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -9
- package/dist/_virtual/_rolldown/runtime.js +1 -1
- package/dist/build/action-owner-manifest.d.ts +3 -2
- package/dist/build/action-owner-manifest.js +18 -2
- package/dist/build/app-page-static-eligibility.d.ts +17 -1
- package/dist/build/app-page-static-eligibility.js +80 -13
- package/dist/build/clean-output.d.ts +2 -1
- package/dist/build/client-build-config.d.ts +77 -6
- package/dist/build/client-build-config.js +176 -12
- package/dist/build/client-reference-async.d.ts +48 -0
- package/dist/build/client-reference-async.js +123 -0
- package/dist/build/client-reference-chunks.d.ts +32 -0
- package/dist/build/client-reference-chunks.js +111 -0
- package/dist/build/client-reference-groups.d.ts +171 -0
- package/dist/build/client-reference-groups.js +572 -0
- package/dist/build/css-url-assets.d.ts +2 -1
- package/dist/build/google-fonts/fallback-metrics.d.ts +2 -1
- package/dist/build/google-fonts/find-font-files-in-css.d.ts +1 -0
- package/dist/build/google-fonts/find-font-files-in-css.js +17 -4
- package/dist/build/google-fonts/font-metadata.d.ts +2 -1
- package/dist/build/google-fonts/validate.d.ts +2 -1
- package/dist/build/inline-css.d.ts +2 -1
- package/dist/build/layout-classification.d.ts +2 -1
- package/dist/build/module-dependency-cache.d.ts +33 -1
- package/dist/build/module-dependency-cache.js +51 -1
- package/dist/build/next-client-runtime-manifests.d.ts +12 -2
- package/dist/build/next-client-runtime-manifests.js +19 -4
- package/dist/build/nitro-public-files.d.ts +24 -0
- package/dist/build/nitro-public-files.js +60 -0
- package/dist/build/pages-client-assets-module.js +1 -1
- package/dist/build/precompress.d.ts +2 -1
- package/dist/build/precompress.js +1 -1
- package/dist/build/prerender-paths.d.ts +2 -1
- package/dist/build/prerender-paths.js +5 -2
- package/dist/build/prerender-phase.d.ts +2 -1
- package/dist/build/prerender-server-pool.js +1 -1
- package/dist/build/prerender.d.ts +3 -2
- package/dist/build/prerender.js +5 -4
- package/dist/build/report.d.ts +2 -1
- package/dist/build/route-classification-injector.d.ts +2 -1
- package/dist/build/route-classification-manifest.d.ts +2 -1
- package/dist/build/run-prerender.d.ts +2 -1
- package/dist/build/server-actions-encryption-key.d.ts +24 -0
- package/dist/build/server-actions-encryption-key.js +101 -0
- package/dist/build/ssr-manifest.d.ts +3 -0
- package/dist/build/ssr-manifest.js +34 -2
- package/dist/build/standalone.d.ts +2 -1
- package/dist/cache/cache-adapters-virtual.d.ts +2 -1
- package/dist/cache.js +1 -2
- package/dist/check.d.ts +2 -1
- package/dist/check.js +4 -0
- package/dist/cli-args.d.ts +2 -1
- package/dist/cli.js +2 -0
- package/dist/client/client-redirect-matcher.js +2 -1
- package/dist/client/client-redirects.d.ts +4 -3
- package/dist/client/client-redirects.js +2 -1
- package/dist/client/client-rewrite-params.d.ts +9 -0
- package/dist/client/client-rewrite-params.js +20 -0
- package/dist/client/client-rewrites.d.ts +2 -1
- package/dist/client/dev-error-overlay-store.d.ts +2 -1
- package/dist/client/dev-error-overlay.js +2 -1
- package/dist/client/index.js +1 -2
- package/dist/client/instrumentation-client-state.js +5 -5
- package/dist/client/navigation-runtime.d.ts +28 -3
- package/dist/client/navigation-runtime.js +42 -11
- package/dist/client/pages-router-link-navigation.d.ts +2 -1
- package/dist/client/vinext-next-data.d.ts +25 -2
- package/dist/client/window-next.d.ts +2 -1
- package/dist/config/config-matchers.d.ts +27 -41
- package/dist/config/config-matchers.js +293 -270
- package/dist/config/config-source.d.ts +34 -0
- package/dist/config/config-source.js +141 -0
- package/dist/config/dotenv.d.ts +2 -1
- package/dist/config/header-params.d.ts +29 -0
- package/dist/config/header-params.js +106 -0
- package/dist/config/next-config.d.ts +20 -6
- package/dist/config/next-config.js +149 -11
- package/dist/config/tsconfig-paths.d.ts +2 -1
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/detector.js +23 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/index.js +2 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/lookup.js +25 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/bmp.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/cur.js +15 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/dds.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/gif.js +12 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/heif.js +55 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/icns.js +76 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ico.js +39 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/index.js +46 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/j2c.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jp2.js +21 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jpg.js +71 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl-stream.js +42 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl.js +46 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ktx.js +19 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/png.js +28 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/pnm.js +54 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/psd.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/svg.js +79 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tga.js +15 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tiff.js +96 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/utils.js +53 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/webp.js +45 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/utils/bit-reader.js +38 -0
- package/dist/deps/.pnpm/ua-parser-js@1.0.35/deps/ua-parser-js/src/ua-parser.js +2 -2
- package/dist/entries/app-browser-entry.d.ts +34 -6
- package/dist/entries/app-browser-entry.js +103 -40
- package/dist/entries/app-rsc-entry.d.ts +4 -1
- package/dist/entries/app-rsc-entry.js +131 -66
- package/dist/entries/app-rsc-manifest.d.ts +12 -1
- package/dist/entries/app-rsc-manifest.js +73 -1
- package/dist/entries/app-ssr-entry.d.ts +4 -1
- package/dist/entries/app-ssr-entry.js +9 -2
- package/dist/entries/pages-client-entry.d.ts +1 -0
- package/dist/entries/pages-client-entry.js +6 -6
- package/dist/entries/pages-entry-helpers.js +1 -2
- package/dist/entries/pages-server-entry.d.ts +2 -1
- package/dist/entries/pages-server-entry.js +18 -15
- package/dist/entries/runtime-entry-module.d.ts +1 -0
- package/dist/entries/runtime-entry-module.js +4 -1
- package/dist/image/image-adapters-virtual.d.ts +2 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +340 -116
- package/dist/init.js +17 -0
- package/dist/plugins/client-compile-hints.d.ts +30 -0
- package/dist/plugins/client-compile-hints.js +88 -0
- package/dist/plugins/client-reference-dedup.d.ts +2 -1
- package/dist/plugins/cloudflare-dev-module-urls.d.ts +2 -1
- package/dist/plugins/dynamic-preload-metadata.d.ts +3 -1
- package/dist/plugins/dynamic-preload-metadata.js +1 -1
- package/dist/plugins/environment.d.ts +2 -1
- package/dist/plugins/fonts.js +9 -12
- package/dist/plugins/ignore-dynamic-requests.d.ts +2 -1
- package/dist/plugins/import-meta-url.d.ts +2 -1
- package/dist/plugins/og-assets.d.ts +2 -1
- package/dist/plugins/og-assets.js +2 -3
- package/dist/plugins/optimize-imports.d.ts +27 -3
- package/dist/plugins/optimize-imports.js +106 -20
- package/dist/plugins/pages-node-externals.d.ts +2 -1
- package/dist/plugins/remove-console.d.ts +2 -1
- package/dist/plugins/require-condition-resolution.d.ts +2 -1
- package/dist/plugins/rsc-client-reference-loaders.d.ts +53 -1
- package/dist/plugins/rsc-client-reference-loaders.js +447 -27
- package/dist/plugins/rsc-client-shim-excludes.js +2 -0
- package/dist/plugins/sass.d.ts +2 -1
- package/dist/plugins/strip-server-exports.d.ts +2 -1
- package/dist/plugins/styled-jsx.d.ts +2 -1
- package/dist/plugins/transform-result.d.ts +2 -1
- package/dist/plugins/typeof-window.d.ts +2 -1
- package/dist/plugins/use-cache-callable.d.ts +5 -0
- package/dist/plugins/use-cache-callable.js +30 -8
- package/dist/plugins/worker-image-imports.d.ts +1 -0
- package/dist/plugins/worker-image-imports.js +2 -2
- package/dist/plugins/worker-use-server.d.ts +2 -1
- package/dist/routing/app-route-graph.d.ts +41 -1
- package/dist/routing/app-route-graph.js +122 -50
- package/dist/routing/browser-route-manifest.d.ts +44 -0
- package/dist/routing/browser-route-manifest.js +195 -0
- package/dist/routing/hashed-route-patterns.d.ts +4 -0
- package/dist/routing/hashed-route-patterns.js +22 -0
- package/dist/routing/optimistic-route-trie.d.ts +28 -0
- package/dist/routing/optimistic-route-trie.js +102 -0
- package/dist/routing/route-matching.d.ts +2 -1
- package/dist/routing/route-pattern.d.ts +2 -1
- package/dist/routing/route-validation.d.ts +6 -1
- package/dist/routing/route-validation.js +26 -10
- package/dist/server/accept-encoding.d.ts +2 -1
- package/dist/server/app-action-forwarding.d.ts +10 -1
- package/dist/server/app-action-forwarding.js +15 -1
- package/dist/server/app-bfcache-identity.d.ts +2 -1
- package/dist/server/app-browser-action-result.d.ts +2 -1
- package/dist/server/app-browser-client-reuse-manifest.d.ts +2 -1
- package/dist/server/app-browser-entry.js +175 -64
- package/dist/server/app-browser-error.d.ts +5 -2
- package/dist/server/app-browser-error.js +7 -2
- package/dist/server/app-browser-history-controller.d.ts +2 -1
- package/dist/server/app-browser-hydration.d.ts +2 -1
- package/dist/server/app-browser-interception-context.d.ts +4 -3
- package/dist/server/app-browser-mpa-navigation.d.ts +1 -0
- package/dist/server/app-browser-mpa-navigation.js +6 -5
- package/dist/server/app-browser-navigation-controller.d.ts +17 -6
- package/dist/server/app-browser-navigation-controller.js +103 -36
- package/dist/server/app-browser-popstate.d.ts +2 -1
- package/dist/server/app-browser-rsc-redirect.d.ts +2 -1
- package/dist/server/app-browser-server-action-client.d.ts +2 -1
- package/dist/server/app-browser-state.d.ts +2 -2
- package/dist/server/app-browser-state.js +1 -1
- package/dist/server/app-browser-stream.d.ts +2 -1
- package/dist/server/app-browser-visible-commit.d.ts +6 -5
- package/dist/server/app-client-reference-manifest.d.ts +31 -0
- package/dist/server/app-client-reference-manifest.js +46 -0
- package/dist/server/app-client-reference-preloader.d.ts +45 -2
- package/dist/server/app-client-reference-preloader.js +48 -10
- package/dist/server/app-elements-wire.d.ts +2 -1
- package/dist/server/app-elements.d.ts +2 -0
- package/dist/server/app-elements.js +3 -1
- package/dist/server/app-fallback-renderer.d.ts +9 -2
- package/dist/server/app-fallback-renderer.js +6 -2
- package/dist/server/app-history-state.d.ts +2 -1
- package/dist/server/app-inline-css-client.d.ts +2 -1
- package/dist/server/app-layout-param-observation.d.ts +2 -1
- package/dist/server/app-metadata-tracing.d.ts +2 -1
- package/dist/server/app-middleware.d.ts +6 -0
- package/dist/server/app-middleware.js +8 -10
- package/dist/server/app-optimistic-routing.d.ts +26 -11
- package/dist/server/app-optimistic-routing.js +38 -96
- package/dist/server/app-page-boundary-render.d.ts +20 -2
- package/dist/server/app-page-boundary-render.js +229 -39
- package/dist/server/app-page-boundary.d.ts +34 -5
- package/dist/server/app-page-boundary.js +40 -7
- package/dist/server/app-page-cache-finalizer.d.ts +2 -1
- package/dist/server/app-page-cache-finalizer.js +1 -1
- package/dist/server/app-page-cache-render.d.ts +10 -2
- package/dist/server/app-page-cache-render.js +15 -2
- package/dist/server/app-page-cache.js +2 -2
- package/dist/server/app-page-dispatch.d.ts +34 -1
- package/dist/server/app-page-dispatch.js +165 -34
- package/dist/server/app-page-element-builder.d.ts +17 -1
- package/dist/server/app-page-element-builder.js +187 -66
- package/dist/server/app-page-execution.d.ts +28 -1
- package/dist/server/app-page-execution.js +114 -5
- package/dist/server/app-page-head.d.ts +95 -3
- package/dist/server/app-page-head.js +307 -152
- package/dist/server/app-page-http-access-fallback-metadata.d.ts +48 -2
- package/dist/server/app-page-http-access-fallback-metadata.js +76 -1
- package/dist/server/app-page-method.d.ts +2 -1
- package/dist/server/app-page-probe.d.ts +2 -1
- package/dist/server/app-page-render-identity.d.ts +2 -1
- package/dist/server/app-page-render.d.ts +7 -1
- package/dist/server/app-page-render.js +38 -11
- package/dist/server/app-page-request.d.ts +14 -1
- package/dist/server/app-page-request.js +1 -1
- package/dist/server/app-page-route-wiring.d.ts +52 -2
- package/dist/server/app-page-route-wiring.js +197 -47
- package/dist/server/app-page-rsc-render-status.d.ts +3 -1
- package/dist/server/app-page-rsc-render-status.js +1 -0
- package/dist/server/app-page-search-params-observation.d.ts +8 -6
- package/dist/server/app-page-search-params-observation.js +16 -11
- package/dist/server/app-page-segment-plan.d.ts +2 -1
- package/dist/server/app-page-stream.d.ts +38 -1
- package/dist/server/app-page-stream.js +24 -4
- package/dist/server/app-pages-bridge.d.ts +4 -2
- package/dist/server/app-pages-bridge.js +11 -7
- package/dist/server/app-ppr-fallback-shell-render.d.ts +2 -1
- package/dist/server/app-ppr-fallback-shell.d.ts +2 -1
- package/dist/server/app-prerender-endpoints.d.ts +2 -1
- package/dist/server/app-prerender-static-params.d.ts +2 -1
- package/dist/server/app-prerender-static-params.js +3 -2
- package/dist/server/app-render-dependency.d.ts +11 -1
- package/dist/server/app-render-dependency.js +65 -6
- package/dist/server/app-request-stage-independent-entry.d.ts +2 -1
- package/dist/server/app-request-stage-independent-entry.js +2 -2
- package/dist/server/app-response-stage-entry.d.ts +2 -1
- package/dist/server/app-response-stage-entry.js +3 -3
- package/dist/server/app-route-handler-cache.d.ts +2 -1
- package/dist/server/app-route-handler-dispatch.d.ts +2 -1
- package/dist/server/app-route-handler-dispatch.js +4 -2
- package/dist/server/app-route-handler-execution.d.ts +4 -1
- package/dist/server/app-route-handler-execution.js +9 -2
- package/dist/server/app-route-handler-middleware-context.d.ts +2 -1
- package/dist/server/app-route-handler-middleware-context.js +3 -3
- package/dist/server/app-route-handler-response.d.ts +4 -2
- package/dist/server/app-route-handler-response.js +2 -2
- package/dist/server/app-route-handler-runtime.d.ts +4 -1
- package/dist/server/app-route-handler-runtime.js +20 -3
- package/dist/server/app-route-module-loader.d.ts +18 -1
- package/dist/server/app-route-module-loader.js +15 -6
- package/dist/server/app-route-tree-prefetch.d.ts +2 -1
- package/dist/server/app-route-tree.d.ts +20 -0
- package/dist/server/app-route-tree.js +18 -0
- package/dist/server/app-router-entry.js +2 -2
- package/dist/server/app-rsc-combined-handler.js +8 -1
- package/dist/server/app-rsc-error-handler.d.ts +2 -1
- package/dist/server/app-rsc-errors.d.ts +9 -1
- package/dist/server/app-rsc-errors.js +9 -2
- package/dist/server/app-rsc-handler.d.ts +6 -2
- package/dist/server/app-rsc-handler.js +152 -140
- package/dist/server/app-rsc-response-finalizer.d.ts +7 -1
- package/dist/server/app-rsc-response-finalizer.js +4 -1
- package/dist/server/app-rsc-response-stage.js +3 -1
- package/dist/server/app-rsc-route-matching.d.ts +39 -1
- package/dist/server/app-rsc-route-matching.js +25 -1
- package/dist/server/app-segment-config.d.ts +2 -1
- package/dist/server/app-segment-config.js +1 -14
- package/dist/server/app-server-action-execution.d.ts +25 -7
- package/dist/server/app-server-action-execution.js +53 -59
- package/dist/server/app-ssr-entry.d.ts +12 -0
- package/dist/server/app-ssr-entry.js +104 -48
- package/dist/server/app-ssr-error-meta.d.ts +2 -1
- package/dist/server/app-ssr-search-params-gate.d.ts +2 -1
- package/dist/server/app-ssr-stream.d.ts +29 -10
- package/dist/server/app-ssr-stream.js +311 -67
- package/dist/server/app-static-generation.d.ts +2 -1
- package/dist/server/app-streamed-client-references.d.ts +39 -0
- package/dist/server/app-streamed-client-references.js +156 -0
- package/dist/server/app-visited-response-cache.d.ts +2 -1
- package/dist/server/app-worker-stages.d.ts +2 -1
- package/dist/server/artifact-compatibility.d.ts +2 -1
- package/dist/server/bfcache-identity.d.ts +2 -1
- package/dist/server/cache-headers.d.ts +2 -1
- package/dist/server/cacheability-request.d.ts +2 -1
- package/dist/server/client-reuse-manifest.d.ts +2 -1
- package/dist/server/config-headers.d.ts +2 -1
- package/dist/server/config-headers.js +12 -3
- package/dist/server/csp.d.ts +2 -1
- package/dist/server/default-global-not-found-module.d.ts +2 -1
- package/dist/server/default-http-access-fallback-modules.d.ts +33 -0
- package/dist/server/default-http-access-fallback-modules.js +31 -0
- package/dist/server/defer-until-stream-consumed.d.ts +34 -0
- package/dist/server/defer-until-stream-consumed.js +154 -21
- package/dist/server/dev-lockfile.d.ts +32 -2
- package/dist/server/dev-lockfile.js +46 -2
- package/dist/server/dev-module-runner.d.ts +2 -1
- package/dist/server/dev-server.js +10 -3
- package/dist/server/fetch-handler.js +1 -2
- package/dist/server/file-based-metadata.d.ts +2 -1
- package/dist/server/framework-tracer.d.ts +2 -1
- package/dist/server/html.d.ts +1 -0
- package/dist/server/html.js +19 -1
- package/dist/server/http-conditional.d.ts +2 -1
- package/dist/server/http-error-responses.d.ts +2 -1
- package/dist/server/implicit-tags.d.ts +2 -1
- package/dist/server/isolate-shared-promise.d.ts +10 -0
- package/dist/server/isolate-shared-promise.js +33 -0
- package/dist/server/isr-cache.js +3 -2
- package/dist/server/metadata-route-build-data.d.ts +2 -1
- package/dist/server/metadata-route-build-data.js +1 -1
- package/dist/server/metadata-route-response.d.ts +2 -1
- package/dist/server/metadata-route-response.js +1 -1
- package/dist/server/metadata-routes.d.ts +2 -1
- package/dist/server/middleware-matcher-pattern.d.ts +0 -1
- package/dist/server/middleware-matcher-pattern.js +11 -140
- package/dist/server/middleware-matcher.js +5 -6
- package/dist/server/middleware-response-headers.d.ts +31 -0
- package/dist/server/middleware-response-headers.js +57 -1
- package/dist/server/middleware-runtime.d.ts +2 -1
- package/dist/server/middleware-runtime.js +26 -13
- package/dist/server/navigation-planner.d.ts +2 -2
- package/dist/server/navigation-trace.d.ts +2 -1
- package/dist/server/next-error-digest.d.ts +2 -1
- package/dist/server/nitro-public-files-plugin.d.ts +39 -0
- package/dist/server/nitro-public-files-plugin.js +106 -0
- package/dist/server/nitro-public-files.d.ts +22 -0
- package/dist/server/nitro-public-files.js +39 -0
- package/dist/server/opentelemetry-api.d.ts +2 -1
- package/dist/server/operation-token.d.ts +2 -1
- package/dist/server/pages-api-route.d.ts +2 -1
- package/dist/server/pages-asset-tags.d.ts +7 -1
- package/dist/server/pages-asset-tags.js +9 -2
- package/dist/server/pages-body-parser-config.d.ts +2 -1
- package/dist/server/pages-client-assets.d.ts +8 -1
- package/dist/server/pages-data-route.d.ts +2 -1
- package/dist/server/pages-document-asset-props.d.ts +2 -1
- package/dist/server/pages-document-initial-props.d.ts +2 -1
- package/dist/server/pages-execution-tracing.d.ts +2 -1
- package/dist/server/pages-execution-tracing.js +1 -1
- package/dist/server/pages-get-initial-props.d.ts +2 -1
- package/dist/server/pages-i18n.d.ts +18 -0
- package/dist/server/pages-i18n.js +18 -2
- package/dist/server/pages-node-compat.d.ts +5 -3
- package/dist/server/pages-node-compat.js +35 -16
- package/dist/server/pages-page-data.d.ts +7 -1
- package/dist/server/pages-page-data.js +35 -12
- package/dist/server/pages-page-handler.d.ts +3 -2
- package/dist/server/pages-page-handler.js +16 -7
- package/dist/server/pages-page-method.d.ts +2 -1
- package/dist/server/pages-page-response.d.ts +2 -1
- package/dist/server/pages-preview.d.ts +2 -1
- package/dist/server/pages-readiness.d.ts +2 -1
- package/dist/server/pages-request-pipeline.d.ts +8 -2
- package/dist/server/pages-request-pipeline.js +35 -40
- package/dist/server/pages-request-stage-entry.d.ts +2 -1
- package/dist/server/pages-request-stage-entry.js +16 -6
- package/dist/server/pages-response-stage-entry.d.ts +2 -1
- package/dist/server/pages-response-stage-entry.js +1 -1
- package/dist/server/pages-revalidate.js +1 -0
- package/dist/server/pages-route-data-kind.d.ts +2 -1
- package/dist/server/pages-router-entry.js +1 -1
- package/dist/server/prerender-cache-life-header.d.ts +2 -1
- package/dist/server/prerender-route-params.d.ts +2 -1
- package/dist/server/prod-server.d.ts +2 -2
- package/dist/server/prod-server.js +80 -36
- package/dist/server/proxy-trust.d.ts +6 -0
- package/dist/server/proxy-trust.js +12 -6
- package/dist/server/request-log.d.ts +2 -1
- package/dist/server/request-pipeline.d.ts +5 -0
- package/dist/server/request-pipeline.js +12 -1
- package/dist/server/request-tracing.d.ts +2 -1
- package/dist/server/request-tracing.js +1 -1
- package/dist/server/response-start-tracing.js +7 -29
- package/dist/server/rsc-render-stream.d.ts +4 -0
- package/dist/server/rsc-render-stream.js +25 -0
- package/dist/server/seed-cache.d.ts +2 -1
- package/dist/server/seed-cache.js +1 -1
- package/dist/server/server-reference-loader.js +10 -1
- package/dist/server/static-file-cache.d.ts +2 -1
- package/dist/server/static-file-cache.js +16 -3
- package/dist/server/static-layout-client-reuse-proof.d.ts +2 -1
- package/dist/server/worker-revalidation-context.d.ts +2 -1
- package/dist/server/worker-stages.d.ts +2 -1
- package/dist/server/worker-utils.js +1 -1
- package/dist/shims/app.d.ts +2 -1
- package/dist/shims/cache-callable-runtime.d.ts +2 -1
- package/dist/shims/cache-handler.d.ts +8 -3
- package/dist/shims/cache-handler.js +32 -11
- package/dist/shims/cache-request-state.d.ts +40 -3
- package/dist/shims/cache-request-state.js +70 -5
- package/dist/shims/cache-runtime.js +47 -19
- package/dist/shims/cache.d.ts +2 -2
- package/dist/shims/cache.js +17 -8
- package/dist/shims/caught-not-found-boundaries.d.ts +15 -0
- package/dist/shims/caught-not-found-boundaries.js +48 -0
- package/dist/shims/cdn-purge-routes.d.ts +25 -0
- package/dist/shims/cdn-purge-routes.js +77 -0
- package/dist/shims/client-locale.js +2 -1
- package/dist/shims/client-page-root.d.ts +2 -1
- package/dist/shims/config.d.ts +2 -1
- package/dist/shims/default-forbidden.d.ts +4 -0
- package/dist/shims/default-forbidden.js +18 -0
- package/dist/shims/default-not-found.d.ts +0 -5
- package/dist/shims/default-not-found.js +5 -41
- package/dist/shims/default-unauthorized.d.ts +4 -0
- package/dist/shims/default-unauthorized.js +18 -0
- package/dist/shims/dynamic.js +17 -4
- package/dist/shims/error-boundary.d.ts +39 -3
- package/dist/shims/error-boundary.js +31 -16
- package/dist/shims/font-google.js +1 -2
- package/dist/shims/font-utils.d.ts +3 -2
- package/dist/shims/font-utils.js +5 -3
- package/dist/shims/form.js +9 -4
- package/dist/shims/http-access-error-fallback.d.ts +7 -0
- package/dist/shims/http-access-error-fallback.js +47 -0
- package/dist/shims/image-props.d.ts +93 -0
- package/dist/shims/image-props.js +323 -0
- package/dist/shims/image.d.ts +4 -39
- package/dist/shims/image.js +4 -319
- package/dist/shims/internal/app-prefetch-fetch-queue.d.ts +22 -2
- package/dist/shims/internal/app-prefetch-fetch-queue.js +71 -18
- package/dist/shims/internal/app-route-prefetch-policy.d.ts +14 -3
- package/dist/shims/internal/app-route-prefetch-policy.js +29 -4
- package/dist/shims/internal/cache-context-accessor.d.ts +2 -1
- package/dist/shims/internal/client-reference-loader.d.ts +7 -0
- package/dist/shims/internal/client-reference-loader.js +91 -0
- package/dist/shims/internal/cookie-serialize.d.ts +2 -1
- package/dist/shims/internal/cookies.js +1 -2
- package/dist/shims/internal/headers-state.d.ts +9 -0
- package/dist/shims/internal/headers-state.js +19 -2
- package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +6 -2
- package/dist/shims/internal/hybrid-client-route-owner-direct.js +31 -14
- package/dist/shims/internal/hybrid-client-route-owner.js +8 -8
- package/dist/shims/internal/interpolate-as.d.ts +2 -1
- package/dist/shims/internal/pages-data-target.d.ts +2 -1
- package/dist/shims/internal/pages-data-url.d.ts +2 -1
- package/dist/shims/internal/thenable-well-known-properties.d.ts +2 -1
- package/dist/shims/link.js +198 -53
- package/dist/shims/metadata.d.ts +32 -11
- package/dist/shims/metadata.js +88 -26
- package/dist/shims/navigation-errors.d.ts +2 -1
- package/dist/shims/navigation.d.ts +23 -3
- package/dist/shims/navigation.js +91 -25
- package/dist/shims/og.js +35 -10
- package/dist/shims/pages-router-runtime.d.ts +2 -1
- package/dist/shims/ppr-fallback-shell.d.ts +2 -1
- package/dist/shims/request-context.d.ts +13 -0
- package/dist/shims/router.js +33 -43
- package/dist/shims/server.d.ts +31 -4
- package/dist/shims/server.js +58 -10
- package/dist/shims/thenable-params.d.ts +6 -1
- package/dist/shims/thenable-params.js +11 -2
- package/dist/shims/unified-request-context.d.ts +5 -0
- package/dist/shims/unified-request-context.js +5 -3
- package/dist/typegen.d.ts +2 -1
- package/dist/utils/asset-prefix.d.ts +7 -0
- package/dist/utils/asset-prefix.js +10 -1
- package/dist/utils/client-build-manifest.d.ts +4 -1
- package/dist/utils/client-build-manifest.js +20 -6
- package/dist/utils/client-entry-manifest.d.ts +13 -0
- package/dist/utils/client-entry-manifest.js +20 -1
- package/dist/utils/client-reference-chunks.d.ts +45 -0
- package/dist/utils/client-reference-chunks.js +30 -0
- package/dist/utils/client-runtime-metadata.d.ts +10 -1
- package/dist/utils/client-runtime-metadata.js +53 -9
- package/dist/utils/compare.d.ts +9 -0
- package/dist/utils/compare.js +15 -1
- package/dist/utils/lazy-chunks.d.ts +18 -0
- package/dist/utils/lazy-chunks.js +27 -1
- package/dist/utils/manifest-paths.d.ts +14 -0
- package/dist/utils/manifest-paths.js +22 -1
- package/dist/utils/middleware-request-headers.d.ts +2 -1
- package/dist/utils/path-to-regexp.d.ts +21 -0
- package/dist/{server/middleware-path-to-regexp.js → utils/path-to-regexp.js} +14 -11
- package/dist/utils/plugin-react-version.d.ts +15 -0
- package/dist/utils/plugin-react-version.js +64 -0
- package/dist/utils/project.d.ts +2 -1
- package/dist/utils/project.js +9 -1
- package/dist/utils/public-routes.d.ts +2 -0
- package/dist/utils/public-routes.js +18 -7
- package/dist/utils/query.d.ts +2 -1
- package/dist/utils/sorted-array.d.ts +2 -1
- package/dist/utils/vite-cli-invocation.d.ts +2 -1
- package/package.json +5 -5
- package/dist/deps/.pnpm/image-size@2.0.2/deps/image-size/dist/index.js +0 -808
- package/dist/server/default-not-found-module.d.ts +0 -19
- package/dist/server/default-not-found-module.js +0 -18
- package/dist/server/middleware-path-to-regexp.d.ts +0 -13
- package/dist/server/rsc-stream-hints.d.ts +0 -21
- package/dist/server/rsc-stream-hints.js +0 -227
- package/dist/utils/regex-safety.d.ts +0 -17
- package/dist/utils/regex-safety.js +0 -789
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PathKey } from "../utils/path-to-regexp.js";
|
|
2
|
+
//#region src/config/config-source.d.ts
|
|
3
|
+
export type CompiledConfigSource = {
|
|
4
|
+
re: RegExp;
|
|
5
|
+
/** Keys in capture-group order; unnamed groups have numeric names. */
|
|
6
|
+
keys: PathKey[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Why `source` is not a valid redirects/rewrites/headers source, or null.
|
|
10
|
+
* Mirrors the source checks in Next.js's checkCustomRoutes, which fail the
|
|
11
|
+
* build; config loading calls this to do the same.
|
|
12
|
+
*
|
|
13
|
+
* https://github.com/vercel/next.js/blob/v16.2.7/packages/next/src/lib/load-custom-routes.ts
|
|
14
|
+
*/
|
|
15
|
+
export declare function configSourceError(source: unknown): string | null;
|
|
16
|
+
export declare function compileConfigSource(source: string): CompiledConfigSource | null;
|
|
17
|
+
/**
|
|
18
|
+
* Match a Next.js config source (from redirects/rewrites/headers) against a
|
|
19
|
+
* pathname. Returns the named params or null.
|
|
20
|
+
*
|
|
21
|
+
* Unnamed groups are dropped, as Next.js does with `removeUnnamedParams`.
|
|
22
|
+
* Repeated params (`:path*`, `:path+`) keep the captured string (`a/b`), and
|
|
23
|
+
* an optional param that did not match is `""`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function matchConfigPattern(pathname: string, pattern: string): Record<string, string> | null;
|
|
26
|
+
/**
|
|
27
|
+
* matchConfigPattern, also reporting the optional params that did not match.
|
|
28
|
+
* Next.js leaves those out of its params entirely.
|
|
29
|
+
*/
|
|
30
|
+
export declare function execConfigSource(pathname: string, source: string): {
|
|
31
|
+
params: Record<string, string>;
|
|
32
|
+
unmatched: string[];
|
|
33
|
+
} | null;
|
|
34
|
+
//#endregion
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { normalizePathTokens, parsePathPattern, pathTokensToRegExpSource } from "../utils/path-to-regexp.js";
|
|
2
|
+
//#region src/config/config-source.ts
|
|
3
|
+
/**
|
|
4
|
+
* Compiles and matches next.config.js redirect, rewrite and header sources.
|
|
5
|
+
*
|
|
6
|
+
* Kept apart from config-matchers so the Pages router can match sources
|
|
7
|
+
* synchronously with the same code as the server, without bundling the rest
|
|
8
|
+
* of config-matchers.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Cache for compiled redirect/rewrite/header sources.
|
|
12
|
+
*
|
|
13
|
+
* Sources come from next.config.js and never change at runtime. Without
|
|
14
|
+
* caching, every request re-parses and recompiles every rule. On apps with
|
|
15
|
+
* many locale-prefixed rules this dominated profiling at ~2.4 seconds of CPU
|
|
16
|
+
* self-time.
|
|
17
|
+
*
|
|
18
|
+
* Value is `null` when the source is invalid, so we skip it on subsequent
|
|
19
|
+
* requests too without re-parsing it.
|
|
20
|
+
*/
|
|
21
|
+
const _compiledSourceCache = /* @__PURE__ */ new Map();
|
|
22
|
+
/**
|
|
23
|
+
* Compile a redirect/rewrite/header source the way Next.js does at runtime:
|
|
24
|
+
* path-to-regexp 6 with `strict: true`, `delimiter: "/"` and case-insensitive
|
|
25
|
+
* matching, then `modifyRouteRegex` appends an optional trailing slash.
|
|
26
|
+
*
|
|
27
|
+
* Returns an error for sources path-to-regexp rejects. Like Next.js, custom
|
|
28
|
+
* param patterns are not checked for catastrophic backtracking.
|
|
29
|
+
*
|
|
30
|
+
* https://github.com/vercel/next.js/blob/v16.2.7/packages/next/src/server/lib/router-utils/filesystem.ts
|
|
31
|
+
* https://github.com/vercel/next.js/blob/v16.2.7/packages/next/src/shared/lib/router/utils/path-match.ts
|
|
32
|
+
*/
|
|
33
|
+
function compileConfigSourceUncached(source) {
|
|
34
|
+
const parsed = parseConfigSource(source);
|
|
35
|
+
if ("kind" in parsed) return parsed;
|
|
36
|
+
const { tokens, re } = parsed;
|
|
37
|
+
return {
|
|
38
|
+
re,
|
|
39
|
+
keys: tokens.filter((token) => typeof token !== "string" && !!token.pattern)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function parseConfigSource(source) {
|
|
43
|
+
try {
|
|
44
|
+
const tokens = parsePathPattern(source, { delimiter: "/" });
|
|
45
|
+
return {
|
|
46
|
+
tokens,
|
|
47
|
+
re: new RegExp(`${pathTokensToRegExpSource(tokens)}(?:\\/)?$`, "i")
|
|
48
|
+
};
|
|
49
|
+
} catch (error) {
|
|
50
|
+
return {
|
|
51
|
+
kind: "invalid",
|
|
52
|
+
error: error instanceof Error ? error.message : String(error)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Length of the RegExp Next.js builds when validating a source
|
|
58
|
+
* (tryToParsePath: path-to-regexp defaults, retried with normalized repeat
|
|
59
|
+
* tokens), or null when it cannot be built.
|
|
60
|
+
*/
|
|
61
|
+
function validationRegExpLength(source) {
|
|
62
|
+
try {
|
|
63
|
+
const tokens = parsePathPattern(source);
|
|
64
|
+
const build = (value) => new RegExp(`${pathTokensToRegExpSource(value)}[\\/#\\?]?$`).source.length;
|
|
65
|
+
try {
|
|
66
|
+
return build(tokens);
|
|
67
|
+
} catch {
|
|
68
|
+
return build(normalizePathTokens(tokens));
|
|
69
|
+
}
|
|
70
|
+
} catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Why `source` is not a valid redirects/rewrites/headers source, or null.
|
|
76
|
+
* Mirrors the source checks in Next.js's checkCustomRoutes, which fail the
|
|
77
|
+
* build; config loading calls this to do the same.
|
|
78
|
+
*
|
|
79
|
+
* https://github.com/vercel/next.js/blob/v16.2.7/packages/next/src/lib/load-custom-routes.ts
|
|
80
|
+
*/
|
|
81
|
+
function configSourceError(source) {
|
|
82
|
+
if (!source) return "`source` is missing";
|
|
83
|
+
if (typeof source !== "string") return "`source` is not a string";
|
|
84
|
+
if (!source.startsWith("/")) return "`source` does not start with /";
|
|
85
|
+
const parsed = parseConfigSource(source);
|
|
86
|
+
if ("kind" in parsed) return parsed.error;
|
|
87
|
+
const length = validationRegExpLength(source);
|
|
88
|
+
if (length !== null && length > 4096) return "`source` exceeds max built length of 4096";
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
function compileConfigSource(source) {
|
|
92
|
+
let compiled = _compiledSourceCache.get(source);
|
|
93
|
+
if (compiled !== void 0) return compiled;
|
|
94
|
+
const result = compileConfigSourceUncached(source);
|
|
95
|
+
if ("kind" in result) {
|
|
96
|
+
console.warn(`[vinext] Ignoring invalid next.config.js source "${source}": ${result.error}`);
|
|
97
|
+
compiled = null;
|
|
98
|
+
} else compiled = result;
|
|
99
|
+
_compiledSourceCache.set(source, compiled);
|
|
100
|
+
return compiled;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Match a Next.js config source (from redirects/rewrites/headers) against a
|
|
104
|
+
* pathname. Returns the named params or null.
|
|
105
|
+
*
|
|
106
|
+
* Unnamed groups are dropped, as Next.js does with `removeUnnamedParams`.
|
|
107
|
+
* Repeated params (`:path*`, `:path+`) keep the captured string (`a/b`), and
|
|
108
|
+
* an optional param that did not match is `""`.
|
|
109
|
+
*/
|
|
110
|
+
function matchConfigPattern(pathname, pattern) {
|
|
111
|
+
return execConfigSource(pathname, pattern)?.params ?? null;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* matchConfigPattern, also reporting the optional params that did not match.
|
|
115
|
+
* Next.js leaves those out of its params entirely.
|
|
116
|
+
*/
|
|
117
|
+
function execConfigSource(pathname, source) {
|
|
118
|
+
const compiled = compileConfigSource(source);
|
|
119
|
+
if (!compiled) return null;
|
|
120
|
+
const match = compiled.re.exec(pathname);
|
|
121
|
+
if (!match) return null;
|
|
122
|
+
const params = Object.create(null);
|
|
123
|
+
const matched = /* @__PURE__ */ new Set();
|
|
124
|
+
for (let i = 0; i < compiled.keys.length; i++) {
|
|
125
|
+
const key = compiled.keys[i].name;
|
|
126
|
+
if (typeof key !== "string") continue;
|
|
127
|
+
const value = match[i + 1];
|
|
128
|
+
if (value === void 0) {
|
|
129
|
+
if (!matched.has(key)) params[key] = "";
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
matched.add(key);
|
|
133
|
+
params[key] = value;
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
params,
|
|
137
|
+
unmatched: Object.keys(params).filter((key) => !matched.has(key))
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
export { compileConfigSource, configSourceError, execConfigSource, matchConfigPattern };
|
package/dist/config/dotenv.d.ts
CHANGED
|
@@ -47,4 +47,5 @@ export declare function getDotenvFiles(mode: string): string[];
|
|
|
47
47
|
* commands (which don't go through Vite at all), this is the only loading.
|
|
48
48
|
*/
|
|
49
49
|
export declare function loadDotenv({ root, mode, processEnv }: LoadDotenvOptions): LoadDotenvResult;
|
|
50
|
-
//#endregion
|
|
50
|
+
//#endregion
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/config/header-params.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Param substitution for next.config.js `headers()` keys and values.
|
|
4
|
+
*
|
|
5
|
+
* Next.js compiles each header key and value with `compileNonPath`: only
|
|
6
|
+
* `:name` markers for captured params are substituted, every other
|
|
7
|
+
* path-to-regexp metacharacter stays literal, repeated params are joined with
|
|
8
|
+
* their template prefix and suffix, and params are inserted verbatim (no
|
|
9
|
+
* encoding or validation).
|
|
10
|
+
*
|
|
11
|
+
* https://github.com/vercel/next.js/blob/v16.2.7/packages/next/src/shared/lib/router/utils/prepare-destination.ts
|
|
12
|
+
* https://github.com/vercel/next.js/blob/v16.2.7/packages/next/src/shared/lib/router/utils/route-match-utils.ts
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Params captured by a header rule: path-to-regexp source params (`*`/`+`
|
|
16
|
+
* params are arrays) merged with Next.js `matchHas` captures. A has capture
|
|
17
|
+
* can be `undefined` when its named group did not participate in the match.
|
|
18
|
+
*/
|
|
19
|
+
export type HeaderParams = Record<string, string | string[] | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* Substitute `params` into a header key or value like Next.js's
|
|
22
|
+
* `compileNonPath`. Throws where Next.js throws: a repeated param referenced
|
|
23
|
+
* without `*`/`+`, an `undefined` has capture, or a template path-to-regexp
|
|
24
|
+
* cannot parse.
|
|
25
|
+
*/
|
|
26
|
+
export declare function compileHeaderParamTemplate(value: string, params: HeaderParams): string;
|
|
27
|
+
/** Whether a substituted header pair can be sent as a response header. */
|
|
28
|
+
export declare function isValidHeaderPair(key: string, value: string): boolean;
|
|
29
|
+
//#endregion
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { parsePathPattern } from "../utils/path-to-regexp.js";
|
|
2
|
+
//#region src/config/header-params.ts
|
|
3
|
+
/**
|
|
4
|
+
* Param substitution for next.config.js `headers()` keys and values.
|
|
5
|
+
*
|
|
6
|
+
* Next.js compiles each header key and value with `compileNonPath`: only
|
|
7
|
+
* `:name` markers for captured params are substituted, every other
|
|
8
|
+
* path-to-regexp metacharacter stays literal, repeated params are joined with
|
|
9
|
+
* their template prefix and suffix, and params are inserted verbatim (no
|
|
10
|
+
* encoding or validation).
|
|
11
|
+
*
|
|
12
|
+
* https://github.com/vercel/next.js/blob/v16.2.7/packages/next/src/shared/lib/router/utils/prepare-destination.ts
|
|
13
|
+
* https://github.com/vercel/next.js/blob/v16.2.7/packages/next/src/shared/lib/router/utils/route-match-utils.ts
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Substitute `params` into a header key or value like Next.js's
|
|
17
|
+
* `compileNonPath`. Throws where Next.js throws: a repeated param referenced
|
|
18
|
+
* without `*`/`+`, an `undefined` has capture, or a template path-to-regexp
|
|
19
|
+
* cannot parse.
|
|
20
|
+
*/
|
|
21
|
+
function compileHeaderParamTemplate(value, params) {
|
|
22
|
+
if (!value.includes(":")) return value;
|
|
23
|
+
const keys = Object.keys(params);
|
|
24
|
+
const cacheKey = JSON.stringify([value, keys]);
|
|
25
|
+
let compiled = _compiledTemplateCache.get(cacheKey);
|
|
26
|
+
if (!compiled) {
|
|
27
|
+
try {
|
|
28
|
+
compiled = { compile: compileTemplate(value, keys) };
|
|
29
|
+
} catch (error) {
|
|
30
|
+
compiled = { error };
|
|
31
|
+
}
|
|
32
|
+
_compiledTemplateCache.set(cacheKey, compiled);
|
|
33
|
+
}
|
|
34
|
+
if ("error" in compiled) throw compiled.error;
|
|
35
|
+
return compiled.compile(params);
|
|
36
|
+
}
|
|
37
|
+
const _compiledTemplateCache = /* @__PURE__ */ new Map();
|
|
38
|
+
function compileTemplate(value, keys) {
|
|
39
|
+
for (const key of keys) if (value.includes(`:${key}`)) value = value.replace(new RegExp(`:${key}\\*`, "g"), `:${key}--ESCAPED_PARAM_ASTERISKS`).replace(new RegExp(`:${key}\\?`, "g"), `:${key}--ESCAPED_PARAM_QUESTION`).replace(new RegExp(`:${key}\\+`, "g"), `:${key}--ESCAPED_PARAM_PLUS`).replace(new RegExp(`:${key}(?!\\w)`, "g"), `--ESCAPED_PARAM_COLON${key}`);
|
|
40
|
+
value = value.replace(/(:|\*|\?|\+|\(|\)|\{|\})/g, "\\$1").replace(/--ESCAPED_PARAM_PLUS/g, "+").replace(/--ESCAPED_PARAM_COLON/g, ":").replace(/--ESCAPED_PARAM_QUESTION/g, "?").replace(/--ESCAPED_PARAM_ASTERISKS/g, "*");
|
|
41
|
+
const compiler = safeCompile(`/${value}`);
|
|
42
|
+
return (params) => compiler(params).slice(1);
|
|
43
|
+
}
|
|
44
|
+
const PARAM_SEPARATOR = "_NEXTSEP_";
|
|
45
|
+
function safeCompile(route) {
|
|
46
|
+
const needsNormalization = /\/\(\.{1,3}\):[^/\s]+/.test(route) || ADJACENT_PARAMS_RE.test(route);
|
|
47
|
+
const routeToUse = needsNormalization ? normalizeAdjacentParameters(route) : route;
|
|
48
|
+
try {
|
|
49
|
+
const compiler = compile(routeToUse);
|
|
50
|
+
return needsNormalization ? (params) => stripNormalizedSeparators(compiler(params)) : compiler;
|
|
51
|
+
} catch (error) {
|
|
52
|
+
if (needsNormalization) throw error;
|
|
53
|
+
try {
|
|
54
|
+
const compiler = compile(normalizeAdjacentParameters(route));
|
|
55
|
+
return (params) => stripNormalizedSeparators(compiler(params));
|
|
56
|
+
} catch {
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const ADJACENT_PARAMS_RE = /:[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*/;
|
|
62
|
+
function normalizeAdjacentParameters(route) {
|
|
63
|
+
return route.replace(/(\([^)]*\)):([^/\s]+)/g, `$1${PARAM_SEPARATOR}:$2`).replace(/:([^:/\s)]+)(?=:)/g, `:$1${PARAM_SEPARATOR}`);
|
|
64
|
+
}
|
|
65
|
+
function stripNormalizedSeparators(pathname) {
|
|
66
|
+
return pathname.replace(new RegExp(`\\)${PARAM_SEPARATOR}`, "g"), ")");
|
|
67
|
+
}
|
|
68
|
+
function compile(route) {
|
|
69
|
+
const tokens = parsePathPattern(route);
|
|
70
|
+
return (params) => {
|
|
71
|
+
let path = "";
|
|
72
|
+
for (const token of tokens) {
|
|
73
|
+
if (typeof token === "string") {
|
|
74
|
+
path += token;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const value = params[token.name];
|
|
78
|
+
const optional = token.modifier === "?" || token.modifier === "*";
|
|
79
|
+
const repeat = token.modifier === "*" || token.modifier === "+";
|
|
80
|
+
if (Array.isArray(value)) {
|
|
81
|
+
if (!repeat) throw new TypeError(`Expected "${token.name}" to not repeat, but got an array`);
|
|
82
|
+
if (value.length === 0) {
|
|
83
|
+
if (optional) continue;
|
|
84
|
+
throw new TypeError(`Expected "${token.name}" to not be empty`);
|
|
85
|
+
}
|
|
86
|
+
for (const segment of value) path += token.prefix + segment + token.suffix;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (typeof value === "string") {
|
|
90
|
+
path += token.prefix + value + token.suffix;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (optional) continue;
|
|
94
|
+
throw new TypeError(`Expected "${token.name}" to be ${repeat ? "an array" : "a string"}`);
|
|
95
|
+
}
|
|
96
|
+
return path;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const HTTP_TOKEN_RE = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;
|
|
100
|
+
const INVALID_HEADER_VALUE_CHAR_RE = /[^\t\x20-\x7e\x80-\xff]/;
|
|
101
|
+
/** Whether a substituted header pair can be sent as a response header. */
|
|
102
|
+
function isValidHeaderPair(key, value) {
|
|
103
|
+
return HTTP_TOKEN_RE.test(key) && !INVALID_HEADER_VALUE_CHAR_RE.test(value);
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
export { compileHeaderParamTemplate, isValidHeaderPair };
|
|
@@ -18,7 +18,13 @@ export type HasCondition = {
|
|
|
18
18
|
export type NextRedirect = {
|
|
19
19
|
source: string;
|
|
20
20
|
destination: string;
|
|
21
|
-
|
|
21
|
+
/** `true` answers 308, `false` 307. Ignored when `statusCode` is set. */
|
|
22
|
+
permanent?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Explicit redirect status, taking precedence over `permanent` as in Next.js
|
|
25
|
+
* `getRedirectStatus` (lib/redirect-status.ts).
|
|
26
|
+
*/
|
|
27
|
+
statusCode?: 301 | 302 | 303 | 307 | 308;
|
|
22
28
|
has?: HasCondition[];
|
|
23
29
|
missing?: HasCondition[];
|
|
24
30
|
/**
|
|
@@ -36,6 +42,12 @@ export type NextRedirect = {
|
|
|
36
42
|
* `.nextjs-ref/packages/next/src/lib/load-custom-routes.ts:26`.
|
|
37
43
|
*/
|
|
38
44
|
basePath?: false;
|
|
45
|
+
/**
|
|
46
|
+
* Internal: set by `applyLocaleToRoutes` on the `/${defaultLocale}` variant.
|
|
47
|
+
* Next.js `processRoutes` prefixes that variant's destination with the
|
|
48
|
+
* basePath without turning a bare `/` into the bare basePath.
|
|
49
|
+
*/
|
|
50
|
+
defaultLocaleVariant?: true;
|
|
39
51
|
};
|
|
40
52
|
export type NextRewrite = {
|
|
41
53
|
source: string;
|
|
@@ -609,11 +621,13 @@ export declare function normalizeAssetPrefix(value: unknown): string;
|
|
|
609
621
|
/**
|
|
610
622
|
* Resolve the App Router RSC compatibility identity for a build.
|
|
611
623
|
*
|
|
612
|
-
*
|
|
613
|
-
* `X-Vinext-RSC-Compatibility-Id` response header; browser navigation
|
|
614
|
-
* RSC payloads whose token differs (deploy skew)
|
|
615
|
-
*
|
|
616
|
-
*
|
|
624
|
+
* The server sends this token with each page (the navigation bootstrap) and in
|
|
625
|
+
* the `X-Vinext-RSC-Compatibility-Id` response header; browser navigation
|
|
626
|
+
* rejects RSC payloads whose token differs from its page's (deploy skew)
|
|
627
|
+
* without exposing the raw build ID. It is never inlined into the client
|
|
628
|
+
* bundle, where a per-build value would rename chunks on every build. When
|
|
629
|
+
* the user pins a `deploymentId` we reuse it (already stable across plugin
|
|
630
|
+
* instances); otherwise we mint a random UUID.
|
|
617
631
|
*
|
|
618
632
|
* NOTE: like `resolveBuildId`, this is non-deterministic in the no-deploymentId
|
|
619
633
|
* case, so a single `vite build` that instantiates the plugin more than once
|
|
@@ -5,6 +5,7 @@ import { isUnknownRecord } from "../utils/record.js";
|
|
|
5
5
|
import { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } from "../shims/constants.js";
|
|
6
6
|
import { getHtmlLimitedBotRegex } from "../utils/html-limited-bots.js";
|
|
7
7
|
import { flattenPluginOptions } from "../utils/plugin-options.js";
|
|
8
|
+
import { configSourceError } from "./config-source.js";
|
|
8
9
|
import { isExternalUrl } from "../utils/external-url.js";
|
|
9
10
|
import { applyLocaleToRoutes } from "./config-matchers.js";
|
|
10
11
|
import { loadTsconfigResolutionForRoot } from "./tsconfig-paths.js";
|
|
@@ -373,7 +374,8 @@ function warnDeprecatedConfigOptions(config, root) {
|
|
|
373
374
|
["experimental.instrumentationHook", `\`experimental.instrumentationHook\` is no longer needed, because \`instrumentation.js\` is available by default. You can remove it from ${configFileName}.`]
|
|
374
375
|
];
|
|
375
376
|
for (const [propertyPath, warning] of warnings) if (hasConfigProperty(config, propertyPath)) warnConfigOnce(warning);
|
|
376
|
-
|
|
377
|
+
const experimental = readOptionalRecord(config.experimental);
|
|
378
|
+
for (const key of ["skipTrailingSlashRedirect", "cacheComponents"]) if (experimental?.[key] != null) warnConfigOnce(`\`experimental.${key}\` has been moved to \`${key}\`. Please update your ${configFileName} file accordingly.`);
|
|
377
379
|
}
|
|
378
380
|
async function resolveNextConfigInput(config, phase = PHASE_DEVELOPMENT_SERVER) {
|
|
379
381
|
return await resolveConfigValue(config, phase);
|
|
@@ -534,11 +536,13 @@ function resolveDeploymentId(configDeploymentId) {
|
|
|
534
536
|
/**
|
|
535
537
|
* Resolve the App Router RSC compatibility identity for a build.
|
|
536
538
|
*
|
|
537
|
-
*
|
|
538
|
-
* `X-Vinext-RSC-Compatibility-Id` response header; browser navigation
|
|
539
|
-
* RSC payloads whose token differs (deploy skew)
|
|
540
|
-
*
|
|
541
|
-
*
|
|
539
|
+
* The server sends this token with each page (the navigation bootstrap) and in
|
|
540
|
+
* the `X-Vinext-RSC-Compatibility-Id` response header; browser navigation
|
|
541
|
+
* rejects RSC payloads whose token differs from its page's (deploy skew)
|
|
542
|
+
* without exposing the raw build ID. It is never inlined into the client
|
|
543
|
+
* bundle, where a per-build value would rename chunks on every build. When
|
|
544
|
+
* the user pins a `deploymentId` we reuse it (already stable across plugin
|
|
545
|
+
* instances); otherwise we mint a random UUID.
|
|
542
546
|
*
|
|
543
547
|
* NOTE: like `resolveBuildId`, this is non-deterministic in the no-deploymentId
|
|
544
548
|
* case, so a single `vite build` that instantiates the plugin more than once
|
|
@@ -750,6 +754,115 @@ function normalizeI18nConfig(value) {
|
|
|
750
754
|
};
|
|
751
755
|
}
|
|
752
756
|
/**
|
|
757
|
+
* Fail config loading on an invalid source, as Next.js fails the build
|
|
758
|
+
* (load-custom-routes.ts checkCustomRoutes), instead of silently skipping a
|
|
759
|
+
* redirect or security header per request.
|
|
760
|
+
*/
|
|
761
|
+
function validateConfigSources(type, routes) {
|
|
762
|
+
const invalid = [];
|
|
763
|
+
for (const route of routes) {
|
|
764
|
+
const error = configSourceError(route?.source);
|
|
765
|
+
if (!error) continue;
|
|
766
|
+
invalid.push(` ${describeSource(route?.source)}: ${error}`);
|
|
767
|
+
}
|
|
768
|
+
if (invalid.length > 0) throw new Error(`Invalid next.config.js ${type} source${invalid.length === 1 ? "" : "s"}:\n${invalid.join("\n")}`);
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* A route source for an error message. Only a string is shown as is; any
|
|
772
|
+
* other value, such as a BigInt, may not serialize.
|
|
773
|
+
*/
|
|
774
|
+
function describeSource(source) {
|
|
775
|
+
return typeof source === "string" ? JSON.stringify(source) : `(${source === null ? "null" : typeof source})`;
|
|
776
|
+
}
|
|
777
|
+
const CONDITION_TYPES = /* @__PURE__ */ new Set([
|
|
778
|
+
"header",
|
|
779
|
+
"cookie",
|
|
780
|
+
"query",
|
|
781
|
+
"host"
|
|
782
|
+
]);
|
|
783
|
+
/**
|
|
784
|
+
* Fail config loading on a malformed has/missing list or item, with the rules
|
|
785
|
+
* of Next.js's checkCustomRoutes (load-custom-routes.ts). The matchers rely on
|
|
786
|
+
* these shapes.
|
|
787
|
+
*/
|
|
788
|
+
function validateConfigConditions(type, routes) {
|
|
789
|
+
const invalid = [];
|
|
790
|
+
for (const route of routes) {
|
|
791
|
+
const source = describeSource(route?.source);
|
|
792
|
+
for (const field of ["has", "missing"]) {
|
|
793
|
+
const items = route?.[field];
|
|
794
|
+
if (items === void 0) continue;
|
|
795
|
+
if (!Array.isArray(items)) {
|
|
796
|
+
invalid.push(` ${source}: \`${field}\` must be undefined or an array`);
|
|
797
|
+
continue;
|
|
798
|
+
}
|
|
799
|
+
for (const item of items) {
|
|
800
|
+
const condition = item ?? {};
|
|
801
|
+
const parts = [];
|
|
802
|
+
if (!CONDITION_TYPES.has(condition.type)) parts.push("invalid type");
|
|
803
|
+
if (typeof condition.key !== "string" && condition.type !== "host") parts.push("invalid key");
|
|
804
|
+
if (condition.value !== void 0 && typeof condition.value !== "string") parts.push("invalid value");
|
|
805
|
+
if (condition.value === void 0 && condition.type === "host") parts.push("value is required for \"host\" type");
|
|
806
|
+
if (parts.length > 0) invalid.push(` ${source}: \`${field}\` item: ${parts.join(", ")} for ${describeConfigValue(item)}`);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
if (invalid.length > 0) throw new Error(`Invalid next.config.js ${type} has/missing condition${invalid.length === 1 ? "" : "s"}:\n${invalid.join("\n")}\nEach item must be { type: header, cookie, query or host, key: string, value?: string }, with a value and no key required for host.`);
|
|
811
|
+
}
|
|
812
|
+
const REDIRECT_STATUS_CODES = /* @__PURE__ */ new Set([
|
|
813
|
+
301,
|
|
814
|
+
302,
|
|
815
|
+
303,
|
|
816
|
+
307,
|
|
817
|
+
308
|
|
818
|
+
]);
|
|
819
|
+
/**
|
|
820
|
+
* Fail config loading on a redirect without a valid status, with the rules of
|
|
821
|
+
* Next.js's checkRedirect (load-custom-routes.ts): `statusCode` must be one of
|
|
822
|
+
* the redirect statuses, and `permanent` a boolean when it is absent.
|
|
823
|
+
*/
|
|
824
|
+
function validateRedirectStatuses(redirects) {
|
|
825
|
+
const invalid = [];
|
|
826
|
+
for (const redirect of redirects) {
|
|
827
|
+
const parts = [];
|
|
828
|
+
if (redirect.statusCode && !REDIRECT_STATUS_CODES.has(redirect.statusCode)) parts.push("`statusCode` is not undefined or valid statusCode");
|
|
829
|
+
if (typeof redirect.permanent !== "boolean" && !redirect.statusCode) parts.push("`permanent` is not set to `true` or `false`");
|
|
830
|
+
if (parts.length > 0) invalid.push(` ${describeSource(redirect.source)}: ${parts.join(", ")}`);
|
|
831
|
+
}
|
|
832
|
+
if (invalid.length > 0) throw new Error(`Invalid next.config.js redirect${invalid.length === 1 ? "" : "s"}:\n${invalid.join("\n")}\nValid redirect statusCode values are ${[...REDIRECT_STATUS_CODES].join(", ")}`);
|
|
833
|
+
}
|
|
834
|
+
/** JSON for a config value, or its type when JSON cannot serialize it. */
|
|
835
|
+
function describeConfigValue(value) {
|
|
836
|
+
try {
|
|
837
|
+
return JSON.stringify(value) ?? `(${typeof value})`;
|
|
838
|
+
} catch {
|
|
839
|
+
return `(${typeof value})`;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* The sources Next.js's processRoutes builds from `routes` by adding the
|
|
844
|
+
* basePath and locale prefixes, which checkCustomRoutes then checks again
|
|
845
|
+
* (load-custom-routes.ts). vinext adds basePath at match time instead, so
|
|
846
|
+
* these exist only for that check.
|
|
847
|
+
*/
|
|
848
|
+
function processedRouteSources(routes, type, options) {
|
|
849
|
+
const { basePath, i18n, trailingSlash } = options;
|
|
850
|
+
const escape = (value) => value.replace(/[|\\{}()[\]^$+*?.-]/g, "\\$&");
|
|
851
|
+
const suffixFor = (source) => source === "/" && !trailingSlash ? "" : source;
|
|
852
|
+
const defaultLocales = i18n && type === "redirect" ? [...(i18n.domains ?? []).map((domain) => domain.defaultLocale), i18n.defaultLocale] : [];
|
|
853
|
+
const sources = [];
|
|
854
|
+
for (const route of routes) {
|
|
855
|
+
const sourceBasePath = basePath && route.basePath !== false ? basePath : "";
|
|
856
|
+
let source = route.source;
|
|
857
|
+
if (i18n && route.locale !== false) {
|
|
858
|
+
if ("destination" in route && route.destination?.startsWith("/")) for (const locale of defaultLocales) sources.push({ source: `${sourceBasePath}/${locale}${suffixFor(source)}` });
|
|
859
|
+
source = `/:nextInternalLocale(${i18n.locales.map(escape).join("|")})${suffixFor(source)}`;
|
|
860
|
+
}
|
|
861
|
+
sources.push({ source: `${sourceBasePath}${source === "/" && sourceBasePath ? "" : source}` });
|
|
862
|
+
}
|
|
863
|
+
return sources;
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
753
866
|
* Resolve a NextConfig into a fully-resolved ResolvedNextConfig.
|
|
754
867
|
* Awaits async functions for redirects/rewrites/headers.
|
|
755
868
|
*/
|
|
@@ -852,11 +965,19 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
852
965
|
};
|
|
853
966
|
}
|
|
854
967
|
{
|
|
855
|
-
const
|
|
968
|
+
const allRewrites = [
|
|
856
969
|
...rewrites.beforeFiles,
|
|
857
970
|
...rewrites.afterFiles,
|
|
858
971
|
...rewrites.fallback
|
|
859
|
-
]
|
|
972
|
+
];
|
|
973
|
+
validateConfigSources("redirect", redirects);
|
|
974
|
+
validateConfigSources("rewrite", allRewrites);
|
|
975
|
+
validateConfigConditions("redirect", redirects);
|
|
976
|
+
validateRedirectStatuses(redirects);
|
|
977
|
+
validateConfigConditions("rewrite", allRewrites);
|
|
978
|
+
const invalidBasePathRewrites = allRewrites.filter((rewrite) => rewrite.basePath === false && !(rewrite.destination.startsWith("http://") || rewrite.destination.startsWith("https://")));
|
|
979
|
+
if (invalidBasePathRewrites.length > 0) throw new Error(invalidBasePathRewrites.map((rewrite) => `The route ${rewrite.source} rewrites urls outside of the basePath. Please use a destination that starts with \`http://\` or \`https://\` https://nextjs.org/docs/messages/invalid-external-rewrite`).concat(`Invalid rewrite${invalidBasePathRewrites.length === 1 ? "" : "s"} found`).join("\n"));
|
|
980
|
+
const externalRewrites = allRewrites.filter((rewrite) => isExternalUrl(rewrite.destination));
|
|
860
981
|
if (externalRewrites.length > 0) {
|
|
861
982
|
const noun = externalRewrites.length === 1 ? "external rewrite" : "external rewrites";
|
|
862
983
|
const listing = externalRewrites.map((rewrite) => ` ${rewrite.source} → ${rewrite.destination}`).join("\n");
|
|
@@ -865,6 +986,22 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
865
986
|
}
|
|
866
987
|
let headers = [];
|
|
867
988
|
if (config.headers) headers = await config.headers();
|
|
989
|
+
validateConfigSources("header", headers);
|
|
990
|
+
validateConfigConditions("header", headers);
|
|
991
|
+
if (config.basePath || i18n) {
|
|
992
|
+
const processOptions = {
|
|
993
|
+
basePath: config.basePath ?? "",
|
|
994
|
+
i18n,
|
|
995
|
+
trailingSlash: config.trailingSlash ?? false
|
|
996
|
+
};
|
|
997
|
+
validateConfigSources("redirect", processedRouteSources(redirects, "redirect", processOptions));
|
|
998
|
+
validateConfigSources("rewrite", processedRouteSources([
|
|
999
|
+
...rewrites.beforeFiles,
|
|
1000
|
+
...rewrites.afterFiles,
|
|
1001
|
+
...rewrites.fallback
|
|
1002
|
+
], "rewrite", processOptions));
|
|
1003
|
+
validateConfigSources("header", processedRouteSources(headers, "header", processOptions));
|
|
1004
|
+
}
|
|
868
1005
|
const webpackProbe = await probeWebpackConfig(config, root, options.dev ?? false);
|
|
869
1006
|
const mdx = webpackProbe.mdx;
|
|
870
1007
|
const aliases = {
|
|
@@ -873,6 +1010,7 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
873
1010
|
};
|
|
874
1011
|
const allowedDevOrigins = Array.isArray(config.allowedDevOrigins) ? config.allowedDevOrigins : [];
|
|
875
1012
|
const experimental = readOptionalRecord(config.experimental);
|
|
1013
|
+
const cacheComponents = (experimental?.cacheComponents ?? config.cacheComponents) === true;
|
|
876
1014
|
const serverActionsConfig = readOptionalRecord(experimental?.serverActions);
|
|
877
1015
|
const serverActionsAllowedOrigins = readStringArray(serverActionsConfig?.allowedOrigins);
|
|
878
1016
|
const serverActionsBodySizeLimitConfig = readOptionalBodySizeLimit(serverActionsConfig?.bodySizeLimit);
|
|
@@ -888,7 +1026,7 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
888
1026
|
const appShells = experimental?.appShells === true;
|
|
889
1027
|
if (appShells) {
|
|
890
1028
|
const missingCoFlags = [];
|
|
891
|
-
if (!
|
|
1029
|
+
if (!cacheComponents) missingCoFlags.push("cacheComponents");
|
|
892
1030
|
if (!prefetchInlining) missingCoFlags.push("experimental.prefetchInlining");
|
|
893
1031
|
if (experimental?.varyParams !== true) missingCoFlags.push("experimental.varyParams");
|
|
894
1032
|
if (experimental?.optimisticRouting !== true) missingCoFlags.push("experimental.optimisticRouting");
|
|
@@ -909,7 +1047,7 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
909
1047
|
exclude: lightningCssFeatureNamesToMask(readStringArray(rawLightningCssFeatures?.exclude))
|
|
910
1048
|
};
|
|
911
1049
|
if (rawLightningCssFeatures && !useLightningcss) console.warn("[vinext] experimental.lightningCssFeatures is set but experimental.useLightningcss is not enabled. The lightningCssFeatures option has no effect without useLightningcss.");
|
|
912
|
-
if (experimental?.cachedNavigations === true && !
|
|
1050
|
+
if (experimental?.cachedNavigations === true && !cacheComponents) console.warn("[vinext] `experimental.cachedNavigations` requires `cacheComponents: true` to have any effect. Set `cacheComponents: true` in your next.config, or remove `experimental.cachedNavigations`.");
|
|
913
1051
|
if (config.webpack !== void 0) {
|
|
914
1052
|
if (mdx || Object.keys(webpackProbe.aliases).length > 0 || webpackProbe.resolveExtensionsCustomized || webpackProbe.instrumentationClientRouteManifest !== void 0) console.warn("[vinext] next.config option \"webpack\" is only partially supported. vinext preserves resolve.alias, resolve.extensions, MDX loader settings, and instrumentation-client route manifests, but other webpack customization is ignored");
|
|
915
1053
|
else console.warn("[vinext] next.config option \"webpack\" is not yet supported and will be ignored");
|
|
@@ -960,7 +1098,7 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
960
1098
|
instrumentationClientInject: Array.isArray(config.instrumentationClientInject) ? config.instrumentationClientInject.filter((x) => typeof x === "string") : [],
|
|
961
1099
|
instrumentationClientRouteManifest: webpackProbe.instrumentationClientRouteManifest,
|
|
962
1100
|
instrumentationServerValueInjections: webpackProbe.instrumentationServerValueInjections,
|
|
963
|
-
cacheComponents
|
|
1101
|
+
cacheComponents,
|
|
964
1102
|
appNavFailHandling: experimental?.appNavFailHandling === true,
|
|
965
1103
|
gestureTransition: experimental?.gestureTransition === true,
|
|
966
1104
|
prefetchInlining,
|
|
@@ -17,4 +17,5 @@ export declare function loadTsconfigResolutionForRoot(projectRoot: string): Tsco
|
|
|
17
17
|
* Back-compat helper for call sites that only need `compilerOptions.paths`.
|
|
18
18
|
*/
|
|
19
19
|
export declare function loadTsconfigPathAliasesForRoot(projectRoot: string): Record<string, string>;
|
|
20
|
-
//#endregion
|
|
20
|
+
//#endregion
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { typeHandlers, types } from "./types/index.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/detector.js
|
|
3
|
+
const firstBytes = /* @__PURE__ */ new Map([
|
|
4
|
+
[0, "heif"],
|
|
5
|
+
[56, "psd"],
|
|
6
|
+
[66, "bmp"],
|
|
7
|
+
[68, "dds"],
|
|
8
|
+
[71, "gif"],
|
|
9
|
+
[73, "tiff"],
|
|
10
|
+
[77, "tiff"],
|
|
11
|
+
[82, "webp"],
|
|
12
|
+
[105, "icns"],
|
|
13
|
+
[137, "png"],
|
|
14
|
+
[255, "jpg"]
|
|
15
|
+
]);
|
|
16
|
+
function detector(input) {
|
|
17
|
+
const byte = input[0];
|
|
18
|
+
const type = firstBytes.get(byte);
|
|
19
|
+
if (type && typeHandlers.get(type)?.validate(input)) return type;
|
|
20
|
+
return types.find((type) => typeHandlers.get(type)?.validate(input));
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { detector };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { typeHandlers } from "./types/index.js";
|
|
2
|
+
import { detector } from "./detector.js";
|
|
3
|
+
//#region ../../node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/lookup.js
|
|
4
|
+
const globalOptions = { disabledTypes: [] };
|
|
5
|
+
function imageSize(input) {
|
|
6
|
+
const type = detector(input);
|
|
7
|
+
if (typeof type !== "undefined") {
|
|
8
|
+
if (globalOptions.disabledTypes.indexOf(type) > -1) throw new TypeError(`disabled file type: ${type}`);
|
|
9
|
+
const size = typeHandlers.get(type)?.calculate(input);
|
|
10
|
+
if (size !== void 0) {
|
|
11
|
+
size.type = size.type ?? type;
|
|
12
|
+
if (size.images && size.images.length > 1) {
|
|
13
|
+
const largestImage = size.images.reduce((largest, current) => {
|
|
14
|
+
return current.width * current.height > largest.width * largest.height ? current : largest;
|
|
15
|
+
}, size.images[0]);
|
|
16
|
+
size.width = largestImage.width;
|
|
17
|
+
size.height = largestImage.height;
|
|
18
|
+
}
|
|
19
|
+
return size;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
throw new TypeError(`unsupported file type: ${type}`);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { imageSize };
|