rollup 3.25.1 → 3.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/dist/bin/rollup +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +591 -180
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/rollup.js +591 -180
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch-proxy.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +22 -19
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.25.
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.25.2
|
|
4
|
+
Sat, 24 Jun 2023 20:37:46 GMT - commit 91bf079599b84f97ea694dd1ecd0108ecf53fc97
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -30,7 +30,7 @@ function _interopNamespaceDefault(e) {
|
|
|
30
30
|
|
|
31
31
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
32
32
|
|
|
33
|
-
var version$1 = "3.25.
|
|
33
|
+
var version$1 = "3.25.2";
|
|
34
34
|
|
|
35
35
|
function ensureArray$1(items) {
|
|
36
36
|
if (Array.isArray(items)) {
|
|
@@ -79,45 +79,77 @@ function toBase64(value) {
|
|
|
79
79
|
return outString;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
var range = { start: start, end: end, line: i };
|
|
91
|
-
start = end;
|
|
92
|
-
return range;
|
|
93
|
-
});
|
|
94
|
-
var i = 0;
|
|
95
|
-
function rangeContains(range, index) {
|
|
96
|
-
return range.start <= index && index < range.end;
|
|
97
|
-
}
|
|
98
|
-
function getLocation(range, index) {
|
|
99
|
-
return { line: offsetLine + range.line, column: offsetColumn + index - range.start, character: index };
|
|
100
|
-
}
|
|
101
|
-
function locate(search, startIndex) {
|
|
102
|
-
if (typeof search === 'string') {
|
|
103
|
-
search = source.indexOf(search, startIndex || 0);
|
|
104
|
-
}
|
|
105
|
-
var range = lineRanges[i];
|
|
106
|
-
var d = search >= range.end ? 1 : -1;
|
|
107
|
-
while (range) {
|
|
108
|
-
if (rangeContains(range, search))
|
|
109
|
-
return getLocation(range, search);
|
|
110
|
-
i += d;
|
|
111
|
-
range = lineRanges[i];
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return locate;
|
|
82
|
+
/** @typedef {import('./types').Location} Location */
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @param {import('./types').Range} range
|
|
86
|
+
* @param {number} index
|
|
87
|
+
*/
|
|
88
|
+
function rangeContains(range, index) {
|
|
89
|
+
return range.start <= index && index < range.end;
|
|
115
90
|
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @param {string} source
|
|
94
|
+
* @param {import('./types').Options} [options]
|
|
95
|
+
*/
|
|
96
|
+
function getLocator$1(source, options = {}) {
|
|
97
|
+
const { offsetLine = 0, offsetColumn = 0 } = options;
|
|
98
|
+
|
|
99
|
+
let start = 0;
|
|
100
|
+
const ranges = source.split('\n').map((line, i) => {
|
|
101
|
+
const end = start + line.length + 1;
|
|
102
|
+
|
|
103
|
+
/** @type {import('./types').Range} */
|
|
104
|
+
const range = { start, end, line: i };
|
|
105
|
+
|
|
106
|
+
start = end;
|
|
107
|
+
return range;
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
let i = 0;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @param {string | number} search
|
|
114
|
+
* @param {number} [index]
|
|
115
|
+
* @returns {Location | undefined}
|
|
116
|
+
*/
|
|
117
|
+
function locator(search, index) {
|
|
118
|
+
if (typeof search === 'string') {
|
|
119
|
+
search = source.indexOf(search, index ?? 0);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (search === -1) return undefined;
|
|
123
|
+
|
|
124
|
+
let range = ranges[i];
|
|
125
|
+
|
|
126
|
+
const d = search >= range.end ? 1 : -1;
|
|
127
|
+
|
|
128
|
+
while (range) {
|
|
129
|
+
if (rangeContains(range, search)) {
|
|
130
|
+
return {
|
|
131
|
+
line: offsetLine + range.line,
|
|
132
|
+
column: offsetColumn + search - range.start,
|
|
133
|
+
character: search
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
i += d;
|
|
138
|
+
range = ranges[i];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return locator;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @param {string} source
|
|
147
|
+
* @param {string | number} search
|
|
148
|
+
* @param {import('./types').Options} [options]
|
|
149
|
+
* @returns {Location | undefined}
|
|
150
|
+
*/
|
|
116
151
|
function locate(source, search, options) {
|
|
117
|
-
|
|
118
|
-
throw new Error('locate takes a { startIndex, offsetLine, offsetColumn } object as the third argument');
|
|
119
|
-
}
|
|
120
|
-
return getLocator$1(source, options)(search, options && options.startIndex);
|
|
152
|
+
return getLocator$1(source, options)(search, options && options.startIndex);
|
|
121
153
|
}
|
|
122
154
|
|
|
123
155
|
function spaces(index) {
|
|
@@ -792,8 +824,11 @@ function logParseError(error, moduleId) {
|
|
|
792
824
|
};
|
|
793
825
|
}
|
|
794
826
|
function logPluginError(error, plugin, { hook, id } = {}) {
|
|
795
|
-
|
|
796
|
-
|
|
827
|
+
const code = error.code;
|
|
828
|
+
if (!error.pluginCode &&
|
|
829
|
+
code != null &&
|
|
830
|
+
(typeof code !== 'string' || (typeof code === 'string' && !code.startsWith('PLUGIN_')))) {
|
|
831
|
+
error.pluginCode = code;
|
|
797
832
|
}
|
|
798
833
|
error.code = PLUGIN_ERROR;
|
|
799
834
|
error.plugin = plugin;
|
|
@@ -19204,6 +19239,9 @@ var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\
|
|
|
19204
19239
|
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";
|
|
19205
19240
|
|
|
19206
19241
|
// These are a run-length and offset encoded representation of the
|
|
19242
|
+
// >0xffff code points that are a valid part of identifiers. The
|
|
19243
|
+
// offset starts at 0x10000, and each pair of numbers represents an
|
|
19244
|
+
// offset to the next range, and then a size of the range.
|
|
19207
19245
|
|
|
19208
19246
|
// Reserved word lists for various dialects of the language
|
|
19209
19247
|
|
|
@@ -20322,6 +20360,16 @@ pp$8.parseThrowStatement = function(node) {
|
|
|
20322
20360
|
|
|
20323
20361
|
var empty$1 = [];
|
|
20324
20362
|
|
|
20363
|
+
pp$8.parseCatchClauseParam = function() {
|
|
20364
|
+
var param = this.parseBindingAtom();
|
|
20365
|
+
var simple = param.type === "Identifier";
|
|
20366
|
+
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
20367
|
+
this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
20368
|
+
this.expect(types$1.parenR);
|
|
20369
|
+
|
|
20370
|
+
return param
|
|
20371
|
+
};
|
|
20372
|
+
|
|
20325
20373
|
pp$8.parseTryStatement = function(node) {
|
|
20326
20374
|
this.next();
|
|
20327
20375
|
node.block = this.parseBlock();
|
|
@@ -20330,11 +20378,7 @@ pp$8.parseTryStatement = function(node) {
|
|
|
20330
20378
|
var clause = this.startNode();
|
|
20331
20379
|
this.next();
|
|
20332
20380
|
if (this.eat(types$1.parenL)) {
|
|
20333
|
-
clause.param = this.
|
|
20334
|
-
var simple = clause.param.type === "Identifier";
|
|
20335
|
-
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
20336
|
-
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
20337
|
-
this.expect(types$1.parenR);
|
|
20381
|
+
clause.param = this.parseCatchClauseParam();
|
|
20338
20382
|
} else {
|
|
20339
20383
|
if (this.options.ecmaVersion < 10) { this.unexpected(); }
|
|
20340
20384
|
clause.param = null;
|
|
@@ -20350,9 +20394,9 @@ pp$8.parseTryStatement = function(node) {
|
|
|
20350
20394
|
return this.finishNode(node, "TryStatement")
|
|
20351
20395
|
};
|
|
20352
20396
|
|
|
20353
|
-
pp$8.parseVarStatement = function(node, kind) {
|
|
20397
|
+
pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {
|
|
20354
20398
|
this.next();
|
|
20355
|
-
this.parseVar(node, false, kind);
|
|
20399
|
+
this.parseVar(node, false, kind, allowMissingInitializer);
|
|
20356
20400
|
this.semicolon();
|
|
20357
20401
|
return this.finishNode(node, "VariableDeclaration")
|
|
20358
20402
|
};
|
|
@@ -20481,7 +20525,7 @@ pp$8.parseForIn = function(node, init) {
|
|
|
20481
20525
|
|
|
20482
20526
|
// Parse a list of variable declarations.
|
|
20483
20527
|
|
|
20484
|
-
pp$8.parseVar = function(node, isFor, kind) {
|
|
20528
|
+
pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
|
|
20485
20529
|
node.declarations = [];
|
|
20486
20530
|
node.kind = kind;
|
|
20487
20531
|
for (;;) {
|
|
@@ -20489,9 +20533,9 @@ pp$8.parseVar = function(node, isFor, kind) {
|
|
|
20489
20533
|
this.parseVarId(decl, kind);
|
|
20490
20534
|
if (this.eat(types$1.eq)) {
|
|
20491
20535
|
decl.init = this.parseMaybeAssign(isFor);
|
|
20492
|
-
} else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
20536
|
+
} else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
20493
20537
|
this.unexpected();
|
|
20494
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
20538
|
+
} else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
20495
20539
|
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
|
20496
20540
|
} else {
|
|
20497
20541
|
decl.init = null;
|
|
@@ -20580,7 +20624,7 @@ pp$8.parseClass = function(node, isStatement) {
|
|
|
20580
20624
|
if (element) {
|
|
20581
20625
|
classBody.body.push(element);
|
|
20582
20626
|
if (element.type === "MethodDefinition" && element.kind === "constructor") {
|
|
20583
|
-
if (hadConstructor) { this.
|
|
20627
|
+
if (hadConstructor) { this.raiseRecoverable(element.start, "Duplicate constructor in the same class"); }
|
|
20584
20628
|
hadConstructor = true;
|
|
20585
20629
|
} else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
|
|
20586
20630
|
this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared"));
|
|
@@ -20829,44 +20873,36 @@ function checkKeyName(node, name) {
|
|
|
20829
20873
|
|
|
20830
20874
|
// Parses module export declaration.
|
|
20831
20875
|
|
|
20876
|
+
pp$8.parseExportAllDeclaration = function(node, exports) {
|
|
20877
|
+
if (this.options.ecmaVersion >= 11) {
|
|
20878
|
+
if (this.eatContextual("as")) {
|
|
20879
|
+
node.exported = this.parseModuleExportName();
|
|
20880
|
+
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
20881
|
+
} else {
|
|
20882
|
+
node.exported = null;
|
|
20883
|
+
}
|
|
20884
|
+
}
|
|
20885
|
+
this.expectContextual("from");
|
|
20886
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
20887
|
+
node.source = this.parseExprAtom();
|
|
20888
|
+
this.semicolon();
|
|
20889
|
+
return this.finishNode(node, "ExportAllDeclaration")
|
|
20890
|
+
};
|
|
20891
|
+
|
|
20832
20892
|
pp$8.parseExport = function(node, exports) {
|
|
20833
20893
|
this.next();
|
|
20834
20894
|
// export * from '...'
|
|
20835
20895
|
if (this.eat(types$1.star)) {
|
|
20836
|
-
|
|
20837
|
-
if (this.eatContextual("as")) {
|
|
20838
|
-
node.exported = this.parseModuleExportName();
|
|
20839
|
-
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
20840
|
-
} else {
|
|
20841
|
-
node.exported = null;
|
|
20842
|
-
}
|
|
20843
|
-
}
|
|
20844
|
-
this.expectContextual("from");
|
|
20845
|
-
if (this.type !== types$1.string) { this.unexpected(); }
|
|
20846
|
-
node.source = this.parseExprAtom();
|
|
20847
|
-
this.semicolon();
|
|
20848
|
-
return this.finishNode(node, "ExportAllDeclaration")
|
|
20896
|
+
return this.parseExportAllDeclaration(node, exports)
|
|
20849
20897
|
}
|
|
20850
20898
|
if (this.eat(types$1._default)) { // export default ...
|
|
20851
20899
|
this.checkExport(exports, "default", this.lastTokStart);
|
|
20852
|
-
|
|
20853
|
-
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
20854
|
-
var fNode = this.startNode();
|
|
20855
|
-
this.next();
|
|
20856
|
-
if (isAsync) { this.next(); }
|
|
20857
|
-
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT$1 | FUNC_NULLABLE_ID$1, false, isAsync);
|
|
20858
|
-
} else if (this.type === types$1._class) {
|
|
20859
|
-
var cNode = this.startNode();
|
|
20860
|
-
node.declaration = this.parseClass(cNode, "nullableID");
|
|
20861
|
-
} else {
|
|
20862
|
-
node.declaration = this.parseMaybeAssign();
|
|
20863
|
-
this.semicolon();
|
|
20864
|
-
}
|
|
20900
|
+
node.declaration = this.parseExportDefaultDeclaration();
|
|
20865
20901
|
return this.finishNode(node, "ExportDefaultDeclaration")
|
|
20866
20902
|
}
|
|
20867
20903
|
// export var|const|let|function|class ...
|
|
20868
20904
|
if (this.shouldParseExportStatement()) {
|
|
20869
|
-
node.declaration = this.
|
|
20905
|
+
node.declaration = this.parseExportDeclaration(node);
|
|
20870
20906
|
if (node.declaration.type === "VariableDeclaration")
|
|
20871
20907
|
{ this.checkVariableExport(exports, node.declaration.declarations); }
|
|
20872
20908
|
else
|
|
@@ -20900,6 +20936,27 @@ pp$8.parseExport = function(node, exports) {
|
|
|
20900
20936
|
return this.finishNode(node, "ExportNamedDeclaration")
|
|
20901
20937
|
};
|
|
20902
20938
|
|
|
20939
|
+
pp$8.parseExportDeclaration = function(node) {
|
|
20940
|
+
return this.parseStatement(null)
|
|
20941
|
+
};
|
|
20942
|
+
|
|
20943
|
+
pp$8.parseExportDefaultDeclaration = function() {
|
|
20944
|
+
var isAsync;
|
|
20945
|
+
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
20946
|
+
var fNode = this.startNode();
|
|
20947
|
+
this.next();
|
|
20948
|
+
if (isAsync) { this.next(); }
|
|
20949
|
+
return this.parseFunction(fNode, FUNC_STATEMENT$1 | FUNC_NULLABLE_ID$1, false, isAsync)
|
|
20950
|
+
} else if (this.type === types$1._class) {
|
|
20951
|
+
var cNode = this.startNode();
|
|
20952
|
+
return this.parseClass(cNode, "nullableID")
|
|
20953
|
+
} else {
|
|
20954
|
+
var declaration = this.parseMaybeAssign();
|
|
20955
|
+
this.semicolon();
|
|
20956
|
+
return declaration
|
|
20957
|
+
}
|
|
20958
|
+
};
|
|
20959
|
+
|
|
20903
20960
|
pp$8.checkExport = function(exports, name, pos) {
|
|
20904
20961
|
if (!exports) { return }
|
|
20905
20962
|
if (typeof name !== "string")
|
|
@@ -20957,6 +21014,20 @@ pp$8.shouldParseExportStatement = function() {
|
|
|
20957
21014
|
|
|
20958
21015
|
// Parses a comma-separated list of module exports.
|
|
20959
21016
|
|
|
21017
|
+
pp$8.parseExportSpecifier = function(exports) {
|
|
21018
|
+
var node = this.startNode();
|
|
21019
|
+
node.local = this.parseModuleExportName();
|
|
21020
|
+
|
|
21021
|
+
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
21022
|
+
this.checkExport(
|
|
21023
|
+
exports,
|
|
21024
|
+
node.exported,
|
|
21025
|
+
node.exported.start
|
|
21026
|
+
);
|
|
21027
|
+
|
|
21028
|
+
return this.finishNode(node, "ExportSpecifier")
|
|
21029
|
+
};
|
|
21030
|
+
|
|
20960
21031
|
pp$8.parseExportSpecifiers = function(exports) {
|
|
20961
21032
|
var nodes = [], first = true;
|
|
20962
21033
|
// export { x, y as z } [from '...']
|
|
@@ -20967,15 +21038,7 @@ pp$8.parseExportSpecifiers = function(exports) {
|
|
|
20967
21038
|
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
20968
21039
|
} else { first = false; }
|
|
20969
21040
|
|
|
20970
|
-
|
|
20971
|
-
node.local = this.parseModuleExportName();
|
|
20972
|
-
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
20973
|
-
this.checkExport(
|
|
20974
|
-
exports,
|
|
20975
|
-
node.exported,
|
|
20976
|
-
node.exported.start
|
|
20977
|
-
);
|
|
20978
|
-
nodes.push(this.finishNode(node, "ExportSpecifier"));
|
|
21041
|
+
nodes.push(this.parseExportSpecifier(exports));
|
|
20979
21042
|
}
|
|
20980
21043
|
return nodes
|
|
20981
21044
|
};
|
|
@@ -20984,6 +21047,7 @@ pp$8.parseExportSpecifiers = function(exports) {
|
|
|
20984
21047
|
|
|
20985
21048
|
pp$8.parseImport = function(node) {
|
|
20986
21049
|
this.next();
|
|
21050
|
+
|
|
20987
21051
|
// import '...'
|
|
20988
21052
|
if (this.type === types$1.string) {
|
|
20989
21053
|
node.specifiers = empty$1;
|
|
@@ -20999,23 +21063,46 @@ pp$8.parseImport = function(node) {
|
|
|
20999
21063
|
|
|
21000
21064
|
// Parses a comma-separated list of module imports.
|
|
21001
21065
|
|
|
21066
|
+
pp$8.parseImportSpecifier = function() {
|
|
21067
|
+
var node = this.startNode();
|
|
21068
|
+
node.imported = this.parseModuleExportName();
|
|
21069
|
+
|
|
21070
|
+
if (this.eatContextual("as")) {
|
|
21071
|
+
node.local = this.parseIdent();
|
|
21072
|
+
} else {
|
|
21073
|
+
this.checkUnreserved(node.imported);
|
|
21074
|
+
node.local = node.imported;
|
|
21075
|
+
}
|
|
21076
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
21077
|
+
|
|
21078
|
+
return this.finishNode(node, "ImportSpecifier")
|
|
21079
|
+
};
|
|
21080
|
+
|
|
21081
|
+
pp$8.parseImportDefaultSpecifier = function() {
|
|
21082
|
+
// import defaultObj, { x, y as z } from '...'
|
|
21083
|
+
var node = this.startNode();
|
|
21084
|
+
node.local = this.parseIdent();
|
|
21085
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
21086
|
+
return this.finishNode(node, "ImportDefaultSpecifier")
|
|
21087
|
+
};
|
|
21088
|
+
|
|
21089
|
+
pp$8.parseImportNamespaceSpecifier = function() {
|
|
21090
|
+
var node = this.startNode();
|
|
21091
|
+
this.next();
|
|
21092
|
+
this.expectContextual("as");
|
|
21093
|
+
node.local = this.parseIdent();
|
|
21094
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
21095
|
+
return this.finishNode(node, "ImportNamespaceSpecifier")
|
|
21096
|
+
};
|
|
21097
|
+
|
|
21002
21098
|
pp$8.parseImportSpecifiers = function() {
|
|
21003
21099
|
var nodes = [], first = true;
|
|
21004
21100
|
if (this.type === types$1.name) {
|
|
21005
|
-
|
|
21006
|
-
var node = this.startNode();
|
|
21007
|
-
node.local = this.parseIdent();
|
|
21008
|
-
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
21009
|
-
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
|
|
21101
|
+
nodes.push(this.parseImportDefaultSpecifier());
|
|
21010
21102
|
if (!this.eat(types$1.comma)) { return nodes }
|
|
21011
21103
|
}
|
|
21012
21104
|
if (this.type === types$1.star) {
|
|
21013
|
-
|
|
21014
|
-
this.next();
|
|
21015
|
-
this.expectContextual("as");
|
|
21016
|
-
node$1.local = this.parseIdent();
|
|
21017
|
-
this.checkLValSimple(node$1.local, BIND_LEXICAL);
|
|
21018
|
-
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
|
|
21105
|
+
nodes.push(this.parseImportNamespaceSpecifier());
|
|
21019
21106
|
return nodes
|
|
21020
21107
|
}
|
|
21021
21108
|
this.expect(types$1.braceL);
|
|
@@ -21025,16 +21112,7 @@ pp$8.parseImportSpecifiers = function() {
|
|
|
21025
21112
|
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
21026
21113
|
} else { first = false; }
|
|
21027
21114
|
|
|
21028
|
-
|
|
21029
|
-
node$2.imported = this.parseModuleExportName();
|
|
21030
|
-
if (this.eatContextual("as")) {
|
|
21031
|
-
node$2.local = this.parseIdent();
|
|
21032
|
-
} else {
|
|
21033
|
-
this.checkUnreserved(node$2.imported);
|
|
21034
|
-
node$2.local = node$2.imported;
|
|
21035
|
-
}
|
|
21036
|
-
this.checkLValSimple(node$2.local, BIND_LEXICAL);
|
|
21037
|
-
nodes.push(this.finishNode(node$2, "ImportSpecifier"));
|
|
21115
|
+
nodes.push(this.parseImportSpecifier());
|
|
21038
21116
|
}
|
|
21039
21117
|
return nodes
|
|
21040
21118
|
};
|
|
@@ -21207,7 +21285,7 @@ pp$7.parseBindingAtom = function() {
|
|
|
21207
21285
|
return this.parseIdent()
|
|
21208
21286
|
};
|
|
21209
21287
|
|
|
21210
|
-
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
21288
|
+
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) {
|
|
21211
21289
|
var elts = [], first = true;
|
|
21212
21290
|
while (!this.eat(close)) {
|
|
21213
21291
|
if (first) { first = false; }
|
|
@@ -21220,18 +21298,22 @@ pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
|
21220
21298
|
var rest = this.parseRestBinding();
|
|
21221
21299
|
this.parseBindingListItem(rest);
|
|
21222
21300
|
elts.push(rest);
|
|
21223
|
-
if (this.type === types$1.comma) { this.
|
|
21301
|
+
if (this.type === types$1.comma) { this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); }
|
|
21224
21302
|
this.expect(close);
|
|
21225
21303
|
break
|
|
21226
21304
|
} else {
|
|
21227
|
-
|
|
21228
|
-
this.parseBindingListItem(elem);
|
|
21229
|
-
elts.push(elem);
|
|
21305
|
+
elts.push(this.parseAssignableListItem(allowModifiers));
|
|
21230
21306
|
}
|
|
21231
21307
|
}
|
|
21232
21308
|
return elts
|
|
21233
21309
|
};
|
|
21234
21310
|
|
|
21311
|
+
pp$7.parseAssignableListItem = function(allowModifiers) {
|
|
21312
|
+
var elem = this.parseMaybeDefault(this.start, this.startLoc);
|
|
21313
|
+
this.parseBindingListItem(elem);
|
|
21314
|
+
return elem
|
|
21315
|
+
};
|
|
21316
|
+
|
|
21235
21317
|
pp$7.parseBindingListItem = function(param) {
|
|
21236
21318
|
return param
|
|
21237
21319
|
};
|
|
@@ -21397,6 +21479,9 @@ pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
|
|
|
21397
21479
|
};
|
|
21398
21480
|
|
|
21399
21481
|
// The algorithm used to determine whether a regexp can appear at a
|
|
21482
|
+
// given point in the program is loosely based on sweet.js' approach.
|
|
21483
|
+
// See https://github.com/mozilla/sweet.js/wiki/design
|
|
21484
|
+
|
|
21400
21485
|
|
|
21401
21486
|
var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
|
|
21402
21487
|
this.token = token;
|
|
@@ -21552,6 +21637,23 @@ types$1.name.updateContext = function(prevType) {
|
|
|
21552
21637
|
};
|
|
21553
21638
|
|
|
21554
21639
|
// A recursive descent parser operates by defining functions for all
|
|
21640
|
+
// syntactic elements, and recursively calling those, each function
|
|
21641
|
+
// advancing the input stream and returning an AST node. Precedence
|
|
21642
|
+
// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
|
|
21643
|
+
// instead of `(!x)[1]` is handled by the fact that the parser
|
|
21644
|
+
// function that parses unary prefix operators is called first, and
|
|
21645
|
+
// in turn calls the function that parses `[]` subscripts — that
|
|
21646
|
+
// way, it'll receive the node for `x[1]` already parsed, and wraps
|
|
21647
|
+
// *that* in the unary operator node.
|
|
21648
|
+
//
|
|
21649
|
+
// Acorn uses an [operator precedence parser][opp] to handle binary
|
|
21650
|
+
// operator precedence, because it is much more compact than using
|
|
21651
|
+
// the technique outlined above, which uses different, nesting
|
|
21652
|
+
// functions to specify precedence, for all of the ten binary
|
|
21653
|
+
// precedence levels that JavaScript defines.
|
|
21654
|
+
//
|
|
21655
|
+
// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
|
|
21656
|
+
|
|
21555
21657
|
|
|
21556
21658
|
var pp$5 = Parser.prototype;
|
|
21557
21659
|
|
|
@@ -21855,6 +21957,14 @@ pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
|
21855
21957
|
}
|
|
21856
21958
|
};
|
|
21857
21959
|
|
|
21960
|
+
pp$5.shouldParseAsyncArrow = function() {
|
|
21961
|
+
return !this.canInsertSemicolon() && this.eat(types$1.arrow)
|
|
21962
|
+
};
|
|
21963
|
+
|
|
21964
|
+
pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) {
|
|
21965
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)
|
|
21966
|
+
};
|
|
21967
|
+
|
|
21858
21968
|
pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
|
|
21859
21969
|
var optionalSupported = this.options.ecmaVersion >= 11;
|
|
21860
21970
|
var optional = optionalSupported && this.eat(types$1.questionDot);
|
|
@@ -21883,7 +21993,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
21883
21993
|
this.awaitPos = 0;
|
|
21884
21994
|
this.awaitIdentPos = 0;
|
|
21885
21995
|
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
21886
|
-
if (maybeAsyncArrow && !optional &&
|
|
21996
|
+
if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {
|
|
21887
21997
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
21888
21998
|
this.checkYieldAwaitInDefaultParams();
|
|
21889
21999
|
if (this.awaitIdentPos > 0)
|
|
@@ -21891,7 +22001,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
21891
22001
|
this.yieldPos = oldYieldPos;
|
|
21892
22002
|
this.awaitPos = oldAwaitPos;
|
|
21893
22003
|
this.awaitIdentPos = oldAwaitIdentPos;
|
|
21894
|
-
return this.
|
|
22004
|
+
return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit)
|
|
21895
22005
|
}
|
|
21896
22006
|
this.checkExpressionErrors(refDestructuringErrors, true);
|
|
21897
22007
|
this.yieldPos = oldYieldPos || this.yieldPos;
|
|
@@ -21921,7 +22031,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
21921
22031
|
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
|
|
21922
22032
|
// or `{}`.
|
|
21923
22033
|
|
|
21924
|
-
pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
22034
|
+
pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
|
|
21925
22035
|
// If a division operator appears in an expression position, the
|
|
21926
22036
|
// tokenizer got confused, and we force it to read a regexp instead.
|
|
21927
22037
|
if (this.type === types$1.slash) { this.readRegexp(); }
|
|
@@ -22022,17 +22132,21 @@ pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
22022
22132
|
|
|
22023
22133
|
case types$1._import:
|
|
22024
22134
|
if (this.options.ecmaVersion >= 11) {
|
|
22025
|
-
return this.parseExprImport()
|
|
22135
|
+
return this.parseExprImport(forNew)
|
|
22026
22136
|
} else {
|
|
22027
22137
|
return this.unexpected()
|
|
22028
22138
|
}
|
|
22029
22139
|
|
|
22030
22140
|
default:
|
|
22031
|
-
this.
|
|
22141
|
+
return this.parseExprAtomDefault()
|
|
22032
22142
|
}
|
|
22033
22143
|
};
|
|
22034
22144
|
|
|
22035
|
-
pp$5.
|
|
22145
|
+
pp$5.parseExprAtomDefault = function() {
|
|
22146
|
+
this.unexpected();
|
|
22147
|
+
};
|
|
22148
|
+
|
|
22149
|
+
pp$5.parseExprImport = function(forNew) {
|
|
22036
22150
|
var node = this.startNode();
|
|
22037
22151
|
|
|
22038
22152
|
// Consume `import` as an identifier for `import.meta`.
|
|
@@ -22040,13 +22154,12 @@ pp$5.parseExprImport = function() {
|
|
|
22040
22154
|
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
|
|
22041
22155
|
var meta = this.parseIdent(true);
|
|
22042
22156
|
|
|
22043
|
-
|
|
22044
|
-
case types$1.parenL:
|
|
22157
|
+
if (this.type === types$1.parenL && !forNew) {
|
|
22045
22158
|
return this.parseDynamicImport(node)
|
|
22046
|
-
|
|
22159
|
+
} else if (this.type === types$1.dot) {
|
|
22047
22160
|
node.meta = meta;
|
|
22048
22161
|
return this.parseImportMeta(node)
|
|
22049
|
-
|
|
22162
|
+
} else {
|
|
22050
22163
|
this.unexpected();
|
|
22051
22164
|
}
|
|
22052
22165
|
};
|
|
@@ -22102,6 +22215,10 @@ pp$5.parseParenExpression = function() {
|
|
|
22102
22215
|
return val
|
|
22103
22216
|
};
|
|
22104
22217
|
|
|
22218
|
+
pp$5.shouldParseArrow = function(exprList) {
|
|
22219
|
+
return !this.canInsertSemicolon()
|
|
22220
|
+
};
|
|
22221
|
+
|
|
22105
22222
|
pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
22106
22223
|
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
|
|
22107
22224
|
if (this.options.ecmaVersion >= 6) {
|
|
@@ -22121,7 +22238,12 @@ pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
22121
22238
|
} else if (this.type === types$1.ellipsis) {
|
|
22122
22239
|
spreadStart = this.start;
|
|
22123
22240
|
exprList.push(this.parseParenItem(this.parseRestBinding()));
|
|
22124
|
-
if (this.type === types$1.comma) {
|
|
22241
|
+
if (this.type === types$1.comma) {
|
|
22242
|
+
this.raiseRecoverable(
|
|
22243
|
+
this.start,
|
|
22244
|
+
"Comma is not permitted after the rest element"
|
|
22245
|
+
);
|
|
22246
|
+
}
|
|
22125
22247
|
break
|
|
22126
22248
|
} else {
|
|
22127
22249
|
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
|
|
@@ -22130,7 +22252,7 @@ pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
22130
22252
|
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
|
|
22131
22253
|
this.expect(types$1.parenR);
|
|
22132
22254
|
|
|
22133
|
-
if (canBeArrow &&
|
|
22255
|
+
if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {
|
|
22134
22256
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
22135
22257
|
this.checkYieldAwaitInDefaultParams();
|
|
22136
22258
|
this.yieldPos = oldYieldPos;
|
|
@@ -22196,11 +22318,8 @@ pp$5.parseNew = function() {
|
|
|
22196
22318
|
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
|
|
22197
22319
|
return this.finishNode(node, "MetaProperty")
|
|
22198
22320
|
}
|
|
22199
|
-
var startPos = this.start, startLoc = this.startLoc
|
|
22200
|
-
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
|
|
22201
|
-
if (isImport && node.callee.type === "ImportExpression") {
|
|
22202
|
-
this.raise(startPos, "Cannot use new with import()");
|
|
22203
|
-
}
|
|
22321
|
+
var startPos = this.start, startLoc = this.startLoc;
|
|
22322
|
+
node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
|
|
22204
22323
|
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
22205
22324
|
else { node.arguments = empty; }
|
|
22206
22325
|
return this.finishNode(node, "NewExpression")
|
|
@@ -22282,7 +22401,7 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
22282
22401
|
if (isPattern) {
|
|
22283
22402
|
prop.argument = this.parseIdent(false);
|
|
22284
22403
|
if (this.type === types$1.comma) {
|
|
22285
|
-
this.
|
|
22404
|
+
this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
|
|
22286
22405
|
}
|
|
22287
22406
|
return this.finishNode(prop, "RestElement")
|
|
22288
22407
|
}
|
|
@@ -22318,6 +22437,23 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
22318
22437
|
return this.finishNode(prop, "Property")
|
|
22319
22438
|
};
|
|
22320
22439
|
|
|
22440
|
+
pp$5.parseGetterSetter = function(prop) {
|
|
22441
|
+
prop.kind = prop.key.name;
|
|
22442
|
+
this.parsePropertyName(prop);
|
|
22443
|
+
prop.value = this.parseMethod(false);
|
|
22444
|
+
var paramCount = prop.kind === "get" ? 0 : 1;
|
|
22445
|
+
if (prop.value.params.length !== paramCount) {
|
|
22446
|
+
var start = prop.value.start;
|
|
22447
|
+
if (prop.kind === "get")
|
|
22448
|
+
{ this.raiseRecoverable(start, "getter should have no params"); }
|
|
22449
|
+
else
|
|
22450
|
+
{ this.raiseRecoverable(start, "setter should have exactly one param"); }
|
|
22451
|
+
} else {
|
|
22452
|
+
if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
|
|
22453
|
+
{ this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
|
|
22454
|
+
}
|
|
22455
|
+
};
|
|
22456
|
+
|
|
22321
22457
|
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
|
|
22322
22458
|
if ((isGenerator || isAsync) && this.type === types$1.colon)
|
|
22323
22459
|
{ this.unexpected(); }
|
|
@@ -22335,20 +22471,7 @@ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
22335
22471
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
|
22336
22472
|
(this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
|
|
22337
22473
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
22338
|
-
|
|
22339
|
-
this.parsePropertyName(prop);
|
|
22340
|
-
prop.value = this.parseMethod(false);
|
|
22341
|
-
var paramCount = prop.kind === "get" ? 0 : 1;
|
|
22342
|
-
if (prop.value.params.length !== paramCount) {
|
|
22343
|
-
var start = prop.value.start;
|
|
22344
|
-
if (prop.kind === "get")
|
|
22345
|
-
{ this.raiseRecoverable(start, "getter should have no params"); }
|
|
22346
|
-
else
|
|
22347
|
-
{ this.raiseRecoverable(start, "setter should have exactly one param"); }
|
|
22348
|
-
} else {
|
|
22349
|
-
if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
|
|
22350
|
-
{ this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
|
|
22351
|
-
}
|
|
22474
|
+
this.parseGetterSetter(prop);
|
|
22352
22475
|
} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
|
|
22353
22476
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
22354
22477
|
this.checkUnreserved(prop.key);
|
|
@@ -22560,6 +22683,18 @@ pp$5.checkUnreserved = function(ref) {
|
|
|
22560
22683
|
// identifiers.
|
|
22561
22684
|
|
|
22562
22685
|
pp$5.parseIdent = function(liberal) {
|
|
22686
|
+
var node = this.parseIdentNode();
|
|
22687
|
+
this.next(!!liberal);
|
|
22688
|
+
this.finishNode(node, "Identifier");
|
|
22689
|
+
if (!liberal) {
|
|
22690
|
+
this.checkUnreserved(node);
|
|
22691
|
+
if (node.name === "await" && !this.awaitIdentPos)
|
|
22692
|
+
{ this.awaitIdentPos = node.start; }
|
|
22693
|
+
}
|
|
22694
|
+
return node
|
|
22695
|
+
};
|
|
22696
|
+
|
|
22697
|
+
pp$5.parseIdentNode = function() {
|
|
22563
22698
|
var node = this.startNode();
|
|
22564
22699
|
if (this.type === types$1.name) {
|
|
22565
22700
|
node.name = this.value;
|
|
@@ -22571,19 +22706,12 @@ pp$5.parseIdent = function(liberal) {
|
|
|
22571
22706
|
// But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
|
|
22572
22707
|
// If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
|
|
22573
22708
|
if ((node.name === "class" || node.name === "function") &&
|
|
22574
|
-
|
|
22709
|
+
(this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
|
|
22575
22710
|
this.context.pop();
|
|
22576
22711
|
}
|
|
22577
22712
|
} else {
|
|
22578
22713
|
this.unexpected();
|
|
22579
22714
|
}
|
|
22580
|
-
this.next(!!liberal);
|
|
22581
|
-
this.finishNode(node, "Identifier");
|
|
22582
|
-
if (!liberal) {
|
|
22583
|
-
this.checkUnreserved(node);
|
|
22584
|
-
if (node.name === "await" && !this.awaitIdentPos)
|
|
22585
|
-
{ this.awaitIdentPos = node.start; }
|
|
22586
|
-
}
|
|
22587
22715
|
return node
|
|
22588
22716
|
};
|
|
22589
22717
|
|
|
@@ -22823,6 +22951,18 @@ var unicodeBinaryProperties = {
|
|
|
22823
22951
|
14: ecma14BinaryProperties
|
|
22824
22952
|
};
|
|
22825
22953
|
|
|
22954
|
+
// #table-binary-unicode-properties-of-strings
|
|
22955
|
+
var ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji";
|
|
22956
|
+
|
|
22957
|
+
var unicodeBinaryPropertiesOfStrings = {
|
|
22958
|
+
9: "",
|
|
22959
|
+
10: "",
|
|
22960
|
+
11: "",
|
|
22961
|
+
12: "",
|
|
22962
|
+
13: "",
|
|
22963
|
+
14: ecma14BinaryPropertiesOfStrings
|
|
22964
|
+
};
|
|
22965
|
+
|
|
22826
22966
|
// #table-unicode-general-category-values
|
|
22827
22967
|
var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";
|
|
22828
22968
|
|
|
@@ -22832,7 +22972,7 @@ var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Han
|
|
|
22832
22972
|
var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
|
|
22833
22973
|
var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
|
|
22834
22974
|
var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
|
|
22835
|
-
var ecma14ScriptValues = ecma13ScriptValues + " Kawi Nag_Mundari Nagm";
|
|
22975
|
+
var ecma14ScriptValues = ecma13ScriptValues + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz";
|
|
22836
22976
|
|
|
22837
22977
|
var unicodeScriptValues = {
|
|
22838
22978
|
9: ecma9ScriptValues,
|
|
@@ -22847,6 +22987,7 @@ var data = {};
|
|
|
22847
22987
|
function buildUnicodeData(ecmaVersion) {
|
|
22848
22988
|
var d = data[ecmaVersion] = {
|
|
22849
22989
|
binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
|
|
22990
|
+
binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),
|
|
22850
22991
|
nonBinary: {
|
|
22851
22992
|
General_Category: wordsRegexp(unicodeGeneralCategoryValues),
|
|
22852
22993
|
Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
|
|
@@ -22869,12 +23010,13 @@ var pp$1 = Parser.prototype;
|
|
|
22869
23010
|
|
|
22870
23011
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
22871
23012
|
this.parser = parser;
|
|
22872
|
-
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "");
|
|
23013
|
+
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
|
|
22873
23014
|
this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];
|
|
22874
23015
|
this.source = "";
|
|
22875
23016
|
this.flags = "";
|
|
22876
23017
|
this.start = 0;
|
|
22877
23018
|
this.switchU = false;
|
|
23019
|
+
this.switchV = false;
|
|
22878
23020
|
this.switchN = false;
|
|
22879
23021
|
this.pos = 0;
|
|
22880
23022
|
this.lastIntValue = 0;
|
|
@@ -22887,12 +23029,20 @@ var RegExpValidationState = function RegExpValidationState(parser) {
|
|
|
22887
23029
|
};
|
|
22888
23030
|
|
|
22889
23031
|
RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
|
|
23032
|
+
var unicodeSets = flags.indexOf("v") !== -1;
|
|
22890
23033
|
var unicode = flags.indexOf("u") !== -1;
|
|
22891
23034
|
this.start = start | 0;
|
|
22892
23035
|
this.source = pattern + "";
|
|
22893
23036
|
this.flags = flags;
|
|
22894
|
-
|
|
22895
|
-
|
|
23037
|
+
if (unicodeSets && this.parser.options.ecmaVersion >= 15) {
|
|
23038
|
+
this.switchU = true;
|
|
23039
|
+
this.switchV = true;
|
|
23040
|
+
this.switchN = true;
|
|
23041
|
+
} else {
|
|
23042
|
+
this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
|
|
23043
|
+
this.switchV = false;
|
|
23044
|
+
this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
|
|
23045
|
+
}
|
|
22896
23046
|
};
|
|
22897
23047
|
|
|
22898
23048
|
RegExpValidationState.prototype.raise = function raise (message) {
|
|
@@ -22961,6 +23111,23 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
|
|
|
22961
23111
|
return false
|
|
22962
23112
|
};
|
|
22963
23113
|
|
|
23114
|
+
RegExpValidationState.prototype.eatChars = function eatChars (chs, forceU) {
|
|
23115
|
+
if ( forceU === void 0 ) forceU = false;
|
|
23116
|
+
|
|
23117
|
+
var pos = this.pos;
|
|
23118
|
+
for (var i = 0, list = chs; i < list.length; i += 1) {
|
|
23119
|
+
var ch = list[i];
|
|
23120
|
+
|
|
23121
|
+
var current = this.at(pos, forceU);
|
|
23122
|
+
if (current === -1 || current !== ch) {
|
|
23123
|
+
return false
|
|
23124
|
+
}
|
|
23125
|
+
pos = this.nextIndex(pos, forceU);
|
|
23126
|
+
}
|
|
23127
|
+
this.pos = pos;
|
|
23128
|
+
return true
|
|
23129
|
+
};
|
|
23130
|
+
|
|
22964
23131
|
/**
|
|
22965
23132
|
* Validate the flags part of a given RegExpLiteral.
|
|
22966
23133
|
*
|
|
@@ -22971,6 +23138,9 @@ pp$1.validateRegExpFlags = function(state) {
|
|
|
22971
23138
|
var validFlags = state.validFlags;
|
|
22972
23139
|
var flags = state.flags;
|
|
22973
23140
|
|
|
23141
|
+
var u = false;
|
|
23142
|
+
var v = false;
|
|
23143
|
+
|
|
22974
23144
|
for (var i = 0; i < flags.length; i++) {
|
|
22975
23145
|
var flag = flags.charAt(i);
|
|
22976
23146
|
if (validFlags.indexOf(flag) === -1) {
|
|
@@ -22979,6 +23149,11 @@ pp$1.validateRegExpFlags = function(state) {
|
|
|
22979
23149
|
if (flags.indexOf(flag, i + 1) > -1) {
|
|
22980
23150
|
this.raise(state.start, "Duplicate regular expression flag");
|
|
22981
23151
|
}
|
|
23152
|
+
if (flag === "u") { u = true; }
|
|
23153
|
+
if (flag === "v") { v = true; }
|
|
23154
|
+
}
|
|
23155
|
+
if (this.options.ecmaVersion >= 15 && u && v) {
|
|
23156
|
+
this.raise(state.start, "Invalid regular expression flag");
|
|
22982
23157
|
}
|
|
22983
23158
|
};
|
|
22984
23159
|
|
|
@@ -23597,6 +23772,12 @@ pp$1.regexp_eatDecimalEscape = function(state) {
|
|
|
23597
23772
|
return false
|
|
23598
23773
|
};
|
|
23599
23774
|
|
|
23775
|
+
// Return values used by character set parsing methods, needed to
|
|
23776
|
+
// forbid negation of sets that can match strings.
|
|
23777
|
+
var CharSetNone = 0; // Nothing parsed
|
|
23778
|
+
var CharSetOk = 1; // Construct parsed, cannot contain strings
|
|
23779
|
+
var CharSetString = 2; // Construct parsed, can contain strings
|
|
23780
|
+
|
|
23600
23781
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
|
|
23601
23782
|
pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
23602
23783
|
var ch = state.current();
|
|
@@ -23604,28 +23785,32 @@ pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
|
23604
23785
|
if (isCharacterClassEscape(ch)) {
|
|
23605
23786
|
state.lastIntValue = -1;
|
|
23606
23787
|
state.advance();
|
|
23607
|
-
return
|
|
23788
|
+
return CharSetOk
|
|
23608
23789
|
}
|
|
23609
23790
|
|
|
23791
|
+
var negate = false;
|
|
23610
23792
|
if (
|
|
23611
23793
|
state.switchU &&
|
|
23612
23794
|
this.options.ecmaVersion >= 9 &&
|
|
23613
|
-
(ch === 0x50 /* P */ || ch === 0x70 /* p */)
|
|
23795
|
+
((negate = ch === 0x50 /* P */) || ch === 0x70 /* p */)
|
|
23614
23796
|
) {
|
|
23615
23797
|
state.lastIntValue = -1;
|
|
23616
23798
|
state.advance();
|
|
23799
|
+
var result;
|
|
23617
23800
|
if (
|
|
23618
23801
|
state.eat(0x7B /* { */) &&
|
|
23619
|
-
this.regexp_eatUnicodePropertyValueExpression(state) &&
|
|
23802
|
+
(result = this.regexp_eatUnicodePropertyValueExpression(state)) &&
|
|
23620
23803
|
state.eat(0x7D /* } */)
|
|
23621
23804
|
) {
|
|
23622
|
-
|
|
23805
|
+
if (negate && result === CharSetString) { state.raise("Invalid property name"); }
|
|
23806
|
+
return result
|
|
23623
23807
|
}
|
|
23624
23808
|
state.raise("Invalid property name");
|
|
23625
23809
|
}
|
|
23626
23810
|
|
|
23627
|
-
return
|
|
23811
|
+
return CharSetNone
|
|
23628
23812
|
};
|
|
23813
|
+
|
|
23629
23814
|
function isCharacterClassEscape(ch) {
|
|
23630
23815
|
return (
|
|
23631
23816
|
ch === 0x64 /* d */ ||
|
|
@@ -23649,7 +23834,7 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
23649
23834
|
if (this.regexp_eatUnicodePropertyValue(state)) {
|
|
23650
23835
|
var value = state.lastStringValue;
|
|
23651
23836
|
this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
|
|
23652
|
-
return
|
|
23837
|
+
return CharSetOk
|
|
23653
23838
|
}
|
|
23654
23839
|
}
|
|
23655
23840
|
state.pos = start;
|
|
@@ -23657,20 +23842,22 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
23657
23842
|
// LoneUnicodePropertyNameOrValue
|
|
23658
23843
|
if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
|
|
23659
23844
|
var nameOrValue = state.lastStringValue;
|
|
23660
|
-
this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)
|
|
23661
|
-
return true
|
|
23845
|
+
return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)
|
|
23662
23846
|
}
|
|
23663
|
-
return
|
|
23847
|
+
return CharSetNone
|
|
23664
23848
|
};
|
|
23849
|
+
|
|
23665
23850
|
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
|
23666
23851
|
if (!hasOwn(state.unicodeProperties.nonBinary, name))
|
|
23667
23852
|
{ state.raise("Invalid property name"); }
|
|
23668
23853
|
if (!state.unicodeProperties.nonBinary[name].test(value))
|
|
23669
23854
|
{ state.raise("Invalid property value"); }
|
|
23670
23855
|
};
|
|
23856
|
+
|
|
23671
23857
|
pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
|
23672
|
-
if (
|
|
23673
|
-
|
|
23858
|
+
if (state.unicodeProperties.binary.test(nameOrValue)) { return CharSetOk }
|
|
23859
|
+
if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) { return CharSetString }
|
|
23860
|
+
state.raise("Invalid property name");
|
|
23674
23861
|
};
|
|
23675
23862
|
|
|
23676
23863
|
// UnicodePropertyName ::
|
|
@@ -23684,6 +23871,7 @@ pp$1.regexp_eatUnicodePropertyName = function(state) {
|
|
|
23684
23871
|
}
|
|
23685
23872
|
return state.lastStringValue !== ""
|
|
23686
23873
|
};
|
|
23874
|
+
|
|
23687
23875
|
function isUnicodePropertyNameCharacter(ch) {
|
|
23688
23876
|
return isControlLetter(ch) || ch === 0x5F /* _ */
|
|
23689
23877
|
}
|
|
@@ -23712,21 +23900,29 @@ pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
|
|
|
23712
23900
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
|
|
23713
23901
|
pp$1.regexp_eatCharacterClass = function(state) {
|
|
23714
23902
|
if (state.eat(0x5B /* [ */)) {
|
|
23715
|
-
state.eat(0x5E /* ^ */);
|
|
23716
|
-
this.
|
|
23717
|
-
if (state.eat(0x5D /* ] */))
|
|
23718
|
-
|
|
23719
|
-
|
|
23720
|
-
|
|
23721
|
-
|
|
23903
|
+
var negate = state.eat(0x5E /* ^ */);
|
|
23904
|
+
var result = this.regexp_classContents(state);
|
|
23905
|
+
if (!state.eat(0x5D /* ] */))
|
|
23906
|
+
{ state.raise("Unterminated character class"); }
|
|
23907
|
+
if (negate && result === CharSetString)
|
|
23908
|
+
{ state.raise("Negated character class may contain strings"); }
|
|
23909
|
+
return true
|
|
23722
23910
|
}
|
|
23723
23911
|
return false
|
|
23724
23912
|
};
|
|
23725
23913
|
|
|
23914
|
+
// https://tc39.es/ecma262/#prod-ClassContents
|
|
23726
23915
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
|
|
23916
|
+
pp$1.regexp_classContents = function(state) {
|
|
23917
|
+
if (state.current() === 0x5D /* ] */) { return CharSetOk }
|
|
23918
|
+
if (state.switchV) { return this.regexp_classSetExpression(state) }
|
|
23919
|
+
this.regexp_nonEmptyClassRanges(state);
|
|
23920
|
+
return CharSetOk
|
|
23921
|
+
};
|
|
23922
|
+
|
|
23727
23923
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
|
|
23728
23924
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
|
|
23729
|
-
pp$1.
|
|
23925
|
+
pp$1.regexp_nonEmptyClassRanges = function(state) {
|
|
23730
23926
|
while (this.regexp_eatClassAtom(state)) {
|
|
23731
23927
|
var left = state.lastIntValue;
|
|
23732
23928
|
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
|
|
@@ -23798,6 +23994,205 @@ pp$1.regexp_eatClassEscape = function(state) {
|
|
|
23798
23994
|
)
|
|
23799
23995
|
};
|
|
23800
23996
|
|
|
23997
|
+
// https://tc39.es/ecma262/#prod-ClassSetExpression
|
|
23998
|
+
// https://tc39.es/ecma262/#prod-ClassUnion
|
|
23999
|
+
// https://tc39.es/ecma262/#prod-ClassIntersection
|
|
24000
|
+
// https://tc39.es/ecma262/#prod-ClassSubtraction
|
|
24001
|
+
pp$1.regexp_classSetExpression = function(state) {
|
|
24002
|
+
var result = CharSetOk, subResult;
|
|
24003
|
+
if (this.regexp_eatClassSetRange(state)) ; else if (subResult = this.regexp_eatClassSetOperand(state)) {
|
|
24004
|
+
if (subResult === CharSetString) { result = CharSetString; }
|
|
24005
|
+
// https://tc39.es/ecma262/#prod-ClassIntersection
|
|
24006
|
+
var start = state.pos;
|
|
24007
|
+
while (state.eatChars([0x26, 0x26] /* && */)) {
|
|
24008
|
+
if (
|
|
24009
|
+
state.current() !== 0x26 /* & */ &&
|
|
24010
|
+
(subResult = this.regexp_eatClassSetOperand(state))
|
|
24011
|
+
) {
|
|
24012
|
+
if (subResult !== CharSetString) { result = CharSetOk; }
|
|
24013
|
+
continue
|
|
24014
|
+
}
|
|
24015
|
+
state.raise("Invalid character in character class");
|
|
24016
|
+
}
|
|
24017
|
+
if (start !== state.pos) { return result }
|
|
24018
|
+
// https://tc39.es/ecma262/#prod-ClassSubtraction
|
|
24019
|
+
while (state.eatChars([0x2D, 0x2D] /* -- */)) {
|
|
24020
|
+
if (this.regexp_eatClassSetOperand(state)) { continue }
|
|
24021
|
+
state.raise("Invalid character in character class");
|
|
24022
|
+
}
|
|
24023
|
+
if (start !== state.pos) { return result }
|
|
24024
|
+
} else {
|
|
24025
|
+
state.raise("Invalid character in character class");
|
|
24026
|
+
}
|
|
24027
|
+
// https://tc39.es/ecma262/#prod-ClassUnion
|
|
24028
|
+
for (;;) {
|
|
24029
|
+
if (this.regexp_eatClassSetRange(state)) { continue }
|
|
24030
|
+
subResult = this.regexp_eatClassSetOperand(state);
|
|
24031
|
+
if (!subResult) { return result }
|
|
24032
|
+
if (subResult === CharSetString) { result = CharSetString; }
|
|
24033
|
+
}
|
|
24034
|
+
};
|
|
24035
|
+
|
|
24036
|
+
// https://tc39.es/ecma262/#prod-ClassSetRange
|
|
24037
|
+
pp$1.regexp_eatClassSetRange = function(state) {
|
|
24038
|
+
var start = state.pos;
|
|
24039
|
+
if (this.regexp_eatClassSetCharacter(state)) {
|
|
24040
|
+
var left = state.lastIntValue;
|
|
24041
|
+
if (state.eat(0x2D /* - */) && this.regexp_eatClassSetCharacter(state)) {
|
|
24042
|
+
var right = state.lastIntValue;
|
|
24043
|
+
if (left !== -1 && right !== -1 && left > right) {
|
|
24044
|
+
state.raise("Range out of order in character class");
|
|
24045
|
+
}
|
|
24046
|
+
return true
|
|
24047
|
+
}
|
|
24048
|
+
state.pos = start;
|
|
24049
|
+
}
|
|
24050
|
+
return false
|
|
24051
|
+
};
|
|
24052
|
+
|
|
24053
|
+
// https://tc39.es/ecma262/#prod-ClassSetOperand
|
|
24054
|
+
pp$1.regexp_eatClassSetOperand = function(state) {
|
|
24055
|
+
if (this.regexp_eatClassSetCharacter(state)) { return CharSetOk }
|
|
24056
|
+
return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state)
|
|
24057
|
+
};
|
|
24058
|
+
|
|
24059
|
+
// https://tc39.es/ecma262/#prod-NestedClass
|
|
24060
|
+
pp$1.regexp_eatNestedClass = function(state) {
|
|
24061
|
+
var start = state.pos;
|
|
24062
|
+
if (state.eat(0x5B /* [ */)) {
|
|
24063
|
+
var negate = state.eat(0x5E /* ^ */);
|
|
24064
|
+
var result = this.regexp_classContents(state);
|
|
24065
|
+
if (state.eat(0x5D /* ] */)) {
|
|
24066
|
+
if (negate && result === CharSetString) {
|
|
24067
|
+
state.raise("Negated character class may contain strings");
|
|
24068
|
+
}
|
|
24069
|
+
return result
|
|
24070
|
+
}
|
|
24071
|
+
state.pos = start;
|
|
24072
|
+
}
|
|
24073
|
+
if (state.eat(0x5C /* \ */)) {
|
|
24074
|
+
var result$1 = this.regexp_eatCharacterClassEscape(state);
|
|
24075
|
+
if (result$1) {
|
|
24076
|
+
return result$1
|
|
24077
|
+
}
|
|
24078
|
+
state.pos = start;
|
|
24079
|
+
}
|
|
24080
|
+
return null
|
|
24081
|
+
};
|
|
24082
|
+
|
|
24083
|
+
// https://tc39.es/ecma262/#prod-ClassStringDisjunction
|
|
24084
|
+
pp$1.regexp_eatClassStringDisjunction = function(state) {
|
|
24085
|
+
var start = state.pos;
|
|
24086
|
+
if (state.eatChars([0x5C, 0x71] /* \q */)) {
|
|
24087
|
+
if (state.eat(0x7B /* { */)) {
|
|
24088
|
+
var result = this.regexp_classStringDisjunctionContents(state);
|
|
24089
|
+
if (state.eat(0x7D /* } */)) {
|
|
24090
|
+
return result
|
|
24091
|
+
}
|
|
24092
|
+
} else {
|
|
24093
|
+
// Make the same message as V8.
|
|
24094
|
+
state.raise("Invalid escape");
|
|
24095
|
+
}
|
|
24096
|
+
state.pos = start;
|
|
24097
|
+
}
|
|
24098
|
+
return null
|
|
24099
|
+
};
|
|
24100
|
+
|
|
24101
|
+
// https://tc39.es/ecma262/#prod-ClassStringDisjunctionContents
|
|
24102
|
+
pp$1.regexp_classStringDisjunctionContents = function(state) {
|
|
24103
|
+
var result = this.regexp_classString(state);
|
|
24104
|
+
while (state.eat(0x7C /* | */)) {
|
|
24105
|
+
if (this.regexp_classString(state) === CharSetString) { result = CharSetString; }
|
|
24106
|
+
}
|
|
24107
|
+
return result
|
|
24108
|
+
};
|
|
24109
|
+
|
|
24110
|
+
// https://tc39.es/ecma262/#prod-ClassString
|
|
24111
|
+
// https://tc39.es/ecma262/#prod-NonEmptyClassString
|
|
24112
|
+
pp$1.regexp_classString = function(state) {
|
|
24113
|
+
var count = 0;
|
|
24114
|
+
while (this.regexp_eatClassSetCharacter(state)) { count++; }
|
|
24115
|
+
return count === 1 ? CharSetOk : CharSetString
|
|
24116
|
+
};
|
|
24117
|
+
|
|
24118
|
+
// https://tc39.es/ecma262/#prod-ClassSetCharacter
|
|
24119
|
+
pp$1.regexp_eatClassSetCharacter = function(state) {
|
|
24120
|
+
var start = state.pos;
|
|
24121
|
+
if (state.eat(0x5C /* \ */)) {
|
|
24122
|
+
if (
|
|
24123
|
+
this.regexp_eatCharacterEscape(state) ||
|
|
24124
|
+
this.regexp_eatClassSetReservedPunctuator(state)
|
|
24125
|
+
) {
|
|
24126
|
+
return true
|
|
24127
|
+
}
|
|
24128
|
+
if (state.eat(0x62 /* b */)) {
|
|
24129
|
+
state.lastIntValue = 0x08; /* <BS> */
|
|
24130
|
+
return true
|
|
24131
|
+
}
|
|
24132
|
+
state.pos = start;
|
|
24133
|
+
return false
|
|
24134
|
+
}
|
|
24135
|
+
var ch = state.current();
|
|
24136
|
+
if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) { return false }
|
|
24137
|
+
if (isClassSetSyntaxCharacter(ch)) { return false }
|
|
24138
|
+
state.advance();
|
|
24139
|
+
state.lastIntValue = ch;
|
|
24140
|
+
return true
|
|
24141
|
+
};
|
|
24142
|
+
|
|
24143
|
+
// https://tc39.es/ecma262/#prod-ClassSetReservedDoublePunctuator
|
|
24144
|
+
function isClassSetReservedDoublePunctuatorCharacter(ch) {
|
|
24145
|
+
return (
|
|
24146
|
+
ch === 0x21 /* ! */ ||
|
|
24147
|
+
ch >= 0x23 /* # */ && ch <= 0x26 /* & */ ||
|
|
24148
|
+
ch >= 0x2A /* * */ && ch <= 0x2C /* , */ ||
|
|
24149
|
+
ch === 0x2E /* . */ ||
|
|
24150
|
+
ch >= 0x3A /* : */ && ch <= 0x40 /* @ */ ||
|
|
24151
|
+
ch === 0x5E /* ^ */ ||
|
|
24152
|
+
ch === 0x60 /* ` */ ||
|
|
24153
|
+
ch === 0x7E /* ~ */
|
|
24154
|
+
)
|
|
24155
|
+
}
|
|
24156
|
+
|
|
24157
|
+
// https://tc39.es/ecma262/#prod-ClassSetSyntaxCharacter
|
|
24158
|
+
function isClassSetSyntaxCharacter(ch) {
|
|
24159
|
+
return (
|
|
24160
|
+
ch === 0x28 /* ( */ ||
|
|
24161
|
+
ch === 0x29 /* ) */ ||
|
|
24162
|
+
ch === 0x2D /* - */ ||
|
|
24163
|
+
ch === 0x2F /* / */ ||
|
|
24164
|
+
ch >= 0x5B /* [ */ && ch <= 0x5D /* ] */ ||
|
|
24165
|
+
ch >= 0x7B /* { */ && ch <= 0x7D /* } */
|
|
24166
|
+
)
|
|
24167
|
+
}
|
|
24168
|
+
|
|
24169
|
+
// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
|
|
24170
|
+
pp$1.regexp_eatClassSetReservedPunctuator = function(state) {
|
|
24171
|
+
var ch = state.current();
|
|
24172
|
+
if (isClassSetReservedPunctuator(ch)) {
|
|
24173
|
+
state.lastIntValue = ch;
|
|
24174
|
+
state.advance();
|
|
24175
|
+
return true
|
|
24176
|
+
}
|
|
24177
|
+
return false
|
|
24178
|
+
};
|
|
24179
|
+
|
|
24180
|
+
// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
|
|
24181
|
+
function isClassSetReservedPunctuator(ch) {
|
|
24182
|
+
return (
|
|
24183
|
+
ch === 0x21 /* ! */ ||
|
|
24184
|
+
ch === 0x23 /* # */ ||
|
|
24185
|
+
ch === 0x25 /* % */ ||
|
|
24186
|
+
ch === 0x26 /* & */ ||
|
|
24187
|
+
ch === 0x2C /* , */ ||
|
|
24188
|
+
ch === 0x2D /* - */ ||
|
|
24189
|
+
ch >= 0x3A /* : */ && ch <= 0x3E /* > */ ||
|
|
24190
|
+
ch === 0x40 /* @ */ ||
|
|
24191
|
+
ch === 0x60 /* ` */ ||
|
|
24192
|
+
ch === 0x7E /* ~ */
|
|
24193
|
+
)
|
|
24194
|
+
}
|
|
24195
|
+
|
|
23801
24196
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
|
|
23802
24197
|
pp$1.regexp_eatClassControlLetter = function(state) {
|
|
23803
24198
|
var ch = state.current();
|
|
@@ -24718,8 +25113,23 @@ pp.readWord = function() {
|
|
|
24718
25113
|
};
|
|
24719
25114
|
|
|
24720
25115
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
25116
|
+
//
|
|
25117
|
+
// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
|
|
25118
|
+
// various contributors and released under an MIT license.
|
|
25119
|
+
//
|
|
25120
|
+
// Git repositories for Acorn are available at
|
|
25121
|
+
//
|
|
25122
|
+
// http://marijnhaverbeke.nl/git/acorn
|
|
25123
|
+
// https://github.com/acornjs/acorn.git
|
|
25124
|
+
//
|
|
25125
|
+
// Please use the [github bug tracker][ghbt] to report issues.
|
|
25126
|
+
//
|
|
25127
|
+
// [ghbt]: https://github.com/acornjs/acorn/issues
|
|
25128
|
+
//
|
|
25129
|
+
// [walk]: util/walk.js
|
|
25130
|
+
|
|
24721
25131
|
|
|
24722
|
-
var version = "8.
|
|
25132
|
+
var version = "8.9.0";
|
|
24723
25133
|
|
|
24724
25134
|
Parser.acorn = {
|
|
24725
25135
|
Parser: Parser,
|
|
@@ -24919,7 +25329,7 @@ async function transform(source, module, pluginDriver, log) {
|
|
|
24919
25329
|
let customTransformCache = false;
|
|
24920
25330
|
const useCustomTransformCache = () => (customTransformCache = true);
|
|
24921
25331
|
let pluginName = '';
|
|
24922
|
-
|
|
25332
|
+
let currentSource = source.code;
|
|
24923
25333
|
function transformReducer(previousCode, result, plugin) {
|
|
24924
25334
|
let code;
|
|
24925
25335
|
let map;
|
|
@@ -24947,6 +25357,7 @@ async function transform(source, module, pluginDriver, log) {
|
|
|
24947
25357
|
plugin: plugin.name
|
|
24948
25358
|
});
|
|
24949
25359
|
}
|
|
25360
|
+
currentSource = code;
|
|
24950
25361
|
return code;
|
|
24951
25362
|
}
|
|
24952
25363
|
const getLogHandler = (handler) => (log, pos) => {
|