@vue/compiler-core 3.4.22 → 3.4.24

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.22
2
+ * @vue/compiler-core v3.4.24
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1715,7 +1715,7 @@ function isReferenced(node, parent, grandparent) {
1715
1715
  if (parent.key === node) {
1716
1716
  return !!parent.computed;
1717
1717
  }
1718
- return !grandparent || grandparent.type !== "ObjectPattern";
1718
+ return !grandparent ;
1719
1719
  case "ClassProperty":
1720
1720
  if (parent.key === node) {
1721
1721
  return !!parent.computed;
@@ -1746,9 +1746,6 @@ function isReferenced(node, parent, grandparent) {
1746
1746
  case "ExportDefaultSpecifier":
1747
1747
  return false;
1748
1748
  case "ExportSpecifier":
1749
- if (grandparent == null ? void 0 : grandparent.source) {
1750
- return false;
1751
- }
1752
1749
  return parent.local === node;
1753
1750
  case "ImportDefaultSpecifier":
1754
1751
  case "ImportNamespaceSpecifier":
@@ -3183,6 +3180,7 @@ function createTransformContext(root, {
3183
3180
  vOnce: 0
3184
3181
  },
3185
3182
  parent: null,
3183
+ grandParent: null,
3186
3184
  currentNode: root,
3187
3185
  childIndex: 0,
3188
3186
  inVOnce: false,
@@ -3357,6 +3355,7 @@ function traverseChildren(parent, context) {
3357
3355
  const child = parent.children[i];
3358
3356
  if (shared.isString(child))
3359
3357
  continue;
3358
+ context.grandParent = context.parent;
3360
3359
  context.parent = parent;
3361
3360
  context.childIndex = i;
3362
3361
  context.onNodeRemoved = nodeRemoved;
@@ -4335,9 +4334,10 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
4335
4334
  if (!ast) {
4336
4335
  const source = asRawStatements ? ` ${rawExp} ` : `(${rawExp})${asParams ? `=>{}` : ``}`;
4337
4336
  try {
4338
- ast = parser.parse(source, {
4337
+ ast = parser.parseExpression(source, {
4338
+ sourceType: "module",
4339
4339
  plugins: context.expressionPlugins
4340
- }).program;
4340
+ });
4341
4341
  } catch (e) {
4342
4342
  context.onError(
4343
4343
  createCompilerError(
@@ -5418,6 +5418,16 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
5418
5418
  if (arg)
5419
5419
  mergeArgs.push(arg);
5420
5420
  };
5421
+ const pushRefVForMarker = () => {
5422
+ if (context.scopes.vFor > 0) {
5423
+ properties.push(
5424
+ createObjectProperty(
5425
+ createSimpleExpression("ref_for", true),
5426
+ createSimpleExpression("true")
5427
+ )
5428
+ );
5429
+ }
5430
+ };
5421
5431
  const analyzePatchFlag = ({ key, value }) => {
5422
5432
  if (isStaticExp(key)) {
5423
5433
  const name = key.content;
@@ -5461,14 +5471,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
5461
5471
  let isStatic = true;
5462
5472
  if (name === "ref") {
5463
5473
  hasRef = true;
5464
- if (context.scopes.vFor > 0) {
5465
- properties.push(
5466
- createObjectProperty(
5467
- createSimpleExpression("ref_for", true),
5468
- createSimpleExpression("true")
5469
- )
5470
- );
5471
- }
5474
+ pushRefVForMarker();
5472
5475
  if (value && context.inline) {
5473
5476
  const binding = context.bindingMetadata[value.content];
5474
5477
  if (binding === "setup-let" || binding === "setup-ref" || binding === "setup-maybe-ref") {
@@ -5530,18 +5533,14 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
5530
5533
  ) {
5531
5534
  shouldUseBlock = true;
5532
5535
  }
5533
- if (isVBind && isStaticArgOf(arg, "ref") && context.scopes.vFor > 0) {
5534
- properties.push(
5535
- createObjectProperty(
5536
- createSimpleExpression("ref_for", true),
5537
- createSimpleExpression("true")
5538
- )
5539
- );
5536
+ if (isVBind && isStaticArgOf(arg, "ref")) {
5537
+ pushRefVForMarker();
5540
5538
  }
5541
5539
  if (!arg && (isVBind || isVOn)) {
5542
5540
  hasDynamicKeys = true;
5543
5541
  if (exp) {
5544
5542
  if (isVBind) {
5543
+ pushRefVForMarker();
5545
5544
  pushMergeArg();
5546
5545
  {
5547
5546
  {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-core v3.4.22
2
+ * @vue/compiler-core v3.4.24
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1711,7 +1711,7 @@ function isReferenced(node, parent, grandparent) {
1711
1711
  if (parent.key === node) {
1712
1712
  return !!parent.computed;
1713
1713
  }
1714
- return !grandparent || grandparent.type !== "ObjectPattern";
1714
+ return !grandparent ;
1715
1715
  case "ClassProperty":
1716
1716
  if (parent.key === node) {
1717
1717
  return !!parent.computed;
@@ -1742,9 +1742,6 @@ function isReferenced(node, parent, grandparent) {
1742
1742
  case "ExportDefaultSpecifier":
1743
1743
  return false;
1744
1744
  case "ExportSpecifier":
1745
- if (grandparent == null ? void 0 : grandparent.source) {
1746
- return false;
1747
- }
1748
1745
  return parent.local === node;
1749
1746
  case "ImportDefaultSpecifier":
1750
1747
  case "ImportNamespaceSpecifier":
@@ -3142,6 +3139,7 @@ function createTransformContext(root, {
3142
3139
  vOnce: 0
3143
3140
  },
3144
3141
  parent: null,
3142
+ grandParent: null,
3145
3143
  currentNode: root,
3146
3144
  childIndex: 0,
3147
3145
  inVOnce: false,
@@ -3298,6 +3296,7 @@ function traverseChildren(parent, context) {
3298
3296
  const child = parent.children[i];
3299
3297
  if (shared.isString(child))
3300
3298
  continue;
3299
+ context.grandParent = context.parent;
3301
3300
  context.parent = parent;
3302
3301
  context.childIndex = i;
3303
3302
  context.onNodeRemoved = nodeRemoved;
@@ -4264,9 +4263,10 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
4264
4263
  if (!ast) {
4265
4264
  const source = asRawStatements ? ` ${rawExp} ` : `(${rawExp})${asParams ? `=>{}` : ``}`;
4266
4265
  try {
4267
- ast = parser.parse(source, {
4266
+ ast = parser.parseExpression(source, {
4267
+ sourceType: "module",
4268
4268
  plugins: context.expressionPlugins
4269
- }).program;
4269
+ });
4270
4270
  } catch (e) {
4271
4271
  context.onError(
4272
4272
  createCompilerError(
@@ -5323,6 +5323,16 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
5323
5323
  if (arg)
5324
5324
  mergeArgs.push(arg);
5325
5325
  };
5326
+ const pushRefVForMarker = () => {
5327
+ if (context.scopes.vFor > 0) {
5328
+ properties.push(
5329
+ createObjectProperty(
5330
+ createSimpleExpression("ref_for", true),
5331
+ createSimpleExpression("true")
5332
+ )
5333
+ );
5334
+ }
5335
+ };
5326
5336
  const analyzePatchFlag = ({ key, value }) => {
5327
5337
  if (isStaticExp(key)) {
5328
5338
  const name = key.content;
@@ -5366,14 +5376,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
5366
5376
  let isStatic = true;
5367
5377
  if (name === "ref") {
5368
5378
  hasRef = true;
5369
- if (context.scopes.vFor > 0) {
5370
- properties.push(
5371
- createObjectProperty(
5372
- createSimpleExpression("ref_for", true),
5373
- createSimpleExpression("true")
5374
- )
5375
- );
5376
- }
5379
+ pushRefVForMarker();
5377
5380
  if (value && context.inline) {
5378
5381
  const binding = context.bindingMetadata[value.content];
5379
5382
  if (binding === "setup-let" || binding === "setup-ref" || binding === "setup-maybe-ref") {
@@ -5435,18 +5438,14 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
5435
5438
  ) {
5436
5439
  shouldUseBlock = true;
5437
5440
  }
5438
- if (isVBind && isStaticArgOf(arg, "ref") && context.scopes.vFor > 0) {
5439
- properties.push(
5440
- createObjectProperty(
5441
- createSimpleExpression("ref_for", true),
5442
- createSimpleExpression("true")
5443
- )
5444
- );
5441
+ if (isVBind && isStaticArgOf(arg, "ref")) {
5442
+ pushRefVForMarker();
5445
5443
  }
5446
5444
  if (!arg && (isVBind || isVOn)) {
5447
5445
  hasDynamicKeys = true;
5448
5446
  if (exp) {
5449
5447
  if (isVBind) {
5448
+ pushRefVForMarker();
5450
5449
  pushMergeArg();
5451
5450
  {
5452
5451
  if (isCompatEnabled(
@@ -99,6 +99,7 @@ export interface TransformContext extends Required<Omit<TransformOptions, keyof
99
99
  vOnce: number;
100
100
  };
101
101
  parent: ParentNode | null;
102
+ grandParent: ParentNode | null;
102
103
  childIndex: number;
103
104
  currentNode: RootNode | TemplateChildNode | null;
104
105
  inVOnce: boolean;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-core v3.4.22
2
+ * @vue/compiler-core v3.4.24
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2927,6 +2927,7 @@ function createTransformContext(root, {
2927
2927
  vOnce: 0
2928
2928
  },
2929
2929
  parent: null,
2930
+ grandParent: null,
2930
2931
  currentNode: root,
2931
2932
  childIndex: 0,
2932
2933
  inVOnce: false,
@@ -3073,6 +3074,7 @@ function traverseChildren(parent, context) {
3073
3074
  const child = parent.children[i];
3074
3075
  if (isString(child))
3075
3076
  continue;
3077
+ context.grandParent = context.parent;
3076
3078
  context.parent = parent;
3077
3079
  context.childIndex = i;
3078
3080
  context.onNodeRemoved = nodeRemoved;
@@ -4676,6 +4678,16 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4676
4678
  if (arg)
4677
4679
  mergeArgs.push(arg);
4678
4680
  };
4681
+ const pushRefVForMarker = () => {
4682
+ if (context.scopes.vFor > 0) {
4683
+ properties.push(
4684
+ createObjectProperty(
4685
+ createSimpleExpression("ref_for", true),
4686
+ createSimpleExpression("true")
4687
+ )
4688
+ );
4689
+ }
4690
+ };
4679
4691
  const analyzePatchFlag = ({ key, value }) => {
4680
4692
  if (isStaticExp(key)) {
4681
4693
  const name = key.content;
@@ -4719,14 +4731,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4719
4731
  let isStatic = true;
4720
4732
  if (name === "ref") {
4721
4733
  hasRef = true;
4722
- if (context.scopes.vFor > 0) {
4723
- properties.push(
4724
- createObjectProperty(
4725
- createSimpleExpression("ref_for", true),
4726
- createSimpleExpression("true")
4727
- )
4728
- );
4729
- }
4734
+ pushRefVForMarker();
4730
4735
  }
4731
4736
  if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || isCompatEnabled(
4732
4737
  "COMPILER_IS_ON_ELEMENT",
@@ -4776,18 +4781,14 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4776
4781
  ) {
4777
4782
  shouldUseBlock = true;
4778
4783
  }
4779
- if (isVBind && isStaticArgOf(arg, "ref") && context.scopes.vFor > 0) {
4780
- properties.push(
4781
- createObjectProperty(
4782
- createSimpleExpression("ref_for", true),
4783
- createSimpleExpression("true")
4784
- )
4785
- );
4784
+ if (isVBind && isStaticArgOf(arg, "ref")) {
4785
+ pushRefVForMarker();
4786
4786
  }
4787
4787
  if (!arg && (isVBind || isVOn)) {
4788
4788
  hasDynamicKeys = true;
4789
4789
  if (exp) {
4790
4790
  if (isVBind) {
4791
+ pushRefVForMarker();
4791
4792
  pushMergeArg();
4792
4793
  {
4793
4794
  if (!!(process.env.NODE_ENV !== "production")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-core",
3
- "version": "3.4.22",
3
+ "version": "3.4.24",
4
4
  "description": "@vue/compiler-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/compiler-core.esm-bundler.js",
@@ -46,11 +46,11 @@
46
46
  },
47
47
  "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
48
48
  "dependencies": {
49
- "@babel/parser": "^7.24.1",
49
+ "@babel/parser": "^7.24.4",
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.22"
53
+ "@vue/shared": "3.4.24"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/types": "^7.24.0"