rollup 2.47.0 → 2.48.0

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 v2.47.0
4
- Tue, 04 May 2021 05:02:40 GMT - commit 6cc9d6b5137dd80fef9618e97471f89f8fbc54ad
3
+ Rollup.js v2.48.0
4
+ Sat, 15 May 2021 04:50:11 GMT - commit 07b3a02069594147665daa95d3fa3e041a82b2d0
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -32,7 +32,7 @@ function _interopNamespaceDefaultOnly(e) {
32
32
 
33
33
  var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
34
34
 
35
- var version$1 = "2.47.0";
35
+ var version$1 = "2.48.0";
36
36
 
37
37
  function ensureArray(items) {
38
38
  if (Array.isArray(items)) {
@@ -112,21 +112,6 @@ var fseventsImporter = {
112
112
  getFsEvents: getFsEvents
113
113
  };
114
114
 
115
- function getAugmentedNamespace(n) {
116
- if (n.__esModule) return n;
117
- var a = Object.defineProperty({}, '__esModule', {value: true});
118
- Object.keys(n).forEach(function (k) {
119
- var d = Object.getOwnPropertyDescriptor(n, k);
120
- Object.defineProperty(a, k, d.get ? d : {
121
- enumerable: true,
122
- get: function () {
123
- return n[k];
124
- }
125
- });
126
- });
127
- return a;
128
- }
129
-
130
115
  var charToInteger = {};
131
116
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
132
117
  for (var i = 0; i < chars$1.length; i++) {
@@ -4463,17 +4448,18 @@ class NamespaceVariable extends Variable {
4463
4448
  this.name = identifier.name;
4464
4449
  }
4465
4450
  deoptimizePath(path) {
4451
+ var _a;
4466
4452
  const memberVariables = this.getMemberVariables();
4467
4453
  const memberPath = path.length <= 1 ? UNKNOWN_PATH : path.slice(1);
4468
4454
  const key = path[0];
4469
- if (typeof key !== 'string') {
4455
+ if (typeof key === 'string') {
4456
+ (_a = memberVariables[key]) === null || _a === void 0 ? void 0 : _a.deoptimizePath(memberPath);
4457
+ }
4458
+ else {
4470
4459
  for (const key of Object.keys(memberVariables)) {
4471
4460
  memberVariables[key].deoptimizePath(memberPath);
4472
4461
  }
4473
4462
  }
4474
- else {
4475
- memberVariables[key].deoptimizePath(memberPath);
4476
- }
4477
4463
  }
4478
4464
  getMemberVariables() {
4479
4465
  if (this.memberVariables) {
@@ -6862,7 +6848,8 @@ class CallExpression extends NodeBase {
6862
6848
  if (argument.hasEffects(context))
6863
6849
  return true;
6864
6850
  }
6865
- if (this.context.options.treeshake.annotations && ((_a = this.annotations) === null || _a === void 0 ? void 0 : _a.some((a) => a.pure)))
6851
+ if (this.context.options.treeshake.annotations &&
6852
+ ((_a = this.annotations) === null || _a === void 0 ? void 0 : _a.some((a) => a.pure)))
6866
6853
  return false;
6867
6854
  return (this.callee.hasEffects(context) ||
6868
6855
  this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
@@ -8155,7 +8142,8 @@ class NewExpression extends NodeBase {
8155
8142
  if (argument.hasEffects(context))
8156
8143
  return true;
8157
8144
  }
8158
- if (this.context.options.treeshake.annotations && ((_a = this.annotations) === null || _a === void 0 ? void 0 : _a.some((a) => a.pure)))
8145
+ if (this.context.options.treeshake.annotations &&
8146
+ ((_a = this.annotations) === null || _a === void 0 ? void 0 : _a.some((a) => a.pure)))
8159
8147
  return false;
8160
8148
  return (this.callee.hasEffects(context) ||
8161
8149
  this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
@@ -11182,12 +11170,11 @@ class Chunk {
11182
11170
  if (isAbsolute(id)) {
11183
11171
  const extension = path.extname(id);
11184
11172
  const pattern = unsetOptions.has('entryFileNames')
11185
- ? NON_ASSET_EXTENSIONS.includes(extension)
11186
- ? '[name].js'
11187
- : '[name][extname].js'
11173
+ ? '[name][assetExtname].js'
11188
11174
  : options.entryFileNames;
11189
11175
  const currentDir = path.dirname(sanitizedId);
11190
11176
  const fileName = renderNamePattern(typeof pattern === 'function' ? pattern(this.getChunkInfo()) : pattern, 'output.entryFileNames', {
11177
+ assetExtname: () => NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension,
11191
11178
  ext: () => extension.substr(1),
11192
11179
  extname: () => extension,
11193
11180
  format: () => options.format,
@@ -12823,6 +12810,7 @@ var types = {
12823
12810
  regexp: new TokenType("regexp", startsExpr),
12824
12811
  string: new TokenType("string", startsExpr),
12825
12812
  name: new TokenType("name", startsExpr),
12813
+ privateId: new TokenType("privateId", startsExpr),
12826
12814
  eof: new TokenType("eof"),
12827
12815
 
12828
12816
  // Punctuation token types.
@@ -13017,7 +13005,8 @@ var defaultOptions = {
13017
13005
  // error.
13018
13006
  allowReturnOutsideFunction: false,
13019
13007
  // When enabled, import/export statements are not constrained to
13020
- // appearing at the top of the program.
13008
+ // appearing at the top of the program, and an import.meta expression
13009
+ // in a script isn't considered an error.
13021
13010
  allowImportExportEverywhere: false,
13022
13011
  // When enabled, await identifiers are allowed to appear at the top-level scope,
13023
13012
  // but they are still not allowed in non-async functions.
@@ -13208,6 +13197,7 @@ var Parser = function Parser(options, input, startPos) {
13208
13197
 
13209
13198
  // Used to signify the start of a potential arrow function
13210
13199
  this.potentialArrowAt = -1;
13200
+ this.potentialArrowInForAwait = false;
13211
13201
 
13212
13202
  // Positions to delayed-check that yield/await does not exist in default parameters.
13213
13203
  this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
@@ -13226,6 +13216,11 @@ var Parser = function Parser(options, input, startPos) {
13226
13216
 
13227
13217
  // For RegExp validation
13228
13218
  this.regexpState = null;
13219
+
13220
+ // The stack of private names.
13221
+ // Each element has two properties: 'declared' and 'used'.
13222
+ // When it exited from the outermost class definition, all used private names must be declared.
13223
+ this.privateNameStack = [];
13229
13224
  };
13230
13225
 
13231
13226
  var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },inNonArrowFunction: { configurable: true } };
@@ -13237,12 +13232,22 @@ Parser.prototype.parse = function parse () {
13237
13232
  };
13238
13233
 
13239
13234
  prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
13240
- prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 };
13241
- prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 };
13242
- prototypeAccessors.allowSuper.get = function () { return (this.currentThisScope().flags & SCOPE_SUPER) > 0 };
13235
+ prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
13236
+ prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
13237
+ prototypeAccessors.allowSuper.get = function () {
13238
+ var ref = this.currentThisScope();
13239
+ var flags = ref.flags;
13240
+ var inClassFieldInit = ref.inClassFieldInit;
13241
+ return (flags & SCOPE_SUPER) > 0 || inClassFieldInit
13242
+ };
13243
13243
  prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
13244
13244
  prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
13245
- prototypeAccessors.inNonArrowFunction.get = function () { return (this.currentThisScope().flags & SCOPE_FUNCTION) > 0 };
13245
+ prototypeAccessors.inNonArrowFunction.get = function () {
13246
+ var ref = this.currentThisScope();
13247
+ var flags = ref.flags;
13248
+ var inClassFieldInit = ref.inClassFieldInit;
13249
+ return (flags & SCOPE_FUNCTION) > 0 || inClassFieldInit
13250
+ };
13246
13251
 
13247
13252
  Parser.extend = function extend () {
13248
13253
  var plugins = [], len = arguments.length;
@@ -13649,7 +13654,7 @@ pp$1.parseForStatement = function(node) {
13649
13654
  return this.parseFor(node, init$1)
13650
13655
  }
13651
13656
  var refDestructuringErrors = new DestructuringErrors;
13652
- var init = this.parseExpression(true, refDestructuringErrors);
13657
+ var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
13653
13658
  if (this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
13654
13659
  if (this.options.ecmaVersion >= 9) {
13655
13660
  if (this.type === types._in) {
@@ -13995,6 +14000,7 @@ pp$1.parseClass = function(node, isStatement) {
13995
14000
 
13996
14001
  this.parseClassId(node, isStatement);
13997
14002
  this.parseClassSuper(node);
14003
+ var privateNameMap = this.enterClassBody();
13998
14004
  var classBody = this.startNode();
13999
14005
  var hadConstructor = false;
14000
14006
  classBody.body = [];
@@ -14006,77 +14012,154 @@ pp$1.parseClass = function(node, isStatement) {
14006
14012
  if (element.type === "MethodDefinition" && element.kind === "constructor") {
14007
14013
  if (hadConstructor) { this.raise(element.start, "Duplicate constructor in the same class"); }
14008
14014
  hadConstructor = true;
14015
+ } else if (element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
14016
+ this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared"));
14009
14017
  }
14010
14018
  }
14011
14019
  }
14012
14020
  this.strict = oldStrict;
14013
14021
  this.next();
14014
14022
  node.body = this.finishNode(classBody, "ClassBody");
14023
+ this.exitClassBody();
14015
14024
  return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
14016
14025
  };
14017
14026
 
14018
14027
  pp$1.parseClassElement = function(constructorAllowsSuper) {
14019
- var this$1 = this;
14020
-
14021
14028
  if (this.eat(types.semi)) { return null }
14022
14029
 
14023
- var method = this.startNode();
14024
- var tryContextual = function (k, noLineBreak) {
14025
- if ( noLineBreak === void 0 ) noLineBreak = false;
14026
-
14027
- var start = this$1.start, startLoc = this$1.startLoc;
14028
- if (!this$1.eatContextual(k)) { return false }
14029
- if (this$1.type !== types.parenL && (!noLineBreak || !this$1.canInsertSemicolon())) { return true }
14030
- if (method.key) { this$1.unexpected(); }
14031
- method.computed = false;
14032
- method.key = this$1.startNodeAt(start, startLoc);
14033
- method.key.name = k;
14034
- this$1.finishNode(method.key, "Identifier");
14035
- return false
14036
- };
14037
-
14038
- method.kind = "method";
14039
- method.static = tryContextual("static");
14040
- var isGenerator = this.eat(types.star);
14030
+ var ecmaVersion = this.options.ecmaVersion;
14031
+ var node = this.startNode();
14032
+ var keyName = "";
14033
+ var isGenerator = false;
14041
14034
  var isAsync = false;
14042
- if (!isGenerator) {
14043
- if (this.options.ecmaVersion >= 8 && tryContextual("async", true)) {
14035
+ var kind = "method";
14036
+
14037
+ // Parse modifiers
14038
+ node.static = false;
14039
+ if (this.eatContextual("static")) {
14040
+ if (this.isClassElementNameStart() || this.type === types.star) {
14041
+ node.static = true;
14042
+ } else {
14043
+ keyName = "static";
14044
+ }
14045
+ }
14046
+ if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
14047
+ if ((this.isClassElementNameStart() || this.type === types.star) && !this.canInsertSemicolon()) {
14044
14048
  isAsync = true;
14045
- isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);
14046
- } else if (tryContextual("get")) {
14047
- method.kind = "get";
14048
- } else if (tryContextual("set")) {
14049
- method.kind = "set";
14049
+ } else {
14050
+ keyName = "async";
14051
+ }
14052
+ }
14053
+ if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types.star)) {
14054
+ isGenerator = true;
14055
+ }
14056
+ if (!keyName && !isAsync && !isGenerator) {
14057
+ var lastValue = this.value;
14058
+ if (this.eatContextual("get") || this.eatContextual("set")) {
14059
+ if (this.isClassElementNameStart()) {
14060
+ kind = lastValue;
14061
+ } else {
14062
+ keyName = lastValue;
14063
+ }
14064
+ }
14065
+ }
14066
+
14067
+ // Parse element name
14068
+ if (keyName) {
14069
+ // 'async', 'get', 'set', or 'static' were not a keyword contextually.
14070
+ // The last token is any of those. Make it the element name.
14071
+ node.computed = false;
14072
+ node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);
14073
+ node.key.name = keyName;
14074
+ this.finishNode(node.key, "Identifier");
14075
+ } else {
14076
+ this.parseClassElementName(node);
14077
+ }
14078
+
14079
+ // Parse element value
14080
+ if (ecmaVersion < 13 || this.type === types.parenL || kind !== "method" || isGenerator || isAsync) {
14081
+ var isConstructor = !node.static && checkKeyName(node, "constructor");
14082
+ var allowsDirectSuper = isConstructor && constructorAllowsSuper;
14083
+ // Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
14084
+ if (isConstructor && kind !== "method") { this.raise(node.key.start, "Constructor can't have get/set modifier"); }
14085
+ node.kind = isConstructor ? "constructor" : kind;
14086
+ this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper);
14087
+ } else {
14088
+ this.parseClassField(node);
14089
+ }
14090
+
14091
+ return node
14092
+ };
14093
+
14094
+ pp$1.isClassElementNameStart = function() {
14095
+ return (
14096
+ this.type === types.name ||
14097
+ this.type === types.privateId ||
14098
+ this.type === types.num ||
14099
+ this.type === types.string ||
14100
+ this.type === types.bracketL ||
14101
+ this.type.keyword
14102
+ )
14103
+ };
14104
+
14105
+ pp$1.parseClassElementName = function(element) {
14106
+ if (this.type === types.privateId) {
14107
+ if (this.value === "constructor") {
14108
+ this.raise(this.start, "Classes can't have an element named '#constructor'");
14050
14109
  }
14110
+ element.computed = false;
14111
+ element.key = this.parsePrivateIdent();
14112
+ } else {
14113
+ this.parsePropertyName(element);
14051
14114
  }
14052
- if (!method.key) { this.parsePropertyName(method); }
14115
+ };
14116
+
14117
+ pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
14118
+ // Check key and flags
14053
14119
  var key = method.key;
14054
- var allowsDirectSuper = false;
14055
- if (!method.computed && !method.static && (key.type === "Identifier" && key.name === "constructor" ||
14056
- key.type === "Literal" && key.value === "constructor")) {
14057
- if (method.kind !== "method") { this.raise(key.start, "Constructor can't have get/set modifier"); }
14120
+ if (method.kind === "constructor") {
14058
14121
  if (isGenerator) { this.raise(key.start, "Constructor can't be a generator"); }
14059
14122
  if (isAsync) { this.raise(key.start, "Constructor can't be an async method"); }
14060
- method.kind = "constructor";
14061
- allowsDirectSuper = constructorAllowsSuper;
14062
- } else if (method.static && key.type === "Identifier" && key.name === "prototype") {
14123
+ } else if (method.static && checkKeyName(method, "prototype")) {
14063
14124
  this.raise(key.start, "Classes may not have a static property named prototype");
14064
14125
  }
14065
- this.parseClassMethod(method, isGenerator, isAsync, allowsDirectSuper);
14066
- if (method.kind === "get" && method.value.params.length !== 0)
14067
- { this.raiseRecoverable(method.value.start, "getter should have no params"); }
14068
- if (method.kind === "set" && method.value.params.length !== 1)
14069
- { this.raiseRecoverable(method.value.start, "setter should have exactly one param"); }
14070
- if (method.kind === "set" && method.value.params[0].type === "RestElement")
14071
- { this.raiseRecoverable(method.value.params[0].start, "Setter cannot use rest params"); }
14072
- return method
14073
- };
14074
14126
 
14075
- pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
14076
- method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
14127
+ // Parse value
14128
+ var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
14129
+
14130
+ // Check value
14131
+ if (method.kind === "get" && value.params.length !== 0)
14132
+ { this.raiseRecoverable(value.start, "getter should have no params"); }
14133
+ if (method.kind === "set" && value.params.length !== 1)
14134
+ { this.raiseRecoverable(value.start, "setter should have exactly one param"); }
14135
+ if (method.kind === "set" && value.params[0].type === "RestElement")
14136
+ { this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params"); }
14137
+
14077
14138
  return this.finishNode(method, "MethodDefinition")
14078
14139
  };
14079
14140
 
14141
+ pp$1.parseClassField = function(field) {
14142
+ if (checkKeyName(field, "constructor")) {
14143
+ this.raise(field.key.start, "Classes can't have a field named 'constructor'");
14144
+ } else if (field.static && checkKeyName(field, "prototype")) {
14145
+ this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
14146
+ }
14147
+
14148
+ if (this.eat(types.eq)) {
14149
+ // To raise SyntaxError if 'arguments' exists in the initializer.
14150
+ var scope = this.currentThisScope();
14151
+ var inClassFieldInit = scope.inClassFieldInit;
14152
+ scope.inClassFieldInit = true;
14153
+ field.value = this.parseMaybeAssign();
14154
+ scope.inClassFieldInit = inClassFieldInit;
14155
+ } else {
14156
+ field.value = null;
14157
+ }
14158
+ this.semicolon();
14159
+
14160
+ return this.finishNode(field, "PropertyDefinition")
14161
+ };
14162
+
14080
14163
  pp$1.parseClassId = function(node, isStatement) {
14081
14164
  if (this.type === types.name) {
14082
14165
  node.id = this.parseIdent();
@@ -14093,6 +14176,65 @@ pp$1.parseClassSuper = function(node) {
14093
14176
  node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null;
14094
14177
  };
14095
14178
 
14179
+ pp$1.enterClassBody = function() {
14180
+ var element = {declared: Object.create(null), used: []};
14181
+ this.privateNameStack.push(element);
14182
+ return element.declared
14183
+ };
14184
+
14185
+ pp$1.exitClassBody = function() {
14186
+ var ref = this.privateNameStack.pop();
14187
+ var declared = ref.declared;
14188
+ var used = ref.used;
14189
+ var len = this.privateNameStack.length;
14190
+ var parent = len === 0 ? null : this.privateNameStack[len - 1];
14191
+ for (var i = 0; i < used.length; ++i) {
14192
+ var id = used[i];
14193
+ if (!has(declared, id.name)) {
14194
+ if (parent) {
14195
+ parent.used.push(id);
14196
+ } else {
14197
+ this.raiseRecoverable(id.start, ("Private field '#" + (id.name) + "' must be declared in an enclosing class"));
14198
+ }
14199
+ }
14200
+ }
14201
+ };
14202
+
14203
+ function isPrivateNameConflicted(privateNameMap, element) {
14204
+ var name = element.key.name;
14205
+ var curr = privateNameMap[name];
14206
+
14207
+ var next = "true";
14208
+ if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) {
14209
+ next = (element.static ? "s" : "i") + element.kind;
14210
+ }
14211
+
14212
+ // `class { get #a(){}; static set #a(_){} }` is also conflict.
14213
+ if (
14214
+ curr === "iget" && next === "iset" ||
14215
+ curr === "iset" && next === "iget" ||
14216
+ curr === "sget" && next === "sset" ||
14217
+ curr === "sset" && next === "sget"
14218
+ ) {
14219
+ privateNameMap[name] = "true";
14220
+ return false
14221
+ } else if (!curr) {
14222
+ privateNameMap[name] = next;
14223
+ return false
14224
+ } else {
14225
+ return true
14226
+ }
14227
+ }
14228
+
14229
+ function checkKeyName(node, name) {
14230
+ var computed = node.computed;
14231
+ var key = node.key;
14232
+ return !computed && (
14233
+ key.type === "Identifier" && key.name === name ||
14234
+ key.type === "Literal" && key.value === name
14235
+ )
14236
+ }
14237
+
14096
14238
  // Parses module export declaration.
14097
14239
 
14098
14240
  pp$1.parseExport = function(node, exports) {
@@ -14711,13 +14853,13 @@ pp$3.checkPropClash = function(prop, propHash, refDestructuringErrors) {
14711
14853
  // and object pattern might appear (so it's possible to raise
14712
14854
  // delayed syntax error at correct position).
14713
14855
 
14714
- pp$3.parseExpression = function(noIn, refDestructuringErrors) {
14856
+ pp$3.parseExpression = function(forInit, refDestructuringErrors) {
14715
14857
  var startPos = this.start, startLoc = this.startLoc;
14716
- var expr = this.parseMaybeAssign(noIn, refDestructuringErrors);
14858
+ var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
14717
14859
  if (this.type === types.comma) {
14718
14860
  var node = this.startNodeAt(startPos, startLoc);
14719
14861
  node.expressions = [expr];
14720
- while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(noIn, refDestructuringErrors)); }
14862
+ while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
14721
14863
  return this.finishNode(node, "SequenceExpression")
14722
14864
  }
14723
14865
  return expr
@@ -14726,9 +14868,9 @@ pp$3.parseExpression = function(noIn, refDestructuringErrors) {
14726
14868
  // Parse an assignment expression. This includes applications of
14727
14869
  // operators like `+=`.
14728
14870
 
14729
- pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
14871
+ pp$3.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
14730
14872
  if (this.isContextual("yield")) {
14731
- if (this.inGenerator) { return this.parseYield(noIn) }
14873
+ if (this.inGenerator) { return this.parseYield(forInit) }
14732
14874
  // The tokenizer will assume an expression is allowed after
14733
14875
  // `yield`, but this isn't that kind of yield
14734
14876
  else { this.exprAllowed = false; }
@@ -14745,9 +14887,11 @@ pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
14745
14887
  }
14746
14888
 
14747
14889
  var startPos = this.start, startLoc = this.startLoc;
14748
- if (this.type === types.parenL || this.type === types.name)
14749
- { this.potentialArrowAt = this.start; }
14750
- var left = this.parseMaybeConditional(noIn, refDestructuringErrors);
14890
+ if (this.type === types.parenL || this.type === types.name) {
14891
+ this.potentialArrowAt = this.start;
14892
+ this.potentialArrowInForAwait = forInit === "await";
14893
+ }
14894
+ var left = this.parseMaybeConditional(forInit, refDestructuringErrors);
14751
14895
  if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }
14752
14896
  if (this.type.isAssign) {
14753
14897
  var node = this.startNodeAt(startPos, startLoc);
@@ -14765,7 +14909,7 @@ pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
14765
14909
  { this.checkLValSimple(left); }
14766
14910
  node.left = left;
14767
14911
  this.next();
14768
- node.right = this.parseMaybeAssign(noIn);
14912
+ node.right = this.parseMaybeAssign(forInit);
14769
14913
  return this.finishNode(node, "AssignmentExpression")
14770
14914
  } else {
14771
14915
  if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
@@ -14777,16 +14921,16 @@ pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
14777
14921
 
14778
14922
  // Parse a ternary conditional (`?:`) operator.
14779
14923
 
14780
- pp$3.parseMaybeConditional = function(noIn, refDestructuringErrors) {
14924
+ pp$3.parseMaybeConditional = function(forInit, refDestructuringErrors) {
14781
14925
  var startPos = this.start, startLoc = this.startLoc;
14782
- var expr = this.parseExprOps(noIn, refDestructuringErrors);
14926
+ var expr = this.parseExprOps(forInit, refDestructuringErrors);
14783
14927
  if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
14784
14928
  if (this.eat(types.question)) {
14785
14929
  var node = this.startNodeAt(startPos, startLoc);
14786
14930
  node.test = expr;
14787
14931
  node.consequent = this.parseMaybeAssign();
14788
14932
  this.expect(types.colon);
14789
- node.alternate = this.parseMaybeAssign(noIn);
14933
+ node.alternate = this.parseMaybeAssign(forInit);
14790
14934
  return this.finishNode(node, "ConditionalExpression")
14791
14935
  }
14792
14936
  return expr
@@ -14794,11 +14938,11 @@ pp$3.parseMaybeConditional = function(noIn, refDestructuringErrors) {
14794
14938
 
14795
14939
  // Start the precedence parser.
14796
14940
 
14797
- pp$3.parseExprOps = function(noIn, refDestructuringErrors) {
14941
+ pp$3.parseExprOps = function(forInit, refDestructuringErrors) {
14798
14942
  var startPos = this.start, startLoc = this.startLoc;
14799
14943
  var expr = this.parseMaybeUnary(refDestructuringErrors, false);
14800
14944
  if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
14801
- return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, noIn)
14945
+ return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit)
14802
14946
  };
14803
14947
 
14804
14948
  // Parse binary operators with the operator precedence parsing
@@ -14807,9 +14951,9 @@ pp$3.parseExprOps = function(noIn, refDestructuringErrors) {
14807
14951
  // defer further parser to one of its callers when it encounters an
14808
14952
  // operator that has a lower precedence than the set it is parsing.
14809
14953
 
14810
- pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {
14954
+ pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
14811
14955
  var prec = this.type.binop;
14812
- if (prec != null && (!noIn || this.type !== types._in)) {
14956
+ if (prec != null && (!forInit || this.type !== types._in)) {
14813
14957
  if (prec > minPrec) {
14814
14958
  var logical = this.type === types.logicalOR || this.type === types.logicalAND;
14815
14959
  var coalesce = this.type === types.coalesce;
@@ -14821,12 +14965,12 @@ pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {
14821
14965
  var op = this.value;
14822
14966
  this.next();
14823
14967
  var startPos = this.start, startLoc = this.startLoc;
14824
- var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn);
14968
+ var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, forInit);
14825
14969
  var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
14826
14970
  if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
14827
14971
  this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
14828
14972
  }
14829
- return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)
14973
+ return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
14830
14974
  }
14831
14975
  }
14832
14976
  return left
@@ -14842,7 +14986,7 @@ pp$3.buildBinary = function(startPos, startLoc, left, right, op, logical) {
14842
14986
 
14843
14987
  // Parse unary operators, both prefix and postfix.
14844
14988
 
14845
- pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
14989
+ pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec) {
14846
14990
  var startPos = this.start, startLoc = this.startLoc, expr;
14847
14991
  if (this.isContextual("await") && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))) {
14848
14992
  expr = this.parseAwait();
@@ -14852,12 +14996,14 @@ pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
14852
14996
  node.operator = this.value;
14853
14997
  node.prefix = true;
14854
14998
  this.next();
14855
- node.argument = this.parseMaybeUnary(null, true);
14999
+ node.argument = this.parseMaybeUnary(null, true, update);
14856
15000
  this.checkExpressionErrors(refDestructuringErrors, true);
14857
15001
  if (update) { this.checkLValSimple(node.argument); }
14858
15002
  else if (this.strict && node.operator === "delete" &&
14859
15003
  node.argument.type === "Identifier")
14860
15004
  { this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); }
15005
+ else if (node.operator === "delete" && isPrivateFieldAccess(node.argument))
15006
+ { this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
14861
15007
  else { sawUnary = true; }
14862
15008
  expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
14863
15009
  } else {
@@ -14874,12 +15020,23 @@ pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
14874
15020
  }
14875
15021
  }
14876
15022
 
14877
- if (!sawUnary && this.eat(types.starstar))
14878
- { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false) }
14879
- else
14880
- { return expr }
15023
+ if (!incDec && this.eat(types.starstar)) {
15024
+ if (sawUnary)
15025
+ { this.unexpected(this.lastTokStart); }
15026
+ else
15027
+ { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false) }
15028
+ } else {
15029
+ return expr
15030
+ }
14881
15031
  };
14882
15032
 
15033
+ function isPrivateFieldAccess(node) {
15034
+ return (
15035
+ node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" ||
15036
+ node.type === "ChainExpression" && isPrivateFieldAccess(node.expression)
15037
+ )
15038
+ }
15039
+
14883
15040
  // Parse call, dot, and `[]`-subscript expressions.
14884
15041
 
14885
15042
  pp$3.parseExprSubscripts = function(refDestructuringErrors) {
@@ -14891,6 +15048,7 @@ pp$3.parseExprSubscripts = function(refDestructuringErrors) {
14891
15048
  if (refDestructuringErrors && result.type === "MemberExpression") {
14892
15049
  if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }
14893
15050
  if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }
15051
+ if (refDestructuringErrors.trailingComma >= result.start) { refDestructuringErrors.trailingComma = -1; }
14894
15052
  }
14895
15053
  return result
14896
15054
  };
@@ -14927,9 +15085,15 @@ pp$3.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
14927
15085
  if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
14928
15086
  var node = this.startNodeAt(startPos, startLoc);
14929
15087
  node.object = base;
14930
- node.property = computed ? this.parseExpression() : this.parseIdent(this.options.allowReserved !== "never");
15088
+ if (computed) {
15089
+ node.property = this.parseExpression();
15090
+ this.expect(types.bracketR);
15091
+ } else if (this.type === types.privateId && base.type !== "Super") {
15092
+ node.property = this.parsePrivateIdent();
15093
+ } else {
15094
+ node.property = this.parseIdent(this.options.allowReserved !== "never");
15095
+ }
14931
15096
  node.computed = !!computed;
14932
- if (computed) { this.expect(types.bracketR); }
14933
15097
  if (optionalSupported) {
14934
15098
  node.optional = optional;
14935
15099
  }
@@ -15015,7 +15179,8 @@ pp$3.parseExprAtom = function(refDestructuringErrors) {
15015
15179
  if (canBeArrow && !this.canInsertSemicolon()) {
15016
15180
  if (this.eat(types.arrow))
15017
15181
  { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false) }
15018
- if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc) {
15182
+ if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc &&
15183
+ (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
15019
15184
  id = this.parseIdent(false);
15020
15185
  if (this.canInsertSemicolon() || !this.eat(types.arrow))
15021
15186
  { this.unexpected(); }
@@ -15133,7 +15298,7 @@ pp$3.parseImportMeta = function(node) {
15133
15298
  { this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); }
15134
15299
  if (containsEsc)
15135
15300
  { this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); }
15136
- if (this.options.sourceType !== "module")
15301
+ if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere)
15137
15302
  { this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); }
15138
15303
 
15139
15304
  return this.finishNode(node, "MetaProperty")
@@ -15601,6 +15766,8 @@ pp$3.checkUnreserved = function(ref) {
15601
15766
  { this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); }
15602
15767
  if (this.inAsync && name === "await")
15603
15768
  { this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); }
15769
+ if (this.currentThisScope().inClassFieldInit && name === "arguments")
15770
+ { this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); }
15604
15771
  if (this.keywords.test(name))
15605
15772
  { this.raise(start, ("Unexpected keyword '" + name + "'")); }
15606
15773
  if (this.options.ecmaVersion < 6 &&
@@ -15645,9 +15812,29 @@ pp$3.parseIdent = function(liberal, isBinding) {
15645
15812
  return node
15646
15813
  };
15647
15814
 
15815
+ pp$3.parsePrivateIdent = function() {
15816
+ var node = this.startNode();
15817
+ if (this.type === types.privateId) {
15818
+ node.name = this.value;
15819
+ } else {
15820
+ this.unexpected();
15821
+ }
15822
+ this.next();
15823
+ this.finishNode(node, "PrivateIdentifier");
15824
+
15825
+ // For validating existence
15826
+ if (this.privateNameStack.length === 0) {
15827
+ this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
15828
+ } else {
15829
+ this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
15830
+ }
15831
+
15832
+ return node
15833
+ };
15834
+
15648
15835
  // Parses yield expression inside generator.
15649
15836
 
15650
- pp$3.parseYield = function(noIn) {
15837
+ pp$3.parseYield = function(forInit) {
15651
15838
  if (!this.yieldPos) { this.yieldPos = this.start; }
15652
15839
 
15653
15840
  var node = this.startNode();
@@ -15657,7 +15844,7 @@ pp$3.parseYield = function(noIn) {
15657
15844
  node.argument = null;
15658
15845
  } else {
15659
15846
  node.delegate = this.eat(types.star);
15660
- node.argument = this.parseMaybeAssign(noIn);
15847
+ node.argument = this.parseMaybeAssign(forInit);
15661
15848
  }
15662
15849
  return this.finishNode(node, "YieldExpression")
15663
15850
  };
@@ -15705,6 +15892,8 @@ var Scope = function Scope(flags) {
15705
15892
  this.lexical = [];
15706
15893
  // A list of lexically-declared FunctionDeclaration names in the current lexical scope
15707
15894
  this.functions = [];
15895
+ // A switch to disallow the identifier reference 'arguments'
15896
+ this.inClassFieldInit = false;
15708
15897
  };
15709
15898
 
15710
15899
  // The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
@@ -17181,9 +17370,9 @@ pp$9.readToken = function(code) {
17181
17370
 
17182
17371
  pp$9.fullCharCodeAtPos = function() {
17183
17372
  var code = this.input.charCodeAt(this.pos);
17184
- if (code <= 0xd7ff || code >= 0xe000) { return code }
17373
+ if (code <= 0xd7ff || code >= 0xdc00) { return code }
17185
17374
  var next = this.input.charCodeAt(this.pos + 1);
17186
- return (code << 10) + next - 0x35fdc00
17375
+ return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
17187
17376
  };
17188
17377
 
17189
17378
  pp$9.skipBlockComment = function() {
@@ -17402,6 +17591,20 @@ pp$9.readToken_question = function() { // '?'
17402
17591
  return this.finishOp(types.question, 1)
17403
17592
  };
17404
17593
 
17594
+ pp$9.readToken_numberSign = function() { // '#'
17595
+ var ecmaVersion = this.options.ecmaVersion;
17596
+ var code = 35; // '#'
17597
+ if (ecmaVersion >= 13) {
17598
+ ++this.pos;
17599
+ code = this.fullCharCodeAtPos();
17600
+ if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
17601
+ return this.finishToken(types.privateId, this.readWord1())
17602
+ }
17603
+ }
17604
+
17605
+ this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'");
17606
+ };
17607
+
17405
17608
  pp$9.getTokenFromCode = function(code) {
17406
17609
  switch (code) {
17407
17610
  // The interpretation of a dot depends on whether it is followed
@@ -17473,6 +17676,9 @@ pp$9.getTokenFromCode = function(code) {
17473
17676
 
17474
17677
  case 126: // '~'
17475
17678
  return this.finishOp(types.prefix, 1)
17679
+
17680
+ case 35: // '#'
17681
+ return this.readToken_numberSign()
17476
17682
  }
17477
17683
 
17478
17684
  this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'");
@@ -17884,7 +18090,7 @@ pp$9.readWord = function() {
17884
18090
 
17885
18091
  // Acorn is a tiny, fast JavaScript parser written in JavaScript.
17886
18092
 
17887
- var version = "8.0.5";
18093
+ var version = "8.2.4";
17888
18094
 
17889
18095
  Parser.acorn = {
17890
18096
  Parser: Parser,
@@ -17919,47 +18125,6 @@ function parse(input, options) {
17919
18125
  return Parser.parse(input, options)
17920
18126
  }
17921
18127
 
17922
- // This function tries to parse a single expression at a given
17923
- // offset in a string. Useful for parsing mixed-language formats
17924
- // that embed JavaScript expressions.
17925
-
17926
- function parseExpressionAt(input, pos, options) {
17927
- return Parser.parseExpressionAt(input, pos, options)
17928
- }
17929
-
17930
- // Acorn is organized as a tokenizer and a recursive-descent parser.
17931
- // The `tokenizer` export provides an interface to the tokenizer.
17932
-
17933
- function tokenizer(input, options) {
17934
- return Parser.tokenizer(input, options)
17935
- }
17936
-
17937
- var acorn = {
17938
- __proto__: null,
17939
- Node: Node,
17940
- Parser: Parser,
17941
- Position: Position,
17942
- SourceLocation: SourceLocation,
17943
- TokContext: TokContext,
17944
- Token: Token,
17945
- TokenType: TokenType,
17946
- defaultOptions: defaultOptions,
17947
- getLineInfo: getLineInfo,
17948
- isIdentifierChar: isIdentifierChar,
17949
- isIdentifierStart: isIdentifierStart,
17950
- isNewLine: isNewLine,
17951
- keywordTypes: keywords$1,
17952
- lineBreak: lineBreak,
17953
- lineBreakG: lineBreakG,
17954
- nonASCIIwhitespace: nonASCIIwhitespace,
17955
- parse: parse,
17956
- parseExpressionAt: parseExpressionAt,
17957
- tokContexts: types$1,
17958
- tokTypes: types,
17959
- tokenizer: tokenizer,
17960
- version: version
17961
- };
17962
-
17963
18128
  class GlobalScope extends Scope$1 {
17964
18129
  constructor() {
17965
18130
  super();
@@ -19187,7 +19352,7 @@ base.ImportDeclaration = function (node, st, c) {
19187
19352
  base.ImportExpression = function (node, st, c) {
19188
19353
  c(node.source, st, "Expression");
19189
19354
  };
19190
- base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
19355
+ base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore;
19191
19356
 
19192
19357
  base.TaggedTemplateExpression = function (node, st, c) {
19193
19358
  c(node.tag, st, "Expression");
@@ -19207,9 +19372,9 @@ base.ClassBody = function (node, st, c) {
19207
19372
  c(elt, st);
19208
19373
  }
19209
19374
  };
19210
- base.MethodDefinition = base.Property = function (node, st, c) {
19375
+ base.MethodDefinition = base.PropertyDefinition = base.Property = function (node, st, c) {
19211
19376
  if (node.computed) { c(node.key, st, "Expression"); }
19212
- c(node.value, st, "Expression");
19377
+ if (node.value) { c(node.value, st, "Expression"); }
19213
19378
  };
19214
19379
 
19215
19380
  // patch up acorn-walk until class-fields are officially supported
@@ -19221,10 +19386,30 @@ base.PropertyDefinition = function (node, st, c) {
19221
19386
  c(node.value, st, 'Expression');
19222
19387
  }
19223
19388
  };
19389
+ function isOnlyWhitespaceOrComments(code) {
19390
+ // streamline the typical case
19391
+ if (/^\s*$/.test(code))
19392
+ return true;
19393
+ try {
19394
+ // successful only if it's a valid Program without statements
19395
+ const ast = parse(code, { ecmaVersion: 'latest' });
19396
+ return ast.body && ast.body.length === 0;
19397
+ }
19398
+ catch (_a) {
19399
+ // should only be reached by invalid annotations like:
19400
+ //
19401
+ // foo() /*@__PURE__*/ /* other */, bar();
19402
+ //
19403
+ // where `code` is " /* other */, "
19404
+ }
19405
+ return false;
19406
+ }
19224
19407
  function handlePureAnnotationsOfNode(node, state, type = node.type) {
19225
19408
  let commentNode = state.commentNodes[state.commentIndex];
19226
19409
  while (commentNode && node.start >= commentNode.end) {
19227
- markPureNode(node, commentNode);
19410
+ const between = state.code.substring(commentNode.end, node.start);
19411
+ if (isOnlyWhitespaceOrComments(between))
19412
+ markPureNode(node, commentNode);
19228
19413
  commentNode = state.commentNodes[++state.commentIndex];
19229
19414
  }
19230
19415
  if (commentNode && commentNode.end <= node.end) {
@@ -19252,8 +19437,9 @@ function markPureNode(node, comment) {
19252
19437
  }
19253
19438
  const pureCommentRegex = /[@#]__PURE__/;
19254
19439
  const isPureComment = (comment) => pureCommentRegex.test(comment.value);
19255
- function markPureCallExpressions(comments, esTreeAst) {
19440
+ function markPureCallExpressions(comments, esTreeAst, code) {
19256
19441
  handlePureAnnotationsOfNode(esTreeAst, {
19442
+ code,
19257
19443
  commentIndex: 0,
19258
19444
  commentNodes: comments.filter(isPureComment)
19259
19445
  });
@@ -19360,7 +19546,7 @@ class Graph {
19360
19546
  onCommentOrig.push(...comments);
19361
19547
  }
19362
19548
  options.onComment = onCommentOrig;
19363
- markPureCallExpressions(comments, ast);
19549
+ markPureCallExpressions(comments, ast, code);
19364
19550
  return ast;
19365
19551
  }
19366
19552
  getCache() {
@@ -19474,348 +19660,6 @@ class Graph {
19474
19660
  }
19475
19661
  }
19476
19662
 
19477
- var require$$1 = /*@__PURE__*/getAugmentedNamespace(acorn);
19478
-
19479
- const getPrototype = Object.getPrototypeOf || (o => o.__proto__);
19480
-
19481
- const getAcorn$1 = Parser => {
19482
- if (Parser.acorn) return Parser.acorn
19483
-
19484
- const acorn = require$$1;
19485
-
19486
- if (acorn.version.indexOf("6.") != 0 && acorn.version.indexOf("6.0.") == 0 && acorn.version.indexOf("7.") != 0) {
19487
- throw new Error(`acorn-private-class-elements requires acorn@^6.1.0 or acorn@7.0.0, not ${acorn.version}`)
19488
- }
19489
-
19490
- // Make sure `Parser` comes from the same acorn as we `require`d,
19491
- // otherwise the comparisons fail.
19492
- for (let cur = Parser; cur && cur !== acorn.Parser; cur = getPrototype(cur)) {
19493
- if (cur !== acorn.Parser) {
19494
- throw new Error("acorn-private-class-elements does not support mixing different acorn copies")
19495
- }
19496
- }
19497
- return acorn
19498
- };
19499
-
19500
- var acornPrivateClassElements = function(Parser) {
19501
- // Only load this plugin once.
19502
- if (Parser.prototype.parsePrivateName) {
19503
- return Parser
19504
- }
19505
-
19506
- const acorn = getAcorn$1(Parser);
19507
-
19508
- Parser = class extends Parser {
19509
- _branch() {
19510
- this.__branch = this.__branch || new Parser({ecmaVersion: this.options.ecmaVersion}, this.input);
19511
- this.__branch.end = this.end;
19512
- this.__branch.pos = this.pos;
19513
- this.__branch.type = this.type;
19514
- this.__branch.value = this.value;
19515
- this.__branch.containsEsc = this.containsEsc;
19516
- return this.__branch
19517
- }
19518
-
19519
- parsePrivateClassElementName(element) {
19520
- element.computed = false;
19521
- element.key = this.parsePrivateName();
19522
- if (element.key.name == "constructor") this.raise(element.key.start, "Classes may not have a private element named constructor");
19523
- const accept = {get: "set", set: "get"}[element.kind];
19524
- const privateBoundNames = this._privateBoundNames;
19525
- if (Object.prototype.hasOwnProperty.call(privateBoundNames, element.key.name) && privateBoundNames[element.key.name] !== accept) {
19526
- this.raise(element.start, "Duplicate private element");
19527
- }
19528
- privateBoundNames[element.key.name] = element.kind || true;
19529
- delete this._unresolvedPrivateNames[element.key.name];
19530
- return element.key
19531
- }
19532
-
19533
- parsePrivateName() {
19534
- const node = this.startNode();
19535
- node.name = this.value;
19536
- this.next();
19537
- this.finishNode(node, "PrivateIdentifier");
19538
- if (this.options.allowReserved == "never") this.checkUnreserved(node);
19539
- return node
19540
- }
19541
-
19542
- // Parse # token
19543
- getTokenFromCode(code) {
19544
- if (code === 35) {
19545
- ++this.pos;
19546
- const word = this.readWord1();
19547
- return this.finishToken(this.privateIdentifierToken, word)
19548
- }
19549
- return super.getTokenFromCode(code)
19550
- }
19551
-
19552
- // Manage stacks and check for undeclared private names
19553
- parseClass(node, isStatement) {
19554
- const oldOuterPrivateBoundNames = this._outerPrivateBoundNames;
19555
- this._outerPrivateBoundNames = this._privateBoundNames;
19556
- this._privateBoundNames = Object.create(this._privateBoundNames || null);
19557
- const oldOuterUnresolvedPrivateNames = this._outerUnresolvedPrivateNames;
19558
- this._outerUnresolvedPrivateNames = this._unresolvedPrivateNames;
19559
- this._unresolvedPrivateNames = Object.create(null);
19560
-
19561
- const _return = super.parseClass(node, isStatement);
19562
-
19563
- const unresolvedPrivateNames = this._unresolvedPrivateNames;
19564
- this._privateBoundNames = this._outerPrivateBoundNames;
19565
- this._outerPrivateBoundNames = oldOuterPrivateBoundNames;
19566
- this._unresolvedPrivateNames = this._outerUnresolvedPrivateNames;
19567
- this._outerUnresolvedPrivateNames = oldOuterUnresolvedPrivateNames;
19568
- if (!this._unresolvedPrivateNames) {
19569
- const names = Object.keys(unresolvedPrivateNames);
19570
- if (names.length) {
19571
- names.sort((n1, n2) => unresolvedPrivateNames[n1] - unresolvedPrivateNames[n2]);
19572
- this.raise(unresolvedPrivateNames[names[0]], "Usage of undeclared private name");
19573
- }
19574
- } else Object.assign(this._unresolvedPrivateNames, unresolvedPrivateNames);
19575
- return _return
19576
- }
19577
-
19578
- // Class heritage is evaluated with outer private environment
19579
- parseClassSuper(node) {
19580
- const privateBoundNames = this._privateBoundNames;
19581
- this._privateBoundNames = this._outerPrivateBoundNames;
19582
- const unresolvedPrivateNames = this._unresolvedPrivateNames;
19583
- this._unresolvedPrivateNames = this._outerUnresolvedPrivateNames;
19584
- const _return = super.parseClassSuper(node);
19585
- this._privateBoundNames = privateBoundNames;
19586
- this._unresolvedPrivateNames = unresolvedPrivateNames;
19587
- return _return
19588
- }
19589
-
19590
- // Parse private element access
19591
- parseSubscript(base, startPos, startLoc, _noCalls, _maybeAsyncArrow, _optionalChained) {
19592
- const optionalSupported = this.options.ecmaVersion >= 11 && acorn.tokTypes.questionDot;
19593
- const branch = this._branch();
19594
- if (!(
19595
- (branch.eat(acorn.tokTypes.dot) || (optionalSupported && branch.eat(acorn.tokTypes.questionDot))) &&
19596
- branch.type == this.privateIdentifierToken
19597
- )) {
19598
- return super.parseSubscript.apply(this, arguments)
19599
- }
19600
- let optional = false;
19601
- if (!this.eat(acorn.tokTypes.dot)) {
19602
- this.expect(acorn.tokTypes.questionDot);
19603
- optional = true;
19604
- }
19605
- let node = this.startNodeAt(startPos, startLoc);
19606
- node.object = base;
19607
- node.computed = false;
19608
- if (optionalSupported) {
19609
- node.optional = optional;
19610
- }
19611
- if (this.type == this.privateIdentifierToken) {
19612
- if (base.type == "Super") {
19613
- this.raise(this.start, "Cannot access private element on super");
19614
- }
19615
- node.property = this.parsePrivateName();
19616
- if (!this._privateBoundNames || !this._privateBoundNames[node.property.name]) {
19617
- if (!this._unresolvedPrivateNames) {
19618
- this.raise(node.property.start, "Usage of undeclared private name");
19619
- }
19620
- this._unresolvedPrivateNames[node.property.name] = node.property.start;
19621
- }
19622
- } else {
19623
- node.property = this.parseIdent(true);
19624
- }
19625
- return this.finishNode(node, "MemberExpression")
19626
- }
19627
-
19628
- // Prohibit delete of private class elements
19629
- parseMaybeUnary(refDestructuringErrors, sawUnary) {
19630
- const _return = super.parseMaybeUnary(refDestructuringErrors, sawUnary);
19631
- if (_return.operator == "delete") {
19632
- if (_return.argument.type == "MemberExpression" && _return.argument.property.type == "PrivateIdentifier") {
19633
- this.raise(_return.start, "Private elements may not be deleted");
19634
- }
19635
- }
19636
- return _return
19637
- }
19638
- };
19639
- Parser.prototype.privateIdentifierToken = new acorn.TokenType("privateIdentifier");
19640
- return Parser
19641
- };
19642
-
19643
- const privateClassElements$1 = acornPrivateClassElements;
19644
-
19645
- var acornClassFields = function(Parser) {
19646
- const acorn = Parser.acorn || require$$1;
19647
- const tt = acorn.tokTypes;
19648
-
19649
- Parser = privateClassElements$1(Parser);
19650
- return class extends Parser {
19651
- _maybeParseFieldValue(field) {
19652
- if (this.eat(tt.eq)) {
19653
- const oldInFieldValue = this._inFieldValue;
19654
- this._inFieldValue = true;
19655
- if (this.type === tt.name && this.value === "await" && (this.inAsync || this.options.allowAwaitOutsideFunction)) {
19656
- field.value = this.parseAwait();
19657
- } else field.value = this.parseExpression();
19658
- this._inFieldValue = oldInFieldValue;
19659
- } else field.value = null;
19660
- }
19661
-
19662
- // Parse fields
19663
- parseClassElement(_constructorAllowsSuper) {
19664
- if (this.options.ecmaVersion >= 8 && (this.type == tt.name || this.type.keyword || this.type == this.privateIdentifierToken || this.type == tt.bracketL || this.type == tt.string || this.type == tt.num)) {
19665
- const branch = this._branch();
19666
- if (branch.type == tt.bracketL) {
19667
- let count = 0;
19668
- do {
19669
- if (branch.eat(tt.bracketL)) ++count;
19670
- else if (branch.eat(tt.bracketR)) --count;
19671
- else branch.next();
19672
- } while (count > 0)
19673
- } else branch.next(true);
19674
- let isField = branch.type == tt.eq || branch.type == tt.semi;
19675
- if (!isField && branch.canInsertSemicolon()) {
19676
- isField = branch.type != tt.parenL;
19677
- }
19678
- if (isField) {
19679
- const node = this.startNode();
19680
- if (this.type == this.privateIdentifierToken) {
19681
- this.parsePrivateClassElementName(node);
19682
- } else {
19683
- this.parsePropertyName(node);
19684
- }
19685
- if ((node.key.type === "Identifier" && node.key.name === "constructor") ||
19686
- (node.key.type === "Literal" && node.key.value === "constructor")) {
19687
- this.raise(node.key.start, "Classes may not have a field called constructor");
19688
- }
19689
- this.enterScope(64 | 2 | 1); // See acorn's scopeflags.js
19690
- this._maybeParseFieldValue(node);
19691
- this.exitScope();
19692
- this.finishNode(node, "PropertyDefinition");
19693
- this.semicolon();
19694
- return node
19695
- }
19696
- }
19697
-
19698
- return super.parseClassElement.apply(this, arguments)
19699
- }
19700
-
19701
- // Prohibit arguments in class field initializers
19702
- parseIdent(liberal, isBinding) {
19703
- const ident = super.parseIdent(liberal, isBinding);
19704
- if (this._inFieldValue && ident.name == "arguments") this.raise(ident.start, "A class field initializer may not contain arguments");
19705
- return ident
19706
- }
19707
- }
19708
- };
19709
-
19710
- // eslint-disable-next-line node/no-unsupported-features/es-syntax
19711
-
19712
- // eslint-disable-next-line node/no-unsupported-features/es-syntax
19713
- function privateMethods(Parser) {
19714
- const ExtendedParser = acornPrivateClassElements(Parser);
19715
-
19716
- return class extends ExtendedParser {
19717
- // Parse private methods
19718
- parseClassElement(_constructorAllowsSuper) {
19719
- const oldInClassMemberName = this._inClassMemberName;
19720
- this._inClassMemberName = true;
19721
- const result = super.parseClassElement.apply(this, arguments);
19722
- this._inClassMemberName = oldInClassMemberName;
19723
- return result
19724
- }
19725
-
19726
- parsePropertyName(prop) {
19727
- const isPrivate = this.options.ecmaVersion >= 8 && this._inClassMemberName && this.type == this.privateIdentifierToken && !prop.static;
19728
- this._inClassMemberName = false;
19729
- if (!isPrivate) return super.parsePropertyName(prop)
19730
- return this.parsePrivateClassElementName(prop)
19731
- }
19732
- }
19733
- }
19734
-
19735
- const privateClassElements = acornPrivateClassElements;
19736
-
19737
- var acornStaticClassFeatures = function(Parser) {
19738
- const ExtendedParser = privateClassElements(Parser);
19739
-
19740
- const acorn = Parser.acorn || require$$1;
19741
- const tt = acorn.tokTypes;
19742
-
19743
- return class extends ExtendedParser {
19744
- _maybeParseFieldValue(field) {
19745
- if (this.eat(tt.eq)) {
19746
- const oldInFieldValue = this._inStaticFieldScope;
19747
- this._inStaticFieldScope = this.currentThisScope();
19748
- field.value = this.parseExpression();
19749
- this._inStaticFieldScope = oldInFieldValue;
19750
- } else field.value = null;
19751
- }
19752
-
19753
- // Parse fields
19754
- parseClassElement(_constructorAllowsSuper) {
19755
- if (this.options.ecmaVersion < 8 || !this.isContextual("static")) {
19756
- return super.parseClassElement.apply(this, arguments)
19757
- }
19758
-
19759
- const branch = this._branch();
19760
- branch.next();
19761
- if ([tt.name, tt.bracketL, tt.string, tt.num, this.privateIdentifierToken].indexOf(branch.type) == -1 && !branch.type.keyword) {
19762
- return super.parseClassElement.apply(this, arguments)
19763
- }
19764
- if (branch.type == tt.bracketL) {
19765
- let count = 0;
19766
- do {
19767
- if (branch.eat(tt.bracketL)) ++count;
19768
- else if (branch.eat(tt.bracketR)) --count;
19769
- else branch.next();
19770
- } while (count > 0)
19771
- } else branch.next();
19772
- if (branch.type != tt.eq && !branch.canInsertSemicolon() && branch.type != tt.semi) {
19773
- return super.parseClassElement.apply(this, arguments)
19774
- }
19775
-
19776
- const node = this.startNode();
19777
- node.static = this.eatContextual("static");
19778
- if (this.type == this.privateIdentifierToken) {
19779
- this.parsePrivateClassElementName(node);
19780
- } else {
19781
- this.parsePropertyName(node);
19782
- }
19783
- if ((node.key.type === "Identifier" && node.key.name === "constructor") ||
19784
- (node.key.type === "Literal" && !node.computed && node.key.value === "constructor")) {
19785
- this.raise(node.key.start, "Classes may not have a field called constructor");
19786
- }
19787
- if ((node.key.name || node.key.value) === "prototype" && !node.computed) {
19788
- this.raise(node.key.start, "Classes may not have a static property named prototype");
19789
- }
19790
-
19791
- this.enterScope(64 | 2 | 1); // See acorn's scopeflags.js
19792
- this._maybeParseFieldValue(node);
19793
- this.exitScope();
19794
- this.finishNode(node, "PropertyDefinition");
19795
- this.semicolon();
19796
- return node
19797
- }
19798
-
19799
- // Parse private static methods
19800
- parsePropertyName(prop) {
19801
- if (prop.static && this.type == this.privateIdentifierToken) {
19802
- this.parsePrivateClassElementName(prop);
19803
- } else {
19804
- super.parsePropertyName(prop);
19805
- }
19806
- }
19807
-
19808
- // Prohibit arguments in class field initializers
19809
- parseIdent(liberal, isBinding) {
19810
- const ident = super.parseIdent(liberal, isBinding);
19811
- if (this._inStaticFieldScope && this.currentThisScope() === this._inStaticFieldScope && ident.name == "arguments") {
19812
- this.raise(ident.start, "A static class field initializer may not contain arguments");
19813
- }
19814
- return ident
19815
- }
19816
- }
19817
- };
19818
-
19819
19663
  function normalizeInputOptions(config) {
19820
19664
  var _a, _b, _c;
19821
19665
  // These are options that may trigger special warnings or behaviour later
@@ -19872,12 +19716,7 @@ const getAcorn = (config) => ({
19872
19716
  sourceType: 'module',
19873
19717
  ...config.acorn
19874
19718
  });
19875
- const getAcornInjectPlugins = (config) => [
19876
- acornClassFields,
19877
- privateMethods,
19878
- acornStaticClassFeatures,
19879
- ...ensureArray(config.acornInjectPlugins)
19880
- ];
19719
+ const getAcornInjectPlugins = (config) => ensureArray(config.acornInjectPlugins);
19881
19720
  const getCache = (config) => {
19882
19721
  var _a;
19883
19722
  return ((_a = config.cache) === null || _a === void 0 ? void 0 : _a.cache) || config.cache;
@@ -20278,7 +20117,10 @@ const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOpt
20278
20117
  }
20279
20118
  return configManualChunks || {};
20280
20119
  };
20281
- const getMinifyInternalExports = (config, format, compact) => { var _a; return (_a = config.minifyInternalExports) !== null && _a !== void 0 ? _a : (compact || format === 'es' || format === 'system'); };
20120
+ const getMinifyInternalExports = (config, format, compact) => {
20121
+ var _a;
20122
+ return (_a = config.minifyInternalExports) !== null && _a !== void 0 ? _a : (compact || format === 'es' || format === 'system');
20123
+ };
20282
20124
 
20283
20125
  function rollup(rawInputOptions) {
20284
20126
  return rollupInternal(rawInputOptions, null);
@@ -20476,7 +20318,6 @@ exports.ensureArray = ensureArray;
20476
20318
  exports.error = error;
20477
20319
  exports.fseventsImporter = fseventsImporter;
20478
20320
  exports.getAliasName = getAliasName;
20479
- exports.getAugmentedNamespace = getAugmentedNamespace;
20480
20321
  exports.getOrCreate = getOrCreate;
20481
20322
  exports.loadFsEvents = loadFsEvents;
20482
20323
  exports.printQuotedStringList = printQuotedStringList;