vite 2.8.0-beta.6 → 2.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of vite might be problematic. Click here for more details.
- package/LICENSE.md +56 -0
- package/dist/node/chunks/{dep-4b0cbf9b.js → dep-15d13ae7.js} +1 -1
- package/dist/node/chunks/{dep-3f888c22.js → dep-333341a0.js} +21 -16
- package/dist/node/chunks/{dep-b8b00184.js → dep-3d5f2596.js} +566 -509
- package/dist/node/chunks/{dep-59826f35.js → dep-50851e02.js} +1 -1
- package/dist/node/chunks/{dep-0ebab0df.js → dep-ec2e68f4.js} +0 -0
- package/dist/node/cli.js +8 -7
- package/dist/node/index.d.ts +5 -5
- package/dist/node/index.js +1 -1
- package/package.json +10 -11
- package/types/importMeta.d.ts +4 -14
- package/CHANGELOG.md +0 -2775
|
@@ -1222,126 +1222,166 @@ const KNOWN_ASSET_TYPES = [
|
|
|
1222
1222
|
const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
|
|
1223
1223
|
const DEP_VERSION_RE = /[\?&](v=[\w\.-]+)\b/;
|
|
1224
1224
|
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1225
|
+
const comma = 44;
|
|
1226
|
+
const semicolon = 59;
|
|
1227
|
+
const chars$2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
1228
|
+
const intToChar = new Uint8Array(65); // 65 possible chars.
|
|
1229
|
+
const charToInteger$1 = new Uint8Array(123); // z is 122 in ASCII
|
|
1230
|
+
for (let i = 0; i < chars$2.length; i++) {
|
|
1231
|
+
const c = chars$2.charCodeAt(i);
|
|
1232
|
+
charToInteger$1[c] = i;
|
|
1233
|
+
intToChar[i] = c;
|
|
1234
|
+
}
|
|
1235
|
+
// Provide a fallback for older environments.
|
|
1236
|
+
const td = typeof TextDecoder !== 'undefined'
|
|
1237
|
+
? new TextDecoder()
|
|
1238
|
+
: typeof Buffer !== 'undefined'
|
|
1239
|
+
? {
|
|
1240
|
+
decode(buf) {
|
|
1241
|
+
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
1242
|
+
return out.toString();
|
|
1243
|
+
},
|
|
1244
|
+
}
|
|
1245
|
+
: {
|
|
1246
|
+
decode(buf) {
|
|
1247
|
+
let out = '';
|
|
1248
|
+
for (let i = 0; i < buf.length; i++) {
|
|
1249
|
+
out += String.fromCharCode(buf[i]);
|
|
1250
|
+
}
|
|
1251
|
+
return out;
|
|
1252
|
+
},
|
|
1253
|
+
};
|
|
1230
1254
|
function decode(mappings) {
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
}
|
|
1247
|
-
else if (c === 59) { // ";"
|
|
1248
|
-
segmentify(line, segment, j);
|
|
1249
|
-
j = 0;
|
|
1255
|
+
const state = new Int32Array(5);
|
|
1256
|
+
const decoded = [];
|
|
1257
|
+
let line = [];
|
|
1258
|
+
let sorted = true;
|
|
1259
|
+
let lastCol = 0;
|
|
1260
|
+
for (let i = 0; i < mappings.length;) {
|
|
1261
|
+
const c = mappings.charCodeAt(i);
|
|
1262
|
+
if (c === comma) {
|
|
1263
|
+
i++;
|
|
1264
|
+
}
|
|
1265
|
+
else if (c === semicolon) {
|
|
1266
|
+
state[0] = lastCol = 0;
|
|
1267
|
+
if (!sorted)
|
|
1268
|
+
sort(line);
|
|
1269
|
+
sorted = true;
|
|
1250
1270
|
decoded.push(line);
|
|
1251
1271
|
line = [];
|
|
1252
|
-
|
|
1272
|
+
i++;
|
|
1253
1273
|
}
|
|
1254
1274
|
else {
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
shift += 5;
|
|
1275
|
+
i = decodeInteger(mappings, i, state, 0); // generatedCodeColumn
|
|
1276
|
+
const col = state[0];
|
|
1277
|
+
if (col < lastCol)
|
|
1278
|
+
sorted = false;
|
|
1279
|
+
lastCol = col;
|
|
1280
|
+
if (!hasMoreSegments(mappings, i)) {
|
|
1281
|
+
line.push([col]);
|
|
1282
|
+
continue;
|
|
1264
1283
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
segment[j] += value;
|
|
1272
|
-
j++;
|
|
1273
|
-
value = shift = 0; // reset
|
|
1284
|
+
i = decodeInteger(mappings, i, state, 1); // sourceFileIndex
|
|
1285
|
+
i = decodeInteger(mappings, i, state, 2); // sourceCodeLine
|
|
1286
|
+
i = decodeInteger(mappings, i, state, 3); // sourceCodeColumn
|
|
1287
|
+
if (!hasMoreSegments(mappings, i)) {
|
|
1288
|
+
line.push([col, state[1], state[2], state[3]]);
|
|
1289
|
+
continue;
|
|
1274
1290
|
}
|
|
1291
|
+
i = decodeInteger(mappings, i, state, 4); // nameIndex
|
|
1292
|
+
line.push([col, state[1], state[2], state[3], state[4]]);
|
|
1275
1293
|
}
|
|
1276
1294
|
}
|
|
1277
|
-
|
|
1295
|
+
if (!sorted)
|
|
1296
|
+
sort(line);
|
|
1278
1297
|
decoded.push(line);
|
|
1279
1298
|
return decoded;
|
|
1280
1299
|
}
|
|
1281
|
-
function
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1300
|
+
function decodeInteger(mappings, pos, state, j) {
|
|
1301
|
+
let value = 0;
|
|
1302
|
+
let shift = 0;
|
|
1303
|
+
let integer = 0;
|
|
1304
|
+
do {
|
|
1305
|
+
const c = mappings.charCodeAt(pos++);
|
|
1306
|
+
integer = charToInteger$1[c];
|
|
1307
|
+
value |= (integer & 31) << shift;
|
|
1308
|
+
shift += 5;
|
|
1309
|
+
} while (integer & 32);
|
|
1310
|
+
const shouldNegate = value & 1;
|
|
1311
|
+
value >>>= 1;
|
|
1312
|
+
if (shouldNegate) {
|
|
1313
|
+
value = value === 0 ? -0x80000000 : -value;
|
|
1314
|
+
}
|
|
1315
|
+
state[j] += value;
|
|
1316
|
+
return pos;
|
|
1317
|
+
}
|
|
1318
|
+
function hasMoreSegments(mappings, i) {
|
|
1319
|
+
if (i >= mappings.length)
|
|
1320
|
+
return false;
|
|
1321
|
+
const c = mappings.charCodeAt(i);
|
|
1322
|
+
if (c === comma || c === semicolon)
|
|
1323
|
+
return false;
|
|
1324
|
+
return true;
|
|
1295
1325
|
}
|
|
1296
|
-
function
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1326
|
+
function sort(line) {
|
|
1327
|
+
line.sort(sortComparator$1);
|
|
1328
|
+
}
|
|
1329
|
+
function sortComparator$1(a, b) {
|
|
1330
|
+
return a[0] - b[0];
|
|
1331
|
+
}
|
|
1332
|
+
function encode$1(decoded) {
|
|
1333
|
+
const state = new Int32Array(5);
|
|
1334
|
+
let buf = new Uint8Array(1000);
|
|
1335
|
+
let pos = 0;
|
|
1336
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
1337
|
+
const line = decoded[i];
|
|
1338
|
+
if (i > 0) {
|
|
1339
|
+
buf = reserve(buf, pos, 1);
|
|
1340
|
+
buf[pos++] = semicolon;
|
|
1341
|
+
}
|
|
1306
1342
|
if (line.length === 0)
|
|
1307
1343
|
continue;
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
if (
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
nameIndex = segment[4];
|
|
1326
|
-
}
|
|
1327
|
-
lineMappings.push(segmentMappings);
|
|
1344
|
+
state[0] = 0;
|
|
1345
|
+
for (let j = 0; j < line.length; j++) {
|
|
1346
|
+
const segment = line[j];
|
|
1347
|
+
// We can push up to 5 ints, each int can take at most 7 chars, and we
|
|
1348
|
+
// may push a comma.
|
|
1349
|
+
buf = reserve(buf, pos, 36);
|
|
1350
|
+
if (j > 0)
|
|
1351
|
+
buf[pos++] = comma;
|
|
1352
|
+
pos = encodeInteger$1(buf, pos, state, segment, 0); // generatedCodeColumn
|
|
1353
|
+
if (segment.length === 1)
|
|
1354
|
+
continue;
|
|
1355
|
+
pos = encodeInteger$1(buf, pos, state, segment, 1); // sourceFileIndex
|
|
1356
|
+
pos = encodeInteger$1(buf, pos, state, segment, 2); // sourceCodeLine
|
|
1357
|
+
pos = encodeInteger$1(buf, pos, state, segment, 3); // sourceCodeColumn
|
|
1358
|
+
if (segment.length === 4)
|
|
1359
|
+
continue;
|
|
1360
|
+
pos = encodeInteger$1(buf, pos, state, segment, 4); // nameIndex
|
|
1328
1361
|
}
|
|
1329
|
-
mappings += lineMappings.join(',');
|
|
1330
1362
|
}
|
|
1331
|
-
return
|
|
1363
|
+
return td.decode(buf.subarray(0, pos));
|
|
1332
1364
|
}
|
|
1333
|
-
function
|
|
1334
|
-
|
|
1365
|
+
function reserve(buf, pos, count) {
|
|
1366
|
+
if (buf.length > pos + count)
|
|
1367
|
+
return buf;
|
|
1368
|
+
const swap = new Uint8Array(buf.length * 2);
|
|
1369
|
+
swap.set(buf);
|
|
1370
|
+
return swap;
|
|
1371
|
+
}
|
|
1372
|
+
function encodeInteger$1(buf, pos, state, segment, j) {
|
|
1373
|
+
const next = segment[j];
|
|
1374
|
+
let num = next - state[j];
|
|
1375
|
+
state[j] = next;
|
|
1335
1376
|
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
1336
1377
|
do {
|
|
1337
|
-
|
|
1378
|
+
let clamped = num & 31;
|
|
1338
1379
|
num >>>= 5;
|
|
1339
|
-
if (num > 0)
|
|
1380
|
+
if (num > 0)
|
|
1340
1381
|
clamped |= 32;
|
|
1341
|
-
|
|
1342
|
-
result += chars$1[clamped];
|
|
1382
|
+
buf[pos++] = intToChar[clamped];
|
|
1343
1383
|
} while (num > 0);
|
|
1344
|
-
return
|
|
1384
|
+
return pos;
|
|
1345
1385
|
}
|
|
1346
1386
|
|
|
1347
1387
|
// Matches the scheme of a URL, eg "http://"
|
|
@@ -1519,199 +1559,82 @@ function resolve$3(input, base) {
|
|
|
1519
1559
|
return `${url.scheme}//${url.user}${url.host}${url.port}${url.path}`;
|
|
1520
1560
|
}
|
|
1521
1561
|
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1530
|
-
*
|
|
1531
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1532
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1533
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1534
|
-
* See the License for the specific language governing permissions and
|
|
1535
|
-
* limitations under the License.
|
|
1536
|
-
*/
|
|
1537
|
-
/**
|
|
1538
|
-
* Creates a brand new (prototype-less) object with the enumerable-own
|
|
1539
|
-
* properties of `target`. Any enumerable-own properties from `source` which
|
|
1540
|
-
* are not present on `target` will be copied as well.
|
|
1541
|
-
*/
|
|
1542
|
-
function defaults(target, source) {
|
|
1543
|
-
return Object.assign(Object.create(null), source, target);
|
|
1562
|
+
function resolve$2(input, base) {
|
|
1563
|
+
// The base is always treated as a directory, if it's not empty.
|
|
1564
|
+
// https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327
|
|
1565
|
+
// https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401
|
|
1566
|
+
if (base && !base.endsWith('/'))
|
|
1567
|
+
base += '/';
|
|
1568
|
+
return resolve$3(input, base);
|
|
1544
1569
|
}
|
|
1545
1570
|
|
|
1546
1571
|
/**
|
|
1547
|
-
*
|
|
1548
|
-
*
|
|
1549
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1550
|
-
* you may not use this file except in compliance with the License.
|
|
1551
|
-
* You may obtain a copy of the License at
|
|
1552
|
-
*
|
|
1553
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1554
|
-
*
|
|
1555
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1556
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1557
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1558
|
-
* See the License for the specific language governing permissions and
|
|
1559
|
-
* limitations under the License.
|
|
1560
|
-
*/
|
|
1561
|
-
/**
|
|
1562
|
-
* Decodes an input sourcemap into a `DecodedSourceMap` sourcemap object.
|
|
1563
|
-
*
|
|
1564
|
-
* Valid input maps include a `DecodedSourceMap`, a `RawSourceMap`, or JSON
|
|
1565
|
-
* representations of either type.
|
|
1572
|
+
* Removes everything after the last "/", but leaves the slash.
|
|
1566
1573
|
*/
|
|
1567
|
-
function
|
|
1568
|
-
if (
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
if (typeof mappings === 'string') {
|
|
1573
|
-
mappings = sortMappings(decode(mappings), true);
|
|
1574
|
-
}
|
|
1575
|
-
else {
|
|
1576
|
-
// Clone the Line so that we can sort it. We don't want to mutate an array
|
|
1577
|
-
// that we don't own directly.
|
|
1578
|
-
mappings = sortMappings(mappings, false);
|
|
1579
|
-
}
|
|
1580
|
-
return defaults({ mappings }, map);
|
|
1581
|
-
}
|
|
1582
|
-
function firstUnsortedSegmentLine(mappings) {
|
|
1583
|
-
for (let i = 0; i < mappings.length; i++) {
|
|
1584
|
-
const segments = mappings[i];
|
|
1585
|
-
for (let j = 1; j < segments.length; j++) {
|
|
1586
|
-
if (segments[j][0] < segments[j - 1][0]) {
|
|
1587
|
-
return i;
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
return mappings.length;
|
|
1574
|
+
function stripFilename(path) {
|
|
1575
|
+
if (!path)
|
|
1576
|
+
return '';
|
|
1577
|
+
const index = path.lastIndexOf('/');
|
|
1578
|
+
return path.slice(0, index + 1);
|
|
1592
1579
|
}
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1580
|
+
|
|
1581
|
+
function maybeSort(mappings, owned) {
|
|
1582
|
+
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
|
1583
|
+
if (unsortedIndex === mappings.length)
|
|
1596
1584
|
return mappings;
|
|
1585
|
+
// If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If
|
|
1586
|
+
// not, we do not want to modify the consumer's input array.
|
|
1597
1587
|
if (!owned)
|
|
1598
1588
|
mappings = mappings.slice();
|
|
1599
|
-
for (let i =
|
|
1589
|
+
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
|
|
1600
1590
|
mappings[i] = sortSegments(mappings[i], owned);
|
|
1601
1591
|
}
|
|
1602
1592
|
return mappings;
|
|
1603
1593
|
}
|
|
1604
|
-
function
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
}
|
|
1609
|
-
function segmentComparator(a, b) {
|
|
1610
|
-
return a[0] - b[0];
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
/**
|
|
1614
|
-
* Copyright 2019 The AMP HTML Authors. All Rights Reserved.
|
|
1615
|
-
*
|
|
1616
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1617
|
-
* you may not use this file except in compliance with the License.
|
|
1618
|
-
* You may obtain a copy of the License at
|
|
1619
|
-
*
|
|
1620
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1621
|
-
*
|
|
1622
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1623
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1624
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1625
|
-
* See the License for the specific language governing permissions and
|
|
1626
|
-
* limitations under the License.
|
|
1627
|
-
*/
|
|
1628
|
-
/**
|
|
1629
|
-
* A "leaf" node in the sourcemap tree, representing an original, unmodified
|
|
1630
|
-
* source file. Recursive segment tracing ends at the `OriginalSource`.
|
|
1631
|
-
*/
|
|
1632
|
-
class OriginalSource {
|
|
1633
|
-
constructor(filename, content) {
|
|
1634
|
-
this.filename = filename;
|
|
1635
|
-
this.content = content;
|
|
1594
|
+
function nextUnsortedSegmentLine(mappings, start) {
|
|
1595
|
+
for (let i = start; i < mappings.length; i++) {
|
|
1596
|
+
if (!isSorted(mappings[i]))
|
|
1597
|
+
return i;
|
|
1636
1598
|
}
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1599
|
+
return mappings.length;
|
|
1600
|
+
}
|
|
1601
|
+
function isSorted(line) {
|
|
1602
|
+
for (let j = 1; j < line.length; j++) {
|
|
1603
|
+
if (line[j][0] < line[j - 1][0]) {
|
|
1604
|
+
return false;
|
|
1605
|
+
}
|
|
1643
1606
|
}
|
|
1607
|
+
return true;
|
|
1644
1608
|
}
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
*
|
|
1653
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1654
|
-
*
|
|
1655
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1656
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1657
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1658
|
-
* See the License for the specific language governing permissions and
|
|
1659
|
-
* limitations under the License.
|
|
1660
|
-
*/
|
|
1661
|
-
function resolve$2(input, base) {
|
|
1662
|
-
// The base is always treated as a directory, if it's not empty.
|
|
1663
|
-
// https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327
|
|
1664
|
-
// https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401
|
|
1665
|
-
if (base && !base.endsWith('/'))
|
|
1666
|
-
base += '/';
|
|
1667
|
-
return resolve$3(input, base);
|
|
1609
|
+
function sortSegments(line, owned) {
|
|
1610
|
+
if (!owned)
|
|
1611
|
+
line = line.slice();
|
|
1612
|
+
return line.sort(sortComparator);
|
|
1613
|
+
}
|
|
1614
|
+
function sortComparator(a, b) {
|
|
1615
|
+
return a[0] - b[0];
|
|
1668
1616
|
}
|
|
1669
1617
|
|
|
1670
1618
|
/**
|
|
1671
|
-
*
|
|
1672
|
-
*
|
|
1673
|
-
*
|
|
1674
|
-
*
|
|
1675
|
-
* You may obtain a copy of the License at
|
|
1676
|
-
*
|
|
1677
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1678
|
-
*
|
|
1679
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1680
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1681
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1682
|
-
* See the License for the specific language governing permissions and
|
|
1683
|
-
* limitations under the License.
|
|
1684
|
-
*/
|
|
1685
|
-
/**
|
|
1686
|
-
* A binary search implementation that returns the index if a match is found,
|
|
1687
|
-
* or the negated index of where the `needle` should be inserted.
|
|
1688
|
-
*
|
|
1689
|
-
* The `comparator` callback receives both the `item` under comparison and the
|
|
1690
|
-
* needle we are searching for. It must return `0` if the `item` is a match,
|
|
1691
|
-
* any negative number if `item` is too small (and we must search after it), or
|
|
1692
|
-
* any positive number if the `item` is too large (and we must search before
|
|
1693
|
-
* it).
|
|
1694
|
-
*
|
|
1695
|
-
* If no match is found, a negated index of where to insert the `needle` is
|
|
1696
|
-
* returned. This negated index is guaranteed to be less than 0. To insert an
|
|
1697
|
-
* item, negate it (again) and splice:
|
|
1619
|
+
* A binary search implementation that returns the index if a match is found.
|
|
1620
|
+
* If no match is found, then the left-index (the index associated with the item that comes just
|
|
1621
|
+
* before the desired index) is returned. To maintain proper sort order, a splice would happen at
|
|
1622
|
+
* the next index:
|
|
1698
1623
|
*
|
|
1699
1624
|
* ```js
|
|
1700
1625
|
* const array = [1, 3];
|
|
1701
1626
|
* const needle = 2;
|
|
1702
1627
|
* const index = binarySearch(array, needle, (item, needle) => item - needle);
|
|
1703
1628
|
*
|
|
1704
|
-
* assert.equal(index,
|
|
1705
|
-
*
|
|
1706
|
-
* array.splice(~index, 0, needle);
|
|
1629
|
+
* assert.equal(index, 0);
|
|
1630
|
+
* array.splice(index + 1, 0, needle);
|
|
1707
1631
|
* assert.deepEqual(array, [1, 2, 3]);
|
|
1708
1632
|
* ```
|
|
1709
1633
|
*/
|
|
1710
|
-
function binarySearch$2(haystack, needle,
|
|
1711
|
-
low = Math.max(low, 0);
|
|
1634
|
+
function binarySearch$2(haystack, needle, low, high) {
|
|
1712
1635
|
while (low <= high) {
|
|
1713
1636
|
const mid = low + ((high - low) >> 1);
|
|
1714
|
-
const cmp =
|
|
1637
|
+
const cmp = haystack[mid][0] - needle;
|
|
1715
1638
|
if (cmp === 0) {
|
|
1716
1639
|
return mid;
|
|
1717
1640
|
}
|
|
@@ -1722,24 +1645,147 @@ function binarySearch$2(haystack, needle, comparator, low, high) {
|
|
|
1722
1645
|
high = mid - 1;
|
|
1723
1646
|
}
|
|
1724
1647
|
}
|
|
1725
|
-
return
|
|
1648
|
+
return low - 1;
|
|
1649
|
+
}
|
|
1650
|
+
function memoizedState() {
|
|
1651
|
+
return {
|
|
1652
|
+
lastKey: -1,
|
|
1653
|
+
lastNeedle: -1,
|
|
1654
|
+
lastIndex: -1,
|
|
1655
|
+
};
|
|
1656
|
+
}
|
|
1657
|
+
/**
|
|
1658
|
+
* This overly complicated beast is just to record the last tested line/column and the resulting
|
|
1659
|
+
* index, allowing us to skip a few tests if mappings are monotonically increasing.
|
|
1660
|
+
*/
|
|
1661
|
+
function memoizedBinarySearch(haystack, needle, state, key) {
|
|
1662
|
+
const { lastKey, lastNeedle, lastIndex } = state;
|
|
1663
|
+
let low = 0;
|
|
1664
|
+
let high = haystack.length - 1;
|
|
1665
|
+
if (key === lastKey) {
|
|
1666
|
+
if (needle === lastNeedle) {
|
|
1667
|
+
return lastIndex;
|
|
1668
|
+
}
|
|
1669
|
+
if (needle >= lastNeedle) {
|
|
1670
|
+
// lastIndex may be -1 if the previous needle was not found.
|
|
1671
|
+
low = Math.max(lastIndex, 0);
|
|
1672
|
+
}
|
|
1673
|
+
else {
|
|
1674
|
+
high = lastIndex;
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
state.lastKey = key;
|
|
1678
|
+
state.lastNeedle = needle;
|
|
1679
|
+
return (state.lastIndex = binarySearch$2(haystack, needle, low, high));
|
|
1726
1680
|
}
|
|
1727
1681
|
|
|
1682
|
+
Object.freeze({
|
|
1683
|
+
source: null,
|
|
1684
|
+
line: null,
|
|
1685
|
+
column: null,
|
|
1686
|
+
name: null,
|
|
1687
|
+
});
|
|
1728
1688
|
/**
|
|
1729
|
-
*
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
*
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
*
|
|
1738
|
-
*
|
|
1739
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1740
|
-
* See the License for the specific language governing permissions and
|
|
1741
|
-
* limitations under the License.
|
|
1689
|
+
* Returns the encoded (VLQ string) form of the SourceMap's mappings field.
|
|
1690
|
+
*/
|
|
1691
|
+
let encodedMappings;
|
|
1692
|
+
/**
|
|
1693
|
+
* Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.
|
|
1694
|
+
*/
|
|
1695
|
+
let decodedMappings;
|
|
1696
|
+
/**
|
|
1697
|
+
* A low-level API to find the segment associated with a generated line/column (think, from a
|
|
1698
|
+
* stack trace). Line and column here are 0-based, unlike `originalPositionFor`.
|
|
1742
1699
|
*/
|
|
1700
|
+
let traceSegment;
|
|
1701
|
+
/**
|
|
1702
|
+
* A helper that skips sorting of the input map's mappings array, which can be expensive for larger
|
|
1703
|
+
* maps.
|
|
1704
|
+
*/
|
|
1705
|
+
let presortedDecodedMap;
|
|
1706
|
+
class TraceMap {
|
|
1707
|
+
constructor(map, mapUrl) {
|
|
1708
|
+
this._binarySearchMemo = memoizedState();
|
|
1709
|
+
const isString = typeof map === 'string';
|
|
1710
|
+
const parsed = isString ? JSON.parse(map) : map;
|
|
1711
|
+
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
|
1712
|
+
this.version = version;
|
|
1713
|
+
this.file = file;
|
|
1714
|
+
this.names = names;
|
|
1715
|
+
this.sourceRoot = sourceRoot;
|
|
1716
|
+
this.sources = sources;
|
|
1717
|
+
this.sourcesContent = sourcesContent;
|
|
1718
|
+
if (sourceRoot || mapUrl) {
|
|
1719
|
+
const from = resolve$2(sourceRoot || '', stripFilename(mapUrl));
|
|
1720
|
+
this.resolvedSources = sources.map((s) => resolve$2(s || '', from));
|
|
1721
|
+
}
|
|
1722
|
+
else {
|
|
1723
|
+
this.resolvedSources = sources;
|
|
1724
|
+
}
|
|
1725
|
+
const { mappings } = parsed;
|
|
1726
|
+
if (typeof mappings === 'string') {
|
|
1727
|
+
this._encoded = mappings;
|
|
1728
|
+
this._decoded = decode(mappings);
|
|
1729
|
+
}
|
|
1730
|
+
else {
|
|
1731
|
+
this._encoded = undefined;
|
|
1732
|
+
this._decoded = maybeSort(mappings, isString);
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
(() => {
|
|
1737
|
+
encodedMappings = (map) => {
|
|
1738
|
+
var _a;
|
|
1739
|
+
return ((_a = map._encoded) !== null && _a !== void 0 ? _a : (map._encoded = encode$1(map._decoded)));
|
|
1740
|
+
};
|
|
1741
|
+
decodedMappings = (map) => {
|
|
1742
|
+
return map._decoded;
|
|
1743
|
+
};
|
|
1744
|
+
traceSegment = (map, line, column) => {
|
|
1745
|
+
const decoded = map._decoded;
|
|
1746
|
+
// It's common for parent source maps to have pointers to lines that have no
|
|
1747
|
+
// mapping (like a "//# sourceMappingURL=") at the end of the child file.
|
|
1748
|
+
if (line >= decoded.length)
|
|
1749
|
+
return null;
|
|
1750
|
+
const segments = decoded[line];
|
|
1751
|
+
const index = memoizedBinarySearch(segments, column, map._binarySearchMemo, line);
|
|
1752
|
+
// we come before any mapped segment
|
|
1753
|
+
if (index < 0)
|
|
1754
|
+
return null;
|
|
1755
|
+
return segments[index];
|
|
1756
|
+
};
|
|
1757
|
+
presortedDecodedMap = (map, mapUrl) => {
|
|
1758
|
+
const clone = Object.assign({}, map);
|
|
1759
|
+
clone.mappings = [];
|
|
1760
|
+
const tracer = new TraceMap(clone, mapUrl);
|
|
1761
|
+
tracer._decoded = map.mappings;
|
|
1762
|
+
return tracer;
|
|
1763
|
+
};
|
|
1764
|
+
})();
|
|
1765
|
+
|
|
1766
|
+
/**
|
|
1767
|
+
* A "leaf" node in the sourcemap tree, representing an original, unmodified
|
|
1768
|
+
* source file. Recursive segment tracing ends at the `OriginalSource`.
|
|
1769
|
+
*/
|
|
1770
|
+
class OriginalSource {
|
|
1771
|
+
constructor(source, content) {
|
|
1772
|
+
this.source = source;
|
|
1773
|
+
this.content = content;
|
|
1774
|
+
}
|
|
1775
|
+
/**
|
|
1776
|
+
* Tracing a `SourceMapSegment` ends when we get to an `OriginalSource`,
|
|
1777
|
+
* meaning this line/column location originated from this source file.
|
|
1778
|
+
*/
|
|
1779
|
+
originalPositionFor(line, column, name) {
|
|
1780
|
+
return { column, line, name, source: this.source, content: this.content };
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
/**
|
|
1785
|
+
* Puts `key` into the backing array, if it is not already present. Returns
|
|
1786
|
+
* the index of the `key` in the backing array.
|
|
1787
|
+
*/
|
|
1788
|
+
let put;
|
|
1743
1789
|
/**
|
|
1744
1790
|
* FastStringArray acts like a `Set` (allowing only one occurrence of a string
|
|
1745
1791
|
* `key`), but provides the index of the `key` in the backing array.
|
|
@@ -1753,12 +1799,10 @@ class FastStringArray {
|
|
|
1753
1799
|
this.indexes = Object.create(null);
|
|
1754
1800
|
this.array = [];
|
|
1755
1801
|
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
put(key) {
|
|
1761
|
-
const { array, indexes } = this;
|
|
1802
|
+
}
|
|
1803
|
+
(() => {
|
|
1804
|
+
put = (strarr, key) => {
|
|
1805
|
+
const { array, indexes } = strarr;
|
|
1762
1806
|
// The key may or may not be present. If it is present, it's a number.
|
|
1763
1807
|
let index = indexes[key];
|
|
1764
1808
|
// If it's not yet present, we need to insert it and track the index in the
|
|
@@ -1768,24 +1812,16 @@ class FastStringArray {
|
|
|
1768
1812
|
array.push(key);
|
|
1769
1813
|
}
|
|
1770
1814
|
return index;
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1815
|
+
};
|
|
1816
|
+
})();
|
|
1773
1817
|
|
|
1818
|
+
const INVALID_MAPPING = undefined;
|
|
1819
|
+
const SOURCELESS_MAPPING = null;
|
|
1774
1820
|
/**
|
|
1775
|
-
*
|
|
1776
|
-
*
|
|
1777
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1778
|
-
* you may not use this file except in compliance with the License.
|
|
1779
|
-
* You may obtain a copy of the License at
|
|
1780
|
-
*
|
|
1781
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1782
|
-
*
|
|
1783
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1784
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1785
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1786
|
-
* See the License for the specific language governing permissions and
|
|
1787
|
-
* limitations under the License.
|
|
1821
|
+
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
|
1822
|
+
* resolving each mapping in terms of the original source files.
|
|
1788
1823
|
*/
|
|
1824
|
+
let traceMappings;
|
|
1789
1825
|
/**
|
|
1790
1826
|
* SourceMapTree represents a single sourcemap, with the ability to trace
|
|
1791
1827
|
* mappings into its child nodes (which may themselves be SourceMapTrees).
|
|
@@ -1794,166 +1830,105 @@ class SourceMapTree {
|
|
|
1794
1830
|
constructor(map, sources) {
|
|
1795
1831
|
this.map = map;
|
|
1796
1832
|
this.sources = sources;
|
|
1797
|
-
this.lastLine = 0;
|
|
1798
|
-
this.lastColumn = 0;
|
|
1799
|
-
this.lastIndex = 0;
|
|
1800
1833
|
}
|
|
1801
1834
|
/**
|
|
1802
|
-
*
|
|
1803
|
-
*
|
|
1804
|
-
* files.
|
|
1835
|
+
* originalPositionFor is only called on children SourceMapTrees. It recurses down
|
|
1836
|
+
* into its own child SourceMapTrees, until we find the original source map.
|
|
1805
1837
|
*/
|
|
1806
|
-
|
|
1838
|
+
originalPositionFor(line, column, name) {
|
|
1839
|
+
const segment = traceSegment(this.map, line, column);
|
|
1840
|
+
// If we couldn't find a segment, then this doesn't exist in the sourcemap.
|
|
1841
|
+
if (segment == null)
|
|
1842
|
+
return INVALID_MAPPING;
|
|
1843
|
+
// 1-length segments only move the current generated column, there's no source information
|
|
1844
|
+
// to gather from it.
|
|
1845
|
+
if (segment.length === 1)
|
|
1846
|
+
return SOURCELESS_MAPPING;
|
|
1847
|
+
const source = this.sources[segment[1]];
|
|
1848
|
+
return source.originalPositionFor(segment[2], segment[3], segment.length === 5 ? this.map.names[segment[4]] : name);
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
(() => {
|
|
1852
|
+
traceMappings = (tree) => {
|
|
1807
1853
|
const mappings = [];
|
|
1808
1854
|
const names = new FastStringArray();
|
|
1809
1855
|
const sources = new FastStringArray();
|
|
1810
1856
|
const sourcesContent = [];
|
|
1811
|
-
const {
|
|
1857
|
+
const { sources: rootSources, map } = tree;
|
|
1858
|
+
const rootNames = map.names;
|
|
1859
|
+
const rootMappings = decodedMappings(map);
|
|
1860
|
+
let lastLineWithSegment = -1;
|
|
1812
1861
|
for (let i = 0; i < rootMappings.length; i++) {
|
|
1813
1862
|
const segments = rootMappings[i];
|
|
1814
1863
|
const tracedSegments = [];
|
|
1815
|
-
let
|
|
1864
|
+
let lastSourcesIndex = -1;
|
|
1865
|
+
let lastSourceLine = -1;
|
|
1866
|
+
let lastSourceColumn = -1;
|
|
1816
1867
|
for (let j = 0; j < segments.length; j++) {
|
|
1817
1868
|
const segment = segments[j];
|
|
1818
|
-
|
|
1819
|
-
//
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1869
|
+
let traced = SOURCELESS_MAPPING;
|
|
1870
|
+
// 1-length segments only move the current generated column, there's no source information
|
|
1871
|
+
// to gather from it.
|
|
1872
|
+
if (segment.length !== 1) {
|
|
1873
|
+
const source = rootSources[segment[1]];
|
|
1874
|
+
traced = source.originalPositionFor(segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : '');
|
|
1875
|
+
// If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a
|
|
1876
|
+
// respective segment into an original source.
|
|
1877
|
+
if (traced === INVALID_MAPPING)
|
|
1878
|
+
continue;
|
|
1879
|
+
}
|
|
1880
|
+
const genCol = segment[0];
|
|
1881
|
+
if (traced === SOURCELESS_MAPPING) {
|
|
1882
|
+
if (lastSourcesIndex === -1) {
|
|
1883
|
+
// This is a consecutive source-less segment, which doesn't carry any new information.
|
|
1884
|
+
continue;
|
|
1885
|
+
}
|
|
1886
|
+
lastSourcesIndex = lastSourceLine = lastSourceColumn = -1;
|
|
1887
|
+
tracedSegments.push([genCol]);
|
|
1825
1888
|
continue;
|
|
1889
|
+
}
|
|
1826
1890
|
// So we traced a segment down into its original source file. Now push a
|
|
1827
1891
|
// new segment pointing to this location.
|
|
1828
|
-
const { column, line, name } = traced;
|
|
1829
|
-
const { content, filename } = traced.source;
|
|
1892
|
+
const { column, line, name, content, source } = traced;
|
|
1830
1893
|
// Store the source location, and ensure we keep sourcesContent up to
|
|
1831
1894
|
// date with the sources array.
|
|
1832
|
-
const
|
|
1833
|
-
sourcesContent[
|
|
1834
|
-
if (
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
//
|
|
1839
|
-
// It doesn't provide any new information, and only bloats the sourcemap.
|
|
1895
|
+
const sourcesIndex = put(sources, source);
|
|
1896
|
+
sourcesContent[sourcesIndex] = content;
|
|
1897
|
+
if (lastSourcesIndex === sourcesIndex &&
|
|
1898
|
+
lastSourceLine === line &&
|
|
1899
|
+
lastSourceColumn === column) {
|
|
1900
|
+
// This is a duplicate mapping pointing at the exact same starting point in the source
|
|
1901
|
+
// file. It doesn't carry any new information, and only bloats the sourcemap.
|
|
1840
1902
|
continue;
|
|
1841
1903
|
}
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1904
|
+
lastLineWithSegment = i;
|
|
1905
|
+
lastSourcesIndex = sourcesIndex;
|
|
1906
|
+
lastSourceLine = line;
|
|
1907
|
+
lastSourceColumn = column;
|
|
1908
|
+
// This looks like unnecessary duplication, but it noticeably increases performance. If we
|
|
1909
|
+
// were to push the nameIndex onto length-4 array, v8 would internally allocate 22 slots!
|
|
1910
|
+
// That's 68 wasted bytes! Array literals have the same capacity as their length, saving
|
|
1911
|
+
// memory.
|
|
1912
|
+
tracedSegments.push(name
|
|
1913
|
+
? [genCol, sourcesIndex, line, column, put(names, name)]
|
|
1914
|
+
: [genCol, sourcesIndex, line, column]);
|
|
1853
1915
|
}
|
|
1854
1916
|
mappings.push(tracedSegments);
|
|
1855
1917
|
}
|
|
1856
|
-
|
|
1857
|
-
|
|
1918
|
+
if (mappings.length > lastLineWithSegment + 1) {
|
|
1919
|
+
mappings.length = lastLineWithSegment + 1;
|
|
1920
|
+
}
|
|
1921
|
+
return presortedDecodedMap(Object.assign({}, tree.map, {
|
|
1858
1922
|
mappings,
|
|
1923
|
+
// TODO: Make all sources relative to the sourceRoot.
|
|
1924
|
+
sourceRoot: undefined,
|
|
1859
1925
|
names: names.array,
|
|
1860
1926
|
sources: sources.array,
|
|
1861
1927
|
sourcesContent,
|
|
1862
|
-
}
|
|
1863
|
-
}
|
|
1864
|
-
|
|
1865
|
-
* traceSegment is only called on children SourceMapTrees. It recurses down
|
|
1866
|
-
* into its own child SourceMapTrees, until we find the original source map.
|
|
1867
|
-
*/
|
|
1868
|
-
traceSegment(line, column, name) {
|
|
1869
|
-
const { mappings, names } = this.map;
|
|
1870
|
-
// It's common for parent sourcemaps to have pointers to lines that have no
|
|
1871
|
-
// mapping (like a "//# sourceMappingURL=") at the end of the child file.
|
|
1872
|
-
if (line >= mappings.length)
|
|
1873
|
-
return null;
|
|
1874
|
-
const segments = mappings[line];
|
|
1875
|
-
if (segments.length === 0)
|
|
1876
|
-
return null;
|
|
1877
|
-
let low = 0;
|
|
1878
|
-
let high = segments.length - 1;
|
|
1879
|
-
if (line === this.lastLine) {
|
|
1880
|
-
if (column >= this.lastColumn) {
|
|
1881
|
-
low = this.lastIndex;
|
|
1882
|
-
}
|
|
1883
|
-
else {
|
|
1884
|
-
high = this.lastIndex;
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1887
|
-
let index = binarySearch$2(segments, column, segmentComparator$1, low, high);
|
|
1888
|
-
this.lastLine = line;
|
|
1889
|
-
this.lastColumn = column;
|
|
1890
|
-
if (index === -1) {
|
|
1891
|
-
this.lastIndex = index;
|
|
1892
|
-
return null; // we come before any mapped segment
|
|
1893
|
-
}
|
|
1894
|
-
// If we can't find a segment that lines up to this column, we use the
|
|
1895
|
-
// segment before.
|
|
1896
|
-
if (index < 0) {
|
|
1897
|
-
index = ~index - 1;
|
|
1898
|
-
}
|
|
1899
|
-
this.lastIndex = index;
|
|
1900
|
-
const segment = segments[index];
|
|
1901
|
-
// 1-length segments only move the current generated column, there's no
|
|
1902
|
-
// source information to gather from it.
|
|
1903
|
-
if (segment.length === 1)
|
|
1904
|
-
return null;
|
|
1905
|
-
const source = this.sources[segment[1]];
|
|
1906
|
-
// So now we can recurse down, until we hit the original source file.
|
|
1907
|
-
return source.traceSegment(segment[2], segment[3],
|
|
1908
|
-
// A child map's recorded name for this segment takes precedence over the
|
|
1909
|
-
// parent's mapped name. Imagine a mangler changing the name over, etc.
|
|
1910
|
-
segment.length === 5 ? names[segment[4]] : name);
|
|
1911
|
-
}
|
|
1912
|
-
}
|
|
1913
|
-
function segmentComparator$1(segment, column) {
|
|
1914
|
-
return segment[0] - column;
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
|
-
/**
|
|
1918
|
-
* Copyright 2019 The AMP HTML Authors. All Rights Reserved.
|
|
1919
|
-
*
|
|
1920
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1921
|
-
* you may not use this file except in compliance with the License.
|
|
1922
|
-
* You may obtain a copy of the License at
|
|
1923
|
-
*
|
|
1924
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1925
|
-
*
|
|
1926
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1927
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1928
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1929
|
-
* See the License for the specific language governing permissions and
|
|
1930
|
-
* limitations under the License.
|
|
1931
|
-
*/
|
|
1932
|
-
/**
|
|
1933
|
-
* Removes the filename from a path.
|
|
1934
|
-
*/
|
|
1935
|
-
function stripFilename(path) {
|
|
1936
|
-
if (!path)
|
|
1937
|
-
return '';
|
|
1938
|
-
const index = path.lastIndexOf('/');
|
|
1939
|
-
return path.slice(0, index + 1);
|
|
1940
|
-
}
|
|
1928
|
+
}));
|
|
1929
|
+
};
|
|
1930
|
+
})();
|
|
1941
1931
|
|
|
1942
|
-
/**
|
|
1943
|
-
* Copyright 2019 The AMP HTML Authors. All Rights Reserved.
|
|
1944
|
-
*
|
|
1945
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1946
|
-
* you may not use this file except in compliance with the License.
|
|
1947
|
-
* You may obtain a copy of the License at
|
|
1948
|
-
*
|
|
1949
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1950
|
-
*
|
|
1951
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1952
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1953
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1954
|
-
* See the License for the specific language governing permissions and
|
|
1955
|
-
* limitations under the License.
|
|
1956
|
-
*/
|
|
1957
1932
|
function asArray(value) {
|
|
1958
1933
|
if (Array.isArray(value))
|
|
1959
1934
|
return value;
|
|
@@ -1970,8 +1945,8 @@ function asArray(value) {
|
|
|
1970
1945
|
* does not have an associated sourcemap, it is considered an original,
|
|
1971
1946
|
* unmodified source file.
|
|
1972
1947
|
*/
|
|
1973
|
-
function buildSourceMapTree(input, loader
|
|
1974
|
-
const maps = asArray(input).map(
|
|
1948
|
+
function buildSourceMapTree(input, loader) {
|
|
1949
|
+
const maps = asArray(input).map((m) => new TraceMap(m, ''));
|
|
1975
1950
|
const map = maps.pop();
|
|
1976
1951
|
for (let i = 0; i < maps.length; i++) {
|
|
1977
1952
|
if (maps[i].sources.length > 1) {
|
|
@@ -1979,48 +1954,43 @@ function buildSourceMapTree(input, loader, relativeRoot) {
|
|
|
1979
1954
|
'Did you specify these with the most recent transformation maps first?');
|
|
1980
1955
|
}
|
|
1981
1956
|
}
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1957
|
+
let tree = build$2(map, '', loader);
|
|
1958
|
+
for (let i = maps.length - 1; i >= 0; i--) {
|
|
1959
|
+
tree = new SourceMapTree(maps[i], [tree]);
|
|
1960
|
+
}
|
|
1961
|
+
return tree;
|
|
1962
|
+
}
|
|
1963
|
+
function build$2(map, importer, loader) {
|
|
1964
|
+
const { resolvedSources, sourcesContent } = map;
|
|
1965
|
+
const children = resolvedSources.map((sourceFile, i) => {
|
|
1966
|
+
// The loading context gives the loader more information about why this file is being loaded
|
|
1967
|
+
// (eg, from which importer). It also allows the loader to override the location of the loaded
|
|
1968
|
+
// sourcemap/original source, or to override the content in the sourcesContent field if it's
|
|
1969
|
+
// an unmodified source file.
|
|
1970
|
+
const ctx = {
|
|
1971
|
+
importer,
|
|
1972
|
+
source: sourceFile || '',
|
|
1973
|
+
content: undefined,
|
|
1974
|
+
};
|
|
1987
1975
|
// Use the provided loader callback to retrieve the file's sourcemap.
|
|
1988
1976
|
// TODO: We should eventually support async loading of sourcemap files.
|
|
1989
|
-
const sourceMap = loader(
|
|
1977
|
+
const sourceMap = loader(ctx.source, ctx);
|
|
1978
|
+
const { source, content } = ctx;
|
|
1990
1979
|
// If there is no sourcemap, then it is an unmodified source file.
|
|
1991
1980
|
if (!sourceMap) {
|
|
1992
|
-
// The source file
|
|
1993
|
-
//
|
|
1994
|
-
//
|
|
1995
|
-
const sourceContent = sourcesContent ? sourcesContent[i] : null;
|
|
1996
|
-
return new OriginalSource(
|
|
1981
|
+
// The contents of this unmodified source file can be overridden via the loader context,
|
|
1982
|
+
// allowing it to be explicitly null or a string. If it remains undefined, we fall back to
|
|
1983
|
+
// the importing sourcemap's `sourcesContent` field.
|
|
1984
|
+
const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
|
|
1985
|
+
return new OriginalSource(source, sourceContent);
|
|
1997
1986
|
}
|
|
1998
1987
|
// Else, it's a real sourcemap, and we need to recurse into it to load its
|
|
1999
1988
|
// source files.
|
|
2000
|
-
return
|
|
1989
|
+
return build$2(new TraceMap(sourceMap, source), source, loader);
|
|
2001
1990
|
});
|
|
2002
|
-
|
|
2003
|
-
for (let i = maps.length - 1; i >= 0; i--) {
|
|
2004
|
-
tree = new SourceMapTree(maps[i], [tree]);
|
|
2005
|
-
}
|
|
2006
|
-
return tree;
|
|
1991
|
+
return new SourceMapTree(map, children);
|
|
2007
1992
|
}
|
|
2008
1993
|
|
|
2009
|
-
/**
|
|
2010
|
-
* Copyright 2019 The AMP HTML Authors. All Rights Reserved.
|
|
2011
|
-
*
|
|
2012
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2013
|
-
* you may not use this file except in compliance with the License.
|
|
2014
|
-
* You may obtain a copy of the License at
|
|
2015
|
-
*
|
|
2016
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2017
|
-
*
|
|
2018
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2019
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2020
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2021
|
-
* See the License for the specific language governing permissions and
|
|
2022
|
-
* limitations under the License.
|
|
2023
|
-
*/
|
|
2024
1994
|
/**
|
|
2025
1995
|
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
|
2026
1996
|
* provided to it.
|
|
@@ -2028,13 +1998,10 @@ function buildSourceMapTree(input, loader, relativeRoot) {
|
|
|
2028
1998
|
class SourceMap$1 {
|
|
2029
1999
|
constructor(map, options) {
|
|
2030
2000
|
this.version = 3; // SourceMap spec says this should be first.
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
this.mappings = options.decodedMappings ? map.mappings : encode(map.mappings);
|
|
2001
|
+
this.file = map.file;
|
|
2002
|
+
this.mappings = options.decodedMappings ? decodedMappings(map) : encodedMappings(map);
|
|
2034
2003
|
this.names = map.names;
|
|
2035
|
-
|
|
2036
|
-
// before we can support a sourceRoot.
|
|
2037
|
-
// if ('sourceRoot' in map) this.sourceRoot = map.sourceRoot;
|
|
2004
|
+
this.sourceRoot = map.sourceRoot;
|
|
2038
2005
|
this.sources = map.sources;
|
|
2039
2006
|
if (!options.excludeContent && 'sourcesContent' in map) {
|
|
2040
2007
|
this.sourcesContent = map.sourcesContent;
|
|
@@ -2045,21 +2012,6 @@ class SourceMap$1 {
|
|
|
2045
2012
|
}
|
|
2046
2013
|
}
|
|
2047
2014
|
|
|
2048
|
-
/**
|
|
2049
|
-
* Copyright 2019 The AMP HTML Authors. All Rights Reserved.
|
|
2050
|
-
*
|
|
2051
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2052
|
-
* you may not use this file except in compliance with the License.
|
|
2053
|
-
* You may obtain a copy of the License at
|
|
2054
|
-
*
|
|
2055
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2056
|
-
*
|
|
2057
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2058
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2059
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2060
|
-
* See the License for the specific language governing permissions and
|
|
2061
|
-
* limitations under the License.
|
|
2062
|
-
*/
|
|
2063
2015
|
/**
|
|
2064
2016
|
* Traces through all the mappings in the root sourcemap, through the sources
|
|
2065
2017
|
* (and their sourcemaps), all the way back to the original source location.
|
|
@@ -2077,8 +2029,8 @@ class SourceMap$1 {
|
|
|
2077
2029
|
*/
|
|
2078
2030
|
function remapping(input, loader, options) {
|
|
2079
2031
|
const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
|
|
2080
|
-
const
|
|
2081
|
-
return new SourceMap$1(
|
|
2032
|
+
const tree = buildSourceMapTree(input, loader);
|
|
2033
|
+
return new SourceMap$1(traceMappings(tree), opts);
|
|
2082
2034
|
}
|
|
2083
2035
|
|
|
2084
2036
|
function slash$1(p) {
|
|
@@ -2386,8 +2338,8 @@ function writeFile(filename, content) {
|
|
|
2386
2338
|
*/
|
|
2387
2339
|
function isFileReadable(filename) {
|
|
2388
2340
|
try {
|
|
2389
|
-
fs__default.
|
|
2390
|
-
return
|
|
2341
|
+
const stat = fs__default.statSync(filename, { throwIfNoEntry: false });
|
|
2342
|
+
return !!stat;
|
|
2391
2343
|
}
|
|
2392
2344
|
catch {
|
|
2393
2345
|
return false;
|
|
@@ -2858,6 +2810,62 @@ function throttle(fn) {
|
|
|
2858
2810
|
};
|
|
2859
2811
|
}
|
|
2860
2812
|
|
|
2813
|
+
var charToInteger = {};
|
|
2814
|
+
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
2815
|
+
for (var i$2 = 0; i$2 < chars$1.length; i$2++) {
|
|
2816
|
+
charToInteger[chars$1.charCodeAt(i$2)] = i$2;
|
|
2817
|
+
}
|
|
2818
|
+
function encode(decoded) {
|
|
2819
|
+
var sourceFileIndex = 0; // second field
|
|
2820
|
+
var sourceCodeLine = 0; // third field
|
|
2821
|
+
var sourceCodeColumn = 0; // fourth field
|
|
2822
|
+
var nameIndex = 0; // fifth field
|
|
2823
|
+
var mappings = '';
|
|
2824
|
+
for (var i = 0; i < decoded.length; i++) {
|
|
2825
|
+
var line = decoded[i];
|
|
2826
|
+
if (i > 0)
|
|
2827
|
+
mappings += ';';
|
|
2828
|
+
if (line.length === 0)
|
|
2829
|
+
continue;
|
|
2830
|
+
var generatedCodeColumn = 0; // first field
|
|
2831
|
+
var lineMappings = [];
|
|
2832
|
+
for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
|
|
2833
|
+
var segment = line_1[_i];
|
|
2834
|
+
var segmentMappings = encodeInteger(segment[0] - generatedCodeColumn);
|
|
2835
|
+
generatedCodeColumn = segment[0];
|
|
2836
|
+
if (segment.length > 1) {
|
|
2837
|
+
segmentMappings +=
|
|
2838
|
+
encodeInteger(segment[1] - sourceFileIndex) +
|
|
2839
|
+
encodeInteger(segment[2] - sourceCodeLine) +
|
|
2840
|
+
encodeInteger(segment[3] - sourceCodeColumn);
|
|
2841
|
+
sourceFileIndex = segment[1];
|
|
2842
|
+
sourceCodeLine = segment[2];
|
|
2843
|
+
sourceCodeColumn = segment[3];
|
|
2844
|
+
}
|
|
2845
|
+
if (segment.length === 5) {
|
|
2846
|
+
segmentMappings += encodeInteger(segment[4] - nameIndex);
|
|
2847
|
+
nameIndex = segment[4];
|
|
2848
|
+
}
|
|
2849
|
+
lineMappings.push(segmentMappings);
|
|
2850
|
+
}
|
|
2851
|
+
mappings += lineMappings.join(',');
|
|
2852
|
+
}
|
|
2853
|
+
return mappings;
|
|
2854
|
+
}
|
|
2855
|
+
function encodeInteger(num) {
|
|
2856
|
+
var result = '';
|
|
2857
|
+
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
2858
|
+
do {
|
|
2859
|
+
var clamped = num & 31;
|
|
2860
|
+
num >>>= 5;
|
|
2861
|
+
if (num > 0) {
|
|
2862
|
+
clamped |= 32;
|
|
2863
|
+
}
|
|
2864
|
+
result += chars$1[clamped];
|
|
2865
|
+
} while (num > 0);
|
|
2866
|
+
return result;
|
|
2867
|
+
}
|
|
2868
|
+
|
|
2861
2869
|
var BitSet = function BitSet(arg) {
|
|
2862
2870
|
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
2863
2871
|
};
|
|
@@ -18858,7 +18866,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
18858
18866
|
const postcssOptions = (postcssConfig && postcssConfig.options) || {};
|
|
18859
18867
|
const postcssPlugins = postcssConfig && postcssConfig.plugins ? postcssConfig.plugins.slice() : [];
|
|
18860
18868
|
if (needInlineImport) {
|
|
18861
|
-
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-
|
|
18869
|
+
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-ec2e68f4.js'); }).then(function (n) { return n.index; })).default({
|
|
18862
18870
|
async resolve(id, basedir) {
|
|
18863
18871
|
const resolved = await atImportResolvers.css(id, path__default.join(basedir, '*'));
|
|
18864
18872
|
if (resolved) {
|
|
@@ -18872,7 +18880,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
18872
18880
|
replacer: urlReplacer
|
|
18873
18881
|
}));
|
|
18874
18882
|
if (isModule) {
|
|
18875
|
-
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-
|
|
18883
|
+
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-50851e02.js'); }).then(function (n) { return n.index; })).default({
|
|
18876
18884
|
...modulesOptions,
|
|
18877
18885
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
18878
18886
|
modules = _modules;
|
|
@@ -21295,7 +21303,7 @@ const assetAttrsConfig = {
|
|
|
21295
21303
|
const isAsyncScriptMap = new WeakMap();
|
|
21296
21304
|
async function traverseHtml(html, filePath, visitor) {
|
|
21297
21305
|
// lazy load compiler
|
|
21298
|
-
const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-
|
|
21306
|
+
const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-333341a0.js'); }).then(function (n) { return n.compilerDom_cjs; });
|
|
21299
21307
|
// @vue/compiler-core doesn't like lowercase doctypes
|
|
21300
21308
|
html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
|
|
21301
21309
|
try {
|
|
@@ -22780,7 +22788,9 @@ function manifestPlugin(config) {
|
|
|
22780
22788
|
const outputLength = Array.isArray(output) ? output.length : 1;
|
|
22781
22789
|
if (outputCount >= outputLength) {
|
|
22782
22790
|
this.emitFile({
|
|
22783
|
-
fileName:
|
|
22791
|
+
fileName: typeof config.build.manifest === 'string'
|
|
22792
|
+
? config.build.manifest
|
|
22793
|
+
: 'manifest.json',
|
|
22784
22794
|
type: 'asset',
|
|
22785
22795
|
source: JSON.stringify(manifest, null, 2)
|
|
22786
22796
|
});
|
|
@@ -29527,10 +29537,6 @@ function resolveExports(pkg, key, options, targetWeb) {
|
|
|
29527
29537
|
});
|
|
29528
29538
|
}
|
|
29529
29539
|
function resolveDeepImport(id, { webResolvedImports, setResolvedCache, getResolvedCache, dir, data }, targetWeb, options) {
|
|
29530
|
-
// id might contain ?query
|
|
29531
|
-
// e.g. when using `<style src="some-pkg/dist/style.css"></style>` in .vue file
|
|
29532
|
-
// the id will be ./dist/style.css?vue&type=style&index=0&src=xxx&lang.css
|
|
29533
|
-
id = id.split('?')[0];
|
|
29534
29540
|
const cache = getResolvedCache(id, targetWeb);
|
|
29535
29541
|
if (cache) {
|
|
29536
29542
|
return cache;
|
|
@@ -29855,7 +29861,9 @@ function ssrManifestPlugin(config) {
|
|
|
29855
29861
|
}
|
|
29856
29862
|
}
|
|
29857
29863
|
this.emitFile({
|
|
29858
|
-
fileName:
|
|
29864
|
+
fileName: typeof config.build.ssrManifest === 'string'
|
|
29865
|
+
? config.build.ssrManifest
|
|
29866
|
+
: 'ssr-manifest.json',
|
|
29859
29867
|
type: 'asset',
|
|
29860
29868
|
source: JSON.stringify(ssrManifest, null, 2)
|
|
29861
29869
|
});
|
|
@@ -38542,7 +38550,7 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
|
|
|
38542
38550
|
loader,
|
|
38543
38551
|
contents: localContent
|
|
38544
38552
|
};
|
|
38545
|
-
js += `import
|
|
38553
|
+
js += `import ${JSON.stringify(virtualModulePrefix + path)}\n`;
|
|
38546
38554
|
}
|
|
38547
38555
|
else {
|
|
38548
38556
|
js += content + '\n';
|
|
@@ -39238,7 +39246,7 @@ function onRollupWarning(warning, warn, config) {
|
|
|
39238
39246
|
}
|
|
39239
39247
|
}
|
|
39240
39248
|
function resolveExternal(ssrExternals, user) {
|
|
39241
|
-
return (
|
|
39249
|
+
return (id, parentId, isResolved) => {
|
|
39242
39250
|
if (shouldExternalizeForSSR(id, ssrExternals)) {
|
|
39243
39251
|
return true;
|
|
39244
39252
|
}
|
|
@@ -39253,7 +39261,7 @@ function resolveExternal(ssrExternals, user) {
|
|
|
39253
39261
|
return isExternal(id, user);
|
|
39254
39262
|
}
|
|
39255
39263
|
}
|
|
39256
|
-
}
|
|
39264
|
+
};
|
|
39257
39265
|
}
|
|
39258
39266
|
function isExternal(id, test) {
|
|
39259
39267
|
if (typeof test === 'string') {
|
|
@@ -39263,10 +39271,10 @@ function isExternal(id, test) {
|
|
|
39263
39271
|
return test.test(id);
|
|
39264
39272
|
}
|
|
39265
39273
|
}
|
|
39266
|
-
function injectSsrFlagToHooks(
|
|
39267
|
-
const { resolveId, load, transform } =
|
|
39274
|
+
function injectSsrFlagToHooks(plugin) {
|
|
39275
|
+
const { resolveId, load, transform } = plugin;
|
|
39268
39276
|
return {
|
|
39269
|
-
...
|
|
39277
|
+
...plugin,
|
|
39270
39278
|
resolveId: wrapSsrResolveId(resolveId),
|
|
39271
39279
|
load: wrapSsrLoad(load),
|
|
39272
39280
|
transform: wrapSsrTransform(transform)
|
|
@@ -39282,21 +39290,21 @@ function wrapSsrResolveId(fn) {
|
|
|
39282
39290
|
function wrapSsrLoad(fn) {
|
|
39283
39291
|
if (!fn)
|
|
39284
39292
|
return;
|
|
39285
|
-
// Receiving options param to be future-proof if Rollup adds it
|
|
39286
39293
|
return function (id, ...args) {
|
|
39294
|
+
// @ts-expect-error: Receiving options param to be future-proof if Rollup adds it
|
|
39287
39295
|
return fn.call(this, id, injectSsrFlag(args[0]));
|
|
39288
39296
|
};
|
|
39289
39297
|
}
|
|
39290
39298
|
function wrapSsrTransform(fn) {
|
|
39291
39299
|
if (!fn)
|
|
39292
39300
|
return;
|
|
39293
|
-
// Receiving options param to be future-proof if Rollup adds it
|
|
39294
39301
|
return function (code, importer, ...args) {
|
|
39302
|
+
// @ts-expect-error: Receiving options param to be future-proof if Rollup adds it
|
|
39295
39303
|
return fn.call(this, code, importer, injectSsrFlag(args[0]));
|
|
39296
39304
|
};
|
|
39297
39305
|
}
|
|
39298
|
-
function injectSsrFlag(options
|
|
39299
|
-
return { ...options, ssr: true };
|
|
39306
|
+
function injectSsrFlag(options) {
|
|
39307
|
+
return { ...(options !== null && options !== void 0 ? options : {}), ssr: true };
|
|
39300
39308
|
}
|
|
39301
39309
|
|
|
39302
39310
|
var build$1 = {
|
|
@@ -45040,7 +45048,7 @@ async function getCertificate(cacheDir) {
|
|
|
45040
45048
|
return content;
|
|
45041
45049
|
}
|
|
45042
45050
|
catch {
|
|
45043
|
-
const content = (await Promise.resolve().then(function () { return require('./dep-
|
|
45051
|
+
const content = (await Promise.resolve().then(function () { return require('./dep-15d13ae7.js'); })).createCertificate();
|
|
45044
45052
|
fs$n.promises
|
|
45045
45053
|
.mkdir(cacheDir, { recursive: true })
|
|
45046
45054
|
.then(() => fs$n.promises.writeFile(cachePath, content))
|
|
@@ -48225,6 +48233,45 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
48225
48233
|
opts.path = parts[1];
|
|
48226
48234
|
}
|
|
48227
48235
|
|
|
48236
|
+
if (opts.followRedirects) {
|
|
48237
|
+
if (websocket._redirects === 0) {
|
|
48238
|
+
websocket._originalHost = parsedUrl.host;
|
|
48239
|
+
|
|
48240
|
+
const headers = options && options.headers;
|
|
48241
|
+
|
|
48242
|
+
//
|
|
48243
|
+
// Shallow copy the user provided options so that headers can be changed
|
|
48244
|
+
// without mutating the original object.
|
|
48245
|
+
//
|
|
48246
|
+
options = { ...options, headers: {} };
|
|
48247
|
+
|
|
48248
|
+
if (headers) {
|
|
48249
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
48250
|
+
options.headers[key.toLowerCase()] = value;
|
|
48251
|
+
}
|
|
48252
|
+
}
|
|
48253
|
+
} else if (parsedUrl.host !== websocket._originalHost) {
|
|
48254
|
+
//
|
|
48255
|
+
// Match curl 7.77.0 behavior and drop the following headers. These
|
|
48256
|
+
// headers are also dropped when following a redirect to a subdomain.
|
|
48257
|
+
//
|
|
48258
|
+
delete opts.headers.authorization;
|
|
48259
|
+
delete opts.headers.cookie;
|
|
48260
|
+
delete opts.headers.host;
|
|
48261
|
+
opts.auth = undefined;
|
|
48262
|
+
}
|
|
48263
|
+
|
|
48264
|
+
//
|
|
48265
|
+
// Match curl 7.77.0 behavior and make the first `Authorization` header win.
|
|
48266
|
+
// If the `Authorization` header is set, then there is nothing to do as it
|
|
48267
|
+
// will take precedence.
|
|
48268
|
+
//
|
|
48269
|
+
if (opts.auth && !options.headers.authorization) {
|
|
48270
|
+
options.headers.authorization =
|
|
48271
|
+
'Basic ' + Buffer.from(opts.auth).toString('base64');
|
|
48272
|
+
}
|
|
48273
|
+
}
|
|
48274
|
+
|
|
48228
48275
|
let req = (websocket._req = get(opts));
|
|
48229
48276
|
|
|
48230
48277
|
if (opts.timeout) {
|
|
@@ -48790,6 +48837,8 @@ class WebSocketServer extends EventEmitter {
|
|
|
48790
48837
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
48791
48838
|
* not to skip UTF-8 validation for text and close messages
|
|
48792
48839
|
* @param {Function} [options.verifyClient] A hook to reject connections
|
|
48840
|
+
* @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket`
|
|
48841
|
+
* class to use. It must be the `WebSocket` class or class that extends it
|
|
48793
48842
|
* @param {Function} [callback] A listener for the `listening` event
|
|
48794
48843
|
*/
|
|
48795
48844
|
constructor(options, callback) {
|
|
@@ -48808,6 +48857,7 @@ class WebSocketServer extends EventEmitter {
|
|
|
48808
48857
|
host: null,
|
|
48809
48858
|
path: null,
|
|
48810
48859
|
port: null,
|
|
48860
|
+
WebSocket,
|
|
48811
48861
|
...options
|
|
48812
48862
|
};
|
|
48813
48863
|
|
|
@@ -49097,7 +49147,7 @@ class WebSocketServer extends EventEmitter {
|
|
|
49097
49147
|
`Sec-WebSocket-Accept: ${digest}`
|
|
49098
49148
|
];
|
|
49099
49149
|
|
|
49100
|
-
const ws = new WebSocket(null);
|
|
49150
|
+
const ws = new this.options.WebSocket(null);
|
|
49101
49151
|
|
|
49102
49152
|
if (protocols.size) {
|
|
49103
49153
|
//
|
|
@@ -69494,6 +69544,12 @@ async function preview(inlineConfig) {
|
|
|
69494
69544
|
};
|
|
69495
69545
|
}
|
|
69496
69546
|
|
|
69547
|
+
var preview$1 = {
|
|
69548
|
+
__proto__: null,
|
|
69549
|
+
resolvePreviewOptions: resolvePreviewOptions,
|
|
69550
|
+
preview: preview
|
|
69551
|
+
};
|
|
69552
|
+
|
|
69497
69553
|
function matches(pattern, importee) {
|
|
69498
69554
|
if (pattern instanceof RegExp) {
|
|
69499
69555
|
return pattern.test(importee);
|
|
@@ -71433,6 +71489,7 @@ exports.mergeConfig = mergeConfig;
|
|
|
71433
71489
|
exports.normalizePath = normalizePath$4;
|
|
71434
71490
|
exports.optimizeDeps = optimizeDeps;
|
|
71435
71491
|
exports.preview = preview;
|
|
71492
|
+
exports.preview$1 = preview$1;
|
|
71436
71493
|
exports.printHttpServerUrls = printHttpServerUrls;
|
|
71437
71494
|
exports.resolveConfig = resolveConfig;
|
|
71438
71495
|
exports.resolveEnvPrefix = resolveEnvPrefix;
|