vite 2.8.0-beta.3 → 2.8.0-beta.7

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
  };
@@ -5358,12 +5333,12 @@ var toRegexRange_1 = toRegexRange$1;
5358
5333
  * Licensed under the MIT License.
5359
5334
  */
5360
5335
 
5361
- const util$9 = require$$0__default$1;
5336
+ const util$6 = require$$0__default$1;
5362
5337
  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
 
@@ -5463,7 +5438,7 @@ const toRegex = (start, end, options) => {
5463
5438
  };
5464
5439
 
5465
5440
  const rangeError = (...args) => {
5466
- return new RangeError('Invalid range arguments: ' + util$9.inspect(...args));
5441
+ return new RangeError('Invalid range arguments: ' + util$6.inspect(...args));
5467
5442
  };
5468
5443
 
5469
5444
  const invalidRange = (start, end, options) => {
@@ -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) {
@@ -8376,7 +8351,7 @@ var picomatch_1 = picomatch$4;
8376
8351
 
8377
8352
  var picomatch$3 = picomatch_1;
8378
8353
 
8379
- const util$8 = require$$0__default$1;
8354
+ const util$5 = require$$0__default$1;
8380
8355
  const braces$1 = braces_1;
8381
8356
  const picomatch$2 = picomatch$3;
8382
8357
  const utils$b = utils$f;
@@ -8563,7 +8538,7 @@ micromatch$1.not = (list, patterns, options = {}) => {
8563
8538
 
8564
8539
  micromatch$1.contains = (str, pattern, options) => {
8565
8540
  if (typeof str !== 'string') {
8566
- throw new TypeError(`Expected a string: "${util$8.inspect(str)}"`);
8541
+ throw new TypeError(`Expected a string: "${util$5.inspect(str)}"`);
8567
8542
  }
8568
8543
 
8569
8544
  if (Array.isArray(pattern)) {
@@ -8709,7 +8684,7 @@ micromatch$1.every = (list, patterns, options) => {
8709
8684
 
8710
8685
  micromatch$1.all = (str, patterns, options) => {
8711
8686
  if (typeof str !== 'string') {
8712
- throw new TypeError(`Expected a string: "${util$8.inspect(str)}"`);
8687
+ throw new TypeError(`Expected a string: "${util$5.inspect(str)}"`);
8713
8688
  }
8714
8689
 
8715
8690
  return [].concat(patterns).every(p => picomatch$2(p, options)(str));
@@ -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);
@@ -18679,6 +18694,10 @@ function cssPostPlugin(config) {
18679
18694
  return null;
18680
18695
  },
18681
18696
  async generateBundle(opts, bundle) {
18697
+ // @ts-ignore asset emits are skipped in legacy bundle
18698
+ if (opts.__vite_skip_asset_emit__) {
18699
+ return;
18700
+ }
18682
18701
  // remove empty css chunks and their imports
18683
18702
  if (pureCssChunks.size) {
18684
18703
  const emptyChunkFiles = [...pureCssChunks]
@@ -18853,7 +18872,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
18853
18872
  replacer: urlReplacer
18854
18873
  }));
18855
18874
  if (isModule) {
18856
- postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-84e12b4e.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({
18857
18876
  ...modulesOptions,
18858
18877
  getJSON(cssFileName, _modules, outputFileName) {
18859
18878
  modules = _modules;
@@ -19313,7 +19332,7 @@ var unicode = {
19313
19332
  ID_Continue: ID_Continue
19314
19333
  };
19315
19334
 
19316
- var util$7 = {
19335
+ var util$4 = {
19317
19336
  isSpaceSeparator (c) {
19318
19337
  return typeof c === 'string' && unicode.Space_Separator.test(c)
19319
19338
  },
@@ -19480,7 +19499,7 @@ const lexStates = {
19480
19499
  return newToken('eof')
19481
19500
  }
19482
19501
 
19483
- if (util$7.isSpaceSeparator(c)) {
19502
+ if (util$4.isSpaceSeparator(c)) {
19484
19503
  read();
19485
19504
  return
19486
19505
  }
@@ -19647,7 +19666,7 @@ const lexStates = {
19647
19666
  break
19648
19667
 
19649
19668
  default:
19650
- if (!util$7.isIdStartChar(u)) {
19669
+ if (!util$4.isIdStartChar(u)) {
19651
19670
  throw invalidIdentifier()
19652
19671
  }
19653
19672
 
@@ -19673,7 +19692,7 @@ const lexStates = {
19673
19692
  return
19674
19693
  }
19675
19694
 
19676
- if (util$7.isIdContinueChar(c)) {
19695
+ if (util$4.isIdContinueChar(c)) {
19677
19696
  buffer += read();
19678
19697
  return
19679
19698
  }
@@ -19696,7 +19715,7 @@ const lexStates = {
19696
19715
  break
19697
19716
 
19698
19717
  default:
19699
- if (!util$7.isIdContinueChar(u)) {
19718
+ if (!util$4.isIdContinueChar(u)) {
19700
19719
  throw invalidIdentifier()
19701
19720
  }
19702
19721
 
@@ -19783,7 +19802,7 @@ const lexStates = {
19783
19802
  return
19784
19803
  }
19785
19804
 
19786
- if (util$7.isDigit(c)) {
19805
+ if (util$4.isDigit(c)) {
19787
19806
  buffer += read();
19788
19807
  return
19789
19808
  }
@@ -19792,7 +19811,7 @@ const lexStates = {
19792
19811
  },
19793
19812
 
19794
19813
  decimalPointLeading () {
19795
- if (util$7.isDigit(c)) {
19814
+ if (util$4.isDigit(c)) {
19796
19815
  buffer += read();
19797
19816
  lexState = 'decimalFraction';
19798
19817
  return
@@ -19810,7 +19829,7 @@ const lexStates = {
19810
19829
  return
19811
19830
  }
19812
19831
 
19813
- if (util$7.isDigit(c)) {
19832
+ if (util$4.isDigit(c)) {
19814
19833
  buffer += read();
19815
19834
  lexState = 'decimalFraction';
19816
19835
  return
@@ -19828,7 +19847,7 @@ const lexStates = {
19828
19847
  return
19829
19848
  }
19830
19849
 
19831
- if (util$7.isDigit(c)) {
19850
+ if (util$4.isDigit(c)) {
19832
19851
  buffer += read();
19833
19852
  return
19834
19853
  }
@@ -19845,7 +19864,7 @@ const lexStates = {
19845
19864
  return
19846
19865
  }
19847
19866
 
19848
- if (util$7.isDigit(c)) {
19867
+ if (util$4.isDigit(c)) {
19849
19868
  buffer += read();
19850
19869
  lexState = 'decimalExponentInteger';
19851
19870
  return
@@ -19855,7 +19874,7 @@ const lexStates = {
19855
19874
  },
19856
19875
 
19857
19876
  decimalExponentSign () {
19858
- if (util$7.isDigit(c)) {
19877
+ if (util$4.isDigit(c)) {
19859
19878
  buffer += read();
19860
19879
  lexState = 'decimalExponentInteger';
19861
19880
  return
@@ -19865,7 +19884,7 @@ const lexStates = {
19865
19884
  },
19866
19885
 
19867
19886
  decimalExponentInteger () {
19868
- if (util$7.isDigit(c)) {
19887
+ if (util$4.isDigit(c)) {
19869
19888
  buffer += read();
19870
19889
  return
19871
19890
  }
@@ -19874,7 +19893,7 @@ const lexStates = {
19874
19893
  },
19875
19894
 
19876
19895
  hexadecimal () {
19877
- if (util$7.isHexDigit(c)) {
19896
+ if (util$4.isHexDigit(c)) {
19878
19897
  buffer += read();
19879
19898
  lexState = 'hexadecimalInteger';
19880
19899
  return
@@ -19884,7 +19903,7 @@ const lexStates = {
19884
19903
  },
19885
19904
 
19886
19905
  hexadecimalInteger () {
19887
- if (util$7.isHexDigit(c)) {
19906
+ if (util$4.isHexDigit(c)) {
19888
19907
  buffer += read();
19889
19908
  return
19890
19909
  }
@@ -19970,7 +19989,7 @@ const lexStates = {
19970
19989
  return
19971
19990
  }
19972
19991
 
19973
- if (util$7.isIdStartChar(c)) {
19992
+ if (util$4.isIdStartChar(c)) {
19974
19993
  buffer += read();
19975
19994
  lexState = 'identifierName';
19976
19995
  return
@@ -20080,7 +20099,7 @@ function escape$1 () {
20080
20099
 
20081
20100
  case '0':
20082
20101
  read();
20083
- if (util$7.isDigit(peek())) {
20102
+ if (util$4.isDigit(peek())) {
20084
20103
  throw invalidChar(read())
20085
20104
  }
20086
20105
 
@@ -20130,14 +20149,14 @@ function hexEscape () {
20130
20149
  let buffer = '';
20131
20150
  let c = peek();
20132
20151
 
20133
- if (!util$7.isHexDigit(c)) {
20152
+ if (!util$4.isHexDigit(c)) {
20134
20153
  throw invalidChar(read())
20135
20154
  }
20136
20155
 
20137
20156
  buffer += read();
20138
20157
 
20139
20158
  c = peek();
20140
- if (!util$7.isHexDigit(c)) {
20159
+ if (!util$4.isHexDigit(c)) {
20141
20160
  throw invalidChar(read())
20142
20161
  }
20143
20162
 
@@ -20152,7 +20171,7 @@ function unicodeEscape () {
20152
20171
 
20153
20172
  while (count-- > 0) {
20154
20173
  const c = peek();
20155
- if (!util$7.isHexDigit(c)) {
20174
+ if (!util$4.isHexDigit(c)) {
20156
20175
  throw invalidChar(read())
20157
20176
  }
20158
20177
 
@@ -20567,7 +20586,7 @@ var stringify = function stringify (value, replacer, space) {
20567
20586
  continue
20568
20587
 
20569
20588
  case '\0':
20570
- if (util$7.isDigit(value[i + 1])) {
20589
+ if (util$4.isDigit(value[i + 1])) {
20571
20590
  product += '\\x00';
20572
20591
  continue
20573
20592
  }
@@ -20644,12 +20663,12 @@ var stringify = function stringify (value, replacer, space) {
20644
20663
  }
20645
20664
 
20646
20665
  const firstChar = String.fromCodePoint(key.codePointAt(0));
20647
- if (!util$7.isIdStartChar(firstChar)) {
20666
+ if (!util$4.isIdStartChar(firstChar)) {
20648
20667
  return quoteString(key)
20649
20668
  }
20650
20669
 
20651
20670
  for (let i = firstChar.length; i < key.length; i++) {
20652
- if (!util$7.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
20671
+ if (!util$4.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
20653
20672
  return quoteString(key)
20654
20673
  }
20655
20674
  }
@@ -21276,7 +21295,7 @@ const assetAttrsConfig = {
21276
21295
  const isAsyncScriptMap = new WeakMap();
21277
21296
  async function traverseHtml(html, filePath, visitor) {
21278
21297
  // lazy load compiler
21279
- const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-6f0b746c.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; });
21280
21299
  // @vue/compiler-core doesn't like lowercase doctypes
21281
21300
  html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
21282
21301
  try {
@@ -21344,30 +21363,11 @@ function buildHtmlPlugin(config) {
21344
21363
  checkPublicFile(url, config);
21345
21364
  // Same reason with `htmlInlineProxyPlugin`
21346
21365
  isAsyncScriptMap.set(config, new Map());
21347
- const inputFiles = new Set();
21348
21366
  return {
21349
21367
  name: 'vite:build-html',
21350
- buildStart({ input }) {
21351
- isAsyncScriptMap.set(config, new Map());
21352
- let allInputs;
21353
- if (typeof input === 'string') {
21354
- allInputs = [input];
21355
- }
21356
- else if (Array.isArray(input)) {
21357
- allInputs = input;
21358
- }
21359
- else {
21360
- allInputs = Object.values(input);
21361
- }
21362
- for (const filename of allInputs) {
21363
- if (filename.endsWith('.html')) {
21364
- inputFiles.add(normalizePath$4(filename));
21365
- }
21366
- }
21367
- },
21368
21368
  async transform(html, id) {
21369
21369
  var _a, _b;
21370
- if (inputFiles.has(id)) {
21370
+ if (id.endsWith('.html')) {
21371
21371
  const publicPath = `/${slash$1(path__default.relative(config.root, id))}`;
21372
21372
  // pre-transform
21373
21373
  html = await applyHtmlTransforms(html, preHooks, {
@@ -22014,14 +22014,13 @@ function stripBom(string) {
22014
22014
  }
22015
22015
  var POSIX_SEP_RE = new RegExp("\\" + path__default.posix.sep, "g");
22016
22016
  var NATIVE_SEP_RE = new RegExp("\\" + path__default.sep, "g");
22017
- var PATTERN_REGEX_CACHE = new Map();
22017
+ var PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
22018
22018
  var GLOB_ALL_PATTERN = `**/*`;
22019
22019
  var DEFAULT_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
22020
22020
  var DEFAULT_EXTENSIONS_RE_GROUP = `\\.(?:${DEFAULT_EXTENSIONS.map((ext) => ext.substring(1)).join("|")})`;
22021
22021
  new Function("path", "return import(path).then(m => m.default)");
22022
22022
  async function resolveTSConfig(filename) {
22023
- const basename = path__default.basename(filename);
22024
- if (basename !== "tsconfig.json") {
22023
+ if (path__default.extname(filename) !== ".json") {
22025
22024
  return;
22026
22025
  }
22027
22026
  const tsconfig = path__default.resolve(filename);
@@ -22484,7 +22483,7 @@ const buildEsbuildPlugin = (config) => {
22484
22483
  const minify = config.build.minify === 'esbuild' &&
22485
22484
  // Do not minify ES lib output since that would remove pure annotations
22486
22485
  // and break tree-shaking
22487
- // https://github.com/vuejs/vue-next/issues/2860#issuecomment-926882793
22486
+ // https://github.com/vuejs/core/issues/2860#issuecomment-926882793
22488
22487
  !(config.build.lib && opts.format === 'es');
22489
22488
  if ((!target || target === 'esnext') && !minify) {
22490
22489
  return null;
@@ -23683,7 +23682,7 @@ function expandTop(str) {
23683
23682
  str = '\\{\\}' + str.substr(2);
23684
23683
  }
23685
23684
 
23686
- return expand$1(escapeBraces(str), true).map(unescapeBraces);
23685
+ return expand$2(escapeBraces(str), true).map(unescapeBraces);
23687
23686
  }
23688
23687
 
23689
23688
  function embrace(str) {
@@ -23700,7 +23699,7 @@ function gte(i, y) {
23700
23699
  return i >= y;
23701
23700
  }
23702
23701
 
23703
- function expand$1(str, isTop) {
23702
+ function expand$2(str, isTop) {
23704
23703
  var expansions = [];
23705
23704
 
23706
23705
  var m = balanced('{', '}', str);
@@ -23714,7 +23713,7 @@ function expand$1(str, isTop) {
23714
23713
  // {a},b}
23715
23714
  if (m.post.match(/,.*\}/)) {
23716
23715
  str = m.pre + '{' + m.body + escClose + m.post;
23717
- return expand$1(str);
23716
+ return expand$2(str);
23718
23717
  }
23719
23718
  return [str];
23720
23719
  }
@@ -23726,10 +23725,10 @@ function expand$1(str, isTop) {
23726
23725
  n = parseCommaParts(m.body);
23727
23726
  if (n.length === 1) {
23728
23727
  // x{{a,b}}y ==> x{a}y x{b}y
23729
- n = expand$1(n[0], false).map(embrace);
23728
+ n = expand$2(n[0], false).map(embrace);
23730
23729
  if (n.length === 1) {
23731
23730
  var post = m.post.length
23732
- ? expand$1(m.post, false)
23731
+ ? expand$2(m.post, false)
23733
23732
  : [''];
23734
23733
  return post.map(function(p) {
23735
23734
  return m.pre + n[0] + p;
@@ -23744,7 +23743,7 @@ function expand$1(str, isTop) {
23744
23743
  // no need to expand pre, since it is guaranteed to be free of brace-sets
23745
23744
  var pre = m.pre;
23746
23745
  var post = m.post.length
23747
- ? expand$1(m.post, false)
23746
+ ? expand$2(m.post, false)
23748
23747
  : [''];
23749
23748
 
23750
23749
  var N;
@@ -23788,7 +23787,7 @@ function expand$1(str, isTop) {
23788
23787
  N.push(c);
23789
23788
  }
23790
23789
  } else {
23791
- N = concatMap(n, function(el) { return expand$1(el, false) });
23790
+ N = concatMap(n, function(el) { return expand$2(el, false) });
23792
23791
  }
23793
23792
 
23794
23793
  for (var j = 0; j < N.length; j++) {
@@ -23811,7 +23810,7 @@ try {
23811
23810
  } catch (er) {}
23812
23811
 
23813
23812
  var GLOBSTAR$1 = minimatch$3.GLOBSTAR = Minimatch$1.GLOBSTAR = {};
23814
- var expand = braceExpansion;
23813
+ var expand$1 = braceExpansion;
23815
23814
 
23816
23815
  var plTypes = {
23817
23816
  '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
@@ -24056,7 +24055,7 @@ function braceExpand (pattern, options) {
24056
24055
  return [pattern]
24057
24056
  }
24058
24057
 
24059
- return expand(pattern)
24058
+ return expand$1(pattern)
24060
24059
  }
24061
24060
 
24062
24061
  // parse a component of the expanded set.
@@ -24758,10 +24757,10 @@ if (typeof Object.create === 'function') {
24758
24757
  }
24759
24758
 
24760
24759
  try {
24761
- var util$6 = require('util');
24760
+ var util$3 = require('util');
24762
24761
  /* istanbul ignore next */
24763
- if (typeof util$6.inherits !== 'function') throw '';
24764
- inherits$1.exports = util$6.inherits;
24762
+ if (typeof util$3.inherits !== 'function') throw '';
24763
+ inherits$1.exports = util$3.inherits;
24765
24764
  } catch (e) {
24766
24765
  /* istanbul ignore next */
24767
24766
  inherits$1.exports = inherits_browser.exports;
@@ -27677,7 +27676,7 @@ function getRequireStringArg(node) {
27677
27676
  function hasDynamicModuleForPath(source, id, dynamicRequireModuleSet) {
27678
27677
  if (!/^(?:\.{0,2}[/\\]|[A-Za-z]:[/\\])/.test(source)) {
27679
27678
  try {
27680
- 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) }));
27681
27680
  if (dynamicRequireModuleSet.has(resolvedPath)) {
27682
27681
  return true;
27683
27682
  }
@@ -29528,10 +29527,6 @@ function resolveExports(pkg, key, options, targetWeb) {
29528
29527
  });
29529
29528
  }
29530
29529
  function resolveDeepImport(id, { webResolvedImports, setResolvedCache, getResolvedCache, dir, data }, targetWeb, options) {
29531
- // id might contain ?query
29532
- // e.g. when using `<style src="some-pkg/dist/style.css"></style>` in .vue file
29533
- // the id will be ./dist/style.css?vue&type=style&index=0&src=xxx&lang.css
29534
- id = id.split('?')[0];
29535
29530
  const cache = getResolvedCache(id, targetWeb);
29536
29531
  if (cache) {
29537
29532
  return cache;
@@ -35563,224 +35558,7 @@ function errorMiddleware(server, allowNext = false) {
35563
35558
  };
35564
35559
  }
35565
35560
 
35566
- var sourceMapGenerator = {};
35567
-
35568
- var base64Vlq = {};
35569
-
35570
- var base64$1 = {};
35571
-
35572
- /* -*- Mode: js; js-indent-level: 2; -*- */
35573
-
35574
- /*
35575
- * Copyright 2011 Mozilla Foundation and contributors
35576
- * Licensed under the New BSD license. See LICENSE or:
35577
- * http://opensource.org/licenses/BSD-3-Clause
35578
- */
35579
-
35580
- var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
35581
-
35582
- /**
35583
- * Encode an integer in the range of 0 to 63 to a single base 64 digit.
35584
- */
35585
- base64$1.encode = function (number) {
35586
- if (0 <= number && number < intToCharMap.length) {
35587
- return intToCharMap[number];
35588
- }
35589
- throw new TypeError("Must be between 0 and 63: " + number);
35590
- };
35591
-
35592
- /**
35593
- * Decode a single base 64 character code digit to an integer. Returns -1 on
35594
- * failure.
35595
- */
35596
- base64$1.decode = function (charCode) {
35597
- var bigA = 65; // 'A'
35598
- var bigZ = 90; // 'Z'
35599
-
35600
- var littleA = 97; // 'a'
35601
- var littleZ = 122; // 'z'
35602
-
35603
- var zero = 48; // '0'
35604
- var nine = 57; // '9'
35605
-
35606
- var plus = 43; // '+'
35607
- var slash = 47; // '/'
35608
-
35609
- var littleOffset = 26;
35610
- var numberOffset = 52;
35611
-
35612
- // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
35613
- if (bigA <= charCode && charCode <= bigZ) {
35614
- return (charCode - bigA);
35615
- }
35616
-
35617
- // 26 - 51: abcdefghijklmnopqrstuvwxyz
35618
- if (littleA <= charCode && charCode <= littleZ) {
35619
- return (charCode - littleA + littleOffset);
35620
- }
35621
-
35622
- // 52 - 61: 0123456789
35623
- if (zero <= charCode && charCode <= nine) {
35624
- return (charCode - zero + numberOffset);
35625
- }
35626
-
35627
- // 62: +
35628
- if (charCode == plus) {
35629
- return 62;
35630
- }
35631
-
35632
- // 63: /
35633
- if (charCode == slash) {
35634
- return 63;
35635
- }
35636
-
35637
- // Invalid base64 digit.
35638
- return -1;
35639
- };
35640
-
35641
- /* -*- Mode: js; js-indent-level: 2; -*- */
35642
-
35643
- /*
35644
- * Copyright 2011 Mozilla Foundation and contributors
35645
- * Licensed under the New BSD license. See LICENSE or:
35646
- * http://opensource.org/licenses/BSD-3-Clause
35647
- *
35648
- * Based on the Base 64 VLQ implementation in Closure Compiler:
35649
- * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
35650
- *
35651
- * Copyright 2011 The Closure Compiler Authors. All rights reserved.
35652
- * Redistribution and use in source and binary forms, with or without
35653
- * modification, are permitted provided that the following conditions are
35654
- * met:
35655
- *
35656
- * * Redistributions of source code must retain the above copyright
35657
- * notice, this list of conditions and the following disclaimer.
35658
- * * Redistributions in binary form must reproduce the above
35659
- * copyright notice, this list of conditions and the following
35660
- * disclaimer in the documentation and/or other materials provided
35661
- * with the distribution.
35662
- * * Neither the name of Google Inc. nor the names of its
35663
- * contributors may be used to endorse or promote products derived
35664
- * from this software without specific prior written permission.
35665
- *
35666
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
35667
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
35668
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35669
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35670
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35671
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35672
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35673
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35674
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35675
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35676
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35677
- */
35678
-
35679
- var base64 = base64$1;
35680
-
35681
- // A single base 64 digit can contain 6 bits of data. For the base 64 variable
35682
- // length quantities we use in the source map spec, the first bit is the sign,
35683
- // the next four bits are the actual value, and the 6th bit is the
35684
- // continuation bit. The continuation bit tells us whether there are more
35685
- // digits in this value following this digit.
35686
- //
35687
- // Continuation
35688
- // | Sign
35689
- // | |
35690
- // V V
35691
- // 101011
35692
-
35693
- var VLQ_BASE_SHIFT = 5;
35694
-
35695
- // binary: 100000
35696
- var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
35697
-
35698
- // binary: 011111
35699
- var VLQ_BASE_MASK = VLQ_BASE - 1;
35700
-
35701
- // binary: 100000
35702
- var VLQ_CONTINUATION_BIT = VLQ_BASE;
35703
-
35704
- /**
35705
- * Converts from a two-complement value to a value where the sign bit is
35706
- * placed in the least significant bit. For example, as decimals:
35707
- * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
35708
- * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
35709
- */
35710
- function toVLQSigned(aValue) {
35711
- return aValue < 0
35712
- ? ((-aValue) << 1) + 1
35713
- : (aValue << 1) + 0;
35714
- }
35715
-
35716
- /**
35717
- * Converts to a two-complement value from a value where the sign bit is
35718
- * placed in the least significant bit. For example, as decimals:
35719
- * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
35720
- * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
35721
- */
35722
- function fromVLQSigned(aValue) {
35723
- var isNegative = (aValue & 1) === 1;
35724
- var shifted = aValue >> 1;
35725
- return isNegative
35726
- ? -shifted
35727
- : shifted;
35728
- }
35729
-
35730
- /**
35731
- * Returns the base 64 VLQ encoded value.
35732
- */
35733
- base64Vlq.encode = function base64VLQ_encode(aValue) {
35734
- var encoded = "";
35735
- var digit;
35736
-
35737
- var vlq = toVLQSigned(aValue);
35738
-
35739
- do {
35740
- digit = vlq & VLQ_BASE_MASK;
35741
- vlq >>>= VLQ_BASE_SHIFT;
35742
- if (vlq > 0) {
35743
- // There are still more digits in this value, so we must make sure the
35744
- // continuation bit is marked.
35745
- digit |= VLQ_CONTINUATION_BIT;
35746
- }
35747
- encoded += base64.encode(digit);
35748
- } while (vlq > 0);
35749
-
35750
- return encoded;
35751
- };
35752
-
35753
- /**
35754
- * Decodes the next base 64 VLQ value from the given string and returns the
35755
- * value and the rest of the string via the out parameter.
35756
- */
35757
- base64Vlq.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
35758
- var strLen = aStr.length;
35759
- var result = 0;
35760
- var shift = 0;
35761
- var continuation, digit;
35762
-
35763
- do {
35764
- if (aIndex >= strLen) {
35765
- throw new Error("Expected more digits in base 64 VLQ value.");
35766
- }
35767
-
35768
- digit = base64.decode(aStr.charCodeAt(aIndex++));
35769
- if (digit === -1) {
35770
- throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
35771
- }
35772
-
35773
- continuation = !!(digit & VLQ_CONTINUATION_BIT);
35774
- digit &= VLQ_BASE_MASK;
35775
- result = result + (digit << shift);
35776
- shift += VLQ_BASE_SHIFT;
35777
- } while (continuation);
35778
-
35779
- aOutParam.value = fromVLQSigned(result);
35780
- aOutParam.rest = aIndex;
35781
- };
35782
-
35783
- var util$5 = {};
35561
+ var util$2 = {};
35784
35562
 
35785
35563
  /* -*- Mode: js; js-indent-level: 2; -*- */
35786
35564
 
@@ -35852,6 +35630,43 @@ function urlGenerate(aParsedUrl) {
35852
35630
  }
35853
35631
  exports.urlGenerate = urlGenerate;
35854
35632
 
35633
+ var MAX_CACHED_INPUTS = 32;
35634
+
35635
+ /**
35636
+ * Takes some function `f(input) -> result` and returns a memoized version of
35637
+ * `f`.
35638
+ *
35639
+ * We keep at most `MAX_CACHED_INPUTS` memoized results of `f` alive. The
35640
+ * memoization is a dumb-simple, linear least-recently-used cache.
35641
+ */
35642
+ function lruMemoize(f) {
35643
+ var cache = [];
35644
+
35645
+ return function(input) {
35646
+ for (var i = 0; i < cache.length; i++) {
35647
+ if (cache[i].input === input) {
35648
+ var temp = cache[0];
35649
+ cache[0] = cache[i];
35650
+ cache[i] = temp;
35651
+ return cache[0].result;
35652
+ }
35653
+ }
35654
+
35655
+ var result = f(input);
35656
+
35657
+ cache.unshift({
35658
+ input,
35659
+ result,
35660
+ });
35661
+
35662
+ if (cache.length > MAX_CACHED_INPUTS) {
35663
+ cache.pop();
35664
+ }
35665
+
35666
+ return result;
35667
+ };
35668
+ }
35669
+
35855
35670
  /**
35856
35671
  * Normalizes a path, or the path portion of a URL:
35857
35672
  *
@@ -35863,7 +35678,7 @@ exports.urlGenerate = urlGenerate;
35863
35678
  *
35864
35679
  * @param aPath The path or url to normalize.
35865
35680
  */
35866
- function normalize(aPath) {
35681
+ var normalize = lruMemoize(function normalize(aPath) {
35867
35682
  var path = aPath;
35868
35683
  var url = urlParse(aPath);
35869
35684
  if (url) {
@@ -35873,8 +35688,25 @@ function normalize(aPath) {
35873
35688
  path = url.path;
35874
35689
  }
35875
35690
  var isAbsolute = exports.isAbsolute(path);
35691
+ // Split the path into parts between `/` characters. This is much faster than
35692
+ // using `.split(/\/+/g)`.
35693
+ var parts = [];
35694
+ var start = 0;
35695
+ var i = 0;
35696
+ while (true) {
35697
+ start = i;
35698
+ i = path.indexOf("/", start);
35699
+ if (i === -1) {
35700
+ parts.push(path.slice(start));
35701
+ break;
35702
+ } else {
35703
+ parts.push(path.slice(start, i));
35704
+ while (i < path.length && path[i] === "/") {
35705
+ i++;
35706
+ }
35707
+ }
35708
+ }
35876
35709
 
35877
- var parts = path.split(/\/+/);
35878
35710
  for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
35879
35711
  part = parts[i];
35880
35712
  if (part === '.') {
@@ -35905,7 +35737,7 @@ function normalize(aPath) {
35905
35737
  return urlGenerate(url);
35906
35738
  }
35907
35739
  return path;
35908
- }
35740
+ });
35909
35741
  exports.normalize = normalize;
35910
35742
 
35911
35743
  /**
@@ -36117,6 +35949,33 @@ function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
36117
35949
  }
36118
35950
  exports.compareByOriginalPositions = compareByOriginalPositions;
36119
35951
 
35952
+ function compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) {
35953
+ var cmp;
35954
+
35955
+ cmp = mappingA.originalLine - mappingB.originalLine;
35956
+ if (cmp !== 0) {
35957
+ return cmp;
35958
+ }
35959
+
35960
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
35961
+ if (cmp !== 0 || onlyCompareOriginal) {
35962
+ return cmp;
35963
+ }
35964
+
35965
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
35966
+ if (cmp !== 0) {
35967
+ return cmp;
35968
+ }
35969
+
35970
+ cmp = mappingA.generatedLine - mappingB.generatedLine;
35971
+ if (cmp !== 0) {
35972
+ return cmp;
35973
+ }
35974
+
35975
+ return strcmp(mappingA.name, mappingB.name);
35976
+ }
35977
+ exports.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource;
35978
+
36120
35979
  /**
36121
35980
  * Comparator between two mappings with deflated source and name indices where
36122
35981
  * the generated positions are compared.
@@ -36156,6 +36015,31 @@ function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGene
36156
36015
  }
36157
36016
  exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
36158
36017
 
36018
+ function compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) {
36019
+ var cmp = mappingA.generatedColumn - mappingB.generatedColumn;
36020
+ if (cmp !== 0 || onlyCompareGenerated) {
36021
+ return cmp;
36022
+ }
36023
+
36024
+ cmp = strcmp(mappingA.source, mappingB.source);
36025
+ if (cmp !== 0) {
36026
+ return cmp;
36027
+ }
36028
+
36029
+ cmp = mappingA.originalLine - mappingB.originalLine;
36030
+ if (cmp !== 0) {
36031
+ return cmp;
36032
+ }
36033
+
36034
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
36035
+ if (cmp !== 0) {
36036
+ return cmp;
36037
+ }
36038
+
36039
+ return strcmp(mappingA.name, mappingB.name);
36040
+ }
36041
+ exports.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine;
36042
+
36159
36043
  function strcmp(aStr1, aStr2) {
36160
36044
  if (aStr1 === aStr2) {
36161
36045
  return 0;
@@ -36272,644 +36156,7 @@ function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
36272
36156
  return normalize(sourceURL);
36273
36157
  }
36274
36158
  exports.computeSourceURL = computeSourceURL;
36275
- }(util$5));
36276
-
36277
- var arraySet = {};
36278
-
36279
- /* -*- Mode: js; js-indent-level: 2; -*- */
36280
-
36281
- /*
36282
- * Copyright 2011 Mozilla Foundation and contributors
36283
- * Licensed under the New BSD license. See LICENSE or:
36284
- * http://opensource.org/licenses/BSD-3-Clause
36285
- */
36286
-
36287
- var util$4 = util$5;
36288
- var has = Object.prototype.hasOwnProperty;
36289
- var hasNativeMap = typeof Map !== "undefined";
36290
-
36291
- /**
36292
- * A data structure which is a combination of an array and a set. Adding a new
36293
- * member is O(1), testing for membership is O(1), and finding the index of an
36294
- * element is O(1). Removing elements from the set is not supported. Only
36295
- * strings are supported for membership.
36296
- */
36297
- function ArraySet$2() {
36298
- this._array = [];
36299
- this._set = hasNativeMap ? new Map() : Object.create(null);
36300
- }
36301
-
36302
- /**
36303
- * Static method for creating ArraySet instances from an existing array.
36304
- */
36305
- ArraySet$2.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
36306
- var set = new ArraySet$2();
36307
- for (var i = 0, len = aArray.length; i < len; i++) {
36308
- set.add(aArray[i], aAllowDuplicates);
36309
- }
36310
- return set;
36311
- };
36312
-
36313
- /**
36314
- * Return how many unique items are in this ArraySet. If duplicates have been
36315
- * added, than those do not count towards the size.
36316
- *
36317
- * @returns Number
36318
- */
36319
- ArraySet$2.prototype.size = function ArraySet_size() {
36320
- return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
36321
- };
36322
-
36323
- /**
36324
- * Add the given string to this set.
36325
- *
36326
- * @param String aStr
36327
- */
36328
- ArraySet$2.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
36329
- var sStr = hasNativeMap ? aStr : util$4.toSetString(aStr);
36330
- var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
36331
- var idx = this._array.length;
36332
- if (!isDuplicate || aAllowDuplicates) {
36333
- this._array.push(aStr);
36334
- }
36335
- if (!isDuplicate) {
36336
- if (hasNativeMap) {
36337
- this._set.set(aStr, idx);
36338
- } else {
36339
- this._set[sStr] = idx;
36340
- }
36341
- }
36342
- };
36343
-
36344
- /**
36345
- * Is the given string a member of this set?
36346
- *
36347
- * @param String aStr
36348
- */
36349
- ArraySet$2.prototype.has = function ArraySet_has(aStr) {
36350
- if (hasNativeMap) {
36351
- return this._set.has(aStr);
36352
- } else {
36353
- var sStr = util$4.toSetString(aStr);
36354
- return has.call(this._set, sStr);
36355
- }
36356
- };
36357
-
36358
- /**
36359
- * What is the index of the given string in the array?
36360
- *
36361
- * @param String aStr
36362
- */
36363
- ArraySet$2.prototype.indexOf = function ArraySet_indexOf(aStr) {
36364
- if (hasNativeMap) {
36365
- var idx = this._set.get(aStr);
36366
- if (idx >= 0) {
36367
- return idx;
36368
- }
36369
- } else {
36370
- var sStr = util$4.toSetString(aStr);
36371
- if (has.call(this._set, sStr)) {
36372
- return this._set[sStr];
36373
- }
36374
- }
36375
-
36376
- throw new Error('"' + aStr + '" is not in the set.');
36377
- };
36378
-
36379
- /**
36380
- * What is the element at the given index?
36381
- *
36382
- * @param Number aIdx
36383
- */
36384
- ArraySet$2.prototype.at = function ArraySet_at(aIdx) {
36385
- if (aIdx >= 0 && aIdx < this._array.length) {
36386
- return this._array[aIdx];
36387
- }
36388
- throw new Error('No element indexed by ' + aIdx);
36389
- };
36390
-
36391
- /**
36392
- * Returns the array representation of this set (which has the proper indices
36393
- * indicated by indexOf). Note that this is a copy of the internal array used
36394
- * for storing the members so that no one can mess with internal state.
36395
- */
36396
- ArraySet$2.prototype.toArray = function ArraySet_toArray() {
36397
- return this._array.slice();
36398
- };
36399
-
36400
- arraySet.ArraySet = ArraySet$2;
36401
-
36402
- var mappingList = {};
36403
-
36404
- /* -*- Mode: js; js-indent-level: 2; -*- */
36405
-
36406
- /*
36407
- * Copyright 2014 Mozilla Foundation and contributors
36408
- * Licensed under the New BSD license. See LICENSE or:
36409
- * http://opensource.org/licenses/BSD-3-Clause
36410
- */
36411
-
36412
- var util$3 = util$5;
36413
-
36414
- /**
36415
- * Determine whether mappingB is after mappingA with respect to generated
36416
- * position.
36417
- */
36418
- function generatedPositionAfter(mappingA, mappingB) {
36419
- // Optimized for most common case
36420
- var lineA = mappingA.generatedLine;
36421
- var lineB = mappingB.generatedLine;
36422
- var columnA = mappingA.generatedColumn;
36423
- var columnB = mappingB.generatedColumn;
36424
- return lineB > lineA || lineB == lineA && columnB >= columnA ||
36425
- util$3.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
36426
- }
36427
-
36428
- /**
36429
- * A data structure to provide a sorted view of accumulated mappings in a
36430
- * performance conscious manner. It trades a neglibable overhead in general
36431
- * case for a large speedup in case of mappings being added in order.
36432
- */
36433
- function MappingList$1() {
36434
- this._array = [];
36435
- this._sorted = true;
36436
- // Serves as infimum
36437
- this._last = {generatedLine: -1, generatedColumn: 0};
36438
- }
36439
-
36440
- /**
36441
- * Iterate through internal items. This method takes the same arguments that
36442
- * `Array.prototype.forEach` takes.
36443
- *
36444
- * NOTE: The order of the mappings is NOT guaranteed.
36445
- */
36446
- MappingList$1.prototype.unsortedForEach =
36447
- function MappingList_forEach(aCallback, aThisArg) {
36448
- this._array.forEach(aCallback, aThisArg);
36449
- };
36450
-
36451
- /**
36452
- * Add the given source mapping.
36453
- *
36454
- * @param Object aMapping
36455
- */
36456
- MappingList$1.prototype.add = function MappingList_add(aMapping) {
36457
- if (generatedPositionAfter(this._last, aMapping)) {
36458
- this._last = aMapping;
36459
- this._array.push(aMapping);
36460
- } else {
36461
- this._sorted = false;
36462
- this._array.push(aMapping);
36463
- }
36464
- };
36465
-
36466
- /**
36467
- * Returns the flat, sorted array of mappings. The mappings are sorted by
36468
- * generated position.
36469
- *
36470
- * WARNING: This method returns internal data without copying, for
36471
- * performance. The return value must NOT be mutated, and should be treated as
36472
- * an immutable borrow. If you want to take ownership, you must make your own
36473
- * copy.
36474
- */
36475
- MappingList$1.prototype.toArray = function MappingList_toArray() {
36476
- if (!this._sorted) {
36477
- this._array.sort(util$3.compareByGeneratedPositionsInflated);
36478
- this._sorted = true;
36479
- }
36480
- return this._array;
36481
- };
36482
-
36483
- mappingList.MappingList = MappingList$1;
36484
-
36485
- /* -*- Mode: js; js-indent-level: 2; -*- */
36486
-
36487
- /*
36488
- * Copyright 2011 Mozilla Foundation and contributors
36489
- * Licensed under the New BSD license. See LICENSE or:
36490
- * http://opensource.org/licenses/BSD-3-Clause
36491
- */
36492
-
36493
- var base64VLQ$1 = base64Vlq;
36494
- var util$2 = util$5;
36495
- var ArraySet$1 = arraySet.ArraySet;
36496
- var MappingList = mappingList.MappingList;
36497
-
36498
- /**
36499
- * An instance of the SourceMapGenerator represents a source map which is
36500
- * being built incrementally. You may pass an object with the following
36501
- * properties:
36502
- *
36503
- * - file: The filename of the generated source.
36504
- * - sourceRoot: A root for all relative URLs in this source map.
36505
- */
36506
- function SourceMapGenerator$1(aArgs) {
36507
- if (!aArgs) {
36508
- aArgs = {};
36509
- }
36510
- this._file = util$2.getArg(aArgs, 'file', null);
36511
- this._sourceRoot = util$2.getArg(aArgs, 'sourceRoot', null);
36512
- this._skipValidation = util$2.getArg(aArgs, 'skipValidation', false);
36513
- this._sources = new ArraySet$1();
36514
- this._names = new ArraySet$1();
36515
- this._mappings = new MappingList();
36516
- this._sourcesContents = null;
36517
- }
36518
-
36519
- SourceMapGenerator$1.prototype._version = 3;
36520
-
36521
- /**
36522
- * Creates a new SourceMapGenerator based on a SourceMapConsumer
36523
- *
36524
- * @param aSourceMapConsumer The SourceMap.
36525
- */
36526
- SourceMapGenerator$1.fromSourceMap =
36527
- function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
36528
- var sourceRoot = aSourceMapConsumer.sourceRoot;
36529
- var generator = new SourceMapGenerator$1({
36530
- file: aSourceMapConsumer.file,
36531
- sourceRoot: sourceRoot
36532
- });
36533
- aSourceMapConsumer.eachMapping(function (mapping) {
36534
- var newMapping = {
36535
- generated: {
36536
- line: mapping.generatedLine,
36537
- column: mapping.generatedColumn
36538
- }
36539
- };
36540
-
36541
- if (mapping.source != null) {
36542
- newMapping.source = mapping.source;
36543
- if (sourceRoot != null) {
36544
- newMapping.source = util$2.relative(sourceRoot, newMapping.source);
36545
- }
36546
-
36547
- newMapping.original = {
36548
- line: mapping.originalLine,
36549
- column: mapping.originalColumn
36550
- };
36551
-
36552
- if (mapping.name != null) {
36553
- newMapping.name = mapping.name;
36554
- }
36555
- }
36556
-
36557
- generator.addMapping(newMapping);
36558
- });
36559
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
36560
- var sourceRelative = sourceFile;
36561
- if (sourceRoot !== null) {
36562
- sourceRelative = util$2.relative(sourceRoot, sourceFile);
36563
- }
36564
-
36565
- if (!generator._sources.has(sourceRelative)) {
36566
- generator._sources.add(sourceRelative);
36567
- }
36568
-
36569
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
36570
- if (content != null) {
36571
- generator.setSourceContent(sourceFile, content);
36572
- }
36573
- });
36574
- return generator;
36575
- };
36576
-
36577
- /**
36578
- * Add a single mapping from original source line and column to the generated
36579
- * source's line and column for this source map being created. The mapping
36580
- * object should have the following properties:
36581
- *
36582
- * - generated: An object with the generated line and column positions.
36583
- * - original: An object with the original line and column positions.
36584
- * - source: The original source file (relative to the sourceRoot).
36585
- * - name: An optional original token name for this mapping.
36586
- */
36587
- SourceMapGenerator$1.prototype.addMapping =
36588
- function SourceMapGenerator_addMapping(aArgs) {
36589
- var generated = util$2.getArg(aArgs, 'generated');
36590
- var original = util$2.getArg(aArgs, 'original', null);
36591
- var source = util$2.getArg(aArgs, 'source', null);
36592
- var name = util$2.getArg(aArgs, 'name', null);
36593
-
36594
- if (!this._skipValidation) {
36595
- this._validateMapping(generated, original, source, name);
36596
- }
36597
-
36598
- if (source != null) {
36599
- source = String(source);
36600
- if (!this._sources.has(source)) {
36601
- this._sources.add(source);
36602
- }
36603
- }
36604
-
36605
- if (name != null) {
36606
- name = String(name);
36607
- if (!this._names.has(name)) {
36608
- this._names.add(name);
36609
- }
36610
- }
36611
-
36612
- this._mappings.add({
36613
- generatedLine: generated.line,
36614
- generatedColumn: generated.column,
36615
- originalLine: original != null && original.line,
36616
- originalColumn: original != null && original.column,
36617
- source: source,
36618
- name: name
36619
- });
36620
- };
36621
-
36622
- /**
36623
- * Set the source content for a source file.
36624
- */
36625
- SourceMapGenerator$1.prototype.setSourceContent =
36626
- function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
36627
- var source = aSourceFile;
36628
- if (this._sourceRoot != null) {
36629
- source = util$2.relative(this._sourceRoot, source);
36630
- }
36631
-
36632
- if (aSourceContent != null) {
36633
- // Add the source content to the _sourcesContents map.
36634
- // Create a new _sourcesContents map if the property is null.
36635
- if (!this._sourcesContents) {
36636
- this._sourcesContents = Object.create(null);
36637
- }
36638
- this._sourcesContents[util$2.toSetString(source)] = aSourceContent;
36639
- } else if (this._sourcesContents) {
36640
- // Remove the source file from the _sourcesContents map.
36641
- // If the _sourcesContents map is empty, set the property to null.
36642
- delete this._sourcesContents[util$2.toSetString(source)];
36643
- if (Object.keys(this._sourcesContents).length === 0) {
36644
- this._sourcesContents = null;
36645
- }
36646
- }
36647
- };
36648
-
36649
- /**
36650
- * Applies the mappings of a sub-source-map for a specific source file to the
36651
- * source map being generated. Each mapping to the supplied source file is
36652
- * rewritten using the supplied source map. Note: The resolution for the
36653
- * resulting mappings is the minimium of this map and the supplied map.
36654
- *
36655
- * @param aSourceMapConsumer The source map to be applied.
36656
- * @param aSourceFile Optional. The filename of the source file.
36657
- * If omitted, SourceMapConsumer's file property will be used.
36658
- * @param aSourceMapPath Optional. The dirname of the path to the source map
36659
- * to be applied. If relative, it is relative to the SourceMapConsumer.
36660
- * This parameter is needed when the two source maps aren't in the same
36661
- * directory, and the source map to be applied contains relative source
36662
- * paths. If so, those relative source paths need to be rewritten
36663
- * relative to the SourceMapGenerator.
36664
- */
36665
- SourceMapGenerator$1.prototype.applySourceMap =
36666
- function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
36667
- var sourceFile = aSourceFile;
36668
- // If aSourceFile is omitted, we will use the file property of the SourceMap
36669
- if (aSourceFile == null) {
36670
- if (aSourceMapConsumer.file == null) {
36671
- throw new Error(
36672
- 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
36673
- 'or the source map\'s "file" property. Both were omitted.'
36674
- );
36675
- }
36676
- sourceFile = aSourceMapConsumer.file;
36677
- }
36678
- var sourceRoot = this._sourceRoot;
36679
- // Make "sourceFile" relative if an absolute Url is passed.
36680
- if (sourceRoot != null) {
36681
- sourceFile = util$2.relative(sourceRoot, sourceFile);
36682
- }
36683
- // Applying the SourceMap can add and remove items from the sources and
36684
- // the names array.
36685
- var newSources = new ArraySet$1();
36686
- var newNames = new ArraySet$1();
36687
-
36688
- // Find mappings for the "sourceFile"
36689
- this._mappings.unsortedForEach(function (mapping) {
36690
- if (mapping.source === sourceFile && mapping.originalLine != null) {
36691
- // Check if it can be mapped by the source map, then update the mapping.
36692
- var original = aSourceMapConsumer.originalPositionFor({
36693
- line: mapping.originalLine,
36694
- column: mapping.originalColumn
36695
- });
36696
- if (original.source != null) {
36697
- // Copy mapping
36698
- mapping.source = original.source;
36699
- if (aSourceMapPath != null) {
36700
- mapping.source = util$2.join(aSourceMapPath, mapping.source);
36701
- }
36702
- if (sourceRoot != null) {
36703
- mapping.source = util$2.relative(sourceRoot, mapping.source);
36704
- }
36705
- mapping.originalLine = original.line;
36706
- mapping.originalColumn = original.column;
36707
- if (original.name != null) {
36708
- mapping.name = original.name;
36709
- }
36710
- }
36711
- }
36712
-
36713
- var source = mapping.source;
36714
- if (source != null && !newSources.has(source)) {
36715
- newSources.add(source);
36716
- }
36717
-
36718
- var name = mapping.name;
36719
- if (name != null && !newNames.has(name)) {
36720
- newNames.add(name);
36721
- }
36722
-
36723
- }, this);
36724
- this._sources = newSources;
36725
- this._names = newNames;
36726
-
36727
- // Copy sourcesContents of applied map.
36728
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
36729
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
36730
- if (content != null) {
36731
- if (aSourceMapPath != null) {
36732
- sourceFile = util$2.join(aSourceMapPath, sourceFile);
36733
- }
36734
- if (sourceRoot != null) {
36735
- sourceFile = util$2.relative(sourceRoot, sourceFile);
36736
- }
36737
- this.setSourceContent(sourceFile, content);
36738
- }
36739
- }, this);
36740
- };
36741
-
36742
- /**
36743
- * A mapping can have one of the three levels of data:
36744
- *
36745
- * 1. Just the generated position.
36746
- * 2. The Generated position, original position, and original source.
36747
- * 3. Generated and original position, original source, as well as a name
36748
- * token.
36749
- *
36750
- * To maintain consistency, we validate that any new mapping being added falls
36751
- * in to one of these categories.
36752
- */
36753
- SourceMapGenerator$1.prototype._validateMapping =
36754
- function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
36755
- aName) {
36756
- // When aOriginal is truthy but has empty values for .line and .column,
36757
- // it is most likely a programmer error. In this case we throw a very
36758
- // specific error message to try to guide them the right way.
36759
- // For example: https://github.com/Polymer/polymer-bundler/pull/519
36760
- if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
36761
- throw new Error(
36762
- 'original.line and original.column are not numbers -- you probably meant to omit ' +
36763
- 'the original mapping entirely and only map the generated position. If so, pass ' +
36764
- 'null for the original mapping instead of an object with empty or null values.'
36765
- );
36766
- }
36767
-
36768
- if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
36769
- && aGenerated.line > 0 && aGenerated.column >= 0
36770
- && !aOriginal && !aSource && !aName) {
36771
- // Case 1.
36772
- return;
36773
- }
36774
- else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
36775
- && aOriginal && 'line' in aOriginal && 'column' in aOriginal
36776
- && aGenerated.line > 0 && aGenerated.column >= 0
36777
- && aOriginal.line > 0 && aOriginal.column >= 0
36778
- && aSource) {
36779
- // Cases 2 and 3.
36780
- return;
36781
- }
36782
- else {
36783
- throw new Error('Invalid mapping: ' + JSON.stringify({
36784
- generated: aGenerated,
36785
- source: aSource,
36786
- original: aOriginal,
36787
- name: aName
36788
- }));
36789
- }
36790
- };
36791
-
36792
- /**
36793
- * Serialize the accumulated mappings in to the stream of base 64 VLQs
36794
- * specified by the source map format.
36795
- */
36796
- SourceMapGenerator$1.prototype._serializeMappings =
36797
- function SourceMapGenerator_serializeMappings() {
36798
- var previousGeneratedColumn = 0;
36799
- var previousGeneratedLine = 1;
36800
- var previousOriginalColumn = 0;
36801
- var previousOriginalLine = 0;
36802
- var previousName = 0;
36803
- var previousSource = 0;
36804
- var result = '';
36805
- var next;
36806
- var mapping;
36807
- var nameIdx;
36808
- var sourceIdx;
36809
-
36810
- var mappings = this._mappings.toArray();
36811
- for (var i = 0, len = mappings.length; i < len; i++) {
36812
- mapping = mappings[i];
36813
- next = '';
36814
-
36815
- if (mapping.generatedLine !== previousGeneratedLine) {
36816
- previousGeneratedColumn = 0;
36817
- while (mapping.generatedLine !== previousGeneratedLine) {
36818
- next += ';';
36819
- previousGeneratedLine++;
36820
- }
36821
- }
36822
- else {
36823
- if (i > 0) {
36824
- if (!util$2.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
36825
- continue;
36826
- }
36827
- next += ',';
36828
- }
36829
- }
36830
-
36831
- next += base64VLQ$1.encode(mapping.generatedColumn
36832
- - previousGeneratedColumn);
36833
- previousGeneratedColumn = mapping.generatedColumn;
36834
-
36835
- if (mapping.source != null) {
36836
- sourceIdx = this._sources.indexOf(mapping.source);
36837
- next += base64VLQ$1.encode(sourceIdx - previousSource);
36838
- previousSource = sourceIdx;
36839
-
36840
- // lines are stored 0-based in SourceMap spec version 3
36841
- next += base64VLQ$1.encode(mapping.originalLine - 1
36842
- - previousOriginalLine);
36843
- previousOriginalLine = mapping.originalLine - 1;
36844
-
36845
- next += base64VLQ$1.encode(mapping.originalColumn
36846
- - previousOriginalColumn);
36847
- previousOriginalColumn = mapping.originalColumn;
36848
-
36849
- if (mapping.name != null) {
36850
- nameIdx = this._names.indexOf(mapping.name);
36851
- next += base64VLQ$1.encode(nameIdx - previousName);
36852
- previousName = nameIdx;
36853
- }
36854
- }
36855
-
36856
- result += next;
36857
- }
36858
-
36859
- return result;
36860
- };
36861
-
36862
- SourceMapGenerator$1.prototype._generateSourcesContent =
36863
- function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
36864
- return aSources.map(function (source) {
36865
- if (!this._sourcesContents) {
36866
- return null;
36867
- }
36868
- if (aSourceRoot != null) {
36869
- source = util$2.relative(aSourceRoot, source);
36870
- }
36871
- var key = util$2.toSetString(source);
36872
- return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
36873
- ? this._sourcesContents[key]
36874
- : null;
36875
- }, this);
36876
- };
36877
-
36878
- /**
36879
- * Externalize the source map.
36880
- */
36881
- SourceMapGenerator$1.prototype.toJSON =
36882
- function SourceMapGenerator_toJSON() {
36883
- var map = {
36884
- version: this._version,
36885
- sources: this._sources.toArray(),
36886
- names: this._names.toArray(),
36887
- mappings: this._serializeMappings()
36888
- };
36889
- if (this._file != null) {
36890
- map.file = this._file;
36891
- }
36892
- if (this._sourceRoot != null) {
36893
- map.sourceRoot = this._sourceRoot;
36894
- }
36895
- if (this._sourcesContents) {
36896
- map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
36897
- }
36898
-
36899
- return map;
36900
- };
36901
-
36902
- /**
36903
- * Render the source map being generated to a string.
36904
- */
36905
- SourceMapGenerator$1.prototype.toString =
36906
- function SourceMapGenerator_toString() {
36907
- return JSON.stringify(this.toJSON());
36908
- };
36909
-
36910
- sourceMapGenerator.SourceMapGenerator = SourceMapGenerator$1;
36911
-
36912
- var sourceMapConsumer = {};
36159
+ }(util$2));
36913
36160
 
36914
36161
  var binarySearch$1 = {};
36915
36162
 
@@ -37028,6 +36275,346 @@ exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
37028
36275
  };
37029
36276
  }(binarySearch$1));
37030
36277
 
36278
+ var arraySet = {};
36279
+
36280
+ /* -*- Mode: js; js-indent-level: 2; -*- */
36281
+
36282
+ /*
36283
+ * Copyright 2011 Mozilla Foundation and contributors
36284
+ * Licensed under the New BSD license. See LICENSE or:
36285
+ * http://opensource.org/licenses/BSD-3-Clause
36286
+ */
36287
+
36288
+ var util$1 = util$2;
36289
+ var has = Object.prototype.hasOwnProperty;
36290
+ var hasNativeMap = typeof Map !== "undefined";
36291
+
36292
+ /**
36293
+ * A data structure which is a combination of an array and a set. Adding a new
36294
+ * member is O(1), testing for membership is O(1), and finding the index of an
36295
+ * element is O(1). Removing elements from the set is not supported. Only
36296
+ * strings are supported for membership.
36297
+ */
36298
+ function ArraySet$1() {
36299
+ this._array = [];
36300
+ this._set = hasNativeMap ? new Map() : Object.create(null);
36301
+ }
36302
+
36303
+ /**
36304
+ * Static method for creating ArraySet instances from an existing array.
36305
+ */
36306
+ ArraySet$1.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
36307
+ var set = new ArraySet$1();
36308
+ for (var i = 0, len = aArray.length; i < len; i++) {
36309
+ set.add(aArray[i], aAllowDuplicates);
36310
+ }
36311
+ return set;
36312
+ };
36313
+
36314
+ /**
36315
+ * Return how many unique items are in this ArraySet. If duplicates have been
36316
+ * added, than those do not count towards the size.
36317
+ *
36318
+ * @returns Number
36319
+ */
36320
+ ArraySet$1.prototype.size = function ArraySet_size() {
36321
+ return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
36322
+ };
36323
+
36324
+ /**
36325
+ * Add the given string to this set.
36326
+ *
36327
+ * @param String aStr
36328
+ */
36329
+ ArraySet$1.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
36330
+ var sStr = hasNativeMap ? aStr : util$1.toSetString(aStr);
36331
+ var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
36332
+ var idx = this._array.length;
36333
+ if (!isDuplicate || aAllowDuplicates) {
36334
+ this._array.push(aStr);
36335
+ }
36336
+ if (!isDuplicate) {
36337
+ if (hasNativeMap) {
36338
+ this._set.set(aStr, idx);
36339
+ } else {
36340
+ this._set[sStr] = idx;
36341
+ }
36342
+ }
36343
+ };
36344
+
36345
+ /**
36346
+ * Is the given string a member of this set?
36347
+ *
36348
+ * @param String aStr
36349
+ */
36350
+ ArraySet$1.prototype.has = function ArraySet_has(aStr) {
36351
+ if (hasNativeMap) {
36352
+ return this._set.has(aStr);
36353
+ } else {
36354
+ var sStr = util$1.toSetString(aStr);
36355
+ return has.call(this._set, sStr);
36356
+ }
36357
+ };
36358
+
36359
+ /**
36360
+ * What is the index of the given string in the array?
36361
+ *
36362
+ * @param String aStr
36363
+ */
36364
+ ArraySet$1.prototype.indexOf = function ArraySet_indexOf(aStr) {
36365
+ if (hasNativeMap) {
36366
+ var idx = this._set.get(aStr);
36367
+ if (idx >= 0) {
36368
+ return idx;
36369
+ }
36370
+ } else {
36371
+ var sStr = util$1.toSetString(aStr);
36372
+ if (has.call(this._set, sStr)) {
36373
+ return this._set[sStr];
36374
+ }
36375
+ }
36376
+
36377
+ throw new Error('"' + aStr + '" is not in the set.');
36378
+ };
36379
+
36380
+ /**
36381
+ * What is the element at the given index?
36382
+ *
36383
+ * @param Number aIdx
36384
+ */
36385
+ ArraySet$1.prototype.at = function ArraySet_at(aIdx) {
36386
+ if (aIdx >= 0 && aIdx < this._array.length) {
36387
+ return this._array[aIdx];
36388
+ }
36389
+ throw new Error('No element indexed by ' + aIdx);
36390
+ };
36391
+
36392
+ /**
36393
+ * Returns the array representation of this set (which has the proper indices
36394
+ * indicated by indexOf). Note that this is a copy of the internal array used
36395
+ * for storing the members so that no one can mess with internal state.
36396
+ */
36397
+ ArraySet$1.prototype.toArray = function ArraySet_toArray() {
36398
+ return this._array.slice();
36399
+ };
36400
+
36401
+ arraySet.ArraySet = ArraySet$1;
36402
+
36403
+ var base64Vlq = {};
36404
+
36405
+ var base64$1 = {};
36406
+
36407
+ /* -*- Mode: js; js-indent-level: 2; -*- */
36408
+
36409
+ /*
36410
+ * Copyright 2011 Mozilla Foundation and contributors
36411
+ * Licensed under the New BSD license. See LICENSE or:
36412
+ * http://opensource.org/licenses/BSD-3-Clause
36413
+ */
36414
+
36415
+ var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
36416
+
36417
+ /**
36418
+ * Encode an integer in the range of 0 to 63 to a single base 64 digit.
36419
+ */
36420
+ base64$1.encode = function (number) {
36421
+ if (0 <= number && number < intToCharMap.length) {
36422
+ return intToCharMap[number];
36423
+ }
36424
+ throw new TypeError("Must be between 0 and 63: " + number);
36425
+ };
36426
+
36427
+ /**
36428
+ * Decode a single base 64 character code digit to an integer. Returns -1 on
36429
+ * failure.
36430
+ */
36431
+ base64$1.decode = function (charCode) {
36432
+ var bigA = 65; // 'A'
36433
+ var bigZ = 90; // 'Z'
36434
+
36435
+ var littleA = 97; // 'a'
36436
+ var littleZ = 122; // 'z'
36437
+
36438
+ var zero = 48; // '0'
36439
+ var nine = 57; // '9'
36440
+
36441
+ var plus = 43; // '+'
36442
+ var slash = 47; // '/'
36443
+
36444
+ var littleOffset = 26;
36445
+ var numberOffset = 52;
36446
+
36447
+ // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
36448
+ if (bigA <= charCode && charCode <= bigZ) {
36449
+ return (charCode - bigA);
36450
+ }
36451
+
36452
+ // 26 - 51: abcdefghijklmnopqrstuvwxyz
36453
+ if (littleA <= charCode && charCode <= littleZ) {
36454
+ return (charCode - littleA + littleOffset);
36455
+ }
36456
+
36457
+ // 52 - 61: 0123456789
36458
+ if (zero <= charCode && charCode <= nine) {
36459
+ return (charCode - zero + numberOffset);
36460
+ }
36461
+
36462
+ // 62: +
36463
+ if (charCode == plus) {
36464
+ return 62;
36465
+ }
36466
+
36467
+ // 63: /
36468
+ if (charCode == slash) {
36469
+ return 63;
36470
+ }
36471
+
36472
+ // Invalid base64 digit.
36473
+ return -1;
36474
+ };
36475
+
36476
+ /* -*- Mode: js; js-indent-level: 2; -*- */
36477
+
36478
+ /*
36479
+ * Copyright 2011 Mozilla Foundation and contributors
36480
+ * Licensed under the New BSD license. See LICENSE or:
36481
+ * http://opensource.org/licenses/BSD-3-Clause
36482
+ *
36483
+ * Based on the Base 64 VLQ implementation in Closure Compiler:
36484
+ * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
36485
+ *
36486
+ * Copyright 2011 The Closure Compiler Authors. All rights reserved.
36487
+ * Redistribution and use in source and binary forms, with or without
36488
+ * modification, are permitted provided that the following conditions are
36489
+ * met:
36490
+ *
36491
+ * * Redistributions of source code must retain the above copyright
36492
+ * notice, this list of conditions and the following disclaimer.
36493
+ * * Redistributions in binary form must reproduce the above
36494
+ * copyright notice, this list of conditions and the following
36495
+ * disclaimer in the documentation and/or other materials provided
36496
+ * with the distribution.
36497
+ * * Neither the name of Google Inc. nor the names of its
36498
+ * contributors may be used to endorse or promote products derived
36499
+ * from this software without specific prior written permission.
36500
+ *
36501
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36502
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
36503
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
36504
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36505
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36506
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36507
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36508
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36509
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36510
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36511
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36512
+ */
36513
+
36514
+ var base64 = base64$1;
36515
+
36516
+ // A single base 64 digit can contain 6 bits of data. For the base 64 variable
36517
+ // length quantities we use in the source map spec, the first bit is the sign,
36518
+ // the next four bits are the actual value, and the 6th bit is the
36519
+ // continuation bit. The continuation bit tells us whether there are more
36520
+ // digits in this value following this digit.
36521
+ //
36522
+ // Continuation
36523
+ // | Sign
36524
+ // | |
36525
+ // V V
36526
+ // 101011
36527
+
36528
+ var VLQ_BASE_SHIFT = 5;
36529
+
36530
+ // binary: 100000
36531
+ var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
36532
+
36533
+ // binary: 011111
36534
+ var VLQ_BASE_MASK = VLQ_BASE - 1;
36535
+
36536
+ // binary: 100000
36537
+ var VLQ_CONTINUATION_BIT = VLQ_BASE;
36538
+
36539
+ /**
36540
+ * Converts from a two-complement value to a value where the sign bit is
36541
+ * placed in the least significant bit. For example, as decimals:
36542
+ * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
36543
+ * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
36544
+ */
36545
+ function toVLQSigned(aValue) {
36546
+ return aValue < 0
36547
+ ? ((-aValue) << 1) + 1
36548
+ : (aValue << 1) + 0;
36549
+ }
36550
+
36551
+ /**
36552
+ * Converts to a two-complement value from a value where the sign bit is
36553
+ * placed in the least significant bit. For example, as decimals:
36554
+ * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
36555
+ * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
36556
+ */
36557
+ function fromVLQSigned(aValue) {
36558
+ var isNegative = (aValue & 1) === 1;
36559
+ var shifted = aValue >> 1;
36560
+ return isNegative
36561
+ ? -shifted
36562
+ : shifted;
36563
+ }
36564
+
36565
+ /**
36566
+ * Returns the base 64 VLQ encoded value.
36567
+ */
36568
+ base64Vlq.encode = function base64VLQ_encode(aValue) {
36569
+ var encoded = "";
36570
+ var digit;
36571
+
36572
+ var vlq = toVLQSigned(aValue);
36573
+
36574
+ do {
36575
+ digit = vlq & VLQ_BASE_MASK;
36576
+ vlq >>>= VLQ_BASE_SHIFT;
36577
+ if (vlq > 0) {
36578
+ // There are still more digits in this value, so we must make sure the
36579
+ // continuation bit is marked.
36580
+ digit |= VLQ_CONTINUATION_BIT;
36581
+ }
36582
+ encoded += base64.encode(digit);
36583
+ } while (vlq > 0);
36584
+
36585
+ return encoded;
36586
+ };
36587
+
36588
+ /**
36589
+ * Decodes the next base 64 VLQ value from the given string and returns the
36590
+ * value and the rest of the string via the out parameter.
36591
+ */
36592
+ base64Vlq.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
36593
+ var strLen = aStr.length;
36594
+ var result = 0;
36595
+ var shift = 0;
36596
+ var continuation, digit;
36597
+
36598
+ do {
36599
+ if (aIndex >= strLen) {
36600
+ throw new Error("Expected more digits in base 64 VLQ value.");
36601
+ }
36602
+
36603
+ digit = base64.decode(aStr.charCodeAt(aIndex++));
36604
+ if (digit === -1) {
36605
+ throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
36606
+ }
36607
+
36608
+ continuation = !!(digit & VLQ_CONTINUATION_BIT);
36609
+ digit &= VLQ_BASE_MASK;
36610
+ result = result + (digit << shift);
36611
+ shift += VLQ_BASE_SHIFT;
36612
+ } while (continuation);
36613
+
36614
+ aOutParam.value = fromVLQSigned(result);
36615
+ aOutParam.rest = aIndex;
36616
+ };
36617
+
37031
36618
  var quickSort$1 = {};
37032
36619
 
37033
36620
  /* -*- Mode: js; js-indent-level: 2; -*- */
@@ -37048,6 +36635,8 @@ var quickSort$1 = {};
37048
36635
  // sorting in C++. By using our own JS-implemented Quick Sort (below), we get
37049
36636
  // a ~3500ms mean speed-up in `bench/bench.html`.
37050
36637
 
36638
+ function SortTemplate(comparator) {
36639
+
37051
36640
  /**
37052
36641
  * Swap the elements indexed by `x` and `y` in the array `ary`.
37053
36642
  *
@@ -37118,7 +36707,7 @@ function doQuickSort(ary, comparator, p, r) {
37118
36707
  //
37119
36708
  // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
37120
36709
  for (var j = p; j < r; j++) {
37121
- if (comparator(ary[j], pivot) <= 0) {
36710
+ if (comparator(ary[j], pivot, false) <= 0) {
37122
36711
  i += 1;
37123
36712
  swap(ary, i, j);
37124
36713
  }
@@ -37134,6 +36723,15 @@ function doQuickSort(ary, comparator, p, r) {
37134
36723
  }
37135
36724
  }
37136
36725
 
36726
+ return doQuickSort;
36727
+ }
36728
+
36729
+ function cloneSort(comparator) {
36730
+ let template = SortTemplate.toString();
36731
+ let templateFn = new Function(`return ${template}`)();
36732
+ return templateFn(comparator);
36733
+ }
36734
+
37137
36735
  /**
37138
36736
  * Sort the given array in-place with the given comparator function.
37139
36737
  *
@@ -37142,8 +36740,15 @@ function doQuickSort(ary, comparator, p, r) {
37142
36740
  * @param {function} comparator
37143
36741
  * Function to use to compare two items.
37144
36742
  */
37145
- quickSort$1.quickSort = function (ary, comparator) {
37146
- doQuickSort(ary, comparator, 0, ary.length - 1);
36743
+
36744
+ let sortCache = new WeakMap();
36745
+ quickSort$1.quickSort = function (ary, comparator, start = 0) {
36746
+ let doQuickSort = sortCache.get(comparator);
36747
+ if (doQuickSort === void 0) {
36748
+ doQuickSort = cloneSort(comparator);
36749
+ sortCache.set(comparator, doQuickSort);
36750
+ }
36751
+ doQuickSort(ary, comparator, start, ary.length - 1);
37147
36752
  };
37148
36753
 
37149
36754
  /* -*- Mode: js; js-indent-level: 2; -*- */
@@ -37154,16 +36759,16 @@ quickSort$1.quickSort = function (ary, comparator) {
37154
36759
  * http://opensource.org/licenses/BSD-3-Clause
37155
36760
  */
37156
36761
 
37157
- var util$1 = util$5;
36762
+ var util = util$2;
37158
36763
  var binarySearch = binarySearch$1;
37159
36764
  var ArraySet = arraySet.ArraySet;
37160
36765
  var base64VLQ = base64Vlq;
37161
36766
  var quickSort = quickSort$1.quickSort;
37162
36767
 
37163
- function SourceMapConsumer$1(aSourceMap, aSourceMapURL) {
36768
+ function SourceMapConsumer(aSourceMap, aSourceMapURL) {
37164
36769
  var sourceMap = aSourceMap;
37165
36770
  if (typeof aSourceMap === 'string') {
37166
- sourceMap = util$1.parseSourceMapInput(aSourceMap);
36771
+ sourceMap = util.parseSourceMapInput(aSourceMap);
37167
36772
  }
37168
36773
 
37169
36774
  return sourceMap.sections != null
@@ -37171,14 +36776,14 @@ function SourceMapConsumer$1(aSourceMap, aSourceMapURL) {
37171
36776
  : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
37172
36777
  }
37173
36778
 
37174
- SourceMapConsumer$1.fromSourceMap = function(aSourceMap, aSourceMapURL) {
36779
+ SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
37175
36780
  return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
37176
36781
  };
37177
36782
 
37178
36783
  /**
37179
36784
  * The version of the source mapping spec that we are consuming.
37180
36785
  */
37181
- SourceMapConsumer$1.prototype._version = 3;
36786
+ SourceMapConsumer.prototype._version = 3;
37182
36787
 
37183
36788
  // `__generatedMappings` and `__originalMappings` are arrays that hold the
37184
36789
  // parsed mapping coordinates from the source map's "mappings" attribute. They
@@ -37210,8 +36815,8 @@ SourceMapConsumer$1.prototype._version = 3;
37210
36815
  //
37211
36816
  // `_originalMappings` is ordered by the original positions.
37212
36817
 
37213
- SourceMapConsumer$1.prototype.__generatedMappings = null;
37214
- Object.defineProperty(SourceMapConsumer$1.prototype, '_generatedMappings', {
36818
+ SourceMapConsumer.prototype.__generatedMappings = null;
36819
+ Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
37215
36820
  configurable: true,
37216
36821
  enumerable: true,
37217
36822
  get: function () {
@@ -37223,8 +36828,8 @@ Object.defineProperty(SourceMapConsumer$1.prototype, '_generatedMappings', {
37223
36828
  }
37224
36829
  });
37225
36830
 
37226
- SourceMapConsumer$1.prototype.__originalMappings = null;
37227
- Object.defineProperty(SourceMapConsumer$1.prototype, '_originalMappings', {
36831
+ SourceMapConsumer.prototype.__originalMappings = null;
36832
+ Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
37228
36833
  configurable: true,
37229
36834
  enumerable: true,
37230
36835
  get: function () {
@@ -37236,7 +36841,7 @@ Object.defineProperty(SourceMapConsumer$1.prototype, '_originalMappings', {
37236
36841
  }
37237
36842
  });
37238
36843
 
37239
- SourceMapConsumer$1.prototype._charIsMappingSeparator =
36844
+ SourceMapConsumer.prototype._charIsMappingSeparator =
37240
36845
  function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
37241
36846
  var c = aStr.charAt(index);
37242
36847
  return c === ";" || c === ",";
@@ -37247,16 +36852,16 @@ SourceMapConsumer$1.prototype._charIsMappingSeparator =
37247
36852
  * query (the ordered arrays in the `this.__generatedMappings` and
37248
36853
  * `this.__originalMappings` properties).
37249
36854
  */
37250
- SourceMapConsumer$1.prototype._parseMappings =
36855
+ SourceMapConsumer.prototype._parseMappings =
37251
36856
  function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
37252
36857
  throw new Error("Subclasses must implement _parseMappings");
37253
36858
  };
37254
36859
 
37255
- SourceMapConsumer$1.GENERATED_ORDER = 1;
37256
- SourceMapConsumer$1.ORIGINAL_ORDER = 2;
36860
+ SourceMapConsumer.GENERATED_ORDER = 1;
36861
+ SourceMapConsumer.ORIGINAL_ORDER = 2;
37257
36862
 
37258
- SourceMapConsumer$1.GREATEST_LOWER_BOUND = 1;
37259
- SourceMapConsumer$1.LEAST_UPPER_BOUND = 2;
36863
+ SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
36864
+ SourceMapConsumer.LEAST_UPPER_BOUND = 2;
37260
36865
 
37261
36866
  /**
37262
36867
  * Iterate over each mapping between an original source/line/column and a
@@ -37274,17 +36879,17 @@ SourceMapConsumer$1.LEAST_UPPER_BOUND = 2;
37274
36879
  * order or the original's source/line/column order, respectively. Defaults to
37275
36880
  * `SourceMapConsumer.GENERATED_ORDER`.
37276
36881
  */
37277
- SourceMapConsumer$1.prototype.eachMapping =
36882
+ SourceMapConsumer.prototype.eachMapping =
37278
36883
  function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
37279
36884
  var context = aContext || null;
37280
- var order = aOrder || SourceMapConsumer$1.GENERATED_ORDER;
36885
+ var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
37281
36886
 
37282
36887
  var mappings;
37283
36888
  switch (order) {
37284
- case SourceMapConsumer$1.GENERATED_ORDER:
36889
+ case SourceMapConsumer.GENERATED_ORDER:
37285
36890
  mappings = this._generatedMappings;
37286
36891
  break;
37287
- case SourceMapConsumer$1.ORIGINAL_ORDER:
36892
+ case SourceMapConsumer.ORIGINAL_ORDER:
37288
36893
  mappings = this._originalMappings;
37289
36894
  break;
37290
36895
  default:
@@ -37292,18 +36897,24 @@ SourceMapConsumer$1.prototype.eachMapping =
37292
36897
  }
37293
36898
 
37294
36899
  var sourceRoot = this.sourceRoot;
37295
- mappings.map(function (mapping) {
37296
- var source = mapping.source === null ? null : this._sources.at(mapping.source);
37297
- source = util$1.computeSourceURL(sourceRoot, source, this._sourceMapURL);
37298
- return {
36900
+ var boundCallback = aCallback.bind(context);
36901
+ var names = this._names;
36902
+ var sources = this._sources;
36903
+ var sourceMapURL = this._sourceMapURL;
36904
+
36905
+ for (var i = 0, n = mappings.length; i < n; i++) {
36906
+ var mapping = mappings[i];
36907
+ var source = mapping.source === null ? null : sources.at(mapping.source);
36908
+ source = util.computeSourceURL(sourceRoot, source, sourceMapURL);
36909
+ boundCallback({
37299
36910
  source: source,
37300
36911
  generatedLine: mapping.generatedLine,
37301
36912
  generatedColumn: mapping.generatedColumn,
37302
36913
  originalLine: mapping.originalLine,
37303
36914
  originalColumn: mapping.originalColumn,
37304
- name: mapping.name === null ? null : this._names.at(mapping.name)
37305
- };
37306
- }, this).forEach(aCallback, context);
36915
+ name: mapping.name === null ? null : names.at(mapping.name)
36916
+ });
36917
+ }
37307
36918
  };
37308
36919
 
37309
36920
  /**
@@ -37328,18 +36939,18 @@ SourceMapConsumer$1.prototype.eachMapping =
37328
36939
  * - column: The column number in the generated source, or null.
37329
36940
  * The column number is 0-based.
37330
36941
  */
37331
- SourceMapConsumer$1.prototype.allGeneratedPositionsFor =
36942
+ SourceMapConsumer.prototype.allGeneratedPositionsFor =
37332
36943
  function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
37333
- var line = util$1.getArg(aArgs, 'line');
36944
+ var line = util.getArg(aArgs, 'line');
37334
36945
 
37335
36946
  // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
37336
36947
  // returns the index of the closest mapping less than the needle. By
37337
36948
  // setting needle.originalColumn to 0, we thus find the last mapping for
37338
36949
  // the given line, provided such a mapping exists.
37339
36950
  var needle = {
37340
- source: util$1.getArg(aArgs, 'source'),
36951
+ source: util.getArg(aArgs, 'source'),
37341
36952
  originalLine: line,
37342
- originalColumn: util$1.getArg(aArgs, 'column', 0)
36953
+ originalColumn: util.getArg(aArgs, 'column', 0)
37343
36954
  };
37344
36955
 
37345
36956
  needle.source = this._findSourceIndex(needle.source);
@@ -37353,7 +36964,7 @@ SourceMapConsumer$1.prototype.allGeneratedPositionsFor =
37353
36964
  this._originalMappings,
37354
36965
  "originalLine",
37355
36966
  "originalColumn",
37356
- util$1.compareByOriginalPositions,
36967
+ util.compareByOriginalPositions,
37357
36968
  binarySearch.LEAST_UPPER_BOUND);
37358
36969
  if (index >= 0) {
37359
36970
  var mapping = this._originalMappings[index];
@@ -37367,9 +36978,9 @@ SourceMapConsumer$1.prototype.allGeneratedPositionsFor =
37367
36978
  // the line we found.
37368
36979
  while (mapping && mapping.originalLine === originalLine) {
37369
36980
  mappings.push({
37370
- line: util$1.getArg(mapping, 'generatedLine', null),
37371
- column: util$1.getArg(mapping, 'generatedColumn', null),
37372
- lastColumn: util$1.getArg(mapping, 'lastGeneratedColumn', null)
36981
+ line: util.getArg(mapping, 'generatedLine', null),
36982
+ column: util.getArg(mapping, 'generatedColumn', null),
36983
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
37373
36984
  });
37374
36985
 
37375
36986
  mapping = this._originalMappings[++index];
@@ -37385,9 +36996,9 @@ SourceMapConsumer$1.prototype.allGeneratedPositionsFor =
37385
36996
  mapping.originalLine === line &&
37386
36997
  mapping.originalColumn == originalColumn) {
37387
36998
  mappings.push({
37388
- line: util$1.getArg(mapping, 'generatedLine', null),
37389
- column: util$1.getArg(mapping, 'generatedColumn', null),
37390
- lastColumn: util$1.getArg(mapping, 'lastGeneratedColumn', null)
36999
+ line: util.getArg(mapping, 'generatedLine', null),
37000
+ column: util.getArg(mapping, 'generatedColumn', null),
37001
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
37391
37002
  });
37392
37003
 
37393
37004
  mapping = this._originalMappings[++index];
@@ -37398,7 +37009,7 @@ SourceMapConsumer$1.prototype.allGeneratedPositionsFor =
37398
37009
  return mappings;
37399
37010
  };
37400
37011
 
37401
- sourceMapConsumer.SourceMapConsumer = SourceMapConsumer$1;
37012
+ var SourceMapConsumer_1 = SourceMapConsumer;
37402
37013
 
37403
37014
  /**
37404
37015
  * A BasicSourceMapConsumer instance represents a parsed source map which we can
@@ -37437,18 +37048,18 @@ sourceMapConsumer.SourceMapConsumer = SourceMapConsumer$1;
37437
37048
  function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
37438
37049
  var sourceMap = aSourceMap;
37439
37050
  if (typeof aSourceMap === 'string') {
37440
- sourceMap = util$1.parseSourceMapInput(aSourceMap);
37051
+ sourceMap = util.parseSourceMapInput(aSourceMap);
37441
37052
  }
37442
37053
 
37443
- var version = util$1.getArg(sourceMap, 'version');
37444
- var sources = util$1.getArg(sourceMap, 'sources');
37054
+ var version = util.getArg(sourceMap, 'version');
37055
+ var sources = util.getArg(sourceMap, 'sources');
37445
37056
  // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
37446
37057
  // requires the array) to play nice here.
37447
- var names = util$1.getArg(sourceMap, 'names', []);
37448
- var sourceRoot = util$1.getArg(sourceMap, 'sourceRoot', null);
37449
- var sourcesContent = util$1.getArg(sourceMap, 'sourcesContent', null);
37450
- var mappings = util$1.getArg(sourceMap, 'mappings');
37451
- var file = util$1.getArg(sourceMap, 'file', null);
37058
+ var names = util.getArg(sourceMap, 'names', []);
37059
+ var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
37060
+ var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
37061
+ var mappings = util.getArg(sourceMap, 'mappings');
37062
+ var file = util.getArg(sourceMap, 'file', null);
37452
37063
 
37453
37064
  // Once again, Sass deviates from the spec and supplies the version as a
37454
37065
  // string rather than a number, so we use loose equality checking here.
@@ -37457,7 +37068,7 @@ function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
37457
37068
  }
37458
37069
 
37459
37070
  if (sourceRoot) {
37460
- sourceRoot = util$1.normalize(sourceRoot);
37071
+ sourceRoot = util.normalize(sourceRoot);
37461
37072
  }
37462
37073
 
37463
37074
  sources = sources
@@ -37465,14 +37076,14 @@ function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
37465
37076
  // Some source maps produce relative source paths like "./foo.js" instead of
37466
37077
  // "foo.js". Normalize these first so that future comparisons will succeed.
37467
37078
  // See bugzil.la/1090768.
37468
- .map(util$1.normalize)
37079
+ .map(util.normalize)
37469
37080
  // Always ensure that absolute sources are internally stored relative to
37470
37081
  // the source root, if the source root is absolute. Not doing this would
37471
37082
  // be particularly problematic when the source root is a prefix of the
37472
37083
  // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
37473
37084
  .map(function (source) {
37474
- return sourceRoot && util$1.isAbsolute(sourceRoot) && util$1.isAbsolute(source)
37475
- ? util$1.relative(sourceRoot, source)
37085
+ return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
37086
+ ? util.relative(sourceRoot, source)
37476
37087
  : source;
37477
37088
  });
37478
37089
 
@@ -37484,7 +37095,7 @@ function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
37484
37095
  this._sources = ArraySet.fromArray(sources, true);
37485
37096
 
37486
37097
  this._absoluteSources = this._sources.toArray().map(function (s) {
37487
- return util$1.computeSourceURL(sourceRoot, s, aSourceMapURL);
37098
+ return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
37488
37099
  });
37489
37100
 
37490
37101
  this.sourceRoot = sourceRoot;
@@ -37494,8 +37105,8 @@ function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
37494
37105
  this.file = file;
37495
37106
  }
37496
37107
 
37497
- BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer$1.prototype);
37498
- BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer$1;
37108
+ BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
37109
+ BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
37499
37110
 
37500
37111
  /**
37501
37112
  * Utility function to find the index of a source. Returns -1 if not
@@ -37504,7 +37115,7 @@ BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer$1;
37504
37115
  BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
37505
37116
  var relativeSource = aSource;
37506
37117
  if (this.sourceRoot != null) {
37507
- relativeSource = util$1.relative(this.sourceRoot, relativeSource);
37118
+ relativeSource = util.relative(this.sourceRoot, relativeSource);
37508
37119
  }
37509
37120
 
37510
37121
  if (this._sources.has(relativeSource)) {
@@ -37544,7 +37155,7 @@ BasicSourceMapConsumer.fromSourceMap =
37544
37155
  smc.file = aSourceMap._file;
37545
37156
  smc._sourceMapURL = aSourceMapURL;
37546
37157
  smc._absoluteSources = smc._sources.toArray().map(function (s) {
37547
- return util$1.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
37158
+ return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
37548
37159
  });
37549
37160
 
37550
37161
  // Because we are modifying the entries (by converting string sources and
@@ -37577,7 +37188,7 @@ BasicSourceMapConsumer.fromSourceMap =
37577
37188
  destGeneratedMappings.push(destMapping);
37578
37189
  }
37579
37190
 
37580
- quickSort(smc.__originalMappings, util$1.compareByOriginalPositions);
37191
+ quickSort(smc.__originalMappings, util.compareByOriginalPositions);
37581
37192
 
37582
37193
  return smc;
37583
37194
  };
@@ -37613,6 +37224,36 @@ function Mapping() {
37613
37224
  * query (the ordered arrays in the `this.__generatedMappings` and
37614
37225
  * `this.__originalMappings` properties).
37615
37226
  */
37227
+
37228
+ const compareGenerated = util.compareByGeneratedPositionsDeflatedNoLine;
37229
+ function sortGenerated(array, start) {
37230
+ let l = array.length;
37231
+ let n = array.length - start;
37232
+ if (n <= 1) {
37233
+ return;
37234
+ } else if (n == 2) {
37235
+ let a = array[start];
37236
+ let b = array[start + 1];
37237
+ if (compareGenerated(a, b) > 0) {
37238
+ array[start] = b;
37239
+ array[start + 1] = a;
37240
+ }
37241
+ } else if (n < 20) {
37242
+ for (let i = start; i < l; i++) {
37243
+ for (let j = i; j > start; j--) {
37244
+ let a = array[j - 1];
37245
+ let b = array[j];
37246
+ if (compareGenerated(a, b) <= 0) {
37247
+ break;
37248
+ }
37249
+ array[j - 1] = b;
37250
+ array[j] = a;
37251
+ }
37252
+ }
37253
+ } else {
37254
+ quickSort(array, compareGenerated, start);
37255
+ }
37256
+ }
37616
37257
  BasicSourceMapConsumer.prototype._parseMappings =
37617
37258
  function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
37618
37259
  var generatedLine = 1;
@@ -37623,17 +37264,20 @@ BasicSourceMapConsumer.prototype._parseMappings =
37623
37264
  var previousName = 0;
37624
37265
  var length = aStr.length;
37625
37266
  var index = 0;
37626
- var cachedSegments = {};
37627
37267
  var temp = {};
37628
37268
  var originalMappings = [];
37629
37269
  var generatedMappings = [];
37630
- var mapping, str, segment, end, value;
37270
+ var mapping, segment, end, value;
37631
37271
 
37272
+ let subarrayStart = 0;
37632
37273
  while (index < length) {
37633
37274
  if (aStr.charAt(index) === ';') {
37634
37275
  generatedLine++;
37635
37276
  index++;
37636
37277
  previousGeneratedColumn = 0;
37278
+
37279
+ sortGenerated(generatedMappings, subarrayStart);
37280
+ subarrayStart = generatedMappings.length;
37637
37281
  }
37638
37282
  else if (aStr.charAt(index) === ',') {
37639
37283
  index++;
@@ -37642,39 +37286,27 @@ BasicSourceMapConsumer.prototype._parseMappings =
37642
37286
  mapping = new Mapping();
37643
37287
  mapping.generatedLine = generatedLine;
37644
37288
 
37645
- // Because each offset is encoded relative to the previous one,
37646
- // many segments often have the same encoding. We can exploit this
37647
- // fact by caching the parsed variable length fields of each segment,
37648
- // allowing us to avoid a second parse if we encounter the same
37649
- // segment again.
37650
37289
  for (end = index; end < length; end++) {
37651
37290
  if (this._charIsMappingSeparator(aStr, end)) {
37652
37291
  break;
37653
37292
  }
37654
37293
  }
37655
- str = aStr.slice(index, end);
37656
-
37657
- segment = cachedSegments[str];
37658
- if (segment) {
37659
- index += str.length;
37660
- } else {
37661
- segment = [];
37662
- while (index < end) {
37663
- base64VLQ.decode(aStr, index, temp);
37664
- value = temp.value;
37665
- index = temp.rest;
37666
- segment.push(value);
37667
- }
37294
+ aStr.slice(index, end);
37668
37295
 
37669
- if (segment.length === 2) {
37670
- throw new Error('Found a source, but no line and column');
37671
- }
37296
+ segment = [];
37297
+ while (index < end) {
37298
+ base64VLQ.decode(aStr, index, temp);
37299
+ value = temp.value;
37300
+ index = temp.rest;
37301
+ segment.push(value);
37302
+ }
37672
37303
 
37673
- if (segment.length === 3) {
37674
- throw new Error('Found a source and line, but no column');
37675
- }
37304
+ if (segment.length === 2) {
37305
+ throw new Error('Found a source, but no line and column');
37306
+ }
37676
37307
 
37677
- cachedSegments[str] = segment;
37308
+ if (segment.length === 3) {
37309
+ throw new Error('Found a source and line, but no column');
37678
37310
  }
37679
37311
 
37680
37312
  // Generated column.
@@ -37705,16 +37337,27 @@ BasicSourceMapConsumer.prototype._parseMappings =
37705
37337
 
37706
37338
  generatedMappings.push(mapping);
37707
37339
  if (typeof mapping.originalLine === 'number') {
37708
- originalMappings.push(mapping);
37340
+ let currentSource = mapping.source;
37341
+ while (originalMappings.length <= currentSource) {
37342
+ originalMappings.push(null);
37343
+ }
37344
+ if (originalMappings[currentSource] === null) {
37345
+ originalMappings[currentSource] = [];
37346
+ }
37347
+ originalMappings[currentSource].push(mapping);
37709
37348
  }
37710
37349
  }
37711
37350
  }
37712
37351
 
37713
- quickSort(generatedMappings, util$1.compareByGeneratedPositionsDeflated);
37352
+ sortGenerated(generatedMappings, subarrayStart);
37714
37353
  this.__generatedMappings = generatedMappings;
37715
37354
 
37716
- quickSort(originalMappings, util$1.compareByOriginalPositions);
37717
- this.__originalMappings = originalMappings;
37355
+ for (var i = 0; i < originalMappings.length; i++) {
37356
+ if (originalMappings[i] != null) {
37357
+ quickSort(originalMappings[i], util.compareByOriginalPositionsNoSource);
37358
+ }
37359
+ }
37360
+ this.__originalMappings = [].concat(...originalMappings);
37718
37361
  };
37719
37362
 
37720
37363
  /**
@@ -37795,8 +37438,8 @@ BasicSourceMapConsumer.prototype.computeColumnSpans =
37795
37438
  BasicSourceMapConsumer.prototype.originalPositionFor =
37796
37439
  function SourceMapConsumer_originalPositionFor(aArgs) {
37797
37440
  var needle = {
37798
- generatedLine: util$1.getArg(aArgs, 'line'),
37799
- generatedColumn: util$1.getArg(aArgs, 'column')
37441
+ generatedLine: util.getArg(aArgs, 'line'),
37442
+ generatedColumn: util.getArg(aArgs, 'column')
37800
37443
  };
37801
37444
 
37802
37445
  var index = this._findMapping(
@@ -37804,27 +37447,27 @@ BasicSourceMapConsumer.prototype.originalPositionFor =
37804
37447
  this._generatedMappings,
37805
37448
  "generatedLine",
37806
37449
  "generatedColumn",
37807
- util$1.compareByGeneratedPositionsDeflated,
37808
- util$1.getArg(aArgs, 'bias', SourceMapConsumer$1.GREATEST_LOWER_BOUND)
37450
+ util.compareByGeneratedPositionsDeflated,
37451
+ util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
37809
37452
  );
37810
37453
 
37811
37454
  if (index >= 0) {
37812
37455
  var mapping = this._generatedMappings[index];
37813
37456
 
37814
37457
  if (mapping.generatedLine === needle.generatedLine) {
37815
- var source = util$1.getArg(mapping, 'source', null);
37458
+ var source = util.getArg(mapping, 'source', null);
37816
37459
  if (source !== null) {
37817
37460
  source = this._sources.at(source);
37818
- source = util$1.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
37461
+ source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
37819
37462
  }
37820
- var name = util$1.getArg(mapping, 'name', null);
37463
+ var name = util.getArg(mapping, 'name', null);
37821
37464
  if (name !== null) {
37822
37465
  name = this._names.at(name);
37823
37466
  }
37824
37467
  return {
37825
37468
  source: source,
37826
- line: util$1.getArg(mapping, 'originalLine', null),
37827
- column: util$1.getArg(mapping, 'originalColumn', null),
37469
+ line: util.getArg(mapping, 'originalLine', null),
37470
+ column: util.getArg(mapping, 'originalColumn', null),
37828
37471
  name: name
37829
37472
  };
37830
37473
  }
@@ -37869,12 +37512,12 @@ BasicSourceMapConsumer.prototype.sourceContentFor =
37869
37512
 
37870
37513
  var relativeSource = aSource;
37871
37514
  if (this.sourceRoot != null) {
37872
- relativeSource = util$1.relative(this.sourceRoot, relativeSource);
37515
+ relativeSource = util.relative(this.sourceRoot, relativeSource);
37873
37516
  }
37874
37517
 
37875
37518
  var url;
37876
37519
  if (this.sourceRoot != null
37877
- && (url = util$1.urlParse(this.sourceRoot))) {
37520
+ && (url = util.urlParse(this.sourceRoot))) {
37878
37521
  // XXX: file:// URIs and absolute paths lead to unexpected behavior for
37879
37522
  // many users. We can help them out when they expect file:// URIs to
37880
37523
  // behave like it would if they were running a local HTTP server. See
@@ -37928,7 +37571,7 @@ BasicSourceMapConsumer.prototype.sourceContentFor =
37928
37571
  */
37929
37572
  BasicSourceMapConsumer.prototype.generatedPositionFor =
37930
37573
  function SourceMapConsumer_generatedPositionFor(aArgs) {
37931
- var source = util$1.getArg(aArgs, 'source');
37574
+ var source = util.getArg(aArgs, 'source');
37932
37575
  source = this._findSourceIndex(source);
37933
37576
  if (source < 0) {
37934
37577
  return {
@@ -37940,8 +37583,8 @@ BasicSourceMapConsumer.prototype.generatedPositionFor =
37940
37583
 
37941
37584
  var needle = {
37942
37585
  source: source,
37943
- originalLine: util$1.getArg(aArgs, 'line'),
37944
- originalColumn: util$1.getArg(aArgs, 'column')
37586
+ originalLine: util.getArg(aArgs, 'line'),
37587
+ originalColumn: util.getArg(aArgs, 'column')
37945
37588
  };
37946
37589
 
37947
37590
  var index = this._findMapping(
@@ -37949,8 +37592,8 @@ BasicSourceMapConsumer.prototype.generatedPositionFor =
37949
37592
  this._originalMappings,
37950
37593
  "originalLine",
37951
37594
  "originalColumn",
37952
- util$1.compareByOriginalPositions,
37953
- util$1.getArg(aArgs, 'bias', SourceMapConsumer$1.GREATEST_LOWER_BOUND)
37595
+ util.compareByOriginalPositions,
37596
+ util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
37954
37597
  );
37955
37598
 
37956
37599
  if (index >= 0) {
@@ -37958,9 +37601,9 @@ BasicSourceMapConsumer.prototype.generatedPositionFor =
37958
37601
 
37959
37602
  if (mapping.source === needle.source) {
37960
37603
  return {
37961
- line: util$1.getArg(mapping, 'generatedLine', null),
37962
- column: util$1.getArg(mapping, 'generatedColumn', null),
37963
- lastColumn: util$1.getArg(mapping, 'lastGeneratedColumn', null)
37604
+ line: util.getArg(mapping, 'generatedLine', null),
37605
+ column: util.getArg(mapping, 'generatedColumn', null),
37606
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
37964
37607
  };
37965
37608
  }
37966
37609
  }
@@ -37972,8 +37615,6 @@ BasicSourceMapConsumer.prototype.generatedPositionFor =
37972
37615
  };
37973
37616
  };
37974
37617
 
37975
- sourceMapConsumer.BasicSourceMapConsumer = BasicSourceMapConsumer;
37976
-
37977
37618
  /**
37978
37619
  * An IndexedSourceMapConsumer instance represents a parsed source map which
37979
37620
  * we can query for information. It differs from BasicSourceMapConsumer in
@@ -38026,11 +37667,11 @@ sourceMapConsumer.BasicSourceMapConsumer = BasicSourceMapConsumer;
38026
37667
  function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
38027
37668
  var sourceMap = aSourceMap;
38028
37669
  if (typeof aSourceMap === 'string') {
38029
- sourceMap = util$1.parseSourceMapInput(aSourceMap);
37670
+ sourceMap = util.parseSourceMapInput(aSourceMap);
38030
37671
  }
38031
37672
 
38032
- var version = util$1.getArg(sourceMap, 'version');
38033
- var sections = util$1.getArg(sourceMap, 'sections');
37673
+ var version = util.getArg(sourceMap, 'version');
37674
+ var sections = util.getArg(sourceMap, 'sections');
38034
37675
 
38035
37676
  if (version != this._version) {
38036
37677
  throw new Error('Unsupported version: ' + version);
@@ -38049,9 +37690,9 @@ function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
38049
37690
  // See https://github.com/mozilla/source-map/issues/16
38050
37691
  throw new Error('Support for url field in sections not implemented.');
38051
37692
  }
38052
- var offset = util$1.getArg(s, 'offset');
38053
- var offsetLine = util$1.getArg(offset, 'line');
38054
- var offsetColumn = util$1.getArg(offset, 'column');
37693
+ var offset = util.getArg(s, 'offset');
37694
+ var offsetLine = util.getArg(offset, 'line');
37695
+ var offsetColumn = util.getArg(offset, 'column');
38055
37696
 
38056
37697
  if (offsetLine < lastOffset.line ||
38057
37698
  (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
@@ -38066,13 +37707,13 @@ function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
38066
37707
  generatedLine: offsetLine + 1,
38067
37708
  generatedColumn: offsetColumn + 1
38068
37709
  },
38069
- consumer: new SourceMapConsumer$1(util$1.getArg(s, 'map'), aSourceMapURL)
37710
+ consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)
38070
37711
  }
38071
37712
  });
38072
37713
  }
38073
37714
 
38074
- IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer$1.prototype);
38075
- IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer$1;
37715
+ IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
37716
+ IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
38076
37717
 
38077
37718
  /**
38078
37719
  * The version of the source mapping spec that we are consuming.
@@ -38116,8 +37757,8 @@ Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
38116
37757
  IndexedSourceMapConsumer.prototype.originalPositionFor =
38117
37758
  function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
38118
37759
  var needle = {
38119
- generatedLine: util$1.getArg(aArgs, 'line'),
38120
- generatedColumn: util$1.getArg(aArgs, 'column')
37760
+ generatedLine: util.getArg(aArgs, 'line'),
37761
+ generatedColumn: util.getArg(aArgs, 'column')
38121
37762
  };
38122
37763
 
38123
37764
  // Find the section containing the generated position we're trying to map
@@ -38213,7 +37854,7 @@ IndexedSourceMapConsumer.prototype.generatedPositionFor =
38213
37854
 
38214
37855
  // Only consider this section if the requested source is in the list of
38215
37856
  // sources of the consumer.
38216
- if (section.consumer._findSourceIndex(util$1.getArg(aArgs, 'source')) === -1) {
37857
+ if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {
38217
37858
  continue;
38218
37859
  }
38219
37860
  var generatedPosition = section.consumer.generatedPositionFor(aArgs);
@@ -38252,7 +37893,7 @@ IndexedSourceMapConsumer.prototype._parseMappings =
38252
37893
  var mapping = sectionMappings[j];
38253
37894
 
38254
37895
  var source = section.consumer._sources.at(mapping.source);
38255
- source = util$1.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
37896
+ source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
38256
37897
  this._sources.add(source);
38257
37898
  source = this._sources.indexOf(source);
38258
37899
 
@@ -38287,432 +37928,10 @@ IndexedSourceMapConsumer.prototype._parseMappings =
38287
37928
  }
38288
37929
  }
38289
37930
 
38290
- quickSort(this.__generatedMappings, util$1.compareByGeneratedPositionsDeflated);
38291
- quickSort(this.__originalMappings, util$1.compareByOriginalPositions);
37931
+ quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
37932
+ quickSort(this.__originalMappings, util.compareByOriginalPositions);
38292
37933
  };
38293
37934
 
38294
- sourceMapConsumer.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
38295
-
38296
- /* -*- Mode: js; js-indent-level: 2; -*- */
38297
-
38298
- /*
38299
- * Copyright 2011 Mozilla Foundation and contributors
38300
- * Licensed under the New BSD license. See LICENSE or:
38301
- * http://opensource.org/licenses/BSD-3-Clause
38302
- */
38303
-
38304
- var SourceMapGenerator = sourceMapGenerator.SourceMapGenerator;
38305
- var util = util$5;
38306
-
38307
- // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
38308
- // operating systems these days (capturing the result).
38309
- var REGEX_NEWLINE = /(\r?\n)/;
38310
-
38311
- // Newline character code for charCodeAt() comparisons
38312
- var NEWLINE_CODE = 10;
38313
-
38314
- // Private symbol for identifying `SourceNode`s when multiple versions of
38315
- // the source-map library are loaded. This MUST NOT CHANGE across
38316
- // versions!
38317
- var isSourceNode = "$$$isSourceNode$$$";
38318
-
38319
- /**
38320
- * SourceNodes provide a way to abstract over interpolating/concatenating
38321
- * snippets of generated JavaScript source code while maintaining the line and
38322
- * column information associated with the original source code.
38323
- *
38324
- * @param aLine The original line number.
38325
- * @param aColumn The original column number.
38326
- * @param aSource The original source's filename.
38327
- * @param aChunks Optional. An array of strings which are snippets of
38328
- * generated JS, or other SourceNodes.
38329
- * @param aName The original identifier.
38330
- */
38331
- function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
38332
- this.children = [];
38333
- this.sourceContents = {};
38334
- this.line = aLine == null ? null : aLine;
38335
- this.column = aColumn == null ? null : aColumn;
38336
- this.source = aSource == null ? null : aSource;
38337
- this.name = aName == null ? null : aName;
38338
- this[isSourceNode] = true;
38339
- if (aChunks != null) this.add(aChunks);
38340
- }
38341
-
38342
- /**
38343
- * Creates a SourceNode from generated code and a SourceMapConsumer.
38344
- *
38345
- * @param aGeneratedCode The generated code
38346
- * @param aSourceMapConsumer The SourceMap for the generated code
38347
- * @param aRelativePath Optional. The path that relative sources in the
38348
- * SourceMapConsumer should be relative to.
38349
- */
38350
- SourceNode.fromStringWithSourceMap =
38351
- function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
38352
- // The SourceNode we want to fill with the generated code
38353
- // and the SourceMap
38354
- var node = new SourceNode();
38355
-
38356
- // All even indices of this array are one line of the generated code,
38357
- // while all odd indices are the newlines between two adjacent lines
38358
- // (since `REGEX_NEWLINE` captures its match).
38359
- // Processed fragments are accessed by calling `shiftNextLine`.
38360
- var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
38361
- var remainingLinesIndex = 0;
38362
- var shiftNextLine = function() {
38363
- var lineContents = getNextLine();
38364
- // The last line of a file might not have a newline.
38365
- var newLine = getNextLine() || "";
38366
- return lineContents + newLine;
38367
-
38368
- function getNextLine() {
38369
- return remainingLinesIndex < remainingLines.length ?
38370
- remainingLines[remainingLinesIndex++] : undefined;
38371
- }
38372
- };
38373
-
38374
- // We need to remember the position of "remainingLines"
38375
- var lastGeneratedLine = 1, lastGeneratedColumn = 0;
38376
-
38377
- // The generate SourceNodes we need a code range.
38378
- // To extract it current and last mapping is used.
38379
- // Here we store the last mapping.
38380
- var lastMapping = null;
38381
-
38382
- aSourceMapConsumer.eachMapping(function (mapping) {
38383
- if (lastMapping !== null) {
38384
- // We add the code from "lastMapping" to "mapping":
38385
- // First check if there is a new line in between.
38386
- if (lastGeneratedLine < mapping.generatedLine) {
38387
- // Associate first line with "lastMapping"
38388
- addMappingWithCode(lastMapping, shiftNextLine());
38389
- lastGeneratedLine++;
38390
- lastGeneratedColumn = 0;
38391
- // The remaining code is added without mapping
38392
- } else {
38393
- // There is no new line in between.
38394
- // Associate the code between "lastGeneratedColumn" and
38395
- // "mapping.generatedColumn" with "lastMapping"
38396
- var nextLine = remainingLines[remainingLinesIndex] || '';
38397
- var code = nextLine.substr(0, mapping.generatedColumn -
38398
- lastGeneratedColumn);
38399
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
38400
- lastGeneratedColumn);
38401
- lastGeneratedColumn = mapping.generatedColumn;
38402
- addMappingWithCode(lastMapping, code);
38403
- // No more remaining code, continue
38404
- lastMapping = mapping;
38405
- return;
38406
- }
38407
- }
38408
- // We add the generated code until the first mapping
38409
- // to the SourceNode without any mapping.
38410
- // Each line is added as separate string.
38411
- while (lastGeneratedLine < mapping.generatedLine) {
38412
- node.add(shiftNextLine());
38413
- lastGeneratedLine++;
38414
- }
38415
- if (lastGeneratedColumn < mapping.generatedColumn) {
38416
- var nextLine = remainingLines[remainingLinesIndex] || '';
38417
- node.add(nextLine.substr(0, mapping.generatedColumn));
38418
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
38419
- lastGeneratedColumn = mapping.generatedColumn;
38420
- }
38421
- lastMapping = mapping;
38422
- }, this);
38423
- // We have processed all mappings.
38424
- if (remainingLinesIndex < remainingLines.length) {
38425
- if (lastMapping) {
38426
- // Associate the remaining code in the current line with "lastMapping"
38427
- addMappingWithCode(lastMapping, shiftNextLine());
38428
- }
38429
- // and add the remaining lines without any mapping
38430
- node.add(remainingLines.splice(remainingLinesIndex).join(""));
38431
- }
38432
-
38433
- // Copy sourcesContent into SourceNode
38434
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
38435
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
38436
- if (content != null) {
38437
- if (aRelativePath != null) {
38438
- sourceFile = util.join(aRelativePath, sourceFile);
38439
- }
38440
- node.setSourceContent(sourceFile, content);
38441
- }
38442
- });
38443
-
38444
- return node;
38445
-
38446
- function addMappingWithCode(mapping, code) {
38447
- if (mapping === null || mapping.source === undefined) {
38448
- node.add(code);
38449
- } else {
38450
- var source = aRelativePath
38451
- ? util.join(aRelativePath, mapping.source)
38452
- : mapping.source;
38453
- node.add(new SourceNode(mapping.originalLine,
38454
- mapping.originalColumn,
38455
- source,
38456
- code,
38457
- mapping.name));
38458
- }
38459
- }
38460
- };
38461
-
38462
- /**
38463
- * Add a chunk of generated JS to this source node.
38464
- *
38465
- * @param aChunk A string snippet of generated JS code, another instance of
38466
- * SourceNode, or an array where each member is one of those things.
38467
- */
38468
- SourceNode.prototype.add = function SourceNode_add(aChunk) {
38469
- if (Array.isArray(aChunk)) {
38470
- aChunk.forEach(function (chunk) {
38471
- this.add(chunk);
38472
- }, this);
38473
- }
38474
- else if (aChunk[isSourceNode] || typeof aChunk === "string") {
38475
- if (aChunk) {
38476
- this.children.push(aChunk);
38477
- }
38478
- }
38479
- else {
38480
- throw new TypeError(
38481
- "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
38482
- );
38483
- }
38484
- return this;
38485
- };
38486
-
38487
- /**
38488
- * Add a chunk of generated JS to the beginning of this source node.
38489
- *
38490
- * @param aChunk A string snippet of generated JS code, another instance of
38491
- * SourceNode, or an array where each member is one of those things.
38492
- */
38493
- SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
38494
- if (Array.isArray(aChunk)) {
38495
- for (var i = aChunk.length-1; i >= 0; i--) {
38496
- this.prepend(aChunk[i]);
38497
- }
38498
- }
38499
- else if (aChunk[isSourceNode] || typeof aChunk === "string") {
38500
- this.children.unshift(aChunk);
38501
- }
38502
- else {
38503
- throw new TypeError(
38504
- "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
38505
- );
38506
- }
38507
- return this;
38508
- };
38509
-
38510
- /**
38511
- * Walk over the tree of JS snippets in this node and its children. The
38512
- * walking function is called once for each snippet of JS and is passed that
38513
- * snippet and the its original associated source's line/column location.
38514
- *
38515
- * @param aFn The traversal function.
38516
- */
38517
- SourceNode.prototype.walk = function SourceNode_walk(aFn) {
38518
- var chunk;
38519
- for (var i = 0, len = this.children.length; i < len; i++) {
38520
- chunk = this.children[i];
38521
- if (chunk[isSourceNode]) {
38522
- chunk.walk(aFn);
38523
- }
38524
- else {
38525
- if (chunk !== '') {
38526
- aFn(chunk, { source: this.source,
38527
- line: this.line,
38528
- column: this.column,
38529
- name: this.name });
38530
- }
38531
- }
38532
- }
38533
- };
38534
-
38535
- /**
38536
- * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
38537
- * each of `this.children`.
38538
- *
38539
- * @param aSep The separator.
38540
- */
38541
- SourceNode.prototype.join = function SourceNode_join(aSep) {
38542
- var newChildren;
38543
- var i;
38544
- var len = this.children.length;
38545
- if (len > 0) {
38546
- newChildren = [];
38547
- for (i = 0; i < len-1; i++) {
38548
- newChildren.push(this.children[i]);
38549
- newChildren.push(aSep);
38550
- }
38551
- newChildren.push(this.children[i]);
38552
- this.children = newChildren;
38553
- }
38554
- return this;
38555
- };
38556
-
38557
- /**
38558
- * Call String.prototype.replace on the very right-most source snippet. Useful
38559
- * for trimming whitespace from the end of a source node, etc.
38560
- *
38561
- * @param aPattern The pattern to replace.
38562
- * @param aReplacement The thing to replace the pattern with.
38563
- */
38564
- SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
38565
- var lastChild = this.children[this.children.length - 1];
38566
- if (lastChild[isSourceNode]) {
38567
- lastChild.replaceRight(aPattern, aReplacement);
38568
- }
38569
- else if (typeof lastChild === 'string') {
38570
- this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
38571
- }
38572
- else {
38573
- this.children.push(''.replace(aPattern, aReplacement));
38574
- }
38575
- return this;
38576
- };
38577
-
38578
- /**
38579
- * Set the source content for a source file. This will be added to the SourceMapGenerator
38580
- * in the sourcesContent field.
38581
- *
38582
- * @param aSourceFile The filename of the source file
38583
- * @param aSourceContent The content of the source file
38584
- */
38585
- SourceNode.prototype.setSourceContent =
38586
- function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
38587
- this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
38588
- };
38589
-
38590
- /**
38591
- * Walk over the tree of SourceNodes. The walking function is called for each
38592
- * source file content and is passed the filename and source content.
38593
- *
38594
- * @param aFn The traversal function.
38595
- */
38596
- SourceNode.prototype.walkSourceContents =
38597
- function SourceNode_walkSourceContents(aFn) {
38598
- for (var i = 0, len = this.children.length; i < len; i++) {
38599
- if (this.children[i][isSourceNode]) {
38600
- this.children[i].walkSourceContents(aFn);
38601
- }
38602
- }
38603
-
38604
- var sources = Object.keys(this.sourceContents);
38605
- for (var i = 0, len = sources.length; i < len; i++) {
38606
- aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
38607
- }
38608
- };
38609
-
38610
- /**
38611
- * Return the string representation of this source node. Walks over the tree
38612
- * and concatenates all the various snippets together to one string.
38613
- */
38614
- SourceNode.prototype.toString = function SourceNode_toString() {
38615
- var str = "";
38616
- this.walk(function (chunk) {
38617
- str += chunk;
38618
- });
38619
- return str;
38620
- };
38621
-
38622
- /**
38623
- * Returns the string representation of this source node along with a source
38624
- * map.
38625
- */
38626
- SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
38627
- var generated = {
38628
- code: "",
38629
- line: 1,
38630
- column: 0
38631
- };
38632
- var map = new SourceMapGenerator(aArgs);
38633
- var sourceMappingActive = false;
38634
- var lastOriginalSource = null;
38635
- var lastOriginalLine = null;
38636
- var lastOriginalColumn = null;
38637
- var lastOriginalName = null;
38638
- this.walk(function (chunk, original) {
38639
- generated.code += chunk;
38640
- if (original.source !== null
38641
- && original.line !== null
38642
- && original.column !== null) {
38643
- if(lastOriginalSource !== original.source
38644
- || lastOriginalLine !== original.line
38645
- || lastOriginalColumn !== original.column
38646
- || lastOriginalName !== original.name) {
38647
- map.addMapping({
38648
- source: original.source,
38649
- original: {
38650
- line: original.line,
38651
- column: original.column
38652
- },
38653
- generated: {
38654
- line: generated.line,
38655
- column: generated.column
38656
- },
38657
- name: original.name
38658
- });
38659
- }
38660
- lastOriginalSource = original.source;
38661
- lastOriginalLine = original.line;
38662
- lastOriginalColumn = original.column;
38663
- lastOriginalName = original.name;
38664
- sourceMappingActive = true;
38665
- } else if (sourceMappingActive) {
38666
- map.addMapping({
38667
- generated: {
38668
- line: generated.line,
38669
- column: generated.column
38670
- }
38671
- });
38672
- lastOriginalSource = null;
38673
- sourceMappingActive = false;
38674
- }
38675
- for (var idx = 0, length = chunk.length; idx < length; idx++) {
38676
- if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
38677
- generated.line++;
38678
- generated.column = 0;
38679
- // Mappings end at eol
38680
- if (idx + 1 === length) {
38681
- lastOriginalSource = null;
38682
- sourceMappingActive = false;
38683
- } else if (sourceMappingActive) {
38684
- map.addMapping({
38685
- source: original.source,
38686
- original: {
38687
- line: original.line,
38688
- column: original.column
38689
- },
38690
- generated: {
38691
- line: generated.line,
38692
- column: generated.column
38693
- },
38694
- name: original.name
38695
- });
38696
- }
38697
- } else {
38698
- generated.column++;
38699
- }
38700
- }
38701
- });
38702
- this.walkSourceContents(function (sourceFile, sourceContent) {
38703
- map.setSourceContent(sourceFile, sourceContent);
38704
- });
38705
-
38706
- return { code: generated.code, map: map };
38707
- };
38708
-
38709
- /*
38710
- * Copyright 2009-2011 Mozilla Foundation and contributors
38711
- * Licensed under the New BSD license. See LICENSE.txt or:
38712
- * http://opensource.org/licenses/BSD-3-Clause
38713
- */
38714
- var SourceMapConsumer = sourceMapConsumer.SourceMapConsumer;
38715
-
38716
37935
  /**
38717
37936
  * This file is refactored into TypeScript based on
38718
37937
  * https://github.com/preactjs/wmr/blob/main/packages/wmr/src/lib/rollup-plugin-container.js
@@ -38908,11 +38127,11 @@ async function createPluginContainer({ plugins, logger, root, build: { rollupOpt
38908
38127
  if (err.loc && ctx instanceof TransformContext) {
38909
38128
  const rawSourceMap = ctx._getCombinedSourcemap();
38910
38129
  if (rawSourceMap) {
38911
- const consumer = new SourceMapConsumer(rawSourceMap);
38130
+ const consumer = new SourceMapConsumer_1(rawSourceMap);
38912
38131
  const { source, line, column } = consumer.originalPositionFor({
38913
38132
  line: Number(err.loc.line),
38914
38133
  column: Number(err.loc.column),
38915
- bias: SourceMapConsumer.GREATEST_LOWER_BOUND
38134
+ bias: SourceMapConsumer_1.GREATEST_LOWER_BOUND
38916
38135
  });
38917
38136
  if (source) {
38918
38137
  err.loc = { file: source, line, column };
@@ -39605,8 +38824,7 @@ function loadFallbackPlugin() {
39605
38824
  };
39606
38825
  }
39607
38826
 
39608
- function resolveBuildOptions(root, raw, isBuild) {
39609
- var _a;
38827
+ function resolveBuildOptions(raw) {
39610
38828
  const resolved = {
39611
38829
  target: 'modules',
39612
38830
  polyfillModulePreload: true,
@@ -39641,35 +38859,6 @@ function resolveBuildOptions(root, raw, isBuild) {
39641
38859
  ...raw === null || raw === void 0 ? void 0 : raw.dynamicImportVarsOptions
39642
38860
  }
39643
38861
  };
39644
- const resolve = (p) => p.startsWith('\0') ? p : path__default.resolve(root, p);
39645
- resolved.outDir = resolve(resolved.outDir);
39646
- let input;
39647
- if ((_a = raw === null || raw === void 0 ? void 0 : raw.rollupOptions) === null || _a === void 0 ? void 0 : _a.input) {
39648
- input = Array.isArray(raw.rollupOptions.input)
39649
- ? raw.rollupOptions.input.map((input) => resolve(input))
39650
- : typeof raw.rollupOptions.input === 'object'
39651
- ? Object.fromEntries(Object.entries(raw.rollupOptions.input).map(([key, value]) => [
39652
- key,
39653
- resolve(value)
39654
- ]))
39655
- : resolve(raw.rollupOptions.input);
39656
- }
39657
- else if ((raw === null || raw === void 0 ? void 0 : raw.lib) && isBuild) {
39658
- input = resolve(raw.lib.entry);
39659
- }
39660
- else if (typeof (raw === null || raw === void 0 ? void 0 : raw.ssr) === 'string') {
39661
- input = resolve(raw.ssr);
39662
- }
39663
- else if (isBuild) {
39664
- input = resolve('index.html');
39665
- }
39666
- if (!!(raw === null || raw === void 0 ? void 0 : raw.ssr) && typeof input === 'string' && input.endsWith('.html')) {
39667
- throw new Error(`rollupOptions.input should not be an html file when building for SSR. ` +
39668
- `Please specify a dedicated SSR entry.`);
39669
- }
39670
- if (input) {
39671
- resolved.rollupOptions.input = input;
39672
- }
39673
38862
  // handle special build targets
39674
38863
  if (resolved.target === 'modules') {
39675
38864
  // Support browserslist
@@ -39749,18 +38938,27 @@ async function build(inlineConfig = {}) {
39749
38938
  }
39750
38939
  }
39751
38940
  async function doBuild(inlineConfig = {}) {
39752
- var _a, _b, _c;
38941
+ var _a, _b, _c, _d;
39753
38942
  const config = await resolveConfig(inlineConfig, 'build', 'production');
39754
38943
  const options = config.build;
39755
- const input = options.rollupOptions.input;
39756
- const outDir = options.outDir;
39757
38944
  const ssr = !!options.ssr;
39758
38945
  const libOptions = options.lib;
39759
38946
  config.logger.info(colors$1.cyan(`vite v${require('vite/package.json').version} ${colors$1.green(`building ${ssr ? `SSR bundle ` : ``}for ${config.mode}...`)}`));
38947
+ const resolve = (p) => path__default.resolve(config.root, p);
38948
+ const input = libOptions
38949
+ ? resolve(libOptions.entry)
38950
+ : typeof options.ssr === 'string'
38951
+ ? resolve(options.ssr)
38952
+ : ((_a = options.rollupOptions) === null || _a === void 0 ? void 0 : _a.input) || resolve('index.html');
38953
+ if (ssr && typeof input === 'string' && input.endsWith('.html')) {
38954
+ throw new Error(`rollupOptions.input should not be an html file when building for SSR. ` +
38955
+ `Please specify a dedicated SSR entry.`);
38956
+ }
38957
+ const outDir = resolve(options.outDir);
39760
38958
  // inject ssr arg to plugin load/transform hooks
39761
38959
  const plugins = (ssr ? config.plugins.map((p) => injectSsrFlagToHooks(p)) : config.plugins);
39762
38960
  // inject ssrExternal if present
39763
- const userExternal = (_a = options.rollupOptions) === null || _a === void 0 ? void 0 : _a.external;
38961
+ const userExternal = (_b = options.rollupOptions) === null || _b === void 0 ? void 0 : _b.external;
39764
38962
  let external = userExternal;
39765
38963
  if (ssr) {
39766
38964
  // see if we have cached deps data available
@@ -39779,6 +38977,7 @@ async function doBuild(inlineConfig = {}) {
39779
38977
  }
39780
38978
  const rollup = require('rollup');
39781
38979
  const rollupOptions = {
38980
+ input,
39782
38981
  context: 'globalThis',
39783
38982
  preserveEntrySignatures: ssr
39784
38983
  ? 'allow-extension'
@@ -39841,7 +39040,7 @@ async function doBuild(inlineConfig = {}) {
39841
39040
  };
39842
39041
  };
39843
39042
  // resolve lib mode outputs
39844
- const outputs = resolveBuildOutputs((_b = options.rollupOptions) === null || _b === void 0 ? void 0 : _b.output, libOptions, config.logger);
39043
+ const outputs = resolveBuildOutputs((_c = options.rollupOptions) === null || _c === void 0 ? void 0 : _c.output, libOptions, config.logger);
39845
39044
  // watch file changes with rollup
39846
39045
  if (config.build.watch) {
39847
39046
  config.logger.info(colors$1.cyan(`\nwatching for file changes...`));
@@ -39867,7 +39066,7 @@ async function doBuild(inlineConfig = {}) {
39867
39066
  ignored: [
39868
39067
  '**/node_modules/**',
39869
39068
  '**/.git/**',
39870
- ...(((_c = watcherOptions === null || watcherOptions === void 0 ? void 0 : watcherOptions.chokidar) === null || _c === void 0 ? void 0 : _c.ignored) || [])
39069
+ ...(((_d = watcherOptions === null || watcherOptions === void 0 ? void 0 : watcherOptions.chokidar) === null || _d === void 0 ? void 0 : _d.ignored) || [])
39871
39070
  ]
39872
39071
  }
39873
39072
  }
@@ -44046,7 +43245,15 @@ async _handleSymlink(entry, directory, path, item) {
44046
43245
  if (!this.fsw.options.followSymlinks) {
44047
43246
  // watch symlink directly (don't follow) and detect changes
44048
43247
  this.fsw._incrReadyCount();
44049
- 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
+
44050
43257
  if (this.fsw.closed) return;
44051
43258
  if (dir.has(item)) {
44052
43259
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
@@ -45829,7 +45036,7 @@ async function getCertificate(cacheDir) {
45829
45036
  return content;
45830
45037
  }
45831
45038
  catch {
45832
- const content = (await Promise.resolve().then(function () { return require('./dep-885d4c21.js'); })).createCertificate();
45039
+ const content = (await Promise.resolve().then(function () { return require('./dep-6a30742f.js'); })).createCertificate();
45833
45040
  fs$n.promises
45834
45041
  .mkdir(cacheDir, { recursive: true })
45835
45042
  .then(() => fs$n.promises.writeFile(cachePath, content))
@@ -46369,7 +45576,7 @@ class PerMessageDeflate$4 {
46369
45576
  /**
46370
45577
  * Compress data. Concurrency limited.
46371
45578
  *
46372
- * @param {Buffer} data Data to compress
45579
+ * @param {(Buffer|String)} data Data to compress
46373
45580
  * @param {Boolean} fin Specifies whether or not this is the last fragment
46374
45581
  * @param {Function} callback Callback
46375
45582
  * @public
@@ -46451,7 +45658,7 @@ class PerMessageDeflate$4 {
46451
45658
  /**
46452
45659
  * Compress data.
46453
45660
  *
46454
- * @param {Buffer} data Data to compress
45661
+ * @param {(Buffer|String)} data Data to compress
46455
45662
  * @param {Boolean} fin Specifies whether or not this is the last fragment
46456
45663
  * @param {Function} callback Callback
46457
45664
  * @private
@@ -47316,6 +46523,7 @@ const { EMPTY_BUFFER: EMPTY_BUFFER$1 } = constants;
47316
46523
  const { isValidStatusCode } = validation.exports;
47317
46524
  const { mask: applyMask, toBuffer: toBuffer$2 } = bufferUtil$1.exports;
47318
46525
 
46526
+ const kByteLength = Symbol('kByteLength');
47319
46527
  const maskBuffer = Buffer.alloc(4);
47320
46528
 
47321
46529
  /**
@@ -47351,7 +46559,7 @@ class Sender$1 {
47351
46559
  /**
47352
46560
  * Frames a piece of data according to the HyBi WebSocket protocol.
47353
46561
  *
47354
- * @param {Buffer} data The data to frame
46562
+ * @param {(Buffer|String)} data The data to frame
47355
46563
  * @param {Object} options Options object
47356
46564
  * @param {Boolean} [options.fin=false] Specifies whether or not to set the
47357
46565
  * FIN bit
@@ -47366,7 +46574,7 @@ class Sender$1 {
47366
46574
  * modified
47367
46575
  * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
47368
46576
  * RSV1 bit
47369
- * @return {Buffer[]} The framed data as a list of `Buffer` instances
46577
+ * @return {(Buffer|String)[]} The framed data
47370
46578
  * @public
47371
46579
  */
47372
46580
  static frame(data, options) {
@@ -47385,22 +46593,37 @@ class Sender$1 {
47385
46593
  }
47386
46594
 
47387
46595
  skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;
47388
- if (options.readOnly && !skipMasking) merge = true;
47389
-
47390
46596
  offset = 6;
47391
46597
  }
47392
46598
 
47393
- let payloadLength = data.length;
46599
+ let dataLength;
47394
46600
 
47395
- 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) {
47396
46619
  offset += 8;
47397
46620
  payloadLength = 127;
47398
- } else if (data.length > 125) {
46621
+ } else if (dataLength > 125) {
47399
46622
  offset += 2;
47400
46623
  payloadLength = 126;
47401
46624
  }
47402
46625
 
47403
- const target = Buffer.allocUnsafe(merge ? data.length + offset : offset);
46626
+ const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset);
47404
46627
 
47405
46628
  target[0] = options.fin ? options.opcode | 0x80 : options.opcode;
47406
46629
  if (options.rsv1) target[0] |= 0x40;
@@ -47408,10 +46631,10 @@ class Sender$1 {
47408
46631
  target[1] = payloadLength;
47409
46632
 
47410
46633
  if (payloadLength === 126) {
47411
- target.writeUInt16BE(data.length, 2);
46634
+ target.writeUInt16BE(dataLength, 2);
47412
46635
  } else if (payloadLength === 127) {
47413
46636
  target[2] = target[3] = 0;
47414
- target.writeUIntBE(data.length, 4, 6);
46637
+ target.writeUIntBE(dataLength, 4, 6);
47415
46638
  }
47416
46639
 
47417
46640
  if (!options.mask) return [target, data];
@@ -47425,11 +46648,11 @@ class Sender$1 {
47425
46648
  if (skipMasking) return [target, data];
47426
46649
 
47427
46650
  if (merge) {
47428
- applyMask(data, mask, target, offset, data.length);
46651
+ applyMask(data, mask, target, offset, dataLength);
47429
46652
  return [target];
47430
46653
  }
47431
46654
 
47432
- applyMask(data, mask, data, 0, data.length);
46655
+ applyMask(data, mask, data, 0, dataLength);
47433
46656
  return [target, data];
47434
46657
  }
47435
46658
 
@@ -47469,36 +46692,24 @@ class Sender$1 {
47469
46692
  }
47470
46693
  }
47471
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
+
47472
46706
  if (this._deflating) {
47473
- this.enqueue([this.doClose, buf, mask, cb]);
46707
+ this.enqueue([this.dispatch, buf, false, options, cb]);
47474
46708
  } else {
47475
- this.doClose(buf, mask, cb);
46709
+ this.sendFrame(Sender$1.frame(buf, options), cb);
47476
46710
  }
47477
46711
  }
47478
46712
 
47479
- /**
47480
- * Frames and sends a close message.
47481
- *
47482
- * @param {Buffer} data The message to send
47483
- * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
47484
- * @param {Function} [cb] Callback
47485
- * @private
47486
- */
47487
- doClose(data, mask, cb) {
47488
- this.sendFrame(
47489
- Sender$1.frame(data, {
47490
- fin: true,
47491
- rsv1: false,
47492
- opcode: 0x08,
47493
- mask,
47494
- maskBuffer: this._maskBuffer,
47495
- generateMask: this._generateMask,
47496
- readOnly: false
47497
- }),
47498
- cb
47499
- );
47500
- }
47501
-
47502
46713
  /**
47503
46714
  * Sends a ping message to the other peer.
47504
46715
  *
@@ -47508,43 +46719,40 @@ class Sender$1 {
47508
46719
  * @public
47509
46720
  */
47510
46721
  ping(data, mask, cb) {
47511
- const buf = toBuffer$2(data);
46722
+ let byteLength;
46723
+ let readOnly;
47512
46724
 
47513
- if (buf.length > 125) {
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
+ }
46733
+
46734
+ if (byteLength > 125) {
47514
46735
  throw new RangeError('The data size must not be greater than 125 bytes');
47515
46736
  }
47516
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
+
47517
46749
  if (this._deflating) {
47518
- this.enqueue([this.doPing, buf, mask, toBuffer$2.readOnly, cb]);
46750
+ this.enqueue([this.dispatch, data, false, options, cb]);
47519
46751
  } else {
47520
- this.doPing(buf, mask, toBuffer$2.readOnly, cb);
46752
+ this.sendFrame(Sender$1.frame(data, options), cb);
47521
46753
  }
47522
46754
  }
47523
46755
 
47524
- /**
47525
- * Frames and sends a ping message.
47526
- *
47527
- * @param {Buffer} data The message to send
47528
- * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
47529
- * @param {Boolean} [readOnly=false] Specifies whether `data` can be modified
47530
- * @param {Function} [cb] Callback
47531
- * @private
47532
- */
47533
- doPing(data, mask, readOnly, cb) {
47534
- this.sendFrame(
47535
- Sender$1.frame(data, {
47536
- fin: true,
47537
- rsv1: false,
47538
- opcode: 0x09,
47539
- mask,
47540
- maskBuffer: this._maskBuffer,
47541
- generateMask: this._generateMask,
47542
- readOnly
47543
- }),
47544
- cb
47545
- );
47546
- }
47547
-
47548
46756
  /**
47549
46757
  * Sends a pong message to the other peer.
47550
46758
  *
@@ -47554,43 +46762,40 @@ class Sender$1 {
47554
46762
  * @public
47555
46763
  */
47556
46764
  pong(data, mask, cb) {
47557
- const buf = toBuffer$2(data);
46765
+ let byteLength;
46766
+ let readOnly;
47558
46767
 
47559
- 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) {
47560
46778
  throw new RangeError('The data size must not be greater than 125 bytes');
47561
46779
  }
47562
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
+
47563
46792
  if (this._deflating) {
47564
- this.enqueue([this.doPong, buf, mask, toBuffer$2.readOnly, cb]);
46793
+ this.enqueue([this.dispatch, data, false, options, cb]);
47565
46794
  } else {
47566
- this.doPong(buf, mask, toBuffer$2.readOnly, cb);
46795
+ this.sendFrame(Sender$1.frame(data, options), cb);
47567
46796
  }
47568
46797
  }
47569
46798
 
47570
- /**
47571
- * Frames and sends a pong message.
47572
- *
47573
- * @param {Buffer} data The message to send
47574
- * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
47575
- * @param {Boolean} [readOnly=false] Specifies whether `data` can be modified
47576
- * @param {Function} [cb] Callback
47577
- * @private
47578
- */
47579
- doPong(data, mask, readOnly, cb) {
47580
- this.sendFrame(
47581
- Sender$1.frame(data, {
47582
- fin: true,
47583
- rsv1: false,
47584
- opcode: 0x0a,
47585
- mask,
47586
- maskBuffer: this._maskBuffer,
47587
- generateMask: this._generateMask,
47588
- readOnly
47589
- }),
47590
- cb
47591
- );
47592
- }
47593
-
47594
46799
  /**
47595
46800
  * Sends a data message to the other peer.
47596
46801
  *
@@ -47608,11 +46813,22 @@ class Sender$1 {
47608
46813
  * @public
47609
46814
  */
47610
46815
  send(data, options, cb) {
47611
- const buf = toBuffer$2(data);
47612
46816
  const perMessageDeflate = this._extensions[PerMessageDeflate$2.extensionName];
47613
46817
  let opcode = options.binary ? 2 : 1;
47614
46818
  let rsv1 = options.compress;
47615
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
+
47616
46832
  if (this._firstFragment) {
47617
46833
  this._firstFragment = false;
47618
46834
  if (
@@ -47624,7 +46840,7 @@ class Sender$1 {
47624
46840
  : 'client_no_context_takeover'
47625
46841
  ]
47626
46842
  ) {
47627
- rsv1 = buf.length >= perMessageDeflate._threshold;
46843
+ rsv1 = byteLength >= perMessageDeflate._threshold;
47628
46844
  }
47629
46845
  this._compress = rsv1;
47630
46846
  } else {
@@ -47636,30 +46852,32 @@ class Sender$1 {
47636
46852
 
47637
46853
  if (perMessageDeflate) {
47638
46854
  const opts = {
46855
+ [kByteLength]: byteLength,
47639
46856
  fin: options.fin,
47640
- rsv1,
47641
- opcode,
46857
+ generateMask: this._generateMask,
47642
46858
  mask: options.mask,
47643
46859
  maskBuffer: this._maskBuffer,
47644
- generateMask: this._generateMask,
47645
- readOnly: toBuffer$2.readOnly
46860
+ opcode,
46861
+ readOnly,
46862
+ rsv1
47646
46863
  };
47647
46864
 
47648
46865
  if (this._deflating) {
47649
- this.enqueue([this.dispatch, buf, this._compress, opts, cb]);
46866
+ this.enqueue([this.dispatch, data, this._compress, opts, cb]);
47650
46867
  } else {
47651
- this.dispatch(buf, this._compress, opts, cb);
46868
+ this.dispatch(data, this._compress, opts, cb);
47652
46869
  }
47653
46870
  } else {
47654
46871
  this.sendFrame(
47655
- Sender$1.frame(buf, {
46872
+ Sender$1.frame(data, {
46873
+ [kByteLength]: byteLength,
47656
46874
  fin: options.fin,
47657
- rsv1: false,
47658
- opcode,
46875
+ generateMask: this._generateMask,
47659
46876
  mask: options.mask,
47660
46877
  maskBuffer: this._maskBuffer,
47661
- generateMask: this._generateMask,
47662
- readOnly: toBuffer$2.readOnly
46878
+ opcode,
46879
+ readOnly,
46880
+ rsv1: false
47663
46881
  }),
47664
46882
  cb
47665
46883
  );
@@ -47667,13 +46885,12 @@ class Sender$1 {
47667
46885
  }
47668
46886
 
47669
46887
  /**
47670
- * Dispatches a data message.
46888
+ * Dispatches a message.
47671
46889
  *
47672
- * @param {Buffer} data The message to send
46890
+ * @param {(Buffer|String)} data The message to send
47673
46891
  * @param {Boolean} [compress=false] Specifies whether or not to compress
47674
46892
  * `data`
47675
46893
  * @param {Object} options Options object
47676
- * @param {Number} options.opcode The opcode
47677
46894
  * @param {Boolean} [options.fin=false] Specifies whether or not to set the
47678
46895
  * FIN bit
47679
46896
  * @param {Function} [options.generateMask] The function used to generate the
@@ -47682,6 +46899,7 @@ class Sender$1 {
47682
46899
  * `data`
47683
46900
  * @param {Buffer} [options.maskBuffer] The buffer used to store the masking
47684
46901
  * key
46902
+ * @param {Number} options.opcode The opcode
47685
46903
  * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
47686
46904
  * modified
47687
46905
  * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
@@ -47697,7 +46915,7 @@ class Sender$1 {
47697
46915
 
47698
46916
  const perMessageDeflate = this._extensions[PerMessageDeflate$2.extensionName];
47699
46917
 
47700
- this._bufferedBytes += data.length;
46918
+ this._bufferedBytes += options[kByteLength];
47701
46919
  this._deflating = true;
47702
46920
  perMessageDeflate.compress(data, options.fin, (_, buf) => {
47703
46921
  if (this._socket.destroyed) {
@@ -47708,7 +46926,8 @@ class Sender$1 {
47708
46926
  if (typeof cb === 'function') cb(err);
47709
46927
 
47710
46928
  for (let i = 0; i < this._queue.length; i++) {
47711
- const callback = this._queue[i][4];
46929
+ const params = this._queue[i];
46930
+ const callback = params[params.length - 1];
47712
46931
 
47713
46932
  if (typeof callback === 'function') callback(err);
47714
46933
  }
@@ -47716,7 +46935,7 @@ class Sender$1 {
47716
46935
  return;
47717
46936
  }
47718
46937
 
47719
- this._bufferedBytes -= data.length;
46938
+ this._bufferedBytes -= options[kByteLength];
47720
46939
  this._deflating = false;
47721
46940
  options.readOnly = false;
47722
46941
  this.sendFrame(Sender$1.frame(buf, options), cb);
@@ -47733,7 +46952,7 @@ class Sender$1 {
47733
46952
  while (!this._deflating && this._queue.length) {
47734
46953
  const params = this._queue.shift();
47735
46954
 
47736
- this._bufferedBytes -= params[1].length;
46955
+ this._bufferedBytes -= params[3][kByteLength];
47737
46956
  Reflect.apply(params[0], this, params.slice(1));
47738
46957
  }
47739
46958
  }
@@ -47745,7 +46964,7 @@ class Sender$1 {
47745
46964
  * @private
47746
46965
  */
47747
46966
  enqueue(params) {
47748
- this._bufferedBytes += params[1].length;
46967
+ this._bufferedBytes += params[3][kByteLength];
47749
46968
  this._queue.push(params);
47750
46969
  }
47751
46970
 
@@ -48245,7 +47464,7 @@ const http$3 = require$$1__default$2;
48245
47464
  const net = require$$3__default;
48246
47465
  const tls = require$$4__default;
48247
47466
  const { randomBytes, createHash: createHash$1 } = require$$1__default$3;
48248
- const { URL: URL$2 } = require$$0__default$5;
47467
+ const { URL: URL$1 } = require$$0__default$5;
48249
47468
 
48250
47469
  const PerMessageDeflate$1 = permessageDeflate;
48251
47470
  const Receiver = receiver;
@@ -48898,12 +48117,12 @@ function initAsClient(websocket, address, protocols, options) {
48898
48117
 
48899
48118
  let parsedUrl;
48900
48119
 
48901
- if (address instanceof URL$2) {
48120
+ if (address instanceof URL$1) {
48902
48121
  parsedUrl = address;
48903
48122
  websocket._url = address.href;
48904
48123
  } else {
48905
48124
  try {
48906
- parsedUrl = new URL$2(address);
48125
+ parsedUrl = new URL$1(address);
48907
48126
  } catch (e) {
48908
48127
  throw new SyntaxError(`Invalid URL: ${address}`);
48909
48128
  }
@@ -49037,7 +48256,7 @@ function initAsClient(websocket, address, protocols, options) {
49037
48256
  let addr;
49038
48257
 
49039
48258
  try {
49040
- addr = new URL$2(location, address);
48259
+ addr = new URL$1(location, address);
49041
48260
  } catch (e) {
49042
48261
  const err = new SyntaxError(`Invalid URL: ${location}`);
49043
48262
  emitErrorAndClose(websocket, err);
@@ -50947,7 +50166,7 @@ var debug_1 = function () {
50947
50166
  };
50948
50167
 
50949
50168
  var url$1 = require$$0__default$5;
50950
- var URL$1 = url$1.URL;
50169
+ var URL = url$1.URL;
50951
50170
  var http$1 = require$$1__default$2;
50952
50171
  var https$1 = require$$1__default$4;
50953
50172
  var Writable = require$$0__default$2.Writable;
@@ -51398,14 +50617,14 @@ function wrap(protocols) {
51398
50617
  if (typeof input === "string") {
51399
50618
  var urlStr = input;
51400
50619
  try {
51401
- input = urlToOptions(new URL$1(urlStr));
50620
+ input = urlToOptions(new URL(urlStr));
51402
50621
  }
51403
50622
  catch (err) {
51404
50623
  /* istanbul ignore next */
51405
50624
  input = url$1.parse(urlStr);
51406
50625
  }
51407
50626
  }
51408
- else if (URL$1 && (input instanceof URL$1)) {
50627
+ else if (URL && (input instanceof URL)) {
51409
50628
  input = urlToOptions(input);
51410
50629
  }
51411
50630
  else {
@@ -51447,7 +50666,7 @@ function wrap(protocols) {
51447
50666
  }
51448
50667
 
51449
50668
  /* istanbul ignore next */
51450
- function noop$2() { /* empty */ }
50669
+ function noop$1() { /* empty */ }
51451
50670
 
51452
50671
  // from https://github.com/nodejs/node/blob/master/lib/internal/url.js
51453
50672
  function urlToOptions(urlObject) {
@@ -51503,7 +50722,7 @@ function abortRequest(request) {
51503
50722
  for (var e = 0; e < events.length; e++) {
51504
50723
  request.removeListener(events[e], eventHandlers[events[e]]);
51505
50724
  }
51506
- request.on("error", noop$2);
50725
+ request.on("error", noop$1);
51507
50726
  request.abort();
51508
50727
  }
51509
50728
 
@@ -52963,7 +52182,7 @@ async function ssrTransform(code, inMap, url) {
52963
52182
  // let binding used in a property shorthand
52964
52183
  // { foo } -> { foo: __import_x__.foo }
52965
52184
  // skip for destructuring patterns
52966
- if (!parent.inPattern ||
52185
+ if (!isNodeInPatternWeakMap.get(parent) ||
52967
52186
  isInDestructuringAssignment(parent, parentStack)) {
52968
52187
  s.appendLeft(id.end, `: ${binding}`);
52969
52188
  }
@@ -53014,6 +52233,7 @@ async function ssrTransform(code, inMap, url) {
53014
52233
  dynamicDeps: [...dynamicDeps]
53015
52234
  };
53016
52235
  }
52236
+ const isNodeInPatternWeakMap = new WeakMap();
53017
52237
  /**
53018
52238
  * Same logic from \@vue/compiler-core & \@vue/compiler-sfc
53019
52239
  * Except this is using acorn AST
@@ -53127,7 +52347,8 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport }) {
53127
52347
  });
53128
52348
  }
53129
52349
  else if (node.type === 'Property' && parent.type === 'ObjectPattern') {
53130
- node.inPattern = true;
52350
+ // mark property in destructuring pattern
52351
+ isNodeInPatternWeakMap.set(node, true);
53131
52352
  }
53132
52353
  else if (node.type === 'VariableDeclarator') {
53133
52354
  const parentFunction = findParentFunction(parentStack);
@@ -53171,7 +52392,7 @@ function isRefIdentifier(id, parent, parentStack) {
53171
52392
  }
53172
52393
  // property key
53173
52394
  // this also covers object destructuring pattern
53174
- if (isStaticPropertyKey(id, parent) || parent.inPattern) {
52395
+ if (isStaticPropertyKey(id, parent) || isNodeInPatternWeakMap.get(parent)) {
53175
52396
  return false;
53176
52397
  }
53177
52398
  // non-assignment array destructuring pattern
@@ -53300,7 +52521,7 @@ function parse$5(req) {
53300
52521
  return req._parsedUrl = { pathname, search, query, raw };
53301
52522
  }
53302
52523
 
53303
- const noop$1 = () => {};
52524
+ const noop = () => {};
53304
52525
 
53305
52526
  function isMatch(uri, arr) {
53306
52527
  for (let i=0; i < arr.length; i++) {
@@ -53411,7 +52632,7 @@ function sirv (dir, opts={}) {
53411
52632
  dir = path$r.resolve(dir || '.');
53412
52633
 
53413
52634
  let isNotFound = opts.onNoMatch || is404;
53414
- let setHeaders = opts.setHeaders || noop$1;
52635
+ let setHeaders = opts.setHeaders || noop;
53415
52636
 
53416
52637
  let extensions = opts.extensions || ['html', 'htm'];
53417
52638
  let gzips = opts.gzip && extensions.map(x => `${x}.gz`).concat('gz');
@@ -56482,7 +55703,7 @@ ssr) {
56482
55703
  for (const id of include) {
56483
55704
  // normalize 'foo >bar` as 'foo > bar' to prevent same id being added
56484
55705
  // and for pretty printing
56485
- const normalizedId = normalizeId$1(id);
55706
+ const normalizedId = normalizeId(id);
56486
55707
  if (!deps[normalizedId]) {
56487
55708
  const entry = await resolve(id);
56488
55709
  if (entry) {
@@ -56689,13 +55910,11 @@ function ssrRewriteStacktrace(stack, moduleGraph) {
56689
55910
  if (!rawSourceMap) {
56690
55911
  return input;
56691
55912
  }
56692
- // In `source-map:v0.7.0+` this constructor returns a Promise...
56693
- // How can we make this block async?
56694
- const consumer = new SourceMapConsumer(rawSourceMap);
55913
+ const consumer = new SourceMapConsumer_1(rawSourceMap);
56695
55914
  const pos = consumer.originalPositionFor({
56696
55915
  line: Number(line) - offset,
56697
55916
  column: Number(column),
56698
- bias: SourceMapConsumer.LEAST_UPPER_BOUND
55917
+ bias: SourceMapConsumer_1.LEAST_UPPER_BOUND
56699
55918
  });
56700
55919
  if (!pos.source) {
56701
55920
  return input;
@@ -56932,8 +56151,11 @@ async function nodeImport(id, importer, resolveOptions) {
56932
56151
  // When an ESM module imports an ESM dependency, this hook is *not* used.
56933
56152
  const unhookNodeResolve = hookNodeResolve((nodeResolve) => (id, parent, isMain, options) => {
56934
56153
  // Use the Vite resolver only for bare imports while skipping
56935
- // any built-in modules and binary modules.
56936
- 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')) {
56937
56159
  return nodeResolve(id, parent, isMain, options);
56938
56160
  }
56939
56161
  if (parent) {
@@ -57026,7 +56248,9 @@ function createMissingImporterRegisterFn(server) {
57026
56248
  const newData = (server._optimizeDepsMetadata = await optimizeDeps(server.config, true, false, newDeps, ssr));
57027
56249
  knownOptimized = newData.optimized;
57028
56250
  // update ssr externals
57029
- server._ssrExternals = resolveSSRExternal(server.config, Object.keys(knownOptimized));
56251
+ if (ssr) {
56252
+ server._ssrExternals = resolveSSRExternal(server.config, Object.keys(knownOptimized));
56253
+ }
57030
56254
  logger.info(colors$1.green(`✨ dependencies updated, reloading page...`), {
57031
56255
  timestamp: true
57032
56256
  });
@@ -57073,12 +56297,14 @@ function createMissingImporterRegisterFn(server) {
57073
56297
  const ROOT_FILES = [
57074
56298
  // '.git',
57075
56299
  // https://pnpm.js.org/workspaces/
57076
- 'pnpm-workspace.yaml'
56300
+ 'pnpm-workspace.yaml',
57077
56301
  // https://rushjs.io/pages/advanced/config_files/
57078
56302
  // 'rush.json',
57079
56303
  // https://nx.dev/latest/react/getting-started/nx-setup
57080
56304
  // 'workspace.json',
57081
- // 'nx.json'
56305
+ // 'nx.json',
56306
+ // https://github.com/lerna/lerna#lernajson
56307
+ 'lerna.json'
57082
56308
  ];
57083
56309
  // npm: https://docs.npmjs.com/cli/v7/using-npm/workspaces#installing-workspaces
57084
56310
  // yarn: https://classic.yarnpkg.com/en/docs/workspaces/#toc-how-to-use-it
@@ -70264,7 +69490,6 @@ async function preview(inlineConfig) {
70264
69490
  };
70265
69491
  }
70266
69492
 
70267
- const noop = () => null;
70268
69493
  function matches(pattern, importee) {
70269
69494
  if (pattern instanceof RegExp) {
70270
69495
  return pattern.test(importee);
@@ -70275,36 +69500,35 @@ function matches(pattern, importee) {
70275
69500
  if (importee === pattern) {
70276
69501
  return true;
70277
69502
  }
70278
- const importeeStartsWithKey = importee.indexOf(pattern) === 0;
70279
- const importeeHasSlashAfterKey = importee.substring(pattern.length)[0] === '/';
70280
- return importeeStartsWithKey && importeeHasSlashAfterKey;
69503
+ // eslint-disable-next-line prefer-template
69504
+ return importee.startsWith(pattern + '/');
70281
69505
  }
70282
- function normalizeId(id) {
70283
- return id;
70284
- }
70285
- function getEntries({ entries }) {
69506
+ function getEntries({ entries, customResolver }) {
70286
69507
  if (!entries) {
70287
69508
  return [];
70288
69509
  }
69510
+ const resolverFunctionFromOptions = resolveCustomResolver(customResolver);
70289
69511
  if (Array.isArray(entries)) {
70290
- 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
+ });
70291
69519
  }
70292
69520
  return Object.entries(entries).map(([key, value]) => {
70293
- return { find: key, replacement: value };
69521
+ return { find: key, replacement: value, resolverFunction: resolverFunctionFromOptions };
70294
69522
  });
70295
69523
  }
70296
- function getCustomResolver({ customResolver }, options) {
70297
- if (typeof customResolver === 'function') {
70298
- return customResolver;
70299
- }
70300
- if (customResolver && typeof customResolver.resolveId === 'function') {
70301
- return customResolver.resolveId;
70302
- }
70303
- if (typeof options.customResolver === 'function') {
70304
- return options.customResolver;
70305
- }
70306
- if (options.customResolver && typeof options.customResolver.resolveId === 'function') {
70307
- 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
+ }
70308
69532
  }
70309
69533
  return null;
70310
69534
  }
@@ -70313,39 +69537,31 @@ function alias(options = {}) {
70313
69537
  if (entries.length === 0) {
70314
69538
  return {
70315
69539
  name: 'alias',
70316
- resolveId: noop
69540
+ resolveId: () => null
70317
69541
  };
70318
69542
  }
70319
69543
  return {
70320
69544
  name: 'alias',
70321
- buildStart(inputOptions) {
70322
- 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 &&
70323
69547
  typeof customResolver === 'object' &&
70324
69548
  typeof customResolver.buildStart === 'function' &&
70325
- customResolver.buildStart.call(this, inputOptions))).then(() => {
70326
- // enforce void return value
70327
- });
69549
+ customResolver.buildStart.call(this, inputOptions)));
70328
69550
  },
70329
69551
  resolveId(importee, importer, resolveOptions) {
70330
- const importeeId = normalizeId(importee);
70331
- const importerId = normalizeId(importer);
69552
+ if (!importer) {
69553
+ return null;
69554
+ }
70332
69555
  // First match is supposed to be the correct one
70333
- const matchedEntry = entries.find((entry) => matches(entry.find, importeeId));
70334
- if (!matchedEntry || !importerId) {
69556
+ const matchedEntry = entries.find((entry) => matches(entry.find, importee));
69557
+ if (!matchedEntry) {
70335
69558
  return null;
70336
69559
  }
70337
- const updatedId = normalizeId(importeeId.replace(matchedEntry.find, matchedEntry.replacement));
70338
- const customResolver = getCustomResolver(matchedEntry, options);
70339
- if (customResolver) {
70340
- 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);
70341
69563
  }
70342
- return this.resolve(updatedId, importer, Object.assign({ skipSelf: true }, resolveOptions)).then((resolved) => {
70343
- let finalResult = resolved;
70344
- if (!finalResult) {
70345
- finalResult = { id: updatedId };
70346
- }
70347
- return finalResult;
70348
- });
69564
+ return this.resolve(updatedId, importer, Object.assign({ skipSelf: true }, resolveOptions)).then((resolved) => resolved || { id: updatedId });
70349
69565
  }
70350
69566
  };
70351
69567
  }
@@ -71349,52 +70565,33 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
71349
70565
  ].filter(Boolean);
71350
70566
  }
71351
70567
 
71352
- var main$1 = {};
71353
-
71354
- /* @flow */
71355
-
71356
- /*::
71357
-
71358
- type DotenvParseOptions = {
71359
- debug?: boolean
71360
- }
71361
-
71362
- // keys and values from src
71363
- type DotenvParseOutput = { [string]: string }
71364
-
71365
- type DotenvConfigOptions = {
71366
- path?: string, // path to .env file
71367
- encoding?: string, // encoding of .env file
71368
- debug?: string // turn on logging for debugging purposes
71369
- }
71370
-
71371
- type DotenvConfigOutput = {
71372
- parsed?: DotenvParseOutput,
71373
- error?: Error
71374
- }
71375
-
71376
- */
70568
+ var main = {exports: {}};
71377
70569
 
71378
70570
  const fs = fs__default;
71379
70571
  const path = path__default;
71380
70572
  const os = require$$1__default;
71381
70573
 
71382
- function log (message /*: string */) {
70574
+ function log (message) {
71383
70575
  console.log(`[dotenv][DEBUG] ${message}`);
71384
70576
  }
71385
70577
 
71386
70578
  const NEWLINE = '\n';
71387
- const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/;
70579
+ const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*("[^"]*"|'[^']*'|.*?)(\s+#.*)?$/;
71388
70580
  const RE_NEWLINES = /\\n/g;
71389
70581
  const NEWLINES_MATCH = /\r\n|\n|\r/;
71390
70582
 
71391
70583
  // Parses src into an Object
71392
- function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */) /*: DotenvParseOutput */ {
70584
+ function parse (src, options) {
71393
70585
  const debug = Boolean(options && options.debug);
70586
+ const multiline = Boolean(options && options.multiline);
71394
70587
  const obj = {};
71395
70588
 
71396
70589
  // convert Buffers before splitting into lines and processing
71397
- src.toString().split(NEWLINES_MATCH).forEach(function (line, idx) {
70590
+ const lines = src.toString().split(NEWLINES_MATCH);
70591
+
70592
+ for (let idx = 0; idx < lines.length; idx++) {
70593
+ let line = lines[idx];
70594
+
71398
70595
  // matching "KEY' and 'VAL' in 'KEY=VAL'
71399
70596
  const keyValueArr = line.match(RE_INI_KEY_VAL);
71400
70597
  // matched?
@@ -71402,12 +70599,30 @@ function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */)
71402
70599
  const key = keyValueArr[1];
71403
70600
  // default undefined or missing values to empty string
71404
70601
  let val = (keyValueArr[2] || '');
71405
- const end = val.length - 1;
70602
+ let end = val.length - 1;
71406
70603
  const isDoubleQuoted = val[0] === '"' && val[end] === '"';
71407
70604
  const isSingleQuoted = val[0] === "'" && val[end] === "'";
71408
70605
 
70606
+ const isMultilineDoubleQuoted = val[0] === '"' && val[end] !== '"';
70607
+ const isMultilineSingleQuoted = val[0] === "'" && val[end] !== "'";
70608
+
70609
+ // if parsing line breaks and the value starts with a quote
70610
+ if (multiline && (isMultilineDoubleQuoted || isMultilineSingleQuoted)) {
70611
+ const quoteChar = isMultilineDoubleQuoted ? '"' : "'";
70612
+
70613
+ val = val.substring(1);
70614
+
70615
+ while (idx++ < lines.length - 1) {
70616
+ line = lines[idx];
70617
+ end = line.length - 1;
70618
+ if (line[end] === quoteChar) {
70619
+ val += NEWLINE + line.substring(0, end);
70620
+ break
70621
+ }
70622
+ val += NEWLINE + line;
70623
+ }
71409
70624
  // if single or double quoted, remove quotes
71410
- if (isSingleQuoted || isDoubleQuoted) {
70625
+ } else if (isSingleQuoted || isDoubleQuoted) {
71411
70626
  val = val.substring(1, end);
71412
70627
 
71413
70628
  // if double quoted, expand newlines
@@ -71421,9 +70636,14 @@ function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */)
71421
70636
 
71422
70637
  obj[key] = val;
71423
70638
  } else if (debug) {
71424
- log(`did not match key and value when parsing line ${idx + 1}: ${line}`);
70639
+ const trimmedLine = line.trim();
70640
+
70641
+ // ignore empty and commented lines
70642
+ if (trimmedLine.length && trimmedLine[0] !== '#') {
70643
+ log(`Failed to match key and value when parsing line ${idx + 1}: ${line}`);
70644
+ }
71425
70645
  }
71426
- });
70646
+ }
71427
70647
 
71428
70648
  return obj
71429
70649
  }
@@ -71433,10 +70653,12 @@ function resolveHome (envPath) {
71433
70653
  }
71434
70654
 
71435
70655
  // Populates process.env from .env file
71436
- function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */ {
70656
+ function config (options) {
71437
70657
  let dotenvPath = path.resolve(process.cwd(), '.env');
71438
- let encoding /*: string */ = 'utf8';
71439
- let debug = false;
70658
+ let encoding = 'utf8';
70659
+ const debug = Boolean(options && options.debug);
70660
+ const override = Boolean(options && options.override);
70661
+ const multiline = Boolean(options && options.multiline);
71440
70662
 
71441
70663
  if (options) {
71442
70664
  if (options.path != null) {
@@ -71445,76 +70667,109 @@ function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */
71445
70667
  if (options.encoding != null) {
71446
70668
  encoding = options.encoding;
71447
70669
  }
71448
- if (options.debug != null) {
71449
- debug = true;
71450
- }
71451
70670
  }
71452
70671
 
71453
70672
  try {
71454
70673
  // specifying an encoding returns a string instead of a buffer
71455
- const parsed = parse(fs.readFileSync(dotenvPath, { encoding }), { debug });
70674
+ const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }), { debug, multiline });
71456
70675
 
71457
70676
  Object.keys(parsed).forEach(function (key) {
71458
70677
  if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
71459
70678
  process.env[key] = parsed[key];
71460
- } else if (debug) {
71461
- log(`"${key}" is already defined in \`process.env\` and will not be overwritten`);
70679
+ } else {
70680
+ if (override === true) {
70681
+ process.env[key] = parsed[key];
70682
+ }
70683
+
70684
+ if (debug) {
70685
+ if (override === true) {
70686
+ log(`"${key}" is already defined in \`process.env\` and WAS overwritten`);
70687
+ } else {
70688
+ log(`"${key}" is already defined in \`process.env\` and was NOT overwritten`);
70689
+ }
70690
+ }
71462
70691
  }
71463
70692
  });
71464
70693
 
71465
70694
  return { parsed }
71466
70695
  } catch (e) {
70696
+ if (debug) {
70697
+ log(`Failed to load ${dotenvPath} ${e.message}`);
70698
+ }
70699
+
71467
70700
  return { error: e }
71468
70701
  }
71469
70702
  }
71470
70703
 
71471
- main$1.config = config;
71472
- main$1.parse = parse;
70704
+ const DotenvModule = {
70705
+ config,
70706
+ parse
70707
+ };
71473
70708
 
71474
- var dotenvExpand = function (config) {
71475
- // if ignoring process.env, use a blank object
71476
- var environment = config.ignoreProcessEnv ? {} : process.env;
70709
+ main.exports.config = DotenvModule.config;
70710
+ main.exports.parse = DotenvModule.parse;
70711
+ main.exports = DotenvModule;
70712
+
70713
+ var dotenv = main.exports;
71477
70714
 
71478
- var interpolate = function (envValue) {
71479
- var matches = envValue.match(/(.?\${?(?:[a-zA-Z0-9_]+)?}?)/g) || [];
70715
+ function _interpolate (envValue, environment, config) {
70716
+ const matches = envValue.match(/(.?\${*[\w]*(?::-)?[\w]*}*)/g) || [];
71480
70717
 
71481
- return matches.reduce(function (newEnv, match) {
71482
- var parts = /(.?)\${?([a-zA-Z0-9_]+)?}?/g.exec(match);
71483
- 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
+ }
71484
70723
 
71485
- var value, replacePart;
70724
+ const prefix = parts[1];
71486
70725
 
71487
- if (prefix === '\\') {
71488
- replacePart = parts[0];
71489
- value = replacePart.replace('\\$', '$');
71490
- } else {
71491
- var key = parts[2];
71492
- replacePart = parts[0].substring(prefix.length);
71493
- // process.env value 'wins' over .env file's value
71494
- value = environment.hasOwnProperty(key) ? environment[key] : (config.parsed[key] || '');
70726
+ let value, replacePart;
71495
70727
 
71496
- // Resolve recursive interpolations
71497
- 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, '');
71498
70746
  }
70747
+ // Resolve recursive interpolations
70748
+ value = _interpolate(value, environment, config);
70749
+ }
71499
70750
 
71500
- return newEnv.replace(replacePart, value)
71501
- }, envValue)
71502
- };
70751
+ return newEnv.replace(replacePart, value)
70752
+ }, envValue)
70753
+ }
71503
70754
 
71504
- for (var configKey in config.parsed) {
71505
- 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;
71506
70758
 
71507
- config.parsed[configKey] = interpolate(value);
70759
+ for (const configKey in config.parsed) {
70760
+ const value = Object.prototype.hasOwnProperty.call(environment, configKey) ? environment[configKey] : config.parsed[configKey];
70761
+
70762
+ config.parsed[configKey] = _interpolate(value, environment, config);
71508
70763
  }
71509
70764
 
71510
- for (var processKey in config.parsed) {
70765
+ for (const processKey in config.parsed) {
71511
70766
  environment[processKey] = config.parsed[processKey];
71512
70767
  }
71513
70768
 
71514
70769
  return config
71515
- };
70770
+ }
71516
70771
 
71517
- var main = dotenvExpand;
70772
+ var expand_1 = expand;
71518
70773
 
71519
70774
  const debug = createDebugger('vite:config');
71520
70775
  /**
@@ -71622,7 +70877,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
71622
70877
  }
71623
70878
  // resolve public base url
71624
70879
  const BASE_URL = resolveBaseUrl(config.base, command === 'build', logger);
71625
- const resolvedBuildOptions = resolveBuildOptions(resolvedRoot, config.build, command === 'build');
70880
+ const resolvedBuildOptions = resolveBuildOptions(config.build);
71626
70881
  // resolve cache directory
71627
70882
  const pkgPath = lookupFile(resolvedRoot, [`package.json`], true /* pathOnly */);
71628
70883
  const cacheDir = config.cacheDir
@@ -72100,6 +71355,7 @@ async function loadConfigFromBundledFile(fileName, bundledCode) {
72100
71355
  return config;
72101
71356
  }
72102
71357
  function loadEnv(mode, envDir, prefixes = 'VITE_') {
71358
+ var _a;
72103
71359
  if (mode === 'local') {
72104
71360
  throw new Error(`"local" cannot be used as a mode name because it conflicts with ` +
72105
71361
  `the .local postfix for .env files.`);
@@ -72123,11 +71379,11 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
72123
71379
  for (const file of envFiles) {
72124
71380
  const path = lookupFile(envDir, [file], true);
72125
71381
  if (path) {
72126
- const parsed = main$1.parse(fs__default.readFileSync(path), {
72127
- debug: !!process.env.DEBUG || undefined
71382
+ const parsed = dotenv.parse(fs__default.readFileSync(path), {
71383
+ debug: ((_a = process.env.DEBUG) === null || _a === void 0 ? void 0 : _a.includes('vite:dotenv')) || undefined
72128
71384
  });
72129
71385
  // let environment variables use each other
72130
- main({
71386
+ expand_1({
72131
71387
  parsed,
72132
71388
  // prevent process.env mutation
72133
71389
  ignoreProcessEnv: true
@@ -72138,7 +71394,8 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
72138
71394
  env[key] === undefined) {
72139
71395
  env[key] = value;
72140
71396
  }
72141
- else if (key === 'NODE_ENV') {
71397
+ else if (key === 'NODE_ENV' &&
71398
+ process.env.VITE_USER_NODE_ENV === undefined) {
72142
71399
  // NODE_ENV override in .env file
72143
71400
  process.env.VITE_USER_NODE_ENV = value;
72144
71401
  }