rollup 3.25.1 → 3.25.3

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.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.25.1
4
- Mon, 12 Jun 2023 04:38:12 GMT - commit b1341bf9cd719670a670905e0308418b37621d70
3
+ Rollup.js v3.25.3
4
+ Mon, 26 Jun 2023 20:07:14 GMT - commit 83d21a4eacbc9f207bb084df78365a456cdb1973
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.1";
33
+ var version$1 = "3.25.3";
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
- function getLocator$1(source, options) {
83
- if (options === void 0) { options = {}; }
84
- var offsetLine = options.offsetLine || 0;
85
- var offsetColumn = options.offsetColumn || 0;
86
- var originalLines = source.split('\n');
87
- var start = 0;
88
- var lineRanges = originalLines.map(function (line, i) {
89
- var end = start + line.length + 1;
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
- if (typeof options === 'number') {
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
- if (error.code && !error.code.startsWith('PLUGIN_') && !error.pluginCode) {
796
- error.pluginCode = error.code;
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;
@@ -15069,7 +15104,7 @@ class Module {
15069
15104
  this.implicitlyLoadedAfter.size > 0) {
15070
15105
  for (const exportName of [...this.getReexports(), ...this.getExports()]) {
15071
15106
  const [exportedVariable] = this.getVariableForExportName(exportName);
15072
- if (exportedVariable) {
15107
+ if (exportedVariable?.included) {
15073
15108
  dependencyVariables.add(exportedVariable);
15074
15109
  }
15075
15110
  }
@@ -17818,7 +17853,9 @@ class Chunk {
17818
17853
  if (!this.outputOptions.preserveModules && this.includedNamespaces.has(module)) {
17819
17854
  const memberVariables = module.namespace.getMemberVariables();
17820
17855
  for (const variable of Object.values(memberVariables)) {
17821
- moduleImports.add(variable);
17856
+ if (variable.included) {
17857
+ moduleImports.add(variable);
17858
+ }
17822
17859
  }
17823
17860
  }
17824
17861
  for (let variable of moduleImports) {
@@ -19204,6 +19241,9 @@ var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\
19204
19241
  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
19242
 
19206
19243
  // These are a run-length and offset encoded representation of the
19244
+ // >0xffff code points that are a valid part of identifiers. The
19245
+ // offset starts at 0x10000, and each pair of numbers represents an
19246
+ // offset to the next range, and then a size of the range.
19207
19247
 
19208
19248
  // Reserved word lists for various dialects of the language
19209
19249
 
@@ -20322,6 +20362,16 @@ pp$8.parseThrowStatement = function(node) {
20322
20362
 
20323
20363
  var empty$1 = [];
20324
20364
 
20365
+ pp$8.parseCatchClauseParam = function() {
20366
+ var param = this.parseBindingAtom();
20367
+ var simple = param.type === "Identifier";
20368
+ this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
20369
+ this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
20370
+ this.expect(types$1.parenR);
20371
+
20372
+ return param
20373
+ };
20374
+
20325
20375
  pp$8.parseTryStatement = function(node) {
20326
20376
  this.next();
20327
20377
  node.block = this.parseBlock();
@@ -20330,11 +20380,7 @@ pp$8.parseTryStatement = function(node) {
20330
20380
  var clause = this.startNode();
20331
20381
  this.next();
20332
20382
  if (this.eat(types$1.parenL)) {
20333
- clause.param = this.parseBindingAtom();
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);
20383
+ clause.param = this.parseCatchClauseParam();
20338
20384
  } else {
20339
20385
  if (this.options.ecmaVersion < 10) { this.unexpected(); }
20340
20386
  clause.param = null;
@@ -20350,9 +20396,9 @@ pp$8.parseTryStatement = function(node) {
20350
20396
  return this.finishNode(node, "TryStatement")
20351
20397
  };
20352
20398
 
20353
- pp$8.parseVarStatement = function(node, kind) {
20399
+ pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {
20354
20400
  this.next();
20355
- this.parseVar(node, false, kind);
20401
+ this.parseVar(node, false, kind, allowMissingInitializer);
20356
20402
  this.semicolon();
20357
20403
  return this.finishNode(node, "VariableDeclaration")
20358
20404
  };
@@ -20481,7 +20527,7 @@ pp$8.parseForIn = function(node, init) {
20481
20527
 
20482
20528
  // Parse a list of variable declarations.
20483
20529
 
20484
- pp$8.parseVar = function(node, isFor, kind) {
20530
+ pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
20485
20531
  node.declarations = [];
20486
20532
  node.kind = kind;
20487
20533
  for (;;) {
@@ -20489,9 +20535,9 @@ pp$8.parseVar = function(node, isFor, kind) {
20489
20535
  this.parseVarId(decl, kind);
20490
20536
  if (this.eat(types$1.eq)) {
20491
20537
  decl.init = this.parseMaybeAssign(isFor);
20492
- } else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
20538
+ } else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
20493
20539
  this.unexpected();
20494
- } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
20540
+ } else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
20495
20541
  this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
20496
20542
  } else {
20497
20543
  decl.init = null;
@@ -20580,7 +20626,7 @@ pp$8.parseClass = function(node, isStatement) {
20580
20626
  if (element) {
20581
20627
  classBody.body.push(element);
20582
20628
  if (element.type === "MethodDefinition" && element.kind === "constructor") {
20583
- if (hadConstructor) { this.raise(element.start, "Duplicate constructor in the same class"); }
20629
+ if (hadConstructor) { this.raiseRecoverable(element.start, "Duplicate constructor in the same class"); }
20584
20630
  hadConstructor = true;
20585
20631
  } else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
20586
20632
  this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared"));
@@ -20829,44 +20875,36 @@ function checkKeyName(node, name) {
20829
20875
 
20830
20876
  // Parses module export declaration.
20831
20877
 
20878
+ pp$8.parseExportAllDeclaration = function(node, exports) {
20879
+ if (this.options.ecmaVersion >= 11) {
20880
+ if (this.eatContextual("as")) {
20881
+ node.exported = this.parseModuleExportName();
20882
+ this.checkExport(exports, node.exported, this.lastTokStart);
20883
+ } else {
20884
+ node.exported = null;
20885
+ }
20886
+ }
20887
+ this.expectContextual("from");
20888
+ if (this.type !== types$1.string) { this.unexpected(); }
20889
+ node.source = this.parseExprAtom();
20890
+ this.semicolon();
20891
+ return this.finishNode(node, "ExportAllDeclaration")
20892
+ };
20893
+
20832
20894
  pp$8.parseExport = function(node, exports) {
20833
20895
  this.next();
20834
20896
  // export * from '...'
20835
20897
  if (this.eat(types$1.star)) {
20836
- if (this.options.ecmaVersion >= 11) {
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")
20898
+ return this.parseExportAllDeclaration(node, exports)
20849
20899
  }
20850
20900
  if (this.eat(types$1._default)) { // export default ...
20851
20901
  this.checkExport(exports, "default", this.lastTokStart);
20852
- var isAsync;
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
- }
20902
+ node.declaration = this.parseExportDefaultDeclaration();
20865
20903
  return this.finishNode(node, "ExportDefaultDeclaration")
20866
20904
  }
20867
20905
  // export var|const|let|function|class ...
20868
20906
  if (this.shouldParseExportStatement()) {
20869
- node.declaration = this.parseStatement(null);
20907
+ node.declaration = this.parseExportDeclaration(node);
20870
20908
  if (node.declaration.type === "VariableDeclaration")
20871
20909
  { this.checkVariableExport(exports, node.declaration.declarations); }
20872
20910
  else
@@ -20900,6 +20938,27 @@ pp$8.parseExport = function(node, exports) {
20900
20938
  return this.finishNode(node, "ExportNamedDeclaration")
20901
20939
  };
20902
20940
 
20941
+ pp$8.parseExportDeclaration = function(node) {
20942
+ return this.parseStatement(null)
20943
+ };
20944
+
20945
+ pp$8.parseExportDefaultDeclaration = function() {
20946
+ var isAsync;
20947
+ if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
20948
+ var fNode = this.startNode();
20949
+ this.next();
20950
+ if (isAsync) { this.next(); }
20951
+ return this.parseFunction(fNode, FUNC_STATEMENT$1 | FUNC_NULLABLE_ID$1, false, isAsync)
20952
+ } else if (this.type === types$1._class) {
20953
+ var cNode = this.startNode();
20954
+ return this.parseClass(cNode, "nullableID")
20955
+ } else {
20956
+ var declaration = this.parseMaybeAssign();
20957
+ this.semicolon();
20958
+ return declaration
20959
+ }
20960
+ };
20961
+
20903
20962
  pp$8.checkExport = function(exports, name, pos) {
20904
20963
  if (!exports) { return }
20905
20964
  if (typeof name !== "string")
@@ -20957,6 +21016,20 @@ pp$8.shouldParseExportStatement = function() {
20957
21016
 
20958
21017
  // Parses a comma-separated list of module exports.
20959
21018
 
21019
+ pp$8.parseExportSpecifier = function(exports) {
21020
+ var node = this.startNode();
21021
+ node.local = this.parseModuleExportName();
21022
+
21023
+ node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
21024
+ this.checkExport(
21025
+ exports,
21026
+ node.exported,
21027
+ node.exported.start
21028
+ );
21029
+
21030
+ return this.finishNode(node, "ExportSpecifier")
21031
+ };
21032
+
20960
21033
  pp$8.parseExportSpecifiers = function(exports) {
20961
21034
  var nodes = [], first = true;
20962
21035
  // export { x, y as z } [from '...']
@@ -20967,15 +21040,7 @@ pp$8.parseExportSpecifiers = function(exports) {
20967
21040
  if (this.afterTrailingComma(types$1.braceR)) { break }
20968
21041
  } else { first = false; }
20969
21042
 
20970
- var node = this.startNode();
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"));
21043
+ nodes.push(this.parseExportSpecifier(exports));
20979
21044
  }
20980
21045
  return nodes
20981
21046
  };
@@ -20984,6 +21049,7 @@ pp$8.parseExportSpecifiers = function(exports) {
20984
21049
 
20985
21050
  pp$8.parseImport = function(node) {
20986
21051
  this.next();
21052
+
20987
21053
  // import '...'
20988
21054
  if (this.type === types$1.string) {
20989
21055
  node.specifiers = empty$1;
@@ -20999,23 +21065,46 @@ pp$8.parseImport = function(node) {
20999
21065
 
21000
21066
  // Parses a comma-separated list of module imports.
21001
21067
 
21068
+ pp$8.parseImportSpecifier = function() {
21069
+ var node = this.startNode();
21070
+ node.imported = this.parseModuleExportName();
21071
+
21072
+ if (this.eatContextual("as")) {
21073
+ node.local = this.parseIdent();
21074
+ } else {
21075
+ this.checkUnreserved(node.imported);
21076
+ node.local = node.imported;
21077
+ }
21078
+ this.checkLValSimple(node.local, BIND_LEXICAL);
21079
+
21080
+ return this.finishNode(node, "ImportSpecifier")
21081
+ };
21082
+
21083
+ pp$8.parseImportDefaultSpecifier = function() {
21084
+ // import defaultObj, { x, y as z } from '...'
21085
+ var node = this.startNode();
21086
+ node.local = this.parseIdent();
21087
+ this.checkLValSimple(node.local, BIND_LEXICAL);
21088
+ return this.finishNode(node, "ImportDefaultSpecifier")
21089
+ };
21090
+
21091
+ pp$8.parseImportNamespaceSpecifier = function() {
21092
+ var node = this.startNode();
21093
+ this.next();
21094
+ this.expectContextual("as");
21095
+ node.local = this.parseIdent();
21096
+ this.checkLValSimple(node.local, BIND_LEXICAL);
21097
+ return this.finishNode(node, "ImportNamespaceSpecifier")
21098
+ };
21099
+
21002
21100
  pp$8.parseImportSpecifiers = function() {
21003
21101
  var nodes = [], first = true;
21004
21102
  if (this.type === types$1.name) {
21005
- // import defaultObj, { x, y as z } from '...'
21006
- var node = this.startNode();
21007
- node.local = this.parseIdent();
21008
- this.checkLValSimple(node.local, BIND_LEXICAL);
21009
- nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
21103
+ nodes.push(this.parseImportDefaultSpecifier());
21010
21104
  if (!this.eat(types$1.comma)) { return nodes }
21011
21105
  }
21012
21106
  if (this.type === types$1.star) {
21013
- var node$1 = this.startNode();
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"));
21107
+ nodes.push(this.parseImportNamespaceSpecifier());
21019
21108
  return nodes
21020
21109
  }
21021
21110
  this.expect(types$1.braceL);
@@ -21025,16 +21114,7 @@ pp$8.parseImportSpecifiers = function() {
21025
21114
  if (this.afterTrailingComma(types$1.braceR)) { break }
21026
21115
  } else { first = false; }
21027
21116
 
21028
- var node$2 = this.startNode();
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"));
21117
+ nodes.push(this.parseImportSpecifier());
21038
21118
  }
21039
21119
  return nodes
21040
21120
  };
@@ -21207,7 +21287,7 @@ pp$7.parseBindingAtom = function() {
21207
21287
  return this.parseIdent()
21208
21288
  };
21209
21289
 
21210
- pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
21290
+ pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) {
21211
21291
  var elts = [], first = true;
21212
21292
  while (!this.eat(close)) {
21213
21293
  if (first) { first = false; }
@@ -21220,18 +21300,22 @@ pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
21220
21300
  var rest = this.parseRestBinding();
21221
21301
  this.parseBindingListItem(rest);
21222
21302
  elts.push(rest);
21223
- if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
21303
+ if (this.type === types$1.comma) { this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); }
21224
21304
  this.expect(close);
21225
21305
  break
21226
21306
  } else {
21227
- var elem = this.parseMaybeDefault(this.start, this.startLoc);
21228
- this.parseBindingListItem(elem);
21229
- elts.push(elem);
21307
+ elts.push(this.parseAssignableListItem(allowModifiers));
21230
21308
  }
21231
21309
  }
21232
21310
  return elts
21233
21311
  };
21234
21312
 
21313
+ pp$7.parseAssignableListItem = function(allowModifiers) {
21314
+ var elem = this.parseMaybeDefault(this.start, this.startLoc);
21315
+ this.parseBindingListItem(elem);
21316
+ return elem
21317
+ };
21318
+
21235
21319
  pp$7.parseBindingListItem = function(param) {
21236
21320
  return param
21237
21321
  };
@@ -21397,6 +21481,9 @@ pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
21397
21481
  };
21398
21482
 
21399
21483
  // The algorithm used to determine whether a regexp can appear at a
21484
+ // given point in the program is loosely based on sweet.js' approach.
21485
+ // See https://github.com/mozilla/sweet.js/wiki/design
21486
+
21400
21487
 
21401
21488
  var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
21402
21489
  this.token = token;
@@ -21552,6 +21639,23 @@ types$1.name.updateContext = function(prevType) {
21552
21639
  };
21553
21640
 
21554
21641
  // A recursive descent parser operates by defining functions for all
21642
+ // syntactic elements, and recursively calling those, each function
21643
+ // advancing the input stream and returning an AST node. Precedence
21644
+ // of constructs (for example, the fact that `!x[1]` means `!(x[1])`
21645
+ // instead of `(!x)[1]` is handled by the fact that the parser
21646
+ // function that parses unary prefix operators is called first, and
21647
+ // in turn calls the function that parses `[]` subscripts — that
21648
+ // way, it'll receive the node for `x[1]` already parsed, and wraps
21649
+ // *that* in the unary operator node.
21650
+ //
21651
+ // Acorn uses an [operator precedence parser][opp] to handle binary
21652
+ // operator precedence, because it is much more compact than using
21653
+ // the technique outlined above, which uses different, nesting
21654
+ // functions to specify precedence, for all of the ten binary
21655
+ // precedence levels that JavaScript defines.
21656
+ //
21657
+ // [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
21658
+
21555
21659
 
21556
21660
  var pp$5 = Parser.prototype;
21557
21661
 
@@ -21855,6 +21959,14 @@ pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
21855
21959
  }
21856
21960
  };
21857
21961
 
21962
+ pp$5.shouldParseAsyncArrow = function() {
21963
+ return !this.canInsertSemicolon() && this.eat(types$1.arrow)
21964
+ };
21965
+
21966
+ pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) {
21967
+ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)
21968
+ };
21969
+
21858
21970
  pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
21859
21971
  var optionalSupported = this.options.ecmaVersion >= 11;
21860
21972
  var optional = optionalSupported && this.eat(types$1.questionDot);
@@ -21883,7 +21995,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
21883
21995
  this.awaitPos = 0;
21884
21996
  this.awaitIdentPos = 0;
21885
21997
  var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
21886
- if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
21998
+ if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {
21887
21999
  this.checkPatternErrors(refDestructuringErrors, false);
21888
22000
  this.checkYieldAwaitInDefaultParams();
21889
22001
  if (this.awaitIdentPos > 0)
@@ -21891,7 +22003,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
21891
22003
  this.yieldPos = oldYieldPos;
21892
22004
  this.awaitPos = oldAwaitPos;
21893
22005
  this.awaitIdentPos = oldAwaitIdentPos;
21894
- return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)
22006
+ return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit)
21895
22007
  }
21896
22008
  this.checkExpressionErrors(refDestructuringErrors, true);
21897
22009
  this.yieldPos = oldYieldPos || this.yieldPos;
@@ -21921,7 +22033,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
21921
22033
  // `new`, or an expression wrapped in punctuation like `()`, `[]`,
21922
22034
  // or `{}`.
21923
22035
 
21924
- pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
22036
+ pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
21925
22037
  // If a division operator appears in an expression position, the
21926
22038
  // tokenizer got confused, and we force it to read a regexp instead.
21927
22039
  if (this.type === types$1.slash) { this.readRegexp(); }
@@ -22022,17 +22134,21 @@ pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
22022
22134
 
22023
22135
  case types$1._import:
22024
22136
  if (this.options.ecmaVersion >= 11) {
22025
- return this.parseExprImport()
22137
+ return this.parseExprImport(forNew)
22026
22138
  } else {
22027
22139
  return this.unexpected()
22028
22140
  }
22029
22141
 
22030
22142
  default:
22031
- this.unexpected();
22143
+ return this.parseExprAtomDefault()
22032
22144
  }
22033
22145
  };
22034
22146
 
22035
- pp$5.parseExprImport = function() {
22147
+ pp$5.parseExprAtomDefault = function() {
22148
+ this.unexpected();
22149
+ };
22150
+
22151
+ pp$5.parseExprImport = function(forNew) {
22036
22152
  var node = this.startNode();
22037
22153
 
22038
22154
  // Consume `import` as an identifier for `import.meta`.
@@ -22040,13 +22156,12 @@ pp$5.parseExprImport = function() {
22040
22156
  if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
22041
22157
  var meta = this.parseIdent(true);
22042
22158
 
22043
- switch (this.type) {
22044
- case types$1.parenL:
22159
+ if (this.type === types$1.parenL && !forNew) {
22045
22160
  return this.parseDynamicImport(node)
22046
- case types$1.dot:
22161
+ } else if (this.type === types$1.dot) {
22047
22162
  node.meta = meta;
22048
22163
  return this.parseImportMeta(node)
22049
- default:
22164
+ } else {
22050
22165
  this.unexpected();
22051
22166
  }
22052
22167
  };
@@ -22102,6 +22217,10 @@ pp$5.parseParenExpression = function() {
22102
22217
  return val
22103
22218
  };
22104
22219
 
22220
+ pp$5.shouldParseArrow = function(exprList) {
22221
+ return !this.canInsertSemicolon()
22222
+ };
22223
+
22105
22224
  pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
22106
22225
  var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
22107
22226
  if (this.options.ecmaVersion >= 6) {
@@ -22121,7 +22240,12 @@ pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
22121
22240
  } else if (this.type === types$1.ellipsis) {
22122
22241
  spreadStart = this.start;
22123
22242
  exprList.push(this.parseParenItem(this.parseRestBinding()));
22124
- if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
22243
+ if (this.type === types$1.comma) {
22244
+ this.raiseRecoverable(
22245
+ this.start,
22246
+ "Comma is not permitted after the rest element"
22247
+ );
22248
+ }
22125
22249
  break
22126
22250
  } else {
22127
22251
  exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
@@ -22130,7 +22254,7 @@ pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
22130
22254
  var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
22131
22255
  this.expect(types$1.parenR);
22132
22256
 
22133
- if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
22257
+ if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {
22134
22258
  this.checkPatternErrors(refDestructuringErrors, false);
22135
22259
  this.checkYieldAwaitInDefaultParams();
22136
22260
  this.yieldPos = oldYieldPos;
@@ -22196,11 +22320,8 @@ pp$5.parseNew = function() {
22196
22320
  { this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
22197
22321
  return this.finishNode(node, "MetaProperty")
22198
22322
  }
22199
- var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
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
- }
22323
+ var startPos = this.start, startLoc = this.startLoc;
22324
+ node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
22204
22325
  if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
22205
22326
  else { node.arguments = empty; }
22206
22327
  return this.finishNode(node, "NewExpression")
@@ -22282,7 +22403,7 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
22282
22403
  if (isPattern) {
22283
22404
  prop.argument = this.parseIdent(false);
22284
22405
  if (this.type === types$1.comma) {
22285
- this.raise(this.start, "Comma is not permitted after the rest element");
22406
+ this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
22286
22407
  }
22287
22408
  return this.finishNode(prop, "RestElement")
22288
22409
  }
@@ -22318,6 +22439,23 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
22318
22439
  return this.finishNode(prop, "Property")
22319
22440
  };
22320
22441
 
22442
+ pp$5.parseGetterSetter = function(prop) {
22443
+ prop.kind = prop.key.name;
22444
+ this.parsePropertyName(prop);
22445
+ prop.value = this.parseMethod(false);
22446
+ var paramCount = prop.kind === "get" ? 0 : 1;
22447
+ if (prop.value.params.length !== paramCount) {
22448
+ var start = prop.value.start;
22449
+ if (prop.kind === "get")
22450
+ { this.raiseRecoverable(start, "getter should have no params"); }
22451
+ else
22452
+ { this.raiseRecoverable(start, "setter should have exactly one param"); }
22453
+ } else {
22454
+ if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
22455
+ { this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
22456
+ }
22457
+ };
22458
+
22321
22459
  pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
22322
22460
  if ((isGenerator || isAsync) && this.type === types$1.colon)
22323
22461
  { this.unexpected(); }
@@ -22335,20 +22473,7 @@ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
22335
22473
  (prop.key.name === "get" || prop.key.name === "set") &&
22336
22474
  (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
22337
22475
  if (isGenerator || isAsync) { this.unexpected(); }
22338
- prop.kind = prop.key.name;
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
- }
22476
+ this.parseGetterSetter(prop);
22352
22477
  } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
22353
22478
  if (isGenerator || isAsync) { this.unexpected(); }
22354
22479
  this.checkUnreserved(prop.key);
@@ -22560,6 +22685,18 @@ pp$5.checkUnreserved = function(ref) {
22560
22685
  // identifiers.
22561
22686
 
22562
22687
  pp$5.parseIdent = function(liberal) {
22688
+ var node = this.parseIdentNode();
22689
+ this.next(!!liberal);
22690
+ this.finishNode(node, "Identifier");
22691
+ if (!liberal) {
22692
+ this.checkUnreserved(node);
22693
+ if (node.name === "await" && !this.awaitIdentPos)
22694
+ { this.awaitIdentPos = node.start; }
22695
+ }
22696
+ return node
22697
+ };
22698
+
22699
+ pp$5.parseIdentNode = function() {
22563
22700
  var node = this.startNode();
22564
22701
  if (this.type === types$1.name) {
22565
22702
  node.name = this.value;
@@ -22571,19 +22708,12 @@ pp$5.parseIdent = function(liberal) {
22571
22708
  // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
22572
22709
  // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
22573
22710
  if ((node.name === "class" || node.name === "function") &&
22574
- (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
22711
+ (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
22575
22712
  this.context.pop();
22576
22713
  }
22577
22714
  } else {
22578
22715
  this.unexpected();
22579
22716
  }
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
22717
  return node
22588
22718
  };
22589
22719
 
@@ -22823,6 +22953,18 @@ var unicodeBinaryProperties = {
22823
22953
  14: ecma14BinaryProperties
22824
22954
  };
22825
22955
 
22956
+ // #table-binary-unicode-properties-of-strings
22957
+ 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";
22958
+
22959
+ var unicodeBinaryPropertiesOfStrings = {
22960
+ 9: "",
22961
+ 10: "",
22962
+ 11: "",
22963
+ 12: "",
22964
+ 13: "",
22965
+ 14: ecma14BinaryPropertiesOfStrings
22966
+ };
22967
+
22826
22968
  // #table-unicode-general-category-values
22827
22969
  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
22970
 
@@ -22832,7 +22974,7 @@ var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Han
22832
22974
  var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
22833
22975
  var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
22834
22976
  var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
22835
- var ecma14ScriptValues = ecma13ScriptValues + " Kawi Nag_Mundari Nagm";
22977
+ var ecma14ScriptValues = ecma13ScriptValues + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz";
22836
22978
 
22837
22979
  var unicodeScriptValues = {
22838
22980
  9: ecma9ScriptValues,
@@ -22847,6 +22989,7 @@ var data = {};
22847
22989
  function buildUnicodeData(ecmaVersion) {
22848
22990
  var d = data[ecmaVersion] = {
22849
22991
  binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
22992
+ binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),
22850
22993
  nonBinary: {
22851
22994
  General_Category: wordsRegexp(unicodeGeneralCategoryValues),
22852
22995
  Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
@@ -22869,12 +23012,13 @@ var pp$1 = Parser.prototype;
22869
23012
 
22870
23013
  var RegExpValidationState = function RegExpValidationState(parser) {
22871
23014
  this.parser = parser;
22872
- this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "");
23015
+ this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
22873
23016
  this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];
22874
23017
  this.source = "";
22875
23018
  this.flags = "";
22876
23019
  this.start = 0;
22877
23020
  this.switchU = false;
23021
+ this.switchV = false;
22878
23022
  this.switchN = false;
22879
23023
  this.pos = 0;
22880
23024
  this.lastIntValue = 0;
@@ -22887,12 +23031,20 @@ var RegExpValidationState = function RegExpValidationState(parser) {
22887
23031
  };
22888
23032
 
22889
23033
  RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
23034
+ var unicodeSets = flags.indexOf("v") !== -1;
22890
23035
  var unicode = flags.indexOf("u") !== -1;
22891
23036
  this.start = start | 0;
22892
23037
  this.source = pattern + "";
22893
23038
  this.flags = flags;
22894
- this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
22895
- this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
23039
+ if (unicodeSets && this.parser.options.ecmaVersion >= 15) {
23040
+ this.switchU = true;
23041
+ this.switchV = true;
23042
+ this.switchN = true;
23043
+ } else {
23044
+ this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
23045
+ this.switchV = false;
23046
+ this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
23047
+ }
22896
23048
  };
22897
23049
 
22898
23050
  RegExpValidationState.prototype.raise = function raise (message) {
@@ -22961,6 +23113,23 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
22961
23113
  return false
22962
23114
  };
22963
23115
 
23116
+ RegExpValidationState.prototype.eatChars = function eatChars (chs, forceU) {
23117
+ if ( forceU === void 0 ) forceU = false;
23118
+
23119
+ var pos = this.pos;
23120
+ for (var i = 0, list = chs; i < list.length; i += 1) {
23121
+ var ch = list[i];
23122
+
23123
+ var current = this.at(pos, forceU);
23124
+ if (current === -1 || current !== ch) {
23125
+ return false
23126
+ }
23127
+ pos = this.nextIndex(pos, forceU);
23128
+ }
23129
+ this.pos = pos;
23130
+ return true
23131
+ };
23132
+
22964
23133
  /**
22965
23134
  * Validate the flags part of a given RegExpLiteral.
22966
23135
  *
@@ -22971,6 +23140,9 @@ pp$1.validateRegExpFlags = function(state) {
22971
23140
  var validFlags = state.validFlags;
22972
23141
  var flags = state.flags;
22973
23142
 
23143
+ var u = false;
23144
+ var v = false;
23145
+
22974
23146
  for (var i = 0; i < flags.length; i++) {
22975
23147
  var flag = flags.charAt(i);
22976
23148
  if (validFlags.indexOf(flag) === -1) {
@@ -22979,6 +23151,11 @@ pp$1.validateRegExpFlags = function(state) {
22979
23151
  if (flags.indexOf(flag, i + 1) > -1) {
22980
23152
  this.raise(state.start, "Duplicate regular expression flag");
22981
23153
  }
23154
+ if (flag === "u") { u = true; }
23155
+ if (flag === "v") { v = true; }
23156
+ }
23157
+ if (this.options.ecmaVersion >= 15 && u && v) {
23158
+ this.raise(state.start, "Invalid regular expression flag");
22982
23159
  }
22983
23160
  };
22984
23161
 
@@ -23597,6 +23774,12 @@ pp$1.regexp_eatDecimalEscape = function(state) {
23597
23774
  return false
23598
23775
  };
23599
23776
 
23777
+ // Return values used by character set parsing methods, needed to
23778
+ // forbid negation of sets that can match strings.
23779
+ var CharSetNone = 0; // Nothing parsed
23780
+ var CharSetOk = 1; // Construct parsed, cannot contain strings
23781
+ var CharSetString = 2; // Construct parsed, can contain strings
23782
+
23600
23783
  // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
23601
23784
  pp$1.regexp_eatCharacterClassEscape = function(state) {
23602
23785
  var ch = state.current();
@@ -23604,28 +23787,32 @@ pp$1.regexp_eatCharacterClassEscape = function(state) {
23604
23787
  if (isCharacterClassEscape(ch)) {
23605
23788
  state.lastIntValue = -1;
23606
23789
  state.advance();
23607
- return true
23790
+ return CharSetOk
23608
23791
  }
23609
23792
 
23793
+ var negate = false;
23610
23794
  if (
23611
23795
  state.switchU &&
23612
23796
  this.options.ecmaVersion >= 9 &&
23613
- (ch === 0x50 /* P */ || ch === 0x70 /* p */)
23797
+ ((negate = ch === 0x50 /* P */) || ch === 0x70 /* p */)
23614
23798
  ) {
23615
23799
  state.lastIntValue = -1;
23616
23800
  state.advance();
23801
+ var result;
23617
23802
  if (
23618
23803
  state.eat(0x7B /* { */) &&
23619
- this.regexp_eatUnicodePropertyValueExpression(state) &&
23804
+ (result = this.regexp_eatUnicodePropertyValueExpression(state)) &&
23620
23805
  state.eat(0x7D /* } */)
23621
23806
  ) {
23622
- return true
23807
+ if (negate && result === CharSetString) { state.raise("Invalid property name"); }
23808
+ return result
23623
23809
  }
23624
23810
  state.raise("Invalid property name");
23625
23811
  }
23626
23812
 
23627
- return false
23813
+ return CharSetNone
23628
23814
  };
23815
+
23629
23816
  function isCharacterClassEscape(ch) {
23630
23817
  return (
23631
23818
  ch === 0x64 /* d */ ||
@@ -23649,7 +23836,7 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
23649
23836
  if (this.regexp_eatUnicodePropertyValue(state)) {
23650
23837
  var value = state.lastStringValue;
23651
23838
  this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
23652
- return true
23839
+ return CharSetOk
23653
23840
  }
23654
23841
  }
23655
23842
  state.pos = start;
@@ -23657,20 +23844,22 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
23657
23844
  // LoneUnicodePropertyNameOrValue
23658
23845
  if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
23659
23846
  var nameOrValue = state.lastStringValue;
23660
- this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue);
23661
- return true
23847
+ return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)
23662
23848
  }
23663
- return false
23849
+ return CharSetNone
23664
23850
  };
23851
+
23665
23852
  pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
23666
23853
  if (!hasOwn(state.unicodeProperties.nonBinary, name))
23667
23854
  { state.raise("Invalid property name"); }
23668
23855
  if (!state.unicodeProperties.nonBinary[name].test(value))
23669
23856
  { state.raise("Invalid property value"); }
23670
23857
  };
23858
+
23671
23859
  pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
23672
- if (!state.unicodeProperties.binary.test(nameOrValue))
23673
- { state.raise("Invalid property name"); }
23860
+ if (state.unicodeProperties.binary.test(nameOrValue)) { return CharSetOk }
23861
+ if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) { return CharSetString }
23862
+ state.raise("Invalid property name");
23674
23863
  };
23675
23864
 
23676
23865
  // UnicodePropertyName ::
@@ -23684,6 +23873,7 @@ pp$1.regexp_eatUnicodePropertyName = function(state) {
23684
23873
  }
23685
23874
  return state.lastStringValue !== ""
23686
23875
  };
23876
+
23687
23877
  function isUnicodePropertyNameCharacter(ch) {
23688
23878
  return isControlLetter(ch) || ch === 0x5F /* _ */
23689
23879
  }
@@ -23712,21 +23902,29 @@ pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
23712
23902
  // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
23713
23903
  pp$1.regexp_eatCharacterClass = function(state) {
23714
23904
  if (state.eat(0x5B /* [ */)) {
23715
- state.eat(0x5E /* ^ */);
23716
- this.regexp_classRanges(state);
23717
- if (state.eat(0x5D /* ] */)) {
23718
- return true
23719
- }
23720
- // Unreachable since it threw "unterminated regular expression" error before.
23721
- state.raise("Unterminated character class");
23905
+ var negate = state.eat(0x5E /* ^ */);
23906
+ var result = this.regexp_classContents(state);
23907
+ if (!state.eat(0x5D /* ] */))
23908
+ { state.raise("Unterminated character class"); }
23909
+ if (negate && result === CharSetString)
23910
+ { state.raise("Negated character class may contain strings"); }
23911
+ return true
23722
23912
  }
23723
23913
  return false
23724
23914
  };
23725
23915
 
23916
+ // https://tc39.es/ecma262/#prod-ClassContents
23726
23917
  // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
23918
+ pp$1.regexp_classContents = function(state) {
23919
+ if (state.current() === 0x5D /* ] */) { return CharSetOk }
23920
+ if (state.switchV) { return this.regexp_classSetExpression(state) }
23921
+ this.regexp_nonEmptyClassRanges(state);
23922
+ return CharSetOk
23923
+ };
23924
+
23727
23925
  // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
23728
23926
  // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
23729
- pp$1.regexp_classRanges = function(state) {
23927
+ pp$1.regexp_nonEmptyClassRanges = function(state) {
23730
23928
  while (this.regexp_eatClassAtom(state)) {
23731
23929
  var left = state.lastIntValue;
23732
23930
  if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
@@ -23798,6 +23996,205 @@ pp$1.regexp_eatClassEscape = function(state) {
23798
23996
  )
23799
23997
  };
23800
23998
 
23999
+ // https://tc39.es/ecma262/#prod-ClassSetExpression
24000
+ // https://tc39.es/ecma262/#prod-ClassUnion
24001
+ // https://tc39.es/ecma262/#prod-ClassIntersection
24002
+ // https://tc39.es/ecma262/#prod-ClassSubtraction
24003
+ pp$1.regexp_classSetExpression = function(state) {
24004
+ var result = CharSetOk, subResult;
24005
+ if (this.regexp_eatClassSetRange(state)) ; else if (subResult = this.regexp_eatClassSetOperand(state)) {
24006
+ if (subResult === CharSetString) { result = CharSetString; }
24007
+ // https://tc39.es/ecma262/#prod-ClassIntersection
24008
+ var start = state.pos;
24009
+ while (state.eatChars([0x26, 0x26] /* && */)) {
24010
+ if (
24011
+ state.current() !== 0x26 /* & */ &&
24012
+ (subResult = this.regexp_eatClassSetOperand(state))
24013
+ ) {
24014
+ if (subResult !== CharSetString) { result = CharSetOk; }
24015
+ continue
24016
+ }
24017
+ state.raise("Invalid character in character class");
24018
+ }
24019
+ if (start !== state.pos) { return result }
24020
+ // https://tc39.es/ecma262/#prod-ClassSubtraction
24021
+ while (state.eatChars([0x2D, 0x2D] /* -- */)) {
24022
+ if (this.regexp_eatClassSetOperand(state)) { continue }
24023
+ state.raise("Invalid character in character class");
24024
+ }
24025
+ if (start !== state.pos) { return result }
24026
+ } else {
24027
+ state.raise("Invalid character in character class");
24028
+ }
24029
+ // https://tc39.es/ecma262/#prod-ClassUnion
24030
+ for (;;) {
24031
+ if (this.regexp_eatClassSetRange(state)) { continue }
24032
+ subResult = this.regexp_eatClassSetOperand(state);
24033
+ if (!subResult) { return result }
24034
+ if (subResult === CharSetString) { result = CharSetString; }
24035
+ }
24036
+ };
24037
+
24038
+ // https://tc39.es/ecma262/#prod-ClassSetRange
24039
+ pp$1.regexp_eatClassSetRange = function(state) {
24040
+ var start = state.pos;
24041
+ if (this.regexp_eatClassSetCharacter(state)) {
24042
+ var left = state.lastIntValue;
24043
+ if (state.eat(0x2D /* - */) && this.regexp_eatClassSetCharacter(state)) {
24044
+ var right = state.lastIntValue;
24045
+ if (left !== -1 && right !== -1 && left > right) {
24046
+ state.raise("Range out of order in character class");
24047
+ }
24048
+ return true
24049
+ }
24050
+ state.pos = start;
24051
+ }
24052
+ return false
24053
+ };
24054
+
24055
+ // https://tc39.es/ecma262/#prod-ClassSetOperand
24056
+ pp$1.regexp_eatClassSetOperand = function(state) {
24057
+ if (this.regexp_eatClassSetCharacter(state)) { return CharSetOk }
24058
+ return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state)
24059
+ };
24060
+
24061
+ // https://tc39.es/ecma262/#prod-NestedClass
24062
+ pp$1.regexp_eatNestedClass = function(state) {
24063
+ var start = state.pos;
24064
+ if (state.eat(0x5B /* [ */)) {
24065
+ var negate = state.eat(0x5E /* ^ */);
24066
+ var result = this.regexp_classContents(state);
24067
+ if (state.eat(0x5D /* ] */)) {
24068
+ if (negate && result === CharSetString) {
24069
+ state.raise("Negated character class may contain strings");
24070
+ }
24071
+ return result
24072
+ }
24073
+ state.pos = start;
24074
+ }
24075
+ if (state.eat(0x5C /* \ */)) {
24076
+ var result$1 = this.regexp_eatCharacterClassEscape(state);
24077
+ if (result$1) {
24078
+ return result$1
24079
+ }
24080
+ state.pos = start;
24081
+ }
24082
+ return null
24083
+ };
24084
+
24085
+ // https://tc39.es/ecma262/#prod-ClassStringDisjunction
24086
+ pp$1.regexp_eatClassStringDisjunction = function(state) {
24087
+ var start = state.pos;
24088
+ if (state.eatChars([0x5C, 0x71] /* \q */)) {
24089
+ if (state.eat(0x7B /* { */)) {
24090
+ var result = this.regexp_classStringDisjunctionContents(state);
24091
+ if (state.eat(0x7D /* } */)) {
24092
+ return result
24093
+ }
24094
+ } else {
24095
+ // Make the same message as V8.
24096
+ state.raise("Invalid escape");
24097
+ }
24098
+ state.pos = start;
24099
+ }
24100
+ return null
24101
+ };
24102
+
24103
+ // https://tc39.es/ecma262/#prod-ClassStringDisjunctionContents
24104
+ pp$1.regexp_classStringDisjunctionContents = function(state) {
24105
+ var result = this.regexp_classString(state);
24106
+ while (state.eat(0x7C /* | */)) {
24107
+ if (this.regexp_classString(state) === CharSetString) { result = CharSetString; }
24108
+ }
24109
+ return result
24110
+ };
24111
+
24112
+ // https://tc39.es/ecma262/#prod-ClassString
24113
+ // https://tc39.es/ecma262/#prod-NonEmptyClassString
24114
+ pp$1.regexp_classString = function(state) {
24115
+ var count = 0;
24116
+ while (this.regexp_eatClassSetCharacter(state)) { count++; }
24117
+ return count === 1 ? CharSetOk : CharSetString
24118
+ };
24119
+
24120
+ // https://tc39.es/ecma262/#prod-ClassSetCharacter
24121
+ pp$1.regexp_eatClassSetCharacter = function(state) {
24122
+ var start = state.pos;
24123
+ if (state.eat(0x5C /* \ */)) {
24124
+ if (
24125
+ this.regexp_eatCharacterEscape(state) ||
24126
+ this.regexp_eatClassSetReservedPunctuator(state)
24127
+ ) {
24128
+ return true
24129
+ }
24130
+ if (state.eat(0x62 /* b */)) {
24131
+ state.lastIntValue = 0x08; /* <BS> */
24132
+ return true
24133
+ }
24134
+ state.pos = start;
24135
+ return false
24136
+ }
24137
+ var ch = state.current();
24138
+ if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) { return false }
24139
+ if (isClassSetSyntaxCharacter(ch)) { return false }
24140
+ state.advance();
24141
+ state.lastIntValue = ch;
24142
+ return true
24143
+ };
24144
+
24145
+ // https://tc39.es/ecma262/#prod-ClassSetReservedDoublePunctuator
24146
+ function isClassSetReservedDoublePunctuatorCharacter(ch) {
24147
+ return (
24148
+ ch === 0x21 /* ! */ ||
24149
+ ch >= 0x23 /* # */ && ch <= 0x26 /* & */ ||
24150
+ ch >= 0x2A /* * */ && ch <= 0x2C /* , */ ||
24151
+ ch === 0x2E /* . */ ||
24152
+ ch >= 0x3A /* : */ && ch <= 0x40 /* @ */ ||
24153
+ ch === 0x5E /* ^ */ ||
24154
+ ch === 0x60 /* ` */ ||
24155
+ ch === 0x7E /* ~ */
24156
+ )
24157
+ }
24158
+
24159
+ // https://tc39.es/ecma262/#prod-ClassSetSyntaxCharacter
24160
+ function isClassSetSyntaxCharacter(ch) {
24161
+ return (
24162
+ ch === 0x28 /* ( */ ||
24163
+ ch === 0x29 /* ) */ ||
24164
+ ch === 0x2D /* - */ ||
24165
+ ch === 0x2F /* / */ ||
24166
+ ch >= 0x5B /* [ */ && ch <= 0x5D /* ] */ ||
24167
+ ch >= 0x7B /* { */ && ch <= 0x7D /* } */
24168
+ )
24169
+ }
24170
+
24171
+ // https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
24172
+ pp$1.regexp_eatClassSetReservedPunctuator = function(state) {
24173
+ var ch = state.current();
24174
+ if (isClassSetReservedPunctuator(ch)) {
24175
+ state.lastIntValue = ch;
24176
+ state.advance();
24177
+ return true
24178
+ }
24179
+ return false
24180
+ };
24181
+
24182
+ // https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
24183
+ function isClassSetReservedPunctuator(ch) {
24184
+ return (
24185
+ ch === 0x21 /* ! */ ||
24186
+ ch === 0x23 /* # */ ||
24187
+ ch === 0x25 /* % */ ||
24188
+ ch === 0x26 /* & */ ||
24189
+ ch === 0x2C /* , */ ||
24190
+ ch === 0x2D /* - */ ||
24191
+ ch >= 0x3A /* : */ && ch <= 0x3E /* > */ ||
24192
+ ch === 0x40 /* @ */ ||
24193
+ ch === 0x60 /* ` */ ||
24194
+ ch === 0x7E /* ~ */
24195
+ )
24196
+ }
24197
+
23801
24198
  // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
23802
24199
  pp$1.regexp_eatClassControlLetter = function(state) {
23803
24200
  var ch = state.current();
@@ -24718,8 +25115,23 @@ pp.readWord = function() {
24718
25115
  };
24719
25116
 
24720
25117
  // Acorn is a tiny, fast JavaScript parser written in JavaScript.
25118
+ //
25119
+ // Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
25120
+ // various contributors and released under an MIT license.
25121
+ //
25122
+ // Git repositories for Acorn are available at
25123
+ //
25124
+ // http://marijnhaverbeke.nl/git/acorn
25125
+ // https://github.com/acornjs/acorn.git
25126
+ //
25127
+ // Please use the [github bug tracker][ghbt] to report issues.
25128
+ //
25129
+ // [ghbt]: https://github.com/acornjs/acorn/issues
25130
+ //
25131
+ // [walk]: util/walk.js
25132
+
24721
25133
 
24722
- var version = "8.8.2";
25134
+ var version = "8.9.0";
24723
25135
 
24724
25136
  Parser.acorn = {
24725
25137
  Parser: Parser,
@@ -24919,7 +25331,7 @@ async function transform(source, module, pluginDriver, log) {
24919
25331
  let customTransformCache = false;
24920
25332
  const useCustomTransformCache = () => (customTransformCache = true);
24921
25333
  let pluginName = '';
24922
- const currentSource = source.code;
25334
+ let currentSource = source.code;
24923
25335
  function transformReducer(previousCode, result, plugin) {
24924
25336
  let code;
24925
25337
  let map;
@@ -24947,6 +25359,7 @@ async function transform(source, module, pluginDriver, log) {
24947
25359
  plugin: plugin.name
24948
25360
  });
24949
25361
  }
25362
+ currentSource = code;
24950
25363
  return code;
24951
25364
  }
24952
25365
  const getLogHandler = (handler) => (log, pos) => {