vite 8.3.0-beta.0 → 8.3.0

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.
@@ -632,14 +632,14 @@ var BundledDevHMRClient = class extends HMRClient {
632
632
  if (importerIndex > -1) {
633
633
  const importChain = [
634
634
  importer,
635
- ...[...currentChain].reverse(),
635
+ ...currentChain.toReversed(),
636
636
  ...nodeChain.slice(importerIndex, -1).reverse()
637
637
  ];
638
638
  this.logger.debug(`circular imports detected: ${importChain.join(" -> ")}`);
639
639
  return true;
640
640
  }
641
641
  if (!currentChain.includes(importer)) {
642
- const result = this.isNodeWithinCircularImports(importer, nodeChain, currentChain.concat(importer), traversedModules);
642
+ const result = this.isNodeWithinCircularImports(importer, nodeChain, [...currentChain, importer], traversedModules);
643
643
  if (result) return result;
644
644
  }
645
645
  }
@@ -1824,6 +1824,13 @@ function injectQuery(url, queryToInject) {
1824
1824
  if (typeof DevRuntime !== "undefined") {
1825
1825
  var _ref;
1826
1826
  class ViteDevRuntime extends DevRuntime {
1827
+ payloadDelivered(filename) {
1828
+ transport.send({
1829
+ type: "custom",
1830
+ event: "vite:bundled-dev:payload-delivered",
1831
+ data: { filename }
1832
+ });
1833
+ }
1827
1834
  createModuleHotContext(moduleId) {
1828
1835
  const ctx = new BundledDevHMRContext(bundledDevHmrClient, moduleId);
1829
1836
  ctx._internal = {
@@ -1,6 +1,6 @@
1
1
  import { ft as __commonJSMin, pt as __require } from "./node.js";
2
2
  import { t as require_lib } from "./lib.js";
3
- //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.26/node_modules/postcss-modules/build/fs.js
3
+ //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.28/node_modules/postcss-modules/build/fs.js
4
4
  var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  function _export(target, all) {
@@ -34,7 +34,7 @@ var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
34
34
  }
35
35
  }));
36
36
  //#endregion
37
- //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.26/node_modules/postcss-modules/build/unquote.js
37
+ //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.28/node_modules/postcss-modules/build/unquote.js
38
38
  var require_unquote = /* @__PURE__ */ __commonJSMin(((exports) => {
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
40
  Object.defineProperty(exports, "default", {
@@ -52,7 +52,7 @@ var require_unquote = /* @__PURE__ */ __commonJSMin(((exports) => {
52
52
  }
53
53
  }));
54
54
  //#endregion
55
- //#region ../../node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.26/node_modules/icss-utils/src/replaceValueSymbols.js
55
+ //#region ../../node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.28/node_modules/icss-utils/src/replaceValueSymbols.js
56
56
  var require_replaceValueSymbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
57
57
  const matchValueName = /[$]?[\w-]+/g;
58
58
  const replaceValueSymbols = (value, replacements) => {
@@ -69,7 +69,7 @@ var require_replaceValueSymbols = /* @__PURE__ */ __commonJSMin(((exports, modul
69
69
  module.exports = replaceValueSymbols;
70
70
  }));
71
71
  //#endregion
72
- //#region ../../node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.26/node_modules/icss-utils/src/replaceSymbols.js
72
+ //#region ../../node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.28/node_modules/icss-utils/src/replaceSymbols.js
73
73
  var require_replaceSymbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
74
74
  const replaceValueSymbols = require_replaceValueSymbols();
75
75
  const replaceSymbols = (css, replacements) => {
@@ -82,7 +82,7 @@ var require_replaceSymbols = /* @__PURE__ */ __commonJSMin(((exports, module) =>
82
82
  module.exports = replaceSymbols;
83
83
  }));
84
84
  //#endregion
85
- //#region ../../node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.26/node_modules/icss-utils/src/extractICSS.js
85
+ //#region ../../node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.28/node_modules/icss-utils/src/extractICSS.js
86
86
  var require_extractICSS = /* @__PURE__ */ __commonJSMin(((exports, module) => {
87
87
  const importPattern = /^:import\(("[^"]*"|'[^']*'|[^"']+)\)$/;
88
88
  const balancedQuotes = /^("[^"]*"|'[^']*'|[^"']+)$/;
@@ -136,7 +136,7 @@ var require_extractICSS = /* @__PURE__ */ __commonJSMin(((exports, module) => {
136
136
  module.exports = extractICSS;
137
137
  }));
138
138
  //#endregion
139
- //#region ../../node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.26/node_modules/icss-utils/src/createICSSRules.js
139
+ //#region ../../node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.28/node_modules/icss-utils/src/createICSSRules.js
140
140
  var require_createICSSRules = /* @__PURE__ */ __commonJSMin(((exports, module) => {
141
141
  const createImports = (imports, postcss, mode = "rule") => {
142
142
  return Object.keys(imports).map((path) => {
@@ -180,7 +180,7 @@ var require_createICSSRules = /* @__PURE__ */ __commonJSMin(((exports, module) =
180
180
  module.exports = createICSSRules;
181
181
  }));
182
182
  //#endregion
183
- //#region ../../node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.26/node_modules/icss-utils/src/index.js
183
+ //#region ../../node_modules/.pnpm/icss-utils@5.1.0_postcss@8.5.28/node_modules/icss-utils/src/index.js
184
184
  var require_src$4 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
185
185
  module.exports = {
186
186
  replaceValueSymbols: require_replaceValueSymbols(),
@@ -190,7 +190,7 @@ var require_src$4 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
190
190
  };
191
191
  }));
192
192
  //#endregion
193
- //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.26/node_modules/postcss-modules/build/Parser.js
193
+ //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.28/node_modules/postcss-modules/build/Parser.js
194
194
  var require_Parser = /* @__PURE__ */ __commonJSMin(((exports) => {
195
195
  Object.defineProperty(exports, "__esModule", { value: true });
196
196
  Object.defineProperty(exports, "default", {
@@ -262,7 +262,7 @@ var require_Parser = /* @__PURE__ */ __commonJSMin(((exports) => {
262
262
  };
263
263
  }));
264
264
  //#endregion
265
- //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.26/node_modules/postcss-modules/build/saveJSON.js
265
+ //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.28/node_modules/postcss-modules/build/saveJSON.js
266
266
  var require_saveJSON = /* @__PURE__ */ __commonJSMin(((exports) => {
267
267
  Object.defineProperty(exports, "__esModule", { value: true });
268
268
  Object.defineProperty(exports, "default", {
@@ -944,7 +944,7 @@ var require_lodash_camelcase = /* @__PURE__ */ __commonJSMin(((exports, module)
944
944
  module.exports = camelCase;
945
945
  }));
946
946
  //#endregion
947
- //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.26/node_modules/postcss-modules/build/localsConvention.js
947
+ //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.28/node_modules/postcss-modules/build/localsConvention.js
948
948
  var require_localsConvention = /* @__PURE__ */ __commonJSMin(((exports) => {
949
949
  Object.defineProperty(exports, "__esModule", { value: true });
950
950
  Object.defineProperty(exports, "makeLocalsConventionReducer", {
@@ -999,7 +999,7 @@ var require_localsConvention = /* @__PURE__ */ __commonJSMin(((exports) => {
999
999
  }
1000
1000
  }));
1001
1001
  //#endregion
1002
- //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.26/node_modules/postcss-modules/build/FileSystemLoader.js
1002
+ //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.28/node_modules/postcss-modules/build/FileSystemLoader.js
1003
1003
  var require_FileSystemLoader = /* @__PURE__ */ __commonJSMin(((exports) => {
1004
1004
  Object.defineProperty(exports, "__esModule", { value: true });
1005
1005
  Object.defineProperty(exports, "default", {
@@ -1088,7 +1088,7 @@ var require_FileSystemLoader = /* @__PURE__ */ __commonJSMin(((exports) => {
1088
1088
  };
1089
1089
  }));
1090
1090
  //#endregion
1091
- //#region ../../node_modules/.pnpm/postcss-modules-extract-imports@3.1.0_postcss@8.5.26/node_modules/postcss-modules-extract-imports/src/topologicalSort.js
1091
+ //#region ../../node_modules/.pnpm/postcss-modules-extract-imports@3.1.0_postcss@8.5.28/node_modules/postcss-modules-extract-imports/src/topologicalSort.js
1092
1092
  var require_topologicalSort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1093
1093
  const PERMANENT_MARKER = 2;
1094
1094
  const TEMPORARY_MARKER = 1;
@@ -1127,7 +1127,7 @@ var require_topologicalSort = /* @__PURE__ */ __commonJSMin(((exports, module) =
1127
1127
  module.exports = topologicalSort;
1128
1128
  }));
1129
1129
  //#endregion
1130
- //#region ../../node_modules/.pnpm/postcss-modules-extract-imports@3.1.0_postcss@8.5.26/node_modules/postcss-modules-extract-imports/src/index.js
1130
+ //#region ../../node_modules/.pnpm/postcss-modules-extract-imports@3.1.0_postcss@8.5.28/node_modules/postcss-modules-extract-imports/src/index.js
1131
1131
  var require_src$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1132
1132
  const topologicalSort = require_topologicalSort();
1133
1133
  const matchImports = /^(.+?)\s+from\s+(?:"([^"]+)"|'([^']+)'|(global))$/;
@@ -4654,7 +4654,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4654
4654
  module.exports = exports.default;
4655
4655
  }));
4656
4656
  //#endregion
4657
- //#region ../../node_modules/.pnpm/postcss-modules-local-by-default@4.2.0_postcss@8.5.26/node_modules/postcss-modules-local-by-default/src/index.js
4657
+ //#region ../../node_modules/.pnpm/postcss-modules-local-by-default@4.2.0_postcss@8.5.28/node_modules/postcss-modules-local-by-default/src/index.js
4658
4658
  var require_src$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4659
4659
  const selectorParser = require_dist();
4660
4660
  const valueParser = require_lib();
@@ -5050,7 +5050,7 @@ var require_src$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5050
5050
  module.exports.postcss = true;
5051
5051
  }));
5052
5052
  //#endregion
5053
- //#region ../../node_modules/.pnpm/postcss-modules-scope@3.2.1_postcss@8.5.26/node_modules/postcss-modules-scope/src/index.js
5053
+ //#region ../../node_modules/.pnpm/postcss-modules-scope@3.2.1_postcss@8.5.28/node_modules/postcss-modules-scope/src/index.js
5054
5054
  var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5055
5055
  const selectorParser = require_dist();
5056
5056
  const hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -5228,7 +5228,7 @@ var require_string_hash = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5228
5228
  module.exports = hash;
5229
5229
  }));
5230
5230
  //#endregion
5231
- //#region ../../node_modules/.pnpm/postcss-modules-values@4.0.0_postcss@8.5.26/node_modules/postcss-modules-values/src/index.js
5231
+ //#region ../../node_modules/.pnpm/postcss-modules-values@4.0.0_postcss@8.5.28/node_modules/postcss-modules-values/src/index.js
5232
5232
  var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5233
5233
  const ICSSUtils = require_src$4();
5234
5234
  const matchImports = /^(.+?|\([\s\S]+?\))\s+from\s+("[^"]*"|'[^']*'|[\w-]+)$/;
@@ -5315,7 +5315,7 @@ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5315
5315
  module.exports.postcss = true;
5316
5316
  }));
5317
5317
  //#endregion
5318
- //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.26/node_modules/postcss-modules/build/scoping.js
5318
+ //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.28/node_modules/postcss-modules/build/scoping.js
5319
5319
  var require_scoping = /* @__PURE__ */ __commonJSMin(((exports) => {
5320
5320
  Object.defineProperty(exports, "__esModule", { value: true });
5321
5321
  function _export(target, all) {
@@ -5394,7 +5394,7 @@ var require_scoping = /* @__PURE__ */ __commonJSMin(((exports) => {
5394
5394
  }
5395
5395
  }));
5396
5396
  //#endregion
5397
- //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.26/node_modules/postcss-modules/build/pluginFactory.js
5397
+ //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.28/node_modules/postcss-modules/build/pluginFactory.js
5398
5398
  var require_pluginFactory = /* @__PURE__ */ __commonJSMin(((exports) => {
5399
5399
  Object.defineProperty(exports, "__esModule", { value: true });
5400
5400
  Object.defineProperty(exports, "makePlugin", {
@@ -5476,7 +5476,7 @@ var require_pluginFactory = /* @__PURE__ */ __commonJSMin(((exports) => {
5476
5476
  }
5477
5477
  }));
5478
5478
  //#endregion
5479
- //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.26/node_modules/postcss-modules/build/index.js
5479
+ //#region ../../node_modules/.pnpm/postcss-modules@9.0.1_postcss@8.5.28/node_modules/postcss-modules/build/index.js
5480
5480
  var require_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5481
5481
  Object.defineProperty(exports, "__esModule", { value: true });
5482
5482
  const _fs = __require("fs");
@@ -9,7 +9,7 @@ import fsp, { constants } from "node:fs/promises";
9
9
  import path, { basename, dirname, extname, isAbsolute, join, normalize, posix, relative, resolve, sep } from "node:path";
10
10
  import { performance as performance$1 } from "node:perf_hooks";
11
11
  import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
12
- import { format, formatWithOptions, inspect, parseEnv, promisify, stripVTControlCharacters } from "node:util";
12
+ import { format, formatWithOptions, inspect, isDeepStrictEqual, parseEnv, promisify, stripVTControlCharacters } from "node:util";
13
13
  import { MessageChannel, Worker } from "node:worker_threads";
14
14
  import pm from "picomatch";
15
15
  import { VERSION as rolldownVersion, rolldown } from "rolldown";
@@ -525,7 +525,7 @@ function splitFileAndPostfix(path) {
525
525
  };
526
526
  }
527
527
  function withTrailingSlash(path) {
528
- if (path[path.length - 1] !== "/") return `${path}/`;
528
+ if (path.at(-1) !== "/") return `${path}/`;
529
529
  return path;
530
530
  }
531
531
  function promiseWithResolvers() {
@@ -628,7 +628,7 @@ var BaseEnvironment = class extends PartialEnvironment {
628
628
  };
629
629
  //#endregion
630
630
  //#region package.json
631
- var version = "8.3.0-beta.0";
631
+ var version = "8.3.0";
632
632
  //#endregion
633
633
  //#region src/node/constants.ts
634
634
  const ROLLUP_HOOKS = [
@@ -1752,11 +1752,11 @@ function getDate() {
1752
1752
  function init$1(debug) {
1753
1753
  debug.inspectOpts = Object.assign({}, inspectOpts);
1754
1754
  }
1755
- var require$1, colors$38, inspectOpts, humanize$1, createDebug, node_default;
1755
+ var require$1, colors$37, inspectOpts, humanize$1, createDebug, node_default;
1756
1756
  var init_node = __esmMin((() => {
1757
1757
  init_core();
1758
1758
  require$1 = createRequire(import.meta.url);
1759
- colors$38 = process.stderr.getColorDepth && process.stderr.getColorDepth() > 2 ? [
1759
+ colors$37 = process.stderr.getColorDepth && process.stderr.getColorDepth() > 2 ? [
1760
1760
  20,
1761
1761
  21,
1762
1762
  26,
@@ -1858,7 +1858,7 @@ var init_node = __esmMin((() => {
1858
1858
  } catch (_unused) {
1859
1859
  humanize$1 = humanize;
1860
1860
  }
1861
- createDebug = setup(useColors(), colors$38, log, load, save, formatArgs, init$1);
1861
+ createDebug = setup(useColors(), colors$37, log, load, save, formatArgs, init$1);
1862
1862
  createDebug.inspectOpts = inspectOpts;
1863
1863
  createDebug.formatters.o = function(v) {
1864
1864
  this.inspectOpts.colors = this.useColors;
@@ -2057,8 +2057,9 @@ function isNodeBuiltin(id) {
2057
2057
  if (id.startsWith(NODE_BUILTIN_NAMESPACE)) return true;
2058
2058
  return nodeBuiltins.includes(id);
2059
2059
  }
2060
+ const inNodeModulesRE = /(?:^|[\\/])node_modules(?:[\\/]|$)/;
2060
2061
  function isInNodeModules(id) {
2061
- return id.includes("node_modules");
2062
+ return inNodeModulesRE.test(id);
2062
2063
  }
2063
2064
  function moduleListContains(moduleList, id) {
2064
2065
  return moduleList?.some((m) => m === id || id.startsWith(withTrailingSlash(m)));
@@ -2138,7 +2139,7 @@ const knownJsSrcRE = /\.(?:[jt]sx?|m[jt]s|vue|marko|svelte|astro|imba|mdx)(?:$|\
2138
2139
  const isJSRequest = (url) => {
2139
2140
  url = cleanUrl(url);
2140
2141
  if (knownJsSrcRE.test(url)) return true;
2141
- if (!path.extname(url) && url[url.length - 1] !== "/") return true;
2142
+ if (!path.extname(url) && url.at(-1) !== "/") return true;
2142
2143
  return false;
2143
2144
  };
2144
2145
  const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
@@ -2253,6 +2254,13 @@ function isFilePathFormatExplicit(filePath, packageCache) {
2253
2254
  }
2254
2255
  const splitRE = /\r?\n/g;
2255
2256
  const range = 2;
2257
+ /**
2258
+ * `splitRE` treats both LF and CRLF as a line terminator, so the terminator
2259
+ * following a line is 2 characters long when the source uses CRLF.
2260
+ */
2261
+ function lineTerminatorLengthAt(source, index) {
2262
+ return source[index] === "\r" ? 2 : 1;
2263
+ }
2256
2264
  function pad(source, n = 2) {
2257
2265
  return source.split(splitRE).map((l) => ` `.repeat(n) + l).join(`\n`);
2258
2266
  }
@@ -2261,7 +2269,10 @@ function posToNumber(source, pos) {
2261
2269
  const lines = source.split(splitRE);
2262
2270
  const { line, column } = pos;
2263
2271
  let start = 0;
2264
- for (let i = 0; i < line - 1 && i < lines.length; i++) start += lines[i].length + 1;
2272
+ for (let i = 0; i < line - 1 && i < lines.length; i++) {
2273
+ start += lines[i].length;
2274
+ start += lineTerminatorLengthAt(source, start);
2275
+ }
2265
2276
  return start + column;
2266
2277
  }
2267
2278
  function numberToPos(source, offset) {
@@ -2270,7 +2281,7 @@ function numberToPos(source, offset) {
2270
2281
  const lines = source.slice(0, offset).split(splitRE);
2271
2282
  return {
2272
2283
  line: lines.length,
2273
- column: lines[lines.length - 1].length
2284
+ column: lines.at(-1).length
2274
2285
  };
2275
2286
  }
2276
2287
  const MAX_DISPLAY_LEN = 120;
@@ -2319,12 +2330,12 @@ function generateCodeFrame(source, start = 0, end) {
2319
2330
  const underline = "^".repeat(Math.min(length, MAX_DISPLAY_LEN));
2320
2331
  res.push(`${" ".repeat(lineNumberWidth)}| ` + underline);
2321
2332
  }
2322
- count += lineLength + 1;
2333
+ count += lineTerminatorLengthAt(source, count) + lineLength;
2323
2334
  }
2324
2335
  }
2325
2336
  break;
2326
2337
  }
2327
- count++;
2338
+ count += lineTerminatorLengthAt(source, count);
2328
2339
  }
2329
2340
  return res.join("\n");
2330
2341
  }
@@ -2527,7 +2538,7 @@ function combineSourcemaps(filename, sourcemapList) {
2527
2538
  return map;
2528
2539
  }
2529
2540
  function unique(arr) {
2530
- return Array.from(new Set(arr));
2541
+ return [...new Set(arr)];
2531
2542
  }
2532
2543
  /**
2533
2544
  * Returns resolved localhost address when `dns.lookup` result differs from DNS
@@ -3175,9 +3186,17 @@ function findNearestPackageData(basedir, packageCache) {
3175
3186
  }
3176
3187
  return null;
3177
3188
  }
3189
+ function isNodeModulesPackageRoot(pkgDir) {
3190
+ const parent = path.dirname(pkgDir);
3191
+ if (path.basename(parent) === "node_modules") return !path.basename(pkgDir).startsWith("@");
3192
+ return path.basename(parent).startsWith("@") && path.basename(path.dirname(parent)) === "node_modules";
3193
+ }
3178
3194
  function findNearestMainPackageData(basedir, packageCache) {
3179
3195
  const nearestPackage = findNearestPackageData(basedir, packageCache);
3180
- return nearestPackage && (nearestPackage.data.name ? nearestPackage : findNearestMainPackageData(path.dirname(nearestPackage.dir), packageCache));
3196
+ if (!nearestPackage) return null;
3197
+ if (isInNodeModules(nearestPackage.dir) && !isNodeModulesPackageRoot(nearestPackage.dir)) return findNearestMainPackageData(path.dirname(nearestPackage.dir), packageCache);
3198
+ if (nearestPackage.data.name) return nearestPackage;
3199
+ return findNearestMainPackageData(path.dirname(nearestPackage.dir), packageCache);
3181
3200
  }
3182
3201
  function loadPackageData(pkgPath) {
3183
3202
  const data = JSON.parse(stripBomTag(fs.readFileSync(pkgPath, "utf-8")));
@@ -6422,7 +6441,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6422
6441
  };
6423
6442
  }));
6424
6443
  //#endregion
6425
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.26_tsx@4.23.13_yaml@2.9.0/node_modules/postcss-load-config/src/req.js
6444
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.13_yaml@2.9.0/node_modules/postcss-load-config/src/req.js
6426
6445
  var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6427
6446
  const { createRequire: createRequire$1 } = __require("node:module");
6428
6447
  const { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1 } = __require("node:url");
@@ -6464,7 +6483,7 @@ var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6464
6483
  module.exports = req;
6465
6484
  }));
6466
6485
  //#endregion
6467
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.26_tsx@4.23.13_yaml@2.9.0/node_modules/postcss-load-config/src/options.js
6486
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.13_yaml@2.9.0/node_modules/postcss-load-config/src/options.js
6468
6487
  var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6469
6488
  const req = require_req();
6470
6489
  /**
@@ -6498,7 +6517,7 @@ var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6498
6517
  module.exports = options;
6499
6518
  }));
6500
6519
  //#endregion
6501
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.26_tsx@4.23.13_yaml@2.9.0/node_modules/postcss-load-config/src/plugins.js
6520
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.13_yaml@2.9.0/node_modules/postcss-load-config/src/plugins.js
6502
6521
  var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6503
6522
  const req = require_req();
6504
6523
  /**
@@ -6552,7 +6571,7 @@ var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6552
6571
  module.exports = plugins;
6553
6572
  }));
6554
6573
  //#endregion
6555
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.26_tsx@4.23.13_yaml@2.9.0/node_modules/postcss-load-config/src/index.js
6574
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.13_yaml@2.9.0/node_modules/postcss-load-config/src/index.js
6556
6575
  var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6557
6576
  const { resolve: resolve$3 } = __require("node:path");
6558
6577
  const config = require_src$1();
@@ -8181,7 +8200,7 @@ var EnvironmentPluginContainer = class {
8181
8200
  async close() {
8182
8201
  if (this._closed) return;
8183
8202
  this._closed = true;
8184
- await Promise.allSettled(Array.from(this._processesing));
8203
+ await Promise.allSettled([...this._processesing]);
8185
8204
  const config = this.environment.getTopLevelConfig();
8186
8205
  let buildEndError;
8187
8206
  try {
@@ -17431,7 +17450,7 @@ function serveStaticMiddleware(server) {
17431
17450
  }
17432
17451
  const resolvedPathname = redirectedPathname || pathname;
17433
17452
  let fileUrl = path.resolve(dir, removeLeadingSlash(resolvedPathname));
17434
- if (resolvedPathname.endsWith("/") && fileUrl[fileUrl.length - 1] !== "/") fileUrl = withTrailingSlash(fileUrl);
17453
+ if (resolvedPathname.endsWith("/") && fileUrl.at(-1) !== "/") fileUrl = withTrailingSlash(fileUrl);
17435
17454
  if (redirectedPathname) {
17436
17455
  url.pathname = encodeURI(redirectedPathname);
17437
17456
  req.url = url.href.slice(url.origin.length);
@@ -17656,7 +17675,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
17656
17675
  if (processedUrl !== src.value) overwriteAttrValue(s, srcSourceCodeLocation, processedUrl);
17657
17676
  } else if (isModule && node.childNodes.length) addInlineModule(node, "js");
17658
17677
  else if (node.childNodes.length) {
17659
- const scriptNode = node.childNodes[node.childNodes.length - 1];
17678
+ const scriptNode = node.childNodes.at(-1);
17660
17679
  for (const { url, start, end } of extractImportExpressionFromClassicScript(scriptNode)) {
17661
17680
  const processedUrl = processNodeUrl(url, false, config, htmlPath, originalUrl);
17662
17681
  if (processedUrl !== url) s.update(start, end, processedUrl);
@@ -17877,7 +17896,6 @@ function memoryFilesMiddleware(server) {
17877
17896
  const mime = lookup(filePath);
17878
17897
  if (mime) res.setHeader("Content-Type", mime);
17879
17898
  for (const name in headers) res.setHeader(name, headers[name]);
17880
- res.on("finish", () => bundledDev.markPayloadDelivered(filePath));
17881
17899
  return res.end(file.source);
17882
17900
  }
17883
17901
  next();
@@ -19342,6 +19360,13 @@ const rewriteOriginHeader = (proxyReq, options, config) => {
19342
19360
  }
19343
19361
  }
19344
19362
  };
19363
+ function createProxyContextMatcher(context) {
19364
+ if (context[0] === "^") {
19365
+ const regex = new RegExp(context);
19366
+ return (url) => regex.test(url);
19367
+ }
19368
+ return (url) => url.startsWith(context);
19369
+ }
19345
19370
  function proxyMiddleware(httpServer, options, config) {
19346
19371
  const proxies = {};
19347
19372
  Object.keys(options).forEach((context) => {
@@ -19377,72 +19402,77 @@ function proxyMiddleware(httpServer, options, config) {
19377
19402
  });
19378
19403
  });
19379
19404
  });
19380
- proxies[context] = [proxy, { ...opts }];
19405
+ proxies[context] = {
19406
+ proxy,
19407
+ options: { ...opts },
19408
+ match: createProxyContextMatcher(context)
19409
+ };
19381
19410
  });
19382
19411
  if (httpServer) httpServer.on("upgrade", async (req, socket, head) => {
19383
19412
  const url = req.url;
19384
- for (const context in proxies) if (doesProxyContextMatchUrl(context, url)) {
19385
- const [proxy, opts] = proxies[context];
19386
- if (opts.ws || opts.target?.toString().startsWith("ws:") || opts.target?.toString().startsWith("wss:")) {
19387
- if (opts.bypass) try {
19388
- const bypassResult = await opts.bypass(req, void 0, opts);
19389
- if (typeof bypassResult === "string") {
19390
- debug$8?.(`bypass: ${req.url} -> ${bypassResult}`);
19391
- req.url = bypassResult;
19392
- return;
19393
- }
19394
- if (bypassResult === false) {
19395
- debug$8?.(`bypass: ${req.url} -> 404`);
19396
- socket.end("HTTP/1.1 404 Not Found\r\n\r\n", "");
19413
+ for (const context in proxies) {
19414
+ const { proxy, options: opts, match } = proxies[context];
19415
+ if (match(url)) {
19416
+ if (opts.ws || opts.target?.toString().startsWith("ws:") || opts.target?.toString().startsWith("wss:")) {
19417
+ if (opts.bypass) try {
19418
+ const bypassResult = await opts.bypass(req, void 0, opts);
19419
+ if (typeof bypassResult === "string") {
19420
+ debug$8?.(`bypass: ${req.url} -> ${bypassResult}`);
19421
+ req.url = bypassResult;
19422
+ return;
19423
+ }
19424
+ if (bypassResult === false) {
19425
+ debug$8?.(`bypass: ${req.url} -> 404`);
19426
+ socket.end("HTTP/1.1 404 Not Found\r\n\r\n", "");
19427
+ return;
19428
+ }
19429
+ } catch (err) {
19430
+ config.logger.error(`${import_picocolors.default.red(`ws proxy bypass error:`)}\n${err.stack}`, {
19431
+ timestamp: true,
19432
+ error: err
19433
+ });
19397
19434
  return;
19398
19435
  }
19399
- } catch (err) {
19400
- config.logger.error(`${import_picocolors.default.red(`ws proxy bypass error:`)}\n${err.stack}`, {
19401
- timestamp: true,
19402
- error: err
19403
- });
19436
+ if (opts.rewrite) req.url = opts.rewrite(url);
19437
+ debug$8?.(`${req.url} -> ws ${opts.target}`);
19438
+ proxy.ws(req, socket, head);
19404
19439
  return;
19405
19440
  }
19406
- if (opts.rewrite) req.url = opts.rewrite(url);
19407
- debug$8?.(`${req.url} -> ws ${opts.target}`);
19408
- proxy.ws(req, socket, head);
19409
- return;
19410
19441
  }
19411
19442
  }
19412
19443
  });
19413
19444
  return async function viteProxyMiddleware(req, res, next) {
19414
19445
  const url = req.url;
19415
- for (const context in proxies) if (doesProxyContextMatchUrl(context, url)) {
19416
- const [proxy, opts] = proxies[context];
19417
- const options = {};
19418
- if (opts.bypass) try {
19419
- const bypassResult = await opts.bypass(req, res, opts);
19420
- if (typeof bypassResult === "string") {
19421
- debug$8?.(`bypass: ${req.url} -> ${bypassResult}`);
19422
- req.url = bypassResult;
19423
- if (res.writableEnded) return;
19424
- return next();
19425
- }
19426
- if (bypassResult === false) {
19427
- debug$8?.(`bypass: ${req.url} -> 404`);
19428
- res.statusCode = 404;
19429
- return res.end();
19446
+ for (const context in proxies) {
19447
+ const { proxy, options: opts, match } = proxies[context];
19448
+ if (match(url)) {
19449
+ const options = {};
19450
+ if (opts.bypass) try {
19451
+ const bypassResult = await opts.bypass(req, res, opts);
19452
+ if (typeof bypassResult === "string") {
19453
+ debug$8?.(`bypass: ${req.url} -> ${bypassResult}`);
19454
+ req.url = bypassResult;
19455
+ if (res.writableEnded) return;
19456
+ return next();
19457
+ }
19458
+ if (bypassResult === false) {
19459
+ debug$8?.(`bypass: ${req.url} -> 404`);
19460
+ res.statusCode = 404;
19461
+ return res.end();
19462
+ }
19463
+ } catch (e) {
19464
+ debug$8?.(`bypass: ${req.url} -> ${e}`);
19465
+ return next(e);
19430
19466
  }
19431
- } catch (e) {
19432
- debug$8?.(`bypass: ${req.url} -> ${e}`);
19433
- return next(e);
19467
+ debug$8?.(`${req.url} -> ${opts.target || opts.forward}`);
19468
+ if (opts.rewrite) req.url = opts.rewrite(req.url);
19469
+ proxy.web(req, res, options);
19470
+ return;
19434
19471
  }
19435
- debug$8?.(`${req.url} -> ${opts.target || opts.forward}`);
19436
- if (opts.rewrite) req.url = opts.rewrite(req.url);
19437
- proxy.web(req, res, options);
19438
- return;
19439
19472
  }
19440
19473
  next();
19441
19474
  };
19442
19475
  }
19443
- function doesProxyContextMatchUrl(context, url) {
19444
- return context[0] === "^" && new RegExp(context).test(url) || url.startsWith(context);
19445
- }
19446
19476
  //#endregion
19447
19477
  //#region src/node/server/middlewares/rejectInvalidRequest.ts
19448
19478
  /**
@@ -19921,7 +19951,6 @@ function triggerLazyBundlingMiddleware(server) {
19921
19951
  }
19922
19952
  if (result == null) return next();
19923
19953
  res.setHeader("Content-Type", "application/javascript");
19924
- res.on("finish", () => bundledDev.markPayloadDelivered(result.filename));
19925
19954
  return res.end(result.code);
19926
19955
  };
19927
19956
  }
@@ -24190,7 +24219,7 @@ function createWebSocketServer(server, config, httpsOptions) {
24190
24219
  },
24191
24220
  [isWebSocketServer]: true,
24192
24221
  get clients() {
24193
- return new Set(Array.from(wss.clients).map(getSocketClient));
24222
+ return new Set([...wss.clients].map(getSocketClient));
24194
24223
  }
24195
24224
  };
24196
24225
  }
@@ -25082,7 +25111,7 @@ function propagateUpdate(node, traversedModules, boundaries, currentChain = [nod
25082
25111
  });
25083
25112
  } else if (!node.importers.size) return true;
25084
25113
  for (const importer of node.importers) {
25085
- const subChain = currentChain.concat(importer);
25114
+ const subChain = [...currentChain, importer];
25086
25115
  if (importer.acceptedHmrDeps.has(node)) {
25087
25116
  boundaries.push({
25088
25117
  boundary: importer,
@@ -25119,7 +25148,7 @@ function isNodeWithinCircularImports(node, nodeChain, currentChain = [node], tra
25119
25148
  if (debugHmr) {
25120
25149
  const importChain = [
25121
25150
  importer,
25122
- ...[...currentChain].reverse(),
25151
+ ...currentChain.toReversed(),
25123
25152
  ...nodeChain.slice(importerIndex, -1).reverse()
25124
25153
  ];
25125
25154
  debugHmr(import_picocolors.default.yellow(`circular imports detected: `) + importChain.map((m) => import_picocolors.default.dim(m.url)).join(" -> "));
@@ -25127,7 +25156,7 @@ function isNodeWithinCircularImports(node, nodeChain, currentChain = [node], tra
25127
25156
  return true;
25128
25157
  }
25129
25158
  if (!currentChain.includes(importer)) {
25130
- const result = isNodeWithinCircularImports(importer, nodeChain, currentChain.concat(importer), traversedModules);
25159
+ const result = isNodeWithinCircularImports(importer, nodeChain, [...currentChain, importer], traversedModules);
25131
25160
  if (result) return result;
25132
25161
  }
25133
25162
  }
@@ -26406,7 +26435,7 @@ function preload(baseModule, deps, importerUrl) {
26406
26435
  link.addEventListener("load", res);
26407
26436
  link.addEventListener("error", () => rej(/* @__PURE__ */ new Error(`Unable to preload CSS for ${dep}`)));
26408
26437
  });
26409
- }));
26438
+ }).filter((p) => p !== void 0));
26410
26439
  }
26411
26440
  function handlePreloadError(err) {
26412
26441
  const e = new Event("vite:preloadError", { cancelable: true });
@@ -26483,7 +26512,7 @@ function buildImportAnalysisPlugin(config) {
26483
26512
  let url = name;
26484
26513
  if (!url) {
26485
26514
  const rawUrl = code.slice(start, end);
26486
- if (rawUrl[0] === `"` && rawUrl[rawUrl.length - 1] === `"` || rawUrl[0] === "`" && rawUrl[rawUrl.length - 1] === "`") url = rawUrl.slice(1, -1);
26515
+ if (rawUrl[0] === `"` && rawUrl.at(-1) === `"` || rawUrl[0] === "`" && rawUrl.at(-1) === "`") url = rawUrl.slice(1, -1);
26487
26516
  }
26488
26517
  if (!url) continue;
26489
26518
  const normalizedFile = path.posix.join(path.posix.dirname(chunk.fileName), url);
@@ -26550,7 +26579,7 @@ function buildImportAnalysisPlugin(config) {
26550
26579
  let url = name;
26551
26580
  if (!url) {
26552
26581
  const rawUrl = code.slice(start, end);
26553
- if (rawUrl[0] === `"` && rawUrl[rawUrl.length - 1] === `"` || rawUrl[0] === "`" && rawUrl[rawUrl.length - 1] === "`") url = rawUrl.slice(1, -1);
26582
+ if (rawUrl[0] === `"` && rawUrl.at(-1) === `"` || rawUrl[0] === "`" && rawUrl.at(-1) === "`") url = rawUrl.slice(1, -1);
26554
26583
  }
26555
26584
  const deps = /* @__PURE__ */ new Set();
26556
26585
  let hasRemovedPureCssChunk = false;
@@ -27123,7 +27152,7 @@ async function parseImportGlob(code, importer, root, resolveId, logger) {
27123
27152
  } catch {
27124
27153
  return [];
27125
27154
  }
27126
- const tasks = Array.from(cleanCode.matchAll(importGlobRE)).map(async (match, index) => {
27155
+ const tasks = [...cleanCode.matchAll(importGlobRE)].map(async (match, index) => {
27127
27156
  const start = match.index;
27128
27157
  const err = (msg) => {
27129
27158
  const e = /* @__PURE__ */ new Error(`Invalid glob import syntax: ${msg}`);
@@ -28536,7 +28565,7 @@ function oxcResolvePlugin(resolveOptions, overrideEnvConfig, isJsPluginContainer
28536
28565
  isRequire: options.isRequire,
28537
28566
  root: options.root,
28538
28567
  scan: options.scan ?? false,
28539
- mainFields: options.skipMainField ? options.mainFields : options.mainFields.concat(["main"]),
28568
+ mainFields: options.skipMainField ? options.mainFields : [...options.mainFields, "main"],
28540
28569
  conditions: options.conditions,
28541
28570
  externalConditions: options.externalConditions,
28542
28571
  extensions: options.extensions,
@@ -30980,8 +31009,14 @@ const noInlineLinkRels = /* @__PURE__ */ new Set([
30980
31009
  "icon",
30981
31010
  "apple-touch-icon",
30982
31011
  "apple-touch-startup-image",
30983
- "manifest"
31012
+ "manifest",
31013
+ "modulepreload",
31014
+ "preload",
31015
+ "prefetch"
30984
31016
  ]);
31017
+ function getLinkShouldInline(node, attributes) {
31018
+ return node.nodeName === "link" && attributes.rel && parseRelAttr(attributes.rel).some((v) => noInlineLinkRels.has(v)) ? false : void 0;
31019
+ }
30985
31020
  const isAsyncScriptMap = /* @__PURE__ */ new WeakMap();
30986
31021
  function nodeIsElement(node) {
30987
31022
  return node.nodeName[0] !== "#";
@@ -31212,7 +31247,7 @@ function buildHtmlPlugin(config) {
31212
31247
  const processedEncodedUrl = await processSrcSet(attr.value, async ({ url }) => {
31213
31248
  const decodedUrl = decodeURIIfPossible(url);
31214
31249
  if (decodedUrl !== void 0 && !isExcludedUrl(decodedUrl)) {
31215
- const result = await processAssetUrl(url);
31250
+ const result = await processAssetUrl(url, getLinkShouldInline(node, attr.attributes));
31216
31251
  return result !== decodedUrl ? encodeURIPath(result) : url;
31217
31252
  }
31218
31253
  return url;
@@ -31231,13 +31266,10 @@ function buildHtmlPlugin(config) {
31231
31266
  end: node.sourceCodeLocation.endOffset
31232
31267
  });
31233
31268
  js += importExpression;
31234
- } else {
31235
- const shouldInline = node.nodeName === "link" && attr.attributes.rel && parseRelAttr(attr.attributes.rel).some((v) => noInlineLinkRels.has(v)) ? false : void 0;
31236
- assetUrlsPromises.push((async () => {
31237
- const processedUrl = await processAssetUrl(url, shouldInline);
31238
- if (processedUrl !== url) overwriteAttrValue(s, attr.location, partialEncodeURIPath(processedUrl));
31239
- })());
31240
- }
31269
+ } else assetUrlsPromises.push((async () => {
31270
+ const processedUrl = await processAssetUrl(url, getLinkShouldInline(node, attr.attributes));
31271
+ if (processedUrl !== url) overwriteAttrValue(s, attr.location, partialEncodeURIPath(processedUrl));
31272
+ })());
31241
31273
  }
31242
31274
  }
31243
31275
  const inlineStyle = findNeedTransformStyleAttribute(node);
@@ -31732,6 +31764,10 @@ function getImportMap(bundle, options) {
31732
31764
  //#endregion
31733
31765
  //#region src/node/plugins/asset.ts
31734
31766
  const assetUrlRE = /__VITE_ASSET__([\w$]+)__/g;
31767
+ const encodedHashPlaceholderRE = /!~%7B([\w$]{1,17})%7D~/g;
31768
+ function unescapeHashPlaceholders(uri) {
31769
+ return uri.replace(encodedHashPlaceholderRE, "!~{$1}~");
31770
+ }
31735
31771
  const fileUrlMetadata = /* @__PURE__ */ new WeakMap();
31736
31772
  const jsSourceMapRE = /\.[cm]?js\.map$/;
31737
31773
  const noInlineRE = /[?&]no-inline\b/;
@@ -31859,7 +31895,7 @@ function assetPlugin(config) {
31859
31895
  const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(format, environment.config.isWorker);
31860
31896
  if ((urlId ? fileUrlMetadata.get(environment)?.get(urlId) : void 0)?.asFileUrl) return toRelativeRuntime(fileName, chunkId).runtime;
31861
31897
  const replacement = toOutputFilePathInJS(environment, fileName, "asset", chunkId, "js", toRelativeRuntime);
31862
- return typeof replacement === "string" ? JSON.stringify(encodeURIPath(replacement)) : replacement.runtime;
31898
+ return typeof replacement === "string" ? JSON.stringify(unescapeHashPlaceholders(encodeURIPath(replacement))) : replacement.runtime;
31863
31899
  },
31864
31900
  renderChunk(code, chunk, opts) {
31865
31901
  const importedFromFileUrl = importedAssetsFromFileUrl.get(this.environment)?.get(chunk.fileName);
@@ -33345,7 +33381,6 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
33345
33381
  pre: [],
33346
33382
  post: []
33347
33383
  };
33348
- const devtoolsIntegrationPlugin = config.devtools.enabled && !isWorker ? await loadDevToolsIntegrationPlugin(config) : null;
33349
33384
  const { modulePreload } = config.build;
33350
33385
  return [
33351
33386
  optimizedDepsPlugin(),
@@ -33412,21 +33447,11 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
33412
33447
  importGlobPlugin(config),
33413
33448
  ...postPlugins,
33414
33449
  ...buildPlugins.post,
33415
- devtoolsIntegrationPlugin,
33416
33450
  clientInjectionsPlugin(config),
33417
33451
  cssAnalysisPlugin(config),
33418
33452
  importAnalysisPlugin(config)
33419
33453
  ].filter(Boolean);
33420
33454
  }
33421
- async function loadDevToolsIntegrationPlugin(config) {
33422
- try {
33423
- const { DevToolsIntegration } = await import("@vitejs/devtools/integration");
33424
- return DevToolsIntegration({ config });
33425
- } catch (error) {
33426
- config.logger.error(import_picocolors.default.red(`Failed to load Vite DevTools integration: ${error?.message || error?.stack}`), { error });
33427
- return null;
33428
- }
33429
- }
33430
33455
  function createPluginHookUtils(plugins) {
33431
33456
  const sortedPluginsCache = /* @__PURE__ */ new Map();
33432
33457
  function getSortedPlugins(hookName) {
@@ -34480,7 +34505,7 @@ async function createBuilder(inlineConfig = {}, useLegacyBuilder = false) {
34480
34505
  return output;
34481
34506
  },
34482
34507
  async runDevTools() {
34483
- if (config.devtools.enabled) try {
34508
+ if (config.devtools) try {
34484
34509
  const { runDevTools } = await import("@vitejs/devtools/integration");
34485
34510
  await runDevTools(builder);
34486
34511
  } catch (e) {
@@ -35520,7 +35545,10 @@ function inlineSourceMap(mod, result, startOffset) {
35520
35545
  if (!map || !("version" in map) || code.includes("//# sourceMappingSource=vite-generated")) return result;
35521
35546
  OTHER_SOURCE_MAP_REGEXP.lastIndex = 0;
35522
35547
  if (OTHER_SOURCE_MAP_REGEXP.test(code)) code = code.replace(OTHER_SOURCE_MAP_REGEXP, "");
35523
- const sourceMap = startOffset ? Object.assign({}, map, { mappings: ";".repeat(startOffset) + map.mappings }) : map;
35548
+ const sourceMap = startOffset ? {
35549
+ ...map,
35550
+ mappings: ";".repeat(startOffset) + map.mappings
35551
+ } : map;
35524
35552
  result.code = `${code.trimEnd()}\n//# sourceURL=${mod.id}\n${MODULE_RUNNER_SOURCEMAPPING_SOURCE}\n//# ${SOURCEMAPPING_URL}=${genSourceMapUrl(sourceMap)}\n`;
35525
35553
  return result;
35526
35554
  }
@@ -35601,6 +35629,9 @@ var BundledDev = class {
35601
35629
  this.clients.setupIfNeeded(client, payload.clientId);
35602
35630
  this.devEngine.registerClient(payload.clientId);
35603
35631
  });
35632
+ this.environment.hot.on("vite:bundled-dev:payload-delivered", (payload) => {
35633
+ this.markPayloadDelivered(payload.filename);
35634
+ });
35604
35635
  this.environment.hot.on("vite:client:connect", (_payload, client) => {
35605
35636
  if (this.lastBuildError) {
35606
35637
  debug$1?.("REPLAY: replaying last build error to newly connected client");
@@ -35736,12 +35767,16 @@ var BundledDev = class {
35736
35767
  debug$1?.(`TRIGGER-LAZY: trigger lazy bundling for module ${moduleId} for client ${clientId}`);
35737
35768
  const result = await this.devEngine.compileEntry(moduleId, clientId);
35738
35769
  this.pendingPayloadFilenames.add(result.filename);
35739
- return result;
35770
+ return {
35771
+ filename: result.filename,
35772
+ code: result.code + payloadDeliveredAck(result.filename)
35773
+ };
35740
35774
  }
35741
35775
  /**
35742
- * Called by the serving middlewares when the response for a payload completed.
35743
- * Only delivered payloads are recorded on the server's per-client ship map, so
35744
- * later chunks may omit a module only if the payload carrying it was delivered.
35776
+ * Called when the client reports that it evaluated a payload (the line appended
35777
+ * by `payloadDeliveredAck`). Only then is the payload recorded on the server's
35778
+ * per-client ship map, so later chunks may omit a module only if the client
35779
+ * already registered it.
35745
35780
  *
35746
35781
  * Note: the payload filename is unique across all clients.
35747
35782
  */
@@ -35813,7 +35848,7 @@ var BundledDev = class {
35813
35848
  code: typeof hmrOutput.code === "string" ? "[code]" : hmrOutput.code
35814
35849
  });
35815
35850
  this.pendingPayloadFilenames.add(hmrOutput.filename);
35816
- this.memoryFiles.set(hmrOutput.filename, { source: hmrOutput.code + "\n; export {}" });
35851
+ this.memoryFiles.set(hmrOutput.filename, { source: hmrOutput.code + payloadDeliveredAck(hmrOutput.filename) + "\n; export {}" });
35817
35852
  if (hmrOutput.sourcemapFilename && hmrOutput.sourcemap) this.memoryFiles.set(hmrOutput.sourcemapFilename, { source: hmrOutput.sourcemap });
35818
35853
  client.send({
35819
35854
  type: "bundled-dev-update",
@@ -35845,7 +35880,7 @@ var Clients = class {
35845
35880
  return this.clientToId.get(client);
35846
35881
  }
35847
35882
  getAll() {
35848
- return Array.from(this.idToClient.values());
35883
+ return [...this.idToClient.values()];
35849
35884
  }
35850
35885
  delete(client) {
35851
35886
  const id = this.clientToId.get(client);
@@ -35866,6 +35901,15 @@ function debounce(time, cb) {
35866
35901
  timer = globalThis.setTimeout(cb, time);
35867
35902
  };
35868
35903
  }
35904
+ /**
35905
+ * The line appended to a lazy chunk or HMR patch so the client reports the
35906
+ * payload as delivered once its factories are registered. Placed after the
35907
+ * chunk's tail: if the tail throws, no report is sent and the next payload
35908
+ * simply re-ships those factories, which is safe (registration overwrites).
35909
+ */
35910
+ function payloadDeliveredAck(filename) {
35911
+ return `\n;__rolldown_runtime__.payloadDelivered(${JSON.stringify(filename)});`;
35912
+ }
35869
35913
  //#endregion
35870
35914
  //#region src/node/server/moduleGraph.ts
35871
35915
  var EnvironmentModuleNode = class {
@@ -36447,8 +36491,8 @@ function setupOnCrawlEnd() {
36447
36491
  //#endregion
36448
36492
  //#region src/node/server/environments/runnableEnvironment.ts
36449
36493
  function createRunnableDevEnvironment(name, config, context = {}) {
36450
- if (context.transport == null) context.transport = createServerHotChannel();
36451
- if (context.hot == null) context.hot = true;
36494
+ context.transport ??= createServerHotChannel();
36495
+ context.hot ??= true;
36452
36496
  return new RunnableDevEnvironment(name, config, context);
36453
36497
  }
36454
36498
  function isRunnableDevEnvironment(environment) {
@@ -36553,20 +36597,32 @@ function defaultCreateClientDevEnvironment(name, config, context) {
36553
36597
  function defaultCreateDevEnvironment(name, config) {
36554
36598
  return createRunnableDevEnvironment(name, config);
36555
36599
  }
36556
- async function resolveDevToolsConfig(config, host, logger) {
36557
- const isEnabled = config === true || !!(config && config.enabled);
36558
- const fallbackHostname = (await resolveHostname(host)).host ?? "localhost";
36559
- const fallbackConfig = {
36560
- config: { host: fallbackHostname },
36561
- enabled: false
36562
- };
36563
- if (!isEnabled) return fallbackConfig;
36600
+ function isDevToolsOptionEnabled(config) {
36601
+ return config === true || typeof config === "object" && config != null && config.enabled !== false;
36602
+ }
36603
+ async function resolveDevToolsConfig(config, command) {
36604
+ if (!isDevToolsOptionEnabled(config)) return false;
36605
+ const { isDevToolsEnabled, normalizeDevToolsConfig } = await import("@vitejs/devtools/config");
36606
+ const resolved = normalizeDevToolsConfig(config, void 0);
36607
+ return isDevToolsEnabled(resolved, command) ? resolved : false;
36608
+ }
36609
+ async function loadDevToolsIntegrationPlugins(config, command, options) {
36564
36610
  try {
36565
- const { normalizeDevToolsConfig } = await import("@vitejs/devtools/config");
36566
- return normalizeDevToolsConfig(config, fallbackHostname);
36567
- } catch (e) {
36568
- logger.error(import_picocolors.default.red(`Failed to load Vite DevTools config: ${e.message || e.stack}`), { error: e });
36569
- return fallbackConfig;
36611
+ const resolved = await resolveDevToolsConfig(options, command);
36612
+ if (!resolved) return;
36613
+ const { DevToolsIntegration } = await import("@vitejs/devtools/integration");
36614
+ return {
36615
+ plugins: await DevToolsIntegration({
36616
+ command,
36617
+ devtools: { options }
36618
+ }),
36619
+ resolvedConfig: resolved
36620
+ };
36621
+ } catch (error) {
36622
+ createLogger(config.logLevel, {
36623
+ allowClearScreen: config.clearScreen,
36624
+ customLogger: config.customLogger
36625
+ }).error(import_picocolors.default.red(`Failed to load Vite DevTools integration: ${error?.message || error?.stack}`), { error });
36570
36626
  }
36571
36627
  }
36572
36628
  const configDefaults = Object.freeze({
@@ -36865,7 +36921,9 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
36865
36921
  }, configEnv);
36866
36922
  else return p.apply === command;
36867
36923
  };
36868
- const [prePlugins, normalPlugins, postPlugins] = sortUserPlugins((await asyncFlatten(config.plugins || [])).filter(filterPlugin));
36924
+ const devtoolsOptions = typeof config.devtools === "object" && config.devtools != null ? deepClone(config.devtools) : config.devtools;
36925
+ const devtoolsIntegration = await loadDevToolsIntegrationPlugins(config, command, devtoolsOptions);
36926
+ const [prePlugins, normalPlugins, postPlugins] = sortUserPlugins((await asyncFlatten([...config.plugins || [], ...devtoolsIntegration?.plugins || []])).filter(filterPlugin));
36869
36927
  const isBuild = command === "build";
36870
36928
  const userPlugins = [
36871
36929
  ...prePlugins,
@@ -36873,6 +36931,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
36873
36931
  ...postPlugins
36874
36932
  ];
36875
36933
  config = await runConfigHook(config, userPlugins, configEnv);
36934
+ const devtoolsConfigChanged = !isDeepStrictEqual(config.devtools, devtoolsOptions);
36876
36935
  config.environments ??= {};
36877
36936
  if (!config.environments.ssr && (!isBuild || config.ssr || config.build?.ssr)) config.environments = {
36878
36937
  ssr: {},
@@ -36886,6 +36945,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
36886
36945
  allowClearScreen: config.clearScreen,
36887
36946
  customLogger: config.customLogger
36888
36947
  });
36948
+ if (devtoolsConfigChanged) logger.warn(import_picocolors.default.yellow(`The \`devtools\` option cannot be changed from a plugin's \`config\` hook. Set it in the user config instead.`));
36889
36949
  const tsconfigPathsPlugin = userPlugins.find((p) => p.name === "vite-tsconfig-paths" || p.name === "vite-plugin-tsconfig-paths");
36890
36950
  if (tsconfigPathsPlugin) logger.warnOnce(import_picocolors.default.yellow(`The plugin ${JSON.stringify(tsconfigPathsPlugin.name)} is detected. Vite now supports tsconfig paths resolution natively via the ${import_picocolors.default.bold("resolve.tsconfigPaths")} option. You can remove the plugin and set ${import_picocolors.default.bold("resolve.tsconfigPaths: true")} in your Vite config instead.`));
36891
36951
  if (process.versions.pnp) logger.warnOnce(import_picocolors.default.yellow(`Using Yarn PnP with Vite is discouraged and PnP-specific bugs will no longer be actively worked on. Please switch to a different ${import_picocolors.default.bold("nodeLinker")} mode or to a different package manager.`));
@@ -37048,7 +37108,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
37048
37108
  } else if (config.esbuild === false && config.oxc !== false) logger.warn(import_picocolors.default.yellow("`esbuild` option is set to false, but `oxc` option was not set to false. `esbuild: false` does not have effect any more. If you want to disable the default transformation, which is now handled by Oxc, please set `oxc: false` instead."));
37049
37109
  const experimental = mergeWithDefaults(configDefaults.experimental, config.experimental ?? {});
37050
37110
  if (command === "serve" && experimental.bundledDev) experimental.renderBuiltUrl = void 0;
37051
- const resolvedDevToolsConfig = await resolveDevToolsConfig(config.devtools, server.host, logger);
37111
+ const resolvedDevToolsConfig = devtoolsIntegration?.resolvedConfig ?? false;
37052
37112
  resolved = {
37053
37113
  configFile: configFile ? normalizePath(configFile) : void 0,
37054
37114
  configFileDependencies: configFileDependencies.map((name) => normalizePath(path.resolve(name))),
@@ -1,6 +1,6 @@
1
1
  import { ft as __commonJSMin, pt as __require } from "./node.js";
2
2
  import { t as require_lib } from "./lib.js";
3
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/format-import-prelude.js
3
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/format-import-prelude.js
4
4
  var require_format_import_prelude = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
5
  module.exports = function formatImportPrelude(layer, media, supports) {
6
6
  const parts = [];
@@ -15,7 +15,7 @@ var require_format_import_prelude = /* @__PURE__ */ __commonJSMin(((exports, mod
15
15
  };
16
16
  }));
17
17
  //#endregion
18
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/base64-encoded-import.js
18
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/base64-encoded-import.js
19
19
  var require_base64_encoded_import = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20
20
  const formatImportPrelude = require_format_import_prelude();
21
21
  module.exports = function base64EncodedConditionalImport(prelude, conditions) {
@@ -28,7 +28,7 @@ var require_base64_encoded_import = /* @__PURE__ */ __commonJSMin(((exports, mod
28
28
  };
29
29
  }));
30
30
  //#endregion
31
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/apply-conditions.js
31
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/apply-conditions.js
32
32
  var require_apply_conditions = /* @__PURE__ */ __commonJSMin(((exports, module) => {
33
33
  const base64EncodedConditionalImport = require_base64_encoded_import();
34
34
  module.exports = function applyConditions(bundle, atRule) {
@@ -103,7 +103,7 @@ var require_apply_conditions = /* @__PURE__ */ __commonJSMin(((exports, module)
103
103
  };
104
104
  }));
105
105
  //#endregion
106
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/apply-raws.js
106
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/apply-raws.js
107
107
  var require_apply_raws = /* @__PURE__ */ __commonJSMin(((exports, module) => {
108
108
  module.exports = function applyRaws(bundle) {
109
109
  bundle.forEach((stmt, index) => {
@@ -114,7 +114,7 @@ var require_apply_raws = /* @__PURE__ */ __commonJSMin(((exports, module) => {
114
114
  };
115
115
  }));
116
116
  //#endregion
117
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/apply-styles.js
117
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/apply-styles.js
118
118
  var require_apply_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
119
119
  module.exports = function applyStyles(bundle, styles) {
120
120
  styles.nodes = [];
@@ -134,7 +134,7 @@ var require_apply_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
134
134
  };
135
135
  }));
136
136
  //#endregion
137
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/data-url.js
137
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/data-url.js
138
138
  var require_data_url = /* @__PURE__ */ __commonJSMin(((exports, module) => {
139
139
  const anyDataURLRegexp = /^data:text\/css(?:;(base64|plain))?,/i;
140
140
  const base64DataURLRegexp = /^data:text\/css;base64,/i;
@@ -153,7 +153,7 @@ var require_data_url = /* @__PURE__ */ __commonJSMin(((exports, module) => {
153
153
  };
154
154
  }));
155
155
  //#endregion
156
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/parse-statements.js
156
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/parse-statements.js
157
157
  var require_parse_statements = /* @__PURE__ */ __commonJSMin(((exports, module) => {
158
158
  const valueParser = require_lib();
159
159
  const { stringify } = valueParser;
@@ -278,7 +278,7 @@ var require_parse_statements = /* @__PURE__ */ __commonJSMin(((exports, module)
278
278
  }
279
279
  }));
280
280
  //#endregion
281
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/process-content.js
281
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/process-content.js
282
282
  var require_process_content = /* @__PURE__ */ __commonJSMin(((exports, module) => {
283
283
  const path$2 = __require("path");
284
284
  let sugarss;
@@ -312,7 +312,7 @@ var require_process_content = /* @__PURE__ */ __commonJSMin(((exports, module) =
312
312
  }
313
313
  }));
314
314
  //#endregion
315
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/parse-styles.js
315
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/parse-styles.js
316
316
  var require_parse_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
317
317
  const path$1 = __require("path");
318
318
  const dataURL = require_data_url();
@@ -416,7 +416,7 @@ var require_parse_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
416
416
  module.exports = parseStyles;
417
417
  }));
418
418
  //#endregion
419
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/index.js
419
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/index.js
420
420
  var require_postcss_import = /* @__PURE__ */ __commonJSMin(((exports, module) => {
421
421
  const path = __require("path");
422
422
  const applyConditions = require_apply_conditions();
package/dist/node/cli.js CHANGED
@@ -651,7 +651,7 @@ const stopProfiler = (log) => {
651
651
  });
652
652
  };
653
653
  const filterDuplicateOptions = (options) => {
654
- for (const [key, value] of Object.entries(options)) if (Array.isArray(value)) options[key] = value[value.length - 1];
654
+ for (const [key, value] of Object.entries(options)) if (Array.isArray(value)) options[key] = value.at(-1);
655
655
  };
656
656
  /**
657
657
  * removing global flags before passing as command specific sub-configs
@@ -8,6 +8,7 @@ import { parseAst as parseAst$1, parseAstAsync as parseAstAsync$1 } from "rolldo
8
8
  import * as Rollup from "#types/internal/rollupTypeCompat";
9
9
  import { esmExternalRequirePlugin } from "rolldown/plugins";
10
10
  import { ESTree, MinifyOptions, MinifyResult, ParseResult, ParserOptions, TransformOptions as rolldown_utils_TransformOptions, TransformResult as rolldown_utils_TransformResult, Visitor, VisitorObject, minify, minifySync, parse, parseSync } from "rolldown/utils";
11
+ import { DevToolsConfig, ResolvedDevToolsConfig } from "#types/internal/devtoolsOptions";
11
12
  import { DepsOptimizerEsbuildOptions, EsbuildTarget, EsbuildTransformOptions, EsbuildTransformOptions as esbuildOptions_EsbuildTransformOptions, EsbuildTransformResult } from "#types/internal/esbuildOptions";
12
13
  import { ChunkMetadata, CustomPluginOptionsVite } from "#types/metadata";
13
14
  import * as http from "node:http";
@@ -31,59 +32,6 @@ import { LightningCSSOptions, LightningCSSOptions as lightningcssOptions_Lightni
31
32
  import { withFilter } from "rolldown/filter";
32
33
  import { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownAsTypeMap, KnownQueryTypeMap } from "#types/importGlob";
33
34
  //#endregion
34
- //#region ../../node_modules/.pnpm/@vitejs+devtools@0.5.1_@devframes+json-render@0.9.7_srvx@0.12.7_vite@packages+vite/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
35
- //#region src/node/cli-commands.d.ts
36
- interface StartOptions {
37
- root?: string;
38
- config?: string;
39
- host: string;
40
- port?: string | number;
41
- open?: boolean;
42
- }
43
- //#endregion
44
- //#region ../../node_modules/.pnpm/@vitejs+devtools@0.5.1_@devframes+json-render@0.9.7_srvx@0.12.7_vite@packages+vite/node_modules/@vitejs/devtools/dist/config.d.ts
45
- //#region src/node/config.d.ts
46
- interface DevToolsConfig extends Partial<StartOptions> {
47
- enabled: boolean;
48
- /**
49
- * Vite environments to enable DevTools for. Defaults to all environments.
50
- */
51
- environments?: string[];
52
- /**
53
- * Disable client authentication.
54
- *
55
- * Beware that if you disable client authentication,
56
- * any browsers can connect to the devtools and access to your server and filesystem.
57
- * (including other devices, if you open server `host` option to LAN or WAN)
58
- *
59
- * @default true
60
- */
61
- clientAuth?: boolean;
62
- /**
63
- * Pre-configured auth tokens that are automatically trusted.
64
- *
65
- * Clients connecting with an auth token matching one of these
66
- * will be auto-approved without a terminal prompt.
67
- */
68
- clientAuthTokens?: string[];
69
- /**
70
- * Origins allowed to open the DevTools WebSocket connection, in addition to the built-in
71
- * loopback allowlist (`localhost`, `127.0.0.1`, etc).
72
- *
73
- * The loopback check is a plain string match against the `Origin` header, not a DNS/hosts-file
74
- * resolution — a custom dev hostname that resolves to loopback via `/etc/hosts` or a local DNS
75
- * override (e.g. `dev-my-app.example.com`) is invisible to it and gets rejected. List such
76
- * hostnames here explicitly.
77
- */
78
- allowedOrigins?: string[];
79
- }
80
- interface ResolvedDevToolsConfig {
81
- config: Omit<DevToolsConfig, 'enabled'> & {
82
- host: string;
83
- };
84
- enabled: boolean;
85
- }
86
- //#endregion
87
35
  //#region src/types/alias.d.ts
88
36
  interface Alias {
89
37
  find: string | RegExp;
@@ -1186,9 +1134,10 @@ declare class BundledDev {
1186
1134
  filename: string;
1187
1135
  } | undefined>;
1188
1136
  /**
1189
- * Called by the serving middlewares when the response for a payload completed.
1190
- * Only delivered payloads are recorded on the server's per-client ship map, so
1191
- * later chunks may omit a module only if the payload carrying it was delivered.
1137
+ * Called when the client reports that it evaluated a payload (the line appended
1138
+ * by `payloadDeliveredAck`). Only then is the payload recorded on the server's
1139
+ * per-client ship map, so later chunks may omit a module only if the client
1140
+ * already registered it.
1192
1141
  *
1193
1142
  * Note: the payload filename is unique across all clients.
1194
1143
  */
@@ -3180,7 +3129,7 @@ type ResolveIdFn = (environment: PartialEnvironment, id: string, importer?: stri
3180
3129
  */
3181
3130
  export declare function createIdResolver(config: ResolvedConfig, options?: Partial<InternalResolveOptions>): ResolveIdFn;
3182
3131
  //#endregion
3183
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.26_tsx@4.23.13_yaml@2.9.0/node_modules/postcss-load-config/src/index.d.ts
3132
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.13_yaml@2.9.0/node_modules/postcss-load-config/src/index.d.ts
3184
3133
  type ConfigPlugin = Transformer | PostCSS.Plugin | Processor;
3185
3134
  interface Config {
3186
3135
  parser?: string | ProcessOptions['parser'] | false;
@@ -3702,7 +3651,6 @@ interface UserConfig extends DefaultEnvironmentOptions {
3702
3651
  appType?: AppType;
3703
3652
  /**
3704
3653
  * Enable devtools integration. Ensure that `@vitejs/devtools` is installed as a dependency.
3705
- * This feature is currently supported only in build mode.
3706
3654
  * @experimental
3707
3655
  * @default false
3708
3656
  */
@@ -3857,7 +3805,7 @@ interface ResolvedConfig extends Readonly<Omit<UserConfig, "plugins" | "css" | "
3857
3805
  /** @experimental */
3858
3806
  builder: ResolvedBuilderOptions | undefined;
3859
3807
  build: ResolvedBuildOptions;
3860
- devtools: ResolvedDevToolsConfig;
3808
+ devtools: ResolvedDevToolsConfig | false;
3861
3809
  preview: ResolvedPreviewOptions;
3862
3810
  ssr: ResolvedSSROptions;
3863
3811
  assetsInclude: (file: string) => boolean;
@@ -4109,4 +4057,4 @@ export declare const parseAst: typeof parseAst$1;
4109
4057
  export declare const parseAstAsync: typeof parseAstAsync$1;
4110
4058
  export declare const esbuildVersion = "0.25.0";
4111
4059
  //#endregion
4112
- export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type BindCLIShortcutsOptions, type BuildAppHook, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type ChunkMetadata, type CommonServerOptions, type ConfigEnv, type ConfigPluginContext, type Connect, type ConnectedPayload, type CorsOptions, type CorsOrigin, type CustomEventMap, type CustomPayload, type CustomPluginOptionsVite, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESTree, type Environment, type EnvironmentModuleGraph, type EnvironmentModuleNode, type EnvironmentOptions, type ErrorPayload, type EsbuildTransformOptions, type ExperimentalOptions, type ExportsData, type FSWatcher, type FetchFunction, type FetchModuleOptions, type FetchResult, type FetchableDevEnvironment, type FetchableDevEnvironmentContext, type FileSystemServeOptions, type FilterPattern, type FullReloadPayload, type GeneralImportGlobOptions, type HMRPayload, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotChannelListener, type HotPayload, type HotUpdateOptions, type HtmlAssetSource, type HtmlTagDescriptor, type index_d_exports as HttpProxy, type HttpServer, type ImportGlobFunction, type ImportGlobOptions, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InferCustomEventPayload, type InlineConfig, type InternalResolveOptions, type InvalidatePayload, type JsonOptions, type KnownAsTypeMap, type KnownQueryTypeMap, type LegacyOptions, type LessPreprocessorOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, type MinifyOptions, type MinifyResult, type MinimalPluginContextWithoutEnvironment, type ModuleGraph, type ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type NormalizedHotChannel, type NormalizedHotChannelClient, type NormalizedServerHotChannel, type OptimizedDepInfo, type OxcOptions, type ParseResult, type ParserOptions, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type Config as PostcssUserConfig, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type PrunePayload, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type Rolldown, type Rollup, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type RunnableDevEnvironment, type RunnableDevEnvironmentContext, type SSROptions, type SSRTarget, type SassPreprocessorOptions, type SendOptions, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions$1 as ServerOptions, type ServerWatchOptions, type SkipInformation, type SsrDepOptimizationConfig, type StylusPreprocessorOptions, type Terser, type TerserOptions, type TransformOptions, type TransformResult, type Update, type UpdatePayload, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, Visitor, type VisitorObject, type ViteBuilder, type ViteDevServer, type WatchOptions, type WebSocket, type WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, type WebSocketServer, type WsOptions, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, esmExternalRequirePlugin, minify, minifySync, ssrTransform as moduleRunnerTransform, parse, parseSync, rolldownVersion, VERSION as version, withFilter };
4060
+ export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type BindCLIShortcutsOptions, type BuildAppHook, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type ChunkMetadata, type CommonServerOptions, type ConfigEnv, type ConfigPluginContext, type Connect, type ConnectedPayload, type CorsOptions, type CorsOrigin, type CustomEventMap, type CustomPayload, type CustomPluginOptionsVite, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESTree, type Environment, type EnvironmentModuleGraph, type EnvironmentModuleNode, type EnvironmentOptions, type ErrorPayload, type EsbuildTransformOptions, type ExperimentalOptions, type ExportsData, type FSWatcher, type FetchFunction, type FetchModuleOptions, type FetchResult, type FetchableDevEnvironment, type FetchableDevEnvironmentContext, type FileSystemServeOptions, type FilterPattern, type FullReloadPayload, type GeneralImportGlobOptions, type HMRPayload, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotChannelListener, type HotPayload, type HotUpdateOptions, type HtmlAssetSource, type HtmlTagDescriptor, type index_d_exports as HttpProxy, type HttpServer, type ImportGlobFunction, type ImportGlobOptions, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InferCustomEventPayload, type InlineConfig, type InternalResolveOptions, type InvalidatePayload, type JsonOptions, type KnownAsTypeMap, type KnownQueryTypeMap, type LegacyOptions, type LessPreprocessorOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, type MinifyOptions, type MinifyResult, type MinimalPluginContextWithoutEnvironment, type ModuleGraph, type ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type NormalizedHotChannel, type NormalizedHotChannelClient, type NormalizedServerHotChannel, type OptimizedDepInfo, type OxcOptions, type ParseResult, type ParserOptions, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type Config as PostcssUserConfig, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type PrunePayload, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, type ResolvedDevToolsConfig, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type Rolldown, type Rollup, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type RunnableDevEnvironment, type RunnableDevEnvironmentContext, type SSROptions, type SSRTarget, type SassPreprocessorOptions, type SendOptions, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions$1 as ServerOptions, type ServerWatchOptions, type SkipInformation, type SsrDepOptimizationConfig, type StylusPreprocessorOptions, type Terser, type TerserOptions, type TransformOptions, type TransformResult, type Update, type UpdatePayload, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, Visitor, type VisitorObject, type ViteBuilder, type ViteDevServer, type WatchOptions, type WebSocket, type WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, type WebSocketServer, type WsOptions, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, esmExternalRequirePlugin, minify, minifySync, ssrTransform as moduleRunnerTransform, parse, parseSync, rolldownVersion, VERSION as version, withFilter };
@@ -223,7 +223,7 @@ function encodePathChars(filepath) {
223
223
  const posixDirname = dirname, posixResolve = resolve;
224
224
  function posixPathToFileHref(posixPath) {
225
225
  let resolved = posixResolve(posixPath), filePathLast = posixPath.charCodeAt(posixPath.length - 1);
226
- return (filePathLast === 47 || isWindows && filePathLast === 92) && resolved[resolved.length - 1] !== "/" && (resolved += "/"), resolved = encodePathChars(resolved), resolved.includes("?") && (resolved = resolved.replace(questionRegex, "%3F")), resolved.includes("#") && (resolved = resolved.replace(hashRegex, "%23")), new URL(`file://${resolved}`).href;
226
+ return (filePathLast === 47 || isWindows && filePathLast === 92) && resolved.at(-1) !== "/" && (resolved += "/"), resolved = encodePathChars(resolved), resolved.includes("?") && (resolved = resolved.replace(questionRegex, "%3F")), resolved.includes("#") && (resolved = resolved.replace(hashRegex, "%23")), new URL(`file://${resolved}`).href;
227
227
  }
228
228
  function toWindowsPath(path) {
229
229
  return path.replace(/\//g, "\\");
@@ -709,7 +709,7 @@ function analyzeImportedModDifference(mod, rawId, moduleType, metadata) {
709
709
  if (!metadata?.isDynamicImport && metadata?.importedNames?.length) {
710
710
  let missingBindings = metadata.importedNames.filter((s) => !(s in mod));
711
711
  if (missingBindings.length) {
712
- let lastBinding = missingBindings[missingBindings.length - 1];
712
+ let lastBinding = missingBindings.at(-1);
713
713
  throw SyntaxError(moduleType === "module" ? `[vite] The requested module '${rawId}' does not provide an export named '${lastBinding}'` : `\
714
714
  [vite] Named export '${lastBinding}' not found. The requested module '${rawId}' is a CommonJS module, which may not support all module.exports as named exports.
715
715
  CommonJS modules can always be imported via the default export, for example using:
@@ -1165,7 +1165,7 @@ var ModuleRunner = class {
1165
1165
  return !1;
1166
1166
  }
1167
1167
  async cachedRequest(url, mod, callstack = [], metadata) {
1168
- let meta = mod.meta, moduleId = meta.id, importee = callstack[callstack.length - 1];
1168
+ let meta = mod.meta, moduleId = meta.id, importee = callstack.at(-1);
1169
1169
  if (importee && mod.importers.add(importee), mod.evaluated && mod.promise) return this.processImport(await mod.promise, meta, metadata);
1170
1170
  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);
1171
1171
  let debugTimer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "8.3.0-beta.0",
3
+ "version": "8.3.0",
4
4
  "description": "Native-ESM powered web dev build tool",
5
5
  "keywords": [
6
6
  "build-tool",
@@ -58,7 +58,7 @@
58
58
  "dependencies": {
59
59
  "lightningcss": "^1.33.0",
60
60
  "picomatch": "^4.0.7",
61
- "postcss": "^8.5.26",
61
+ "postcss": "^8.5.28",
62
62
  "rolldown": "~1.2.6",
63
63
  "tinyglobby": "^0.2.17"
64
64
  },
@@ -73,11 +73,11 @@
73
73
  "@types/escape-html": "^1.0.4",
74
74
  "@types/pnpapi": "^0.0.5",
75
75
  "@vercel/detect-agent": "^1.2.5",
76
- "@vitejs/devtools": "^0.5.1",
76
+ "@vitejs/devtools": "^0.7.1",
77
77
  "@vitest/utils": "4.1.11",
78
78
  "@voidzero-dev/vite-task-client": "^0.2.0",
79
79
  "artichokie": "^0.4.4",
80
- "baseline-browser-mapping": "^2.11.20",
80
+ "baseline-browser-mapping": "^2.11.21",
81
81
  "cac": "^7.0.0",
82
82
  "chokidar": "^3.6.0",
83
83
  "connect": "^3.7.0",
@@ -112,8 +112,8 @@
112
112
  "rolldown-plugin-dts": "^0.28.3",
113
113
  "rollup": "^4.59.0",
114
114
  "rollup-plugin-license": "^3.7.1",
115
- "sass": "^1.103.1",
116
- "sass-embedded": "^1.103.1",
115
+ "sass": "^1.104.0",
116
+ "sass-embedded": "^1.104.0",
117
117
  "sirv": "^3.0.2",
118
118
  "strip-literal": "^4.0.0",
119
119
  "terser": "^5.51.2",
@@ -122,7 +122,7 @@
122
122
  },
123
123
  "peerDependencies": {
124
124
  "@types/node": "^20.19.0 || >=22.12.0",
125
- "@vitejs/devtools": "^0.4.0 || ^0.5.0",
125
+ "@vitejs/devtools": "^0.7.1",
126
126
  "esbuild": "^0.27.0 || ^0.28.0",
127
127
  "jiti": ">=1.21.0",
128
128
  "less": "^4.0.0",
@@ -39,16 +39,10 @@ export interface WebSocketConnectionPayload {
39
39
  }
40
40
 
41
41
  export interface InvalidatePayload {
42
- /**
43
- * Module URL of the invalidated module.
44
- * @remarks This changed from a browser-safe URL to a module URL.
45
- */
42
+ /** Module URL of the invalidated module */
46
43
  path: string
47
44
  message: string | undefined
48
- /**
49
- * Module URL of the first module that invalidated the update.
50
- * @remarks This changed from a browser-safe URL to a module URL.
51
- */
45
+ /** Module URL of the first module that invalidated the update */
52
46
  firstInvalidatedBy: string
53
47
  }
54
48
 
@@ -38,15 +38,9 @@ export interface BundledDevUpdatePayload {
38
38
 
39
39
  export interface Update {
40
40
  type: 'js-update' | 'css-update'
41
- /**
42
- * Module URL of the HMR boundary.
43
- * @remarks This changed from a browser-safe URL to a module URL.
44
- */
41
+ /** Module URL of the HMR boundary */
45
42
  path: string
46
- /**
47
- * Module URL of the accepted module.
48
- * @remarks This changed from a browser-safe URL to a module URL.
49
- */
43
+ /** Module URL of the accepted module */
50
44
  acceptedPath: string
51
45
  timestamp: number
52
46
  /** @internal */
@@ -0,0 +1,9 @@
1
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
2
+
3
+ // @ts-ignore `@vitejs/devtools` may not be installed
4
+ import type * as DevToolsConfig from '@vitejs/devtools/config'
5
+
6
+ /* eslint-enable @typescript-eslint/ban-ts-comment */
7
+
8
+ export type DevToolsConfig = DevToolsConfig.DevToolsConfig
9
+ export type ResolvedDevToolsConfig = DevToolsConfig.ResolvedDevToolsConfig