@voidzero-dev/vite-plus-core 1.0.0-rc.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/LICENSE +29 -176
  2. package/dist/rolldown/cli.mjs +9 -8
  3. package/dist/rolldown/config.d.mts +1 -1
  4. package/dist/rolldown/config.mjs +2 -2
  5. package/dist/rolldown/experimental-index.d.mts +4 -4
  6. package/dist/rolldown/experimental-index.mjs +8 -8
  7. package/dist/rolldown/experimental-runtime-types.d.ts +25 -6
  8. package/dist/rolldown/experimental-runtime.d.ts +25 -6
  9. package/dist/rolldown/experimental-runtime.mjs +267 -255
  10. package/dist/rolldown/filter-index.d.mts +1 -1
  11. package/dist/rolldown/index.d.mts +3 -3
  12. package/dist/rolldown/index.mjs +4 -4
  13. package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
  14. package/dist/rolldown/parallel-plugin.d.mts +1 -1
  15. package/dist/rolldown/parse-ast-index.d.mts +1 -1
  16. package/dist/rolldown/parse-ast-index.mjs +1 -1
  17. package/dist/rolldown/plugins-index.d.mts +3 -3
  18. package/dist/rolldown/plugins-index.mjs +2 -2
  19. package/dist/rolldown/shared/{binding-BY0qR5iS.mjs → binding-B4m_2rFW.mjs} +27 -28
  20. package/dist/rolldown/shared/{binding-BTa6BPQe.d.mts → binding-tzp6Hc_3.d.mts} +1 -1
  21. package/dist/rolldown/shared/{bindingify-input-options-B8JHmN6_.mjs → bindingify-input-options-YtcpaV3r.mjs} +196 -13
  22. package/dist/rolldown/shared/{constructors-DuOq7MqW.d.mts → constructors-CGQ9ItSV.d.mts} +2 -2
  23. package/dist/rolldown/shared/{constructors-xEvVj3lN.mjs → constructors-DDRbtWM1.mjs} +1 -1
  24. package/dist/rolldown/shared/{create-bundler-option-COco-7P6.mjs → create-bundler-option-CFtx335R.mjs} +17 -8
  25. package/dist/rolldown/shared/{define-config-C7HCoqY8.d.mts → define-config-kIZKjX8Q.d.mts} +72 -2
  26. package/dist/rolldown/shared/{error-C7pxws0W.mjs → error-Bj1xBdEY.mjs} +2 -1
  27. package/dist/rolldown/shared/{load-config-DkUBnDsI.mjs → load-config-CiFPv7UH.mjs} +2 -2
  28. package/dist/rolldown/shared/{normalize-string-or-regex-F14uvr6D.mjs → normalize-string-or-regex-xyy0kCQR.mjs} +1 -1
  29. package/dist/rolldown/shared/{parse-BWeE7Vr9.mjs → parse-Zii6QoPp.mjs} +2 -2
  30. package/dist/rolldown/shared/{resolve-tsconfig-DHwpIs5e.mjs → resolve-tsconfig-DRWFAQ3v.mjs} +2 -2
  31. package/dist/rolldown/shared/{rolldown-Bue0gNT5.mjs → rolldown-BCQsxZbq.mjs} +4 -4
  32. package/dist/rolldown/shared/{transform-DK_nCt9j.d.mts → transform-D4RDjIPI.d.mts} +1 -1
  33. package/dist/rolldown/shared/{watch-RXhXN1aG.mjs → watch-CXhrnblH.mjs} +4 -4
  34. package/dist/rolldown/utils-index.d.mts +3 -3
  35. package/dist/rolldown/utils-index.mjs +5 -5
  36. package/dist/tsdown/{build-JVmLFaZt-DRlLhpV3.js → build-JVmLFaZt-k6Y-YuG9.js} +8 -8
  37. package/dist/tsdown/{debug-CpC4hV25-C-OYr2iI.js → debug-CpC4hV25-D_60QWpz.js} +2 -2
  38. package/dist/tsdown/{detect-Bg-d8iUV-Du8LljhG.js → detect-Bg-d8iUV--_V5C4Db.js} +1 -1
  39. package/dist/tsdown/{dist-VDcV1Qyy.js → dist-DquISSoY.js} +8 -8
  40. package/dist/tsdown/index-types.d.ts +5 -5
  41. package/dist/tsdown/index.js +4 -4
  42. package/dist/tsdown/{require-BbBF8Ii0-BDaWJgzA.js → require-BbBF8Ii0-S6Y65RhW.js} +1 -1
  43. package/dist/tsdown/{resolver-DE0_sy8o-Bi3xbRxi.js → resolver-DE0_sy8o-Pz8aksn9.js} +2 -2
  44. package/dist/tsdown/run.js +3 -3
  45. package/dist/tsdown/{target-DgdLrXba-DpO9JXxB.js → target-DgdLrXba-BygiKCU8.js} +3 -3
  46. package/dist/tsdown/{tsc-BLb4pSBY.js → tsc-2xhsE0Bf.js} +4 -4
  47. package/dist/tsdown/tsdown-css.js +1 -1
  48. package/dist/tsdown/tsdown-exe.js +3 -3
  49. package/dist/tsdown/{version-CQ98ZBpL-D6GAHapk.js → version-CQ98ZBpL-CKvh-HCu.js} +1 -1
  50. package/dist/vite/client/bundledDevClient.mjs +75 -329
  51. package/dist/vite/client/client.mjs +74 -23
  52. package/dist/vite/node/chunks/node.js +883 -666
  53. package/dist/vite/node/index.d.ts +3 -1
  54. package/dist/vite/node/module-runner.js +16 -2
  55. package/package.json +38 -21
  56. package/dist/rolldown/experimental-default-runtime.mjs +0 -116
  57. package/dist/rolldown/experimental-runtime-base.mjs +0 -95
@@ -4,22 +4,22 @@ import { esmExternalRequirePlugin, esmExternalRequirePlugin as esmExternalRequir
4
4
  import { TsconfigCache, Visitor, minify, minifySync, parse, parseSync, transformSync } from "@voidzero-dev/vite-plus-core/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";
13
13
  import { MessageChannel, Worker } from "node:worker_threads";
14
14
  import { VERSION as rolldownVersion, rolldown } from "@voidzero-dev/vite-plus-core/rolldown";
15
15
  import * as nativeFs from "fs";
16
- import { readdir, readdirSync, realpath, realpathSync, stat, statSync } from "fs";
16
+ import { readdir, readdirSync, realpath, realpathSync, stat, statSync as statSync$1 } from "fs";
17
17
  import path$1, { basename as basename$1, dirname as dirname$1, isAbsolute as isAbsolute$1, join as join$1, normalize as normalize$1, posix as posix$1, relative as relative$1, resolve as resolve$1, sep as sep$1, win32 } from "path";
18
18
  import { fileURLToPath as fileURLToPath$1 } from "url";
19
19
  import { createRequire as createRequire$1 } from "module";
20
20
  import { dev, oxcRuntimePlugin, resolveTsconfig, scan, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteDynamicImportVarsPlugin, viteImportGlobPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWebWorkerPostPlugin } from "@voidzero-dev/vite-plus-core/rolldown/experimental";
21
21
  import readline from "node:readline";
22
- import childProcess, { exec, execFile, execSync } from "node:child_process";
22
+ import childProcess, { exec, execFile, execSync, spawn } from "node:child_process";
23
23
  import { promises } from "node:dns";
24
24
  import net from "node:net";
25
25
  import os from "node:os";
@@ -27,11 +27,13 @@ import { isatty } from "node:tty";
27
27
  import { exactRegex, makeIdFiltersToMatchWithQuery, prefixRegex, withFilter } from "@voidzero-dev/vite-plus-core/rolldown/filter";
28
28
  import { Buffer as Buffer$1 } from "node:buffer";
29
29
  import assert from "node:assert";
30
- import process$1 from "node:process";
30
+ import process$1, { cwd } from "node:process";
31
31
  import v8 from "node:v8";
32
32
  import { EventEmitter } from "node:events";
33
33
  import { STATUS_CODES, createServer, get } from "node:http";
34
34
  import { createServer as createServer$1, get as get$1 } from "node:https";
35
+ import { pipeline } from "node:stream/promises";
36
+ import { PassThrough } from "node:stream";
35
37
  import { ESModulesEvaluator, ModuleRunner, createNodeImportMeta } from "@voidzero-dev/vite-plus-core/module-runner";
36
38
  import * as qs from "node:querystring";
37
39
  import zlib from "zlib";
@@ -913,7 +915,7 @@ var require_scan$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
913
915
  }));
914
916
  //#endregion
915
917
  //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/parse.js
916
- var require_parse$4 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
918
+ var require_parse$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
917
919
  const constants = require_constants$4();
918
920
  const utils = require_utils$2();
919
921
  /**
@@ -1988,7 +1990,7 @@ var require_parse$4 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1988
1990
  //#region ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/picomatch.js
1989
1991
  var require_picomatch$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1990
1992
  const scan = require_scan$1();
1991
- const parse = require_parse$4();
1993
+ const parse = require_parse$3();
1992
1994
  const utils = require_utils$2();
1993
1995
  const constants = require_constants$4();
1994
1996
  const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
@@ -3059,7 +3061,7 @@ function formatPaths(paths, mapper) {
3059
3061
  if (mapper) for (let i = paths.length - 1; i >= 0; i--) paths[i] = mapper(paths[i]);
3060
3062
  return paths;
3061
3063
  }
3062
- const defaultOptions = {
3064
+ const defaultOptions$1 = {
3063
3065
  caseSensitiveMatch: true,
3064
3066
  debug: !!process.env.TINYGLOBBY_DEBUG,
3065
3067
  expandDirectories: true,
@@ -3068,7 +3070,7 @@ const defaultOptions = {
3068
3070
  };
3069
3071
  function getOptions(options) {
3070
3072
  const opts = Object.assign({}, options);
3071
- for (const key in defaultOptions) if (opts[key] === void 0) Object.assign(opts, { [key]: defaultOptions[key] });
3073
+ for (const key in defaultOptions$1) if (opts[key] === void 0) Object.assign(opts, { [key]: defaultOptions$1[key] });
3072
3074
  opts.cwd = (opts.cwd instanceof URL ? fileURLToPath$1(opts.cwd) : resolve$1(opts.cwd || process.cwd())).replace(BACKSLASHES, "/");
3073
3075
  opts.ignore = ensureStringArray(opts.ignore);
3074
3076
  opts.fs && (opts.fs = {
@@ -3077,7 +3079,7 @@ function getOptions(options) {
3077
3079
  realpath: opts.fs.realpath || realpath,
3078
3080
  realpathSync: opts.fs.realpathSync || realpathSync,
3079
3081
  stat: opts.fs.stat || stat,
3080
- statSync: opts.fs.statSync || statSync
3082
+ statSync: opts.fs.statSync || statSync$1
3081
3083
  });
3082
3084
  if (opts.debug) log$1("globbing with options:", opts);
3083
3085
  return opts;
@@ -3187,7 +3189,7 @@ const MODULE_RUNNER_SOURCEMAPPING_SOURCE = "//# sourceMappingSource=vite-generat
3187
3189
  const ERR_OUTDATED_OPTIMIZED_DEP = "ERR_OUTDATED_OPTIMIZED_DEP";
3188
3190
  //#endregion
3189
3191
  //#region ../../vite/packages/vite/src/shared/utils.ts
3190
- const isWindows = typeof process !== "undefined" && process.platform === "win32";
3192
+ const isWindows$1 = typeof process !== "undefined" && process.platform === "win32";
3191
3193
  /**
3192
3194
  * Prepend `/@id/` and replace null byte so the id is URL-safe.
3193
3195
  * This is prepended to resolved ids that are not valid browser
@@ -3233,6 +3235,25 @@ function promiseWithResolvers() {
3233
3235
  reject
3234
3236
  };
3235
3237
  }
3238
+ const whitespaceRE$1 = /\s/g;
3239
+ const percentEncodedRE = /(?:%[0-9a-f]{2})+/gi;
3240
+ const whitespaceOnlyRE = /^\s+$/;
3241
+ /** Percent-encodes whitespace, which terminates a `//# sourceURL=` value in V8. */
3242
+ function encodeSourceURL(id) {
3243
+ return id.replace(whitespaceRE$1, encodeURIComponent);
3244
+ }
3245
+ /** Reverses {@link encodeSourceURL}. */
3246
+ function decodeSourceURL(url) {
3247
+ return url.replace(percentEncodedRE, (match) => {
3248
+ let decoded;
3249
+ try {
3250
+ decoded = decodeURIComponent(match);
3251
+ } catch {
3252
+ return match;
3253
+ }
3254
+ return whitespaceOnlyRE.test(decoded) ? decoded : match;
3255
+ });
3256
+ }
3236
3257
  //#endregion
3237
3258
  //#region ../../vite/packages/vite/src/node/baseEnvironment.ts
3238
3259
  var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
@@ -3321,7 +3342,7 @@ var BaseEnvironment = class extends PartialEnvironment {
3321
3342
  };
3322
3343
  //#endregion
3323
3344
  //#region ../../vite/packages/vite/package.json
3324
- var version = "8.3.1";
3345
+ var version = "8.3.3";
3325
3346
  //#endregion
3326
3347
  //#region ../../vite/packages/vite/src/node/constants.ts
