vite 8.3.2 → 8.3.4

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.
@@ -13,7 +13,6 @@ import { format, formatWithOptions, inspect, isDeepStrictEqual, parseEnv, promis
13
13
  import { MessageChannel, Worker } from "node:worker_threads";
14
14
  import pm from "picomatch";
15
15
  import { VERSION as rolldownVersion, rolldown } from "rolldown";
16
- import { escapePath, glob, globSync, isDynamicPattern } from "tinyglobby";
17
16
  import { dev, oxcRuntimePlugin, resolveTsconfig, scan, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteDynamicImportVarsPlugin, viteImportGlobPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWebWorkerPostPlugin } from "rolldown/experimental";
18
17
  import childProcess, { exec, execFile, execSync, spawn } from "node:child_process";
19
18
  import { promises } from "node:dns";
@@ -24,6 +23,7 @@ import path$1, { isAbsolute as isAbsolute$1, join as join$1, posix as posix$1, r
24
23
  import { exactRegex, makeIdFiltersToMatchWithQuery, prefixRegex, withFilter } from "rolldown/filter";
25
24
  import { Buffer as Buffer$1 } from "node:buffer";
26
25
  import { readdirSync, statSync as statSync$1 } from "fs";
26
+ import { escapePath, glob, globSync, isDynamicPattern } from "tinyglobby";
27
27
  import assert from "node:assert";
28
28
  import process$1, { cwd } from "node:process";
29
29
  import v8 from "node:v8";
@@ -649,7 +649,7 @@ var BaseEnvironment = class extends PartialEnvironment {
649
649
  };
650
650
  //#endregion
651
651
  //#region package.json
652
- var version = "8.3.2";
652
+ var version = "8.3.4";
653
653
  //#endregion
654
654
  //#region src/node/constants.ts
655
655
  const ROLLUP_HOOKS = [
@@ -2490,7 +2490,7 @@ function optimizeSafeRealPathSync() {
2490
2490
  });
2491
2491
  }
2492
2492
  function ensureWatchedFile(watcher, file, root) {
2493
- if (file && !file.startsWith(withTrailingSlash(root)) && !file.includes("\0") && fs.existsSync(file)) watcher.add(path.resolve(file));
2493
+ if (file && !normalizePath(file).startsWith(withTrailingSlash(root)) && !file.includes("\0") && fs.existsSync(file)) watcher.add(path.resolve(file));
2494
2494
  }
2495
2495
  function joinSrcset(ret) {
2496
2496
  return ret.map(({ url, descriptor }) => url + (descriptor ? ` ${descriptor}` : "")).join(", ");
@@ -2832,7 +2832,7 @@ function setupHmrWsOptionCompat(serverConfig) {
2832
2832
  for (const key of wsOptionKeys) if (hmrConfig[key] !== void 0) wsConfig[key] ??= hmrConfig[key];
2833
2833
  }
2834
2834
  serverConfig.ws = wsConfig;
2835
- const hmrProxy = hmrConfig || {};
2835
+ const hmrProxy = { ...hmrConfig };
2836
2836
  for (const key of wsOptionKeys) Object.defineProperty(hmrProxy, key, {
2837
2837
  get() {
2838
2838
  return serverConfig.ws?.[key];
@@ -3483,7 +3483,7 @@ function alias$1(options = {}) {
3483
3483
  };
3484
3484
  }
3485
3485
  //#endregion
3486
- //#region ../../node_modules/.pnpm/magic-string@1.4.2/node_modules/magic-string/dist/index.mjs
3486
+ //#region ../../node_modules/.pnpm/magic-string@1.4.3/node_modules/magic-string/dist/index.mjs
3487
3487
  var BitSet = class BitSet {
3488
3488
  constructor(arg) {
3489
3489
  this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
@@ -4492,7 +4492,7 @@ var MagicString = class MagicString {
4492
4492
  while (chunk !== last) {
4493
4493
  if (chunk.next !== this.byStart.get(chunk.end)) throw new MagicStringError("cannot overwrite across a split point");
4494
4494
  chunk = chunk.next;
4495
- chunk.edit("", false);
4495
+ chunk.edit("", false, !overwrite);
4496
4496
  }
4497
4497
  first.edit(content, storeName, !overwrite);
4498
4498
  } else {
@@ -4846,8 +4846,8 @@ var MagicString = class MagicString {
4846
4846
  if (this._hasRemovedContent(match.index, match.index + match[0].length)) return false;
4847
4847
  const replacement = getReplacement(match, this.original);
4848
4848
  if (replacement === match[0]) return true;
4849
- if (match[0].length === 0) this.appendRight(match.index, replacement);
4850
- else this.overwrite(match.index, match.index + match[0].length, replacement);
4849
+ if (match[0].length === 0) this.appendRight(match.index - this.offset, replacement);
4850
+ else this.overwrite(match.index - this.offset, match.index + match[0].length - this.offset, replacement);
4851
4851
  return true;
4852
4852
  };
4853
4853
  if (searchValue.global) {
@@ -4874,8 +4874,8 @@ var MagicString = class MagicString {
4874
4874
  if (typeof replacement === "function") replacement = replacement(string, index, original);
4875
4875
  else replacement = expandReplacement(replacement, string, index, original, [], void 0);
4876
4876
  if (string !== replacement) {
4877
- if (string.length === 0) this.appendRight(index, replacement);
4878
- else this.overwrite(index, index + string.length, replacement);
4877
+ if (string.length === 0) this.appendRight(index - this.offset, replacement);
4878
+ else this.overwrite(index - this.offset, index + string.length - this.offset, replacement);
4879
4879
  }
4880
4880
  break;
4881
4881
  }
@@ -4896,7 +4896,7 @@ var MagicString = class MagicString {
4896
4896
  for (let index = 0; index <= original.length; index += 1) {
4897
4897
  if (this._hasRemovedContent(index, index)) continue;
4898
4898
  const _replacement = typeof replacement === "function" ? replacement("", index, original) : expandReplacement(replacement, "", index, original, [], void 0);
4899
- if (_replacement !== "") this.appendRight(index, _replacement);
4899
+ if (_replacement !== "") this.appendRight(index - this.offset, _replacement);
4900
4900
  }
4901
4901
  return this;
4902
4902
  }
@@ -4904,7 +4904,7 @@ var MagicString = class MagicString {
4904
4904
  if (this._hasRemovedContent(index, index + stringLength)) continue;
4905
4905
  const previous = original.slice(index, index + stringLength);
4906
4906
  const _replacement = typeof replacement === "function" ? replacement(previous, index, original) : expandReplacement(replacement, previous, index, original, [], void 0);
4907
- if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
4907
+ if (previous !== _replacement) this.overwrite(index - this.offset, index + stringLength - this.offset, _replacement);
4908
4908
  }
4909
4909
  return this;
4910
4910
  }
@@ -6470,7 +6470,7 @@ var WorkerWithFallback = class {
6470
6470
  //#endregion
6471
6471
  //#region ../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js
6472
6472
  var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6473
- const path$7 = __require("path");
6473
+ const path$8 = __require("path");
6474
6474
  const fs$7 = __require("fs");
6475
6475
  const os$3 = __require("os");
6476
6476
  const url$2 = __require("url");
@@ -6503,7 +6503,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6503
6503
  * And on Windows, this will never happen. ('C:\build' -> 'C:')
6504
6504
  */
6505
6505
  function parentDir(p) {
6506
- return path$7.dirname(p) || path$7.sep;
6506
+ return path$8.dirname(p) || path$8.sep;
6507
6507
  }
6508
6508
  /** @type {import('./index').LoaderSync} */
6509
6509
  const jsonLoader = (_, content) => JSON.parse(content);
@@ -6563,7 +6563,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6563
6563
  }
6564
6564
  };
6565
6565
  conf.searchPlaces.forEach((place) => {
6566
- const key = path$7.extname(place) || "noExt";
6566
+ const key = path$8.extname(place) || "noExt";
6567
6567
  const loader = conf.loaders[key];
6568
6568
  if (!loader) throw new Error(`Missing loader for extension "${place}"`);
6569
6569
  if (typeof loader !== "function") throw new Error(`Loader for extension "${place}" is not a function: Received ${typeof loader}.`);
@@ -6615,14 +6615,14 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6615
6615
  visited.add(dir);
6616
6616
  }
6617
6617
  for (const searchPlace of searchPlaces) {
6618
- const filepath = path$7.join(dir, searchPlace);
6618
+ const filepath = path$8.join(dir, searchPlace);
6619
6619
  try {
6620
6620
  await fs$7.promises.access(filepath);
6621
6621
  } catch {
6622
6622
  continue;
6623
6623
  }
6624
6624
  const content = String(await fsReadFileAsync(filepath));
6625
- const loaderKey = path$7.extname(searchPlace) || "noExt";
6625
+ const loaderKey = path$8.extname(searchPlace) || "noExt";
6626
6626
  const loader = loaders[loaderKey];
6627
6627
  if (searchPlace === "package.json") {
6628
6628
  const pkg = await loader(filepath, content);
@@ -6655,9 +6655,9 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6655
6655
  },
6656
6656
  async load(filepath) {
6657
6657
  validateFilePath(filepath);
6658
- const absPath = path$7.resolve(process.cwd(), filepath);
6658
+ const absPath = path$8.resolve(process.cwd(), filepath);
6659
6659
  if (cache && loadCache.has(absPath)) return loadCache.get(absPath);
6660
- const { base, ext } = path$7.parse(absPath);
6660
+ const { base, ext } = path$8.parse(absPath);
6661
6661
  const loaderKey = ext || "noExt";
6662
6662
  const loader = loaders[loaderKey];
6663
6663
  validateLoader(loader, loaderKey);
@@ -6727,13 +6727,13 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6727
6727
  visited.add(dir);
6728
6728
  }
6729
6729
  for (const searchPlace of searchPlaces) {
6730
- const filepath = path$7.join(dir, searchPlace);
6730
+ const filepath = path$8.join(dir, searchPlace);
6731
6731
  try {
6732
6732
  fs$7.accessSync(filepath);
6733
6733
  } catch {
6734
6734
  continue;
6735
6735
  }
6736
- const loaderKey = path$7.extname(searchPlace) || "noExt";
6736
+ const loaderKey = path$8.extname(searchPlace) || "noExt";
6737
6737
  const loader = loaders[loaderKey];
6738
6738
  const content = String(fs$7.readFileSync(filepath));
6739
6739
  if (searchPlace === "package.json") {
@@ -6767,9 +6767,9 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6767
6767
  },
6768
6768
  load(filepath) {
6769
6769
  validateFilePath(filepath);
6770
- const absPath = path$7.resolve(process.cwd(), filepath);
6770
+ const absPath = path$8.resolve(process.cwd(), filepath);
6771
6771
  if (cache && loadCache.has(absPath)) return loadCache.get(absPath);
6772
- const { base, ext } = path$7.parse(absPath);
6772
+ const { base, ext } = path$8.parse(absPath);
6773
6773
  const loaderKey = ext || "noExt";
6774
6774
  const loader = loaders[loaderKey];
6775
6775
  validateLoader(loader, loaderKey);
@@ -6814,7 +6814,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6814
6814
  };
6815
6815
  }));
6816
6816
  //#endregion
6817
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.15_yaml@2.9.0/node_modules/postcss-load-config/src/req.js
6817
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.29_tsx@4.23.15_yaml@2.9.1/node_modules/postcss-load-config/src/req.js
6818
6818
  var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6819
6819
  const { createRequire: createRequire$1 } = __require("node:module");
6820
6820
  const { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1 } = __require("node:url");
@@ -6856,7 +6856,7 @@ var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6856
6856
  module.exports = req;
6857
6857
  }));
6858
6858
  //#endregion
6859
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.15_yaml@2.9.0/node_modules/postcss-load-config/src/options.js
6859
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.29_tsx@4.23.15_yaml@2.9.1/node_modules/postcss-load-config/src/options.js
6860
6860
  var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6861
6861
  const req = require_req();
6862
6862
  /**
@@ -6890,7 +6890,7 @@ var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6890
6890
  module.exports = options;
6891
6891
  }));
6892
6892
  //#endregion
6893
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.15_yaml@2.9.0/node_modules/postcss-load-config/src/plugins.js
6893
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.29_tsx@4.23.15_yaml@2.9.1/node_modules/postcss-load-config/src/plugins.js
6894
6894
  var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6895
6895
  const req = require_req();
6896
6896
  /**
@@ -6944,7 +6944,7 @@ var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6944
6944
  module.exports = plugins;
6945
6945
  }));
6946
6946
  //#endregion
6947
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.15_yaml@2.9.0/node_modules/postcss-load-config/src/index.js
6947
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.29_tsx@4.23.15_yaml@2.9.1/node_modules/postcss-load-config/src/index.js
6948
6948
  var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6949
6949
  const { resolve: resolve$3 } = __require("node:path");
6950
6950
  const config = require_src$1();
@@ -7620,7 +7620,7 @@ function oxcPlugin(config) {
7620
7620
  ...jsxOptions,
7621
7621
  refresh: false
7622
7622
  };
7623
- if (jsxRefreshFilter?.(id) && !JS_TYPES_RE.test(cleanUrl(id))) result.lang = "js";
7623
+ if (jsxRefreshFilter?.(id) && !JS_TYPES_RE.test(id) && !JS_TYPES_RE.test(cleanUrl(id))) result.lang = "js";
7624
7624
  return result;
7625
7625
  };
7626
7626
  let server;
@@ -10967,10 +10967,10 @@ var require_binary_extensions = /* @__PURE__ */ __commonJSMin(((exports, module)
10967
10967
  //#endregion
10968
10968
  //#region ../../node_modules/.pnpm/is-binary-path@2.1.0/node_modules/is-binary-path/index.js
10969
10969
  var require_is_binary_path = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10970
- const path$6 = __require("path");
10970
+ const path$7 = __require("path");
10971
10971
  const binaryExtensions = require_binary_extensions();
10972
10972
  const extensions = new Set(binaryExtensions);
10973
- module.exports = (filePath) => extensions.has(path$6.extname(filePath).slice(1).toLowerCase());
10973
+ module.exports = (filePath) => extensions.has(path$7.extname(filePath).slice(1).toLowerCase());
10974
10974
  }));
10975
10975
  //#endregion
10976
10976
  //#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/constants.js
@@ -13842,18 +13842,29 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13842
13842
  })();
