@vue/compiler-sfc 3.5.0-alpha.2 → 3.5.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.5.0-alpha.2
2
+ * @vue/compiler-sfc v3.5.0-alpha.3
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -86,11 +86,14 @@ const slotFlagsText = {
86
86
  [3]: "FORWARDED"
87
87
  };
88
88
 
89
- const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
89
+ const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
90
90
  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]}`
@@ -166,8 +168,8 @@ function stringifyStyle(styles) {
166
168
  }
167
169
  for (const key in styles) {
168
170
  const value = styles[key];
169
- const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
170
171
  if (isString$2(value) || typeof value === "number") {
172
+ const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
171
173
  ret += `${normalizedKey}:${value};`;
172
174
  }
173
175
  }
@@ -272,11 +274,14 @@ function escapeHtml(string) {
272
274
  return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
273
275
  }
274
276
 
277
+ const isRef = (val) => {
278
+ return !!(val && val["__v_isRef"] === true);
279
+ };
275
280
  const toDisplayString = (val) => {
276
- return isString$2(val) ? val : val == null ? "" : isArray$3(val) || isObject$2(val) && (val.toString === objectToString$1 || !isFunction$1(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
281
+ return isString$2(val) ? val : val == null ? "" : isArray$3(val) || isObject$2(val) && (val.toString === objectToString$1 || !isFunction$1(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
277
282
  };
278
283
  const replacer = (_key, val) => {
279
- if (val && val.__v_isRef) {
284
+ if (isRef(val)) {
280
285
  return replacer(_key, val.value);
281
286
  } else if (isMap(val)) {
282
287
  return {
@@ -475,8 +480,8 @@ const ConstantTypes = {
475
480
  "0": "NOT_CONSTANT",
476
481
  "CAN_SKIP_PATCH": 1,
477
482
  "1": "CAN_SKIP_PATCH",
478
- "CAN_HOIST": 2,
479
- "2": "CAN_HOIST",
483
+ "CAN_CACHE": 2,
484
+ "2": "CAN_CACHE",
480
485
  "CAN_STRINGIFY": 3,
481
486
  "3": "CAN_STRINGIFY"
482
487
  };
@@ -495,7 +500,7 @@ function createRoot(children, source = "") {
495
500
  directives: [],
496
501
  hoists: [],
497
502
  imports: [],
498
- cached: 0,
503
+ cached: [],
499
504
  temps: 0,
500
505
  codegenNode: void 0,
501
506
  loc: locStub
@@ -600,12 +605,13 @@ function createConditionalExpression(test, consequent, alternate, newline = true
600
605
  loc: locStub
601
606
  };
602
607
  }
603
- function createCacheExpression(index, value, isVNode = false) {
608
+ function createCacheExpression(index, value, needPauseTracking = false) {
604
609
  return {
605
610
  type: 20,
606
611
  index,
607
612
  value,
608
- isVNode,
613
+ needPauseTracking,
614
+ needArraySpread: false,
609
615
  loc: locStub
610
616
  };
611
617
  }
@@ -2146,8 +2152,7 @@ function warnDeprecation(key, context, loc, ...args) {
2146
2152
  Details: ${link}` : ``}`;
2147
2153
  const err = new SyntaxError(msg);
2148
2154
  err.code = key;
2149
- if (loc)
2150
- err.loc = loc;
2155
+ if (loc) err.loc = loc;
2151
2156
  context.onWarn(err);
2152
2157
  }
2153
2158
 
@@ -2447,10 +2452,7 @@ const NodeDescriptions = {
2447
2452
  VariableDeclarator: "variable declaration",
2448
2453
  YieldExpression: "yield expression"
2449
2454
  };
2450
- const toNodeDescription = ({
2451
- type,
2452
- prefix
2453
- }) => type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[String(prefix)] : NodeDescriptions[type];
2455
+ const toNodeDescription = node => node.type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[`${node.prefix}`] : NodeDescriptions[node.type];
2454
2456
  var StandardErrors = {
2455
2457
  AccessorIsGenerator: ({
2456
2458
  kind
@@ -2661,6 +2663,7 @@ var StandardErrors = {
2661
2663
  UnterminatedRegExp: "Unterminated regular expression.",
2662
2664
  UnterminatedString: "Unterminated string constant.",
2663
2665
  UnterminatedTemplate: "Unterminated template.",
2666
+ UsingDeclarationExport: "Using declaration cannot be exported.",
2664
2667
  UsingDeclarationHasBindingPattern: "Using declaration cannot have destructuring patterns.",
2665
2668
  VarRedeclaration: ({
2666
2669
  identifierName
@@ -2950,6 +2953,10 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
2950
2953
  }
2951
2954
  return this.finishNode(node, "MethodDefinition");
2952
2955
  }
2956
+ nameIsConstructor(key) {
2957
+ if (key.type === "Literal") return key.value === "constructor";
2958
+ return super.nameIsConstructor(key);
2959
+ }
2953
2960
  parseClassProperty(...args) {
2954
2961
  const propertyNode = super.parseClassProperty(...args);
2955
2962
  {
@@ -3014,9 +3021,9 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
3014
3021
  }
3015
3022
  }
3016
3023
  toAssignableObjectExpressionProp(prop, isLast, isLHS) {
3017
- if (prop.kind === "get" || prop.kind === "set") {
3024
+ if (prop.type === "Property" && (prop.kind === "get" || prop.kind === "set")) {
3018
3025
  this.raise(Errors.PatternHasAccessor, prop.key);
3019
- } else if (prop.method) {
3026
+ } else if (prop.type === "Property" && prop.method) {
3020
3027
  this.raise(Errors.PatternHasMethod, prop.key);
3021
3028
  } else {
3022
3029
  super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
@@ -3028,9 +3035,9 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
3028
3035
  node.type = "ImportExpression";
3029
3036
  node.source = node.arguments[0];
3030
3037
  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;
3038
+ var _ref, _ref2;
3039
+ node.options = (_ref = node.arguments[1]) != null ? _ref : null;
3040
+ node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
3034
3041
  }
3035
3042
  delete node.arguments;
3036
3043
  delete node.callee;
@@ -3102,7 +3109,7 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
3102
3109
  return node.type === "Property" && node.kind === "init" && !node.method;
3103
3110
  }
3104
3111
  isObjectMethod(node) {
3105
- return node.method || node.kind === "get" || node.kind === "set";
3112
+ return node.type === "Property" && (node.method || node.kind === "get" || node.kind === "set");
3106
3113
  }
3107
3114
  finishNodeAt(node, type, endLoc) {
3108
3115
  return toESTreeLocation(super.finishNodeAt(node, type, endLoc));
@@ -4005,7 +4012,9 @@ class CommentsParser extends BaseParser {
4005
4012
  const {
4006
4013
  commentsLen
4007
4014
  } = this.state;
4008
- if (this.comments.length != commentsLen) this.comments.length = commentsLen;
4015
+ if (this.comments.length !== commentsLen) {
4016
+ this.comments.length = commentsLen;
4017
+ }
4009
4018
  this.comments.push(comment);
4010
4019
  this.state.commentsLen++;
4011
4020
  }
@@ -4227,12 +4236,8 @@ class State {
4227
4236
  get strict() {
4228
4237
  return (this.flags & 1) > 0;
4229
4238
  }
4230
- set strict(value) {
4231
- if (value) {
4232
- this.flags |= 1;
4233
- } else {
4234
- this.flags &= ~1;
4235
- }
4239
+ set strict(v) {
4240
+ if (v) this.flags |= 1;else this.flags &= -2;
4236
4241
  }
4237
4242
  init({
4238
4243
  strictMode,
@@ -4248,112 +4253,68 @@ class State {
4248
4253
  get maybeInArrowParameters() {
4249
4254
  return (this.flags & 2) > 0;
4250
4255
  }
4251
- set maybeInArrowParameters(value) {
4252
- if (value) {
4253
- this.flags |= 2;
4254
- } else {
4255
- this.flags &= ~2;
4256
- }
4256
+ set maybeInArrowParameters(v) {
4257
+ if (v) this.flags |= 2;else this.flags &= -3;
4257
4258
  }
4258
4259
  get inType() {
4259
4260
  return (this.flags & 4) > 0;
4260
4261
  }
4261
- set inType(value) {
4262
- if (value) {
4263
- this.flags |= 4;
4264
- } else {
4265
- this.flags &= ~4;
4266
- }
4262
+ set inType(v) {
4263
+ if (v) this.flags |= 4;else this.flags &= -5;
4267
4264
  }
4268
4265
  get noAnonFunctionType() {
4269
4266
  return (this.flags & 8) > 0;
4270
4267
  }
4271
- set noAnonFunctionType(value) {
4272
- if (value) {
4273
- this.flags |= 8;
4274
- } else {
4275
- this.flags &= ~8;
4276
- }
4268
+ set noAnonFunctionType(v) {
4269
+ if (v) this.flags |= 8;else this.flags &= -9;
4277
4270
  }
4278
4271
  get hasFlowComment() {
4279
4272
  return (this.flags & 16) > 0;
4280
4273
  }
4281
- set hasFlowComment(value) {
4282
- if (value) {
4283
- this.flags |= 16;
4284
- } else {
4285
- this.flags &= ~16;
4286
- }
4274
+ set hasFlowComment(v) {
4275
+ if (v) this.flags |= 16;else this.flags &= -17;
4287
4276
  }
4288
4277
  get isAmbientContext() {
4289
4278
  return (this.flags & 32) > 0;
4290
4279
  }
4291
- set isAmbientContext(value) {
4292
- if (value) {
4293
- this.flags |= 32;
4294
- } else {
4295
- this.flags &= ~32;
4296
- }
4280
+ set isAmbientContext(v) {
4281
+ if (v) this.flags |= 32;else this.flags &= -33;
4297
4282
  }
4298
4283
  get inAbstractClass() {
4299
4284
  return (this.flags & 64) > 0;
4300
4285
  }
4301
- set inAbstractClass(value) {
4302
- if (value) {
4303
- this.flags |= 64;
4304
- } else {
4305
- this.flags &= ~64;
4306
- }
4286
+ set inAbstractClass(v) {
4287
+ if (v) this.flags |= 64;else this.flags &= -65;
4307
4288
  }
4308
4289
  get inDisallowConditionalTypesContext() {
4309
4290
  return (this.flags & 128) > 0;
4310
4291
  }
4311
- set inDisallowConditionalTypesContext(value) {
4312
- if (value) {
4313
- this.flags |= 128;
4314
- } else {
4315
- this.flags &= ~128;
4316
- }
4292
+ set inDisallowConditionalTypesContext(v) {
4293
+ if (v) this.flags |= 128;else this.flags &= -129;
4317
4294
  }
4318
4295
  get soloAwait() {
4319
4296
  return (this.flags & 256) > 0;
4320
4297
  }
4321
- set soloAwait(value) {
4322
- if (value) {
4323
- this.flags |= 256;
4324
- } else {
4325
- this.flags &= ~256;
4326
- }
4298
+ set soloAwait(v) {
4299
+ if (v) this.flags |= 256;else this.flags &= -257;
4327
4300
  }
4328
4301
  get inFSharpPipelineDirectBody() {
4329
4302
  return (this.flags & 512) > 0;
4330
4303
  }
4331
- set inFSharpPipelineDirectBody(value) {
4332
- if (value) {
4333
- this.flags |= 512;
4334
- } else {
4335
- this.flags &= ~512;
4336
- }
4304
+ set inFSharpPipelineDirectBody(v) {
4305
+ if (v) this.flags |= 512;else this.flags &= -513;
4337
4306
  }
4338
4307
  get canStartJSXElement() {
4339
4308
  return (this.flags & 1024) > 0;
4340
4309
  }
4341
- set canStartJSXElement(value) {
4342
- if (value) {
4343
- this.flags |= 1024;
4344
- } else {
4345
- this.flags &= ~1024;
4346
- }
4310
+ set canStartJSXElement(v) {
4311
+ if (v) this.flags |= 1024;else this.flags &= -1025;
4347
4312
  }
4348
4313
  get containsEsc() {
4349
4314
  return (this.flags & 2048) > 0;
4350
4315
  }
4351
- set containsEsc(value) {
4352
- if (value) {
4353
- this.flags |= 2048;
4354
- } else {
4355
- this.flags &= ~2048;
4356
- }
4316
+ set containsEsc(v) {
4317
+ if (v) this.flags |= 2048;else this.flags &= -2049;
4357
4318
  }
4358
4319
  curPosition() {
4359
4320
  return new Position(this.curLine, this.pos - this.lineStart, this.pos);
@@ -7179,50 +7140,56 @@ var flow = superClass => class FlowParserMixin extends superClass {
7179
7140
  this.state.noAnonFunctionType = oldNoAnonFunctionType;
7180
7141
  return type;
7181
7142
  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");
7143
+ {
7144
+ const node = this.startNode();
7145
+ node.typeParameters = this.flowParseTypeParameterDeclaration();
7146
+ this.expect(10);
7147
+ tmp = this.flowParseFunctionTypeParams();
7148
+ node.params = tmp.params;
7149
+ node.rest = tmp.rest;
7150
+ node.this = tmp._this;
7151
+ this.expect(11);
7152
+ this.expect(19);
7153
+ node.returnType = this.flowParseType();
7154
+ return this.finishNode(node, "FunctionTypeAnnotation");
7155
+ }
7192
7156
  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;
7157
+ {
7158
+ const node = this.startNode();
7159
+ this.next();
7160
+ if (!this.match(11) && !this.match(21)) {
7161
+ if (tokenIsIdentifier(this.state.type) || this.match(78)) {
7162
+ const token = this.lookahead().type;
7163
+ isGroupedType = token !== 17 && token !== 14;
7164
+ } else {
7165
+ isGroupedType = true;
7166
+ }
7200
7167
  }
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;
7168
+ if (isGroupedType) {
7169
+ this.state.noAnonFunctionType = false;
7170
+ type = this.flowParseType();
7171
+ this.state.noAnonFunctionType = oldNoAnonFunctionType;
7172
+ if (this.state.noAnonFunctionType || !(this.match(12) || this.match(11) && this.lookahead().type === 19)) {
7173
+ this.expect(11);
7174
+ return type;
7175
+ } else {
7176
+ this.eat(12);
7177
+ }
7178
+ }
7179
+ if (type) {
7180
+ tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]);
7209
7181
  } else {
7210
- this.eat(12);
7182
+ tmp = this.flowParseFunctionTypeParams();
7211
7183
  }
7184
+ node.params = tmp.params;
7185
+ node.rest = tmp.rest;
7186
+ node.this = tmp._this;
7187
+ this.expect(11);
7188
+ this.expect(19);
7189
+ node.returnType = this.flowParseType();
7190
+ node.typeParameters = null;
7191
+ return this.finishNode(node, "FunctionTypeAnnotation");
7212
7192
  }
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
7193
  case 133:
7227
7194
  return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
7228
7195
  case 85:
@@ -7538,7 +7505,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
7538
7505
  const arrows = [];
7539
7506
  while (stack.length !== 0) {
7540
7507
  const node = stack.pop();
7541
- if (node.type === "ArrowFunctionExpression") {
7508
+ if (node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatement") {
7542
7509
  if (node.typeParameters || !node.returnType) {
7543
7510
  this.finishArrowValidation(node);
7544
7511
  } else {
@@ -7575,18 +7542,18 @@ var flow = superClass => class FlowParserMixin extends superClass {
7575
7542
  return result;
7576
7543
  }
7577
7544
  parseParenItem(node, startLoc) {
7578
- node = super.parseParenItem(node, startLoc);
7545
+ const newNode = super.parseParenItem(node, startLoc);
7579
7546
  if (this.eat(17)) {
7580
- node.optional = true;
7547
+ newNode.optional = true;
7581
7548
  this.resetEndLocation(node);
7582
7549
  }
7583
7550
  if (this.match(14)) {
7584
7551
  const typeCastNode = this.startNodeAt(startLoc);
7585
- typeCastNode.expression = node;
7552
+ typeCastNode.expression = newNode;
7586
7553
  typeCastNode.typeAnnotation = this.flowParseTypeAnnotation();
7587
7554
  return this.finishNode(typeCastNode, "TypeCastExpression");
7588
7555
  }
7589
- return node;
7556
+ return newNode;
7590
7557
  }
7591
7558
  assertModuleNodeAllowed(node) {
7592
7559
  if (node.type === "ImportDeclaration" && (node.importKind === "type" || node.importKind === "typeof") || node.type === "ExportNamedDeclaration" && node.exportKind === "type" || node.type === "ExportAllDeclaration" && node.exportKind === "type") {
@@ -8959,7 +8926,7 @@ var jsx = superClass => class JSXParserMixin extends superClass {
8959
8926
  } else {
8960
8927
  let count = 0;
8961
8928
  let semi = false;
8962
- while (count++ < 10 && this.state.pos < this.length && !(semi = this.codePointAtPos(this.state.pos) == 59)) {
8929
+ while (count++ < 10 && this.state.pos < this.length && !(semi = this.codePointAtPos(this.state.pos) === 59)) {
8963
8930
  ++this.state.pos;
8964
8931
  }
8965
8932
  if (semi) {
@@ -9121,7 +9088,7 @@ var jsx = superClass => class JSXParserMixin extends superClass {
9121
9088
  children.push(this.jsxParseElementAt(startLoc));
9122
9089
  break;
9123
9090
  case 141:
9124
- children.push(this.parseExprAtom());
9091
+ children.push(this.parseLiteral(this.state.value, "JSXText"));
9125
9092
  break;
9126
9093
  case 5:
9127
9094
  {
@@ -9178,9 +9145,7 @@ var jsx = superClass => class JSXParserMixin extends superClass {
9178
9145
  context[context.length - 1] = newContext;
9179
9146
  }
9180
9147
  parseExprAtom(refExpressionErrors) {
9181
- if (this.match(141)) {
9182
- return this.parseLiteral(this.state.value, "JSXText");
9183
- } else if (this.match(142)) {
9148
+ if (this.match(142)) {
9184
9149
  return this.jsxParseElement();
9185
9150
  } else if (this.match(47) && this.input.charCodeAt(this.state.pos) !== 33) {
9186
9151
  this.replaceToken(142);
@@ -9261,14 +9226,14 @@ class TypeScriptScopeHandler extends ScopeHandler {
9261
9226
  return new TypeScriptScope(flags);
9262
9227
  }
9263
9228
  enter(flags) {
9264
- if (flags == 256) {
9229
+ if (flags === 256) {
9265
9230
  this.importsStack.push(new Set());
9266
9231
  }
9267
9232
  super.enter(flags);
9268
9233
  }
9269
9234
  exit() {
9270
9235
  const flags = super.exit();
9271
- if (flags == 256) {
9236
+ if (flags === 256) {
9272
9237
  this.importsStack.pop();
9273
9238
  }
9274
9239
  return flags;
@@ -9577,14 +9542,15 @@ class LValParser extends NodeUtils {
9577
9542
  return this.finishNode(prop, "RestElement");
9578
9543
  }
9579
9544
  parseBindingProperty() {
9580
- const prop = this.startNode();
9581
9545
  const {
9582
9546
  type,
9583
9547
  startLoc
9584
9548
  } = this.state;
9585
9549
  if (type === 21) {
9586
- return this.parseBindingRestProperty(prop);
9587
- } else if (type === 138) {
9550
+ return this.parseBindingRestProperty(this.startNode());
9551
+ }
9552
+ const prop = this.startNode();
9553
+ if (type === 138) {
9588
9554
  this.expectPlugin("destructuringPrivate", startLoc);
9589
9555
  this.classScope.usePrivateName(this.state.value, startLoc);
9590
9556
  prop.key = this.parsePrivateName();
@@ -11434,13 +11400,14 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
11434
11400
  parseExport(node, decorators) {
11435
11401
  if (this.match(83)) {
11436
11402
  this.next();
11403
+ const nodeImportEquals = node;
11437
11404
  let maybeDefaultIdentifier = null;
11438
11405
  if (this.isContextual(130) && this.isPotentialImportPhase(false)) {
11439
- maybeDefaultIdentifier = this.parseMaybeImportPhase(node, false);
11406
+ maybeDefaultIdentifier = this.parseMaybeImportPhase(nodeImportEquals, false);
11440
11407
  } else {
11441
- node.importKind = "value";
11408
+ nodeImportEquals.importKind = "value";
11442
11409
  }
11443
- return this.tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier, true);
11410
+ return this.tsParseImportEqualsDeclaration(nodeImportEquals, maybeDefaultIdentifier, true);
11444
11411
  } else if (this.eat(29)) {
11445
11412
  const assign = node;
11446
11413
  assign.expression = super.parseExpression();
@@ -11612,9 +11579,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
11612
11579
  return result.node;
11613
11580
  }
11614
11581
  parseParenItem(node, startLoc) {
11615
- node = super.parseParenItem(node, startLoc);
11582
+ const newNode = super.parseParenItem(node, startLoc);
11616
11583
  if (this.eat(17)) {
11617
- node.optional = true;
11584
+ newNode.optional = true;
11618
11585
  this.resetEndLocation(node);
11619
11586
  }
11620
11587
  if (this.match(14)) {
@@ -11723,7 +11690,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
11723
11690
  }
11724
11691
  declareClassPrivateMethodInScope(node, kind) {
11725
11692
  if (node.type === "TSDeclareMethod") return;
11726
- if (node.type === "MethodDefinition" && !node.value.body) return;
11693
+ if (node.type === "MethodDefinition" && !hasOwnProperty.call(node.value, "body")) {
11694
+ return;
11695
+ }
11727
11696
  super.declareClassPrivateMethodInScope(node, kind);
11728
11697
  }
11729
11698
  parseClassSuper(node) {
@@ -11922,6 +11891,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
11922
11891
  TSTypeCastExpression: true,
11923
11892
  TSParameterProperty: "parameter",
11924
11893
  TSNonNullExpression: "expression",
11894
+ TSInstantiationExpression: "expression",
11925
11895
  TSAsExpression: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true],
11926
11896
  TSSatisfiesExpression: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true],
11927
11897
  TSTypeAssertion: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true]
@@ -12275,9 +12245,12 @@ var placeholders = superClass => class PlaceholdersParserMixin extends superClas
12275
12245
  }
12276
12246
  }
12277
12247
  finishPlaceholder(node, expectedNode) {
12278
- const isFinished = !!(node.expectedNode && node.type === "Placeholder");
12279
- node.expectedNode = expectedNode;
12280
- return isFinished ? node : this.finishNode(node, "Placeholder");
12248
+ let placeholder = node;
12249
+ if (!placeholder.expectedNode || !placeholder.type) {
12250
+ placeholder = this.finishNode(placeholder, "Placeholder");
12251
+ }
12252
+ placeholder.expectedNode = expectedNode;
12253
+ return placeholder;
12281
12254
  }
12282
12255
  getTokenFromCode(code) {
12283
12256
  if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
@@ -12337,8 +12310,9 @@ var placeholders = superClass => class PlaceholdersParserMixin extends superClas
12337
12310
  return this.finishNode(stmt, "LabeledStatement");
12338
12311
  }
12339
12312
  this.semicolon();
12340
- node.name = expr.name;
12341
- return this.finishPlaceholder(node, "Statement");
12313
+ const stmtPlaceholder = node;
12314
+ stmtPlaceholder.name = expr.name;
12315
+ return this.finishPlaceholder(stmtPlaceholder, "Statement");
12342
12316
  }
12343
12317
  parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse) {
12344
12318
  return this.parsePlaceholder("BlockStatement") || super.parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse);
@@ -12371,17 +12345,18 @@ var placeholders = superClass => class PlaceholdersParserMixin extends superClas
12371
12345
  parseExport(node, decorators) {
12372
12346
  const placeholder = this.parsePlaceholder("Identifier");
12373
12347
  if (!placeholder) return super.parseExport(node, decorators);
12348
+ const node2 = node;
12374
12349
  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");
12350
+ node2.specifiers = [];
12351
+ node2.source = null;
12352
+ node2.declaration = this.finishPlaceholder(placeholder, "Declaration");
12353
+ return this.finishNode(node2, "ExportNamedDeclaration");
12379
12354
  }
12380
12355
  this.expectPlugin("exportDefaultFrom");
12381
12356
  const specifier = this.startNode();
12382
12357
  specifier.exported = placeholder;
12383
- node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
12384
- return super.parseExport(node, decorators);
12358
+ node2.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
12359
+ return super.parseExport(node2, decorators);
12385
12360
  }
12386
12361
  isExportDefaultSpecifier() {
12387
12362
  if (this.match(65)) {
@@ -12498,7 +12473,6 @@ function getPluginOption(plugins, name, option) {
12498
12473
  }
12499
12474
  const PIPELINE_PROPOSALS = ["minimal", "fsharp", "hack", "smart"];
12500
12475
  const TOPIC_TOKENS = ["^^", "@@", "^", "%", "#"];
12501
- const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
12502
12476
  function validatePlugins(plugins) {
12503
12477
  if (hasPlugin(plugins, "decorators")) {
12504
12478
  if (hasPlugin(plugins, "decorators-legacy")) {
@@ -12525,9 +12499,10 @@ function validatePlugins(plugins) {
12525
12499
  const proposalList = PIPELINE_PROPOSALS.map(p => `"${p}"`).join(", ");
12526
12500
  throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${proposalList}.`);