3327
3348
  const ROLLUP_HOOKS = [
@@ -3423,6 +3444,8 @@ const CLIENT_ENTRY = path.join(VITE_PACKAGE_DIR, "dist/vite/client/client.mjs");
3423
3444
  const BUNDLED_DEV_CLIENT_ENTRY = path.join(VITE_PACKAGE_DIR, "dist/vite/client/bundledDevClient.mjs");
3424
3445
  /** URL filename the bundled-dev server serves the vite client under */
3425
3446
  const BUNDLED_DEV_CLIENT_FILENAME = "bundledDevClient.mjs";
3447
+ /** URL directory the bundled-dev server serves rolldown's dev runtime files under */
3448
+ const BUNDLED_DEV_ROLLDOWN_RUNTIME_DIR = "@rolldown";
3426
3449
  const ENV_ENTRY = path.join(VITE_PACKAGE_DIR, "dist/vite/client/env.mjs");
3427
3450
  const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
3428
3451
  const KNOWN_ASSET_TYPES = [
@@ -4908,7 +4931,7 @@ function testCaseInsensitiveFS() {
4908
4931
  const isCaseInsensitiveFS = testCaseInsensitiveFS();
4909
4932
  const VOLUME_RE = /^[A-Z]:/i;
4910
4933
  function normalizePath(id) {
4911
- return path.posix.normalize(isWindows ? slash(id) : id);
4934
+ return path.posix.normalize(isWindows$1 ? slash(id) : id);
4912
4935
  }
4913
4936
  function fsPathFromId(id) {
4914
4937
  const fsPath = normalizePath(id.startsWith(FS_PREFIX) ? id.slice(FS_PREFIX.length) : id);
@@ -4980,7 +5003,7 @@ function removeUrlQuery(url) {
4980
5003
  }
4981
5004
  function injectQuery(url, queryToInject) {
4982
5005
  const { file, postfix } = splitFileAndPostfix(url);
4983
- return `${isWindows ? slash(file) : file}?${queryToInject}${postfix[0] === "?" ? `&${postfix.slice(1)}` : postfix}`;
5006
+ return `${isWindows$1 ? slash(file) : file}?${queryToInject}${postfix[0] === "?" ? `&${postfix.slice(1)}` : postfix}`;
4984
5007
  }
4985
5008
  const timestampRE = /(\?|&)t=\d{13}(?:&|$)/;
4986
5009
  function removeTimestampQuery(url) {
@@ -5221,7 +5244,7 @@ async function recursiveReaddir(dir) {
5221
5244
  return dirent.isDirectory() ? recursiveReaddir(res) : normalizePath(res);
5222
5245
  }))).flat(1);
5223
5246
  }
5224
- let safeRealpathSync = isWindows ? windowsSafeRealPathSync : fs.realpathSync.native;
5247
+ let safeRealpathSync = isWindows$1 ? windowsSafeRealPathSync : fs.realpathSync.native;
5225
5248
  const windowsNetworkMap = /* @__PURE__ */ new Map();
5226
5249
  function windowsMappedRealpathSync(path) {
5227
5250
  const realPath = fs.realpathSync.native(path);
@@ -9240,11 +9263,11 @@ var WorkerWithFallback = class {
9240
9263
  //#endregion
9241
9264
  //#region ../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js
9242
9265
  var require_src$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9243
- const path$13 = __require$1("path");
9244
- const fs$10 = __require$1("fs");
9266
+ const path$11 = __require$1("path");
9267
+ const fs$7 = __require$1("fs");
9245
9268
  const os$3 = __require$1("os");
9246
9269
  const url$2 = __require$1("url");
9247
- const fsReadFileAsync = fs$10.promises.readFile;
9270
+ const fsReadFileAsync = fs$7.promises.readFile;
9248
9271
  /** @type {(name: string, sync: boolean) => string[]} */
9249
9272
  function getDefaultSearchPlaces(name, sync) {
9250
9273
  return [
@@ -9273,7 +9296,7 @@ var require_src$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9273
9296
  * And on Windows, this will never happen. ('C:\build' -> 'C:')
9274
9297
  */
9275
9298
  function parentDir(p) {
9276
- return path$13.dirname(p) || path$13.sep;
9299
+ return path$11.dirname(p) || path$11.sep;
9277
9300
  }
9278
9301
  /** @type {import('./index').LoaderSync} */
9279
9302
  const jsonLoader = (_, content) => JSON.parse(content);
@@ -9333,7 +9356,7 @@ var require_src$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9333
9356
  }
9334
9357
  };
9335
9358
  conf.searchPlaces.forEach((place) => {
9336
- const key = path$13.extname(place) || "noExt";
9359
+ const key = path$11.extname(place) || "noExt";
9337
9360
  const loader = conf.loaders[key];
9338
9361
  if (!loader) throw new Error(`Missing loader for extension "${place}"`);
9339
9362
  if (typeof loader !== "function") throw new Error(`Loader for extension "${place}" is not a function: Received ${typeof loader}.`);
@@ -9385,14 +9408,14 @@ var require_src$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9385
9408
  visited.add(dir);
9386
9409
  }
9387
9410
  for (const searchPlace of searchPlaces) {
9388
- const filepath = path$13.join(dir, searchPlace);
9411
+ const filepath = path$11.join(dir, searchPlace);
9389
9412
  try {
9390
- await fs$10.promises.access(filepath);
9413
+ await fs$7.promises.access(filepath);
9391
9414
  } catch {
9392
9415
  continue;
9393
9416
  }
9394
9417
  const content = String(await fsReadFileAsync(filepath));
9395
- const loaderKey = path$13.extname(searchPlace) || "noExt";
9418
+ const loaderKey = path$11.extname(searchPlace) || "noExt";
9396
9419
  const loader = loaders[loaderKey];
9397
9420
  if (searchPlace === "package.json") {
9398
9421
  const pkg = await loader(filepath, content);
@@ -9425,9 +9448,9 @@ var require_src$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9425
9448
  },
9426
9449
  async load(filepath) {
9427
9450
  validateFilePath(filepath);
9428
- const absPath = path$13.resolve(process.cwd(), filepath);
9451
+ const absPath = path$11.resolve(process.cwd(), filepath);
9429
9452
  if (cache && loadCache.has(absPath)) return loadCache.get(absPath);
9430
- const { base, ext } = path$13.parse(absPath);
9453
+ const { base, ext } = path$11.parse(absPath);
9431
9454
  const loaderKey = ext || "noExt";
9432
9455
  const loader = loaders[loaderKey];
9433
9456
  validateLoader(loader, loaderKey);
@@ -9497,15 +9520,15 @@ var require_src$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9497
9520
  visited.add(dir);
9498
9521
  }
9499
9522
  for (const searchPlace of searchPlaces) {
9500
- const filepath = path$13.join(dir, searchPlace);
9523
+ const filepath = path$11.join(dir, searchPlace);
9501
9524
  try {
9502
- fs$10.accessSync(filepath);
9525
+ fs$7.accessSync(filepath);
9503
9526
  } catch {
9504
9527
  continue;
9505
9528
  }
9506
- const loaderKey = path$13.extname(searchPlace) || "noExt";
9529
+ const loaderKey = path$11.extname(searchPlace) || "noExt";
9507
9530
  const loader = loaders[loaderKey];
9508
- const content = String(fs$10.readFileSync(filepath));
9531
+ const content = String(fs$7.readFileSync(filepath));
9509
9532
  if (searchPlace === "package.json") {
9510
9533
  const pkg = loader(filepath, content);
9511
9534
  const maybeConfig = getPackageProp(packageProp, pkg);
@@ -9537,13 +9560,13 @@ var require_src$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9537
9560
  },
9538
9561
  load(filepath) {
9539
9562
  validateFilePath(filepath);
9540
- const absPath = path$13.resolve(process.cwd(), filepath);
9563
+ const absPath = path$11.resolve(process.cwd(), filepath);
9541
9564
  if (cache && loadCache.has(absPath)) return loadCache.get(absPath);
9542
- const { base, ext } = path$13.parse(absPath);
9565
+ const { base, ext } = path$11.parse(absPath);
9543
9566
  const loaderKey = ext || "noExt";
9544
9567
  const loader = loaders[loaderKey];
9545
9568
  validateLoader(loader, loaderKey);
9546
- const content = String(fs$10.readFileSync(absPath));
9569
+ const content = String(fs$7.readFileSync(absPath));
9547
9570
  if (base === "package.json") {
9548
9571
  const pkg = loader(absPath, content);
9549
9572
  return transform({
@@ -11899,7 +11922,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11899
11922
  //#endregion
11900
11923
  //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js
11901
11924
  var require_constants$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11902
- const path$12 = __require$1("path");
11925
+ const path$10 = __require$1("path");
11903
11926
  const WIN_SLASH = "\\\\/";
11904
11927
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
11905
11928
  /**
@@ -12020,7 +12043,7 @@ var require_constants$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12020
12043
  CHAR_UNDERSCORE: 95,
12021
12044
  CHAR_VERTICAL_LINE: 124,
12022
12045
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
12023
- SEP: path$12.sep,
12046
+ SEP: path$10.sep,
12024
12047
  /**
12025
12048
  * Create EXTGLOB_CHARS
12026
12049
  */
@@ -12064,7 +12087,7 @@ var require_constants$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12064
12087
  //#endregion
12065
12088
  //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js
12066
12089
  var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
12067
- const path$11 = __require$1("path");
12090
+ const path$9 = __require$1("path");
12068
12091
  const win32 = process.platform === "win32";
12069
12092
  const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants$3();
12070
12093
  exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
@@ -12084,7 +12107,7 @@ var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
12084
12107
  };
12085
12108
  exports.isWindows = (options) => {
12086
12109
  if (options && typeof options.windows === "boolean") return options.windows;
12087
- return win32 === true || path$11.sep === "\\";
12110
+ return win32 === true || path$9.sep === "\\";
12088
12111
  };
12089
12112
  exports.escapeLast = (input, char, lastIdx) => {
12090
12113
  const idx = input.lastIndexOf(char, lastIdx);
@@ -12395,7 +12418,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12395
12418
  }));
12396
12419
  //#endregion
12397
12420
  //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js
12398
- var require_parse$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12421
+ var require_parse$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12399
12422
  const constants = require_constants$3();
12400
12423
  const utils = require_utils$1();
12401
12424
  /**
@@ -13256,9 +13279,9 @@ var require_parse$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13256
13279
  //#endregion
13257
13280
  //#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js
13258
13281
  var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13259
- const path$10 = __require$1("path");
13282
+ const path$8 = __require$1("path");
13260
13283
  const scan = require_scan();
13261
- const parse = require_parse$3();
13284
+ const parse = require_parse$2();
13262
13285
  const utils = require_utils$1();
13263
13286
  const constants = require_constants$3();
13264
13287
  const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
@@ -13394,7 +13417,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13394
13417
  * @api public
13395
13418
  */
13396
13419
  picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
13397
- return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$10.basename(input));
13420
+ return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$8.basename(input));
13398
13421
  };
13399
13422
  /**
13400
13423
  * Returns true if **any** of the given glob `patterns` match the specified `string`.
@@ -13551,15 +13574,15 @@ var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13551
13574
  //#endregion
13552
13575
  //#region ../../node_modules/.pnpm/readdirp@3.6.0/node_modules/readdirp/index.js
13553
13576
  var require_readdirp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13554
- const fs$9 = __require$1("fs");
13577
+ const fs$6 = __require$1("fs");
13555
13578
  const { Readable: Readable$1 } = __require$1("stream");
13556
13579
  const sysPath$3 = __require$1("path");
13557
13580
  const { promisify: promisify$4 } = __require$1("util");
13558
13581
  const picomatch = require_picomatch();
13559
- const readdir = promisify$4(fs$9.readdir);
13560
- const stat = promisify$4(fs$9.stat);
13561
- const lstat = promisify$4(fs$9.lstat);
13562
- const realpath = promisify$4(fs$9.realpath);
13582
+ const readdir = promisify$4(fs$6.readdir);
13583
+ const stat = promisify$4(fs$6.stat);
13584
+ const lstat = promisify$4(fs$6.lstat);
13585
+ const realpath = promisify$4(fs$6.realpath);
13563
13586
  /**
13564
13587
  * @typedef {Object} EntryInfo
13565
13588
  * @property {String} path
@@ -13653,7 +13676,7 @@ var require_readdirp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13653
13676
  ].includes(type);
13654
13677
  this._wantsEverything = type === EVERYTHING_TYPE;
13655
13678
  this._root = sysPath$3.resolve(root);
13656
- this._isDirent = "Dirent" in fs$9 && !opts.alwaysStat;
13679
+ this._isDirent = "Dirent" in fs$6 && !opts.alwaysStat;
13657
13680
  this._statsProp = this._isDirent ? "dirent" : "stats";
13658
13681
  this._rdOptions = {
13659
13682
  encoding: "utf8",
@@ -14702,7 +14725,7 @@ var require_constants$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14702
14725
  }));
14703
14726
  //#endregion
14704
14727
  //#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js
14705
- var require_parse$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14728
+ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14706
14729
  const stringify = require_stringify();
14707
14730
  /**
14708
14731
  * Constants
@@ -14993,7 +15016,7 @@ var require_braces = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14993
15016
  const stringify = require_stringify();
14994
15017
  const compile = require_compile();
14995
15018
  const expand = require_expand();
14996
- const parse = require_parse$2();
15019
+ const parse = require_parse$1();
14997
15020
  /**
14998
15021
  * Expand the given pattern or create a regex-compatible string.
14999
15022
  *
@@ -15389,10 +15412,10 @@ var require_binary_extensions = /* @__PURE__ */ __commonJSMin(((exports, module)
15389
15412
  //#endregion
15390
15413
  //#region ../../node_modules/.pnpm/is-binary-path@2.1.0/node_modules/is-binary-path/index.js
15391
15414
  var require_is_binary_path = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15392
- const path$9 = __require$1("path");
15415
+ const path$7 = __require$1("path");
15393
15416
  const binaryExtensions = require_binary_extensions();
15394
15417
  const extensions = new Set(binaryExtensions);
15395
- module.exports = (filePath) => extensions.has(path$9.extname(filePath).slice(1).toLowerCase());
15418
+ module.exports = (filePath) => extensions.has(path$7.extname(filePath).slice(1).toLowerCase());
15396
15419
  }));
15397
15420
  //#endregion
15398
15421
  //#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/constants.js
@@ -15461,17 +15484,17 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
15461
15484
  //#endregion
15462
15485
  //#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/nodefs-handler.js
15463
15486
  var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15464
- const fs$8 = __require$1("fs");
15487
+ const fs$5 = __require$1("fs");
15465
15488
  const sysPath$2 = __require$1("path");
15466
15489
  const { promisify: promisify$3 } = __require$1("util");
15467
15490
  const isBinaryPath = require_is_binary_path();
15468
15491
  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();
15469
15492
  const THROTTLE_MODE_WATCH = "watch";
15470
- const open = promisify$3(fs$8.open);
15471
- const stat = promisify$3(fs$8.stat);
15472
- const lstat = promisify$3(fs$8.lstat);
15473
- const close = promisify$3(fs$8.close);
15474
- const fsrealpath = promisify$3(fs$8.realpath);
15493
+ const open = promisify$3(fs$5.open);
15494
+ const stat = promisify$3(fs$5.stat);
15495
+ const lstat = promisify$3(fs$5.lstat);
15496
+ const close = promisify$3(fs$5.close);
15497
+ const fsrealpath = promisify$3(fs$5.realpath);
15475
15498
  const statMethods = {
15476
15499
  lstat,
15477
15500
  stat
@@ -15527,7 +15550,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
15527
15550
  if (evPath && path !== evPath) fsWatchBroadcast(sysPath$2.resolve(path, evPath), KEY_LISTENERS, sysPath$2.join(path, evPath));
15528
15551
  };
15529
15552
  try {
15530
- return fs$8.watch(path, options, handleEvent);
15553
+ return fs$5.watch(path, options, handleEvent);
15531
15554
  } catch (error) {
15532
15555
  errHandler(error);
15533
15556
  }
@@ -15617,7 +15640,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
15617
15640
  let cont = FsWatchFileInstances.get(fullPath);
15618
15641
  const copts = cont && cont.options;
15619
15642
  if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
15620
- fs$8.unwatchFile(fullPath);
15643
+ fs$5.unwatchFile(fullPath);
15621
15644
  cont = void 0;
15622
15645
  }
15623
15646
  if (cont) {
@@ -15628,7 +15651,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
15628
15651
  listeners: listener,
15629
15652
  rawEmitters: rawEmitter,
15630
15653
  options,
15631
- watcher: fs$8.watchFile(fullPath, options, (curr, prev) => {
15654
+ watcher: fs$5.watchFile(fullPath, options, (curr, prev) => {
15632
15655
  foreach(cont.rawEmitters, (rawEmitter) => {
15633
15656
  rawEmitter(EV_CHANGE, fullPath, {
15634
15657
  curr,
@@ -15646,7 +15669,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
15646
15669
  delFromSet(cont, KEY_RAW, rawEmitter);
15647
15670
  if (isEmptySet(cont.listeners)) {
15648
15671
  FsWatchFileInstances.delete(fullPath);
15649
- fs$8.unwatchFile(fullPath);
15672
+ fs$5.unwatchFile(fullPath);
15650
15673
  cont.options = cont.watcher = void 0;
15651
15674
  Object.freeze(cont);
15652
15675
  }
@@ -15919,7 +15942,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
15919
15942
  //#endregion
15920
15943
  //#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/fsevents-handler.js
15921
15944
  var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15922
- const fs$7 = __require$1("fs");
15945
+ const fs$4 = __require$1("fs");
15923
15946
  const sysPath$1 = __require$1("path");
15924
15947
  const { promisify: promisify$2 } = __require$1("util");
15925
15948
  let fsevents;
@@ -15936,9 +15959,9 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
15936
15959
  }
15937
15960
  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();
15938
15961
  const Depth = (value) => isNaN(value) ? {} : { depth: value };
15939
- const stat = promisify$2(fs$7.stat);
15940
- const lstat = promisify$2(fs$7.lstat);
15941
- const realpath = promisify$2(fs$7.realpath);
15962
+ const stat = promisify$2(fs$4.stat);
15963
+ const lstat = promisify$2(fs$4.lstat);
15964
+ const realpath = promisify$2(fs$4.realpath);
15942
15965
  const statMethods = {
15943
15966
  stat,
15944
15967
  lstat
@@ -16258,7 +16281,7 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
16258
16281
  //#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/index.js
16259
16282
  var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
16260
16283
  const { EventEmitter: EventEmitter$4 } = __require$1("events");
16261
- const fs$6 = __require$1("fs");
16284
+ const fs$3 = __require$1("fs");
16262
16285
  const sysPath = __require$1("path");
16263
16286
  const { promisify: promisify$1 } = __require$1("util");
16264
16287
  const readdirp = require_readdirp();
@@ -16270,8 +16293,8 @@ var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
16270
16293
  const NodeFsHandler = require_nodefs_handler();
16271
16294
  const FsEventsHandler = require_fsevents_handler();
16272
16295
  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();
16273
- const stat = promisify$1(fs$6.stat);
16274
- const readdir = promisify$1(fs$6.readdir);
16296
+ const stat = promisify$1(fs$3.stat);
16297
+ const readdir = promisify$1(fs$3.readdir);
16275
16298
  /**
16276
16299
  * @typedef {String} Path
16277
16300
  * @typedef {'all'|'add'|'addDir'|'change'|'unlink'|'unlinkDir'|'raw'|'error'|'ready'} EventName
@@ -16759,7 +16782,7 @@ var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
16759
16782
  if (this.options.cwd && !sysPath.isAbsolute(path)) fullPath = sysPath.join(this.options.cwd, path);
16760
16783
  const now = /* @__PURE__ */ new Date();
16761
16784
  const awaitWriteFinish = (prevStat) => {
16762
- fs$6.stat(fullPath, (err, curStat) => {
16785
+ fs$3.stat(fullPath, (err, curStat) => {
16763
16786
  if (err || !this._pendingWrites.has(path)) {
16764
16787
  if (err && err.code !== "ENOENT") awfEmit(err);
16765
16788
  return;
@@ -18816,18 +18839,29 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18816
18839
  })();
18817
18840
  }));
18818
18841
  //#endregion
18819
- //#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/quote.js
18842
+ //#region ../../node_modules/.pnpm/shell-quote@1.12.0/node_modules/shell-quote/quote.js
18820
18843
  var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18844
+ /** @import { ControlOperator } from './parse' */
18845
+ /** @type {ControlOperator['op'][]} */
18821
18846
  var OPS = [
18822
18847
  "||",
18823
18848
  "&&",
18849
+ ";;&",
18824
18850
  ";;",
18851
+ ";&",
18825
18852
  "|&",
18826
18853
  "<(",
18854
+ ">(",
18827
18855
  "<<<",
18856
+ "<<-",
18857
+ "<<",
18828
18858
  ">>",
18829
18859
  ">&",
18860
+ ">|",
18861
+ "&>>",
18862
+ "&>",
18830
18863
  "<&",
18864
+ "<>",
18831
18865
  "&",
18832
18866
  ";",
18833
18867
  "(",
@@ -18837,51 +18871,70 @@ var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18837
18871
  ">"
18838
18872
  ];
18839
18873
  var LINE_TERMINATORS = /[\n\r\u2028\u2029]/;
18840
- var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|]/g;
18874
+ var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|~]/g;
18875
+ /** @type {typeof import('./quote')} */
18841
18876
  module.exports = function quote(xs) {
18877
+ var sawComment = false;
18842
18878
  return xs.map(function(s) {
18879
+ if (sawComment && typeof s === "string" && LINE_TERMINATORS.test(s)) throw new TypeError("a token after a `comment` must not contain line terminators");
18843
18880
  if (s === "") return "''";
18844
18881
  if (s && typeof s === "object") {
18845
- if (s.op === "glob") {
18882
+ if ("op" in s && s.op === "glob") {
18846
18883
  if (typeof s.pattern !== "string") throw new TypeError("glob token requires a string `pattern`");
18847
18884
  if (LINE_TERMINATORS.test(s.pattern)) throw new TypeError("glob `pattern` must not contain line terminators");
18885
+ if (s.pattern === "") return "''";
18848
18886
  return s.pattern.replace(GLOB_SHELL_SPECIAL, "\\$&");
18849
18887
  }
18850
- if (typeof s.op === "string") {
18888
+ if ("op" in s && typeof s.op === "string") {
18851
18889
  if (OPS.indexOf(s.op) < 0) throw new TypeError("invalid `op` value: " + JSON.stringify(s.op));
18852
18890
  return s.op.replace(/[\s\S]/g, "\\$&");
18853
18891
  }
18854
- if (typeof s.comment === "string") {
18892
+ if ("comment" in s && typeof s.comment === "string") {
18855
18893
  if (LINE_TERMINATORS.test(s.comment)) throw new TypeError("`comment` must not contain line terminators");
18894
+ sawComment = true;
18856
18895
  return "#" + s.comment;
18857
18896
  }
18858
18897
  throw new TypeError("unrecognized object token shape");
18859
18898
  }
18860
- if (/["\s\\]/.test(s) && !/'/.test(s)) return "'" + s.replace(/(['])/g, "\\$1") + "'";
18861
- if (/["'\s]/.test(s)) return "\"" + s.replace(/(["\\$`!])/g, "\\$1") + "\"";
18862
- return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, "$1\\$2");
18899
+ if (/'/.test(s) && /!/.test(s)) return "'" + s.replace(/'/g, "'\"'\"'") + "'";
18900
+ if (/["\s\\]/.test(s) && !/'/.test(s)) return "'" + s + "'";
18901
+ if (/["'\s]/.test(s)) return "\"" + s.replace(/(["\\$`])/g, "\\$1") + "\"";
18902
+ return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g, "$1\\$2");
18863
18903
  }).join(" ");
18864
18904
  };
18865
18905
  }));
18866
18906
  //#endregion
18867
- //#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/parse.js
18868
- var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18907
+ //#region ../../node_modules/.pnpm/shell-quote@1.12.0/node_modules/shell-quote/parse.js
18908
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18909
+ /**
18910
+ * @import {
18911
+ * ControlOperator,
18912
+ * Env,
18913
+ * GlobPattern,
18914
+ * ParseEntry,
18915
+ * } from './parse' */
18869
18916
  var CONTROL = "(?:" + [
18870
18917
  "\\|\\|",
18871
- "\\&\\&",
18872
- ";;",
18873
- "\\|\\&",
18918
+ "\\&(?:\\&|>>?)",
18919
+ ";;\\&?",
18920
+ "[;|]\\&",
18874
18921
  "\\<\\(",
18875
18922
  "\\<\\<\\<",
18923
+ "\\<\\<-",
18924
+ "\\<\\<(?!\\()",
18876
18925
  ">>",
18877
- ">\\&",
18878
- "<\\&",
18926
+ ">[&|(]",
18927
+ "<[&>]",
18879
18928
  "[&;()|<>]"
18880
18929
  ].join("|") + ")";
18881
18930
  var controlRE = new RegExp("^" + CONTROL + "$");
18882
18931
  var META = "|&;()<> \\t";
18883
- var SINGLE_QUOTE = "\"((\\\\\"|[^\"])*?)\"";
18884
- var DOUBLE_QUOTE = "'((\\\\'|[^'])*?)'";
18932
+ var SINGLE_QUOTE = "'([^']*?)'";
18933
+ var ANSI_C_BODY = "(?:\\\\[\\s\\S]|[^\\\\'])*?";
18934
+ var ANSI_C_QUOTE = "\\$'" + ANSI_C_BODY + "'";
18935
+ var ansiCAt = new RegExp("\\$'" + ANSI_C_BODY + "(?:(')|\\\\?$)", "g");
18936
+ var ANSI_C_LETTERS = "abeEfnrtv";
18937
+ var ANSI_C_CHARS = "\x07\b\x1B\x1B\f\n\r \v";
18885
18938
  var hash = /^#$/;
18886
18939
  var SQ = "'";
18887
18940
  var DQ = "\"";
@@ -18890,17 +18943,26 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18890
18943
  var mult = 4294967296;
18891
18944
  for (var i = 0; i < 4; i++) TOKEN += (mult * Math.random()).toString(16);
18892
18945
  var startsWithToken = new RegExp("^" + TOKEN);
18946
+ /**
18947
+ * @param {string} s
18948
+ * @param {RegExp} r
18949
+ */
18893
18950
  function matchAll(s, r) {
18894
18951
  var origIndex = r.lastIndex;
18895
18952
  var matches = [];
18896
18953
  var matchObj;
18897
18954
  while (matchObj = r.exec(s)) {
18898
- matches.push(matchObj);
18955
+ matches[matches.length] = matchObj;
18899
18956
  if (r.lastIndex === matchObj.index) r.lastIndex += 1;
18900
18957
  }
18901
18958
  r.lastIndex = origIndex;
18902
18959
  return matches;
18903
18960
  }
18961
+ /**
18962
+ * @param {Env} env
18963
+ * @param {string} pre
18964
+ * @param {string} key
18965
+ */
18904
18966
  function getVar(env, pre, key) {
18905
18967
  var r = typeof env === "function" ? env(key) : env[key];
18906
18968
  if (typeof r === "undefined" && key != "") r = "";
@@ -18908,11 +18970,51 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18908
18970
  if (typeof r === "object") return pre + TOKEN + JSON.stringify(r) + TOKEN;
18909
18971
  return pre + r;
18910
18972
  }
18973
+ 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;
18974
+ /**
18975
+ * @param {string} m
18976
+ * @param {string} escape
18977
+ */
18978
+ function expandAnsiCEscape(m, escape) {
18979
+ var kind = escape.charAt(0);
18980
+ if (kind === "c") {
18981
+ var ctrl = escape.charAt(1);
18982
+ return ctrl === "?" ? "" : String.fromCharCode(ctrl.charCodeAt(0) & 31);
18983
+ }
18984
+ if (kind === "x" || kind === "u" || kind === "U") {
18985
+ var cp = parseInt(escape.slice(1), 16);
18986
+ if (cp > 1114111) return m;
18987
+ return String.fromCharCode.apply(null, cp > 65535 ? [55232 + (cp >> 10), 56320 + (cp & 1023)] : [cp]);
18988
+ }
18989
+ if (kind >= "0" && kind <= "7") return String.fromCharCode(parseInt(escape, 8) & 255);
18990
+ var letter = ANSI_C_LETTERS.indexOf(escape);
18991
+ return letter < 0 ? escape : ANSI_C_CHARS.charAt(letter);
18992
+ }
18993
+ /** @param {string} body */
18994
+ function expandAnsiC(body) {
18995
+ return body.replace(ansiCEscape, expandAnsiCEscape).split("\0")[0];
18996
+ }
18997
+ /**
18998
+ * @param {string} s
18999
+ * @param {number} i
19000
+ */
19001
+ function closesAnsiC(s, i) {
19002
+ ansiCAt.lastIndex = i;
19003
+ return !!ansiCAt.exec(s)[1];
19004
+ }
19005
+ /**
19006
+ * @param {string} string
19007
+ * @param {Env} [env]
19008
+ * @param {{ escape?: string, splitUnquoted?: boolean | string }} [opts]
19009
+ * @returns {ParseEntry[]}
19010
+ */
18911
19011
  function parseInternal(string, env, opts) {
18912
19012
  if (!opts) opts = {};
18913
19013
  var BS = opts.escape || "\\";
18914
- var BAREWORD = "(\\" + BS + "['\"" + META + "]|[^\\s'\"" + META + "])+";
18915
- var matches = matchAll(string, new RegExp(["(" + CONTROL + ")", "(" + BAREWORD + "|" + SINGLE_QUOTE + "|" + DOUBLE_QUOTE + ")+"].join("|"), "g"));
19014
+ var ifs = opts.splitUnquoted === true ? " \n" : typeof opts.splitUnquoted === "string" ? opts.splitUnquoted : "";
19015
+ var BAREWORD = "(\\" + BS + "['\"$\\" + BS + META + "]|\\$\\$|\\$(?!" + ANSI_C_QUOTE.slice(2) + ")|[^\\s'\"$" + META + "])+";
19016
+ var DOUBLE_QUOTE = "\"(?:\\" + BS + "[\\s\\S]|[^\"\\" + BS + "])*\"";
19017
+ var matches = matchAll(string, new RegExp(["(" + CONTROL + ")", "(" + ANSI_C_QUOTE + "|" + BAREWORD + "|" + DOUBLE_QUOTE + "|" + SINGLE_QUOTE + ")+"].join("|"), "g"));
18916
19018
  if (matches.length === 0) return [];
18917
19019
  if (!env) env = {};
18918
19020
  var commented = false;
@@ -18920,27 +19022,41 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18920
19022
  var s = match[0];
18921
19023
  if (!s || commented) return;
18922
19024
  if (controlRE.test(s)) return { op: s };
19025
+ /** @type {string | boolean} */
18923
19026
  var quote = false;
18924
19027
  var esc = false;
18925
19028
  var out = "";
19029
+ /** @type {string[]} */
19030
+ var words = [];
19031
+ var sawQuote = false;
19032
+ /** @type {number | null} */
19033
+ var pendingNw = null;
18926
19034
  var isGlob = false;
19035
+ /** @type {number} */
18927
19036
  var i;
18928
19037
  function parseEnvVar() {
18929
19038
  i += 1;
19039
+ /** @type {number | RegExpMatchArray | null} */
18930
19040
  var varend;
19041
+ /** @type {string} */
18931
19042
  var varname;
18932
19043
  var char = s.charAt(i);
18933
19044
  if (char === "{") {
18934
19045
  i += 1;
18935
19046
  if (s.charAt(i) === "}") throw new Error("Bad substitution: " + s.slice(i - 2, i + 1));
18936
- varend = s.indexOf("}", i);
18937
- if (varend < 0) throw new Error("Bad substitution: " + s.slice(i));
19047
+ var depth = 1;
19048
+ varend = i;
19049
+ while (depth > 0 && varend < s.length) {
19050
+ if (s.charAt(varend) === "{" && s.charAt(varend - 1) === "$") depth += 1;
19051
+ else if (s.charAt(varend) === "}") depth -= 1;
19052
+ varend += 1;
19053
+ }
19054
+ if (depth !== 0) throw new Error("Bad substitution: " + s.slice(i));
19055
+ varend -= 1;
18938
19056
  varname = s.slice(i, varend);
18939
19057
  i = varend;
18940
- } else if (/[*@#?$!_-]/.test(char)) {
18941
- varname = char;
18942
- i += 1;
18943
- } else {
19058
+ } else if (/[*@#?$!-]/.test(char)) varname = char;
19059
+ else {
18944
19060
  var slicedFromI = s.slice(i);
18945
19061
  varend = slicedFromI.match(/[^\w\d_]/);
18946
19062
  if (!varend) {
@@ -18953,8 +19069,23 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18953
19069
  }
18954
19070
  return getVar(env, "", varname);
18955
19071
  }
19072
+ function flushRun() {
19073
+ if (pendingNw === null) return;
19074
+ if (pendingNw === 0) {
19075
+ if (out !== "") {
19076
+ words[words.length] = out;
19077
+ out = "";
19078
+ }
19079
+ } else {
19080
+ words[words.length] = out;
19081
+ out = "";
19082
+ for (var fe = 1; fe < pendingNw; fe += 1) words[words.length] = "";
19083
+ }
19084
+ pendingNw = null;
19085
+ }
18956
19086
  for (i = 0; i < s.length; i++) {
18957
19087
  var c = s.charAt(i);
19088
+ if (ifs && c !== DS) flushRun();
18958
19089
  isGlob = isGlob || !quote && (c === "*" || c === "?");
18959
19090
  if (esc) {
18960
19091
  out += c;
@@ -18969,48 +19100,85 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18969
19100
  else out += BS + c;
18970
19101
  } else if (c === DS) out += parseEnvVar();
18971
19102
  else out += c;
18972
- } else if (c === DQ || c === SQ) quote = c;
18973
- else if (controlRE.test(c)) return { op: s };
19103
+ } else if (c === DQ || c === SQ) {
19104
+ quote = c;
19105
+ sawQuote = true;
19106
+ } else if (controlRE.test(c)) return { op: s };
18974
19107
  else if (hash.test(c)) {
18975
19108
  commented = true;
18976
19109
  var commentObj = { comment: string.slice(match.index + i + 1) };
18977
19110
  if (out.length) return [out, commentObj];
18978
19111
  return [commentObj];
18979
19112
  } else if (c === BS) esc = true;
18980
- else if (c === DS) out += parseEnvVar();
18981
- else out += c;
19113
+ else if (c === DS && s.charAt(i + 1) === SQ && closesAnsiC(s, i)) {
19114
+ flushRun();
19115
+ sawQuote = true;
19116
+ out += expandAnsiC(s.slice(i + 2, ansiCAt.lastIndex - 1));
19117
+ i = ansiCAt.lastIndex - 1;
19118
+ } else if (c === DS) {
19119
+ var value = parseEnvVar();
19120
+ if (!ifs) out += value;
19121
+ else for (var vi = 0; vi < value.length; vi += 1) {
19122
+ var vc = value.charAt(vi);
19123
+ if (ifs.indexOf(vc) < 0) {
19124
+ flushRun();
19125
+ out += vc;
19126
+ } else if (pendingNw === null) pendingNw = vc === " " || vc === " " || vc === "\n" ? 0 : 1;
19127
+ else if (vc !== " " && vc !== " " && vc !== "\n") pendingNw += 1;
19128
+ }
19129
+ } else out += c;
18982
19130
  }
18983
19131
  if (isGlob) return {
18984
19132
  op: "glob",
18985
19133
  pattern: out
18986
19134
  };
19135
+ if (ifs) {
19136
+ if (pendingNw !== null && pendingNw > 0) {
19137
+ words[words.length] = out;
19138
+ out = "";
19139
+ for (var te = 1; te < pendingNw; te += 1) words[words.length] = "";
19140
+ }
19141
+ if (out !== "" || sawQuote && words.length === 0) words[words.length] = out;
19142
+ return words;
19143
+ }
18987
19144
  return out;
18988
19145
  }).reduce(function(prev, arg) {
18989
- return typeof arg === "undefined" ? prev : prev.concat(arg);
19146
+ if (typeof arg === "undefined") return prev;
19147
+ /** @type {ParseEntry[]} */ [].concat(arg).forEach(function(entry) {
19148
+ prev[prev.length] = entry;
19149
+ });
19150
+ return prev;
18990
19151
  }, []);
18991
19152
  }
19153
+ /** @type {typeof import('./parse')} */
18992
19154
  module.exports = function parse(s, env, opts) {
18993
19155
  var mapped = parseInternal(s, env, opts);
18994
19156
  if (typeof env !== "function") return mapped;
18995
19157
  return mapped.reduce(function(acc, s) {
18996
- if (typeof s === "object") return acc.concat(s);
19158
+ if (typeof s === "object") {
19159
+ acc[acc.length] = s;
19160
+ return acc;
19161
+ }
18997
19162
  var xs = s.split(RegExp("(" + TOKEN + ".*?" + TOKEN + ")", "g"));
18998
- if (xs.length === 1) return acc.concat(xs[0]);
18999
- return acc.concat(xs.filter(Boolean).map(function(x) {
19000
- if (startsWithToken.test(x)) return JSON.parse(x.split(TOKEN)[1]);
19001
- return x;
19002
- }));
19163
+ if (xs.length === 1) {
19164
+ acc[acc.length] = xs[0];
19165
+ return acc;
19166
+ }
19167
+ xs.filter(Boolean).forEach(function(x) {
19168
+ acc[acc.length] = startsWithToken.test(x) ? JSON.parse(x.split(TOKEN)[1]) : x;
19169
+ });
19170
+ return acc;
19003
19171
  }, []);
19004
19172
  };
19005
19173
  }));
19006
19174
  //#endregion
19007
- //#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/index.js
19175
+ //#region ../../node_modules/.pnpm/shell-quote@1.12.0/node_modules/shell-quote/index.js
19008
19176
  var require_shell_quote = /* @__PURE__ */ __commonJSMin(((exports) => {
19009
19177
  exports.quote = require_quote();
19010
- exports.parse = require_parse$1();
19178
+ exports.parse = require_parse();
19011
19179
  }));
19012
19180
  //#endregion
19013
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/macos.js
19181
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/editor-info/macos.js
19014
19182
  var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19015
19183
  module.exports = {
19016
19184
  "/Applications/Atom.app/Contents/MacOS/Atom": "atom",
@@ -19045,7 +19213,7 @@ var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19045
19213
  };
19046
19214
  }));
19047
19215
  //#endregion
19048
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/linux.js
19216
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/editor-info/linux.js
19049
19217
  var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19050
19218
  module.exports = {
19051
19219
  atom: "atom",
@@ -19079,8 +19247,8 @@ var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19079
19247
  };
19080
19248
  }));
19081
19249
  //#endregion
19082
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/windows.js
19083
- var require_windows$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19250
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/editor-info/windows.js
19251
+ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19084
19252
  module.exports = [
19085
19253
  "Brackets.exe",
19086
19254
  "Code.exe",
@@ -19112,14 +19280,14 @@ var require_windows$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19112
19280
  ];
19113
19281
  }));
19114
19282
  //#endregion
19115
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/guess.js
19283
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/guess.js
19116
19284
  var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19117
- const path$8 = __require$1("path");
19285
+ const path$6 = __require$1("path");
19118
19286
  const shellQuote = require_shell_quote();
19119
19287
  const childProcess$2 = __require$1("child_process");
19120
19288
  const COMMON_EDITORS_MACOS = require_macos();
19121
19289
  const COMMON_EDITORS_LINUX = require_linux();
19122
- const COMMON_EDITORS_WIN = require_windows$1();
19290
+ const COMMON_EDITORS_WIN = require_windows();
19123
19291
  function getEditorFromMacProcesses(output) {
19124
19292
  const processNames = Object.keys(COMMON_EDITORS_MACOS);
19125
19293
  const processList = output.split("\n");
@@ -19138,7 +19306,7 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19138
19306
  const runningProcesses = output.split("\r\n");
19139
19307
  for (let i = 0; i < runningProcesses.length; i++) {
19140
19308
  const fullProcessPath = runningProcesses[i].trim();
19141
- const shortProcessName = path$8.win32.basename(fullProcessPath);
19309
+ const shortProcessName = path$6.win32.basename(fullProcessPath);
19142
19310
  if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) return fullProcessPath;
19143
19311
  }
19144
19312
  }
@@ -19187,11 +19355,15 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19187
19355
  module.exports.getEditorFromLinuxProcesses = getEditorFromLinuxProcesses;
19188
19356
  }));
19189
19357
  //#endregion
19190
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/get-args.js
19358
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/get-args.js
19191
19359
  var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19192
- const path$7 = __require$1("path");
19193
- module.exports = function getArgumentsForPosition(editor, fileName, lineNumber, columnNumber = 1) {
19194
- switch (path$7.basename(editor).replace(/\.(exe|cmd|bat)$/i, "")) {
19360
+ const os$1 = __require$1("os");
19361
+ const path$5 = __require$1("path");
19362
+ module.exports = function getArgumentsForFile(editor, fileName, lineNumber, columnNumber = 1) {
19363
+ fileName = path$5.resolve(fileName);
19364
+ if (process.platform === "linux" && fileName.startsWith("/mnt/") && /Microsoft/i.test(os$1.release())) fileName = `./${path$5.relative("", fileName)}`;
19365
+ if (!lineNumber) return [fileName];
19366
+ switch (path$5.basename(editor).replace(/\.(exe|cmd|bat)$/i, "")) {
19195
19367
  case "atom":
19196
19368
  case "Atom":
19197
19369
  case "Atom Beta":
@@ -19266,7 +19438,42 @@ var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19266
19438
  };
19267
19439
  }));
19268
19440
  //#endregion
19269
- //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/index.js
19441
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/construct-windows-launch-command.js
19442
+ var require_construct_windows_launch_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19443
+ function escapeCmdArgs(cmdArgs) {
19444
+ return cmdArgs.replace(/([&|<>,;=^])/g, "^$1");
19445
+ }
19446
+ function doubleQuoteIfNeeded(str) {
19447
+ if (str.includes("^")) return `^"${str}^"`;
19448
+ else if (str.includes(" ")) return `"${str}"`;
19449
+ return str;
19450
+ }
19451
+ function constructWindowsLaunchCommand(editor, args) {
19452
+ if (args.some((arg) => /[\r\n]/.test(arg))) throw new Error("Cannot launch an editor with an argument containing a line break");
19453
+ if (args.some((arg) => arg.includes("%"))) throw new Error("Cannot launch an editor with an argument containing \"%\"");
19454
+ return [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(" ");
19455
+ }
19456
+ module.exports = constructWindowsLaunchCommand;
19457
+ }));
19458
+ //#endregion
19459
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/parse-file.js
19460
+ var require_parse_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19461
+ const path$4 = __require$1("path");
19462
+ const positionRE = /:(\d+)(:(\d+))?$/;
19463
+ module.exports = function parseFile(file) {
19464
+ if (file.startsWith("file://")) file = __require$1("url").fileURLToPath(file);
19465
+ const unresolvedFileName = file.replace(positionRE, "");
19466
+ const fileName = unresolvedFileName ? path$4.resolve(unresolvedFileName) : "";
19467
+ const match = file.match(positionRE);
19468
+ return {
19469
+ fileName,
19470
+ lineNumber: match && match[1],
19471
+ columnNumber: match && match[3]
19472
+ };
19473
+ };
19474
+ }));
19475
+ //#endregion
19476
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.2/node_modules/launch-editor/index.js
19270
19477
  var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19271
