vinext 0.2.1 → 1.0.0-beta.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 +67 -30
- package/dist/build/assets-ignore.js +1 -1
- package/dist/build/clean-output.js +1 -1
- package/dist/build/client-build-config.d.ts +13 -92
- package/dist/build/client-build-config.js +23 -99
- 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 +23 -0
- package/dist/build/prerender-paths.js +291 -0
- package/dist/build/prerender-server-pool.js +2 -2
- package/dist/build/prerender.d.ts +12 -1
- package/dist/build/prerender.js +2 -2
- package/dist/build/preview-credentials.d.ts +11 -0
- package/dist/build/preview-credentials.js +19 -0
- package/dist/build/report.d.ts +0 -3
- package/dist/build/report.js +2 -4
- 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 +7 -17
- package/dist/cache/cache-adapters-virtual.js +35 -2
- package/dist/check.d.ts +0 -16
- package/dist/check.js +17 -34
- package/dist/cli.js +86 -101
- package/dist/client/instrumentation-client-inject.js +1 -1
- package/dist/client/pages-router-link-navigation.js +1 -1
- package/dist/config/config-matchers.js +2 -2
- package/dist/config/dotenv.js +1 -1
- package/dist/config/next-config.d.ts +4 -1
- package/dist/config/next-config.js +82 -16
- package/dist/config/prerender.d.ts +12 -2
- package/dist/config/prerender.js +22 -12
- package/dist/config/server-external-packages.js +1 -1
- package/dist/config/tsconfig-paths.js +7 -3
- 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 +12 -5
- package/dist/entries/app-rsc-manifest.js +4 -4
- package/dist/entries/pages-client-entry.js +6 -5
- package/dist/entries/pages-server-entry.js +15 -26
- package/dist/entries/runtime-entry-module.js +2 -2
- package/dist/image/image-adapters-virtual.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +500 -338
- package/dist/init-cloudflare.js +13 -4
- package/dist/init-platform.d.ts +10 -1
- package/dist/init-platform.js +79 -13
- package/dist/init.d.ts +11 -3
- package/dist/init.js +133 -35
- 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 +4 -5
- 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 +3 -10
- package/dist/routing/app-route-graph.js +28 -76
- package/dist/routing/app-router.d.ts +0 -5
- package/dist/routing/app-router.js +0 -5
- package/dist/routing/file-matcher.d.ts +2 -6
- package/dist/routing/file-matcher.js +10 -11
- package/dist/routing/pages-router.js +3 -3
- package/dist/server/api-handler.js +41 -33
- package/dist/server/app-browser-entry.js +15 -11
- package/dist/server/app-browser-navigation-controller.js +9 -4
- 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 +8 -0
- package/dist/server/app-fallback-renderer.js +13 -1
- package/dist/server/app-layout-param-observation.d.ts +1 -1
- package/dist/server/app-page-boundary-render.d.ts +14 -1
- package/dist/server/app-page-boundary-render.js +107 -54
- package/dist/server/app-page-cache-render.d.ts +1 -1
- package/dist/server/app-page-dispatch.d.ts +2 -1
- package/dist/server/app-page-dispatch.js +29 -40
- package/dist/server/app-page-element-builder.d.ts +2 -1
- package/dist/server/app-page-element-builder.js +3 -3
- package/dist/server/app-page-execution.d.ts +3 -1
- package/dist/server/app-page-execution.js +31 -39
- package/dist/server/app-page-render.d.ts +1 -1
- package/dist/server/app-page-request.js +1 -1
- package/dist/server/app-page-route-wiring.js +4 -4
- package/dist/server/app-route-handler-execution.d.ts +1 -1
- package/dist/server/app-route-tree-prefetch.js +1 -1
- package/dist/server/app-rsc-cache-busting.js +1 -2
- package/dist/server/app-rsc-handler.js +2 -2
- 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-render-mode.d.ts +2 -5
- package/dist/server/app-rsc-render-mode.js +2 -12
- package/dist/server/app-segment-config.js +2 -2
- package/dist/server/app-server-action-execution.js +3 -3
- package/dist/server/app-ssr-entry.js +4 -1
- package/dist/server/app-ssr-stream.d.ts +2 -1
- package/dist/server/app-ssr-stream.js +4 -1
- package/dist/server/cache-proof.js +1 -1
- 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-lockfile.js +2 -3
- package/dist/server/dev-module-runner.js +1 -1
- package/dist/server/dev-origin-check.d.ts +2 -2
- package/dist/server/dev-origin-check.js +2 -2
- package/dist/server/dev-route-files.js +1 -1
- package/dist/server/dev-server.js +256 -164
- 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.d.ts +12 -1
- package/dist/server/image-optimization.js +15 -3
- package/dist/server/implicit-tags.js +2 -1
- package/dist/server/instrumentation.js +2 -2
- package/dist/server/isr-cache.d.ts +12 -4
- package/dist/server/isr-cache.js +3 -3
- package/dist/server/metadata-routes.js +4 -4
- package/dist/server/middleware-response-headers.js +1 -1
- package/dist/server/middleware-runtime.js +1 -1
- package/dist/server/middleware.d.ts +1 -0
- package/dist/server/middleware.js +1 -1
- 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-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-node-compat.d.ts +13 -6
- package/dist/server/pages-node-compat.js +44 -45
- package/dist/server/pages-page-data.d.ts +1 -1
- package/dist/server/pages-page-data.js +5 -4
- package/dist/server/pages-page-handler.js +61 -29
- package/dist/server/pages-page-response.d.ts +2 -2
- package/dist/server/pages-page-response.js +2 -2
- package/dist/server/pages-preview.d.ts +26 -0
- package/dist/server/pages-preview.js +165 -0
- package/dist/server/pages-readiness.d.ts +2 -1
- package/dist/server/pages-readiness.js +4 -2
- package/dist/server/pages-request-pipeline.js +1 -1
- package/dist/server/prerender-manifest.d.ts +15 -1
- package/dist/server/prerender-manifest.js +29 -1
- package/dist/server/prod-server.d.ts +6 -5
- package/dist/server/prod-server.js +15 -15
- package/dist/server/request-pipeline.js +1 -1
- package/dist/server/seed-cache.js +1 -1
- package/dist/server/socket-error-backstop.js +1 -1
- package/dist/server/static-file-cache.js +8 -9
- package/dist/server/worker-utils.js +1 -1
- package/dist/shims/cache.d.ts +1 -1
- package/dist/shims/cache.js +2 -1
- package/dist/shims/cdn-cache.d.ts +2 -7
- package/dist/shims/cdn-cache.js +2 -14
- package/dist/shims/constants.js +1 -1
- package/dist/shims/error-boundary.d.ts +4 -4
- package/dist/shims/error.d.ts +21 -5
- package/dist/shims/error.js +52 -14
- package/dist/shims/fetch-cache.js +1 -1
- package/dist/shims/font-utils.js +1 -1
- package/dist/shims/form.d.ts +1 -1
- package/dist/shims/head.js +3 -3
- package/dist/shims/headers.js +6 -4
- package/dist/shims/internal/pages-data-fetch-dedup.js +5 -3
- package/dist/shims/layout-segment-context.d.ts +1 -1
- package/dist/shims/link.d.ts +3 -1
- package/dist/shims/link.js +6 -3
- package/dist/shims/navigation-errors.d.ts +2 -1
- package/dist/shims/navigation-errors.js +9 -13
- package/dist/shims/navigation.d.ts +1 -1
- package/dist/shims/navigation.js +5 -5
- package/dist/shims/request-state-types.d.ts +2 -2
- package/dist/shims/router-state.d.ts +1 -0
- package/dist/shims/router.d.ts +2 -1
- package/dist/shims/router.js +18 -11
- package/dist/shims/script.js +1 -1
- package/dist/shims/server.js +2 -2
- 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/typegen.js +9 -11
- 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/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 +1 -7
- 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/vinext-root.js +1 -1
- package/dist/utils/vite-version.d.ts +6 -13
- package/dist/utils/vite-version.js +68 -34
- package/package.json +33 -14
- package/dist/cloudflare/index.d.ts +0 -3
- package/dist/cloudflare/index.js +0 -3
- package/dist/packages/cloudflare/src/cache/cdn-adapter.runtime.js +0 -102
- package/dist/packages/cloudflare/src/cache/kv-data-adapter.runtime.d.ts +0 -126
- package/dist/packages/cloudflare/src/cache/kv-data-adapter.runtime.js +0 -442
- package/dist/packages/cloudflare/src/deploy-config.js +0 -150
- package/dist/packages/cloudflare/src/deploy-help.js +0 -55
- package/dist/packages/cloudflare/src/deploy.js +0 -272
- package/dist/packages/cloudflare/src/tpr.d.ts +0 -45
- package/dist/packages/cloudflare/src/tpr.js +0 -582
- package/dist/packages/cloudflare/src/utils/cache-control-metadata.js +0 -20
- /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/head.js
CHANGED
|
@@ -80,7 +80,7 @@ function getSSRHeadHTML() {
|
|
|
80
80
|
* Tags allowed inside <head>. Anything else is silently dropped.
|
|
81
81
|
* This prevents injection of dangerous elements like <iframe>, <object>, etc.
|
|
82
82
|
*/
|
|
83
|
-
const ALLOWED_HEAD_TAGS = new Set([
|
|
83
|
+
const ALLOWED_HEAD_TAGS = /* @__PURE__ */ new Set([
|
|
84
84
|
"title",
|
|
85
85
|
"meta",
|
|
86
86
|
"link",
|
|
@@ -97,13 +97,13 @@ const META_TYPES = [
|
|
|
97
97
|
"itemProp"
|
|
98
98
|
];
|
|
99
99
|
/** Self-closing tags: no inner content, emit as <tag ... /> */
|
|
100
|
-
const SELF_CLOSING_HEAD_TAGS = new Set([
|
|
100
|
+
const SELF_CLOSING_HEAD_TAGS = /* @__PURE__ */ new Set([
|
|
101
101
|
"meta",
|
|
102
102
|
"link",
|
|
103
103
|
"base"
|
|
104
104
|
]);
|
|
105
105
|
/** Tags whose content is raw text — closing-tag sequences must be escaped during SSR. */
|
|
106
|
-
const RAW_CONTENT_TAGS = new Set(["script", "style"]);
|
|
106
|
+
const RAW_CONTENT_TAGS = /* @__PURE__ */ new Set(["script", "style"]);
|
|
107
107
|
const INLINE_CLOSE_TAG_RES = {
|
|
108
108
|
script: /<\/(script)/gi,
|
|
109
109
|
style: /<\/(style)/gi
|
package/dist/shims/headers.js
CHANGED
|
@@ -360,7 +360,7 @@ function applyMiddlewareRequestHeaders(middlewareResponseHeaders) {
|
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
/** Methods on `Headers` that mutate state. Hoisted to module scope — static. */
|
|
363
|
-
const _HEADERS_MUTATING_METHODS = new Set([
|
|
363
|
+
const _HEADERS_MUTATING_METHODS = /* @__PURE__ */ new Set([
|
|
364
364
|
"set",
|
|
365
365
|
"delete",
|
|
366
366
|
"append"
|
|
@@ -395,7 +395,7 @@ function _decorateRequestApiPromise(promise, target) {
|
|
|
395
395
|
return prop in promiseTarget || prop in target;
|
|
396
396
|
},
|
|
397
397
|
ownKeys(promiseTarget) {
|
|
398
|
-
return Array.from(new Set([...Reflect.ownKeys(promiseTarget), ...Reflect.ownKeys(target)]));
|
|
398
|
+
return Array.from(/* @__PURE__ */ new Set([...Reflect.ownKeys(promiseTarget), ...Reflect.ownKeys(target)]));
|
|
399
399
|
},
|
|
400
400
|
getOwnPropertyDescriptor(promiseTarget, prop) {
|
|
401
401
|
return Reflect.getOwnPropertyDescriptor(promiseTarget, prop) ?? Reflect.getOwnPropertyDescriptor(target, prop);
|
|
@@ -546,7 +546,8 @@ function headers() {
|
|
|
546
546
|
markDynamicUsage();
|
|
547
547
|
const fallbackShellPromise = createPprFallbackShellSuspensePromise("`headers()`");
|
|
548
548
|
if (fallbackShellPromise) return _decorateSuspendingRequestApiPromise(fallbackShellPromise);
|
|
549
|
-
|
|
549
|
+
const readonlyHeaders = _getReadonlyHeaders(state.headersContext);
|
|
550
|
+
return _getOrCreateDecoratedRequestApiPromise(_decoratedHeadersPromises, readonlyHeaders);
|
|
550
551
|
}
|
|
551
552
|
/**
|
|
552
553
|
* Cookie jar from the incoming request.
|
|
@@ -565,7 +566,8 @@ function cookies() {
|
|
|
565
566
|
markDynamicUsage();
|
|
566
567
|
const fallbackShellPromise = createPprFallbackShellSuspensePromise("`cookies()`");
|
|
567
568
|
if (fallbackShellPromise) return _decorateSuspendingRequestApiPromise(fallbackShellPromise);
|
|
568
|
-
|
|
569
|
+
const cookieStore = _areCookiesMutableInCurrentPhase() ? _getMutableCookies(state.headersContext) : _getReadonlyCookies(state.headersContext);
|
|
570
|
+
return _getOrCreateDecoratedRequestApiPromise(_decoratedCookiesPromises, cookieStore);
|
|
569
571
|
}
|
|
570
572
|
/** Accumulated Set-Cookie headers from cookies().set() / .delete() calls */
|
|
571
573
|
/**
|
|
@@ -40,10 +40,11 @@ const staticDataCache = Object.create(null);
|
|
|
40
40
|
const staticDataSources = /* @__PURE__ */ new Map();
|
|
41
41
|
function getStaticDataKey(dataHref) {
|
|
42
42
|
if (typeof window === "undefined") return dataHref;
|
|
43
|
+
const previewVariant = window.__NEXT_DATA__?.isPreview === true ? "preview" : "normal";
|
|
43
44
|
try {
|
|
44
|
-
return new URL(dataHref, window.location.href).href
|
|
45
|
+
return `${new URL(dataHref, window.location.href).href}\n${previewVariant}`;
|
|
45
46
|
} catch {
|
|
46
|
-
return dataHref
|
|
47
|
+
return `${dataHref}\n${previewVariant}`;
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
function cloneStaticResponse(cached, signal) {
|
|
@@ -113,7 +114,8 @@ function getInflightKey(dataHref, init) {
|
|
|
113
114
|
resolvedHref = new URL(dataHref, window.location.href).href;
|
|
114
115
|
} catch {}
|
|
115
116
|
const deploymentId = new Headers(init?.headers).get("x-deployment-id") ?? "";
|
|
116
|
-
|
|
117
|
+
const previewVariant = typeof window !== "undefined" && window.__NEXT_DATA__?.isPreview === true ? "preview" : "normal";
|
|
118
|
+
return `${resolvedHref}\n${deploymentId}\n${previewVariant}`;
|
|
117
119
|
}
|
|
118
120
|
function cloneSharedResponse(key, entry, signal) {
|
|
119
121
|
entry.waiters += 1;
|
|
@@ -22,6 +22,6 @@ declare function LayoutSegmentProvider({
|
|
|
22
22
|
providerId?: string;
|
|
23
23
|
segmentMap: SegmentMap;
|
|
24
24
|
children: ReactNode;
|
|
25
|
-
}): string | number | bigint | boolean | import("react").
|
|
25
|
+
}): string | number | bigint | boolean | import("react").FunctionComponentElement<import("react").ProviderProps<SegmentMap>> | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null | undefined;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { LayoutSegmentProvider, mergeLayoutSegmentMap };
|
package/dist/shims/link.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ type LinkProps = {
|
|
|
12
12
|
href: string | {
|
|
13
13
|
pathname?: string;
|
|
14
14
|
query?: UrlQuery;
|
|
15
|
+
hash?: string;
|
|
15
16
|
}; /** URL displayed in the browser (when href is a route pattern like /user/[id]) */
|
|
16
17
|
as?: string; /** Replace the current history entry instead of pushing */
|
|
17
18
|
replace?: boolean; /** Prefetch the page in the background (App Router default: auto, Pages Router default: true) */
|
|
@@ -68,6 +69,7 @@ declare const Link: React.ForwardRefExoticComponent<{
|
|
|
68
69
|
href: string | {
|
|
69
70
|
pathname?: string;
|
|
70
71
|
query?: UrlQuery;
|
|
72
|
+
hash?: string;
|
|
71
73
|
}; /** URL displayed in the browser (when href is a route pattern like /user/[id]) */
|
|
72
74
|
as?: string; /** Replace the current history entry instead of pushing */
|
|
73
75
|
replace?: boolean; /** Prefetch the page in the background (App Router default: auto, Pages Router default: true) */
|
|
@@ -97,6 +99,6 @@ declare const Link: React.ForwardRefExoticComponent<{
|
|
|
97
99
|
locale?: string | false; /** Called before navigation happens (Next.js 16). Return value is ignored. */
|
|
98
100
|
onNavigate?: (event: NavigateEvent) => void;
|
|
99
101
|
children?: React.ReactNode;
|
|
100
|
-
} & Omit<
|
|
102
|
+
} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
101
103
|
//#endregion
|
|
102
104
|
export { canAutoPrefetchFullAppRoute, Link as default, resolveAutoAppRoutePrefetch, resolveLinkPrefetchMode, useLinkStatus };
|
package/dist/shims/link.js
CHANGED
|
@@ -51,11 +51,12 @@ function resolveHref(href) {
|
|
|
51
51
|
const params = urlQueryToSearchParams(href.query);
|
|
52
52
|
url = appendSearchParamsToUrl(url, params);
|
|
53
53
|
}
|
|
54
|
+
if (href.hash) url += href.hash.startsWith("#") ? href.hash : `#${href.hash}`;
|
|
54
55
|
return url;
|
|
55
56
|
}
|
|
56
57
|
function resolvePagesQueryOnlyHref(href) {
|
|
57
58
|
if (!HAS_PAGES_ROUTER) return href;
|
|
58
|
-
if (!href.startsWith("?") || typeof window === "undefined") return href;
|
|
59
|
+
if (!href.startsWith("?") && !href.startsWith("#") || typeof window === "undefined") return href;
|
|
59
60
|
const pagesRouter = window.next?.appDir === true ? void 0 : window.next?.router;
|
|
60
61
|
return resolvePagesRouterQueryOnlyHref(href, {
|
|
61
62
|
asPath: pagesRouter && "reload" in pagesRouter && "asPath" in pagesRouter && typeof pagesRouter.asPath === "string" ? pagesRouter.asPath : void 0,
|
|
@@ -369,7 +370,8 @@ function prefetchUrl(href, mode, priority = "low", pagesRouteHref, locale) {
|
|
|
369
370
|
await shellEntry?.pending?.catch(() => {});
|
|
370
371
|
const renderedPathAndSearch = shellEntry?.snapshot?.renderedPathAndSearch;
|
|
371
372
|
if (renderedPathAndSearch) {
|
|
372
|
-
const
|
|
373
|
+
const renderedRscUrl = await createRscRequestUrl(renderedPathAndSearch, headers);
|
|
374
|
+
const cachedRenderedResponse = peekPrefetchResponseForNavigation(renderedRscUrl, interceptionContext, mountedSlotsHeader);
|
|
373
375
|
if (cachedRenderedResponse) return restoreRscResponse(cachedRenderedResponse);
|
|
374
376
|
}
|
|
375
377
|
return scheduleAppPrefetchFetch(() => fetch(rscUrl, {
|
|
@@ -574,7 +576,8 @@ const Link = forwardRef(function Link({ href, as, replace = false, prefetch: pre
|
|
|
574
576
|
const { locale, ...restWithoutLocale } = rest;
|
|
575
577
|
let children = childrenProp;
|
|
576
578
|
if (legacyBehavior && (typeof childrenProp === "string" || typeof childrenProp === "number")) children = React.createElement("a", null, childrenProp);
|
|
577
|
-
const
|
|
579
|
+
const unresolvedHref = as ?? resolveHref(href);
|
|
580
|
+
const rawResolvedHref = typeof unresolvedHref === "string" && unresolvedHref.startsWith("#") ? resolvePagesQueryOnlyHref(unresolvedHref) : unresolvedHref;
|
|
578
581
|
const routeHrefRaw = (HAS_PAGES_ROUTER ? resolveConcreteRouteHref(href, as) : null) ?? (typeof href === "string" ? href : resolveHref(href));
|
|
579
582
|
const resolvedHref = typeof rawResolvedHref === "string" ? warnAndNormalizeRepeatedSlashesInHref(rawResolvedHref) : rawResolvedHref;
|
|
580
583
|
const isDangerous = typeof resolvedHref === "string" && isDangerousScheme(resolvedHref);
|
|
@@ -26,7 +26,8 @@ type RedirectErrorShape = Error & {
|
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
28
|
* vinext accepts its three-part redirect digest and Next.js's five-part form.
|
|
29
|
-
*
|
|
29
|
+
* This is deliberately only a cheap prefix gate because vinext permits an
|
|
30
|
+
* empty redirect type; parseRedirectDigest is the authoritative validator.
|
|
30
31
|
*/
|
|
31
32
|
declare function isRedirectError(error: unknown): error is RedirectErrorShape;
|
|
32
33
|
declare function decodeRedirectError(digest: string): {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseRedirectDigest } from "../utils/redirect-digest.js";
|
|
1
2
|
//#region src/shims/navigation-errors.ts
|
|
2
3
|
/**
|
|
3
4
|
* Server-safe navigation control-flow errors and predicates.
|
|
@@ -52,24 +53,19 @@ function unauthorized() {
|
|
|
52
53
|
}
|
|
53
54
|
/**
|
|
54
55
|
* vinext accepts its three-part redirect digest and Next.js's five-part form.
|
|
55
|
-
*
|
|
56
|
+
* This is deliberately only a cheap prefix gate because vinext permits an
|
|
57
|
+
* empty redirect type; parseRedirectDigest is the authoritative validator.
|
|
56
58
|
*/
|
|
57
59
|
function isRedirectError(error) {
|
|
58
60
|
return !!error && typeof error === "object" && "digest" in error && typeof error.digest === "string" && error.digest.startsWith("NEXT_REDIRECT;");
|
|
59
61
|
}
|
|
60
62
|
function decodeRedirectError(digest) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
url: decodeURIComponent(encodedTarget),
|
|
68
|
-
type: parts[1] === "push" ? "push" : "replace"
|
|
69
|
-
};
|
|
70
|
-
} catch {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
63
|
+
const redirect = parseRedirectDigest(digest);
|
|
64
|
+
if (!redirect) return null;
|
|
65
|
+
return {
|
|
66
|
+
url: redirect.url,
|
|
67
|
+
type: redirect.type === "push" ? "push" : "replace"
|
|
68
|
+
};
|
|
73
69
|
}
|
|
74
70
|
function isNextRouterError(error) {
|
|
75
71
|
return isRedirectError(error) || isHTTPAccessFallbackError(error);
|
|
@@ -252,7 +252,6 @@ declare const appRouterInstance: AppRouterInstance;
|
|
|
252
252
|
* and layers the nearest segment's contextual `bfcacheId` on top.
|
|
253
253
|
*/
|
|
254
254
|
declare function useRouter(): {
|
|
255
|
-
bfcacheId: string;
|
|
256
255
|
back(): void;
|
|
257
256
|
forward(): void;
|
|
258
257
|
refresh(): void;
|
|
@@ -260,6 +259,7 @@ declare function useRouter(): {
|
|
|
260
259
|
replace(href: string, options?: NavigateOptions): void;
|
|
261
260
|
prefetch(href: string, options?: PrefetchOptions$1): void;
|
|
262
261
|
experimental_gesturePush?(href: string, options?: NavigateOptions): void;
|
|
262
|
+
bfcacheId: string;
|
|
263
263
|
};
|
|
264
264
|
/**
|
|
265
265
|
* Returns the active child segment one level below the layout where it's called.
|
package/dist/shims/navigation.js
CHANGED
|
@@ -331,7 +331,7 @@ function notifyPrefetchInvalidated(entry) {
|
|
|
331
331
|
}
|
|
332
332
|
function deletePrefetchCacheEntry(cache, prefetched, cacheKey, entry, notify) {
|
|
333
333
|
adjustPrefetchCacheByteSize(cache, -getPrefetchCacheEntrySize(entry));
|
|
334
|
-
const cacheKeys = entry.cacheKeys ?? new Set([cacheKey]);
|
|
334
|
+
const cacheKeys = entry.cacheKeys ?? /* @__PURE__ */ new Set([cacheKey]);
|
|
335
335
|
for (const key of cacheKeys) {
|
|
336
336
|
if (cache.get(key) === entry) cache.delete(key);
|
|
337
337
|
prefetched.delete(key);
|
|
@@ -384,7 +384,7 @@ function seedPrefetchResponseSnapshot(rscUrl, snapshot, interceptionContext = nu
|
|
|
384
384
|
const timestamp = Date.now();
|
|
385
385
|
const entry = {
|
|
386
386
|
cacheForNavigation: true,
|
|
387
|
-
cacheKeys: new Set([cacheKey]),
|
|
387
|
+
cacheKeys: /* @__PURE__ */ new Set([cacheKey]),
|
|
388
388
|
expiresAt: resolveCachedRscResponseExpiresAt(timestamp, snapshot, fallbackTtlMs),
|
|
389
389
|
mountedSlotsHeader,
|
|
390
390
|
outcome: "cache-seeded",
|
|
@@ -428,7 +428,7 @@ function storePrefetchResponse(rscUrl, response, interceptionContext = null, opt
|
|
|
428
428
|
const existing = cache.get(cacheKey);
|
|
429
429
|
if (existing) deletePrefetchCacheEntry(cache, prefetched, cacheKey, existing, false);
|
|
430
430
|
const entry = {
|
|
431
|
-
cacheKeys: new Set([cacheKey]),
|
|
431
|
+
cacheKeys: /* @__PURE__ */ new Set([cacheKey]),
|
|
432
432
|
mountedSlotsHeader: null,
|
|
433
433
|
outcome: "pending",
|
|
434
434
|
timestamp: Date.now()
|
|
@@ -531,7 +531,7 @@ function prefetchRscResponse(rscUrl, fetchPromise, interceptionContext = null, m
|
|
|
531
531
|
if (existing) deletePrefetchCacheEntry(cache, prefetched, cacheKey, existing, false);
|
|
532
532
|
const entry = {
|
|
533
533
|
cacheForNavigation: behavior.cacheForNavigation ?? true,
|
|
534
|
-
cacheKeys: new Set([cacheKey]),
|
|
534
|
+
cacheKeys: /* @__PURE__ */ new Set([cacheKey]),
|
|
535
535
|
mountedSlotsHeader,
|
|
536
536
|
optimisticRouteShell: behavior.optimisticRouteShell === true,
|
|
537
537
|
outcome: "pending",
|
|
@@ -577,7 +577,7 @@ function addRenderedPathAndSearchPrefetchAlias(cache, prefetched, primaryCacheKe
|
|
|
577
577
|
if (aliasCacheKey === primaryCacheKey) return;
|
|
578
578
|
const existing = cache.get(aliasCacheKey);
|
|
579
579
|
if (existing && existing !== entry) deletePrefetchCacheEntry(cache, prefetched, aliasCacheKey, existing, false);
|
|
580
|
-
entry.cacheKeys ??= new Set([primaryCacheKey]);
|
|
580
|
+
entry.cacheKeys ??= /* @__PURE__ */ new Set([primaryCacheKey]);
|
|
581
581
|
entry.cacheKeys.add(aliasCacheKey);
|
|
582
582
|
cache.set(aliasCacheKey, entry);
|
|
583
583
|
prefetched.add(aliasCacheKey);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CacheLifeConfig, CacheState } from "./cache-request-state.js";
|
|
2
|
-
import { ExecutionContextLike } from "./request-context.js";
|
|
3
1
|
import { NavigationContext } from "./navigation-context-state.js";
|
|
4
2
|
import { RootParamsState } from "./root-params.js";
|
|
3
|
+
import { CacheLifeConfig, CacheState } from "./cache-request-state.js";
|
|
4
|
+
import { ExecutionContextLike } from "./request-context.js";
|
|
5
5
|
import { FetchCacheState } from "./fetch-cache.js";
|
|
6
6
|
import { HeadersAccessPhase, HeadersContext, VinextHeadersShimState } from "./headers.js";
|
|
7
7
|
import { RouterState, SSRContext } from "./router-state.js";
|
package/dist/shims/router.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ type SSRContext = {
|
|
|
70
70
|
locales?: string[];
|
|
71
71
|
defaultLocale?: string;
|
|
72
72
|
domainLocales?: VinextNextData["domainLocales"];
|
|
73
|
+
isPreview?: boolean;
|
|
73
74
|
/**
|
|
74
75
|
* True when rendering a `getStaticPaths` fallback shell for a path that
|
|
75
76
|
* hasn't been pre-rendered yet (`fallback: true` + unlisted path). Mirrors
|
|
@@ -112,7 +113,7 @@ type PagesNavigationContextShape = {
|
|
|
112
113
|
declare function getPagesNavigationContext(): PagesNavigationContextShape | null;
|
|
113
114
|
declare function getPagesNavigationIsReadyFromSerializedState(routePattern: string | undefined, searchString: string, nextData?: VinextNextData): boolean;
|
|
114
115
|
declare function markPagesRouterReady(): boolean;
|
|
115
|
-
declare function initializePagesRouterReadyFromNextData(nextData: VinextNextData): void;
|
|
116
|
+
declare function initializePagesRouterReadyFromNextData(nextData: VinextNextData, forceReady?: boolean): void;
|
|
116
117
|
/**
|
|
117
118
|
* useRouter hook - Pages Router compatible.
|
|
118
119
|
*
|
package/dist/shims/router.js
CHANGED
|
@@ -684,7 +684,8 @@ function getPathnameAndQuery() {
|
|
|
684
684
|
};
|
|
685
685
|
}
|
|
686
686
|
const resolvedPath = stripBasePath(window.location.pathname, __basePath);
|
|
687
|
-
const
|
|
687
|
+
const canonicalResolvedPath = removeNavigationLocalePrefix(resolvedPath);
|
|
688
|
+
const pathname = window.__NEXT_DATA__?.page ?? canonicalResolvedPath;
|
|
688
689
|
const nextData = window.__NEXT_DATA__;
|
|
689
690
|
const routeQuery = getRouteQueryFromNextData(nextData, resolvedPath);
|
|
690
691
|
const searchQuery = {};
|
|
@@ -696,7 +697,7 @@ function getPathnameAndQuery() {
|
|
|
696
697
|
...searchQuery,
|
|
697
698
|
...routeQuery
|
|
698
699
|
},
|
|
699
|
-
asPath: getCurrentHistoryAsPath() ??
|
|
700
|
+
asPath: getCurrentHistoryAsPath() ?? canonicalResolvedPath + window.location.search + window.location.hash
|
|
700
701
|
};
|
|
701
702
|
}
|
|
702
703
|
function getCurrentHistoryAsPath() {
|
|
@@ -704,10 +705,12 @@ function getCurrentHistoryAsPath() {
|
|
|
704
705
|
if (!isNextRouterState(state) || typeof state.as !== "string") return null;
|
|
705
706
|
try {
|
|
706
707
|
const browserUrl = new URL(window.location.href);
|
|
707
|
-
const
|
|
708
|
+
const stateLocale = state.options.locale === false ? void 0 : state.options.locale;
|
|
709
|
+
const localizedStateAs = applyNavigationLocale(state.as, stateLocale);
|
|
710
|
+
const stateUrl = new URL(toBrowserNavigationHref(localizedStateAs, window.location.href, __basePath), window.location.href);
|
|
708
711
|
if (stateUrl.pathname !== browserUrl.pathname || stateUrl.search !== browserUrl.search) return null;
|
|
709
|
-
const stateAs = stripHash(state.as);
|
|
710
|
-
const visibleAs = `${stripBasePath(window.location.pathname, __basePath)}${window.location.search}`;
|
|
712
|
+
const stateAs = removeNavigationLocalePrefix(stripHash(state.as));
|
|
713
|
+
const visibleAs = `${removeNavigationLocalePrefix(stripBasePath(window.location.pathname, __basePath))}${window.location.search}`;
|
|
711
714
|
return `${stateAs || visibleAs}${window.location.hash}`;
|
|
712
715
|
} catch {
|
|
713
716
|
return null;
|
|
@@ -742,9 +745,9 @@ function markPagesRouterReady() {
|
|
|
742
745
|
routerRuntimeState.pagesRouterReady = true;
|
|
743
746
|
return true;
|
|
744
747
|
}
|
|
745
|
-
function initializePagesRouterReadyFromNextData(nextData) {
|
|
748
|
+
function initializePagesRouterReadyFromNextData(nextData, forceReady = false) {
|
|
746
749
|
if (typeof window === "undefined") return;
|
|
747
|
-
routerRuntimeState.pagesRouterReady = getPagesNavigationIsReadyFromSerializedState(nextData.page, window.location.search, nextData);
|
|
750
|
+
routerRuntimeState.pagesRouterReady = forceReady || getPagesNavigationIsReadyFromSerializedState(nextData.page, window.location.search, nextData);
|
|
748
751
|
}
|
|
749
752
|
function markPagesRouterHydrated() {
|
|
750
753
|
if (typeof window === "undefined" || window.__NEXT_HYDRATED === true) return;
|
|
@@ -1087,6 +1090,7 @@ function buildPagesNavigationNextData(target, props) {
|
|
|
1087
1090
|
query: mergedQuery,
|
|
1088
1091
|
buildId: target.buildId,
|
|
1089
1092
|
isFallback: false,
|
|
1093
|
+
isPreview: props.__N_PREVIEW === true,
|
|
1090
1094
|
...nextLocale !== void 0 ? { locale: nextLocale } : {}
|
|
1091
1095
|
};
|
|
1092
1096
|
}
|
|
@@ -1190,7 +1194,7 @@ async function navigateClientData(url, initialTarget, controller, navId, assertS
|
|
|
1190
1194
|
};
|
|
1191
1195
|
const deploymentId = getDeploymentId();
|
|
1192
1196
|
if (deploymentId) headers[NEXT_DEPLOYMENT_ID_HEADER] = deploymentId;
|
|
1193
|
-
res = await (initialTarget.dataKind === "static" ? fetchStaticPagesData : dedupedPagesDataFetch)(initialTarget.dataHref, {
|
|
1197
|
+
res = await (initialTarget.dataKind === "static" && Router.isPreview !== true ? fetchStaticPagesData : dedupedPagesDataFetch)(initialTarget.dataHref, {
|
|
1194
1198
|
headers,
|
|
1195
1199
|
signal: controller.signal
|
|
1196
1200
|
});
|
|
@@ -1231,6 +1235,7 @@ async function navigateClientData(url, initialTarget, controller, navId, assertS
|
|
|
1231
1235
|
const rawPageProps = props.pageProps;
|
|
1232
1236
|
const pageProps = isUnknownRecord(rawPageProps) ? rawPageProps : {};
|
|
1233
1237
|
if (initialTarget.dataKind === "server") evictPagesDataCache(initialTarget.dataHref);
|
|
1238
|
+
if (props.__N_PREVIEW === true || Router.isPreview === true) evictPagesDataCache(initialTarget.dataHref);
|
|
1234
1239
|
const redirectDestination = pageProps.__N_REDIRECT;
|
|
1235
1240
|
if (typeof redirectDestination === "string") {
|
|
1236
1241
|
handleDataRedirect(redirectDestination, pageProps.__N_REDIRECT_BASE_PATH, options.mode);
|
|
@@ -1484,7 +1489,7 @@ function buildRouterValue(pathname, query, asPath, isReady, methods) {
|
|
|
1484
1489
|
defaultLocale,
|
|
1485
1490
|
domainLocales,
|
|
1486
1491
|
isReady,
|
|
1487
|
-
isPreview:
|
|
1492
|
+
isPreview: typeof window !== "undefined" ? nextData?.isPreview === true : _ssrState?.isPreview === true,
|
|
1488
1493
|
isFallback: typeof window !== "undefined" ? nextData?.isFallback === true : _ssrState?.isFallback === true,
|
|
1489
1494
|
...methods,
|
|
1490
1495
|
events: routerEvents
|
|
@@ -2037,8 +2042,10 @@ const Router = Object.defineProperties(RouterMethods, {
|
|
|
2037
2042
|
},
|
|
2038
2043
|
isPreview: {
|
|
2039
2044
|
enumerable: true,
|
|
2040
|
-
|
|
2041
|
-
|
|
2045
|
+
get() {
|
|
2046
|
+
if (typeof window === "undefined") return _getSSRContext()?.isPreview === true;
|
|
2047
|
+
return window.__NEXT_DATA__?.isPreview === true;
|
|
2048
|
+
}
|
|
2042
2049
|
},
|
|
2043
2050
|
isFallback: {
|
|
2044
2051
|
enumerable: true,
|
package/dist/shims/script.js
CHANGED
package/dist/shims/server.js
CHANGED
|
@@ -112,7 +112,7 @@ var NextRequest = class extends Request {
|
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
/** Valid HTTP redirect status codes, matching Next.js's REDIRECTS set. */
|
|
115
|
-
const REDIRECT_STATUSES = new Set([
|
|
115
|
+
const REDIRECT_STATUSES = /* @__PURE__ */ new Set([
|
|
116
116
|
301,
|
|
117
117
|
302,
|
|
118
118
|
303,
|
|
@@ -500,7 +500,7 @@ var ReadonlyRequestCookiesError = class ReadonlyRequestCookiesError extends Erro
|
|
|
500
500
|
throw new ReadonlyRequestCookiesError();
|
|
501
501
|
}
|
|
502
502
|
};
|
|
503
|
-
const REQUEST_HEADERS_MUTATING_METHODS = new Set([
|
|
503
|
+
const REQUEST_HEADERS_MUTATING_METHODS = /* @__PURE__ */ new Set([
|
|
504
504
|
"set",
|
|
505
505
|
"delete",
|
|
506
506
|
"append"
|
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,6 +1,6 @@
|
|
|
1
|
+
import { RootParamsState } from "./root-params.js";
|
|
1
2
|
import { CacheState } from "./cache-request-state.js";
|
|
2
3
|
import { ExecutionContextLike } from "./request-context.js";
|
|
3
|
-
import { RootParamsState } from "./root-params.js";
|
|
4
4
|
import { FetchCacheState } from "./fetch-cache.js";
|
|
5
5
|
import { VinextHeadersShimState } from "./headers.js";
|
|
6
6
|
import { RouterState } from "./router-state.js";
|
package/dist/typegen.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
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 fs from "node:fs/promises";
|
|
7
|
+
import fsp from "node:fs/promises";
|
|
10
8
|
//#region src/typegen.ts
|
|
11
9
|
const NEXT_ENV_FILE_CONTENT = `/// <reference types="next" />
|
|
12
10
|
/// <reference types="next/image-types/global" />
|
|
@@ -16,19 +14,19 @@ import "./.next/types/routes.d.ts";
|
|
|
16
14
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
|
17
15
|
`;
|
|
18
16
|
async function generateRouteTypes(options) {
|
|
19
|
-
const root =
|
|
20
|
-
const appDir = options.appDir ?
|
|
21
|
-
const outPath = path.
|
|
17
|
+
const root = path.resolve(options.root);
|
|
18
|
+
const appDir = options.appDir ? path.resolve(options.appDir) : findDir(root, "app", "src/app");
|
|
19
|
+
const outPath = path.join(root, ".next", "types", "routes.d.ts");
|
|
22
20
|
const content = appDir ? renderRouteTypes(await collectRouteTypeModel(appDir, options.pageExtensions)) : renderRouteTypes(emptyRouteTypeModel());
|
|
23
|
-
await
|
|
24
|
-
await
|
|
21
|
+
await fsp.mkdir(path.dirname(outPath), { recursive: true });
|
|
22
|
+
await fsp.writeFile(outPath, content, "utf-8");
|
|
25
23
|
await ensureNextEnvFile(root);
|
|
26
24
|
return outPath;
|
|
27
25
|
}
|
|
28
26
|
async function ensureNextEnvFile(root) {
|
|
29
|
-
const envPath = path.
|
|
27
|
+
const envPath = path.join(root, "next-env.d.ts");
|
|
30
28
|
try {
|
|
31
|
-
await
|
|
29
|
+
await fsp.writeFile(envPath, NEXT_ENV_FILE_CONTENT, {
|
|
32
30
|
encoding: "utf-8",
|
|
33
31
|
flag: "wx"
|
|
34
32
|
});
|
|
@@ -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) => {
|
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 };
|
package/dist/utils/path.js
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
//#region src/utils/path.ts
|
|
2
2
|
const isWindows = process.platform === "win32";
|
|
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
|
-
function normalizePathSeparators(p) {
|
|
15
|
-
return isWindows ? p.replace(/\\/g, "/") : p;
|
|
16
|
-
}
|
|
17
3
|
function stripViteModuleQuery(id) {
|
|
18
4
|
const queryIndex = id.search(/[?#]/);
|
|
19
5
|
return queryIndex === -1 ? id : id.slice(0, queryIndex);
|
|
@@ -27,4 +13,4 @@ function stripJsExtension(name) {
|
|
|
27
13
|
return name.endsWith(".js") ? name.slice(0, -3) : name;
|
|
28
14
|
}
|
|
29
15
|
//#endregion
|
|
30
|
-
export { isWindows,
|
|
16
|
+
export { isWindows, stripJsExtension, stripViteModuleQuery };
|