13843
13843
  }));
13844
13844
  //#endregion
13845
- //#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/quote.js
13845
+ //#region ../../node_modules/.pnpm/shell-quote@1.12.0/node_modules/shell-quote/quote.js
13846
13846
  var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13847
+ /** @import { ControlOperator } from './parse' */
13848
+ /** @type {ControlOperator['op'][]} */
13847
13849
  var OPS = [
13848
13850
  "||",
13849
13851
  "&&",
13852
+ ";;&",
13850
13853
  ";;",
13854
+ ";&",
13851
13855
  "|&",
13852
13856
  "<(",
13857
+ ">(",
13853
13858
  "<<<",
13859
+ "<<-",
13860
+ "<<",
13854
13861
  ">>",
13855
13862
  ">&",
13863
+ ">|",
13864
+ "&>>",
13865
+ "&>",
13856
13866
  "<&",
13867
+ "<>",
13857
13868
  "&",
13858
13869
  ";",
13859
13870
  "(",
@@ -13863,51 +13874,70 @@ var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13863
13874
  ">"
13864
13875
  ];
13865
13876
  var LINE_TERMINATORS = /[\n\r\u2028\u2029]/;
13866
- var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|]/g;
13877
+ var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|~]/g;
13878
+ /** @type {typeof import('./quote')} */
13867
13879
  module.exports = function quote(xs) {
13880
+ var sawComment = false;
13868
13881
  return xs.map(function(s) {
13882
+ if (sawComment && typeof s === "string" && LINE_TERMINATORS.test(s)) throw new TypeError("a token after a `comment` must not contain line terminators");
13869
13883
  if (s === "") return "''";
13870
13884
  if (s && typeof s === "object") {
13871
- if (s.op === "glob") {
13885
+ if ("op" in s && s.op === "glob") {
13872
13886
  if (typeof s.pattern !== "string") throw new TypeError("glob token requires a string `pattern`");
13873
13887
  if (LINE_TERMINATORS.test(s.pattern)) throw new TypeError("glob `pattern` must not contain line terminators");
13888
+ if (s.pattern === "") return "''";
13874
13889
  return s.pattern.replace(GLOB_SHELL_SPECIAL, "\\$&");
13875
13890
  }
13876
- if (typeof s.op === "string") {
13891
+ if ("op" in s && typeof s.op === "string") {
13877
13892
  if (OPS.indexOf(s.op) < 0) throw new TypeError("invalid `op` value: " + JSON.stringify(s.op));
13878
13893
  return s.op.replace(/[\s\S]/g, "\\$&");
13879
13894
  }
13880
- if (typeof s.comment === "string") {
13895
+ if ("comment" in s && typeof s.comment === "string") {
13881
13896
  if (LINE_TERMINATORS.test(s.comment)) throw new TypeError("`comment` must not contain line terminators");
13897
+ sawComment = true;
13882
13898
  return "#" + s.comment;
13883
13899
  }
13884
13900
  throw new TypeError("unrecognized object token shape");
13885
13901
  }
13886
- if (/["\s\\]/.test(s) && !/'/.test(s)) return "'" + s.replace(/(['])/g, "\\$1") + "'";
13887
- if (/["'\s]/.test(s)) return "\"" + s.replace(/(["\\$`!])/g, "\\$1") + "\"";
13888
- return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, "$1\\$2");
13902
+ if (/'/.test(s) && /!/.test(s)) return "'" + s.replace(/'/g, "'\"'\"'") + "'";
13903
+ if (/["\s\\]/.test(s) && !/'/.test(s)) return "'" + s + "'";
13904
+ if (/["'\s]/.test(s)) return "\"" + s.replace(/(["\\$`])/g, "\\$1") + "\"";
13905
+ return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g, "$1\\$2");
13889
13906
  }).join(" ");
13890
13907
  };
13891
13908
  }));
13892
13909
  //#endregion
13893
- //#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/parse.js
13910
+ //#region ../../node_modules/.pnpm/shell-quote@1.12.0/node_modules/shell-quote/parse.js
13894
13911
  var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13912
+ /**
13913
+ * @import {
13914
+ * ControlOperator,
13915
+ * Env,
13916
+ * GlobPattern,
13917
+ * ParseEntry,
13918
+ * } from './parse' */
13895
13919
  var CONTROL = "(?:" + [
13896
13920
  "\\|\\|",
13897
- "\\&\\&",
13898
- ";;",
13899
- "\\|\\&",
13921
+ "\\&(?:\\&|>>?)",
13922
+ ";;\\&?",
13923
+ "[;|]\\&",
13900
13924
  "\\<\\(",
13901
13925
  "\\<\\<\\<",
13926
+ "\\<\\<-",
13927
+ "\\<\\<(?!\\()",
13902
13928
  ">>",
13903
- ">\\&",
13904
- "<\\&",
13929
+ ">[&|(]",
13930
+ "<[&>]",
13905
13931
  "[&;()|<>]"
13906
13932
  ].join("|") + ")";
13907
13933
  var controlRE = new RegExp("^" + CONTROL + "$");
13908
13934
  var META = "|&;()<> \\t";
13909
- var SINGLE_QUOTE = "\"((\\\\\"|[^\"])*?)\"";
13910
- var DOUBLE_QUOTE = "'((\\\\'|[^'])*?)'";
13935
+ var SINGLE_QUOTE = "'([^']*?)'";
13936
+ var ANSI_C_BODY = "(?:\\\\[\\s\\S]|[^\\\\'])*?";
13937
+ var ANSI_C_QUOTE = "\\$'" + ANSI_C_BODY + "'";
13938
+ var ansiCAt = new RegExp("\\$'" + ANSI_C_BODY + "(?:(')|\\\\?$)", "g");
13939
+ var ANSI_C_LETTERS = "abeEfnrtv";
13940
+ var ANSI_C_CHARS = "\x07\b\x1B\x1B\f\n\r \v";
13911
13941
  var hash = /^#$/;
13912
13942
  var SQ = "'";
13913
13943
  var DQ = "\"";
@@ -13916,17 +13946,26 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13916
13946
  var mult = 4294967296;
13917
13947
  for (var i = 0; i < 4; i++) TOKEN += (mult * Math.random()).toString(16);
13918
13948
  var startsWithToken = new RegExp("^" + TOKEN);
13949
+ /**
13950
+ * @param {string} s
13951
+ * @param {RegExp} r
13952
+ */
13919
13953
  function matchAll(s, r) {
13920
13954
  var origIndex = r.lastIndex;
13921
13955
  var matches = [];
13922
13956
  var matchObj;
13923
13957
  while (matchObj = r.exec(s)) {
13924
- matches.push(matchObj);
13958
+ matches[matches.length] = matchObj;
13925
13959
  if (r.lastIndex === matchObj.index) r.lastIndex += 1;
13926
13960
  }
13927
13961
  r.lastIndex = origIndex;
13928
13962
  return matches;
13929
13963
  }
13964
+ /**
13965
+ * @param {Env} env
13966
+ * @param {string} pre
13967
+ * @param {string} key
13968
+ */
13930
13969
  function getVar(env, pre, key) {
13931
13970
  var r = typeof env === "function" ? env(key) : env[key];
13932
13971
  if (typeof r === "undefined" && key != "") r = "";
@@ -13934,11 +13973,51 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13934
13973
  if (typeof r === "object") return pre + TOKEN + JSON.stringify(r) + TOKEN;
13935
13974
  return pre + r;
13936
13975
  }
13976
+ var ansiCEscape = /\\([0-7]{1,3}|x[\dA-Fa-f]{1,2}|u[\dA-Fa-f]{1,4}|U[\dA-Fa-f]{1,8}|c(?:\\\\|[\s\S])|[abeEfnrtv\\'"?])/g;
13977
+ /**
13978
+ * @param {string} m
13979
+ * @param {string} escape
13980
+ */
13981
+ function expandAnsiCEscape(m, escape) {
13982
+ var kind = escape.charAt(0);
13983
+ if (kind === "c") {
13984
+ var ctrl = escape.charAt(1);
13985
+ return ctrl === "?" ? "" : String.fromCharCode(ctrl.charCodeAt(0) & 31);
13986
+ }
13987
+ if (kind === "x" || kind === "u" || kind === "U") {
13988
+ var cp = parseInt(escape.slice(1), 16);
13989
+ if (cp > 1114111) return m;
13990
+ return String.fromCharCode.apply(null, cp > 65535 ? [55232 + (cp >> 10), 56320 + (cp & 1023)] : [cp]);
13991
+ }
13992
+ if (kind >= "0" && kind <= "7") return String.fromCharCode(parseInt(escape, 8) & 255);
13993
+ var letter = ANSI_C_LETTERS.indexOf(escape);
13994
+ return letter < 0 ? escape : ANSI_C_CHARS.charAt(letter);
13995
+ }
13996
+ /** @param {string} body */
13997
+ function expandAnsiC(body) {
13998
+ return body.replace(ansiCEscape, expandAnsiCEscape).split("\0")[0];
13999
+ }
14000
+ /**
14001
+ * @param {string} s
14002
+ * @param {number} i
14003
+ */
14004
+ function closesAnsiC(s, i) {
14005
+ ansiCAt.lastIndex = i;
14006
+ return !!ansiCAt.exec(s)[1];
14007
+ }
14008
+ /**
14009
+ * @param {string} string
14010
+ * @param {Env} [env]
14011
+ * @param {{ escape?: string, splitUnquoted?: boolean | string }} [opts]
14012
+ * @returns {ParseEntry[]}
14013
+ */
13937
14014
  function parseInternal(string, env, opts) {
13938
14015
  if (!opts) opts = {};
13939
14016
  var BS = opts.escape || "\\";
13940
- var BAREWORD = "(\\" + BS + "['\"" + META + "]|[^\\s'\"" + META + "])+";
13941
- var matches = matchAll(string, new RegExp(["(" + CONTROL + ")", "(" + BAREWORD + "|" + SINGLE_QUOTE + "|" + DOUBLE_QUOTE + ")+"].join("|"), "g"));
14017
+ var ifs = opts.splitUnquoted === true ? " \n" : typeof opts.splitUnquoted === "string" ? opts.splitUnquoted : "";
14018
+ var BAREWORD = "(\\" + BS + "['\"$\\" + BS + META + "]|\\$\\$|\\$(?!" + ANSI_C_QUOTE.slice(2) + ")|[^\\s'\"$" + META + "])+";
14019
+ var DOUBLE_QUOTE = "\"(?:\\" + BS + "[\\s\\S]|[^\"\\" + BS + "])*\"";
14020
+ var matches = matchAll(string, new RegExp(["(" + CONTROL + ")", "(" + ANSI_C_QUOTE + "|" + BAREWORD + "|" + DOUBLE_QUOTE + "|" + SINGLE_QUOTE + ")+"].join("|"), "g"));
13942
14021
  if (matches.length === 0) return [];
13943
14022
  if (!env) env = {};
13944
14023
  var commented = false;
@@ -13946,27 +14025,41 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13946
14025
  var s = match[0];
13947
14026
  if (!s || commented) return;
13948
14027
  if (controlRE.test(s)) return { op: s };
14028
+ /** @type {string | boolean} */
13949
14029
  var quote = false;
13950
14030
  var esc = false;
13951
14031
  var out = "";
14032
+ /** @type {string[]} */
14033
+ var words = [];
14034
+ var sawQuote = false;
14035
+ /** @type {number | null} */
14036
+ var pendingNw = null;
13952
14037
  var isGlob = false;
14038
+ /** @type {number} */
13953
14039
  var i;
13954
14040
  function parseEnvVar() {
13955
14041
  i += 1;
14042
+ /** @type {number | RegExpMatchArray | null} */
13956
14043
  var varend;
14044
+ /** @type {string} */
13957
14045
  var varname;
13958
14046
  var char = s.charAt(i);
13959
14047
  if (char === "{") {
13960
14048
  i += 1;
13961
14049
  if (s.charAt(i) === "}") throw new Error("Bad substitution: " + s.slice(i - 2, i + 1));
13962
- varend = s.indexOf("}", i);
13963
- if (varend < 0) throw new Error("Bad substitution: " + s.slice(i));
14050
+ var depth = 1;
14051
+ varend = i;
14052
+ while (depth > 0 && varend < s.length) {
14053
+ if (s.charAt(varend) === "{" && s.charAt(varend - 1) === "$") depth += 1;
14054
+ else if (s.charAt(varend) === "}") depth -= 1;
14055
+ varend += 1;
14056
+ }
14057
+ if (depth !== 0) throw new Error("Bad substitution: " + s.slice(i));
14058
+ varend -= 1;
13964
14059
  varname = s.slice(i, varend);
13965
14060
  i = varend;
13966
- } else if (/[*@#?$!_-]/.test(char)) {
13967
- varname = char;
13968
- i += 1;
13969
- } else {
14061
+ } else if (/[*@#?$!-]/.test(char)) varname = char;
14062
+ else {
13970
14063
  var slicedFromI = s.slice(i);
13971
14064
  varend = slicedFromI.match(/[^\w\d_]/);
13972
14065
  if (!varend) {
@@ -13979,8 +14072,23 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13979
14072
  }
13980
14073
  return getVar(env, "", varname);
13981
14074
  }
14075
+ function flushRun() {
14076
+ if (pendingNw === null) return;
14077
+ if (pendingNw === 0) {
14078
+ if (out !== "") {
14079
+ words[words.length] = out;
14080
+ out = "";
14081
+ }
14082
+ } else {
14083
+ words[words.length] = out;
14084
+ out = "";
14085
+ for (var fe = 1; fe < pendingNw; fe += 1) words[words.length] = "";
14086
+ }
14087
+ pendingNw = null;
14088
+ }
13982
14089
  for (i = 0; i < s.length; i++) {
13983
14090
  var c = s.charAt(i);
14091
+ if (ifs && c !== DS) flushRun();
13984
14092
  isGlob = isGlob || !quote && (c === "*" || c === "?");
13985
14093
  if (esc) {
13986
14094
  out += c;
@@ -13995,48 +14103,85 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13995
14103
  else out += BS + c;
13996
14104
  } else if (c === DS) out += parseEnvVar();
13997
14105
  else out += c;
13998
- } else if (c === DQ || c === SQ) quote = c;
13999
- else if (controlRE.test(c)) return { op: s };
14106
+ } else if (c === DQ || c === SQ) {
14107
+ quote = c;
14108
+ sawQuote = true;
14109
+ } else if (controlRE.test(c)) return { op: s };
14000
14110
  else if (hash.test(c)) {
14001
14111
  commented = true;
14002
14112
  var commentObj = { comment: string.slice(match.index + i + 1) };
14003
14113
  if (out.length) return [out, commentObj];
14004
14114
  return [commentObj];
14005
14115
  } else if (c === BS) esc = true;
14006
- else if (c === DS) out += parseEnvVar();
14007
- else out += c;
14116
+ else if (c === DS && s.charAt(i + 1) === SQ && closesAnsiC(s, i)) {
14117
+ flushRun();
14118
+ sawQuote = true;
14119
+ out += expandAnsiC(s.slice(i + 2, ansiCAt.lastIndex - 1));
14120
+ i = ansiCAt.lastIndex - 1;
14121
+ } else if (c === DS) {
14122
+ var value = parseEnvVar();
14123
+ if (!ifs) out += value;
14124
+ else for (var vi = 0; vi < value.length; vi += 1) {
14125
+ var vc = value.charAt(vi);
14126
+ if (ifs.indexOf(vc) < 0) {
14127
+ flushRun();
14128
+ out += vc;
14129
+ } else if (pendingNw === null) pendingNw = vc === " " || vc === " " || vc === "\n" ? 0 : 1;
14130
+ else if (vc !== " " && vc !== " " && vc !== "\n") pendingNw += 1;
14131
+ }
14132
+ } else out += c;
14008
14133
  }
14009
14134
  if (isGlob) return {
14010
14135
  op: "glob",
14011
14136
  pattern: out
14012
14137
  };
14138
+ if (ifs) {
14139
+ if (pendingNw !== null && pendingNw > 0) {
14140
+ words[words.length] = out;
14141
+ out = "";
14142
+ for (var te = 1; te < pendingNw; te += 1) words[words.length] = "";
14143
+ }
14144
+ if (out !== "" || sawQuote && words.length === 0) words[words.length] = out;
14145
+ return words;
14146
+ }
14013
14147
  return out;
14014
14148
  }).reduce(function(prev, arg) {
14015
- return typeof arg === "undefined" ? prev : prev.concat(arg);
14149
+ if (typeof arg === "undefined") return prev;
14150
+ /** @type {ParseEntry[]} */ [].concat(arg).forEach(function(entry) {
14151
+ prev[prev.length] = entry;
14152
+ });
14153
+ return prev;
14016
14154
  }, []);
14017
14155
  }
14156
+ /** @type {typeof import('./parse')} */
14018
14157
  module.exports = function parse(s, env, opts) {
14019
14158
  var mapped = parseInternal(s, env, opts);
14020
14159
  if (typeof env !== "function") return mapped;
14021
14160
  return mapped.reduce(function(acc, s) {
14022
- if (typeof s === "object") return acc.concat(s);
14161
+ if (typeof s === "object") {
14162
+ acc[acc.length] = s;
14163
+ return acc;
14164
+ }
14023
14165
  var xs = s.split(RegExp("(" + TOKEN + ".*?" + TOKEN + ")", "g"));
14024
- if (xs.length === 1) return acc.concat(xs[0]);
14025
- return acc.concat(xs.filter(Boolean).map(function(x) {
14026
- if (startsWithToken.test(x)) return JSON.parse(x.split(TOKEN)[1]);
14027
- return x;
14028
- }));
14166
+ if (xs.length === 1) {
14167
+ acc[acc.length] = xs[0];
14168
+ return acc;
14169
+ }
14170
+ xs.filter(Boolean).forEach(function(x) {
14171
+ acc[acc.length] = startsWithToken.test(x) ? JSON.parse(x.split(TOKEN)[1]) : x;
14172
+ });
14173
+ return acc;
14029
14174
  }, []);
14030
14175
  };
14031
14176
  }));
14032
14177
  //#endregion
14033
- //#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/index.js
14178
+ //#region ../../node_modules/.pnpm/shell-quote@1.12.0/node_modules/shell-quote/index.js
14034
14179
  var require_shell_quote = /* @__PURE__ */ __commonJSMin(((exports) => {
14035
14180
  exports.quote = require_quote();
14036
14181
  exports.parse = require_parse();
14037
14182
  }));
14038
14183
  //#endregion
14039
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/macos.js
14184
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/editor-info/macos.js
14040
14185
  var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14041
14186
  module.exports = {
14042
14187
  "/Applications/Atom.app/Contents/MacOS/Atom": "atom",
@@ -14071,7 +14216,7 @@ var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14071
14216
  };
14072
14217
  }));
14073
14218
  //#endregion
14074
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/linux.js
14219
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/editor-info/linux.js
14075
14220
  var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14076
14221
  module.exports = {
14077
14222
  atom: "atom",
@@ -14105,7 +14250,7 @@ var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14105
14250
  };
14106
14251
  }));
14107
14252
  //#endregion
14108
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/windows.js
14253
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/editor-info/windows.js
14109
14254
  var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14110
14255
  module.exports = [
14111
14256
  "Brackets.exe",
@@ -14138,9 +14283,9 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14138
14283
  ];
14139
14284
  }));
