@rsbuild/core 1.5.12 → 1.5.13

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.
Files changed (47) hide show
  1. package/compiled/@jridgewell/remapping/index.js +5 -848
  2. package/compiled/@jridgewell/trace-mapping/index.d.ts +194 -0
  3. package/compiled/@jridgewell/trace-mapping/index.js +1408 -0
  4. package/compiled/@jridgewell/trace-mapping/license +19 -0
  5. package/compiled/@jridgewell/trace-mapping/package.json +1 -0
  6. package/compiled/css-loader/index.js +22 -22
  7. package/compiled/html-rspack-plugin/index.js +14 -14
  8. package/compiled/launch-editor-middleware/index.js +3 -3
  9. package/compiled/memfs/index.d.ts +6 -1
  10. package/compiled/memfs/index.js +662 -636
  11. package/compiled/memfs/package.json +1 -1
  12. package/compiled/postcss/index.js +4 -4
  13. package/compiled/postcss-loader/index.js +6 -6
  14. package/compiled/rspack-manifest-plugin/index.js +4 -4
  15. package/dist/client/hmr.js +58 -19
  16. package/dist/index.cjs +426 -373
  17. package/dist/index.js +420 -369
  18. package/dist-types/configChain.d.ts +0 -4
  19. package/dist-types/server/assets-middleware/getFileFromUrl.d.ts +9 -0
  20. package/dist-types/server/assets-middleware/index.d.ts +48 -0
  21. package/dist-types/server/assets-middleware/middleware.d.ts +3 -0
  22. package/dist-types/server/assets-middleware/setupOutputFileSystem.d.ts +4 -0
  23. package/dist-types/server/assets-middleware/setupWriteToDisk.d.ts +15 -0
  24. package/dist-types/server/browserLogs.d.ts +7 -0
  25. package/dist-types/server/{compilationManager.d.ts → buildManager.d.ts} +11 -11
  26. package/dist-types/server/devMiddlewares.d.ts +2 -2
  27. package/dist-types/server/devServer.d.ts +3 -3
  28. package/dist-types/server/middlewares.d.ts +3 -3
  29. package/dist-types/server/socketServer.d.ts +22 -11
  30. package/dist-types/server/watchFiles.d.ts +2 -2
  31. package/dist-types/types/config.d.ts +13 -6
  32. package/dist-types/types/context.d.ts +14 -4
  33. package/dist-types/types/plugin.d.ts +1 -1
  34. package/dist-types/types/rsbuild.d.ts +8 -1
  35. package/package.json +5 -3
  36. package/dist-types/dev-middleware/index.d.ts +0 -53
  37. package/dist-types/dev-middleware/middleware.d.ts +0 -3
  38. package/dist-types/dev-middleware/utils/getFilenameFromUrl.d.ts +0 -7
  39. package/dist-types/dev-middleware/utils/getPaths.d.ts +0 -7
  40. package/dist-types/dev-middleware/utils/ready.d.ts +0 -2
  41. package/dist-types/dev-middleware/utils/setupHooks.d.ts +0 -3
  42. package/dist-types/dev-middleware/utils/setupOutputFileSystem.d.ts +0 -3
  43. package/dist-types/dev-middleware/utils/setupWriteToDisk.d.ts +0 -7
  44. package/dist-types/server/compilationMiddleware.d.ts +0 -36
  45. /package/dist-types/{dev-middleware/utils → server/assets-middleware}/escapeHtml.d.ts +0 -0
  46. /package/dist-types/{dev-middleware/utils → server/assets-middleware}/memorize.d.ts +0 -0
  47. /package/dist-types/{dev-middleware/utils → server/assets-middleware}/parseTokenList.d.ts +0 -0
@@ -4,7 +4,7 @@
4
4
  module = __nccwpck_require__.nmd(module);
5
5
  (function (global, factory, m) {
6
6
  true
7
- ? factory(module, __nccwpck_require__(26), __nccwpck_require__(99))
7
+ ? factory(module, __nccwpck_require__(26), __nccwpck_require__(462))
8
8
  : 0;
9
9
  })(this, function (module, require_sourcemapCodec, require_traceMapping) {
10
10
  "use strict";
@@ -405,7 +405,7 @@
405
405
  module = __nccwpck_require__.nmd(module);
406
406
  (function (global, factory) {
407
407
  if (true) {
408
- factory(module, __nccwpck_require__(686), __nccwpck_require__(99));
408
+ factory(module, __nccwpck_require__(686), __nccwpck_require__(462));
409
409
  module.exports = def(module);
410
410
  } else {
411
411
  }
@@ -645,191 +645,6 @@
645
645
  }
646
646
  });
647
647
  },
