@vue/compiler-sfc 3.5.17 → 3.5.19

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,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.5.17
2
+ * @vue/compiler-sfc v3.5.19
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -39,10 +39,10 @@ const isBuiltInDirective = /* @__PURE__ */ makeMap(
39
39
  );
40
40
  const cacheStringFunction = (fn) => {
41
41
  const cache = /* @__PURE__ */ Object.create(null);
42
- return (str) => {
42
+ return ((str) => {
43
43
  const hit = cache[str];
44
44
  return hit || (cache[str] = fn(str));
45
- };
45
+ });
46
46
  };
47
47
  const camelizeRE = /-(\w)/g;
48
48
  const camelize = cacheStringFunction(
@@ -2586,6 +2586,7 @@ function requireLib () {
2586
2586
  IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.",
2587
2587
  InvalidBigIntLiteral: "Invalid BigIntLiteral.",
2588
2588
  InvalidCodePoint: "Code point out of bounds.",
2589
+ InvalidCoverDiscardElement: "'void' must be followed by an expression when not used in a binding position.",
2589
2590
  InvalidCoverInitializedName: "Invalid shorthand property initializer.",
2590
2591
  InvalidDecimal: "Invalid decimal.",
2591
2592
  InvalidDigit: ({
@@ -2703,6 +2704,7 @@ function requireLib () {
2703
2704
  }) => `Unexpected token${unexpected ? ` '${unexpected}'.` : ""}${expected ? `, expected "${expected}"` : ""}`,
2704
2705
  UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
2705
2706
  UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",
2707
+ UnexpectedVoidPattern: "Unexpected void binding.",
2706
2708
  UnsupportedBind: "Binding should be performed on object property.",
2707
2709
  UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
2708
2710
  UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
@@ -2723,6 +2725,8 @@ function requireLib () {
2723
2725
  VarRedeclaration: ({
2724
2726
  identifierName
2725
2727
  }) => `Identifier '${identifierName}' has already been declared.`,
2728
+ VoidPatternCatchClauseParam: "A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",
2729
+ VoidPatternInitializer: "A void binding may not have an initializer.",
2726
2730
  YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.",
2727
2731
  YieldInParameter: "Yield expression is not allowed in formal parameters.",
2728
2732
  YieldNotInGeneratorFunction: "'yield' is only allowed within generator functions.",
@@ -2909,6 +2913,17 @@ function requireLib () {
2909
2913
  throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");
2910
2914
  }
2911
2915
  }
2916
+ if (options.sourceType === "commonjs") {
2917
+ if (opts.allowAwaitOutsideFunction != null) {
2918
+ throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");
2919
+ }
2920
+ if (opts.allowReturnOutsideFunction != null) {
2921
+ throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");
2922
+ }
2923
+ if (opts.allowNewTargetOutsideFunction != null) {
2924
+ throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.");
2925
+ }
2926
+ }
2912
2927
  return options;
2913
2928
  }
2914
2929
  const {
@@ -3204,11 +3219,14 @@ function requireLib () {
3204
3219
  finishCallExpression(unfinished, optional) {
3205
3220
  const node = super.finishCallExpression(unfinished, optional);
3206
3221
  if (node.callee.type === "Import") {
3207
- var _ref, _ref2;
3222
+ var _ref;
3208
3223
  this.castNodeTo(node, "ImportExpression");
3209
3224
  node.source = node.arguments[0];
3210
3225
  node.options = (_ref = node.arguments[1]) != null ? _ref : null;
3211
- node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
3226
+ {
3227
+ var _ref2;
3228
+ node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
3229
+ }
3212
3230
  delete node.arguments;
3213
3231
  delete node.callee;
3214
3232
  } else if (node.type === "OptionalCallExpression") {
@@ -3776,7 +3794,7 @@ function requireLib () {
3776
3794
  startsExpr
3777
3795
  }),
3778
3796
  placeholder: createToken("%%", {
3779
- startsExpr: true
3797
+ startsExpr
3780
3798
  }),
3781
3799
  string: createToken("string", {
3782
3800
  startsExpr
@@ -3799,10 +3817,10 @@ function requireLib () {
3799
3817
  eof: createToken("eof"),
3800
3818
  jsxName: createToken("jsxName"),
3801
3819
  jsxText: createToken("jsxText", {
3802
- beforeExpr: true
3820
+ beforeExpr
3803
3821
  }),
3804
3822
  jsxTagStart: createToken("jsxTagStart", {
3805
- startsExpr: true
3823
+ startsExpr
3806
3824
  }),
3807
3825
  jsxTagEnd: createToken("jsxTagEnd")
3808
3826
  };
@@ -3982,6 +4000,9 @@ function requireLib () {
3982
4000
  get allowDirectSuper() {
3983
4001
  return (this.currentThisScopeFlags() & 32) > 0;
3984
4002
  }
4003
+ get allowNewTarget() {
4004
+ return (this.currentThisScopeFlags() & 512) > 0;
4005
+ }
3985
4006
  get inClass() {
3986
4007
  return (this.currentThisScopeFlags() & 64) > 0;
3987
4008
  }
@@ -3997,7 +4018,7 @@ function requireLib () {
3997
4018
  if (flags & 128) {
3998
4019
  return true;
3999
4020
  }
4000
- if (flags & (643 | 64)) {
4021
+ if (flags & (1667 | 64)) {
4001
4022
  return false;
4002
4023
  }
4003
4024
  }
@@ -4047,7 +4068,7 @@ function requireLib () {
4047
4068
  this.checkRedeclarationInScope(scope, name, bindingType, loc);
4048
4069
  scope.names.set(name, (scope.names.get(name) || 0) | 1);
4049
4070
  this.maybeExportDefined(scope, name);
4050
- if (scope.flags & 643) break;
4071
+ if (scope.flags & 1667) break;
4051
4072
  }
4052
4073
  }
4053
4074
  if (this.parser.inModule && scope.flags & 1) {
@@ -4094,7 +4115,7 @@ function requireLib () {
4094
4115
  const {
4095
4116
  flags
4096
4117
  } = this.scopeStack[i];
4097
- if (flags & 643) {
4118
+ if (flags & 1667) {
4098
4119
  return flags;
4099
4120
  }
4100
4121
  }
@@ -4104,7 +4125,7 @@ function requireLib () {
4104
4125
  const {
4105
4126
  flags
4106
4127
  } = this.scopeStack[i];
4107
- if (flags & (643 | 64) && !(flags & 4)) {
4128
+ if (flags & (1667 | 64) && !(flags & 4)) {
4108
4129
  return flags;
4109
4130
  }
4110
4131
  }
@@ -5502,7 +5523,7 @@ function requireLib () {
5502
5523
  finishArrowValidation(node) {
5503
5524
  var _node$extra;
5504
5525
  this.toAssignableList(node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingCommaLoc, false);
5505
- this.scope.enter(2 | 4);
5526
+ this.scope.enter(514 | 4);
5506
5527
  super.checkParams(node, false, true);
5507
5528
  this.scope.exit();
5508
5529
  }
@@ -6045,7 +6066,7 @@ function requireLib () {
6045
6066
  this.next();
6046
6067
  const node = this.startNodeAt(startLoc);
6047
6068
  node.callee = base;
6048
- node.arguments = super.parseCallExpressionArguments(11);
6069
+ node.arguments = super.parseCallExpressionArguments();
6049
6070
  base = this.finishNode(node, "CallExpression");
6050
6071
  } else if (base.type === "Identifier" && base.name === "async" && this.match(47)) {
6051
6072
  const state = this.state.clone();
@@ -6077,7 +6098,7 @@ function requireLib () {
6077
6098
  node.callee = base;
6078
6099
  node.typeArguments = this.flowParseTypeParameterInstantiationInExpression();
6079
6100
  this.expect(10);
6080
- node.arguments = this.parseCallExpressionArguments(11);
6101
+ node.arguments = this.parseCallExpressionArguments();
6081
6102
  node.optional = true;
6082
6103
  return this.finishCallExpression(node, true);
6083
6104
  } else if (!noCalls && this.shouldParseTypes() && (this.match(47) || this.match(51))) {
@@ -6086,7 +6107,7 @@ function requireLib () {
6086
6107
  const result = this.tryParse(() => {
6087
6108
  node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew();
6088
6109
  this.expect(10);
6089
- node.arguments = super.parseCallExpressionArguments(11);
6110
+ node.arguments = super.parseCallExpressionArguments();
6090
6111
  if (subscriptState.optionalChainMember) {
6091
6112
  node.optional = false;
6092
6113
  }
@@ -7286,14 +7307,14 @@ function requireLib () {
7286
7307
  return new TypeScriptScope(flags);
7287
7308
  }
7288
7309
  enter(flags) {
7289
- if (flags === 512) {
7310
+ if (flags === 1024) {
7290
7311
  this.importsStack.push(new Set());
7291
7312
  }
7292
7313
  super.enter(flags);
7293
7314
  }
7294
7315
  exit() {
7295
7316
  const flags = super.exit();
7296
- if (flags === 512) {
7317
+ if (flags === 1024) {
7297
7318
  this.importsStack.pop();
7298
7319
  }
7299
7320
  return flags;
@@ -9301,9 +9322,8 @@ function requireLib () {
9301
9322
  return this.state.type === token && !this.state.containsEsc;
9302
9323
  }
9303
9324
  isUnparsedContextual(nameStart, name) {
9304
- const nameEnd = nameStart + name.length;
9305
- if (this.input.slice(nameStart, nameEnd) === name) {
9306
- const nextCh = this.input.charCodeAt(nameEnd);
9325
+ if (this.input.startsWith(name, nameStart)) {
9326
+ const nextCh = this.input.charCodeAt(nameStart + name.length);
9307
9327
  return !(isIdentifierChar(nextCh) || (nextCh & 0xfc00) === 0xd800);
9308
9328
  }
9309
9329
  return false;
@@ -9406,9 +9426,10 @@ function requireLib () {
9406
9426
  shorthandAssignLoc,
9407
9427
  doubleProtoLoc,
9408
9428
  privateKeyLoc,
9409
- optionalParametersLoc
9429
+ optionalParametersLoc,
9430
+ voidPatternLoc
9410
9431
  } = refExpressionErrors;
9411
- const hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc;
9432
+ const hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc || !!voidPatternLoc;
9412
9433
  if (!andThrow) {
9413
9434
  return hasErrors;
9414
9435
  }
@@ -9424,6 +9445,9 @@ function requireLib () {
9424
9445
  if (optionalParametersLoc != null) {
9425
9446
  this.unexpected(optionalParametersLoc);
9426
9447
  }
9448
+ if (voidPatternLoc != null) {
9449
+ this.raise(Errors.InvalidCoverDiscardElement, voidPatternLoc);
9450
+ }
9427
9451
  }
9428
9452
  isLiteralPropertyName() {
9429
9453
  return tokenIsLiteralPropertyName(this.state.type);
@@ -9471,14 +9495,22 @@ function requireLib () {
9471
9495
  }
9472
9496
  enterInitialScopes() {
9473
9497
  let paramFlags = 0;
9474
- if (this.inModule) {
9498
+ if (this.inModule || this.optionFlags & 1) {
9475
9499
  paramFlags |= 2;
9476
9500
  }
9477
9501
  if (this.optionFlags & 32) {
9478
9502
  paramFlags |= 1;
9479
9503
  }
9480
- this.scope.enter(1);
9504
+ const isCommonJS = !this.inModule && this.options.sourceType === "commonjs";
9505
+ if (isCommonJS || this.optionFlags & 2) {
9506
+ paramFlags |= 4;
9507
+ }
9481
9508
  this.prodParam.enter(paramFlags);
9509
+ let scopeFlags = isCommonJS ? 514 : 1;
9510
+ if (this.optionFlags & 4) {
9511
+ scopeFlags |= 512;
9512
+ }
9513
+ this.scope.enter(scopeFlags);
9482
9514
  }
9483
9515
  checkDestructuringPrivate(refExpressionErrors) {
9484
9516
  const {
@@ -9495,6 +9527,7 @@ function requireLib () {
9495
9527
  this.doubleProtoLoc = null;
9496
9528
  this.privateKeyLoc = null;
9497
9529
  this.optionalParametersLoc = null;
9530
+ this.voidPatternLoc = null;
9498
9531
  }
9499
9532
  }
9500
9533
  class Node {
@@ -9626,6 +9659,7 @@ function requireLib () {
9626
9659
  case "ArrayPattern":
9627
9660
  case "AssignmentPattern":
9628
9661
  case "RestElement":
9662
+ case "VoidPattern":
9629
9663
  break;
9630
9664
  case "ObjectExpression":
9631
9665
  this.castNodeTo(node, "ObjectPattern");
@@ -9665,6 +9699,9 @@ function requireLib () {
9665
9699
  }
9666
9700
  this.castNodeTo(node, "AssignmentPattern");
9667
9701
  delete node.operator;
9702
+ if (node.left.type === "VoidPattern") {
9703
+ this.raise(Errors.VoidPatternInitializer, node.left);
9704
+ }
9668
9705
  this.toAssignable(node.left, isLHS);
9669
9706
  break;
9670
9707
  case "ParenthesizedExpression":
@@ -9720,6 +9757,7 @@ function requireLib () {
9720
9757
  case "ArrayPattern":
9721
9758
  case "AssignmentPattern":
9722
9759
  case "RestElement":
9760
+ case "VoidPattern":
9723
9761
  return true;
9724
9762
  case "ObjectExpression":
9725
9763
  {
@@ -9765,7 +9803,11 @@ function requireLib () {
9765
9803
  parseRestBinding() {
9766
9804
  const node = this.startNode();
9767
9805
  this.next();
9768
- node.argument = this.parseBindingAtom();
9806
+ const argument = this.parseBindingAtom();
9807
+ if (argument.type === "VoidPattern") {
9808
+ this.raise(Errors.UnexpectedVoidPattern, argument);
9809
+ }
9810
+ node.argument = argument;
9769
9811
  return this.finishNode(node, "RestElement");
9770
9812
  }
9771
9813
  parseBindingAtom() {
@@ -9779,6 +9821,8 @@ function requireLib () {
9779
9821
  }
9780
9822
  case 5:
9781
9823
  return this.parseObjectLike(8, true);
9824
+ case 88:
9825
+ return this.parseVoidPattern(null);
9782
9826
  }
9783
9827
  return this.parseIdentifier();
9784
9828
  }
@@ -9823,7 +9867,12 @@ function requireLib () {
9823
9867
  }
9824
9868
  parseBindingRestProperty(prop) {
9825
9869
  this.next();
9826
- prop.argument = this.parseIdentifier();
9870
+ if (this.hasPlugin("discardBinding") && this.match(88)) {
9871
+ prop.argument = this.parseVoidPattern(null);
9872
+ this.raise(Errors.UnexpectedVoidPattern, prop.argument);
9873
+ } else {
9874
+ prop.argument = this.parseIdentifier();
9875
+ }
9827
9876
  this.checkCommaAfterRest(125);
9828
9877
  return this.finishNode(prop, "RestElement");
9829
9878
  }
@@ -9866,6 +9915,9 @@ function requireLib () {
9866
9915
  left = left != null ? left : this.parseBindingAtom();
9867
9916
  if (!this.eat(29)) return left;
9868
9917
  const node = this.startNodeAt(startLoc);
9918
+ if (left.type === "VoidPattern") {
9919
+ this.raise(Errors.VoidPatternInitializer, left);
9920
+ }
9869
9921
  node.left = left;
9870
9922
  node.right = this.parseMaybeAssignAllowIn();
9871
9923
  return this.finishNode(node, "AssignmentPattern");
@@ -9884,6 +9936,8 @@ function requireLib () {
9884
9936
  return "elements";
9885
9937
  case "ObjectPattern":
9886
9938
  return "properties";
9939
+ case "VoidPattern":
9940
+ return true;
9887
9941
  }
9888
9942
  return false;
9889
9943
  }
@@ -9922,6 +9976,8 @@ function requireLib () {
9922
9976
  }
9923
9977
  }
9924
9978
  return;
9979
+ } else if (type === "VoidPattern" && ancestor.type === "CatchClause") {
9980
+ this.raise(Errors.VoidPatternCatchClauseParam, expression);
9925
9981
  }
9926
9982
  const validity = this.isValidLVal(type, !(hasParenthesizedAncestor || (_expression$extra = expression.extra) != null && _expression$extra.parenthesized) && ancestor.type === "AssignmentExpression", binding);
9927
9983
  if (validity === true) return;
@@ -10105,7 +10161,8 @@ function requireLib () {
10105
10161
  UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
10106
10162
  UnsupportedSignatureParameterKind: ({
10107
10163
  type
10108
- }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`
10164
+ }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`,
10165
+ UsingDeclarationInAmbientContext: kind => `'${kind}' declarations are not allowed in ambient contexts.`
10109
10166
  });
10110
10167
  function keywordTypeFromName(value) {
10111
10168
  switch (value) {
@@ -10380,6 +10437,7 @@ function requireLib () {
10380
10437
  this.expect(14);
10381
10438
  withProperty.value = this.tsParseImportTypeWithPropertyValue();
10382
10439
  node.properties = [this.finishObjectProperty(withProperty)];
10440
+ this.eat(12);
10383
10441
  this.expect(8);
10384
10442
  return this.finishNode(node, "ObjectExpression");
10385
10443
  }
@@ -11120,7 +11178,7 @@ function requireLib () {
11120
11178
  return this.finishNode(node, "TSConditionalType");
11121
11179
  }
11122
11180
  isAbstractConstructorSignature() {
11123
- return this.isContextual(124) && this.lookahead().type === 77;
11181
+ return this.isContextual(124) && this.isLookaheadContextual("new");
11124
11182
  }
11125
11183
  tsParseNonConditionalType() {
11126
11184
  if (this.tsIsStartOfFunctionType()) {
@@ -11191,7 +11249,7 @@ function requireLib () {
11191
11249
  node.typeAnnotation = this.tsInType(() => {
11192
11250
  node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers);
11193
11251
  this.expect(29);
11194
- if (this.isContextual(114) && this.lookahead().type !== 16) {
11252
+ if (this.isContextual(114) && this.lookaheadCharCode() !== 46) {
11195
11253
  const node = this.startNode();
11196
11254
  this.next();
11197
11255
  return this.finishNode(node, "TSIntrinsicKeyword");
@@ -11304,7 +11362,7 @@ function requireLib () {
11304
11362
  this.tsParseModuleOrNamespaceDeclaration(inner, true);
11305
11363
  node.body = inner;
11306
11364
  } else {
11307
- this.scope.enter(512);
11365
+ this.scope.enter(1024);
11308
11366
  this.prodParam.enter(0);
11309
11367
  node.body = this.tsParseModuleBlock();
11310
11368
  this.prodParam.exit();
@@ -11326,7 +11384,7 @@ function requireLib () {
11326
11384
  this.unexpected();
11327
11385
  }
11328
11386
  if (this.match(5)) {
11329
- this.scope.enter(512);
11387
+ this.scope.enter(1024);
11330
11388
  this.prodParam.enter(0);
11331
11389
  node.body = this.tsParseModuleBlock();
11332
11390
  this.prodParam.exit();
@@ -11424,14 +11482,14 @@ function requireLib () {
11424
11482
  declare: true
11425
11483
  });
11426
11484
  case 107:
11427
- if (this.hasPlugin("explicitResourceManagement") && this.isUsing()) {
11485
+ if (this.isUsing()) {
11428
11486
  this.raise(TSErrors.InvalidModifierOnUsingDeclaration, this.state.startLoc, "declare");
11429
11487
  node.declare = true;
11430
11488
  return this.parseVarStatement(node, "using", true);
11431
11489
  }
11432
11490
  break;
11433
11491
  case 96:
11434
- if (this.hasPlugin("explicitResourceManagement") && this.isAwaitUsing()) {
11492
+ if (this.isAwaitUsing()) {
11435
11493
  this.raise(TSErrors.InvalidModifierOnAwaitUsingDeclaration, this.state.startLoc, "declare");
11436
11494
  node.declare = true;
11437
11495
  this.next();
@@ -11467,7 +11525,7 @@ function requireLib () {
11467
11525
  }
11468
11526
  case "global":
11469
11527
  if (this.match(5)) {
11470
- this.scope.enter(512);
11528
+ this.scope.enter(1024);
11471
11529
  this.prodParam.enter(0);
11472
11530
  const mod = node;
11473
11531
  mod.kind = "global";
@@ -11679,6 +11737,7 @@ function requireLib () {
11679
11737
  if (!noCalls && this.atPossibleAsyncArrow(base)) {
11680
11738
  const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction(startLoc);
11681
11739
  if (asyncArrowFn) {
11740
+ state.stop = true;
11682
11741
  return asyncArrowFn;
11683
11742
  }
11684
11743
  }
@@ -11698,7 +11757,7 @@ function requireLib () {
11698
11757
  if (!noCalls && this.eat(10)) {
11699
11758
  const node = this.startNodeAt(startLoc);
11700
11759
  node.callee = base;
11701
- node.arguments = this.parseCallExpressionArguments(11);
11760
+ node.arguments = this.parseCallExpressionArguments();
11702
11761
  this.tsCheckForInvalidTypeCasts(node.arguments);
11703
11762
  {
11704
11763
  node.typeParameters = typeArguments;
@@ -11855,7 +11914,7 @@ function requireLib () {
11855
11914
  }
11856
11915
  }
11857
11916
  isAbstractClass() {
11858
- return this.isContextual(124) && this.lookahead().type === 80;
11917
+ return this.isContextual(124) && this.isLookaheadContextual("class");
11859
11918
  }
11860
11919
  parseExportDefaultExpression() {
11861
11920
  if (this.isAbstractClass()) {
@@ -11876,6 +11935,10 @@ function requireLib () {
11876
11935
  } = this.state;
11877
11936
  const declaration = super.parseVarStatement(node, kind, allowMissingInitializer || isAmbientContext);
11878
11937
  if (!isAmbientContext) return declaration;
11938
+ if (!node.declare && (kind === "using" || kind === "await using")) {
11939
+ this.raiseOverwrite(TSErrors.UsingDeclarationInAmbientContext, node, kind);
11940
+ return declaration;
11941
+ }
11879
11942
  for (const {
11880
11943
  id,
11881
11944
  init
@@ -12846,8 +12909,8 @@ function requireLib () {
12846
12909
  if (super.chStartsBindingIdentifier(ch, pos)) {
12847
12910
  return true;
12848
12911
  }
12849
- const nextToken = this.lookahead();
12850
- if (nextToken.type === 133) {
12912
+ const next = this.nextTokenStart();
12913
+ if (this.input.charCodeAt(next) === 37 && this.input.charCodeAt(next + 1) === 37) {
12851
12914
  return true;
12852
12915
  }
12853
12916
  return false;
@@ -13087,6 +13150,9 @@ function requireLib () {
13087
13150
  if (pluginsMap.has("optionalChainingAssign") && pluginsMap.get("optionalChainingAssign").version !== "2023-07") {
13088
13151
  throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is '2023-07'.");
13089
13152
  }
13153
+ if (pluginsMap.has("discardBinding") && pluginsMap.get("discardBinding").syntaxType !== "void") {
13154
+ throw new Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.");
13155
+ }
13090
13156
  }
13091
13157
  const mixinPlugins = {
13092
13158
  estree,
@@ -13222,6 +13288,9 @@ function requireLib () {
13222
13288
  this.checkDestructuringPrivate(refExpressionErrors);
13223
13289
  refExpressionErrors.privateKeyLoc = null;
13224
13290
  }
13291
+ if (refExpressionErrors.voidPatternLoc != null && refExpressionErrors.voidPatternLoc.index >= startIndex) {
13292
+ refExpressionErrors.voidPatternLoc = null;
13293
+ }
13225
13294
  } else {
13226
13295
  node.left = left;
13227
13296
  }
@@ -13550,9 +13619,9 @@ function requireLib () {
13550
13619
  node.optional = optional;
13551
13620
  }
13552
13621
  if (optional) {
13553
- node.arguments = this.parseCallExpressionArguments(11);
13622
+ node.arguments = this.parseCallExpressionArguments();
13554
13623
  } else {
13555
- node.arguments = this.parseCallExpressionArguments(11, base.type !== "Super", node, refExpressionErrors);
13624
+ node.arguments = this.parseCallExpressionArguments(base.type !== "Super", node, refExpressionErrors);
13556
13625
  }
13557
13626
  let finishedNode = this.finishCallExpression(node, optionalChainMember);
13558
13627
  if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
@@ -13600,17 +13669,17 @@ function requireLib () {
13600
13669
  }
13601
13670
  return this.finishNode(node, optional ? "OptionalCallExpression" : "CallExpression");
13602
13671
  }
13603
- parseCallExpressionArguments(close, allowPlaceholder, nodeForExtra, refExpressionErrors) {
13672
+ parseCallExpressionArguments(allowPlaceholder, nodeForExtra, refExpressionErrors) {
13604
13673
  const elts = [];
13605
13674
  let first = true;
13606
13675
  const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
13607
13676
  this.state.inFSharpPipelineDirectBody = false;
13608
- while (!this.eat(close)) {
13677
+ while (!this.eat(11)) {
13609
13678
  if (first) {
13610
13679
  first = false;
13611
13680
  } else {
13612
13681
  this.expect(12);
13613
- if (this.match(close)) {
13682
+ if (this.match(11)) {
13614
13683
  if (nodeForExtra) {
13615
13684
  this.addTrailingCommaExtraToNode(nodeForExtra);
13616
13685
  }
@@ -13618,7 +13687,7 @@ function requireLib () {
13618
13687
  break;
13619
13688
  }
13620
13689
  }
13621
- elts.push(this.parseExprListItem(false, refExpressionErrors, allowPlaceholder));
13690
+ elts.push(this.parseExprListItem(11, false, refExpressionErrors, allowPlaceholder));
13622
13691
  }
13623
13692
  this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
13624
13693
  return elts;
@@ -13986,7 +14055,9 @@ function requireLib () {
13986
14055
  return this.parseLiteral(value, "NumericLiteral");
13987
14056
  }
13988
14057
  parseBigIntLiteral(value) {
13989
- return this.parseLiteral(value, "BigIntLiteral");
14058
+ {
14059
+ return this.parseLiteral(value, "BigIntLiteral");
14060
+ }
13990
14061
  }
13991
14062
  parseDecimalLiteral(value) {
13992
14063
  return this.parseLiteral(value, "DecimalLiteral");
@@ -14043,7 +14114,7 @@ function requireLib () {
14043
14114
  break;
14044
14115
  }
14045
14116
  } else {
14046
- exprList.push(this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem));
14117
+ exprList.push(this.parseMaybeAssignAllowInOrVoidPattern(11, refExpressionErrors, this.parseParenItem));
14047
14118
  }
14048
14119
  }
14049
14120
  const innerEndLoc = this.state.lastTokEndLoc;
@@ -14105,7 +14176,7 @@ function requireLib () {
14105
14176
  const meta = this.createIdentifier(this.startNodeAtNode(node), "new");
14106
14177
  this.next();
14107
14178
  const metaProp = this.parseMetaProperty(node, meta, "target");
14108
- if (!this.scope.inNonArrowFunction && !this.scope.inClass && !(this.optionFlags & 4)) {
14179
+ if (!this.scope.allowNewTarget) {
14109
14180
  this.raise(Errors.UnexpectedNewTarget, metaProp);
14110
14181
  }
14111
14182
  return metaProp;
@@ -14320,7 +14391,7 @@ function requireLib () {
14320
14391
  parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors) {
14321
14392
  prop.shorthand = false;
14322
14393
  if (this.eat(14)) {
14323
- prop.value = isPattern ? this.parseMaybeDefault(this.state.startLoc) : this.parseMaybeAssignAllowIn(refExpressionErrors);
14394
+ prop.value = isPattern ? this.parseMaybeDefault(this.state.startLoc) : this.parseMaybeAssignAllowInOrVoidPattern(8, refExpressionErrors);
14324
14395
  return this.finishObjectProperty(prop);
14325
14396
  }
14326
14397
  if (!prop.computed && prop.key.type === "Identifier") {
@@ -14411,7 +14482,7 @@ function requireLib () {
14411
14482
  parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
14412
14483
  this.initFunction(node, isAsync);
14413
14484
  node.generator = isGenerator;
14414
- this.scope.enter(2 | 16 | (inClassScope ? 64 : 0) | (allowDirectSuper ? 32 : 0));
14485
+ this.scope.enter(514 | 16 | (inClassScope ? 576 : 0) | (allowDirectSuper ? 32 : 0));
14415
14486
  this.prodParam.enter(functionFlags(isAsync, node.generator));
14416
14487
  this.parseFunctionParams(node, isConstructor);
14417
14488
  const finishedNode = this.parseFunctionBodyAndFinish(node, type, true);
@@ -14432,7 +14503,7 @@ function requireLib () {
14432
14503
  return this.finishNode(node, isTuple ? "TupleExpression" : "ArrayExpression");
14433
14504
  }
14434
14505
  parseArrowExpression(node, params, isAsync, trailingCommaLoc) {
14435
- this.scope.enter(2 | 4);
14506
+ this.scope.enter(514 | 4);
14436
14507
  let flags = functionFlags(isAsync, false);
14437
14508
  if (!this.match(5) && this.prodParam.hasIn) {
14438
14509
  flags |= 8;
@@ -14520,11 +14591,11 @@ function requireLib () {
14520
14591
  break;
14521
14592
  }
14522
14593
  }
14523
- elts.push(this.parseExprListItem(allowEmpty, refExpressionErrors));
14594
+ elts.push(this.parseExprListItem(close, allowEmpty, refExpressionErrors));
14524
14595
  }
14525
14596
  return elts;
14526
14597
  }
14527
- parseExprListItem(allowEmpty, refExpressionErrors, allowPlaceholder) {
14598
+ parseExprListItem(close, allowEmpty, refExpressionErrors, allowPlaceholder) {
14528
14599
  let elt;
14529
14600
  if (this.match(12)) {
14530
14601
  if (!allowEmpty) {
@@ -14545,7 +14616,7 @@ function requireLib () {
14545
14616
  this.next();
14546
14617
  elt = this.finishNode(node, "ArgumentPlaceholder");
14547
14618
  } else {
14548
- elt = this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem);
14619
+ elt = this.parseMaybeAssignAllowInOrVoidPattern(close, refExpressionErrors, this.parseParenItem);
14549
14620
  }
14550
14621
  return elt;
14551
14622
  }
@@ -14628,7 +14699,7 @@ function requireLib () {
14628
14699
  }
14629
14700
  }
14630
14701
  recordAwaitIfAllowed() {
14631
- const isAwaitAllowed = this.prodParam.hasAwait || this.optionFlags & 1 && !this.scope.inFunction;
14702
+ const isAwaitAllowed = this.prodParam.hasAwait;
14632
14703
  if (isAwaitAllowed && !this.scope.inFunction) {
14633
14704
  this.state.hasTopLevelAwait = true;
14634
14705
  }
@@ -14847,6 +14918,24 @@ function requireLib () {
14847
14918
  }
14848
14919
  return this.finishNode(node, "ModuleExpression");
14849
14920
  }
14921
+ parseVoidPattern(refExpressionErrors) {
14922
+ this.expectPlugin("discardBinding");
14923
+ const node = this.startNode();
14924
+ if (refExpressionErrors != null) {
14925
+ refExpressionErrors.voidPatternLoc = this.state.startLoc;
14926
+ }
14927
+ this.next();
14928
+ return this.finishNode(node, "VoidPattern");
14929
+ }
14930
+ parseMaybeAssignAllowInOrVoidPattern(close, refExpressionErrors, afterLeftParse) {
14931
+ if (refExpressionErrors != null && this.match(88)) {
14932
+ const nextCode = this.lookaheadCharCode();
14933
+ if (nextCode === 44 || nextCode === (close === 3 ? 93 : close === 8 ? 125 : 41) || nextCode === 61) {
14934
+ return this.parseMaybeDefault(this.state.startLoc, this.parseVoidPattern(refExpressionErrors));
14935
+ }
14936
+ }
14937
+ return this.parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse);
14938
+ }
14850
14939
  parsePropertyNamePrefixOperator(prop) {}
14851
14940
  }
14852
14941
  const loopLabel = {
@@ -14966,14 +15055,14 @@ function requireLib () {
14966
15055
  }
14967
15056
  class StatementParser extends ExpressionParser {
14968
15057
  parseTopLevel(file, program) {
14969
- file.program = this.parseProgram(program);
15058
+ file.program = this.parseProgram(program, 140, this.options.sourceType === "module" ? "module" : "script");
14970
15059
  file.comments = this.comments;
14971
15060
  if (this.optionFlags & 256) {
14972
15061
  file.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex);
14973
15062
  }
14974
15063
  return this.finishNode(file, "File");
14975
15064
  }
14976
- parseProgram(program, end = 140, sourceType = this.options.sourceType) {
15065
+ parseProgram(program, end, sourceType) {
14977
15066
  program.sourceType = sourceType;
14978
15067
  program.interpreter = this.parseInterpreterDirective();
14979
15068
  this.parseBlockBody(program, true, true, end);
@@ -15031,6 +15120,23 @@ function requireLib () {
15031
15120
  const nextCh = this.codePointAtPos(next);
15032
15121
  return this.chStartsBindingIdentifier(nextCh, next);
15033
15122
  }
15123
+ isForUsing() {
15124
+ if (!this.isContextual(107)) {
15125
+ return false;
15126
+ }
15127
+ const next = this.nextTokenInLineStart();
15128
+ const nextCh = this.codePointAtPos(next);
15129
+ if (this.isUnparsedContextual(next, "of")) {
15130
+ const nextCharAfterOf = this.lookaheadCharCodeSince(next + 2);
15131
+ if (nextCharAfterOf !== 61 && nextCharAfterOf !== 58 && nextCharAfterOf !== 59) {
15132
+ return false;
15133
+ }
15134
+ }
15135
+ if (this.chStartsBindingIdentifier(nextCh, next) || this.isUnparsedContextual(next, "void")) {
15136
+ return true;
15137
+ }
15138
+ return false;
15139
+ }
15034
15140
  isAwaitUsing() {
15035
15141
  if (!this.isContextual(96)) {
15036
15142
  return false;
@@ -15040,7 +15146,6 @@ function requireLib () {
15040
15146
  next = this.nextTokenInLineStartSince(next + 5);
15041
15147
  const nextCh = this.codePointAtPos(next);
15042
15148
  if (this.chStartsBindingIdentifier(nextCh, next)) {
15043
- this.expectPlugin("explicitResourceManagement");
15044
15149
  return true;
15045
15150
  }
15046
15151
  }
@@ -15075,24 +15180,6 @@ function requireLib () {
15075
15180
  const nextCh = this.codePointAtPos(next);
15076
15181
  return nextCh === 123 || this.chStartsBindingIdentifier(nextCh, next);
15077
15182
  }
15078
- allowsForUsing() {
15079
- const {
15080
- type,
15081
- containsEsc,
15082
- end
15083
- } = this.lookahead();
15084
- if (type === 102 && !containsEsc) {
15085
- const nextCharAfterOf = this.lookaheadCharCodeSince(end);
15086
- if (nextCharAfterOf !== 61 && nextCharAfterOf !== 58 && nextCharAfterOf !== 59) {
15087
- return false;
15088
- }
15089
- }
15090
- if (tokenIsIdentifier(type) && !this.hasFollowingLineBreak()) {
15091
- this.expectPlugin("explicitResourceManagement");
15092
- return true;
15093
- }
15094
- return false;
15095
- }
15096
15183
  allowsUsing() {
15097
15184
  return (this.scope.inModule || !this.scope.inTopLevel) && !this.scope.inBareCaseStatement;
15098
15185
  }
@@ -15175,7 +15262,6 @@ function requireLib () {
15175
15262
  if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifierOrBrace()) {
15176
15263
  break;
15177
15264
  }
15178
- this.expectPlugin("explicitResourceManagement");
15179
15265
  if (!this.allowsUsing()) {
15180
15266
  this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
15181
15267
  } else if (!allowDeclaration) {
@@ -15344,7 +15430,7 @@ function requireLib () {
15344
15430
  if (this.eat(10)) {
15345
15431
  const node = this.startNodeAt(startLoc);
15346
15432
  node.callee = expr;
15347
- node.arguments = this.parseCallExpressionArguments(11);
15433
+ node.arguments = this.parseCallExpressionArguments();
15348
15434
  this.toReferencedList(node.arguments);
15349
15435
  return this.finishNode(node, "CallExpression");
15350
15436
  }
@@ -15419,7 +15505,7 @@ function requireLib () {
15419
15505
  const startsWithLet = this.isContextual(100);
15420
15506
  {
15421
15507
  const startsWithAwaitUsing = this.isAwaitUsing();
15422
- const starsWithUsingDeclaration = startsWithAwaitUsing || this.isContextual(107) && this.allowsForUsing();
15508
+ const starsWithUsingDeclaration = startsWithAwaitUsing || this.isForUsing();
15423
15509
  const isLetOrUsing = startsWithLet && this.hasFollowingBindingAtom() || starsWithUsingDeclaration;
15424
15510
  if (this.match(74) || this.match(75) || isLetOrUsing) {
15425
15511
  const initNode = this.startNode();
@@ -15489,7 +15575,7 @@ function requireLib () {
15489
15575
  return this.finishNode(node, "IfStatement");
15490
15576
  }
15491
15577
  parseReturnStatement(node) {
15492
- if (!this.prodParam.hasReturn && !(this.optionFlags & 2)) {
15578
+ if (!this.prodParam.hasReturn) {
15493
15579
  this.raise(Errors.IllegalReturn, this.state.startLoc);
15494
15580
  }
15495
15581
  this.next();
@@ -15761,6 +15847,10 @@ function requireLib () {
15761
15847
  if (id.type === "ArrayPattern" || id.type === "ObjectPattern") {
15762
15848
  this.raise(Errors.UsingDeclarationHasBindingPattern, id.loc.start);
15763
15849
  }
15850
+ } else {
15851
+ if (id.type === "VoidPattern") {
15852
+ this.raise(Errors.UnexpectedVoidPattern, id.loc.start);
15853
+ }
15764
15854
  }
15765
15855
  this.checkLVal(id, {
15766
15856
  type: "VariableDeclarator"
@@ -15788,7 +15878,7 @@ function requireLib () {
15788
15878
  }
15789
15879
  const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
15790
15880
  this.state.maybeInArrowParameters = false;
15791
- this.scope.enter(2);
15881
+ this.scope.enter(514);
15792
15882
  this.prodParam.enter(functionFlags(isAsync, node.generator));
15793
15883
  if (!isDeclaration) {
15794
15884
  node.id = this.parseFunctionId();
@@ -16041,7 +16131,7 @@ function requireLib () {
16041
16131
  }
16042
16132
  parseClassStaticBlock(classBody, member) {
16043
16133
  var _member$decorators;
16044
- this.scope.enter(64 | 128 | 16);
16134
+ this.scope.enter(576 | 128 | 16);
16045
16135
  const oldLabels = this.state.labels;
16046
16136
  this.state.labels = [];
16047
16137
  this.prodParam.enter(0);
@@ -16105,7 +16195,7 @@ function requireLib () {
16105
16195
  return this.finishNode(node, "ClassAccessorProperty");
16106
16196
  }
16107
16197
  parseInitializer(node) {
16108
- this.scope.enter(64 | 16);
16198
+ this.scope.enter(576 | 16);
16109
16199
  this.expressionScope.enter(newExpressionScope());
16110
16200
  this.prodParam.enter(0);
16111
16201
  node.value = this.eat(29) ? this.parseMaybeAssignAllowIn() : null;
@@ -16272,7 +16362,7 @@ function requireLib () {
16272
16362
  }
16273
16363
  return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
16274
16364
  }
16275
- if (this.match(75) || this.match(74) || this.isLet() || this.hasPlugin("explicitResourceManagement") && (this.isUsing() || this.isAwaitUsing())) {
16365
+ if (this.match(75) || this.match(74) || this.isLet() || this.isUsing() || this.isAwaitUsing()) {
16276
16366
  throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
16277
16367
  }
16278
16368
  const res = this.parseMaybeAssignAllowIn();
@@ -16295,10 +16385,9 @@ function requireLib () {
16295
16385
  return false;
16296
16386
  }
16297
16387
  if ((type === 130 || type === 129) && !this.state.containsEsc) {
16298
- const {
16299
- type: nextType
16300
- } = this.lookahead();
16301
- if (tokenIsIdentifier(nextType) && nextType !== 98 || nextType === 5) {
16388
+ const next = this.nextTokenStart();
16389
+ const nextChar = this.input.charCodeAt(next);
16390
+ if (nextChar === 123 || this.chStartsBindingIdentifier(nextChar, next) && !this.input.startsWith("from", next)) {
16302
16391
  this.expectOnePlugin(["flow", "typescript"]);
16303
16392
  return false;
16304
16393
  }
@@ -16341,15 +16430,13 @@ function requireLib () {
16341
16430
  return true;
16342
16431
  }
16343
16432
  }
16344
- if (this.hasPlugin("explicitResourceManagement")) {
16345
- if (this.isUsing()) {
16346
- this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
16347
- return true;
16348
- }
16349
- if (this.isAwaitUsing()) {
16350
- this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
16351
- return true;
16352
- }
16433
+ if (this.isUsing()) {
16434
+ this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
16435
+ return true;
16436
+ }
16437
+ if (this.isAwaitUsing()) {
16438
+ this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
16439
+ return true;
16353
16440
  }
16354
16441
  return type === 74 || type === 75 || type === 68 || type === 80 || this.isLet() || this.isAsyncFunction();
16355
16442
  }
@@ -17212,14 +17299,15 @@ function isReferencedIdentifier(id, parent, parentStack) {
17212
17299
  if (id.name === "arguments") {
17213
17300
  return false;
17214
17301
  }
17215
- if (isReferenced(id, parent)) {
17302
+ if (isReferenced(id, parent, parentStack[parentStack.length - 2])) {
17216
17303
  return true;
17217
17304
  }
17218
17305
  switch (parent.type) {
17219
17306
  case "AssignmentExpression":
17220
17307
  case "AssignmentPattern":
17221
17308
  return true;
17222
- case "ObjectPattern":
17309
+ case "ObjectProperty":
17310
+ return parent.key !== id && isInDestructureAssignment(parent, parentStack);
17223
17311
  case "ArrayPattern":
17224
17312
  return isInDestructureAssignment(parent, parentStack);
17225
17313
  }
@@ -17388,7 +17476,7 @@ function isReferenced(node, parent, grandparent) {
17388
17476
  if (parent.key === node) {
17389
17477
  return !!parent.computed;
17390
17478
  }
17391
- return true;
17479
+ return !grandparent || grandparent.type !== "ObjectPattern";
17392
17480
  // no: class { NODE = value; }
17393
17481
  // yes: class { [NODE] = value; }
17394
17482
  // yes: class { key = NODE; }
@@ -17438,6 +17526,9 @@ function isReferenced(node, parent, grandparent) {
17438
17526
  // yes: export { NODE as foo };
17439
17527
  // no: export { NODE as foo } from "foo";
17440
17528
  case "ExportSpecifier":
17529
+ if (grandparent == null ? void 0 : grandparent.source) {
17530
+ return false;
17531
+ }
17441
17532
  return parent.local === node;
17442
17533
  // no: import NODE from "foo";
17443
17534
  // no: import * as NODE from "foo";
@@ -17518,7 +17609,7 @@ function isCoreComponent(tag) {
17518
17609
  return BASE_TRANSITION;
17519
17610
  }
17520
17611
  }
17521
- const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
17612
+ const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
17522
17613
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
17523
17614
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
17524
17615
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
@@ -17683,6 +17774,9 @@ function hasDynamicKeyVBind(node) {
17683
17774
  function isText$1(node) {
17684
17775
  return node.type === 5 || node.type === 2;
17685
17776
  }
17777
+ function isVPre(p) {
17778
+ return p.type === 7 && p.name === "pre";
17779
+ }
17686
17780
  function isVSlot(p) {
17687
17781
  return p.type === 7 && p.name === "slot";
17688
17782
  }
@@ -17981,7 +18075,7 @@ const tokenizer = new Tokenizer(stack, {
17981
18075
  ondirarg(start, end) {
17982
18076
  if (start === end) return;
17983
18077
  const arg = getSlice(start, end);
17984
- if (inVPre) {
18078
+ if (inVPre && !isVPre(currentProp)) {
17985
18079
  currentProp.name += arg;
17986
18080
  setLocEnd(currentProp.nameLoc, end);
17987
18081
  } else {
@@ -17996,7 +18090,7 @@ const tokenizer = new Tokenizer(stack, {
17996
18090
  },
17997
18091
  ondirmodifier(start, end) {
17998
18092
  const mod = getSlice(start, end);
17999
- if (inVPre) {
18093
+ if (inVPre && !isVPre(currentProp)) {
18000
18094
  currentProp.name += "." + mod;
18001
18095
  setLocEnd(currentProp.nameLoc, end);
18002
18096
  } else if (currentProp.name === "slot") {
@@ -18560,6 +18654,11 @@ function walk$1(node, parent, context, doNotHoistNode = false, inFor = false) {
18560
18654
  } else if (child.type === 12) {
18561
18655
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
18562
18656
  if (constantType >= 2) {
18657
+ if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
18658
+ child.codegenNode.arguments.push(
18659
+ -1 + (` /* ${PatchFlagNames[-1]} */` )
18660
+ );
18661
+ }
18563
18662
  toCache.push(child);
18564
18663
  continue;
18565
18664
  }
@@ -18588,7 +18687,6 @@ function walk$1(node, parent, context, doNotHoistNode = false, inFor = false) {
18588
18687
  }
18589
18688
  }
18590
18689
  let cachedAsArray = false;
18591
- const slotCacheKeys = [];
18592
18690
  if (toCache.length === children.length && node.type === 1) {
18593
18691
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray$3(node.codegenNode.children)) {
18594
18692
  node.codegenNode.children = getCacheExpression(
@@ -18598,7 +18696,6 @@ function walk$1(node, parent, context, doNotHoistNode = false, inFor = false) {
18598
18696
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray$3(node.codegenNode.children) && node.codegenNode.children.type === 15) {
18599
18697
  const slot = getSlotNode(node.codegenNode, "default");
18600
18698
  if (slot) {
18601
- slotCacheKeys.push(context.cached.length);
18602
18699
  slot.returns = getCacheExpression(
18603
18700
  createArrayExpression(slot.returns)
18604
18701
  );
@@ -18608,7 +18705,6 @@ function walk$1(node, parent, context, doNotHoistNode = false, inFor = false) {
18608
18705
  const slotName = findDir(node, "slot", true);
18609
18706
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
18610
18707
  if (slot) {
18611
- slotCacheKeys.push(context.cached.length);
18612
18708
  slot.returns = getCacheExpression(
18613
18709
  createArrayExpression(slot.returns)
18614
18710
  );
@@ -18618,23 +18714,12 @@ function walk$1(node, parent, context, doNotHoistNode = false, inFor = false) {
18618
18714
  }
18619
18715
  if (!cachedAsArray) {
18620
18716
  for (const child of toCache) {
18621
- slotCacheKeys.push(context.cached.length);
18622
18717
  child.codegenNode = context.cache(child.codegenNode);
18623
18718
  }
18624
18719
  }
18625
- if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray$3(node.codegenNode.children) && node.codegenNode.children.type === 15) {
18626
- node.codegenNode.children.properties.push(
18627
- createObjectProperty(
18628
- `__`,
18629
- createSimpleExpression(JSON.stringify(slotCacheKeys), false)
18630
- )
18631
- );
18632
- }
18633
18720
  function getCacheExpression(value) {
18634
18721
  const exp = context.cache(value);
18635
- if (inFor && context.hmr) {
18636
- exp.needArraySpread = true;
18637
- }
18722
+ exp.needArraySpread = true;
18638
18723
  return exp;
18639
18724
  }
18640
18725
  function getSlotNode(node2, name) {
@@ -23620,7 +23705,7 @@ function processIf(node, dir, context, processCodegen) {
23620
23705
  continue;
23621
23706
  }
23622
23707
  if (sibling && sibling.type === 9) {
23623
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
23708
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
23624
23709
  context.onError(
23625
23710
  createCompilerError(30, node.loc)
23626
23711
  );
@@ -23806,7 +23891,7 @@ const transformBind = (dir, _node, context) => {
23806
23891
  arg.children.unshift(`(`);
23807
23892
  arg.children.push(`) || ""`);
23808
23893
  } else if (!arg.isStatic) {
23809
- arg.content = `${arg.content} || ""`;
23894
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
23810
23895
  }
23811
23896
  if (modifiers.some((mod) => mod.content === "camel")) {
23812
23897
  if (arg.type === 4) {
@@ -25322,7 +25407,7 @@ const seen = /* @__PURE__ */ new WeakSet();
25322
25407
  const transformMemo = (node, context) => {
25323
25408
  if (node.type === 1) {
25324
25409
  const dir = findDir(node, "memo");
25325
- if (!dir || seen.has(node)) {
25410
+ if (!dir || seen.has(node) || context.inSSR) {
25326
25411
  return;
25327
25412
  }
25328
25413
  seen.add(node);
@@ -26447,6 +26532,7 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
26447
26532
  isStaticPropertyKey: isStaticPropertyKey,
26448
26533
  isTemplateNode: isTemplateNode,
26449
26534
  isText: isText$1,
26535
+ isVPre: isVPre,
26450
26536
  isVSlot: isVSlot,
26451
26537
  locStub: locStub,
26452
26538
  noopDirectiveTransform: noopDirectiveTransform,
@@ -26561,7 +26647,14 @@ const CSS_VARS_HELPER = `useCssVars`;
26561
26647
  function genCssVarsFromList(vars, id, isProd, isSSR = false) {
26562
26648
  return `{
26563
26649
  ${vars.map(
26564
- (key) => `"${isSSR ? `--` : ``}${genVarName(id, key, isProd, isSSR)}": (${key})`
26650
+ (key) => (
26651
+ // The `:` prefix here is used in `ssrRenderStyle` to distinguish whether
26652
+ // a custom property comes from `ssrCssVars`. If it does, we need to reset
26653
+ // its value to `initial` on the component instance to avoid unintentionally
26654
+ // inheriting the same property value from a different instance of the same
26655
+ // component in the outer scope.
26656
+ `"${isSSR ? `:--` : ``}${genVarName(id, key, isProd, isSSR)}": (${key})`
26657
+ )
26565
26658
  ).join(",\n ")}
26566
26659
  }`;
26567
26660
  }
@@ -31612,7 +31705,7 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
31612
31705
  }
31613
31706
  }
31614
31707
  const shouldProcessUrl = (url) => {
31615
- return !isExternalUrl(url) && !isDataUrl(url) && (options.includeAbsolute || isRelativeUrl(url));
31708
+ return url && !isExternalUrl(url) && !isDataUrl(url) && (options.includeAbsolute || isRelativeUrl(url));
31616
31709
  };
31617
31710
  if (!imageCandidates.some(({ url }) => shouldProcessUrl(url))) {
31618
31711
  return;
@@ -41808,6 +41901,7 @@ var selectorParser = /*@__PURE__*/getDefaultExportFromCjs(distExports);
41808
41901
 
41809
41902
  const animationNameRE = /^(-\w+-)?animation-name$/;
41810
41903
  const animationRE = /^(-\w+-)?animation$/;
41904
+ const keyframesRE = /^(?:-\w+-)?keyframes$/;
41811
41905
  const scopedPlugin = (id = "") => {
41812
41906
  const keyframes = /* @__PURE__ */ Object.create(null);
41813
41907
  const shortId = id.replace(/^data-v-/, "");
@@ -41817,7 +41911,7 @@ const scopedPlugin = (id = "") => {
41817
41911
  processRule(id, rule);
41818
41912
  },
41819
41913
  AtRule(node) {
41820
- if (/-?keyframes$/.test(node.name) && !node.params.endsWith(`-${shortId}`)) {
41914
+ if (keyframesRE.test(node.name) && !node.params.endsWith(`-${shortId}`)) {
41821
41915
  keyframes[node.params] = node.params = node.params + "-" + shortId;
41822
41916
  }
41823
41917
  },
@@ -41846,7 +41940,7 @@ const scopedPlugin = (id = "") => {
41846
41940
  };
41847
41941
  const processedRules = /* @__PURE__ */ new WeakSet();
41848
41942
  function processRule(id, rule) {
41849
- if (processedRules.has(rule) || rule.parent && rule.parent.type === "atrule" && /-?keyframes$/.test(rule.parent.name)) {
41943
+ if (processedRules.has(rule) || rule.parent && rule.parent.type === "atrule" && keyframesRE.test(rule.parent.name)) {
41850
41944
  return;
41851
41945
  }
41852
41946
  processedRules.add(rule);
@@ -48338,7 +48432,7 @@ function recordImport(node, imports) {
48338
48432
  };
48339
48433
  }
48340
48434
  }
48341
- function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx), isKeyOf = false) {
48435
+ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx), isKeyOf = false, typeParameters) {
48342
48436
  try {
48343
48437
  switch (node.type) {
48344
48438
  case "TSStringKeyword":
@@ -48411,12 +48505,38 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
48411
48505
  case "TSTypeReference": {
48412
48506
  const resolved = resolveTypeReference(ctx, node, scope);
48413
48507
  if (resolved) {
48414
- if (resolved.type === "TSTypeAliasDeclaration" && resolved.typeAnnotation.type === "TSFunctionType") {
48415
- return ["Function"];
48508
+ if (resolved.type === "TSTypeAliasDeclaration") {
48509
+ if (resolved.typeAnnotation.type === "TSFunctionType") {
48510
+ return ["Function"];
48511
+ }
48512
+ if (node.typeParameters) {
48513
+ const typeParams = /* @__PURE__ */ Object.create(null);
48514
+ if (resolved.typeParameters) {
48515
+ resolved.typeParameters.params.forEach((p, i) => {
48516
+ typeParams[p.name] = node.typeParameters.params[i];
48517
+ });
48518
+ }
48519
+ return inferRuntimeType(
48520
+ ctx,
48521
+ resolved.typeAnnotation,
48522
+ resolved._ownerScope,
48523
+ isKeyOf,
48524
+ typeParams
48525
+ );
48526
+ }
48416
48527
  }
48417
48528
  return inferRuntimeType(ctx, resolved, resolved._ownerScope, isKeyOf);
48418
48529
  }
48419
48530
  if (node.typeName.type === "Identifier") {
48531
+ if (typeParameters && typeParameters[node.typeName.name]) {
48532
+ return inferRuntimeType(
48533
+ ctx,
48534
+ typeParameters[node.typeName.name],
48535
+ scope,
48536
+ isKeyOf,
48537
+ typeParameters
48538
+ );
48539
+ }
48420
48540
  if (isKeyOf) {
48421
48541
  switch (node.typeName.name) {
48422
48542
  case "String":
@@ -48539,11 +48659,15 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
48539
48659
  case "TSParenthesizedType":
48540
48660
  return inferRuntimeType(ctx, node.typeAnnotation, scope);
48541
48661
  case "TSUnionType":
48542
- return flattenTypes(ctx, node.types, scope, isKeyOf);
48662
+ return flattenTypes(ctx, node.types, scope, isKeyOf, typeParameters);
48543
48663
  case "TSIntersectionType": {
48544
- return flattenTypes(ctx, node.types, scope, isKeyOf).filter(
48545
- (t) => t !== UNKNOWN_TYPE
48546
- );
48664
+ return flattenTypes(
48665
+ ctx,
48666
+ node.types,
48667
+ scope,
48668
+ isKeyOf,
48669
+ typeParameters
48670
+ ).filter((t) => t !== UNKNOWN_TYPE);
48547
48671
  }
48548
48672
  case "TSEnumDeclaration":
48549
48673
  return inferEnumType(node);
@@ -48598,14 +48722,16 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
48598
48722
  }
48599
48723
  return [UNKNOWN_TYPE];
48600
48724
  }
48601
- function flattenTypes(ctx, types, scope, isKeyOf = false) {
48725
+ function flattenTypes(ctx, types, scope, isKeyOf = false, typeParameters = void 0) {
48602
48726
  if (types.length === 1) {
48603
- return inferRuntimeType(ctx, types[0], scope, isKeyOf);
48727
+ return inferRuntimeType(ctx, types[0], scope, isKeyOf, typeParameters);
48604
48728
  }
48605
48729
  return [
48606
48730
  ...new Set(
48607
48731
  [].concat(
48608
- ...types.map((t) => inferRuntimeType(ctx, t, scope, isKeyOf))
48732
+ ...types.map(
48733
+ (t) => inferRuntimeType(ctx, t, scope, isKeyOf, typeParameters)
48734
+ )
48609
48735
  )
48610
48736
  )
48611
48737
  ];
@@ -49509,23 +49635,23 @@ function compileScript(sfc, options) {
49509
49635
  Upgrade your vite or vue-loader version for compatibility with the latest experimental proposals.`
49510
49636
  );
49511
49637
  }
49512
- const ctx = new ScriptCompileContext(sfc, options);
49513
49638
  const { script, scriptSetup, source, filename } = sfc;
49514
49639
  const hoistStatic = options.hoistStatic !== false && !script;
49515
49640
  const scopeId = options.id ? options.id.replace(/^data-v-/, "") : "";
49516
49641
  const scriptLang = script && script.lang;
49517
49642
  const scriptSetupLang = scriptSetup && scriptSetup.lang;
49643
+ if (script && scriptSetup && scriptLang !== scriptSetupLang) {
49644
+ throw new Error(
49645
+ `[@vue/compiler-sfc] <script> and <script setup> must have the same language type.`
49646
+ );
49647
+ }
49648
+ const ctx = new ScriptCompileContext(sfc, options);
49518
49649
  if (!scriptSetup) {
49519
49650
  if (!script) {
49520
49651
  throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
49521
49652
  }
49522
49653
  return processNormalScript(ctx, scopeId);
49523
49654
  }
49524
- if (script && scriptLang !== scriptSetupLang) {
49525
- throw new Error(
49526
- `[@vue/compiler-sfc] <script> and <script setup> must have the same language type.`
49527
- );
49528
- }
49529
49655
  if (scriptSetupLang && !ctx.isJS && !ctx.isTS) {
49530
49656
  return scriptSetup;
49531
49657
  }
@@ -50344,7 +50470,7 @@ var __spreadValues = (a, b) => {
50344
50470
  }
50345
50471
  return a;
50346
50472
  };
50347
- const version = "3.5.17";
50473
+ const version = "3.5.19";
50348
50474
  const parseCache = parseCache$1;
50349
50475
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
50350
50476
  const walk = walk$2;