vinext 1.0.0-beta.0 → 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 (202) hide show
  1. package/README.md +17 -1
  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.js +6 -4
  5. package/dist/build/css-url-assets.js +3 -3
  6. package/dist/build/google-fonts/fallback-metrics.js +1 -1
  7. package/dist/build/google-fonts/font-metadata.js +1 -1
  8. package/dist/build/inject-pregenerated-paths.js +1 -1
  9. package/dist/build/inline-css.js +2 -5
  10. package/dist/build/module-dependency-cache.d.ts +4 -0
  11. package/dist/build/module-dependency-cache.js +13 -0
  12. package/dist/build/next-client-runtime-manifests.js +1 -1
  13. package/dist/build/pages-client-assets-module.js +1 -1
  14. package/dist/build/precompress.js +7 -7
  15. package/dist/build/prerender-paths.d.ts +2 -2
  16. package/dist/build/prerender-paths.js +10 -15
  17. package/dist/build/prerender-server-pool.js +2 -2
  18. package/dist/build/prerender.js +1 -1
  19. package/dist/build/preview-credentials.d.ts +11 -0
  20. package/dist/build/preview-credentials.js +19 -0
  21. package/dist/build/report.d.ts +0 -3
  22. package/dist/build/report.js +2 -4
  23. package/dist/build/run-prerender.d.ts +2 -11
  24. package/dist/build/run-prerender.js +2 -10
  25. package/dist/build/server-manifest.js +1 -1
  26. package/dist/build/ssr-manifest.d.ts +4 -0
  27. package/dist/build/ssr-manifest.js +10 -6
  28. package/dist/build/standalone.js +37 -37
  29. package/dist/cache/cache-adapters-virtual.d.ts +1 -17
  30. package/dist/cache/cache-adapters-virtual.js +20 -11
  31. package/dist/check.d.ts +0 -16
  32. package/dist/check.js +12 -34
  33. package/dist/cli.js +58 -53
  34. package/dist/client/instrumentation-client-inject.js +1 -1
  35. package/dist/client/pages-router-link-navigation.js +1 -1
  36. package/dist/config/config-matchers.js +2 -2
  37. package/dist/config/dotenv.js +1 -1
  38. package/dist/config/next-config.d.ts +4 -1
  39. package/dist/config/next-config.js +81 -14
  40. package/dist/config/prerender.d.ts +2 -2
  41. package/dist/config/prerender.js +7 -15
  42. package/dist/config/server-external-packages.js +1 -1
  43. package/dist/config/tsconfig-paths.js +2 -2
  44. 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
  45. package/dist/deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js +50 -0
  46. package/dist/entries/app-rsc-entry.js +12 -5
  47. package/dist/entries/app-rsc-manifest.js +4 -4
  48. package/dist/entries/pages-client-entry.js +6 -5
  49. package/dist/entries/pages-server-entry.js +15 -26
  50. package/dist/entries/runtime-entry-module.js +2 -2
  51. package/dist/index.js +255 -195
  52. package/dist/init-cloudflare.js +1 -1
  53. package/dist/init-platform.js +1 -1
  54. package/dist/init.js +5 -5
  55. package/dist/plugins/ast-utils.js +1 -1
  56. package/dist/plugins/dynamic-preload-metadata.js +7 -7
  57. package/dist/plugins/extensionless-dynamic-import.js +1 -1
  58. package/dist/plugins/fonts.js +3 -3
  59. package/dist/plugins/ignore-dynamic-requests.js +13 -8
  60. package/dist/plugins/import-meta-url.js +16 -17
  61. package/dist/plugins/middleware-export-validation.js +1 -1
  62. package/dist/plugins/middleware-server-only.js +2 -2
  63. package/dist/plugins/og-asset-ownership.js +7 -6
  64. package/dist/plugins/og-assets.js +4 -5
  65. package/dist/plugins/optimize-imports.js +12 -13
  66. package/dist/plugins/postcss.js +1 -1
  67. package/dist/plugins/remove-console.js +1 -1
  68. package/dist/plugins/require-context.js +1 -1
  69. package/dist/plugins/sass.js +2 -2
  70. package/dist/plugins/server-externals-manifest.js +1 -1
  71. package/dist/plugins/strip-server-exports.js +1 -1
  72. package/dist/plugins/styled-jsx.js +3 -2
  73. package/dist/plugins/typeof-window.js +1 -1
  74. package/dist/routing/app-route-graph.d.ts +3 -10
  75. package/dist/routing/app-route-graph.js +28 -76
  76. package/dist/routing/app-router.d.ts +0 -5
  77. package/dist/routing/app-router.js +0 -5
  78. package/dist/routing/file-matcher.d.ts +2 -6
  79. package/dist/routing/file-matcher.js +10 -11
  80. package/dist/routing/pages-router.js +3 -3
  81. package/dist/server/api-handler.js +41 -33
  82. package/dist/server/app-browser-entry.js +17 -11
  83. package/dist/server/app-browser-navigation-controller.js +5 -3
  84. package/dist/server/app-browser-server-action-client.js +1 -1
  85. package/dist/server/app-browser-state.js +1 -1
  86. package/dist/server/app-browser-visible-commit.js +1 -1
  87. package/dist/server/app-elements-wire.d.ts +2 -1
  88. package/dist/server/app-fallback-renderer.d.ts +8 -0
  89. package/dist/server/app-fallback-renderer.js +13 -1
  90. package/dist/server/app-page-boundary-render.d.ts +14 -1
  91. package/dist/server/app-page-boundary-render.js +107 -54
  92. package/dist/server/app-page-dispatch.d.ts +1 -0
  93. package/dist/server/app-page-dispatch.js +26 -37
  94. package/dist/server/app-page-element-builder.d.ts +2 -1
  95. package/dist/server/app-page-element-builder.js +3 -3
  96. package/dist/server/app-page-execution.d.ts +3 -1
  97. package/dist/server/app-page-execution.js +31 -39
  98. package/dist/server/app-page-request.js +1 -1
  99. package/dist/server/app-page-route-wiring.js +1 -1
  100. package/dist/server/app-route-handler-execution.js +1 -1
  101. package/dist/server/app-route-tree-prefetch.js +1 -1
  102. package/dist/server/app-rsc-cache-busting.js +1 -1
  103. package/dist/server/app-rsc-handler.js +3 -3
  104. package/dist/server/app-rsc-redirect-flight.d.ts +66 -0
  105. package/dist/server/app-rsc-redirect-flight.js +71 -0
  106. package/dist/server/app-segment-config.js +2 -2
  107. package/dist/server/app-server-action-execution.js +1 -1
  108. package/dist/server/app-ssr-entry.js +6 -3
  109. package/dist/server/app-ssr-stream.d.ts +2 -1
  110. package/dist/server/app-ssr-stream.js +4 -1
  111. package/dist/server/cache-proof.js +1 -1
  112. package/dist/server/default-global-error-module.d.ts +3 -1
  113. package/dist/server/default-not-found-module.d.ts +3 -1
  114. package/dist/server/dev-lockfile.js +2 -3
  115. package/dist/server/dev-route-files.js +1 -1
  116. package/dist/server/dev-server.js +253 -161
  117. package/dist/server/dev-stack-sourcemap.js +4 -3
  118. package/dist/server/headers.d.ts +3 -1
  119. package/dist/server/headers.js +3 -1
  120. package/dist/server/image-optimization.js +2 -2
  121. package/dist/server/implicit-tags.js +2 -1
  122. package/dist/server/instrumentation.js +2 -2
  123. package/dist/server/isr-cache.js +1 -1
  124. package/dist/server/metadata-routes.js +4 -4
  125. package/dist/server/middleware-response-headers.js +1 -1
  126. package/dist/server/middleware-runtime.js +1 -1
  127. package/dist/server/middleware.d.ts +1 -0
  128. package/dist/server/middleware.js +1 -1
  129. package/dist/server/navigation-planner.d.ts +2 -0
  130. package/dist/server/navigation-planner.js +8 -2
  131. package/dist/server/next-error-digest.d.ts +9 -24
  132. package/dist/server/next-error-digest.js +23 -15
  133. package/dist/server/operation-token.js +1 -1
  134. package/dist/server/pages-body-parser-config.js +2 -1
  135. package/dist/server/pages-dev-hydration.d.ts +14 -0
  136. package/dist/server/pages-dev-hydration.js +83 -0
  137. package/dist/server/pages-dev-module-url.js +2 -2
  138. package/dist/server/pages-node-compat.d.ts +13 -6
  139. package/dist/server/pages-node-compat.js +44 -45
  140. package/dist/server/pages-page-data.d.ts +1 -1
  141. package/dist/server/pages-page-data.js +4 -3
  142. package/dist/server/pages-page-handler.js +61 -29
  143. package/dist/server/pages-page-response.d.ts +2 -2
  144. package/dist/server/pages-preview.d.ts +26 -0
  145. package/dist/server/pages-preview.js +165 -0
  146. package/dist/server/pages-readiness.d.ts +2 -1
  147. package/dist/server/pages-readiness.js +4 -2
  148. package/dist/server/prod-server.js +9 -8
  149. package/dist/server/request-pipeline.js +1 -1
  150. package/dist/server/seed-cache.js +1 -1
  151. package/dist/server/socket-error-backstop.js +1 -1
  152. package/dist/server/static-file-cache.js +7 -8
  153. package/dist/server/worker-utils.js +1 -1
  154. package/dist/shims/cache.js +2 -1
  155. package/dist/shims/constants.js +1 -1
  156. package/dist/shims/error-boundary.d.ts +4 -4
  157. package/dist/shims/error.d.ts +21 -5
  158. package/dist/shims/error.js +52 -14
  159. package/dist/shims/fetch-cache.js +1 -1
  160. package/dist/shims/font-utils.js +1 -1
  161. package/dist/shims/form.d.ts +1 -1
  162. package/dist/shims/head.js +3 -3
  163. package/dist/shims/headers.js +6 -4
  164. package/dist/shims/internal/pages-data-fetch-dedup.js +5 -3
  165. package/dist/shims/layout-segment-context.d.ts +1 -1
  166. package/dist/shims/link.d.ts +3 -1
  167. package/dist/shims/link.js +6 -3
  168. package/dist/shims/navigation-errors.d.ts +2 -1
  169. package/dist/shims/navigation-errors.js +9 -13
  170. package/dist/shims/navigation.d.ts +1 -1
  171. package/dist/shims/navigation.js +5 -5
  172. package/dist/shims/navigation.react-server.js +1 -1
  173. package/dist/shims/router-state.d.ts +1 -0
  174. package/dist/shims/router.d.ts +2 -1
  175. package/dist/shims/router.js +18 -11
  176. package/dist/shims/script.js +1 -1
  177. package/dist/shims/server.js +2 -2
  178. package/dist/shims/slot.d.ts +1 -1
  179. package/dist/shims/thenable-params.js +1 -1
  180. package/dist/typegen.js +9 -11
  181. package/dist/utils/client-build-manifest.js +2 -2
  182. package/dist/utils/client-entry-manifest.js +1 -1
  183. package/dist/utils/client-runtime-metadata.js +1 -1
  184. package/dist/utils/commonjs-loader.js +3 -3
  185. package/dist/utils/mdx-scan.js +1 -1
  186. package/dist/utils/path.d.ts +1 -13
  187. package/dist/utils/path.js +1 -15
  188. package/dist/utils/plugin-options.d.ts +4 -0
  189. package/dist/utils/plugin-options.js +8 -0
  190. package/dist/utils/project.d.ts +0 -6
  191. package/dist/utils/project.js +2 -8
  192. package/dist/utils/public-routes.js +2 -2
  193. package/dist/utils/react-version.js +1 -1
  194. package/dist/utils/redirect-digest.d.ts +9 -0
  195. package/dist/utils/redirect-digest.js +25 -0
  196. package/dist/utils/vinext-root.js +1 -1
  197. package/dist/utils/vite-version.d.ts +5 -2
  198. package/dist/utils/vite-version.js +43 -17
  199. package/package.json +4 -3
  200. /package/dist/build/google-fonts/{fallback-metrics-data.js → fallback-metrics-data.json.js} +0 -0
  201. /package/dist/build/google-fonts/{font-data.js → font-data.json.js} +0 -0
  202. /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
