vite 8.3.1 → 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.
@@ -4,9 +4,9 @@ import { esmExternalRequirePlugin, esmExternalRequirePlugin as esmExternalRequir
4
4
  import { TsconfigCache, Visitor, minify, minifySync, parse, parseSync, parseSync as parseSync$1, transformSync } from "rolldown/utils";
5
5
  import crypto, { randomBytes } from "node:crypto";
6
6
  import * as fs$1 from "node:fs";
7
- import fs, { existsSync, readFileSync } from "node:fs";
7
+ import fs, { closeSync, existsSync, openSync, readFileSync, readSync, statSync } from "node:fs";
8
8
  import fsp, { constants } from "node:fs/promises";
9
- import path, { basename, dirname, extname, isAbsolute, join, normalize, posix, relative, resolve, sep } from "node:path";
9
+ import path, { basename, delimiter, dirname, extname, isAbsolute, join, normalize, posix, relative, resolve, sep } from "node:path";
10
10
  import { performance as performance$1 } from "node:perf_hooks";
11
11
  import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
12
12
  import { format, formatWithOptions, inspect, isDeepStrictEqual, parseEnv, promisify, stripVTControlCharacters } from "node:util";
@@ -15,7 +15,7 @@ import pm from "picomatch";
15
15
  import { VERSION as rolldownVersion, rolldown } from "rolldown";
16
16
  import { escapePath, glob, globSync, isDynamicPattern } from "tinyglobby";
17
17
  import { dev, oxcRuntimePlugin, resolveTsconfig, scan, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteDynamicImportVarsPlugin, viteImportGlobPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWebWorkerPostPlugin } from "rolldown/experimental";
18
- import childProcess, { exec, execFile, execSync } from "node:child_process";
18
+ import childProcess, { exec, execFile, execSync, spawn } from "node:child_process";
19
19
  import { promises } from "node:dns";
20
20
  import net from "node:net";
21
21
  import os from "node:os";
@@ -23,14 +23,16 @@ import { isatty } from "node:tty";
23
23
  import path$1, { isAbsolute as isAbsolute$1, join as join$1, posix as posix$1, resolve as resolve$1, win32 } from "path";
24
24
  import { exactRegex, makeIdFiltersToMatchWithQuery, prefixRegex, withFilter } from "rolldown/filter";
25
25
  import { Buffer as Buffer$1 } from "node:buffer";
26
- import { readdirSync, statSync } from "fs";
26
+ import { readdirSync, statSync as statSync$1 } from "fs";
27
27
  import assert from "node:assert";
28
- import process$1 from "node:process";
28
+ import process$1, { cwd } from "node:process";
29
29
  import v8 from "node:v8";
30
30
  import { EventEmitter } from "node:events";
31
31
  import { STATUS_CODES, createServer, get } from "node:http";
32
32
  import { createServer as createServer$1, get as get$1 } from "node:https";
33
33
  import readline from "node:readline";
34
+ import { pipeline } from "node:stream/promises";
35
+ import { PassThrough } from "node:stream";
34
36
  import { ESModulesEvaluator, ModuleRunner, createNodeImportMeta } from "vite/module-runner";
35
37
  import * as qs from "node:querystring";
36
38
  import zlib from "zlib";
@@ -494,7 +496,7 @@ const MODULE_RUNNER_SOURCEMAPPING_SOURCE = "//# sourceMappingSource=vite-generat
494
496
  const ERR_OUTDATED_OPTIMIZED_DEP = "ERR_OUTDATED_OPTIMIZED_DEP";
495
497
  //#endregion
496
498
  //#region src/shared/utils.ts
497
- const isWindows = typeof process !== "undefined" && process.platform === "win32";
499
+ const isWindows$1 = typeof process !== "undefined" && process.platform === "win32";
498
500
  /**
499
501
  * Prepend `/@id/` and replace null byte so the id is URL-safe.
500
502
  * This is prepended to resolved ids that are not valid browser
@@ -540,6 +542,25 @@ function promiseWithResolvers() {
540
542
  reject
541
543
  };
542
544
  }
545
+ const whitespaceRE$1 = /\s/g;
546
+ const percentEncodedRE = /(?:%[0-9a-f]{2})+/gi;
547
+ const whitespaceOnlyRE = /^\s+$/;
548
+ /** Percent-encodes whitespace, which terminates a `//# sourceURL=` value in V8. */
549
+ function encodeSourceURL(id) {
550
+ return id.replace(whitespaceRE$1, encodeURIComponent);
551
+ }
552
+ /** Reverses {@link encodeSourceURL}. */
553
+ function decodeSourceURL(url) {
554
+ return url.replace(percentEncodedRE, (match) => {
555
+ let decoded;
556
+ try {
557
+ decoded = decodeURIComponent(match);
558
+ } catch {
559
+ return match;
560
+ }
561
+ return whitespaceOnlyRE.test(decoded) ? decoded : match;
562
+ });
563
+ }
543
564
  //#endregion
544
565
  //#region src/node/baseEnvironment.ts
545
566
  var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
@@ -628,7 +649,7 @@ var BaseEnvironment = class extends PartialEnvironment {
628
649
  };
629
650
  //#endregion
630
651
  //#region package.json
631
- var version = "8.3.1";
652
+ var version = "8.3.3";
632
653
  //#endregion
633
654
  //#region src/node/constants.ts
634
655
  const ROLLUP_HOOKS = [
@@ -726,6 +747,8 @@ const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/client.mjs");
726
747
  const BUNDLED_DEV_CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/bundledDevClient.mjs");
727
748
  /** URL filename the bundled-dev server serves the vite client under */
728
749
  const BUNDLED_DEV_CLIENT_FILENAME = "bundledDevClient.mjs";
750
+ /** URL directory the bundled-dev server serves rolldown's dev runtime files under */
751
+ const BUNDLED_DEV_ROLLDOWN_RUNTIME_DIR = "@rolldown";
729
752
  const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/env.mjs");
730
753
  const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
731
754
  const KNOWN_ASSET_TYPES = [
@@ -2115,7 +2138,7 @@ function testCaseInsensitiveFS() {
2115
2138
  const isCaseInsensitiveFS = testCaseInsensitiveFS();
2116
2139
  const VOLUME_RE = /^[A-Z]:/i;
2117
2140
  function normalizePath(id) {
2118
- return path.posix.normalize(isWindows ? slash(id) : id);
2141
+ return path.posix.normalize(isWindows$1 ? slash(id) : id);
2119
2142
  }
2120
2143
  function fsPathFromId(id) {
2121
2144
  const fsPath = normalizePath(id.startsWith(FS_PREFIX) ? id.slice(FS_PREFIX.length) : id);
@@ -2187,7 +2210,7 @@ function removeUrlQuery(url) {
2187
2210
  }
2188
2211
  function injectQuery(url, queryToInject) {
2189
2212
  const { file, postfix } = splitFileAndPostfix(url);
2190
- return `${isWindows ? slash(file) : file}?${queryToInject}${postfix[0] === "?" ? `&${postfix.slice(1)}` : postfix}`;
2213
+ return `${isWindows$1 ? slash(file) : file}?${queryToInject}${postfix[0] === "?" ? `&${postfix.slice(1)}` : postfix}`;
2191
2214
  }
2192
2215
  const timestampRE = /(\?|&)t=\d{13}(?:&|$)/;
2193
2216
  function removeTimestampQuery(url) {
@@ -2428,7 +2451,7 @@ async function recursiveReaddir(dir) {
2428
2451
  return dirent.isDirectory() ? recursiveReaddir(res) : normalizePath(res);
2429
2452
  }))).flat(1);
2430
2453
  }
2431
- let safeRealpathSync = isWindows ? windowsSafeRealPathSync : fs.realpathSync.native;
2454
+ let safeRealpathSync = isWindows$1 ? windowsSafeRealPathSync : fs.realpathSync.native;
2432
2455
  const windowsNetworkMap = /* @__PURE__ */ new Map();
2433
2456
  function windowsMappedRealpathSync(path) {
2434
2457
  const realPath = fs.realpathSync.native(path);
@@ -3460,7 +3483,7 @@ function alias$1(options = {}) {
3460
3483
  };
3461
3484
  }
3462
3485
  //#endregion
3463
- //#region ../../node_modules/.pnpm/magic-string@1.4.1/node_modules/magic-string/dist/index.mjs
3486
+ //#region ../../node_modules/.pnpm/magic-string@1.4.2/node_modules/magic-string/dist/index.mjs
3464
3487
  var BitSet = class BitSet {
3465
3488
  constructor(arg) {
3466
3489
  this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
@@ -3554,7 +3577,7 @@ var Chunk = class Chunk {
3554
3577
  this.outro = "";
3555
3578
  this.end = index;
3556
3579
  if (this.edited) {
3557
- newChunk.edit("", false);
3580
+ newChunk.edit("", false, true);
3558
3581
  this.content = "";
3559
3582
  } else this.content = originalBefore;
3560
3583
  newChunk.next = this.next;
@@ -4516,7 +4539,7 @@ var MagicString = class MagicString {
4516
4539
  * Content appended or prepended at positions strictly inside the range is removed with it, while
4517
4540
  * content attached at `start` or `end` is preserved — use `s.overwrite(start, end, '')` to remove
4518
4541
  * the range including its edge inserts.
4519
- * Removing the same content twice, or making removals that partially overlap, will cause an error.
4542
+ * Repeated removals and removals with partially overlapping ranges are allowed.
4520
4543
  */
4521
4544
  remove(start, end) {
4522
4545
  start = start + this.offset;
@@ -4798,10 +4821,16 @@ var MagicString = class MagicString {
4798
4821
  * @internal
4799
4822
  */
4800
4823
  _hasRemovedContent(start, end) {
4801
- let chunk = this.firstChunk;
4802
- while (chunk) {
4803
- if (chunk.content === "" && chunk.start < end && chunk.end > start) return true;
4804
- chunk = chunk.next;
4824
+ let chunk = this.byStart.get(start);
4825
+ if (!chunk) {
4826
+ chunk = this.lastSearchedChunk;
4827
+ const searchForward = start >= chunk.end;
4828
+ while (chunk && !chunk.contains(start)) chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start);
4829
+ if (chunk) this.lastSearchedChunk = chunk;
4830
+ }
4831
+ while (chunk && chunk.start < end) {
4832
+ if (chunk.content === "") return true;
4833
+ chunk = this.byStart.get(chunk.end);
4805
4834
  }
4806
4835
  return false;
4807
4836
  }
@@ -4865,6 +4894,7 @@ var MagicString = class MagicString {
4865
4894
  const stringLength = string.length;
4866
4895
  if (stringLength === 0) {
4867
4896
  for (let index = 0; index <= original.length; index += 1) {
4897
+ if (this._hasRemovedContent(index, index)) continue;
4868
4898
  const _replacement = typeof replacement === "function" ? replacement("", index, original) : expandReplacement(replacement, "", index, original, [], void 0);
4869
4899
  if (_replacement !== "") this.appendRight(index, _replacement);
4870
4900
  }
@@ -6440,11 +6470,11 @@ var WorkerWithFallback = class {
6440
6470
  //#endregion
6441
6471
  //#region ../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js
6442
6472
  var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6443
- const path$10 = __require("path");
6444
- const fs$10 = __require("fs");
6473
+ const path$8 = __require("path");
6474
+ const fs$7 = __require("fs");
6445
6475
  const os$3 = __require("os");
6446
6476
  const url$2 = __require("url");
6447
- const fsReadFileAsync = fs$10.promises.readFile;
6477
+ const fsReadFileAsync = fs$7.promises.readFile;
6448
6478
  /** @type {(name: string, sync: boolean) => string[]} */
6449
6479
  function getDefaultSearchPlaces(name, sync) {
6450
6480
  return [
@@ -6473,7 +6503,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6473
6503
  * And on Windows, this will never happen. ('C:\build' -> 'C:')
6474
6504
  */
6475
6505
  function parentDir(p) {
6476
- return path$10.dirname(p) || path$10.sep;
6506
+ return path$8.dirname(p) || path$8.sep;
6477
6507
  }
6478
6508
  /** @type {import('./index').LoaderSync} */
6479
6509
  const jsonLoader = (_, content) => JSON.parse(content);
@@ -6533,7 +6563,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6533
6563
  }
6534
6564
  };
6535
6565
  conf.searchPlaces.forEach((place) => {
6536
- const key = path$10.extname(place) || "noExt";
6566
+ const key = path$8.extname(place) || "noExt";
6537
6567
  const loader = conf.loaders[key];
6538
6568
  if (!loader) throw new Error(`Missing loader for extension "${place}"`);
6539
6569
  if (typeof loader !== "function") throw new Error(`Loader for extension "${place}" is not a function: Received ${typeof loader}.`);
@@ -6585,14 +6615,14 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6585
6615
  visited.add(dir);
6586
6616
  }
6587
6617
  for (const searchPlace of searchPlaces) {
6588
- const filepath = path$10.join(dir, searchPlace);
6618
+ const filepath = path$8.join(dir, searchPlace);
6589
6619
  try {
6590
- await fs$10.promises.access(filepath);
6620
+ await fs$7.promises.access(filepath);
6591
6621
  } catch {
6592
6622
  continue;
6593
6623
  }
6594
6624
  const content = String(await fsReadFileAsync(filepath));
6595
- const loaderKey = path$10.extname(searchPlace) || "noExt";
6625
+ const loaderKey = path$8.extname(searchPlace) || "noExt";
6596
6626
  const loader = loaders[loaderKey];
6597
6627
  if (searchPlace === "package.json") {
6598
6628
  const pkg = await loader(filepath, content);
@@ -6625,9 +6655,9 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6625
6655
  },
6626
6656
  async load(filepath) {
6627
6657
  validateFilePath(filepath);
6628
- const absPath = path$10.resolve(process.cwd(), filepath);
6658
+ const absPath = path$8.resolve(process.cwd(), filepath);
6629
6659
  if (cache && loadCache.has(absPath)) return loadCache.get(absPath);
6630
- const { base, ext } = path$10.parse(absPath);
6660
+ const { base, ext } = path$8.parse(absPath);
6631
6661
  const loaderKey = ext || "noExt";
6632
6662
  const loader = loaders[loaderKey];
6633
6663
  validateLoader(loader, loaderKey);
@@ -6697,15 +6727,15 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6697
6727
  visited.add(dir);
6698
6728
  }
6699
6729
  for (const searchPlace of searchPlaces) {
6700
- const filepath = path$10.join(dir, searchPlace);
6730
+ const filepath = path$8.join(dir, searchPlace);
6701
6731
  try {
6702
- fs$10.accessSync(filepath);
6732
+ fs$7.accessSync(filepath);
6703
6733
  } catch {
6704
6734
  continue;
6705
6735
  }
6706
- const loaderKey = path$10.extname(searchPlace) || "noExt";
6736
+ const loaderKey = path$8.extname(searchPlace) || "noExt";
6707
6737
  const loader = loaders[loaderKey];
6708
- const content = String(fs$10.readFileSync(filepath));
6738
+ const content = String(fs$7.readFileSync(filepath));
6709
6739
  if (searchPlace === "package.json") {
6710
6740
  const pkg = loader(filepath, content);
6711
6741
  const maybeConfig = getPackageProp(packageProp, pkg);
@@ -6737,13 +6767,13 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6737
6767
  },
6738
6768
  load(filepath) {
6739
6769
  validateFilePath(filepath);
6740
- const absPath = path$10.resolve(process.cwd(), filepath);
6770
+ const absPath = path$8.resolve(process.cwd(), filepath);
6741
6771
  if (cache && loadCache.has(absPath)) return loadCache.get(absPath);
6742
- const { base, ext } = path$10.parse(absPath);
6772
+ const { base, ext } = path$8.parse(absPath);
6743
6773
  const loaderKey = ext || "noExt";
6744
6774
  const loader = loaders[loaderKey];
6745
6775
  validateLoader(loader, loaderKey);
6746
- const content = String(fs$10.readFileSync(absPath));
6776
+ const content = String(fs$7.readFileSync(absPath));
6747
6777
  if (base === "package.json") {
6748
6778
  const pkg = loader(absPath, content);
6749
6779
  return transform({
@@ -9099,15 +9129,15 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9099
9129
  //#endregion
9100
9130
  //#region ../../node_modules/.pnpm/readdirp@3.6.0/node_modules/readdirp/index.js
9101
9131
  var require_readdirp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9102
- const fs$9 = __require("fs");
9132
+ const fs$6 = __require("fs");
9103
9133
  const { Readable: Readable$1 } = __require("stream");
9104
9134
  const sysPath$3 = __require("path");
9105
9135
  const { promisify: promisify$4 } = __require("util");
9106
9136
  const picomatch$1 = __require("picomatch");
9107
- const readdir = promisify$4(fs$9.readdir);
9108
- const stat = promisify$4(fs$9.stat);
9109
- const lstat = promisify$4(fs$9.lstat);
9110
- const realpath = promisify$4(fs$9.realpath);
9137
+ const readdir = promisify$4(fs$6.readdir);
9138
+ const stat = promisify$4(fs$6.stat);
9139
+ const lstat = promisify$4(fs$6.lstat);
9140
+ const realpath = promisify$4(fs$6.realpath);
9111
9141
  /**
9112
9142
  * @typedef {Object} EntryInfo
9113
9143
  * @property {String} path
@@ -9201,7 +9231,7 @@ var require_readdirp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9201
9231
  ].includes(type);
9202
9232
  this._wantsEverything = type === EVERYTHING_TYPE;
9203
9233
  this._root = sysPath$3.resolve(root);
9204
- this._isDirent = "Dirent" in fs$9 && !opts.alwaysStat;
9234
+ this._isDirent = "Dirent" in fs$6 && !opts.alwaysStat;
9205
9235
  this._statsProp = this._isDirent ? "dirent" : "stats";
9206
9236
  this._rdOptions = {
9207
9237
  encoding: "utf8",
@@ -10250,7 +10280,7 @@ var require_constants$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10250
10280
  }));
10251
10281
  //#endregion
10252
10282
  //#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js
10253
- var require_parse$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10283
+ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10254
10284
  const stringify = require_stringify();
10255
10285
  /**
10256
10286
  * Constants
@@ -10541,7 +10571,7 @@ var require_braces = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10541
10571
  const stringify = require_stringify();
10542
10572
  const compile = require_compile();
10543
10573
  const expand = require_expand();
10544
- const parse = require_parse$2();
10574
+ const parse = require_parse$1();
10545
10575
  /**
10546
10576
  * Expand the given pattern or create a regex-compatible string.
10547
10577
  *
@@ -10937,10 +10967,10 @@ var require_binary_extensions = /* @__PURE__ */ __commonJSMin(((exports, module)
10937
10967
  //#endregion
10938
10968
  //#region ../../node_modules/.pnpm/is-binary-path@2.1.0/node_modules/is-binary-path/index.js
10939
10969
  var require_is_binary_path = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10940
- const path$9 = __require("path");
10970
+ const path$7 = __require("path");
10941
10971
  const binaryExtensions = require_binary_extensions();
10942
10972
  const extensions = new Set(binaryExtensions);
10943
- module.exports = (filePath) => extensions.has(path$9.extname(filePath).slice(1).toLowerCase());
10973
+ module.exports = (filePath) => extensions.has(path$7.extname(filePath).slice(1).toLowerCase());
10944
10974
  }));
10945
10975
  //#endregion
10946
10976
  //#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/constants.js
@@ -11009,17 +11039,17 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
11009
11039
  //#endregion
11010
11040
  //#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/nodefs-handler.js
11011
11041
  var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11012
- const fs$8 = __require("fs");
11042
+ const fs$5 = __require("fs");
11013
11043
  const sysPath$2 = __require("path");
11014
11044
  const { promisify: promisify$3 } = __require("util");
11015
11045
  const isBinaryPath = require_is_binary_path();
11016
11046
  const { isWindows, isLinux, EMPTY_FN, EMPTY_STR, KEY_LISTENERS, KEY_ERR, KEY_RAW, HANDLER_KEYS, EV_CHANGE, EV_ADD, EV_ADD_DIR, EV_ERROR, STR_DATA, STR_END, BRACE_START, STAR } = require_constants$1();
11017
11047
  const THROTTLE_MODE_WATCH = "watch";
11018
- const open = promisify$3(fs$8.open);
11019
- const stat = promisify$3(fs$8.stat);
11020
- const lstat = promisify$3(fs$8.lstat);
11021
- const close = promisify$3(fs$8.close);
11022
- const fsrealpath = promisify$3(fs$8.realpath);
11048
+ const open = promisify$3(fs$5.open);
11049
+ const stat = promisify$3(fs$5.stat);
11050
+ const lstat = promisify$3(fs$5.lstat);
11051
+ const close = promisify$3(fs$5.close);
11052
+ const fsrealpath = promisify$3(fs$5.realpath);
11023
11053
  const statMethods = {
11024
11054
  lstat,
11025
11055
  stat
@@ -11075,7 +11105,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
11075
11105
  if (evPath && path !== evPath) fsWatchBroadcast(sysPath$2.resolve(path, evPath), KEY_LISTENERS, sysPath$2.join(path, evPath));
11076
11106
  };
11077
11107
  try {
11078
- return fs$8.watch(path, options, handleEvent);
11108
+ return fs$5.watch(path, options, handleEvent);
11079
11109
  } catch (error) {
11080
11110
  errHandler(error);
11081
11111
  }
@@ -11165,7 +11195,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
11165
11195
  let cont = FsWatchFileInstances.get(fullPath);
11166
11196
  const copts = cont && cont.options;
11167
11197
  if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
11168
- fs$8.unwatchFile(fullPath);
11198
+ fs$5.unwatchFile(fullPath);
11169
11199
  cont = void 0;
11170
11200
  }
11171
11201
  if (cont) {
@@ -11176,7 +11206,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
11176
11206
  listeners: listener,
11177
11207
  rawEmitters: rawEmitter,
11178
11208
  options,
11179
- watcher: fs$8.watchFile(fullPath, options, (curr, prev) => {
11209
+ watcher: fs$5.watchFile(fullPath, options, (curr, prev) => {
11180
11210
  foreach(cont.rawEmitters, (rawEmitter) => {
11181
11211
  rawEmitter(EV_CHANGE, fullPath, {
11182
11212
  curr,
@@ -11194,7 +11224,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
11194
11224
  delFromSet(cont, KEY_RAW, rawEmitter);
11195
11225
  if (isEmptySet(cont.listeners)) {
11196
11226
  FsWatchFileInstances.delete(fullPath);
11197
- fs$8.unwatchFile(fullPath);
11227
+ fs$5.unwatchFile(fullPath);
11198
11228
  cont.options = cont.watcher = void 0;
11199
11229
  Object.freeze(cont);
11200
11230
  }
@@ -11467,7 +11497,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
11467
11497
  //#endregion
11468
11498
  //#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/fsevents-handler.js
11469
11499
  var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11470
- const fs$7 = __require("fs");
11500
+ const fs$4 = __require("fs");
11471
11501
  const sysPath$1 = __require("path");
11472
11502
  const { promisify: promisify$2 } = __require("util");
11473
11503
  let fsevents;
@@ -11484,9 +11514,9 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
11484
11514
  }
11485
11515
  const { EV_ADD, EV_CHANGE, EV_ADD_DIR, EV_UNLINK, EV_ERROR, STR_DATA, STR_END, FSEVENT_CREATED, FSEVENT_MODIFIED, FSEVENT_DELETED, FSEVENT_MOVED, FSEVENT_UNKNOWN, FSEVENT_FLAG_MUST_SCAN_SUBDIRS, FSEVENT_TYPE_FILE, FSEVENT_TYPE_DIRECTORY, FSEVENT_TYPE_SYMLINK, ROOT_GLOBSTAR, DIR_SUFFIX, DOT_SLASH, FUNCTION_TYPE, EMPTY_FN, IDENTITY_FN } = require_constants$1();
11486
11516
  const Depth = (value) => isNaN(value) ? {} : { depth: value };
11487
- const stat = promisify$2(fs$7.stat);
11488
- const lstat = promisify$2(fs$7.lstat);
11489
- const realpath = promisify$2(fs$7.realpath);
11517
+ const stat = promisify$2(fs$4.stat);
11518
+ const lstat = promisify$2(fs$4.lstat);
11519
+ const realpath = promisify$2(fs$4.realpath);
11490
11520
  const statMethods = {
11491
11521
  stat,
11492
11522
  lstat
@@ -11806,7 +11836,7 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
11806
11836
  //#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/index.js
11807
11837
  var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
11808
11838
  const { EventEmitter: EventEmitter$4 } = __require("events");
11809
- const fs$6 = __require("fs");
11839
+ const fs$3 = __require("fs");
11810
11840
  const sysPath = __require("path");
11811
11841
  const { promisify: promisify$1 } = __require("util");
11812
11842
  const readdirp = require_readdirp();
@@ -11818,8 +11848,8 @@ var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
11818
11848
  const NodeFsHandler = require_nodefs_handler();
11819
11849
  const FsEventsHandler = require_fsevents_handler();
11820
11850
  const { EV_ALL, EV_READY, EV_ADD, EV_CHANGE, EV_UNLINK, EV_ADD_DIR, EV_UNLINK_DIR, EV_RAW, EV_ERROR, STR_CLOSE, STR_END, BACK_SLASH_RE, DOUBLE_SLASH_RE, SLASH_OR_BACK_SLASH_RE, DOT_RE, REPLACER_RE, SLASH, SLASH_SLASH, BRACE_START, BANG, ONE_DOT, TWO_DOTS, GLOBSTAR, SLASH_GLOBSTAR, ANYMATCH_OPTS, STRING_TYPE, FUNCTION_TYPE, EMPTY_STR, EMPTY_FN, isWindows, isMacos, isIBMi } = require_constants$1();
11821
- const stat = promisify$1(fs$6.stat);
11822
- const readdir = promisify$1(fs$6.readdir);
11851
+ const stat = promisify$1(fs$3.stat);
11852
+ const readdir = promisify$1(fs$3.readdir);
11823
11853
  /**
11824
11854
  * @typedef {String} Path
11825
11855
  * @typedef {'all'|'add'|'addDir'|'change'|'unlink'|'unlinkDir'|'raw'|'error'|'ready'} EventName
@@ -12307,7 +12337,7 @@ var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
12307
12337
  if (this.options.cwd && !sysPath.isAbsolute(path)) fullPath = sysPath.join(this.options.cwd, path);
12308
12338
  const now = /* @__PURE__ */ new Date();
12309
12339
  const awaitWriteFinish = (prevStat) => {
12310
- fs$6.stat(fullPath, (err, curStat) => {
12340
+ fs$3.stat(fullPath, (err, curStat) => {
12311
12341
  if (err || !this._pendingWrites.has(path)) {
12312
12342
  if (err && err.code !== "ENOENT") awfEmit(err);
12313
12343
  return;
@@ -13812,18 +13842,29 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13812
13842
  })();
13813
13843
  }));
13814
13844
  //#endregion
13815
- //#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
13816
13846
  var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13847
+ /** @import { ControlOperator } from './parse' */
13848
+ /** @type {ControlOperator['op'][]} */
13817
13849
  var OPS = [
13818
13850
  "||",
13819
13851
  "&&",
13852
+ ";;&",
13820
13853
  ";;",
13854
+ ";&",
13821
13855
  "|&",
13822
13856
  "<(",
13857
+ ">(",
13823
13858
  "<<<",
13859
+ "<<-",
13860
+ "<<",
13824
13861
  ">>",
13825
13862
  ">&",
13863
+ ">|",
13864
+ "&>>",
13865
+ "&>",
13826
13866
  "<&",
13867
+ "<>",
13827
13868
  "&",
13828
13869
  ";",
13829
13870
  "(",
@@ -13833,51 +13874,70 @@ var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13833
13874
  ">"
13834
13875
  ];
13835
13876
  var LINE_TERMINATORS = /[\n\r\u2028\u2029]/;
13836
- var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|]/g;
13877
+ var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|~]/g;
13878
+ /** @type {typeof import('./quote')} */
13837
13879
  module.exports = function quote(xs) {
13880
+ var sawComment = false;
13838
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");
13839
13883
  if (s === "") return "''";
13840
13884
  if (s && typeof s === "object") {
13841
- if (s.op === "glob") {
13885
+ if ("op" in s && s.op === "glob") {
13842
13886
  if (typeof s.pattern !== "string") throw new TypeError("glob token requires a string `pattern`");
13843
13887
  if (LINE_TERMINATORS.test(s.pattern)) throw new TypeError("glob `pattern` must not contain line terminators");
13888
+ if (s.pattern === "") return "''";
13844
13889
  return s.pattern.replace(GLOB_SHELL_SPECIAL, "\\$&");
13845
13890
  }
13846
- if (typeof s.op === "string") {
13891
+ if ("op" in s && typeof s.op === "string") {
13847
13892
  if (OPS.indexOf(s.op) < 0) throw new TypeError("invalid `op` value: " + JSON.stringify(s.op));
13848
13893
  return s.op.replace(/[\s\S]/g, "\\$&");
13849
13894
  }
13850
- if (typeof s.comment === "string") {
13895
+ if ("comment" in s && typeof s.comment === "string") {
13851
13896
  if (LINE_TERMINATORS.test(s.comment)) throw new TypeError("`comment` must not contain line terminators");
13897
+ sawComment = true;
13852
13898
  return "#" + s.comment;
13853
13899
  }
13854
13900
  throw new TypeError("unrecognized object token shape");
13855
13901
  }
13856
- if (/["\s\\]/.test(s) && !/'/.test(s)) return "'" + s.replace(/(['])/g, "\\$1") + "'";
13857
- if (/["'\s]/.test(s)) return "\"" + s.replace(/(["\\$`!])/g, "\\$1") + "\"";
13858
- 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");
13859
13906
  }).join(" ");
13860
13907
  };
13861
13908
  }));
13862
13909
  //#endregion
13863
- //#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/parse.js
13864
- var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13910
+ //#region ../../node_modules/.pnpm/shell-quote@1.12.0/node_modules/shell-quote/parse.js
13911
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13912
+ /**
13913
+ * @import {
13914
+ * ControlOperator,
13915
+ * Env,
13916
+ * GlobPattern,
13917
+ * ParseEntry,
13918
+ * } from './parse' */
13865
13919
  var CONTROL = "(?:" + [
13866
13920
  "\\|\\|",
13867
- "\\&\\&",
13868
- ";;",
13869
- "\\|\\&",
13921
+ "\\&(?:\\&|>>?)",
13922
+ ";;\\&?",
13923
+ "[;|]\\&",
13870
13924
  "\\<\\(",
13871
13925
  "\\<\\<\\<",
13926
+ "\\<\\<-",
13927
+ "\\<\\<(?!\\()",
13872
13928
  ">>",
13873
- ">\\&",
13874
- "<\\&",
13929
+ ">[&|(]",
13930
+ "<[&>]",
13875
13931
  "[&;()|<>]"
13876
13932
  ].join("|") + ")";
13877
13933
  var controlRE = new RegExp("^" + CONTROL + "$");
13878
13934
  var META = "|&;()<> \\t";
13879
- var SINGLE_QUOTE = "\"((\\\\\"|[^\"])*?)\"";
13880
- 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";
13881
13941
  var hash = /^#$/;
13882
13942
  var SQ = "'";
13883
13943
  var DQ = "\"";
@@ -13886,17 +13946,26 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13886
13946
  var mult = 4294967296;
13887
13947
  for (var i = 0; i < 4; i++) TOKEN += (mult * Math.random()).toString(16);
13888
13948
  var startsWithToken = new RegExp("^" + TOKEN);
13949
+ /**
13950
+ * @param {string} s
13951
+ * @param {RegExp} r
13952
+ */
13889
13953
  function matchAll(s, r) {
13890
13954
  var origIndex = r.lastIndex;
13891
13955
  var matches = [];
13892
13956
  var matchObj;
13893
13957
  while (matchObj = r.exec(s)) {
13894
- matches.push(matchObj);
13958
+ matches[matches.length] = matchObj;
13895
13959
  if (r.lastIndex === matchObj.index) r.lastIndex += 1;
13896
13960
  }
13897
13961
  r.lastIndex = origIndex;
13898
13962
  return matches;
13899
13963
  }
13964
+ /**
13965
+ * @param {Env} env
13966
+ * @param {string} pre
13967
+ * @param {string} key
13968
+ */
13900
13969
  function getVar(env, pre, key) {
13901
13970
  var r = typeof env === "function" ? env(key) : env[key];
13902
13971
  if (typeof r === "undefined" && key != "") r = "";
@@ -13904,11 +13973,51 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13904
13973
  if (typeof r === "object") return pre + TOKEN + JSON.stringify(r) + TOKEN;
13905
13974
  return pre + r;
13906
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
+ */
13907
14014
  function parseInternal(string, env, opts) {
13908
14015
  if (!opts) opts = {};
13909
14016
  var BS = opts.escape || "\\";
13910
- var BAREWORD = "(\\" + BS + "['\"" + META + "]|[^\\s'\"" + META + "])+";
13911
- 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"));
13912
14021
  if (matches.length === 0) return [];
13913
14022
  if (!env) env = {};
13914
14023
  var commented = false;
@@ -13916,27 +14025,41 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13916
14025
  var s = match[0];
13917
14026
  if (!s || commented) return;
13918
14027
  if (controlRE.test(s)) return { op: s };
14028
+ /** @type {string | boolean} */
13919
14029
  var quote = false;
13920
14030
  var esc = false;
13921
14031
  var out = "";
14032
+ /** @type {string[]} */
14033
+ var words = [];
14034
+ var sawQuote = false;
14035
+ /** @type {number | null} */
14036
+ var pendingNw = null;
13922
14037
  var isGlob = false;
14038
+ /** @type {number} */
13923
14039
  var i;
13924
14040
  function parseEnvVar() {
13925
14041
  i += 1;
14042
+ /** @type {number | RegExpMatchArray | null} */
13926
14043
  var varend;
14044
+ /** @type {string} */
13927
14045
  var varname;
13928
14046
  var char = s.charAt(i);
13929
14047
  if (char === "{") {
13930
14048
  i += 1;
13931
14049
  if (s.charAt(i) === "}") throw new Error("Bad substitution: " + s.slice(i - 2, i + 1));
13932
- varend = s.indexOf("}", i);
13933
- 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;
13934
14059
  varname = s.slice(i, varend);
13935
14060
  i = varend;
13936
- } else if (/[*@#?$!_-]/.test(char)) {
13937
- varname = char;
13938
- i += 1;
13939
- } else {
14061
+ } else if (/[*@#?$!-]/.test(char)) varname = char;
14062
+ else {
13940
14063
  var slicedFromI = s.slice(i);
13941
14064
  varend = slicedFromI.match(/[^\w\d_]/);
13942
14065
  if (!varend) {
@@ -13949,8 +14072,23 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13949
14072
  }
13950
14073
  return getVar(env, "", varname);
13951
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
+ }
13952
14089
  for (i = 0; i < s.length; i++) {
13953
14090
  var c = s.charAt(i);
14091
+ if (ifs && c !== DS) flushRun();
13954
14092
  isGlob = isGlob || !quote && (c === "*" || c === "?");
13955
14093
  if (esc) {
13956
14094
  out += c;
@@ -13965,48 +14103,85 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13965
14103
  else out += BS + c;
13966
14104
  } else if (c === DS) out += parseEnvVar();
13967
14105
  else out += c;
13968
- } else if (c === DQ || c === SQ) quote = c;
13969
- 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 };
13970
14110
  else if (hash.test(c)) {
13971
14111
  commented = true;
13972
14112
  var commentObj = { comment: string.slice(match.index + i + 1) };
13973
14113
  if (out.length) return [out, commentObj];
13974
14114
  return [commentObj];
13975
14115
  } else if (c === BS) esc = true;
13976
- else if (c === DS) out += parseEnvVar();
13977
- 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;
13978
14133
  }
13979
14134
  if (isGlob) return {
13980
14135
  op: "glob",
13981
14136
  pattern: out
13982
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
+ }
13983
14147
  return out;
13984
14148
  }).reduce(function(prev, arg) {
13985
- 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;
13986
14154
  }, []);
13987
14155
  }
14156
+ /** @type {typeof import('./parse')} */
13988
14157
  module.exports = function parse(s, env, opts) {
13989
14158
  var mapped = parseInternal(s, env, opts);
13990
14159
  if (typeof env !== "function") return mapped;
13991
14160
  return mapped.reduce(function(acc, s) {
13992
- if (typeof s === "object") return acc.concat(s);
14161
+ if (typeof s === "object") {
14162
+ acc[acc.length] = s;
14163
+ return acc;
14164
+ }
13993
14165
  var xs = s.split(RegExp("(" + TOKEN + ".*?" + TOKEN + ")", "g"));
13994
- if (xs.length === 1) return acc.concat(xs[0]);
13995
- return acc.concat(xs.filter(Boolean).map(function(x) {
13996
- if (startsWithToken.test(x)) return JSON.parse(x.split(TOKEN)[1]);
13997
- return x;
13998
- }));
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;
13999
14174
  }, []);
14000
14175
  };
14001
14176
  }));
14002
14177
  //#endregion
14003
- //#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
14004
14179
  var require_shell_quote = /* @__PURE__ */ __commonJSMin(((exports) => {
14005
14180
  exports.quote = require_quote();
14006
- exports.parse = require_parse$1();
14181
+ exports.parse = require_parse();
14007
14182
  }));
14008
14183
  //#endregion
14009
- //#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
14010
14185
  var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14011
14186
  module.exports = {
14012
14187
  "/Applications/Atom.app/Contents/MacOS/Atom": "atom",
@@ -14041,7 +14216,7 @@ var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14041
14216
  };
14042
14217
  }));
14043
14218
  //#endregion
14044
- //#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
14045
14220
  var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14046
14221
  module.exports = {
14047
14222
  atom: "atom",
@@ -14075,8 +14250,8 @@ var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14075
14250
  };
14076
14251
  }));
14077
14252
  //#endregion
14078
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/windows.js
14079
- var require_windows$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14253
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/editor-info/windows.js
14254
+ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14080
14255
  module.exports = [
14081
14256
  "Brackets.exe",
14082
14257
  "Code.exe",
@@ -14108,14 +14283,14 @@ var require_windows$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14108
14283
  ];
14109
14284
  }));
14110
14285
  //#endregion
14111
- //#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
14112
14287
  var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14113
- const path$8 = __require("path");
14288
+ const path$6 = __require("path");
14114
14289
  const shellQuote = require_shell_quote();
14115
14290
  const childProcess$2 = __require("child_process");
14116
14291
  const COMMON_EDITORS_MACOS = require_macos();
14117
14292
  const COMMON_EDITORS_LINUX = require_linux();
14118
- const COMMON_EDITORS_WIN = require_windows$1();
14293
+ const COMMON_EDITORS_WIN = require_windows();
14119
14294
  function getEditorFromMacProcesses(output) {
14120
14295
  const processNames = Object.keys(COMMON_EDITORS_MACOS);
14121
14296
  const processList = output.split("\n");
@@ -14134,7 +14309,7 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14134
14309
  const runningProcesses = output.split("\r\n");
14135
14310
  for (let i = 0; i < runningProcesses.length; i++) {
14136
14311
  const fullProcessPath = runningProcesses[i].trim();
14137
- const shortProcessName = path$8.win32.basename(fullProcessPath);
14312
+ const shortProcessName = path$6.win32.basename(fullProcessPath);
14138
14313
  if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) return fullProcessPath;
14139
14314
  }
14140
14315
  }
@@ -14183,11 +14358,15 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14183
14358
  module.exports.getEditorFromLinuxProcesses = getEditorFromLinuxProcesses;
14184
14359
  }));
14185
14360
  //#endregion
14186
- //#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
14187
14362
  var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14188
- const path$7 = __require("path");
14189
- module.exports = function getArgumentsForPosition(editor, fileName, lineNumber, columnNumber = 1) {
14190
- switch (path$7.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, "")) {
14191
14370
  case "atom":
14192
14371
  case "Atom":
14193
14372
  case "Atom Beta":
@@ -14262,7 +14441,42 @@ var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14262
14441
  };
14263
14442
  }));
14264
14443
  //#endregion
14265
- //#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
14266
14480
  var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14267
14481
  /**
14268
14482
  * Copyright (c) 2015-present, Facebook, Inc.
@@ -14273,17 +14487,18 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
14273
14487
  *
14274
14488
  * Modified by Yuxi Evan You
14275
14489
  */
14276
- const fs$5 = __require("fs");
14277
- const os$1 = __require("os");
14278
- const path$6 = __require("path");
14490
+ const fs$2 = __require("fs");
14491
+ const path$3 = __require("path");
14279
14492
  const colors = require_picocolors();
14280
14493
  const childProcess$1 = __require("child_process");
14281
14494
  const guessEditor = require_guess();
14282
- 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();
14283
14498
  function wrapErrorCallback(cb) {
14284
14499
  return (fileName, errorMessage) => {
14285
14500
  console.log();
14286
- console.log(colors.red("Could not open " + path$6.basename(fileName) + " in the editor."));
14501
+ console.log(colors.red("Could not open " + path$3.basename(fileName) + " in the editor."));
14287
14502
  if (errorMessage) {
14288
14503
  if (errorMessage[errorMessage.length - 1] !== ".") errorMessage += ".";
14289
14504
  console.log(colors.red("The editor process exited with an error: " + errorMessage));
@@ -14300,55 +14515,36 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
14300
14515
  }
14301
14516
  return false;
14302
14517
  }
14303
- const positionRE = /:(\d+)(:(\d+))?$/;
14304
- function parseFile(file) {
14305
- if (file.startsWith("file://")) file = __require("url").fileURLToPath(file);
14306
- const fileName = file.replace(positionRE, "");
14307
- const match = file.match(positionRE);
14308
- return {
14309
- fileName,
14310
- lineNumber: match && match[1],
14311
- columnNumber: match && match[3]
14312
- };
14313
- }
14314
14518
  let currentChildProcess = null;
14315
14519
  function launchEditor(file, specifiedEditor, onErrorCallback) {
14316
- const parsed = parseFile(file);
14317
- let { fileName } = parsed;
14318
- const { lineNumber, columnNumber } = parsed;
14319
- if (process.platform === "win32" && path$6.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.");
14320
- if (!fs$5.existsSync(fileName)) return;
14520
+ const { fileName, lineNumber, columnNumber } = parseFile(file);
14321
14521
  if (typeof specifiedEditor === "function") {
14322
14522
  onErrorCallback = specifiedEditor;
14323
14523
  specifiedEditor = void 0;
14324
14524
  }
14325
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;
14326
14528
  const [editor, ...args] = guessEditor(specifiedEditor);
14327
14529
  if (!editor) {
14328
14530
  onErrorCallback(fileName, null);
14329
14531
  return;
14330
14532
  }
14331
- if (process.platform === "linux" && fileName.startsWith("/mnt/") && /Microsoft/i.test(os$1.release())) fileName = path$6.relative("", fileName);
14332
- if (lineNumber) {
14333
- const extraArgs = getArgumentsForPosition(editor, fileName, lineNumber, columnNumber);
14334
- args.push.apply(args, extraArgs);
14335
- } 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
+ }
14336
14542
  if (currentChildProcess && isTerminalEditor(editor)) currentChildProcess.kill("SIGKILL");
14337
- if (process.platform === "win32") {
14338
- function escapeCmdArgs(cmdArgs) {
14339
- return cmdArgs.replace(/([&|<>,;=^])/g, "^$1");
14340
- }
14341
- function doubleQuoteIfNeeded(str) {
14342
- if (str.includes("^")) return `^"${str}^"`;
14343
- else if (str.includes(" ")) return `"${str}"`;
14344
- return str;
14345
- }
14346
- const launchCommand = [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(" ");
14347
- currentChildProcess = childProcess$1.exec(launchCommand, {
14348
- stdio: "inherit",
14349
- shell: true
14350
- });
14351
- } 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" });
14352
14548
  currentChildProcess.on("exit", function(errorCode) {
14353
14549
  currentChildProcess = null;
14354
14550
  if (errorCode) onErrorCallback(fileName, "(code " + errorCode + ")");
@@ -14362,9 +14558,9 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
14362
14558
  module.exports = launchEditor;
14363
14559
  }));
14364
14560
  //#endregion
14365
- //#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
14366
14562
  var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14367
- const path$5 = __require("path");
14563
+ const path$2 = __require("path");
14368
14564
  const launch = require_launch_editor();
14369
14565
  module.exports = (specifiedEditor, srcRoot, onErrorCallback) => {
14370
14566
  if (typeof specifiedEditor === "function") {
@@ -14391,7 +14587,7 @@ var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports,
14391
14587
  res.statusCode = 500;
14392
14588
  res.end(`launch-editor-middleware: required query param "file" is missing.`);
14393
14589
  } else {
14394
- const resolved = file.startsWith("file://") ? file : path$5.resolve(srcRoot, file);
14590
+ const resolved = file.startsWith("file://") ? file : path$2.resolve(srcRoot, file);
14395
14591
  launch(resolved, specifiedEditor, onErrorCallback);
14396
14592
  res.end();
14397
14593
  }
@@ -14647,408 +14843,6 @@ function printServerUrls(urls, optionsHost, info) {
14647
14843
  if (urls.network.length === 0 && optionsHost === void 0) info(import_picocolors.default.dim(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Network")}: use `) + import_picocolors.default.bold("--host") + import_picocolors.default.dim(" to expose"));
14648
14844
  }
14649
14845
  //#endregion
14650
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
14651
- var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14652
- module.exports = isexe;
14653
- isexe.sync = sync;
14654
- var fs$4 = __require("fs");
14655
- function checkPathExt(path, options) {
14656
- var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
14657
- if (!pathext) return true;
14658
- pathext = pathext.split(";");
14659
- if (pathext.indexOf("") !== -1) return true;
14660
- for (var i = 0; i < pathext.length; i++) {
14661
- var p = pathext[i].toLowerCase();
14662
- if (p && path.substr(-p.length).toLowerCase() === p) return true;
14663
- }
14664
- return false;
14665
- }
14666
- function checkStat(stat, path, options) {
14667
- if (!stat.isSymbolicLink() && !stat.isFile()) return false;
14668
- return checkPathExt(path, options);
14669
- }
14670
- function isexe(path, options, cb) {
14671
- fs$4.stat(path, function(er, stat) {
14672
- cb(er, er ? false : checkStat(stat, path, options));
14673
- });
14674
- }
14675
- function sync(path, options) {
14676
- return checkStat(fs$4.statSync(path), path, options);
14677
- }
14678
- }));
14679
- //#endregion
14680
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
14681
- var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14682
- module.exports = isexe;
14683
- isexe.sync = sync;
14684
- var fs$3 = __require("fs");
14685
- function isexe(path, options, cb) {
14686
- fs$3.stat(path, function(er, stat) {
14687
- cb(er, er ? false : checkStat(stat, options));
14688
- });
14689
- }
14690
- function sync(path, options) {
14691
- return checkStat(fs$3.statSync(path), options);
14692
- }
14693
- function checkStat(stat, options) {
14694
- return stat.isFile() && checkMode(stat, options);
14695
- }
14696
- function checkMode(stat, options) {
14697
- var mod = stat.mode;
14698
- var uid = stat.uid;
14699
- var gid = stat.gid;
14700
- var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
14701
- var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
14702
- var u = parseInt("100", 8);
14703
- var g = parseInt("010", 8);
14704
- var o = parseInt("001", 8);
14705
- var ug = u | g;
14706
- return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
14707
- }
14708
- }));
14709
- //#endregion
14710
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
14711
- var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14712
- __require("fs");
14713
- var core;
14714
- if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
14715
- else core = require_mode();
14716
- module.exports = isexe;
14717
- isexe.sync = sync;
14718
- function isexe(path, options, cb) {
14719
- if (typeof options === "function") {
14720
- cb = options;
14721
- options = {};
14722
- }
14723
- if (!cb) {
14724
- if (typeof Promise !== "function") throw new TypeError("callback not provided");
14725
- return new Promise(function(resolve, reject) {
14726
- isexe(path, options || {}, function(er, is) {
14727
- if (er) reject(er);
14728
- else resolve(is);
14729
- });
14730
- });
14731
- }
14732
- core(path, options || {}, function(er, is) {
14733
- if (er) {
14734
- if (er.code === "EACCES" || options && options.ignoreErrors) {
14735
- er = null;
14736
- is = false;
14737
- }
14738
- }
14739
- cb(er, is);
14740
- });
14741
- }
14742
- function sync(path, options) {
14743
- try {
14744
- return core.sync(path, options || {});
14745
- } catch (er) {
14746
- if (options && options.ignoreErrors || er.code === "EACCES") return false;
14747
- else throw er;
14748
- }
14749
- }
14750
- }));
14751
- //#endregion
14752
- //#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
14753
- var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14754
- const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
14755
- const path$4 = __require("path");
14756
- const COLON = isWindows ? ";" : ":";
14757
- const isexe = require_isexe();
14758
- const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
14759
- const getPathInfo = (cmd, opt) => {
14760
- const colon = opt.colon || COLON;
14761
- const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
14762
- /* istanbul ignore next: very unusual */ "").split(colon)];
14763
- const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
14764
- const pathExt = isWindows ? pathExtExe.split(colon) : [""];
14765
- if (isWindows) {
14766
- if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
14767
- }
14768
- return {
14769
- pathEnv,
14770
- pathExt,
14771
- pathExtExe
14772
- };
14773
- };
14774
- const which = (cmd, opt, cb) => {
14775
- if (typeof opt === "function") {
14776
- cb = opt;
14777
- opt = {};
14778
- }
14779
- if (!opt) opt = {};
14780
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
14781
- const found = [];
14782
- const step = (i) => new Promise((resolve, reject) => {
14783
- if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
14784
- const ppRaw = pathEnv[i];
14785
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
14786
- const pCmd = path$4.join(pathPart, cmd);
14787
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
14788
- resolve(subStep(p, i, 0));
14789
- });
14790
- const subStep = (p, i, ii) => new Promise((resolve, reject) => {
14791
- if (ii === pathExt.length) return resolve(step(i + 1));
14792
- const ext = pathExt[ii];
14793
- isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
14794
- if (!er && is) {
14795
- if (opt.all) found.push(p + ext);
14796
- else return resolve(p + ext);
14797
- }
14798
- return resolve(subStep(p, i, ii + 1));
14799
- });
14800
- });
14801
- return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
14802
- };
14803
- const whichSync = (cmd, opt) => {
14804
- opt = opt || {};
14805
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
14806
- const found = [];
14807
- for (let i = 0; i < pathEnv.length; i++) {
14808
- const ppRaw = pathEnv[i];
14809
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
14810
- const pCmd = path$4.join(pathPart, cmd);
14811
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
14812
- for (let j = 0; j < pathExt.length; j++) {
14813
- const cur = p + pathExt[j];
14814
- try {
14815
- if (isexe.sync(cur, { pathExt: pathExtExe })) {
14816
- if (opt.all) found.push(cur);
14817
- else return cur;
14818
- }
14819
- } catch (ex) {}
14820
- }
14821
- }
14822
- if (opt.all && found.length) return found;
14823
- if (opt.nothrow) return null;
14824
- throw getNotFoundError(cmd);
14825
- };
14826
- module.exports = which;
14827
- which.sync = whichSync;
14828
- }));
14829
- //#endregion
14830
- //#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
14831
- var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14832
- const pathKey = (options = {}) => {
14833
- const environment = options.env || process.env;
14834
- if ((options.platform || process.platform) !== "win32") return "PATH";
14835
- return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
14836
- };
14837
- module.exports = pathKey;
14838
- module.exports.default = pathKey;
14839
- }));
14840
- //#endregion
14841
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
14842
- var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14843
- const path$3 = __require("path");
14844
- const which = require_which();
14845
- const getPathKey = require_path_key();
14846
- function resolveCommandAttempt(parsed, withoutPathExt) {
14847
- const env = parsed.options.env || process.env;
14848
- const cwd = process.cwd();
14849
- const hasCustomCwd = parsed.options.cwd != null;
14850
- const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
14851
- if (shouldSwitchCwd) try {
14852
- process.chdir(parsed.options.cwd);
14853
- } catch (err) {}
14854
- let resolved;
14855
- try {
14856
- resolved = which.sync(parsed.command, {
14857
- path: env[getPathKey({ env })],
14858
- pathExt: withoutPathExt ? path$3.delimiter : void 0
14859
- });
14860
- } catch (e) {} finally {
14861
- if (shouldSwitchCwd) process.chdir(cwd);
14862
- }
14863
- if (resolved) resolved = path$3.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
14864
- return resolved;
14865
- }
14866
- function resolveCommand(parsed) {
14867
- return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
14868
- }
14869
- module.exports = resolveCommand;
14870
- }));
14871
- //#endregion
14872
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
14873
- var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14874
- const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
14875
- function escapeCommand(arg) {
14876
- arg = arg.replace(metaCharsRegExp, "^$1");
14877
- return arg;
14878
- }
14879
- function escapeArgument(arg, doubleEscapeMetaChars) {
14880
- arg = `${arg}`;
14881
- arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
14882
- arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
14883
- arg = `"${arg}"`;
14884
- arg = arg.replace(metaCharsRegExp, "^$1");
14885
- if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
14886
- return arg;
14887
- }
14888
- module.exports.command = escapeCommand;
14889
- module.exports.argument = escapeArgument;
14890
- }));
14891
- //#endregion
14892
- //#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
14893
- var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14894
- module.exports = /^#!(.*)/;
14895
- }));
14896
- //#endregion
14897
- //#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
14898
- var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14899
- const shebangRegex = require_shebang_regex();
14900
- module.exports = (string = "") => {
14901
- const match = string.match(shebangRegex);
14902
- if (!match) return null;
14903
- const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
14904
- const binary = path.split("/").pop();
14905
- if (binary === "env") return argument;
14906
- return argument ? `${binary} ${argument}` : binary;
14907
- };
14908
- }));
14909
- //#endregion
14910
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
14911
- var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14912
- const fs$2 = __require("fs");
14913
- const shebangCommand = require_shebang_command();
14914
- function readShebang(command) {
14915
- const size = 150;
14916
- const buffer = Buffer.alloc(size);
14917
- let fd;
14918
- try {
14919
- fd = fs$2.openSync(command, "r");
14920
- fs$2.readSync(fd, buffer, 0, size, 0);
14921
- fs$2.closeSync(fd);
14922
- } catch (e) {}
14923
- return shebangCommand(buffer.toString());
14924
- }
14925
- module.exports = readShebang;
14926
- }));
14927
- //#endregion
14928
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
14929
- var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14930
- const path$2 = __require("path");
14931
- const resolveCommand = require_resolveCommand();
14932
- const escape = require_escape();
14933
- const readShebang = require_readShebang();
14934
- const isWin = process.platform === "win32";
14935
- const isExecutableRegExp = /\.(?:com|exe)$/i;
14936
- const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
14937
- function detectShebang(parsed) {
14938
- parsed.file = resolveCommand(parsed);
14939
- const shebang = parsed.file && readShebang(parsed.file);
14940
- if (shebang) {
14941
- parsed.args.unshift(parsed.file);
14942
- parsed.command = shebang;
14943
- return resolveCommand(parsed);
14944
- }
14945
- return parsed.file;
14946
- }
14947
- function parseNonShell(parsed) {
14948
- if (!isWin) return parsed;
14949
- const commandFile = detectShebang(parsed);
14950
- const needsShell = !isExecutableRegExp.test(commandFile);
14951
- if (parsed.options.forceShell || needsShell) {
14952
- const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
14953
- parsed.command = path$2.normalize(parsed.command);
14954
- parsed.command = escape.command(parsed.command);
14955
- parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
14956
- parsed.args = [
14957
- "/d",
14958
- "/s",
14959
- "/c",
14960
- `"${[parsed.command].concat(parsed.args).join(" ")}"`
14961
- ];
14962
- parsed.command = process.env.comspec || "cmd.exe";
14963
- parsed.options.windowsVerbatimArguments = true;
14964
- }
14965
- return parsed;
14966
- }
14967
- function parse(command, args, options) {
14968
- if (args && !Array.isArray(args)) {
14969
- options = args;
14970
- args = null;
14971
- }
14972
- args = args ? args.slice(0) : [];
14973
- options = Object.assign({}, options);
14974
- const parsed = {
14975
- command,
14976
- args,
14977
- options,
14978
- file: void 0,
14979
- original: {
14980
- command,
14981
- args
14982
- }
14983
- };
14984
- return options.shell ? parsed : parseNonShell(parsed);
14985
- }
14986
- module.exports = parse;
14987
- }));
14988
- //#endregion
14989
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
14990
- var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14991
- const isWin = process.platform === "win32";
14992
- function notFoundError(original, syscall) {
14993
- return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
14994
- code: "ENOENT",
14995
- errno: "ENOENT",
14996
- syscall: `${syscall} ${original.command}`,
14997
- path: original.command,
14998
- spawnargs: original.args
14999
- });
15000
- }
15001
- function hookChildProcess(cp, parsed) {
15002
- if (!isWin) return;
15003
- const originalEmit = cp.emit;
15004
- cp.emit = function(name, arg1) {
15005
- if (name === "exit") {
15006
- const err = verifyENOENT(arg1, parsed);
15007
- if (err) return originalEmit.call(cp, "error", err);
15008
- }
15009
- return originalEmit.apply(cp, arguments);
15010
- };
15011
- }
15012
- function verifyENOENT(status, parsed) {
15013
- if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
15014
- return null;
15015
- }
15016
- function verifyENOENTSync(status, parsed) {
15017
- if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
15018
- return null;
15019
- }
15020
- module.exports = {
15021
- hookChildProcess,
15022
- verifyENOENT,
15023
- verifyENOENTSync,
15024
- notFoundError
15025
- };
15026
- }));
15027
- //#endregion
15028
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
15029
- var require_cross_spawn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15030
- const cp = __require("child_process");
15031
- const parse = require_parse();
15032
- const enoent = require_enoent();
15033
- function spawn(command, args, options) {
15034
- const parsed = parse(command, args, options);
15035
- const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
15036
- enoent.hookChildProcess(spawned, parsed);
15037
- return spawned;
15038
- }
15039
- function spawnSync(command, args, options) {
15040
- const parsed = parse(command, args, options);
15041
- const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
15042
- result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
15043
- return result;
15044
- }
15045
- module.exports = spawn;
15046
- module.exports.spawn = spawn;
15047
- module.exports.sync = spawnSync;
15048
- module.exports._parse = parse;
15049
- module.exports._enoent = enoent;
15050
- }));
15051
- //#endregion
15052
14846
  //#region ../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
