vite 8.3.2 → 8.3.3

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.
@@ -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.3";
653
653
  //#endregion
654
654
  //#region src/node/constants.ts
655
655
  const ROLLUP_HOOKS = [
@@ -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);
@@ -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();
@@ -17941,8 +18107,9 @@ function createDevHtmlTransformFn(config) {
17941
18107
  };
17942
18108
  }
17943
18109
  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))));
18110
+ const urlPath = cleanUrl(url);
18111
+ if (urlPath.startsWith(FS_PREFIX)) return decodeURIComponent(fsPathFromId(urlPath));
18112
+ else return decodeURIComponent(normalizePath(path.join(server.config.root, urlPath.slice(1))));
17946
18113
  }
17947
18114
  function shouldPreTransform(url, config) {
17948
18115
  return !checkPublicFile(url, config) && (isJSRequest(url) || isCSSRequest(url));
@@ -17954,6 +18121,7 @@ function isBareRelative(url) {
17954
18121
  function getHtmlDirnameForRelativeUrl(htmlPath) {
17955
18122
  return htmlPath.endsWith("/") ? htmlPath : path.posix.dirname(htmlPath);
17956
18123
  }
18124
+ const multipleLeadingSlashesRE = /^\/{2,}/g;
17957
18125
  const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, server, isClassicScriptLink) => {
17958
18126
  const replacer = (url) => {
17959
18127
  if (url[0] === "/" && url[1] !== "/" || (url[0] === "." || isBareRelative(url)) && originalUrl && originalUrl !== "/" && htmlPath === "/index.html") url = path.posix.join(config.base, url);
@@ -17979,6 +18147,7 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
17979
18147
  return useSrcSetReplacer ? processSrcSetSync(url, ({ url }) => replacer(url)) : replacer(url);
17980
18148
  };
17981
18149
  const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl }) => {
18150
+ if (htmlPath.startsWith("//")) htmlPath = htmlPath.replace(multipleLeadingSlashesRE, "/");
17982
18151
  const { config, watcher } = server;
17983
18152
  const base = config.base || "/";
17984
18153
  const decodedBase = config.decodedBase || "/";
@@ -20114,8 +20283,9 @@ const urlRE = /[?&]url\b/;
20114
20283
  const rawRE = /[?&]raw\b/;
20115
20284
  const inlineRE$3 = /[?&]inline\b/;
20116
20285
  const svgRE = /\.svg\b/;
20286
+ const wasmInstanceRE$1 = /[?&]vite-wasm-instance(?:&|$)/;
20117
20287
  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";
20288
+ 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
20289
  return false;
20120
20290
  }
20121
20291
  /**
@@ -26491,8 +26661,8 @@ function importAnalysisPlugin(config) {
26491
26661
  if (specifier === clientPublicPath) return;
26492
26662
  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
26663
  let [url, resolvedId] = await normalizeUrl(specifier, start);
26664
+ if (resolvedId) config.safeModulePaths.add(cleanUrl(resolvedId));
26494
26665
  resolvedId = resolvedId || url;
26495
- config.safeModulePaths.add(fsPathFromUrl(stripBase(url, base)));
26496
26666
  if (url !== specifier) {
26497
26667
  let rewriteDone = false;
26498
26668
  if (!(depsOptimizer?.isOptimizedDepFile(importer) && specifier[0] === ".") && depsOptimizer?.isOptimizedDepFile(resolvedId) && !optimizedDepChunkRE.test(resolvedId)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "8.3.2",
3
+ "version": "8.3.3",
4
4
  "description": "Native-ESM powered web dev build tool",
5
5
  "keywords": [
6
6
  "build-tool",
@@ -92,7 +92,7 @@
92
92
  "fresh-import": "^0.2.1",
93
93
  "host-validation-middleware": "^0.1.4",
94
94
  "http-proxy-3": "^1.23.3",
95
- "launch-editor-middleware": "^2.14.1",
95
+ "launch-editor-middleware": "^2.14.2",
96
96
  "magic-string": "^1.4.2",
97
97
  "mlly": "^1.8.2",
98
98
  "mrmime": "^2.0.1",