@vue/compiler-sfc 3.2.36 → 3.2.39

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.
@@ -18,29 +18,29 @@ function makeMap(str, expectsLowerCase) {
18
18
  * dev only flag -> name mapping
19
19
  */
20
20
  const PatchFlagNames = {
21
- [1 /* TEXT */]: `TEXT`,
22
- [2 /* CLASS */]: `CLASS`,
23
- [4 /* STYLE */]: `STYLE`,
24
- [8 /* PROPS */]: `PROPS`,
25
- [16 /* FULL_PROPS */]: `FULL_PROPS`,
26
- [32 /* HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
27
- [64 /* STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
28
- [128 /* KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
29
- [256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
30
- [512 /* NEED_PATCH */]: `NEED_PATCH`,
31
- [1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
32
- [2048 /* DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
33
- [-1 /* HOISTED */]: `HOISTED`,
34
- [-2 /* BAIL */]: `BAIL`
21
+ [1 /* PatchFlags.TEXT */]: `TEXT`,
22
+ [2 /* PatchFlags.CLASS */]: `CLASS`,
23
+ [4 /* PatchFlags.STYLE */]: `STYLE`,
24
+ [8 /* PatchFlags.PROPS */]: `PROPS`,
25
+ [16 /* PatchFlags.FULL_PROPS */]: `FULL_PROPS`,
26
+ [32 /* PatchFlags.HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
27
+ [64 /* PatchFlags.STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
28
+ [128 /* PatchFlags.KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
29
+ [256 /* PatchFlags.UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
30
+ [512 /* PatchFlags.NEED_PATCH */]: `NEED_PATCH`,
31
+ [1024 /* PatchFlags.DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
32
+ [2048 /* PatchFlags.DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
33
+ [-1 /* PatchFlags.HOISTED */]: `HOISTED`,
34
+ [-2 /* PatchFlags.BAIL */]: `BAIL`
35
35
  };
36
36
 
37
37
  /**
38
38
  * Dev only
39
39
  */
40
40
  const slotFlagsText = {
41
- [1 /* STABLE */]: 'STABLE',
42
- [2 /* DYNAMIC */]: 'DYNAMIC',
43
- [3 /* FORWARDED */]: 'FORWARDED'
41
+ [1 /* SlotFlags.STABLE */]: 'STABLE',
42
+ [2 /* SlotFlags.DYNAMIC */]: 'DYNAMIC',
43
+ [3 /* SlotFlags.FORWARDED */]: 'FORWARDED'
44
44
  };
45
45
 
46
46
  const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
@@ -477,65 +477,65 @@ function createCompilerError(code, loc, messages, additionalMessage) {
477
477
  }
478
478
  const errorMessages = {
479
479
  // parse errors
480
- [0 /* ABRUPT_CLOSING_OF_EMPTY_COMMENT */]: 'Illegal comment.',
481
- [1 /* CDATA_IN_HTML_CONTENT */]: 'CDATA section is allowed only in XML context.',
482
- [2 /* DUPLICATE_ATTRIBUTE */]: 'Duplicate attribute.',
483
- [3 /* END_TAG_WITH_ATTRIBUTES */]: 'End tag cannot have attributes.',
484
- [4 /* END_TAG_WITH_TRAILING_SOLIDUS */]: "Illegal '/' in tags.",
485
- [5 /* EOF_BEFORE_TAG_NAME */]: 'Unexpected EOF in tag.',
486
- [6 /* EOF_IN_CDATA */]: 'Unexpected EOF in CDATA section.',
487
- [7 /* EOF_IN_COMMENT */]: 'Unexpected EOF in comment.',
488
- [8 /* EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT */]: 'Unexpected EOF in script.',
489
- [9 /* EOF_IN_TAG */]: 'Unexpected EOF in tag.',
490
- [10 /* INCORRECTLY_CLOSED_COMMENT */]: 'Incorrectly closed comment.',
491
- [11 /* INCORRECTLY_OPENED_COMMENT */]: 'Incorrectly opened comment.',
492
- [12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */]: "Illegal tag name. Use '&lt;' to print '<'.",
493
- [13 /* MISSING_ATTRIBUTE_VALUE */]: 'Attribute value was expected.',
494
- [14 /* MISSING_END_TAG_NAME */]: 'End tag name was expected.',
495
- [15 /* MISSING_WHITESPACE_BETWEEN_ATTRIBUTES */]: 'Whitespace was expected.',
496
- [16 /* NESTED_COMMENT */]: "Unexpected '<!--' in comment.",
497
- [17 /* UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME */]: 'Attribute name cannot contain U+0022 ("), U+0027 (\'), and U+003C (<).',
498
- [18 /* UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */]: 'Unquoted attribute value cannot contain U+0022 ("), U+0027 (\'), U+003C (<), U+003D (=), and U+0060 (`).',
499
- [19 /* UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */]: "Attribute name cannot start with '='.",
500
- [21 /* UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */]: "'<?' is allowed only in XML context.",
501
- [20 /* UNEXPECTED_NULL_CHARACTER */]: `Unexpected null character.`,
502
- [22 /* UNEXPECTED_SOLIDUS_IN_TAG */]: "Illegal '/' in tags.",
480
+ [0 /* ErrorCodes.ABRUPT_CLOSING_OF_EMPTY_COMMENT */]: 'Illegal comment.',
481
+ [1 /* ErrorCodes.CDATA_IN_HTML_CONTENT */]: 'CDATA section is allowed only in XML context.',
482
+ [2 /* ErrorCodes.DUPLICATE_ATTRIBUTE */]: 'Duplicate attribute.',
483
+ [3 /* ErrorCodes.END_TAG_WITH_ATTRIBUTES */]: 'End tag cannot have attributes.',
484
+ [4 /* ErrorCodes.END_TAG_WITH_TRAILING_SOLIDUS */]: "Illegal '/' in tags.",
485
+ [5 /* ErrorCodes.EOF_BEFORE_TAG_NAME */]: 'Unexpected EOF in tag.',
486
+ [6 /* ErrorCodes.EOF_IN_CDATA */]: 'Unexpected EOF in CDATA section.',
487
+ [7 /* ErrorCodes.EOF_IN_COMMENT */]: 'Unexpected EOF in comment.',
488
+ [8 /* ErrorCodes.EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT */]: 'Unexpected EOF in script.',
489
+ [9 /* ErrorCodes.EOF_IN_TAG */]: 'Unexpected EOF in tag.',
490
+ [10 /* ErrorCodes.INCORRECTLY_CLOSED_COMMENT */]: 'Incorrectly closed comment.',
491
+ [11 /* ErrorCodes.INCORRECTLY_OPENED_COMMENT */]: 'Incorrectly opened comment.',
492
+ [12 /* ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME */]: "Illegal tag name. Use '&lt;' to print '<'.",
493
+ [13 /* ErrorCodes.MISSING_ATTRIBUTE_VALUE */]: 'Attribute value was expected.',
494
+ [14 /* ErrorCodes.MISSING_END_TAG_NAME */]: 'End tag name was expected.',
495
+ [15 /* ErrorCodes.MISSING_WHITESPACE_BETWEEN_ATTRIBUTES */]: 'Whitespace was expected.',
496
+ [16 /* ErrorCodes.NESTED_COMMENT */]: "Unexpected '<!--' in comment.",
497
+ [17 /* ErrorCodes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME */]: 'Attribute name cannot contain U+0022 ("), U+0027 (\'), and U+003C (<).',
498
+ [18 /* ErrorCodes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */]: 'Unquoted attribute value cannot contain U+0022 ("), U+0027 (\'), U+003C (<), U+003D (=), and U+0060 (`).',
499
+ [19 /* ErrorCodes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */]: "Attribute name cannot start with '='.",
500
+ [21 /* ErrorCodes.UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */]: "'<?' is allowed only in XML context.",
501
+ [20 /* ErrorCodes.UNEXPECTED_NULL_CHARACTER */]: `Unexpected null character.`,
502
+ [22 /* ErrorCodes.UNEXPECTED_SOLIDUS_IN_TAG */]: "Illegal '/' in tags.",
503
503
  // Vue-specific parse errors
504
- [23 /* X_INVALID_END_TAG */]: 'Invalid end tag.',
505
- [24 /* X_MISSING_END_TAG */]: 'Element is missing end tag.',
506
- [25 /* X_MISSING_INTERPOLATION_END */]: 'Interpolation end sign was not found.',
507
- [27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */]: 'End bracket for dynamic directive argument was not found. ' +
504
+ [23 /* ErrorCodes.X_INVALID_END_TAG */]: 'Invalid end tag.',
505
+ [24 /* ErrorCodes.X_MISSING_END_TAG */]: 'Element is missing end tag.',
506
+ [25 /* ErrorCodes.X_MISSING_INTERPOLATION_END */]: 'Interpolation end sign was not found.',
507
+ [27 /* ErrorCodes.X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */]: 'End bracket for dynamic directive argument was not found. ' +
508
508
  'Note that dynamic directive argument cannot contain spaces.',
509
- [26 /* X_MISSING_DIRECTIVE_NAME */]: 'Legal directive name was expected.',
509
+ [26 /* ErrorCodes.X_MISSING_DIRECTIVE_NAME */]: 'Legal directive name was expected.',
510
510
  // transform errors
511
- [28 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
512
- [29 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
513
- [30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
514
- [31 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
515
- [32 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
516
- [33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
517
- [34 /* X_V_BIND_NO_EXPRESSION */]: `v-bind is missing expression.`,
518
- [35 /* X_V_ON_NO_EXPRESSION */]: `v-on is missing expression.`,
519
- [36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */]: `Unexpected custom directive on <slot> outlet.`,
520
- [37 /* X_V_SLOT_MIXED_SLOT_USAGE */]: `Mixed v-slot usage on both the component and nested <template>.` +
511
+ [28 /* ErrorCodes.X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
512
+ [29 /* ErrorCodes.X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
513
+ [30 /* ErrorCodes.X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
514
+ [31 /* ErrorCodes.X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
515
+ [32 /* ErrorCodes.X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
516
+ [33 /* ErrorCodes.X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
517
+ [34 /* ErrorCodes.X_V_BIND_NO_EXPRESSION */]: `v-bind is missing expression.`,
518
+ [35 /* ErrorCodes.X_V_ON_NO_EXPRESSION */]: `v-on is missing expression.`,
519
+ [36 /* ErrorCodes.X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */]: `Unexpected custom directive on <slot> outlet.`,
520
+ [37 /* ErrorCodes.X_V_SLOT_MIXED_SLOT_USAGE */]: `Mixed v-slot usage on both the component and nested <template>.` +
521
521
  `When there are multiple named slots, all slots should use <template> ` +
522
522
  `syntax to avoid scope ambiguity.`,
523
- [38 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */]: `Duplicate slot names found. `,
524
- [39 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */]: `Extraneous children found when component already has explicitly named ` +
523
+ [38 /* ErrorCodes.X_V_SLOT_DUPLICATE_SLOT_NAMES */]: `Duplicate slot names found. `,
524
+ [39 /* ErrorCodes.X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */]: `Extraneous children found when component already has explicitly named ` +
525
525
  `default slot. These children will be ignored.`,
526
- [40 /* X_V_SLOT_MISPLACED */]: `v-slot can only be used on components or <template> tags.`,
527
- [41 /* X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
528
- [42 /* X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
529
- [43 /* X_V_MODEL_ON_SCOPE_VARIABLE */]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
530
- [44 /* X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
531
- [45 /* X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
526
+ [40 /* ErrorCodes.X_V_SLOT_MISPLACED */]: `v-slot can only be used on components or <template> tags.`,
527
+ [41 /* ErrorCodes.X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
528
+ [42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
529
+ [43 /* ErrorCodes.X_V_MODEL_ON_SCOPE_VARIABLE */]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
530
+ [44 /* ErrorCodes.X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
531
+ [45 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
532
532
  // generic errors
533
- [46 /* X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
534
- [47 /* X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
535
- [48 /* X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
536
- [49 /* X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
533
+ [46 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
534
+ [47 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
535
+ [48 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
536
+ [49 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
537
537
  // just to fulfill types
538
- [50 /* __EXTEND_POINT__ */]: ``
538
+ [50 /* ErrorCodes.__EXTEND_POINT__ */]: ``
539
539
  };
540
540
 
541
541
  const FRAGMENT = Symbol(`Fragment` );
@@ -638,7 +638,7 @@ const locStub = {
638
638
  };
639
639
  function createRoot(children, loc = locStub) {
640
640
  return {
641
- type: 0 /* ROOT */,
641
+ type: 0 /* NodeTypes.ROOT */,
642
642
  children,
643
643
  helpers: [],
644
644
  components: [],
@@ -665,7 +665,7 @@ function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps,
665
665
  }
666
666
  }
667
667
  return {
668
- type: 13 /* VNODE_CALL */,
668
+ type: 13 /* NodeTypes.VNODE_CALL */,
669
669
  tag,
670
670
  props,
671
671
  children,
@@ -680,38 +680,38 @@ function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps,
680
680
  }
681
681
  function createArrayExpression(elements, loc = locStub) {
682
682
  return {
683
- type: 17 /* JS_ARRAY_EXPRESSION */,
683
+ type: 17 /* NodeTypes.JS_ARRAY_EXPRESSION */,
684
684
  loc,
685
685
  elements
686
686
  };
687
687
  }
688
688
  function createObjectExpression(properties, loc = locStub) {
689
689
  return {
690
- type: 15 /* JS_OBJECT_EXPRESSION */,
690
+ type: 15 /* NodeTypes.JS_OBJECT_EXPRESSION */,
691
691
  loc,
692
692
  properties
693
693
  };
694
694
  }
695
695
  function createObjectProperty(key, value) {
696
696
  return {
697
- type: 16 /* JS_PROPERTY */,
697
+ type: 16 /* NodeTypes.JS_PROPERTY */,
698
698
  loc: locStub,
699
699
  key: isString(key) ? createSimpleExpression(key, true) : key,
700
700
  value
701
701
  };
702
702
  }
703
- function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0 /* NOT_CONSTANT */) {
703
+ function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0 /* ConstantTypes.NOT_CONSTANT */) {
704
704
  return {
705
- type: 4 /* SIMPLE_EXPRESSION */,
705
+ type: 4 /* NodeTypes.SIMPLE_EXPRESSION */,
706
706
  loc,
707
707
  content,
708
708
  isStatic,
709
- constType: isStatic ? 3 /* CAN_STRINGIFY */ : constType
709
+ constType: isStatic ? 3 /* ConstantTypes.CAN_STRINGIFY */ : constType
710
710
  };
711
711
  }
712
712
  function createInterpolation(content, loc) {
713
713
  return {
714
- type: 5 /* INTERPOLATION */,
714
+ type: 5 /* NodeTypes.INTERPOLATION */,
715
715
  loc,
716
716
  content: isString(content)
717
717
  ? createSimpleExpression(content, false, loc)
@@ -720,14 +720,14 @@ function createInterpolation(content, loc) {
720
720
  }
721
721
  function createCompoundExpression(children, loc = locStub) {
722
722
  return {
723
- type: 8 /* COMPOUND_EXPRESSION */,
723
+ type: 8 /* NodeTypes.COMPOUND_EXPRESSION */,
724
724
  loc,
725
725
  children
726
726
  };
727
727
  }
728
728
  function createCallExpression(callee, args = [], loc = locStub) {
729
729
  return {
730
- type: 14 /* JS_CALL_EXPRESSION */,
730
+ type: 14 /* NodeTypes.JS_CALL_EXPRESSION */,
731
731
  loc,
732
732
  callee,
733
733
  arguments: args
@@ -735,7 +735,7 @@ function createCallExpression(callee, args = [], loc = locStub) {
735
735
  }
736
736
  function createFunctionExpression(params, returns = undefined, newline = false, isSlot = false, loc = locStub) {
737
737
  return {
738
- type: 18 /* JS_FUNCTION_EXPRESSION */,
738
+ type: 18 /* NodeTypes.JS_FUNCTION_EXPRESSION */,
739
739
  params,
740
740
  returns,
741
741
  newline,
@@ -745,7 +745,7 @@ function createFunctionExpression(params, returns = undefined, newline = false,
745
745
  }
746
746
  function createConditionalExpression(test, consequent, alternate, newline = true) {
747
747
  return {
748
- type: 19 /* JS_CONDITIONAL_EXPRESSION */,
748
+ type: 19 /* NodeTypes.JS_CONDITIONAL_EXPRESSION */,
749
749
  test,
750
750
  consequent,
751
751
  alternate,
@@ -755,7 +755,7 @@ function createConditionalExpression(test, consequent, alternate, newline = true
755
755
  }
756
756
  function createCacheExpression(index, value, isVNode = false) {
757
757
  return {
758
- type: 20 /* JS_CACHE_EXPRESSION */,
758
+ type: 20 /* NodeTypes.JS_CACHE_EXPRESSION */,
759
759
  index,
760
760
  value,
761
761
  isVNode,
@@ -764,21 +764,21 @@ function createCacheExpression(index, value, isVNode = false) {
764
764
  }
765
765
  function createBlockStatement(body) {
766
766
  return {
767
- type: 21 /* JS_BLOCK_STATEMENT */,
767
+ type: 21 /* NodeTypes.JS_BLOCK_STATEMENT */,
768
768
  body,
769
769
  loc: locStub
770
770
  };
771
771
  }
772
772
  function createTemplateLiteral(elements) {
773
773
  return {
774
- type: 22 /* JS_TEMPLATE_LITERAL */,
774
+ type: 22 /* NodeTypes.JS_TEMPLATE_LITERAL */,
775
775
  elements,
776
776
  loc: locStub
777
777
  };
778
778
  }
779
779
  function createIfStatement(test, consequent, alternate) {
780
780
  return {
781
- type: 23 /* JS_IF_STATEMENT */,
781
+ type: 23 /* NodeTypes.JS_IF_STATEMENT */,
782
782
  test,
783
783
  consequent,
784
784
  alternate,
@@ -787,7 +787,7 @@ function createIfStatement(test, consequent, alternate) {
787
787
  }
788
788
  function createAssignmentExpression(left, right) {
789
789
  return {
790
- type: 24 /* JS_ASSIGNMENT_EXPRESSION */,
790
+ type: 24 /* NodeTypes.JS_ASSIGNMENT_EXPRESSION */,
791
791
  left,
792
792
  right,
793
793
  loc: locStub
@@ -795,14 +795,14 @@ function createAssignmentExpression(left, right) {
795
795
  }
796
796
  function createSequenceExpression(expressions) {
797
797
  return {
798
- type: 25 /* JS_SEQUENCE_EXPRESSION */,
798
+ type: 25 /* NodeTypes.JS_SEQUENCE_EXPRESSION */,
799
799
  expressions,
800
800
  loc: locStub
801
801
  };
802
802
  }
803
803
  function createReturnStatement(returns) {
804
804
  return {
805
- type: 26 /* JS_RETURN_STATEMENT */,
805
+ type: 26 /* NodeTypes.JS_RETURN_STATEMENT */,
806
806
  returns,
807
807
  loc: locStub
808
808
  };
@@ -15959,7 +15959,7 @@ var tokTypes_1 = tokTypes;
15959
15959
  tokTypes: tokTypes_1
15960
15960
  }, '__esModule', {value: true});
15961
15961
 
15962
- const isStaticExp = (p) => p.type === 4 /* SIMPLE_EXPRESSION */ && p.isStatic;
15962
+ const isStaticExp = (p) => p.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ && p.isStatic;
15963
15963
  const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
15964
15964
  function isCoreComponent(tag) {
15965
15965
  if (isBuiltInType(tag, 'Teleport')) {
@@ -15989,7 +15989,7 @@ const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
15989
15989
  const isMemberExpressionBrowser = (path) => {
15990
15990
  // remove whitespaces around . or [ first
15991
15991
  path = path.trim().replace(whitespaceRE, s => s.trim());
15992
- let state = 0 /* inMemberExp */;
15992
+ let state = 0 /* MemberExpLexState.inMemberExp */;
15993
15993
  let stateStack = [];
15994
15994
  let currentOpenBracketCount = 0;
15995
15995
  let currentOpenParensCount = 0;
@@ -15997,25 +15997,25 @@ const isMemberExpressionBrowser = (path) => {
15997
15997
  for (let i = 0; i < path.length; i++) {
15998
15998
  const char = path.charAt(i);
15999
15999
  switch (state) {
16000
- case 0 /* inMemberExp */:
16000
+ case 0 /* MemberExpLexState.inMemberExp */:
16001
16001
  if (char === '[') {
16002
16002
  stateStack.push(state);
16003
- state = 1 /* inBrackets */;
16003
+ state = 1 /* MemberExpLexState.inBrackets */;
16004
16004
  currentOpenBracketCount++;
16005
16005
  }
16006
16006
  else if (char === '(') {
16007
16007
  stateStack.push(state);
16008
- state = 2 /* inParens */;
16008
+ state = 2 /* MemberExpLexState.inParens */;
16009
16009
  currentOpenParensCount++;
16010
16010
  }
16011
16011
  else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
16012
16012
  return false;
16013
16013
  }
16014
16014
  break;
16015
- case 1 /* inBrackets */:
16015
+ case 1 /* MemberExpLexState.inBrackets */:
16016
16016
  if (char === `'` || char === `"` || char === '`') {
16017
16017
  stateStack.push(state);
16018
- state = 3 /* inString */;
16018
+ state = 3 /* MemberExpLexState.inString */;
16019
16019
  currentStringType = char;
16020
16020
  }
16021
16021
  else if (char === `[`) {
@@ -16027,10 +16027,10 @@ const isMemberExpressionBrowser = (path) => {
16027
16027
  }
16028
16028
  }
16029
16029
  break;
16030
- case 2 /* inParens */:
16030
+ case 2 /* MemberExpLexState.inParens */:
16031
16031
  if (char === `'` || char === `"` || char === '`') {
16032
16032
  stateStack.push(state);
16033
- state = 3 /* inString */;
16033
+ state = 3 /* MemberExpLexState.inString */;
16034
16034
  currentStringType = char;
16035
16035
  }
16036
16036
  else if (char === `(`) {
@@ -16046,7 +16046,7 @@ const isMemberExpressionBrowser = (path) => {
16046
16046
  }
16047
16047
  }
16048
16048
  break;
16049
- case 3 /* inString */:
16049
+ case 3 /* MemberExpLexState.inString */:
16050
16050
  if (char === currentStringType) {
16051
16051
  state = stateStack.pop();
16052
16052
  currentStringType = null;
@@ -16116,7 +16116,7 @@ function assert$1(condition, msg) {
16116
16116
  function findDir(node, name, allowEmpty = false) {
16117
16117
  for (let i = 0; i < node.props.length; i++) {
16118
16118
  const p = node.props[i];
16119
- if (p.type === 7 /* DIRECTIVE */ &&
16119
+ if (p.type === 7 /* NodeTypes.DIRECTIVE */ &&
16120
16120
  (allowEmpty || p.exp) &&
16121
16121
  (isString(name) ? p.name === name : name.test(p.name))) {
16122
16122
  return p;
@@ -16126,7 +16126,7 @@ function findDir(node, name, allowEmpty = false) {
16126
16126
  function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
16127
16127
  for (let i = 0; i < node.props.length; i++) {
16128
16128
  const p = node.props[i];
16129
- if (p.type === 6 /* ATTRIBUTE */) {
16129
+ if (p.type === 6 /* NodeTypes.ATTRIBUTE */) {
16130
16130
  if (dynamicOnly)
16131
16131
  continue;
16132
16132
  if (p.name === name && (p.value || allowEmpty)) {
@@ -16144,24 +16144,24 @@ function isStaticArgOf(arg, name) {
16144
16144
  return !!(arg && isStaticExp(arg) && arg.content === name);
16145
16145
  }
16146
16146
  function hasDynamicKeyVBind(node) {
16147
- return node.props.some(p => p.type === 7 /* DIRECTIVE */ &&
16147
+ return node.props.some(p => p.type === 7 /* NodeTypes.DIRECTIVE */ &&
16148
16148
  p.name === 'bind' &&
16149
16149
  (!p.arg || // v-bind="obj"
16150
- p.arg.type !== 4 /* SIMPLE_EXPRESSION */ || // v-bind:[_ctx.foo]
16150
+ p.arg.type !== 4 /* NodeTypes.SIMPLE_EXPRESSION */ || // v-bind:[_ctx.foo]
16151
16151
  !p.arg.isStatic) // v-bind:[foo]
16152
16152
  );
16153
16153
  }
16154
16154
  function isText(node) {
16155
- return node.type === 5 /* INTERPOLATION */ || node.type === 2 /* TEXT */;
16155
+ return node.type === 5 /* NodeTypes.INTERPOLATION */ || node.type === 2 /* NodeTypes.TEXT */;
16156
16156
  }
16157
16157
  function isVSlot(p) {
16158
- return p.type === 7 /* DIRECTIVE */ && p.name === 'slot';
16158
+ return p.type === 7 /* NodeTypes.DIRECTIVE */ && p.name === 'slot';
16159
16159
  }
16160
16160
  function isTemplateNode(node) {
16161
- return (node.type === 1 /* ELEMENT */ && node.tagType === 3 /* TEMPLATE */);
16161
+ return (node.type === 1 /* NodeTypes.ELEMENT */ && node.tagType === 3 /* ElementTypes.TEMPLATE */);
16162
16162
  }
16163
16163
  function isSlotOutlet(node) {
16164
- return node.type === 1 /* ELEMENT */ && node.tagType === 2 /* SLOT */;
16164
+ return node.type === 1 /* NodeTypes.ELEMENT */ && node.tagType === 2 /* ElementTypes.SLOT */;
16165
16165
  }
16166
16166
  function getVNodeHelper(ssr, isComponent) {
16167
16167
  return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
@@ -16173,7 +16173,7 @@ const propsHelperSet = new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
16173
16173
  function getUnnormalizedProps(props, callPath = []) {
16174
16174
  if (props &&
16175
16175
  !isString(props) &&
16176
- props.type === 14 /* JS_CALL_EXPRESSION */) {
16176
+ props.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */) {
16177
16177
  const callee = props.callee;
16178
16178
  if (!isString(callee) && propsHelperSet.has(callee)) {
16179
16179
  return getUnnormalizedProps(props.arguments[0], callPath.concat(props));
@@ -16191,12 +16191,12 @@ function injectProp(node, prop, context) {
16191
16191
  *
16192
16192
  * we need to get the real props before normalization
16193
16193
  */
16194
- let props = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
16194
+ let props = node.type === 13 /* NodeTypes.VNODE_CALL */ ? node.props : node.arguments[2];
16195
16195
  let callPath = [];
16196
16196
  let parentCall;
16197
16197
  if (props &&
16198
16198
  !isString(props) &&
16199
- props.type === 14 /* JS_CALL_EXPRESSION */) {
16199
+ props.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */) {
16200
16200
  const ret = getUnnormalizedProps(props);
16201
16201
  props = ret[0];
16202
16202
  callPath = ret[1];
@@ -16205,12 +16205,12 @@ function injectProp(node, prop, context) {
16205
16205
  if (props == null || isString(props)) {
16206
16206
  propsWithInjection = createObjectExpression([prop]);
16207
16207
  }
16208
- else if (props.type === 14 /* JS_CALL_EXPRESSION */) {
16208
+ else if (props.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */) {
16209
16209
  // merged props... add ours
16210
16210
  // only inject key to object literal if it's the first argument so that
16211
16211
  // if doesn't override user provided keys
16212
16212
  const first = props.arguments[0];
16213
- if (!isString(first) && first.type === 15 /* JS_OBJECT_EXPRESSION */) {
16213
+ if (!isString(first) && first.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
16214
16214
  first.properties.unshift(prop);
16215
16215
  }
16216
16216
  else {
@@ -16227,12 +16227,12 @@ function injectProp(node, prop, context) {
16227
16227
  }
16228
16228
  !propsWithInjection && (propsWithInjection = props);
16229
16229
  }
16230
- else if (props.type === 15 /* JS_OBJECT_EXPRESSION */) {
16230
+ else if (props.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
16231
16231
  let alreadyExists = false;
16232
16232
  // check existing key to avoid overriding user provided keys
16233
- if (prop.key.type === 4 /* SIMPLE_EXPRESSION */) {
16233
+ if (prop.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
16234
16234
  const propKeyName = prop.key.content;
16235
- alreadyExists = props.properties.some(p => p.key.type === 4 /* SIMPLE_EXPRESSION */ &&
16235
+ alreadyExists = props.properties.some(p => p.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
16236
16236
  p.key.content === propKeyName);
16237
16237
  }
16238
16238
  if (!alreadyExists) {
@@ -16253,7 +16253,7 @@ function injectProp(node, prop, context) {
16253
16253
  parentCall = callPath[callPath.length - 2];
16254
16254
  }
16255
16255
  }
16256
- if (node.type === 13 /* VNODE_CALL */) {
16256
+ if (node.type === 13 /* NodeTypes.VNODE_CALL */) {
16257
16257
  if (parentCall) {
16258
16258
  parentCall.arguments[0] = propsWithInjection;
16259
16259
  }
@@ -16282,45 +16282,45 @@ function hasScopeRef(node, ids) {
16282
16282
  return false;
16283
16283
  }
16284
16284
  switch (node.type) {
16285
- case 1 /* ELEMENT */:
16285
+ case 1 /* NodeTypes.ELEMENT */:
16286
16286
  for (let i = 0; i < node.props.length; i++) {
16287
16287
  const p = node.props[i];
16288
- if (p.type === 7 /* DIRECTIVE */ &&
16288
+ if (p.type === 7 /* NodeTypes.DIRECTIVE */ &&
16289
16289
  (hasScopeRef(p.arg, ids) || hasScopeRef(p.exp, ids))) {
16290
16290
  return true;
16291
16291
  }
16292
16292
  }
16293
16293
  return node.children.some(c => hasScopeRef(c, ids));
16294
- case 11 /* FOR */:
16294
+ case 11 /* NodeTypes.FOR */:
16295
16295
  if (hasScopeRef(node.source, ids)) {
16296
16296
  return true;
16297
16297
  }
16298
16298
  return node.children.some(c => hasScopeRef(c, ids));
16299
- case 9 /* IF */:
16299
+ case 9 /* NodeTypes.IF */:
16300
16300
  return node.branches.some(b => hasScopeRef(b, ids));
16301
- case 10 /* IF_BRANCH */:
16301
+ case 10 /* NodeTypes.IF_BRANCH */:
16302
16302
  if (hasScopeRef(node.condition, ids)) {
16303
16303
  return true;
16304
16304
  }
16305
16305
  return node.children.some(c => hasScopeRef(c, ids));
16306
- case 4 /* SIMPLE_EXPRESSION */:
16306
+ case 4 /* NodeTypes.SIMPLE_EXPRESSION */:
16307
16307
  return (!node.isStatic &&
16308
16308
  isSimpleIdentifier(node.content) &&
16309
16309
  !!ids[node.content]);
16310
- case 8 /* COMPOUND_EXPRESSION */:
16310
+ case 8 /* NodeTypes.COMPOUND_EXPRESSION */:
16311
16311
  return node.children.some(c => isObject(c) && hasScopeRef(c, ids));
16312
- case 5 /* INTERPOLATION */:
16313
- case 12 /* TEXT_CALL */:
16312
+ case 5 /* NodeTypes.INTERPOLATION */:
16313
+ case 12 /* NodeTypes.TEXT_CALL */:
16314
16314
  return hasScopeRef(node.content, ids);
16315
- case 2 /* TEXT */:
16316
- case 3 /* COMMENT */:
16315
+ case 2 /* NodeTypes.TEXT */:
16316
+ case 3 /* NodeTypes.COMMENT */:
16317
16317
  return false;
16318
16318
  default:
16319
16319
  return false;
16320
16320
  }
16321
16321
  }
16322
16322
  function getMemoedVNodeCall(node) {
16323
- if (node.type === 14 /* JS_CALL_EXPRESSION */ && node.callee === WITH_MEMO) {
16323
+ if (node.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */ && node.callee === WITH_MEMO) {
16324
16324
  return node.arguments[1].returns;
16325
16325
  }
16326
16326
  else {
@@ -16337,23 +16337,23 @@ function makeBlock(node, { helper, removeHelper, inSSR }) {
16337
16337
  }
16338
16338
 
16339
16339
  const deprecationData = {
16340
- ["COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */]: {
16340
+ ["COMPILER_IS_ON_ELEMENT" /* CompilerDeprecationTypes.COMPILER_IS_ON_ELEMENT */]: {
16341
16341
  message: `Platform-native elements with "is" prop will no longer be ` +
16342
16342
  `treated as components in Vue 3 unless the "is" value is explicitly ` +
16343
16343
  `prefixed with "vue:".`,
16344
16344
  link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
16345
16345
  },
16346
- ["COMPILER_V_BIND_SYNC" /* COMPILER_V_BIND_SYNC */]: {
16346
+ ["COMPILER_V_BIND_SYNC" /* CompilerDeprecationTypes.COMPILER_V_BIND_SYNC */]: {
16347
16347
  message: key => `.sync modifier for v-bind has been removed. Use v-model with ` +
16348
16348
  `argument instead. \`v-bind:${key}.sync\` should be changed to ` +
16349
16349
  `\`v-model:${key}\`.`,
16350
16350
  link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
16351
16351
  },
16352
- ["COMPILER_V_BIND_PROP" /* COMPILER_V_BIND_PROP */]: {
16352
+ ["COMPILER_V_BIND_PROP" /* CompilerDeprecationTypes.COMPILER_V_BIND_PROP */]: {
16353
16353
  message: `.prop modifier for v-bind has been removed and no longer necessary. ` +
16354
16354
  `Vue 3 will automatically set a binding as DOM property when appropriate.`
16355
16355
  },
16356
- ["COMPILER_V_BIND_OBJECT_ORDER" /* COMPILER_V_BIND_OBJECT_ORDER */]: {
16356
+ ["COMPILER_V_BIND_OBJECT_ORDER" /* CompilerDeprecationTypes.COMPILER_V_BIND_OBJECT_ORDER */]: {
16357
16357
  message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript ` +
16358
16358
  `object spread: it will now overwrite an existing non-mergeable attribute ` +
16359
16359
  `that appears before v-bind in the case of conflict. ` +
@@ -16361,11 +16361,11 @@ const deprecationData = {
16361
16361
  `You can also suppress this warning if the usage is intended.`,
16362
16362
  link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
16363
16363
  },
16364
- ["COMPILER_V_ON_NATIVE" /* COMPILER_V_ON_NATIVE */]: {
16364
+ ["COMPILER_V_ON_NATIVE" /* CompilerDeprecationTypes.COMPILER_V_ON_NATIVE */]: {
16365
16365
  message: `.native modifier for v-on has been removed as is no longer necessary.`,
16366
16366
  link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
16367
16367
  },
16368
- ["COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */]: {
16368
+ ["COMPILER_V_IF_V_FOR_PRECEDENCE" /* CompilerDeprecationTypes.COMPILER_V_IF_V_FOR_PRECEDENCE */]: {
16369
16369
  message: `v-if / v-for precedence when used on the same element has changed ` +
16370
16370
  `in Vue 3: v-if now takes higher precedence and will no longer have ` +
16371
16371
  `access to v-for scope variables. It is best to avoid the ambiguity ` +
@@ -16373,15 +16373,15 @@ const deprecationData = {
16373
16373
  `data source.`,
16374
16374
  link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
16375
16375
  },
16376
- ["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
16376
+ ["COMPILER_NATIVE_TEMPLATE" /* CompilerDeprecationTypes.COMPILER_NATIVE_TEMPLATE */]: {
16377
16377
  message: `<template> with no special directives will render as a native template ` +
16378
16378
  `element instead of its inner content in Vue 3.`
16379
16379
  },
16380
- ["COMPILER_INLINE_TEMPLATE" /* COMPILER_INLINE_TEMPLATE */]: {
16380
+ ["COMPILER_INLINE_TEMPLATE" /* CompilerDeprecationTypes.COMPILER_INLINE_TEMPLATE */]: {
16381
16381
  message: `"inline-template" has been removed in Vue 3.`,
16382
16382
  link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
16383
16383
  },
16384
- ["COMPILER_FILTER" /* COMPILER_FILTERS */]: {
16384
+ ["COMPILER_FILTER" /* CompilerDeprecationTypes.COMPILER_FILTERS */]: {
16385
16385
  message: `filters have been removed in Vue 3. ` +
16386
16386
  `The "|" symbol will be treated as native JavaScript bitwise OR operator. ` +
16387
16387
  `Use method calls or computed properties instead.`,
@@ -16441,8 +16441,8 @@ const decodeMap = {
16441
16441
  };
16442
16442
  const defaultParserOptions = {
16443
16443
  delimiters: [`{{`, `}}`],
16444
- getNamespace: () => 0 /* HTML */,
16445
- getTextMode: () => 0 /* DATA */,
16444
+ getNamespace: () => 0 /* Namespaces.HTML */,
16445
+ getTextMode: () => 0 /* TextModes.DATA */,
16446
16446
  isVoidTag: NO,
16447
16447
  isPreTag: NO,
16448
16448
  isCustomElement: NO,
@@ -16454,7 +16454,7 @@ const defaultParserOptions = {
16454
16454
  function baseParse(content, options = {}) {
16455
16455
  const context = createParserContext(content, options);
16456
16456
  const start = getCursor(context);
16457
- return createRoot(parseChildren(context, 0 /* DATA */, []), getSelection(context, start));
16457
+ return createRoot(parseChildren(context, 0 /* TextModes.DATA */, []), getSelection(context, start));
16458
16458
  }
16459
16459
  function createParserContext(content, rawOptions) {
16460
16460
  const options = extend({}, defaultParserOptions);
@@ -16480,20 +16480,20 @@ function createParserContext(content, rawOptions) {
16480
16480
  }
16481
16481
  function parseChildren(context, mode, ancestors) {
16482
16482
  const parent = last(ancestors);
16483
- const ns = parent ? parent.ns : 0 /* HTML */;
16483
+ const ns = parent ? parent.ns : 0 /* Namespaces.HTML */;
16484
16484
  const nodes = [];
16485
16485
  while (!isEnd(context, mode, ancestors)) {
16486
16486
  const s = context.source;
16487
16487
  let node = undefined;
16488
- if (mode === 0 /* DATA */ || mode === 1 /* RCDATA */) {
16488
+ if (mode === 0 /* TextModes.DATA */ || mode === 1 /* TextModes.RCDATA */) {
16489
16489
  if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
16490
16490
  // '{{'
16491
16491
  node = parseInterpolation(context, mode);
16492
16492
  }
16493
- else if (mode === 0 /* DATA */ && s[0] === '<') {
16493
+ else if (mode === 0 /* TextModes.DATA */ && s[0] === '<') {
16494
16494
  // https://html.spec.whatwg.org/multipage/parsing.html#tag-open-state
16495
16495
  if (s.length === 1) {
16496
- emitError(context, 5 /* EOF_BEFORE_TAG_NAME */, 1);
16496
+ emitError(context, 5 /* ErrorCodes.EOF_BEFORE_TAG_NAME */, 1);
16497
16497
  }
16498
16498
  else if (s[1] === '!') {
16499
16499
  // https://html.spec.whatwg.org/multipage/parsing.html#markup-declaration-open-state
@@ -16505,36 +16505,36 @@ function parseChildren(context, mode, ancestors) {
16505
16505
  node = parseBogusComment(context);
16506
16506
  }
16507
16507
  else if (startsWith(s, '<![CDATA[')) {
16508
- if (ns !== 0 /* HTML */) {
16508
+ if (ns !== 0 /* Namespaces.HTML */) {
16509
16509
  node = parseCDATA(context, ancestors);
16510
16510
  }
16511
16511
  else {
16512
- emitError(context, 1 /* CDATA_IN_HTML_CONTENT */);
16512
+ emitError(context, 1 /* ErrorCodes.CDATA_IN_HTML_CONTENT */);
16513
16513
  node = parseBogusComment(context);
16514
16514
  }
16515
16515
  }
16516
16516
  else {
16517
- emitError(context, 11 /* INCORRECTLY_OPENED_COMMENT */);
16517
+ emitError(context, 11 /* ErrorCodes.INCORRECTLY_OPENED_COMMENT */);
16518
16518
  node = parseBogusComment(context);
16519
16519
  }
16520
16520
  }
16521
16521
  else if (s[1] === '/') {
16522
16522
  // https://html.spec.whatwg.org/multipage/parsing.html#end-tag-open-state
16523
16523
  if (s.length === 2) {
16524
- emitError(context, 5 /* EOF_BEFORE_TAG_NAME */, 2);
16524
+ emitError(context, 5 /* ErrorCodes.EOF_BEFORE_TAG_NAME */, 2);
16525
16525
  }
16526
16526
  else if (s[2] === '>') {
16527
- emitError(context, 14 /* MISSING_END_TAG_NAME */, 2);
16527
+ emitError(context, 14 /* ErrorCodes.MISSING_END_TAG_NAME */, 2);
16528
16528
  advanceBy(context, 3);
16529
16529
  continue;
16530
16530
  }
16531
16531
  else if (/[a-z]/i.test(s[2])) {
16532
- emitError(context, 23 /* X_INVALID_END_TAG */);
16533
- parseTag(context, 1 /* End */, parent);
16532
+ emitError(context, 23 /* ErrorCodes.X_INVALID_END_TAG */);
16533
+ parseTag(context, 1 /* TagType.End */, parent);
16534
16534
  continue;
16535
16535
  }
16536
16536
  else {
16537
- emitError(context, 12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */, 2);
16537
+ emitError(context, 12 /* ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME */, 2);
16538
16538
  node = parseBogusComment(context);
16539
16539
  }
16540
16540
  }
@@ -16542,11 +16542,11 @@ function parseChildren(context, mode, ancestors) {
16542
16542
  node = parseElement(context, ancestors);
16543
16543
  }
16544
16544
  else if (s[1] === '?') {
16545
- emitError(context, 21 /* UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */, 1);
16545
+ emitError(context, 21 /* ErrorCodes.UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */, 1);
16546
16546
  node = parseBogusComment(context);
16547
16547
  }
16548
16548
  else {
16549
- emitError(context, 12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */, 1);
16549
+ emitError(context, 12 /* ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME */, 1);
16550
16550
  }
16551
16551
  }
16552
16552
  }
@@ -16564,11 +16564,11 @@ function parseChildren(context, mode, ancestors) {
16564
16564
  }
16565
16565
  // Whitespace handling strategy like v2
16566
16566
  let removedWhitespace = false;
16567
- if (mode !== 2 /* RAWTEXT */ && mode !== 1 /* RCDATA */) {
16567
+ if (mode !== 2 /* TextModes.RAWTEXT */ && mode !== 1 /* TextModes.RCDATA */) {
16568
16568
  const shouldCondense = context.options.whitespace !== 'preserve';
16569
16569
  for (let i = 0; i < nodes.length; i++) {
16570
16570
  const node = nodes[i];
16571
- if (!context.inPre && node.type === 2 /* TEXT */) {
16571
+ if (!context.inPre && node.type === 2 /* NodeTypes.TEXT */) {
16572
16572
  if (!/[^\t\r\n\f ]/.test(node.content)) {
16573
16573
  const prev = nodes[i - 1];
16574
16574
  const next = nodes[i + 1];
@@ -16579,10 +16579,10 @@ function parseChildren(context, mode, ancestors) {
16579
16579
  if (!prev ||
16580
16580
  !next ||
16581
16581
  (shouldCondense &&
16582
- (prev.type === 3 /* COMMENT */ ||
16583
- next.type === 3 /* COMMENT */ ||
16584
- (prev.type === 1 /* ELEMENT */ &&
16585
- next.type === 1 /* ELEMENT */ &&
16582
+ (prev.type === 3 /* NodeTypes.COMMENT */ ||
16583
+ next.type === 3 /* NodeTypes.COMMENT */ ||
16584
+ (prev.type === 1 /* NodeTypes.ELEMENT */ &&
16585
+ next.type === 1 /* NodeTypes.ELEMENT */ &&
16586
16586
  /[\r\n]/.test(node.content))))) {
16587
16587
  removedWhitespace = true;
16588
16588
  nodes[i] = null;
@@ -16599,7 +16599,7 @@ function parseChildren(context, mode, ancestors) {
16599
16599
  }
16600
16600
  }
16601
16601
  // Remove comment nodes if desired by configuration.
16602
- else if (node.type === 3 /* COMMENT */ && !context.options.comments) {
16602
+ else if (node.type === 3 /* NodeTypes.COMMENT */ && !context.options.comments) {
16603
16603
  removedWhitespace = true;
16604
16604
  nodes[i] = null;
16605
16605
  }
@@ -16608,7 +16608,7 @@ function parseChildren(context, mode, ancestors) {
16608
16608
  // remove leading newline per html spec
16609
16609
  // https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element
16610
16610
  const first = nodes[0];
16611
- if (first && first.type === 2 /* TEXT */) {
16611
+ if (first && first.type === 2 /* NodeTypes.TEXT */) {
16612
16612
  first.content = first.content.replace(/^\r?\n/, '');
16613
16613
  }
16614
16614
  }
@@ -16616,12 +16616,12 @@ function parseChildren(context, mode, ancestors) {
16616
16616
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
16617
16617
  }
16618
16618
  function pushNode(nodes, node) {
16619
- if (node.type === 2 /* TEXT */) {
16619
+ if (node.type === 2 /* NodeTypes.TEXT */) {
16620
16620
  const prev = last(nodes);
16621
16621
  // Merge if both this and the previous node are text and those are
16622
16622
  // consecutive. This happens for cases like "a < b".
16623
16623
  if (prev &&
16624
- prev.type === 2 /* TEXT */ &&
16624
+ prev.type === 2 /* NodeTypes.TEXT */ &&
16625
16625
  prev.loc.end.offset === node.loc.start.offset) {
16626
16626
  prev.content += node.content;
16627
16627
  prev.loc.end = node.loc.end;
@@ -16633,9 +16633,9 @@ function pushNode(nodes, node) {
16633
16633
  }
16634
16634
  function parseCDATA(context, ancestors) {
16635
16635
  advanceBy(context, 9);
16636
- const nodes = parseChildren(context, 3 /* CDATA */, ancestors);
16636
+ const nodes = parseChildren(context, 3 /* TextModes.CDATA */, ancestors);
16637
16637
  if (context.source.length === 0) {
16638
- emitError(context, 6 /* EOF_IN_CDATA */);
16638
+ emitError(context, 6 /* ErrorCodes.EOF_IN_CDATA */);
16639
16639
  }
16640
16640
  else {
16641
16641
  advanceBy(context, 3);
@@ -16650,14 +16650,14 @@ function parseComment(context) {
16650
16650
  if (!match) {
16651
16651
  content = context.source.slice(4);
16652
16652
  advanceBy(context, context.source.length);
16653
- emitError(context, 7 /* EOF_IN_COMMENT */);
16653
+ emitError(context, 7 /* ErrorCodes.EOF_IN_COMMENT */);
16654
16654
  }
16655
16655
  else {
16656
16656
  if (match.index <= 3) {
16657
- emitError(context, 0 /* ABRUPT_CLOSING_OF_EMPTY_COMMENT */);
16657
+ emitError(context, 0 /* ErrorCodes.ABRUPT_CLOSING_OF_EMPTY_COMMENT */);
16658
16658
  }
16659
16659
  if (match[1]) {
16660
- emitError(context, 10 /* INCORRECTLY_CLOSED_COMMENT */);
16660
+ emitError(context, 10 /* ErrorCodes.INCORRECTLY_CLOSED_COMMENT */);
16661
16661
  }
16662
16662
  content = context.source.slice(4, match.index);
16663
16663
  // Advancing with reporting nested comments.
@@ -16666,14 +16666,14 @@ function parseComment(context) {
16666
16666
  while ((nestedIndex = s.indexOf('<!--', prevIndex)) !== -1) {
16667
16667
  advanceBy(context, nestedIndex - prevIndex + 1);
16668
16668
  if (nestedIndex + 4 < s.length) {
16669
- emitError(context, 16 /* NESTED_COMMENT */);
16669
+ emitError(context, 16 /* ErrorCodes.NESTED_COMMENT */);
16670
16670
  }
16671
16671
  prevIndex = nestedIndex + 1;
16672
16672
  }
16673
16673
  advanceBy(context, match.index + match[0].length - prevIndex + 1);
16674
16674
  }
16675
16675
  return {
16676
- type: 3 /* COMMENT */,
16676
+ type: 3 /* NodeTypes.COMMENT */,
16677
16677
  content,
16678
16678
  loc: getSelection(context, start)
16679
16679
  };
@@ -16692,7 +16692,7 @@ function parseBogusComment(context) {
16692
16692
  advanceBy(context, closeIndex + 1);
16693
16693
  }
16694
16694
  return {
16695
- type: 3 /* COMMENT */,
16695
+ type: 3 /* NodeTypes.COMMENT */,
16696
16696
  content,
16697
16697
  loc: getSelection(context, start)
16698
16698
  };
@@ -16702,7 +16702,7 @@ function parseElement(context, ancestors) {
16702
16702
  const wasInPre = context.inPre;
16703
16703
  const wasInVPre = context.inVPre;
16704
16704
  const parent = last(ancestors);
16705
- const element = parseTag(context, 0 /* Start */, parent);
16705
+ const element = parseTag(context, 0 /* TagType.Start */, parent);
16706
16706
  const isPreBoundary = context.inPre && !wasInPre;
16707
16707
  const isVPreBoundary = context.inVPre && !wasInVPre;
16708
16708
  if (element.isSelfClosing || context.options.isVoidTag(element.tag)) {
@@ -16723,14 +16723,14 @@ function parseElement(context, ancestors) {
16723
16723
  element.children = children;
16724
16724
  // End tag.
16725
16725
  if (startsWithEndTagOpen(context.source, element.tag)) {
16726
- parseTag(context, 1 /* End */, parent);
16726
+ parseTag(context, 1 /* TagType.End */, parent);
16727
16727
  }
16728
16728
  else {
16729
- emitError(context, 24 /* X_MISSING_END_TAG */, 0, element.loc.start);
16729
+ emitError(context, 24 /* ErrorCodes.X_MISSING_END_TAG */, 0, element.loc.start);
16730
16730
  if (context.source.length === 0 && element.tag.toLowerCase() === 'script') {
16731
16731
  const first = children[0];
16732
16732
  if (first && startsWith(first.loc.source, '<!--')) {
16733
- emitError(context, 8 /* EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT */);
16733
+ emitError(context, 8 /* ErrorCodes.EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT */);
16734
16734
  }
16735
16735
  }
16736
16736
  }
@@ -16762,9 +16762,9 @@ function parseTag(context, type, parent) {
16762
16762
  // Attributes.
16763
16763
  let props = parseAttributes(context, type);
16764
16764
  // check v-pre
16765
- if (type === 0 /* Start */ &&
16765
+ if (type === 0 /* TagType.Start */ &&
16766
16766
  !context.inVPre &&
16767
- props.some(p => p.type === 7 /* DIRECTIVE */ && p.name === 'pre')) {
16767
+ props.some(p => p.type === 7 /* NodeTypes.DIRECTIVE */ && p.name === 'pre')) {
16768
16768
  context.inVPre = true;
16769
16769
  // reset context
16770
16770
  extend(context, cursor);
@@ -16775,34 +16775,34 @@ function parseTag(context, type, parent) {
16775
16775
  // Tag close.
16776
16776
  let isSelfClosing = false;
16777
16777
  if (context.source.length === 0) {
16778
- emitError(context, 9 /* EOF_IN_TAG */);
16778
+ emitError(context, 9 /* ErrorCodes.EOF_IN_TAG */);
16779
16779
  }
16780
16780
  else {
16781
16781
  isSelfClosing = startsWith(context.source, '/>');
16782
- if (type === 1 /* End */ && isSelfClosing) {
16783
- emitError(context, 4 /* END_TAG_WITH_TRAILING_SOLIDUS */);
16782
+ if (type === 1 /* TagType.End */ && isSelfClosing) {
16783
+ emitError(context, 4 /* ErrorCodes.END_TAG_WITH_TRAILING_SOLIDUS */);
16784
16784
  }
16785
16785
  advanceBy(context, isSelfClosing ? 2 : 1);
16786
16786
  }
16787
- if (type === 1 /* End */) {
16787
+ if (type === 1 /* TagType.End */) {
16788
16788
  return;
16789
16789
  }
16790
- let tagType = 0 /* ELEMENT */;
16790
+ let tagType = 0 /* ElementTypes.ELEMENT */;
16791
16791
  if (!context.inVPre) {
16792
16792
  if (tag === 'slot') {
16793
- tagType = 2 /* SLOT */;
16793
+ tagType = 2 /* ElementTypes.SLOT */;
16794
16794
  }
16795
16795
  else if (tag === 'template') {
16796
- if (props.some(p => p.type === 7 /* DIRECTIVE */ && isSpecialTemplateDirective(p.name))) {
16797
- tagType = 3 /* TEMPLATE */;
16796
+ if (props.some(p => p.type === 7 /* NodeTypes.DIRECTIVE */ && isSpecialTemplateDirective(p.name))) {
16797
+ tagType = 3 /* ElementTypes.TEMPLATE */;
16798
16798
  }
16799
16799
  }
16800
16800
  else if (isComponent(tag, props, context)) {
16801
- tagType = 1 /* COMPONENT */;
16801
+ tagType = 1 /* ElementTypes.COMPONENT */;
16802
16802
  }
16803
16803
  }
16804
16804
  return {
16805
- type: 1 /* ELEMENT */,
16805
+ type: 1 /* NodeTypes.ELEMENT */,
16806
16806
  ns,
16807
16807
  tag,
16808
16808
  tagType,
@@ -16829,7 +16829,7 @@ function isComponent(tag, props, context) {
16829
16829
  // casting
16830
16830
  for (let i = 0; i < props.length; i++) {
16831
16831
  const p = props[i];
16832
- if (p.type === 6 /* ATTRIBUTE */) {
16832
+ if (p.type === 6 /* NodeTypes.ATTRIBUTE */) {
16833
16833
  if (p.name === 'is' && p.value) {
16834
16834
  if (p.value.content.startsWith('vue:')) {
16835
16835
  return true;
@@ -16847,7 +16847,7 @@ function isComponent(tag, props, context) {
16847
16847
  p.name === 'bind' &&
16848
16848
  isStaticArgOf(p.arg, 'is') &&
16849
16849
  false &&
16850
- checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
16850
+ checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* CompilerDeprecationTypes.COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
16851
16851
  return true;
16852
16852
  }
16853
16853
  }
@@ -16860,27 +16860,27 @@ function parseAttributes(context, type) {
16860
16860
  !startsWith(context.source, '>') &&
16861
16861
  !startsWith(context.source, '/>')) {
16862
16862
  if (startsWith(context.source, '/')) {
16863
- emitError(context, 22 /* UNEXPECTED_SOLIDUS_IN_TAG */);
16863
+ emitError(context, 22 /* ErrorCodes.UNEXPECTED_SOLIDUS_IN_TAG */);
16864
16864
  advanceBy(context, 1);
16865
16865
  advanceSpaces(context);
16866
16866
  continue;
16867
16867
  }
16868
- if (type === 1 /* End */) {
16869
- emitError(context, 3 /* END_TAG_WITH_ATTRIBUTES */);
16868
+ if (type === 1 /* TagType.End */) {
16869
+ emitError(context, 3 /* ErrorCodes.END_TAG_WITH_ATTRIBUTES */);
16870
16870
  }
16871
16871
  const attr = parseAttribute(context, attributeNames);
16872
16872
  // Trim whitespace between class
16873
16873
  // https://github.com/vuejs/core/issues/4251
16874
- if (attr.type === 6 /* ATTRIBUTE */ &&
16874
+ if (attr.type === 6 /* NodeTypes.ATTRIBUTE */ &&
16875
16875
  attr.value &&
16876
16876
  attr.name === 'class') {
16877
16877
  attr.value.content = attr.value.content.replace(/\s+/g, ' ').trim();
16878
16878
  }
16879
- if (type === 0 /* Start */) {
16879
+ if (type === 0 /* TagType.Start */) {
16880
16880
  props.push(attr);
16881
16881
  }
16882
16882
  if (/^[^\t\r\n\f />]/.test(context.source)) {
16883
- emitError(context, 15 /* MISSING_WHITESPACE_BETWEEN_ATTRIBUTES */);
16883
+ emitError(context, 15 /* ErrorCodes.MISSING_WHITESPACE_BETWEEN_ATTRIBUTES */);
16884
16884
  }
16885
16885
  advanceSpaces(context);
16886
16886
  }
@@ -16892,17 +16892,17 @@ function parseAttribute(context, nameSet) {
16892
16892
  const match = /^[^\t\r\n\f />][^\t\r\n\f />=]*/.exec(context.source);
16893
16893
  const name = match[0];
16894
16894
  if (nameSet.has(name)) {
16895
- emitError(context, 2 /* DUPLICATE_ATTRIBUTE */);
16895
+ emitError(context, 2 /* ErrorCodes.DUPLICATE_ATTRIBUTE */);
16896
16896
  }
16897
16897
  nameSet.add(name);
16898
16898
  if (name[0] === '=') {
16899
- emitError(context, 19 /* UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */);
16899
+ emitError(context, 19 /* ErrorCodes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */);
16900
16900
  }
16901
16901
  {
16902
16902
  const pattern = /["'<]/g;
16903
16903
  let m;
16904
16904
  while ((m = pattern.exec(name))) {
16905
- emitError(context, 17 /* UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME */, m.index);
16905
+ emitError(context, 17 /* ErrorCodes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME */, m.index);
16906
16906
  }
16907
16907
  }
16908
16908
  advanceBy(context, name.length);
@@ -16914,7 +16914,7 @@ function parseAttribute(context, nameSet) {
16914
16914
  advanceSpaces(context);
16915
16915
  value = parseAttributeValue(context);
16916
16916
  if (!value) {
16917
- emitError(context, 13 /* MISSING_ATTRIBUTE_VALUE */);
16917
+ emitError(context, 13 /* ErrorCodes.MISSING_ATTRIBUTE_VALUE */);
16918
16918
  }
16919
16919
  }
16920
16920
  const loc = getSelection(context, start);
@@ -16937,7 +16937,7 @@ function parseAttribute(context, nameSet) {
16937
16937
  if (content.startsWith('[')) {
16938
16938
  isStatic = false;
16939
16939
  if (!content.endsWith(']')) {
16940
- emitError(context, 27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
16940
+ emitError(context, 27 /* ErrorCodes.X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
16941
16941
  content = content.slice(1);
16942
16942
  }
16943
16943
  else {
@@ -16951,12 +16951,12 @@ function parseAttribute(context, nameSet) {
16951
16951
  content += match[3] || '';
16952
16952
  }
16953
16953
  arg = {
16954
- type: 4 /* SIMPLE_EXPRESSION */,
16954
+ type: 4 /* NodeTypes.SIMPLE_EXPRESSION */,
16955
16955
  content,
16956
16956
  isStatic,
16957
16957
  constType: isStatic
16958
- ? 3 /* CAN_STRINGIFY */
16959
- : 0 /* NOT_CONSTANT */,
16958
+ ? 3 /* ConstantTypes.CAN_STRINGIFY */
16959
+ : 0 /* ConstantTypes.NOT_CONSTANT */,
16960
16960
  loc
16961
16961
  };
16962
16962
  }
@@ -16971,15 +16971,15 @@ function parseAttribute(context, nameSet) {
16971
16971
  if (isPropShorthand)
16972
16972
  modifiers.push('prop');
16973
16973
  return {
16974
- type: 7 /* DIRECTIVE */,
16974
+ type: 7 /* NodeTypes.DIRECTIVE */,
16975
16975
  name: dirName,
16976
16976
  exp: value && {
16977
- type: 4 /* SIMPLE_EXPRESSION */,
16977
+ type: 4 /* NodeTypes.SIMPLE_EXPRESSION */,
16978
16978
  content: value.content,
16979
16979
  isStatic: false,
16980
16980
  // Treat as non-constant by default. This can be potentially set to
16981
16981
  // other values by `transformExpression` to make it eligible for hoisting.
16982
- constType: 0 /* NOT_CONSTANT */,
16982
+ constType: 0 /* ConstantTypes.NOT_CONSTANT */,
16983
16983
  loc: value.loc
16984
16984
  },
16985
16985
  arg,
@@ -16989,13 +16989,13 @@ function parseAttribute(context, nameSet) {
16989
16989
  }
16990
16990
  // missing directive name or illegal directive name
16991
16991
  if (!context.inVPre && startsWith(name, 'v-')) {
16992
- emitError(context, 26 /* X_MISSING_DIRECTIVE_NAME */);
16992
+ emitError(context, 26 /* ErrorCodes.X_MISSING_DIRECTIVE_NAME */);
16993
16993
  }
16994
16994
  return {
16995
- type: 6 /* ATTRIBUTE */,
16995
+ type: 6 /* NodeTypes.ATTRIBUTE */,
16996
16996
  name,
16997
16997
  value: value && {
16998
- type: 2 /* TEXT */,
16998
+ type: 2 /* NodeTypes.TEXT */,
16999
16999
  content: value.content,
17000
17000
  loc: value.loc
17001
17001
  },
@@ -17012,10 +17012,10 @@ function parseAttributeValue(context) {
17012
17012
  advanceBy(context, 1);
17013
17013
  const endIndex = context.source.indexOf(quote);
17014
17014
  if (endIndex === -1) {
17015
- content = parseTextData(context, context.source.length, 4 /* ATTRIBUTE_VALUE */);
17015
+ content = parseTextData(context, context.source.length, 4 /* TextModes.ATTRIBUTE_VALUE */);
17016
17016
  }
17017
17017
  else {
17018
- content = parseTextData(context, endIndex, 4 /* ATTRIBUTE_VALUE */);
17018
+ content = parseTextData(context, endIndex, 4 /* TextModes.ATTRIBUTE_VALUE */);
17019
17019
  advanceBy(context, 1);
17020
17020
  }
17021
17021
  }
@@ -17028,9 +17028,9 @@ function parseAttributeValue(context) {
17028
17028
  const unexpectedChars = /["'<=`]/g;
17029
17029
  let m;
17030
17030
  while ((m = unexpectedChars.exec(match[0]))) {
17031
- emitError(context, 18 /* UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */, m.index);
17031
+ emitError(context, 18 /* ErrorCodes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */, m.index);
17032
17032
  }
17033
- content = parseTextData(context, match[0].length, 4 /* ATTRIBUTE_VALUE */);
17033
+ content = parseTextData(context, match[0].length, 4 /* TextModes.ATTRIBUTE_VALUE */);
17034
17034
  }
17035
17035
  return { content, isQuoted, loc: getSelection(context, start) };
17036
17036
  }
@@ -17038,7 +17038,7 @@ function parseInterpolation(context, mode) {
17038
17038
  const [open, close] = context.options.delimiters;
17039
17039
  const closeIndex = context.source.indexOf(close, open.length);
17040
17040
  if (closeIndex === -1) {
17041
- emitError(context, 25 /* X_MISSING_INTERPOLATION_END */);
17041
+ emitError(context, 25 /* ErrorCodes.X_MISSING_INTERPOLATION_END */);
17042
17042
  return undefined;
17043
17043
  }
17044
17044
  const start = getCursor(context);
@@ -17057,12 +17057,12 @@ function parseInterpolation(context, mode) {
17057
17057
  advancePositionWithMutation(innerEnd, rawContent, endOffset);
17058
17058
  advanceBy(context, close.length);
17059
17059
  return {
17060
- type: 5 /* INTERPOLATION */,
17060
+ type: 5 /* NodeTypes.INTERPOLATION */,
17061
17061
  content: {
17062
- type: 4 /* SIMPLE_EXPRESSION */,
17062
+ type: 4 /* NodeTypes.SIMPLE_EXPRESSION */,
17063
17063
  isStatic: false,
17064
17064
  // Set `isConstant` to false by default and will decide in transformExpression
17065
- constType: 0 /* NOT_CONSTANT */,
17065
+ constType: 0 /* ConstantTypes.NOT_CONSTANT */,
17066
17066
  content,
17067
17067
  loc: getSelection(context, innerStart, innerEnd)
17068
17068
  },
@@ -17070,7 +17070,7 @@ function parseInterpolation(context, mode) {
17070
17070
  };
17071
17071
  }
17072
17072
  function parseText(context, mode) {
17073
- const endTokens = mode === 3 /* CDATA */ ? [']]>'] : ['<', context.options.delimiters[0]];
17073
+ const endTokens = mode === 3 /* TextModes.CDATA */ ? [']]>'] : ['<', context.options.delimiters[0]];
17074
17074
  let endIndex = context.source.length;
17075
17075
  for (let i = 0; i < endTokens.length; i++) {
17076
17076
  const index = context.source.indexOf(endTokens[i], 1);
@@ -17081,7 +17081,7 @@ function parseText(context, mode) {
17081
17081
  const start = getCursor(context);
17082
17082
  const content = parseTextData(context, endIndex, mode);
17083
17083
  return {
17084
- type: 2 /* TEXT */,
17084
+ type: 2 /* NodeTypes.TEXT */,
17085
17085
  content,
17086
17086
  loc: getSelection(context, start)
17087
17087
  };
@@ -17093,14 +17093,14 @@ function parseText(context, mode) {
17093
17093
  function parseTextData(context, length, mode) {
17094
17094
  const rawText = context.source.slice(0, length);
17095
17095
  advanceBy(context, length);
17096
- if (mode === 2 /* RAWTEXT */ ||
17097
- mode === 3 /* CDATA */ ||
17096
+ if (mode === 2 /* TextModes.RAWTEXT */ ||
17097
+ mode === 3 /* TextModes.CDATA */ ||
17098
17098
  !rawText.includes('&')) {
17099
17099
  return rawText;
17100
17100
  }
17101
17101
  else {
17102
17102
  // DATA or RCDATA containing "&"". Entity decoding required.
17103
- return context.options.decodeEntities(rawText, mode === 4 /* ATTRIBUTE_VALUE */);
17103
+ return context.options.decodeEntities(rawText, mode === 4 /* TextModes.ATTRIBUTE_VALUE */);
17104
17104
  }
17105
17105
  }
17106
17106
  function getCursor(context) {
@@ -17149,7 +17149,7 @@ function emitError(context, code, offset, loc = getCursor(context)) {
17149
17149
  function isEnd(context, mode, ancestors) {
17150
17150
  const s = context.source;
17151
17151
  switch (mode) {
17152
- case 0 /* DATA */:
17152
+ case 0 /* TextModes.DATA */:
17153
17153
  if (startsWith(s, '</')) {
17154
17154
  // TODO: probably bad performance
17155
17155
  for (let i = ancestors.length - 1; i >= 0; --i) {
@@ -17159,15 +17159,15 @@ function isEnd(context, mode, ancestors) {
17159
17159
  }
17160
17160
  }
17161
17161
  break;
17162
- case 1 /* RCDATA */:
17163
- case 2 /* RAWTEXT */: {
17162
+ case 1 /* TextModes.RCDATA */:
17163
+ case 2 /* TextModes.RAWTEXT */: {
17164
17164
  const parent = last(ancestors);
17165
17165
  if (parent && startsWithEndTagOpen(s, parent.tag)) {
17166
17166
  return true;
17167
17167
  }
17168
17168
  break;
17169
17169
  }
17170
- case 3 /* CDATA */:
17170
+ case 3 /* TextModes.CDATA */:
17171
17171
  if (startsWith(s, ']]>')) {
17172
17172
  return true;
17173
17173
  }
@@ -17190,7 +17190,7 @@ function hoistStatic(root, context) {
17190
17190
  function isSingleElementRoot(root, child) {
17191
17191
  const { children } = root;
17192
17192
  return (children.length === 1 &&
17193
- child.type === 1 /* ELEMENT */ &&
17193
+ child.type === 1 /* NodeTypes.ELEMENT */ &&
17194
17194
  !isSlotOutlet(child));
17195
17195
  }
17196
17196
  function walk(node, context, doNotHoistNode = false) {
@@ -17200,15 +17200,15 @@ function walk(node, context, doNotHoistNode = false) {
17200
17200
  for (let i = 0; i < children.length; i++) {
17201
17201
  const child = children[i];
17202
17202
  // only plain elements & text calls are eligible for hoisting.
17203
- if (child.type === 1 /* ELEMENT */ &&
17204
- child.tagType === 0 /* ELEMENT */) {
17203
+ if (child.type === 1 /* NodeTypes.ELEMENT */ &&
17204
+ child.tagType === 0 /* ElementTypes.ELEMENT */) {
17205
17205
  const constantType = doNotHoistNode
17206
- ? 0 /* NOT_CONSTANT */
17206
+ ? 0 /* ConstantTypes.NOT_CONSTANT */
17207
17207
  : getConstantType(child, context);
17208
- if (constantType > 0 /* NOT_CONSTANT */) {
17209
- if (constantType >= 2 /* CAN_HOIST */) {
17208
+ if (constantType > 0 /* ConstantTypes.NOT_CONSTANT */) {
17209
+ if (constantType >= 2 /* ConstantTypes.CAN_HOIST */) {
17210
17210
  child.codegenNode.patchFlag =
17211
- -1 /* HOISTED */ + (` /* HOISTED */` );
17211
+ -1 /* PatchFlags.HOISTED */ + (` /* HOISTED */` );
17212
17212
  child.codegenNode = context.hoist(child.codegenNode);
17213
17213
  hoistedCount++;
17214
17214
  continue;
@@ -17218,13 +17218,13 @@ function walk(node, context, doNotHoistNode = false) {
17218
17218
  // node may contain dynamic children, but its props may be eligible for
17219
17219
  // hoisting.
17220
17220
  const codegenNode = child.codegenNode;
17221
- if (codegenNode.type === 13 /* VNODE_CALL */) {
17221
+ if (codegenNode.type === 13 /* NodeTypes.VNODE_CALL */) {
17222
17222
  const flag = getPatchFlag(codegenNode);
17223
17223
  if ((!flag ||
17224
- flag === 512 /* NEED_PATCH */ ||
17225
- flag === 1 /* TEXT */) &&
17224
+ flag === 512 /* PatchFlags.NEED_PATCH */ ||
17225
+ flag === 1 /* PatchFlags.TEXT */) &&
17226
17226
  getGeneratedPropsConstantType(child, context) >=
17227
- 2 /* CAN_HOIST */) {
17227
+ 2 /* ConstantTypes.CAN_HOIST */) {
17228
17228
  const props = getNodeProps(child);
17229
17229
  if (props) {
17230
17230
  codegenNode.props = context.hoist(props);
@@ -17236,14 +17236,14 @@ function walk(node, context, doNotHoistNode = false) {
17236
17236
  }
17237
17237
  }
17238
17238
  }
17239
- else if (child.type === 12 /* TEXT_CALL */ &&
17240
- getConstantType(child.content, context) >= 2 /* CAN_HOIST */) {
17239
+ else if (child.type === 12 /* NodeTypes.TEXT_CALL */ &&
17240
+ getConstantType(child.content, context) >= 2 /* ConstantTypes.CAN_HOIST */) {
17241
17241
  child.codegenNode = context.hoist(child.codegenNode);
17242
17242
  hoistedCount++;
17243
17243
  }
17244
17244
  // walk further
17245
- if (child.type === 1 /* ELEMENT */) {
17246
- const isComponent = child.tagType === 1 /* COMPONENT */;
17245
+ if (child.type === 1 /* NodeTypes.ELEMENT */) {
17246
+ const isComponent = child.tagType === 1 /* ElementTypes.COMPONENT */;
17247
17247
  if (isComponent) {
17248
17248
  context.scopes.vSlot++;
17249
17249
  }
@@ -17252,11 +17252,11 @@ function walk(node, context, doNotHoistNode = false) {
17252
17252
  context.scopes.vSlot--;
17253
17253
  }
17254
17254
  }
17255
- else if (child.type === 11 /* FOR */) {
17255
+ else if (child.type === 11 /* NodeTypes.FOR */) {
17256
17256
  // Do not hoist v-for single child because it has to be a block
17257
17257
  walk(child, context, child.children.length === 1);
17258
17258
  }
17259
- else if (child.type === 9 /* IF */) {
17259
+ else if (child.type === 9 /* NodeTypes.IF */) {
17260
17260
  for (let i = 0; i < child.branches.length; i++) {
17261
17261
  // Do not hoist v-if single child because it has to be a block
17262
17262
  walk(child.branches[i], context, child.branches[i].children.length === 1);
@@ -17269,10 +17269,10 @@ function walk(node, context, doNotHoistNode = false) {
17269
17269
  // all children were hoisted - the entire children array is hoistable.
17270
17270
  if (hoistedCount &&
17271
17271
  hoistedCount === originalCount &&
17272
- node.type === 1 /* ELEMENT */ &&
17273
- node.tagType === 0 /* ELEMENT */ &&
17272
+ node.type === 1 /* NodeTypes.ELEMENT */ &&
17273
+ node.tagType === 0 /* ElementTypes.ELEMENT */ &&
17274
17274
  node.codegenNode &&
17275
- node.codegenNode.type === 13 /* VNODE_CALL */ &&
17275
+ node.codegenNode.type === 13 /* NodeTypes.VNODE_CALL */ &&
17276
17276
  isArray(node.codegenNode.children)) {
17277
17277
  node.codegenNode.children = context.hoist(createArrayExpression(node.codegenNode.children));
17278
17278
  }
@@ -17280,35 +17280,35 @@ function walk(node, context, doNotHoistNode = false) {
17280
17280
  function getConstantType(node, context) {
17281
17281
  const { constantCache } = context;
17282
17282
  switch (node.type) {
17283
- case 1 /* ELEMENT */:
17284
- if (node.tagType !== 0 /* ELEMENT */) {
17285
- return 0 /* NOT_CONSTANT */;
17283
+ case 1 /* NodeTypes.ELEMENT */:
17284
+ if (node.tagType !== 0 /* ElementTypes.ELEMENT */) {
17285
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
17286
17286
  }
17287
17287
  const cached = constantCache.get(node);
17288
17288
  if (cached !== undefined) {
17289
17289
  return cached;
17290
17290
  }
17291
17291
  const codegenNode = node.codegenNode;
17292
- if (codegenNode.type !== 13 /* VNODE_CALL */) {
17293
- return 0 /* NOT_CONSTANT */;
17292
+ if (codegenNode.type !== 13 /* NodeTypes.VNODE_CALL */) {
17293
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
17294
17294
  }
17295
17295
  if (codegenNode.isBlock &&
17296
17296
  node.tag !== 'svg' &&
17297
17297
  node.tag !== 'foreignObject') {
17298
- return 0 /* NOT_CONSTANT */;
17298
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
17299
17299
  }
17300
17300
  const flag = getPatchFlag(codegenNode);
17301
17301
  if (!flag) {
17302
- let returnType = 3 /* CAN_STRINGIFY */;
17302
+ let returnType = 3 /* ConstantTypes.CAN_STRINGIFY */;
17303
17303
  // Element itself has no patch flag. However we still need to check:
17304
17304
  // 1. Even for a node with no patch flag, it is possible for it to contain
17305
17305
  // non-hoistable expressions that refers to scope variables, e.g. compiler
17306
17306
  // injected keys or cached event handlers. Therefore we need to always
17307
17307
  // check the codegenNode's props to be sure.
17308
17308
  const generatedPropsType = getGeneratedPropsConstantType(node, context);
17309
- if (generatedPropsType === 0 /* NOT_CONSTANT */) {
17310
- constantCache.set(node, 0 /* NOT_CONSTANT */);
17311
- return 0 /* NOT_CONSTANT */;
17309
+ if (generatedPropsType === 0 /* ConstantTypes.NOT_CONSTANT */) {
17310
+ constantCache.set(node, 0 /* ConstantTypes.NOT_CONSTANT */);
17311
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
17312
17312
  }
17313
17313
  if (generatedPropsType < returnType) {
17314
17314
  returnType = generatedPropsType;
@@ -17316,9 +17316,9 @@ function getConstantType(node, context) {
17316
17316
  // 2. its children.
17317
17317
  for (let i = 0; i < node.children.length; i++) {
17318
17318
  const childType = getConstantType(node.children[i], context);
17319
- if (childType === 0 /* NOT_CONSTANT */) {
17320
- constantCache.set(node, 0 /* NOT_CONSTANT */);
17321
- return 0 /* NOT_CONSTANT */;
17319
+ if (childType === 0 /* ConstantTypes.NOT_CONSTANT */) {
17320
+ constantCache.set(node, 0 /* ConstantTypes.NOT_CONSTANT */);
17321
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
17322
17322
  }
17323
17323
  if (childType < returnType) {
17324
17324
  returnType = childType;
@@ -17328,14 +17328,14 @@ function getConstantType(node, context) {
17328
17328
  // type, check if any of the props can cause the type to be lowered
17329
17329
  // we can skip can_patch because it's guaranteed by the absence of a
17330
17330
  // patchFlag.
17331
- if (returnType > 1 /* CAN_SKIP_PATCH */) {
17331
+ if (returnType > 1 /* ConstantTypes.CAN_SKIP_PATCH */) {
17332
17332
  for (let i = 0; i < node.props.length; i++) {
17333
17333
  const p = node.props[i];
17334
- if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind' && p.exp) {
17334
+ if (p.type === 7 /* NodeTypes.DIRECTIVE */ && p.name === 'bind' && p.exp) {
17335
17335
  const expType = getConstantType(p.exp, context);
17336
- if (expType === 0 /* NOT_CONSTANT */) {
17337
- constantCache.set(node, 0 /* NOT_CONSTANT */);
17338
- return 0 /* NOT_CONSTANT */;
17336
+ if (expType === 0 /* ConstantTypes.NOT_CONSTANT */) {
17337
+ constantCache.set(node, 0 /* ConstantTypes.NOT_CONSTANT */);
17338
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
17339
17339
  }
17340
17340
  if (expType < returnType) {
17341
17341
  returnType = expType;
@@ -17350,9 +17350,9 @@ function getConstantType(node, context) {
17350
17350
  // except set custom directives.
17351
17351
  for (let i = 0; i < node.props.length; i++) {
17352
17352
  const p = node.props[i];
17353
- if (p.type === 7 /* DIRECTIVE */) {
17354
- constantCache.set(node, 0 /* NOT_CONSTANT */);
17355
- return 0 /* NOT_CONSTANT */;
17353
+ if (p.type === 7 /* NodeTypes.DIRECTIVE */) {
17354
+ constantCache.set(node, 0 /* ConstantTypes.NOT_CONSTANT */);
17355
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
17356
17356
  }
17357
17357
  }
17358
17358
  context.removeHelper(OPEN_BLOCK);
@@ -17364,31 +17364,31 @@ function getConstantType(node, context) {
17364
17364
  return returnType;
17365
17365
  }
17366
17366
  else {
17367
- constantCache.set(node, 0 /* NOT_CONSTANT */);
17368
- return 0 /* NOT_CONSTANT */;
17369
- }
17370
- case 2 /* TEXT */:
17371
- case 3 /* COMMENT */:
17372
- return 3 /* CAN_STRINGIFY */;
17373
- case 9 /* IF */:
17374
- case 11 /* FOR */:
17375
- case 10 /* IF_BRANCH */:
17376
- return 0 /* NOT_CONSTANT */;
17377
- case 5 /* INTERPOLATION */:
17378
- case 12 /* TEXT_CALL */:
17367
+ constantCache.set(node, 0 /* ConstantTypes.NOT_CONSTANT */);
17368
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
17369
+ }
17370
+ case 2 /* NodeTypes.TEXT */:
17371
+ case 3 /* NodeTypes.COMMENT */:
17372
+ return 3 /* ConstantTypes.CAN_STRINGIFY */;
17373
+ case 9 /* NodeTypes.IF */:
17374
+ case 11 /* NodeTypes.FOR */:
17375
+ case 10 /* NodeTypes.IF_BRANCH */:
17376
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
17377
+ case 5 /* NodeTypes.INTERPOLATION */:
17378
+ case 12 /* NodeTypes.TEXT_CALL */:
17379
17379
  return getConstantType(node.content, context);
17380
- case 4 /* SIMPLE_EXPRESSION */:
17380
+ case 4 /* NodeTypes.SIMPLE_EXPRESSION */:
17381
17381
  return node.constType;
17382
- case 8 /* COMPOUND_EXPRESSION */:
17383
- let returnType = 3 /* CAN_STRINGIFY */;
17382
+ case 8 /* NodeTypes.COMPOUND_EXPRESSION */:
17383
+ let returnType = 3 /* ConstantTypes.CAN_STRINGIFY */;
17384
17384
  for (let i = 0; i < node.children.length; i++) {
17385
17385
  const child = node.children[i];
17386
17386
  if (isString(child) || isSymbol(child)) {
17387
17387
  continue;
17388
17388
  }
17389
17389
  const childType = getConstantType(child, context);
17390
- if (childType === 0 /* NOT_CONSTANT */) {
17391
- return 0 /* NOT_CONSTANT */;
17390
+ if (childType === 0 /* ConstantTypes.NOT_CONSTANT */) {
17391
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
17392
17392
  }
17393
17393
  else if (childType < returnType) {
17394
17394
  returnType = childType;
@@ -17396,7 +17396,7 @@ function getConstantType(node, context) {
17396
17396
  }
17397
17397
  return returnType;
17398
17398
  default:
17399
- return 0 /* NOT_CONSTANT */;
17399
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
17400
17400
  }
17401
17401
  }
17402
17402
  const allowHoistedHelperSet = new Set([
@@ -17406,48 +17406,48 @@ const allowHoistedHelperSet = new Set([
17406
17406
  GUARD_REACTIVE_PROPS
17407
17407
  ]);
17408
17408
  function getConstantTypeOfHelperCall(value, context) {
17409
- if (value.type === 14 /* JS_CALL_EXPRESSION */ &&
17409
+ if (value.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */ &&
17410
17410
  !isString(value.callee) &&
17411
17411
  allowHoistedHelperSet.has(value.callee)) {
17412
17412
  const arg = value.arguments[0];
17413
- if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
17413
+ if (arg.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
17414
17414
  return getConstantType(arg, context);
17415
17415
  }
17416
- else if (arg.type === 14 /* JS_CALL_EXPRESSION */) {
17416
+ else if (arg.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */) {
17417
17417
  // in the case of nested helper call, e.g. `normalizeProps(guardReactiveProps(exp))`
17418
17418
  return getConstantTypeOfHelperCall(arg, context);
17419
17419
  }
17420
17420
  }
17421
- return 0 /* NOT_CONSTANT */;
17421
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
17422
17422
  }
17423
17423
  function getGeneratedPropsConstantType(node, context) {
17424
- let returnType = 3 /* CAN_STRINGIFY */;
17424
+ let returnType = 3 /* ConstantTypes.CAN_STRINGIFY */;
17425
17425
  const props = getNodeProps(node);
17426
- if (props && props.type === 15 /* JS_OBJECT_EXPRESSION */) {
17426
+ if (props && props.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
17427
17427
  const { properties } = props;
17428
17428
  for (let i = 0; i < properties.length; i++) {
17429
17429
  const { key, value } = properties[i];
17430
17430
  const keyType = getConstantType(key, context);
17431
- if (keyType === 0 /* NOT_CONSTANT */) {
17431
+ if (keyType === 0 /* ConstantTypes.NOT_CONSTANT */) {
17432
17432
  return keyType;
17433
17433
  }
17434
17434
  if (keyType < returnType) {
17435
17435
  returnType = keyType;
17436
17436
  }
17437
17437
  let valueType;
17438
- if (value.type === 4 /* SIMPLE_EXPRESSION */) {
17438
+ if (value.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
17439
17439
  valueType = getConstantType(value, context);
17440
17440
  }
17441
- else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
17441
+ else if (value.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */) {
17442
17442
  // some helper calls can be hoisted,
17443
17443
  // such as the `normalizeProps` generated by the compiler for pre-normalize class,
17444
17444
  // in this case we need to respect the ConstantType of the helper's arguments
17445
17445
  valueType = getConstantTypeOfHelperCall(value, context);
17446
17446
  }
17447
17447
  else {
17448
- valueType = 0 /* NOT_CONSTANT */;
17448
+ valueType = 0 /* ConstantTypes.NOT_CONSTANT */;
17449
17449
  }
17450
- if (valueType === 0 /* NOT_CONSTANT */) {
17450
+ if (valueType === 0 /* ConstantTypes.NOT_CONSTANT */) {
17451
17451
  return valueType;
17452
17452
  }
17453
17453
  if (valueType < returnType) {
@@ -17459,7 +17459,7 @@ function getGeneratedPropsConstantType(node, context) {
17459
17459
  }
17460
17460
  function getNodeProps(node) {
17461
17461
  const codegenNode = node.codegenNode;
17462
- if (codegenNode.type === 13 /* VNODE_CALL */) {
17462
+ if (codegenNode.type === 13 /* NodeTypes.VNODE_CALL */) {
17463
17463
  return codegenNode.props;
17464
17464
  }
17465
17465
  }
@@ -17585,7 +17585,7 @@ function createTransformContext(root, { filename = '', prefixIdentifiers = false
17585
17585
  else if (exp.identifiers) {
17586
17586
  exp.identifiers.forEach(addId);
17587
17587
  }
17588
- else if (exp.type === 4 /* SIMPLE_EXPRESSION */) {
17588
+ else if (exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
17589
17589
  addId(exp.content);
17590
17590
  }
17591
17591
  }
@@ -17598,7 +17598,7 @@ function createTransformContext(root, { filename = '', prefixIdentifiers = false
17598
17598
  else if (exp.identifiers) {
17599
17599
  exp.identifiers.forEach(removeId);
17600
17600
  }
17601
- else if (exp.type === 4 /* SIMPLE_EXPRESSION */) {
17601
+ else if (exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
17602
17602
  removeId(exp.content);
17603
17603
  }
17604
17604
  }
@@ -17607,7 +17607,7 @@ function createTransformContext(root, { filename = '', prefixIdentifiers = false
17607
17607
  if (isString(exp))
17608
17608
  exp = createSimpleExpression(exp);
17609
17609
  context.hoists.push(exp);
17610
- const identifier = createSimpleExpression(`_hoisted_${context.hoists.length}`, false, exp.loc, 2 /* CAN_HOIST */);
17610
+ const identifier = createSimpleExpression(`_hoisted_${context.hoists.length}`, false, exp.loc, 2 /* ConstantTypes.CAN_HOIST */);
17611
17611
  identifier.hoisted = exp;
17612
17612
  return identifier;
17613
17613
  },
@@ -17655,7 +17655,7 @@ function createRootCodegen(root, context) {
17655
17655
  // single element root is never hoisted so codegenNode will never be
17656
17656
  // SimpleExpressionNode
17657
17657
  const codegenNode = child.codegenNode;
17658
- if (codegenNode.type === 13 /* VNODE_CALL */) {
17658
+ if (codegenNode.type === 13 /* NodeTypes.VNODE_CALL */) {
17659
17659
  makeBlock(codegenNode, context);
17660
17660
  }
17661
17661
  root.codegenNode = codegenNode;
@@ -17669,13 +17669,13 @@ function createRootCodegen(root, context) {
17669
17669
  }
17670
17670
  else if (children.length > 1) {
17671
17671
  // root has multiple nodes - return a fragment block.
17672
- let patchFlag = 64 /* STABLE_FRAGMENT */;
17673
- let patchFlagText = PatchFlagNames[64 /* STABLE_FRAGMENT */];
17672
+ let patchFlag = 64 /* PatchFlags.STABLE_FRAGMENT */;
17673
+ let patchFlagText = PatchFlagNames[64 /* PatchFlags.STABLE_FRAGMENT */];
17674
17674
  // check if the fragment actually contains a single valid child with
17675
17675
  // the rest being comments
17676
- if (children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
17677
- patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
17678
- patchFlagText += `, ${PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
17676
+ if (children.filter(c => c.type !== 3 /* NodeTypes.COMMENT */).length === 1) {
17677
+ patchFlag |= 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */;
17678
+ patchFlagText += `, ${PatchFlagNames[2048 /* PatchFlags.DEV_ROOT_FRAGMENT */]}`;
17679
17679
  }
17680
17680
  root.codegenNode = createVNodeCall(context, helper(FRAGMENT), undefined, root.children, patchFlag + (` /* ${patchFlagText} */` ), undefined, undefined, true, undefined, false /* isComponent */);
17681
17681
  }
@@ -17721,29 +17721,29 @@ function traverseNode(node, context) {
17721
17721
  }
17722
17722
  }
17723
17723
  switch (node.type) {
17724
- case 3 /* COMMENT */:
17724
+ case 3 /* NodeTypes.COMMENT */:
17725
17725
  if (!context.ssr) {
17726
17726
  // inject import for the Comment symbol, which is needed for creating
17727
17727
  // comment nodes with `createVNode`
17728
17728
  context.helper(CREATE_COMMENT);
17729
17729
  }
17730
17730
  break;
17731
- case 5 /* INTERPOLATION */:
17731
+ case 5 /* NodeTypes.INTERPOLATION */:
17732
17732
  // no need to traverse, but we need to inject toString helper
17733
17733
  if (!context.ssr) {
17734
17734
  context.helper(TO_DISPLAY_STRING);
17735
17735
  }
17736
17736
  break;
17737
17737
  // for container types, further traverse downwards
17738
- case 9 /* IF */:
17738
+ case 9 /* NodeTypes.IF */:
17739
17739
  for (let i = 0; i < node.branches.length; i++) {
17740
17740
  traverseNode(node.branches[i], context);
17741
17741
  }
17742
17742
  break;
17743
- case 10 /* IF_BRANCH */:
17744
- case 11 /* FOR */:
17745
- case 1 /* ELEMENT */:
17746
- case 0 /* ROOT */:
17743
+ case 10 /* NodeTypes.IF_BRANCH */:
17744
+ case 11 /* NodeTypes.FOR */:
17745
+ case 1 /* NodeTypes.ELEMENT */:
17746
+ case 0 /* NodeTypes.ROOT */:
17747
17747
  traverseChildren(node, context);
17748
17748
  break;
17749
17749
  }
@@ -17759,17 +17759,17 @@ function createStructuralDirectiveTransform(name, fn) {
17759
17759
  ? (n) => n === name
17760
17760
  : (n) => name.test(n);
17761
17761
  return (node, context) => {
17762
- if (node.type === 1 /* ELEMENT */) {
17762
+ if (node.type === 1 /* NodeTypes.ELEMENT */) {
17763
17763
  const { props } = node;
17764
17764
  // structural directive transforms are not concerned with slots
17765
17765
  // as they are handled separately in vSlot.ts
17766
- if (node.tagType === 3 /* TEMPLATE */ && props.some(isVSlot)) {
17766
+ if (node.tagType === 3 /* ElementTypes.TEMPLATE */ && props.some(isVSlot)) {
17767
17767
  return;
17768
17768
  }
17769
17769
  const exitFns = [];
17770
17770
  for (let i = 0; i < props.length; i++) {
17771
17771
  const prop = props[i];
17772
- if (prop.type === 7 /* DIRECTIVE */ && matches(prop.name)) {
17772
+ if (prop.type === 7 /* NodeTypes.DIRECTIVE */ && matches(prop.name)) {
17773
17773
  // structural directives are removed to avoid infinite recursion
17774
17774
  // also we remove them *before* applying so that it can further
17775
17775
  // traverse itself in case it moves the node around
@@ -21018,7 +21018,7 @@ function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode
21018
21018
  if (context.map) {
21019
21019
  if (node) {
21020
21020
  let name;
21021
- if (node.type === 4 /* SIMPLE_EXPRESSION */ && !node.isStatic) {
21021
+ if (node.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ && !node.isStatic) {
21022
21022
  const content = node.content.replace(/^_ctx\./, '');
21023
21023
  if (content !== node.content && isSimpleIdentifier(content)) {
21024
21024
  name = content;
@@ -21287,7 +21287,7 @@ function genHoists(hoists, context) {
21287
21287
  for (let i = 0; i < hoists.length; i++) {
21288
21288
  const exp = hoists[i];
21289
21289
  if (exp) {
21290
- const needScopeIdWrapper = genScopeId && exp.type === 13 /* VNODE_CALL */;
21290
+ const needScopeIdWrapper = genScopeId && exp.type === 13 /* NodeTypes.VNODE_CALL */;
21291
21291
  push(`const _hoisted_${i + 1} = ${needScopeIdWrapper ? `${PURE_ANNOTATION} _withScopeId(() => ` : ``}`);
21292
21292
  genNode(exp, context);
21293
21293
  if (needScopeIdWrapper) {
@@ -21311,10 +21311,10 @@ function genImports(importsOptions, context) {
21311
21311
  }
21312
21312
  function isText$1(n) {
21313
21313
  return (isString(n) ||
21314
- n.type === 4 /* SIMPLE_EXPRESSION */ ||
21315
- n.type === 2 /* TEXT */ ||
21316
- n.type === 5 /* INTERPOLATION */ ||
21317
- n.type === 8 /* COMPOUND_EXPRESSION */);
21314
+ n.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ ||
21315
+ n.type === 2 /* NodeTypes.TEXT */ ||
21316
+ n.type === 5 /* NodeTypes.INTERPOLATION */ ||
21317
+ n.type === 8 /* NodeTypes.COMPOUND_EXPRESSION */);
21318
21318
  }
21319
21319
  function genNodeListAsArray(nodes, context) {
21320
21320
  const multilines = nodes.length > 3 ||
@@ -21359,73 +21359,73 @@ function genNode(node, context) {
21359
21359
  return;
21360
21360
  }
21361
21361
  switch (node.type) {
21362
- case 1 /* ELEMENT */:
21363
- case 9 /* IF */:
21364
- case 11 /* FOR */:
21362
+ case 1 /* NodeTypes.ELEMENT */:
21363
+ case 9 /* NodeTypes.IF */:
21364
+ case 11 /* NodeTypes.FOR */:
21365
21365
  assert$1(node.codegenNode != null, `Codegen node is missing for element/if/for node. ` +
21366
21366
  `Apply appropriate transforms first.`);
21367
21367
  genNode(node.codegenNode, context);
21368
21368
  break;
21369
- case 2 /* TEXT */:
21369
+ case 2 /* NodeTypes.TEXT */:
21370
21370
  genText(node, context);
21371
21371
  break;
21372
- case 4 /* SIMPLE_EXPRESSION */:
21372
+ case 4 /* NodeTypes.SIMPLE_EXPRESSION */:
21373
21373
  genExpression(node, context);
21374
21374
  break;
21375
- case 5 /* INTERPOLATION */:
21375
+ case 5 /* NodeTypes.INTERPOLATION */:
21376
21376
  genInterpolation(node, context);
21377
21377
  break;
21378
- case 12 /* TEXT_CALL */:
21378
+ case 12 /* NodeTypes.TEXT_CALL */:
21379
21379
  genNode(node.codegenNode, context);
21380
21380
  break;
21381
- case 8 /* COMPOUND_EXPRESSION */:
21381
+ case 8 /* NodeTypes.COMPOUND_EXPRESSION */:
21382
21382
  genCompoundExpression(node, context);
21383
21383
  break;
21384
- case 3 /* COMMENT */:
21384
+ case 3 /* NodeTypes.COMMENT */:
21385
21385
  genComment(node, context);
21386
21386
  break;
21387
- case 13 /* VNODE_CALL */:
21387
+ case 13 /* NodeTypes.VNODE_CALL */:
21388
21388
  genVNodeCall(node, context);
21389
21389
  break;
21390
- case 14 /* JS_CALL_EXPRESSION */:
21390
+ case 14 /* NodeTypes.JS_CALL_EXPRESSION */:
21391
21391
  genCallExpression(node, context);
21392
21392
  break;
21393
- case 15 /* JS_OBJECT_EXPRESSION */:
21393
+ case 15 /* NodeTypes.JS_OBJECT_EXPRESSION */:
21394
21394
  genObjectExpression(node, context);
21395
21395
  break;
21396
- case 17 /* JS_ARRAY_EXPRESSION */:
21396
+ case 17 /* NodeTypes.JS_ARRAY_EXPRESSION */:
21397
21397
  genArrayExpression(node, context);
21398
21398
  break;
21399
- case 18 /* JS_FUNCTION_EXPRESSION */:
21399
+ case 18 /* NodeTypes.JS_FUNCTION_EXPRESSION */:
21400
21400
  genFunctionExpression(node, context);
21401
21401
  break;
21402
- case 19 /* JS_CONDITIONAL_EXPRESSION */:
21402
+ case 19 /* NodeTypes.JS_CONDITIONAL_EXPRESSION */:
21403
21403
  genConditionalExpression(node, context);
21404
21404
  break;
21405
- case 20 /* JS_CACHE_EXPRESSION */:
21405
+ case 20 /* NodeTypes.JS_CACHE_EXPRESSION */:
21406
21406
  genCacheExpression(node, context);
21407
21407
  break;
21408
- case 21 /* JS_BLOCK_STATEMENT */:
21408
+ case 21 /* NodeTypes.JS_BLOCK_STATEMENT */:
21409
21409
  genNodeList(node.body, context, true, false);
21410
21410
  break;
21411
21411
  // SSR only types
21412
- case 22 /* JS_TEMPLATE_LITERAL */:
21412
+ case 22 /* NodeTypes.JS_TEMPLATE_LITERAL */:
21413
21413
  genTemplateLiteral(node, context);
21414
21414
  break;
21415
- case 23 /* JS_IF_STATEMENT */:
21415
+ case 23 /* NodeTypes.JS_IF_STATEMENT */:
21416
21416
  genIfStatement(node, context);
21417
21417
  break;
21418
- case 24 /* JS_ASSIGNMENT_EXPRESSION */:
21418
+ case 24 /* NodeTypes.JS_ASSIGNMENT_EXPRESSION */:
21419
21419
  genAssignmentExpression(node, context);
21420
21420
  break;
21421
- case 25 /* JS_SEQUENCE_EXPRESSION */:
21421
+ case 25 /* NodeTypes.JS_SEQUENCE_EXPRESSION */:
21422
21422
  genSequenceExpression(node, context);
21423
21423
  break;
21424
- case 26 /* JS_RETURN_STATEMENT */:
21424
+ case 26 /* NodeTypes.JS_RETURN_STATEMENT */:
21425
21425
  genReturnStatement(node, context);
21426
21426
  break;
21427
21427
  /* istanbul ignore next */
21428
- case 10 /* IF_BRANCH */:
21428
+ case 10 /* NodeTypes.IF_BRANCH */:
21429
21429
  // noop
21430
21430
  break;
21431
21431
  default:
@@ -21465,7 +21465,7 @@ function genCompoundExpression(node, context) {
21465
21465
  }
21466
21466
  function genExpressionAsPropertyKey(node, context) {
21467
21467
  const { push } = context;
21468
- if (node.type === 8 /* COMPOUND_EXPRESSION */) {
21468
+ if (node.type === 8 /* NodeTypes.COMPOUND_EXPRESSION */) {
21469
21469
  push(`[`);
21470
21470
  genCompoundExpression(node, context);
21471
21471
  push(`]`);
@@ -21542,7 +21542,7 @@ function genObjectExpression(node, context) {
21542
21542
  return;
21543
21543
  }
21544
21544
  const multilines = properties.length > 1 ||
21545
- (properties.some(p => p.value.type !== 4 /* SIMPLE_EXPRESSION */));
21545
+ (properties.some(p => p.value.type !== 4 /* NodeTypes.SIMPLE_EXPRESSION */));
21546
21546
  push(multilines ? `{` : `{ `);
21547
21547
  multilines && indent();
21548
21548
  for (let i = 0; i < properties.length; i++) {
@@ -21608,7 +21608,7 @@ function genFunctionExpression(node, context) {
21608
21608
  function genConditionalExpression(node, context) {
21609
21609
  const { test, consequent, alternate, newline: needNewline } = node;
21610
21610
  const { push, indent, deindent, newline } = context;
21611
- if (test.type === 4 /* SIMPLE_EXPRESSION */) {
21611
+ if (test.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
21612
21612
  const needsParens = !isSimpleIdentifier(test.content);
21613
21613
  needsParens && push(`(`);
21614
21614
  genExpression(test, context);
@@ -21628,7 +21628,7 @@ function genConditionalExpression(node, context) {
21628
21628
  needNewline && newline();
21629
21629
  needNewline || push(` `);
21630
21630
  push(`: `);
21631
- const isNested = alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */;
21631
+ const isNested = alternate.type === 19 /* NodeTypes.JS_CONDITIONAL_EXPRESSION */;
21632
21632
  if (!isNested) {
21633
21633
  context.indentLevel++;
21634
21634
  }
@@ -21692,7 +21692,7 @@ function genIfStatement(node, context) {
21692
21692
  push(`}`);
21693
21693
  if (alternate) {
21694
21694
  push(` else `);
21695
- if (alternate.type === 23 /* JS_IF_STATEMENT */) {
21695
+ if (alternate.type === 23 /* NodeTypes.JS_IF_STATEMENT */) {
21696
21696
  genIfStatement(alternate, context);
21697
21697
  }
21698
21698
  else {
@@ -22249,27 +22249,27 @@ function isReferenced(node, parent, grandparent) {
22249
22249
 
22250
22250
  const isLiteralWhitelisted = /*#__PURE__*/ makeMap('true,false,null,this');
22251
22251
  const transformExpression = (node, context) => {
22252
- if (node.type === 5 /* INTERPOLATION */) {
22252
+ if (node.type === 5 /* NodeTypes.INTERPOLATION */) {
22253
22253
  node.content = processExpression(node.content, context);
22254
22254
  }
22255
- else if (node.type === 1 /* ELEMENT */) {
22255
+ else if (node.type === 1 /* NodeTypes.ELEMENT */) {
22256
22256
  // handle directives on element
22257
22257
  for (let i = 0; i < node.props.length; i++) {
22258
22258
  const dir = node.props[i];
22259
22259
  // do not process for v-on & v-for since they are special handled
22260
- if (dir.type === 7 /* DIRECTIVE */ && dir.name !== 'for') {
22260
+ if (dir.type === 7 /* NodeTypes.DIRECTIVE */ && dir.name !== 'for') {
22261
22261
  const exp = dir.exp;
22262
22262
  const arg = dir.arg;
22263
22263
  // do not process exp if this is v-on:arg - we need special handling
22264
22264
  // for wrapping inline statements.
22265
22265
  if (exp &&
22266
- exp.type === 4 /* SIMPLE_EXPRESSION */ &&
22266
+ exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
22267
22267
  !(dir.name === 'on' && arg)) {
22268
22268
  dir.exp = processExpression(exp, context,
22269
22269
  // slot args must be processed as function params
22270
22270
  dir.name === 'slot');
22271
22271
  }
22272
- if (arg && arg.type === 4 /* SIMPLE_EXPRESSION */ && !arg.isStatic) {
22272
+ if (arg && arg.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ && !arg.isStatic) {
22273
22273
  dir.arg = processExpression(arg, context);
22274
22274
  }
22275
22275
  }
@@ -22298,15 +22298,15 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
22298
22298
  const isUpdateArg = parent && parent.type === 'UpdateExpression' && parent.argument === id;
22299
22299
  // ({ x } = y)
22300
22300
  const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack);
22301
- if (type === "setup-const" /* SETUP_CONST */ ||
22302
- type === "setup-reactive-const" /* SETUP_REACTIVE_CONST */ ||
22301
+ if (type === "setup-const" /* BindingTypes.SETUP_CONST */ ||
22302
+ type === "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */ ||
22303
22303
  localVars[raw]) {
22304
22304
  return raw;
22305
22305
  }
22306
- else if (type === "setup-ref" /* SETUP_REF */) {
22306
+ else if (type === "setup-ref" /* BindingTypes.SETUP_REF */) {
22307
22307
  return `${raw}.value`;
22308
22308
  }
22309
- else if (type === "setup-maybe-ref" /* SETUP_MAYBE_REF */) {
22309
+ else if (type === "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */) {
22310
22310
  // const binding that may or may not be ref
22311
22311
  // if it's not a ref, then assignments don't make sense -
22312
22312
  // so we ignore the non-ref assignment case and generate code
@@ -22315,7 +22315,7 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
22315
22315
  ? `${raw}.value`
22316
22316
  : `${context.helperString(UNREF)}(${raw})`;
22317
22317
  }
22318
- else if (type === "setup-let" /* SETUP_LET */) {
22318
+ else if (type === "setup-let" /* BindingTypes.SETUP_LET */) {
22319
22319
  if (isAssignmentLVal) {
22320
22320
  // let binding.
22321
22321
  // this is a bit more tricky as we need to cover the case where
@@ -22351,12 +22351,12 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
22351
22351
  return `${context.helperString(UNREF)}(${raw})`;
22352
22352
  }
22353
22353
  }
22354
- else if (type === "props" /* PROPS */) {
22354
+ else if (type === "props" /* BindingTypes.PROPS */) {
22355
22355
  // use __props which is generated by compileScript so in ts mode
22356
22356
  // it gets correct type
22357
22357
  return genPropsAccessExp(raw);
22358
22358
  }
22359
- else if (type === "props-aliased" /* PROPS_ALIASED */) {
22359
+ else if (type === "props-aliased" /* BindingTypes.PROPS_ALIASED */) {
22360
22360
  // prop with a different local alias (from defineProps() destructure)
22361
22361
  return genPropsAccessExp(bindingMetadata.__propsAliases[raw]);
22362
22362
  }
@@ -22366,7 +22366,7 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
22366
22366
  // setup bindings in non-inline mode
22367
22367
  return `$setup.${raw}`;
22368
22368
  }
22369
- else if (type === "props-aliased" /* PROPS_ALIASED */) {
22369
+ else if (type === "props-aliased" /* BindingTypes.PROPS_ALIASED */) {
22370
22370
  return `$props['${bindingMetadata.__propsAliases[raw]}']`;
22371
22371
  }
22372
22372
  else if (type) {
@@ -22387,17 +22387,17 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
22387
22387
  if (!asParams && !isScopeVarReference && !isAllowedGlobal && !isLiteral) {
22388
22388
  // const bindings exposed from setup can be skipped for patching but
22389
22389
  // cannot be hoisted to module scope
22390
- if (bindingMetadata[node.content] === "setup-const" /* SETUP_CONST */) {
22391
- node.constType = 1 /* CAN_SKIP_PATCH */;
22390
+ if (bindingMetadata[node.content] === "setup-const" /* BindingTypes.SETUP_CONST */) {
22391
+ node.constType = 1 /* ConstantTypes.CAN_SKIP_PATCH */;
22392
22392
  }
22393
22393
  node.content = rewriteIdentifier(rawExp);
22394
22394
  }
22395
22395
  else if (!isScopeVarReference) {
22396
22396
  if (isLiteral) {
22397
- node.constType = 3 /* CAN_STRINGIFY */;
22397
+ node.constType = 3 /* ConstantTypes.CAN_STRINGIFY */;
22398
22398
  }
22399
22399
  else {
22400
- node.constType = 2 /* CAN_HOIST */;
22400
+ node.constType = 2 /* ConstantTypes.CAN_HOIST */;
22401
22401
  }
22402
22402
  }
22403
22403
  return node;
@@ -22417,7 +22417,7 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
22417
22417
  }).program;
22418
22418
  }
22419
22419
  catch (e) {
22420
- context.onError(createCompilerError(44 /* X_INVALID_EXPRESSION */, node.loc, undefined, e.message));
22420
+ context.onError(createCompilerError(44 /* ErrorCodes.X_INVALID_EXPRESSION */, node.loc, undefined, e.message));
22421
22421
  return node;
22422
22422
  }
22423
22423
  const ids = [];
@@ -22467,7 +22467,7 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
22467
22467
  source,
22468
22468
  start: advancePositionWithClone(node.loc.start, source, start),
22469
22469
  end: advancePositionWithClone(node.loc.start, source, end)
22470
- }, id.isConstant ? 3 /* CAN_STRINGIFY */ : 0 /* NOT_CONSTANT */));
22470
+ }, id.isConstant ? 3 /* ConstantTypes.CAN_STRINGIFY */ : 0 /* ConstantTypes.NOT_CONSTANT */));
22471
22471
  if (i === ids.length - 1 && end < rawExp.length) {
22472
22472
  children.push(rawExp.slice(end));
22473
22473
  }
@@ -22479,8 +22479,8 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
22479
22479
  else {
22480
22480
  ret = node;
22481
22481
  ret.constType = bailConstant
22482
- ? 0 /* NOT_CONSTANT */
22483
- : 3 /* CAN_STRINGIFY */;
22482
+ ? 0 /* ConstantTypes.NOT_CONSTANT */
22483
+ : 3 /* ConstantTypes.CAN_STRINGIFY */;
22484
22484
  }
22485
22485
  ret.identifiers = Object.keys(knownIds);
22486
22486
  return ret;
@@ -22500,7 +22500,7 @@ function stringifyExpression(exp) {
22500
22500
  if (isString(exp)) {
22501
22501
  return exp;
22502
22502
  }
22503
- else if (exp.type === 4 /* SIMPLE_EXPRESSION */) {
22503
+ else if (exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
22504
22504
  return exp.content;
22505
22505
  }
22506
22506
  else {
@@ -22520,7 +22520,7 @@ const transformIf = createStructuralDirectiveTransform(/^(if|else|else-if)$/, (n
22520
22520
  let key = 0;
22521
22521
  while (i-- >= 0) {
22522
22522
  const sibling = siblings[i];
22523
- if (sibling && sibling.type === 9 /* IF */) {
22523
+ if (sibling && sibling.type === 9 /* NodeTypes.IF */) {
22524
22524
  key += sibling.branches.length;
22525
22525
  }
22526
22526
  }
@@ -22543,7 +22543,7 @@ function processIf(node, dir, context, processCodegen) {
22543
22543
  if (dir.name !== 'else' &&
22544
22544
  (!dir.exp || !dir.exp.content.trim())) {
22545
22545
  const loc = dir.exp ? dir.exp.loc : node.loc;
22546
- context.onError(createCompilerError(28 /* X_V_IF_NO_EXPRESSION */, dir.loc));
22546
+ context.onError(createCompilerError(28 /* ErrorCodes.X_V_IF_NO_EXPRESSION */, dir.loc));
22547
22547
  dir.exp = createSimpleExpression(`true`, false, loc);
22548
22548
  }
22549
22549
  if (context.prefixIdentifiers && dir.exp) {
@@ -22554,7 +22554,7 @@ function processIf(node, dir, context, processCodegen) {
22554
22554
  if (dir.name === 'if') {
22555
22555
  const branch = createIfBranch(node, dir);
22556
22556
  const ifNode = {
22557
- type: 9 /* IF */,
22557
+ type: 9 /* NodeTypes.IF */,
22558
22558
  loc: node.loc,
22559
22559
  branches: [branch]
22560
22560
  };
@@ -22570,22 +22570,22 @@ function processIf(node, dir, context, processCodegen) {
22570
22570
  let i = siblings.indexOf(node);
22571
22571
  while (i-- >= -1) {
22572
22572
  const sibling = siblings[i];
22573
- if (sibling && sibling.type === 3 /* COMMENT */) {
22573
+ if (sibling && sibling.type === 3 /* NodeTypes.COMMENT */) {
22574
22574
  context.removeNode(sibling);
22575
22575
  comments.unshift(sibling);
22576
22576
  continue;
22577
22577
  }
22578
22578
  if (sibling &&
22579
- sibling.type === 2 /* TEXT */ &&
22579
+ sibling.type === 2 /* NodeTypes.TEXT */ &&
22580
22580
  !sibling.content.trim().length) {
22581
22581
  context.removeNode(sibling);
22582
22582
  continue;
22583
22583
  }
22584
- if (sibling && sibling.type === 9 /* IF */) {
22584
+ if (sibling && sibling.type === 9 /* NodeTypes.IF */) {
22585
22585
  // Check if v-else was followed by v-else-if
22586
22586
  if (dir.name === 'else-if' &&
22587
22587
  sibling.branches[sibling.branches.length - 1].condition === undefined) {
22588
- context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
22588
+ context.onError(createCompilerError(30 /* ErrorCodes.X_V_ELSE_NO_ADJACENT_IF */, node.loc));
22589
22589
  }
22590
22590
  // move the node to the if node's branches
22591
22591
  context.removeNode();
@@ -22593,7 +22593,7 @@ function processIf(node, dir, context, processCodegen) {
22593
22593
  if (comments.length &&
22594
22594
  // #3619 ignore comments if the v-if is direct child of <transition>
22595
22595
  !(context.parent &&
22596
- context.parent.type === 1 /* ELEMENT */ &&
22596
+ context.parent.type === 1 /* NodeTypes.ELEMENT */ &&
22597
22597
  isBuiltInType(context.parent.tag, 'transition'))) {
22598
22598
  branch.children = [...comments, ...branch.children];
22599
22599
  }
@@ -22603,7 +22603,7 @@ function processIf(node, dir, context, processCodegen) {
22603
22603
  if (key) {
22604
22604
  sibling.branches.forEach(({ userKey }) => {
22605
22605
  if (isSameKey(userKey, key)) {
22606
- context.onError(createCompilerError(29 /* X_V_IF_SAME_KEY */, branch.userKey.loc));
22606
+ context.onError(createCompilerError(29 /* ErrorCodes.X_V_IF_SAME_KEY */, branch.userKey.loc));
22607
22607
  }
22608
22608
  });
22609
22609
  }
@@ -22621,16 +22621,16 @@ function processIf(node, dir, context, processCodegen) {
22621
22621
  context.currentNode = null;
22622
22622
  }
22623
22623
  else {
22624
- context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
22624
+ context.onError(createCompilerError(30 /* ErrorCodes.X_V_ELSE_NO_ADJACENT_IF */, node.loc));
22625
22625
  }
22626
22626
  break;
22627
22627
  }
22628
22628
  }
22629
22629
  }
22630
22630
  function createIfBranch(node, dir) {
22631
- const isTemplateIf = node.tagType === 3 /* TEMPLATE */;
22631
+ const isTemplateIf = node.tagType === 3 /* ElementTypes.TEMPLATE */;
22632
22632
  return {
22633
- type: 10 /* IF_BRANCH */,
22633
+ type: 10 /* NodeTypes.IF_BRANCH */,
22634
22634
  loc: node.loc,
22635
22635
  condition: dir.name === 'else' ? undefined : dir.exp,
22636
22636
  children: isTemplateIf && !findDir(node, 'for') ? node.children : [node],
@@ -22654,26 +22654,26 @@ function createCodegenNodeForBranch(branch, keyIndex, context) {
22654
22654
  }
22655
22655
  function createChildrenCodegenNode(branch, keyIndex, context) {
22656
22656
  const { helper } = context;
22657
- const keyProperty = createObjectProperty(`key`, createSimpleExpression(`${keyIndex}`, false, locStub, 2 /* CAN_HOIST */));
22657
+ const keyProperty = createObjectProperty(`key`, createSimpleExpression(`${keyIndex}`, false, locStub, 2 /* ConstantTypes.CAN_HOIST */));
22658
22658
  const { children } = branch;
22659
22659
  const firstChild = children[0];
22660
- const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1 /* ELEMENT */;
22660
+ const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1 /* NodeTypes.ELEMENT */;
22661
22661
  if (needFragmentWrapper) {
22662
- if (children.length === 1 && firstChild.type === 11 /* FOR */) {
22662
+ if (children.length === 1 && firstChild.type === 11 /* NodeTypes.FOR */) {
22663
22663
  // optimize away nested fragments when child is a ForNode
22664
22664
  const vnodeCall = firstChild.codegenNode;
22665
22665
  injectProp(vnodeCall, keyProperty, context);
22666
22666
  return vnodeCall;
22667
22667
  }
22668
22668
  else {
22669
- let patchFlag = 64 /* STABLE_FRAGMENT */;
22670
- let patchFlagText = PatchFlagNames[64 /* STABLE_FRAGMENT */];
22669
+ let patchFlag = 64 /* PatchFlags.STABLE_FRAGMENT */;
22670
+ let patchFlagText = PatchFlagNames[64 /* PatchFlags.STABLE_FRAGMENT */];
22671
22671
  // check if the fragment actually contains a single valid child with
22672
22672
  // the rest being comments
22673
22673
  if (!branch.isTemplateIf &&
22674
- children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
22675
- patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
22676
- patchFlagText += `, ${PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
22674
+ children.filter(c => c.type !== 3 /* NodeTypes.COMMENT */).length === 1) {
22675
+ patchFlag |= 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */;
22676
+ patchFlagText += `, ${PatchFlagNames[2048 /* PatchFlags.DEV_ROOT_FRAGMENT */]}`;
22677
22677
  }
22678
22678
  return createVNodeCall(context, helper(FRAGMENT), createObjectExpression([keyProperty]), children, patchFlag + (` /* ${patchFlagText} */` ), undefined, undefined, true, false, false /* isComponent */, branch.loc);
22679
22679
  }
@@ -22682,7 +22682,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
22682
22682
  const ret = firstChild.codegenNode;
22683
22683
  const vnodeCall = getMemoedVNodeCall(ret);
22684
22684
  // Change createVNode to createBlock.
22685
- if (vnodeCall.type === 13 /* VNODE_CALL */) {
22685
+ if (vnodeCall.type === 13 /* NodeTypes.VNODE_CALL */) {
22686
22686
  makeBlock(vnodeCall, context);
22687
22687
  }
22688
22688
  // inject branch key
@@ -22694,7 +22694,7 @@ function isSameKey(a, b) {
22694
22694
  if (!a || a.type !== b.type) {
22695
22695
  return false;
22696
22696
  }
22697
- if (a.type === 6 /* ATTRIBUTE */) {
22697
+ if (a.type === 6 /* NodeTypes.ATTRIBUTE */) {
22698
22698
  if (a.value.content !== b.value.content) {
22699
22699
  return false;
22700
22700
  }
@@ -22706,7 +22706,7 @@ function isSameKey(a, b) {
22706
22706
  if (exp.type !== branchExp.type) {
22707
22707
  return false;
22708
22708
  }
22709
- if (exp.type !== 4 /* SIMPLE_EXPRESSION */ ||
22709
+ if (exp.type !== 4 /* NodeTypes.SIMPLE_EXPRESSION */ ||
22710
22710
  exp.isStatic !== branchExp.isStatic ||
22711
22711
  exp.content !== branchExp.content) {
22712
22712
  return false;
@@ -22716,15 +22716,15 @@ function isSameKey(a, b) {
22716
22716
  }
22717
22717
  function getParentCondition(node) {
22718
22718
  while (true) {
22719
- if (node.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
22720
- if (node.alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
22719
+ if (node.type === 19 /* NodeTypes.JS_CONDITIONAL_EXPRESSION */) {
22720
+ if (node.alternate.type === 19 /* NodeTypes.JS_CONDITIONAL_EXPRESSION */) {
22721
22721
  node = node.alternate;
22722
22722
  }
22723
22723
  else {
22724
22724
  return node;
22725
22725
  }
22726
22726
  }
22727
- else if (node.type === 20 /* JS_CACHE_EXPRESSION */) {
22727
+ else if (node.type === 20 /* NodeTypes.JS_CACHE_EXPRESSION */) {
22728
22728
  node = node.value;
22729
22729
  }
22730
22730
  }
@@ -22742,7 +22742,7 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
22742
22742
  const memo = findDir(node, 'memo');
22743
22743
  const keyProp = findProp(node, `key`);
22744
22744
  const keyExp = keyProp &&
22745
- (keyProp.type === 6 /* ATTRIBUTE */
22745
+ (keyProp.type === 6 /* NodeTypes.ATTRIBUTE */
22746
22746
  ? createSimpleExpression(keyProp.value.content, true)
22747
22747
  : keyProp.exp);
22748
22748
  const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null;
@@ -22754,17 +22754,17 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
22754
22754
  if (memo) {
22755
22755
  memo.exp = processExpression(memo.exp, context);
22756
22756
  }
22757
- if (keyProperty && keyProp.type !== 6 /* ATTRIBUTE */) {
22757
+ if (keyProperty && keyProp.type !== 6 /* NodeTypes.ATTRIBUTE */) {
22758
22758
  keyProperty.value = processExpression(keyProperty.value, context);
22759
22759
  }
22760
22760
  }
22761
- const isStableFragment = forNode.source.type === 4 /* SIMPLE_EXPRESSION */ &&
22762
- forNode.source.constType > 0 /* NOT_CONSTANT */;
22761
+ const isStableFragment = forNode.source.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
22762
+ forNode.source.constType > 0 /* ConstantTypes.NOT_CONSTANT */;
22763
22763
  const fragmentFlag = isStableFragment
22764
- ? 64 /* STABLE_FRAGMENT */
22764
+ ? 64 /* PatchFlags.STABLE_FRAGMENT */
22765
22765
  : keyProp
22766
- ? 128 /* KEYED_FRAGMENT */
22767
- : 256 /* UNKEYED_FRAGMENT */;
22766
+ ? 128 /* PatchFlags.KEYED_FRAGMENT */
22767
+ : 256 /* PatchFlags.UNKEYED_FRAGMENT */;
22768
22768
  forNode.codegenNode = createVNodeCall(context, helper(FRAGMENT), undefined, renderExp, fragmentFlag +
22769
22769
  (` /* ${PatchFlagNames[fragmentFlag]} */` ), undefined, undefined, true /* isBlock */, !isStableFragment /* disableTracking */, false /* isComponent */, node.loc);
22770
22770
  return () => {
@@ -22774,16 +22774,16 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
22774
22774
  // check <template v-for> key placement
22775
22775
  if (isTemplate) {
22776
22776
  node.children.some(c => {
22777
- if (c.type === 1 /* ELEMENT */) {
22777
+ if (c.type === 1 /* NodeTypes.ELEMENT */) {
22778
22778
  const key = findProp(c, 'key');
22779
22779
  if (key) {
22780
- context.onError(createCompilerError(33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */, key.loc));
22780
+ context.onError(createCompilerError(33 /* ErrorCodes.X_V_FOR_TEMPLATE_KEY_PLACEMENT */, key.loc));
22781
22781
  return true;
22782
22782
  }
22783
22783
  }
22784
22784
  });
22785
22785
  }
22786
- const needFragmentWrapper = children.length !== 1 || children[0].type !== 1 /* ELEMENT */;
22786
+ const needFragmentWrapper = children.length !== 1 || children[0].type !== 1 /* NodeTypes.ELEMENT */;
22787
22787
  const slotOutlet = isSlotOutlet(node)
22788
22788
  ? node
22789
22789
  : isTemplate &&
@@ -22804,8 +22804,8 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
22804
22804
  else if (needFragmentWrapper) {
22805
22805
  // <template v-for="..."> with text or multi-elements
22806
22806
  // should generate a fragment block for each loop
22807
- childBlock = createVNodeCall(context, helper(FRAGMENT), keyProperty ? createObjectExpression([keyProperty]) : undefined, node.children, 64 /* STABLE_FRAGMENT */ +
22808
- (` /* ${PatchFlagNames[64 /* STABLE_FRAGMENT */]} */`
22807
+ childBlock = createVNodeCall(context, helper(FRAGMENT), keyProperty ? createObjectExpression([keyProperty]) : undefined, node.children, 64 /* PatchFlags.STABLE_FRAGMENT */ +
22808
+ (` /* ${PatchFlagNames[64 /* PatchFlags.STABLE_FRAGMENT */]} */`
22809
22809
  ), undefined, undefined, true, undefined, false /* isComponent */);
22810
22810
  }
22811
22811
  else {
@@ -22862,7 +22862,7 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
22862
22862
  // target-agnostic transform used for both Client and SSR
22863
22863
  function processFor(node, dir, context, processCodegen) {
22864
22864
  if (!dir.exp) {
22865
- context.onError(createCompilerError(31 /* X_V_FOR_NO_EXPRESSION */, dir.loc));
22865
+ context.onError(createCompilerError(31 /* ErrorCodes.X_V_FOR_NO_EXPRESSION */, dir.loc));
22866
22866
  return;
22867
22867
  }
22868
22868
  const parseResult = parseForExpression(
@@ -22870,13 +22870,13 @@ function processFor(node, dir, context, processCodegen) {
22870
22870
  // before expression transform.
22871
22871
  dir.exp, context);
22872
22872
  if (!parseResult) {
22873
- context.onError(createCompilerError(32 /* X_V_FOR_MALFORMED_EXPRESSION */, dir.loc));
22873
+ context.onError(createCompilerError(32 /* ErrorCodes.X_V_FOR_MALFORMED_EXPRESSION */, dir.loc));
22874
22874
  return;
22875
22875
  }
22876
22876
  const { addIdentifiers, removeIdentifiers, scopes } = context;
22877
22877
  const { source, value, key, index } = parseResult;
22878
22878
  const forNode = {
22879
- type: 11 /* FOR */,
22879
+ type: 11 /* NodeTypes.FOR */,
22880
22880
  loc: dir.loc,
22881
22881
  source,
22882
22882
  valueAlias: value,
@@ -22988,9 +22988,9 @@ const defaultFallback = createSimpleExpression(`undefined`, false);
22988
22988
  // Note the exit callback is executed before buildSlots() on the same node,
22989
22989
  // so only nested slots see positive numbers.
22990
22990
  const trackSlotScopes = (node, context) => {
22991
- if (node.type === 1 /* ELEMENT */ &&
22992
- (node.tagType === 1 /* COMPONENT */ ||
22993
- node.tagType === 3 /* TEMPLATE */)) {
22991
+ if (node.type === 1 /* NodeTypes.ELEMENT */ &&
22992
+ (node.tagType === 1 /* ElementTypes.COMPONENT */ ||
22993
+ node.tagType === 3 /* ElementTypes.TEMPLATE */)) {
22994
22994
  // We are only checking non-empty v-slot here
22995
22995
  // since we only care about slots that introduce scope variables.
22996
22996
  const vSlot = findDir(node, 'slot');
@@ -23063,20 +23063,21 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
23063
23063
  let hasNamedDefaultSlot = false;
23064
23064
  const implicitDefaultChildren = [];
23065
23065
  const seenSlotNames = new Set();
23066
+ let conditionalBranchIndex = 0;
23066
23067
  for (let i = 0; i < children.length; i++) {
23067
23068
  const slotElement = children[i];
23068
23069
  let slotDir;
23069
23070
  if (!isTemplateNode(slotElement) ||
23070
23071
  !(slotDir = findDir(slotElement, 'slot', true))) {
23071
23072
  // not a <template v-slot>, skip.
23072
- if (slotElement.type !== 3 /* COMMENT */) {
23073
+ if (slotElement.type !== 3 /* NodeTypes.COMMENT */) {
23073
23074
  implicitDefaultChildren.push(slotElement);
23074
23075
  }
23075
23076
  continue;
23076
23077
  }
23077
23078
  if (onComponentSlot) {
23078
23079
  // already has on-component slot - this is incorrect usage.
23079
- context.onError(createCompilerError(37 /* X_V_SLOT_MIXED_SLOT_USAGE */, slotDir.loc));
23080
+ context.onError(createCompilerError(37 /* ErrorCodes.X_V_SLOT_MIXED_SLOT_USAGE */, slotDir.loc));
23080
23081
  break;
23081
23082
  }
23082
23083
  hasTemplateSlots = true;
@@ -23097,7 +23098,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
23097
23098
  let vFor;
23098
23099
  if ((vIf = findDir(slotElement, 'if'))) {
23099
23100
  hasDynamicSlots = true;
23100
- dynamicSlots.push(createConditionalExpression(vIf.exp, buildDynamicSlot(slotName, slotFunction), defaultFallback));
23101
+ dynamicSlots.push(createConditionalExpression(vIf.exp, buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++), defaultFallback));
23101
23102
  }
23102
23103
  else if ((vElse = findDir(slotElement, /^else(-if)?$/, true /* allowEmpty */))) {
23103
23104
  // find adjacent v-if
@@ -23105,7 +23106,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
23105
23106
  let prev;
23106
23107
  while (j--) {
23107
23108
  prev = children[j];
23108
- if (prev.type !== 3 /* COMMENT */) {
23109
+ if (prev.type !== 3 /* NodeTypes.COMMENT */) {
23109
23110
  break;
23110
23111
  }
23111
23112
  }
@@ -23115,15 +23116,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
23115
23116
  i--;
23116
23117
  // attach this slot to previous conditional
23117
23118
  let conditional = dynamicSlots[dynamicSlots.length - 1];
23118
- while (conditional.alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
23119
+ while (conditional.alternate.type === 19 /* NodeTypes.JS_CONDITIONAL_EXPRESSION */) {
23119
23120
  conditional = conditional.alternate;
23120
23121
  }
23121
23122
  conditional.alternate = vElse.exp
23122
- ? createConditionalExpression(vElse.exp, buildDynamicSlot(slotName, slotFunction), defaultFallback)
23123
- : buildDynamicSlot(slotName, slotFunction);
23123
+ ? createConditionalExpression(vElse.exp, buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++), defaultFallback)
23124
+ : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
23124
23125
  }
23125
23126
  else {
23126
- context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, vElse.loc));
23127
+ context.onError(createCompilerError(30 /* ErrorCodes.X_V_ELSE_NO_ADJACENT_IF */, vElse.loc));
23127
23128
  }
23128
23129
  }
23129
23130
  else if ((vFor = findDir(slotElement, 'for'))) {
@@ -23139,14 +23140,14 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
23139
23140
  ]));
23140
23141
  }
23141
23142
  else {
23142
- context.onError(createCompilerError(32 /* X_V_FOR_MALFORMED_EXPRESSION */, vFor.loc));
23143
+ context.onError(createCompilerError(32 /* ErrorCodes.X_V_FOR_MALFORMED_EXPRESSION */, vFor.loc));
23143
23144
  }
23144
23145
  }
23145
23146
  else {
23146
23147
  // check duplicate static names
23147
23148
  if (staticSlotName) {
23148
23149
  if (seenSlotNames.has(staticSlotName)) {
23149
- context.onError(createCompilerError(38 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */, dirLoc));
23150
+ context.onError(createCompilerError(38 /* ErrorCodes.X_V_SLOT_DUPLICATE_SLOT_NAMES */, dirLoc));
23150
23151
  continue;
23151
23152
  }
23152
23153
  seenSlotNames.add(staticSlotName);
@@ -23173,7 +23174,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
23173
23174
  implicitDefaultChildren.some(node => isNonWhitespaceContent(node))) {
23174
23175
  // implicit default slot (mixed with named slots)
23175
23176
  if (hasNamedDefaultSlot) {
23176
- context.onError(createCompilerError(39 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */, implicitDefaultChildren[0].loc));
23177
+ context.onError(createCompilerError(39 /* ErrorCodes.X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */, implicitDefaultChildren[0].loc));
23177
23178
  }
23178
23179
  else {
23179
23180
  slotsProperties.push(buildDefaultSlotProperty(undefined, implicitDefaultChildren));
@@ -23181,10 +23182,10 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
23181
23182
  }
23182
23183
  }
23183
23184
  const slotFlag = hasDynamicSlots
23184
- ? 2 /* DYNAMIC */
23185
+ ? 2 /* SlotFlags.DYNAMIC */
23185
23186
  : hasForwardedSlots(node.children)
23186
- ? 3 /* FORWARDED */
23187
- : 1 /* STABLE */;
23187
+ ? 3 /* SlotFlags.FORWARDED */
23188
+ : 1 /* SlotFlags.STABLE */;
23188
23189
  let slots = createObjectExpression(slotsProperties.concat(createObjectProperty(`_`,
23189
23190
  // 2 = compiled but dynamic = can skip normalization, but must run diff
23190
23191
  // 1 = compiled and static = can skip normalization AND diff as optimized
@@ -23200,28 +23201,32 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
23200
23201
  hasDynamicSlots
23201
23202
  };
23202
23203
  }
23203
- function buildDynamicSlot(name, fn) {
23204
- return createObjectExpression([
23204
+ function buildDynamicSlot(name, fn, index) {
23205
+ const props = [
23205
23206
  createObjectProperty(`name`, name),
23206
23207
  createObjectProperty(`fn`, fn)
23207
- ]);
23208
+ ];
23209
+ if (index != null) {
23210
+ props.push(createObjectProperty(`key`, createSimpleExpression(String(index), true)));
23211
+ }
23212
+ return createObjectExpression(props);
23208
23213
  }
23209
23214
  function hasForwardedSlots(children) {
23210
23215
  for (let i = 0; i < children.length; i++) {
23211
23216
  const child = children[i];
23212
23217
  switch (child.type) {
23213
- case 1 /* ELEMENT */:
23214
- if (child.tagType === 2 /* SLOT */ ||
23218
+ case 1 /* NodeTypes.ELEMENT */:
23219
+ if (child.tagType === 2 /* ElementTypes.SLOT */ ||
23215
23220
  hasForwardedSlots(child.children)) {
23216
23221
  return true;
23217
23222
  }
23218
23223
  break;
23219
- case 9 /* IF */:
23224
+ case 9 /* NodeTypes.IF */:
23220
23225
  if (hasForwardedSlots(child.branches))
23221
23226
  return true;
23222
23227
  break;
23223
- case 10 /* IF_BRANCH */:
23224
- case 11 /* FOR */:
23228
+ case 10 /* NodeTypes.IF_BRANCH */:
23229
+ case 11 /* NodeTypes.FOR */:
23225
23230
  if (hasForwardedSlots(child.children))
23226
23231
  return true;
23227
23232
  break;
@@ -23230,9 +23235,9 @@ function hasForwardedSlots(children) {
23230
23235
  return false;
23231
23236
  }
23232
23237
  function isNonWhitespaceContent(node) {
23233
- if (node.type !== 2 /* TEXT */ && node.type !== 12 /* TEXT_CALL */)
23238
+ if (node.type !== 2 /* NodeTypes.TEXT */ && node.type !== 12 /* NodeTypes.TEXT_CALL */)
23234
23239
  return true;
23235
- return node.type === 2 /* TEXT */
23240
+ return node.type === 2 /* NodeTypes.TEXT */
23236
23241
  ? !!node.content.trim()
23237
23242
  : isNonWhitespaceContent(node.content);
23238
23243
  }
@@ -23246,13 +23251,13 @@ const transformElement = (node, context) => {
23246
23251
  // processed and merged.
23247
23252
  return function postTransformElement() {
23248
23253
  node = context.currentNode;
23249
- if (!(node.type === 1 /* ELEMENT */ &&
23250
- (node.tagType === 0 /* ELEMENT */ ||
23251
- node.tagType === 1 /* COMPONENT */))) {
23254
+ if (!(node.type === 1 /* NodeTypes.ELEMENT */ &&
23255
+ (node.tagType === 0 /* ElementTypes.ELEMENT */ ||
23256
+ node.tagType === 1 /* ElementTypes.COMPONENT */))) {
23252
23257
  return;
23253
23258
  }
23254
23259
  const { tag, props } = node;
23255
- const isComponent = node.tagType === 1 /* COMPONENT */;
23260
+ const isComponent = node.tagType === 1 /* ElementTypes.COMPONENT */;
23256
23261
  // The goal of the transform is to create a codegenNode implementing the
23257
23262
  // VNodeCall interface.
23258
23263
  let vnodeTag = isComponent
@@ -23303,9 +23308,9 @@ const transformElement = (node, context) => {
23303
23308
  // collected by a parent block.
23304
23309
  shouldUseBlock = true;
23305
23310
  // 2. Force keep-alive to always be updated, since it uses raw children.
23306
- patchFlag |= 1024 /* DYNAMIC_SLOTS */;
23311
+ patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
23307
23312
  if (node.children.length > 1) {
23308
- context.onError(createCompilerError(45 /* X_KEEP_ALIVE_INVALID_CHILDREN */, {
23313
+ context.onError(createCompilerError(45 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */, {
23309
23314
  start: node.children[0].loc.start,
23310
23315
  end: node.children[node.children.length - 1].loc.end,
23311
23316
  source: ''
@@ -23321,22 +23326,22 @@ const transformElement = (node, context) => {
23321
23326
  const { slots, hasDynamicSlots } = buildSlots(node, context);
23322
23327
  vnodeChildren = slots;
23323
23328
  if (hasDynamicSlots) {
23324
- patchFlag |= 1024 /* DYNAMIC_SLOTS */;
23329
+ patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
23325
23330
  }
23326
23331
  }
23327
23332
  else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
23328
23333
  const child = node.children[0];
23329
23334
  const type = child.type;
23330
23335
  // check for dynamic text children
23331
- const hasDynamicTextChild = type === 5 /* INTERPOLATION */ ||
23332
- type === 8 /* COMPOUND_EXPRESSION */;
23336
+ const hasDynamicTextChild = type === 5 /* NodeTypes.INTERPOLATION */ ||
23337
+ type === 8 /* NodeTypes.COMPOUND_EXPRESSION */;
23333
23338
  if (hasDynamicTextChild &&
23334
- getConstantType(child, context) === 0 /* NOT_CONSTANT */) {
23335
- patchFlag |= 1 /* TEXT */;
23339
+ getConstantType(child, context) === 0 /* ConstantTypes.NOT_CONSTANT */) {
23340
+ patchFlag |= 1 /* PatchFlags.TEXT */;
23336
23341
  }
23337
23342
  // pass directly if the only child is a text node
23338
23343
  // (plain / interpolation / expression)
23339
- if (hasDynamicTextChild || type === 2 /* TEXT */) {
23344
+ if (hasDynamicTextChild || type === 2 /* NodeTypes.TEXT */) {
23340
23345
  vnodeChildren = child;
23341
23346
  }
23342
23347
  else {
@@ -23379,7 +23384,7 @@ function resolveComponentType(node, context, ssr = false) {
23379
23384
  if (isProp) {
23380
23385
  if (isExplicitDynamic ||
23381
23386
  (false )) {
23382
- const exp = isProp.type === 6 /* ATTRIBUTE */
23387
+ const exp = isProp.type === 6 /* NodeTypes.ATTRIBUTE */
23383
23388
  ? isProp.value && createSimpleExpression(isProp.value.content, true)
23384
23389
  : isProp.exp;
23385
23390
  if (exp) {
@@ -23388,7 +23393,7 @@ function resolveComponentType(node, context, ssr = false) {
23388
23393
  ]);
23389
23394
  }
23390
23395
  }
23391
- else if (isProp.type === 6 /* ATTRIBUTE */ &&
23396
+ else if (isProp.type === 6 /* NodeTypes.ATTRIBUTE */ &&
23392
23397
  isProp.value.content.startsWith('vue:')) {
23393
23398
  // <button is="vue:xxx">
23394
23399
  // if not <component>, only is value that starts with "vue:" will be
@@ -23462,17 +23467,17 @@ function resolveSetupReference(name, context) {
23462
23467
  return PascalName;
23463
23468
  }
23464
23469
  };
23465
- const fromConst = checkType("setup-const" /* SETUP_CONST */) ||
23466
- checkType("setup-reactive-const" /* SETUP_REACTIVE_CONST */);
23470
+ const fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
23471
+ checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
23467
23472
  if (fromConst) {
23468
23473
  return context.inline
23469
23474
  ? // in inline mode, const setup bindings (e.g. imports) can be used as-is
23470
23475
  fromConst
23471
23476
  : `$setup[${JSON.stringify(fromConst)}]`;
23472
23477
  }
23473
- const fromMaybeRef = checkType("setup-let" /* SETUP_LET */) ||
23474
- checkType("setup-ref" /* SETUP_REF */) ||
23475
- checkType("setup-maybe-ref" /* SETUP_MAYBE_REF */);
23478
+ const fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
23479
+ checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
23480
+ checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
23476
23481
  if (fromMaybeRef) {
23477
23482
  return context.inline
23478
23483
  ? // setup scope bindings that may be refs need to be unrefed
@@ -23514,9 +23519,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
23514
23519
  if (isEventHandler && isReservedProp(name)) {
23515
23520
  hasVnodeHook = true;
23516
23521
  }
23517
- if (value.type === 20 /* JS_CACHE_EXPRESSION */ ||
23518
- ((value.type === 4 /* SIMPLE_EXPRESSION */ ||
23519
- value.type === 8 /* COMPOUND_EXPRESSION */) &&
23522
+ if (value.type === 20 /* NodeTypes.JS_CACHE_EXPRESSION */ ||
23523
+ ((value.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ ||
23524
+ value.type === 8 /* NodeTypes.COMPOUND_EXPRESSION */) &&
23520
23525
  getConstantType(value, context) > 0)) {
23521
23526
  // skip if the prop is a cached handler or has constant value
23522
23527
  return;
@@ -23547,7 +23552,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
23547
23552
  for (let i = 0; i < props.length; i++) {
23548
23553
  // static attribute
23549
23554
  const prop = props[i];
23550
- if (prop.type === 6 /* ATTRIBUTE */) {
23555
+ if (prop.type === 6 /* NodeTypes.ATTRIBUTE */) {
23551
23556
  const { loc, name, value } = prop;
23552
23557
  let isStatic = true;
23553
23558
  if (name === 'ref') {
@@ -23582,7 +23587,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
23582
23587
  // skip v-slot - it is handled by its dedicated transform.
23583
23588
  if (name === 'slot') {
23584
23589
  if (!isComponent) {
23585
- context.onError(createCompilerError(40 /* X_V_SLOT_MISPLACED */, loc));
23590
+ context.onError(createCompilerError(40 /* ErrorCodes.X_V_SLOT_MISPLACED */, loc));
23586
23591
  }
23587
23592
  continue;
23588
23593
  }
@@ -23627,17 +23632,17 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
23627
23632
  else {
23628
23633
  // v-on="obj" -> toHandlers(obj)
23629
23634
  mergeArgs.push({
23630
- type: 14 /* JS_CALL_EXPRESSION */,
23635
+ type: 14 /* NodeTypes.JS_CALL_EXPRESSION */,
23631
23636
  loc,
23632
23637
  callee: context.helper(TO_HANDLERS),
23633
- arguments: [exp]
23638
+ arguments: isComponent ? [exp] : [exp, `true`]
23634
23639
  });
23635
23640
  }
23636
23641
  }
23637
23642
  else {
23638
23643
  context.onError(createCompilerError(isVBind
23639
- ? 34 /* X_V_BIND_NO_EXPRESSION */
23640
- : 35 /* X_V_ON_NO_EXPRESSION */, loc));
23644
+ ? 34 /* ErrorCodes.X_V_BIND_NO_EXPRESSION */
23645
+ : 35 /* ErrorCodes.X_V_ON_NO_EXPRESSION */, loc));
23641
23646
  }
23642
23647
  continue;
23643
23648
  }
@@ -23684,31 +23689,31 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
23684
23689
  }
23685
23690
  // patchFlag analysis
23686
23691
  if (hasDynamicKeys) {
23687
- patchFlag |= 16 /* FULL_PROPS */;
23692
+ patchFlag |= 16 /* PatchFlags.FULL_PROPS */;
23688
23693
  }
23689
23694
  else {
23690
23695
  if (hasClassBinding && !isComponent) {
23691
- patchFlag |= 2 /* CLASS */;
23696
+ patchFlag |= 2 /* PatchFlags.CLASS */;
23692
23697
  }
23693
23698
  if (hasStyleBinding && !isComponent) {
23694
- patchFlag |= 4 /* STYLE */;
23699
+ patchFlag |= 4 /* PatchFlags.STYLE */;
23695
23700
  }
23696
23701
  if (dynamicPropNames.length) {
23697
- patchFlag |= 8 /* PROPS */;
23702
+ patchFlag |= 8 /* PatchFlags.PROPS */;
23698
23703
  }
23699
23704
  if (hasHydrationEventBinding) {
23700
- patchFlag |= 32 /* HYDRATE_EVENTS */;
23705
+ patchFlag |= 32 /* PatchFlags.HYDRATE_EVENTS */;
23701
23706
  }
23702
23707
  }
23703
23708
  if (!shouldUseBlock &&
23704
- (patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
23709
+ (patchFlag === 0 || patchFlag === 32 /* PatchFlags.HYDRATE_EVENTS */) &&
23705
23710
  (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
23706
- patchFlag |= 512 /* NEED_PATCH */;
23711
+ patchFlag |= 512 /* PatchFlags.NEED_PATCH */;
23707
23712
  }
23708
23713
  // pre-normalize props, SSR is skipped for now
23709
23714
  if (!context.inSSR && propsExpression) {
23710
23715
  switch (propsExpression.type) {
23711
- case 15 /* JS_OBJECT_EXPRESSION */:
23716
+ case 15 /* NodeTypes.JS_OBJECT_EXPRESSION */:
23712
23717
  // means that there is no v-bind,
23713
23718
  // but still need to deal with dynamic key binding
23714
23719
  let classKeyIndex = -1;
@@ -23739,11 +23744,11 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
23739
23744
  // the static style is compiled into an object,
23740
23745
  // so use `hasStyleBinding` to ensure that it is a dynamic style binding
23741
23746
  (hasStyleBinding ||
23742
- (styleProp.value.type === 4 /* SIMPLE_EXPRESSION */ &&
23747
+ (styleProp.value.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
23743
23748
  styleProp.value.content.trim()[0] === `[`) ||
23744
23749
  // v-bind:style and style both exist,
23745
23750
  // v-bind:style with static literal object
23746
- styleProp.value.type === 17 /* JS_ARRAY_EXPRESSION */)) {
23751
+ styleProp.value.type === 17 /* NodeTypes.JS_ARRAY_EXPRESSION */)) {
23747
23752
  styleProp.value = createCallExpression(context.helper(NORMALIZE_STYLE), [styleProp.value]);
23748
23753
  }
23749
23754
  }
@@ -23752,7 +23757,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
23752
23757
  propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [propsExpression]);
23753
23758
  }
23754
23759
  break;
23755
- case 14 /* JS_CALL_EXPRESSION */:
23760
+ case 14 /* NodeTypes.JS_CALL_EXPRESSION */:
23756
23761
  // mergeProps call, do nothing
23757
23762
  break;
23758
23763
  default:
@@ -23785,7 +23790,7 @@ function dedupeProperties(properties) {
23785
23790
  for (let i = 0; i < properties.length; i++) {
23786
23791
  const prop = properties[i];
23787
23792
  // dynamic keys are always allowed
23788
- if (prop.key.type === 8 /* COMPOUND_EXPRESSION */ || !prop.key.isStatic) {
23793
+ if (prop.key.type === 8 /* NodeTypes.COMPOUND_EXPRESSION */ || !prop.key.isStatic) {
23789
23794
  deduped.push(prop);
23790
23795
  continue;
23791
23796
  }
@@ -23805,7 +23810,7 @@ function dedupeProperties(properties) {
23805
23810
  return deduped;
23806
23811
  }
23807
23812
  function mergeAsArray(existing, incoming) {
23808
- if (existing.value.type === 17 /* JS_ARRAY_EXPRESSION */) {
23813
+ if (existing.value.type === 17 /* NodeTypes.JS_ARRAY_EXPRESSION */) {
23809
23814
  existing.value.elements.push(incoming.value);
23810
23815
  }
23811
23816
  else {
@@ -23900,7 +23905,7 @@ function processSlotOutlet(node, context) {
23900
23905
  const nonNameProps = [];
23901
23906
  for (let i = 0; i < node.props.length; i++) {
23902
23907
  const p = node.props[i];
23903
- if (p.type === 6 /* ATTRIBUTE */) {
23908
+ if (p.type === 6 /* NodeTypes.ATTRIBUTE */) {
23904
23909
  if (p.value) {
23905
23910
  if (p.name === 'name') {
23906
23911
  slotName = JSON.stringify(p.value.content);
@@ -23928,7 +23933,7 @@ function processSlotOutlet(node, context) {
23928
23933
  const { props, directives } = buildProps(node, context, nonNameProps, false, false);
23929
23934
  slotProps = props;
23930
23935
  if (directives.length) {
23931
- context.onError(createCompilerError(36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
23936
+ context.onError(createCompilerError(36 /* ErrorCodes.X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
23932
23937
  }
23933
23938
  }
23934
23939
  return {
@@ -23941,18 +23946,26 @@ const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*=>|^\s*(async\s+)?functio
23941
23946
  const transformOn = (dir, node, context, augmentor) => {
23942
23947
  const { loc, modifiers, arg } = dir;
23943
23948
  if (!dir.exp && !modifiers.length) {
23944
- context.onError(createCompilerError(35 /* X_V_ON_NO_EXPRESSION */, loc));
23949
+ context.onError(createCompilerError(35 /* ErrorCodes.X_V_ON_NO_EXPRESSION */, loc));
23945
23950
  }
23946
23951
  let eventName;
23947
- if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
23952
+ if (arg.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
23948
23953
  if (arg.isStatic) {
23949
23954
  let rawName = arg.content;
23950
23955
  // TODO deprecate @vnodeXXX usage
23951
23956
  if (rawName.startsWith('vue:')) {
23952
23957
  rawName = `vnode-${rawName.slice(4)}`;
23953
23958
  }
23954
- // for all event listeners, auto convert it to camelCase. See issue #2249
23955
- eventName = createSimpleExpression(toHandlerKey(camelize(rawName)), true, arg.loc);
23959
+ const eventString = node.tagType === 1 /* ElementTypes.COMPONENT */ ||
23960
+ rawName.startsWith('vnode') ||
23961
+ !/[A-Z]/.test(rawName)
23962
+ ? // for component and vnode lifecycle event listeners, auto convert
23963
+ // it to camelCase. See issue #2249
23964
+ toHandlerKey(camelize(rawName))
23965
+ // preserve case for plain element listeners that have uppercase
23966
+ // letters, as these may be custom elements' custom events
23967
+ : `on:${rawName}`;
23968
+ eventName = createSimpleExpression(eventString, true, arg.loc);
23956
23969
  }
23957
23970
  else {
23958
23971
  // #2388
@@ -23992,13 +24005,13 @@ const transformOn = (dir, node, context, augmentor) => {
23992
24005
  !context.inVOnce &&
23993
24006
  // runtime constants don't need to be cached
23994
24007
  // (this is analyzed by compileScript in SFC <script setup>)
23995
- !(exp.type === 4 /* SIMPLE_EXPRESSION */ && exp.constType > 0) &&
24008
+ !(exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ && exp.constType > 0) &&
23996
24009
  // #1541 bail if this is a member exp handler passed to a component -
23997
24010
  // we need to use the original function to preserve arity,
23998
24011
  // e.g. <transition> relies on checking cb.length to determine
23999
24012
  // transition end handling. Inline function is ok since its arity
24000
24013
  // is preserved even when cached.
24001
- !(isMemberExp && node.tagType === 1 /* COMPONENT */) &&
24014
+ !(isMemberExp && node.tagType === 1 /* ElementTypes.COMPONENT */) &&
24002
24015
  // bail if the function references closure variables (v-for, v-slot)
24003
24016
  // it must be passed fresh to avoid stale values.
24004
24017
  !hasScopeRef(exp, context.identifiers);
@@ -24007,7 +24020,7 @@ const transformOn = (dir, node, context, augmentor) => {
24007
24020
  // below) so that it always accesses the latest value when called - thus
24008
24021
  // avoiding the need to be patched.
24009
24022
  if (shouldCache && isMemberExp) {
24010
- if (exp.type === 4 /* SIMPLE_EXPRESSION */) {
24023
+ if (exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
24011
24024
  exp.content = `${exp.content} && ${exp.content}(...args)`;
24012
24025
  }
24013
24026
  else {
@@ -24054,7 +24067,7 @@ const transformOn = (dir, node, context, augmentor) => {
24054
24067
  const transformBind = (dir, _node, context) => {
24055
24068
  const { exp, modifiers, loc } = dir;
24056
24069
  const arg = dir.arg;
24057
- if (arg.type !== 4 /* SIMPLE_EXPRESSION */) {
24070
+ if (arg.type !== 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
24058
24071
  arg.children.unshift(`(`);
24059
24072
  arg.children.push(`) || ""`);
24060
24073
  }
@@ -24063,7 +24076,7 @@ const transformBind = (dir, _node, context) => {
24063
24076
  }
24064
24077
  // .sync is replaced by v-model:arg
24065
24078
  if (modifiers.includes('camel')) {
24066
- if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
24079
+ if (arg.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
24067
24080
  if (arg.isStatic) {
24068
24081
  arg.content = camelize(arg.content);
24069
24082
  }
@@ -24085,8 +24098,8 @@ const transformBind = (dir, _node, context) => {
24085
24098
  }
24086
24099
  }
24087
24100
  if (!exp ||
24088
- (exp.type === 4 /* SIMPLE_EXPRESSION */ && !exp.content.trim())) {
24089
- context.onError(createCompilerError(34 /* X_V_BIND_NO_EXPRESSION */, loc));
24101
+ (exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ && !exp.content.trim())) {
24102
+ context.onError(createCompilerError(34 /* ErrorCodes.X_V_BIND_NO_EXPRESSION */, loc));
24090
24103
  return {
24091
24104
  props: [createObjectProperty(arg, createSimpleExpression('', true, loc))]
24092
24105
  };
@@ -24096,7 +24109,7 @@ const transformBind = (dir, _node, context) => {
24096
24109
  };
24097
24110
  };
24098
24111
  const injectPrefix = (arg, prefix) => {
24099
- if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
24112
+ if (arg.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
24100
24113
  if (arg.isStatic) {
24101
24114
  arg.content = prefix + arg.content;
24102
24115
  }
@@ -24113,10 +24126,10 @@ const injectPrefix = (arg, prefix) => {
24113
24126
  // Merge adjacent text nodes and expressions into a single expression
24114
24127
  // e.g. <div>abc {{ d }} {{ e }}</div> should have a single expression node as child.
24115
24128
  const transformText = (node, context) => {
24116
- if (node.type === 0 /* ROOT */ ||
24117
- node.type === 1 /* ELEMENT */ ||
24118
- node.type === 11 /* FOR */ ||
24119
- node.type === 10 /* IF_BRANCH */) {
24129
+ if (node.type === 0 /* NodeTypes.ROOT */ ||
24130
+ node.type === 1 /* NodeTypes.ELEMENT */ ||
24131
+ node.type === 11 /* NodeTypes.FOR */ ||
24132
+ node.type === 10 /* NodeTypes.IF_BRANCH */) {
24120
24133
  // perform the transform on node exit so that all expressions have already
24121
24134
  // been processed.
24122
24135
  return () => {
@@ -24151,15 +24164,15 @@ const transformText = (node, context) => {
24151
24164
  // setting textContent of the element.
24152
24165
  // for component root it's always normalized anyway.
24153
24166
  (children.length === 1 &&
24154
- (node.type === 0 /* ROOT */ ||
24155
- (node.type === 1 /* ELEMENT */ &&
24156
- node.tagType === 0 /* ELEMENT */ &&
24167
+ (node.type === 0 /* NodeTypes.ROOT */ ||
24168
+ (node.type === 1 /* NodeTypes.ELEMENT */ &&
24169
+ node.tagType === 0 /* ElementTypes.ELEMENT */ &&
24157
24170
  // #3756
24158
24171
  // custom directives can potentially add DOM elements arbitrarily,
24159
24172
  // we need to avoid setting textContent of the element at runtime
24160
24173
  // to avoid accidentally overwriting the DOM elements added
24161
24174
  // by the user through custom directives.
24162
- !node.props.find(p => p.type === 7 /* DIRECTIVE */ &&
24175
+ !node.props.find(p => p.type === 7 /* NodeTypes.DIRECTIVE */ &&
24163
24176
  !context.directiveTransforms[p.name]) &&
24164
24177
  // in compat mode, <template> tags with no special directives
24165
24178
  // will be rendered as a fragment so its children must be
@@ -24171,21 +24184,21 @@ const transformText = (node, context) => {
24171
24184
  // runtime normalization.
24172
24185
  for (let i = 0; i < children.length; i++) {
24173
24186
  const child = children[i];
24174
- if (isText(child) || child.type === 8 /* COMPOUND_EXPRESSION */) {
24187
+ if (isText(child) || child.type === 8 /* NodeTypes.COMPOUND_EXPRESSION */) {
24175
24188
  const callArgs = [];
24176
24189
  // createTextVNode defaults to single whitespace, so if it is a
24177
24190
  // single space the code could be an empty call to save bytes.
24178
- if (child.type !== 2 /* TEXT */ || child.content !== ' ') {
24191
+ if (child.type !== 2 /* NodeTypes.TEXT */ || child.content !== ' ') {
24179
24192
  callArgs.push(child);
24180
24193
  }
24181
24194
  // mark dynamic text with flag so it gets patched inside a block
24182
24195
  if (!context.ssr &&
24183
- getConstantType(child, context) === 0 /* NOT_CONSTANT */) {
24184
- callArgs.push(1 /* TEXT */ +
24185
- (` /* ${PatchFlagNames[1 /* TEXT */]} */` ));
24196
+ getConstantType(child, context) === 0 /* ConstantTypes.NOT_CONSTANT */) {
24197
+ callArgs.push(1 /* PatchFlags.TEXT */ +
24198
+ (` /* ${PatchFlagNames[1 /* PatchFlags.TEXT */]} */` ));
24186
24199
  }
24187
24200
  children[i] = {
24188
- type: 12 /* TEXT_CALL */,
24201
+ type: 12 /* NodeTypes.TEXT_CALL */,
24189
24202
  content: child,
24190
24203
  loc: child.loc,
24191
24204
  codegenNode: createCallExpression(context.helper(CREATE_TEXT), callArgs)
@@ -24198,7 +24211,7 @@ const transformText = (node, context) => {
24198
24211
 
24199
24212
  const seen = new WeakSet();
24200
24213
  const transformOnce = (node, context) => {
24201
- if (node.type === 1 /* ELEMENT */ && findDir(node, 'once', true)) {
24214
+ if (node.type === 1 /* NodeTypes.ELEMENT */ && findDir(node, 'once', true)) {
24202
24215
  if (seen.has(node) || context.inVOnce) {
24203
24216
  return;
24204
24217
  }
@@ -24218,26 +24231,26 @@ const transformOnce = (node, context) => {
24218
24231
  const transformModel = (dir, node, context) => {
24219
24232
  const { exp, arg } = dir;
24220
24233
  if (!exp) {
24221
- context.onError(createCompilerError(41 /* X_V_MODEL_NO_EXPRESSION */, dir.loc));
24234
+ context.onError(createCompilerError(41 /* ErrorCodes.X_V_MODEL_NO_EXPRESSION */, dir.loc));
24222
24235
  return createTransformProps();
24223
24236
  }
24224
24237
  const rawExp = exp.loc.source;
24225
- const expString = exp.type === 4 /* SIMPLE_EXPRESSION */ ? exp.content : rawExp;
24238
+ const expString = exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ ? exp.content : rawExp;
24226
24239
  // im SFC <script setup> inline mode, the exp may have been transformed into
24227
24240
  // _unref(exp)
24228
24241
  const bindingType = context.bindingMetadata[rawExp];
24229
24242
  const maybeRef = context.inline &&
24230
24243
  bindingType &&
24231
- bindingType !== "setup-const" /* SETUP_CONST */;
24244
+ bindingType !== "setup-const" /* BindingTypes.SETUP_CONST */;
24232
24245
  if (!expString.trim() ||
24233
24246
  (!isMemberExpression(expString, context) && !maybeRef)) {
24234
- context.onError(createCompilerError(42 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
24247
+ context.onError(createCompilerError(42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
24235
24248
  return createTransformProps();
24236
24249
  }
24237
24250
  if (context.prefixIdentifiers &&
24238
24251
  isSimpleIdentifier(expString) &&
24239
24252
  context.identifiers[expString]) {
24240
- context.onError(createCompilerError(43 /* X_V_MODEL_ON_SCOPE_VARIABLE */, exp.loc));
24253
+ context.onError(createCompilerError(43 /* ErrorCodes.X_V_MODEL_ON_SCOPE_VARIABLE */, exp.loc));
24241
24254
  return createTransformProps();
24242
24255
  }
24243
24256
  const propName = arg ? arg : createSimpleExpression('modelValue', true);
@@ -24249,7 +24262,7 @@ const transformModel = (dir, node, context) => {
24249
24262
  let assignmentExp;
24250
24263
  const eventArg = context.isTS ? `($event: any)` : `$event`;
24251
24264
  if (maybeRef) {
24252
- if (bindingType === "setup-ref" /* SETUP_REF */) {
24265
+ if (bindingType === "setup-ref" /* BindingTypes.SETUP_REF */) {
24253
24266
  // v-model used on known ref.
24254
24267
  assignmentExp = createCompoundExpression([
24255
24268
  `${eventArg} => ((`,
@@ -24260,7 +24273,7 @@ const transformModel = (dir, node, context) => {
24260
24273
  else {
24261
24274
  // v-model used on a potentially ref binding in <script setup> inline mode.
24262
24275
  // the assignment needs to check whether the binding is actually a ref.
24263
- const altAssignment = bindingType === "setup-let" /* SETUP_LET */ ? `${rawExp} = $event` : `null`;
24276
+ const altAssignment = bindingType === "setup-let" /* BindingTypes.SETUP_LET */ ? `${rawExp} = $event` : `null`;
24264
24277
  assignmentExp = createCompoundExpression([
24265
24278
  `${eventArg} => (${context.helperString(IS_REF)}(${rawExp}) ? (`,
24266
24279
  createSimpleExpression(rawExp, false, exp.loc),
@@ -24289,7 +24302,7 @@ const transformModel = (dir, node, context) => {
24289
24302
  props[1].value = context.cache(props[1].value);
24290
24303
  }
24291
24304
  // modelModifiers: { foo: true, "bar-baz": true }
24292
- if (dir.modifiers.length && node.tagType === 1 /* COMPONENT */) {
24305
+ if (dir.modifiers.length && node.tagType === 1 /* ElementTypes.COMPONENT */) {
24293
24306
  const modifiers = dir.modifiers
24294
24307
  .map(m => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`)
24295
24308
  .join(`, `);
@@ -24298,7 +24311,7 @@ const transformModel = (dir, node, context) => {
24298
24311
  ? `${arg.content}Modifiers`
24299
24312
  : createCompoundExpression([arg, ' + "Modifiers"'])
24300
24313
  : `modelModifiers`;
24301
- props.push(createObjectProperty(modifiersKey, createSimpleExpression(`{ ${modifiers} }`, false, dir.loc, 2 /* CAN_HOIST */)));
24314
+ props.push(createObjectProperty(modifiersKey, createSimpleExpression(`{ ${modifiers} }`, false, dir.loc, 2 /* ConstantTypes.CAN_HOIST */)));
24302
24315
  }
24303
24316
  return createTransformProps(props);
24304
24317
  };
@@ -24308,7 +24321,7 @@ function createTransformProps(props = []) {
24308
24321
 
24309
24322
  const seen$1 = new WeakSet();
24310
24323
  const transformMemo = (node, context) => {
24311
- if (node.type === 1 /* ELEMENT */) {
24324
+ if (node.type === 1 /* NodeTypes.ELEMENT */) {
24312
24325
  const dir = findDir(node, 'memo');
24313
24326
  if (!dir || seen$1.has(node)) {
24314
24327
  return;
@@ -24317,9 +24330,9 @@ const transformMemo = (node, context) => {
24317
24330
  return () => {
24318
24331
  const codegenNode = node.codegenNode ||
24319
24332
  context.currentNode.codegenNode;
24320
- if (codegenNode && codegenNode.type === 13 /* VNODE_CALL */) {
24333
+ if (codegenNode && codegenNode.type === 13 /* NodeTypes.VNODE_CALL */) {
24321
24334
  // non-component sub tree should be turned into a block
24322
- if (node.tagType !== 1 /* COMPONENT */) {
24335
+ if (node.tagType !== 1 /* ElementTypes.COMPONENT */) {
24323
24336
  makeBlock(codegenNode, context);
24324
24337
  }
24325
24338
  node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
@@ -24367,10 +24380,10 @@ function baseCompile(template, options = {}) {
24367
24380
  const isModuleMode = options.mode === 'module';
24368
24381
  const prefixIdentifiers = (options.prefixIdentifiers === true || isModuleMode);
24369
24382
  if (!prefixIdentifiers && options.cacheHandlers) {
24370
- onError(createCompilerError(48 /* X_CACHE_HANDLER_NOT_SUPPORTED */));
24383
+ onError(createCompilerError(48 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */));
24371
24384
  }
24372
24385
  if (options.scopeId && !isModuleMode) {
24373
- onError(createCompilerError(49 /* X_SCOPE_ID_NOT_SUPPORTED */));
24386
+ onError(createCompilerError(49 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */));
24374
24387
  }
24375
24388
  const ast = isString(template) ? baseParse(template, options) : template;
24376
24389
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
@@ -26791,54 +26804,54 @@ const parserOptions = {
26791
26804
  },
26792
26805
  // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
26793
26806
  getNamespace(tag, parent) {
26794
- let ns = parent ? parent.ns : 0 /* HTML */;
26795
- if (parent && ns === 2 /* MATH_ML */) {
26807
+ let ns = parent ? parent.ns : 0 /* DOMNamespaces.HTML */;
26808
+ if (parent && ns === 2 /* DOMNamespaces.MATH_ML */) {
26796
26809
  if (parent.tag === 'annotation-xml') {
26797
26810
  if (tag === 'svg') {
26798
- return 1 /* SVG */;
26811
+ return 1 /* DOMNamespaces.SVG */;
26799
26812
  }
26800
- if (parent.props.some(a => a.type === 6 /* ATTRIBUTE */ &&
26813
+ if (parent.props.some(a => a.type === 6 /* NodeTypes.ATTRIBUTE */ &&
26801
26814
  a.name === 'encoding' &&
26802
26815
  a.value != null &&
26803
26816
  (a.value.content === 'text/html' ||
26804
26817
  a.value.content === 'application/xhtml+xml'))) {
26805
- ns = 0 /* HTML */;
26818
+ ns = 0 /* DOMNamespaces.HTML */;
26806
26819
  }
26807
26820
  }
26808
26821
  else if (/^m(?:[ions]|text)$/.test(parent.tag) &&
26809
26822
  tag !== 'mglyph' &&
26810
26823
  tag !== 'malignmark') {
26811
- ns = 0 /* HTML */;
26824
+ ns = 0 /* DOMNamespaces.HTML */;
26812
26825
  }
26813
26826
  }
26814
- else if (parent && ns === 1 /* SVG */) {
26827
+ else if (parent && ns === 1 /* DOMNamespaces.SVG */) {
26815
26828
  if (parent.tag === 'foreignObject' ||
26816
26829
  parent.tag === 'desc' ||
26817
26830
  parent.tag === 'title') {
26818
- ns = 0 /* HTML */;
26831
+ ns = 0 /* DOMNamespaces.HTML */;
26819
26832
  }
26820
26833
  }
26821
- if (ns === 0 /* HTML */) {
26834
+ if (ns === 0 /* DOMNamespaces.HTML */) {
26822
26835
  if (tag === 'svg') {
26823
- return 1 /* SVG */;
26836
+ return 1 /* DOMNamespaces.SVG */;
26824
26837
  }
26825
26838
  if (tag === 'math') {
26826
- return 2 /* MATH_ML */;
26839
+ return 2 /* DOMNamespaces.MATH_ML */;
26827
26840
  }
26828
26841
  }
26829
26842
  return ns;
26830
26843
  },
26831
26844
  // https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
26832
26845
  getTextMode({ tag, ns }) {
26833
- if (ns === 0 /* HTML */) {
26846
+ if (ns === 0 /* DOMNamespaces.HTML */) {
26834
26847
  if (tag === 'textarea' || tag === 'title') {
26835
- return 1 /* RCDATA */;
26848
+ return 1 /* TextModes.RCDATA */;
26836
26849
  }
26837
26850
  if (isRawTextContainer(tag)) {
26838
- return 2 /* RAWTEXT */;
26851
+ return 2 /* TextModes.RAWTEXT */;
26839
26852
  }
26840
26853
  }
26841
- return 0 /* DATA */;
26854
+ return 0 /* TextModes.DATA */;
26842
26855
  }
26843
26856
  };
26844
26857
 
@@ -26849,12 +26862,12 @@ const parserOptions = {
26849
26862
  // It is then processed by `transformElement` and included in the generated
26850
26863
  // props.
26851
26864
  const transformStyle = node => {
26852
- if (node.type === 1 /* ELEMENT */) {
26865
+ if (node.type === 1 /* NodeTypes.ELEMENT */) {
26853
26866
  node.props.forEach((p, i) => {
26854
- if (p.type === 6 /* ATTRIBUTE */ && p.name === 'style' && p.value) {
26867
+ if (p.type === 6 /* NodeTypes.ATTRIBUTE */ && p.name === 'style' && p.value) {
26855
26868
  // replace p with an expression node
26856
26869
  node.props[i] = {
26857
- type: 7 /* DIRECTIVE */,
26870
+ type: 7 /* NodeTypes.DIRECTIVE */,
26858
26871
  name: `bind`,
26859
26872
  arg: createSimpleExpression(`style`, true, p.loc),
26860
26873
  exp: parseInlineCSS(p.value.content, p.loc),
@@ -26867,33 +26880,33 @@ const transformStyle = node => {
26867
26880
  };
26868
26881
  const parseInlineCSS = (cssText, loc) => {
26869
26882
  const normalized = parseStringStyle(cssText);
26870
- return createSimpleExpression(JSON.stringify(normalized), false, loc, 3 /* CAN_STRINGIFY */);
26883
+ return createSimpleExpression(JSON.stringify(normalized), false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
26871
26884
  };
26872
26885
 
26873
26886
  function createDOMCompilerError(code, loc) {
26874
26887
  return createCompilerError(code, loc, DOMErrorMessages );
26875
26888
  }
26876
26889
  const DOMErrorMessages = {
26877
- [50 /* X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
26878
- [51 /* X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
26879
- [52 /* X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
26880
- [53 /* X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
26881
- [54 /* X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
26882
- [55 /* X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
26883
- [56 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
26884
- [57 /* X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
26885
- [58 /* X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
26886
- [59 /* X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
26887
- [60 /* X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
26890
+ [50 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
26891
+ [51 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
26892
+ [52 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
26893
+ [53 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
26894
+ [54 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
26895
+ [55 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
26896
+ [56 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
26897
+ [57 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
26898
+ [58 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
26899
+ [59 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
26900
+ [60 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
26888
26901
  };
26889
26902
 
26890
26903
  const transformVHtml = (dir, node, context) => {
26891
26904
  const { exp, loc } = dir;
26892
26905
  if (!exp) {
26893
- context.onError(createDOMCompilerError(50 /* X_V_HTML_NO_EXPRESSION */, loc));
26906
+ context.onError(createDOMCompilerError(50 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */, loc));
26894
26907
  }
26895
26908
  if (node.children.length) {
26896
- context.onError(createDOMCompilerError(51 /* X_V_HTML_WITH_CHILDREN */, loc));
26909
+ context.onError(createDOMCompilerError(51 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */, loc));
26897
26910
  node.children.length = 0;
26898
26911
  }
26899
26912
  return {
@@ -26906,10 +26919,10 @@ const transformVHtml = (dir, node, context) => {
26906
26919
  const transformVText = (dir, node, context) => {
26907
26920
  const { exp, loc } = dir;
26908
26921
  if (!exp) {
26909
- context.onError(createDOMCompilerError(52 /* X_V_TEXT_NO_EXPRESSION */, loc));
26922
+ context.onError(createDOMCompilerError(52 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */, loc));
26910
26923
  }
26911
26924
  if (node.children.length) {
26912
- context.onError(createDOMCompilerError(53 /* X_V_TEXT_WITH_CHILDREN */, loc));
26925
+ context.onError(createDOMCompilerError(53 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */, loc));
26913
26926
  node.children.length = 0;
26914
26927
  }
26915
26928
  return {
@@ -26926,16 +26939,16 @@ const transformVText = (dir, node, context) => {
26926
26939
  const transformModel$1 = (dir, node, context) => {
26927
26940
  const baseResult = transformModel(dir, node, context);
26928
26941
  // base transform has errors OR component v-model (only need props)
26929
- if (!baseResult.props.length || node.tagType === 1 /* COMPONENT */) {
26942
+ if (!baseResult.props.length || node.tagType === 1 /* ElementTypes.COMPONENT */) {
26930
26943
  return baseResult;
26931
26944
  }
26932
26945
  if (dir.arg) {
26933
- context.onError(createDOMCompilerError(55 /* X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
26946
+ context.onError(createDOMCompilerError(55 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
26934
26947
  }
26935
26948
  function checkDuplicatedValue() {
26936
26949
  const value = findProp(node, 'value');
26937
26950
  if (value) {
26938
- context.onError(createDOMCompilerError(57 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
26951
+ context.onError(createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
26939
26952
  }
26940
26953
  }
26941
26954
  const { tag } = node;
@@ -26949,7 +26962,7 @@ const transformModel$1 = (dir, node, context) => {
26949
26962
  if (tag === 'input' || isCustomElement) {
26950
26963
  const type = findProp(node, `type`);
26951
26964
  if (type) {
26952
- if (type.type === 7 /* DIRECTIVE */) {
26965
+ if (type.type === 7 /* NodeTypes.DIRECTIVE */) {
26953
26966
  // :type="foo"
26954
26967
  directiveToUse = V_MODEL_DYNAMIC;
26955
26968
  }
@@ -26963,7 +26976,7 @@ const transformModel$1 = (dir, node, context) => {
26963
26976
  break;
26964
26977
  case 'file':
26965
26978
  isInvalidType = true;
26966
- context.onError(createDOMCompilerError(56 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
26979
+ context.onError(createDOMCompilerError(56 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
26967
26980
  break;
26968
26981
  default:
26969
26982
  // text type
@@ -26997,11 +27010,11 @@ const transformModel$1 = (dir, node, context) => {
26997
27010
  }
26998
27011
  }
26999
27012
  else {
27000
- context.onError(createDOMCompilerError(54 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
27013
+ context.onError(createDOMCompilerError(54 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
27001
27014
  }
27002
27015
  // native vmodel doesn't need the `modelValue` props since they are also
27003
27016
  // passed to the runtime as `binding.value`. removing it reduces code size.
27004
- baseResult.props = baseResult.props.filter(p => !(p.key.type === 4 /* SIMPLE_EXPRESSION */ &&
27017
+ baseResult.props = baseResult.props.filter(p => !(p.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
27005
27018
  p.key.content === 'modelValue'));
27006
27019
  return baseResult;
27007
27020
  };
@@ -27064,7 +27077,7 @@ const transformClick = (key, event) => {
27064
27077
  const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === 'onclick';
27065
27078
  return isStaticClick
27066
27079
  ? createSimpleExpression(event, true)
27067
- : key.type !== 4 /* SIMPLE_EXPRESSION */
27080
+ : key.type !== 4 /* NodeTypes.SIMPLE_EXPRESSION */
27068
27081
  ? createCompoundExpression([
27069
27082
  `(`,
27070
27083
  key,
@@ -27117,7 +27130,7 @@ const transformOn$1 = (dir, node, context) => {
27117
27130
  const transformShow = (dir, node, context) => {
27118
27131
  const { exp, loc } = dir;
27119
27132
  if (!exp) {
27120
- context.onError(createDOMCompilerError(58 /* X_V_SHOW_NO_EXPRESSION */, loc));
27133
+ context.onError(createDOMCompilerError(58 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */, loc));
27121
27134
  }
27122
27135
  return {
27123
27136
  props: [],
@@ -27126,8 +27139,8 @@ const transformShow = (dir, node, context) => {
27126
27139
  };
27127
27140
 
27128
27141
  const transformTransition = (node, context) => {
27129
- if (node.type === 1 /* ELEMENT */ &&
27130
- node.tagType === 1 /* COMPONENT */) {
27142
+ if (node.type === 1 /* NodeTypes.ELEMENT */ &&
27143
+ node.tagType === 1 /* ElementTypes.COMPONENT */) {
27131
27144
  const component = context.isBuiltInComponent(node.tag);
27132
27145
  if (component === TRANSITION) {
27133
27146
  return () => {
@@ -27136,7 +27149,7 @@ const transformTransition = (node, context) => {
27136
27149
  }
27137
27150
  // warn multiple transition children
27138
27151
  if (hasMultipleChildren(node)) {
27139
- context.onError(createDOMCompilerError(59 /* X_TRANSITION_INVALID_CHILDREN */, {
27152
+ context.onError(createDOMCompilerError(59 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */, {
27140
27153
  start: node.children[0].loc.start,
27141
27154
  end: node.children[node.children.length - 1].loc.end,
27142
27155
  source: ''
@@ -27145,11 +27158,11 @@ const transformTransition = (node, context) => {
27145
27158
  // check if it's s single child w/ v-show
27146
27159
  // if yes, inject "persisted: true" to the transition props
27147
27160
  const child = node.children[0];
27148
- if (child.type === 1 /* ELEMENT */) {
27161
+ if (child.type === 1 /* NodeTypes.ELEMENT */) {
27149
27162
  for (const p of child.props) {
27150
- if (p.type === 7 /* DIRECTIVE */ && p.name === 'show') {
27163
+ if (p.type === 7 /* NodeTypes.DIRECTIVE */ && p.name === 'show') {
27151
27164
  node.props.push({
27152
- type: 6 /* ATTRIBUTE */,
27165
+ type: 6 /* NodeTypes.ATTRIBUTE */,
27153
27166
  name: 'persisted',
27154
27167
  value: undefined,
27155
27168
  loc: node.loc
@@ -27163,12 +27176,12 @@ const transformTransition = (node, context) => {
27163
27176
  };
27164
27177
  function hasMultipleChildren(node) {
27165
27178
  // #1352 filter out potential comment nodes.
27166
- const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */ &&
27167
- !(c.type === 2 /* TEXT */ && !c.content.trim())));
27179
+ const children = (node.children = node.children.filter(c => c.type !== 3 /* NodeTypes.COMMENT */ &&
27180
+ !(c.type === 2 /* NodeTypes.TEXT */ && !c.content.trim())));
27168
27181
  const child = children[0];
27169
27182
  return (children.length !== 1 ||
27170
- child.type === 11 /* FOR */ ||
27171
- (child.type === 9 /* IF */ && child.branches.some(hasMultipleChildren)));
27183
+ child.type === 11 /* NodeTypes.FOR */ ||
27184
+ (child.type === 9 /* NodeTypes.IF */ && child.branches.some(hasMultipleChildren)));
27172
27185
  }
27173
27186
 
27174
27187
  /**
@@ -27211,8 +27224,8 @@ const stringifyStatic = (children, context, parent) => {
27211
27224
  let ec = 0; // current element with binding count
27212
27225
  const currentChunk = [];
27213
27226
  const stringifyCurrentChunk = (currentIndex) => {
27214
- if (nc >= 20 /* NODE_COUNT */ ||
27215
- ec >= 5 /* ELEMENT_WITH_BINDING_COUNT */) {
27227
+ if (nc >= 20 /* StringifyThresholds.NODE_COUNT */ ||
27228
+ ec >= 5 /* StringifyThresholds.ELEMENT_WITH_BINDING_COUNT */) {
27216
27229
  // combine all currently eligible nodes into a single static vnode call
27217
27230
  const staticCall = createCallExpression(context.helper(CREATE_STATIC), [
27218
27231
  JSON.stringify(currentChunk.map(node => stringifyNode(node, context)).join('')).replace(expReplaceRE, `" + $1 + "`),
@@ -27263,16 +27276,16 @@ const stringifyStatic = (children, context, parent) => {
27263
27276
  // in case the last node was also stringifiable
27264
27277
  stringifyCurrentChunk(i);
27265
27278
  };
27266
- const getHoistedNode = (node) => ((node.type === 1 /* ELEMENT */ && node.tagType === 0 /* ELEMENT */) ||
27267
- node.type == 12 /* TEXT_CALL */) &&
27279
+ const getHoistedNode = (node) => ((node.type === 1 /* NodeTypes.ELEMENT */ && node.tagType === 0 /* ElementTypes.ELEMENT */) ||
27280
+ node.type == 12 /* NodeTypes.TEXT_CALL */) &&
27268
27281
  node.codegenNode &&
27269
- node.codegenNode.type === 4 /* SIMPLE_EXPRESSION */ &&
27282
+ node.codegenNode.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
27270
27283
  node.codegenNode.hoisted;
27271
27284
  const dataAriaRE = /^(data|aria)-/;
27272
27285
  const isStringifiableAttr = (name, ns) => {
27273
- return ((ns === 0 /* HTML */
27286
+ return ((ns === 0 /* DOMNamespaces.HTML */
27274
27287
  ? isKnownHtmlAttr(name)
27275
- : ns === 1 /* SVG */
27288
+ : ns === 1 /* DOMNamespaces.SVG */
27276
27289
  ? isKnownSvgAttr(name)
27277
27290
  : false) || dataAriaRE.test(name));
27278
27291
  };
@@ -27289,10 +27302,10 @@ const isNonStringifiable = /*#__PURE__*/ makeMap(`caption,thead,tr,th,tbody,td,t
27289
27302
  * - ec is the number of element with bindings inside
27290
27303
  */
27291
27304
  function analyzeNode(node) {
27292
- if (node.type === 1 /* ELEMENT */ && isNonStringifiable(node.tag)) {
27305
+ if (node.type === 1 /* NodeTypes.ELEMENT */ && isNonStringifiable(node.tag)) {
27293
27306
  return false;
27294
27307
  }
27295
- if (node.type === 12 /* TEXT_CALL */) {
27308
+ if (node.type === 12 /* NodeTypes.TEXT_CALL */) {
27296
27309
  return [1, 0];
27297
27310
  }
27298
27311
  let nc = 1; // node count
@@ -27310,20 +27323,20 @@ function analyzeNode(node) {
27310
27323
  for (let i = 0; i < node.props.length; i++) {
27311
27324
  const p = node.props[i];
27312
27325
  // bail on non-attr bindings
27313
- if (p.type === 6 /* ATTRIBUTE */ &&
27326
+ if (p.type === 6 /* NodeTypes.ATTRIBUTE */ &&
27314
27327
  !isStringifiableAttr(p.name, node.ns)) {
27315
27328
  return bail();
27316
27329
  }
27317
- if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind') {
27330
+ if (p.type === 7 /* NodeTypes.DIRECTIVE */ && p.name === 'bind') {
27318
27331
  // bail on non-attr bindings
27319
27332
  if (p.arg &&
27320
- (p.arg.type === 8 /* COMPOUND_EXPRESSION */ ||
27333
+ (p.arg.type === 8 /* NodeTypes.COMPOUND_EXPRESSION */ ||
27321
27334
  (p.arg.isStatic && !isStringifiableAttr(p.arg.content, node.ns)))) {
27322
27335
  return bail();
27323
27336
  }
27324
27337
  if (p.exp &&
27325
- (p.exp.type === 8 /* COMPOUND_EXPRESSION */ ||
27326
- p.exp.constType < 3 /* CAN_STRINGIFY */)) {
27338
+ (p.exp.type === 8 /* NodeTypes.COMPOUND_EXPRESSION */ ||
27339
+ p.exp.constType < 3 /* ConstantTypes.CAN_STRINGIFY */)) {
27327
27340
  return bail();
27328
27341
  }
27329
27342
  }
@@ -27331,7 +27344,7 @@ function analyzeNode(node) {
27331
27344
  for (let i = 0; i < node.children.length; i++) {
27332
27345
  nc++;
27333
27346
  const child = node.children[i];
27334
- if (child.type === 1 /* ELEMENT */) {
27347
+ if (child.type === 1 /* NodeTypes.ELEMENT */) {
27335
27348
  if (child.props.length > 0) {
27336
27349
  ec++;
27337
27350
  }
@@ -27353,17 +27366,17 @@ function stringifyNode(node, context) {
27353
27366
  return ``;
27354
27367
  }
27355
27368
  switch (node.type) {
27356
- case 1 /* ELEMENT */:
27369
+ case 1 /* NodeTypes.ELEMENT */:
27357
27370
  return stringifyElement(node, context);
27358
- case 2 /* TEXT */:
27371
+ case 2 /* NodeTypes.TEXT */:
27359
27372
  return escapeHtml(node.content);
27360
- case 3 /* COMMENT */:
27373
+ case 3 /* NodeTypes.COMMENT */:
27361
27374
  return `<!--${escapeHtml(node.content)}-->`;
27362
- case 5 /* INTERPOLATION */:
27375
+ case 5 /* NodeTypes.INTERPOLATION */:
27363
27376
  return escapeHtml(toDisplayString(evaluateConstant(node.content)));
27364
- case 8 /* COMPOUND_EXPRESSION */:
27377
+ case 8 /* NodeTypes.COMPOUND_EXPRESSION */:
27365
27378
  return escapeHtml(evaluateConstant(node));
27366
- case 12 /* TEXT_CALL */:
27379
+ case 12 /* NodeTypes.TEXT_CALL */:
27367
27380
  return stringifyNode(node.content, context);
27368
27381
  default:
27369
27382
  // static trees will not contain if/for nodes
@@ -27375,13 +27388,13 @@ function stringifyElement(node, context) {
27375
27388
  let innerHTML = '';
27376
27389
  for (let i = 0; i < node.props.length; i++) {
27377
27390
  const p = node.props[i];
27378
- if (p.type === 6 /* ATTRIBUTE */) {
27391
+ if (p.type === 6 /* NodeTypes.ATTRIBUTE */) {
27379
27392
  res += ` ${p.name}`;
27380
27393
  if (p.value) {
27381
27394
  res += `="${escapeHtml(p.value.content)}"`;
27382
27395
  }
27383
27396
  }
27384
- else if (p.type === 7 /* DIRECTIVE */) {
27397
+ else if (p.type === 7 /* NodeTypes.DIRECTIVE */) {
27385
27398
  if (p.name === 'bind') {
27386
27399
  const exp = p.exp;
27387
27400
  if (exp.content[0] === '_') {
@@ -27438,7 +27451,7 @@ function stringifyElement(node, context) {
27438
27451
  // run JSFuck in here. But we mark it unsafe for security review purposes.
27439
27452
  // (see compiler-core/src/transforms/transformExpression)
27440
27453
  function evaluateConstant(exp) {
27441
- if (exp.type === 4 /* SIMPLE_EXPRESSION */) {
27454
+ if (exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
27442
27455
  return new Function(`return ${exp.content}`)();
27443
27456
  }
27444
27457
  else {
@@ -27448,10 +27461,10 @@ function evaluateConstant(exp) {
27448
27461
  if (isString(c) || isSymbol(c)) {
27449
27462
  return;
27450
27463
  }
27451
- if (c.type === 2 /* TEXT */) {
27464
+ if (c.type === 2 /* NodeTypes.TEXT */) {
27452
27465
  res += c.content;
27453
27466
  }
27454
- else if (c.type === 5 /* INTERPOLATION */) {
27467
+ else if (c.type === 5 /* NodeTypes.INTERPOLATION */) {
27455
27468
  res += toDisplayString(evaluateConstant(c.content));
27456
27469
  }
27457
27470
  else {
@@ -27463,10 +27476,10 @@ function evaluateConstant(exp) {
27463
27476
  }
27464
27477
 
27465
27478
  const ignoreSideEffectTags = (node, context) => {
27466
- if (node.type === 1 /* ELEMENT */ &&
27467
- node.tagType === 0 /* ELEMENT */ &&
27479
+ if (node.type === 1 /* NodeTypes.ELEMENT */ &&
27480
+ node.tagType === 0 /* ElementTypes.ELEMENT */ &&
27468
27481
  (node.tag === 'script' || node.tag === 'style')) {
27469
- context.onError(createDOMCompilerError(60 /* X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
27482
+ context.onError(createDOMCompilerError(60 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
27470
27483
  context.removeNode();
27471
27484
  }
27472
27485
  };
@@ -27716,8 +27729,6 @@ function sum (o) {
27716
27729
  var hashSum = sum;
27717
27730
 
27718
27731
  const CSS_VARS_HELPER = `useCssVars`;
27719
- // match v-bind() with max 2-levels of nested parens.
27720
- const cssVarRE = /v-bind\s*\(((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*)\)/g;
27721
27732
  function genCssVarsFromList(vars, id, isProd, isSSR = false) {
27722
27733
  return `{\n ${vars
27723
27734
  .map(key => `"${isSSR ? `--` : ``}${genVarName(id, key, isProd)}": (${key})`)
@@ -27739,31 +27750,89 @@ function normalizeExpression(exp) {
27739
27750
  }
27740
27751
  return exp;
27741
27752
  }
27753
+ const vBindRE = /v-bind\s*\(/g;
27742
27754
  function parseCssVars(sfc) {
27743
27755
  const vars = [];
27744
27756
  sfc.styles.forEach(style => {
27745
27757
  let match;
27746
27758
  // ignore v-bind() in comments /* ... */
27747
27759
  const content = style.content.replace(/\/\*([\s\S]*?)\*\//g, '');
27748
- while ((match = cssVarRE.exec(content))) {
27749
- const variable = normalizeExpression(match[1]);
27750
- if (!vars.includes(variable)) {
27751
- vars.push(variable);
27760
+ while ((match = vBindRE.exec(content))) {
27761
+ const start = match.index + match[0].length;
27762
+ const end = lexBinding(content, start);
27763
+ if (end !== null) {
27764
+ const variable = normalizeExpression(content.slice(start, end));
27765
+ if (!vars.includes(variable)) {
27766
+ vars.push(variable);
27767
+ }
27752
27768
  }
27753
27769
  }
27754
27770
  });
27755
27771
  return vars;
27756
27772
  }
27773
+ function lexBinding(content, start) {
27774
+ let state = 0 /* LexerState.inParens */;
27775
+ let parenDepth = 0;
27776
+ for (let i = start; i < content.length; i++) {
27777
+ const char = content.charAt(i);
27778
+ switch (state) {
27779
+ case 0 /* LexerState.inParens */:
27780
+ if (char === `'`) {
27781
+ state = 1 /* LexerState.inSingleQuoteString */;
27782
+ }
27783
+ else if (char === `"`) {
27784
+ state = 2 /* LexerState.inDoubleQuoteString */;
27785
+ }
27786
+ else if (char === `(`) {
27787
+ parenDepth++;
27788
+ }
27789
+ else if (char === `)`) {
27790
+ if (parenDepth > 0) {
27791
+ parenDepth--;
27792
+ }
27793
+ else {
27794
+ return i;
27795
+ }
27796
+ }
27797
+ break;
27798
+ case 1 /* LexerState.inSingleQuoteString */:
27799
+ if (char === `'`) {
27800
+ state = 0 /* LexerState.inParens */;
27801
+ }
27802
+ break;
27803
+ case 2 /* LexerState.inDoubleQuoteString */:
27804
+ if (char === `"`) {
27805
+ state = 0 /* LexerState.inParens */;
27806
+ }
27807
+ break;
27808
+ }
27809
+ }
27810
+ return null;
27811
+ }
27757
27812
  const cssVarsPlugin = opts => {
27758
27813
  const { id, isProd } = opts;
27759
27814
  return {
27760
27815
  postcssPlugin: 'vue-sfc-vars',
27761
27816
  Declaration(decl) {
27762
27817
  // rewrite CSS variables
27763
- if (cssVarRE.test(decl.value)) {
27764
- decl.value = decl.value.replace(cssVarRE, (_, $1) => {
27765
- return `var(--${genVarName(id, normalizeExpression($1), isProd)})`;
27766
- });
27818
+ const value = decl.value;
27819
+ if (vBindRE.test(value)) {
27820
+ vBindRE.lastIndex = 0;
27821
+ let transformed = '';
27822
+ let lastIndex = 0;
27823
+ let match;
27824
+ while ((match = vBindRE.exec(value))) {
27825
+ const start = match.index + match[0].length;
27826
+ const end = lexBinding(value, start);
27827
+ if (end !== null) {
27828
+ const variable = normalizeExpression(value.slice(start, end));
27829
+ transformed +=
27830
+ value.slice(lastIndex, match.index) +
27831
+ `var(--${genVarName(id, variable, isProd)})`;
27832
+ lastIndex = end + 1;
27833
+ }
27834
+ }
27835
+ decl.value = transformed + value.slice(lastIndex);
27767
27836
  }
27768
27837
  }
27769
27838
  };
@@ -27778,7 +27847,7 @@ function genCssVarsCode(vars, bindings, id, isProd) {
27778
27847
  bindingMetadata: bindings.__isScriptSetup === false ? undefined : bindings
27779
27848
  });
27780
27849
  const transformed = processExpression(exp, context);
27781
- const transformedString = transformed.type === 4 /* SIMPLE_EXPRESSION */
27850
+ const transformedString = transformed.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */
27782
27851
  ? transformed.content
27783
27852
  : transformed.children
27784
27853
  .map(c => {
@@ -33146,7 +33215,7 @@ const createAssetUrlTransformWithOptions = (options) => {
33146
33215
  * ```
33147
33216
  */
33148
33217
  const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
33149
- if (node.type === 1 /* ELEMENT */) {
33218
+ if (node.type === 1 /* NodeTypes.ELEMENT */) {
33150
33219
  if (!node.props.length) {
33151
33220
  return;
33152
33221
  }
@@ -33158,7 +33227,7 @@ const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
33158
33227
  }
33159
33228
  const assetAttrs = (attrs || []).concat(wildCardAttrs || []);
33160
33229
  node.props.forEach((attr, index) => {
33161
- if (attr.type !== 6 /* ATTRIBUTE */ ||
33230
+ if (attr.type !== 6 /* NodeTypes.ATTRIBUTE */ ||
33162
33231
  !assetAttrs.includes(attr.name) ||
33163
33232
  !attr.value ||
33164
33233
  isExternalUrl(attr.value.content) ||
@@ -33188,7 +33257,7 @@ const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
33188
33257
  // absolute url (e.g. webpack file-loader)
33189
33258
  const exp = getImportsExpressionExp(url.path, url.hash, attr.loc, context);
33190
33259
  node.props[index] = {
33191
- type: 7 /* DIRECTIVE */,
33260
+ type: 7 /* NodeTypes.DIRECTIVE */,
33192
33261
  name: 'bind',
33193
33262
  arg: createSimpleExpression(attr.name, true, attr.loc),
33194
33263
  exp,
@@ -33209,30 +33278,30 @@ function getImportsExpressionExp(path, hash, loc, context) {
33209
33278
  }
33210
33279
  else {
33211
33280
  name = `_imports_${context.imports.length}`;
33212
- exp = createSimpleExpression(name, false, loc, 3 /* CAN_STRINGIFY */);
33281
+ exp = createSimpleExpression(name, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
33213
33282
  context.imports.push({ exp, path });
33214
33283
  }
33215
33284
  if (!hash) {
33216
33285
  return exp;
33217
33286
  }
33218
33287
  const hashExp = `${name} + '${hash}'`;
33219
- const finalExp = createSimpleExpression(hashExp, false, loc, 3 /* CAN_STRINGIFY */);
33288
+ const finalExp = createSimpleExpression(hashExp, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
33220
33289
  if (!context.hoistStatic) {
33221
33290
  return finalExp;
33222
33291
  }
33223
33292
  const existingHoistIndex = context.hoists.findIndex(h => {
33224
33293
  return (h &&
33225
- h.type === 4 /* SIMPLE_EXPRESSION */ &&
33294
+ h.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
33226
33295
  !h.isStatic &&
33227
33296
  h.content === hashExp);
33228
33297
  });
33229
33298
  if (existingHoistIndex > -1) {
33230
- return createSimpleExpression(`_hoisted_${existingHoistIndex + 1}`, false, loc, 3 /* CAN_STRINGIFY */);
33299
+ return createSimpleExpression(`_hoisted_${existingHoistIndex + 1}`, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
33231
33300
  }
33232
33301
  return context.hoist(finalExp);
33233
33302
  }
33234
33303
  else {
33235
- return createSimpleExpression(`''`, false, loc, 3 /* CAN_STRINGIFY */);
33304
+ return createSimpleExpression(`''`, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
33236
33305
  }
33237
33306
  }
33238
33307
 
@@ -33243,10 +33312,10 @@ const createSrcsetTransformWithOptions = (options) => {
33243
33312
  return (node, context) => transformSrcset(node, context, options);
33244
33313
  };
33245
33314
  const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
33246
- if (node.type === 1 /* ELEMENT */) {
33315
+ if (node.type === 1 /* NodeTypes.ELEMENT */) {
33247
33316
  if (srcsetTags.includes(node.tag) && node.props.length) {
33248
33317
  node.props.forEach((attr, index) => {
33249
- if (attr.name === 'srcset' && attr.type === 6 /* ATTRIBUTE */) {
33318
+ if (attr.name === 'srcset' && attr.type === 6 /* NodeTypes.ATTRIBUTE */) {
33250
33319
  if (!attr.value)
33251
33320
  return;
33252
33321
  const value = attr.value.content;
@@ -33311,17 +33380,17 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
33311
33380
  if (path) {
33312
33381
  const existingImportsIndex = context.imports.findIndex(i => i.path === path);
33313
33382
  if (existingImportsIndex > -1) {
33314
- exp = createSimpleExpression(`_imports_${existingImportsIndex}`, false, attr.loc, 3 /* CAN_STRINGIFY */);
33383
+ exp = createSimpleExpression(`_imports_${existingImportsIndex}`, false, attr.loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
33315
33384
  }
33316
33385
  else {
33317
- exp = createSimpleExpression(`_imports_${context.imports.length}`, false, attr.loc, 3 /* CAN_STRINGIFY */);
33386
+ exp = createSimpleExpression(`_imports_${context.imports.length}`, false, attr.loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
33318
33387
  context.imports.push({ exp, path });
33319
33388
  }
33320
33389
  compoundExpression.children.push(exp);
33321
33390
  }
33322
33391
  }
33323
33392
  else {
33324
- const exp = createSimpleExpression(`"${url}"`, false, attr.loc, 3 /* CAN_STRINGIFY */);
33393
+ const exp = createSimpleExpression(`"${url}"`, false, attr.loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
33325
33394
  compoundExpression.children.push(exp);
33326
33395
  }
33327
33396
  const isNotLast = imageCandidates.length - 1 > index;
@@ -33338,10 +33407,10 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
33338
33407
  let exp = compoundExpression;
33339
33408
  if (context.hoistStatic) {
33340
33409
  exp = context.hoist(compoundExpression);
33341
- exp.constType = 3 /* CAN_STRINGIFY */;
33410
+ exp.constType = 3 /* ConstantTypes.CAN_STRINGIFY */;
33342
33411
  }
33343
33412
  node.props[index] = {
33344
- type: 7 /* DIRECTIVE */,
33413
+ type: 7 /* NodeTypes.DIRECTIVE */,
33345
33414
  name: 'bind',
33346
33415
  arg: createSimpleExpression('srcset', true, attr.loc),
33347
33416
  exp,
@@ -33428,9 +33497,9 @@ function ssrProcessIf(node, context, disableNestedFragments = false) {
33428
33497
  function processIfBranch(branch, context, disableNestedFragments = false) {
33429
33498
  const { children } = branch;
33430
33499
  const needFragmentWrapper = !disableNestedFragments &&
33431
- (children.length !== 1 || children[0].type !== 1 /* ELEMENT */) &&
33500
+ (children.length !== 1 || children[0].type !== 1 /* NodeTypes.ELEMENT */) &&
33432
33501
  // optimize away nested fragments when the only child is a ForNode
33433
- !(children.length === 1 && children[0].type === 11 /* FOR */);
33502
+ !(children.length === 1 && children[0].type === 11 /* NodeTypes.FOR */);
33434
33503
  return processChildrenAsStatement(branch, context, needFragmentWrapper);
33435
33504
  }
33436
33505
 
@@ -33440,7 +33509,7 @@ const ssrTransformFor = createStructuralDirectiveTransform('for', processFor);
33440
33509
  // codegen nodes.
33441
33510
  function ssrProcessFor(node, context, disableNestedFragments = false) {
33442
33511
  const needFragmentWrapper = !disableNestedFragments &&
33443
- (node.children.length !== 1 || node.children[0].type !== 1 /* ELEMENT */);
33512
+ (node.children.length !== 1 || node.children[0].type !== 1 /* NodeTypes.ELEMENT */);
33444
33513
  const renderLoop = createFunctionExpression(createForLoopParams(node.parseResult));
33445
33514
  renderLoop.body = processChildrenAsStatement(node, context, needFragmentWrapper);
33446
33515
  // v-for always renders a fragment unless explicitly disabled
@@ -33479,11 +33548,15 @@ const ssrTransformSlotOutlet = (node, context) => {
33479
33548
  // we need to avoid rendering the slot as a fragment.
33480
33549
  const parent = context.parent;
33481
33550
  if (parent &&
33482
- parent.type === 1 /* ELEMENT */ &&
33483
- parent.tagType === 1 /* COMPONENT */ &&
33551
+ parent.type === 1 /* NodeTypes.ELEMENT */ &&
33552
+ parent.tagType === 1 /* ElementTypes.COMPONENT */ &&
33484
33553
  resolveComponentType(parent, context, true) === TRANSITION &&
33485
- parent.children.filter(c => c.type === 1 /* ELEMENT */).length === 1) {
33554
+ parent.children.filter(c => c.type === 1 /* NodeTypes.ELEMENT */).length === 1) {
33486
33555
  method = SSR_RENDER_SLOT_INNER;
33556
+ if (!(context.scopeId && context.slotted !== false)) {
33557
+ args.push('null');
33558
+ }
33559
+ args.push('true');
33487
33560
  }
33488
33561
  node.ssrCodegenNode = createCallExpression(context.helper(method), args);
33489
33562
  }
@@ -33511,20 +33584,20 @@ function createSSRCompilerError(code, loc) {
33511
33584
  return createCompilerError(code, loc, SSRErrorMessages);
33512
33585
  }
33513
33586
  const SSRErrorMessages = {
33514
- [61 /* X_SSR_UNSAFE_ATTR_NAME */]: `Unsafe attribute name for SSR.`,
33515
- [62 /* X_SSR_NO_TELEPORT_TARGET */]: `Missing the 'to' prop on teleport element.`,
33516
- [63 /* X_SSR_INVALID_AST_NODE */]: `Invalid AST node during SSR transform.`
33587
+ [61 /* SSRErrorCodes.X_SSR_UNSAFE_ATTR_NAME */]: `Unsafe attribute name for SSR.`,
33588
+ [62 /* SSRErrorCodes.X_SSR_NO_TELEPORT_TARGET */]: `Missing the 'to' prop on teleport element.`,
33589
+ [63 /* SSRErrorCodes.X_SSR_INVALID_AST_NODE */]: `Invalid AST node during SSR transform.`
33517
33590
  };
33518
33591
 
33519
33592
  // Note: this is a 2nd-pass codegen transform.
33520
33593
  function ssrProcessTeleport(node, context) {
33521
33594
  const targetProp = findProp(node, 'to');
33522
33595
  if (!targetProp) {
33523
- context.onError(createSSRCompilerError(62 /* X_SSR_NO_TELEPORT_TARGET */, node.loc));
33596
+ context.onError(createSSRCompilerError(62 /* SSRErrorCodes.X_SSR_NO_TELEPORT_TARGET */, node.loc));
33524
33597
  return;
33525
33598
  }
33526
33599
  let target;
33527
- if (targetProp.type === 6 /* ATTRIBUTE */) {
33600
+ if (targetProp.type === 6 /* NodeTypes.ATTRIBUTE */) {
33528
33601
  target =
33529
33602
  targetProp.value && createSimpleExpression(targetProp.value.content, true);
33530
33603
  }
@@ -33532,12 +33605,12 @@ function ssrProcessTeleport(node, context) {
33532
33605
  target = targetProp.exp;
33533
33606
  }
33534
33607
  if (!target) {
33535
- context.onError(createSSRCompilerError(62 /* X_SSR_NO_TELEPORT_TARGET */, targetProp.loc));
33608
+ context.onError(createSSRCompilerError(62 /* SSRErrorCodes.X_SSR_NO_TELEPORT_TARGET */, targetProp.loc));
33536
33609
  return;
33537
33610
  }
33538
33611
  const disabledProp = findProp(node, 'disabled', false, true /* allow empty */);
33539
33612
  const disabled = disabledProp
33540
- ? disabledProp.type === 6 /* ATTRIBUTE */
33613
+ ? disabledProp.type === 6 /* NodeTypes.ATTRIBUTE */
33541
33614
  ? `true`
33542
33615
  : disabledProp.exp || `false`
33543
33616
  : `false`;
@@ -33602,8 +33675,8 @@ function ssrProcessSuspense(node, context) {
33602
33675
  // store the raw children so that they can be added in the 2nd pass.
33603
33676
  const rawChildrenMap = new WeakMap();
33604
33677
  const ssrTransformElement = (node, context) => {
33605
- if (node.type !== 1 /* ELEMENT */ ||
33606
- node.tagType !== 0 /* ELEMENT */) {
33678
+ if (node.type !== 1 /* NodeTypes.ELEMENT */ ||
33679
+ node.tagType !== 0 /* ElementTypes.ELEMENT */) {
33607
33680
  return;
33608
33681
  }
33609
33682
  return function ssrPostTransformElement() {
@@ -33616,7 +33689,7 @@ const ssrTransformElement = (node, context) => {
33616
33689
  // overwrite other static attrs and can affect final rendering result,
33617
33690
  // so when they are present we need to bail out to full `renderAttrs`
33618
33691
  const hasDynamicVBind = hasDynamicKeyVBind(node);
33619
- const hasCustomDir = node.props.some(p => p.type === 7 /* DIRECTIVE */ && !isBuiltInDirective(p.name));
33692
+ const hasCustomDir = node.props.some(p => p.type === 7 /* NodeTypes.DIRECTIVE */ && !isBuiltInDirective(p.name));
33620
33693
  const needMergeProps = hasDynamicVBind || hasCustomDir;
33621
33694
  if (needMergeProps) {
33622
33695
  const { props, directives } = buildProps(node, context, node.props, false /* isComponent */, false /* isDynamicComponent */, true /* ssr */);
@@ -33627,7 +33700,7 @@ const ssrTransformElement = (node, context) => {
33627
33700
  const existingText = node.children[0];
33628
33701
  // If interpolation, this is dynamic <textarea> content, potentially
33629
33702
  // injected by v-model and takes higher priority than v-bind value
33630
- if (!existingText || existingText.type !== 5 /* INTERPOLATION */) {
33703
+ if (!existingText || existingText.type !== 5 /* NodeTypes.INTERPOLATION */) {
33631
33704
  // <textarea> with dynamic v-bind. We don't know if the final props
33632
33705
  // will contain .value, so we will have to do something special:
33633
33706
  // assign the merged props to a temp variable, and check whether
@@ -33683,7 +33756,7 @@ const ssrTransformElement = (node, context) => {
33683
33756
  continue;
33684
33757
  }
33685
33758
  // special cases with children override
33686
- if (prop.type === 7 /* DIRECTIVE */) {
33759
+ if (prop.type === 7 /* NodeTypes.DIRECTIVE */) {
33687
33760
  if (prop.name === 'html' && prop.exp) {
33688
33761
  rawChildrenMap.set(node, prop.exp);
33689
33762
  }
@@ -33691,7 +33764,7 @@ const ssrTransformElement = (node, context) => {
33691
33764
  node.children = [createInterpolation(prop.exp, prop.loc)];
33692
33765
  }
33693
33766
  else if (prop.name === 'slot') {
33694
- context.onError(createCompilerError(40 /* X_V_SLOT_MISPLACED */, prop.loc));
33767
+ context.onError(createCompilerError(40 /* ErrorCodes.X_V_SLOT_MISPLACED */, prop.loc));
33695
33768
  }
33696
33769
  else if (isTextareaWithValue(node, prop) && prop.exp) {
33697
33770
  if (!needMergeProps) {
@@ -33741,7 +33814,7 @@ const ssrTransformElement = (node, context) => {
33741
33814
  ]));
33742
33815
  }
33743
33816
  else {
33744
- context.onError(createSSRCompilerError(61 /* X_SSR_UNSAFE_ATTR_NAME */, key.loc));
33817
+ context.onError(createSSRCompilerError(61 /* SSRErrorCodes.X_SSR_UNSAFE_ATTR_NAME */, key.loc));
33745
33818
  }
33746
33819
  }
33747
33820
  }
@@ -33791,7 +33864,7 @@ const ssrTransformElement = (node, context) => {
33791
33864
  function buildSSRProps(props, directives, context) {
33792
33865
  let mergePropsArgs = [];
33793
33866
  if (props) {
33794
- if (props.type === 14 /* JS_CALL_EXPRESSION */) {
33867
+ if (props.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */) {
33795
33868
  // already a mergeProps call
33796
33869
  mergePropsArgs = props.arguments;
33797
33870
  }
@@ -33812,7 +33885,7 @@ function buildSSRProps(props, directives, context) {
33812
33885
  : mergePropsArgs[0];
33813
33886
  }
33814
33887
  function isTrueFalseValue(prop) {
33815
- if (prop.type === 7 /* DIRECTIVE */) {
33888
+ if (prop.type === 7 /* NodeTypes.DIRECTIVE */) {
33816
33889
  return (prop.name === 'bind' &&
33817
33890
  prop.arg &&
33818
33891
  isStaticExp(prop.arg) &&
@@ -33829,7 +33902,7 @@ function isTextareaWithValue(node, prop) {
33829
33902
  }
33830
33903
  function mergeCall(call, arg) {
33831
33904
  const existing = call.arguments[0];
33832
- if (existing.type === 17 /* JS_ARRAY_EXPRESSION */) {
33905
+ if (existing.type === 17 /* NodeTypes.JS_ARRAY_EXPRESSION */) {
33833
33906
  existing.elements.push(arg);
33834
33907
  }
33835
33908
  else {
@@ -33844,7 +33917,7 @@ function removeStaticBinding(tag, binding) {
33844
33917
  }
33845
33918
  }
33846
33919
  function findVModel(node) {
33847
- return node.props.find(p => p.type === 7 /* DIRECTIVE */ && p.name === 'model' && p.exp);
33920
+ return node.props.find(p => p.type === 7 /* NodeTypes.DIRECTIVE */ && p.name === 'model' && p.exp);
33848
33921
  }
33849
33922
  function ssrProcessElement(node, context) {
33850
33923
  const isVoidTag = context.options.isVoidTag || NO;
@@ -33897,7 +33970,7 @@ function ssrProcessTransitionGroup(node, context) {
33897
33970
  const entry = wipMap$1.get(node);
33898
33971
  if (entry) {
33899
33972
  const { tag, propsExp } = entry;
33900
- if (tag.type === 7 /* DIRECTIVE */) {
33973
+ if (tag.type === 7 /* NodeTypes.DIRECTIVE */) {
33901
33974
  // dynamic :tag
33902
33975
  context.pushStringPart(`<`);
33903
33976
  context.pushStringPart(tag.exp);
@@ -33948,8 +34021,8 @@ const componentTypeMap = new WeakMap();
33948
34021
  // In phase 2. we convert the WIP slots from phase 1 into ssr-specific codegen
33949
34022
  // nodes.
33950
34023
  const ssrTransformComponent = (node, context) => {
33951
- if (node.type !== 1 /* ELEMENT */ ||
33952
- node.tagType !== 1 /* COMPONENT */) {
34024
+ if (node.type !== 1 /* NodeTypes.ELEMENT */ ||
34025
+ node.tagType !== 1 /* ElementTypes.COMPONENT */) {
33953
34026
  return;
33954
34027
  }
33955
34028
  const component = resolveComponentType(node, context, true /* ssr */);
@@ -34053,7 +34126,7 @@ function ssrProcessComponent(node, context, parent) {
34053
34126
  }
34054
34127
  // #5351: filter out comment children inside transition
34055
34128
  if (component === TRANSITION) {
34056
- node.children = node.children.filter(c => c.type !== 3 /* COMMENT */);
34129
+ node.children = node.children.filter(c => c.type !== 3 /* NodeTypes.COMMENT */);
34057
34130
  }
34058
34131
  processChildren(node, context);
34059
34132
  }
@@ -34099,16 +34172,16 @@ function createVNodeSlotBranch(props, children, parentContext) {
34099
34172
  ], directiveTransforms: Object.assign(Object.assign({}, vnodeDirectiveTransforms), (rawOptions.directiveTransforms || {})) });
34100
34173
  // wrap the children with a wrapper template for proper children treatment.
34101
34174
  const wrapperNode = {
34102
- type: 1 /* ELEMENT */,
34103
- ns: 0 /* HTML */,
34175
+ type: 1 /* NodeTypes.ELEMENT */,
34176
+ ns: 0 /* Namespaces.HTML */,
34104
34177
  tag: 'template',
34105
- tagType: 3 /* TEMPLATE */,
34178
+ tagType: 3 /* ElementTypes.TEMPLATE */,
34106
34179
  isSelfClosing: false,
34107
34180
  // important: provide v-slot="props" on the wrapper for proper
34108
34181
  // scope analysis
34109
34182
  props: [
34110
34183
  {
34111
- type: 7 /* DIRECTIVE */,
34184
+ type: 7 /* NodeTypes.DIRECTIVE */,
34112
34185
  name: 'slot',
34113
34186
  exp: props,
34114
34187
  arg: undefined,
@@ -34183,8 +34256,10 @@ function ssrCodegenTransform(ast, options) {
34183
34256
  // we do this instead of inlining the expression to ensure the vars are
34184
34257
  // only resolved once per render
34185
34258
  if (options.ssrCssVars) {
34186
- const varsExp = processExpression(createSimpleExpression(options.ssrCssVars, false), createTransformContext(createRoot([]), options));
34259
+ const cssContext = createTransformContext(createRoot([]), options);
34260
+ const varsExp = processExpression(createSimpleExpression(options.ssrCssVars, false), cssContext);
34187
34261
  context.body.push(createCompoundExpression([`const _cssVars = { style: `, varsExp, `}`]));
34262
+ Array.from(cssContext.helpers.keys()).forEach(helper => ast.helpers.push(helper));
34188
34263
  }
34189
34264
  const isFragment = ast.children.length > 1 && ast.children.some(c => !isText(c));
34190
34265
  processChildren(ast, context, isFragment);
@@ -34246,54 +34321,54 @@ function processChildren(parent, context, asFragment = false, disableNestedFragm
34246
34321
  for (let i = 0; i < children.length; i++) {
34247
34322
  const child = children[i];
34248
34323
  switch (child.type) {
34249
- case 1 /* ELEMENT */:
34324
+ case 1 /* NodeTypes.ELEMENT */:
34250
34325
  switch (child.tagType) {
34251
- case 0 /* ELEMENT */:
34326
+ case 0 /* ElementTypes.ELEMENT */:
34252
34327
  ssrProcessElement(child, context);
34253
34328
  break;
34254
- case 1 /* COMPONENT */:
34329
+ case 1 /* ElementTypes.COMPONENT */:
34255
34330
  ssrProcessComponent(child, context, parent);
34256
34331
  break;
34257
- case 2 /* SLOT */:
34332
+ case 2 /* ElementTypes.SLOT */:
34258
34333
  ssrProcessSlotOutlet(child, context);
34259
34334
  break;
34260
- case 3 /* TEMPLATE */:
34335
+ case 3 /* ElementTypes.TEMPLATE */:
34261
34336
  // TODO
34262
34337
  break;
34263
34338
  default:
34264
- context.onError(createSSRCompilerError(63 /* X_SSR_INVALID_AST_NODE */, child.loc));
34339
+ context.onError(createSSRCompilerError(63 /* SSRErrorCodes.X_SSR_INVALID_AST_NODE */, child.loc));
34265
34340
  // make sure we exhaust all possible types
34266
34341
  const exhaustiveCheck = child;
34267
34342
  return exhaustiveCheck;
34268
34343
  }
34269
34344
  break;
34270
- case 2 /* TEXT */:
34345
+ case 2 /* NodeTypes.TEXT */:
34271
34346
  context.pushStringPart(escapeHtml(child.content));
34272
34347
  break;
34273
- case 3 /* COMMENT */:
34348
+ case 3 /* NodeTypes.COMMENT */:
34274
34349
  // no need to escape comment here because the AST can only
34275
34350
  // contain valid comments.
34276
34351
  context.pushStringPart(`<!--${child.content}-->`);
34277
34352
  break;
34278
- case 5 /* INTERPOLATION */:
34353
+ case 5 /* NodeTypes.INTERPOLATION */:
34279
34354
  context.pushStringPart(createCallExpression(context.helper(SSR_INTERPOLATE), [child.content]));
34280
34355
  break;
34281
- case 9 /* IF */:
34356
+ case 9 /* NodeTypes.IF */:
34282
34357
  ssrProcessIf(child, context, disableNestedFragments);
34283
34358
  break;
34284
- case 11 /* FOR */:
34359
+ case 11 /* NodeTypes.FOR */:
34285
34360
  ssrProcessFor(child, context, disableNestedFragments);
34286
34361
  break;
34287
- case 10 /* IF_BRANCH */:
34362
+ case 10 /* NodeTypes.IF_BRANCH */:
34288
34363
  // no-op - handled by ssrProcessIf
34289
34364
  break;
34290
- case 12 /* TEXT_CALL */:
34291
- case 8 /* COMPOUND_EXPRESSION */:
34365
+ case 12 /* NodeTypes.TEXT_CALL */:
34366
+ case 8 /* NodeTypes.COMPOUND_EXPRESSION */:
34292
34367
  // no-op - these two types can never appear as template child node since
34293
34368
  // `transformText` is not used during SSR compile.
34294
34369
  break;
34295
34370
  default:
34296
- context.onError(createSSRCompilerError(63 /* X_SSR_INVALID_AST_NODE */, child.loc));
34371
+ context.onError(createSSRCompilerError(63 /* SSRErrorCodes.X_SSR_INVALID_AST_NODE */, child.loc));
34297
34372
  // make sure we exhaust all possible types
34298
34373
  const exhaustiveCheck = child;
34299
34374
  return exhaustiveCheck;
@@ -34314,10 +34389,10 @@ const ssrTransformModel = (dir, node, context) => {
34314
34389
  function checkDuplicatedValue() {
34315
34390
  const value = findProp(node, 'value');
34316
34391
  if (value) {
34317
- context.onError(createDOMCompilerError(57 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
34392
+ context.onError(createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
34318
34393
  }
34319
34394
  }
34320
- if (node.tagType === 0 /* ELEMENT */) {
34395
+ if (node.tagType === 0 /* ElementTypes.ELEMENT */) {
34321
34396
  const res = { props: [] };
34322
34397
  const defaultProps = [
34323
34398
  // default value binding for text type inputs
@@ -34327,7 +34402,7 @@ const ssrTransformModel = (dir, node, context) => {
34327
34402
  const type = findProp(node, 'type');
34328
34403
  if (type) {
34329
34404
  const value = findValueBinding(node);
34330
- if (type.type === 7 /* DIRECTIVE */) {
34405
+ if (type.type === 7 /* NodeTypes.DIRECTIVE */) {
34331
34406
  // dynamic type
34332
34407
  res.ssrTagParts = [
34333
34408
  createCallExpression(context.helper(SSR_RENDER_DYNAMIC_MODEL), [
@@ -34351,7 +34426,7 @@ const ssrTransformModel = (dir, node, context) => {
34351
34426
  case 'checkbox':
34352
34427
  const trueValueBinding = findProp(node, 'true-value');
34353
34428
  if (trueValueBinding) {
34354
- const trueValue = trueValueBinding.type === 6 /* ATTRIBUTE */
34429
+ const trueValue = trueValueBinding.type === 6 /* NodeTypes.ATTRIBUTE */
34355
34430
  ? JSON.stringify(trueValueBinding.value.content)
34356
34431
  : trueValueBinding.exp;
34357
34432
  res.props = [
@@ -34371,7 +34446,7 @@ const ssrTransformModel = (dir, node, context) => {
34371
34446
  }
34372
34447
  break;
34373
34448
  case 'file':
34374
- context.onError(createDOMCompilerError(56 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
34449
+ context.onError(createDOMCompilerError(56 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
34375
34450
  break;
34376
34451
  default:
34377
34452
  checkDuplicatedValue();
@@ -34393,7 +34468,7 @@ const ssrTransformModel = (dir, node, context) => {
34393
34468
  }
34394
34469
  else if (node.tag === 'select') ;
34395
34470
  else {
34396
- context.onError(createDOMCompilerError(54 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
34471
+ context.onError(createDOMCompilerError(54 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
34397
34472
  }
34398
34473
  return res;
34399
34474
  }
@@ -34405,7 +34480,7 @@ const ssrTransformModel = (dir, node, context) => {
34405
34480
  function findValueBinding(node) {
34406
34481
  const valueBinding = findProp(node, 'value');
34407
34482
  return valueBinding
34408
- ? valueBinding.type === 7 /* DIRECTIVE */
34483
+ ? valueBinding.type === 7 /* NodeTypes.DIRECTIVE */
34409
34484
  ? valueBinding.exp
34410
34485
  : createSimpleExpression(valueBinding.value.content, true)
34411
34486
  : createSimpleExpression(`null`, false);
@@ -34413,7 +34488,7 @@ function findValueBinding(node) {
34413
34488
 
34414
34489
  const ssrTransformShow = (dir, node, context) => {
34415
34490
  if (!dir.exp) {
34416
- context.onError(createDOMCompilerError(58 /* X_V_SHOW_NO_EXPRESSION */));
34491
+ context.onError(createDOMCompilerError(58 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */));
34417
34492
  }
34418
34493
  return {
34419
34494
  props: [
@@ -34424,17 +34499,17 @@ const ssrTransformShow = (dir, node, context) => {
34424
34499
  };
34425
34500
  };
34426
34501
 
34427
- const filterChild = (node) => node.children.filter(n => n.type !== 3 /* COMMENT */);
34502
+ const filterChild = (node) => node.children.filter(n => n.type !== 3 /* NodeTypes.COMMENT */);
34428
34503
  const hasSingleChild = (node) => filterChild(node).length === 1;
34429
34504
  const ssrInjectFallthroughAttrs = (node, context) => {
34430
34505
  // _attrs is provided as a function argument.
34431
34506
  // mark it as a known identifier so that it doesn't get prefixed by
34432
34507
  // transformExpression.
34433
- if (node.type === 0 /* ROOT */) {
34508
+ if (node.type === 0 /* NodeTypes.ROOT */) {
34434
34509
  context.identifiers._attrs = 1;
34435
34510
  }
34436
- if (node.type === 1 /* ELEMENT */ &&
34437
- node.tagType === 1 /* COMPONENT */ &&
34511
+ if (node.type === 1 /* NodeTypes.ELEMENT */ &&
34512
+ node.tagType === 1 /* ElementTypes.COMPONENT */ &&
34438
34513
  (isBuiltInType(node.tag, 'Transition') ||
34439
34514
  isBuiltInType(node.tag, 'KeepAlive'))) {
34440
34515
  const rootChildren = filterChild(context.root);
@@ -34446,15 +34521,15 @@ const ssrInjectFallthroughAttrs = (node, context) => {
34446
34521
  }
34447
34522
  }
34448
34523
  const parent = context.parent;
34449
- if (!parent || parent.type !== 0 /* ROOT */) {
34524
+ if (!parent || parent.type !== 0 /* NodeTypes.ROOT */) {
34450
34525
  return;
34451
34526
  }
34452
- if (node.type === 10 /* IF_BRANCH */ && hasSingleChild(node)) {
34527
+ if (node.type === 10 /* NodeTypes.IF_BRANCH */ && hasSingleChild(node)) {
34453
34528
  // detect cases where the parent v-if is not the only root level node
34454
34529
  let hasEncounteredIf = false;
34455
34530
  for (const c of filterChild(parent)) {
34456
- if (c.type === 9 /* IF */ ||
34457
- (c.type === 1 /* ELEMENT */ && findDir(c, 'if'))) {
34531
+ if (c.type === 9 /* NodeTypes.IF */ ||
34532
+ (c.type === 1 /* NodeTypes.ELEMENT */ && findDir(c, 'if'))) {
34458
34533
  // multiple root v-if
34459
34534
  if (hasEncounteredIf)
34460
34535
  return;
@@ -34464,7 +34539,7 @@ const ssrInjectFallthroughAttrs = (node, context) => {
34464
34539
  // node before v-if
34465
34540
  !hasEncounteredIf ||
34466
34541
  // non else nodes
34467
- !(c.type === 1 /* ELEMENT */ && findDir(c, /else/, true))) {
34542
+ !(c.type === 1 /* NodeTypes.ELEMENT */ && findDir(c, /else/, true))) {
34468
34543
  return;
34469
34544
  }
34470
34545
  }
@@ -34475,12 +34550,12 @@ const ssrInjectFallthroughAttrs = (node, context) => {
34475
34550
  }
34476
34551
  };
34477
34552
  function injectFallthroughAttrs(node) {
34478
- if (node.type === 1 /* ELEMENT */ &&
34479
- (node.tagType === 0 /* ELEMENT */ ||
34480
- node.tagType === 1 /* COMPONENT */) &&
34553
+ if (node.type === 1 /* NodeTypes.ELEMENT */ &&
34554
+ (node.tagType === 0 /* ElementTypes.ELEMENT */ ||
34555
+ node.tagType === 1 /* ElementTypes.COMPONENT */) &&
34481
34556
  !findDir(node, 'for')) {
34482
34557
  node.props.push({
34483
- type: 7 /* DIRECTIVE */,
34558
+ type: 7 /* NodeTypes.DIRECTIVE */,
34484
34559
  name: 'bind',
34485
34560
  arg: undefined,
34486
34561
  exp: createSimpleExpression(`_attrs`, false),
@@ -34497,14 +34572,14 @@ const ssrInjectCssVars = (node, context) => {
34497
34572
  // _cssVars is initialized once per render function
34498
34573
  // the code is injected in ssrCodegenTransform when creating the
34499
34574
  // ssr transform context
34500
- if (node.type === 0 /* ROOT */) {
34575
+ if (node.type === 0 /* NodeTypes.ROOT */) {
34501
34576
  context.identifiers._cssVars = 1;
34502
34577
  }
34503
34578
  const parent = context.parent;
34504
- if (!parent || parent.type !== 0 /* ROOT */) {
34579
+ if (!parent || parent.type !== 0 /* NodeTypes.ROOT */) {
34505
34580
  return;
34506
34581
  }
34507
- if (node.type === 10 /* IF_BRANCH */) {
34582
+ if (node.type === 10 /* NodeTypes.IF_BRANCH */) {
34508
34583
  for (const child of node.children) {
34509
34584
  injectCssVars(child);
34510
34585
  }
@@ -34514,14 +34589,14 @@ const ssrInjectCssVars = (node, context) => {
34514
34589
  }
34515
34590
  };
34516
34591
  function injectCssVars(node) {
34517
- if (node.type === 1 /* ELEMENT */ &&
34518
- (node.tagType === 0 /* ELEMENT */ ||
34519
- node.tagType === 1 /* COMPONENT */) &&
34592
+ if (node.type === 1 /* NodeTypes.ELEMENT */ &&
34593
+ (node.tagType === 0 /* ElementTypes.ELEMENT */ ||
34594
+ node.tagType === 1 /* ElementTypes.COMPONENT */) &&
34520
34595
  !findDir(node, 'for')) {
34521
34596
  if (isBuiltInType(node.tag, 'Suspense')) {
34522
34597
  for (const child of node.children) {
34523
- if (child.type === 1 /* ELEMENT */ &&
34524
- child.tagType === 3 /* TEMPLATE */) {
34598
+ if (child.type === 1 /* NodeTypes.ELEMENT */ &&
34599
+ child.tagType === 3 /* ElementTypes.TEMPLATE */) {
34525
34600
  // suspense slot
34526
34601
  child.children.forEach(injectCssVars);
34527
34602
  }
@@ -34532,7 +34607,7 @@ function injectCssVars(node) {
34532
34607
  }
34533
34608
  else {
34534
34609
  node.props.push({
34535
- type: 7 /* DIRECTIVE */,
34610
+ type: 7 /* NodeTypes.DIRECTIVE */,
34536
34611
  name: 'bind',
34537
34612
  arg: undefined,
34538
34613
  exp: createSimpleExpression(`_cssVars`, false),
@@ -34813,7 +34888,13 @@ function rewriteDefault(input, as, parserPlugins) {
34813
34888
  }).program.body;
34814
34889
  ast.forEach(node => {
34815
34890
  if (node.type === 'ExportDefaultDeclaration') {
34816
- s.overwrite(node.start, node.declaration.start, `const ${as} = `);
34891
+ if (node.declaration.type === 'ClassDeclaration') {
34892
+ s.overwrite(node.start, node.declaration.id.start, `class `);
34893
+ s.append(`\nconst ${as} = ${node.declaration.id.name}`);
34894
+ }
34895
+ else {
34896
+ s.overwrite(node.start, node.declaration.start, `const ${as} = `);
34897
+ }
34817
34898
  }
34818
34899
  if (node.type === 'ExportNamedDeclaration') {
34819
34900
  for (const specifier of node.specifiers) {
@@ -35435,8 +35516,12 @@ function compileScript(sfc, options) {
35435
35516
  }
35436
35517
  if (options.babelParserPlugins)
35437
35518
  plugins.push(...options.babelParserPlugins);
35438
- if (isTS)
35439
- plugins.push('typescript', 'decorators-legacy');
35519
+ if (isTS) {
35520
+ plugins.push('typescript');
35521
+ if (!plugins.includes('decorators')) {
35522
+ plugins.push('decorators-legacy');
35523
+ }
35524
+ }
35440
35525
  if (!scriptSetup) {
35441
35526
  if (!script) {
35442
35527
  throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
@@ -36160,7 +36245,7 @@ function compileScript(sfc, options) {
36160
36245
  if (isTS) {
36161
36246
  // runtime enum
36162
36247
  if (node.type === 'TSEnumDeclaration') {
36163
- registerBinding(setupBindings, node.id, "setup-const" /* SETUP_CONST */);
36248
+ registerBinding(setupBindings, node.id, "setup-const" /* BindingTypes.SETUP_CONST */);
36164
36249
  }
36165
36250
  // move all Type declarations to outer scope
36166
36251
  if (node.type.startsWith('TS') ||
@@ -36222,22 +36307,22 @@ function compileScript(sfc, options) {
36222
36307
  }
36223
36308
  if (propsRuntimeDecl) {
36224
36309
  for (const key of getObjectOrArrayExpressionKeys(propsRuntimeDecl)) {
36225
- bindingMetadata[key] = "props" /* PROPS */;
36310
+ bindingMetadata[key] = "props" /* BindingTypes.PROPS */;
36226
36311
  }
36227
36312
  }
36228
36313
  for (const key in typeDeclaredProps) {
36229
- bindingMetadata[key] = "props" /* PROPS */;
36314
+ bindingMetadata[key] = "props" /* BindingTypes.PROPS */;
36230
36315
  }
36231
36316
  // props aliases
36232
36317
  if (propsDestructureDecl) {
36233
36318
  if (propsDestructureRestId) {
36234
36319
  bindingMetadata[propsDestructureRestId] =
36235
- "setup-reactive-const" /* SETUP_REACTIVE_CONST */;
36320
+ "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */;
36236
36321
  }
36237
36322
  for (const key in propsDestructuredBindings) {
36238
36323
  const { local } = propsDestructuredBindings[key];
36239
36324
  if (local !== key) {
36240
- bindingMetadata[local] = "props-aliased" /* PROPS_ALIASED */;
36325
+ bindingMetadata[local] = "props-aliased" /* BindingTypes.PROPS_ALIASED */;
36241
36326
  (bindingMetadata.__propsAliases ||
36242
36327
  (bindingMetadata.__propsAliases = {}))[local] = key;
36243
36328
  }
@@ -36250,8 +36335,8 @@ function compileScript(sfc, options) {
36250
36335
  imported === '*' ||
36251
36336
  (imported === 'default' && source.endsWith('.vue')) ||
36252
36337
  source === 'vue'
36253
- ? "setup-const" /* SETUP_CONST */
36254
- : "setup-maybe-ref" /* SETUP_MAYBE_REF */;
36338
+ ? "setup-const" /* BindingTypes.SETUP_CONST */
36339
+ : "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */;
36255
36340
  }
36256
36341
  for (const key in scriptBindings) {
36257
36342
  bindingMetadata[key] = scriptBindings[key];
@@ -36262,7 +36347,7 @@ function compileScript(sfc, options) {
36262
36347
  // known ref bindings
36263
36348
  if (refBindings) {
36264
36349
  for (const key of refBindings) {
36265
- bindingMetadata[key] = "setup-ref" /* SETUP_REF */;
36350
+ bindingMetadata[key] = "setup-ref" /* BindingTypes.SETUP_REF */;
36266
36351
  }
36267
36352
  }
36268
36353
  // 8. inject `useCssVars` calls
@@ -36378,7 +36463,7 @@ function compileScript(sfc, options) {
36378
36463
  if (!hasDefaultExportName && filename && filename !== DEFAULT_FILENAME) {
36379
36464
  const match = filename.match(/([^/\\]+)\.\w+$/);
36380
36465
  if (match) {
36381
- runtimeOptions += `\n name: '${match[1]}',`;
36466
+ runtimeOptions += `\n __name: '${match[1]}',`;
36382
36467
  }
36383
36468
  }
36384
36469
  if (hasInlinedSsrRenderFn) {
@@ -36471,8 +36556,8 @@ function walkDeclaration(node, bindings, userImportAlias) {
36471
36556
  if (isCallOf(init, userReactiveBinding)) {
36472
36557
  // treat reactive() calls as let since it's meant to be mutable
36473
36558
  bindingType = isConst
36474
- ? "setup-reactive-const" /* SETUP_REACTIVE_CONST */
36475
- : "setup-let" /* SETUP_LET */;
36559
+ ? "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */
36560
+ : "setup-let" /* BindingTypes.SETUP_LET */;
36476
36561
  }
36477
36562
  else if (
36478
36563
  // if a declaration is a const literal, we can mark it so that
@@ -36480,19 +36565,19 @@ function walkDeclaration(node, bindings, userImportAlias) {
36480
36565
  isDefineCall ||
36481
36566
  (isConst && canNeverBeRef(init, userReactiveBinding))) {
36482
36567
  bindingType = isCallOf(init, DEFINE_PROPS)
36483
- ? "setup-reactive-const" /* SETUP_REACTIVE_CONST */
36484
- : "setup-const" /* SETUP_CONST */;
36568
+ ? "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */
36569
+ : "setup-const" /* BindingTypes.SETUP_CONST */;
36485
36570
  }
36486
36571
  else if (isConst) {
36487
36572
  if (isCallOf(init, userImportAlias['ref'] || 'ref')) {
36488
- bindingType = "setup-ref" /* SETUP_REF */;
36573
+ bindingType = "setup-ref" /* BindingTypes.SETUP_REF */;
36489
36574
  }
36490
36575
  else {
36491
- bindingType = "setup-maybe-ref" /* SETUP_MAYBE_REF */;
36576
+ bindingType = "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */;
36492
36577
  }
36493
36578
  }
36494
36579
  else {
36495
- bindingType = "setup-let" /* SETUP_LET */;
36580
+ bindingType = "setup-let" /* BindingTypes.SETUP_LET */;
36496
36581
  }
36497
36582
  registerBinding(bindings, id, bindingType);
36498
36583
  }
@@ -36515,7 +36600,7 @@ function walkDeclaration(node, bindings, userImportAlias) {
36515
36600
  node.type === 'ClassDeclaration') {
36516
36601
  // export function foo() {} / export class Foo {}
36517
36602
  // export declarations must be named.
36518
- bindings[node.id.name] = "setup-const" /* SETUP_CONST */;
36603
+ bindings[node.id.name] = "setup-const" /* BindingTypes.SETUP_CONST */;
36519
36604
  }
36520
36605
  }
36521
36606
  function walkObjectPattern(node, bindings, isConst, isDefineCall = false) {
@@ -36524,10 +36609,10 @@ function walkObjectPattern(node, bindings, isConst, isDefineCall = false) {
36524
36609
  if (p.key.type === 'Identifier' && p.key === p.value) {
36525
36610
  // shorthand: const { x } = ...
36526
36611
  const type = isDefineCall
36527
- ? "setup-const" /* SETUP_CONST */
36612
+ ? "setup-const" /* BindingTypes.SETUP_CONST */
36528
36613
  : isConst
36529
- ? "setup-maybe-ref" /* SETUP_MAYBE_REF */
36530
- : "setup-let" /* SETUP_LET */;
36614
+ ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
36615
+ : "setup-let" /* BindingTypes.SETUP_LET */;
36531
36616
  registerBinding(bindings, p.key, type);
36532
36617
  }
36533
36618
  else {
@@ -36537,7 +36622,7 @@ function walkObjectPattern(node, bindings, isConst, isDefineCall = false) {
36537
36622
  else {
36538
36623
  // ...rest
36539
36624
  // argument can only be identifier when destructuring
36540
- const type = isConst ? "setup-const" /* SETUP_CONST */ : "setup-let" /* SETUP_LET */;
36625
+ const type = isConst ? "setup-const" /* BindingTypes.SETUP_CONST */ : "setup-let" /* BindingTypes.SETUP_LET */;
36541
36626
  registerBinding(bindings, p.argument, type);
36542
36627
  }
36543
36628
  }
@@ -36550,15 +36635,15 @@ function walkArrayPattern(node, bindings, isConst, isDefineCall = false) {
36550
36635
  function walkPattern(node, bindings, isConst, isDefineCall = false) {
36551
36636
  if (node.type === 'Identifier') {
36552
36637
  const type = isDefineCall
36553
- ? "setup-const" /* SETUP_CONST */
36638
+ ? "setup-const" /* BindingTypes.SETUP_CONST */
36554
36639
  : isConst
36555
- ? "setup-maybe-ref" /* SETUP_MAYBE_REF */
36556
- : "setup-let" /* SETUP_LET */;
36640
+ ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
36641
+ : "setup-let" /* BindingTypes.SETUP_LET */;
36557
36642
  registerBinding(bindings, node, type);
36558
36643
  }
36559
36644
  else if (node.type === 'RestElement') {
36560
36645
  // argument can only be identifier when destructuring
36561
- const type = isConst ? "setup-const" /* SETUP_CONST */ : "setup-let" /* SETUP_LET */;
36646
+ const type = isConst ? "setup-const" /* BindingTypes.SETUP_CONST */ : "setup-let" /* BindingTypes.SETUP_LET */;
36562
36647
  registerBinding(bindings, node.argument, type);
36563
36648
  }
36564
36649
  else if (node.type === 'ObjectPattern') {
@@ -36570,10 +36655,10 @@ function walkPattern(node, bindings, isConst, isDefineCall = false) {
36570
36655
  else if (node.type === 'AssignmentPattern') {
36571
36656
  if (node.left.type === 'Identifier') {
36572
36657
  const type = isDefineCall
36573
- ? "setup-const" /* SETUP_CONST */
36658
+ ? "setup-const" /* BindingTypes.SETUP_CONST */
36574
36659
  : isConst
36575
- ? "setup-maybe-ref" /* SETUP_MAYBE_REF */
36576
- : "setup-let" /* SETUP_LET */;
36660
+ ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
36661
+ : "setup-let" /* BindingTypes.SETUP_LET */;
36577
36662
  registerBinding(bindings, node.left, type);
36578
36663
  }
36579
36664
  else {
@@ -36793,7 +36878,7 @@ function analyzeBindingsFromOptions(node) {
36793
36878
  // props: ['foo']
36794
36879
  // props: { foo: ... }
36795
36880
  for (const key of getObjectOrArrayExpressionKeys(property.value)) {
36796
- bindings[key] = "props" /* PROPS */;
36881
+ bindings[key] = "props" /* BindingTypes.PROPS */;
36797
36882
  }
36798
36883
  }
36799
36884
  // inject
@@ -36801,7 +36886,7 @@ function analyzeBindingsFromOptions(node) {
36801
36886
  // inject: ['foo']
36802
36887
  // inject: { foo: {} }
36803
36888
  for (const key of getObjectOrArrayExpressionKeys(property.value)) {
36804
- bindings[key] = "options" /* OPTIONS */;
36889
+ bindings[key] = "options" /* BindingTypes.OPTIONS */;
36805
36890
  }
36806
36891
  }
36807
36892
  // computed & methods
@@ -36810,7 +36895,7 @@ function analyzeBindingsFromOptions(node) {
36810
36895
  // methods: { foo() {} }
36811
36896
  // computed: { foo() {} }
36812
36897
  for (const key of getObjectExpressionKeys(property.value)) {
36813
- bindings[key] = "options" /* OPTIONS */;
36898
+ bindings[key] = "options" /* BindingTypes.OPTIONS */;
36814
36899
  }
36815
36900
  }
36816
36901
  }
@@ -36830,8 +36915,8 @@ function analyzeBindingsFromOptions(node) {
36830
36915
  for (const key of getObjectExpressionKeys(bodyItem.argument)) {
36831
36916
  bindings[key] =
36832
36917
  property.key.name === 'setup'
36833
- ? "setup-maybe-ref" /* SETUP_MAYBE_REF */
36834
- : "data" /* DATA */;
36918
+ ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
36919
+ : "data" /* BindingTypes.DATA */;
36835
36920
  }
36836
36921
  }
36837
36922
  }
@@ -36883,14 +36968,14 @@ function resolveTemplateUsageCheckString(sfc) {
36883
36968
  transform(createRoot([ast]), {
36884
36969
  nodeTransforms: [
36885
36970
  node => {
36886
- if (node.type === 1 /* ELEMENT */) {
36971
+ if (node.type === 1 /* NodeTypes.ELEMENT */) {
36887
36972
  if (!parserOptions.isNativeTag(node.tag) &&
36888
36973
  !parserOptions.isBuiltInComponent(node.tag)) {
36889
36974
  code += `,${camelize(node.tag)},${capitalize(camelize(node.tag))}`;
36890
36975
  }
36891
36976
  for (let i = 0; i < node.props.length; i++) {
36892
36977
  const prop = node.props[i];
36893
- if (prop.type === 7 /* DIRECTIVE */) {
36978
+ if (prop.type === 7 /* NodeTypes.DIRECTIVE */) {
36894
36979
  if (!isBuiltInDir(prop.name)) {
36895
36980
  code += `,v${capitalize(camelize(prop.name))}`;
36896
36981
  }
@@ -36900,7 +36985,7 @@ function resolveTemplateUsageCheckString(sfc) {
36900
36985
  }
36901
36986
  }
36902
36987
  }
36903
- else if (node.type === 5 /* INTERPOLATION */) {
36988
+ else if (node.type === 5 /* NodeTypes.INTERPOLATION */) {
36904
36989
  code += `,${processExp(node.content.content)}`;
36905
36990
  }
36906
36991
  }
@@ -36916,6 +37001,9 @@ function processExp(exp, dir) {
36916
37001
  if (dir === 'slot') {
36917
37002
  exp = `(${exp})=>{}`;
36918
37003
  }
37004
+ else if (dir === 'on') {
37005
+ exp = `()=>{${exp}}`;
37006
+ }
36919
37007
  else if (dir === 'for') {
36920
37008
  const inMatch = exp.match(forAliasRE$1);
36921
37009
  if (inMatch) {
@@ -37005,15 +37093,15 @@ function parse$4(source, { sourceMap = true, filename = DEFAULT_FILENAME, source
37005
37093
  if ((!parent && tag !== 'template') ||
37006
37094
  // <template lang="xxx"> should also be treated as raw text
37007
37095
  (tag === 'template' &&
37008
- props.some(p => p.type === 6 /* ATTRIBUTE */ &&
37096
+ props.some(p => p.type === 6 /* NodeTypes.ATTRIBUTE */ &&
37009
37097
  p.name === 'lang' &&
37010
37098
  p.value &&
37011
37099
  p.value.content &&
37012
37100
  p.value.content !== 'html'))) {
37013
- return 2 /* RAWTEXT */;
37101
+ return 2 /* TextModes.RAWTEXT */;
37014
37102
  }
37015
37103
  else {
37016
- return 0 /* DATA */;
37104
+ return 0 /* TextModes.DATA */;
37017
37105
  }
37018
37106
  },
37019
37107
  onError: e => {
@@ -37021,7 +37109,7 @@ function parse$4(source, { sourceMap = true, filename = DEFAULT_FILENAME, source
37021
37109
  }
37022
37110
  });
37023
37111
  ast.children.forEach(node => {
37024
- if (node.type !== 1 /* ELEMENT */) {
37112
+ if (node.type !== 1 /* NodeTypes.ELEMENT */) {
37025
37113
  return;
37026
37114
  }
37027
37115
  // we only want to keep the nodes that are not empty (when the tag is not a template)
@@ -37152,7 +37240,7 @@ function createBlock(node, source, pad) {
37152
37240
  block.content = padContent(source, block, pad) + block.content;
37153
37241
  }
37154
37242
  node.props.forEach(p => {
37155
- if (p.type === 6 /* ATTRIBUTE */) {
37243
+ if (p.type === 6 /* NodeTypes.ATTRIBUTE */) {
37156
37244
  attrs[p.name] = p.value ? p.value.content || true : true;
37157
37245
  if (p.name === 'lang') {
37158
37246
  block.lang = p.value && p.value.content;
@@ -37220,7 +37308,7 @@ function padContent(content, block, pad) {
37220
37308
  }
37221
37309
  function hasSrc(node) {
37222
37310
  return node.props.some(p => {
37223
- if (p.type !== 6 /* ATTRIBUTE */) {
37311
+ if (p.type !== 6 /* NodeTypes.ATTRIBUTE */) {
37224
37312
  return false;
37225
37313
  }
37226
37314
  return p.name === 'src';
@@ -37233,7 +37321,7 @@ function hasSrc(node) {
37233
37321
  function isEmpty(node) {
37234
37322
  for (let i = 0; i < node.children.length; i++) {
37235
37323
  const child = node.children[i];
37236
- if (child.type !== 2 /* TEXT */ || child.content.trim() !== '') {
37324
+ if (child.type !== 2 /* NodeTypes.TEXT */ || child.content.trim() !== '') {
37237
37325
  return false;
37238
37326
  }
37239
37327
  }