@vue/compiler-sfc 3.4.27 → 3.4.29

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.4.27
2
+ * @vue/compiler-sfc v3.4.29
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -91,6 +91,9 @@ const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
91
91
 
92
92
  const range = 2;
93
93
  function generateCodeFrame(source, start = 0, end = source.length) {
94
+ start = Math.max(0, Math.min(start, source.length));
95
+ end = Math.max(0, Math.min(end, source.length));
96
+ if (start > end) return "";
94
97
  let lines = source.split(/(\r?\n)/);
95
98
  const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
96
99
  lines = lines.filter((_, idx) => idx % 2 === 0);
@@ -100,8 +103,7 @@ function generateCodeFrame(source, start = 0, end = source.length) {
100
103
  count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
101
104
  if (count >= start) {
102
105
  for (let j = i - range; j <= i + range || end > count; j++) {
103
- if (j < 0 || j >= lines.length)
104
- continue;
106
+ if (j < 0 || j >= lines.length) continue;
105
107
  const line = j + 1;
106
108
  res.push(
107
109
  `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
@@ -2146,8 +2148,7 @@ function warnDeprecation(key, context, loc, ...args) {
2146
2148
  Details: ${link}` : ``}`;
2147
2149
  const err = new SyntaxError(msg);
2148
2150
  err.code = key;
2149
- if (loc)
2150
- err.loc = loc;
2151
+ if (loc) err.loc = loc;
2151
2152
  context.onWarn(err);
2152
2153
  }
2153
2154
 
@@ -2447,10 +2448,7 @@ const NodeDescriptions = {
2447
2448
  VariableDeclarator: "variable declaration",
2448
2449
  YieldExpression: "yield expression"
2449
2450
  };
2450
- const toNodeDescription = ({
2451
- type,
2452
- prefix
2453
- }) => type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[String(prefix)] : NodeDescriptions[type];
2451
+ const toNodeDescription = node => node.type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[`${node.prefix}`] : NodeDescriptions[node.type];
2454
2452
  var StandardErrors = {
2455
2453
  AccessorIsGenerator: ({
2456
2454
  kind
@@ -2661,6 +2659,7 @@ var StandardErrors = {
2661
2659
  UnterminatedRegExp: "Unterminated regular expression.",
2662
2660
  UnterminatedString: "Unterminated string constant.",
2663
2661
  UnterminatedTemplate: "Unterminated template.",
2662
+ UsingDeclarationExport: "Using declaration cannot be exported.",
2664
2663
  UsingDeclarationHasBindingPattern: "Using declaration cannot have destructuring patterns.",
2665
2664
  VarRedeclaration: ({
2666
2665
  identifierName
@@ -2950,6 +2949,10 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
2950
2949
  }
2951
2950
  return this.finishNode(node, "MethodDefinition");
2952
2951
  }
2952
+ nameIsConstructor(key) {
2953
+ if (key.type === "Literal") return key.value === "constructor";
2954
+ return super.nameIsConstructor(key);
2955
+ }
2953
2956
  parseClassProperty(...args) {
2954
2957
  const propertyNode = super.parseClassProperty(...args);
2955
2958
  {
@@ -3014,9 +3017,9 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
3014
3017
  }
3015
3018
  }
3016
3019
  toAssignableObjectExpressionProp(prop, isLast, isLHS) {
3017
- if (prop.kind === "get" || prop.kind === "set") {
3020
+ if (prop.type === "Property" && (prop.kind === "get" || prop.kind === "set")) {
3018
3021
  this.raise(Errors.PatternHasAccessor, prop.key);
3019
- } else if (prop.method) {
3022
+ } else if (prop.type === "Property" && prop.method) {
3020
3023
  this.raise(Errors.PatternHasMethod, prop.key);
3021
3024
  } else {
3022
3025
  super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
@@ -3028,9 +3031,9 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
3028
3031
  node.type = "ImportExpression";
3029
3032
  node.source = node.arguments[0];
3030
3033
  if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
3031
- var _node$arguments$, _node$arguments$2;
3032
- node.options = (_node$arguments$ = node.arguments[1]) != null ? _node$arguments$ : null;
3033
- node.attributes = (_node$arguments$2 = node.arguments[1]) != null ? _node$arguments$2 : null;
3034
+ var _ref, _ref2;
3035
+ node.options = (_ref = node.arguments[1]) != null ? _ref : null;
3036
+ node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
3034
3037
  }
3035
3038
  delete node.arguments;
3036
3039
  delete node.callee;
@@ -3102,7 +3105,7 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
3102
3105
  return node.type === "Property" && node.kind === "init" && !node.method;
3103
3106
  }
3104
3107
  isObjectMethod(node) {
3105
- return node.method || node.kind === "get" || node.kind === "set";
3108
+ return node.type === "Property" && (node.method || node.kind === "get" || node.kind === "set");
3106
3109
  }
3107
3110
  finishNodeAt(node, type, endLoc) {
3108
3111
  return toESTreeLocation(super.finishNodeAt(node, type, endLoc));
@@ -4005,7 +4008,9 @@ class CommentsParser extends BaseParser {
4005
4008
  const {
4006
4009
  commentsLen
4007
4010
  } = this.state;
4008
- if (this.comments.length != commentsLen) this.comments.length = commentsLen;
4011
+ if (this.comments.length !== commentsLen) {
4012
+ this.comments.length = commentsLen;
4013
+ }
4009
4014
  this.comments.push(comment);
4010
4015
  this.state.commentsLen++;
4011
4016
  }
@@ -4227,12 +4232,8 @@ class State {
4227
4232
  get strict() {
4228
4233
  return (this.flags & 1) > 0;
4229
4234
  }
4230
- set strict(value) {
4231
- if (value) {
4232
- this.flags |= 1;
4233
- } else {
4234
- this.flags &= ~1;
4235
- }
4235
+ set strict(v) {
4236
+ if (v) this.flags |= 1;else this.flags &= -2;
4236
4237
  }
4237
4238
  init({
4238
4239
  strictMode,
@@ -4248,112 +4249,68 @@ class State {
4248
4249
  get maybeInArrowParameters() {
4249
4250
  return (this.flags & 2) > 0;
4250
4251
  }
4251
- set maybeInArrowParameters(value) {
4252
- if (value) {
4253
- this.flags |= 2;
4254
- } else {
4255
- this.flags &= ~2;
4256
- }
4252
+ set maybeInArrowParameters(v) {
4253
+ if (v) this.flags |= 2;else this.flags &= -3;
4257
4254
  }
4258
4255
  get inType() {
4259
4256
  return (this.flags & 4) > 0;
4260
4257
  }
4261
- set inType(value) {
4262
- if (value) {
4263
- this.flags |= 4;
4264
- } else {
4265
- this.flags &= ~4;
4266
- }
4258
+ set inType(v) {
4259
+ if (v) this.flags |= 4;else this.flags &= -5;
4267
4260
  }
4268
4261
  get noAnonFunctionType() {
4269
4262
  return (this.flags & 8) > 0;
4270
4263
  }
4271
- set noAnonFunctionType(value) {
4272
- if (value) {
4273
- this.flags |= 8;
4274
- } else {
4275
- this.flags &= ~8;
4276
- }
4264
+ set noAnonFunctionType(v) {
4265
+ if (v) this.flags |= 8;else this.flags &= -9;
4277
4266
  }
4278
4267
  get hasFlowComment() {
4279
4268
  return (this.flags & 16) > 0;
4280
4269
  }
4281
- set hasFlowComment(value) {
4282
- if (value) {
4283
- this.flags |= 16;
4284
- } else {
4285
- this.flags &= ~16;
4286
- }
4270
+ set hasFlowComment(v) {
4271
+ if (v) this.flags |= 16;else this.flags &= -17;
4287
4272
  }
4288
4273
  get isAmbientContext() {
4289
4274
  return (this.flags & 32) > 0;
4290
4275
  }
4291
- set isAmbientContext(value) {
4292
- if (value) {
4293
- this.flags |= 32;
4294
- } else {
4295
- this.flags &= ~32;
4296
- }
4276
+ set isAmbientContext(v) {
4277
+ if (v) this.flags |= 32;else this.flags &= -33;
4297
4278
  }
4298
4279
  get inAbstractClass() {
4299
4280
  return (this.flags & 64) > 0;
4300
4281
  }
4301
- set inAbstractClass(value) {
4302
- if (value) {
4303
- this.flags |= 64;
4304
- } else {
4305
- this.flags &= ~64;
4306
- }
4282
+ set inAbstractClass(v) {
4283
+ if (v) this.flags |= 64;else this.flags &= -65;
4307
4284
  }
4308
4285
  get inDisallowConditionalTypesContext() {
4309
4286
  return (this.flags & 128) > 0;
4310
4287
  }
4311
- set inDisallowConditionalTypesContext(value) {
4312
- if (value) {
4313
- this.flags |= 128;
4314
- } else {
4315
- this.flags &= ~128;
4316
- }
4288
+ set inDisallowConditionalTypesContext(v) {
4289
+ if (v) this.flags |= 128;else this.flags &= -129;
4317
4290
  }
4318
4291
  get soloAwait() {
4319
4292
  return (this.flags & 256) > 0;
4320
4293
  }
4321
- set soloAwait(value) {
4322
- if (value) {
4323
- this.flags |= 256;
4324
- } else {
4325
- this.flags &= ~256;
4326
- }
4294
+ set soloAwait(v) {
4295
+ if (v) this.flags |= 256;else this.flags &= -257;
4327
4296
  }
4328
4297
  get inFSharpPipelineDirectBody() {
4329
4298
  return (this.flags & 512) > 0;
4330
4299
  }
4331
- set inFSharpPipelineDirectBody(value) {
4332
- if (value) {
4333
- this.flags |= 512;
4334
- } else {
4335
- this.flags &= ~512;
4336
- }
4300
+ set inFSharpPipelineDirectBody(v) {
4301
+ if (v) this.flags |= 512;else this.flags &= -513;
4337
4302
  }
4338
4303
  get canStartJSXElement() {
4339
4304
  return (this.flags & 1024) > 0;
4340
4305
  }
4341
- set canStartJSXElement(value) {
4342
- if (value) {
4343
- this.flags |= 1024;
4344
- } else {
4345
- this.flags &= ~1024;
4346
- }
4306
+ set canStartJSXElement(v) {
4307
+ if (v) this.flags |= 1024;else this.flags &= -1025;
4347
4308
  }
4348
4309
  get containsEsc() {
4349
4310
  return (this.flags & 2048) > 0;
4350
4311
  }
4351
- set containsEsc(value) {
4352
- if (value) {
4353
- this.flags |= 2048;
4354
- } else {
4355
- this.flags &= ~2048;
4356
- }
4312
+ set containsEsc(v) {
4313
+ if (v) this.flags |= 2048;else this.flags &= -2049;
4357
4314
  }
4358
4315
  curPosition() {
4359
4316
  return new Position(this.curLine, this.pos - this.lineStart, this.pos);
@@ -7179,50 +7136,56 @@ var flow = superClass => class FlowParserMixin extends superClass {
7179
7136
  this.state.noAnonFunctionType = oldNoAnonFunctionType;
7180
7137
  return type;
7181
7138
  case 47:
7182
- node.typeParameters = this.flowParseTypeParameterDeclaration();
7183
- this.expect(10);
7184
- tmp = this.flowParseFunctionTypeParams();
7185
- node.params = tmp.params;
7186
- node.rest = tmp.rest;
7187
- node.this = tmp._this;
7188
- this.expect(11);
7189
- this.expect(19);
7190
- node.returnType = this.flowParseType();
7191
- return this.finishNode(node, "FunctionTypeAnnotation");
7139
+ {
7140
+ const node = this.startNode();
7141
+ node.typeParameters = this.flowParseTypeParameterDeclaration();
7142
+ this.expect(10);
7143
+ tmp = this.flowParseFunctionTypeParams();
7144
+ node.params = tmp.params;
7145
+ node.rest = tmp.rest;
7146
+ node.this = tmp._this;
7147
+ this.expect(11);
7148
+ this.expect(19);
7149
+ node.returnType = this.flowParseType();
7150
+ return this.finishNode(node, "FunctionTypeAnnotation");
7151
+ }
7192
7152
  case 10:
7193
- this.next();
7194
- if (!this.match(11) && !this.match(21)) {
7195
- if (tokenIsIdentifier(this.state.type) || this.match(78)) {
7196
- const token = this.lookahead().type;
7197
- isGroupedType = token !== 17 && token !== 14;
7198
- } else {
7199
- isGroupedType = true;
7153
+ {
7154
+ const node = this.startNode();
7155
+ this.next();
7156
+ if (!this.match(11) && !this.match(21)) {
7157
+ if (tokenIsIdentifier(this.state.type) || this.match(78)) {
7158
+ const token = this.lookahead().type;
7159
+ isGroupedType = token !== 17 && token !== 14;
7160
+ } else {
7161
+ isGroupedType = true;
7162
+ }
7200
7163
  }
7201
- }
7202
- if (isGroupedType) {
7203
- this.state.noAnonFunctionType = false;
7204
- type = this.flowParseType();
7205
- this.state.noAnonFunctionType = oldNoAnonFunctionType;
7206
- if (this.state.noAnonFunctionType || !(this.match(12) || this.match(11) && this.lookahead().type === 19)) {
7207
- this.expect(11);
7208
- return type;
7164
+ if (isGroupedType) {
7165
+ this.state.noAnonFunctionType = false;
7166
+ type = this.flowParseType();
7167
+ this.state.noAnonFunctionType = oldNoAnonFunctionType;
7168
+ if (this.state.noAnonFunctionType || !(this.match(12) || this.match(11) && this.lookahead().type === 19)) {
7169
+ this.expect(11);
7170
+ return type;
7171
+ } else {
7172
+ this.eat(12);
7173
+ }
7174
+ }
7175
+ if (type) {
7176
+ tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]);
7209
7177
  } else {
7210
- this.eat(12);
7178
+ tmp = this.flowParseFunctionTypeParams();
7211
7179
  }
7180
+ node.params = tmp.params;
7181
+ node.rest = tmp.rest;
7182
+ node.this = tmp._this;
7183
+ this.expect(11);
7184
+ this.expect(19);
7185
+ node.returnType = this.flowParseType();
7186
+ node.typeParameters = null;
7187
+ return this.finishNode(node, "FunctionTypeAnnotation");
7212
7188
  }
7213
- if (type) {
7214
- tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]);
7215
- } else {
7216
- tmp = this.flowParseFunctionTypeParams();
7217
- }
7218
- node.params = tmp.params;
7219
- node.rest = tmp.rest;
7220
- node.this = tmp._this;
7221
- this.expect(11);
7222
- this.expect(19);
7223
- node.returnType = this.flowParseType();
7224
- node.typeParameters = null;
7225
- return this.finishNode(node, "FunctionTypeAnnotation");
7226
7189
  case 133:
7227
7190
  return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
7228
7191
  case 85:
@@ -7538,7 +7501,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
7538
7501
  const arrows = [];
7539
7502
  while (stack.length !== 0) {
7540
7503
  const node = stack.pop();
7541
- if (node.type === "ArrowFunctionExpression") {
7504
+ if (node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatement") {
7542
7505
  if (node.typeParameters || !node.returnType) {
7543
7506
  this.finishArrowValidation(node);
7544
7507
  } else {
@@ -7575,18 +7538,18 @@ var flow = superClass => class FlowParserMixin extends superClass {
7575
7538
  return result;
7576
7539
  }
7577
7540
  parseParenItem(node, startLoc) {
7578
- node = super.parseParenItem(node, startLoc);
7541
+ const newNode = super.parseParenItem(node, startLoc);
7579
7542
  if (this.eat(17)) {
7580
- node.optional = true;
7543
+ newNode.optional = true;
7581
7544
  this.resetEndLocation(node);
7582
7545
  }
7583
7546
  if (this.match(14)) {
7584
7547
  const typeCastNode = this.startNodeAt(startLoc);
7585
- typeCastNode.expression = node;
7548
+ typeCastNode.expression = newNode;
7586
7549
  typeCastNode.typeAnnotation = this.flowParseTypeAnnotation();
7587
7550
  return this.finishNode(typeCastNode, "TypeCastExpression");
7588
7551
  }
7589
- return node;
7552
+ return newNode;
7590
7553
  }
7591
7554
  assertModuleNodeAllowed(node) {
7592
7555
  if (node.type === "ImportDeclaration" && (node.importKind === "type" || node.importKind === "typeof") || node.type === "ExportNamedDeclaration" && node.exportKind === "type" || node.type === "ExportAllDeclaration" && node.exportKind === "type") {
@@ -8959,7 +8922,7 @@ var jsx = superClass => class JSXParserMixin extends superClass {
8959
8922
  } else {
8960
8923
  let count = 0;
8961
8924
  let semi = false;
8962
- while (count++ < 10 && this.state.pos < this.length && !(semi = this.codePointAtPos(this.state.pos) == 59)) {
8925
+ while (count++ < 10 && this.state.pos < this.length && !(semi = this.codePointAtPos(this.state.pos) === 59)) {
8963
8926
  ++this.state.pos;
8964
8927
  }
8965
8928
  if (semi) {
@@ -9121,7 +9084,7 @@ var jsx = superClass => class JSXParserMixin extends superClass {
9121
9084
  children.push(this.jsxParseElementAt(startLoc));
9122
9085
  break;
9123
9086
  case 141:
9124
- children.push(this.parseExprAtom());
9087
+ children.push(this.parseLiteral(this.state.value, "JSXText"));
9125
9088
  break;
9126
9089
  case 5:
9127
9090
  {
@@ -9178,9 +9141,7 @@ var jsx = superClass => class JSXParserMixin extends superClass {
9178
9141
  context[context.length - 1] = newContext;
9179
9142
  }
9180
9143
  parseExprAtom(refExpressionErrors) {
9181
- if (this.match(141)) {
9182
- return this.parseLiteral(this.state.value, "JSXText");
9183
- } else if (this.match(142)) {
9144
+ if (this.match(142)) {
9184
9145
  return this.jsxParseElement();
9185
9146
  } else if (this.match(47) && this.input.charCodeAt(this.state.pos) !== 33) {
9186
9147
  this.replaceToken(142);
@@ -9261,14 +9222,14 @@ class TypeScriptScopeHandler extends ScopeHandler {
9261
9222
  return new TypeScriptScope(flags);
9262
9223
  }
9263
9224
  enter(flags) {
9264
- if (flags == 256) {
9225
+ if (flags === 256) {
9265
9226
  this.importsStack.push(new Set());
9266
9227
  }
9267
9228
  super.enter(flags);
9268
9229
  }
9269
9230
  exit() {
9270
9231
  const flags = super.exit();
9271
- if (flags == 256) {
9232
+ if (flags === 256) {
9272
9233
  this.importsStack.pop();
9273
9234
  }
9274
9235
  return flags;
@@ -9577,14 +9538,15 @@ class LValParser extends NodeUtils {
9577
9538
  return this.finishNode(prop, "RestElement");
9578
9539
  }
9579
9540
  parseBindingProperty() {
9580
- const prop = this.startNode();
9581
9541
  const {
9582
9542
  type,
9583
9543
  startLoc
9584
9544
  } = this.state;
9585
9545
  if (type === 21) {
9586
- return this.parseBindingRestProperty(prop);
9587
- } else if (type === 138) {
9546
+ return this.parseBindingRestProperty(this.startNode());
9547
+ }
9548
+ const prop = this.startNode();
9549
+ if (type === 138) {
9588
9550
  this.expectPlugin("destructuringPrivate", startLoc);
9589
9551
  this.classScope.usePrivateName(this.state.value, startLoc);
9590
9552
  prop.key = this.parsePrivateName();
@@ -11434,13 +11396,14 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
11434
11396
  parseExport(node, decorators) {
11435
11397
  if (this.match(83)) {
11436
11398
  this.next();
11399
+ const nodeImportEquals = node;
11437
11400
  let maybeDefaultIdentifier = null;
11438
11401
  if (this.isContextual(130) && this.isPotentialImportPhase(false)) {
11439
- maybeDefaultIdentifier = this.parseMaybeImportPhase(node, false);
11402
+ maybeDefaultIdentifier = this.parseMaybeImportPhase(nodeImportEquals, false);
11440
11403
  } else {
11441
- node.importKind = "value";
11404
+ nodeImportEquals.importKind = "value";
11442
11405
  }
11443
- return this.tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier, true);
11406
+ return this.tsParseImportEqualsDeclaration(nodeImportEquals, maybeDefaultIdentifier, true);
11444
11407
  } else if (this.eat(29)) {
11445
11408
  const assign = node;
11446
11409
  assign.expression = super.parseExpression();
@@ -11612,9 +11575,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
11612
11575
  return result.node;
11613
11576
  }
11614
11577
  parseParenItem(node, startLoc) {
11615
- node = super.parseParenItem(node, startLoc);
11578
+ const newNode = super.parseParenItem(node, startLoc);
11616
11579
  if (this.eat(17)) {
11617
- node.optional = true;
11580
+ newNode.optional = true;
11618
11581
  this.resetEndLocation(node);
11619
11582
  }
11620
11583
  if (this.match(14)) {
@@ -11723,7 +11686,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
11723
11686
  }
11724
11687
  declareClassPrivateMethodInScope(node, kind) {
11725
11688
  if (node.type === "TSDeclareMethod") return;
11726
- if (node.type === "MethodDefinition" && !node.value.body) return;
11689
+ if (node.type === "MethodDefinition" && !hasOwnProperty.call(node.value, "body")) {
11690
+ return;
11691
+ }
11727
11692
  super.declareClassPrivateMethodInScope(node, kind);
11728
11693
  }
11729
11694
  parseClassSuper(node) {
@@ -11922,6 +11887,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
11922
11887
  TSTypeCastExpression: true,
11923
11888
  TSParameterProperty: "parameter",
11924
11889
  TSNonNullExpression: "expression",
11890
+ TSInstantiationExpression: "expression",
11925
11891
  TSAsExpression: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true],
11926
11892
  TSSatisfiesExpression: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true],
11927
11893
  TSTypeAssertion: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true]
@@ -12275,9 +12241,12 @@ var placeholders = superClass => class PlaceholdersParserMixin extends superClas
12275
12241
  }
12276
12242
  }
12277
12243
  finishPlaceholder(node, expectedNode) {
12278
- const isFinished = !!(node.expectedNode && node.type === "Placeholder");
12279
- node.expectedNode = expectedNode;
12280
- return isFinished ? node : this.finishNode(node, "Placeholder");
12244
+ let placeholder = node;
12245
+ if (!placeholder.expectedNode || !placeholder.type) {
12246
+ placeholder = this.finishNode(placeholder, "Placeholder");
12247
+ }
12248
+ placeholder.expectedNode = expectedNode;
12249
+ return placeholder;
12281
12250
  }
12282
12251
  getTokenFromCode(code) {
12283
12252
  if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
@@ -12337,8 +12306,9 @@ var placeholders = superClass => class PlaceholdersParserMixin extends superClas
12337
12306
  return this.finishNode(stmt, "LabeledStatement");
12338
12307
  }
12339
12308
  this.semicolon();
12340
- node.name = expr.name;
12341
- return this.finishPlaceholder(node, "Statement");
12309
+ const stmtPlaceholder = node;
12310
+ stmtPlaceholder.name = expr.name;
12311
+ return this.finishPlaceholder(stmtPlaceholder, "Statement");
12342
12312
  }
12343
12313
  parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse) {
12344
12314
  return this.parsePlaceholder("BlockStatement") || super.parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse);
@@ -12371,17 +12341,18 @@ var placeholders = superClass => class PlaceholdersParserMixin extends superClas
12371
12341
  parseExport(node, decorators) {
12372
12342
  const placeholder = this.parsePlaceholder("Identifier");
12373
12343
  if (!placeholder) return super.parseExport(node, decorators);
12344
+ const node2 = node;
12374
12345
  if (!this.isContextual(98) && !this.match(12)) {
12375
- node.specifiers = [];
12376
- node.source = null;
12377
- node.declaration = this.finishPlaceholder(placeholder, "Declaration");
12378
- return this.finishNode(node, "ExportNamedDeclaration");
12346
+ node2.specifiers = [];
12347
+ node2.source = null;
12348
+ node2.declaration = this.finishPlaceholder(placeholder, "Declaration");
12349
+ return this.finishNode(node2, "ExportNamedDeclaration");
12379
12350
  }
12380
12351
  this.expectPlugin("exportDefaultFrom");
12381
12352
  const specifier = this.startNode();
12382
12353
  specifier.exported = placeholder;
12383
- node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
12384
- return super.parseExport(node, decorators);
12354
+ node2.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
12355
+ return super.parseExport(node2, decorators);
12385
12356
  }
12386
12357
  isExportDefaultSpecifier() {
12387
12358
  if (this.match(65)) {
@@ -12498,7 +12469,6 @@ function getPluginOption(plugins, name, option) {
12498
12469
  }
12499
12470
  const PIPELINE_PROPOSALS = ["minimal", "fsharp", "hack", "smart"];
12500
12471
  const TOPIC_TOKENS = ["^^", "@@", "^", "%", "#"];
12501
- const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
12502
12472
  function validatePlugins(plugins) {
12503
12473
  if (hasPlugin(plugins, "decorators")) {
12504
12474
  if (hasPlugin(plugins, "decorators-legacy")) {
@@ -12525,9 +12495,10 @@ function validatePlugins(plugins) {
12525
12495
  const proposalList = PIPELINE_PROPOSALS.map(p => `"${p}"`).join(", ");
12526
12496
  throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${proposalList}.`);
12527
12497
  }
12528
- const tupleSyntaxIsHash = hasPlugin(plugins, ["recordAndTuple", {
12498
+ const recordAndTupleConfigItem = ["recordAndTuple", {
12529
12499
  syntaxType: "hash"
12530
- }]);
12500
+ }];
12501
+ const tupleSyntaxIsHash = hasPlugin(plugins, recordAndTupleConfigItem);
12531
12502
  if (proposal === "hack") {
12532
12503
  if (hasPlugin(plugins, "placeholders")) {
12533
12504
  throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");
@@ -12541,10 +12512,10 @@ function validatePlugins(plugins) {
12541
12512
  throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${tokenList}.`);
12542
12513
  }
12543
12514
  if (topicToken === "#" && tupleSyntaxIsHash) {
12544
- throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "hack", topicToken: "#" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.');
12515
+ throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(recordAndTupleConfigItem)}\`.`);
12545
12516
  }
12546
12517
  } else if (proposal === "smart" && tupleSyntaxIsHash) {
12547
- throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "smart" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.');
12518
+ throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "smart" }]\` and \`${JSON.stringify(recordAndTupleConfigItem)}\`.`);
12548
12519
  }
