vite 2.8.0-beta.4 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of vite might be problematic. Click here for more details.

@@ -10,7 +10,7 @@ var require$$0$5 = require('url');
10
10
  var require$$1$3 = require('http');
11
11
  var require$$0$8 = require('stream');
12
12
  var require$$1 = require('os');
13
- var resolve$3 = require('resolve');
13
+ var resolve$4 = require('resolve');
14
14
  var require$$0$6 = require('module');
15
15
  var perf_hooks = require('perf_hooks');
16
16
  var require$$1$4 = require('https');
@@ -50,7 +50,7 @@ var require$$0__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$0$5);
50
50
  var require$$1__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$1$3);
51
51
  var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$8);
52
52
  var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
53
- var resolve__default = /*#__PURE__*/_interopDefaultLegacy(resolve$3);
53
+ var resolve__default = /*#__PURE__*/_interopDefaultLegacy(resolve$4);
54
54
  var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$6);
55
55
  var require$$1__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$1$4);
56
56
  var require$$0__default$6 = /*#__PURE__*/_interopDefaultLegacy(require$$0$7);
@@ -1222,10 +1222,10 @@ 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
- var charToInteger$1 = {};
1226
- var chars$2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
1227
- for (var i$3 = 0; i$3 < chars$2.length; i$3++) {
1228
- charToInteger$1[chars$2.charCodeAt(i$3)] = i$3;
1225
+ var charToInteger = {};
1226
+ var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
1227
+ for (var i$2 = 0; i$2 < chars$1.length; i$2++) {
1228
+ charToInteger[chars$1.charCodeAt(i$2)] = i$2;
1229
1229
  }
1230
1230
  function decode(mappings) {
1231
1231
  var decoded = [];
@@ -1252,7 +1252,7 @@ function decode(mappings) {
1252
1252
  segment[0] = 0;
1253
1253
  }
1254
1254
  else {
1255
- var integer = charToInteger$1[c];
1255
+ var integer = charToInteger[c];
1256
1256
  if (integer === undefined) {
1257
1257
  throw new Error('Invalid character (' + String.fromCharCode(c) + ')');
1258
1258
  }
@@ -1293,7 +1293,7 @@ function segmentify(line, segment, j) {
1293
1293
  else if (j === 1)
1294
1294
  line.push([segment[0]]);
1295
1295
  }
1296
- function encode$1(decoded) {
1296
+ function encode(decoded) {
1297
1297
  var sourceFileIndex = 0; // second field
1298
1298
  var sourceCodeLine = 0; // third field
1299
1299
  var sourceCodeColumn = 0; // fourth field
@@ -1309,19 +1309,19 @@ function encode$1(decoded) {
1309
1309
  var lineMappings = [];
1310
1310
  for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
1311
1311
  var segment = line_1[_i];
1312
- var segmentMappings = encodeInteger$1(segment[0] - generatedCodeColumn);
1312
+ var segmentMappings = encodeInteger(segment[0] - generatedCodeColumn);
1313
1313
  generatedCodeColumn = segment[0];
1314
1314
  if (segment.length > 1) {
1315
1315
  segmentMappings +=
1316
- encodeInteger$1(segment[1] - sourceFileIndex) +
1317
- encodeInteger$1(segment[2] - sourceCodeLine) +
1318
- encodeInteger$1(segment[3] - sourceCodeColumn);
1316
+ encodeInteger(segment[1] - sourceFileIndex) +
1317
+ encodeInteger(segment[2] - sourceCodeLine) +
1318
+ encodeInteger(segment[3] - sourceCodeColumn);
1319
1319
  sourceFileIndex = segment[1];
1320
1320
  sourceCodeLine = segment[2];
1321
1321
  sourceCodeColumn = segment[3];
1322
1322
  }
1323
1323
  if (segment.length === 5) {
1324
- segmentMappings += encodeInteger$1(segment[4] - nameIndex);
1324
+ segmentMappings += encodeInteger(segment[4] - nameIndex);
1325
1325
  nameIndex = segment[4];
1326
1326
  }
1327
1327
  lineMappings.push(segmentMappings);
@@ -1330,7 +1330,7 @@ function encode$1(decoded) {
1330
1330
  }
1331
1331
  return mappings;
1332
1332
  }
1333
- function encodeInteger$1(num) {
1333
+ function encodeInteger(num) {
1334
1334
  var result = '';
1335
1335
  num = num < 0 ? (-num << 1) | 1 : num << 1;
1336
1336
  do {
@@ -1339,11 +1339,186 @@ function encodeInteger$1(num) {
1339
1339
  if (num > 0) {
1340
1340
  clamped |= 32;
1341
1341
  }
1342
- result += chars$2[clamped];
1342
+ result += chars$1[clamped];
1343
1343
  } while (num > 0);
1344
1344
  return result;
1345
1345
  }
1346
1346
 
1347
+ // Matches the scheme of a URL, eg "http://"
1348
+ const schemeRegex = /^[\w+.-]+:\/\//;
1349
+ /**
1350
+ * Matches the parts of a URL:
1351
+ * 1. Scheme, including ":", guaranteed.
1352
+ * 2. User/password, including "@", optional.
1353
+ * 3. Host, guaranteed.
1354
+ * 4. Port, including ":", optional.
1355
+ * 5. Path, including "/", optional.
1356
+ */
1357
+ const urlRegex = /^([\w+.-]+:)\/\/([^@]*@)?([^:/]*)(:\d+)?(\/[^#?]*)?/;
1358
+ function isAbsoluteUrl(input) {
1359
+ return schemeRegex.test(input);
1360
+ }
1361
+ function isSchemeRelativeUrl(input) {
1362
+ return input.startsWith('//');
1363
+ }
1364
+ function isAbsolutePath(input) {
1365
+ return input.startsWith('/');
1366
+ }
1367
+ function parseAbsoluteUrl(input) {
1368
+ const match = urlRegex.exec(input);
1369
+ return {
1370
+ scheme: match[1],
1371
+ user: match[2] || '',
1372
+ host: match[3],
1373
+ port: match[4] || '',
1374
+ path: match[5] || '/',
1375
+ relativePath: false,
1376
+ };
1377
+ }
1378
+ function parseUrl$2(input) {
1379
+ if (isSchemeRelativeUrl(input)) {
1380
+ const url = parseAbsoluteUrl('http:' + input);
1381
+ url.scheme = '';
1382
+ return url;
1383
+ }
1384
+ if (isAbsolutePath(input)) {
1385
+ const url = parseAbsoluteUrl('http://foo.com' + input);
1386
+ url.scheme = '';
1387
+ url.host = '';
1388
+ return url;
1389
+ }
1390
+ if (!isAbsoluteUrl(input)) {
1391
+ const url = parseAbsoluteUrl('http://foo.com/' + input);
1392
+ url.scheme = '';
1393
+ url.host = '';
1394
+ url.relativePath = true;
1395
+ return url;
1396
+ }
1397
+ return parseAbsoluteUrl(input);
1398
+ }
1399
+ function stripPathFilename(path) {
1400
+ // If a path ends with a parent directory "..", then it's a relative path with excess parent
1401
+ // paths. It's not a file, so we can't strip it.
1402
+ if (path.endsWith('/..'))
1403
+ return path;
1404
+ const index = path.lastIndexOf('/');
1405
+ return path.slice(0, index + 1);
1406
+ }
1407
+ function mergePaths(url, base) {
1408
+ // If we're not a relative path, then we're an absolute path, and it doesn't matter what base is.
1409
+ if (!url.relativePath)
1410
+ return;
1411
+ normalizePath$5(base);
1412
+ // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative
1413
+ // path).
1414
+ if (url.path === '/') {
1415
+ url.path = base.path;
1416
+ }
1417
+ else {
1418
+ // Resolution happens relative to the base path's directory, not the file.
1419
+ url.path = stripPathFilename(base.path) + url.path;
1420
+ }
1421
+ // If the base path is absolute, then our path is now absolute too.
1422
+ url.relativePath = base.relativePath;
1423
+ }
1424
+ /**
1425
+ * The path can have empty directories "//", unneeded parents "foo/..", or current directory
1426
+ * "foo/.". We need to normalize to a standard representation.
1427
+ */
1428
+ function normalizePath$5(url) {
1429
+ const { relativePath } = url;
1430
+ const pieces = url.path.split('/');
1431
+ // We need to preserve the first piece always, so that we output a leading slash. The item at
1432
+ // pieces[0] is an empty string.
1433
+ let pointer = 1;
1434
+ // Positive is the number of real directories we've output, used for popping a parent directory.
1435
+ // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo".
1436
+ let positive = 0;
1437
+ // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will
1438
+ // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a
1439
+ // real directory, we won't need to append, unless the other conditions happen again.
1440
+ let addTrailingSlash = false;
1441
+ for (let i = 1; i < pieces.length; i++) {
1442
+ const piece = pieces[i];
1443
+ // An empty directory, could be a trailing slash, or just a double "//" in the path.
1444
+ if (!piece) {
1445
+ addTrailingSlash = true;
1446
+ continue;
1447
+ }
1448
+ // If we encounter a real directory, then we don't need to append anymore.
1449
+ addTrailingSlash = false;
1450
+ // A current directory, which we can always drop.
1451
+ if (piece === '.')
1452
+ continue;
1453
+ // A parent directory, we need to see if there are any real directories we can pop. Else, we
1454
+ // have an excess of parents, and we'll need to keep the "..".
1455
+ if (piece === '..') {
1456
+ if (positive) {
1457
+ addTrailingSlash = true;
1458
+ positive--;
1459
+ pointer--;
1460
+ }
1461
+ else if (relativePath) {
1462
+ // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute
1463
+ // URL, protocol relative URL, or an absolute path, we don't need to keep excess.
1464
+ pieces[pointer++] = piece;
1465
+ }
1466
+ continue;
1467
+ }
1468
+ // We've encountered a real directory. Move it to the next insertion pointer, which accounts for
1469
+ // any popped or dropped directories.
1470
+ pieces[pointer++] = piece;
1471
+ positive++;
1472
+ }
1473
+ let path = '';
1474
+ for (let i = 1; i < pointer; i++) {
1475
+ path += '/' + pieces[i];
1476
+ }
1477
+ if (!path || (addTrailingSlash && !path.endsWith('/..'))) {
1478
+ path += '/';
1479
+ }
1480
+ url.path = path;
1481
+ }
1482
+ /**
1483
+ * Attempts to resolve `input` URL/path relative to `base`.
1484
+ */
1485
+ function resolve$3(input, base) {
1486
+ if (!input && !base)
1487
+ return '';
1488
+ const url = parseUrl$2(input);
1489
+ // If we have a base, and the input isn't already an absolute URL, then we need to merge.
1490
+ if (base && !url.scheme) {
1491
+ const baseUrl = parseUrl$2(base);
1492
+ url.scheme = baseUrl.scheme;
1493
+ // If there's no host, then we were just a path.
1494
+ if (!url.host || baseUrl.scheme === 'file:') {
1495
+ // The host, user, and port are joined, you can't copy one without the others.
1496
+ url.user = baseUrl.user;
1497
+ url.host = baseUrl.host;
1498
+ url.port = baseUrl.port;
1499
+ }
1500
+ mergePaths(url, baseUrl);
1501
+ }
1502
+ normalizePath$5(url);
1503
+ // If the input (and base, if there was one) are both relative, then we need to output a relative.
1504
+ if (url.relativePath) {
1505
+ // The first char is always a "/".
1506
+ const path = url.path.slice(1);
1507
+ if (!path)
1508
+ return '.';
1509
+ // If base started with a leading ".", or there is no base and input started with a ".", then we
1510
+ // need to ensure that the relative path starts with a ".". We don't know if relative starts
1511
+ // with a "..", though, so check before prepending.
1512
+ const keepRelative = (base || input).startsWith('.');
1513
+ return !keepRelative || path.startsWith('.') ? path : './' + path;
1514
+ }
1515
+ // If there's no host (and no scheme/user/port), then we need to output an absolute path.
1516
+ if (!url.scheme && !url.host)
1517
+ return url.path;
1518
+ // We're outputting either an absolute URL, or a protocol relative one.
1519
+ return `${url.scheme}//${url.user}${url.host}${url.port}${url.path}`;
1520
+ }
1521
+
1347
1522
  /**
1348
1523
  * Copyright 2019 The AMP HTML Authors. All Rights Reserved.
1349
1524
  *
@@ -1468,150 +1643,6 @@ class OriginalSource {
1468
1643
  }
1469
1644
  }
1470
1645
 
1471
- /* istanbul ignore next */
1472
- const Url$1 = (typeof URL !== 'undefined' ? URL : require('url').URL);
1473
- // Matches "..", which must be preceeded by "/" or the start of the string, and
1474
- // must be followed by a "/". We do not eat the following "/", so that the next
1475
- // iteration can match on it.
1476
- const parentRegex = /(^|\/)\.\.(?=\/|$)/g;
1477
- function isAbsoluteUrl(url) {
1478
- try {
1479
- return !!new Url$1(url);
1480
- }
1481
- catch (e) {
1482
- return false;
1483
- }
1484
- }
1485
- /**
1486
- * Creates a directory name that is guaranteed to not be in `str`.
1487
- */
1488
- function uniqInStr(str) {
1489
- let uniq = String(Math.random()).slice(2);
1490
- while (str.indexOf(uniq) > -1) {
1491
- /* istanbul ignore next */
1492
- uniq += uniq;
1493
- }
1494
- return uniq;
1495
- }
1496
- /**
1497
- * Removes the filename from the path (everything trailing the last "/"). This
1498
- * is only safe to call on a path, never call with an absolute or protocol
1499
- * relative URL.
1500
- */
1501
- function stripPathFilename(path) {
1502
- path = normalizePath$5(path);
1503
- const index = path.lastIndexOf('/');
1504
- return path.slice(0, index + 1);
1505
- }
1506
- /**
1507
- * Normalizes a protocol-relative URL, but keeps it protocol relative by
1508
- * stripping out the protocl before returning it.
1509
- */
1510
- function normalizeProtocolRelative(input, absoluteBase) {
1511
- const { href, protocol } = new Url$1(input, absoluteBase);
1512
- return href.slice(protocol.length);
1513
- }
1514
- /**
1515
- * Normalizes a simple path (one that has no ".."s, or is absolute so ".."s can
1516
- * be normalized absolutely).
1517
- */
1518
- function normalizeSimplePath(input) {
1519
- const { href } = new Url$1(input, 'https://foo.com/');
1520
- return href.slice('https://foo.com/'.length);
1521
- }
1522
- /**
1523
- * Normalizes a path, ensuring that excess ".."s are preserved for relative
1524
- * paths in the output.
1525
- *
1526
- * If the input is absolute, this will return an absolutey normalized path, but
1527
- * it will not have a leading "/".
1528
- *
1529
- * If the input has a leading "..", the output will have a leading "..".
1530
- *
1531
- * If the input has a leading ".", the output will not have a leading "."
1532
- * unless there are too many ".."s, in which case there will be a leading "..".
1533
- */
1534
- function normalizePath$5(input) {
1535
- // If there are no ".."s, we can treat this as if it were an absolute path.
1536
- // The return won't be an absolute path, so it's easy.
1537
- if (!parentRegex.test(input))
1538
- return normalizeSimplePath(input);
1539
- // We already found one "..". Let's see how many there are.
1540
- let total = 1;
1541
- while (parentRegex.test(input))
1542
- total++;
1543
- // If there are ".."s, we need to prefix the the path with the same number of
1544
- // unique directories. This is to ensure that we "remember" how many parent
1545
- // directories we are accessing. Eg, "../../.." must keep 3, and "foo/../.."
1546
- // must keep 1.
1547
- const uniqDirectory = `z${uniqInStr(input)}/`;
1548
- // uniqDirectory is just a "z", followed by numbers, followed by a "/". So
1549
- // generating a runtime regex from it is safe. We'll use this search regex to
1550
- // strip out our uniq directory names and insert any needed ".."s.
1551
- const search = new RegExp(`^(?:${uniqDirectory})*`);
1552
- // Now we can resolve the total path. If there are excess ".."s, they will
1553
- // eliminate one or more of the unique directories we prefix with.
1554
- const relative = normalizeSimplePath(uniqDirectory.repeat(total) + input);
1555
- // We can now count the number of unique directories that were eliminated. If
1556
- // there were 3, and 1 was eliminated, we know we only need to add 1 "..". If
1557
- // 2 were eliminated, we need to insert 2 ".."s. If all 3 were eliminated,
1558
- // then we need 3, etc. This replace is guranteed to match (it may match 0 or
1559
- // more times), and we can count the total match to see how many were eliminated.
1560
- return relative.replace(search, (all) => {
1561
- const leftover = all.length / uniqDirectory.length;
1562
- return '../'.repeat(total - leftover);
1563
- });
1564
- }
1565
- /**
1566
- * Attempts to resolve `input` URL relative to `base`.
1567
- */
1568
- function resolve$2(input, base) {
1569
- if (!base)
1570
- base = '';
1571
- // Absolute URLs are very easy to resolve right.
1572
- if (isAbsoluteUrl(input))
1573
- return new Url$1(input).href;
1574
- if (base) {
1575
- // Absolute URLs are easy...
1576
- if (isAbsoluteUrl(base))
1577
- return new Url$1(input, base).href;
1578
- // If base is protocol relative, we'll resolve with it but keep the result
1579
- // protocol relative.
1580
- if (base.startsWith('//'))
1581
- return normalizeProtocolRelative(input, `https:${base}`);
1582
- }
1583
- // Normalize input, but keep it protocol relative. We know base doesn't supply
1584
- // a protocol, because that would have been handled above.
1585
- if (input.startsWith('//'))
1586
- return normalizeProtocolRelative(input, 'https://foo.com/');
1587
- // We now know that base (if there is one) and input are paths. We've handled
1588
- // both absolute and protocol-relative variations above.
1589
- // Absolute paths don't need any special handling, because they cannot have
1590
- // extra "." or ".."s. That'll all be stripped away. Input takes priority here,
1591
- // because if input is an absolute path, base path won't affect it in any way.
1592
- if (input.startsWith('/'))
1593
- return '/' + normalizeSimplePath(input);
1594
- // Since input and base are paths, we need to join them to do any further
1595
- // processing. Paths are joined at the directory level, so we need to remove
1596
- // the base's filename before joining. We also know that input does not have a
1597
- // leading slash, and that the stripped base will have a trailing slash if
1598
- // there are any directories (or it'll be empty).
1599
- const joined = stripPathFilename(base) + input;
1600
- // If base is an absolute path, then input will be relative to it.
1601
- if (base.startsWith('/'))
1602
- return '/' + normalizeSimplePath(joined);
1603
- // We now know both base (if there is one) and input are relative paths.
1604
- const relative = normalizePath$5(joined);
1605
- // If base started with a leading ".", or there is no base and input started
1606
- // with a ".", then we need to ensure that the relative path starts with a
1607
- // ".". We don't know if relative starts with a "..", though, so check before
1608
- // prepending.
1609
- if ((base || input).startsWith('.') && !relative.startsWith('.')) {
1610
- return './' + relative;
1611
- }
1612
- return relative;
1613
- }
1614
-
1615
1646
  /**
1616
1647
  * Copyright 2019 The AMP HTML Authors. All Rights Reserved.
1617
1648
  *
@@ -1627,13 +1658,13 @@ function resolve$2(input, base) {
1627
1658
  * See the License for the specific language governing permissions and
1628
1659
  * limitations under the License.
1629
1660
  */
1630
- function resolve$1$1(input, base) {
1661
+ function resolve$2(input, base) {
1631
1662
  // The base is always treated as a directory, if it's not empty.
1632
1663
  // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327
1633
1664
  // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401
1634
1665
  if (base && !base.endsWith('/'))
1635
1666
  base += '/';
1636
- return resolve$2(input, base);
1667
+ return resolve$3(input, base);
1637
1668
  }
1638
1669
 
1639
1670
  /**
@@ -1952,7 +1983,7 @@ function buildSourceMapTree(input, loader, relativeRoot) {
1952
1983
  const children = sources.map((sourceFile, i) => {
1953
1984
  // Each source file is loaded relative to the sourcemap's own sourceRoot,
1954
1985
  // which is itself relative to the sourcemap's parent.
1955
- const uri = resolve$1$1(sourceFile || '', resolve$1$1(sourceRoot || '', stripFilename(relativeRoot)));
1986
+ const uri = resolve$2(sourceFile || '', resolve$2(sourceRoot || '', stripFilename(relativeRoot)));
1956
1987
  // Use the provided loader callback to retrieve the file's sourcemap.
1957
1988
  // TODO: We should eventually support async loading of sourcemap files.
1958
1989
  const sourceMap = loader(uri);
@@ -1999,7 +2030,7 @@ class SourceMap$1 {
1999
2030
  this.version = 3; // SourceMap spec says this should be first.
2000
2031
  if ('file' in map)
2001
2032
  this.file = map.file;
2002
- this.mappings = options.decodedMappings ? map.mappings : encode$1(map.mappings);
2033
+ this.mappings = options.decodedMappings ? map.mappings : encode(map.mappings);
2003
2034
  this.names = map.names;
2004
2035
  // TODO: We first need to make all source URIs relative to the sourceRoot
2005
2036
  // before we can support a sourceRoot.
@@ -2059,7 +2090,7 @@ function unwrapId$1(id) {
2059
2090
  return id.startsWith(VALID_ID_PREFIX) ? id.slice(VALID_ID_PREFIX.length) : id;
2060
2091
  }
2061
2092
  const flattenId = (id) => id.replace(/(\s*>\s*)/g, '__').replace(/[\/\.]/g, '_');
2062
- const normalizeId$1 = (id) => id.replace(/(\s*>\s*)/g, ' > ');
2093
+ const normalizeId = (id) => id.replace(/(\s*>\s*)/g, ' > ');
2063
2094
  //TODO: revisit later to see if the edge case that "compiling using node v12 code to be run in node v16 in the server" is what we intend to support.
2064
2095
  const builtins$2 = new Set([
2065
2096
  ...require$$0$6.builtinModules,
@@ -2827,62 +2858,6 @@ function throttle(fn) {
2827
2858
  };
2828
2859
  }
2829
2860
 
2830
- var charToInteger = {};
2831
- var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
2832
- for (var i$2 = 0; i$2 < chars$1.length; i$2++) {
2833
- charToInteger[chars$1.charCodeAt(i$2)] = i$2;
2834
- }
2835
- function encode(decoded) {
2836
- var sourceFileIndex = 0; // second field
2837
- var sourceCodeLine = 0; // third field
2838
- var sourceCodeColumn = 0; // fourth field
2839
- var nameIndex = 0; // fifth field
2840
- var mappings = '';
2841
- for (var i = 0; i < decoded.length; i++) {
2842
- var line = decoded[i];
2843
- if (i > 0)
2844
- mappings += ';';
2845
- if (line.length === 0)
2846
- continue;
2847
- var generatedCodeColumn = 0; // first field
2848
- var lineMappings = [];
2849
- for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
2850
- var segment = line_1[_i];
2851
- var segmentMappings = encodeInteger(segment[0] - generatedCodeColumn);
2852
- generatedCodeColumn = segment[0];
2853
- if (segment.length > 1) {
2854
- segmentMappings +=
2855
- encodeInteger(segment[1] - sourceFileIndex) +
2856
- encodeInteger(segment[2] - sourceCodeLine) +
2857
- encodeInteger(segment[3] - sourceCodeColumn);
2858
- sourceFileIndex = segment[1];
2859
- sourceCodeLine = segment[2];
2860
- sourceCodeColumn = segment[3];
2861
- }
2862
- if (segment.length === 5) {
2863
- segmentMappings += encodeInteger(segment[4] - nameIndex);
2864
- nameIndex = segment[4];
2865
- }
2866
- lineMappings.push(segmentMappings);
2867
- }
2868
- mappings += lineMappings.join(',');
2869
- }
2870
- return mappings;
2871
- }
2872
- function encodeInteger(num) {
2873
- var result = '';
2874
- num = num < 0 ? (-num << 1) | 1 : num << 1;
2875
- do {
2876
- var clamped = num & 31;
2877
- num >>>= 5;
2878
- if (num > 0) {
2879
- clamped |= 32;
2880
- }
2881
- result += chars$1[clamped];
2882
- } while (num > 0);
2883
- return result;
2884
- }
2885
-
2886
2861
  var BitSet = function BitSet(arg) {
2887
2862
  this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
2888
2863
  };
@@ -5363,7 +5338,7 @@ const toRegexRange = toRegexRange_1;
5363
5338
 
5364
5339
  const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
5365
5340
 
5366
- const transform = toNumber => {
5341
+ const transform$1 = toNumber => {
5367
5342
  return value => toNumber === true ? Number(value) : String(value);
5368
5343
  };
5369
5344
 
@@ -5500,7 +5475,7 @@ const fillNumbers = (start, end, step = 1, options = {}) => {
5500
5475
  let padded = zeros(startString) || zeros(endString) || zeros(stepString);
5501
5476
  let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
5502
5477
  let toNumber = padded === false && stringify$7(start, end, options) === false;
5503
- let format = options.transform || transform(toNumber);
5478
+ let format = options.transform || transform$1(toNumber);
5504
5479
 
5505
5480
  if (options.toRegex && step === 1) {
5506
5481
  return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
@@ -5685,7 +5660,7 @@ const append$1 = (queue = '', stash = '', enclose = false) => {
5685
5660
  return utils$g.flatten(result);
5686
5661
  };
5687
5662
 
5688
- const expand$3 = (ast, options = {}) => {
5663
+ const expand$4 = (ast, options = {}) => {
5689
5664
  let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit;
5690
5665
 
5691
5666
  let walk = (node, parent = {}) => {
@@ -5765,7 +5740,7 @@ const expand$3 = (ast, options = {}) => {
5765
5740
  return utils$g.flatten(walk(ast));
5766
5741
  };
5767
5742
 
5768
- var expand_1 = expand$3;
5743
+ var expand_1$1 = expand$4;
5769
5744
 
5770
5745
  var constants$6 = {
5771
5746
  MAX_LENGTH: 1024 * 64,
@@ -6154,7 +6129,7 @@ var parse_1$2 = parse$m;
6154
6129
 
6155
6130
  const stringify$4 = stringify$8;
6156
6131
  const compile = compile_1;
6157
- const expand$2 = expand_1;
6132
+ const expand$3 = expand_1$1;
6158
6133
  const parse$l = parse_1$2;
6159
6134
 
6160
6135
  /**
@@ -6274,7 +6249,7 @@ braces$2.expand = (input, options = {}) => {
6274
6249
  input = braces$2.parse(input, options);
6275
6250
  }
6276
6251
 
6277
- let result = expand$2(input, options);
6252
+ let result = expand$3(input, options);
6278
6253
 
6279
6254
  // filter out empty strings if specified
6280
6255
  if (options.noempty === true) {
@@ -8850,10 +8825,10 @@ const micromatch = micromatch_1;
8850
8825
  const GLOBSTAR$2 = '**';
8851
8826
  const ESCAPE_SYMBOL = '\\';
8852
8827
  const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
8853
- const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[.*]/;
8854
- const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\(.*\|.*\)/;
8855
- const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\(.*\)/;
8856
- const BRACE_EXPANSIONS_SYMBOLS_RE = /{.*(?:,|\.\.).*}/;
8828
+ const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
8829
+ const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
8830
+ const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
8831
+ const BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
8857
8832
  function isStaticPattern(pattern, options = {}) {
8858
8833
  return !isDynamicPattern(pattern, options);
8859
8834
  }
@@ -8880,12 +8855,24 @@ function isDynamicPattern(pattern, options = {}) {
8880
8855
  if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
8881
8856
  return true;
8882
8857
  }
8883
- if (options.braceExpansion !== false && BRACE_EXPANSIONS_SYMBOLS_RE.test(pattern)) {
8858
+ if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
8884
8859
  return true;
8885
8860
  }
8886
8861
  return false;
8887
8862
  }
8888
8863
  pattern$1.isDynamicPattern = isDynamicPattern;
8864
+ function hasBraceExpansion(pattern) {
8865
+ const openingBraceIndex = pattern.indexOf('{');
8866
+ if (openingBraceIndex === -1) {
8867
+ return false;
8868
+ }
8869
+ const closingBraceIndex = pattern.indexOf('}', openingBraceIndex + 1);
8870
+ if (closingBraceIndex === -1) {
8871
+ return false;
8872
+ }
8873
+ const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
8874
+ return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
8875
+ }
8889
8876
  function convertToPositivePattern(pattern) {
8890
8877
  return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
8891
8878
  }
@@ -9272,6 +9259,29 @@ function convertPatternGroupToTask(base, positive, negative, dynamic) {
9272
9259
  }
9273
9260
  tasks.convertPatternGroupToTask = convertPatternGroupToTask;
9274
9261
 
9262
+ var patterns = {};
9263
+
9264
+ Object.defineProperty(patterns, "__esModule", { value: true });
9265
+ patterns.removeDuplicateSlashes = patterns.transform = void 0;
9266
+ /**
9267
+ * Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string.
9268
+ * The latter is due to the presence of the device path at the beginning of the UNC path.
9269
+ * @todo rewrite to negative lookbehind with the next major release.
9270
+ */
9271
+ const DOUBLE_SLASH_RE$1 = /(?!^)\/{2,}/g;
9272
+ function transform(patterns) {
9273
+ return patterns.map((pattern) => removeDuplicateSlashes(pattern));
9274
+ }
9275
+ patterns.transform = transform;
9276
+ /**
9277
+ * This package only works with forward slashes as a path separator.
9278
+ * Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes.
9279
+ */
9280
+ function removeDuplicateSlashes(pattern) {
9281
+ return pattern.replace(DOUBLE_SLASH_RE$1, '/');
9282
+ }
9283
+ patterns.removeDuplicateSlashes = removeDuplicateSlashes;
9284
+
9275
9285
  var async$6 = {};
9276
9286
 
9277
9287
  var stream$2 = {};
@@ -9834,8 +9844,8 @@ function fastqueue (context, worker, concurrency) {
9834
9844
 
9835
9845
  var self = {
9836
9846
  push: push,
9837
- drain: noop$3,
9838
- saturated: noop$3,
9847
+ drain: noop$2,
9848
+ saturated: noop$2,
9839
9849
  pause: pause,
9840
9850
  paused: false,
9841
9851
  concurrency: concurrency,
@@ -9845,7 +9855,7 @@ function fastqueue (context, worker, concurrency) {
9845
9855
  length: length,
9846
9856
  getQueue: getQueue,
9847
9857
  unshift: unshift,
9848
- empty: noop$3,
9858
+ empty: noop$2,
9849
9859
  kill: kill,
9850
9860
  killAndDrain: killAndDrain,
9851
9861
  error: error
@@ -9904,7 +9914,7 @@ function fastqueue (context, worker, concurrency) {
9904
9914
  current.context = context;
9905
9915
  current.release = release;
9906
9916
  current.value = value;
9907
- current.callback = done || noop$3;
9917
+ current.callback = done || noop$2;
9908
9918
  current.errorHandler = errorHandler;
9909
9919
 
9910
9920
  if (_running === self.concurrency || self.paused) {
@@ -9928,7 +9938,7 @@ function fastqueue (context, worker, concurrency) {
9928
9938
  current.context = context;
9929
9939
  current.release = release;
9930
9940
  current.value = value;
9931
- current.callback = done || noop$3;
9941
+ current.callback = done || noop$2;
9932
9942
 
9933
9943
  if (_running === self.concurrency || self.paused) {
9934
9944
  if (queueHead) {
@@ -9972,14 +9982,14 @@ function fastqueue (context, worker, concurrency) {
9972
9982
  function kill () {
9973
9983
  queueHead = null;
9974
9984
  queueTail = null;
9975
- self.drain = noop$3;
9985
+ self.drain = noop$2;
9976
9986
  }
9977
9987
 
9978
9988
  function killAndDrain () {
9979
9989
  queueHead = null;
9980
9990
  queueTail = null;
9981
9991
  self.drain();
9982
- self.drain = noop$3;
9992
+ self.drain = noop$2;
9983
9993
  }
9984
9994
 
9985
9995
  function error (handler) {
@@ -9987,13 +9997,13 @@ function fastqueue (context, worker, concurrency) {
9987
9997
  }
9988
9998
  }
9989
9999
 
9990
- function noop$3 () {}
10000
+ function noop$2 () {}
9991
10001
 
9992
10002
  function Task () {
9993
10003
  this.value = null;
9994
- this.callback = noop$3;
10004
+ this.callback = noop$2;
9995
10005
  this.next = null;
9996
- this.release = noop$3;
10006
+ this.release = noop$2;
9997
10007
  this.context = null;
9998
10008
  this.errorHandler = null;
9999
10009
 
@@ -10004,7 +10014,7 @@ function Task () {
10004
10014
  var errorHandler = self.errorHandler;
10005
10015
  var val = self.value;
10006
10016
  self.value = null;
10007
- self.callback = noop$3;
10017
+ self.callback = noop$2;
10008
10018
  if (self.errorHandler) {
10009
10019
  errorHandler(err, val);
10010
10020
  }
@@ -10052,7 +10062,7 @@ function queueAsPromised (context, worker, concurrency) {
10052
10062
  // Let's fork the promise chain to
10053
10063
  // make the error bubble up to the user but
10054
10064
  // not lead to a unhandledRejection
10055
- p.catch(noop$3);
10065
+ p.catch(noop$2);
10056
10066
 
10057
10067
  return p
10058
10068
  }
@@ -10071,7 +10081,7 @@ function queueAsPromised (context, worker, concurrency) {
10071
10081
  // Let's fork the promise chain to
10072
10082
  // make the error bubble up to the user but
10073
10083
  // not lead to a unhandledRejection
10074
- p.catch(noop$3);
10084
+ p.catch(noop$2);
10075
10085
 
10076
10086
  return p
10077
10087
  }
@@ -10740,9 +10750,13 @@ class EntryFilter {
10740
10750
  const fullpath = utils$3.path.makeAbsolute(this._settings.cwd, entryPath);
10741
10751
  return utils$3.pattern.matchAny(fullpath, patternsRe);
10742
10752
  }
10753
+ /**
10754
+ * First, just trying to apply patterns to the path.
10755
+ * Second, trying to apply patterns to the path with final slash.
10756
+ */
10743
10757
  _isMatchToPatterns(entryPath, patternsRe) {
10744
10758
  const filepath = utils$3.path.removeLeadingDotSegment(entryPath);
10745
- return utils$3.pattern.matchAny(filepath, patternsRe);
10759
+ return utils$3.pattern.matchAny(filepath, patternsRe) || utils$3.pattern.matchAny(filepath + '/', patternsRe);
10746
10760
  }
10747
10761
  }
10748
10762
  entry$1.default = EntryFilter;
@@ -11033,6 +11047,7 @@ exports.default = Settings;
11033
11047
  }(settings));
11034
11048
 
11035
11049
  const taskManager = tasks;
11050
+ const patternManager = patterns;
11036
11051
  const async_1 = async$6;
11037
11052
  const stream_1 = stream;
11038
11053
  const sync_1 = sync$5;
@@ -11066,7 +11081,7 @@ async function FastGlob(source, options) {
11066
11081
  FastGlob.stream = stream;
11067
11082
  function generateTasks(source, options) {
11068
11083
  assertPatternsInput(source);
11069
- const patterns = [].concat(source);
11084
+ const patterns = patternManager.transform([].concat(source));
11070
11085
  const settings = new settings_1.default(options);
11071
11086
  return taskManager.generate(patterns, settings);
11072
11087
  }
@@ -11084,7 +11099,7 @@ async function FastGlob(source, options) {
11084
11099
  FastGlob.escapePath = escapePath;
11085
11100
  })(FastGlob || (FastGlob = {}));
11086
11101
  function getWorks(source, _Provider, options) {
11087
- const patterns = [].concat(source);
11102
+ const patterns = patternManager.transform([].concat(source));
11088
11103
  const settings = new settings_1.default(options);
11089
11104
  const tasks = taskManager.generate(patterns, settings);
11090
11105
  const provider = new _Provider(settings);
@@ -18857,7 +18872,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
18857
18872
  replacer: urlReplacer
18858
18873
  }));
18859
18874
  if (isModule) {
18860
- postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-4ef300ce.js'); }).then(function (n) { return n.index; })).default({
18875
+ postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-752d5fd3.js'); }).then(function (n) { return n.index; })).default({
18861
18876
  ...modulesOptions,
18862
18877
  getJSON(cssFileName, _modules, outputFileName) {
18863
18878
  modules = _modules;
@@ -21280,7 +21295,7 @@ const assetAttrsConfig = {
21280
21295
  const isAsyncScriptMap = new WeakMap();
21281
21296
  async function traverseHtml(html, filePath, visitor) {
21282
21297
  // lazy load compiler
21283
- const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-2451c479.js'); }).then(function (n) { return n.compilerDom_cjs; });
21298
+ const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-9e561a04.js'); }).then(function (n) { return n.compilerDom_cjs; });
21284
21299
  // @vue/compiler-core doesn't like lowercase doctypes
21285
21300
  html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
21286
21301
  try {
@@ -21348,30 +21363,11 @@ function buildHtmlPlugin(config) {
21348
21363
  checkPublicFile(url, config);
21349
21364
  // Same reason with `htmlInlineProxyPlugin`
21350
21365
  isAsyncScriptMap.set(config, new Map());
21351
- const inputFiles = new Set();
21352
21366
  return {
21353
21367
  name: 'vite:build-html',
21354
- buildStart({ input }) {
21355
- isAsyncScriptMap.set(config, new Map());
21356
- let allInputs;
21357
- if (typeof input === 'string') {
21358
- allInputs = [input];
21359
- }
21360
- else if (Array.isArray(input)) {
21361
- allInputs = input;
21362
- }
21363
- else {
21364
- allInputs = Object.values(input);
21365
- }
21366
- for (const filename of allInputs) {
21367
- if (filename.endsWith('.html')) {
21368
- inputFiles.add(normalizePath$4(filename));
21369
- }
21370
- }
21371
- },
21372
21368
  async transform(html, id) {
21373
21369
  var _a, _b;
21374
- if (inputFiles.has(id)) {
21370
+ if (id.endsWith('.html')) {
21375
21371
  const publicPath = `/${slash$1(path__default.relative(config.root, id))}`;
21376
21372
  // pre-transform
21377
21373
  html = await applyHtmlTransforms(html, preHooks, {
@@ -22018,14 +22014,13 @@ function stripBom(string) {
22018
22014
  }
22019
22015
  var POSIX_SEP_RE = new RegExp("\\" + path__default.posix.sep, "g");
22020
22016
  var NATIVE_SEP_RE = new RegExp("\\" + path__default.sep, "g");
22021
- var PATTERN_REGEX_CACHE = new Map();
22017
+ var PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
22022
22018
  var GLOB_ALL_PATTERN = `**/*`;
22023
22019
  var DEFAULT_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
22024
22020
  var DEFAULT_EXTENSIONS_RE_GROUP = `\\.(?:${DEFAULT_EXTENSIONS.map((ext) => ext.substring(1)).join("|")})`;
22025
22021
  new Function("path", "return import(path).then(m => m.default)");
22026
22022
  async function resolveTSConfig(filename) {
22027
- const basename = path__default.basename(filename);
22028
- if (basename !== "tsconfig.json") {
22023
+ if (path__default.extname(filename) !== ".json") {
22029
22024
  return;
22030
22025
  }
22031
22026
  const tsconfig = path__default.resolve(filename);
@@ -23687,7 +23682,7 @@ function expandTop(str) {
23687
23682
  str = '\\{\\}' + str.substr(2);
23688
23683
  }
23689
23684
 
23690
- return expand$1(escapeBraces(str), true).map(unescapeBraces);
23685
+ return expand$2(escapeBraces(str), true).map(unescapeBraces);
23691
23686
  }
23692
23687
 
23693
23688
  function embrace(str) {
@@ -23704,7 +23699,7 @@ function gte(i, y) {
23704
23699
  return i >= y;
23705
23700
  }
23706
23701
 
23707
- function expand$1(str, isTop) {
23702
+ function expand$2(str, isTop) {
23708
23703
  var expansions = [];
23709
23704
 
23710
23705
  var m = balanced('{', '}', str);
@@ -23718,7 +23713,7 @@ function expand$1(str, isTop) {
23718
23713
  // {a},b}
23719
23714
  if (m.post.match(/,.*\}/)) {
23720
23715
  str = m.pre + '{' + m.body + escClose + m.post;
23721
- return expand$1(str);
23716
+ return expand$2(str);
23722
23717
  }
23723
23718
  return [str];
23724
23719
  }
@@ -23730,10 +23725,10 @@ function expand$1(str, isTop) {
23730
23725
  n = parseCommaParts(m.body);
23731
23726
  if (n.length === 1) {
23732
23727
  // x{{a,b}}y ==> x{a}y x{b}y
23733
- n = expand$1(n[0], false).map(embrace);
23728
+ n = expand$2(n[0], false).map(embrace);
23734
23729
  if (n.length === 1) {
23735
23730
  var post = m.post.length
23736
- ? expand$1(m.post, false)
23731
+ ? expand$2(m.post, false)
23737
23732
  : [''];
23738
23733
  return post.map(function(p) {
23739
23734
  return m.pre + n[0] + p;
@@ -23748,7 +23743,7 @@ function expand$1(str, isTop) {
23748
23743
  // no need to expand pre, since it is guaranteed to be free of brace-sets
23749
23744
  var pre = m.pre;
23750
23745
  var post = m.post.length
23751
- ? expand$1(m.post, false)
23746
+ ? expand$2(m.post, false)
23752
23747
  : [''];
23753
23748
 
23754
23749
  var N;
@@ -23792,7 +23787,7 @@ function expand$1(str, isTop) {
23792
23787
  N.push(c);
23793
23788
  }
23794
23789
  } else {
23795
- N = concatMap(n, function(el) { return expand$1(el, false) });
23790
+ N = concatMap(n, function(el) { return expand$2(el, false) });
23796
23791
  }
23797
23792
 
23798
23793
  for (var j = 0; j < N.length; j++) {
@@ -23815,7 +23810,7 @@ try {
23815
23810
  } catch (er) {}
23816
23811
 
23817
23812
  var GLOBSTAR$1 = minimatch$3.GLOBSTAR = Minimatch$1.GLOBSTAR = {};
23818
- var expand = braceExpansion;
23813
+ var expand$1 = braceExpansion;
23819
23814
 
23820
23815
  var plTypes = {
23821
23816
  '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
@@ -24060,7 +24055,7 @@ function braceExpand (pattern, options) {
24060
24055
  return [pattern]
24061
24056
  }
24062
24057
 
24063
- return expand(pattern)
24058
+ return expand$1(pattern)
24064
24059
  }
24065
24060
 
24066
24061
  // parse a component of the expanded set.
@@ -27681,7 +27676,7 @@ function getRequireStringArg(node) {
27681
27676
  function hasDynamicModuleForPath(source, id, dynamicRequireModuleSet) {
27682
27677
  if (!/^(?:\.{0,2}[/\\]|[A-Za-z]:[/\\])/.test(source)) {
27683
27678
  try {
27684
- const resolvedPath = normalizePathSlashes(resolve$3.sync(source, { basedir: path$r.dirname(id) }));
27679
+ const resolvedPath = normalizePathSlashes(resolve$4.sync(source, { basedir: path$r.dirname(id) }));
27685
27680
  if (dynamicRequireModuleSet.has(resolvedPath)) {
27686
27681
  return true;
27687
27682
  }
@@ -29532,10 +29527,6 @@ function resolveExports(pkg, key, options, targetWeb) {
29532
29527
  });
29533
29528
  }
29534
29529
  function resolveDeepImport(id, { webResolvedImports, setResolvedCache, getResolvedCache, dir, data }, targetWeb, options) {
29535
- // id might contain ?query
29536
- // e.g. when using `<style src="some-pkg/dist/style.css"></style>` in .vue file
29537
- // the id will be ./dist/style.css?vue&type=style&index=0&src=xxx&lang.css
29538
- id = id.split('?')[0];
29539
29530
  const cache = getResolvedCache(id, targetWeb);
29540
29531
  if (cache) {
29541
29532
  return cache;
@@ -43254,7 +43245,15 @@ async _handleSymlink(entry, directory, path, item) {
43254
43245
  if (!this.fsw.options.followSymlinks) {
43255
43246
  // watch symlink directly (don't follow) and detect changes
43256
43247
  this.fsw._incrReadyCount();
43257
- const linkPath = await fsrealpath(path);
43248
+
43249
+ let linkPath;
43250
+ try {
43251
+ linkPath = await fsrealpath(path);
43252
+ } catch (e) {
43253
+ this.fsw._emitReady();
43254
+ return true;
43255
+ }
43256
+
43258
43257
  if (this.fsw.closed) return;
43259
43258
  if (dir.has(item)) {
43260
43259
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
@@ -45037,7 +45036,7 @@ async function getCertificate(cacheDir) {
45037
45036
  return content;
45038
45037
  }
45039
45038
  catch {
45040
- const content = (await Promise.resolve().then(function () { return require('./dep-778bed46.js'); })).createCertificate();
45039
+ const content = (await Promise.resolve().then(function () { return require('./dep-6a30742f.js'); })).createCertificate();
45041
45040
  fs$n.promises
45042
45041
  .mkdir(cacheDir, { recursive: true })
45043
45042
  .then(() => fs$n.promises.writeFile(cachePath, content))
@@ -45577,7 +45576,7 @@ class PerMessageDeflate$4 {
45577
45576
  /**
45578
45577
  * Compress data. Concurrency limited.
45579
45578
  *
45580
- * @param {Buffer} data Data to compress
45579
+ * @param {(Buffer|String)} data Data to compress
45581
45580
  * @param {Boolean} fin Specifies whether or not this is the last fragment
45582
45581
  * @param {Function} callback Callback
45583
45582
  * @public
@@ -45659,7 +45658,7 @@ class PerMessageDeflate$4 {
45659
45658
  /**
45660
45659
  * Compress data.
45661
45660
  *
45662
- * @param {Buffer} data Data to compress
45661
+ * @param {(Buffer|String)} data Data to compress
45663
45662
  * @param {Boolean} fin Specifies whether or not this is the last fragment
45664
45663
  * @param {Function} callback Callback
45665
45664
  * @private
@@ -46524,6 +46523,7 @@ const { EMPTY_BUFFER: EMPTY_BUFFER$1 } = constants;
46524
46523
  const { isValidStatusCode } = validation.exports;
46525
46524
  const { mask: applyMask, toBuffer: toBuffer$2 } = bufferUtil$1.exports;
46526
46525
 
46526
+ const kByteLength = Symbol('kByteLength');
46527
46527
  const maskBuffer = Buffer.alloc(4);
46528
46528
 
46529
46529
  /**
@@ -46559,7 +46559,7 @@ class Sender$1 {
46559
46559
  /**
46560
46560
  * Frames a piece of data according to the HyBi WebSocket protocol.
46561
46561
  *
46562
- * @param {Buffer} data The data to frame
46562
+ * @param {(Buffer|String)} data The data to frame
46563
46563
  * @param {Object} options Options object
46564
46564
  * @param {Boolean} [options.fin=false] Specifies whether or not to set the
46565
46565
  * FIN bit
@@ -46574,7 +46574,7 @@ class Sender$1 {
46574
46574
  * modified
46575
46575
  * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
46576
46576
  * RSV1 bit
46577
- * @return {Buffer[]} The framed data as a list of `Buffer` instances
46577
+ * @return {(Buffer|String)[]} The framed data
46578
46578
  * @public
46579
46579
  */
46580
46580
  static frame(data, options) {
@@ -46593,22 +46593,37 @@ class Sender$1 {
46593
46593
  }
46594
46594
 
46595
46595
  skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;
46596
- if (options.readOnly && !skipMasking) merge = true;
46597
-
46598
46596
  offset = 6;
46599
46597
  }
46600
46598
 
46601
- let payloadLength = data.length;
46599
+ let dataLength;
46602
46600
 
46603
- if (data.length >= 65536) {
46601
+ if (typeof data === 'string') {
46602
+ if (
46603
+ (!options.mask || skipMasking) &&
46604
+ options[kByteLength] !== undefined
46605
+ ) {
46606
+ dataLength = options[kByteLength];
46607
+ } else {
46608
+ data = Buffer.from(data);
46609
+ dataLength = data.length;
46610
+ }
46611
+ } else {
46612
+ dataLength = data.length;
46613
+ merge = options.mask && options.readOnly && !skipMasking;
46614
+ }
46615
+
46616
+ let payloadLength = dataLength;
46617
+
46618
+ if (dataLength >= 65536) {
46604
46619
  offset += 8;
46605
46620
  payloadLength = 127;
46606
- } else if (data.length > 125) {
46621
+ } else if (dataLength > 125) {
46607
46622
  offset += 2;
46608
46623
  payloadLength = 126;
46609
46624
  }
46610
46625
 
46611
- const target = Buffer.allocUnsafe(merge ? data.length + offset : offset);
46626
+ const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset);
46612
46627
 
46613
46628
  target[0] = options.fin ? options.opcode | 0x80 : options.opcode;
46614
46629
  if (options.rsv1) target[0] |= 0x40;
@@ -46616,10 +46631,10 @@ class Sender$1 {
46616
46631
  target[1] = payloadLength;
46617
46632
 
46618
46633
  if (payloadLength === 126) {
46619
- target.writeUInt16BE(data.length, 2);
46634
+ target.writeUInt16BE(dataLength, 2);
46620
46635
  } else if (payloadLength === 127) {
46621
46636
  target[2] = target[3] = 0;
46622
- target.writeUIntBE(data.length, 4, 6);
46637
+ target.writeUIntBE(dataLength, 4, 6);
46623
46638
  }
46624
46639
 
46625
46640
  if (!options.mask) return [target, data];
@@ -46633,11 +46648,11 @@ class Sender$1 {
46633
46648
  if (skipMasking) return [target, data];
46634
46649
 
46635
46650
  if (merge) {
46636
- applyMask(data, mask, target, offset, data.length);
46651
+ applyMask(data, mask, target, offset, dataLength);
46637
46652
  return [target];
46638
46653
  }
46639
46654
 
46640
- applyMask(data, mask, data, 0, data.length);
46655
+ applyMask(data, mask, data, 0, dataLength);
46641
46656
  return [target, data];
46642
46657
  }
46643
46658
 
@@ -46677,36 +46692,24 @@ class Sender$1 {
46677
46692
  }
46678
46693
  }
46679
46694
 
46695
+ const options = {
46696
+ [kByteLength]: buf.length,
46697
+ fin: true,
46698
+ generateMask: this._generateMask,
46699
+ mask,
46700
+ maskBuffer: this._maskBuffer,
46701
+ opcode: 0x08,
46702
+ readOnly: false,
46703
+ rsv1: false
46704
+ };
46705
+
46680
46706
  if (this._deflating) {
46681
- this.enqueue([this.doClose, buf, mask, cb]);
46707
+ this.enqueue([this.dispatch, buf, false, options, cb]);
46682
46708
  } else {
46683
- this.doClose(buf, mask, cb);
46709
+ this.sendFrame(Sender$1.frame(buf, options), cb);
46684
46710
  }
46685
46711
  }
46686
46712
 
46687
- /**
46688
- * Frames and sends a close message.
46689
- *
46690
- * @param {Buffer} data The message to send
46691
- * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
46692
- * @param {Function} [cb] Callback
46693
- * @private
46694
- */
46695
- doClose(data, mask, cb) {
46696
- this.sendFrame(
46697
- Sender$1.frame(data, {
46698
- fin: true,
46699
- rsv1: false,
46700
- opcode: 0x08,
46701
- mask,
46702
- maskBuffer: this._maskBuffer,
46703
- generateMask: this._generateMask,
46704
- readOnly: false
46705
- }),
46706
- cb
46707
- );
46708
- }
46709
-
46710
46713
  /**
46711
46714
  * Sends a ping message to the other peer.
46712
46715
  *
@@ -46716,43 +46719,40 @@ class Sender$1 {
46716
46719
  * @public
46717
46720
  */
46718
46721
  ping(data, mask, cb) {
46719
- const buf = toBuffer$2(data);
46722
+ let byteLength;
46723
+ let readOnly;
46724
+
46725
+ if (typeof data === 'string') {
46726
+ byteLength = Buffer.byteLength(data);
46727
+ readOnly = false;
46728
+ } else {
46729
+ data = toBuffer$2(data);
46730
+ byteLength = data.length;
46731
+ readOnly = toBuffer$2.readOnly;
46732
+ }
46720
46733
 
46721
- if (buf.length > 125) {
46734
+ if (byteLength > 125) {
46722
46735
  throw new RangeError('The data size must not be greater than 125 bytes');
46723
46736
  }
46724
46737
 
46738
+ const options = {
46739
+ [kByteLength]: byteLength,
46740
+ fin: true,
46741
+ generateMask: this._generateMask,
46742
+ mask,
46743
+ maskBuffer: this._maskBuffer,
46744
+ opcode: 0x09,
46745
+ readOnly,
46746
+ rsv1: false
46747
+ };
46748
+
46725
46749
  if (this._deflating) {
46726
- this.enqueue([this.doPing, buf, mask, toBuffer$2.readOnly, cb]);
46750
+ this.enqueue([this.dispatch, data, false, options, cb]);
46727
46751
  } else {
46728
- this.doPing(buf, mask, toBuffer$2.readOnly, cb);
46752
+ this.sendFrame(Sender$1.frame(data, options), cb);
46729
46753
  }
46730
46754
  }
46731
46755
 
46732
- /**
46733
- * Frames and sends a ping message.
46734
- *
46735
- * @param {Buffer} data The message to send
46736
- * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
46737
- * @param {Boolean} [readOnly=false] Specifies whether `data` can be modified
46738
- * @param {Function} [cb] Callback
46739
- * @private
46740
- */
46741
- doPing(data, mask, readOnly, cb) {
46742
- this.sendFrame(
46743
- Sender$1.frame(data, {
46744
- fin: true,
46745
- rsv1: false,
46746
- opcode: 0x09,
46747
- mask,
46748
- maskBuffer: this._maskBuffer,
46749
- generateMask: this._generateMask,
46750
- readOnly
46751
- }),
46752
- cb
46753
- );
46754
- }
46755
-
46756
46756
  /**
46757
46757
  * Sends a pong message to the other peer.
46758
46758
  *
@@ -46762,43 +46762,40 @@ class Sender$1 {
46762
46762
  * @public
46763
46763
  */
46764
46764
  pong(data, mask, cb) {
46765
- const buf = toBuffer$2(data);
46765
+ let byteLength;
46766
+ let readOnly;
46766
46767
 
46767
- if (buf.length > 125) {
46768
+ if (typeof data === 'string') {
46769
+ byteLength = Buffer.byteLength(data);
46770
+ readOnly = false;
46771
+ } else {
46772
+ data = toBuffer$2(data);
46773
+ byteLength = data.length;
46774
+ readOnly = toBuffer$2.readOnly;
46775
+ }
46776
+
46777
+ if (byteLength > 125) {
46768
46778
  throw new RangeError('The data size must not be greater than 125 bytes');
46769
46779
  }
46770
46780
 
46781
+ const options = {
46782
+ [kByteLength]: byteLength,
46783
+ fin: true,
46784
+ generateMask: this._generateMask,
46785
+ mask,
46786
+ maskBuffer: this._maskBuffer,
46787
+ opcode: 0x0a,
46788
+ readOnly,
46789
+ rsv1: false
46790
+ };
46791
+
46771
46792
  if (this._deflating) {
46772
- this.enqueue([this.doPong, buf, mask, toBuffer$2.readOnly, cb]);
46793
+ this.enqueue([this.dispatch, data, false, options, cb]);
46773
46794
  } else {
46774
- this.doPong(buf, mask, toBuffer$2.readOnly, cb);
46795
+ this.sendFrame(Sender$1.frame(data, options), cb);
46775
46796
  }
46776
46797
  }
46777
46798
 
46778
- /**
46779
- * Frames and sends a pong message.
46780
- *
46781
- * @param {Buffer} data The message to send
46782
- * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
46783
- * @param {Boolean} [readOnly=false] Specifies whether `data` can be modified
46784
- * @param {Function} [cb] Callback
46785
- * @private
46786
- */
46787
- doPong(data, mask, readOnly, cb) {
46788
- this.sendFrame(
46789
- Sender$1.frame(data, {
46790
- fin: true,
46791
- rsv1: false,
46792
- opcode: 0x0a,
46793
- mask,
46794
- maskBuffer: this._maskBuffer,
46795
- generateMask: this._generateMask,
46796
- readOnly
46797
- }),
46798
- cb
46799
- );
46800
- }
46801
-
46802
46799
  /**
46803
46800
  * Sends a data message to the other peer.
46804
46801
  *
@@ -46816,11 +46813,22 @@ class Sender$1 {
46816
46813
  * @public
46817
46814
  */
46818
46815
  send(data, options, cb) {
46819
- const buf = toBuffer$2(data);
46820
46816
  const perMessageDeflate = this._extensions[PerMessageDeflate$2.extensionName];
46821
46817
  let opcode = options.binary ? 2 : 1;
46822
46818
  let rsv1 = options.compress;
46823
46819
 
46820
+ let byteLength;
46821
+ let readOnly;
46822
+
46823
+ if (typeof data === 'string') {
46824
+ byteLength = Buffer.byteLength(data);
46825
+ readOnly = false;
46826
+ } else {
46827
+ data = toBuffer$2(data);
46828
+ byteLength = data.length;
46829
+ readOnly = toBuffer$2.readOnly;
46830
+ }
46831
+
46824
46832
  if (this._firstFragment) {
46825
46833
  this._firstFragment = false;
46826
46834
  if (
@@ -46832,7 +46840,7 @@ class Sender$1 {
46832
46840
  : 'client_no_context_takeover'
46833
46841
  ]
46834
46842
  ) {
46835
- rsv1 = buf.length >= perMessageDeflate._threshold;
46843
+ rsv1 = byteLength >= perMessageDeflate._threshold;
46836
46844
  }
46837
46845
  this._compress = rsv1;
46838
46846
  } else {
@@ -46844,30 +46852,32 @@ class Sender$1 {
46844
46852
 
46845
46853
  if (perMessageDeflate) {
46846
46854
  const opts = {
46855
+ [kByteLength]: byteLength,
46847
46856
  fin: options.fin,
46848
- rsv1,
46849
- opcode,
46857
+ generateMask: this._generateMask,
46850
46858
  mask: options.mask,
46851
46859
  maskBuffer: this._maskBuffer,
46852
- generateMask: this._generateMask,
46853
- readOnly: toBuffer$2.readOnly
46860
+ opcode,
46861
+ readOnly,
46862
+ rsv1
46854
46863
  };
46855
46864
 
46856
46865
  if (this._deflating) {
46857
- this.enqueue([this.dispatch, buf, this._compress, opts, cb]);
46866
+ this.enqueue([this.dispatch, data, this._compress, opts, cb]);
46858
46867
  } else {
46859
- this.dispatch(buf, this._compress, opts, cb);
46868
+ this.dispatch(data, this._compress, opts, cb);
46860
46869
  }
46861
46870
  } else {
46862
46871
  this.sendFrame(
46863
- Sender$1.frame(buf, {
46872
+ Sender$1.frame(data, {
46873
+ [kByteLength]: byteLength,
46864
46874
  fin: options.fin,
46865
- rsv1: false,
46866
- opcode,
46875
+ generateMask: this._generateMask,
46867
46876
  mask: options.mask,
46868
46877
  maskBuffer: this._maskBuffer,
46869
- generateMask: this._generateMask,
46870
- readOnly: toBuffer$2.readOnly
46878
+ opcode,
46879
+ readOnly,
46880
+ rsv1: false
46871
46881
  }),
46872
46882
  cb
46873
46883
  );
@@ -46875,13 +46885,12 @@ class Sender$1 {
46875
46885
  }
46876
46886
 
46877
46887
  /**
46878
- * Dispatches a data message.
46888
+ * Dispatches a message.
46879
46889
  *
46880
- * @param {Buffer} data The message to send
46890
+ * @param {(Buffer|String)} data The message to send
46881
46891
  * @param {Boolean} [compress=false] Specifies whether or not to compress
46882
46892
  * `data`
46883
46893
  * @param {Object} options Options object
46884
- * @param {Number} options.opcode The opcode
46885
46894
  * @param {Boolean} [options.fin=false] Specifies whether or not to set the
46886
46895
  * FIN bit
46887
46896
  * @param {Function} [options.generateMask] The function used to generate the
@@ -46890,6 +46899,7 @@ class Sender$1 {
46890
46899
  * `data`
46891
46900
  * @param {Buffer} [options.maskBuffer] The buffer used to store the masking
46892
46901
  * key
46902
+ * @param {Number} options.opcode The opcode
46893
46903
  * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
46894
46904
  * modified
46895
46905
  * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
@@ -46905,7 +46915,7 @@ class Sender$1 {
46905
46915
 
46906
46916
  const perMessageDeflate = this._extensions[PerMessageDeflate$2.extensionName];
46907
46917
 
46908
- this._bufferedBytes += data.length;
46918
+ this._bufferedBytes += options[kByteLength];
46909
46919
  this._deflating = true;
46910
46920
  perMessageDeflate.compress(data, options.fin, (_, buf) => {
46911
46921
  if (this._socket.destroyed) {
@@ -46916,7 +46926,8 @@ class Sender$1 {
46916
46926
  if (typeof cb === 'function') cb(err);
46917
46927
 
46918
46928
  for (let i = 0; i < this._queue.length; i++) {
46919
- const callback = this._queue[i][4];
46929
+ const params = this._queue[i];
46930
+ const callback = params[params.length - 1];
46920
46931
 
46921
46932
  if (typeof callback === 'function') callback(err);
46922
46933
  }
@@ -46924,7 +46935,7 @@ class Sender$1 {
46924
46935
  return;
46925
46936
  }
46926
46937
 
46927
- this._bufferedBytes -= data.length;
46938
+ this._bufferedBytes -= options[kByteLength];
46928
46939
  this._deflating = false;
46929
46940
  options.readOnly = false;
46930
46941
  this.sendFrame(Sender$1.frame(buf, options), cb);
@@ -46941,7 +46952,7 @@ class Sender$1 {
46941
46952
  while (!this._deflating && this._queue.length) {
46942
46953
  const params = this._queue.shift();
46943
46954
 
46944
- this._bufferedBytes -= params[1].length;
46955
+ this._bufferedBytes -= params[3][kByteLength];
46945
46956
  Reflect.apply(params[0], this, params.slice(1));
46946
46957
  }
46947
46958
  }
@@ -46953,7 +46964,7 @@ class Sender$1 {
46953
46964
  * @private
46954
46965
  */
46955
46966
  enqueue(params) {
46956
- this._bufferedBytes += params[1].length;
46967
+ this._bufferedBytes += params[3][kByteLength];
46957
46968
  this._queue.push(params);
46958
46969
  }
46959
46970
 
@@ -47453,7 +47464,7 @@ const http$3 = require$$1__default$2;
47453
47464
  const net = require$$3__default;
47454
47465
  const tls = require$$4__default;
47455
47466
  const { randomBytes, createHash: createHash$1 } = require$$1__default$3;
47456
- const { URL: URL$2 } = require$$0__default$5;
47467
+ const { URL: URL$1 } = require$$0__default$5;
47457
47468
 
47458
47469
  const PerMessageDeflate$1 = permessageDeflate;
47459
47470
  const Receiver = receiver;
@@ -48106,12 +48117,12 @@ function initAsClient(websocket, address, protocols, options) {
48106
48117
 
48107
48118
  let parsedUrl;
48108
48119
 
48109
- if (address instanceof URL$2) {
48120
+ if (address instanceof URL$1) {
48110
48121
  parsedUrl = address;
48111
48122
  websocket._url = address.href;
48112
48123
  } else {
48113
48124
  try {
48114
- parsedUrl = new URL$2(address);
48125
+ parsedUrl = new URL$1(address);
48115
48126
  } catch (e) {
48116
48127
  throw new SyntaxError(`Invalid URL: ${address}`);
48117
48128
  }
@@ -48245,7 +48256,7 @@ function initAsClient(websocket, address, protocols, options) {
48245
48256
  let addr;
48246
48257
 
48247
48258
  try {
48248
- addr = new URL$2(location, address);
48259
+ addr = new URL$1(location, address);
48249
48260
  } catch (e) {
48250
48261
  const err = new SyntaxError(`Invalid URL: ${location}`);
48251
48262
  emitErrorAndClose(websocket, err);
@@ -50155,7 +50166,7 @@ var debug_1 = function () {
50155
50166
  };
50156
50167
 
50157
50168
  var url$1 = require$$0__default$5;
50158
- var URL$1 = url$1.URL;
50169
+ var URL = url$1.URL;
50159
50170
  var http$1 = require$$1__default$2;
50160
50171
  var https$1 = require$$1__default$4;
50161
50172
  var Writable = require$$0__default$2.Writable;
@@ -50606,14 +50617,14 @@ function wrap(protocols) {
50606
50617
  if (typeof input === "string") {
50607
50618
  var urlStr = input;
50608
50619
  try {
50609
- input = urlToOptions(new URL$1(urlStr));
50620
+ input = urlToOptions(new URL(urlStr));
50610
50621
  }
50611
50622
  catch (err) {
50612
50623
  /* istanbul ignore next */
50613
50624
  input = url$1.parse(urlStr);
50614
50625
  }
50615
50626
  }
50616
- else if (URL$1 && (input instanceof URL$1)) {
50627
+ else if (URL && (input instanceof URL)) {
50617
50628
  input = urlToOptions(input);
50618
50629
  }
50619
50630
  else {
@@ -50655,7 +50666,7 @@ function wrap(protocols) {
50655
50666
  }
50656
50667
 
50657
50668
  /* istanbul ignore next */
50658
- function noop$2() { /* empty */ }
50669
+ function noop$1() { /* empty */ }
50659
50670
 
50660
50671
  // from https://github.com/nodejs/node/blob/master/lib/internal/url.js
50661
50672
  function urlToOptions(urlObject) {
@@ -50711,7 +50722,7 @@ function abortRequest(request) {
50711
50722
  for (var e = 0; e < events.length; e++) {
50712
50723
  request.removeListener(events[e], eventHandlers[events[e]]);
50713
50724
  }
50714
- request.on("error", noop$2);
50725
+ request.on("error", noop$1);
50715
50726
  request.abort();
50716
50727
  }
50717
50728
 
@@ -52171,7 +52182,7 @@ async function ssrTransform(code, inMap, url) {
52171
52182
  // let binding used in a property shorthand
52172
52183
  // { foo } -> { foo: __import_x__.foo }
52173
52184
  // skip for destructuring patterns
52174
- if (!parent.inPattern ||
52185
+ if (!isNodeInPatternWeakMap.get(parent) ||
52175
52186
  isInDestructuringAssignment(parent, parentStack)) {
52176
52187
  s.appendLeft(id.end, `: ${binding}`);
52177
52188
  }
@@ -52222,6 +52233,7 @@ async function ssrTransform(code, inMap, url) {
52222
52233
  dynamicDeps: [...dynamicDeps]
52223
52234
  };
52224
52235
  }
52236
+ const isNodeInPatternWeakMap = new WeakMap();
52225
52237
  /**
52226
52238
  * Same logic from \@vue/compiler-core & \@vue/compiler-sfc
52227
52239
  * Except this is using acorn AST
@@ -52335,7 +52347,8 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport }) {
52335
52347
  });
52336
52348
  }
52337
52349
  else if (node.type === 'Property' && parent.type === 'ObjectPattern') {
52338
- node.inPattern = true;
52350
+ // mark property in destructuring pattern
52351
+ isNodeInPatternWeakMap.set(node, true);
52339
52352
  }
52340
52353
  else if (node.type === 'VariableDeclarator') {
52341
52354
  const parentFunction = findParentFunction(parentStack);
@@ -52379,7 +52392,7 @@ function isRefIdentifier(id, parent, parentStack) {
52379
52392
  }
52380
52393
  // property key
52381
52394
  // this also covers object destructuring pattern
52382
- if (isStaticPropertyKey(id, parent) || parent.inPattern) {
52395
+ if (isStaticPropertyKey(id, parent) || isNodeInPatternWeakMap.get(parent)) {
52383
52396
  return false;
52384
52397
  }
52385
52398
  // non-assignment array destructuring pattern
@@ -52508,7 +52521,7 @@ function parse$5(req) {
52508
52521
  return req._parsedUrl = { pathname, search, query, raw };
52509
52522
  }
52510
52523
 
52511
- const noop$1 = () => {};
52524
+ const noop = () => {};
52512
52525
 
52513
52526
  function isMatch(uri, arr) {
52514
52527
  for (let i=0; i < arr.length; i++) {
@@ -52619,7 +52632,7 @@ function sirv (dir, opts={}) {
52619
52632
  dir = path$r.resolve(dir || '.');
52620
52633
 
52621
52634
  let isNotFound = opts.onNoMatch || is404;
52622
- let setHeaders = opts.setHeaders || noop$1;
52635
+ let setHeaders = opts.setHeaders || noop;
52623
52636
 
52624
52637
  let extensions = opts.extensions || ['html', 'htm'];
52625
52638
  let gzips = opts.gzip && extensions.map(x => `${x}.gz`).concat('gz');
@@ -55690,7 +55703,7 @@ ssr) {
55690
55703
  for (const id of include) {
55691
55704
  // normalize 'foo >bar` as 'foo > bar' to prevent same id being added
55692
55705
  // and for pretty printing
55693
- const normalizedId = normalizeId$1(id);
55706
+ const normalizedId = normalizeId(id);
55694
55707
  if (!deps[normalizedId]) {
55695
55708
  const entry = await resolve(id);
55696
55709
  if (entry) {
@@ -56138,8 +56151,11 @@ async function nodeImport(id, importer, resolveOptions) {
56138
56151
  // When an ESM module imports an ESM dependency, this hook is *not* used.
56139
56152
  const unhookNodeResolve = hookNodeResolve((nodeResolve) => (id, parent, isMain, options) => {
56140
56153
  // Use the Vite resolver only for bare imports while skipping
56141
- // any built-in modules and binary modules.
56142
- if (!bareImportRE.test(id) || isBuiltin(id) || id.endsWith('.node')) {
56154
+ // any absolute paths, built-in modules and binary modules.
56155
+ if (!bareImportRE.test(id) ||
56156
+ path__default.isAbsolute(id) ||
56157
+ isBuiltin(id) ||
56158
+ id.endsWith('.node')) {
56143
56159
  return nodeResolve(id, parent, isMain, options);
56144
56160
  }
56145
56161
  if (parent) {
@@ -69474,7 +69490,6 @@ async function preview(inlineConfig) {
69474
69490
  };
69475
69491
  }
69476
69492
 
69477
- const noop = () => null;
69478
69493
  function matches(pattern, importee) {
69479
69494
  if (pattern instanceof RegExp) {
69480
69495
  return pattern.test(importee);
@@ -69485,36 +69500,35 @@ function matches(pattern, importee) {
69485
69500
  if (importee === pattern) {
69486
69501
  return true;
69487
69502
  }
69488
- const importeeStartsWithKey = importee.indexOf(pattern) === 0;
69489
- const importeeHasSlashAfterKey = importee.substring(pattern.length)[0] === '/';
69490
- return importeeStartsWithKey && importeeHasSlashAfterKey;
69503
+ // eslint-disable-next-line prefer-template
69504
+ return importee.startsWith(pattern + '/');
69491
69505
  }
69492
- function normalizeId(id) {
69493
- return id;
69494
- }
69495
- function getEntries({ entries }) {
69506
+ function getEntries({ entries, customResolver }) {
69496
69507
  if (!entries) {
69497
69508
  return [];
69498
69509
  }
69510
+ const resolverFunctionFromOptions = resolveCustomResolver(customResolver);
69499
69511
  if (Array.isArray(entries)) {
69500
- return entries;
69512
+ return entries.map((entry) => {
69513
+ return {
69514
+ find: entry.find,
69515
+ replacement: entry.replacement,
69516
+ resolverFunction: resolveCustomResolver(entry.customResolver) || resolverFunctionFromOptions
69517
+ };
69518
+ });
69501
69519
  }
69502
69520
  return Object.entries(entries).map(([key, value]) => {
69503
- return { find: key, replacement: value };
69521
+ return { find: key, replacement: value, resolverFunction: resolverFunctionFromOptions };
69504
69522
  });
69505
69523
  }
69506
- function getCustomResolver({ customResolver }, options) {
69507
- if (typeof customResolver === 'function') {
69508
- return customResolver;
69509
- }
69510
- if (customResolver && typeof customResolver.resolveId === 'function') {
69511
- return customResolver.resolveId;
69512
- }
69513
- if (typeof options.customResolver === 'function') {
69514
- return options.customResolver;
69515
- }
69516
- if (options.customResolver && typeof options.customResolver.resolveId === 'function') {
69517
- return options.customResolver.resolveId;
69524
+ function resolveCustomResolver(customResolver) {
69525
+ if (customResolver) {
69526
+ if (typeof customResolver === 'function') {
69527
+ return customResolver;
69528
+ }
69529
+ if (typeof customResolver.resolveId === 'function') {
69530
+ return customResolver.resolveId;
69531
+ }
69518
69532
  }
69519
69533
  return null;
69520
69534
  }
@@ -69523,39 +69537,31 @@ function alias(options = {}) {
69523
69537
  if (entries.length === 0) {
69524
69538
  return {
69525
69539
  name: 'alias',
69526
- resolveId: noop
69540
+ resolveId: () => null
69527
69541
  };
69528
69542
  }
69529
69543
  return {
69530
69544
  name: 'alias',
69531
- buildStart(inputOptions) {
69532
- return Promise.all([...entries, options].map(({ customResolver }) => customResolver &&
69545
+ async buildStart(inputOptions) {
69546
+ await Promise.all([...(Array.isArray(options.entries) ? options.entries : []), options].map(({ customResolver }) => customResolver &&
69533
69547
  typeof customResolver === 'object' &&
69534
69548
  typeof customResolver.buildStart === 'function' &&
69535
- customResolver.buildStart.call(this, inputOptions))).then(() => {
69536
- // enforce void return value
69537
- });
69549
+ customResolver.buildStart.call(this, inputOptions)));
69538
69550
  },
69539
69551
  resolveId(importee, importer, resolveOptions) {
69540
- const importeeId = normalizeId(importee);
69541
- const importerId = normalizeId(importer);
69552
+ if (!importer) {
69553
+ return null;
69554
+ }
69542
69555
  // First match is supposed to be the correct one
69543
- const matchedEntry = entries.find((entry) => matches(entry.find, importeeId));
69544
- if (!matchedEntry || !importerId) {
69556
+ const matchedEntry = entries.find((entry) => matches(entry.find, importee));
69557
+ if (!matchedEntry) {
69545
69558
  return null;
69546
69559
  }
69547
- const updatedId = normalizeId(importeeId.replace(matchedEntry.find, matchedEntry.replacement));
69548
- const customResolver = getCustomResolver(matchedEntry, options);
69549
- if (customResolver) {
69550
- return customResolver.call(this, updatedId, importerId, resolveOptions);
69560
+ const updatedId = importee.replace(matchedEntry.find, matchedEntry.replacement);
69561
+ if (matchedEntry.resolverFunction) {
69562
+ return matchedEntry.resolverFunction.call(this, updatedId, importer, resolveOptions);
69551
69563
  }
69552
- return this.resolve(updatedId, importer, Object.assign({ skipSelf: true }, resolveOptions)).then((resolved) => {
69553
- let finalResult = resolved;
69554
- if (!finalResult) {
69555
- finalResult = { id: updatedId };
69556
- }
69557
- return finalResult;
69558
- });
69564
+ return this.resolve(updatedId, importer, Object.assign({ skipSelf: true }, resolveOptions)).then((resolved) => resolved || { id: updatedId });
69559
69565
  }
69560
69566
  };
69561
69567
  }
@@ -70559,7 +70565,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
70559
70565
  ].filter(Boolean);
70560
70566
  }
70561
70567
 
70562
- var main$1 = {exports: {}};
70568
+ var main = {exports: {}};
70563
70569
 
70564
70570
  const fs = fs__default;
70565
70571
  const path = path__default;
@@ -70700,56 +70706,70 @@ const DotenvModule = {
70700
70706
  parse
70701
70707
  };
70702
70708
 
70703
- main$1.exports.config = DotenvModule.config;
70704
- main$1.exports.parse = DotenvModule.parse;
70705
- main$1.exports = DotenvModule;
70709
+ main.exports.config = DotenvModule.config;
70710
+ main.exports.parse = DotenvModule.parse;
70711
+ main.exports = DotenvModule;
70706
70712
 
70707
- var dotenv = main$1.exports;
70713
+ var dotenv = main.exports;
70708
70714
 
70709
- var dotenvExpand = function (config) {
70710
- // if ignoring process.env, use a blank object
70711
- var environment = config.ignoreProcessEnv ? {} : process.env;
70712
-
70713
- var interpolate = function (envValue) {
70714
- var matches = envValue.match(/(.?\${?(?:[a-zA-Z0-9_]+)?}?)/g) || [];
70715
+ function _interpolate (envValue, environment, config) {
70716
+ const matches = envValue.match(/(.?\${*[\w]*(?::-)?[\w]*}*)/g) || [];
70715
70717
 
70716
- return matches.reduce(function (newEnv, match) {
70717
- var parts = /(.?)\${?([a-zA-Z0-9_]+)?}?/g.exec(match);
70718
- var prefix = parts[1];
70718
+ return matches.reduce(function (newEnv, match, index) {
70719
+ const parts = /(.?)\${*([\w]*(?::-)?[\w]*)?}*/g.exec(match);
70720
+ if (!parts || parts.length === 0) {
70721
+ return newEnv
70722
+ }
70719
70723
 
70720
- var value, replacePart;
70724
+ const prefix = parts[1];
70721
70725
 
70722
- if (prefix === '\\') {
70723
- replacePart = parts[0];
70724
- value = replacePart.replace('\\$', '$');
70725
- } else {
70726
- var key = parts[2];
70727
- replacePart = parts[0].substring(prefix.length);
70728
- // process.env value 'wins' over .env file's value
70729
- value = environment.hasOwnProperty(key) ? environment[key] : (config.parsed[key] || '');
70726
+ let value, replacePart;
70730
70727
 
70731
- // Resolve recursive interpolations
70732
- value = interpolate(value);
70728
+ if (prefix === '\\') {
70729
+ replacePart = parts[0];
70730
+ value = replacePart.replace('\\$', '$');
70731
+ } else {
70732
+ const keyParts = parts[2].split(':-');
70733
+ const key = keyParts[0];
70734
+ replacePart = parts[0].substring(prefix.length);
70735
+ // process.env value 'wins' over .env file's value
70736
+ value = Object.prototype.hasOwnProperty.call(environment, key)
70737
+ ? environment[key]
70738
+ : (config.parsed[key] || keyParts[1] || '');
70739
+
70740
+ // If the value is found, remove nested expansions.
70741
+ if (keyParts.length > 1 && value) {
70742
+ const replaceNested = matches[index + 1];
70743
+ matches[index + 1] = '';
70744
+
70745
+ newEnv = newEnv.replace(replaceNested, '');
70733
70746
  }
70747
+ // Resolve recursive interpolations
70748
+ value = _interpolate(value, environment, config);
70749
+ }
70734
70750
 
70735
- return newEnv.replace(replacePart, value)
70736
- }, envValue)
70737
- };
70751
+ return newEnv.replace(replacePart, value)
70752
+ }, envValue)
70753
+ }
70738
70754
 
70739
- for (var configKey in config.parsed) {
70740
- var value = environment.hasOwnProperty(configKey) ? environment[configKey] : config.parsed[configKey];
70755
+ function expand (config) {
70756
+ // if ignoring process.env, use a blank object
70757
+ const environment = config.ignoreProcessEnv ? {} : process.env;
70758
+
70759
+ for (const configKey in config.parsed) {
70760
+ const value = Object.prototype.hasOwnProperty.call(environment, configKey) ? environment[configKey] : config.parsed[configKey];
70741
70761
 
70742
- config.parsed[configKey] = interpolate(value);
70762
+ config.parsed[configKey] = _interpolate(value, environment, config);
70743
70763
  }
70744
70764
 
70745
- for (var processKey in config.parsed) {
70765
+ for (const processKey in config.parsed) {
70746
70766
  environment[processKey] = config.parsed[processKey];
70747
70767
  }
70748
70768
 
70749
70769
  return config
70750
- };
70770
+ }
70751
70771
 
70752
- var main = dotenvExpand;
70772
+ var expand_1 = expand;
70753
70773
 
70754
70774
  const debug = createDebugger('vite:config');
70755
70775
  /**
@@ -71363,7 +71383,7 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
71363
71383
  debug: ((_a = process.env.DEBUG) === null || _a === void 0 ? void 0 : _a.includes('vite:dotenv')) || undefined
71364
71384
  });
71365
71385
  // let environment variables use each other
71366
- main({
71386
+ expand_1({
71367
71387
  parsed,
71368
71388
  // prevent process.env mutation
71369
71389
  ignoreProcessEnv: true