19478
  /**
19272
19479
  * Copyright (c) 2015-present, Facebook, Inc.
@@ -19277,17 +19484,18 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
19277
19484
  *
19278
19485
  * Modified by Yuxi Evan You
19279
19486
  */
19280
- const fs$5 = __require$1("fs");
19281
- const os$1 = __require$1("os");
19282
- const path$6 = __require$1("path");
19487
+ const fs$2 = __require$1("fs");
19488
+ const path$3 = __require$1("path");
19283
19489
  const colors = require_picocolors();
19284
19490
  const childProcess$1 = __require$1("child_process");
19285
19491
  const guessEditor = require_guess();
19286
- const getArgumentsForPosition = require_get_args();
19492
+ const getArgumentsForFile = require_get_args();
19493
+ const constructWindowsLaunchCommand = require_construct_windows_launch_command();
19494
+ const parseFile = require_parse_file();
19287
19495
  function wrapErrorCallback(cb) {
19288
19496
  return (fileName, errorMessage) => {
19289
19497
  console.log();
19290
- console.log(colors.red("Could not open " + path$6.basename(fileName) + " in the editor."));
19498
+ console.log(colors.red("Could not open " + path$3.basename(fileName) + " in the editor."));
19291
19499
  if (errorMessage) {
19292
19500
  if (errorMessage[errorMessage.length - 1] !== ".") errorMessage += ".";
19293
19501
  console.log(colors.red("The editor process exited with an error: " + errorMessage));
@@ -19304,55 +19512,36 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
19304
19512
  }
19305
19513
  return false;
19306
19514
  }
19307
- const positionRE = /:(\d+)(:(\d+))?$/;
19308
- function parseFile(file) {
19309
- if (file.startsWith("file://")) file = __require$1("url").fileURLToPath(file);
19310
- const fileName = file.replace(positionRE, "");
19311
- const match = file.match(positionRE);
19312
- return {
19313
- fileName,
19314
- lineNumber: match && match[1],
19315
- columnNumber: match && match[3]
19316
- };
19317
- }
19318
19515
  let currentChildProcess = null;
19319
19516
  function launchEditor(file, specifiedEditor, onErrorCallback) {
19320
- const parsed = parseFile(file);
19321
- let { fileName } = parsed;
19322
- const { lineNumber, columnNumber } = parsed;
19323
- 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.");
19324
- if (!fs$5.existsSync(fileName)) return;
19517
+ const { fileName, lineNumber, columnNumber } = parseFile(file);
19325
19518
  if (typeof specifiedEditor === "function") {
19326
19519
  onErrorCallback = specifiedEditor;
19327
19520
  specifiedEditor = void 0;
19328
19521
  }
19329
19522
  onErrorCallback = wrapErrorCallback(onErrorCallback);
19523
+ 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.");
19524
+ if (!fs$2.existsSync(fileName)) return;
19330
19525
  const [editor, ...args] = guessEditor(specifiedEditor);
19331
19526
  if (!editor) {
19332
19527
  onErrorCallback(fileName, null);
19333
19528
  return;
19334
19529
  }
19335
- if (process.platform === "linux" && fileName.startsWith("/mnt/") && /Microsoft/i.test(os$1.release())) fileName = path$6.relative("", fileName);
19336
- if (lineNumber) {
19337
- const extraArgs = getArgumentsForPosition(editor, fileName, lineNumber, columnNumber);
19338
- args.push.apply(args, extraArgs);
19339
- } else args.push(fileName);
19530
+ const extraArgs = getArgumentsForFile(editor, fileName, lineNumber, columnNumber);
19531
+ args.push.apply(args, extraArgs);
19532
+ let launchCommand;
19533
+ if (process.platform === "win32") try {
19534
+ launchCommand = constructWindowsLaunchCommand(editor, args);
19535
+ } catch (error) {
19536
+ onErrorCallback(fileName, error.message);
19537
+ return;
19538
+ }
19340
19539
  if (currentChildProcess && isTerminalEditor(editor)) currentChildProcess.kill("SIGKILL");
19341
- if (process.platform === "win32") {
19342
- function escapeCmdArgs(cmdArgs) {
19343
- return cmdArgs.replace(/([&|<>,;=^])/g, "^$1");
19344
- }
19345
- function doubleQuoteIfNeeded(str) {
19346
- if (str.includes("^")) return `^"${str}^"`;
19347
- else if (str.includes(" ")) return `"${str}"`;
19348
- return str;
19349
- }
19350
- const launchCommand = [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(" ");
19351
- currentChildProcess = childProcess$1.exec(launchCommand, {
19352
- stdio: "inherit",
19353
- shell: true
19354
- });
19355
- } else currentChildProcess = childProcess$1.spawn(editor, args, { stdio: "inherit" });
19540
+ if (process.platform === "win32") currentChildProcess = childProcess$1.exec(launchCommand, {
19541
+ stdio: "inherit",
19542
+ shell: true
19543
+ });
19544
+ else currentChildProcess = childProcess$1.spawn(editor, args, { stdio: "inherit" });
19356
19545
  currentChildProcess.on("exit", function(errorCode) {
19357
19546
  currentChildProcess = null;
19358
19547
  if (errorCode) onErrorCallback(fileName, "(code " + errorCode + ")");
@@ -19366,9 +19555,9 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
19366
19555
  module.exports = launchEditor;
19367
19556
  }));
19368
19557
  //#endregion
19369
- //#region ../../node_modules/.pnpm/launch-editor-middleware@2.14.1/node_modules/launch-editor-middleware/index.js
19558
+ //#region ../../node_modules/.pnpm/launch-editor-middleware@2.14.2/node_modules/launch-editor-middleware/index.js
19370
19559
  var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19371
- const path$5 = __require$1("path");
19560
+ const path$2 = __require$1("path");
19372
19561
  const launch = require_launch_editor();
19373
19562
  module.exports = (specifiedEditor, srcRoot, onErrorCallback) => {
19374
19563
  if (typeof specifiedEditor === "function") {
@@ -19395,7 +19584,7 @@ var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports,
19395
19584
  res.statusCode = 500;
19396
19585
  res.end(`launch-editor-middleware: required query param "file" is missing.`);
19397
19586
  } else {
19398
- const resolved = file.startsWith("file://") ? file : path$5.resolve(srcRoot, file);
19587
+ const resolved = file.startsWith("file://") ? file : path$2.resolve(srcRoot, file);
19399
19588
  launch(resolved, specifiedEditor, onErrorCallback);
19400
19589
  res.end();
19401
19590
  }
@@ -19543,408 +19732,6 @@ function setClientErrorHandler(server, logger) {
19543
19732
  });
19544
19733
  }
19545
19734
  //#endregion
19546
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
19547
- var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19548
- module.exports = isexe;
19549
- isexe.sync = sync;
19550
- var fs$4 = __require$1("fs");
19551
- function checkPathExt(path, options) {
19552
- var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
19553
- if (!pathext) return true;
19554
- pathext = pathext.split(";");
19555
- if (pathext.indexOf("") !== -1) return true;
19556
- for (var i = 0; i < pathext.length; i++) {
19557
- var p = pathext[i].toLowerCase();
19558
- if (p && path.substr(-p.length).toLowerCase() === p) return true;
19559
- }
19560
- return false;
19561
- }
19562
- function checkStat(stat, path, options) {
19563
- if (!stat.isSymbolicLink() && !stat.isFile()) return false;
19564
- return checkPathExt(path, options);
19565
- }
19566
- function isexe(path, options, cb) {
19567
- fs$4.stat(path, function(er, stat) {
19568
- cb(er, er ? false : checkStat(stat, path, options));
19569
- });
19570
- }
19571
- function sync(path, options) {
19572
- return checkStat(fs$4.statSync(path), path, options);
19573
- }
19574
- }));
19575
- //#endregion
19576
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
19577
- var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19578
- module.exports = isexe;
19579
- isexe.sync = sync;
19580
- var fs$3 = __require$1("fs");
19581
- function isexe(path, options, cb) {
19582
- fs$3.stat(path, function(er, stat) {
19583
- cb(er, er ? false : checkStat(stat, options));
19584
- });
19585
- }
19586
- function sync(path, options) {
19587
- return checkStat(fs$3.statSync(path), options);
19588
- }
19589
- function checkStat(stat, options) {
19590
- return stat.isFile() && checkMode(stat, options);
19591
- }
19592
- function checkMode(stat, options) {
19593
- var mod = stat.mode;
19594
- var uid = stat.uid;
19595
- var gid = stat.gid;
19596
- var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
19597
- var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
19598
- var u = parseInt("100", 8);
19599
- var g = parseInt("010", 8);
19600
- var o = parseInt("001", 8);
19601
- var ug = u | g;
19602
- return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
19603
- }
19604
- }));
19605
- //#endregion
19606
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
19607
- var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19608
- __require$1("fs");
19609
- var core;
19610
- if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
19611
- else core = require_mode();
19612
- module.exports = isexe;
19613
- isexe.sync = sync;
19614
- function isexe(path, options, cb) {
19615
- if (typeof options === "function") {
19616
- cb = options;
19617
- options = {};
19618
- }
19619
- if (!cb) {
19620
- if (typeof Promise !== "function") throw new TypeError("callback not provided");
19621
- return new Promise(function(resolve, reject) {
19622
- isexe(path, options || {}, function(er, is) {
19623
- if (er) reject(er);
19624
- else resolve(is);
19625
- });
19626
- });
19627
- }
19628
- core(path, options || {}, function(er, is) {
19629
- if (er) {
19630
- if (er.code === "EACCES" || options && options.ignoreErrors) {
19631
- er = null;
19632
- is = false;
19633
- }
19634
- }
19635
- cb(er, is);
19636
- });
19637
- }
19638
- function sync(path, options) {
19639
- try {
19640
- return core.sync(path, options || {});
19641
- } catch (er) {
19642
- if (options && options.ignoreErrors || er.code === "EACCES") return false;
19643
- else throw er;
19644
- }
19645
- }
19646
- }));
19647
- //#endregion
19648
- //#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
19649
- var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19650
- const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
19651
- const path$4 = __require$1("path");
19652
- const COLON = isWindows ? ";" : ":";
19653
- const isexe = require_isexe();
19654
- const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
19655
- const getPathInfo = (cmd, opt) => {
19656
- const colon = opt.colon || COLON;
19657
- const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
19658
- /* istanbul ignore next: very unusual */ "").split(colon)];
19659
- const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
19660
- const pathExt = isWindows ? pathExtExe.split(colon) : [""];
19661
- if (isWindows) {
19662
- if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
19663
- }
19664
- return {
19665
- pathEnv,
19666
- pathExt,
19667
- pathExtExe
19668
- };
19669
- };
19670
- const which = (cmd, opt, cb) => {
19671
- if (typeof opt === "function") {
19672
- cb = opt;
19673
- opt = {};
19674
- }
19675
- if (!opt) opt = {};
19676
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
19677
- const found = [];
19678
- const step = (i) => new Promise((resolve, reject) => {
19679
- if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
19680
- const ppRaw = pathEnv[i];
19681
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
19682
- const pCmd = path$4.join(pathPart, cmd);
19683
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
19684
- resolve(subStep(p, i, 0));
19685
- });
19686
- const subStep = (p, i, ii) => new Promise((resolve, reject) => {
19687
- if (ii === pathExt.length) return resolve(step(i + 1));
19688
- const ext = pathExt[ii];
19689
- isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
19690
- if (!er && is) {
19691
- if (opt.all) found.push(p + ext);
19692
- else return resolve(p + ext);
19693
- }
19694
- return resolve(subStep(p, i, ii + 1));
19695
- });
19696
- });
19697
- return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
19698
- };
19699
- const whichSync = (cmd, opt) => {
19700
- opt = opt || {};
19701
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
19702
- const found = [];
19703
- for (let i = 0; i < pathEnv.length; i++) {
19704
- const ppRaw = pathEnv[i];
19705
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
19706
- const pCmd = path$4.join(pathPart, cmd);
19707
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
19708
- for (let j = 0; j < pathExt.length; j++) {
19709
- const cur = p + pathExt[j];
19710
- try {
19711
- if (isexe.sync(cur, { pathExt: pathExtExe })) {
19712
- if (opt.all) found.push(cur);
19713
- else return cur;
19714
- }
19715
- } catch (ex) {}
19716
- }
19717
- }
19718
- if (opt.all && found.length) return found;
19719
- if (opt.nothrow) return null;
19720
- throw getNotFoundError(cmd);
19721
- };
19722
- module.exports = which;
19723
- which.sync = whichSync;
19724
- }));
19725
- //#endregion
19726
- //#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
19727
- var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19728
- const pathKey = (options = {}) => {
19729
- const environment = options.env || process.env;
19730
- if ((options.platform || process.platform) !== "win32") return "PATH";
19731
- return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
19732
- };
19733
- module.exports = pathKey;
19734
- module.exports.default = pathKey;
19735
- }));
19736
- //#endregion
19737
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
19738
- var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19739
- const path$3 = __require$1("path");
19740
- const which = require_which();
19741
- const getPathKey = require_path_key();
19742
- function resolveCommandAttempt(parsed, withoutPathExt) {
19743
- const env = parsed.options.env || process.env;
19744
- const cwd = process.cwd();
19745
- const hasCustomCwd = parsed.options.cwd != null;
19746
- const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
19747
- if (shouldSwitchCwd) try {
19748
- process.chdir(parsed.options.cwd);
19749
- } catch (err) {}
19750
- let resolved;
19751
- try {
19752
- resolved = which.sync(parsed.command, {
19753
- path: env[getPathKey({ env })],
19754
- pathExt: withoutPathExt ? path$3.delimiter : void 0
19755
- });
19756
- } catch (e) {} finally {
19757
- if (shouldSwitchCwd) process.chdir(cwd);
19758
- }
19759
- if (resolved) resolved = path$3.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
19760
- return resolved;
19761
- }
19762
- function resolveCommand(parsed) {
19763
- return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
19764
- }
19765
- module.exports = resolveCommand;
19766
- }));
19767
- //#endregion
19768
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
19769
- var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19770
- const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
19771
- function escapeCommand(arg) {
19772
- arg = arg.replace(metaCharsRegExp, "^$1");
19773
- return arg;
19774
- }
19775
- function escapeArgument(arg, doubleEscapeMetaChars) {
19776
- arg = `${arg}`;
19777
- arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
19778
- arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
19779
- arg = `"${arg}"`;
19780
- arg = arg.replace(metaCharsRegExp, "^$1");
19781
- if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
19782
- return arg;
19783
- }
19784
- module.exports.command = escapeCommand;
19785
- module.exports.argument = escapeArgument;
19786
- }));
19787
- //#endregion
19788
- //#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
19789
- var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19790
- module.exports = /^#!(.*)/;
19791
- }));
19792
- //#endregion
19793
- //#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
19794
- var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19795
- const shebangRegex = require_shebang_regex();
19796
- module.exports = (string = "") => {
19797
- const match = string.match(shebangRegex);
19798
- if (!match) return null;
19799
- const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
19800
- const binary = path.split("/").pop();
19801
- if (binary === "env") return argument;
19802
- return argument ? `${binary} ${argument}` : binary;
19803
- };
19804
- }));
19805
- //#endregion
19806
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
19807
- var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19808
- const fs$2 = __require$1("fs");
19809
- const shebangCommand = require_shebang_command();
19810
- function readShebang(command) {
19811
- const size = 150;
19812
- const buffer = Buffer.alloc(size);
19813
- let fd;
19814
- try {
19815
- fd = fs$2.openSync(command, "r");
19816
- fs$2.readSync(fd, buffer, 0, size, 0);
19817
- fs$2.closeSync(fd);
19818
- } catch (e) {}
19819
- return shebangCommand(buffer.toString());
19820
- }
19821
- module.exports = readShebang;
19822
- }));
19823
- //#endregion
19824
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
19825
- var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19826
- const path$2 = __require$1("path");
19827
- const resolveCommand = require_resolveCommand();
19828
- const escape = require_escape();
19829
- const readShebang = require_readShebang();
19830
- const isWin = process.platform === "win32";
19831
- const isExecutableRegExp = /\.(?:com|exe)$/i;
19832
- const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
19833
- function detectShebang(parsed) {
19834
- parsed.file = resolveCommand(parsed);
19835
- const shebang = parsed.file && readShebang(parsed.file);
19836
- if (shebang) {
19837
- parsed.args.unshift(parsed.file);
19838
- parsed.command = shebang;
19839
- return resolveCommand(parsed);
19840
- }
19841
- return parsed.file;
19842
- }
19843
- function parseNonShell(parsed) {
19844
- if (!isWin) return parsed;
19845
- const commandFile = detectShebang(parsed);
19846
- const needsShell = !isExecutableRegExp.test(commandFile);
19847
- if (parsed.options.forceShell || needsShell) {
19848
- const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
19849
- parsed.command = path$2.normalize(parsed.command);
19850
- parsed.command = escape.command(parsed.command);
19851
- parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
19852
- parsed.args = [
19853
- "/d",
19854
- "/s",
19855
- "/c",
19856
- `"${[parsed.command].concat(parsed.args).join(" ")}"`
19857
- ];
19858
- parsed.command = process.env.comspec || "cmd.exe";
19859
- parsed.options.windowsVerbatimArguments = true;
19860
- }
19861
- return parsed;
19862
- }
19863
- function parse(command, args, options) {
19864
- if (args && !Array.isArray(args)) {
19865
- options = args;
19866
- args = null;
19867
- }
19868
- args = args ? args.slice(0) : [];
19869
- options = Object.assign({}, options);
19870
- const parsed = {
19871
- command,
19872
- args,
19873
- options,
19874
- file: void 0,
19875
- original: {
19876
- command,
19877
- args
19878
- }
19879
- };
19880
- return options.shell ? parsed : parseNonShell(parsed);
19881
- }
19882
- module.exports = parse;
19883
- }));
19884
- //#endregion
19885
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
19886
- var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19887
- const isWin = process.platform === "win32";
19888
- function notFoundError(original, syscall) {
19889
- return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
19890
- code: "ENOENT",
19891
- errno: "ENOENT",
19892
- syscall: `${syscall} ${original.command}`,
19893
- path: original.command,
19894
- spawnargs: original.args
19895
- });
19896
- }
19897
- function hookChildProcess(cp, parsed) {
19898
- if (!isWin) return;
19899
- const originalEmit = cp.emit;
19900
- cp.emit = function(name, arg1) {
19901
- if (name === "exit") {
19902
- const err = verifyENOENT(arg1, parsed);
19903
- if (err) return originalEmit.call(cp, "error", err);
19904
- }
19905
- return originalEmit.apply(cp, arguments);
19906
- };
19907
- }
19908
- function verifyENOENT(status, parsed) {
19909
- if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
19910
- return null;
19911
- }
19912
- function verifyENOENTSync(status, parsed) {
19913
- if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
19914
- return null;
19915
- }
19916
- module.exports = {
19917
- hookChildProcess,
19918
- verifyENOENT,
19919
- verifyENOENTSync,
19920
- notFoundError
19921
- };
19922
- }));
19923
- //#endregion
19924
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
19925
- var require_cross_spawn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19926
- const cp = __require$1("child_process");
19927
- const parse = require_parse();
19928
- const enoent = require_enoent();
19929
- function spawn(command, args, options) {
19930
- const parsed = parse(command, args, options);
19931
- const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
19932
- enoent.hookChildProcess(spawned, parsed);
19933
- return spawned;
19934
- }
19935
- function spawnSync(command, args, options) {
19936
- const parsed = parse(command, args, options);
19937
- const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
19938
- result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
19939
- return result;
19940
- }
19941
- module.exports = spawn;
19942
- module.exports.spawn = spawn;
19943
- module.exports.sync = spawnSync;
19944
- module.exports._parse = parse;
19945
- module.exports._enoent = enoent;
19946
- }));
19947
- //#endregion
19948
19735
  //#region ../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