14140
14285
  //#endregion
14141
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/guess.js
14286
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/guess.js
14142
14287
  var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14143
- const path$5 = __require("path");
14288
+ const path$6 = __require("path");
14144
14289
  const shellQuote = require_shell_quote();
14145
14290
  const childProcess$2 = __require("child_process");
14146
14291
  const COMMON_EDITORS_MACOS = require_macos();
@@ -14164,7 +14309,7 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14164
14309
  const runningProcesses = output.split("\r\n");
14165
14310
  for (let i = 0; i < runningProcesses.length; i++) {
14166
14311
  const fullProcessPath = runningProcesses[i].trim();
14167
- const shortProcessName = path$5.win32.basename(fullProcessPath);
14312
+ const shortProcessName = path$6.win32.basename(fullProcessPath);
14168
14313
  if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) return fullProcessPath;
14169
14314
  }
14170
14315
  }
@@ -14213,11 +14358,15 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14213
14358
  module.exports.getEditorFromLinuxProcesses = getEditorFromLinuxProcesses;
14214
14359
  }));
14215
14360
  //#endregion
14216
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/get-args.js
14361
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/get-args.js
14217
14362
  var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14218
- const path$4 = __require("path");
14219
- module.exports = function getArgumentsForPosition(editor, fileName, lineNumber, columnNumber = 1) {
14220
- switch (path$4.basename(editor).replace(/\.(exe|cmd|bat)$/i, "")) {
14363
+ const os$1 = __require("os");
14364
+ const path$5 = __require("path");
14365
+ module.exports = function getArgumentsForFile(editor, fileName, lineNumber, columnNumber = 1) {
14366
+ fileName = path$5.resolve(fileName);
14367
+ if (process.platform === "linux" && fileName.startsWith("/mnt/") && /Microsoft/i.test(os$1.release())) fileName = `./${path$5.relative("", fileName)}`;
14368
+ if (!lineNumber) return [fileName];
14369
+ switch (path$5.basename(editor).replace(/\.(exe|cmd|bat)$/i, "")) {
14221
14370
  case "atom":
14222
14371
  case "Atom":
14223
14372
  case "Atom Beta":
@@ -14292,7 +14441,42 @@ var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14292
14441
  };
14293
14442
  }));
