vinext 1.0.0-beta.6 → 1.0.0-beta.8

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 (179) hide show
  1. package/README.md +47 -3
  2. package/dist/build/action-owner-manifest.d.ts +42 -0
  3. package/dist/build/action-owner-manifest.js +110 -0
  4. package/dist/build/clean-output.js +1 -4
  5. package/dist/build/client-build-config.js +10 -11
  6. package/dist/build/prerender.d.ts +1 -1
  7. package/dist/build/prerender.js +12 -6
  8. package/dist/build/report.d.ts +1 -1
  9. package/dist/build/route-classification-manifest.d.ts +1 -1
  10. package/dist/build/static-export.d.ts +1 -1
  11. package/dist/client/app-nav-failure-handler.js +1 -0
  12. package/dist/client/navigation-runtime.d.ts +5 -3
  13. package/dist/client/navigation-runtime.js +4 -8
  14. package/dist/entries/app-browser-entry.d.ts +1 -1
  15. package/dist/entries/app-rsc-entry.d.ts +2 -1
  16. package/dist/entries/app-rsc-entry.js +111 -8
  17. package/dist/entries/pages-client-entry.d.ts +1 -1
  18. package/dist/entries/pages-server-entry.d.ts +1 -1
  19. package/dist/index.d.ts +3 -0
  20. package/dist/index.js +119 -26
  21. package/dist/plugins/action-owner-manifest.d.ts +14 -0
  22. package/dist/plugins/action-owner-manifest.js +84 -0
  23. package/dist/plugins/ast-utils.d.ts +30 -1
  24. package/dist/plugins/ast-utils.js +76 -1
  25. package/dist/plugins/css-module-imports.d.ts +2 -2
  26. package/dist/plugins/css-module-imports.js +5 -13
  27. package/dist/plugins/dynamic-preload-metadata.js +13 -34
  28. package/dist/plugins/environment.d.ts +11 -0
  29. package/dist/plugins/environment.js +7 -0
  30. package/dist/plugins/extensionless-dynamic-import.js +11 -35
  31. package/dist/plugins/fonts.js +8 -12
  32. package/dist/plugins/ignore-dynamic-requests.d.ts +2 -4
  33. package/dist/plugins/ignore-dynamic-requests.js +29 -59
  34. package/dist/plugins/import-meta-url.d.ts +15 -9
  35. package/dist/plugins/import-meta-url.js +310 -85
  36. package/dist/plugins/instrumentation-client.js +4 -5
  37. package/dist/plugins/middleware-export-validation.js +5 -17
  38. package/dist/plugins/middleware-server-only.js +2 -2
  39. package/dist/plugins/og-asset-ownership.js +18 -26
  40. package/dist/plugins/og-assets.js +2 -4
  41. package/dist/plugins/optimize-imports.js +2 -4
  42. package/dist/plugins/pages-node-externals.js +13 -40
  43. package/dist/plugins/remove-console.js +2 -4
  44. package/dist/plugins/require-condition-resolution.d.ts +16 -0
  45. package/dist/plugins/require-condition-resolution.js +167 -0
  46. package/dist/plugins/require-context.js +11 -46
  47. package/dist/plugins/sass.js +1 -1
  48. package/dist/plugins/server-externals-manifest.js +1 -23
  49. package/dist/plugins/strip-server-exports.js +13 -19
  50. package/dist/plugins/styled-jsx.js +17 -19
  51. package/dist/plugins/transform-result.d.ts +10 -0
  52. package/dist/plugins/transform-result.js +10 -0
  53. package/dist/plugins/transitive-externals.js +7 -21
  54. package/dist/plugins/typeof-window.d.ts +3 -8
  55. package/dist/plugins/typeof-window.js +5 -15
  56. package/dist/plugins/use-cache-callable.js +12 -22
  57. package/dist/plugins/wasm-module-import.js +1 -1
  58. package/dist/plugins/worker-image-imports.d.ts +12 -0
  59. package/dist/plugins/worker-image-imports.js +136 -0
  60. package/dist/routing/app-route-graph.d.ts +3 -2
  61. package/dist/routing/app-route-graph.js +1 -1
  62. package/dist/routing/route-pattern.d.ts +8 -1
  63. package/dist/routing/route-pattern.js +28 -1
  64. package/dist/routing/route-validation.js +7 -1
  65. package/dist/server/accept-encoding.d.ts +1 -2
  66. package/dist/server/accept-encoding.js +1 -4
  67. package/dist/server/app-action-forwarding.d.ts +18 -0
  68. package/dist/server/app-action-forwarding.js +140 -0
  69. package/dist/server/app-browser-entry.js +231 -50
  70. package/dist/server/app-browser-error.d.ts +1 -2
  71. package/dist/server/app-browser-error.js +1 -5
  72. package/dist/server/app-browser-history-controller.d.ts +16 -1
  73. package/dist/server/app-browser-history-controller.js +135 -18
  74. package/dist/server/app-browser-navigation-abort.d.ts +16 -0
  75. package/dist/server/app-browser-navigation-abort.js +29 -0
  76. package/dist/server/app-browser-navigation-controller.d.ts +4 -0
  77. package/dist/server/app-browser-navigation-controller.js +22 -6
  78. package/dist/server/app-browser-navigation-response.d.ts +11 -0
  79. package/dist/server/app-browser-navigation-response.js +8 -0
  80. package/dist/server/app-browser-popstate.d.ts +6 -1
  81. package/dist/server/app-browser-popstate.js +6 -2
  82. package/dist/server/app-browser-server-action-client.js +1 -1
  83. package/dist/server/app-browser-state.d.ts +2 -2
  84. package/dist/server/app-browser-state.js +3 -3
  85. package/dist/server/app-browser-stream.d.ts +0 -2
  86. package/dist/server/app-browser-supplemental-refresh.d.ts +49 -0
  87. package/dist/server/app-browser-supplemental-refresh.js +190 -0
  88. package/dist/server/app-browser-visible-commit.js +23 -12
  89. package/dist/server/app-elements-wire.d.ts +2 -0
  90. package/dist/server/app-elements-wire.js +7 -0
  91. package/dist/server/app-history-state.d.ts +22 -1
  92. package/dist/server/app-history-state.js +93 -9
  93. package/dist/server/app-optimistic-routing.d.ts +22 -1
  94. package/dist/server/app-optimistic-routing.js +137 -12
  95. package/dist/server/app-page-cache-finalizer.d.ts +3 -1
  96. package/dist/server/app-page-cache-finalizer.js +6 -6
  97. package/dist/server/app-page-cache.d.ts +2 -1
  98. package/dist/server/app-page-cache.js +2 -2
  99. package/dist/server/app-page-dispatch.d.ts +4 -1
  100. package/dist/server/app-page-dispatch.js +10 -1
  101. package/dist/server/app-page-element-builder.d.ts +1 -0
  102. package/dist/server/app-page-element-builder.js +1 -0
  103. package/dist/server/app-page-ppr-runtime.js +3 -2
  104. package/dist/server/app-page-render.d.ts +2 -1
  105. package/dist/server/app-page-render.js +6 -3
  106. package/dist/server/app-page-request.d.ts +2 -33
  107. package/dist/server/app-page-request.js +1 -27
  108. package/dist/server/app-page-route-wiring.d.ts +1 -0
  109. package/dist/server/app-page-route-wiring.js +4 -0
  110. package/dist/server/app-page-segment-state.d.ts +2 -2
  111. package/dist/server/app-page-segment-state.js +14 -8
  112. package/dist/server/app-ppr-fallback-shell.d.ts +2 -2
  113. package/dist/server/app-ppr-fallback-shell.js +3 -6
  114. package/dist/server/app-route-handler-dispatch.js +4 -1
  115. package/dist/server/app-route-handler-execution.js +1 -1
  116. package/dist/server/app-rsc-cache-busting.d.ts +2 -1
  117. package/dist/server/app-rsc-cache-busting.js +34 -8
  118. package/dist/server/app-rsc-handler.d.ts +4 -2
  119. package/dist/server/app-rsc-handler.js +57 -9
  120. package/dist/server/app-rsc-request-normalization.d.ts +2 -0
  121. package/dist/server/app-rsc-request-normalization.js +5 -1
  122. package/dist/server/app-rsc-route-matching.d.ts +4 -3
  123. package/dist/server/app-rsc-route-matching.js +14 -42
  124. package/dist/server/app-server-action-execution.d.ts +3 -0
  125. package/dist/server/app-server-action-execution.js +77 -2
  126. package/dist/server/app-ssr-entry.js +6 -6
  127. package/dist/server/app-ssr-stream.d.ts +1 -1
  128. package/dist/server/app-ssr-stream.js +2 -2
  129. package/dist/server/app-visited-response-cache.d.ts +6 -1
  130. package/dist/server/app-visited-response-cache.js +18 -2
  131. package/dist/server/dev-route-files.js +2 -5
  132. package/dist/server/dev-server.d.ts +5 -13
  133. package/dist/server/dev-server.js +22 -22
  134. package/dist/server/dev-stack-sourcemap.d.ts +1 -2
  135. package/dist/server/dev-stack-sourcemap.js +1 -4
  136. package/dist/server/headers.d.ts +5 -1
  137. package/dist/server/headers.js +5 -1
  138. package/dist/server/isr-cache.d.ts +6 -14
  139. package/dist/server/isr-cache.js +6 -27
  140. package/dist/server/middleware.d.ts +3 -16
  141. package/dist/server/middleware.js +2 -19
  142. package/dist/server/navigation-planner.d.ts +1 -0
  143. package/dist/server/navigation-planner.js +57 -9
  144. package/dist/server/navigation-trace.d.ts +1 -0
  145. package/dist/server/navigation-trace.js +1 -0
  146. package/dist/server/pages-data-route.d.ts +1 -10
  147. package/dist/server/pages-data-route.js +1 -12
  148. package/dist/server/pages-node-compat.d.ts +1 -4
  149. package/dist/server/pages-node-compat.js +1 -7
  150. package/dist/server/pages-readiness.js +4 -4
  151. package/dist/server/prerender-route-params.d.ts +1 -2
  152. package/dist/server/prerender-route-params.js +1 -4
  153. package/dist/server/prod-server.js +3 -1
  154. package/dist/shims/cache-runtime.js +39 -22
  155. package/dist/shims/cache.d.ts +1 -1
  156. package/dist/shims/dynamic.d.ts +3 -3
  157. package/dist/shims/dynamic.js +4 -6
  158. package/dist/shims/error.js +1 -1
  159. package/dist/shims/fetch-cache.d.ts +3 -1
  160. package/dist/shims/fetch-cache.js +23 -4
  161. package/dist/shims/internal/app-route-prefetch-policy.d.ts +6 -7
  162. package/dist/shims/internal/app-route-prefetch-policy.js +5 -4
  163. package/dist/shims/link.js +1 -1
  164. package/dist/shims/navigation.d.ts +12 -3
  165. package/dist/shims/navigation.js +46 -11
  166. package/dist/shims/navigation.react-server.js +1 -1
  167. package/dist/shims/request-state-types.d.ts +1 -1
  168. package/dist/shims/router.js +75 -4
  169. package/dist/shims/unified-request-context.d.ts +1 -1
  170. package/dist/shims/unified-request-context.js +1 -0
  171. package/dist/utils/built-asset-url.d.ts +1 -1
  172. package/dist/utils/built-asset-url.js +4 -2
  173. package/dist/utils/package-name.d.ts +11 -0
  174. package/dist/utils/package-name.js +18 -0
  175. package/dist/utils/path.d.ts +8 -1
  176. package/dist/utils/path.js +21 -1
  177. package/dist/utils/react-compiler-support.d.ts +20 -0
  178. package/dist/utils/react-compiler-support.js +29 -0
  179. package/package.json +3 -2
