vinext 1.0.0-beta.0 → 1.0.0-beta.2
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 +21 -2
- package/dist/build/assets-ignore.js +1 -1
- package/dist/build/clean-output.js +1 -1
- package/dist/build/client-build-config.js +7 -4
- package/dist/build/css-url-assets.js +3 -3
- package/dist/build/google-fonts/fallback-metrics.js +1 -1
- package/dist/build/google-fonts/font-metadata.js +1 -1
- package/dist/build/inject-pregenerated-paths.js +1 -1
- package/dist/build/inline-css.js +2 -5
- package/dist/build/module-dependency-cache.d.ts +4 -0
- package/dist/build/module-dependency-cache.js +13 -0
- package/dist/build/next-client-runtime-manifests.js +1 -1
- package/dist/build/pages-client-assets-module.js +1 -1
- package/dist/build/precompress.js +7 -7
- package/dist/build/prerender-paths.d.ts +2 -2
- package/dist/build/prerender-paths.js +10 -15
- package/dist/build/prerender-server-pool.js +2 -2
- package/dist/build/prerender.js +1 -1
- package/dist/build/preview-credentials.d.ts +11 -0
- package/dist/build/preview-credentials.js +19 -0
- package/dist/build/report.d.ts +8 -4
- package/dist/build/report.js +14 -6
- package/dist/build/run-prerender.d.ts +2 -11
- package/dist/build/run-prerender.js +2 -10
- package/dist/build/server-manifest.js +1 -1
- package/dist/build/ssr-manifest.d.ts +4 -0
- package/dist/build/ssr-manifest.js +10 -6
- package/dist/build/standalone.js +37 -37
- package/dist/cache/cache-adapters-virtual.d.ts +1 -17
- package/dist/cache/cache-adapters-virtual.js +20 -11
- package/dist/check.d.ts +0 -16
- package/dist/check.js +27 -36
- package/dist/cli.js +61 -55
- package/dist/client/instrumentation-client-inject.js +1 -1
- package/dist/client/pages-router-link-navigation.js +1 -1
- package/dist/config/config-matchers.d.ts +13 -37
- package/dist/config/config-matchers.js +33 -123
- package/dist/config/dotenv.js +1 -1
- package/dist/config/next-config.d.ts +7 -3
- package/dist/config/next-config.js +84 -15
- package/dist/config/prerender.d.ts +2 -2
- package/dist/config/prerender.js +7 -15
- package/dist/config/request-context.d.ts +14 -0
- package/dist/config/request-context.js +26 -0
- package/dist/config/server-external-packages.js +1 -1
- package/dist/config/tsconfig-paths.js +2 -2
- package/dist/{node_modules/.pnpm/am-i-vibing@0.5.0/node_modules → deps/.pnpm/am-i-vibing@0.5.0/deps}/am-i-vibing/dist/detector-1yx2Hoe0.js +2 -2
- package/dist/deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js +50 -0
- package/dist/entries/app-rsc-entry.js +39 -14
- package/dist/entries/app-rsc-manifest.js +21 -4
- package/dist/entries/pages-client-entry.js +6 -5
- package/dist/entries/pages-server-entry.js +18 -28
- package/dist/entries/runtime-entry-module.js +2 -2
- package/dist/index.js +314 -230
- package/dist/init-cloudflare.js +1 -1
- package/dist/init-platform.js +1 -1
- package/dist/init.d.ts +6 -4
- package/dist/init.js +25 -27
- package/dist/plugins/ast-utils.js +1 -1
- package/dist/plugins/dynamic-preload-metadata.js +7 -7
- package/dist/plugins/extensionless-dynamic-import.js +1 -1
- package/dist/plugins/fonts.js +3 -3
- package/dist/plugins/ignore-dynamic-requests.js +13 -8
- package/dist/plugins/import-meta-url.js +16 -17
- package/dist/plugins/middleware-export-validation.js +1 -1
- package/dist/plugins/middleware-server-only.js +2 -2
- package/dist/plugins/og-asset-ownership.js +7 -6
- package/dist/plugins/og-assets.js +5 -6
- package/dist/plugins/optimize-imports.js +12 -13
- package/dist/plugins/postcss.js +1 -1
- package/dist/plugins/remove-console.js +1 -1
- package/dist/plugins/require-context.js +1 -1
- package/dist/plugins/sass.js +2 -2
- package/dist/plugins/server-externals-manifest.js +1 -1
- package/dist/plugins/strip-server-exports.js +1 -1
- package/dist/plugins/styled-jsx.js +3 -2
- package/dist/plugins/typeof-window.js +1 -1
- package/dist/routing/app-route-graph.d.ts +16 -15
- package/dist/routing/app-route-graph.js +86 -88
- package/dist/routing/app-router.d.ts +0 -5
- package/dist/routing/app-router.js +12 -11
- package/dist/routing/file-matcher.d.ts +13 -28
- package/dist/routing/file-matcher.js +31 -44
- package/dist/routing/pages-router.js +26 -32
- package/dist/routing/route-matching.d.ts +14 -1
- package/dist/routing/route-matching.js +13 -1
- package/dist/routing/route-pattern.d.ts +2 -1
- package/dist/routing/route-pattern.js +7 -4
- package/dist/routing/route-trie.d.ts +5 -1
- package/dist/routing/route-trie.js +5 -2
- package/dist/server/api-handler.js +41 -33
- package/dist/server/app-browser-entry.js +18 -11
- package/dist/server/app-browser-history-controller.d.ts +1 -1
- package/dist/server/app-browser-history-controller.js +3 -3
- package/dist/server/app-browser-navigation-controller.js +4 -2
- package/dist/server/app-browser-server-action-client.js +1 -1
- package/dist/server/app-elements-wire.d.ts +2 -1
- package/dist/server/app-fallback-renderer.d.ts +11 -0
- package/dist/server/app-fallback-renderer.js +16 -2
- package/dist/server/app-middleware.js +2 -1
- package/dist/server/app-page-boundary-render.d.ts +26 -2
- package/dist/server/app-page-boundary-render.js +190 -55
- package/dist/server/app-page-cache-finalizer.d.ts +1 -1
- package/dist/server/app-page-cache.d.ts +1 -1
- package/dist/server/app-page-dispatch.d.ts +12 -2
- package/dist/server/app-page-dispatch.js +37 -51
- package/dist/server/app-page-element-builder.d.ts +8 -2
- package/dist/server/app-page-element-builder.js +112 -27
- package/dist/server/app-page-execution.d.ts +3 -1
- package/dist/server/app-page-execution.js +31 -39
- package/dist/server/app-page-head.d.ts +54 -2
- package/dist/server/app-page-head.js +164 -78
- package/dist/server/app-page-http-access-fallback-metadata.d.ts +29 -0
- package/dist/server/app-page-http-access-fallback-metadata.js +106 -0
- package/dist/server/app-page-render.d.ts +2 -2
- package/dist/server/app-page-render.js +1 -1
- package/dist/server/app-page-request.d.ts +12 -0
- package/dist/server/app-page-request.js +134 -14
- package/dist/server/app-page-route-wiring.d.ts +9 -0
- package/dist/server/app-page-route-wiring.js +44 -4
- package/dist/server/app-post-middleware-context.d.ts +1 -1
- package/dist/server/app-post-middleware-context.js +1 -1
- package/dist/server/app-route-handler-dispatch.js +31 -17
- package/dist/server/app-route-handler-execution.d.ts +6 -1
- package/dist/server/app-route-handler-execution.js +41 -15
- package/dist/server/app-route-handler-policy.d.ts +2 -0
- package/dist/server/app-route-handler-policy.js +3 -3
- package/dist/server/app-route-module-loader.d.ts +3 -1
- package/dist/server/app-route-module-loader.js +1 -0
- package/dist/server/app-route-tree-prefetch.js +1 -1
- package/dist/server/app-rsc-cache-busting.d.ts +1 -1
- package/dist/server/app-rsc-cache-busting.js +1 -1
- package/dist/server/app-rsc-errors.d.ts +1 -1
- package/dist/server/app-rsc-errors.js +12 -2
- package/dist/server/app-rsc-handler.d.ts +10 -5
- package/dist/server/app-rsc-handler.js +51 -23
- package/dist/server/app-rsc-redirect-flight.d.ts +66 -0
- package/dist/server/app-rsc-redirect-flight.js +71 -0
- package/dist/server/app-rsc-request-normalization.d.ts +3 -2
- package/dist/server/app-rsc-request-normalization.js +8 -2
- package/dist/server/app-rsc-response-finalizer.d.ts +2 -2
- package/dist/server/app-rsc-response-finalizer.js +5 -11
- package/dist/server/app-rsc-route-matching.d.ts +20 -0
- package/dist/server/app-rsc-route-matching.js +87 -11
- package/dist/server/app-segment-config.js +15 -5
- package/dist/server/app-server-action-execution.d.ts +3 -1
- package/dist/server/app-server-action-execution.js +8 -6
- package/dist/server/app-ssr-entry.js +4 -1
- package/dist/server/app-ssr-stream.d.ts +2 -7
- package/dist/server/app-ssr-stream.js +5 -10
- package/dist/server/cache-proof.js +1 -1
- package/dist/server/config-headers.d.ts +24 -0
- package/dist/server/config-headers.js +52 -0
- package/dist/server/default-global-error-module.d.ts +3 -1
- package/dist/server/default-not-found-module.d.ts +3 -1
- package/dist/server/dev-initial-server-error.d.ts +1 -1
- package/dist/server/dev-lockfile.js +2 -3
- package/dist/server/dev-route-files.js +1 -1
- package/dist/server/dev-server.js +281 -173
- package/dist/server/dev-stack-sourcemap.js +4 -3
- package/dist/server/headers.d.ts +3 -1
- package/dist/server/headers.js +3 -1
- package/dist/server/image-optimization.js +2 -2
- package/dist/server/implicit-tags.js +2 -1
- package/dist/server/instrumentation.js +2 -2
- package/dist/server/isr-cache.d.ts +1 -1
- package/dist/server/isr-cache.js +1 -1
- package/dist/server/metadata-routes.js +4 -4
- package/dist/server/middleware-matcher-pattern.d.ts +22 -0
- package/dist/server/middleware-matcher-pattern.js +219 -0
- package/dist/server/middleware-matcher.d.ts +2 -7
- package/dist/server/middleware-matcher.js +13 -60
- package/dist/server/middleware-path-to-regexp.d.ts +14 -0
- package/dist/server/middleware-path-to-regexp.js +228 -0
- package/dist/server/middleware-response-headers.js +1 -1
- package/dist/server/middleware-runtime.js +5 -4
- package/dist/server/middleware.d.ts +2 -1
- package/dist/server/middleware.js +3 -2
- package/dist/server/navigation-planner.d.ts +2 -0
- package/dist/server/navigation-planner.js +8 -2
- package/dist/server/next-error-digest.d.ts +9 -24
- package/dist/server/next-error-digest.js +23 -15
- package/dist/server/operation-token.js +1 -1
- package/dist/server/pages-body-parser-config.js +2 -1
- package/dist/server/pages-data-route.d.ts +11 -1
- package/dist/server/pages-data-route.js +16 -1
- package/dist/server/pages-dev-hydration.d.ts +14 -0
- package/dist/server/pages-dev-hydration.js +83 -0
- package/dist/server/pages-dev-module-url.js +2 -2
- package/dist/server/pages-get-initial-props.d.ts +15 -2
- package/dist/server/pages-get-initial-props.js +16 -6
- package/dist/server/pages-node-compat.d.ts +13 -6
- package/dist/server/pages-node-compat.js +44 -45
- package/dist/server/pages-page-data.d.ts +4 -2
- package/dist/server/pages-page-data.js +20 -10
- package/dist/server/pages-page-handler.d.ts +4 -2
- package/dist/server/pages-page-handler.js +74 -43
- package/dist/server/pages-page-response.d.ts +2 -2
- package/dist/server/pages-page-response.js +1 -1
- package/dist/server/pages-preview.d.ts +26 -0
- package/dist/server/pages-preview.js +165 -0
- package/dist/server/pages-readiness.d.ts +5 -4
- package/dist/server/pages-readiness.js +4 -2
- package/dist/server/pages-request-pipeline.d.ts +1 -0
- package/dist/server/pages-request-pipeline.js +25 -11
- package/dist/server/pages-router-entry.js +6 -0
- package/dist/server/prerender-route-params.js +2 -2
- package/dist/server/prod-server.d.ts +1 -4
- package/dist/server/prod-server.js +44 -30
- package/dist/server/request-pipeline.d.ts +15 -29
- package/dist/server/request-pipeline.js +25 -60
- package/dist/server/rsc-stream-hints.js +122 -18
- package/dist/server/seed-cache.js +1 -1
- package/dist/server/socket-error-backstop.js +1 -1
- package/dist/server/static-file-cache.js +7 -8
- package/dist/server/worker-utils.js +1 -1
- package/dist/shims/app.d.ts +1 -1
- package/dist/shims/cache-request-state.d.ts +27 -1
- package/dist/shims/cache-request-state.js +60 -1
- package/dist/shims/cache-runtime.d.ts +12 -1
- package/dist/shims/cache-runtime.js +22 -7
- package/dist/shims/cache.d.ts +5 -5
- package/dist/shims/cache.js +28 -11
- package/dist/shims/constants.js +1 -1
- package/dist/shims/document.d.ts +42 -83
- package/dist/shims/document.js +62 -53
- package/dist/shims/dynamic.d.ts +5 -25
- package/dist/shims/dynamic.js +29 -8
- package/dist/shims/error-boundary.d.ts +4 -4
- package/dist/shims/error.d.ts +22 -6
- package/dist/shims/error.js +53 -15
- package/dist/shims/fetch-cache.js +13 -4
- package/dist/shims/font-google-base.d.ts +11 -4
- package/dist/shims/font-local.d.ts +10 -3
- package/dist/shims/font-utils.js +1 -1
- package/dist/shims/form.d.ts +1 -1
- package/dist/shims/head.d.ts +13 -2
- package/dist/shims/head.js +6 -6
- package/dist/shims/headers.d.ts +28 -31
- package/dist/shims/headers.js +115 -53
- package/dist/shims/image.d.ts +27 -37
- package/dist/shims/image.js +21 -14
- package/dist/shims/internal/cookie-serialize.d.ts +3 -1
- package/dist/shims/internal/cookie-serialize.js +3 -1
- package/dist/shims/internal/hybrid-client-route-owner.js +3 -1
- package/dist/shims/internal/pages-data-fetch-dedup.js +5 -3
- package/dist/shims/internal/utils.d.ts +3 -3
- package/dist/shims/layout-segment-context.d.ts +1 -1
- package/dist/shims/legacy-image.d.ts +3 -37
- package/dist/shims/legacy-image.js +6 -16
- package/dist/shims/link.d.ts +16 -21
- package/dist/shims/link.js +25 -13
- package/dist/shims/navigation-context-state.d.ts +1 -1
- package/dist/shims/navigation-errors.d.ts +2 -1
- package/dist/shims/navigation-errors.js +9 -13
- package/dist/shims/navigation.d.ts +8 -4
- package/dist/shims/navigation.js +29 -18
- package/dist/shims/next-shims-augmentations.d.ts +1 -0
- package/dist/shims/next-shims-public.d.ts +1 -0
- package/dist/shims/public-shim-map.json.js +103 -0
- package/dist/shims/readonly-url-search-params.d.ts +3 -3
- package/dist/shims/readonly-url-search-params.js +3 -3
- package/dist/shims/request-state-types.d.ts +1 -1
- package/dist/shims/router-state.d.ts +1 -0
- package/dist/shims/router.d.ts +57 -22
- package/dist/shims/router.js +178 -46
- package/dist/shims/script.d.ts +6 -10
- package/dist/shims/script.js +7 -4
- package/dist/shims/server.d.ts +45 -22
- package/dist/shims/server.js +46 -7
- package/dist/shims/slot.d.ts +1 -1
- package/dist/shims/thenable-params.js +1 -1
- package/dist/shims/unified-request-context.d.ts +1 -1
- package/dist/shims/unified-request-context.js +2 -0
- package/dist/shims/url-safety.d.ts +1 -1
- package/dist/shims/url-safety.js +2 -2
- package/dist/typegen.d.ts +8 -2
- package/dist/typegen.js +84 -25
- package/dist/utils/client-build-manifest.js +2 -2
- package/dist/utils/client-entry-manifest.js +1 -1
- package/dist/utils/client-runtime-metadata.js +1 -1
- package/dist/utils/commonjs-loader.js +3 -3
- package/dist/utils/domain-locale.d.ts +2 -2
- package/dist/utils/external-url.d.ts +5 -0
- package/dist/utils/external-url.js +7 -0
- package/dist/utils/mdx-scan.js +1 -1
- package/dist/utils/path.d.ts +1 -13
- package/dist/utils/path.js +1 -15
- package/dist/utils/plugin-options.d.ts +4 -0
- package/dist/utils/plugin-options.js +8 -0
- package/dist/utils/project.d.ts +0 -6
- package/dist/utils/project.js +2 -8
- package/dist/utils/public-routes.js +2 -2
- package/dist/utils/react-version.js +1 -1
- package/dist/utils/redirect-digest.d.ts +9 -0
- package/dist/utils/redirect-digest.js +25 -0
- package/dist/utils/regex-safety.d.ts +8 -0
- package/dist/utils/regex-safety.js +737 -0
- package/dist/utils/vinext-root.js +1 -1
- package/dist/utils/vite-version.d.ts +5 -2
- package/dist/utils/vite-version.js +43 -17
- package/package.json +16 -4
- /package/dist/build/google-fonts/{fallback-metrics-data.js → fallback-metrics-data.json.js} +0 -0
- /package/dist/build/google-fonts/{font-data.js → font-data.json.js} +0 -0
- /package/dist/{node_modules/.pnpm/process-ancestry@0.1.0/node_modules → deps/.pnpm/process-ancestry@0.1.0/deps}/process-ancestry/dist/index.js +0 -0
package/dist/shims/script.js
CHANGED
|
@@ -78,9 +78,12 @@ function buildBeforeInteractiveScriptProps(options) {
|
|
|
78
78
|
if (options.src) scriptProps.src = options.src;
|
|
79
79
|
if (options.id) scriptProps.id = options.id;
|
|
80
80
|
if (options.resolvedNonce) scriptProps.nonce = options.resolvedNonce;
|
|
81
|
-
if (options.dangerouslySetInnerHTML) scriptProps.dangerouslySetInnerHTML = { __html: escapeInlineContent(options.dangerouslySetInnerHTML.__html, "script") };
|
|
81
|
+
if (options.dangerouslySetInnerHTML) scriptProps.dangerouslySetInnerHTML = { __html: escapeInlineContent(stringifyInlineContent(options.dangerouslySetInnerHTML.__html), "script") };
|
|
82
82
|
return scriptProps;
|
|
83
83
|
}
|
|
84
|
+
function stringifyInlineContent(value) {
|
|
85
|
+
return String(value);
|
|
86
|
+
}
|
|
84
87
|
/**
|
|
85
88
|
* Extract the inline script content for a `beforeInteractive` Script element
|
|
86
89
|
* with no `src`. Returns `null` when the element has neither a string-shaped
|
|
@@ -93,7 +96,7 @@ function buildBeforeInteractiveScriptProps(options) {
|
|
|
93
96
|
* to the emit point so the rule is obvious at the boundary).
|
|
94
97
|
*/
|
|
95
98
|
function extractBeforeInteractiveInlineContent(children, dangerouslySetInnerHTML) {
|
|
96
|
-
if (dangerouslySetInnerHTML &&
|
|
99
|
+
if (dangerouslySetInnerHTML && stringifyInlineContent(dangerouslySetInnerHTML.__html).length > 0) return stringifyInlineContent(dangerouslySetInnerHTML.__html);
|
|
97
100
|
if (typeof children === "string" && children.length > 0) return children;
|
|
98
101
|
if (Array.isArray(children) && children.every((c) => typeof c === "string")) {
|
|
99
102
|
const joined = children.join("");
|
|
@@ -130,7 +133,7 @@ const REACT_TO_HTML_ATTR = {
|
|
|
130
133
|
* `REACT_TO_HTML_ATTR`.
|
|
131
134
|
*/
|
|
132
135
|
function collectBeforeInteractiveAttributes(rest) {
|
|
133
|
-
const RESERVED = new Set([
|
|
136
|
+
const RESERVED = /* @__PURE__ */ new Set([
|
|
134
137
|
"id",
|
|
135
138
|
"nonce",
|
|
136
139
|
"src",
|
|
@@ -220,7 +223,7 @@ function loadClientScript(props, options) {
|
|
|
220
223
|
onReady?.();
|
|
221
224
|
};
|
|
222
225
|
if (dangerouslySetInnerHTML?.__html) {
|
|
223
|
-
el.innerHTML = dangerouslySetInnerHTML.__html;
|
|
226
|
+
el.innerHTML = stringifyInlineContent(dangerouslySetInnerHTML.__html);
|
|
224
227
|
markLoaded();
|
|
225
228
|
} else if (children && typeof children === "string") {
|
|
226
229
|
el.textContent = children;
|
package/dist/shims/server.d.ts
CHANGED
|
@@ -9,28 +9,36 @@
|
|
|
9
9
|
* This is a pragmatic subset — we implement the most commonly used APIs
|
|
10
10
|
* rather than bug-for-bug parity with Next.js internals.
|
|
11
11
|
*/
|
|
12
|
+
/** @deprecated Import ImageResponse from `next/og` instead. */
|
|
13
|
+
declare function ImageResponse(): never;
|
|
14
|
+
type RequestInit = globalThis.RequestInit & {
|
|
15
|
+
nextConfig?: {
|
|
16
|
+
basePath?: string;
|
|
17
|
+
i18n?: {
|
|
18
|
+
locales: readonly string[];
|
|
19
|
+
defaultLocale: string;
|
|
20
|
+
domains?: ReadonlyArray<{
|
|
21
|
+
domain: string;
|
|
22
|
+
defaultLocale: string;
|
|
23
|
+
locales?: readonly string[];
|
|
24
|
+
http?: true;
|
|
25
|
+
}>;
|
|
26
|
+
} | null;
|
|
27
|
+
trailingSlash?: boolean;
|
|
28
|
+
};
|
|
29
|
+
signal?: AbortSignal;
|
|
30
|
+
duplex?: "half";
|
|
31
|
+
};
|
|
12
32
|
declare class NextRequest extends Request {
|
|
13
33
|
private _nextUrl;
|
|
14
34
|
private _url;
|
|
15
35
|
private _cookies;
|
|
16
|
-
constructor(input: URL | RequestInfo, init?: RequestInit
|
|
17
|
-
nextConfig?: {
|
|
18
|
-
basePath?: string;
|
|
19
|
-
i18n?: {
|
|
20
|
-
locales: string[];
|
|
21
|
-
defaultLocale: string;
|
|
22
|
-
domains?: Array<{
|
|
23
|
-
domain: string;
|
|
24
|
-
defaultLocale: string;
|
|
25
|
-
locales?: string[];
|
|
26
|
-
}>;
|
|
27
|
-
};
|
|
28
|
-
trailingSlash?: boolean;
|
|
29
|
-
};
|
|
30
|
-
});
|
|
36
|
+
constructor(input: URL | RequestInfo, init?: RequestInit);
|
|
31
37
|
get nextUrl(): NextURL;
|
|
32
38
|
get url(): string;
|
|
33
39
|
get cookies(): RequestCookies;
|
|
40
|
+
get page(): void;
|
|
41
|
+
get ua(): void;
|
|
34
42
|
/**
|
|
35
43
|
* Client IP address. Prefers Cloudflare's trusted CF-Connecting-IP header
|
|
36
44
|
* over the spoofable X-Forwarded-For. Returns undefined if unavailable.
|
|
@@ -65,12 +73,16 @@ declare class NextResponse<_Body = unknown> extends Response {
|
|
|
65
73
|
/**
|
|
66
74
|
* Create a redirect response.
|
|
67
75
|
*/
|
|
68
|
-
static redirect(url: string | URL |
|
|
76
|
+
static redirect(url: string | URL | {
|
|
77
|
+
toString(): string;
|
|
78
|
+
}, init?: number | ResponseInit): NextResponse;
|
|
69
79
|
/**
|
|
70
80
|
* Create a rewrite response (middleware pattern).
|
|
71
81
|
* Sets the x-middleware-rewrite header.
|
|
72
82
|
*/
|
|
73
|
-
static rewrite(destination: string | URL |
|
|
83
|
+
static rewrite(destination: string | URL | {
|
|
84
|
+
toString(): string;
|
|
85
|
+
}, init?: MiddlewareResponseInit): NextResponse;
|
|
74
86
|
/**
|
|
75
87
|
* Continue to the next handler (middleware pattern).
|
|
76
88
|
* Sets the x-middleware-next header.
|
|
@@ -176,6 +188,7 @@ declare class NextURL {
|
|
|
176
188
|
get locales(): string[] | undefined;
|
|
177
189
|
clone(): NextURL;
|
|
178
190
|
toString(): string;
|
|
191
|
+
toJSON(): string;
|
|
179
192
|
/**
|
|
180
193
|
* The build ID of the Next.js application.
|
|
181
194
|
* Set from `generateBuildId` in next.config.js, or a random UUID if not configured.
|
|
@@ -202,7 +215,7 @@ declare class RequestCookies {
|
|
|
202
215
|
toString(): string;
|
|
203
216
|
private _serialize;
|
|
204
217
|
private _syncHeader;
|
|
205
|
-
[Symbol.iterator]():
|
|
218
|
+
[Symbol.iterator](): MapIterator<[string, CookieEntry]>;
|
|
206
219
|
}
|
|
207
220
|
declare function sealRequestHeaders(headers: Headers): Headers;
|
|
208
221
|
declare function sealRequestCookies(cookies: RequestCookies): RequestCookies;
|
|
@@ -225,7 +238,7 @@ declare class ResponseCookies {
|
|
|
225
238
|
delete(...args: [name: string] | [options: Omit<CookieOptions & {
|
|
226
239
|
name: string;
|
|
227
240
|
}, "maxAge" | "expires">]): this;
|
|
228
|
-
[Symbol.iterator]():
|
|
241
|
+
[Symbol.iterator](): MapIterator<[string, CookieEntry]>;
|
|
229
242
|
/** Delete all Set-Cookie headers and re-append from the internal map. */
|
|
230
243
|
private _syncHeaders;
|
|
231
244
|
}
|
|
@@ -233,10 +246,12 @@ type CookieOptions = {
|
|
|
233
246
|
path?: string;
|
|
234
247
|
domain?: string;
|
|
235
248
|
maxAge?: number;
|
|
236
|
-
expires?: Date;
|
|
249
|
+
expires?: Date | number;
|
|
237
250
|
httpOnly?: boolean;
|
|
238
251
|
secure?: boolean;
|
|
239
|
-
sameSite?: "Strict" | "Lax" | "None";
|
|
252
|
+
sameSite?: true | false | "strict" | "lax" | "none" | "Strict" | "Lax" | "None";
|
|
253
|
+
partitioned?: boolean;
|
|
254
|
+
priority?: "low" | "medium" | "high";
|
|
240
255
|
};
|
|
241
256
|
type MiddlewareResponseInit = {
|
|
242
257
|
request?: {
|
|
@@ -253,8 +268,16 @@ declare class NextFetchEvent {
|
|
|
253
268
|
sourcePage: string;
|
|
254
269
|
private _waitUntilPromises;
|
|
255
270
|
constructor(params: {
|
|
271
|
+
request?: Request;
|
|
256
272
|
page: string;
|
|
273
|
+
context?: {
|
|
274
|
+
waitUntil(promise: Promise<unknown>): void;
|
|
275
|
+
};
|
|
257
276
|
});
|
|
277
|
+
private _externalWaitUntil?;
|
|
278
|
+
get request(): void;
|
|
279
|
+
respondWith(): void;
|
|
280
|
+
passThroughOnException(): void;
|
|
258
281
|
waitUntil(promise: Promise<unknown>): void;
|
|
259
282
|
get waitUntilPromises(): Promise<unknown>[];
|
|
260
283
|
/** Drain all waitUntil promises. Returns a single promise that settles when all are done. */
|
|
@@ -320,4 +343,4 @@ declare function connection(): Promise<void>;
|
|
|
320
343
|
*/
|
|
321
344
|
declare const URLPattern: typeof globalThis.URLPattern;
|
|
322
345
|
//#endregion
|
|
323
|
-
export { MiddlewareResponseInit, NextFetchEvent, NextMiddleware, NextMiddlewareResult, NextRequest, NextResponse, NextURL, NextURLConfig, RequestCookies, ResponseCookies, URLPattern, UserAgent, after, connection, sealRequestCookies, sealRequestHeaders, userAgent, userAgentFromString };
|
|
346
|
+
export { ImageResponse, MiddlewareResponseInit, NextFetchEvent, NextMiddleware, NextMiddlewareResult, NextRequest, NextResponse, NextURL, NextURLConfig, RequestCookies, RequestInit, ResponseCookies, URLPattern, UserAgent, after, connection, sealRequestCookies, sealRequestHeaders, userAgent, userAgentFromString };
|
package/dist/shims/server.js
CHANGED
|
@@ -17,6 +17,10 @@ import { assertSafeNavigationUrl } from "./url-safety.js";
|
|
|
17
17
|
* This is a pragmatic subset — we implement the most commonly used APIs
|
|
18
18
|
* rather than bug-for-bug parity with Next.js internals.
|
|
19
19
|
*/
|
|
20
|
+
/** @deprecated Import ImageResponse from `next/og` instead. */
|
|
21
|
+
function ImageResponse() {
|
|
22
|
+
throw new Error("ImageResponse has moved from next/server to next/og");
|
|
23
|
+
}
|
|
20
24
|
const _USE_CACHE_ALS_KEY = Symbol.for("vinext.cacheRuntime.contextAls");
|
|
21
25
|
const _UNSTABLE_CACHE_ALS_KEY = Symbol.for("vinext.unstableCache.als");
|
|
22
26
|
const _g = globalThis;
|
|
@@ -60,10 +64,18 @@ var NextRequest = class extends Request {
|
|
|
60
64
|
});
|
|
61
65
|
} else super(input, requestInit);
|
|
62
66
|
const url = typeof input === "string" ? new URL(input, "http://localhost") : input instanceof URL ? input : new URL(input.url, "http://localhost");
|
|
67
|
+
const i18n = _nextConfig?.i18n ? {
|
|
68
|
+
locales: [..._nextConfig.i18n.locales],
|
|
69
|
+
defaultLocale: _nextConfig.i18n.defaultLocale,
|
|
70
|
+
domains: _nextConfig.i18n.domains?.map((domain) => ({
|
|
71
|
+
...domain,
|
|
72
|
+
locales: domain.locales ? [...domain.locales] : void 0
|
|
73
|
+
}))
|
|
74
|
+
} : void 0;
|
|
63
75
|
const urlConfig = _nextConfig ? {
|
|
64
76
|
basePath: _nextConfig.basePath,
|
|
65
77
|
nextConfig: {
|
|
66
|
-
i18n
|
|
78
|
+
i18n,
|
|
67
79
|
trailingSlash: _nextConfig.trailingSlash
|
|
68
80
|
}
|
|
69
81
|
} : void 0;
|
|
@@ -80,6 +92,12 @@ var NextRequest = class extends Request {
|
|
|
80
92
|
get cookies() {
|
|
81
93
|
return this._cookies;
|
|
82
94
|
}
|
|
95
|
+
get page() {
|
|
96
|
+
throw new Error("NextRequest.page has been removed; use URLPattern instead");
|
|
97
|
+
}
|
|
98
|
+
get ua() {
|
|
99
|
+
throw new Error("NextRequest.ua has been removed; use userAgent() instead");
|
|
100
|
+
}
|
|
83
101
|
/**
|
|
84
102
|
* Client IP address. Prefers Cloudflare's trusted CF-Connecting-IP header
|
|
85
103
|
* over the spoofable X-Forwarded-For. Returns undefined if unavailable.
|
|
@@ -112,7 +130,7 @@ var NextRequest = class extends Request {
|
|
|
112
130
|
}
|
|
113
131
|
};
|
|
114
132
|
/** Valid HTTP redirect status codes, matching Next.js's REDIRECTS set. */
|
|
115
|
-
const REDIRECT_STATUSES = new Set([
|
|
133
|
+
const REDIRECT_STATUSES = /* @__PURE__ */ new Set([
|
|
116
134
|
301,
|
|
117
135
|
302,
|
|
118
136
|
303,
|
|
@@ -407,6 +425,9 @@ var NextURL = class NextURL {
|
|
|
407
425
|
toString() {
|
|
408
426
|
return this.href;
|
|
409
427
|
}
|
|
428
|
+
toJSON() {
|
|
429
|
+
return this.href;
|
|
430
|
+
}
|
|
410
431
|
/**
|
|
411
432
|
* The build ID of the Next.js application.
|
|
412
433
|
* Set from `generateBuildId` in next.config.js, or a random UUID if not configured.
|
|
@@ -489,7 +510,7 @@ var RequestCookies = class {
|
|
|
489
510
|
else this._headers.set("cookie", this._serialize());
|
|
490
511
|
}
|
|
491
512
|
[Symbol.iterator]() {
|
|
492
|
-
return this.getAll().map((
|
|
513
|
+
return new Map(this.getAll().map((cookie) => [cookie.name, cookie])).entries();
|
|
493
514
|
}
|
|
494
515
|
};
|
|
495
516
|
var ReadonlyRequestCookiesError = class ReadonlyRequestCookiesError extends Error {
|
|
@@ -500,7 +521,7 @@ var ReadonlyRequestCookiesError = class ReadonlyRequestCookiesError extends Erro
|
|
|
500
521
|
throw new ReadonlyRequestCookiesError();
|
|
501
522
|
}
|
|
502
523
|
};
|
|
503
|
-
const REQUEST_HEADERS_MUTATING_METHODS = new Set([
|
|
524
|
+
const REQUEST_HEADERS_MUTATING_METHODS = /* @__PURE__ */ new Set([
|
|
504
525
|
"set",
|
|
505
526
|
"delete",
|
|
506
527
|
"append"
|
|
@@ -557,7 +578,12 @@ var ResponseCookies = class {
|
|
|
557
578
|
set(...args) {
|
|
558
579
|
const [name, value, opts] = parseCookieSetArgs(args);
|
|
559
580
|
validateCookieName(name);
|
|
560
|
-
const
|
|
581
|
+
const sameSite = opts?.sameSite === true ? "Strict" : typeof opts?.sameSite === "string" ? opts.sameSite[0].toUpperCase() + opts.sameSite.slice(1) : void 0;
|
|
582
|
+
const serialized = serializeSetCookie(name, value, {
|
|
583
|
+
...opts,
|
|
584
|
+
expires: typeof opts?.expires === "number" ? new Date(opts.expires) : opts?.expires,
|
|
585
|
+
sameSite
|
|
586
|
+
});
|
|
561
587
|
this._parsed.set(name, {
|
|
562
588
|
serialized,
|
|
563
589
|
entry: {
|
|
@@ -595,7 +621,7 @@ var ResponseCookies = class {
|
|
|
595
621
|
});
|
|
596
622
|
}
|
|
597
623
|
[Symbol.iterator]() {
|
|
598
|
-
return [...this._parsed.values()].map((
|
|
624
|
+
return new Map([...this._parsed.values()].map(({ entry }) => [entry.name, entry])).entries();
|
|
599
625
|
}
|
|
600
626
|
/** Delete all Set-Cookie headers and re-append from the internal map. */
|
|
601
627
|
_syncHeaders() {
|
|
@@ -655,8 +681,21 @@ var NextFetchEvent = class {
|
|
|
655
681
|
_waitUntilPromises = [];
|
|
656
682
|
constructor(params) {
|
|
657
683
|
this.sourcePage = params.page;
|
|
684
|
+
if (params.context) this._externalWaitUntil = params.context.waitUntil.bind(params.context);
|
|
685
|
+
}
|
|
686
|
+
_externalWaitUntil;
|
|
687
|
+
get request() {
|
|
688
|
+
throw new Error(`The middleware signature for ${this.sourcePage} no longer exposes event.request`);
|
|
658
689
|
}
|
|
690
|
+
respondWith() {
|
|
691
|
+
throw new Error(`The middleware signature for ${this.sourcePage} no longer uses respondWith()`);
|
|
692
|
+
}
|
|
693
|
+
passThroughOnException() {}
|
|
659
694
|
waitUntil(promise) {
|
|
695
|
+
if (this._externalWaitUntil) {
|
|
696
|
+
this._externalWaitUntil(promise);
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
660
699
|
this._waitUntilPromises.push(promise);
|
|
661
700
|
}
|
|
662
701
|
get waitUntilPromises() {
|
|
@@ -727,4 +766,4 @@ const URLPattern = globalThis.URLPattern ?? (() => {
|
|
|
727
766
|
throw new Error("URLPattern is not available in this runtime. Install the `urlpattern-polyfill` package or upgrade to Node 20+.");
|
|
728
767
|
});
|
|
729
768
|
//#endregion
|
|
730
|
-
export { NextFetchEvent, NextRequest, NextResponse, NextURL, RequestCookies, ResponseCookies, URLPattern, after, connection, sealRequestCookies, sealRequestHeaders, userAgent, userAgentFromString };
|
|
769
|
+
export { ImageResponse, NextFetchEvent, NextRequest, NextResponse, NextURL, RequestCookies, ResponseCookies, URLPattern, after, connection, sealRequestCookies, sealRequestHeaders, userAgent, userAgentFromString };
|
package/dist/shims/slot.d.ts
CHANGED
|
@@ -40,6 +40,6 @@ declare function ParallelSlot({
|
|
|
40
40
|
name
|
|
41
41
|
}: {
|
|
42
42
|
name: string;
|
|
43
|
-
}): string | number | bigint | boolean |
|
|
43
|
+
}): string | number | bigint | boolean | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | Iterable<React$1.ReactNode> | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | React$1.ReactPortal | null | undefined> | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | null;
|
|
44
44
|
//#endregion
|
|
45
45
|
export { BfcacheSlotEntry, BfcacheStateKeyMapContext, Children, ChildrenContext, ElementsContext, ParallelSlot, ParallelSlotsContext, Slot, UNMATCHED_SLOT, mergeElements, updateBfcacheSlotEntryOrder };
|
|
@@ -3,7 +3,7 @@ import { createPprFallbackShellSuspensePromiseForState, getPprFallbackShellState
|
|
|
3
3
|
function hasParamProperty(obj, prop) {
|
|
4
4
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
5
5
|
}
|
|
6
|
-
const wellKnownProperties = new Set([
|
|
6
|
+
const wellKnownProperties = /* @__PURE__ */ new Set([
|
|
7
7
|
"hasOwnProperty",
|
|
8
8
|
"isPrototypeOf",
|
|
9
9
|
"propertyIsEnumerable",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RootParamsState } from "./root-params.js";
|
|
2
1
|
import { CacheState } from "./cache-request-state.js";
|
|
2
|
+
import { RootParamsState } from "./root-params.js";
|
|
3
3
|
import { ExecutionContextLike } from "./request-context.js";
|
|
4
4
|
import { FetchCacheState } from "./fetch-cache.js";
|
|
5
5
|
import { VinextHeadersShimState } from "./headers.js";
|
|
@@ -16,6 +16,8 @@ function createRequestContext(opts) {
|
|
|
16
16
|
return {
|
|
17
17
|
headersContext: null,
|
|
18
18
|
actionRevalidationKind: 0,
|
|
19
|
+
pendingRevalidatedTags: /* @__PURE__ */ new Set(),
|
|
20
|
+
pendingRevalidations: /* @__PURE__ */ new Set(),
|
|
19
21
|
dynamicUsageDetected: false,
|
|
20
22
|
renderRequestApiUsage: /* @__PURE__ */ new Set(),
|
|
21
23
|
connectionProbe: null,
|
|
@@ -29,6 +29,6 @@ declare function isDangerousScheme(url: string): boolean;
|
|
|
29
29
|
* packages/next/src/shared/lib/router/router.ts:1025,1057
|
|
30
30
|
*/
|
|
31
31
|
declare function reportBlockedDangerousNavigation(): void;
|
|
32
|
-
declare function assertSafeNavigationUrl(url: string): void;
|
|
32
|
+
declare function assertSafeNavigationUrl(url: string, ErrorConstructor?: new (message: string) => Error): void;
|
|
33
33
|
//#endregion
|
|
34
34
|
export { DANGEROUS_URL_BLOCK_MESSAGE, assertSafeNavigationUrl, isDangerousScheme, reportBlockedDangerousNavigation };
|
package/dist/shims/url-safety.js
CHANGED
|
@@ -60,10 +60,10 @@ function isDangerousScheme(url) {
|
|
|
60
60
|
function reportBlockedDangerousNavigation() {
|
|
61
61
|
console.error(DANGEROUS_URL_BLOCK_MESSAGE);
|
|
62
62
|
}
|
|
63
|
-
function assertSafeNavigationUrl(url) {
|
|
63
|
+
function assertSafeNavigationUrl(url, ErrorConstructor = Error) {
|
|
64
64
|
if (isDangerousScheme(url)) {
|
|
65
65
|
reportBlockedDangerousNavigation();
|
|
66
|
-
throw new
|
|
66
|
+
throw new ErrorConstructor(DANGEROUS_URL_BLOCK_MESSAGE);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
//#endregion
|
package/dist/typegen.d.ts
CHANGED
|
@@ -4,6 +4,12 @@ type GenerateRouteTypesOptions = {
|
|
|
4
4
|
appDir?: string | null;
|
|
5
5
|
pageExtensions?: readonly string[];
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type GenerateRouteTypesResult = {
|
|
8
|
+
routeTypesPath: string;
|
|
9
|
+
nextEnvPath: string;
|
|
10
|
+
nextEnvStatus: "created" | "updated" | "unchanged";
|
|
11
|
+
};
|
|
12
|
+
declare function nextEnvFileContent(hasNext: boolean, hasAppDir: boolean, eol?: string): string;
|
|
13
|
+
declare function generateRouteTypes(options: GenerateRouteTypesOptions): Promise<GenerateRouteTypesResult>;
|
|
8
14
|
//#endregion
|
|
9
|
-
export { generateRouteTypes };
|
|
15
|
+
export { GenerateRouteTypesResult, generateRouteTypes, nextEnvFileContent };
|
package/dist/typegen.js
CHANGED
|
@@ -1,39 +1,85 @@
|
|
|
1
|
+
import path from "./deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
|
|
1
2
|
import { findDir } from "./utils/project.js";
|
|
2
|
-
import { normalizePathSeparators } from "./utils/path.js";
|
|
3
3
|
import { decodeRouteSegment, isInvisibleSegment } from "./routing/utils.js";
|
|
4
4
|
import { patternToNextFormat } from "./routing/route-validation.js";
|
|
5
5
|
import { compareStrings } from "./utils/compare.js";
|
|
6
|
-
import "./routing/app-route-graph.js";
|
|
7
6
|
import { appRouteGraph } from "./routing/app-router.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
7
|
+
import { createRequire } from "node:module";
|
|
8
|
+
import fsp from "node:fs/promises";
|
|
9
|
+
import os from "node:os";
|
|
10
10
|
//#region src/typegen.ts
|
|
11
|
-
|
|
11
|
+
function nextEnvFileContent(hasNext, hasAppDir, eol = "\n") {
|
|
12
|
+
return `${hasNext ? `/// <reference types="next" />
|
|
12
13
|
/// <reference types="next/image-types/global" />
|
|
13
|
-
import "
|
|
14
|
+
import "vinext/types/augmentations";
|
|
15
|
+
` : `import "vinext/types";
|
|
16
|
+
`}import "./.next/types/routes.d.ts";
|
|
14
17
|
|
|
15
18
|
// NOTE: This file should not be edited
|
|
16
|
-
// see https://nextjs.org/docs
|
|
17
|
-
|
|
19
|
+
// see https://nextjs.org/docs/${hasAppDir ? "app" : "pages"}/api-reference/config/typescript for more information.
|
|
20
|
+
`.replaceAll("\n", eol);
|
|
21
|
+
}
|
|
18
22
|
async function generateRouteTypes(options) {
|
|
19
|
-
const root =
|
|
20
|
-
const appDir = options.appDir ?
|
|
21
|
-
const outPath = path.
|
|
22
|
-
const
|
|
23
|
-
await
|
|
24
|
-
await
|
|
25
|
-
await
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
const root = path.resolve(options.root);
|
|
24
|
+
const appDir = options.appDir === null ? null : options.appDir ? path.resolve(options.appDir) : findDir(root, "app", "src/app");
|
|
25
|
+
const outPath = path.join(root, ".next", "types", "routes.d.ts");
|
|
26
|
+
const pagesDir = findDir(root, "pages", "src/pages");
|
|
27
|
+
const content = appDir ? renderRouteTypes(await collectRouteTypeModel(appDir, options.pageExtensions), pagesDir !== null) : renderRouteTypes(emptyRouteTypeModel(), false);
|
|
28
|
+
await fsp.mkdir(path.dirname(outPath), { recursive: true });
|
|
29
|
+
await fsp.writeFile(outPath, content, "utf-8");
|
|
30
|
+
const nextEnv = await ensureNextEnvFile(root, appDir !== null);
|
|
31
|
+
return {
|
|
32
|
+
routeTypesPath: outPath,
|
|
33
|
+
nextEnvPath: nextEnv.path,
|
|
34
|
+
nextEnvStatus: nextEnv.status
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
async function ensureNextEnvFile(root, hasAppDir) {
|
|
38
|
+
const envPath = path.join(root, "next-env.d.ts");
|
|
39
|
+
let eol = os.EOL;
|
|
40
|
+
let existing;
|
|
41
|
+
try {
|
|
42
|
+
existing = await fsp.readFile(envPath, "utf-8");
|
|
43
|
+
const newline = existing.indexOf("\n", 1);
|
|
44
|
+
if (newline !== -1) eol = existing[newline - 1] === "\r" ? "\r\n" : "\n";
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (error.code !== "ENOENT") throw error;
|
|
47
|
+
}
|
|
48
|
+
const content = nextEnvFileContent(await hasNextPackage(root), hasAppDir, eol);
|
|
49
|
+
if (existing === content) return {
|
|
50
|
+
path: envPath,
|
|
51
|
+
status: "unchanged"
|
|
52
|
+
};
|
|
53
|
+
await fsp.writeFile(envPath, content, "utf-8");
|
|
54
|
+
return {
|
|
55
|
+
path: envPath,
|
|
56
|
+
status: existing === void 0 ? "created" : "updated"
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
async function hasNextPackage(root) {
|
|
60
|
+
const manifestPath = path.join(root, "package.json");
|
|
61
|
+
let declaresNext;
|
|
30
62
|
try {
|
|
31
|
-
await
|
|
32
|
-
|
|
33
|
-
|
|
63
|
+
const manifest = JSON.parse(await fsp.readFile(manifestPath, "utf-8"));
|
|
64
|
+
declaresNext = [
|
|
65
|
+
"dependencies",
|
|
66
|
+
"devDependencies",
|
|
67
|
+
"peerDependencies",
|
|
68
|
+
"optionalDependencies"
|
|
69
|
+
].some((field) => {
|
|
70
|
+
const dependencies = manifest[field];
|
|
71
|
+
return typeof dependencies === "object" && dependencies !== null && Object.hasOwn(dependencies, "next");
|
|
34
72
|
});
|
|
35
73
|
} catch (error) {
|
|
36
|
-
if (error.code !== "
|
|
74
|
+
if (error.code !== "ENOENT") throw error;
|
|
75
|
+
}
|
|
76
|
+
if (declaresNext === false) return false;
|
|
77
|
+
try {
|
|
78
|
+
const packageJsonPath = createRequire(manifestPath).resolve("next/package.json");
|
|
79
|
+
await fsp.access(packageJsonPath);
|
|
80
|
+
return true;
|
|
81
|
+
} catch {
|
|
82
|
+
return false;
|
|
37
83
|
}
|
|
38
84
|
}
|
|
39
85
|
function emptyRouteTypeModel() {
|
|
@@ -86,12 +132,23 @@ async function collectRouteTypeModel(appDir, pageExtensions) {
|
|
|
86
132
|
for (const slotNames of model.layoutSlots.values()) slotNames.sort(compareStrings);
|
|
87
133
|
return model;
|
|
88
134
|
}
|
|
89
|
-
function renderRouteTypes(model) {
|
|
135
|
+
function renderRouteTypes(model, hasPagesCompat) {
|
|
90
136
|
const allRoutes = uniqueSorted([
|
|
91
137
|
...model.pageRoutes,
|
|
92
138
|
...model.layoutRoutes,
|
|
93
139
|
...model.routeHandlerRoutes
|
|
94
140
|
]);
|
|
141
|
+
const navigationCompat = hasPagesCompat ? `
|
|
142
|
+
declare module "next/navigation" {
|
|
143
|
+
function useSearchParams(): import("next/navigation").ReadonlyURLSearchParams | null;
|
|
144
|
+
function usePathname(): string | null;
|
|
145
|
+
function useParams<
|
|
146
|
+
T extends Record<string, string | string[]> = Record<string, string | string[]>,
|
|
147
|
+
>(): T | null;
|
|
148
|
+
function useSelectedLayoutSegments(): string[] | null;
|
|
149
|
+
function useSelectedLayoutSegment(): string | null;
|
|
150
|
+
}
|
|
151
|
+
` : "";
|
|
95
152
|
return `// This file is generated by vinext. Do not edit.
|
|
96
153
|
import type * as React from "react";
|
|
97
154
|
|
|
@@ -128,6 +185,8 @@ ${renderLayoutSlotMap(model.layoutRoutes, model.layoutSlots)}
|
|
|
128
185
|
}
|
|
129
186
|
}
|
|
130
187
|
|
|
188
|
+
${navigationCompat}
|
|
189
|
+
|
|
131
190
|
export {};
|
|
132
191
|
`;
|
|
133
192
|
}
|
|
@@ -226,4 +285,4 @@ function quote(value) {
|
|
|
226
285
|
return JSON.stringify(value);
|
|
227
286
|
}
|
|
228
287
|
//#endregion
|
|
229
|
-
export { generateRouteTypes };
|
|
288
|
+
export { generateRouteTypes, nextEnvFileContent };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import path from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
|
|
1
2
|
import { isUnknownRecord } from "./record.js";
|
|
2
3
|
import { manifestFileWithBase } from "./manifest-paths.js";
|
|
3
4
|
import fs from "node:fs";
|
|
4
|
-
import path from "node:path";
|
|
5
5
|
//#region src/utils/client-build-manifest.ts
|
|
6
6
|
const PAGES_CLIENT_ENTRY_MARKERS = ["vinext-client-entry"];
|
|
7
7
|
const CLIENT_ENTRY_MARKERS = [...PAGES_CLIENT_ENTRY_MARKERS, "vinext-app-browser-entry"];
|
|
@@ -66,7 +66,7 @@ function findClientEntryFileInAssetsDir(options) {
|
|
|
66
66
|
if (entryFull) break;
|
|
67
67
|
}
|
|
68
68
|
if (!entryFull) return void 0;
|
|
69
|
-
return manifestFileWithBase(path.relative(options.clientDir, entryFull)
|
|
69
|
+
return manifestFileWithBase(path.relative(options.clientDir, entryFull), options.assetBase);
|
|
70
70
|
}
|
|
71
71
|
function findClientEntryFile(options) {
|
|
72
72
|
return (options.buildManifest ? findClientEntryFileFromManifest(options.buildManifest, options.assetBase) : void 0) ?? findClientEntryFileInAssetsDir({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import path from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
|
|
1
2
|
import { isUnknownRecord } from "./record.js";
|
|
2
3
|
import { manifestFileWithBase } from "./manifest-paths.js";
|
|
3
4
|
import fs from "node:fs";
|
|
4
|
-
import path from "node:path";
|
|
5
5
|
//#region src/utils/client-entry-manifest.ts
|
|
6
6
|
const VINEXT_CLIENT_ENTRY_MANIFEST = "vinext-client-entry-manifest.json";
|
|
7
7
|
function readClientEntryManifest(clientDir) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import path from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
|
|
1
2
|
import { isAbsoluteAssetPrefix, resolveAssetsDir } from "./asset-prefix.js";
|
|
2
3
|
import { manifestFileWithAssetPrefix, manifestFileWithBase } from "./manifest-paths.js";
|
|
3
4
|
import { findClientEntryFile, findPagesClientEntryFile, readClientBuildManifest } from "./client-build-manifest.js";
|
|
4
5
|
import { findClientEntryFileFromVinextManifest, findPagesClientEntryFileFromVinextManifest, readClientEntryManifest } from "./client-entry-manifest.js";
|
|
5
6
|
import { computeDynamicImportPreloads, computeLazyChunks, dynamicImportPreloadsWithBase } from "./lazy-chunks.js";
|
|
6
|
-
import path from "node:path";
|
|
7
7
|
//#region src/utils/client-runtime-metadata.ts
|
|
8
8
|
function collectAppBootstrapPreinitModules(buildManifest, appBrowserEntry, applyBase) {
|
|
9
9
|
if (!appBrowserEntry) return void 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, createRequire } from "node:module";
|
|
2
2
|
import fs from "node:fs";
|
|
3
|
-
import
|
|
3
|
+
import nodePath from "node:path";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
5
|
//#region src/utils/commonjs-loader.ts
|
|
6
6
|
const CommonJsModule = Module;
|
|
@@ -10,7 +10,7 @@ function canonicalPath(filePath) {
|
|
|
10
10
|
try {
|
|
11
11
|
return fs.realpathSync.native(resolvedPath);
|
|
12
12
|
} catch {
|
|
13
|
-
return
|
|
13
|
+
return nodePath.resolve(resolvedPath);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
function shouldRetryAsCommonJs(error, resolvedPath) {
|
|
@@ -47,7 +47,7 @@ function compileCommonJsModule(resolvedPath, parent) {
|
|
|
47
47
|
if (cached) return cached.exports;
|
|
48
48
|
const mod = new CommonJsModule(resolvedPath, parent);
|
|
49
49
|
mod.filename = resolvedPath;
|
|
50
|
-
mod.paths = CommonJsModule._nodeModulePaths(
|
|
50
|
+
mod.paths = CommonJsModule._nodeModulePaths(nodePath.dirname(resolvedPath));
|
|
51
51
|
req.cache[resolvedPath] = mod;
|
|
52
52
|
const originalRequire = mod.require.bind(mod);
|
|
53
53
|
mod.require = ((specifier) => {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
type DomainLocale = {
|
|
3
3
|
domain: string;
|
|
4
4
|
defaultLocale: string;
|
|
5
|
-
locales?: string[];
|
|
6
|
-
http?:
|
|
5
|
+
locales?: readonly string[];
|
|
6
|
+
http?: true;
|
|
7
7
|
};
|
|
8
8
|
declare function normalizeDomainHostname(hostname: string | null | undefined): string | undefined;
|
|
9
9
|
/**
|
package/dist/utils/mdx-scan.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import path from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
|
|
1
2
|
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
3
|
//#region src/utils/mdx-scan.ts
|
|
4
4
|
/** Module-level cache for hasMdxFiles — avoids re-scanning per Vite environment. */
|
|
5
5
|
const mdxScanCache = /* @__PURE__ */ new Map();
|
package/dist/utils/path.d.ts
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
//#region src/utils/path.d.ts
|
|
2
2
|
declare const isWindows: boolean;
|
|
3
|
-
/**
|
|
4
|
-
* Convert Windows-style backslash path separators to forward slashes.
|
|
5
|
-
*
|
|
6
|
-
* Generated entry modules embed absolute filesystem paths inside `import`
|
|
7
|
-
* statements. On Windows the OS-native paths use `\` which is invalid in JS
|
|
8
|
-
* module specifiers, so every entry generator normalizes paths through this
|
|
9
|
-
* helper before stringifying them into the emitted code.
|
|
10
|
-
*
|
|
11
|
-
* No-op on POSIX — skips the regex scan entirely since backslashes never
|
|
12
|
-
* appear in filesystem paths on Linux/macOS.
|
|
13
|
-
*/
|
|
14
|
-
declare function normalizePathSeparators(p: string): string;
|
|
15
3
|
declare function stripViteModuleQuery(id: string): string;
|
|
16
4
|
/** Strip a trailing `.js` extension from a module specifier so
|
|
17
5
|
* `resolveShimModulePath` looks for the correct base name (e.g. `headers.js`
|
|
@@ -20,4 +8,4 @@ declare function stripViteModuleQuery(id: string): string;
|
|
|
20
8
|
* files like `headers.js.ts`. */
|
|
21
9
|
declare function stripJsExtension(name: string): string;
|
|
22
10
|
//#endregion
|
|
23
|
-
export { isWindows,
|
|
11
|
+
export { isWindows, stripJsExtension, stripViteModuleQuery };
|