12549
12520
  }
12550
12521
  if (hasPlugin(plugins, "moduleAttributes")) {
@@ -12561,8 +12532,16 @@ function validatePlugins(plugins) {
12561
12532
  if (hasPlugin(plugins, "importAssertions") && hasPlugin(plugins, "importAttributes")) {
12562
12533
  throw new Error("Cannot combine importAssertions and importAttributes plugins.");
12563
12534
  }
12564
- if (hasPlugin(plugins, "recordAndTuple") && getPluginOption(plugins, "recordAndTuple", "syntaxType") != null && !RECORD_AND_TUPLE_SYNTAX_TYPES.includes(getPluginOption(plugins, "recordAndTuple", "syntaxType"))) {
12565
- throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: " + RECORD_AND_TUPLE_SYNTAX_TYPES.map(p => `'${p}'`).join(", "));
12535
+ if (hasPlugin(plugins, "recordAndTuple")) {
12536
+ const syntaxType = getPluginOption(plugins, "recordAndTuple", "syntaxType");
12537
+ if (syntaxType != null) {
12538
+ {
12539
+ const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
12540
+ if (!RECORD_AND_TUPLE_SYNTAX_TYPES.includes(syntaxType)) {
12541
+ throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: " + RECORD_AND_TUPLE_SYNTAX_TYPES.map(p => `'${p}'`).join(", "));
12542
+ }
12543
+ }
12544
+ }
12566
12545
  }
12567
12546
  if (hasPlugin(plugins, "asyncDoExpressions") && !hasPlugin(plugins, "doExpressions")) {
12568
12547
  const error = new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");
@@ -13681,14 +13660,16 @@ class ExpressionParser extends LValParser {
13681
13660
  }
13682
13661
  parseTemplate(isTagged) {
13683
13662
  const node = this.startNode();
13684
- node.expressions = [];
13685
13663
  let curElt = this.parseTemplateElement(isTagged);
13686
- node.quasis = [curElt];
13664
+ const quasis = [curElt];
13665
+ const substitutions = [];
13687
13666
  while (!curElt.tail) {
13688
- node.expressions.push(this.parseTemplateSubstitution());
13667
+ substitutions.push(this.parseTemplateSubstitution());
13689
13668
  this.readTemplateContinuation();
13690
- node.quasis.push(curElt = this.parseTemplateElement(isTagged));
13669
+ quasis.push(curElt = this.parseTemplateElement(isTagged));
13691
13670
  }
13671
+ node.expressions = substitutions;
13672
+ node.quasis = quasis;
13692
13673
  return this.finishNode(node, "TemplateLiteral");
13693
13674
  }
13694
13675
  parseTemplateSubstitution() {
@@ -13725,8 +13706,10 @@ class ExpressionParser extends LValParser {
13725
13706
  if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
13726
13707
  this.raise(Errors.InvalidRecordProperty, prop);
13727
13708
  }
13728
- if (prop.shorthand) {
13729
- this.addExtra(prop, "shorthand", true);
13709
+ {
13710
+ if (prop.shorthand) {
13711
+ this.addExtra(prop, "shorthand", true);
13712
+ }
13730
13713
  }
13731
13714
  node.properties.push(prop);
13732
13715
  }
@@ -13776,8 +13759,11 @@ class ExpressionParser extends LValParser {
13776
13759
  let isGenerator = this.eat(55);
13777
13760
  this.parsePropertyNamePrefixOperator(prop);
13778
13761
  const containsEsc = this.state.containsEsc;
13779
- const key = this.parsePropertyName(prop, refExpressionErrors);
13762
+ this.parsePropertyName(prop, refExpressionErrors);
13780
13763
  if (!isGenerator && !containsEsc && this.maybeAsyncOrAccessorProp(prop)) {
13764
+ const {
13765
+ key
13766
+ } = prop;
13781
13767
  const keyName = key.name;
13782
13768
  if (keyName === "async" && !this.hasPrecedingLineBreak()) {
13783
13769
  isAsync = true;
@@ -13912,7 +13898,6 @@ class ExpressionParser extends LValParser {
13912
13898
  prop.computed = false;
13913
13899
  }
13914
13900
  }
13915
- return prop.key;
13916
13901
  }
13917
13902
  initFunction(node, isAsync) {
13918
13903
  node.id = null;
@@ -15322,8 +15307,11 @@ class StatementParser extends ExpressionParser {
15322
15307
  isClassMethod() {
15323
15308
  return this.match(10);
15324
15309
  }
15310
+ nameIsConstructor(key) {
15311
+ return key.type === "Identifier" && key.name === "constructor" || key.type === "StringLiteral" && key.value === "constructor";
15312
+ }
15325
15313
  isNonstaticConstructor(method) {
15326
- return !method.computed && !method.static && (method.key.name === "constructor" || method.key.value === "constructor");
15314
+ return !method.computed && !method.static && this.nameIsConstructor(method.key);
15327
15315
  }
15328
15316
  parseClassBody(hadSuperClass, oldStrict) {
15329
15317
  this.classScope.enter();
@@ -15425,9 +15413,10 @@ class StatementParser extends ExpressionParser {
15425
15413
  this.pushClassMethod(classBody, publicMethod, true, false, false, false);
15426
15414
  return;
15427
15415
  }
15428
- const isContextual = tokenIsIdentifier(this.state.type) && !this.state.containsEsc;
15429
- const isPrivate = this.match(138);
15416
+ const isContextual = !this.state.containsEsc && tokenIsIdentifier(this.state.type);
15430
15417
  const key = this.parseClassElementName(member);
15418
+ const maybeContextualKw = isContextual ? key.name : null;
15419
+ const isPrivate = this.isPrivateName(key);
15431
15420
  const maybeQuestionTokenStartLoc = this.state.startLoc;
15432
15421
  this.parsePostMemberNameModifiers(publicMember);
15433
15422
  if (this.isClassMethod()) {
@@ -15456,7 +15445,7 @@ class StatementParser extends ExpressionParser {
15456
15445
  } else {
15457
15446
  this.pushClassProperty(classBody, publicProp);
15458
15447
  }
15459
- } else if (isContextual && key.name === "async" && !this.isLineTerminator()) {
15448
+ } else if (maybeContextualKw === "async" && !this.isLineTerminator()) {
15460
15449
  this.resetPreviousNodeTrailingComments(key);
15461
15450
  const isGenerator = this.eat(55);
15462
15451
  if (publicMember.optional) {
@@ -15474,9 +15463,9 @@ class StatementParser extends ExpressionParser {
15474
15463
  }
15475
15464
  this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
15476
15465
  }
15477
- } else if (isContextual && (key.name === "get" || key.name === "set") && !(this.match(55) && this.isLineTerminator())) {
15466
+ } else if ((maybeContextualKw === "get" || maybeContextualKw === "set") && !(this.match(55) && this.isLineTerminator())) {
15478
15467
  this.resetPreviousNodeTrailingComments(key);
15479
- method.kind = key.name;
15468
+ method.kind = maybeContextualKw;
15480
15469
  const isPrivate = this.match(138);
15481
15470
  this.parseClassElementName(publicMethod);
15482
15471
  if (isPrivate) {
@@ -15488,7 +15477,7 @@ class StatementParser extends ExpressionParser {
15488
15477
  this.pushClassMethod(classBody, publicMethod, false, false, false, false);
15489
15478
  }
15490
15479
  this.checkGetterSetterParams(publicMethod);
15491
- } else if (isContextual && key.name === "accessor" && !this.isLineTerminator()) {
15480
+ } else if (maybeContextualKw === "accessor" && !this.isLineTerminator()) {
15492
15481
  this.expectPlugin("decoratorAutoAccessors");
15493
15482
  this.resetPreviousNodeTrailingComments(key);
15494
15483
  const isPrivate = this.match(138);
@@ -15520,7 +15509,8 @@ class StatementParser extends ExpressionParser {
15520
15509
  member.key = key;
15521
15510
  return key;
15522
15511
  }
15523
- return this.parsePropertyName(member);
15512
+ this.parsePropertyName(member);
15513
+ return member.key;
15524
15514
  }
15525
15515
  parseClassStaticBlock(classBody, member) {
15526
15516
  var _member$decorators;
@@ -15539,7 +15529,7 @@ class StatementParser extends ExpressionParser {
15539
15529
  }
15540
15530
  }
15541
15531
  pushClassProperty(classBody, prop) {
15542
- if (!prop.computed && (prop.key.name === "constructor" || prop.key.value === "constructor")) {
15532
+ if (!prop.computed && this.nameIsConstructor(prop.key)) {
15543
15533
  this.raise(Errors.ConstructorClassField, prop.key);
15544
15534
  }
15545
15535
  classBody.body.push(this.parseClassProperty(prop));
@@ -15550,11 +15540,8 @@ class StatementParser extends ExpressionParser {
15550
15540
  this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.loc.start);
15551
15541
  }
15552
15542
  pushClassAccessorProperty(classBody, prop, isPrivate) {
15553
- if (!isPrivate && !prop.computed) {
15554
- const key = prop.key;
15555
- if (key.name === "constructor" || key.value === "constructor") {
15556
- this.raise(Errors.ConstructorClassField, key);
15557
- }
15543
+ if (!isPrivate && !prop.computed && this.nameIsConstructor(prop.key)) {
15544
+ this.raise(Errors.ConstructorClassField, prop.key);
15558
15545
  }
15559
15546
  const node = this.parseClassAccessorProperty(prop);
15560
15547
  classBody.body.push(node);
@@ -15690,7 +15677,8 @@ class StatementParser extends ExpressionParser {
15690
15677
  }
15691
15678
  maybeParseExportNamespaceSpecifier(node) {
15692
15679
  if (this.isContextual(93)) {
15693
- if (!node.specifiers) node.specifiers = [];
15680
+ var _ref, _ref$specifiers;
15681
+ (_ref$specifiers = (_ref = node).specifiers) != null ? _ref$specifiers : _ref.specifiers = [];
15694
15682
  const specifier = this.startNodeAt(this.state.lastTokStartLoc);
15695
15683
  this.next();
15696
15684
  specifier.exported = this.parseModuleExportName();
@@ -15701,13 +15689,14 @@ class StatementParser extends ExpressionParser {
15701
15689
  }
15702
15690
  maybeParseExportNamedSpecifiers(node) {
15703
15691
  if (this.match(5)) {
15704
- if (!node.specifiers) node.specifiers = [];
15705
- const isTypeExport = node.exportKind === "type";
15706
- node.specifiers.push(...this.parseExportSpecifiers(isTypeExport));
15707
- node.source = null;
15708
- node.declaration = null;
15692
+ const node2 = node;
15693
+ if (!node2.specifiers) node2.specifiers = [];
15694
+ const isTypeExport = node2.exportKind === "type";
15695
+ node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport));
15696
+ node2.source = null;
15697
+ node2.declaration = null;
15709
15698
  if (this.hasPlugin("importAssertions")) {
15710
- node.assertions = [];
15699
+ node2.assertions = [];
15711
15700
  }
15712
15701
  return true;
15713
15702
  }
@@ -15818,6 +15807,14 @@ class StatementParser extends ExpressionParser {
15818
15807
  return true;
15819
15808
  }
15820
15809
  }
15810
+ if (this.isContextual(107)) {
15811
+ this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
15812
+ return true;
15813
+ }
15814
+ if (this.isContextual(96) && this.startsAwaitUsing()) {
15815
+ this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
15816
+ return true;
15817
+ }
15821
15818
  return type === 74 || type === 75 || type === 68 || type === 80 || this.isLet() || this.isAsyncFunction();
15822
15819
  }
15823
15820
  checkExport(node, checkNames, isDefault, isFrom) {
@@ -15855,12 +15852,15 @@ class StatementParser extends ExpressionParser {
15855
15852
  }
15856
15853
  }
15857
15854
  } else if (node.declaration) {
15858
- if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") {
15859
- const id = node.declaration.id;
15855
+ const decl = node.declaration;
15856
+ if (decl.type === "FunctionDeclaration" || decl.type === "ClassDeclaration") {
15857
+ const {
15858
+ id
15859
+ } = decl;
15860
15860
  if (!id) throw new Error("Assertion failure");
15861
15861
  this.checkDuplicateExports(node, id.name);
15862
- } else if (node.declaration.type === "VariableDeclaration") {
15863
- for (const declaration of node.declaration.declarations) {
15862
+ } else if (decl.type === "VariableDeclaration") {
15863
+ for (const declaration of decl.declarations) {
15864
15864
  this.checkDeclaration(declaration.id);
15865
15865
  }
15866
15866
  }
@@ -16570,7 +16570,8 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
16570
16570
  if (includeAll || isRefed && !isLocal) {
16571
16571
  onIdentifier(node, parent, parentStack, isRefed, isLocal);
16572
16572
  }
16573
- } else if (node.type === "ObjectProperty" && (parent == null ? void 0 : parent.type) === "ObjectPattern") {
16573
+ } else if (node.type === "ObjectProperty" && // eslint-disable-next-line no-restricted-syntax
16574
+ (parent == null ? void 0 : parent.type) === "ObjectPattern") {
16574
16575
  node.inPattern = true;
16575
16576
  } else if (isFunctionType(node)) {
16576
16577
  if (node.scopeIds) {
@@ -16661,16 +16662,14 @@ function walkFunctionParams(node, onIdent) {
16661
16662
  function walkBlockDeclarations(block, onIdent) {
16662
16663
  for (const stmt of block.body) {
16663
16664
  if (stmt.type === "VariableDeclaration") {
16664
- if (stmt.declare)
16665
- continue;
16665
+ if (stmt.declare) continue;
16666
16666
  for (const decl of stmt.declarations) {
16667
16667
  for (const id of extractIdentifiers$1(decl.id)) {
16668
16668
  onIdent(id);
16669
16669
  }
16670
16670
  }
16671
16671
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
16672
- if (stmt.declare || !stmt.id)
16673
- continue;
16672
+ if (stmt.declare || !stmt.id) continue;
16674
16673
  onIdent(stmt.id);
16675
16674
  } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
16676
16675
  const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
@@ -16707,8 +16706,7 @@ function extractIdentifiers$1(param, nodes = []) {
16707
16706
  break;
16708
16707
  case "ArrayPattern":
16709
16708
  param.elements.forEach((element) => {
16710
- if (element)
16711
- extractIdentifiers$1(element, nodes);
16709
+ if (element) extractIdentifiers$1(element, nodes);
16712
16710
  });
16713
16711
  break;
16714
16712
  case "RestElement":
@@ -16861,7 +16859,7 @@ function isCoreComponent(tag) {
16861
16859
  return BASE_TRANSITION;
16862
16860
  }
16863
16861
  }
16864
- const nonIdentifierRE = /^\d|[^\$\w]/;
16862
+ const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
16865
16863
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
16866
16864
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
16867
16865
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
@@ -16982,8 +16980,7 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
16982
16980
  for (let i = 0; i < node.props.length; i++) {
16983
16981
  const p = node.props[i];
16984
16982
  if (p.type === 6) {
16985
- if (dynamicOnly)
16986
- continue;
16983
+ if (dynamicOnly) continue;
16987
16984
  if (p.name === name && (p.value || allowEmpty)) {
16988
16985
  return p;
16989
16986
  }
@@ -17147,7 +17144,7 @@ function getMemoedVNodeCall(node) {
17147
17144
  return node;
17148
17145
  }
17149
17146
  }
17150
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
17147
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
17151
17148
 
17152
17149
  const defaultParserOptions = {
17153
17150
  parseMode: "base",
@@ -17300,8 +17297,7 @@ const tokenizer$2 = new Tokenizer$1(stack, {
17300
17297
  }
17301
17298
  },
17302
17299
  ondirarg(start, end) {
17303
- if (start === end)
17304
- return;
17300
+ if (start === end) return;
17305
17301
  const arg = getSlice(start, end);
17306
17302
  if (inVPre) {
17307
17303
  currentProp.name += arg;
@@ -17333,14 +17329,12 @@ const tokenizer$2 = new Tokenizer$1(stack, {
17333
17329
  },
17334
17330
  onattribdata(start, end) {
17335
17331
  currentAttrValue += getSlice(start, end);
17336
- if (currentAttrStartIndex < 0)
17337
- currentAttrStartIndex = start;
17332
+ if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
17338
17333
  currentAttrEndIndex = end;
17339
17334
  },
17340
17335
  onattribentity(char, start, end) {
17341
17336
  currentAttrValue += char;
17342
- if (currentAttrStartIndex < 0)
17343
- currentAttrStartIndex = start;
17337
+ if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
17344
17338
  currentAttrEndIndex = end;
17345
17339
  },
17346
17340
  onattribnameend(end) {
@@ -17480,8 +17474,7 @@ function parseForExpression(input) {
17480
17474
  const loc = input.loc;
17481
17475
  const exp = input.content;
17482
17476
  const inMatch = exp.match(forAliasRE);
17483
- if (!inMatch)
17484
- return;
17477
+ if (!inMatch) return;
17485
17478
  const [, LHS, RHS] = inMatch;
17486
17479
  const createAliasExpression = (content, offset, asParam = false) => {
17487
17480
  const start = loc.start.offset + offset;
@@ -17610,14 +17603,12 @@ function onCloseTag(el, end, isImplied = false) {
17610
17603
  }
17611
17604
  function lookAhead(index, c) {
17612
17605
  let i = index;
17613
- while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
17614
- i++;
17606
+ while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
17615
17607
  return i;
17616
17608
  }
17617
17609
  function backTrack(index, c) {
17618
17610
  let i = index;
17619
- while (currentInput.charCodeAt(i) !== c && i >= 0)
17620
- i--;
17611
+ while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
17621
17612
  return i;
17622
17613
  }
17623
17614
  const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
@@ -17929,7 +17920,7 @@ function getConstantType(node, context) {
17929
17920
  if (codegenNode.type !== 13) {
17930
17921
  return 0;
17931
17922
  }
17932
- if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
17923
+ if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
17933
17924
  return 0;
17934
17925
  }
17935
17926
  const flag = getPatchFlag(codegenNode);
@@ -18227,8 +18218,7 @@ function createTransformContext(root, {
18227
18218
  }
18228
18219
  },
18229
18220
  hoist(exp) {
18230
- if (isString$2(exp))
18231
- exp = createSimpleExpression(exp);
18221
+ if (isString$2(exp)) exp = createSimpleExpression(exp);
18232
18222
  context.hoists.push(exp);
18233
18223
  const identifier = createSimpleExpression(
18234
18224
  `_hoisted_${context.hoists.length}`,
@@ -18315,8 +18305,7 @@ function traverseChildren(parent, context) {
18315
18305
  };
18316
18306
  for (; i < parent.children.length; i++) {
18317
18307
  const child = parent.children[i];
18318
- if (isString$2(child))
18319
- continue;
18308
+ if (isString$2(child)) continue;
18320
18309
  context.grandParent = context.parent;
18321
18310
  context.parent = parent;
18322
18311
  context.childIndex = i;
@@ -18387,8 +18376,7 @@ function createStructuralDirectiveTransform(name, fn) {
18387
18376
  props.splice(i, 1);
18388
18377
  i--;
18389
18378
  const onExit = fn(node, prop, context);
18390
- if (onExit)
18391
- exitFns.push(onExit);
18379
+ if (onExit) exitFns.push(onExit);
18392
18380
  }
18393
18381
  }
18394
18382
  return exitFns;
@@ -21827,8 +21815,7 @@ function createCodegenContext(ast, {
21827
21815
  }
21828
21816
  function addMapping(loc, name = null) {
21829
21817
  const { _names, _mappings } = context.map;
21830
- if (name !== null && !_names.has(name))
21831
- _names.add(name);
21818
+ if (name !== null && !_names.has(name)) _names.add(name);
21832
21819
  _mappings.add({
21833
21820
  originalLine: loc.line,
21834
21821
  originalColumn: loc.column - 1,
@@ -21848,8 +21835,7 @@ function createCodegenContext(ast, {
21848
21835
  }
21849
21836
  function generate(ast, options = {}) {
21850
21837
  const context = createCodegenContext(ast, options);
21851
- if (options.onContextCreated)
21852
- options.onContextCreated(context);
21838
+ if (options.onContextCreated) options.onContextCreated(context);
21853
21839
  const {
21854
21840
  mode,
21855
21841
  push,
@@ -22064,8 +22050,9 @@ function genHoists(hoists, context) {
22064
22050
  const genScopeId = scopeId != null && mode !== "function";
22065
22051
  newline();
22066
22052
  if (genScopeId) {
22053
+ const param = context.isTS ? "(n: any)" : "n";
22067
22054
  push(
22068
- `const _withScopeId = n => (${helper(
22055
+ `const _withScopeId = ${param} => (${helper(
22069
22056
  PUSH_SCOPE_ID
22070
22057
  )}("${scopeId}"),n=n(),${helper(POP_SCOPE_ID)}(),n)`
22071
22058
  );
@@ -22229,8 +22216,7 @@ function genExpression(node, context) {
22229
22216
  }
22230
22217
  function genInterpolation(node, context) {
22231
22218
  const { push, helper, pure } = context;
22232
- if (pure)
22233
- push(PURE_ANNOTATION);
22219
+ if (pure) push(PURE_ANNOTATION);
22234
22220
  push(`${helper(TO_DISPLAY_STRING)}(`);
22235
22221
  genNode(node.content, context);
22236
22222
  push(`)`);
@@ -22310,8 +22296,7 @@ function genVNodeCall(node, context) {
22310
22296
  function genNullableArgs(args) {
22311
22297
  let i = args.length;
22312
22298
  while (i--) {
22313
- if (args[i] != null)
22314
- break;
22299
+ if (args[i] != null) break;
22315
22300
  }
22316
22301
  return args.slice(0, i + 1).map((arg) => arg || `null`);
22317
22302
  }
@@ -22454,11 +22439,9 @@ function genTemplateLiteral(node, context) {
22454
22439
  push(e.replace(/(`|\$|\\)/g, "\\$1"), -3 /* Unknown */);
22455
22440
  } else {
22456
22441
  push("${");
22457
- if (multilines)
22458
- indent();
22442
+ if (multilines) indent();
22459
22443
  genNode(e, context);
22460
- if (multilines)
22461
- deindent();
22444
+ if (multilines) deindent();
22462
22445
  push("}");
22463
22446
  }
22464
22447
  }
@@ -22829,8 +22812,7 @@ function processIf(node, dir, context, processCodegen) {
22829
22812
  sibling.branches.push(branch);
22830
22813
  const onExit = processCodegen && processCodegen(sibling, branch, false);
22831
22814
  traverseNode(branch, context);
22832
- if (onExit)
22833
- onExit();
22815
+ if (onExit) onExit();
22834
22816
  context.currentNode = null;
22835
22817
  } else {
22836
22818
  context.onError(
@@ -22952,6 +22934,90 @@ function getParentCondition(node) {
22952
22934
  }
22953
22935
  }
22954
22936
 
22937
+ const transformBind = (dir, _node, context) => {
22938
+ const { modifiers, loc } = dir;
22939
+ const arg = dir.arg;
22940
+ let { exp } = dir;
22941
+ if (exp && exp.type === 4 && !exp.content.trim()) {
22942
+ {
22943
+ context.onError(
22944
+ createCompilerError(34, loc)
22945
+ );
22946
+ return {
22947
+ props: [
22948
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
22949
+ ]
22950
+ };
22951
+ }
22952
+ }
22953
+ if (!exp) {
22954
+ if (arg.type !== 4 || !arg.isStatic) {
22955
+ context.onError(
22956
+ createCompilerError(
22957
+ 52,
22958
+ arg.loc
22959
+ )
22960
+ );
22961
+ return {
22962
+ props: [
22963
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
22964
+ ]
22965
+ };
22966
+ }
22967
+ transformBindShorthand(dir, context);
22968
+ exp = dir.exp;
22969
+ }
22970
+ if (arg.type !== 4) {
22971
+ arg.children.unshift(`(`);
22972
+ arg.children.push(`) || ""`);
22973
+ } else if (!arg.isStatic) {
22974
+ arg.content = `${arg.content} || ""`;
22975
+ }
22976
+ if (modifiers.includes("camel")) {
22977
+ if (arg.type === 4) {
22978
+ if (arg.isStatic) {
22979
+ arg.content = camelize(arg.content);
22980
+ } else {
22981
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
22982
+ }
22983
+ } else {
22984
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
22985
+ arg.children.push(`)`);
22986
+ }
22987
+ }
22988
+ if (!context.inSSR) {
22989
+ if (modifiers.includes("prop")) {
22990
+ injectPrefix(arg, ".");
22991
+ }
22992
+ if (modifiers.includes("attr")) {
22993
+ injectPrefix(arg, "^");
22994
+ }
22995
+ }
22996
+ return {
22997
+ props: [createObjectProperty(arg, exp)]
22998
+ };
22999
+ };
23000
+ const transformBindShorthand = (dir, context) => {
23001
+ const arg = dir.arg;
23002
+ const propName = camelize(arg.content);
23003
+ dir.exp = createSimpleExpression(propName, false, arg.loc);
23004
+ {
23005
+ dir.exp = processExpression(dir.exp, context);
23006
+ }
23007
+ };
23008
+ const injectPrefix = (arg, prefix) => {
23009
+ if (arg.type === 4) {
23010
+ if (arg.isStatic) {
23011
+ arg.content = prefix + arg.content;
23012
+ } else {
23013
+ arg.content = `\`${prefix}\${${arg.content}}\``;
23014
+ }
23015
+ } else {
23016
+ arg.children.unshift(`'${prefix}' + (`);
23017
+ arg.children.push(`)`);
23018
+ }
23019
+ };
23020
+
22955
23021
  const transformFor = createStructuralDirectiveTransform(
22956
23022
  "for",
22957
23023
  (node, dir, context) => {
@@ -22962,9 +23028,12 @@ const transformFor = createStructuralDirectiveTransform(
22962
23028
  ]);
22963
23029
  const isTemplate = isTemplateNode(node);
22964
23030
  const memo = findDir(node, "memo");
22965
- const keyProp = findProp(node, `key`);
22966
- const keyExp = keyProp && (keyProp.type === 6 ? createSimpleExpression(keyProp.value.content, true) : keyProp.exp);
22967
- const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null;
23031
+ const keyProp = findProp(node, `key`, false, true);
23032
+ if (keyProp && keyProp.type === 7 && !keyProp.exp) {
23033
+ transformBindShorthand(keyProp, context);
23034
+ }
23035
+ const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
23036
+ const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
22968
23037
  if (isTemplate) {
22969
23038
  if (memo) {
22970
23039
  memo.exp = processExpression(
@@ -23137,13 +23206,11 @@ function processFor(node, dir, context, processCodegen) {
23137
23206
  key && removeIdentifiers(key);
23138
23207
  index && removeIdentifiers(index);
23139
23208
  }
23140
- if (onExit)
23141
- onExit();
23209
+ if (onExit) onExit();
23142
23210
  };
23143
23211
  }
23144
23212
  function finalizeForParseResult(result, context) {
23145
- if (result.finalized)
23146
- return;
23213
+ if (result.finalized) return;
23147
23214
  if (context.prefixIdentifiers) {
23148
23215
  result.source = processExpression(
23149
23216
  result.source,
@@ -23179,8 +23246,7 @@ function createForLoopParams({ value, key, index }, memoArgs = []) {
23179
23246
  function createParamsList(args) {
23180
23247
  let i = args.length;
23181
23248
  while (i--) {
23182
- if (args[i])
23183
- break;
23249
+ if (args[i]) break;
23184
23250
  }
23185
23251
  return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
23186
23252
  }
@@ -23448,13 +23514,11 @@ function hasForwardedSlots(children) {
23448
23514
  }
23449
23515
  break;
23450
23516
  case 9:
23451
- if (hasForwardedSlots(child.branches))
23452
- return true;
23517
+ if (hasForwardedSlots(child.branches)) return true;
23453
23518
  break;
23454
23519
  case 10:
23455
23520
  case 11:
23456
- if (hasForwardedSlots(child.children))
23457
- return true;
23521
+ if (hasForwardedSlots(child.children)) return true;
23458
23522
  break;
23459
23523
  }
23460
23524
  }
@@ -23490,7 +23554,7 @@ const transformElement = (node, context) => {
23490
23554
  // updates inside get proper isSVG flag at runtime. (#639, #643)
23491
23555
  // This is technically web-specific, but splitting the logic out of core
23492
23556
  // leads to too much unnecessary complexity.
23493
- (tag === "svg" || tag === "foreignObject")
23557
+ (tag === "svg" || tag === "foreignObject" || tag === "math")
23494
23558
  );
23495
23559
  if (props.length > 0) {
23496
23560
  const propsBuildResult = buildProps(
@@ -23613,8 +23677,7 @@ function resolveComponentType(node, context, ssr = false) {
23613
23677
  }
23614
23678
  const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
23615
23679
  if (builtIn) {
23616
- if (!ssr)
23617
- context.helper(builtIn);
23680
+ if (!ssr) context.helper(builtIn);
23618
23681
  return builtIn;
23619
23682
  }
23620
23683
  {
@@ -23698,8 +23761,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
23698
23761
  );
23699
23762
  properties = [];
23700
23763
  }
23701
- if (arg)
23702
- mergeArgs.push(arg);
23764
+ if (arg) mergeArgs.push(arg);
23703
23765
  };
23704
23766
  const pushRefVForMarker = () => {
23705
23767
  if (context.scopes.vFor > 0) {
@@ -24015,8 +24077,7 @@ function buildDirectiveArgs(dir, context) {
24015
24077
  }
24016
24078
  }
24017
24079
  const { loc } = dir;
24018
- if (dir.exp)
24019
- dirArgs.push(dir.exp);
24080
+ if (dir.exp) dirArgs.push(dir.exp);
24020
24081
  if (dir.arg) {
24021
24082
  if (!dir.exp) {
24022
24083
  dirArgs.push(`void 0`);
@@ -24046,8 +24107,7 @@ function stringifyDynamicPropNames(props) {
24046
24107
  let propsNamesString = `[`;
24047
24108
  for (let i = 0, l = props.length; i < l; i++) {
24048
24109
  propsNamesString += JSON.stringify(props[i]);
24049
- if (i < l - 1)
24050
- propsNamesString += ", ";
24110
+ if (i < l - 1) propsNamesString += ", ";
24051
24111
  }
24052
24112
  return propsNamesString + `]`;
24053
24113
  }
@@ -24247,85 +24307,6 @@ const transformOn$1 = (dir, node, context, augmentor) => {
24247
24307
  return ret;
24248
24308
  };
24249
24309
 
24250
- const transformBind = (dir, _node, context) => {
24251
- const { modifiers, loc } = dir;
24252
- const arg = dir.arg;
24253
- let { exp } = dir;
24254
- if (exp && exp.type === 4 && !exp.content.trim()) {
24255
- {
24256
- context.onError(
24257
- createCompilerError(34, loc)
24258
- );
24259
- return {
24260
- props: [
24261
- createObjectProperty(arg, createSimpleExpression("", true, loc))
24262
- ]
24263
- };
24264
- }
24265
- }
24266
- if (!exp) {
24267
- if (arg.type !== 4 || !arg.isStatic) {
24268
- context.onError(
24269
- createCompilerError(
24270
- 52,
24271
- arg.loc
24272
- )
24273
- );
24274
- return {
24275
- props: [
24276
- createObjectProperty(arg, createSimpleExpression("", true, loc))
24277
- ]
24278
- };
24279
- }
24280
- const propName = camelize(arg.content);
24281
- exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
24282
- {
24283
- exp = dir.exp = processExpression(exp, context);
24284
- }
24285
- }
24286
- if (arg.type !== 4) {
24287
- arg.children.unshift(`(`);
24288
- arg.children.push(`) || ""`);
24289
- } else if (!arg.isStatic) {
24290
- arg.content = `${arg.content} || ""`;
24291
- }
24292
- if (modifiers.includes("camel")) {
24293
- if (arg.type === 4) {
24294
- if (arg.isStatic) {
24295
- arg.content = camelize(arg.content);
24296
- } else {
24297
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
24298
- }
24299
- } else {
24300
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
24301
- arg.children.push(`)`);
24302
- }
24303
- }
24304
- if (!context.inSSR) {
24305
- if (modifiers.includes("prop")) {
24306
- injectPrefix(arg, ".");
24307
- }
24308
- if (modifiers.includes("attr")) {
24309
- injectPrefix(arg, "^");
24310
- }
24311
- }
24312
- return {
24313
- props: [createObjectProperty(arg, exp)]
24314
- };
24315
- };
24316
- const injectPrefix = (arg, prefix) => {
24317
- if (arg.type === 4) {
24318
- if (arg.isStatic) {
24319
- arg.content = prefix + arg.content;
24320
- } else {
24321
- arg.content = `\`${prefix}\${${arg.content}}\``;
24322
- }
24323
- } else {
24324
- arg.children.unshift(`'${prefix}' + (`);
24325
- arg.children.push(`)`);
24326
- }
24327
- };
24328
-
24329
24310
  const transformText = (node, context) => {
24330
24311
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
24331
24312
  return () => {
@@ -24944,8 +24925,7 @@ const transformClick = (key, event) => {
24944
24925
  const transformOn = (dir, node, context) => {
24945
24926
  return transformOn$1(dir, node, context, (baseResult) => {
24946
24927
  const { modifiers } = dir;
24947
- if (!modifiers.length)
24948
- return baseResult;
24928
+ if (!modifiers.length) return baseResult;
24949
24929
  let { key, value: handlerExp } = baseResult.props[0];
24950
24930
  const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
24951
24931
  if (nonKeyModifiers.includes("right")) {
@@ -25716,8 +25696,7 @@ function resolveObjectKey(node, computed) {
25716
25696
  case "NumericLiteral":
25717
25697
  return String(node.value);
25718
25698
  case "Identifier":
25719
- if (!computed)
25720
- return node.name;
25699
+ if (!computed) return node.name;
25721
25700
  }
25722
25701
  return void 0;
25723
25702
  }
@@ -25736,8 +25715,7 @@ function toRuntimeTypeString(types) {
25736
25715
  function getImportedName(specifier) {
25737
25716
  if (specifier.type === "ImportSpecifier")
25738
25717
  return specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
25739
- else if (specifier.type === "ImportNamespaceSpecifier")
25740
- return "*";
25718
+ else if (specifier.type === "ImportNamespaceSpecifier") return "*";
25741
25719
  return "default";
25742
25720
  }
25743
25721
  function getId(node) {
@@ -26104,8 +26082,8 @@ Item.prototype.run = function () {
26104
26082
  var title = 'browser';
26105
26083
  var platform = 'browser';
26106
26084
  var browser = true;
26107
- var env = {};
26108
- var argv = [];
26085
+ var env$1 = {};
26086
+ var argv$1 = [];
26109
26087
  var version$1 = ''; // empty string to avoid regexp issues
26110
26088
  var versions = {};
26111
26089
  var release = {};
@@ -26168,8 +26146,8 @@ var browser$1 = {
26168
26146
  nextTick: nextTick,
26169
26147
  title: title,
26170
26148
  browser: browser,
26171
- env: env,
26172
- argv: argv,
26149
+ env: env$1,
26150
+ argv: argv$1,
26173
26151
  version: version$1,
26174
26152
  versions: versions,
26175
26153
  on: on,
@@ -26213,8 +26191,7 @@ function resolveTemplateUsedIdentifiers(sfc) {
26213
26191
  switch (node.type) {
26214
26192
  case 1:
26215
26193
  let tag = node.tag;
26216
- if (tag.includes("."))
26217
- tag = tag.split(".")[0].trim();
26194
+ if (tag.includes(".")) tag = tag.split(".")[0].trim();
26218
26195
  if (!parserOptions.isNativeTag(tag) && !parserOptions.isBuiltInComponent(tag)) {
26219
26196
  ids.add(camelize(tag));
26220
26197
  ids.add(capitalize$1(camelize(tag)));
@@ -30631,11 +30608,9 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
30631
30608
  if (srcsetTags.includes(node.tag) && node.props.length) {
30632
30609
  node.props.forEach((attr, index) => {
30633
30610
  if (attr.name === "srcset" && attr.type === 6) {
30634
- if (!attr.value)
30635
- return;
30611
+ if (!attr.value) return;
30636
30612
  const value = attr.value.content;
30637
- if (!value)
30638
- return;
30613
+ if (!value) return;
30639
30614
  const imageCandidates = value.split(",").map((s) => {
30640
30615
  const [url, descriptor] = s.replace(escapedSpaceCharacters, " ").trim().split(" ", 2);
30641
30616
  return { url, descriptor };
@@ -31989,8 +31964,7 @@ const ssrInjectFallthroughAttrs = (node, context) => {
31989
31964
  let hasEncounteredIf = false;
31990
31965
  for (const c of filterChild(parent)) {
31991
31966
  if (c.type === 9 || c.type === 1 && findDir(c, "if")) {
31992
- if (hasEncounteredIf)
31993
- return;
31967
+ if (hasEncounteredIf) return;
31994
31968
  hasEncounteredIf = true;
31995
31969
  } else if (
31996
31970
  // node before v-if
@@ -32132,6 +32106,10 @@ var CompilerSSR = /*#__PURE__*/Object.freeze({
32132
32106
  compile: compile
32133
32107
  });
32134
32108
 
32109
+ function commonjsRequire(path) {
32110
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
32111
+ }
32112
+
32135
32113
  var _polyfillNode_fs = {};
32136
32114
 
32137
32115
  var _polyfillNode_fs$1 = /*#__PURE__*/Object.freeze({
@@ -32186,13 +32164,11 @@ function preprocess$1({ source, filename, preprocessOptions }, preprocessor) {
32186
32164
  source,
32187
32165
  __spreadValues$6({ filename }, preprocessOptions),
32188
32166
  (_err, _res) => {
32189
- if (_err)
32190
- err = _err;
32167
+ if (_err) err = _err;
32191
32168
  res = _res;
32192
32169
  }
32193
32170
  );
32194
- if (err)
32195
- throw err;
32171
+ if (err) throw err;
32196
32172
  return res;
32197
32173
  }
32198
32174
  function compileTemplate(options) {
@@ -32262,11 +32238,11 @@ function doCompileTemplate({
32262
32238
  }
32263
32239
  if (ssr && !ssrCssVars) {
32264
32240
  warnOnce$3(
32265
- `compileTemplate is called with \`ssr: true\` but no corresponding \`cssVars\` option.\`.`
32241
+ `compileTemplate is called with \`ssr: true\` but no corresponding \`cssVars\` option.`
32266
32242
  );
32267
32243
  }
32268
32244
  if (!id) {
32269
- warnOnce$3(`compileTemplate now requires the \`id\` option.\`.`);
32245
+ warnOnce$3(`compileTemplate now requires the \`id\` option.`);
32270
32246
  id = "";
32271
32247
  }
32272
32248
  const shortId = id.replace(/^data-v-/, "");
@@ -32327,10 +32303,8 @@ ${generateCodeFrame(
32327
32303
  return { code, ast, preamble, source, errors, tips, map };
32328
32304
  }
32329
32305
  function mapLines(oldMap, newMap) {
32330
- if (!oldMap)
32331
- return newMap;
32332
- if (!newMap)
32333
- return oldMap;
32306
+ if (!oldMap) return newMap;
32307
+ if (!newMap) return oldMap;
32334
32308
  const oldMapConsumer = new SourceMapConsumer$5(oldMap);
32335
32309
  const newMapConsumer = new SourceMapConsumer$5(newMap);
32336
32310
  const mergedMapGenerator = new SourceMapGenerator$6();
@@ -32422,15 +32396,15 @@ var _polyfillNode_tty$1 = /*#__PURE__*/Object.freeze({
32422
32396
 
32423
32397
  var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_tty$1);
32424
32398
 
32425
- let tty = require$$0;
32426
-
32399
+ let argv = browser$1.argv || [],
32400
+ env = ({});
32427
32401
  let isColorSupported =
32428
- !("NO_COLOR" in ({}) || browser$1.argv.includes("--no-color")) &&
32429
- ("FORCE_COLOR" in ({}) ||
32430
- browser$1.argv.includes("--color") ||
32402
+ !("NO_COLOR" in env || argv.includes("--no-color")) &&
32403
+ ("FORCE_COLOR" in env ||
32404
+ argv.includes("--color") ||
32431
32405
  "" === "win32" ||
32432
- (tty.isatty(1) && browser$1.env.TERM !== "dumb") ||
32433
- "CI" in ({}));
32406
+ (commonjsRequire != null && require$$0.isatty(1) && env.TERM !== "dumb") ||
32407
+ "CI" in env);
32434
32408
 
32435
32409
  let formatter =
32436
32410
  (open, close, replace = open) =>
@@ -32443,40 +32417,47 @@ let formatter =
32443
32417
  };
32444
32418
 
32445
32419
  let replaceClose = (string, close, replace, index) => {
32446
- let start = string.substring(0, index) + replace;
32447
- let end = string.substring(index + close.length);
32448
- let nextIndex = end.indexOf(close);
32449
- return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
32450
- };
32451
-
32452
- let createColors = (enabled = isColorSupported) => ({
32453
- isColorSupported: enabled,
32454
- reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
32455
- bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
32456
- dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
32457
- italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
32458
- underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
32459
- inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
32460
- hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
32461
- strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
32462
- black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
32463
- red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
32464
- green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
32465
- yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
32466
- blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
32467
- magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
32468
- cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
32469
- white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
32470
- gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
32471
- bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
32472
- bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
32473
- bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
32474
- bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
32475
- bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
32476
- bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
32477
- bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
32478
- bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
32479
- });
32420
+ let result = "";
32421
+ let cursor = 0;
32422
+ do {
32423
+ result += string.substring(cursor, index) + replace;
32424
+ cursor = index + close.length;
32425
+ index = string.indexOf(close, cursor);
32426
+ } while (~index)
32427
+ return result + string.substring(cursor)
32428
+ };
32429
+
32430
+ let createColors = (enabled = isColorSupported) => {
32431
+ let init = enabled ? formatter : () => String;
32432
+ return {
32433
+ isColorSupported: enabled,
32434
+ reset: init("\x1b[0m", "\x1b[0m"),
32435
+ bold: init("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
32436
+ dim: init("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
32437
+ italic: init("\x1b[3m", "\x1b[23m"),
32438
+ underline: init("\x1b[4m", "\x1b[24m"),
32439
+ inverse: init("\x1b[7m", "\x1b[27m"),
32440
+ hidden: init("\x1b[8m", "\x1b[28m"),
32441
+ strikethrough: init("\x1b[9m", "\x1b[29m"),
32442
+ black: init("\x1b[30m", "\x1b[39m"),
32443
+ red: init("\x1b[31m", "\x1b[39m"),
32444
+ green: init("\x1b[32m", "\x1b[39m"),
32445
+ yellow: init("\x1b[33m", "\x1b[39m"),
32446
+ blue: init("\x1b[34m", "\x1b[39m"),
32447
+ magenta: init("\x1b[35m", "\x1b[39m"),
32448
+ cyan: init("\x1b[36m", "\x1b[39m"),
32449
+ white: init("\x1b[37m", "\x1b[39m"),
32450
+ gray: init("\x1b[90m", "\x1b[39m"),
32451
+ bgBlack: init("\x1b[40m", "\x1b[49m"),
32452
+ bgRed: init("\x1b[41m", "\x1b[49m"),
32453
+ bgGreen: init("\x1b[42m", "\x1b[49m"),
32454
+ bgYellow: init("\x1b[43m", "\x1b[49m"),
32455
+ bgBlue: init("\x1b[44m", "\x1b[49m"),
32456
+ bgMagenta: init("\x1b[45m", "\x1b[49m"),
32457
+ bgCyan: init("\x1b[46m", "\x1b[49m"),
32458
+ bgWhite: init("\x1b[47m", "\x1b[49m"),
32459
+ }
32460
+ };
32480
32461
 
32481
32462
  picocolors.exports = createColors();
32482
32463
  picocolors.exports.createColors = createColors;
@@ -36795,10 +36776,8 @@ const trimPlugin = () => {
36795
36776
  Once(root) {
36796
36777
  root.walk(({ type, raws }) => {
36797
36778
  if (type === "rule" || type === "atrule") {
36798
- if (raws.before)
36799
- raws.before = "\n";
36800
- if ("after" in raws && raws.after)
36801
- raws.after = "\n";
36779
+ if (raws.before) raws.before = "\n";
36780
+ if ("after" in raws && raws.after) raws.after = "\n";
36802
36781
  }
36803
36782
  });
36804
36783
  }
@@ -38981,7 +38960,8 @@ tokenTypes.combinator = combinator$1;
38981
38960
  line: 1,
38982
38961
  column: 1
38983
38962
  }
38984
- }
38963
+ },
38964
+ sourceIndex: 0
38985
38965
  });
38986
38966
  this.root.append(selector);
38987
38967
  this.current = selector;
@@ -39440,7 +39420,8 @@ tokenTypes.combinator = combinator$1;
39440
39420
  var selector = new _selector["default"]({
39441
39421
  source: {
39442
39422
  start: tokenStart(this.tokens[this.position + 1])
39443
- }
39423
+ },
39424
+ sourceIndex: this.tokens[this.position + 1][_tokenize.FIELDS.START_POS]
39444
39425
  });
39445
39426
  this.current.parent.append(selector);
39446
39427
  this.current = selector;
@@ -39509,8 +39490,9 @@ tokenTypes.combinator = combinator$1;
39509
39490
  if (last && last.type === types$1.PSEUDO) {
39510
39491
  var selector = new _selector["default"]({
39511
39492
  source: {
39512
- start: tokenStart(this.tokens[this.position - 1])
39513
- }
39493
+ start: tokenStart(this.tokens[this.position])
39494
+ },
39495
+ sourceIndex: this.tokens[this.position][_tokenize.FIELDS.START_POS]
39514
39496
  });
39515
39497
  var cache = this.current;
39516
39498
  last.append(selector);
@@ -40358,8 +40340,7 @@ function rewriteSelector(id, selector, selectorRoot, slotted = false) {
40358
40340
  return false;
40359
40341
  }
40360
40342
  }
40361
- if (node)
40362
- return;
40343
+ if (node) return;
40363
40344
  }
40364
40345
  if (n.type !== "pseudo" && n.type !== "combinator" || n.type === "pseudo" && (n.value === ":is" || n.value === ":where") && !node) {
40365
40346
  node = n;
@@ -43689,8 +43670,7 @@ const less = (source, map, options, load = require) => {
43689
43670
  result = output;
43690
43671
  }
43691
43672
  );
43692
- if (error)
43693
- return { code: "", errors: [error], dependencies: [] };
43673
+ if (error) return { code: "", errors: [error], dependencies: [] };
43694
43674
  const dependencies = result.imports;
43695
43675
  if (map) {
43696
43676
  return {
@@ -43710,8 +43690,7 @@ const styl = (source, map, options, load = require) => {
43710
43690
  const nodeStylus = load("stylus");
43711
43691
  try {
43712
43692
  const ref = nodeStylus(source, options);
43713
- if (map)
43714
- ref.set("sourcemap", { inline: false, comment: false });
43693
+ if (map) ref.set("sourcemap", { inline: false, comment: false });
43715
43694
  const result = ref.render();
43716
43695
  const dependencies = ref.deps();
43717
43696
  if (map) {
@@ -43728,8 +43707,7 @@ const styl = (source, map, options, load = require) => {
43728
43707
  }
43729
43708
  };
43730
43709
  function getSource(source, filename, additionalData) {
43731
- if (!additionalData)
43732
- return source;
43710
+ if (!additionalData) return source;
43733
43711
  if (isFunction$1(additionalData)) {
43734
43712
  return additionalData(source, filename);
43735
43713
  }
@@ -43929,11 +43907,9 @@ function analyzeBindingsFromOptions(node) {
43929
43907
  function getObjectExpressionKeys(node) {
43930
43908
  const keys = [];
43931
43909
  for (const prop of node.properties) {
43932
- if (prop.type === "SpreadElement")
43933
- continue;
43910
+ if (prop.type === "SpreadElement") continue;
43934
43911
  const key = resolveObjectKey(prop.key, prop.computed);
43935
- if (key)
43936
- keys.push(String(key));
43912
+ if (key) keys.push(String(key));
43937
43913
  }
43938
43914
  return keys;
43939
43915
  }
@@ -45381,12 +45357,12 @@ function resolveParserPlugins(lang, userPlugins, dts = false) {
45381
45357
  )) {
45382
45358
  plugins.push("importAttributes");
45383
45359
  }
45384
- if (lang === "jsx" || lang === "tsx") {
45360
+ if (lang === "jsx" || lang === "tsx" || lang === "mtsx") {
45385
45361
  plugins.push("jsx");
45386
45362
  } else if (userPlugins) {
45387
45363
  userPlugins = userPlugins.filter((p) => p !== "jsx");
45388
45364
  }
45389
- if (lang === "ts" || lang === "tsx") {
45365
+ if (lang === "ts" || lang === "mts" || lang === "tsx" || lang === "mtsx") {
45390
45366
  plugins.push(["typescript", { dts }], "explicitResourceManagement");
45391
45367
  if (!userPlugins || !userPlugins.includes("decorators")) {
45392
45368
  plugins.push("decorators-legacy");
@@ -45601,6 +45577,9 @@ function resolveTypeElements(ctx, node, scope, typeParameters) {
45601
45577
  }
45602
45578
  function innerResolveTypeElements(ctx, node, scope, typeParameters) {
45603
45579
  var _a, _b;
45580
+ if (node.leadingComments && node.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
45581
+ return { props: {} };
45582
+ }
45604
45583
  switch (node.type) {
45605
45584
  case "TSTypeLiteral":
45606
45585
  return typeElementsToMap(ctx, node.members, scope, typeParameters);
@@ -45624,7 +45603,7 @@ function innerResolveTypeElements(ctx, node, scope, typeParameters) {
45624
45603
  node.type
45625
45604
  );
45626
45605
  case "TSMappedType":
45627
- return resolveMappedType(ctx, node, scope);
45606
+ return resolveMappedType(ctx, node, scope, typeParameters);
45628
45607
  case "TSIndexedAccessType": {
45629
45608
  const types = resolveIndexType(ctx, node, scope);
45630
45609
  return mergeElements(
@@ -45653,8 +45632,7 @@ function innerResolveTypeElements(ctx, node, scope, typeParameters) {
45653
45632
  typeParams = /* @__PURE__ */ Object.create(null);
45654
45633
  resolved.typeParameters.params.forEach((p, i) => {
45655
45634
  let param = typeParameters && typeParameters[p.name];
45656
- if (!param)
45657
- param = node.typeParameters.params[i];
45635
+ if (!param) param = node.typeParameters.params[i];
45658
45636
  typeParams[p.name] = param;
45659
45637
  });
45660
45638
  }
@@ -45764,8 +45742,7 @@ function typeElementsToMap(ctx, elements, scope = ctxToScope(ctx), typeParameter
45764
45742
  return res;
45765
45743
  }
45766
45744
  function mergeElements(maps, type) {
45767
- if (maps.length === 1)
45768
- return maps[0];
45745
+ if (maps.length === 1) return maps[0];
45769
45746
  const res = { props: {} };
45770
45747
  const { props: baseProps } = res;
45771
45748
  for (const { props, calls } of maps) {
@@ -45813,9 +45790,6 @@ function resolveInterfaceMembers(ctx, node, scope, typeParameters) {
45813
45790
  );
45814
45791
  if (node.extends) {
45815
45792
  for (const ext of node.extends) {
45816
- if (ext.leadingComments && ext.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
45817
- continue;
45818
- }
45819
45793
  try {
45820
45794
  const { props, calls } = resolveTypeElements(ctx, ext, scope);
45821
45795
  for (const key in props) {
@@ -45835,16 +45809,25 @@ If this previously worked in 3.2, you can instruct the compiler to ignore this e
45835
45809
  interface Props extends /* @vue-ignore */ Base {}
45836
45810
 
45837
45811
  Note: both in 3.2 or with the ignore, the properties in the base type are treated as fallthrough attrs at runtime.`,
45838
- ext
45812
+ ext,
45813
+ scope
45839
45814
  );
45840
45815
  }
45841
45816
  }
45842
45817
  }
45843
45818
  return base;
45844
45819
  }
45845
- function resolveMappedType(ctx, node, scope) {
45820
+ function resolveMappedType(ctx, node, scope, typeParameters) {
45846
45821
  const res = { props: {} };
45847
- const keys = resolveStringType(ctx, node.typeParameter.constraint, scope);
45822
+ let keys;
45823
+ if (node.nameType) {
45824
+ const { name, constraint } = node.typeParameter;
45825
+ scope = createChildScope(scope);
45826
+ Object.assign(scope.types, __spreadProps$1(__spreadValues$2({}, typeParameters), { [name]: constraint }));
45827
+ keys = resolveStringType(ctx, node.nameType, scope);
45828
+ } else {
45829
+ keys = resolveStringType(ctx, node.typeParameter.constraint, scope);
45830
+ }
45848
45831
  for (const key of keys) {
45849
45832
  res.props[key] = createProperty(
45850
45833
  {
@@ -46188,7 +46171,7 @@ function importSourceToScope(ctx, node, scope, source) {
46188
46171
  const osSpecificJoinFn = joinPaths;
46189
46172
  const filename = osSpecificJoinFn(dirname$2(scope.filename), source);
46190
46173
  resolved = resolveExt(filename, fs);
46191
- } else if (source.startsWith(".")) {
46174
+ } else if (source[0] === ".") {
46192
46175
  const filename = joinPaths(dirname$2(scope.filename), source);
46193
46176
  resolved = resolveExt(filename, fs);
46194
46177
  } else {
@@ -46218,8 +46201,7 @@ function importSourceToScope(ctx, node, scope, source) {
46218
46201
  function resolveExt(filename, fs) {
46219
46202
  filename = filename.replace(/\.js$/, "");
46220
46203
  const tryResolve = (filename2) => {
46221
- if (fs.fileExists(filename2))
46222
- return filename2;
46204
+ if (fs.fileExists(filename2)) return filename2;
46223
46205
  };
46224
46206
  return tryResolve(filename) || tryResolve(filename + `.ts`) || tryResolve(filename + `.tsx`) || tryResolve(filename + `.d.ts`) || tryResolve(joinPaths(filename, `index.ts`)) || tryResolve(joinPaths(filename, `index.tsx`)) || tryResolve(joinPaths(filename, `index.d.ts`));
46225
46207
  }
@@ -46231,8 +46213,7 @@ function invalidateTypeCache(filename) {
46231
46213
  fileToScopeCache.delete(filename);
46232
46214
  tsConfigCache.delete(filename);
46233
46215
  const affectedConfig = tsConfigRefMap.get(filename);
46234
- if (affectedConfig)
46235
- tsConfigCache.delete(affectedConfig);
46216
+ if (affectedConfig) tsConfigCache.delete(affectedConfig);
46236
46217
  }
46237
46218
  function fileToScope(ctx, filename, asGlobal = false) {
46238
46219
  const cached = fileToScopeCache.get(filename);
@@ -46249,12 +46230,12 @@ function fileToScope(ctx, filename, asGlobal = false) {
46249
46230
  }
46250
46231
  function parseFile(filename, content, parserPlugins) {
46251
46232
  const ext = extname(filename);
46252
- if (ext === ".ts" || ext === ".tsx") {
46233
+ if (ext === ".ts" || ext === ".mts" || ext === ".tsx" || ext === ".mtsx") {
46253
46234
  return parse_1$1(content, {
46254
46235
  plugins: resolveParserPlugins(
46255
46236
  ext.slice(1),
46256
46237
  parserPlugins,
46257
- filename.endsWith(".d.ts")
46238
+ /\.d\.m?ts$/.test(filename)
46258
46239
  ),
46259
46240
  sourceType: "module"
46260
46241
  }).program.body;
@@ -46395,8 +46376,7 @@ function recordTypes(ctx, body, scope, asGlobal = false) {
46395
46376
  for (const key of Object.keys(types)) {
46396
46377
  const node = types[key];
46397
46378
  node._ownerScope = scope;
46398
- if (node._ns)
46399
- node._ns._ownerScope = scope;
46379
+ if (node._ns) node._ns._ownerScope = scope;
46400
46380
  }
46401
46381
  for (const key of Object.keys(declares)) {
46402
46382
  declares[key]._ownerScope = scope;
@@ -46437,15 +46417,13 @@ function recordType(node, types, declares, overwriteId) {
46437
46417
  break;
46438
46418
  }
46439
46419
  case "ClassDeclaration":
46440
- if (overwriteId || node.id)
46441
- types[overwriteId || getId(node.id)] = node;
46420
+ if (overwriteId || node.id) types[overwriteId || getId(node.id)] = node;
46442
46421
  break;
46443
46422
  case "TSTypeAliasDeclaration":
46444
46423
  types[node.id.name] = node.typeParameters ? node : node.typeAnnotation;
46445
46424
  break;
46446
46425
  case "TSDeclareFunction":
46447
- if (node.id)
46448
- declares[node.id.name] = node;
46426
+ if (node.id) declares[node.id.name] = node;
46449
46427
  break;
46450
46428
  case "VariableDeclaration": {
46451
46429
  if (node.declare) {
@@ -46530,6 +46508,17 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
46530
46508
  if (isKeyOf) {
46531
46509
  if (m.type === "TSPropertySignature" && m.key.type === "NumericLiteral") {
46532
46510
  types.add("Number");
46511
+ } else if (m.type === "TSIndexSignature") {
46512
+ const annotation = m.parameters[0].typeAnnotation;
46513
+ if (annotation && annotation.type !== "Noop") {
46514
+ const type = inferRuntimeType(
46515
+ ctx,
46516
+ annotation.typeAnnotation,
46517
+ scope
46518
+ )[0];
46519
+ if (type === UNKNOWN_TYPE) return [UNKNOWN_TYPE];
46520
+ types.add(type);
46521
+ }
46533
46522
  } else {
46534
46523
  types.add("String");
46535
46524
  }
@@ -46539,7 +46528,7 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
46539
46528
  types.add("Object");
46540
46529
  }
46541
46530
  }
46542
- return types.size ? Array.from(types) : ["Object"];
46531
+ return types.size ? Array.from(types) : [isKeyOf ? UNKNOWN_TYPE : "Object"];
46543
46532
  }
46544
46533
  case "TSPropertySignature":
46545
46534
  if (node.typeAnnotation) {
@@ -46579,73 +46568,113 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
46579
46568
  case "String":
46580
46569
  case "Array":
46581
46570
  case "ArrayLike":
46571
+ case "Parameters":
46572
+ case "ConstructorParameters":
46582
46573
  case "ReadonlyArray":
46583
46574
  return ["String", "Number"];
46584
- default:
46575
+ case "Record":
46576
+ case "Partial":
46577
+ case "Required":
46578
+ case "Readonly":
46579
+ if (node.typeParameters && node.typeParameters.params[0]) {
46580
+ return inferRuntimeType(
46581
+ ctx,
46582
+ node.typeParameters.params[0],
46583
+ scope,
46584
+ true
46585
+ );
46586
+ }
46587
+ break;
46588
+ case "Pick":
46589
+ case "Extract":
46590
+ if (node.typeParameters && node.typeParameters.params[1]) {
46591
+ return inferRuntimeType(
46592
+ ctx,
46593
+ node.typeParameters.params[1],
46594
+ scope
46595
+ );
46596
+ }
46597
+ break;
46598
+ case "Function":
46599
+ case "Object":
46600
+ case "Set":
46601
+ case "Map":
46602
+ case "WeakSet":
46603
+ case "WeakMap":
46604
+ case "Date":
46605
+ case "Promise":
46606
+ case "Error":
46607
+ case "Uppercase":
46608
+ case "Lowercase":
46609
+ case "Capitalize":
46610
+ case "Uncapitalize":
46611
+ case "ReadonlyMap":
46612
+ case "ReadonlySet":
46585
46613
  return ["String"];
46586
46614
  }
46587
- }
46588
- switch (node.typeName.name) {
46589
- case "Array":
46590
- case "Function":
46591
- case "Object":
46592
- case "Set":
46593
- case "Map":
46594
- case "WeakSet":
46595
- case "WeakMap":
46596
- case "Date":
46597
- case "Promise":
46598
- case "Error":
46599
- return [node.typeName.name];
46600
- case "Partial":
46601
- case "Required":
46602
- case "Readonly":
46603
- case "Record":
46604
- case "Pick":
46605
- case "Omit":
46606
- case "InstanceType":
46607
- return ["Object"];
46608
- case "Uppercase":
46609
- case "Lowercase":
46610
- case "Capitalize":
46611
- case "Uncapitalize":
46612
- return ["String"];
46613
- case "Parameters":
46614
- case "ConstructorParameters":
46615
- case "ReadonlyArray":
46616
- return ["Array"];
46617
- case "ReadonlyMap":
46618
- return ["Map"];
46619
- case "ReadonlySet":
46620
- return ["Set"];
46621
- case "NonNullable":
46622
- if (node.typeParameters && node.typeParameters.params[0]) {
46623
- return inferRuntimeType(
46624
- ctx,
46625
- node.typeParameters.params[0],
46626
- scope
46627
- ).filter((t) => t !== "null");
46628
- }
46629
- break;
46630
- case "Extract":
46631
- if (node.typeParameters && node.typeParameters.params[1]) {
46632
- return inferRuntimeType(
46633
- ctx,
46634
- node.typeParameters.params[1],
46635
- scope
46636
- );
46637
- }
46638
- break;
46639
- case "Exclude":
46640
- case "OmitThisParameter":
46641
- if (node.typeParameters && node.typeParameters.params[0]) {
46642
- return inferRuntimeType(
46643
- ctx,
46644
- node.typeParameters.params[0],
46645
- scope
46646
- );
46647
- }
46648
- break;
46615
+ } else {
46616
+ switch (node.typeName.name) {
46617
+ case "Array":
46618
+ case "Function":
46619
+ case "Object":
46620
+ case "Set":
46621
+ case "Map":
46622
+ case "WeakSet":
46623
+ case "WeakMap":
46624
+ case "Date":
46625
+ case "Promise":
46626
+ case "Error":
46627
+ return [node.typeName.name];
46628
+ case "Partial":
46629
+ case "Required":
46630
+ case "Readonly":
46631
+ case "Record":
46632
+ case "Pick":
46633
+ case "Omit":
46634
+ case "InstanceType":
46635
+ return ["Object"];
46636
+ case "Uppercase":
46637
+ case "Lowercase":
46638
+ case "Capitalize":
46639
+ case "Uncapitalize":
46640
+ return ["String"];
46641
+ case "Parameters":
46642
+ case "ConstructorParameters":
46643
+ case "ReadonlyArray":
46644
+ return ["Array"];
46645
+ case "ReadonlyMap":
46646
+ return ["Map"];
46647
+ case "ReadonlySet":
46648
+ return ["Set"];
46649
+ case "NonNullable":
46650
+ if (node.typeParameters && node.typeParameters.params[0]) {
46651
+ return inferRuntimeType(
46652
+ ctx,
46653
+ node.typeParameters.params[0],
46654
+ scope
46655
+ ).filter((t) => t !== "null");
46656
+ }
46657
+ break;
46658
+ case "Extract":
46659
+ if (node.typeParameters && node.typeParameters.params[1]) {
46660
+ return inferRuntimeType(
46661
+ ctx,
46662
+ node.typeParameters.params[1],
46663
+ scope
46664
+ );
46665
+ }
46666
+ break;
46667
+ case "Exclude":
46668
+ case "OmitThisParameter":
46669
+ if (node.typeParameters && node.typeParameters.params[0]) {
46670
+ return inferRuntimeType(
46671
+ ctx,
46672
+ node.typeParameters.params[0],
46673
+ scope
46674
+ );
46675
+ }
46676
+ break;
46677
+ }
46649
46678
  }
46650
46679
  }
46651
46680
  break;
@@ -46653,9 +46682,9 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
46653
46682
  case "TSParenthesizedType":
46654
46683
  return inferRuntimeType(ctx, node.typeAnnotation, scope);
46655
46684
  case "TSUnionType":
46656
- return flattenTypes(ctx, node.types, scope);
46685
+ return flattenTypes(ctx, node.types, scope, isKeyOf);
46657
46686
  case "TSIntersectionType": {
46658
- return flattenTypes(ctx, node.types, scope).filter(
46687
+ return flattenTypes(ctx, node.types, scope, isKeyOf).filter(
46659
46688
  (t) => t !== UNKNOWN_TYPE
46660
46689
  );
46661
46690
  }
@@ -46700,19 +46729,25 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
46700
46729
  node.operator === "keyof"
46701
46730
  );
46702
46731
  }
46732
+ case "TSAnyKeyword": {
46733
+ if (isKeyOf) {
46734
+ return ["String", "Number", "Symbol"];
46735
+ }
46736
+ break;
46737
+ }
46703
46738
  }
46704
46739
  } catch (e) {
46705
46740
  }
46706
46741
  return [UNKNOWN_TYPE];
46707
46742
  }
46708
- function flattenTypes(ctx, types, scope) {
46743
+ function flattenTypes(ctx, types, scope, isKeyOf = false) {
46709
46744
  if (types.length === 1) {
46710
- return inferRuntimeType(ctx, types[0], scope);
46745
+ return inferRuntimeType(ctx, types[0], scope, isKeyOf);
46711
46746
  }
46712
46747
  return [
46713
46748
  ...new Set(
46714
46749
  [].concat(
46715
- ...types.map((t) => inferRuntimeType(ctx, t, scope))
46750
+ ...types.map((t) => inferRuntimeType(ctx, t, scope, isKeyOf))
46716
46751
  )
46717
46752
  )
46718
46753
  ];
@@ -46768,8 +46803,7 @@ function reverseInferType(key, node, scope, optional = true, checkObjectSyntax =
46768
46803
  if ((node.type === "TSTypeReference" || node.type === "TSImportType") && node.typeParameters) {
46769
46804
  for (const t of node.typeParameters.params) {
46770
46805
  const inferred = reverseInferType(key, t, scope, optional);
46771
- if (inferred)
46772
- return inferred;
46806
+ if (inferred) return inferred;
46773
46807
  }
46774
46808
  }
46775
46809
  return createProperty(key, { type: `TSNullKeyword` }, scope, optional);
@@ -46809,8 +46843,7 @@ function resolveReturnType(ctx, arg, scope) {
46809
46843
  if (arg.type === "TSTypeReference" || arg.type === "TSTypeQuery" || arg.type === "TSImportType") {
46810
46844
  resolved = resolveTypeReference(ctx, arg, scope);
46811
46845
  }
46812
- if (!resolved)
46813
- return;
46846
+ if (!resolved) return;
46814
46847
  if (resolved.type === "TSFunctionType") {
46815
46848
  return (_a = resolved.typeAnnotation) == null ? void 0 : _a.typeAnnotation;
46816
46849
  }
@@ -46821,8 +46854,7 @@ function resolveReturnType(ctx, arg, scope) {
46821
46854
  function resolveUnionType(ctx, node, scope) {
46822
46855
  if (node.type === "TSTypeReference") {
46823
46856
  const resolved = resolveTypeReference(ctx, node, scope);
46824
- if (resolved)
46825
- node = resolved;
46857
+ if (resolved) node = resolved;
46826
46858
  }
46827
46859
  let types;
46828
46860
  if (node.type === "TSUnionType") {
@@ -46899,8 +46931,7 @@ function processDefineModel(ctx, node, declId) {
46899
46931
  return true;
46900
46932
  }
46901
46933
  function genModelProps(ctx) {
46902
- if (!ctx.hasDefineModelCall)
46903
- return;
46934
+ if (!ctx.hasDefineModelCall) return;
46904
46935
  const isProd = !!ctx.options.isProd;
46905
46936
  let modelPropsDecl = "";
46906
46937
  for (const [name, { type, options: runtimeOptions }] of Object.entries(
@@ -47102,8 +47133,7 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
47102
47133
  } else if (hasStaticDefaults) {
47103
47134
  const prop = ctx.propsRuntimeDefaults.properties.find(
47104
47135
  (node) => {
47105
- if (node.type === "SpreadElement")
47106
- return false;
47136
+ if (node.type === "SpreadElement") return false;
47107
47137
  return resolveObjectKey(node.key, node.computed) === key;
47108
47138
  }
47109
47139
  );
@@ -47275,8 +47305,7 @@ function transformDestructuredProps(ctx, vueImportAliases) {
47275
47305
  if (stmt.type === "VariableDeclaration") {
47276
47306
  walkVariableDeclaration(stmt, isRoot);
47277
47307
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
47278
- if (stmt.declare || !stmt.id)
47279
- continue;
47308
+ if (stmt.declare || !stmt.id) continue;
47280
47309
  registerLocalBinding(stmt.id);
47281
47310
  } else if ((stmt.type === "ForOfStatement" || stmt.type === "ForInStatement") && stmt.left.type === "VariableDeclaration") {
47282
47311
  walkVariableDeclaration(stmt.left);
@@ -47502,8 +47531,7 @@ function processDefineOptions(ctx, node) {
47502
47531
  if (node.typeParameters) {
47503
47532
  ctx.error(`${DEFINE_OPTIONS}() cannot accept type arguments`, node);
47504
47533
  }
47505
- if (!node.arguments[0])
47506
- return true;
47534
+ if (!node.arguments[0]) return true;
47507
47535
  ctx.hasDefineOptionsCall = true;
47508
47536
  ctx.optionsRuntimeDecl = unwrapTSNode(node.arguments[0]);
47509
47537
  let propsOption = void 0;
@@ -47513,14 +47541,20 @@ function processDefineOptions(ctx, node) {
47513
47541
  if (ctx.optionsRuntimeDecl.type === "ObjectExpression") {
47514
47542
  for (const prop of ctx.optionsRuntimeDecl.properties) {
47515
47543
  if ((prop.type === "ObjectProperty" || prop.type === "ObjectMethod") && prop.key.type === "Identifier") {
47516
- if (prop.key.name === "props")
47517
- propsOption = prop;
47518
- if (prop.key.name === "emits")
47519
- emitsOption = prop;
47520
- if (prop.key.name === "expose")
47521
- exposeOption = prop;
47522
- if (prop.key.name === "slots")
47523
- slotsOption = prop;
47544
+ switch (prop.key.name) {
47545
+ case "props":
47546
+ propsOption = prop;
47547
+ break;
47548
+ case "emits":
47549
+ emitsOption = prop;
47550
+ break;
47551
+ case "expose":
47552
+ exposeOption = prop;
47553
+ break;
47554
+ case "slots":
47555
+ slotsOption = prop;
47556
+ break;
47557
+ }
47524
47558
  }
47525
47559
  }
47526
47560
  }
@@ -47596,6 +47630,15 @@ var __spreadValues$1 = (a, b) => {
47596
47630
  return a;
47597
47631
  };
47598
47632
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
47633
+ const MACROS = [
47634
+ DEFINE_PROPS,
47635
+ DEFINE_EMITS,
47636
+ DEFINE_EXPOSE,
47637
+ DEFINE_OPTIONS,
47638
+ DEFINE_SLOTS,
47639
+ DEFINE_MODEL,
47640
+ WITH_DEFAULTS
47641
+ ];
47599
47642
  function compileScript(sfc, options) {
47600
47643
  var _a, _b, _c;
47601
47644
  if (!options.id) {
@@ -47663,8 +47706,7 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
47663
47706
  };
47664
47707
  }
47665
47708
  function checkInvalidScopeReference(node, method) {
47666
- if (!node)
47667
- return;
47709
+ if (!node) return;
47668
47710
  walkIdentifiers(node, (id) => {
47669
47711
  const binding = setupBindings[id.name];
47670
47712
  if (binding && binding !== "literal-const") {
@@ -47714,10 +47756,17 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
47714
47756
  const imported = getImportedName(specifier);
47715
47757
  const source2 = node.source.value;
47716
47758
  const existing = ctx.userImports[local];
47717
- if (source2 === "vue" && (imported === DEFINE_PROPS || imported === DEFINE_EMITS || imported === DEFINE_EXPOSE)) {
47718
- warnOnce$3(
47719
- `\`${imported}\` is a compiler macro and no longer needs to be imported.`
47720
- );
47759
+ if (source2 === "vue" && MACROS.includes(imported)) {
47760
+ if (local === imported) {
47761
+ warnOnce$3(
47762
+ `\`${imported}\` is a compiler macro and no longer needs to be imported.`
47763
+ );
47764
+ } else {
47765
+ ctx.error(
47766
+ `\`${imported}\` is a compiler macro and cannot be aliased to a different name.`,
47767
+ specifier
47768
+ );
47769
+ }
47721
47770
  removeSpecifier(i);
47722
47771
  } else if (existing) {
47723
47772
  if (existing.source === source2 && existing.imported === imported) {
@@ -47747,8 +47796,7 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
47747
47796
  const vueImportAliases = {};
47748
47797
  for (const key in ctx.userImports) {
47749
47798
  const { source: source2, imported, local } = ctx.userImports[key];
47750
- if (source2 === "vue")
47751
- vueImportAliases[imported] = local;
47799
+ if (source2 === "vue") vueImportAliases[imported] = local;
47752
47800
  }
47753
47801
  if (script && scriptAst) {
47754
47802
  for (const node of scriptAst.body) {
@@ -47862,6 +47910,9 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
47862
47910
  );
47863
47911
  }
47864
47912
  const isDefineProps = processDefineProps(ctx, init, decl.id);
47913
+ if (ctx.propsDestructureRestId) {
47914
+ setupBindings[ctx.propsDestructureRestId] = "setup-reactive-const";
47915
+ }
47865
47916
  const isDefineEmits = !isDefineProps && processDefineEmits(ctx, init, decl.id);
47866
47917
  !isDefineEmits && (processDefineSlots(ctx, init, decl.id) || processDefineModel(ctx, init, decl.id));
47867
47918
  if (isDefineProps && !ctx.propsDestructureRestId && ctx.propsDestructureDecl) {
@@ -47928,8 +47979,7 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
47928
47979
  }
47929
47980
  },
47930
47981
  exit(node2) {
47931
- if (node2.type === "BlockStatement")
47932
- scope.pop();
47982
+ if (node2.type === "BlockStatement") scope.pop();
47933
47983
  }
47934
47984
  });
47935
47985
  }
@@ -47980,8 +48030,7 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
47980
48030
  for (const [key, { isType, imported, source: source2 }] of Object.entries(
47981
48031
  ctx.userImports
47982
48032
  )) {
47983
- if (isType)
47984
- continue;
48033
+ if (isType) continue;
47985
48034
  ctx.bindingMetadata[key] = imported === "*" || imported === "default" && source2.endsWith(".vue") || source2 === "vue" ? "setup-const" : "setup-maybe-ref";
47986
48035
  }
47987
48036
  for (const key in scriptBindings) {
@@ -48148,12 +48197,10 @@ return ${returned}
48148
48197
  __ssrInlineRender: true,`;
48149
48198
  }
48150
48199
  const propsDecl = genRuntimeProps(ctx);
48151
- if (propsDecl)
48152
- runtimeOptions += `
48200
+ if (propsDecl) runtimeOptions += `
48153
48201
  props: ${propsDecl},`;
48154
48202
  const emitsDecl = genRuntimeEmits(ctx);
48155
- if (emitsDecl)
48156
- runtimeOptions += `
48203
+ if (emitsDecl) runtimeOptions += `
48157
48204
  emits: ${emitsDecl},`;
48158
48205
  let definedOptions = "";
48159
48206
  if (ctx.optionsRuntimeDecl) {
@@ -48230,10 +48277,10 @@ function walkDeclaration(from, node, bindings, userImportAliases, hoistStatic) {
48230
48277
  );
48231
48278
  for (const { id, init: _init } of node.declarations) {
48232
48279
  const init = _init && unwrapTSNode(_init);
48233
- const isDefineCall = !!(isConst && isCallOf(
48280
+ const isConstMacroCall = isConst && isCallOf(
48234
48281
  init,
48235
- (c) => c === DEFINE_PROPS || c === DEFINE_EMITS || c === WITH_DEFAULTS
48236
- ));
48282
+ (c) => c === DEFINE_PROPS || c === DEFINE_EMITS || c === WITH_DEFAULTS || c === DEFINE_SLOTS
48283
+ );
48237
48284
  if (id.type === "Identifier") {
48238
48285
  let bindingType;
48239
48286
  const userReactiveBinding = userImportAliases["reactive"];
@@ -48244,7 +48291,7 @@ function walkDeclaration(from, node, bindings, userImportAliases, hoistStatic) {
48244
48291
  } else if (
48245
48292
  // if a declaration is a const literal, we can mark it so that
48246
48293
  // the generated render fn code doesn't need to unref() it
48247
- isDefineCall || isConst && canNeverBeRef(init, userReactiveBinding)
48294
+ isConstMacroCall || isConst && canNeverBeRef(init, userReactiveBinding)
48248
48295
  ) {
48249
48296
  bindingType = isCallOf(init, DEFINE_PROPS) ? "setup-reactive-const" : "setup-const";
48250
48297
  } else if (isConst) {
@@ -48265,9 +48312,9 @@ function walkDeclaration(from, node, bindings, userImportAliases, hoistStatic) {
48265
48312
  continue;
48266
48313
  }
48267
48314
  if (id.type === "ObjectPattern") {
48268
- walkObjectPattern(id, bindings, isConst, isDefineCall);
48315
+ walkObjectPattern(id, bindings, isConst, isConstMacroCall);
48269
48316
  } else if (id.type === "ArrayPattern") {
48270
- walkArrayPattern(id, bindings, isConst, isDefineCall);
48317
+ walkArrayPattern(id, bindings, isConst, isConstMacroCall);
48271
48318
  }
48272
48319
  }
48273
48320
  }
@@ -48390,7 +48437,7 @@ var __spreadValues = (a, b) => {
48390
48437
  }
48391
48438
  return a;
48392
48439
  };
48393
- const version = "3.4.27";
48440
+ const version = "3.4.29";
48394
48441
  const parseCache = parseCache$1;
48395
48442
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
48396
48443
  const walk = walk$2;