14294
14443
  //#endregion
14295
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/index.js
14444
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/construct-windows-launch-command.js
14445
+ var require_construct_windows_launch_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14446
+ function escapeCmdArgs(cmdArgs) {
14447
+ return cmdArgs.replace(/([&|<>,;=^])/g, "^$1");
14448
+ }
14449
+ function doubleQuoteIfNeeded(str) {
14450
+ if (str.includes("^")) return `^"${str}^"`;
14451
+ else if (str.includes(" ")) return `"${str}"`;
14452
+ return str;
14453
+ }
14454
+ function constructWindowsLaunchCommand(editor, args) {
14455
+ if (args.some((arg) => /[\r\n]/.test(arg))) throw new Error("Cannot launch an editor with an argument containing a line break");
14456
+ if (args.some((arg) => arg.includes("%"))) throw new Error("Cannot launch an editor with an argument containing \"%\"");
14457
+ return [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(" ");
14458
+ }
14459
+ module.exports = constructWindowsLaunchCommand;
14460
+ }));
14461
+ //#endregion
14462
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/parse-file.js
14463
+ var require_parse_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14464
+ const path$4 = __require("path");
14465
+ const positionRE = /:(\d+)(:(\d+))?$/;
14466
+ module.exports = function parseFile(file) {
14467
+ if (file.startsWith("file://")) file = __require("url").fileURLToPath(file);
14468
+ const unresolvedFileName = file.replace(positionRE, "");
14469
+ const fileName = unresolvedFileName ? path$4.resolve(unresolvedFileName) : "";
14470
+ const match = file.match(positionRE);
14471
+ return {
14472
+ fileName,
14473
+ lineNumber: match && match[1],
14474
+ columnNumber: match && match[3]
14475
+ };
14476
+ };
14477
+ }));
14478
+ //#endregion
14479
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/index.js
14296
14480
  var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14297
