@vue/compiler-core 3.4.0-beta.3 → 3.4.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.
@@ -1516,12 +1516,23 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
1516
1516
  } else if (node.type === "ObjectProperty" && parent.type === "ObjectPattern") {
1517
1517
  node.inPattern = true;
1518
1518
  } else if (isFunctionType(node)) {
1519
- walkFunctionParams(node, (id) => markScopeIdentifier(node, id, knownIds));
1519
+ if (node.scopeIds) {
1520
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
1521
+ } else {
1522
+ walkFunctionParams(
1523
+ node,
1524
+ (id) => markScopeIdentifier(node, id, knownIds)
1525
+ );
1526
+ }
1520
1527
  } else if (node.type === "BlockStatement") {
1521
- walkBlockDeclarations(
1522
- node,
1523
- (id) => markScopeIdentifier(node, id, knownIds)
1524
- );
1528
+ if (node.scopeIds) {
1529
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
1530
+ } else {
1531
+ walkBlockDeclarations(
1532
+ node,
1533
+ (id) => markScopeIdentifier(node, id, knownIds)
1534
+ );
1535
+ }
1525
1536
  }
1526
1537
  },
1527
1538
  leave(node, parent) {
@@ -1640,16 +1651,19 @@ function extractIdentifiers(param, nodes = []) {
1640
1651
  }
1641
1652
  return nodes;
1642
1653
  }
1643
- function markScopeIdentifier(node, child, knownIds) {
1644
- const { name } = child;
1645
- if (node.scopeIds && node.scopeIds.has(name)) {
1646
- return;
1647
- }
1654
+ function markKnownIds(name, knownIds) {
1648
1655
  if (name in knownIds) {
1649
1656
  knownIds[name]++;
1650
1657
  } else {
1651
1658
  knownIds[name] = 1;
1652
1659
  }
1660
+ }
1661
+ function markScopeIdentifier(node, child, knownIds) {
1662
+ const { name } = child;
1663
+ if (node.scopeIds && node.scopeIds.has(name)) {
1664
+ return;
1665
+ }
1666
+ markKnownIds(name, knownIds);
1653
1667
  (node.scopeIds || (node.scopeIds = /* @__PURE__ */ new Set())).add(name);
1654
1668
  }
1655
1669
  const isFunctionType = (node) => {
@@ -1854,7 +1868,7 @@ const isMemberExpressionNode = (path, context) => {
1854
1868
  plugins: context.expressionPlugins
1855
1869
  });
1856
1870
  ret = unwrapTSNode(ret);
1857
- return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier";
1871
+ return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier" && ret.name !== "undefined";
1858
1872
  } catch (e) {
1859
1873
  return false;
1860
1874
  }
@@ -1512,12 +1512,23 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
1512
1512
  } else if (node.type === "ObjectProperty" && parent.type === "ObjectPattern") {
1513
1513
  node.inPattern = true;
1514
1514
  } else if (isFunctionType(node)) {
1515
- walkFunctionParams(node, (id) => markScopeIdentifier(node, id, knownIds));
1515
+ if (node.scopeIds) {
1516
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
1517
+ } else {
1518
+ walkFunctionParams(
1519
+ node,
1520
+ (id) => markScopeIdentifier(node, id, knownIds)
1521
+ );
1522
+ }
1516
1523
  } else if (node.type === "BlockStatement") {
1517
- walkBlockDeclarations(
1518
- node,
1519
- (id) => markScopeIdentifier(node, id, knownIds)
1520
- );
1524
+ if (node.scopeIds) {
1525
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
1526
+ } else {
1527
+ walkBlockDeclarations(
1528
+ node,
1529
+ (id) => markScopeIdentifier(node, id, knownIds)
1530
+ );
1531
+ }
1521
1532
  }
1522
1533
  },
1523
1534
  leave(node, parent) {
@@ -1636,16 +1647,19 @@ function extractIdentifiers(param, nodes = []) {
1636
1647
  }
1637
1648
  return nodes;
1638
1649
  }
1639
- function markScopeIdentifier(node, child, knownIds) {
1640
- const { name } = child;
1641
- if (node.scopeIds && node.scopeIds.has(name)) {
1642
- return;
1643
- }
1650
+ function markKnownIds(name, knownIds) {
1644
1651
  if (name in knownIds) {
1645
1652
  knownIds[name]++;
1646
1653
  } else {
1647
1654
  knownIds[name] = 1;
1648
1655
  }
1656
+ }
1657
+ function markScopeIdentifier(node, child, knownIds) {
1658
+ const { name } = child;
1659
+ if (node.scopeIds && node.scopeIds.has(name)) {
1660
+ return;
1661
+ }
1662
+ markKnownIds(name, knownIds);
1649
1663
  (node.scopeIds || (node.scopeIds = /* @__PURE__ */ new Set())).add(name);
1650
1664
  }
1651
1665
  const isFunctionType = (node) => {
@@ -1850,7 +1864,7 @@ const isMemberExpressionNode = (path, context) => {
1850
1864
  plugins: context.expressionPlugins
1851
1865
  });
1852
1866
  ret = unwrapTSNode(ret);
1853
- return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier";
1867
+ return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier" && ret.name !== "undefined";
1854
1868
  } catch (e) {
1855
1869
  return false;
1856
1870
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-core",
3
- "version": "3.4.0-beta.3",
3
+ "version": "3.4.0-beta.4",
4
4
  "description": "@vue/compiler-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/compiler-core.esm-bundler.js",
@@ -36,7 +36,7 @@
36
36
  "entities": "^4.5.0",
37
37
  "estree-walker": "^2.0.2",
38
38
  "source-map-js": "^1.0.2",
39
- "@vue/shared": "3.4.0-beta.3"
39
+ "@vue/shared": "3.4.0-beta.4"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@babel/types": "^7.23.5"