@vue/compiler-sfc 3.5.26 → 3.5.27

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.26
2
+ * @vue/compiler-sfc v3.5.27
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -22263,16 +22263,18 @@ function resolveInterfaceMembers(ctx, node, scope, typeParameters) {
22263
22263
  (base.calls || (base.calls = [])).push(...calls);
22264
22264
  }
22265
22265
  } catch (e) {
22266
- ctx.error(
22267
- `Failed to resolve extends base type.
22266
+ if (!ctx.silentOnExtendsFailure) {
22267
+ ctx.error(
22268
+ `Failed to resolve extends base type.
22268
22269
  If this previously worked in 3.2, you can instruct the compiler to ignore this extend by adding /* @vue-ignore */ before it, for example:
22269
22270
 
22270
22271
  interface Props extends /* @vue-ignore */ Base {}
22271
22272
 
22272
22273
  Note: both in 3.2 or with the ignore, the properties in the base type are treated as fallthrough attrs at runtime.`,
22273
- ext,
22274
- scope
22275
- );
22274
+ ext,
22275
+ scope
22276
+ );
22277
+ }
22276
22278
  }
22277
22279
  }
22278
22280
  }
@@ -22972,6 +22974,17 @@ function recordType(node, types, declares, overwriteId) {
22972
22974
  case "TSInterfaceDeclaration":
22973
22975
  case "TSEnumDeclaration":
22974
22976
  case "TSModuleDeclaration": {
22977
+ if (node.type === "TSModuleDeclaration" && node.global) {
22978
+ const body = node.body;
22979
+ for (const s of body.body) {
22980
+ if (s.type === "ExportNamedDeclaration" && s.declaration) {
22981
+ recordType(s.declaration, types, declares);
22982
+ } else {
22983
+ recordType(s, types, declares);
22984
+ }
22985
+ }
22986
+ break;
22987
+ }
22975
22988
  const id = overwriteId || getId(node.id);
22976
22989
  let existing = types[id];
22977
22990
  if (existing) {
@@ -23076,6 +23089,8 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
23076
23089
  if (node.leadingComments && node.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
23077
23090
  return [UNKNOWN_TYPE];
23078
23091
  }
23092
+ const prevSilent = ctx.silentOnExtendsFailure;
23093
+ ctx.silentOnExtendsFailure = true;
23079
23094
  try {
23080
23095
  switch (node.type) {
23081
23096
  case "TSStringKeyword":
@@ -23380,18 +23395,32 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
23380
23395
  }
23381
23396
  }
23382
23397
  } catch (e) {
23398
+ } finally {
23399
+ ctx.silentOnExtendsFailure = prevSilent;
23383
23400
  }
23384
23401
  return [UNKNOWN_TYPE];
23385
23402
  }
23386
23403
  function flattenTypes(ctx, types, scope, isKeyOf = false, typeParameters = void 0) {
23387
23404
  if (types.length === 1) {
23388
- return inferRuntimeType(ctx, types[0], scope, isKeyOf, typeParameters);
23405
+ return inferRuntimeType(
23406
+ ctx,
23407
+ types[0],
23408
+ types[0]._ownerScope || scope,
23409
+ isKeyOf,
23410
+ typeParameters
23411
+ );
23389
23412
  }
23390
23413
  return [
23391
23414
  ...new Set(
23392
23415
  [].concat(
23393
23416
  ...types.map(
23394
- (t) => inferRuntimeType(ctx, t, scope, isKeyOf, typeParameters)
23417
+ (t) => inferRuntimeType(
23418
+ ctx,
23419
+ t,
23420
+ t._ownerScope || scope,
23421
+ isKeyOf,
23422
+ typeParameters
23423
+ )
23395
23424
  )
23396
23425
  )
23397
23426
  )
@@ -23956,8 +23985,6 @@ function transformDestructuredProps(ctx, vueImportAliases) {
23956
23985
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
23957
23986
  if (stmt.declare || !stmt.id) continue;
23958
23987
  registerLocalBinding(stmt.id);
23959
- } else if ((stmt.type === "ForOfStatement" || stmt.type === "ForInStatement") && stmt.left.type === "VariableDeclaration") {
23960
- walkVariableDeclaration(stmt.left);
23961
23988
  } else if (stmt.type === "ExportNamedDeclaration" && stmt.declaration && stmt.declaration.type === "VariableDeclaration") {
23962
23989
  walkVariableDeclaration(stmt.declaration, isRoot);
23963
23990
  } else if (stmt.type === "LabeledStatement" && stmt.body.type === "VariableDeclaration") {
@@ -24036,6 +24063,17 @@ function transformDestructuredProps(ctx, vueImportAliases) {
24036
24063
  walkScope(node.body);
24037
24064
  return;
24038
24065
  }
24066
+ if (node.type === "ForOfStatement" || node.type === "ForInStatement" || node.type === "ForStatement") {
24067
+ pushScope();
24068
+ const varDecl = node.type === "ForStatement" ? node.init : node.left;
24069
+ if (varDecl && varDecl.type === "VariableDeclaration") {
24070
+ walkVariableDeclaration(varDecl);
24071
+ }
24072
+ if (node.body.type === "BlockStatement") {
24073
+ walkScope(node.body);
24074
+ }
24075
+ return;
24076
+ }
24039
24077
  if (node.type === "BlockStatement" && !CompilerDOM.isFunctionType(parent)) {
24040
24078
  pushScope();
24041
24079
  walkScope(node);
@@ -24051,7 +24089,7 @@ function transformDestructuredProps(ctx, vueImportAliases) {
24051
24089
  },
24052
24090
  leave(node, parent) {
24053
24091
  parent && parentStack.pop();
24054
- if (node.type === "BlockStatement" && !CompilerDOM.isFunctionType(parent) || CompilerDOM.isFunctionType(node) || node.type === "CatchClause") {
24092
+ if (node.type === "BlockStatement" && !CompilerDOM.isFunctionType(parent) || CompilerDOM.isFunctionType(node) || node.type === "CatchClause" || node.type === "ForOfStatement" || node.type === "ForInStatement" || node.type === "ForStatement") {
24055
24093
  popScope();
24056
24094
  }
24057
24095
  }
@@ -25143,7 +25181,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
25143
25181
  return generator.toJSON();
25144
25182
  }
25145
25183
 
25146
- const version = "3.5.26";
25184
+ const version = "3.5.27";
25147
25185
  const parseCache = parseCache$1;
25148
25186
  const errorMessages = {
25149
25187
  ...CompilerDOM.errorMessages,
@@ -415,11 +415,13 @@ export type SimpleTypeResolveOptions = Partial<Pick<SFCScriptCompileOptions, 'gl
415
415
  * }
416
416
  * ```
417
417
  */
418
- export type SimpleTypeResolveContext = Pick<ScriptCompileContext, 'source' | 'filename' | 'error' | 'helper' | 'getString' | 'propsTypeDecl' | 'propsRuntimeDefaults' | 'propsDestructuredBindings' | 'emitsTypeDecl' | 'isCE'> & Partial<Pick<ScriptCompileContext, 'scope' | 'globalScopes' | 'deps' | 'fs'>> & {
418
+ export type SimpleTypeResolveContext = Pick<ScriptCompileContext, 'source' | 'filename' | 'error' | 'warn' | 'helper' | 'getString' | 'propsTypeDecl' | 'propsRuntimeDefaults' | 'propsDestructuredBindings' | 'emitsTypeDecl' | 'isCE'> & Partial<Pick<ScriptCompileContext, 'scope' | 'globalScopes' | 'deps' | 'fs'>> & {
419
419
  ast: Statement[];
420
420
  options: SimpleTypeResolveOptions;
421
421
  };
422
- export type TypeResolveContext = ScriptCompileContext | SimpleTypeResolveContext;
422
+ export type TypeResolveContext = (ScriptCompileContext | SimpleTypeResolveContext) & {
423
+ silentOnExtendsFailure?: boolean;
424
+ };
423
425
  type Import = Pick<ImportBinding, 'source' | 'imported'>;
424
426
  interface WithScope {
425
427
  _ownerScope: TypeScope;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.5.26
2
+ * @vue/compiler-sfc v3.5.27
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -47988,16 +47988,18 @@ function resolveInterfaceMembers(ctx, node, scope, typeParameters) {
47988
47988
  (base.calls || (base.calls = [])).push(...calls);
47989
47989
  }
47990
47990
  } catch (e) {
47991
- ctx.error(
47992
- `Failed to resolve extends base type.
47991
+ if (!ctx.silentOnExtendsFailure) {
47992
+ ctx.error(
47993
+ `Failed to resolve extends base type.
47993
47994
  If this previously worked in 3.2, you can instruct the compiler to ignore this extend by adding /* @vue-ignore */ before it, for example:
47994
47995
 
47995
47996
  interface Props extends /* @vue-ignore */ Base {}
47996
47997
 
47997
47998
  Note: both in 3.2 or with the ignore, the properties in the base type are treated as fallthrough attrs at runtime.`,
47998
- ext,
47999
- scope
48000
- );
47999
+ ext,
48000
+ scope
48001
+ );
48002
+ }
48001
48003
  }
48002
48004
  }
48003
48005
  }
@@ -48603,6 +48605,17 @@ function recordType(node, types, declares, overwriteId) {
48603
48605
  case "TSInterfaceDeclaration":
48604
48606
  case "TSEnumDeclaration":
48605
48607
  case "TSModuleDeclaration": {
48608
+ if (node.type === "TSModuleDeclaration" && node.global) {
48609
+ const body = node.body;
48610
+ for (const s of body.body) {
48611
+ if (s.type === "ExportNamedDeclaration" && s.declaration) {
48612
+ recordType(s.declaration, types, declares);
48613
+ } else {
48614
+ recordType(s, types, declares);
48615
+ }
48616
+ }
48617
+ break;
48618
+ }
48606
48619
  const id = overwriteId || getId(node.id);
48607
48620
  let existing = types[id];
48608
48621
  if (existing) {
@@ -48707,6 +48720,8 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
48707
48720
  if (node.leadingComments && node.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
48708
48721
  return [UNKNOWN_TYPE];
48709
48722
  }
48723
+ const prevSilent = ctx.silentOnExtendsFailure;
48724
+ ctx.silentOnExtendsFailure = true;
48710
48725
  try {
48711
48726
  switch (node.type) {
48712
48727
  case "TSStringKeyword":
@@ -49011,18 +49026,32 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
49011
49026
  }
49012
49027
  }
49013
49028
  } catch (e) {
49029
+ } finally {
49030
+ ctx.silentOnExtendsFailure = prevSilent;
49014
49031
  }
49015
49032
  return [UNKNOWN_TYPE];
49016
49033
  }
49017
49034
  function flattenTypes(ctx, types, scope, isKeyOf = false, typeParameters = void 0) {
49018
49035
  if (types.length === 1) {
49019
- return inferRuntimeType(ctx, types[0], scope, isKeyOf, typeParameters);
49036
+ return inferRuntimeType(
49037
+ ctx,
49038
+ types[0],
49039
+ types[0]._ownerScope || scope,
49040
+ isKeyOf,
49041
+ typeParameters
49042
+ );
49020
49043
  }
49021
49044
  return [
49022
49045
  ...new Set(
49023
49046
  [].concat(
49024
49047
  ...types.map(
49025
- (t) => inferRuntimeType(ctx, t, scope, isKeyOf, typeParameters)
49048
+ (t) => inferRuntimeType(
49049
+ ctx,
49050
+ t,
49051
+ t._ownerScope || scope,
49052
+ isKeyOf,
49053
+ typeParameters
49054
+ )
49026
49055
  )
49027
49056
  )
49028
49057
  )
@@ -49587,8 +49616,6 @@ function transformDestructuredProps(ctx, vueImportAliases) {
49587
49616
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
49588
49617
  if (stmt.declare || !stmt.id) continue;
49589
49618
  registerLocalBinding(stmt.id);
49590
- } else if ((stmt.type === "ForOfStatement" || stmt.type === "ForInStatement") && stmt.left.type === "VariableDeclaration") {
49591
- walkVariableDeclaration(stmt.left);
49592
49619
  } else if (stmt.type === "ExportNamedDeclaration" && stmt.declaration && stmt.declaration.type === "VariableDeclaration") {
49593
49620
  walkVariableDeclaration(stmt.declaration, isRoot);
49594
49621
  } else if (stmt.type === "LabeledStatement" && stmt.body.type === "VariableDeclaration") {
@@ -49667,6 +49694,17 @@ function transformDestructuredProps(ctx, vueImportAliases) {
49667
49694
  walkScope(node.body);
49668
49695
  return;
49669
49696
  }
49697
+ if (node.type === "ForOfStatement" || node.type === "ForInStatement" || node.type === "ForStatement") {
49698
+ pushScope();
49699
+ const varDecl = node.type === "ForStatement" ? node.init : node.left;
49700
+ if (varDecl && varDecl.type === "VariableDeclaration") {
49701
+ walkVariableDeclaration(varDecl);
49702
+ }
49703
+ if (node.body.type === "BlockStatement") {
49704
+ walkScope(node.body);
49705
+ }
49706
+ return;
49707
+ }
49670
49708
  if (node.type === "BlockStatement" && !isFunctionType(parent)) {
49671
49709
  pushScope();
49672
49710
  walkScope(node);
@@ -49682,7 +49720,7 @@ function transformDestructuredProps(ctx, vueImportAliases) {
49682
49720
  },
49683
49721
  leave(node, parent) {
49684
49722
  parent && parentStack.pop();
49685
- if (node.type === "BlockStatement" && !isFunctionType(parent) || isFunctionType(node) || node.type === "CatchClause") {
49723
+ if (node.type === "BlockStatement" && !isFunctionType(parent) || isFunctionType(node) || node.type === "CatchClause" || node.type === "ForOfStatement" || node.type === "ForInStatement" || node.type === "ForStatement") {
49686
49724
  popScope();
49687
49725
  }
49688
49726
  }
@@ -50804,7 +50842,7 @@ var __spreadValues = (a, b) => {
50804
50842
  }
50805
50843
  return a;
50806
50844
  };
50807
- const version = "3.5.26";
50845
+ const version = "3.5.27";
50808
50846
  const parseCache = parseCache$1;
50809
50847
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
50810
50848
  const walk = walk$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.5.26",
3
+ "version": "3.5.27",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "module": "dist/compiler-sfc.esm-browser.js",
@@ -47,10 +47,10 @@
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.5.26",
51
- "@vue/compiler-dom": "3.5.26",
52
- "@vue/compiler-ssr": "3.5.26",
53
- "@vue/shared": "3.5.26"
50
+ "@vue/compiler-ssr": "3.5.27",
51
+ "@vue/compiler-core": "3.5.27",
52
+ "@vue/compiler-dom": "3.5.27",
53
+ "@vue/shared": "3.5.27"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/types": "^7.28.5",