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.
Files changed (236) hide show
  1. package/README.md +67 -30
  2. package/dist/build/assets-ignore.js +1 -1
  3. package/dist/build/clean-output.js +1 -1
  4. package/dist/build/client-build-config.d.ts +13 -92
  5. package/dist/build/client-build-config.js +23 -99
  6. package/dist/build/css-url-assets.js +3 -3
  7. package/dist/build/google-fonts/fallback-metrics.js +1 -1
  8. package/dist/build/google-fonts/font-metadata.js +1 -1
  9. package/dist/build/inject-pregenerated-paths.js +1 -1
  10. package/dist/build/inline-css.js +2 -5
  11. package/dist/build/module-dependency-cache.d.ts +4 -0
  12. package/dist/build/module-dependency-cache.js +13 -0
  13. package/dist/build/next-client-runtime-manifests.js +1 -1
  14. package/dist/build/pages-client-assets-module.js +1 -1
  15. package/dist/build/precompress.js +7 -7
  16. package/dist/build/prerender-paths.d.ts +23 -0
  17. package/dist/build/prerender-paths.js +291 -0
  18. package/dist/build/prerender-server-pool.js +2 -2
  19. package/dist/build/prerender.d.ts +12 -1
  20. package/dist/build/prerender.js +2 -2
  21. package/dist/build/preview-credentials.d.ts +11 -0
  22. package/dist/build/preview-credentials.js +19 -0
  23. package/dist/build/report.d.ts +0 -3
  24. package/dist/build/report.js +2 -4
  25. package/dist/build/run-prerender.d.ts +2 -11
  26. package/dist/build/run-prerender.js +2 -10
  27. package/dist/build/server-manifest.js +1 -1
  28. package/dist/build/ssr-manifest.d.ts +4 -0
  29. package/dist/build/ssr-manifest.js +10 -6
  30. package/dist/build/standalone.js +37 -37
  31. package/dist/cache/cache-adapters-virtual.d.ts +7 -17
  32. package/dist/cache/cache-adapters-virtual.js +35 -2
  33. package/dist/check.d.ts +0 -16
  34. package/dist/check.js +17 -34
  35. package/dist/cli.js +86 -101
  36. package/dist/client/instrumentation-client-inject.js +1 -1
  37. package/dist/client/pages-router-link-navigation.js +1 -1
  38. package/dist/config/config-matchers.js +2 -2
  39. package/dist/config/dotenv.js +1 -1
  40. package/dist/config/next-config.d.ts +4 -1
  41. package/dist/config/next-config.js +82 -16
  42. package/dist/config/prerender.d.ts +12 -2
  43. package/dist/config/prerender.js +22 -12
  44. package/dist/config/server-external-packages.js +1 -1
  45. package/dist/config/tsconfig-paths.js +7 -3
  46. 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
  47. package/dist/deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js +50 -0
  48. package/dist/entries/app-rsc-entry.js +12 -5
  49. package/dist/entries/app-rsc-manifest.js +4 -4
  50. package/dist/entries/pages-client-entry.js +6 -5
  51. package/dist/entries/pages-server-entry.js +15 -26
  52. package/dist/entries/runtime-entry-module.js +2 -2
  53. package/dist/image/image-adapters-virtual.js +1 -0
  54. package/dist/index.d.ts +1 -1
  55. package/dist/index.js +500 -338
  56. package/dist/init-cloudflare.js +13 -4
  57. package/dist/init-platform.d.ts +10 -1
  58. package/dist/init-platform.js +79 -13
  59. package/dist/init.d.ts +11 -3
  60. package/dist/init.js +133 -35
  61. package/dist/plugins/ast-utils.js +1 -1
  62. package/dist/plugins/dynamic-preload-metadata.js +7 -7
  63. package/dist/plugins/extensionless-dynamic-import.js +1 -1
  64. package/dist/plugins/fonts.js +3 -3
  65. package/dist/plugins/ignore-dynamic-requests.js +13 -8
  66. package/dist/plugins/import-meta-url.js +16 -17
  67. package/dist/plugins/middleware-export-validation.js +1 -1
  68. package/dist/plugins/middleware-server-only.js +2 -2
  69. package/dist/plugins/og-asset-ownership.js +7 -6
  70. package/dist/plugins/og-assets.js +4 -5
  71. package/dist/plugins/optimize-imports.js +12 -13
  72. package/dist/plugins/postcss.js +1 -1
  73. package/dist/plugins/remove-console.js +1 -1
  74. package/dist/plugins/require-context.js +1 -1
  75. package/dist/plugins/sass.js +2 -2
  76. package/dist/plugins/server-externals-manifest.js +1 -1
  77. package/dist/plugins/strip-server-exports.js +1 -1
  78. package/dist/plugins/styled-jsx.js +3 -2
  79. package/dist/plugins/typeof-window.js +1 -1
  80. package/dist/routing/app-route-graph.d.ts +3 -10
  81. package/dist/routing/app-route-graph.js +28 -76
  82. package/dist/routing/app-router.d.ts +0 -5
  83. package/dist/routing/app-router.js +0 -5
  84. package/dist/routing/file-matcher.d.ts +2 -6
  85. package/dist/routing/file-matcher.js +10 -11
  86. package/dist/routing/pages-router.js +3 -3
  87. package/dist/server/api-handler.js +41 -33
  88. package/dist/server/app-browser-entry.js +15 -11
  89. package/dist/server/app-browser-navigation-controller.js +9 -4
  90. package/dist/server/app-browser-server-action-client.js +1 -1
  91. package/dist/server/app-elements-wire.d.ts +2 -1
  92. package/dist/server/app-fallback-renderer.d.ts +8 -0
  93. package/dist/server/app-fallback-renderer.js +13 -1
  94. package/dist/server/app-layout-param-observation.d.ts +1 -1
  95. package/dist/server/app-page-boundary-render.d.ts +14 -1
  96. package/dist/server/app-page-boundary-render.js +107 -54
  97. package/dist/server/app-page-cache-render.d.ts +1 -1
  98. package/dist/server/app-page-dispatch.d.ts +2 -1
  99. package/dist/server/app-page-dispatch.js +29 -40
  100. package/dist/server/app-page-element-builder.d.ts +2 -1
  101. package/dist/server/app-page-element-builder.js +3 -3
  102. package/dist/server/app-page-execution.d.ts +3 -1
  103. package/dist/server/app-page-execution.js +31 -39
  104. package/dist/server/app-page-render.d.ts +1 -1
  105. package/dist/server/app-page-request.js +1 -1
  106. package/dist/server/app-page-route-wiring.js +4 -4
  107. package/dist/server/app-route-handler-execution.d.ts +1 -1
  108. package/dist/server/app-route-tree-prefetch.js +1 -1
  109. package/dist/server/app-rsc-cache-busting.js +1 -2
  110. package/dist/server/app-rsc-handler.js +2 -2
  111. package/dist/server/app-rsc-redirect-flight.d.ts +66 -0
  112. package/dist/server/app-rsc-redirect-flight.js +71 -0
  113. package/dist/server/app-rsc-render-mode.d.ts +2 -5
  114. package/dist/server/app-rsc-render-mode.js +2 -12
  115. package/dist/server/app-segment-config.js +2 -2
  116. package/dist/server/app-server-action-execution.js +3 -3
  117. package/dist/server/app-ssr-entry.js +4 -1
  118. package/dist/server/app-ssr-stream.d.ts +2 -1
  119. package/dist/server/app-ssr-stream.js +4 -1
  120. package/dist/server/cache-proof.js +1 -1
  121. package/dist/server/default-global-error-module.d.ts +3 -1
  122. package/dist/server/default-not-found-module.d.ts +3 -1
  123. package/dist/server/dev-lockfile.js +2 -3
  124. package/dist/server/dev-module-runner.js +1 -1
  125. package/dist/server/dev-origin-check.d.ts +2 -2
  126. package/dist/server/dev-origin-check.js +2 -2
  127. package/dist/server/dev-route-files.js +1 -1
  128. package/dist/server/dev-server.js +256 -164
  129. package/dist/server/dev-stack-sourcemap.js +4 -3
  130. package/dist/server/headers.d.ts +3 -1
  131. package/dist/server/headers.js +3 -1
  132. package/dist/server/image-optimization.d.ts +12 -1
  133. package/dist/server/image-optimization.js +15 -3
  134. package/dist/server/implicit-tags.js +2 -1
  135. package/dist/server/instrumentation.js +2 -2
  136. package/dist/server/isr-cache.d.ts +12 -4
  137. package/dist/server/isr-cache.js +3 -3
  138. package/dist/server/metadata-routes.js +4 -4
  139. package/dist/server/middleware-response-headers.js +1 -1
  140. package/dist/server/middleware-runtime.js +1 -1
  141. package/dist/server/middleware.d.ts +1 -0
  142. package/dist/server/middleware.js +1 -1
  143. package/dist/server/navigation-planner.d.ts +2 -0
  144. package/dist/server/navigation-planner.js +8 -2
  145. package/dist/server/next-error-digest.d.ts +9 -24
  146. package/dist/server/next-error-digest.js +23 -15
  147. package/dist/server/operation-token.js +1 -1
  148. package/dist/server/pages-body-parser-config.js +2 -1
  149. package/dist/server/pages-dev-hydration.d.ts +14 -0
  150. package/dist/server/pages-dev-hydration.js +83 -0
  151. package/dist/server/pages-dev-module-url.js +2 -2
  152. package/dist/server/pages-node-compat.d.ts +13 -6
  153. package/dist/server/pages-node-compat.js +44 -45
  154. package/dist/server/pages-page-data.d.ts +1 -1
  155. package/dist/server/pages-page-data.js +5 -4
  156. package/dist/server/pages-page-handler.js +61 -29
  157. package/dist/server/pages-page-response.d.ts +2 -2
  158. package/dist/server/pages-page-response.js +2 -2
  159. package/dist/server/pages-preview.d.ts +26 -0
  160. package/dist/server/pages-preview.js +165 -0
  161. package/dist/server/pages-readiness.d.ts +2 -1
  162. package/dist/server/pages-readiness.js +4 -2
  163. package/dist/server/pages-request-pipeline.js +1 -1
  164. package/dist/server/prerender-manifest.d.ts +15 -1
  165. package/dist/server/prerender-manifest.js +29 -1
  166. package/dist/server/prod-server.d.ts +6 -5
  167. package/dist/server/prod-server.js +15 -15
  168. package/dist/server/request-pipeline.js +1 -1
  169. package/dist/server/seed-cache.js +1 -1
  170. package/dist/server/socket-error-backstop.js +1 -1
  171. package/dist/server/static-file-cache.js +8 -9
  172. package/dist/server/worker-utils.js +1 -1
  173. package/dist/shims/cache.d.ts +1 -1
  174. package/dist/shims/cache.js +2 -1
  175. package/dist/shims/cdn-cache.d.ts +2 -7
  176. package/dist/shims/cdn-cache.js +2 -14
  177. package/dist/shims/constants.js +1 -1
  178. package/dist/shims/error-boundary.d.ts +4 -4
  179. package/dist/shims/error.d.ts +21 -5
  180. package/dist/shims/error.js +52 -14
  181. package/dist/shims/fetch-cache.js +1 -1
  182. package/dist/shims/font-utils.js +1 -1
  183. package/dist/shims/form.d.ts +1 -1
  184. package/dist/shims/head.js +3 -3
  185. package/dist/shims/headers.js +6 -4
  186. package/dist/shims/internal/pages-data-fetch-dedup.js +5 -3
  187. package/dist/shims/layout-segment-context.d.ts +1 -1
  188. package/dist/shims/link.d.ts +3 -1
  189. package/dist/shims/link.js +6 -3
  190. package/dist/shims/navigation-errors.d.ts +2 -1
  191. package/dist/shims/navigation-errors.js +9 -13
  192. package/dist/shims/navigation.d.ts +1 -1
  193. package/dist/shims/navigation.js +5 -5
  194. package/dist/shims/request-state-types.d.ts +2 -2
  195. package/dist/shims/router-state.d.ts +1 -0
  196. package/dist/shims/router.d.ts +2 -1
  197. package/dist/shims/router.js +18 -11
  198. package/dist/shims/script.js +1 -1
  199. package/dist/shims/server.js +2 -2
  200. package/dist/shims/slot.d.ts +1 -1
  201. package/dist/shims/thenable-params.js +1 -1
  202. package/dist/shims/unified-request-context.d.ts +1 -1
  203. package/dist/typegen.js +9 -11
  204. package/dist/utils/client-build-manifest.js +2 -2
  205. package/dist/utils/client-entry-manifest.js +1 -1
  206. package/dist/utils/client-runtime-metadata.js +1 -1
  207. package/dist/utils/commonjs-loader.js +3 -3
  208. package/dist/utils/mdx-scan.js +1 -1
  209. package/dist/utils/path.d.ts +1 -13
  210. package/dist/utils/path.js +1 -15
  211. package/dist/utils/plugin-options.d.ts +4 -0
  212. package/dist/utils/plugin-options.js +8 -0
  213. package/dist/utils/project.d.ts +1 -7
  214. package/dist/utils/project.js +2 -8
  215. package/dist/utils/public-routes.js +2 -2
  216. package/dist/utils/react-version.js +1 -1
  217. package/dist/utils/redirect-digest.d.ts +9 -0
  218. package/dist/utils/redirect-digest.js +25 -0
  219. package/dist/utils/vinext-root.js +1 -1
  220. package/dist/utils/vite-version.d.ts +6 -13
  221. package/dist/utils/vite-version.js +68 -34
  222. package/package.json +33 -14
  223. package/dist/cloudflare/index.d.ts +0 -3
  224. package/dist/cloudflare/index.js +0 -3
  225. package/dist/packages/cloudflare/src/cache/cdn-adapter.runtime.js +0 -102
  226. package/dist/packages/cloudflare/src/cache/kv-data-adapter.runtime.d.ts +0 -126
  227. package/dist/packages/cloudflare/src/cache/kv-data-adapter.runtime.js +0 -442
  228. package/dist/packages/cloudflare/src/deploy-config.js +0 -150
  229. package/dist/packages/cloudflare/src/deploy-help.js +0 -55
  230. package/dist/packages/cloudflare/src/deploy.js +0 -272
  231. package/dist/packages/cloudflare/src/tpr.d.ts +0 -45
  232. package/dist/packages/cloudflare/src/tpr.js +0 -582
  233. package/dist/packages/cloudflare/src/utils/cache-control-metadata.js +0 -20
  234. /package/dist/build/google-fonts/{fallback-metrics-data.js → fallback-metrics-data.json.js} +0 -0
  235. /package/dist/build/google-fonts/{font-data.js → font-data.json.js} +0 -0
  236. /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