15053
14847
  let isDockerCached;
15054
14848
  function hasDockerEnv() {
@@ -15505,6 +15299,347 @@ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
15505
15299
  defineLazyProperty(apps, "browser", () => "browser");
15506
15300
  defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
15507
15301
  //#endregion
15302
+ //#region ../../node_modules/.pnpm/tinyexec@1.3.1/node_modules/tinyexec/dist/main.mjs
15303
+ const isPathLikePattern = /^path$/i;
15304
+ const defaultEnvPathInfo = {
15305
+ key: "PATH",
15306
+ value: ""
15307
+ };
15308
+ function getPathFromEnv(env) {
15309
+ for (const key in env) {
15310
+ if (!Object.prototype.hasOwnProperty.call(env, key) || !isPathLikePattern.test(key)) continue;
15311
+ const value = env[key];
15312
+ if (!value) return defaultEnvPathInfo;
15313
+ return {
15314
+ key,
15315
+ value
15316
+ };
15317
+ }
15318
+ return defaultEnvPathInfo;
15319
+ }
15320
+ function addNodeBinToPath(cwd, path) {
15321
+ const parts = path.value.split(delimiter);
15322
+ const nodeBinPaths = [];
15323
+ let currentPath = typeof cwd === "string" ? cwd : fileURLToPath(cwd, { windows: false });
15324
+ let lastPath;
15325
+ do {
15326
+ nodeBinPaths.push(resolve(currentPath, "node_modules", ".bin"));
15327
+ lastPath = currentPath;
15328
+ currentPath = dirname(currentPath);
15329
+ } while (currentPath !== lastPath);
15330
+ nodeBinPaths.push(dirname(process.execPath));
15331
+ const newPath = nodeBinPaths.concat(parts).join(delimiter);
15332
+ return {
15333
+ key: path.key,
15334
+ value: newPath
15335
+ };
15336
+ }
15337
+ function computeEnv(cwd, env, nodePath = true) {
15338
+ const envWithDefault = {
15339
+ ...process.env,
15340
+ ...env
15341
+ };
15342
+ if (!nodePath) return envWithDefault;
15343
+ const envPathInfo = addNodeBinToPath(cwd, getPathFromEnv(envWithDefault));
15344
+ envWithDefault[envPathInfo.key] = envPathInfo.value;
15345
+ return envWithDefault;
15346
+ }
15347
+ const combineStreams = (streams) => {
15348
+ let streamCount = streams.length;
15349
+ const combined = new PassThrough();
15350
+ const maybeEmitEnd = () => {
15351
+ if (--streamCount === 0) combined.end();
15352
+ };
15353
+ for (const stream of streams) pipeline(stream, combined, { end: false }).then(maybeEmitEnd).catch(maybeEmitEnd);
15354
+ return combined;
15355
+ };
15356
+ const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
15357
+ const shebangRegExp = /^#!\s*(.+)/;
15358
+ const isWindowsExecutableRegExp = /\.(?:com|exe)$/i;
15359
+ const isNodeModulesCmdRegExp = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i;
15360
+ const isWindows = process.platform === "win32";
15361
+ const defaultPathExt = [
15362
+ ".EXE",
15363
+ ".CMD",
15364
+ ".BAT",
15365
+ ".COM"
15366
+ ];
15367
+ const noPathExt = [""];
15368
+ /**
15369
+ * Normalizes the command and arguments to work cross-platform.
15370
+ * On Windows, this basically handles things like shebangs, calling
15371
+ * `node_modules/.bin` commands, and escaping meta characters.
15372
+ * On other platforms, it just returns the command and arguments as-is.
15373
+ */
15374
+ function normalizeSpawnCommand(command, args = [], options = {}) {
15375
+ if (options.shell === true || !isWindows) return {
15376
+ command,
15377
+ args,
15378
+ options
15379
+ };
15380
+ let file = resolveCommand(command, options);
15381
+ let shebang = null;
15382
+ if (file !== null) {
15383
+ const size = 150;
15384
+ const buffer = Buffer.alloc(size);
15385
+ let fd = null;
15386
+ try {
15387
+ fd = openSync(file, "r");
15388
+ readSync(fd, buffer, 0, size, 0);
15389
+ } catch {} finally {
15390
+ if (fd !== null) closeSync(fd);
15391
+ }
15392
+ const match = buffer.toString().match(shebangRegExp);
15393
+ if (match !== null) {
15394
+ const line = match[1].trim();
15395
+ const separatorIndex = line.indexOf(" ");
15396
+ const path = separatorIndex !== -1 ? line.slice(0, separatorIndex) : line;
15397
+ const argument = separatorIndex !== -1 ? line.slice(separatorIndex + 1) : "";
15398
+ const binary = basename(path);
15399
+ shebang = binary === "env" ? argument || null : binary;
15400
+ }
15401
+ }
15402
+ if (shebang !== null && file !== null) {
15403
+ args = [file, ...args];
15404
+ command = shebang;
15405
+ file = resolveCommand(command, options);
15406
+ }
15407
+ if (file === null || !isWindowsExecutableRegExp.test(file)) {
15408
+ const needsDoubleEscapeMetaChars = file !== null && isNodeModulesCmdRegExp.test(file);
15409
+ command = normalize(command);
15410
+ command = command.replace(metaCharsRegExp, "^$1");
15411
+ args = args.map((arg) => {
15412
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
15413
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
15414
+ arg = `"${arg}"`;
15415
+ arg = arg.replace(metaCharsRegExp, "^$1");
15416
+ if (needsDoubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
15417
+ return arg;
15418
+ });
15419
+ args = [
15420
+ "/d",
15421
+ "/s",
15422
+ "/c",
15423
+ `"${[command, ...args].join(" ")}"`
15424
+ ];
15425
+ command = options.env?.comspec ?? "cmd.exe";
15426
+ options = {
15427
+ ...options,
15428
+ windowsVerbatimArguments: true
15429
+ };
15430
+ }
15431
+ return {
15432
+ command,
15433
+ args,
15434
+ options
15435
+ };
15436
+ }
15437
+ /**
15438
+ * Resolves the command to an absolute path if possible.
15439
+ * Handles things like traversing PATH and adding extensions from PATHEXT
15440
+ */
15441
+ function resolveCommand(command, options) {
15442
+ const cwd$3 = (options.cwd ?? cwd()).toString();
15443
+ const env = options.env ?? process.env;
15444
+ const PATH = getPathFromEnv(env).value;
15445
+ const pathEnv = command.includes("/") || command.includes("\\") ? [""] : [cwd$3, ...PATH.split(delimiter)];
15446
+ let pathExt = env.PATHEXT ? env.PATHEXT.split(delimiter) : defaultPathExt;
15447
+ if (command.includes(".") && pathExt[0] !== "") pathExt = ["", ...pathExt];
15448
+ for (const extensions of [pathExt, noPathExt]) for (const path of pathEnv) {
15449
+ const unquoted = path.startsWith("\"") && path.endsWith("\"") && path.length > 1 ? path.slice(1, -1) : path;
15450
+ const dest = resolve(cwd$3, unquoted, command);
15451
+ for (const ext of extensions) {
15452
+ const destWithExt = dest + ext;
15453
+ try {
15454
+ if (statSync(destWithExt).isFile()) return destWithExt;
15455
+ } catch {}
15456
+ }
15457
+ }
15458
+ return null;
15459
+ }
15460
+ var NonZeroExitError = class extends Error {
15461
+ result;
15462
+ output;
15463
+ exitCode;
15464
+ get signalCode() {
15465
+ return this.result.signalCode;
15466
+ }
15467
+ constructor(result, output, command, args) {
15468
+ let target = "The process";
15469
+ if (command) target = `The command \`${args?.length ? `${command} ${args.map((a) => /[ "'`()]/.test(a) ? JSON.stringify(a) : a).join(" ")}` : command}\``;
15470
+ const exitCode = result.exitCode ?? 1;
15471
+ super(result.signalCode !== null ? `${target} was killed by the signal ${result.signalCode}` : `${target} exited with a non-zero status (${exitCode})`);
15472
+ this.result = result;
15473
+ this.output = output;
15474
+ this.exitCode = exitCode;
15475
+ Object.defineProperty(this, "result", {
15476
+ enumerable: false,
15477
+ writable: false,
15478
+ configurable: false
15479
+ });
15480
+ }
15481
+ };
15482
+ const defaultOptions = {
15483
+ timeout: void 0,
15484
+ persist: false
15485
+ };
15486
+ const defaultNodeOptions = { windowsHide: true };
15487
+ function combineSignals(signals) {
15488
+ const controller = new AbortController();
15489
+ for (const signal of signals) {
15490
+ if (signal.aborted) {
15491
+ controller.abort();
15492
+ return signal;
15493
+ }
15494
+ const onAbort = () => {
15495
+ controller.abort(signal.reason);
15496
+ };
15497
+ signal.addEventListener("abort", onAbort, { signal: controller.signal });
15498
+ }
15499
+ return controller.signal;
15500
+ }
15501
+ async function readStream(stream) {
15502
+ let output = "";
15503
+ try {
15504
+ for await (const chunk of stream) output += chunk.toString();
15505
+ } catch {}
15506
+ return output;
15507
+ }
15508
+ var ExecProcess = class {
15509
+ _process;
15510
+ _aborted = false;
15511
+ _options;
15512
+ _command;
15513
+ _args;
15514
+ _resolveClose;
15515
+ _processClosed;
15516
+ _thrownError;
15517
+ get process() {
15518
+ return this._process;
15519
+ }
15520
+ get pid() {
15521
+ return this._process?.pid;
15522
+ }
15523
+ get exitCode() {
15524
+ if (this._process && this._process.exitCode !== null) return this._process.exitCode;
15525
+ }
15526
+ get signalCode() {
15527
+ return this._process?.signalCode ?? null;
15528
+ }
15529
+ constructor(command, args, options) {
15530
+ this._options = {
15531
+ ...defaultOptions,
15532
+ ...options
15533
+ };
15534
+ this._command = command;
15535
+ this._args = args ?? [];
15536
+ this._processClosed = new Promise((resolve) => {
15537
+ this._resolveClose = resolve;
15538
+ });
15539
+ }
15540
+ kill(signal) {
15541
+ return this._process?.kill(signal) === true;
15542
+ }
15543
+ get aborted() {
15544
+ return this._aborted;
15545
+ }
15546
+ get killed() {
15547
+ return this._process?.killed === true;
15548
+ }
15549
+ pipe(command, args, options) {
15550
+ return exec$1(command, args, {
15551
+ ...options,
15552
+ stdin: this
15553
+ });
15554
+ }
15555
+ async *[Symbol.asyncIterator]() {
15556
+ const proc = this._process;
15557
+ if (!proc) return;
15558
+ const streams = [];
15559
+ if (this._streamErr) streams.push(this._streamErr);
15560
+ if (this._streamOut) streams.push(this._streamOut);
15561
+ const streamCombined = combineStreams(streams);
15562
+ const rl = readline.createInterface({ input: streamCombined });
15563
+ for await (const chunk of rl) yield chunk.toString();
15564
+ await this._processClosed;
15565
+ proc.removeAllListeners();
15566
+ if (this._thrownError) throw this._thrownError;
15567
+ if (this._options?.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, void 0, this._command, this._args);
15568
+ }
15569
+ async _waitForOutput() {
15570
+ const proc = this._process;
15571
+ if (!proc) throw new Error("No process was started");
15572
+ const [stdout, stderr] = await Promise.all([this._streamOut ? readStream(this._streamOut) : "", this._streamErr ? readStream(this._streamErr) : ""]);
15573
+ await this._processClosed;
15574
+ const { stdin } = this._options;
15575
+ if (stdin && typeof stdin !== "string") await stdin;
15576
+ proc.removeAllListeners();
15577
+ if (this._thrownError) throw this._thrownError;
15578
+ const result = {
15579
+ stderr,
15580
+ stdout,
15581
+ exitCode: this.exitCode
15582
+ };
15583
+ if (this._options.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, result, this._command, this._args);
15584
+ return result;
15585
+ }
15586
+ then(onfulfilled, onrejected) {
15587
+ return this._waitForOutput().then(onfulfilled, onrejected);
15588
+ }
15589
+ _streamOut;
15590
+ _streamErr;
15591
+ spawn() {
15592
+ const options = this._options;
15593
+ const nodeOptions = {
15594
+ ...defaultNodeOptions,
15595
+ ...options.nodeOptions
15596
+ };
15597
+ const cwd$1 = nodeOptions?.cwd ?? cwd();
15598
+ const signals = [];
15599
+ this._resetState();
15600
+ if (options.timeout !== void 0) signals.push(AbortSignal.timeout(options.timeout));
15601
+ if (options.signal !== void 0) signals.push(options.signal);
15602
+ if (options.persist === true) nodeOptions.detached = true;
15603
+ if (signals.length > 0) nodeOptions.signal = combineSignals(signals);
15604
+ nodeOptions.env = computeEnv(cwd$1, nodeOptions.env, options.nodePath);
15605
+ const crossResult = normalizeSpawnCommand(this._command, this._args, nodeOptions);
15606
+ const handle = spawn(crossResult.command, crossResult.args, crossResult.options);
15607
+ if (handle.stderr) this._streamErr = handle.stderr;
15608
+ if (handle.stdout) this._streamOut = handle.stdout;
15609
+ this._process = handle;
15610
+ handle.once("error", this._onError);
15611
+ handle.once("close", this._onClose);
15612
+ if (handle.stdin) {
15613
+ const { stdin } = options;
15614
+ if (typeof stdin === "string") handle.stdin.end(stdin);
15615
+ else stdin?.process?.stdout?.pipe(handle.stdin);
15616
+ }
15617
+ }
15618
+ _resetState() {
15619
+ this._aborted = false;
15620
+ this._processClosed = new Promise((resolve) => {
15621
+ this._resolveClose = resolve;
15622
+ });
15623
+ this._thrownError = void 0;
15624
+ }
15625
+ _onError = (err) => {
15626
+ if (err.name === "AbortError" && (!(err.cause instanceof Error) || err.cause.name !== "TimeoutError")) {
15627
+ this._aborted = true;
15628
+ return;
15629
+ }
15630
+ this._thrownError = err;
15631
+ };
15632
+ _onClose = () => {
15633
+ if (this._resolveClose) this._resolveClose();
15634
+ };
15635
+ };
15636
+ const x = (command, args, userOptions) => {
15637
+ const proc = new ExecProcess(command, args, userOptions);
15638
+ proc.spawn();
15639
+ return proc;
15640
+ };
15641
+ const exec$1 = x;
15642
+ //#endregion
15508
15643
  //#region src/node/server/openBrowser.ts
15509
15644
  /**
15510
15645
  * The following is modified based on source found in
@@ -15515,7 +15650,6 @@ defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
15515
15650
  * https://github.com/react/create-react-app/blob/main/LICENSE
15516
15651
  *
15517
15652
  */
15518
- var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
15519
15653
  /**
15520
15654
  * Reads the BROWSER environment variable and decides what to do with it.
15521
15655
  */
@@ -15526,12 +15660,12 @@ function openBrowser(url, opt, logger) {
15526
15660
  }
15527
15661
  function executeNodeScript(scriptPath, url, logger) {
15528
15662
  const extraArgs = process.argv.slice(2);
15529
- (0, import_cross_spawn.default)(process.execPath, [
15663
+ x(process.execPath, [
15530
15664
  scriptPath,
15531
15665
  ...extraArgs,
15532
15666
  url
15533
- ], { stdio: "inherit" }).on("close", (code) => {
15534
- if (code !== 0) logger.error(import_picocolors.default.red(`\nThe script specified as BROWSER environment variable failed.\n\n${import_picocolors.default.cyan(scriptPath)} exited with code ${code}.`), { error: null });
15667
+ ], { nodeOptions: { stdio: "inherit" } }).then(({ exitCode }) => {
15668
+ if (exitCode !== 0) logger.error(import_picocolors.default.red(`\nThe script specified as BROWSER environment variable failed.\n\n${import_picocolors.default.cyan(scriptPath)} exited with code ${exitCode}.`), { error: null });
15535
15669
  });
15536
15670
  }
15537
15671
  const supportedChromiumBrowsers = [
@@ -15770,8 +15904,9 @@ function ssrRewriteStacktrace(stack, moduleGraph) {
15770
15904
  let alreadyRewritten = false;
15771
15905
  return {
15772
15906
  result: stack.split("\n").map((line) => {
15773
- return line.replace(/^ {4}at (?:(\S.*?)\s\()?(.+?):(\d+)(?::(\d+))?\)?/, (input, varName, id, originalLine, originalColumn) => {
15774
- if (!id) return input;
15907
+ return line.replace(/^ {4}at (?:(\S.*?)\s\()?(.+?):(\d+)(?::(\d+))?\)?/, (input, varName, rawId, originalLine, originalColumn) => {
15908
+ if (!rawId) return input;
15909
+ const id = decodeSourceURL(rawId);
15775
15910
  const rawSourceMap = moduleGraph.getModuleById(id)?.transformResult?.map;
15776
15911
  if (!rawSourceMap) return input;
15777
15912
  const traced = new TraceMap(rawSourceMap);
@@ -16543,10 +16678,13 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
16543
16678
  let map;
16544
16679
  if (inMap?.mappings === "") map = inMap;
16545
16680
  else {
16546
- map = s.generateMap({ hires: "boundary" });
16547
- map.sources = [path.basename(url)];
16548
- map.sourcesContent = [originalCode];
16549
- if (inMap && inMap.mappings && "sources" in inMap && inMap.sources.length > 0) map = combineSourcemaps(url, [map, inMap]);
16681
+ const shouldCombine = !!(inMap && inMap.mappings && "sources" in inMap && inMap.sources.length > 0);
16682
+ const mapOptions = { hires: "boundary" };
16683
+ const nextMap = shouldCombine ? s.generateDecodedMap(mapOptions) : s.generateMap(mapOptions);
16684
+ nextMap.sources = [path.basename(url)];
16685
+ nextMap.sourcesContent = [originalCode];
16686
+ if (shouldCombine) map = combineSourcemaps(url, [nextMap, inMap]);
16687
+ else map = nextMap;
16550
16688
  }
16551
16689
  return {
16552
16690
  code: s.toString(),
@@ -17166,9 +17304,26 @@ async function createClientConfigValueReplacer(config) {
17166
17304
  const serverForwardConsoleReplacement = escapeReplacement(config.server.forwardConsole);
17167
17305
  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);
17168
17306
  }
17307
+ const ROLLDOWN_DEV_RUNTIME_ENTRY = "rolldown/experimental/runtime";
17169
17308
  async function getHmrImplementation(config) {
17170
17309
  const content = fs.readFileSync(normalizedBundledDevClientEntry, "utf-8");
17171
- return (await createClientConfigValueReplacer(config))(content).replace(/import\s*['"]@vite\/env['"]/, "");
17310
+ return (await createClientConfigValueReplacer(config))(content).replace(/import\s*['"]@vite\/env['"]/, "").replace(new RegExp(`(from\\s*['"])${ROLLDOWN_DEV_RUNTIME_ENTRY}(['"])`), (_, before, after) => `${before}${path.posix.join(config.base, BUNDLED_DEV_ROLLDOWN_RUNTIME_DIR, path.basename(rolldownDevRuntimeEntryPath()))}${after}`);
17311
+ }
17312
+ function rolldownDevRuntimeEntryPath() {
17313
+ return fileURLToPath(import.meta.resolve(ROLLDOWN_DEV_RUNTIME_ENTRY));
17314
+ }
17315
+ /**
17316
+ * The dev runtime must match the rolldown that generates the bundle, so it is read from the
17317
+ * installed package at serve time instead of being bundled into the client. The entry imports
17318
+ * its helper file with a relative path, so both are served under the same directory.
17319
+ */
17320
+ function getRolldownDevRuntimeFiles() {
17321
+ const entry = rolldownDevRuntimeEntryPath();
17322
+ const dir = path.dirname(entry);
17323
+ const files = /* @__PURE__ */ new Map();
17324
+ for (const name of fs.readdirSync(dir)) if (name.startsWith("experimental-runtime") && name.endsWith(".mjs")) files.set(`${BUNDLED_DEV_ROLLDOWN_RUNTIME_DIR}/${name}`, fs.readFileSync(path.join(dir, name), "utf-8"));
17325
+ if (!files.has(`@rolldown/${path.basename(entry)}`)) throw new Error(`rolldown dev runtime entry ${entry} was not found`);
17326
+ return files;
17172
17327
  }
17173
17328
  //#endregion
17174
17329
  //#region ../../node_modules/.pnpm/convert-source-map@2.0.0/node_modules/convert-source-map/index.js
@@ -17554,7 +17709,7 @@ function totalist(dir, callback, pre = "") {
17554
17709
  let i = 0, abs, stats;
17555
17710
  for (; i < arr.length; i++) {
17556
17711
  abs = join$1(dir, arr[i]);
17557
- stats = statSync(abs);
17712
+ stats = statSync$1(abs);
17558
17713
  stats.isDirectory() ? totalist(abs, callback, join$1(pre, arr[i])) : callback(join$1(pre, arr[i]), abs, stats);
17559
17714
  }
17560
17715
  }
@@ -17841,7 +17996,7 @@ function serveRawFsMiddleware(server) {
17841
17996
  const pathname = decodeURIIfPossible(url.pathname);
17842
17997
  if (pathname === void 0) return next();
17843
17998
  let newPathname = pathname.slice(FS_PREFIX.length);
17844
- if (isWindows) newPathname = newPathname.replace(/^[A-Z]:/i, "");
17999
+ if (isWindows$1) newPathname = newPathname.replace(/^[A-Z]:/i, "");
17845
18000
  url.pathname = encodeURI(newPathname);
17846
18001
  req.url = url.href.slice(url.origin.length);
17847
18002
  try {
@@ -17885,8 +18040,8 @@ function looksLikeWindowsShortNamePath(filePath) {
17885
18040
  function isFileLoadingAllowed(config, filePath) {
17886
18041
  const { fs } = config.server;
17887
18042
  if (!fs.strict) return true;
17888
- if (isWindows && looksLikeWindowsShortNamePath(filePath)) return false;
17889
- if ((isWindows && windowsDriveRE.test(filePath) ? filePath.slice(2) : filePath).includes(":")) return false;
18043
+ if (isWindows$1 && looksLikeWindowsShortNamePath(filePath)) return false;
18044
+ if ((isWindows$1 && windowsDriveRE.test(filePath) ? filePath.slice(2) : filePath).includes(":")) return false;
17890
18045
  const filePathWithoutTrailingSlash = filePath.endsWith("/") ? filePath.slice(0, -1) : filePath;
17891
18046
  if (config.fsDenyGlob(filePathWithoutTrailingSlash)) return false;
17892
18047
  if (config.safeModulePaths.has(filePath)) return true;
@@ -17952,8 +18107,9 @@ function createDevHtmlTransformFn(config) {
17952
18107
  };
17953
18108
  }
17954
18109
  function getHtmlFilename(url, server) {
17955
- if (url.startsWith(FS_PREFIX)) return decodeURIComponent(fsPathFromId(url));
17956
- 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))));
17957
18113
  }
17958
18114
  function shouldPreTransform(url, config) {
17959
18115
  return !checkPublicFile(url, config) && (isJSRequest(url) || isCSSRequest(url));
@@ -17965,6 +18121,7 @@ function isBareRelative(url) {
17965
18121
  function getHtmlDirnameForRelativeUrl(htmlPath) {
17966
18122
  return htmlPath.endsWith("/") ? htmlPath : path.posix.dirname(htmlPath);
17967
18123
  }
18124
+ const multipleLeadingSlashesRE = /^\/{2,}/g;
17968
18125
  const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, server, isClassicScriptLink) => {
17969
18126
  const replacer = (url) => {
17970
18127
  if (url[0] === "/" && url[1] !== "/" || (url[0] === "." || isBareRelative(url)) && originalUrl && originalUrl !== "/" && htmlPath === "/index.html") url = path.posix.join(config.base, url);
@@ -17990,6 +18147,7 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
17990
18147
  return useSrcSetReplacer ? processSrcSetSync(url, ({ url }) => replacer(url)) : replacer(url);
17991
18148
  };
17992
18149
  const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl }) => {
18150
+ if (htmlPath.startsWith("//")) htmlPath = htmlPath.replace(multipleLeadingSlashesRE, "/");
17993
18151
  const { config, watcher } = server;
17994
18152
  const base = config.base || "/";
17995
18153
  const decodedBase = config.decodedBase || "/";
@@ -19855,6 +20013,7 @@ function rejectInvalidRequestMiddleware() {
19855
20013
  //#endregion
19856
20014
  //#region src/node/server/middlewares/time.ts
19857
20015
  const logTime = createDebugger("vite:time");
20016
+ const isTimeDebugEnabled = logTime !== void 0;
19858
20017
  function timeMiddleware(root) {
19859
20018
  return function viteTimeMiddleware(req, res, next) {
19860
20019
  const start = performance$1.now();
@@ -20124,8 +20283,9 @@ const urlRE = /[?&]url\b/;
20124
20283
  const rawRE = /[?&]raw\b/;
20125
20284
  const inlineRE$3 = /[?&]inline\b/;
20126
20285
  const svgRE = /\.svg\b/;
20286
+ const wasmInstanceRE$1 = /[?&]vite-wasm-instance(?:&|$)/;
20127
20287
  function isServerAccessDeniedForTransform(config, id) {
20128
- 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";
20129
20289
  return false;
20130
20290
  }
20131
20291
  /**
@@ -20782,7 +20942,7 @@ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
20782
20942
  return searchForWorkspaceRoot(dir, root);
20783
20943
  }
20784
20944
  //#endregion
20785
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js
20945
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/constants.js
20786
20946
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20787
20947
  const BINARY_TYPES = [
20788
20948
  "nodebuffer",
@@ -20805,7 +20965,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20805
20965
  };
20806
20966
  }));
20807
20967
  //#endregion
20808
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/buffer-util.js
20968
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/buffer-util.js
20809
20969
  var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20810
20970
  const { EMPTY_BUFFER } = require_constants();
20811
20971
  const FastBuffer = Buffer[Symbol.species];
@@ -20905,7 +21065,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20905
21065
  } catch (e) {}
20906
21066
  }));
20907
21067
  //#endregion
20908
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/limiter.js
21068
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/limiter.js
20909
21069
  var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20910
21070
  const kDone = Symbol("kDone");
20911
21071
  const kRun = Symbol("kRun");
@@ -20956,7 +21116,7 @@ var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20956
21116
  module.exports = Limiter;
20957
21117
  }));
20958
21118
  //#endregion
20959
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/permessage-deflate.js
21119
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/permessage-deflate.js
20960
21120
  var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20961
21121
  const zlib$1 = __require("zlib");
20962
21122
  const bufferUtil = require_buffer_util();
@@ -21292,7 +21452,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
21292
21452
  }
21293
21453
  }));
21294
21454
  //#endregion
21295
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/validation.js
21455
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/validation.js
21296
21456
  var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21297
21457
  const { isUtf8 } = __require("buffer");
21298
21458
  const { hasBlob } = require_constants();
@@ -21488,7 +21648,7 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21488
21648
  } catch (e) {}
21489
21649
  }));
21490
21650
  //#endregion
21491
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/receiver.js
21651
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/receiver.js
21492
21652
  var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21493
21653
  const { Writable } = __require("stream");
21494
21654
  const PerMessageDeflate = require_permessage_deflate();
@@ -21951,7 +22111,7 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21951
22111
  module.exports = Receiver;
21952
22112
  }));
21953
22113
  //#endregion
21954
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/sender.js
22114
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/sender.js
21955
22115
  var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21956
22116
  const { Duplex: Duplex$3 } = __require("stream");
21957
22117
  const { randomFillSync } = __require("crypto");
@@ -22449,7 +22609,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
22449
22609
  }
22450
22610
  }));
22451
22611
  //#endregion
22452
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/event-target.js
22612
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/event-target.js
22453
22613
  var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
22454
22614
  const { kForOnEventAttribute, kListener } = require_constants();
22455
22615
  const kCode = Symbol("kCode");
@@ -22680,7 +22840,7 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
22680
22840
  }
22681
22841
  }));
22682
22842
  //#endregion
22683
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/extension.js
22843
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/extension.js
22684
22844
  var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
22685
22845
  const { tokenChars } = require_validation();
22686
22846
  /**
@@ -22826,7 +22986,7 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
22826
22986
  };
22827
22987
  }));
22828
22988
  //#endregion
22829
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket.js
22989
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/websocket.js
22830
22990
  var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
22831
22991
  const EventEmitter$2 = __require("events");
22832
22992
  const https = __require("https");
@@ -22886,11 +23046,16 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
22886
23046
  this._bufferedAmount = 0;
22887
23047
  this._isServer = false;
22888
23048
  this._redirects = 0;
22889
- if (protocols === void 0) protocols = [];
22890
- else if (!Array.isArray(protocols)) {
23049
+ if (protocols === void 0) {
23050
+ if (!options || options.protocols === void 0) protocols = [];
23051
+ else if (Array.isArray(options.protocols)) protocols = options.protocols;
23052
+ else protocols = [options.protocols];
23053
+ } else if (!Array.isArray(protocols)) {
22891
23054
  if (typeof protocols === "object" && protocols !== null) {
22892
23055
  options = protocols;
22893
- protocols = [];
23056
+ if (options.protocols === void 0) protocols = [];
23057
+ else if (Array.isArray(options.protocols)) protocols = options.protocols;
23058
+ else protocols = [options.protocols];
22894
23059
  } else protocols = [protocols];
22895
23060
  }
22896
23061
  initAsClient(this, address, protocols, options);
@@ -23080,12 +23245,12 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
23080
23245
  if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) this._socket.end();
23081
23246
  return;
23082
23247
  }
23083
- this._readyState = WebSocket.CLOSING;
23084
23248
  this._sender.close(code, data, !this._isServer, (err) => {
23085
23249
  if (err) return;
23086
23250
  this._closeFrameSent = true;
23087
23251
  if (this._closeFrameReceived || this._receiver._writableState.errorEmitted) this._socket.end();
23088
23252
  });
23253
+ this._readyState = WebSocket.CLOSING;
23089
23254
  setCloseTimer(this);
23090
23255
  }
23091
23256
  /**
@@ -23368,6 +23533,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
23368
23533
  socketPath: void 0,
23369
23534
  hostname: void 0,
23370
23535
  protocol: void 0,
23536
+ protocols: void 0,
23371
23537
  timeout: void 0,
23372
23538
  method: "GET",
23373
23539
  host: void 0,
@@ -23819,7 +23985,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
23819
23985
  }
23820
23986
  }));
23821
23987
  //#endregion
23822
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/stream.js
23988
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/stream.js
23823
23989
  var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
23824
23990
  require_websocket();
23825
23991
  const { Duplex: Duplex$1 } = __require("stream");
@@ -23935,7 +24101,7 @@ var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
23935
24101
  module.exports = createWebSocketStream;
23936
24102
  }));
23937
24103
  //#endregion
23938
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/subprotocol.js
24104
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/subprotocol.js
23939
24105
  var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
23940
24106
  const { tokenChars } = require_validation();
23941
24107
  /**
@@ -23974,7 +24140,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
23974
24140
  module.exports = { parse };
23975
24141
  }));
23976
24142
  //#endregion
23977
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket-server.js
24143
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/websocket-server.js
23978
24144
  var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
23979
24145
  const EventEmitter$1 = __require("events");
23980
24146
  const http = __require("http");
@@ -24655,6 +24821,9 @@ async function _createServer(inlineConfig = {}, options) {
24655
24821
  ...getEnvFilesForMode(config.mode, config.envDir),
24656
24822
  ...publicDir && publicFiles ? [publicDir] : []
24657
24823
  ], resolvedWatchOptions)) : createNoopWatcher(resolvedWatchOptions);
24824
+ watcher.on("error", (error) => {
24825
+ config.logger.error(import_picocolors.default.red(`file watcher error: ${error.message}`));
24826
+ });
24658
24827
  const environments = {};
24659
24828
  await Promise.all(Object.entries(config.environments).map(async ([name, environmentOptions]) => {
24660
24829
  const environment = await environmentOptions.dev.createEnvironment(name, config, { ws });
@@ -24664,6 +24833,7 @@ async function _createServer(inlineConfig = {}, options) {
24664
24833
  previousInstance: options.previousEnvironments?.[environment.name]
24665
24834
  });
24666
24835
  }));
24836
+ options.previousEnvironments = void 0;
24667
24837
  let moduleGraph = new ModuleGraph({
24668
24838
  client: () => environments.client.moduleGraph,
24669
24839
  ssr: () => environments.ssr.moduleGraph
@@ -24869,7 +25039,7 @@ async function _createServer(inlineConfig = {}, options) {
24869
25039
  if (!middlewareMode && httpServer) httpServer.once("listening", () => {
24870
25040
  serverConfig.port = httpServer.address().port;
24871
25041
  });
24872
- if (process.env.DEBUG) middlewares.use(timeMiddleware(root));
25042
+ if (isTimeDebugEnabled) middlewares.use(timeMiddleware(root));
24873
25043
  middlewares.use(rejectInvalidRequestMiddleware());
24874
25044
  const { cors } = serverConfig;
24875
25045
  if (cors !== false) middlewares.use((0, import_lib.default)(typeof cors === "boolean" ? {} : cors));
@@ -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)) {
@@ -26714,6 +26884,9 @@ const preloadMethod = `__vitePreload`;
26714
26884
  const preloadMarker = `__VITE_PRELOAD__`;
26715
26885
  const preloadHelperId = "\0vite/preload-helper.js";
26716
26886
  const preloadMarkerRE = new RegExp(preloadMarker, "g");
26887
+ function isCssPreloadUrl(url) {
26888
+ return url.pathname.endsWith(".css");
26889
+ }
26717
26890
  function toRelativePath(filename, importer) {
26718
26891
  const relPath = path.posix.relative(path.posix.dirname(importer), filename);
26719
26892
  return relPath[0] === "." ? relPath : `./${relPath}`;
@@ -26759,7 +26932,7 @@ function detectScriptRel() {
26759
26932
  function preload(baseModule, deps, importerUrl) {
26760
26933
  let promise = Promise.resolve();
26761
26934
  if (__VITE_IS_MODERN__ && deps && deps.length > 0) {
26762
- const links = document.getElementsByTagName("link");
26935
+ let preloadedHrefs;
26763
26936
  const cspNonceMeta = document.querySelector("meta[property=csp-nonce]");
26764
26937
  const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce");
26765
26938
  function allSettled(promises) {
@@ -26772,28 +26945,37 @@ function preload(baseModule, deps, importerUrl) {
26772
26945
  }))));
26773
26946
  }
26774
26947
  function importMetaResolve(specifier) {
26775
- if (import.meta.resolve) return import.meta.resolve(specifier);
26948
+ if (import.meta.resolve) return new URL(import.meta.resolve(specifier));
26776
26949
  return new URL(
26777
26950
  specifier,
26778
26951
  /** #__KEEP__ */
26779
26952
  import.meta.url
26780
- ).href;
26781
- }
26782
- promise = allSettled(deps.map((dep) => {
26783
- dep = assetsURL(dep, importerUrl);
26784
- dep = importMetaResolve(dep);
26785
- if (dep in seen) return;
26786
- seen[dep] = true;
26787
- const isCss = dep.endsWith(".css");
26788
- for (let i = links.length - 1; i >= 0; i--) {
26789
- const link = links[i];
26790
- if (link.href === dep && (!isCss || link.rel === "stylesheet")) return;
26953
+ );
26954
+ }
26955
+ promise = allSettled(deps.map((depString) => {
26956
+ depString = assetsURL(depString, importerUrl);
26957
+ const dep = importMetaResolve(depString);
26958
+ if (dep.href in seen) return;
26959
+ seen[dep.href] = true;
26960
+ const isCss = isCssPreloadUrl(dep);
26961
+ if (preloadedHrefs === void 0) {
26962
+ preloadedHrefs = {
26963
+ all: /* @__PURE__ */ new Set(),
26964
+ styles: /* @__PURE__ */ new Set()
26965
+ };
26966
+ const links = document.getElementsByTagName("link");
26967
+ for (let i = links.length - 1; i >= 0; i--) {
26968
+ const link = links[i];
26969
+ preloadedHrefs.all.add(link.href);
26970
+ if (link.rel === "stylesheet") preloadedHrefs.styles.add(link.href);
26971
+ }
26791
26972
  }
26973
+ if ((isCss ? preloadedHrefs.styles : preloadedHrefs.all).has(dep.href)) return;
26792
26974
  const link = document.createElement("link");
26793
26975
  link.rel = isCss ? "stylesheet" : scriptRel;
26794
26976
  if (!isCss) link.as = "script";
26795
26977
  link.crossOrigin = "";
26796
- link.href = dep;
26978
+ link.href = dep.href;
26797
26979
  if (cspNonce) link.setAttribute("nonce", cspNonce);
26798
26980
  document.head.appendChild(link);
26799
26981
  if (isCss) return new Promise((res, rej) => {
@@ -26821,7 +27003,7 @@ function getPreloadCode(environment, renderBuiltUrlBoolean, isRelativeBase) {
26821
27003
  const scriptRel = modulePreload && modulePreload.polyfill ? `'modulepreload'` : `/* @__PURE__ */ (${detectScriptRel.toString()})()`;
26822
27004
  const assetsURL = renderBuiltUrlBoolean || isRelativeBase ? `function(dep, importerUrl) { return new URL(dep, importerUrl).href }` : `function(dep) { return ${JSON.stringify(environment.config.base)}+dep }`;
26823
27005
  const preloadMethodCode = preload.toString().replaceAll("𝐢𝐦𝐩𝐨𝐫𝐭", "import");
26824
- return `const scriptRel = ${scriptRel};const assetsURL = ${assetsURL};const seen = {};export const ${preloadMethod} = ${preloadMethodCode}`;
27006
+ return `const scriptRel = ${scriptRel};const assetsURL = ${assetsURL};const seen = {};const isCssPreloadUrl = ${isCssPreloadUrl.toString()};export const ${preloadMethod} = ${preloadMethodCode}`;
26825
27007
  }
26826
27008
  /**
26827
27009
  * Build only. During serve this is performed as part of ./importAnalysis.
@@ -27021,7 +27203,7 @@ function buildImportAnalysisPlugin(config) {
27021
27203
  if (s.hasChanged()) {
27022
27204
  chunk.code = s.toString();
27023
27205
  if (buildSourcemap && chunk.map) {
27024
- const nextMap = s.generateMap({
27206
+ const nextMap = s.generateDecodedMap({
27025
27207
  source: chunk.fileName,
27026
27208
  hires: "boundary"
27027
27209
  });
@@ -27234,6 +27416,7 @@ function rolldownDepPlugin(environment, qualified, external) {
27234
27416
  return (kind.startsWith("require") ? _resolveRequire : _resolve)(environment, id, _importer);
27235
27417
  };
27236
27418
  const resolveResult = (id, resolved, kind) => {
27419
+ if (resolved === "__vite-browser-external") return { id: browserExternalId };
27237
27420
  if (resolved.startsWith("__vite-browser-external")) return { id: browserExternalNamespace + id };
27238
27421
  if (resolved.startsWith("__vite-optional-peer-dep")) return { id: optionalPeerDepNamespace + resolved };
27239
27422
  if (allExternalTypesReg.test(resolved)) return resolveAssets(resolved, kind);
@@ -27263,7 +27446,7 @@ function rolldownDepPlugin(environment, qualified, external) {
27263
27446
  const resolved = await resolve(id, importer, kind);
27264
27447
  if (resolved) {
27265
27448
  if (JS_TYPES_RE.test(resolved)) return {
27266
- id: isWindows ? resolved.replaceAll("/", "\\") : resolved,
27449
+ id: isWindows$1 ? resolved.replaceAll("/", "\\") : resolved,
27267
27450
  external: false
27268
27451
  };
27269
27452
  return resolveAssets(resolved, kind);
@@ -27303,8 +27486,13 @@ function rolldownDepPlugin(environment, qualified, external) {
27303
27486
  }
27304
27487
  },
27305
27488
  load: {
27306
- filter: { id: [prefixRegex(browserExternalNamespace), prefixRegex(optionalPeerDepNamespace)] },
27489
+ filter: { id: [
27490
+ exactRegex(browserExternalId),
27491
+ prefixRegex(browserExternalNamespace),
27492
+ prefixRegex(optionalPeerDepNamespace)
27493
+ ] },
27307
27494
  handler(id) {
27495
+ if (id === "__vite-browser-external") return { code: "module.exports = {}" };
27308
27496
  if (id.startsWith(browserExternalNamespace)) {
27309
27497
  const path = id.slice(17);
27310
27498
  if (isProduction) return { code: "module.exports = {}" };
@@ -27356,20 +27544,31 @@ function rolldownDepPlugin(environment, qualified, external) {
27356
27544
  }];
27357
27545
  }
27358
27546
  const matchesEntireLine = (text) => `^${escapeRegex(text)}$`;
27359
- function rolldownCjsExternalPlugin(externals, platform) {
27547
+ function rolldownCjsExternalPlugin(externals, platform, environment) {
27360
27548
  if (platform === "node") return;
27361
27549
  if (platform === "neutral") return;
27362
27550
  const filter = new RegExp(externals.map(matchesEntireLine).join("|"));
27551
+ const packageCache = /* @__PURE__ */ new Map();
27552
+ const resolveRequire = createBackCompatIdResolver(environment.getTopLevelConfig(), {
27553
+ asSrc: false,
27554
+ isRequire: true,
27555
+ scan: true,
27556
+ packageCache
27557
+ });
27363
27558
  return {
27364
27559
  name: "cjs-external",
27365
27560
  resolveId: {
27366
27561
  filter: { id: [prefixRegex(nonFacadePrefix), filter] },
27367
- handler(id, _importer, options) {
27562
+ async handler(id, importer, options) {
27368
27563
  if (id.startsWith(nonFacadePrefix)) return {
27369
27564
  id: id.slice(25),
27370
27565
  external: "absolute"
27371
27566
  };
27372
- if (options.kind === "require-call") return { id: cjsExternalFacadeNamespace + id };
27567
+ if (options.kind === "require-call") {
27568
+ const resolved = await resolveRequire(environment, id, importer).catch(() => void 0);
27569
+ if (resolved?.startsWith("__vite-optional-peer-dep")) return { id: optionalPeerDepNamespace + resolved };
27570
+ return { id: cjsExternalFacadeNamespace + id };
27571
+ }
27373
27572
  return {
27374
27573
  id,
27375
27574
  external: "absolute"
@@ -28323,7 +28522,7 @@ function runOptimizeDeps(environment, depsInfo) {
28323
28522
  fs.writeFileSync(dataPath, stringifyDepsOptimizerMetadata(metadata, depsCacheDir));
28324
28523
  const temporaryPath = depsCacheDir + getTempSuffix();
28325
28524
  const depsCacheDirPresent = fs.existsSync(depsCacheDir);
28326
- if (isWindows) {
28525
+ if (isWindows$1) {
28327
28526
  if (depsCacheDirPresent) {
28328
28527
  debug$4?.(import_picocolors.default.green(`renaming ${depsCacheDir} to ${temporaryPath}`));
28329
28528
  await safeRename(depsCacheDir, temporaryPath);
@@ -28430,7 +28629,7 @@ async function prepareRolldownOptimizerRun(environment, depsInfo, processingCach
28430
28629
  const exportsData = await (depsInfo[id].exportsData ?? extractExportsData(environment, src));
28431
28630
  if (exportsData.jsxLoader) jsxLoader = true;
28432
28631
  const flatId = flattenId(id);
28433
- flatIdDeps[flatId] = isWindows ? src.replaceAll("/", "\\") : src;
28632
+ flatIdDeps[flatId] = isWindows$1 ? src.replaceAll("/", "\\") : src;
28434
28633
  idToExports[id] = exportsData;
28435
28634
  }));
28436
28635
  if (optimizerContext.cancelled) return {
@@ -28444,7 +28643,7 @@ async function prepareRolldownOptimizerRun(environment, depsInfo, processingCach
28444
28643
  const platform = optimizeDeps.rolldownOptions?.platform ?? (environment.config.consumer === "client" || environment.config.ssr.target === "webworker" ? "browser" : "node");
28445
28644
  const external = [...optimizeDeps.exclude ?? []];
28446
28645
  const plugins = await asyncFlatten(arraify(pluginsFromConfig));
28447
- if (external.length) plugins.push(rolldownCjsExternalPlugin(external, platform));
28646
+ if (external.length) plugins.push(rolldownCjsExternalPlugin(external, platform, environment));
28448
28647
  plugins.push(...rolldownDepPlugin(environment, flatIdDeps, external));
28449
28648
  let canceled = false;
28450
28649
  async function build() {
@@ -29784,8 +29983,8 @@ function cssPostPlugin(config) {
29784
29983
  const relativePath = normalizePath(path.relative(cssAssetDirname, filename));
29785
29984
  return relativePath[0] === "." ? relativePath : "./" + relativePath;
29786
29985
  };
29787
- chunkCSS = chunkCSS.replace(assetUrlRE, (_, fileHash) => {
29788
- const filename = this.getFileName(fileHash);
29986
+ chunkCSS = chunkCSS.replace(assetUrlRE, (_, fileHash, urlId) => {
29987
+ const filename = this.getFileName(fileHash) + getAssetUrlPostfix(this.environment, urlId);
29789
29988
  chunk.viteMetadata.importedAssets.add(cleanUrl(filename));
29790
29989
  return encodeURIPath(toOutputFilePathInCss(filename, "asset", cssAssetName, "css", config, toRelative));
29791
29990
  });
@@ -30091,7 +30290,7 @@ function createCSSResolvers(config) {
30091
30290
  skipMainField: true
30092
30291
  });
30093
30292
  sassResolve = async (...args) => {
30094
- if (args[1].startsWith("file://")) args[1] = fileURLToPath(args[1], { windows: isWindows && !fileURLWithWindowsDriveRE.test(args[1]) ? false : void 0 });
30293
+ if (args[1].startsWith("file://")) args[1] = fileURLToPath(args[1], { windows: isWindows$1 && !fileURLWithWindowsDriveRE.test(args[1]) ? false : void 0 });
30095
30294
  return resolver(...args);
30096
30295
  };
30097
30296
  }
@@ -31612,7 +31811,7 @@ function buildHtmlPlugin(config) {
31612
31811
  const processedEncodedUrl = await processSrcSet(attr.value, async ({ url }) => {
31613
31812
  const decodedUrl = decodeURIIfPossible(url);
31614
31813
  if (decodedUrl !== void 0 && !isExcludedUrl(decodedUrl)) {
31615
- const result = await processAssetUrl(url, getLinkShouldInline(node, attr.attributes));
31814
+ const result = await processAssetUrl(decodedUrl, getLinkShouldInline(node, attr.attributes));
31616
31815
  return result !== decodedUrl ? encodeURIPath(result) : url;
31617
31816
  }
31618
31817
  return url;
@@ -31794,10 +31993,10 @@ function buildHtmlPlugin(config) {
31794
31993
  bundle,
31795
31994
  chunk
31796
31995
  });
31797
- result = result.replace(assetUrlRE, (_, fileHash) => {
31996
+ result = result.replace(assetUrlRE, (_, fileHash, urlId) => {
31798
31997
  const file = this.getFileName(fileHash);
31799
31998
  if (chunk) chunk.viteMetadata.importedAssets.add(cleanUrl(file));
31800
- return encodeURIPath(toOutputAssetFilePath(file));
31999
+ return encodeURIPath(toOutputAssetFilePath(file)) + getAssetUrlPostfix(this.environment, urlId);
31801
32000
  });
31802
32001
  result = result.replace(publicAssetUrlRE, (_, fileHash) => {
31803
32002
  const publicAssetPath = toOutputPublicAssetFilePath(getPublicAssetFilename(fileHash, config));
@@ -32128,7 +32327,7 @@ function getImportMap(bundle, options) {
32128
32327
  }
32129
32328
  //#endregion
32130
32329
  //#region src/node/plugins/asset.ts
32131
- const assetUrlRE = /__VITE_ASSET__([\w$]+)__/g;
32330
+ const assetUrlRE = /__VITE_ASSET__([\w$]{22})(?:_([a-f\d]{24}))?__/g;
32132
32331
  const encodedHashPlaceholderRE = /!~%7B([\w$]{1,17})%7D~/g;
32133
32332
  function unescapeHashPlaceholders(uri) {
32134
32333
  return uri.replace(encodedHashPlaceholderRE, "!~{$1}~");
@@ -32159,10 +32358,10 @@ function renderAssetUrlInJS(pluginContext, chunk, opts, code) {
32159
32358
  assetUrlRE.lastIndex = 0;
32160
32359
  while (match = assetUrlRE.exec(code)) {
32161
32360
  s ||= new MagicString(code);
32162
- const [full, referenceId] = match;
32361
+ const [full, referenceId, urlId] = match;
32163
32362
  const file = pluginContext.getFileName(referenceId);
32164
32363
  chunk.viteMetadata.importedAssets.add(cleanUrl(file));
32165
- const replacement = toOutputFilePathInJS(environment, file, "asset", chunk.fileName, "js", toRelativeRuntime);
32364
+ const replacement = toOutputFilePathInJS(environment, file + getAssetUrlPostfix(environment, urlId), "asset", chunk.fileName, "js", toRelativeRuntime);
32166
32365
  const replacementString = typeof replacement === "string" ? JSON.stringify(encodeURIPath(replacement)).slice(1, -1) : `"+${replacement.runtime}+"`;
32167
32366
  s.update(match.index, match.index + full.length, replacementString);
32168
32367
  }
@@ -32236,7 +32435,7 @@ function assetPlugin(config) {
32236
32435
  };
32237
32436
  }
32238
32437
  return {
32239
- code: `export default ${formatBuiltAsset(resolved, "js")}`,
32438
+ code: `export default ${formatBuiltAsset(resolved, "js", addFileUrlMetadataForAsset(this.environment, resolved, "js"))}`,
32240
32439
  moduleSideEffects: config.command === "build" && this.getModuleInfo(id)?.isEntry ? "no-treeshake" : false,
32241
32440
  meta: config.command === "build" ? { "vite:asset": true } : void 0,
32242
32441
  moduleType: "js"
@@ -32258,8 +32457,9 @@ function assetPlugin(config) {
32258
32457
  }
32259
32458
  files.add(cleanUrl(fileName));
32260
32459
  const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(format, environment.config.isWorker);
32261
- if ((urlId ? fileUrlMetadata.get(environment)?.get(urlId) : void 0)?.asFileUrl) return toRelativeRuntime(fileName, chunkId).runtime;
32262
- const replacement = toOutputFilePathInJS(environment, fileName, "asset", chunkId, "js", toRelativeRuntime);
32460
+ const metadata = urlId ? fileUrlMetadata.get(environment)?.get(urlId) : void 0;
32461
+ if (metadata?.asFileUrl) return toRelativeRuntime(fileName, chunkId).runtime;
32462
+ const replacement = toOutputFilePathInJS(environment, fileName + (metadata?.postfix ?? ""), "asset", chunkId, "js", toRelativeRuntime);
32263
32463
  return typeof replacement === "string" ? JSON.stringify(unescapeHashPlaceholders(encodeURIPath(replacement))) : replacement.runtime;
32264
32464
  },
32265
32465
  renderChunk(code, chunk, opts) {
@@ -32356,7 +32556,17 @@ function isGitLfsPlaceholder(content) {
32356
32556
  */
32357
32557
  async function fileToBuiltUrl(pluginContext, id, format, skipPublicCheck = false, forceInline, asFileUrl = false) {
32358
32558
  const resolved = await resolveBuiltAsset(pluginContext, id, skipPublicCheck, forceInline);
32359
- return formatBuiltAsset(resolved, format, resolved.type === "reference" && format === "js" && asFileUrl ? addFileUrlMetadata(pluginContext.environment, { asFileUrl }) : void 0);
32559
+ return formatBuiltAsset(resolved, format, addFileUrlMetadataForAsset(pluginContext.environment, resolved, format, asFileUrl));
32560
+ }
32561
+ function addFileUrlMetadataForAsset(environment, resolved, format, useFileUrl = false) {
32562
+ if (resolved.type !== "reference") return;
32563
+ const asFileUrl = format === "js" && useFileUrl;
32564
+ const { postfix } = resolved;
32565
+ if (!asFileUrl && !postfix) return;
32566
+ return addFileUrlMetadata(environment, {
32567
+ asFileUrl,
32568
+ postfix
32569
+ });
32360
32570
  }
32361
32571
  function addFileUrlMetadata(environment, metadata) {
32362
32572
  let metadataMap = fileUrlMetadata.get(environment);
@@ -32371,14 +32581,14 @@ function addFileUrlMetadata(environment, metadata) {
32371
32581
  metadataMap.set(urlId, metadata);
32372
32582
  return urlId;
32373
32583
  }
32584
+ function getAssetUrlPostfix(environment, urlId) {
32585
+ return urlId ? fileUrlMetadata.get(environment)?.get(urlId)?.postfix ?? "" : "";
32586
+ }
32374
32587
  /** Format a resolved asset as either a JS expression or a plain-text string. */
32375
32588
  function formatBuiltAsset(resolved, format, urlId) {
32376
32589
  if (resolved.type === "reference") {
32377
- if (format === "js") {
32378
- const base = urlId ? `import.meta.ROLLDOWN_FILE_URL_${resolved.referenceId}_${urlId}` : `import.meta.ROLLDOWN_FILE_URL_${resolved.referenceId}`;
32379
- return resolved.postfix ? `${base} + ${JSON.stringify(resolved.postfix)}` : base;
32380
- }
32381
- return `__VITE_ASSET__${resolved.referenceId}__${resolved.postfix}`;
32590
+ if (format === "js") return urlId ? `import.meta.ROLLDOWN_FILE_URL_${resolved.referenceId}_${urlId}` : `import.meta.ROLLDOWN_FILE_URL_${resolved.referenceId}`;
32591
+ return `__VITE_ASSET__${resolved.referenceId}${urlId ? `_${urlId}` : ""}__`;
32382
32592
  }
32383
32593
  return format === "js" ? JSON.stringify(encodeURIPath(resolved.value)) : resolved.value;
32384
32594
  }
@@ -32728,7 +32938,7 @@ function normalizeWindowsPath(input = "") {
32728
32938
  return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
32729
32939
  }
32730
32940
  const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
32731
- function cwd() {
32941
+ function cwd$1() {
32732
32942
  if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
32733
32943
  return "/";
32734
32944
  }
@@ -32737,7 +32947,7 @@ const resolve$2 = function(...arguments_) {
32737
32947
  let resolvedPath = "";
32738
32948
  let resolvedAbsolute = false;
32739
32949
  for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
32740
- const path = index >= 0 ? arguments_[index] : cwd();
32950
+ const path = index >= 0 ? arguments_[index] : cwd$1();
32741
32951
  if (!path || path.length === 0) continue;
32742
32952
  resolvedPath = `${path}/${resolvedPath}`;
32743
32953
  resolvedAbsolute = isAbsolute$2(path);
@@ -34073,9 +34283,10 @@ function terserPlugin(config) {
34073
34283
  return !!environment.config.build.minify;
34074
34284
  },
34075
34285
  async renderChunk(code, chunk, outputOptions) {
34076
- const usesOxcMinifier = (config.build.minify === true || config.build.minify === "oxc") && outputOptions.minify !== false;
34286
+ const minify = this.environment.config.build.minify;
34287
+ const usesOxcMinifier = (minify === true || minify === "oxc") && outputOptions.minify !== false;
34077
34288
  const minifyLegacyWithTerser = this.environment.config.isOutputOptionsForLegacyChunks?.(outputOptions) && !usesOxcMinifier;
34078
- if (config.build.minify !== "terser" && !minifyLegacyWithTerser) return null;
34289
+ if (minify !== "terser" && !minifyLegacyWithTerser) return null;
34079
34290
  worker ||= makeWorker();
34080
34291
  const terserPath = pathToFileURL(loadTerserPath(config.root)).href;
34081
34292
  try {
@@ -34362,6 +34573,11 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
34362
34573
  if (output.sourcemap) logger.warnOnce(import_picocolors.default.yellow("Vite does not support \"rolldownOptions.output.sourcemap\". Please use \"build.sourcemap\" instead."));
34363
34574
  const format = output.format || "es";
34364
34575
  const jsExt = ssr && !isSsrTargetWebworkerEnvironment || libOptions ? resolveOutputJsExtension(format, findNearestPackageData(root, packageCache)?.data.type) : "js";
34576
+ const resolvedMinify = options.minify === "oxc" ? libOptions && (format === "es" || format === "esm") ? {
34577
+ compress: true,
34578
+ mangle: true,
34579
+ codegen: false
34580
+ } : true : options.minify === false ? "dce-only" : false;
34365
34581
  return {
34366
34582
  dir: outDir,
34367
34583
  format,
@@ -34373,13 +34589,12 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
34373
34589
  chunkFileNames: libOptions ? `[name]-[hash].${jsExt}` : path.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
34374
34590
  assetFileNames: libOptions ? `[name].[ext]` : path.posix.join(options.assetsDir, `[name]-[hash].[ext]`),
34375
34591
  codeSplitting: output.codeSplitting ?? (output.format === "umd" || output.format === "iife" || isSsrTargetWebworkerEnvironment && (typeof input === "string" || Object.keys(input).length === 1) ? false : void 0),
34376
- minify: options.minify === "oxc" ? libOptions && (format === "es" || format === "esm") ? {
34377
- compress: true,
34378
- mangle: true,
34379
- codegen: false
34380
- } : true : options.minify === false ? "dce-only" : false,
34381
34592
  topLevelVar: true,
34382
34593
  ...output,
34594
+ minify: output.minify === void 0 ? resolvedMinify : typeof output.minify === "object" && typeof resolvedMinify === "object" ? {
34595
+ ...resolvedMinify,
34596
+ ...output.minify
34597
+ } : output.minify,
34383
34598
  comments: typeof output.comments === "boolean" ? output.comments : {
34384
34599
  annotation: !options.minify || libOptions && (format === "es" || format === "esm"),
34385
34600
  jsdoc: !options.minify,
@@ -35914,7 +36129,7 @@ function inlineSourceMap(mod, result, startOffset) {
35914
36129
  ...map,
35915
36130
  mappings: ";".repeat(startOffset) + map.mappings
35916
36131
  } : map;
35917
- result.code = `${code.trimEnd()}\n//# sourceURL=${mod.id}\n${MODULE_RUNNER_SOURCEMAPPING_SOURCE}\n//# ${SOURCEMAPPING_URL}=${genSourceMapUrl(sourceMap)}\n`;
36132
+ result.code = `${code.trimEnd()}\n//# sourceURL=${encodeSourceURL(mod.id)}\n${MODULE_RUNNER_SOURCEMAPPING_SOURCE}\n//# ${SOURCEMAPPING_URL}=${genSourceMapUrl(sourceMap)}\n`;
35918
36133
  return result;
35919
36134
  }
35920
36135
  //#endregion
@@ -35948,7 +36163,8 @@ var MemoryFiles = class {
35948
36163
  var BundledDev = class {
35949
36164
  environment;
35950
36165
  _devEngine;
35951
- viteRuntime;
36166
+ /** the vite client and the rolldown runtime; set before the first build so `hasBuildOutput` can count them */
36167
+ staticFiles = /* @__PURE__ */ new Map();
35952
36168
  initialBuildCompleted = false;
35953
36169
  _closed = false;
35954
36170
  clients = new Clients();
@@ -35982,12 +36198,13 @@ var BundledDev = class {
35982
36198
  }
35983
36199
  pendingPayloadFilenames = /* @__PURE__ */ new Set();
35984
36200
  get hasBuildOutput() {
35985
- return this.memoryFiles.size > 1 || this.memoryFiles.size === 1 && !this.memoryFiles.has("bundledDevClient.mjs");
36201
+ return this.memoryFiles.size > this.staticFiles.size;
35986
36202
  }
35987
36203
  async listen() {
35988
36204
  this._closed = false;
35989
36205
  debug$1?.("INITIAL: setup bundle options");
35990
36206
  const rolldownOptions = await this.getRolldownOptions();
36207
+ await this.storeStaticFiles();
35991
36208
  if (Array.isArray(rolldownOptions.output) && rolldownOptions.output.length > 1) throw new Error("multiple output options are not supported in dev mode");
35992
36209
  const outputOptions = Array.isArray(rolldownOptions.output) ? rolldownOptions.output[0] : rolldownOptions.output;
35993
36210
  this.environment.hot.on("vite:client-connected", async (payload, client) => {
@@ -36079,8 +36296,6 @@ var BundledDev = class {
36079
36296
  }, (e) => {
36080
36297
  debug$1?.("INITIAL: run error", e);
36081
36298
  });
36082
- this.viteRuntime = await getHmrImplementation(this.environment.getTopLevelConfig());
36083
- this.storeOutputFiles([]);
36084
36299
  this.waitForInitialBuildFinish().then(() => {
36085
36300
  if (this._closed) return;
36086
36301
  debug$1?.("INITIAL: build done");
@@ -36132,6 +36347,7 @@ var BundledDev = class {
36132
36347
  debug$1?.(`TRIGGER-LAZY: trigger lazy bundling for module ${moduleId} for client ${clientId}`);
36133
36348
  const result = await this.devEngine.compileEntry(moduleId, clientId);
36134
36349
  this.pendingPayloadFilenames.add(result.filename);
36350
+ if (result.sourcemapFilename && result.sourcemap) this.memoryFiles.set(`@vite/${result.sourcemapFilename}`, { source: result.sourcemap });
36135
36351
  return {
36136
36352
  filename: result.filename,
36137
36353
  code: result.code + payloadDeliveredAck(result.filename)
@@ -36154,11 +36370,19 @@ var BundledDev = class {
36154
36370
  await this._devEngine?.close();
36155
36371
  this.initialBuildCompleted = false;
36156
36372
  }
36373
+ async storeStaticFiles() {
36374
+ const sources = new Map([[BUNDLED_DEV_CLIENT_FILENAME, await getHmrImplementation(this.environment.getTopLevelConfig())], ...getRolldownDevRuntimeFiles()]);
36375
+ this.staticFiles.clear();
36376
+ for (const [fileName, source] of sources) {
36377
+ const file = {
36378
+ source,
36379
+ etag: (0, import_etag.default)(Buffer.from(source), { weak: true })
36380
+ };
36381
+ this.staticFiles.set(fileName, file);
36382
+ this.memoryFiles.set(fileName, file);
36383
+ }
36384
+ }
36157
36385
  storeOutputFiles(output) {
36158
- if (this.viteRuntime) this.memoryFiles.set(BUNDLED_DEV_CLIENT_FILENAME, {
36159
- source: this.viteRuntime,
36160
- etag: (0, import_etag.default)(Buffer.from(this.viteRuntime), { weak: true })
36161
- });
36162
36386
  for (const outputFile of output) this.memoryFiles.set(outputFile.fileName, () => {
36163
36387
  const source = outputFile.type === "chunk" ? outputFile.code : outputFile.source;
36164
36388
  return {