12527
12501
  }
12528
- const tupleSyntaxIsHash = hasPlugin(plugins, ["recordAndTuple", {
12502
+ const recordAndTupleConfigItem = ["recordAndTuple", {
12529
12503
  syntaxType: "hash"
12530
- }]);
12504
+ }];
12505
+ const tupleSyntaxIsHash = hasPlugin(plugins, recordAndTupleConfigItem);
12531
12506
  if (proposal === "hack") {
12532
12507
  if (hasPlugin(plugins, "placeholders")) {
12533
12508
  throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");
@@ -12541,10 +12516,10 @@ function validatePlugins(plugins) {
12541
12516
  throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${tokenList}.`);
12542
12517
  }
12543
12518
  if (topicToken === "#" && tupleSyntaxIsHash) {
12544
- throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "hack", topicToken: "#" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.');
12519
+ throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(recordAndTupleConfigItem)}\`.`);
12545
12520
  }
12546
12521
  } else if (proposal === "smart" && tupleSyntaxIsHash) {
12547
- throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "smart" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.');
12522
+ throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "smart" }]\` and \`${JSON.stringify(recordAndTupleConfigItem)}\`.`);
12548
12523
  }
12549
12524
  }
12550
12525
  if (hasPlugin(plugins, "moduleAttributes")) {
@@ -12561,8 +12536,16 @@ function validatePlugins(plugins) {
12561
12536
  if (hasPlugin(plugins, "importAssertions") && hasPlugin(plugins, "importAttributes")) {
12562
12537
  throw new Error("Cannot combine importAssertions and importAttributes plugins.");
12563
12538
  }
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(", "));
12539
+ if (hasPlugin(plugins, "recordAndTuple")) {
12540
+ const syntaxType = getPluginOption(plugins, "recordAndTuple", "syntaxType");
12541
+ if (syntaxType != null) {
12542
+ {
12543
+ const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
12544
+ if (!RECORD_AND_TUPLE_SYNTAX_TYPES.includes(syntaxType)) {
12545
+ throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: " + RECORD_AND_TUPLE_SYNTAX_TYPES.map(p => `'${p}'`).join(", "));
12546
+ }
12547
+ }
12548
+ }
12566
12549
  }
12567
12550
  if (hasPlugin(plugins, "asyncDoExpressions") && !hasPlugin(plugins, "doExpressions")) {
12568
12551
  const error = new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");
@@ -13681,14 +13664,16 @@ class ExpressionParser extends LValParser {
13681
13664
  }
13682
13665
  parseTemplate(isTagged) {
13683
13666
  const node = this.startNode();
13684
- node.expressions = [];
13685
13667
  let curElt = this.parseTemplateElement(isTagged);
13686
- node.quasis = [curElt];
13668
+ const quasis = [curElt];
13669
+ const substitutions = [];
13687
13670
  while (!curElt.tail) {
13688
- node.expressions.push(this.parseTemplateSubstitution());
13671
+ substitutions.push(this.parseTemplateSubstitution());
13689
13672
  this.readTemplateContinuation();
13690
- node.quasis.push(curElt = this.parseTemplateElement(isTagged));
13673
+ quasis.push(curElt = this.parseTemplateElement(isTagged));
13691
13674
  }
13675
+ node.expressions = substitutions;
13676
+ node.quasis = quasis;
13692
13677
  return this.finishNode(node, "TemplateLiteral");
13693
13678
  }
13694
13679
  parseTemplateSubstitution() {
@@ -13725,8 +13710,10 @@ class ExpressionParser extends LValParser {
13725
13710
  if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
13726
13711
  this.raise(Errors.InvalidRecordProperty, prop);
13727
13712
  }
13728
- if (prop.shorthand) {
13729
- this.addExtra(prop, "shorthand", true);
13713
+ {
13714
+ if (prop.shorthand) {
13715
+ this.addExtra(prop, "shorthand", true);
13716
+ }
13730
13717
  }
13731
13718
  node.properties.push(prop);
13732
13719
  }
@@ -13776,8 +13763,11 @@ class ExpressionParser extends LValParser {
13776
13763
  let isGenerator = this.eat(55);
13777
13764
  this.parsePropertyNamePrefixOperator(prop);
13778
13765
  const containsEsc = this.state.containsEsc;
13779
- const key = this.parsePropertyName(prop, refExpressionErrors);
13766
+ this.parsePropertyName(prop, refExpressionErrors);
13780
13767
  if (!isGenerator && !containsEsc && this.maybeAsyncOrAccessorProp(prop)) {
13768
+ const {
13769
+ key
13770
+ } = prop;
13781
13771
  const keyName = key.name;
13782
13772
  if (keyName === "async" && !this.hasPrecedingLineBreak()) {
13783
13773
  isAsync = true;
@@ -13912,7 +13902,6 @@ class ExpressionParser extends LValParser {
13912
13902
  prop.computed = false;
13913
13903
  }
13914
13904
  }
13915
- return prop.key;
13916
13905
  }
13917
13906
  initFunction(node, isAsync) {
13918
13907
  node.id = null;
@@ -15322,8 +15311,11 @@ class StatementParser extends ExpressionParser {
15322
15311
  isClassMethod() {
15323
15312
  return this.match(10);
15324
15313
  }
15314
+ nameIsConstructor(key) {
15315
+ return key.type === "Identifier" && key.name === "constructor" || key.type === "StringLiteral" && key.value === "constructor";
15316
+ }
15325
15317
  isNonstaticConstructor(method) {
15326
- return !method.computed && !method.static && (method.key.name === "constructor" || method.key.value === "constructor");
15318
+ return !method.computed && !method.static && this.nameIsConstructor(method.key);
15327
15319
  }
15328
15320
  parseClassBody(hadSuperClass, oldStrict) {
15329
15321
  this.classScope.enter();
@@ -15425,9 +15417,10 @@ class StatementParser extends ExpressionParser {
15425
15417
  this.pushClassMethod(classBody, publicMethod, true, false, false, false);
15426
15418
  return;
15427
15419
  }
15428
- const isContextual = tokenIsIdentifier(this.state.type) && !this.state.containsEsc;
15429
- const isPrivate = this.match(138);
15420
+ const isContextual = !this.state.containsEsc && tokenIsIdentifier(this.state.type);
15430
15421
  const key = this.parseClassElementName(member);
15422
+ const maybeContextualKw = isContextual ? key.name : null;
15423
+ const isPrivate = this.isPrivateName(key);
15431
15424
  const maybeQuestionTokenStartLoc = this.state.startLoc;
15432
15425
  this.parsePostMemberNameModifiers(publicMember);
15433
15426
  if (this.isClassMethod()) {
@@ -15456,7 +15449,7 @@ class StatementParser extends ExpressionParser {
15456
15449
  } else {
15457
15450
  this.pushClassProperty(classBody, publicProp);
15458
15451
  }
15459
- } else if (isContextual && key.name === "async" && !this.isLineTerminator()) {
15452
+ } else if (maybeContextualKw === "async" && !this.isLineTerminator()) {
15460
15453
  this.resetPreviousNodeTrailingComments(key);
15461
15454
  const isGenerator = this.eat(55);
15462
15455
  if (publicMember.optional) {
@@ -15474,9 +15467,9 @@ class StatementParser extends ExpressionParser {
15474
15467
  }
15475
15468
  this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
15476
15469
  }
15477
- } else if (isContextual && (key.name === "get" || key.name === "set") && !(this.match(55) && this.isLineTerminator())) {
15470
+ } else if ((maybeContextualKw === "get" || maybeContextualKw === "set") && !(this.match(55) && this.isLineTerminator())) {
15478
15471
  this.resetPreviousNodeTrailingComments(key);
15479
- method.kind = key.name;
15472
+ method.kind = maybeContextualKw;
15480
15473
  const isPrivate = this.match(138);
15481
15474
  this.parseClassElementName(publicMethod);
15482
15475
  if (isPrivate) {
@@ -15488,7 +15481,7 @@ class StatementParser extends ExpressionParser {
15488
15481
  this.pushClassMethod(classBody, publicMethod, false, false, false, false);
15489
15482
  }
15490
15483
  this.checkGetterSetterParams(publicMethod);
15491
- } else if (isContextual && key.name === "accessor" && !this.isLineTerminator()) {
15484
+ } else if (maybeContextualKw === "accessor" && !this.isLineTerminator()) {
15492
15485
  this.expectPlugin("decoratorAutoAccessors");
15493
15486
  this.resetPreviousNodeTrailingComments(key);
15494
15487
  const isPrivate = this.match(138);
@@ -15520,7 +15513,8 @@ class StatementParser extends ExpressionParser {
15520
15513
  member.key = key;
15521
15514
  return key;
15522
15515
  }
15523
- return this.parsePropertyName(member);
15516
+ this.parsePropertyName(member);
15517
+ return member.key;
15524
15518
  }
15525
15519
  parseClassStaticBlock(classBody, member) {
15526
15520
  var _member$decorators;
@@ -15539,7 +15533,7 @@ class StatementParser extends ExpressionParser {
15539
15533
  }
15540
15534
  }
15541
15535
  pushClassProperty(classBody, prop) {
15542
- if (!prop.computed && (prop.key.name === "constructor" || prop.key.value === "constructor")) {
15536
+ if (!prop.computed && this.nameIsConstructor(prop.key)) {
15543
15537
  this.raise(Errors.ConstructorClassField, prop.key);
15544
15538
  }
15545
15539
  classBody.body.push(this.parseClassProperty(prop));
@@ -15550,11 +15544,8 @@ class StatementParser extends ExpressionParser {
15550
15544
  this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.loc.start);
15551
15545
  }
15552
15546
  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
- }
15547
+ if (!isPrivate && !prop.computed && this.nameIsConstructor(prop.key)) {
15548
+ this.raise(Errors.ConstructorClassField, prop.key);
15558
15549
  }
15559
15550
  const node = this.parseClassAccessorProperty(prop);
15560
15551
  classBody.body.push(node);
@@ -15690,7 +15681,8 @@ class StatementParser extends ExpressionParser {
15690
15681
  }
15691
15682
  maybeParseExportNamespaceSpecifier(node) {
15692
15683
  if (this.isContextual(93)) {
15693
- if (!node.specifiers) node.specifiers = [];
15684
+ var _ref, _ref$specifiers;
15685
+ (_ref$specifiers = (_ref = node).specifiers) != null ? _ref$specifiers : _ref.specifiers = [];
15694
15686
  const specifier = this.startNodeAt(this.state.lastTokStartLoc);
15695
15687
  this.next();
15696
15688
  specifier.exported = this.parseModuleExportName();
@@ -15701,13 +15693,14 @@ class StatementParser extends ExpressionParser {
15701
15693
  }
15702
15694
  maybeParseExportNamedSpecifiers(node) {
15703
15695
  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;
15696
+ const node2 = node;
15697
+ if (!node2.specifiers) node2.specifiers = [];
15698
+ const isTypeExport = node2.exportKind === "type";
15699
+ node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport));
15700
+ node2.source = null;
15701
+ node2.declaration = null;
15709
15702
  if (this.hasPlugin("importAssertions")) {
15710
- node.assertions = [];
15703
+ node2.assertions = [];
15711
15704
  }
15712
15705
  return true;
15713
15706
  }
@@ -15818,6 +15811,14 @@ class StatementParser extends ExpressionParser {
15818
15811
  return true;
15819
15812
  }
15820
15813
  }
15814
+ if (this.isContextual(107)) {
15815
+ this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
15816
+ return true;
15817
+ }
15818
+ if (this.isContextual(96) && this.startsAwaitUsing()) {
15819
+ this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
15820
+ return true;
15821
+ }
15821
15822
  return type === 74 || type === 75 || type === 68 || type === 80 || this.isLet() || this.isAsyncFunction();
15822
15823
  }
15823
15824
  checkExport(node, checkNames, isDefault, isFrom) {
@@ -15855,12 +15856,15 @@ class StatementParser extends ExpressionParser {
15855
15856
  }
15856
15857
  }
15857
15858
  } else if (node.declaration) {
15858
- if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") {
15859
- const id = node.declaration.id;
15859
+ const decl = node.declaration;
15860
+ if (decl.type === "FunctionDeclaration" || decl.type === "ClassDeclaration") {
15861
+ const {
15862
+ id
15863
+ } = decl;
15860
15864
  if (!id) throw new Error("Assertion failure");
15861
15865
  this.checkDuplicateExports(node, id.name);
15862
- } else if (node.declaration.type === "VariableDeclaration") {
15863
- for (const declaration of node.declaration.declarations) {
15866
+ } else if (decl.type === "VariableDeclaration") {
15867
+ for (const declaration of decl.declarations) {
15864
15868
  this.checkDeclaration(declaration.id);
15865
15869
  }
15866
15870
  }
@@ -16570,7 +16574,8 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
16570
16574
  if (includeAll || isRefed && !isLocal) {
16571
16575
  onIdentifier(node, parent, parentStack, isRefed, isLocal);
16572
16576
  }
16573
- } else if (node.type === "ObjectProperty" && (parent == null ? void 0 : parent.type) === "ObjectPattern") {
16577
+ } else if (node.type === "ObjectProperty" && // eslint-disable-next-line no-restricted-syntax
16578
+ (parent == null ? void 0 : parent.type) === "ObjectPattern") {
16574
16579
  node.inPattern = true;
16575
16580
  } else if (isFunctionType(node)) {
16576
16581
  if (node.scopeIds) {
@@ -16661,16 +16666,14 @@ function walkFunctionParams(node, onIdent) {
16661
16666
  function walkBlockDeclarations(block, onIdent) {
16662
16667
  for (const stmt of block.body) {
16663
16668
  if (stmt.type === "VariableDeclaration") {
16664
- if (stmt.declare)
16665
- continue;
16669
+ if (stmt.declare) continue;
16666
16670
  for (const decl of stmt.declarations) {
16667
16671
  for (const id of extractIdentifiers$1(decl.id)) {
16668
16672
  onIdent(id);
16669
16673
  }
16670
16674
  }
16671
16675
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
16672
- if (stmt.declare || !stmt.id)
16673
- continue;
16676
+ if (stmt.declare || !stmt.id) continue;
16674
16677
  onIdent(stmt.id);
16675
16678
  } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
16676
16679
  const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
@@ -16707,8 +16710,7 @@ function extractIdentifiers$1(param, nodes = []) {
16707
16710
  break;
16708
16711
  case "ArrayPattern":
16709
16712
  param.elements.forEach((element) => {
16710
- if (element)
16711
- extractIdentifiers$1(element, nodes);
16713
+ if (element) extractIdentifiers$1(element, nodes);
16712
16714
  });
16713
16715
  break;
16714
16716
  case "RestElement":
@@ -16861,7 +16863,7 @@ function isCoreComponent(tag) {
16861
16863
  return BASE_TRANSITION;
16862
16864
  }
16863
16865
  }
16864
- const nonIdentifierRE = /^\d|[^\$\w]/;
16866
+ const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
16865
16867
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
16866
16868
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
16867
16869
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
@@ -16982,8 +16984,7 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
16982
16984
  for (let i = 0; i < node.props.length; i++) {
16983
16985
  const p = node.props[i];
16984
16986
  if (p.type === 6) {
16985
- if (dynamicOnly)
16986
- continue;
16987
+ if (dynamicOnly) continue;
16987
16988
  if (p.name === name && (p.value || allowEmpty)) {
16988
16989
  return p;
16989
16990
  }
@@ -17135,6 +17136,7 @@ function hasScopeRef(node, ids) {
17135
17136
  return hasScopeRef(node.content, ids);
17136
17137
  case 2:
17137
17138
  case 3:
17139
+ case 20:
17138
17140
  return false;
17139
17141
  default:
17140
17142
  return false;
@@ -17147,7 +17149,7 @@ function getMemoedVNodeCall(node) {
17147
17149
  return node;
17148
17150
  }
17149
17151
  }
17150
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
17152
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
17151
17153
 
17152
17154
  const defaultParserOptions = {
17153
17155
  parseMode: "base",
@@ -17300,8 +17302,7 @@ const tokenizer$2 = new Tokenizer$1(stack, {
17300
17302
  }
17301
17303
  },
17302
17304
  ondirarg(start, end) {
17303
- if (start === end)
17304
- return;
17305
+ if (start === end) return;
17305
17306
  const arg = getSlice(start, end);
17306
17307
  if (inVPre) {
17307
17308
  currentProp.name += arg;
@@ -17333,14 +17334,12 @@ const tokenizer$2 = new Tokenizer$1(stack, {
17333
17334
  },
17334
17335
  onattribdata(start, end) {
17335
17336
  currentAttrValue += getSlice(start, end);
17336
- if (currentAttrStartIndex < 0)
17337
- currentAttrStartIndex = start;
17337
+ if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
17338
17338
  currentAttrEndIndex = end;
17339
17339
  },
17340
17340
  onattribentity(char, start, end) {
17341
17341
  currentAttrValue += char;
17342
- if (currentAttrStartIndex < 0)
17343
- currentAttrStartIndex = start;
17342
+ if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
17344
17343
  currentAttrEndIndex = end;
17345
17344
  },
17346
17345
  onattribnameend(end) {
@@ -17480,8 +17479,7 @@ function parseForExpression(input) {
17480
17479
  const loc = input.loc;
17481
17480
  const exp = input.content;
17482
17481
  const inMatch = exp.match(forAliasRE);
17483
- if (!inMatch)
17484
- return;
17482
+ if (!inMatch) return;
17485
17483
  const [, LHS, RHS] = inMatch;
17486
17484
  const createAliasExpression = (content, offset, asParam = false) => {
17487
17485
  const start = loc.start.offset + offset;
@@ -17610,14 +17608,12 @@ function onCloseTag(el, end, isImplied = false) {
17610
17608
  }
17611
17609
  function lookAhead(index, c) {
17612
17610
  let i = index;
17613
- while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
17614
- i++;
17611
+ while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
17615
17612
  return i;
17616
17613
  }
17617
17614
  function backTrack(index, c) {
17618
17615
  let i = index;
17619
- while (currentInput.charCodeAt(i) !== c && i >= 0)
17620
- i--;
17616
+ while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
17621
17617
  return i;
17622
17618
  }
17623
17619
  const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
@@ -17836,9 +17832,10 @@ function baseParse(input, options) {
17836
17832
  return root;
17837
17833
  }
17838
17834
 
17839
- function hoistStatic(root, context) {
17835
+ function cacheStatic(root, context) {
17840
17836
  walk$1(
17841
17837
  root,
17838
+ void 0,
17842
17839
  context,
17843
17840
  // Root node is unfortunately non-hoistable due to potential parent
17844
17841
  // fallthrough attributes.
@@ -17849,26 +17846,24 @@ function isSingleElementRoot(root, child) {
17849
17846
  const { children } = root;
17850
17847
  return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
17851
17848
  }
17852
- function walk$1(node, context, doNotHoistNode = false) {
17849
+ function walk$1(node, parent, context, doNotHoistNode = false, inFor = false) {
17853
17850
  const { children } = node;
17854
- const originalCount = children.length;
17855
- let hoistedCount = 0;
17851
+ const toCache = [];
17856
17852
  for (let i = 0; i < children.length; i++) {
17857
17853
  const child = children[i];
17858
17854
  if (child.type === 1 && child.tagType === 0) {
17859
17855
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
17860
17856
  if (constantType > 0) {
17861
17857
  if (constantType >= 2) {
17862
- child.codegenNode.patchFlag = -1 + (` /* HOISTED */` );
17863
- child.codegenNode = context.hoist(child.codegenNode);
17864
- hoistedCount++;
17858
+ child.codegenNode.patchFlag = -1;
17859
+ toCache.push(child);
17865
17860
  continue;
17866
17861
  }
17867
17862
  } else {
17868
17863
  const codegenNode = child.codegenNode;
17869
17864
  if (codegenNode.type === 13) {
17870
- const flag = getPatchFlag(codegenNode);
17871
- if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
17865
+ const flag = codegenNode.patchFlag;
17866
+ if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
17872
17867
  const props = getNodeProps(child);
17873
17868
  if (props) {
17874
17869
  codegenNode.props = context.hoist(props);
@@ -17879,39 +17874,84 @@ function walk$1(node, context, doNotHoistNode = false) {
17879
17874
  }
17880
17875
  }
17881
17876
  }
17877
+ } else if (child.type === 12) {
17878
+ const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
17879
+ if (constantType >= 2) {
17880
+ toCache.push(child);
17881
+ continue;
17882
+ }
17882
17883
  }
17883
17884
  if (child.type === 1) {
17884
17885
  const isComponent = child.tagType === 1;
17885
17886
  if (isComponent) {
17886
17887
  context.scopes.vSlot++;
17887
17888
  }
17888
- walk$1(child, context);
17889
+ walk$1(child, node, context, false, inFor);
17889
17890
  if (isComponent) {
17890
17891
  context.scopes.vSlot--;
17891
17892
  }
17892
17893
  } else if (child.type === 11) {
17893
- walk$1(child, context, child.children.length === 1);
17894
+ walk$1(child, node, context, child.children.length === 1, true);
17894
17895
  } else if (child.type === 9) {
17895
17896
  for (let i2 = 0; i2 < child.branches.length; i2++) {
17896
17897
  walk$1(
17897
17898
  child.branches[i2],
17899
+ node,
17898
17900
  context,
17899
- child.branches[i2].children.length === 1
17901
+ child.branches[i2].children.length === 1,
17902
+ inFor
17900
17903
  );
17901
17904
  }
17902
17905
  }
17903
17906
  }
17904
- if (hoistedCount && context.transformHoist) {
17905
- context.transformHoist(children, context, node);
17907
+ let cachedAsArray = false;
17908
+ if (toCache.length === children.length && node.type === 1) {
17909
+ if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray$3(node.codegenNode.children)) {
17910
+ node.codegenNode.children = getCacheExpression(
17911
+ createArrayExpression(node.codegenNode.children)
17912
+ );
17913
+ cachedAsArray = true;
17914
+ } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray$3(node.codegenNode.children) && node.codegenNode.children.type === 15) {
17915
+ const slot = getSlotNode(node.codegenNode, "default");
17916
+ if (slot) {
17917
+ slot.returns = getCacheExpression(
17918
+ createArrayExpression(slot.returns)
17919
+ );
17920
+ cachedAsArray = true;
17921
+ }
17922
+ } else if (node.tagType === 3 && parent && parent.type === 1 && parent.tagType === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !isArray$3(parent.codegenNode.children) && parent.codegenNode.children.type === 15) {
17923
+ const slotName = findDir(node, "slot", true);
17924
+ const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
17925
+ if (slot) {
17926
+ slot.returns = getCacheExpression(
17927
+ createArrayExpression(slot.returns)
17928
+ );
17929
+ cachedAsArray = true;
17930
+ }
17931
+ }
17906
17932
  }
17907
- if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray$3(node.codegenNode.children)) {
17908
- const hoisted = context.hoist(
17909
- createArrayExpression(node.codegenNode.children)
17910
- );
17911
- if (context.hmr) {
17912
- hoisted.content = `[...${hoisted.content}]`;
17933
+ if (!cachedAsArray) {
17934
+ for (const child of toCache) {
17935
+ child.codegenNode = context.cache(child.codegenNode);
17936
+ }
17937
+ }
17938
+ function getCacheExpression(value) {
17939
+ const exp = context.cache(value);
17940
+ if (inFor && context.hmr) {
17941
+ exp.needArraySpread = true;
17942
+ }
17943
+ return exp;
17944
+ }
17945
+ function getSlotNode(node2, name) {
17946
+ if (node2.children && !isArray$3(node2.children) && node2.children.type === 15) {
17947
+ const slot = node2.children.properties.find(
17948
+ (p) => p.key === name || p.key.content === name
17949
+ );
17950
+ return slot && slot.value;
17913
17951
  }
17914
- node.codegenNode.children = hoisted;
17952
+ }
17953
+ if (toCache.length && context.transformHoist) {
17954
+ context.transformHoist(children, context, node);
17915
17955
  }
17916
17956
  }
17917
17957
  function getConstantType(node, context) {
@@ -17929,11 +17969,10 @@ function getConstantType(node, context) {
17929
17969
  if (codegenNode.type !== 13) {
17930
17970
  return 0;
17931
17971
  }
17932
- if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
17972
+ if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
17933
17973
  return 0;
17934
17974
  }
17935
- const flag = getPatchFlag(codegenNode);
17936
- if (!flag) {
17975
+ if (codegenNode.patchFlag === void 0) {
17937
17976
  let returnType2 = 3;
17938
17977
  const generatedPropsType = getGeneratedPropsConstantType(node, context);
17939
17978
  if (generatedPropsType === 0) {
@@ -18016,6 +18055,8 @@ function getConstantType(node, context) {
18016
18055
  }
18017
18056
  }
18018
18057
  return returnType;
18058
+ case 20:
18059
+ return 2;
18019
18060
  default:
18020
18061
  return 0;
18021
18062
  }
@@ -18075,15 +18116,11 @@ function getNodeProps(node) {
18075
18116
  return codegenNode.props;
18076
18117
  }
18077
18118
  }
18078
- function getPatchFlag(node) {
18079
- const flag = node.patchFlag;
18080
- return flag ? parseInt(flag, 10) : void 0;
18081
- }
18082
18119
 
18083
18120
  function createTransformContext(root, {
18084
18121
  filename = "",
18085
18122
  prefixIdentifiers = false,
18086
- hoistStatic: hoistStatic2 = false,
18123
+ hoistStatic = false,
18087
18124
  hmr = false,
18088
18125
  cacheHandlers = false,
18089
18126
  nodeTransforms = [],
@@ -18110,7 +18147,7 @@ function createTransformContext(root, {
18110
18147
  filename,
18111
18148
  selfName: nameMatch && capitalize$1(camelize(nameMatch[1])),
18112
18149
  prefixIdentifiers,
18113
- hoistStatic: hoistStatic2,
18150
+ hoistStatic,
18114
18151
  hmr,
18115
18152
  cacheHandlers,
18116
18153
  nodeTransforms,
@@ -18137,9 +18174,9 @@ function createTransformContext(root, {
18137
18174
  directives: /* @__PURE__ */ new Set(),
18138
18175
  hoists: [],
18139
18176
  imports: [],
18177
+ cached: [],
18140
18178
  constantCache: /* @__PURE__ */ new WeakMap(),
18141
18179
  temps: 0,
18142
- cached: 0,
18143
18180
  identifiers: /* @__PURE__ */ Object.create(null),
18144
18181
  scopes: {
18145
18182
  vFor: 0,
@@ -18227,8 +18264,7 @@ function createTransformContext(root, {
18227
18264
  }
18228
18265
  },
18229
18266
  hoist(exp) {
18230
- if (isString$2(exp))
18231
- exp = createSimpleExpression(exp);
18267
+ if (isString$2(exp)) exp = createSimpleExpression(exp);
18232
18268
  context.hoists.push(exp);
18233
18269
  const identifier = createSimpleExpression(
18234
18270
  `_hoisted_${context.hoists.length}`,
@@ -18240,7 +18276,13 @@ function createTransformContext(root, {
18240
18276
  return identifier;
18241
18277
  },
18242
18278
  cache(exp, isVNode = false) {
18243
- return createCacheExpression(context.cached++, exp, isVNode);
18279
+ const cacheExp = createCacheExpression(
18280
+ context.cached.length,
18281
+ exp,
18282
+ isVNode
18283
+ );
18284
+ context.cached.push(cacheExp);
18285
+ return cacheExp;
18244
18286
  }
18245
18287
  };
18246
18288
  function addId(id) {
@@ -18259,7 +18301,7 @@ function transform(root, options) {
18259
18301
  const context = createTransformContext(root, options);
18260
18302
  traverseNode(root, context);
18261
18303
  if (options.hoistStatic) {
18262
- hoistStatic(root, context);
18304
+ cacheStatic(root, context);
18263
18305
  }
18264
18306
  if (!options.ssr) {
18265
18307
  createRootCodegen(root, context);
@@ -18299,7 +18341,7 @@ function createRootCodegen(root, context) {
18299
18341
  helper(FRAGMENT),
18300
18342
  void 0,
18301
18343
  root.children,
18302
- patchFlag + (` /* ${patchFlagText} */` ),
18344
+ patchFlag,
18303
18345
  void 0,
18304
18346
  void 0,
18305
18347
  true,
@@ -18315,8 +18357,7 @@ function traverseChildren(parent, context) {
18315
18357
  };
18316
18358
  for (; i < parent.children.length; i++) {
18317
18359
  const child = parent.children[i];
18318
- if (isString$2(child))
18319
- continue;
18360
+ if (isString$2(child)) continue;
18320
18361
  context.grandParent = context.parent;
18321
18362
  context.parent = parent;
18322
18363
  context.childIndex = i;
@@ -18387,8 +18428,7 @@ function createStructuralDirectiveTransform(name, fn) {
18387
18428
  props.splice(i, 1);
18388
18429
  i--;
18389
18430
  const onExit = fn(node, prop, context);
18390
- if (onExit)
18391
- exitFns.push(onExit);
18431
+ if (onExit) exitFns.push(onExit);
18392
18432
  }
18393
18433
  }
18394
18434
  return exitFns;
@@ -21827,8 +21867,7 @@ function createCodegenContext(ast, {
21827
21867
  }
21828
21868
  function addMapping(loc, name = null) {
21829
21869
  const { _names, _mappings } = context.map;
21830
- if (name !== null && !_names.has(name))
21831
- _names.add(name);
21870
+ if (name !== null && !_names.has(name)) _names.add(name);
21832
21871
  _mappings.add({
21833
21872
  originalLine: loc.line,
21834
21873
  originalColumn: loc.column - 1,
@@ -21848,8 +21887,7 @@ function createCodegenContext(ast, {
21848
21887
  }
21849
21888
  function generate(ast, options = {}) {
21850
21889
  const context = createCodegenContext(ast, options);
21851
- if (options.onContextCreated)
21852
- options.onContextCreated(context);
21890
+ if (options.onContextCreated) options.onContextCreated(context);
21853
21891
  const {
21854
21892
  mode,
21855
21893
  push,
@@ -21993,10 +22031,6 @@ function genModulePreamble(ast, context, genScopeId, inline) {
21993
22031
  runtimeModuleName,
21994
22032
  ssrRuntimeModuleName
21995
22033
  } = context;
21996
- if (genScopeId && ast.hoists.length) {
21997
- ast.helpers.add(PUSH_SCOPE_ID);
21998
- ast.helpers.add(POP_SCOPE_ID);
21999
- }
22000
22034
  if (ast.helpers.size) {
22001
22035
  const helpers = Array.from(ast.helpers);
22002
22036
  if (optimizeImports) {
@@ -22060,28 +22094,13 @@ function genHoists(hoists, context) {
22060
22094
  return;
22061
22095
  }
22062
22096
  context.pure = true;
22063
- const { push, newline, helper, scopeId, mode } = context;
22064
- const genScopeId = scopeId != null && mode !== "function";
22097
+ const { push, newline } = context;
22065
22098
  newline();
22066
- if (genScopeId) {
22067
- push(
22068
- `const _withScopeId = n => (${helper(
22069
- PUSH_SCOPE_ID
22070
- )}("${scopeId}"),n=n(),${helper(POP_SCOPE_ID)}(),n)`
22071
- );
22072
- newline();
22073
- }
22074
22099
  for (let i = 0; i < hoists.length; i++) {
22075
22100
  const exp = hoists[i];
22076
22101
  if (exp) {
22077
- const needScopeIdWrapper = genScopeId && exp.type === 13;
22078
- push(
22079
- `const _hoisted_${i + 1} = ${needScopeIdWrapper ? `${PURE_ANNOTATION} _withScopeId(() => ` : ``}`
22080
- );
22102
+ push(`const _hoisted_${i + 1} = `);
22081
22103
  genNode(exp, context);
22082
- if (needScopeIdWrapper) {
22083
- push(`)`);
22084
- }
22085
22104
  newline();
22086
22105
  }
22087
22106
  }
@@ -22229,8 +22248,7 @@ function genExpression(node, context) {
22229
22248
  }
22230
22249
  function genInterpolation(node, context) {
22231
22250
  const { push, helper, pure } = context;
22232
- if (pure)
22233
- push(PURE_ANNOTATION);
22251
+ if (pure) push(PURE_ANNOTATION);
22234
22252
  push(`${helper(TO_DISPLAY_STRING)}(`);
22235
22253
  genNode(node.content, context);
22236
22254
  push(`)`);
@@ -22282,6 +22300,17 @@ function genVNodeCall(node, context) {
22282
22300
  disableTracking,
22283
22301
  isComponent
22284
22302
  } = node;
22303
+ let patchFlagString;
22304
+ if (patchFlag) {
22305
+ {
22306
+ if (patchFlag < 0) {
22307
+ patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
22308
+ } else {
22309
+ const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
22310
+ patchFlagString = patchFlag + ` /* ${flagNames} */`;
22311
+ }
22312
+ }
22313
+ }
22285
22314
  if (directives) {
22286
22315
  push(helper(WITH_DIRECTIVES) + `(`);
22287
22316
  }
@@ -22294,7 +22323,7 @@ function genVNodeCall(node, context) {
22294
22323
  const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
22295
22324
  push(helper(callHelper) + `(`, -2 /* None */, node);
22296
22325
  genNodeList(
22297
- genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
22326
+ genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
22298
22327
  context
22299
22328
  );
22300
22329
  push(`)`);
@@ -22310,8 +22339,7 @@ function genVNodeCall(node, context) {
22310
22339
  function genNullableArgs(args) {
22311
22340
  let i = args.length;
22312
22341
  while (i--) {
22313
- if (args[i] != null)
22314
- break;
22342
+ if (args[i] != null) break;
22315
22343
  }
22316
22344
  return args.slice(0, i + 1).map((arg) => arg || `null`);
22317
22345
  }
@@ -22425,16 +22453,21 @@ function genConditionalExpression(node, context) {
22425
22453
  }
22426
22454
  function genCacheExpression(node, context) {
22427
22455
  const { push, helper, indent, deindent, newline } = context;
22456
+ const { needPauseTracking, needArraySpread } = node;
22457
+ if (needArraySpread) {
22458
+ push(`[...(`);
22459
+ }
22428
22460
  push(`_cache[${node.index}] || (`);
22429
- if (node.isVNode) {
22461
+ if (needPauseTracking) {
22430
22462
  indent();
22431
22463
  push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
22432
22464
  newline();
22465
+ push(`(`);
22433
22466
  }
22434
22467
  push(`_cache[${node.index}] = `);
22435
22468
  genNode(node.value, context);
22436
- if (node.isVNode) {
22437
- push(`,`);
22469
+ if (needPauseTracking) {
22470
+ push(`).cacheIndex = ${node.index},`);
22438
22471
  newline();
22439
22472
  push(`${helper(SET_BLOCK_TRACKING)}(1),`);
22440
22473
  newline();
@@ -22442,6 +22475,9 @@ function genCacheExpression(node, context) {
22442
22475
  deindent();
22443
22476
  }
22444
22477
  push(`)`);
22478
+ if (needArraySpread) {
22479
+ push(`)]`);
22480
+ }
22445
22481
  }
22446
22482
  function genTemplateLiteral(node, context) {
22447
22483
  const { push, indent, deindent } = context;
@@ -22454,11 +22490,9 @@ function genTemplateLiteral(node, context) {
22454
22490
  push(e.replace(/(`|\$|\\)/g, "\\$1"), -3 /* Unknown */);
22455
22491
  } else {
22456
22492
  push("${");
22457
- if (multilines)
22458
- indent();
22493
+ if (multilines) indent();
22459
22494
  genNode(e, context);
22460
- if (multilines)
22461
- deindent();
22495
+ if (multilines) deindent();
22462
22496
  push("}");
22463
22497
  }
22464
22498
  }
@@ -22659,7 +22693,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
22659
22693
  node2.name = rewriteIdentifier(node2.name, parent, node2);
22660
22694
  ids.push(node2);
22661
22695
  } else {
22662
- if (!(needPrefix && isLocal) && parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "MemberExpression") {
22696
+ if (!(needPrefix && isLocal) && (!parent || parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "MemberExpression")) {
22663
22697
  node2.isConstant = true;
22664
22698
  }
22665
22699
  ids.push(node2);
@@ -22829,8 +22863,7 @@ function processIf(node, dir, context, processCodegen) {
22829
22863
  sibling.branches.push(branch);
22830
22864
  const onExit = processCodegen && processCodegen(sibling, branch, false);
22831
22865
  traverseNode(branch, context);
22832
- if (onExit)
22833
- onExit();
22866
+ if (onExit) onExit();
22834
22867
  context.currentNode = null;
22835
22868
  } else {
22836
22869
  context.onError(
@@ -22899,7 +22932,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
22899
22932
  helper(FRAGMENT),
22900
22933
  createObjectExpression([keyProperty]),
22901
22934
  children,
22902
- patchFlag + (` /* ${patchFlagText} */` ),
22935
+ patchFlag,
22903
22936
  void 0,
22904
22937
  void 0,
22905
22938
  true,
@@ -22952,6 +22985,90 @@ function getParentCondition(node) {
22952
22985
  }
22953
22986
  }
22954
22987
 
22988
+ const transformBind = (dir, _node, context) => {
22989
+ const { modifiers, loc } = dir;
22990
+ const arg = dir.arg;
22991
+ let { exp } = dir;
22992
+ if (exp && exp.type === 4 && !exp.content.trim()) {
22993
+ {
22994
+ context.onError(
22995
+ createCompilerError(34, loc)
22996
+ );
22997
+ return {
22998
+ props: [
22999
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
23000
+ ]
23001
+ };
23002
+ }
23003
+ }
23004
+ if (!exp) {
23005
+ if (arg.type !== 4 || !arg.isStatic) {
23006
+ context.onError(
23007
+ createCompilerError(
23008
+ 52,
23009
+ arg.loc
23010
+ )
23011
+ );
23012
+ return {
23013
+ props: [
23014
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
23015
+ ]
23016
+ };
23017
+ }
23018
+ transformBindShorthand(dir, context);
23019
+ exp = dir.exp;
23020
+ }
23021
+ if (arg.type !== 4) {
23022
+ arg.children.unshift(`(`);
23023
+ arg.children.push(`) || ""`);
23024
+ } else if (!arg.isStatic) {
23025
+ arg.content = `${arg.content} || ""`;
23026
+ }
23027
+ if (modifiers.includes("camel")) {
23028
+ if (arg.type === 4) {
23029
+ if (arg.isStatic) {
23030
+ arg.content = camelize(arg.content);
23031
+ } else {
23032
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
23033
+ }
23034
+ } else {
23035
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
23036
+ arg.children.push(`)`);
23037
+ }
23038
+ }
23039
+ if (!context.inSSR) {
23040
+ if (modifiers.includes("prop")) {
23041
+ injectPrefix(arg, ".");
23042
+ }
23043
+ if (modifiers.includes("attr")) {
23044
+ injectPrefix(arg, "^");
23045
+ }
23046
+ }
23047
+ return {
23048
+ props: [createObjectProperty(arg, exp)]
23049
+ };
23050
+ };
23051
+ const transformBindShorthand = (dir, context) => {
23052
+ const arg = dir.arg;
23053
+ const propName = camelize(arg.content);
23054
+ dir.exp = createSimpleExpression(propName, false, arg.loc);
23055
+ {
23056
+ dir.exp = processExpression(dir.exp, context);
23057
+ }
23058
+ };
23059
+ const injectPrefix = (arg, prefix) => {
23060
+ if (arg.type === 4) {
23061
+ if (arg.isStatic) {
23062
+ arg.content = prefix + arg.content;
23063
+ } else {
23064
+ arg.content = `\`${prefix}\${${arg.content}}\``;
23065
+ }
23066
+ } else {
23067
+ arg.children.unshift(`'${prefix}' + (`);
23068
+ arg.children.push(`)`);
23069
+ }
23070
+ };
23071
+
22955
23072
  const transformFor = createStructuralDirectiveTransform(
22956
23073
  "for",
22957
23074
  (node, dir, context) => {
@@ -22962,9 +23079,12 @@ const transformFor = createStructuralDirectiveTransform(
22962
23079
  ]);
22963
23080
  const isTemplate = isTemplateNode(node);
22964
23081
  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;
23082
+ const keyProp = findProp(node, `key`, false, true);
23083
+ if (keyProp && keyProp.type === 7 && !keyProp.exp) {
23084
+ transformBindShorthand(keyProp, context);
23085
+ }
23086
+ const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
23087
+ const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
22968
23088
  if (isTemplate) {
22969
23089
  if (memo) {
22970
23090
  memo.exp = processExpression(
@@ -22986,7 +23106,7 @@ const transformFor = createStructuralDirectiveTransform(
22986
23106
  helper(FRAGMENT),
22987
23107
  void 0,
22988
23108
  renderExp,
22989
- fragmentFlag + (` /* ${PatchFlagNames[fragmentFlag]} */` ),
23109
+ fragmentFlag,
22990
23110
  void 0,
22991
23111
  void 0,
22992
23112
  true,
@@ -23026,7 +23146,7 @@ const transformFor = createStructuralDirectiveTransform(
23026
23146
  helper(FRAGMENT),
23027
23147
  keyProperty ? createObjectExpression([keyProperty]) : void 0,
23028
23148
  node.children,
23029
- 64 + (` /* ${PatchFlagNames[64]} */` ),
23149
+ 64,
23030
23150
  void 0,
23031
23151
  void 0,
23032
23152
  true,
@@ -23080,8 +23200,9 @@ const transformFor = createStructuralDirectiveTransform(
23080
23200
  renderExp.arguments.push(
23081
23201
  loop,
23082
23202
  createSimpleExpression(`_cache`),
23083
- createSimpleExpression(String(context.cached++))
23203
+ createSimpleExpression(String(context.cached.length))
23084
23204
  );
23205
+ context.cached.push(null);
23085
23206
  } else {
23086
23207
  renderExp.arguments.push(
23087
23208
  createFunctionExpression(
@@ -23137,13 +23258,11 @@ function processFor(node, dir, context, processCodegen) {
23137
23258
  key && removeIdentifiers(key);
23138
23259
  index && removeIdentifiers(index);
23139
23260
  }
23140
- if (onExit)
23141
- onExit();
23261
+ if (onExit) onExit();
23142
23262
  };
23143
23263
  }
23144
23264
  function finalizeForParseResult(result, context) {
23145
- if (result.finalized)
23146
- return;
23265
+ if (result.finalized) return;
23147
23266
  if (context.prefixIdentifiers) {
23148
23267
  result.source = processExpression(
23149
23268
  result.source,
@@ -23179,8 +23298,7 @@ function createForLoopParams({ value, key, index }, memoArgs = []) {
23179
23298
  function createParamsList(args) {
23180
23299
  let i = args.length;
23181
23300
  while (i--) {
23182
- if (args[i])
23183
- break;
23301
+ if (args[i]) break;
23184
23302
  }
23185
23303
  return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
23186
23304
  }
@@ -23312,9 +23430,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
23312
23430
  break;
23313
23431
  }
23314
23432
  }
23315
- if (prev && isTemplateNode(prev) && findDir(prev, "if")) {
23316
- children.splice(i, 1);
23317
- i--;
23433
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
23318
23434
  let conditional = dynamicSlots[dynamicSlots.length - 1];
23319
23435
  while (conditional.alternate.type === 19) {
23320
23436
  conditional = conditional.alternate;
@@ -23448,13 +23564,11 @@ function hasForwardedSlots(children) {
23448
23564
  }
23449
23565
  break;
23450
23566
  case 9:
23451
- if (hasForwardedSlots(child.branches))
23452
- return true;
23567
+ if (hasForwardedSlots(child.branches)) return true;
23453
23568
  break;
23454
23569
  case 10:
23455
23570
  case 11:
23456
- if (hasForwardedSlots(child.children))
23457
- return true;
23571
+ if (hasForwardedSlots(child.children)) return true;
23458
23572
  break;
23459
23573
  }
23460
23574
  }
@@ -23479,7 +23593,6 @@ const transformElement = (node, context) => {
23479
23593
  const isDynamicComponent = isObject$2(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
23480
23594
  let vnodeProps;
23481
23595
  let vnodeChildren;
23482
- let vnodePatchFlag;
23483
23596
  let patchFlag = 0;
23484
23597
  let vnodeDynamicProps;
23485
23598
  let dynamicPropNames;
@@ -23490,7 +23603,7 @@ const transformElement = (node, context) => {
23490
23603
  // updates inside get proper isSVG flag at runtime. (#639, #643)
23491
23604
  // This is technically web-specific, but splitting the logic out of core
23492
23605
  // leads to too much unnecessary complexity.
23493
- (tag === "svg" || tag === "foreignObject")
23606
+ (tag === "svg" || tag === "foreignObject" || tag === "math")
23494
23607
  );
23495
23608
  if (props.length > 0) {
23496
23609
  const propsBuildResult = buildProps(
@@ -23550,25 +23663,15 @@ const transformElement = (node, context) => {
23550
23663
  vnodeChildren = node.children;
23551
23664
  }
23552
23665
  }
23553
- if (patchFlag !== 0) {
23554
- {
23555
- if (patchFlag < 0) {
23556
- vnodePatchFlag = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
23557
- } else {
23558
- const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
23559
- vnodePatchFlag = patchFlag + ` /* ${flagNames} */`;
23560
- }
23561
- }
23562
- if (dynamicPropNames && dynamicPropNames.length) {
23563
- vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
23564
- }
23666
+ if (dynamicPropNames && dynamicPropNames.length) {
23667
+ vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
23565
23668
  }
23566
23669
  node.codegenNode = createVNodeCall(
23567
23670
  context,
23568
23671
  vnodeTag,
23569
23672
  vnodeProps,
23570
23673
  vnodeChildren,
23571
- vnodePatchFlag,
23674
+ patchFlag === 0 ? void 0 : patchFlag,
23572
23675
  vnodeDynamicProps,
23573
23676
  vnodeDirectives,
23574
23677
  !!shouldUseBlock,
@@ -23613,8 +23716,7 @@ function resolveComponentType(node, context, ssr = false) {
23613
23716
  }
23614
23717
  const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
23615
23718
  if (builtIn) {
23616
- if (!ssr)
23617
- context.helper(builtIn);
23719
+ if (!ssr) context.helper(builtIn);
23618
23720
  return builtIn;
23619
23721
  }
23620
23722
  {
@@ -23698,8 +23800,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
23698
23800
  );
23699
23801
  properties = [];
23700
23802
  }
23701
- if (arg)
23702
- mergeArgs.push(arg);
23803
+ if (arg) mergeArgs.push(arg);
23703
23804
  };
23704
23805
  const pushRefVForMarker = () => {
23705
23806
  if (context.scopes.vFor > 0) {
@@ -24015,8 +24116,7 @@ function buildDirectiveArgs(dir, context) {
24015
24116
  }
24016
24117
  }
24017
24118
  const { loc } = dir;
24018
- if (dir.exp)
24019
- dirArgs.push(dir.exp);
24119
+ if (dir.exp) dirArgs.push(dir.exp);
24020
24120
  if (dir.arg) {
24021
24121
  if (!dir.exp) {
24022
24122
  dirArgs.push(`void 0`);
@@ -24046,8 +24146,7 @@ function stringifyDynamicPropNames(props) {
24046
24146
  let propsNamesString = `[`;
24047
24147
  for (let i = 0, l = props.length; i < l; i++) {
24048
24148
  propsNamesString += JSON.stringify(props[i]);
24049
- if (i < l - 1)
24050
- propsNamesString += ", ";
24149
+ if (i < l - 1) propsNamesString += ", ";
24051
24150
  }
24052
24151
  return propsNamesString + `]`;
24053
24152
  }
@@ -24144,7 +24243,7 @@ function processSlotOutlet(node, context) {
24144
24243
  };
24145
24244
  }
24146
24245
 
24147
- const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
24246
+ const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
24148
24247
  const transformOn$1 = (dir, node, context, augmentor) => {
24149
24248
  const { loc, modifiers, arg } = dir;
24150
24249
  if (!dir.exp && !modifiers.length) {
@@ -24247,85 +24346,6 @@ const transformOn$1 = (dir, node, context, augmentor) => {
24247
24346
  return ret;
24248
24347
  };
24249
24348
 
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
24349
  const transformText = (node, context) => {
24330
24350
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
24331
24351
  return () => {
@@ -24524,8 +24544,9 @@ const transformMemo = (node, context) => {
24524
24544
  dir.exp,
24525
24545
  createFunctionExpression(void 0, codegenNode),
24526
24546
  `_cache`,
24527
- String(context.cached++)
24547
+ String(context.cached.length)
24528
24548
  ]);
24549
+ context.cached.push(null);
24529
24550
  }
24530
24551
  };
24531
24552
  }
@@ -24944,8 +24965,7 @@ const transformClick = (key, event) => {
24944
24965
  const transformOn = (dir, node, context) => {
24945
24966
  return transformOn$1(dir, node, context, (baseResult) => {
24946
24967
  const { modifiers } = dir;
24947
- if (!modifiers.length)
24948
- return baseResult;
24968
+ if (!modifiers.length) return baseResult;
24949
24969
  let { key, value: handlerExp } = baseResult.props[0];
24950
24970
  const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
24951
24971
  if (nonKeyModifiers.includes("right")) {
@@ -25041,6 +25061,7 @@ const stringifyStatic = (children, context, parent) => {
25041
25061
  if (context.scopes.vSlot > 0) {
25042
25062
  return;
25043
25063
  }
25064
+ const isParentCached = parent.type === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !isArray$3(parent.codegenNode.children) && parent.codegenNode.children.type === 20;
25044
25065
  let nc = 0;
25045
25066
  let ec = 0;
25046
25067
  const currentChunk = [];
@@ -25054,14 +25075,25 @@ const stringifyStatic = (children, context, parent) => {
25054
25075
  // will insert / hydrate
25055
25076
  String(currentChunk.length)
25056
25077
  ]);
25057
- replaceHoist(currentChunk[0], staticCall, context);
25058
- if (currentChunk.length > 1) {
25059
- for (let i2 = 1; i2 < currentChunk.length; i2++) {
25060
- replaceHoist(currentChunk[i2], null, context);
25078
+ if (isParentCached) {
25079
+ parent.codegenNode.children.value = createArrayExpression([staticCall]);
25080
+ } else {
25081
+ currentChunk[0].codegenNode.value = staticCall;
25082
+ if (currentChunk.length > 1) {
25083
+ const deleteCount = currentChunk.length - 1;
25084
+ children.splice(currentIndex - currentChunk.length + 1, deleteCount);
25085
+ const cacheIndex = context.cached.indexOf(
25086
+ currentChunk[currentChunk.length - 1].codegenNode
25087
+ );
25088
+ if (cacheIndex > -1) {
25089
+ for (let i2 = cacheIndex; i2 < context.cached.length; i2++) {
25090
+ const c = context.cached[i2];
25091
+ if (c) c.index -= deleteCount;
25092
+ }
25093
+ context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
25094
+ }
25095
+ return deleteCount;
25061
25096
  }
25062
- const deleteCount = currentChunk.length - 1;
25063
- children.splice(currentIndex - currentChunk.length + 1, deleteCount);
25064
- return deleteCount;
25065
25097
  }
25066
25098
  }
25067
25099
  return 0;
@@ -25069,14 +25101,13 @@ const stringifyStatic = (children, context, parent) => {
25069
25101
  let i = 0;
25070
25102
  for (; i < children.length; i++) {
25071
25103
  const child = children[i];
25072
- const hoisted = getHoistedNode(child);
25073
- if (hoisted) {
25074
- const node = child;
25075
- const result = analyzeNode(node);
25104
+ const isCached = isParentCached || getCachedNode(child);
25105
+ if (isCached) {
25106
+ const result = analyzeNode(child);
25076
25107
  if (result) {
25077
25108
  nc += result[0];
25078
25109
  ec += result[1];
25079
- currentChunk.push(node);
25110
+ currentChunk.push(child);
25080
25111
  continue;
25081
25112
  }
25082
25113
  }
@@ -25087,15 +25118,15 @@ const stringifyStatic = (children, context, parent) => {
25087
25118
  }
25088
25119
  stringifyCurrentChunk(i);
25089
25120
  };
25090
- const getHoistedNode = (node) => (node.type === 1 && node.tagType === 0 || node.type == 12) && node.codegenNode && node.codegenNode.type === 4 && node.codegenNode.hoisted;
25121
+ const getCachedNode = (node) => {
25122
+ if ((node.type === 1 && node.tagType === 0 || node.type === 12) && node.codegenNode && node.codegenNode.type === 20) {
25123
+ return node.codegenNode;
25124
+ }
25125
+ };
25091
25126
  const dataAriaRE = /^(data|aria)-/;
25092
25127
  const isStringifiableAttr = (name, ns) => {
25093
25128
  return (ns === 0 ? isKnownHtmlAttr(name) : ns === 1 ? isKnownSvgAttr(name) : false) || dataAriaRE.test(name);
25094
25129
  };
25095
- const replaceHoist = (node, replacement, context) => {
25096
- const hoistToReplace = node.codegenNode.hoisted;
25097
- context.hoists[context.hoists.indexOf(hoistToReplace)] = replacement;
25098
- };
25099
25130
  const isNonStringifiable = /* @__PURE__ */ makeMap(
25100
25131
  `caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
25101
25132
  );
@@ -25114,6 +25145,7 @@ function analyzeNode(node) {
25114
25145
  return false;
25115
25146
  };
25116
25147
  function walk(node2) {
25148
+ const isOptionTag = node2.tag === "option" && node2.ns === 0;
25117
25149
  for (let i = 0; i < node2.props.length; i++) {
25118
25150
  const p = node2.props[i];
25119
25151
  if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
@@ -25126,6 +25158,9 @@ function analyzeNode(node) {
25126
25158
  if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
25127
25159
  return bail();
25128
25160
  }
25161
+ if (isOptionTag && isStaticArgOf(p.arg, "value") && p.exp && p.exp.ast && p.exp.ast.type !== "StringLiteral") {
25162
+ return bail();
25163
+ }
25129
25164
  }
25130
25165
  }
25131
25166
  for (let i = 0; i < node2.children.length; i++) {
@@ -25267,12 +25302,10 @@ function isValidHTMLNesting(parent, child) {
25267
25302
  return onlyValidParents[child].has(parent);
25268
25303
  }
25269
25304
  if (parent in knownInvalidChildren) {
25270
- if (knownInvalidChildren[parent].has(child))
25271
- return false;
25305
+ if (knownInvalidChildren[parent].has(child)) return false;
25272
25306
  }
25273
25307
  if (child in knownInvalidParents) {
25274
- if (knownInvalidParents[child].has(parent))
25275
- return false;
25308
+ if (knownInvalidParents[child].has(parent)) return false;
25276
25309
  }
25277
25310
  return true;
25278
25311
  }
@@ -25886,8 +25919,7 @@ function resolveObjectKey(node, computed) {
25886
25919
  case "NumericLiteral":
25887
25920
  return String(node.value);
25888
25921
  case "Identifier":
25889
- if (!computed)
25890
- return node.name;
25922
+ if (!computed) return node.name;
25891
25923
  }
25892
25924
  return void 0;
25893
25925
  }
@@ -25906,8 +25938,7 @@ function toRuntimeTypeString(types) {
25906
25938
  function getImportedName(specifier) {
25907
25939
  if (specifier.type === "ImportSpecifier")
25908
25940
  return specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
25909
- else if (specifier.type === "ImportNamespaceSpecifier")
25910
- return "*";
25941
+ else if (specifier.type === "ImportNamespaceSpecifier") return "*";
25911
25942
  return "default";
25912
25943
  }
25913
25944
  function getId(node) {
@@ -26274,8 +26305,8 @@ Item.prototype.run = function () {
26274
26305
  var title = 'browser';
26275
26306
  var platform = 'browser';
26276
26307
  var browser = true;
26277
- var env = {};
26278
- var argv = [];
26308
+ var env$1 = {};
26309
+ var argv$1 = [];
26279
26310
  var version$1 = ''; // empty string to avoid regexp issues
26280
26311
  var versions = {};
26281
26312
  var release = {};
@@ -26338,8 +26369,8 @@ var browser$1 = {
26338
26369
  nextTick: nextTick,
26339
26370
  title: title,
26340
26371
  browser: browser,
26341
- env: env,
26342
- argv: argv,
26372
+ env: env$1,
26373
+ argv: argv$1,
26343
26374
  version: version$1,
26344
26375
  versions: versions,
26345
26376
  on: on,
@@ -26383,8 +26414,7 @@ function resolveTemplateUsedIdentifiers(sfc) {
26383
26414
  switch (node.type) {
26384
26415
  case 1:
26385
26416
  let tag = node.tag;
26386
- if (tag.includes("."))
26387
- tag = tag.split(".")[0].trim();
26417
+ if (tag.includes(".")) tag = tag.split(".")[0].trim();
26388
26418
  if (!parserOptions.isNativeTag(tag) && !parserOptions.isBuiltInComponent(tag)) {
26389
26419
  ids.add(camelize(tag));
26390
26420
  ids.add(capitalize$1(camelize(tag)));
@@ -30801,11 +30831,9 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
30801
30831
  if (srcsetTags.includes(node.tag) && node.props.length) {
30802
30832
  node.props.forEach((attr, index) => {
30803
30833
  if (attr.name === "srcset" && attr.type === 6) {
30804
- if (!attr.value)
30805
- return;
30834
+ if (!attr.value) return;
30806
30835
  const value = attr.value.content;
30807
- if (!value)
30808
- return;
30836
+ if (!value) return;
30809
30837
  const imageCandidates = value.split(",").map((s) => {
30810
30838
  const [url, descriptor] = s.replace(escapedSpaceCharacters, " ").trim().split(" ", 2);
30811
30839
  return { url, descriptor };
@@ -32159,8 +32187,7 @@ const ssrInjectFallthroughAttrs = (node, context) => {
32159
32187
  let hasEncounteredIf = false;
32160
32188
  for (const c of filterChild(parent)) {
32161
32189
  if (c.type === 9 || c.type === 1 && findDir(c, "if")) {
32162
- if (hasEncounteredIf)
32163
- return;
32190
+ if (hasEncounteredIf) return;
32164
32191
  hasEncounteredIf = true;
32165
32192
  } else if (
32166
32193
  // node before v-if
@@ -32302,6 +32329,10 @@ var CompilerSSR = /*#__PURE__*/Object.freeze({
32302
32329
  compile: compile
32303
32330
  });
32304
32331
 
32332
+ function commonjsRequire(path) {
32333
+ 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.');
32334
+ }
32335
+
32305
32336
  var _polyfillNode_fs = {};
32306
32337
 
32307
32338
  var _polyfillNode_fs$1 = /*#__PURE__*/Object.freeze({
@@ -32356,13 +32387,11 @@ function preprocess$1({ source, filename, preprocessOptions }, preprocessor) {
32356
32387
  source,
32357
32388
  __spreadValues$6({ filename }, preprocessOptions),
32358
32389
  (_err, _res) => {
32359
- if (_err)
32360
- err = _err;
32390
+ if (_err) err = _err;
32361
32391
  res = _res;
32362
32392
  }
32363
32393
  );
32364
- if (err)
32365
- throw err;
32394
+ if (err) throw err;
32366
32395
  return res;
32367
32396
  }
32368
32397
  function compileTemplate(options) {
@@ -32432,11 +32461,11 @@ function doCompileTemplate({
32432
32461
  }
32433
32462
  if (ssr && !ssrCssVars) {
32434
32463
  warnOnce$3(
32435
- `compileTemplate is called with \`ssr: true\` but no corresponding \`cssVars\` option.\`.`
32464
+ `compileTemplate is called with \`ssr: true\` but no corresponding \`cssVars\` option.`
32436
32465
  );
32437
32466
  }
32438
32467
  if (!id) {
32439
- warnOnce$3(`compileTemplate now requires the \`id\` option.\`.`);
32468
+ warnOnce$3(`compileTemplate now requires the \`id\` option.`);
32440
32469
  id = "";
32441
32470
  }
32442
32471
  const shortId = id.replace(/^data-v-/, "");
@@ -32497,10 +32526,8 @@ ${generateCodeFrame(
32497
32526
  return { code, ast, preamble, source, errors, tips, map };
32498
32527
  }
32499
32528
  function mapLines(oldMap, newMap) {
32500
- if (!oldMap)
32501
- return newMap;
32502
- if (!newMap)
32503
- return oldMap;
32529
+ if (!oldMap) return newMap;
32530
+ if (!newMap) return oldMap;
32504
32531
  const oldMapConsumer = new SourceMapConsumer$5(oldMap);
32505
32532
  const newMapConsumer = new SourceMapConsumer$5(newMap);
32506
32533
  const mergedMapGenerator = new SourceMapGenerator$6();
@@ -32592,15 +32619,15 @@ var _polyfillNode_tty$1 = /*#__PURE__*/Object.freeze({
32592
32619
 
32593
32620
  var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_tty$1);
32594
32621
 
32595
- let tty = require$$0;
32596
-
32622
+ let argv = browser$1.argv || [],
32623
+ env = ({});
32597
32624
  let isColorSupported =
32598
- !("NO_COLOR" in ({}) || browser$1.argv.includes("--no-color")) &&
32599
- ("FORCE_COLOR" in ({}) ||
32600
- browser$1.argv.includes("--color") ||
32625
+ !("NO_COLOR" in env || argv.includes("--no-color")) &&
32626
+ ("FORCE_COLOR" in env ||
32627
+ argv.includes("--color") ||
32601
32628
  "" === "win32" ||
32602
- (tty.isatty(1) && browser$1.env.TERM !== "dumb") ||
32603
- "CI" in ({}));
32629
+ (commonjsRequire != null && require$$0.isatty(1) && env.TERM !== "dumb") ||
32630
+ "CI" in env);
32604
32631
 
32605
32632
  let formatter =
32606
32633
  (open, close, replace = open) =>
@@ -32613,40 +32640,47 @@ let formatter =
32613
32640
  };
32614
32641
 
32615
32642
  let replaceClose = (string, close, replace, index) => {
32616
- let start = string.substring(0, index) + replace;
32617
- let end = string.substring(index + close.length);
32618
- let nextIndex = end.indexOf(close);
32619
- return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
32620
- };
32621
-
32622
- let createColors = (enabled = isColorSupported) => ({
32623
- isColorSupported: enabled,
32624
- reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
32625
- bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
32626
- dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
32627
- italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
32628
- underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
32629
- inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
32630
- hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
32631
- strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
32632
- black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
32633
- red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
32634
- green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
32635
- yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
32636
- blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
32637
- magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
32638
- cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
32639
- white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
32640
- gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
32641
- bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
32642
- bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
32643
- bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
32644
- bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
32645
- bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
32646
- bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
32647
- bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
32648
- bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
32649
- });
32643
+ let result = "";
32644
+ let cursor = 0;
32645
+ do {
32646
+ result += string.substring(cursor, index) + replace;
32647
+ cursor = index + close.length;
32648
+ index = string.indexOf(close, cursor);
32649
+ } while (~index)
32650
+ return result + string.substring(cursor)
32651
+ };
32652
+
32653
+ let createColors = (enabled = isColorSupported) => {
32654
+ let init = enabled ? formatter : () => String;
32655
+ return {
32656
+ isColorSupported: enabled,
32657
+ reset: init("\x1b[0m", "\x1b[0m"),
32658
+ bold: init("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
32659
+ dim: init("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
32660
+ italic: init("\x1b[3m", "\x1b[23m"),
32661
+ underline: init("\x1b[4m", "\x1b[24m"),
32662
+ inverse: init("\x1b[7m", "\x1b[27m"),
32663
+ hidden: init("\x1b[8m", "\x1b[28m"),
32664
+ strikethrough: init("\x1b[9m", "\x1b[29m"),
32665
+ black: init("\x1b[30m", "\x1b[39m"),
32666
+ red: init("\x1b[31m", "\x1b[39m"),
32667
+ green: init("\x1b[32m", "\x1b[39m"),
32668
+ yellow: init("\x1b[33m", "\x1b[39m"),
32669
+ blue: init("\x1b[34m", "\x1b[39m"),
32670
+ magenta: init("\x1b[35m", "\x1b[39m"),
32671
+ cyan: init("\x1b[36m", "\x1b[39m"),
32672
+ white: init("\x1b[37m", "\x1b[39m"),
32673
+ gray: init("\x1b[90m", "\x1b[39m"),
32674
+ bgBlack: init("\x1b[40m", "\x1b[49m"),
32675
+ bgRed: init("\x1b[41m", "\x1b[49m"),
32676
+ bgGreen: init("\x1b[42m", "\x1b[49m"),
32677
+ bgYellow: init("\x1b[43m", "\x1b[49m"),
32678
+ bgBlue: init("\x1b[44m", "\x1b[49m"),
32679
+ bgMagenta: init("\x1b[45m", "\x1b[49m"),
32680
+ bgCyan: init("\x1b[46m", "\x1b[49m"),
32681
+ bgWhite: init("\x1b[47m", "\x1b[49m"),
32682
+ }
32683
+ };
32650
32684
 
32651
32685
  picocolors.exports = createColors();
32652
32686
  picocolors.exports.createColors = createColors;
@@ -36718,7 +36752,7 @@ let Root$2 = root$2;
36718
36752
 
36719
36753
  let Processor$1 = class Processor {
36720
36754
  constructor(plugins = []) {
36721
- this.version = '8.4.38';
36755
+ this.version = '8.4.39';
36722
36756
  this.plugins = this.normalize(plugins);
36723
36757
  }
36724
36758
 
@@ -36965,10 +36999,8 @@ const trimPlugin = () => {
36965
36999
  Once(root) {
36966
37000
  root.walk(({ type, raws }) => {
36967
37001
  if (type === "rule" || type === "atrule") {
36968
- if (raws.before)
36969
- raws.before = "\n";
36970
- if ("after" in raws && raws.after)
36971
- raws.after = "\n";
37002
+ if (raws.before) raws.before = "\n";
37003
+ if ("after" in raws && raws.after) raws.after = "\n";
36972
37004
  }
36973
37005
  });
36974
37006
  }
@@ -39151,7 +39183,8 @@ tokenTypes.combinator = combinator$1;
39151
39183
  line: 1,
39152
39184
  column: 1
39153
39185
  }
39154
- }
39186
+ },
39187
+ sourceIndex: 0
39155
39188
  });
39156
39189
  this.root.append(selector);
39157
39190
  this.current = selector;
@@ -39610,7 +39643,8 @@ tokenTypes.combinator = combinator$1;
39610
39643
  var selector = new _selector["default"]({
39611
39644
  source: {
39612
39645
  start: tokenStart(this.tokens[this.position + 1])
39613
- }
39646
+ },
39647
+ sourceIndex: this.tokens[this.position + 1][_tokenize.FIELDS.START_POS]
39614
39648
  });
39615
39649
  this.current.parent.append(selector);
39616
39650
  this.current = selector;
@@ -39679,8 +39713,9 @@ tokenTypes.combinator = combinator$1;
39679
39713
  if (last && last.type === types$1.PSEUDO) {
39680
39714
  var selector = new _selector["default"]({
39681
39715
  source: {
39682
- start: tokenStart(this.tokens[this.position - 1])
39683
- }
39716
+ start: tokenStart(this.tokens[this.position])
39717
+ },
39718
+ sourceIndex: this.tokens[this.position][_tokenize.FIELDS.START_POS]
39684
39719
  });
39685
39720
  var cache = this.current;
39686
39721
  last.append(selector);
@@ -40528,8 +40563,7 @@ function rewriteSelector(id, selector, selectorRoot, slotted = false) {
40528
40563
  return false;
40529
40564
  }
40530
40565
  }
40531
- if (node)
40532
- return;
40566
+ if (node) return;
40533
40567
  }
40534
40568
  if (n.type !== "pseudo" && n.type !== "combinator" || n.type === "pseudo" && (n.value === ":is" || n.value === ":where") && !node) {
40535
40569
  node = n;
@@ -43859,8 +43893,7 @@ const less = (source, map, options, load = require) => {
43859
43893
  result = output;
43860
43894
  }
43861
43895
  );
43862
- if (error)
43863
- return { code: "", errors: [error], dependencies: [] };
43896
+ if (error) return { code: "", errors: [error], dependencies: [] };
43864
43897
  const dependencies = result.imports;
43865
43898
  if (map) {
43866
43899
  return {
@@ -43880,8 +43913,7 @@ const styl = (source, map, options, load = require) => {
43880
43913
  const nodeStylus = load("stylus");
43881
43914
  try {
43882
43915
  const ref = nodeStylus(source, options);
43883
- if (map)
43884
- ref.set("sourcemap", { inline: false, comment: false });
43916
+ if (map) ref.set("sourcemap", { inline: false, comment: false });
43885
43917
  const result = ref.render();
43886
43918
  const dependencies = ref.deps();
43887
43919
  if (map) {
@@ -43898,8 +43930,7 @@ const styl = (source, map, options, load = require) => {
43898
43930
  }
43899
43931
  };
43900
43932
  function getSource(source, filename, additionalData) {
43901
- if (!additionalData)
43902
- return source;
43933
+ if (!additionalData) return source;
43903
43934
  if (isFunction$1(additionalData)) {
43904
43935
  return additionalData(source, filename);
43905
43936
  }
@@ -44099,11 +44130,9 @@ function analyzeBindingsFromOptions(node) {
44099
44130
  function getObjectExpressionKeys(node) {
44100
44131
  const keys = [];
44101
44132
  for (const prop of node.properties) {
44102
- if (prop.type === "SpreadElement")
44103
- continue;
44133
+ if (prop.type === "SpreadElement") continue;
44104
44134
  const key = resolveObjectKey(prop.key, prop.computed);
44105
- if (key)
44106
- keys.push(String(key));
44135
+ if (key) keys.push(String(key));
44107
44136
  }
44108
44137
  return keys;
44109
44138
  }
@@ -45551,12 +45580,12 @@ function resolveParserPlugins(lang, userPlugins, dts = false) {
45551
45580
  )) {
45552
45581
  plugins.push("importAttributes");
45553
45582
  }
45554
- if (lang === "jsx" || lang === "tsx") {
45583
+ if (lang === "jsx" || lang === "tsx" || lang === "mtsx") {
45555
45584
  plugins.push("jsx");
45556
45585
  } else if (userPlugins) {
45557
45586
  userPlugins = userPlugins.filter((p) => p !== "jsx");
45558
45587
  }
45559
- if (lang === "ts" || lang === "tsx") {
45588
+ if (lang === "ts" || lang === "mts" || lang === "tsx" || lang === "mtsx") {
45560
45589
  plugins.push(["typescript", { dts }], "explicitResourceManagement");
45561
45590
  if (!userPlugins || !userPlugins.includes("decorators")) {
45562
45591
  plugins.push("decorators-legacy");
@@ -45771,12 +45800,16 @@ function resolveTypeElements(ctx, node, scope, typeParameters) {
45771
45800
  }
45772
45801
  function innerResolveTypeElements(ctx, node, scope, typeParameters) {
45773
45802
  var _a, _b;
45803
+ if (node.leadingComments && node.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
45804
+ return { props: {} };
45805
+ }
45774
45806
  switch (node.type) {
45775
45807
  case "TSTypeLiteral":
45776
45808
  return typeElementsToMap(ctx, node.members, scope, typeParameters);
45777
45809
  case "TSInterfaceDeclaration":
45778
45810
  return resolveInterfaceMembers(ctx, node, scope, typeParameters);
45779
45811
  case "TSTypeAliasDeclaration":
45812
+ case "TSTypeAnnotation":
45780
45813
  case "TSParenthesizedType":
45781
45814
  return resolveTypeElements(
45782
45815
  ctx,
@@ -45794,7 +45827,7 @@ function innerResolveTypeElements(ctx, node, scope, typeParameters) {
45794
45827
  node.type
45795
45828
  );
45796
45829
  case "TSMappedType":
45797
- return resolveMappedType(ctx, node, scope);
45830
+ return resolveMappedType(ctx, node, scope, typeParameters);
45798
45831
  case "TSIndexedAccessType": {
45799
45832
  const types = resolveIndexType(ctx, node, scope);
45800
45833
  return mergeElements(
@@ -45823,8 +45856,7 @@ function innerResolveTypeElements(ctx, node, scope, typeParameters) {
45823
45856
  typeParams = /* @__PURE__ */ Object.create(null);
45824
45857
  resolved.typeParameters.params.forEach((p, i) => {
45825
45858
  let param = typeParameters && typeParameters[p.name];
45826
- if (!param)
45827
- param = node.typeParameters.params[i];
45859
+ if (!param) param = node.typeParameters.params[i];
45828
45860
  typeParams[p.name] = param;
45829
45861
  });
45830
45862
  }
@@ -45934,8 +45966,7 @@ function typeElementsToMap(ctx, elements, scope = ctxToScope(ctx), typeParameter
45934
45966
  return res;
45935
45967
  }
45936
45968
  function mergeElements(maps, type) {
45937
- if (maps.length === 1)
45938
- return maps[0];
45969
+ if (maps.length === 1) return maps[0];
45939
45970
  const res = { props: {} };
45940
45971
  const { props: baseProps } = res;
45941
45972
  for (const { props, calls } of maps) {
@@ -45983,9 +46014,6 @@ function resolveInterfaceMembers(ctx, node, scope, typeParameters) {
45983
46014
  );
45984
46015
  if (node.extends) {
45985
46016
  for (const ext of node.extends) {
45986
- if (ext.leadingComments && ext.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
45987
- continue;
45988
- }
45989
46017
  try {
45990
46018
  const { props, calls } = resolveTypeElements(ctx, ext, scope);
45991
46019
  for (const key in props) {
@@ -46005,16 +46033,25 @@ If this previously worked in 3.2, you can instruct the compiler to ignore this e
46005
46033
  interface Props extends /* @vue-ignore */ Base {}
46006
46034
 
46007
46035
  Note: both in 3.2 or with the ignore, the properties in the base type are treated as fallthrough attrs at runtime.`,
46008
- ext
46036
+ ext,
46037
+ scope
46009
46038
  );
46010
46039
  }
46011
46040
  }
46012
46041
  }
46013
46042
  return base;
46014
46043
  }
46015
- function resolveMappedType(ctx, node, scope) {
46044
+ function resolveMappedType(ctx, node, scope, typeParameters) {
46016
46045
  const res = { props: {} };
46017
- const keys = resolveStringType(ctx, node.typeParameter.constraint, scope);
46046
+ let keys;
46047
+ if (node.nameType) {
46048
+ const { name, constraint } = node.typeParameter;
46049
+ scope = createChildScope(scope);
46050
+ Object.assign(scope.types, __spreadProps$1(__spreadValues$2({}, typeParameters), { [name]: constraint }));
46051
+ keys = resolveStringType(ctx, node.nameType, scope);
46052
+ } else {
46053
+ keys = resolveStringType(ctx, node.typeParameter.constraint, scope);
46054
+ }
46018
46055
  for (const key of keys) {
46019
46056
  res.props[key] = createProperty(
46020
46057
  {
@@ -46358,7 +46395,7 @@ function importSourceToScope(ctx, node, scope, source) {
46358
46395
  const osSpecificJoinFn = joinPaths;
46359
46396
  const filename = osSpecificJoinFn(dirname$2(scope.filename), source);
46360
46397
  resolved = resolveExt(filename, fs);
46361
- } else if (source.startsWith(".")) {
46398
+ } else if (source[0] === ".") {
46362
46399
  const filename = joinPaths(dirname$2(scope.filename), source);
46363
46400
  resolved = resolveExt(filename, fs);
46364
46401
  } else {
@@ -46388,8 +46425,7 @@ function importSourceToScope(ctx, node, scope, source) {
46388
46425
  function resolveExt(filename, fs) {
46389
46426
  filename = filename.replace(/\.js$/, "");
46390
46427
  const tryResolve = (filename2) => {
46391
- if (fs.fileExists(filename2))
46392
- return filename2;
46428
+ if (fs.fileExists(filename2)) return filename2;
46393
46429
  };
46394
46430
  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`));
46395
46431
  }
@@ -46401,8 +46437,7 @@ function invalidateTypeCache(filename) {
46401
46437
  fileToScopeCache.delete(filename);
46402
46438
  tsConfigCache.delete(filename);
46403
46439
  const affectedConfig = tsConfigRefMap.get(filename);
46404
- if (affectedConfig)
46405
- tsConfigCache.delete(affectedConfig);
46440
+ if (affectedConfig) tsConfigCache.delete(affectedConfig);
46406
46441
  }
46407
46442
  function fileToScope(ctx, filename, asGlobal = false) {
46408
46443
  const cached = fileToScopeCache.get(filename);
@@ -46419,12 +46454,12 @@ function fileToScope(ctx, filename, asGlobal = false) {
46419
46454
  }
46420
46455
  function parseFile(filename, content, parserPlugins) {
46421
46456
  const ext = extname(filename);
46422
- if (ext === ".ts" || ext === ".tsx") {
46457
+ if (ext === ".ts" || ext === ".mts" || ext === ".tsx" || ext === ".mtsx") {
46423
46458
  return parse_1$1(content, {
46424
46459
  plugins: resolveParserPlugins(
46425
46460
  ext.slice(1),
46426
46461
  parserPlugins,
46427
- filename.endsWith(".d.ts")
46462
+ /\.d\.m?ts$/.test(filename)
46428
46463
  ),
46429
46464
  sourceType: "module"
46430
46465
  }).program.body;
@@ -46565,8 +46600,7 @@ function recordTypes(ctx, body, scope, asGlobal = false) {
46565
46600
  for (const key of Object.keys(types)) {
46566
46601
  const node = types[key];
46567
46602
  node._ownerScope = scope;
46568
- if (node._ns)
46569
- node._ns._ownerScope = scope;
46603
+ if (node._ns) node._ns._ownerScope = scope;
46570
46604
  }
46571
46605
  for (const key of Object.keys(declares)) {
46572
46606
  declares[key]._ownerScope = scope;
@@ -46607,15 +46641,13 @@ function recordType(node, types, declares, overwriteId) {
46607
46641
  break;
46608
46642
  }
46609
46643
  case "ClassDeclaration":
46610
- if (overwriteId || node.id)
46611
- types[overwriteId || getId(node.id)] = node;
46644
+ if (overwriteId || node.id) types[overwriteId || getId(node.id)] = node;
46612
46645
  break;
46613
46646
  case "TSTypeAliasDeclaration":
46614
46647
  types[node.id.name] = node.typeParameters ? node : node.typeAnnotation;
46615
46648
  break;
46616
46649
  case "TSDeclareFunction":
46617
- if (node.id)
46618
- declares[node.id.name] = node;
46650
+ if (node.id) declares[node.id.name] = node;
46619
46651
  break;
46620
46652
  case "VariableDeclaration": {
46621
46653
  if (node.declare) {
@@ -46679,7 +46711,7 @@ function recordImport(node, imports) {
46679
46711
  };
46680
46712
  }
46681
46713
  }
46682
- function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)) {
46714
+ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx), isKeyOf = false) {
46683
46715
  try {
46684
46716
  switch (node.type) {
46685
46717
  case "TSStringKeyword":
@@ -46697,13 +46729,30 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
46697
46729
  const types = /* @__PURE__ */ new Set();
46698
46730
  const members = node.type === "TSTypeLiteral" ? node.members : node.body.body;
46699
46731
  for (const m of members) {
46700
- if (m.type === "TSCallSignatureDeclaration" || m.type === "TSConstructSignatureDeclaration") {
46732
+ if (isKeyOf) {
46733
+ if (m.type === "TSPropertySignature" && m.key.type === "NumericLiteral") {
46734
+ types.add("Number");
46735
+ } else if (m.type === "TSIndexSignature") {
46736
+ const annotation = m.parameters[0].typeAnnotation;
46737
+ if (annotation && annotation.type !== "Noop") {
46738
+ const type = inferRuntimeType(
46739
+ ctx,
46740
+ annotation.typeAnnotation,
46741
+ scope
46742
+ )[0];
46743
+ if (type === UNKNOWN_TYPE) return [UNKNOWN_TYPE];
46744
+ types.add(type);
46745
+ }
46746
+ } else {
46747
+ types.add("String");
46748
+ }
46749
+ } else if (m.type === "TSCallSignatureDeclaration" || m.type === "TSConstructSignatureDeclaration") {
46701
46750
  types.add("Function");
46702
46751
  } else {
46703
46752
  types.add("Object");
46704
46753
  }
46705
46754
  }
46706
- return types.size ? Array.from(types) : ["Object"];
46755
+ return types.size ? Array.from(types) : [isKeyOf ? UNKNOWN_TYPE : "Object"];
46707
46756
  }
46708
46757
  case "TSPropertySignature":
46709
46758
  if (node.typeAnnotation) {
@@ -46735,70 +46784,121 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
46735
46784
  case "TSTypeReference": {
46736
46785
  const resolved = resolveTypeReference(ctx, node, scope);
46737
46786
  if (resolved) {
46738
- return inferRuntimeType(ctx, resolved, resolved._ownerScope);
46787
+ return inferRuntimeType(ctx, resolved, resolved._ownerScope, isKeyOf);
46739
46788
  }
46740
46789
  if (node.typeName.type === "Identifier") {
46741
- switch (node.typeName.name) {
46742
- case "Array":
46743
- case "Function":
46744
- case "Object":
46745
- case "Set":
46746
- case "Map":
46747
- case "WeakSet":
46748
- case "WeakMap":
46749
- case "Date":
46750
- case "Promise":
46751
- case "Error":
46752
- return [node.typeName.name];
46753
- case "Partial":
46754
- case "Required":
46755
- case "Readonly":
46756
- case "Record":
46757
- case "Pick":
46758
- case "Omit":
46759
- case "InstanceType":
46760
- return ["Object"];
46761
- case "Uppercase":
46762
- case "Lowercase":
46763
- case "Capitalize":
46764
- case "Uncapitalize":
46765
- return ["String"];
46766
- case "Parameters":
46767
- case "ConstructorParameters":
46768
- case "ReadonlyArray":
46769
- return ["Array"];
46770
- case "ReadonlyMap":
46771
- return ["Map"];
46772
- case "ReadonlySet":
46773
- return ["Set"];
46774
- case "NonNullable":
46775
- if (node.typeParameters && node.typeParameters.params[0]) {
46776
- return inferRuntimeType(
46777
- ctx,
46778
- node.typeParameters.params[0],
46779
- scope
46780
- ).filter((t) => t !== "null");
46781
- }
46782
- break;
46783
- case "Extract":
46784
- if (node.typeParameters && node.typeParameters.params[1]) {
46785
- return inferRuntimeType(
46786
- ctx,
46787
- node.typeParameters.params[1],
46788
- scope
46789
- );
46790
- }
46791
- break;
46792
- case "Exclude":
46793
- case "OmitThisParameter":
46794
- if (node.typeParameters && node.typeParameters.params[0]) {
46795
- return inferRuntimeType(
46796
- ctx,
46797
- node.typeParameters.params[0],
46798
- scope
46799
- );
46800
- }
46801
- break;
46790
+ if (isKeyOf) {
46791
+ switch (node.typeName.name) {
46792
+ case "String":
46793
+ case "Array":
46794
+ case "ArrayLike":
46795
+ case "Parameters":
46796
+ case "ConstructorParameters":
46797
+ case "ReadonlyArray":
46798
+ return ["String", "Number"];
46799
+ case "Record":
46800
+ case "Partial":
46801
+ case "Required":
46802
+ case "Readonly":
46803
+ if (node.typeParameters && node.typeParameters.params[0]) {
46804
+ return inferRuntimeType(
46805
+ ctx,
46806
+ node.typeParameters.params[0],
46807
+ scope,
46808
+ true
46809
+ );
46810
+ }
46811
+ break;
46812
+ case "Pick":
46813
+ case "Extract":
46814
+ if (node.typeParameters && node.typeParameters.params[1]) {
46815
+ return inferRuntimeType(
46816
+ ctx,
46817
+ node.typeParameters.params[1],
46818
+ scope
46819
+ );
46820
+ }
46821
+ break;
46822
+ case "Function":
46823
+ case "Object":
46824
+ case "Set":
46825
+ case "Map":
46826
+ case "WeakSet":
46827
+ case "WeakMap":
46828
+ case "Date":
46829
+ case "Promise":
46830
+ case "Error":
46831
+ case "Uppercase":
46832
+ case "Lowercase":
46833
+ case "Capitalize":
46834
+ case "Uncapitalize":
46835
+ case "ReadonlyMap":
46836
+ case "ReadonlySet":
46837
+ return ["String"];
46838
+ }
46839
+ } else {
46840
+ switch (node.typeName.name) {
46841
+ case "Array":
46842
+ case "Function":
46843
+ case "Object":
46844
+ case "Set":
46845
+ case "Map":
46846
+ case "WeakSet":
46847
+ case "WeakMap":
46848
+ case "Date":
46849
+ case "Promise":
46850
+ case "Error":
46851
+ return [node.typeName.name];
46852
+ case "Partial":
46853
+ case "Required":
46854
+ case "Readonly":
46855
+ case "Record":
46856
+ case "Pick":
46857
+ case "Omit":
46858
+ case "InstanceType":
46859
+ return ["Object"];
46860
+ case "Uppercase":
46861
+ case "Lowercase":
46862
+ case "Capitalize":
46863
+ case "Uncapitalize":
46864
+ return ["String"];
46865
+ case "Parameters":
46866
+ case "ConstructorParameters":
46867
+ case "ReadonlyArray":
46868
+ return ["Array"];
46869
+ case "ReadonlyMap":
46870
+ return ["Map"];
46871
+ case "ReadonlySet":
46872
+ return ["Set"];
46873
+ case "NonNullable":
46874
+ if (node.typeParameters && node.typeParameters.params[0]) {
46875
+ return inferRuntimeType(
46876
+ ctx,
46877
+ node.typeParameters.params[0],
46878
+ scope
46879
+ ).filter((t) => t !== "null");
46880
+ }
46881
+ break;
46882
+ case "Extract":
46883
+ if (node.typeParameters && node.typeParameters.params[1]) {
46884
+ return inferRuntimeType(
46885
+ ctx,
46886
+ node.typeParameters.params[1],
46887
+ scope
46888
+ );
46889
+ }
46890
+ break;
46891
+ case "Exclude":
46892
+ case "OmitThisParameter":
46893
+ if (node.typeParameters && node.typeParameters.params[0]) {
46894
+ return inferRuntimeType(
46895
+ ctx,
46896
+ node.typeParameters.params[0],
46897
+ scope
46898
+ );
46899
+ }
46900
+ break;
46901
+ }
46802
46902
  }
46803
46903
  }
46804
46904
  break;
@@ -46806,9 +46906,9 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
46806
46906
  case "TSParenthesizedType":
46807
46907
  return inferRuntimeType(ctx, node.typeAnnotation, scope);
46808
46908
  case "TSUnionType":
46809
- return flattenTypes(ctx, node.types, scope);
46909
+ return flattenTypes(ctx, node.types, scope, isKeyOf);
46810
46910
  case "TSIntersectionType": {
46811
- return flattenTypes(ctx, node.types, scope).filter(
46911
+ return flattenTypes(ctx, node.types, scope, isKeyOf).filter(
46812
46912
  (t) => t !== UNKNOWN_TYPE
46813
46913
  );
46814
46914
  }
@@ -46840,27 +46940,38 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
46840
46940
  if (id.type === "Identifier") {
46841
46941
  const matched = scope.declares[id.name];
46842
46942
  if (matched) {
46843
- return inferRuntimeType(ctx, matched, matched._ownerScope);
46943
+ return inferRuntimeType(ctx, matched, matched._ownerScope, isKeyOf);
46844
46944
  }
46845
46945
  }
46846
46946
  break;
46847
46947
  }
46848
46948
  case "TSTypeOperator": {
46849
- return inferRuntimeType(ctx, node.typeAnnotation, scope);
46949
+ return inferRuntimeType(
46950
+ ctx,
46951
+ node.typeAnnotation,
46952
+ scope,
46953
+ node.operator === "keyof"
46954
+ );
46955
+ }
46956
+ case "TSAnyKeyword": {
46957
+ if (isKeyOf) {
46958
+ return ["String", "Number", "Symbol"];
46959
+ }
46960
+ break;
46850
46961
  }
46851
46962
  }
46852
46963
  } catch (e) {
46853
46964
  }
46854
46965
  return [UNKNOWN_TYPE];
46855
46966
  }
46856
- function flattenTypes(ctx, types, scope) {
46967
+ function flattenTypes(ctx, types, scope, isKeyOf = false) {
46857
46968
  if (types.length === 1) {
46858
- return inferRuntimeType(ctx, types[0], scope);
46969
+ return inferRuntimeType(ctx, types[0], scope, isKeyOf);
46859
46970
  }
46860
46971
  return [
46861
46972
  ...new Set(
46862
46973
  [].concat(
46863
- ...types.map((t) => inferRuntimeType(ctx, t, scope))
46974
+ ...types.map((t) => inferRuntimeType(ctx, t, scope, isKeyOf))
46864
46975
  )
46865
46976
  )
46866
46977
  ];
@@ -46916,8 +47027,7 @@ function reverseInferType(key, node, scope, optional = true, checkObjectSyntax =
46916
47027
  if ((node.type === "TSTypeReference" || node.type === "TSImportType") && node.typeParameters) {
46917
47028
  for (const t of node.typeParameters.params) {
46918
47029
  const inferred = reverseInferType(key, t, scope, optional);
46919
- if (inferred)
46920
- return inferred;
47030
+ if (inferred) return inferred;
46921
47031
  }
46922
47032
  }
46923
47033
  return createProperty(key, { type: `TSNullKeyword` }, scope, optional);
@@ -46957,8 +47067,7 @@ function resolveReturnType(ctx, arg, scope) {
46957
47067
  if (arg.type === "TSTypeReference" || arg.type === "TSTypeQuery" || arg.type === "TSImportType") {
46958
47068
  resolved = resolveTypeReference(ctx, arg, scope);
46959
47069
  }
46960
- if (!resolved)
46961
- return;
47070
+ if (!resolved) return;
46962
47071
  if (resolved.type === "TSFunctionType") {
46963
47072
  return (_a = resolved.typeAnnotation) == null ? void 0 : _a.typeAnnotation;
46964
47073
  }
@@ -46969,8 +47078,7 @@ function resolveReturnType(ctx, arg, scope) {
46969
47078
  function resolveUnionType(ctx, node, scope) {
46970
47079
  if (node.type === "TSTypeReference") {
46971
47080
  const resolved = resolveTypeReference(ctx, node, scope);
46972
- if (resolved)
46973
- node = resolved;
47081
+ if (resolved) node = resolved;
46974
47082
  }
46975
47083
  let types;
46976
47084
  if (node.type === "TSUnionType") {
@@ -47047,8 +47155,7 @@ function processDefineModel(ctx, node, declId) {
47047
47155
  return true;
47048
47156
  }
47049
47157
  function genModelProps(ctx) {
47050
- if (!ctx.hasDefineModelCall)
47051
- return;
47158
+ if (!ctx.hasDefineModelCall) return;
47052
47159
  const isProd = !!ctx.options.isProd;
47053
47160
  let modelPropsDecl = "";
47054
47161
  for (const [name, { type, options: runtimeOptions }] of Object.entries(
@@ -47250,8 +47357,7 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
47250
47357
  } else if (hasStaticDefaults) {
47251
47358
  const prop = ctx.propsRuntimeDefaults.properties.find(
47252
47359
  (node) => {
47253
- if (node.type === "SpreadElement")
47254
- return false;
47360
+ if (node.type === "SpreadElement") return false;
47255
47361
  return resolveObjectKey(node.key, node.computed) === key;
47256
47362
  }
47257
47363
  );
@@ -47421,8 +47527,7 @@ function transformDestructuredProps(ctx, vueImportAliases) {
47421
47527
  if (stmt.type === "VariableDeclaration") {
47422
47528
  walkVariableDeclaration(stmt, isRoot);
47423
47529
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
47424
- if (stmt.declare || !stmt.id)
47425
- continue;
47530
+ if (stmt.declare || !stmt.id) continue;
47426
47531
  registerLocalBinding(stmt.id);
47427
47532
  } else if ((stmt.type === "ForOfStatement" || stmt.type === "ForInStatement") && stmt.left.type === "VariableDeclaration") {
47428
47533
  walkVariableDeclaration(stmt.left);
@@ -47648,8 +47753,7 @@ function processDefineOptions(ctx, node) {
47648
47753
  if (node.typeParameters) {
47649
47754
  ctx.error(`${DEFINE_OPTIONS}() cannot accept type arguments`, node);
47650
47755
  }
47651
- if (!node.arguments[0])
47652
- return true;
47756
+ if (!node.arguments[0]) return true;
47653
47757
  ctx.hasDefineOptionsCall = true;
47654
47758
  ctx.optionsRuntimeDecl = unwrapTSNode(node.arguments[0]);
47655
47759
  let propsOption = void 0;
@@ -47659,14 +47763,20 @@ function processDefineOptions(ctx, node) {
47659
47763
  if (ctx.optionsRuntimeDecl.type === "ObjectExpression") {
47660
47764
  for (const prop of ctx.optionsRuntimeDecl.properties) {
47661
47765
  if ((prop.type === "ObjectProperty" || prop.type === "ObjectMethod") && prop.key.type === "Identifier") {
47662
- if (prop.key.name === "props")
47663
- propsOption = prop;
47664
- if (prop.key.name === "emits")
47665
- emitsOption = prop;
47666
- if (prop.key.name === "expose")
47667
- exposeOption = prop;
47668
- if (prop.key.name === "slots")
47669
- slotsOption = prop;
47766
+ switch (prop.key.name) {
47767
+ case "props":
47768
+ propsOption = prop;
47769
+ break;
47770
+ case "emits":
47771
+ emitsOption = prop;
47772
+ break;
47773
+ case "expose":
47774
+ exposeOption = prop;
47775
+ break;
47776
+ case "slots":
47777
+ slotsOption = prop;
47778
+ break;
47779
+ }
47670
47780
  }
47671
47781
  }
47672
47782
  }
@@ -47742,6 +47852,15 @@ var __spreadValues$1 = (a, b) => {
47742
47852
  return a;
47743
47853
  };
47744
47854
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
47855
+ const MACROS = [
47856
+ DEFINE_PROPS,
47857
+ DEFINE_EMITS,
47858
+ DEFINE_EXPOSE,
47859
+ DEFINE_OPTIONS,
47860
+ DEFINE_SLOTS,
47861
+ DEFINE_MODEL,
47862
+ WITH_DEFAULTS
47863
+ ];
47745
47864
  function compileScript(sfc, options) {
47746
47865
  var _a, _b, _c;
47747
47866
  if (!options.id) {
@@ -47809,8 +47928,7 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
47809
47928
  };
47810
47929
  }
47811
47930
  function checkInvalidScopeReference(node, method) {
47812
- if (!node)
47813
- return;
47931
+ if (!node) return;
47814
47932
  walkIdentifiers(node, (id) => {
47815
47933
  const binding = setupBindings[id.name];
47816
47934
  if (binding && binding !== "literal-const") {
@@ -47860,10 +47978,17 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
47860
47978
  const imported = getImportedName(specifier);
47861
47979
  const source2 = node.source.value;
47862
47980
  const existing = ctx.userImports[local];
47863
- if (source2 === "vue" && (imported === DEFINE_PROPS || imported === DEFINE_EMITS || imported === DEFINE_EXPOSE)) {
47864
- warnOnce$3(
47865
- `\`${imported}\` is a compiler macro and no longer needs to be imported.`
47866
- );
47981
+ if (source2 === "vue" && MACROS.includes(imported)) {
47982
+ if (local === imported) {
47983
+ warnOnce$3(
47984
+ `\`${imported}\` is a compiler macro and no longer needs to be imported.`
47985
+ );
47986
+ } else {
47987
+ ctx.error(
47988
+ `\`${imported}\` is a compiler macro and cannot be aliased to a different name.`,
47989
+ specifier
47990
+ );
47991
+ }
47867
47992
  removeSpecifier(i);
47868
47993
  } else if (existing) {
47869
47994
  if (existing.source === source2 && existing.imported === imported) {
@@ -47893,8 +48018,7 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
47893
48018
  const vueImportAliases = {};
47894
48019
  for (const key in ctx.userImports) {
47895
48020
  const { source: source2, imported, local } = ctx.userImports[key];
47896
- if (source2 === "vue")
47897
- vueImportAliases[imported] = local;
48021
+ if (source2 === "vue") vueImportAliases[imported] = local;
47898
48022
  }
47899
48023
  if (script && scriptAst) {
47900
48024
  for (const node of scriptAst.body) {
@@ -48008,6 +48132,9 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
48008
48132
  );
48009
48133
  }
48010
48134
  const isDefineProps = processDefineProps(ctx, init, decl.id);
48135
+ if (ctx.propsDestructureRestId) {
48136
+ setupBindings[ctx.propsDestructureRestId] = "setup-reactive-const";
48137
+ }
48011
48138
  const isDefineEmits = !isDefineProps && processDefineEmits(ctx, init, decl.id);
48012
48139
  !isDefineEmits && (processDefineSlots(ctx, init, decl.id) || processDefineModel(ctx, init, decl.id));
48013
48140
  if (isDefineProps && !ctx.propsDestructureRestId && ctx.propsDestructureDecl) {
@@ -48043,7 +48170,8 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
48043
48170
  node,
48044
48171
  setupBindings,
48045
48172
  vueImportAliases,
48046
- hoistStatic
48173
+ hoistStatic,
48174
+ !!ctx.propsDestructureDecl
48047
48175
  );
48048
48176
  }
48049
48177
  if (hoistStatic && isAllLiteral) {
@@ -48074,8 +48202,7 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
48074
48202
  }
48075
48203
  },
48076
48204
  exit(node2) {
48077
- if (node2.type === "BlockStatement")
48078
- scope.pop();
48205
+ if (node2.type === "BlockStatement") scope.pop();
48079
48206
  }
48080
48207
  });
48081
48208
  }
@@ -48126,8 +48253,7 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
48126
48253
  for (const [key, { isType, imported, source: source2 }] of Object.entries(
48127
48254
  ctx.userImports
48128
48255
  )) {
48129
- if (isType)
48130
- continue;
48256
+ if (isType) continue;
48131
48257
  ctx.bindingMetadata[key] = imported === "*" || imported === "default" && source2.endsWith(".vue") || source2 === "vue" ? "setup-const" : "setup-maybe-ref";
48132
48258
  }
48133
48259
  for (const key in scriptBindings) {
@@ -48294,12 +48420,10 @@ return ${returned}
48294
48420
  __ssrInlineRender: true,`;
48295
48421
  }
48296
48422
  const propsDecl = genRuntimeProps(ctx);
48297
- if (propsDecl)
48298
- runtimeOptions += `
48423
+ if (propsDecl) runtimeOptions += `
48299
48424
  props: ${propsDecl},`;
48300
48425
  const emitsDecl = genRuntimeEmits(ctx);
48301
- if (emitsDecl)
48302
- runtimeOptions += `
48426
+ if (emitsDecl) runtimeOptions += `
48303
48427
  emits: ${emitsDecl},`;
48304
48428
  let definedOptions = "";
48305
48429
  if (ctx.optionsRuntimeDecl) {
@@ -48367,7 +48491,7 @@ ${exposeCall}`
48367
48491
  function registerBinding(bindings, node, type) {
48368
48492
  bindings[node.name] = type;
48369
48493
  }
48370
- function walkDeclaration(from, node, bindings, userImportAliases, hoistStatic) {
48494
+ function walkDeclaration(from, node, bindings, userImportAliases, hoistStatic, isPropsDestructureEnabled = false) {
48371
48495
  let isAllLiteral = false;
48372
48496
  if (node.type === "VariableDeclaration") {
48373
48497
  const isConst = node.kind === "const";
@@ -48376,10 +48500,10 @@ function walkDeclaration(from, node, bindings, userImportAliases, hoistStatic) {
48376
48500
  );
48377
48501
  for (const { id, init: _init } of node.declarations) {
48378
48502
  const init = _init && unwrapTSNode(_init);
48379
- const isDefineCall = !!(isConst && isCallOf(
48503
+ const isConstMacroCall = isConst && isCallOf(
48380
48504
  init,
48381
- (c) => c === DEFINE_PROPS || c === DEFINE_EMITS || c === WITH_DEFAULTS
48382
- ));
48505
+ (c) => c === DEFINE_PROPS || c === DEFINE_EMITS || c === WITH_DEFAULTS || c === DEFINE_SLOTS
48506
+ );
48383
48507
  if (id.type === "Identifier") {
48384
48508
  let bindingType;
48385
48509
  const userReactiveBinding = userImportAliases["reactive"];
@@ -48390,7 +48514,7 @@ function walkDeclaration(from, node, bindings, userImportAliases, hoistStatic) {
48390
48514
  } else if (
48391
48515
  // if a declaration is a const literal, we can mark it so that
48392
48516
  // the generated render fn code doesn't need to unref() it
48393
- isDefineCall || isConst && canNeverBeRef(init, userReactiveBinding)
48517
+ isConstMacroCall || isConst && canNeverBeRef(init, userReactiveBinding)
48394
48518
  ) {
48395
48519
  bindingType = isCallOf(init, DEFINE_PROPS) ? "setup-reactive-const" : "setup-const";
48396
48520
  } else if (isConst) {
@@ -48407,13 +48531,13 @@ function walkDeclaration(from, node, bindings, userImportAliases, hoistStatic) {
48407
48531
  }
48408
48532
  registerBinding(bindings, id, bindingType);
48409
48533
  } else {
48410
- if (isCallOf(init, DEFINE_PROPS)) {
48534
+ if (isCallOf(init, DEFINE_PROPS) && isPropsDestructureEnabled) {
48411
48535
  continue;
48412
48536
  }
48413
48537
  if (id.type === "ObjectPattern") {
48414
- walkObjectPattern(id, bindings, isConst, isDefineCall);
48538
+ walkObjectPattern(id, bindings, isConst, isConstMacroCall);
48415
48539
  } else if (id.type === "ArrayPattern") {
48416
- walkArrayPattern(id, bindings, isConst, isDefineCall);
48540
+ walkArrayPattern(id, bindings, isConst, isConstMacroCall);
48417
48541
  }
48418
48542
  }
48419
48543
  }
@@ -48536,7 +48660,7 @@ var __spreadValues = (a, b) => {
48536
48660
  }
48537
48661
  return a;
48538
48662
  };
48539
- const version = "3.5.0-alpha.2";
48663
+ const version = "3.5.0-alpha.3";
48540
48664
  const parseCache = parseCache$1;
48541
48665
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
48542
48666
  const walk = walk$2;