@vue/compiler-dom 3.5.17 → 3.6.0-alpha.1

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-dom v3.5.17
2
+ * @vue/compiler-dom v3.6.0-alpha.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -162,7 +162,9 @@ const DOMErrorMessages = {
162
162
  [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
163
163
  [61]: `v-show is missing expression.`,
164
164
  [62]: `<Transition> expects exactly one child element or component.`,
165
- [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
165
+ [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
166
+ // just to fulfill types
167
+ [64]: ``
166
168
  };
167
169
 
168
170
  const transformVHtml = (dir, node, context) => {
@@ -311,7 +313,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
311
313
  const eventOptionModifiers = [];
312
314
  for (let i = 0; i < modifiers.length; i++) {
313
315
  const modifier = modifiers[i].content;
314
- if (modifier === "native" && compilerCore.checkCompatEnabled(
316
+ if (modifier === "native" && context && compilerCore.checkCompatEnabled(
315
317
  "COMPILER_V_ON_NATIVE",
316
318
  context,
317
319
  loc
@@ -320,9 +322,10 @@ const resolveModifiers = (key, modifiers, context, loc) => {
320
322
  } else if (isEventOptionModifier(modifier)) {
321
323
  eventOptionModifiers.push(modifier);
322
324
  } else {
325
+ const keyString = shared.isString(key) ? key : compilerCore.isStaticExp(key) ? key.content : null;
323
326
  if (maybeKeyModifier(modifier)) {
324
- if (compilerCore.isStaticExp(key)) {
325
- if (isKeyboardEvent(key.content.toLowerCase())) {
327
+ if (keyString) {
328
+ if (isKeyboardEvent(keyString.toLowerCase())) {
326
329
  keyModifiers.push(modifier);
327
330
  } else {
328
331
  nonKeyModifiers.push(modifier);
@@ -923,8 +926,10 @@ exports.V_ON_WITH_MODIFIERS = V_ON_WITH_MODIFIERS;
923
926
  exports.V_SHOW = V_SHOW;
924
927
  exports.compile = compile;
925
928
  exports.createDOMCompilerError = createDOMCompilerError;
929
+ exports.isValidHTMLNesting = isValidHTMLNesting;
926
930
  exports.parse = parse;
927
931
  exports.parserOptions = parserOptions;
932
+ exports.resolveModifiers = resolveModifiers;
928
933
  exports.transformStyle = transformStyle;
929
934
  Object.keys(compilerCore).forEach(function (k) {
930
935
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = compilerCore[k];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-dom v3.5.17
2
+ * @vue/compiler-dom v3.6.0-alpha.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -162,7 +162,9 @@ const DOMErrorMessages = {
162
162
  [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
163
163
  [61]: `v-show is missing expression.`,
164
164
  [62]: `<Transition> expects exactly one child element or component.`,
165
- [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
165
+ [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
166
+ // just to fulfill types
167
+ [64]: ``
166
168
  };
167
169
 
168
170
  const transformVHtml = (dir, node, context) => {
@@ -293,7 +295,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
293
295
  const eventOptionModifiers = [];
294
296
  for (let i = 0; i < modifiers.length; i++) {
295
297
  const modifier = modifiers[i].content;
296
- if (modifier === "native" && compilerCore.checkCompatEnabled(
298
+ if (modifier === "native" && context && compilerCore.checkCompatEnabled(
297
299
  "COMPILER_V_ON_NATIVE",
298
300
  context,
299
301
  loc
@@ -302,9 +304,10 @@ const resolveModifiers = (key, modifiers, context, loc) => {
302
304
  } else if (isEventOptionModifier(modifier)) {
303
305
  eventOptionModifiers.push(modifier);
304
306
  } else {
307
+ const keyString = shared.isString(key) ? key : compilerCore.isStaticExp(key) ? key.content : null;
305
308
  if (maybeKeyModifier(modifier)) {
306
- if (compilerCore.isStaticExp(key)) {
307
- if (isKeyboardEvent(key.content.toLowerCase())) {
309
+ if (keyString) {
310
+ if (isKeyboardEvent(keyString.toLowerCase())) {
308
311
  keyModifiers.push(modifier);
309
312
  } else {
310
313
  nonKeyModifiers.push(modifier);
@@ -623,6 +626,171 @@ const ignoreSideEffectTags = (node, context) => {
623
626
  }
624
627
  };
625
628
 
629
+ function isValidHTMLNesting(parent, child) {
630
+ if (parent === "template") {
631
+ return true;
632
+ }
633
+ if (parent in onlyValidChildren) {
634
+ return onlyValidChildren[parent].has(child);
635
+ }
636
+ if (child in onlyValidParents) {
637
+ return onlyValidParents[child].has(parent);
638
+ }
639
+ if (parent in knownInvalidChildren) {
640
+ if (knownInvalidChildren[parent].has(child)) return false;
641
+ }
642
+ if (child in knownInvalidParents) {
643
+ if (knownInvalidParents[child].has(parent)) return false;
644
+ }
645
+ return true;
646
+ }
647
+ const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
648
+ const emptySet = /* @__PURE__ */ new Set([]);
649
+ const onlyValidChildren = {
650
+ head: /* @__PURE__ */ new Set([
651
+ "base",
652
+ "basefront",
653
+ "bgsound",
654
+ "link",
655
+ "meta",
656
+ "title",
657
+ "noscript",
658
+ "noframes",
659
+ "style",
660
+ "script",
661
+ "template"
662
+ ]),
663
+ optgroup: /* @__PURE__ */ new Set(["option"]),
664
+ select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
665
+ // table
666
+ table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
667
+ tr: /* @__PURE__ */ new Set(["td", "th"]),
668
+ colgroup: /* @__PURE__ */ new Set(["col"]),
669
+ tbody: /* @__PURE__ */ new Set(["tr"]),
670
+ thead: /* @__PURE__ */ new Set(["tr"]),
671
+ tfoot: /* @__PURE__ */ new Set(["tr"]),
672
+ // these elements can not have any children elements
673
+ script: emptySet,
674
+ iframe: emptySet,
675
+ option: emptySet,
676
+ textarea: emptySet,
677
+ style: emptySet,
678
+ title: emptySet
679
+ };
680
+ const onlyValidParents = {
681
+ // sections
682
+ html: emptySet,
683
+ body: /* @__PURE__ */ new Set(["html"]),
684
+ head: /* @__PURE__ */ new Set(["html"]),
685
+ // table
686
+ td: /* @__PURE__ */ new Set(["tr"]),
687
+ colgroup: /* @__PURE__ */ new Set(["table"]),
688
+ caption: /* @__PURE__ */ new Set(["table"]),
689
+ tbody: /* @__PURE__ */ new Set(["table"]),
690
+ tfoot: /* @__PURE__ */ new Set(["table"]),
691
+ col: /* @__PURE__ */ new Set(["colgroup"]),
692
+ th: /* @__PURE__ */ new Set(["tr"]),
693
+ thead: /* @__PURE__ */ new Set(["table"]),
694
+ tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
695
+ // data list
696
+ dd: /* @__PURE__ */ new Set(["dl", "div"]),
697
+ dt: /* @__PURE__ */ new Set(["dl", "div"]),
698
+ // other
699
+ figcaption: /* @__PURE__ */ new Set(["figure"]),
700
+ // li: new Set(["ul", "ol"]),
701
+ summary: /* @__PURE__ */ new Set(["details"]),
702
+ area: /* @__PURE__ */ new Set(["map"])
703
+ };
704
+ const knownInvalidChildren = {
705
+ p: /* @__PURE__ */ new Set([
706
+ "address",
707
+ "article",
708
+ "aside",
709
+ "blockquote",
710
+ "center",
711
+ "details",
712
+ "dialog",
713
+ "dir",
714
+ "div",
715
+ "dl",
716
+ "fieldset",
717
+ "figure",
718
+ "footer",
719
+ "form",
720
+ "h1",
721
+ "h2",
722
+ "h3",
723
+ "h4",
724
+ "h5",
725
+ "h6",
726
+ "header",
727
+ "hgroup",
728
+ "hr",
729
+ "li",
730
+ "main",
731
+ "nav",
732
+ "menu",
733
+ "ol",
734
+ "p",
735
+ "pre",
736
+ "section",
737
+ "table",
738
+ "ul"
739
+ ]),
740
+ svg: /* @__PURE__ */ new Set([
741
+ "b",
742
+ "blockquote",
743
+ "br",
744
+ "code",
745
+ "dd",
746
+ "div",
747
+ "dl",
748
+ "dt",
749
+ "em",
750
+ "embed",
751
+ "h1",
752
+ "h2",
753
+ "h3",
754
+ "h4",
755
+ "h5",
756
+ "h6",
757
+ "hr",
758
+ "i",
759
+ "img",
760
+ "li",
761
+ "menu",
762
+ "meta",
763
+ "ol",
764
+ "p",
765
+ "pre",
766
+ "ruby",
767
+ "s",
768
+ "small",
769
+ "span",
770
+ "strong",
771
+ "sub",
772
+ "sup",
773
+ "table",
774
+ "u",
775
+ "ul",
776
+ "var"
777
+ ])
778
+ };
779
+ const knownInvalidParents = {
780
+ a: /* @__PURE__ */ new Set(["a"]),
781
+ button: /* @__PURE__ */ new Set(["button"]),
782
+ dd: /* @__PURE__ */ new Set(["dd", "dt"]),
783
+ dt: /* @__PURE__ */ new Set(["dd", "dt"]),
784
+ form: /* @__PURE__ */ new Set(["form"]),
785
+ li: /* @__PURE__ */ new Set(["li"]),
786
+ h1: headings,
787
+ h2: headings,
788
+ h3: headings,
789
+ h4: headings,
790
+ h5: headings,
791
+ h6: headings
792
+ };
793
+
626
794
  const DOMNodeTransforms = [
627
795
  transformStyle,
628
796
  ...[]
@@ -678,8 +846,10 @@ exports.V_ON_WITH_MODIFIERS = V_ON_WITH_MODIFIERS;
678
846
  exports.V_SHOW = V_SHOW;
679
847
  exports.compile = compile;
680
848
  exports.createDOMCompilerError = createDOMCompilerError;
849
+ exports.isValidHTMLNesting = isValidHTMLNesting;
681
850
  exports.parse = parse;
682
851
  exports.parserOptions = parserOptions;
852
+ exports.resolveModifiers = resolveModifiers;
683
853
  exports.transformStyle = transformStyle;
684
854
  Object.keys(compilerCore).forEach(function (k) {
685
855
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = compilerCore[k];
@@ -1,4 +1,4 @@
1
- import { ParserOptions, NodeTransform, SourceLocation, CompilerError, DirectiveTransform, RootNode, CompilerOptions, CodegenResult } from '@vue/compiler-core';
1
+ import { ParserOptions, NodeTransform, SourceLocation, CompilerError, ExpressionNode, SimpleExpressionNode, TransformContext, DirectiveTransform, RootNode, CompilerOptions, CodegenResult } from '@vue/compiler-core';
2
2
  export * from '@vue/compiler-core';
3
3
 
4
4
  export declare const parserOptions: ParserOptions;
@@ -34,10 +34,27 @@ export declare enum DOMErrorCodes {
34
34
  X_IGNORED_SIDE_EFFECT_TAG = 63,
35
35
  __EXTEND_POINT__ = 64
36
36
  }
37
- export declare const DOMErrorMessages: {
38
- [code: number]: string;
37
+ export declare const DOMErrorMessages: Record<DOMErrorCodes, string>;
38
+
39
+ export declare const resolveModifiers: (key: ExpressionNode | string, modifiers: SimpleExpressionNode[], context: TransformContext | null, loc: SourceLocation) => {
40
+ keyModifiers: string[];
41
+ nonKeyModifiers: string[];
42
+ eventOptionModifiers: string[];
39
43
  };
40
44
 
45
+ /**
46
+ * Copied from https://github.com/MananTank/validate-html-nesting
47
+ * with ISC license
48
+ *
49
+ * To avoid runtime dependency on validate-html-nesting
50
+ * This file should not change very often in the original repo
51
+ * but we may need to keep it up-to-date from time to time.
52
+ */
53
+ /**
54
+ * returns true if given parent-child nesting is valid HTML
55
+ */
56
+ export declare function isValidHTMLNesting(parent: string, child: string): boolean;
57
+
41
58
  export declare const DOMNodeTransforms: NodeTransform[];
42
59
  export declare const DOMDirectiveTransforms: Record<string, DirectiveTransform>;
43
60
  export declare function compile(src: string | RootNode, options?: CompilerOptions): CodegenResult;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-dom v3.5.17
2
+ * @vue/compiler-dom v3.6.0-alpha.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -37,10 +37,9 @@ const cacheStringFunction = (fn) => {
37
37
  };
38
38
  };
39
39
  const camelizeRE = /-(\w)/g;
40
+ const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
40
41
  const camelize = cacheStringFunction(
41
- (str) => {
42
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
43
- }
42
+ (str) => str.replace(camelizeRE, camelizeReplacer)
44
43
  );
45
44
  const capitalize = cacheStringFunction((str) => {
46
45
  return str.charAt(0).toUpperCase() + str.slice(1);
@@ -1715,7 +1714,7 @@ function extractIdentifiers(param, nodes = []) {
1715
1714
  const isFunctionType = (node) => {
1716
1715
  return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
1717
1716
  };
1718
- const isStaticProperty = (node) => node && (node.type === "ObjectProperty" || node.type === "ObjectMethod") && !node.computed;
1717
+ const isStaticProperty = (node) => !!node && (node.type === "ObjectProperty" || node.type === "ObjectMethod") && !node.computed;
1719
1718
  const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node;
1720
1719
  const TS_NODE_TYPES = [
1721
1720
  "TSAsExpression",
@@ -1736,6 +1735,59 @@ function unwrapTSNode(node) {
1736
1735
  return node;
1737
1736
  }
1738
1737
  }
1738
+ function isStaticNode(node) {
1739
+ node = unwrapTSNode(node);
1740
+ switch (node.type) {
1741
+ case "UnaryExpression":
1742
+ return isStaticNode(node.argument);
1743
+ case "LogicalExpression":
1744
+ // 1 > 2
1745
+ case "BinaryExpression":
1746
+ return isStaticNode(node.left) && isStaticNode(node.right);
1747
+ case "ConditionalExpression": {
1748
+ return isStaticNode(node.test) && isStaticNode(node.consequent) && isStaticNode(node.alternate);
1749
+ }
1750
+ case "SequenceExpression":
1751
+ // (1, 2)
1752
+ case "TemplateLiteral":
1753
+ return node.expressions.every((expr) => isStaticNode(expr));
1754
+ case "ParenthesizedExpression":
1755
+ return isStaticNode(node.expression);
1756
+ case "StringLiteral":
1757
+ case "NumericLiteral":
1758
+ case "BooleanLiteral":
1759
+ case "NullLiteral":
1760
+ case "BigIntLiteral":
1761
+ return true;
1762
+ }
1763
+ return false;
1764
+ }
1765
+ function isConstantNode(node, bindings) {
1766
+ if (isStaticNode(node)) return true;
1767
+ node = unwrapTSNode(node);
1768
+ switch (node.type) {
1769
+ case "Identifier":
1770
+ const type = bindings[node.name];
1771
+ return type === "literal-const";
1772
+ case "RegExpLiteral":
1773
+ return true;
1774
+ case "ObjectExpression":
1775
+ return node.properties.every((prop) => {
1776
+ if (prop.type === "ObjectMethod") return false;
1777
+ if (prop.type === "SpreadElement")
1778
+ return isConstantNode(prop.argument, bindings);
1779
+ return (!prop.computed || isConstantNode(prop.key, bindings)) && isConstantNode(prop.value, bindings);
1780
+ });
1781
+ case "ArrayExpression":
1782
+ return node.elements.every((element) => {
1783
+ if (element === null) return true;
1784
+ if (element.type === "SpreadElement")
1785
+ return isConstantNode(element.argument, bindings);
1786
+ return isConstantNode(element, bindings);
1787
+ });
1788
+ }
1789
+ return false;
1790
+ }
1739
1791
 
1740
1792
  const isStaticExp = (p) => p.type === 4 && p.isStatic;
1741
1793
  function isCoreComponent(tag) {
@@ -3086,6 +3138,10 @@ function getNodeProps(node) {
3086
3138
  }
3087
3139
  }
3088
3140
 
3141
+ function getSelfName(filename) {
3142
+ const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
3143
+ return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
3144
+ }
3089
3145
  function createTransformContext(root, {
3090
3146
  filename = "",
3091
3147
  prefixIdentifiers = false,
@@ -3110,11 +3166,10 @@ function createTransformContext(root, {
3110
3166
  onWarn = defaultOnWarn,
3111
3167
  compatConfig
3112
3168
  }) {
3113
- const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
3114
3169
  const context = {
3115
3170
  // options
3116
3171
  filename,
3117
- selfName: nameMatch && capitalize(camelize(nameMatch[1])),
3172
+ selfName: getSelfName(filename),
3118
3173
  prefixIdentifiers,
3119
3174
  hoistStatic,
3120
3175
  hmr,
@@ -3385,6 +3440,16 @@ function createStructuralDirectiveTransform(name, fn) {
3385
3440
 
3386
3441
  const PURE_ANNOTATION = `/*@__PURE__*/`;
3387
3442
  const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
3443
+ const NewlineType = {
3444
+ "Start": 0,
3445
+ "0": "Start",
3446
+ "End": -1,
3447
+ "-1": "End",
3448
+ "None": -2,
3449
+ "-2": "None",
3450
+ "Unknown": -3,
3451
+ "-3": "Unknown"
3452
+ };
3388
3453
  function createCodegenContext(ast, {
3389
3454
  mode = "function",
3390
3455
  prefixIdentifiers = mode === "module",
@@ -3423,7 +3488,7 @@ function createCodegenContext(ast, {
3423
3488
  helper(key) {
3424
3489
  return `_${helperNameMap[key]}`;
3425
3490
  },
3426
- push(code, newlineIndex = -2 /* None */, node) {
3491
+ push(code, newlineIndex = -2, node) {
3427
3492
  context.code += code;
3428
3493
  },
3429
3494
  indent() {
@@ -3441,7 +3506,7 @@ function createCodegenContext(ast, {
3441
3506
  }
3442
3507
  };
3443
3508
  function newline(n) {
3444
- context.push("\n" + ` `.repeat(n), 0 /* Start */);
3509
+ context.push("\n" + ` `.repeat(n), 0);
3445
3510
  }
3446
3511
  return context;
3447
3512
  }
@@ -3479,7 +3544,7 @@ function generate(ast, options = {}) {
3479
3544
  push(
3480
3545
  `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
3481
3546
  `,
3482
- -1 /* End */
3547
+ -1
3483
3548
  );
3484
3549
  newline();
3485
3550
  }
@@ -3509,7 +3574,7 @@ function generate(ast, options = {}) {
3509
3574
  }
3510
3575
  if (ast.components.length || ast.directives.length || ast.temps) {
3511
3576
  push(`
3512
- `, 0 /* Start */);
3577
+ `, 0);
3513
3578
  newline();
3514
3579
  }
3515
3580
  if (!ssr) {
@@ -3530,7 +3595,8 @@ function generate(ast, options = {}) {
3530
3595
  ast,
3531
3596
  code: context.code,
3532
3597
  preamble: ``,
3533
- map: context.map ? context.map.toJSON() : void 0
3598
+ map: context.map ? context.map.toJSON() : void 0,
3599
+ helpers: ast.helpers
3534
3600
  };
3535
3601
  }
3536
3602
  function genFunctionPreamble(ast, context) {
@@ -3548,7 +3614,7 @@ function genFunctionPreamble(ast, context) {
3548
3614
  if (helpers.length > 0) {
3549
3615
  {
3550
3616
  push(`const _Vue = ${VueBinding}
3551
- `, -1 /* End */);
3617
+ `, -1);
3552
3618
  if (ast.hoists.length) {
3553
3619
  const staticHelpers = [
3554
3620
  CREATE_VNODE,
@@ -3558,7 +3624,7 @@ function genFunctionPreamble(ast, context) {
3558
3624
  CREATE_STATIC
3559
3625
  ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
3560
3626
  push(`const { ${staticHelpers} } = _Vue
3561
- `, -1 /* End */);
3627
+ `, -1);
3562
3628
  }
3563
3629
  }
3564
3630
  }
@@ -3617,7 +3683,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
3617
3683
  for (let i = 0; i < nodes.length; i++) {
3618
3684
  const node = nodes[i];
3619
3685
  if (isString(node)) {
3620
- push(node, -3 /* Unknown */);
3686
+ push(node, -3);
3621
3687
  } else if (isArray(node)) {
3622
3688
  genNodeListAsArray(node, context);
3623
3689
  } else {
@@ -3635,7 +3701,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
3635
3701
  }
3636
3702
  function genNode(node, context) {
3637
3703
  if (isString(node)) {
3638
- context.push(node, -3 /* Unknown */);
3704
+ context.push(node, -3);
3639
3705
  return;
3640
3706
  }
3641
3707
  if (isSymbol(node)) {
@@ -3717,13 +3783,13 @@ function genNode(node, context) {
3717
3783
  }
3718
3784
  }
3719
3785
  function genText(node, context) {
3720
- context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
3786
+ context.push(JSON.stringify(node.content), -3, node);
3721
3787
  }
3722
3788
  function genExpression(node, context) {
3723
3789
  const { content, isStatic } = node;
3724
3790
  context.push(
3725
3791
  isStatic ? JSON.stringify(content) : content,
3726
- -3 /* Unknown */,
3792
+ -3,
3727
3793
  node
3728
3794
  );
3729
3795
  }
@@ -3738,7 +3804,7 @@ function genCompoundExpression(node, context) {
3738
3804
  for (let i = 0; i < node.children.length; i++) {
3739
3805
  const child = node.children[i];
3740
3806
  if (isString(child)) {
3741
- context.push(child, -3 /* Unknown */);
3807
+ context.push(child, -3);
3742
3808
  } else {
3743
3809
  genNode(child, context);
3744
3810
  }
@@ -3752,9 +3818,9 @@ function genExpressionAsPropertyKey(node, context) {
3752
3818
  push(`]`);
3753
3819
  } else if (node.isStatic) {
3754
3820
  const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
3755
- push(text, -2 /* None */, node);
3821
+ push(text, -2, node);
3756
3822
  } else {
3757
- push(`[${node.content}]`, -3 /* Unknown */, node);
3823
+ push(`[${node.content}]`, -3, node);
3758
3824
  }
3759
3825
  }
3760
3826
  function genComment(node, context) {
@@ -3764,7 +3830,7 @@ function genComment(node, context) {
3764
3830
  }
3765
3831
  push(
3766
3832
  `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
3767
- -3 /* Unknown */,
3833
+ -3,
3768
3834
  node
3769
3835
  );
3770
3836
  }
@@ -3802,7 +3868,7 @@ function genVNodeCall(node, context) {
3802
3868
  push(PURE_ANNOTATION);
3803
3869
  }
3804
3870
  const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
3805
- push(helper(callHelper) + `(`, -2 /* None */, node);
3871
+ push(helper(callHelper) + `(`, -2, node);
3806
3872
  genNodeList(
3807
3873
  genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
3808
3874
  context
@@ -3830,7 +3896,7 @@ function genCallExpression(node, context) {
3830
3896
  if (pure) {
3831
3897
  push(PURE_ANNOTATION);
3832
3898
  }
3833
- push(callee + `(`, -2 /* None */, node);
3899
+ push(callee + `(`, -2, node);
3834
3900
  genNodeList(node.arguments, context);
3835
3901
  push(`)`);
3836
3902
  }
@@ -3838,7 +3904,7 @@ function genObjectExpression(node, context) {
3838
3904
  const { push, indent, deindent, newline } = context;
3839
3905
  const { properties } = node;
3840
3906
  if (!properties.length) {
3841
- push(`{}`, -2 /* None */, node);
3907
+ push(`{}`, -2, node);
3842
3908
  return;
3843
3909
  }
3844
3910
  const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
@@ -3866,7 +3932,7 @@ function genFunctionExpression(node, context) {
3866
3932
  if (isSlot) {
3867
3933
  push(`_${helperNameMap[WITH_CTX]}(`);
3868
3934
  }
3869
- push(`(`, -2 /* None */, node);
3935
+ push(`(`, -2, node);
3870
3936
  if (isArray(params)) {
3871
3937
  genNodeList(params, context);
3872
3938
  } else if (params) {
@@ -3996,6 +4062,7 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
3996
4062
  }
3997
4063
  }
3998
4064
 
4065
+ const isLiteralWhitelisted = /* @__PURE__ */ makeMap("true,false,null,this");
3999
4066
  const transformExpression = (node, context) => {
4000
4067
  if (node.type === 5) {
4001
4068
  node.content = processExpression(
@@ -6095,7 +6162,9 @@ const DOMErrorMessages = {
6095
6162
  [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
6096
6163
  [61]: `v-show is missing expression.`,
6097
6164
  [62]: `<Transition> expects exactly one child element or component.`,
6098
- [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
6165
+ [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
6166
+ // just to fulfill types
6167
+ [64]: ``
6099
6168
  };
6100
6169
 
6101
6170
  const transformVHtml = (dir, node, context) => {
@@ -6244,7 +6313,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
6244
6313
  const eventOptionModifiers = [];
6245
6314
  for (let i = 0; i < modifiers.length; i++) {
6246
6315
  const modifier = modifiers[i].content;
6247
- if (modifier === "native" && checkCompatEnabled(
6316
+ if (modifier === "native" && context && checkCompatEnabled(
6248
6317
  "COMPILER_V_ON_NATIVE",
6249
6318
  context,
6250
6319
  loc
@@ -6253,9 +6322,10 @@ const resolveModifiers = (key, modifiers, context, loc) => {
6253
6322
  } else if (isEventOptionModifier(modifier)) {
6254
6323
  eventOptionModifiers.push(modifier);
6255
6324
  } else {
6325
+ const keyString = isString(key) ? key : isStaticExp(key) ? key.content : null;
6256
6326
  if (maybeKeyModifier(modifier)) {
6257
- if (isStaticExp(key)) {
6258
- if (isKeyboardEvent(key.content.toLowerCase())) {
6327
+ if (keyString) {
6328
+ if (isKeyboardEvent(keyString.toLowerCase())) {
6259
6329
  keyModifiers.push(modifier);
6260
6330
  } else {
6261
6331
  nonKeyModifiers.push(modifier);
@@ -6609,4 +6679,4 @@ function parse(template, options = {}) {
6609
6679
  return baseParse(template, extend({}, parserOptions, options));
6610
6680
  }
6611
6681
 
6612
- export { BASE_TRANSITION, BindingTypes, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, CompilerDeprecationTypes, ConstantTypes, DOMDirectiveTransforms, DOMErrorCodes, DOMErrorMessages, DOMNodeTransforms, ElementTypes, ErrorCodes, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, Namespaces, NodeTypes, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, TRANSITION, TRANSITION_GROUP, TS_NODE_TYPES, UNREF, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, compile, convertToBlock, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createDOMCompilerError, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, errorMessages, extractIdentifiers, findDir, findProp, forAliasRE, generate, generateCodeFrame, getBaseTransformPreset, getConstantType, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isCoreComponent, isFnExpression, isFnExpressionBrowser, isFnExpressionNode, isFunctionType, isInDestructureAssignment, isInNewExpression, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVSlot, locStub, noopDirectiveTransform, parse, parserOptions, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel$1 as transformModel, transformOn$1 as transformOn, transformStyle, traverseNode, unwrapTSNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
6682
+ export { BASE_TRANSITION, BindingTypes, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, CompilerDeprecationTypes, ConstantTypes, DOMDirectiveTransforms, DOMErrorCodes, DOMErrorMessages, DOMNodeTransforms, ElementTypes, ErrorCodes, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, Namespaces, NewlineType, NodeTypes, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, TRANSITION, TRANSITION_GROUP, TS_NODE_TYPES, UNREF, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, compile, convertToBlock, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createDOMCompilerError, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, defaultOnError, defaultOnWarn, errorMessages, extractIdentifiers, findDir, findProp, forAliasRE, generate, generateCodeFrame, getBaseTransformPreset, getConstantType, getMemoedVNodeCall, getSelfName, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isConstantNode, isCoreComponent, isFnExpression, isFnExpressionBrowser, isFnExpressionNode, isFunctionType, isInDestructureAssignment, isInNewExpression, isLiteralWhitelisted, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticNode, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVSlot, isValidHTMLNesting, locStub, noopDirectiveTransform, parse, parserOptions, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, resolveModifiers, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel$1 as transformModel, transformOn$1 as transformOn, transformStyle, traverseNode, unwrapTSNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };