rollup 3.25.0 → 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.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.25.0
4
- Sun, 11 Jun 2023 05:02:46 GMT - commit 23c111c87145d15b0de032a6c7eeb6596764d1cf
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.0";
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
- 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;
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;
115
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;
@@ -10226,6 +10261,9 @@ class FunctionBase extends NodeBase {
10226
10261
  if (path.length > 0 || interaction.type !== INTERACTION_CALLED) {
10227
10262
  return this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context);
10228
10263
  }
10264
+ if (this.annotationNoSideEffects) {
10265
+ return false;
10266
+ }
10229
10267
  if (this.async) {
10230
10268
  const { propertyReadSideEffects } = this.context.options
10231
10269
  .treeshake;
@@ -10289,12 +10327,13 @@ class ArrowFunctionExpression extends FunctionBase {
10289
10327
  return false;
10290
10328
  }
10291
10329
  hasEffectsOnInteractionAtPath(path, interaction, context) {
10292
- if (super.hasEffectsOnInteractionAtPath(path, interaction, context))
10330
+ if (super.hasEffectsOnInteractionAtPath(path, interaction, context)) {
10293
10331
  return true;
10332
+ }
10333
+ if (this.annotationNoSideEffects) {
10334
+ return false;
10335
+ }
10294
10336
  if (interaction.type === INTERACTION_CALLED) {
10295
- if (this.annotationNoSideEffects) {
10296
- return false;
10297
- }
10298
10337
  const { ignore, brokenFlow } = context;
10299
10338
  context.ignore = {
10300
10339
  breaks: false,
@@ -19200,6 +19239,9 @@ var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\
19200
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";
19201
19240
 
19202
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.
19203
19245
 
19204
19246
  // Reserved word lists for various dialects of the language
19205
19247
 
@@ -20318,6 +20360,16 @@ pp$8.parseThrowStatement = function(node) {
20318
20360
 
20319
20361
  var empty$1 = [];
20320
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
+
20321
20373
  pp$8.parseTryStatement = function(node) {
20322
20374
  this.next();
20323
20375
  node.block = this.parseBlock();
@@ -20326,11 +20378,7 @@ pp$8.parseTryStatement = function(node) {
20326
20378
  var clause = this.startNode();
20327
20379
  this.next();
20328
20380
  if (this.eat(types$1.parenL)) {
20329
- clause.param = this.parseBindingAtom();
20330
- var simple = clause.param.type === "Identifier";
20331
- this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
20332
- this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
20333
- this.expect(types$1.parenR);
20381
+ clause.param = this.parseCatchClauseParam();
20334
20382
  } else {
20335
20383
  if (this.options.ecmaVersion < 10) { this.unexpected(); }
20336
20384
  clause.param = null;
@@ -20346,9 +20394,9 @@ pp$8.parseTryStatement = function(node) {
20346
20394
  return this.finishNode(node, "TryStatement")
20347
20395
  };
20348
20396
 
20349
- pp$8.parseVarStatement = function(node, kind) {
20397
+ pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {
20350
20398
  this.next();
20351
- this.parseVar(node, false, kind);
20399
+ this.parseVar(node, false, kind, allowMissingInitializer);
20352
20400
  this.semicolon();
20353
20401
  return this.finishNode(node, "VariableDeclaration")
20354
20402
  };
@@ -20477,7 +20525,7 @@ pp$8.parseForIn = function(node, init) {
20477
20525
 
20478
20526
  // Parse a list of variable declarations.
20479
20527
 
20480
- pp$8.parseVar = function(node, isFor, kind) {
20528
+ pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
20481
20529
  node.declarations = [];
20482
20530
  node.kind = kind;
20483
20531
  for (;;) {
@@ -20485,9 +20533,9 @@ pp$8.parseVar = function(node, isFor, kind) {
20485
20533
  this.parseVarId(decl, kind);
20486
20534
  if (this.eat(types$1.eq)) {
20487
20535
  decl.init = this.parseMaybeAssign(isFor);
20488
- } 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")))) {
20489
20537
  this.unexpected();
20490
- } 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")))) {
20491
20539
  this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
20492
20540
  } else {
20493
20541
  decl.init = null;
@@ -20576,7 +20624,7 @@ pp$8.parseClass = function(node, isStatement) {
20576
20624
  if (element) {
20577
20625
  classBody.body.push(element);
20578
20626
  if (element.type === "MethodDefinition" && element.kind === "constructor") {
20579
- if (hadConstructor) { this.raise(element.start, "Duplicate constructor in the same class"); }
20627
+ if (hadConstructor) { this.raiseRecoverable(element.start, "Duplicate constructor in the same class"); }
20580
20628
  hadConstructor = true;
20581
20629
  } else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
20582
20630
  this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared"));
@@ -20825,44 +20873,36 @@ function checkKeyName(node, name) {
20825
20873
 
20826
20874
  // Parses module export declaration.
20827
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
+
20828
20892
  pp$8.parseExport = function(node, exports) {
20829
20893
  this.next();
20830
20894
  // export * from '...'
20831
20895
  if (this.eat(types$1.star)) {
20832
- if (this.options.ecmaVersion >= 11) {
20833
- if (this.eatContextual("as")) {
20834
- node.exported = this.parseModuleExportName();
20835
- this.checkExport(exports, node.exported, this.lastTokStart);
20836
- } else {
20837
- node.exported = null;
20838
- }
20839
- }
20840
- this.expectContextual("from");
20841
- if (this.type !== types$1.string) { this.unexpected(); }
20842
- node.source = this.parseExprAtom();
20843
- this.semicolon();
20844
- return this.finishNode(node, "ExportAllDeclaration")
20896
+ return this.parseExportAllDeclaration(node, exports)
20845
20897
  }
20846
20898
  if (this.eat(types$1._default)) { // export default ...
20847
20899
  this.checkExport(exports, "default", this.lastTokStart);
20848
- var isAsync;
20849
- if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
20850
- var fNode = this.startNode();
20851
- this.next();
20852
- if (isAsync) { this.next(); }
20853
- node.declaration = this.parseFunction(fNode, FUNC_STATEMENT$1 | FUNC_NULLABLE_ID$1, false, isAsync);
20854
- } else if (this.type === types$1._class) {
20855
- var cNode = this.startNode();
20856
- node.declaration = this.parseClass(cNode, "nullableID");
20857
- } else {
20858
- node.declaration = this.parseMaybeAssign();
20859
- this.semicolon();
20860
- }
20900
+ node.declaration = this.parseExportDefaultDeclaration();
20861
20901
  return this.finishNode(node, "ExportDefaultDeclaration")
20862
20902
  }
20863
20903
  // export var|const|let|function|class ...
20864
20904
  if (this.shouldParseExportStatement()) {
20865
- node.declaration = this.parseStatement(null);
20905
+ node.declaration = this.parseExportDeclaration(node);
20866
20906
  if (node.declaration.type === "VariableDeclaration")
20867
20907
  { this.checkVariableExport(exports, node.declaration.declarations); }
20868
20908
  else
@@ -20896,6 +20936,27 @@ pp$8.parseExport = function(node, exports) {
20896
20936
  return this.finishNode(node, "ExportNamedDeclaration")
20897
20937
  };
20898
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
+
20899
20960
  pp$8.checkExport = function(exports, name, pos) {
20900
20961
  if (!exports) { return }
20901
20962
  if (typeof name !== "string")
@@ -20953,6 +21014,20 @@ pp$8.shouldParseExportStatement = function() {
20953
21014
 
20954
21015
  // Parses a comma-separated list of module exports.
20955
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
+
20956
21031
  pp$8.parseExportSpecifiers = function(exports) {
20957
21032
  var nodes = [], first = true;
20958
21033
  // export { x, y as z } [from '...']
@@ -20963,15 +21038,7 @@ pp$8.parseExportSpecifiers = function(exports) {
20963
21038
  if (this.afterTrailingComma(types$1.braceR)) { break }
20964
21039
  } else { first = false; }
20965
21040
 
20966
- var node = this.startNode();
20967
- node.local = this.parseModuleExportName();
20968
- node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
20969
- this.checkExport(
20970
- exports,
20971
- node.exported,
20972
- node.exported.start
20973
- );
20974
- nodes.push(this.finishNode(node, "ExportSpecifier"));
21041
+ nodes.push(this.parseExportSpecifier(exports));
20975
21042
  }
20976
21043
  return nodes
20977
21044
  };
@@ -20980,6 +21047,7 @@ pp$8.parseExportSpecifiers = function(exports) {
20980
21047
 
20981
21048
  pp$8.parseImport = function(node) {
20982
21049
  this.next();
21050
+
20983
21051
  // import '...'
20984
21052
  if (this.type === types$1.string) {
20985
21053
  node.specifiers = empty$1;
@@ -20995,23 +21063,46 @@ pp$8.parseImport = function(node) {
20995
21063
 
20996
21064
  // Parses a comma-separated list of module imports.
20997
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
+
20998
21098
  pp$8.parseImportSpecifiers = function() {
20999
21099
  var nodes = [], first = true;
21000
21100
  if (this.type === types$1.name) {
21001
- // import defaultObj, { x, y as z } from '...'
21002
- var node = this.startNode();
21003
- node.local = this.parseIdent();
21004
- this.checkLValSimple(node.local, BIND_LEXICAL);
21005
- nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
21101
+ nodes.push(this.parseImportDefaultSpecifier());
21006
21102
  if (!this.eat(types$1.comma)) { return nodes }
21007
21103
  }
21008
21104
  if (this.type === types$1.star) {
21009
- var node$1 = this.startNode();
21010
- this.next();
21011
- this.expectContextual("as");
21012
- node$1.local = this.parseIdent();
21013
- this.checkLValSimple(node$1.local, BIND_LEXICAL);
21014
- nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
21105
+ nodes.push(this.parseImportNamespaceSpecifier());
21015
21106
  return nodes
21016
21107
  }
21017
21108
  this.expect(types$1.braceL);
@@ -21021,16 +21112,7 @@ pp$8.parseImportSpecifiers = function() {
21021
21112
  if (this.afterTrailingComma(types$1.braceR)) { break }
21022
21113
  } else { first = false; }
21023
21114
 
21024
- var node$2 = this.startNode();
21025
- node$2.imported = this.parseModuleExportName();
21026
- if (this.eatContextual("as")) {
21027
- node$2.local = this.parseIdent();
21028
- } else {
21029
- this.checkUnreserved(node$2.imported);
21030
- node$2.local = node$2.imported;
21031
- }
21032
- this.checkLValSimple(node$2.local, BIND_LEXICAL);
21033
- nodes.push(this.finishNode(node$2, "ImportSpecifier"));
21115
+ nodes.push(this.parseImportSpecifier());
21034
21116
  }
21035
21117
  return nodes
21036
21118
  };
@@ -21203,7 +21285,7 @@ pp$7.parseBindingAtom = function() {
21203
21285
  return this.parseIdent()
21204
21286
  };
21205
21287
 
21206
- pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
21288
+ pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) {
21207
21289
  var elts = [], first = true;
21208
21290
  while (!this.eat(close)) {
21209
21291
  if (first) { first = false; }
@@ -21216,18 +21298,22 @@ pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
21216
21298
  var rest = this.parseRestBinding();
21217
21299
  this.parseBindingListItem(rest);
21218
21300
  elts.push(rest);
21219
- if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
21301
+ if (this.type === types$1.comma) { this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); }
21220
21302
  this.expect(close);
21221
21303
  break
21222
21304
  } else {
21223
- var elem = this.parseMaybeDefault(this.start, this.startLoc);
21224
- this.parseBindingListItem(elem);
21225
- elts.push(elem);
21305
+ elts.push(this.parseAssignableListItem(allowModifiers));
21226
21306
  }
21227
21307
  }
21228
21308
  return elts
21229
21309
  };
21230
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
+
21231
21317
  pp$7.parseBindingListItem = function(param) {
21232
21318
  return param
21233
21319
  };
@@ -21393,6 +21479,9 @@ pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
21393
21479
  };
21394
21480
 
21395
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
+
21396
21485
 
21397
21486
  var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
21398
21487
  this.token = token;
@@ -21548,6 +21637,23 @@ types$1.name.updateContext = function(prevType) {
21548
21637
  };
21549
21638
 
21550
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
+
21551
21657
 
21552
21658
  var pp$5 = Parser.prototype;
21553
21659
 
@@ -21851,6 +21957,14 @@ pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
21851
21957
  }
21852
21958
  };
21853
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
+
21854
21968
  pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
21855
21969
  var optionalSupported = this.options.ecmaVersion >= 11;
21856
21970
  var optional = optionalSupported && this.eat(types$1.questionDot);
@@ -21879,7 +21993,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
21879
21993
  this.awaitPos = 0;
21880
21994
  this.awaitIdentPos = 0;
21881
21995
  var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
21882
- if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
21996
+ if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {
21883
21997
  this.checkPatternErrors(refDestructuringErrors, false);
21884
21998
  this.checkYieldAwaitInDefaultParams();
21885
21999
  if (this.awaitIdentPos > 0)
@@ -21887,7 +22001,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
21887
22001
  this.yieldPos = oldYieldPos;
21888
22002
  this.awaitPos = oldAwaitPos;
21889
22003
  this.awaitIdentPos = oldAwaitIdentPos;
21890
- return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)
22004
+ return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit)
21891
22005
  }
21892
22006
  this.checkExpressionErrors(refDestructuringErrors, true);
21893
22007
  this.yieldPos = oldYieldPos || this.yieldPos;
@@ -21917,7 +22031,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
21917
22031
  // `new`, or an expression wrapped in punctuation like `()`, `[]`,
21918
22032
  // or `{}`.
21919
22033
 
21920
- pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
22034
+ pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
21921
22035
  // If a division operator appears in an expression position, the
21922
22036
  // tokenizer got confused, and we force it to read a regexp instead.
21923
22037
  if (this.type === types$1.slash) { this.readRegexp(); }
@@ -22018,17 +22132,21 @@ pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
22018
22132
 
22019
22133
  case types$1._import:
22020
22134
  if (this.options.ecmaVersion >= 11) {
22021
- return this.parseExprImport()
22135
+ return this.parseExprImport(forNew)
22022
22136
  } else {
22023
22137
  return this.unexpected()
22024
22138
  }
22025
22139
 
22026
22140
  default:
22027
- this.unexpected();
22141
+ return this.parseExprAtomDefault()
22028
22142
  }
22029
22143
  };
22030
22144
 
22031
- pp$5.parseExprImport = function() {
22145
+ pp$5.parseExprAtomDefault = function() {
22146
+ this.unexpected();
22147
+ };
22148
+
22149
+ pp$5.parseExprImport = function(forNew) {
22032
22150
  var node = this.startNode();
22033
22151
 
22034
22152
  // Consume `import` as an identifier for `import.meta`.
@@ -22036,13 +22154,12 @@ pp$5.parseExprImport = function() {
22036
22154
  if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
22037
22155
  var meta = this.parseIdent(true);
22038
22156
 
22039
- switch (this.type) {
22040
- case types$1.parenL:
22157
+ if (this.type === types$1.parenL && !forNew) {
22041
22158
  return this.parseDynamicImport(node)
22042
- case types$1.dot:
22159
+ } else if (this.type === types$1.dot) {
22043
22160
  node.meta = meta;
22044
22161
  return this.parseImportMeta(node)
22045
- default:
22162
+ } else {
22046
22163
  this.unexpected();
22047
22164
  }
22048
22165
  };
@@ -22098,6 +22215,10 @@ pp$5.parseParenExpression = function() {
22098
22215
  return val
22099
22216
  };
22100
22217
 
22218
+ pp$5.shouldParseArrow = function(exprList) {
22219
+ return !this.canInsertSemicolon()
22220
+ };
22221
+
22101
22222
  pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
22102
22223
  var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
22103
22224
  if (this.options.ecmaVersion >= 6) {
@@ -22117,7 +22238,12 @@ pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
22117
22238
  } else if (this.type === types$1.ellipsis) {
22118
22239
  spreadStart = this.start;
22119
22240
  exprList.push(this.parseParenItem(this.parseRestBinding()));
22120
- if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
22241
+ if (this.type === types$1.comma) {
22242
+ this.raiseRecoverable(
22243
+ this.start,
22244
+ "Comma is not permitted after the rest element"
22245
+ );
22246
+ }
22121
22247
  break
22122
22248
  } else {
22123
22249
  exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
@@ -22126,7 +22252,7 @@ pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
22126
22252
  var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
22127
22253
  this.expect(types$1.parenR);
22128
22254
 
22129
- if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
22255
+ if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {
22130
22256
  this.checkPatternErrors(refDestructuringErrors, false);
22131
22257
  this.checkYieldAwaitInDefaultParams();
22132
22258
  this.yieldPos = oldYieldPos;
@@ -22192,11 +22318,8 @@ pp$5.parseNew = function() {
22192
22318
  { this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
22193
22319
  return this.finishNode(node, "MetaProperty")
22194
22320
  }
22195
- var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
22196
- node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
22197
- if (isImport && node.callee.type === "ImportExpression") {
22198
- this.raise(startPos, "Cannot use new with import()");
22199
- }
22321
+ var startPos = this.start, startLoc = this.startLoc;
22322
+ node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
22200
22323
  if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
22201
22324
  else { node.arguments = empty; }
22202
22325
  return this.finishNode(node, "NewExpression")
@@ -22278,7 +22401,7 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
22278
22401
  if (isPattern) {
22279
22402
  prop.argument = this.parseIdent(false);
22280
22403
  if (this.type === types$1.comma) {
22281
- this.raise(this.start, "Comma is not permitted after the rest element");
22404
+ this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
22282
22405
  }
22283
22406
  return this.finishNode(prop, "RestElement")
22284
22407
  }
@@ -22314,6 +22437,23 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
22314
22437
  return this.finishNode(prop, "Property")
22315
22438
  };
22316
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
+
22317
22457
  pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
22318
22458
  if ((isGenerator || isAsync) && this.type === types$1.colon)
22319
22459
  { this.unexpected(); }
@@ -22331,20 +22471,7 @@ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
22331
22471
  (prop.key.name === "get" || prop.key.name === "set") &&
22332
22472
  (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
22333
22473
  if (isGenerator || isAsync) { this.unexpected(); }
22334
- prop.kind = prop.key.name;
22335
- this.parsePropertyName(prop);
22336
- prop.value = this.parseMethod(false);
22337
- var paramCount = prop.kind === "get" ? 0 : 1;
22338
- if (prop.value.params.length !== paramCount) {
22339
- var start = prop.value.start;
22340
- if (prop.kind === "get")
22341
- { this.raiseRecoverable(start, "getter should have no params"); }
22342
- else
22343
- { this.raiseRecoverable(start, "setter should have exactly one param"); }
22344
- } else {
22345
- if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
22346
- { this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
22347
- }
22474
+ this.parseGetterSetter(prop);
22348
22475
  } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
22349
22476
  if (isGenerator || isAsync) { this.unexpected(); }
22350
22477
  this.checkUnreserved(prop.key);
@@ -22556,6 +22683,18 @@ pp$5.checkUnreserved = function(ref) {
22556
22683
  // identifiers.
22557
22684
 
22558
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() {
22559
22698
  var node = this.startNode();
22560
22699
  if (this.type === types$1.name) {
22561
22700
  node.name = this.value;
@@ -22567,19 +22706,12 @@ pp$5.parseIdent = function(liberal) {
22567
22706
  // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
22568
22707
  // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
22569
22708
  if ((node.name === "class" || node.name === "function") &&
22570
- (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
22709
+ (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
22571
22710
  this.context.pop();
22572
22711
  }
22573
22712
  } else {
22574
22713
  this.unexpected();
22575
22714
  }
22576
- this.next(!!liberal);
22577
- this.finishNode(node, "Identifier");
22578
- if (!liberal) {
22579
- this.checkUnreserved(node);
22580
- if (node.name === "await" && !this.awaitIdentPos)
22581
- { this.awaitIdentPos = node.start; }
22582
- }
22583
22715
  return node
22584
22716
  };
22585
22717
 
@@ -22819,6 +22951,18 @@ var unicodeBinaryProperties = {
22819
22951
  14: ecma14BinaryProperties
22820
22952
  };
22821
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
+
22822
22966
  // #table-unicode-general-category-values
22823
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";
22824
22968
 
@@ -22828,7 +22972,7 @@ var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Han
22828
22972
  var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
22829
22973
  var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
22830
22974
  var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
22831
- var ecma14ScriptValues = ecma13ScriptValues + " Kawi Nag_Mundari Nagm";
22975
+ var ecma14ScriptValues = ecma13ScriptValues + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz";
22832
22976
 
22833
22977
  var unicodeScriptValues = {
22834
22978
  9: ecma9ScriptValues,
@@ -22843,6 +22987,7 @@ var data = {};
22843
22987
  function buildUnicodeData(ecmaVersion) {
22844
22988
  var d = data[ecmaVersion] = {
22845
22989
  binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
22990
+ binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),
22846
22991
  nonBinary: {
22847
22992
  General_Category: wordsRegexp(unicodeGeneralCategoryValues),
22848
22993
  Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
@@ -22865,12 +23010,13 @@ var pp$1 = Parser.prototype;
22865
23010
 
22866
23011
  var RegExpValidationState = function RegExpValidationState(parser) {
22867
23012
  this.parser = parser;
22868
- 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" : "");
22869
23014
  this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];
22870
23015
  this.source = "";
22871
23016
  this.flags = "";
22872
23017
  this.start = 0;
22873
23018
  this.switchU = false;
23019
+ this.switchV = false;
22874
23020
  this.switchN = false;
22875
23021
  this.pos = 0;
22876
23022
  this.lastIntValue = 0;
@@ -22883,12 +23029,20 @@ var RegExpValidationState = function RegExpValidationState(parser) {
22883
23029
  };
22884
23030
 
22885
23031
  RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
23032
+ var unicodeSets = flags.indexOf("v") !== -1;
22886
23033
  var unicode = flags.indexOf("u") !== -1;
22887
23034
  this.start = start | 0;
22888
23035
  this.source = pattern + "";
22889
23036
  this.flags = flags;
22890
- this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
22891
- this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
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
+ }
22892
23046
  };
22893
23047
 
22894
23048
  RegExpValidationState.prototype.raise = function raise (message) {
@@ -22957,6 +23111,23 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
22957
23111
  return false
22958
23112
  };
22959
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
+
22960
23131
  /**
22961
23132
  * Validate the flags part of a given RegExpLiteral.
22962
23133
  *
@@ -22967,6 +23138,9 @@ pp$1.validateRegExpFlags = function(state) {
22967
23138
  var validFlags = state.validFlags;
22968
23139
  var flags = state.flags;
22969
23140
 
23141
+ var u = false;
23142
+ var v = false;
23143
+
22970
23144
  for (var i = 0; i < flags.length; i++) {
22971
23145
  var flag = flags.charAt(i);
22972
23146
  if (validFlags.indexOf(flag) === -1) {
@@ -22975,6 +23149,11 @@ pp$1.validateRegExpFlags = function(state) {
22975
23149
  if (flags.indexOf(flag, i + 1) > -1) {
22976
23150
  this.raise(state.start, "Duplicate regular expression flag");
22977
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");
22978
23157
  }
22979
23158
  };
22980
23159
 
@@ -23593,6 +23772,12 @@ pp$1.regexp_eatDecimalEscape = function(state) {
23593
23772
  return false
23594
23773
  };
23595
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
+
23596
23781
  // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
23597
23782
  pp$1.regexp_eatCharacterClassEscape = function(state) {
23598
23783
  var ch = state.current();
@@ -23600,28 +23785,32 @@ pp$1.regexp_eatCharacterClassEscape = function(state) {
23600
23785
  if (isCharacterClassEscape(ch)) {
23601
23786
  state.lastIntValue = -1;
23602
23787
  state.advance();
23603
- return true
23788
+ return CharSetOk
23604
23789
  }
23605
23790
 
23791
+ var negate = false;
23606
23792
  if (
23607
23793
  state.switchU &&
23608
23794
  this.options.ecmaVersion >= 9 &&
23609
- (ch === 0x50 /* P */ || ch === 0x70 /* p */)
23795
+ ((negate = ch === 0x50 /* P */) || ch === 0x70 /* p */)
23610
23796
  ) {
23611
23797
  state.lastIntValue = -1;
23612
23798
  state.advance();
23799
+ var result;
23613
23800
  if (
23614
23801
  state.eat(0x7B /* { */) &&
23615
- this.regexp_eatUnicodePropertyValueExpression(state) &&
23802
+ (result = this.regexp_eatUnicodePropertyValueExpression(state)) &&
23616
23803
  state.eat(0x7D /* } */)
23617
23804
  ) {
23618
- return true
23805
+ if (negate && result === CharSetString) { state.raise("Invalid property name"); }
23806
+ return result
23619
23807
  }
23620
23808
  state.raise("Invalid property name");
23621
23809
  }
23622
23810
 
23623
- return false
23811
+ return CharSetNone
23624
23812
  };
23813
+
23625
23814
  function isCharacterClassEscape(ch) {
23626
23815
  return (
23627
23816
  ch === 0x64 /* d */ ||
@@ -23645,7 +23834,7 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
23645
23834
  if (this.regexp_eatUnicodePropertyValue(state)) {
23646
23835
  var value = state.lastStringValue;
23647
23836
  this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
23648
- return true
23837
+ return CharSetOk
23649
23838
  }
23650
23839
  }
23651
23840
  state.pos = start;
@@ -23653,20 +23842,22 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
23653
23842
  // LoneUnicodePropertyNameOrValue
23654
23843
  if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
23655
23844
  var nameOrValue = state.lastStringValue;
23656
- this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue);
23657
- return true
23845
+ return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)
23658
23846
  }
23659
- return false
23847
+ return CharSetNone
23660
23848
  };
23849
+
23661
23850
  pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
23662
23851
  if (!hasOwn(state.unicodeProperties.nonBinary, name))
23663
23852
  { state.raise("Invalid property name"); }
23664
23853
  if (!state.unicodeProperties.nonBinary[name].test(value))
23665
23854
  { state.raise("Invalid property value"); }
23666
23855
  };
23856
+
23667
23857
  pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
23668
- if (!state.unicodeProperties.binary.test(nameOrValue))
23669
- { state.raise("Invalid property name"); }
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");
23670
23861
  };
23671
23862
 
23672
23863
  // UnicodePropertyName ::
@@ -23680,6 +23871,7 @@ pp$1.regexp_eatUnicodePropertyName = function(state) {
23680
23871
  }
23681
23872
  return state.lastStringValue !== ""
23682
23873
  };
23874
+
23683
23875
  function isUnicodePropertyNameCharacter(ch) {
23684
23876
  return isControlLetter(ch) || ch === 0x5F /* _ */
23685
23877
  }
@@ -23708,21 +23900,29 @@ pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
23708
23900
  // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
23709
23901
  pp$1.regexp_eatCharacterClass = function(state) {
23710
23902
  if (state.eat(0x5B /* [ */)) {
23711
- state.eat(0x5E /* ^ */);
23712
- this.regexp_classRanges(state);
23713
- if (state.eat(0x5D /* ] */)) {
23714
- return true
23715
- }
23716
- // Unreachable since it threw "unterminated regular expression" error before.
23717
- state.raise("Unterminated character class");
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
23718
23910
  }
23719
23911
  return false
23720
23912
  };
23721
23913
 
23914
+ // https://tc39.es/ecma262/#prod-ClassContents
23722
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
+
23723
23923
  // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
23724
23924
  // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
23725
- pp$1.regexp_classRanges = function(state) {
23925
+ pp$1.regexp_nonEmptyClassRanges = function(state) {
23726
23926
  while (this.regexp_eatClassAtom(state)) {
23727
23927
  var left = state.lastIntValue;
23728
23928
  if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
@@ -23794,6 +23994,205 @@ pp$1.regexp_eatClassEscape = function(state) {
23794
23994
  )
23795
23995
  };
23796
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
+
23797
24196
  // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
23798
24197
  pp$1.regexp_eatClassControlLetter = function(state) {
23799
24198
  var ch = state.current();
@@ -24714,8 +25113,23 @@ pp.readWord = function() {
24714
25113
  };
24715
25114
 
24716
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
+
24717
25131
 
24718
- var version = "8.8.2";
25132
+ var version = "8.9.0";
24719
25133
 
24720
25134
  Parser.acorn = {
24721
25135
  Parser: Parser,
@@ -24915,7 +25329,7 @@ async function transform(source, module, pluginDriver, log) {
24915
25329
  let customTransformCache = false;
24916
25330
  const useCustomTransformCache = () => (customTransformCache = true);
24917
25331
  let pluginName = '';
24918
- const currentSource = source.code;
25332
+ let currentSource = source.code;
24919
25333
  function transformReducer(previousCode, result, plugin) {
24920
25334
  let code;
24921
25335
  let map;
@@ -24943,6 +25357,7 @@ async function transform(source, module, pluginDriver, log) {
24943
25357
  plugin: plugin.name
24944
25358
  });
24945
25359
  }
25360
+ currentSource = code;
24946
25361
  return code;
24947
25362
  }
24948
25363
  const getLogHandler = (handler) => (log, pos) => {