vite 8.3.0 → 8.3.2
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.
- package/LICENSE.md +29 -86
- package/dist/client/bundledDevClient.mjs +75 -333
- package/dist/client/client.mjs +74 -23
- package/dist/node/chunks/build.js +2 -2
- package/dist/node/chunks/lib.js +2 -2
- package/dist/node/chunks/node.js +1157 -738
- package/dist/node/index.d.ts +7 -4
- package/dist/node/module-runner.js +26 -10
- package/package.json +13 -13
package/dist/node/chunks/node.js
CHANGED
|
@@ -4,9 +4,9 @@ import { esmExternalRequirePlugin, esmExternalRequirePlugin as esmExternalRequir
|
|
|
4
4
|
import { TsconfigCache, Visitor, minify, minifySync, parse, parseSync, parseSync as parseSync$1, transformSync } from "rolldown/utils";
|
|
5
5
|
import crypto, { randomBytes } from "node:crypto";
|
|
6
6
|
import * as fs$1 from "node:fs";
|
|
7
|
-
import fs, { existsSync, readFileSync } from "node:fs";
|
|
7
|
+
import fs, { closeSync, existsSync, openSync, readFileSync, readSync, statSync } from "node:fs";
|
|
8
8
|
import fsp, { constants } from "node:fs/promises";
|
|
9
|
-
import path, { basename, dirname, extname, isAbsolute, join, normalize, posix, relative, resolve, sep } from "node:path";
|
|
9
|
+
import path, { basename, delimiter, dirname, extname, isAbsolute, join, normalize, posix, relative, resolve, sep } from "node:path";
|
|
10
10
|
import { performance as performance$1 } from "node:perf_hooks";
|
|
11
11
|
import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
|
|
12
12
|
import { format, formatWithOptions, inspect, isDeepStrictEqual, parseEnv, promisify, stripVTControlCharacters } from "node:util";
|
|
@@ -15,7 +15,7 @@ import pm from "picomatch";
|
|
|
15
15
|
import { VERSION as rolldownVersion, rolldown } from "rolldown";
|
|
16
16
|
import { escapePath, glob, globSync, isDynamicPattern } from "tinyglobby";
|
|
17
17
|
import { dev, oxcRuntimePlugin, resolveTsconfig, scan, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteDynamicImportVarsPlugin, viteImportGlobPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWebWorkerPostPlugin } from "rolldown/experimental";
|
|
18
|
-
import childProcess, { exec, execFile, execSync } from "node:child_process";
|
|
18
|
+
import childProcess, { exec, execFile, execSync, spawn } from "node:child_process";
|
|
19
19
|
import { promises } from "node:dns";
|
|
20
20
|
import net from "node:net";
|
|
21
21
|
import os from "node:os";
|
|
@@ -23,14 +23,16 @@ import { isatty } from "node:tty";
|
|
|
23
23
|
import path$1, { isAbsolute as isAbsolute$1, join as join$1, posix as posix$1, resolve as resolve$1, win32 } from "path";
|
|
24
24
|
import { exactRegex, makeIdFiltersToMatchWithQuery, prefixRegex, withFilter } from "rolldown/filter";
|
|
25
25
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
26
|
-
import { readdirSync, statSync } from "fs";
|
|
26
|
+
import { readdirSync, statSync as statSync$1 } from "fs";
|
|
27
27
|
import assert from "node:assert";
|
|
28
|
-
import process$1 from "node:process";
|
|
28
|
+
import process$1, { cwd } from "node:process";
|
|
29
29
|
import v8 from "node:v8";
|
|
30
30
|
import { EventEmitter } from "node:events";
|
|
31
31
|
import { STATUS_CODES, createServer, get } from "node:http";
|
|
32
32
|
import { createServer as createServer$1, get as get$1 } from "node:https";
|
|
33
33
|
import readline from "node:readline";
|
|
34
|
+
import { pipeline } from "node:stream/promises";
|
|
35
|
+
import { PassThrough } from "node:stream";
|
|
34
36
|
import { ESModulesEvaluator, ModuleRunner, createNodeImportMeta } from "vite/module-runner";
|
|
35
37
|
import * as qs from "node:querystring";
|
|
36
38
|
import zlib from "zlib";
|
|
@@ -494,7 +496,7 @@ const MODULE_RUNNER_SOURCEMAPPING_SOURCE = "//# sourceMappingSource=vite-generat
|
|
|
494
496
|
const ERR_OUTDATED_OPTIMIZED_DEP = "ERR_OUTDATED_OPTIMIZED_DEP";
|
|
495
497
|
//#endregion
|
|
496
498
|
//#region src/shared/utils.ts
|
|
497
|
-
const isWindows = typeof process !== "undefined" && process.platform === "win32";
|
|
499
|
+
const isWindows$1 = typeof process !== "undefined" && process.platform === "win32";
|
|
498
500
|
/**
|
|
499
501
|
* Prepend `/@id/` and replace null byte so the id is URL-safe.
|
|
500
502
|
* This is prepended to resolved ids that are not valid browser
|
|
@@ -540,6 +542,25 @@ function promiseWithResolvers() {
|
|
|
540
542
|
reject
|
|
541
543
|
};
|
|
542
544
|
}
|
|
545
|
+
const whitespaceRE$1 = /\s/g;
|
|
546
|
+
const percentEncodedRE = /(?:%[0-9a-f]{2})+/gi;
|
|
547
|
+
const whitespaceOnlyRE = /^\s+$/;
|
|
548
|
+
/** Percent-encodes whitespace, which terminates a `//# sourceURL=` value in V8. */
|
|
549
|
+
function encodeSourceURL(id) {
|
|
550
|
+
return id.replace(whitespaceRE$1, encodeURIComponent);
|
|
551
|
+
}
|
|
552
|
+
/** Reverses {@link encodeSourceURL}. */
|
|
553
|
+
function decodeSourceURL(url) {
|
|
554
|
+
return url.replace(percentEncodedRE, (match) => {
|
|
555
|
+
let decoded;
|
|
556
|
+
try {
|
|
557
|
+
decoded = decodeURIComponent(match);
|
|
558
|
+
} catch {
|
|
559
|
+
return match;
|
|
560
|
+
}
|
|
561
|
+
return whitespaceOnlyRE.test(decoded) ? decoded : match;
|
|
562
|
+
});
|
|
563
|
+
}
|
|
543
564
|
//#endregion
|
|
544
565
|
//#region src/node/baseEnvironment.ts
|
|
545
566
|
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
@@ -628,7 +649,7 @@ var BaseEnvironment = class extends PartialEnvironment {
|
|
|
628
649
|
};
|
|
629
650
|
//#endregion
|
|
630
651
|
//#region package.json
|
|
631
|
-
var version = "8.3.
|
|
652
|
+
var version = "8.3.2";
|
|
632
653
|
//#endregion
|
|
633
654
|
//#region src/node/constants.ts
|
|
634
655
|
const ROLLUP_HOOKS = [
|
|
@@ -726,6 +747,8 @@ const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/client.mjs");
|
|
|
726
747
|
const BUNDLED_DEV_CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/bundledDevClient.mjs");
|
|
727
748
|
/** URL filename the bundled-dev server serves the vite client under */
|
|
728
749
|
const BUNDLED_DEV_CLIENT_FILENAME = "bundledDevClient.mjs";
|
|
750
|
+
/** URL directory the bundled-dev server serves rolldown's dev runtime files under */
|
|
751
|
+
const BUNDLED_DEV_ROLLDOWN_RUNTIME_DIR = "@rolldown";
|
|
729
752
|
const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/env.mjs");
|
|
730
753
|
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
|
731
754
|
const KNOWN_ASSET_TYPES = [
|
|
@@ -762,7 +785,7 @@ const KNOWN_ASSET_TYPES = [
|
|
|
762
785
|
"pdf",
|
|
763
786
|
"txt"
|
|
764
787
|
];
|
|
765
|
-
const DEFAULT_ASSETS_RE = new RegExp(`\\.(
|
|
788
|
+
const DEFAULT_ASSETS_RE = new RegExp(`\\.(?:` + KNOWN_ASSET_TYPES.join("|") + `)(\\?.*)?$`, "i");
|
|
766
789
|
const DEP_VERSION_RE = /[?&](v=[\w.-]+)\b/;
|
|
767
790
|
const loopbackHosts = /* @__PURE__ */ new Set([
|
|
768
791
|
"localhost",
|
|
@@ -840,18 +863,18 @@ function ignoreDeprecationWarnings(fn) {
|
|
|
840
863
|
return ret;
|
|
841
864
|
}
|
|
842
865
|
//#endregion
|
|
843
|
-
//#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.
|
|
866
|
+
//#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.6.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
844
867
|
var comma$1 = ",".charCodeAt(0);
|
|
845
868
|
var semicolon = ";".charCodeAt(0);
|
|
846
869
|
var chars$1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
847
|
-
var intToChar$
|
|
870
|
+
var intToChar$2 = /* @__PURE__ */ new Uint8Array(64);
|
|
848
871
|
var charToInt$1 = /* @__PURE__ */ new Uint8Array(128);
|
|
849
872
|
for (let i = 0; i < chars$1.length; i++) {
|
|
850
873
|
const c = chars$1.charCodeAt(i);
|
|
851
|
-
intToChar$
|
|
874
|
+
intToChar$2[i] = c;
|
|
852
875
|
charToInt$1[c] = i;
|
|
853
876
|
}
|
|
854
|
-
function decodeInteger$1(reader
|
|
877
|
+
function decodeInteger$1(reader) {
|
|
855
878
|
let value = 0;
|
|
856
879
|
let shift = 0;
|
|
857
880
|
let integer = 0;
|
|
@@ -860,21 +883,21 @@ function decodeInteger$1(reader, relative) {
|
|
|
860
883
|
value |= (integer & 31) << shift;
|
|
861
884
|
shift += 5;
|
|
862
885
|
} while (integer & 32);
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
return
|
|
886
|
+
return value;
|
|
887
|
+
}
|
|
888
|
+
function decodeSign(num) {
|
|
889
|
+
return num & 1 ? -2147483648 | -(num >>> 1) : num >>> 1;
|
|
867
890
|
}
|
|
868
|
-
function encodeInteger(builder, num
|
|
869
|
-
let delta = num - relative;
|
|
870
|
-
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
|
|
891
|
+
function encodeInteger(builder, num) {
|
|
871
892
|
do {
|
|
872
|
-
let clamped =
|
|
873
|
-
|
|
874
|
-
if (
|
|
875
|
-
builder.write(intToChar$
|
|
876
|
-
} while (
|
|
877
|
-
|
|
893
|
+
let clamped = num & 31;
|
|
894
|
+
num >>>= 5;
|
|
895
|
+
if (num > 0) clamped |= 32;
|
|
896
|
+
builder.write(intToChar$2[clamped]);
|
|
897
|
+
} while (num > 0);
|
|
898
|
+
}
|
|
899
|
+
function encodeSign(num) {
|
|
900
|
+
return num < 0 ? -num << 1 | 1 : num << 1;
|
|
878
901
|
}
|
|
879
902
|
function hasMoreVlq$1(reader, max) {
|
|
880
903
|
if (reader.pos >= max) return false;
|
|
@@ -924,6 +947,21 @@ var StringReader$1 = class {
|
|
|
924
947
|
return idx === -1 ? buffer.length : idx;
|
|
925
948
|
}
|
|
926
949
|
};
|
|
950
|
+
function encodeRangeMappings(decoded) {
|
|
951
|
+
if (decoded.length === 0) return "";
|
|
952
|
+
const writer = new StringWriter();
|
|
953
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
954
|
+
const indices = decoded[i];
|
|
955
|
+
if (i > 0) writer.write(semicolon);
|
|
956
|
+
let index = 0;
|
|
957
|
+
for (let j = 0; j < indices.length; j++) {
|
|
958
|
+
const offset = indices[j];
|
|
959
|
+
encodeInteger(writer, offset - index);
|
|
960
|
+
index = offset;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
return writer.flush();
|
|
964
|
+
}
|
|
927
965
|
function decode$1(mappings) {
|
|
928
966
|
const { length } = mappings;
|
|
929
967
|
const reader = new StringReader$1(mappings);
|
|
@@ -941,15 +979,15 @@ function decode$1(mappings) {
|
|
|
941
979
|
genColumn = 0;
|
|
942
980
|
while (reader.pos < semi) {
|
|
943
981
|
let seg;
|
|
944
|
-
genColumn
|
|
982
|
+
genColumn += decodeSign(decodeInteger$1(reader));
|
|
945
983
|
if (genColumn < lastCol) sorted = false;
|
|
946
984
|
lastCol = genColumn;
|
|
947
985
|
if (hasMoreVlq$1(reader, semi)) {
|
|
948
|
-
sourcesIndex
|
|
949
|
-
sourceLine
|
|
950
|
-
sourceColumn
|
|
986
|
+
sourcesIndex += decodeSign(decodeInteger$1(reader));
|
|
987
|
+
sourceLine += decodeSign(decodeInteger$1(reader));
|
|
988
|
+
sourceColumn += decodeSign(decodeInteger$1(reader));
|
|
951
989
|
if (hasMoreVlq$1(reader, semi)) {
|
|
952
|
-
namesIndex
|
|
990
|
+
namesIndex += decodeSign(decodeInteger$1(reader));
|
|
953
991
|
seg = [
|
|
954
992
|
genColumn,
|
|
955
993
|
sourcesIndex,
|
|
@@ -993,13 +1031,18 @@ function encode$1(decoded) {
|
|
|
993
1031
|
for (let j = 0; j < line.length; j++) {
|
|
994
1032
|
const segment = line[j];
|
|
995
1033
|
if (j > 0) writer.write(comma$1);
|
|
996
|
-
|
|
1034
|
+
encodeInteger(writer, encodeSign(segment[0] - genColumn));
|
|
1035
|
+
genColumn = segment[0];
|
|
997
1036
|
if (segment.length === 1) continue;
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1037
|
+
encodeInteger(writer, encodeSign(segment[1] - sourcesIndex));
|
|
1038
|
+
encodeInteger(writer, encodeSign(segment[2] - sourceLine));
|
|
1039
|
+
encodeInteger(writer, encodeSign(segment[3] - sourceColumn));
|
|
1040
|
+
sourcesIndex = segment[1];
|
|
1041
|
+
sourceLine = segment[2];
|
|
1042
|
+
sourceColumn = segment[3];
|
|
1001
1043
|
if (segment.length === 4) continue;
|
|
1002
|
-
|
|
1044
|
+
encodeInteger(writer, encodeSign(segment[4] - namesIndex));
|
|
1045
|
+
namesIndex = segment[4];
|
|
1003
1046
|
}
|
|
1004
1047
|
}
|
|
1005
1048
|
return writer.flush();
|
|
@@ -2095,7 +2138,7 @@ function testCaseInsensitiveFS() {
|
|
|
2095
2138
|
const isCaseInsensitiveFS = testCaseInsensitiveFS();
|
|
2096
2139
|
const VOLUME_RE = /^[A-Z]:/i;
|
|
2097
2140
|
function normalizePath(id) {
|
|
2098
|
-
return path.posix.normalize(isWindows ? slash(id) : id);
|
|
2141
|
+
return path.posix.normalize(isWindows$1 ? slash(id) : id);
|
|
2099
2142
|
}
|
|
2100
2143
|
function fsPathFromId(id) {
|
|
2101
2144
|
const fsPath = normalizePath(id.startsWith(FS_PREFIX) ? id.slice(FS_PREFIX.length) : id);
|
|
@@ -2167,7 +2210,7 @@ function removeUrlQuery(url) {
|
|
|
2167
2210
|
}
|
|
2168
2211
|
function injectQuery(url, queryToInject) {
|
|
2169
2212
|
const { file, postfix } = splitFileAndPostfix(url);
|
|
2170
|
-
return `${isWindows ? slash(file) : file}?${queryToInject}${postfix[0] === "?" ? `&${postfix.slice(1)}` : postfix}`;
|
|
2213
|
+
return `${isWindows$1 ? slash(file) : file}?${queryToInject}${postfix[0] === "?" ? `&${postfix.slice(1)}` : postfix}`;
|
|
2171
2214
|
}
|
|
2172
2215
|
const timestampRE = /(\?|&)t=\d{13}(?:&|$)/;
|
|
2173
2216
|
function removeTimestampQuery(url) {
|
|
@@ -2408,7 +2451,7 @@ async function recursiveReaddir(dir) {
|
|
|
2408
2451
|
return dirent.isDirectory() ? recursiveReaddir(res) : normalizePath(res);
|
|
2409
2452
|
}))).flat(1);
|
|
2410
2453
|
}
|
|
2411
|
-
let safeRealpathSync = isWindows ? windowsSafeRealPathSync : fs.realpathSync.native;
|
|
2454
|
+
let safeRealpathSync = isWindows$1 ? windowsSafeRealPathSync : fs.realpathSync.native;
|
|
2412
2455
|
const windowsNetworkMap = /* @__PURE__ */ new Map();
|
|
2413
2456
|
function windowsMappedRealpathSync(path) {
|
|
2414
2457
|
const realPath = fs.realpathSync.native(path);
|
|
@@ -2807,7 +2850,10 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
|
2807
2850
|
const merged = { ...defaults };
|
|
2808
2851
|
if (rollupOptionsRootPaths.has(rootPath)) setupRollupOptionCompat(merged, rootPath);
|
|
2809
2852
|
if (rootPath === "server") setupHmrWsOptionCompat(merged);
|
|
2810
|
-
if (rootPath === "server.hmr") for (const key of wsOptionKeys)
|
|
2853
|
+
if (rootPath === "server.hmr") for (const key of wsOptionKeys) {
|
|
2854
|
+
const descriptor = Object.getOwnPropertyDescriptor(defaults, key);
|
|
2855
|
+
if (descriptor) Object.defineProperty(merged, key, descriptor);
|
|
2856
|
+
}
|
|
2811
2857
|
for (const key in overrides) {
|
|
2812
2858
|
const value = overrides[key];
|
|
2813
2859
|
if (value == null) continue;
|
|
@@ -3437,7 +3483,7 @@ function alias$1(options = {}) {
|
|
|
3437
3483
|
};
|
|
3438
3484
|
}
|
|
3439
3485
|
//#endregion
|
|
3440
|
-
//#region ../../node_modules/.pnpm/magic-string@1.2
|
|
3486
|
+
//#region ../../node_modules/.pnpm/magic-string@1.4.2/node_modules/magic-string/dist/index.mjs
|
|
3441
3487
|
var BitSet = class BitSet {
|
|
3442
3488
|
constructor(arg) {
|
|
3443
3489
|
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
@@ -3531,7 +3577,7 @@ var Chunk = class Chunk {
|
|
|
3531
3577
|
this.outro = "";
|
|
3532
3578
|
this.end = index;
|
|
3533
3579
|
if (this.edited) {
|
|
3534
|
-
newChunk.edit("", false);
|
|
3580
|
+
newChunk.edit("", false, true);
|
|
3535
3581
|
this.content = "";
|
|
3536
3582
|
} else this.content = originalBefore;
|
|
3537
3583
|
newChunk.next = this.next;
|
|
@@ -3548,8 +3594,10 @@ var Chunk = class Chunk {
|
|
|
3548
3594
|
if (this.outro.length) return true;
|
|
3549
3595
|
const trimmed = this.content.replace(rx, "");
|
|
3550
3596
|
if (trimmed.length) {
|
|
3551
|
-
if (trimmed !== this.content)
|
|
3552
|
-
|
|
3597
|
+
if (trimmed !== this.content) {
|
|
3598
|
+
if (this.edited) this.edit(trimmed, this.storeName, true);
|
|
3599
|
+
else this.split(this.start + trimmed.length).edit("", void 0, true);
|
|
3600
|
+
}
|
|
3553
3601
|
return true;
|
|
3554
3602
|
} else {
|
|
3555
3603
|
this.edit("", void 0, true);
|
|
@@ -3562,10 +3610,12 @@ var Chunk = class Chunk {
|
|
|
3562
3610
|
if (this.intro.length) return true;
|
|
3563
3611
|
const trimmed = this.content.replace(rx, "");
|
|
3564
3612
|
if (trimmed.length) {
|
|
3565
|
-
if (trimmed !== this.content)
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3613
|
+
if (trimmed !== this.content) {
|
|
3614
|
+
if (this.edited) this.edit(trimmed, this.storeName, true);
|
|
3615
|
+
else {
|
|
3616
|
+
this.split(this.end - trimmed.length);
|
|
3617
|
+
this.edit("", void 0, true);
|
|
3618
|
+
}
|
|
3569
3619
|
}
|
|
3570
3620
|
return true;
|
|
3571
3621
|
} else {
|
|
@@ -3588,12 +3638,14 @@ var MagicStringError = class extends Error {
|
|
|
3588
3638
|
}
|
|
3589
3639
|
};
|
|
3590
3640
|
function getBtoa() {
|
|
3641
|
+
/* v8 ignore next -- environment fallback, unreachable when `btoa` is present */
|
|
3591
3642
|
if (typeof globalThis !== "undefined" && typeof globalThis.btoa === "function") return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
|
|
3592
3643
|
const buffer = globalThis["Buffer"];
|
|
3593
3644
|
if (buffer) return (str) => buffer.from(str, "utf-8").toString("base64");
|
|
3594
3645
|
return () => {
|
|
3595
3646
|
throw new MagicStringError("unsupported environment: `btoa` or `Buffer` is required");
|
|
3596
3647
|
};
|
|
3648
|
+
/* v8 ignore stop */
|
|
3597
3649
|
}
|
|
3598
3650
|
const btoa$1 = /* #__PURE__ */ getBtoa();
|
|
3599
3651
|
var SourceMap = class {
|
|
@@ -3603,9 +3655,17 @@ var SourceMap = class {
|
|
|
3603
3655
|
this.sources = properties.sources;
|
|
3604
3656
|
this.sourcesContent = properties.sourcesContent;
|
|
3605
3657
|
this.names = properties.names;
|
|
3606
|
-
this.mappings = encode$1(properties.mappings);
|
|
3658
|
+
this.mappings = typeof properties.mappings === "string" ? properties.mappings : encode$1(properties.mappings);
|
|
3607
3659
|
if (typeof properties.x_google_ignoreList !== "undefined") this.x_google_ignoreList = properties.x_google_ignoreList;
|
|
3608
3660
|
if (typeof properties.debugId !== "undefined") this.debugId = properties.debugId;
|
|
3661
|
+
if (typeof properties.rangeMappings !== "undefined") {
|
|
3662
|
+
let shouldOutputRangeMapping = false;
|
|
3663
|
+
for (const line of properties.rangeMappings) if (line.length !== 0) {
|
|
3664
|
+
shouldOutputRangeMapping = true;
|
|
3665
|
+
break;
|
|
3666
|
+
}
|
|
3667
|
+
if (shouldOutputRangeMapping) this.rangeMappings = encodeRangeMappings(properties.rangeMappings);
|
|
3668
|
+
}
|
|
3609
3669
|
}
|
|
3610
3670
|
/**
|
|
3611
3671
|
* Returns the equivalent of `JSON.stringify(map)`
|
|
@@ -3622,12 +3682,8 @@ var SourceMap = class {
|
|
|
3622
3682
|
}
|
|
3623
3683
|
};
|
|
3624
3684
|
function getLocator(source) {
|
|
3625
|
-
const
|
|
3626
|
-
|
|
3627
|
-
for (let i = 0, pos = 0; i < originalLines.length; i++) {
|
|
3628
|
-
lineOffsets.push(pos);
|
|
3629
|
-
pos += originalLines[i].length + 1;
|
|
3630
|
-
}
|
|
3685
|
+
const lineOffsets = [0];
|
|
3686
|
+
for (let i = source.indexOf("\n"); i !== -1; i = source.indexOf("\n", i + 1)) lineOffsets.push(i + 1);
|
|
3631
3687
|
return function locate(index) {
|
|
3632
3688
|
let i = 0;
|
|
3633
3689
|
let j = lineOffsets.length;
|
|
@@ -3673,15 +3729,120 @@ const toString = Object.prototype.toString;
|
|
|
3673
3729
|
function isObject(thing) {
|
|
3674
3730
|
return toString.call(thing) === "[object Object]";
|
|
3675
3731
|
}
|
|
3676
|
-
const
|
|
3732
|
+
const BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3733
|
+
const intToChar$1 = /* #__PURE__ */ (() => {
|
|
3734
|
+
const chars = /* @__PURE__ */ new Uint8Array(64);
|
|
3735
|
+
for (let i = 0; i < 64; i++) chars[i] = BASE64_CHARS.charCodeAt(i);
|
|
3736
|
+
return chars;
|
|
3737
|
+
})();
|
|
3738
|
+
const COMMA = 44;
|
|
3739
|
+
const SEMICOLON = 59;
|
|
3740
|
+
const BUFFER_SIZE = 16384;
|
|
3741
|
+
const FLUSH_THRESHOLD = 16348;
|
|
3742
|
+
const scratch = /* #__PURE__ */ new Uint8Array(BUFFER_SIZE);
|
|
3743
|
+
function writeVlq(pos, num) {
|
|
3744
|
+
num = num < 0 ? -num << 1 | 1 : num << 1;
|
|
3745
|
+
do {
|
|
3746
|
+
let clamped = num & 31;
|
|
3747
|
+
num >>>= 5;
|
|
3748
|
+
if (num > 0) clamped |= 32;
|
|
3749
|
+
scratch[pos++] = intToChar$1[clamped];
|
|
3750
|
+
} while (num > 0);
|
|
3751
|
+
return pos;
|
|
3752
|
+
}
|
|
3753
|
+
const decoder$1 = /* #__PURE__ */ new TextDecoder();
|
|
3754
|
+
var MappingsEncoder = class {
|
|
3755
|
+
constructor() {
|
|
3756
|
+
this.out = "";
|
|
3757
|
+
this.pos = 0;
|
|
3758
|
+
this.lines = [];
|
|
3759
|
+
this.buffered = 0;
|
|
3760
|
+
this.needsComma = false;
|
|
3761
|
+
this.prevGenColumn = 0;
|
|
3762
|
+
this.prevSourceIndex = 0;
|
|
3763
|
+
this.prevSourceLine = 0;
|
|
3764
|
+
this.prevSourceColumn = 0;
|
|
3765
|
+
this.prevNameIndex = 0;
|
|
3766
|
+
}
|
|
3767
|
+
endLine(segments) {
|
|
3768
|
+
this.lines.push(segments);
|
|
3769
|
+
this.buffered += segments.length + 1;
|
|
3770
|
+
if (this.buffered >= 4096) this.drain(null);
|
|
3771
|
+
}
|
|
3772
|
+
segments(segments) {
|
|
3773
|
+
this.drain(segments);
|
|
3774
|
+
}
|
|
3775
|
+
finish(segments) {
|
|
3776
|
+
this.drain(segments);
|
|
3777
|
+
this.flush();
|
|
3778
|
+
return this.out;
|
|
3779
|
+
}
|
|
3780
|
+
drain(trailing) {
|
|
3781
|
+
const lines = this.lines;
|
|
3782
|
+
const lineCount = lines.length;
|
|
3783
|
+
for (let l = 0; l <= lineCount; l++) {
|
|
3784
|
+
const line = l < lineCount ? lines[l] : trailing;
|
|
3785
|
+
if (line === null) break;
|
|
3786
|
+
for (let i = 0; i < line.length; i++) {
|
|
3787
|
+
if (this.pos > FLUSH_THRESHOLD) this.flush();
|
|
3788
|
+
const segment = line[i];
|
|
3789
|
+
if (this.needsComma) scratch[this.pos++] = COMMA;
|
|
3790
|
+
this.needsComma = true;
|
|
3791
|
+
this.pos = writeVlq(this.pos, segment[0] - this.prevGenColumn);
|
|
3792
|
+
this.prevGenColumn = segment[0];
|
|
3793
|
+
this.pos = writeVlq(this.pos, segment[1] - this.prevSourceIndex);
|
|
3794
|
+
this.prevSourceIndex = segment[1];
|
|
3795
|
+
this.pos = writeVlq(this.pos, segment[2] - this.prevSourceLine);
|
|
3796
|
+
this.prevSourceLine = segment[2];
|
|
3797
|
+
this.pos = writeVlq(this.pos, segment[3] - this.prevSourceColumn);
|
|
3798
|
+
this.prevSourceColumn = segment[3];
|
|
3799
|
+
if (segment.length === 5) {
|
|
3800
|
+
this.pos = writeVlq(this.pos, segment[4] - this.prevNameIndex);
|
|
3801
|
+
this.prevNameIndex = segment[4];
|
|
3802
|
+
}
|
|
3803
|
+
}
|
|
3804
|
+
if (l < lineCount) {
|
|
3805
|
+
if (this.pos > FLUSH_THRESHOLD) this.flush();
|
|
3806
|
+
scratch[this.pos++] = SEMICOLON;
|
|
3807
|
+
this.needsComma = false;
|
|
3808
|
+
this.prevGenColumn = 0;
|
|
3809
|
+
}
|
|
3810
|
+
}
|
|
3811
|
+
lines.length = 0;
|
|
3812
|
+
this.buffered = 0;
|
|
3813
|
+
this.flush();
|
|
3814
|
+
}
|
|
3815
|
+
flush() {
|
|
3816
|
+
this.out += decoder$1.decode(scratch.subarray(0, this.pos));
|
|
3817
|
+
this.pos = 0;
|
|
3818
|
+
}
|
|
3819
|
+
};
|
|
3820
|
+
const NEWLINE_CHAR$1 = 10;
|
|
3821
|
+
function isWordCode(code) {
|
|
3822
|
+
return code >= 97 && code <= 122 || code >= 65 && code <= 90 || code >= 48 && code <= 57 || code === 95;
|
|
3823
|
+
}
|
|
3677
3824
|
var Mappings = class {
|
|
3678
|
-
constructor(hires) {
|
|
3825
|
+
constructor(hires, encoder = null) {
|
|
3679
3826
|
this.hires = hires;
|
|
3680
3827
|
this.generatedCodeLine = 0;
|
|
3681
3828
|
this.generatedCodeColumn = 0;
|
|
3682
3829
|
this.raw = [];
|
|
3683
3830
|
this.rawSegments = this.raw[this.generatedCodeLine] = [];
|
|
3684
|
-
this.
|
|
3831
|
+
this.rawRangeMappings = [];
|
|
3832
|
+
this.rawRangeMappingsIndices = this.rawRangeMappings[this.generatedCodeLine] = [];
|
|
3833
|
+
this.encoder = encoder;
|
|
3834
|
+
}
|
|
3835
|
+
nextLine() {
|
|
3836
|
+
if (this.encoder === null) {
|
|
3837
|
+
this.generatedCodeLine += 1;
|
|
3838
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
3839
|
+
} else {
|
|
3840
|
+
this.encoder.endLine(this.rawSegments);
|
|
3841
|
+
this.rawSegments = [];
|
|
3842
|
+
this.generatedCodeLine += 1;
|
|
3843
|
+
}
|
|
3844
|
+
this.generatedCodeColumn = 0;
|
|
3845
|
+
this.rawRangeMappings[this.generatedCodeLine] = this.rawRangeMappingsIndices = [];
|
|
3685
3846
|
}
|
|
3686
3847
|
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
3687
3848
|
if (content.length) {
|
|
@@ -3697,9 +3858,7 @@ var Mappings = class {
|
|
|
3697
3858
|
];
|
|
3698
3859
|
if (nameIndex >= 0) segment.push(nameIndex);
|
|
3699
3860
|
this.rawSegments.push(segment);
|
|
3700
|
-
this.
|
|
3701
|
-
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
3702
|
-
this.generatedCodeColumn = 0;
|
|
3861
|
+
this.nextLine();
|
|
3703
3862
|
previousContentLineEnd = contentLineEnd;
|
|
3704
3863
|
contentLineEnd = content.indexOf("\n", contentLineEnd + 1);
|
|
3705
3864
|
}
|
|
@@ -3712,63 +3871,122 @@ var Mappings = class {
|
|
|
3712
3871
|
if (nameIndex >= 0) segment.push(nameIndex);
|
|
3713
3872
|
this.rawSegments.push(segment);
|
|
3714
3873
|
this.advance(content.slice(previousContentLineEnd + 1));
|
|
3715
|
-
} else if (this.pending) {
|
|
3716
|
-
this.rawSegments.push(this.pending);
|
|
3717
|
-
this.advance(content);
|
|
3718
3874
|
}
|
|
3719
|
-
this.pending = null;
|
|
3720
3875
|
}
|
|
3721
3876
|
addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
|
|
3722
|
-
|
|
3723
|
-
let
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3877
|
+
const end = chunk.end;
|
|
3878
|
+
let i = chunk.start;
|
|
3879
|
+
if (this.hires) {
|
|
3880
|
+
const boundary = this.hires === "boundary";
|
|
3881
|
+
const experimentalRange = this.hires === "experimental-range";
|
|
3882
|
+
const encoder = experimentalRange ? null : this.encoder;
|
|
3883
|
+
let charInHiresBoundary = false;
|
|
3884
|
+
while (i < end) {
|
|
3885
|
+
if (encoder !== null && this.rawSegments.length >= 4096) {
|
|
3886
|
+
encoder.segments(this.rawSegments);
|
|
3887
|
+
this.rawSegments.length = 0;
|
|
3888
|
+
}
|
|
3889
|
+
if (experimentalRange && i + 1 >= end) this.rawSegments.push([
|
|
3890
|
+
this.generatedCodeColumn,
|
|
3891
|
+
sourceIndex,
|
|
3892
|
+
loc.line,
|
|
3893
|
+
loc.column
|
|
3894
|
+
]);
|
|
3895
|
+
const code = original.charCodeAt(i);
|
|
3896
|
+
if (code === NEWLINE_CHAR$1) {
|
|
3897
|
+
loc.line += 1;
|
|
3898
|
+
loc.column = 0;
|
|
3899
|
+
this.nextLine();
|
|
3900
|
+
charInHiresBoundary = false;
|
|
3901
|
+
} else {
|
|
3902
|
+
if (boundary) {
|
|
3903
|
+
if (isWordCode(code)) {
|
|
3904
|
+
if (!charInHiresBoundary) {
|
|
3905
|
+
this.rawSegments.push([
|
|
3906
|
+
this.generatedCodeColumn,
|
|
3907
|
+
sourceIndex,
|
|
3908
|
+
loc.line,
|
|
3909
|
+
loc.column
|
|
3910
|
+
]);
|
|
3911
|
+
charInHiresBoundary = true;
|
|
3912
|
+
}
|
|
3913
|
+
} else {
|
|
3914
|
+
this.rawSegments.push([
|
|
3915
|
+
this.generatedCodeColumn,
|
|
3916
|
+
sourceIndex,
|
|
3917
|
+
loc.line,
|
|
3918
|
+
loc.column
|
|
3919
|
+
]);
|
|
3920
|
+
charInHiresBoundary = false;
|
|
3921
|
+
}
|
|
3922
|
+
} else if (experimentalRange) {
|
|
3923
|
+
if (i === chunk.start) {
|
|
3924
|
+
this.rawRangeMappingsIndices.push(this.rawSegments.length);
|
|
3925
|
+
this.rawSegments.push([
|
|
3926
|
+
this.generatedCodeColumn,
|
|
3927
|
+
sourceIndex,
|
|
3928
|
+
loc.line,
|
|
3929
|
+
loc.column
|
|
3930
|
+
]);
|
|
3931
|
+
}
|
|
3932
|
+
} else this.rawSegments.push([
|
|
3737
3933
|
this.generatedCodeColumn,
|
|
3738
3934
|
sourceIndex,
|
|
3739
3935
|
loc.line,
|
|
3740
3936
|
loc.column
|
|
3741
|
-
];
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3937
|
+
]);
|
|
3938
|
+
loc.column += 1;
|
|
3939
|
+
this.generatedCodeColumn += 1;
|
|
3940
|
+
}
|
|
3941
|
+
i += 1;
|
|
3942
|
+
}
|
|
3943
|
+
} else {
|
|
3944
|
+
const bits = sourcemapLocations.bits;
|
|
3945
|
+
while (i < end) {
|
|
3946
|
+
let newline = original.indexOf("\n", i);
|
|
3947
|
+
if (newline === -1 || newline > end) newline = end;
|
|
3948
|
+
if (newline > i) {
|
|
3949
|
+
this.rawSegments.push([
|
|
3950
|
+
this.generatedCodeColumn,
|
|
3951
|
+
sourceIndex,
|
|
3952
|
+
loc.line,
|
|
3953
|
+
loc.column
|
|
3954
|
+
]);
|
|
3955
|
+
for (let w = i + 1 >> 5, last = newline - 1 >> 5; w <= last; w++) {
|
|
3956
|
+
let word = bits[w];
|
|
3957
|
+
if (!word) continue;
|
|
3958
|
+
const base = w << 5;
|
|
3959
|
+
while (word) {
|
|
3960
|
+
const lowest = word & -word;
|
|
3961
|
+
const index = base + 31 - Math.clz32(lowest);
|
|
3962
|
+
if (index > i && index < newline) {
|
|
3963
|
+
const offset = index - i;
|
|
3964
|
+
this.rawSegments.push([
|
|
3965
|
+
this.generatedCodeColumn + offset,
|
|
3966
|
+
sourceIndex,
|
|
3967
|
+
loc.line,
|
|
3968
|
+
loc.column + offset
|
|
3969
|
+
]);
|
|
3970
|
+
}
|
|
3971
|
+
word ^= lowest;
|
|
3746
3972
|
}
|
|
3747
|
-
} else {
|
|
3748
|
-
this.rawSegments.push(segment);
|
|
3749
|
-
charInHiresBoundary = false;
|
|
3750
3973
|
}
|
|
3751
|
-
|
|
3974
|
+
loc.column += newline - i;
|
|
3975
|
+
this.generatedCodeColumn += newline - i;
|
|
3752
3976
|
}
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3977
|
+
if (newline === end) break;
|
|
3978
|
+
loc.line += 1;
|
|
3979
|
+
loc.column = 0;
|
|
3980
|
+
this.nextLine();
|
|
3981
|
+
i = newline + 1;
|
|
3756
3982
|
}
|
|
3757
|
-
originalCharIndex += 1;
|
|
3758
3983
|
}
|
|
3759
|
-
this.pending = null;
|
|
3760
3984
|
}
|
|
3761
3985
|
advance(str) {
|
|
3762
3986
|
if (!str) return;
|
|
3763
|
-
const
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
this.generatedCodeLine++;
|
|
3767
|
-
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
3768
|
-
}
|
|
3769
|
-
this.generatedCodeColumn = 0;
|
|
3770
|
-
}
|
|
3771
|
-
this.generatedCodeColumn += lines[lines.length - 1].length;
|
|
3987
|
+
const lastNewline = str.lastIndexOf("\n");
|
|
3988
|
+
for (let i = str.indexOf("\n"); i !== -1; i = str.indexOf("\n", i + 1)) this.nextLine();
|
|
3989
|
+
this.generatedCodeColumn += str.length - lastNewline - 1;
|
|
3772
3990
|
}
|
|
3773
3991
|
};
|
|
3774
3992
|
const n$1 = "\n";
|
|
@@ -3779,6 +3997,63 @@ const warned = {
|
|
|
3779
3997
|
insertRight: false,
|
|
3780
3998
|
storeName: false
|
|
3781
3999
|
};
|
|
4000
|
+
/**
|
|
4001
|
+
* Expands the `$` substitution patterns that `String.prototype.replace` accepts
|
|
4002
|
+
* in a string replacement.
|
|
4003
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter
|
|
4004
|
+
*
|
|
4005
|
+
* `captures` holds the capture groups in order, so `captures[0]` is `$1`.
|
|
4006
|
+
* `namedCaptures` is `undefined` when the pattern has no named groups, and
|
|
4007
|
+
* `$<name>` is then literal text - which is also the case for a string search
|
|
4008
|
+
* value, where there are no groups of either kind.
|
|
4009
|
+
*/
|
|
4010
|
+
function expandReplacement(replacement, matched, position, str, captures, namedCaptures) {
|
|
4011
|
+
if (!replacement.includes("$")) return replacement;
|
|
4012
|
+
let result = "";
|
|
4013
|
+
let index = 0;
|
|
4014
|
+
while (index < replacement.length) {
|
|
4015
|
+
const dollar = replacement.indexOf("$", index);
|
|
4016
|
+
if (dollar === -1) {
|
|
4017
|
+
result += replacement.slice(index);
|
|
4018
|
+
break;
|
|
4019
|
+
}
|
|
4020
|
+
result += replacement.slice(index, dollar);
|
|
4021
|
+
const char = replacement[dollar + 1];
|
|
4022
|
+
let expansion = "$";
|
|
4023
|
+
let consumed = 1;
|
|
4024
|
+
if (char === "$") consumed = 2;
|
|
4025
|
+
else if (char === "&") {
|
|
4026
|
+
expansion = matched;
|
|
4027
|
+
consumed = 2;
|
|
4028
|
+
} else if (char === "`") {
|
|
4029
|
+
expansion = str.slice(0, position);
|
|
4030
|
+
consumed = 2;
|
|
4031
|
+
} else if (char === "'") {
|
|
4032
|
+
expansion = str.slice(position + matched.length);
|
|
4033
|
+
consumed = 2;
|
|
4034
|
+
} else if (char === "<" && namedCaptures !== void 0) {
|
|
4035
|
+
const close = replacement.indexOf(">", dollar + 2);
|
|
4036
|
+
if (close !== -1) {
|
|
4037
|
+
expansion = namedCaptures[replacement.slice(dollar + 2, close)] ?? "";
|
|
4038
|
+
consumed = close + 1 - dollar;
|
|
4039
|
+
}
|
|
4040
|
+
} else if (char >= "0" && char <= "9") {
|
|
4041
|
+
const second = replacement[dollar + 2];
|
|
4042
|
+
const double = second >= "0" && second <= "9" ? Number(char + second) : NaN;
|
|
4043
|
+
const single = Number(char);
|
|
4044
|
+
if (double >= 1 && double <= captures.length) {
|
|
4045
|
+
expansion = captures[double - 1] ?? "";
|
|
4046
|
+
consumed = 3;
|
|
4047
|
+
} else if (single >= 1 && single <= captures.length) {
|
|
4048
|
+
expansion = captures[single - 1] ?? "";
|
|
4049
|
+
consumed = 2;
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4052
|
+
result += expansion;
|
|
4053
|
+
index = dollar + consumed;
|
|
4054
|
+
}
|
|
4055
|
+
return result;
|
|
4056
|
+
}
|
|
3782
4057
|
var MagicString = class MagicString {
|
|
3783
4058
|
constructor(string, options = {}) {
|
|
3784
4059
|
const chunk = new Chunk(0, string.length, string);
|
|
@@ -3929,9 +4204,32 @@ var MagicString = class MagicString {
|
|
|
3929
4204
|
*/
|
|
3930
4205
|
generateDecodedMap(options) {
|
|
3931
4206
|
options = options || {};
|
|
4207
|
+
const mappings = new Mappings(options.hires);
|
|
4208
|
+
const names = this._generateMappings(mappings);
|
|
4209
|
+
return {
|
|
4210
|
+
...this._mapProperties(options, names),
|
|
4211
|
+
mappings: mappings.raw,
|
|
4212
|
+
rangeMappings: mappings.rawRangeMappings
|
|
4213
|
+
};
|
|
4214
|
+
}
|
|
4215
|
+
/**
|
|
4216
|
+
* Generates a version 3 sourcemap.
|
|
4217
|
+
*/
|
|
4218
|
+
generateMap(options) {
|
|
4219
|
+
options = options || {};
|
|
4220
|
+
const encoder = new MappingsEncoder();
|
|
4221
|
+
const mappings = new Mappings(options.hires, encoder);
|
|
4222
|
+
const names = this._generateMappings(mappings);
|
|
4223
|
+
return new SourceMap({
|
|
4224
|
+
...this._mapProperties(options, names),
|
|
4225
|
+
mappings: encoder.finish(mappings.rawSegments),
|
|
4226
|
+
rangeMappings: mappings.rawRangeMappings
|
|
4227
|
+
});
|
|
4228
|
+
}
|
|
4229
|
+
/** @internal */
|
|
4230
|
+
_generateMappings(mappings) {
|
|
3932
4231
|
const sourceIndex = 0;
|
|
3933
4232
|
const names = Object.keys(this.storedNames);
|
|
3934
|
-
const mappings = new Mappings(options.hires);
|
|
3935
4233
|
const locate = getLocator(this.original);
|
|
3936
4234
|
if (this.intro) mappings.advance(this.intro);
|
|
3937
4235
|
this.firstChunk.eachNext((chunk) => {
|
|
@@ -3942,21 +4240,18 @@ var MagicString = class MagicString {
|
|
|
3942
4240
|
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
3943
4241
|
});
|
|
3944
4242
|
if (this.outro) mappings.advance(this.outro);
|
|
4243
|
+
return names;
|
|
4244
|
+
}
|
|
4245
|
+
/** @internal */
|
|
4246
|
+
_mapProperties(options, names) {
|
|
3945
4247
|
return {
|
|
3946
4248
|
file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
|
|
3947
4249
|
sources: [options.source ? getRelativePath(options.file || "", options.source) : options.file || ""],
|
|
3948
4250
|
sourcesContent: options.includeContent ? [this.original] : void 0,
|
|
3949
4251
|
names,
|
|
3950
|
-
|
|
3951
|
-
x_google_ignoreList: this.ignoreList ? [sourceIndex] : void 0
|
|
4252
|
+
x_google_ignoreList: this.ignoreList ? [0] : void 0
|
|
3952
4253
|
};
|
|
3953
4254
|
}
|
|
3954
|
-
/**
|
|
3955
|
-
* Generates a version 3 sourcemap.
|
|
3956
|
-
*/
|
|
3957
|
-
generateMap(options) {
|
|
3958
|
-
return new SourceMap(this.generateDecodedMap(options));
|
|
3959
|
-
}
|
|
3960
4255
|
/** @internal */
|
|
3961
4256
|
_ensureindentStr() {
|
|
3962
4257
|
if (this.indentStr === void 0) this.indentStr = guessIndent(this.original);
|
|
@@ -3988,17 +4283,18 @@ var MagicString = class MagicString {
|
|
|
3988
4283
|
for (let i = exclusion[0]; i < exclusion[1]; i += 1) isExcluded[i] = true;
|
|
3989
4284
|
});
|
|
3990
4285
|
let shouldIndentNextCharacter = options.indentStart !== false;
|
|
3991
|
-
const
|
|
3992
|
-
if (
|
|
3993
|
-
|
|
3994
|
-
|
|
4286
|
+
const indentPiece = (str) => {
|
|
4287
|
+
if (str === "") return str;
|
|
4288
|
+
const indented = str.replace(pattern, (match, offset) => offset > 0 || shouldIndentNextCharacter ? `${resolvedIndentStr}${match}` : match);
|
|
4289
|
+
shouldIndentNextCharacter = str[str.length - 1] === "\n";
|
|
4290
|
+
return indented;
|
|
3995
4291
|
};
|
|
3996
|
-
this.intro = this.intro
|
|
4292
|
+
this.intro = indentPiece(this.intro);
|
|
3997
4293
|
let charIndex = 0;
|
|
3998
4294
|
let chunk = this.firstChunk;
|
|
3999
4295
|
const indentAt = (index) => {
|
|
4000
4296
|
shouldIndentNextCharacter = false;
|
|
4001
|
-
if (index === chunk.start) chunk.
|
|
4297
|
+
if (index === chunk.start) chunk.appendRight(resolvedIndentStr);
|
|
4002
4298
|
else {
|
|
4003
4299
|
this._splitChunk(chunk, index);
|
|
4004
4300
|
chunk = chunk.next;
|
|
@@ -4007,11 +4303,9 @@ var MagicString = class MagicString {
|
|
|
4007
4303
|
};
|
|
4008
4304
|
while (chunk) {
|
|
4009
4305
|
const end = chunk.end;
|
|
4306
|
+
if (!isExcluded[chunk.start]) chunk.intro = indentPiece(chunk.intro);
|
|
4010
4307
|
if (chunk.edited) {
|
|
4011
|
-
if (!isExcluded[charIndex])
|
|
4012
|
-
chunk.content = chunk.content.replace(pattern, replacer);
|
|
4013
|
-
if (chunk.content.length) shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === "\n";
|
|
4014
|
-
}
|
|
4308
|
+
if (!isExcluded[charIndex]) chunk.content = indentPiece(chunk.content);
|
|
4015
4309
|
} else if (options.exclude) {
|
|
4016
4310
|
charIndex = chunk.start;
|
|
4017
4311
|
while (charIndex < end) {
|
|
@@ -4041,10 +4335,11 @@ var MagicString = class MagicString {
|
|
|
4041
4335
|
charIndex += 1;
|
|
4042
4336
|
}
|
|
4043
4337
|
}
|
|
4338
|
+
if (!isExcluded[chunk.end - 1]) chunk.outro = indentPiece(chunk.outro);
|
|
4044
4339
|
charIndex = chunk.end;
|
|
4045
4340
|
chunk = chunk.next;
|
|
4046
4341
|
}
|
|
4047
|
-
this.outro = this.outro
|
|
4342
|
+
this.outro = indentPiece(this.outro);
|
|
4048
4343
|
return this;
|
|
4049
4344
|
}
|
|
4050
4345
|
/** @internal */
|
|
@@ -4069,8 +4364,14 @@ var MagicString = class MagicString {
|
|
|
4069
4364
|
}
|
|
4070
4365
|
/**
|
|
4071
4366
|
* Moves the characters from `start` and `end` to `index`.
|
|
4367
|
+
*
|
|
4368
|
+
* `affinity` controls where the range is anchored at `index`. With the
|
|
4369
|
+
* default `'right'`, it is inserted before the content that starts at `index`;
|
|
4370
|
+
* with `'left'`, it is inserted after the content that ends at `index`. The
|
|
4371
|
+
* two differ only when other content has already been moved to that boundary,
|
|
4372
|
+
* mirroring the `appendLeft`/`appendRight` distinction.
|
|
4072
4373
|
*/
|
|
4073
|
-
move(start, end, index) {
|
|
4374
|
+
move(start, end, index, affinity = "right") {
|
|
4074
4375
|
start = start + this.offset;
|
|
4075
4376
|
end = end + this.offset;
|
|
4076
4377
|
index = index + this.offset;
|
|
@@ -4090,9 +4391,27 @@ var MagicString = class MagicString {
|
|
|
4090
4391
|
}
|
|
4091
4392
|
const oldLeft = first.previous;
|
|
4092
4393
|
const oldRight = last.next;
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4394
|
+
let newLeft;
|
|
4395
|
+
let newRight;
|
|
4396
|
+
if (affinity === "left") {
|
|
4397
|
+
newLeft = this.byEnd.get(index) ?? null;
|
|
4398
|
+
if (!newLeft) {
|
|
4399
|
+
if (first === this.firstChunk) return this;
|
|
4400
|
+
newRight = this.firstChunk;
|
|
4401
|
+
} else {
|
|
4402
|
+
if (newLeft.next === first) return this;
|
|
4403
|
+
newRight = newLeft.next;
|
|
4404
|
+
}
|
|
4405
|
+
} else {
|
|
4406
|
+
newRight = this.byStart.get(index) ?? null;
|
|
4407
|
+
if (!newRight) {
|
|
4408
|
+
if (last === this.lastChunk) return this;
|
|
4409
|
+
newLeft = this.lastChunk;
|
|
4410
|
+
} else {
|
|
4411
|
+
if (newRight.previous === last) return this;
|
|
4412
|
+
newLeft = newRight.previous;
|
|
4413
|
+
}
|
|
4414
|
+
}
|
|
4096
4415
|
if (oldLeft) oldLeft.next = oldRight;
|
|
4097
4416
|
if (oldRight) oldRight.previous = oldLeft;
|
|
4098
4417
|
if (newLeft) newLeft.next = first;
|
|
@@ -4167,6 +4486,7 @@ var MagicString = class MagicString {
|
|
|
4167
4486
|
}
|
|
4168
4487
|
const first = this.byStart.get(start);
|
|
4169
4488
|
const last = this.byEnd.get(end);
|
|
4489
|
+
/* v8 ignore else -- unreachable: a valid start/end always yields a `first` chunk */
|
|
4170
4490
|
if (first) {
|
|
4171
4491
|
let chunk = first;
|
|
4172
4492
|
while (chunk !== last) {
|
|
@@ -4216,7 +4536,10 @@ var MagicString = class MagicString {
|
|
|
4216
4536
|
}
|
|
4217
4537
|
/**
|
|
4218
4538
|
* Removes the characters from `start` to `end` (of the original string, **not** the generated string).
|
|
4219
|
-
*
|
|
4539
|
+
* Content appended or prepended at positions strictly inside the range is removed with it, while
|
|
4540
|
+
* content attached at `start` or `end` is preserved — use `s.overwrite(start, end, '')` to remove
|
|
4541
|
+
* the range including its edge inserts.
|
|
4542
|
+
* Repeated removals and removals with partially overlapping ranges are allowed.
|
|
4220
4543
|
*/
|
|
4221
4544
|
remove(start, end) {
|
|
4222
4545
|
start = start + this.offset;
|
|
@@ -4232,9 +4555,9 @@ var MagicString = class MagicString {
|
|
|
4232
4555
|
this._split(end);
|
|
4233
4556
|
let chunk = this.byStart.get(start);
|
|
4234
4557
|
while (chunk) {
|
|
4235
|
-
chunk.intro = "";
|
|
4236
|
-
chunk.outro = "";
|
|
4237
|
-
chunk.edit("");
|
|
4558
|
+
if (chunk.start > start) chunk.intro = "";
|
|
4559
|
+
if (chunk.end < end) chunk.outro = "";
|
|
4560
|
+
chunk.edit("", false, true);
|
|
4238
4561
|
chunk = end > chunk.end ? this.byStart.get(chunk.end) : null;
|
|
4239
4562
|
}
|
|
4240
4563
|
return this;
|
|
@@ -4314,12 +4637,13 @@ var MagicString = class MagicString {
|
|
|
4314
4637
|
let result = "";
|
|
4315
4638
|
let chunk = this.firstChunk;
|
|
4316
4639
|
while (chunk && (chunk.start > start || chunk.end <= start)) {
|
|
4317
|
-
if (chunk.start < end && chunk.end >= end) return result;
|
|
4640
|
+
if (chunk.start < end && chunk.end >= end || end === 0 && chunk.start === 0) return result;
|
|
4318
4641
|
chunk = chunk.next;
|
|
4319
4642
|
}
|
|
4320
4643
|
if (chunk && chunk.edited && chunk.start !== start) throw new MagicStringError(`cannot use edited character ${start} as slice start anchor`);
|
|
4321
4644
|
const startChunk = chunk;
|
|
4322
4645
|
while (chunk) {
|
|
4646
|
+
if (end === 0 && chunk.start === 0) break;
|
|
4323
4647
|
if (chunk.intro && (startChunk !== chunk || chunk.start === start)) result += chunk.intro;
|
|
4324
4648
|
const containsEnd = chunk.start < end && chunk.end >= end;
|
|
4325
4649
|
if (containsEnd && chunk.edited && chunk.end !== end) throw new MagicStringError(`cannot use edited character ${end} as slice end anchor`);
|
|
@@ -4384,11 +4708,13 @@ var MagicString = class MagicString {
|
|
|
4384
4708
|
* Returns true if the resulting source is empty (disregarding white space).
|
|
4385
4709
|
*/
|
|
4386
4710
|
isEmpty() {
|
|
4711
|
+
if (this.intro.length && this.intro.trim()) return false;
|
|
4387
4712
|
let chunk = this.firstChunk;
|
|
4388
4713
|
while (chunk) {
|
|
4389
4714
|
if (chunk.intro.length && chunk.intro.trim() || chunk.content.length && chunk.content.trim() || chunk.outro.length && chunk.outro.trim()) return false;
|
|
4390
4715
|
chunk = chunk.next;
|
|
4391
4716
|
}
|
|
4717
|
+
if (this.outro.length && this.outro.trim()) return false;
|
|
4392
4718
|
return true;
|
|
4393
4719
|
}
|
|
4394
4720
|
length() {
|
|
@@ -4430,7 +4756,8 @@ var MagicString = class MagicString {
|
|
|
4430
4756
|
if (aborted) return true;
|
|
4431
4757
|
chunk = chunk.previous;
|
|
4432
4758
|
} while (chunk);
|
|
4433
|
-
|
|
4759
|
+
this.intro = this.intro.replace(rx, "");
|
|
4760
|
+
return this.intro.length > 0;
|
|
4434
4761
|
}
|
|
4435
4762
|
/**
|
|
4436
4763
|
* Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the end.
|
|
@@ -4457,7 +4784,8 @@ var MagicString = class MagicString {
|
|
|
4457
4784
|
if (aborted) return true;
|
|
4458
4785
|
chunk = chunk.next;
|
|
4459
4786
|
} while (chunk);
|
|
4460
|
-
|
|
4787
|
+
this.outro = this.outro.replace(rx, "");
|
|
4788
|
+
return this.outro.length > 0;
|
|
4461
4789
|
}
|
|
4462
4790
|
/**
|
|
4463
4791
|
* Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start.
|
|
@@ -4484,41 +4812,72 @@ var MagicString = class MagicString {
|
|
|
4484
4812
|
}
|
|
4485
4813
|
return outputIndex !== this.original.length;
|
|
4486
4814
|
}
|
|
4815
|
+
/**
|
|
4816
|
+
* Whether the original range [start, end) has had any of its characters
|
|
4817
|
+
* removed. `replace`/`replaceAll` search `original`, so a match can land on
|
|
4818
|
+
* text that is no longer in the output - overwriting it would resurrect the
|
|
4819
|
+
* removed characters, so such matches are skipped instead.
|
|
4820
|
+
*
|
|
4821
|
+
* @internal
|
|
4822
|
+
*/
|
|
4823
|
+
_hasRemovedContent(start, end) {
|
|
4824
|
+
let chunk = this.byStart.get(start);
|
|
4825
|
+
if (!chunk) {
|
|
4826
|
+
chunk = this.lastSearchedChunk;
|
|
4827
|
+
const searchForward = start >= chunk.end;
|
|
4828
|
+
while (chunk && !chunk.contains(start)) chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start);
|
|
4829
|
+
if (chunk) this.lastSearchedChunk = chunk;
|
|
4830
|
+
}
|
|
4831
|
+
while (chunk && chunk.start < end) {
|
|
4832
|
+
if (chunk.content === "") return true;
|
|
4833
|
+
chunk = this.byStart.get(chunk.end);
|
|
4834
|
+
}
|
|
4835
|
+
return false;
|
|
4836
|
+
}
|
|
4487
4837
|
/** @internal */
|
|
4488
4838
|
_replaceRegexp(searchValue, replacement) {
|
|
4489
4839
|
function getReplacement(match, str) {
|
|
4490
|
-
if (typeof replacement === "string") return replacement.
|
|
4491
|
-
|
|
4492
|
-
if (i === "&") return match[0];
|
|
4493
|
-
if (+i < match.length) return match[+i];
|
|
4494
|
-
return `$${i}`;
|
|
4495
|
-
});
|
|
4496
|
-
else return replacement(match[0], ...match.slice(1), match.index, str, match.groups);
|
|
4840
|
+
if (typeof replacement === "string") return expandReplacement(replacement, match[0], match.index, str, match.slice(1), match.groups);
|
|
4841
|
+
else return match.groups === void 0 ? replacement(match[0], ...match.slice(1), match.index, str) : replacement(match[0], ...match.slice(1), match.index, str, match.groups);
|
|
4497
4842
|
}
|
|
4498
4843
|
const replaceMatch = (match) => {
|
|
4499
|
-
|
|
4844
|
+
/* v8 ignore next 2 -- `match.index` is always defined for matches from `matchAll` */
|
|
4845
|
+
if (match.index == null) return false;
|
|
4846
|
+
if (this._hasRemovedContent(match.index, match.index + match[0].length)) return false;
|
|
4500
4847
|
const replacement = getReplacement(match, this.original);
|
|
4501
|
-
if (replacement === match[0]) return;
|
|
4848
|
+
if (replacement === match[0]) return true;
|
|
4502
4849
|
if (match[0].length === 0) this.appendRight(match.index, replacement);
|
|
4503
4850
|
else this.overwrite(match.index, match.index + match[0].length, replacement);
|
|
4851
|
+
return true;
|
|
4504
4852
|
};
|
|
4505
4853
|
if (searchValue.global) {
|
|
4506
4854
|
searchValue.lastIndex = 0;
|
|
4507
4855
|
for (const match of this.original.matchAll(searchValue)) replaceMatch(match);
|
|
4508
4856
|
} else {
|
|
4509
4857
|
const match = this.original.match(searchValue);
|
|
4510
|
-
if (match
|
|
4858
|
+
if (match && !replaceMatch(match)) {
|
|
4859
|
+
const global = new RegExp(searchValue.source, `${searchValue.flags}g`);
|
|
4860
|
+
for (const next of this.original.matchAll(global)) if (replaceMatch(next)) break;
|
|
4861
|
+
}
|
|
4511
4862
|
}
|
|
4512
4863
|
return this;
|
|
4513
4864
|
}
|
|
4514
4865
|
/** @internal */
|
|
4515
4866
|
_replaceString(string, replacement) {
|
|
4516
4867
|
const { original } = this;
|
|
4517
|
-
|
|
4518
|
-
|
|
4868
|
+
let index = original.indexOf(string);
|
|
4869
|
+
while (index !== -1) {
|
|
4870
|
+
if (this._hasRemovedContent(index, index + string.length)) {
|
|
4871
|
+
index = original.indexOf(string, index + string.length);
|
|
4872
|
+
continue;
|
|
4873
|
+
}
|
|
4519
4874
|
if (typeof replacement === "function") replacement = replacement(string, index, original);
|
|
4520
|
-
|
|
4521
|
-
|
|
4875
|
+
else replacement = expandReplacement(replacement, string, index, original, [], void 0);
|
|
4876
|
+
if (string !== replacement) {
|
|
4877
|
+
if (string.length === 0) this.appendRight(index, replacement);
|
|
4878
|
+
else this.overwrite(index, index + string.length, replacement);
|
|
4879
|
+
}
|
|
4880
|
+
break;
|
|
4522
4881
|
}
|
|
4523
4882
|
return this;
|
|
4524
4883
|
}
|
|
@@ -4535,14 +4894,16 @@ var MagicString = class MagicString {
|
|
|
4535
4894
|
const stringLength = string.length;
|
|
4536
4895
|
if (stringLength === 0) {
|
|
4537
4896
|
for (let index = 0; index <= original.length; index += 1) {
|
|
4538
|
-
|
|
4897
|
+
if (this._hasRemovedContent(index, index)) continue;
|
|
4898
|
+
const _replacement = typeof replacement === "function" ? replacement("", index, original) : expandReplacement(replacement, "", index, original, [], void 0);
|
|
4539
4899
|
if (_replacement !== "") this.appendRight(index, _replacement);
|
|
4540
4900
|
}
|
|
4541
4901
|
return this;
|
|
4542
4902
|
}
|
|
4543
4903
|
for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
|
|
4904
|
+
if (this._hasRemovedContent(index, index + stringLength)) continue;
|
|
4544
4905
|
const previous = original.slice(index, index + stringLength);
|
|
4545
|
-
const _replacement = typeof replacement === "function" ? replacement(previous, index, original) : replacement;
|
|
4906
|
+
const _replacement = typeof replacement === "function" ? replacement(previous, index, original) : expandReplacement(replacement, previous, index, original, [], void 0);
|
|
4546
4907
|
if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
|
|
4547
4908
|
}
|
|
4548
4909
|
return this;
|
|
@@ -5755,7 +6116,7 @@ function perEnvironmentState(initial) {
|
|
|
5755
6116
|
};
|
|
5756
6117
|
}
|
|
5757
6118
|
//#endregion
|
|
5758
|
-
//#region ../../node_modules/.pnpm/artichokie@0.4.
|
|
6119
|
+
//#region ../../node_modules/.pnpm/artichokie@0.4.5/node_modules/artichokie/dist/index.js
|
|
5759
6120
|
const AsyncFunction = async function() {}.constructor;
|
|
5760
6121
|
const codeToDataUrl = (code) => `data:application/javascript,${encodeURIComponent(code + "\n//# sourceURL=[worker-eval(artichokie)]")}`;
|
|
5761
6122
|
const viteSsrDynamicImport = "__vite_ssr_dynamic_import__";
|
|
@@ -5790,7 +6151,14 @@ var Worker$1 = class {
|
|
|
5790
6151
|
return new Promise((resolve, reject) => {
|
|
5791
6152
|
worker.currentResolve = resolve;
|
|
5792
6153
|
worker.currentReject = reject;
|
|
5793
|
-
|
|
6154
|
+
try {
|
|
6155
|
+
worker.postMessage({ args });
|
|
6156
|
+
} catch (err) {
|
|
6157
|
+
worker.currentResolve = null;
|
|
6158
|
+
worker.currentReject = null;
|
|
6159
|
+
this._assignDoneWorker(worker);
|
|
6160
|
+
throw err;
|
|
6161
|
+
}
|
|
5794
6162
|
});
|
|
5795
6163
|
}
|
|
5796
6164
|
stop() {
|
|
@@ -5833,18 +6201,23 @@ var Worker$1 = class {
|
|
|
5833
6201
|
}
|
|
5834
6202
|
this._assignDoneWorker(worker);
|
|
5835
6203
|
});
|
|
5836
|
-
|
|
6204
|
+
const rejectWorker = (err) => {
|
|
5837
6205
|
worker.currentReject?.(err);
|
|
5838
6206
|
worker.currentReject = null;
|
|
5839
6207
|
parentFunctionResponder.close();
|
|
5840
|
-
}
|
|
6208
|
+
};
|
|
6209
|
+
worker.on("error", rejectWorker);
|
|
5841
6210
|
worker.on("exit", (code) => {
|
|
5842
6211
|
const i = this._pool.indexOf(worker);
|
|
5843
6212
|
if (i > -1) this._pool.splice(i, 1);
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
6213
|
+
const idleIndex = this._idlePool.indexOf(worker);
|
|
6214
|
+
if (idleIndex > -1) this._idlePool.splice(idleIndex, 1);
|
|
6215
|
+
if (code !== 0) {
|
|
6216
|
+
rejectWorker(/* @__PURE__ */ new Error(`Worker stopped with non-0 exit code ${code}`));
|
|
6217
|
+
if (this._queue.length) {
|
|
6218
|
+
const [resolve, reject] = this._queue.shift();
|
|
6219
|
+
this._getAvailableWorker().then(resolve, reject);
|
|
6220
|
+
}
|
|
5848
6221
|
}
|
|
5849
6222
|
});
|
|
5850
6223
|
this._pool.push(worker);
|
|
@@ -6097,11 +6470,11 @@ var WorkerWithFallback = class {
|
|
|
6097
6470
|
//#endregion
|
|
6098
6471
|
//#region ../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js
|
|
6099
6472
|
var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6100
|
-
const path$
|
|
6101
|
-
const fs$
|
|
6473
|
+
const path$7 = __require("path");
|
|
6474
|
+
const fs$7 = __require("fs");
|
|
6102
6475
|
const os$3 = __require("os");
|
|
6103
6476
|
const url$2 = __require("url");
|
|
6104
|
-
const fsReadFileAsync = fs$
|
|
6477
|
+
const fsReadFileAsync = fs$7.promises.readFile;
|
|
6105
6478
|
/** @type {(name: string, sync: boolean) => string[]} */
|
|
6106
6479
|
function getDefaultSearchPlaces(name, sync) {
|
|
6107
6480
|
return [
|
|
@@ -6130,7 +6503,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6130
6503
|
* And on Windows, this will never happen. ('C:\build' -> 'C:')
|
|
6131
6504
|
*/
|
|
6132
6505
|
function parentDir(p) {
|
|
6133
|
-
return path$
|
|
6506
|
+
return path$7.dirname(p) || path$7.sep;
|
|
6134
6507
|
}
|
|
6135
6508
|
/** @type {import('./index').LoaderSync} */
|
|
6136
6509
|
const jsonLoader = (_, content) => JSON.parse(content);
|
|
@@ -6190,7 +6563,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6190
6563
|
}
|
|
6191
6564
|
};
|
|
6192
6565
|
conf.searchPlaces.forEach((place) => {
|
|
6193
|
-
const key = path$
|
|
6566
|
+
const key = path$7.extname(place) || "noExt";
|
|
6194
6567
|
const loader = conf.loaders[key];
|
|
6195
6568
|
if (!loader) throw new Error(`Missing loader for extension "${place}"`);
|
|
6196
6569
|
if (typeof loader !== "function") throw new Error(`Loader for extension "${place}" is not a function: Received ${typeof loader}.`);
|
|
@@ -6242,14 +6615,14 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6242
6615
|
visited.add(dir);
|
|
6243
6616
|
}
|
|
6244
6617
|
for (const searchPlace of searchPlaces) {
|
|
6245
|
-
const filepath = path$
|
|
6618
|
+
const filepath = path$7.join(dir, searchPlace);
|
|
6246
6619
|
try {
|
|
6247
|
-
await fs$
|
|
6620
|
+
await fs$7.promises.access(filepath);
|
|
6248
6621
|
} catch {
|
|
6249
6622
|
continue;
|
|
6250
6623
|
}
|
|
6251
6624
|
const content = String(await fsReadFileAsync(filepath));
|
|
6252
|
-
const loaderKey = path$
|
|
6625
|
+
const loaderKey = path$7.extname(searchPlace) || "noExt";
|
|
6253
6626
|
const loader = loaders[loaderKey];
|
|
6254
6627
|
if (searchPlace === "package.json") {
|
|
6255
6628
|
const pkg = await loader(filepath, content);
|
|
@@ -6282,9 +6655,9 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6282
6655
|
},
|
|
6283
6656
|
async load(filepath) {
|
|
6284
6657
|
validateFilePath(filepath);
|
|
6285
|
-
const absPath = path$
|
|
6658
|
+
const absPath = path$7.resolve(process.cwd(), filepath);
|
|
6286
6659
|
if (cache && loadCache.has(absPath)) return loadCache.get(absPath);
|
|
6287
|
-
const { base, ext } = path$
|
|
6660
|
+
const { base, ext } = path$7.parse(absPath);
|
|
6288
6661
|
const loaderKey = ext || "noExt";
|
|
6289
6662
|
const loader = loaders[loaderKey];
|
|
6290
6663
|
validateLoader(loader, loaderKey);
|
|
@@ -6354,15 +6727,15 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6354
6727
|
visited.add(dir);
|
|
6355
6728
|
}
|
|
6356
6729
|
for (const searchPlace of searchPlaces) {
|
|
6357
|
-
const filepath = path$
|
|
6730
|
+
const filepath = path$7.join(dir, searchPlace);
|
|
6358
6731
|
try {
|
|
6359
|
-
fs$
|
|
6732
|
+
fs$7.accessSync(filepath);
|
|
6360
6733
|
} catch {
|
|
6361
6734
|
continue;
|
|
6362
6735
|
}
|
|
6363
|
-
const loaderKey = path$
|
|
6736
|
+
const loaderKey = path$7.extname(searchPlace) || "noExt";
|
|
6364
6737
|
const loader = loaders[loaderKey];
|
|
6365
|
-
const content = String(fs$
|
|
6738
|
+
const content = String(fs$7.readFileSync(filepath));
|
|
6366
6739
|
if (searchPlace === "package.json") {
|
|
6367
6740
|
const pkg = loader(filepath, content);
|
|
6368
6741
|
const maybeConfig = getPackageProp(packageProp, pkg);
|
|
@@ -6394,13 +6767,13 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6394
6767
|
},
|
|
6395
6768
|
load(filepath) {
|
|
6396
6769
|
validateFilePath(filepath);
|
|
6397
|
-
const absPath = path$
|
|
6770
|
+
const absPath = path$7.resolve(process.cwd(), filepath);
|
|
6398
6771
|
if (cache && loadCache.has(absPath)) return loadCache.get(absPath);
|
|
6399
|
-
const { base, ext } = path$
|
|
6772
|
+
const { base, ext } = path$7.parse(absPath);
|
|
6400
6773
|
const loaderKey = ext || "noExt";
|
|
6401
6774
|
const loader = loaders[loaderKey];
|
|
6402
6775
|
validateLoader(loader, loaderKey);
|
|
6403
|
-
const content = String(fs$
|
|
6776
|
+
const content = String(fs$7.readFileSync(absPath));
|
|
6404
6777
|
if (base === "package.json") {
|
|
6405
6778
|
const pkg = loader(absPath, content);
|
|
6406
6779
|
return transform({
|
|
@@ -6441,7 +6814,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6441
6814
|
};
|
|
6442
6815
|
}));
|
|
6443
6816
|
//#endregion
|
|
6444
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.
|
|
6817
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.15_yaml@2.9.0/node_modules/postcss-load-config/src/req.js
|
|
6445
6818
|
var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6446
6819
|
const { createRequire: createRequire$1 } = __require("node:module");
|
|
6447
6820
|
const { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1 } = __require("node:url");
|
|
@@ -6483,7 +6856,7 @@ var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6483
6856
|
module.exports = req;
|
|
6484
6857
|
}));
|
|
6485
6858
|
//#endregion
|
|
6486
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.
|
|
6859
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.15_yaml@2.9.0/node_modules/postcss-load-config/src/options.js
|
|
6487
6860
|
var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6488
6861
|
const req = require_req();
|
|
6489
6862
|
/**
|
|
@@ -6517,7 +6890,7 @@ var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6517
6890
|
module.exports = options;
|
|
6518
6891
|
}));
|
|
6519
6892
|
//#endregion
|
|
6520
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.
|
|
6893
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.15_yaml@2.9.0/node_modules/postcss-load-config/src/plugins.js
|
|
6521
6894
|
var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6522
6895
|
const req = require_req();
|
|
6523
6896
|
/**
|
|
@@ -6571,7 +6944,7 @@ var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6571
6944
|
module.exports = plugins;
|
|
6572
6945
|
}));
|
|
6573
6946
|
//#endregion
|
|
6574
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.
|
|
6947
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.15_yaml@2.9.0/node_modules/postcss-load-config/src/index.js
|
|
6575
6948
|
var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6576
6949
|
const { resolve: resolve$3 } = __require("node:path");
|
|
6577
6950
|
const config = require_src$1();
|
|
@@ -8756,15 +9129,15 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8756
9129
|
//#endregion
|
|
8757
9130
|
//#region ../../node_modules/.pnpm/readdirp@3.6.0/node_modules/readdirp/index.js
|
|
8758
9131
|
var require_readdirp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
8759
|
-
const fs$
|
|
9132
|
+
const fs$6 = __require("fs");
|
|
8760
9133
|
const { Readable: Readable$1 } = __require("stream");
|
|
8761
9134
|
const sysPath$3 = __require("path");
|
|
8762
9135
|
const { promisify: promisify$4 } = __require("util");
|
|
8763
9136
|
const picomatch$1 = __require("picomatch");
|
|
8764
|
-
const readdir = promisify$4(fs$
|
|
8765
|
-
const stat = promisify$4(fs$
|
|
8766
|
-
const lstat = promisify$4(fs$
|
|
8767
|
-
const realpath = promisify$4(fs$
|
|
9137
|
+
const readdir = promisify$4(fs$6.readdir);
|
|
9138
|
+
const stat = promisify$4(fs$6.stat);
|
|
9139
|
+
const lstat = promisify$4(fs$6.lstat);
|
|
9140
|
+
const realpath = promisify$4(fs$6.realpath);
|
|
8768
9141
|
/**
|
|
8769
9142
|
* @typedef {Object} EntryInfo
|
|
8770
9143
|
* @property {String} path
|
|
@@ -8858,7 +9231,7 @@ var require_readdirp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8858
9231
|
].includes(type);
|
|
8859
9232
|
this._wantsEverything = type === EVERYTHING_TYPE;
|
|
8860
9233
|
this._root = sysPath$3.resolve(root);
|
|
8861
|
-
this._isDirent = "Dirent" in fs$
|
|
9234
|
+
this._isDirent = "Dirent" in fs$6 && !opts.alwaysStat;
|
|
8862
9235
|
this._statsProp = this._isDirent ? "dirent" : "stats";
|
|
8863
9236
|
this._rdOptions = {
|
|
8864
9237
|
encoding: "utf8",
|
|
@@ -9907,7 +10280,7 @@ var require_constants$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9907
10280
|
}));
|
|
9908
10281
|
//#endregion
|
|
9909
10282
|
//#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js
|
|
9910
|
-
var require_parse$
|
|
10283
|
+
var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9911
10284
|
const stringify = require_stringify();
|
|
9912
10285
|
/**
|
|
9913
10286
|
* Constants
|
|
@@ -10198,7 +10571,7 @@ var require_braces = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
10198
10571
|
const stringify = require_stringify();
|
|
10199
10572
|
const compile = require_compile();
|
|
10200
10573
|
const expand = require_expand();
|
|
10201
|
-
const parse = require_parse$
|
|
10574
|
+
const parse = require_parse$1();
|
|
10202
10575
|
/**
|
|
10203
10576
|
* Expand the given pattern or create a regex-compatible string.
|
|
10204
10577
|
*
|
|
@@ -10594,10 +10967,10 @@ var require_binary_extensions = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
10594
10967
|
//#endregion
|
|
10595
10968
|
//#region ../../node_modules/.pnpm/is-binary-path@2.1.0/node_modules/is-binary-path/index.js
|
|
10596
10969
|
var require_is_binary_path = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
10597
|
-
const path$
|
|
10970
|
+
const path$6 = __require("path");
|
|
10598
10971
|
const binaryExtensions = require_binary_extensions();
|
|
10599
10972
|
const extensions = new Set(binaryExtensions);
|
|
10600
|
-
module.exports = (filePath) => extensions.has(path$
|
|
10973
|
+
module.exports = (filePath) => extensions.has(path$6.extname(filePath).slice(1).toLowerCase());
|
|
10601
10974
|
}));
|
|
10602
10975
|
//#endregion
|
|
10603
10976
|
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/constants.js
|
|
@@ -10666,17 +11039,17 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
10666
11039
|
//#endregion
|
|
10667
11040
|
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/nodefs-handler.js
|
|
10668
11041
|
var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
10669
|
-
const fs$
|
|
11042
|
+
const fs$5 = __require("fs");
|
|
10670
11043
|
const sysPath$2 = __require("path");
|
|
10671
11044
|
const { promisify: promisify$3 } = __require("util");
|
|
10672
11045
|
const isBinaryPath = require_is_binary_path();
|
|
10673
11046
|
const { isWindows, isLinux, EMPTY_FN, EMPTY_STR, KEY_LISTENERS, KEY_ERR, KEY_RAW, HANDLER_KEYS, EV_CHANGE, EV_ADD, EV_ADD_DIR, EV_ERROR, STR_DATA, STR_END, BRACE_START, STAR } = require_constants$1();
|
|
10674
11047
|
const THROTTLE_MODE_WATCH = "watch";
|
|
10675
|
-
const open = promisify$3(fs$
|
|
10676
|
-
const stat = promisify$3(fs$
|
|
10677
|
-
const lstat = promisify$3(fs$
|
|
10678
|
-
const close = promisify$3(fs$
|
|
10679
|
-
const fsrealpath = promisify$3(fs$
|
|
11048
|
+
const open = promisify$3(fs$5.open);
|
|
11049
|
+
const stat = promisify$3(fs$5.stat);
|
|
11050
|
+
const lstat = promisify$3(fs$5.lstat);
|
|
11051
|
+
const close = promisify$3(fs$5.close);
|
|
11052
|
+
const fsrealpath = promisify$3(fs$5.realpath);
|
|
10680
11053
|
const statMethods = {
|
|
10681
11054
|
lstat,
|
|
10682
11055
|
stat
|
|
@@ -10732,7 +11105,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
10732
11105
|
if (evPath && path !== evPath) fsWatchBroadcast(sysPath$2.resolve(path, evPath), KEY_LISTENERS, sysPath$2.join(path, evPath));
|
|
10733
11106
|
};
|
|
10734
11107
|
try {
|
|
10735
|
-
return fs$
|
|
11108
|
+
return fs$5.watch(path, options, handleEvent);
|
|
10736
11109
|
} catch (error) {
|
|
10737
11110
|
errHandler(error);
|
|
10738
11111
|
}
|
|
@@ -10822,7 +11195,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
10822
11195
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
10823
11196
|
const copts = cont && cont.options;
|
|
10824
11197
|
if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
|
|
10825
|
-
fs$
|
|
11198
|
+
fs$5.unwatchFile(fullPath);
|
|
10826
11199
|
cont = void 0;
|
|
10827
11200
|
}
|
|
10828
11201
|
if (cont) {
|
|
@@ -10833,7 +11206,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
10833
11206
|
listeners: listener,
|
|
10834
11207
|
rawEmitters: rawEmitter,
|
|
10835
11208
|
options,
|
|
10836
|
-
watcher: fs$
|
|
11209
|
+
watcher: fs$5.watchFile(fullPath, options, (curr, prev) => {
|
|
10837
11210
|
foreach(cont.rawEmitters, (rawEmitter) => {
|
|
10838
11211
|
rawEmitter(EV_CHANGE, fullPath, {
|
|
10839
11212
|
curr,
|
|
@@ -10851,7 +11224,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
10851
11224
|
delFromSet(cont, KEY_RAW, rawEmitter);
|
|
10852
11225
|
if (isEmptySet(cont.listeners)) {
|
|
10853
11226
|
FsWatchFileInstances.delete(fullPath);
|
|
10854
|
-
fs$
|
|
11227
|
+
fs$5.unwatchFile(fullPath);
|
|
10855
11228
|
cont.options = cont.watcher = void 0;
|
|
10856
11229
|
Object.freeze(cont);
|
|
10857
11230
|
}
|
|
@@ -11124,7 +11497,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
11124
11497
|
//#endregion
|
|
11125
11498
|
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/fsevents-handler.js
|
|
11126
11499
|
var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11127
|
-
const fs$
|
|
11500
|
+
const fs$4 = __require("fs");
|
|
11128
11501
|
const sysPath$1 = __require("path");
|
|
11129
11502
|
const { promisify: promisify$2 } = __require("util");
|
|
11130
11503
|
let fsevents;
|
|
@@ -11141,9 +11514,9 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
11141
11514
|
}
|
|
11142
11515
|
const { EV_ADD, EV_CHANGE, EV_ADD_DIR, EV_UNLINK, EV_ERROR, STR_DATA, STR_END, FSEVENT_CREATED, FSEVENT_MODIFIED, FSEVENT_DELETED, FSEVENT_MOVED, FSEVENT_UNKNOWN, FSEVENT_FLAG_MUST_SCAN_SUBDIRS, FSEVENT_TYPE_FILE, FSEVENT_TYPE_DIRECTORY, FSEVENT_TYPE_SYMLINK, ROOT_GLOBSTAR, DIR_SUFFIX, DOT_SLASH, FUNCTION_TYPE, EMPTY_FN, IDENTITY_FN } = require_constants$1();
|
|
11143
11516
|
const Depth = (value) => isNaN(value) ? {} : { depth: value };
|
|
11144
|
-
const stat = promisify$2(fs$
|
|
11145
|
-
const lstat = promisify$2(fs$
|
|
11146
|
-
const realpath = promisify$2(fs$
|
|
11517
|
+
const stat = promisify$2(fs$4.stat);
|
|
11518
|
+
const lstat = promisify$2(fs$4.lstat);
|
|
11519
|
+
const realpath = promisify$2(fs$4.realpath);
|
|
11147
11520
|
const statMethods = {
|
|
11148
11521
|
stat,
|
|
11149
11522
|
lstat
|
|
@@ -11463,7 +11836,7 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
11463
11836
|
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/index.js
|
|
11464
11837
|
var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
11465
11838
|
const { EventEmitter: EventEmitter$4 } = __require("events");
|
|
11466
|
-
const fs$
|
|
11839
|
+
const fs$3 = __require("fs");
|
|
11467
11840
|
const sysPath = __require("path");
|
|
11468
11841
|
const { promisify: promisify$1 } = __require("util");
|
|
11469
11842
|
const readdirp = require_readdirp();
|
|
@@ -11475,8 +11848,8 @@ var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11475
11848
|
const NodeFsHandler = require_nodefs_handler();
|
|
11476
11849
|
const FsEventsHandler = require_fsevents_handler();
|
|
11477
11850
|
const { EV_ALL, EV_READY, EV_ADD, EV_CHANGE, EV_UNLINK, EV_ADD_DIR, EV_UNLINK_DIR, EV_RAW, EV_ERROR, STR_CLOSE, STR_END, BACK_SLASH_RE, DOUBLE_SLASH_RE, SLASH_OR_BACK_SLASH_RE, DOT_RE, REPLACER_RE, SLASH, SLASH_SLASH, BRACE_START, BANG, ONE_DOT, TWO_DOTS, GLOBSTAR, SLASH_GLOBSTAR, ANYMATCH_OPTS, STRING_TYPE, FUNCTION_TYPE, EMPTY_STR, EMPTY_FN, isWindows, isMacos, isIBMi } = require_constants$1();
|
|
11478
|
-
const stat = promisify$1(fs$
|
|
11479
|
-
const readdir = promisify$1(fs$
|
|
11851
|
+
const stat = promisify$1(fs$3.stat);
|
|
11852
|
+
const readdir = promisify$1(fs$3.readdir);
|
|
11480
11853
|
/**
|
|
11481
11854
|
* @typedef {String} Path
|
|
11482
11855
|
* @typedef {'all'|'add'|'addDir'|'change'|'unlink'|'unlinkDir'|'raw'|'error'|'ready'} EventName
|
|
@@ -11964,7 +12337,7 @@ var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11964
12337
|
if (this.options.cwd && !sysPath.isAbsolute(path)) fullPath = sysPath.join(this.options.cwd, path);
|
|
11965
12338
|
const now = /* @__PURE__ */ new Date();
|
|
11966
12339
|
const awaitWriteFinish = (prevStat) => {
|
|
11967
|
-
fs$
|
|
12340
|
+
fs$3.stat(fullPath, (err, curStat) => {
|
|
11968
12341
|
if (err || !this._pendingWrites.has(path)) {
|
|
11969
12342
|
if (err && err.code !== "ENOENT") awfEmit(err);
|
|
11970
12343
|
return;
|
|
@@ -13518,7 +13891,7 @@ var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13518
13891
|
}));
|
|
13519
13892
|
//#endregion
|
|
13520
13893
|
//#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/parse.js
|
|
13521
|
-
var require_parse
|
|
13894
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
13522
13895
|
var CONTROL = "(?:" + [
|
|
13523
13896
|
"\\|\\|",
|
|
13524
13897
|
"\\&\\&",
|
|
@@ -13660,7 +14033,7 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13660
14033
|
//#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/index.js
|
|
13661
14034
|
var require_shell_quote = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
13662
14035
|
exports.quote = require_quote();
|
|
13663
|
-
exports.parse = require_parse
|
|
14036
|
+
exports.parse = require_parse();
|
|
13664
14037
|
}));
|
|
13665
14038
|
//#endregion
|
|
13666
14039
|
//#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/macos.js
|
|
@@ -13733,7 +14106,7 @@ var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13733
14106
|
}));
|
|
13734
14107
|
//#endregion
|
|
13735
14108
|
//#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/windows.js
|
|
13736
|
-
var require_windows
|
|
14109
|
+
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
13737
14110
|
module.exports = [
|
|
13738
14111
|
"Brackets.exe",
|
|
13739
14112
|
"Code.exe",
|
|
@@ -13767,12 +14140,12 @@ var require_windows$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13767
14140
|
//#endregion
|
|
13768
14141
|
//#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/guess.js
|
|
13769
14142
|
var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
13770
|
-
const path$
|
|
14143
|
+
const path$5 = __require("path");
|
|
13771
14144
|
const shellQuote = require_shell_quote();
|
|
13772
14145
|
const childProcess$2 = __require("child_process");
|
|
13773
14146
|
const COMMON_EDITORS_MACOS = require_macos();
|
|
13774
14147
|
const COMMON_EDITORS_LINUX = require_linux();
|
|
13775
|
-
const COMMON_EDITORS_WIN = require_windows
|
|
14148
|
+
const COMMON_EDITORS_WIN = require_windows();
|
|
13776
14149
|
function getEditorFromMacProcesses(output) {
|
|
13777
14150
|
const processNames = Object.keys(COMMON_EDITORS_MACOS);
|
|
13778
14151
|
const processList = output.split("\n");
|
|
@@ -13791,7 +14164,7 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13791
14164
|
const runningProcesses = output.split("\r\n");
|
|
13792
14165
|
for (let i = 0; i < runningProcesses.length; i++) {
|
|
13793
14166
|
const fullProcessPath = runningProcesses[i].trim();
|
|
13794
|
-
const shortProcessName = path$
|
|
14167
|
+
const shortProcessName = path$5.win32.basename(fullProcessPath);
|
|
13795
14168
|
if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) return fullProcessPath;
|
|
13796
14169
|
}
|
|
13797
14170
|
}
|
|
@@ -13842,9 +14215,9 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13842
14215
|
//#endregion
|
|
13843
14216
|
//#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/get-args.js
|
|
13844
14217
|
var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
13845
|
-
const path$
|
|
14218
|
+
const path$4 = __require("path");
|
|
13846
14219
|
module.exports = function getArgumentsForPosition(editor, fileName, lineNumber, columnNumber = 1) {
|
|
13847
|
-
switch (path$
|
|
14220
|
+
switch (path$4.basename(editor).replace(/\.(exe|cmd|bat)$/i, "")) {
|
|
13848
14221
|
case "atom":
|
|
13849
14222
|
case "Atom":
|
|
13850
14223
|
case "Atom Beta":
|
|
@@ -13930,9 +14303,9 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
13930
14303
|
*
|
|
13931
14304
|
* Modified by Yuxi Evan You
|
|
13932
14305
|
*/
|
|
13933
|
-
const fs$
|
|
14306
|
+
const fs$2 = __require("fs");
|
|
13934
14307
|
const os$1 = __require("os");
|
|
13935
|
-
const path$
|
|
14308
|
+
const path$3 = __require("path");
|
|
13936
14309
|
const colors = require_picocolors();
|
|
13937
14310
|
const childProcess$1 = __require("child_process");
|
|
13938
14311
|
const guessEditor = require_guess();
|
|
@@ -13940,7 +14313,7 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
13940
14313
|
function wrapErrorCallback(cb) {
|
|
13941
14314
|
return (fileName, errorMessage) => {
|
|
13942
14315
|
console.log();
|
|
13943
|
-
console.log(colors.red("Could not open " + path$
|
|
14316
|
+
console.log(colors.red("Could not open " + path$3.basename(fileName) + " in the editor."));
|
|
13944
14317
|
if (errorMessage) {
|
|
13945
14318
|
if (errorMessage[errorMessage.length - 1] !== ".") errorMessage += ".";
|
|
13946
14319
|
console.log(colors.red("The editor process exited with an error: " + errorMessage));
|
|
@@ -13973,8 +14346,8 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
13973
14346
|
const parsed = parseFile(file);
|
|
13974
14347
|
let { fileName } = parsed;
|
|
13975
14348
|
const { lineNumber, columnNumber } = parsed;
|
|
13976
|
-
if (process.platform === "win32" && path$
|
|
13977
|
-
if (!fs$
|
|
14349
|
+
if (process.platform === "win32" && path$3.resolve(fileName).startsWith("\\\\")) return onErrorCallback(fileName, "UNC paths are not supported on Windows to avoid security issues. See https://github.com/vitejs/launch-editor/tree/main/packages/launch-editor#unc-paths-on-windows for details.");
|
|
14350
|
+
if (!fs$2.existsSync(fileName)) return;
|
|
13978
14351
|
if (typeof specifiedEditor === "function") {
|
|
13979
14352
|
onErrorCallback = specifiedEditor;
|
|
13980
14353
|
specifiedEditor = void 0;
|
|
@@ -13985,7 +14358,7 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
13985
14358
|
onErrorCallback(fileName, null);
|
|
13986
14359
|
return;
|
|
13987
14360
|
}
|
|
13988
|
-
if (process.platform === "linux" && fileName.startsWith("/mnt/") && /Microsoft/i.test(os$1.release())) fileName = path$
|
|
14361
|
+
if (process.platform === "linux" && fileName.startsWith("/mnt/") && /Microsoft/i.test(os$1.release())) fileName = path$3.relative("", fileName);
|
|
13989
14362
|
if (lineNumber) {
|
|
13990
14363
|
const extraArgs = getArgumentsForPosition(editor, fileName, lineNumber, columnNumber);
|
|
13991
14364
|
args.push.apply(args, extraArgs);
|
|
@@ -14021,7 +14394,7 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
14021
14394
|
//#endregion
|
|
14022
14395
|
//#region ../../node_modules/.pnpm/launch-editor-middleware@2.14.1/node_modules/launch-editor-middleware/index.js
|
|
14023
14396
|
var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14024
|
-
const path$
|
|
14397
|
+
const path$2 = __require("path");
|
|
14025
14398
|
const launch = require_launch_editor();
|
|
14026
14399
|
module.exports = (specifiedEditor, srcRoot, onErrorCallback) => {
|
|
14027
14400
|
if (typeof specifiedEditor === "function") {
|
|
@@ -14048,7 +14421,7 @@ var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports,
|
|
|
14048
14421
|
res.statusCode = 500;
|
|
14049
14422
|
res.end(`launch-editor-middleware: required query param "file" is missing.`);
|
|
14050
14423
|
} else {
|
|
14051
|
-
const resolved = file.startsWith("file://") ? file : path$
|
|
14424
|
+
const resolved = file.startsWith("file://") ? file : path$2.resolve(srcRoot, file);
|
|
14052
14425
|
launch(resolved, specifiedEditor, onErrorCallback);
|
|
14053
14426
|
res.end();
|
|
14054
14427
|
}
|
|
@@ -14304,408 +14677,6 @@ function printServerUrls(urls, optionsHost, info) {
|
|
|
14304
14677
|
if (urls.network.length === 0 && optionsHost === void 0) info(import_picocolors.default.dim(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Network")}: use `) + import_picocolors.default.bold("--host") + import_picocolors.default.dim(" to expose"));
|
|
14305
14678
|
}
|
|
14306
14679
|
//#endregion
|
|
14307
|
-
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
14308
|
-
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14309
|
-
module.exports = isexe;
|
|
14310
|
-
isexe.sync = sync;
|
|
14311
|
-
var fs$4 = __require("fs");
|
|
14312
|
-
function checkPathExt(path, options) {
|
|
14313
|
-
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
14314
|
-
if (!pathext) return true;
|
|
14315
|
-
pathext = pathext.split(";");
|
|
14316
|
-
if (pathext.indexOf("") !== -1) return true;
|
|
14317
|
-
for (var i = 0; i < pathext.length; i++) {
|
|
14318
|
-
var p = pathext[i].toLowerCase();
|
|
14319
|
-
if (p && path.substr(-p.length).toLowerCase() === p) return true;
|
|
14320
|
-
}
|
|
14321
|
-
return false;
|
|
14322
|
-
}
|
|
14323
|
-
function checkStat(stat, path, options) {
|
|
14324
|
-
if (!stat.isSymbolicLink() && !stat.isFile()) return false;
|
|
14325
|
-
return checkPathExt(path, options);
|
|
14326
|
-
}
|
|
14327
|
-
function isexe(path, options, cb) {
|
|
14328
|
-
fs$4.stat(path, function(er, stat) {
|
|
14329
|
-
cb(er, er ? false : checkStat(stat, path, options));
|
|
14330
|
-
});
|
|
14331
|
-
}
|
|
14332
|
-
function sync(path, options) {
|
|
14333
|
-
return checkStat(fs$4.statSync(path), path, options);
|
|
14334
|
-
}
|
|
14335
|
-
}));
|
|
14336
|
-
//#endregion
|
|
14337
|
-
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
|
|
14338
|
-
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14339
|
-
module.exports = isexe;
|
|
14340
|
-
isexe.sync = sync;
|
|
14341
|
-
var fs$3 = __require("fs");
|
|
14342
|
-
function isexe(path, options, cb) {
|
|
14343
|
-
fs$3.stat(path, function(er, stat) {
|
|
14344
|
-
cb(er, er ? false : checkStat(stat, options));
|
|
14345
|
-
});
|
|
14346
|
-
}
|
|
14347
|
-
function sync(path, options) {
|
|
14348
|
-
return checkStat(fs$3.statSync(path), options);
|
|
14349
|
-
}
|
|
14350
|
-
function checkStat(stat, options) {
|
|
14351
|
-
return stat.isFile() && checkMode(stat, options);
|
|
14352
|
-
}
|
|
14353
|
-
function checkMode(stat, options) {
|
|
14354
|
-
var mod = stat.mode;
|
|
14355
|
-
var uid = stat.uid;
|
|
14356
|
-
var gid = stat.gid;
|
|
14357
|
-
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
14358
|
-
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
14359
|
-
var u = parseInt("100", 8);
|
|
14360
|
-
var g = parseInt("010", 8);
|
|
14361
|
-
var o = parseInt("001", 8);
|
|
14362
|
-
var ug = u | g;
|
|
14363
|
-
return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
14364
|
-
}
|
|
14365
|
-
}));
|
|
14366
|
-
//#endregion
|
|
14367
|
-
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
14368
|
-
var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14369
|
-
__require("fs");
|
|
14370
|
-
var core;
|
|
14371
|
-
if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
|
|
14372
|
-
else core = require_mode();
|
|
14373
|
-
module.exports = isexe;
|
|
14374
|
-
isexe.sync = sync;
|
|
14375
|
-
function isexe(path, options, cb) {
|
|
14376
|
-
if (typeof options === "function") {
|
|
14377
|
-
cb = options;
|
|
14378
|
-
options = {};
|
|
14379
|
-
}
|
|
14380
|
-
if (!cb) {
|
|
14381
|
-
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
14382
|
-
return new Promise(function(resolve, reject) {
|
|
14383
|
-
isexe(path, options || {}, function(er, is) {
|
|
14384
|
-
if (er) reject(er);
|
|
14385
|
-
else resolve(is);
|
|
14386
|
-
});
|
|
14387
|
-
});
|
|
14388
|
-
}
|
|
14389
|
-
core(path, options || {}, function(er, is) {
|
|
14390
|
-
if (er) {
|
|
14391
|
-
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
14392
|
-
er = null;
|
|
14393
|
-
is = false;
|
|
14394
|
-
}
|
|
14395
|
-
}
|
|
14396
|
-
cb(er, is);
|
|
14397
|
-
});
|
|
14398
|
-
}
|
|
14399
|
-
function sync(path, options) {
|
|
14400
|
-
try {
|
|
14401
|
-
return core.sync(path, options || {});
|
|
14402
|
-
} catch (er) {
|
|
14403
|
-
if (options && options.ignoreErrors || er.code === "EACCES") return false;
|
|
14404
|
-
else throw er;
|
|
14405
|
-
}
|
|
14406
|
-
}
|
|
14407
|
-
}));
|
|
14408
|
-
//#endregion
|
|
14409
|
-
//#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
14410
|
-
var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14411
|
-
const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
14412
|
-
const path$4 = __require("path");
|
|
14413
|
-
const COLON = isWindows ? ";" : ":";
|
|
14414
|
-
const isexe = require_isexe();
|
|
14415
|
-
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
14416
|
-
const getPathInfo = (cmd, opt) => {
|
|
14417
|
-
const colon = opt.colon || COLON;
|
|
14418
|
-
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
14419
|
-
/* istanbul ignore next: very unusual */ "").split(colon)];
|
|
14420
|
-
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
14421
|
-
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
14422
|
-
if (isWindows) {
|
|
14423
|
-
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
|
|
14424
|
-
}
|
|
14425
|
-
return {
|
|
14426
|
-
pathEnv,
|
|
14427
|
-
pathExt,
|
|
14428
|
-
pathExtExe
|
|
14429
|
-
};
|
|
14430
|
-
};
|
|
14431
|
-
const which = (cmd, opt, cb) => {
|
|
14432
|
-
if (typeof opt === "function") {
|
|
14433
|
-
cb = opt;
|
|
14434
|
-
opt = {};
|
|
14435
|
-
}
|
|
14436
|
-
if (!opt) opt = {};
|
|
14437
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
14438
|
-
const found = [];
|
|
14439
|
-
const step = (i) => new Promise((resolve, reject) => {
|
|
14440
|
-
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
14441
|
-
const ppRaw = pathEnv[i];
|
|
14442
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
14443
|
-
const pCmd = path$4.join(pathPart, cmd);
|
|
14444
|
-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
14445
|
-
resolve(subStep(p, i, 0));
|
|
14446
|
-
});
|
|
14447
|
-
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
|
14448
|
-
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
14449
|
-
const ext = pathExt[ii];
|
|
14450
|
-
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
14451
|
-
if (!er && is) {
|
|
14452
|
-
if (opt.all) found.push(p + ext);
|
|
14453
|
-
else return resolve(p + ext);
|
|
14454
|
-
}
|
|
14455
|
-
return resolve(subStep(p, i, ii + 1));
|
|
14456
|
-
});
|
|
14457
|
-
});
|
|
14458
|
-
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
14459
|
-
};
|
|
14460
|
-
const whichSync = (cmd, opt) => {
|
|
14461
|
-
opt = opt || {};
|
|
14462
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
14463
|
-
const found = [];
|
|
14464
|
-
for (let i = 0; i < pathEnv.length; i++) {
|
|
14465
|
-
const ppRaw = pathEnv[i];
|
|
14466
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
14467
|
-
const pCmd = path$4.join(pathPart, cmd);
|
|
14468
|
-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
14469
|
-
for (let j = 0; j < pathExt.length; j++) {
|
|
14470
|
-
const cur = p + pathExt[j];
|
|
14471
|
-
try {
|
|
14472
|
-
if (isexe.sync(cur, { pathExt: pathExtExe })) {
|
|
14473
|
-
if (opt.all) found.push(cur);
|
|
14474
|
-
else return cur;
|
|
14475
|
-
}
|
|
14476
|
-
} catch (ex) {}
|
|
14477
|
-
}
|
|
14478
|
-
}
|
|
14479
|
-
if (opt.all && found.length) return found;
|
|
14480
|
-
if (opt.nothrow) return null;
|
|
14481
|
-
throw getNotFoundError(cmd);
|
|
14482
|
-
};
|
|
14483
|
-
module.exports = which;
|
|
14484
|
-
which.sync = whichSync;
|
|
14485
|
-
}));
|
|
14486
|
-
//#endregion
|
|
14487
|
-
//#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
14488
|
-
var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14489
|
-
const pathKey = (options = {}) => {
|
|
14490
|
-
const environment = options.env || process.env;
|
|
14491
|
-
if ((options.platform || process.platform) !== "win32") return "PATH";
|
|
14492
|
-
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
14493
|
-
};
|
|
14494
|
-
module.exports = pathKey;
|
|
14495
|
-
module.exports.default = pathKey;
|
|
14496
|
-
}));
|
|
14497
|
-
//#endregion
|
|
14498
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
14499
|
-
var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14500
|
-
const path$3 = __require("path");
|
|
14501
|
-
const which = require_which();
|
|
14502
|
-
const getPathKey = require_path_key();
|
|
14503
|
-
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
14504
|
-
const env = parsed.options.env || process.env;
|
|
14505
|
-
const cwd = process.cwd();
|
|
14506
|
-
const hasCustomCwd = parsed.options.cwd != null;
|
|
14507
|
-
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
14508
|
-
if (shouldSwitchCwd) try {
|
|
14509
|
-
process.chdir(parsed.options.cwd);
|
|
14510
|
-
} catch (err) {}
|
|
14511
|
-
let resolved;
|
|
14512
|
-
try {
|
|
14513
|
-
resolved = which.sync(parsed.command, {
|
|
14514
|
-
path: env[getPathKey({ env })],
|
|
14515
|
-
pathExt: withoutPathExt ? path$3.delimiter : void 0
|
|
14516
|
-
});
|
|
14517
|
-
} catch (e) {} finally {
|
|
14518
|
-
if (shouldSwitchCwd) process.chdir(cwd);
|
|
14519
|
-
}
|
|
14520
|
-
if (resolved) resolved = path$3.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
14521
|
-
return resolved;
|
|
14522
|
-
}
|
|
14523
|
-
function resolveCommand(parsed) {
|
|
14524
|
-
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
14525
|
-
}
|
|
14526
|
-
module.exports = resolveCommand;
|
|
14527
|
-
}));
|
|
14528
|
-
//#endregion
|
|
14529
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
|
|
14530
|
-
var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14531
|
-
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
14532
|
-
function escapeCommand(arg) {
|
|
14533
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
14534
|
-
return arg;
|
|
14535
|
-
}
|
|
14536
|
-
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
14537
|
-
arg = `${arg}`;
|
|
14538
|
-
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
14539
|
-
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
14540
|
-
arg = `"${arg}"`;
|
|
14541
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
14542
|
-
if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
|
|
14543
|
-
return arg;
|
|
14544
|
-
}
|
|
14545
|
-
module.exports.command = escapeCommand;
|
|
14546
|
-
module.exports.argument = escapeArgument;
|
|
14547
|
-
}));
|
|
14548
|
-
//#endregion
|
|
14549
|
-
//#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
|
|
14550
|
-
var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14551
|
-
module.exports = /^#!(.*)/;
|
|
14552
|
-
}));
|
|
14553
|
-
//#endregion
|
|
14554
|
-
//#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
|
|
14555
|
-
var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14556
|
-
const shebangRegex = require_shebang_regex();
|
|
14557
|
-
module.exports = (string = "") => {
|
|
14558
|
-
const match = string.match(shebangRegex);
|
|
14559
|
-
if (!match) return null;
|
|
14560
|
-
const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
14561
|
-
const binary = path.split("/").pop();
|
|
14562
|
-
if (binary === "env") return argument;
|
|
14563
|
-
return argument ? `${binary} ${argument}` : binary;
|
|
14564
|
-
};
|
|
14565
|
-
}));
|
|
14566
|
-
//#endregion
|
|
14567
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
14568
|
-
var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14569
|
-
const fs$2 = __require("fs");
|
|
14570
|
-
const shebangCommand = require_shebang_command();
|
|
14571
|
-
function readShebang(command) {
|
|
14572
|
-
const size = 150;
|
|
14573
|
-
const buffer = Buffer.alloc(size);
|
|
14574
|
-
let fd;
|
|
14575
|
-
try {
|
|
14576
|
-
fd = fs$2.openSync(command, "r");
|
|
14577
|
-
fs$2.readSync(fd, buffer, 0, size, 0);
|
|
14578
|
-
fs$2.closeSync(fd);
|
|
14579
|
-
} catch (e) {}
|
|
14580
|
-
return shebangCommand(buffer.toString());
|
|
14581
|
-
}
|
|
14582
|
-
module.exports = readShebang;
|
|
14583
|
-
}));
|
|
14584
|
-
//#endregion
|
|
14585
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
14586
|
-
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14587
|
-
const path$2 = __require("path");
|
|
14588
|
-
const resolveCommand = require_resolveCommand();
|
|
14589
|
-
const escape = require_escape();
|
|
14590
|
-
const readShebang = require_readShebang();
|
|
14591
|
-
const isWin = process.platform === "win32";
|
|
14592
|
-
const isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
14593
|
-
const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
14594
|
-
function detectShebang(parsed) {
|
|
14595
|
-
parsed.file = resolveCommand(parsed);
|
|
14596
|
-
const shebang = parsed.file && readShebang(parsed.file);
|
|
14597
|
-
if (shebang) {
|
|
14598
|
-
parsed.args.unshift(parsed.file);
|
|
14599
|
-
parsed.command = shebang;
|
|
14600
|
-
return resolveCommand(parsed);
|
|
14601
|
-
}
|
|
14602
|
-
return parsed.file;
|
|
14603
|
-
}
|
|
14604
|
-
function parseNonShell(parsed) {
|
|
14605
|
-
if (!isWin) return parsed;
|
|
14606
|
-
const commandFile = detectShebang(parsed);
|
|
14607
|
-
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
14608
|
-
if (parsed.options.forceShell || needsShell) {
|
|
14609
|
-
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
14610
|
-
parsed.command = path$2.normalize(parsed.command);
|
|
14611
|
-
parsed.command = escape.command(parsed.command);
|
|
14612
|
-
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
14613
|
-
parsed.args = [
|
|
14614
|
-
"/d",
|
|
14615
|
-
"/s",
|
|
14616
|
-
"/c",
|
|
14617
|
-
`"${[parsed.command].concat(parsed.args).join(" ")}"`
|
|
14618
|
-
];
|
|
14619
|
-
parsed.command = process.env.comspec || "cmd.exe";
|
|
14620
|
-
parsed.options.windowsVerbatimArguments = true;
|
|
14621
|
-
}
|
|
14622
|
-
return parsed;
|
|
14623
|
-
}
|
|
14624
|
-
function parse(command, args, options) {
|
|
14625
|
-
if (args && !Array.isArray(args)) {
|
|
14626
|
-
options = args;
|
|
14627
|
-
args = null;
|
|
14628
|
-
}
|
|
14629
|
-
args = args ? args.slice(0) : [];
|
|
14630
|
-
options = Object.assign({}, options);
|
|
14631
|
-
const parsed = {
|
|
14632
|
-
command,
|
|
14633
|
-
args,
|
|
14634
|
-
options,
|
|
14635
|
-
file: void 0,
|
|
14636
|
-
original: {
|
|
14637
|
-
command,
|
|
14638
|
-
args
|
|
14639
|
-
}
|
|
14640
|
-
};
|
|
14641
|
-
return options.shell ? parsed : parseNonShell(parsed);
|
|
14642
|
-
}
|
|
14643
|
-
module.exports = parse;
|
|
14644
|
-
}));
|
|
14645
|
-
//#endregion
|
|
14646
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
|
|
14647
|
-
var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14648
|
-
const isWin = process.platform === "win32";
|
|
14649
|
-
function notFoundError(original, syscall) {
|
|
14650
|
-
return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
|
|
14651
|
-
code: "ENOENT",
|
|
14652
|
-
errno: "ENOENT",
|
|
14653
|
-
syscall: `${syscall} ${original.command}`,
|
|
14654
|
-
path: original.command,
|
|
14655
|
-
spawnargs: original.args
|
|
14656
|
-
});
|
|
14657
|
-
}
|
|
14658
|
-
function hookChildProcess(cp, parsed) {
|
|
14659
|
-
if (!isWin) return;
|
|
14660
|
-
const originalEmit = cp.emit;
|
|
14661
|
-
cp.emit = function(name, arg1) {
|
|
14662
|
-
if (name === "exit") {
|
|
14663
|
-
const err = verifyENOENT(arg1, parsed);
|
|
14664
|
-
if (err) return originalEmit.call(cp, "error", err);
|
|
14665
|
-
}
|
|
14666
|
-
return originalEmit.apply(cp, arguments);
|
|
14667
|
-
};
|
|
14668
|
-
}
|
|
14669
|
-
function verifyENOENT(status, parsed) {
|
|
14670
|
-
if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
|
|
14671
|
-
return null;
|
|
14672
|
-
}
|
|
14673
|
-
function verifyENOENTSync(status, parsed) {
|
|
14674
|
-
if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
|
|
14675
|
-
return null;
|
|
14676
|
-
}
|
|
14677
|
-
module.exports = {
|
|
14678
|
-
hookChildProcess,
|
|
14679
|
-
verifyENOENT,
|
|
14680
|
-
verifyENOENTSync,
|
|
14681
|
-
notFoundError
|
|
14682
|
-
};
|
|
14683
|
-
}));
|
|
14684
|
-
//#endregion
|
|
14685
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
|
|
14686
|
-
var require_cross_spawn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14687
|
-
const cp = __require("child_process");
|
|
14688
|
-
const parse = require_parse();
|
|
14689
|
-
const enoent = require_enoent();
|
|
14690
|
-
function spawn(command, args, options) {
|
|
14691
|
-
const parsed = parse(command, args, options);
|
|
14692
|
-
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
14693
|
-
enoent.hookChildProcess(spawned, parsed);
|
|
14694
|
-
return spawned;
|
|
14695
|
-
}
|
|
14696
|
-
function spawnSync(command, args, options) {
|
|
14697
|
-
const parsed = parse(command, args, options);
|
|
14698
|
-
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
14699
|
-
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
14700
|
-
return result;
|
|
14701
|
-
}
|
|
14702
|
-
module.exports = spawn;
|
|
14703
|
-
module.exports.spawn = spawn;
|
|
14704
|
-
module.exports.sync = spawnSync;
|
|
14705
|
-
module.exports._parse = parse;
|
|
14706
|
-
module.exports._enoent = enoent;
|
|
14707
|
-
}));
|
|
14708
|
-
//#endregion
|
|
14709
14680
|
//#region ../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
|
|
14710
14681
|
let isDockerCached;
|
|
14711
14682
|
function hasDockerEnv() {
|
|
@@ -15162,6 +15133,347 @@ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
|
15162
15133
|
defineLazyProperty(apps, "browser", () => "browser");
|
|
15163
15134
|
defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
|
|
15164
15135
|
//#endregion
|
|
15136
|
+
//#region ../../node_modules/.pnpm/tinyexec@1.3.1/node_modules/tinyexec/dist/main.mjs
|
|
15137
|
+
const isPathLikePattern = /^path$/i;
|
|
15138
|
+
const defaultEnvPathInfo = {
|
|
15139
|
+
key: "PATH",
|
|
15140
|
+
value: ""
|
|
15141
|
+
};
|
|
15142
|
+
function getPathFromEnv(env) {
|
|
15143
|
+
for (const key in env) {
|
|
15144
|
+
if (!Object.prototype.hasOwnProperty.call(env, key) || !isPathLikePattern.test(key)) continue;
|
|
15145
|
+
const value = env[key];
|
|
15146
|
+
if (!value) return defaultEnvPathInfo;
|
|
15147
|
+
return {
|
|
15148
|
+
key,
|
|
15149
|
+
value
|
|
15150
|
+
};
|
|
15151
|
+
}
|
|
15152
|
+
return defaultEnvPathInfo;
|
|
15153
|
+
}
|
|
15154
|
+
function addNodeBinToPath(cwd, path) {
|
|
15155
|
+
const parts = path.value.split(delimiter);
|
|
15156
|
+
const nodeBinPaths = [];
|
|
15157
|
+
let currentPath = typeof cwd === "string" ? cwd : fileURLToPath(cwd, { windows: false });
|
|
15158
|
+
let lastPath;
|
|
15159
|
+
do {
|
|
15160
|
+
nodeBinPaths.push(resolve(currentPath, "node_modules", ".bin"));
|
|
15161
|
+
lastPath = currentPath;
|
|
15162
|
+
currentPath = dirname(currentPath);
|
|
15163
|
+
} while (currentPath !== lastPath);
|
|
15164
|
+
nodeBinPaths.push(dirname(process.execPath));
|
|
15165
|
+
const newPath = nodeBinPaths.concat(parts).join(delimiter);
|
|
15166
|
+
return {
|
|
15167
|
+
key: path.key,
|
|
15168
|
+
value: newPath
|
|
15169
|
+
};
|
|
15170
|
+
}
|
|
15171
|
+
function computeEnv(cwd, env, nodePath = true) {
|
|
15172
|
+
const envWithDefault = {
|
|
15173
|
+
...process.env,
|
|
15174
|
+
...env
|
|
15175
|
+
};
|
|
15176
|
+
if (!nodePath) return envWithDefault;
|
|
15177
|
+
const envPathInfo = addNodeBinToPath(cwd, getPathFromEnv(envWithDefault));
|
|
15178
|
+
envWithDefault[envPathInfo.key] = envPathInfo.value;
|
|
15179
|
+
return envWithDefault;
|
|
15180
|
+
}
|
|
15181
|
+
const combineStreams = (streams) => {
|
|
15182
|
+
let streamCount = streams.length;
|
|
15183
|
+
const combined = new PassThrough();
|
|
15184
|
+
const maybeEmitEnd = () => {
|
|
15185
|
+
if (--streamCount === 0) combined.end();
|
|
15186
|
+
};
|
|
15187
|
+
for (const stream of streams) pipeline(stream, combined, { end: false }).then(maybeEmitEnd).catch(maybeEmitEnd);
|
|
15188
|
+
return combined;
|
|
15189
|
+
};
|
|
15190
|
+
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
15191
|
+
const shebangRegExp = /^#!\s*(.+)/;
|
|
15192
|
+
const isWindowsExecutableRegExp = /\.(?:com|exe)$/i;
|
|
15193
|
+
const isNodeModulesCmdRegExp = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i;
|
|
15194
|
+
const isWindows = process.platform === "win32";
|
|
15195
|
+
const defaultPathExt = [
|
|
15196
|
+
".EXE",
|
|
15197
|
+
".CMD",
|
|
15198
|
+
".BAT",
|
|
15199
|
+
".COM"
|
|
15200
|
+
];
|
|
15201
|
+
const noPathExt = [""];
|
|
15202
|
+
/**
|
|
15203
|
+
* Normalizes the command and arguments to work cross-platform.
|
|
15204
|
+
* On Windows, this basically handles things like shebangs, calling
|
|
15205
|
+
* `node_modules/.bin` commands, and escaping meta characters.
|
|
15206
|
+
* On other platforms, it just returns the command and arguments as-is.
|
|
15207
|
+
*/
|
|
15208
|
+
function normalizeSpawnCommand(command, args = [], options = {}) {
|
|
15209
|
+
if (options.shell === true || !isWindows) return {
|
|
15210
|
+
command,
|
|
15211
|
+
args,
|
|
15212
|
+
options
|
|
15213
|
+
};
|
|
15214
|
+
let file = resolveCommand(command, options);
|
|
15215
|
+
let shebang = null;
|
|
15216
|
+
if (file !== null) {
|
|
15217
|
+
const size = 150;
|
|
15218
|
+
const buffer = Buffer.alloc(size);
|
|
15219
|
+
let fd = null;
|
|
15220
|
+
try {
|
|
15221
|
+
fd = openSync(file, "r");
|
|
15222
|
+
readSync(fd, buffer, 0, size, 0);
|
|
15223
|
+
} catch {} finally {
|
|
15224
|
+
if (fd !== null) closeSync(fd);
|
|
15225
|
+
}
|
|
15226
|
+
const match = buffer.toString().match(shebangRegExp);
|
|
15227
|
+
if (match !== null) {
|
|
15228
|
+
const line = match[1].trim();
|
|
15229
|
+
const separatorIndex = line.indexOf(" ");
|
|
15230
|
+
const path = separatorIndex !== -1 ? line.slice(0, separatorIndex) : line;
|
|
15231
|
+
const argument = separatorIndex !== -1 ? line.slice(separatorIndex + 1) : "";
|
|
15232
|
+
const binary = basename(path);
|
|
15233
|
+
shebang = binary === "env" ? argument || null : binary;
|
|
15234
|
+
}
|
|
15235
|
+
}
|
|
15236
|
+
if (shebang !== null && file !== null) {
|
|
15237
|
+
args = [file, ...args];
|
|
15238
|
+
command = shebang;
|
|
15239
|
+
file = resolveCommand(command, options);
|
|
15240
|
+
}
|
|
15241
|
+
if (file === null || !isWindowsExecutableRegExp.test(file)) {
|
|
15242
|
+
const needsDoubleEscapeMetaChars = file !== null && isNodeModulesCmdRegExp.test(file);
|
|
15243
|
+
command = normalize(command);
|
|
15244
|
+
command = command.replace(metaCharsRegExp, "^$1");
|
|
15245
|
+
args = args.map((arg) => {
|
|
15246
|
+
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
15247
|
+
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
15248
|
+
arg = `"${arg}"`;
|
|
15249
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
15250
|
+
if (needsDoubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
|
|
15251
|
+
return arg;
|
|
15252
|
+
});
|
|
15253
|
+
args = [
|
|
15254
|
+
"/d",
|
|
15255
|
+
"/s",
|
|
15256
|
+
"/c",
|
|
15257
|
+
`"${[command, ...args].join(" ")}"`
|
|
15258
|
+
];
|
|
15259
|
+
command = options.env?.comspec ?? "cmd.exe";
|
|
15260
|
+
options = {
|
|
15261
|
+
...options,
|
|
15262
|
+
windowsVerbatimArguments: true
|
|
15263
|
+
};
|
|
15264
|
+
}
|
|
15265
|
+
return {
|
|
15266
|
+
command,
|
|
15267
|
+
args,
|
|
15268
|
+
options
|
|
15269
|
+
};
|
|
15270
|
+
}
|
|
15271
|
+
/**
|
|
15272
|
+
* Resolves the command to an absolute path if possible.
|
|
15273
|
+
* Handles things like traversing PATH and adding extensions from PATHEXT
|
|
15274
|
+
*/
|
|
15275
|
+
function resolveCommand(command, options) {
|
|
15276
|
+
const cwd$3 = (options.cwd ?? cwd()).toString();
|
|
15277
|
+
const env = options.env ?? process.env;
|
|
15278
|
+
const PATH = getPathFromEnv(env).value;
|
|
15279
|
+
const pathEnv = command.includes("/") || command.includes("\\") ? [""] : [cwd$3, ...PATH.split(delimiter)];
|
|
15280
|
+
let pathExt = env.PATHEXT ? env.PATHEXT.split(delimiter) : defaultPathExt;
|
|
15281
|
+
if (command.includes(".") && pathExt[0] !== "") pathExt = ["", ...pathExt];
|
|
15282
|
+
for (const extensions of [pathExt, noPathExt]) for (const path of pathEnv) {
|
|
15283
|
+
const unquoted = path.startsWith("\"") && path.endsWith("\"") && path.length > 1 ? path.slice(1, -1) : path;
|
|
15284
|
+
const dest = resolve(cwd$3, unquoted, command);
|
|
15285
|
+
for (const ext of extensions) {
|
|
15286
|
+
const destWithExt = dest + ext;
|
|
15287
|
+
try {
|
|
15288
|
+
if (statSync(destWithExt).isFile()) return destWithExt;
|
|
15289
|
+
} catch {}
|
|
15290
|
+
}
|
|
15291
|
+
}
|
|
15292
|
+
return null;
|
|
15293
|
+
}
|
|
15294
|
+
var NonZeroExitError = class extends Error {
|
|
15295
|
+
result;
|
|
15296
|
+
output;
|
|
15297
|
+
exitCode;
|
|
15298
|
+
get signalCode() {
|
|
15299
|
+
return this.result.signalCode;
|
|
15300
|
+
}
|
|
15301
|
+
constructor(result, output, command, args) {
|
|
15302
|
+
let target = "The process";
|
|
15303
|
+
if (command) target = `The command \`${args?.length ? `${command} ${args.map((a) => /[ "'`()]/.test(a) ? JSON.stringify(a) : a).join(" ")}` : command}\``;
|
|
15304
|
+
const exitCode = result.exitCode ?? 1;
|
|
15305
|
+
super(result.signalCode !== null ? `${target} was killed by the signal ${result.signalCode}` : `${target} exited with a non-zero status (${exitCode})`);
|
|
15306
|
+
this.result = result;
|
|
15307
|
+
this.output = output;
|
|
15308
|
+
this.exitCode = exitCode;
|
|
15309
|
+
Object.defineProperty(this, "result", {
|
|
15310
|
+
enumerable: false,
|
|
15311
|
+
writable: false,
|
|
15312
|
+
configurable: false
|
|
15313
|
+
});
|
|
15314
|
+
}
|
|
15315
|
+
};
|
|
15316
|
+
const defaultOptions = {
|
|
15317
|
+
timeout: void 0,
|
|
15318
|
+
persist: false
|
|
15319
|
+
};
|
|
15320
|
+
const defaultNodeOptions = { windowsHide: true };
|
|
15321
|
+
function combineSignals(signals) {
|
|
15322
|
+
const controller = new AbortController();
|
|
15323
|
+
for (const signal of signals) {
|
|
15324
|
+
if (signal.aborted) {
|
|
15325
|
+
controller.abort();
|
|
15326
|
+
return signal;
|
|
15327
|
+
}
|
|
15328
|
+
const onAbort = () => {
|
|
15329
|
+
controller.abort(signal.reason);
|
|
15330
|
+
};
|
|
15331
|
+
signal.addEventListener("abort", onAbort, { signal: controller.signal });
|
|
15332
|
+
}
|
|
15333
|
+
return controller.signal;
|
|
15334
|
+
}
|
|
15335
|
+
async function readStream(stream) {
|
|
15336
|
+
let output = "";
|
|
15337
|
+
try {
|
|
15338
|
+
for await (const chunk of stream) output += chunk.toString();
|
|
15339
|
+
} catch {}
|
|
15340
|
+
return output;
|
|
15341
|
+
}
|
|
15342
|
+
var ExecProcess = class {
|
|
15343
|
+
_process;
|
|
15344
|
+
_aborted = false;
|
|
15345
|
+
_options;
|
|
15346
|
+
_command;
|
|
15347
|
+
_args;
|
|
15348
|
+
_resolveClose;
|
|
15349
|
+
_processClosed;
|
|
15350
|
+
_thrownError;
|
|
15351
|
+
get process() {
|
|
15352
|
+
return this._process;
|
|
15353
|
+
}
|
|
15354
|
+
get pid() {
|
|
15355
|
+
return this._process?.pid;
|
|
15356
|
+
}
|
|
15357
|
+
get exitCode() {
|
|
15358
|
+
if (this._process && this._process.exitCode !== null) return this._process.exitCode;
|
|
15359
|
+
}
|
|
15360
|
+
get signalCode() {
|
|
15361
|
+
return this._process?.signalCode ?? null;
|
|
15362
|
+
}
|
|
15363
|
+
constructor(command, args, options) {
|
|
15364
|
+
this._options = {
|
|
15365
|
+
...defaultOptions,
|
|
15366
|
+
...options
|
|
15367
|
+
};
|
|
15368
|
+
this._command = command;
|
|
15369
|
+
this._args = args ?? [];
|
|
15370
|
+
this._processClosed = new Promise((resolve) => {
|
|
15371
|
+
this._resolveClose = resolve;
|
|
15372
|
+
});
|
|
15373
|
+
}
|
|
15374
|
+
kill(signal) {
|
|
15375
|
+
return this._process?.kill(signal) === true;
|
|
15376
|
+
}
|
|
15377
|
+
get aborted() {
|
|
15378
|
+
return this._aborted;
|
|
15379
|
+
}
|
|
15380
|
+
get killed() {
|
|
15381
|
+
return this._process?.killed === true;
|
|
15382
|
+
}
|
|
15383
|
+
pipe(command, args, options) {
|
|
15384
|
+
return exec$1(command, args, {
|
|
15385
|
+
...options,
|
|
15386
|
+
stdin: this
|
|
15387
|
+
});
|
|
15388
|
+
}
|
|
15389
|
+
async *[Symbol.asyncIterator]() {
|
|
15390
|
+
const proc = this._process;
|
|
15391
|
+
if (!proc) return;
|
|
15392
|
+
const streams = [];
|
|
15393
|
+
if (this._streamErr) streams.push(this._streamErr);
|
|
15394
|
+
if (this._streamOut) streams.push(this._streamOut);
|
|
15395
|
+
const streamCombined = combineStreams(streams);
|
|
15396
|
+
const rl = readline.createInterface({ input: streamCombined });
|
|
15397
|
+
for await (const chunk of rl) yield chunk.toString();
|
|
15398
|
+
await this._processClosed;
|
|
15399
|
+
proc.removeAllListeners();
|
|
15400
|
+
if (this._thrownError) throw this._thrownError;
|
|
15401
|
+
if (this._options?.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, void 0, this._command, this._args);
|
|
15402
|
+
}
|
|
15403
|
+
async _waitForOutput() {
|
|
15404
|
+
const proc = this._process;
|
|
15405
|
+
if (!proc) throw new Error("No process was started");
|
|
15406
|
+
const [stdout, stderr] = await Promise.all([this._streamOut ? readStream(this._streamOut) : "", this._streamErr ? readStream(this._streamErr) : ""]);
|
|
15407
|
+
await this._processClosed;
|
|
15408
|
+
const { stdin } = this._options;
|
|
15409
|
+
if (stdin && typeof stdin !== "string") await stdin;
|
|
15410
|
+
proc.removeAllListeners();
|
|
15411
|
+
if (this._thrownError) throw this._thrownError;
|
|
15412
|
+
const result = {
|
|
15413
|
+
stderr,
|
|
15414
|
+
stdout,
|
|
15415
|
+
exitCode: this.exitCode
|
|
15416
|
+
};
|
|
15417
|
+
if (this._options.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, result, this._command, this._args);
|
|
15418
|
+
return result;
|
|
15419
|
+
}
|
|
15420
|
+
then(onfulfilled, onrejected) {
|
|
15421
|
+
return this._waitForOutput().then(onfulfilled, onrejected);
|
|
15422
|
+
}
|
|
15423
|
+
_streamOut;
|
|
15424
|
+
_streamErr;
|
|
15425
|
+
spawn() {
|
|
15426
|
+
const options = this._options;
|
|
15427
|
+
const nodeOptions = {
|
|
15428
|
+
...defaultNodeOptions,
|
|
15429
|
+
...options.nodeOptions
|
|
15430
|
+
};
|
|
15431
|
+
const cwd$1 = nodeOptions?.cwd ?? cwd();
|
|
15432
|
+
const signals = [];
|
|
15433
|
+
this._resetState();
|
|
15434
|
+
if (options.timeout !== void 0) signals.push(AbortSignal.timeout(options.timeout));
|
|
15435
|
+
if (options.signal !== void 0) signals.push(options.signal);
|
|
15436
|
+
if (options.persist === true) nodeOptions.detached = true;
|
|
15437
|
+
if (signals.length > 0) nodeOptions.signal = combineSignals(signals);
|
|
15438
|
+
nodeOptions.env = computeEnv(cwd$1, nodeOptions.env, options.nodePath);
|
|
15439
|
+
const crossResult = normalizeSpawnCommand(this._command, this._args, nodeOptions);
|
|
15440
|
+
const handle = spawn(crossResult.command, crossResult.args, crossResult.options);
|
|
15441
|
+
if (handle.stderr) this._streamErr = handle.stderr;
|
|
15442
|
+
if (handle.stdout) this._streamOut = handle.stdout;
|
|
15443
|
+
this._process = handle;
|
|
15444
|
+
handle.once("error", this._onError);
|
|
15445
|
+
handle.once("close", this._onClose);
|
|
15446
|
+
if (handle.stdin) {
|
|
15447
|
+
const { stdin } = options;
|
|
15448
|
+
if (typeof stdin === "string") handle.stdin.end(stdin);
|
|
15449
|
+
else stdin?.process?.stdout?.pipe(handle.stdin);
|
|
15450
|
+
}
|
|
15451
|
+
}
|
|
15452
|
+
_resetState() {
|
|
15453
|
+
this._aborted = false;
|
|
15454
|
+
this._processClosed = new Promise((resolve) => {
|
|
15455
|
+
this._resolveClose = resolve;
|
|
15456
|
+
});
|
|
15457
|
+
this._thrownError = void 0;
|
|
15458
|
+
}
|
|
15459
|
+
_onError = (err) => {
|
|
15460
|
+
if (err.name === "AbortError" && (!(err.cause instanceof Error) || err.cause.name !== "TimeoutError")) {
|
|
15461
|
+
this._aborted = true;
|
|
15462
|
+
return;
|
|
15463
|
+
}
|
|
15464
|
+
this._thrownError = err;
|
|
15465
|
+
};
|
|
15466
|
+
_onClose = () => {
|
|
15467
|
+
if (this._resolveClose) this._resolveClose();
|
|
15468
|
+
};
|
|
15469
|
+
};
|
|
15470
|
+
const x = (command, args, userOptions) => {
|
|
15471
|
+
const proc = new ExecProcess(command, args, userOptions);
|
|
15472
|
+
proc.spawn();
|
|
15473
|
+
return proc;
|
|
15474
|
+
};
|
|
15475
|
+
const exec$1 = x;
|
|
15476
|
+
//#endregion
|
|
15165
15477
|
//#region src/node/server/openBrowser.ts
|
|
15166
15478
|
/**
|
|
15167
15479
|
* The following is modified based on source found in
|
|
@@ -15172,7 +15484,6 @@ defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
|
|
|
15172
15484
|
* https://github.com/react/create-react-app/blob/main/LICENSE
|
|
15173
15485
|
*
|
|
15174
15486
|
*/
|
|
15175
|
-
var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
|
|
15176
15487
|
/**
|
|
15177
15488
|
* Reads the BROWSER environment variable and decides what to do with it.
|
|
15178
15489
|
*/
|
|
@@ -15183,12 +15494,12 @@ function openBrowser(url, opt, logger) {
|
|
|
15183
15494
|
}
|
|
15184
15495
|
function executeNodeScript(scriptPath, url, logger) {
|
|
15185
15496
|
const extraArgs = process.argv.slice(2);
|
|
15186
|
-
(
|
|
15497
|
+
x(process.execPath, [
|
|
15187
15498
|
scriptPath,
|
|
15188
15499
|
...extraArgs,
|
|
15189
15500
|
url
|
|
15190
|
-
], { stdio: "inherit" }).
|
|
15191
|
-
if (
|
|
15501
|
+
], { nodeOptions: { stdio: "inherit" } }).then(({ exitCode }) => {
|
|
15502
|
+
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 });
|
|
15192
15503
|
});
|
|
15193
15504
|
}
|
|
15194
15505
|
const supportedChromiumBrowsers = [
|
|
@@ -15427,8 +15738,9 @@ function ssrRewriteStacktrace(stack, moduleGraph) {
|
|
|
15427
15738
|
let alreadyRewritten = false;
|
|
15428
15739
|
return {
|
|
15429
15740
|
result: stack.split("\n").map((line) => {
|
|
15430
|
-
return line.replace(/^ {4}at (?:(\S.*?)\s\()?(.+?):(\d+)(?::(\d+))?\)?/, (input, varName,
|
|
15431
|
-
if (!
|
|
15741
|
+
return line.replace(/^ {4}at (?:(\S.*?)\s\()?(.+?):(\d+)(?::(\d+))?\)?/, (input, varName, rawId, originalLine, originalColumn) => {
|
|
15742
|
+
if (!rawId) return input;
|
|
15743
|
+
const id = decodeSourceURL(rawId);
|
|
15432
15744
|
const rawSourceMap = moduleGraph.getModuleById(id)?.transformResult?.map;
|
|
15433
15745
|
if (!rawSourceMap) return input;
|
|
15434
15746
|
const traced = new TraceMap(rawSourceMap);
|
|
@@ -16200,10 +16512,13 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
16200
16512
|
let map;
|
|
16201
16513
|
if (inMap?.mappings === "") map = inMap;
|
|
16202
16514
|
else {
|
|
16203
|
-
|
|
16204
|
-
|
|
16205
|
-
|
|
16206
|
-
|
|
16515
|
+
const shouldCombine = !!(inMap && inMap.mappings && "sources" in inMap && inMap.sources.length > 0);
|
|
16516
|
+
const mapOptions = { hires: "boundary" };
|
|
16517
|
+
const nextMap = shouldCombine ? s.generateDecodedMap(mapOptions) : s.generateMap(mapOptions);
|
|
16518
|
+
nextMap.sources = [path.basename(url)];
|
|
16519
|
+
nextMap.sourcesContent = [originalCode];
|
|
16520
|
+
if (shouldCombine) map = combineSourcemaps(url, [nextMap, inMap]);
|
|
16521
|
+
else map = nextMap;
|
|
16207
16522
|
}
|
|
16208
16523
|
return {
|
|
16209
16524
|
code: s.toString(),
|
|
@@ -16414,6 +16729,26 @@ var NoopWatcher = class extends EventEmitter {
|
|
|
16414
16729
|
function createNoopWatcher(options) {
|
|
16415
16730
|
return new NoopWatcher(options);
|
|
16416
16731
|
}
|
|
16732
|
+
/**
|
|
16733
|
+
* Chokidar's `add()` reopens a closed watcher. It may be called after shutdown
|
|
16734
|
+
* starts from an in-flight plugin hook or directly through the exposed watcher.
|
|
16735
|
+
* This wrapper makes `close()` final so those calls cannot create new file
|
|
16736
|
+
* system handles.
|
|
16737
|
+
*/
|
|
16738
|
+
function makeWatcherCloseFinal(watcher) {
|
|
16739
|
+
let closed = false;
|
|
16740
|
+
const add = watcher.add;
|
|
16741
|
+
watcher.add = function(...args) {
|
|
16742
|
+
if (closed) return this;
|
|
16743
|
+
return add.apply(this, args);
|
|
16744
|
+
};
|
|
16745
|
+
const close = watcher.close;
|
|
16746
|
+
watcher.close = function(...args) {
|
|
16747
|
+
closed = true;
|
|
16748
|
+
return close.apply(this, args);
|
|
16749
|
+
};
|
|
16750
|
+
return watcher;
|
|
16751
|
+
}
|
|
16417
16752
|
//#endregion
|
|
16418
16753
|
//#region src/node/server/middlewares/base.ts
|
|
16419
16754
|
function baseMiddleware(rawBase, middlewareMode) {
|
|
@@ -16803,9 +17138,26 @@ async function createClientConfigValueReplacer(config) {
|
|
|
16803
17138
|
const serverForwardConsoleReplacement = escapeReplacement(config.server.forwardConsole);
|
|
16804
17139
|
return (code) => code.replace(`__MODE__`, modeReplacement).replace(/__BASE__/g, baseReplacement).replace(`__SERVER_HOST__`, serverHostReplacement).replace(`__HMR_PROTOCOL__`, hmrProtocolReplacement).replace(`__HMR_HOSTNAME__`, hmrHostnameReplacement).replace(`__HMR_PORT__`, hmrPortReplacement).replace(`__HMR_DIRECT_TARGET__`, hmrDirectTargetReplacement).replace(`__HMR_BASE__`, hmrBaseReplacement).replace(`__HMR_TIMEOUT__`, hmrTimeoutReplacement).replace(`__HMR_ENABLE_OVERLAY__`, hmrEnableOverlayReplacement).replace(`__HMR_CONFIG_NAME__`, hmrConfigNameReplacement).replace(`__WS_TOKEN__`, wsTokenReplacement).replace(`__SERVER_FORWARD_CONSOLE__`, serverForwardConsoleReplacement);
|
|
16805
17140
|
}
|
|
17141
|
+
const ROLLDOWN_DEV_RUNTIME_ENTRY = "rolldown/experimental/runtime";
|
|
16806
17142
|
async function getHmrImplementation(config) {
|
|
16807
17143
|
const content = fs.readFileSync(normalizedBundledDevClientEntry, "utf-8");
|
|
16808
|
-
return (await createClientConfigValueReplacer(config))(content).replace(/import\s*['"]@vite\/env['"]/, "");
|
|
17144
|
+
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}`);
|
|
17145
|
+
}
|
|
17146
|
+
function rolldownDevRuntimeEntryPath() {
|
|
17147
|
+
return fileURLToPath(import.meta.resolve(ROLLDOWN_DEV_RUNTIME_ENTRY));
|
|
17148
|
+
}
|
|
17149
|
+
/**
|
|
17150
|
+
* The dev runtime must match the rolldown that generates the bundle, so it is read from the
|
|
17151
|
+
* installed package at serve time instead of being bundled into the client. The entry imports
|
|
17152
|
+
* its helper file with a relative path, so both are served under the same directory.
|
|
17153
|
+
*/
|
|
17154
|
+
function getRolldownDevRuntimeFiles() {
|
|
17155
|
+
const entry = rolldownDevRuntimeEntryPath();
|
|
17156
|
+
const dir = path.dirname(entry);
|
|
17157
|
+
const files = /* @__PURE__ */ new Map();
|
|
17158
|
+
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"));
|
|
17159
|
+
if (!files.has(`@rolldown/${path.basename(entry)}`)) throw new Error(`rolldown dev runtime entry ${entry} was not found`);
|
|
17160
|
+
return files;
|
|
16809
17161
|
}
|
|
16810
17162
|
//#endregion
|
|
16811
17163
|
//#region ../../node_modules/.pnpm/convert-source-map@2.0.0/node_modules/convert-source-map/index.js
|
|
@@ -17065,6 +17417,7 @@ async function computeSourceRoute(map, file) {
|
|
|
17065
17417
|
return sourceRoot;
|
|
17066
17418
|
}
|
|
17067
17419
|
async function injectSourcesContent(map, file, logger) {
|
|
17420
|
+
if (map.sourceRoot && isExternalUrl(map.sourceRoot)) return;
|
|
17068
17421
|
let sourceRootPromise;
|
|
17069
17422
|
const packageRoot = getNodeModulesPackageRoot(file);
|
|
17070
17423
|
const missingSources = [];
|
|
@@ -17072,7 +17425,7 @@ async function injectSourcesContent(map, file, logger) {
|
|
|
17072
17425
|
const sourcesContentPromises = [];
|
|
17073
17426
|
for (let index = 0; index < map.sources.length; index++) {
|
|
17074
17427
|
const sourcePath = map.sources[index];
|
|
17075
|
-
if (sourcesContent[index] == null && sourcePath && !virtualSourceRE.test(sourcePath)) sourcesContentPromises.push((async () => {
|
|
17428
|
+
if (sourcesContent[index] == null && sourcePath && !isExternalUrl(sourcePath) && !virtualSourceRE.test(sourcePath)) sourcesContentPromises.push((async () => {
|
|
17076
17429
|
sourceRootPromise ??= computeSourceRoute(map, file);
|
|
17077
17430
|
const sourceRoot = await sourceRootPromise;
|
|
17078
17431
|
let resolvedSourcePath = cleanUrl(decodeURI(sourcePath));
|
|
@@ -17190,7 +17543,7 @@ function totalist(dir, callback, pre = "") {
|
|
|
17190
17543
|
let i = 0, abs, stats;
|
|
17191
17544
|
for (; i < arr.length; i++) {
|
|
17192
17545
|
abs = join$1(dir, arr[i]);
|
|
17193
|
-
stats = statSync(abs);
|
|
17546
|
+
stats = statSync$1(abs);
|
|
17194
17547
|
stats.isDirectory() ? totalist(abs, callback, join$1(pre, arr[i])) : callback(join$1(pre, arr[i]), abs, stats);
|
|
17195
17548
|
}
|
|
17196
17549
|
}
|
|
@@ -17477,7 +17830,7 @@ function serveRawFsMiddleware(server) {
|
|
|
17477
17830
|
const pathname = decodeURIIfPossible(url.pathname);
|
|
17478
17831
|
if (pathname === void 0) return next();
|
|
17479
17832
|
let newPathname = pathname.slice(FS_PREFIX.length);
|
|
17480
|
-
if (isWindows) newPathname = newPathname.replace(/^[A-Z]:/i, "");
|
|
17833
|
+
if (isWindows$1) newPathname = newPathname.replace(/^[A-Z]:/i, "");
|
|
17481
17834
|
url.pathname = encodeURI(newPathname);
|
|
17482
17835
|
req.url = url.href.slice(url.origin.length);
|
|
17483
17836
|
try {
|
|
@@ -17521,8 +17874,8 @@ function looksLikeWindowsShortNamePath(filePath) {
|
|
|
17521
17874
|
function isFileLoadingAllowed(config, filePath) {
|
|
17522
17875
|
const { fs } = config.server;
|
|
17523
17876
|
if (!fs.strict) return true;
|
|
17524
|
-
if (isWindows && looksLikeWindowsShortNamePath(filePath)) return false;
|
|
17525
|
-
if ((isWindows && windowsDriveRE.test(filePath) ? filePath.slice(2) : filePath).includes(":")) return false;
|
|
17877
|
+
if (isWindows$1 && looksLikeWindowsShortNamePath(filePath)) return false;
|
|
17878
|
+
if ((isWindows$1 && windowsDriveRE.test(filePath) ? filePath.slice(2) : filePath).includes(":")) return false;
|
|
17526
17879
|
const filePathWithoutTrailingSlash = filePath.endsWith("/") ? filePath.slice(0, -1) : filePath;
|
|
17527
17880
|
if (config.fsDenyGlob(filePathWithoutTrailingSlash)) return false;
|
|
17528
17881
|
if (config.safeModulePaths.has(filePath)) return true;
|
|
@@ -19491,6 +19844,7 @@ function rejectInvalidRequestMiddleware() {
|
|
|
19491
19844
|
//#endregion
|
|
19492
19845
|
//#region src/node/server/middlewares/time.ts
|
|
19493
19846
|
const logTime = createDebugger("vite:time");
|
|
19847
|
+
const isTimeDebugEnabled = logTime !== void 0;
|
|
19494
19848
|
function timeMiddleware(root) {
|
|
19495
19849
|
return function viteTimeMiddleware(req, res, next) {
|
|
19496
19850
|
const start = performance$1.now();
|
|
@@ -20418,7 +20772,7 @@ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
|
|
20418
20772
|
return searchForWorkspaceRoot(dir, root);
|
|
20419
20773
|
}
|
|
20420
20774
|
//#endregion
|
|
20421
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
20775
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/constants.js
|
|
20422
20776
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20423
20777
|
const BINARY_TYPES = [
|
|
20424
20778
|
"nodebuffer",
|
|
@@ -20441,7 +20795,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20441
20795
|
};
|
|
20442
20796
|
}));
|
|
20443
20797
|
//#endregion
|
|
20444
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
20798
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/buffer-util.js
|
|
20445
20799
|
var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20446
20800
|
const { EMPTY_BUFFER } = require_constants();
|
|
20447
20801
|
const FastBuffer = Buffer[Symbol.species];
|
|
@@ -20541,7 +20895,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20541
20895
|
} catch (e) {}
|
|
20542
20896
|
}));
|
|
20543
20897
|
//#endregion
|
|
20544
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
20898
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/limiter.js
|
|
20545
20899
|
var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20546
20900
|
const kDone = Symbol("kDone");
|
|
20547
20901
|
const kRun = Symbol("kRun");
|
|
@@ -20592,7 +20946,7 @@ var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20592
20946
|
module.exports = Limiter;
|
|
20593
20947
|
}));
|
|
20594
20948
|
//#endregion
|
|
20595
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
20949
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/permessage-deflate.js
|
|
20596
20950
|
var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20597
20951
|
const zlib$1 = __require("zlib");
|
|
20598
20952
|
const bufferUtil = require_buffer_util();
|
|
@@ -20928,7 +21282,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
20928
21282
|
}
|
|
20929
21283
|
}));
|
|
20930
21284
|
//#endregion
|
|
20931
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
21285
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/validation.js
|
|
20932
21286
|
var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20933
21287
|
const { isUtf8 } = __require("buffer");
|
|
20934
21288
|
const { hasBlob } = require_constants();
|
|
@@ -21124,7 +21478,7 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21124
21478
|
} catch (e) {}
|
|
21125
21479
|
}));
|
|
21126
21480
|
//#endregion
|
|
21127
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
21481
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/receiver.js
|
|
21128
21482
|
var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21129
21483
|
const { Writable } = __require("stream");
|
|
21130
21484
|
const PerMessageDeflate = require_permessage_deflate();
|
|
@@ -21587,7 +21941,7 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21587
21941
|
module.exports = Receiver;
|
|
21588
21942
|
}));
|
|
21589
21943
|
//#endregion
|
|
21590
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
21944
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/sender.js
|
|
21591
21945
|
var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21592
21946
|
const { Duplex: Duplex$3 } = __require("stream");
|
|
21593
21947
|
const { randomFillSync } = __require("crypto");
|
|
@@ -22085,7 +22439,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
22085
22439
|
}
|
|
22086
22440
|
}));
|
|
22087
22441
|
//#endregion
|
|
22088
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
22442
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/event-target.js
|
|
22089
22443
|
var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
22090
22444
|
const { kForOnEventAttribute, kListener } = require_constants();
|
|
22091
22445
|
const kCode = Symbol("kCode");
|
|
@@ -22316,7 +22670,7 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
22316
22670
|
}
|
|
22317
22671
|
}));
|
|
22318
22672
|
//#endregion
|
|
22319
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
22673
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/extension.js
|
|
22320
22674
|
var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
22321
22675
|
const { tokenChars } = require_validation();
|
|
22322
22676
|
/**
|
|
@@ -22462,7 +22816,7 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
22462
22816
|
};
|
|
22463
22817
|
}));
|
|
22464
22818
|
//#endregion
|
|
22465
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
22819
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/websocket.js
|
|
22466
22820
|
var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
22467
22821
|
const EventEmitter$2 = __require("events");
|
|
22468
22822
|
const https = __require("https");
|
|
@@ -22522,11 +22876,16 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
22522
22876
|
this._bufferedAmount = 0;
|
|
22523
22877
|
this._isServer = false;
|
|
22524
22878
|
this._redirects = 0;
|
|
22525
|
-
if (protocols === void 0)
|
|
22526
|
-
|
|
22879
|
+
if (protocols === void 0) {
|
|
22880
|
+
if (!options || options.protocols === void 0) protocols = [];
|
|
22881
|
+
else if (Array.isArray(options.protocols)) protocols = options.protocols;
|
|
22882
|
+
else protocols = [options.protocols];
|
|
22883
|
+
} else if (!Array.isArray(protocols)) {
|
|
22527
22884
|
if (typeof protocols === "object" && protocols !== null) {
|
|
22528
22885
|
options = protocols;
|
|
22529
|
-
protocols = [];
|
|
22886
|
+
if (options.protocols === void 0) protocols = [];
|
|
22887
|
+
else if (Array.isArray(options.protocols)) protocols = options.protocols;
|
|
22888
|
+
else protocols = [options.protocols];
|
|
22530
22889
|
} else protocols = [protocols];
|
|
22531
22890
|
}
|
|
22532
22891
|
initAsClient(this, address, protocols, options);
|
|
@@ -22716,12 +23075,12 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
22716
23075
|
if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) this._socket.end();
|
|
22717
23076
|
return;
|
|
22718
23077
|
}
|
|
22719
|
-
this._readyState = WebSocket.CLOSING;
|
|
22720
23078
|
this._sender.close(code, data, !this._isServer, (err) => {
|
|
22721
23079
|
if (err) return;
|
|
22722
23080
|
this._closeFrameSent = true;
|
|
22723
23081
|
if (this._closeFrameReceived || this._receiver._writableState.errorEmitted) this._socket.end();
|
|
22724
23082
|
});
|
|
23083
|
+
this._readyState = WebSocket.CLOSING;
|
|
22725
23084
|
setCloseTimer(this);
|
|
22726
23085
|
}
|
|
22727
23086
|
/**
|
|
@@ -23004,6 +23363,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
23004
23363
|
socketPath: void 0,
|
|
23005
23364
|
hostname: void 0,
|
|
23006
23365
|
protocol: void 0,
|
|
23366
|
+
protocols: void 0,
|
|
23007
23367
|
timeout: void 0,
|
|
23008
23368
|
method: "GET",
|
|
23009
23369
|
host: void 0,
|
|
@@ -23455,7 +23815,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
23455
23815
|
}
|
|
23456
23816
|
}));
|
|
23457
23817
|
//#endregion
|
|
23458
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
23818
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/stream.js
|
|
23459
23819
|
var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
23460
23820
|
require_websocket();
|
|
23461
23821
|
const { Duplex: Duplex$1 } = __require("stream");
|
|
@@ -23571,7 +23931,7 @@ var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
23571
23931
|
module.exports = createWebSocketStream;
|
|
23572
23932
|
}));
|
|
23573
23933
|
//#endregion
|
|
23574
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
23934
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/subprotocol.js
|
|
23575
23935
|
var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
23576
23936
|
const { tokenChars } = require_validation();
|
|
23577
23937
|
/**
|
|
@@ -23610,7 +23970,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
23610
23970
|
module.exports = { parse };
|
|
23611
23971
|
}));
|
|
23612
23972
|
//#endregion
|
|
23613
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
23973
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/websocket-server.js
|
|
23614
23974
|
var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
23615
23975
|
const EventEmitter$1 = __require("events");
|
|
23616
23976
|
const http = __require("http");
|
|
@@ -24285,12 +24645,15 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
24285
24645
|
const publicFiles = await initPublicFilesPromise;
|
|
24286
24646
|
const { publicDir } = config;
|
|
24287
24647
|
if (httpServer) setClientErrorHandler(httpServer, config.logger);
|
|
24288
|
-
const watcher = serverConfig.watch !== null ? import_chokidar.watch([
|
|
24648
|
+
const watcher = serverConfig.watch !== null ? makeWatcherCloseFinal(import_chokidar.watch([
|
|
24289
24649
|
...config.experimental.bundledDev ? [] : [root],
|
|
24290
24650
|
...config.configFileDependencies,
|
|
24291
24651
|
...getEnvFilesForMode(config.mode, config.envDir),
|
|
24292
24652
|
...publicDir && publicFiles ? [publicDir] : []
|
|
24293
|
-
], resolvedWatchOptions) : createNoopWatcher(resolvedWatchOptions);
|
|
24653
|
+
], resolvedWatchOptions)) : createNoopWatcher(resolvedWatchOptions);
|
|
24654
|
+
watcher.on("error", (error) => {
|
|
24655
|
+
config.logger.error(import_picocolors.default.red(`file watcher error: ${error.message}`));
|
|
24656
|
+
});
|
|
24294
24657
|
const environments = {};
|
|
24295
24658
|
await Promise.all(Object.entries(config.environments).map(async ([name, environmentOptions]) => {
|
|
24296
24659
|
const environment = await environmentOptions.dev.createEnvironment(name, config, { ws });
|
|
@@ -24300,6 +24663,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
24300
24663
|
previousInstance: options.previousEnvironments?.[environment.name]
|
|
24301
24664
|
});
|
|
24302
24665
|
}));
|
|
24666
|
+
options.previousEnvironments = void 0;
|
|
24303
24667
|
let moduleGraph = new ModuleGraph({
|
|
24304
24668
|
client: () => environments.client.moduleGraph,
|
|
24305
24669
|
ssr: () => environments.ssr.moduleGraph
|
|
@@ -24505,7 +24869,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
24505
24869
|
if (!middlewareMode && httpServer) httpServer.once("listening", () => {
|
|
24506
24870
|
serverConfig.port = httpServer.address().port;
|
|
24507
24871
|
});
|
|
24508
|
-
if (
|
|
24872
|
+
if (isTimeDebugEnabled) middlewares.use(timeMiddleware(root));
|
|
24509
24873
|
middlewares.use(rejectInvalidRequestMiddleware());
|
|
24510
24874
|
const { cors } = serverConfig;
|
|
24511
24875
|
if (cors !== false) middlewares.use((0, import_lib.default)(typeof cors === "boolean" ? {} : cors));
|
|
@@ -25316,6 +25680,7 @@ function optimizedDepsPlugin() {
|
|
|
25316
25680
|
if (info) {
|
|
25317
25681
|
if (browserHash && info.browserHash !== browserHash && !environment.config.optimizeDeps.ignoreOutdatedRequests) throwOutdatedRequest(id);
|
|
25318
25682
|
try {
|
|
25683
|
+
if (info.processing && depsOptimizer.initState === "idle") debug$7?.(`transforming ${import_picocolors.default.cyan(file)} is waiting for the dependency optimizer to initialize`);
|
|
25319
25684
|
await info.processing;
|
|
25320
25685
|
} catch {
|
|
25321
25686
|
throwProcessingError(id);
|
|
@@ -25375,7 +25740,7 @@ function preAliasPlugin(config) {
|
|
|
25375
25740
|
const ssr = environment.config.consumer === "server";
|
|
25376
25741
|
const depsOptimizer = environment.depsOptimizer;
|
|
25377
25742
|
if (importer && depsOptimizer && bareImportRE.test(id) && !options.scan && id !== "@vite/client" && id !== "@vite/env") {
|
|
25378
|
-
if (findPatterns.
|
|
25743
|
+
if (findPatterns.some((pattern) => matches(pattern, id))) {
|
|
25379
25744
|
const optimizedId = await tryOptimizedResolve(depsOptimizer, id, importer, config.resolve.preserveSymlinks, config.packageCache);
|
|
25380
25745
|
if (optimizedId) return optimizedId;
|
|
25381
25746
|
if (depsOptimizer.options.noDiscovery) return;
|
|
@@ -26349,6 +26714,9 @@ const preloadMethod = `__vitePreload`;
|
|
|
26349
26714
|
const preloadMarker = `__VITE_PRELOAD__`;
|
|
26350
26715
|
const preloadHelperId = "\0vite/preload-helper.js";
|
|
26351
26716
|
const preloadMarkerRE = new RegExp(preloadMarker, "g");
|
|
26717
|
+
function isCssPreloadUrl(url) {
|
|
26718
|
+
return url.pathname.endsWith(".css");
|
|
26719
|
+
}
|
|
26352
26720
|
function toRelativePath(filename, importer) {
|
|
26353
26721
|
const relPath = path.posix.relative(path.posix.dirname(importer), filename);
|
|
26354
26722
|
return relPath[0] === "." ? relPath : `./${relPath}`;
|
|
@@ -26394,7 +26762,7 @@ function detectScriptRel() {
|
|
|
26394
26762
|
function preload(baseModule, deps, importerUrl) {
|
|
26395
26763
|
let promise = Promise.resolve();
|
|
26396
26764
|
if (__VITE_IS_MODERN__ && deps && deps.length > 0) {
|
|
26397
|
-
|
|
26765
|
+
let preloadedHrefs;
|
|
26398
26766
|
const cspNonceMeta = document.querySelector("meta[property=csp-nonce]");
|
|
26399
26767
|
const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce");
|
|
26400
26768
|
function allSettled(promises) {
|
|
@@ -26407,28 +26775,37 @@ function preload(baseModule, deps, importerUrl) {
|
|
|
26407
26775
|
}))));
|
|
26408
26776
|
}
|
|
26409
26777
|
function importMetaResolve(specifier) {
|
|
26410
|
-
if (import.meta.resolve) return import.meta.resolve(specifier);
|
|
26778
|
+
if (import.meta.resolve) return new URL(import.meta.resolve(specifier));
|
|
26411
26779
|
return new URL(
|
|
26412
26780
|
specifier,
|
|
26413
26781
|
/** #__KEEP__ */
|
|
26414
26782
|
import.meta.url
|
|
26415
|
-
)
|
|
26416
|
-
}
|
|
26417
|
-
promise = allSettled(deps.map((
|
|
26418
|
-
|
|
26419
|
-
dep = importMetaResolve(
|
|
26420
|
-
if (dep in seen) return;
|
|
26421
|
-
seen[dep] = true;
|
|
26422
|
-
const isCss = dep
|
|
26423
|
-
|
|
26424
|
-
|
|
26425
|
-
|
|
26783
|
+
);
|
|
26784
|
+
}
|
|
26785
|
+
promise = allSettled(deps.map((depString) => {
|
|
26786
|
+
depString = assetsURL(depString, importerUrl);
|
|
26787
|
+
const dep = importMetaResolve(depString);
|
|
26788
|
+
if (dep.href in seen) return;
|
|
26789
|
+
seen[dep.href] = true;
|
|
26790
|
+
const isCss = isCssPreloadUrl(dep);
|
|
26791
|
+
if (preloadedHrefs === void 0) {
|
|
26792
|
+
preloadedHrefs = {
|
|
26793
|
+
all: /* @__PURE__ */ new Set(),
|
|
26794
|
+
styles: /* @__PURE__ */ new Set()
|
|
26795
|
+
};
|
|
26796
|
+
const links = document.getElementsByTagName("link");
|
|
26797
|
+
for (let i = links.length - 1; i >= 0; i--) {
|
|
26798
|
+
const link = links[i];
|
|
26799
|
+
preloadedHrefs.all.add(link.href);
|
|
26800
|
+
if (link.rel === "stylesheet") preloadedHrefs.styles.add(link.href);
|
|
26801
|
+
}
|
|
26426
26802
|
}
|
|
26803
|
+
if ((isCss ? preloadedHrefs.styles : preloadedHrefs.all).has(dep.href)) return;
|
|
26427
26804
|
const link = document.createElement("link");
|
|
26428
26805
|
link.rel = isCss ? "stylesheet" : scriptRel;
|
|
26429
26806
|
if (!isCss) link.as = "script";
|
|
26430
26807
|
link.crossOrigin = "";
|
|
26431
|
-
link.href = dep;
|
|
26808
|
+
link.href = dep.href;
|
|
26432
26809
|
if (cspNonce) link.setAttribute("nonce", cspNonce);
|
|
26433
26810
|
document.head.appendChild(link);
|
|
26434
26811
|
if (isCss) return new Promise((res, rej) => {
|
|
@@ -26456,7 +26833,7 @@ function getPreloadCode(environment, renderBuiltUrlBoolean, isRelativeBase) {
|
|
|
26456
26833
|
const scriptRel = modulePreload && modulePreload.polyfill ? `'modulepreload'` : `/* @__PURE__ */ (${detectScriptRel.toString()})()`;
|
|
26457
26834
|
const assetsURL = renderBuiltUrlBoolean || isRelativeBase ? `function(dep, importerUrl) { return new URL(dep, importerUrl).href }` : `function(dep) { return ${JSON.stringify(environment.config.base)}+dep }`;
|
|
26458
26835
|
const preloadMethodCode = preload.toString().replaceAll("𝐢𝐦𝐩𝐨𝐫𝐭", "import");
|
|
26459
|
-
return `const scriptRel = ${scriptRel};const assetsURL = ${assetsURL};const seen = {};export const ${preloadMethod} = ${preloadMethodCode}`;
|
|
26836
|
+
return `const scriptRel = ${scriptRel};const assetsURL = ${assetsURL};const seen = {};const isCssPreloadUrl = ${isCssPreloadUrl.toString()};export const ${preloadMethod} = ${preloadMethodCode}`;
|
|
26460
26837
|
}
|
|
26461
26838
|
/**
|
|
26462
26839
|
* Build only. During serve this is performed as part of ./importAnalysis.
|
|
@@ -26656,7 +27033,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
26656
27033
|
if (s.hasChanged()) {
|
|
26657
27034
|
chunk.code = s.toString();
|
|
26658
27035
|
if (buildSourcemap && chunk.map) {
|
|
26659
|
-
const nextMap = s.
|
|
27036
|
+
const nextMap = s.generateDecodedMap({
|
|
26660
27037
|
source: chunk.fileName,
|
|
26661
27038
|
hires: "boundary"
|
|
26662
27039
|
});
|
|
@@ -26869,6 +27246,7 @@ function rolldownDepPlugin(environment, qualified, external) {
|
|
|
26869
27246
|
return (kind.startsWith("require") ? _resolveRequire : _resolve)(environment, id, _importer);
|
|
26870
27247
|
};
|
|
26871
27248
|
const resolveResult = (id, resolved, kind) => {
|
|
27249
|
+
if (resolved === "__vite-browser-external") return { id: browserExternalId };
|
|
26872
27250
|
if (resolved.startsWith("__vite-browser-external")) return { id: browserExternalNamespace + id };
|
|
26873
27251
|
if (resolved.startsWith("__vite-optional-peer-dep")) return { id: optionalPeerDepNamespace + resolved };
|
|
26874
27252
|
if (allExternalTypesReg.test(resolved)) return resolveAssets(resolved, kind);
|
|
@@ -26898,7 +27276,7 @@ function rolldownDepPlugin(environment, qualified, external) {
|
|
|
26898
27276
|
const resolved = await resolve(id, importer, kind);
|
|
26899
27277
|
if (resolved) {
|
|
26900
27278
|
if (JS_TYPES_RE.test(resolved)) return {
|
|
26901
|
-
id: isWindows ? resolved.replaceAll("/", "\\") : resolved,
|
|
27279
|
+
id: isWindows$1 ? resolved.replaceAll("/", "\\") : resolved,
|
|
26902
27280
|
external: false
|
|
26903
27281
|
};
|
|
26904
27282
|
return resolveAssets(resolved, kind);
|
|
@@ -26938,8 +27316,13 @@ function rolldownDepPlugin(environment, qualified, external) {
|
|
|
26938
27316
|
}
|
|
26939
27317
|
},
|
|
26940
27318
|
load: {
|
|
26941
|
-
filter: { id: [
|
|
27319
|
+
filter: { id: [
|
|
27320
|
+
exactRegex(browserExternalId),
|
|
27321
|
+
prefixRegex(browserExternalNamespace),
|
|
27322
|
+
prefixRegex(optionalPeerDepNamespace)
|
|
27323
|
+
] },
|
|
26942
27324
|
handler(id) {
|
|
27325
|
+
if (id === "__vite-browser-external") return { code: "module.exports = {}" };
|
|
26943
27326
|
if (id.startsWith(browserExternalNamespace)) {
|
|
26944
27327
|
const path = id.slice(17);
|
|
26945
27328
|
if (isProduction) return { code: "module.exports = {}" };
|
|
@@ -26991,20 +27374,31 @@ function rolldownDepPlugin(environment, qualified, external) {
|
|
|
26991
27374
|
}];
|
|
26992
27375
|
}
|
|
26993
27376
|
const matchesEntireLine = (text) => `^${escapeRegex(text)}$`;
|
|
26994
|
-
function rolldownCjsExternalPlugin(externals, platform) {
|
|
27377
|
+
function rolldownCjsExternalPlugin(externals, platform, environment) {
|
|
26995
27378
|
if (platform === "node") return;
|
|
26996
27379
|
if (platform === "neutral") return;
|
|
26997
27380
|
const filter = new RegExp(externals.map(matchesEntireLine).join("|"));
|
|
27381
|
+
const packageCache = /* @__PURE__ */ new Map();
|
|
27382
|
+
const resolveRequire = createBackCompatIdResolver(environment.getTopLevelConfig(), {
|
|
27383
|
+
asSrc: false,
|
|
27384
|
+
isRequire: true,
|
|
27385
|
+
scan: true,
|
|
27386
|
+
packageCache
|
|
27387
|
+
});
|
|
26998
27388
|
return {
|
|
26999
27389
|
name: "cjs-external",
|
|
27000
27390
|
resolveId: {
|
|
27001
27391
|
filter: { id: [prefixRegex(nonFacadePrefix), filter] },
|
|
27002
|
-
handler(id,
|
|
27392
|
+
async handler(id, importer, options) {
|
|
27003
27393
|
if (id.startsWith(nonFacadePrefix)) return {
|
|
27004
27394
|
id: id.slice(25),
|
|
27005
27395
|
external: "absolute"
|
|
27006
27396
|
};
|
|
27007
|
-
if (options.kind === "require-call")
|
|
27397
|
+
if (options.kind === "require-call") {
|
|
27398
|
+
const resolved = await resolveRequire(environment, id, importer).catch(() => void 0);
|
|
27399
|
+
if (resolved?.startsWith("__vite-optional-peer-dep")) return { id: optionalPeerDepNamespace + resolved };
|
|
27400
|
+
return { id: cjsExternalFacadeNamespace + id };
|
|
27401
|
+
}
|
|
27008
27402
|
return {
|
|
27009
27403
|
id,
|
|
27010
27404
|
external: "absolute"
|
|
@@ -27419,7 +27813,7 @@ function devToScanEnvironment(environment) {
|
|
|
27419
27813
|
}
|
|
27420
27814
|
const debug$5 = createDebugger("vite:deps");
|
|
27421
27815
|
const htmlTypesRE = /\.(?:html|vue|svelte|astro|imba)$/;
|
|
27422
|
-
const importsRE = /(?<!\/\/.*)(?<=^|;|\*\/)\s*import(?!\s+type)(?:[\w*{}\n\r\t, ]+from)?\s*("[^"]+"|'[^']+')\s*(?=$|;|\/\/|\/\*)/gm;
|
|
27816
|
+
const importsRE = /(?<!\/\/.*)(?<=^|;|\*\/)\s*import(?!\s+type\b)(?:[\w*{}\n\r\t, ]+from)?\s*("[^"]+"|'[^']+')\s*(?=$|;|\/\/|\/\*)/gm;
|
|
27423
27817
|
function scanImports(environment) {
|
|
27424
27818
|
const start = performance$1.now();
|
|
27425
27819
|
const { config } = environment;
|
|
@@ -27958,7 +28352,7 @@ function runOptimizeDeps(environment, depsInfo) {
|
|
|
27958
28352
|
fs.writeFileSync(dataPath, stringifyDepsOptimizerMetadata(metadata, depsCacheDir));
|
|
27959
28353
|
const temporaryPath = depsCacheDir + getTempSuffix();
|
|
27960
28354
|
const depsCacheDirPresent = fs.existsSync(depsCacheDir);
|
|
27961
|
-
if (isWindows) {
|
|
28355
|
+
if (isWindows$1) {
|
|
27962
28356
|
if (depsCacheDirPresent) {
|
|
27963
28357
|
debug$4?.(import_picocolors.default.green(`renaming ${depsCacheDir} to ${temporaryPath}`));
|
|
27964
28358
|
await safeRename(depsCacheDir, temporaryPath);
|
|
@@ -28065,7 +28459,7 @@ async function prepareRolldownOptimizerRun(environment, depsInfo, processingCach
|
|
|
28065
28459
|
const exportsData = await (depsInfo[id].exportsData ?? extractExportsData(environment, src));
|
|
28066
28460
|
if (exportsData.jsxLoader) jsxLoader = true;
|
|
28067
28461
|
const flatId = flattenId(id);
|
|
28068
|
-
flatIdDeps[flatId] = isWindows ? src.replaceAll("/", "\\") : src;
|
|
28462
|
+
flatIdDeps[flatId] = isWindows$1 ? src.replaceAll("/", "\\") : src;
|
|
28069
28463
|
idToExports[id] = exportsData;
|
|
28070
28464
|
}));
|
|
28071
28465
|
if (optimizerContext.cancelled) return {
|
|
@@ -28079,7 +28473,7 @@ async function prepareRolldownOptimizerRun(environment, depsInfo, processingCach
|
|
|
28079
28473
|
const platform = optimizeDeps.rolldownOptions?.platform ?? (environment.config.consumer === "client" || environment.config.ssr.target === "webworker" ? "browser" : "node");
|
|
28080
28474
|
const external = [...optimizeDeps.exclude ?? []];
|
|
28081
28475
|
const plugins = await asyncFlatten(arraify(pluginsFromConfig));
|
|
28082
|
-
if (external.length) plugins.push(rolldownCjsExternalPlugin(external, platform));
|
|
28476
|
+
if (external.length) plugins.push(rolldownCjsExternalPlugin(external, platform, environment));
|
|
28083
28477
|
plugins.push(...rolldownDepPlugin(environment, flatIdDeps, external));
|
|
28084
28478
|
let canceled = false;
|
|
28085
28479
|
async function build() {
|
|
@@ -29419,8 +29813,8 @@ function cssPostPlugin(config) {
|
|
|
29419
29813
|
const relativePath = normalizePath(path.relative(cssAssetDirname, filename));
|
|
29420
29814
|
return relativePath[0] === "." ? relativePath : "./" + relativePath;
|
|
29421
29815
|
};
|
|
29422
|
-
chunkCSS = chunkCSS.replace(assetUrlRE, (_, fileHash) => {
|
|
29423
|
-
const filename = this.getFileName(fileHash);
|
|
29816
|
+
chunkCSS = chunkCSS.replace(assetUrlRE, (_, fileHash, urlId) => {
|
|
29817
|
+
const filename = this.getFileName(fileHash) + getAssetUrlPostfix(this.environment, urlId);
|
|
29424
29818
|
chunk.viteMetadata.importedAssets.add(cleanUrl(filename));
|
|
29425
29819
|
return encodeURIPath(toOutputFilePathInCss(filename, "asset", cssAssetName, "css", config, toRelative));
|
|
29426
29820
|
});
|
|
@@ -29726,7 +30120,7 @@ function createCSSResolvers(config) {
|
|
|
29726
30120
|
skipMainField: true
|
|
29727
30121
|
});
|
|
29728
30122
|
sassResolve = async (...args) => {
|
|
29729
|
-
if (args[1].startsWith("file://")) args[1] = fileURLToPath(args[1], { windows: isWindows && !fileURLWithWindowsDriveRE.test(args[1]) ? false : void 0 });
|
|
30123
|
+
if (args[1].startsWith("file://")) args[1] = fileURLToPath(args[1], { windows: isWindows$1 && !fileURLWithWindowsDriveRE.test(args[1]) ? false : void 0 });
|
|
29730
30124
|
return resolver(...args);
|
|
29731
30125
|
};
|
|
29732
30126
|
}
|
|
@@ -31247,7 +31641,7 @@ function buildHtmlPlugin(config) {
|
|
|
31247
31641
|
const processedEncodedUrl = await processSrcSet(attr.value, async ({ url }) => {
|
|
31248
31642
|
const decodedUrl = decodeURIIfPossible(url);
|
|
31249
31643
|
if (decodedUrl !== void 0 && !isExcludedUrl(decodedUrl)) {
|
|
31250
|
-
const result = await processAssetUrl(
|
|
31644
|
+
const result = await processAssetUrl(decodedUrl, getLinkShouldInline(node, attr.attributes));
|
|
31251
31645
|
return result !== decodedUrl ? encodeURIPath(result) : url;
|
|
31252
31646
|
}
|
|
31253
31647
|
return url;
|
|
@@ -31429,10 +31823,10 @@ function buildHtmlPlugin(config) {
|
|
|
31429
31823
|
bundle,
|
|
31430
31824
|
chunk
|
|
31431
31825
|
});
|
|
31432
|
-
result = result.replace(assetUrlRE, (_, fileHash) => {
|
|
31826
|
+
result = result.replace(assetUrlRE, (_, fileHash, urlId) => {
|
|
31433
31827
|
const file = this.getFileName(fileHash);
|
|
31434
31828
|
if (chunk) chunk.viteMetadata.importedAssets.add(cleanUrl(file));
|
|
31435
|
-
return encodeURIPath(toOutputAssetFilePath(file));
|
|
31829
|
+
return encodeURIPath(toOutputAssetFilePath(file)) + getAssetUrlPostfix(this.environment, urlId);
|
|
31436
31830
|
});
|
|
31437
31831
|
result = result.replace(publicAssetUrlRE, (_, fileHash) => {
|
|
31438
31832
|
const publicAssetPath = toOutputPublicAssetFilePath(getPublicAssetFilename(fileHash, config));
|
|
@@ -31763,7 +32157,7 @@ function getImportMap(bundle, options) {
|
|
|
31763
32157
|
}
|
|
31764
32158
|
//#endregion
|
|
31765
32159
|
//#region src/node/plugins/asset.ts
|
|
31766
|
-
const assetUrlRE = /__VITE_ASSET__([\w$]
|
|
32160
|
+
const assetUrlRE = /__VITE_ASSET__([\w$]{22})(?:_([a-f\d]{24}))?__/g;
|
|
31767
32161
|
const encodedHashPlaceholderRE = /!~%7B([\w$]{1,17})%7D~/g;
|
|
31768
32162
|
function unescapeHashPlaceholders(uri) {
|
|
31769
32163
|
return uri.replace(encodedHashPlaceholderRE, "!~{$1}~");
|
|
@@ -31794,10 +32188,10 @@ function renderAssetUrlInJS(pluginContext, chunk, opts, code) {
|
|
|
31794
32188
|
assetUrlRE.lastIndex = 0;
|
|
31795
32189
|
while (match = assetUrlRE.exec(code)) {
|
|
31796
32190
|
s ||= new MagicString(code);
|
|
31797
|
-
const [full, referenceId] = match;
|
|
32191
|
+
const [full, referenceId, urlId] = match;
|
|
31798
32192
|
const file = pluginContext.getFileName(referenceId);
|
|
31799
32193
|
chunk.viteMetadata.importedAssets.add(cleanUrl(file));
|
|
31800
|
-
const replacement = toOutputFilePathInJS(environment, file, "asset", chunk.fileName, "js", toRelativeRuntime);
|
|
32194
|
+
const replacement = toOutputFilePathInJS(environment, file + getAssetUrlPostfix(environment, urlId), "asset", chunk.fileName, "js", toRelativeRuntime);
|
|
31801
32195
|
const replacementString = typeof replacement === "string" ? JSON.stringify(encodeURIPath(replacement)).slice(1, -1) : `"+${replacement.runtime}+"`;
|
|
31802
32196
|
s.update(match.index, match.index + full.length, replacementString);
|
|
31803
32197
|
}
|
|
@@ -31871,7 +32265,7 @@ function assetPlugin(config) {
|
|
|
31871
32265
|
};
|
|
31872
32266
|
}
|
|
31873
32267
|
return {
|
|
31874
|
-
code: `export default ${formatBuiltAsset(resolved, "js")}`,
|
|
32268
|
+
code: `export default ${formatBuiltAsset(resolved, "js", addFileUrlMetadataForAsset(this.environment, resolved, "js"))}`,
|
|
31875
32269
|
moduleSideEffects: config.command === "build" && this.getModuleInfo(id)?.isEntry ? "no-treeshake" : false,
|
|
31876
32270
|
meta: config.command === "build" ? { "vite:asset": true } : void 0,
|
|
31877
32271
|
moduleType: "js"
|
|
@@ -31893,8 +32287,9 @@ function assetPlugin(config) {
|
|
|
31893
32287
|
}
|
|
31894
32288
|
files.add(cleanUrl(fileName));
|
|
31895
32289
|
const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(format, environment.config.isWorker);
|
|
31896
|
-
|
|
31897
|
-
|
|
32290
|
+
const metadata = urlId ? fileUrlMetadata.get(environment)?.get(urlId) : void 0;
|
|
32291
|
+
if (metadata?.asFileUrl) return toRelativeRuntime(fileName, chunkId).runtime;
|
|
32292
|
+
const replacement = toOutputFilePathInJS(environment, fileName + (metadata?.postfix ?? ""), "asset", chunkId, "js", toRelativeRuntime);
|
|
31898
32293
|
return typeof replacement === "string" ? JSON.stringify(unescapeHashPlaceholders(encodeURIPath(replacement))) : replacement.runtime;
|
|
31899
32294
|
},
|
|
31900
32295
|
renderChunk(code, chunk, opts) {
|
|
@@ -31991,7 +32386,17 @@ function isGitLfsPlaceholder(content) {
|
|
|
31991
32386
|
*/
|
|
31992
32387
|
async function fileToBuiltUrl(pluginContext, id, format, skipPublicCheck = false, forceInline, asFileUrl = false) {
|
|
31993
32388
|
const resolved = await resolveBuiltAsset(pluginContext, id, skipPublicCheck, forceInline);
|
|
31994
|
-
return formatBuiltAsset(resolved, format,
|
|
32389
|
+
return formatBuiltAsset(resolved, format, addFileUrlMetadataForAsset(pluginContext.environment, resolved, format, asFileUrl));
|
|
32390
|
+
}
|
|
32391
|
+
function addFileUrlMetadataForAsset(environment, resolved, format, useFileUrl = false) {
|
|
32392
|
+
if (resolved.type !== "reference") return;
|
|
32393
|
+
const asFileUrl = format === "js" && useFileUrl;
|
|
32394
|
+
const { postfix } = resolved;
|
|
32395
|
+
if (!asFileUrl && !postfix) return;
|
|
32396
|
+
return addFileUrlMetadata(environment, {
|
|
32397
|
+
asFileUrl,
|
|
32398
|
+
postfix
|
|
32399
|
+
});
|
|
31995
32400
|
}
|
|
31996
32401
|
function addFileUrlMetadata(environment, metadata) {
|
|
31997
32402
|
let metadataMap = fileUrlMetadata.get(environment);
|
|
@@ -32006,14 +32411,14 @@ function addFileUrlMetadata(environment, metadata) {
|
|
|
32006
32411
|
metadataMap.set(urlId, metadata);
|
|
32007
32412
|
return urlId;
|
|
32008
32413
|
}
|
|
32414
|
+
function getAssetUrlPostfix(environment, urlId) {
|
|
32415
|
+
return urlId ? fileUrlMetadata.get(environment)?.get(urlId)?.postfix ?? "" : "";
|
|
32416
|
+
}
|
|
32009
32417
|
/** Format a resolved asset as either a JS expression or a plain-text string. */
|
|
32010
32418
|
function formatBuiltAsset(resolved, format, urlId) {
|
|
32011
32419
|
if (resolved.type === "reference") {
|
|
32012
|
-
if (format === "js") {
|
|
32013
|
-
|
|
32014
|
-
return resolved.postfix ? `${base} + ${JSON.stringify(resolved.postfix)}` : base;
|
|
32015
|
-
}
|
|
32016
|
-
return `__VITE_ASSET__${resolved.referenceId}__${resolved.postfix}`;
|
|
32420
|
+
if (format === "js") return urlId ? `import.meta.ROLLDOWN_FILE_URL_${resolved.referenceId}_${urlId}` : `import.meta.ROLLDOWN_FILE_URL_${resolved.referenceId}`;
|
|
32421
|
+
return `__VITE_ASSET__${resolved.referenceId}${urlId ? `_${urlId}` : ""}__`;
|
|
32017
32422
|
}
|
|
32018
32423
|
return format === "js" ? JSON.stringify(encodeURIPath(resolved.value)) : resolved.value;
|
|
32019
32424
|
}
|
|
@@ -32363,7 +32768,7 @@ function normalizeWindowsPath(input = "") {
|
|
|
32363
32768
|
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
32364
32769
|
}
|
|
32365
32770
|
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
32366
|
-
function cwd() {
|
|
32771
|
+
function cwd$1() {
|
|
32367
32772
|
if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
|
|
32368
32773
|
return "/";
|
|
32369
32774
|
}
|
|
@@ -32372,7 +32777,7 @@ const resolve$2 = function(...arguments_) {
|
|
|
32372
32777
|
let resolvedPath = "";
|
|
32373
32778
|
let resolvedAbsolute = false;
|
|
32374
32779
|
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
32375
|
-
const path = index >= 0 ? arguments_[index] : cwd();
|
|
32780
|
+
const path = index >= 0 ? arguments_[index] : cwd$1();
|
|
32376
32781
|
if (!path || path.length === 0) continue;
|
|
32377
32782
|
resolvedPath = `${path}/${resolvedPath}`;
|
|
32378
32783
|
resolvedAbsolute = isAbsolute$2(path);
|
|
@@ -33708,9 +34113,10 @@ function terserPlugin(config) {
|
|
|
33708
34113
|
return !!environment.config.build.minify;
|
|
33709
34114
|
},
|
|
33710
34115
|
async renderChunk(code, chunk, outputOptions) {
|
|
33711
|
-
const
|
|
34116
|
+
const minify = this.environment.config.build.minify;
|
|
34117
|
+
const usesOxcMinifier = (minify === true || minify === "oxc") && outputOptions.minify !== false;
|
|
33712
34118
|
const minifyLegacyWithTerser = this.environment.config.isOutputOptionsForLegacyChunks?.(outputOptions) && !usesOxcMinifier;
|
|
33713
|
-
if (
|
|
34119
|
+
if (minify !== "terser" && !minifyLegacyWithTerser) return null;
|
|
33714
34120
|
worker ||= makeWorker();
|
|
33715
34121
|
const terserPath = pathToFileURL(loadTerserPath(config.root)).href;
|
|
33716
34122
|
try {
|
|
@@ -33963,10 +34369,8 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
|
|
|
33963
34369
|
...options.rolldownOptions.resolve,
|
|
33964
34370
|
tsconfigFilename: void 0
|
|
33965
34371
|
} : options.rolldownOptions.resolve,
|
|
33966
|
-
output: options.rolldownOptions.output,
|
|
33967
34372
|
input,
|
|
33968
34373
|
plugins,
|
|
33969
|
-
external: options.rolldownOptions.external,
|
|
33970
34374
|
onLog(level, log) {
|
|
33971
34375
|
onRollupLog(level, log, environment);
|
|
33972
34376
|
},
|
|
@@ -33999,6 +34403,11 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
|
|
|
33999
34403
|
if (output.sourcemap) logger.warnOnce(import_picocolors.default.yellow("Vite does not support \"rolldownOptions.output.sourcemap\". Please use \"build.sourcemap\" instead."));
|
|
34000
34404
|
const format = output.format || "es";
|
|
34001
34405
|
const jsExt = ssr && !isSsrTargetWebworkerEnvironment || libOptions ? resolveOutputJsExtension(format, findNearestPackageData(root, packageCache)?.data.type) : "js";
|
|
34406
|
+
const resolvedMinify = options.minify === "oxc" ? libOptions && (format === "es" || format === "esm") ? {
|
|
34407
|
+
compress: true,
|
|
34408
|
+
mangle: true,
|
|
34409
|
+
codegen: false
|
|
34410
|
+
} : true : options.minify === false ? "dce-only" : false;
|
|
34002
34411
|
return {
|
|
34003
34412
|
dir: outDir,
|
|
34004
34413
|
format,
|
|
@@ -34010,19 +34419,18 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
|
|
|
34010
34419
|
chunkFileNames: libOptions ? `[name]-[hash].${jsExt}` : path.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
|
|
34011
34420
|
assetFileNames: libOptions ? `[name].[ext]` : path.posix.join(options.assetsDir, `[name]-[hash].[ext]`),
|
|
34012
34421
|
codeSplitting: output.codeSplitting ?? (output.format === "umd" || output.format === "iife" || isSsrTargetWebworkerEnvironment && (typeof input === "string" || Object.keys(input).length === 1) ? false : void 0),
|
|
34422
|
+
topLevelVar: true,
|
|
34423
|
+
...output,
|
|
34424
|
+
minify: output.minify === void 0 ? resolvedMinify : typeof output.minify === "object" && typeof resolvedMinify === "object" ? {
|
|
34425
|
+
...resolvedMinify,
|
|
34426
|
+
...output.minify
|
|
34427
|
+
} : output.minify,
|
|
34013
34428
|
comments: typeof output.comments === "boolean" ? output.comments : {
|
|
34014
34429
|
annotation: !options.minify || libOptions && (format === "es" || format === "esm"),
|
|
34015
34430
|
jsdoc: !options.minify,
|
|
34016
34431
|
legal: !options.minify,
|
|
34017
34432
|
...output.comments
|
|
34018
|
-
}
|
|
34019
|
-
minify: options.minify === "oxc" ? libOptions && (format === "es" || format === "esm") ? {
|
|
34020
|
-
compress: true,
|
|
34021
|
-
mangle: true,
|
|
34022
|
-
codegen: false
|
|
34023
|
-
} : true : options.minify === false ? "dce-only" : false,
|
|
34024
|
-
topLevelVar: true,
|
|
34025
|
-
...output
|
|
34433
|
+
}
|
|
34026
34434
|
};
|
|
34027
34435
|
};
|
|
34028
34436
|
const outputs = resolveBuildOutputs(options.rolldownOptions.output, libOptions, logger);
|
|
@@ -35120,6 +35528,7 @@ function createDepsOptimizer(environment) {
|
|
|
35120
35528
|
let metadata = initDepsOptimizerMetadata(environment, sessionTimestamp);
|
|
35121
35529
|
const depsOptimizer = {
|
|
35122
35530
|
init,
|
|
35531
|
+
initState: "idle",
|
|
35123
35532
|
metadata,
|
|
35124
35533
|
registerMissingImport,
|
|
35125
35534
|
run: () => debouncedProcessing(0),
|
|
@@ -35160,16 +35569,19 @@ function createDepsOptimizer(environment) {
|
|
|
35160
35569
|
let discover;
|
|
35161
35570
|
async function close() {
|
|
35162
35571
|
closed = true;
|
|
35572
|
+
if (debounceProcessingHandle) clearTimeout(debounceProcessingHandle);
|
|
35573
|
+
debounceProcessingHandle = void 0;
|
|
35163
35574
|
await Promise.allSettled([
|
|
35164
35575
|
discover?.cancel(),
|
|
35165
35576
|
depsOptimizer.scanProcessing,
|
|
35166
35577
|
optimizationResult?.cancel()
|
|
35167
35578
|
]);
|
|
35579
|
+
depOptimizationProcessing.resolve();
|
|
35580
|
+
resolveEnqueuedProcessingPromises();
|
|
35168
35581
|
}
|
|
35169
|
-
let initState = "idle";
|
|
35170
35582
|
async function init() {
|
|
35171
|
-
if (initState !== "idle") return;
|
|
35172
|
-
initState = "initializing";
|
|
35583
|
+
if (depsOptimizer.initState !== "idle") return;
|
|
35584
|
+
depsOptimizer.initState = "initializing";
|
|
35173
35585
|
const cachedMetadata = await loadCachedDepOptimizationMetadata(environment);
|
|
35174
35586
|
firstRunCalled = !!cachedMetadata;
|
|
35175
35587
|
metadata = depsOptimizer.metadata = cachedMetadata || initDepsOptimizerMetadata(environment, sessionTimestamp);
|
|
@@ -35226,7 +35638,7 @@ function createDepsOptimizer(environment) {
|
|
|
35226
35638
|
})();
|
|
35227
35639
|
});
|
|
35228
35640
|
}
|
|
35229
|
-
initState = "initialized";
|
|
35641
|
+
depsOptimizer.initState = "initialized";
|
|
35230
35642
|
}
|
|
35231
35643
|
function startNextDiscoveredBatch() {
|
|
35232
35644
|
newDepsDiscovered = false;
|
|
@@ -35250,8 +35662,6 @@ function createDepsOptimizer(environment) {
|
|
|
35250
35662
|
if (debounceProcessingHandle) clearTimeout(debounceProcessingHandle);
|
|
35251
35663
|
if (closed) {
|
|
35252
35664
|
currentlyProcessing = false;
|
|
35253
|
-
depOptimizationProcessing.resolve();
|
|
35254
|
-
resolveEnqueuedProcessingPromises();
|
|
35255
35665
|
return;
|
|
35256
35666
|
}
|
|
35257
35667
|
currentlyProcessing = true;
|
|
@@ -35268,7 +35678,6 @@ function createDepsOptimizer(environment) {
|
|
|
35268
35678
|
if (closed) {
|
|
35269
35679
|
currentlyProcessing = false;
|
|
35270
35680
|
processingResult.cancel();
|
|
35271
|
-
resolveEnqueuedProcessingPromises();
|
|
35272
35681
|
return;
|
|
35273
35682
|
}
|
|
35274
35683
|
const newData = processingResult.metadata;
|
|
@@ -35363,7 +35772,7 @@ function createDepsOptimizer(environment) {
|
|
|
35363
35772
|
let missing = metadata.discovered[id];
|
|
35364
35773
|
if (missing) return missing;
|
|
35365
35774
|
missing = addMissingDep(id, resolved);
|
|
35366
|
-
if (initState === "initialized" && !waitingForCrawlEnd) debouncedProcessing();
|
|
35775
|
+
if (depsOptimizer.initState === "initialized" && !waitingForCrawlEnd) debouncedProcessing();
|
|
35367
35776
|
return missing;
|
|
35368
35777
|
}
|
|
35369
35778
|
function addMissingDep(id, resolved) {
|
|
@@ -35440,6 +35849,7 @@ function createDepsOptimizer(environment) {
|
|
|
35440
35849
|
function createExplicitDepsOptimizer(environment) {
|
|
35441
35850
|
const depsOptimizer = {
|
|
35442
35851
|
metadata: initDepsOptimizerMetadata(environment),
|
|
35852
|
+
initState: "idle",
|
|
35443
35853
|
isOptimizedDepFile: createIsOptimizedDepFile(environment),
|
|
35444
35854
|
isOptimizedDepUrl: createIsOptimizedDepUrl(environment),
|
|
35445
35855
|
getOptimizedDepId: (depInfo) => `${depInfo.file}?v=${depInfo.browserHash}`,
|
|
@@ -35451,11 +35861,11 @@ function createExplicitDepsOptimizer(environment) {
|
|
|
35451
35861
|
close: async () => {},
|
|
35452
35862
|
options: environment.config.optimizeDeps
|
|
35453
35863
|
};
|
|
35454
|
-
let inited = false;
|
|
35455
35864
|
async function init() {
|
|
35456
|
-
if (
|
|
35457
|
-
|
|
35865
|
+
if (depsOptimizer.initState !== "idle") return;
|
|
35866
|
+
depsOptimizer.initState = "initializing";
|
|
35458
35867
|
depsOptimizer.metadata = await optimizeExplicitEnvironmentDeps(environment);
|
|
35868
|
+
depsOptimizer.initState = "initialized";
|
|
35459
35869
|
}
|
|
35460
35870
|
return depsOptimizer;
|
|
35461
35871
|
}
|
|
@@ -35549,7 +35959,7 @@ function inlineSourceMap(mod, result, startOffset) {
|
|
|
35549
35959
|
...map,
|
|
35550
35960
|
mappings: ";".repeat(startOffset) + map.mappings
|
|
35551
35961
|
} : map;
|
|
35552
|
-
result.code = `${code.trimEnd()}\n//# sourceURL=${mod.id}\n${MODULE_RUNNER_SOURCEMAPPING_SOURCE}\n//# ${SOURCEMAPPING_URL}=${genSourceMapUrl(sourceMap)}\n`;
|
|
35962
|
+
result.code = `${code.trimEnd()}\n//# sourceURL=${encodeSourceURL(mod.id)}\n${MODULE_RUNNER_SOURCEMAPPING_SOURCE}\n//# ${SOURCEMAPPING_URL}=${genSourceMapUrl(sourceMap)}\n`;
|
|
35553
35963
|
return result;
|
|
35554
35964
|
}
|
|
35555
35965
|
//#endregion
|
|
@@ -35583,7 +35993,8 @@ var MemoryFiles = class {
|
|
|
35583
35993
|
var BundledDev = class {
|
|
35584
35994
|
environment;
|
|
35585
35995
|
_devEngine;
|
|
35586
|
-
|
|
35996
|
+
/** the vite client and the rolldown runtime; set before the first build so `hasBuildOutput` can count them */
|
|
35997
|
+
staticFiles = /* @__PURE__ */ new Map();
|
|
35587
35998
|
initialBuildCompleted = false;
|
|
35588
35999
|
_closed = false;
|
|
35589
36000
|
clients = new Clients();
|
|
@@ -35617,12 +36028,13 @@ var BundledDev = class {
|
|
|
35617
36028
|
}
|
|
35618
36029
|
pendingPayloadFilenames = /* @__PURE__ */ new Set();
|
|
35619
36030
|
get hasBuildOutput() {
|
|
35620
|
-
return this.memoryFiles.size >
|
|
36031
|
+
return this.memoryFiles.size > this.staticFiles.size;
|
|
35621
36032
|
}
|
|
35622
36033
|
async listen() {
|
|
35623
36034
|
this._closed = false;
|
|
35624
36035
|
debug$1?.("INITIAL: setup bundle options");
|
|
35625
36036
|
const rolldownOptions = await this.getRolldownOptions();
|
|
36037
|
+
await this.storeStaticFiles();
|
|
35626
36038
|
if (Array.isArray(rolldownOptions.output) && rolldownOptions.output.length > 1) throw new Error("multiple output options are not supported in dev mode");
|
|
35627
36039
|
const outputOptions = Array.isArray(rolldownOptions.output) ? rolldownOptions.output[0] : rolldownOptions.output;
|
|
35628
36040
|
this.environment.hot.on("vite:client-connected", async (payload, client) => {
|
|
@@ -35714,8 +36126,6 @@ var BundledDev = class {
|
|
|
35714
36126
|
}, (e) => {
|
|
35715
36127
|
debug$1?.("INITIAL: run error", e);
|
|
35716
36128
|
});
|
|
35717
|
-
this.viteRuntime = await getHmrImplementation(this.environment.getTopLevelConfig());
|
|
35718
|
-
this.storeOutputFiles([]);
|
|
35719
36129
|
this.waitForInitialBuildFinish().then(() => {
|
|
35720
36130
|
if (this._closed) return;
|
|
35721
36131
|
debug$1?.("INITIAL: build done");
|
|
@@ -35767,6 +36177,7 @@ var BundledDev = class {
|
|
|
35767
36177
|
debug$1?.(`TRIGGER-LAZY: trigger lazy bundling for module ${moduleId} for client ${clientId}`);
|
|
35768
36178
|
const result = await this.devEngine.compileEntry(moduleId, clientId);
|
|
35769
36179
|
this.pendingPayloadFilenames.add(result.filename);
|
|
36180
|
+
if (result.sourcemapFilename && result.sourcemap) this.memoryFiles.set(`@vite/${result.sourcemapFilename}`, { source: result.sourcemap });
|
|
35770
36181
|
return {
|
|
35771
36182
|
filename: result.filename,
|
|
35772
36183
|
code: result.code + payloadDeliveredAck(result.filename)
|
|
@@ -35789,11 +36200,19 @@ var BundledDev = class {
|
|
|
35789
36200
|
await this._devEngine?.close();
|
|
35790
36201
|
this.initialBuildCompleted = false;
|
|
35791
36202
|
}
|
|
36203
|
+
async storeStaticFiles() {
|
|
36204
|
+
const sources = new Map([[BUNDLED_DEV_CLIENT_FILENAME, await getHmrImplementation(this.environment.getTopLevelConfig())], ...getRolldownDevRuntimeFiles()]);
|
|
36205
|
+
this.staticFiles.clear();
|
|
36206
|
+
for (const [fileName, source] of sources) {
|
|
36207
|
+
const file = {
|
|
36208
|
+
source,
|
|
36209
|
+
etag: (0, import_etag.default)(Buffer.from(source), { weak: true })
|
|
36210
|
+
};
|
|
36211
|
+
this.staticFiles.set(fileName, file);
|
|
36212
|
+
this.memoryFiles.set(fileName, file);
|
|
36213
|
+
}
|
|
36214
|
+
}
|
|
35792
36215
|
storeOutputFiles(output) {
|
|
35793
|
-
if (this.viteRuntime) this.memoryFiles.set(BUNDLED_DEV_CLIENT_FILENAME, {
|
|
35794
|
-
source: this.viteRuntime,
|
|
35795
|
-
etag: (0, import_etag.default)(Buffer.from(this.viteRuntime), { weak: true })
|
|
35796
|
-
});
|
|
35797
36216
|
for (const outputFile of output) this.memoryFiles.set(outputFile.fileName, () => {
|
|
35798
36217
|
const source = outputFile.type === "chunk" ? outputFile.code : outputFile.source;
|
|
35799
36218
|
return {
|