@vue/compiler-core 3.6.0-alpha.2 → 3.6.0-alpha.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-core v3.6.0-alpha.2
2
+ * @vue/compiler-core v3.6.0-alpha.4
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -135,14 +135,6 @@ function registerRuntimeHelpers(helpers) {
135
135
  });
136
136
  }
137
137
 
138
- const Namespaces = {
139
- "HTML": 0,
140
- "0": "HTML",
141
- "SVG": 1,
142
- "1": "SVG",
143
- "MATH_ML": 2,
144
- "2": "MATH_ML"
145
- };
146
138
  const NodeTypes = {
147
139
  "ROOT": 0,
148
140
  "0": "ROOT",
@@ -1570,16 +1562,34 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
1570
1562
  (id) => markScopeIdentifier(node, id, knownIds)
1571
1563
  );
1572
1564
  }
1565
+ } else if (node.type === "SwitchStatement") {
1566
+ if (node.scopeIds) {
1567
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
1568
+ } else {
1569
+ walkSwitchStatement(
1570
+ node,
1571
+ false,
1572
+ (id) => markScopeIdentifier(node, id, knownIds)
1573
+ );
1574
+ }
1573
1575
  } else if (node.type === "CatchClause" && node.param) {
1574
- for (const id of extractIdentifiers(node.param)) {
1575
- markScopeIdentifier(node, id, knownIds);
1576
+ if (node.scopeIds) {
1577
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
1578
+ } else {
1579
+ for (const id of extractIdentifiers(node.param)) {
1580
+ markScopeIdentifier(node, id, knownIds);
1581
+ }
1576
1582
  }
1577
1583
  } else if (isForStatement(node)) {
1578
- walkForStatement(
1579
- node,
1580
- false,
1581
- (id) => markScopeIdentifier(node, id, knownIds)
1582
- );
1584
+ if (node.scopeIds) {
1585
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
1586
+ } else {
1587
+ walkForStatement(
1588
+ node,
1589
+ false,
1590
+ (id) => markScopeIdentifier(node, id, knownIds)
1591
+ );
1592
+ }
1583
1593
  }
1584
1594
  },
