@vue/compiler-sfc 3.4.26 → 3.4.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.4.26
2
+ * @vue/compiler-sfc v3.4.27
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -4826,7 +4826,7 @@ types$1.UNIVERSAL = UNIVERSAL;
4826
4826
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
4827
4827
  function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike ) { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4828
4828
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4829
- function _arrayLikeToArray(arr, len) { len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
4829
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
4830
4830
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
4831
4831
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4832
4832
  function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
@@ -12000,6 +12000,10 @@ var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
12000
12000
  function baseSlice(array, start, end) {
12001
12001
  var index = -1,
12002
12002
  length = array.length;
12003
+
12004
+ if (start < 0) {
12005
+ start = -start > length ? 0 : (length + start);
12006
+ }
12003
12007
  end = end > length ? length : end;
12004
12008
  if (end < 0) {
12005
12009
  end += length;
@@ -12046,7 +12050,7 @@ function baseToString(value) {
12046
12050
  function castSlice(array, start, end) {
12047
12051
  var length = array.length;
12048
12052
  end = end === undefined ? length : end;
12049
- return baseSlice(array, start, end);
12053
+ return (!start && end >= length) ? array : baseSlice(array, start, end);
12050
12054
  }
12051
12055
 
12052
12056
  /**
@@ -18934,7 +18938,7 @@ function recordImport(node, imports) {
18934
18938
  };
18935
18939
  }
18936
18940
  }
18937
- function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)) {
18941
+ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx), isKeyOf = false) {
18938
18942
  try {
18939
18943
  switch (node.type) {
18940
18944
  case "TSStringKeyword":
@@ -18952,7 +18956,13 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
18952
18956
  const types = /* @__PURE__ */ new Set();
18953
18957
  const members = node.type === "TSTypeLiteral" ? node.members : node.body.body;
18954
18958
  for (const m of members) {
18955
- if (m.type === "TSCallSignatureDeclaration" || m.type === "TSConstructSignatureDeclaration") {
18959
+ if (isKeyOf) {
18960
+ if (m.type === "TSPropertySignature" && m.key.type === "NumericLiteral") {
18961
+ types.add("Number");
18962
+ } else {
18963
+ types.add("String");
18964
+ }
18965
+ } else if (m.type === "TSCallSignatureDeclaration" || m.type === "TSConstructSignatureDeclaration") {
18956
18966
  types.add("Function");
18957
18967
  } else {
18958
18968
  types.add("Object");
@@ -18990,9 +19000,20 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
18990
19000
  case "TSTypeReference": {
18991
19001
  const resolved = resolveTypeReference(ctx, node, scope);
18992
19002
  if (resolved) {
18993
- return inferRuntimeType(ctx, resolved, resolved._ownerScope);
19003
+ return inferRuntimeType(ctx, resolved, resolved._ownerScope, isKeyOf);
18994
19004
  }
18995
19005
  if (node.typeName.type === "Identifier") {
19006
+ if (isKeyOf) {
19007
+ switch (node.typeName.name) {
19008
+ case "String":
19009
+ case "Array":
19010
+ case "ArrayLike":
19011
+ case "ReadonlyArray":
19012
+ return ["String", "Number"];
19013
+ default:
19014
+ return ["String"];
19015
+ }
19016
+ }
18996
19017
  switch (node.typeName.name) {
18997
19018
  case "Array":
18998
19019
  case "Function":
@@ -19095,13 +19116,18 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
19095
19116
  if (id.type === "Identifier") {
19096
19117
  const matched = scope.declares[id.name];
19097
19118
  if (matched) {
19098
- return inferRuntimeType(ctx, matched, matched._ownerScope);
19119
+ return inferRuntimeType(ctx, matched, matched._ownerScope, isKeyOf);
19099
19120
  }
19100
19121
  }
19101
19122
  break;
19102
19123
  }
19103
19124
  case "TSTypeOperator": {
19104
- return inferRuntimeType(ctx, node.typeAnnotation, scope);
19125
+ return inferRuntimeType(
19126
+ ctx,
19127
+ node.typeAnnotation,
19128
+ scope,
19129
+ node.operator === "keyof"
19130
+ );
19105
19131
  }
19106
19132
  }
19107
19133
  } catch (e) {
@@ -20763,7 +20789,7 @@ function isStaticNode(node) {
20763
20789
  return false;
20764
20790
  }
20765
20791
 
20766
- const version = "3.4.26";
20792
+ const version = "3.4.27";
20767
20793
  const parseCache = parseCache$1;
20768
20794
  const errorMessages = {
20769
20795
  ...CompilerDOM.errorMessages,
@@ -467,7 +467,7 @@ export declare function registerTS(_loadTS: () => typeof TS): void;
467
467
  * @private
468
468
  */
469
469
  export declare function invalidateTypeCache(filename: string): void;
470
- export declare function inferRuntimeType(ctx: TypeResolveContext, node: Node & MaybeWithScope, scope?: TypeScope): string[];
470
+ export declare function inferRuntimeType(ctx: TypeResolveContext, node: Node & MaybeWithScope, scope?: TypeScope, isKeyOf?: boolean): string[];
471
471
 
472
472
  export declare function extractRuntimeEmits(ctx: TypeResolveContext): Set<string>;
473
473
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.4.26
2
+ * @vue/compiler-sfc v3.4.27
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -166,8 +166,8 @@ function stringifyStyle(styles) {
166
166
  }
167
167
  for (const key in styles) {
168
168
  const value = styles[key];
169
- const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
170
169
  if (isString$2(value) || typeof value === "number") {
170
+ const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
171
171
  ret += `${normalizedKey}:${value};`;
172
172
  }
173
173
  }
@@ -24144,7 +24144,7 @@ function processSlotOutlet(node, context) {
24144
24144
  };
24145
24145
  }
24146
24146
 
24147
- const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
24147
+ const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
24148
24148
  const transformOn$1 = (dir, node, context, augmentor) => {
24149
24149
  const { loc, modifiers, arg } = dir;
24150
24150
  if (!dir.exp && !modifiers.length) {
@@ -25114,6 +25114,7 @@ function analyzeNode(node) {
25114
25114
  return false;
25115
25115
  };
25116
25116
  function walk(node2) {
25117
+ const isOptionTag = node2.tag === "option" && node2.ns === 0;
25117
25118
  for (let i = 0; i < node2.props.length; i++) {
25118
25119
  const p = node2.props[i];
25119
25120
  if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
@@ -25126,6 +25127,9 @@ function analyzeNode(node) {
25126
25127
  if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
25127
25128
  return bail();
25128
25129
  }
25130
+ if (isOptionTag && isStaticArgOf(p.arg, "value") && p.exp && p.exp.ast && p.exp.ast.type !== "StringLiteral") {
25131
+ return bail();
25132
+ }
25129
25133
  }
25130
25134
  }
25131
25135
  for (let i = 0; i < node2.children.length; i++) {
@@ -37220,7 +37224,7 @@ types.UNIVERSAL = UNIVERSAL;
37220
37224
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
37221
37225
  function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike ) { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
37222
37226
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
37223
- function _arrayLikeToArray(arr, len) { len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
37227
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
37224
37228
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
37225
37229
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
37226
37230
  function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
@@ -46505,7 +46509,7 @@ function recordImport(node, imports) {
46505
46509
  };
46506
46510
  }
46507
46511
  }
46508
- function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)) {
46512
+ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx), isKeyOf = false) {
46509
46513
  try {
46510
46514
  switch (node.type) {
46511
46515
  case "TSStringKeyword":
@@ -46523,7 +46527,13 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
46523
46527
  const types = /* @__PURE__ */ new Set();
46524
46528
  const members = node.type === "TSTypeLiteral" ? node.members : node.body.body;
46525
46529
  for (const m of members) {
46526
- if (m.type === "TSCallSignatureDeclaration" || m.type === "TSConstructSignatureDeclaration") {
46530
+ if (isKeyOf) {
46531
+ if (m.type === "TSPropertySignature" && m.key.type === "NumericLiteral") {
46532
+ types.add("Number");
46533
+ } else {
46534
+ types.add("String");
46535
+ }
46536
+ } else if (m.type === "TSCallSignatureDeclaration" || m.type === "TSConstructSignatureDeclaration") {
46527
46537
  types.add("Function");
46528
46538
  } else {
46529
46539
  types.add("Object");
@@ -46561,9 +46571,20 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
46561
46571
  case "TSTypeReference": {
46562
46572
  const resolved = resolveTypeReference(ctx, node, scope);
46563
46573
  if (resolved) {
46564
- return inferRuntimeType(ctx, resolved, resolved._ownerScope);
46574
+ return inferRuntimeType(ctx, resolved, resolved._ownerScope, isKeyOf);
46565
46575
  }
46566
46576
  if (node.typeName.type === "Identifier") {
46577
+ if (isKeyOf) {
46578
+ switch (node.typeName.name) {
46579
+ case "String":
46580
+ case "Array":
46581
+ case "ArrayLike":
46582
+ case "ReadonlyArray":
46583
+ return ["String", "Number"];
46584
+ default:
46585
+ return ["String"];
46586
+ }
46587
+ }
46567
46588
  switch (node.typeName.name) {
46568
46589
  case "Array":
46569
46590
  case "Function":
@@ -46666,13 +46687,18 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
46666
46687
  if (id.type === "Identifier") {
46667
46688
  const matched = scope.declares[id.name];
46668
46689
  if (matched) {
46669
- return inferRuntimeType(ctx, matched, matched._ownerScope);
46690
+ return inferRuntimeType(ctx, matched, matched._ownerScope, isKeyOf);
46670
46691
  }
46671
46692
  }
46672
46693
  break;
46673
46694
  }
46674
46695
  case "TSTypeOperator": {
46675
- return inferRuntimeType(ctx, node.typeAnnotation, scope);
46696
+ return inferRuntimeType(
46697
+ ctx,
46698
+ node.typeAnnotation,
46699
+ scope,
46700
+ node.operator === "keyof"
46701
+ );
46676
46702
  }
46677
46703
  }
46678
46704
  } catch (e) {
@@ -48364,7 +48390,7 @@ var __spreadValues = (a, b) => {
48364
48390
  }
48365
48391
  return a;
48366
48392
  };
48367
- const version = "3.4.26";
48393
+ const version = "3.4.27";
48368
48394
  const parseCache = parseCache$1;
48369
48395
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
48370
48396
  const walk = walk$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.4.26",
3
+ "version": "3.4.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.10",
48
48
  "postcss": "^8.4.38",
49
49
  "source-map-js": "^1.2.0",
50
- "@vue/compiler-core": "3.4.26",
51
- "@vue/shared": "3.4.26",
52
- "@vue/compiler-dom": "3.4.26",
53
- "@vue/compiler-ssr": "3.4.26"
50
+ "@vue/shared": "3.4.27",
51
+ "@vue/compiler-core": "3.4.27",
52
+ "@vue/compiler-ssr": "3.4.27",
53
+ "@vue/compiler-dom": "3.4.27"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/types": "^7.24.0",
@@ -62,6 +62,6 @@
62
62
  "postcss-modules": "^6.0.0",
63
63
  "postcss-selector-parser": "^6.0.16",
64
64
  "pug": "^3.0.2",
65
- "sass": "^1.75.0"
65
+ "sass": "^1.76.0"
66
66
  }
67
67
  }