vite 8.0.11 → 8.0.12

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.
@@ -8,7 +8,7 @@ let nanoid = (size = 21) => {
8
8
  return id;
9
9
  };
10
10
  //#endregion
11
- //#region \0@oxc-project+runtime@0.128.0/helpers/typeof.js
11
+ //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
12
12
  function _typeof(o) {
13
13
  "@babel/helpers - typeof";
14
14
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -18,7 +18,7 @@ function _typeof(o) {
18
18
  }, _typeof(o);
19
19
  }
20
20
  //#endregion
21
- //#region \0@oxc-project+runtime@0.128.0/helpers/toPrimitive.js
21
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
22
22
  function toPrimitive(t, r) {
23
23
  if ("object" != _typeof(t) || !t) return t;
24
24
  var e = t[Symbol.toPrimitive];
@@ -30,13 +30,13 @@ function toPrimitive(t, r) {
30
30
  return ("string" === r ? String : Number)(t);
31
31
  }
32
32
  //#endregion
33
- //#region \0@oxc-project+runtime@0.128.0/helpers/toPropertyKey.js
33
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
34
34
  function toPropertyKey(t) {
35
35
  var i = toPrimitive(t, "string");
36
36
  return "symbol" == _typeof(i) ? i : i + "";
37
37
  }
38
38
  //#endregion
39
- //#region \0@oxc-project+runtime@0.128.0/helpers/defineProperty.js
39
+ //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
40
40
  function _defineProperty(e, r, t) {
41
41
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
42
42
  value: t,
@@ -10826,6 +10826,7 @@ async function instantiateModule(url, runner, environment, fixStacktrace) {
10826
10826
  }
10827
10827
  }
10828
10828
  var SSRCompatModuleRunner = class extends ModuleRunner {
10829
+ environment;
10829
10830
  constructor(environment) {
10830
10831
  super({
10831
10832
  transport: createServerModuleRunnerTransport({ channel: environment.hot }),
@@ -12457,6 +12458,7 @@ function convertToWatcherOptions(options) {
12457
12458
  };
12458
12459
  }
12459
12460
  var NoopWatcher = class extends EventEmitter {
12461
+ options;
12460
12462
  constructor(options) {
12461
12463
  super();
12462
12464
  this.options = options;
@@ -27160,6 +27162,7 @@ async function bundleWorkerEntry(config, id) {
27160
27162
  const workerEnvironment = new BuildEnvironment("client", await plugins(newBundleChain));
27161
27163
  await workerEnvironment.init();
27162
27164
  const chunkMetadataMap = new ChunkMetadataMap();
27165
+ const workerBuildTarget = workerEnvironment.config.build.target;
27163
27166
  const bundle = await rolldown({
27164
27167
  ...rollupOptions,
27165
27168
  input,
@@ -27167,6 +27170,14 @@ async function bundleWorkerEntry(config, id) {
27167
27170
  onLog(level, log) {
27168
27171
  onRollupLog(level, log, workerEnvironment);
27169
27172
  },
27173
+ transform: {
27174
+ target: workerBuildTarget === false ? void 0 : workerBuildTarget,
27175
+ ...rollupOptions.transform,
27176
+ define: {
27177
+ ...rollupOptions.transform?.define,
27178
+ "process.env.NODE_ENV": "process.env.NODE_ENV"
27179
+ }
27180
+ },
27170
27181
  moduleTypes: {
27171
27182
  ".css": "js",
27172
27183
  ...rollupOptions.moduleTypes
@@ -29948,6 +29959,9 @@ async function createEnvironmentPluginContainer(environment, plugins, watcher, a
29948
29959
  return container;
29949
29960
  }
29950
29961
  var EnvironmentPluginContainer = class {
29962
+ environment;
29963
+ plugins;
29964
+ watcher;
29951
29965
  _pluginContextMap = /* @__PURE__ */ new Map();
29952
29966
  _resolvedRollupOptions;
29953
29967
  _processesing = /* @__PURE__ */ new Set();
@@ -30219,6 +30233,8 @@ const basePluginContextMeta = {
30219
30233
  rolldownVersion
30220
30234
  };
30221
30235
  var BasicMinimalPluginContext = class {
30236
+ meta;
30237
+ _logger;
30222
30238
  constructor(meta, _logger) {
30223
30239
  this.meta = meta;
30224
30240
  this._logger = _logger;
@@ -30278,6 +30294,8 @@ const fsModule = {
30278
30294
  writeFile: fsp.writeFile
30279
30295
  };
30280
30296
  var PluginContext = class extends MinimalPluginContext {
30297
+ _plugin;
30298
+ _container;
30281
30299
  ssr = false;
30282
30300
  _scan = false;
30283
30301
  _activeId = null;
@@ -30547,6 +30565,7 @@ var TransformPluginContext = class extends LoadPluginContext {
30547
30565
  }
30548
30566
  };
30549
30567
  var PluginContainer = class {
30568
+ environments;
30550
30569
  constructor(environments) {
30551
30570
  this.environments = environments;
30552
30571
  }
@@ -30661,7 +30680,7 @@ function scanImports(environment) {
30661
30680
  async function scan() {
30662
30681
  const entries = await computeEntries(environment);
30663
30682
  if (!entries.length) {
30664
- if (!config.optimizeDeps.entries && !config.optimizeDeps.include) environment.logger.warn(import_picocolors.default.yellow("(!) Could not auto-determine entry point from rollupOptions or html files and there are no explicit optimizeDeps.include patterns. Skipping dependency pre-bundling."));
30683
+ if (!config.optimizeDeps.entries && !config.optimizeDeps.include) environment.logger.warn(import_picocolors.default.yellow("(!) Could not auto-determine entry point from rolldownOptions or html files and there are no explicit optimizeDeps.include patterns. Skipping dependency pre-bundling."));
30665
30684
  return;
30666
30685
  }
30667
30686
  if (scanContext.cancelled) return;
@@ -30706,13 +30725,13 @@ async function computeEntries(environment) {
30706
30725
  isEntry: true,
30707
30726
  scan: true
30708
30727
  }))?.id;
30709
- if (id === void 0) throw new Error(`failed to resolve rollupOptions.input value: ${JSON.stringify(p)}.`);
30728
+ if (id === void 0) throw new Error(`failed to resolve rolldownOptions.input value: ${JSON.stringify(p)}.`);
30710
30729
  return id;
30711
30730
  };
30712
30731
  if (typeof buildInput === "string") entries = [await resolvePath(buildInput)];
30713
30732
  else if (Array.isArray(buildInput)) entries = await Promise.all(buildInput.map(resolvePath));
30714
30733
  else if (isObject$1(buildInput)) entries = await Promise.all(Object.values(buildInput).map(resolvePath));
30715
- else throw new Error("invalid rollupOptions.input value.");
30734
+ else throw new Error("invalid rolldownOptions.input value.");
30716
30735
  } else entries = await globEntries("**/*.html", environment);
30717
30736
  entries = entries.filter((entry) => isScannable(entry, environment.config.optimizeDeps.extensions) && fs.existsSync(entry));
30718
30737
  return entries;
@@ -32945,9 +32964,9 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
32945
32964
  const isSsrTargetWebworkerEnvironment = environment.name === "ssr" && environment.getTopLevelConfig().ssr?.target === "webworker";
32946
32965
  if (isSsrTargetWebworkerEnvironment) plugins.push(esmExternalRequirePlugin());
32947
32966
  const buildOutputOptions = (output = {}) => {
32948
- if (output.output) logger.warn("You've set \"rollupOptions.output.output\" in your config. This is deprecated and will override all Vite.js default output options. Please use \"rollupOptions.output\" instead.");
32949
- if (output.file) throw new Error("Vite does not support \"rollupOptions.output.file\". Please use \"rollupOptions.output.dir\" and \"rollupOptions.output.entryFileNames\" instead.");
32950
- if (output.sourcemap) logger.warnOnce(import_picocolors.default.yellow("Vite does not support \"rollupOptions.output.sourcemap\". Please use \"build.sourcemap\" instead."));
32967
+ if (output.output) logger.warn("You've set \"rolldownOptions.output.output\" in your config. This is deprecated and will override all Vite.js default output options. Please use \"rolldownOptions.output\" instead.");
32968
+ if (output.file) throw new Error("Vite does not support \"rolldownOptions.output.file\". Please use \"rolldownOptions.output.dir\" and \"rolldownOptions.output.entryFileNames\" instead.");
32969
+ if (output.sourcemap) logger.warnOnce(import_picocolors.default.yellow("Vite does not support \"rolldownOptions.output.sourcemap\". Please use \"build.sourcemap\" instead."));
32951
32970
  const format = output.format || "es";
32952
32971
  const jsExt = ssr && !isSsrTargetWebworkerEnvironment || libOptions ? resolveOutputJsExtension(format, findNearestPackageData(root, packageCache)?.data.type) : "js";
32953
32972
  return {
@@ -33101,9 +33120,9 @@ function resolveBuildOutputs(outputs, libOptions, logger) {
33101
33120
  format
33102
33121
  }));
33103
33122
  }
33104
- if (libOptions.formats) logger.warn(import_picocolors.default.yellow("\"build.lib.formats\" will be ignored because \"build.rollupOptions.output\" is already an array format."));
33123
+ if (libOptions.formats) logger.warn(import_picocolors.default.yellow("\"build.lib.formats\" will be ignored because \"build.rolldownOptions.output\" is already an array format."));
33105
33124
  outputs.forEach((output) => {
33106
- if ((output.format === "umd" || output.format === "iife") && !output.name) throw new Error("Entries in \"build.rollupOptions.output\" must specify \"name\" when the format is \"umd\" or \"iife\".");
33125
+ if ((output.format === "umd" || output.format === "iife") && !output.name) throw new Error("Entries in \"build.rolldownOptions.output\" must specify \"name\" when the format is \"umd\" or \"iife\".");
33107
33126
  });
33108
33127
  }
33109
33128
  return outputs;
@@ -33123,7 +33142,7 @@ function onRollupLog(level, log, environment) {
33123
33142
  if (logging.code === "UNRESOLVED_IMPORT") {
33124
33143
  const id = logging.id;
33125
33144
  const exporter = logging.exporter;
33126
- if (!id || !id.endsWith("?commonjs-external")) throw new Error(`[vite]: Rolldown failed to resolve import "${exporter}" from "${id}".\nThis is most likely unintended because it can break your application at runtime.\nIf you do want to externalize this module explicitly add it to\n\`build.rollupOptions.external\``);
33145
+ if (!id || !id.endsWith("?commonjs-external")) throw new Error(`[vite]: Rolldown failed to resolve import "${exporter}" from "${id}".\nThis is most likely unintended because it can break your application at runtime.\nIf you do want to externalize this module explicitly add it to\n\`build.rolldownOptions.external\``);
33127
33146
  }
33128
33147
  if (logLeveling === "warn") {
33129
33148
  if (logging.plugin === "rollup-plugin-dynamic-import-variables" && dynamicImportWarningIgnoreList.some((msg) => logging.message.includes(msg))) return;
@@ -34539,7 +34558,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
34539
34558
  if (assetFileNamesList.length > 1) {
34540
34559
  const firstAssetFileNames = assetFileNamesList[0];
34541
34560
  if (assetFileNamesList.some((assetFileNames) => assetFileNames !== firstAssetFileNames)) resolved.logger.warn(import_picocolors.default.yellow(`
34542
- assetFileNames isn't equal for every build.rollupOptions.output. A single pattern across all outputs is supported by Vite.
34561
+ assetFileNames isn't equal for every build.rolldownOptions.output. A single pattern across all outputs is supported by Vite.
34543
34562
  `));
34544
34563
  }
34545
34564
  }
@@ -31,7 +31,7 @@ import { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownA
31
31
 
32
32
  //#region \0rolldown/runtime.js
33
33
  //#endregion
34
- //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.19_typescript@6.0.2_vite@packages+vite/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
34
+ //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.21_typescript@6.0.2_vite@packages+vite/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
35
35
  //#region src/node/cli-commands.d.ts
36
36
  interface StartOptions {
37
37
  root?: string;
@@ -41,7 +41,7 @@ interface StartOptions {
41
41
  open?: boolean;
42
42
  }
43
43
  //#endregion
44
- //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.19_typescript@6.0.2_vite@packages+vite/node_modules/@vitejs/devtools/dist/config.d.ts
44
+ //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.21_typescript@6.0.2_vite@packages+vite/node_modules/@vitejs/devtools/dist/config.d.ts
45
45
  //#region src/node/config.d.ts
46
46
  interface DevToolsConfig extends Partial<StartOptions> {
47
47
  enabled: boolean;
@@ -925,7 +925,7 @@ interface DepOptimizationConfig {
925
925
  type DepOptimizationOptions = DepOptimizationConfig & {
926
926
  /**
927
927
  * By default, Vite will crawl your `index.html` to detect dependencies that
928
- * need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
928
+ * need to be pre-bundled. If `build.rolldownOptions.input` is specified, Vite
929
929
  * will crawl those entry points instead.
930
930
  *
931
931
  * If neither of these fit your needs, you can specify custom entries using
@@ -131,8 +131,7 @@ declare class ModuleRunner {
131
131
  */
132
132
  isClosed(): boolean;
133
133
  private processImport;
134
- private isCircularModule;
135
- private isCircularImport;
134
+ private isCircularRequest;
136
135
  private cachedRequest;
137
136
  private cachedModule;
138
137
  private ensureBuiltins;
@@ -225,6 +225,7 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
225
225
  //#endregion
226
226
  //#region src/module-runner/sourcemap/decoder.ts
227
227
  var DecodedMap = class {
228
+ map;
228
229
  _encoded;
229
230
  _decoded;
230
231
  _decodedMemo;
@@ -256,6 +257,8 @@ function getOriginalPosition(map, needle) {
256
257
  //#region src/module-runner/evaluatedModules.ts
257
258
  const MODULE_RUNNER_SOURCEMAPPING_REGEXP = RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`);
258
259
  var EvaluatedModuleNode = class {
260
+ id;
261
+ url;
259
262
  importers = /* @__PURE__ */ new Set();
260
263
  imports = /* @__PURE__ */ new Set();
261
264
  evaluated = !1;
@@ -349,6 +352,8 @@ function normalizeModuleId(file) {
349
352
  //#endregion
350
353
  //#region src/shared/hmr.ts
351
354
  var HMRContext = class {
355
+ hmrClient;
356
+ ownerPath;
352
357
  newListeners;
353
358
  constructor(hmrClient, ownerPath) {
354
359
  this.hmrClient = hmrClient, this.ownerPath = ownerPath, hmrClient.dataMap.has(ownerPath) || hmrClient.dataMap.set(ownerPath, {});
@@ -430,6 +435,9 @@ var HMRContext = class {
430
435
  }), this.hmrClient.hotModulesMap.set(this.ownerPath, mod);
431
436
  }
432
437
  }, HMRClient = class {
438
+ logger;
439
+ transport;
440
+ importUpdatedModule;
433
441
  hotModulesMap = /* @__PURE__ */ new Map();
434
442
  disposeMap = /* @__PURE__ */ new Map();
435
443
  pruneMap = /* @__PURE__ */ new Map();
@@ -1080,6 +1088,9 @@ function createNodeImportMeta(modulePath) {
1080
1088
  //#endregion
1081
1089
  //#region src/module-runner/runner.ts
1082
1090
  var ModuleRunner = class {
1091
+ options;
1092
+ evaluator;
1093
+ debug;
1083
1094
  evaluatedModules;
1084
1095
  hmrClient;
1085
1096
  transport;
@@ -1127,29 +1138,25 @@ var ModuleRunner = class {
1127
1138
  let { url, type } = fetchResult;
1128
1139
  return type !== "module" && type !== "commonjs" || analyzeImportedModDifference(exports, url, type, metadata), exports;
1129
1140
  }
1130
- isCircularModule(mod) {
1131
- for (let importedFile of mod.imports) if (mod.importers.has(importedFile)) return !0;
1132
- return !1;
1133
- }
1134
- isCircularImport(importers, moduleUrl, visited = /* @__PURE__ */ new Set()) {
1135
- for (let importer of importers) {
1136
- if (visited.has(importer)) continue;
1137
- if (visited.add(importer), importer === moduleUrl) return !0;
1138
- let mod = this.evaluatedModules.getModuleById(importer);
1139
- if (mod && mod.importers.size && this.isCircularImport(mod.importers, moduleUrl, visited)) return !0;
1141
+ isCircularRequest(mod, callstack, visited = /* @__PURE__ */ new Set()) {
1142
+ if (visited.has(mod.id)) return !1;
1143
+ visited.add(mod.id);
1144
+ for (let importedModuleId of mod.imports) {
1145
+ if (callstack.includes(importedModuleId)) return !0;
1146
+ let importedModule = this.evaluatedModules.getModuleById(importedModuleId);
1147
+ if (importedModule?.promise && !importedModule.evaluated && this.isCircularRequest(importedModule, callstack, visited)) return !0;
1140
1148
  }
1141
1149
  return !1;
1142
1150
  }
1143
1151
  async cachedRequest(url, mod, callstack = [], metadata) {
1144
- let meta = mod.meta, moduleId = meta.id, { importers } = mod, importee = callstack[callstack.length - 1];
1145
- if (importee && importers.add(importee), mod.evaluated && mod.promise) return this.processImport(await mod.promise, meta, metadata);
1146
- if ((callstack.includes(moduleId) || this.isCircularModule(mod) || this.isCircularImport(importers, moduleId)) && mod.exports) return this.processImport(mod.exports, meta, metadata);
1152
+ let meta = mod.meta, moduleId = meta.id, importee = callstack[callstack.length - 1];
1153
+ if (importee && mod.importers.add(importee), mod.evaluated && mod.promise) return this.processImport(await mod.promise, meta, metadata);
1154
+ if (mod.promise) return mod.exports && (callstack.includes(moduleId) || this.isCircularRequest(mod, callstack)) ? this.processImport(mod.exports, meta, metadata) : this.processImport(await mod.promise, meta, metadata);
1147
1155
  let debugTimer;
1148
1156
  this.debug && (debugTimer = setTimeout(() => {
1149
1157
  this.debug(`[module runner] module ${moduleId} takes over 2s to load.\n${`stack:\n${[...callstack, moduleId].reverse().map((p) => ` - ${p}`).join("\n")}`}`);
1150
1158
  }, 2e3));
1151
1159
  try {
1152
- if (mod.promise) return this.processImport(await mod.promise, meta, metadata);
1153
1160
  let promise = this.directRequest(url, mod, callstack);
1154
1161
  return mod.promise = promise, mod.evaluated = !1, this.processImport(await promise, meta, metadata);
1155
1162
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "8.0.11",
3
+ "version": "8.0.12",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -63,7 +63,7 @@
63
63
  "lightningcss": "^1.32.0",
64
64
  "picomatch": "^4.0.4",
65
65
  "postcss": "^8.5.14",
66
- "rolldown": "1.0.0-rc.18",
66
+ "rolldown": "1.0.0",
67
67
  "tinyglobby": "^0.2.16"
68
68
  },
69
69
  "optionalDependencies": {
@@ -81,9 +81,9 @@
81
81
  "@types/escape-html": "^1.0.4",
82
82
  "@types/pnpapi": "^0.0.5",
83
83
  "@vitest/utils": "4.1.5",
84
- "@vitejs/devtools": "^0.1.19",
84
+ "@vitejs/devtools": "^0.1.21",
85
85
  "artichokie": "^0.4.3",
86
- "baseline-browser-mapping": "^2.10.27",
86
+ "baseline-browser-mapping": "^2.10.29",
87
87
  "cac": "^7.0.0",
88
88
  "chokidar": "^3.6.0",
89
89
  "connect": "^3.7.0",
@@ -114,14 +114,14 @@
114
114
  "postcss-modules": "^6.0.1",
115
115
  "premove": "^4.0.0",
116
116
  "resolve.exports": "^2.0.3",
117
- "rolldown-plugin-dts": "^0.24.1",
117
+ "rolldown-plugin-dts": "^0.25.0",
118
118
  "rollup": "^4.59.0",
119
119
  "rollup-plugin-license": "^3.7.1",
120
120
  "sass": "^1.99.0",
121
121
  "sass-embedded": "^1.99.0",
122
122
  "sirv": "^3.0.2",
123
123
  "strip-literal": "^3.1.0",
124
- "terser": "^5.46.2",
124
+ "terser": "^5.47.1",
125
125
  "ufo": "^1.6.4",
126
126
  "ws": "^8.20.0"
127
127
  },