rollup 2.70.1 → 2.71.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/LICENSE.md +1 -1
- package/dist/bin/rollup +17 -17
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +1142 -1087
- package/dist/es/shared/watch.js +189 -187
- package/dist/loadConfigFile.js +6 -6
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.d.ts +13 -17
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +191 -189
- package/dist/shared/loadConfigFile.js +6 -4
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +1142 -1087
- package/dist/shared/watch-cli.js +79 -74
- package/dist/shared/watch.js +2 -2
- package/package.json +25 -23
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.71.1
|
|
4
|
+
Sat, 30 Apr 2022 13:35:44 GMT - commit f44a3a38b357c2ba80a99aca36cfd30dcfb84476
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -27,7 +27,7 @@ function _interopNamespaceDefault(e) {
|
|
|
27
27
|
return n;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var version$1 = "2.
|
|
30
|
+
var version$1 = "2.71.1";
|
|
31
31
|
|
|
32
32
|
function ensureArray$1(items) {
|
|
33
33
|
if (Array.isArray(items)) {
|
|
@@ -608,8 +608,7 @@ const objectifyOptionWithPresets = (presets, optionName, additionalValues) => (v
|
|
|
608
608
|
return objectifyOption(value);
|
|
609
609
|
};
|
|
610
610
|
const getOptionWithPreset = (value, presets, optionName, additionalValues) => {
|
|
611
|
-
|
|
612
|
-
const presetName = (_a = value) === null || _a === void 0 ? void 0 : _a.preset;
|
|
611
|
+
const presetName = value === null || value === void 0 ? void 0 : value.preset;
|
|
613
612
|
if (presetName) {
|
|
614
613
|
const preset = presets[presetName];
|
|
615
614
|
if (preset) {
|
|
@@ -648,9 +647,19 @@ const fseventsImporter = /*#__PURE__*/Object.defineProperty({
|
|
|
648
647
|
|
|
649
648
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
650
649
|
|
|
650
|
+
function getDefaultExportFromCjs (x) {
|
|
651
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
652
|
+
}
|
|
653
|
+
|
|
651
654
|
function getAugmentedNamespace(n) {
|
|
652
|
-
|
|
653
|
-
|
|
655
|
+
var f = n.default;
|
|
656
|
+
if (typeof f == "function") {
|
|
657
|
+
var a = function () {
|
|
658
|
+
return f.apply(this, arguments);
|
|
659
|
+
};
|
|
660
|
+
a.prototype = f.prototype;
|
|
661
|
+
} else a = {};
|
|
662
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
654
663
|
Object.keys(n).forEach(function (k) {
|
|
655
664
|
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
656
665
|
Object.defineProperty(a, k, d.get ? d : {
|
|
@@ -785,204 +794,208 @@ function encodeInteger(num) {
|
|
|
785
794
|
return result;
|
|
786
795
|
}
|
|
787
796
|
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
BitSet.prototype.add = function add (n) {
|
|
793
|
-
this.bits[n >> 5] |= 1 << (n & 31);
|
|
794
|
-
};
|
|
797
|
+
class BitSet {
|
|
798
|
+
constructor(arg) {
|
|
799
|
+
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
800
|
+
}
|
|
795
801
|
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
}
|
|
802
|
+
add(n) {
|
|
803
|
+
this.bits[n >> 5] |= 1 << (n & 31);
|
|
804
|
+
}
|
|
799
805
|
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
806
|
+
has(n) {
|
|
807
|
+
return !!(this.bits[n >> 5] & (1 << (n & 31)));
|
|
808
|
+
}
|
|
809
|
+
}
|
|
804
810
|
|
|
805
|
-
|
|
806
|
-
|
|
811
|
+
class Chunk$1 {
|
|
812
|
+
constructor(start, end, content) {
|
|
813
|
+
this.start = start;
|
|
814
|
+
this.end = end;
|
|
815
|
+
this.original = content;
|
|
807
816
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
this.edited = false;
|
|
817
|
+
this.intro = '';
|
|
818
|
+
this.outro = '';
|
|
811
819
|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
next: { writable: true, value: null }
|
|
816
|
-
});
|
|
817
|
-
};
|
|
820
|
+
this.content = content;
|
|
821
|
+
this.storeName = false;
|
|
822
|
+
this.edited = false;
|
|
818
823
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
}
|
|
824
|
+
// we make these non-enumerable, for sanity while debugging
|
|
825
|
+
Object.defineProperties(this, {
|
|
826
|
+
previous: { writable: true, value: null },
|
|
827
|
+
next: { writable: true, value: null },
|
|
828
|
+
});
|
|
829
|
+
}
|
|
822
830
|
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
}
|
|
831
|
+
appendLeft(content) {
|
|
832
|
+
this.outro += content;
|
|
833
|
+
}
|
|
826
834
|
|
|
827
|
-
|
|
828
|
-
|
|
835
|
+
appendRight(content) {
|
|
836
|
+
this.intro = this.intro + content;
|
|
837
|
+
}
|
|
829
838
|
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
chunk.content = this.content;
|
|
833
|
-
chunk.storeName = this.storeName;
|
|
834
|
-
chunk.edited = this.edited;
|
|
839
|
+
clone() {
|
|
840
|
+
const chunk = new Chunk$1(this.start, this.end, this.original);
|
|
835
841
|
|
|
836
|
-
|
|
837
|
-
|
|
842
|
+
chunk.intro = this.intro;
|
|
843
|
+
chunk.outro = this.outro;
|
|
844
|
+
chunk.content = this.content;
|
|
845
|
+
chunk.storeName = this.storeName;
|
|
846
|
+
chunk.edited = this.edited;
|
|
838
847
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
};
|
|
848
|
+
return chunk;
|
|
849
|
+
}
|
|
842
850
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
while (chunk) {
|
|
846
|
-
fn(chunk);
|
|
847
|
-
chunk = chunk.next;
|
|
851
|
+
contains(index) {
|
|
852
|
+
return this.start < index && index < this.end;
|
|
848
853
|
}
|
|
849
|
-
};
|
|
850
854
|
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
855
|
+
eachNext(fn) {
|
|
856
|
+
let chunk = this;
|
|
857
|
+
while (chunk) {
|
|
858
|
+
fn(chunk);
|
|
859
|
+
chunk = chunk.next;
|
|
860
|
+
}
|
|
856
861
|
}
|
|
857
|
-
};
|
|
858
862
|
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
863
|
+
eachPrevious(fn) {
|
|
864
|
+
let chunk = this;
|
|
865
|
+
while (chunk) {
|
|
866
|
+
fn(chunk);
|
|
867
|
+
chunk = chunk.previous;
|
|
868
|
+
}
|
|
864
869
|
}
|
|
865
|
-
this.storeName = storeName;
|
|
866
870
|
|
|
867
|
-
|
|
871
|
+
edit(content, storeName, contentOnly) {
|
|
872
|
+
this.content = content;
|
|
873
|
+
if (!contentOnly) {
|
|
874
|
+
this.intro = '';
|
|
875
|
+
this.outro = '';
|
|
876
|
+
}
|
|
877
|
+
this.storeName = storeName;
|
|
868
878
|
|
|
869
|
-
|
|
870
|
-
};
|
|
879
|
+
this.edited = true;
|
|
871
880
|
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
};
|
|
881
|
+
return this;
|
|
882
|
+
}
|
|
875
883
|
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
}
|
|
884
|
+
prependLeft(content) {
|
|
885
|
+
this.outro = content + this.outro;
|
|
886
|
+
}
|
|
879
887
|
|
|
880
|
-
|
|
881
|
-
|
|
888
|
+
prependRight(content) {
|
|
889
|
+
this.intro = content + this.intro;
|
|
890
|
+
}
|
|
882
891
|
|
|
883
|
-
|
|
884
|
-
|
|
892
|
+
split(index) {
|
|
893
|
+
const sliceIndex = index - this.start;
|
|
885
894
|
|
|
886
|
-
|
|
895
|
+
const originalBefore = this.original.slice(0, sliceIndex);
|
|
896
|
+
const originalAfter = this.original.slice(sliceIndex);
|
|
887
897
|
|
|
888
|
-
|
|
889
|
-
newChunk.outro = this.outro;
|
|
890
|
-
this.outro = '';
|
|
898
|
+
this.original = originalBefore;
|
|
891
899
|
|
|
892
|
-
|
|
900
|
+
const newChunk = new Chunk$1(index, this.end, originalAfter);
|
|
901
|
+
newChunk.outro = this.outro;
|
|
902
|
+
this.outro = '';
|
|
893
903
|
|
|
894
|
-
|
|
895
|
-
// TODO is this block necessary?...
|
|
896
|
-
newChunk.edit('', false);
|
|
897
|
-
this.content = '';
|
|
898
|
-
} else {
|
|
899
|
-
this.content = originalBefore;
|
|
900
|
-
}
|
|
904
|
+
this.end = index;
|
|
901
905
|
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
+
if (this.edited) {
|
|
907
|
+
// TODO is this block necessary?...
|
|
908
|
+
newChunk.edit('', false);
|
|
909
|
+
this.content = '';
|
|
910
|
+
} else {
|
|
911
|
+
this.content = originalBefore;
|
|
912
|
+
}
|
|
906
913
|
|
|
907
|
-
|
|
908
|
-
|
|
914
|
+
newChunk.next = this.next;
|
|
915
|
+
if (newChunk.next) newChunk.next.previous = newChunk;
|
|
916
|
+
newChunk.previous = this;
|
|
917
|
+
this.next = newChunk;
|
|
909
918
|
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
};
|
|
919
|
+
return newChunk;
|
|
920
|
+
}
|
|
913
921
|
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
922
|
+
toString() {
|
|
923
|
+
return this.intro + this.content + this.outro;
|
|
924
|
+
}
|
|
917
925
|
|
|
918
|
-
|
|
926
|
+
trimEnd(rx) {
|
|
927
|
+
this.outro = this.outro.replace(rx, '');
|
|
928
|
+
if (this.outro.length) return true;
|
|
919
929
|
|
|
920
|
-
|
|
921
|
-
if (trimmed !== this.content) {
|
|
922
|
-
this.split(this.start + trimmed.length).edit('', undefined, true);
|
|
923
|
-
}
|
|
924
|
-
return true;
|
|
930
|
+
const trimmed = this.content.replace(rx, '');
|
|
925
931
|
|
|
926
|
-
|
|
927
|
-
|
|
932
|
+
if (trimmed.length) {
|
|
933
|
+
if (trimmed !== this.content) {
|
|
934
|
+
this.split(this.start + trimmed.length).edit('', undefined, true);
|
|
935
|
+
}
|
|
936
|
+
return true;
|
|
937
|
+
} else {
|
|
938
|
+
this.edit('', undefined, true);
|
|
928
939
|
|
|
929
|
-
|
|
930
|
-
|
|
940
|
+
this.intro = this.intro.replace(rx, '');
|
|
941
|
+
if (this.intro.length) return true;
|
|
942
|
+
}
|
|
931
943
|
}
|
|
932
|
-
};
|
|
933
944
|
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
945
|
+
trimStart(rx) {
|
|
946
|
+
this.intro = this.intro.replace(rx, '');
|
|
947
|
+
if (this.intro.length) return true;
|
|
937
948
|
|
|
938
|
-
|
|
949
|
+
const trimmed = this.content.replace(rx, '');
|
|
939
950
|
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
951
|
+
if (trimmed.length) {
|
|
952
|
+
if (trimmed !== this.content) {
|
|
953
|
+
this.split(this.end - trimmed.length);
|
|
954
|
+
this.edit('', undefined, true);
|
|
955
|
+
}
|
|
956
|
+
return true;
|
|
957
|
+
} else {
|
|
943
958
|
this.edit('', undefined, true);
|
|
944
|
-
}
|
|
945
|
-
return true;
|
|
946
|
-
|
|
947
|
-
} else {
|
|
948
|
-
this.edit('', undefined, true);
|
|
949
959
|
|
|
950
|
-
|
|
951
|
-
|
|
960
|
+
this.outro = this.outro.replace(rx, '');
|
|
961
|
+
if (this.outro.length) return true;
|
|
962
|
+
}
|
|
952
963
|
}
|
|
953
|
-
}
|
|
964
|
+
}
|
|
954
965
|
|
|
955
|
-
|
|
966
|
+
let btoa = () => {
|
|
956
967
|
throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
|
|
957
968
|
};
|
|
958
969
|
if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
|
|
959
|
-
btoa =
|
|
970
|
+
btoa = (str) => window.btoa(unescape(encodeURIComponent(str)));
|
|
960
971
|
} else if (typeof Buffer === 'function') {
|
|
961
|
-
btoa =
|
|
972
|
+
btoa = (str) => Buffer.from(str, 'utf-8').toString('base64');
|
|
962
973
|
}
|
|
963
974
|
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
975
|
+
class SourceMap {
|
|
976
|
+
constructor(properties) {
|
|
977
|
+
this.version = 3;
|
|
978
|
+
this.file = properties.file;
|
|
979
|
+
this.sources = properties.sources;
|
|
980
|
+
this.sourcesContent = properties.sourcesContent;
|
|
981
|
+
this.names = properties.names;
|
|
982
|
+
this.mappings = encode(properties.mappings);
|
|
983
|
+
}
|
|
972
984
|
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
}
|
|
985
|
+
toString() {
|
|
986
|
+
return JSON.stringify(this);
|
|
987
|
+
}
|
|
976
988
|
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
}
|
|
989
|
+
toUrl() {
|
|
990
|
+
return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());
|
|
991
|
+
}
|
|
992
|
+
}
|
|
980
993
|
|
|
981
994
|
function guessIndent(code) {
|
|
982
|
-
|
|
995
|
+
const lines = code.split('\n');
|
|
983
996
|
|
|
984
|
-
|
|
985
|
-
|
|
997
|
+
const tabbed = lines.filter((line) => /^\t+/.test(line));
|
|
998
|
+
const spaced = lines.filter((line) => /^ {2,}/.test(line));
|
|
986
999
|
|
|
987
1000
|
if (tabbed.length === 0 && spaced.length === 0) {
|
|
988
1001
|
return null;
|
|
@@ -996,8 +1009,8 @@ function guessIndent(code) {
|
|
|
996
1009
|
}
|
|
997
1010
|
|
|
998
1011
|
// Otherwise, we need to guess the multiple
|
|
999
|
-
|
|
1000
|
-
|
|
1012
|
+
const min = spaced.reduce((previous, current) => {
|
|
1013
|
+
const numSpaces = /^ +/.exec(current)[0].length;
|
|
1001
1014
|
return Math.min(numSpaces, previous);
|
|
1002
1015
|
}, Infinity);
|
|
1003
1016
|
|
|
@@ -1005,8 +1018,8 @@ function guessIndent(code) {
|
|
|
1005
1018
|
}
|
|
1006
1019
|
|
|
1007
1020
|
function getRelativePath(from, to) {
|
|
1008
|
-
|
|
1009
|
-
|
|
1021
|
+
const fromParts = from.split(/[/\\]/);
|
|
1022
|
+
const toParts = to.split(/[/\\]/);
|
|
1010
1023
|
|
|
1011
1024
|
fromParts.pop(); // get dirname
|
|
1012
1025
|
|
|
@@ -1016,1079 +1029,1120 @@ function getRelativePath(from, to) {
|
|
|
1016
1029
|
}
|
|
1017
1030
|
|
|
1018
1031
|
if (fromParts.length) {
|
|
1019
|
-
|
|
1020
|
-
while (i--)
|
|
1032
|
+
let i = fromParts.length;
|
|
1033
|
+
while (i--) fromParts[i] = '..';
|
|
1021
1034
|
}
|
|
1022
1035
|
|
|
1023
1036
|
return fromParts.concat(toParts).join('/');
|
|
1024
1037
|
}
|
|
1025
1038
|
|
|
1026
|
-
|
|
1039
|
+
const toString$1 = Object.prototype.toString;
|
|
1027
1040
|
|
|
1028
1041
|
function isObject$1(thing) {
|
|
1029
1042
|
return toString$1.call(thing) === '[object Object]';
|
|
1030
1043
|
}
|
|
1031
1044
|
|
|
1032
1045
|
function getLocator(source) {
|
|
1033
|
-
|
|
1034
|
-
|
|
1046
|
+
const originalLines = source.split('\n');
|
|
1047
|
+
const lineOffsets = [];
|
|
1035
1048
|
|
|
1036
|
-
for (
|
|
1049
|
+
for (let i = 0, pos = 0; i < originalLines.length; i++) {
|
|
1037
1050
|
lineOffsets.push(pos);
|
|
1038
1051
|
pos += originalLines[i].length + 1;
|
|
1039
1052
|
}
|
|
1040
1053
|
|
|
1041
1054
|
return function locate(index) {
|
|
1042
|
-
|
|
1043
|
-
|
|
1055
|
+
let i = 0;
|
|
1056
|
+
let j = lineOffsets.length;
|
|
1044
1057
|
while (i < j) {
|
|
1045
|
-
|
|
1058
|
+
const m = (i + j) >> 1;
|
|
1046
1059
|
if (index < lineOffsets[m]) {
|
|
1047
1060
|
j = m;
|
|
1048
1061
|
} else {
|
|
1049
1062
|
i = m + 1;
|
|
1050
1063
|
}
|
|
1051
1064
|
}
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
return { line
|
|
1065
|
+
const line = i - 1;
|
|
1066
|
+
const column = index - lineOffsets[line];
|
|
1067
|
+
return { line, column };
|
|
1055
1068
|
};
|
|
1056
1069
|
}
|
|
1057
1070
|
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1071
|
+
class Mappings {
|
|
1072
|
+
constructor(hires) {
|
|
1073
|
+
this.hires = hires;
|
|
1074
|
+
this.generatedCodeLine = 0;
|
|
1075
|
+
this.generatedCodeColumn = 0;
|
|
1076
|
+
this.raw = [];
|
|
1077
|
+
this.rawSegments = this.raw[this.generatedCodeLine] = [];
|
|
1078
|
+
this.pending = null;
|
|
1079
|
+
}
|
|
1066
1080
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1081
|
+
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
1082
|
+
if (content.length) {
|
|
1083
|
+
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
1084
|
+
if (nameIndex >= 0) {
|
|
1085
|
+
segment.push(nameIndex);
|
|
1086
|
+
}
|
|
1087
|
+
this.rawSegments.push(segment);
|
|
1088
|
+
} else if (this.pending) {
|
|
1089
|
+
this.rawSegments.push(this.pending);
|
|
1072
1090
|
}
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
this.
|
|
1091
|
+
|
|
1092
|
+
this.advance(content);
|
|
1093
|
+
this.pending = null;
|
|
1076
1094
|
}
|
|
1077
1095
|
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1096
|
+
addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
|
|
1097
|
+
let originalCharIndex = chunk.start;
|
|
1098
|
+
let first = true;
|
|
1081
1099
|
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1100
|
+
while (originalCharIndex < chunk.end) {
|
|
1101
|
+
if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
|
|
1102
|
+
this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
|
|
1103
|
+
}
|
|
1085
1104
|
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1105
|
+
if (original[originalCharIndex] === '\n') {
|
|
1106
|
+
loc.line += 1;
|
|
1107
|
+
loc.column = 0;
|
|
1108
|
+
this.generatedCodeLine += 1;
|
|
1109
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
1110
|
+
this.generatedCodeColumn = 0;
|
|
1111
|
+
first = true;
|
|
1112
|
+
} else {
|
|
1113
|
+
loc.column += 1;
|
|
1114
|
+
this.generatedCodeColumn += 1;
|
|
1115
|
+
first = false;
|
|
1116
|
+
}
|
|
1090
1117
|
|
|
1091
|
-
|
|
1092
|
-
loc.line += 1;
|
|
1093
|
-
loc.column = 0;
|
|
1094
|
-
this.generatedCodeLine += 1;
|
|
1095
|
-
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
1096
|
-
this.generatedCodeColumn = 0;
|
|
1097
|
-
first = true;
|
|
1098
|
-
} else {
|
|
1099
|
-
loc.column += 1;
|
|
1100
|
-
this.generatedCodeColumn += 1;
|
|
1101
|
-
first = false;
|
|
1118
|
+
originalCharIndex += 1;
|
|
1102
1119
|
}
|
|
1103
1120
|
|
|
1104
|
-
|
|
1121
|
+
this.pending = null;
|
|
1105
1122
|
}
|
|
1106
1123
|
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
Mappings.prototype.advance = function advance (str) {
|
|
1111
|
-
if (!str) { return; }
|
|
1124
|
+
advance(str) {
|
|
1125
|
+
if (!str) return;
|
|
1112
1126
|
|
|
1113
|
-
|
|
1127
|
+
const lines = str.split('\n');
|
|
1114
1128
|
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1129
|
+
if (lines.length > 1) {
|
|
1130
|
+
for (let i = 0; i < lines.length - 1; i++) {
|
|
1131
|
+
this.generatedCodeLine++;
|
|
1132
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
1133
|
+
}
|
|
1134
|
+
this.generatedCodeColumn = 0;
|
|
1119
1135
|
}
|
|
1120
|
-
this.generatedCodeColumn = 0;
|
|
1121
|
-
}
|
|
1122
1136
|
|
|
1123
|
-
|
|
1124
|
-
}
|
|
1137
|
+
this.generatedCodeColumn += lines[lines.length - 1].length;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1125
1140
|
|
|
1126
|
-
|
|
1141
|
+
const n = '\n';
|
|
1127
1142
|
|
|
1128
|
-
|
|
1143
|
+
const warned = {
|
|
1129
1144
|
insertLeft: false,
|
|
1130
1145
|
insertRight: false,
|
|
1131
|
-
storeName: false
|
|
1132
|
-
};
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
});
|
|
1154
|
-
|
|
1155
|
-
this.byStart[0] = chunk;
|
|
1156
|
-
this.byEnd[string.length] = chunk;
|
|
1157
|
-
};
|
|
1158
|
-
|
|
1159
|
-
MagicString.prototype.addSourcemapLocation = function addSourcemapLocation (char) {
|
|
1160
|
-
this.sourcemapLocations.add(char);
|
|
1161
|
-
};
|
|
1162
|
-
|
|
1163
|
-
MagicString.prototype.append = function append (content) {
|
|
1164
|
-
if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
|
|
1165
|
-
|
|
1166
|
-
this.outro += content;
|
|
1167
|
-
return this;
|
|
1168
|
-
};
|
|
1146
|
+
storeName: false,
|
|
1147
|
+
};
|
|
1148
|
+
|
|
1149
|
+
class MagicString {
|
|
1150
|
+
constructor(string, options = {}) {
|
|
1151
|
+
const chunk = new Chunk$1(0, string.length, string);
|
|
1152
|
+
|
|
1153
|
+
Object.defineProperties(this, {
|
|
1154
|
+
original: { writable: true, value: string },
|
|
1155
|
+
outro: { writable: true, value: '' },
|
|
1156
|
+
intro: { writable: true, value: '' },
|
|
1157
|
+
firstChunk: { writable: true, value: chunk },
|
|
1158
|
+
lastChunk: { writable: true, value: chunk },
|
|
1159
|
+
lastSearchedChunk: { writable: true, value: chunk },
|
|
1160
|
+
byStart: { writable: true, value: {} },
|
|
1161
|
+
byEnd: { writable: true, value: {} },
|
|
1162
|
+
filename: { writable: true, value: options.filename },
|
|
1163
|
+
indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
|
|
1164
|
+
sourcemapLocations: { writable: true, value: new BitSet() },
|
|
1165
|
+
storedNames: { writable: true, value: {} },
|
|
1166
|
+
indentStr: { writable: true, value: guessIndent(string) },
|
|
1167
|
+
});
|
|
1169
1168
|
|
|
1170
|
-
|
|
1171
|
-
|
|
1169
|
+
this.byStart[0] = chunk;
|
|
1170
|
+
this.byEnd[string.length] = chunk;
|
|
1171
|
+
}
|
|
1172
1172
|
|
|
1173
|
-
|
|
1173
|
+
addSourcemapLocation(char) {
|
|
1174
|
+
this.sourcemapLocations.add(char);
|
|
1175
|
+
}
|
|
1174
1176
|
|
|
1175
|
-
|
|
1177
|
+
append(content) {
|
|
1178
|
+
if (typeof content !== 'string') throw new TypeError('outro content must be a string');
|
|
1176
1179
|
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
} else {
|
|
1180
|
-
this.intro += content;
|
|
1180
|
+
this.outro += content;
|
|
1181
|
+
return this;
|
|
1181
1182
|
}
|
|
1182
|
-
return this;
|
|
1183
|
-
};
|
|
1184
1183
|
|
|
1185
|
-
|
|
1186
|
-
|
|
1184
|
+
appendLeft(index, content) {
|
|
1185
|
+
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
1187
1186
|
|
|
1188
|
-
|
|
1187
|
+
this._split(index);
|
|
1189
1188
|
|
|
1190
|
-
|
|
1189
|
+
const chunk = this.byEnd[index];
|
|
1191
1190
|
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1191
|
+
if (chunk) {
|
|
1192
|
+
chunk.appendLeft(content);
|
|
1193
|
+
} else {
|
|
1194
|
+
this.intro += content;
|
|
1195
|
+
}
|
|
1196
|
+
return this;
|
|
1196
1197
|
}
|
|
1197
|
-
return this;
|
|
1198
|
-
};
|
|
1199
1198
|
|
|
1200
|
-
|
|
1201
|
-
|
|
1199
|
+
appendRight(index, content) {
|
|
1200
|
+
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
1202
1201
|
|
|
1203
|
-
|
|
1204
|
-
var clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
|
|
1202
|
+
this._split(index);
|
|
1205
1203
|
|
|
1206
|
-
|
|
1207
|
-
cloned.byStart[clonedChunk.start] = clonedChunk;
|
|
1208
|
-
cloned.byEnd[clonedChunk.end] = clonedChunk;
|
|
1204
|
+
const chunk = this.byStart[index];
|
|
1209
1205
|
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
clonedChunk.next = nextClonedChunk;
|
|
1215
|
-
nextClonedChunk.previous = clonedChunk;
|
|
1216
|
-
|
|
1217
|
-
clonedChunk = nextClonedChunk;
|
|
1206
|
+
if (chunk) {
|
|
1207
|
+
chunk.appendRight(content);
|
|
1208
|
+
} else {
|
|
1209
|
+
this.outro += content;
|
|
1218
1210
|
}
|
|
1219
|
-
|
|
1220
|
-
originalChunk = nextOriginalChunk;
|
|
1211
|
+
return this;
|
|
1221
1212
|
}
|
|
1222
1213
|
|
|
1223
|
-
|
|
1214
|
+
clone() {
|
|
1215
|
+
const cloned = new MagicString(this.original, { filename: this.filename });
|
|
1224
1216
|
|
|
1225
|
-
|
|
1226
|
-
cloned.
|
|
1227
|
-
}
|
|
1217
|
+
let originalChunk = this.firstChunk;
|
|
1218
|
+
let clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());
|
|
1228
1219
|
|
|
1229
|
-
|
|
1220
|
+
while (originalChunk) {
|
|
1221
|
+
cloned.byStart[clonedChunk.start] = clonedChunk;
|
|
1222
|
+
cloned.byEnd[clonedChunk.end] = clonedChunk;
|
|
1230
1223
|
|
|
1231
|
-
|
|
1232
|
-
|
|
1224
|
+
const nextOriginalChunk = originalChunk.next;
|
|
1225
|
+
const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
|
|
1233
1226
|
|
|
1234
|
-
|
|
1235
|
-
|
|
1227
|
+
if (nextClonedChunk) {
|
|
1228
|
+
clonedChunk.next = nextClonedChunk;
|
|
1229
|
+
nextClonedChunk.previous = clonedChunk;
|
|
1230
|
+
|
|
1231
|
+
clonedChunk = nextClonedChunk;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
originalChunk = nextOriginalChunk;
|
|
1235
|
+
}
|
|
1236
1236
|
|
|
1237
|
-
|
|
1238
|
-
var this$1$1 = this;
|
|
1237
|
+
cloned.lastChunk = clonedChunk;
|
|
1239
1238
|
|
|
1240
|
-
|
|
1239
|
+
if (this.indentExclusionRanges) {
|
|
1240
|
+
cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
|
|
1241
|
+
}
|
|
1241
1242
|
|
|
1242
|
-
|
|
1243
|
-
var names = Object.keys(this.storedNames);
|
|
1244
|
-
var mappings = new Mappings(options.hires);
|
|
1243
|
+
cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
|
|
1245
1244
|
|
|
1246
|
-
|
|
1245
|
+
cloned.intro = this.intro;
|
|
1246
|
+
cloned.outro = this.outro;
|
|
1247
1247
|
|
|
1248
|
-
|
|
1249
|
-
mappings.advance(this.intro);
|
|
1248
|
+
return cloned;
|
|
1250
1249
|
}
|
|
1251
1250
|
|
|
1252
|
-
|
|
1253
|
-
|
|
1251
|
+
generateDecodedMap(options) {
|
|
1252
|
+
options = options || {};
|
|
1254
1253
|
|
|
1255
|
-
|
|
1254
|
+
const sourceIndex = 0;
|
|
1255
|
+
const names = Object.keys(this.storedNames);
|
|
1256
|
+
const mappings = new Mappings(options.hires);
|
|
1256
1257
|
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
loc,
|
|
1262
|
-
chunk.storeName ? names.indexOf(chunk.original) : -1
|
|
1263
|
-
);
|
|
1264
|
-
} else {
|
|
1265
|
-
mappings.addUneditedChunk(sourceIndex, chunk, this$1$1.original, loc, this$1$1.sourcemapLocations);
|
|
1258
|
+
const locate = getLocator(this.original);
|
|
1259
|
+
|
|
1260
|
+
if (this.intro) {
|
|
1261
|
+
mappings.advance(this.intro);
|
|
1266
1262
|
}
|
|
1267
1263
|
|
|
1268
|
-
|
|
1269
|
-
|
|
1264
|
+
this.firstChunk.eachNext((chunk) => {
|
|
1265
|
+
const loc = locate(chunk.start);
|
|
1270
1266
|
|
|
1271
|
-
|
|
1272
|
-
file: options.file ? options.file.split(/[/\\]/).pop() : null,
|
|
1273
|
-
sources: [options.source ? getRelativePath(options.file || '', options.source) : null],
|
|
1274
|
-
sourcesContent: options.includeContent ? [this.original] : [null],
|
|
1275
|
-
names: names,
|
|
1276
|
-
mappings: mappings.raw
|
|
1277
|
-
};
|
|
1278
|
-
};
|
|
1267
|
+
if (chunk.intro.length) mappings.advance(chunk.intro);
|
|
1279
1268
|
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1269
|
+
if (chunk.edited) {
|
|
1270
|
+
mappings.addEdit(
|
|
1271
|
+
sourceIndex,
|
|
1272
|
+
chunk.content,
|
|
1273
|
+
loc,
|
|
1274
|
+
chunk.storeName ? names.indexOf(chunk.original) : -1
|
|
1275
|
+
);
|
|
1276
|
+
} else {
|
|
1277
|
+
mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
|
|
1278
|
+
}
|
|
1283
1279
|
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
};
|
|
1280
|
+
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
1281
|
+
});
|
|
1287
1282
|
|
|
1288
|
-
|
|
1289
|
-
|
|
1283
|
+
return {
|
|
1284
|
+
file: options.file ? options.file.split(/[/\\]/).pop() : null,
|
|
1285
|
+
sources: [options.source ? getRelativePath(options.file || '', options.source) : null],
|
|
1286
|
+
sourcesContent: options.includeContent ? [this.original] : [null],
|
|
1287
|
+
names,
|
|
1288
|
+
mappings: mappings.raw,
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1290
1291
|
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
indentStr = undefined;
|
|
1292
|
+
generateMap(options) {
|
|
1293
|
+
return new SourceMap(this.generateDecodedMap(options));
|
|
1294
1294
|
}
|
|
1295
1295
|
|
|
1296
|
-
|
|
1296
|
+
getIndentString() {
|
|
1297
|
+
return this.indentStr === null ? '\t' : this.indentStr;
|
|
1298
|
+
}
|
|
1297
1299
|
|
|
1298
|
-
|
|
1300
|
+
indent(indentStr, options) {
|
|
1301
|
+
const pattern = /^[^\r\n]/gm;
|
|
1299
1302
|
|
|
1300
|
-
|
|
1303
|
+
if (isObject$1(indentStr)) {
|
|
1304
|
+
options = indentStr;
|
|
1305
|
+
indentStr = undefined;
|
|
1306
|
+
}
|
|
1301
1307
|
|
|
1302
|
-
|
|
1303
|
-
var isExcluded = {};
|
|
1308
|
+
indentStr = indentStr !== undefined ? indentStr : this.indentStr || '\t';
|
|
1304
1309
|
|
|
1305
|
-
|
|
1306
|
-
var exclusions =
|
|
1307
|
-
typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
|
|
1308
|
-
exclusions.forEach(function (exclusion) {
|
|
1309
|
-
for (var i = exclusion[0]; i < exclusion[1]; i += 1) {
|
|
1310
|
-
isExcluded[i] = true;
|
|
1311
|
-
}
|
|
1312
|
-
});
|
|
1313
|
-
}
|
|
1310
|
+
if (indentStr === '') return this; // noop
|
|
1314
1311
|
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
return match;
|
|
1320
|
-
};
|
|
1312
|
+
options = options || {};
|
|
1313
|
+
|
|
1314
|
+
// Process exclusion ranges
|
|
1315
|
+
const isExcluded = {};
|
|
1321
1316
|
|
|
1322
|
-
|
|
1317
|
+
if (options.exclude) {
|
|
1318
|
+
const exclusions =
|
|
1319
|
+
typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;
|
|
1320
|
+
exclusions.forEach((exclusion) => {
|
|
1321
|
+
for (let i = exclusion[0]; i < exclusion[1]; i += 1) {
|
|
1322
|
+
isExcluded[i] = true;
|
|
1323
|
+
}
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1323
1326
|
|
|
1324
|
-
|
|
1325
|
-
|
|
1327
|
+
let shouldIndentNextCharacter = options.indentStart !== false;
|
|
1328
|
+
const replacer = (match) => {
|
|
1329
|
+
if (shouldIndentNextCharacter) return `${indentStr}${match}`;
|
|
1330
|
+
shouldIndentNextCharacter = true;
|
|
1331
|
+
return match;
|
|
1332
|
+
};
|
|
1326
1333
|
|
|
1327
|
-
|
|
1328
|
-
var end = chunk.end;
|
|
1334
|
+
this.intro = this.intro.replace(pattern, replacer);
|
|
1329
1335
|
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
chunk.content = chunk.content.replace(pattern, replacer);
|
|
1336
|
+
let charIndex = 0;
|
|
1337
|
+
let chunk = this.firstChunk;
|
|
1333
1338
|
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
} else {
|
|
1339
|
-
charIndex = chunk.start;
|
|
1339
|
+
while (chunk) {
|
|
1340
|
+
const end = chunk.end;
|
|
1340
1341
|
|
|
1341
|
-
|
|
1342
|
+
if (chunk.edited) {
|
|
1342
1343
|
if (!isExcluded[charIndex]) {
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
if (
|
|
1346
|
-
shouldIndentNextCharacter =
|
|
1347
|
-
} else if (char !== '\r' && shouldIndentNextCharacter) {
|
|
1348
|
-
shouldIndentNextCharacter = false;
|
|
1349
|
-
|
|
1350
|
-
if (charIndex === chunk.start) {
|
|
1351
|
-
chunk.prependRight(indentStr);
|
|
1352
|
-
} else {
|
|
1353
|
-
this._splitChunk(chunk, charIndex);
|
|
1354
|
-
chunk = chunk.next;
|
|
1355
|
-
chunk.prependRight(indentStr);
|
|
1356
|
-
}
|
|
1344
|
+
chunk.content = chunk.content.replace(pattern, replacer);
|
|
1345
|
+
|
|
1346
|
+
if (chunk.content.length) {
|
|
1347
|
+
shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n';
|
|
1357
1348
|
}
|
|
1358
1349
|
}
|
|
1350
|
+
} else {
|
|
1351
|
+
charIndex = chunk.start;
|
|
1352
|
+
|
|
1353
|
+
while (charIndex < end) {
|
|
1354
|
+
if (!isExcluded[charIndex]) {
|
|
1355
|
+
const char = this.original[charIndex];
|
|
1356
|
+
|
|
1357
|
+
if (char === '\n') {
|
|
1358
|
+
shouldIndentNextCharacter = true;
|
|
1359
|
+
} else if (char !== '\r' && shouldIndentNextCharacter) {
|
|
1360
|
+
shouldIndentNextCharacter = false;
|
|
1361
|
+
|
|
1362
|
+
if (charIndex === chunk.start) {
|
|
1363
|
+
chunk.prependRight(indentStr);
|
|
1364
|
+
} else {
|
|
1365
|
+
this._splitChunk(chunk, charIndex);
|
|
1366
|
+
chunk = chunk.next;
|
|
1367
|
+
chunk.prependRight(indentStr);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1359
1371
|
|
|
1360
|
-
|
|
1372
|
+
charIndex += 1;
|
|
1373
|
+
}
|
|
1361
1374
|
}
|
|
1375
|
+
|
|
1376
|
+
charIndex = chunk.end;
|
|
1377
|
+
chunk = chunk.next;
|
|
1362
1378
|
}
|
|
1363
1379
|
|
|
1364
|
-
|
|
1365
|
-
chunk = chunk.next;
|
|
1366
|
-
}
|
|
1380
|
+
this.outro = this.outro.replace(pattern, replacer);
|
|
1367
1381
|
|
|
1368
|
-
|
|
1382
|
+
return this;
|
|
1383
|
+
}
|
|
1369
1384
|
|
|
1370
|
-
|
|
1371
|
-
|
|
1385
|
+
insert() {
|
|
1386
|
+
throw new Error(
|
|
1387
|
+
'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)'
|
|
1388
|
+
);
|
|
1389
|
+
}
|
|
1372
1390
|
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1391
|
+
insertLeft(index, content) {
|
|
1392
|
+
if (!warned.insertLeft) {
|
|
1393
|
+
console.warn(
|
|
1394
|
+
'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'
|
|
1395
|
+
); // eslint-disable-line no-console
|
|
1396
|
+
warned.insertLeft = true;
|
|
1397
|
+
}
|
|
1376
1398
|
|
|
1377
|
-
|
|
1378
|
-
if (!warned.insertLeft) {
|
|
1379
|
-
console.warn('magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'); // eslint-disable-line no-console
|
|
1380
|
-
warned.insertLeft = true;
|
|
1399
|
+
return this.appendLeft(index, content);
|
|
1381
1400
|
}
|
|
1382
1401
|
|
|
1383
|
-
|
|
1384
|
-
|
|
1402
|
+
insertRight(index, content) {
|
|
1403
|
+
if (!warned.insertRight) {
|
|
1404
|
+
console.warn(
|
|
1405
|
+
'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'
|
|
1406
|
+
); // eslint-disable-line no-console
|
|
1407
|
+
warned.insertRight = true;
|
|
1408
|
+
}
|
|
1385
1409
|
|
|
1386
|
-
|
|
1387
|
-
if (!warned.insertRight) {
|
|
1388
|
-
console.warn('magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'); // eslint-disable-line no-console
|
|
1389
|
-
warned.insertRight = true;
|
|
1410
|
+
return this.prependRight(index, content);
|
|
1390
1411
|
}
|
|
1391
1412
|
|
|
1392
|
-
|
|
1393
|
-
|
|
1413
|
+
move(start, end, index) {
|
|
1414
|
+
if (index >= start && index <= end) throw new Error('Cannot move a selection inside itself');
|
|
1394
1415
|
|
|
1395
|
-
|
|
1396
|
-
|
|
1416
|
+
this._split(start);
|
|
1417
|
+
this._split(end);
|
|
1418
|
+
this._split(index);
|
|
1397
1419
|
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
this._split(index);
|
|
1420
|
+
const first = this.byStart[start];
|
|
1421
|
+
const last = this.byEnd[end];
|
|
1401
1422
|
|
|
1402
|
-
|
|
1403
|
-
|
|
1423
|
+
const oldLeft = first.previous;
|
|
1424
|
+
const oldRight = last.next;
|
|
1404
1425
|
|
|
1405
|
-
|
|
1406
|
-
|
|
1426
|
+
const newRight = this.byStart[index];
|
|
1427
|
+
if (!newRight && last === this.lastChunk) return this;
|
|
1428
|
+
const newLeft = newRight ? newRight.previous : this.lastChunk;
|
|
1407
1429
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
var newLeft = newRight ? newRight.previous : this.lastChunk;
|
|
1430
|
+
if (oldLeft) oldLeft.next = oldRight;
|
|
1431
|
+
if (oldRight) oldRight.previous = oldLeft;
|
|
1411
1432
|
|
|
1412
|
-
|
|
1413
|
-
|
|
1433
|
+
if (newLeft) newLeft.next = first;
|
|
1434
|
+
if (newRight) newRight.previous = last;
|
|
1414
1435
|
|
|
1415
|
-
|
|
1416
|
-
|
|
1436
|
+
if (!first.previous) this.firstChunk = last.next;
|
|
1437
|
+
if (!last.next) {
|
|
1438
|
+
this.lastChunk = first.previous;
|
|
1439
|
+
this.lastChunk.next = null;
|
|
1440
|
+
}
|
|
1417
1441
|
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
this.lastChunk = first.previous;
|
|
1421
|
-
this.lastChunk.next = null;
|
|
1422
|
-
}
|
|
1442
|
+
first.previous = newLeft;
|
|
1443
|
+
last.next = newRight || null;
|
|
1423
1444
|
|
|
1424
|
-
|
|
1425
|
-
|
|
1445
|
+
if (!newLeft) this.firstChunk = first;
|
|
1446
|
+
if (!newRight) this.lastChunk = last;
|
|
1447
|
+
return this;
|
|
1448
|
+
}
|
|
1426
1449
|
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
return this;
|
|
1430
|
-
};
|
|
1450
|
+
overwrite(start, end, content, options) {
|
|
1451
|
+
if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
|
|
1431
1452
|
|
|
1432
|
-
|
|
1433
|
-
|
|
1453
|
+
while (start < 0) start += this.original.length;
|
|
1454
|
+
while (end < 0) end += this.original.length;
|
|
1434
1455
|
|
|
1435
|
-
|
|
1436
|
-
|
|
1456
|
+
if (end > this.original.length) throw new Error('end is out of bounds');
|
|
1457
|
+
if (start === end)
|
|
1458
|
+
throw new Error(
|
|
1459
|
+
'Cannot overwrite a zero-length range – use appendLeft or prependRight instead'
|
|
1460
|
+
);
|
|
1437
1461
|
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
{ throw new Error('Cannot overwrite a zero-length range – use appendLeft or prependRight instead'); }
|
|
1462
|
+
this._split(start);
|
|
1463
|
+
this._split(end);
|
|
1441
1464
|
|
|
1442
|
-
|
|
1443
|
-
|
|
1465
|
+
if (options === true) {
|
|
1466
|
+
if (!warned.storeName) {
|
|
1467
|
+
console.warn(
|
|
1468
|
+
'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'
|
|
1469
|
+
); // eslint-disable-line no-console
|
|
1470
|
+
warned.storeName = true;
|
|
1471
|
+
}
|
|
1444
1472
|
|
|
1445
|
-
|
|
1446
|
-
if (!warned.storeName) {
|
|
1447
|
-
console.warn('The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'); // eslint-disable-line no-console
|
|
1448
|
-
warned.storeName = true;
|
|
1473
|
+
options = { storeName: true };
|
|
1449
1474
|
}
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
var first = this.byStart[start];
|
|
1462
|
-
var last = this.byEnd[end];
|
|
1463
|
-
|
|
1464
|
-
if (first) {
|
|
1465
|
-
if (end > first.end && first.next !== this.byStart[first.end]) {
|
|
1466
|
-
throw new Error('Cannot overwrite across a split point');
|
|
1475
|
+
const storeName = options !== undefined ? options.storeName : false;
|
|
1476
|
+
const contentOnly = options !== undefined ? options.contentOnly : false;
|
|
1477
|
+
|
|
1478
|
+
if (storeName) {
|
|
1479
|
+
const original = this.original.slice(start, end);
|
|
1480
|
+
Object.defineProperty(this.storedNames, original, {
|
|
1481
|
+
writable: true,
|
|
1482
|
+
value: true,
|
|
1483
|
+
enumerable: true,
|
|
1484
|
+
});
|
|
1467
1485
|
}
|
|
1468
1486
|
|
|
1469
|
-
first
|
|
1487
|
+
const first = this.byStart[start];
|
|
1488
|
+
const last = this.byEnd[end];
|
|
1470
1489
|
|
|
1471
|
-
if (first
|
|
1472
|
-
|
|
1490
|
+
if (first) {
|
|
1491
|
+
let chunk = first;
|
|
1473
1492
|
while (chunk !== last) {
|
|
1474
|
-
chunk.
|
|
1493
|
+
if (chunk.next !== this.byStart[chunk.end]) {
|
|
1494
|
+
throw new Error('Cannot overwrite across a split point');
|
|
1495
|
+
}
|
|
1475
1496
|
chunk = chunk.next;
|
|
1497
|
+
chunk.edit('', false);
|
|
1476
1498
|
}
|
|
1477
1499
|
|
|
1478
|
-
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
var newChunk = new Chunk$1(start, end, '').edit(content, storeName);
|
|
1500
|
+
first.edit(content, storeName, contentOnly);
|
|
1501
|
+
} else {
|
|
1502
|
+
// must be inserting at the end
|
|
1503
|
+
const newChunk = new Chunk$1(start, end, '').edit(content, storeName);
|
|
1483
1504
|
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1505
|
+
// TODO last chunk in the array may not be the last chunk, if it's moved...
|
|
1506
|
+
last.next = newChunk;
|
|
1507
|
+
newChunk.previous = last;
|
|
1508
|
+
}
|
|
1509
|
+
return this;
|
|
1487
1510
|
}
|
|
1488
|
-
return this;
|
|
1489
|
-
};
|
|
1490
|
-
|
|
1491
|
-
MagicString.prototype.prepend = function prepend (content) {
|
|
1492
|
-
if (typeof content !== 'string') { throw new TypeError('outro content must be a string'); }
|
|
1493
|
-
|
|
1494
|
-
this.intro = content + this.intro;
|
|
1495
|
-
return this;
|
|
1496
|
-
};
|
|
1497
|
-
|
|
1498
|
-
MagicString.prototype.prependLeft = function prependLeft (index, content) {
|
|
1499
|
-
if (typeof content !== 'string') { throw new TypeError('inserted content must be a string'); }
|
|
1500
1511
|
|
|
1501
|
-
|
|
1512
|
+
prepend(content) {
|
|
1513
|
+
if (typeof content !== 'string') throw new TypeError('outro content must be a string');
|
|
1502
1514
|
|
|
1503
|
-
var chunk = this.byEnd[index];
|
|
1504
|
-
|
|
1505
|
-
if (chunk) {
|
|
1506
|
-
chunk.prependLeft(content);
|
|
1507
|
-
} else {
|
|
1508
1515
|
this.intro = content + this.intro;
|
|
1516
|
+
return this;
|
|
1509
1517
|
}
|
|
1510
|
-
return this;
|
|
1511
|
-
};
|
|
1512
1518
|
|
|
1513
|
-
|
|
1514
|
-
|
|
1519
|
+
prependLeft(index, content) {
|
|
1520
|
+
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
1515
1521
|
|
|
1516
|
-
|
|
1522
|
+
this._split(index);
|
|
1517
1523
|
|
|
1518
|
-
|
|
1524
|
+
const chunk = this.byEnd[index];
|
|
1519
1525
|
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1526
|
+
if (chunk) {
|
|
1527
|
+
chunk.prependLeft(content);
|
|
1528
|
+
} else {
|
|
1529
|
+
this.intro = content + this.intro;
|
|
1530
|
+
}
|
|
1531
|
+
return this;
|
|
1524
1532
|
}
|
|
1525
|
-
return this;
|
|
1526
|
-
};
|
|
1527
|
-
|
|
1528
|
-
MagicString.prototype.remove = function remove (start, end) {
|
|
1529
|
-
while (start < 0) { start += this.original.length; }
|
|
1530
|
-
while (end < 0) { end += this.original.length; }
|
|
1531
1533
|
|
|
1532
|
-
|
|
1534
|
+
prependRight(index, content) {
|
|
1535
|
+
if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
|
|
1533
1536
|
|
|
1534
|
-
|
|
1535
|
-
if (start > end) { throw new Error('end must be greater than start'); }
|
|
1537
|
+
this._split(index);
|
|
1536
1538
|
|
|
1537
|
-
|
|
1538
|
-
this._split(end);
|
|
1539
|
+
const chunk = this.byStart[index];
|
|
1539
1540
|
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
chunk.outro = '';
|
|
1545
|
-
chunk.edit('');
|
|
1546
|
-
|
|
1547
|
-
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
1548
|
-
}
|
|
1549
|
-
return this;
|
|
1550
|
-
};
|
|
1551
|
-
|
|
1552
|
-
MagicString.prototype.lastChar = function lastChar () {
|
|
1553
|
-
if (this.outro.length)
|
|
1554
|
-
{ return this.outro[this.outro.length - 1]; }
|
|
1555
|
-
var chunk = this.lastChunk;
|
|
1556
|
-
do {
|
|
1557
|
-
if (chunk.outro.length)
|
|
1558
|
-
{ return chunk.outro[chunk.outro.length - 1]; }
|
|
1559
|
-
if (chunk.content.length)
|
|
1560
|
-
{ return chunk.content[chunk.content.length - 1]; }
|
|
1561
|
-
if (chunk.intro.length)
|
|
1562
|
-
{ return chunk.intro[chunk.intro.length - 1]; }
|
|
1563
|
-
} while (chunk = chunk.previous);
|
|
1564
|
-
if (this.intro.length)
|
|
1565
|
-
{ return this.intro[this.intro.length - 1]; }
|
|
1566
|
-
return '';
|
|
1567
|
-
};
|
|
1568
|
-
|
|
1569
|
-
MagicString.prototype.lastLine = function lastLine () {
|
|
1570
|
-
var lineIndex = this.outro.lastIndexOf(n);
|
|
1571
|
-
if (lineIndex !== -1)
|
|
1572
|
-
{ return this.outro.substr(lineIndex + 1); }
|
|
1573
|
-
var lineStr = this.outro;
|
|
1574
|
-
var chunk = this.lastChunk;
|
|
1575
|
-
do {
|
|
1576
|
-
if (chunk.outro.length > 0) {
|
|
1577
|
-
lineIndex = chunk.outro.lastIndexOf(n);
|
|
1578
|
-
if (lineIndex !== -1)
|
|
1579
|
-
{ return chunk.outro.substr(lineIndex + 1) + lineStr; }
|
|
1580
|
-
lineStr = chunk.outro + lineStr;
|
|
1541
|
+
if (chunk) {
|
|
1542
|
+
chunk.prependRight(content);
|
|
1543
|
+
} else {
|
|
1544
|
+
this.outro = content + this.outro;
|
|
1581
1545
|
}
|
|
1546
|
+
return this;
|
|
1547
|
+
}
|
|
1582
1548
|
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
{ return chunk.content.substr(lineIndex + 1) + lineStr; }
|
|
1587
|
-
lineStr = chunk.content + lineStr;
|
|
1588
|
-
}
|
|
1549
|
+
remove(start, end) {
|
|
1550
|
+
while (start < 0) start += this.original.length;
|
|
1551
|
+
while (end < 0) end += this.original.length;
|
|
1589
1552
|
|
|
1590
|
-
if (
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
lineStr = chunk.intro + lineStr;
|
|
1595
|
-
}
|
|
1596
|
-
} while (chunk = chunk.previous);
|
|
1597
|
-
lineIndex = this.intro.lastIndexOf(n);
|
|
1598
|
-
if (lineIndex !== -1)
|
|
1599
|
-
{ return this.intro.substr(lineIndex + 1) + lineStr; }
|
|
1600
|
-
return this.intro + lineStr;
|
|
1601
|
-
};
|
|
1553
|
+
if (start === end) return this;
|
|
1554
|
+
|
|
1555
|
+
if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');
|
|
1556
|
+
if (start > end) throw new Error('end must be greater than start');
|
|
1602
1557
|
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
if ( end === void 0 ) end = this.original.length;
|
|
1558
|
+
this._split(start);
|
|
1559
|
+
this._split(end);
|
|
1606
1560
|
|
|
1607
|
-
|
|
1608
|
-
while (end < 0) { end += this.original.length; }
|
|
1561
|
+
let chunk = this.byStart[start];
|
|
1609
1562
|
|
|
1610
|
-
|
|
1563
|
+
while (chunk) {
|
|
1564
|
+
chunk.intro = '';
|
|
1565
|
+
chunk.outro = '';
|
|
1566
|
+
chunk.edit('');
|
|
1611
1567
|
|
|
1612
|
-
|
|
1613
|
-
var chunk = this.firstChunk;
|
|
1614
|
-
while (chunk && (chunk.start > start || chunk.end <= start)) {
|
|
1615
|
-
// found end chunk before start
|
|
1616
|
-
if (chunk.start < end && chunk.end >= end) {
|
|
1617
|
-
return result;
|
|
1568
|
+
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
1618
1569
|
}
|
|
1570
|
+
return this;
|
|
1571
|
+
}
|
|
1619
1572
|
|
|
1620
|
-
|
|
1573
|
+
lastChar() {
|
|
1574
|
+
if (this.outro.length) return this.outro[this.outro.length - 1];
|
|
1575
|
+
let chunk = this.lastChunk;
|
|
1576
|
+
do {
|
|
1577
|
+
if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];
|
|
1578
|
+
if (chunk.content.length) return chunk.content[chunk.content.length - 1];
|
|
1579
|
+
if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];
|
|
1580
|
+
} while ((chunk = chunk.previous));
|
|
1581
|
+
if (this.intro.length) return this.intro[this.intro.length - 1];
|
|
1582
|
+
return '';
|
|
1621
1583
|
}
|
|
1622
1584
|
|
|
1623
|
-
|
|
1624
|
-
|
|
1585
|
+
lastLine() {
|
|
1586
|
+
let lineIndex = this.outro.lastIndexOf(n);
|
|
1587
|
+
if (lineIndex !== -1) return this.outro.substr(lineIndex + 1);
|
|
1588
|
+
let lineStr = this.outro;
|
|
1589
|
+
let chunk = this.lastChunk;
|
|
1590
|
+
do {
|
|
1591
|
+
if (chunk.outro.length > 0) {
|
|
1592
|
+
lineIndex = chunk.outro.lastIndexOf(n);
|
|
1593
|
+
if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;
|
|
1594
|
+
lineStr = chunk.outro + lineStr;
|
|
1595
|
+
}
|
|
1625
1596
|
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1597
|
+
if (chunk.content.length > 0) {
|
|
1598
|
+
lineIndex = chunk.content.lastIndexOf(n);
|
|
1599
|
+
if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;
|
|
1600
|
+
lineStr = chunk.content + lineStr;
|
|
1601
|
+
}
|
|
1631
1602
|
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1603
|
+
if (chunk.intro.length > 0) {
|
|
1604
|
+
lineIndex = chunk.intro.lastIndexOf(n);
|
|
1605
|
+
if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;
|
|
1606
|
+
lineStr = chunk.intro + lineStr;
|
|
1607
|
+
}
|
|
1608
|
+
} while ((chunk = chunk.previous));
|
|
1609
|
+
lineIndex = this.intro.lastIndexOf(n);
|
|
1610
|
+
if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;
|
|
1611
|
+
return this.intro + lineStr;
|
|
1612
|
+
}
|
|
1635
1613
|
|
|
1636
|
-
|
|
1637
|
-
|
|
1614
|
+
slice(start = 0, end = this.original.length) {
|
|
1615
|
+
while (start < 0) start += this.original.length;
|
|
1616
|
+
while (end < 0) end += this.original.length;
|
|
1638
1617
|
|
|
1639
|
-
result
|
|
1618
|
+
let result = '';
|
|
1640
1619
|
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1620
|
+
// find start chunk
|
|
1621
|
+
let chunk = this.firstChunk;
|
|
1622
|
+
while (chunk && (chunk.start > start || chunk.end <= start)) {
|
|
1623
|
+
// found end chunk before start
|
|
1624
|
+
if (chunk.start < end && chunk.end >= end) {
|
|
1625
|
+
return result;
|
|
1626
|
+
}
|
|
1644
1627
|
|
|
1645
|
-
|
|
1646
|
-
break;
|
|
1628
|
+
chunk = chunk.next;
|
|
1647
1629
|
}
|
|
1648
1630
|
|
|
1649
|
-
chunk
|
|
1650
|
-
|
|
1631
|
+
if (chunk && chunk.edited && chunk.start !== start)
|
|
1632
|
+
throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
|
|
1651
1633
|
|
|
1652
|
-
|
|
1653
|
-
|
|
1634
|
+
const startChunk = chunk;
|
|
1635
|
+
while (chunk) {
|
|
1636
|
+
if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
|
|
1637
|
+
result += chunk.intro;
|
|
1638
|
+
}
|
|
1654
1639
|
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
clone.remove(0, start);
|
|
1659
|
-
clone.remove(end, clone.original.length);
|
|
1640
|
+
const containsEnd = chunk.start < end && chunk.end >= end;
|
|
1641
|
+
if (containsEnd && chunk.edited && chunk.end !== end)
|
|
1642
|
+
throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
|
|
1660
1643
|
|
|
1661
|
-
|
|
1662
|
-
|
|
1644
|
+
const sliceStart = startChunk === chunk ? start - chunk.start : 0;
|
|
1645
|
+
const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
|
|
1663
1646
|
|
|
1664
|
-
|
|
1665
|
-
if (this.byStart[index] || this.byEnd[index]) { return; }
|
|
1647
|
+
result += chunk.content.slice(sliceStart, sliceEnd);
|
|
1666
1648
|
|
|
1667
|
-
|
|
1668
|
-
|
|
1649
|
+
if (chunk.outro && (!containsEnd || chunk.end === end)) {
|
|
1650
|
+
result += chunk.outro;
|
|
1651
|
+
}
|
|
1669
1652
|
|
|
1670
|
-
|
|
1671
|
-
|
|
1653
|
+
if (containsEnd) {
|
|
1654
|
+
break;
|
|
1655
|
+
}
|
|
1672
1656
|
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
};
|
|
1657
|
+
chunk = chunk.next;
|
|
1658
|
+
}
|
|
1676
1659
|
|
|
1677
|
-
|
|
1678
|
-
if (chunk.edited && chunk.content.length) {
|
|
1679
|
-
// zero-length edited chunks are a special case (overlapping replacements)
|
|
1680
|
-
var loc = getLocator(this.original)(index);
|
|
1681
|
-
throw new Error(
|
|
1682
|
-
("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")")
|
|
1683
|
-
);
|
|
1660
|
+
return result;
|
|
1684
1661
|
}
|
|
1685
1662
|
|
|
1686
|
-
|
|
1663
|
+
// TODO deprecate this? not really very useful
|
|
1664
|
+
snip(start, end) {
|
|
1665
|
+
const clone = this.clone();
|
|
1666
|
+
clone.remove(0, start);
|
|
1667
|
+
clone.remove(end, clone.original.length);
|
|
1687
1668
|
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
this.byEnd[newChunk.end] = newChunk;
|
|
1669
|
+
return clone;
|
|
1670
|
+
}
|
|
1691
1671
|
|
|
1692
|
-
|
|
1672
|
+
_split(index) {
|
|
1673
|
+
if (this.byStart[index] || this.byEnd[index]) return;
|
|
1693
1674
|
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
};
|
|
1675
|
+
let chunk = this.lastSearchedChunk;
|
|
1676
|
+
const searchForward = index > chunk.end;
|
|
1697
1677
|
|
|
1698
|
-
|
|
1699
|
-
|
|
1678
|
+
while (chunk) {
|
|
1679
|
+
if (chunk.contains(index)) return this._splitChunk(chunk, index);
|
|
1700
1680
|
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
str += chunk.toString();
|
|
1704
|
-
chunk = chunk.next;
|
|
1681
|
+
chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
|
|
1682
|
+
}
|
|
1705
1683
|
}
|
|
1706
1684
|
|
|
1707
|
-
|
|
1708
|
-
|
|
1685
|
+
_splitChunk(chunk, index) {
|
|
1686
|
+
if (chunk.edited && chunk.content.length) {
|
|
1687
|
+
// zero-length edited chunks are a special case (overlapping replacements)
|
|
1688
|
+
const loc = getLocator(this.original)(index);
|
|
1689
|
+
throw new Error(
|
|
1690
|
+
`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`
|
|
1691
|
+
);
|
|
1692
|
+
}
|
|
1709
1693
|
|
|
1710
|
-
|
|
1711
|
-
var chunk = this.firstChunk;
|
|
1712
|
-
do {
|
|
1713
|
-
if (chunk.intro.length && chunk.intro.trim() ||
|
|
1714
|
-
chunk.content.length && chunk.content.trim() ||
|
|
1715
|
-
chunk.outro.length && chunk.outro.trim())
|
|
1716
|
-
{ return false; }
|
|
1717
|
-
} while (chunk = chunk.next);
|
|
1718
|
-
return true;
|
|
1719
|
-
};
|
|
1694
|
+
const newChunk = chunk.split(index);
|
|
1720
1695
|
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
do {
|
|
1725
|
-
length += chunk.intro.length + chunk.content.length + chunk.outro.length;
|
|
1726
|
-
} while (chunk = chunk.next);
|
|
1727
|
-
return length;
|
|
1728
|
-
};
|
|
1696
|
+
this.byEnd[index] = chunk;
|
|
1697
|
+
this.byStart[index] = newChunk;
|
|
1698
|
+
this.byEnd[newChunk.end] = newChunk;
|
|
1729
1699
|
|
|
1730
|
-
|
|
1731
|
-
return this.trim('[\\r\\n]');
|
|
1732
|
-
};
|
|
1700
|
+
if (chunk === this.lastChunk) this.lastChunk = newChunk;
|
|
1733
1701
|
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
}
|
|
1702
|
+
this.lastSearchedChunk = chunk;
|
|
1703
|
+
return true;
|
|
1704
|
+
}
|
|
1737
1705
|
|
|
1738
|
-
|
|
1739
|
-
|
|
1706
|
+
toString() {
|
|
1707
|
+
let str = this.intro;
|
|
1740
1708
|
|
|
1741
|
-
|
|
1742
|
-
|
|
1709
|
+
let chunk = this.firstChunk;
|
|
1710
|
+
while (chunk) {
|
|
1711
|
+
str += chunk.toString();
|
|
1712
|
+
chunk = chunk.next;
|
|
1713
|
+
}
|
|
1743
1714
|
|
|
1744
|
-
|
|
1715
|
+
return str + this.outro;
|
|
1716
|
+
}
|
|
1745
1717
|
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1718
|
+
isEmpty() {
|
|
1719
|
+
let chunk = this.firstChunk;
|
|
1720
|
+
do {
|
|
1721
|
+
if (
|
|
1722
|
+
(chunk.intro.length && chunk.intro.trim()) ||
|
|
1723
|
+
(chunk.content.length && chunk.content.trim()) ||
|
|
1724
|
+
(chunk.outro.length && chunk.outro.trim())
|
|
1725
|
+
)
|
|
1726
|
+
return false;
|
|
1727
|
+
} while ((chunk = chunk.next));
|
|
1728
|
+
return true;
|
|
1729
|
+
}
|
|
1749
1730
|
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1731
|
+
length() {
|
|
1732
|
+
let chunk = this.firstChunk;
|
|
1733
|
+
let length = 0;
|
|
1734
|
+
do {
|
|
1735
|
+
length += chunk.intro.length + chunk.content.length + chunk.outro.length;
|
|
1736
|
+
} while ((chunk = chunk.next));
|
|
1737
|
+
return length;
|
|
1738
|
+
}
|
|
1755
1739
|
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
}
|
|
1740
|
+
trimLines() {
|
|
1741
|
+
return this.trim('[\\r\\n]');
|
|
1742
|
+
}
|
|
1760
1743
|
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
}
|
|
1744
|
+
trim(charType) {
|
|
1745
|
+
return this.trimStart(charType).trimEnd(charType);
|
|
1746
|
+
}
|
|
1764
1747
|
|
|
1765
|
-
|
|
1766
|
-
|
|
1748
|
+
trimEndAborted(charType) {
|
|
1749
|
+
const rx = new RegExp((charType || '\\s') + '+$');
|
|
1767
1750
|
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
return this;
|
|
1771
|
-
};
|
|
1772
|
-
MagicString.prototype.trimStartAborted = function trimStartAborted (charType) {
|
|
1773
|
-
var rx = new RegExp('^' + (charType || '\\s') + '+');
|
|
1751
|
+
this.outro = this.outro.replace(rx, '');
|
|
1752
|
+
if (this.outro.length) return true;
|
|
1774
1753
|
|
|
1775
|
-
|
|
1776
|
-
if (this.intro.length) { return true; }
|
|
1754
|
+
let chunk = this.lastChunk;
|
|
1777
1755
|
|
|
1778
|
-
|
|
1756
|
+
do {
|
|
1757
|
+
const end = chunk.end;
|
|
1758
|
+
const aborted = chunk.trimEnd(rx);
|
|
1779
1759
|
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1760
|
+
// if chunk was trimmed, we have a new lastChunk
|
|
1761
|
+
if (chunk.end !== end) {
|
|
1762
|
+
if (this.lastChunk === chunk) {
|
|
1763
|
+
this.lastChunk = chunk.next;
|
|
1764
|
+
}
|
|
1783
1765
|
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1766
|
+
this.byEnd[chunk.end] = chunk;
|
|
1767
|
+
this.byStart[chunk.next.start] = chunk.next;
|
|
1768
|
+
this.byEnd[chunk.next.end] = chunk.next;
|
|
1769
|
+
}
|
|
1787
1770
|
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
}
|
|
1771
|
+
if (aborted) return true;
|
|
1772
|
+
chunk = chunk.previous;
|
|
1773
|
+
} while (chunk);
|
|
1792
1774
|
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
} while (chunk);
|
|
1775
|
+
return false;
|
|
1776
|
+
}
|
|
1796
1777
|
|
|
1797
|
-
|
|
1798
|
-
|
|
1778
|
+
trimEnd(charType) {
|
|
1779
|
+
this.trimEndAborted(charType);
|
|
1780
|
+
return this;
|
|
1781
|
+
}
|
|
1782
|
+
trimStartAborted(charType) {
|
|
1783
|
+
const rx = new RegExp('^' + (charType || '\\s') + '+');
|
|
1799
1784
|
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
return this;
|
|
1803
|
-
};
|
|
1785
|
+
this.intro = this.intro.replace(rx, '');
|
|
1786
|
+
if (this.intro.length) return true;
|
|
1804
1787
|
|
|
1805
|
-
|
|
1788
|
+
let chunk = this.firstChunk;
|
|
1806
1789
|
|
|
1807
|
-
|
|
1808
|
-
|
|
1790
|
+
do {
|
|
1791
|
+
const end = chunk.end;
|
|
1792
|
+
const aborted = chunk.trimStart(rx);
|
|
1809
1793
|
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
this.uniqueSources = [];
|
|
1814
|
-
this.uniqueSourceIndexByFilename = {};
|
|
1815
|
-
};
|
|
1794
|
+
if (chunk.end !== end) {
|
|
1795
|
+
// special case...
|
|
1796
|
+
if (chunk === this.lastChunk) this.lastChunk = chunk.next;
|
|
1816
1797
|
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1798
|
+
this.byEnd[chunk.end] = chunk;
|
|
1799
|
+
this.byStart[chunk.next.start] = chunk.next;
|
|
1800
|
+
this.byEnd[chunk.next.end] = chunk.next;
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
if (aborted) return true;
|
|
1804
|
+
chunk = chunk.next;
|
|
1805
|
+
} while (chunk);
|
|
1825
1806
|
|
|
1826
|
-
|
|
1827
|
-
throw new Error('bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`');
|
|
1807
|
+
return false;
|
|
1828
1808
|
}
|
|
1829
1809
|
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1810
|
+
trimStart(charType) {
|
|
1811
|
+
this.trimStartAborted(charType);
|
|
1812
|
+
return this;
|
|
1813
|
+
}
|
|
1833
1814
|
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
source.separator = this.separator;
|
|
1815
|
+
hasChanged() {
|
|
1816
|
+
return this.original !== this.toString();
|
|
1837
1817
|
}
|
|
1838
1818
|
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1819
|
+
replace(searchValue, replacement) {
|
|
1820
|
+
function getReplacement(match, str) {
|
|
1821
|
+
if (typeof replacement === 'string') {
|
|
1822
|
+
return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
|
|
1823
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter
|
|
1824
|
+
if (i === '$') return '$';
|
|
1825
|
+
if (i === '&') return match[0];
|
|
1826
|
+
const num = +i;
|
|
1827
|
+
if (num < match.length) return match[+i];
|
|
1828
|
+
return `$${i}`;
|
|
1829
|
+
});
|
|
1830
|
+
} else {
|
|
1831
|
+
return replacement(...match, match.index, str, match.groups);
|
|
1847
1832
|
}
|
|
1848
1833
|
}
|
|
1834
|
+
function matchAll(re, str) {
|
|
1835
|
+
let match;
|
|
1836
|
+
const matches = [];
|
|
1837
|
+
while ((match = re.exec(str))) {
|
|
1838
|
+
matches.push(match);
|
|
1839
|
+
}
|
|
1840
|
+
return matches;
|
|
1841
|
+
}
|
|
1842
|
+
if (typeof searchValue !== 'string' && searchValue.global) {
|
|
1843
|
+
const matches = matchAll(searchValue, this.original);
|
|
1844
|
+
matches.forEach((match) => {
|
|
1845
|
+
if (match.index != null)
|
|
1846
|
+
this.overwrite(
|
|
1847
|
+
match.index,
|
|
1848
|
+
match.index + match[0].length,
|
|
1849
|
+
getReplacement(match, this.original)
|
|
1850
|
+
);
|
|
1851
|
+
});
|
|
1852
|
+
} else {
|
|
1853
|
+
const match = this.original.match(searchValue);
|
|
1854
|
+
if (match && match.index != null)
|
|
1855
|
+
this.overwrite(
|
|
1856
|
+
match.index,
|
|
1857
|
+
match.index + match[0].length,
|
|
1858
|
+
getReplacement(match, this.original)
|
|
1859
|
+
);
|
|
1860
|
+
}
|
|
1861
|
+
return this;
|
|
1849
1862
|
}
|
|
1863
|
+
}
|
|
1850
1864
|
|
|
1851
|
-
|
|
1852
|
-
return this;
|
|
1853
|
-
};
|
|
1865
|
+
const hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1854
1866
|
|
|
1855
|
-
Bundle$1
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
separator
|
|
1859
|
-
|
|
1867
|
+
class Bundle$1 {
|
|
1868
|
+
constructor(options = {}) {
|
|
1869
|
+
this.intro = options.intro || '';
|
|
1870
|
+
this.separator = options.separator !== undefined ? options.separator : '\n';
|
|
1871
|
+
this.sources = [];
|
|
1872
|
+
this.uniqueSources = [];
|
|
1873
|
+
this.uniqueSourceIndexByFilename = {};
|
|
1874
|
+
}
|
|
1860
1875
|
|
|
1861
|
-
|
|
1862
|
-
|
|
1876
|
+
addSource(source) {
|
|
1877
|
+
if (source instanceof MagicString) {
|
|
1878
|
+
return this.addSource({
|
|
1879
|
+
content: source,
|
|
1880
|
+
filename: source.filename,
|
|
1881
|
+
separator: this.separator,
|
|
1882
|
+
});
|
|
1883
|
+
}
|
|
1863
1884
|
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1885
|
+
if (!isObject$1(source) || !source.content) {
|
|
1886
|
+
throw new Error(
|
|
1887
|
+
'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`'
|
|
1888
|
+
);
|
|
1889
|
+
}
|
|
1869
1890
|
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
filename: source.filename,
|
|
1873
|
-
content: source.content.clone(),
|
|
1874
|
-
separator: source.separator
|
|
1891
|
+
['filename', 'indentExclusionRanges', 'separator'].forEach((option) => {
|
|
1892
|
+
if (!hasOwnProp.call(source, option)) source[option] = source.content[option];
|
|
1875
1893
|
});
|
|
1876
|
-
});
|
|
1877
1894
|
|
|
1878
|
-
|
|
1879
|
-
|
|
1895
|
+
if (source.separator === undefined) {
|
|
1896
|
+
// TODO there's a bunch of this sort of thing, needs cleaning up
|
|
1897
|
+
source.separator = this.separator;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
if (source.filename) {
|
|
1901
|
+
if (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {
|
|
1902
|
+
this.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;
|
|
1903
|
+
this.uniqueSources.push({ filename: source.filename, content: source.content.original });
|
|
1904
|
+
} else {
|
|
1905
|
+
const uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];
|
|
1906
|
+
if (source.content.original !== uniqueSource.content) {
|
|
1907
|
+
throw new Error(`Illegal source: same filename (${source.filename}), different contents`);
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1880
1911
|
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1912
|
+
this.sources.push(source);
|
|
1913
|
+
return this;
|
|
1914
|
+
}
|
|
1884
1915
|
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1916
|
+
append(str, options) {
|
|
1917
|
+
this.addSource({
|
|
1918
|
+
content: new MagicString(str),
|
|
1919
|
+
separator: (options && options.separator) || '',
|
|
1889
1920
|
});
|
|
1890
|
-
});
|
|
1891
1921
|
|
|
1892
|
-
|
|
1922
|
+
return this;
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
clone() {
|
|
1926
|
+
const bundle = new Bundle$1({
|
|
1927
|
+
intro: this.intro,
|
|
1928
|
+
separator: this.separator,
|
|
1929
|
+
});
|
|
1930
|
+
|
|
1931
|
+
this.sources.forEach((source) => {
|
|
1932
|
+
bundle.addSource({
|
|
1933
|
+
filename: source.filename,
|
|
1934
|
+
content: source.content.clone(),
|
|
1935
|
+
separator: source.separator,
|
|
1936
|
+
});
|
|
1937
|
+
});
|
|
1893
1938
|
|
|
1894
|
-
|
|
1895
|
-
mappings.advance(this.intro);
|
|
1939
|
+
return bundle;
|
|
1896
1940
|
}
|
|
1897
1941
|
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1942
|
+
generateDecodedMap(options = {}) {
|
|
1943
|
+
const names = [];
|
|
1944
|
+
this.sources.forEach((source) => {
|
|
1945
|
+
Object.keys(source.content.storedNames).forEach((name) => {
|
|
1946
|
+
if (!~names.indexOf(name)) names.push(name);
|
|
1947
|
+
});
|
|
1948
|
+
});
|
|
1902
1949
|
|
|
1903
|
-
|
|
1904
|
-
var magicString = source.content;
|
|
1905
|
-
var locate = getLocator(magicString.original);
|
|
1950
|
+
const mappings = new Mappings(options.hires);
|
|
1906
1951
|
|
|
1907
|
-
if (
|
|
1908
|
-
mappings.advance(
|
|
1952
|
+
if (this.intro) {
|
|
1953
|
+
mappings.advance(this.intro);
|
|
1909
1954
|
}
|
|
1910
1955
|
|
|
1911
|
-
|
|
1912
|
-
|
|
1956
|
+
this.sources.forEach((source, i) => {
|
|
1957
|
+
if (i > 0) {
|
|
1958
|
+
mappings.advance(this.separator);
|
|
1959
|
+
}
|
|
1913
1960
|
|
|
1914
|
-
|
|
1961
|
+
const sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1;
|
|
1962
|
+
const magicString = source.content;
|
|
1963
|
+
const locate = getLocator(magicString.original);
|
|
1915
1964
|
|
|
1916
|
-
if (
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1965
|
+
if (magicString.intro) {
|
|
1966
|
+
mappings.advance(magicString.intro);
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
magicString.firstChunk.eachNext((chunk) => {
|
|
1970
|
+
const loc = locate(chunk.start);
|
|
1971
|
+
|
|
1972
|
+
if (chunk.intro.length) mappings.advance(chunk.intro);
|
|
1973
|
+
|
|
1974
|
+
if (source.filename) {
|
|
1975
|
+
if (chunk.edited) {
|
|
1976
|
+
mappings.addEdit(
|
|
1977
|
+
sourceIndex,
|
|
1978
|
+
chunk.content,
|
|
1979
|
+
loc,
|
|
1980
|
+
chunk.storeName ? names.indexOf(chunk.original) : -1
|
|
1981
|
+
);
|
|
1982
|
+
} else {
|
|
1983
|
+
mappings.addUneditedChunk(
|
|
1984
|
+
sourceIndex,
|
|
1985
|
+
chunk,
|
|
1986
|
+
magicString.original,
|
|
1987
|
+
loc,
|
|
1988
|
+
magicString.sourcemapLocations
|
|
1989
|
+
);
|
|
1990
|
+
}
|
|
1924
1991
|
} else {
|
|
1925
|
-
mappings.
|
|
1926
|
-
sourceIndex,
|
|
1927
|
-
chunk,
|
|
1928
|
-
magicString.original,
|
|
1929
|
-
loc,
|
|
1930
|
-
magicString.sourcemapLocations
|
|
1931
|
-
);
|
|
1992
|
+
mappings.advance(chunk.content);
|
|
1932
1993
|
}
|
|
1933
|
-
} else {
|
|
1934
|
-
mappings.advance(chunk.content);
|
|
1935
|
-
}
|
|
1936
1994
|
|
|
1937
|
-
|
|
1938
|
-
|
|
1995
|
+
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
1996
|
+
});
|
|
1939
1997
|
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1998
|
+
if (magicString.outro) {
|
|
1999
|
+
mappings.advance(magicString.outro);
|
|
2000
|
+
}
|
|
2001
|
+
});
|
|
1944
2002
|
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
}
|
|
2003
|
+
return {
|
|
2004
|
+
file: options.file ? options.file.split(/[/\\]/).pop() : null,
|
|
2005
|
+
sources: this.uniqueSources.map((source) => {
|
|
2006
|
+
return options.file ? getRelativePath(options.file, source.filename) : source.filename;
|
|
2007
|
+
}),
|
|
2008
|
+
sourcesContent: this.uniqueSources.map((source) => {
|
|
2009
|
+
return options.includeContent ? source.content : null;
|
|
2010
|
+
}),
|
|
2011
|
+
names,
|
|
2012
|
+
mappings: mappings.raw,
|
|
2013
|
+
};
|
|
2014
|
+
}
|
|
1957
2015
|
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
}
|
|
2016
|
+
generateMap(options) {
|
|
2017
|
+
return new SourceMap(this.generateDecodedMap(options));
|
|
2018
|
+
}
|
|
1961
2019
|
|
|
1962
|
-
|
|
1963
|
-
|
|
2020
|
+
getIndentString() {
|
|
2021
|
+
const indentStringCounts = {};
|
|
1964
2022
|
|
|
1965
|
-
|
|
1966
|
-
|
|
2023
|
+
this.sources.forEach((source) => {
|
|
2024
|
+
const indentStr = source.content.indentStr;
|
|
1967
2025
|
|
|
1968
|
-
|
|
2026
|
+
if (indentStr === null) return;
|
|
1969
2027
|
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
2028
|
+
if (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0;
|
|
2029
|
+
indentStringCounts[indentStr] += 1;
|
|
2030
|
+
});
|
|
1973
2031
|
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
}
|
|
2032
|
+
return (
|
|
2033
|
+
Object.keys(indentStringCounts).sort((a, b) => {
|
|
2034
|
+
return indentStringCounts[a] - indentStringCounts[b];
|
|
2035
|
+
})[0] || '\t'
|
|
2036
|
+
);
|
|
2037
|
+
}
|
|
1980
2038
|
|
|
1981
|
-
|
|
1982
|
-
|
|
2039
|
+
indent(indentStr) {
|
|
2040
|
+
if (!arguments.length) {
|
|
2041
|
+
indentStr = this.getIndentString();
|
|
2042
|
+
}
|
|
1983
2043
|
|
|
1984
|
-
|
|
1985
|
-
indentStr = this.getIndentString();
|
|
1986
|
-
}
|
|
2044
|
+
if (indentStr === '') return this; // noop
|
|
1987
2045
|
|
|
1988
|
-
|
|
2046
|
+
let trailingNewline = !this.intro || this.intro.slice(-1) === '\n';
|
|
1989
2047
|
|
|
1990
|
-
|
|
2048
|
+
this.sources.forEach((source, i) => {
|
|
2049
|
+
const separator = source.separator !== undefined ? source.separator : this.separator;
|
|
2050
|
+
const indentStart = trailingNewline || (i > 0 && /\r?\n$/.test(separator));
|
|
1991
2051
|
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2052
|
+
source.content.indent(indentStr, {
|
|
2053
|
+
exclude: source.indentExclusionRanges,
|
|
2054
|
+
indentStart, //: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator )
|
|
2055
|
+
});
|
|
1995
2056
|
|
|
1996
|
-
|
|
1997
|
-
exclude: source.indentExclusionRanges,
|
|
1998
|
-
indentStart: indentStart //: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator )
|
|
2057
|
+
trailingNewline = source.content.lastChar() === '\n';
|
|
1999
2058
|
});
|
|
2000
2059
|
|
|
2001
|
-
|
|
2002
|
-
|
|
2060
|
+
if (this.intro) {
|
|
2061
|
+
this.intro =
|
|
2062
|
+
indentStr +
|
|
2063
|
+
this.intro.replace(/^[^\n]/gm, (match, index) => {
|
|
2064
|
+
return index > 0 ? indentStr + match : match;
|
|
2065
|
+
});
|
|
2066
|
+
}
|
|
2003
2067
|
|
|
2004
|
-
|
|
2005
|
-
this.intro =
|
|
2006
|
-
indentStr +
|
|
2007
|
-
this.intro.replace(/^[^\n]/gm, function (match, index) {
|
|
2008
|
-
return index > 0 ? indentStr + match : match;
|
|
2009
|
-
});
|
|
2068
|
+
return this;
|
|
2010
2069
|
}
|
|
2011
2070
|
|
|
2012
|
-
|
|
2013
|
-
|
|
2071
|
+
prepend(str) {
|
|
2072
|
+
this.intro = str + this.intro;
|
|
2073
|
+
return this;
|
|
2074
|
+
}
|
|
2014
2075
|
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2076
|
+
toString() {
|
|
2077
|
+
const body = this.sources
|
|
2078
|
+
.map((source, i) => {
|
|
2079
|
+
const separator = source.separator !== undefined ? source.separator : this.separator;
|
|
2080
|
+
const str = (i > 0 ? separator : '') + source.content.toString();
|
|
2019
2081
|
|
|
2020
|
-
|
|
2021
|
-
|
|
2082
|
+
return str;
|
|
2083
|
+
})
|
|
2084
|
+
.join('');
|
|
2022
2085
|
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
var separator = source.separator !== undefined ? source.separator : this$1$1.separator;
|
|
2026
|
-
var str = (i > 0 ? separator : '') + source.content.toString();
|
|
2086
|
+
return this.intro + body;
|
|
2087
|
+
}
|
|
2027
2088
|
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
.
|
|
2089
|
+
isEmpty() {
|
|
2090
|
+
if (this.intro.length && this.intro.trim()) return false;
|
|
2091
|
+
if (this.sources.some((source) => !source.content.isEmpty())) return false;
|
|
2092
|
+
return true;
|
|
2093
|
+
}
|
|
2031
2094
|
|
|
2032
|
-
|
|
2033
|
-
|
|
2095
|
+
length() {
|
|
2096
|
+
return this.sources.reduce(
|
|
2097
|
+
(length, source) => length + source.content.length(),
|
|
2098
|
+
this.intro.length
|
|
2099
|
+
);
|
|
2100
|
+
}
|
|
2034
2101
|
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
if (this.sources.some(function (source) { return !source.content.isEmpty(); }))
|
|
2039
|
-
{ return false; }
|
|
2040
|
-
return true;
|
|
2041
|
-
};
|
|
2102
|
+
trimLines() {
|
|
2103
|
+
return this.trim('[\\r\\n]');
|
|
2104
|
+
}
|
|
2042
2105
|
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
}
|
|
2106
|
+
trim(charType) {
|
|
2107
|
+
return this.trimStart(charType).trimEnd(charType);
|
|
2108
|
+
}
|
|
2046
2109
|
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2110
|
+
trimStart(charType) {
|
|
2111
|
+
const rx = new RegExp('^' + (charType || '\\s') + '+');
|
|
2112
|
+
this.intro = this.intro.replace(rx, '');
|
|
2050
2113
|
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2114
|
+
if (!this.intro) {
|
|
2115
|
+
let source;
|
|
2116
|
+
let i = 0;
|
|
2117
|
+
|
|
2118
|
+
do {
|
|
2119
|
+
source = this.sources[i++];
|
|
2120
|
+
if (!source) {
|
|
2121
|
+
break;
|
|
2122
|
+
}
|
|
2123
|
+
} while (!source.content.trimStartAborted(charType));
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
return this;
|
|
2127
|
+
}
|
|
2054
2128
|
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
this.intro = this.intro.replace(rx, '');
|
|
2129
|
+
trimEnd(charType) {
|
|
2130
|
+
const rx = new RegExp((charType || '\\s') + '+$');
|
|
2058
2131
|
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
var i = 0;
|
|
2132
|
+
let source;
|
|
2133
|
+
let i = this.sources.length - 1;
|
|
2062
2134
|
|
|
2063
2135
|
do {
|
|
2064
|
-
source = this.sources[i
|
|
2136
|
+
source = this.sources[i--];
|
|
2065
2137
|
if (!source) {
|
|
2138
|
+
this.intro = this.intro.replace(rx, '');
|
|
2066
2139
|
break;
|
|
2067
2140
|
}
|
|
2068
|
-
} while (!source.content.
|
|
2069
|
-
}
|
|
2070
|
-
|
|
2071
|
-
return this;
|
|
2072
|
-
};
|
|
2141
|
+
} while (!source.content.trimEndAborted(charType));
|
|
2073
2142
|
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
var source;
|
|
2078
|
-
var i = this.sources.length - 1;
|
|
2079
|
-
|
|
2080
|
-
do {
|
|
2081
|
-
source = this.sources[i--];
|
|
2082
|
-
if (!source) {
|
|
2083
|
-
this.intro = this.intro.replace(rx, '');
|
|
2084
|
-
break;
|
|
2085
|
-
}
|
|
2086
|
-
} while (!source.content.trimEndAborted(charType));
|
|
2087
|
-
|
|
2088
|
-
return this;
|
|
2089
|
-
};
|
|
2090
|
-
|
|
2091
|
-
const MagicString$1 = MagicString;
|
|
2143
|
+
return this;
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2092
2146
|
|
|
2093
2147
|
function getOrCreate(map, key, init) {
|
|
2094
2148
|
const existing = map.get(key);
|
|
@@ -2443,6 +2497,8 @@ class ExternalModule {
|
|
|
2443
2497
|
}
|
|
2444
2498
|
}
|
|
2445
2499
|
|
|
2500
|
+
var picomatch$1 = {exports: {}};
|
|
2501
|
+
|
|
2446
2502
|
var utils$3 = {};
|
|
2447
2503
|
|
|
2448
2504
|
const path$1 = require$$0;
|
|
@@ -2625,69 +2681,69 @@ var constants$2 = {
|
|
|
2625
2681
|
|
|
2626
2682
|
(function (exports) {
|
|
2627
2683
|
|
|
2628
|
-
const path = require$$0;
|
|
2629
|
-
const win32 = process.platform === 'win32';
|
|
2630
|
-
const {
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
} = constants$2;
|
|
2636
|
-
|
|
2637
|
-
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
2638
|
-
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
|
2639
|
-
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
|
2640
|
-
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
2641
|
-
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
|
2642
|
-
|
|
2643
|
-
exports.removeBackslashes = str => {
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
};
|
|
2684
|
+
const path = require$$0;
|
|
2685
|
+
const win32 = process.platform === 'win32';
|
|
2686
|
+
const {
|
|
2687
|
+
REGEX_BACKSLASH,
|
|
2688
|
+
REGEX_REMOVE_BACKSLASH,
|
|
2689
|
+
REGEX_SPECIAL_CHARS,
|
|
2690
|
+
REGEX_SPECIAL_CHARS_GLOBAL
|
|
2691
|
+
} = constants$2;
|
|
2692
|
+
|
|
2693
|
+
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
2694
|
+
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
|
2695
|
+
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
|
2696
|
+
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
2697
|
+
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
|
2698
|
+
|
|
2699
|
+
exports.removeBackslashes = str => {
|
|
2700
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
|
|
2701
|
+
return match === '\\' ? '' : match;
|
|
2702
|
+
});
|
|
2703
|
+
};
|
|
2648
2704
|
|
|
2649
|
-
exports.supportsLookbehinds = () => {
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
};
|
|
2705
|
+
exports.supportsLookbehinds = () => {
|
|
2706
|
+
const segs = process.version.slice(1).split('.').map(Number);
|
|
2707
|
+
if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
|
|
2708
|
+
return true;
|
|
2709
|
+
}
|
|
2710
|
+
return false;
|
|
2711
|
+
};
|
|
2656
2712
|
|
|
2657
|
-
exports.isWindows = options => {
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
};
|
|
2713
|
+
exports.isWindows = options => {
|
|
2714
|
+
if (options && typeof options.windows === 'boolean') {
|
|
2715
|
+
return options.windows;
|
|
2716
|
+
}
|
|
2717
|
+
return win32 === true || path.sep === '\\';
|
|
2718
|
+
};
|
|
2663
2719
|
|
|
2664
|
-
exports.escapeLast = (input, char, lastIdx) => {
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
};
|
|
2720
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
2721
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
2722
|
+
if (idx === -1) return input;
|
|
2723
|
+
if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
|
|
2724
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
2725
|
+
};
|
|
2670
2726
|
|
|
2671
|
-
exports.removePrefix = (input, state = {}) => {
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
};
|
|
2727
|
+
exports.removePrefix = (input, state = {}) => {
|
|
2728
|
+
let output = input;
|
|
2729
|
+
if (output.startsWith('./')) {
|
|
2730
|
+
output = output.slice(2);
|
|
2731
|
+
state.prefix = './';
|
|
2732
|
+
}
|
|
2733
|
+
return output;
|
|
2734
|
+
};
|
|
2679
2735
|
|
|
2680
|
-
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
2681
|
-
|
|
2682
|
-
|
|
2736
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
2737
|
+
const prepend = options.contains ? '' : '^';
|
|
2738
|
+
const append = options.contains ? '' : '$';
|
|
2683
2739
|
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
};
|
|
2690
|
-
}(utils$3));
|
|
2740
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
2741
|
+
if (state.negated === true) {
|
|
2742
|
+
output = `(?:^(?!${output}).*$)`;
|
|
2743
|
+
}
|
|
2744
|
+
return output;
|
|
2745
|
+
};
|
|
2746
|
+
} (utils$3));
|
|
2691
2747
|
|
|
2692
2748
|
const utils$2 = utils$3;
|
|
2693
2749
|
const {
|
|
@@ -4191,9 +4247,9 @@ const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
|
4191
4247
|
* @api public
|
|
4192
4248
|
*/
|
|
4193
4249
|
|
|
4194
|
-
const picomatch
|
|
4250
|
+
const picomatch = (glob, options, returnState = false) => {
|
|
4195
4251
|
if (Array.isArray(glob)) {
|
|
4196
|
-
const fns = glob.map(input => picomatch
|
|
4252
|
+
const fns = glob.map(input => picomatch(input, options, returnState));
|
|
4197
4253
|
const arrayMatcher = str => {
|
|
4198
4254
|
for (const isMatch of fns) {
|
|
4199
4255
|
const state = isMatch(str);
|
|
@@ -4213,8 +4269,8 @@ const picomatch$1 = (glob, options, returnState = false) => {
|
|
|
4213
4269
|
const opts = options || {};
|
|
4214
4270
|
const posix = utils.isWindows(options);
|
|
4215
4271
|
const regex = isState
|
|
4216
|
-
? picomatch
|
|
4217
|
-
: picomatch
|
|
4272
|
+
? picomatch.compileRe(glob, options)
|
|
4273
|
+
: picomatch.makeRe(glob, options, false, true);
|
|
4218
4274
|
|
|
4219
4275
|
const state = regex.state;
|
|
4220
4276
|
delete regex.state;
|
|
@@ -4222,11 +4278,11 @@ const picomatch$1 = (glob, options, returnState = false) => {
|
|
|
4222
4278
|
let isIgnored = () => false;
|
|
4223
4279
|
if (opts.ignore) {
|
|
4224
4280
|
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
4225
|
-
isIgnored = picomatch
|
|
4281
|
+
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
4226
4282
|
}
|
|
4227
4283
|
|
|
4228
4284
|
const matcher = (input, returnObject = false) => {
|
|
4229
|
-
const { isMatch, match, output } = picomatch
|
|
4285
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
|
|
4230
4286
|
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
4231
4287
|
|
|
4232
4288
|
if (typeof opts.onResult === 'function') {
|
|
@@ -4276,7 +4332,7 @@ const picomatch$1 = (glob, options, returnState = false) => {
|
|
|
4276
4332
|
* @api public
|
|
4277
4333
|
*/
|
|
4278
4334
|
|
|
4279
|
-
picomatch
|
|
4335
|
+
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
4280
4336
|
if (typeof input !== 'string') {
|
|
4281
4337
|
throw new TypeError('Expected input to be a string');
|
|
4282
4338
|
}
|
|
@@ -4297,7 +4353,7 @@ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
|
|
|
4297
4353
|
|
|
4298
4354
|
if (match === false || opts.capture === true) {
|
|
4299
4355
|
if (opts.matchBase === true || opts.basename === true) {
|
|
4300
|
-
match = picomatch
|
|
4356
|
+
match = picomatch.matchBase(input, regex, options, posix);
|
|
4301
4357
|
} else {
|
|
4302
4358
|
match = regex.exec(output);
|
|
4303
4359
|
}
|
|
@@ -4320,8 +4376,8 @@ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
|
|
|
4320
4376
|
* @api public
|
|
4321
4377
|
*/
|
|
4322
4378
|
|
|
4323
|
-
picomatch
|
|
4324
|
-
const regex = glob instanceof RegExp ? glob : picomatch
|
|
4379
|
+
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
4380
|
+
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
4325
4381
|
return regex.test(path.basename(input));
|
|
4326
4382
|
};
|
|
4327
4383
|
|
|
@@ -4342,7 +4398,7 @@ picomatch$1.matchBase = (input, glob, options, posix = utils.isWindows(options))
|
|
|
4342
4398
|
* @api public
|
|
4343
4399
|
*/
|
|
4344
4400
|
|
|
4345
|
-
picomatch
|
|
4401
|
+
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
4346
4402
|
|
|
4347
4403
|
/**
|
|
4348
4404
|
* Parse a glob pattern to create the source string for a regular
|
|
@@ -4358,8 +4414,8 @@ picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)
|
|
|
4358
4414
|
* @api public
|
|
4359
4415
|
*/
|
|
4360
4416
|
|
|
4361
|
-
picomatch
|
|
4362
|
-
if (Array.isArray(pattern)) return pattern.map(p => picomatch
|
|
4417
|
+
picomatch.parse = (pattern, options) => {
|
|
4418
|
+
if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
|
|
4363
4419
|
return parse(pattern, { ...options, fastpaths: false });
|
|
4364
4420
|
};
|
|
4365
4421
|
|
|
@@ -4390,7 +4446,7 @@ picomatch$1.parse = (pattern, options) => {
|
|
|
4390
4446
|
* @api public
|
|
4391
4447
|
*/
|
|
4392
4448
|
|
|
4393
|
-
picomatch
|
|
4449
|
+
picomatch.scan = (input, options) => scan(input, options);
|
|
4394
4450
|
|
|
4395
4451
|
/**
|
|
4396
4452
|
* Compile a regular expression from the `state` object returned by the
|
|
@@ -4404,7 +4460,7 @@ picomatch$1.scan = (input, options) => scan(input, options);
|
|
|
4404
4460
|
* @api public
|
|
4405
4461
|
*/
|
|
4406
4462
|
|
|
4407
|
-
picomatch
|
|
4463
|
+
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
4408
4464
|
if (returnOutput === true) {
|
|
4409
4465
|
return state.output;
|
|
4410
4466
|
}
|
|
@@ -4418,7 +4474,7 @@ picomatch$1.compileRe = (state, options, returnOutput = false, returnState = fal
|
|
|
4418
4474
|
source = `^(?!${source}).*$`;
|
|
4419
4475
|
}
|
|
4420
4476
|
|
|
4421
|
-
const regex = picomatch
|
|
4477
|
+
const regex = picomatch.toRegex(source, options);
|
|
4422
4478
|
if (returnState === true) {
|
|
4423
4479
|
regex.state = state;
|
|
4424
4480
|
}
|
|
@@ -4445,7 +4501,7 @@ picomatch$1.compileRe = (state, options, returnOutput = false, returnState = fal
|
|
|
4445
4501
|
* @api public
|
|
4446
4502
|
*/
|
|
4447
4503
|
|
|
4448
|
-
picomatch
|
|
4504
|
+
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
4449
4505
|
if (!input || typeof input !== 'string') {
|
|
4450
4506
|
throw new TypeError('Expected a non-empty string');
|
|
4451
4507
|
}
|
|
@@ -4460,7 +4516,7 @@ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = f
|
|
|
4460
4516
|
parsed = parse(input, options);
|
|
4461
4517
|
}
|
|
4462
4518
|
|
|
4463
|
-
return picomatch
|
|
4519
|
+
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
4464
4520
|
};
|
|
4465
4521
|
|
|
4466
4522
|
/**
|
|
@@ -4480,7 +4536,7 @@ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = f
|
|
|
4480
4536
|
* @api public
|
|
4481
4537
|
*/
|
|
4482
4538
|
|
|
4483
|
-
picomatch
|
|
4539
|
+
picomatch.toRegex = (source, options) => {
|
|
4484
4540
|
try {
|
|
4485
4541
|
const opts = options || {};
|
|
4486
4542
|
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
@@ -4495,17 +4551,20 @@ picomatch$1.toRegex = (source, options) => {
|
|
|
4495
4551
|
* @return {Object}
|
|
4496
4552
|
*/
|
|
4497
4553
|
|
|
4498
|
-
picomatch
|
|
4554
|
+
picomatch.constants = constants;
|
|
4499
4555
|
|
|
4500
4556
|
/**
|
|
4501
4557
|
* Expose "picomatch"
|
|
4502
4558
|
*/
|
|
4503
4559
|
|
|
4504
|
-
var picomatch_1 = picomatch
|
|
4560
|
+
var picomatch_1 = picomatch;
|
|
4505
4561
|
|
|
4506
|
-
|
|
4562
|
+
(function (module) {
|
|
4507
4563
|
|
|
4508
|
-
|
|
4564
|
+
module.exports = picomatch_1;
|
|
4565
|
+
} (picomatch$1));
|
|
4566
|
+
|
|
4567
|
+
const pm = /*@__PURE__*/getDefaultExportFromCjs(picomatch$1.exports);
|
|
4509
4568
|
|
|
4510
4569
|
const extractors = {
|
|
4511
4570
|
ArrayPattern(names, param) {
|
|
@@ -4560,7 +4619,7 @@ const normalizePath = function normalizePath(filename) {
|
|
|
4560
4619
|
|
|
4561
4620
|
function getMatcherString(id, resolutionBase) {
|
|
4562
4621
|
if (resolutionBase === false || require$$0.isAbsolute(id) || id.startsWith('*')) {
|
|
4563
|
-
return id;
|
|
4622
|
+
return normalizePath(id);
|
|
4564
4623
|
}
|
|
4565
4624
|
// resolve('') is valid and will default to process.cwd()
|
|
4566
4625
|
const basePath = normalizePath(require$$0.resolve(resolutionBase || ''))
|
|
@@ -4570,7 +4629,7 @@ function getMatcherString(id, resolutionBase) {
|
|
|
4570
4629
|
// 1. the basePath has been normalized to use /
|
|
4571
4630
|
// 2. the incoming glob (id) matcher, also uses /
|
|
4572
4631
|
// otherwise Node will force backslash (\) on windows
|
|
4573
|
-
return require$$0.posix.join(basePath, id);
|
|
4632
|
+
return require$$0.posix.join(basePath, normalizePath(id));
|
|
4574
4633
|
}
|
|
4575
4634
|
const createFilter = function createFilter(include, exclude, options) {
|
|
4576
4635
|
const resolutionBase = options && options.resolve;
|
|
@@ -6998,6 +7057,7 @@ const knownGlobals = {
|
|
|
6998
7057
|
getOwnPropertyNames: PF,
|
|
6999
7058
|
getOwnPropertySymbols: PF,
|
|
7000
7059
|
getPrototypeOf: PF,
|
|
7060
|
+
hasOwn: PF,
|
|
7001
7061
|
is: PF,
|
|
7002
7062
|
isExtensible: PF,
|
|
7003
7063
|
isFrozen: PF,
|
|
@@ -12642,7 +12702,10 @@ class Module {
|
|
|
12642
12702
|
return [this.exportShimVariable];
|
|
12643
12703
|
}
|
|
12644
12704
|
const name = exportDeclaration.localName;
|
|
12645
|
-
const variable = this.traceVariable(name,
|
|
12705
|
+
const variable = this.traceVariable(name, {
|
|
12706
|
+
importerForSideEffects,
|
|
12707
|
+
searchedNamesAndModules
|
|
12708
|
+
});
|
|
12646
12709
|
if (importerForSideEffects) {
|
|
12647
12710
|
getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, () => new Set()).add(this);
|
|
12648
12711
|
setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
|
|
@@ -12760,7 +12823,7 @@ class Module {
|
|
|
12760
12823
|
// By default, `id` is the file name. Custom resolvers and loaders
|
|
12761
12824
|
// can change that, but it makes sense to use it for the source file name
|
|
12762
12825
|
const fileName = this.id;
|
|
12763
|
-
this.magicString = new MagicString
|
|
12826
|
+
this.magicString = new MagicString(code, {
|
|
12764
12827
|
filename: (this.excludeFromSourcemap ? null : fileName),
|
|
12765
12828
|
indentExclusionRanges: []
|
|
12766
12829
|
});
|
|
@@ -12817,7 +12880,7 @@ class Module {
|
|
|
12817
12880
|
transformFiles: this.transformFiles
|
|
12818
12881
|
};
|
|
12819
12882
|
}
|
|
12820
|
-
traceVariable(name, importerForSideEffects) {
|
|
12883
|
+
traceVariable(name, { importerForSideEffects, isExportAllSearch, searchedNamesAndModules } = EMPTY_OBJECT) {
|
|
12821
12884
|
const localVariable = this.scope.variables.get(name);
|
|
12822
12885
|
if (localVariable) {
|
|
12823
12886
|
return localVariable;
|
|
@@ -12828,9 +12891,7 @@ class Module {
|
|
|
12828
12891
|
if (otherModule instanceof Module && importDeclaration.name === '*') {
|
|
12829
12892
|
return otherModule.namespace;
|
|
12830
12893
|
}
|
|
12831
|
-
const [declaration] = otherModule
|
|
12832
|
-
importerForSideEffects: importerForSideEffects || this
|
|
12833
|
-
});
|
|
12894
|
+
const [declaration] = getVariableForExportNameRecursive(otherModule, importDeclaration.name, importerForSideEffects || this, isExportAllSearch, searchedNamesAndModules);
|
|
12834
12895
|
if (!declaration) {
|
|
12835
12896
|
return this.error(errMissingExport(importDeclaration.name, this.id, otherModule.id), importDeclaration.start);
|
|
12836
12897
|
}
|
|
@@ -13035,7 +13096,10 @@ class Module {
|
|
|
13035
13096
|
if (module.info.syntheticNamedExports === name) {
|
|
13036
13097
|
continue;
|
|
13037
13098
|
}
|
|
13038
|
-
const [variable, indirectExternal] = getVariableForExportNameRecursive(module, name, importerForSideEffects, true,
|
|
13099
|
+
const [variable, indirectExternal] = getVariableForExportNameRecursive(module, name, importerForSideEffects, true,
|
|
13100
|
+
// We are creating a copy to handle the case where the same binding is
|
|
13101
|
+
// imported through different namespace reexports gracefully
|
|
13102
|
+
copyNameToModulesMap(searchedNamesAndModules));
|
|
13039
13103
|
if (module instanceof ExternalModule || indirectExternal) {
|
|
13040
13104
|
foundExternalDeclarations.add(variable);
|
|
13041
13105
|
}
|
|
@@ -13151,6 +13215,8 @@ function setAlternativeExporterIfCyclic(variable, importer, reexporter) {
|
|
|
13151
13215
|
}
|
|
13152
13216
|
}
|
|
13153
13217
|
}
|
|
13218
|
+
const copyNameToModulesMap = (searchedNamesAndModules) => searchedNamesAndModules &&
|
|
13219
|
+
new Map(Array.from(searchedNamesAndModules, ([name, modules]) => [name, new Set(modules)]));
|
|
13154
13220
|
|
|
13155
13221
|
function removeJsExtension(name) {
|
|
13156
13222
|
return name.endsWith('.js') ? name.slice(0, -3) : name;
|
|
@@ -14796,7 +14862,7 @@ class Chunk {
|
|
|
14796
14862
|
if (namespace.renderFirst())
|
|
14797
14863
|
hoistedSource += n + rendered;
|
|
14798
14864
|
else
|
|
14799
|
-
magicString.addSource(new MagicString
|
|
14865
|
+
magicString.addSource(new MagicString(rendered));
|
|
14800
14866
|
}
|
|
14801
14867
|
}
|
|
14802
14868
|
const { renderedExports, removedExports } = module.getRenderedExports();
|
|
@@ -16180,6 +16246,20 @@ function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
|
|
|
16180
16246
|
manualChunkAliasByEntry.set(module, alias);
|
|
16181
16247
|
}
|
|
16182
16248
|
|
|
16249
|
+
// This file was generated. Do not modify manually!
|
|
16250
|
+
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
16251
|
+
|
|
16252
|
+
// This file was generated. Do not modify manually!
|
|
16253
|
+
var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
|
|
16254
|
+
|
|
16255
|
+
// This file was generated. Do not modify manually!
|
|
16256
|
+
var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
|
|
16257
|
+
|
|
16258
|
+
// This file was generated. Do not modify manually!
|
|
16259
|
+
var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
|
16260
|
+
|
|
16261
|
+
// These are a run-length and offset encoded representation of the
|
|
16262
|
+
|
|
16183
16263
|
// Reserved word lists for various dialects of the language
|
|
16184
16264
|
|
|
16185
16265
|
var reservedWords = {
|
|
@@ -16204,31 +16284,9 @@ var keywordRelationalOperator = /^in(stanceof)?$/;
|
|
|
16204
16284
|
|
|
16205
16285
|
// ## Character categories
|
|
16206
16286
|
|
|
16207
|
-
// Big ugly regular expressions that match characters in the
|
|
16208
|
-
// whitespace, identifier, and identifier-start categories. These
|
|
16209
|
-
// are only applied when a character is found to actually have a
|
|
16210
|
-
// code point above 128.
|
|
16211
|
-
// Generated by `bin/generate-identifier-regex.js`.
|
|
16212
|
-
var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
|
16213
|
-
var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
|
|
16214
|
-
|
|
16215
16287
|
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
16216
16288
|
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
16217
16289
|
|
|
16218
|
-
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
16219
|
-
|
|
16220
|
-
// These are a run-length and offset encoded representation of the
|
|
16221
|
-
// >0xffff code points that are a valid part of identifiers. The
|
|
16222
|
-
// offset starts at 0x10000, and each pair of numbers represents an
|
|
16223
|
-
// offset to the next range, and then a size of the range. They were
|
|
16224
|
-
// generated by bin/generate-identifier-regex.js
|
|
16225
|
-
|
|
16226
|
-
// eslint-disable-next-line comma-spacing
|
|
16227
|
-
var astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2637,96,16,1070,4050,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,46,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,482,44,11,6,17,0,322,29,19,43,1269,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4152,8,221,3,5761,15,7472,3104,541,1507,4938];
|
|
16228
|
-
|
|
16229
|
-
// eslint-disable-next-line comma-spacing
|
|
16230
|
-
var astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,357,0,62,13,1495,6,110,6,6,9,4759,9,787719,239];
|
|
16231
|
-
|
|
16232
16290
|
// This has a complexity linear to the value of the code. The
|
|
16233
16291
|
// assumption is that looking up astral identifier characters is
|
|
16234
16292
|
// rare.
|
|
@@ -16463,6 +16521,13 @@ function wordsRegexp(words) {
|
|
|
16463
16521
|
return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")
|
|
16464
16522
|
}
|
|
16465
16523
|
|
|
16524
|
+
function codePointToString(code) {
|
|
16525
|
+
// UTF-16 Decoding
|
|
16526
|
+
if (code <= 0xFFFF) { return String.fromCharCode(code) }
|
|
16527
|
+
code -= 0x10000;
|
|
16528
|
+
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
|
|
16529
|
+
}
|
|
16530
|
+
|
|
16466
16531
|
var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
|
|
16467
16532
|
|
|
16468
16533
|
// These are used when `options.locations` is on, for the
|
|
@@ -16830,6 +16895,7 @@ var pp$9 = Parser.prototype;
|
|
|
16830
16895
|
|
|
16831
16896
|
var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
|
|
16832
16897
|
pp$9.strictDirective = function(start) {
|
|
16898
|
+
if (this.options.ecmaVersion < 5) { return false }
|
|
16833
16899
|
for (;;) {
|
|
16834
16900
|
// Try to find string literal.
|
|
16835
16901
|
skipWhiteSpace.lastIndex = start;
|
|
@@ -16932,14 +16998,14 @@ pp$9.unexpected = function(pos) {
|
|
|
16932
16998
|
this.raise(pos != null ? pos : this.start, "Unexpected token");
|
|
16933
16999
|
};
|
|
16934
17000
|
|
|
16935
|
-
function DestructuringErrors() {
|
|
17001
|
+
var DestructuringErrors = function DestructuringErrors() {
|
|
16936
17002
|
this.shorthandAssign =
|
|
16937
17003
|
this.trailingComma =
|
|
16938
17004
|
this.parenthesizedAssign =
|
|
16939
17005
|
this.parenthesizedBind =
|
|
16940
17006
|
this.doubleProto =
|
|
16941
17007
|
-1;
|
|
16942
|
-
}
|
|
17008
|
+
};
|
|
16943
17009
|
|
|
16944
17010
|
pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
16945
17011
|
if (!refDestructuringErrors) { return }
|
|
@@ -17820,7 +17886,7 @@ pp$8.parseExport = function(node, exports) {
|
|
|
17820
17886
|
if (this.options.ecmaVersion >= 11) {
|
|
17821
17887
|
if (this.eatContextual("as")) {
|
|
17822
17888
|
node.exported = this.parseModuleExportName();
|
|
17823
|
-
this.checkExport(exports, node.exported
|
|
17889
|
+
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
17824
17890
|
} else {
|
|
17825
17891
|
node.exported = null;
|
|
17826
17892
|
}
|
|
@@ -17854,7 +17920,7 @@ pp$8.parseExport = function(node, exports) {
|
|
|
17854
17920
|
if (node.declaration.type === "VariableDeclaration")
|
|
17855
17921
|
{ this.checkVariableExport(exports, node.declaration.declarations); }
|
|
17856
17922
|
else
|
|
17857
|
-
{ this.checkExport(exports, node.declaration.id
|
|
17923
|
+
{ this.checkExport(exports, node.declaration.id, node.declaration.id.start); }
|
|
17858
17924
|
node.specifiers = [];
|
|
17859
17925
|
node.source = null;
|
|
17860
17926
|
} else { // export { x, y as z } [from '...']
|
|
@@ -17886,6 +17952,8 @@ pp$8.parseExport = function(node, exports) {
|
|
|
17886
17952
|
|
|
17887
17953
|
pp$8.checkExport = function(exports, name, pos) {
|
|
17888
17954
|
if (!exports) { return }
|
|
17955
|
+
if (typeof name !== "string")
|
|
17956
|
+
{ name = name.type === "Identifier" ? name.name : name.value; }
|
|
17889
17957
|
if (hasOwn(exports, name))
|
|
17890
17958
|
{ this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
|
|
17891
17959
|
exports[name] = true;
|
|
@@ -17894,7 +17962,7 @@ pp$8.checkExport = function(exports, name, pos) {
|
|
|
17894
17962
|
pp$8.checkPatternExport = function(exports, pat) {
|
|
17895
17963
|
var type = pat.type;
|
|
17896
17964
|
if (type === "Identifier")
|
|
17897
|
-
{ this.checkExport(exports, pat
|
|
17965
|
+
{ this.checkExport(exports, pat, pat.start); }
|
|
17898
17966
|
else if (type === "ObjectPattern")
|
|
17899
17967
|
{ for (var i = 0, list = pat.properties; i < list.length; i += 1)
|
|
17900
17968
|
{
|
|
@@ -17954,7 +18022,7 @@ pp$8.parseExportSpecifiers = function(exports) {
|
|
|
17954
18022
|
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
17955
18023
|
this.checkExport(
|
|
17956
18024
|
exports,
|
|
17957
|
-
node.exported
|
|
18025
|
+
node.exported,
|
|
17958
18026
|
node.exported.start
|
|
17959
18027
|
);
|
|
17960
18028
|
nodes.push(this.finishNode(node, "ExportSpecifier"));
|
|
@@ -19944,12 +20012,6 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
|
|
|
19944
20012
|
return false
|
|
19945
20013
|
};
|
|
19946
20014
|
|
|
19947
|
-
function codePointToString$1(ch) {
|
|
19948
|
-
if (ch <= 0xFFFF) { return String.fromCharCode(ch) }
|
|
19949
|
-
ch -= 0x10000;
|
|
19950
|
-
return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)
|
|
19951
|
-
}
|
|
19952
|
-
|
|
19953
20015
|
/**
|
|
19954
20016
|
* Validate the flags part of a given RegExpLiteral.
|
|
19955
20017
|
*
|
|
@@ -20314,9 +20376,9 @@ pp$1.regexp_eatGroupName = function(state) {
|
|
|
20314
20376
|
pp$1.regexp_eatRegExpIdentifierName = function(state) {
|
|
20315
20377
|
state.lastStringValue = "";
|
|
20316
20378
|
if (this.regexp_eatRegExpIdentifierStart(state)) {
|
|
20317
|
-
state.lastStringValue += codePointToString
|
|
20379
|
+
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20318
20380
|
while (this.regexp_eatRegExpIdentifierPart(state)) {
|
|
20319
|
-
state.lastStringValue += codePointToString
|
|
20381
|
+
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
20320
20382
|
}
|
|
20321
20383
|
return true
|
|
20322
20384
|
}
|
|
@@ -20668,7 +20730,7 @@ pp$1.regexp_eatUnicodePropertyName = function(state) {
|
|
|
20668
20730
|
var ch = 0;
|
|
20669
20731
|
state.lastStringValue = "";
|
|
20670
20732
|
while (isUnicodePropertyNameCharacter(ch = state.current())) {
|
|
20671
|
-
state.lastStringValue += codePointToString
|
|
20733
|
+
state.lastStringValue += codePointToString(ch);
|
|
20672
20734
|
state.advance();
|
|
20673
20735
|
}
|
|
20674
20736
|
return state.lastStringValue !== ""
|
|
@@ -20683,7 +20745,7 @@ pp$1.regexp_eatUnicodePropertyValue = function(state) {
|
|
|
20683
20745
|
var ch = 0;
|
|
20684
20746
|
state.lastStringValue = "";
|
|
20685
20747
|
while (isUnicodePropertyValueCharacter(ch = state.current())) {
|
|
20686
|
-
state.lastStringValue += codePointToString
|
|
20748
|
+
state.lastStringValue += codePointToString(ch);
|
|
20687
20749
|
state.advance();
|
|
20688
20750
|
}
|
|
20689
20751
|
return state.lastStringValue !== ""
|
|
@@ -21466,13 +21528,6 @@ pp.readCodePoint = function() {
|
|
|
21466
21528
|
return code
|
|
21467
21529
|
};
|
|
21468
21530
|
|
|
21469
|
-
function codePointToString(code) {
|
|
21470
|
-
// UTF-16 Decoding
|
|
21471
|
-
if (code <= 0xFFFF) { return String.fromCharCode(code) }
|
|
21472
|
-
code -= 0x10000;
|
|
21473
|
-
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)
|
|
21474
|
-
}
|
|
21475
|
-
|
|
21476
21531
|
pp.readString = function(quote) {
|
|
21477
21532
|
var out = "", chunkStart = ++this.pos;
|
|
21478
21533
|
for (;;) {
|
|
@@ -21717,7 +21772,7 @@ pp.readWord = function() {
|
|
|
21717
21772
|
|
|
21718
21773
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
21719
21774
|
|
|
21720
|
-
var version = "8.7.
|
|
21775
|
+
var version = "8.7.1";
|
|
21721
21776
|
|
|
21722
21777
|
Parser.acorn = {
|
|
21723
21778
|
Parser: Parser,
|
|
@@ -22026,7 +22081,7 @@ async function transform(source, module, pluginDriver, warn) {
|
|
|
22026
22081
|
getCombinedSourcemap() {
|
|
22027
22082
|
const combinedMap = collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, warn);
|
|
22028
22083
|
if (!combinedMap) {
|
|
22029
|
-
const magicString = new MagicString
|
|
22084
|
+
const magicString = new MagicString(originalCode);
|
|
22030
22085
|
return magicString.generateMap({ hires: true, includeContent: true, source: id });
|
|
22031
22086
|
}
|
|
22032
22087
|
if (originalSourcemap !== combinedMap) {
|
|
@@ -23784,7 +23839,7 @@ exports.getOrCreate = getOrCreate;
|
|
|
23784
23839
|
exports.loadFsEvents = loadFsEvents;
|
|
23785
23840
|
exports.objectifyOption = objectifyOption;
|
|
23786
23841
|
exports.objectifyOptionWithPresets = objectifyOptionWithPresets;
|
|
23787
|
-
exports.picomatch = picomatch;
|
|
23842
|
+
exports.picomatch = picomatch$1;
|
|
23788
23843
|
exports.printQuotedStringList = printQuotedStringList;
|
|
23789
23844
|
exports.relativeId = relativeId;
|
|
23790
23845
|
exports.rollup = rollup;
|