@vue/compiler-core 3.4.24 → 3.4.26

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-core v3.4.24
2
+ * @vue/compiler-core v3.4.26
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2195,11 +2195,10 @@ const tokenizer = new Tokenizer(stack, {
2195
2195
  }
2196
2196
  },
2197
2197
  onselfclosingtag(end) {
2198
- var _a;
2199
2198
  const name = currentOpenTag.tag;
2200
2199
  currentOpenTag.isSelfClosing = true;
2201
2200
  endOpenTag(end);
2202
- if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
2201
+ if (stack[0] && stack[0].tag === name) {
2203
2202
  onCloseTag(stack.shift(), end);
2204
2203
  }
2205
2204
  },
@@ -2515,7 +2514,7 @@ function endOpenTag(end) {
2515
2514
  function onText(content, start, end) {
2516
2515
  const parent = stack[0] || currentRoot;
2517
2516
  const lastNode = parent.children[parent.children.length - 1];
2518
- if ((lastNode == null ? void 0 : lastNode.type) === 2) {
2517
+ if (lastNode && lastNode.type === 2) {
2519
2518
  lastNode.content += content;
2520
2519
  setLocEnd(lastNode.loc, end);
2521
2520
  } else {
@@ -2649,11 +2648,10 @@ function isFragmentTemplate({ tag, props }) {
2649
2648
  return false;
2650
2649
  }
2651
2650
  function isComponent({ tag, props }) {
2652
- var _a;
2653
2651
  if (currentOptions.isCustomElement(tag)) {
2654
2652
  return false;
2655
2653
  }
2656
- if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
2654
+ if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
2657
2655
  return true;
2658
2656
  }
2659
2657
  for (let i = 0; i < props.length; i++) {
@@ -2686,7 +2684,6 @@ function isUpperCase(c) {
2686
2684
  }
2687
2685
  const windowsNewlineRE = /\r\n/g;
2688
2686
  function condenseWhitespace(nodes, tag) {
2689
- var _a, _b;
2690
2687
  const shouldCondense = currentOptions.whitespace !== "preserve";
2691
2688
  let removedWhitespace = false;
2692
2689
  for (let i = 0; i < nodes.length; i++) {
@@ -2694,8 +2691,8 @@ function condenseWhitespace(nodes, tag) {
2694
2691
  if (node.type === 2) {
2695
2692
  if (!inPre) {
2696
2693
  if (isAllWhitespace(node.content)) {
2697
- const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
2698
- const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
2694
+ const prev = nodes[i - 1] && nodes[i - 1].type;
2695
+ const next = nodes[i + 1] && nodes[i + 1].type;
2699
2696
  if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
2700
2697
  removedWhitespace = true;
2701
2698
  nodes[i] = null;
@@ -2855,7 +2852,7 @@ function baseParse(input, options) {
2855
2852
  }
2856
2853
  tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
2857
2854
  tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
2858
- const delimiters = options == null ? void 0 : options.delimiters;
2855
+ const delimiters = options && options.delimiters;
2859
2856
  if (delimiters) {
2860
2857
  tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
2861
2858
  tokenizer.delimiterClose = toCharCodes(delimiters[1]);
@@ -4213,7 +4210,6 @@ function genReturnStatement({ returns }, context) {
4213
4210
  }
4214
4211
 
4215
4212
  const isLiteralWhitelisted = /* @__PURE__ */ shared.makeMap("true,false,null,this");
4216
- const constantBailRE = /\w\s*\(|\.[^\d]/;
4217
4213
  const transformExpression = (node, context) => {
4218
4214
  if (node.type === 5) {
4219
4215
  node.content = processExpression(
@@ -4308,7 +4304,6 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
4308
4304
  return `_ctx.${raw}`;
4309
4305
  };
4310
4306
  const rawExp = node.content;
4311
- const bailConstant = constantBailRE.test(rawExp);
4312
4307
  let ast = node.ast;
4313
4308
  if (ast === false) {
4314
4309
  return node;
@@ -4370,7 +4365,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
4370
4365
  node2.name = rewriteIdentifier(node2.name, parent, node2);
4371
4366
  ids.push(node2);
4372
4367
  } else {
4373
- if (!(needPrefix && isLocal) && !bailConstant) {
4368
+ if (!(needPrefix && isLocal) && parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "MemberExpression") {
4374
4369
  node2.isConstant = true;
4375
4370
  }
4376
4371
  ids.push(node2);
@@ -4414,7 +4409,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
4414
4409
  ret.ast = ast;
4415
4410
  } else {
4416
4411
  ret = node;
4417
- ret.constType = bailConstant ? 0 : 3;
4412
+ ret.constType = 3;
4418
4413
  }
4419
4414
  ret.identifiers = Object.keys(knownIds);
4420
4415
  return ret;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-core v3.4.24
2
+ * @vue/compiler-core v3.4.26
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2191,11 +2191,10 @@ const tokenizer = new Tokenizer(stack, {
2191
2191
  }
2192
2192
  },
2193
2193
  onselfclosingtag(end) {
2194
- var _a;
2195
2194
  const name = currentOpenTag.tag;
2196
2195
  currentOpenTag.isSelfClosing = true;
2197
2196
  endOpenTag(end);
2198
- if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
2197
+ if (stack[0] && stack[0].tag === name) {
2199
2198
  onCloseTag(stack.shift(), end);
2200
2199
  }
2201
2200
  },
@@ -2511,7 +2510,7 @@ function endOpenTag(end) {
2511
2510
  function onText(content, start, end) {
2512
2511
  const parent = stack[0] || currentRoot;
2513
2512
  const lastNode = parent.children[parent.children.length - 1];
2514
- if ((lastNode == null ? void 0 : lastNode.type) === 2) {
2513
+ if (lastNode && lastNode.type === 2) {
2515
2514
  lastNode.content += content;
2516
2515
  setLocEnd(lastNode.loc, end);
2517
2516
  } else {
@@ -2615,11 +2614,10 @@ function isFragmentTemplate({ tag, props }) {
2615
2614
  return false;
2616
2615
  }
2617
2616
  function isComponent({ tag, props }) {
2618
- var _a;
2619
2617
  if (currentOptions.isCustomElement(tag)) {
2620
2618
  return false;
2621
2619
  }
2622
- if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
2620
+ if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
2623
2621
  return true;
2624
2622
  }
2625
2623
  for (let i = 0; i < props.length; i++) {
@@ -2652,7 +2650,6 @@ function isUpperCase(c) {
2652
2650
  }
2653
2651
  const windowsNewlineRE = /\r\n/g;
2654
2652
  function condenseWhitespace(nodes, tag) {
2655
- var _a, _b;
2656
2653
  const shouldCondense = currentOptions.whitespace !== "preserve";
2657
2654
  let removedWhitespace = false;
2658
2655
  for (let i = 0; i < nodes.length; i++) {
@@ -2660,8 +2657,8 @@ function condenseWhitespace(nodes, tag) {
2660
2657
  if (node.type === 2) {
2661
2658
  if (!inPre) {
2662
2659
  if (isAllWhitespace(node.content)) {
2663
- const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
2664
- const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
2660
+ const prev = nodes[i - 1] && nodes[i - 1].type;
2661
+ const next = nodes[i + 1] && nodes[i + 1].type;
2665
2662
  if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
2666
2663
  removedWhitespace = true;
2667
2664
  nodes[i] = null;
@@ -2814,7 +2811,7 @@ function baseParse(input, options) {
2814
2811
  }
2815
2812
  tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
2816
2813
  tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
2817
- const delimiters = options == null ? void 0 : options.delimiters;
2814
+ const delimiters = options && options.delimiters;
2818
2815
  if (delimiters) {
2819
2816
  tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
2820
2817
  tokenizer.delimiterClose = toCharCodes(delimiters[1]);
@@ -4142,7 +4139,6 @@ function genReturnStatement({ returns }, context) {
4142
4139
  }
4143
4140
 
4144
4141
  const isLiteralWhitelisted = /* @__PURE__ */ shared.makeMap("true,false,null,this");
4145
- const constantBailRE = /\w\s*\(|\.[^\d]/;
4146
4142
  const transformExpression = (node, context) => {
4147
4143
  if (node.type === 5) {
4148
4144
  node.content = processExpression(
@@ -4237,7 +4233,6 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
4237
4233
  return `_ctx.${raw}`;
4238
4234
  };
4239
4235
  const rawExp = node.content;
4240
- const bailConstant = constantBailRE.test(rawExp);
4241
4236
  let ast = node.ast;
4242
4237
  if (ast === false) {
4243
4238
  return node;
@@ -4299,7 +4294,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
4299
4294
  node2.name = rewriteIdentifier(node2.name, parent, node2);
4300
4295
  ids.push(node2);
4301
4296
  } else {
4302
- if (!(needPrefix && isLocal) && !bailConstant) {
4297
+ if (!(needPrefix && isLocal) && parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "MemberExpression") {
4303
4298
  node2.isConstant = true;
4304
4299
  }
4305
4300
  ids.push(node2);
@@ -4343,7 +4338,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
4343
4338
  ret.ast = ast;
4344
4339
  } else {
4345
4340
  ret = node;
4346
- ret.constType = bailConstant ? 0 : 3;
4341
+ ret.constType = 3;
4347
4342
  }
4348
4343
  ret.identifiers = Object.keys(knownIds);
4349
4344
  return ret;
@@ -1022,6 +1022,9 @@ export declare function hasScopeRef(node: TemplateChildNode | IfBranchNode | Exp
1022
1022
  export declare function getMemoedVNodeCall(node: BlockCodegenNode | MemoExpression): VNodeCall | RenderSlotCall;
1023
1023
  export declare const forAliasRE: RegExp;
1024
1024
 
1025
+ /**
1026
+ * Return value indicates whether the AST walked can be a constant
1027
+ */
1025
1028
  export declare function walkIdentifiers(root: Node$1, onIdentifier: (node: Identifier, parent: Node$1, parentStack: Node$1[], isReference: boolean, isLocal: boolean) => void, includeAll?: boolean, parentStack?: Node$1[], knownIds?: Record<string, number>): void;
1026
1029
  export declare function isReferencedIdentifier(id: Identifier, parent: Node$1 | null, parentStack: Node$1[]): boolean;
1027
1030
  export declare function isInDestructureAssignment(parent: Node$1, parentStack: Node$1[]): boolean;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-core v3.4.24
2
+ * @vue/compiler-core v3.4.26
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1959,11 +1959,10 @@ const tokenizer = new Tokenizer(stack, {
1959
1959
  }
1960
1960
  },
1961
1961
  onselfclosingtag(end) {
1962
- var _a;
1963
1962
  const name = currentOpenTag.tag;
1964
1963
  currentOpenTag.isSelfClosing = true;
1965
1964
  endOpenTag(end);
1966
- if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
1965
+ if (stack[0] && stack[0].tag === name) {
1967
1966
  onCloseTag(stack.shift(), end);
1968
1967
  }
1969
1968
  },
@@ -2274,16 +2273,15 @@ function endOpenTag(end) {
2274
2273
  currentOpenTag = null;
2275
2274
  }
2276
2275
  function onText(content, start, end) {
2277
- var _a;
2278
2276
  {
2279
- const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
2277
+ const tag = stack[0] && stack[0].tag;
2280
2278
  if (tag !== "script" && tag !== "style" && content.includes("&")) {
2281
2279
  content = currentOptions.decodeEntities(content, false);
2282
2280
  }
2283
2281
  }
2284
2282
  const parent = stack[0] || currentRoot;
2285
2283
  const lastNode = parent.children[parent.children.length - 1];
2286
- if ((lastNode == null ? void 0 : lastNode.type) === 2) {
2284
+ if (lastNode && lastNode.type === 2) {
2287
2285
  lastNode.content += content;
2288
2286
  setLocEnd(lastNode.loc, end);
2289
2287
  } else {
@@ -2417,11 +2415,10 @@ function isFragmentTemplate({ tag, props }) {
2417
2415
  return false;
2418
2416
  }
2419
2417
  function isComponent({ tag, props }) {
2420
- var _a;
2421
2418
  if (currentOptions.isCustomElement(tag)) {
2422
2419
  return false;
2423
2420
  }
2424
- if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
2421
+ if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
2425
2422
  return true;
2426
2423
  }
2427
2424
  for (let i = 0; i < props.length; i++) {
@@ -2454,7 +2451,6 @@ function isUpperCase(c) {
2454
2451
  }
2455
2452
  const windowsNewlineRE = /\r\n/g;
2456
2453
  function condenseWhitespace(nodes, tag) {
2457
- var _a, _b;
2458
2454
  const shouldCondense = currentOptions.whitespace !== "preserve";
2459
2455
  let removedWhitespace = false;
2460
2456
  for (let i = 0; i < nodes.length; i++) {
@@ -2462,8 +2458,8 @@ function condenseWhitespace(nodes, tag) {
2462
2458
  if (node.type === 2) {
2463
2459
  if (!inPre) {
2464
2460
  if (isAllWhitespace(node.content)) {
2465
- const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
2466
- const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
2461
+ const prev = nodes[i - 1] && nodes[i - 1].type;
2462
+ const next = nodes[i + 1] && nodes[i + 1].type;
2467
2463
  if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
2468
2464
  removedWhitespace = true;
2469
2465
  nodes[i] = null;
@@ -2601,7 +2597,7 @@ function baseParse(input, options) {
2601
2597
  }
2602
2598
  tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
2603
2599
  tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
2604
- const delimiters = options == null ? void 0 : options.delimiters;
2600
+ const delimiters = options && options.delimiters;
2605
2601
  if (delimiters) {
2606
2602
  tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
2607
2603
  tokenizer.delimiterClose = toCharCodes(delimiters[1]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-core",
3
- "version": "3.4.24",
3
+ "version": "3.4.26",
4
4
  "description": "@vue/compiler-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/compiler-core.esm-bundler.js",
@@ -50,7 +50,7 @@
50
50
  "entities": "^4.5.0",
51
51
  "estree-walker": "^2.0.2",
52
52
  "source-map-js": "^1.2.0",
53
- "@vue/shared": "3.4.24"
53
+ "@vue/shared": "3.4.26"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/types": "^7.24.0"