648
- 738: function (module) {
649
- (function (global, factory) {
650
- true ? (module.exports = factory()) : 0;
651
- })(this, function () {
652
- "use strict";
653
- const schemeRegex = /^[\w+.-]+:\/\//;
654
- const urlRegex =
655
- /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
656
- const fileRegex =
657
- /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
658
- function isAbsoluteUrl(input) {
659
- return schemeRegex.test(input);
660
- }
661
- function isSchemeRelativeUrl(input) {
662
- return input.startsWith("//");
663
- }
664
- function isAbsolutePath(input) {
665
- return input.startsWith("/");
666
- }
667
- function isFileUrl(input) {
668
- return input.startsWith("file:");
669
- }
670
- function isRelative(input) {
671
- return /^[.?#]/.test(input);
672
- }
673
- function parseAbsoluteUrl(input) {
674
- const match = urlRegex.exec(input);
675
- return makeUrl(
676
- match[1],
677
- match[2] || "",
678
- match[3],
679
- match[4] || "",
680
- match[5] || "/",
681
- match[6] || "",
682
- match[7] || "",
683
- );
684
- }
685
- function parseFileUrl(input) {
686
- const match = fileRegex.exec(input);
687
- const path = match[2];
688
- return makeUrl(
689
- "file:",
690
- "",
691
- match[1] || "",
692
- "",
693
- isAbsolutePath(path) ? path : "/" + path,
694
- match[3] || "",
695
- match[4] || "",
696
- );
697
- }
698
- function makeUrl(scheme, user, host, port, path, query, hash) {
699
- return { scheme, user, host, port, path, query, hash, type: 7 };
700
- }
701
- function parseUrl(input) {
702
- if (isSchemeRelativeUrl(input)) {
703
- const url = parseAbsoluteUrl("http:" + input);
704
- url.scheme = "";
705
- url.type = 6;
706
- return url;
707
- }
708
- if (isAbsolutePath(input)) {
709
- const url = parseAbsoluteUrl("http://foo.com" + input);
710
- url.scheme = "";
711
- url.host = "";
712
- url.type = 5;
713
- return url;
714
- }
715
- if (isFileUrl(input)) return parseFileUrl(input);
716
- if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
717
- const url = parseAbsoluteUrl("http://foo.com/" + input);
718
- url.scheme = "";
719
- url.host = "";
720
- url.type = input
721
- ? input.startsWith("?")
722
- ? 3
723
- : input.startsWith("#")
724
- ? 2
725
- : 4
726
- : 1;
727
- return url;
728
- }
729
- function stripPathFilename(path) {
730
- if (path.endsWith("/..")) return path;
731
- const index = path.lastIndexOf("/");
732
- return path.slice(0, index + 1);
733
- }
734
- function mergePaths(url, base) {
735
- normalizePath(base, base.type);
736
- if (url.path === "/") {
737
- url.path = base.path;
738
- } else {
739
- url.path = stripPathFilename(base.path) + url.path;
740
- }
741
- }
742
- function normalizePath(url, type) {
743
- const rel = type <= 4;
744
- const pieces = url.path.split("/");
745
- let pointer = 1;
746
- let positive = 0;
747
- let addTrailingSlash = false;
748
- for (let i = 1; i < pieces.length; i++) {
749
- const piece = pieces[i];
750
- if (!piece) {
751
- addTrailingSlash = true;
752
- continue;
753
- }
754
- addTrailingSlash = false;
755
- if (piece === ".") continue;
756
- if (piece === "..") {
757
- if (positive) {
758
- addTrailingSlash = true;
759
- positive--;
760
- pointer--;
761
- } else if (rel) {
762
- pieces[pointer++] = piece;
763
- }
764
- continue;
765
- }
766
- pieces[pointer++] = piece;
767
- positive++;
768
- }
769
- let path = "";
770
- for (let i = 1; i < pointer; i++) {
771
- path += "/" + pieces[i];
772
- }
773
- if (!path || (addTrailingSlash && !path.endsWith("/.."))) {
774
- path += "/";
775
- }
776
- url.path = path;
777
- }
778
- function resolve(input, base) {
779
- if (!input && !base) return "";
780
- const url = parseUrl(input);
781
- let inputType = url.type;
782
- if (base && inputType !== 7) {
783
- const baseUrl = parseUrl(base);
784
- const baseType = baseUrl.type;
785
- switch (inputType) {
786
- case 1:
787
- url.hash = baseUrl.hash;
788
- case 2:
789
- url.query = baseUrl.query;
790
- case 3:
791
- case 4:
792
- mergePaths(url, baseUrl);
793
- case 5:
794
- url.user = baseUrl.user;
795
- url.host = baseUrl.host;
796
- url.port = baseUrl.port;
797
- case 6:
798
- url.scheme = baseUrl.scheme;
799
- }
800
- if (baseType > inputType) inputType = baseType;
801
- }
802
- normalizePath(url, inputType);
803
- const queryHash = url.query + url.hash;
804
- switch (inputType) {
805
- case 2:
806
- case 3:
807
- return queryHash;
808
- case 4: {
809
- const path = url.path.slice(1);
810
- if (!path) return queryHash || ".";
811
- if (isRelative(base || input) && !isRelative(path)) {
812
- return "./" + path + queryHash;
813
- }
814
- return path + queryHash;
815
- }
816
- case 5:
817
- return url.path + queryHash;
818
- default:
819
- return (
820
- url.scheme +
821
- "//" +
822
- url.user +
823
- url.host +
824
- url.port +
825
- url.path +
826
- queryHash
827
- );
828
- }
829
- }
830
- return resolve;
831
- });
832
- },
833
648
  26: function (module, __unused_webpack_exports, __nccwpck_require__) {
834
649
  module = __nccwpck_require__.nmd(module);
835
650
  (function (global, factory) {
@@ -1357,667 +1172,9 @@
1357
1172
  }
1358
1173
  });
1359
1174
  },