14481
  /**
14298
14482
  * Copyright (c) 2015-present, Facebook, Inc.
@@ -14304,12 +14488,13 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
14304
14488
  * Modified by Yuxi Evan You
14305
14489
  */
14306
14490
  const fs$2 = __require("fs");
14307
- const os$1 = __require("os");
14308
14491
  const path$3 = __require("path");
14309
14492
  const colors = require_picocolors();
14310
14493
  const childProcess$1 = __require("child_process");
14311
14494
  const guessEditor = require_guess();
14312
- const getArgumentsForPosition = require_get_args();
14495
+ const getArgumentsForFile = require_get_args();
14496
+ const constructWindowsLaunchCommand = require_construct_windows_launch_command();
14497
+ const parseFile = require_parse_file();
14313
14498
  function wrapErrorCallback(cb) {
14314
14499
  return (fileName, errorMessage) => {
14315
14500
  console.log();
@@ -14330,55 +14515,36 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
14330
14515
  }
14331
14516
  return false;
14332
14517
  }
14333
- const positionRE = /:(\d+)(:(\d+))?$/;
14334
- function parseFile(file) {
14335
- if (file.startsWith("file://")) file = __require("url").fileURLToPath(file);
14336
- const fileName = file.replace(positionRE, "");
14337
- const match = file.match(positionRE);
14338
- return {
14339
- fileName,
14340
- lineNumber: match && match[1],
14341
- columnNumber: match && match[3]
14342
- };
14343
- }
14344
14518
  let currentChildProcess = null;