1585
1595
  leave(node, parent) {
@@ -1602,14 +1612,15 @@ function isReferencedIdentifier(id, parent, parentStack) {
1602
1612
  if (id.name === "arguments") {
1603
1613
  return false;
1604
1614
  }
1605
- if (isReferenced(id, parent)) {
1615
+ if (isReferenced(id, parent, parentStack[parentStack.length - 2])) {
1606
1616
  return true;
1607
1617
  }
1608
1618
  switch (parent.type) {
1609
1619
  case "AssignmentExpression":
1610
1620
  case "AssignmentPattern":
1611
1621
  return true;
1612
- case "ObjectPattern":
1622
+ case "ObjectProperty":
1623
+ return parent.key !== id && isInDestructureAssignment(parent, parentStack);
1613
1624
  case "ArrayPattern":
1614
1625
  return isInDestructureAssignment(parent, parentStack);
1615
1626
  }
@@ -1649,7 +1660,8 @@ function walkFunctionParams(node, onIdent) {
1649
1660
  }
1650
1661
  }
1651
1662
  function walkBlockDeclarations(block, onIdent) {
1652
- for (const stmt of block.body) {
1663
+ const body = block.type === "SwitchCase" ? block.consequent : block.body;
1664
+ for (const stmt of body) {
1653
1665
  if (stmt.type === "VariableDeclaration") {
1654
1666
  if (stmt.declare) continue;
1655
1667
  for (const decl of stmt.declarations) {
@@ -1662,6 +1674,8 @@ function walkBlockDeclarations(block, onIdent) {
1662
1674
  onIdent(stmt.id);
1663
1675
  } else if (isForStatement(stmt)) {
1664
1676
  walkForStatement(stmt, true, onIdent);
1677
+ } else if (stmt.type === "SwitchStatement") {
1678
+ walkSwitchStatement(stmt, true, onIdent);
1665
1679
  }
1666
1680
  }
1667
1681
  }
@@ -1678,6 +1692,20 @@ function walkForStatement(stmt, isVar, onIdent) {
1678
1692
  }
1679
1693
  }
1680
1694
  }
1695
+ function walkSwitchStatement(stmt, isVar, onIdent) {
1696
+ for (const cs of stmt.cases) {
1697
+ for (const stmt2 of cs.consequent) {
1698
+ if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
1699
+ for (const decl of stmt2.declarations) {
1700
+ for (const id of extractIdentifiers(decl.id)) {
1701
+ onIdent(id);
1702
+ }
1703
+ }
1704
+ }
1705
+ }
1706
+ walkBlockDeclarations(cs, onIdent);
1707
+ }
1708
+ }
1681
1709
  function extractIdentifiers(param, nodes = []) {
1682
1710
  switch (param.type) {
1683
1711
  case "Identifier":
@@ -1778,7 +1806,7 @@ function isReferenced(node, parent, grandparent) {
1778
1806
  if (parent.key === node) {
1779
1807
  return !!parent.computed;
1780
1808
  }
1781
- return true;
1809
+ return !grandparent || grandparent.type !== "ObjectPattern";
1782
1810
  // no: class { NODE = value; }
1783
1811
  // yes: class { [NODE] = value; }
1784
1812
  // yes: class { key = NODE; }
@@ -1828,6 +1856,9 @@ function isReferenced(node, parent, grandparent) {
1828
1856
  // yes: export { NODE as foo };
1829
1857
  // no: export { NODE as foo } from "foo";
1830
1858
  case "ExportSpecifier":
1859
+ if (grandparent == null ? void 0 : grandparent.source) {
1860
+ return false;
1861
+ }
1831
1862
  return parent.local === node;
1832
1863
  // no: import NODE from "foo";
1833
1864
  // no: import * as NODE from "foo";
@@ -1961,7 +1992,7 @@ function isCoreComponent(tag) {
1961
1992
  return BASE_TRANSITION;
1962
1993
  }
1963
1994
  }
1964
- const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
1995
+ const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
1965
1996
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
1966
1997
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
1967
1998
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
@@ -2041,7 +2072,7 @@ const isMemberExpressionNode = (exp, context) => {
2041
2072
  }
2042
2073
  };
2043
2074
  const isMemberExpression = isMemberExpressionNode;
2044
- const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
2075
+ const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/;
2045
2076
  const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
2046
2077
  const isFnExpressionNode = (exp, context) => {
2047
2078
  try {
@@ -2126,6 +2157,9 @@ function hasDynamicKeyVBind(node) {
2126
2157
  function isText$1(node) {
2127
2158
  return node.type === 5 || node.type === 2;
2128
2159
  }
2160
+ function isVPre(p) {
2161
+ return p.type === 7 && p.name === "pre";
2162
+ }
2129
2163
  function isVSlot(p) {
2130
2164
  return p.type === 7 && p.name === "slot";
2131
2165
  }
@@ -2424,7 +2458,7 @@ const tokenizer = new Tokenizer(stack, {
2424
2458
  ondirarg(start, end) {
2425
2459
  if (start === end) return;
2426
2460
  const arg = getSlice(start, end);
2427
- if (inVPre) {
2461
+ if (inVPre && !isVPre(currentProp)) {
2428
2462
  currentProp.name += arg;
2429
2463
  setLocEnd(currentProp.nameLoc, end);
2430
2464
  } else {
@@ -2439,7 +2473,7 @@ const tokenizer = new Tokenizer(stack, {
2439
2473
  },
2440
2474
  ondirmodifier(start, end) {
2441
2475
  const mod = getSlice(start, end);
2442
- if (inVPre) {
2476
+ if (inVPre && !isVPre(currentProp)) {
2443
2477
  currentProp.name += "." + mod;
2444
2478
  setLocEnd(currentProp.nameLoc, end);
2445
2479
  } else if (currentProp.name === "slot") {
@@ -3049,6 +3083,11 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
3049
3083
  } else if (child.type === 12) {
3050
3084
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
3051
3085
  if (constantType >= 2) {
3086
+ if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
3087
+ child.codegenNode.arguments.push(
3088
+ -1 + (``)
3089
+ );
3090
+ }
3052
3091
  toCache.push(child);
3053
3092
  continue;
3054
3093
  }
@@ -3077,7 +3116,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
3077
3116
  }
3078
3117
  }
3079
3118
  let cachedAsArray = false;
3080
- const slotCacheKeys = [];
3081
3119
  if (toCache.length === children.length && node.type === 1) {
3082
3120
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && shared.isArray(node.codegenNode.children)) {
3083
3121
  node.codegenNode.children = getCacheExpression(
@@ -3087,7 +3125,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
3087
3125
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !shared.isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
3088
3126
  const slot = getSlotNode(node.codegenNode, "default");
3089
3127
  if (slot) {
3090
- slotCacheKeys.push(context.cached.length);
3091
3128
  slot.returns = getCacheExpression(
3092
3129
  createArrayExpression(slot.returns)
3093
3130
  );
@@ -3097,7 +3134,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
3097
3134
  const slotName = findDir(node, "slot", true);
3098
3135
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
3099
3136
  if (slot) {
3100
- slotCacheKeys.push(context.cached.length);
3101
3137
  slot.returns = getCacheExpression(
3102
3138
  createArrayExpression(slot.returns)
3103
3139
  );
@@ -3107,23 +3143,12 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
3107
3143
  }
3108
3144
  if (!cachedAsArray) {
3109
3145
  for (const child of toCache) {
3110
- slotCacheKeys.push(context.cached.length);
3111
3146
  child.codegenNode = context.cache(child.codegenNode);
3112
3147
  }
3113
3148
  }
3114
- if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !shared.isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
3115
- node.codegenNode.children.properties.push(
3116
- createObjectProperty(
3117
- `__`,
3118
- createSimpleExpression(JSON.stringify(slotCacheKeys), false)
3119
- )
3120
- );
3121
- }
3122
3149
  function getCacheExpression(value) {
3123
3150
  const exp = context.cache(value);
3124
- if (inFor && context.hmr) {
3125
- exp.needArraySpread = true;
3126
- }
3151
+ exp.needArraySpread = true;
3127
3152
  return exp;
3128
3153
  }
3129
3154
  function getSlotNode(node2, name) {
@@ -4613,7 +4638,7 @@ function isConst(type) {
4613
4638
  }
4614
4639
 
4615
4640
  const transformIf = createStructuralDirectiveTransform(
4616
- /^(if|else|else-if)$/,
4641
+ /^(?:if|else|else-if)$/,
4617
4642
  (node, dir, context) => {
4618
4643
  return processIf(node, dir, context, (ifNode, branch, isRoot) => {
4619
4644
  const siblings = context.parent.children;
@@ -4680,7 +4705,7 @@ function processIf(node, dir, context, processCodegen) {
4680
4705
  continue;
4681
4706
  }
4682
4707
  if (sibling && sibling.type === 9) {
4683
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
4708
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
4684
4709
  context.onError(
4685
4710
  createCompilerError(30, node.loc)
4686
4711
  );
@@ -4822,90 +4847,6 @@ function getParentCondition(node) {
4822
4847
  }
4823
4848
  }
4824
4849
 
4825
- const transformBind = (dir, _node, context) => {
4826
- const { modifiers, loc } = dir;
4827
- const arg = dir.arg;
4828
- let { exp } = dir;
4829
- if (exp && exp.type === 4 && !exp.content.trim()) {
4830
- {
4831
- context.onError(
4832
- createCompilerError(34, loc)
4833
- );
4834
- return {
4835
- props: [
4836
- createObjectProperty(arg, createSimpleExpression("", true, loc))
4837
- ]
4838
- };
4839
- }
4840
- }
4841
- if (!exp) {
4842
- if (arg.type !== 4 || !arg.isStatic) {
4843
- context.onError(
4844
- createCompilerError(
4845
- 52,
4846
- arg.loc
4847
- )
4848
- );
4849
- return {
4850
- props: [
4851
- createObjectProperty(arg, createSimpleExpression("", true, loc))
4852
- ]
4853
- };
4854
- }
4855
- transformBindShorthand(dir, context);
4856
- exp = dir.exp;
4857
- }
4858
- if (arg.type !== 4) {
4859
- arg.children.unshift(`(`);
4860
- arg.children.push(`) || ""`);
4861
- } else if (!arg.isStatic) {
4862
- arg.content = `${arg.content} || ""`;
4863
- }
4864
- if (modifiers.some((mod) => mod.content === "camel")) {
4865
- if (arg.type === 4) {
4866
- if (arg.isStatic) {
4867
- arg.content = shared.camelize(arg.content);
4868
- } else {
4869
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
4870
- }
4871
- } else {
4872
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
4873
- arg.children.push(`)`);
4874
- }
4875
- }
4876
- if (!context.inSSR) {
4877
- if (modifiers.some((mod) => mod.content === "prop")) {
4878
- injectPrefix(arg, ".");
4879
- }
4880
- if (modifiers.some((mod) => mod.content === "attr")) {
4881
- injectPrefix(arg, "^");
4882
- }
4883
- }
4884
- return {
4885
- props: [createObjectProperty(arg, exp)]
4886
- };
4887
- };
4888
- const transformBindShorthand = (dir, context) => {
4889
- const arg = dir.arg;
4890
- const propName = shared.camelize(arg.content);
4891
- dir.exp = createSimpleExpression(propName, false, arg.loc);
4892
- {
4893
- dir.exp = processExpression(dir.exp, context);
4894
- }
4895
- };
4896
- const injectPrefix = (arg, prefix) => {
4897
- if (arg.type === 4) {
4898
- if (arg.isStatic) {
4899
- arg.content = prefix + arg.content;
4900
- } else {
4901
- arg.content = `\`${prefix}\${${arg.content}}\``;
4902
- }
4903
- } else {
4904
- arg.children.unshift(`'${prefix}' + (`);
4905
- arg.children.push(`)`);
4906
- }
4907
- };
4908
-
4909
4850
  const transformFor = createStructuralDirectiveTransform(
4910
4851
  "for",
4911
4852
  (node, dir, context) => {
@@ -4918,9 +4859,6 @@ const transformFor = createStructuralDirectiveTransform(
4918
4859
  const memo = findDir(node, "memo");
4919
4860
  const keyProp = findProp(node, `key`, false, true);
4920
4861
  const isDirKey = keyProp && keyProp.type === 7;
4921
- if (isDirKey && !keyProp.exp) {
4922
- transformBindShorthand(keyProp, context);
4923
- }
4924
4862
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
4925
4863
  if (memo && keyExp && isDirKey) {
4926
4864
  {
@@ -5201,7 +5139,9 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
5201
5139
  const dynamicSlots = [];
5202
5140
  let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
5203
5141
  if (!context.ssr && context.prefixIdentifiers) {
5204
- hasDynamicSlots = hasScopeRef(node, context.identifiers);
5142
+ hasDynamicSlots = node.props.some(
5143
+ (prop) => isVSlot(prop) && (hasScopeRef(prop.arg, context.identifiers) || hasScopeRef(prop.exp, context.identifiers))
5144
+ ) || children.some((child) => hasScopeRef(child, context.identifiers));
5205
5145
  }
5206
5146
  const onComponentSlot = findDir(node, "slot", true);
5207
5147
  if (onComponentSlot) {
@@ -5264,7 +5204,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
5264
5204
  );
5265
5205
  } else if (vElse = findDir(
5266
5206
  slotElement,
5267
- /^else(-if)?$/,
5207
+ /^else(?:-if)?$/,
5268
5208
  true
5269
5209
  /* allowEmpty */
5270
5210
  )) {
@@ -5276,7 +5216,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
5276
5216
  break;
5277
5217
  }
5278
5218
  }
5279
- if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
5219
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
5280
5220
  let conditional = dynamicSlots[dynamicSlots.length - 1];
5281
5221
  while (conditional.alternate.type === 19) {
5282
5222
  conditional = conditional.alternate;
@@ -6201,6 +6141,65 @@ const transformOn = (dir, node, context, augmentor) => {
6201
6141
  return ret;
6202
6142
  };
6203
6143
 
6144
+ const transformBind = (dir, _node, context) => {
6145
+ const { modifiers, loc } = dir;
6146
+ const arg = dir.arg;
6147
+ let { exp } = dir;
6148
+ if (exp && exp.type === 4 && !exp.content.trim()) {
6149
+ {
6150
+ context.onError(
6151
+ createCompilerError(34, loc)
6152
+ );
6153
+ return {
6154
+ props: [
6155
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
6156
+ ]
6157
+ };
6158
+ }
6159
+ }
6160
+ if (arg.type !== 4) {
6161
+ arg.children.unshift(`(`);
6162
+ arg.children.push(`) || ""`);
6163
+ } else if (!arg.isStatic) {
6164
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
6165
+ }
6166
+ if (modifiers.some((mod) => mod.content === "camel")) {
6167
+ if (arg.type === 4) {
6168
+ if (arg.isStatic) {
6169
+ arg.content = shared.camelize(arg.content);
6170
+ } else {
6171
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
6172
+ }
6173
+ } else {
6174
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
6175
+ arg.children.push(`)`);
6176
+ }
6177
+ }
6178
+ if (!context.inSSR) {
6179
+ if (modifiers.some((mod) => mod.content === "prop")) {
6180
+ injectPrefix(arg, ".");
6181
+ }
6182
+ if (modifiers.some((mod) => mod.content === "attr")) {
6183
+ injectPrefix(arg, "^");
6184
+ }
6185
+ }
6186
+ return {
6187
+ props: [createObjectProperty(arg, exp)]
6188
+ };
6189
+ };
6190
+ const injectPrefix = (arg, prefix) => {
6191
+ if (arg.type === 4) {
6192
+ if (arg.isStatic) {
6193
+ arg.content = prefix + arg.content;
6194
+ } else {
6195
+ arg.content = `\`${prefix}\${${arg.content}}\``;
6196
+ }
6197
+ } else {
6198
+ arg.children.unshift(`'${prefix}' + (`);
6199
+ arg.children.push(`)`);
6200
+ }
6201
+ };
6202
+
6204
6203
  const transformText = (node, context) => {
6205
6204
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
6206
6205
  return () => {
@@ -6362,7 +6361,7 @@ const transformModel = (dir, node, context) => {
6362
6361
  }
6363
6362
  if (dir.modifiers.length && node.tagType === 1) {
6364
6363
  const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
6365
- const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
6364
+ const modifiersKey = arg ? isStaticExp(arg) ? shared.getModifierPropName(arg.content) : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
6366
6365
  props.push(
6367
6366
  createObjectProperty(
6368
6367
  modifiersKey,
@@ -6529,7 +6528,7 @@ const seen = /* @__PURE__ */ new WeakSet();
6529
6528
  const transformMemo = (node, context) => {
6530
6529
  if (node.type === 1) {
6531
6530
  const dir = findDir(node, "memo");
6532
- if (!dir || seen.has(node)) {
6531
+ if (!dir || seen.has(node) || context.inSSR) {
6533
6532
  return;
6534
6533
  }
6535
6534
  seen.add(node);
@@ -6551,9 +6550,36 @@ const transformMemo = (node, context) => {
6551
6550
  }
6552
6551
  };
6553
6552
 
6553
+ const transformVBindShorthand = (node, context) => {
6554
+ if (node.type === 1) {
6555
+ for (const prop of node.props) {
6556
+ if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
6557
+ false) && prop.arg) {
6558
+ const arg = prop.arg;
6559
+ if (arg.type !== 4 || !arg.isStatic) {
6560
+ context.onError(
6561
+ createCompilerError(
6562
+ 52,
6563
+ arg.loc
6564
+ )
6565
+ );
6566
+ prop.exp = createSimpleExpression("", true, arg.loc);
6567
+ } else {
6568
+ const propName = shared.camelize(arg.content);
6569
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
6570
+ propName[0] === "-") {
6571
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
6572
+ }
6573
+ }
6574
+ }
6575
+ }
6576
+ }
6577
+ };
6578
+
6554
6579
  function getBaseTransformPreset(prefixIdentifiers) {
6555
6580
  return [
6556
6581
  [
6582
+ transformVBindShorthand,
6557
6583
  transformOnce,
6558
6584
  transformIf,
6559
6585
  transformMemo,
@@ -6657,7 +6683,6 @@ exports.MERGE_PROPS = MERGE_PROPS;
6657
6683
  exports.NORMALIZE_CLASS = NORMALIZE_CLASS;
6658
6684
  exports.NORMALIZE_PROPS = NORMALIZE_PROPS;
6659
6685
  exports.NORMALIZE_STYLE = NORMALIZE_STYLE;
6660
- exports.Namespaces = Namespaces;
6661
6686
  exports.NewlineType = NewlineType;
6662
6687
  exports.NodeTypes = NodeTypes;
6663
6688
  exports.OPEN_BLOCK = OPEN_BLOCK;
@@ -6752,6 +6777,7 @@ exports.isStaticProperty = isStaticProperty;
6752
6777
  exports.isStaticPropertyKey = isStaticPropertyKey;
6753
6778
  exports.isTemplateNode = isTemplateNode;
6754
6779
  exports.isText = isText$1;
6780
+ exports.isVPre = isVPre;
6755
6781
  exports.isVSlot = isVSlot;
6756
6782
  exports.locStub = locStub;
6757
6783
  exports.noopDirectiveTransform = noopDirectiveTransform;
@@ -6771,8 +6797,10 @@ exports.transformElement = transformElement;
6771
6797
  exports.transformExpression = transformExpression;
6772
6798
  exports.transformModel = transformModel;
6773
6799
  exports.transformOn = transformOn;
6800
+ exports.transformVBindShorthand = transformVBindShorthand;
6774
6801
  exports.traverseNode = traverseNode;
6775
6802
  exports.unwrapTSNode = unwrapTSNode;
6803
+ exports.validFirstIdentCharRE = validFirstIdentCharRE;
6776
6804
  exports.walkBlockDeclarations = walkBlockDeclarations;
6777
6805
  exports.walkFunctionParams = walkFunctionParams;
6778
6806
  exports.walkIdentifiers = walkIdentifiers;
@@ -1,6 +1,6 @@
1
- import { PatchFlags } from '@vue/shared';
1
+ import { Namespace, PatchFlags, Namespaces } from '@vue/shared';
2
2
  export { generateCodeFrame } from '@vue/shared';
3
- import { Node as Node$1, Identifier, Function, BlockStatement as BlockStatement$1, Program, ObjectProperty } from '@babel/types';
3
+ import { Node as Node$1, Identifier, Function, BlockStatement as BlockStatement$1, SwitchCase, Program, ObjectProperty } from '@babel/types';
4
4
  import { ParserPlugin } from '@babel/parser';
5
5
 
6
6
  export declare const FRAGMENT: unique symbol;
@@ -83,8 +83,8 @@ interface DirectiveTransformResult {
83
83
  ssrTagParts?: TemplateLiteral['elements'];
84
84
  }
85
85
  export type StructuralDirectiveTransform = (node: ElementNode, dir: DirectiveNode, context: TransformContext) => void | (() => void);
86
- interface ImportItem {
87
- exp: string | ExpressionNode;
86
+ export interface ImportItem {
87
+ exp: SimpleExpressionNode;
88
88
  path: string;
89
89
  }
90
90
  export interface TransformContext extends Required<Omit<TransformOptions, keyof CompilerCompatOptions>>, CompilerCompatOptions {
@@ -142,12 +142,6 @@ export declare function buildProps(node: ElementNode, context: TransformContext,
142
142
  };
143
143
  export declare function buildDirectiveArgs(dir: DirectiveNode, context: TransformContext): ArrayExpression;
144
144
 
145
- export type Namespace = number;
146
- export declare enum Namespaces {
147
- HTML = 0,
148
- SVG = 1,
149
- MATH_ML = 2
150
- }
151
145
  export declare enum NodeTypes {
152
146
  ROOT = 0,
153
147
  ELEMENT = 1,
@@ -1030,6 +1024,7 @@ export declare function baseCompile(source: string | RootNode, options?: Compile
1030
1024
  export declare const isStaticExp: (p: JSChildNode) => p is SimpleExpressionNode;
1031
1025
  export declare function isCoreComponent(tag: string): symbol | void;
1032
1026
  export declare const isSimpleIdentifier: (name: string) => boolean;
1027
+ export declare const validFirstIdentCharRE: RegExp;
1033
1028
  /**
1034
1029
  * Simple lexer to check if an expression is a member expression. This is
1035
1030
  * lax and only checks validity at the root level (i.e. does not validate exps
@@ -1051,6 +1046,7 @@ export declare function findProp(node: ElementNode, name: string, dynamicOnly?:
1051
1046
  export declare function isStaticArgOf(arg: DirectiveNode['arg'], name: string): boolean;
1052
1047
  export declare function hasDynamicKeyVBind(node: ElementNode): boolean;
1053
1048
  export declare function isText(node: TemplateChildNode): node is TextNode | InterpolationNode;
1049
+ export declare function isVPre(p: ElementNode['props'][0]): p is DirectiveNode;
1054
1050
  export declare function isVSlot(p: ElementNode['props'][0]): p is DirectiveNode;
1055
1051
  export declare function isTemplateNode(node: RootNode | TemplateChildNode): node is TemplateNode;
1056
1052
  export declare function isSlotOutlet(node: RootNode | TemplateChildNode): node is SlotOutletNode;
@@ -1068,7 +1064,7 @@ export declare function isReferencedIdentifier(id: Identifier, parent: Node$1 |
1068
1064
  export declare function isInDestructureAssignment(parent: Node$1, parentStack: Node$1[]): boolean;
1069
1065
  export declare function isInNewExpression(parentStack: Node$1[]): boolean;
1070
1066
  export declare function walkFunctionParams(node: Function, onIdent: (id: Identifier) => void): void;
1071
- export declare function walkBlockDeclarations(block: BlockStatement$1 | Program, onIdent: (node: Identifier) => void): void;
1067
+ export declare function walkBlockDeclarations(block: BlockStatement$1 | SwitchCase | Program, onIdent: (node: Identifier) => void): void;
1072
1068
  export declare function extractIdentifiers(param: Node$1, nodes?: Identifier[]): Identifier[];
1073
1069
  export declare const isFunctionType: (node: Node$1) => node is Function;
1074
1070
  export declare const isStaticProperty: (node?: Node$1) => node is ObjectProperty;
@@ -1104,6 +1100,8 @@ export declare function buildSlots(node: ElementNode, context: TransformContext,
1104
1100
  hasDynamicSlots: boolean;
1105
1101
  };
1106
1102
 
1103
+ export declare const transformVBindShorthand: NodeTransform;
1104
+
1107
1105
  interface SlotOutletProcessResult {
1108
1106
  slotName: string | ExpressionNode;
1109
1107
  slotProps: PropsExpression | undefined;