@vue/compiler-sfc 3.6.0-beta.3 → 3.6.0-beta.4

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.6.0-beta.3
2
+ * @vue/compiler-sfc v3.6.0-beta.4
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -18903,16 +18903,18 @@ function resolveInterfaceMembers(ctx, node, scope, typeParameters) {
18903
18903
  (base.calls || (base.calls = [])).push(...calls);
18904
18904
  }
18905
18905
  } catch (e) {
18906
- ctx.error(
18907
- `Failed to resolve extends base type.
18906
+ if (!ctx.silentOnExtendsFailure) {
18907
+ ctx.error(
18908
+ `Failed to resolve extends base type.
18908
18909
  If this previously worked in 3.2, you can instruct the compiler to ignore this extend by adding /* @vue-ignore */ before it, for example:
18909
18910
 
18910
18911
  interface Props extends /* @vue-ignore */ Base {}
18911
18912
 
18912
18913
  Note: both in 3.2 or with the ignore, the properties in the base type are treated as fallthrough attrs at runtime.`,
18913
- ext,
18914
- scope
18915
- );
18914
+ ext,
18915
+ scope
18916
+ );
18917
+ }
18916
18918
  }
18917
18919
  }
18918
18920
  }
@@ -19612,6 +19614,17 @@ function recordType(node, types, declares, overwriteId) {
19612
19614
  case "TSInterfaceDeclaration":
19613
19615
  case "TSEnumDeclaration":
19614
19616
  case "TSModuleDeclaration": {
19617
+ if (node.type === "TSModuleDeclaration" && node.global) {
19618
+ const body = node.body;
19619
+ for (const s of body.body) {
19620
+ if (s.type === "ExportNamedDeclaration" && s.declaration) {
19621
+ recordType(s.declaration, types, declares);
19622
+ } else {
19623
+ recordType(s, types, declares);
19624
+ }
19625
+ }
19626
+ break;
19627
+ }
19615
19628
  const id = overwriteId || getId(node.id);
19616
19629
  let existing = types[id];
19617
19630
  if (existing) {
@@ -19716,6 +19729,8 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
19716
19729
  if (node.leadingComments && node.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
19717
19730
  return [UNKNOWN_TYPE];
19718
19731
  }
19732
+ const prevSilent = ctx.silentOnExtendsFailure;
19733
+ ctx.silentOnExtendsFailure = true;
19719
19734
  try {
19720
19735
  switch (node.type) {
19721
19736
  case "TSStringKeyword":
@@ -20020,18 +20035,32 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
20020
20035
  }
20021
20036
  }
20022
20037
  } catch (e) {
20038
+ } finally {
20039
+ ctx.silentOnExtendsFailure = prevSilent;
20023
20040
  }
20024
20041
  return [UNKNOWN_TYPE];
20025
20042
  }
20026
20043
  function flattenTypes(ctx, types, scope, isKeyOf = false, typeParameters = void 0) {
20027
20044
  if (types.length === 1) {
20028
- return inferRuntimeType(ctx, types[0], scope, isKeyOf, typeParameters);
20045
+ return inferRuntimeType(
20046
+ ctx,
20047
+ types[0],
20048
+ types[0]._ownerScope || scope,
20049
+ isKeyOf,
20050
+ typeParameters
20051
+ );
20029
20052
  }
20030
20053
  return [
20031
20054
  ...new Set(
20032
20055
  [].concat(
20033
20056
  ...types.map(
20034
- (t) => inferRuntimeType(ctx, t, scope, isKeyOf, typeParameters)
20057
+ (t) => inferRuntimeType(
20058
+ ctx,
20059
+ t,
20060
+ t._ownerScope || scope,
20061
+ isKeyOf,
20062
+ typeParameters
20063
+ )
20035
20064
  )
20036
20065
  )
20037
20066
  )
@@ -20599,8 +20628,6 @@ function transformDestructuredProps(ctx, vueImportAliases) {
20599
20628
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
20600
20629
  if (stmt.declare || !stmt.id) continue;
20601
20630
  registerLocalBinding(stmt.id);
20602
- } else if ((stmt.type === "ForOfStatement" || stmt.type === "ForInStatement") && stmt.left.type === "VariableDeclaration") {
20603
- walkVariableDeclaration(stmt.left);
20604
20631
  } else if (stmt.type === "ExportNamedDeclaration" && stmt.declaration && stmt.declaration.type === "VariableDeclaration") {
20605
20632
  walkVariableDeclaration(stmt.declaration, isRoot);
20606
20633
  } else if (stmt.type === "LabeledStatement" && stmt.body.type === "VariableDeclaration") {
@@ -20679,6 +20706,17 @@ function transformDestructuredProps(ctx, vueImportAliases) {
20679
20706
  walkScope(node.body);
20680
20707
  return;
20681
20708
  }
20709
+ if (node.type === "ForOfStatement" || node.type === "ForInStatement" || node.type === "ForStatement") {
20710
+ pushScope();
20711
+ const varDecl = node.type === "ForStatement" ? node.init : node.left;
20712
+ if (varDecl && varDecl.type === "VariableDeclaration") {
20713
+ walkVariableDeclaration(varDecl);
20714
+ }
20715
+ if (node.body.type === "BlockStatement") {
20716
+ walkScope(node.body);
20717
+ }
20718
+ return;
20719
+ }
20682
20720
  if (node.type === "BlockStatement" && !CompilerDOM.isFunctionType(parent)) {
20683
20721
  pushScope();
20684
20722
  walkScope(node);
@@ -20694,7 +20732,7 @@ function transformDestructuredProps(ctx, vueImportAliases) {
20694
20732
  },
20695
20733
  leave(node, parent) {
20696
20734
  parent && parentStack.pop();
20697
- if (node.type === "BlockStatement" && !CompilerDOM.isFunctionType(parent) || CompilerDOM.isFunctionType(node) || node.type === "CatchClause") {
20735
+ if (node.type === "BlockStatement" && !CompilerDOM.isFunctionType(parent) || CompilerDOM.isFunctionType(node) || node.type === "CatchClause" || node.type === "ForOfStatement" || node.type === "ForInStatement" || node.type === "ForStatement") {
20698
20736
  popScope();
20699
20737
  }
20700
20738
  }
@@ -21817,7 +21855,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
21817
21855
  return generator.toJSON();
21818
21856
  }
21819
21857
 
21820
- const version = "3.6.0-beta.3";
21858
+ const version = "3.6.0-beta.4";
21821
21859
  const parseCache = parseCache$1;
21822
21860
  const errorMessages = {
21823
21861
  ...CompilerDOM.errorMessages,
@@ -422,11 +422,13 @@ export type SimpleTypeResolveOptions = Partial<Pick<SFCScriptCompileOptions, 'gl
422
422
  * }
423
423
  * ```
424
424
  */
425
- export type SimpleTypeResolveContext = Pick<ScriptCompileContext, 'source' | 'filename' | 'error' | 'helper' | 'getString' | 'propsTypeDecl' | 'propsRuntimeDefaults' | 'propsDestructuredBindings' | 'emitsTypeDecl' | 'isCE'> & Partial<Pick<ScriptCompileContext, 'scope' | 'globalScopes' | 'deps' | 'fs'>> & {
425
+ export type SimpleTypeResolveContext = Pick<ScriptCompileContext, 'source' | 'filename' | 'error' | 'warn' | 'helper' | 'getString' | 'propsTypeDecl' | 'propsRuntimeDefaults' | 'propsDestructuredBindings' | 'emitsTypeDecl' | 'isCE'> & Partial<Pick<ScriptCompileContext, 'scope' | 'globalScopes' | 'deps' | 'fs'>> & {
426
426
  ast: Statement[];
427
427
  options: SimpleTypeResolveOptions;
428
428
  };
429
- export type TypeResolveContext = ScriptCompileContext | SimpleTypeResolveContext;
429
+ export type TypeResolveContext = (ScriptCompileContext | SimpleTypeResolveContext) & {
430
+ silentOnExtendsFailure?: boolean;
431
+ };
430
432
  type Import = Pick<ImportBinding, 'source' | 'imported'>;
431
433
  interface WithScope {
432
434
  _ownerScope: TypeScope;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.6.0-beta.3
2
+ * @vue/compiler-sfc v3.6.0-beta.4
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -222,11 +222,17 @@ const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,col
222
222
  const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
223
223
  const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
224
224
  const FORMATTING_TAGS = "a,b,big,code,em,font,i,nobr,s,small,strike,strong,tt,u";
225
+ const ALWAYS_CLOSE_TAGS = "title,style,script,noscript,template,object,table,button,textarea,select,iframe,fieldset";
226
+ const INLINE_TAGS = "a,abbr,acronym,b,bdi,bdo,big,br,button,canvas,cite,code,data,datalist,del,dfn,em,embed,i,iframe,img,input,ins,kbd,label,map,mark,meter,noscript,object,output,picture,progress,q,ruby,s,samp,script,select,small,span,strong,sub,sup,svg,textarea,time,u,tt,var,video";
227
+ const BLOCK_TAGS = "address,article,aside,blockquote,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,main,menu,nav,ol,p,pre,section,table,ul";
225
228
  const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
226
229
  const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
227
230
  const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
228
231
  const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
229
232
  const isFormattingTag = /* @__PURE__ */ makeMap(FORMATTING_TAGS);
233
+ const isAlwaysCloseTag = /* @__PURE__ */ makeMap(ALWAYS_CLOSE_TAGS);
234
+ const isInlineTag = /* @__PURE__ */ makeMap(INLINE_TAGS);
235
+ const isBlockTag = /* @__PURE__ */ makeMap(BLOCK_TAGS);
230
236
 
231
237
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
232
238
  const isBooleanAttr = /* @__PURE__ */ makeMap(
@@ -32360,6 +32366,9 @@ class TransformContext {
32360
32366
  // whether this node is on the rightmost path of the tree
32361
32367
  // (all ancestors are also last effective children)
32362
32368
  this.isOnRightmostPath = true;
32369
+ // whether there is an inline ancestor that needs closing
32370
+ // (i.e. is an inline tag and not on the rightmost path)
32371
+ this.hasInlineAncestorNeedingClose = false;
32363
32372
  this.globalId = 0;
32364
32373
  this.nextIdMap = null;
32365
32374
  this.increaseId = () => {
@@ -32446,6 +32455,14 @@ class TransformContext {
32446
32455
  }
32447
32456
  const isLastEffectiveChild = this.isEffectivelyLastChild(index);
32448
32457
  const isOnRightmostPath = this.isOnRightmostPath && isLastEffectiveChild;
32458
+ let hasInlineAncestorNeedingClose = this.hasInlineAncestorNeedingClose;
32459
+ if (this.node.type === 1) {
32460
+ if (this.node.tag === "template") {
32461
+ hasInlineAncestorNeedingClose = false;
32462
+ } else if (!hasInlineAncestorNeedingClose && !this.isOnRightmostPath && isInlineTag(this.node.tag)) {
32463
+ hasInlineAncestorNeedingClose = true;
32464
+ }
32465
+ }
32449
32466
  return Object.assign(Object.create(TransformContext.prototype), this, {
32450
32467
  node,
32451
32468
  parent: this,
@@ -32455,7 +32472,8 @@ class TransformContext {
32455
32472
  dynamic: newDynamic(),
32456
32473
  effectiveParent,
32457
32474
  isLastEffectiveChild,
32458
- isOnRightmostPath
32475
+ isOnRightmostPath,
32476
+ hasInlineAncestorNeedingClose
32459
32477
  });
32460
32478
  }
32461
32479
  isEffectivelyLastChild(index) {
@@ -33944,8 +33962,8 @@ function genRefValue(value, context) {
33944
33962
 
33945
33963
  function genSetText(oper, context) {
33946
33964
  const { helper } = context;
33947
- const { element, values, generated, jsx, isComponent } = oper;
33948
- const texts = combineValues(values, context, jsx);
33965
+ const { element, values, generated, isComponent } = oper;
33966
+ const texts = combineValues(values, context);
33949
33967
  return [
33950
33968
  NEWLINE,
33951
33969
  ...genCall(
@@ -33956,14 +33974,14 @@ function genSetText(oper, context) {
33956
33974
  )
33957
33975
  ];
33958
33976
  }
33959
- function combineValues(values, context, jsx) {
33977
+ function combineValues(values, context) {
33960
33978
  return values.flatMap((value, i) => {
33961
33979
  let exp = genExpression(value, context);
33962
- if (!jsx && getLiteralExpressionValue(value, true) == null) {
33980
+ if (getLiteralExpressionValue(value, true) == null) {
33963
33981
  exp = genCall(context.helper("toDisplayString"), exp);
33964
33982
  }
33965
33983
  if (i > 0) {
33966
- exp.unshift(jsx ? ", " : " + ");
33984
+ exp.unshift(" + ");
33967
33985
  }
33968
33986
  return exp;
33969
33987
  });
@@ -34688,17 +34706,17 @@ function genEffect({ operations }, context) {
34688
34706
  return frag;
34689
34707
  }
34690
34708
  function genInsertionState(operation, context) {
34691
- const { parent, anchor, append, last } = operation;
34709
+ const { parent, anchor, logicalIndex, append, last } = operation;
34692
34710
  return [
34693
34711
  NEWLINE,
34694
34712
  ...genCall(
34695
34713
  context.helper("setInsertionState"),
34696
34714
  `n${parent}`,
34697
34715
  anchor == null ? void 0 : anchor === -1 ? `0` : append ? (
34698
- // null or anchor > 0 for append
34699
- // anchor > 0 is the logical index of append node - used for locate node during hydration
34700
- anchor === 0 ? "null" : `${anchor}`
34716
+ // for append, always use null since we have logicalIndex
34717
+ "null"
34701
34718
  ) : `n${anchor}`,
34719
+ logicalIndex !== void 0 ? String(logicalIndex) : void 0,
34702
34720
  last && "true"
34703
34721
  )
34704
34722
  ];
@@ -34743,16 +34761,9 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`) {
34743
34761
  const { children } = dynamic;
34744
34762
  let offset = 0;
34745
34763
  let prev;
34746
- let ifBranchCount = 0;
34747
- let prependCount = 0;
34748
34764
  for (const [index, child] of children.entries()) {
34749
- if (child.operation && child.operation.anchor === -1) {
34750
- prependCount++;
34751
- }
34752
34765
  if (child.flags & 2) {
34753
34766
  offset--;
34754
- } else if (child.ifBranch) {
34755
- ifBranchCount++;
34756
34767
  }
34757
34768
  const id = child.flags & 1 ? child.flags & 4 ? child.anchor : child.id : void 0;
34758
34769
  if (id === void 0 && !child.hasDynamicChild) {
@@ -34760,19 +34771,19 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`) {
34760
34771
  continue;
34761
34772
  }
34762
34773
  const elementIndex = index + offset;
34763
- const logicalIndex = elementIndex - ifBranchCount + prependCount;
34774
+ const logicalIndex = child.logicalIndex !== void 0 ? String(child.logicalIndex) : void 0;
34764
34775
  const variable = id === void 0 ? context.pName(context.block.tempId++) : `n${id}`;
34765
34776
  pushBlock(NEWLINE, `const ${variable} = `);
34766
34777
  if (prev) {
34767
34778
  if (elementIndex - prev[1] === 1) {
34768
- pushBlock(...genCall(helper("next"), prev[0], String(logicalIndex)));
34779
+ pushBlock(...genCall(helper("next"), prev[0], logicalIndex));
34769
34780
  } else {
34770
34781
  pushBlock(
34771
34782
  ...genCall(
34772
34783
  helper("nthChild"),
34773
34784
  from,
34774
34785
  String(elementIndex),
34775
- String(logicalIndex)
34786
+ logicalIndex
34776
34787
  )
34777
34788
  );
34778
34789
  }
@@ -34782,19 +34793,19 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`) {
34782
34793
  ...genCall(
34783
34794
  helper("child"),
34784
34795
  from,
34785
- logicalIndex !== 0 ? String(logicalIndex) : void 0
34796
+ child.logicalIndex !== 0 ? logicalIndex : void 0
34786
34797
  )
34787
34798
  );
34788
34799
  } else {
34789
34800
  let init = genCall(helper("child"), from);
34790
34801
  if (elementIndex === 1) {
34791
- init = genCall(helper("next"), init, String(logicalIndex));
34802
+ init = genCall(helper("next"), init, logicalIndex);
34792
34803
  } else if (elementIndex > 1) {
34793
34804
  init = genCall(
34794
34805
  helper("nthChild"),
34795
34806
  from,
34796
34807
  String(elementIndex),
34797
- String(logicalIndex)
34808
+ logicalIndex
34798
34809
  );
34799
34810
  }
34800
34811
  pushBlock(...init);
@@ -35091,11 +35102,15 @@ function processDynamicChildren(context) {
35091
35102
  let dynamicCount = 0;
35092
35103
  let lastInsertionChild;
35093
35104
  const children = context.dynamic.children;
35105
+ let logicalIndex = 0;
35094
35106
  for (const [index, child] of children.entries()) {
35095
35107
  if (child.flags & 4) {
35108
+ child.logicalIndex = logicalIndex;
35096
35109
  prevDynamics.push(lastInsertionChild = child);
35110
+ logicalIndex++;
35097
35111
  }
35098
35112
  if (!(child.flags & 2)) {
35113
+ child.logicalIndex = logicalIndex;
35099
35114
  if (prevDynamics.length) {
35100
35115
  if (staticCount) {
35101
35116
  context.childrenTemplate[index - prevDynamics.length] = `<!>`;
@@ -35114,6 +35129,7 @@ function processDynamicChildren(context) {
35114
35129
  prevDynamics = [];
35115
35130
  }
35116
35131
  staticCount++;
35132
+ logicalIndex++;
35117
35133
  }
35118
35134
  }
35119
35135
  if (prevDynamics.length) {
@@ -35131,6 +35147,7 @@ function processDynamicChildren(context) {
35131
35147
  }
35132
35148
  function registerInsertion(dynamics, context, anchor, append) {
35133
35149
  for (const child of dynamics) {
35150
+ const logicalIndex = child.logicalIndex;
35134
35151
  if (child.template != null) {
35135
35152
  context.registerOperation({
35136
35153
  type: 9,
@@ -35141,6 +35158,7 @@ function registerInsertion(dynamics, context, anchor, append) {
35141
35158
  } else if (child.operation && isBlockOperation(child.operation)) {
35142
35159
  child.operation.parent = context.reference();
35143
35160
  child.operation.anchor = anchor;
35161
+ child.operation.logicalIndex = logicalIndex;
35144
35162
  child.operation.append = append;
35145
35163
  }
35146
35164
  }
@@ -35214,9 +35232,15 @@ function canOmitEndTag(node, context) {
35214
35232
  if (block !== parent.block) {
35215
35233
  return true;
35216
35234
  }
35235
+ if (isAlwaysCloseTag(node.tag) && !context.isOnRightmostPath) {
35236
+ return false;
35237
+ }
35217
35238
  if (isFormattingTag(node.tag) || parent.node.type === 1 && node.tag === parent.node.tag) {
35218
35239
  return context.isOnRightmostPath;
35219
35240
  }
35241
+ if (isBlockTag(node.tag) && context.hasInlineAncestorNeedingClose) {
35242
+ return false;
35243
+ }
35220
35244
  return context.isLastEffectiveChild;
35221
35245
  }
35222
35246
  function isSingleRoot(context) {
@@ -35763,6 +35787,7 @@ function markNonTemplate(node, context) {
35763
35787
  seen.get(context.root).add(node);
35764
35788
  }
35765
35789
  const transformText = (node, context) => {
35790
+ var _a;
35766
35791
  if (!seen.has(context.root)) seen.set(context.root, /* @__PURE__ */ new WeakSet());
35767
35792
  if (seen.get(context.root).has(node)) {
35768
35793
  context.dynamic.flags |= 2;
@@ -35796,7 +35821,9 @@ const transformText = (node, context) => {
35796
35821
  } else if (node.type === 5) {
35797
35822
  processInterpolation(context);
35798
35823
  } else if (node.type === 2) {
35799
- context.template += escapeHtml(node.content);
35824
+ const parent = (_a = context.parent) == null ? void 0 : _a.node;
35825
+ const isRootText = !parent || parent.type === 0 || parent.type === 1 && (parent.tagType === 3 || parent.tagType === 1);
35826
+ context.template += isRootText ? node.content : escapeHtml(node.content);
35800
35827
  }
35801
35828
  };
35802
35829
  function processInterpolation(context) {
@@ -36030,7 +36057,6 @@ function processIf(node, dir, context) {
36030
36057
  };
36031
36058
  } else {
36032
36059
  const siblingIf = getSiblingIf(context, true);
36033
- context.dynamic.ifBranch = true;
36034
36060
  const siblings = context.parent && context.parent.dynamic.children;
36035
36061
  let lastIfNode;
36036
36062
  if (siblings) {
@@ -36468,7 +36494,7 @@ function hasMultipleChildren(node) {
36468
36494
  (c, index) => c.type === 1 && // not template
36469
36495
  !isTemplateNode(c) && // not has v-for
36470
36496
  !findDir(c, "for") && // if the first child has v-if, the rest should also have v-else-if/v-else
36471
- (index === 0 ? findDir(c, "if") : hasElse(c)) && !hasMultipleChildren(c)
36497
+ (index === 0 ? findDir(c, "if") : hasElse(c))
36472
36498
  )) {
36473
36499
  return false;
36474
36500
  }
@@ -52537,16 +52563,18 @@ function resolveInterfaceMembers(ctx, node, scope, typeParameters) {
52537
52563
  (base.calls || (base.calls = [])).push(...calls);
52538
52564
  }
52539
52565
  } catch (e) {
52540
- ctx.error(
52541
- `Failed to resolve extends base type.
52566
+ if (!ctx.silentOnExtendsFailure) {
52567
+ ctx.error(
52568
+ `Failed to resolve extends base type.
52542
52569
  If this previously worked in 3.2, you can instruct the compiler to ignore this extend by adding /* @vue-ignore */ before it, for example:
52543
52570
 
52544
52571
  interface Props extends /* @vue-ignore */ Base {}
52545
52572
 
52546
52573
  Note: both in 3.2 or with the ignore, the properties in the base type are treated as fallthrough attrs at runtime.`,
52547
- ext,
52548
- scope
52549
- );
52574
+ ext,
52575
+ scope
52576
+ );
52577
+ }
52550
52578
  }
52551
52579
  }
52552
52580
  }
@@ -53152,6 +53180,17 @@ function recordType(node, types, declares, overwriteId) {
53152
53180
  case "TSInterfaceDeclaration":
53153
53181
  case "TSEnumDeclaration":
53154
53182
  case "TSModuleDeclaration": {
53183
+ if (node.type === "TSModuleDeclaration" && node.global) {
53184
+ const body = node.body;
53185
+ for (const s of body.body) {
53186
+ if (s.type === "ExportNamedDeclaration" && s.declaration) {
53187
+ recordType(s.declaration, types, declares);
53188
+ } else {
53189
+ recordType(s, types, declares);
53190
+ }
53191
+ }
53192
+ break;
53193
+ }
53155
53194
  const id = overwriteId || getId(node.id);
53156
53195
  let existing = types[id];
53157
53196
  if (existing) {
@@ -53256,6 +53295,8 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
53256
53295
  if (node.leadingComments && node.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
53257
53296
  return [UNKNOWN_TYPE];
53258
53297
  }
53298
+ const prevSilent = ctx.silentOnExtendsFailure;
53299
+ ctx.silentOnExtendsFailure = true;
53259
53300
  try {
53260
53301
  switch (node.type) {
53261
53302
  case "TSStringKeyword":
@@ -53560,18 +53601,32 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
53560
53601
  }
53561
53602
  }
53562
53603
  } catch (e) {
53604
+ } finally {
53605
+ ctx.silentOnExtendsFailure = prevSilent;
53563
53606
  }
53564
53607
  return [UNKNOWN_TYPE];
53565
53608
  }
53566
53609
  function flattenTypes(ctx, types, scope, isKeyOf = false, typeParameters = void 0) {
53567
53610
  if (types.length === 1) {
53568
- return inferRuntimeType(ctx, types[0], scope, isKeyOf, typeParameters);
53611
+ return inferRuntimeType(
53612
+ ctx,
53613
+ types[0],
53614
+ types[0]._ownerScope || scope,
53615
+ isKeyOf,
53616
+ typeParameters
53617
+ );
53569
53618
  }
53570
53619
  return [
53571
53620
  ...new Set(
53572
53621
  [].concat(
53573
53622
  ...types.map(
53574
- (t) => inferRuntimeType(ctx, t, scope, isKeyOf, typeParameters)
53623
+ (t) => inferRuntimeType(
53624
+ ctx,
53625
+ t,
53626
+ t._ownerScope || scope,
53627
+ isKeyOf,
53628
+ typeParameters
53629
+ )
53575
53630
  )
53576
53631
  )
53577
53632
  )
@@ -54139,8 +54194,6 @@ function transformDestructuredProps(ctx, vueImportAliases) {
54139
54194
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
54140
54195
  if (stmt.declare || !stmt.id) continue;
54141
54196
  registerLocalBinding(stmt.id);
54142
- } else if ((stmt.type === "ForOfStatement" || stmt.type === "ForInStatement") && stmt.left.type === "VariableDeclaration") {
54143
- walkVariableDeclaration(stmt.left);
54144
54197
  } else if (stmt.type === "ExportNamedDeclaration" && stmt.declaration && stmt.declaration.type === "VariableDeclaration") {
54145
54198
  walkVariableDeclaration(stmt.declaration, isRoot);
54146
54199
  } else if (stmt.type === "LabeledStatement" && stmt.body.type === "VariableDeclaration") {
@@ -54219,6 +54272,17 @@ function transformDestructuredProps(ctx, vueImportAliases) {
54219
54272
  walkScope(node.body);
54220
54273
  return;
54221
54274
  }
54275
+ if (node.type === "ForOfStatement" || node.type === "ForInStatement" || node.type === "ForStatement") {
54276
+ pushScope();
54277
+ const varDecl = node.type === "ForStatement" ? node.init : node.left;
54278
+ if (varDecl && varDecl.type === "VariableDeclaration") {
54279
+ walkVariableDeclaration(varDecl);
54280
+ }
54281
+ if (node.body.type === "BlockStatement") {
54282
+ walkScope(node.body);
54283
+ }
54284
+ return;
54285
+ }
54222
54286
  if (node.type === "BlockStatement" && !isFunctionType(parent)) {
54223
54287
  pushScope();
54224
54288
  walkScope(node);
@@ -54234,7 +54298,7 @@ function transformDestructuredProps(ctx, vueImportAliases) {
54234
54298
  },
54235
54299
  leave(node, parent) {
54236
54300
  parent && parentStack.pop();
54237
- if (node.type === "BlockStatement" && !isFunctionType(parent) || isFunctionType(node) || node.type === "CatchClause") {
54301
+ if (node.type === "BlockStatement" && !isFunctionType(parent) || isFunctionType(node) || node.type === "CatchClause" || node.type === "ForOfStatement" || node.type === "ForInStatement" || node.type === "ForStatement") {
54238
54302
  popScope();
54239
54303
  }
54240
54304
  }
@@ -55387,7 +55451,7 @@ var __spreadValues = (a, b) => {
55387
55451
  }
55388
55452
  return a;
55389
55453
  };
55390
- const version = "3.6.0-beta.3";
55454
+ const version = "3.6.0-beta.4";
55391
55455
  const parseCache = parseCache$1;
55392
55456
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
55393
55457
  const walk = walk$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.6.0-beta.3",
3
+ "version": "3.6.0-beta.4",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "module": "dist/compiler-sfc.esm-browser.js",
@@ -47,11 +47,11 @@
47
47
  "magic-string": "^0.30.21",
48
48
  "postcss": "^8.5.6",
49
49
  "source-map-js": "^1.2.1",
50
- "@vue/compiler-core": "3.6.0-beta.3",
51
- "@vue/compiler-ssr": "3.6.0-beta.3",
52
- "@vue/compiler-vapor": "3.6.0-beta.3",
53
- "@vue/compiler-dom": "3.6.0-beta.3",
54
- "@vue/shared": "3.6.0-beta.3"
50
+ "@vue/compiler-core": "3.6.0-beta.4",
51
+ "@vue/compiler-dom": "3.6.0-beta.4",
52
+ "@vue/compiler-ssr": "3.6.0-beta.4",
53
+ "@vue/compiler-vapor": "3.6.0-beta.4",
54
+ "@vue/shared": "3.6.0-beta.4"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@babel/types": "^7.28.5",