vinext 1.3.1 → 1.4.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 +25 -22
- package/THIRD_PARTY_LICENSES.md +47 -0
- package/dist/_virtual/_rolldown/runtime.js +3 -2
- package/dist/build/prerender.js +4 -3
- package/dist/build/report.d.ts +0 -14
- package/dist/build/report.js +1 -51
- package/dist/check.js +4 -7
- package/dist/cli.js +3 -0
- package/dist/client/dev-error-overlay-store.d.ts +1 -0
- package/dist/client/dev-error-overlay.d.ts +2 -0
- package/dist/client/dev-error-overlay.js +20 -4
- package/dist/client/navigation-runtime.d.ts +13 -1
- package/dist/client/navigation-runtime.js +1 -1
- package/dist/config/config-matchers.js +2 -0
- package/dist/config/destination-params.d.ts +2 -1
- package/dist/config/destination-params.js +52 -2
- package/dist/config/next-config.d.ts +25 -0
- package/dist/config/next-config.js +82 -4
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-codec.js +327 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-data.js +123 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/index.js +29 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/internal.js +134 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-codec.js +50 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data-generated.js +455 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data.js +147 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/big5-added.json.js +169 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp936.json.js +2584 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp949.json.js +2220 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp950.json.js +227 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/eucjp.json.js +425 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gb18030-ranges.json.js +427 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gbk-added.json.js +229 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/shiftjis.json.js +292 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf16.js +106 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf7.js +182 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/bom-handling.js +42 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/extend-node.js +147 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/index.js +94 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/streams.js +95 -0
- package/dist/deps/.pnpm/safer-buffer@2.1.2/deps/safer-buffer/safer.js +45 -0
- package/dist/entries/app-rsc-entry.js +17 -49
- package/dist/entries/app-rsc-manifest.js +3 -4
- package/dist/entries/app-ssr-entry.js +1 -0
- package/dist/entries/pages-server-entry.js +36 -9
- package/dist/index.js +112 -90
- package/dist/init-cloudflare.d.ts +1 -3
- package/dist/init-cloudflare.js +10 -48
- package/dist/init-platform.d.ts +2 -0
- package/dist/init-platform.js +4 -0
- package/dist/plugins/extensionless-dynamic-import.js +6 -2
- package/dist/plugins/next-intl-catalog.d.ts +12 -0
- package/dist/plugins/next-intl-catalog.js +85 -0
- package/dist/plugins/pages-node-externals.d.ts +1 -0
- package/dist/plugins/pages-node-externals.js +1 -1
- package/dist/plugins/strip-server-exports.js +2 -1
- package/dist/plugins/use-cache-callable.d.ts +1 -1
- package/dist/plugins/use-cache-callable.js +136 -94
- package/dist/routing/app-route-graph.d.ts +6 -0
- package/dist/routing/app-route-graph.js +9 -1
- package/dist/server/api-handler.js +21 -5
- package/dist/server/app-bfcache-identity.js +1 -1
- package/dist/server/app-browser-entry.js +86 -66
- package/dist/server/app-browser-history-controller.d.ts +5 -4
- package/dist/server/app-browser-history-controller.js +93 -15
- package/dist/server/app-browser-navigation-controller.d.ts +2 -2
- package/dist/server/app-browser-navigation-controller.js +1 -2
- package/dist/server/app-browser-rsc-redirect.js +7 -7
- package/dist/server/app-browser-server-action-client.d.ts +2 -0
- package/dist/server/app-browser-server-action-client.js +5 -4
- package/dist/server/app-browser-state.d.ts +2 -4
- package/dist/server/app-browser-state.js +9 -4
- package/dist/server/app-browser-supplemental-refresh.js +16 -1
- package/dist/server/app-browser-visible-commit.d.ts +1 -1
- package/dist/server/app-browser-visible-commit.js +4 -14
- package/dist/server/app-elements-wire.d.ts +6 -38
- package/dist/server/app-elements-wire.js +4 -41
- package/dist/server/app-elements.d.ts +2 -2
- package/dist/server/app-elements.js +2 -2
- package/dist/server/app-history-state.d.ts +2 -2
- package/dist/server/app-history-state.js +5 -2
- package/dist/server/app-mounted-layouts.d.ts +21 -0
- package/dist/server/app-mounted-layouts.js +67 -0
- package/dist/server/app-optimistic-routing.d.ts +19 -1
- package/dist/server/app-optimistic-routing.js +43 -4
- package/dist/server/app-page-boundary-render.js +10 -14
- package/dist/server/app-page-boundary.js +2 -2
- package/dist/server/app-page-cache-finalizer.d.ts +12 -1
- package/dist/server/app-page-cache-finalizer.js +70 -29
- package/dist/server/app-page-cache.d.ts +13 -1
- package/dist/server/app-page-cache.js +31 -9
- package/dist/server/app-page-dispatch.d.ts +5 -11
- package/dist/server/app-page-dispatch.js +84 -155
- package/dist/server/app-page-element-builder.d.ts +2 -2
- package/dist/server/app-page-element-builder.js +13 -12
- package/dist/server/app-page-execution.d.ts +17 -52
- package/dist/server/app-page-execution.js +102 -95
- package/dist/server/app-page-head.d.ts +13 -0
- package/dist/server/app-page-head.js +44 -16
- package/dist/server/app-page-http-access-fallback-metadata.d.ts +1 -0
- package/dist/server/app-page-http-access-fallback-metadata.js +2 -2
- package/dist/server/app-page-layout-gate.d.ts +35 -0
- package/dist/server/app-page-layout-gate.js +50 -0
- package/dist/server/app-page-params.d.ts +0 -1
- package/dist/server/app-page-params.js +1 -14
- package/dist/server/app-page-probe.d.ts +3 -21
- package/dist/server/app-page-probe.js +4 -37
- package/dist/server/app-page-render.d.ts +2 -13
- package/dist/server/app-page-render.js +103 -234
- package/dist/server/app-page-request.d.ts +1 -3
- package/dist/server/app-page-request.js +1 -1
- package/dist/server/app-page-response.js +3 -3
- package/dist/server/app-page-route-wiring.d.ts +13 -6
- package/dist/server/app-page-route-wiring.js +86 -63
- package/dist/server/app-page-rsc-render-status.d.ts +27 -1
- package/dist/server/app-page-rsc-render-status.js +121 -13
- package/dist/server/app-page-stream.d.ts +12 -8
- package/dist/server/app-page-stream.js +4 -3
- package/dist/server/app-pages-bridge.d.ts +4 -0
- package/dist/server/app-pages-bridge.js +7 -3
- package/dist/server/app-render-dependency.d.ts +11 -4
- package/dist/server/app-render-dependency.js +86 -38
- package/dist/server/app-request-stage-dispatch.js +1 -1
- package/dist/server/app-request-stage-independent-entry.js +1 -1
- package/dist/server/app-route-handler-cache.js +2 -2
- package/dist/server/app-route-handler-dispatch.js +14 -9
- package/dist/server/app-route-handler-execution.js +11 -5
- package/dist/server/app-route-handler-policy.d.ts +1 -1
- package/dist/server/app-route-handler-policy.js +3 -3
- package/dist/server/app-route-handler-response.js +1 -1
- package/dist/server/app-route-handler-runtime.d.ts +1 -1
- package/dist/server/app-route-handler-runtime.js +28 -11
- package/dist/server/app-router-entry.js +1 -1
- package/dist/server/app-rsc-cache-busting.d.ts +12 -12
- package/dist/server/app-rsc-cache-busting.js +31 -72
- package/dist/server/app-rsc-error-handler.d.ts +2 -1
- package/dist/server/app-rsc-error-handler.js +10 -2
- package/dist/server/app-rsc-errors.d.ts +8 -0
- package/dist/server/app-rsc-errors.js +11 -1
- package/dist/server/app-rsc-handler.d.ts +5 -5
- package/dist/server/app-rsc-handler.js +80 -83
- package/dist/server/app-rsc-request-normalization.d.ts +10 -16
- package/dist/server/app-rsc-request-normalization.js +12 -18
- package/dist/server/app-rsc-response-finalizer.js +2 -2
- package/dist/server/app-rsc-response-stage.js +9 -15
- package/dist/server/app-server-action-execution.d.ts +3 -1
- package/dist/server/app-server-action-execution.js +15 -8
- package/dist/server/app-ssr-entry.d.ts +8 -0
- package/dist/server/app-ssr-entry.js +22 -16
- package/dist/server/app-ssr-stream.js +1 -1
- package/dist/server/app-visited-response-cache.d.ts +36 -1
- package/dist/server/app-visited-response-cache.js +46 -5
- package/dist/server/app-worker-stages.d.ts +37 -6
- package/dist/server/app-worker-stages.js +81 -9
- package/dist/server/artifact-compatibility.d.ts +0 -1
- package/dist/server/artifact-compatibility.js +1 -10
- package/dist/server/bfcache-identity.d.ts +7 -0
- package/dist/server/bfcache-identity.js +10 -1
- package/dist/server/cache-proof.d.ts +1 -115
- package/dist/server/cache-proof.js +1 -544
- package/dist/server/cacheability-manifest.js +1 -2
- package/dist/server/cacheability-request.js +13 -8
- package/dist/server/dev-origin-check.d.ts +2 -1
- package/dist/server/dev-origin-check.js +2 -1
- package/dist/server/dev-server.js +6 -4
- package/dist/server/headers.d.ts +6 -3
- package/dist/server/headers.js +9 -5
- package/dist/server/image-optimization.d.ts +5 -0
- package/dist/server/image-optimization.js +6 -1
- package/dist/server/isr-cache.d.ts +8 -2
- package/dist/server/isr-cache.js +30 -2
- package/dist/server/metadata-route-response.js +32 -15
- package/dist/server/middleware-matcher.js +19 -6
- package/dist/server/middleware-runtime.js +6 -2
- package/dist/server/multi-stage.d.ts +57 -12
- package/dist/server/multi-stage.js +13 -1
- package/dist/server/navigation-planner.js +1 -1
- package/dist/server/pages-api-route.js +28 -19
- package/dist/server/pages-media-type.d.ts +21 -1
- package/dist/server/pages-media-type.js +69 -5
- package/dist/server/pages-node-compat.d.ts +1 -1
- package/dist/server/pages-node-compat.js +54 -27
- package/dist/server/pages-page-data.js +2 -1
- package/dist/server/pages-page-handler.js +28 -26
- package/dist/server/pages-page-response.d.ts +9 -0
- package/dist/server/pages-page-response.js +18 -4
- package/dist/server/pages-request-pipeline.d.ts +8 -0
- package/dist/server/pages-request-pipeline.js +2 -2
- package/dist/server/pages-request-stage-entry.js +36 -14
- package/dist/server/pages-response-stage-entry.js +9 -3
- package/dist/server/pages-router-entry.js +3 -2
- package/dist/server/prod-server.d.ts +2 -2
- package/dist/server/prod-server.js +47 -9
- package/dist/server/request-error-log.d.ts +9 -0
- package/dist/server/request-error-log.js +13 -0
- package/dist/server/request-pipeline.d.ts +15 -4
- package/dist/server/request-pipeline.js +43 -15
- package/dist/server/rsc-completion-metadata.js +3 -0
- package/dist/server/shared-cache-identity.d.ts +23 -0
- package/dist/server/shared-cache-identity.js +36 -0
- package/dist/server/static-file-cache.d.ts +9 -0
- package/dist/server/static-file-cache.js +13 -2
- package/dist/server/worker-stages.d.ts +16 -3
- package/dist/server/worker-stages.js +23 -4
- package/dist/shims/cache-handler.js +2 -2
- package/dist/shims/cache-request-state.d.ts +23 -26
- package/dist/shims/cache-request-state.js +22 -57
- package/dist/shims/cache-runtime.d.ts +3 -1
- package/dist/shims/cache-runtime.js +94 -48
- package/dist/shims/cache.d.ts +16 -10
- package/dist/shims/cache.js +47 -36
- package/dist/shims/cacheability-classification.d.ts +2 -0
- package/dist/shims/cdn-cache.d.ts +22 -5
- package/dist/shims/client-hook-error.d.ts +2 -0
- package/dist/shims/client-hook-error.js +16 -1
- package/dist/shims/client-page-root.js +2 -2
- package/dist/shims/dynamic.js +9 -6
- package/dist/shims/error-boundary.js +2 -2
- package/dist/shims/fetch-cache-state.d.ts +5 -1
- package/dist/shims/fetch-cache-state.js +1 -3
- package/dist/shims/fetch-cache.d.ts +2 -1
- package/dist/shims/fetch-cache.js +39 -25
- package/dist/shims/form.js +2 -2
- package/dist/shims/headers.d.ts +10 -24
- package/dist/shims/headers.js +22 -70
- package/dist/shims/internal/cache-context-accessor.d.ts +1 -1
- package/dist/shims/internal/navigation-untracked.js +1 -1
- package/dist/shims/link.js +8 -11
- package/dist/shims/metadata.d.ts +23 -21
- package/dist/shims/metadata.js +62 -24
- package/dist/shims/navigation-server.js +1 -1
- package/dist/shims/navigation.d.ts +74 -7
- package/dist/shims/navigation.js +184 -31
- package/dist/shims/navigation.react-server.js +2 -2
- package/dist/shims/request-state-types.d.ts +3 -2
- package/dist/shims/slot.d.ts +16 -0
- package/dist/shims/slot.js +44 -9
- package/dist/shims/unified-request-context.d.ts +7 -1
- package/dist/shims/unified-request-context.js +3 -3
- package/dist/utils/cache-control-metadata.d.ts +5 -0
- package/dist/utils/cache-control-metadata.js +9 -1
- package/dist/utils/cache-life-profiles.d.ts +33 -0
- package/dist/utils/cache-life-profiles.js +111 -0
- package/dist/utils/middleware-request-headers.d.ts +14 -3
- package/dist/utils/middleware-request-headers.js +54 -7
- package/dist/utils/project.d.ts +2 -2
- package/dist/utils/project.js +3 -16
- package/dist/utils/regex.d.ts +5 -0
- package/dist/utils/regex.js +11 -1
- package/dist/utils/text-stream.d.ts +10 -5
- package/dist/utils/text-stream.js +6 -6
- package/package.json +2 -1
- package/dist/build/layout-classification-types.d.ts +0 -60
- package/dist/build/layout-classification-types.js +0 -1
- package/dist/build/layout-classification.d.ts +0 -62
- package/dist/build/layout-classification.js +0 -98
- package/dist/build/route-classification-injector.d.ts +0 -33
- package/dist/build/route-classification-injector.js +0 -59
- package/dist/build/route-classification-manifest.d.ts +0 -54
- package/dist/build/route-classification-manifest.js +0 -143
- package/dist/server/app-browser-client-reuse-manifest.d.ts +0 -11
- package/dist/server/app-browser-client-reuse-manifest.js +0 -101
- package/dist/server/app-layout-param-observation.d.ts +0 -42
- package/dist/server/app-layout-param-observation.js +0 -168
- package/dist/server/client-reuse-manifest.d.ts +0 -103
- package/dist/server/client-reuse-manifest.js +0 -209
- package/dist/server/skip-cache-proof.d.ts +0 -60
- package/dist/server/skip-cache-proof.js +0 -168
- package/dist/server/static-layout-client-reuse-proof.d.ts +0 -14
- package/dist/server/static-layout-client-reuse-proof.js +0 -33
- package/dist/utils/sorted-array.d.ts +0 -8
- package/dist/utils/sorted-array.js +0 -20
package/README.md
CHANGED
|
@@ -137,7 +137,7 @@ files to `.cjs`) when an unambiguous default Vite config requires the ESM migrat
|
|
|
137
137
|
`"type": "commonjs"` is never changed. Direct `vite dev` and `vite build` do not perform these
|
|
138
138
|
wrapper compatibility steps.
|
|
139
139
|
|
|
140
|
-
`@vinext/cloudflare deploy` options: `--preview`, `--env <name>`, `--name <name>`, `--skip-build`, `--dry-run`, `--warm-cache`, `--traffic-aware-warm-cache`.
|
|
140
|
+
`@vinext/cloudflare deploy` options: `--preview`, `--env <name>`, `--name <name>`, `--vite-config <path>`, `--skip-build`, `--dry-run`, `--warm-cache`, `--traffic-aware-warm-cache`.
|
|
141
141
|
|
|
142
142
|
`vinext init` prompts for a deployment target, defaulting to Cloudflare. Agents must ask the
|
|
143
143
|
user which target they want, then pass `--platform=cloudflare` or `--platform=node`.
|
|
@@ -147,6 +147,8 @@ Other options: `--port <port>` (default: 3001), `--skip-check`, `--force`.
|
|
|
147
147
|
Cloudflare init uses `cf` and `cloudflare.config.ts` by default. Both `vinext init`
|
|
148
148
|
and `create-vinext-app` accept `--legacy-wrangler-cloudflare-init` to retain the
|
|
149
149
|
legacy Wrangler setup. Existing Wrangler configs are not automatically migrated.
|
|
150
|
+
If a root Wrangler config belongs to another Worker, `vinext init --ignore-wrangler-config`
|
|
151
|
+
sets up `cloudflare.config.ts` and leaves that file untouched.
|
|
150
152
|
`vinext init --name <name>` sets the Worker name in the generated config instead of
|
|
151
153
|
deriving it from `package.json`. An existing config keeps its own Worker name, and init
|
|
152
154
|
prints a warning.
|
|
@@ -360,7 +362,8 @@ The init command also auto-detects and fixes common migration issues:
|
|
|
360
362
|
- Resolves tsconfig.json path aliases automatically with Vite's native resolver
|
|
361
363
|
- Detects MDX usage and configures `@mdx-js/rollup`
|
|
362
364
|
- Renames CJS config files (postcss.config.js, etc.) to `.cjs` when needed
|
|
363
|
-
|
|
365
|
+
|
|
366
|
+
vinext does not stub native Node.js modules such as `sharp`, `@resvg/resvg-js` or `@napi-rs/canvas`. Workers cannot load Node-API addons, so importing one into Worker code fails the build or the request. If a dependency imports one on a code path that never runs on Workers, alias it to a module of your own with `resolve.alias` in `vite.config.ts`. Configs generated by earlier versions of `vinext init` may contain `resolve.alias` entries pointing at `empty-stub.js`, a file init never created; delete them.
|
|
364
367
|
|
|
365
368
|
Both App Router and Pages Router work on Workers with full client-side hydration.
|
|
366
369
|
|
|
@@ -656,26 +659,26 @@ Every `next/*` import is shimmed to a Vite-compatible implementation.
|
|
|
656
659
|
|
|
657
660
|
### Server features
|
|
658
661
|
|
|
659
|
-
| Feature | | Notes
|
|
660
|
-
| ------------------------------------------ | --- |
|
|
661
|
-
| SSR (Pages Router) | ✅ | Streaming, `_app`/`_document`, `__NEXT_DATA__`, hydration
|
|
662
|
-
| SSR (App Router) | ✅ | RSC pipeline, nested layouts, streaming, nav context for client components
|
|
663
|
-
| `getStaticProps` | ✅ | Props, redirect, notFound, revalidate
|
|
664
|
-
| `getStaticPaths` | ✅ | `fallback: false`, `true`, `"blocking"`
|
|
665
|
-
| `getServerSideProps` | ✅ | Full context including locale
|
|
666
|
-
| ISR | ✅ | Stale-while-revalidate, pluggable `CacheHandler`, background regeneration
|
|
667
|
-
| Server Actions (`"use server"`) | ✅ | Action execution, FormData, re-render after mutation, `redirect()` in actions
|
|
668
|
-
| React Server Components | ✅ | Via `@vitejs/plugin-rsc`. `"use client"` boundaries work correctly
|
|
669
|
-
| Streaming SSR | ✅ | Both routers
|
|
670
|
-
| Metadata API | ✅ | `metadata`, `generateMetadata`, `viewport`, `generateViewport`, title templates
|
|
671
|
-
| `generateStaticParams` | ✅ | With `dynamicParams` enforcement
|
|
672
|
-
| Metadata file routes | ✅ | sitemap.xml, robots.txt, manifest, favicon, OG images (static + dynamic)
|
|
673
|
-
| Static export (`output: 'export'`) | ✅ | Generates static HTML/JSON for all routes
|
|
674
|
-
| Standalone output (`output: 'standalone'`) | ✅ | Generates `dist/standalone` with `server.js`, build artifacts, and runtime deps
|
|
675
|
-
| `connection()` | ✅ | Forces dynamic rendering
|
|
676
|
-
| `"use cache"` directive | ✅ | File-level and function-level. `cacheLife()` profiles, `cacheTag()`, stale-while-revalidate |
|
|
677
|
-
| `instrumentation.ts` | ✅ | `register()`, `onRequestError()`, and [framework tracing](docs/tracing.mdx)
|
|
678
|
-
| Route segment config | 🟡 | `revalidate`, `dynamic`, `dynamicParams`, `runtime` (not placement). No `preferredRegion`
|
|
662
|
+
| Feature | | Notes |
|
|
663
|
+
| ------------------------------------------ | --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
664
|
+
| SSR (Pages Router) | ✅ | Streaming, `_app`/`_document`, `__NEXT_DATA__`, hydration |
|
|
665
|
+
| SSR (App Router) | ✅ | RSC pipeline, nested layouts, streaming, nav context for client components |
|
|
666
|
+
| `getStaticProps` | ✅ | Props, redirect, notFound, revalidate |
|
|
667
|
+
| `getStaticPaths` | ✅ | `fallback: false`, `true`, `"blocking"` |
|
|
668
|
+
| `getServerSideProps` | ✅ | Full context including locale |
|
|
669
|
+
| ISR | ✅ | Stale-while-revalidate, pluggable `CacheHandler`, background regeneration |
|
|
670
|
+
| Server Actions (`"use server"`) | ✅ | Action execution, FormData, re-render after mutation, `redirect()` in actions |
|
|
671
|
+
| React Server Components | ✅ | Via `@vitejs/plugin-rsc`. `"use client"` boundaries work correctly |
|
|
672
|
+
| Streaming SSR | ✅ | Both routers |
|
|
673
|
+
| Metadata API | ✅ | `metadata`, `generateMetadata`, `viewport`, `generateViewport`, title templates |
|
|
674
|
+
| `generateStaticParams` | ✅ | With `dynamicParams` enforcement |
|
|
675
|
+
| Metadata file routes | ✅ | sitemap.xml, robots.txt, manifest, favicon, OG images (static + dynamic) |
|
|
676
|
+
| Static export (`output: 'export'`) | ✅ | Generates static HTML/JSON for all routes |
|
|
677
|
+
| Standalone output (`output: 'standalone'`) | ✅ | Generates `dist/standalone` with `server.js`, build artifacts, and runtime deps |
|
|
678
|
+
| `connection()` | ✅ | Forces dynamic rendering |
|
|
679
|
+
| `"use cache"` directive | ✅ | File-level and function-level. `cacheLife()` with built-in and next.config `cacheLife` (or legacy `experimental.cacheLife`) profiles, `cacheTag()`, stale-while-revalidate |
|
|
680
|
+
| `instrumentation.ts` | ✅ | `register()`, `onRequestError()`, and [framework tracing](docs/tracing.mdx) |
|
|
681
|
+
| Route segment config | 🟡 | `revalidate`, `dynamic`, `dynamicParams`, `runtime` (not placement). No `preferredRegion` |
|
|
679
682
|
|
|
680
683
|
### Configuration
|
|
681
684
|
|
package/THIRD_PARTY_LICENSES.md
CHANGED
|
@@ -49,3 +49,50 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
49
49
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
50
50
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
51
51
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
52
|
+
|
|
53
|
+
## iconv-lite (version 0.4.24)
|
|
54
|
+
|
|
55
|
+
Copyright (c) 2011 Alexander Shtuchkin
|
|
56
|
+
|
|
57
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
58
|
+
a copy of this software and associated documentation files (the
|
|
59
|
+
"Software"), to deal in the Software without restriction, including
|
|
60
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
61
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
62
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
63
|
+
the following conditions:
|
|
64
|
+
|
|
65
|
+
The above copyright notice and this permission notice shall be
|
|
66
|
+
included in all copies or substantial portions of the Software.
|
|
67
|
+
|
|
68
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
69
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
70
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
71
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
72
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
73
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
74
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
75
|
+
|
|
76
|
+
## safer-buffer (version 2.1.2)
|
|
77
|
+
|
|
78
|
+
MIT License
|
|
79
|
+
|
|
80
|
+
Copyright (c) 2018 Nikita Skovoroda <chalkerx@gmail.com>
|
|
81
|
+
|
|
82
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
83
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
84
|
+
in the Software without restriction, including without limitation the rights
|
|
85
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
86
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
87
|
+
furnished to do so, subject to the following conditions:
|
|
88
|
+
|
|
89
|
+
The above copyright notice and this permission notice shall be included in all
|
|
90
|
+
copies or substantial portions of the Software.
|
|
91
|
+
|
|
92
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
93
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
94
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
95
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
96
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
97
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
98
|
+
SOFTWARE.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "node:module";
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -21,5 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
value: mod,
|
|
22
22
|
enumerable: true
|
|
23
23
|
}) : target, mod));
|
|
24
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
24
25
|
//#endregion
|
|
25
|
-
export { __commonJSMin, __toESM };
|
|
26
|
+
export { __commonJSMin, __require, __toESM };
|
package/dist/build/prerender.js
CHANGED
|
@@ -12,10 +12,10 @@ import { NoOpCacheHandler, getCacheHandler, setCacheHandler } from "../shims/cac
|
|
|
12
12
|
import { headersContextFromRequest, runWithHeadersContext } from "../shims/headers.js";
|
|
13
13
|
import { _consumeRequestScopedCacheLife } from "../shims/cache-request-state.js";
|
|
14
14
|
import { normalizeStaticPathsEntry } from "../routing/route-pattern.js";
|
|
15
|
-
import { createRscRequestUrl } from "../server/app-rsc-cache-busting.js";
|
|
16
15
|
import { readPrerenderSecret } from "./server-manifest.js";
|
|
17
16
|
import { buildPregeneratedConcretePathTable } from "../server/prerender-manifest.js";
|
|
18
17
|
import { concatUint8Arrays, decodeRscEmbeddedChunk } from "../server/app-rsc-embedded-chunks.js";
|
|
18
|
+
import { createRscRequestUrl } from "../server/app-rsc-cache-busting.js";
|
|
19
19
|
import { navigationRuntimeRscBootstrapExpression } from "../server/app-ssr-stream.js";
|
|
20
20
|
import { encodePrerenderRouteParams, serializePrerenderRouteParamsHeader } from "../server/prerender-route-params.js";
|
|
21
21
|
import { startProdServer } from "../server/prod-server.js";
|
|
@@ -608,12 +608,13 @@ async function prerenderPages({ routes, apiRoutes, pagesDir, outDir, config, mod
|
|
|
608
608
|
fs.writeFileSync(htmlFullPath, html, "utf-8");
|
|
609
609
|
outputFiles.push(htmlOutputPath);
|
|
610
610
|
}
|
|
611
|
+
const renderedRevalidate = isStaticPropsResponse ? readPrerenderCacheLifeHeader(response.headers)?.revalidate ?? false : revalidate;
|
|
611
612
|
result = {
|
|
612
613
|
route: route.pattern,
|
|
613
614
|
status: "rendered",
|
|
614
615
|
outputFiles,
|
|
615
|
-
revalidate,
|
|
616
|
-
...typeof
|
|
616
|
+
revalidate: renderedRevalidate,
|
|
617
|
+
...typeof renderedRevalidate === "number" ? { expire: config.expireTime } : {},
|
|
617
618
|
router: "pages",
|
|
618
619
|
...urlPath !== route.pattern ? { path: urlPath } : {},
|
|
619
620
|
...locale ? { locale } : {},
|
package/dist/build/report.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AppRoute } from "../routing/app-route-graph.js";
|
|
2
|
-
import { LayoutBuildClassification } from "./layout-classification-types.js";
|
|
3
2
|
import { Route } from "../routing/pages-router.js";
|
|
4
3
|
import { PrerenderResult } from "./prerender.js";
|
|
5
4
|
//#region src/build/report.d.ts
|
|
@@ -77,19 +76,6 @@ export declare function extractExportConstNumber(code: string, name: string): nu
|
|
|
77
76
|
* null — no `revalidate` key found (fully static)
|
|
78
77
|
*/
|
|
79
78
|
export declare function extractGetStaticPropsRevalidate(code: string): number | false | null;
|
|
80
|
-
/**
|
|
81
|
-
* Classifies a layout file by its segment config exports (`dynamic`, `revalidate`).
|
|
82
|
-
*
|
|
83
|
-
* Returns a tagged `LayoutBuildClassification` carrying both the decision and
|
|
84
|
-
* the specific segment-config field that produced it. `{ kind: "absent" }`
|
|
85
|
-
* means no segment config is present and the caller should defer to the next
|
|
86
|
-
* layer (module graph analysis).
|
|
87
|
-
*
|
|
88
|
-
* Unlike page classification, positive `revalidate` values are not meaningful
|
|
89
|
-
* for layout skip decisions — ISR is a page-level concept. Only the extremes
|
|
90
|
-
* (`revalidate = 0` → dynamic, `revalidate = Infinity` → static) are decisive.
|
|
91
|
-
*/
|
|
92
|
-
export declare function classifyLayoutSegmentConfig(code: string): LayoutBuildClassification;
|
|
93
79
|
/**
|
|
94
80
|
* Classifies a Pages Router page file by reading its source and examining
|
|
95
81
|
* which data-fetching exports it contains.
|
package/dist/build/report.js
CHANGED
|
@@ -392,56 +392,6 @@ function propertyName(key) {
|
|
|
392
392
|
return null;
|
|
393
393
|
}
|
|
394
394
|
/**
|
|
395
|
-
* Classifies a layout file by its segment config exports (`dynamic`, `revalidate`).
|
|
396
|
-
*
|
|
397
|
-
* Returns a tagged `LayoutBuildClassification` carrying both the decision and
|
|
398
|
-
* the specific segment-config field that produced it. `{ kind: "absent" }`
|
|
399
|
-
* means no segment config is present and the caller should defer to the next
|
|
400
|
-
* layer (module graph analysis).
|
|
401
|
-
*
|
|
402
|
-
* Unlike page classification, positive `revalidate` values are not meaningful
|
|
403
|
-
* for layout skip decisions — ISR is a page-level concept. Only the extremes
|
|
404
|
-
* (`revalidate = 0` → dynamic, `revalidate = Infinity` → static) are decisive.
|
|
405
|
-
*/
|
|
406
|
-
function classifyLayoutSegmentConfig(code) {
|
|
407
|
-
const program = parseRouteModule(code);
|
|
408
|
-
const dynamicValue = program ? extractExportConstStringFromProgram(program, "dynamic") : null;
|
|
409
|
-
if (dynamicValue === "force-dynamic") return {
|
|
410
|
-
kind: "dynamic",
|
|
411
|
-
reason: {
|
|
412
|
-
layer: "segment-config",
|
|
413
|
-
key: "dynamic",
|
|
414
|
-
value: "force-dynamic"
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
if (dynamicValue === "force-static" || dynamicValue === "error") return {
|
|
418
|
-
kind: "static",
|
|
419
|
-
reason: {
|
|
420
|
-
layer: "segment-config",
|
|
421
|
-
key: "dynamic",
|
|
422
|
-
value: dynamicValue
|
|
423
|
-
}
|
|
424
|
-
};
|
|
425
|
-
const revalidateValue = program ? extractExportConstNumberFromProgram(program, "revalidate") : null;
|
|
426
|
-
if (revalidateValue === Infinity) return {
|
|
427
|
-
kind: "static",
|
|
428
|
-
reason: {
|
|
429
|
-
layer: "segment-config",
|
|
430
|
-
key: "revalidate",
|
|
431
|
-
value: Infinity
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
if (revalidateValue === 0) return {
|
|
435
|
-
kind: "dynamic",
|
|
436
|
-
reason: {
|
|
437
|
-
layer: "segment-config",
|
|
438
|
-
key: "revalidate",
|
|
439
|
-
value: 0
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
|
-
return { kind: "absent" };
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
395
|
* Classifies a Pages Router page file by reading its source and examining
|
|
446
396
|
* which data-fetching exports it contains.
|
|
447
397
|
*
|
|
@@ -675,4 +625,4 @@ async function printBuildReport(options) {
|
|
|
675
625
|
}
|
|
676
626
|
}
|
|
677
627
|
//#endregion
|
|
678
|
-
export { buildReportRows, classifyAppRoute, classifyAppRouteHandler,
|
|
628
|
+
export { buildReportRows, classifyAppRoute, classifyAppRouteHandler, classifyPagesRoute, extractExportConstNumber, extractExportConstString, extractGetStaticPropsRevalidate, extractMiddlewareMatcherConfig, extractMiddlewareMatcherConfigValue, formatBuildReport, getAppRouteRenderEntryPath, hasExportedName, hasNamedExport, hasRuntimeExportedName, printBuildReport };
|
package/dist/check.js
CHANGED
|
@@ -243,13 +243,10 @@ const CONFIG_SUPPORT = {
|
|
|
243
243
|
status: "unsupported",
|
|
244
244
|
detail: "ignored; configure cache adapters with vinext({ cache }) in vite.config"
|
|
245
245
|
},
|
|
246
|
-
cacheLife: {
|
|
247
|
-
status: "unsupported",
|
|
248
|
-
detail: "custom cacheLife profiles are ignored; only the built-in profiles are available"
|
|
249
|
-
},
|
|
246
|
+
cacheLife: { status: "supported" },
|
|
250
247
|
"experimental.cacheLife": {
|
|
251
|
-
status: "
|
|
252
|
-
detail: "
|
|
248
|
+
status: "supported",
|
|
249
|
+
detail: "legacy alias of cacheLife"
|
|
253
250
|
},
|
|
254
251
|
skipTrailingSlashRedirect: { status: "supported" },
|
|
255
252
|
"experimental.skipTrailingSlashRedirect": {
|
|
@@ -438,7 +435,7 @@ const LIBRARY_SUPPORT = {
|
|
|
438
435
|
},
|
|
439
436
|
"next-intl": {
|
|
440
437
|
status: "supported",
|
|
441
|
-
detail: "createNextIntlPlugin is only optional with the request config at (src/)i18n/request.*; its experimental
|
|
438
|
+
detail: "createNextIntlPlugin is only optional with the request config at (src/)i18n/request.*; its experimental extract option doesn't work (it needs a webpack/Turbopack loader)"
|
|
442
439
|
},
|
|
443
440
|
"@clerk/nextjs": {
|
|
444
441
|
status: "supported",
|
package/dist/cli.js
CHANGED
|
@@ -284,6 +284,9 @@ function printHelp(cmd) {
|
|
|
284
284
|
(Response Store or Workers Cache, default: prompt with No)
|
|
285
285
|
--legacy-wrangler-cloudflare-init
|
|
286
286
|
Use the legacy Wrangler setup instead of cf
|
|
287
|
+
--ignore-wrangler-config
|
|
288
|
+
Set up cf even if a root Wrangler config exists
|
|
289
|
+
(use when it belongs to an unrelated Worker)
|
|
287
290
|
--cdn-cache <type> Cloudflare CDN cache: none, response-store, workers-cache,
|
|
288
291
|
static-assets, or data-cache
|
|
289
292
|
(default: none; response-store is the default cache choice)
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ReportedError, dismissOverlay } from "./dev-error-overlay-store.js";
|
|
2
|
+
import { InitialDevServerErrorPayload } from "../server/dev-initial-server-error.js";
|
|
2
3
|
//#region src/client/dev-error-overlay.d.ts
|
|
3
4
|
export declare const DEV_ERROR_OVERLAY_HOST_ID = "__vinext_dev_error_overlay_root";
|
|
4
5
|
export declare const DEV_ERROR_OVERLAY_MOUNT_ID = "__vinext_dev_error_overlay_mount";
|
|
5
6
|
export declare function installDevErrorOverlay(): void;
|
|
6
7
|
export declare function installReactRefreshErrorRecovery(): void;
|
|
8
|
+
export declare function selectUnreportedInitialDevServerErrors(payloads: readonly InitialDevServerErrorPayload[], reported: readonly ReportedError[]): InitialDevServerErrorPayload[];
|
|
7
9
|
export declare function reportInitialDevServerErrors(): void;
|
|
8
10
|
type ViteHmrErrorPayload = {
|
|
9
11
|
err?: ViteHmrError;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isNavigationSignalError } from "../utils/navigation-signal.js";
|
|
2
|
-
import { VINEXT_DEV_ERROR_RECOVERY_EVENT } from "../utils/dev-error-recovery-event.js";
|
|
3
2
|
import { VINEXT_ORIGINAL_STACK_TRACE_ENDPOINT } from "../utils/dev-stack-sourcemap-endpoint.js";
|
|
4
3
|
import { dismissOverlay, expandOverlay, getOverlaySnapshot, minimizeOverlay, reportToOverlay, setOverlayIndex, subscribeOverlay, updateOverlayErrorStack } from "./dev-error-overlay-store.js";
|
|
4
|
+
import { VINEXT_DEV_ERROR_RECOVERY_EVENT } from "../utils/dev-error-recovery-event.js";
|
|
5
5
|
import { Fragment, useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
6
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { createRoot } from "react-dom/client";
|
|
@@ -11,6 +11,7 @@ const DEV_ERROR_OVERLAY_MOUNT_ID = "__vinext_dev_error_overlay_mount";
|
|
|
11
11
|
const VITE_ERROR_HANDLER_DATA_KEY = "__vinext_vite_error_handler__";
|
|
12
12
|
const REACT_REFRESH_RECOVERY_RETRY_DELAY_MS = 16;
|
|
13
13
|
let reactRoot = null;
|
|
14
|
+
let overlayHost = null;
|
|
14
15
|
let installed = false;
|
|
15
16
|
const reportedErrors = /* @__PURE__ */ new WeakSet();
|
|
16
17
|
function rememberReported(error) {
|
|
@@ -81,12 +82,21 @@ function tryInstallReactRefreshErrorRecovery() {
|
|
|
81
82
|
});
|
|
82
83
|
return true;
|
|
83
84
|
}
|
|
85
|
+
function selectUnreportedInitialDevServerErrors(payloads, reported) {
|
|
86
|
+
const rethrownErrors = reported.filter((error) => error.source === "caught" || error.source === "uncaught" || error.source === "window-error");
|
|
87
|
+
return payloads.filter((payload) => {
|
|
88
|
+
const rethrownIndex = rethrownErrors.findIndex((error) => error.message === payload.message && (error.name || "Error") === (payload.name || "Error"));
|
|
89
|
+
if (rethrownIndex === -1) return true;
|
|
90
|
+
rethrownErrors.splice(rethrownIndex, 1);
|
|
91
|
+
return false;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
84
94
|
function reportInitialDevServerErrors() {
|
|
85
95
|
if (typeof window === "undefined") return;
|
|
86
96
|
const errors = window.__VINEXT_INITIAL_DEV_ERRORS__;
|
|
87
97
|
if (!errors || errors.length === 0) return;
|
|
88
98
|
window.__VINEXT_INITIAL_DEV_ERRORS__ = [];
|
|
89
|
-
for (const payload of errors) {
|
|
99
|
+
for (const payload of selectUnreportedInitialDevServerErrors(errors, getOverlaySnapshot().errors)) {
|
|
90
100
|
const error = new Error(payload.message);
|
|
91
101
|
if (payload.name) error.name = payload.name;
|
|
92
102
|
if (payload.stack) error.stack = payload.stack;
|
|
@@ -130,6 +140,7 @@ function reportDevError(error, options) {
|
|
|
130
140
|
ensureMounted();
|
|
131
141
|
const id = reportToOverlay({
|
|
132
142
|
source: options.source,
|
|
143
|
+
name: error instanceof Error ? error.name : void 0,
|
|
133
144
|
message,
|
|
134
145
|
stack,
|
|
135
146
|
ignoredStackFrames: void 0,
|
|
@@ -176,8 +187,13 @@ function stringValue(value) {
|
|
|
176
187
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
177
188
|
}
|
|
178
189
|
function ensureMounted() {
|
|
179
|
-
if (reactRoot)
|
|
190
|
+
if (reactRoot) {
|
|
191
|
+
const host = overlayHost;
|
|
192
|
+
if (host && !host.isConnected) (document.body ?? document.documentElement).appendChild(host);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
180
195
|
const node = createDevErrorOverlayMountNode(document);
|
|
196
|
+
overlayHost = document.getElementById(DEV_ERROR_OVERLAY_HOST_ID);
|
|
181
197
|
reactRoot = createRoot(node);
|
|
182
198
|
reactRoot.render(/* @__PURE__ */ jsx(DevErrorOverlayApp, {}));
|
|
183
199
|
}
|
|
@@ -1342,4 +1358,4 @@ const componentStackStyle = {
|
|
|
1342
1358
|
color: "var(--vinext-overlay-muted)"
|
|
1343
1359
|
};
|
|
1344
1360
|
//#endregion
|
|
1345
|
-
export { DEV_ERROR_OVERLAY_HOST_ID, DEV_ERROR_OVERLAY_MOUNT_ID, createDevErrorOverlayMountNode, createViteOpenInEditorUrl, devOnCaughtError, devOnUncaughtError, dismissOverlay, formatErrorInfoForClipboard, formatOverlayDisplayFile, formatViteOpenInEditorFile, installDevErrorOverlay, installReactRefreshErrorRecovery, installViteHmrErrorHandler, normalizeViteHmrError, reportInitialDevServerErrors };
|
|
1361
|
+
export { DEV_ERROR_OVERLAY_HOST_ID, DEV_ERROR_OVERLAY_MOUNT_ID, createDevErrorOverlayMountNode, createViteOpenInEditorUrl, devOnCaughtError, devOnUncaughtError, dismissOverlay, formatErrorInfoForClipboard, formatOverlayDisplayFile, formatViteOpenInEditorFile, installDevErrorOverlay, installReactRefreshErrorRecovery, installViteHmrErrorHandler, normalizeViteHmrError, reportInitialDevServerErrors, selectUnreportedInitialDevServerErrors };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BrowserRouteManifest, BrowserRouteManifestWire } from "../routing/browser-route-manifest.js";
|
|
2
2
|
import { AppRouterScrollIntent } from "../shims/app-router-scroll-state.js";
|
|
3
|
+
import { CachedRscResponse } from "../shims/navigation.js";
|
|
3
4
|
//#region src/client/navigation-runtime.d.ts
|
|
4
5
|
type NavigationRuntimeSnapshot = {
|
|
5
6
|
pathname: string;
|
|
@@ -42,7 +43,9 @@ type NavigationRuntimeTraversalIntent = {
|
|
|
42
43
|
};
|
|
43
44
|
export type NavigationRuntimeNavigate = (href: string, redirectDepth?: number, navigationKind?: NavigationRuntimeKind, historyUpdateMode?: NavigationRuntimeHistoryUpdateMode, previousNextUrlOverride?: string | null, programmaticTransition?: boolean, traversalIntent?: NavigationRuntimeTraversalIntent, scrollIntent?: AppRouterScrollIntent | null, visibleCommitMode?: NavigationRuntimeVisibleCommitMode, bypassNavigationCache?: boolean) => Promise<void>;
|
|
44
45
|
export type NavigationRuntimeFunctions = {
|
|
45
|
-
clearNavigationCaches?: (
|
|
46
|
+
clearNavigationCaches?: (options?: {
|
|
47
|
+
pingVisibleLinks?: boolean;
|
|
48
|
+
}) => void;
|
|
46
49
|
commitHashNavigation?: (href: string, historyUpdateMode: NavigationRuntimeHistoryUpdateMode, scroll: boolean) => void;
|
|
47
50
|
navigateExternal?: (href: string, historyUpdateMode: NavigationRuntimeHistoryUpdateMode) => Promise<void>;
|
|
48
51
|
navigate?: NavigationRuntimeNavigate;
|
|
@@ -57,6 +60,15 @@ export type NavigationRuntimeFunctions = {
|
|
|
57
60
|
notifyLinkNavigationStart?: () => void;
|
|
58
61
|
pingVisibleLinks?: () => void;
|
|
59
62
|
preparePrefetchResponse?: (response: Response) => Promise<unknown>;
|
|
63
|
+
/**
|
|
64
|
+
* The visited (BFCache) response a full prefetch can be fulfilled from, and
|
|
65
|
+
* until when a navigation would still reuse it (null if it wouldn't).
|
|
66
|
+
*/
|
|
67
|
+
readVisitedResponseForFullPrefetch?: (rscUrls: readonly string[], interceptionContext: string | null, mountedSlotsHeader: string | null) => {
|
|
68
|
+
navigatedAt: number;
|
|
69
|
+
navigationFreshUntil: number | null;
|
|
70
|
+
response: CachedRscResponse;
|
|
71
|
+
} | null;
|
|
60
72
|
claimCurrentHistoryTreeSnapshot?: (historyUpdateMode: NavigationRuntimeHistoryUpdateMode, previousHistoryState: unknown) => void;
|
|
61
73
|
commitAppOwnedHistoryStateWrite?: (historyUpdateMode: NavigationRuntimeHistoryUpdateMode, previousHistoryState: unknown) => void;
|
|
62
74
|
/**
|
|
@@ -26,7 +26,7 @@ function readRuntimeWindow() {
|
|
|
26
26
|
}
|
|
27
27
|
function isNavigationRuntimeFunctions(value) {
|
|
28
28
|
if (!isUnknownRecord(value)) return false;
|
|
29
|
-
return isOptionalRuntimeFunction(Reflect.get(value, "clearNavigationCaches")) && isOptionalRuntimeFunction(Reflect.get(value, "commitHashNavigation")) && isOptionalRuntimeFunction(Reflect.get(value, "navigateExternal")) && isOptionalRuntimeFunction(Reflect.get(value, "navigate")) && isOptionalRuntimeFunction(Reflect.get(value, "getPrefetchRouterState")) && isOptionalRuntimeFunction(Reflect.get(value, "notifyLinkNavigationStart")) && isOptionalRuntimeFunction(Reflect.get(value, "pingVisibleLinks")) && isOptionalRuntimeFunction(Reflect.get(value, "preparePrefetchResponse")) && isOptionalRuntimeFunction(Reflect.get(value, "claimCurrentHistoryTreeSnapshot")) && isOptionalRuntimeFunction(Reflect.get(value, "commitAppOwnedHistoryStateWrite")) && isOptionalRuntimeFunction(Reflect.get(value, "discardPendingNavigation")) && isOptionalRuntimeFunction(Reflect.get(value, "flushCommittingNavigationUrl")) && isOptionalRuntimeFunction(Reflect.get(value, "loadRouteManifest"));
|
|
29
|
+
return isOptionalRuntimeFunction(Reflect.get(value, "clearNavigationCaches")) && isOptionalRuntimeFunction(Reflect.get(value, "commitHashNavigation")) && isOptionalRuntimeFunction(Reflect.get(value, "navigateExternal")) && isOptionalRuntimeFunction(Reflect.get(value, "navigate")) && isOptionalRuntimeFunction(Reflect.get(value, "getPrefetchRouterState")) && isOptionalRuntimeFunction(Reflect.get(value, "notifyLinkNavigationStart")) && isOptionalRuntimeFunction(Reflect.get(value, "pingVisibleLinks")) && isOptionalRuntimeFunction(Reflect.get(value, "preparePrefetchResponse")) && isOptionalRuntimeFunction(Reflect.get(value, "readVisitedResponseForFullPrefetch")) && isOptionalRuntimeFunction(Reflect.get(value, "claimCurrentHistoryTreeSnapshot")) && isOptionalRuntimeFunction(Reflect.get(value, "commitAppOwnedHistoryStateWrite")) && isOptionalRuntimeFunction(Reflect.get(value, "discardPendingNavigation")) && isOptionalRuntimeFunction(Reflect.get(value, "flushCommittingNavigationUrl")) && isOptionalRuntimeFunction(Reflect.get(value, "loadRouteManifest"));
|
|
30
30
|
}
|
|
31
31
|
function isNavigationRuntimeRscChunk(value) {
|
|
32
32
|
if (typeof value === "string") return true;
|
|
@@ -759,8 +759,10 @@ async function proxyExternalRequest(request, externalUrl) {
|
|
|
759
759
|
const destinationKeys = new Set(targetUrl.searchParams.keys());
|
|
760
760
|
for (const [key, value] of originalUrl.searchParams) if (!destinationKeys.has(key)) targetUrl.searchParams.append(key, value);
|
|
761
761
|
const headers = new Headers(request.headers);
|
|
762
|
+
const requestHost = headers.get("host") ?? "";
|
|
762
763
|
headers.set("host", targetUrl.host);
|
|
763
764
|
stripHopByHopRequestHeaders(headers);
|
|
765
|
+
headers.set("x-forwarded-host", requestHost);
|
|
764
766
|
const keysToDelete = [];
|
|
765
767
|
for (const key of headers.keys()) if (key.startsWith("x-middleware-") && !key.startsWith("x-middleware-request-")) keysToDelete.push(key);
|
|
766
768
|
for (const key of keysToDelete) headers.delete(key);
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
* `%XX` escapes a raw path capture already carries. A decoded `has` capture
|
|
26
26
|
* carrying `#`, `/`, `?`, `@` or `:` then makes the host invalid instead of
|
|
27
27
|
* moving the proxy to another host. Next.js substitutes the hostname verbatim
|
|
28
|
-
* and can be retargeted this way; vinext is stricter.
|
|
28
|
+
* and can be retargeted this way; vinext is stricter. Params in a rewrite's
|
|
29
|
+
* path follow substituteRewritePath.
|
|
29
30
|
*
|
|
30
31
|
* https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/router/utils/prepare-destination.ts
|
|
31
32
|
* https://github.com/vercel/next.js/blob/canary/packages/next/src/server/server-route-utils.ts
|
|
@@ -33,7 +33,8 @@ const _compiledDestinationParamCache = /* @__PURE__ */ new Map();
|
|
|
33
33
|
* `%XX` escapes a raw path capture already carries. A decoded `has` capture
|
|
34
34
|
* carrying `#`, `/`, `?`, `@` or `:` then makes the host invalid instead of
|
|
35
35
|
* moving the proxy to another host. Next.js substitutes the hostname verbatim
|
|
36
|
-
* and can be retargeted this way; vinext is stricter.
|
|
36
|
+
* and can be retargeted this way; vinext is stricter. Params in a rewrite's
|
|
37
|
+
* path follow substituteRewritePath.
|
|
37
38
|
*
|
|
38
39
|
* https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/router/utils/prepare-destination.ts
|
|
39
40
|
* https://github.com/vercel/next.js/blob/canary/packages/next/src/server/server-route-utils.ts
|
|
@@ -49,7 +50,56 @@ function substituteDestinationParams(destination, params, kind) {
|
|
|
49
50
|
const queryIndex = beforeHash.indexOf("?");
|
|
50
51
|
const beforeQuery = queryIndex === -1 ? beforeHash : beforeHash.slice(0, queryIndex);
|
|
51
52
|
const authorityEnd = getAbsoluteUrlAuthorityEnd(beforeQuery.replace(paramRe, (token) => "x".repeat(token.length)));
|
|
52
|
-
|
|
53
|
+
const [path, pathHash] = substituteRewritePath(beforeQuery.slice(authorityEnd), paramRe, params, authorityEnd > 0);
|
|
54
|
+
const query = queryIndex === -1 ? "" : `?${replaceParams(beforeHash.slice(queryIndex + 1), encodeRewriteQueryParamValue)}`;
|
|
55
|
+
return `${replaceParams(beforeQuery.slice(0, authorityEnd), encodeAuthorityParam)}${path}${query}${pathHash ?? replaceParams(hash, (value) => value)}`;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Substitute params into a rewrite destination's path, returning the path and,
|
|
59
|
+
* when a param carried a `#`, the hash it starts.
|
|
60
|
+
*
|
|
61
|
+
* Next.js inserts path params verbatim, splits the result at the first `#`
|
|
62
|
+
* and escapes a `?` when it formats the URL. A decoded `has` capture can end
|
|
63
|
+
* the path with `#`, but neither `?` nor `#` can displace the destination's
|
|
64
|
+
* own query.
|
|
65
|
+
*
|
|
66
|
+
* An absolute destination is proxied with the URL parser, which removes tab
|
|
67
|
+
* and newlines, trims trailing control characters and spaces, and resolves
|
|
68
|
+
* `.`/`..` segments against the destination's literal path. Next.js sends a
|
|
69
|
+
* param's control characters and spaces percent-encoded, as vinext does, and
|
|
70
|
+
* its dot segments as written. A parsed URL cannot carry a `..` segment, so a
|
|
71
|
+
* dot segment that a param is in or next to is escaped once more (`.` as
|
|
72
|
+
* `%252E`, `%2e` as `%252e`) and stays inside the destination's path. The
|
|
73
|
+
* destination's own dot segments still resolve.
|
|
74
|
+
*
|
|
75
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/router/utils/prepare-destination.ts
|
|
76
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/router/utils/format-url.ts
|
|
77
|
+
*/
|
|
78
|
+
function substituteRewritePath(template, paramRe, params, absolute) {
|
|
79
|
+
const encodeParam = absolute ? encodeAbsoluteUrlPathParam : encodePathQueryDelimiter;
|
|
80
|
+
const paramRanges = [];
|
|
81
|
+
let substituted = "";
|
|
82
|
+
let templateIndex = 0;
|
|
83
|
+
for (const match of template.matchAll(paramRe)) {
|
|
84
|
+
substituted += template.slice(templateIndex, match.index);
|
|
85
|
+
const value = encodeParam(params[match[1]]);
|
|
86
|
+
paramRanges.push([substituted.length, substituted.length + value.length]);
|
|
87
|
+
substituted += value;
|
|
88
|
+
templateIndex = match.index + match[0].length;
|
|
89
|
+
}
|
|
90
|
+
substituted += template.slice(templateIndex);
|
|
91
|
+
const [path, hash] = substituted.split("#", 2);
|
|
92
|
+
const pathHash = hash === void 0 ? void 0 : hash ? `#${hash}` : "";
|
|
93
|
+
if (!absolute) return [path, pathHash];
|
|
94
|
+
return [path.replace(DOT_SEGMENT_RE, (segment, offset) => paramRanges.some(([start, end]) => start <= offset + segment.length && end >= offset) ? segment.replace(/\.|%(?=2e)/gi, (char) => char === "." ? "%252E" : "%25") : segment), pathHash];
|
|
95
|
+
}
|
|
96
|
+
const DOT_SEGMENT_RE = /(?<=^|[/\\])(?:\.|%2e){1,2}(?=[/\\]|$)/gi;
|
|
97
|
+
function encodePathQueryDelimiter(value) {
|
|
98
|
+
return value.replaceAll("?", "%3F");
|
|
99
|
+
}
|
|
100
|
+
const ABSOLUTE_URL_PATH_PARAM_UNSAFE_RE = /[?\u0000- ]/g;
|
|
101
|
+
function encodeAbsoluteUrlPathParam(value) {
|
|
102
|
+
return value.replace(ABSOLUTE_URL_PATH_PARAM_UNSAFE_RE, encodeURIComponent);
|
|
53
103
|
}
|
|
54
104
|
function getAbsoluteUrlAuthorityEnd(value) {
|
|
55
105
|
const scheme = /^[a-z][a-z0-9+.-]*:[/\\\t\n\r]*/i.exec(value);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CacheLifeConfig } from "../utils/cache-life-profiles.js";
|
|
1
2
|
import { PHASE_PRODUCTION_BUILD } from "../shims/constants.js";
|
|
2
3
|
import { PluginOption } from "vite";
|
|
3
4
|
//#region src/config/next-config.d.ts
|
|
@@ -102,6 +103,18 @@ export type MdxOptions = {
|
|
|
102
103
|
rehypePlugins?: unknown[];
|
|
103
104
|
recmaPlugins?: unknown[];
|
|
104
105
|
};
|
|
106
|
+
/**
|
|
107
|
+
* The webpack/Turbopack rule `createNextIntlPlugin` adds for its
|
|
108
|
+
* `experimental.messages` catalogs. vinext runs the same loader on the files it matches.
|
|
109
|
+
*/
|
|
110
|
+
export type NextIntlCatalogLoader = {
|
|
111
|
+
/** Absolute catalog directories (the rule's `include`). */
|
|
112
|
+
include: string[];
|
|
113
|
+
/** Catalog file extension test (the rule's `test`). */
|
|
114
|
+
test: RegExp;
|
|
115
|
+
/** The loader's `options`. */
|
|
116
|
+
options: Record<string, unknown>;
|
|
117
|
+
};
|
|
105
118
|
export type PrefetchInliningConfig = false | {
|
|
106
119
|
maxBundleSize: number;
|
|
107
120
|
maxSize: number;
|
|
@@ -352,6 +365,11 @@ export type ResolvedNextConfig = {
|
|
|
352
365
|
/** Server globals injected into instrumentation.ts by wrapped webpack configs. */
|
|
353
366
|
instrumentationServerValueInjections: Record<string, unknown>;
|
|
354
367
|
cacheComponents: boolean;
|
|
368
|
+
/**
|
|
369
|
+
* `experimental.cachedNavigations`: lets the client cache the static stage of
|
|
370
|
+
* navigation responses. Requires `cacheComponents`.
|
|
371
|
+
*/
|
|
372
|
+
cachedNavigations: boolean;
|
|
355
373
|
appNavFailHandling: boolean;
|
|
356
374
|
/**
|
|
357
375
|
* Enables the experimental App Router gesture transition API:
|
|
@@ -374,6 +392,8 @@ export type ResolvedNextConfig = {
|
|
|
374
392
|
i18n: NextI18nConfig | null;
|
|
375
393
|
/** MDX remark/rehype/recma plugins extracted from @next/mdx config */
|
|
376
394
|
mdx: MdxOptions | null;
|
|
395
|
+
/** next-intl's message catalog loader rule from `createNextIntlPlugin`. */
|
|
396
|
+
nextIntlCatalogLoader: NextIntlCatalogLoader | null;
|
|
377
397
|
/** Explicit module aliases preserved from wrapped next.config plugins. */
|
|
378
398
|
aliases: Record<string, string>;
|
|
379
399
|
/** Extra allowed origins for dev server access (from allowedDevOrigins). */
|
|
@@ -532,6 +552,11 @@ export type ResolvedNextConfig = {
|
|
|
532
552
|
dynamic: number;
|
|
533
553
|
static: number;
|
|
534
554
|
};
|
|
555
|
+
/**
|
|
556
|
+
* `cacheLife` profiles (or legacy `experimental.cacheLife`) merged over the
|
|
557
|
+
* built-ins with Next.js's rules; read by the `cacheLife()` shim.
|
|
558
|
+
*/
|
|
559
|
+
cacheLife: Record<string, CacheLifeConfig>;
|
|
535
560
|
/**
|
|
536
561
|
* Mirrors Next.js `experimental.useLightningcss`. When `true`, switch
|
|
537
562
|
* Vite's CSS pipeline from PostCSS to lightningcss for both transforms
|