@@ -0,0 +1,18 @@
1
+ import { builtinModules } from "node:module";
2
+ //#region src/utils/package-name.ts
3
+ const BUILTIN_MODULES = new Set(builtinModules.flatMap((name) => name.startsWith("node:") ? [name, name.slice(5)] : [name, `node:${name}`]));
4
+ const BARE_PACKAGE_SPECIFIER_RE = /^(?:(?<scoped>@[A-Za-z0-9._~-]+\/[A-Za-z0-9._~-]+)|(?<unscoped>[A-Za-z0-9_~-][A-Za-z0-9._~-]*))(?:\/[^?#]*)?$/;
5
+ /**
6
+ * Extract the npm package name from a bare package specifier.
7
+ *
8
+ * Relative and absolute paths, package imports, URL/virtual schemes, malformed
9
+ * scoped names, and Node builtins are not npm package references.
10
+ */
11
+ function packageNameFromSpecifier(specifier) {
12
+ const match = BARE_PACKAGE_SPECIFIER_RE.exec(specifier);
13
+ const packageName = match?.groups?.scoped ?? match?.groups?.unscoped ?? null;
14
+ if (!packageName || BUILTIN_MODULES.has(packageName)) return null;
15
+ return packageName;
16
+ }
17
+ //#endregion
18
+ export { BARE_PACKAGE_SPECIFIER_RE, packageNameFromSpecifier };
@@ -1,6 +1,13 @@
1
1
  //#region src/utils/path.d.ts
2
2
  declare const isWindows: boolean;
3
+ declare const NODE_MODULES_PATH_RE: RegExp;
3
4
  declare function stripViteModuleQuery(id: string): string;
5
+ /** Canonicalize an external-origin filesystem path for use as a Vite module id. */
6
+ declare function canonicalizeFilePath(filePath: string): string;
7
+ /** Whether `filePath` is a strict descendant of `directory`. */
8
+ declare function isPathInside(directory: string, filePath: string): boolean;
9
+ /** Whether `filePath` is `directory` itself or one of its descendants. */
10
+ declare function isPathInsideOrEqual(directory: string, filePath: string): boolean;
4
11
  /** Strip a trailing `.js` extension from a module specifier so
5
12
  * `resolveShimModulePath` looks for the correct base name (e.g. `headers.js`
6
13
  * → `headers`). Public and internal shim imports may carry extensionful
@@ -8,4 +15,4 @@ declare function stripViteModuleQuery(id: string): string;
8
15
  * files like `headers.js.ts`. */
9
16
  declare function stripJsExtension(name: string): string;
10
17
  //#endregion
11
- export { isWindows, stripJsExtension, stripViteModuleQuery };
18
+ export { NODE_MODULES_PATH_RE, canonicalizeFilePath, isPathInside, isPathInsideOrEqual, isWindows, stripJsExtension, stripViteModuleQuery };
@@ -1,9 +1,29 @@
1
+ import path, { toSlash } from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
2
+ import fs from "node:fs";
1
3
  //#region src/utils/path.ts
2
4
  const isWindows = process.platform === "win32";
5
+ const NODE_MODULES_PATH_RE = /(?:^|[\\/])node_modules(?:[\\/]|$)/;
3
6
  function stripViteModuleQuery(id) {
4
7
  const queryIndex = id.search(/[?#]/);
5
8
  return queryIndex === -1 ? id : id.slice(0, queryIndex);
6
9
  }
10
+ /** Canonicalize an external-origin filesystem path for use as a Vite module id. */
11
+ function canonicalizeFilePath(filePath) {
12
+ try {
13
+ return toSlash(fs.realpathSync.native(filePath));
14
+ } catch {
15
+ return toSlash(filePath);
16
+ }
17
+ }
18
+ /** Whether `filePath` is a strict descendant of `directory`. */
19
+ function isPathInside(directory, filePath) {
20
+ const relativePath = path.relative(directory, filePath);
21
+ return relativePath !== "" && relativePath !== ".." && !relativePath.startsWith("../") && !path.isAbsolute(relativePath);
22
+ }
23
+ /** Whether `filePath` is `directory` itself or one of its descendants. */
24
+ function isPathInsideOrEqual(directory, filePath) {
25
+ return path.relative(directory, filePath) === "" || isPathInside(directory, filePath);
26
+ }
7
27
  /** Strip a trailing `.js` extension from a module specifier so
8
28
  * `resolveShimModulePath` looks for the correct base name (e.g. `headers.js`
9
29
  * → `headers`). Public and internal shim imports may carry extensionful
@@ -13,4 +33,4 @@ function stripJsExtension(name) {
13
33
  return name.endsWith(".js") ? name.slice(0, -3) : name;
14
34
  }
15
35
  //#endregion
16
- export { isWindows, stripJsExtension, stripViteModuleQuery };
36
+ export { NODE_MODULES_PATH_RE, canonicalizeFilePath, isPathInside, isPathInsideOrEqual, isWindows, stripJsExtension, stripViteModuleQuery };
@@ -0,0 +1,20 @@
1
+ //#region src/utils/react-compiler-support.d.ts
2
+ /**
3
+ * The React Compiler option landed in @vitejs/plugin-react 6.1. Older versions
4
+ * accept an unknown `compiler` key in their options object and silently drop
5
+ * it, which would leave the compiler disabled while the config says otherwise.
6
+ *
7
+ * The plugin factory only returns `vite:react-compiler` when the installed
8
+ * version understands the option, so its presence is what we probe for.
9
+ */
10
+ declare const REACT_COMPILER_PLUGIN_NAME = "vite:react-compiler";
11
+ /** Whether the user asked for the React Compiler through vinext's `react` option. */
12
+ declare function isReactCompilerRequested(reactOptions: unknown): boolean;
13
+ /** Whether a plugin entry is the React Compiler plugin. */
14
+ declare function isReactCompilerPlugin(plugin: unknown): boolean;
15
+ /** Whether the resolved @vitejs/plugin-react actually registered the compiler. */
16
+ declare function hasReactCompilerPlugin(plugins: readonly unknown[]): boolean;
17
+ /** Message for when `react: { compiler: true }` cannot be honored. */
18
+ declare function reactCompilerUnsupportedMessage(installCommand: string): string;
19
+ //#endregion
20
+ export { REACT_COMPILER_PLUGIN_NAME, hasReactCompilerPlugin, isReactCompilerPlugin, isReactCompilerRequested, reactCompilerUnsupportedMessage };
@@ -0,0 +1,29 @@
1
+ //#region src/utils/react-compiler-support.ts
2
+ /**
3
+ * The React Compiler option landed in @vitejs/plugin-react 6.1. Older versions
4
+ * accept an unknown `compiler` key in their options object and silently drop
5
+ * it, which would leave the compiler disabled while the config says otherwise.
6
+ *
7
+ * The plugin factory only returns `vite:react-compiler` when the installed
8
+ * version understands the option, so its presence is what we probe for.
9
+ */
10
+ const REACT_COMPILER_PLUGIN_NAME = "vite:react-compiler";
11
+ /** Whether the user asked for the React Compiler through vinext's `react` option. */
12
+ function isReactCompilerRequested(reactOptions) {
13
+ if (!reactOptions || typeof reactOptions !== "object") return false;
14
+ return Boolean(reactOptions.compiler);
15
+ }
16
+ /** Whether a plugin entry is the React Compiler plugin. */
17
+ function isReactCompilerPlugin(plugin) {
18
+ return typeof plugin === "object" && plugin !== null && plugin.name === "vite:react-compiler";
19
+ }
20
+ /** Whether the resolved @vitejs/plugin-react actually registered the compiler. */
21
+ function hasReactCompilerPlugin(plugins) {
22
+ return plugins.some(isReactCompilerPlugin);
23
+ }
24
+ /** Message for when `react: { compiler: true }` cannot be honored. */
25
+ function reactCompilerUnsupportedMessage(installCommand) {
26
+ return "vinext: `react: { compiler: true }` requires @vitejs/plugin-react 6.1 or newer.\nThe installed version ignores the option, which would leave the React Compiler disabled.\nRun: " + installCommand + " @vitejs/plugin-react@latest";
27
+ }
28
+ //#endregion
29
+ export { REACT_COMPILER_PLUGIN_NAME, hasReactCompilerPlugin, isReactCompilerPlugin, isReactCompilerRequested, reactCompilerUnsupportedMessage };
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "vinext",
3
- "version": "1.0.0-beta.6",
3
+ "version": "1.0.0-beta.8",
4
4
  "description": "Run Next.js apps on Vite. Drop-in replacement for the next CLI.",
5
+ "homepage": "https://vinext.dev/",
5
6
  "license": "MIT",
6
7
  "repository": {
7
8
  "type": "git",
@@ -181,7 +182,7 @@
181
182
  "@types/node": "^25.9.2",
182
183
  "@types/react": "^19.2.16",
183
184
  "@types/react-dom": "^19.2.3",
184
- "@vitejs/plugin-react": "^6.0.1",
185
+ "@vitejs/plugin-react": "^6.1.0",
185
186
  "@vitejs/plugin-rsc": "^0.5.34",
186
187
  "am-i-vibing": "^0.5.0",
187
188
  "image-size": "2.0.2",