@vue/compiler-sfc 3.5.17 → 3.5.18

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.18
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -127,7 +127,14 @@ const CSS_VARS_HELPER = `useCssVars`;
127
127
  function genCssVarsFromList(vars, id, isProd, isSSR = false) {
128
128
  return `{
129
129
  ${vars.map(
130
- (key) => `"${isSSR ? `--` : ``}${genVarName(id, key, isProd, isSSR)}": (${key})`
130
+ (key) => (
131
+ // The `:` prefix here is used in `ssrRenderStyle` to distinguish whether
132
+ // a custom property comes from `ssrCssVars`. If it does, we need to reset
133
+ // its value to `initial` on the component instance to avoid unintentionally
134
+ // inheriting the same property value from a different instance of the same
135
+ // component in the outer scope.
136
+ `"${isSSR ? `:--` : ``}${genVarName(id, key, isProd, isSSR)}": (${key})`
137
+ )
131
138
  ).join(",\n ")}
132
139
  }`;
133
140
  }
@@ -2213,7 +2220,7 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
2213
2220
  }
2214
2221
  }
2215
2222
  const shouldProcessUrl = (url) => {
2216
- return !isExternalUrl(url) && !isDataUrl(url) && (options.includeAbsolute || isRelativeUrl(url));
2223
+ return url && !isExternalUrl(url) && !isDataUrl(url) && (options.includeAbsolute || isRelativeUrl(url));
2217
2224
  };
