vite 8.0.0-beta.7 → 8.0.0-beta.9

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.
@@ -63,10 +63,10 @@ declare class HMRClient {
63
63
  private updateQueue;
64
64
  private pendingUpdateQueue;
65
65
  /**
66
- * buffer multiple hot updates triggered by the same src change
67
- * so that they are invoked in the same order they were sent.
68
- * (otherwise the order may be inconsistent because of the http request round trip)
69
- */
66
+ * buffer multiple hot updates triggered by the same src change
67
+ * so that they are invoked in the same order they were sent.
68
+ * (otherwise the order may be inconsistent because of the http request round trip)
69
+ */
70
70
  queueUpdate(payload: Update): Promise<void>;
71
71
  private fetchUpdate;
72
72
  }
@@ -74,14 +74,14 @@ declare class HMRClient {
74
74
  //#region src/shared/ssrTransform.d.ts
75
75
  interface DefineImportMetadata {
76
76
  /**
77
- * Imported names before being transformed to `ssrImportKey`
78
- *
79
- * import foo, { bar as baz, qux } from 'hello'
80
- * => ['default', 'bar', 'qux']
81
- *
82
- * import * as namespace from 'world
83
- * => undefined
84
- */
77
+ * Imported names before being transformed to `ssrImportKey`
78
+ *
79
+ * import foo, { bar as baz, qux } from 'hello'
80
+ * => ['default', 'bar', 'qux']
81
+ *
82
+ * import * as namespace from 'world
83
+ * => undefined
84
+ */
85
85
  importedNames?: string[];
86
86
  }
87
87
  interface SSRImportMetadata extends DefineImportMetadata {
@@ -114,21 +114,21 @@ declare class ModuleRunner {
114
114
  private closed;
115
115
  constructor(options: ModuleRunnerOptions, evaluator?: ModuleEvaluator, debug?: ModuleRunnerDebugger | undefined);
116
116
  /**
117
- * URL to execute. Accepts file path, server path or id relative to the root.
118
- */
117
+ * URL to execute. Accepts file path, server path or id relative to the root.
118
+ */
119
119
  import<T = any>(url: string): Promise<T>;
120
120
  /**
121
- * Clear all caches including HMR listeners.
122
- */
121
+ * Clear all caches including HMR listeners.
122
+ */
123
123
  clearCache(): void;
124
124
  /**
125
- * Clears all caches, removes all HMR listeners, and resets source map support.
126
- * This method doesn't stop the HMR connection.
127
- */
125
+ * Clears all caches, removes all HMR listeners, and resets source map support.
126
+ * This method doesn't stop the HMR connection.
127
+ */
128
128
  close(): Promise<void>;
129
129
  /**
130
- * Returns `true` if the runtime has been closed by calling `close()` method.
131
- */
130
+ * Returns `true` if the runtime has been closed by calling `close()` method.
131
+ */
132
132
  isClosed(): boolean;
133
133
  private processImport;
134
134
  private isCircularModule;
@@ -172,20 +172,20 @@ interface ModuleRunnerContext {
172
172
  }
173
173
  interface ModuleEvaluator {
174
174
  /**
175
- * Number of prefixed lines in the transformed code.
176
- */
175
+ * Number of prefixed lines in the transformed code.
176
+ */
177
177
  startOffset?: number;
178
178
  /**
179
- * Run code that was transformed by Vite.
180
- * @param context Function context
181
- * @param code Transformed code
182
- * @param module The module node
183
- */
179
+ * Run code that was transformed by Vite.
180
+ * @param context Function context
181
+ * @param code Transformed code
182
+ * @param module The module node
183
+ */
184
184
  runInlinedModule(context: ModuleRunnerContext, code: string, module: Readonly<EvaluatedModuleNode>): Promise<any>;
185
185
  /**
186
- * Run externalized module.
187
- * @param file File URL to the external module
188
- */
186
+ * Run externalized module.
187
+ * @param file File URL to the external module
188
+ */
189
189
  runExternalModule(file: string): Promise<any>;
190
190
  }
191
191
  type ResolvedResult = (ExternalFetchResult | ViteFetchResult) & {
@@ -195,36 +195,36 @@ type ResolvedResult = (ExternalFetchResult | ViteFetchResult) & {
195
195
  type FetchFunction = (id: string, importer?: string, options?: FetchFunctionOptions) => Promise<FetchResult>;
196
196
  interface ModuleRunnerHmr {
197
197
  /**
198
- * Configure HMR logger.
199
- */
198
+ * Configure HMR logger.
199
+ */
200
200
  logger?: false | HMRLogger;
201
201
  }
202
202
  interface ModuleRunnerOptions {
203
203
  /**
204
- * A set of methods to communicate with the server.
205
- */
204
+ * A set of methods to communicate with the server.
205
+ */
206
206
  transport: ModuleRunnerTransport;
207
207
  /**
208
- * Configure how source maps are resolved. Prefers `node` if `process.setSourceMapsEnabled` is available.
209
- * Otherwise it will use `prepareStackTrace` by default which overrides `Error.prepareStackTrace` method.
210
- * You can provide an object to configure how file contents and source maps are resolved for files that were not processed by Vite.
211
- */
208
+ * Configure how source maps are resolved. Prefers `node` if `process.setSourceMapsEnabled` is available.
209
+ * Otherwise it will use `prepareStackTrace` by default which overrides `Error.prepareStackTrace` method.
210
+ * You can provide an object to configure how file contents and source maps are resolved for files that were not processed by Vite.
211
+ */
212
212
  sourcemapInterceptor?: false | "node" | "prepareStackTrace" | InterceptorOptions;
213
213
  /**
214
- * Disable HMR or configure HMR options.
215
- *
216
- * @default true
217
- */
214
+ * Disable HMR or configure HMR options.
215
+ *
216
+ * @default true
217
+ */
218
218
  hmr?: boolean | ModuleRunnerHmr;
219
219
  /**
220
- * Create import.meta object for the module.
221
- *
222
- * @default createDefaultImportMeta
223
- */
220
+ * Create import.meta object for the module.
221
+ *
222
+ * @default createDefaultImportMeta
223
+ */
224
224
  createImportMeta?: (modulePath: string) => ModuleRunnerImportMeta | Promise<ModuleRunnerImportMeta>;
225
225
  /**
226
- * Custom module cache. If not provided, creates a separate module cache for each ModuleRunner instance.
227
- */
226
+ * Custom module cache. If not provided, creates a separate module cache for each ModuleRunner instance.
227
+ */
228
228
  evaluatedModules?: EvaluatedModules;
229
229
  }
230
230
  interface ImportMetaEnv {
@@ -255,40 +255,40 @@ declare class EvaluatedModules {
255
255
  readonly fileToModulesMap: Map<string, Set<EvaluatedModuleNode>>;
256
256
  readonly urlToIdModuleMap: Map<string, EvaluatedModuleNode>;
257
257
  /**
258
- * Returns the module node by the resolved module ID. Usually, module ID is
259
- * the file system path with query and/or hash. It can also be a virtual module.
260
- *
261
- * Module runner graph will have 1 to 1 mapping with the server module graph.
262
- * @param id Resolved module ID
263
- */
258
+ * Returns the module node by the resolved module ID. Usually, module ID is
259
+ * the file system path with query and/or hash. It can also be a virtual module.
260
+ *
261
+ * Module runner graph will have 1 to 1 mapping with the server module graph.
262
+ * @param id Resolved module ID
263
+ */
264
264
  getModuleById(id: string): EvaluatedModuleNode | undefined;
265
265
  /**
266
- * Returns all modules related to the file system path. Different modules
267
- * might have different query parameters or hash, so it's possible to have
268
- * multiple modules for the same file.
269
- * @param file The file system path of the module
270
- */
266
+ * Returns all modules related to the file system path. Different modules
267
+ * might have different query parameters or hash, so it's possible to have
268
+ * multiple modules for the same file.
269
+ * @param file The file system path of the module
270
+ */
271
271
  getModulesByFile(file: string): Set<EvaluatedModuleNode> | undefined;
272
272
  /**
273
- * Returns the module node by the URL that was used in the import statement.
274
- * Unlike module graph on the server, the URL is not resolved and is used as is.
275
- * @param url Server URL that was used in the import statement
276
- */
273
+ * Returns the module node by the URL that was used in the import statement.
274
+ * Unlike module graph on the server, the URL is not resolved and is used as is.
275
+ * @param url Server URL that was used in the import statement
276
+ */
277
277
  getModuleByUrl(url: string): EvaluatedModuleNode | undefined;
278
278
  /**
279
- * Ensure that module is in the graph. If the module is already in the graph,
280
- * it will return the existing module node. Otherwise, it will create a new
281
- * module node and add it to the graph.
282
- * @param id Resolved module ID
283
- * @param url URL that was used in the import statement
284
- */
279
+ * Ensure that module is in the graph. If the module is already in the graph,
280
+ * it will return the existing module node. Otherwise, it will create a new
281
+ * module node and add it to the graph.
282
+ * @param id Resolved module ID
283
+ * @param url URL that was used in the import statement
284
+ */
285
285
  ensureModule(id: string, url: string): EvaluatedModuleNode;
286
286
  invalidateModule(node: EvaluatedModuleNode): void;
287
287
  /**
288
- * Extracts the inlined source map from the module code and returns the decoded
289
- * source map. If the source map is not inlined, it will return null.
290
- * @param id Resolved module ID
291
- */
288
+ * Extracts the inlined source map from the module code and returns the decoded
289
+ * source map. If the source map is not inlined, it will return null.
290
+ * @param id Resolved module ID
291
+ */
292
292
  getModuleSourceMapById(id: string): DecodedMap | null;
293
293
  clear(): void;
294
294
  }
@@ -306,6 +306,6 @@ declare function createDefaultImportMeta(modulePath: string): ModuleRunnerImport
306
306
  /**
307
307
  * Create import.meta object for Node.js.
308
308
  */
309
- declare function createNodeImportMeta(modulePath: string): Promise<ModuleRunnerImportMeta>;
309
+ declare function createNodeImportMeta(modulePath: string): ModuleRunnerImportMeta;
310
310
  //#endregion
311
311
  export { ESModulesEvaluator, type EvaluatedModuleNode, EvaluatedModules, type FetchFunction, type FetchFunctionOptions, type FetchResult, type HMRLogger, type InterceptorOptions, type ModuleEvaluator, ModuleRunner, type ModuleRunnerContext, type ModuleRunnerHmr, type ModuleRunnerImportMeta, type ModuleRunnerOptions, type ModuleRunnerTransport, type ModuleRunnerTransportHandlers, type ResolvedResult, type SSRImportMetadata, createDefaultImportMeta, createNodeImportMeta, createWebSocketModuleRunnerTransport, normalizeModuleId, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
@@ -25,12 +25,12 @@ function getAsyncFunctionDeclarationPaddingLineCount() {
25
25
  return asyncFunctionDeclarationPaddingLineCount;
26
26
  }
27
27
  function promiseWithResolvers() {
28
- let resolve$1, reject;
28
+ let resolve, reject;
29
29
  return {
30
30
  promise: new Promise((_resolve, _reject) => {
31
- resolve$1 = _resolve, reject = _reject;
31
+ resolve = _resolve, reject = _reject;
32
32
  }),
33
- resolve: resolve$1,
33
+ resolve,
34
34
  reject
35
35
  };
36
36
  }
@@ -239,7 +239,7 @@ function getOriginalPosition(map, needle) {
239
239
  let result = originalPositionFor(map, needle);
240
240
  return result.column == null ? null : result;
241
241
  }
242
- const MODULE_RUNNER_SOURCEMAPPING_REGEXP = /* @__PURE__ */ RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`);
242
+ const MODULE_RUNNER_SOURCEMAPPING_REGEXP = RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`);
243
243
  var EvaluatedModuleNode = class {
244
244
  importers = /* @__PURE__ */ new Set();
245
245
  imports = /* @__PURE__ */ new Set();
@@ -267,8 +267,8 @@ var EvaluatedModuleNode = class {
267
267
  }
268
268
  ensureModule(id, url) {
269
269
  if (id = normalizeModuleId(id), this.idToModuleMap.has(id)) {
270
- let moduleNode$1 = this.idToModuleMap.get(id);
271
- return this.urlToIdModuleMap.set(url, moduleNode$1), moduleNode$1;
270
+ let moduleNode = this.idToModuleMap.get(id);
271
+ return this.urlToIdModuleMap.set(url, moduleNode), moduleNode;
272
272
  }
273
273
  let moduleNode = new EvaluatedModuleNode(id, url);
274
274
  this.idToModuleMap.set(id, moduleNode), this.urlToIdModuleMap.set(url, moduleNode);
@@ -532,11 +532,11 @@ const createInvokeableTransport = (transport) => {
532
532
  id: `send:${promiseId}`,
533
533
  data
534
534
  }
535
- }, sendPromise = transport.send(wrappedData), { promise, resolve: resolve$1, reject } = promiseWithResolvers(), timeout = transport.timeout ?? 6e4, timeoutId;
535
+ }, sendPromise = transport.send(wrappedData), { promise, resolve, reject } = promiseWithResolvers(), timeout = transport.timeout ?? 6e4, timeoutId;
536
536
  timeout > 0 && (timeoutId = setTimeout(() => {
537
537
  rpcPromises.delete(promiseId), reject(/* @__PURE__ */ Error(`transport invoke timed out after ${timeout}ms (data: ${JSON.stringify(wrappedData)})`));
538
538
  }, timeout), timeoutId?.unref?.()), rpcPromises.set(promiseId, {
539
- resolve: resolve$1,
539
+ resolve,
540
540
  reject,
541
541
  name,
542
542
  timeoutId
@@ -593,9 +593,9 @@ const createInvokeableTransport = (transport) => {
593
593
  onMessage(JSON.parse(data));
594
594
  });
595
595
  let isOpened = socket.readyState === socket.OPEN;
596
- isOpened || await new Promise((resolve$1, reject) => {
596
+ isOpened || await new Promise((resolve, reject) => {
597
597
  socket.addEventListener("open", () => {
598
- isOpened = !0, resolve$1();
598
+ isOpened = !0, resolve();
599
599
  }, { once: !0 }), socket.addEventListener("close", async () => {
600
600
  if (!isOpened) {
601
601
  reject(/* @__PURE__ */ Error("WebSocket closed without opened."));
@@ -642,10 +642,10 @@ var Queue = class {
642
642
  queue = [];
643
643
  pending = !1;
644
644
  enqueue(promise) {
645
- return new Promise((resolve$1, reject) => {
645
+ return new Promise((resolve, reject) => {
646
646
  this.queue.push({
647
647
  promise,
648
- resolve: resolve$1,
648
+ resolve,
649
649
  reject
650
650
  }), this.dequeue();
651
651
  });
@@ -936,10 +936,10 @@ function customizationHookResolve(specifier, context, nextResolve) {
936
936
  }
937
937
  return nextResolve(specifier, context);
938
938
  }
939
- async function createImportMetaResolver() {
939
+ function createImportMetaResolver() {
940
940
  let module;
941
941
  try {
942
- module = (await import("node:module")).Module;
942
+ module = typeof process < "u" ? process.getBuiltinModule("node:module").Module : void 0;
943
943
  } catch {
944
944
  return;
945
945
  }
@@ -965,10 +965,10 @@ const envProxy = new Proxy({}, { get(_, p) {
965
965
  throw Error(`[module runner] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p)}" instead.`);
966
966
  } });
967
967
  function createDefaultImportMeta(modulePath) {
968
- let href = posixPathToFileHref(modulePath), filename = modulePath, dirname$1 = posixDirname(modulePath);
968
+ let href = posixPathToFileHref(modulePath), filename = modulePath, dirname = posixDirname(modulePath);
969
969
  return {
970
970
  filename: isWindows ? toWindowsPath(filename) : filename,
971
- dirname: isWindows ? toWindowsPath(dirname$1) : dirname$1,
971
+ dirname: isWindows ? toWindowsPath(dirname) : dirname,
972
972
  url: href,
973
973
  env: envProxy,
974
974
  resolve(_id, _parent) {
@@ -979,11 +979,8 @@ function createDefaultImportMeta(modulePath) {
979
979
  }
980
980
  };
981
981
  }
982
- let importMetaResolverCache;
983
- async function createNodeImportMeta(modulePath) {
984
- let defaultMeta = createDefaultImportMeta(modulePath), href = defaultMeta.url;
985
- importMetaResolverCache ??= createImportMetaResolver();
986
- let importMetaResolver = await importMetaResolverCache;
982
+ function createNodeImportMeta(modulePath) {
983
+ let defaultMeta = createDefaultImportMeta(modulePath), href = defaultMeta.url, importMetaResolver = createImportMetaResolver();
987
984
  return {
988
985
  ...defaultMeta,
989
986
  main: !1,
@@ -1106,8 +1103,8 @@ var ModuleRunner = class {
1106
1103
  if ("externalize" in fetchResult) {
1107
1104
  let { externalize } = fetchResult;
1108
1105
  this.debug?.("[module runner] externalizing", externalize);
1109
- let exports$1 = await this.evaluator.runExternalModule(externalize);
1110
- return mod.exports = exports$1, exports$1;
1106
+ let exports = await this.evaluator.runExternalModule(externalize);
1107
+ return mod.exports = exports, exports;
1111
1108
  }
1112
1109
  let { code, file } = fetchResult;
1113
1110
  if (code == null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "8.0.0-beta.7",
3
+ "version": "8.0.0-beta.9",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -60,24 +60,24 @@
60
60
  "funding": "https://github.com/vitejs/vite?sponsor=1",
61
61
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
62
62
  "dependencies": {
63
- "@oxc-project/runtime": "0.107.0",
63
+ "@oxc-project/runtime": "0.110.0",
64
64
  "fdir": "^6.5.0",
65
65
  "lightningcss": "^1.30.2",
66
66
  "picomatch": "^4.0.3",
67
67
  "postcss": "^8.5.6",
68
- "rolldown": "1.0.0-beta.59",
68
+ "rolldown": "1.0.0-rc.1",
69
69
  "tinyglobby": "^0.2.15"
70
70
  },
71
71
  "optionalDependencies": {
72
72
  "fsevents": "~2.3.3"
73
73
  },
74
74
  "devDependencies": {
75
- "@babel/parser": "^7.28.5",
75
+ "@babel/parser": "^7.28.6",
76
76
  "@jridgewell/remapping": "^2.3.5",
77
77
  "@jridgewell/trace-mapping": "^0.3.31",
78
- "@oxc-project/types": "0.107.0",
78
+ "@oxc-project/types": "0.110.0",
79
79
  "@polka/compression": "^1.0.0-next.25",
80
- "@rolldown/pluginutils": "1.0.0-beta.59",
80
+ "@rolldown/pluginutils": "1.0.0-rc.1",
81
81
  "@rollup/plugin-alias": "^5.1.1",
82
82
  "@rollup/plugin-commonjs": "^29.0.0",
83
83
  "@rollup/plugin-dynamic-import-vars": "2.1.4",
@@ -85,7 +85,7 @@
85
85
  "@types/escape-html": "^1.0.4",
86
86
  "@types/pnpapi": "^0.0.5",
87
87
  "artichokie": "^0.4.2",
88
- "baseline-browser-mapping": "^2.9.11",
88
+ "baseline-browser-mapping": "^2.9.15",
89
89
  "cac": "^6.7.14",
90
90
  "chokidar": "^3.6.0",
91
91
  "connect": "^3.7.0",
@@ -96,7 +96,7 @@
96
96
  "dotenv": "^17.2.3",
97
97
  "dotenv-expand": "^12.0.3",
98
98
  "es-module-lexer": "^1.7.0",
99
- "esbuild": "^0.25.0",
99
+ "esbuild": "^0.27.2",
100
100
  "escape-html": "^1.0.3",
101
101
  "estree-walker": "^3.0.3",
102
102
  "etag": "^1.8.1",
@@ -117,21 +117,21 @@
117
117
  "postcss-modules": "^6.0.1",
118
118
  "premove": "^4.0.0",
119
119
  "resolve.exports": "^2.0.3",
120
- "rolldown-plugin-dts": "^0.20.0",
120
+ "rolldown-plugin-dts": "^0.21.2",
121
121
  "rollup": "^4.43.0",
122
122
  "rollup-plugin-license": "^3.6.0",
123
123
  "sass": "^1.97.2",
124
124
  "sass-embedded": "^1.97.2",
125
125
  "sirv": "^3.0.2",
126
126
  "strip-literal": "^3.1.0",
127
- "terser": "^5.44.1",
127
+ "terser": "^5.46.0",
128
128
  "tsconfck": "^3.1.6",
129
- "ufo": "^1.6.2",
129
+ "ufo": "^1.6.3",
130
130
  "ws": "^8.19.0"
131
131
  },
132
132
  "peerDependencies": {
133
133
  "@types/node": "^20.19.0 || >=22.12.0",
134
- "esbuild": "^0.25.0",
134
+ "esbuild": "^0.27.0",
135
135
  "jiti": ">=1.21.0",
136
136
  "less": "^4.0.0",
137
137
  "sass": "^1.70.0",