1360
- 99: function (module, __unused_webpack_exports, __nccwpck_require__) {
1361
- module = __nccwpck_require__.nmd(module);
1362
- (function (global, factory, m) {
1363
- true
1364
- ? factory(module, __nccwpck_require__(738), __nccwpck_require__(26))
1365
- : 0;
1366
- })(this, function (module, require_resolveURI, require_sourcemapCodec) {
1367
- "use strict";
1368
- var __create = Object.create;
1369
- var __defProp = Object.defineProperty;
1370
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
1371
- var __getOwnPropNames = Object.getOwnPropertyNames;
1372
- var __getProtoOf = Object.getPrototypeOf;
1373
- var __hasOwnProp = Object.prototype.hasOwnProperty;
1374
- var __commonJS = (cb, mod) =>
1375
- function __require() {
1376
- return (
1377
- mod ||
1378
- (0, cb[__getOwnPropNames(cb)[0]])(
1379
- (mod = { exports: {} }).exports,
1380
- mod,
1381
- ),
1382
- mod.exports
1383
- );
1384
- };
1385
- var __export = (target, all) => {
1386
- for (var name in all)
1387
- __defProp(target, name, { get: all[name], enumerable: true });
1388
- };
1389
- var __copyProps = (to, from, except, desc) => {
1390
- if (
1391
- (from && typeof from === "object") ||
1392
- typeof from === "function"
1393
- ) {
1394
- for (let key of __getOwnPropNames(from))
1395
- if (!__hasOwnProp.call(to, key) && key !== except)
1396
- __defProp(to, key, {
1397
- get: () => from[key],
1398
- enumerable:
1399
- !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
1400
- });
1401
- }
1402
- return to;
1403
- };
1404
- var __toESM = (mod, isNodeMode, target) => (
1405
- (target = mod != null ? __create(__getProtoOf(mod)) : {}),
1406
- __copyProps(
1407
- isNodeMode || !mod || !mod.__esModule
1408
- ? __defProp(target, "default", { value: mod, enumerable: true })
1409
- : target,
1410
- mod,
1411
- )
1412
- );
1413
- var __toCommonJS = (mod) =>
1414
- __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1415
- var require_sourcemap_codec = __commonJS({
1416
- "umd:@jridgewell/sourcemap-codec"(exports, module2) {
1417
- module2.exports = require_sourcemapCodec;
1418
- },
1419
- });
1420
- var require_resolve_uri = __commonJS({
1421
- "umd:@jridgewell/resolve-uri"(exports, module2) {
1422
- module2.exports = require_resolveURI;
1423
- },
1424
- });
1425
- var trace_mapping_exports = {};
1426
- __export(trace_mapping_exports, {
1427
- AnyMap: () => FlattenMap,
1428
- FlattenMap: () => FlattenMap,
1429
- GREATEST_LOWER_BOUND: () => GREATEST_LOWER_BOUND,
1430
- LEAST_UPPER_BOUND: () => LEAST_UPPER_BOUND,
1431
- TraceMap: () => TraceMap,
1432
- allGeneratedPositionsFor: () => allGeneratedPositionsFor,
1433
- decodedMap: () => decodedMap,
1434
- decodedMappings: () => decodedMappings,
1435
- eachMapping: () => eachMapping,
1436
- encodedMap: () => encodedMap,
1437
- encodedMappings: () => encodedMappings,
1438
- generatedPositionFor: () => generatedPositionFor,
1439
- isIgnored: () => isIgnored,
1440
- originalPositionFor: () => originalPositionFor,
1441
- presortedDecodedMap: () => presortedDecodedMap,
1442
- sourceContentFor: () => sourceContentFor,
1443
- traceSegment: () => traceSegment,
1444
- });
1445
- module.exports = __toCommonJS(trace_mapping_exports);
1446
- var import_sourcemap_codec = __toESM(require_sourcemap_codec());
1447
- var import_resolve_uri = __toESM(require_resolve_uri());
1448
- function stripFilename(path) {
1449
- if (!path) return "";
1450
- const index = path.lastIndexOf("/");
1451
- return path.slice(0, index + 1);
1452
- }
1453
- function resolver(mapUrl, sourceRoot) {
1454
- const from = stripFilename(mapUrl);
1455
- const prefix = sourceRoot ? sourceRoot + "/" : "";
1456
- return (source) =>
1457
- (0, import_resolve_uri.default)(prefix + (source || ""), from);
1458
- }
1459
- var COLUMN = 0;
1460
- var SOURCES_INDEX = 1;
1461
- var SOURCE_LINE = 2;
1462
- var SOURCE_COLUMN = 3;
1463
- var NAMES_INDEX = 4;
1464
- var REV_GENERATED_LINE = 1;
1465
- var REV_GENERATED_COLUMN = 2;
1466
- function maybeSort(mappings, owned) {
1467
- const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
1468
- if (unsortedIndex === mappings.length) return mappings;
1469
- if (!owned) mappings = mappings.slice();
1470
- for (
1471
- let i = unsortedIndex;
1472
- i < mappings.length;
1473
- i = nextUnsortedSegmentLine(mappings, i + 1)
1474
- ) {
1475
- mappings[i] = sortSegments(mappings[i], owned);
1476
- }
1477
- return mappings;
1478
- }
1479
- function nextUnsortedSegmentLine(mappings, start) {
1480
- for (let i = start; i < mappings.length; i++) {
1481
- if (!isSorted(mappings[i])) return i;
1482
- }
1483
- return mappings.length;
1484
- }
1485
- function isSorted(line) {
1486
- for (let j = 1; j < line.length; j++) {
1487
- if (line[j][COLUMN] < line[j - 1][COLUMN]) {
1488
- return false;
1489
- }
1490
- }
1491
- return true;
1492
- }
1493
- function sortSegments(line, owned) {
1494
- if (!owned) line = line.slice();
1495
- return line.sort(sortComparator);
1496
- }
1497
- function sortComparator(a, b) {
1498
- return a[COLUMN] - b[COLUMN];
1499
- }
1500
- var found = false;
1501
- function binarySearch(haystack, needle, low, high) {
1502
- while (low <= high) {
1503
- const mid = low + ((high - low) >> 1);
1504
- const cmp = haystack[mid][COLUMN] - needle;
1505
- if (cmp === 0) {
1506
- found = true;
1507
- return mid;
1508
- }
1509
- if (cmp < 0) {
1510
- low = mid + 1;
1511
- } else {
1512
- high = mid - 1;
1513
- }
1514
- }
1515
- found = false;
1516
- return low - 1;
1517
- }
1518
- function upperBound(haystack, needle, index) {
1519
- for (let i = index + 1; i < haystack.length; index = i++) {
1520
- if (haystack[i][COLUMN] !== needle) break;
1521
- }
1522
- return index;
1523
- }
1524
- function lowerBound(haystack, needle, index) {
1525
- for (let i = index - 1; i >= 0; index = i--) {
1526
- if (haystack[i][COLUMN] !== needle) break;
1527
- }
1528
- return index;
1529
- }
1530
- function memoizedState() {
1531
- return { lastKey: -1, lastNeedle: -1, lastIndex: -1 };
1532
- }
1533
- function memoizedBinarySearch(haystack, needle, state, key) {
1534
- const { lastKey, lastNeedle, lastIndex } = state;
1535
- let low = 0;
1536
- let high = haystack.length - 1;
1537
- if (key === lastKey) {
1538
- if (needle === lastNeedle) {
1539
- found =
1540
- lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
1541
- return lastIndex;
1542
- }
1543
- if (needle >= lastNeedle) {
1544
- low = lastIndex === -1 ? 0 : lastIndex;
1545
- } else {
1546
- high = lastIndex;
1547
- }
1548
- }
1549
- state.lastKey = key;
1550
- state.lastNeedle = needle;
1551
- return (state.lastIndex = binarySearch(haystack, needle, low, high));
1552
- }
1553
- function buildBySources(decoded, memos) {
1554
- const sources = memos.map(buildNullArray);
1555
- for (let i = 0; i < decoded.length; i++) {
1556
- const line = decoded[i];
1557
- for (let j = 0; j < line.length; j++) {
1558
- const seg = line[j];
1559
- if (seg.length === 1) continue;
1560
- const sourceIndex2 = seg[SOURCES_INDEX];
1561
- const sourceLine = seg[SOURCE_LINE];
1562
- const sourceColumn = seg[SOURCE_COLUMN];
1563
- const originalSource = sources[sourceIndex2];
1564
- const originalLine =
1565
- originalSource[sourceLine] || (originalSource[sourceLine] = []);
1566
- const memo = memos[sourceIndex2];
1567
- let index = upperBound(
1568
- originalLine,
1569
- sourceColumn,
1570
- memoizedBinarySearch(
1571
- originalLine,
1572
- sourceColumn,
1573
- memo,
1574
- sourceLine,
1575
- ),
1576
- );
1577
- memo.lastIndex = ++index;
1578
- insert(originalLine, index, [sourceColumn, i, seg[COLUMN]]);
1579
- }
1580
- }
1581
- return sources;
1582
- }
1583
- function insert(array, index, value) {
1584
- for (let i = array.length; i > index; i--) {
1585
- array[i] = array[i - 1];
1586
- }
1587
- array[index] = value;
1588
- }
1589
- function buildNullArray() {
1590
- return { __proto__: null };
1591
- }
1592
- function parse(map) {
1593
- return typeof map === "string" ? JSON.parse(map) : map;
1594
- }
1595
- var FlattenMap = function (map, mapUrl) {
1596
- const parsed = parse(map);
1597
- if (!("sections" in parsed)) {
1598
- return new TraceMap(parsed, mapUrl);
1599
- }
1600
- const mappings = [];
1601
- const sources = [];
1602
- const sourcesContent = [];
1603
- const names = [];
1604
- const ignoreList = [];
1605
- recurse(
1606
- parsed,
1607
- mapUrl,
1608
- mappings,
1609
- sources,
1610
- sourcesContent,
1611
- names,
1612
- ignoreList,
1613
- 0,
1614
- 0,
1615
- Infinity,
1616
- Infinity,
1617
- );
1618
- const joined = {
1619
- version: 3,
1620
- file: parsed.file,
1621
- names,
1622
- sources,
1623
- sourcesContent,
1624
- mappings,
1625
- ignoreList,
1626
- };
1627
- return presortedDecodedMap(joined);
1628
- };
1629
- function recurse(
1630
- input,
1631
- mapUrl,
1632
- mappings,
1633
- sources,
1634
- sourcesContent,
1635
- names,
1636
- ignoreList,
1637
- lineOffset,
1638
- columnOffset,
1639
- stopLine,
1640
- stopColumn,
1641
- ) {
1642
- const { sections } = input;
1643
- for (let i = 0; i < sections.length; i++) {
1644
- const { map, offset } = sections[i];
1645
- let sl = stopLine;
1646
- let sc = stopColumn;
1647
- if (i + 1 < sections.length) {
1648
- const nextOffset = sections[i + 1].offset;
1649
- sl = Math.min(stopLine, lineOffset + nextOffset.line);
1650
- if (sl === stopLine) {
1651
- sc = Math.min(stopColumn, columnOffset + nextOffset.column);
1652
- } else if (sl < stopLine) {
1653
- sc = columnOffset + nextOffset.column;
1654
- }
1655
- }
1656
- addSection(
1657
- map,
1658
- mapUrl,
1659
- mappings,
1660
- sources,
1661
- sourcesContent,
1662
- names,
1663
- ignoreList,
1664
- lineOffset + offset.line,
1665
- columnOffset + offset.column,
1666
- sl,
1667
- sc,
1668
- );
1669
- }
1670
- }
1671
- function addSection(
1672
- input,
1673
- mapUrl,
1674
- mappings,
1675
- sources,
1676
- sourcesContent,
1677
- names,
1678
- ignoreList,
1679
- lineOffset,
1680
- columnOffset,
1681
- stopLine,
1682
- stopColumn,
1683
- ) {
1684
- const parsed = parse(input);
1685
- if ("sections" in parsed) return recurse(...arguments);
1686
- const map = new TraceMap(parsed, mapUrl);
1687
- const sourcesOffset = sources.length;
1688
- const namesOffset = names.length;
1689
- const decoded = decodedMappings(map);
1690
- const {
1691
- resolvedSources,
1692
- sourcesContent: contents,
1693
- ignoreList: ignores,
1694
- } = map;
1695
- append(sources, resolvedSources);
1696
- append(names, map.names);
1697
- if (contents) append(sourcesContent, contents);
1698
- else
1699
- for (let i = 0; i < resolvedSources.length; i++)
1700
- sourcesContent.push(null);
1701
- if (ignores)
1702
- for (let i = 0; i < ignores.length; i++)
1703
- ignoreList.push(ignores[i] + sourcesOffset);
1704
- for (let i = 0; i < decoded.length; i++) {
1705
- const lineI = lineOffset + i;
1706
- if (lineI > stopLine) return;
1707
- const out = getLine(mappings, lineI);
1708
- const cOffset = i === 0 ? columnOffset : 0;
1709
- const line = decoded[i];
1710
- for (let j = 0; j < line.length; j++) {
1711
- const seg = line[j];
1712
- const column = cOffset + seg[COLUMN];
1713
- if (lineI === stopLine && column >= stopColumn) return;
1714
- if (seg.length === 1) {
1715
- out.push([column]);
1716
- continue;
1717
- }
1718
- const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];
1719
- const sourceLine = seg[SOURCE_LINE];
1720
- const sourceColumn = seg[SOURCE_COLUMN];
1721
- out.push(
1722
- seg.length === 4
1723
- ? [column, sourcesIndex, sourceLine, sourceColumn]
1724
- : [
1725
- column,
1726
- sourcesIndex,
1727
- sourceLine,
1728
- sourceColumn,
1729
- namesOffset + seg[NAMES_INDEX],
1730
- ],
1731
- );
1732
- }
1733
- }
1734
- }
1735
- function append(arr, other) {
1736
- for (let i = 0; i < other.length; i++) arr.push(other[i]);
1737
- }
1738
- function getLine(arr, index) {
1739
- for (let i = arr.length; i <= index; i++) arr[i] = [];
1740
- return arr[index];
1741
- }
1742
- var LINE_GTR_ZERO =
1743
- "`line` must be greater than 0 (lines start at line 1)";
1744
- var COL_GTR_EQ_ZERO =
1745
- "`column` must be greater than or equal to 0 (columns start at column 0)";
1746
- var LEAST_UPPER_BOUND = -1;
1747
- var GREATEST_LOWER_BOUND = 1;
1748
- var TraceMap = class {
1749
- constructor(map, mapUrl) {
1750
- const isString = typeof map === "string";
1751
- if (!isString && map._decodedMemo) return map;
1752
- const parsed = parse(map);
1753
- const {
1754
- version,
1755
- file,
1756
- names,
1757
- sourceRoot,
1758
- sources,
1759
- sourcesContent,
1760
- } = parsed;
1761
- this.version = version;
1762
- this.file = file;
1763
- this.names = names || [];
1764
- this.sourceRoot = sourceRoot;
1765
- this.sources = sources;
1766
- this.sourcesContent = sourcesContent;
1767
- this.ignoreList =
1768
- parsed.ignoreList || parsed.x_google_ignoreList || void 0;
1769
- const resolve = resolver(mapUrl, sourceRoot);
1770
- this.resolvedSources = sources.map(resolve);
1771
- const { mappings } = parsed;
1772
- if (typeof mappings === "string") {
1773
- this._encoded = mappings;
1774
- this._decoded = void 0;
1775
- } else if (Array.isArray(mappings)) {
1776
- this._encoded = void 0;
1777
- this._decoded = maybeSort(mappings, isString);
1778
- } else if (parsed.sections) {
1779
- throw new Error(
1780
- `TraceMap passed sectioned source map, please use FlattenMap export instead`,
1781
- );
1782
- } else {
1783
- throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
1784
- }
1785
- this._decodedMemo = memoizedState();
1786
- this._bySources = void 0;
1787
- this._bySourceMemos = void 0;
1788
- }
1789
- };
1790
- function cast(map) {
1791
- return map;
1792
- }
1793
- function encodedMappings(map) {
1794
- var _a, _b;
1795
- return (_b = (_a = cast(map))._encoded) != null
1796
- ? _b
1797
- : (_a._encoded = (0, import_sourcemap_codec.encode)(
1798
- cast(map)._decoded,
1799
- ));
1800
- }
1801
- function decodedMappings(map) {
1802
- var _a;
1803
- return (
1804
- (_a = cast(map))._decoded ||
1805
- (_a._decoded = (0, import_sourcemap_codec.decode)(
1806
- cast(map)._encoded,
1807
- ))
1808
- );
1809
- }
1810
- function traceSegment(map, line, column) {
1811
- const decoded = decodedMappings(map);
1812
- if (line >= decoded.length) return null;
1813
- const segments = decoded[line];
1814
- const index = traceSegmentInternal(
1815
- segments,
1816
- cast(map)._decodedMemo,
1817
- line,
1818
- column,
1819
- GREATEST_LOWER_BOUND,
1820
- );
1821
- return index === -1 ? null : segments[index];
1822
- }
1823
- function originalPositionFor(map, needle) {
1824
- let { line, column, bias } = needle;
1825
- line--;
1826
- if (line < 0) throw new Error(LINE_GTR_ZERO);
1827
- if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
1828
- const decoded = decodedMappings(map);
1829
- if (line >= decoded.length) return OMapping(null, null, null, null);
1830
- const segments = decoded[line];
1831
- const index = traceSegmentInternal(
1832
- segments,
1833
- cast(map)._decodedMemo,
1834
- line,
1835
- column,
1836
- bias || GREATEST_LOWER_BOUND,
1837
- );
1838
- if (index === -1) return OMapping(null, null, null, null);
1839
- const segment = segments[index];
1840
- if (segment.length === 1) return OMapping(null, null, null, null);
1841
- const { names, resolvedSources } = map;
1842
- return OMapping(
1843
- resolvedSources[segment[SOURCES_INDEX]],
1844
- segment[SOURCE_LINE] + 1,
1845
- segment[SOURCE_COLUMN],
1846
- segment.length === 5 ? names[segment[NAMES_INDEX]] : null,
1847
- );
1848
- }
1849
- function generatedPositionFor(map, needle) {
1850
- const { source, line, column, bias } = needle;
1851
- return generatedPosition(
1852
- map,
1853
- source,
1854
- line,
1855
- column,
1856
- bias || GREATEST_LOWER_BOUND,
1857
- false,
1858
- );
1859
- }
1860
- function allGeneratedPositionsFor(map, needle) {
1861
- const { source, line, column, bias } = needle;
1862
- return generatedPosition(
1863
- map,
1864
- source,
1865
- line,
1866
- column,
1867
- bias || LEAST_UPPER_BOUND,
1868
- true,
1869
- );
1870
- }
1871
- function eachMapping(map, cb) {
1872
- const decoded = decodedMappings(map);
1873
- const { names, resolvedSources } = map;
1874
- for (let i = 0; i < decoded.length; i++) {
1875
- const line = decoded[i];
1876
- for (let j = 0; j < line.length; j++) {
1877
- const seg = line[j];
1878
- const generatedLine = i + 1;
1879
- const generatedColumn = seg[0];
1880
- let source = null;
1881
- let originalLine = null;
1882
- let originalColumn = null;
1883
- let name = null;
1884
- if (seg.length !== 1) {
1885
- source = resolvedSources[seg[1]];
1886
- originalLine = seg[2] + 1;
1887
- originalColumn = seg[3];
1888
- }
1889
- if (seg.length === 5) name = names[seg[4]];
1890
- cb({
1891
- generatedLine,
1892
- generatedColumn,
1893
- source,
1894
- originalLine,
1895
- originalColumn,
1896
- name,
1897
- });
1898
- }
1899
- }
1900
- }
1901
- function sourceIndex(map, source) {
1902
- const { sources, resolvedSources } = map;
1903
- let index = sources.indexOf(source);
1904
- if (index === -1) index = resolvedSources.indexOf(source);
1905
- return index;
1906
- }
1907
- function sourceContentFor(map, source) {
1908
- const { sourcesContent } = map;
1909
- if (sourcesContent == null) return null;
1910
- const index = sourceIndex(map, source);
1911
- return index === -1 ? null : sourcesContent[index];
1912
- }
1913
- function isIgnored(map, source) {
1914
- const { ignoreList } = map;
1915
- if (ignoreList == null) return false;
1916
- const index = sourceIndex(map, source);
1917
- return index === -1 ? false : ignoreList.includes(index);
1918
- }
1919
- function presortedDecodedMap(map, mapUrl) {
1920
- const tracer = new TraceMap(clone(map, []), mapUrl);
1921
- cast(tracer)._decoded = map.mappings;
1922
- return tracer;
1923
- }
1924
- function decodedMap(map) {
1925
- return clone(map, decodedMappings(map));
1926
- }
1927
- function encodedMap(map) {
1928
- return clone(map, encodedMappings(map));
1929
- }
1930
- function clone(map, mappings) {
1931
- return {
1932
- version: map.version,
1933
- file: map.file,
1934
- names: map.names,
1935
- sourceRoot: map.sourceRoot,
1936
- sources: map.sources,
1937
- sourcesContent: map.sourcesContent,
1938
- mappings,
1939
- ignoreList: map.ignoreList || map.x_google_ignoreList,
1940
- };
1941
- }
1942
- function OMapping(source, line, column, name) {
1943
- return { source, line, column, name };
1944
- }
1945
- function GMapping(line, column) {
1946
- return { line, column };
1947
- }
1948
- function traceSegmentInternal(segments, memo, line, column, bias) {
1949
- let index = memoizedBinarySearch(segments, column, memo, line);
1950
- if (found) {
1951
- index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(
1952
- segments,
1953
- column,
1954
- index,
1955
- );
1956
- } else if (bias === LEAST_UPPER_BOUND) index++;
1957
- if (index === -1 || index === segments.length) return -1;
1958
- return index;
1959
- }
1960
- function sliceGeneratedPositions(segments, memo, line, column, bias) {
1961
- let min = traceSegmentInternal(
1962
- segments,
1963
- memo,
1964
- line,
1965
- column,
1966
- GREATEST_LOWER_BOUND,
1967
- );
1968
- if (!found && bias === LEAST_UPPER_BOUND) min++;
1969
- if (min === -1 || min === segments.length) return [];
1970
- const matchedColumn = found ? column : segments[min][COLUMN];
1971
- if (!found) min = lowerBound(segments, matchedColumn, min);
1972
- const max = upperBound(segments, matchedColumn, min);
1973
- const result = [];
1974
- for (; min <= max; min++) {
1975
- const segment = segments[min];
1976
- result.push(
1977
- GMapping(
1978
- segment[REV_GENERATED_LINE] + 1,
1979
- segment[REV_GENERATED_COLUMN],
1980
- ),
1981
- );
1982
- }
1983
- return result;
1984
- }
1985
- function generatedPosition(map, source, line, column, bias, all) {
1986
- var _a;
1987
- line--;
1988
- if (line < 0) throw new Error(LINE_GTR_ZERO);
1989
- if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
1990
- const { sources, resolvedSources } = map;
1991
- let sourceIndex2 = sources.indexOf(source);
1992
- if (sourceIndex2 === -1)
1993
- sourceIndex2 = resolvedSources.indexOf(source);
1994
- if (sourceIndex2 === -1) return all ? [] : GMapping(null, null);
1995
- const generated =
1996
- (_a = cast(map))._bySources ||
1997
- (_a._bySources = buildBySources(
1998
- decodedMappings(map),
1999
- (cast(map)._bySourceMemos = sources.map(memoizedState)),
2000
- ));
2001
- const segments = generated[sourceIndex2][line];
2002
- if (segments == null) return all ? [] : GMapping(null, null);
2003
- const memo = cast(map)._bySourceMemos[sourceIndex2];
2004
- if (all)
2005
- return sliceGeneratedPositions(segments, memo, line, column, bias);
2006
- const index = traceSegmentInternal(
2007
- segments,
2008
- memo,
2009
- line,
2010
- column,
2011
- bias,
2012
- );
2013
- if (index === -1) return GMapping(null, null);
2014
- const segment = segments[index];
2015
- return GMapping(
2016
- segment[REV_GENERATED_LINE] + 1,
2017
- segment[REV_GENERATED_COLUMN],
2018
- );
2019
- }
2020
- });
1175
+ 462: (module) => {
1176
+ "use strict";
1177
+ module.exports = require("../trace-mapping/index.js");
2021
1178
  },
2022
1179
  };
2023
1180
  var __webpack_module_cache__ = {};