rollup 3.25.1 → 3.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.2
4
+ Sat, 24 Jun 2023 20:37:46 GMT - commit 91bf079599b84f97ea694dd1ecd0108ecf53fc97
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -15,7 +15,7 @@ import { createHash as createHash$1 } from 'node:crypto';
15
15
  import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/promises';
16
16
  import * as tty from 'tty';
17
17
 
18
- var version$1 = "3.25.1";
18
+ var version$1 = "3.25.2";
19
19
 
20
20
  const comma = ','.charCodeAt(0);
21
21
  const semicolon = ';'.charCodeAt(0);
@@ -2054,45 +2054,77 @@ const logLevelPriority = {
2054
2054
  [LOGLEVEL_WARN]: 2
2055
2055
  };
2056
2056
 
2057
- function getLocator(source, options) {
2058
- if (options === void 0) { options = {}; }
2059
- var offsetLine = options.offsetLine || 0;
2060
- var offsetColumn = options.offsetColumn || 0;
2061
- var originalLines = source.split('\n');
2062
- var start = 0;
2063
- var lineRanges = originalLines.map(function (line, i) {
2064
- var end = start + line.length + 1;
2065
- var range = { start: start, end: end, line: i };
2066
- start = end;
2067
- return range;
2068
- });
2069
- var i = 0;
2070
- function rangeContains(range, index) {
2071
- return range.start <= index && index < range.end;
2072
- }
2073
- function getLocation(range, index) {
2074
- return { line: offsetLine + range.line, column: offsetColumn + index - range.start, character: index };
2075
- }
2076
- function locate(search, startIndex) {
2077
- if (typeof search === 'string') {
2078
- search = source.indexOf(search, startIndex || 0);
2079
- }
2080
- var range = lineRanges[i];
2081
- var d = search >= range.end ? 1 : -1;
2082
- while (range) {
2083
- if (rangeContains(range, search))
2084
- return getLocation(range, search);
2085
- i += d;
2086
- range = lineRanges[i];
2087
- }
2088
- }
2089
- return locate;
2057
+ /** @typedef {import('./types').Location} Location */
2058
+
2059
+ /**
2060
+ * @param {import('./types').Range} range
2061
+ * @param {number} index
2062
+ */
2063
+ function rangeContains(range, index) {
2064
+ return range.start <= index && index < range.end;
2090
2065
  }
2066
+
2067
+ /**
2068
+ * @param {string} source
2069
+ * @param {import('./types').Options} [options]
2070
+ */
2071
+ function getLocator(source, options = {}) {
2072
+ const { offsetLine = 0, offsetColumn = 0 } = options;
2073
+
2074
+ let start = 0;
2075
+ const ranges = source.split('\n').map((line, i) => {
2076
+ const end = start + line.length + 1;
2077
+
2078
+ /** @type {import('./types').Range} */
2079
+ const range = { start, end, line: i };
2080
+
2081
+ start = end;
2082
+ return range;
2083
+ });
2084
+
2085
+ let i = 0;
2086
+
2087
+ /**
2088
+ * @param {string | number} search
2089
+ * @param {number} [index]
2090
+ * @returns {Location | undefined}
2091
+ */
2092
+ function locator(search, index) {
2093
+ if (typeof search === 'string') {
2094
+ search = source.indexOf(search, index ?? 0);
2095
+ }
2096
+
2097
+ if (search === -1) return undefined;
2098
+
2099
+ let range = ranges[i];
2100
+
2101
+ const d = search >= range.end ? 1 : -1;
2102
+
2103
+ while (range) {
2104
+ if (rangeContains(range, search)) {
2105
+ return {
2106
+ line: offsetLine + range.line,
2107
+ column: offsetColumn + search - range.start,
2108
+ character: search
2109
+ };
2110
+ }
2111
+
2112
+ i += d;
2113
+ range = ranges[i];
2114
+ }
2115
+ }
2116
+
2117
+ return locator;
2118
+ }
2119
+
2120
+ /**
2121
+ * @param {string} source
2122
+ * @param {string | number} search
2123
+ * @param {import('./types').Options} [options]
2124
+ * @returns {Location | undefined}
2125
+ */
2091
2126
  function locate(source, search, options) {
2092
- if (typeof options === 'number') {
2093
- throw new Error('locate takes a { startIndex, offsetLine, offsetColumn } object as the third argument');
2094
- }
2095
- return getLocator(source, options)(search, options && options.startIndex);
2127
+ return getLocator(source, options)(search, options && options.startIndex);
2096
2128
  }
2097
2129
 
2098
2130
  function spaces(index) {
@@ -2630,8 +2662,11 @@ function logParseError(error, moduleId) {
2630
2662
  };
2631
2663
  }
2632
2664
  function logPluginError(error, plugin, { hook, id } = {}) {
2633
- if (error.code && !error.code.startsWith('PLUGIN_') && !error.pluginCode) {
2634
- error.pluginCode = error.code;
2665
+ const code = error.code;
2666
+ if (!error.pluginCode &&
2667
+ code != null &&
2668
+ (typeof code !== 'string' || (typeof code === 'string' && !code.startsWith('PLUGIN_')))) {
2669
+ error.pluginCode = code;
2635
2670
  }
2636
2671
  error.code = PLUGIN_ERROR;
2637
2672
  error.plugin = plugin;
@@ -17823,6 +17858,9 @@ var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\
17823
17858
  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";
17824
17859
 
17825
17860
  // These are a run-length and offset encoded representation of the
17861
+ // >0xffff code points that are a valid part of identifiers. The
17862
+ // offset starts at 0x10000, and each pair of numbers represents an
17863
+ // offset to the next range, and then a size of the range.
17826
17864
 
17827
17865
  // Reserved word lists for various dialects of the language
17828
17866
 
@@ -18941,6 +18979,16 @@ pp$8.parseThrowStatement = function(node) {
18941
18979
 
18942
18980
  var empty$1 = [];
18943
18981
 
18982
+ pp$8.parseCatchClauseParam = function() {
18983
+ var param = this.parseBindingAtom();
18984
+ var simple = param.type === "Identifier";
18985
+ this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
18986
+ this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
18987
+ this.expect(types$1.parenR);
18988
+
18989
+ return param
18990
+ };
18991
+
18944
18992
  pp$8.parseTryStatement = function(node) {
18945
18993
  this.next();
18946
18994
  node.block = this.parseBlock();
@@ -18949,11 +18997,7 @@ pp$8.parseTryStatement = function(node) {
18949
18997
  var clause = this.startNode();
18950
18998
  this.next();
18951
18999
  if (this.eat(types$1.parenL)) {
18952
- clause.param = this.parseBindingAtom();
18953
- var simple = clause.param.type === "Identifier";
18954
- this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
18955
- this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
18956
- this.expect(types$1.parenR);
19000
+ clause.param = this.parseCatchClauseParam();
18957
19001
  } else {
18958
19002
  if (this.options.ecmaVersion < 10) { this.unexpected(); }
18959
19003
  clause.param = null;
@@ -18969,9 +19013,9 @@ pp$8.parseTryStatement = function(node) {
18969
19013
  return this.finishNode(node, "TryStatement")
18970
19014
  };
18971
19015
 
18972
- pp$8.parseVarStatement = function(node, kind) {
19016
+ pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {
18973
19017
  this.next();
18974
- this.parseVar(node, false, kind);
19018
+ this.parseVar(node, false, kind, allowMissingInitializer);
18975
19019
  this.semicolon();
18976
19020
  return this.finishNode(node, "VariableDeclaration")
18977
19021
  };
@@ -19100,7 +19144,7 @@ pp$8.parseForIn = function(node, init) {
19100
19144
 
19101
19145
  // Parse a list of variable declarations.
19102
19146
 
19103
- pp$8.parseVar = function(node, isFor, kind) {
19147
+ pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
19104
19148
  node.declarations = [];
19105
19149
  node.kind = kind;
19106
19150
  for (;;) {
@@ -19108,9 +19152,9 @@ pp$8.parseVar = function(node, isFor, kind) {
19108
19152
  this.parseVarId(decl, kind);
19109
19153
  if (this.eat(types$1.eq)) {
19110
19154
  decl.init = this.parseMaybeAssign(isFor);
19111
- } else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
19155
+ } else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
19112
19156
  this.unexpected();
19113
- } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
19157
+ } else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
19114
19158
  this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
19115
19159
  } else {
19116
19160
  decl.init = null;
@@ -19199,7 +19243,7 @@ pp$8.parseClass = function(node, isStatement) {
19199
19243
  if (element) {
19200
19244
  classBody.body.push(element);
19201
19245
  if (element.type === "MethodDefinition" && element.kind === "constructor") {
19202
- if (hadConstructor) { this.raise(element.start, "Duplicate constructor in the same class"); }
19246
+ if (hadConstructor) { this.raiseRecoverable(element.start, "Duplicate constructor in the same class"); }
19203
19247
  hadConstructor = true;
19204
19248
  } else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
19205
19249
  this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared"));
@@ -19448,44 +19492,36 @@ function checkKeyName(node, name) {
19448
19492
 
19449
19493
  // Parses module export declaration.
19450
19494
 
19495
+ pp$8.parseExportAllDeclaration = function(node, exports) {
19496
+ if (this.options.ecmaVersion >= 11) {
19497
+ if (this.eatContextual("as")) {
19498
+ node.exported = this.parseModuleExportName();
19499
+ this.checkExport(exports, node.exported, this.lastTokStart);
19500
+ } else {
19501
+ node.exported = null;
19502
+ }
19503
+ }
19504
+ this.expectContextual("from");
19505
+ if (this.type !== types$1.string) { this.unexpected(); }
19506
+ node.source = this.parseExprAtom();
19507
+ this.semicolon();
19508
+ return this.finishNode(node, "ExportAllDeclaration")
19509
+ };
19510
+
19451
19511
  pp$8.parseExport = function(node, exports) {
19452
19512
  this.next();
19453
19513
  // export * from '...'
19454
19514
  if (this.eat(types$1.star)) {
19455
- if (this.options.ecmaVersion >= 11) {
19456
- if (this.eatContextual("as")) {
19457
- node.exported = this.parseModuleExportName();
19458
- this.checkExport(exports, node.exported, this.lastTokStart);
19459
- } else {
19460
- node.exported = null;
19461
- }
19462
- }
19463
- this.expectContextual("from");
19464
- if (this.type !== types$1.string) { this.unexpected(); }
19465
- node.source = this.parseExprAtom();
19466
- this.semicolon();
19467
- return this.finishNode(node, "ExportAllDeclaration")
19515
+ return this.parseExportAllDeclaration(node, exports)
19468
19516
  }
19469
19517
  if (this.eat(types$1._default)) { // export default ...
19470
19518
  this.checkExport(exports, "default", this.lastTokStart);
19471
- var isAsync;
19472
- if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
19473
- var fNode = this.startNode();
19474
- this.next();
19475
- if (isAsync) { this.next(); }
19476
- node.declaration = this.parseFunction(fNode, FUNC_STATEMENT$1 | FUNC_NULLABLE_ID$1, false, isAsync);
19477
- } else if (this.type === types$1._class) {
19478
- var cNode = this.startNode();
19479
- node.declaration = this.parseClass(cNode, "nullableID");
19480
- } else {
19481
- node.declaration = this.parseMaybeAssign();
19482
- this.semicolon();
19483
- }
19519
+ node.declaration = this.parseExportDefaultDeclaration();
19484
19520
  return this.finishNode(node, "ExportDefaultDeclaration")
19485
19521
  }
19486
19522
  // export var|const|let|function|class ...
19487
19523
  if (this.shouldParseExportStatement()) {
19488
- node.declaration = this.parseStatement(null);
19524
+ node.declaration = this.parseExportDeclaration(node);
19489
19525
  if (node.declaration.type === "VariableDeclaration")
19490
19526
  { this.checkVariableExport(exports, node.declaration.declarations); }
19491
19527
  else
@@ -19519,6 +19555,27 @@ pp$8.parseExport = function(node, exports) {
19519
19555
  return this.finishNode(node, "ExportNamedDeclaration")
19520
19556
  };
19521
19557
 
19558
+ pp$8.parseExportDeclaration = function(node) {
19559
+ return this.parseStatement(null)
19560
+ };
19561
+
19562
+ pp$8.parseExportDefaultDeclaration = function() {
19563
+ var isAsync;
19564
+ if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
19565
+ var fNode = this.startNode();
19566
+ this.next();
19567
+ if (isAsync) { this.next(); }
19568
+ return this.parseFunction(fNode, FUNC_STATEMENT$1 | FUNC_NULLABLE_ID$1, false, isAsync)
19569
+ } else if (this.type === types$1._class) {
19570
+ var cNode = this.startNode();
19571
+ return this.parseClass(cNode, "nullableID")
19572
+ } else {
19573
+ var declaration = this.parseMaybeAssign();
19574
+ this.semicolon();
19575
+ return declaration
19576
+ }
19577
+ };
19578
+
19522
19579
  pp$8.checkExport = function(exports, name, pos) {
19523
19580
  if (!exports) { return }
19524
19581
  if (typeof name !== "string")
@@ -19576,6 +19633,20 @@ pp$8.shouldParseExportStatement = function() {
19576
19633
 
19577
19634
  // Parses a comma-separated list of module exports.
19578
19635
 
19636
+ pp$8.parseExportSpecifier = function(exports) {
19637
+ var node = this.startNode();
19638
+ node.local = this.parseModuleExportName();
19639
+
19640
+ node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
19641
+ this.checkExport(
19642
+ exports,
19643
+ node.exported,
19644
+ node.exported.start
19645
+ );
19646
+
19647
+ return this.finishNode(node, "ExportSpecifier")
19648
+ };
19649
+
19579
19650
  pp$8.parseExportSpecifiers = function(exports) {
19580
19651
  var nodes = [], first = true;
19581
19652
  // export { x, y as z } [from '...']
@@ -19586,15 +19657,7 @@ pp$8.parseExportSpecifiers = function(exports) {
19586
19657
  if (this.afterTrailingComma(types$1.braceR)) { break }
19587
19658
  } else { first = false; }
19588
19659
 
19589
- var node = this.startNode();
19590
- node.local = this.parseModuleExportName();
19591
- node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
19592
- this.checkExport(
19593
- exports,
19594
- node.exported,
19595
- node.exported.start
19596
- );
19597
- nodes.push(this.finishNode(node, "ExportSpecifier"));
19660
+ nodes.push(this.parseExportSpecifier(exports));
19598
19661
  }
19599
19662
  return nodes
19600
19663
  };
@@ -19603,6 +19666,7 @@ pp$8.parseExportSpecifiers = function(exports) {
19603
19666
 
19604
19667
  pp$8.parseImport = function(node) {
19605
19668
  this.next();
19669
+
19606
19670
  // import '...'
19607
19671
  if (this.type === types$1.string) {
19608
19672
  node.specifiers = empty$1;
@@ -19618,23 +19682,46 @@ pp$8.parseImport = function(node) {
19618
19682
 
19619
19683
  // Parses a comma-separated list of module imports.
19620
19684
 
19685
+ pp$8.parseImportSpecifier = function() {
19686
+ var node = this.startNode();
19687
+ node.imported = this.parseModuleExportName();
19688
+
19689
+ if (this.eatContextual("as")) {
19690
+ node.local = this.parseIdent();
19691
+ } else {
19692
+ this.checkUnreserved(node.imported);
19693
+ node.local = node.imported;
19694
+ }
19695
+ this.checkLValSimple(node.local, BIND_LEXICAL);
19696
+
19697
+ return this.finishNode(node, "ImportSpecifier")
19698
+ };
19699
+
19700
+ pp$8.parseImportDefaultSpecifier = function() {
19701
+ // import defaultObj, { x, y as z } from '...'
19702
+ var node = this.startNode();
19703
+ node.local = this.parseIdent();
19704
+ this.checkLValSimple(node.local, BIND_LEXICAL);
19705
+ return this.finishNode(node, "ImportDefaultSpecifier")
19706
+ };
19707
+
19708
+ pp$8.parseImportNamespaceSpecifier = function() {
19709
+ var node = this.startNode();
19710
+ this.next();
19711
+ this.expectContextual("as");
19712
+ node.local = this.parseIdent();
19713
+ this.checkLValSimple(node.local, BIND_LEXICAL);
19714
+ return this.finishNode(node, "ImportNamespaceSpecifier")
19715
+ };
19716
+
19621
19717
  pp$8.parseImportSpecifiers = function() {
19622
19718
  var nodes = [], first = true;
19623
19719
  if (this.type === types$1.name) {
19624
- // import defaultObj, { x, y as z } from '...'
19625
- var node = this.startNode();
19626
- node.local = this.parseIdent();
19627
- this.checkLValSimple(node.local, BIND_LEXICAL);
19628
- nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
19720
+ nodes.push(this.parseImportDefaultSpecifier());
19629
19721
  if (!this.eat(types$1.comma)) { return nodes }
19630
19722
  }
19631
19723
  if (this.type === types$1.star) {
19632
- var node$1 = this.startNode();
19633
- this.next();
19634
- this.expectContextual("as");
19635
- node$1.local = this.parseIdent();
19636
- this.checkLValSimple(node$1.local, BIND_LEXICAL);
19637
- nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
19724
+ nodes.push(this.parseImportNamespaceSpecifier());
19638
19725
  return nodes
19639
19726
  }
19640
19727
  this.expect(types$1.braceL);
@@ -19644,16 +19731,7 @@ pp$8.parseImportSpecifiers = function() {
19644
19731
  if (this.afterTrailingComma(types$1.braceR)) { break }
19645
19732
  } else { first = false; }
19646
19733
 
19647
- var node$2 = this.startNode();
19648
- node$2.imported = this.parseModuleExportName();
19649
- if (this.eatContextual("as")) {
19650
- node$2.local = this.parseIdent();
19651
- } else {
19652
- this.checkUnreserved(node$2.imported);
19653
- node$2.local = node$2.imported;
19654
- }
19655
- this.checkLValSimple(node$2.local, BIND_LEXICAL);
19656
- nodes.push(this.finishNode(node$2, "ImportSpecifier"));
19734
+ nodes.push(this.parseImportSpecifier());
19657
19735
  }
19658
19736
  return nodes
19659
19737
  };
@@ -19826,7 +19904,7 @@ pp$7.parseBindingAtom = function() {
19826
19904
  return this.parseIdent()
19827
19905
  };
19828
19906
 
19829
- pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
19907
+ pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) {
19830
19908
  var elts = [], first = true;
19831
19909
  while (!this.eat(close)) {
19832
19910
  if (first) { first = false; }
@@ -19839,18 +19917,22 @@ pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
19839
19917
  var rest = this.parseRestBinding();
19840
19918
  this.parseBindingListItem(rest);
19841
19919
  elts.push(rest);
19842
- if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
19920
+ if (this.type === types$1.comma) { this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); }
19843
19921
  this.expect(close);
19844
19922
  break
19845
19923
  } else {
19846
- var elem = this.parseMaybeDefault(this.start, this.startLoc);
19847
- this.parseBindingListItem(elem);
19848
- elts.push(elem);
19924
+ elts.push(this.parseAssignableListItem(allowModifiers));
19849
19925
  }
19850
19926
  }
19851
19927
  return elts
19852
19928
  };
19853
19929
 
19930
+ pp$7.parseAssignableListItem = function(allowModifiers) {
19931
+ var elem = this.parseMaybeDefault(this.start, this.startLoc);
19932
+ this.parseBindingListItem(elem);
19933
+ return elem
19934
+ };
19935
+
19854
19936
  pp$7.parseBindingListItem = function(param) {
19855
19937
  return param
19856
19938
  };
@@ -20016,6 +20098,9 @@ pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
20016
20098
  };
20017
20099
 
20018
20100
  // The algorithm used to determine whether a regexp can appear at a
20101
+ // given point in the program is loosely based on sweet.js' approach.
20102
+ // See https://github.com/mozilla/sweet.js/wiki/design
20103
+
20019
20104
 
20020
20105
  var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
20021
20106
  this.token = token;
@@ -20171,6 +20256,23 @@ types$1.name.updateContext = function(prevType) {
20171
20256
  };
20172
20257
 
20173
20258
  // A recursive descent parser operates by defining functions for all
20259
+ // syntactic elements, and recursively calling those, each function
20260
+ // advancing the input stream and returning an AST node. Precedence
20261
+ // of constructs (for example, the fact that `!x[1]` means `!(x[1])`
20262
+ // instead of `(!x)[1]` is handled by the fact that the parser
20263
+ // function that parses unary prefix operators is called first, and
20264
+ // in turn calls the function that parses `[]` subscripts — that
20265
+ // way, it'll receive the node for `x[1]` already parsed, and wraps
20266
+ // *that* in the unary operator node.
20267
+ //
20268
+ // Acorn uses an [operator precedence parser][opp] to handle binary
20269
+ // operator precedence, because it is much more compact than using
20270
+ // the technique outlined above, which uses different, nesting
20271
+ // functions to specify precedence, for all of the ten binary
20272
+ // precedence levels that JavaScript defines.
20273
+ //
20274
+ // [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
20275
+
20174
20276
 
20175
20277
  var pp$5 = Parser.prototype;
20176
20278
 
@@ -20474,6 +20576,14 @@ pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
20474
20576
  }
20475
20577
  };
20476
20578
 
20579
+ pp$5.shouldParseAsyncArrow = function() {
20580
+ return !this.canInsertSemicolon() && this.eat(types$1.arrow)
20581
+ };
20582
+
20583
+ pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) {
20584
+ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)
20585
+ };
20586
+
20477
20587
  pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
20478
20588
  var optionalSupported = this.options.ecmaVersion >= 11;
20479
20589
  var optional = optionalSupported && this.eat(types$1.questionDot);
@@ -20502,7 +20612,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
20502
20612
  this.awaitPos = 0;
20503
20613
  this.awaitIdentPos = 0;
20504
20614
  var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
20505
- if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
20615
+ if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {
20506
20616
  this.checkPatternErrors(refDestructuringErrors, false);
20507
20617
  this.checkYieldAwaitInDefaultParams();
20508
20618
  if (this.awaitIdentPos > 0)
@@ -20510,7 +20620,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
20510
20620
  this.yieldPos = oldYieldPos;
20511
20621
  this.awaitPos = oldAwaitPos;
20512
20622
  this.awaitIdentPos = oldAwaitIdentPos;
20513
- return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)
20623
+ return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit)
20514
20624
  }
20515
20625
  this.checkExpressionErrors(refDestructuringErrors, true);
20516
20626
  this.yieldPos = oldYieldPos || this.yieldPos;
@@ -20540,7 +20650,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
20540
20650
  // `new`, or an expression wrapped in punctuation like `()`, `[]`,
20541
20651
  // or `{}`.
20542
20652
 
20543
- pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
20653
+ pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
20544
20654
  // If a division operator appears in an expression position, the
20545
20655
  // tokenizer got confused, and we force it to read a regexp instead.
20546
20656
  if (this.type === types$1.slash) { this.readRegexp(); }
@@ -20641,17 +20751,21 @@ pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
20641
20751
 
20642
20752
  case types$1._import:
20643
20753
  if (this.options.ecmaVersion >= 11) {
20644
- return this.parseExprImport()
20754
+ return this.parseExprImport(forNew)
20645
20755
  } else {
20646
20756
  return this.unexpected()
20647
20757
  }
20648
20758
 
20649
20759
  default:
20650
- this.unexpected();
20760
+ return this.parseExprAtomDefault()
20651
20761
  }
20652
20762
  };
20653
20763
 
20654
- pp$5.parseExprImport = function() {
20764
+ pp$5.parseExprAtomDefault = function() {
20765
+ this.unexpected();
20766
+ };
20767
+
20768
+ pp$5.parseExprImport = function(forNew) {
20655
20769
  var node = this.startNode();
20656
20770
 
20657
20771
  // Consume `import` as an identifier for `import.meta`.
@@ -20659,13 +20773,12 @@ pp$5.parseExprImport = function() {
20659
20773
  if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
20660
20774
  var meta = this.parseIdent(true);
20661
20775
 
20662
- switch (this.type) {
20663
- case types$1.parenL:
20776
+ if (this.type === types$1.parenL && !forNew) {
20664
20777
  return this.parseDynamicImport(node)
20665
- case types$1.dot:
20778
+ } else if (this.type === types$1.dot) {
20666
20779
  node.meta = meta;
20667
20780
  return this.parseImportMeta(node)
20668
- default:
20781
+ } else {
20669
20782
  this.unexpected();
20670
20783
  }
20671
20784
  };
@@ -20721,6 +20834,10 @@ pp$5.parseParenExpression = function() {
20721
20834
  return val
20722
20835
  };
20723
20836
 
20837
+ pp$5.shouldParseArrow = function(exprList) {
20838
+ return !this.canInsertSemicolon()
20839
+ };
20840
+
20724
20841
  pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
20725
20842
  var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
20726
20843
  if (this.options.ecmaVersion >= 6) {
@@ -20740,7 +20857,12 @@ pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
20740
20857
  } else if (this.type === types$1.ellipsis) {
20741
20858
  spreadStart = this.start;
20742
20859
  exprList.push(this.parseParenItem(this.parseRestBinding()));
20743
- if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); }
20860
+ if (this.type === types$1.comma) {
20861
+ this.raiseRecoverable(
20862
+ this.start,
20863
+ "Comma is not permitted after the rest element"
20864
+ );
20865
+ }
20744
20866
  break
20745
20867
  } else {
20746
20868
  exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
@@ -20749,7 +20871,7 @@ pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
20749
20871
  var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
20750
20872
  this.expect(types$1.parenR);
20751
20873
 
20752
- if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) {
20874
+ if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {
20753
20875
  this.checkPatternErrors(refDestructuringErrors, false);
20754
20876
  this.checkYieldAwaitInDefaultParams();
20755
20877
  this.yieldPos = oldYieldPos;
@@ -20815,11 +20937,8 @@ pp$5.parseNew = function() {
20815
20937
  { this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
20816
20938
  return this.finishNode(node, "MetaProperty")
20817
20939
  }
20818
- var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types$1._import;
20819
- node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
20820
- if (isImport && node.callee.type === "ImportExpression") {
20821
- this.raise(startPos, "Cannot use new with import()");
20822
- }
20940
+ var startPos = this.start, startLoc = this.startLoc;
20941
+ node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
20823
20942
  if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
20824
20943
  else { node.arguments = empty; }
20825
20944
  return this.finishNode(node, "NewExpression")
@@ -20901,7 +21020,7 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
20901
21020
  if (isPattern) {
20902
21021
  prop.argument = this.parseIdent(false);
20903
21022
  if (this.type === types$1.comma) {
20904
- this.raise(this.start, "Comma is not permitted after the rest element");
21023
+ this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
20905
21024
  }
20906
21025
  return this.finishNode(prop, "RestElement")
20907
21026
  }
@@ -20937,6 +21056,23 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
20937
21056
  return this.finishNode(prop, "Property")
20938
21057
  };
20939
21058
 
21059
+ pp$5.parseGetterSetter = function(prop) {
21060
+ prop.kind = prop.key.name;
21061
+ this.parsePropertyName(prop);
21062
+ prop.value = this.parseMethod(false);
21063
+ var paramCount = prop.kind === "get" ? 0 : 1;
21064
+ if (prop.value.params.length !== paramCount) {
21065
+ var start = prop.value.start;
21066
+ if (prop.kind === "get")
21067
+ { this.raiseRecoverable(start, "getter should have no params"); }
21068
+ else
21069
+ { this.raiseRecoverable(start, "setter should have exactly one param"); }
21070
+ } else {
21071
+ if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
21072
+ { this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
21073
+ }
21074
+ };
21075
+
20940
21076
  pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
20941
21077
  if ((isGenerator || isAsync) && this.type === types$1.colon)
20942
21078
  { this.unexpected(); }
@@ -20954,20 +21090,7 @@ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
20954
21090
  (prop.key.name === "get" || prop.key.name === "set") &&
20955
21091
  (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
20956
21092
  if (isGenerator || isAsync) { this.unexpected(); }
20957
- prop.kind = prop.key.name;
20958
- this.parsePropertyName(prop);
20959
- prop.value = this.parseMethod(false);
20960
- var paramCount = prop.kind === "get" ? 0 : 1;
20961
- if (prop.value.params.length !== paramCount) {
20962
- var start = prop.value.start;
20963
- if (prop.kind === "get")
20964
- { this.raiseRecoverable(start, "getter should have no params"); }
20965
- else
20966
- { this.raiseRecoverable(start, "setter should have exactly one param"); }
20967
- } else {
20968
- if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
20969
- { this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
20970
- }
21093
+ this.parseGetterSetter(prop);
20971
21094
  } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
20972
21095
  if (isGenerator || isAsync) { this.unexpected(); }
20973
21096
  this.checkUnreserved(prop.key);
@@ -21179,6 +21302,18 @@ pp$5.checkUnreserved = function(ref) {
21179
21302
  // identifiers.
21180
21303
 
21181
21304
  pp$5.parseIdent = function(liberal) {
21305
+ var node = this.parseIdentNode();
21306
+ this.next(!!liberal);
21307
+ this.finishNode(node, "Identifier");
21308
+ if (!liberal) {
21309
+ this.checkUnreserved(node);
21310
+ if (node.name === "await" && !this.awaitIdentPos)
21311
+ { this.awaitIdentPos = node.start; }
21312
+ }
21313
+ return node
21314
+ };
21315
+
21316
+ pp$5.parseIdentNode = function() {
21182
21317
  var node = this.startNode();
21183
21318
  if (this.type === types$1.name) {
21184
21319
  node.name = this.value;
@@ -21190,19 +21325,12 @@ pp$5.parseIdent = function(liberal) {
21190
21325
  // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
21191
21326
  // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
21192
21327
  if ((node.name === "class" || node.name === "function") &&
21193
- (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
21328
+ (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
21194
21329
  this.context.pop();
21195
21330
  }
21196
21331
  } else {
21197
21332
  this.unexpected();
21198
21333
  }
21199
- this.next(!!liberal);
21200
- this.finishNode(node, "Identifier");
21201
- if (!liberal) {
21202
- this.checkUnreserved(node);
21203
- if (node.name === "await" && !this.awaitIdentPos)
21204
- { this.awaitIdentPos = node.start; }
21205
- }
21206
21334
  return node
21207
21335
  };
21208
21336
 
@@ -21442,6 +21570,18 @@ var unicodeBinaryProperties = {
21442
21570
  14: ecma14BinaryProperties
21443
21571
  };
21444
21572
 
21573
+ // #table-binary-unicode-properties-of-strings
21574
+ 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";
21575
+
21576
+ var unicodeBinaryPropertiesOfStrings = {
21577
+ 9: "",
21578
+ 10: "",
21579
+ 11: "",
21580
+ 12: "",
21581
+ 13: "",
21582
+ 14: ecma14BinaryPropertiesOfStrings
21583
+ };
21584
+
21445
21585
  // #table-unicode-general-category-values
21446
21586
  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";
21447
21587
 
@@ -21451,7 +21591,7 @@ var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Han
21451
21591
  var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
21452
21592
  var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
21453
21593
  var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
21454
- var ecma14ScriptValues = ecma13ScriptValues + " Kawi Nag_Mundari Nagm";
21594
+ var ecma14ScriptValues = ecma13ScriptValues + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz";
21455
21595
 
21456
21596
  var unicodeScriptValues = {
21457
21597
  9: ecma9ScriptValues,
@@ -21466,6 +21606,7 @@ var data = {};
21466
21606
  function buildUnicodeData(ecmaVersion) {
21467
21607
  var d = data[ecmaVersion] = {
21468
21608
  binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
21609
+ binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),
21469
21610
  nonBinary: {
21470
21611
  General_Category: wordsRegexp(unicodeGeneralCategoryValues),
21471
21612
  Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
@@ -21488,12 +21629,13 @@ var pp$1 = Parser.prototype;
21488
21629
 
21489
21630
  var RegExpValidationState = function RegExpValidationState(parser) {
21490
21631
  this.parser = parser;
21491
- this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "");
21632
+ this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
21492
21633
  this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];
21493
21634
  this.source = "";
21494
21635
  this.flags = "";
21495
21636
  this.start = 0;
21496
21637
  this.switchU = false;
21638
+ this.switchV = false;
21497
21639
  this.switchN = false;
21498
21640
  this.pos = 0;
21499
21641
  this.lastIntValue = 0;
@@ -21506,12 +21648,20 @@ var RegExpValidationState = function RegExpValidationState(parser) {
21506
21648
  };
21507
21649
 
21508
21650
  RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
21651
+ var unicodeSets = flags.indexOf("v") !== -1;
21509
21652
  var unicode = flags.indexOf("u") !== -1;
21510
21653
  this.start = start | 0;
21511
21654
  this.source = pattern + "";
21512
21655
  this.flags = flags;
21513
- this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
21514
- this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
21656
+ if (unicodeSets && this.parser.options.ecmaVersion >= 15) {
21657
+ this.switchU = true;
21658
+ this.switchV = true;
21659
+ this.switchN = true;
21660
+ } else {
21661
+ this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
21662
+ this.switchV = false;
21663
+ this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
21664
+ }
21515
21665
  };
21516
21666
 
21517
21667
  RegExpValidationState.prototype.raise = function raise (message) {
@@ -21580,6 +21730,23 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
21580
21730
  return false
21581
21731
  };
21582
21732
 
21733
+ RegExpValidationState.prototype.eatChars = function eatChars (chs, forceU) {
21734
+ if ( forceU === void 0 ) forceU = false;
21735
+
21736
+ var pos = this.pos;
21737
+ for (var i = 0, list = chs; i < list.length; i += 1) {
21738
+ var ch = list[i];
21739
+
21740
+ var current = this.at(pos, forceU);
21741
+ if (current === -1 || current !== ch) {
21742
+ return false
21743
+ }
21744
+ pos = this.nextIndex(pos, forceU);
21745
+ }
21746
+ this.pos = pos;
21747
+ return true
21748
+ };
21749
+
21583
21750
  /**
21584
21751
  * Validate the flags part of a given RegExpLiteral.
21585
21752
  *
@@ -21590,6 +21757,9 @@ pp$1.validateRegExpFlags = function(state) {
21590
21757
  var validFlags = state.validFlags;
21591
21758
  var flags = state.flags;
21592
21759
 
21760
+ var u = false;
21761
+ var v = false;
21762
+
21593
21763
  for (var i = 0; i < flags.length; i++) {
21594
21764
  var flag = flags.charAt(i);
21595
21765
  if (validFlags.indexOf(flag) === -1) {
@@ -21598,6 +21768,11 @@ pp$1.validateRegExpFlags = function(state) {
21598
21768
  if (flags.indexOf(flag, i + 1) > -1) {
21599
21769
  this.raise(state.start, "Duplicate regular expression flag");
21600
21770
  }
21771
+ if (flag === "u") { u = true; }
21772
+ if (flag === "v") { v = true; }
21773
+ }
21774
+ if (this.options.ecmaVersion >= 15 && u && v) {
21775
+ this.raise(state.start, "Invalid regular expression flag");
21601
21776
  }
21602
21777
  };
21603
21778
 
@@ -22216,6 +22391,12 @@ pp$1.regexp_eatDecimalEscape = function(state) {
22216
22391
  return false
22217
22392
  };
22218
22393
 
22394
+ // Return values used by character set parsing methods, needed to
22395
+ // forbid negation of sets that can match strings.
22396
+ var CharSetNone = 0; // Nothing parsed
22397
+ var CharSetOk = 1; // Construct parsed, cannot contain strings
22398
+ var CharSetString = 2; // Construct parsed, can contain strings
22399
+
22219
22400
  // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
22220
22401
  pp$1.regexp_eatCharacterClassEscape = function(state) {
22221
22402
  var ch = state.current();
@@ -22223,28 +22404,32 @@ pp$1.regexp_eatCharacterClassEscape = function(state) {
22223
22404
  if (isCharacterClassEscape(ch)) {
22224
22405
  state.lastIntValue = -1;
22225
22406
  state.advance();
22226
- return true
22407
+ return CharSetOk
22227
22408
  }
22228
22409
 
22410
+ var negate = false;
22229
22411
  if (
22230
22412
  state.switchU &&
22231
22413
  this.options.ecmaVersion >= 9 &&
22232
- (ch === 0x50 /* P */ || ch === 0x70 /* p */)
22414
+ ((negate = ch === 0x50 /* P */) || ch === 0x70 /* p */)
22233
22415
  ) {
22234
22416
  state.lastIntValue = -1;
22235
22417
  state.advance();
22418
+ var result;
22236
22419
  if (
22237
22420
  state.eat(0x7B /* { */) &&
22238
- this.regexp_eatUnicodePropertyValueExpression(state) &&
22421
+ (result = this.regexp_eatUnicodePropertyValueExpression(state)) &&
22239
22422
  state.eat(0x7D /* } */)
22240
22423
  ) {
22241
- return true
22424
+ if (negate && result === CharSetString) { state.raise("Invalid property name"); }
22425
+ return result
22242
22426
  }
22243
22427
  state.raise("Invalid property name");
22244
22428
  }
22245
22429
 
22246
- return false
22430
+ return CharSetNone
22247
22431
  };
22432
+
22248
22433
  function isCharacterClassEscape(ch) {
22249
22434
  return (
22250
22435
  ch === 0x64 /* d */ ||
@@ -22268,7 +22453,7 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
22268
22453
  if (this.regexp_eatUnicodePropertyValue(state)) {
22269
22454
  var value = state.lastStringValue;
22270
22455
  this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
22271
- return true
22456
+ return CharSetOk
22272
22457
  }
22273
22458
  }
22274
22459
  state.pos = start;
@@ -22276,20 +22461,22 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
22276
22461
  // LoneUnicodePropertyNameOrValue
22277
22462
  if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
22278
22463
  var nameOrValue = state.lastStringValue;
22279
- this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue);
22280
- return true
22464
+ return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)
22281
22465
  }
22282
- return false
22466
+ return CharSetNone
22283
22467
  };
22468
+
22284
22469
  pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
22285
22470
  if (!hasOwn(state.unicodeProperties.nonBinary, name))
22286
22471
  { state.raise("Invalid property name"); }
22287
22472
  if (!state.unicodeProperties.nonBinary[name].test(value))
22288
22473
  { state.raise("Invalid property value"); }
22289
22474
  };
22475
+
22290
22476
  pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
22291
- if (!state.unicodeProperties.binary.test(nameOrValue))
22292
- { state.raise("Invalid property name"); }
22477
+ if (state.unicodeProperties.binary.test(nameOrValue)) { return CharSetOk }
22478
+ if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) { return CharSetString }
22479
+ state.raise("Invalid property name");
22293
22480
  };
22294
22481
 
22295
22482
  // UnicodePropertyName ::
@@ -22303,6 +22490,7 @@ pp$1.regexp_eatUnicodePropertyName = function(state) {
22303
22490
  }
22304
22491
  return state.lastStringValue !== ""
22305
22492
  };
22493
+
22306
22494
  function isUnicodePropertyNameCharacter(ch) {
22307
22495
  return isControlLetter(ch) || ch === 0x5F /* _ */
22308
22496
  }
@@ -22331,21 +22519,29 @@ pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
22331
22519
  // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
22332
22520
  pp$1.regexp_eatCharacterClass = function(state) {
22333
22521
  if (state.eat(0x5B /* [ */)) {
22334
- state.eat(0x5E /* ^ */);
22335
- this.regexp_classRanges(state);
22336
- if (state.eat(0x5D /* ] */)) {
22337
- return true
22338
- }
22339
- // Unreachable since it threw "unterminated regular expression" error before.
22340
- state.raise("Unterminated character class");
22522
+ var negate = state.eat(0x5E /* ^ */);
22523
+ var result = this.regexp_classContents(state);
22524
+ if (!state.eat(0x5D /* ] */))
22525
+ { state.raise("Unterminated character class"); }
22526
+ if (negate && result === CharSetString)
22527
+ { state.raise("Negated character class may contain strings"); }
22528
+ return true
22341
22529
  }
22342
22530
  return false
22343
22531
  };
22344
22532
 
22533
+ // https://tc39.es/ecma262/#prod-ClassContents
22345
22534
  // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
22535
+ pp$1.regexp_classContents = function(state) {
22536
+ if (state.current() === 0x5D /* ] */) { return CharSetOk }
22537
+ if (state.switchV) { return this.regexp_classSetExpression(state) }
22538
+ this.regexp_nonEmptyClassRanges(state);
22539
+ return CharSetOk
22540
+ };
22541
+
22346
22542
  // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
22347
22543
  // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
22348
- pp$1.regexp_classRanges = function(state) {
22544
+ pp$1.regexp_nonEmptyClassRanges = function(state) {
22349
22545
  while (this.regexp_eatClassAtom(state)) {
22350
22546
  var left = state.lastIntValue;
22351
22547
  if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
@@ -22417,6 +22613,205 @@ pp$1.regexp_eatClassEscape = function(state) {
22417
22613
  )
22418
22614
  };
22419
22615
 
22616
+ // https://tc39.es/ecma262/#prod-ClassSetExpression
22617
+ // https://tc39.es/ecma262/#prod-ClassUnion
22618
+ // https://tc39.es/ecma262/#prod-ClassIntersection
22619
+ // https://tc39.es/ecma262/#prod-ClassSubtraction
22620
+ pp$1.regexp_classSetExpression = function(state) {
22621
+ var result = CharSetOk, subResult;
22622
+ if (this.regexp_eatClassSetRange(state)) ; else if (subResult = this.regexp_eatClassSetOperand(state)) {
22623
+ if (subResult === CharSetString) { result = CharSetString; }
22624
+ // https://tc39.es/ecma262/#prod-ClassIntersection
22625
+ var start = state.pos;
22626
+ while (state.eatChars([0x26, 0x26] /* && */)) {
22627
+ if (
22628
+ state.current() !== 0x26 /* & */ &&
22629
+ (subResult = this.regexp_eatClassSetOperand(state))
22630
+ ) {
22631
+ if (subResult !== CharSetString) { result = CharSetOk; }
22632
+ continue
22633
+ }
22634
+ state.raise("Invalid character in character class");
22635
+ }
22636
+ if (start !== state.pos) { return result }
22637
+ // https://tc39.es/ecma262/#prod-ClassSubtraction
22638
+ while (state.eatChars([0x2D, 0x2D] /* -- */)) {
22639
+ if (this.regexp_eatClassSetOperand(state)) { continue }
22640
+ state.raise("Invalid character in character class");
22641
+ }
22642
+ if (start !== state.pos) { return result }
22643
+ } else {
22644
+ state.raise("Invalid character in character class");
22645
+ }
22646
+ // https://tc39.es/ecma262/#prod-ClassUnion
22647
+ for (;;) {
22648
+ if (this.regexp_eatClassSetRange(state)) { continue }
22649
+ subResult = this.regexp_eatClassSetOperand(state);
22650
+ if (!subResult) { return result }
22651
+ if (subResult === CharSetString) { result = CharSetString; }
22652
+ }
22653
+ };
22654
+
22655
+ // https://tc39.es/ecma262/#prod-ClassSetRange
22656
+ pp$1.regexp_eatClassSetRange = function(state) {
22657
+ var start = state.pos;
22658
+ if (this.regexp_eatClassSetCharacter(state)) {
22659
+ var left = state.lastIntValue;
22660
+ if (state.eat(0x2D /* - */) && this.regexp_eatClassSetCharacter(state)) {
22661
+ var right = state.lastIntValue;
22662
+ if (left !== -1 && right !== -1 && left > right) {
22663
+ state.raise("Range out of order in character class");
22664
+ }
22665
+ return true
22666
+ }
22667
+ state.pos = start;
22668
+ }
22669
+ return false
22670
+ };
22671
+
22672
+ // https://tc39.es/ecma262/#prod-ClassSetOperand
22673
+ pp$1.regexp_eatClassSetOperand = function(state) {
22674
+ if (this.regexp_eatClassSetCharacter(state)) { return CharSetOk }
22675
+ return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state)
22676
+ };
22677
+
22678
+ // https://tc39.es/ecma262/#prod-NestedClass
22679
+ pp$1.regexp_eatNestedClass = function(state) {
22680
+ var start = state.pos;
22681
+ if (state.eat(0x5B /* [ */)) {
22682
+ var negate = state.eat(0x5E /* ^ */);
22683
+ var result = this.regexp_classContents(state);
22684
+ if (state.eat(0x5D /* ] */)) {
22685
+ if (negate && result === CharSetString) {
22686
+ state.raise("Negated character class may contain strings");
22687
+ }
22688
+ return result
22689
+ }
22690
+ state.pos = start;
22691
+ }
22692
+ if (state.eat(0x5C /* \ */)) {
22693
+ var result$1 = this.regexp_eatCharacterClassEscape(state);
22694
+ if (result$1) {
22695
+ return result$1
22696
+ }
22697
+ state.pos = start;
22698
+ }
22699
+ return null
22700
+ };
22701
+
22702
+ // https://tc39.es/ecma262/#prod-ClassStringDisjunction
22703
+ pp$1.regexp_eatClassStringDisjunction = function(state) {
22704
+ var start = state.pos;
22705
+ if (state.eatChars([0x5C, 0x71] /* \q */)) {
22706
+ if (state.eat(0x7B /* { */)) {
22707
+ var result = this.regexp_classStringDisjunctionContents(state);
22708
+ if (state.eat(0x7D /* } */)) {
22709
+ return result
22710
+ }
22711
+ } else {
22712
+ // Make the same message as V8.
22713
+ state.raise("Invalid escape");
22714
+ }
22715
+ state.pos = start;
22716
+ }
22717
+ return null
22718
+ };
22719
+
22720
+ // https://tc39.es/ecma262/#prod-ClassStringDisjunctionContents
22721
+ pp$1.regexp_classStringDisjunctionContents = function(state) {
22722
+ var result = this.regexp_classString(state);
22723
+ while (state.eat(0x7C /* | */)) {
22724
+ if (this.regexp_classString(state) === CharSetString) { result = CharSetString; }
22725
+ }
22726
+ return result
22727
+ };
22728
+
22729
+ // https://tc39.es/ecma262/#prod-ClassString
22730
+ // https://tc39.es/ecma262/#prod-NonEmptyClassString
22731
+ pp$1.regexp_classString = function(state) {
22732
+ var count = 0;
22733
+ while (this.regexp_eatClassSetCharacter(state)) { count++; }
22734
+ return count === 1 ? CharSetOk : CharSetString
22735
+ };
22736
+
22737
+ // https://tc39.es/ecma262/#prod-ClassSetCharacter
22738
+ pp$1.regexp_eatClassSetCharacter = function(state) {
22739
+ var start = state.pos;
22740
+ if (state.eat(0x5C /* \ */)) {
22741
+ if (
22742
+ this.regexp_eatCharacterEscape(state) ||
22743
+ this.regexp_eatClassSetReservedPunctuator(state)
22744
+ ) {
22745
+ return true
22746
+ }
22747
+ if (state.eat(0x62 /* b */)) {
22748
+ state.lastIntValue = 0x08; /* <BS> */
22749
+ return true
22750
+ }
22751
+ state.pos = start;
22752
+ return false
22753
+ }
22754
+ var ch = state.current();
22755
+ if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) { return false }
22756
+ if (isClassSetSyntaxCharacter(ch)) { return false }
22757
+ state.advance();
22758
+ state.lastIntValue = ch;
22759
+ return true
22760
+ };
22761
+
22762
+ // https://tc39.es/ecma262/#prod-ClassSetReservedDoublePunctuator
22763
+ function isClassSetReservedDoublePunctuatorCharacter(ch) {
22764
+ return (
22765
+ ch === 0x21 /* ! */ ||
22766
+ ch >= 0x23 /* # */ && ch <= 0x26 /* & */ ||
22767
+ ch >= 0x2A /* * */ && ch <= 0x2C /* , */ ||
22768
+ ch === 0x2E /* . */ ||
22769
+ ch >= 0x3A /* : */ && ch <= 0x40 /* @ */ ||
22770
+ ch === 0x5E /* ^ */ ||
22771
+ ch === 0x60 /* ` */ ||
22772
+ ch === 0x7E /* ~ */
22773
+ )
22774
+ }
22775
+
22776
+ // https://tc39.es/ecma262/#prod-ClassSetSyntaxCharacter
22777
+ function isClassSetSyntaxCharacter(ch) {
22778
+ return (
22779
+ ch === 0x28 /* ( */ ||
22780
+ ch === 0x29 /* ) */ ||
22781
+ ch === 0x2D /* - */ ||
22782
+ ch === 0x2F /* / */ ||
22783
+ ch >= 0x5B /* [ */ && ch <= 0x5D /* ] */ ||
22784
+ ch >= 0x7B /* { */ && ch <= 0x7D /* } */
22785
+ )
22786
+ }
22787
+
22788
+ // https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
22789
+ pp$1.regexp_eatClassSetReservedPunctuator = function(state) {
22790
+ var ch = state.current();
22791
+ if (isClassSetReservedPunctuator(ch)) {
22792
+ state.lastIntValue = ch;
22793
+ state.advance();
22794
+ return true
22795
+ }
22796
+ return false
22797
+ };
22798
+
22799
+ // https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
22800
+ function isClassSetReservedPunctuator(ch) {
22801
+ return (
22802
+ ch === 0x21 /* ! */ ||
22803
+ ch === 0x23 /* # */ ||
22804
+ ch === 0x25 /* % */ ||
22805
+ ch === 0x26 /* & */ ||
22806
+ ch === 0x2C /* , */ ||
22807
+ ch === 0x2D /* - */ ||
22808
+ ch >= 0x3A /* : */ && ch <= 0x3E /* > */ ||
22809
+ ch === 0x40 /* @ */ ||
22810
+ ch === 0x60 /* ` */ ||
22811
+ ch === 0x7E /* ~ */
22812
+ )
22813
+ }
22814
+
22420
22815
  // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
22421
22816
  pp$1.regexp_eatClassControlLetter = function(state) {
22422
22817
  var ch = state.current();
@@ -23337,8 +23732,23 @@ pp.readWord = function() {
23337
23732
  };
23338
23733
 
23339
23734
  // Acorn is a tiny, fast JavaScript parser written in JavaScript.
23735
+ //
23736
+ // Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
23737
+ // various contributors and released under an MIT license.
23738
+ //
23739
+ // Git repositories for Acorn are available at
23740
+ //
23741
+ // http://marijnhaverbeke.nl/git/acorn
23742
+ // https://github.com/acornjs/acorn.git
23743
+ //
23744
+ // Please use the [github bug tracker][ghbt] to report issues.
23745
+ //
23746
+ // [ghbt]: https://github.com/acornjs/acorn/issues
23747
+ //
23748
+ // [walk]: util/walk.js
23749
+
23340
23750
 
23341
- var version = "8.8.2";
23751
+ var version = "8.9.0";
23342
23752
 
23343
23753
  Parser.acorn = {
23344
23754
  Parser: Parser,
@@ -23768,7 +24178,7 @@ async function transform(source, module, pluginDriver, log) {
23768
24178
  let customTransformCache = false;
23769
24179
  const useCustomTransformCache = () => (customTransformCache = true);
23770
24180
  let pluginName = '';
23771
- const currentSource = source.code;
24181
+ let currentSource = source.code;
23772
24182
  function transformReducer(previousCode, result, plugin) {
23773
24183
  let code;
23774
24184
  let map;
@@ -23796,6 +24206,7 @@ async function transform(source, module, pluginDriver, log) {
23796
24206
  plugin: plugin.name
23797
24207
  });
23798
24208
  }
24209
+ currentSource = code;
23799
24210
  return code;
23800
24211
  }
23801
24212
  const getLogHandler = (handler) => (log, pos) => {