vite 5.3.5 → 5.4.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/client.d.ts +17 -0
- package/dist/node/chunks/{dep-CjZz522d.js → dep-AVIP6AlI.js} +1 -1
- package/dist/node/chunks/{dep-mCdpKltl.js → dep-BuSuK4CE.js} +391 -210
- package/dist/node/chunks/{dep-VqAwxVIc.js → dep-C5hW-0CE.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/index.js +2 -2
- package/dist/node/runtime.js +1 -3
- package/dist/node-cjs/publicUtils.cjs +122 -95
- package/index.cjs +0 -3
- package/package.json +5 -5
@@ -10781,18 +10781,32 @@ const glob$1 = Object.assign(glob_, {
|
|
10781
10781
|
});
|
10782
10782
|
glob$1.glob = glob$1;
|
10783
10783
|
|
10784
|
-
const comma = ','.charCodeAt(0);
|
10785
|
-
const semicolon = ';'.charCodeAt(0);
|
10786
|
-
const chars$
|
10787
|
-
const intToChar = new Uint8Array(64); // 64 possible chars.
|
10788
|
-
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
10789
|
-
for (let i = 0; i < chars$
|
10790
|
-
const c = chars$
|
10791
|
-
intToChar[i] = c;
|
10792
|
-
charToInt[c] = i;
|
10784
|
+
const comma$1 = ','.charCodeAt(0);
|
10785
|
+
const semicolon$1 = ';'.charCodeAt(0);
|
10786
|
+
const chars$2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
10787
|
+
const intToChar$1 = new Uint8Array(64); // 64 possible chars.
|
10788
|
+
const charToInt$1 = new Uint8Array(128); // z is 122 in ASCII
|
10789
|
+
for (let i = 0; i < chars$2.length; i++) {
|
10790
|
+
const c = chars$2.charCodeAt(i);
|
10791
|
+
intToChar$1[i] = c;
|
10792
|
+
charToInt$1[c] = i;
|
10793
|
+
}
|
10794
|
+
function encodeInteger$1(builder, num, relative) {
|
10795
|
+
let delta = num - relative;
|
10796
|
+
delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;
|
10797
|
+
do {
|
10798
|
+
let clamped = delta & 0b011111;
|
10799
|
+
delta >>>= 5;
|
10800
|
+
if (delta > 0)
|
10801
|
+
clamped |= 0b100000;
|
10802
|
+
builder.write(intToChar$1[clamped]);
|
10803
|
+
} while (delta > 0);
|
10804
|
+
return num;
|
10793
10805
|
}
|
10806
|
+
|
10807
|
+
const bufLength = 1024 * 16;
|
10794
10808
|
// Provide a fallback for older environments.
|
10795
|
-
const td = typeof TextDecoder !== 'undefined'
|
10809
|
+
const td$1 = typeof TextDecoder !== 'undefined'
|
10796
10810
|
? /* #__PURE__ */ new TextDecoder()
|
10797
10811
|
: typeof Buffer !== 'undefined'
|
10798
10812
|
? {
|
@@ -10810,137 +10824,54 @@ const td = typeof TextDecoder !== 'undefined'
|
|
10810
10824
|
return out;
|
10811
10825
|
},
|
10812
10826
|
};
|
10813
|
-
|
10814
|
-
|
10815
|
-
|
10816
|
-
|
10817
|
-
|
10818
|
-
|
10819
|
-
|
10820
|
-
|
10821
|
-
|
10822
|
-
|
10823
|
-
|
10824
|
-
|
10825
|
-
i = decodeInteger(mappings, i, state, 0); // genColumn
|
10826
|
-
const col = state[0];
|
10827
|
-
if (col < lastCol)
|
10828
|
-
sorted = false;
|
10829
|
-
lastCol = col;
|
10830
|
-
if (hasMoreVlq(mappings, i, semi)) {
|
10831
|
-
i = decodeInteger(mappings, i, state, 1); // sourcesIndex
|
10832
|
-
i = decodeInteger(mappings, i, state, 2); // sourceLine
|
10833
|
-
i = decodeInteger(mappings, i, state, 3); // sourceColumn
|
10834
|
-
if (hasMoreVlq(mappings, i, semi)) {
|
10835
|
-
i = decodeInteger(mappings, i, state, 4); // namesIndex
|
10836
|
-
seg = [col, state[1], state[2], state[3], state[4]];
|
10837
|
-
}
|
10838
|
-
else {
|
10839
|
-
seg = [col, state[1], state[2], state[3]];
|
10840
|
-
}
|
10841
|
-
}
|
10842
|
-
else {
|
10843
|
-
seg = [col];
|
10844
|
-
}
|
10845
|
-
line.push(seg);
|
10827
|
+
class StringWriter {
|
10828
|
+
constructor() {
|
10829
|
+
this.pos = 0;
|
10830
|
+
this.out = '';
|
10831
|
+
this.buffer = new Uint8Array(bufLength);
|
10832
|
+
}
|
10833
|
+
write(v) {
|
10834
|
+
const { buffer } = this;
|
10835
|
+
buffer[this.pos++] = v;
|
10836
|
+
if (this.pos === bufLength) {
|
10837
|
+
this.out += td$1.decode(buffer);
|
10838
|
+
this.pos = 0;
|
10846
10839
|
}
|
10847
|
-
if (!sorted)
|
10848
|
-
sort(line);
|
10849
|
-
decoded.push(line);
|
10850
|
-
index = semi + 1;
|
10851
|
-
} while (index <= mappings.length);
|
10852
|
-
return decoded;
|
10853
|
-
}
|
10854
|
-
function indexOf(mappings, index) {
|
10855
|
-
const idx = mappings.indexOf(';', index);
|
10856
|
-
return idx === -1 ? mappings.length : idx;
|
10857
|
-
}
|
10858
|
-
function decodeInteger(mappings, pos, state, j) {
|
10859
|
-
let value = 0;
|
10860
|
-
let shift = 0;
|
10861
|
-
let integer = 0;
|
10862
|
-
do {
|
10863
|
-
const c = mappings.charCodeAt(pos++);
|
10864
|
-
integer = charToInt[c];
|
10865
|
-
value |= (integer & 31) << shift;
|
10866
|
-
shift += 5;
|
10867
|
-
} while (integer & 32);
|
10868
|
-
const shouldNegate = value & 1;
|
10869
|
-
value >>>= 1;
|
10870
|
-
if (shouldNegate) {
|
10871
|
-
value = -0x80000000 | -value;
|
10872
10840
|
}
|
10873
|
-
|
10874
|
-
|
10875
|
-
|
10876
|
-
|
10877
|
-
if (i >= length)
|
10878
|
-
return false;
|
10879
|
-
return mappings.charCodeAt(i) !== comma;
|
10880
|
-
}
|
10881
|
-
function sort(line) {
|
10882
|
-
line.sort(sortComparator$1);
|
10883
|
-
}
|
10884
|
-
function sortComparator$1(a, b) {
|
10885
|
-
return a[0] - b[0];
|
10841
|
+
flush() {
|
10842
|
+
const { buffer, out, pos } = this;
|
10843
|
+
return pos > 0 ? out + td$1.decode(buffer.subarray(0, pos)) : out;
|
10844
|
+
}
|
10886
10845
|
}
|
10887
|
-
function encode$
|
10888
|
-
const
|
10889
|
-
|
10890
|
-
|
10891
|
-
|
10892
|
-
|
10893
|
-
let pos = 0;
|
10894
|
-
let out = '';
|
10846
|
+
function encode$2(decoded) {
|
10847
|
+
const writer = new StringWriter();
|
10848
|
+
let sourcesIndex = 0;
|
10849
|
+
let sourceLine = 0;
|
10850
|
+
let sourceColumn = 0;
|
10851
|
+
let namesIndex = 0;
|
10895
10852
|
for (let i = 0; i < decoded.length; i++) {
|
10896
10853
|
const line = decoded[i];
|
10897
|
-
if (i > 0)
|
10898
|
-
|
10899
|
-
out += td.decode(buf);
|
10900
|
-
pos = 0;
|
10901
|
-
}
|
10902
|
-
buf[pos++] = semicolon;
|
10903
|
-
}
|
10854
|
+
if (i > 0)
|
10855
|
+
writer.write(semicolon$1);
|
10904
10856
|
if (line.length === 0)
|
10905
10857
|
continue;
|
10906
|
-
|
10858
|
+
let genColumn = 0;
|
10907
10859
|
for (let j = 0; j < line.length; j++) {
|
10908
10860
|
const segment = line[j];
|
10909
|
-
// We can push up to 5 ints, each int can take at most 7 chars, and we
|
10910
|
-
// may push a comma.
|
10911
|
-
if (pos > subLength) {
|
10912
|
-
out += td.decode(sub);
|
10913
|
-
buf.copyWithin(0, subLength, pos);
|
10914
|
-
pos -= subLength;
|
10915
|
-
}
|
10916
10861
|
if (j > 0)
|
10917
|
-
|
10918
|
-
|
10862
|
+
writer.write(comma$1);
|
10863
|
+
genColumn = encodeInteger$1(writer, segment[0], genColumn);
|
10919
10864
|
if (segment.length === 1)
|
10920
10865
|
continue;
|
10921
|
-
|
10922
|
-
|
10923
|
-
|
10866
|
+
sourcesIndex = encodeInteger$1(writer, segment[1], sourcesIndex);
|
10867
|
+
sourceLine = encodeInteger$1(writer, segment[2], sourceLine);
|
10868
|
+
sourceColumn = encodeInteger$1(writer, segment[3], sourceColumn);
|
10924
10869
|
if (segment.length === 4)
|
10925
10870
|
continue;
|
10926
|
-
|
10871
|
+
namesIndex = encodeInteger$1(writer, segment[4], namesIndex);
|
10927
10872
|
}
|
10928
10873
|
}
|
10929
|
-
return
|
10930
|
-
}
|
10931
|
-
function encodeInteger(buf, pos, state, segment, j) {
|
10932
|
-
const next = segment[j];
|
10933
|
-
let num = next - state[j];
|
10934
|
-
state[j] = next;
|
10935
|
-
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
10936
|
-
do {
|
10937
|
-
let clamped = num & 0b011111;
|
10938
|
-
num >>>= 5;
|
10939
|
-
if (num > 0)
|
10940
|
-
clamped |= 0b100000;
|
10941
|
-
buf[pos++] = intToChar[clamped];
|
10942
|
-
} while (num > 0);
|
10943
|
-
return pos;
|
10874
|
+
return writer.flush();
|
10944
10875
|
}
|
10945
10876
|
|
10946
10877
|
class BitSet {
|
@@ -11157,7 +11088,7 @@ let SourceMap$1 = class SourceMap {
|
|
11157
11088
|
this.sources = properties.sources;
|
11158
11089
|
this.sourcesContent = properties.sourcesContent;
|
11159
11090
|
this.names = properties.names;
|
11160
|
-
this.mappings = encode$
|
11091
|
+
this.mappings = encode$2(properties.mappings);
|
11161
11092
|
if (typeof properties.x_google_ignoreList !== 'undefined') {
|
11162
11093
|
this.x_google_ignoreList = properties.x_google_ignoreList;
|
11163
11094
|
}
|
@@ -11698,8 +11629,10 @@ class MagicString {
|
|
11698
11629
|
update(start, end, content, options) {
|
11699
11630
|
if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
|
11700
11631
|
|
11701
|
-
|
11702
|
-
|
11632
|
+
if (this.original.length !== 0) {
|
11633
|
+
while (start < 0) start += this.original.length;
|
11634
|
+
while (end < 0) end += this.original.length;
|
11635
|
+
}
|
11703
11636
|
|
11704
11637
|
if (end > this.original.length) throw new Error('end is out of bounds');
|
11705
11638
|
if (start === end)
|
@@ -11795,8 +11728,10 @@ class MagicString {
|
|
11795
11728
|
}
|
11796
11729
|
|
11797
11730
|
remove(start, end) {
|
11798
|
-
|
11799
|
-
|
11731
|
+
if (this.original.length !== 0) {
|
11732
|
+
while (start < 0) start += this.original.length;
|
11733
|
+
while (end < 0) end += this.original.length;
|
11734
|
+
}
|
11800
11735
|
|
11801
11736
|
if (start === end) return this;
|
11802
11737
|
|
@@ -11819,8 +11754,10 @@ class MagicString {
|
|
11819
11754
|
}
|
11820
11755
|
|
11821
11756
|
reset(start, end) {
|
11822
|
-
|
11823
|
-
|
11757
|
+
if (this.original.length !== 0) {
|
11758
|
+
while (start < 0) start += this.original.length;
|
11759
|
+
while (end < 0) end += this.original.length;
|
11760
|
+
}
|
11824
11761
|
|
11825
11762
|
if (start === end) return this;
|
11826
11763
|
|
@@ -11882,8 +11819,10 @@ class MagicString {
|
|
11882
11819
|
}
|
11883
11820
|
|
11884
11821
|
slice(start = 0, end = this.original.length) {
|
11885
|
-
|
11886
|
-
|
11822
|
+
if (this.original.length !== 0) {
|
11823
|
+
while (start < 0) start += this.original.length;
|
11824
|
+
while (end < 0) end += this.original.length;
|
11825
|
+
}
|
11887
11826
|
|
11888
11827
|
let result = '';
|
11889
11828
|
|
@@ -14509,6 +14448,168 @@ function commonjs(options = {}) {
|
|
14509
14448
|
};
|
14510
14449
|
}
|
14511
14450
|
|
14451
|
+
const comma = ','.charCodeAt(0);
|
14452
|
+
const semicolon = ';'.charCodeAt(0);
|
14453
|
+
const chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
14454
|
+
const intToChar = new Uint8Array(64); // 64 possible chars.
|
14455
|
+
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
14456
|
+
for (let i = 0; i < chars$1.length; i++) {
|
14457
|
+
const c = chars$1.charCodeAt(i);
|
14458
|
+
intToChar[i] = c;
|
14459
|
+
charToInt[c] = i;
|
14460
|
+
}
|
14461
|
+
// Provide a fallback for older environments.
|
14462
|
+
const td = typeof TextDecoder !== 'undefined'
|
14463
|
+
? /* #__PURE__ */ new TextDecoder()
|
14464
|
+
: typeof Buffer !== 'undefined'
|
14465
|
+
? {
|
14466
|
+
decode(buf) {
|
14467
|
+
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
14468
|
+
return out.toString();
|
14469
|
+
},
|
14470
|
+
}
|
14471
|
+
: {
|
14472
|
+
decode(buf) {
|
14473
|
+
let out = '';
|
14474
|
+
for (let i = 0; i < buf.length; i++) {
|
14475
|
+
out += String.fromCharCode(buf[i]);
|
14476
|
+
}
|
14477
|
+
return out;
|
14478
|
+
},
|
14479
|
+
};
|
14480
|
+
function decode(mappings) {
|
14481
|
+
const state = new Int32Array(5);
|
14482
|
+
const decoded = [];
|
14483
|
+
let index = 0;
|
14484
|
+
do {
|
14485
|
+
const semi = indexOf(mappings, index);
|
14486
|
+
const line = [];
|
14487
|
+
let sorted = true;
|
14488
|
+
let lastCol = 0;
|
14489
|
+
state[0] = 0;
|
14490
|
+
for (let i = index; i < semi; i++) {
|
14491
|
+
let seg;
|
14492
|
+
i = decodeInteger(mappings, i, state, 0); // genColumn
|
14493
|
+
const col = state[0];
|
14494
|
+
if (col < lastCol)
|
14495
|
+
sorted = false;
|
14496
|
+
lastCol = col;
|
14497
|
+
if (hasMoreVlq(mappings, i, semi)) {
|
14498
|
+
i = decodeInteger(mappings, i, state, 1); // sourcesIndex
|
14499
|
+
i = decodeInteger(mappings, i, state, 2); // sourceLine
|
14500
|
+
i = decodeInteger(mappings, i, state, 3); // sourceColumn
|
14501
|
+
if (hasMoreVlq(mappings, i, semi)) {
|
14502
|
+
i = decodeInteger(mappings, i, state, 4); // namesIndex
|
14503
|
+
seg = [col, state[1], state[2], state[3], state[4]];
|
14504
|
+
}
|
14505
|
+
else {
|
14506
|
+
seg = [col, state[1], state[2], state[3]];
|
14507
|
+
}
|
14508
|
+
}
|
14509
|
+
else {
|
14510
|
+
seg = [col];
|
14511
|
+
}
|
14512
|
+
line.push(seg);
|
14513
|
+
}
|
14514
|
+
if (!sorted)
|
14515
|
+
sort(line);
|
14516
|
+
decoded.push(line);
|
14517
|
+
index = semi + 1;
|
14518
|
+
} while (index <= mappings.length);
|
14519
|
+
return decoded;
|
14520
|
+
}
|
14521
|
+
function indexOf(mappings, index) {
|
14522
|
+
const idx = mappings.indexOf(';', index);
|
14523
|
+
return idx === -1 ? mappings.length : idx;
|
14524
|
+
}
|
14525
|
+
function decodeInteger(mappings, pos, state, j) {
|
14526
|
+
let value = 0;
|
14527
|
+
let shift = 0;
|
14528
|
+
let integer = 0;
|
14529
|
+
do {
|
14530
|
+
const c = mappings.charCodeAt(pos++);
|
14531
|
+
integer = charToInt[c];
|
14532
|
+
value |= (integer & 31) << shift;
|
14533
|
+
shift += 5;
|
14534
|
+
} while (integer & 32);
|
14535
|
+
const shouldNegate = value & 1;
|
14536
|
+
value >>>= 1;
|
14537
|
+
if (shouldNegate) {
|
14538
|
+
value = -0x80000000 | -value;
|
14539
|
+
}
|
14540
|
+
state[j] += value;
|
14541
|
+
return pos;
|
14542
|
+
}
|
14543
|
+
function hasMoreVlq(mappings, i, length) {
|
14544
|
+
if (i >= length)
|
14545
|
+
return false;
|
14546
|
+
return mappings.charCodeAt(i) !== comma;
|
14547
|
+
}
|
14548
|
+
function sort(line) {
|
14549
|
+
line.sort(sortComparator$1);
|
14550
|
+
}
|
14551
|
+
function sortComparator$1(a, b) {
|
14552
|
+
return a[0] - b[0];
|
14553
|
+
}
|
14554
|
+
function encode$1(decoded) {
|
14555
|
+
const state = new Int32Array(5);
|
14556
|
+
const bufLength = 1024 * 16;
|
14557
|
+
const subLength = bufLength - 36;
|
14558
|
+
const buf = new Uint8Array(bufLength);
|
14559
|
+
const sub = buf.subarray(0, subLength);
|
14560
|
+
let pos = 0;
|
14561
|
+
let out = '';
|
14562
|
+
for (let i = 0; i < decoded.length; i++) {
|
14563
|
+
const line = decoded[i];
|
14564
|
+
if (i > 0) {
|
14565
|
+
if (pos === bufLength) {
|
14566
|
+
out += td.decode(buf);
|
14567
|
+
pos = 0;
|
14568
|
+
}
|
14569
|
+
buf[pos++] = semicolon;
|
14570
|
+
}
|
14571
|
+
if (line.length === 0)
|
14572
|
+
continue;
|
14573
|
+
state[0] = 0;
|
14574
|
+
for (let j = 0; j < line.length; j++) {
|
14575
|
+
const segment = line[j];
|
14576
|
+
// We can push up to 5 ints, each int can take at most 7 chars, and we
|
14577
|
+
// may push a comma.
|
14578
|
+
if (pos > subLength) {
|
14579
|
+
out += td.decode(sub);
|
14580
|
+
buf.copyWithin(0, subLength, pos);
|
14581
|
+
pos -= subLength;
|
14582
|
+
}
|
14583
|
+
if (j > 0)
|
14584
|
+
buf[pos++] = comma;
|
14585
|
+
pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
|
14586
|
+
if (segment.length === 1)
|
14587
|
+
continue;
|
14588
|
+
pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
|
14589
|
+
pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
|
14590
|
+
pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
|
14591
|
+
if (segment.length === 4)
|
14592
|
+
continue;
|
14593
|
+
pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
|
14594
|
+
}
|
14595
|
+
}
|
14596
|
+
return out + td.decode(buf.subarray(0, pos));
|
14597
|
+
}
|
14598
|
+
function encodeInteger(buf, pos, state, segment, j) {
|
14599
|
+
const next = segment[j];
|
14600
|
+
let num = next - state[j];
|
14601
|
+
state[j] = next;
|
14602
|
+
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
14603
|
+
do {
|
14604
|
+
let clamped = num & 0b011111;
|
14605
|
+
num >>>= 5;
|
14606
|
+
if (num > 0)
|
14607
|
+
clamped |= 0b100000;
|
14608
|
+
buf[pos++] = intToChar[clamped];
|
14609
|
+
} while (num > 0);
|
14610
|
+
return pos;
|
14611
|
+
}
|
14612
|
+
|
14512
14613
|
// Matches the scheme of a URL, eg "http://"
|
14513
14614
|
const schemeRegex = /^[\w+.-]+:\/\//;
|
14514
14615
|
/**
|
@@ -16019,6 +16120,8 @@ function requireBrowser$1 () {
|
|
16019
16120
|
return false;
|
16020
16121
|
}
|
16021
16122
|
|
16123
|
+
let m;
|
16124
|
+
|
16022
16125
|
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
16023
16126
|
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
16024
16127
|
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
@@ -16026,7 +16129,7 @@ function requireBrowser$1 () {
|
|
16026
16129
|
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
16027
16130
|
// Is firefox >= v31?
|
16028
16131
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
16029
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(
|
16132
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
|
16030
16133
|
// Double check webkit in userAgent just in case we are in a worker
|
16031
16134
|
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
16032
16135
|
}
|
@@ -16685,7 +16788,7 @@ function traverseBetweenDirs(longerDir, shorterDir, cb) {
|
|
16685
16788
|
const createFilter = createFilter$1;
|
16686
16789
|
const replaceSlashOrColonRE = /[/:]/g;
|
16687
16790
|
const replaceDotRE = /\./g;
|
16688
|
-
const replaceNestedIdRE =
|
16791
|
+
const replaceNestedIdRE = /\s*>\s*/g;
|
16689
16792
|
const replaceHashRE = /#/g;
|
16690
16793
|
const flattenId = (id) => {
|
16691
16794
|
const flatId = limitFlattenIdLength(
|
@@ -17025,7 +17128,7 @@ function emptyDir(dir, skip) {
|
|
17025
17128
|
if (skip?.length) {
|
17026
17129
|
for (const file of skip) {
|
17027
17130
|
if (path$n.dirname(file) !== ".") {
|
17028
|
-
const matched =
|
17131
|
+
const matched = splitFirstDirRE.exec(file);
|
17029
17132
|
if (matched) {
|
17030
17133
|
nested ??= /* @__PURE__ */ new Map();
|
17031
17134
|
const [, nestedDir, skipPath] = matched;
|
@@ -17110,7 +17213,7 @@ function windowsMappedRealpathSync(path2) {
|
|
17110
17213
|
}
|
17111
17214
|
return realPath;
|
17112
17215
|
}
|
17113
|
-
const parseNetUseRE =
|
17216
|
+
const parseNetUseRE = /^\w* +(\w:) +([^ ]+)\s/;
|
17114
17217
|
let firstSafeRealPathSyncRun = false;
|
17115
17218
|
function windowsSafeRealPathSync(path2) {
|
17116
17219
|
if (!firstSafeRealPathSyncRun) {
|
@@ -17137,8 +17240,8 @@ function optimizeSafeRealPathSync() {
|
|
17137
17240
|
if (error) return;
|
17138
17241
|
const lines = stdout.split("\n");
|
17139
17242
|
for (const line of lines) {
|
17140
|
-
const m =
|
17141
|
-
if (m) windowsNetworkMap.set(m[
|
17243
|
+
const m = parseNetUseRE.exec(line);
|
17244
|
+
if (m) windowsNetworkMap.set(m[2], m[1]);
|
17142
17245
|
}
|
17143
17246
|
if (windowsNetworkMap.size === 0) {
|
17144
17247
|
safeRealpathSync = fs__default.realpathSync.native;
|
@@ -17154,7 +17257,7 @@ function ensureWatchedFile(watcher, file, root) {
|
|
17154
17257
|
watcher.add(path$n.resolve(file));
|
17155
17258
|
}
|
17156
17259
|
}
|
17157
|
-
const escapedSpaceCharacters = /( |\\t|\\n|\\f|\\r)+/g;
|
17260
|
+
const escapedSpaceCharacters = /(?: |\\t|\\n|\\f|\\r)+/g;
|
17158
17261
|
const imageSetUrlRE = /^(?:[\w\-]+\(.*?\)|'.*?'|".*?"|\S*)/;
|
17159
17262
|
function joinSrcset(ret) {
|
17160
17263
|
return ret.map(({ url, descriptor }) => url + (descriptor ? ` ${descriptor}` : "")).join(", ");
|
@@ -17402,6 +17505,9 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
17402
17505
|
...backwardCompatibleWorkerPlugins(value)
|
17403
17506
|
];
|
17404
17507
|
continue;
|
17508
|
+
} else if (key === "server" && rootPath === "server.hmr") {
|
17509
|
+
merged[key] = value;
|
17510
|
+
continue;
|
17405
17511
|
}
|
17406
17512
|
if (Array.isArray(existing) || Array.isArray(value)) {
|
17407
17513
|
merged[key] = [...arraify(existing), ...arraify(value)];
|
@@ -19093,7 +19199,7 @@ class TSConfckCache {
|
|
19093
19199
|
}
|
19094
19200
|
|
19095
19201
|
const debug$h = createDebugger("vite:esbuild");
|
19096
|
-
const IIFE_BEGIN_RE = /(const|var)\s+\S+\s*=\s*function\([^()]*\)\s*\{\s*"use strict";/;
|
19202
|
+
const IIFE_BEGIN_RE = /(?:const|var)\s+\S+\s*=\s*function\([^()]*\)\s*\{\s*"use strict";/;
|
19097
19203
|
const validExtensionRE = /\.\w+$/;
|
19098
19204
|
const jsxExtensionsRE = /\.(?:j|t)sx\b/;
|
19099
19205
|
const defaultEsbuildSupported = {
|
@@ -20574,7 +20680,7 @@ function dataURIPlugin() {
|
|
20574
20680
|
if (uri.protocol !== "data:") {
|
20575
20681
|
return;
|
20576
20682
|
}
|
20577
|
-
const match = uri.pathname
|
20683
|
+
const match = dataUriRE.exec(uri.pathname);
|
20578
20684
|
if (!match) {
|
20579
20685
|
return;
|
20580
20686
|
}
|
@@ -34925,7 +35031,7 @@ function polyfill() {
|
|
34925
35031
|
}
|
34926
35032
|
}
|
34927
35033
|
|
34928
|
-
const htmlProxyRE$1 = /\?html-proxy=?(?:&inline-css)?(?:&style-attr)?&index=(\d+)\.(js|css)$/;
|
35034
|
+
const htmlProxyRE$1 = /\?html-proxy=?(?:&inline-css)?(?:&style-attr)?&index=(\d+)\.(?:js|css)$/;
|
34929
35035
|
const isHtmlProxyRE = /\?html-proxy\b/;
|
34930
35036
|
const inlineCSSRE$1 = /__VITE_INLINE_CSS__([a-z\d]{8}_\d+)__/g;
|
34931
35037
|
const inlineImportRE = /(?<!(?<!\.\.)\.)\bimport\s*\(("(?:[^"]|(?<=\\)")*"|'(?:[^']|(?<=\\)')*')\)/dg;
|
@@ -34952,7 +35058,7 @@ function htmlInlineProxyPlugin(config) {
|
|
34952
35058
|
}
|
34953
35059
|
},
|
34954
35060
|
load(id) {
|
34955
|
-
const proxyMatch =
|
35061
|
+
const proxyMatch = htmlProxyRE$1.exec(id);
|
34956
35062
|
if (proxyMatch) {
|
34957
35063
|
const index = Number(proxyMatch[1]);
|
34958
35064
|
const file = cleanUrl(id);
|
@@ -35041,7 +35147,7 @@ function overwriteAttrValue(s, sourceCodeLocation, newValue) {
|
|
35041
35147
|
sourceCodeLocation.startOffset,
|
35042
35148
|
sourceCodeLocation.endOffset
|
35043
35149
|
);
|
35044
|
-
const valueStart =
|
35150
|
+
const valueStart = attrValueStartRE.exec(srcString);
|
35045
35151
|
if (!valueStart) {
|
35046
35152
|
throw new Error(
|
35047
35153
|
`[vite:html] internal error, failed to overwrite attribute value`
|
@@ -35827,7 +35933,7 @@ async function applyHtmlTransforms(html, hooks, ctx) {
|
|
35827
35933
|
}
|
35828
35934
|
return html;
|
35829
35935
|
}
|
35830
|
-
const importRE = /\bimport\s*("[^"]*[^\\]"|'[^']*[^\\]');*/g;
|
35936
|
+
const importRE = /\bimport\s*(?:"[^"]*[^\\]"|'[^']*[^\\]');*/g;
|
35831
35937
|
const commentRE$1 = /\/\*[\s\S]*?\*\/|\/\/.*$/gm;
|
35832
35938
|
function isEntirelyImport(code) {
|
35833
35939
|
return !code.replace(importRE, "").replace(commentRE$1, "").trim().length;
|
@@ -35980,7 +36086,7 @@ const inlineCSSRE = /[?&]inline-css\b/;
|
|
35980
36086
|
const styleAttrRE = /[?&]style-attr\b/;
|
35981
36087
|
const functionCallRE = /^[A-Z_][\w-]*\(/i;
|
35982
36088
|
const transformOnlyRE = /[?&]transform-only\b/;
|
35983
|
-
const nonEscapedDoubleQuoteRe = /(?<!\\)
|
36089
|
+
const nonEscapedDoubleQuoteRe = /(?<!\\)"/g;
|
35984
36090
|
const cssBundleName = "style.css";
|
35985
36091
|
const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
|
35986
36092
|
const isModuleCSSRequest = (request) => cssModuleRE.test(request);
|
@@ -36675,7 +36781,7 @@ async function compileCSS(id, code, config, workerController, urlReplacer) {
|
|
36675
36781
|
const isModule = modulesOptions !== false && cssModuleRE.test(id);
|
36676
36782
|
const needInlineImport = code.includes("@import");
|
36677
36783
|
const hasUrl = cssUrlRE.test(code) || cssImageSetRE.test(code);
|
36678
|
-
const lang =
|
36784
|
+
const lang = CSS_LANGS_RE.exec(id)?.[1];
|
36679
36785
|
const postcssConfig = await resolvePostcssConfig(config);
|
36680
36786
|
if (lang === "css" && !postcssConfig && !isModule && !needInlineImport && !hasUrl) {
|
36681
36787
|
return { code, map: null };
|
@@ -36724,7 +36830,7 @@ async function compileCSS(id, code, config, workerController, urlReplacer) {
|
|
36724
36830
|
},
|
36725
36831
|
async load(id2) {
|
36726
36832
|
const code2 = await fs__default.promises.readFile(id2, "utf-8");
|
36727
|
-
const lang2 =
|
36833
|
+
const lang2 = CSS_LANGS_RE.exec(id2)?.[1];
|
36728
36834
|
if (isPreProcessor(lang2)) {
|
36729
36835
|
const result = await compileCSSPreprocessors(
|
36730
36836
|
id2,
|
@@ -36882,8 +36988,8 @@ function createCachedImport(imp) {
|
|
36882
36988
|
return cached;
|
36883
36989
|
};
|
36884
36990
|
}
|
36885
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
36886
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
36991
|
+
const importPostcssImport = createCachedImport(() => import('./dep-C5hW-0CE.js').then(function (n) { return n.i; }));
|
36992
|
+
const importPostcssModules = createCachedImport(() => import('./dep-AVIP6AlI.js').then(function (n) { return n.i; }));
|
36887
36993
|
const importPostcss = createCachedImport(() => import('postcss'));
|
36888
36994
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
36889
36995
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -37287,6 +37393,77 @@ const makeScssWorker = (resolvers, alias, maxWorkers) => {
|
|
37287
37393
|
);
|
37288
37394
|
return worker;
|
37289
37395
|
};
|
37396
|
+
const makeModernScssWorker = (resolvers, alias, maxWorkers) => {
|
37397
|
+
const internalCanonicalize = async (url, importer) => {
|
37398
|
+
importer = cleanScssBugUrl(importer);
|
37399
|
+
const resolved = await resolvers.sass(url, importer);
|
37400
|
+
return resolved ?? null;
|
37401
|
+
};
|
37402
|
+
const internalLoad = async (file, rootFile) => {
|
37403
|
+
const result = await rebaseUrls(file, rootFile, alias, "$", resolvers.sass);
|
37404
|
+
if (result.contents) {
|
37405
|
+
return result.contents;
|
37406
|
+
}
|
37407
|
+
return await fsp.readFile(result.file, "utf-8");
|
37408
|
+
};
|
37409
|
+
const worker = new WorkerWithFallback(
|
37410
|
+
() => async (sassPath, data, options) => {
|
37411
|
+
const sass = require(sassPath);
|
37412
|
+
const path2 = require("node:path");
|
37413
|
+
const { fileURLToPath, pathToFileURL } = (
|
37414
|
+
// eslint-disable-next-line no-restricted-globals
|
37415
|
+
require("node:url")
|
37416
|
+
);
|
37417
|
+
const sassOptions = { ...options };
|
37418
|
+
sassOptions.url = pathToFileURL(options.filename);
|
37419
|
+
sassOptions.sourceMap = options.enableSourcemap;
|
37420
|
+
const internalImporter = {
|
37421
|
+
async canonicalize(url, context) {
|
37422
|
+
const importer = context.containingUrl ? fileURLToPath(context.containingUrl) : options.filename;
|
37423
|
+
const resolved = await internalCanonicalize(url, importer);
|
37424
|
+
return resolved ? pathToFileURL(resolved) : null;
|
37425
|
+
},
|
37426
|
+
async load(canonicalUrl) {
|
37427
|
+
const ext = path2.extname(canonicalUrl.pathname);
|
37428
|
+
let syntax = "scss";
|
37429
|
+
if (ext === ".sass") {
|
37430
|
+
syntax = "indented";
|
37431
|
+
} else if (ext === ".css") {
|
37432
|
+
syntax = "css";
|
37433
|
+
}
|
37434
|
+
const contents = await internalLoad(
|
37435
|
+
fileURLToPath(canonicalUrl),
|
37436
|
+
options.filename
|
37437
|
+
);
|
37438
|
+
return { contents, syntax };
|
37439
|
+
}
|
37440
|
+
};
|
37441
|
+
sassOptions.importers = [
|
37442
|
+
...sassOptions.importers ?? [],
|
37443
|
+
internalImporter
|
37444
|
+
];
|
37445
|
+
const result = await sass.compileStringAsync(data, sassOptions);
|
37446
|
+
return {
|
37447
|
+
css: result.css,
|
37448
|
+
map: result.sourceMap ? JSON.stringify(result.sourceMap) : void 0,
|
37449
|
+
stats: {
|
37450
|
+
includedFiles: result.loadedUrls.filter((url) => url.protocol === "file:").map((url) => fileURLToPath(url))
|
37451
|
+
}
|
37452
|
+
};
|
37453
|
+
},
|
37454
|
+
{
|
37455
|
+
parentFunctions: {
|
37456
|
+
internalCanonicalize,
|
37457
|
+
internalLoad
|
37458
|
+
},
|
37459
|
+
shouldUseFake(_sassPath, _data, options) {
|
37460
|
+
return !!(options.functions && Object.keys(options.functions).length > 0 || options.importers && (!Array.isArray(options.importers) || options.importers.length > 0));
|
37461
|
+
},
|
37462
|
+
max: maxWorkers
|
37463
|
+
}
|
37464
|
+
);
|
37465
|
+
return worker;
|
37466
|
+
};
|
37290
37467
|
const scssProcessor = (maxWorkers) => {
|
37291
37468
|
const workerMap = /* @__PURE__ */ new Map();
|
37292
37469
|
return {
|
@@ -37300,7 +37477,7 @@ const scssProcessor = (maxWorkers) => {
|
|
37300
37477
|
if (!workerMap.has(options.alias)) {
|
37301
37478
|
workerMap.set(
|
37302
37479
|
options.alias,
|
37303
|
-
makeScssWorker(resolvers, options.alias, maxWorkers)
|
37480
|
+
options.api === "modern" ? makeModernScssWorker(resolvers, options.alias, maxWorkers) : makeScssWorker(resolvers, options.alias, maxWorkers)
|
37304
37481
|
);
|
37305
37482
|
}
|
37306
37483
|
const worker = workerMap.get(options.alias);
|
@@ -37651,7 +37828,7 @@ const createPreprocessorWorkerController = (maxWorkers) => {
|
|
37651
37828
|
return scss.process(
|
37652
37829
|
source,
|
37653
37830
|
root,
|
37654
|
-
{ ...options, indentedSyntax: true },
|
37831
|
+
{ ...options, indentedSyntax: true, syntax: "indented" },
|
37655
37832
|
resolvers
|
37656
37833
|
);
|
37657
37834
|
};
|
@@ -37808,7 +37985,7 @@ const convertTargets = (esbuildTarget) => {
|
|
37808
37985
|
if (cached) return cached;
|
37809
37986
|
const targets = {};
|
37810
37987
|
const entriesWithoutES = arraify(esbuildTarget).flatMap((e) => {
|
37811
|
-
const match =
|
37988
|
+
const match = esRE.exec(e);
|
37812
37989
|
if (!match) return e;
|
37813
37990
|
const year = Number(match[1]);
|
37814
37991
|
if (!esMap[year]) throw new Error(`Unsupported target "${e}"`);
|
@@ -46125,7 +46302,7 @@ function tryCleanFsResolve(file, options, tryIndex = true, targetWeb = true, ski
|
|
46125
46302
|
}
|
46126
46303
|
function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr = false, externalize, allowLinkedExternal = true) {
|
46127
46304
|
const { root, dedupe, isBuild, preserveSymlinks, packageCache } = options;
|
46128
|
-
const deepMatch =
|
46305
|
+
const deepMatch = deepImportRE.exec(id);
|
46129
46306
|
const pkgId = deepMatch ? deepMatch[1] || deepMatch[2] : cleanUrl(id);
|
46130
46307
|
let basedir;
|
46131
46308
|
if (dedupe?.includes(pkgId)) {
|
@@ -46928,7 +47105,7 @@ function optimizedDepsPlugin(config) {
|
|
46928
47105
|
if (depsOptimizer?.isOptimizedDepFile(id)) {
|
46929
47106
|
const metadata = depsOptimizer.metadata;
|
46930
47107
|
const file = cleanUrl(id);
|
46931
|
-
const versionMatch =
|
47108
|
+
const versionMatch = DEP_VERSION_RE.exec(file);
|
46932
47109
|
const browserHash = versionMatch ? versionMatch[1].split("=")[1] : void 0;
|
46933
47110
|
const info = optimizedDepInfoFromFile(metadata, file);
|
46934
47111
|
if (info) {
|
@@ -46986,6 +47163,9 @@ function throwFileNotFoundInOptimizedDep(id) {
|
|
46986
47163
|
|
46987
47164
|
const nonJsRe = /\.json(?:$|\?)/;
|
46988
47165
|
const isNonJsRequest = (request) => nonJsRe.test(request);
|
47166
|
+
const importMetaEnvMarker = "__vite_import_meta_env__";
|
47167
|
+
const bareImportMetaEnvRe = new RegExp(`${importMetaEnvMarker}(?!\\.)\\b`);
|
47168
|
+
const importMetaEnvKeyRe = new RegExp(`${importMetaEnvMarker}\\..+?\\b`, "g");
|
46989
47169
|
function definePlugin(config) {
|
46990
47170
|
const isBuild = config.command === "build";
|
46991
47171
|
const isBuildLib = isBuild && config.build.lib;
|
@@ -47034,12 +47214,15 @@ function definePlugin(config) {
|
|
47034
47214
|
define["import.meta.env.SSR"] = ssr + "";
|
47035
47215
|
}
|
47036
47216
|
if ("import.meta.env" in define) {
|
47037
|
-
define["import.meta.env"] =
|
47038
|
-
...importMetaEnvKeys,
|
47039
|
-
SSR: ssr + "",
|
47040
|
-
...userDefineEnv
|
47041
|
-
});
|
47217
|
+
define["import.meta.env"] = importMetaEnvMarker;
|
47042
47218
|
}
|
47219
|
+
const importMetaEnvVal = serializeDefine({
|
47220
|
+
...importMetaEnvKeys,
|
47221
|
+
SSR: ssr + "",
|
47222
|
+
...userDefineEnv
|
47223
|
+
});
|
47224
|
+
const banner = `const ${importMetaEnvMarker} = ${importMetaEnvVal};
|
47225
|
+
`;
|
47043
47226
|
const patternKeys = Object.keys(userDefine);
|
47044
47227
|
if (replaceProcessEnv && Object.keys(processEnv).length) {
|
47045
47228
|
patternKeys.push("process.env");
|
@@ -47048,7 +47231,7 @@ function definePlugin(config) {
|
|
47048
47231
|
patternKeys.push("import.meta.env", "import.meta.hot");
|
47049
47232
|
}
|
47050
47233
|
const pattern = patternKeys.length ? new RegExp(patternKeys.map(escapeRegex).join("|")) : null;
|
47051
|
-
return [define, pattern];
|
47234
|
+
return [define, pattern, banner];
|
47052
47235
|
}
|
47053
47236
|
const defaultPattern = generatePattern(false);
|
47054
47237
|
const ssrPattern = generatePattern(true);
|
@@ -47065,22 +47248,28 @@ function definePlugin(config) {
|
|
47065
47248
|
) {
|
47066
47249
|
return;
|
47067
47250
|
}
|
47068
|
-
const [define, pattern] = ssr ? ssrPattern : defaultPattern;
|
47251
|
+
const [define, pattern, banner] = ssr ? ssrPattern : defaultPattern;
|
47069
47252
|
if (!pattern) return;
|
47070
47253
|
pattern.lastIndex = 0;
|
47071
47254
|
if (!pattern.test(code)) return;
|
47072
|
-
|
47255
|
+
const result = await replaceDefine(code, id, define, config);
|
47256
|
+
result.code = result.code.replaceAll(
|
47257
|
+
importMetaEnvKeyRe,
|
47258
|
+
(m) => "undefined".padEnd(m.length)
|
47259
|
+
);
|
47260
|
+
if (bareImportMetaEnvRe.test(result.code)) {
|
47261
|
+
result.code = banner + result.code;
|
47262
|
+
if (result.map) {
|
47263
|
+
const map = JSON.parse(result.map);
|
47264
|
+
map.mappings = ";" + map.mappings;
|
47265
|
+
result.map = map;
|
47266
|
+
}
|
47267
|
+
}
|
47268
|
+
return result;
|
47073
47269
|
}
|
47074
47270
|
};
|
47075
47271
|
}
|
47076
47272
|
async function replaceDefine(code, id, define, config) {
|
47077
|
-
const replacementMarkers = {};
|
47078
|
-
const env = define["import.meta.env"];
|
47079
|
-
if (env && !canJsonParse(env)) {
|
47080
|
-
const marker = `_${getHash(env, env.length - 2)}_`;
|
47081
|
-
replacementMarkers[marker] = env;
|
47082
|
-
define = { ...define, "import.meta.env": marker };
|
47083
|
-
}
|
47084
47273
|
const esbuildOptions = config.esbuild || {};
|
47085
47274
|
const result = await transform$1(code, {
|
47086
47275
|
loader: "js",
|
@@ -47106,9 +47295,6 @@ async function replaceDefine(code, id, define, config) {
|
|
47106
47295
|
result.map = JSON.stringify(encodedMap(new TraceMap(decoded)));
|
47107
47296
|
}
|
47108
47297
|
}
|
47109
|
-
for (const marker in replacementMarkers) {
|
47110
|
-
result.code = result.code.replaceAll(marker, replacementMarkers[marker]);
|
47111
|
-
}
|
47112
47298
|
return {
|
47113
47299
|
code: result.code,
|
47114
47300
|
map: result.map || null
|
@@ -47132,14 +47318,6 @@ function handleDefineValue(value) {
|
|
47132
47318
|
if (typeof value === "string") return value;
|
47133
47319
|
return JSON.stringify(value);
|
47134
47320
|
}
|
47135
|
-
function canJsonParse(value) {
|
47136
|
-
try {
|
47137
|
-
JSON.parse(value);
|
47138
|
-
return true;
|
47139
|
-
} catch {
|
47140
|
-
return false;
|
47141
|
-
}
|
47142
|
-
}
|
47143
47321
|
|
47144
47322
|
const normalizedClientEntry = normalizePath$3(CLIENT_ENTRY);
|
47145
47323
|
const normalizedEnvEntry = normalizePath$3(ENV_ENTRY);
|
@@ -48467,7 +48645,7 @@ function buildErrorMessage(err, args = [], includeStack = true) {
|
|
48467
48645
|
return args.join("\n");
|
48468
48646
|
}
|
48469
48647
|
function cleanStack(stack) {
|
48470
|
-
return stack.split(/\n/
|
48648
|
+
return stack.split(/\n/).filter((l) => /^\s*at/.test(l)).join("\n");
|
48471
48649
|
}
|
48472
48650
|
function logError(server, err) {
|
48473
48651
|
const msg = buildErrorMessage(err, [
|
@@ -49391,9 +49569,9 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
|
|
49391
49569
|
let scriptId = 0;
|
49392
49570
|
const matches = raw.matchAll(scriptRE);
|
49393
49571
|
for (const [, openTag, content] of matches) {
|
49394
|
-
const typeMatch =
|
49572
|
+
const typeMatch = typeRE.exec(openTag);
|
49395
49573
|
const type = typeMatch && (typeMatch[1] || typeMatch[2] || typeMatch[3]);
|
49396
|
-
const langMatch =
|
49574
|
+
const langMatch = langRE.exec(openTag);
|
49397
49575
|
const lang = langMatch && (langMatch[1] || langMatch[2] || langMatch[3]);
|
49398
49576
|
if (isHtml && type !== "module") {
|
49399
49577
|
continue;
|
@@ -49407,7 +49585,7 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
|
|
49407
49585
|
} else if (p.endsWith(".astro")) {
|
49408
49586
|
loader = "ts";
|
49409
49587
|
}
|
49410
|
-
const srcMatch =
|
49588
|
+
const srcMatch = srcRE.exec(openTag);
|
49411
49589
|
if (srcMatch) {
|
49412
49590
|
const src = srcMatch[1] || srcMatch[2] || srcMatch[3];
|
49413
49591
|
js += `import ${JSON.stringify(src)}
|
@@ -49436,7 +49614,7 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
|
|
49436
49614
|
};
|
49437
49615
|
}
|
49438
49616
|
const virtualModulePath = JSON.stringify(virtualModulePrefix + key);
|
49439
|
-
const contextMatch =
|
49617
|
+
const contextMatch = contextRE.exec(openTag);
|
49440
49618
|
const context = contextMatch && (contextMatch[1] || contextMatch[2] || contextMatch[3]);
|
49441
49619
|
if (p.endsWith(".svelte") && context !== "module") {
|
49442
49620
|
js += `import ${virtualModulePath}
|
@@ -49658,7 +49836,7 @@ function expandGlobIds(id, config) {
|
|
49658
49836
|
if (exportsValue.startsWith("./") && !filePath.startsWith("./")) {
|
49659
49837
|
filePath = "./" + filePath;
|
49660
49838
|
}
|
49661
|
-
const matched2 = slash$1(filePath)
|
49839
|
+
const matched2 = exportsValueGlobRe.exec(slash$1(filePath));
|
49662
49840
|
if (matched2) {
|
49663
49841
|
let allGlobSame = matched2.length === 2;
|
49664
49842
|
if (!allGlobSame) {
|
@@ -49769,7 +49947,7 @@ async function createDepsOptimizer(config, server) {
|
|
49769
49947
|
let newDepsToLogHandle;
|
49770
49948
|
const logNewlyDiscoveredDeps = () => {
|
49771
49949
|
if (newDepsToLog.length) {
|
49772
|
-
|
49950
|
+
logger.info(
|
49773
49951
|
colors$1.green(
|
49774
49952
|
`\u2728 new dependencies optimized: ${depsLogString(newDepsToLog)}`
|
49775
49953
|
),
|
@@ -49783,7 +49961,7 @@ async function createDepsOptimizer(config, server) {
|
|
49783
49961
|
let discoveredDepsWhileScanning = [];
|
49784
49962
|
const logDiscoveredDepsWhileScanning = () => {
|
49785
49963
|
if (discoveredDepsWhileScanning.length) {
|
49786
|
-
|
49964
|
+
logger.info(
|
49787
49965
|
colors$1.green(
|
49788
49966
|
`\u2728 discovered while scanning: ${depsLogString(
|
49789
49967
|
discoveredDepsWhileScanning
|
@@ -49977,7 +50155,7 @@ async function createDepsOptimizer(config, server) {
|
|
49977
50155
|
logNewlyDiscoveredDeps();
|
49978
50156
|
if (warnAboutMissedDependencies) {
|
49979
50157
|
logDiscoveredDepsWhileScanning();
|
49980
|
-
|
50158
|
+
logger.info(
|
49981
50159
|
colors$1.magenta(
|
49982
50160
|
`\u2757 add these dependencies to optimizeDeps.include to speed up cold start`
|
49983
50161
|
),
|
@@ -50009,7 +50187,7 @@ async function createDepsOptimizer(config, server) {
|
|
50009
50187
|
logNewlyDiscoveredDeps();
|
50010
50188
|
if (warnAboutMissedDependencies) {
|
50011
50189
|
logDiscoveredDepsWhileScanning();
|
50012
|
-
|
50190
|
+
logger.info(
|
50013
50191
|
colors$1.magenta(
|
50014
50192
|
`\u2757 add these dependencies to optimizeDeps.include to avoid a full page reload during cold start`
|
50015
50193
|
),
|
@@ -50025,7 +50203,7 @@ async function createDepsOptimizer(config, server) {
|
|
50025
50203
|
}
|
50026
50204
|
);
|
50027
50205
|
if (needsInteropMismatch.length > 0) {
|
50028
|
-
|
50206
|
+
logger.warn(
|
50029
50207
|
`Mixed ESM and CJS detected in ${colors$1.yellow(
|
50030
50208
|
needsInteropMismatch.join(", ")
|
50031
50209
|
)}, add ${needsInteropMismatch.length === 1 ? "it" : "them"} to optimizeDeps.needsInterop to speed up cold start`,
|
@@ -52072,7 +52250,7 @@ Contents of line ${line}: ${code.split("\n")[line - 1]}`
|
|
52072
52250
|
const dynamicDeps = /* @__PURE__ */ new Set();
|
52073
52251
|
const idToImportMap = /* @__PURE__ */ new Map();
|
52074
52252
|
const declaredConst = /* @__PURE__ */ new Set();
|
52075
|
-
const hoistIndex =
|
52253
|
+
const hoistIndex = hashbangRE.exec(code)?.[0].length ?? 0;
|
52076
52254
|
function defineImport(index, source, metadata) {
|
52077
52255
|
deps.add(source);
|
52078
52256
|
const importId = `__vite_ssr_import_${uid++}__`;
|
@@ -63741,7 +63919,7 @@ function importAnalysisPlugin(config) {
|
|
63741
63919
|
if (isExplicitImportRequired(url)) {
|
63742
63920
|
url = injectQuery(url, "import");
|
63743
63921
|
} else if ((isRelative || isSelfImport) && !DEP_VERSION_RE.test(url)) {
|
63744
|
-
const versionMatch =
|
63922
|
+
const versionMatch = DEP_VERSION_RE.exec(importer);
|
63745
63923
|
if (versionMatch) {
|
63746
63924
|
url = injectQuery(url, versionMatch[1]);
|
63747
63925
|
}
|
@@ -64256,7 +64434,9 @@ function preload(baseModule, deps, importerUrl) {
|
|
64256
64434
|
);
|
64257
64435
|
}
|
64258
64436
|
return promise.then(() => baseModule()).catch((err) => {
|
64259
|
-
const e = new Event("vite:preloadError", {
|
64437
|
+
const e = new Event("vite:preloadError", {
|
64438
|
+
cancelable: true
|
64439
|
+
});
|
64260
64440
|
e.payload = err;
|
64261
64441
|
window.dispatchEvent(e);
|
64262
64442
|
if (!e.defaultPrevented) {
|
@@ -64334,7 +64514,7 @@ function buildImportAnalysisPlugin(config) {
|
|
64334
64514
|
continue;
|
64335
64515
|
}
|
64336
64516
|
if (match[3]) {
|
64337
|
-
let names2 =
|
64517
|
+
let names2 = /\.([^.?]+)/.exec(match[4])?.[1] || "";
|
64338
64518
|
if (names2 === "default") {
|
64339
64519
|
names2 = "default: __vite_default__";
|
64340
64520
|
}
|
@@ -64918,9 +65098,10 @@ async function build(inlineConfig = {}) {
|
|
64918
65098
|
"production"
|
64919
65099
|
);
|
64920
65100
|
const options = config.build;
|
65101
|
+
const { logger } = config;
|
64921
65102
|
const ssr = !!options.ssr;
|
64922
65103
|
const libOptions = options.lib;
|
64923
|
-
|
65104
|
+
logger.info(
|
64924
65105
|
colors$1.cyan(
|
64925
65106
|
`vite v${VERSION} ${colors$1.green(
|
64926
65107
|
`building ${ssr ? `SSR bundle ` : ``}for ${config.mode}...`
|
@@ -65000,14 +65181,14 @@ ${stackOnly}`;
|
|
65000
65181
|
const outputBuildError = (e) => {
|
65001
65182
|
enhanceRollupError(e);
|
65002
65183
|
clearLine();
|
65003
|
-
|
65184
|
+
logger.error(e.message, { error: e });
|
65004
65185
|
};
|
65005
65186
|
let bundle;
|
65006
65187
|
let startTime;
|
65007
65188
|
try {
|
65008
65189
|
const buildOutputOptions = (output = {}) => {
|
65009
65190
|
if (output.output) {
|
65010
|
-
|
65191
|
+
logger.warn(
|
65011
65192
|
`You've set "rollupOptions.output.output" in your config. This is deprecated and will override all Vite.js default output options. Please use "rollupOptions.output" instead.`
|
65012
65193
|
);
|
65013
65194
|
}
|
@@ -65017,7 +65198,7 @@ ${stackOnly}`;
|
|
65017
65198
|
);
|
65018
65199
|
}
|
65019
65200
|
if (output.sourcemap) {
|
65020
|
-
|
65201
|
+
logger.warnOnce(
|
65021
65202
|
colors$1.yellow(
|
65022
65203
|
`Vite does not support "rollupOptions.output.sourcemap". Please use "build.sourcemap" instead.`
|
65023
65204
|
)
|
@@ -65059,7 +65240,7 @@ ${stackOnly}`;
|
|
65059
65240
|
const outputs = resolveBuildOutputs(
|
65060
65241
|
options.rollupOptions?.output,
|
65061
65242
|
libOptions,
|
65062
|
-
|
65243
|
+
logger
|
65063
65244
|
);
|
65064
65245
|
const normalizedOutputs = [];
|
65065
65246
|
if (Array.isArray(outputs)) {
|
@@ -65078,10 +65259,10 @@ ${stackOnly}`;
|
|
65078
65259
|
options.emptyOutDir,
|
65079
65260
|
config.root,
|
65080
65261
|
resolvedOutDirs,
|
65081
|
-
|
65262
|
+
logger
|
65082
65263
|
);
|
65083
65264
|
if (config.build.watch) {
|
65084
|
-
|
65265
|
+
logger.info(colors$1.cyan(`
|
65085
65266
|
watching for file changes...`));
|
65086
65267
|
const resolvedChokidarOptions = resolveChokidarOptions(
|
65087
65268
|
config,
|
@@ -65100,14 +65281,14 @@ watching for file changes...`));
|
|
65100
65281
|
});
|
65101
65282
|
watcher.on("event", (event) => {
|
65102
65283
|
if (event.code === "BUNDLE_START") {
|
65103
|
-
|
65284
|
+
logger.info(colors$1.cyan(`
|
65104
65285
|
build started...`));
|
65105
65286
|
if (options.write) {
|
65106
65287
|
prepareOutDir(resolvedOutDirs, emptyOutDir, config);
|
65107
65288
|
}
|
65108
65289
|
} else if (event.code === "BUNDLE_END") {
|
65109
65290
|
event.result.close();
|
65110
|
-
|
65291
|
+
logger.info(colors$1.cyan(`built in ${event.duration}ms.`));
|
65111
65292
|
} else if (event.code === "ERROR") {
|
65112
65293
|
outputBuildError(event.error);
|
65113
65294
|
}
|
@@ -65124,7 +65305,7 @@ build started...`));
|
|
65124
65305
|
for (const output of normalizedOutputs) {
|
65125
65306
|
res.push(await bundle[options.write ? "write" : "generate"](output));
|
65126
65307
|
}
|
65127
|
-
|
65308
|
+
logger.info(
|
65128
65309
|
`${colors$1.green(`\u2713 built in ${displayTime(Date.now() - startTime)}`)}`
|
65129
65310
|
);
|
65130
65311
|
return Array.isArray(outputs) ? res : res[0];
|
@@ -65132,7 +65313,7 @@ build started...`));
|
|
65132
65313
|
enhanceRollupError(e);
|
65133
65314
|
clearLine();
|
65134
65315
|
if (startTime) {
|
65135
|
-
|
65316
|
+
logger.error(
|
65136
65317
|
`${colors$1.red("x")} Build failed in ${displayTime(Date.now() - startTime)}`
|
65137
65318
|
);
|
65138
65319
|
startTime = void 0;
|
@@ -66236,7 +66417,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
66236
66417
|
absWorkingDir: process.cwd(),
|
66237
66418
|
entryPoints: [fileName],
|
66238
66419
|
write: false,
|
66239
|
-
target: [
|
66420
|
+
target: [`node${process.versions.node}`],
|
66240
66421
|
platform: "node",
|
66241
66422
|
bundle: true,
|
66242
66423
|
format: isESM ? "esm" : "cjs",
|