@@ -2,7 +2,7 @@ import { readJsonFile } from "../utils/safe-json-file.js";
2
2
  import { resolveVinextPackageRoot } from "../utils/vinext-root.js";
3
3
  import { createRequire } from "node:module";
4
4
  import fs from "node:fs";
5
- import path from "node:path";
5
+ import nodePath from "node:path";
6
6
  //#region src/build/standalone.ts
7
7
  function readPackageJson(packageJsonPath) {
8
8
  return JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
@@ -29,7 +29,7 @@ function runtimeDeps(pkg) {
29
29
  * running against a build that predates this feature).
30
30
  */
31
31
  function readServerExternalsManifest(serverDir) {
32
- const manifestPath = path.join(serverDir, "vinext-externals.json");
32
+ const manifestPath = nodePath.join(serverDir, "vinext-externals.json");
33
33
  if (!fs.existsSync(manifestPath)) return [];
34
34
  return readJsonFile(manifestPath, { onError: (err) => {
35
35
  console.warn(`[vinext] Warning: failed to parse ${manifestPath}, proceeding without externals manifest: ${String(err)}`);
@@ -41,28 +41,28 @@ function resolvePackageJsonPath(packageName, resolver) {
41
41
  } catch {
42
42
  const lookupPaths = resolver.resolve.paths(packageName) ?? [];
43
43
  for (const lookupPath of lookupPaths) {
44
- const candidate = path.join(lookupPath, packageName, "package.json");
44
+ const candidate = nodePath.join(lookupPath, packageName, "package.json");
45
45
  if (fs.existsSync(candidate)) {
46
46
  if (readPackageJson(candidate).name === packageName) return candidate;
47
47
  }
48
48
  }
49
49
  try {
50
50
  const entryPath = resolver.resolve(packageName);
51
- let dir = path.dirname(entryPath);
52
- while (dir !== path.dirname(dir)) {
53
- const candidate = path.join(dir, "package.json");
51
+ let dir = nodePath.dirname(entryPath);
52
+ while (dir !== nodePath.dirname(dir)) {
53
+ const candidate = nodePath.join(dir, "package.json");
54
54
  if (fs.existsSync(candidate)) {
55
55
  if (readPackageJson(candidate).name === packageName) return candidate;
56
56
  }
57
- dir = path.dirname(dir);
57
+ dir = nodePath.dirname(dir);
58
58
  }
59
59
  } catch {}
60
60
  return null;
61
61
  }
62
62
  }
63
63
  function copyPackageAndRuntimeDeps(root, targetNodeModulesDir, initialPackages, alreadyCopied) {
64
- const rootResolver = createRequire(path.join(root, "package.json"));
65
- const rootPkg = readPackageJson(path.join(root, "package.json"));
64
+ const rootResolver = createRequire(nodePath.join(root, "package.json"));
65
+ const rootPkg = readPackageJson(nodePath.join(root, "package.json"));
66
66
  const rootOptional = new Set(Object.keys(rootPkg.optionalDependencies ?? {}));
67
67
  const copied = alreadyCopied ?? /* @__PURE__ */ new Set();
68
68
  const queue = initialPackages.map((packageName) => ({
@@ -80,14 +80,14 @@ function copyPackageAndRuntimeDeps(root, targetNodeModulesDir, initialPackages,
80
80
  throw new Error(`Failed to resolve required runtime dependency "${entry.packageName}" for standalone output`);
81
81
  }
82
82
  const realPackageJsonPath = fs.realpathSync(packageJsonPath);
83
- const packageRoot = path.dirname(realPackageJsonPath);
84
- const packageTarget = path.join(targetNodeModulesDir, entry.packageName);
85
- fs.mkdirSync(path.dirname(packageTarget), { recursive: true });
83
+ const packageRoot = nodePath.dirname(realPackageJsonPath);
84
+ const packageTarget = nodePath.join(targetNodeModulesDir, entry.packageName);
85
+ fs.mkdirSync(nodePath.dirname(packageTarget), { recursive: true });
86
86
  fs.cpSync(packageRoot, packageTarget, {
87
87
  recursive: true,
88
88
  dereference: true,
89
89
  filter: (src) => {
90
- return !path.relative(packageRoot, src).split(path.sep).includes("node_modules");
90
+ return !nodePath.relative(packageRoot, src).split(nodePath.sep).includes("node_modules");
91
91
  }
92
92
  });
93
93
  copied.add(entry.packageName);
@@ -144,58 +144,58 @@ function writeStandalonePackageJson(filePath) {
144
144
  * included.
145
145
  */
146
146
  function emitStandaloneOutput(options) {
147
- const root = path.resolve(options.root);
148
- const outDir = path.resolve(options.outDir);
149
- const clientDir = path.join(outDir, "client");
150
- const serverDir = path.join(outDir, "server");
147
+ const root = nodePath.resolve(options.root);
148
+ const outDir = nodePath.resolve(options.outDir);
149
+ const clientDir = nodePath.join(outDir, "client");
150
+ const serverDir = nodePath.join(outDir, "server");
151
151
  if (!fs.existsSync(clientDir) || !fs.existsSync(serverDir)) throw new Error(`No build output found in ${outDir}. Run vinext build first.`);
152
- const standaloneDir = path.join(outDir, "standalone");
153
- const standaloneDistDir = path.join(standaloneDir, "dist");
154
- const standaloneNodeModulesDir = path.join(standaloneDir, "node_modules");
152
+ const standaloneDir = nodePath.join(outDir, "standalone");
153
+ const standaloneDistDir = nodePath.join(standaloneDir, "dist");
154
+ const standaloneNodeModulesDir = nodePath.join(standaloneDir, "node_modules");
155
155
  fs.rmSync(standaloneDir, {
156
156
  recursive: true,
157
157
  force: true
158
158
  });
159
159
  fs.mkdirSync(standaloneDistDir, { recursive: true });
160
- fs.cpSync(clientDir, path.join(standaloneDistDir, "client"), {
160
+ fs.cpSync(clientDir, nodePath.join(standaloneDistDir, "client"), {
161
161
  recursive: true,
162
162
  dereference: true,
163
- filter: (src) => !path.relative(clientDir, src).split(path.sep).includes("node_modules")
163
+ filter: (src) => !nodePath.relative(clientDir, src).split(nodePath.sep).includes("node_modules")
164
164
  });
165
- fs.cpSync(serverDir, path.join(standaloneDistDir, "server"), {
165
+ fs.cpSync(serverDir, nodePath.join(standaloneDistDir, "server"), {
166
166
  recursive: true,
167
167
  dereference: true,
168
- filter: (src) => !path.relative(serverDir, src).split(path.sep).includes("node_modules")
168
+ filter: (src) => !nodePath.relative(serverDir, src).split(nodePath.sep).includes("node_modules")
169
169
  });
170
- const clientAssetsSidecar = path.join(outDir, "vinext-client-assets.js");
171
- if (fs.existsSync(clientAssetsSidecar)) fs.copyFileSync(clientAssetsSidecar, path.join(standaloneDistDir, "vinext-client-assets.js"));
172
- const publicDir = path.join(root, "public");
173
- if (fs.existsSync(publicDir)) fs.cpSync(publicDir, path.join(standaloneDir, "public"), {
170
+ const clientAssetsSidecar = nodePath.join(outDir, "vinext-client-assets.js");
171
+ if (fs.existsSync(clientAssetsSidecar)) fs.copyFileSync(clientAssetsSidecar, nodePath.join(standaloneDistDir, "vinext-client-assets.js"));
172
+ const publicDir = nodePath.join(root, "public");
173
+ if (fs.existsSync(publicDir)) fs.cpSync(publicDir, nodePath.join(standaloneDir, "public"), {
174
174
  recursive: true,
175
175
  dereference: true,
176
- filter: (src) => !path.relative(publicDir, src).split(path.sep).includes("node_modules")
176
+ filter: (src) => !nodePath.relative(publicDir, src).split(nodePath.sep).includes("node_modules")
177
177
  });
178
178
  fs.mkdirSync(standaloneNodeModulesDir, { recursive: true });
179
179
  const initialPackages = readServerExternalsManifest(serverDir).filter((name) => name !== "vinext");
180
180
  const copiedSet = /* @__PURE__ */ new Set();
181
181
  copyPackageAndRuntimeDeps(root, standaloneNodeModulesDir, initialPackages, copiedSet);
182
182
  const vinextPackageRoot = resolveVinextPackageRoot(options.vinextPackageRoot);
183
- const vinextDistDir = path.join(vinextPackageRoot, "dist");
183
+ const vinextDistDir = nodePath.join(vinextPackageRoot, "dist");
184
184
  if (!fs.existsSync(vinextDistDir)) throw new Error(`vinext runtime dist/ not found at ${vinextPackageRoot}`);
185
- const vinextTargetDir = path.join(standaloneNodeModulesDir, "vinext");
185
+ const vinextTargetDir = nodePath.join(standaloneNodeModulesDir, "vinext");
186
186
  fs.mkdirSync(vinextTargetDir, { recursive: true });
187
- fs.copyFileSync(path.join(vinextPackageRoot, "package.json"), path.join(vinextTargetDir, "package.json"));
188
- fs.cpSync(vinextDistDir, path.join(vinextTargetDir, "dist"), {
187
+ fs.copyFileSync(nodePath.join(vinextPackageRoot, "package.json"), nodePath.join(vinextTargetDir, "package.json"));
188
+ fs.cpSync(vinextDistDir, nodePath.join(vinextTargetDir, "dist"), {
189
189
  recursive: true,
190
190
  dereference: true,
191
191
  filter: (src) => {
192
- return !path.relative(vinextDistDir, src).split(path.sep).includes("node_modules");
192
+ return !nodePath.relative(vinextDistDir, src).split(nodePath.sep).includes("node_modules");
193
193
  }
194
194
  });
195
195
  copiedSet.add("vinext");
196
- copyPackageAndRuntimeDeps(vinextPackageRoot, standaloneNodeModulesDir, runtimeDeps(readPackageJson(path.join(vinextPackageRoot, "package.json"))).filter((name) => !copiedSet.has(name)), copiedSet);
197
- writeStandaloneServerEntry(path.join(standaloneDir, "server.js"));
198
- writeStandalonePackageJson(path.join(standaloneDir, "package.json"));
196
+ copyPackageAndRuntimeDeps(vinextPackageRoot, standaloneNodeModulesDir, runtimeDeps(readPackageJson(nodePath.join(vinextPackageRoot, "package.json"))).filter((name) => !copiedSet.has(name)), copiedSet);
197
+ writeStandaloneServerEntry(nodePath.join(standaloneDir, "server.js"));
198
+ writeStandalonePackageJson(nodePath.join(standaloneDir, "package.json"));
199
199
  return {
200
200
  standaloneDir,
201
201
  copiedPackages: [...copiedSet]
@@ -1,20 +1,4 @@
1
1
  //#region src/cache/cache-adapters-virtual.d.ts
2
- /**
3
- * Code generation for the `virtual:vinext-cache-adapters` module, resolved by
4
- * the vinext vite plugin from the user's `cache` config ({@link VinextCacheConfig}).
5
- *
6
- * The generated module exports `registerConfiguredCacheAdapters(env)`, which the
7
- * server entries call on each request. It self-guards (adapters instantiate once
8
- * per isolate) and is a no-op when nothing is configured. Registration is
9
- * resilient: a factory that throws (e.g. a KV adapter on the Node.js server,
10
- * where the binding can't exist) is logged and skipped rather than failing every
11
- * request, so the same config can be registered from every runtime/router entry.
12
- *
13
- * Descriptor `options` are inlined into the generated module and forwarded to the
14
- * factory at runtime, so a config-time builder like `kvDataAdapter({ binding })`
15
- * never touches the Workers runtime — instantiation is deferred to the first
16
- * request.
17
- */
18
2
  /**
19
3
  * A serializable pointer to a cache adapter module — the shape of each `cache`
20
4
  * slot in the vinext() plugin config. Produced by an adapter builder (e.g.
@@ -45,7 +29,7 @@ declare const VINEXT_CACHE_CONFIG_PLUGIN_PROPERTY = "__vinextCacheConfig";
45
29
  type ViteConfigLoader = {
46
30
  loadConfigFromFile: typeof import("vite").loadConfigFromFile;
47
31
  };
48
- declare function findVinextCacheConfigInPlugins(plugins: import("vite").PluginOption[] | undefined): VinextCacheConfig | null;
32
+ declare function findVinextCacheConfigInPlugins(plugins: import("vite").PluginOption[] | undefined): Promise<VinextCacheConfig | null>;
49
33
  declare function loadVinextCacheConfigFromViteConfig(vite: ViteConfigLoader, root: string): Promise<VinextCacheConfig | null>;
50
34
  /**
51
35
  * Generate the source of the `virtual:vinext-cache-adapters` module for the
@@ -1,17 +1,26 @@
1
+ import { flattenPluginOptions } from "../utils/plugin-options.js";
1
2
  //#region src/cache/cache-adapters-virtual.ts
3
+ /**
4
+ * Code generation for the `virtual:vinext-cache-adapters` module, resolved by
5
+ * the vinext vite plugin from the user's `cache` config ({@link VinextCacheConfig}).
6
+ *
7
+ * The generated module exports `registerConfiguredCacheAdapters(env)`, which the
8
+ * server entries call on each request. It self-guards (adapters instantiate once
9
+ * per isolate) and is a no-op when nothing is configured. Registration is
10
+ * resilient: a factory that throws (e.g. a KV adapter on the Node.js server,
11
+ * where the binding can't exist) is logged and skipped rather than failing every
12
+ * request, so the same config can be registered from every runtime/router entry.
13
+ *
14
+ * Descriptor `options` are inlined into the generated module and forwarded to the
15
+ * factory at runtime, so a config-time builder like `kvDataAdapter({ binding })`
16
+ * never touches the Workers runtime — instantiation is deferred to the first
17
+ * request.
18
+ */
2
19
  /** Public virtual module id imported by the server entries. */
3
20
  const VIRTUAL_CACHE_ADAPTERS = "virtual:vinext-cache-adapters";
4
21
  const VINEXT_CACHE_CONFIG_PLUGIN_PROPERTY = "__vinextCacheConfig";
5
- function flattenPluginOptions(value, target) {
6
- if (Array.isArray(value)) {
7
- for (const item of value) flattenPluginOptions(item, target);
8
- return;
9
- }
10
- if (value) target.push(value);
11
- }
12
- function findVinextCacheConfigInPlugins(plugins) {
13
- const flattened = [];
14
- flattenPluginOptions(plugins, flattened);
22
+ async function findVinextCacheConfigInPlugins(plugins) {
23
+ const flattened = await flattenPluginOptions(plugins);
15
24
  for (const plugin of flattened) {
16
25
  if (!plugin || typeof plugin !== "object") continue;
17
26
  const cacheConfig = plugin[VINEXT_CACHE_CONFIG_PLUGIN_PROPERTY];
@@ -20,7 +29,7 @@ function findVinextCacheConfigInPlugins(plugins) {
20
29
  return null;
21
30
  }
22
31
  async function loadVinextCacheConfigFromViteConfig(vite, root) {
23
- return findVinextCacheConfigInPlugins((await vite.loadConfigFromFile({
32
+ return await findVinextCacheConfigInPlugins((await vite.loadConfigFromFile({
24
33
  command: "build",
25
34
  mode: "production"
26
35
  }, void 0, root))?.config.plugins);
package/dist/check.d.ts CHANGED
@@ -59,38 +59,22 @@ type CheckResult = {
59
59
  declare function hasFreeCjsGlobal(content: string): boolean;
60
60
  /**
61
61
  * Scan source files for `import ... from 'next/...'` statements.
62
- *
63
- * `root` must be forward-slash: it is passed to `findSourceFiles`, which
64
- * requires it.
65
62
  */
66
63
  declare function scanImports(root: string): CheckItem[];
67
64
  /**
68
65
  * Analyze next.config.js/mjs/ts for supported and unsupported options.
69
- *
70
- * `root` must be forward-slash — joined with `path.posix.join`. Only called
71
- * from `runCheck`, which normalizes it.
72
66
  */
73
67
  declare function analyzeConfig(root: string): CheckItem[];
74
68
  /**
75
69
  * Check package.json dependencies for known libraries.
76
- *
77
- * `root` must be forward-slash — joined with `path.posix.join`. Only called
78
- * from `runCheck`, which normalizes it.
79
70
  */
80
71
  declare function checkLibraries(root: string): CheckItem[];
81
72
  /**
82
73
  * Check file conventions (pages, app directory, middleware, etc.)
83
- *
84
- * `root` must be forward-slash — joined with `path.posix.join` and passed to
85
- * `findDir`. Only called from `runCheck`, which normalizes it.
86
74
  */
87
75
  declare function checkConventions(root: string): CheckItem[];
88
76
  /**
89
77
  * Run the full compatibility check.
90
- *
91
- * `root` must be forward-slash — callers normalize it at the CLI entry, and it
92
- * is forwarded to `scanImports` / `checkConventions` / `findDir`, which build
93
- * paths with `path.posix.*`.
94
78
  */
95
79
  declare function runCheck(root: string): CheckResult;
96
80
  /**
package/dist/check.js CHANGED
@@ -1,7 +1,6 @@
1
+ import path from "./deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
1
2
  import { detectPackageManager, findDir } from "./utils/project.js";
2
- import { normalizePathSeparators } from "./utils/path.js";
3
3
  import fs from "node:fs";
4
- import path from "node:path";
5
4
  import { parseAst } from "vite";
6
5
  //#region src/check.ts
7
6
  /**
@@ -371,11 +370,6 @@ const LIBRARY_SUPPORT = {
371
370
  };
372
371
  /**
373
372
  * Recursively find all source files in a directory.
374
- *
375
- * `dir` must be forward-slash, and the returned paths are forward-slash too:
376
- * each entry is joined with `path.posix.join`, which only stays canonical when
377
- * the base already is. This keeps downstream substring checks (e.g.
378
- * `f.includes("/api/")`) and reported paths consistent across platforms.
379
373
  */
380
374
  function findSourceFiles(dir, extensions = [
381
375
  ".ts",
@@ -388,7 +382,7 @@ function findSourceFiles(dir, extensions = [
388
382
  if (!fs.existsSync(dir)) return results;
389
383
  const entries = fs.readdirSync(dir, { withFileTypes: true });
390
384
  for (const entry of entries) {
391
- const fullPath = path.posix.join(dir, entry.name);
385
+ const fullPath = path.join(dir, entry.name);
392
386
  if (entry.isDirectory()) {
393
387
  if (entry.name === "node_modules" || entry.name === ".next" || entry.name === "dist" || entry.name === ".git") continue;
394
388
  results.push(...findSourceFiles(fullPath, extensions));
@@ -402,8 +396,8 @@ function isIdentStart(c) {
402
396
  function isIdentChar(c) {
403
397
  return c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c >= "0" && c <= "9" || c === "_" || c === "$";
404
398
  }
405
- const CJS_GLOBALS = new Set(["__dirname", "__filename"]);
406
- const REGEX_PRECEDING_KEYWORDS = new Set([
399
+ const CJS_GLOBALS = /* @__PURE__ */ new Set(["__dirname", "__filename"]);
400
+ const REGEX_PRECEDING_KEYWORDS = /* @__PURE__ */ new Set([
407
401
  "return",
408
402
  "typeof",
409
403
  "instanceof",
@@ -592,9 +586,6 @@ function hasFreeCjsGlobal(content) {
592
586
  }
593
587
  /**
594
588
  * Scan source files for `import ... from 'next/...'` statements.
595
- *
596
- * `root` must be forward-slash: it is passed to `findSourceFiles`, which
597
- * requires it.
598
589
  */
599
590
  function scanImports(root) {
600
591
  const files = findSourceFiles(root);
@@ -612,7 +603,7 @@ function scanImports(root) {
612
603
  if (mod.startsWith("next/") || mod === "next" || mod === "server-only" || mod === "client-only") {
613
604
  const normalized = mod === "next" ? "next" : mod;
614
605
  if (!importUsage.has(normalized)) importUsage.set(normalized, []);
615
- const relFile = normalizePathSeparators(path.relative(root, file));
606
+ const relFile = path.relative(root, file);
616
607
  const usedInFiles = importUsage.get(normalized) ?? [];
617
608
  if (!usedInFiles.includes(relFile)) usedInFiles.push(relFile);
618
609
  }
@@ -739,9 +730,6 @@ function collectConfigKeys(source) {
739
730
  }
740
731
  /**
741
732
  * Analyze next.config.js/mjs/ts for supported and unsupported options.
742
- *
743
- * `root` must be forward-slash — joined with `path.posix.join`. Only called
744
- * from `runCheck`, which normalizes it.
745
733
  */
746
734
  function analyzeConfig(root) {
747
735
  const configFiles = [
@@ -753,7 +741,7 @@ function analyzeConfig(root) {
753
741
  ];
754
742
  let configPath = null;
755
743
  for (const f of configFiles) {
756
- const p = path.posix.join(root, f);
744
+ const p = path.join(root, f);
757
745
  if (fs.existsSync(p)) {
758
746
  configPath = p;
759
747
  break;
@@ -811,12 +799,9 @@ function analyzeConfig(root) {
811
799
  }
812
800
  /**
813
801
  * Check package.json dependencies for known libraries.
814
- *
815
- * `root` must be forward-slash — joined with `path.posix.join`. Only called
816
- * from `runCheck`, which normalizes it.
817
802
  */
818
803
  function checkLibraries(root) {
819
- const pkgPath = path.posix.join(root, "package.json");
804
+ const pkgPath = path.join(root, "package.json");
820
805
  if (!fs.existsSync(pkgPath)) return [];
821
806
  const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
822
807
  const allDeps = {
@@ -834,16 +819,13 @@ function checkLibraries(root) {
834
819
  }
835
820
  /**
836
821
  * Check file conventions (pages, app directory, middleware, etc.)
837
- *
838
- * `root` must be forward-slash — joined with `path.posix.join` and passed to
839
- * `findDir`. Only called from `runCheck`, which normalizes it.
840
822
  */
841
823
  function checkConventions(root) {
842
824
  const items = [];
843
825
  const pagesDir = findDir(root, "pages", "src/pages");
844
826
  const appDirPath = findDir(root, "app", "src/app");
845
- const hasProxy = fs.existsSync(path.posix.join(root, "proxy.ts")) || fs.existsSync(path.posix.join(root, "proxy.js"));
846
- const hasMiddleware = fs.existsSync(path.posix.join(root, "middleware.ts")) || fs.existsSync(path.posix.join(root, "middleware.js"));
827
+ const hasProxy = fs.existsSync(path.join(root, "proxy.ts")) || fs.existsSync(path.join(root, "proxy.js"));
828
+ const hasMiddleware = fs.existsSync(path.join(root, "middleware.ts")) || fs.existsSync(path.join(root, "middleware.js"));
847
829
  if (pagesDir !== null) {
848
830
  const isSrc = pagesDir.includes("src/pages");
849
831
  items.push({
@@ -921,7 +903,7 @@ function checkConventions(root) {
921
903
  status: "unsupported",
922
904
  detail: "vinext requires a pages/ or app/ directory"
923
905
  });
924
- const pkgPath = path.posix.join(root, "package.json");
906
+ const pkgPath = path.join(root, "package.json");
925
907
  if (fs.existsSync(pkgPath)) {
926
908
  if (JSON.parse(fs.readFileSync(pkgPath, "utf-8")).type !== "module") items.push({
927
909
  name: "Missing \"type\": \"module\" in package.json",
@@ -935,7 +917,7 @@ function checkConventions(root) {
935
917
  const cjsGlobalFiles = [];
936
918
  for (const file of allSourceFiles) {
937
919
  const content = fs.readFileSync(file, "utf-8");
938
- const rel = normalizePathSeparators(path.relative(root, file));
920
+ const rel = path.relative(root, file);
939
921
  if (viewTransitionRegex.test(content)) viewTransitionFiles.push(rel);
940
922
  if (hasFreeCjsGlobal(content)) cjsGlobalFiles.push(rel);
941
923
  }
@@ -950,7 +932,7 @@ function checkConventions(root) {
950
932
  "postcss.config.js",
951
933
  "postcss.config.cjs"
952
934
  ]) {
953
- const configPath = path.posix.join(root, configFile);
935
+ const configPath = path.join(root, configFile);
954
936
  if (fs.existsSync(configPath)) {
955
937
  const content = fs.readFileSync(configPath, "utf-8");
956
938
  if (/plugins\s*:\s*\[\s*['"]/.test(content)) items.push({
@@ -971,10 +953,6 @@ function checkConventions(root) {
971
953
  }
972
954
  /**
973
955
  * Run the full compatibility check.
974
- *
975
- * `root` must be forward-slash — callers normalize it at the CLI entry, and it
976
- * is forwarded to `scanImports` / `checkConventions` / `findDir`, which build
977
- * paths with `path.posix.*`.
978
956
  */
979
957
  function runCheck(root) {
980
958
  const imports = scanImports(root);
package/dist/cli.js CHANGED
@@ -1,13 +1,14 @@
1
1
  #!/usr/bin/env node
2
+ import path, { toSlash } from "./deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
2
3
  import { detectPackageManager, ensureViteConfigCompatibility, hasAppDir, hasViteConfig } from "./utils/project.js";
3
- import { normalizePathSeparators } from "./utils/path.js";
4
4
  import { formatReport, runCheck } from "./check.js";
5
5
  import { parseArgs } from "./cli-args.js";
6
6
  import { createDevServerConfigPlugin, normalizeDevServerHostname } from "./cli-dev-config.js";
7
7
  import { PHASE_PRODUCTION_BUILD } from "./shims/constants.js";
8
- import { createRscCompatibilityId, loadNextConfig, resolveNextConfig } from "./config/next-config.js";
8
+ import { createRscCompatibilityId, findVinextNextConfigInPlugins, loadNextConfig, resolveNextConfig, resolveNextConfigInput } from "./config/next-config.js";
9
9
  import { generateRouteTypes } from "./typegen.js";
10
10
  import { clearPagesClientAssetsBuildMetadata } from "./build/pages-client-assets-module.js";
11
+ import { runWithPreviewBuildCredentials } from "./build/preview-credentials.js";
11
12
  import { findVinextPrerenderConfigInPlugins, findVinextRouteRootConfigInPlugins, formatVinextPrerenderLabel, resolveVinextPrerenderDecision } from "./config/prerender.js";
12
13
  import vinext from "./index.js";
13
14
  import { runPrerender } from "./build/run-prerender.js";
@@ -22,7 +23,6 @@ import { cleanBuildOutput } from "./build/clean-output.js";
22
23
  import { formatAlreadyRunningError, tryAcquireLockfile } from "./server/dev-lockfile.js";
23
24
  import { createRequire } from "node:module";
24
25
  import fs from "node:fs";
25
- import path from "node:path";
26
26
  import { pathToFileURL } from "node:url";
27
27
  import { randomBytes } from "node:crypto";
28
28
  import { execFileSync } from "node:child_process";
@@ -127,6 +127,7 @@ function hasPagesDir() {
127
127
  }
128
128
  async function loadBuildViteConfigMetadata(vite, root) {
129
129
  if (!hasViteConfig(root)) return {
130
+ nextConfig: null,
130
131
  prerenderConfig: null,
131
132
  routeRootConfig: null
132
133
  };
@@ -137,8 +138,9 @@ async function loadBuildViteConfigMetadata(vite, root) {
137
138
  const emptyOutDir = loaded?.config.build?.emptyOutDir;
138
139
  return {
139
140
  emptyOutDir: typeof emptyOutDir === "boolean" ? emptyOutDir : void 0,
140
- prerenderConfig: findVinextPrerenderConfigInPlugins(loaded?.config.plugins),
141
- routeRootConfig: findVinextRouteRootConfigInPlugins(loaded?.config.plugins)
141
+ nextConfig: await findVinextNextConfigInPlugins(loaded?.config.plugins),
142
+ prerenderConfig: await findVinextPrerenderConfigInPlugins(loaded?.config.plugins),
143
+ routeRootConfig: await findVinextRouteRootConfigInPlugins(loaded?.config.plugins)
142
144
  };
143
145
  }
144
146
  /**
@@ -281,9 +283,10 @@ async function buildApp() {
281
283
  const vite = await loadVite();
282
284
  const withBuildBundlerOptions = (bundlerOptions) => ({ rolldownOptions: bundlerOptions });
283
285
  console.log(`\n vinext build (Vite ${getViteVersion()})\n`);
284
- const root = process.cwd();
285
- const isApp = hasAppDir(normalizePathSeparators(root));
286
- const resolvedNextConfig = await resolveNextConfig(await loadNextConfig(root, PHASE_PRODUCTION_BUILD), root);
286
+ const root = toSlash(process.cwd());
287
+ const isApp = hasAppDir(root);
288
+ const buildConfigMetadata = await loadBuildViteConfigMetadata(vite, root);
289
+ const resolvedNextConfig = await resolveNextConfig(buildConfigMetadata.nextConfig ? await resolveNextConfigInput(buildConfigMetadata.nextConfig, PHASE_PRODUCTION_BUILD) : await loadNextConfig(root, PHASE_PRODUCTION_BUILD), root);
287
290
  process.env.__VINEXT_SHARED_BUILD_ID = resolvedNextConfig.buildId;
288
291
  process.env.__VINEXT_SHARED_RSC_COMPATIBILITY_ID = createRscCompatibilityId(resolvedNextConfig);
289
292
  if (!process.env.__VINEXT_SHARED_REVALIDATE_SECRET) process.env.__VINEXT_SHARED_REVALIDATE_SECRET = randomBytes(32).toString("hex");
@@ -309,7 +312,6 @@ async function buildApp() {
309
312
  });
310
313
  }
311
314
  }
312
- const buildConfigMetadata = await loadBuildViteConfigMetadata(vite, root);
313
315
  cleanBuildOutput({
314
316
  root,
315
317
  outDir: distDir,
@@ -318,46 +320,48 @@ async function buildApp() {
318
320
  const isHybrid = isApp && hasPagesDir();
319
321
  const pagesClientAssetsBuildSession = isHybrid ? randomBytes(16).toString("hex") : null;
320
322
  if (pagesClientAssetsBuildSession) process.env.__VINEXT_PAGES_CLIENT_ASSETS_BUILD_SESSION = pagesClientAssetsBuildSession;
321
- try {
322
- const config = buildViteConfig({}, logger);
323
- await (await vite.createBuilder(config)).buildApp();
324
- if (isHybrid) {
325
- console.log(" Building Pages Router server (hybrid)...");
326
- const root = process.cwd();
327
- let userTransformPlugins = [];
328
- if (hasViteConfig(process.cwd())) {
329
- const loaded = await vite.loadConfigFromFile({
330
- command: "build",
331
- mode: "production",
332
- isSsrBuild: true
333
- }, void 0, root);
334
- if (loaded?.config.plugins) userTransformPlugins = loaded.config.plugins.flat(Infinity).filter((p) => !!p && typeof p.name === "string" && !p.name.startsWith("vinext:") && !p.name.startsWith("vite:react") && !p.name.startsWith("rsc:") && p.name !== "vite-rsc-load-module-dev-proxy" && !p.name.startsWith("vite-plugin-cloudflare"));
335
- }
336
- await vite.build({
337
- root,
338
- configFile: false,
339
- plugins: [...userTransformPlugins, vinext({ disableAppRouter: true })],
340
- resolve: { dedupe: [
341
- "react",
342
- "react-dom",
343
- "react/jsx-runtime",
344
- "react/jsx-dev-runtime"
345
- ] },
346
- ...logger ? { customLogger: logger } : {},
347
- build: {
348
- outDir: "dist/server",
349
- emptyOutDir: false,
350
- ssr: "virtual:vinext-server-entry",
351
- ...withBuildBundlerOptions({ output: { entryFileNames: "entry.js" } })
323
+ await runWithPreviewBuildCredentials(async () => {
324
+ try {
325
+ const config = buildViteConfig({}, logger);
326
+ await (await vite.createBuilder(config)).buildApp();
327
+ if (isHybrid) {
328
+ console.log(" Building Pages Router server (hybrid)...");
329
+ const root = process.cwd();
330
+ let userTransformPlugins = [];
331
+ if (hasViteConfig(process.cwd())) {
332
+ const loaded = await vite.loadConfigFromFile({
333
+ command: "build",
334
+ mode: "production",
335
+ isSsrBuild: true
336
+ }, void 0, root);
337
+ if (loaded?.config.plugins) userTransformPlugins = loaded.config.plugins.flat(Infinity).filter((p) => !!p && typeof p.name === "string" && !p.name.startsWith("vinext:") && !p.name.startsWith("vite:react") && !p.name.startsWith("rsc:") && p.name !== "vite-rsc-load-module-dev-proxy" && !p.name.startsWith("vite-plugin-cloudflare"));
352
338
  }
353
- });
354
- }
355
- } finally {
356
- if (pagesClientAssetsBuildSession) {
357
- clearPagesClientAssetsBuildMetadata(pagesClientAssetsBuildSession);
358
- if (process.env.__VINEXT_PAGES_CLIENT_ASSETS_BUILD_SESSION === pagesClientAssetsBuildSession) delete process.env.__VINEXT_PAGES_CLIENT_ASSETS_BUILD_SESSION;
339
+ await vite.build({
340
+ root,
341
+ configFile: false,
342
+ plugins: [...userTransformPlugins, vinext({ disableAppRouter: true })],
343
+ resolve: { dedupe: [
344
+ "react",
345
+ "react-dom",
346
+ "react/jsx-runtime",
347
+ "react/jsx-dev-runtime"
348
+ ] },
349
+ ...logger ? { customLogger: logger } : {},
350
+ build: {
351
+ outDir: "dist/server",
352
+ emptyOutDir: false,
353
+ ssr: "virtual:vinext-server-entry",
354
+ ...withBuildBundlerOptions({ output: { entryFileNames: "entry.js" } })
355
+ }
356
+ });
357
+ }
358
+ } finally {
359
+ if (pagesClientAssetsBuildSession) {
360
+ clearPagesClientAssetsBuildMetadata(pagesClientAssetsBuildSession);
361
+ if (process.env.__VINEXT_PAGES_CLIENT_ASSETS_BUILD_SESSION === pagesClientAssetsBuildSession) delete process.env.__VINEXT_PAGES_CLIENT_ASSETS_BUILD_SESSION;
362
+ }
359
363
  }
360
- }
364
+ });
361
365
  if (outputMode === "standalone") {
362
366
  const standalone = emitStandaloneOutput({
363
367
  root: process.cwd(),
@@ -381,19 +385,20 @@ async function buildApp() {
381
385
  process.stdout.write("\x1B[0m");
382
386
  console.log(` ${formatVinextPrerenderLabel(prerenderDecision)}`);
383
387
  prerenderResult = await runPrerender({
384
- root: normalizePathSeparators(process.cwd()),
385
- concurrency: parsed.prerenderConcurrency
388
+ root,
389
+ concurrency: parsed.prerenderConcurrency,
390
+ nextConfig: resolvedNextConfig
386
391
  });
387
392
  await emitPrerenderPathManifest({
388
- root: normalizePathSeparators(process.cwd()),
389
- nextConfigOverride: resolvedNextConfig,
393
+ root,
394
+ nextConfig: resolvedNextConfig,
390
395
  routeRootConfig: buildConfigMetadata.routeRootConfig
391
396
  });
392
397
  }
393
398
  process.stdout.write("\x1B[0m");
394
399
  const { printBuildReport } = await import("./build/report.js");
395
400
  await printBuildReport({
396
- root: normalizePathSeparators(process.cwd()),
401
+ root,
397
402
  pageExtensions: resolvedNextConfig.pageExtensions,
398
403
  prerenderResult: prerenderResult ?? void 0
399
404
  });
@@ -466,7 +471,7 @@ async function check() {
466
471
  if (parseArgs(rawArgs).help) return printHelp("check");
467
472
  console.log(`\n vinext check\n`);
468
473
  console.log(" Scanning project...\n");
469
- const result = runCheck(normalizePathSeparators(process.cwd()));
474
+ const result = runCheck(toSlash(process.cwd()));
470
475
  console.log(formatReport(result));
471
476
  }
472
477
  async function typegen() {
@@ -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/client/instrumentation-client-inject.ts
4
4
  /** Resolve empty-module next to this file (.js in dist, .ts in source). */
5
5
  function resolveInstrumentationClientEmptyModule(dir) {
@@ -2,7 +2,7 @@ import { stripBasePath } from "../utils/base-path.js";
2
2
  import { getLocalePathPrefix } from "../utils/domain-locale.js";
3
3
  //#region src/client/pages-router-link-navigation.ts
4
4
  function resolvePagesRouterQueryOnlyHref(href, { asPath, basePath, fallbackHref, locales }) {
5
- if (!href.startsWith("?")) return href;
5
+ if (!href.startsWith("?") && !href.startsWith("#")) return href;
6
6
  try {
7
7
  const fallbackUrl = new URL(fallbackHref);
8
8
  const base = new URL(asPath ?? `${stripBasePath(fallbackUrl.pathname, basePath)}${fallbackUrl.search}${fallbackUrl.hash}`, "http://vinext.local");
@@ -159,7 +159,7 @@ function _getRedirectIndex(redirects) {
159
159
  return index;
160
160
  }
161
161
  /** Hop-by-hop headers that should not be forwarded through a proxy. */
162
- const HOP_BY_HOP_HEADERS = new Set([
162
+ const HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
163
163
  "connection",
164
164
  "keep-alive",
165
165
  "proxy-authenticate",
@@ -175,7 +175,7 @@ const HOP_BY_HOP_HEADERS = new Set([
175
175
  * still forwards proxy auth credentials, while response sanitization strips
176
176
  * them before returning data to the client.
177
177
  */
178
- const REQUEST_HOP_BY_HOP_HEADERS = new Set([
178
+ const REQUEST_HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
179
179
  "connection",
180
180
  "keep-alive",
181
181
  "te",
@@ -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
  import { parseEnv } from "node:util";
4
4
  //#region src/config/dotenv.ts
5
5
  /**