@@ -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
@@ -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
- return _getOrCreateDecoratedRequestApiPromise(_decoratedHeadersPromises, _getReadonlyHeaders(state.headersContext));
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
- return _getOrCreateDecoratedRequestApiPromise(_decoratedCookiesPromises, _areCookiesMutableInCurrentPhase() ? _getMutableCookies(state.headersContext) : _getReadonlyCookies(state.headersContext));
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
- return `${resolvedHref}\n${deploymentId}`;
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").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").FunctionComponentElement<import("react").ProviderProps<SegmentMap>> | null | undefined;
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 };
@@ -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<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href"> & React.RefAttributes<HTMLAnchorElement>>;
102
+ } & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href"> & React.RefAttributes<HTMLAnchorElement>>;
101
103
  //#endregion
102
104
  export { canAutoPrefetchFullAppRoute, Link as default, resolveAutoAppRoutePrefetch, resolveLinkPrefetchMode, useLinkStatus };
@@ -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 cachedRenderedResponse = peekPrefetchResponseForNavigation(await createRscRequestUrl(renderedPathAndSearch, headers), interceptionContext, mountedSlotsHeader);
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 rawResolvedHref = as ?? resolveHref(href);
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
- * A prefix check is deliberate because vinext permits an empty redirect type.
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
- * A prefix check is deliberate because vinext permits an empty redirect type.
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
- if (!digest.startsWith("NEXT_REDIRECT;")) return null;
62
- const parts = digest.split(";");
63
- const encodedTarget = parts.length >= 5 ? parts.slice(2, -2).join(";") : parts[2];
64
- if (!encodedTarget) return null;
65
- try {
66
- return {
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.
@@ -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";
@@ -16,6 +16,7 @@ type SSRContext = {
16
16
  locale?: string;
17
17
  locales?: string[];
18
18
  defaultLocale?: string;
19
+ isPreview?: boolean;
19
20
  isFallback?: boolean;
20
21
  };
21
22
  type RouterState = {
@@ -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
  *
@@ -684,7 +684,8 @@ function getPathnameAndQuery() {
684
684
  };
685
685
  }
686
686
  const resolvedPath = stripBasePath(window.location.pathname, __basePath);
687
- const pathname = window.__NEXT_DATA__?.page ?? resolvedPath;
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() ?? resolvedPath + window.location.search + window.location.hash
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 stateUrl = new URL(toBrowserNavigationHref(state.as, window.location.href, __basePath), window.location.href);
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: false,
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
- value: false,
2041
- writable: false
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,
@@ -130,7 +130,7 @@ const REACT_TO_HTML_ATTR = {
130
130
  * `REACT_TO_HTML_ATTR`.
131
131
  */
132
132
  function collectBeforeInteractiveAttributes(rest) {
133
- const RESERVED = new Set([
133
+ const RESERVED = /* @__PURE__ */ new Set([
134
134
  "id",
135
135
  "nonce",
136
136
  "src",
@@ -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"
@@ -40,6 +40,6 @@ declare function ParallelSlot({
40
40
  name
41
41
  }: {
42
42
  name: string;
43
- }): string | number | bigint | boolean | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined> | null;
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 path from "node:path";
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 = normalizePathSeparators(path.resolve(options.root));
20
- const appDir = options.appDir ? normalizePathSeparators(path.resolve(options.appDir)) : findDir(root, "app", "src/app");
21
- const outPath = path.posix.join(root, ".next", "types", "routes.d.ts");
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 fs.mkdir(path.posix.dirname(outPath), { recursive: true });
24
- await fs.writeFile(outPath, content, "utf-8");
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.posix.join(root, "next-env.d.ts");
27
+ const envPath = path.join(root, "next-env.d.ts");
30
28
  try {
31
- await fs.writeFile(envPath, NEXT_ENV_FILE_CONTENT, {
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).split(path.sep).join("/"), options.assetBase);
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 path from "node:path";
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 path.resolve(resolvedPath);
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(path.dirname(resolvedPath));
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) => {
@@ -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();
@@ -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, normalizePathSeparators, stripJsExtension, stripViteModuleQuery };
11
+ export { isWindows, stripJsExtension, stripViteModuleQuery };
@@ -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, normalizePathSeparators, stripJsExtension, stripViteModuleQuery };
16
+ export { isWindows, stripJsExtension, stripViteModuleQuery };
@@ -0,0 +1,4 @@
1
+ //#region src/utils/plugin-options.d.ts
2
+ declare function flattenPluginOptions(value: unknown): Promise<unknown[]>;
3
+ //#endregion
4
+ export { flattenPluginOptions };