2218
2225
  if (!imageCandidates.some(({ url }) => shouldProcessUrl(url))) {
2219
2226
  return;
@@ -7980,6 +7987,7 @@ var selectorParser = /*@__PURE__*/getDefaultExportFromCjs(distExports);
7980
7987
 
7981
7988
  const animationNameRE = /^(-\w+-)?animation-name$/;
7982
7989
  const animationRE = /^(-\w+-)?animation$/;
7990
+ const keyframesRE = /^(?:-\w+-)?keyframes$/;
7983
7991
  const scopedPlugin = (id = "") => {
7984
7992
  const keyframes = /* @__PURE__ */ Object.create(null);
7985
7993
  const shortId = id.replace(/^data-v-/, "");
@@ -7989,7 +7997,7 @@ const scopedPlugin = (id = "") => {
7989
7997
  processRule(id, rule);
7990
7998
  },
7991
7999
  AtRule(node) {
7992
- if (/-?keyframes$/.test(node.name) && !node.params.endsWith(`-${shortId}`)) {
8000
+ if (keyframesRE.test(node.name) && !node.params.endsWith(`-${shortId}`)) {
7993
8001
  keyframes[node.params] = node.params = node.params + "-" + shortId;
7994
8002
  }
7995
8003
  },
@@ -8018,7 +8026,7 @@ const scopedPlugin = (id = "") => {
8018
8026
  };
8019
8027
  const processedRules = /* @__PURE__ */ new WeakSet();
8020
8028
  function processRule(id, rule) {
8021
- if (processedRules.has(rule) || rule.parent && rule.parent.type === "atrule" && /-?keyframes$/.test(rule.parent.name)) {
8029
+ if (processedRules.has(rule) || rule.parent && rule.parent.type === "atrule" && keyframesRE.test(rule.parent.name)) {
8022
8030
  return;
8023
8031
  }
8024
8032
  processedRules.add(rule);
@@ -24974,7 +24982,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
24974
24982
  return generator.toJSON();
24975
24983
  }
24976
24984
 
24977
- const version = "3.5.17";
24985
+ const version = "3.5.18";
24978
24986
  const parseCache = parseCache$1;
24979
24987
  const errorMessages = {
24980
24988
  ...CompilerDOM.errorMessages,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.5.17
2
+ * @vue/compiler-sfc v3.5.18
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -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 {
@@ -3776,7 +3791,7 @@ function requireLib () {
3776
3791
  startsExpr
3777
3792
  }),
3778
3793
  placeholder: createToken("%%", {
3779
- startsExpr: true
3794
+ startsExpr
3780
3795
  }),
3781
3796
  string: createToken("string", {
3782
3797
  startsExpr
@@ -3799,10 +3814,10 @@ function requireLib () {
3799
3814
  eof: createToken("eof"),
3800
3815
  jsxName: createToken("jsxName"),
3801
3816
  jsxText: createToken("jsxText", {
3802
- beforeExpr: true
3817
+ beforeExpr
3803
3818
  }),
3804
3819
  jsxTagStart: createToken("jsxTagStart", {
3805
- startsExpr: true
3820
+ startsExpr
3806
3821
  }),
3807
3822
  jsxTagEnd: createToken("jsxTagEnd")
3808
3823
  };
@@ -3982,6 +3997,9 @@ function requireLib () {
3982
3997
  get allowDirectSuper() {
3983
3998
  return (this.currentThisScopeFlags() & 32) > 0;
3984
3999
  }
4000
+ get allowNewTarget() {
4001
+ return (this.currentThisScopeFlags() & 512) > 0;
4002
+ }
3985
4003
  get inClass() {
3986
4004
  return (this.currentThisScopeFlags() & 64) > 0;
3987
4005
  }
@@ -3997,7 +4015,7 @@ function requireLib () {
3997
4015
  if (flags & 128) {
3998
4016
  return true;
3999
4017
  }
4000
- if (flags & (643 | 64)) {
4018
+ if (flags & (1667 | 64)) {
4001
4019
  return false;
4002
4020
  }
4003
4021
  }
@@ -4047,7 +4065,7 @@ function requireLib () {
4047
4065
  this.checkRedeclarationInScope(scope, name, bindingType, loc);
4048
4066
  scope.names.set(name, (scope.names.get(name) || 0) | 1);
4049
4067
  this.maybeExportDefined(scope, name);
4050
- if (scope.flags & 643) break;
4068
+ if (scope.flags & 1667) break;
4051
4069
  }
4052
4070
  }
4053
4071
  if (this.parser.inModule && scope.flags & 1) {
@@ -4094,7 +4112,7 @@ function requireLib () {
4094
4112
  const {
4095
4113
  flags
4096
4114
  } = this.scopeStack[i];
4097
- if (flags & 643) {
4115
+ if (flags & 1667) {
4098
4116
  return flags;
4099
4117
  }
4100
4118
  }
@@ -4104,7 +4122,7 @@ function requireLib () {
4104
4122
  const {
4105
4123
  flags
4106
4124
  } = this.scopeStack[i];
4107
- if (flags & (643 | 64) && !(flags & 4)) {
4125
+ if (flags & (1667 | 64) && !(flags & 4)) {
4108
4126
  return flags;
4109
4127
  }
4110
4128
  }
@@ -5502,7 +5520,7 @@ function requireLib () {
5502
5520
  finishArrowValidation(node) {
5503
5521
  var _node$extra;
5504
5522
  this.toAssignableList(node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingCommaLoc, false);
5505
- this.scope.enter(2 | 4);
5523
+ this.scope.enter(514 | 4);
5506
5524
  super.checkParams(node, false, true);
5507
5525
  this.scope.exit();
5508
5526
  }
@@ -6045,7 +6063,7 @@ function requireLib () {
6045
6063
  this.next();
6046
6064
  const node = this.startNodeAt(startLoc);
6047
6065
  node.callee = base;
6048
- node.arguments = super.parseCallExpressionArguments(11);
6066
+ node.arguments = super.parseCallExpressionArguments();
6049
6067
  base = this.finishNode(node, "CallExpression");
6050
6068
  } else if (base.type === "Identifier" && base.name === "async" && this.match(47)) {
6051
6069
  const state = this.state.clone();
@@ -6077,7 +6095,7 @@ function requireLib () {
6077
6095
  node.callee = base;
6078
6096
  node.typeArguments = this.flowParseTypeParameterInstantiationInExpression();
6079
6097
  this.expect(10);
6080
- node.arguments = this.parseCallExpressionArguments(11);
6098
+ node.arguments = this.parseCallExpressionArguments();
6081
6099
  node.optional = true;
6082
6100
  return this.finishCallExpression(node, true);
6083
6101
  } else if (!noCalls && this.shouldParseTypes() && (this.match(47) || this.match(51))) {
@@ -6086,7 +6104,7 @@ function requireLib () {
6086
6104
  const result = this.tryParse(() => {
6087
6105
  node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew();
6088
6106
  this.expect(10);
6089
- node.arguments = super.parseCallExpressionArguments(11);
6107
+ node.arguments = super.parseCallExpressionArguments();
6090
6108
  if (subscriptState.optionalChainMember) {
6091
6109
  node.optional = false;
6092
6110
  }
@@ -7286,14 +7304,14 @@ function requireLib () {
7286
7304
  return new TypeScriptScope(flags);
7287
7305
  }
7288
7306
  enter(flags) {
7289
- if (flags === 512) {
7307
+ if (flags === 1024) {
7290
7308
  this.importsStack.push(new Set());
7291
7309
  }
7292
7310
  super.enter(flags);
7293
7311
  }
7294
7312
  exit() {
7295
7313
  const flags = super.exit();
7296
- if (flags === 512) {
7314
+ if (flags === 1024) {
7297
7315
  this.importsStack.pop();
7298
7316
  }
7299
7317
  return flags;
@@ -9301,9 +9319,8 @@ function requireLib () {
9301
9319
  return this.state.type === token && !this.state.containsEsc;
9302
9320
  }
9303
9321
  isUnparsedContextual(nameStart, name) {
9304
- const nameEnd = nameStart + name.length;
9305
- if (this.input.slice(nameStart, nameEnd) === name) {
9306
- const nextCh = this.input.charCodeAt(nameEnd);
9322
+ if (this.input.startsWith(name, nameStart)) {
9323
+ const nextCh = this.input.charCodeAt(nameStart + name.length);
9307
9324
  return !(isIdentifierChar(nextCh) || (nextCh & 0xfc00) === 0xd800);
9308
9325
  }
9309
9326
  return false;
@@ -9406,9 +9423,10 @@ function requireLib () {
9406
9423
  shorthandAssignLoc,
9407
9424
  doubleProtoLoc,
9408
9425
  privateKeyLoc,
9409
- optionalParametersLoc
9426
+ optionalParametersLoc,
9427
+ voidPatternLoc
9410
9428
  } = refExpressionErrors;
9411
- const hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc;
9429
+ const hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc || !!voidPatternLoc;
9412
9430
  if (!andThrow) {
9413
9431
  return hasErrors;
9414
9432
  }
@@ -9424,6 +9442,9 @@ function requireLib () {
9424
9442
  if (optionalParametersLoc != null) {
9425
9443
  this.unexpected(optionalParametersLoc);
9426
9444
  }
9445
+ if (voidPatternLoc != null) {
9446
+ this.raise(Errors.InvalidCoverDiscardElement, voidPatternLoc);
9447
+ }
9427
9448
  }
9428
9449
  isLiteralPropertyName() {
9429
9450
  return tokenIsLiteralPropertyName(this.state.type);
@@ -9471,14 +9492,22 @@ function requireLib () {
9471
9492
  }
9472
9493
  enterInitialScopes() {
9473
9494
  let paramFlags = 0;
9474
- if (this.inModule) {
9495
+ if (this.inModule || this.optionFlags & 1) {
9475
9496
  paramFlags |= 2;
9476
9497
  }
9477
9498
  if (this.optionFlags & 32) {
9478
9499
  paramFlags |= 1;
9479
9500
  }
9480
- this.scope.enter(1);
9501
+ const isCommonJS = !this.inModule && this.options.sourceType === "commonjs";
9502
+ if (isCommonJS || this.optionFlags & 2) {
9503
+ paramFlags |= 4;
9504
+ }
9481
9505
  this.prodParam.enter(paramFlags);
9506
+ let scopeFlags = isCommonJS ? 514 : 1;
9507
+ if (this.optionFlags & 4) {
9508
+ scopeFlags |= 512;
9509
+ }
9510
+ this.scope.enter(scopeFlags);
9482
9511
  }
9483
9512
  checkDestructuringPrivate(refExpressionErrors) {
9484
9513
  const {
@@ -9495,6 +9524,7 @@ function requireLib () {
9495
9524
  this.doubleProtoLoc = null;
9496
9525
  this.privateKeyLoc = null;
9497
9526
  this.optionalParametersLoc = null;
9527
+ this.voidPatternLoc = null;
9498
9528
  }
9499
9529
  }
9500
9530
  class Node {
@@ -9626,6 +9656,7 @@ function requireLib () {
9626
9656
  case "ArrayPattern":
9627
9657
  case "AssignmentPattern":
9628
9658
  case "RestElement":
9659
+ case "VoidPattern":
9629
9660
  break;
9630
9661
  case "ObjectExpression":
9631
9662
  this.castNodeTo(node, "ObjectPattern");
@@ -9665,6 +9696,9 @@ function requireLib () {
9665
9696
  }
9666
9697
  this.castNodeTo(node, "AssignmentPattern");
9667
9698
  delete node.operator;
9699
+ if (node.left.type === "VoidPattern") {
9700
+ this.raise(Errors.VoidPatternInitializer, node.left);
9701
+ }
9668
9702
  this.toAssignable(node.left, isLHS);
9669
9703
  break;
9670
9704
  case "ParenthesizedExpression":
@@ -9720,6 +9754,7 @@ function requireLib () {
9720
9754
  case "ArrayPattern":
9721
9755
  case "AssignmentPattern":
9722
9756
  case "RestElement":
9757
+ case "VoidPattern":
9723
9758
  return true;
9724
9759
  case "ObjectExpression":
9725
9760
  {
@@ -9765,7 +9800,11 @@ function requireLib () {
9765
9800
  parseRestBinding() {
9766
9801
  const node = this.startNode();
9767
9802
  this.next();
9768
- node.argument = this.parseBindingAtom();
9803
+ const argument = this.parseBindingAtom();
9804
+ if (argument.type === "VoidPattern") {
9805
+ this.raise(Errors.UnexpectedVoidPattern, argument);
9806
+ }
9807
+ node.argument = argument;
9769
9808
  return this.finishNode(node, "RestElement");
9770
9809
  }
9771
9810
  parseBindingAtom() {
@@ -9779,6 +9818,8 @@ function requireLib () {
9779
9818
  }
9780
9819
  case 5:
9781
9820
  return this.parseObjectLike(8, true);
9821
+ case 88:
9822
+ return this.parseVoidPattern(null);
9782
9823
  }
9783
9824
  return this.parseIdentifier();
9784
9825
  }
@@ -9823,7 +9864,12 @@ function requireLib () {
9823
9864
  }
9824
9865
  parseBindingRestProperty(prop) {
9825
9866
  this.next();
9826
- prop.argument = this.parseIdentifier();
9867
+ if (this.hasPlugin("discardBinding") && this.match(88)) {
9868
+ prop.argument = this.parseVoidPattern(null);
9869
+ this.raise(Errors.UnexpectedVoidPattern, prop.argument);
9870
+ } else {
9871
+ prop.argument = this.parseIdentifier();
9872
+ }
9827
9873
  this.checkCommaAfterRest(125);
9828
9874
  return this.finishNode(prop, "RestElement");
9829
9875
  }
@@ -9866,6 +9912,9 @@ function requireLib () {
9866
9912
  left = left != null ? left : this.parseBindingAtom();
9867
9913
  if (!this.eat(29)) return left;
9868
9914
  const node = this.startNodeAt(startLoc);
9915
+ if (left.type === "VoidPattern") {
9916
+ this.raise(Errors.VoidPatternInitializer, left);
9917
+ }
9869
9918
  node.left = left;
9870
9919
  node.right = this.parseMaybeAssignAllowIn();
9871
9920
  return this.finishNode(node, "AssignmentPattern");
@@ -9884,6 +9933,8 @@ function requireLib () {
9884
9933
  return "elements";
9885
9934
  case "ObjectPattern":
9886
9935
  return "properties";
9936
+ case "VoidPattern":
9937
+ return true;
9887
9938
  }
9888
9939
  return false;
9889
9940
  }
@@ -9922,6 +9973,8 @@ function requireLib () {
9922
9973
  }
9923
9974
  }
9924
9975
  return;
9976
+ } else if (type === "VoidPattern" && ancestor.type === "CatchClause") {
9977
+ this.raise(Errors.VoidPatternCatchClauseParam, expression);
9925
9978
  }
9926
9979
  const validity = this.isValidLVal(type, !(hasParenthesizedAncestor || (_expression$extra = expression.extra) != null && _expression$extra.parenthesized) && ancestor.type === "AssignmentExpression", binding);
9927
9980
  if (validity === true) return;
@@ -10105,7 +10158,8 @@ function requireLib () {
10105
10158
  UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
10106
10159
  UnsupportedSignatureParameterKind: ({
10107
10160
  type
10108
- }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`
10161
+ }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`,
10162
+ UsingDeclarationInAmbientContext: kind => `'${kind}' declarations are not allowed in ambient contexts.`
10109
10163
  });
10110
10164
  function keywordTypeFromName(value) {
10111
10165
  switch (value) {
@@ -11120,7 +11174,7 @@ function requireLib () {
11120
11174
  return this.finishNode(node, "TSConditionalType");
11121
11175
  }
11122
11176
  isAbstractConstructorSignature() {
11123
- return this.isContextual(124) && this.lookahead().type === 77;
11177
+ return this.isContextual(124) && this.isLookaheadContextual("new");
11124
11178
  }
11125
11179
  tsParseNonConditionalType() {
11126
11180
  if (this.tsIsStartOfFunctionType()) {
@@ -11191,7 +11245,7 @@ function requireLib () {
11191
11245
  node.typeAnnotation = this.tsInType(() => {
11192
11246
  node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers);
11193
11247
  this.expect(29);
11194
- if (this.isContextual(114) && this.lookahead().type !== 16) {
11248
+ if (this.isContextual(114) && this.lookaheadCharCode() !== 46) {
11195
11249
  const node = this.startNode();
11196
11250
  this.next();
11197
11251
  return this.finishNode(node, "TSIntrinsicKeyword");
@@ -11304,7 +11358,7 @@ function requireLib () {
11304
11358
  this.tsParseModuleOrNamespaceDeclaration(inner, true);
11305
11359
  node.body = inner;
11306
11360
  } else {
11307
- this.scope.enter(512);
11361
+ this.scope.enter(1024);
11308
11362
  this.prodParam.enter(0);
11309
11363
  node.body = this.tsParseModuleBlock();
11310
11364
  this.prodParam.exit();
@@ -11326,7 +11380,7 @@ function requireLib () {
11326
11380
  this.unexpected();
11327
11381
  }
11328
11382
  if (this.match(5)) {
11329
- this.scope.enter(512);
11383
+ this.scope.enter(1024);
11330
11384
  this.prodParam.enter(0);
11331
11385
  node.body = this.tsParseModuleBlock();
11332
11386
  this.prodParam.exit();
@@ -11424,14 +11478,14 @@ function requireLib () {
11424
11478
  declare: true
11425
11479
  });
11426
11480
  case 107:
11427
- if (this.hasPlugin("explicitResourceManagement") && this.isUsing()) {
11481
+ if (this.isUsing()) {
11428
11482
  this.raise(TSErrors.InvalidModifierOnUsingDeclaration, this.state.startLoc, "declare");
11429
11483
  node.declare = true;
11430
11484
  return this.parseVarStatement(node, "using", true);
11431
11485
  }
11432
11486
  break;
11433
11487
  case 96:
11434
- if (this.hasPlugin("explicitResourceManagement") && this.isAwaitUsing()) {
11488
+ if (this.isAwaitUsing()) {
11435
11489
  this.raise(TSErrors.InvalidModifierOnAwaitUsingDeclaration, this.state.startLoc, "declare");
11436
11490
  node.declare = true;
11437
11491
  this.next();
@@ -11467,7 +11521,7 @@ function requireLib () {
11467
11521
  }
11468
11522
  case "global":
11469
11523
  if (this.match(5)) {
11470
- this.scope.enter(512);
11524
+ this.scope.enter(1024);
11471
11525
  this.prodParam.enter(0);
11472
11526
  const mod = node;
11473
11527
  mod.kind = "global";
@@ -11698,7 +11752,7 @@ function requireLib () {
11698
11752
  if (!noCalls && this.eat(10)) {
11699
11753
  const node = this.startNodeAt(startLoc);
11700
11754
  node.callee = base;
11701
- node.arguments = this.parseCallExpressionArguments(11);
11755
+ node.arguments = this.parseCallExpressionArguments();
11702
11756
  this.tsCheckForInvalidTypeCasts(node.arguments);
11703
11757
  {
11704
11758
  node.typeParameters = typeArguments;
@@ -11855,7 +11909,7 @@ function requireLib () {
11855
11909
  }
11856
11910
  }
11857
11911
  isAbstractClass() {
11858
- return this.isContextual(124) && this.lookahead().type === 80;
11912
+ return this.isContextual(124) && this.isLookaheadContextual("class");
11859
11913
  }
11860
11914
  parseExportDefaultExpression() {
11861
11915
  if (this.isAbstractClass()) {
@@ -11876,6 +11930,10 @@ function requireLib () {
11876
11930
  } = this.state;
11877
11931
  const declaration = super.parseVarStatement(node, kind, allowMissingInitializer || isAmbientContext);
11878
11932
  if (!isAmbientContext) return declaration;
11933
+ if (!node.declare && (kind === "using" || kind === "await using")) {
11934
+ this.raiseOverwrite(TSErrors.UsingDeclarationInAmbientContext, node, kind);
11935
+ return declaration;
11936
+ }
11879
11937
  for (const {
11880
11938
  id,
11881
11939
  init
@@ -12846,8 +12904,8 @@ function requireLib () {
12846
12904
  if (super.chStartsBindingIdentifier(ch, pos)) {
12847
12905
  return true;
12848
12906
  }
12849
- const nextToken = this.lookahead();
12850
- if (nextToken.type === 133) {
12907
+ const next = this.nextTokenStart();
12908
+ if (this.input.charCodeAt(next) === 37 && this.input.charCodeAt(next + 1) === 37) {
12851
12909
  return true;
12852
12910
  }
12853
12911
  return false;
@@ -13087,6 +13145,9 @@ function requireLib () {
13087
13145
  if (pluginsMap.has("optionalChainingAssign") && pluginsMap.get("optionalChainingAssign").version !== "2023-07") {
13088
13146
  throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is '2023-07'.");
13089
13147
  }
13148
+ if (pluginsMap.has("discardBinding") && pluginsMap.get("discardBinding").syntaxType !== "void") {
13149
+ throw new Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.");
13150
+ }
13090
13151
  }
13091
13152
  const mixinPlugins = {
13092
13153
  estree,
@@ -13222,6 +13283,9 @@ function requireLib () {
13222
13283
  this.checkDestructuringPrivate(refExpressionErrors);
13223
13284
  refExpressionErrors.privateKeyLoc = null;
13224
13285
  }
13286
+ if (refExpressionErrors.voidPatternLoc != null && refExpressionErrors.voidPatternLoc.index >= startIndex) {
13287
+ refExpressionErrors.voidPatternLoc = null;
13288
+ }
13225
13289
  } else {
13226
13290
  node.left = left;
13227
13291
  }
@@ -13550,9 +13614,9 @@ function requireLib () {
13550
13614
  node.optional = optional;
13551
13615
  }
13552
13616
  if (optional) {
13553
- node.arguments = this.parseCallExpressionArguments(11);
13617
+ node.arguments = this.parseCallExpressionArguments();
13554
13618
  } else {
13555
- node.arguments = this.parseCallExpressionArguments(11, base.type !== "Super", node, refExpressionErrors);
13619
+ node.arguments = this.parseCallExpressionArguments(base.type !== "Super", node, refExpressionErrors);
13556
13620
  }
13557
13621
  let finishedNode = this.finishCallExpression(node, optionalChainMember);
13558
13622
  if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
@@ -13600,17 +13664,17 @@ function requireLib () {
13600
13664
  }
13601
13665
  return this.finishNode(node, optional ? "OptionalCallExpression" : "CallExpression");
13602
13666
  }
13603
- parseCallExpressionArguments(close, allowPlaceholder, nodeForExtra, refExpressionErrors) {
13667
+ parseCallExpressionArguments(allowPlaceholder, nodeForExtra, refExpressionErrors) {
13604
13668
  const elts = [];
13605
13669
  let first = true;
13606
13670
  const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
13607
13671
  this.state.inFSharpPipelineDirectBody = false;
13608
- while (!this.eat(close)) {
13672
+ while (!this.eat(11)) {
13609
13673
  if (first) {
13610
13674
  first = false;
13611
13675
  } else {
13612
13676
  this.expect(12);
13613
- if (this.match(close)) {
13677
+ if (this.match(11)) {
13614
13678
  if (nodeForExtra) {
13615
13679
  this.addTrailingCommaExtraToNode(nodeForExtra);
13616
13680
  }
@@ -13618,7 +13682,7 @@ function requireLib () {
13618
13682
  break;
13619
13683
  }
13620
13684
  }
13621
- elts.push(this.parseExprListItem(false, refExpressionErrors, allowPlaceholder));
13685
+ elts.push(this.parseExprListItem(11, false, refExpressionErrors, allowPlaceholder));
13622
13686
  }
13623
13687
  this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
13624
13688
  return elts;
@@ -13986,7 +14050,9 @@ function requireLib () {
13986
14050
  return this.parseLiteral(value, "NumericLiteral");
13987
14051
  }
13988
14052
  parseBigIntLiteral(value) {
13989
- return this.parseLiteral(value, "BigIntLiteral");
14053
+ {
14054
+ return this.parseLiteral(value, "BigIntLiteral");
14055
+ }
13990
14056
  }
13991
14057
  parseDecimalLiteral(value) {
13992
14058
  return this.parseLiteral(value, "DecimalLiteral");
@@ -14043,7 +14109,7 @@ function requireLib () {
14043
14109
  break;
14044
14110
  }
14045
14111
  } else {
14046
- exprList.push(this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem));
14112
+ exprList.push(this.parseMaybeAssignAllowInOrVoidPattern(11, refExpressionErrors, this.parseParenItem));
14047
14113
  }
14048
14114
  }
14049
14115
  const innerEndLoc = this.state.lastTokEndLoc;
@@ -14105,7 +14171,7 @@ function requireLib () {
14105
14171
  const meta = this.createIdentifier(this.startNodeAtNode(node), "new");
14106
14172
  this.next();
14107
14173
  const metaProp = this.parseMetaProperty(node, meta, "target");
14108
- if (!this.scope.inNonArrowFunction && !this.scope.inClass && !(this.optionFlags & 4)) {
14174
+ if (!this.scope.allowNewTarget) {
14109
14175
  this.raise(Errors.UnexpectedNewTarget, metaProp);
14110
14176
  }
14111
14177
  return metaProp;
@@ -14320,7 +14386,7 @@ function requireLib () {
14320
14386
  parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors) {
14321
14387
  prop.shorthand = false;
14322
14388
  if (this.eat(14)) {
14323
- prop.value = isPattern ? this.parseMaybeDefault(this.state.startLoc) : this.parseMaybeAssignAllowIn(refExpressionErrors);
14389
+ prop.value = isPattern ? this.parseMaybeDefault(this.state.startLoc) : this.parseMaybeAssignAllowInOrVoidPattern(8, refExpressionErrors);
14324
14390
  return this.finishObjectProperty(prop);
14325
14391
  }
14326
14392
  if (!prop.computed && prop.key.type === "Identifier") {
@@ -14411,7 +14477,7 @@ function requireLib () {
14411
14477
  parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
14412
14478
  this.initFunction(node, isAsync);
14413
14479
  node.generator = isGenerator;
14414
- this.scope.enter(2 | 16 | (inClassScope ? 64 : 0) | (allowDirectSuper ? 32 : 0));
14480
+ this.scope.enter(514 | 16 | (inClassScope ? 576 : 0) | (allowDirectSuper ? 32 : 0));
14415
14481
  this.prodParam.enter(functionFlags(isAsync, node.generator));
14416
14482
  this.parseFunctionParams(node, isConstructor);
14417
14483
  const finishedNode = this.parseFunctionBodyAndFinish(node, type, true);
@@ -14432,7 +14498,7 @@ function requireLib () {
14432
14498
  return this.finishNode(node, isTuple ? "TupleExpression" : "ArrayExpression");
14433
14499
  }
14434
14500
  parseArrowExpression(node, params, isAsync, trailingCommaLoc) {
14435
- this.scope.enter(2 | 4);
14501
+ this.scope.enter(514 | 4);
14436
14502
  let flags = functionFlags(isAsync, false);
14437
14503
  if (!this.match(5) && this.prodParam.hasIn) {
14438
14504
  flags |= 8;
@@ -14520,11 +14586,11 @@ function requireLib () {
14520
14586
  break;
14521
14587
  }
14522
14588
  }
14523
- elts.push(this.parseExprListItem(allowEmpty, refExpressionErrors));
14589
+ elts.push(this.parseExprListItem(close, allowEmpty, refExpressionErrors));
14524
14590
  }
14525
14591
  return elts;
14526
14592
  }
14527
- parseExprListItem(allowEmpty, refExpressionErrors, allowPlaceholder) {
14593
+ parseExprListItem(close, allowEmpty, refExpressionErrors, allowPlaceholder) {
14528
14594
  let elt;
14529
14595
  if (this.match(12)) {
14530
14596
  if (!allowEmpty) {
@@ -14545,7 +14611,7 @@ function requireLib () {
14545
14611
  this.next();
14546
14612
  elt = this.finishNode(node, "ArgumentPlaceholder");
14547
14613
  } else {
14548
- elt = this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem);
14614
+ elt = this.parseMaybeAssignAllowInOrVoidPattern(close, refExpressionErrors, this.parseParenItem);
14549
14615
  }
14550
14616
  return elt;
14551
14617
  }
@@ -14628,7 +14694,7 @@ function requireLib () {
14628
14694
  }
14629
14695
  }
14630
14696
  recordAwaitIfAllowed() {
14631
- const isAwaitAllowed = this.prodParam.hasAwait || this.optionFlags & 1 && !this.scope.inFunction;
14697
+ const isAwaitAllowed = this.prodParam.hasAwait;
14632
14698
  if (isAwaitAllowed && !this.scope.inFunction) {
14633
14699
  this.state.hasTopLevelAwait = true;
14634
14700
  }
@@ -14847,6 +14913,24 @@ function requireLib () {
14847
14913
  }
14848
14914
  return this.finishNode(node, "ModuleExpression");
14849
14915
  }
14916
+ parseVoidPattern(refExpressionErrors) {
14917
+ this.expectPlugin("discardBinding");
14918
+ const node = this.startNode();
14919
+ if (refExpressionErrors != null) {
14920
+ refExpressionErrors.voidPatternLoc = this.state.startLoc;
14921
+ }
14922
+ this.next();
14923
+ return this.finishNode(node, "VoidPattern");
14924
+ }
14925
+ parseMaybeAssignAllowInOrVoidPattern(close, refExpressionErrors, afterLeftParse) {
14926
+ if (refExpressionErrors != null && this.match(88)) {
14927
+ const nextCode = this.lookaheadCharCode();
14928
+ if (nextCode === 44 || nextCode === (close === 3 ? 93 : close === 8 ? 125 : 41) || nextCode === 61) {
14929
+ return this.parseMaybeDefault(this.state.startLoc, this.parseVoidPattern(refExpressionErrors));
14930
+ }
14931
+ }
14932
+ return this.parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse);
14933
+ }
14850
14934
  parsePropertyNamePrefixOperator(prop) {}
14851
14935
  }
14852
14936
  const loopLabel = {
@@ -14966,14 +15050,14 @@ function requireLib () {
14966
15050
  }
14967
15051
  class StatementParser extends ExpressionParser {
14968
15052
  parseTopLevel(file, program) {
14969
- file.program = this.parseProgram(program);
15053
+ file.program = this.parseProgram(program, 140, this.options.sourceType === "module" ? "module" : "script");
14970
15054
  file.comments = this.comments;
14971
15055
  if (this.optionFlags & 256) {
14972
15056
  file.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex);
14973
15057
  }
14974
15058
  return this.finishNode(file, "File");
14975
15059
  }
14976
- parseProgram(program, end = 140, sourceType = this.options.sourceType) {
15060
+ parseProgram(program, end, sourceType) {
14977
15061
  program.sourceType = sourceType;
14978
15062
  program.interpreter = this.parseInterpreterDirective();
14979
15063
  this.parseBlockBody(program, true, true, end);
@@ -15031,6 +15115,23 @@ function requireLib () {
15031
15115
  const nextCh = this.codePointAtPos(next);
15032
15116
  return this.chStartsBindingIdentifier(nextCh, next);
15033
15117
  }
15118
+ isForUsing() {
15119
+ if (!this.isContextual(107)) {
15120
+ return false;
15121
+ }
15122
+ const next = this.nextTokenInLineStart();
15123
+ const nextCh = this.codePointAtPos(next);
15124
+ if (this.isUnparsedContextual(next, "of")) {
15125
+ const nextCharAfterOf = this.lookaheadCharCodeSince(next + 2);
15126
+ if (nextCharAfterOf !== 61 && nextCharAfterOf !== 58 && nextCharAfterOf !== 59) {
15127
+ return false;
15128
+ }
15129
+ }
15130
+ if (this.chStartsBindingIdentifier(nextCh, next) || this.isUnparsedContextual(next, "void")) {
15131
+ return true;
15132
+ }
15133
+ return false;
15134
+ }
15034
15135
  isAwaitUsing() {
15035
15136
  if (!this.isContextual(96)) {
15036
15137
  return false;
@@ -15040,7 +15141,6 @@ function requireLib () {
15040
15141
  next = this.nextTokenInLineStartSince(next + 5);
15041
15142
  const nextCh = this.codePointAtPos(next);
15042
15143
  if (this.chStartsBindingIdentifier(nextCh, next)) {
15043
- this.expectPlugin("explicitResourceManagement");
15044
15144
  return true;
15045
15145
  }
15046
15146
  }
@@ -15075,24 +15175,6 @@ function requireLib () {
15075
15175
  const nextCh = this.codePointAtPos(next);
15076
15176
  return nextCh === 123 || this.chStartsBindingIdentifier(nextCh, next);
15077
15177
  }
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
15178
  allowsUsing() {
15097
15179
  return (this.scope.inModule || !this.scope.inTopLevel) && !this.scope.inBareCaseStatement;
15098
15180
  }
@@ -15175,7 +15257,6 @@ function requireLib () {
15175
15257
  if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifierOrBrace()) {
15176
15258
  break;
15177
15259
  }
15178
- this.expectPlugin("explicitResourceManagement");
15179
15260
  if (!this.allowsUsing()) {
15180
15261
  this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
15181
15262
  } else if (!allowDeclaration) {
@@ -15344,7 +15425,7 @@ function requireLib () {
15344
15425
  if (this.eat(10)) {
15345
15426
  const node = this.startNodeAt(startLoc);
15346
15427
  node.callee = expr;
15347
- node.arguments = this.parseCallExpressionArguments(11);
15428
+ node.arguments = this.parseCallExpressionArguments();
15348
15429
  this.toReferencedList(node.arguments);
15349
15430
  return this.finishNode(node, "CallExpression");
15350
15431
  }
@@ -15419,7 +15500,7 @@ function requireLib () {
15419
15500
  const startsWithLet = this.isContextual(100);
15420
15501
  {
15421
15502
  const startsWithAwaitUsing = this.isAwaitUsing();
15422
- const starsWithUsingDeclaration = startsWithAwaitUsing || this.isContextual(107) && this.allowsForUsing();
15503
+ const starsWithUsingDeclaration = startsWithAwaitUsing || this.isForUsing();
15423
15504
  const isLetOrUsing = startsWithLet && this.hasFollowingBindingAtom() || starsWithUsingDeclaration;
15424
15505
  if (this.match(74) || this.match(75) || isLetOrUsing) {
15425
15506
  const initNode = this.startNode();
@@ -15489,7 +15570,7 @@ function requireLib () {
15489
15570
  return this.finishNode(node, "IfStatement");
15490
15571
  }
15491
15572
  parseReturnStatement(node) {
15492
- if (!this.prodParam.hasReturn && !(this.optionFlags & 2)) {
15573
+ if (!this.prodParam.hasReturn) {
15493
15574
  this.raise(Errors.IllegalReturn, this.state.startLoc);
15494
15575
  }
15495
15576
  this.next();
@@ -15761,6 +15842,10 @@ function requireLib () {
15761
15842
  if (id.type === "ArrayPattern" || id.type === "ObjectPattern") {
15762
15843
  this.raise(Errors.UsingDeclarationHasBindingPattern, id.loc.start);
15763
15844
  }
15845
+ } else {
15846
+ if (id.type === "VoidPattern") {
15847
+ this.raise(Errors.UnexpectedVoidPattern, id.loc.start);
15848
+ }
15764
15849
  }
15765
15850
  this.checkLVal(id, {
15766
15851
  type: "VariableDeclarator"
@@ -15788,7 +15873,7 @@ function requireLib () {
15788
15873
  }
15789
15874
  const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
15790
15875
  this.state.maybeInArrowParameters = false;
15791
- this.scope.enter(2);
15876
+ this.scope.enter(514);
15792
15877
  this.prodParam.enter(functionFlags(isAsync, node.generator));
15793
15878
  if (!isDeclaration) {
15794
15879
  node.id = this.parseFunctionId();
@@ -16041,7 +16126,7 @@ function requireLib () {
16041
16126
  }
16042
16127
  parseClassStaticBlock(classBody, member) {
16043
16128
  var _member$decorators;
16044
- this.scope.enter(64 | 128 | 16);
16129
+ this.scope.enter(576 | 128 | 16);
16045
16130
  const oldLabels = this.state.labels;
16046
16131
  this.state.labels = [];
16047
16132
  this.prodParam.enter(0);
@@ -16105,7 +16190,7 @@ function requireLib () {
16105
16190
  return this.finishNode(node, "ClassAccessorProperty");
16106
16191
  }
16107
16192
  parseInitializer(node) {
16108
- this.scope.enter(64 | 16);
16193
+ this.scope.enter(576 | 16);
16109
16194
  this.expressionScope.enter(newExpressionScope());
16110
16195
  this.prodParam.enter(0);
16111
16196
  node.value = this.eat(29) ? this.parseMaybeAssignAllowIn() : null;
@@ -16272,7 +16357,7 @@ function requireLib () {
16272
16357
  }
16273
16358
  return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
16274
16359
  }
16275
- if (this.match(75) || this.match(74) || this.isLet() || this.hasPlugin("explicitResourceManagement") && (this.isUsing() || this.isAwaitUsing())) {
16360
+ if (this.match(75) || this.match(74) || this.isLet() || this.isUsing() || this.isAwaitUsing()) {
16276
16361
  throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
16277
16362
  }
16278
16363
  const res = this.parseMaybeAssignAllowIn();
@@ -16295,10 +16380,9 @@ function requireLib () {
16295
16380
  return false;
16296
16381
  }
16297
16382
  if ((type === 130 || type === 129) && !this.state.containsEsc) {
16298
- const {
16299
- type: nextType
16300
- } = this.lookahead();
16301
- if (tokenIsIdentifier(nextType) && nextType !== 98 || nextType === 5) {
16383
+ const next = this.nextTokenStart();
16384
+ const nextChar = this.input.charCodeAt(next);
16385
+ if (nextChar === 123 || this.chStartsBindingIdentifier(nextChar, next) && !this.input.startsWith("from", next)) {
16302
16386
  this.expectOnePlugin(["flow", "typescript"]);
16303
16387
  return false;
16304
16388
  }
@@ -16341,15 +16425,13 @@ function requireLib () {
16341
16425
  return true;
16342
16426
  }
16343
16427
  }
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
- }
16428
+ if (this.isUsing()) {
16429
+ this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
16430
+ return true;
16431
+ }
16432
+ if (this.isAwaitUsing()) {
16433
+ this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
16434
+ return true;
16353
16435
  }
16354
16436
  return type === 74 || type === 75 || type === 68 || type === 80 || this.isLet() || this.isAsyncFunction();
16355
16437
  }
@@ -17212,14 +17294,15 @@ function isReferencedIdentifier(id, parent, parentStack) {
17212
17294
  if (id.name === "arguments") {
17213
17295
  return false;
17214
17296
  }
17215
- if (isReferenced(id, parent)) {
17297
+ if (isReferenced(id, parent, parentStack[parentStack.length - 2])) {
17216
17298
  return true;
17217
17299
  }
17218
17300
  switch (parent.type) {
17219
17301
  case "AssignmentExpression":
17220
17302
  case "AssignmentPattern":
17221
17303
  return true;
17222
- case "ObjectPattern":
17304
+ case "ObjectProperty":
17305
+ return parent.key !== id && isInDestructureAssignment(parent, parentStack);
17223
17306
  case "ArrayPattern":
17224
17307
  return isInDestructureAssignment(parent, parentStack);
17225
17308
  }
@@ -17388,7 +17471,7 @@ function isReferenced(node, parent, grandparent) {
17388
17471
  if (parent.key === node) {
17389
17472
  return !!parent.computed;
17390
17473
  }
17391
- return true;
17474
+ return !grandparent || grandparent.type !== "ObjectPattern";
17392
17475
  // no: class { NODE = value; }
17393
17476
  // yes: class { [NODE] = value; }
17394
17477
  // yes: class { key = NODE; }
@@ -17438,6 +17521,9 @@ function isReferenced(node, parent, grandparent) {
17438
17521
  // yes: export { NODE as foo };
17439
17522
  // no: export { NODE as foo } from "foo";
17440
17523
  case "ExportSpecifier":
17524
+ if (grandparent == null ? void 0 : grandparent.source) {
17525
+ return false;
17526
+ }
17441
17527
  return parent.local === node;
17442
17528
  // no: import NODE from "foo";
17443
17529
  // no: import * as NODE from "foo";
@@ -17518,7 +17604,7 @@ function isCoreComponent(tag) {
17518
17604
  return BASE_TRANSITION;
17519
17605
  }
17520
17606
  }
17521
- const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
17607
+ const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
17522
17608
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
17523
17609
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
17524
17610
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
@@ -17683,6 +17769,9 @@ function hasDynamicKeyVBind(node) {
17683
17769
  function isText$1(node) {
17684
17770
  return node.type === 5 || node.type === 2;
17685
17771
  }
17772
+ function isVPre(p) {
17773
+ return p.type === 7 && p.name === "pre";
17774
+ }
17686
17775
  function isVSlot(p) {
17687
17776
  return p.type === 7 && p.name === "slot";
17688
17777
  }
@@ -17981,7 +18070,7 @@ const tokenizer = new Tokenizer(stack, {
17981
18070
  ondirarg(start, end) {
17982
18071
  if (start === end) return;
17983
18072
  const arg = getSlice(start, end);
17984
- if (inVPre) {
18073
+ if (inVPre && !isVPre(currentProp)) {
17985
18074
  currentProp.name += arg;
17986
18075
  setLocEnd(currentProp.nameLoc, end);
17987
18076
  } else {
@@ -17996,7 +18085,7 @@ const tokenizer = new Tokenizer(stack, {
17996
18085
  },
17997
18086
  ondirmodifier(start, end) {
17998
18087
  const mod = getSlice(start, end);
17999
- if (inVPre) {
18088
+ if (inVPre && !isVPre(currentProp)) {
18000
18089
  currentProp.name += "." + mod;
18001
18090
  setLocEnd(currentProp.nameLoc, end);
18002
18091
  } else if (currentProp.name === "slot") {
@@ -18560,6 +18649,11 @@ function walk$1(node, parent, context, doNotHoistNode = false, inFor = false) {
18560
18649
  } else if (child.type === 12) {
18561
18650
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
18562
18651
  if (constantType >= 2) {
18652
+ if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
18653
+ child.codegenNode.arguments.push(
18654
+ -1 + (` /* ${PatchFlagNames[-1]} */` )
18655
+ );
18656
+ }
18563
18657
  toCache.push(child);
18564
18658
  continue;
18565
18659
  }
@@ -23806,7 +23900,7 @@ const transformBind = (dir, _node, context) => {
23806
23900
  arg.children.unshift(`(`);
23807
23901
  arg.children.push(`) || ""`);
23808
23902
  } else if (!arg.isStatic) {
23809
- arg.content = `${arg.content} || ""`;
23903
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
23810
23904
  }
23811
23905
  if (modifiers.some((mod) => mod.content === "camel")) {
23812
23906
  if (arg.type === 4) {
@@ -26447,6 +26541,7 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
26447
26541
  isStaticPropertyKey: isStaticPropertyKey,
26448
26542
  isTemplateNode: isTemplateNode,
26449
26543
  isText: isText$1,
26544
+ isVPre: isVPre,
26450
26545
  isVSlot: isVSlot,
26451
26546
  locStub: locStub,
26452
26547
  noopDirectiveTransform: noopDirectiveTransform,
@@ -26561,7 +26656,14 @@ const CSS_VARS_HELPER = `useCssVars`;
26561
26656
  function genCssVarsFromList(vars, id, isProd, isSSR = false) {
26562
26657
  return `{
26563
26658
  ${vars.map(
26564
- (key) => `"${isSSR ? `--` : ``}${genVarName(id, key, isProd, isSSR)}": (${key})`
26659
+ (key) => (
26660
+ // The `:` prefix here is used in `ssrRenderStyle` to distinguish whether
26661
+ // a custom property comes from `ssrCssVars`. If it does, we need to reset
26662
+ // its value to `initial` on the component instance to avoid unintentionally
26663
+ // inheriting the same property value from a different instance of the same
26664
+ // component in the outer scope.
26665
+ `"${isSSR ? `:--` : ``}${genVarName(id, key, isProd, isSSR)}": (${key})`
26666
+ )
26565
26667
  ).join(",\n ")}
26566
26668
  }`;
26567
26669
  }
@@ -31612,7 +31714,7 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
31612
31714
  }
31613
31715
  }
31614
31716
  const shouldProcessUrl = (url) => {
31615
- return !isExternalUrl(url) && !isDataUrl(url) && (options.includeAbsolute || isRelativeUrl(url));
31717
+ return url && !isExternalUrl(url) && !isDataUrl(url) && (options.includeAbsolute || isRelativeUrl(url));
31616
31718
  };
31617
31719
  if (!imageCandidates.some(({ url }) => shouldProcessUrl(url))) {
31618
31720
  return;
@@ -41808,6 +41910,7 @@ var selectorParser = /*@__PURE__*/getDefaultExportFromCjs(distExports);
41808
41910
 
41809
41911
  const animationNameRE = /^(-\w+-)?animation-name$/;
41810
41912
  const animationRE = /^(-\w+-)?animation$/;
41913
+ const keyframesRE = /^(?:-\w+-)?keyframes$/;
41811
41914
  const scopedPlugin = (id = "") => {
41812
41915
  const keyframes = /* @__PURE__ */ Object.create(null);
41813
41916
  const shortId = id.replace(/^data-v-/, "");
@@ -41817,7 +41920,7 @@ const scopedPlugin = (id = "") => {
41817
41920
  processRule(id, rule);
41818
41921
  },
41819
41922
  AtRule(node) {
41820
- if (/-?keyframes$/.test(node.name) && !node.params.endsWith(`-${shortId}`)) {
41923
+ if (keyframesRE.test(node.name) && !node.params.endsWith(`-${shortId}`)) {
41821
41924
  keyframes[node.params] = node.params = node.params + "-" + shortId;
41822
41925
  }
41823
41926
  },
@@ -41846,7 +41949,7 @@ const scopedPlugin = (id = "") => {
41846
41949
  };
41847
41950
  const processedRules = /* @__PURE__ */ new WeakSet();
41848
41951
  function processRule(id, rule) {
41849
- if (processedRules.has(rule) || rule.parent && rule.parent.type === "atrule" && /-?keyframes$/.test(rule.parent.name)) {
41952
+ if (processedRules.has(rule) || rule.parent && rule.parent.type === "atrule" && keyframesRE.test(rule.parent.name)) {
41850
41953
  return;
41851
41954
  }
41852
41955
  processedRules.add(rule);
@@ -50344,7 +50447,7 @@ var __spreadValues = (a, b) => {
50344
50447
  }
50345
50448
  return a;
50346
50449
  };
50347
- const version = "3.5.17";
50450
+ const version = "3.5.18";
50348
50451
  const parseCache = parseCache$1;
50349
50452
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
50350
50453
  const walk = walk$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.5.17",
3
+ "version": "3.5.18",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "module": "dist/compiler-sfc.esm-browser.js",
@@ -42,18 +42,18 @@
42
42
  },
43
43
  "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
44
44
  "dependencies": {
45
- "@babel/parser": "^7.27.5",
45
+ "@babel/parser": "^7.28.0",
46
46
  "estree-walker": "^2.0.2",
47
47
  "magic-string": "^0.30.17",
48
48
  "postcss": "^8.5.6",
49
49
  "source-map-js": "^1.2.1",
50
- "@vue/compiler-dom": "3.5.17",
51
- "@vue/compiler-core": "3.5.17",
52
- "@vue/compiler-ssr": "3.5.17",
53
- "@vue/shared": "3.5.17"
50
+ "@vue/compiler-dom": "3.5.18",
51
+ "@vue/compiler-ssr": "3.5.18",
52
+ "@vue/shared": "3.5.18",
53
+ "@vue/compiler-core": "3.5.18"
54
54
  },
55
55
  "devDependencies": {
56
- "@babel/types": "^7.27.6",
56
+ "@babel/types": "^7.28.1",
57
57
  "@vue/consolidate": "^1.0.0",
58
58
  "hash-sum": "^2.0.0",
59
59
  "lru-cache": "10.1.0",