vite 5.1.5 → 5.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +6 -0
- package/dist/client/client.mjs +23 -22
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-WMYkPWs9.js → dep-6MdzGidO.js} +145 -145
- package/dist/node/chunks/{dep-G-px366b.js → dep-BxRAmRCV.js} +1153 -992
- package/dist/node/chunks/{dep-OHeF5w5D.js → dep-DeEXZBZL.js} +2 -2
- package/dist/node/cli.js +6 -6
- package/dist/node/index.d.ts +6 -5
- package/dist/node/index.js +3 -3
- package/dist/node/runtime.d.ts +2 -2
- package/dist/node/runtime.js +49 -43
- package/dist/node/{types.d-AKzkD8vd.d.ts → types.d-aGj9QkWt.d.ts} +19 -16
- package/dist/node-cjs/publicUtils.cjs +410 -407
- package/package.json +10 -9
- /package/dist/node/chunks/{dep-kjUoH5nk.js → dep-CrWVpuYf.js} +0 -0
- /package/dist/node/chunks/{dep-8a-6Quh6.js → dep-IQS-Za7F.js} +0 -0
@@ -13,6 +13,7 @@ import * as require$$0$2 from 'fs';
|
|
13
13
|
import require$$0__default, { existsSync, readFileSync, statSync as statSync$1, readdirSync } from 'fs';
|
14
14
|
import require$$0$5 from 'events';
|
15
15
|
import require$$5 from 'assert';
|
16
|
+
import { exec, execSync } from 'node:child_process';
|
16
17
|
import { createServer as createServer$3, STATUS_CODES, get as get$2 } from 'node:http';
|
17
18
|
import { createServer as createServer$2, get as get$1 } from 'node:https';
|
18
19
|
import require$$0$6 from 'util';
|
@@ -23,10 +24,9 @@ import require$$0$7 from 'stream';
|
|
23
24
|
import require$$2 from 'os';
|
24
25
|
import require$$2$1 from 'child_process';
|
25
26
|
import os$4 from 'node:os';
|
26
|
-
import { exec } from 'node:child_process';
|
27
27
|
import { createHash as createHash$2 } from 'node:crypto';
|
28
28
|
import { promises } from 'node:dns';
|
29
|
-
import require$$
|
29
|
+
import require$$3$1 from 'crypto';
|
30
30
|
import require$$0$8, { createRequire as createRequire$2 } from 'module';
|
31
31
|
import assert$1 from 'node:assert';
|
32
32
|
import v8 from 'node:v8';
|
@@ -36,11 +36,11 @@ import { EventEmitter as EventEmitter$4 } from 'node:events';
|
|
36
36
|
import { parseAst, parseAstAsync } from 'rollup/parseAst';
|
37
37
|
import * as qs from 'querystring';
|
38
38
|
import readline from 'node:readline';
|
39
|
-
import
|
40
|
-
import require$$0$
|
39
|
+
import zlib$1 from 'zlib';
|
40
|
+
import require$$0$a from 'buffer';
|
41
41
|
import require$$1$1 from 'https';
|
42
42
|
import require$$4$2 from 'tls';
|
43
|
-
import
|
43
|
+
import { gzip } from 'node:zlib';
|
44
44
|
|
45
45
|
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
46
46
|
import { dirname as __cjs_dirname } from 'node:path';
|
@@ -250,7 +250,6 @@ const NULL_BYTE_PLACEHOLDER = `__x00__`;
|
|
250
250
|
let SOURCEMAPPING_URL = 'sourceMa';
|
251
251
|
SOURCEMAPPING_URL += 'ppingURL';
|
252
252
|
const VITE_RUNTIME_SOURCEMAPPING_SOURCE = '//# sourceMappingSource=vite-runtime';
|
253
|
-
const VITE_RUNTIME_SOURCEMAPPING_URL = `${SOURCEMAPPING_URL}=data:application/json;charset=utf-8`;
|
254
253
|
|
255
254
|
const isWindows$5 = typeof process !== 'undefined' && process.platform === 'win32';
|
256
255
|
/**
|
@@ -285,6 +284,15 @@ function withTrailingSlash(path) {
|
|
285
284
|
}
|
286
285
|
return path;
|
287
286
|
}
|
287
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
288
|
+
const AsyncFunction = async function () { }.constructor;
|
289
|
+
// https://github.com/nodejs/node/issues/43047#issuecomment-1564068099
|
290
|
+
const asyncFunctionDeclarationPaddingLineCount =
|
291
|
+
/** #__PURE__ */ (() => {
|
292
|
+
const body = '/*code*/';
|
293
|
+
const source = new AsyncFunction('a', 'b', body).toString();
|
294
|
+
return source.slice(0, source.indexOf(body)).split('\n').length - 1;
|
295
|
+
})();
|
288
296
|
|
289
297
|
// @ts-check
|
290
298
|
/** @typedef { import('estree').BaseNode} BaseNode */
|
@@ -6702,9 +6710,12 @@ class Mappings {
|
|
6702
6710
|
|
6703
6711
|
addEdit(sourceIndex, content, loc, nameIndex) {
|
6704
6712
|
if (content.length) {
|
6713
|
+
const contentLengthMinusOne = content.length - 1;
|
6705
6714
|
let contentLineEnd = content.indexOf('\n', 0);
|
6706
6715
|
let previousContentLineEnd = -1;
|
6707
|
-
|
6716
|
+
// Loop through each line in the content and add a segment, but stop if the last line is empty,
|
6717
|
+
// else code afterwards would fill one line too many
|
6718
|
+
while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {
|
6708
6719
|
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
6709
6720
|
if (nameIndex >= 0) {
|
6710
6721
|
segment.push(nameIndex);
|
@@ -10319,6 +10330,7 @@ class TraceMap {
|
|
10319
10330
|
this.sourceRoot = sourceRoot;
|
10320
10331
|
this.sources = sources;
|
10321
10332
|
this.sourcesContent = sourcesContent;
|
10333
|
+
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || undefined;
|
10322
10334
|
const from = resolve$1(sourceRoot || '', stripFilename(mapUrl));
|
10323
10335
|
this.resolvedSources = sources.map((s) => resolve$1(s || '', from));
|
10324
10336
|
const { mappings } = parsed;
|
@@ -10339,7 +10351,7 @@ class TraceMap {
|
|
10339
10351
|
* Typescript doesn't allow friend access to private fields, so this just casts the map into a type
|
10340
10352
|
* with public access modifiers.
|
10341
10353
|
*/
|
10342
|
-
function cast(map) {
|
10354
|
+
function cast$2(map) {
|
10343
10355
|
return map;
|
10344
10356
|
}
|
10345
10357
|
/**
|
@@ -10347,7 +10359,7 @@ function cast(map) {
|
|
10347
10359
|
*/
|
10348
10360
|
function decodedMappings(map) {
|
10349
10361
|
var _a;
|
10350
|
-
return ((_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded)));
|
10362
|
+
return ((_a = cast$2(map))._decoded || (_a._decoded = decode(cast$2(map)._encoded)));
|
10351
10363
|
}
|
10352
10364
|
/**
|
10353
10365
|
* A low-level API to find the segment associated with a generated line/column (think, from a
|
@@ -10360,7 +10372,7 @@ function traceSegment(map, line, column) {
|
|
10360
10372
|
if (line >= decoded.length)
|
10361
10373
|
return null;
|
10362
10374
|
const segments = decoded[line];
|
10363
|
-
const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, GREATEST_LOWER_BOUND);
|
10375
|
+
const index = traceSegmentInternal(segments, cast$2(map)._decodedMemo, line, column, GREATEST_LOWER_BOUND);
|
10364
10376
|
return index === -1 ? null : segments[index];
|
10365
10377
|
}
|
10366
10378
|
/**
|
@@ -10381,7 +10393,7 @@ function originalPositionFor$1(map, needle) {
|
|
10381
10393
|
if (line >= decoded.length)
|
10382
10394
|
return OMapping(null, null, null, null);
|
10383
10395
|
const segments = decoded[line];
|
10384
|
-
const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
|
10396
|
+
const index = traceSegmentInternal(segments, cast$2(map)._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
|
10385
10397
|
if (index === -1)
|
10386
10398
|
return OMapping(null, null, null, null);
|
10387
10399
|
const segment = segments[index];
|
@@ -10405,15 +10417,6 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
10405
10417
|
return index;
|
10406
10418
|
}
|
10407
10419
|
|
10408
|
-
/**
|
10409
|
-
* Gets the index associated with `key` in the backing array, if it is already present.
|
10410
|
-
*/
|
10411
|
-
let get;
|
10412
|
-
/**
|
10413
|
-
* Puts `key` into the backing array, if it is not already present. Returns
|
10414
|
-
* the index of the `key` in the backing array.
|
10415
|
-
*/
|
10416
|
-
let put;
|
10417
10420
|
/**
|
10418
10421
|
* SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the
|
10419
10422
|
* index of the `key` in the backing array.
|
@@ -10428,17 +10431,48 @@ class SetArray {
|
|
10428
10431
|
this.array = [];
|
10429
10432
|
}
|
10430
10433
|
}
|
10431
|
-
|
10432
|
-
|
10433
|
-
|
10434
|
-
|
10435
|
-
|
10436
|
-
|
10437
|
-
|
10438
|
-
|
10439
|
-
|
10440
|
-
|
10441
|
-
|
10434
|
+
/**
|
10435
|
+
* Typescript doesn't allow friend access to private fields, so this just casts the set into a type
|
10436
|
+
* with public access modifiers.
|
10437
|
+
*/
|
10438
|
+
function cast$1(set) {
|
10439
|
+
return set;
|
10440
|
+
}
|
10441
|
+
/**
|
10442
|
+
* Gets the index associated with `key` in the backing array, if it is already present.
|
10443
|
+
*/
|
10444
|
+
function get(setarr, key) {
|
10445
|
+
return cast$1(setarr)._indexes[key];
|
10446
|
+
}
|
10447
|
+
/**
|
10448
|
+
* Puts `key` into the backing array, if it is not already present. Returns
|
10449
|
+
* the index of the `key` in the backing array.
|
10450
|
+
*/
|
10451
|
+
function put(setarr, key) {
|
10452
|
+
// The key may or may not be present. If it is present, it's a number.
|
10453
|
+
const index = get(setarr, key);
|
10454
|
+
if (index !== undefined)
|
10455
|
+
return index;
|
10456
|
+
const { array, _indexes: indexes } = cast$1(setarr);
|
10457
|
+
const length = array.push(key);
|
10458
|
+
return (indexes[key] = length - 1);
|
10459
|
+
}
|
10460
|
+
/**
|
10461
|
+
* Removes the key, if it exists in the set.
|
10462
|
+
*/
|
10463
|
+
function remove(setarr, key) {
|
10464
|
+
const index = get(setarr, key);
|
10465
|
+
if (index === undefined)
|
10466
|
+
return;
|
10467
|
+
const { array, _indexes: indexes } = cast$1(setarr);
|
10468
|
+
for (let i = index + 1; i < array.length; i++) {
|
10469
|
+
const k = array[i];
|
10470
|
+
array[i - 1] = k;
|
10471
|
+
indexes[k]--;
|
10472
|
+
}
|
10473
|
+
indexes[key] = undefined;
|
10474
|
+
array.pop();
|
10475
|
+
}
|
10442
10476
|
|
10443
10477
|
const COLUMN = 0;
|
10444
10478
|
const SOURCES_INDEX = 1;
|
@@ -10447,88 +10481,100 @@ const SOURCE_COLUMN = 3;
|
|
10447
10481
|
const NAMES_INDEX = 4;
|
10448
10482
|
|
10449
10483
|
const NO_NAME = -1;
|
10484
|
+
/**
|
10485
|
+
* Provides the state to generate a sourcemap.
|
10486
|
+
*/
|
10487
|
+
class GenMapping {
|
10488
|
+
constructor({ file, sourceRoot } = {}) {
|
10489
|
+
this._names = new SetArray();
|
10490
|
+
this._sources = new SetArray();
|
10491
|
+
this._sourcesContent = [];
|
10492
|
+
this._mappings = [];
|
10493
|
+
this.file = file;
|
10494
|
+
this.sourceRoot = sourceRoot;
|
10495
|
+
this._ignoreList = new SetArray();
|
10496
|
+
}
|
10497
|
+
}
|
10498
|
+
/**
|
10499
|
+
* Typescript doesn't allow friend access to private fields, so this just casts the map into a type
|
10500
|
+
* with public access modifiers.
|
10501
|
+
*/
|
10502
|
+
function cast(map) {
|
10503
|
+
return map;
|
10504
|
+
}
|
10450
10505
|
/**
|
10451
10506
|
* Same as `addSegment`, but will only add the segment if it generates useful information in the
|
10452
10507
|
* resulting map. This only works correctly if segments are added **in order**, meaning you should
|
10453
10508
|
* not add a segment with a lower generated line/column than one that came before.
|
10454
10509
|
*/
|
10455
|
-
|
10510
|
+
const maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
|
10511
|
+
return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content);
|
10512
|
+
};
|
10456
10513
|
/**
|
10457
10514
|
* Adds/removes the content of the source file to the source map.
|
10458
10515
|
*/
|
10459
|
-
|
10516
|
+
function setSourceContent(map, source, content) {
|
10517
|
+
const { _sources: sources, _sourcesContent: sourcesContent } = cast(map);
|
10518
|
+
const index = put(sources, source);
|
10519
|
+
sourcesContent[index] = content;
|
10520
|
+
}
|
10521
|
+
function setIgnore(map, source, ignore = true) {
|
10522
|
+
const { _sources: sources, _sourcesContent: sourcesContent, _ignoreList: ignoreList } = cast(map);
|
10523
|
+
const index = put(sources, source);
|
10524
|
+
if (index === sourcesContent.length)
|
10525
|
+
sourcesContent[index] = null;
|
10526
|
+
if (ignore)
|
10527
|
+
put(ignoreList, index);
|
10528
|
+
else
|
10529
|
+
remove(ignoreList, index);
|
10530
|
+
}
|
10460
10531
|
/**
|
10461
10532
|
* Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
|
10462
10533
|
* a sourcemap, or to JSON.stringify.
|
10463
10534
|
*/
|
10464
|
-
|
10535
|
+
function toDecodedMap(map) {
|
10536
|
+
const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, _ignoreList: ignoreList, } = cast(map);
|
10537
|
+
removeEmptyFinalLines(mappings);
|
10538
|
+
return {
|
10539
|
+
version: 3,
|
10540
|
+
file: map.file || undefined,
|
10541
|
+
names: names.array,
|
10542
|
+
sourceRoot: map.sourceRoot || undefined,
|
10543
|
+
sources: sources.array,
|
10544
|
+
sourcesContent,
|
10545
|
+
mappings,
|
10546
|
+
ignoreList: ignoreList.array,
|
10547
|
+
};
|
10548
|
+
}
|
10465
10549
|
/**
|
10466
10550
|
* Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
|
10467
10551
|
* a sourcemap, or to JSON.stringify.
|
10468
10552
|
*/
|
10469
|
-
|
10553
|
+
function toEncodedMap(map) {
|
10554
|
+
const decoded = toDecodedMap(map);
|
10555
|
+
return Object.assign(Object.assign({}, decoded), { mappings: encode$1(decoded.mappings) });
|
10556
|
+
}
|
10470
10557
|
// This split declaration is only so that terser can elminiate the static initialization block.
|
10471
|
-
|
10472
|
-
|
10473
|
-
|
10474
|
-
|
10475
|
-
|
10476
|
-
|
10477
|
-
|
10478
|
-
|
10479
|
-
|
10480
|
-
|
10481
|
-
|
10482
|
-
|
10558
|
+
function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) {
|
10559
|
+
const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = cast(map);
|
10560
|
+
const line = getLine(mappings, genLine);
|
10561
|
+
const index = getColumnIndex(line, genColumn);
|
10562
|
+
if (!source) {
|
10563
|
+
if (skipable && skipSourceless(line, index))
|
10564
|
+
return;
|
10565
|
+
return insert(line, index, [genColumn]);
|
10566
|
+
}
|
10567
|
+
const sourcesIndex = put(sources, source);
|
10568
|
+
const namesIndex = name ? put(names, name) : NO_NAME;
|
10569
|
+
if (sourcesIndex === sourcesContent.length)
|
10570
|
+
sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null;
|
10571
|
+
if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
|
10572
|
+
return;
|
10483
10573
|
}
|
10574
|
+
return insert(line, index, name
|
10575
|
+
? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]
|
10576
|
+
: [genColumn, sourcesIndex, sourceLine, sourceColumn]);
|
10484
10577
|
}
|
10485
|
-
(() => {
|
10486
|
-
maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
|
10487
|
-
return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content);
|
10488
|
-
};
|
10489
|
-
setSourceContent = (map, source, content) => {
|
10490
|
-
const { _sources: sources, _sourcesContent: sourcesContent } = map;
|
10491
|
-
sourcesContent[put(sources, source)] = content;
|
10492
|
-
};
|
10493
|
-
toDecodedMap = (map) => {
|
10494
|
-
const { file, sourceRoot, _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map;
|
10495
|
-
removeEmptyFinalLines(mappings);
|
10496
|
-
return {
|
10497
|
-
version: 3,
|
10498
|
-
file: file || undefined,
|
10499
|
-
names: names.array,
|
10500
|
-
sourceRoot: sourceRoot || undefined,
|
10501
|
-
sources: sources.array,
|
10502
|
-
sourcesContent,
|
10503
|
-
mappings,
|
10504
|
-
};
|
10505
|
-
};
|
10506
|
-
toEncodedMap = (map) => {
|
10507
|
-
const decoded = toDecodedMap(map);
|
10508
|
-
return Object.assign(Object.assign({}, decoded), { mappings: encode$1(decoded.mappings) });
|
10509
|
-
};
|
10510
|
-
// Internal helpers
|
10511
|
-
addSegmentInternal = (skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
|
10512
|
-
const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map;
|
10513
|
-
const line = getLine(mappings, genLine);
|
10514
|
-
const index = getColumnIndex(line, genColumn);
|
10515
|
-
if (!source) {
|
10516
|
-
if (skipable && skipSourceless(line, index))
|
10517
|
-
return;
|
10518
|
-
return insert(line, index, [genColumn]);
|
10519
|
-
}
|
10520
|
-
const sourcesIndex = put(sources, source);
|
10521
|
-
const namesIndex = name ? put(names, name) : NO_NAME;
|
10522
|
-
if (sourcesIndex === sourcesContent.length)
|
10523
|
-
sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null;
|
10524
|
-
if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
|
10525
|
-
return;
|
10526
|
-
}
|
10527
|
-
return insert(line, index, name
|
10528
|
-
? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]
|
10529
|
-
: [genColumn, sourcesIndex, sourceLine, sourceColumn]);
|
10530
|
-
};
|
10531
|
-
})();
|
10532
10578
|
function getLine(mappings, index) {
|
10533
10579
|
for (let i = mappings.length; i <= index; i++) {
|
10534
10580
|
mappings[i] = [];
|
@@ -10587,17 +10633,18 @@ function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIn
|
|
10587
10633
|
namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME));
|
10588
10634
|
}
|
10589
10635
|
|
10590
|
-
const SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null);
|
10636
|
+
const SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null, false);
|
10591
10637
|
const EMPTY_SOURCES = [];
|
10592
|
-
function SegmentObject(source, line, column, name, content) {
|
10593
|
-
return { source, line, column, name, content };
|
10638
|
+
function SegmentObject(source, line, column, name, content, ignore) {
|
10639
|
+
return { source, line, column, name, content, ignore };
|
10594
10640
|
}
|
10595
|
-
function Source(map, sources, source, content) {
|
10641
|
+
function Source(map, sources, source, content, ignore) {
|
10596
10642
|
return {
|
10597
10643
|
map,
|
10598
10644
|
sources,
|
10599
10645
|
source,
|
10600
10646
|
content,
|
10647
|
+
ignore,
|
10601
10648
|
};
|
10602
10649
|
}
|
10603
10650
|
/**
|
@@ -10605,14 +10652,14 @@ function Source(map, sources, source, content) {
|
|
10605
10652
|
* (which may themselves be SourceMapTrees).
|
10606
10653
|
*/
|
10607
10654
|
function MapSource(map, sources) {
|
10608
|
-
return Source(map, sources, '', null);
|
10655
|
+
return Source(map, sources, '', null, false);
|
10609
10656
|
}
|
10610
10657
|
/**
|
10611
10658
|
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
10612
10659
|
* segment tracing ends at the `OriginalSource`.
|
10613
10660
|
*/
|
10614
|
-
function OriginalSource(source, content) {
|
10615
|
-
return Source(null, EMPTY_SOURCES, source, content);
|
10661
|
+
function OriginalSource(source, content, ignore) {
|
10662
|
+
return Source(null, EMPTY_SOURCES, source, content, ignore);
|
10616
10663
|
}
|
10617
10664
|
/**
|
10618
10665
|
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
@@ -10641,10 +10688,12 @@ function traceMappings(tree) {
|
|
10641
10688
|
if (traced == null)
|
10642
10689
|
continue;
|
10643
10690
|
}
|
10644
|
-
const { column, line, name, content, source } = traced;
|
10691
|
+
const { column, line, name, content, source, ignore } = traced;
|
10645
10692
|
maybeAddSegment(gen, i, genCol, source, line, column, name);
|
10646
10693
|
if (source && content != null)
|
10647
10694
|
setSourceContent(gen, source, content);
|
10695
|
+
if (ignore)
|
10696
|
+
setIgnore(gen, source, true);
|
10648
10697
|
}
|
10649
10698
|
}
|
10650
10699
|
return gen;
|
@@ -10655,7 +10704,7 @@ function traceMappings(tree) {
|
|
10655
10704
|
*/
|
10656
10705
|
function originalPositionFor(source, line, column, name) {
|
10657
10706
|
if (!source.map) {
|
10658
|
-
return SegmentObject(source.source, line, column, name, source.content);
|
10707
|
+
return SegmentObject(source.source, line, column, name, source.content, source.ignore);
|
10659
10708
|
}
|
10660
10709
|
const segment = traceSegment(source.map, line, column);
|
10661
10710
|
// If we couldn't find a segment, then this doesn't exist in the sourcemap.
|
@@ -10700,7 +10749,7 @@ function buildSourceMapTree(input, loader) {
|
|
10700
10749
|
return tree;
|
10701
10750
|
}
|
10702
10751
|
function build$2(map, loader, importer, importerDepth) {
|
10703
|
-
const { resolvedSources, sourcesContent } = map;
|
10752
|
+
const { resolvedSources, sourcesContent, ignoreList } = map;
|
10704
10753
|
const depth = importerDepth + 1;
|
10705
10754
|
const children = resolvedSources.map((sourceFile, i) => {
|
10706
10755
|
// The loading context gives the loader more information about why this file is being loaded
|
@@ -10712,20 +10761,22 @@ function build$2(map, loader, importer, importerDepth) {
|
|
10712
10761
|
depth,
|
10713
10762
|
source: sourceFile || '',
|
10714
10763
|
content: undefined,
|
10764
|
+
ignore: undefined,
|
10715
10765
|
};
|
10716
10766
|
// Use the provided loader callback to retrieve the file's sourcemap.
|
10717
10767
|
// TODO: We should eventually support async loading of sourcemap files.
|
10718
10768
|
const sourceMap = loader(ctx.source, ctx);
|
10719
|
-
const { source, content } = ctx;
|
10769
|
+
const { source, content, ignore } = ctx;
|
10720
10770
|
// If there is a sourcemap, then we need to recurse into it to load its source files.
|
10721
10771
|
if (sourceMap)
|
10722
10772
|
return build$2(new TraceMap(sourceMap, source), loader, source, depth);
|
10723
|
-
// Else, it's an
|
10773
|
+
// Else, it's an unmodified source file.
|
10724
10774
|
// The contents of this unmodified source file can be overridden via the loader context,
|
10725
10775
|
// allowing it to be explicitly null or a string. If it remains undefined, we fall back to
|
10726
10776
|
// the importing sourcemap's `sourcesContent` field.
|
10727
10777
|
const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
|
10728
|
-
|
10778
|
+
const ignored = ignore !== undefined ? ignore : ignoreList ? ignoreList.includes(i) : false;
|
10779
|
+
return OriginalSource(source, sourceContent, ignored);
|
10729
10780
|
});
|
10730
10781
|
return MapSource(map, children);
|
10731
10782
|
}
|
@@ -10741,6 +10792,7 @@ class SourceMap {
|
|
10741
10792
|
this.file = out.file;
|
10742
10793
|
this.mappings = out.mappings;
|
10743
10794
|
this.names = out.names;
|
10795
|
+
this.ignoreList = out.ignoreList;
|
10744
10796
|
this.sourceRoot = out.sourceRoot;
|
10745
10797
|
this.sources = out.sources;
|
10746
10798
|
if (!options.excludeContent) {
|
@@ -10775,7 +10827,7 @@ function remapping(input, loader, options) {
|
|
10775
10827
|
|
10776
10828
|
var src$2 = {exports: {}};
|
10777
10829
|
|
10778
|
-
var
|
10830
|
+
var browser$3 = {exports: {}};
|
10779
10831
|
|
10780
10832
|
/**
|
10781
10833
|
* Helpers.
|
@@ -11230,281 +11282,6 @@ function requireCommon () {
|
|
11230
11282
|
return common$b;
|
11231
11283
|
}
|
11232
11284
|
|
11233
|
-
/**
|
11234
|
-
* Module dependencies.
|
11235
|
-
*/
|
11236
|
-
|
11237
|
-
var hasRequiredNode$1;
|
11238
|
-
|
11239
|
-
function requireNode$1 () {
|
11240
|
-
if (hasRequiredNode$1) return node$1.exports;
|
11241
|
-
hasRequiredNode$1 = 1;
|
11242
|
-
(function (module, exports) {
|
11243
|
-
const tty = require$$0$3;
|
11244
|
-
const util = require$$0$6;
|
11245
|
-
|
11246
|
-
/**
|
11247
|
-
* This is the Node.js implementation of `debug()`.
|
11248
|
-
*/
|
11249
|
-
|
11250
|
-
exports.init = init;
|
11251
|
-
exports.log = log;
|
11252
|
-
exports.formatArgs = formatArgs;
|
11253
|
-
exports.save = save;
|
11254
|
-
exports.load = load;
|
11255
|
-
exports.useColors = useColors;
|
11256
|
-
exports.destroy = util.deprecate(
|
11257
|
-
() => {},
|
11258
|
-
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
11259
|
-
);
|
11260
|
-
|
11261
|
-
/**
|
11262
|
-
* Colors.
|
11263
|
-
*/
|
11264
|
-
|
11265
|
-
exports.colors = [6, 2, 3, 4, 5, 1];
|
11266
|
-
|
11267
|
-
try {
|
11268
|
-
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
11269
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
11270
|
-
const supportsColor = require('supports-color');
|
11271
|
-
|
11272
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
11273
|
-
exports.colors = [
|
11274
|
-
20,
|
11275
|
-
21,
|
11276
|
-
26,
|
11277
|
-
27,
|
11278
|
-
32,
|
11279
|
-
33,
|
11280
|
-
38,
|
11281
|
-
39,
|
11282
|
-
40,
|
11283
|
-
41,
|
11284
|
-
42,
|
11285
|
-
43,
|
11286
|
-
44,
|
11287
|
-
45,
|
11288
|
-
56,
|
11289
|
-
57,
|
11290
|
-
62,
|
11291
|
-
63,
|
11292
|
-
68,
|
11293
|
-
69,
|
11294
|
-
74,
|
11295
|
-
75,
|
11296
|
-
76,
|
11297
|
-
77,
|
11298
|
-
78,
|
11299
|
-
79,
|
11300
|
-
80,
|
11301
|
-
81,
|
11302
|
-
92,
|
11303
|
-
93,
|
11304
|
-
98,
|
11305
|
-
99,
|
11306
|
-
112,
|
11307
|
-
113,
|
11308
|
-
128,
|
11309
|
-
129,
|
11310
|
-
134,
|
11311
|
-
135,
|
11312
|
-
148,
|
11313
|
-
149,
|
11314
|
-
160,
|
11315
|
-
161,
|
11316
|
-
162,
|
11317
|
-
163,
|
11318
|
-
164,
|
11319
|
-
165,
|
11320
|
-
166,
|
11321
|
-
167,
|
11322
|
-
168,
|
11323
|
-
169,
|
11324
|
-
170,
|
11325
|
-
171,
|
11326
|
-
172,
|
11327
|
-
173,
|
11328
|
-
178,
|
11329
|
-
179,
|
11330
|
-
184,
|
11331
|
-
185,
|
11332
|
-
196,
|
11333
|
-
197,
|
11334
|
-
198,
|
11335
|
-
199,
|
11336
|
-
200,
|
11337
|
-
201,
|
11338
|
-
202,
|
11339
|
-
203,
|
11340
|
-
204,
|
11341
|
-
205,
|
11342
|
-
206,
|
11343
|
-
207,
|
11344
|
-
208,
|
11345
|
-
209,
|
11346
|
-
214,
|
11347
|
-
215,
|
11348
|
-
220,
|
11349
|
-
221
|
11350
|
-
];
|
11351
|
-
}
|
11352
|
-
} catch (error) {
|
11353
|
-
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
11354
|
-
}
|
11355
|
-
|
11356
|
-
/**
|
11357
|
-
* Build up the default `inspectOpts` object from the environment variables.
|
11358
|
-
*
|
11359
|
-
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
11360
|
-
*/
|
11361
|
-
|
11362
|
-
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
11363
|
-
return /^debug_/i.test(key);
|
11364
|
-
}).reduce((obj, key) => {
|
11365
|
-
// Camel-case
|
11366
|
-
const prop = key
|
11367
|
-
.substring(6)
|
11368
|
-
.toLowerCase()
|
11369
|
-
.replace(/_([a-z])/g, (_, k) => {
|
11370
|
-
return k.toUpperCase();
|
11371
|
-
});
|
11372
|
-
|
11373
|
-
// Coerce string value into JS value
|
11374
|
-
let val = process.env[key];
|
11375
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
11376
|
-
val = true;
|
11377
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
11378
|
-
val = false;
|
11379
|
-
} else if (val === 'null') {
|
11380
|
-
val = null;
|
11381
|
-
} else {
|
11382
|
-
val = Number(val);
|
11383
|
-
}
|
11384
|
-
|
11385
|
-
obj[prop] = val;
|
11386
|
-
return obj;
|
11387
|
-
}, {});
|
11388
|
-
|
11389
|
-
/**
|
11390
|
-
* Is stdout a TTY? Colored output is enabled when `true`.
|
11391
|
-
*/
|
11392
|
-
|
11393
|
-
function useColors() {
|
11394
|
-
return 'colors' in exports.inspectOpts ?
|
11395
|
-
Boolean(exports.inspectOpts.colors) :
|
11396
|
-
tty.isatty(process.stderr.fd);
|
11397
|
-
}
|
11398
|
-
|
11399
|
-
/**
|
11400
|
-
* Adds ANSI color escape codes if enabled.
|
11401
|
-
*
|
11402
|
-
* @api public
|
11403
|
-
*/
|
11404
|
-
|
11405
|
-
function formatArgs(args) {
|
11406
|
-
const {namespace: name, useColors} = this;
|
11407
|
-
|
11408
|
-
if (useColors) {
|
11409
|
-
const c = this.color;
|
11410
|
-
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
11411
|
-
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
11412
|
-
|
11413
|
-
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
11414
|
-
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
11415
|
-
} else {
|
11416
|
-
args[0] = getDate() + name + ' ' + args[0];
|
11417
|
-
}
|
11418
|
-
}
|
11419
|
-
|
11420
|
-
function getDate() {
|
11421
|
-
if (exports.inspectOpts.hideDate) {
|
11422
|
-
return '';
|
11423
|
-
}
|
11424
|
-
return new Date().toISOString() + ' ';
|
11425
|
-
}
|
11426
|
-
|
11427
|
-
/**
|
11428
|
-
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
11429
|
-
*/
|
11430
|
-
|
11431
|
-
function log(...args) {
|
11432
|
-
return process.stderr.write(util.format(...args) + '\n');
|
11433
|
-
}
|
11434
|
-
|
11435
|
-
/**
|
11436
|
-
* Save `namespaces`.
|
11437
|
-
*
|
11438
|
-
* @param {String} namespaces
|
11439
|
-
* @api private
|
11440
|
-
*/
|
11441
|
-
function save(namespaces) {
|
11442
|
-
if (namespaces) {
|
11443
|
-
process.env.DEBUG = namespaces;
|
11444
|
-
} else {
|
11445
|
-
// If you set a process.env field to null or undefined, it gets cast to the
|
11446
|
-
// string 'null' or 'undefined'. Just delete instead.
|
11447
|
-
delete process.env.DEBUG;
|
11448
|
-
}
|
11449
|
-
}
|
11450
|
-
|
11451
|
-
/**
|
11452
|
-
* Load `namespaces`.
|
11453
|
-
*
|
11454
|
-
* @return {String} returns the previously persisted debug modes
|
11455
|
-
* @api private
|
11456
|
-
*/
|
11457
|
-
|
11458
|
-
function load() {
|
11459
|
-
return process.env.DEBUG;
|
11460
|
-
}
|
11461
|
-
|
11462
|
-
/**
|
11463
|
-
* Init logic for `debug` instances.
|
11464
|
-
*
|
11465
|
-
* Create a new `inspectOpts` object in case `useColors` is set
|
11466
|
-
* differently for a particular `debug` instance.
|
11467
|
-
*/
|
11468
|
-
|
11469
|
-
function init(debug) {
|
11470
|
-
debug.inspectOpts = {};
|
11471
|
-
|
11472
|
-
const keys = Object.keys(exports.inspectOpts);
|
11473
|
-
for (let i = 0; i < keys.length; i++) {
|
11474
|
-
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
11475
|
-
}
|
11476
|
-
}
|
11477
|
-
|
11478
|
-
module.exports = requireCommon()(exports);
|
11479
|
-
|
11480
|
-
const {formatters} = module.exports;
|
11481
|
-
|
11482
|
-
/**
|
11483
|
-
* Map %o to `util.inspect()`, all on a single line.
|
11484
|
-
*/
|
11485
|
-
|
11486
|
-
formatters.o = function (v) {
|
11487
|
-
this.inspectOpts.colors = this.useColors;
|
11488
|
-
return util.inspect(v, this.inspectOpts)
|
11489
|
-
.split('\n')
|
11490
|
-
.map(str => str.trim())
|
11491
|
-
.join(' ');
|
11492
|
-
};
|
11493
|
-
|
11494
|
-
/**
|
11495
|
-
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
11496
|
-
*/
|
11497
|
-
|
11498
|
-
formatters.O = function (v) {
|
11499
|
-
this.inspectOpts.colors = this.useColors;
|
11500
|
-
return util.inspect(v, this.inspectOpts);
|
11501
|
-
};
|
11502
|
-
} (node$1, node$1.exports));
|
11503
|
-
return node$1.exports;
|
11504
|
-
}
|
11505
|
-
|
11506
|
-
var browser$3 = {exports: {}};
|
11507
|
-
|
11508
11285
|
/* eslint-env browser */
|
11509
11286
|
|
11510
11287
|
var hasRequiredBrowser$1;
|
@@ -11784,6 +11561,281 @@ function requireBrowser$1 () {
|
|
11784
11561
|
return browser$3.exports;
|
11785
11562
|
}
|
11786
11563
|
|
11564
|
+
var node$1 = {exports: {}};
|
11565
|
+
|
11566
|
+
/**
|
11567
|
+
* Module dependencies.
|
11568
|
+
*/
|
11569
|
+
|
11570
|
+
var hasRequiredNode$1;
|
11571
|
+
|
11572
|
+
function requireNode$1 () {
|
11573
|
+
if (hasRequiredNode$1) return node$1.exports;
|
11574
|
+
hasRequiredNode$1 = 1;
|
11575
|
+
(function (module, exports) {
|
11576
|
+
const tty = require$$0$3;
|
11577
|
+
const util = require$$0$6;
|
11578
|
+
|
11579
|
+
/**
|
11580
|
+
* This is the Node.js implementation of `debug()`.
|
11581
|
+
*/
|
11582
|
+
|
11583
|
+
exports.init = init;
|
11584
|
+
exports.log = log;
|
11585
|
+
exports.formatArgs = formatArgs;
|
11586
|
+
exports.save = save;
|
11587
|
+
exports.load = load;
|
11588
|
+
exports.useColors = useColors;
|
11589
|
+
exports.destroy = util.deprecate(
|
11590
|
+
() => {},
|
11591
|
+
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
11592
|
+
);
|
11593
|
+
|
11594
|
+
/**
|
11595
|
+
* Colors.
|
11596
|
+
*/
|
11597
|
+
|
11598
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
11599
|
+
|
11600
|
+
try {
|
11601
|
+
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
11602
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
11603
|
+
const supportsColor = require('supports-color');
|
11604
|
+
|
11605
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
11606
|
+
exports.colors = [
|
11607
|
+
20,
|
11608
|
+
21,
|
11609
|
+
26,
|
11610
|
+
27,
|
11611
|
+
32,
|
11612
|
+
33,
|
11613
|
+
38,
|
11614
|
+
39,
|
11615
|
+
40,
|
11616
|
+
41,
|
11617
|
+
42,
|
11618
|
+
43,
|
11619
|
+
44,
|
11620
|
+
45,
|
11621
|
+
56,
|
11622
|
+
57,
|
11623
|
+
62,
|
11624
|
+
63,
|
11625
|
+
68,
|
11626
|
+
69,
|
11627
|
+
74,
|
11628
|
+
75,
|
11629
|
+
76,
|
11630
|
+
77,
|
11631
|
+
78,
|
11632
|
+
79,
|
11633
|
+
80,
|
11634
|
+
81,
|
11635
|
+
92,
|
11636
|
+
93,
|
11637
|
+
98,
|
11638
|
+
99,
|
11639
|
+
112,
|
11640
|
+
113,
|
11641
|
+
128,
|
11642
|
+
129,
|
11643
|
+
134,
|
11644
|
+
135,
|
11645
|
+
148,
|
11646
|
+
149,
|
11647
|
+
160,
|
11648
|
+
161,
|
11649
|
+
162,
|
11650
|
+
163,
|
11651
|
+
164,
|
11652
|
+
165,
|
11653
|
+
166,
|
11654
|
+
167,
|
11655
|
+
168,
|
11656
|
+
169,
|
11657
|
+
170,
|
11658
|
+
171,
|
11659
|
+
172,
|
11660
|
+
173,
|
11661
|
+
178,
|
11662
|
+
179,
|
11663
|
+
184,
|
11664
|
+
185,
|
11665
|
+
196,
|
11666
|
+
197,
|
11667
|
+
198,
|
11668
|
+
199,
|
11669
|
+
200,
|
11670
|
+
201,
|
11671
|
+
202,
|
11672
|
+
203,
|
11673
|
+
204,
|
11674
|
+
205,
|
11675
|
+
206,
|
11676
|
+
207,
|
11677
|
+
208,
|
11678
|
+
209,
|
11679
|
+
214,
|
11680
|
+
215,
|
11681
|
+
220,
|
11682
|
+
221
|
11683
|
+
];
|
11684
|
+
}
|
11685
|
+
} catch (error) {
|
11686
|
+
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
11687
|
+
}
|
11688
|
+
|
11689
|
+
/**
|
11690
|
+
* Build up the default `inspectOpts` object from the environment variables.
|
11691
|
+
*
|
11692
|
+
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
11693
|
+
*/
|
11694
|
+
|
11695
|
+
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
11696
|
+
return /^debug_/i.test(key);
|
11697
|
+
}).reduce((obj, key) => {
|
11698
|
+
// Camel-case
|
11699
|
+
const prop = key
|
11700
|
+
.substring(6)
|
11701
|
+
.toLowerCase()
|
11702
|
+
.replace(/_([a-z])/g, (_, k) => {
|
11703
|
+
return k.toUpperCase();
|
11704
|
+
});
|
11705
|
+
|
11706
|
+
// Coerce string value into JS value
|
11707
|
+
let val = process.env[key];
|
11708
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
11709
|
+
val = true;
|
11710
|
+
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
11711
|
+
val = false;
|
11712
|
+
} else if (val === 'null') {
|
11713
|
+
val = null;
|
11714
|
+
} else {
|
11715
|
+
val = Number(val);
|
11716
|
+
}
|
11717
|
+
|
11718
|
+
obj[prop] = val;
|
11719
|
+
return obj;
|
11720
|
+
}, {});
|
11721
|
+
|
11722
|
+
/**
|
11723
|
+
* Is stdout a TTY? Colored output is enabled when `true`.
|
11724
|
+
*/
|
11725
|
+
|
11726
|
+
function useColors() {
|
11727
|
+
return 'colors' in exports.inspectOpts ?
|
11728
|
+
Boolean(exports.inspectOpts.colors) :
|
11729
|
+
tty.isatty(process.stderr.fd);
|
11730
|
+
}
|
11731
|
+
|
11732
|
+
/**
|
11733
|
+
* Adds ANSI color escape codes if enabled.
|
11734
|
+
*
|
11735
|
+
* @api public
|
11736
|
+
*/
|
11737
|
+
|
11738
|
+
function formatArgs(args) {
|
11739
|
+
const {namespace: name, useColors} = this;
|
11740
|
+
|
11741
|
+
if (useColors) {
|
11742
|
+
const c = this.color;
|
11743
|
+
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
11744
|
+
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
11745
|
+
|
11746
|
+
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
11747
|
+
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
11748
|
+
} else {
|
11749
|
+
args[0] = getDate() + name + ' ' + args[0];
|
11750
|
+
}
|
11751
|
+
}
|
11752
|
+
|
11753
|
+
function getDate() {
|
11754
|
+
if (exports.inspectOpts.hideDate) {
|
11755
|
+
return '';
|
11756
|
+
}
|
11757
|
+
return new Date().toISOString() + ' ';
|
11758
|
+
}
|
11759
|
+
|
11760
|
+
/**
|
11761
|
+
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
11762
|
+
*/
|
11763
|
+
|
11764
|
+
function log(...args) {
|
11765
|
+
return process.stderr.write(util.format(...args) + '\n');
|
11766
|
+
}
|
11767
|
+
|
11768
|
+
/**
|
11769
|
+
* Save `namespaces`.
|
11770
|
+
*
|
11771
|
+
* @param {String} namespaces
|
11772
|
+
* @api private
|
11773
|
+
*/
|
11774
|
+
function save(namespaces) {
|
11775
|
+
if (namespaces) {
|
11776
|
+
process.env.DEBUG = namespaces;
|
11777
|
+
} else {
|
11778
|
+
// If you set a process.env field to null or undefined, it gets cast to the
|
11779
|
+
// string 'null' or 'undefined'. Just delete instead.
|
11780
|
+
delete process.env.DEBUG;
|
11781
|
+
}
|
11782
|
+
}
|
11783
|
+
|
11784
|
+
/**
|
11785
|
+
* Load `namespaces`.
|
11786
|
+
*
|
11787
|
+
* @return {String} returns the previously persisted debug modes
|
11788
|
+
* @api private
|
11789
|
+
*/
|
11790
|
+
|
11791
|
+
function load() {
|
11792
|
+
return process.env.DEBUG;
|
11793
|
+
}
|
11794
|
+
|
11795
|
+
/**
|
11796
|
+
* Init logic for `debug` instances.
|
11797
|
+
*
|
11798
|
+
* Create a new `inspectOpts` object in case `useColors` is set
|
11799
|
+
* differently for a particular `debug` instance.
|
11800
|
+
*/
|
11801
|
+
|
11802
|
+
function init(debug) {
|
11803
|
+
debug.inspectOpts = {};
|
11804
|
+
|
11805
|
+
const keys = Object.keys(exports.inspectOpts);
|
11806
|
+
for (let i = 0; i < keys.length; i++) {
|
11807
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
11808
|
+
}
|
11809
|
+
}
|
11810
|
+
|
11811
|
+
module.exports = requireCommon()(exports);
|
11812
|
+
|
11813
|
+
const {formatters} = module.exports;
|
11814
|
+
|
11815
|
+
/**
|
11816
|
+
* Map %o to `util.inspect()`, all on a single line.
|
11817
|
+
*/
|
11818
|
+
|
11819
|
+
formatters.o = function (v) {
|
11820
|
+
this.inspectOpts.colors = this.useColors;
|
11821
|
+
return util.inspect(v, this.inspectOpts)
|
11822
|
+
.split('\n')
|
11823
|
+
.map(str => str.trim())
|
11824
|
+
.join(' ');
|
11825
|
+
};
|
11826
|
+
|
11827
|
+
/**
|
11828
|
+
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
11829
|
+
*/
|
11830
|
+
|
11831
|
+
formatters.O = function (v) {
|
11832
|
+
this.inspectOpts.colors = this.useColors;
|
11833
|
+
return util.inspect(v, this.inspectOpts);
|
11834
|
+
};
|
11835
|
+
} (node$1, node$1.exports));
|
11836
|
+
return node$1.exports;
|
11837
|
+
}
|
11838
|
+
|
11787
11839
|
/**
|
11788
11840
|
* Detect Electron renderer / nwjs process, which is node, but we should
|
11789
11841
|
* treat as a browser.
|
@@ -11806,7 +11858,7 @@ if (process.versions.pnp) {
|
|
11806
11858
|
catch { }
|
11807
11859
|
}
|
11808
11860
|
function invalidatePackageData(packageCache, pkgPath) {
|
11809
|
-
const pkgDir = path$o.dirname(pkgPath);
|
11861
|
+
const pkgDir = normalizePath$3(path$o.dirname(pkgPath));
|
11810
11862
|
packageCache.forEach((pkg, cacheKey) => {
|
11811
11863
|
if (pkg.dir === pkgDir) {
|
11812
11864
|
packageCache.delete(cacheKey);
|
@@ -11894,7 +11946,7 @@ function findNearestMainPackageData(basedir, packageCache) {
|
|
11894
11946
|
}
|
11895
11947
|
function loadPackageData(pkgPath) {
|
11896
11948
|
const data = JSON.parse(fs$l.readFileSync(pkgPath, 'utf-8'));
|
11897
|
-
const pkgDir = path$o.dirname(pkgPath);
|
11949
|
+
const pkgDir = normalizePath$3(path$o.dirname(pkgPath));
|
11898
11950
|
const { sideEffects } = data;
|
11899
11951
|
let hasSideEffects;
|
11900
11952
|
if (typeof sideEffects === 'boolean') {
|
@@ -12586,6 +12638,8 @@ function joinSrcset(ret) {
|
|
12586
12638
|
.map(({ url, descriptor }) => url + (descriptor ? ` ${descriptor}` : ''))
|
12587
12639
|
.join(', ');
|
12588
12640
|
}
|
12641
|
+
// NOTE: The returned `url` should perhaps be decoded so all handled URLs within Vite are consistently decoded.
|
12642
|
+
// However, this may also require a refactor for `cssReplacer` to accept decoded URLs instead.
|
12589
12643
|
function splitSrcSetDescriptor(srcs) {
|
12590
12644
|
return splitSrcSet(srcs)
|
12591
12645
|
.map((s) => {
|
@@ -12873,7 +12927,7 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
12873
12927
|
continue;
|
12874
12928
|
}
|
12875
12929
|
if (Array.isArray(existing) || Array.isArray(value)) {
|
12876
|
-
merged[key] = [...arraify(existing
|
12930
|
+
merged[key] = [...arraify(existing), ...arraify(value)];
|
12877
12931
|
continue;
|
12878
12932
|
}
|
12879
12933
|
if (isObject$1(existing) && isObject$1(value)) {
|
@@ -13110,6 +13164,13 @@ function displayTime(time) {
|
|
13110
13164
|
// display: {X}m {Y}s
|
13111
13165
|
return `${mins}m${seconds < 1 ? '' : ` ${seconds.toFixed(0)}s`}`;
|
13112
13166
|
}
|
13167
|
+
/**
|
13168
|
+
* Like `encodeURI`, but only replacing `%` as `%25`. This is useful for environments
|
13169
|
+
* that can handle un-encoded URIs, where `%` is the only ambiguous character.
|
13170
|
+
*/
|
13171
|
+
function partialEncodeURI(uri) {
|
13172
|
+
return uri.replaceAll('%', '%25');
|
13173
|
+
}
|
13113
13174
|
|
13114
13175
|
/* eslint no-console: 0 */
|
13115
13176
|
const LogLevels = {
|
@@ -14020,7 +14081,7 @@ async function parse$f(filename, options) {
|
|
14020
14081
|
/** @type {Promise<import('./public.d.ts').TSConfckParseResult>}*/
|
14021
14082
|
promise
|
14022
14083
|
} = makePromise();
|
14023
|
-
cache?.setParseResult(filename, promise);
|
14084
|
+
cache?.setParseResult(filename, promise, true);
|
14024
14085
|
try {
|
14025
14086
|
let tsconfigFile =
|
14026
14087
|
(await resolveTSConfigJson(filename, cache)) || (await find(filename, options));
|
@@ -14059,7 +14120,7 @@ async function getParsedDeep(filename, cache, options) {
|
|
14059
14120
|
parseExtends(result, cache),
|
14060
14121
|
parseReferences(result, options)
|
14061
14122
|
]).then(() => result);
|
14062
|
-
cache.setParseResult(filename, promise);
|
14123
|
+
cache.setParseResult(filename, promise, true);
|
14063
14124
|
return promise;
|
14064
14125
|
}
|
14065
14126
|
return result;
|
@@ -14073,7 +14134,11 @@ async function getParsedDeep(filename, cache, options) {
|
|
14073
14134
|
* @returns {Promise<import('./public.d.ts').TSConfckParseResult>}
|
14074
14135
|
*/
|
14075
14136
|
async function parseFile$1(tsconfigFile, cache, skipCache) {
|
14076
|
-
if (
|
14137
|
+
if (
|
14138
|
+
!skipCache &&
|
14139
|
+
cache?.hasParseResult(tsconfigFile) &&
|
14140
|
+
!cache.getParseResult(tsconfigFile)._isRootFile_
|
14141
|
+
) {
|
14077
14142
|
return cache.getParseResult(tsconfigFile);
|
14078
14143
|
}
|
14079
14144
|
const promise = promises$1
|
@@ -14095,7 +14160,10 @@ async function parseFile$1(tsconfigFile, cache, skipCache) {
|
|
14095
14160
|
e
|
14096
14161
|
);
|
14097
14162
|
});
|
14098
|
-
if (
|
14163
|
+
if (
|
14164
|
+
!skipCache &&
|
14165
|
+
(!cache?.hasParseResult(tsconfigFile) || !cache.getParseResult(tsconfigFile)._isRootFile_)
|
14166
|
+
) {
|
14099
14167
|
cache?.setParseResult(tsconfigFile, promise);
|
14100
14168
|
}
|
14101
14169
|
return promise;
|
@@ -14477,9 +14545,17 @@ class TSConfckCache {
|
|
14477
14545
|
* @internal
|
14478
14546
|
* @private
|
14479
14547
|
* @param file
|
14548
|
+
* @param {boolean} isRootFile a flag to check if current file which involking the parse() api, used to distinguish the normal cache which only parsed by parseFile()
|
14480
14549
|
* @param {Promise<T>} result
|
14481
14550
|
*/
|
14482
|
-
setParseResult(file, result) {
|
14551
|
+
setParseResult(file, result, isRootFile = false) {
|
14552
|
+
// _isRootFile_ is a temporary property for Promise result, used to prevent deadlock with cache
|
14553
|
+
Object.defineProperty(result, '_isRootFile_', {
|
14554
|
+
value: isRootFile,
|
14555
|
+
writable: false,
|
14556
|
+
enumerable: false,
|
14557
|
+
configurable: false
|
14558
|
+
});
|
14483
14559
|
this.#parsed.set(file, result);
|
14484
14560
|
result
|
14485
14561
|
.then((parsed) => {
|
@@ -15214,7 +15290,7 @@ function terserPlugin(config) {
|
|
15214
15290
|
};
|
15215
15291
|
}
|
15216
15292
|
|
15217
|
-
const mimes
|
15293
|
+
const mimes = {
|
15218
15294
|
"3g2": "video/3gpp2",
|
15219
15295
|
"3gp": "video/3gpp",
|
15220
15296
|
"3gpp": "video/3gpp",
|
@@ -15654,7 +15730,7 @@ const mimes$1 = {
|
|
15654
15730
|
function lookup(extn) {
|
15655
15731
|
let tmp = ('' + extn).trim().toLowerCase();
|
15656
15732
|
let idx = tmp.lastIndexOf('.');
|
15657
|
-
return mimes
|
15733
|
+
return mimes[!~idx ? tmp : tmp.substring(++idx)];
|
15658
15734
|
}
|
15659
15735
|
|
15660
15736
|
const publicFilesMap = new WeakMap();
|
@@ -15707,11 +15783,11 @@ const generatedAssets = new WeakMap();
|
|
15707
15783
|
// add own dictionary entry by directly assigning mrmime
|
15708
15784
|
function registerCustomMime() {
|
15709
15785
|
// https://github.com/lukeed/mrmime/issues/3
|
15710
|
-
mimes
|
15786
|
+
mimes['ico'] = 'image/x-icon';
|
15711
15787
|
// https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#flac
|
15712
|
-
mimes
|
15788
|
+
mimes['flac'] = 'audio/flac';
|
15713
15789
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
|
15714
|
-
mimes
|
15790
|
+
mimes['eot'] = 'application/vnd.ms-fontobject';
|
15715
15791
|
}
|
15716
15792
|
function renderAssetUrlInJS(ctx, config, chunk, opts, code) {
|
15717
15793
|
const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(opts.format, config.isWorker);
|
@@ -15731,7 +15807,7 @@ function renderAssetUrlInJS(ctx, config, chunk, opts, code) {
|
|
15731
15807
|
const filename = file + postfix;
|
15732
15808
|
const replacement = toOutputFilePathInJS(filename, 'asset', chunk.fileName, 'js', config, toRelativeRuntime);
|
15733
15809
|
const replacementString = typeof replacement === 'string'
|
15734
|
-
? JSON.stringify(replacement).slice(1, -1)
|
15810
|
+
? JSON.stringify(encodeURI(replacement)).slice(1, -1)
|
15735
15811
|
: `"+${replacement.runtime}+"`;
|
15736
15812
|
s.update(match.index, match.index + full.length, replacementString);
|
15737
15813
|
}
|
@@ -15744,7 +15820,7 @@ function renderAssetUrlInJS(ctx, config, chunk, opts, code) {
|
|
15744
15820
|
const publicUrl = publicAssetUrlMap.get(hash).slice(1);
|
15745
15821
|
const replacement = toOutputFilePathInJS(publicUrl, 'public', chunk.fileName, 'js', config, toRelativeRuntime);
|
15746
15822
|
const replacementString = typeof replacement === 'string'
|
15747
|
-
? JSON.stringify(replacement).slice(1, -1)
|
15823
|
+
? JSON.stringify(encodeURI(replacement)).slice(1, -1)
|
15748
15824
|
: `"+${replacement.runtime}+"`;
|
15749
15825
|
s.update(match.index, match.index + full.length, replacementString);
|
15750
15826
|
}
|
@@ -15809,7 +15885,14 @@ function assetPlugin(config) {
|
|
15809
15885
|
url = injectQuery(url, `t=${mod.lastHMRTimestamp}`);
|
15810
15886
|
}
|
15811
15887
|
}
|
15812
|
-
return
|
15888
|
+
return {
|
15889
|
+
code: `export default ${JSON.stringify(url.startsWith('data:') ? url : encodeURI(url))}`,
|
15890
|
+
// Force rollup to keep this module from being shared between other entry points if it's an entrypoint.
|
15891
|
+
// If the resulting chunk is empty, it will be removed in generateBundle.
|
15892
|
+
moduleSideEffects: config.command === 'build' && this.getModuleInfo(id)?.isEntry
|
15893
|
+
? 'no-treeshake'
|
15894
|
+
: false,
|
15895
|
+
};
|
15813
15896
|
},
|
15814
15897
|
renderChunk(code, chunk, opts) {
|
15815
15898
|
const s = renderAssetUrlInJS(this, config, chunk, opts, code);
|
@@ -15826,6 +15909,16 @@ function assetPlugin(config) {
|
|
15826
15909
|
}
|
15827
15910
|
},
|
15828
15911
|
generateBundle(_, bundle) {
|
15912
|
+
// Remove empty entry point file
|
15913
|
+
for (const file in bundle) {
|
15914
|
+
const chunk = bundle[file];
|
15915
|
+
if (chunk.type === 'chunk' &&
|
15916
|
+
chunk.isEntry &&
|
15917
|
+
chunk.moduleIds.length === 1 &&
|
15918
|
+
config.assetsInclude(chunk.moduleIds[0])) {
|
15919
|
+
delete bundle[file];
|
15920
|
+
}
|
15921
|
+
}
|
15829
15922
|
// do not emit assets for SSR build
|
15830
15923
|
if (config.command === 'build' &&
|
15831
15924
|
config.build.ssr &&
|
@@ -15911,7 +16004,7 @@ async function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false
|
|
15911
16004
|
const file = cleanUrl(id);
|
15912
16005
|
const content = await fsp.readFile(file);
|
15913
16006
|
let url;
|
15914
|
-
if (shouldInline(config, file, id, content, forceInline)) {
|
16007
|
+
if (shouldInline(config, file, id, content, pluginContext, forceInline)) {
|
15915
16008
|
if (config.build.lib && isGitLfsPlaceholder(content)) {
|
15916
16009
|
config.logger.warn(colors$1.yellow(`Inlined file ${id} was not downloaded via Git LFS`));
|
15917
16010
|
}
|
@@ -15952,9 +16045,11 @@ async function urlToBuiltUrl(url, importer, config, pluginContext, forceInline)
|
|
15952
16045
|
// skip public check since we just did it above
|
15953
16046
|
true, forceInline);
|
15954
16047
|
}
|
15955
|
-
const shouldInline = (config, file, id, content, forceInline) => {
|
16048
|
+
const shouldInline = (config, file, id, content, pluginContext, forceInline) => {
|
15956
16049
|
if (config.build.lib)
|
15957
16050
|
return true;
|
16051
|
+
if (pluginContext.getModuleInfo(id)?.isEntry)
|
16052
|
+
return false;
|
15958
16053
|
if (forceInline !== undefined)
|
15959
16054
|
return forceInline;
|
15960
16055
|
let limit;
|
@@ -16028,6 +16123,7 @@ function manifestPlugin(config) {
|
|
16028
16123
|
function createChunk(chunk) {
|
16029
16124
|
const manifestChunk = {
|
16030
16125
|
file: chunk.fileName,
|
16126
|
+
name: chunk.name,
|
16031
16127
|
};
|
16032
16128
|
if (chunk.facadeModuleId) {
|
16033
16129
|
manifestChunk.src = getChunkName(chunk);
|
@@ -19810,8 +19906,8 @@ function fastqueue (context, worker, concurrency) {
|
|
19810
19906
|
|
19811
19907
|
var self = {
|
19812
19908
|
push: push,
|
19813
|
-
drain: noop$
|
19814
|
-
saturated: noop$
|
19909
|
+
drain: noop$3,
|
19910
|
+
saturated: noop$3,
|
19815
19911
|
pause: pause,
|
19816
19912
|
paused: false,
|
19817
19913
|
concurrency: concurrency,
|
@@ -19821,7 +19917,7 @@ function fastqueue (context, worker, concurrency) {
|
|
19821
19917
|
length: length,
|
19822
19918
|
getQueue: getQueue,
|
19823
19919
|
unshift: unshift,
|
19824
|
-
empty: noop$
|
19920
|
+
empty: noop$3,
|
19825
19921
|
kill: kill,
|
19826
19922
|
killAndDrain: killAndDrain,
|
19827
19923
|
error: error
|
@@ -19880,7 +19976,7 @@ function fastqueue (context, worker, concurrency) {
|
|
19880
19976
|
current.context = context;
|
19881
19977
|
current.release = release;
|
19882
19978
|
current.value = value;
|
19883
|
-
current.callback = done || noop$
|
19979
|
+
current.callback = done || noop$3;
|
19884
19980
|
current.errorHandler = errorHandler;
|
19885
19981
|
|
19886
19982
|
if (_running === self.concurrency || self.paused) {
|
@@ -19904,7 +20000,7 @@ function fastqueue (context, worker, concurrency) {
|
|
19904
20000
|
current.context = context;
|
19905
20001
|
current.release = release;
|
19906
20002
|
current.value = value;
|
19907
|
-
current.callback = done || noop$
|
20003
|
+
current.callback = done || noop$3;
|
19908
20004
|
|
19909
20005
|
if (_running === self.concurrency || self.paused) {
|
19910
20006
|
if (queueHead) {
|
@@ -19948,14 +20044,14 @@ function fastqueue (context, worker, concurrency) {
|
|
19948
20044
|
function kill () {
|
19949
20045
|
queueHead = null;
|
19950
20046
|
queueTail = null;
|
19951
|
-
self.drain = noop$
|
20047
|
+
self.drain = noop$3;
|
19952
20048
|
}
|
19953
20049
|
|
19954
20050
|
function killAndDrain () {
|
19955
20051
|
queueHead = null;
|
19956
20052
|
queueTail = null;
|
19957
20053
|
self.drain();
|
19958
|
-
self.drain = noop$
|
20054
|
+
self.drain = noop$3;
|
19959
20055
|
}
|
19960
20056
|
|
19961
20057
|
function error (handler) {
|
@@ -19963,13 +20059,13 @@ function fastqueue (context, worker, concurrency) {
|
|
19963
20059
|
}
|
19964
20060
|
}
|
19965
20061
|
|
19966
|
-
function noop$
|
20062
|
+
function noop$3 () {}
|
19967
20063
|
|
19968
20064
|
function Task () {
|
19969
20065
|
this.value = null;
|
19970
|
-
this.callback = noop$
|
20066
|
+
this.callback = noop$3;
|
19971
20067
|
this.next = null;
|
19972
|
-
this.release = noop$
|
20068
|
+
this.release = noop$3;
|
19973
20069
|
this.context = null;
|
19974
20070
|
this.errorHandler = null;
|
19975
20071
|
|
@@ -19980,7 +20076,7 @@ function Task () {
|
|
19980
20076
|
var errorHandler = self.errorHandler;
|
19981
20077
|
var val = self.value;
|
19982
20078
|
self.value = null;
|
19983
|
-
self.callback = noop$
|
20079
|
+
self.callback = noop$3;
|
19984
20080
|
if (self.errorHandler) {
|
19985
20081
|
errorHandler(err, val);
|
19986
20082
|
}
|
@@ -20028,7 +20124,7 @@ function queueAsPromised (context, worker, concurrency) {
|
|
20028
20124
|
// Let's fork the promise chain to
|
20029
20125
|
// make the error bubble up to the user but
|
20030
20126
|
// not lead to a unhandledRejection
|
20031
|
-
p.catch(noop$
|
20127
|
+
p.catch(noop$3);
|
20032
20128
|
|
20033
20129
|
return p
|
20034
20130
|
}
|
@@ -20047,7 +20143,7 @@ function queueAsPromised (context, worker, concurrency) {
|
|
20047
20143
|
// Let's fork the promise chain to
|
20048
20144
|
// make the error bubble up to the user but
|
20049
20145
|
// not lead to a unhandledRejection
|
20050
|
-
p.catch(noop$
|
20146
|
+
p.catch(noop$3);
|
20051
20147
|
|
20052
20148
|
return p
|
20053
20149
|
}
|
@@ -29693,7 +29789,7 @@ var require$$4 = {
|
|
29693
29789
|
const fs$9 = require$$0__default;
|
29694
29790
|
const path$9 = require$$0$4;
|
29695
29791
|
const os$2 = require$$2;
|
29696
|
-
const crypto$1 = require$$
|
29792
|
+
const crypto$1 = require$$3$1;
|
29697
29793
|
const packageJson = require$$4;
|
29698
29794
|
|
29699
29795
|
const version$1 = packageJson.version;
|
@@ -30361,7 +30457,7 @@ function traverseNodes(node, visitor) {
|
|
30361
30457
|
}
|
30362
30458
|
async function traverseHtml(html, filePath, visitor) {
|
30363
30459
|
// lazy load compiler
|
30364
|
-
const { parse } = await import('./dep-
|
30460
|
+
const { parse } = await import('./dep-CrWVpuYf.js');
|
30365
30461
|
const ast = parse(html, {
|
30366
30462
|
scriptingEnabled: false,
|
30367
30463
|
sourceCodeLocationInfo: true,
|
@@ -30543,7 +30639,7 @@ function buildHtmlPlugin(config) {
|
|
30543
30639
|
const isPublicFile = !!(url && checkPublicFile(url, config));
|
30544
30640
|
if (isPublicFile) {
|
30545
30641
|
// referencing public dir url, prefix with base
|
30546
|
-
overwriteAttrValue(s, sourceCodeLocation, toOutputPublicFilePath(url));
|
30642
|
+
overwriteAttrValue(s, sourceCodeLocation, partialEncodeURI(toOutputPublicFilePath(url)));
|
30547
30643
|
}
|
30548
30644
|
if (isModule) {
|
30549
30645
|
inlineModuleIndex++;
|
@@ -30587,23 +30683,25 @@ function buildHtmlPlugin(config) {
|
|
30587
30683
|
if (p.value && assetAttrs.includes(attrKey)) {
|
30588
30684
|
if (attrKey === 'srcset') {
|
30589
30685
|
assetUrlsPromises.push((async () => {
|
30590
|
-
const
|
30686
|
+
const processedEncodedUrl = await processSrcSet(p.value, async ({ url }) => {
|
30591
30687
|
const decodedUrl = decodeURI(url);
|
30592
30688
|
if (!isExcludedUrl(decodedUrl)) {
|
30593
30689
|
const result = await processAssetUrl(url);
|
30594
|
-
return result !== decodedUrl
|
30690
|
+
return result !== decodedUrl
|
30691
|
+
? encodeURI(result)
|
30692
|
+
: url;
|
30595
30693
|
}
|
30596
30694
|
return url;
|
30597
30695
|
});
|
30598
|
-
if (
|
30599
|
-
overwriteAttrValue(s, getAttrSourceCodeLocation(node, attrKey),
|
30696
|
+
if (processedEncodedUrl !== p.value) {
|
30697
|
+
overwriteAttrValue(s, getAttrSourceCodeLocation(node, attrKey), processedEncodedUrl);
|
30600
30698
|
}
|
30601
30699
|
})());
|
30602
30700
|
}
|
30603
30701
|
else {
|
30604
30702
|
const url = decodeURI(p.value);
|
30605
30703
|
if (checkPublicFile(url, config)) {
|
30606
|
-
overwriteAttrValue(s, getAttrSourceCodeLocation(node, attrKey), toOutputPublicFilePath(url));
|
30704
|
+
overwriteAttrValue(s, getAttrSourceCodeLocation(node, attrKey), partialEncodeURI(toOutputPublicFilePath(url)));
|
30607
30705
|
}
|
30608
30706
|
else if (!isExcludedUrl(url)) {
|
30609
30707
|
if (node.nodeName === 'link' &&
|
@@ -30632,7 +30730,7 @@ function buildHtmlPlugin(config) {
|
|
30632
30730
|
assetUrlsPromises.push((async () => {
|
30633
30731
|
const processedUrl = await processAssetUrl(url, shouldInline);
|
30634
30732
|
if (processedUrl !== url) {
|
30635
|
-
overwriteAttrValue(s, getAttrSourceCodeLocation(node, attrKey), processedUrl);
|
30733
|
+
overwriteAttrValue(s, getAttrSourceCodeLocation(node, attrKey), partialEncodeURI(processedUrl));
|
30636
30734
|
}
|
30637
30735
|
})());
|
30638
30736
|
}
|
@@ -30682,10 +30780,10 @@ function buildHtmlPlugin(config) {
|
|
30682
30780
|
// emit <script>import("./aaa")</script> asset
|
30683
30781
|
for (const { start, end, url } of scriptUrls) {
|
30684
30782
|
if (checkPublicFile(url, config)) {
|
30685
|
-
s.update(start, end, toOutputPublicFilePath(url));
|
30783
|
+
s.update(start, end, partialEncodeURI(toOutputPublicFilePath(url)));
|
30686
30784
|
}
|
30687
30785
|
else if (!isExcludedUrl(url)) {
|
30688
|
-
s.update(start, end, await urlToBuiltUrl(url, id, config, this));
|
30786
|
+
s.update(start, end, partialEncodeURI(await urlToBuiltUrl(url, id, config, this)));
|
30689
30787
|
}
|
30690
30788
|
}
|
30691
30789
|
// ignore <link rel="stylesheet"> if its url can't be resolved
|
@@ -30876,13 +30974,13 @@ function buildHtmlPlugin(config) {
|
|
30876
30974
|
if (chunk) {
|
30877
30975
|
chunk.viteMetadata.importedAssets.add(cleanUrl(file));
|
30878
30976
|
}
|
30879
|
-
return toOutputAssetFilePath(file) + postfix;
|
30977
|
+
return encodeURI(toOutputAssetFilePath(file)) + postfix;
|
30880
30978
|
});
|
30881
30979
|
result = result.replace(publicAssetUrlRE, (_, fileHash) => {
|
30882
30980
|
const publicAssetPath = toOutputPublicAssetFilePath(getPublicAssetFilename(fileHash, config));
|
30883
|
-
return urlCanParse(publicAssetPath)
|
30981
|
+
return encodeURI(urlCanParse(publicAssetPath)
|
30884
30982
|
? publicAssetPath
|
30885
|
-
: normalizePath$3(publicAssetPath);
|
30983
|
+
: normalizePath$3(publicAssetPath));
|
30886
30984
|
});
|
30887
30985
|
if (chunk && canInlineEntry) {
|
30888
30986
|
inlineEntryChunk.add(chunk.fileName);
|
@@ -31472,7 +31570,7 @@ function cssPostPlugin(config) {
|
|
31472
31570
|
map: { mappings: '' },
|
31473
31571
|
// avoid the css module from being tree-shaken so that we can retrieve
|
31474
31572
|
// it in renderChunk()
|
31475
|
-
moduleSideEffects: inlined ? false : 'no-treeshake',
|
31573
|
+
moduleSideEffects: modulesCode || inlined ? false : 'no-treeshake',
|
31476
31574
|
};
|
31477
31575
|
},
|
31478
31576
|
async renderChunk(code, chunk, opts) {
|
@@ -31514,14 +31612,14 @@ function cssPostPlugin(config) {
|
|
31514
31612
|
chunkCSS = chunkCSS.replace(assetUrlRE, (_, fileHash, postfix = '') => {
|
31515
31613
|
const filename = this.getFileName(fileHash) + postfix;
|
31516
31614
|
chunk.viteMetadata.importedAssets.add(cleanUrl(filename));
|
31517
|
-
return toOutputFilePathInCss(filename, 'asset', cssAssetName, 'css', config, toRelative);
|
31615
|
+
return encodeURI(toOutputFilePathInCss(filename, 'asset', cssAssetName, 'css', config, toRelative));
|
31518
31616
|
});
|
31519
31617
|
// resolve public URL from CSS paths
|
31520
31618
|
if (encodedPublicUrls) {
|
31521
31619
|
const relativePathToPublicFromCSS = path$o.posix.relative(cssAssetDirname, '');
|
31522
31620
|
chunkCSS = chunkCSS.replace(publicAssetUrlRE, (_, hash) => {
|
31523
31621
|
const publicUrl = publicAssetUrlMap.get(hash).slice(1);
|
31524
|
-
return toOutputFilePathInCss(publicUrl, 'public', cssAssetName, 'css', config, () => `${relativePathToPublicFromCSS}/${publicUrl}`);
|
31622
|
+
return encodeURI(toOutputFilePathInCss(publicUrl, 'public', cssAssetName, 'css', config, () => `${relativePathToPublicFromCSS}/${publicUrl}`));
|
31525
31623
|
});
|
31526
31624
|
}
|
31527
31625
|
return chunkCSS;
|
@@ -31572,7 +31670,7 @@ function cssPostPlugin(config) {
|
|
31572
31670
|
.set(referenceId, { originalName: originalFilename });
|
31573
31671
|
const replacement = toOutputFilePathInJS(this.getFileName(referenceId), 'asset', chunk.fileName, 'js', config, toRelativeRuntime);
|
31574
31672
|
const replacementString = typeof replacement === 'string'
|
31575
|
-
? JSON.stringify(replacement).slice(1, -1)
|
31673
|
+
? JSON.stringify(encodeURI(replacement)).slice(1, -1)
|
31576
31674
|
: `"+${replacement.runtime}+"`;
|
31577
31675
|
s.update(start, end, replacementString);
|
31578
31676
|
}
|
@@ -32106,8 +32204,8 @@ function createCachedImport(imp) {
|
|
32106
32204
|
return cached;
|
32107
32205
|
};
|
32108
32206
|
}
|
32109
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
32110
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
32207
|
+
const importPostcssImport = createCachedImport(() => import('./dep-DeEXZBZL.js').then(function (n) { return n.i; }));
|
32208
|
+
const importPostcssModules = createCachedImport(() => import('./dep-6MdzGidO.js').then(function (n) { return n.i; }));
|
32111
32209
|
const importPostcss = createCachedImport(() => import('postcss'));
|
32112
32210
|
const preprocessorWorkerControllerCache = new WeakMap();
|
32113
32211
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -40403,7 +40501,7 @@ function isVirtualModule(id) {
|
|
40403
40501
|
|
40404
40502
|
var src = {exports: {}};
|
40405
40503
|
|
40406
|
-
var
|
40504
|
+
var browser = {exports: {}};
|
40407
40505
|
|
40408
40506
|
var debug$f = {exports: {}};
|
40409
40507
|
|
@@ -40779,266 +40877,6 @@ function requireDebug () {
|
|
40779
40877
|
return debug$f.exports;
|
40780
40878
|
}
|
40781
40879
|
|
40782
|
-
/**
|
40783
|
-
* Module dependencies.
|
40784
|
-
*/
|
40785
|
-
|
40786
|
-
var hasRequiredNode;
|
40787
|
-
|
40788
|
-
function requireNode () {
|
40789
|
-
if (hasRequiredNode) return node.exports;
|
40790
|
-
hasRequiredNode = 1;
|
40791
|
-
(function (module, exports) {
|
40792
|
-
var tty = require$$0$3;
|
40793
|
-
var util = require$$0$6;
|
40794
|
-
|
40795
|
-
/**
|
40796
|
-
* This is the Node.js implementation of `debug()`.
|
40797
|
-
*
|
40798
|
-
* Expose `debug()` as the module.
|
40799
|
-
*/
|
40800
|
-
|
40801
|
-
exports = module.exports = requireDebug();
|
40802
|
-
exports.init = init;
|
40803
|
-
exports.log = log;
|
40804
|
-
exports.formatArgs = formatArgs;
|
40805
|
-
exports.save = save;
|
40806
|
-
exports.load = load;
|
40807
|
-
exports.useColors = useColors;
|
40808
|
-
|
40809
|
-
/**
|
40810
|
-
* Colors.
|
40811
|
-
*/
|
40812
|
-
|
40813
|
-
exports.colors = [6, 2, 3, 4, 5, 1];
|
40814
|
-
|
40815
|
-
/**
|
40816
|
-
* Build up the default `inspectOpts` object from the environment variables.
|
40817
|
-
*
|
40818
|
-
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
40819
|
-
*/
|
40820
|
-
|
40821
|
-
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
|
40822
|
-
return /^debug_/i.test(key);
|
40823
|
-
}).reduce(function (obj, key) {
|
40824
|
-
// camel-case
|
40825
|
-
var prop = key
|
40826
|
-
.substring(6)
|
40827
|
-
.toLowerCase()
|
40828
|
-
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
|
40829
|
-
|
40830
|
-
// coerce string value into JS value
|
40831
|
-
var val = process.env[key];
|
40832
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
40833
|
-
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
40834
|
-
else if (val === 'null') val = null;
|
40835
|
-
else val = Number(val);
|
40836
|
-
|
40837
|
-
obj[prop] = val;
|
40838
|
-
return obj;
|
40839
|
-
}, {});
|
40840
|
-
|
40841
|
-
/**
|
40842
|
-
* The file descriptor to write the `debug()` calls to.
|
40843
|
-
* Set the `DEBUG_FD` env variable to override with another value. i.e.:
|
40844
|
-
*
|
40845
|
-
* $ DEBUG_FD=3 node script.js 3>debug.log
|
40846
|
-
*/
|
40847
|
-
|
40848
|
-
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
|
40849
|
-
|
40850
|
-
if (1 !== fd && 2 !== fd) {
|
40851
|
-
util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')();
|
40852
|
-
}
|
40853
|
-
|
40854
|
-
var stream = 1 === fd ? process.stdout :
|
40855
|
-
2 === fd ? process.stderr :
|
40856
|
-
createWritableStdioStream(fd);
|
40857
|
-
|
40858
|
-
/**
|
40859
|
-
* Is stdout a TTY? Colored output is enabled when `true`.
|
40860
|
-
*/
|
40861
|
-
|
40862
|
-
function useColors() {
|
40863
|
-
return 'colors' in exports.inspectOpts
|
40864
|
-
? Boolean(exports.inspectOpts.colors)
|
40865
|
-
: tty.isatty(fd);
|
40866
|
-
}
|
40867
|
-
|
40868
|
-
/**
|
40869
|
-
* Map %o to `util.inspect()`, all on a single line.
|
40870
|
-
*/
|
40871
|
-
|
40872
|
-
exports.formatters.o = function(v) {
|
40873
|
-
this.inspectOpts.colors = this.useColors;
|
40874
|
-
return util.inspect(v, this.inspectOpts)
|
40875
|
-
.split('\n').map(function(str) {
|
40876
|
-
return str.trim()
|
40877
|
-
}).join(' ');
|
40878
|
-
};
|
40879
|
-
|
40880
|
-
/**
|
40881
|
-
* Map %o to `util.inspect()`, allowing multiple lines if needed.
|
40882
|
-
*/
|
40883
|
-
|
40884
|
-
exports.formatters.O = function(v) {
|
40885
|
-
this.inspectOpts.colors = this.useColors;
|
40886
|
-
return util.inspect(v, this.inspectOpts);
|
40887
|
-
};
|
40888
|
-
|
40889
|
-
/**
|
40890
|
-
* Adds ANSI color escape codes if enabled.
|
40891
|
-
*
|
40892
|
-
* @api public
|
40893
|
-
*/
|
40894
|
-
|
40895
|
-
function formatArgs(args) {
|
40896
|
-
var name = this.namespace;
|
40897
|
-
var useColors = this.useColors;
|
40898
|
-
|
40899
|
-
if (useColors) {
|
40900
|
-
var c = this.color;
|
40901
|
-
var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
|
40902
|
-
|
40903
|
-
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
40904
|
-
args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
|
40905
|
-
} else {
|
40906
|
-
args[0] = new Date().toUTCString()
|
40907
|
-
+ ' ' + name + ' ' + args[0];
|
40908
|
-
}
|
40909
|
-
}
|
40910
|
-
|
40911
|
-
/**
|
40912
|
-
* Invokes `util.format()` with the specified arguments and writes to `stream`.
|
40913
|
-
*/
|
40914
|
-
|
40915
|
-
function log() {
|
40916
|
-
return stream.write(util.format.apply(util, arguments) + '\n');
|
40917
|
-
}
|
40918
|
-
|
40919
|
-
/**
|
40920
|
-
* Save `namespaces`.
|
40921
|
-
*
|
40922
|
-
* @param {String} namespaces
|
40923
|
-
* @api private
|
40924
|
-
*/
|
40925
|
-
|
40926
|
-
function save(namespaces) {
|
40927
|
-
if (null == namespaces) {
|
40928
|
-
// If you set a process.env field to null or undefined, it gets cast to the
|
40929
|
-
// string 'null' or 'undefined'. Just delete instead.
|
40930
|
-
delete process.env.DEBUG;
|
40931
|
-
} else {
|
40932
|
-
process.env.DEBUG = namespaces;
|
40933
|
-
}
|
40934
|
-
}
|
40935
|
-
|
40936
|
-
/**
|
40937
|
-
* Load `namespaces`.
|
40938
|
-
*
|
40939
|
-
* @return {String} returns the previously persisted debug modes
|
40940
|
-
* @api private
|
40941
|
-
*/
|
40942
|
-
|
40943
|
-
function load() {
|
40944
|
-
return process.env.DEBUG;
|
40945
|
-
}
|
40946
|
-
|
40947
|
-
/**
|
40948
|
-
* Copied from `node/src/node.js`.
|
40949
|
-
*
|
40950
|
-
* XXX: It's lame that node doesn't expose this API out-of-the-box. It also
|
40951
|
-
* relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
|
40952
|
-
*/
|
40953
|
-
|
40954
|
-
function createWritableStdioStream (fd) {
|
40955
|
-
var stream;
|
40956
|
-
var tty_wrap = process.binding('tty_wrap');
|
40957
|
-
|
40958
|
-
// Note stream._type is used for test-module-load-list.js
|
40959
|
-
|
40960
|
-
switch (tty_wrap.guessHandleType(fd)) {
|
40961
|
-
case 'TTY':
|
40962
|
-
stream = new tty.WriteStream(fd);
|
40963
|
-
stream._type = 'tty';
|
40964
|
-
|
40965
|
-
// Hack to have stream not keep the event loop alive.
|
40966
|
-
// See https://github.com/joyent/node/issues/1726
|
40967
|
-
if (stream._handle && stream._handle.unref) {
|
40968
|
-
stream._handle.unref();
|
40969
|
-
}
|
40970
|
-
break;
|
40971
|
-
|
40972
|
-
case 'FILE':
|
40973
|
-
var fs = require$$0__default;
|
40974
|
-
stream = new fs.SyncWriteStream(fd, { autoClose: false });
|
40975
|
-
stream._type = 'fs';
|
40976
|
-
break;
|
40977
|
-
|
40978
|
-
case 'PIPE':
|
40979
|
-
case 'TCP':
|
40980
|
-
var net = require$$4$1;
|
40981
|
-
stream = new net.Socket({
|
40982
|
-
fd: fd,
|
40983
|
-
readable: false,
|
40984
|
-
writable: true
|
40985
|
-
});
|
40986
|
-
|
40987
|
-
// FIXME Should probably have an option in net.Socket to create a
|
40988
|
-
// stream from an existing fd which is writable only. But for now
|
40989
|
-
// we'll just add this hack and set the `readable` member to false.
|
40990
|
-
// Test: ./node test/fixtures/echo.js < /etc/passwd
|
40991
|
-
stream.readable = false;
|
40992
|
-
stream.read = null;
|
40993
|
-
stream._type = 'pipe';
|
40994
|
-
|
40995
|
-
// FIXME Hack to have stream not keep the event loop alive.
|
40996
|
-
// See https://github.com/joyent/node/issues/1726
|
40997
|
-
if (stream._handle && stream._handle.unref) {
|
40998
|
-
stream._handle.unref();
|
40999
|
-
}
|
41000
|
-
break;
|
41001
|
-
|
41002
|
-
default:
|
41003
|
-
// Probably an error on in uv_guess_handle()
|
41004
|
-
throw new Error('Implement me. Unknown stream file type!');
|
41005
|
-
}
|
41006
|
-
|
41007
|
-
// For supporting legacy API we put the FD here.
|
41008
|
-
stream.fd = fd;
|
41009
|
-
|
41010
|
-
stream._isStdio = true;
|
41011
|
-
|
41012
|
-
return stream;
|
41013
|
-
}
|
41014
|
-
|
41015
|
-
/**
|
41016
|
-
* Init logic for `debug` instances.
|
41017
|
-
*
|
41018
|
-
* Create a new `inspectOpts` object in case `useColors` is set
|
41019
|
-
* differently for a particular `debug` instance.
|
41020
|
-
*/
|
41021
|
-
|
41022
|
-
function init (debug) {
|
41023
|
-
debug.inspectOpts = {};
|
41024
|
-
|
41025
|
-
var keys = Object.keys(exports.inspectOpts);
|
41026
|
-
for (var i = 0; i < keys.length; i++) {
|
41027
|
-
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
41028
|
-
}
|
41029
|
-
}
|
41030
|
-
|
41031
|
-
/**
|
41032
|
-
* Enable namespaces listed in `process.env.DEBUG` initially.
|
41033
|
-
*/
|
41034
|
-
|
41035
|
-
exports.enable(load());
|
41036
|
-
} (node, node.exports));
|
41037
|
-
return node.exports;
|
41038
|
-
}
|
41039
|
-
|
41040
|
-
var browser = {exports: {}};
|
41041
|
-
|
41042
40880
|
/**
|
41043
40881
|
* This is the web browser implementation of `debug()`.
|
41044
40882
|
*
|
@@ -41234,6 +41072,266 @@ function requireBrowser () {
|
|
41234
41072
|
return browser.exports;
|
41235
41073
|
}
|
41236
41074
|
|
41075
|
+
var node = {exports: {}};
|
41076
|
+
|
41077
|
+
/**
|
41078
|
+
* Module dependencies.
|
41079
|
+
*/
|
41080
|
+
|
41081
|
+
var hasRequiredNode;
|
41082
|
+
|
41083
|
+
function requireNode () {
|
41084
|
+
if (hasRequiredNode) return node.exports;
|
41085
|
+
hasRequiredNode = 1;
|
41086
|
+
(function (module, exports) {
|
41087
|
+
var tty = require$$0$3;
|
41088
|
+
var util = require$$0$6;
|
41089
|
+
|
41090
|
+
/**
|
41091
|
+
* This is the Node.js implementation of `debug()`.
|
41092
|
+
*
|
41093
|
+
* Expose `debug()` as the module.
|
41094
|
+
*/
|
41095
|
+
|
41096
|
+
exports = module.exports = requireDebug();
|
41097
|
+
exports.init = init;
|
41098
|
+
exports.log = log;
|
41099
|
+
exports.formatArgs = formatArgs;
|
41100
|
+
exports.save = save;
|
41101
|
+
exports.load = load;
|
41102
|
+
exports.useColors = useColors;
|
41103
|
+
|
41104
|
+
/**
|
41105
|
+
* Colors.
|
41106
|
+
*/
|
41107
|
+
|
41108
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
41109
|
+
|
41110
|
+
/**
|
41111
|
+
* Build up the default `inspectOpts` object from the environment variables.
|
41112
|
+
*
|
41113
|
+
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
41114
|
+
*/
|
41115
|
+
|
41116
|
+
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
|
41117
|
+
return /^debug_/i.test(key);
|
41118
|
+
}).reduce(function (obj, key) {
|
41119
|
+
// camel-case
|
41120
|
+
var prop = key
|
41121
|
+
.substring(6)
|
41122
|
+
.toLowerCase()
|
41123
|
+
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
|
41124
|
+
|
41125
|
+
// coerce string value into JS value
|
41126
|
+
var val = process.env[key];
|
41127
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
41128
|
+
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
41129
|
+
else if (val === 'null') val = null;
|
41130
|
+
else val = Number(val);
|
41131
|
+
|
41132
|
+
obj[prop] = val;
|
41133
|
+
return obj;
|
41134
|
+
}, {});
|
41135
|
+
|
41136
|
+
/**
|
41137
|
+
* The file descriptor to write the `debug()` calls to.
|
41138
|
+
* Set the `DEBUG_FD` env variable to override with another value. i.e.:
|
41139
|
+
*
|
41140
|
+
* $ DEBUG_FD=3 node script.js 3>debug.log
|
41141
|
+
*/
|
41142
|
+
|
41143
|
+
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
|
41144
|
+
|
41145
|
+
if (1 !== fd && 2 !== fd) {
|
41146
|
+
util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')();
|
41147
|
+
}
|
41148
|
+
|
41149
|
+
var stream = 1 === fd ? process.stdout :
|
41150
|
+
2 === fd ? process.stderr :
|
41151
|
+
createWritableStdioStream(fd);
|
41152
|
+
|
41153
|
+
/**
|
41154
|
+
* Is stdout a TTY? Colored output is enabled when `true`.
|
41155
|
+
*/
|
41156
|
+
|
41157
|
+
function useColors() {
|
41158
|
+
return 'colors' in exports.inspectOpts
|
41159
|
+
? Boolean(exports.inspectOpts.colors)
|
41160
|
+
: tty.isatty(fd);
|
41161
|
+
}
|
41162
|
+
|
41163
|
+
/**
|
41164
|
+
* Map %o to `util.inspect()`, all on a single line.
|
41165
|
+
*/
|
41166
|
+
|
41167
|
+
exports.formatters.o = function(v) {
|
41168
|
+
this.inspectOpts.colors = this.useColors;
|
41169
|
+
return util.inspect(v, this.inspectOpts)
|
41170
|
+
.split('\n').map(function(str) {
|
41171
|
+
return str.trim()
|
41172
|
+
}).join(' ');
|
41173
|
+
};
|
41174
|
+
|
41175
|
+
/**
|
41176
|
+
* Map %o to `util.inspect()`, allowing multiple lines if needed.
|
41177
|
+
*/
|
41178
|
+
|
41179
|
+
exports.formatters.O = function(v) {
|
41180
|
+
this.inspectOpts.colors = this.useColors;
|
41181
|
+
return util.inspect(v, this.inspectOpts);
|
41182
|
+
};
|
41183
|
+
|
41184
|
+
/**
|
41185
|
+
* Adds ANSI color escape codes if enabled.
|
41186
|
+
*
|
41187
|
+
* @api public
|
41188
|
+
*/
|
41189
|
+
|
41190
|
+
function formatArgs(args) {
|
41191
|
+
var name = this.namespace;
|
41192
|
+
var useColors = this.useColors;
|
41193
|
+
|
41194
|
+
if (useColors) {
|
41195
|
+
var c = this.color;
|
41196
|
+
var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
|
41197
|
+
|
41198
|
+
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
41199
|
+
args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
|
41200
|
+
} else {
|
41201
|
+
args[0] = new Date().toUTCString()
|
41202
|
+
+ ' ' + name + ' ' + args[0];
|
41203
|
+
}
|
41204
|
+
}
|
41205
|
+
|
41206
|
+
/**
|
41207
|
+
* Invokes `util.format()` with the specified arguments and writes to `stream`.
|
41208
|
+
*/
|
41209
|
+
|
41210
|
+
function log() {
|
41211
|
+
return stream.write(util.format.apply(util, arguments) + '\n');
|
41212
|
+
}
|
41213
|
+
|
41214
|
+
/**
|
41215
|
+
* Save `namespaces`.
|
41216
|
+
*
|
41217
|
+
* @param {String} namespaces
|
41218
|
+
* @api private
|
41219
|
+
*/
|
41220
|
+
|
41221
|
+
function save(namespaces) {
|
41222
|
+
if (null == namespaces) {
|
41223
|
+
// If you set a process.env field to null or undefined, it gets cast to the
|
41224
|
+
// string 'null' or 'undefined'. Just delete instead.
|
41225
|
+
delete process.env.DEBUG;
|
41226
|
+
} else {
|
41227
|
+
process.env.DEBUG = namespaces;
|
41228
|
+
}
|
41229
|
+
}
|
41230
|
+
|
41231
|
+
/**
|
41232
|
+
* Load `namespaces`.
|
41233
|
+
*
|
41234
|
+
* @return {String} returns the previously persisted debug modes
|
41235
|
+
* @api private
|
41236
|
+
*/
|
41237
|
+
|
41238
|
+
function load() {
|
41239
|
+
return process.env.DEBUG;
|
41240
|
+
}
|
41241
|
+
|
41242
|
+
/**
|
41243
|
+
* Copied from `node/src/node.js`.
|
41244
|
+
*
|
41245
|
+
* XXX: It's lame that node doesn't expose this API out-of-the-box. It also
|
41246
|
+
* relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
|
41247
|
+
*/
|
41248
|
+
|
41249
|
+
function createWritableStdioStream (fd) {
|
41250
|
+
var stream;
|
41251
|
+
var tty_wrap = process.binding('tty_wrap');
|
41252
|
+
|
41253
|
+
// Note stream._type is used for test-module-load-list.js
|
41254
|
+
|
41255
|
+
switch (tty_wrap.guessHandleType(fd)) {
|
41256
|
+
case 'TTY':
|
41257
|
+
stream = new tty.WriteStream(fd);
|
41258
|
+
stream._type = 'tty';
|
41259
|
+
|
41260
|
+
// Hack to have stream not keep the event loop alive.
|
41261
|
+
// See https://github.com/joyent/node/issues/1726
|
41262
|
+
if (stream._handle && stream._handle.unref) {
|
41263
|
+
stream._handle.unref();
|
41264
|
+
}
|
41265
|
+
break;
|
41266
|
+
|
41267
|
+
case 'FILE':
|
41268
|
+
var fs = require$$0__default;
|
41269
|
+
stream = new fs.SyncWriteStream(fd, { autoClose: false });
|
41270
|
+
stream._type = 'fs';
|
41271
|
+
break;
|
41272
|
+
|
41273
|
+
case 'PIPE':
|
41274
|
+
case 'TCP':
|
41275
|
+
var net = require$$4$1;
|
41276
|
+
stream = new net.Socket({
|
41277
|
+
fd: fd,
|
41278
|
+
readable: false,
|
41279
|
+
writable: true
|
41280
|
+
});
|
41281
|
+
|
41282
|
+
// FIXME Should probably have an option in net.Socket to create a
|
41283
|
+
// stream from an existing fd which is writable only. But for now
|
41284
|
+
// we'll just add this hack and set the `readable` member to false.
|
41285
|
+
// Test: ./node test/fixtures/echo.js < /etc/passwd
|
41286
|
+
stream.readable = false;
|
41287
|
+
stream.read = null;
|
41288
|
+
stream._type = 'pipe';
|
41289
|
+
|
41290
|
+
// FIXME Hack to have stream not keep the event loop alive.
|
41291
|
+
// See https://github.com/joyent/node/issues/1726
|
41292
|
+
if (stream._handle && stream._handle.unref) {
|
41293
|
+
stream._handle.unref();
|
41294
|
+
}
|
41295
|
+
break;
|
41296
|
+
|
41297
|
+
default:
|
41298
|
+
// Probably an error on in uv_guess_handle()
|
41299
|
+
throw new Error('Implement me. Unknown stream file type!');
|
41300
|
+
}
|
41301
|
+
|
41302
|
+
// For supporting legacy API we put the FD here.
|
41303
|
+
stream.fd = fd;
|
41304
|
+
|
41305
|
+
stream._isStdio = true;
|
41306
|
+
|
41307
|
+
return stream;
|
41308
|
+
}
|
41309
|
+
|
41310
|
+
/**
|
41311
|
+
* Init logic for `debug` instances.
|
41312
|
+
*
|
41313
|
+
* Create a new `inspectOpts` object in case `useColors` is set
|
41314
|
+
* differently for a particular `debug` instance.
|
41315
|
+
*/
|
41316
|
+
|
41317
|
+
function init (debug) {
|
41318
|
+
debug.inspectOpts = {};
|
41319
|
+
|
41320
|
+
var keys = Object.keys(exports.inspectOpts);
|
41321
|
+
for (var i = 0; i < keys.length; i++) {
|
41322
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
41323
|
+
}
|
41324
|
+
}
|
41325
|
+
|
41326
|
+
/**
|
41327
|
+
* Enable namespaces listed in `process.env.DEBUG` initially.
|
41328
|
+
*/
|
41329
|
+
|
41330
|
+
exports.enable(load());
|
41331
|
+
} (node, node.exports));
|
41332
|
+
return node.exports;
|
41333
|
+
}
|
41334
|
+
|
41237
41335
|
/**
|
41238
41336
|
* Detect Electron renderer process, which is node, but we should
|
41239
41337
|
* treat as a browser.
|
@@ -47281,7 +47379,7 @@ var etag_1 = etag;
|
|
47281
47379
|
* @private
|
47282
47380
|
*/
|
47283
47381
|
|
47284
|
-
var crypto = require$$
|
47382
|
+
var crypto = require$$3$1;
|
47285
47383
|
var Stats = require$$0__default.Stats;
|
47286
47384
|
|
47287
47385
|
/**
|
@@ -47586,7 +47684,8 @@ function resolvePlugin(resolveOptions) {
|
|
47586
47684
|
// externalize if building for SSR, otherwise redirect to empty module
|
47587
47685
|
if (isBuiltin(id)) {
|
47588
47686
|
if (ssr) {
|
47589
|
-
if (
|
47687
|
+
if (targetWeb &&
|
47688
|
+
ssrNoExternal === true &&
|
47590
47689
|
// if both noExternal and external are true, noExternal will take the higher priority and bundle it.
|
47591
47690
|
// only if the id is explicitly listed in external, we will externalize it and skip this error.
|
47592
47691
|
(ssrExternal === true || !ssrExternal?.includes(id))) {
|
@@ -47792,7 +47891,17 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr = f
|
|
47792
47891
|
else {
|
47793
47892
|
basedir = root;
|
47794
47893
|
}
|
47795
|
-
|
47894
|
+
let selfPkg = null;
|
47895
|
+
if (!isBuiltin(id) && !id.includes('\0') && bareImportRE.test(id)) {
|
47896
|
+
// check if it's a self reference dep.
|
47897
|
+
const selfPackageData = findNearestPackageData(basedir, packageCache);
|
47898
|
+
selfPkg =
|
47899
|
+
selfPackageData?.data.exports && selfPackageData?.data.name === pkgId
|
47900
|
+
? selfPackageData
|
47901
|
+
: null;
|
47902
|
+
}
|
47903
|
+
const pkg = selfPkg ||
|
47904
|
+
resolvePackageData(pkgId, basedir, preserveSymlinks, packageCache);
|
47796
47905
|
if (!pkg) {
|
47797
47906
|
// if import can't be found, check if it's an optional peer dep.
|
47798
47907
|
// if so, we can resolve to a special id that errors only when imported.
|
@@ -49077,18 +49186,23 @@ const inlineRE = /[?&]inline\b/;
|
|
49077
49186
|
const WORKER_FILE_ID = 'worker_file';
|
49078
49187
|
const workerCache = new WeakMap();
|
49079
49188
|
function saveEmitWorkerAsset(config, asset) {
|
49080
|
-
const fileName = asset.fileName;
|
49081
49189
|
const workerMap = workerCache.get(config.mainConfig || config);
|
49082
|
-
workerMap.assets.set(fileName, asset);
|
49190
|
+
workerMap.assets.set(asset.fileName, asset);
|
49083
49191
|
}
|
49084
49192
|
async function bundleWorkerEntry(config, id) {
|
49193
|
+
const input = cleanUrl(id);
|
49194
|
+
const newBundleChain = [...config.bundleChain, input];
|
49195
|
+
if (config.bundleChain.includes(input)) {
|
49196
|
+
throw new Error('Circular worker imports detected. Vite does not support it. ' +
|
49197
|
+
`Import chain: ${newBundleChain.map((id) => prettifyUrl(id, config.root)).join(' -> ')}`);
|
49198
|
+
}
|
49085
49199
|
// bundle the file as entry to support imports
|
49086
49200
|
const { rollup } = await import('rollup');
|
49087
49201
|
const { plugins, rollupOptions, format } = config.worker;
|
49088
49202
|
const bundle = await rollup({
|
49089
49203
|
...rollupOptions,
|
49090
|
-
input
|
49091
|
-
plugins: await plugins(),
|
49204
|
+
input,
|
49205
|
+
plugins: await plugins(newBundleChain),
|
49092
49206
|
onwarn(warning, warn) {
|
49093
49207
|
onRollupWarning(warning, warn, config);
|
49094
49208
|
},
|
@@ -49119,7 +49233,6 @@ async function bundleWorkerEntry(config, id) {
|
|
49119
49233
|
saveEmitWorkerAsset(config, {
|
49120
49234
|
fileName: outputChunk.fileName,
|
49121
49235
|
source: outputChunk.code,
|
49122
|
-
type: 'asset',
|
49123
49236
|
});
|
49124
49237
|
}
|
49125
49238
|
});
|
@@ -49138,7 +49251,6 @@ function emitSourcemapForWorkerEntry(config, chunk) {
|
|
49138
49251
|
const mapFileName = chunk.fileName + '.map';
|
49139
49252
|
saveEmitWorkerAsset(config, {
|
49140
49253
|
fileName: mapFileName,
|
49141
|
-
type: 'asset',
|
49142
49254
|
source: data,
|
49143
49255
|
});
|
49144
49256
|
}
|
@@ -49163,7 +49275,6 @@ async function workerFileToUrl(config, id) {
|
|
49163
49275
|
saveEmitWorkerAsset(config, {
|
49164
49276
|
fileName,
|
49165
49277
|
source: outputChunk.code,
|
49166
|
-
type: 'asset',
|
49167
49278
|
});
|
49168
49279
|
workerMap.bundle.set(id, fileName);
|
49169
49280
|
}
|
@@ -49260,8 +49371,6 @@ function webWorkerPlugin(config) {
|
|
49260
49371
|
const workerMatch = workerOrSharedWorkerRE.exec(id);
|
49261
49372
|
if (!workerMatch)
|
49262
49373
|
return;
|
49263
|
-
// stringified url or `new URL(...)`
|
49264
|
-
let url;
|
49265
49374
|
const { format } = config.worker;
|
49266
49375
|
const workerConstructor = workerMatch[1] === 'sharedworker' ? 'SharedWorker' : 'Worker';
|
49267
49376
|
const workerType = isBuild
|
@@ -49273,8 +49382,12 @@ function webWorkerPlugin(config) {
|
|
49273
49382
|
${workerType === 'module' ? `type: "module",` : ''}
|
49274
49383
|
name: options?.name
|
49275
49384
|
}`;
|
49385
|
+
let urlCode;
|
49276
49386
|
if (isBuild) {
|
49277
|
-
if (
|
49387
|
+
if (isWorker && this.getModuleInfo(cleanUrl(id))?.isEntry) {
|
49388
|
+
urlCode = 'self.location.href';
|
49389
|
+
}
|
49390
|
+
else if (inlineRE.test(id)) {
|
49278
49391
|
const chunk = await bundleWorkerEntry(config, id);
|
49279
49392
|
const encodedJs = `const encodedJs = "${Buffer.from(chunk.code).toString('base64')}";`;
|
49280
49393
|
const code =
|
@@ -49325,23 +49438,24 @@ function webWorkerPlugin(config) {
|
|
49325
49438
|
};
|
49326
49439
|
}
|
49327
49440
|
else {
|
49328
|
-
|
49441
|
+
urlCode = JSON.stringify(await workerFileToUrl(config, id));
|
49329
49442
|
}
|
49330
49443
|
}
|
49331
49444
|
else {
|
49332
|
-
url = await fileToUrl$1(cleanUrl(id), config, this);
|
49445
|
+
let url = await fileToUrl$1(cleanUrl(id), config, this);
|
49333
49446
|
url = injectQuery(url, `${WORKER_FILE_ID}&type=${workerType}`);
|
49447
|
+
urlCode = JSON.stringify(url);
|
49334
49448
|
}
|
49335
49449
|
if (urlRE.test(id)) {
|
49336
49450
|
return {
|
49337
|
-
code: `export default ${
|
49451
|
+
code: `export default ${urlCode}`,
|
49338
49452
|
map: { mappings: '' }, // Empty sourcemap to suppress Rollup warning
|
49339
49453
|
};
|
49340
49454
|
}
|
49341
49455
|
return {
|
49342
49456
|
code: `export default function WorkerWrapper(options) {
|
49343
49457
|
return new ${workerConstructor}(
|
49344
|
-
${
|
49458
|
+
${urlCode},
|
49345
49459
|
${workerTypeOption}
|
49346
49460
|
);
|
49347
49461
|
}`,
|
@@ -49372,26 +49486,49 @@ function webWorkerPlugin(config) {
|
|
49372
49486
|
const filename = fileNameHash.get(hash);
|
49373
49487
|
const replacement = toOutputFilePathInJS(filename, 'asset', chunk.fileName, 'js', config, toRelativeRuntime);
|
49374
49488
|
const replacementString = typeof replacement === 'string'
|
49375
|
-
? JSON.stringify(replacement).slice(1, -1)
|
49489
|
+
? JSON.stringify(encodeURI(replacement)).slice(1, -1)
|
49376
49490
|
: `"+${replacement.runtime}+"`;
|
49377
49491
|
s.update(match.index, match.index + full.length, replacementString);
|
49378
49492
|
}
|
49379
49493
|
}
|
49380
49494
|
return result();
|
49381
49495
|
},
|
49382
|
-
generateBundle(opts) {
|
49496
|
+
generateBundle(opts, bundle) {
|
49383
49497
|
// @ts-expect-error asset emits are skipped in legacy bundle
|
49384
49498
|
if (opts.__vite_skip_asset_emit__ || isWorker) {
|
49385
49499
|
return;
|
49386
49500
|
}
|
49387
49501
|
const workerMap = workerCache.get(config);
|
49388
49502
|
workerMap.assets.forEach((asset) => {
|
49389
|
-
|
49390
|
-
|
49503
|
+
const duplicateAsset = bundle[asset.fileName];
|
49504
|
+
if (duplicateAsset) {
|
49505
|
+
const content = duplicateAsset.type === 'asset'
|
49506
|
+
? duplicateAsset.source
|
49507
|
+
: duplicateAsset.code;
|
49508
|
+
// don't emit if the file name and the content is same
|
49509
|
+
if (isSameContent(content, asset.source)) {
|
49510
|
+
return;
|
49511
|
+
}
|
49512
|
+
}
|
49513
|
+
this.emitFile({
|
49514
|
+
type: 'asset',
|
49515
|
+
fileName: asset.fileName,
|
49516
|
+
source: asset.source,
|
49517
|
+
});
|
49391
49518
|
});
|
49519
|
+
workerMap.assets.clear();
|
49392
49520
|
},
|
49393
49521
|
};
|
49394
49522
|
}
|
49523
|
+
function isSameContent(a, b) {
|
49524
|
+
if (typeof a === 'string') {
|
49525
|
+
if (typeof b === 'string') {
|
49526
|
+
return a === b;
|
49527
|
+
}
|
49528
|
+
return Buffer.from(a).equals(b);
|
49529
|
+
}
|
49530
|
+
return Buffer.from(b).equals(a);
|
49531
|
+
}
|
49395
49532
|
|
49396
49533
|
/**
|
49397
49534
|
* A plugin to avoid an aliased AND optimized dep from being aliased in src
|
@@ -49482,6 +49619,10 @@ function getAliasPatterns(entries) {
|
|
49482
49619
|
}
|
49483
49620
|
return Object.entries(entries).map(([find]) => find);
|
49484
49621
|
}
|
49622
|
+
function getAliasPatternMatcher(entries) {
|
49623
|
+
const patterns = getAliasPatterns(entries);
|
49624
|
+
return (importee) => patterns.some((pattern) => matches(pattern, importee));
|
49625
|
+
}
|
49485
49626
|
|
49486
49627
|
function err(e, pos) {
|
49487
49628
|
const error = new Error(e);
|
@@ -49594,17 +49735,24 @@ function workerImportMetaUrlPlugin(config) {
|
|
49594
49735
|
? slash$1(path$o.join(config.publicDir, url))
|
49595
49736
|
: slash$1(path$o.resolve(path$o.dirname(id), url));
|
49596
49737
|
}
|
49597
|
-
|
49598
|
-
|
49599
|
-
|
49738
|
+
if (isBuild &&
|
49739
|
+
config.isWorker &&
|
49740
|
+
this.getModuleInfo(cleanUrl(file))?.isEntry) {
|
49741
|
+
s.update(expStart, expEnd, 'self.location.href');
|
49600
49742
|
}
|
49601
49743
|
else {
|
49602
|
-
builtUrl
|
49603
|
-
|
49744
|
+
let builtUrl;
|
49745
|
+
if (isBuild) {
|
49746
|
+
builtUrl = await workerFileToUrl(config, file);
|
49747
|
+
}
|
49748
|
+
else {
|
49749
|
+
builtUrl = await fileToUrl$1(cleanUrl(file), config, this);
|
49750
|
+
builtUrl = injectQuery(builtUrl, `${WORKER_FILE_ID}&type=${workerType}`);
|
49751
|
+
}
|
49752
|
+
s.update(expStart, expEnd,
|
49753
|
+
// add `'' +` to skip vite:asset-import-meta-url plugin
|
49754
|
+
`new URL('' + ${JSON.stringify(builtUrl)}, import.meta.url)`);
|
49604
49755
|
}
|
49605
|
-
s.update(expStart, expEnd,
|
49606
|
-
// add `'' +` to skip vite:asset-import-meta-url plugin
|
49607
|
-
`new URL('' + ${JSON.stringify(builtUrl)}, import.meta.url)`);
|
49608
49756
|
}
|
49609
49757
|
if (s) {
|
49610
49758
|
return transformStableResult(s, id, config);
|
@@ -49707,7 +49855,7 @@ function assetImportMetaUrlPlugin(config) {
|
|
49707
49855
|
let builtUrl;
|
49708
49856
|
if (file) {
|
49709
49857
|
try {
|
49710
|
-
if (isParentDirectory(publicDir, file)) {
|
49858
|
+
if (publicDir && isParentDirectory(publicDir, file)) {
|
49711
49859
|
const publicPath = '/' + path$o.posix.relative(publicDir, file);
|
49712
49860
|
builtUrl = await fileToUrl$1(publicPath, config, this);
|
49713
49861
|
}
|
@@ -50339,7 +50487,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
50339
50487
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
50340
50488
|
SOFTWARE.
|
50341
50489
|
*/
|
50342
|
-
const noop$
|
50490
|
+
const noop$2 = () => { };
|
50343
50491
|
const ERR_CLOSED_SERVER = 'ERR_CLOSED_SERVER';
|
50344
50492
|
function throwClosedServerError() {
|
50345
50493
|
const err = new Error('The server is being restarted or closed. Request is outdated');
|
@@ -50372,11 +50520,11 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
50372
50520
|
rollupVersion,
|
50373
50521
|
watchMode: true,
|
50374
50522
|
},
|
50375
|
-
debug: noop$
|
50376
|
-
info: noop$
|
50377
|
-
warn: noop$
|
50523
|
+
debug: noop$2,
|
50524
|
+
info: noop$2,
|
50525
|
+
warn: noop$2,
|
50378
50526
|
// @ts-expect-error noop
|
50379
|
-
error: noop$
|
50527
|
+
error: noop$2,
|
50380
50528
|
};
|
50381
50529
|
function warnIncompatibleMethod(method, plugin) {
|
50382
50530
|
logger.warn(colors$1.cyan(`[plugin:${plugin}] `) +
|
@@ -50538,8 +50686,8 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
50538
50686
|
// the the error middleware.
|
50539
50687
|
throw formatError(e, position, this);
|
50540
50688
|
}
|
50541
|
-
debug = noop$
|
50542
|
-
info = noop$
|
50689
|
+
debug = noop$2;
|
50690
|
+
info = noop$2;
|
50543
50691
|
}
|
50544
50692
|
function formatError(e, position, ctx) {
|
50545
50693
|
const err = (typeof e === 'string' ? new Error(e) : e);
|
@@ -53062,7 +53210,7 @@ function parse$5(req) {
|
|
53062
53210
|
return req._parsedUrl = { pathname, search, query, raw };
|
53063
53211
|
}
|
53064
53212
|
|
53065
|
-
const noop$
|
53213
|
+
const noop$1 = () => {};
|
53066
53214
|
|
53067
53215
|
function isMatch(uri, arr) {
|
53068
53216
|
for (let i=0; i < arr.length; i++) {
|
@@ -53178,7 +53326,7 @@ function sirv (dir, opts={}) {
|
|
53178
53326
|
dir = resolve$3(dir || '.');
|
53179
53327
|
|
53180
53328
|
let isNotFound = opts.onNoMatch || is404;
|
53181
|
-
let setHeaders = opts.setHeaders || noop$
|
53329
|
+
let setHeaders = opts.setHeaders || noop$1;
|
53182
53330
|
|
53183
53331
|
let extensions = opts.extensions || ['html', 'htm'];
|
53184
53332
|
let gzips = opts.gzip && extensions.map(x => `${x}.gz`).concat('gz');
|
@@ -53782,6 +53930,54 @@ async function handleModuleSoftInvalidation(mod, ssr, timestamp, server) {
|
|
53782
53930
|
return result;
|
53783
53931
|
}
|
53784
53932
|
|
53933
|
+
/**
|
53934
|
+
* Vite converts `import { } from 'foo'` to `const _ = __vite_ssr_import__('foo')`.
|
53935
|
+
* Top-level imports and dynamic imports work slightly differently in Node.js.
|
53936
|
+
* This function normalizes the differences so it matches prod behaviour.
|
53937
|
+
*/
|
53938
|
+
function analyzeImportedModDifference(mod, rawId, moduleType, metadata) {
|
53939
|
+
// No normalization needed if the user already dynamic imports this module
|
53940
|
+
if (metadata?.isDynamicImport)
|
53941
|
+
return;
|
53942
|
+
// If file path is ESM, everything should be fine
|
53943
|
+
if (moduleType === 'module')
|
53944
|
+
return;
|
53945
|
+
// For non-ESM, named imports is done via static analysis with cjs-module-lexer in Node.js.
|
53946
|
+
// If the user named imports a specifier that can't be analyzed, error.
|
53947
|
+
if (metadata?.importedNames?.length) {
|
53948
|
+
const missingBindings = metadata.importedNames.filter((s) => !(s in mod));
|
53949
|
+
if (missingBindings.length) {
|
53950
|
+
const lastBinding = missingBindings[missingBindings.length - 1];
|
53951
|
+
// Copied from Node.js
|
53952
|
+
throw new SyntaxError(`\
|
53953
|
+
[vite] Named export '${lastBinding}' not found. The requested module '${rawId}' is a CommonJS module, which may not support all module.exports as named exports.
|
53954
|
+
CommonJS modules can always be imported via the default export, for example using:
|
53955
|
+
|
53956
|
+
import pkg from '${rawId}';
|
53957
|
+
const {${missingBindings.join(', ')}} = pkg;
|
53958
|
+
`);
|
53959
|
+
}
|
53960
|
+
}
|
53961
|
+
}
|
53962
|
+
/**
|
53963
|
+
* Guard invalid named exports only, similar to how Node.js errors for top-level imports.
|
53964
|
+
* But since we transform as dynamic imports, we need to emulate the error manually.
|
53965
|
+
*/
|
53966
|
+
function proxyGuardOnlyEsm(mod, rawId, metadata) {
|
53967
|
+
// If the module doesn't import anything explicitly, e.g. `import 'foo'` or
|
53968
|
+
// `import * as foo from 'foo'`, we can skip the proxy guard.
|
53969
|
+
if (!metadata?.importedNames?.length)
|
53970
|
+
return mod;
|
53971
|
+
return new Proxy(mod, {
|
53972
|
+
get(mod, prop) {
|
53973
|
+
if (prop !== 'then' && !(prop in mod)) {
|
53974
|
+
throw new SyntaxError(`[vite] The requested module '${rawId}' does not provide an export named '${prop.toString()}'`);
|
53975
|
+
}
|
53976
|
+
return mod[prop];
|
53977
|
+
},
|
53978
|
+
});
|
53979
|
+
}
|
53980
|
+
|
53785
53981
|
/**
|
53786
53982
|
* @param {import('estree').Node} param
|
53787
53983
|
* @returns {string[]}
|
@@ -54610,15 +54806,6 @@ function ssrFixStacktrace(e, moduleGraph) {
|
|
54610
54806
|
rewroteStacktraces.add(e);
|
54611
54807
|
}
|
54612
54808
|
|
54613
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
54614
|
-
const AsyncFunction$1 = async function () { }.constructor;
|
54615
|
-
let fnDeclarationLineCount$1 = 0;
|
54616
|
-
{
|
54617
|
-
const body = '/*code*/';
|
54618
|
-
const source = new AsyncFunction$1('a', 'b', body).toString();
|
54619
|
-
fnDeclarationLineCount$1 =
|
54620
|
-
source.slice(0, source.indexOf(body)).split('\n').length - 1;
|
54621
|
-
}
|
54622
54809
|
const pendingModules = new Map();
|
54623
54810
|
const pendingImports = new Map();
|
54624
54811
|
const importErrors = new WeakMap();
|
@@ -54665,7 +54852,11 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
|
|
54665
54852
|
// Tolerate circular imports by ensuring the module can be
|
54666
54853
|
// referenced before it's been instantiated.
|
54667
54854
|
mod.ssrModule = ssrModule;
|
54855
|
+
// replace '/' with '\\' on Windows to match Node.js
|
54856
|
+
const osNormalizedFilename = isWindows$5 ? path$o.resolve(mod.file) : mod.file;
|
54668
54857
|
const ssrImportMeta = {
|
54858
|
+
dirname: path$o.dirname(osNormalizedFilename),
|
54859
|
+
filename: osNormalizedFilename,
|
54669
54860
|
// The filesystem URL, matching native Node.js modules
|
54670
54861
|
url: pathToFileURL(mod.file).toString(),
|
54671
54862
|
};
|
@@ -54744,15 +54935,13 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
|
|
54744
54935
|
let sourceMapSuffix = '';
|
54745
54936
|
if (result.map && 'version' in result.map) {
|
54746
54937
|
const moduleSourceMap = Object.assign({}, result.map, {
|
54747
|
-
|
54748
|
-
|
54749
|
-
mappings: ';'.repeat(fnDeclarationLineCount$1) + result.map.mappings,
|
54938
|
+
mappings: ';'.repeat(asyncFunctionDeclarationPaddingLineCount) +
|
54939
|
+
result.map.mappings,
|
54750
54940
|
});
|
54751
|
-
sourceMapSuffix =
|
54752
|
-
'\n//# sourceMappingURL=' + genSourceMapUrl(moduleSourceMap);
|
54941
|
+
sourceMapSuffix = `\n//# ${SOURCEMAPPING_URL}=${genSourceMapUrl(moduleSourceMap)}`;
|
54753
54942
|
}
|
54754
54943
|
try {
|
54755
|
-
const initModule = new AsyncFunction
|
54944
|
+
const initModule = new AsyncFunction(`global`, ssrModuleExportsKey, ssrImportMetaKey, ssrImportKey, ssrDynamicImportKey, ssrExportAllKey, '"use strict";' +
|
54756
54945
|
result.code +
|
54757
54946
|
`\n//# sourceURL=${mod.id}${sourceMapSuffix}`);
|
54758
54947
|
await initModule(context.global, ssrModule, ssrImportMeta, ssrImport, ssrDynamicImport, ssrExportAll);
|
@@ -54798,7 +54987,9 @@ async function nodeImport(id, importer, resolveOptions, metadata) {
|
|
54798
54987
|
return proxyESM(mod);
|
54799
54988
|
}
|
54800
54989
|
else if (filePath) {
|
54801
|
-
analyzeImportedModDifference(mod,
|
54990
|
+
analyzeImportedModDifference(mod, id, isFilePathESM(filePath, resolveOptions.packageCache)
|
54991
|
+
? 'module'
|
54992
|
+
: undefined, metadata);
|
54802
54993
|
return proxyGuardOnlyEsm(mod, id);
|
54803
54994
|
}
|
54804
54995
|
else {
|
@@ -54828,53 +55019,6 @@ function proxyESM(mod) {
|
|
54828
55019
|
function isPrimitive(value) {
|
54829
55020
|
return !value || (typeof value !== 'object' && typeof value !== 'function');
|
54830
55021
|
}
|
54831
|
-
/**
|
54832
|
-
* Vite converts `import { } from 'foo'` to `const _ = __vite_ssr_import__('foo')`.
|
54833
|
-
* Top-level imports and dynamic imports work slightly differently in Node.js.
|
54834
|
-
* This function normalizes the differences so it matches prod behaviour.
|
54835
|
-
*/
|
54836
|
-
function analyzeImportedModDifference(mod, filePath, rawId, metadata, packageCache) {
|
54837
|
-
// No normalization needed if the user already dynamic imports this module
|
54838
|
-
if (metadata?.isDynamicImport)
|
54839
|
-
return;
|
54840
|
-
// If file path is ESM, everything should be fine
|
54841
|
-
if (isFilePathESM(filePath, packageCache))
|
54842
|
-
return;
|
54843
|
-
// For non-ESM, named imports is done via static analysis with cjs-module-lexer in Node.js.
|
54844
|
-
// If the user named imports a specifier that can't be analyzed, error.
|
54845
|
-
if (metadata?.importedNames?.length) {
|
54846
|
-
const missingBindings = metadata.importedNames.filter((s) => !(s in mod));
|
54847
|
-
if (missingBindings.length) {
|
54848
|
-
const lastBinding = missingBindings[missingBindings.length - 1];
|
54849
|
-
// Copied from Node.js
|
54850
|
-
throw new SyntaxError(`\
|
54851
|
-
[vite] Named export '${lastBinding}' not found. The requested module '${rawId}' is a CommonJS module, which may not support all module.exports as named exports.
|
54852
|
-
CommonJS modules can always be imported via the default export, for example using:
|
54853
|
-
|
54854
|
-
import pkg from '${rawId}';
|
54855
|
-
const {${missingBindings.join(', ')}} = pkg;
|
54856
|
-
`);
|
54857
|
-
}
|
54858
|
-
}
|
54859
|
-
}
|
54860
|
-
/**
|
54861
|
-
* Guard invalid named exports only, similar to how Node.js errors for top-level imports.
|
54862
|
-
* But since we transform as dynamic imports, we need to emulate the error manually.
|
54863
|
-
*/
|
54864
|
-
function proxyGuardOnlyEsm(mod, rawId, metadata) {
|
54865
|
-
// If the module doesn't import anything explicitly, e.g. `import 'foo'` or
|
54866
|
-
// `import * as foo from 'foo'`, we can skip the proxy guard.
|
54867
|
-
if (!metadata?.importedNames?.length)
|
54868
|
-
return mod;
|
54869
|
-
return new Proxy(mod, {
|
54870
|
-
get(mod, prop) {
|
54871
|
-
if (prop !== 'then' && !(prop in mod)) {
|
54872
|
-
throw new SyntaxError(`[vite] The requested module '${rawId}' does not provide an export named '${prop.toString()}'`);
|
54873
|
-
}
|
54874
|
-
return mod[prop];
|
54875
|
-
},
|
54876
|
-
});
|
54877
|
-
}
|
54878
55022
|
|
54879
55023
|
var isWsl$2 = {exports: {}};
|
54880
55024
|
|
@@ -55298,56 +55442,6 @@ var open$1 = /*@__PURE__*/getDefaultExportFromCjs(open_1);
|
|
55298
55442
|
|
55299
55443
|
var crossSpawn = {exports: {}};
|
55300
55444
|
|
55301
|
-
var mode;
|
55302
|
-
var hasRequiredMode;
|
55303
|
-
|
55304
|
-
function requireMode () {
|
55305
|
-
if (hasRequiredMode) return mode;
|
55306
|
-
hasRequiredMode = 1;
|
55307
|
-
mode = isexe;
|
55308
|
-
isexe.sync = sync;
|
55309
|
-
|
55310
|
-
var fs = require$$0__default;
|
55311
|
-
|
55312
|
-
function isexe (path, options, cb) {
|
55313
|
-
fs.stat(path, function (er, stat) {
|
55314
|
-
cb(er, er ? false : checkStat(stat, options));
|
55315
|
-
});
|
55316
|
-
}
|
55317
|
-
|
55318
|
-
function sync (path, options) {
|
55319
|
-
return checkStat(fs.statSync(path), options)
|
55320
|
-
}
|
55321
|
-
|
55322
|
-
function checkStat (stat, options) {
|
55323
|
-
return stat.isFile() && checkMode(stat, options)
|
55324
|
-
}
|
55325
|
-
|
55326
|
-
function checkMode (stat, options) {
|
55327
|
-
var mod = stat.mode;
|
55328
|
-
var uid = stat.uid;
|
55329
|
-
var gid = stat.gid;
|
55330
|
-
|
55331
|
-
var myUid = options.uid !== undefined ?
|
55332
|
-
options.uid : process.getuid && process.getuid();
|
55333
|
-
var myGid = options.gid !== undefined ?
|
55334
|
-
options.gid : process.getgid && process.getgid();
|
55335
|
-
|
55336
|
-
var u = parseInt('100', 8);
|
55337
|
-
var g = parseInt('010', 8);
|
55338
|
-
var o = parseInt('001', 8);
|
55339
|
-
var ug = u | g;
|
55340
|
-
|
55341
|
-
var ret = (mod & o) ||
|
55342
|
-
(mod & g) && gid === myGid ||
|
55343
|
-
(mod & u) && uid === myUid ||
|
55344
|
-
(mod & ug) && myUid === 0;
|
55345
|
-
|
55346
|
-
return ret
|
55347
|
-
}
|
55348
|
-
return mode;
|
55349
|
-
}
|
55350
|
-
|
55351
55445
|
var windows;
|
55352
55446
|
var hasRequiredWindows;
|
55353
55447
|
|
@@ -55399,6 +55493,56 @@ function requireWindows () {
|
|
55399
55493
|
return windows;
|
55400
55494
|
}
|
55401
55495
|
|
55496
|
+
var mode;
|
55497
|
+
var hasRequiredMode;
|
55498
|
+
|
55499
|
+
function requireMode () {
|
55500
|
+
if (hasRequiredMode) return mode;
|
55501
|
+
hasRequiredMode = 1;
|
55502
|
+
mode = isexe;
|
55503
|
+
isexe.sync = sync;
|
55504
|
+
|
55505
|
+
var fs = require$$0__default;
|
55506
|
+
|
55507
|
+
function isexe (path, options, cb) {
|
55508
|
+
fs.stat(path, function (er, stat) {
|
55509
|
+
cb(er, er ? false : checkStat(stat, options));
|
55510
|
+
});
|
55511
|
+
}
|
55512
|
+
|
55513
|
+
function sync (path, options) {
|
55514
|
+
return checkStat(fs.statSync(path), options)
|
55515
|
+
}
|
55516
|
+
|
55517
|
+
function checkStat (stat, options) {
|
55518
|
+
return stat.isFile() && checkMode(stat, options)
|
55519
|
+
}
|
55520
|
+
|
55521
|
+
function checkMode (stat, options) {
|
55522
|
+
var mod = stat.mode;
|
55523
|
+
var uid = stat.uid;
|
55524
|
+
var gid = stat.gid;
|
55525
|
+
|
55526
|
+
var myUid = options.uid !== undefined ?
|
55527
|
+
options.uid : process.getuid && process.getuid();
|
55528
|
+
var myGid = options.gid !== undefined ?
|
55529
|
+
options.gid : process.getgid && process.getgid();
|
55530
|
+
|
55531
|
+
var u = parseInt('100', 8);
|
55532
|
+
var g = parseInt('010', 8);
|
55533
|
+
var o = parseInt('001', 8);
|
55534
|
+
var ug = u | g;
|
55535
|
+
|
55536
|
+
var ret = (mod & o) ||
|
55537
|
+
(mod & g) && gid === myGid ||
|
55538
|
+
(mod & u) && uid === myUid ||
|
55539
|
+
(mod & ug) && myUid === 0;
|
55540
|
+
|
55541
|
+
return ret
|
55542
|
+
}
|
55543
|
+
return mode;
|
55544
|
+
}
|
55545
|
+
|
55402
55546
|
var core;
|
55403
55547
|
if (process.platform === 'win32' || commonjsGlobal.TESTING_WINDOWS) {
|
55404
55548
|
core = requireWindows();
|
@@ -56225,7 +56369,6 @@ async function fetchModule(server, url, importer, options = {}) {
|
|
56225
56369
|
isProduction,
|
56226
56370
|
root,
|
56227
56371
|
ssrConfig: ssr,
|
56228
|
-
legacyProxySsrExternalModules: server.config.legacy?.proxySsrExternalModules,
|
56229
56372
|
packageCache: server.config.packageCache,
|
56230
56373
|
};
|
56231
56374
|
const resolved = tryNodeResolve(url, importer, { ...resolveOptions, tryEsmOnly: true }, false, undefined, true);
|
@@ -56270,26 +56413,17 @@ function inlineSourceMap(mod, result, processSourceMap) {
|
|
56270
56413
|
OTHER_SOURCE_MAP_REGEXP.lastIndex = 0;
|
56271
56414
|
if (OTHER_SOURCE_MAP_REGEXP.test(code))
|
56272
56415
|
code = code.replace(OTHER_SOURCE_MAP_REGEXP, '');
|
56273
|
-
const sourceMap =
|
56274
|
-
result.code = `${code.trimEnd()}\n//# sourceURL=${mod.id}\n${VITE_RUNTIME_SOURCEMAPPING_SOURCE}\n//# ${
|
56416
|
+
const sourceMap = processSourceMap?.(map) || map;
|
56417
|
+
result.code = `${code.trimEnd()}\n//# sourceURL=${mod.id}\n${VITE_RUNTIME_SOURCEMAPPING_SOURCE}\n//# ${SOURCEMAPPING_URL}=${genSourceMapUrl(sourceMap)}\n`;
|
56275
56418
|
return result;
|
56276
56419
|
}
|
56277
56420
|
|
56278
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
56279
|
-
const AsyncFunction = async function () { }.constructor;
|
56280
|
-
const fnDeclarationLineCount = (() => {
|
56281
|
-
const body = '/*code*/';
|
56282
|
-
const source = new AsyncFunction('a', 'b', body).toString();
|
56283
|
-
return source.slice(0, source.indexOf(body)).split('\n').length - 1;
|
56284
|
-
})();
|
56285
56421
|
function ssrFetchModule(server, id, importer) {
|
56286
56422
|
return fetchModule(server, id, importer, {
|
56287
56423
|
processSourceMap(map) {
|
56288
56424
|
// this assumes that "new AsyncFunction" is used to create the module
|
56289
56425
|
return Object.assign({}, map, {
|
56290
|
-
|
56291
|
-
// https://github.com/nodejs/node/issues/43047#issuecomment-1180632750
|
56292
|
-
mappings: ';'.repeat(fnDeclarationLineCount) + map.mappings,
|
56426
|
+
mappings: ';'.repeat(asyncFunctionDeclarationPaddingLineCount) + map.mappings,
|
56293
56427
|
});
|
56294
56428
|
},
|
56295
56429
|
});
|
@@ -56494,7 +56628,7 @@ let Limiter$1 = class Limiter {
|
|
56494
56628
|
|
56495
56629
|
var limiter = Limiter$1;
|
56496
56630
|
|
56497
|
-
const zlib =
|
56631
|
+
const zlib = zlib$1;
|
56498
56632
|
|
56499
56633
|
const bufferUtil = bufferUtilExports;
|
56500
56634
|
const Limiter = limiter;
|
@@ -57009,7 +57143,7 @@ function inflateOnError(err) {
|
|
57009
57143
|
|
57010
57144
|
var validation = {exports: {}};
|
57011
57145
|
|
57012
|
-
const { isUtf8 } = require$$0$
|
57146
|
+
const { isUtf8 } = require$$0$a;
|
57013
57147
|
|
57014
57148
|
//
|
57015
57149
|
// Allowed token characters:
|
@@ -57882,7 +58016,7 @@ function throwErrorNextTick(err) {
|
|
57882
58016
|
}
|
57883
58017
|
|
57884
58018
|
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex" }] */
|
57885
|
-
const { randomFillSync } = require$$
|
58019
|
+
const { randomFillSync } = require$$3$1;
|
57886
58020
|
|
57887
58021
|
const PerMessageDeflate$2 = permessageDeflate;
|
57888
58022
|
const { EMPTY_BUFFER: EMPTY_BUFFER$1 } = constants;
|
@@ -58855,7 +58989,7 @@ const https$2 = require$$1$1;
|
|
58855
58989
|
const http$3 = require$$1;
|
58856
58990
|
const net = require$$4$1;
|
58857
58991
|
const tls = require$$4$2;
|
58858
|
-
const { randomBytes, createHash: createHash$1 } = require$$
|
58992
|
+
const { randomBytes, createHash: createHash$1 } = require$$3$1;
|
58859
58993
|
const { URL: URL$2 } = require$$0$9;
|
58860
58994
|
|
58861
58995
|
const PerMessageDeflate$1 = permessageDeflate;
|
@@ -58869,7 +59003,7 @@ const {
|
|
58869
59003
|
kListener,
|
58870
59004
|
kStatusCode,
|
58871
59005
|
kWebSocket: kWebSocket$1,
|
58872
|
-
NOOP
|
59006
|
+
NOOP: NOOP$1
|
58873
59007
|
} = constants;
|
58874
59008
|
const {
|
58875
59009
|
EventTarget: { addEventListener, removeEventListener }
|
@@ -60065,7 +60199,7 @@ function receiverOnMessage(data, isBinary) {
|
|
60065
60199
|
function receiverOnPing(data) {
|
60066
60200
|
const websocket = this[kWebSocket$1];
|
60067
60201
|
|
60068
|
-
if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
|
60202
|
+
if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP$1);
|
60069
60203
|
websocket.emit('ping', data);
|
60070
60204
|
}
|
60071
60205
|
|
@@ -60174,7 +60308,7 @@ function socketOnError$1() {
|
|
60174
60308
|
const websocket = this[kWebSocket$1];
|
60175
60309
|
|
60176
60310
|
this.removeListener('error', socketOnError$1);
|
60177
|
-
this.on('error', NOOP);
|
60311
|
+
this.on('error', NOOP$1);
|
60178
60312
|
|
60179
60313
|
if (websocket) {
|
60180
60314
|
websocket._readyState = WebSocket$1.CLOSING;
|
@@ -60247,7 +60381,7 @@ var subprotocol$1 = { parse };
|
|
60247
60381
|
|
60248
60382
|
const EventEmitter = require$$0$5;
|
60249
60383
|
const http$2 = require$$1;
|
60250
|
-
const { createHash } = require$$
|
60384
|
+
const { createHash } = require$$3$1;
|
60251
60385
|
|
60252
60386
|
const extension = extension$1;
|
60253
60387
|
const PerMessageDeflate = permessageDeflate;
|
@@ -62374,7 +62508,7 @@ function wrap(protocols) {
|
|
62374
62508
|
}
|
62375
62509
|
|
62376
62510
|
/* istanbul ignore next */
|
62377
|
-
function noop
|
62511
|
+
function noop() { /* empty */ }
|
62378
62512
|
|
62379
62513
|
// from https://github.com/nodejs/node/blob/master/lib/internal/url.js
|
62380
62514
|
function urlToOptions(urlObject) {
|
@@ -62430,7 +62564,7 @@ function abortRequest(request) {
|
|
62430
62564
|
for (var e = 0; e < events.length; e++) {
|
62431
62565
|
request.removeListener(events[e], eventHandlers[events[e]]);
|
62432
62566
|
}
|
62433
|
-
request.on("error", noop
|
62567
|
+
request.on("error", noop);
|
62434
62568
|
request.abort();
|
62435
62569
|
}
|
62436
62570
|
|
@@ -64592,14 +64726,12 @@ async function _createServer(inlineConfig = {}, options) {
|
|
64592
64726
|
// proxy
|
64593
64727
|
const { proxy } = serverConfig;
|
64594
64728
|
if (proxy) {
|
64595
|
-
const middlewareServer = (isObject$1(
|
64596
|
-
? serverConfig.middlewareMode.server
|
64597
|
-
: null) || httpServer;
|
64729
|
+
const middlewareServer = (isObject$1(middlewareMode) ? middlewareMode.server : null) || httpServer;
|
64598
64730
|
middlewares.use(proxyMiddleware(middlewareServer, proxy, config));
|
64599
64731
|
}
|
64600
64732
|
// base
|
64601
64733
|
if (config.base !== '/') {
|
64602
|
-
middlewares.use(baseMiddleware(config.rawBase, middlewareMode));
|
64734
|
+
middlewares.use(baseMiddleware(config.rawBase, !!middlewareMode));
|
64603
64735
|
}
|
64604
64736
|
// open in editor support
|
64605
64737
|
middlewares.use('/__open-in-editor', launchEditorMiddleware$1());
|
@@ -64639,7 +64771,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
64639
64771
|
middlewares.use(notFoundMiddleware());
|
64640
64772
|
}
|
64641
64773
|
// error handler
|
64642
|
-
middlewares.use(errorMiddleware(server, middlewareMode));
|
64774
|
+
middlewares.use(errorMiddleware(server, !!middlewareMode));
|
64643
64775
|
// httpServer.listen can be called multiple times
|
64644
64776
|
// when port when using next port number
|
64645
64777
|
// this code is to avoid calling buildStart multiple times
|
@@ -64751,13 +64883,29 @@ function resolveServerOptions(root, raw, logger) {
|
|
64751
64883
|
sourcemapIgnoreList: raw?.sourcemapIgnoreList === false
|
64752
64884
|
? () => false
|
64753
64885
|
: raw?.sourcemapIgnoreList || isInNodeModules$1,
|
64754
|
-
middlewareMode:
|
64886
|
+
middlewareMode: raw?.middlewareMode || false,
|
64755
64887
|
};
|
64756
64888
|
let allowDirs = server.fs?.allow;
|
64757
64889
|
const deny = server.fs?.deny || ['.env', '.env.*', '*.{crt,pem}'];
|
64758
64890
|
if (!allowDirs) {
|
64759
64891
|
allowDirs = [searchForWorkspaceRoot(root)];
|
64760
64892
|
}
|
64893
|
+
if (process.versions.pnp) {
|
64894
|
+
try {
|
64895
|
+
const enableGlobalCache = execSync('yarn config get enableGlobalCache', { cwd: root })
|
64896
|
+
.toString()
|
64897
|
+
.trim() === 'true';
|
64898
|
+
const yarnCacheDir = execSync(`yarn config get ${enableGlobalCache ? 'globalFolder' : 'cacheFolder'}`, { cwd: root })
|
64899
|
+
.toString()
|
64900
|
+
.trim();
|
64901
|
+
allowDirs.push(yarnCacheDir);
|
64902
|
+
}
|
64903
|
+
catch (e) {
|
64904
|
+
logger.warn(`Get yarn cache dir error: ${e.message}`, {
|
64905
|
+
timestamp: true,
|
64906
|
+
});
|
64907
|
+
}
|
64908
|
+
}
|
64761
64909
|
allowDirs = allowDirs.map((i) => resolvedAllowDir(root, i));
|
64762
64910
|
// only push client dir when vite itself is outside-of-root
|
64763
64911
|
const resolvedClientDir = resolvedAllowDir(root, CLIENT_DIR);
|
@@ -65509,6 +65657,7 @@ function importAnalysisPlugin(config) {
|
|
65509
65657
|
const fsUtils = getFsUtils(config);
|
65510
65658
|
const clientPublicPath = path$o.posix.join(base, CLIENT_PUBLIC_PATH);
|
65511
65659
|
const enablePartialAccept = config.experimental?.hmrPartialAccept;
|
65660
|
+
const matchAlias = getAliasPatternMatcher(config.resolve.alias);
|
65512
65661
|
let server;
|
65513
65662
|
let _env;
|
65514
65663
|
let _ssrEnv;
|
@@ -65752,7 +65901,7 @@ function importAnalysisPlugin(config) {
|
|
65752
65901
|
return;
|
65753
65902
|
}
|
65754
65903
|
// skip ssr external
|
65755
|
-
if (ssr) {
|
65904
|
+
if (ssr && !matchAlias(specifier)) {
|
65756
65905
|
if (shouldExternalizeForSSR(specifier, importer, config)) {
|
65757
65906
|
return;
|
65758
65907
|
}
|
@@ -65813,7 +65962,7 @@ function importAnalysisPlugin(config) {
|
|
65813
65962
|
rewriteDone = true;
|
65814
65963
|
}
|
65815
65964
|
if (!rewriteDone) {
|
65816
|
-
const rewrittenUrl = JSON.stringify(url);
|
65965
|
+
const rewrittenUrl = JSON.stringify(partialEncodeURI(url));
|
65817
65966
|
const s = isDynamicImport ? start : start - 1;
|
65818
65967
|
const e = isDynamicImport ? end : end + 1;
|
65819
65968
|
str().overwrite(s, e, rewrittenUrl, {
|
@@ -65980,7 +66129,7 @@ function createParseErrorInfo(importer, source) {
|
|
65980
66129
|
};
|
65981
66130
|
}
|
65982
66131
|
// prettier-ignore
|
65983
|
-
const interopHelper = (m) => m?.__esModule ? m : { ...(typeof m === 'object' && !Array.isArray(m) ? m : {}), default: m };
|
66132
|
+
const interopHelper = (m) => m?.__esModule ? m : { ...(typeof m === 'object' && !Array.isArray(m) || typeof m === 'function' ? m : {}), default: m };
|
65984
66133
|
function interopNamedImports(str, importSpecifier, rewrittenUrl, importIndex, importer, config) {
|
65985
66134
|
const source = str.original;
|
65986
66135
|
const { s: start, e: end, ss: expStart, se: expEnd, d: dynamicIndex, } = importSpecifier;
|
@@ -67222,7 +67371,7 @@ function injectSsrFlag(options) {
|
|
67222
67371
|
}
|
67223
67372
|
/*
|
67224
67373
|
The following functions are copied from rollup
|
67225
|
-
https://github.com/rollup/rollup/blob/
|
67374
|
+
https://github.com/rollup/rollup/blob/ce6cb93098850a46fa242e37b74a919e99a5de28/src/ast/nodes/MetaProperty.ts#L155-L203
|
67226
67375
|
|
67227
67376
|
https://github.com/rollup/rollup
|
67228
67377
|
The MIT License (MIT)
|
@@ -67240,26 +67389,26 @@ function escapeId(id) {
|
|
67240
67389
|
return id.replace(backSlashRegEx, '\\\\').replace(quoteNewlineRegEx, '\\$1');
|
67241
67390
|
}
|
67242
67391
|
const getResolveUrl = (path, URL = 'URL') => `new ${URL}(${path}).href`;
|
67243
|
-
const getRelativeUrlFromDocument = (relativePath, umd = false) => getResolveUrl(`'${escapeId(relativePath)}', ${umd ? `typeof document === 'undefined' ? location.href : ` : ''}document.currentScript && document.currentScript.src || document.baseURI`);
|
67392
|
+
const getRelativeUrlFromDocument = (relativePath, umd = false) => getResolveUrl(`'${escapeId(partialEncodeURI(relativePath))}', ${umd ? `typeof document === 'undefined' ? location.href : ` : ''}document.currentScript && document.currentScript.src || document.baseURI`);
|
67244
67393
|
const getFileUrlFromFullPath = (path) => `require('u' + 'rl').pathToFileURL(${path}).href`;
|
67245
|
-
const getFileUrlFromRelativePath = (path) => getFileUrlFromFullPath(`__dirname + '/${path}'`);
|
67394
|
+
const getFileUrlFromRelativePath = (path) => getFileUrlFromFullPath(`__dirname + '/${escapeId(path)}'`);
|
67246
67395
|
const relativeUrlMechanisms = {
|
67247
67396
|
amd: (relativePath) => {
|
67248
67397
|
if (relativePath[0] !== '.')
|
67249
67398
|
relativePath = './' + relativePath;
|
67250
|
-
return getResolveUrl(`require.toUrl('${relativePath}'), document.baseURI`);
|
67399
|
+
return getResolveUrl(`require.toUrl('${escapeId(relativePath)}'), document.baseURI`);
|
67251
67400
|
},
|
67252
67401
|
cjs: (relativePath) => `(typeof document === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath)})`,
|
67253
|
-
es: (relativePath) => getResolveUrl(`'${relativePath}', import.meta.url`),
|
67402
|
+
es: (relativePath) => getResolveUrl(`'${escapeId(partialEncodeURI(relativePath))}', import.meta.url`),
|
67254
67403
|
iife: (relativePath) => getRelativeUrlFromDocument(relativePath),
|
67255
67404
|
// NOTE: make sure rollup generate `module` params
|
67256
|
-
system: (relativePath) => getResolveUrl(`'${relativePath}', module.meta.url`),
|
67405
|
+
system: (relativePath) => getResolveUrl(`'${escapeId(partialEncodeURI(relativePath))}', module.meta.url`),
|
67257
67406
|
umd: (relativePath) => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath, true)})`,
|
67258
67407
|
};
|
67259
67408
|
/* end of copy */
|
67260
67409
|
const customRelativeUrlMechanisms = {
|
67261
67410
|
...relativeUrlMechanisms,
|
67262
|
-
'worker-iife': (relativePath) => getResolveUrl(`'${relativePath}', self.location.href`),
|
67411
|
+
'worker-iife': (relativePath) => getResolveUrl(`'${escapeId(partialEncodeURI(relativePath))}', self.location.href`),
|
67263
67412
|
};
|
67264
67413
|
function toOutputFilePathInJS(filename, type, hostId, hostType, config, toRelative) {
|
67265
67414
|
const { renderBuiltUrl } = config.experimental;
|
@@ -67350,111 +67499,119 @@ var build$1 = {
|
|
67350
67499
|
toOutputFilePathWithoutRuntime: toOutputFilePathWithoutRuntime
|
67351
67500
|
};
|
67352
67501
|
|
67353
|
-
|
67354
|
-
|
67355
|
-
|
67356
|
-
|
67357
|
-
|
67358
|
-
|
67359
|
-
|
67360
|
-
|
67361
|
-
|
67362
|
-
|
67363
|
-
|
67364
|
-
|
67365
|
-
|
67366
|
-
|
67367
|
-
|
67368
|
-
|
67369
|
-
|
67370
|
-
|
67371
|
-
|
67372
|
-
|
67373
|
-
|
67374
|
-
|
67375
|
-
|
67376
|
-
|
67377
|
-
|
67378
|
-
|
67379
|
-
|
67380
|
-
|
67381
|
-
|
67382
|
-
|
67383
|
-
|
67384
|
-
|
67385
|
-
|
67386
|
-
|
67387
|
-
|
67388
|
-
|
67389
|
-
|
67390
|
-
|
67391
|
-
|
67392
|
-
|
67393
|
-
|
67394
|
-
|
67395
|
-
|
67396
|
-
|
67397
|
-
|
67398
|
-
|
67399
|
-
|
67400
|
-
|
67401
|
-
|
67402
|
-
|
67403
|
-
|
67404
|
-
|
67405
|
-
|
67406
|
-
|
67407
|
-
|
67408
|
-
|
67409
|
-
|
67410
|
-
|
67411
|
-
|
67412
|
-
|
67413
|
-
|
67414
|
-
|
67415
|
-
|
67416
|
-
|
67417
|
-
|
67418
|
-
|
67419
|
-
|
67420
|
-
|
67421
|
-
|
67422
|
-
|
67423
|
-
|
67424
|
-
|
67425
|
-
|
67426
|
-
|
67427
|
-
|
67428
|
-
|
67429
|
-
|
67430
|
-
|
67431
|
-
|
67432
|
-
|
67433
|
-
|
67434
|
-
|
67435
|
-
|
67436
|
-
|
67437
|
-
|
67438
|
-
|
67439
|
-
|
67440
|
-
|
67441
|
-
|
67442
|
-
|
67443
|
-
|
67444
|
-
|
67445
|
-
|
67446
|
-
|
67447
|
-
|
67448
|
-
|
67449
|
-
|
67450
|
-
|
67451
|
-
|
67452
|
-
|
67453
|
-
|
67454
|
-
|
67455
|
-
|
67456
|
-
|
67457
|
-
|
67502
|
+
// NOTE: supports Node 6.x
|
67503
|
+
|
67504
|
+
|
67505
|
+
const NOOP = () => {};
|
67506
|
+
const MIMES = /text|javascript|\/json|xml/i;
|
67507
|
+
|
67508
|
+
/**
|
67509
|
+
* @param {any} chunk
|
67510
|
+
* @param {BufferEncoding} enc
|
67511
|
+
* @returns {number}
|
67512
|
+
*/
|
67513
|
+
function getChunkSize(chunk, enc) {
|
67514
|
+
return chunk ? Buffer.byteLength(chunk, enc) : 0;
|
67515
|
+
}
|
67516
|
+
|
67517
|
+
/**
|
67518
|
+
* @param {import('./index.d.mts').Options} [options]
|
67519
|
+
* @returns {import('./index.d.mts').Middleware}
|
67520
|
+
*/
|
67521
|
+
function compression ({ threshold = 1024, level = -1, brotli = false, gzip = true, mimes = MIMES } = {}) {
|
67522
|
+
const brotliOpts = (typeof brotli === 'object' && brotli) || {};
|
67523
|
+
const gzipOpts = (typeof gzip === 'object' && gzip) || {};
|
67524
|
+
|
67525
|
+
// disable Brotli on Node<12.7 where it is unsupported:
|
67526
|
+
if (!zlib$1.createBrotliCompress) brotli = false;
|
67527
|
+
|
67528
|
+
return (req, res, next = NOOP) => {
|
67529
|
+
const accept = req.headers['accept-encoding'] + '';
|
67530
|
+
const encoding = ((brotli && accept.match(/\bbr\b/)) || (gzip && accept.match(/\bgzip\b/)) || [])[0];
|
67531
|
+
|
67532
|
+
// skip if no response body or no supported encoding:
|
67533
|
+
if (req.method === 'HEAD' || !encoding) return next();
|
67534
|
+
|
67535
|
+
/** @type {zlib.Gzip | zlib.BrotliCompress} */
|
67536
|
+
let compress;
|
67537
|
+
/** @type {Array<[string, function]>?} */
|
67538
|
+
let pendingListeners = [];
|
67539
|
+
let pendingStatus = 0;
|
67540
|
+
let started = false;
|
67541
|
+
let size = 0;
|
67542
|
+
|
67543
|
+
function start() {
|
67544
|
+
started = true;
|
67545
|
+
// @ts-ignore
|
67546
|
+
size = res.getHeader('Content-Length') | 0 || size;
|
67547
|
+
const compressible = mimes.test(
|
67548
|
+
String(res.getHeader('Content-Type') || 'text/plain')
|
67549
|
+
);
|
67550
|
+
const cleartext = !res.getHeader('Content-Encoding');
|
67551
|
+
const listeners = pendingListeners || [];
|
67552
|
+
|
67553
|
+
if (compressible && cleartext && size >= threshold) {
|
67554
|
+
res.setHeader('Content-Encoding', encoding);
|
67555
|
+
res.removeHeader('Content-Length');
|
67556
|
+
if (encoding === 'br') {
|
67557
|
+
compress = zlib$1.createBrotliCompress({
|
67558
|
+
params: Object.assign({
|
67559
|
+
[zlib$1.constants.BROTLI_PARAM_QUALITY]: level,
|
67560
|
+
[zlib$1.constants.BROTLI_PARAM_SIZE_HINT]: size,
|
67561
|
+
}, brotliOpts)
|
67562
|
+
});
|
67563
|
+
} else {
|
67564
|
+
compress = zlib$1.createGzip(
|
67565
|
+
Object.assign({ level }, gzipOpts)
|
67566
|
+
);
|
67567
|
+
}
|
67568
|
+
// backpressure
|
67569
|
+
compress.on('data', chunk => write.call(res, chunk) || compress.pause());
|
67570
|
+
on.call(res, 'drain', () => compress.resume());
|
67571
|
+
compress.on('end', () => end.call(res));
|
67572
|
+
listeners.forEach(p => compress.on.apply(compress, p));
|
67573
|
+
} else {
|
67574
|
+
pendingListeners = null;
|
67575
|
+
listeners.forEach(p => on.apply(res, p));
|
67576
|
+
}
|
67577
|
+
|
67578
|
+
writeHead.call(res, pendingStatus || res.statusCode);
|
67579
|
+
}
|
67580
|
+
|
67581
|
+
const { end, write, on, writeHead } = res;
|
67582
|
+
|
67583
|
+
res.writeHead = function (status, reason, headers) {
|
67584
|
+
if (typeof reason !== 'string') [headers, reason] = [reason, headers];
|
67585
|
+
if (headers) for (let k in headers) res.setHeader(k, headers[k]);
|
67586
|
+
pendingStatus = status;
|
67587
|
+
return this;
|
67588
|
+
};
|
67589
|
+
|
67590
|
+
res.write = function (chunk, enc) {
|
67591
|
+
size += getChunkSize(chunk, enc);
|
67592
|
+
if (!started) start();
|
67593
|
+
if (!compress) return write.apply(this, arguments);
|
67594
|
+
return compress.write.apply(compress, arguments);
|
67595
|
+
};
|
67596
|
+
|
67597
|
+
res.end = function (chunk, enc) {
|
67598
|
+
if (arguments.length > 0 && typeof chunk !== 'function') {
|
67599
|
+
size += getChunkSize(chunk, enc);
|
67600
|
+
}
|
67601
|
+
if (!started) start();
|
67602
|
+
if (!compress) return end.apply(this, arguments);
|
67603
|
+
return compress.end.apply(compress, arguments);
|
67604
|
+
};
|
67605
|
+
|
67606
|
+
res.on = function (type, listener) {
|
67607
|
+
if (!pendingListeners) on.call(this, type, listener);
|
67608
|
+
else if (compress) compress.on(type, listener);
|
67609
|
+
else pendingListeners.push([type, listener]);
|
67610
|
+
return this;
|
67611
|
+
};
|
67612
|
+
|
67613
|
+
next();
|
67614
|
+
};
|
67458
67615
|
}
|
67459
67616
|
|
67460
67617
|
function resolvePreviewOptions(preview, server) {
|
@@ -67817,7 +67974,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
|
|
67817
67974
|
logger.warn(colors$1.yellow(`worker.plugins is now a function that returns an array of plugins. ` +
|
67818
67975
|
`Please update your Vite config accordingly.\n`));
|
67819
67976
|
}
|
67820
|
-
const createWorkerPlugins = async function () {
|
67977
|
+
const createWorkerPlugins = async function (bundleChain) {
|
67821
67978
|
// Some plugins that aren't intended to work in the bundling of workers (doing post-processing at build time for example).
|
67822
67979
|
// And Plugins may also have cached that could be corrupted by being used in these extra rollup calls.
|
67823
67980
|
// So we need to separate the worker plugin from the plugin that vite needs to run.
|
@@ -67837,6 +67994,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
|
|
67837
67994
|
...resolved,
|
67838
67995
|
isWorker: true,
|
67839
67996
|
mainConfig: resolved,
|
67997
|
+
bundleChain,
|
67840
67998
|
};
|
67841
67999
|
const resolvedWorkerPlugins = await resolvePlugins(workerResolved, workerPrePlugins, workerNormalPlugins, workerPostPlugins);
|
67842
68000
|
// run configResolved hooks
|
@@ -67865,6 +68023,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
|
|
67865
68023
|
ssr,
|
67866
68024
|
isWorker: false,
|
67867
68025
|
mainConfig: null,
|
68026
|
+
bundleChain: [],
|
67868
68027
|
isProduction,
|
67869
68028
|
plugins: userPlugins,
|
67870
68029
|
css: resolveCSSOptions(config.css),
|
@@ -68074,6 +68233,8 @@ async function bundleConfigFile(fileName, isESM) {
|
|
68074
68233
|
__dirname: dirnameVarName,
|
68075
68234
|
__filename: filenameVarName,
|
68076
68235
|
'import.meta.url': importMetaUrlVarName,
|
68236
|
+
'import.meta.dirname': dirnameVarName,
|
68237
|
+
'import.meta.filename': filenameVarName,
|
68077
68238
|
},
|
68078
68239
|
plugins: [
|
68079
68240
|
{
|