19949
19736
  let isDockerCached;
19950
19737
  function hasDockerEnv() {
@@ -20396,6 +20183,347 @@ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
20396
20183
  defineLazyProperty(apps, "browser", () => "browser");
20397
20184
  defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
20398
20185
  //#endregion
20186
+ //#region ../../node_modules/.pnpm/tinyexec@1.3.1/node_modules/tinyexec/dist/main.mjs
20187
+ const isPathLikePattern = /^path$/i;
20188
+ const defaultEnvPathInfo = {
20189
+ key: "PATH",
20190
+ value: ""
20191
+ };
20192
+ function getPathFromEnv(env) {
20193
+ for (const key in env) {
20194
+ if (!Object.prototype.hasOwnProperty.call(env, key) || !isPathLikePattern.test(key)) continue;
20195
+ const value = env[key];
20196
+ if (!value) return defaultEnvPathInfo;
20197
+ return {
20198
+ key,
20199
+ value
20200
+ };
20201
+ }
20202
+ return defaultEnvPathInfo;
20203
+ }
20204
+ function addNodeBinToPath(cwd, path) {
20205
+ const parts = path.value.split(delimiter);
20206
+ const nodeBinPaths = [];
20207
+ let currentPath = typeof cwd === "string" ? cwd : fileURLToPath(cwd, { windows: false });
20208
+ let lastPath;
20209
+ do {
20210
+ nodeBinPaths.push(resolve(currentPath, "node_modules", ".bin"));
20211
+ lastPath = currentPath;
20212
+ currentPath = dirname(currentPath);
20213
+ } while (currentPath !== lastPath);
20214
+ nodeBinPaths.push(dirname(process.execPath));
20215
+ const newPath = nodeBinPaths.concat(parts).join(delimiter);
20216
+ return {
20217
+ key: path.key,
20218
+ value: newPath
20219
+ };
20220
+ }
20221
+ function computeEnv(cwd, env, nodePath = true) {
20222
+ const envWithDefault = {
20223
+ ...process.env,
20224
+ ...env
20225
+ };
20226
+ if (!nodePath) return envWithDefault;
20227
+ const envPathInfo = addNodeBinToPath(cwd, getPathFromEnv(envWithDefault));
20228
+ envWithDefault[envPathInfo.key] = envPathInfo.value;
20229
+ return envWithDefault;
20230
+ }
20231
+ const combineStreams = (streams) => {
20232
+ let streamCount = streams.length;
20233
+ const combined = new PassThrough();
20234
+ const maybeEmitEnd = () => {
20235
+ if (--streamCount === 0) combined.end();
20236
+ };
20237
+ for (const stream of streams) pipeline(stream, combined, { end: false }).then(maybeEmitEnd).catch(maybeEmitEnd);
20238
+ return combined;
20239
+ };
20240
+ const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
20241
+ const shebangRegExp = /^#!\s*(.+)/;
20242
+ const isWindowsExecutableRegExp = /\.(?:com|exe)$/i;
20243
+ const isNodeModulesCmdRegExp = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i;
20244
+ const isWindows = process.platform === "win32";
20245
+ const defaultPathExt = [
20246
+ ".EXE",
20247
+ ".CMD",
20248
+ ".BAT",
20249
+ ".COM"
20250
+ ];
20251
+ const noPathExt = [""];
20252
+ /**
20253
+ * Normalizes the command and arguments to work cross-platform.
20254
+ * On Windows, this basically handles things like shebangs, calling
20255
+ * `node_modules/.bin` commands, and escaping meta characters.
20256
+ * On other platforms, it just returns the command and arguments as-is.
20257
+ */
20258
+ function normalizeSpawnCommand(command, args = [], options = {}) {
20259
+ if (options.shell === true || !isWindows) return {
20260
+ command,
20261
+ args,
20262
+ options
20263
+ };
20264
+ let file = resolveCommand(command, options);
20265
+ let shebang = null;
20266
+ if (file !== null) {
20267
+ const size = 150;
20268
+ const buffer = Buffer.alloc(size);
20269
+ let fd = null;
20270
+ try {
20271
+ fd = openSync(file, "r");
20272
+ readSync(fd, buffer, 0, size, 0);
20273
+ } catch {} finally {
20274
+ if (fd !== null) closeSync(fd);
20275
+ }
20276
+ const match = buffer.toString().match(shebangRegExp);
20277
+ if (match !== null) {
20278
+ const line = match[1].trim();
20279
+ const separatorIndex = line.indexOf(" ");
20280
+ const path = separatorIndex !== -1 ? line.slice(0, separatorIndex) : line;
20281
+ const argument = separatorIndex !== -1 ? line.slice(separatorIndex + 1) : "";
20282
+ const binary = basename(path);
20283
+ shebang = binary === "env" ? argument || null : binary;
20284
+ }
20285
+ }
20286
+ if (shebang !== null && file !== null) {
20287
+ args = [file, ...args];
20288
+ command = shebang;
20289
+ file = resolveCommand(command, options);
20290
+ }
20291
+ if (file === null || !isWindowsExecutableRegExp.test(file)) {
20292
+ const needsDoubleEscapeMetaChars = file !== null && isNodeModulesCmdRegExp.test(file);
20293
+ command = normalize(command);
20294
+ command = command.replace(metaCharsRegExp, "^$1");
20295
+ args = args.map((arg) => {
20296
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
20297
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
20298
+ arg = `"${arg}"`;
20299
+ arg = arg.replace(metaCharsRegExp, "^$1");
20300
+ if (needsDoubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
20301
+ return arg;
20302
+ });
20303
+ args = [
20304
+ "/d",
20305
+ "/s",
20306
+ "/c",
20307
+ `"${[command, ...args].join(" ")}"`
20308
+ ];
20309
+ command = options.env?.comspec ?? "cmd.exe";
20310
+ options = {
20311
+ ...options,
20312
+ windowsVerbatimArguments: true
20313
+ };
20314
+ }
20315
+ return {
20316
+ command,
20317
+ args,
20318
+ options
20319
+ };
20320
+ }
20321
+ /**
20322
+ * Resolves the command to an absolute path if possible.
20323
+ * Handles things like traversing PATH and adding extensions from PATHEXT
20324
+ */
20325
+ function resolveCommand(command, options) {
20326
+ const cwd$3 = (options.cwd ?? cwd()).toString();
20327
+ const env = options.env ?? process.env;
20328
+ const PATH = getPathFromEnv(env).value;
20329
+ const pathEnv = command.includes("/") || command.includes("\\") ? [""] : [cwd$3, ...PATH.split(delimiter)];
20330
+ let pathExt = env.PATHEXT ? env.PATHEXT.split(delimiter) : defaultPathExt;
20331
+ if (command.includes(".") && pathExt[0] !== "") pathExt = ["", ...pathExt];
20332
+ for (const extensions of [pathExt, noPathExt]) for (const path of pathEnv) {
20333
+ const unquoted = path.startsWith("\"") && path.endsWith("\"") && path.length > 1 ? path.slice(1, -1) : path;
20334
+ const dest = resolve(cwd$3, unquoted, command);
20335
+ for (const ext of extensions) {
20336
+ const destWithExt = dest + ext;
20337
+ try {
20338
+ if (statSync(destWithExt).isFile()) return destWithExt;
20339
+ } catch {}
20340
+ }
20341
+ }
20342
+ return null;
20343
+ }
20344
+ var NonZeroExitError = class extends Error {
20345
+ result;
20346
+ output;
20347
+ exitCode;
20348
+ get signalCode() {
20349
+ return this.result.signalCode;
20350
+ }
20351
+ constructor(result, output, command, args) {
20352
+ let target = "The process";
20353
+ if (command) target = `The command \`${args?.length ? `${command} ${args.map((a) => /[ "'`()]/.test(a) ? JSON.stringify(a) : a).join(" ")}` : command}\``;
20354
+ const exitCode = result.exitCode ?? 1;
20355
+ super(result.signalCode !== null ? `${target} was killed by the signal ${result.signalCode}` : `${target} exited with a non-zero status (${exitCode})`);
20356
+ this.result = result;
20357
+ this.output = output;
20358
+ this.exitCode = exitCode;
20359
+ Object.defineProperty(this, "result", {
20360
+ enumerable: false,
20361
+ writable: false,
20362
+ configurable: false
20363
+ });
20364
+ }
20365
+ };
20366
+ const defaultOptions = {
20367
+ timeout: void 0,
20368
+ persist: false
20369
+ };
20370
+ const defaultNodeOptions = { windowsHide: true };
20371
+ function combineSignals(signals) {
20372
+ const controller = new AbortController();
20373
+ for (const signal of signals) {
20374
+ if (signal.aborted) {
20375
+ controller.abort();
20376
+ return signal;
20377
+ }
20378
+ const onAbort = () => {
20379
+ controller.abort(signal.reason);
20380
+ };
20381
+ signal.addEventListener("abort", onAbort, { signal: controller.signal });
20382
+ }
20383
+ return controller.signal;
20384
+ }
20385
+ async function readStream(stream) {
20386
+ let output = "";
20387
+ try {
20388
+ for await (const chunk of stream) output += chunk.toString();
20389
+ } catch {}
20390
+ return output;
20391
+ }
20392
+ var ExecProcess = class {
20393
+ _process;
20394
+ _aborted = false;
20395
+ _options;
20396
+ _command;
20397
+ _args;
20398
+ _resolveClose;
20399
+ _processClosed;
20400
+ _thrownError;
20401
+ get process() {
20402
+ return this._process;
20403
+ }
20404
+ get pid() {
20405
+ return this._process?.pid;
20406
+ }
20407
+ get exitCode() {
20408
+ if (this._process && this._process.exitCode !== null) return this._process.exitCode;
20409
+ }
20410
+ get signalCode() {
20411
+ return this._process?.signalCode ?? null;
20412
+ }
20413
+ constructor(command, args, options) {
20414
+ this._options = {
20415
+ ...defaultOptions,
20416
+ ...options
20417
+ };
20418
+ this._command = command;
20419
+ this._args = args ?? [];
20420
+ this._processClosed = new Promise((resolve) => {
20421
+ this._resolveClose = resolve;
20422
+ });
20423
+ }
20424
+ kill(signal) {
20425
+ return this._process?.kill(signal) === true;
20426
+ }
20427
+ get aborted() {
20428
+ return this._aborted;
20429
+ }
20430
+ get killed() {
20431
+ return this._process?.killed === true;
20432
+ }
20433
+ pipe(command, args, options) {
20434
+ return exec$1(command, args, {
20435
+ ...options,
20436
+ stdin: this
20437
+ });
20438
+ }
20439
+ async *[Symbol.asyncIterator]() {
20440
+ const proc = this._process;
20441
+ if (!proc) return;
20442
+ const streams = [];
20443
+ if (this._streamErr) streams.push(this._streamErr);
20444
+ if (this._streamOut) streams.push(this._streamOut);
20445
+ const streamCombined = combineStreams(streams);
20446
+ const rl = readline.createInterface({ input: streamCombined });
20447
+ for await (const chunk of rl) yield chunk.toString();
20448
+ await this._processClosed;
20449
+ proc.removeAllListeners();
20450
+ if (this._thrownError) throw this._thrownError;
20451
+ if (this._options?.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, void 0, this._command, this._args);
20452
+ }
20453
+ async _waitForOutput() {
20454
+ const proc = this._process;
20455
+ if (!proc) throw new Error("No process was started");
20456
+ const [stdout, stderr] = await Promise.all([this._streamOut ? readStream(this._streamOut) : "", this._streamErr ? readStream(this._streamErr) : ""]);
20457
+ await this._processClosed;
20458
+ const { stdin } = this._options;
20459
+ if (stdin && typeof stdin !== "string") await stdin;
20460
+ proc.removeAllListeners();
20461
+ if (this._thrownError) throw this._thrownError;
20462
+ const result = {
20463
+ stderr,
20464
+ stdout,
20465
+ exitCode: this.exitCode
20466
+ };
20467
+ if (this._options.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, result, this._command, this._args);
20468
+ return result;
20469
+ }
20470
+ then(onfulfilled, onrejected) {
20471
+ return this._waitForOutput().then(onfulfilled, onrejected);
20472
+ }
20473
+ _streamOut;
20474
+ _streamErr;
20475
+ spawn() {
20476
+ const options = this._options;
20477
+ const nodeOptions = {
20478
+ ...defaultNodeOptions,
20479
+ ...options.nodeOptions
20480
+ };
20481
+ const cwd$1 = nodeOptions?.cwd ?? cwd();
20482
+ const signals = [];
20483
+ this._resetState();
20484
+ if (options.timeout !== void 0) signals.push(AbortSignal.timeout(options.timeout));
20485
+ if (options.signal !== void 0) signals.push(options.signal);
20486
+ if (options.persist === true) nodeOptions.detached = true;
20487
+ if (signals.length > 0) nodeOptions.signal = combineSignals(signals);
20488
+ nodeOptions.env = computeEnv(cwd$1, nodeOptions.env, options.nodePath);
20489
+ const crossResult = normalizeSpawnCommand(this._command, this._args, nodeOptions);
20490
+ const handle = spawn(crossResult.command, crossResult.args, crossResult.options);
20491
+ if (handle.stderr) this._streamErr = handle.stderr;
20492
+ if (handle.stdout) this._streamOut = handle.stdout;
20493
+ this._process = handle;
20494
+ handle.once("error", this._onError);
20495
+ handle.once("close", this._onClose);
20496
+ if (handle.stdin) {
20497
+ const { stdin } = options;
20498
+ if (typeof stdin === "string") handle.stdin.end(stdin);
20499
+ else stdin?.process?.stdout?.pipe(handle.stdin);
20500
+ }
20501
+ }
20502
+ _resetState() {
20503
+ this._aborted = false;
20504
+ this._processClosed = new Promise((resolve) => {
20505
+ this._resolveClose = resolve;
20506
+ });
20507
+ this._thrownError = void 0;
20508
+ }
20509
+ _onError = (err) => {
20510
+ if (err.name === "AbortError" && (!(err.cause instanceof Error) || err.cause.name !== "TimeoutError")) {
20511
+ this._aborted = true;
20512
+ return;
20513
+ }
20514
+ this._thrownError = err;
20515
+ };
20516
+ _onClose = () => {
20517
+ if (this._resolveClose) this._resolveClose();
20518
+ };
20519
+ };
20520
+ const x = (command, args, userOptions) => {
20521
+ const proc = new ExecProcess(command, args, userOptions);
20522
+ proc.spawn();
20523
+ return proc;
20524
+ };
20525
+ const exec$1 = x;
20526
+ //#endregion
20399
20527
  //#region ../../vite/packages/vite/src/node/server/openBrowser.ts
20400
20528
  /**
20401
20529
  * The following is modified based on source found in
@@ -20406,7 +20534,6 @@ defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
20406
20534
  * https://github.com/react/create-react-app/blob/main/LICENSE
20407
20535
  *
20408
20536
  */
20409
- var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
20410
20537
  /**
20411
20538
  * Reads the BROWSER environment variable and decides what to do with it.
20412
20539
  */
@@ -20417,12 +20544,12 @@ function openBrowser(url, opt, logger) {
20417
20544
  }
20418
20545
  function executeNodeScript(scriptPath, url, logger) {
20419
20546
  const extraArgs = process.argv.slice(2);
20420
- (0, import_cross_spawn.default)(process.execPath, [
20547
+ x(process.execPath, [
20421
20548
  scriptPath,
20422
20549
  ...extraArgs,
20423
20550
  url
20424
- ], { stdio: "inherit" }).on("close", (code) => {
20425
- 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 });
20551
+ ], { nodeOptions: { stdio: "inherit" } }).then(({ exitCode }) => {
20552
+ 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 });
20426
20553
  });
20427
20554
  }
20428
20555
  const supportedChromiumBrowsers = [
@@ -20661,8 +20788,9 @@ function ssrRewriteStacktrace(stack, moduleGraph) {
20661
20788
  let alreadyRewritten = false;
20662
20789
  return {
20663
20790
  result: stack.split("\n").map((line) => {
20664
- return line.replace(/^ {4}at (?:(\S.*?)\s\()?(.+?):(\d+)(?::(\d+))?\)?/, (input, varName, id, originalLine, originalColumn) => {
20665
- if (!id) return input;
20791
+ return line.replace(/^ {4}at (?:(\S.*?)\s\()?(.+?):(\d+)(?::(\d+))?\)?/, (input, varName, rawId, originalLine, originalColumn) => {
20792
+ if (!rawId) return input;
20793
+ const id = decodeSourceURL(rawId);
20666
20794
  const rawSourceMap = moduleGraph.getModuleById(id)?.transformResult?.map;
20667
20795
  if (!rawSourceMap) return input;
20668
20796
  const traced = new TraceMap(rawSourceMap);
@@ -21163,10 +21291,13 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
21163
21291
  let map;
21164
21292
  if (inMap?.mappings === "") map = inMap;
21165
21293
  else {
21166
- map = s.generateMap({ hires: "boundary" });
21167
- map.sources = [path.basename(url)];
21168
- map.sourcesContent = [originalCode];
21169
- if (inMap && inMap.mappings && "sources" in inMap && inMap.sources.length > 0) map = combineSourcemaps(url, [map, inMap]);
21294
+ const shouldCombine = !!(inMap && inMap.mappings && "sources" in inMap && inMap.sources.length > 0);
21295
+ const mapOptions = { hires: "boundary" };
21296
+ const nextMap = shouldCombine ? s.generateDecodedMap(mapOptions) : s.generateMap(mapOptions);
21297
+ nextMap.sources = [path.basename(url)];
21298
+ nextMap.sourcesContent = [originalCode];
21299
+ if (shouldCombine) map = combineSourcemaps(url, [nextMap, inMap]);
21300
+ else map = nextMap;
21170
21301
  }
21171
21302
  return {
21172
21303
  code: s.toString(),
@@ -21786,9 +21917,26 @@ async function createClientConfigValueReplacer(config) {
21786
21917
  const serverForwardConsoleReplacement = escapeReplacement(config.server.forwardConsole);
21787
21918
  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);
21788
21919
  }
21920
+ const ROLLDOWN_DEV_RUNTIME_ENTRY = "rolldown/experimental/runtime";
21789
21921
  async function getHmrImplementation(config) {
21790
21922
  const content = fs.readFileSync(normalizedBundledDevClientEntry, "utf-8");
21791
- return (await createClientConfigValueReplacer(config))(content).replace(/import\s*['"]@vite\/env['"]/, "");
21923
+ 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}`);
21924
+ }
21925
+ function rolldownDevRuntimeEntryPath() {
21926
+ return fileURLToPath(import.meta.resolve(ROLLDOWN_DEV_RUNTIME_ENTRY));
21927
+ }
21928
+ /**
21929
+ * The dev runtime must match the rolldown that generates the bundle, so it is read from the
21930
+ * installed package at serve time instead of being bundled into the client. The entry imports
21931
+ * its helper file with a relative path, so both are served under the same directory.
21932
+ */
21933
+ function getRolldownDevRuntimeFiles() {
21934
+ const entry = rolldownDevRuntimeEntryPath();
21935
+ const dir = path.dirname(entry);
21936
+ const files = /* @__PURE__ */ new Map();
21937
+ 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"));
21938
+ if (!files.has(`@rolldown/${path.basename(entry)}`)) throw new Error(`rolldown dev runtime entry ${entry} was not found`);
21939
+ return files;
21792
21940
  }
21793
21941
  //#endregion
21794
21942
  //#region ../../node_modules/.pnpm/convert-source-map@2.0.0/node_modules/convert-source-map/index.js
@@ -22174,7 +22322,7 @@ function totalist(dir, callback, pre = "") {
22174
22322
  let i = 0, abs, stats;
22175
22323
  for (; i < arr.length; i++) {
22176
22324
  abs = join$1(dir, arr[i]);
22177
- stats = statSync(abs);
22325
+ stats = statSync$1(abs);
22178
22326
  stats.isDirectory() ? totalist(abs, callback, join$1(pre, arr[i])) : callback(join$1(pre, arr[i]), abs, stats);
22179
22327
  }
22180
22328
  }
@@ -22461,7 +22609,7 @@ function serveRawFsMiddleware(server) {
22461
22609
  const pathname = decodeURIIfPossible(url.pathname);
22462
22610
  if (pathname === void 0) return next();
22463
22611
  let newPathname = pathname.slice(FS_PREFIX.length);
22464
- if (isWindows) newPathname = newPathname.replace(/^[A-Z]:/i, "");
22612
+ if (isWindows$1) newPathname = newPathname.replace(/^[A-Z]:/i, "");
22465
22613
  url.pathname = encodeURI(newPathname);
22466
22614
  req.url = url.href.slice(url.origin.length);
22467
22615
  try {
@@ -22505,8 +22653,8 @@ function looksLikeWindowsShortNamePath(filePath) {
22505
22653
  function isFileLoadingAllowed(config, filePath) {
22506
22654
  const { fs } = config.server;
22507
22655
  if (!fs.strict) return true;
22508
- if (isWindows && looksLikeWindowsShortNamePath(filePath)) return false;
22509
- if ((isWindows && windowsDriveRE.test(filePath) ? filePath.slice(2) : filePath).includes(":")) return false;
22656
+ if (isWindows$1 && looksLikeWindowsShortNamePath(filePath)) return false;
22657
+ if ((isWindows$1 && windowsDriveRE.test(filePath) ? filePath.slice(2) : filePath).includes(":")) return false;
22510
22658
  const filePathWithoutTrailingSlash = filePath.endsWith("/") ? filePath.slice(0, -1) : filePath;
22511
22659
  if (config.fsDenyGlob(filePathWithoutTrailingSlash)) return false;
22512
22660
  if (config.safeModulePaths.has(filePath)) return true;
@@ -22572,8 +22720,9 @@ function createDevHtmlTransformFn(config) {
22572
22720
  };
22573
22721
  }
22574
22722
  function getHtmlFilename(url, server) {
22575
- if (url.startsWith(FS_PREFIX)) return decodeURIComponent(fsPathFromId(url));
22576
- else return decodeURIComponent(normalizePath(path.join(server.config.root, url.slice(1))));
22723
+ const urlPath = cleanUrl(url);
22724
+ if (urlPath.startsWith(FS_PREFIX)) return decodeURIComponent(fsPathFromId(urlPath));
22725
+ else return decodeURIComponent(normalizePath(path.join(server.config.root, urlPath.slice(1))));
22577
22726
  }
22578
22727
  function shouldPreTransform(url, config) {
22579
22728
  return !checkPublicFile(url, config) && (isJSRequest(url) || isCSSRequest(url));
@@ -22585,6 +22734,7 @@ function isBareRelative(url) {
22585
22734
  function getHtmlDirnameForRelativeUrl(htmlPath) {
22586
22735
  return htmlPath.endsWith("/") ? htmlPath : path.posix.dirname(htmlPath);
22587
22736
  }
22737
+ const multipleLeadingSlashesRE = /^\/{2,}/g;
22588
22738
  const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, server, isClassicScriptLink) => {
22589
22739
  const replacer = (url) => {
22590
22740
  if (url[0] === "/" && url[1] !== "/" || (url[0] === "." || isBareRelative(url)) && originalUrl && originalUrl !== "/" && htmlPath === "/index.html") url = path.posix.join(config.base, url);
@@ -22610,6 +22760,7 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
22610
22760
  return useSrcSetReplacer ? processSrcSetSync(url, ({ url }) => replacer(url)) : replacer(url);
22611
22761
  };
22612
22762
  const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl }) => {
22763
+ if (htmlPath.startsWith("//")) htmlPath = htmlPath.replace(multipleLeadingSlashesRE, "/");
22613
22764
  const { config, watcher } = server;
22614
22765
  const base = config.base || "/";
22615
22766
  const decodedBase = config.decodedBase || "/";
@@ -25208,6 +25359,7 @@ function rejectInvalidRequestMiddleware() {
25208
25359
  //#endregion
25209
25360
  //#region ../../vite/packages/vite/src/node/server/middlewares/time.ts
25210
25361
  const logTime = createDebugger("vite:time");
25362
+ const isTimeDebugEnabled = logTime !== void 0;
25211
25363
  function timeMiddleware(root) {
25212
25364
  return function viteTimeMiddleware(req, res, next) {
25213
25365
  const start = performance$1.now();
@@ -25477,8 +25629,9 @@ const urlRE = /[?&]url\b/;
25477
25629
  const rawRE = /[?&]raw\b/;
25478
25630
  const inlineRE$3 = /[?&]inline\b/;
25479
25631
  const svgRE = /\.svg\b/;
25632
+ const wasmInstanceRE$1 = /[?&]vite-wasm-instance(?:&|$)/;
25480
25633
  function isServerAccessDeniedForTransform(config, id) {
25481
- if (rawRE.test(id) || urlRE.test(id) || inlineRE$3.test(id) || svgRE.test(id)) return checkLoadingAccess(config, cleanUrl(id)) !== "allowed" || checkLoadingAccess(config, id) !== "allowed";
25634
+ 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";
25482
25635
  return false;
25483
25636
  }
25484
25637
  /**
@@ -26135,7 +26288,7 @@ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
26135
26288
  return searchForWorkspaceRoot(dir, root);
26136
26289
  }
26137
26290
  //#endregion
26138
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js
26291
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/constants.js
26139
26292
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26140
26293
  const BINARY_TYPES = [
26141
26294
  "nodebuffer",
@@ -26158,7 +26311,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26158
26311
  };
26159
26312
  }));
26160
26313
  //#endregion
26161
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/buffer-util.js
26314
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/buffer-util.js
26162
26315
  var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26163
26316
  const { EMPTY_BUFFER } = require_constants();
26164
26317
  const FastBuffer = Buffer[Symbol.species];
@@ -26258,7 +26411,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26258
26411
  } catch (e) {}
26259
26412
  }));
26260
26413
  //#endregion
26261
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/limiter.js
26414
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/limiter.js
26262
26415
  var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26263
26416
  const kDone = Symbol("kDone");
26264
26417
  const kRun = Symbol("kRun");
@@ -26309,7 +26462,7 @@ var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26309
26462
  module.exports = Limiter;
26310
26463
  }));
26311
26464
  //#endregion
26312
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/permessage-deflate.js
26465
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/permessage-deflate.js
26313
26466
  var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26314
26467
  const zlib$1 = __require$1("zlib");
26315
26468
  const bufferUtil = require_buffer_util();
@@ -26645,7 +26798,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
26645
26798
  }
26646
26799
  }));
26647
26800
  //#endregion
26648
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/validation.js
26801
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/validation.js
26649
26802
  var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26650
26803
  const { isUtf8 } = __require$1("buffer");
26651
26804
  const { hasBlob } = require_constants();
@@ -26841,7 +26994,7 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26841
26994
  } catch (e) {}
26842
26995
  }));
26843
26996
  //#endregion
26844
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/receiver.js
26997
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/receiver.js
26845
26998
  var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26846
26999
  const { Writable } = __require$1("stream");
26847
27000
  const PerMessageDeflate = require_permessage_deflate();
@@ -27304,7 +27457,7 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
27304
27457
  module.exports = Receiver;
27305
27458
  }));
27306
27459
  //#endregion
27307
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/sender.js
27460
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/sender.js
27308
27461
  var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
27309
27462
  const { Duplex: Duplex$3 } = __require$1("stream");
27310
27463
  const { randomFillSync } = __require$1("crypto");
@@ -27802,7 +27955,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
27802
27955
  }
27803
27956
  }));
27804
27957
  //#endregion
27805
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/event-target.js
27958
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/event-target.js
27806
27959
  var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
27807
27960
  const { kForOnEventAttribute, kListener } = require_constants();
27808
27961
  const kCode = Symbol("kCode");
@@ -28033,7 +28186,7 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28033
28186
  }
28034
28187
  }));
28035
28188
  //#endregion
28036
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/extension.js
28189
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/extension.js
28037
28190
  var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28038
28191
  const { tokenChars } = require_validation();
28039
28192
  /**
@@ -28179,7 +28332,7 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28179
28332
  };
28180
28333
  }));
28181
28334
  //#endregion
28182
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket.js
28335
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/websocket.js
28183
28336
  var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28184
28337
  const EventEmitter$2 = __require$1("events");
28185
28338
  const https = __require$1("https");
@@ -28239,11 +28392,16 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28239
28392
  this._bufferedAmount = 0;
28240
28393
  this._isServer = false;
28241
28394
  this._redirects = 0;
28242
- if (protocols === void 0) protocols = [];
28243
- else if (!Array.isArray(protocols)) {
28395
+ if (protocols === void 0) {
28396
+ if (!options || options.protocols === void 0) protocols = [];
28397
+ else if (Array.isArray(options.protocols)) protocols = options.protocols;
28398
+ else protocols = [options.protocols];
28399
+ } else if (!Array.isArray(protocols)) {
28244
28400
  if (typeof protocols === "object" && protocols !== null) {
28245
28401
  options = protocols;
28246
- protocols = [];
28402
+ if (options.protocols === void 0) protocols = [];
28403
+ else if (Array.isArray(options.protocols)) protocols = options.protocols;
28404
+ else protocols = [options.protocols];
28247
28405
  } else protocols = [protocols];
28248
28406
  }
28249
28407
  initAsClient(this, address, protocols, options);
@@ -28433,12 +28591,12 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28433
28591
  if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) this._socket.end();
28434
28592
  return;
28435
28593
  }
28436
- this._readyState = WebSocket.CLOSING;
28437
28594
  this._sender.close(code, data, !this._isServer, (err) => {
28438
28595
  if (err) return;
28439
28596
  this._closeFrameSent = true;
28440
28597
  if (this._closeFrameReceived || this._receiver._writableState.errorEmitted) this._socket.end();
28441
28598
  });
28599
+ this._readyState = WebSocket.CLOSING;
28442
28600
  setCloseTimer(this);
28443
28601
  }
28444
28602
  /**
@@ -28721,6 +28879,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28721
28879
  socketPath: void 0,
28722
28880
  hostname: void 0,
28723
28881
  protocol: void 0,
28882
+ protocols: void 0,
28724
28883
  timeout: void 0,
28725
28884
  method: "GET",
28726
28885
  host: void 0,
@@ -29172,7 +29331,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29172
29331
  }
29173
29332
  }));
29174
29333
  //#endregion
29175
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/stream.js
29334
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/stream.js
29176
29335
  var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29177
29336
  require_websocket();
29178
29337
  const { Duplex: Duplex$1 } = __require$1("stream");
@@ -29288,7 +29447,7 @@ var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29288
29447
  module.exports = createWebSocketStream;
29289
29448
  }));
29290
29449
  //#endregion
29291
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/subprotocol.js
29450
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/subprotocol.js
29292
29451
  var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29293
29452
  const { tokenChars } = require_validation();
29294
29453
  /**
@@ -29327,7 +29486,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29327
29486
  module.exports = { parse };
29328
29487
  }));
29329
29488
  //#endregion
29330
- //#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket-server.js
29489
+ //#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/websocket-server.js
29331
29490
  var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29332
29491
  const EventEmitter$1 = __require$1("events");
29333
29492
  const http = __require$1("http");
@@ -30008,6 +30167,9 @@ async function _createServer(inlineConfig = {}, options) {
30008
30167
  ...getEnvFilesForMode(config.mode, config.envDir),
30009
30168
  ...publicDir && publicFiles ? [publicDir] : []
30010
30169
  ], resolvedWatchOptions)) : createNoopWatcher(resolvedWatchOptions);
30170
+ watcher.on("error", (error) => {
30171
+ config.logger.error(import_picocolors.default.red(`file watcher error: ${error.message}`));
30172
+ });
30011
30173
  const environments = {};
30012
30174
  await Promise.all(Object.entries(config.environments).map(async ([name, environmentOptions]) => {
30013
30175
  const environment = await environmentOptions.dev.createEnvironment(name, config, { ws });
@@ -30017,6 +30179,7 @@ async function _createServer(inlineConfig = {}, options) {
30017
30179
  previousInstance: options.previousEnvironments?.[environment.name]
30018
30180
  });
30019
30181
  }));
30182
+ options.previousEnvironments = void 0;
30020
30183
  let moduleGraph = new ModuleGraph({
30021
30184
  client: () => environments.client.moduleGraph,
30022
30185
  ssr: () => environments.ssr.moduleGraph
@@ -30222,7 +30385,7 @@ async function _createServer(inlineConfig = {}, options) {
30222
30385
  if (!middlewareMode && httpServer) httpServer.once("listening", () => {
30223
30386
  serverConfig.port = httpServer.address().port;
30224
30387
  });
30225
- if (process.env.DEBUG) middlewares.use(timeMiddleware(root));
30388
+ if (isTimeDebugEnabled) middlewares.use(timeMiddleware(root));
30226
30389
  middlewares.use(rejectInvalidRequestMiddleware());
30227
30390
  const { cors } = serverConfig;
30228
30391
  if (cors !== false) middlewares.use((0, import_lib.default)(typeof cors === "boolean" ? {} : cors));
@@ -31844,8 +32007,8 @@ function importAnalysisPlugin(config) {
31844
32007
  if (specifier === clientPublicPath) return;
31845
32008
  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.`);
31846
32009
  let [url, resolvedId] = await normalizeUrl(specifier, start);
32010
+ if (resolvedId) config.safeModulePaths.add(cleanUrl(resolvedId));
31847
32011
  resolvedId = resolvedId || url;
31848
- config.safeModulePaths.add(fsPathFromUrl(stripBase(url, base)));
31849
32012
  if (url !== specifier) {
31850
32013
  let rewriteDone = false;
31851
32014
  if (!(depsOptimizer?.isOptimizedDepFile(importer) && specifier[0] === ".") && depsOptimizer?.isOptimizedDepFile(resolvedId) && !optimizedDepChunkRE.test(resolvedId)) {
@@ -32067,6 +32230,9 @@ const preloadMethod = `__vitePreload`;
32067
32230
  const preloadMarker = `__VITE_PRELOAD__`;
32068
32231
  const preloadHelperId = "\0vite/preload-helper.js";
32069
32232
  const preloadMarkerRE = new RegExp(preloadMarker, "g");
32233
+ function isCssPreloadUrl(url) {
32234
+ return url.pathname.endsWith(".css");
32235
+ }
32070
32236
  function toRelativePath(filename, importer) {
32071
32237
  const relPath = path.posix.relative(path.posix.dirname(importer), filename);
32072
32238
  return relPath[0] === "." ? relPath : `./${relPath}`;
@@ -32112,7 +32278,7 @@ function detectScriptRel() {
32112
32278
  function preload(baseModule, deps, importerUrl) {
32113
32279
  let promise = Promise.resolve();
32114
32280
  if (__VITE_IS_MODERN__ && deps && deps.length > 0) {
32115
- const links = document.getElementsByTagName("link");
32281
+ let preloadedHrefs;
32116
32282
  const cspNonceMeta = document.querySelector("meta[property=csp-nonce]");
32117
32283
  const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce");
32118
32284
  function allSettled(promises) {
@@ -32125,28 +32291,37 @@ function preload(baseModule, deps, importerUrl) {
32125
32291
  }))));
32126
32292
  }
32127
32293
  function importMetaResolve(specifier) {
32128
- if (import.meta.resolve) return import.meta.resolve(specifier);
32294
+ if (import.meta.resolve) return new URL(import.meta.resolve(specifier));
32129
32295
  return new URL(
32130
32296
  specifier,
32131
32297
  /** #__KEEP__ */
32132
32298
  import.meta.url
32133
- ).href;
32134
- }
32135
- promise = allSettled(deps.map((dep) => {
32136
- dep = assetsURL(dep, importerUrl);
32137
- dep = importMetaResolve(dep);
32138
- if (dep in seen) return;
32139
- seen[dep] = true;
32140
- const isCss = dep.endsWith(".css");
32141
- for (let i = links.length - 1; i >= 0; i--) {
32142
- const link = links[i];
32143
- if (link.href === dep && (!isCss || link.rel === "stylesheet")) return;
32299
+ );
32300
+ }
32301
+ promise = allSettled(deps.map((depString) => {
32302
+ depString = assetsURL(depString, importerUrl);
32303
+ const dep = importMetaResolve(depString);
32304
+ if (dep.href in seen) return;
32305
+ seen[dep.href] = true;
32306
+ const isCss = isCssPreloadUrl(dep);
32307
+ if (preloadedHrefs === void 0) {
32308
+ preloadedHrefs = {
32309
+ all: /* @__PURE__ */ new Set(),
32310
+ styles: /* @__PURE__ */ new Set()
32311
+ };
32312
+ const links = document.getElementsByTagName("link");
32313
+ for (let i = links.length - 1; i >= 0; i--) {
32314
+ const link = links[i];
32315
+ preloadedHrefs.all.add(link.href);
32316
+ if (link.rel === "stylesheet") preloadedHrefs.styles.add(link.href);
32317
+ }
32144
32318
  }
32319
+ if ((isCss ? preloadedHrefs.styles : preloadedHrefs.all).has(dep.href)) return;
32145
32320
  const link = document.createElement("link");
32146
32321
  link.rel = isCss ? "stylesheet" : scriptRel;
32147
32322
  if (!isCss) link.as = "script";
32148
32323
  link.crossOrigin = "";
32149
- link.href = dep;
32324
+ link.href = dep.href;
32150
32325
  if (cspNonce) link.setAttribute("nonce", cspNonce);
32151
32326
  document.head.appendChild(link);
32152
32327
  if (isCss) return new Promise((res, rej) => {
@@ -32174,7 +32349,7 @@ function getPreloadCode(environment, renderBuiltUrlBoolean, isRelativeBase) {
32174
32349
  const scriptRel = modulePreload && modulePreload.polyfill ? `'modulepreload'` : `/* @__PURE__ */ (${detectScriptRel.toString()})()`;
32175
32350
  const assetsURL = renderBuiltUrlBoolean || isRelativeBase ? `function(dep, importerUrl) { return new URL(dep, importerUrl).href }` : `function(dep) { return ${JSON.stringify(environment.config.base)}+dep }`;
32176
32351
  const preloadMethodCode = preload.toString().replaceAll("𝐢𝐦𝐩𝐨𝐫𝐭", "import");
32177
- return `const scriptRel = ${scriptRel};const assetsURL = ${assetsURL};const seen = {};export const ${preloadMethod} = ${preloadMethodCode}`;
32352
+ return `const scriptRel = ${scriptRel};const assetsURL = ${assetsURL};const seen = {};const isCssPreloadUrl = ${isCssPreloadUrl.toString()};export const ${preloadMethod} = ${preloadMethodCode}`;
32178
32353
  }
32179
32354
  /**
32180
32355
  * Build only. During serve this is performed as part of ./importAnalysis.
@@ -32374,7 +32549,7 @@ function buildImportAnalysisPlugin(config) {
32374
32549
  if (s.hasChanged()) {
32375
32550
  chunk.code = s.toString();
32376
32551
  if (buildSourcemap && chunk.map) {
32377
- const nextMap = s.generateMap({
32552
+ const nextMap = s.generateDecodedMap({
32378
32553
  source: chunk.fileName,
32379
32554
  hires: "boundary"
32380
32555
  });
@@ -32587,6 +32762,7 @@ function rolldownDepPlugin(environment, qualified, external) {
32587
32762
  return (kind.startsWith("require") ? _resolveRequire : _resolve)(environment, id, _importer);
32588
32763
  };
32589
32764
  const resolveResult = (id, resolved, kind) => {
32765
+ if (resolved === "__vite-browser-external") return { id: browserExternalId };
32590
32766
  if (resolved.startsWith("__vite-browser-external")) return { id: browserExternalNamespace + id };
32591
32767
  if (resolved.startsWith("__vite-optional-peer-dep")) return { id: optionalPeerDepNamespace + resolved };
32592
32768
  if (allExternalTypesReg.test(resolved)) return resolveAssets(resolved, kind);
@@ -32616,7 +32792,7 @@ function rolldownDepPlugin(environment, qualified, external) {
32616
32792
  const resolved = await resolve(id, importer, kind);
32617
32793
  if (resolved) {
32618
32794
  if (JS_TYPES_RE.test(resolved)) return {
32619
- id: isWindows ? resolved.replaceAll("/", "\\") : resolved,
32795
+ id: isWindows$1 ? resolved.replaceAll("/", "\\") : resolved,
32620
32796
  external: false
32621
32797
  };
32622
32798
  return resolveAssets(resolved, kind);
@@ -32656,8 +32832,13 @@ function rolldownDepPlugin(environment, qualified, external) {
32656
32832
  }
32657
32833
  },
32658
32834
  load: {
32659
- filter: { id: [prefixRegex(browserExternalNamespace), prefixRegex(optionalPeerDepNamespace)] },
32835
+ filter: { id: [
32836
+ exactRegex(browserExternalId),
32837
+ prefixRegex(browserExternalNamespace),
32838
+ prefixRegex(optionalPeerDepNamespace)
32839
+ ] },
32660
32840
  handler(id) {
32841
+ if (id === "__vite-browser-external") return { code: "module.exports = {}" };
32661
32842
  if (id.startsWith(browserExternalNamespace)) {
32662
32843
  const path = id.slice(17);
32663
32844
  if (isProduction) return { code: "module.exports = {}" };
@@ -32709,20 +32890,31 @@ function rolldownDepPlugin(environment, qualified, external) {
32709
32890
  }];
32710
32891
  }
32711
32892
  const matchesEntireLine = (text) => `^${escapeRegex(text)}$`;
32712
- function rolldownCjsExternalPlugin(externals, platform) {
32893
+ function rolldownCjsExternalPlugin(externals, platform, environment) {
32713
32894
  if (platform === "node") return;
32714
32895
  if (platform === "neutral") return;
32715
32896
  const filter = new RegExp(externals.map(matchesEntireLine).join("|"));
32897
+ const packageCache = /* @__PURE__ */ new Map();
32898
+ const resolveRequire = createBackCompatIdResolver(environment.getTopLevelConfig(), {
32899
+ asSrc: false,
32900
+ isRequire: true,
32901
+ scan: true,
32902
+ packageCache
32903
+ });
32716
32904
  return {
32717
32905
  name: "cjs-external",
32718
32906
  resolveId: {
32719
32907
  filter: { id: [prefixRegex(nonFacadePrefix), filter] },
32720
- handler(id, _importer, options) {
32908
+ async handler(id, importer, options) {
32721
32909
  if (id.startsWith(nonFacadePrefix)) return {
32722
32910
  id: id.slice(25),
32723
32911
  external: "absolute"
32724
32912
  };
32725
- if (options.kind === "require-call") return { id: cjsExternalFacadeNamespace + id };
32913
+ if (options.kind === "require-call") {
32914
+ const resolved = await resolveRequire(environment, id, importer).catch(() => void 0);
32915
+ if (resolved?.startsWith("__vite-optional-peer-dep")) return { id: optionalPeerDepNamespace + resolved };
32916
+ return { id: cjsExternalFacadeNamespace + id };
32917
+ }
32726
32918
  return {
32727
32919
  id,
32728
32920
  external: "absolute"
@@ -33675,7 +33867,7 @@ function runOptimizeDeps(environment, depsInfo) {
33675
33867
  fs.writeFileSync(dataPath, stringifyDepsOptimizerMetadata(metadata, depsCacheDir));
33676
33868
  const temporaryPath = depsCacheDir + getTempSuffix();
33677
33869
  const depsCacheDirPresent = fs.existsSync(depsCacheDir);
33678
- if (isWindows) {
33870
+ if (isWindows$1) {
33679
33871
  if (depsCacheDirPresent) {
33680
33872
  debug$4?.(import_picocolors.default.green(`renaming ${depsCacheDir} to ${temporaryPath}`));
33681
33873
  await safeRename(depsCacheDir, temporaryPath);
@@ -33782,7 +33974,7 @@ async function prepareRolldownOptimizerRun(environment, depsInfo, processingCach
33782
33974
  const exportsData = await (depsInfo[id].exportsData ?? extractExportsData(environment, src));
33783
33975
  if (exportsData.jsxLoader) jsxLoader = true;
33784
33976
  const flatId = flattenId(id);
33785
- flatIdDeps[flatId] = isWindows ? src.replaceAll("/", "\\") : src;
33977
+ flatIdDeps[flatId] = isWindows$1 ? src.replaceAll("/", "\\") : src;
33786
33978
  idToExports[id] = exportsData;
33787
33979
  }));
33788
33980
  if (optimizerContext.cancelled) return {
@@ -33796,7 +33988,7 @@ async function prepareRolldownOptimizerRun(environment, depsInfo, processingCach
33796
33988
  const platform = optimizeDeps.rolldownOptions?.platform ?? (environment.config.consumer === "client" || environment.config.ssr.target === "webworker" ? "browser" : "node");
33797
33989
  const external = [...optimizeDeps.exclude ?? []];
33798
33990
  const plugins = await asyncFlatten(arraify(pluginsFromConfig));
33799
- if (external.length) plugins.push(rolldownCjsExternalPlugin(external, platform));
33991
+ if (external.length) plugins.push(rolldownCjsExternalPlugin(external, platform, environment));
33800
33992
  plugins.push(...rolldownDepPlugin(environment, flatIdDeps, external));
33801
33993
  let canceled = false;
33802
33994
  async function build() {
@@ -35136,8 +35328,8 @@ function cssPostPlugin(config) {
35136
35328
  const relativePath = normalizePath(path.relative(cssAssetDirname, filename));
35137
35329
  return relativePath[0] === "." ? relativePath : "./" + relativePath;
35138
35330
  };
35139
- chunkCSS = chunkCSS.replace(assetUrlRE, (_, fileHash) => {
35140
- const filename = this.getFileName(fileHash);
35331
+ chunkCSS = chunkCSS.replace(assetUrlRE, (_, fileHash, urlId) => {
35332
+ const filename = this.getFileName(fileHash) + getAssetUrlPostfix(this.environment, urlId);
35141
35333
  chunk.viteMetadata.importedAssets.add(cleanUrl(filename));
35142
35334
  return encodeURIPath(toOutputFilePathInCss(filename, "asset", cssAssetName, "css", config, toRelative));
35143
35335
  });
@@ -35443,7 +35635,7 @@ function createCSSResolvers(config) {
35443
35635
  skipMainField: true
35444
35636
  });
35445
35637
  sassResolve = async (...args) => {
35446
- if (args[1].startsWith("file://")) args[1] = fileURLToPath(args[1], { windows: isWindows && !fileURLWithWindowsDriveRE.test(args[1]) ? false : void 0 });
35638
+ if (args[1].startsWith("file://")) args[1] = fileURLToPath(args[1], { windows: isWindows$1 && !fileURLWithWindowsDriveRE.test(args[1]) ? false : void 0 });
35447
35639
  return resolver(...args);
35448
35640
  };
35449
35641
  }
@@ -36964,7 +37156,7 @@ function buildHtmlPlugin(config) {
36964
37156
  const processedEncodedUrl = await processSrcSet(attr.value, async ({ url }) => {
36965
37157
  const decodedUrl = decodeURIIfPossible(url);
36966
37158
  if (decodedUrl !== void 0 && !isExcludedUrl(decodedUrl)) {
36967
- const result = await processAssetUrl(url, getLinkShouldInline(node, attr.attributes));
37159
+ const result = await processAssetUrl(decodedUrl, getLinkShouldInline(node, attr.attributes));
36968
37160
  return result !== decodedUrl ? encodeURIPath(result) : url;
36969
37161
  }
36970
37162
  return url;
@@ -37146,10 +37338,10 @@ function buildHtmlPlugin(config) {
37146
37338
  bundle,
37147
37339
  chunk
37148
37340
  });
37149
- result = result.replace(assetUrlRE, (_, fileHash) => {
37341
+ result = result.replace(assetUrlRE, (_, fileHash, urlId) => {
37150
37342
  const file = this.getFileName(fileHash);
37151
37343
  if (chunk) chunk.viteMetadata.importedAssets.add(cleanUrl(file));
37152
- return encodeURIPath(toOutputAssetFilePath(file));
37344
+ return encodeURIPath(toOutputAssetFilePath(file)) + getAssetUrlPostfix(this.environment, urlId);
37153
37345
  });
37154
37346
  result = result.replace(publicAssetUrlRE, (_, fileHash) => {
37155
37347
  const publicAssetPath = toOutputPublicAssetFilePath(getPublicAssetFilename(fileHash, config));
@@ -37480,7 +37672,7 @@ function getImportMap(bundle, options) {
37480
37672
  }
37481
37673
  //#endregion
37482
37674
  //#region ../../vite/packages/vite/src/node/plugins/asset.ts
37483
- const assetUrlRE = /__VITE_ASSET__([\w$]+)__/g;
37675
+ const assetUrlRE = /__VITE_ASSET__([\w$]{22})(?:_([a-f\d]{24}))?__/g;
37484
37676
  const encodedHashPlaceholderRE = /!~%7B([\w$]{1,17})%7D~/g;
37485
37677
  function unescapeHashPlaceholders(uri) {
37486
37678
  return uri.replace(encodedHashPlaceholderRE, "!~{$1}~");
@@ -37511,10 +37703,10 @@ function renderAssetUrlInJS(pluginContext, chunk, opts, code) {
37511
37703
  assetUrlRE.lastIndex = 0;
37512
37704
  while (match = assetUrlRE.exec(code)) {
37513
37705
  s ||= new MagicString(code);
37514
- const [full, referenceId] = match;
37706
+ const [full, referenceId, urlId] = match;
37515
37707
  const file = pluginContext.getFileName(referenceId);
37516
37708
  chunk.viteMetadata.importedAssets.add(cleanUrl(file));
37517
- const replacement = toOutputFilePathInJS(environment, file, "asset", chunk.fileName, "js", toRelativeRuntime);
37709
+ const replacement = toOutputFilePathInJS(environment, file + getAssetUrlPostfix(environment, urlId), "asset", chunk.fileName, "js", toRelativeRuntime);
37518
37710
  const replacementString = typeof replacement === "string" ? JSON.stringify(encodeURIPath(replacement)).slice(1, -1) : `"+${replacement.runtime}+"`;
37519
37711
  s.update(match.index, match.index + full.length, replacementString);
37520
37712
  }
@@ -37588,7 +37780,7 @@ function assetPlugin(config) {
37588
37780
  };
37589
37781
  }
37590
37782
  return {
37591
- code: `export default ${formatBuiltAsset(resolved, "js")}`,
37783
+ code: `export default ${formatBuiltAsset(resolved, "js", addFileUrlMetadataForAsset(this.environment, resolved, "js"))}`,
37592
37784
  moduleSideEffects: config.command === "build" && this.getModuleInfo(id)?.isEntry ? "no-treeshake" : false,
37593
37785
  meta: config.command === "build" ? { "vite:asset": true } : void 0,
37594
37786
  moduleType: "js"
@@ -37610,8 +37802,9 @@ function assetPlugin(config) {
37610
37802
  }
37611
37803
  files.add(cleanUrl(fileName));
37612
37804
  const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(format, environment.config.isWorker);
37613
- if ((urlId ? fileUrlMetadata.get(environment)?.get(urlId) : void 0)?.asFileUrl) return toRelativeRuntime(fileName, chunkId).runtime;
37614
- const replacement = toOutputFilePathInJS(environment, fileName, "asset", chunkId, "js", toRelativeRuntime);
37805
+ const metadata = urlId ? fileUrlMetadata.get(environment)?.get(urlId) : void 0;
37806
+ if (metadata?.asFileUrl) return toRelativeRuntime(fileName, chunkId).runtime;
37807
+ const replacement = toOutputFilePathInJS(environment, fileName + (metadata?.postfix ?? ""), "asset", chunkId, "js", toRelativeRuntime);
37615
37808
  return typeof replacement === "string" ? JSON.stringify(unescapeHashPlaceholders(encodeURIPath(replacement))) : replacement.runtime;
37616
37809
  },
37617
37810
  renderChunk(code, chunk, opts) {
@@ -37708,7 +37901,17 @@ function isGitLfsPlaceholder(content) {
37708
37901
  */
37709
37902
  async function fileToBuiltUrl(pluginContext, id, format, skipPublicCheck = false, forceInline, asFileUrl = false) {
37710
37903
  const resolved = await resolveBuiltAsset(pluginContext, id, skipPublicCheck, forceInline);
37711
- return formatBuiltAsset(resolved, format, resolved.type === "reference" && format === "js" && asFileUrl ? addFileUrlMetadata(pluginContext.environment, { asFileUrl }) : void 0);
37904
+ return formatBuiltAsset(resolved, format, addFileUrlMetadataForAsset(pluginContext.environment, resolved, format, asFileUrl));
37905
+ }
37906
+ function addFileUrlMetadataForAsset(environment, resolved, format, useFileUrl = false) {
37907
+ if (resolved.type !== "reference") return;
37908
+ const asFileUrl = format === "js" && useFileUrl;
37909
+ const { postfix } = resolved;
37910
+ if (!asFileUrl && !postfix) return;
37911
+ return addFileUrlMetadata(environment, {
37912
+ asFileUrl,
37913
+ postfix
37914
+ });
37712
37915
  }
37713
37916
  function addFileUrlMetadata(environment, metadata) {
37714
37917
  let metadataMap = fileUrlMetadata.get(environment);
@@ -37723,14 +37926,14 @@ function addFileUrlMetadata(environment, metadata) {
37723
37926
  metadataMap.set(urlId, metadata);
37724
37927
  return urlId;
37725
37928
  }
37929
+ function getAssetUrlPostfix(environment, urlId) {
37930
+ return urlId ? fileUrlMetadata.get(environment)?.get(urlId)?.postfix ?? "" : "";
37931
+ }
37726
37932
  /** Format a resolved asset as either a JS expression or a plain-text string. */
37727
37933
  function formatBuiltAsset(resolved, format, urlId) {
37728
37934
  if (resolved.type === "reference") {
37729
- if (format === "js") {
37730
- const base = urlId ? `import.meta.ROLLDOWN_FILE_URL_${resolved.referenceId}_${urlId}` : `import.meta.ROLLDOWN_FILE_URL_${resolved.referenceId}`;
37731
- return resolved.postfix ? `${base} + ${JSON.stringify(resolved.postfix)}` : base;
37732
- }
37733
- return `__VITE_ASSET__${resolved.referenceId}__${resolved.postfix}`;
37935
+ if (format === "js") return urlId ? `import.meta.ROLLDOWN_FILE_URL_${resolved.referenceId}_${urlId}` : `import.meta.ROLLDOWN_FILE_URL_${resolved.referenceId}`;
37936
+ return `__VITE_ASSET__${resolved.referenceId}${urlId ? `_${urlId}` : ""}__`;
37734
37937
  }
37735
37938
  return format === "js" ? JSON.stringify(encodeURIPath(resolved.value)) : resolved.value;
37736
37939
  }
@@ -38065,7 +38268,7 @@ function esbuildBannerFooterCompatPlugin(config) {
38065
38268
  };
38066
38269
  }
38067
38270
  //#endregion
38068
- //#region ../../node_modules/.pnpm/@vitest+utils@5.0.1/node_modules/@vitest/utils/dist/helpers.js
38271
+ //#region ../../node_modules/.pnpm/@vitest+utils@5.0.3/node_modules/@vitest/utils/dist/helpers.js
38069
38272
  function notNullish(v) {
38070
38273
  return v != null;
38071
38274
  }
@@ -38073,14 +38276,14 @@ function isPrimitive(value) {
38073
38276
  return value === null || typeof value !== "function" && typeof value !== "object";
38074
38277
  }
38075
38278
  //#endregion
38076
- //#region ../../node_modules/.pnpm/@vitest+utils@5.0.1/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
38279
+ //#region ../../node_modules/.pnpm/@vitest+utils@5.0.3/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
38077
38280
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
38078
38281
  function normalizeWindowsPath(input = "") {
38079
38282
  if (!input) return input;
38080
38283
  return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
38081
38284
  }
38082
38285
  const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
38083
- function cwd() {
38286
+ function cwd$1() {
38084
38287
  if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
38085
38288
  return "/";
38086
38289
  }
@@ -38089,7 +38292,7 @@ const resolve$2 = function(...arguments_) {
38089
38292
  let resolvedPath = "";
38090
38293
  let resolvedAbsolute = false;
38091
38294
  for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
38092
- const path = index >= 0 ? arguments_[index] : cwd();
38295
+ const path = index >= 0 ? arguments_[index] : cwd$1();
38093
38296
  if (!path || path.length === 0) continue;
38094
38297
  resolvedPath = `${path}/${resolvedPath}`;
38095
38298
  resolvedAbsolute = isAbsolute$2(path);
@@ -38152,7 +38355,7 @@ const isAbsolute$2 = function(p) {
38152
38355
  return _IS_ABSOLUTE_RE.test(p);
38153
38356
  };
38154
38357
  //#endregion
38155
- //#region ../../node_modules/.pnpm/@vitest+utils@5.0.1/node_modules/@vitest/utils/dist/source-map.js
38358
+ //#region ../../node_modules/.pnpm/@vitest+utils@5.0.3/node_modules/@vitest/utils/dist/source-map.js
38156
38359
  var comma = ",".charCodeAt(0);
38157
38360
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
38158
38361
  var intToChar = /* @__PURE__ */ new Uint8Array(64);
@@ -39438,9 +39641,10 @@ function terserPlugin(config) {
39438
39641
  return !!environment.config.build.minify;
39439
39642
  },
39440
39643
  async renderChunk(code, chunk, outputOptions) {
39441
- const usesOxcMinifier = (config.build.minify === true || config.build.minify === "oxc") && outputOptions.minify !== false;
39644
+ const minify = this.environment.config.build.minify;
39645
+ const usesOxcMinifier = (minify === true || minify === "oxc") && outputOptions.minify !== false;
39442
39646
  const minifyLegacyWithTerser = this.environment.config.isOutputOptionsForLegacyChunks?.(outputOptions) && !usesOxcMinifier;
39443
- if (config.build.minify !== "terser" && !minifyLegacyWithTerser) return null;
39647
+ if (minify !== "terser" && !minifyLegacyWithTerser) return null;
39444
39648
  worker ||= makeWorker();
39445
39649
  const terserPath = pathToFileURL(loadTerserPath(config.root)).href;
39446
39650
  try {
@@ -39727,6 +39931,11 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
39727
39931
  if (output.sourcemap) logger.warnOnce(import_picocolors.default.yellow("Vite does not support \"rolldownOptions.output.sourcemap\". Please use \"build.sourcemap\" instead."));
39728
39932
  const format = output.format || "es";
39729
39933
  const jsExt = ssr && !isSsrTargetWebworkerEnvironment || libOptions ? resolveOutputJsExtension(format, findNearestPackageData(root, packageCache)?.data.type) : "js";
39934
+ const resolvedMinify = options.minify === "oxc" ? libOptions && (format === "es" || format === "esm") ? {
39935
+ compress: true,
39936
+ mangle: true,
39937
+ codegen: false
39938
+ } : true : options.minify === false ? "dce-only" : false;
39730
39939
  return {
39731
39940
  dir: outDir,
39732
39941
  format,
@@ -39738,13 +39947,12 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
39738
39947
  chunkFileNames: libOptions ? `[name]-[hash].${jsExt}` : path.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
39739
39948
  assetFileNames: libOptions ? `[name].[ext]` : path.posix.join(options.assetsDir, `[name]-[hash].[ext]`),
39740
39949
  codeSplitting: output.codeSplitting ?? (output.format === "umd" || output.format === "iife" || isSsrTargetWebworkerEnvironment && (typeof input === "string" || Object.keys(input).length === 1) ? false : void 0),
39741
- minify: options.minify === "oxc" ? libOptions && (format === "es" || format === "esm") ? {
39742
- compress: true,
39743
- mangle: true,
39744
- codegen: false
39745
- } : true : options.minify === false ? "dce-only" : false,
39746
39950
  topLevelVar: true,
39747
39951
  ...output,
39952
+ minify: output.minify === void 0 ? resolvedMinify : typeof output.minify === "object" && typeof resolvedMinify === "object" ? {
39953
+ ...resolvedMinify,
39954
+ ...output.minify
39955
+ } : output.minify,
39748
39956
  comments: typeof output.comments === "boolean" ? output.comments : {
39749
39957
  annotation: !options.minify || libOptions && (format === "es" || format === "esm"),
39750
39958
  jsdoc: !options.minify,
@@ -41108,7 +41316,7 @@ function inlineSourceMap(mod, result, startOffset) {
41108
41316
  ...map,
41109
41317
  mappings: ";".repeat(startOffset) + map.mappings
41110
41318
  } : map;
41111
- result.code = `${code.trimEnd()}\n//# sourceURL=${mod.id}\n${MODULE_RUNNER_SOURCEMAPPING_SOURCE}\n//# ${SOURCEMAPPING_URL}=${genSourceMapUrl(sourceMap)}\n`;
41319
+ result.code = `${code.trimEnd()}\n//# sourceURL=${encodeSourceURL(mod.id)}\n${MODULE_RUNNER_SOURCEMAPPING_SOURCE}\n//# ${SOURCEMAPPING_URL}=${genSourceMapUrl(sourceMap)}\n`;
41112
41320
  return result;
41113
41321
  }
41114
41322
  //#endregion
@@ -41142,7 +41350,8 @@ var MemoryFiles = class {
41142
41350
  var BundledDev = class {
41143
41351
  environment;
41144
41352
  _devEngine;
41145
- viteRuntime;
41353
+ /** the vite client and the rolldown runtime; set before the first build so `hasBuildOutput` can count them */
41354
+ staticFiles = /* @__PURE__ */ new Map();
41146
41355
  initialBuildCompleted = false;
41147
41356
  _closed = false;
41148
41357
  clients = new Clients();
@@ -41176,12 +41385,13 @@ var BundledDev = class {
41176
41385
  }
41177
41386
  pendingPayloadFilenames = /* @__PURE__ */ new Set();
41178
41387
  get hasBuildOutput() {
41179
- return this.memoryFiles.size > 1 || this.memoryFiles.size === 1 && !this.memoryFiles.has("bundledDevClient.mjs");
41388
+ return this.memoryFiles.size > this.staticFiles.size;
41180
41389
  }
41181
41390
  async listen() {
41182
41391
  this._closed = false;
41183
41392
  debug$1?.("INITIAL: setup bundle options");
41184
41393
  const rolldownOptions = await this.getRolldownOptions();
41394
+ await this.storeStaticFiles();
41185
41395
  if (Array.isArray(rolldownOptions.output) && rolldownOptions.output.length > 1) throw new Error("multiple output options are not supported in dev mode");
41186
41396
  const outputOptions = Array.isArray(rolldownOptions.output) ? rolldownOptions.output[0] : rolldownOptions.output;
41187
41397
  this.environment.hot.on("vite:client-connected", async (payload, client) => {
@@ -41273,8 +41483,6 @@ var BundledDev = class {
41273
41483
  }, (e) => {
41274
41484
  debug$1?.("INITIAL: run error", e);
41275
41485
  });
41276
- this.viteRuntime = await getHmrImplementation(this.environment.getTopLevelConfig());
41277
- this.storeOutputFiles([]);
41278
41486
  this.waitForInitialBuildFinish().then(() => {
41279
41487
  if (this._closed) return;
41280
41488
  debug$1?.("INITIAL: build done");
@@ -41326,6 +41534,7 @@ var BundledDev = class {
41326
41534
  debug$1?.(`TRIGGER-LAZY: trigger lazy bundling for module ${moduleId} for client ${clientId}`);
41327
41535
  const result = await this.devEngine.compileEntry(moduleId, clientId);
41328
41536
  this.pendingPayloadFilenames.add(result.filename);
41537
+ if (result.sourcemapFilename && result.sourcemap) this.memoryFiles.set(`@vite/${result.sourcemapFilename}`, { source: result.sourcemap });
41329
41538
  return {
41330
41539
  filename: result.filename,
41331
41540
  code: result.code + payloadDeliveredAck(result.filename)
@@ -41348,11 +41557,19 @@ var BundledDev = class {
41348
41557
  await this._devEngine?.close();
41349
41558
  this.initialBuildCompleted = false;
41350
41559
  }
41560
+ async storeStaticFiles() {
41561
+ const sources = new Map([[BUNDLED_DEV_CLIENT_FILENAME, await getHmrImplementation(this.environment.getTopLevelConfig())], ...getRolldownDevRuntimeFiles()]);
41562
+ this.staticFiles.clear();
41563
+ for (const [fileName, source] of sources) {
41564
+ const file = {
41565
+ source,
41566
+ etag: (0, import_etag.default)(Buffer.from(source), { weak: true })
41567
+ };
41568
+ this.staticFiles.set(fileName, file);
41569
+ this.memoryFiles.set(fileName, file);
41570
+ }
41571
+ }
41351
41572
  storeOutputFiles(output) {
41352
- if (this.viteRuntime) this.memoryFiles.set(BUNDLED_DEV_CLIENT_FILENAME, {
41353
- source: this.viteRuntime,
41354
- etag: (0, import_etag.default)(Buffer.from(this.viteRuntime), { weak: true })
41355
- });
41356
41573
  for (const outputFile of output) this.memoryFiles.set(outputFile.fileName, () => {
41357
41574
  const source = outputFile.type === "chunk" ? outputFile.code : outputFile.source;
41358
41575
  return {