14345
14519
  function launchEditor(file, specifiedEditor, onErrorCallback) {
14346
- const parsed = parseFile(file);
14347
- let { fileName } = parsed;
14348
- const { lineNumber, columnNumber } = parsed;
14349
- if (process.platform === "win32" && path$3.resolve(fileName).startsWith("\\\\")) return onErrorCallback(fileName, "UNC paths are not supported on Windows to avoid security issues. See https://github.com/vitejs/launch-editor/tree/main/packages/launch-editor#unc-paths-on-windows for details.");
14350
- if (!fs$2.existsSync(fileName)) return;
14520
+ const { fileName, lineNumber, columnNumber } = parseFile(file);
14351
14521
  if (typeof specifiedEditor === "function") {
14352
14522
  onErrorCallback = specifiedEditor;
14353
14523
  specifiedEditor = void 0;
14354
14524
  }
14355
14525
  onErrorCallback = wrapErrorCallback(onErrorCallback);
14526
+ if (process.platform === "win32" && fileName.startsWith("\\\\")) return onErrorCallback(fileName, "UNC paths are not supported on Windows to avoid security issues. See https://github.com/vitejs/launch-editor/tree/main/packages/launch-editor#unc-paths-on-windows for details.");
14527
+ if (!fs$2.existsSync(fileName)) return;
14356
14528
  const [editor, ...args] = guessEditor(specifiedEditor);
14357
14529
  if (!editor) {
14358
14530
  onErrorCallback(fileName, null);
14359
14531
  return;
14360
14532
  }
14361
- if (process.platform === "linux" && fileName.startsWith("/mnt/") && /Microsoft/i.test(os$1.release())) fileName = path$3.relative("", fileName);
14362
- if (lineNumber) {
14363
- const extraArgs = getArgumentsForPosition(editor, fileName, lineNumber, columnNumber);
14364
- args.push.apply(args, extraArgs);
14365
- } else args.push(fileName);
14533
+ const extraArgs = getArgumentsForFile(editor, fileName, lineNumber, columnNumber);
14534
+ args.push.apply(args, extraArgs);
14535
+ let launchCommand;
14536
+ if (process.platform === "win32") try {
14537
+ launchCommand = constructWindowsLaunchCommand(editor, args);
14538
+ } catch (error) {
14539
+ onErrorCallback(fileName, error.message);
14540
+ return;
14541
+ }
14366
14542
  if (currentChildProcess && isTerminalEditor(editor)) currentChildProcess.kill("SIGKILL");
14367
- if (process.platform === "win32") {
14368
- function escapeCmdArgs(cmdArgs) {
14369
- return cmdArgs.replace(/([&|<>,;=^])/g, "^$1");
14370
- }
14371
- function doubleQuoteIfNeeded(str) {
14372
- if (str.includes("^")) return `^"${str}^"`;
14373
- else if (str.includes(" ")) return `"${str}"`;
14374
- return str;
14375
- }
14376
- const launchCommand = [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(" ");
14377
- currentChildProcess = childProcess$1.exec(launchCommand, {
14378
- stdio: "inherit",
14379
- shell: true
14380
- });
14381
- } else currentChildProcess = childProcess$1.spawn(editor, args, { stdio: "inherit" });
14543
+ if (process.platform === "win32") currentChildProcess = childProcess$1.exec(launchCommand, {
14544
+ stdio: "inherit",
14545
+ shell: true
14546
+ });
14547
+ else currentChildProcess = childProcess$1.spawn(editor, args, { stdio: "inherit" });
14382
14548
  currentChildProcess.on("exit", function(errorCode) {
14383
14549
  currentChildProcess = null;
14384
14550
  if (errorCode) onErrorCallback(fileName, "(code " + errorCode + ")");
@@ -14392,7 +14558,7 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
14392
14558
  module.exports = launchEditor;
14393
14559
  }));
14394
14560
  //#endregion
14395
- //#region ../../node_modules/.pnpm/launch-editor-middleware@2.14.1/node_modules/launch-editor-middleware/index.js
14561
+ //#region ../../node_modules/.pnpm/launch-editor-middleware@2.14.2/node_modules/launch-editor-middleware/index.js
14396
14562
  var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14397
14563
  const path$2 = __require("path");
14398
14564
  const launch = require_launch_editor();
@@ -17134,9 +17300,10 @@ async function createClientConfigValueReplacer(config) {
17134
17300
  const hmrTimeoutReplacement = escapeReplacement(timeout);
17135
17301
  const hmrEnableOverlayReplacement = escapeReplacement(overlay);
17136
17302
  const hmrConfigNameReplacement = escapeReplacement(hmrConfigName);
17303
+ const hmrPartialAcceptReplacement = escapeReplacement(config.experimental.hmrPartialAccept);
17137
17304
  const wsTokenReplacement = escapeReplacement(config.webSocketToken);
17138
17305
  const serverForwardConsoleReplacement = escapeReplacement(config.server.forwardConsole);
17139
- return (code) => code.replace(`__MODE__`, modeReplacement).replace(/__BASE__/g, baseReplacement).replace(`__SERVER_HOST__`, serverHostReplacement).replace(`__HMR_PROTOCOL__`, hmrProtocolReplacement).replace(`__HMR_HOSTNAME__`, hmrHostnameReplacement).replace(`__HMR_PORT__`, hmrPortReplacement).replace(`__HMR_DIRECT_TARGET__`, hmrDirectTargetReplacement).replace(`__HMR_BASE__`, hmrBaseReplacement).replace(`__HMR_TIMEOUT__`, hmrTimeoutReplacement).replace(`__HMR_ENABLE_OVERLAY__`, hmrEnableOverlayReplacement).replace(`__HMR_CONFIG_NAME__`, hmrConfigNameReplacement).replace(`__WS_TOKEN__`, wsTokenReplacement).replace(`__SERVER_FORWARD_CONSOLE__`, serverForwardConsoleReplacement);
17306
+ return (code) => code.replace(`__MODE__`, modeReplacement).replace(/__BASE__/g, baseReplacement).replace(`__SERVER_HOST__`, serverHostReplacement).replace(`__HMR_PROTOCOL__`, hmrProtocolReplacement).replace(`__HMR_HOSTNAME__`, hmrHostnameReplacement).replace(`__HMR_PORT__`, hmrPortReplacement).replace(`__HMR_DIRECT_TARGET__`, hmrDirectTargetReplacement).replace(`__HMR_BASE__`, hmrBaseReplacement).replace(`__HMR_TIMEOUT__`, hmrTimeoutReplacement).replace(`__HMR_ENABLE_OVERLAY__`, hmrEnableOverlayReplacement).replace(`__HMR_CONFIG_NAME__`, hmrConfigNameReplacement).replace(`__HMR_PARTIAL_ACCEPT__`, hmrPartialAcceptReplacement).replace(`__WS_TOKEN__`, wsTokenReplacement).replace(`__SERVER_FORWARD_CONSOLE__`, serverForwardConsoleReplacement);
17140
17307
  }
17141
17308
  const ROLLDOWN_DEV_RUNTIME_ENTRY = "rolldown/experimental/runtime";
17142
17309
  async function getHmrImplementation(config) {
@@ -17159,6 +17326,34 @@ function getRolldownDevRuntimeFiles() {
17159
17326
  if (!files.has(`@rolldown/${path.basename(entry)}`)) throw new Error(`rolldown dev runtime entry ${entry} was not found`);
17160
17327
  return files;
17161
17328
  }
17329
+ function getBundledDevClientAliases(config) {
17330
+ const clientUrl = path.posix.join(config.base, BUNDLED_DEV_CLIENT_FILENAME);
17331
+ return /* @__PURE__ */ new Map([[CLIENT_PUBLIC_PATH.slice(1), `export * from ${JSON.stringify(clientUrl)}`], [ENV_PUBLIC_PATH.slice(1), ""]]);
17332
+ }
17333
+ function bundledDevClientImportsPlugin(config) {
17334
+ const clientUrl = path.posix.join(config.base, BUNDLED_DEV_CLIENT_FILENAME);
17335
+ return {
17336
+ name: "vite:bundled-dev-client-imports",
17337
+ applyToEnvironment(environment) {
17338
+ return config.command === "serve" && environment.config.isBundled && environment.config.consumer === "client";
17339
+ },
17340
+ resolveId: {
17341
+ filter: { id: [exactRegex(clientUrl), exactRegex(path.posix.join(config.base, CLIENT_PUBLIC_PATH))] },
17342
+ handler() {
17343
+ return {
17344
+ id: clientUrl,
17345
+ external: true
17346
+ };
17347
+ }
17348
+ },
17349
+ load: {
17350
+ filter: { id: new RegExp(`^(?:${escapeRegex(normalizedClientEntry$1)}|${escapeRegex(normalizedEnvEntry$1)})(?:\\?.*)?$`) },
17351
+ handler(id) {
17352
+ return cleanUrl(id) === normalizedClientEntry$1 ? `export * from ${JSON.stringify(clientUrl)}` : "";
17353
+ }
17354
+ }
17355
+ };
17356
+ }
17162
17357
  //#endregion
17163
17358
  //#region ../../node_modules/.pnpm/convert-source-map@2.0.0/node_modules/convert-source-map/index.js
17164
17359
  var require_convert_source_map = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -17793,11 +17988,7 @@ function serveStaticMiddleware(server) {
17793
17988
  const url = new URL(req.url, "http://example.com");
17794
17989
  const pathname = decodeURIIfPossible(url.pathname);
17795
17990
  if (pathname === void 0) return next();
17796
- let redirectedPathname;
17797
- for (const { find, replacement } of server.config.resolve.alias) if (typeof find === "string" ? pathname.startsWith(find) : find.test(pathname)) {
17798
- redirectedPathname = pathname.replace(find, replacement);
17799
- break;
17800
- }
17991
+ let redirectedPathname = applyStaticAlias(pathname, server.config.resolve.alias);
17801
17992
  if (redirectedPathname) {
17802
17993
  if (redirectedPathname.startsWith(withTrailingSlash(dir))) redirectedPathname = redirectedPathname.slice(dir.length);
17803
17994
  }
@@ -17819,6 +18010,9 @@ function serveStaticMiddleware(server) {
17819
18010
  }
17820
18011
  };
17821
18012
  }
18013
+ function applyStaticAlias(pathname, aliases) {
18014
+ for (const { find, replacement } of aliases) if (typeof find === "string" ? pathname === find || pathname.startsWith(`${find}/`) : find.test(pathname)) return pathname.replace(find, replacement);
18015
+ }
17822
18016
  function serveRawFsMiddleware(server) {
17823
18017
  const serveFromRoot = build_default$1("/", sirvOptions({
17824
18018
  config: server.config,
@@ -17941,8 +18135,9 @@ function createDevHtmlTransformFn(config) {
17941
18135
  };
17942
18136
  }
17943
18137
  function getHtmlFilename(url, server) {
17944
- if (url.startsWith(FS_PREFIX)) return decodeURIComponent(fsPathFromId(url));
17945
- else return decodeURIComponent(normalizePath(path.join(server.config.root, url.slice(1))));
18138
+ const urlPath = cleanUrl(url);
18139
+ if (urlPath.startsWith(FS_PREFIX)) return decodeURIComponent(fsPathFromId(urlPath));
18140
+ else return decodeURIComponent(normalizePath(path.join(server.config.root, urlPath.slice(1))));
17946
18141
  }
17947
18142
  function shouldPreTransform(url, config) {
17948
18143
  return !checkPublicFile(url, config) && (isJSRequest(url) || isCSSRequest(url));
@@ -17954,6 +18149,7 @@ function isBareRelative(url) {
17954
18149
  function getHtmlDirnameForRelativeUrl(htmlPath) {
17955
18150
  return htmlPath.endsWith("/") ? htmlPath : path.posix.dirname(htmlPath);
17956
18151
  }
18152
+ const multipleLeadingSlashesRE = /^\/{2,}/g;
17957
18153
  const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, server, isClassicScriptLink) => {
17958
18154
  const replacer = (url) => {
17959
18155
  if (url[0] === "/" && url[1] !== "/" || (url[0] === "." || isBareRelative(url)) && originalUrl && originalUrl !== "/" && htmlPath === "/index.html") url = path.posix.join(config.base, url);
@@ -17979,13 +18175,15 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
17979
18175
  return useSrcSetReplacer ? processSrcSetSync(url, ({ url }) => replacer(url)) : replacer(url);
17980
18176
  };
17981
18177
  const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl }) => {
18178
+ if (htmlPath.startsWith("//")) htmlPath = htmlPath.replace(multipleLeadingSlashesRE, "/");
17982
18179
  const { config, watcher } = server;
17983
18180
  const base = config.base || "/";
17984
18181
  const decodedBase = config.decodedBase || "/";
17985
18182
  let proxyModulePath;
17986
18183
  let proxyModuleUrl;
17987
18184
  const trailingSlash = htmlPath.endsWith("/");
17988
- if (!trailingSlash && fs.existsSync(filename)) {
18185
+ if (!trailingSlash && tryStatSync(filename)?.isFile()) {
18186
+ ensureWatchedFile(watcher, filename, config.root);
17989
18187
  proxyModulePath = htmlPath.startsWith(FS_PREFIX) ? filename : htmlPath;
17990
18188
  proxyModuleUrl = htmlPath;
17991
18189
  } else {
@@ -18067,7 +18265,6 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
18067
18265
  await Promise.all([...styleUrl.map(async ({ start, end, code }, index) => {
18068
18266
  const url = `${proxyModulePath}?html-proxy&direct&index=${index}.css`;
18069
18267
  const mod = await server.environments.client.moduleGraph.ensureEntryFromUrl(url, false);
18070
- ensureWatchedFile(watcher, mod.file, config.root);
18071
18268
  const result = await server.environments.client.pluginContainer.transform(code, mod.id);
18072
18269
  let content = "";
18073
18270
  if (result.map && "version" in result.map) {
@@ -18078,7 +18275,6 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
18078
18275
  }), ...inlineStyles.map(async ({ index, location, code }) => {
18079
18276
  const url = `${proxyModulePath}?html-proxy&inline-css&style-attr&index=${index}.css`;
18080
18277
  const mod = await server.environments.client.moduleGraph.ensureEntryFromUrl(url, false);
18081
- ensureWatchedFile(watcher, mod.file, config.root);
18082
18278
  await server?.environments.client.pluginContainer.transform(code, mod.id);
18083
18279
  const hash = getHash(cleanUrl(mod.id));
18084
18280
  const result = htmlProxyResult.get(`${hash}_${index}`);
@@ -18246,7 +18442,7 @@ function memoryFilesMiddleware(server) {
18246
18442
  }
18247
18443
  res.setHeader("Etag", file.etag);
18248
18444
  }
18249
- const mime = lookup(filePath);
18445
+ const mime = file.contentType ?? lookup(filePath);
18250
18446
  if (mime) res.setHeader("Content-Type", mime);
18251
18447
  for (const name in headers) res.setHeader(name, headers[name]);
18252
18448
  return res.end(file.source);
@@ -20114,8 +20310,9 @@ const urlRE = /[?&]url\b/;
20114
20310
  const rawRE = /[?&]raw\b/;
20115
20311
  const inlineRE$3 = /[?&]inline\b/;
20116
20312
  const svgRE = /\.svg\b/;
20313
+ const wasmInstanceRE$1 = /[?&]vite-wasm-instance(?:&|$)/;
20117
20314
  function isServerAccessDeniedForTransform(config, id) {
20118
- if (rawRE.test(id) || urlRE.test(id) || inlineRE$3.test(id) || svgRE.test(id)) return checkLoadingAccess(config, cleanUrl(id)) !== "allowed" || checkLoadingAccess(config, id) !== "allowed";
20315
+ if (rawRE.test(id) || urlRE.test(id) || inlineRE$3.test(id) || svgRE.test(id) || wasmInstanceRE$1.test(id)) return checkLoadingAccess(config, cleanUrl(id)) !== "allowed" || checkLoadingAccess(config, id) !== "allowed";
20119
20316
  return false;
20120
20317
  }
20121
20318
  /**
@@ -24625,6 +24822,11 @@ function createServer$2(inlineConfig = {}) {
24625
24822
  }
24626
24823
  async function _createServer(inlineConfig = {}, options) {
24627
24824
  disableCache();
24825
+ const restartState = options.restartState ?? {
24826
+ promise: null,
24827
+ pending: false,
24828
+ forceOptimize: false
24829
+ };
24628
24830
  const config = isResolvedConfig(inlineConfig) ? inlineConfig : await resolveConfig(inlineConfig, "serve");
24629
24831
  if (usedConfigs.has(config)) throw new Error(`There is already a server associated with the config.`);
24630
24832
  if (config.command !== "serve") throw new Error(`Config was resolved for a "build", expected a "serve" command.`);
@@ -24788,14 +24990,24 @@ async function _createServer(inlineConfig = {}, options) {
24788
24990
  bindCLIShortcuts(server, options);
24789
24991
  },
24790
24992
  async restart(forceOptimize) {
24791
- if (!server._restartPromise) {
24792
- server._forceOptimizeOnRestart = !!forceOptimize;
24793
- server._restartPromise = restartServer(server).finally(() => {
24794
- server._restartPromise = null;
24795
- server._forceOptimizeOnRestart = false;
24796
- });
24993
+ restartState.forceOptimize ||= !!forceOptimize;
24994
+ if (restartState.promise) {
24995
+ restartState.pending = true;
24996
+ return restartState.promise;
24797
24997
  }
24798
- return server._restartPromise;
24998
+ restartState.promise = (async () => {
24999
+ try {
25000
+ do {
25001
+ restartState.pending = false;
25002
+ await restartServer(server, restartState);
25003
+ } while (restartState.pending);
25004
+ } finally {
25005
+ restartState.promise = null;
25006
+ restartState.pending = false;
25007
+ restartState.forceOptimize = false;
25008
+ }
25009
+ })();
25010
+ return restartState.promise;
24799
25011
  },
24800
25012
  waitForRequestsIdle(ignoredId) {
24801
25013
  return environments.client.waitForRequestsIdle(ignoredId);
@@ -24807,8 +25019,6 @@ async function _createServer(inlineConfig = {}, options) {
24807
25019
  if (!closeServerPromise) closeServerPromise = closeServer(reason);
24808
25020
  return closeServerPromise;
24809
25021
  },
24810
- _restartPromise: options.previousRestartPromise ?? null,
24811
- _forceOptimizeOnRestart: options.previousForceOptimizeOnRestart ?? false,
24812
25022
  _shortcutsState: options.previousShortcutsState
24813
25023
  };
24814
25024
  const reflexServer = new Proxy(server, {
@@ -25061,10 +25271,10 @@ async function resolveServerOptions(root, raw, logger) {
25061
25271
  }
25062
25272
  return server;
25063
25273
  }
25064
- async function restartServer(server) {
25274
+ async function restartServer(server, restartState) {
25065
25275
  global.__vite_start_time = performance$1.now();
25066
25276
  let inlineConfig = server.config.inlineConfig;
25067
- if (server._forceOptimizeOnRestart) inlineConfig = mergeConfig(inlineConfig, { forceOptimizeDeps: true });
25277
+ if (restartState.forceOptimize) inlineConfig = mergeConfig(inlineConfig, { forceOptimizeDeps: true });
25068
25278
  {
25069
25279
  let newServer = null;
25070
25280
  try {
@@ -25072,8 +25282,7 @@ async function restartServer(server) {
25072
25282
  listen: false,
25073
25283
  previousEnvironments: server.environments,
25074
25284
  previousShortcutsState: server._shortcutsState,
25075
- previousRestartPromise: server._restartPromise,
25076
- previousForceOptimizeOnRestart: server._forceOptimizeOnRestart
25285
+ restartState
25077
25286
  });
25078
25287
  } catch (err) {
25079
25288
  server.config.logger.error(err.message, { timestamp: true });
@@ -26491,8 +26700,8 @@ function importAnalysisPlugin(config) {
26491
26700
  if (specifier === clientPublicPath) return;
26492
26701
  if (specifier[0] === "/" && !(config.assetsInclude(cleanUrl(specifier)) || urlRE$1.test(specifier)) && checkPublicFile(specifier, config)) throw new Error(`Cannot import non-asset file ${specifier} which is inside /public. JS/CSS files inside /public are copied as-is on build and can only be referenced via <script src> or <link href> in html. If you want to get the URL of that file, use ${injectQuery(specifier, "url")} instead.`);
26493
26702
  let [url, resolvedId] = await normalizeUrl(specifier, start);
26703
+ if (resolvedId) config.safeModulePaths.add(cleanUrl(resolvedId));
26494
26704
  resolvedId = resolvedId || url;
26495
- config.safeModulePaths.add(fsPathFromUrl(stripBase(url, base)));
26496
26705
  if (url !== specifier) {
26497
26706
  let rewriteDone = false;
26498
26707
  if (!(depsOptimizer?.isOptimizedDepFile(importer) && specifier[0] === ".") && depsOptimizer?.isOptimizedDepFile(resolvedId) && !optimizedDepChunkRE.test(resolvedId)) {
@@ -26759,6 +26968,22 @@ function detectScriptRel() {
26759
26968
  const relList = typeof document !== "undefined" && document.createElement("link").relList;
26760
26969
  return relList && relList.supports && relList.supports("modulepreload") ? "modulepreload" : "preload";
26761
26970
  }
26971
+ function preloadOnce(seen, href, preload) {
26972
+ if (href in seen) return seen[href];
26973
+ const promise = preload();
26974
+ if (!promise) {
26975
+ seen[href] = void 0;
26976
+ return;
26977
+ }
26978
+ const preloadPromise = promise.then(() => {
26979
+ seen[href] = void 0;
26980
+ }, (err) => {
26981
+ seen[href] = void 0;
26982
+ throw err;
26983
+ });
26984
+ seen[href] = preloadPromise;
26985
+ return preloadPromise;
26986
+ }
26762
26987
  function preload(baseModule, deps, importerUrl) {
26763
26988
  let promise = Promise.resolve();
26764
26989
  if (__VITE_IS_MODERN__ && deps && deps.length > 0) {
@@ -26785,32 +27010,32 @@ function preload(baseModule, deps, importerUrl) {
26785
27010
  promise = allSettled(deps.map((depString) => {
26786
27011
  depString = assetsURL(depString, importerUrl);
26787
27012
  const dep = importMetaResolve(depString);
26788
- if (dep.href in seen) return;
26789
- seen[dep.href] = true;
26790
27013
  const isCss = isCssPreloadUrl(dep);
26791
- if (preloadedHrefs === void 0) {
26792
- preloadedHrefs = {
26793
- all: /* @__PURE__ */ new Set(),
26794
- styles: /* @__PURE__ */ new Set()
26795
- };
26796
- const links = document.getElementsByTagName("link");
26797
- for (let i = links.length - 1; i >= 0; i--) {
26798
- const link = links[i];
26799
- preloadedHrefs.all.add(link.href);
26800
- if (link.rel === "stylesheet") preloadedHrefs.styles.add(link.href);
26801
- }
26802
- }
26803
- if ((isCss ? preloadedHrefs.styles : preloadedHrefs.all).has(dep.href)) return;
26804
- const link = document.createElement("link");
26805
- link.rel = isCss ? "stylesheet" : scriptRel;
26806
- if (!isCss) link.as = "script";
26807
- link.crossOrigin = "";
26808
- link.href = dep.href;
26809
- if (cspNonce) link.setAttribute("nonce", cspNonce);
26810
- document.head.appendChild(link);
26811
- if (isCss) return new Promise((res, rej) => {
26812
- link.addEventListener("load", res);
26813
- link.addEventListener("error", () => rej(/* @__PURE__ */ new Error(`Unable to preload CSS for ${dep}`)));
27014
+ return preloadOnce(seen, dep.href, () => {
27015
+ if (preloadedHrefs === void 0) {
27016
+ preloadedHrefs = {
27017
+ all: /* @__PURE__ */ new Set(),
27018
+ styles: /* @__PURE__ */ new Set()
27019
+ };
27020
+ const links = document.getElementsByTagName("link");
27021
+ for (let i = links.length - 1; i >= 0; i--) {
27022
+ const link = links[i];
27023
+ preloadedHrefs.all.add(link.href);
27024
+ if (link.rel === "stylesheet") preloadedHrefs.styles.add(link.href);
27025
+ }
27026
+ }
27027
+ if ((isCss ? preloadedHrefs.styles : preloadedHrefs.all).has(dep.href)) return;
27028
+ const link = document.createElement("link");
27029
+ link.rel = isCss ? "stylesheet" : scriptRel;
27030
+ if (!isCss) link.as = "script";
27031
+ link.crossOrigin = "";
27032
+ link.href = dep.href;
27033
+ if (cspNonce) link.setAttribute("nonce", cspNonce);
27034
+ document.head.appendChild(link);
27035
+ if (isCss) return new Promise((res, rej) => {
27036
+ link.addEventListener("load", res);
27037
+ link.addEventListener("error", () => rej(/* @__PURE__ */ new Error(`Unable to preload CSS for ${dep}`)));
27038
+ });
26814
27039
  });
26815
27040
  }).filter((p) => p !== void 0));
26816
27041
  }
@@ -26833,7 +27058,7 @@ function getPreloadCode(environment, renderBuiltUrlBoolean, isRelativeBase) {
26833
27058
  const scriptRel = modulePreload && modulePreload.polyfill ? `'modulepreload'` : `/* @__PURE__ */ (${detectScriptRel.toString()})()`;
26834
27059
  const assetsURL = renderBuiltUrlBoolean || isRelativeBase ? `function(dep, importerUrl) { return new URL(dep, importerUrl).href }` : `function(dep) { return ${JSON.stringify(environment.config.base)}+dep }`;
26835
27060
  const preloadMethodCode = preload.toString().replaceAll("𝐢𝐦𝐩𝐨𝐫𝐭", "import");
26836
- return `const scriptRel = ${scriptRel};const assetsURL = ${assetsURL};const seen = {};const isCssPreloadUrl = ${isCssPreloadUrl.toString()};export const ${preloadMethod} = ${preloadMethodCode}`;
27061
+ return `const scriptRel = ${scriptRel};const assetsURL = ${assetsURL};const seen = {};const isCssPreloadUrl = ${isCssPreloadUrl.toString()};const preloadOnce = ${preloadOnce.toString()};export const ${preloadMethod} = ${preloadMethodCode}`;
26837
27062
  }
26838
27063
  /**
26839
27064
  * Build only. During serve this is performed as part of ./importAnalysis.
@@ -28071,9 +28296,10 @@ function rolldownScanPlugin(environment, depImports, missing, entries, jsxOption
28071
28296
  if (htmlTypesRE.test(id)) {
28072
28297
  const resolved = await resolve(id, importer);
28073
28298
  if (!resolved) return;
28074
- if (isInNodeModules(resolved) && isOptimizable(resolved, optimizeDepsOptions)) return;
28075
- if (shouldExternalizeDep(resolved, id)) return externalUnlessEntry({ path: id });
28076
- return resolved;
28299
+ if (!isInNodeModules(resolved) || !isOptimizable(resolved, optimizeDepsOptions)) {
28300
+ if (shouldExternalizeDep(resolved, id)) return externalUnlessEntry({ path: id });
28301
+ return resolved;
28302
+ }
28077
28303
  }
28078
28304
  if (/^[\w@][^:]/.test(id)) {
28079
28305
  if (moduleListContains(exclude, id)) return externalUnlessEntry({ path: id });
@@ -29759,7 +29985,7 @@ function cssPostPlugin(config) {
29759
29985
  const cssContent = await getContentWithSourcemap(css);
29760
29986
  return {
29761
29987
  code: [
29762
- this.environment.config.isBundled ? `const { updateStyle: __vite__updateStyle, removeStyle: __vite__removeStyle } = import.meta.hot._internal` : `import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from ${JSON.stringify(path.posix.join(config.base, CLIENT_PUBLIC_PATH))}`,
29988
+ `import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from ${JSON.stringify(path.posix.join(config.base, CLIENT_PUBLIC_PATH))}`,
29763
29989
  `const __vite__id = ${JSON.stringify(id)}`,
29764
29990
  `const __vite__css = ${JSON.stringify(cssContent)}`,
29765
29991
  `__vite__updateStyle(__vite__id, __vite__css)`,
@@ -31062,10 +31288,10 @@ async function compileLightningCSS(environment, id, src, deps, workerController,
31062
31288
  const code = fs.readFileSync(filePath, "utf-8");
31063
31289
  const lang = CSS_LANGS_RE.exec(filePath)?.[1];
31064
31290
  if (isPreProcessor(lang)) {
31065
- const result = await compileCSSPreprocessors(environment, id, lang, code, workerController);
31291
+ const result = await compileCSSPreprocessors(environment, filePath, lang, code, workerController);
31066
31292
  result.deps?.forEach((dep) => deps.add(dep));
31067
31293
  return result.code;
31068
- } else if (lang === "sss") return (await transformSugarSS(environment, id, code)).code;
31294
+ } else if (lang === "sss") return (await transformSugarSS(environment, filePath, code)).code;
31069
31295
  return code;
31070
31296
  },
31071
31297
  async resolve(id, from) {
@@ -31513,13 +31739,14 @@ function getCssFilesForChunk(chunk, bundle, analyzedImportedCssFiles, seenChunks
31513
31739
  }
31514
31740
  const allFiles = [];
31515
31741
  const filteredFiles = [];
31742
+ let complete = true;
31516
31743
  chunk.imports.forEach((file) => {
31517
31744
  const importee = bundle[file];
31518
31745
  if (importee?.type === "chunk") {
31519
31746
  const importeeCss = getCssFilesForChunk(importee, bundle, analyzedImportedCssFiles, seenChunks, seenCss);
31520
31747
  filteredFiles.push(...importeeCss);
31521
31748
  if (analyzedImportedCssFiles.has(importee)) allFiles.push(...analyzedImportedCssFiles.get(importee));
31522
- else allFiles.push(...importeeCss);
31749
+ else complete = false;
31523
31750
  }
31524
31751
  });
31525
31752
  chunk.viteMetadata.importedCss.forEach((file) => {
@@ -31529,7 +31756,7 @@ function getCssFilesForChunk(chunk, bundle, analyzedImportedCssFiles, seenChunks
31529
31756
  filteredFiles.push(file);
31530
31757
  }
31531
31758
  });
31532
- analyzedImportedCssFiles.set(chunk, unique(allFiles));
31759
+ if (complete) analyzedImportedCssFiles.set(chunk, unique(allFiles));
31533
31760
  return filteredFiles;
31534
31761
  }
31535
31762
  /**
@@ -32136,9 +32363,7 @@ function getImportMapFilename(options) {
32136
32363
  return "importmap.json";
32137
32364
  }
32138
32365
  function getImportMapBaseUrl(options) {
32139
- const chunkImportMap = options.build.rolldownOptions.experimental?.chunkImportMap;
32140
- if (typeof chunkImportMap === "object" && chunkImportMap.baseUrl) return chunkImportMap.baseUrl;
32141
- return "/";
32366
+ return options.base;
32142
32367
  }
32143
32368
  /**
32144
32369
  * Read and parse the chunk import map asset from the bundle.
@@ -33808,6 +34033,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
33808
34033
  },
33809
34034
  ...prePlugins,
33810
34035
  modulePreload !== false && modulePreload.polyfill ? modulePreloadPolyfillPlugin() : null,
34036
+ bundledDevClientImportsPlugin(config),
33811
34037
  ...oxcResolvePlugin({
33812
34038
  root: config.root,
33813
34039
  isProduction: config.isProduction,
@@ -36202,11 +36428,13 @@ var BundledDev = class {
36202
36428
  }
36203
36429
  async storeStaticFiles() {
36204
36430
  const sources = new Map([[BUNDLED_DEV_CLIENT_FILENAME, await getHmrImplementation(this.environment.getTopLevelConfig())], ...getRolldownDevRuntimeFiles()]);
36431
+ const aliases = getBundledDevClientAliases(this.environment.getTopLevelConfig());
36205
36432
  this.staticFiles.clear();
36206
- for (const [fileName, source] of sources) {
36433
+ for (const [fileName, source] of [...sources, ...aliases]) {
36207
36434
  const file = {
36208
36435
  source,
36209
- etag: (0, import_etag.default)(Buffer.from(source), { weak: true })
36436
+ etag: (0, import_etag.default)(Buffer.from(source), { weak: true }),
36437
+ ...aliases.has(fileName) ? { contentType: "text/javascript" } : {}
36210
36438
  };
36211
36439
  this.staticFiles.set(fileName, file);
36212
36440
  this.memoryFiles.set(fileName, file);
@@ -37124,19 +37352,6 @@ const configDefaults = Object.freeze({
37124
37352
  environments: {},
37125
37353
  appType: "spa"
37126
37354
  });
37127
- function normalizeInput(input) {
37128
- if (input === void 0) return;
37129
- if (typeof input === "string") return unescapeGlobCharacters(input);
37130
- if (Array.isArray(input)) return input.map(unescapeGlobCharacters);
37131
- const resolved = {};
37132
- for (const key in input) resolved[key] = unescapeGlobCharacters(input[key]);
37133
- return resolved;
37134
- }
37135
- const escapedGlobCharactersRE = /\\([*?[\]{}()!+@|])/g;
37136
- function unescapeGlobCharacters(value) {
37137
- if (isDynamicPattern(value)) throw new Error(`\`input\` cannot contain glob characters. They are reserved, so the ${JSON.stringify(value)} is not allowed. Please escape them with a backslash (\\)`);
37138
- return value.replace(escapedGlobCharactersRE, "$1");
37139
- }
37140
37355
  function resolveDevEnvironmentOptions(dev, environmentName, consumer, preTransformRequest) {
37141
37356
  const resolved = mergeWithDefaults({
37142
37357
  ...configDefaults.dev,
@@ -37165,7 +37380,7 @@ function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimi
37165
37380
  }
37166
37381
  const resolve = resolveEnvironmentResolveOptions(options.resolve, alias, preserveSymlinks, logger, consumer, isSsrTargetWebworkerEnvironment);
37167
37382
  return {
37168
- input: normalizeInput(options.input),
37383
+ input: options.input,
37169
37384
  define: options.define,
37170
37385
  resolve,
37171
37386
  keepProcessEnv: options.keepProcessEnv ?? (isSsrTargetWebworkerEnvironment ? false : consumer === "server"),
@@ -37466,7 +37681,6 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
37466
37681
  const assetsFilter = config.assetsInclude && (!Array.isArray(config.assetsInclude) || config.assetsInclude.length) ? createFilter$1(config.assetsInclude) : () => false;
37467
37682
  const { publicDir } = config;
37468
37683
  const resolvedPublicDir = publicDir !== false && publicDir !== "" ? normalizePath(path.resolve(resolvedRoot, typeof publicDir === "string" ? publicDir : configDefaults.publicDir)) : "";
37469
- const input = normalizeInput(config.input);
37470
37684
  const server = await resolveServerOptions(resolvedRoot, config.server, logger);
37471
37685
  const builder = resolveBuilderOptions(config.builder);
37472
37686
  const BASE_URL = resolvedBase;
@@ -37593,7 +37807,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
37593
37807
  removeSsrLoadModule: "warn"
37594
37808
  } : config.future,
37595
37809
  ssr,
37596
- input,
37810
+ input: config.input,
37597
37811
  optimizeDeps: backwardCompatibleOptimizeDeps,
37598
37812
  resolve: resolvedDefaultResolve,
37599
37813
  dev: resolvedDevEnvironmentOptions,