vite 8.3.1 → 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 -363
- package/dist/client/client.mjs +74 -23
- package/dist/node/chunks/node.js +627 -573
- package/dist/node/index.d.ts +3 -1
- package/dist/node/module-runner.js +16 -2
- package/package.json +8 -8
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 = [
|
|
@@ -2115,7 +2138,7 @@ function testCaseInsensitiveFS() {
|
|
|
2115
2138
|
const isCaseInsensitiveFS = testCaseInsensitiveFS();
|
|
2116
2139
|
const VOLUME_RE = /^[A-Z]:/i;
|
|
2117
2140
|
function normalizePath(id) {
|
|
2118
|
-
return path.posix.normalize(isWindows ? slash(id) : id);
|
|
2141
|
+
return path.posix.normalize(isWindows$1 ? slash(id) : id);
|
|
2119
2142
|
}
|
|
2120
2143
|
function fsPathFromId(id) {
|
|
2121
2144
|
const fsPath = normalizePath(id.startsWith(FS_PREFIX) ? id.slice(FS_PREFIX.length) : id);
|
|
@@ -2187,7 +2210,7 @@ function removeUrlQuery(url) {
|
|
|
2187
2210
|
}
|
|
2188
2211
|
function injectQuery(url, queryToInject) {
|
|
2189
2212
|
const { file, postfix } = splitFileAndPostfix(url);
|
|
2190
|
-
return `${isWindows ? slash(file) : file}?${queryToInject}${postfix[0] === "?" ? `&${postfix.slice(1)}` : postfix}`;
|
|
2213
|
+
return `${isWindows$1 ? slash(file) : file}?${queryToInject}${postfix[0] === "?" ? `&${postfix.slice(1)}` : postfix}`;
|
|
2191
2214
|
}
|
|
2192
2215
|
const timestampRE = /(\?|&)t=\d{13}(?:&|$)/;
|
|
2193
2216
|
function removeTimestampQuery(url) {
|
|
@@ -2428,7 +2451,7 @@ async function recursiveReaddir(dir) {
|
|
|
2428
2451
|
return dirent.isDirectory() ? recursiveReaddir(res) : normalizePath(res);
|
|
2429
2452
|
}))).flat(1);
|
|
2430
2453
|
}
|
|
2431
|
-
let safeRealpathSync = isWindows ? windowsSafeRealPathSync : fs.realpathSync.native;
|
|
2454
|
+
let safeRealpathSync = isWindows$1 ? windowsSafeRealPathSync : fs.realpathSync.native;
|
|
2432
2455
|
const windowsNetworkMap = /* @__PURE__ */ new Map();
|
|
2433
2456
|
function windowsMappedRealpathSync(path) {
|
|
2434
2457
|
const realPath = fs.realpathSync.native(path);
|
|
@@ -3460,7 +3483,7 @@ function alias$1(options = {}) {
|
|
|
3460
3483
|
};
|
|
3461
3484
|
}
|
|
3462
3485
|
//#endregion
|
|
3463
|
-
//#region ../../node_modules/.pnpm/magic-string@1.4.
|
|
3486
|
+
//#region ../../node_modules/.pnpm/magic-string@1.4.2/node_modules/magic-string/dist/index.mjs
|
|
3464
3487
|
var BitSet = class BitSet {
|
|
3465
3488
|
constructor(arg) {
|
|
3466
3489
|
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
@@ -3554,7 +3577,7 @@ var Chunk = class Chunk {
|
|
|
3554
3577
|
this.outro = "";
|
|
3555
3578
|
this.end = index;
|
|
3556
3579
|
if (this.edited) {
|
|
3557
|
-
newChunk.edit("", false);
|
|
3580
|
+
newChunk.edit("", false, true);
|
|
3558
3581
|
this.content = "";
|
|
3559
3582
|
} else this.content = originalBefore;
|
|
3560
3583
|
newChunk.next = this.next;
|
|
@@ -4516,7 +4539,7 @@ var MagicString = class MagicString {
|
|
|
4516
4539
|
* Content appended or prepended at positions strictly inside the range is removed with it, while
|
|
4517
4540
|
* content attached at `start` or `end` is preserved — use `s.overwrite(start, end, '')` to remove
|
|
4518
4541
|
* the range including its edge inserts.
|
|
4519
|
-
*
|
|
4542
|
+
* Repeated removals and removals with partially overlapping ranges are allowed.
|
|
4520
4543
|
*/
|
|
4521
4544
|
remove(start, end) {
|
|
4522
4545
|
start = start + this.offset;
|
|
@@ -4798,10 +4821,16 @@ var MagicString = class MagicString {
|
|
|
4798
4821
|
* @internal
|
|
4799
4822
|
*/
|
|
4800
4823
|
_hasRemovedContent(start, end) {
|
|
4801
|
-
let chunk = this.
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4824
|
+
let chunk = this.byStart.get(start);
|
|
4825
|
+
if (!chunk) {
|
|
4826
|
+
chunk = this.lastSearchedChunk;
|
|
4827
|
+
const searchForward = start >= chunk.end;
|
|
4828
|
+
while (chunk && !chunk.contains(start)) chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start);
|
|
4829
|
+
if (chunk) this.lastSearchedChunk = chunk;
|
|
4830
|
+
}
|
|
4831
|
+
while (chunk && chunk.start < end) {
|
|
4832
|
+
if (chunk.content === "") return true;
|
|
4833
|
+
chunk = this.byStart.get(chunk.end);
|
|
4805
4834
|
}
|
|
4806
4835
|
return false;
|
|
4807
4836
|
}
|
|
@@ -4865,6 +4894,7 @@ var MagicString = class MagicString {
|
|
|
4865
4894
|
const stringLength = string.length;
|
|
4866
4895
|
if (stringLength === 0) {
|
|
4867
4896
|
for (let index = 0; index <= original.length; index += 1) {
|
|
4897
|
+
if (this._hasRemovedContent(index, index)) continue;
|
|
4868
4898
|
const _replacement = typeof replacement === "function" ? replacement("", index, original) : expandReplacement(replacement, "", index, original, [], void 0);
|
|
4869
4899
|
if (_replacement !== "") this.appendRight(index, _replacement);
|
|
4870
4900
|
}
|
|
@@ -6440,11 +6470,11 @@ var WorkerWithFallback = class {
|
|
|
6440
6470
|
//#endregion
|
|
6441
6471
|
//#region ../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js
|
|
6442
6472
|
var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6443
|
-
const path$
|
|
6444
|
-
const fs$
|
|
6473
|
+
const path$7 = __require("path");
|
|
6474
|
+
const fs$7 = __require("fs");
|
|
6445
6475
|
const os$3 = __require("os");
|
|
6446
6476
|
const url$2 = __require("url");
|
|
6447
|
-
const fsReadFileAsync = fs$
|
|
6477
|
+
const fsReadFileAsync = fs$7.promises.readFile;
|
|
6448
6478
|
/** @type {(name: string, sync: boolean) => string[]} */
|
|
6449
6479
|
function getDefaultSearchPlaces(name, sync) {
|
|
6450
6480
|
return [
|
|
@@ -6473,7 +6503,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6473
6503
|
* And on Windows, this will never happen. ('C:\build' -> 'C:')
|
|
6474
6504
|
*/
|
|
6475
6505
|
function parentDir(p) {
|
|
6476
|
-
return path$
|
|
6506
|
+
return path$7.dirname(p) || path$7.sep;
|
|
6477
6507
|
}
|
|
6478
6508
|
/** @type {import('./index').LoaderSync} */
|
|
6479
6509
|
const jsonLoader = (_, content) => JSON.parse(content);
|
|
@@ -6533,7 +6563,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6533
6563
|
}
|
|
6534
6564
|
};
|
|
6535
6565
|
conf.searchPlaces.forEach((place) => {
|
|
6536
|
-
const key = path$
|
|
6566
|
+
const key = path$7.extname(place) || "noExt";
|
|
6537
6567
|
const loader = conf.loaders[key];
|
|
6538
6568
|
if (!loader) throw new Error(`Missing loader for extension "${place}"`);
|
|
6539
6569
|
if (typeof loader !== "function") throw new Error(`Loader for extension "${place}" is not a function: Received ${typeof loader}.`);
|
|
@@ -6585,14 +6615,14 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6585
6615
|
visited.add(dir);
|
|
6586
6616
|
}
|
|
6587
6617
|
for (const searchPlace of searchPlaces) {
|
|
6588
|
-
const filepath = path$
|
|
6618
|
+
const filepath = path$7.join(dir, searchPlace);
|
|
6589
6619
|
try {
|
|
6590
|
-
await fs$
|
|
6620
|
+
await fs$7.promises.access(filepath);
|
|
6591
6621
|
} catch {
|
|
6592
6622
|
continue;
|
|
6593
6623
|
}
|
|
6594
6624
|
const content = String(await fsReadFileAsync(filepath));
|
|
6595
|
-
const loaderKey = path$
|
|
6625
|
+
const loaderKey = path$7.extname(searchPlace) || "noExt";
|
|
6596
6626
|
const loader = loaders[loaderKey];
|
|
6597
6627
|
if (searchPlace === "package.json") {
|
|
6598
6628
|
const pkg = await loader(filepath, content);
|
|
@@ -6625,9 +6655,9 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6625
6655
|
},
|
|
6626
6656
|
async load(filepath) {
|
|
6627
6657
|
validateFilePath(filepath);
|
|
6628
|
-
const absPath = path$
|
|
6658
|
+
const absPath = path$7.resolve(process.cwd(), filepath);
|
|
6629
6659
|
if (cache && loadCache.has(absPath)) return loadCache.get(absPath);
|
|
6630
|
-
const { base, ext } = path$
|
|
6660
|
+
const { base, ext } = path$7.parse(absPath);
|
|
6631
6661
|
const loaderKey = ext || "noExt";
|
|
6632
6662
|
const loader = loaders[loaderKey];
|
|
6633
6663
|
validateLoader(loader, loaderKey);
|
|
@@ -6697,15 +6727,15 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6697
6727
|
visited.add(dir);
|
|
6698
6728
|
}
|
|
6699
6729
|
for (const searchPlace of searchPlaces) {
|
|
6700
|
-
const filepath = path$
|
|
6730
|
+
const filepath = path$7.join(dir, searchPlace);
|
|
6701
6731
|
try {
|
|
6702
|
-
fs$
|
|
6732
|
+
fs$7.accessSync(filepath);
|
|
6703
6733
|
} catch {
|
|
6704
6734
|
continue;
|
|
6705
6735
|
}
|
|
6706
|
-
const loaderKey = path$
|
|
6736
|
+
const loaderKey = path$7.extname(searchPlace) || "noExt";
|
|
6707
6737
|
const loader = loaders[loaderKey];
|
|
6708
|
-
const content = String(fs$
|
|
6738
|
+
const content = String(fs$7.readFileSync(filepath));
|
|
6709
6739
|
if (searchPlace === "package.json") {
|
|
6710
6740
|
const pkg = loader(filepath, content);
|
|
6711
6741
|
const maybeConfig = getPackageProp(packageProp, pkg);
|
|
@@ -6737,13 +6767,13 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6737
6767
|
},
|
|
6738
6768
|
load(filepath) {
|
|
6739
6769
|
validateFilePath(filepath);
|
|
6740
|
-
const absPath = path$
|
|
6770
|
+
const absPath = path$7.resolve(process.cwd(), filepath);
|
|
6741
6771
|
if (cache && loadCache.has(absPath)) return loadCache.get(absPath);
|
|
6742
|
-
const { base, ext } = path$
|
|
6772
|
+
const { base, ext } = path$7.parse(absPath);
|
|
6743
6773
|
const loaderKey = ext || "noExt";
|
|
6744
6774
|
const loader = loaders[loaderKey];
|
|
6745
6775
|
validateLoader(loader, loaderKey);
|
|
6746
|
-
const content = String(fs$
|
|
6776
|
+
const content = String(fs$7.readFileSync(absPath));
|
|
6747
6777
|
if (base === "package.json") {
|
|
6748
6778
|
const pkg = loader(absPath, content);
|
|
6749
6779
|
return transform({
|
|
@@ -9099,15 +9129,15 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9099
9129
|
//#endregion
|
|
9100
9130
|
//#region ../../node_modules/.pnpm/readdirp@3.6.0/node_modules/readdirp/index.js
|
|
9101
9131
|
var require_readdirp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9102
|
-
const fs$
|
|
9132
|
+
const fs$6 = __require("fs");
|
|
9103
9133
|
const { Readable: Readable$1 } = __require("stream");
|
|
9104
9134
|
const sysPath$3 = __require("path");
|
|
9105
9135
|
const { promisify: promisify$4 } = __require("util");
|
|
9106
9136
|
const picomatch$1 = __require("picomatch");
|
|
9107
|
-
const readdir = promisify$4(fs$
|
|
9108
|
-
const stat = promisify$4(fs$
|
|
9109
|
-
const lstat = promisify$4(fs$
|
|
9110
|
-
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);
|
|
9111
9141
|
/**
|
|
9112
9142
|
* @typedef {Object} EntryInfo
|
|
9113
9143
|
* @property {String} path
|
|
@@ -9201,7 +9231,7 @@ var require_readdirp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9201
9231
|
].includes(type);
|
|
9202
9232
|
this._wantsEverything = type === EVERYTHING_TYPE;
|
|
9203
9233
|
this._root = sysPath$3.resolve(root);
|
|
9204
|
-
this._isDirent = "Dirent" in fs$
|
|
9234
|
+
this._isDirent = "Dirent" in fs$6 && !opts.alwaysStat;
|
|
9205
9235
|
this._statsProp = this._isDirent ? "dirent" : "stats";
|
|
9206
9236
|
this._rdOptions = {
|
|
9207
9237
|
encoding: "utf8",
|
|
@@ -10250,7 +10280,7 @@ var require_constants$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
10250
10280
|
}));
|
|
10251
10281
|
//#endregion
|
|
10252
10282
|
//#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js
|
|
10253
|
-
var require_parse$
|
|
10283
|
+
var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
10254
10284
|
const stringify = require_stringify();
|
|
10255
10285
|
/**
|
|
10256
10286
|
* Constants
|
|
@@ -10541,7 +10571,7 @@ var require_braces = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
10541
10571
|
const stringify = require_stringify();
|
|
10542
10572
|
const compile = require_compile();
|
|
10543
10573
|
const expand = require_expand();
|
|
10544
|
-
const parse = require_parse$
|
|
10574
|
+
const parse = require_parse$1();
|
|
10545
10575
|
/**
|
|
10546
10576
|
* Expand the given pattern or create a regex-compatible string.
|
|
10547
10577
|
*
|
|
@@ -10937,10 +10967,10 @@ var require_binary_extensions = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
10937
10967
|
//#endregion
|
|
10938
10968
|
//#region ../../node_modules/.pnpm/is-binary-path@2.1.0/node_modules/is-binary-path/index.js
|
|
10939
10969
|
var require_is_binary_path = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
10940
|
-
const path$
|
|
10970
|
+
const path$6 = __require("path");
|
|
10941
10971
|
const binaryExtensions = require_binary_extensions();
|
|
10942
10972
|
const extensions = new Set(binaryExtensions);
|
|
10943
|
-
module.exports = (filePath) => extensions.has(path$
|
|
10973
|
+
module.exports = (filePath) => extensions.has(path$6.extname(filePath).slice(1).toLowerCase());
|
|
10944
10974
|
}));
|
|
10945
10975
|
//#endregion
|
|
10946
10976
|
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/constants.js
|
|
@@ -11009,17 +11039,17 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11009
11039
|
//#endregion
|
|
11010
11040
|
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/nodefs-handler.js
|
|
11011
11041
|
var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11012
|
-
const fs$
|
|
11042
|
+
const fs$5 = __require("fs");
|
|
11013
11043
|
const sysPath$2 = __require("path");
|
|
11014
11044
|
const { promisify: promisify$3 } = __require("util");
|
|
11015
11045
|
const isBinaryPath = require_is_binary_path();
|
|
11016
11046
|
const { isWindows, isLinux, EMPTY_FN, EMPTY_STR, KEY_LISTENERS, KEY_ERR, KEY_RAW, HANDLER_KEYS, EV_CHANGE, EV_ADD, EV_ADD_DIR, EV_ERROR, STR_DATA, STR_END, BRACE_START, STAR } = require_constants$1();
|
|
11017
11047
|
const THROTTLE_MODE_WATCH = "watch";
|
|
11018
|
-
const open = promisify$3(fs$
|
|
11019
|
-
const stat = promisify$3(fs$
|
|
11020
|
-
const lstat = promisify$3(fs$
|
|
11021
|
-
const close = promisify$3(fs$
|
|
11022
|
-
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);
|
|
11023
11053
|
const statMethods = {
|
|
11024
11054
|
lstat,
|
|
11025
11055
|
stat
|
|
@@ -11075,7 +11105,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
11075
11105
|
if (evPath && path !== evPath) fsWatchBroadcast(sysPath$2.resolve(path, evPath), KEY_LISTENERS, sysPath$2.join(path, evPath));
|
|
11076
11106
|
};
|
|
11077
11107
|
try {
|
|
11078
|
-
return fs$
|
|
11108
|
+
return fs$5.watch(path, options, handleEvent);
|
|
11079
11109
|
} catch (error) {
|
|
11080
11110
|
errHandler(error);
|
|
11081
11111
|
}
|
|
@@ -11165,7 +11195,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
11165
11195
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
11166
11196
|
const copts = cont && cont.options;
|
|
11167
11197
|
if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
|
|
11168
|
-
fs$
|
|
11198
|
+
fs$5.unwatchFile(fullPath);
|
|
11169
11199
|
cont = void 0;
|
|
11170
11200
|
}
|
|
11171
11201
|
if (cont) {
|
|
@@ -11176,7 +11206,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
11176
11206
|
listeners: listener,
|
|
11177
11207
|
rawEmitters: rawEmitter,
|
|
11178
11208
|
options,
|
|
11179
|
-
watcher: fs$
|
|
11209
|
+
watcher: fs$5.watchFile(fullPath, options, (curr, prev) => {
|
|
11180
11210
|
foreach(cont.rawEmitters, (rawEmitter) => {
|
|
11181
11211
|
rawEmitter(EV_CHANGE, fullPath, {
|
|
11182
11212
|
curr,
|
|
@@ -11194,7 +11224,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
11194
11224
|
delFromSet(cont, KEY_RAW, rawEmitter);
|
|
11195
11225
|
if (isEmptySet(cont.listeners)) {
|
|
11196
11226
|
FsWatchFileInstances.delete(fullPath);
|
|
11197
|
-
fs$
|
|
11227
|
+
fs$5.unwatchFile(fullPath);
|
|
11198
11228
|
cont.options = cont.watcher = void 0;
|
|
11199
11229
|
Object.freeze(cont);
|
|
11200
11230
|
}
|
|
@@ -11467,7 +11497,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
11467
11497
|
//#endregion
|
|
11468
11498
|
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/lib/fsevents-handler.js
|
|
11469
11499
|
var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11470
|
-
const fs$
|
|
11500
|
+
const fs$4 = __require("fs");
|
|
11471
11501
|
const sysPath$1 = __require("path");
|
|
11472
11502
|
const { promisify: promisify$2 } = __require("util");
|
|
11473
11503
|
let fsevents;
|
|
@@ -11484,9 +11514,9 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
11484
11514
|
}
|
|
11485
11515
|
const { EV_ADD, EV_CHANGE, EV_ADD_DIR, EV_UNLINK, EV_ERROR, STR_DATA, STR_END, FSEVENT_CREATED, FSEVENT_MODIFIED, FSEVENT_DELETED, FSEVENT_MOVED, FSEVENT_UNKNOWN, FSEVENT_FLAG_MUST_SCAN_SUBDIRS, FSEVENT_TYPE_FILE, FSEVENT_TYPE_DIRECTORY, FSEVENT_TYPE_SYMLINK, ROOT_GLOBSTAR, DIR_SUFFIX, DOT_SLASH, FUNCTION_TYPE, EMPTY_FN, IDENTITY_FN } = require_constants$1();
|
|
11486
11516
|
const Depth = (value) => isNaN(value) ? {} : { depth: value };
|
|
11487
|
-
const stat = promisify$2(fs$
|
|
11488
|
-
const lstat = promisify$2(fs$
|
|
11489
|
-
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);
|
|
11490
11520
|
const statMethods = {
|
|
11491
11521
|
stat,
|
|
11492
11522
|
lstat
|
|
@@ -11806,7 +11836,7 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
11806
11836
|
//#region ../../node_modules/.pnpm/chokidar@3.6.0_patch_hash=e17269188c54412478078f7ac7877c1d5a475a2f2438328e3a7e725513ccbf1f/node_modules/chokidar/index.js
|
|
11807
11837
|
var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
11808
11838
|
const { EventEmitter: EventEmitter$4 } = __require("events");
|
|
11809
|
-
const fs$
|
|
11839
|
+
const fs$3 = __require("fs");
|
|
11810
11840
|
const sysPath = __require("path");
|
|
11811
11841
|
const { promisify: promisify$1 } = __require("util");
|
|
11812
11842
|
const readdirp = require_readdirp();
|
|
@@ -11818,8 +11848,8 @@ var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11818
11848
|
const NodeFsHandler = require_nodefs_handler();
|
|
11819
11849
|
const FsEventsHandler = require_fsevents_handler();
|
|
11820
11850
|
const { EV_ALL, EV_READY, EV_ADD, EV_CHANGE, EV_UNLINK, EV_ADD_DIR, EV_UNLINK_DIR, EV_RAW, EV_ERROR, STR_CLOSE, STR_END, BACK_SLASH_RE, DOUBLE_SLASH_RE, SLASH_OR_BACK_SLASH_RE, DOT_RE, REPLACER_RE, SLASH, SLASH_SLASH, BRACE_START, BANG, ONE_DOT, TWO_DOTS, GLOBSTAR, SLASH_GLOBSTAR, ANYMATCH_OPTS, STRING_TYPE, FUNCTION_TYPE, EMPTY_STR, EMPTY_FN, isWindows, isMacos, isIBMi } = require_constants$1();
|
|
11821
|
-
const stat = promisify$1(fs$
|
|
11822
|
-
const readdir = promisify$1(fs$
|
|
11851
|
+
const stat = promisify$1(fs$3.stat);
|
|
11852
|
+
const readdir = promisify$1(fs$3.readdir);
|
|
11823
11853
|
/**
|
|
11824
11854
|
* @typedef {String} Path
|
|
11825
11855
|
* @typedef {'all'|'add'|'addDir'|'change'|'unlink'|'unlinkDir'|'raw'|'error'|'ready'} EventName
|
|
@@ -12307,7 +12337,7 @@ var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12307
12337
|
if (this.options.cwd && !sysPath.isAbsolute(path)) fullPath = sysPath.join(this.options.cwd, path);
|
|
12308
12338
|
const now = /* @__PURE__ */ new Date();
|
|
12309
12339
|
const awaitWriteFinish = (prevStat) => {
|
|
12310
|
-
fs$
|
|
12340
|
+
fs$3.stat(fullPath, (err, curStat) => {
|
|
12311
12341
|
if (err || !this._pendingWrites.has(path)) {
|
|
12312
12342
|
if (err && err.code !== "ENOENT") awfEmit(err);
|
|
12313
12343
|
return;
|
|
@@ -13861,7 +13891,7 @@ var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13861
13891
|
}));
|
|
13862
13892
|
//#endregion
|
|
13863
13893
|
//#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/parse.js
|
|
13864
|
-
var require_parse
|
|
13894
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
13865
13895
|
var CONTROL = "(?:" + [
|
|
13866
13896
|
"\\|\\|",
|
|
13867
13897
|
"\\&\\&",
|
|
@@ -14003,7 +14033,7 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14003
14033
|
//#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/index.js
|
|
14004
14034
|
var require_shell_quote = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
14005
14035
|
exports.quote = require_quote();
|
|
14006
|
-
exports.parse = require_parse
|
|
14036
|
+
exports.parse = require_parse();
|
|
14007
14037
|
}));
|
|
14008
14038
|
//#endregion
|
|
14009
14039
|
//#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/macos.js
|
|
@@ -14076,7 +14106,7 @@ var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14076
14106
|
}));
|
|
14077
14107
|
//#endregion
|
|
14078
14108
|
//#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/windows.js
|
|
14079
|
-
var require_windows
|
|
14109
|
+
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14080
14110
|
module.exports = [
|
|
14081
14111
|
"Brackets.exe",
|
|
14082
14112
|
"Code.exe",
|
|
@@ -14110,12 +14140,12 @@ var require_windows$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14110
14140
|
//#endregion
|
|
14111
14141
|
//#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/guess.js
|
|
14112
14142
|
var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14113
|
-
const path$
|
|
14143
|
+
const path$5 = __require("path");
|
|
14114
14144
|
const shellQuote = require_shell_quote();
|
|
14115
14145
|
const childProcess$2 = __require("child_process");
|
|
14116
14146
|
const COMMON_EDITORS_MACOS = require_macos();
|
|
14117
14147
|
const COMMON_EDITORS_LINUX = require_linux();
|
|
14118
|
-
const COMMON_EDITORS_WIN = require_windows
|
|
14148
|
+
const COMMON_EDITORS_WIN = require_windows();
|
|
14119
14149
|
function getEditorFromMacProcesses(output) {
|
|
14120
14150
|
const processNames = Object.keys(COMMON_EDITORS_MACOS);
|
|
14121
14151
|
const processList = output.split("\n");
|
|
@@ -14134,7 +14164,7 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14134
14164
|
const runningProcesses = output.split("\r\n");
|
|
14135
14165
|
for (let i = 0; i < runningProcesses.length; i++) {
|
|
14136
14166
|
const fullProcessPath = runningProcesses[i].trim();
|
|
14137
|
-
const shortProcessName = path$
|
|
14167
|
+
const shortProcessName = path$5.win32.basename(fullProcessPath);
|
|
14138
14168
|
if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) return fullProcessPath;
|
|
14139
14169
|
}
|
|
14140
14170
|
}
|
|
@@ -14185,9 +14215,9 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14185
14215
|
//#endregion
|
|
14186
14216
|
//#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/get-args.js
|
|
14187
14217
|
var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14188
|
-
const path$
|
|
14218
|
+
const path$4 = __require("path");
|
|
14189
14219
|
module.exports = function getArgumentsForPosition(editor, fileName, lineNumber, columnNumber = 1) {
|
|
14190
|
-
switch (path$
|
|
14220
|
+
switch (path$4.basename(editor).replace(/\.(exe|cmd|bat)$/i, "")) {
|
|
14191
14221
|
case "atom":
|
|
14192
14222
|
case "Atom":
|
|
14193
14223
|
case "Atom Beta":
|
|
@@ -14273,9 +14303,9 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
14273
14303
|
*
|
|
14274
14304
|
* Modified by Yuxi Evan You
|
|
14275
14305
|
*/
|
|
14276
|
-
const fs$
|
|
14306
|
+
const fs$2 = __require("fs");
|
|
14277
14307
|
const os$1 = __require("os");
|
|
14278
|
-
const path$
|
|
14308
|
+
const path$3 = __require("path");
|
|
14279
14309
|
const colors = require_picocolors();
|
|
14280
14310
|
const childProcess$1 = __require("child_process");
|
|
14281
14311
|
const guessEditor = require_guess();
|
|
@@ -14283,7 +14313,7 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
14283
14313
|
function wrapErrorCallback(cb) {
|
|
14284
14314
|
return (fileName, errorMessage) => {
|
|
14285
14315
|
console.log();
|
|
14286
|
-
console.log(colors.red("Could not open " + path$
|
|
14316
|
+
console.log(colors.red("Could not open " + path$3.basename(fileName) + " in the editor."));
|
|
14287
14317
|
if (errorMessage) {
|
|
14288
14318
|
if (errorMessage[errorMessage.length - 1] !== ".") errorMessage += ".";
|
|
14289
14319
|
console.log(colors.red("The editor process exited with an error: " + errorMessage));
|
|
@@ -14316,8 +14346,8 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
14316
14346
|
const parsed = parseFile(file);
|
|
14317
14347
|
let { fileName } = parsed;
|
|
14318
14348
|
const { lineNumber, columnNumber } = parsed;
|
|
14319
|
-
if (process.platform === "win32" && path$
|
|
14320
|
-
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;
|
|
14321
14351
|
if (typeof specifiedEditor === "function") {
|
|
14322
14352
|
onErrorCallback = specifiedEditor;
|
|
14323
14353
|
specifiedEditor = void 0;
|
|
@@ -14328,7 +14358,7 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
14328
14358
|
onErrorCallback(fileName, null);
|
|
14329
14359
|
return;
|
|
14330
14360
|
}
|
|
14331
|
-
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);
|
|
14332
14362
|
if (lineNumber) {
|
|
14333
14363
|
const extraArgs = getArgumentsForPosition(editor, fileName, lineNumber, columnNumber);
|
|
14334
14364
|
args.push.apply(args, extraArgs);
|
|
@@ -14364,7 +14394,7 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
14364
14394
|
//#endregion
|
|
14365
14395
|
//#region ../../node_modules/.pnpm/launch-editor-middleware@2.14.1/node_modules/launch-editor-middleware/index.js
|
|
14366
14396
|
var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14367
|
-
const path$
|
|
14397
|
+
const path$2 = __require("path");
|
|
14368
14398
|
const launch = require_launch_editor();
|
|
14369
14399
|
module.exports = (specifiedEditor, srcRoot, onErrorCallback) => {
|
|
14370
14400
|
if (typeof specifiedEditor === "function") {
|
|
@@ -14391,7 +14421,7 @@ var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports,
|
|
|
14391
14421
|
res.statusCode = 500;
|
|
14392
14422
|
res.end(`launch-editor-middleware: required query param "file" is missing.`);
|
|
14393
14423
|
} else {
|
|
14394
|
-
const resolved = file.startsWith("file://") ? file : path$
|
|
14424
|
+
const resolved = file.startsWith("file://") ? file : path$2.resolve(srcRoot, file);
|
|
14395
14425
|
launch(resolved, specifiedEditor, onErrorCallback);
|
|
14396
14426
|
res.end();
|
|
14397
14427
|
}
|
|
@@ -14647,408 +14677,6 @@ function printServerUrls(urls, optionsHost, info) {
|
|
|
14647
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"));
|
|
14648
14678
|
}
|
|
14649
14679
|
//#endregion
|
|
14650
|
-
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
14651
|
-
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14652
|
-
module.exports = isexe;
|
|
14653
|
-
isexe.sync = sync;
|
|
14654
|
-
var fs$4 = __require("fs");
|
|
14655
|
-
function checkPathExt(path, options) {
|
|
14656
|
-
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
14657
|
-
if (!pathext) return true;
|
|
14658
|
-
pathext = pathext.split(";");
|
|
14659
|
-
if (pathext.indexOf("") !== -1) return true;
|
|
14660
|
-
for (var i = 0; i < pathext.length; i++) {
|
|
14661
|
-
var p = pathext[i].toLowerCase();
|
|
14662
|
-
if (p && path.substr(-p.length).toLowerCase() === p) return true;
|
|
14663
|
-
}
|
|
14664
|
-
return false;
|
|
14665
|
-
}
|
|
14666
|
-
function checkStat(stat, path, options) {
|
|
14667
|
-
if (!stat.isSymbolicLink() && !stat.isFile()) return false;
|
|
14668
|
-
return checkPathExt(path, options);
|
|
14669
|
-
}
|
|
14670
|
-
function isexe(path, options, cb) {
|
|
14671
|
-
fs$4.stat(path, function(er, stat) {
|
|
14672
|
-
cb(er, er ? false : checkStat(stat, path, options));
|
|
14673
|
-
});
|
|
14674
|
-
}
|
|
14675
|
-
function sync(path, options) {
|
|
14676
|
-
return checkStat(fs$4.statSync(path), path, options);
|
|
14677
|
-
}
|
|
14678
|
-
}));
|
|
14679
|
-
//#endregion
|
|
14680
|
-
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
|
|
14681
|
-
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14682
|
-
module.exports = isexe;
|
|
14683
|
-
isexe.sync = sync;
|
|
14684
|
-
var fs$3 = __require("fs");
|
|
14685
|
-
function isexe(path, options, cb) {
|
|
14686
|
-
fs$3.stat(path, function(er, stat) {
|
|
14687
|
-
cb(er, er ? false : checkStat(stat, options));
|
|
14688
|
-
});
|
|
14689
|
-
}
|
|
14690
|
-
function sync(path, options) {
|
|
14691
|
-
return checkStat(fs$3.statSync(path), options);
|
|
14692
|
-
}
|
|
14693
|
-
function checkStat(stat, options) {
|
|
14694
|
-
return stat.isFile() && checkMode(stat, options);
|
|
14695
|
-
}
|
|
14696
|
-
function checkMode(stat, options) {
|
|
14697
|
-
var mod = stat.mode;
|
|
14698
|
-
var uid = stat.uid;
|
|
14699
|
-
var gid = stat.gid;
|
|
14700
|
-
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
14701
|
-
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
14702
|
-
var u = parseInt("100", 8);
|
|
14703
|
-
var g = parseInt("010", 8);
|
|
14704
|
-
var o = parseInt("001", 8);
|
|
14705
|
-
var ug = u | g;
|
|
14706
|
-
return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
14707
|
-
}
|
|
14708
|
-
}));
|
|
14709
|
-
//#endregion
|
|
14710
|
-
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
14711
|
-
var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14712
|
-
__require("fs");
|
|
14713
|
-
var core;
|
|
14714
|
-
if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
|
|
14715
|
-
else core = require_mode();
|
|
14716
|
-
module.exports = isexe;
|
|
14717
|
-
isexe.sync = sync;
|
|
14718
|
-
function isexe(path, options, cb) {
|
|
14719
|
-
if (typeof options === "function") {
|
|
14720
|
-
cb = options;
|
|
14721
|
-
options = {};
|
|
14722
|
-
}
|
|
14723
|
-
if (!cb) {
|
|
14724
|
-
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
14725
|
-
return new Promise(function(resolve, reject) {
|
|
14726
|
-
isexe(path, options || {}, function(er, is) {
|
|
14727
|
-
if (er) reject(er);
|
|
14728
|
-
else resolve(is);
|
|
14729
|
-
});
|
|
14730
|
-
});
|
|
14731
|
-
}
|
|
14732
|
-
core(path, options || {}, function(er, is) {
|
|
14733
|
-
if (er) {
|
|
14734
|
-
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
14735
|
-
er = null;
|
|
14736
|
-
is = false;
|
|
14737
|
-
}
|
|
14738
|
-
}
|
|
14739
|
-
cb(er, is);
|
|
14740
|
-
});
|
|
14741
|
-
}
|
|
14742
|
-
function sync(path, options) {
|
|
14743
|
-
try {
|
|
14744
|
-
return core.sync(path, options || {});
|
|
14745
|
-
} catch (er) {
|
|
14746
|
-
if (options && options.ignoreErrors || er.code === "EACCES") return false;
|
|
14747
|
-
else throw er;
|
|
14748
|
-
}
|
|
14749
|
-
}
|
|
14750
|
-
}));
|
|
14751
|
-
//#endregion
|
|
14752
|
-
//#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
14753
|
-
var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14754
|
-
const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
14755
|
-
const path$4 = __require("path");
|
|
14756
|
-
const COLON = isWindows ? ";" : ":";
|
|
14757
|
-
const isexe = require_isexe();
|
|
14758
|
-
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
14759
|
-
const getPathInfo = (cmd, opt) => {
|
|
14760
|
-
const colon = opt.colon || COLON;
|
|
14761
|
-
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
14762
|
-
/* istanbul ignore next: very unusual */ "").split(colon)];
|
|
14763
|
-
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
14764
|
-
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
14765
|
-
if (isWindows) {
|
|
14766
|
-
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
|
|
14767
|
-
}
|
|
14768
|
-
return {
|
|
14769
|
-
pathEnv,
|
|
14770
|
-
pathExt,
|
|
14771
|
-
pathExtExe
|
|
14772
|
-
};
|
|
14773
|
-
};
|
|
14774
|
-
const which = (cmd, opt, cb) => {
|
|
14775
|
-
if (typeof opt === "function") {
|
|
14776
|
-
cb = opt;
|
|
14777
|
-
opt = {};
|
|
14778
|
-
}
|
|
14779
|
-
if (!opt) opt = {};
|
|
14780
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
14781
|
-
const found = [];
|
|
14782
|
-
const step = (i) => new Promise((resolve, reject) => {
|
|
14783
|
-
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
14784
|
-
const ppRaw = pathEnv[i];
|
|
14785
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
14786
|
-
const pCmd = path$4.join(pathPart, cmd);
|
|
14787
|
-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
14788
|
-
resolve(subStep(p, i, 0));
|
|
14789
|
-
});
|
|
14790
|
-
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
|
14791
|
-
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
14792
|
-
const ext = pathExt[ii];
|
|
14793
|
-
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
14794
|
-
if (!er && is) {
|
|
14795
|
-
if (opt.all) found.push(p + ext);
|
|
14796
|
-
else return resolve(p + ext);
|
|
14797
|
-
}
|
|
14798
|
-
return resolve(subStep(p, i, ii + 1));
|
|
14799
|
-
});
|
|
14800
|
-
});
|
|
14801
|
-
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
14802
|
-
};
|
|
14803
|
-
const whichSync = (cmd, opt) => {
|
|
14804
|
-
opt = opt || {};
|
|
14805
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
14806
|
-
const found = [];
|
|
14807
|
-
for (let i = 0; i < pathEnv.length; i++) {
|
|
14808
|
-
const ppRaw = pathEnv[i];
|
|
14809
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
14810
|
-
const pCmd = path$4.join(pathPart, cmd);
|
|
14811
|
-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
14812
|
-
for (let j = 0; j < pathExt.length; j++) {
|
|
14813
|
-
const cur = p + pathExt[j];
|
|
14814
|
-
try {
|
|
14815
|
-
if (isexe.sync(cur, { pathExt: pathExtExe })) {
|
|
14816
|
-
if (opt.all) found.push(cur);
|
|
14817
|
-
else return cur;
|
|
14818
|
-
}
|
|
14819
|
-
} catch (ex) {}
|
|
14820
|
-
}
|
|
14821
|
-
}
|
|
14822
|
-
if (opt.all && found.length) return found;
|
|
14823
|
-
if (opt.nothrow) return null;
|
|
14824
|
-
throw getNotFoundError(cmd);
|
|
14825
|
-
};
|
|
14826
|
-
module.exports = which;
|
|
14827
|
-
which.sync = whichSync;
|
|
14828
|
-
}));
|
|
14829
|
-
//#endregion
|
|
14830
|
-
//#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
14831
|
-
var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14832
|
-
const pathKey = (options = {}) => {
|
|
14833
|
-
const environment = options.env || process.env;
|
|
14834
|
-
if ((options.platform || process.platform) !== "win32") return "PATH";
|
|
14835
|
-
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
14836
|
-
};
|
|
14837
|
-
module.exports = pathKey;
|
|
14838
|
-
module.exports.default = pathKey;
|
|
14839
|
-
}));
|
|
14840
|
-
//#endregion
|
|
14841
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
14842
|
-
var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14843
|
-
const path$3 = __require("path");
|
|
14844
|
-
const which = require_which();
|
|
14845
|
-
const getPathKey = require_path_key();
|
|
14846
|
-
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
14847
|
-
const env = parsed.options.env || process.env;
|
|
14848
|
-
const cwd = process.cwd();
|
|
14849
|
-
const hasCustomCwd = parsed.options.cwd != null;
|
|
14850
|
-
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
14851
|
-
if (shouldSwitchCwd) try {
|
|
14852
|
-
process.chdir(parsed.options.cwd);
|
|
14853
|
-
} catch (err) {}
|
|
14854
|
-
let resolved;
|
|
14855
|
-
try {
|
|
14856
|
-
resolved = which.sync(parsed.command, {
|
|
14857
|
-
path: env[getPathKey({ env })],
|
|
14858
|
-
pathExt: withoutPathExt ? path$3.delimiter : void 0
|
|
14859
|
-
});
|
|
14860
|
-
} catch (e) {} finally {
|
|
14861
|
-
if (shouldSwitchCwd) process.chdir(cwd);
|
|
14862
|
-
}
|
|
14863
|
-
if (resolved) resolved = path$3.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
14864
|
-
return resolved;
|
|
14865
|
-
}
|
|
14866
|
-
function resolveCommand(parsed) {
|
|
14867
|
-
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
14868
|
-
}
|
|
14869
|
-
module.exports = resolveCommand;
|
|
14870
|
-
}));
|
|
14871
|
-
//#endregion
|
|
14872
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
|
|
14873
|
-
var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14874
|
-
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
14875
|
-
function escapeCommand(arg) {
|
|
14876
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
14877
|
-
return arg;
|
|
14878
|
-
}
|
|
14879
|
-
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
14880
|
-
arg = `${arg}`;
|
|
14881
|
-
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
14882
|
-
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
14883
|
-
arg = `"${arg}"`;
|
|
14884
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
14885
|
-
if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
|
|
14886
|
-
return arg;
|
|
14887
|
-
}
|
|
14888
|
-
module.exports.command = escapeCommand;
|
|
14889
|
-
module.exports.argument = escapeArgument;
|
|
14890
|
-
}));
|
|
14891
|
-
//#endregion
|
|
14892
|
-
//#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
|
|
14893
|
-
var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14894
|
-
module.exports = /^#!(.*)/;
|
|
14895
|
-
}));
|
|
14896
|
-
//#endregion
|
|
14897
|
-
//#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
|
|
14898
|
-
var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14899
|
-
const shebangRegex = require_shebang_regex();
|
|
14900
|
-
module.exports = (string = "") => {
|
|
14901
|
-
const match = string.match(shebangRegex);
|
|
14902
|
-
if (!match) return null;
|
|
14903
|
-
const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
14904
|
-
const binary = path.split("/").pop();
|
|
14905
|
-
if (binary === "env") return argument;
|
|
14906
|
-
return argument ? `${binary} ${argument}` : binary;
|
|
14907
|
-
};
|
|
14908
|
-
}));
|
|
14909
|
-
//#endregion
|
|
14910
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
14911
|
-
var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14912
|
-
const fs$2 = __require("fs");
|
|
14913
|
-
const shebangCommand = require_shebang_command();
|
|
14914
|
-
function readShebang(command) {
|
|
14915
|
-
const size = 150;
|
|
14916
|
-
const buffer = Buffer.alloc(size);
|
|
14917
|
-
let fd;
|
|
14918
|
-
try {
|
|
14919
|
-
fd = fs$2.openSync(command, "r");
|
|
14920
|
-
fs$2.readSync(fd, buffer, 0, size, 0);
|
|
14921
|
-
fs$2.closeSync(fd);
|
|
14922
|
-
} catch (e) {}
|
|
14923
|
-
return shebangCommand(buffer.toString());
|
|
14924
|
-
}
|
|
14925
|
-
module.exports = readShebang;
|
|
14926
|
-
}));
|
|
14927
|
-
//#endregion
|
|
14928
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
14929
|
-
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14930
|
-
const path$2 = __require("path");
|
|
14931
|
-
const resolveCommand = require_resolveCommand();
|
|
14932
|
-
const escape = require_escape();
|
|
14933
|
-
const readShebang = require_readShebang();
|
|
14934
|
-
const isWin = process.platform === "win32";
|
|
14935
|
-
const isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
14936
|
-
const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
14937
|
-
function detectShebang(parsed) {
|
|
14938
|
-
parsed.file = resolveCommand(parsed);
|
|
14939
|
-
const shebang = parsed.file && readShebang(parsed.file);
|
|
14940
|
-
if (shebang) {
|
|
14941
|
-
parsed.args.unshift(parsed.file);
|
|
14942
|
-
parsed.command = shebang;
|
|
14943
|
-
return resolveCommand(parsed);
|
|
14944
|
-
}
|
|
14945
|
-
return parsed.file;
|
|
14946
|
-
}
|
|
14947
|
-
function parseNonShell(parsed) {
|
|
14948
|
-
if (!isWin) return parsed;
|
|
14949
|
-
const commandFile = detectShebang(parsed);
|
|
14950
|
-
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
14951
|
-
if (parsed.options.forceShell || needsShell) {
|
|
14952
|
-
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
14953
|
-
parsed.command = path$2.normalize(parsed.command);
|
|
14954
|
-
parsed.command = escape.command(parsed.command);
|
|
14955
|
-
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
14956
|
-
parsed.args = [
|
|
14957
|
-
"/d",
|
|
14958
|
-
"/s",
|
|
14959
|
-
"/c",
|
|
14960
|
-
`"${[parsed.command].concat(parsed.args).join(" ")}"`
|
|
14961
|
-
];
|
|
14962
|
-
parsed.command = process.env.comspec || "cmd.exe";
|
|
14963
|
-
parsed.options.windowsVerbatimArguments = true;
|
|
14964
|
-
}
|
|
14965
|
-
return parsed;
|
|
14966
|
-
}
|
|
14967
|
-
function parse(command, args, options) {
|
|
14968
|
-
if (args && !Array.isArray(args)) {
|
|
14969
|
-
options = args;
|
|
14970
|
-
args = null;
|
|
14971
|
-
}
|
|
14972
|
-
args = args ? args.slice(0) : [];
|
|
14973
|
-
options = Object.assign({}, options);
|
|
14974
|
-
const parsed = {
|
|
14975
|
-
command,
|
|
14976
|
-
args,
|
|
14977
|
-
options,
|
|
14978
|
-
file: void 0,
|
|
14979
|
-
original: {
|
|
14980
|
-
command,
|
|
14981
|
-
args
|
|
14982
|
-
}
|
|
14983
|
-
};
|
|
14984
|
-
return options.shell ? parsed : parseNonShell(parsed);
|
|
14985
|
-
}
|
|
14986
|
-
module.exports = parse;
|
|
14987
|
-
}));
|
|
14988
|
-
//#endregion
|
|
14989
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
|
|
14990
|
-
var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14991
|
-
const isWin = process.platform === "win32";
|
|
14992
|
-
function notFoundError(original, syscall) {
|
|
14993
|
-
return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
|
|
14994
|
-
code: "ENOENT",
|
|
14995
|
-
errno: "ENOENT",
|
|
14996
|
-
syscall: `${syscall} ${original.command}`,
|
|
14997
|
-
path: original.command,
|
|
14998
|
-
spawnargs: original.args
|
|
14999
|
-
});
|
|
15000
|
-
}
|
|
15001
|
-
function hookChildProcess(cp, parsed) {
|
|
15002
|
-
if (!isWin) return;
|
|
15003
|
-
const originalEmit = cp.emit;
|
|
15004
|
-
cp.emit = function(name, arg1) {
|
|
15005
|
-
if (name === "exit") {
|
|
15006
|
-
const err = verifyENOENT(arg1, parsed);
|
|
15007
|
-
if (err) return originalEmit.call(cp, "error", err);
|
|
15008
|
-
}
|
|
15009
|
-
return originalEmit.apply(cp, arguments);
|
|
15010
|
-
};
|
|
15011
|
-
}
|
|
15012
|
-
function verifyENOENT(status, parsed) {
|
|
15013
|
-
if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
|
|
15014
|
-
return null;
|
|
15015
|
-
}
|
|
15016
|
-
function verifyENOENTSync(status, parsed) {
|
|
15017
|
-
if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
|
|
15018
|
-
return null;
|
|
15019
|
-
}
|
|
15020
|
-
module.exports = {
|
|
15021
|
-
hookChildProcess,
|
|
15022
|
-
verifyENOENT,
|
|
15023
|
-
verifyENOENTSync,
|
|
15024
|
-
notFoundError
|
|
15025
|
-
};
|
|
15026
|
-
}));
|
|
15027
|
-
//#endregion
|
|
15028
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
|
|
15029
|
-
var require_cross_spawn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15030
|
-
const cp = __require("child_process");
|
|
15031
|
-
const parse = require_parse();
|
|
15032
|
-
const enoent = require_enoent();
|
|
15033
|
-
function spawn(command, args, options) {
|
|
15034
|
-
const parsed = parse(command, args, options);
|
|
15035
|
-
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
15036
|
-
enoent.hookChildProcess(spawned, parsed);
|
|
15037
|
-
return spawned;
|
|
15038
|
-
}
|
|
15039
|
-
function spawnSync(command, args, options) {
|
|
15040
|
-
const parsed = parse(command, args, options);
|
|
15041
|
-
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
15042
|
-
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
15043
|
-
return result;
|
|
15044
|
-
}
|
|
15045
|
-
module.exports = spawn;
|
|
15046
|
-
module.exports.spawn = spawn;
|
|
15047
|
-
module.exports.sync = spawnSync;
|
|
15048
|
-
module.exports._parse = parse;
|
|
15049
|
-
module.exports._enoent = enoent;
|
|
15050
|
-
}));
|
|
15051
|
-
//#endregion
|
|
15052
14680
|
//#region ../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
|
|
15053
14681
|
let isDockerCached;
|
|
15054
14682
|
function hasDockerEnv() {
|
|
@@ -15505,6 +15133,347 @@ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
|
15505
15133
|
defineLazyProperty(apps, "browser", () => "browser");
|
|
15506
15134
|
defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
|
|
15507
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
|
|
15508
15477
|
//#region src/node/server/openBrowser.ts
|
|
15509
15478
|
/**
|
|
15510
15479
|
* The following is modified based on source found in
|
|
@@ -15515,7 +15484,6 @@ defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
|
|
|
15515
15484
|
* https://github.com/react/create-react-app/blob/main/LICENSE
|
|
15516
15485
|
*
|
|
15517
15486
|
*/
|
|
15518
|
-
var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
|
|
15519
15487
|
/**
|
|
15520
15488
|
* Reads the BROWSER environment variable and decides what to do with it.
|
|
15521
15489
|
*/
|
|
@@ -15526,12 +15494,12 @@ function openBrowser(url, opt, logger) {
|
|
|
15526
15494
|
}
|
|
15527
15495
|
function executeNodeScript(scriptPath, url, logger) {
|
|
15528
15496
|
const extraArgs = process.argv.slice(2);
|
|
15529
|
-
(
|
|
15497
|
+
x(process.execPath, [
|
|
15530
15498
|
scriptPath,
|
|
15531
15499
|
...extraArgs,
|
|
15532
15500
|
url
|
|
15533
|
-
], { stdio: "inherit" }).
|
|
15534
|
-
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 });
|
|
15535
15503
|
});
|
|
15536
15504
|
}
|
|
15537
15505
|
const supportedChromiumBrowsers = [
|
|
@@ -15770,8 +15738,9 @@ function ssrRewriteStacktrace(stack, moduleGraph) {
|
|
|
15770
15738
|
let alreadyRewritten = false;
|
|
15771
15739
|
return {
|
|
15772
15740
|
result: stack.split("\n").map((line) => {
|
|
15773
|
-
return line.replace(/^ {4}at (?:(\S.*?)\s\()?(.+?):(\d+)(?::(\d+))?\)?/, (input, varName,
|
|
15774
|
-
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);
|
|
15775
15744
|
const rawSourceMap = moduleGraph.getModuleById(id)?.transformResult?.map;
|
|
15776
15745
|
if (!rawSourceMap) return input;
|
|
15777
15746
|
const traced = new TraceMap(rawSourceMap);
|
|
@@ -16543,10 +16512,13 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
16543
16512
|
let map;
|
|
16544
16513
|
if (inMap?.mappings === "") map = inMap;
|
|
16545
16514
|
else {
|
|
16546
|
-
|
|
16547
|
-
|
|
16548
|
-
|
|
16549
|
-
|
|
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;
|
|
16550
16522
|
}
|
|
16551
16523
|
return {
|
|
16552
16524
|
code: s.toString(),
|
|
@@ -17166,9 +17138,26 @@ async function createClientConfigValueReplacer(config) {
|
|
|
17166
17138
|
const serverForwardConsoleReplacement = escapeReplacement(config.server.forwardConsole);
|
|
17167
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);
|
|
17168
17140
|
}
|
|
17141
|
+
const ROLLDOWN_DEV_RUNTIME_ENTRY = "rolldown/experimental/runtime";
|
|
17169
17142
|
async function getHmrImplementation(config) {
|
|
17170
17143
|
const content = fs.readFileSync(normalizedBundledDevClientEntry, "utf-8");
|
|
17171
|
-
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;
|
|
17172
17161
|
}
|
|
17173
17162
|
//#endregion
|
|
17174
17163
|
//#region ../../node_modules/.pnpm/convert-source-map@2.0.0/node_modules/convert-source-map/index.js
|
|
@@ -17554,7 +17543,7 @@ function totalist(dir, callback, pre = "") {
|
|
|
17554
17543
|
let i = 0, abs, stats;
|
|
17555
17544
|
for (; i < arr.length; i++) {
|
|
17556
17545
|
abs = join$1(dir, arr[i]);
|
|
17557
|
-
stats = statSync(abs);
|
|
17546
|
+
stats = statSync$1(abs);
|
|
17558
17547
|
stats.isDirectory() ? totalist(abs, callback, join$1(pre, arr[i])) : callback(join$1(pre, arr[i]), abs, stats);
|
|
17559
17548
|
}
|
|
17560
17549
|
}
|
|
@@ -17841,7 +17830,7 @@ function serveRawFsMiddleware(server) {
|
|
|
17841
17830
|
const pathname = decodeURIIfPossible(url.pathname);
|
|
17842
17831
|
if (pathname === void 0) return next();
|
|
17843
17832
|
let newPathname = pathname.slice(FS_PREFIX.length);
|
|
17844
|
-
if (isWindows) newPathname = newPathname.replace(/^[A-Z]:/i, "");
|
|
17833
|
+
if (isWindows$1) newPathname = newPathname.replace(/^[A-Z]:/i, "");
|
|
17845
17834
|
url.pathname = encodeURI(newPathname);
|
|
17846
17835
|
req.url = url.href.slice(url.origin.length);
|
|
17847
17836
|
try {
|
|
@@ -17885,8 +17874,8 @@ function looksLikeWindowsShortNamePath(filePath) {
|
|
|
17885
17874
|
function isFileLoadingAllowed(config, filePath) {
|
|
17886
17875
|
const { fs } = config.server;
|
|
17887
17876
|
if (!fs.strict) return true;
|
|
17888
|
-
if (isWindows && looksLikeWindowsShortNamePath(filePath)) return false;
|
|
17889
|
-
if ((isWindows && windowsDriveRE.test(filePath) ? filePath.slice(2) : filePath).includes(":")) return false;
|
|
17877
|
+
if (isWindows$1 && looksLikeWindowsShortNamePath(filePath)) return false;
|
|
17878
|
+
if ((isWindows$1 && windowsDriveRE.test(filePath) ? filePath.slice(2) : filePath).includes(":")) return false;
|
|
17890
17879
|
const filePathWithoutTrailingSlash = filePath.endsWith("/") ? filePath.slice(0, -1) : filePath;
|
|
17891
17880
|
if (config.fsDenyGlob(filePathWithoutTrailingSlash)) return false;
|
|
17892
17881
|
if (config.safeModulePaths.has(filePath)) return true;
|
|
@@ -19855,6 +19844,7 @@ function rejectInvalidRequestMiddleware() {
|
|
|
19855
19844
|
//#endregion
|
|
19856
19845
|
//#region src/node/server/middlewares/time.ts
|
|
19857
19846
|
const logTime = createDebugger("vite:time");
|
|
19847
|
+
const isTimeDebugEnabled = logTime !== void 0;
|
|
19858
19848
|
function timeMiddleware(root) {
|
|
19859
19849
|
return function viteTimeMiddleware(req, res, next) {
|
|
19860
19850
|
const start = performance$1.now();
|
|
@@ -20782,7 +20772,7 @@ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
|
|
20782
20772
|
return searchForWorkspaceRoot(dir, root);
|
|
20783
20773
|
}
|
|
20784
20774
|
//#endregion
|
|
20785
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
20775
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/constants.js
|
|
20786
20776
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20787
20777
|
const BINARY_TYPES = [
|
|
20788
20778
|
"nodebuffer",
|
|
@@ -20805,7 +20795,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20805
20795
|
};
|
|
20806
20796
|
}));
|
|
20807
20797
|
//#endregion
|
|
20808
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
20798
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/buffer-util.js
|
|
20809
20799
|
var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20810
20800
|
const { EMPTY_BUFFER } = require_constants();
|
|
20811
20801
|
const FastBuffer = Buffer[Symbol.species];
|
|
@@ -20905,7 +20895,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20905
20895
|
} catch (e) {}
|
|
20906
20896
|
}));
|
|
20907
20897
|
//#endregion
|
|
20908
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
20898
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/limiter.js
|
|
20909
20899
|
var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20910
20900
|
const kDone = Symbol("kDone");
|
|
20911
20901
|
const kRun = Symbol("kRun");
|
|
@@ -20956,7 +20946,7 @@ var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20956
20946
|
module.exports = Limiter;
|
|
20957
20947
|
}));
|
|
20958
20948
|
//#endregion
|
|
20959
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
20949
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/permessage-deflate.js
|
|
20960
20950
|
var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20961
20951
|
const zlib$1 = __require("zlib");
|
|
20962
20952
|
const bufferUtil = require_buffer_util();
|
|
@@ -21292,7 +21282,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
21292
21282
|
}
|
|
21293
21283
|
}));
|
|
21294
21284
|
//#endregion
|
|
21295
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
21285
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/validation.js
|
|
21296
21286
|
var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21297
21287
|
const { isUtf8 } = __require("buffer");
|
|
21298
21288
|
const { hasBlob } = require_constants();
|
|
@@ -21488,7 +21478,7 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21488
21478
|
} catch (e) {}
|
|
21489
21479
|
}));
|
|
21490
21480
|
//#endregion
|
|
21491
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
21481
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/receiver.js
|
|
21492
21482
|
var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21493
21483
|
const { Writable } = __require("stream");
|
|
21494
21484
|
const PerMessageDeflate = require_permessage_deflate();
|
|
@@ -21951,7 +21941,7 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21951
21941
|
module.exports = Receiver;
|
|
21952
21942
|
}));
|
|
21953
21943
|
//#endregion
|
|
21954
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
21944
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/sender.js
|
|
21955
21945
|
var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21956
21946
|
const { Duplex: Duplex$3 } = __require("stream");
|
|
21957
21947
|
const { randomFillSync } = __require("crypto");
|
|
@@ -22449,7 +22439,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
22449
22439
|
}
|
|
22450
22440
|
}));
|
|
22451
22441
|
//#endregion
|
|
22452
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
22442
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/event-target.js
|
|
22453
22443
|
var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
22454
22444
|
const { kForOnEventAttribute, kListener } = require_constants();
|
|
22455
22445
|
const kCode = Symbol("kCode");
|
|
@@ -22680,7 +22670,7 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
22680
22670
|
}
|
|
22681
22671
|
}));
|
|
22682
22672
|
//#endregion
|
|
22683
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
22673
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/extension.js
|
|
22684
22674
|
var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
22685
22675
|
const { tokenChars } = require_validation();
|
|
22686
22676
|
/**
|
|
@@ -22826,7 +22816,7 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
22826
22816
|
};
|
|
22827
22817
|
}));
|
|
22828
22818
|
//#endregion
|
|
22829
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
22819
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/websocket.js
|
|
22830
22820
|
var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
22831
22821
|
const EventEmitter$2 = __require("events");
|
|
22832
22822
|
const https = __require("https");
|
|
@@ -22886,11 +22876,16 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
22886
22876
|
this._bufferedAmount = 0;
|
|
22887
22877
|
this._isServer = false;
|
|
22888
22878
|
this._redirects = 0;
|
|
22889
|
-
if (protocols === void 0)
|
|
22890
|
-
|
|
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)) {
|
|
22891
22884
|
if (typeof protocols === "object" && protocols !== null) {
|
|
22892
22885
|
options = protocols;
|
|
22893
|
-
protocols = [];
|
|
22886
|
+
if (options.protocols === void 0) protocols = [];
|
|
22887
|
+
else if (Array.isArray(options.protocols)) protocols = options.protocols;
|
|
22888
|
+
else protocols = [options.protocols];
|
|
22894
22889
|
} else protocols = [protocols];
|
|
22895
22890
|
}
|
|
22896
22891
|
initAsClient(this, address, protocols, options);
|
|
@@ -23080,12 +23075,12 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
23080
23075
|
if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) this._socket.end();
|
|
23081
23076
|
return;
|
|
23082
23077
|
}
|
|
23083
|
-
this._readyState = WebSocket.CLOSING;
|
|
23084
23078
|
this._sender.close(code, data, !this._isServer, (err) => {
|
|
23085
23079
|
if (err) return;
|
|
23086
23080
|
this._closeFrameSent = true;
|
|
23087
23081
|
if (this._closeFrameReceived || this._receiver._writableState.errorEmitted) this._socket.end();
|
|
23088
23082
|
});
|
|
23083
|
+
this._readyState = WebSocket.CLOSING;
|
|
23089
23084
|
setCloseTimer(this);
|
|
23090
23085
|
}
|
|
23091
23086
|
/**
|
|
@@ -23368,6 +23363,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
23368
23363
|
socketPath: void 0,
|
|
23369
23364
|
hostname: void 0,
|
|
23370
23365
|
protocol: void 0,
|
|
23366
|
+
protocols: void 0,
|
|
23371
23367
|
timeout: void 0,
|
|
23372
23368
|
method: "GET",
|
|
23373
23369
|
host: void 0,
|
|
@@ -23819,7 +23815,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
23819
23815
|
}
|
|
23820
23816
|
}));
|
|
23821
23817
|
//#endregion
|
|
23822
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
23818
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/stream.js
|
|
23823
23819
|
var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
23824
23820
|
require_websocket();
|
|
23825
23821
|
const { Duplex: Duplex$1 } = __require("stream");
|
|
@@ -23935,7 +23931,7 @@ var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
23935
23931
|
module.exports = createWebSocketStream;
|
|
23936
23932
|
}));
|
|
23937
23933
|
//#endregion
|
|
23938
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
23934
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/subprotocol.js
|
|
23939
23935
|
var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
23940
23936
|
const { tokenChars } = require_validation();
|
|
23941
23937
|
/**
|
|
@@ -23974,7 +23970,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
23974
23970
|
module.exports = { parse };
|
|
23975
23971
|
}));
|
|
23976
23972
|
//#endregion
|
|
23977
|
-
//#region ../../node_modules/.pnpm/ws@8.
|
|
23973
|
+
//#region ../../node_modules/.pnpm/ws@8.22.0/node_modules/ws/lib/websocket-server.js
|
|
23978
23974
|
var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
23979
23975
|
const EventEmitter$1 = __require("events");
|
|
23980
23976
|
const http = __require("http");
|
|
@@ -24655,6 +24651,9 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
24655
24651
|
...getEnvFilesForMode(config.mode, config.envDir),
|
|
24656
24652
|
...publicDir && publicFiles ? [publicDir] : []
|
|
24657
24653
|
], resolvedWatchOptions)) : createNoopWatcher(resolvedWatchOptions);
|
|
24654
|
+
watcher.on("error", (error) => {
|
|
24655
|
+
config.logger.error(import_picocolors.default.red(`file watcher error: ${error.message}`));
|
|
24656
|
+
});
|
|
24658
24657
|
const environments = {};
|
|
24659
24658
|
await Promise.all(Object.entries(config.environments).map(async ([name, environmentOptions]) => {
|
|
24660
24659
|
const environment = await environmentOptions.dev.createEnvironment(name, config, { ws });
|
|
@@ -24664,6 +24663,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
24664
24663
|
previousInstance: options.previousEnvironments?.[environment.name]
|
|
24665
24664
|
});
|
|
24666
24665
|
}));
|
|
24666
|
+
options.previousEnvironments = void 0;
|
|
24667
24667
|
let moduleGraph = new ModuleGraph({
|
|
24668
24668
|
client: () => environments.client.moduleGraph,
|
|
24669
24669
|
ssr: () => environments.ssr.moduleGraph
|
|
@@ -24869,7 +24869,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
24869
24869
|
if (!middlewareMode && httpServer) httpServer.once("listening", () => {
|
|
24870
24870
|
serverConfig.port = httpServer.address().port;
|
|
24871
24871
|
});
|
|
24872
|
-
if (
|
|
24872
|
+
if (isTimeDebugEnabled) middlewares.use(timeMiddleware(root));
|
|
24873
24873
|
middlewares.use(rejectInvalidRequestMiddleware());
|
|
24874
24874
|
const { cors } = serverConfig;
|
|
24875
24875
|
if (cors !== false) middlewares.use((0, import_lib.default)(typeof cors === "boolean" ? {} : cors));
|
|
@@ -26714,6 +26714,9 @@ const preloadMethod = `__vitePreload`;
|
|
|
26714
26714
|
const preloadMarker = `__VITE_PRELOAD__`;
|
|
26715
26715
|
const preloadHelperId = "\0vite/preload-helper.js";
|
|
26716
26716
|
const preloadMarkerRE = new RegExp(preloadMarker, "g");
|
|
26717
|
+
function isCssPreloadUrl(url) {
|
|
26718
|
+
return url.pathname.endsWith(".css");
|
|
26719
|
+
}
|
|
26717
26720
|
function toRelativePath(filename, importer) {
|
|
26718
26721
|
const relPath = path.posix.relative(path.posix.dirname(importer), filename);
|
|
26719
26722
|
return relPath[0] === "." ? relPath : `./${relPath}`;
|
|
@@ -26759,7 +26762,7 @@ function detectScriptRel() {
|
|
|
26759
26762
|
function preload(baseModule, deps, importerUrl) {
|
|
26760
26763
|
let promise = Promise.resolve();
|
|
26761
26764
|
if (__VITE_IS_MODERN__ && deps && deps.length > 0) {
|
|
26762
|
-
|
|
26765
|
+
let preloadedHrefs;
|
|
26763
26766
|
const cspNonceMeta = document.querySelector("meta[property=csp-nonce]");
|
|
26764
26767
|
const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce");
|
|
26765
26768
|
function allSettled(promises) {
|
|
@@ -26772,28 +26775,37 @@ function preload(baseModule, deps, importerUrl) {
|
|
|
26772
26775
|
}))));
|
|
26773
26776
|
}
|
|
26774
26777
|
function importMetaResolve(specifier) {
|
|
26775
|
-
if (import.meta.resolve) return import.meta.resolve(specifier);
|
|
26778
|
+
if (import.meta.resolve) return new URL(import.meta.resolve(specifier));
|
|
26776
26779
|
return new URL(
|
|
26777
26780
|
specifier,
|
|
26778
26781
|
/** #__KEEP__ */
|
|
26779
26782
|
import.meta.url
|
|
26780
|
-
)
|
|
26781
|
-
}
|
|
26782
|
-
promise = allSettled(deps.map((
|
|
26783
|
-
|
|
26784
|
-
dep = importMetaResolve(
|
|
26785
|
-
if (dep in seen) return;
|
|
26786
|
-
seen[dep] = true;
|
|
26787
|
-
const isCss = dep
|
|
26788
|
-
|
|
26789
|
-
|
|
26790
|
-
|
|
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
|
+
}
|
|
26791
26802
|
}
|
|
26803
|
+
if ((isCss ? preloadedHrefs.styles : preloadedHrefs.all).has(dep.href)) return;
|
|
26792
26804
|
const link = document.createElement("link");
|
|
26793
26805
|
link.rel = isCss ? "stylesheet" : scriptRel;
|
|
26794
26806
|
if (!isCss) link.as = "script";
|
|
26795
26807
|
link.crossOrigin = "";
|
|
26796
|
-
link.href = dep;
|
|
26808
|
+
link.href = dep.href;
|
|
26797
26809
|
if (cspNonce) link.setAttribute("nonce", cspNonce);
|
|
26798
26810
|
document.head.appendChild(link);
|
|
26799
26811
|
if (isCss) return new Promise((res, rej) => {
|
|
@@ -26821,7 +26833,7 @@ function getPreloadCode(environment, renderBuiltUrlBoolean, isRelativeBase) {
|
|
|
26821
26833
|
const scriptRel = modulePreload && modulePreload.polyfill ? `'modulepreload'` : `/* @__PURE__ */ (${detectScriptRel.toString()})()`;
|
|
26822
26834
|
const assetsURL = renderBuiltUrlBoolean || isRelativeBase ? `function(dep, importerUrl) { return new URL(dep, importerUrl).href }` : `function(dep) { return ${JSON.stringify(environment.config.base)}+dep }`;
|
|
26823
26835
|
const preloadMethodCode = preload.toString().replaceAll("𝐢𝐦𝐩𝐨𝐫𝐭", "import");
|
|
26824
|
-
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}`;
|
|
26825
26837
|
}
|
|
26826
26838
|
/**
|
|
26827
26839
|
* Build only. During serve this is performed as part of ./importAnalysis.
|
|
@@ -27021,7 +27033,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
27021
27033
|
if (s.hasChanged()) {
|
|
27022
27034
|
chunk.code = s.toString();
|
|
27023
27035
|
if (buildSourcemap && chunk.map) {
|
|
27024
|
-
const nextMap = s.
|
|
27036
|
+
const nextMap = s.generateDecodedMap({
|
|
27025
27037
|
source: chunk.fileName,
|
|
27026
27038
|
hires: "boundary"
|
|
27027
27039
|
});
|
|
@@ -27234,6 +27246,7 @@ function rolldownDepPlugin(environment, qualified, external) {
|
|
|
27234
27246
|
return (kind.startsWith("require") ? _resolveRequire : _resolve)(environment, id, _importer);
|
|
27235
27247
|
};
|
|
27236
27248
|
const resolveResult = (id, resolved, kind) => {
|
|
27249
|
+
if (resolved === "__vite-browser-external") return { id: browserExternalId };
|
|
27237
27250
|
if (resolved.startsWith("__vite-browser-external")) return { id: browserExternalNamespace + id };
|
|
27238
27251
|
if (resolved.startsWith("__vite-optional-peer-dep")) return { id: optionalPeerDepNamespace + resolved };
|
|
27239
27252
|
if (allExternalTypesReg.test(resolved)) return resolveAssets(resolved, kind);
|
|
@@ -27263,7 +27276,7 @@ function rolldownDepPlugin(environment, qualified, external) {
|
|
|
27263
27276
|
const resolved = await resolve(id, importer, kind);
|
|
27264
27277
|
if (resolved) {
|
|
27265
27278
|
if (JS_TYPES_RE.test(resolved)) return {
|
|
27266
|
-
id: isWindows ? resolved.replaceAll("/", "\\") : resolved,
|
|
27279
|
+
id: isWindows$1 ? resolved.replaceAll("/", "\\") : resolved,
|
|
27267
27280
|
external: false
|
|
27268
27281
|
};
|
|
27269
27282
|
return resolveAssets(resolved, kind);
|
|
@@ -27303,8 +27316,13 @@ function rolldownDepPlugin(environment, qualified, external) {
|
|
|
27303
27316
|
}
|
|
27304
27317
|
},
|
|
27305
27318
|
load: {
|
|
27306
|
-
filter: { id: [
|
|
27319
|
+
filter: { id: [
|
|
27320
|
+
exactRegex(browserExternalId),
|
|
27321
|
+
prefixRegex(browserExternalNamespace),
|
|
27322
|
+
prefixRegex(optionalPeerDepNamespace)
|
|
27323
|
+
] },
|
|
27307
27324
|
handler(id) {
|
|
27325
|
+
if (id === "__vite-browser-external") return { code: "module.exports = {}" };
|
|
27308
27326
|
if (id.startsWith(browserExternalNamespace)) {
|
|
27309
27327
|
const path = id.slice(17);
|
|
27310
27328
|
if (isProduction) return { code: "module.exports = {}" };
|
|
@@ -27356,20 +27374,31 @@ function rolldownDepPlugin(environment, qualified, external) {
|
|
|
27356
27374
|
}];
|
|
27357
27375
|
}
|
|
27358
27376
|
const matchesEntireLine = (text) => `^${escapeRegex(text)}$`;
|
|
27359
|
-
function rolldownCjsExternalPlugin(externals, platform) {
|
|
27377
|
+
function rolldownCjsExternalPlugin(externals, platform, environment) {
|
|
27360
27378
|
if (platform === "node") return;
|
|
27361
27379
|
if (platform === "neutral") return;
|
|
27362
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
|
+
});
|
|
27363
27388
|
return {
|
|
27364
27389
|
name: "cjs-external",
|
|
27365
27390
|
resolveId: {
|
|
27366
27391
|
filter: { id: [prefixRegex(nonFacadePrefix), filter] },
|
|
27367
|
-
handler(id,
|
|
27392
|
+
async handler(id, importer, options) {
|
|
27368
27393
|
if (id.startsWith(nonFacadePrefix)) return {
|
|
27369
27394
|
id: id.slice(25),
|
|
27370
27395
|
external: "absolute"
|
|
27371
27396
|
};
|
|
27372
|
-
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
|
+
}
|
|
27373
27402
|
return {
|
|
27374
27403
|
id,
|
|
27375
27404
|
external: "absolute"
|
|
@@ -28323,7 +28352,7 @@ function runOptimizeDeps(environment, depsInfo) {
|
|
|
28323
28352
|
fs.writeFileSync(dataPath, stringifyDepsOptimizerMetadata(metadata, depsCacheDir));
|
|
28324
28353
|
const temporaryPath = depsCacheDir + getTempSuffix();
|
|
28325
28354
|
const depsCacheDirPresent = fs.existsSync(depsCacheDir);
|
|
28326
|
-
if (isWindows) {
|
|
28355
|
+
if (isWindows$1) {
|
|
28327
28356
|
if (depsCacheDirPresent) {
|
|
28328
28357
|
debug$4?.(import_picocolors.default.green(`renaming ${depsCacheDir} to ${temporaryPath}`));
|
|
28329
28358
|
await safeRename(depsCacheDir, temporaryPath);
|
|
@@ -28430,7 +28459,7 @@ async function prepareRolldownOptimizerRun(environment, depsInfo, processingCach
|
|
|
28430
28459
|
const exportsData = await (depsInfo[id].exportsData ?? extractExportsData(environment, src));
|
|
28431
28460
|
if (exportsData.jsxLoader) jsxLoader = true;
|
|
28432
28461
|
const flatId = flattenId(id);
|
|
28433
|
-
flatIdDeps[flatId] = isWindows ? src.replaceAll("/", "\\") : src;
|
|
28462
|
+
flatIdDeps[flatId] = isWindows$1 ? src.replaceAll("/", "\\") : src;
|
|
28434
28463
|
idToExports[id] = exportsData;
|
|
28435
28464
|
}));
|
|
28436
28465
|
if (optimizerContext.cancelled) return {
|
|
@@ -28444,7 +28473,7 @@ async function prepareRolldownOptimizerRun(environment, depsInfo, processingCach
|
|
|
28444
28473
|
const platform = optimizeDeps.rolldownOptions?.platform ?? (environment.config.consumer === "client" || environment.config.ssr.target === "webworker" ? "browser" : "node");
|
|
28445
28474
|
const external = [...optimizeDeps.exclude ?? []];
|
|
28446
28475
|
const plugins = await asyncFlatten(arraify(pluginsFromConfig));
|
|
28447
|
-
if (external.length) plugins.push(rolldownCjsExternalPlugin(external, platform));
|
|
28476
|
+
if (external.length) plugins.push(rolldownCjsExternalPlugin(external, platform, environment));
|
|
28448
28477
|
plugins.push(...rolldownDepPlugin(environment, flatIdDeps, external));
|
|
28449
28478
|
let canceled = false;
|
|
28450
28479
|
async function build() {
|
|
@@ -29784,8 +29813,8 @@ function cssPostPlugin(config) {
|
|
|
29784
29813
|
const relativePath = normalizePath(path.relative(cssAssetDirname, filename));
|
|
29785
29814
|
return relativePath[0] === "." ? relativePath : "./" + relativePath;
|
|
29786
29815
|
};
|
|
29787
|
-
chunkCSS = chunkCSS.replace(assetUrlRE, (_, fileHash) => {
|
|
29788
|
-
const filename = this.getFileName(fileHash);
|
|
29816
|
+
chunkCSS = chunkCSS.replace(assetUrlRE, (_, fileHash, urlId) => {
|
|
29817
|
+
const filename = this.getFileName(fileHash) + getAssetUrlPostfix(this.environment, urlId);
|
|
29789
29818
|
chunk.viteMetadata.importedAssets.add(cleanUrl(filename));
|
|
29790
29819
|
return encodeURIPath(toOutputFilePathInCss(filename, "asset", cssAssetName, "css", config, toRelative));
|
|
29791
29820
|
});
|
|
@@ -30091,7 +30120,7 @@ function createCSSResolvers(config) {
|
|
|
30091
30120
|
skipMainField: true
|
|
30092
30121
|
});
|
|
30093
30122
|
sassResolve = async (...args) => {
|
|
30094
|
-
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 });
|
|
30095
30124
|
return resolver(...args);
|
|
30096
30125
|
};
|
|
30097
30126
|
}
|
|
@@ -31612,7 +31641,7 @@ function buildHtmlPlugin(config) {
|
|
|
31612
31641
|
const processedEncodedUrl = await processSrcSet(attr.value, async ({ url }) => {
|
|
31613
31642
|
const decodedUrl = decodeURIIfPossible(url);
|
|
31614
31643
|
if (decodedUrl !== void 0 && !isExcludedUrl(decodedUrl)) {
|
|
31615
|
-
const result = await processAssetUrl(
|
|
31644
|
+
const result = await processAssetUrl(decodedUrl, getLinkShouldInline(node, attr.attributes));
|
|
31616
31645
|
return result !== decodedUrl ? encodeURIPath(result) : url;
|
|
31617
31646
|
}
|
|
31618
31647
|
return url;
|
|
@@ -31794,10 +31823,10 @@ function buildHtmlPlugin(config) {
|
|
|
31794
31823
|
bundle,
|
|
31795
31824
|
chunk
|
|
31796
31825
|
});
|
|
31797
|
-
result = result.replace(assetUrlRE, (_, fileHash) => {
|
|
31826
|
+
result = result.replace(assetUrlRE, (_, fileHash, urlId) => {
|
|
31798
31827
|
const file = this.getFileName(fileHash);
|
|
31799
31828
|
if (chunk) chunk.viteMetadata.importedAssets.add(cleanUrl(file));
|
|
31800
|
-
return encodeURIPath(toOutputAssetFilePath(file));
|
|
31829
|
+
return encodeURIPath(toOutputAssetFilePath(file)) + getAssetUrlPostfix(this.environment, urlId);
|
|
31801
31830
|
});
|
|
31802
31831
|
result = result.replace(publicAssetUrlRE, (_, fileHash) => {
|
|
31803
31832
|
const publicAssetPath = toOutputPublicAssetFilePath(getPublicAssetFilename(fileHash, config));
|
|
@@ -32128,7 +32157,7 @@ function getImportMap(bundle, options) {
|
|
|
32128
32157
|
}
|
|
32129
32158
|
//#endregion
|
|
32130
32159
|
//#region src/node/plugins/asset.ts
|
|
32131
|
-
const assetUrlRE = /__VITE_ASSET__([\w$]
|
|
32160
|
+
const assetUrlRE = /__VITE_ASSET__([\w$]{22})(?:_([a-f\d]{24}))?__/g;
|
|
32132
32161
|
const encodedHashPlaceholderRE = /!~%7B([\w$]{1,17})%7D~/g;
|
|
32133
32162
|
function unescapeHashPlaceholders(uri) {
|
|
32134
32163
|
return uri.replace(encodedHashPlaceholderRE, "!~{$1}~");
|
|
@@ -32159,10 +32188,10 @@ function renderAssetUrlInJS(pluginContext, chunk, opts, code) {
|
|
|
32159
32188
|
assetUrlRE.lastIndex = 0;
|
|
32160
32189
|
while (match = assetUrlRE.exec(code)) {
|
|
32161
32190
|
s ||= new MagicString(code);
|
|
32162
|
-
const [full, referenceId] = match;
|
|
32191
|
+
const [full, referenceId, urlId] = match;
|
|
32163
32192
|
const file = pluginContext.getFileName(referenceId);
|
|
32164
32193
|
chunk.viteMetadata.importedAssets.add(cleanUrl(file));
|
|
32165
|
-
const replacement = toOutputFilePathInJS(environment, file, "asset", chunk.fileName, "js", toRelativeRuntime);
|
|
32194
|
+
const replacement = toOutputFilePathInJS(environment, file + getAssetUrlPostfix(environment, urlId), "asset", chunk.fileName, "js", toRelativeRuntime);
|
|
32166
32195
|
const replacementString = typeof replacement === "string" ? JSON.stringify(encodeURIPath(replacement)).slice(1, -1) : `"+${replacement.runtime}+"`;
|
|
32167
32196
|
s.update(match.index, match.index + full.length, replacementString);
|
|
32168
32197
|
}
|
|
@@ -32236,7 +32265,7 @@ function assetPlugin(config) {
|
|
|
32236
32265
|
};
|
|
32237
32266
|
}
|
|
32238
32267
|
return {
|
|
32239
|
-
code: `export default ${formatBuiltAsset(resolved, "js")}`,
|
|
32268
|
+
code: `export default ${formatBuiltAsset(resolved, "js", addFileUrlMetadataForAsset(this.environment, resolved, "js"))}`,
|
|
32240
32269
|
moduleSideEffects: config.command === "build" && this.getModuleInfo(id)?.isEntry ? "no-treeshake" : false,
|
|
32241
32270
|
meta: config.command === "build" ? { "vite:asset": true } : void 0,
|
|
32242
32271
|
moduleType: "js"
|
|
@@ -32258,8 +32287,9 @@ function assetPlugin(config) {
|
|
|
32258
32287
|
}
|
|
32259
32288
|
files.add(cleanUrl(fileName));
|
|
32260
32289
|
const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(format, environment.config.isWorker);
|
|
32261
|
-
|
|
32262
|
-
|
|
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);
|
|
32263
32293
|
return typeof replacement === "string" ? JSON.stringify(unescapeHashPlaceholders(encodeURIPath(replacement))) : replacement.runtime;
|
|
32264
32294
|
},
|
|
32265
32295
|
renderChunk(code, chunk, opts) {
|
|
@@ -32356,7 +32386,17 @@ function isGitLfsPlaceholder(content) {
|
|
|
32356
32386
|
*/
|
|
32357
32387
|
async function fileToBuiltUrl(pluginContext, id, format, skipPublicCheck = false, forceInline, asFileUrl = false) {
|
|
32358
32388
|
const resolved = await resolveBuiltAsset(pluginContext, id, skipPublicCheck, forceInline);
|
|
32359
|
-
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
|
+
});
|
|
32360
32400
|
}
|
|
32361
32401
|
function addFileUrlMetadata(environment, metadata) {
|
|
32362
32402
|
let metadataMap = fileUrlMetadata.get(environment);
|
|
@@ -32371,14 +32411,14 @@ function addFileUrlMetadata(environment, metadata) {
|
|
|
32371
32411
|
metadataMap.set(urlId, metadata);
|
|
32372
32412
|
return urlId;
|
|
32373
32413
|
}
|
|
32414
|
+
function getAssetUrlPostfix(environment, urlId) {
|
|
32415
|
+
return urlId ? fileUrlMetadata.get(environment)?.get(urlId)?.postfix ?? "" : "";
|
|
32416
|
+
}
|
|
32374
32417
|
/** Format a resolved asset as either a JS expression or a plain-text string. */
|
|
32375
32418
|
function formatBuiltAsset(resolved, format, urlId) {
|
|
32376
32419
|
if (resolved.type === "reference") {
|
|
32377
|
-
if (format === "js") {
|
|
32378
|
-
|
|
32379
|
-
return resolved.postfix ? `${base} + ${JSON.stringify(resolved.postfix)}` : base;
|
|
32380
|
-
}
|
|
32381
|
-
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}` : ""}__`;
|
|
32382
32422
|
}
|
|
32383
32423
|
return format === "js" ? JSON.stringify(encodeURIPath(resolved.value)) : resolved.value;
|
|
32384
32424
|
}
|
|
@@ -32728,7 +32768,7 @@ function normalizeWindowsPath(input = "") {
|
|
|
32728
32768
|
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
32729
32769
|
}
|
|
32730
32770
|
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
32731
|
-
function cwd() {
|
|
32771
|
+
function cwd$1() {
|
|
32732
32772
|
if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
|
|
32733
32773
|
return "/";
|
|
32734
32774
|
}
|
|
@@ -32737,7 +32777,7 @@ const resolve$2 = function(...arguments_) {
|
|
|
32737
32777
|
let resolvedPath = "";
|
|
32738
32778
|
let resolvedAbsolute = false;
|
|
32739
32779
|
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
32740
|
-
const path = index >= 0 ? arguments_[index] : cwd();
|
|
32780
|
+
const path = index >= 0 ? arguments_[index] : cwd$1();
|
|
32741
32781
|
if (!path || path.length === 0) continue;
|
|
32742
32782
|
resolvedPath = `${path}/${resolvedPath}`;
|
|
32743
32783
|
resolvedAbsolute = isAbsolute$2(path);
|
|
@@ -34073,9 +34113,10 @@ function terserPlugin(config) {
|
|
|
34073
34113
|
return !!environment.config.build.minify;
|
|
34074
34114
|
},
|
|
34075
34115
|
async renderChunk(code, chunk, outputOptions) {
|
|
34076
|
-
const
|
|
34116
|
+
const minify = this.environment.config.build.minify;
|
|
34117
|
+
const usesOxcMinifier = (minify === true || minify === "oxc") && outputOptions.minify !== false;
|
|
34077
34118
|
const minifyLegacyWithTerser = this.environment.config.isOutputOptionsForLegacyChunks?.(outputOptions) && !usesOxcMinifier;
|
|
34078
|
-
if (
|
|
34119
|
+
if (minify !== "terser" && !minifyLegacyWithTerser) return null;
|
|
34079
34120
|
worker ||= makeWorker();
|
|
34080
34121
|
const terserPath = pathToFileURL(loadTerserPath(config.root)).href;
|
|
34081
34122
|
try {
|
|
@@ -34362,6 +34403,11 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
|
|
|
34362
34403
|
if (output.sourcemap) logger.warnOnce(import_picocolors.default.yellow("Vite does not support \"rolldownOptions.output.sourcemap\". Please use \"build.sourcemap\" instead."));
|
|
34363
34404
|
const format = output.format || "es";
|
|
34364
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;
|
|
34365
34411
|
return {
|
|
34366
34412
|
dir: outDir,
|
|
34367
34413
|
format,
|
|
@@ -34373,13 +34419,12 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
|
|
|
34373
34419
|
chunkFileNames: libOptions ? `[name]-[hash].${jsExt}` : path.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
|
|
34374
34420
|
assetFileNames: libOptions ? `[name].[ext]` : path.posix.join(options.assetsDir, `[name]-[hash].[ext]`),
|
|
34375
34421
|
codeSplitting: output.codeSplitting ?? (output.format === "umd" || output.format === "iife" || isSsrTargetWebworkerEnvironment && (typeof input === "string" || Object.keys(input).length === 1) ? false : void 0),
|
|
34376
|
-
minify: options.minify === "oxc" ? libOptions && (format === "es" || format === "esm") ? {
|
|
34377
|
-
compress: true,
|
|
34378
|
-
mangle: true,
|
|
34379
|
-
codegen: false
|
|
34380
|
-
} : true : options.minify === false ? "dce-only" : false,
|
|
34381
34422
|
topLevelVar: true,
|
|
34382
34423
|
...output,
|
|
34424
|
+
minify: output.minify === void 0 ? resolvedMinify : typeof output.minify === "object" && typeof resolvedMinify === "object" ? {
|
|
34425
|
+
...resolvedMinify,
|
|
34426
|
+
...output.minify
|
|
34427
|
+
} : output.minify,
|
|
34383
34428
|
comments: typeof output.comments === "boolean" ? output.comments : {
|
|
34384
34429
|
annotation: !options.minify || libOptions && (format === "es" || format === "esm"),
|
|
34385
34430
|
jsdoc: !options.minify,
|
|
@@ -35914,7 +35959,7 @@ function inlineSourceMap(mod, result, startOffset) {
|
|
|
35914
35959
|
...map,
|
|
35915
35960
|
mappings: ";".repeat(startOffset) + map.mappings
|
|
35916
35961
|
} : map;
|
|
35917
|
-
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`;
|
|
35918
35963
|
return result;
|
|
35919
35964
|
}
|
|
35920
35965
|
//#endregion
|
|
@@ -35948,7 +35993,8 @@ var MemoryFiles = class {
|
|
|
35948
35993
|
var BundledDev = class {
|
|
35949
35994
|
environment;
|
|
35950
35995
|
_devEngine;
|
|
35951
|
-
|
|
35996
|
+
/** the vite client and the rolldown runtime; set before the first build so `hasBuildOutput` can count them */
|
|
35997
|
+
staticFiles = /* @__PURE__ */ new Map();
|
|
35952
35998
|
initialBuildCompleted = false;
|
|
35953
35999
|
_closed = false;
|
|
35954
36000
|
clients = new Clients();
|
|
@@ -35982,12 +36028,13 @@ var BundledDev = class {
|
|
|
35982
36028
|
}
|
|
35983
36029
|
pendingPayloadFilenames = /* @__PURE__ */ new Set();
|
|
35984
36030
|
get hasBuildOutput() {
|
|
35985
|
-
return this.memoryFiles.size >
|
|
36031
|
+
return this.memoryFiles.size > this.staticFiles.size;
|
|
35986
36032
|
}
|
|
35987
36033
|
async listen() {
|
|
35988
36034
|
this._closed = false;
|
|
35989
36035
|
debug$1?.("INITIAL: setup bundle options");
|
|
35990
36036
|
const rolldownOptions = await this.getRolldownOptions();
|
|
36037
|
+
await this.storeStaticFiles();
|
|
35991
36038
|
if (Array.isArray(rolldownOptions.output) && rolldownOptions.output.length > 1) throw new Error("multiple output options are not supported in dev mode");
|
|
35992
36039
|
const outputOptions = Array.isArray(rolldownOptions.output) ? rolldownOptions.output[0] : rolldownOptions.output;
|
|
35993
36040
|
this.environment.hot.on("vite:client-connected", async (payload, client) => {
|
|
@@ -36079,8 +36126,6 @@ var BundledDev = class {
|
|
|
36079
36126
|
}, (e) => {
|
|
36080
36127
|
debug$1?.("INITIAL: run error", e);
|
|
36081
36128
|
});
|
|
36082
|
-
this.viteRuntime = await getHmrImplementation(this.environment.getTopLevelConfig());
|
|
36083
|
-
this.storeOutputFiles([]);
|
|
36084
36129
|
this.waitForInitialBuildFinish().then(() => {
|
|
36085
36130
|
if (this._closed) return;
|
|
36086
36131
|
debug$1?.("INITIAL: build done");
|
|
@@ -36132,6 +36177,7 @@ var BundledDev = class {
|
|
|
36132
36177
|
debug$1?.(`TRIGGER-LAZY: trigger lazy bundling for module ${moduleId} for client ${clientId}`);
|
|
36133
36178
|
const result = await this.devEngine.compileEntry(moduleId, clientId);
|
|
36134
36179
|
this.pendingPayloadFilenames.add(result.filename);
|
|
36180
|
+
if (result.sourcemapFilename && result.sourcemap) this.memoryFiles.set(`@vite/${result.sourcemapFilename}`, { source: result.sourcemap });
|
|
36135
36181
|
return {
|
|
36136
36182
|
filename: result.filename,
|
|
36137
36183
|
code: result.code + payloadDeliveredAck(result.filename)
|
|
@@ -36154,11 +36200,19 @@ var BundledDev = class {
|
|
|
36154
36200
|
await this._devEngine?.close();
|
|
36155
36201
|
this.initialBuildCompleted = false;
|
|
36156
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
|
+
}
|
|
36157
36215
|
storeOutputFiles(output) {
|
|
36158
|
-
if (this.viteRuntime) this.memoryFiles.set(BUNDLED_DEV_CLIENT_FILENAME, {
|
|
36159
|
-
source: this.viteRuntime,
|
|
36160
|
-
etag: (0, import_etag.default)(Buffer.from(this.viteRuntime), { weak: true })
|
|
36161
|
-
});
|
|
36162
36216
|
for (const outputFile of output) this.memoryFiles.set(outputFile.fileName, () => {
|
|
36163
36217
|
const source = outputFile.type === "chunk" ? outputFile.code : outputFile.source;
|
|
36164
36218
|
return {
|