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
package/dist/build/report.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { parseSync } from "vite";
|
|
3
4
|
//#region src/build/report.ts
|
|
4
5
|
/**
|
|
5
6
|
* Build report — prints a Next.js-style route table after `vinext build`.
|
|
@@ -11,9 +12,9 @@ import path from "node:path";
|
|
|
11
12
|
* ? Unknown — no explicit config; likely dynamic but not confirmed
|
|
12
13
|
* λ API — API route handler
|
|
13
14
|
*
|
|
14
|
-
* Classification uses
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* Classification uses AST-based static source analysis (no module execution).
|
|
16
|
+
* Runtime/prerender results are still treated as stronger evidence where
|
|
17
|
+
* available; AST analysis only reads top-level static exports.
|
|
17
18
|
*
|
|
18
19
|
* Limitation: without running the build, we cannot detect dynamic API usage
|
|
19
20
|
* (headers(), cookies(), connection(), etc.) that implicitly forces a route
|
|
@@ -28,42 +29,113 @@ function getAppRouteRenderEntryPath(route) {
|
|
|
28
29
|
for (const slot of route.parallelSlots) if (slot.defaultPath) return slot.defaultPath;
|
|
29
30
|
return null;
|
|
30
31
|
}
|
|
32
|
+
function parseRouteModuleWithLang(code, lang) {
|
|
33
|
+
try {
|
|
34
|
+
const result = parseSync(`vinext-route.${lang}`, code, {
|
|
35
|
+
astType: "ts",
|
|
36
|
+
lang,
|
|
37
|
+
sourceType: "module"
|
|
38
|
+
});
|
|
39
|
+
return result.errors.some((error) => error.severity === "Error") ? null : result.program;
|
|
40
|
+
} catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function parseRouteModule(code) {
|
|
45
|
+
return parseRouteModuleWithLang(code, "tsx") ?? parseRouteModuleWithLang(code, "ts");
|
|
46
|
+
}
|
|
47
|
+
function moduleExportNameValue(name) {
|
|
48
|
+
if (name.type === "Identifier") return name.name;
|
|
49
|
+
if (name.type === "Literal" && typeof name.value === "string") return name.value;
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
function bindingName(pattern) {
|
|
53
|
+
return pattern.type === "Identifier" ? pattern.name : null;
|
|
54
|
+
}
|
|
55
|
+
function declarationHasBindingName(declaration, name) {
|
|
56
|
+
if (declaration === null) return false;
|
|
57
|
+
if (declaration.type === "FunctionDeclaration") return declaration.id?.name === name;
|
|
58
|
+
if (declaration.type !== "VariableDeclaration") return false;
|
|
59
|
+
return declaration.declarations.some((declaration) => bindingName(declaration.id) === name);
|
|
60
|
+
}
|
|
31
61
|
/**
|
|
32
|
-
* Returns true if the source code contains
|
|
62
|
+
* Returns true if the source code contains an export declaration with the given name.
|
|
63
|
+
* For re-export specifiers, this intentionally follows Next.js' static analyzer
|
|
64
|
+
* and checks the local/original binding name.
|
|
33
65
|
* Handles all three common export forms:
|
|
34
66
|
* export function foo() {}
|
|
35
67
|
* export const foo = ...
|
|
36
68
|
* export { foo }
|
|
37
69
|
*/
|
|
38
70
|
function hasNamedExport(code, name) {
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
|
|
71
|
+
const program = parseRouteModule(code);
|
|
72
|
+
if (!program) return false;
|
|
73
|
+
return hasNamedExportInProgram(program, name);
|
|
74
|
+
}
|
|
75
|
+
function hasNamedExportInProgram(program, name) {
|
|
76
|
+
for (const node of program.body) {
|
|
77
|
+
if (node.type !== "ExportNamedDeclaration") continue;
|
|
78
|
+
if (declarationHasBindingName(node.declaration, name)) return true;
|
|
79
|
+
for (const specifier of node.specifiers) if (moduleExportNameValue(specifier.local) === name) return true;
|
|
80
|
+
}
|
|
42
81
|
return false;
|
|
43
82
|
}
|
|
83
|
+
function unwrapStaticExpression(expression) {
|
|
84
|
+
let current = expression;
|
|
85
|
+
while (current.type === "ParenthesizedExpression" || current.type === "TSAsExpression" || current.type === "TSSatisfiesExpression" || current.type === "TSTypeAssertion" || current.type === "TSNonNullExpression") current = current.expression;
|
|
86
|
+
return current;
|
|
87
|
+
}
|
|
88
|
+
function findExportedConstInitializer(code, name) {
|
|
89
|
+
const program = parseRouteModule(code);
|
|
90
|
+
if (!program) return null;
|
|
91
|
+
return findExportedConstInitializerInProgram(program, name);
|
|
92
|
+
}
|
|
93
|
+
function findExportedConstInitializerInProgram(program, name) {
|
|
94
|
+
for (const node of program.body) {
|
|
95
|
+
if (node.type !== "ExportNamedDeclaration") continue;
|
|
96
|
+
const declaration = node.declaration;
|
|
97
|
+
if (declaration?.type !== "VariableDeclaration" || declaration.kind !== "const") continue;
|
|
98
|
+
for (const declarator of declaration.declarations) if (bindingName(declarator.id) === name) return declarator.init;
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
44
102
|
/**
|
|
45
103
|
* Extracts the string value of `export const <name> = "value"`.
|
|
46
|
-
* Handles
|
|
47
|
-
* export const dynamic: string = "force-dynamic"
|
|
104
|
+
* Handles TypeScript annotations/assertions and no-substitution template literals.
|
|
48
105
|
* Returns null if the export is absent or not a string literal.
|
|
49
106
|
*/
|
|
50
107
|
function extractExportConstString(code, name) {
|
|
51
|
-
|
|
52
|
-
|
|
108
|
+
return extractStringFromConstInitializer(findExportedConstInitializer(code, name));
|
|
109
|
+
}
|
|
110
|
+
function extractExportConstStringFromProgram(program, name) {
|
|
111
|
+
return extractStringFromConstInitializer(findExportedConstInitializerInProgram(program, name));
|
|
112
|
+
}
|
|
113
|
+
function extractStringFromConstInitializer(initializer) {
|
|
114
|
+
if (initializer === null) return null;
|
|
115
|
+
const expression = unwrapStaticExpression(initializer);
|
|
116
|
+
if (expression.type === "Literal" && typeof expression.value === "string") return expression.value;
|
|
117
|
+
if (expression.type === "TemplateLiteral" && expression.expressions.length === 0) return expression.quasis[0]?.value.cooked ?? expression.quasis[0]?.value.raw ?? null;
|
|
118
|
+
return null;
|
|
53
119
|
}
|
|
54
120
|
/**
|
|
55
121
|
* Extracts the numeric value of `export const <name> = <number|false>`.
|
|
56
122
|
* Supports integers, decimals, negative values, `Infinity`, and `false`.
|
|
57
123
|
* `false` is returned as `Infinity` because `export const revalidate = false`
|
|
58
124
|
* means "cache indefinitely" in Next.js segment config.
|
|
59
|
-
* Handles
|
|
125
|
+
* Handles TypeScript annotations/assertions and JavaScript numeric separators.
|
|
60
126
|
* Returns null if the export is absent or not a number/`false`.
|
|
61
127
|
*/
|
|
62
128
|
function extractExportConstNumber(code, name) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return
|
|
129
|
+
return extractNumberFromConstInitializer(findExportedConstInitializer(code, name));
|
|
130
|
+
}
|
|
131
|
+
function extractExportConstNumberFromProgram(program, name) {
|
|
132
|
+
return extractNumberFromConstInitializer(findExportedConstInitializerInProgram(program, name));
|
|
133
|
+
}
|
|
134
|
+
function extractNumberFromConstInitializer(initializer) {
|
|
135
|
+
if (initializer === null) return null;
|
|
136
|
+
const value = extractStaticNumberValue(initializer);
|
|
137
|
+
if (value === null) return null;
|
|
138
|
+
return value === false ? Infinity : value;
|
|
67
139
|
}
|
|
68
140
|
/**
|
|
69
141
|
* Extracts the `revalidate` value from inside a `getStaticProps` return object.
|
|
@@ -77,345 +149,118 @@ function extractExportConstNumber(code, name) {
|
|
|
77
149
|
* null — no `revalidate` key found (fully static)
|
|
78
150
|
*/
|
|
79
151
|
function extractGetStaticPropsRevalidate(code) {
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
152
|
+
const program = parseRouteModule(code);
|
|
153
|
+
if (!program) return extractWrappedGetStaticPropsRevalidate(code);
|
|
154
|
+
return extractGetStaticPropsRevalidateFromProgram(program, code);
|
|
155
|
+
}
|
|
156
|
+
function extractGetStaticPropsRevalidateFromProgram(program, fallbackCode) {
|
|
157
|
+
const getStaticProps = findExportedGetStaticProps(program);
|
|
158
|
+
if (getStaticProps === "external") return null;
|
|
159
|
+
if (getStaticProps === null) return extractWrappedGetStaticPropsRevalidate(fallbackCode);
|
|
160
|
+
return extractFunctionRevalidate(getStaticProps);
|
|
161
|
+
}
|
|
162
|
+
function extractStaticNumberValue(expression) {
|
|
163
|
+
const unwrapped = unwrapStaticExpression(expression);
|
|
164
|
+
if (unwrapped.type === "Literal") {
|
|
165
|
+
if (typeof unwrapped.value === "number") return unwrapped.value;
|
|
166
|
+
if (unwrapped.value === false) return false;
|
|
86
167
|
return null;
|
|
87
168
|
}
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
let
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
if (quote) {
|
|
116
|
-
if (char === "\\") {
|
|
117
|
-
i++;
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
if (char === quote) quote = null;
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
if (char === "/" && next === "/") {
|
|
124
|
-
inLineComment = true;
|
|
125
|
-
i++;
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
if (char === "/" && next === "*") {
|
|
129
|
-
inBlockComment = true;
|
|
130
|
-
i++;
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
if (char === "\"" || char === "'" || char === "`") {
|
|
134
|
-
quote = char;
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
if (char === "{") {
|
|
138
|
-
braceDepth++;
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
if (char === "}") {
|
|
142
|
-
braceDepth--;
|
|
143
|
-
continue;
|
|
144
|
-
}
|
|
145
|
-
if (char === "(") {
|
|
146
|
-
parenDepth++;
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
if (char === ")") {
|
|
150
|
-
parenDepth--;
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
if (char === "[") {
|
|
154
|
-
bracketDepth++;
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
if (char === "]") {
|
|
158
|
-
bracketDepth--;
|
|
159
|
-
continue;
|
|
169
|
+
if (unwrapped.type === "Identifier" && unwrapped.name === "Infinity") return Infinity;
|
|
170
|
+
if (unwrapped.type === "UnaryExpression") {
|
|
171
|
+
const argument = extractStaticNumberValue(unwrapped.argument);
|
|
172
|
+
if (typeof argument !== "number") return null;
|
|
173
|
+
if (unwrapped.operator === "-") return -argument;
|
|
174
|
+
if (unwrapped.operator === "+") return argument;
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
function findExportedGetStaticProps(program) {
|
|
180
|
+
let hasLocalGetStaticPropsExport = false;
|
|
181
|
+
for (const node of program.body) {
|
|
182
|
+
if (node.type !== "ExportNamedDeclaration") continue;
|
|
183
|
+
const declaration = node.declaration;
|
|
184
|
+
if (declaration?.type === "FunctionDeclaration" && declaration.id?.name === "getStaticProps") return declaration;
|
|
185
|
+
if (declaration?.type === "VariableDeclaration") {
|
|
186
|
+
const direct = findFunctionLikeVariable(declaration.declarations, "getStaticProps");
|
|
187
|
+
if (direct) return direct;
|
|
188
|
+
}
|
|
189
|
+
for (const specifier of node.specifiers) {
|
|
190
|
+
if (moduleExportNameValue(specifier.local) !== "getStaticProps") continue;
|
|
191
|
+
if (node.source !== null) return "external";
|
|
192
|
+
hasLocalGetStaticPropsExport = true;
|
|
160
193
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
168
|
-
if (valueMatch[1] === "false") return false;
|
|
169
|
-
if (valueMatch[1] === "Infinity") return Infinity;
|
|
170
|
-
return parseFloat(valueMatch[1]);
|
|
194
|
+
}
|
|
195
|
+
if (!hasLocalGetStaticPropsExport) return null;
|
|
196
|
+
for (const node of program.body) {
|
|
197
|
+
if (node.type === "FunctionDeclaration" && node.id?.name === "getStaticProps") return node;
|
|
198
|
+
if (node.type === "VariableDeclaration") {
|
|
199
|
+
const local = findFunctionLikeVariable(node.declarations, "getStaticProps");
|
|
200
|
+
if (local) return local;
|
|
171
201
|
}
|
|
172
202
|
}
|
|
173
203
|
return null;
|
|
174
204
|
}
|
|
175
|
-
function
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return
|
|
205
|
+
function findFunctionLikeVariable(declarations, name) {
|
|
206
|
+
for (const declaration of declarations) {
|
|
207
|
+
if (bindingName(declaration.id) !== name || declaration.init === null) continue;
|
|
208
|
+
const initializer = unwrapStaticExpression(declaration.init);
|
|
209
|
+
if (initializer.type === "FunctionExpression" || initializer.type === "ArrowFunctionExpression") return initializer;
|
|
180
210
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
function extractGetStaticPropsDeclaration(code, declarationMatch) {
|
|
194
|
-
const declarationStart = declarationMatch.index;
|
|
195
|
-
const declarationText = declarationMatch[0];
|
|
196
|
-
const declarationTail = code.slice(declarationStart);
|
|
197
|
-
if (declarationText.includes("function getStaticProps")) return extractFunctionBody(code, declarationStart + declarationText.length);
|
|
198
|
-
const functionExpressionMatch = /(?:async\s+)?function\b/.exec(declarationTail);
|
|
199
|
-
if (functionExpressionMatch) return extractFunctionBody(declarationTail, functionExpressionMatch.index);
|
|
200
|
-
const blockBodyMatch = /=>\s*\{/.exec(declarationTail);
|
|
201
|
-
if (blockBodyMatch) {
|
|
202
|
-
const braceStart = declarationTail.indexOf("{", blockBodyMatch.index);
|
|
203
|
-
if (braceStart === -1) return null;
|
|
204
|
-
const braceEnd = findMatchingBrace(declarationTail, braceStart);
|
|
205
|
-
if (braceEnd === -1) return null;
|
|
206
|
-
return declarationTail.slice(braceStart, braceEnd + 1);
|
|
207
|
-
}
|
|
208
|
-
const implicitArrowMatch = declarationTail.search(/=>\s*\(\s*\{/);
|
|
209
|
-
if (implicitArrowMatch === -1) return null;
|
|
210
|
-
const implicitBraceStart = declarationTail.indexOf("{", implicitArrowMatch);
|
|
211
|
-
if (implicitBraceStart === -1) return null;
|
|
212
|
-
const implicitBraceEnd = findMatchingBrace(declarationTail, implicitBraceStart);
|
|
213
|
-
if (implicitBraceEnd === -1) return null;
|
|
214
|
-
return declarationTail.slice(0, implicitBraceEnd + 1);
|
|
215
|
-
}
|
|
216
|
-
function extractFunctionBody(code, functionStart) {
|
|
217
|
-
const bodyEnd = findFunctionBodyEnd(code, functionStart);
|
|
218
|
-
if (bodyEnd === -1) return null;
|
|
219
|
-
const paramsStart = code.indexOf("(", functionStart);
|
|
220
|
-
if (paramsStart === -1) return null;
|
|
221
|
-
const paramsEnd = findMatchingParen(code, paramsStart);
|
|
222
|
-
if (paramsEnd === -1) return null;
|
|
223
|
-
const bodyStart = code.indexOf("{", paramsEnd + 1);
|
|
224
|
-
if (bodyStart === -1) return null;
|
|
225
|
-
return code.slice(bodyStart, bodyEnd + 1);
|
|
226
|
-
}
|
|
227
|
-
function collectReturnObjectsFromFunctionBody(code) {
|
|
228
|
-
const returnObjects = [];
|
|
229
|
-
let quote = null;
|
|
230
|
-
let inLineComment = false;
|
|
231
|
-
let inBlockComment = false;
|
|
232
|
-
for (let i = 0; i < code.length; i++) {
|
|
233
|
-
const char = code[i];
|
|
234
|
-
const next = code[i + 1];
|
|
235
|
-
if (inLineComment) {
|
|
236
|
-
if (char === "\n") inLineComment = false;
|
|
237
|
-
continue;
|
|
238
|
-
}
|
|
239
|
-
if (inBlockComment) {
|
|
240
|
-
if (char === "*" && next === "/") {
|
|
241
|
-
inBlockComment = false;
|
|
242
|
-
i++;
|
|
243
|
-
}
|
|
244
|
-
continue;
|
|
245
|
-
}
|
|
246
|
-
if (quote) {
|
|
247
|
-
if (char === "\\") {
|
|
248
|
-
i++;
|
|
249
|
-
continue;
|
|
250
|
-
}
|
|
251
|
-
if (char === quote) quote = null;
|
|
252
|
-
continue;
|
|
253
|
-
}
|
|
254
|
-
if (char === "/" && next === "/") {
|
|
255
|
-
inLineComment = true;
|
|
256
|
-
i++;
|
|
257
|
-
continue;
|
|
258
|
-
}
|
|
259
|
-
if (char === "/" && next === "*") {
|
|
260
|
-
inBlockComment = true;
|
|
261
|
-
i++;
|
|
262
|
-
continue;
|
|
263
|
-
}
|
|
264
|
-
if (char === "\"" || char === "'" || char === "`") {
|
|
265
|
-
quote = char;
|
|
266
|
-
continue;
|
|
267
|
-
}
|
|
268
|
-
if (matchesKeywordAt(code, i, "function")) {
|
|
269
|
-
const nestedBodyEnd = findFunctionBodyEnd(code, i);
|
|
270
|
-
if (nestedBodyEnd !== -1) i = nestedBodyEnd;
|
|
271
|
-
continue;
|
|
272
|
-
}
|
|
273
|
-
if (matchesKeywordAt(code, i, "class")) {
|
|
274
|
-
const classBodyEnd = findClassBodyEnd(code, i);
|
|
275
|
-
if (classBodyEnd !== -1) i = classBodyEnd;
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
if (char === "=" && next === ">") {
|
|
279
|
-
const nestedBodyEnd = findArrowFunctionBodyEnd(code, i);
|
|
280
|
-
if (nestedBodyEnd !== -1) i = nestedBodyEnd;
|
|
281
|
-
continue;
|
|
282
|
-
}
|
|
283
|
-
if (char >= "A" && char <= "Z" || char >= "a" && char <= "z" || char === "_" || char === "$" || char === "*") {
|
|
284
|
-
const methodBodyEnd = findObjectMethodBodyEnd(code, i);
|
|
285
|
-
if (methodBodyEnd !== -1) {
|
|
286
|
-
i = methodBodyEnd;
|
|
287
|
-
continue;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
if (matchesKeywordAt(code, i, "return")) {
|
|
291
|
-
const braceStart = findNextNonWhitespaceIndex(code, i + 6);
|
|
292
|
-
if (braceStart === -1 || code[braceStart] !== "{") continue;
|
|
293
|
-
const braceEnd = findMatchingBrace(code, braceStart);
|
|
294
|
-
if (braceEnd === -1) continue;
|
|
295
|
-
returnObjects.push(code.slice(braceStart, braceEnd + 1));
|
|
296
|
-
i = braceEnd;
|
|
297
|
-
}
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
function extractWrappedGetStaticPropsRevalidate(code) {
|
|
214
|
+
const program = parseRouteModule(`function __vinextGetStaticProps() {\n${code}\n}`);
|
|
215
|
+
if (!program) return null;
|
|
216
|
+
for (const node of program.body) if (node.type === "FunctionDeclaration" && node.id?.name === "__vinextGetStaticProps") return extractFunctionRevalidate(node);
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
function extractFunctionRevalidate(fn) {
|
|
220
|
+
if (fn.type === "ArrowFunctionExpression" && fn.body.type !== "BlockStatement") {
|
|
221
|
+
const expression = unwrapStaticExpression(fn.body);
|
|
222
|
+
return expression.type === "ObjectExpression" ? extractObjectRevalidate(expression) : null;
|
|
298
223
|
}
|
|
299
|
-
return
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
const bodyStart = code.indexOf("{", paramsEnd + 1);
|
|
307
|
-
if (bodyStart === -1) return -1;
|
|
308
|
-
return findMatchingBrace(code, bodyStart);
|
|
309
|
-
}
|
|
310
|
-
function findClassBodyEnd(code, classStart) {
|
|
311
|
-
const bodyStart = code.indexOf("{", classStart + 5);
|
|
312
|
-
if (bodyStart === -1) return -1;
|
|
313
|
-
return findMatchingBrace(code, bodyStart);
|
|
314
|
-
}
|
|
315
|
-
function findArrowFunctionBodyEnd(code, arrowIndex) {
|
|
316
|
-
const bodyStart = findNextNonWhitespaceIndex(code, arrowIndex + 2);
|
|
317
|
-
if (bodyStart === -1 || code[bodyStart] !== "{") return -1;
|
|
318
|
-
return findMatchingBrace(code, bodyStart);
|
|
319
|
-
}
|
|
320
|
-
function findObjectMethodBodyEnd(code, start) {
|
|
321
|
-
let i = start;
|
|
322
|
-
if (matchesKeywordAt(code, i, "async")) {
|
|
323
|
-
const afterAsync = findNextNonWhitespaceIndex(code, i + 5);
|
|
324
|
-
if (afterAsync === -1) return -1;
|
|
325
|
-
if (code[afterAsync] !== "(") i = afterAsync;
|
|
224
|
+
if (!fn.body || fn.body.type !== "BlockStatement") return null;
|
|
225
|
+
return extractBlockRevalidate(fn.body);
|
|
226
|
+
}
|
|
227
|
+
function extractBlockRevalidate(block) {
|
|
228
|
+
for (const statement of block.body) {
|
|
229
|
+
const result = extractStatementRevalidate(statement);
|
|
230
|
+
if (result !== null) return result;
|
|
326
231
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
function extractStatementRevalidate(statement) {
|
|
235
|
+
if (statement.type === "ReturnStatement") {
|
|
236
|
+
if (!statement.argument) return null;
|
|
237
|
+
const argument = unwrapStaticExpression(statement.argument);
|
|
238
|
+
return argument.type === "ObjectExpression" ? extractObjectRevalidate(argument) : null;
|
|
330
239
|
}
|
|
331
|
-
if (
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
if (afterAccessor === -1) return -1;
|
|
339
|
-
if (code[afterAccessor] !== "(") {
|
|
340
|
-
i = afterAccessor;
|
|
341
|
-
if (!/[A-Za-z_$]/.test(code[i] ?? "")) return -1;
|
|
342
|
-
while (/[A-Za-z0-9_$]/.test(code[i] ?? "")) i++;
|
|
240
|
+
if (statement.type === "BlockStatement") return extractBlockRevalidate(statement);
|
|
241
|
+
if (statement.type === "IfStatement") return extractStatementRevalidate(statement.consequent) ?? (statement.alternate ? extractStatementRevalidate(statement.alternate) : null);
|
|
242
|
+
if (statement.type === "ForStatement" || statement.type === "ForInStatement" || statement.type === "ForOfStatement" || statement.type === "WhileStatement" || statement.type === "DoWhileStatement" || statement.type === "WithStatement" || statement.type === "LabeledStatement") return extractStatementRevalidate(statement.body);
|
|
243
|
+
if (statement.type === "SwitchStatement") {
|
|
244
|
+
for (const switchCase of statement.cases) for (const consequent of switchCase.consequent) {
|
|
245
|
+
const result = extractStatementRevalidate(consequent);
|
|
246
|
+
if (result !== null) return result;
|
|
343
247
|
}
|
|
248
|
+
return null;
|
|
344
249
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
function findNextNonWhitespaceIndex(code, start) {
|
|
354
|
-
for (let i = start; i < code.length; i++) if (!/\s/.test(code[i])) return i;
|
|
355
|
-
return -1;
|
|
356
|
-
}
|
|
357
|
-
function matchesKeywordAt(code, index, keyword) {
|
|
358
|
-
const before = index === 0 ? "" : code[index - 1];
|
|
359
|
-
const after = code[index + keyword.length] ?? "";
|
|
360
|
-
return code.startsWith(keyword, index) && (before === "" || !/[A-Za-z0-9_$]/.test(before)) && (after === "" || !/[A-Za-z0-9_$]/.test(after));
|
|
361
|
-
}
|
|
362
|
-
function findMatchingBrace(code, start) {
|
|
363
|
-
return findMatchingToken(code, start, "{", "}");
|
|
364
|
-
}
|
|
365
|
-
function findMatchingParen(code, start) {
|
|
366
|
-
return findMatchingToken(code, start, "(", ")");
|
|
367
|
-
}
|
|
368
|
-
function findMatchingToken(code, start, openToken, closeToken) {
|
|
369
|
-
let depth = 0;
|
|
370
|
-
let quote = null;
|
|
371
|
-
let inLineComment = false;
|
|
372
|
-
let inBlockComment = false;
|
|
373
|
-
for (let i = start; i < code.length; i++) {
|
|
374
|
-
const char = code[i];
|
|
375
|
-
const next = code[i + 1];
|
|
376
|
-
if (inLineComment) {
|
|
377
|
-
if (char === "\n") inLineComment = false;
|
|
378
|
-
continue;
|
|
379
|
-
}
|
|
380
|
-
if (inBlockComment) {
|
|
381
|
-
if (char === "*" && next === "/") {
|
|
382
|
-
inBlockComment = false;
|
|
383
|
-
i++;
|
|
384
|
-
}
|
|
385
|
-
continue;
|
|
386
|
-
}
|
|
387
|
-
if (quote) {
|
|
388
|
-
if (char === "\\") {
|
|
389
|
-
i++;
|
|
390
|
-
continue;
|
|
391
|
-
}
|
|
392
|
-
if (char === quote) quote = null;
|
|
393
|
-
continue;
|
|
394
|
-
}
|
|
395
|
-
if (char === "/" && next === "/") {
|
|
396
|
-
inLineComment = true;
|
|
397
|
-
i++;
|
|
398
|
-
continue;
|
|
399
|
-
}
|
|
400
|
-
if (char === "/" && next === "*") {
|
|
401
|
-
inBlockComment = true;
|
|
402
|
-
i++;
|
|
403
|
-
continue;
|
|
404
|
-
}
|
|
405
|
-
if (char === "\"" || char === "'" || char === "`") {
|
|
406
|
-
quote = char;
|
|
407
|
-
continue;
|
|
408
|
-
}
|
|
409
|
-
if (char === openToken) {
|
|
410
|
-
depth++;
|
|
411
|
-
continue;
|
|
412
|
-
}
|
|
413
|
-
if (char === closeToken) {
|
|
414
|
-
depth--;
|
|
415
|
-
if (depth === 0) return i;
|
|
416
|
-
}
|
|
250
|
+
if (statement.type === "TryStatement") return extractBlockRevalidate(statement.block) ?? (statement.handler ? extractBlockRevalidate(statement.handler.body) : null) ?? (statement.finalizer ? extractBlockRevalidate(statement.finalizer) : null);
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
function extractObjectRevalidate(object) {
|
|
254
|
+
for (const property of object.properties) {
|
|
255
|
+
if (property.type !== "Property" || property.computed || propertyName(property.key) !== "revalidate") continue;
|
|
256
|
+
return extractStaticNumberValue(property.value);
|
|
417
257
|
}
|
|
418
|
-
return
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
function propertyName(key) {
|
|
261
|
+
if (key.type === "Identifier") return key.name;
|
|
262
|
+
if (key.type === "Literal" && typeof key.value === "string") return key.value;
|
|
263
|
+
return null;
|
|
419
264
|
}
|
|
420
265
|
/**
|
|
421
266
|
* Classifies a layout file by its segment config exports (`dynamic`, `revalidate`).
|
|
@@ -430,7 +275,8 @@ function findMatchingToken(code, start, openToken, closeToken) {
|
|
|
430
275
|
* (`revalidate = 0` → dynamic, `revalidate = Infinity` → static) are decisive.
|
|
431
276
|
*/
|
|
432
277
|
function classifyLayoutSegmentConfig(code) {
|
|
433
|
-
const
|
|
278
|
+
const program = parseRouteModule(code);
|
|
279
|
+
const dynamicValue = program ? extractExportConstStringFromProgram(program, "dynamic") : null;
|
|
434
280
|
if (dynamicValue === "force-dynamic") return {
|
|
435
281
|
kind: "dynamic",
|
|
436
282
|
reason: {
|
|
@@ -447,7 +293,7 @@ function classifyLayoutSegmentConfig(code) {
|
|
|
447
293
|
value: dynamicValue
|
|
448
294
|
}
|
|
449
295
|
};
|
|
450
|
-
const revalidateValue =
|
|
296
|
+
const revalidateValue = program ? extractExportConstNumberFromProgram(program, "revalidate") : null;
|
|
451
297
|
if (revalidateValue === Infinity) return {
|
|
452
298
|
kind: "static",
|
|
453
299
|
reason: {
|
|
@@ -480,9 +326,10 @@ function classifyPagesRoute(filePath) {
|
|
|
480
326
|
} catch {
|
|
481
327
|
return { type: "unknown" };
|
|
482
328
|
}
|
|
483
|
-
|
|
484
|
-
if (
|
|
485
|
-
|
|
329
|
+
const program = parseRouteModule(code);
|
|
330
|
+
if (program && hasNamedExportInProgram(program, "getServerSideProps")) return { type: "ssr" };
|
|
331
|
+
if (program && hasNamedExportInProgram(program, "getStaticProps")) {
|
|
332
|
+
const revalidate = extractGetStaticPropsRevalidateFromProgram(program, code);
|
|
486
333
|
if (revalidate === null || revalidate === false || revalidate === Infinity) return { type: "static" };
|
|
487
334
|
if (revalidate === 0) return { type: "ssr" };
|
|
488
335
|
return {
|
|
@@ -509,10 +356,11 @@ function classifyAppRoute(pagePath, routePath, isDynamic) {
|
|
|
509
356
|
} catch {
|
|
510
357
|
return { type: "unknown" };
|
|
511
358
|
}
|
|
512
|
-
const
|
|
359
|
+
const program = parseRouteModule(code);
|
|
360
|
+
const dynamicValue = program ? extractExportConstStringFromProgram(program, "dynamic") : null;
|
|
513
361
|
if (dynamicValue === "force-dynamic") return { type: "ssr" };
|
|
514
362
|
if (dynamicValue === "force-static" || dynamicValue === "error") return { type: "static" };
|
|
515
|
-
const revalidateValue =
|
|
363
|
+
const revalidateValue = program ? extractExportConstNumberFromProgram(program, "revalidate") : null;
|
|
516
364
|
if (revalidateValue !== null) {
|
|
517
365
|
if (revalidateValue === Infinity) return { type: "static" };
|
|
518
366
|
if (revalidateValue === 0) return { type: "ssr" };
|