vite 5.3.5 → 5.4.0-beta.1
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-Du4V_m3I.js} +1 -1
- package/dist/node/chunks/{dep-mCdpKltl.js → dep-gy9yrVx2.js} +481 -228
- package/dist/node/chunks/{dep-VqAwxVIc.js → dep-y7MNyJvV.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 +10 -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 = {
|
@@ -20322,7 +20428,7 @@ function fileToDevUrl(id, config) {
|
|
20322
20428
|
} else {
|
20323
20429
|
rtn = path$n.posix.join(FS_PREFIX, id);
|
20324
20430
|
}
|
20325
|
-
const base = joinUrlSegments(config.server?.origin ?? "", config.
|
20431
|
+
const base = joinUrlSegments(config.server?.origin ?? "", config.decodedBase);
|
20326
20432
|
return joinUrlSegments(base, removeLeadingSlash(rtn));
|
20327
20433
|
}
|
20328
20434
|
function getPublicAssetFilename(hash, config) {
|
@@ -20332,7 +20438,7 @@ const publicAssetUrlCache = /* @__PURE__ */ new WeakMap();
|
|
20332
20438
|
const publicAssetUrlRE = /__VITE_PUBLIC_ASSET__([a-z\d]{8})__/g;
|
20333
20439
|
function publicFileToBuiltUrl(url, config) {
|
20334
20440
|
if (config.command !== "build") {
|
20335
|
-
return joinUrlSegments(config.
|
20441
|
+
return joinUrlSegments(config.decodedBase, url);
|
20336
20442
|
}
|
20337
20443
|
const hash = getHash(url);
|
20338
20444
|
let cache = publicAssetUrlCache.get(config);
|
@@ -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-y7MNyJvV.js').then(function (n) { return n.i; }));
|
36992
|
+
const importPostcssModules = createCachedImport(() => import('./dep-Du4V_m3I.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;
|
@@ -37190,6 +37296,19 @@ ${e.message}`
|
|
37190
37296
|
}
|
37191
37297
|
}
|
37192
37298
|
}
|
37299
|
+
function loadSassPackage(root) {
|
37300
|
+
try {
|
37301
|
+
const path2 = loadPreprocessorPath("sass-embedded", root);
|
37302
|
+
return { name: "sass-embedded", path: path2 };
|
37303
|
+
} catch (e1) {
|
37304
|
+
try {
|
37305
|
+
const path2 = loadPreprocessorPath("sass" /* sass */, root);
|
37306
|
+
return { name: "sass", path: path2 };
|
37307
|
+
} catch (e2) {
|
37308
|
+
throw e1;
|
37309
|
+
}
|
37310
|
+
}
|
37311
|
+
}
|
37193
37312
|
let cachedSss;
|
37194
37313
|
function loadSss(root) {
|
37195
37314
|
if (cachedSss) return cachedSss;
|
@@ -37287,6 +37406,131 @@ const makeScssWorker = (resolvers, alias, maxWorkers) => {
|
|
37287
37406
|
);
|
37288
37407
|
return worker;
|
37289
37408
|
};
|
37409
|
+
const makeModernScssWorker = (resolvers, alias, maxWorkers) => {
|
37410
|
+
const internalCanonicalize = async (url, importer) => {
|
37411
|
+
importer = cleanScssBugUrl(importer);
|
37412
|
+
const resolved = await resolvers.sass(url, importer);
|
37413
|
+
return resolved ?? null;
|
37414
|
+
};
|
37415
|
+
const internalLoad = async (file, rootFile) => {
|
37416
|
+
const result = await rebaseUrls(file, rootFile, alias, "$", resolvers.sass);
|
37417
|
+
if (result.contents) {
|
37418
|
+
return result.contents;
|
37419
|
+
}
|
37420
|
+
return await fsp.readFile(result.file, "utf-8");
|
37421
|
+
};
|
37422
|
+
const worker = new WorkerWithFallback(
|
37423
|
+
() => async (sassPath, data, options) => {
|
37424
|
+
const sass = require(sassPath);
|
37425
|
+
const path2 = require("node:path");
|
37426
|
+
const { fileURLToPath: fileURLToPath2, pathToFileURL: pathToFileURL2 } = (
|
37427
|
+
// eslint-disable-next-line no-restricted-globals
|
37428
|
+
require("node:url")
|
37429
|
+
);
|
37430
|
+
const sassOptions = { ...options };
|
37431
|
+
sassOptions.url = pathToFileURL2(options.filename);
|
37432
|
+
sassOptions.sourceMap = options.enableSourcemap;
|
37433
|
+
const internalImporter = {
|
37434
|
+
async canonicalize(url, context) {
|
37435
|
+
const importer = context.containingUrl ? fileURLToPath2(context.containingUrl) : options.filename;
|
37436
|
+
const resolved = await internalCanonicalize(url, importer);
|
37437
|
+
return resolved ? pathToFileURL2(resolved) : null;
|
37438
|
+
},
|
37439
|
+
async load(canonicalUrl) {
|
37440
|
+
const ext = path2.extname(canonicalUrl.pathname);
|
37441
|
+
let syntax = "scss";
|
37442
|
+
if (ext === ".sass") {
|
37443
|
+
syntax = "indented";
|
37444
|
+
} else if (ext === ".css") {
|
37445
|
+
syntax = "css";
|
37446
|
+
}
|
37447
|
+
const contents = await internalLoad(
|
37448
|
+
fileURLToPath2(canonicalUrl),
|
37449
|
+
options.filename
|
37450
|
+
);
|
37451
|
+
return { contents, syntax };
|
37452
|
+
}
|
37453
|
+
};
|
37454
|
+
sassOptions.importers = [
|
37455
|
+
...sassOptions.importers ?? [],
|
37456
|
+
internalImporter
|
37457
|
+
];
|
37458
|
+
const result = await sass.compileStringAsync(data, sassOptions);
|
37459
|
+
return {
|
37460
|
+
css: result.css,
|
37461
|
+
map: result.sourceMap ? JSON.stringify(result.sourceMap) : void 0,
|
37462
|
+
stats: {
|
37463
|
+
includedFiles: result.loadedUrls.filter((url) => url.protocol === "file:").map((url) => fileURLToPath2(url))
|
37464
|
+
}
|
37465
|
+
};
|
37466
|
+
},
|
37467
|
+
{
|
37468
|
+
parentFunctions: {
|
37469
|
+
internalCanonicalize,
|
37470
|
+
internalLoad
|
37471
|
+
},
|
37472
|
+
shouldUseFake(_sassPath, _data, options) {
|
37473
|
+
return !!(options.functions && Object.keys(options.functions).length > 0 || options.importers && (!Array.isArray(options.importers) || options.importers.length > 0));
|
37474
|
+
},
|
37475
|
+
max: maxWorkers
|
37476
|
+
}
|
37477
|
+
);
|
37478
|
+
return worker;
|
37479
|
+
};
|
37480
|
+
const makeModernCompilerScssWorker = (resolvers, alias, _maxWorkers) => {
|
37481
|
+
let compiler;
|
37482
|
+
const worker = {
|
37483
|
+
async run(sassPath, data, options) {
|
37484
|
+
const sass = (await import(pathToFileURL(sassPath).href)).default;
|
37485
|
+
compiler ??= await sass.initAsyncCompiler();
|
37486
|
+
const sassOptions = { ...options };
|
37487
|
+
sassOptions.url = pathToFileURL(options.filename);
|
37488
|
+
sassOptions.sourceMap = options.enableSourcemap;
|
37489
|
+
const internalImporter = {
|
37490
|
+
async canonicalize(url, context) {
|
37491
|
+
const importer = context.containingUrl ? fileURLToPath(context.containingUrl) : options.filename;
|
37492
|
+
const resolved = await resolvers.sass(url, cleanScssBugUrl(importer));
|
37493
|
+
return resolved ? pathToFileURL(resolved) : null;
|
37494
|
+
},
|
37495
|
+
async load(canonicalUrl) {
|
37496
|
+
const ext = path$n.extname(canonicalUrl.pathname);
|
37497
|
+
let syntax = "scss";
|
37498
|
+
if (ext === ".sass") {
|
37499
|
+
syntax = "indented";
|
37500
|
+
} else if (ext === ".css") {
|
37501
|
+
syntax = "css";
|
37502
|
+
}
|
37503
|
+
const result2 = await rebaseUrls(
|
37504
|
+
fileURLToPath(canonicalUrl),
|
37505
|
+
options.filename,
|
37506
|
+
alias,
|
37507
|
+
"$",
|
37508
|
+
resolvers.sass
|
37509
|
+
);
|
37510
|
+
const contents = result2.contents ?? await fsp.readFile(result2.file, "utf-8");
|
37511
|
+
return { contents, syntax };
|
37512
|
+
}
|
37513
|
+
};
|
37514
|
+
sassOptions.importers = [
|
37515
|
+
...sassOptions.importers ?? [],
|
37516
|
+
internalImporter
|
37517
|
+
];
|
37518
|
+
const result = await compiler.compileStringAsync(data, sassOptions);
|
37519
|
+
return {
|
37520
|
+
css: result.css,
|
37521
|
+
map: result.sourceMap ? JSON.stringify(result.sourceMap) : void 0,
|
37522
|
+
stats: {
|
37523
|
+
includedFiles: result.loadedUrls.filter((url) => url.protocol === "file:").map((url) => fileURLToPath(url))
|
37524
|
+
}
|
37525
|
+
};
|
37526
|
+
},
|
37527
|
+
async stop() {
|
37528
|
+
compiler?.dispose();
|
37529
|
+
compiler = void 0;
|
37530
|
+
}
|
37531
|
+
};
|
37532
|
+
return worker;
|
37533
|
+
};
|
37290
37534
|
const scssProcessor = (maxWorkers) => {
|
37291
37535
|
const workerMap = /* @__PURE__ */ new Map();
|
37292
37536
|
return {
|
@@ -37296,11 +37540,12 @@ const scssProcessor = (maxWorkers) => {
|
|
37296
37540
|
}
|
37297
37541
|
},
|
37298
37542
|
async process(source, root, options, resolvers) {
|
37299
|
-
const
|
37543
|
+
const sassPackage = loadSassPackage(root);
|
37544
|
+
const api = options.api ?? "legacy";
|
37300
37545
|
if (!workerMap.has(options.alias)) {
|
37301
37546
|
workerMap.set(
|
37302
37547
|
options.alias,
|
37303
|
-
makeScssWorker(resolvers, options.alias, maxWorkers)
|
37548
|
+
api === "modern-compiler" ? makeModernCompilerScssWorker(resolvers, options.alias) : api === "modern" ? makeModernScssWorker(resolvers, options.alias, maxWorkers) : makeScssWorker(resolvers, options.alias, maxWorkers)
|
37304
37549
|
);
|
37305
37550
|
}
|
37306
37551
|
const worker = workerMap.get(options.alias);
|
@@ -37316,7 +37561,7 @@ const scssProcessor = (maxWorkers) => {
|
|
37316
37561
|
};
|
37317
37562
|
try {
|
37318
37563
|
const result = await worker.run(
|
37319
|
-
|
37564
|
+
sassPackage.path,
|
37320
37565
|
data,
|
37321
37566
|
optionsWithoutAdditionalData
|
37322
37567
|
);
|
@@ -37651,7 +37896,7 @@ const createPreprocessorWorkerController = (maxWorkers) => {
|
|
37651
37896
|
return scss.process(
|
37652
37897
|
source,
|
37653
37898
|
root,
|
37654
|
-
{ ...options, indentedSyntax: true },
|
37899
|
+
{ ...options, indentedSyntax: true, syntax: "indented" },
|
37655
37900
|
resolvers
|
37656
37901
|
);
|
37657
37902
|
};
|
@@ -37808,7 +38053,7 @@ const convertTargets = (esbuildTarget) => {
|
|
37808
38053
|
if (cached) return cached;
|
37809
38054
|
const targets = {};
|
37810
38055
|
const entriesWithoutES = arraify(esbuildTarget).flatMap((e) => {
|
37811
|
-
const match =
|
38056
|
+
const match = esRE.exec(e);
|
37812
38057
|
if (!match) return e;
|
37813
38058
|
const year = Number(match[1]);
|
37814
38059
|
if (!esMap[year]) throw new Error(`Unsupported target "${e}"`);
|
@@ -45354,7 +45599,7 @@ const cachedFsUtilsMap = /* @__PURE__ */ new WeakMap();
|
|
45354
45599
|
function getFsUtils(config) {
|
45355
45600
|
let fsUtils = cachedFsUtilsMap.get(config);
|
45356
45601
|
if (!fsUtils) {
|
45357
|
-
if (config.command !== "serve" || config.server.fs.cachedChecks
|
45602
|
+
if (config.command !== "serve" || config.server.fs.cachedChecks !== true || config.server.watch?.ignored || process.versions.pnp) {
|
45358
45603
|
fsUtils = commonFsUtils;
|
45359
45604
|
} else if (!config.resolve.preserveSymlinks && config.root !== getRealPath(config.root)) {
|
45360
45605
|
fsUtils = commonFsUtils;
|
@@ -46125,7 +46370,7 @@ function tryCleanFsResolve(file, options, tryIndex = true, targetWeb = true, ski
|
|
46125
46370
|
}
|
46126
46371
|
function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr = false, externalize, allowLinkedExternal = true) {
|
46127
46372
|
const { root, dedupe, isBuild, preserveSymlinks, packageCache } = options;
|
46128
|
-
const deepMatch =
|
46373
|
+
const deepMatch = deepImportRE.exec(id);
|
46129
46374
|
const pkgId = deepMatch ? deepMatch[1] || deepMatch[2] : cleanUrl(id);
|
46130
46375
|
let basedir;
|
46131
46376
|
if (dedupe?.includes(pkgId)) {
|
@@ -46928,7 +47173,7 @@ function optimizedDepsPlugin(config) {
|
|
46928
47173
|
if (depsOptimizer?.isOptimizedDepFile(id)) {
|
46929
47174
|
const metadata = depsOptimizer.metadata;
|
46930
47175
|
const file = cleanUrl(id);
|
46931
|
-
const versionMatch =
|
47176
|
+
const versionMatch = DEP_VERSION_RE.exec(file);
|
46932
47177
|
const browserHash = versionMatch ? versionMatch[1].split("=")[1] : void 0;
|
46933
47178
|
const info = optimizedDepInfoFromFile(metadata, file);
|
46934
47179
|
if (info) {
|
@@ -46986,6 +47231,9 @@ function throwFileNotFoundInOptimizedDep(id) {
|
|
46986
47231
|
|
46987
47232
|
const nonJsRe = /\.json(?:$|\?)/;
|
46988
47233
|
const isNonJsRequest = (request) => nonJsRe.test(request);
|
47234
|
+
const importMetaEnvMarker = "__vite_import_meta_env__";
|
47235
|
+
const bareImportMetaEnvRe = new RegExp(`${importMetaEnvMarker}(?!\\.)\\b`);
|
47236
|
+
const importMetaEnvKeyRe = new RegExp(`${importMetaEnvMarker}\\..+?\\b`, "g");
|
46989
47237
|
function definePlugin(config) {
|
46990
47238
|
const isBuild = config.command === "build";
|
46991
47239
|
const isBuildLib = isBuild && config.build.lib;
|
@@ -47034,12 +47282,15 @@ function definePlugin(config) {
|
|
47034
47282
|
define["import.meta.env.SSR"] = ssr + "";
|
47035
47283
|
}
|
47036
47284
|
if ("import.meta.env" in define) {
|
47037
|
-
define["import.meta.env"] =
|
47038
|
-
...importMetaEnvKeys,
|
47039
|
-
SSR: ssr + "",
|
47040
|
-
...userDefineEnv
|
47041
|
-
});
|
47285
|
+
define["import.meta.env"] = importMetaEnvMarker;
|
47042
47286
|
}
|
47287
|
+
const importMetaEnvVal = serializeDefine({
|
47288
|
+
...importMetaEnvKeys,
|
47289
|
+
SSR: ssr + "",
|
47290
|
+
...userDefineEnv
|
47291
|
+
});
|
47292
|
+
const banner = `const ${importMetaEnvMarker} = ${importMetaEnvVal};
|
47293
|
+
`;
|
47043
47294
|
const patternKeys = Object.keys(userDefine);
|
47044
47295
|
if (replaceProcessEnv && Object.keys(processEnv).length) {
|
47045
47296
|
patternKeys.push("process.env");
|
@@ -47048,7 +47299,7 @@ function definePlugin(config) {
|
|
47048
47299
|
patternKeys.push("import.meta.env", "import.meta.hot");
|
47049
47300
|
}
|
47050
47301
|
const pattern = patternKeys.length ? new RegExp(patternKeys.map(escapeRegex).join("|")) : null;
|
47051
|
-
return [define, pattern];
|
47302
|
+
return [define, pattern, banner];
|
47052
47303
|
}
|
47053
47304
|
const defaultPattern = generatePattern(false);
|
47054
47305
|
const ssrPattern = generatePattern(true);
|
@@ -47065,22 +47316,28 @@ function definePlugin(config) {
|
|
47065
47316
|
) {
|
47066
47317
|
return;
|
47067
47318
|
}
|
47068
|
-
const [define, pattern] = ssr ? ssrPattern : defaultPattern;
|
47319
|
+
const [define, pattern, banner] = ssr ? ssrPattern : defaultPattern;
|
47069
47320
|
if (!pattern) return;
|
47070
47321
|
pattern.lastIndex = 0;
|
47071
47322
|
if (!pattern.test(code)) return;
|
47072
|
-
|
47323
|
+
const result = await replaceDefine(code, id, define, config);
|
47324
|
+
result.code = result.code.replaceAll(
|
47325
|
+
importMetaEnvKeyRe,
|
47326
|
+
(m) => "undefined".padEnd(m.length)
|
47327
|
+
);
|
47328
|
+
if (bareImportMetaEnvRe.test(result.code)) {
|
47329
|
+
result.code = banner + result.code;
|
47330
|
+
if (result.map) {
|
47331
|
+
const map = JSON.parse(result.map);
|
47332
|
+
map.mappings = ";" + map.mappings;
|
47333
|
+
result.map = map;
|
47334
|
+
}
|
47335
|
+
}
|
47336
|
+
return result;
|
47073
47337
|
}
|
47074
47338
|
};
|
47075
47339
|
}
|
47076
47340
|
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
47341
|
const esbuildOptions = config.esbuild || {};
|
47085
47342
|
const result = await transform$1(code, {
|
47086
47343
|
loader: "js",
|
@@ -47106,9 +47363,6 @@ async function replaceDefine(code, id, define, config) {
|
|
47106
47363
|
result.map = JSON.stringify(encodedMap(new TraceMap(decoded)));
|
47107
47364
|
}
|
47108
47365
|
}
|
47109
|
-
for (const marker in replacementMarkers) {
|
47110
|
-
result.code = result.code.replaceAll(marker, replacementMarkers[marker]);
|
47111
|
-
}
|
47112
47366
|
return {
|
47113
47367
|
code: result.code,
|
47114
47368
|
map: result.map || null
|
@@ -47132,14 +47386,6 @@ function handleDefineValue(value) {
|
|
47132
47386
|
if (typeof value === "string") return value;
|
47133
47387
|
return JSON.stringify(value);
|
47134
47388
|
}
|
47135
|
-
function canJsonParse(value) {
|
47136
|
-
try {
|
47137
|
-
JSON.parse(value);
|
47138
|
-
return true;
|
47139
|
-
} catch {
|
47140
|
-
return false;
|
47141
|
-
}
|
47142
|
-
}
|
47143
47389
|
|
47144
47390
|
const normalizedClientEntry = normalizePath$3(CLIENT_ENTRY);
|
47145
47391
|
const normalizedEnvEntry = normalizePath$3(ENV_ENTRY);
|
@@ -48467,7 +48713,7 @@ function buildErrorMessage(err, args = [], includeStack = true) {
|
|
48467
48713
|
return args.join("\n");
|
48468
48714
|
}
|
48469
48715
|
function cleanStack(stack) {
|
48470
|
-
return stack.split(/\n/
|
48716
|
+
return stack.split(/\n/).filter((l) => /^\s*at/.test(l)).join("\n");
|
48471
48717
|
}
|
48472
48718
|
function logError(server, err) {
|
48473
48719
|
const msg = buildErrorMessage(err, [
|
@@ -49391,9 +49637,9 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
|
|
49391
49637
|
let scriptId = 0;
|
49392
49638
|
const matches = raw.matchAll(scriptRE);
|
49393
49639
|
for (const [, openTag, content] of matches) {
|
49394
|
-
const typeMatch =
|
49640
|
+
const typeMatch = typeRE.exec(openTag);
|
49395
49641
|
const type = typeMatch && (typeMatch[1] || typeMatch[2] || typeMatch[3]);
|
49396
|
-
const langMatch =
|
49642
|
+
const langMatch = langRE.exec(openTag);
|
49397
49643
|
const lang = langMatch && (langMatch[1] || langMatch[2] || langMatch[3]);
|
49398
49644
|
if (isHtml && type !== "module") {
|
49399
49645
|
continue;
|
@@ -49407,7 +49653,7 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
|
|
49407
49653
|
} else if (p.endsWith(".astro")) {
|
49408
49654
|
loader = "ts";
|
49409
49655
|
}
|
49410
|
-
const srcMatch =
|
49656
|
+
const srcMatch = srcRE.exec(openTag);
|
49411
49657
|
if (srcMatch) {
|
49412
49658
|
const src = srcMatch[1] || srcMatch[2] || srcMatch[3];
|
49413
49659
|
js += `import ${JSON.stringify(src)}
|
@@ -49436,7 +49682,7 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
|
|
49436
49682
|
};
|
49437
49683
|
}
|
49438
49684
|
const virtualModulePath = JSON.stringify(virtualModulePrefix + key);
|
49439
|
-
const contextMatch =
|
49685
|
+
const contextMatch = contextRE.exec(openTag);
|
49440
49686
|
const context = contextMatch && (contextMatch[1] || contextMatch[2] || contextMatch[3]);
|
49441
49687
|
if (p.endsWith(".svelte") && context !== "module") {
|
49442
49688
|
js += `import ${virtualModulePath}
|
@@ -49658,7 +49904,7 @@ function expandGlobIds(id, config) {
|
|
49658
49904
|
if (exportsValue.startsWith("./") && !filePath.startsWith("./")) {
|
49659
49905
|
filePath = "./" + filePath;
|
49660
49906
|
}
|
49661
|
-
const matched2 = slash$1(filePath)
|
49907
|
+
const matched2 = exportsValueGlobRe.exec(slash$1(filePath));
|
49662
49908
|
if (matched2) {
|
49663
49909
|
let allGlobSame = matched2.length === 2;
|
49664
49910
|
if (!allGlobSame) {
|
@@ -49769,7 +50015,7 @@ async function createDepsOptimizer(config, server) {
|
|
49769
50015
|
let newDepsToLogHandle;
|
49770
50016
|
const logNewlyDiscoveredDeps = () => {
|
49771
50017
|
if (newDepsToLog.length) {
|
49772
|
-
|
50018
|
+
logger.info(
|
49773
50019
|
colors$1.green(
|
49774
50020
|
`\u2728 new dependencies optimized: ${depsLogString(newDepsToLog)}`
|
49775
50021
|
),
|
@@ -49783,7 +50029,7 @@ async function createDepsOptimizer(config, server) {
|
|
49783
50029
|
let discoveredDepsWhileScanning = [];
|
49784
50030
|
const logDiscoveredDepsWhileScanning = () => {
|
49785
50031
|
if (discoveredDepsWhileScanning.length) {
|
49786
|
-
|
50032
|
+
logger.info(
|
49787
50033
|
colors$1.green(
|
49788
50034
|
`\u2728 discovered while scanning: ${depsLogString(
|
49789
50035
|
discoveredDepsWhileScanning
|
@@ -49977,7 +50223,7 @@ async function createDepsOptimizer(config, server) {
|
|
49977
50223
|
logNewlyDiscoveredDeps();
|
49978
50224
|
if (warnAboutMissedDependencies) {
|
49979
50225
|
logDiscoveredDepsWhileScanning();
|
49980
|
-
|
50226
|
+
logger.info(
|
49981
50227
|
colors$1.magenta(
|
49982
50228
|
`\u2757 add these dependencies to optimizeDeps.include to speed up cold start`
|
49983
50229
|
),
|
@@ -50009,7 +50255,7 @@ async function createDepsOptimizer(config, server) {
|
|
50009
50255
|
logNewlyDiscoveredDeps();
|
50010
50256
|
if (warnAboutMissedDependencies) {
|
50011
50257
|
logDiscoveredDepsWhileScanning();
|
50012
|
-
|
50258
|
+
logger.info(
|
50013
50259
|
colors$1.magenta(
|
50014
50260
|
`\u2757 add these dependencies to optimizeDeps.include to avoid a full page reload during cold start`
|
50015
50261
|
),
|
@@ -50025,7 +50271,7 @@ async function createDepsOptimizer(config, server) {
|
|
50025
50271
|
}
|
50026
50272
|
);
|
50027
50273
|
if (needsInteropMismatch.length > 0) {
|
50028
|
-
|
50274
|
+
logger.warn(
|
50029
50275
|
`Mixed ESM and CJS detected in ${colors$1.yellow(
|
50030
50276
|
needsInteropMismatch.join(", ")
|
50031
50277
|
)}, add ${needsInteropMismatch.length === 1 ? "it" : "them"} to optimizeDeps.needsInterop to speed up cold start`,
|
@@ -52072,7 +52318,7 @@ Contents of line ${line}: ${code.split("\n")[line - 1]}`
|
|
52072
52318
|
const dynamicDeps = /* @__PURE__ */ new Set();
|
52073
52319
|
const idToImportMap = /* @__PURE__ */ new Map();
|
52074
52320
|
const declaredConst = /* @__PURE__ */ new Set();
|
52075
|
-
const hoistIndex =
|
52321
|
+
const hoistIndex = hashbangRE.exec(code)?.[0].length ?? 0;
|
52076
52322
|
function defineImport(index, source, metadata) {
|
52077
52323
|
deps.add(source);
|
52078
52324
|
const importId = `__vite_ssr_import_${uid++}__`;
|
@@ -61712,7 +61958,12 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
|
|
61712
61958
|
);
|
61713
61959
|
}
|
61714
61960
|
if (preTransformUrl) {
|
61715
|
-
|
61961
|
+
try {
|
61962
|
+
preTransformUrl = decodeURI(preTransformUrl);
|
61963
|
+
} catch (err) {
|
61964
|
+
return url2;
|
61965
|
+
}
|
61966
|
+
preTransformRequest(server, preTransformUrl, config.decodedBase);
|
61716
61967
|
}
|
61717
61968
|
}
|
61718
61969
|
return url2;
|
@@ -61723,6 +61974,7 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
|
|
61723
61974
|
const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl }) => {
|
61724
61975
|
const { config, moduleGraph, watcher } = server;
|
61725
61976
|
const base = config.base || "/";
|
61977
|
+
const decodedBase = config.decodedBase || "/";
|
61726
61978
|
let proxyModulePath;
|
61727
61979
|
let proxyModuleUrl;
|
61728
61980
|
const trailingSlash = htmlPath.endsWith("/");
|
@@ -61734,7 +61986,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
|
|
61734
61986
|
proxyModulePath = `\0${validPath}`;
|
61735
61987
|
proxyModuleUrl = wrapId$1(proxyModulePath);
|
61736
61988
|
}
|
61737
|
-
proxyModuleUrl = joinUrlSegments(
|
61989
|
+
proxyModuleUrl = joinUrlSegments(decodedBase, proxyModuleUrl);
|
61738
61990
|
const s = new MagicString(html);
|
61739
61991
|
let inlineModuleIndex = -1;
|
61740
61992
|
const proxyCacheUrl = decodeURI(
|
@@ -61766,7 +62018,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
|
|
61766
62018
|
node.sourceCodeLocation.endOffset,
|
61767
62019
|
`<script type="module" src="${modulePath}"><\/script>`
|
61768
62020
|
);
|
61769
|
-
preTransformRequest(server, modulePath,
|
62021
|
+
preTransformRequest(server, modulePath, decodedBase);
|
61770
62022
|
};
|
61771
62023
|
await traverseHtml(html, filename, (node) => {
|
61772
62024
|
if (!nodeIsElement(node)) {
|
@@ -61928,14 +62180,10 @@ function indexHtmlMiddleware(root, server) {
|
|
61928
62180
|
next();
|
61929
62181
|
};
|
61930
62182
|
}
|
61931
|
-
function preTransformRequest(server,
|
62183
|
+
function preTransformRequest(server, decodedUrl, decodedBase) {
|
61932
62184
|
if (!server.config.server.preTransformRequests) return;
|
61933
|
-
|
61934
|
-
|
61935
|
-
} catch {
|
61936
|
-
return;
|
61937
|
-
}
|
61938
|
-
server.warmupRequest(url);
|
62185
|
+
decodedUrl = unwrapId$1(stripBase(decodedUrl, decodedBase));
|
62186
|
+
server.warmupRequest(decodedUrl);
|
61939
62187
|
}
|
61940
62188
|
|
61941
62189
|
const logTime = createDebugger("vite:time");
|
@@ -63741,7 +63989,7 @@ function importAnalysisPlugin(config) {
|
|
63741
63989
|
if (isExplicitImportRequired(url)) {
|
63742
63990
|
url = injectQuery(url, "import");
|
63743
63991
|
} else if ((isRelative || isSelfImport) && !DEP_VERSION_RE.test(url)) {
|
63744
|
-
const versionMatch =
|
63992
|
+
const versionMatch = DEP_VERSION_RE.exec(importer);
|
63745
63993
|
if (versionMatch) {
|
63746
63994
|
url = injectQuery(url, versionMatch[1]);
|
63747
63995
|
}
|
@@ -64256,7 +64504,9 @@ function preload(baseModule, deps, importerUrl) {
|
|
64256
64504
|
);
|
64257
64505
|
}
|
64258
64506
|
return promise.then(() => baseModule()).catch((err) => {
|
64259
|
-
const e = new Event("vite:preloadError", {
|
64507
|
+
const e = new Event("vite:preloadError", {
|
64508
|
+
cancelable: true
|
64509
|
+
});
|
64260
64510
|
e.payload = err;
|
64261
64511
|
window.dispatchEvent(e);
|
64262
64512
|
if (!e.defaultPrevented) {
|
@@ -64334,7 +64584,7 @@ function buildImportAnalysisPlugin(config) {
|
|
64334
64584
|
continue;
|
64335
64585
|
}
|
64336
64586
|
if (match[3]) {
|
64337
|
-
let names2 =
|
64587
|
+
let names2 = /\.([^.?]+)/.exec(match[4])?.[1] || "";
|
64338
64588
|
if (names2 === "default") {
|
64339
64589
|
names2 = "default: __vite_default__";
|
64340
64590
|
}
|
@@ -64918,9 +65168,10 @@ async function build(inlineConfig = {}) {
|
|
64918
65168
|
"production"
|
64919
65169
|
);
|
64920
65170
|
const options = config.build;
|
65171
|
+
const { logger } = config;
|
64921
65172
|
const ssr = !!options.ssr;
|
64922
65173
|
const libOptions = options.lib;
|
64923
|
-
|
65174
|
+
logger.info(
|
64924
65175
|
colors$1.cyan(
|
64925
65176
|
`vite v${VERSION} ${colors$1.green(
|
64926
65177
|
`building ${ssr ? `SSR bundle ` : ``}for ${config.mode}...`
|
@@ -65000,14 +65251,14 @@ ${stackOnly}`;
|
|
65000
65251
|
const outputBuildError = (e) => {
|
65001
65252
|
enhanceRollupError(e);
|
65002
65253
|
clearLine();
|
65003
|
-
|
65254
|
+
logger.error(e.message, { error: e });
|
65004
65255
|
};
|
65005
65256
|
let bundle;
|
65006
65257
|
let startTime;
|
65007
65258
|
try {
|
65008
65259
|
const buildOutputOptions = (output = {}) => {
|
65009
65260
|
if (output.output) {
|
65010
|
-
|
65261
|
+
logger.warn(
|
65011
65262
|
`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
65263
|
);
|
65013
65264
|
}
|
@@ -65017,7 +65268,7 @@ ${stackOnly}`;
|
|
65017
65268
|
);
|
65018
65269
|
}
|
65019
65270
|
if (output.sourcemap) {
|
65020
|
-
|
65271
|
+
logger.warnOnce(
|
65021
65272
|
colors$1.yellow(
|
65022
65273
|
`Vite does not support "rollupOptions.output.sourcemap". Please use "build.sourcemap" instead.`
|
65023
65274
|
)
|
@@ -65059,7 +65310,7 @@ ${stackOnly}`;
|
|
65059
65310
|
const outputs = resolveBuildOutputs(
|
65060
65311
|
options.rollupOptions?.output,
|
65061
65312
|
libOptions,
|
65062
|
-
|
65313
|
+
logger
|
65063
65314
|
);
|
65064
65315
|
const normalizedOutputs = [];
|
65065
65316
|
if (Array.isArray(outputs)) {
|
@@ -65078,10 +65329,10 @@ ${stackOnly}`;
|
|
65078
65329
|
options.emptyOutDir,
|
65079
65330
|
config.root,
|
65080
65331
|
resolvedOutDirs,
|
65081
|
-
|
65332
|
+
logger
|
65082
65333
|
);
|
65083
65334
|
if (config.build.watch) {
|
65084
|
-
|
65335
|
+
logger.info(colors$1.cyan(`
|
65085
65336
|
watching for file changes...`));
|
65086
65337
|
const resolvedChokidarOptions = resolveChokidarOptions(
|
65087
65338
|
config,
|
@@ -65100,14 +65351,14 @@ watching for file changes...`));
|
|
65100
65351
|
});
|
65101
65352
|
watcher.on("event", (event) => {
|
65102
65353
|
if (event.code === "BUNDLE_START") {
|
65103
|
-
|
65354
|
+
logger.info(colors$1.cyan(`
|
65104
65355
|
build started...`));
|
65105
65356
|
if (options.write) {
|
65106
65357
|
prepareOutDir(resolvedOutDirs, emptyOutDir, config);
|
65107
65358
|
}
|
65108
65359
|
} else if (event.code === "BUNDLE_END") {
|
65109
65360
|
event.result.close();
|
65110
|
-
|
65361
|
+
logger.info(colors$1.cyan(`built in ${event.duration}ms.`));
|
65111
65362
|
} else if (event.code === "ERROR") {
|
65112
65363
|
outputBuildError(event.error);
|
65113
65364
|
}
|
@@ -65124,7 +65375,7 @@ build started...`));
|
|
65124
65375
|
for (const output of normalizedOutputs) {
|
65125
65376
|
res.push(await bundle[options.write ? "write" : "generate"](output));
|
65126
65377
|
}
|
65127
|
-
|
65378
|
+
logger.info(
|
65128
65379
|
`${colors$1.green(`\u2713 built in ${displayTime(Date.now() - startTime)}`)}`
|
65129
65380
|
);
|
65130
65381
|
return Array.isArray(outputs) ? res : res[0];
|
@@ -65132,7 +65383,7 @@ build started...`));
|
|
65132
65383
|
enhanceRollupError(e);
|
65133
65384
|
clearLine();
|
65134
65385
|
if (startTime) {
|
65135
|
-
|
65386
|
+
logger.error(
|
65136
65387
|
`${colors$1.red("x")} Build failed in ${displayTime(Date.now() - startTime)}`
|
65137
65388
|
);
|
65138
65389
|
startTime = void 0;
|
@@ -65435,7 +65686,7 @@ function toOutputFilePathInJS(filename, type, hostId, hostType, config, toRelati
|
|
65435
65686
|
if (relative && !config.build.ssr) {
|
65436
65687
|
return toRelative(filename, hostId);
|
65437
65688
|
}
|
65438
|
-
return joinUrlSegments(config.
|
65689
|
+
return joinUrlSegments(config.decodedBase, filename);
|
65439
65690
|
}
|
65440
65691
|
function createToImportMetaURLBasedRelativeRuntime(format, isWorker) {
|
65441
65692
|
const formatLong = isWorker && format === "iife" ? "worker-iife" : format;
|
@@ -65472,7 +65723,7 @@ function toOutputFilePathWithoutRuntime(filename, type, hostId, hostType, config
|
|
65472
65723
|
if (relative && !config.build.ssr) {
|
65473
65724
|
return toRelative(filename, hostId);
|
65474
65725
|
} else {
|
65475
|
-
return joinUrlSegments(config.
|
65726
|
+
return joinUrlSegments(config.decodedBase, filename);
|
65476
65727
|
}
|
65477
65728
|
}
|
65478
65729
|
const toOutputFilePathInCss = toOutputFilePathWithoutRuntime;
|
@@ -66004,6 +66255,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
66004
66255
|
plugins: createWorkerPlugins,
|
66005
66256
|
rollupOptions: config.worker?.rollupOptions || {}
|
66006
66257
|
};
|
66258
|
+
const base = withTrailingSlash(resolvedBase);
|
66007
66259
|
resolved = {
|
66008
66260
|
configFile: configFile ? normalizePath$3(configFile) : void 0,
|
66009
66261
|
configFileDependencies: configFileDependencies.map(
|
@@ -66011,7 +66263,8 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
66011
66263
|
),
|
66012
66264
|
inlineConfig,
|
66013
66265
|
root: resolvedRoot,
|
66014
|
-
base
|
66266
|
+
base,
|
66267
|
+
decodedBase: decodeURI(base),
|
66015
66268
|
rawBase: resolvedBase,
|
66016
66269
|
resolve: resolveOptions,
|
66017
66270
|
publicDir: resolvedPublicDir,
|
@@ -66236,7 +66489,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
66236
66489
|
absWorkingDir: process.cwd(),
|
66237
66490
|
entryPoints: [fileName],
|
66238
66491
|
write: false,
|
66239
|
-
target: [
|
66492
|
+
target: [`node${process.versions.node}`],
|
66240
66493
|
platform: "node",
|
66241
66494
|
bundle: true,
|
66242
66495
|
format: isESM ? "esm" : "cjs",
|