@vue/compiler-dom 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 range = 2;
@@ -205,65 +205,65 @@ function createCompilerError(code, loc, messages, additionalMessage) {
205
205
  }
206
206
  const errorMessages = {
207
207
  // parse errors
208
- [0 /* ABRUPT_CLOSING_OF_EMPTY_COMMENT */]: 'Illegal comment.',
209
- [1 /* CDATA_IN_HTML_CONTENT */]: 'CDATA section is allowed only in XML context.',
210
- [2 /* DUPLICATE_ATTRIBUTE */]: 'Duplicate attribute.',
211
- [3 /* END_TAG_WITH_ATTRIBUTES */]: 'End tag cannot have attributes.',
212
- [4 /* END_TAG_WITH_TRAILING_SOLIDUS */]: "Illegal '/' in tags.",
213
- [5 /* EOF_BEFORE_TAG_NAME */]: 'Unexpected EOF in tag.',
214
- [6 /* EOF_IN_CDATA */]: 'Unexpected EOF in CDATA section.',
215
- [7 /* EOF_IN_COMMENT */]: 'Unexpected EOF in comment.',
216
- [8 /* EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT */]: 'Unexpected EOF in script.',
217
- [9 /* EOF_IN_TAG */]: 'Unexpected EOF in tag.',
218
- [10 /* INCORRECTLY_CLOSED_COMMENT */]: 'Incorrectly closed comment.',
219
- [11 /* INCORRECTLY_OPENED_COMMENT */]: 'Incorrectly opened comment.',
220
- [12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */]: "Illegal tag name. Use '&lt;' to print '<'.",
221
- [13 /* MISSING_ATTRIBUTE_VALUE */]: 'Attribute value was expected.',
222
- [14 /* MISSING_END_TAG_NAME */]: 'End tag name was expected.',
223
- [15 /* MISSING_WHITESPACE_BETWEEN_ATTRIBUTES */]: 'Whitespace was expected.',
224
- [16 /* NESTED_COMMENT */]: "Unexpected '<!--' in comment.",
225
- [17 /* UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME */]: 'Attribute name cannot contain U+0022 ("), U+0027 (\'), and U+003C (<).',
226
- [18 /* UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */]: 'Unquoted attribute value cannot contain U+0022 ("), U+0027 (\'), U+003C (<), U+003D (=), and U+0060 (`).',
227
- [19 /* UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */]: "Attribute name cannot start with '='.",
228
- [21 /* UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */]: "'<?' is allowed only in XML context.",
229
- [20 /* UNEXPECTED_NULL_CHARACTER */]: `Unexpected null character.`,
230
- [22 /* UNEXPECTED_SOLIDUS_IN_TAG */]: "Illegal '/' in tags.",
208
+ [0 /* ErrorCodes.ABRUPT_CLOSING_OF_EMPTY_COMMENT */]: 'Illegal comment.',
209
+ [1 /* ErrorCodes.CDATA_IN_HTML_CONTENT */]: 'CDATA section is allowed only in XML context.',
210
+ [2 /* ErrorCodes.DUPLICATE_ATTRIBUTE */]: 'Duplicate attribute.',
211
+ [3 /* ErrorCodes.END_TAG_WITH_ATTRIBUTES */]: 'End tag cannot have attributes.',
212
+ [4 /* ErrorCodes.END_TAG_WITH_TRAILING_SOLIDUS */]: "Illegal '/' in tags.",
213
+ [5 /* ErrorCodes.EOF_BEFORE_TAG_NAME */]: 'Unexpected EOF in tag.',
214
+ [6 /* ErrorCodes.EOF_IN_CDATA */]: 'Unexpected EOF in CDATA section.',
215
+ [7 /* ErrorCodes.EOF_IN_COMMENT */]: 'Unexpected EOF in comment.',
216
+ [8 /* ErrorCodes.EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT */]: 'Unexpected EOF in script.',
217
+ [9 /* ErrorCodes.EOF_IN_TAG */]: 'Unexpected EOF in tag.',
218
+ [10 /* ErrorCodes.INCORRECTLY_CLOSED_COMMENT */]: 'Incorrectly closed comment.',
219
+ [11 /* ErrorCodes.INCORRECTLY_OPENED_COMMENT */]: 'Incorrectly opened comment.',
220
+ [12 /* ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME */]: "Illegal tag name. Use '&lt;' to print '<'.",
221
+ [13 /* ErrorCodes.MISSING_ATTRIBUTE_VALUE */]: 'Attribute value was expected.',
222
+ [14 /* ErrorCodes.MISSING_END_TAG_NAME */]: 'End tag name was expected.',
223
+ [15 /* ErrorCodes.MISSING_WHITESPACE_BETWEEN_ATTRIBUTES */]: 'Whitespace was expected.',
224
+ [16 /* ErrorCodes.NESTED_COMMENT */]: "Unexpected '<!--' in comment.",
225
+ [17 /* ErrorCodes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME */]: 'Attribute name cannot contain U+0022 ("), U+0027 (\'), and U+003C (<).',
226
+ [18 /* ErrorCodes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */]: 'Unquoted attribute value cannot contain U+0022 ("), U+0027 (\'), U+003C (<), U+003D (=), and U+0060 (`).',
227
+ [19 /* ErrorCodes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */]: "Attribute name cannot start with '='.",
228
+ [21 /* ErrorCodes.UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */]: "'<?' is allowed only in XML context.",
229
+ [20 /* ErrorCodes.UNEXPECTED_NULL_CHARACTER */]: `Unexpected null character.`,
230
+ [22 /* ErrorCodes.UNEXPECTED_SOLIDUS_IN_TAG */]: "Illegal '/' in tags.",
231
231
  // Vue-specific parse errors
232
- [23 /* X_INVALID_END_TAG */]: 'Invalid end tag.',
233
- [24 /* X_MISSING_END_TAG */]: 'Element is missing end tag.',
234
- [25 /* X_MISSING_INTERPOLATION_END */]: 'Interpolation end sign was not found.',
235
- [27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */]: 'End bracket for dynamic directive argument was not found. ' +
232
+ [23 /* ErrorCodes.X_INVALID_END_TAG */]: 'Invalid end tag.',
233
+ [24 /* ErrorCodes.X_MISSING_END_TAG */]: 'Element is missing end tag.',
234
+ [25 /* ErrorCodes.X_MISSING_INTERPOLATION_END */]: 'Interpolation end sign was not found.',
235
+ [27 /* ErrorCodes.X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */]: 'End bracket for dynamic directive argument was not found. ' +
236
236
  'Note that dynamic directive argument cannot contain spaces.',
237
- [26 /* X_MISSING_DIRECTIVE_NAME */]: 'Legal directive name was expected.',
237
+ [26 /* ErrorCodes.X_MISSING_DIRECTIVE_NAME */]: 'Legal directive name was expected.',
238
238
  // transform errors
239
- [28 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
240
- [29 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
241
- [30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
242
- [31 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
243
- [32 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
244
- [33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
245
- [34 /* X_V_BIND_NO_EXPRESSION */]: `v-bind is missing expression.`,
246
- [35 /* X_V_ON_NO_EXPRESSION */]: `v-on is missing expression.`,
247
- [36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */]: `Unexpected custom directive on <slot> outlet.`,
248
- [37 /* X_V_SLOT_MIXED_SLOT_USAGE */]: `Mixed v-slot usage on both the component and nested <template>.` +
239
+ [28 /* ErrorCodes.X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
240
+ [29 /* ErrorCodes.X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
241
+ [30 /* ErrorCodes.X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
242
+ [31 /* ErrorCodes.X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
243
+ [32 /* ErrorCodes.X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
244
+ [33 /* ErrorCodes.X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
245
+ [34 /* ErrorCodes.X_V_BIND_NO_EXPRESSION */]: `v-bind is missing expression.`,
246
+ [35 /* ErrorCodes.X_V_ON_NO_EXPRESSION */]: `v-on is missing expression.`,
247
+ [36 /* ErrorCodes.X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */]: `Unexpected custom directive on <slot> outlet.`,
248
+ [37 /* ErrorCodes.X_V_SLOT_MIXED_SLOT_USAGE */]: `Mixed v-slot usage on both the component and nested <template>.` +
249
249
  `When there are multiple named slots, all slots should use <template> ` +
250
250
  `syntax to avoid scope ambiguity.`,
251
- [38 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */]: `Duplicate slot names found. `,
252
- [39 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */]: `Extraneous children found when component already has explicitly named ` +
251
+ [38 /* ErrorCodes.X_V_SLOT_DUPLICATE_SLOT_NAMES */]: `Duplicate slot names found. `,
252
+ [39 /* ErrorCodes.X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */]: `Extraneous children found when component already has explicitly named ` +
253
253
  `default slot. These children will be ignored.`,
254
- [40 /* X_V_SLOT_MISPLACED */]: `v-slot can only be used on components or <template> tags.`,
255
- [41 /* X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
256
- [42 /* X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
257
- [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.`,
258
- [44 /* X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
259
- [45 /* X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
254
+ [40 /* ErrorCodes.X_V_SLOT_MISPLACED */]: `v-slot can only be used on components or <template> tags.`,
255
+ [41 /* ErrorCodes.X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
256
+ [42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
257
+ [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.`,
258
+ [44 /* ErrorCodes.X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
259
+ [45 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
260
260
  // generic errors
261
- [46 /* X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
262
- [47 /* X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
263
- [48 /* X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
264
- [49 /* X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
261
+ [46 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
262
+ [47 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
263
+ [48 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
264
+ [49 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
265
265
  // just to fulfill types
266
- [50 /* __EXTEND_POINT__ */]: ``
266
+ [50 /* ErrorCodes.__EXTEND_POINT__ */]: ``
267
267
  };
268
268
 
269
269
  const FRAGMENT = Symbol(`Fragment` );
@@ -366,7 +366,7 @@ const locStub = {
366
366
  };
367
367
  function createRoot(children, loc = locStub) {
368
368
  return {
369
- type: 0 /* ROOT */,
369
+ type: 0 /* NodeTypes.ROOT */,
370
370
  children,
371
371
  helpers: [],
372
372
  components: [],
@@ -393,7 +393,7 @@ function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps,
393
393
  }
394
394
  }
395
395
  return {
396
- type: 13 /* VNODE_CALL */,
396
+ type: 13 /* NodeTypes.VNODE_CALL */,
397
397
  tag,
398
398
  props,
399
399
  children,
@@ -408,38 +408,38 @@ function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps,
408
408
  }
409
409
  function createArrayExpression(elements, loc = locStub) {
410
410
  return {
411
- type: 17 /* JS_ARRAY_EXPRESSION */,
411
+ type: 17 /* NodeTypes.JS_ARRAY_EXPRESSION */,
412
412
  loc,
413
413
  elements
414
414
  };
415
415
  }
416
416
  function createObjectExpression(properties, loc = locStub) {
417
417
  return {
418
- type: 15 /* JS_OBJECT_EXPRESSION */,
418
+ type: 15 /* NodeTypes.JS_OBJECT_EXPRESSION */,
419
419
  loc,
420
420
  properties
421
421
  };
422
422
  }
423
423
  function createObjectProperty(key, value) {
424
424
  return {
425
- type: 16 /* JS_PROPERTY */,
425
+ type: 16 /* NodeTypes.JS_PROPERTY */,
426
426
  loc: locStub,
427
427
  key: isString(key) ? createSimpleExpression(key, true) : key,
428
428
  value
429
429
  };
430
430
  }
431
- function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0 /* NOT_CONSTANT */) {
431
+ function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0 /* ConstantTypes.NOT_CONSTANT */) {
432
432
  return {
433
- type: 4 /* SIMPLE_EXPRESSION */,
433
+ type: 4 /* NodeTypes.SIMPLE_EXPRESSION */,
434
434
  loc,
435
435
  content,
436
436
  isStatic,
437
- constType: isStatic ? 3 /* CAN_STRINGIFY */ : constType
437
+ constType: isStatic ? 3 /* ConstantTypes.CAN_STRINGIFY */ : constType
438
438
  };
439
439
  }
440
440
  function createInterpolation(content, loc) {
441
441
  return {
442
- type: 5 /* INTERPOLATION */,
442
+ type: 5 /* NodeTypes.INTERPOLATION */,
443
443
  loc,
444
444
  content: isString(content)
445
445
  ? createSimpleExpression(content, false, loc)
@@ -448,14 +448,14 @@ function createInterpolation(content, loc) {
448
448
  }
449
449
  function createCompoundExpression(children, loc = locStub) {
450
450
  return {
451
- type: 8 /* COMPOUND_EXPRESSION */,
451
+ type: 8 /* NodeTypes.COMPOUND_EXPRESSION */,
452
452
  loc,
453
453
  children
454
454
  };
455
455
  }
456
456
  function createCallExpression(callee, args = [], loc = locStub) {
457
457
  return {
458
- type: 14 /* JS_CALL_EXPRESSION */,
458
+ type: 14 /* NodeTypes.JS_CALL_EXPRESSION */,
459
459
  loc,
460
460
  callee,
461
461
  arguments: args
@@ -463,7 +463,7 @@ function createCallExpression(callee, args = [], loc = locStub) {
463
463
  }
464
464
  function createFunctionExpression(params, returns = undefined, newline = false, isSlot = false, loc = locStub) {
465
465
  return {
466
- type: 18 /* JS_FUNCTION_EXPRESSION */,
466
+ type: 18 /* NodeTypes.JS_FUNCTION_EXPRESSION */,
467
467
  params,
468
468
  returns,
469
469
  newline,
@@ -473,7 +473,7 @@ function createFunctionExpression(params, returns = undefined, newline = false,
473
473
  }
474
474
  function createConditionalExpression(test, consequent, alternate, newline = true) {
475
475
  return {
476
- type: 19 /* JS_CONDITIONAL_EXPRESSION */,
476
+ type: 19 /* NodeTypes.JS_CONDITIONAL_EXPRESSION */,
477
477
  test,
478
478
  consequent,
479
479
  alternate,
@@ -483,7 +483,7 @@ function createConditionalExpression(test, consequent, alternate, newline = true
483
483
  }
484
484
  function createCacheExpression(index, value, isVNode = false) {
485
485
  return {
486
- type: 20 /* JS_CACHE_EXPRESSION */,
486
+ type: 20 /* NodeTypes.JS_CACHE_EXPRESSION */,
487
487
  index,
488
488
  value,
489
489
  isVNode,
@@ -492,21 +492,21 @@ function createCacheExpression(index, value, isVNode = false) {
492
492
  }
493
493
  function createBlockStatement(body) {
494
494
  return {
495
- type: 21 /* JS_BLOCK_STATEMENT */,
495
+ type: 21 /* NodeTypes.JS_BLOCK_STATEMENT */,
496
496
  body,
497
497
  loc: locStub
498
498
  };
499
499
  }
500
500
  function createTemplateLiteral(elements) {
501
501
  return {
502
- type: 22 /* JS_TEMPLATE_LITERAL */,
502
+ type: 22 /* NodeTypes.JS_TEMPLATE_LITERAL */,
503
503
  elements,
504
504
  loc: locStub
505
505
  };
506
506
  }
507
507
  function createIfStatement(test, consequent, alternate) {
508
508
  return {
509
- type: 23 /* JS_IF_STATEMENT */,
509
+ type: 23 /* NodeTypes.JS_IF_STATEMENT */,
510
510
  test,
511
511
  consequent,
512
512
  alternate,
@@ -515,7 +515,7 @@ function createIfStatement(test, consequent, alternate) {
515
515
  }
516
516
  function createAssignmentExpression(left, right) {
517
517
  return {
518
- type: 24 /* JS_ASSIGNMENT_EXPRESSION */,
518
+ type: 24 /* NodeTypes.JS_ASSIGNMENT_EXPRESSION */,
519
519
  left,
520
520
  right,
521
521
  loc: locStub
@@ -523,20 +523,20 @@ function createAssignmentExpression(left, right) {
523
523
  }
524
524
  function createSequenceExpression(expressions) {
525
525
  return {
526
- type: 25 /* JS_SEQUENCE_EXPRESSION */,
526
+ type: 25 /* NodeTypes.JS_SEQUENCE_EXPRESSION */,
527
527
  expressions,
528
528
  loc: locStub
529
529
  };
530
530
  }
531
531
  function createReturnStatement(returns) {
532
532
  return {
533
- type: 26 /* JS_RETURN_STATEMENT */,
533
+ type: 26 /* NodeTypes.JS_RETURN_STATEMENT */,
534
534
  returns,
535
535
  loc: locStub
536
536
  };
537
537
  }
538
538
 
539
- const isStaticExp = (p) => p.type === 4 /* SIMPLE_EXPRESSION */ && p.isStatic;
539
+ const isStaticExp = (p) => p.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ && p.isStatic;
540
540
  const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
541
541
  function isCoreComponent(tag) {
542
542
  if (isBuiltInType(tag, 'Teleport')) {
@@ -566,7 +566,7 @@ const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
566
566
  const isMemberExpressionBrowser = (path) => {
567
567
  // remove whitespaces around . or [ first
568
568
  path = path.trim().replace(whitespaceRE, s => s.trim());
569
- let state = 0 /* inMemberExp */;
569
+ let state = 0 /* MemberExpLexState.inMemberExp */;
570
570
  let stateStack = [];
571
571
  let currentOpenBracketCount = 0;
572
572
  let currentOpenParensCount = 0;
@@ -574,25 +574,25 @@ const isMemberExpressionBrowser = (path) => {
574
574
  for (let i = 0; i < path.length; i++) {
575
575
  const char = path.charAt(i);
576
576
  switch (state) {
577
- case 0 /* inMemberExp */:
577
+ case 0 /* MemberExpLexState.inMemberExp */:
578
578
  if (char === '[') {
579
579
  stateStack.push(state);
580
- state = 1 /* inBrackets */;
580
+ state = 1 /* MemberExpLexState.inBrackets */;
581
581
  currentOpenBracketCount++;
582
582
  }
583
583
  else if (char === '(') {
584
584
  stateStack.push(state);
585
- state = 2 /* inParens */;
585
+ state = 2 /* MemberExpLexState.inParens */;
586
586
  currentOpenParensCount++;
587
587
  }
588
588
  else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
589
589
  return false;
590
590
  }
591
591
  break;
592
- case 1 /* inBrackets */:
592
+ case 1 /* MemberExpLexState.inBrackets */:
593
593
  if (char === `'` || char === `"` || char === '`') {
594
594
  stateStack.push(state);
595
- state = 3 /* inString */;
595
+ state = 3 /* MemberExpLexState.inString */;
596
596
  currentStringType = char;
597
597
  }
598
598
  else if (char === `[`) {
@@ -604,10 +604,10 @@ const isMemberExpressionBrowser = (path) => {
604
604
  }
605
605
  }
606
606
  break;
607
- case 2 /* inParens */:
607
+ case 2 /* MemberExpLexState.inParens */:
608
608
  if (char === `'` || char === `"` || char === '`') {
609
609
  stateStack.push(state);
610
- state = 3 /* inString */;
610
+ state = 3 /* MemberExpLexState.inString */;
611
611
  currentStringType = char;
612
612
  }
613
613
  else if (char === `(`) {
@@ -623,7 +623,7 @@ const isMemberExpressionBrowser = (path) => {
623
623
  }
624
624
  }
625
625
  break;
626
- case 3 /* inString */:
626
+ case 3 /* MemberExpLexState.inString */:
627
627
  if (char === currentStringType) {
628
628
  state = stateStack.pop();
629
629
  currentStringType = null;
@@ -680,7 +680,7 @@ function assert(condition, msg) {
680
680
  function findDir(node, name, allowEmpty = false) {
681
681
  for (let i = 0; i < node.props.length; i++) {
682
682
  const p = node.props[i];
683
- if (p.type === 7 /* DIRECTIVE */ &&
683
+ if (p.type === 7 /* NodeTypes.DIRECTIVE */ &&
684
684
  (allowEmpty || p.exp) &&
685
685
  (isString(name) ? p.name === name : name.test(p.name))) {
686
686
  return p;
@@ -690,7 +690,7 @@ function findDir(node, name, allowEmpty = false) {
690
690
  function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
691
691
  for (let i = 0; i < node.props.length; i++) {
692
692
  const p = node.props[i];
693
- if (p.type === 6 /* ATTRIBUTE */) {
693
+ if (p.type === 6 /* NodeTypes.ATTRIBUTE */) {
694
694
  if (dynamicOnly)
695
695
  continue;
696
696
  if (p.name === name && (p.value || allowEmpty)) {
@@ -708,24 +708,24 @@ function isStaticArgOf(arg, name) {
708
708
  return !!(arg && isStaticExp(arg) && arg.content === name);
709
709
  }
710
710
  function hasDynamicKeyVBind(node) {
711
- return node.props.some(p => p.type === 7 /* DIRECTIVE */ &&
711
+ return node.props.some(p => p.type === 7 /* NodeTypes.DIRECTIVE */ &&
712
712
  p.name === 'bind' &&
713
713
  (!p.arg || // v-bind="obj"
714
- p.arg.type !== 4 /* SIMPLE_EXPRESSION */ || // v-bind:[_ctx.foo]
714
+ p.arg.type !== 4 /* NodeTypes.SIMPLE_EXPRESSION */ || // v-bind:[_ctx.foo]
715
715
  !p.arg.isStatic) // v-bind:[foo]
716
716
  );
717
717
  }
718
718
  function isText(node) {
719
- return node.type === 5 /* INTERPOLATION */ || node.type === 2 /* TEXT */;
719
+ return node.type === 5 /* NodeTypes.INTERPOLATION */ || node.type === 2 /* NodeTypes.TEXT */;
720
720
  }
721
721
  function isVSlot(p) {
722
- return p.type === 7 /* DIRECTIVE */ && p.name === 'slot';
722
+ return p.type === 7 /* NodeTypes.DIRECTIVE */ && p.name === 'slot';
723
723
  }
724
724
  function isTemplateNode(node) {
725
- return (node.type === 1 /* ELEMENT */ && node.tagType === 3 /* TEMPLATE */);
725
+ return (node.type === 1 /* NodeTypes.ELEMENT */ && node.tagType === 3 /* ElementTypes.TEMPLATE */);
726
726
  }
727
727
  function isSlotOutlet(node) {
728
- return node.type === 1 /* ELEMENT */ && node.tagType === 2 /* SLOT */;
728
+ return node.type === 1 /* NodeTypes.ELEMENT */ && node.tagType === 2 /* ElementTypes.SLOT */;
729
729
  }
730
730
  function getVNodeHelper(ssr, isComponent) {
731
731
  return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
@@ -737,7 +737,7 @@ const propsHelperSet = new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
737
737
  function getUnnormalizedProps(props, callPath = []) {
738
738
  if (props &&
739
739
  !isString(props) &&
740
- props.type === 14 /* JS_CALL_EXPRESSION */) {
740
+ props.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */) {
741
741
  const callee = props.callee;
742
742
  if (!isString(callee) && propsHelperSet.has(callee)) {
743
743
  return getUnnormalizedProps(props.arguments[0], callPath.concat(props));
@@ -755,12 +755,12 @@ function injectProp(node, prop, context) {
755
755
  *
756
756
  * we need to get the real props before normalization
757
757
  */
758
- let props = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
758
+ let props = node.type === 13 /* NodeTypes.VNODE_CALL */ ? node.props : node.arguments[2];
759
759
  let callPath = [];
760
760
  let parentCall;
761
761
  if (props &&
762
762
  !isString(props) &&
763
- props.type === 14 /* JS_CALL_EXPRESSION */) {
763
+ props.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */) {
764
764
  const ret = getUnnormalizedProps(props);
765
765
  props = ret[0];
766
766
  callPath = ret[1];
@@ -769,12 +769,12 @@ function injectProp(node, prop, context) {
769
769
  if (props == null || isString(props)) {
770
770
  propsWithInjection = createObjectExpression([prop]);
771
771
  }
772
- else if (props.type === 14 /* JS_CALL_EXPRESSION */) {
772
+ else if (props.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */) {
773
773
  // merged props... add ours
774
774
  // only inject key to object literal if it's the first argument so that
775
775
  // if doesn't override user provided keys
776
776
  const first = props.arguments[0];
777
- if (!isString(first) && first.type === 15 /* JS_OBJECT_EXPRESSION */) {
777
+ if (!isString(first) && first.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
778
778
  first.properties.unshift(prop);
779
779
  }
780
780
  else {
@@ -791,12 +791,12 @@ function injectProp(node, prop, context) {
791
791
  }
792
792
  !propsWithInjection && (propsWithInjection = props);
793
793
  }
794
- else if (props.type === 15 /* JS_OBJECT_EXPRESSION */) {
794
+ else if (props.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
795
795
  let alreadyExists = false;
796
796
  // check existing key to avoid overriding user provided keys
797
- if (prop.key.type === 4 /* SIMPLE_EXPRESSION */) {
797
+ if (prop.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
798
798
  const propKeyName = prop.key.content;
799
- alreadyExists = props.properties.some(p => p.key.type === 4 /* SIMPLE_EXPRESSION */ &&
799
+ alreadyExists = props.properties.some(p => p.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
800
800
  p.key.content === propKeyName);
801
801
  }
802
802
  if (!alreadyExists) {
@@ -817,7 +817,7 @@ function injectProp(node, prop, context) {
817
817
  parentCall = callPath[callPath.length - 2];
818
818
  }
819
819
  }
820
- if (node.type === 13 /* VNODE_CALL */) {
820
+ if (node.type === 13 /* NodeTypes.VNODE_CALL */) {
821
821
  if (parentCall) {
822
822
  parentCall.arguments[0] = propsWithInjection;
823
823
  }
@@ -846,45 +846,45 @@ function hasScopeRef(node, ids) {
846
846
  return false;
847
847
  }
848
848
  switch (node.type) {
849
- case 1 /* ELEMENT */:
849
+ case 1 /* NodeTypes.ELEMENT */:
850
850
  for (let i = 0; i < node.props.length; i++) {
851
851
  const p = node.props[i];
852
- if (p.type === 7 /* DIRECTIVE */ &&
852
+ if (p.type === 7 /* NodeTypes.DIRECTIVE */ &&
853
853
  (hasScopeRef(p.arg, ids) || hasScopeRef(p.exp, ids))) {
854
854
  return true;
855
855
  }
856
856
  }
857
857
  return node.children.some(c => hasScopeRef(c, ids));
858
- case 11 /* FOR */:
858
+ case 11 /* NodeTypes.FOR */:
859
859
  if (hasScopeRef(node.source, ids)) {
860
860
  return true;
861
861
  }
862
862
  return node.children.some(c => hasScopeRef(c, ids));
863
- case 9 /* IF */:
863
+ case 9 /* NodeTypes.IF */:
864
864
  return node.branches.some(b => hasScopeRef(b, ids));
865
- case 10 /* IF_BRANCH */:
865
+ case 10 /* NodeTypes.IF_BRANCH */:
866
866
  if (hasScopeRef(node.condition, ids)) {
867
867
  return true;
868
868
  }
869
869
  return node.children.some(c => hasScopeRef(c, ids));
870
- case 4 /* SIMPLE_EXPRESSION */:
870
+ case 4 /* NodeTypes.SIMPLE_EXPRESSION */:
871
871
  return (!node.isStatic &&
872
872
  isSimpleIdentifier(node.content) &&
873
873
  !!ids[node.content]);
874
- case 8 /* COMPOUND_EXPRESSION */:
874
+ case 8 /* NodeTypes.COMPOUND_EXPRESSION */:
875
875
  return node.children.some(c => isObject(c) && hasScopeRef(c, ids));
876
- case 5 /* INTERPOLATION */:
877
- case 12 /* TEXT_CALL */:
876
+ case 5 /* NodeTypes.INTERPOLATION */:
877
+ case 12 /* NodeTypes.TEXT_CALL */:
878
878
  return hasScopeRef(node.content, ids);
879
- case 2 /* TEXT */:
880
- case 3 /* COMMENT */:
879
+ case 2 /* NodeTypes.TEXT */:
880
+ case 3 /* NodeTypes.COMMENT */:
881
881
  return false;
882
882
  default:
883
883
  return false;
884
884
  }
885
885
  }
886
886
  function getMemoedVNodeCall(node) {
887
- if (node.type === 14 /* JS_CALL_EXPRESSION */ && node.callee === WITH_MEMO) {
887
+ if (node.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */ && node.callee === WITH_MEMO) {
888
888
  return node.arguments[1].returns;
889
889
  }
890
890
  else {
@@ -901,23 +901,23 @@ function makeBlock(node, { helper, removeHelper, inSSR }) {
901
901
  }
902
902
 
903
903
  const deprecationData = {
904
- ["COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */]: {
904
+ ["COMPILER_IS_ON_ELEMENT" /* CompilerDeprecationTypes.COMPILER_IS_ON_ELEMENT */]: {
905
905
  message: `Platform-native elements with "is" prop will no longer be ` +
906
906
  `treated as components in Vue 3 unless the "is" value is explicitly ` +
907
907
  `prefixed with "vue:".`,
908
908
  link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
909
909
  },
910
- ["COMPILER_V_BIND_SYNC" /* COMPILER_V_BIND_SYNC */]: {
910
+ ["COMPILER_V_BIND_SYNC" /* CompilerDeprecationTypes.COMPILER_V_BIND_SYNC */]: {
911
911
  message: key => `.sync modifier for v-bind has been removed. Use v-model with ` +
912
912
  `argument instead. \`v-bind:${key}.sync\` should be changed to ` +
913
913
  `\`v-model:${key}\`.`,
914
914
  link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
915
915
  },
916
- ["COMPILER_V_BIND_PROP" /* COMPILER_V_BIND_PROP */]: {
916
+ ["COMPILER_V_BIND_PROP" /* CompilerDeprecationTypes.COMPILER_V_BIND_PROP */]: {
917
917
  message: `.prop modifier for v-bind has been removed and no longer necessary. ` +
918
918
  `Vue 3 will automatically set a binding as DOM property when appropriate.`
919
919
  },
920
- ["COMPILER_V_BIND_OBJECT_ORDER" /* COMPILER_V_BIND_OBJECT_ORDER */]: {
920
+ ["COMPILER_V_BIND_OBJECT_ORDER" /* CompilerDeprecationTypes.COMPILER_V_BIND_OBJECT_ORDER */]: {
921
921
  message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript ` +
922
922
  `object spread: it will now overwrite an existing non-mergeable attribute ` +
923
923
  `that appears before v-bind in the case of conflict. ` +
@@ -925,11 +925,11 @@ const deprecationData = {
925
925
  `You can also suppress this warning if the usage is intended.`,
926
926
  link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
927
927
  },
928
- ["COMPILER_V_ON_NATIVE" /* COMPILER_V_ON_NATIVE */]: {
928
+ ["COMPILER_V_ON_NATIVE" /* CompilerDeprecationTypes.COMPILER_V_ON_NATIVE */]: {
929
929
  message: `.native modifier for v-on has been removed as is no longer necessary.`,
930
930
  link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
931
931
  },
932
- ["COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */]: {
932
+ ["COMPILER_V_IF_V_FOR_PRECEDENCE" /* CompilerDeprecationTypes.COMPILER_V_IF_V_FOR_PRECEDENCE */]: {
933
933
  message: `v-if / v-for precedence when used on the same element has changed ` +
934
934
  `in Vue 3: v-if now takes higher precedence and will no longer have ` +
935
935
  `access to v-for scope variables. It is best to avoid the ambiguity ` +
@@ -937,15 +937,15 @@ const deprecationData = {
937
937
  `data source.`,
938
938
  link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
939
939
  },
940
- ["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
940
+ ["COMPILER_NATIVE_TEMPLATE" /* CompilerDeprecationTypes.COMPILER_NATIVE_TEMPLATE */]: {
941
941
  message: `<template> with no special directives will render as a native template ` +
942
942
  `element instead of its inner content in Vue 3.`
943
943
  },
944
- ["COMPILER_INLINE_TEMPLATE" /* COMPILER_INLINE_TEMPLATE */]: {
944
+ ["COMPILER_INLINE_TEMPLATE" /* CompilerDeprecationTypes.COMPILER_INLINE_TEMPLATE */]: {
945
945
  message: `"inline-template" has been removed in Vue 3.`,
946
946
  link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
947
947
  },
948
- ["COMPILER_FILTER" /* COMPILER_FILTERS */]: {
948
+ ["COMPILER_FILTER" /* CompilerDeprecationTypes.COMPILER_FILTERS */]: {
949
949
  message: `filters have been removed in Vue 3. ` +
950
950
  `The "|" symbol will be treated as native JavaScript bitwise OR operator. ` +
951
951
  `Use method calls or computed properties instead.`,
@@ -1005,8 +1005,8 @@ const decodeMap = {
1005
1005
  };
1006
1006
  const defaultParserOptions = {
1007
1007
  delimiters: [`{{`, `}}`],
1008
- getNamespace: () => 0 /* HTML */,
1009
- getTextMode: () => 0 /* DATA */,
1008
+ getNamespace: () => 0 /* Namespaces.HTML */,
1009
+ getTextMode: () => 0 /* TextModes.DATA */,
1010
1010
  isVoidTag: NO,
1011
1011
  isPreTag: NO,
1012
1012
  isCustomElement: NO,
@@ -1018,7 +1018,7 @@ const defaultParserOptions = {
1018
1018
  function baseParse(content, options = {}) {
1019
1019
  const context = createParserContext(content, options);
1020
1020
  const start = getCursor(context);
1021
- return createRoot(parseChildren(context, 0 /* DATA */, []), getSelection(context, start));
1021
+ return createRoot(parseChildren(context, 0 /* TextModes.DATA */, []), getSelection(context, start));
1022
1022
  }
1023
1023
  function createParserContext(content, rawOptions) {
1024
1024
  const options = extend({}, defaultParserOptions);
@@ -1044,20 +1044,20 @@ function createParserContext(content, rawOptions) {
1044
1044
  }
1045
1045
  function parseChildren(context, mode, ancestors) {
1046
1046
  const parent = last(ancestors);
1047
- const ns = parent ? parent.ns : 0 /* HTML */;
1047
+ const ns = parent ? parent.ns : 0 /* Namespaces.HTML */;
1048
1048
  const nodes = [];
1049
1049
  while (!isEnd(context, mode, ancestors)) {
1050
1050
  const s = context.source;
1051
1051
  let node = undefined;
1052
- if (mode === 0 /* DATA */ || mode === 1 /* RCDATA */) {
1052
+ if (mode === 0 /* TextModes.DATA */ || mode === 1 /* TextModes.RCDATA */) {
1053
1053
  if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
1054
1054
  // '{{'
1055
1055
  node = parseInterpolation(context, mode);
1056
1056
  }
1057
- else if (mode === 0 /* DATA */ && s[0] === '<') {
1057
+ else if (mode === 0 /* TextModes.DATA */ && s[0] === '<') {
1058
1058
  // https://html.spec.whatwg.org/multipage/parsing.html#tag-open-state
1059
1059
  if (s.length === 1) {
1060
- emitError(context, 5 /* EOF_BEFORE_TAG_NAME */, 1);
1060
+ emitError(context, 5 /* ErrorCodes.EOF_BEFORE_TAG_NAME */, 1);
1061
1061
  }
1062
1062
  else if (s[1] === '!') {
1063
1063
  // https://html.spec.whatwg.org/multipage/parsing.html#markup-declaration-open-state
@@ -1069,57 +1069,57 @@ function parseChildren(context, mode, ancestors) {
1069
1069
  node = parseBogusComment(context);
1070
1070
  }
1071
1071
  else if (startsWith(s, '<![CDATA[')) {
1072
- if (ns !== 0 /* HTML */) {
1072
+ if (ns !== 0 /* Namespaces.HTML */) {
1073
1073
  node = parseCDATA(context, ancestors);
1074
1074
  }
1075
1075
  else {
1076
- emitError(context, 1 /* CDATA_IN_HTML_CONTENT */);
1076
+ emitError(context, 1 /* ErrorCodes.CDATA_IN_HTML_CONTENT */);
1077
1077
  node = parseBogusComment(context);
1078
1078
  }
1079
1079
  }
1080
1080
  else {
1081
- emitError(context, 11 /* INCORRECTLY_OPENED_COMMENT */);
1081
+ emitError(context, 11 /* ErrorCodes.INCORRECTLY_OPENED_COMMENT */);
1082
1082
  node = parseBogusComment(context);
1083
1083
  }
1084
1084
  }
1085
1085
  else if (s[1] === '/') {
1086
1086
  // https://html.spec.whatwg.org/multipage/parsing.html#end-tag-open-state
1087
1087
  if (s.length === 2) {
1088
- emitError(context, 5 /* EOF_BEFORE_TAG_NAME */, 2);
1088
+ emitError(context, 5 /* ErrorCodes.EOF_BEFORE_TAG_NAME */, 2);
1089
1089
  }
1090
1090
  else if (s[2] === '>') {
1091
- emitError(context, 14 /* MISSING_END_TAG_NAME */, 2);
1091
+ emitError(context, 14 /* ErrorCodes.MISSING_END_TAG_NAME */, 2);
1092
1092
  advanceBy(context, 3);
1093
1093
  continue;
1094
1094
  }
1095
1095
  else if (/[a-z]/i.test(s[2])) {
1096
- emitError(context, 23 /* X_INVALID_END_TAG */);
1097
- parseTag(context, 1 /* End */, parent);
1096
+ emitError(context, 23 /* ErrorCodes.X_INVALID_END_TAG */);
1097
+ parseTag(context, 1 /* TagType.End */, parent);
1098
1098
  continue;
1099
1099
  }
1100
1100
  else {
1101
- emitError(context, 12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */, 2);
1101
+ emitError(context, 12 /* ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME */, 2);
1102
1102
  node = parseBogusComment(context);
1103
1103
  }
1104
1104
  }
1105
1105
  else if (/[a-z]/i.test(s[1])) {
1106
1106
  node = parseElement(context, ancestors);
1107
1107
  // 2.x <template> with no directive compat
1108
- if (isCompatEnabled("COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */, context) &&
1108
+ if (isCompatEnabled("COMPILER_NATIVE_TEMPLATE" /* CompilerDeprecationTypes.COMPILER_NATIVE_TEMPLATE */, context) &&
1109
1109
  node &&
1110
1110
  node.tag === 'template' &&
1111
- !node.props.some(p => p.type === 7 /* DIRECTIVE */ &&
1111
+ !node.props.some(p => p.type === 7 /* NodeTypes.DIRECTIVE */ &&
1112
1112
  isSpecialTemplateDirective(p.name))) {
1113
- warnDeprecation("COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */, context, node.loc);
1113
+ warnDeprecation("COMPILER_NATIVE_TEMPLATE" /* CompilerDeprecationTypes.COMPILER_NATIVE_TEMPLATE */, context, node.loc);
1114
1114
  node = node.children;
1115
1115
  }
1116
1116
  }
1117
1117
  else if (s[1] === '?') {
1118
- emitError(context, 21 /* UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */, 1);
1118
+ emitError(context, 21 /* ErrorCodes.UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */, 1);
1119
1119
  node = parseBogusComment(context);
1120
1120
  }
1121
1121
  else {
1122
- emitError(context, 12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */, 1);
1122
+ emitError(context, 12 /* ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME */, 1);
1123
1123
  }
1124
1124
  }
1125
1125
  }
@@ -1137,11 +1137,11 @@ function parseChildren(context, mode, ancestors) {
1137
1137
  }
1138
1138
  // Whitespace handling strategy like v2
1139
1139
  let removedWhitespace = false;
1140
- if (mode !== 2 /* RAWTEXT */ && mode !== 1 /* RCDATA */) {
1140
+ if (mode !== 2 /* TextModes.RAWTEXT */ && mode !== 1 /* TextModes.RCDATA */) {
1141
1141
  const shouldCondense = context.options.whitespace !== 'preserve';
1142
1142
  for (let i = 0; i < nodes.length; i++) {
1143
1143
  const node = nodes[i];
1144
- if (!context.inPre && node.type === 2 /* TEXT */) {
1144
+ if (!context.inPre && node.type === 2 /* NodeTypes.TEXT */) {
1145
1145
  if (!/[^\t\r\n\f ]/.test(node.content)) {
1146
1146
  const prev = nodes[i - 1];
1147
1147
  const next = nodes[i + 1];
@@ -1152,10 +1152,10 @@ function parseChildren(context, mode, ancestors) {
1152
1152
  if (!prev ||
1153
1153
  !next ||
1154
1154
  (shouldCondense &&
1155
- (prev.type === 3 /* COMMENT */ ||
1156
- next.type === 3 /* COMMENT */ ||
1157
- (prev.type === 1 /* ELEMENT */ &&
1158
- next.type === 1 /* ELEMENT */ &&
1155
+ (prev.type === 3 /* NodeTypes.COMMENT */ ||
1156
+ next.type === 3 /* NodeTypes.COMMENT */ ||
1157
+ (prev.type === 1 /* NodeTypes.ELEMENT */ &&
1158
+ next.type === 1 /* NodeTypes.ELEMENT */ &&
1159
1159
  /[\r\n]/.test(node.content))))) {
1160
1160
  removedWhitespace = true;
1161
1161
  nodes[i] = null;
@@ -1172,7 +1172,7 @@ function parseChildren(context, mode, ancestors) {
1172
1172
  }
1173
1173
  }
1174
1174
  // Remove comment nodes if desired by configuration.
1175
- else if (node.type === 3 /* COMMENT */ && !context.options.comments) {
1175
+ else if (node.type === 3 /* NodeTypes.COMMENT */ && !context.options.comments) {
1176
1176
  removedWhitespace = true;
1177
1177
  nodes[i] = null;
1178
1178
  }
@@ -1181,7 +1181,7 @@ function parseChildren(context, mode, ancestors) {
1181
1181
  // remove leading newline per html spec
1182
1182
  // https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element
1183
1183
  const first = nodes[0];
1184
- if (first && first.type === 2 /* TEXT */) {
1184
+ if (first && first.type === 2 /* NodeTypes.TEXT */) {
1185
1185
  first.content = first.content.replace(/^\r?\n/, '');
1186
1186
  }
1187
1187
  }
@@ -1189,12 +1189,12 @@ function parseChildren(context, mode, ancestors) {
1189
1189
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
1190
1190
  }
1191
1191
  function pushNode(nodes, node) {
1192
- if (node.type === 2 /* TEXT */) {
1192
+ if (node.type === 2 /* NodeTypes.TEXT */) {
1193
1193
  const prev = last(nodes);
1194
1194
  // Merge if both this and the previous node are text and those are
1195
1195
  // consecutive. This happens for cases like "a < b".
1196
1196
  if (prev &&
1197
- prev.type === 2 /* TEXT */ &&
1197
+ prev.type === 2 /* NodeTypes.TEXT */ &&
1198
1198
  prev.loc.end.offset === node.loc.start.offset) {
1199
1199
  prev.content += node.content;
1200
1200
  prev.loc.end = node.loc.end;
@@ -1206,9 +1206,9 @@ function pushNode(nodes, node) {
1206
1206
  }
1207
1207
  function parseCDATA(context, ancestors) {
1208
1208
  advanceBy(context, 9);
1209
- const nodes = parseChildren(context, 3 /* CDATA */, ancestors);
1209
+ const nodes = parseChildren(context, 3 /* TextModes.CDATA */, ancestors);
1210
1210
  if (context.source.length === 0) {
1211
- emitError(context, 6 /* EOF_IN_CDATA */);
1211
+ emitError(context, 6 /* ErrorCodes.EOF_IN_CDATA */);
1212
1212
  }
1213
1213
  else {
1214
1214
  advanceBy(context, 3);
@@ -1223,14 +1223,14 @@ function parseComment(context) {
1223
1223
  if (!match) {
1224
1224
  content = context.source.slice(4);
1225
1225
  advanceBy(context, context.source.length);
1226
- emitError(context, 7 /* EOF_IN_COMMENT */);
1226
+ emitError(context, 7 /* ErrorCodes.EOF_IN_COMMENT */);
1227
1227
  }
1228
1228
  else {
1229
1229
  if (match.index <= 3) {
1230
- emitError(context, 0 /* ABRUPT_CLOSING_OF_EMPTY_COMMENT */);
1230
+ emitError(context, 0 /* ErrorCodes.ABRUPT_CLOSING_OF_EMPTY_COMMENT */);
1231
1231
  }
1232
1232
  if (match[1]) {
1233
- emitError(context, 10 /* INCORRECTLY_CLOSED_COMMENT */);
1233
+ emitError(context, 10 /* ErrorCodes.INCORRECTLY_CLOSED_COMMENT */);
1234
1234
  }
1235
1235
  content = context.source.slice(4, match.index);
1236
1236
  // Advancing with reporting nested comments.
@@ -1239,14 +1239,14 @@ function parseComment(context) {
1239
1239
  while ((nestedIndex = s.indexOf('<!--', prevIndex)) !== -1) {
1240
1240
  advanceBy(context, nestedIndex - prevIndex + 1);
1241
1241
  if (nestedIndex + 4 < s.length) {
1242
- emitError(context, 16 /* NESTED_COMMENT */);
1242
+ emitError(context, 16 /* ErrorCodes.NESTED_COMMENT */);
1243
1243
  }
1244
1244
  prevIndex = nestedIndex + 1;
1245
1245
  }
1246
1246
  advanceBy(context, match.index + match[0].length - prevIndex + 1);
1247
1247
  }
1248
1248
  return {
1249
- type: 3 /* COMMENT */,
1249
+ type: 3 /* NodeTypes.COMMENT */,
1250
1250
  content,
1251
1251
  loc: getSelection(context, start)
1252
1252
  };
@@ -1265,7 +1265,7 @@ function parseBogusComment(context) {
1265
1265
  advanceBy(context, closeIndex + 1);
1266
1266
  }
1267
1267
  return {
1268
- type: 3 /* COMMENT */,
1268
+ type: 3 /* NodeTypes.COMMENT */,
1269
1269
  content,
1270
1270
  loc: getSelection(context, start)
1271
1271
  };
@@ -1275,7 +1275,7 @@ function parseElement(context, ancestors) {
1275
1275
  const wasInPre = context.inPre;
1276
1276
  const wasInVPre = context.inVPre;
1277
1277
  const parent = last(ancestors);
1278
- const element = parseTag(context, 0 /* Start */, parent);
1278
+ const element = parseTag(context, 0 /* TagType.Start */, parent);
1279
1279
  const isPreBoundary = context.inPre && !wasInPre;
1280
1280
  const isVPreBoundary = context.inVPre && !wasInVPre;
1281
1281
  if (element.isSelfClosing || context.options.isVoidTag(element.tag)) {
@@ -1295,12 +1295,12 @@ function parseElement(context, ancestors) {
1295
1295
  ancestors.pop();
1296
1296
  // 2.x inline-template compat
1297
1297
  {
1298
- const inlineTemplateProp = element.props.find(p => p.type === 6 /* ATTRIBUTE */ && p.name === 'inline-template');
1298
+ const inlineTemplateProp = element.props.find(p => p.type === 6 /* NodeTypes.ATTRIBUTE */ && p.name === 'inline-template');
1299
1299
  if (inlineTemplateProp &&
1300
- checkCompatEnabled("COMPILER_INLINE_TEMPLATE" /* COMPILER_INLINE_TEMPLATE */, context, inlineTemplateProp.loc)) {
1300
+ checkCompatEnabled("COMPILER_INLINE_TEMPLATE" /* CompilerDeprecationTypes.COMPILER_INLINE_TEMPLATE */, context, inlineTemplateProp.loc)) {
1301
1301
  const loc = getSelection(context, element.loc.end);
1302
1302
  inlineTemplateProp.value = {
1303
- type: 2 /* TEXT */,
1303
+ type: 2 /* NodeTypes.TEXT */,
1304
1304
  content: loc.source,
1305
1305
  loc
1306
1306
  };
@@ -1309,14 +1309,14 @@ function parseElement(context, ancestors) {
1309
1309
  element.children = children;
1310
1310
  // End tag.
1311
1311
  if (startsWithEndTagOpen(context.source, element.tag)) {
1312
- parseTag(context, 1 /* End */, parent);
1312
+ parseTag(context, 1 /* TagType.End */, parent);
1313
1313
  }
1314
1314
  else {
1315
- emitError(context, 24 /* X_MISSING_END_TAG */, 0, element.loc.start);
1315
+ emitError(context, 24 /* ErrorCodes.X_MISSING_END_TAG */, 0, element.loc.start);
1316
1316
  if (context.source.length === 0 && element.tag.toLowerCase() === 'script') {
1317
1317
  const first = children[0];
1318
1318
  if (first && startsWith(first.loc.source, '<!--')) {
1319
- emitError(context, 8 /* EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT */);
1319
+ emitError(context, 8 /* ErrorCodes.EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT */);
1320
1320
  }
1321
1321
  }
1322
1322
  }
@@ -1348,9 +1348,9 @@ function parseTag(context, type, parent) {
1348
1348
  // Attributes.
1349
1349
  let props = parseAttributes(context, type);
1350
1350
  // check v-pre
1351
- if (type === 0 /* Start */ &&
1351
+ if (type === 0 /* TagType.Start */ &&
1352
1352
  !context.inVPre &&
1353
- props.some(p => p.type === 7 /* DIRECTIVE */ && p.name === 'pre')) {
1353
+ props.some(p => p.type === 7 /* NodeTypes.DIRECTIVE */ && p.name === 'pre')) {
1354
1354
  context.inVPre = true;
1355
1355
  // reset context
1356
1356
  extend(context, cursor);
@@ -1361,25 +1361,25 @@ function parseTag(context, type, parent) {
1361
1361
  // Tag close.
1362
1362
  let isSelfClosing = false;
1363
1363
  if (context.source.length === 0) {
1364
- emitError(context, 9 /* EOF_IN_TAG */);
1364
+ emitError(context, 9 /* ErrorCodes.EOF_IN_TAG */);
1365
1365
  }
1366
1366
  else {
1367
1367
  isSelfClosing = startsWith(context.source, '/>');
1368
- if (type === 1 /* End */ && isSelfClosing) {
1369
- emitError(context, 4 /* END_TAG_WITH_TRAILING_SOLIDUS */);
1368
+ if (type === 1 /* TagType.End */ && isSelfClosing) {
1369
+ emitError(context, 4 /* ErrorCodes.END_TAG_WITH_TRAILING_SOLIDUS */);
1370
1370
  }
1371
1371
  advanceBy(context, isSelfClosing ? 2 : 1);
1372
1372
  }
1373
- if (type === 1 /* End */) {
1373
+ if (type === 1 /* TagType.End */) {
1374
1374
  return;
1375
1375
  }
1376
1376
  // 2.x deprecation checks
1377
- if (isCompatEnabled("COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */, context)) {
1377
+ if (isCompatEnabled("COMPILER_V_IF_V_FOR_PRECEDENCE" /* CompilerDeprecationTypes.COMPILER_V_IF_V_FOR_PRECEDENCE */, context)) {
1378
1378
  let hasIf = false;
1379
1379
  let hasFor = false;
1380
1380
  for (let i = 0; i < props.length; i++) {
1381
1381
  const p = props[i];
1382
- if (p.type === 7 /* DIRECTIVE */) {
1382
+ if (p.type === 7 /* NodeTypes.DIRECTIVE */) {
1383
1383
  if (p.name === 'if') {
1384
1384
  hasIf = true;
1385
1385
  }
@@ -1388,27 +1388,27 @@ function parseTag(context, type, parent) {
1388
1388
  }
1389
1389
  }
1390
1390
  if (hasIf && hasFor) {
1391
- warnDeprecation("COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */, context, getSelection(context, start));
1391
+ warnDeprecation("COMPILER_V_IF_V_FOR_PRECEDENCE" /* CompilerDeprecationTypes.COMPILER_V_IF_V_FOR_PRECEDENCE */, context, getSelection(context, start));
1392
1392
  break;
1393
1393
  }
1394
1394
  }
1395
1395
  }
1396
- let tagType = 0 /* ELEMENT */;
1396
+ let tagType = 0 /* ElementTypes.ELEMENT */;
1397
1397
  if (!context.inVPre) {
1398
1398
  if (tag === 'slot') {
1399
- tagType = 2 /* SLOT */;
1399
+ tagType = 2 /* ElementTypes.SLOT */;
1400
1400
  }
1401
1401
  else if (tag === 'template') {
1402
- if (props.some(p => p.type === 7 /* DIRECTIVE */ && isSpecialTemplateDirective(p.name))) {
1403
- tagType = 3 /* TEMPLATE */;
1402
+ if (props.some(p => p.type === 7 /* NodeTypes.DIRECTIVE */ && isSpecialTemplateDirective(p.name))) {
1403
+ tagType = 3 /* ElementTypes.TEMPLATE */;
1404
1404
  }
1405
1405
  }
1406
1406
  else if (isComponent(tag, props, context)) {
1407
- tagType = 1 /* COMPONENT */;
1407
+ tagType = 1 /* ElementTypes.COMPONENT */;
1408
1408
  }
1409
1409
  }
1410
1410
  return {
1411
- type: 1 /* ELEMENT */,
1411
+ type: 1 /* NodeTypes.ELEMENT */,
1412
1412
  ns,
1413
1413
  tag,
1414
1414
  tagType,
@@ -1435,12 +1435,12 @@ function isComponent(tag, props, context) {
1435
1435
  // casting
1436
1436
  for (let i = 0; i < props.length; i++) {
1437
1437
  const p = props[i];
1438
- if (p.type === 6 /* ATTRIBUTE */) {
1438
+ if (p.type === 6 /* NodeTypes.ATTRIBUTE */) {
1439
1439
  if (p.name === 'is' && p.value) {
1440
1440
  if (p.value.content.startsWith('vue:')) {
1441
1441
  return true;
1442
1442
  }
1443
- else if (checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
1443
+ else if (checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* CompilerDeprecationTypes.COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
1444
1444
  return true;
1445
1445
  }
1446
1446
  }
@@ -1456,7 +1456,7 @@ function isComponent(tag, props, context) {
1456
1456
  p.name === 'bind' &&
1457
1457
  isStaticArgOf(p.arg, 'is') &&
1458
1458
  true &&
1459
- checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
1459
+ checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* CompilerDeprecationTypes.COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
1460
1460
  return true;
1461
1461
  }
1462
1462
  }
@@ -1469,27 +1469,27 @@ function parseAttributes(context, type) {
1469
1469
  !startsWith(context.source, '>') &&
1470
1470
  !startsWith(context.source, '/>')) {
1471
1471
  if (startsWith(context.source, '/')) {
1472
- emitError(context, 22 /* UNEXPECTED_SOLIDUS_IN_TAG */);
1472
+ emitError(context, 22 /* ErrorCodes.UNEXPECTED_SOLIDUS_IN_TAG */);
1473
1473
  advanceBy(context, 1);
1474
1474
  advanceSpaces(context);
1475
1475
  continue;
1476
1476
  }
1477
- if (type === 1 /* End */) {
1478
- emitError(context, 3 /* END_TAG_WITH_ATTRIBUTES */);
1477
+ if (type === 1 /* TagType.End */) {
1478
+ emitError(context, 3 /* ErrorCodes.END_TAG_WITH_ATTRIBUTES */);
1479
1479
  }
1480
1480
  const attr = parseAttribute(context, attributeNames);
1481
1481
  // Trim whitespace between class
1482
1482
  // https://github.com/vuejs/core/issues/4251
1483
- if (attr.type === 6 /* ATTRIBUTE */ &&
1483
+ if (attr.type === 6 /* NodeTypes.ATTRIBUTE */ &&
1484
1484
  attr.value &&
1485
1485
  attr.name === 'class') {
1486
1486
  attr.value.content = attr.value.content.replace(/\s+/g, ' ').trim();
1487
1487
  }
1488
- if (type === 0 /* Start */) {
1488
+ if (type === 0 /* TagType.Start */) {
1489
1489
  props.push(attr);
1490
1490
  }
1491
1491
  if (/^[^\t\r\n\f />]/.test(context.source)) {
1492
- emitError(context, 15 /* MISSING_WHITESPACE_BETWEEN_ATTRIBUTES */);
1492
+ emitError(context, 15 /* ErrorCodes.MISSING_WHITESPACE_BETWEEN_ATTRIBUTES */);
1493
1493
  }
1494
1494
  advanceSpaces(context);
1495
1495
  }
@@ -1501,17 +1501,17 @@ function parseAttribute(context, nameSet) {
1501
1501
  const match = /^[^\t\r\n\f />][^\t\r\n\f />=]*/.exec(context.source);
1502
1502
  const name = match[0];
1503
1503
  if (nameSet.has(name)) {
1504
- emitError(context, 2 /* DUPLICATE_ATTRIBUTE */);
1504
+ emitError(context, 2 /* ErrorCodes.DUPLICATE_ATTRIBUTE */);
1505
1505
  }
1506
1506
  nameSet.add(name);
1507
1507
  if (name[0] === '=') {
1508
- emitError(context, 19 /* UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */);
1508
+ emitError(context, 19 /* ErrorCodes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */);
1509
1509
  }
1510
1510
  {
1511
1511
  const pattern = /["'<]/g;
1512
1512
  let m;
1513
1513
  while ((m = pattern.exec(name))) {
1514
- emitError(context, 17 /* UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME */, m.index);
1514
+ emitError(context, 17 /* ErrorCodes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME */, m.index);
1515
1515
  }
1516
1516
  }
1517
1517
  advanceBy(context, name.length);
@@ -1523,7 +1523,7 @@ function parseAttribute(context, nameSet) {
1523
1523
  advanceSpaces(context);
1524
1524
  value = parseAttributeValue(context);
1525
1525
  if (!value) {
1526
- emitError(context, 13 /* MISSING_ATTRIBUTE_VALUE */);
1526
+ emitError(context, 13 /* ErrorCodes.MISSING_ATTRIBUTE_VALUE */);
1527
1527
  }
1528
1528
  }
1529
1529
  const loc = getSelection(context, start);
@@ -1546,7 +1546,7 @@ function parseAttribute(context, nameSet) {
1546
1546
  if (content.startsWith('[')) {
1547
1547
  isStatic = false;
1548
1548
  if (!content.endsWith(']')) {
1549
- emitError(context, 27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
1549
+ emitError(context, 27 /* ErrorCodes.X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
1550
1550
  content = content.slice(1);
1551
1551
  }
1552
1552
  else {
@@ -1560,12 +1560,12 @@ function parseAttribute(context, nameSet) {
1560
1560
  content += match[3] || '';
1561
1561
  }
1562
1562
  arg = {
1563
- type: 4 /* SIMPLE_EXPRESSION */,
1563
+ type: 4 /* NodeTypes.SIMPLE_EXPRESSION */,
1564
1564
  content,
1565
1565
  isStatic,
1566
1566
  constType: isStatic
1567
- ? 3 /* CAN_STRINGIFY */
1568
- : 0 /* NOT_CONSTANT */,
1567
+ ? 3 /* ConstantTypes.CAN_STRINGIFY */
1568
+ : 0 /* ConstantTypes.NOT_CONSTANT */,
1569
1569
  loc
1570
1570
  };
1571
1571
  }
@@ -1582,24 +1582,24 @@ function parseAttribute(context, nameSet) {
1582
1582
  // 2.x compat v-bind:foo.sync -> v-model:foo
1583
1583
  if (dirName === 'bind' && arg) {
1584
1584
  if (modifiers.includes('sync') &&
1585
- checkCompatEnabled("COMPILER_V_BIND_SYNC" /* COMPILER_V_BIND_SYNC */, context, loc, arg.loc.source)) {
1585
+ checkCompatEnabled("COMPILER_V_BIND_SYNC" /* CompilerDeprecationTypes.COMPILER_V_BIND_SYNC */, context, loc, arg.loc.source)) {
1586
1586
  dirName = 'model';
1587
1587
  modifiers.splice(modifiers.indexOf('sync'), 1);
1588
1588
  }
1589
1589
  if (modifiers.includes('prop')) {
1590
- checkCompatEnabled("COMPILER_V_BIND_PROP" /* COMPILER_V_BIND_PROP */, context, loc);
1590
+ checkCompatEnabled("COMPILER_V_BIND_PROP" /* CompilerDeprecationTypes.COMPILER_V_BIND_PROP */, context, loc);
1591
1591
  }
1592
1592
  }
1593
1593
  return {
1594
- type: 7 /* DIRECTIVE */,
1594
+ type: 7 /* NodeTypes.DIRECTIVE */,
1595
1595
  name: dirName,
1596
1596
  exp: value && {
1597
- type: 4 /* SIMPLE_EXPRESSION */,
1597
+ type: 4 /* NodeTypes.SIMPLE_EXPRESSION */,
1598
1598
  content: value.content,
1599
1599
  isStatic: false,
1600
1600
  // Treat as non-constant by default. This can be potentially set to
1601
1601
  // other values by `transformExpression` to make it eligible for hoisting.
1602
- constType: 0 /* NOT_CONSTANT */,
1602
+ constType: 0 /* ConstantTypes.NOT_CONSTANT */,
1603
1603
  loc: value.loc
1604
1604
  },
1605
1605
  arg,
@@ -1609,13 +1609,13 @@ function parseAttribute(context, nameSet) {
1609
1609
  }
1610
1610
  // missing directive name or illegal directive name
1611
1611
  if (!context.inVPre && startsWith(name, 'v-')) {
1612
- emitError(context, 26 /* X_MISSING_DIRECTIVE_NAME */);
1612
+ emitError(context, 26 /* ErrorCodes.X_MISSING_DIRECTIVE_NAME */);
1613
1613
  }
1614
1614
  return {
1615
- type: 6 /* ATTRIBUTE */,
1615
+ type: 6 /* NodeTypes.ATTRIBUTE */,
1616
1616
  name,
1617
1617
  value: value && {
1618
- type: 2 /* TEXT */,
1618
+ type: 2 /* NodeTypes.TEXT */,
1619
1619
  content: value.content,
1620
1620
  loc: value.loc
1621
1621
  },
@@ -1632,10 +1632,10 @@ function parseAttributeValue(context) {
1632
1632
  advanceBy(context, 1);
1633
1633
  const endIndex = context.source.indexOf(quote);
1634
1634
  if (endIndex === -1) {
1635
- content = parseTextData(context, context.source.length, 4 /* ATTRIBUTE_VALUE */);
1635
+ content = parseTextData(context, context.source.length, 4 /* TextModes.ATTRIBUTE_VALUE */);
1636
1636
  }
1637
1637
  else {
1638
- content = parseTextData(context, endIndex, 4 /* ATTRIBUTE_VALUE */);
1638
+ content = parseTextData(context, endIndex, 4 /* TextModes.ATTRIBUTE_VALUE */);
1639
1639
  advanceBy(context, 1);
1640
1640
  }
1641
1641
  }
@@ -1648,9 +1648,9 @@ function parseAttributeValue(context) {
1648
1648
  const unexpectedChars = /["'<=`]/g;
1649
1649
  let m;
1650
1650
  while ((m = unexpectedChars.exec(match[0]))) {
1651
- emitError(context, 18 /* UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */, m.index);
1651
+ emitError(context, 18 /* ErrorCodes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */, m.index);
1652
1652
  }
1653
- content = parseTextData(context, match[0].length, 4 /* ATTRIBUTE_VALUE */);
1653
+ content = parseTextData(context, match[0].length, 4 /* TextModes.ATTRIBUTE_VALUE */);
1654
1654
  }
1655
1655
  return { content, isQuoted, loc: getSelection(context, start) };
1656
1656
  }
@@ -1658,7 +1658,7 @@ function parseInterpolation(context, mode) {
1658
1658
  const [open, close] = context.options.delimiters;
1659
1659
  const closeIndex = context.source.indexOf(close, open.length);
1660
1660
  if (closeIndex === -1) {
1661
- emitError(context, 25 /* X_MISSING_INTERPOLATION_END */);
1661
+ emitError(context, 25 /* ErrorCodes.X_MISSING_INTERPOLATION_END */);
1662
1662
  return undefined;
1663
1663
  }
1664
1664
  const start = getCursor(context);
@@ -1677,12 +1677,12 @@ function parseInterpolation(context, mode) {
1677
1677
  advancePositionWithMutation(innerEnd, rawContent, endOffset);
1678
1678
  advanceBy(context, close.length);
1679
1679
  return {
1680
- type: 5 /* INTERPOLATION */,
1680
+ type: 5 /* NodeTypes.INTERPOLATION */,
1681
1681
  content: {
1682
- type: 4 /* SIMPLE_EXPRESSION */,
1682
+ type: 4 /* NodeTypes.SIMPLE_EXPRESSION */,
1683
1683
  isStatic: false,
1684
1684
  // Set `isConstant` to false by default and will decide in transformExpression
1685
- constType: 0 /* NOT_CONSTANT */,
1685
+ constType: 0 /* ConstantTypes.NOT_CONSTANT */,
1686
1686
  content,
1687
1687
  loc: getSelection(context, innerStart, innerEnd)
1688
1688
  },
@@ -1690,7 +1690,7 @@ function parseInterpolation(context, mode) {
1690
1690
  };
1691
1691
  }
1692
1692
  function parseText(context, mode) {
1693
- const endTokens = mode === 3 /* CDATA */ ? [']]>'] : ['<', context.options.delimiters[0]];
1693
+ const endTokens = mode === 3 /* TextModes.CDATA */ ? [']]>'] : ['<', context.options.delimiters[0]];
1694
1694
  let endIndex = context.source.length;
1695
1695
  for (let i = 0; i < endTokens.length; i++) {
1696
1696
  const index = context.source.indexOf(endTokens[i], 1);
@@ -1701,7 +1701,7 @@ function parseText(context, mode) {
1701
1701
  const start = getCursor(context);
1702
1702
  const content = parseTextData(context, endIndex, mode);
1703
1703
  return {
1704
- type: 2 /* TEXT */,
1704
+ type: 2 /* NodeTypes.TEXT */,
1705
1705
  content,
1706
1706
  loc: getSelection(context, start)
1707
1707
  };
@@ -1713,14 +1713,14 @@ function parseText(context, mode) {
1713
1713
  function parseTextData(context, length, mode) {
1714
1714
  const rawText = context.source.slice(0, length);
1715
1715
  advanceBy(context, length);
1716
- if (mode === 2 /* RAWTEXT */ ||
1717
- mode === 3 /* CDATA */ ||
1716
+ if (mode === 2 /* TextModes.RAWTEXT */ ||
1717
+ mode === 3 /* TextModes.CDATA */ ||
1718
1718
  !rawText.includes('&')) {
1719
1719
  return rawText;
1720
1720
  }
1721
1721
  else {
1722
1722
  // DATA or RCDATA containing "&"". Entity decoding required.
1723
- return context.options.decodeEntities(rawText, mode === 4 /* ATTRIBUTE_VALUE */);
1723
+ return context.options.decodeEntities(rawText, mode === 4 /* TextModes.ATTRIBUTE_VALUE */);
1724
1724
  }
1725
1725
  }
1726
1726
  function getCursor(context) {
@@ -1769,7 +1769,7 @@ function emitError(context, code, offset, loc = getCursor(context)) {
1769
1769
  function isEnd(context, mode, ancestors) {
1770
1770
  const s = context.source;
1771
1771
  switch (mode) {
1772
- case 0 /* DATA */:
1772
+ case 0 /* TextModes.DATA */:
1773
1773
  if (startsWith(s, '</')) {
1774
1774
  // TODO: probably bad performance
1775
1775
  for (let i = ancestors.length - 1; i >= 0; --i) {
@@ -1779,15 +1779,15 @@ function isEnd(context, mode, ancestors) {
1779
1779
  }
1780
1780
  }
1781
1781
  break;
1782
- case 1 /* RCDATA */:
1783
- case 2 /* RAWTEXT */: {
1782
+ case 1 /* TextModes.RCDATA */:
1783
+ case 2 /* TextModes.RAWTEXT */: {
1784
1784
  const parent = last(ancestors);
1785
1785
  if (parent && startsWithEndTagOpen(s, parent.tag)) {
1786
1786
  return true;
1787
1787
  }
1788
1788
  break;
1789
1789
  }
1790
- case 3 /* CDATA */:
1790
+ case 3 /* TextModes.CDATA */:
1791
1791
  if (startsWith(s, ']]>')) {
1792
1792
  return true;
1793
1793
  }
@@ -1810,7 +1810,7 @@ function hoistStatic(root, context) {
1810
1810
  function isSingleElementRoot(root, child) {
1811
1811
  const { children } = root;
1812
1812
  return (children.length === 1 &&
1813
- child.type === 1 /* ELEMENT */ &&
1813
+ child.type === 1 /* NodeTypes.ELEMENT */ &&
1814
1814
  !isSlotOutlet(child));
1815
1815
  }
1816
1816
  function walk(node, context, doNotHoistNode = false) {
@@ -1820,15 +1820,15 @@ function walk(node, context, doNotHoistNode = false) {
1820
1820
  for (let i = 0; i < children.length; i++) {
1821
1821
  const child = children[i];
1822
1822
  // only plain elements & text calls are eligible for hoisting.
1823
- if (child.type === 1 /* ELEMENT */ &&
1824
- child.tagType === 0 /* ELEMENT */) {
1823
+ if (child.type === 1 /* NodeTypes.ELEMENT */ &&
1824
+ child.tagType === 0 /* ElementTypes.ELEMENT */) {
1825
1825
  const constantType = doNotHoistNode
1826
- ? 0 /* NOT_CONSTANT */
1826
+ ? 0 /* ConstantTypes.NOT_CONSTANT */
1827
1827
  : getConstantType(child, context);
1828
- if (constantType > 0 /* NOT_CONSTANT */) {
1829
- if (constantType >= 2 /* CAN_HOIST */) {
1828
+ if (constantType > 0 /* ConstantTypes.NOT_CONSTANT */) {
1829
+ if (constantType >= 2 /* ConstantTypes.CAN_HOIST */) {
1830
1830
  child.codegenNode.patchFlag =
1831
- -1 /* HOISTED */ + (` /* HOISTED */` );
1831
+ -1 /* PatchFlags.HOISTED */ + (` /* HOISTED */` );
1832
1832
  child.codegenNode = context.hoist(child.codegenNode);
1833
1833
  hoistedCount++;
1834
1834
  continue;
@@ -1838,13 +1838,13 @@ function walk(node, context, doNotHoistNode = false) {
1838
1838
  // node may contain dynamic children, but its props may be eligible for
1839
1839
  // hoisting.
1840
1840
  const codegenNode = child.codegenNode;
1841
- if (codegenNode.type === 13 /* VNODE_CALL */) {
1841
+ if (codegenNode.type === 13 /* NodeTypes.VNODE_CALL */) {
1842
1842
  const flag = getPatchFlag(codegenNode);
1843
1843
  if ((!flag ||
1844
- flag === 512 /* NEED_PATCH */ ||
1845
- flag === 1 /* TEXT */) &&
1844
+ flag === 512 /* PatchFlags.NEED_PATCH */ ||
1845
+ flag === 1 /* PatchFlags.TEXT */) &&
1846
1846
  getGeneratedPropsConstantType(child, context) >=
1847
- 2 /* CAN_HOIST */) {
1847
+ 2 /* ConstantTypes.CAN_HOIST */) {
1848
1848
  const props = getNodeProps(child);
1849
1849
  if (props) {
1850
1850
  codegenNode.props = context.hoist(props);
@@ -1856,14 +1856,14 @@ function walk(node, context, doNotHoistNode = false) {
1856
1856
  }
1857
1857
  }
1858
1858
  }
1859
- else if (child.type === 12 /* TEXT_CALL */ &&
1860
- getConstantType(child.content, context) >= 2 /* CAN_HOIST */) {
1859
+ else if (child.type === 12 /* NodeTypes.TEXT_CALL */ &&
1860
+ getConstantType(child.content, context) >= 2 /* ConstantTypes.CAN_HOIST */) {
1861
1861
  child.codegenNode = context.hoist(child.codegenNode);
1862
1862
  hoistedCount++;
1863
1863
  }
1864
1864
  // walk further
1865
- if (child.type === 1 /* ELEMENT */) {
1866
- const isComponent = child.tagType === 1 /* COMPONENT */;
1865
+ if (child.type === 1 /* NodeTypes.ELEMENT */) {
1866
+ const isComponent = child.tagType === 1 /* ElementTypes.COMPONENT */;
1867
1867
  if (isComponent) {
1868
1868
  context.scopes.vSlot++;
1869
1869
  }
@@ -1872,11 +1872,11 @@ function walk(node, context, doNotHoistNode = false) {
1872
1872
  context.scopes.vSlot--;
1873
1873
  }
1874
1874
  }
1875
- else if (child.type === 11 /* FOR */) {
1875
+ else if (child.type === 11 /* NodeTypes.FOR */) {
1876
1876
  // Do not hoist v-for single child because it has to be a block
1877
1877
  walk(child, context, child.children.length === 1);
1878
1878
  }
1879
- else if (child.type === 9 /* IF */) {
1879
+ else if (child.type === 9 /* NodeTypes.IF */) {
1880
1880
  for (let i = 0; i < child.branches.length; i++) {
1881
1881
  // Do not hoist v-if single child because it has to be a block
1882
1882
  walk(child.branches[i], context, child.branches[i].children.length === 1);
@@ -1889,10 +1889,10 @@ function walk(node, context, doNotHoistNode = false) {
1889
1889
  // all children were hoisted - the entire children array is hoistable.
1890
1890
  if (hoistedCount &&
1891
1891
  hoistedCount === originalCount &&
1892
- node.type === 1 /* ELEMENT */ &&
1893
- node.tagType === 0 /* ELEMENT */ &&
1892
+ node.type === 1 /* NodeTypes.ELEMENT */ &&
1893
+ node.tagType === 0 /* ElementTypes.ELEMENT */ &&
1894
1894
  node.codegenNode &&
1895
- node.codegenNode.type === 13 /* VNODE_CALL */ &&
1895
+ node.codegenNode.type === 13 /* NodeTypes.VNODE_CALL */ &&
1896
1896
  isArray(node.codegenNode.children)) {
1897
1897
  node.codegenNode.children = context.hoist(createArrayExpression(node.codegenNode.children));
1898
1898
  }
@@ -1900,35 +1900,35 @@ function walk(node, context, doNotHoistNode = false) {
1900
1900
  function getConstantType(node, context) {
1901
1901
  const { constantCache } = context;
1902
1902
  switch (node.type) {
1903
- case 1 /* ELEMENT */:
1904
- if (node.tagType !== 0 /* ELEMENT */) {
1905
- return 0 /* NOT_CONSTANT */;
1903
+ case 1 /* NodeTypes.ELEMENT */:
1904
+ if (node.tagType !== 0 /* ElementTypes.ELEMENT */) {
1905
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
1906
1906
  }
1907
1907
  const cached = constantCache.get(node);
1908
1908
  if (cached !== undefined) {
1909
1909
  return cached;
1910
1910
  }
1911
1911
  const codegenNode = node.codegenNode;
1912
- if (codegenNode.type !== 13 /* VNODE_CALL */) {
1913
- return 0 /* NOT_CONSTANT */;
1912
+ if (codegenNode.type !== 13 /* NodeTypes.VNODE_CALL */) {
1913
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
1914
1914
  }
1915
1915
  if (codegenNode.isBlock &&
1916
1916
  node.tag !== 'svg' &&
1917
1917
  node.tag !== 'foreignObject') {
1918
- return 0 /* NOT_CONSTANT */;
1918
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
1919
1919
  }
1920
1920
  const flag = getPatchFlag(codegenNode);
1921
1921
  if (!flag) {
1922
- let returnType = 3 /* CAN_STRINGIFY */;
1922
+ let returnType = 3 /* ConstantTypes.CAN_STRINGIFY */;
1923
1923
  // Element itself has no patch flag. However we still need to check:
1924
1924
  // 1. Even for a node with no patch flag, it is possible for it to contain
1925
1925
  // non-hoistable expressions that refers to scope variables, e.g. compiler
1926
1926
  // injected keys or cached event handlers. Therefore we need to always
1927
1927
  // check the codegenNode's props to be sure.
1928
1928
  const generatedPropsType = getGeneratedPropsConstantType(node, context);
1929
- if (generatedPropsType === 0 /* NOT_CONSTANT */) {
1930
- constantCache.set(node, 0 /* NOT_CONSTANT */);
1931
- return 0 /* NOT_CONSTANT */;
1929
+ if (generatedPropsType === 0 /* ConstantTypes.NOT_CONSTANT */) {
1930
+ constantCache.set(node, 0 /* ConstantTypes.NOT_CONSTANT */);
1931
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
1932
1932
  }
1933
1933
  if (generatedPropsType < returnType) {
1934
1934
  returnType = generatedPropsType;
@@ -1936,9 +1936,9 @@ function getConstantType(node, context) {
1936
1936
  // 2. its children.
1937
1937
  for (let i = 0; i < node.children.length; i++) {
1938
1938
  const childType = getConstantType(node.children[i], context);
1939
- if (childType === 0 /* NOT_CONSTANT */) {
1940
- constantCache.set(node, 0 /* NOT_CONSTANT */);
1941
- return 0 /* NOT_CONSTANT */;
1939
+ if (childType === 0 /* ConstantTypes.NOT_CONSTANT */) {
1940
+ constantCache.set(node, 0 /* ConstantTypes.NOT_CONSTANT */);
1941
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
1942
1942
  }
1943
1943
  if (childType < returnType) {
1944
1944
  returnType = childType;
@@ -1948,14 +1948,14 @@ function getConstantType(node, context) {
1948
1948
  // type, check if any of the props can cause the type to be lowered
1949
1949
  // we can skip can_patch because it's guaranteed by the absence of a
1950
1950
  // patchFlag.
1951
- if (returnType > 1 /* CAN_SKIP_PATCH */) {
1951
+ if (returnType > 1 /* ConstantTypes.CAN_SKIP_PATCH */) {
1952
1952
  for (let i = 0; i < node.props.length; i++) {
1953
1953
  const p = node.props[i];
1954
- if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind' && p.exp) {
1954
+ if (p.type === 7 /* NodeTypes.DIRECTIVE */ && p.name === 'bind' && p.exp) {
1955
1955
  const expType = getConstantType(p.exp, context);
1956
- if (expType === 0 /* NOT_CONSTANT */) {
1957
- constantCache.set(node, 0 /* NOT_CONSTANT */);
1958
- return 0 /* NOT_CONSTANT */;
1956
+ if (expType === 0 /* ConstantTypes.NOT_CONSTANT */) {
1957
+ constantCache.set(node, 0 /* ConstantTypes.NOT_CONSTANT */);
1958
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
1959
1959
  }
1960
1960
  if (expType < returnType) {
1961
1961
  returnType = expType;
@@ -1970,9 +1970,9 @@ function getConstantType(node, context) {
1970
1970
  // except set custom directives.
1971
1971
  for (let i = 0; i < node.props.length; i++) {
1972
1972
  const p = node.props[i];
1973
- if (p.type === 7 /* DIRECTIVE */) {
1974
- constantCache.set(node, 0 /* NOT_CONSTANT */);
1975
- return 0 /* NOT_CONSTANT */;
1973
+ if (p.type === 7 /* NodeTypes.DIRECTIVE */) {
1974
+ constantCache.set(node, 0 /* ConstantTypes.NOT_CONSTANT */);
1975
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
1976
1976
  }
1977
1977
  }
1978
1978
  context.removeHelper(OPEN_BLOCK);
@@ -1984,31 +1984,31 @@ function getConstantType(node, context) {
1984
1984
  return returnType;
1985
1985
  }
1986
1986
  else {
1987
- constantCache.set(node, 0 /* NOT_CONSTANT */);
1988
- return 0 /* NOT_CONSTANT */;
1989
- }
1990
- case 2 /* TEXT */:
1991
- case 3 /* COMMENT */:
1992
- return 3 /* CAN_STRINGIFY */;
1993
- case 9 /* IF */:
1994
- case 11 /* FOR */:
1995
- case 10 /* IF_BRANCH */:
1996
- return 0 /* NOT_CONSTANT */;
1997
- case 5 /* INTERPOLATION */:
1998
- case 12 /* TEXT_CALL */:
1987
+ constantCache.set(node, 0 /* ConstantTypes.NOT_CONSTANT */);
1988
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
1989
+ }
1990
+ case 2 /* NodeTypes.TEXT */:
1991
+ case 3 /* NodeTypes.COMMENT */:
1992
+ return 3 /* ConstantTypes.CAN_STRINGIFY */;
1993
+ case 9 /* NodeTypes.IF */:
1994
+ case 11 /* NodeTypes.FOR */:
1995
+ case 10 /* NodeTypes.IF_BRANCH */:
1996
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
1997
+ case 5 /* NodeTypes.INTERPOLATION */:
1998
+ case 12 /* NodeTypes.TEXT_CALL */:
1999
1999
  return getConstantType(node.content, context);
2000
- case 4 /* SIMPLE_EXPRESSION */:
2000
+ case 4 /* NodeTypes.SIMPLE_EXPRESSION */:
2001
2001
  return node.constType;
2002
- case 8 /* COMPOUND_EXPRESSION */:
2003
- let returnType = 3 /* CAN_STRINGIFY */;
2002
+ case 8 /* NodeTypes.COMPOUND_EXPRESSION */:
2003
+ let returnType = 3 /* ConstantTypes.CAN_STRINGIFY */;
2004
2004
  for (let i = 0; i < node.children.length; i++) {
2005
2005
  const child = node.children[i];
2006
2006
  if (isString(child) || isSymbol(child)) {
2007
2007
  continue;
2008
2008
  }
2009
2009
  const childType = getConstantType(child, context);
2010
- if (childType === 0 /* NOT_CONSTANT */) {
2011
- return 0 /* NOT_CONSTANT */;
2010
+ if (childType === 0 /* ConstantTypes.NOT_CONSTANT */) {
2011
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
2012
2012
  }
2013
2013
  else if (childType < returnType) {
2014
2014
  returnType = childType;
@@ -2016,7 +2016,7 @@ function getConstantType(node, context) {
2016
2016
  }
2017
2017
  return returnType;
2018
2018
  default:
2019
- return 0 /* NOT_CONSTANT */;
2019
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
2020
2020
  }
2021
2021
  }
2022
2022
  const allowHoistedHelperSet = new Set([
@@ -2026,48 +2026,48 @@ const allowHoistedHelperSet = new Set([
2026
2026
  GUARD_REACTIVE_PROPS
2027
2027
  ]);
2028
2028
  function getConstantTypeOfHelperCall(value, context) {
2029
- if (value.type === 14 /* JS_CALL_EXPRESSION */ &&
2029
+ if (value.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */ &&
2030
2030
  !isString(value.callee) &&
2031
2031
  allowHoistedHelperSet.has(value.callee)) {
2032
2032
  const arg = value.arguments[0];
2033
- if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
2033
+ if (arg.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
2034
2034
  return getConstantType(arg, context);
2035
2035
  }
2036
- else if (arg.type === 14 /* JS_CALL_EXPRESSION */) {
2036
+ else if (arg.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */) {
2037
2037
  // in the case of nested helper call, e.g. `normalizeProps(guardReactiveProps(exp))`
2038
2038
  return getConstantTypeOfHelperCall(arg, context);
2039
2039
  }
2040
2040
  }
2041
- return 0 /* NOT_CONSTANT */;
2041
+ return 0 /* ConstantTypes.NOT_CONSTANT */;
2042
2042
  }
2043
2043
  function getGeneratedPropsConstantType(node, context) {
2044
- let returnType = 3 /* CAN_STRINGIFY */;
2044
+ let returnType = 3 /* ConstantTypes.CAN_STRINGIFY */;
2045
2045
  const props = getNodeProps(node);
2046
- if (props && props.type === 15 /* JS_OBJECT_EXPRESSION */) {
2046
+ if (props && props.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
2047
2047
  const { properties } = props;
2048
2048
  for (let i = 0; i < properties.length; i++) {
2049
2049
  const { key, value } = properties[i];
2050
2050
  const keyType = getConstantType(key, context);
2051
- if (keyType === 0 /* NOT_CONSTANT */) {
2051
+ if (keyType === 0 /* ConstantTypes.NOT_CONSTANT */) {
2052
2052
  return keyType;
2053
2053
  }
2054
2054
  if (keyType < returnType) {
2055
2055
  returnType = keyType;
2056
2056
  }
2057
2057
  let valueType;
2058
- if (value.type === 4 /* SIMPLE_EXPRESSION */) {
2058
+ if (value.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
2059
2059
  valueType = getConstantType(value, context);
2060
2060
  }
2061
- else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
2061
+ else if (value.type === 14 /* NodeTypes.JS_CALL_EXPRESSION */) {
2062
2062
  // some helper calls can be hoisted,
2063
2063
  // such as the `normalizeProps` generated by the compiler for pre-normalize class,
2064
2064
  // in this case we need to respect the ConstantType of the helper's arguments
2065
2065
  valueType = getConstantTypeOfHelperCall(value, context);
2066
2066
  }
2067
2067
  else {
2068
- valueType = 0 /* NOT_CONSTANT */;
2068
+ valueType = 0 /* ConstantTypes.NOT_CONSTANT */;
2069
2069
  }
2070
- if (valueType === 0 /* NOT_CONSTANT */) {
2070
+ if (valueType === 0 /* ConstantTypes.NOT_CONSTANT */) {
2071
2071
  return valueType;
2072
2072
  }
2073
2073
  if (valueType < returnType) {
@@ -2079,7 +2079,7 @@ function getGeneratedPropsConstantType(node, context) {
2079
2079
  }
2080
2080
  function getNodeProps(node) {
2081
2081
  const codegenNode = node.codegenNode;
2082
- if (codegenNode.type === 13 /* VNODE_CALL */) {
2082
+ if (codegenNode.type === 13 /* NodeTypes.VNODE_CALL */) {
2083
2083
  return codegenNode.props;
2084
2084
  }
2085
2085
  }
@@ -2204,7 +2204,7 @@ function createTransformContext(root, { filename = '', prefixIdentifiers = false
2204
2204
  if (isString(exp))
2205
2205
  exp = createSimpleExpression(exp);
2206
2206
  context.hoists.push(exp);
2207
- const identifier = createSimpleExpression(`_hoisted_${context.hoists.length}`, false, exp.loc, 2 /* CAN_HOIST */);
2207
+ const identifier = createSimpleExpression(`_hoisted_${context.hoists.length}`, false, exp.loc, 2 /* ConstantTypes.CAN_HOIST */);
2208
2208
  identifier.hoisted = exp;
2209
2209
  return identifier;
2210
2210
  },
@@ -2248,7 +2248,7 @@ function createRootCodegen(root, context) {
2248
2248
  // single element root is never hoisted so codegenNode will never be
2249
2249
  // SimpleExpressionNode
2250
2250
  const codegenNode = child.codegenNode;
2251
- if (codegenNode.type === 13 /* VNODE_CALL */) {
2251
+ if (codegenNode.type === 13 /* NodeTypes.VNODE_CALL */) {
2252
2252
  makeBlock(codegenNode, context);
2253
2253
  }
2254
2254
  root.codegenNode = codegenNode;
@@ -2262,13 +2262,13 @@ function createRootCodegen(root, context) {
2262
2262
  }
2263
2263
  else if (children.length > 1) {
2264
2264
  // root has multiple nodes - return a fragment block.
2265
- let patchFlag = 64 /* STABLE_FRAGMENT */;
2266
- let patchFlagText = PatchFlagNames[64 /* STABLE_FRAGMENT */];
2265
+ let patchFlag = 64 /* PatchFlags.STABLE_FRAGMENT */;
2266
+ let patchFlagText = PatchFlagNames[64 /* PatchFlags.STABLE_FRAGMENT */];
2267
2267
  // check if the fragment actually contains a single valid child with
2268
2268
  // the rest being comments
2269
- if (children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
2270
- patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
2271
- patchFlagText += `, ${PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
2269
+ if (children.filter(c => c.type !== 3 /* NodeTypes.COMMENT */).length === 1) {
2270
+ patchFlag |= 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */;
2271
+ patchFlagText += `, ${PatchFlagNames[2048 /* PatchFlags.DEV_ROOT_FRAGMENT */]}`;
2272
2272
  }
2273
2273
  root.codegenNode = createVNodeCall(context, helper(FRAGMENT), undefined, root.children, patchFlag + (` /* ${patchFlagText} */` ), undefined, undefined, true, undefined, false /* isComponent */);
2274
2274
  }
@@ -2314,29 +2314,29 @@ function traverseNode(node, context) {
2314
2314
  }
2315
2315
  }
2316
2316
  switch (node.type) {
2317
- case 3 /* COMMENT */:
2317
+ case 3 /* NodeTypes.COMMENT */:
2318
2318
  if (!context.ssr) {
2319
2319
  // inject import for the Comment symbol, which is needed for creating
2320
2320
  // comment nodes with `createVNode`
2321
2321
  context.helper(CREATE_COMMENT);
2322
2322
  }
2323
2323
  break;
2324
- case 5 /* INTERPOLATION */:
2324
+ case 5 /* NodeTypes.INTERPOLATION */:
2325
2325
  // no need to traverse, but we need to inject toString helper
2326
2326
  if (!context.ssr) {
2327
2327
  context.helper(TO_DISPLAY_STRING);
2328
2328
  }
2329
2329
  break;
2330
2330
  // for container types, further traverse downwards
2331
- case 9 /* IF */:
2331
+ case 9 /* NodeTypes.IF */:
2332
2332
  for (let i = 0; i < node.branches.length; i++) {
2333
2333
  traverseNode(node.branches[i], context);
2334
2334
  }
2335
2335
  break;
2336
- case 10 /* IF_BRANCH */:
2337
- case 11 /* FOR */:
2338
- case 1 /* ELEMENT */:
2339
- case 0 /* ROOT */:
2336
+ case 10 /* NodeTypes.IF_BRANCH */:
2337
+ case 11 /* NodeTypes.FOR */:
2338
+ case 1 /* NodeTypes.ELEMENT */:
2339
+ case 0 /* NodeTypes.ROOT */:
2340
2340
  traverseChildren(node, context);
2341
2341
  break;
2342
2342
  }
@@ -2352,17 +2352,17 @@ function createStructuralDirectiveTransform(name, fn) {
2352
2352
  ? (n) => n === name
2353
2353
  : (n) => name.test(n);
2354
2354
  return (node, context) => {
2355
- if (node.type === 1 /* ELEMENT */) {
2355
+ if (node.type === 1 /* NodeTypes.ELEMENT */) {
2356
2356
  const { props } = node;
2357
2357
  // structural directive transforms are not concerned with slots
2358
2358
  // as they are handled separately in vSlot.ts
2359
- if (node.tagType === 3 /* TEMPLATE */ && props.some(isVSlot)) {
2359
+ if (node.tagType === 3 /* ElementTypes.TEMPLATE */ && props.some(isVSlot)) {
2360
2360
  return;
2361
2361
  }
2362
2362
  const exitFns = [];
2363
2363
  for (let i = 0; i < props.length; i++) {
2364
2364
  const prop = props[i];
2365
- if (prop.type === 7 /* DIRECTIVE */ && matches(prop.name)) {
2365
+ if (prop.type === 7 /* NodeTypes.DIRECTIVE */ && matches(prop.name)) {
2366
2366
  // structural directives are removed to avoid infinite recursion
2367
2367
  // also we remove them *before* applying so that it can further
2368
2368
  // traverse itself in case it moves the node around
@@ -2585,10 +2585,10 @@ function genHoists(hoists, context) {
2585
2585
  }
2586
2586
  function isText$1(n) {
2587
2587
  return (isString(n) ||
2588
- n.type === 4 /* SIMPLE_EXPRESSION */ ||
2589
- n.type === 2 /* TEXT */ ||
2590
- n.type === 5 /* INTERPOLATION */ ||
2591
- n.type === 8 /* COMPOUND_EXPRESSION */);
2588
+ n.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ ||
2589
+ n.type === 2 /* NodeTypes.TEXT */ ||
2590
+ n.type === 5 /* NodeTypes.INTERPOLATION */ ||
2591
+ n.type === 8 /* NodeTypes.COMPOUND_EXPRESSION */);
2592
2592
  }
2593
2593
  function genNodeListAsArray(nodes, context) {
2594
2594
  const multilines = nodes.length > 3 ||
@@ -2633,68 +2633,68 @@ function genNode(node, context) {
2633
2633
  return;
2634
2634
  }
2635
2635
  switch (node.type) {
2636
- case 1 /* ELEMENT */:
2637
- case 9 /* IF */:
2638
- case 11 /* FOR */:
2636
+ case 1 /* NodeTypes.ELEMENT */:
2637
+ case 9 /* NodeTypes.IF */:
2638
+ case 11 /* NodeTypes.FOR */:
2639
2639
  assert(node.codegenNode != null, `Codegen node is missing for element/if/for node. ` +
2640
2640
  `Apply appropriate transforms first.`);
2641
2641
  genNode(node.codegenNode, context);
2642
2642
  break;
2643
- case 2 /* TEXT */:
2643
+ case 2 /* NodeTypes.TEXT */:
2644
2644
  genText(node, context);
2645
2645
  break;
2646
- case 4 /* SIMPLE_EXPRESSION */:
2646
+ case 4 /* NodeTypes.SIMPLE_EXPRESSION */:
2647
2647
  genExpression(node, context);
2648
2648
  break;
2649
- case 5 /* INTERPOLATION */:
2649
+ case 5 /* NodeTypes.INTERPOLATION */:
2650
2650
  genInterpolation(node, context);
2651
2651
  break;
2652
- case 12 /* TEXT_CALL */:
2652
+ case 12 /* NodeTypes.TEXT_CALL */:
2653
2653
  genNode(node.codegenNode, context);
2654
2654
  break;
2655
- case 8 /* COMPOUND_EXPRESSION */:
2655
+ case 8 /* NodeTypes.COMPOUND_EXPRESSION */:
2656
2656
  genCompoundExpression(node, context);
2657
2657
  break;
2658
- case 3 /* COMMENT */:
2658
+ case 3 /* NodeTypes.COMMENT */:
2659
2659
  genComment(node, context);
2660
2660
  break;
2661
- case 13 /* VNODE_CALL */:
2661
+ case 13 /* NodeTypes.VNODE_CALL */:
2662
2662
  genVNodeCall(node, context);
2663
2663
  break;
2664
- case 14 /* JS_CALL_EXPRESSION */:
2664
+ case 14 /* NodeTypes.JS_CALL_EXPRESSION */:
2665
2665
  genCallExpression(node, context);
2666
2666
  break;
2667
- case 15 /* JS_OBJECT_EXPRESSION */:
2667
+ case 15 /* NodeTypes.JS_OBJECT_EXPRESSION */:
2668
2668
  genObjectExpression(node, context);
2669
2669
  break;
2670
- case 17 /* JS_ARRAY_EXPRESSION */:
2670
+ case 17 /* NodeTypes.JS_ARRAY_EXPRESSION */:
2671
2671
  genArrayExpression(node, context);
2672
2672
  break;
2673
- case 18 /* JS_FUNCTION_EXPRESSION */:
2673
+ case 18 /* NodeTypes.JS_FUNCTION_EXPRESSION */:
2674
2674
  genFunctionExpression(node, context);
2675
2675
  break;
2676
- case 19 /* JS_CONDITIONAL_EXPRESSION */:
2676
+ case 19 /* NodeTypes.JS_CONDITIONAL_EXPRESSION */:
2677
2677
  genConditionalExpression(node, context);
2678
2678
  break;
2679
- case 20 /* JS_CACHE_EXPRESSION */:
2679
+ case 20 /* NodeTypes.JS_CACHE_EXPRESSION */:
2680
2680
  genCacheExpression(node, context);
2681
2681
  break;
2682
- case 21 /* JS_BLOCK_STATEMENT */:
2682
+ case 21 /* NodeTypes.JS_BLOCK_STATEMENT */:
2683
2683
  genNodeList(node.body, context, true, false);
2684
2684
  break;
2685
2685
  // SSR only types
2686
- case 22 /* JS_TEMPLATE_LITERAL */:
2686
+ case 22 /* NodeTypes.JS_TEMPLATE_LITERAL */:
2687
2687
  break;
2688
- case 23 /* JS_IF_STATEMENT */:
2688
+ case 23 /* NodeTypes.JS_IF_STATEMENT */:
2689
2689
  break;
2690
- case 24 /* JS_ASSIGNMENT_EXPRESSION */:
2690
+ case 24 /* NodeTypes.JS_ASSIGNMENT_EXPRESSION */:
2691
2691
  break;
2692
- case 25 /* JS_SEQUENCE_EXPRESSION */:
2692
+ case 25 /* NodeTypes.JS_SEQUENCE_EXPRESSION */:
2693
2693
  break;
2694
- case 26 /* JS_RETURN_STATEMENT */:
2694
+ case 26 /* NodeTypes.JS_RETURN_STATEMENT */:
2695
2695
  break;
2696
2696
  /* istanbul ignore next */
2697
- case 10 /* IF_BRANCH */:
2697
+ case 10 /* NodeTypes.IF_BRANCH */:
2698
2698
  // noop
2699
2699
  break;
2700
2700
  default:
@@ -2734,7 +2734,7 @@ function genCompoundExpression(node, context) {
2734
2734
  }
2735
2735
  function genExpressionAsPropertyKey(node, context) {
2736
2736
  const { push } = context;
2737
- if (node.type === 8 /* COMPOUND_EXPRESSION */) {
2737
+ if (node.type === 8 /* NodeTypes.COMPOUND_EXPRESSION */) {
2738
2738
  push(`[`);
2739
2739
  genCompoundExpression(node, context);
2740
2740
  push(`]`);
@@ -2811,7 +2811,7 @@ function genObjectExpression(node, context) {
2811
2811
  return;
2812
2812
  }
2813
2813
  const multilines = properties.length > 1 ||
2814
- (properties.some(p => p.value.type !== 4 /* SIMPLE_EXPRESSION */));
2814
+ (properties.some(p => p.value.type !== 4 /* NodeTypes.SIMPLE_EXPRESSION */));
2815
2815
  push(multilines ? `{` : `{ `);
2816
2816
  multilines && indent();
2817
2817
  for (let i = 0; i < properties.length; i++) {
@@ -2880,7 +2880,7 @@ function genFunctionExpression(node, context) {
2880
2880
  function genConditionalExpression(node, context) {
2881
2881
  const { test, consequent, alternate, newline: needNewline } = node;
2882
2882
  const { push, indent, deindent, newline } = context;
2883
- if (test.type === 4 /* SIMPLE_EXPRESSION */) {
2883
+ if (test.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
2884
2884
  const needsParens = !isSimpleIdentifier(test.content);
2885
2885
  needsParens && push(`(`);
2886
2886
  genExpression(test, context);
@@ -2900,7 +2900,7 @@ function genConditionalExpression(node, context) {
2900
2900
  needNewline && newline();
2901
2901
  needNewline || push(` `);
2902
2902
  push(`: `);
2903
- const isNested = alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */;
2903
+ const isNested = alternate.type === 19 /* NodeTypes.JS_CONDITIONAL_EXPRESSION */;
2904
2904
  if (!isNested) {
2905
2905
  context.indentLevel++;
2906
2906
  }
@@ -3064,32 +3064,32 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
3064
3064
  if (keywordMatch) {
3065
3065
  message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
3066
3066
  }
3067
- context.onError(createCompilerError(44 /* X_INVALID_EXPRESSION */, node.loc, undefined, message));
3067
+ context.onError(createCompilerError(44 /* ErrorCodes.X_INVALID_EXPRESSION */, node.loc, undefined, message));
3068
3068
  }
3069
3069
  }
3070
3070
 
3071
3071
  const transformExpression = (node, context) => {
3072
- if (node.type === 5 /* INTERPOLATION */) {
3072
+ if (node.type === 5 /* NodeTypes.INTERPOLATION */) {
3073
3073
  node.content = processExpression(node.content, context);
3074
3074
  }
3075
- else if (node.type === 1 /* ELEMENT */) {
3075
+ else if (node.type === 1 /* NodeTypes.ELEMENT */) {
3076
3076
  // handle directives on element
3077
3077
  for (let i = 0; i < node.props.length; i++) {
3078
3078
  const dir = node.props[i];
3079
3079
  // do not process for v-on & v-for since they are special handled
3080
- if (dir.type === 7 /* DIRECTIVE */ && dir.name !== 'for') {
3080
+ if (dir.type === 7 /* NodeTypes.DIRECTIVE */ && dir.name !== 'for') {
3081
3081
  const exp = dir.exp;
3082
3082
  const arg = dir.arg;
3083
3083
  // do not process exp if this is v-on:arg - we need special handling
3084
3084
  // for wrapping inline statements.
3085
3085
  if (exp &&
3086
- exp.type === 4 /* SIMPLE_EXPRESSION */ &&
3086
+ exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
3087
3087
  !(dir.name === 'on' && arg)) {
3088
3088
  dir.exp = processExpression(exp, context,
3089
3089
  // slot args must be processed as function params
3090
3090
  dir.name === 'slot');
3091
3091
  }
3092
- if (arg && arg.type === 4 /* SIMPLE_EXPRESSION */ && !arg.isStatic) {
3092
+ if (arg && arg.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ && !arg.isStatic) {
3093
3093
  dir.arg = processExpression(arg, context);
3094
3094
  }
3095
3095
  }
@@ -3124,7 +3124,7 @@ const transformIf = createStructuralDirectiveTransform(/^(if|else|else-if)$/, (n
3124
3124
  let key = 0;
3125
3125
  while (i-- >= 0) {
3126
3126
  const sibling = siblings[i];
3127
- if (sibling && sibling.type === 9 /* IF */) {
3127
+ if (sibling && sibling.type === 9 /* NodeTypes.IF */) {
3128
3128
  key += sibling.branches.length;
3129
3129
  }
3130
3130
  }
@@ -3147,7 +3147,7 @@ function processIf(node, dir, context, processCodegen) {
3147
3147
  if (dir.name !== 'else' &&
3148
3148
  (!dir.exp || !dir.exp.content.trim())) {
3149
3149
  const loc = dir.exp ? dir.exp.loc : node.loc;
3150
- context.onError(createCompilerError(28 /* X_V_IF_NO_EXPRESSION */, dir.loc));
3150
+ context.onError(createCompilerError(28 /* ErrorCodes.X_V_IF_NO_EXPRESSION */, dir.loc));
3151
3151
  dir.exp = createSimpleExpression(`true`, false, loc);
3152
3152
  }
3153
3153
  if (dir.exp) {
@@ -3156,7 +3156,7 @@ function processIf(node, dir, context, processCodegen) {
3156
3156
  if (dir.name === 'if') {
3157
3157
  const branch = createIfBranch(node, dir);
3158
3158
  const ifNode = {
3159
- type: 9 /* IF */,
3159
+ type: 9 /* NodeTypes.IF */,
3160
3160
  loc: node.loc,
3161
3161
  branches: [branch]
3162
3162
  };
@@ -3172,22 +3172,22 @@ function processIf(node, dir, context, processCodegen) {
3172
3172
  let i = siblings.indexOf(node);
3173
3173
  while (i-- >= -1) {
3174
3174
  const sibling = siblings[i];
3175
- if (sibling && sibling.type === 3 /* COMMENT */) {
3175
+ if (sibling && sibling.type === 3 /* NodeTypes.COMMENT */) {
3176
3176
  context.removeNode(sibling);
3177
3177
  comments.unshift(sibling);
3178
3178
  continue;
3179
3179
  }
3180
3180
  if (sibling &&
3181
- sibling.type === 2 /* TEXT */ &&
3181
+ sibling.type === 2 /* NodeTypes.TEXT */ &&
3182
3182
  !sibling.content.trim().length) {
3183
3183
  context.removeNode(sibling);
3184
3184
  continue;
3185
3185
  }
3186
- if (sibling && sibling.type === 9 /* IF */) {
3186
+ if (sibling && sibling.type === 9 /* NodeTypes.IF */) {
3187
3187
  // Check if v-else was followed by v-else-if
3188
3188
  if (dir.name === 'else-if' &&
3189
3189
  sibling.branches[sibling.branches.length - 1].condition === undefined) {
3190
- context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
3190
+ context.onError(createCompilerError(30 /* ErrorCodes.X_V_ELSE_NO_ADJACENT_IF */, node.loc));
3191
3191
  }
3192
3192
  // move the node to the if node's branches
3193
3193
  context.removeNode();
@@ -3195,7 +3195,7 @@ function processIf(node, dir, context, processCodegen) {
3195
3195
  if (comments.length &&
3196
3196
  // #3619 ignore comments if the v-if is direct child of <transition>
3197
3197
  !(context.parent &&
3198
- context.parent.type === 1 /* ELEMENT */ &&
3198
+ context.parent.type === 1 /* NodeTypes.ELEMENT */ &&
3199
3199
  isBuiltInType(context.parent.tag, 'transition'))) {
3200
3200
  branch.children = [...comments, ...branch.children];
3201
3201
  }
@@ -3205,7 +3205,7 @@ function processIf(node, dir, context, processCodegen) {
3205
3205
  if (key) {
3206
3206
  sibling.branches.forEach(({ userKey }) => {
3207
3207
  if (isSameKey(userKey, key)) {
3208
- context.onError(createCompilerError(29 /* X_V_IF_SAME_KEY */, branch.userKey.loc));
3208
+ context.onError(createCompilerError(29 /* ErrorCodes.X_V_IF_SAME_KEY */, branch.userKey.loc));
3209
3209
  }
3210
3210
  });
3211
3211
  }
@@ -3223,16 +3223,16 @@ function processIf(node, dir, context, processCodegen) {
3223
3223
  context.currentNode = null;
3224
3224
  }
3225
3225
  else {
3226
- context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
3226
+ context.onError(createCompilerError(30 /* ErrorCodes.X_V_ELSE_NO_ADJACENT_IF */, node.loc));
3227
3227
  }
3228
3228
  break;
3229
3229
  }
3230
3230
  }
3231
3231
  }
3232
3232
  function createIfBranch(node, dir) {
3233
- const isTemplateIf = node.tagType === 3 /* TEMPLATE */;
3233
+ const isTemplateIf = node.tagType === 3 /* ElementTypes.TEMPLATE */;
3234
3234
  return {
3235
- type: 10 /* IF_BRANCH */,
3235
+ type: 10 /* NodeTypes.IF_BRANCH */,
3236
3236
  loc: node.loc,
3237
3237
  condition: dir.name === 'else' ? undefined : dir.exp,
3238
3238
  children: isTemplateIf && !findDir(node, 'for') ? node.children : [node],
@@ -3256,26 +3256,26 @@ function createCodegenNodeForBranch(branch, keyIndex, context) {
3256
3256
  }
3257
3257
  function createChildrenCodegenNode(branch, keyIndex, context) {
3258
3258
  const { helper } = context;
3259
- const keyProperty = createObjectProperty(`key`, createSimpleExpression(`${keyIndex}`, false, locStub, 2 /* CAN_HOIST */));
3259
+ const keyProperty = createObjectProperty(`key`, createSimpleExpression(`${keyIndex}`, false, locStub, 2 /* ConstantTypes.CAN_HOIST */));
3260
3260
  const { children } = branch;
3261
3261
  const firstChild = children[0];
3262
- const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1 /* ELEMENT */;
3262
+ const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1 /* NodeTypes.ELEMENT */;
3263
3263
  if (needFragmentWrapper) {
3264
- if (children.length === 1 && firstChild.type === 11 /* FOR */) {
3264
+ if (children.length === 1 && firstChild.type === 11 /* NodeTypes.FOR */) {
3265
3265
  // optimize away nested fragments when child is a ForNode
3266
3266
  const vnodeCall = firstChild.codegenNode;
3267
3267
  injectProp(vnodeCall, keyProperty, context);
3268
3268
  return vnodeCall;
3269
3269
  }
3270
3270
  else {
3271
- let patchFlag = 64 /* STABLE_FRAGMENT */;
3272
- let patchFlagText = PatchFlagNames[64 /* STABLE_FRAGMENT */];
3271
+ let patchFlag = 64 /* PatchFlags.STABLE_FRAGMENT */;
3272
+ let patchFlagText = PatchFlagNames[64 /* PatchFlags.STABLE_FRAGMENT */];
3273
3273
  // check if the fragment actually contains a single valid child with
3274
3274
  // the rest being comments
3275
3275
  if (!branch.isTemplateIf &&
3276
- children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
3277
- patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
3278
- patchFlagText += `, ${PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
3276
+ children.filter(c => c.type !== 3 /* NodeTypes.COMMENT */).length === 1) {
3277
+ patchFlag |= 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */;
3278
+ patchFlagText += `, ${PatchFlagNames[2048 /* PatchFlags.DEV_ROOT_FRAGMENT */]}`;
3279
3279
  }
3280
3280
  return createVNodeCall(context, helper(FRAGMENT), createObjectExpression([keyProperty]), children, patchFlag + (` /* ${patchFlagText} */` ), undefined, undefined, true, false, false /* isComponent */, branch.loc);
3281
3281
  }
@@ -3284,7 +3284,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
3284
3284
  const ret = firstChild.codegenNode;
3285
3285
  const vnodeCall = getMemoedVNodeCall(ret);
3286
3286
  // Change createVNode to createBlock.
3287
- if (vnodeCall.type === 13 /* VNODE_CALL */) {
3287
+ if (vnodeCall.type === 13 /* NodeTypes.VNODE_CALL */) {
3288
3288
  makeBlock(vnodeCall, context);
3289
3289
  }
3290
3290
  // inject branch key
@@ -3296,7 +3296,7 @@ function isSameKey(a, b) {
3296
3296
  if (!a || a.type !== b.type) {
3297
3297
  return false;
3298
3298
  }
3299
- if (a.type === 6 /* ATTRIBUTE */) {
3299
+ if (a.type === 6 /* NodeTypes.ATTRIBUTE */) {
3300
3300
  if (a.value.content !== b.value.content) {
3301
3301
  return false;
3302
3302
  }
@@ -3308,7 +3308,7 @@ function isSameKey(a, b) {
3308
3308
  if (exp.type !== branchExp.type) {
3309
3309
  return false;
3310
3310
  }
3311
- if (exp.type !== 4 /* SIMPLE_EXPRESSION */ ||
3311
+ if (exp.type !== 4 /* NodeTypes.SIMPLE_EXPRESSION */ ||
3312
3312
  exp.isStatic !== branchExp.isStatic ||
3313
3313
  exp.content !== branchExp.content) {
3314
3314
  return false;
@@ -3318,15 +3318,15 @@ function isSameKey(a, b) {
3318
3318
  }
3319
3319
  function getParentCondition(node) {
3320
3320
  while (true) {
3321
- if (node.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
3322
- if (node.alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
3321
+ if (node.type === 19 /* NodeTypes.JS_CONDITIONAL_EXPRESSION */) {
3322
+ if (node.alternate.type === 19 /* NodeTypes.JS_CONDITIONAL_EXPRESSION */) {
3323
3323
  node = node.alternate;
3324
3324
  }
3325
3325
  else {
3326
3326
  return node;
3327
3327
  }
3328
3328
  }
3329
- else if (node.type === 20 /* JS_CACHE_EXPRESSION */) {
3329
+ else if (node.type === 20 /* NodeTypes.JS_CACHE_EXPRESSION */) {
3330
3330
  node = node.value;
3331
3331
  }
3332
3332
  }
@@ -3344,17 +3344,17 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
3344
3344
  const memo = findDir(node, 'memo');
3345
3345
  const keyProp = findProp(node, `key`);
3346
3346
  const keyExp = keyProp &&
3347
- (keyProp.type === 6 /* ATTRIBUTE */
3347
+ (keyProp.type === 6 /* NodeTypes.ATTRIBUTE */
3348
3348
  ? createSimpleExpression(keyProp.value.content, true)
3349
3349
  : keyProp.exp);
3350
3350
  const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null;
3351
- const isStableFragment = forNode.source.type === 4 /* SIMPLE_EXPRESSION */ &&
3352
- forNode.source.constType > 0 /* NOT_CONSTANT */;
3351
+ const isStableFragment = forNode.source.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
3352
+ forNode.source.constType > 0 /* ConstantTypes.NOT_CONSTANT */;
3353
3353
  const fragmentFlag = isStableFragment
3354
- ? 64 /* STABLE_FRAGMENT */
3354
+ ? 64 /* PatchFlags.STABLE_FRAGMENT */
3355
3355
  : keyProp
3356
- ? 128 /* KEYED_FRAGMENT */
3357
- : 256 /* UNKEYED_FRAGMENT */;
3356
+ ? 128 /* PatchFlags.KEYED_FRAGMENT */
3357
+ : 256 /* PatchFlags.UNKEYED_FRAGMENT */;
3358
3358
  forNode.codegenNode = createVNodeCall(context, helper(FRAGMENT), undefined, renderExp, fragmentFlag +
3359
3359
  (` /* ${PatchFlagNames[fragmentFlag]} */` ), undefined, undefined, true /* isBlock */, !isStableFragment /* disableTracking */, false /* isComponent */, node.loc);
3360
3360
  return () => {
@@ -3364,16 +3364,16 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
3364
3364
  // check <template v-for> key placement
3365
3365
  if (isTemplate) {
3366
3366
  node.children.some(c => {
3367
- if (c.type === 1 /* ELEMENT */) {
3367
+ if (c.type === 1 /* NodeTypes.ELEMENT */) {
3368
3368
  const key = findProp(c, 'key');
3369
3369
  if (key) {
3370
- context.onError(createCompilerError(33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */, key.loc));
3370
+ context.onError(createCompilerError(33 /* ErrorCodes.X_V_FOR_TEMPLATE_KEY_PLACEMENT */, key.loc));
3371
3371
  return true;
3372
3372
  }
3373
3373
  }
3374
3374
  });
3375
3375
  }
3376
- const needFragmentWrapper = children.length !== 1 || children[0].type !== 1 /* ELEMENT */;
3376
+ const needFragmentWrapper = children.length !== 1 || children[0].type !== 1 /* NodeTypes.ELEMENT */;
3377
3377
  const slotOutlet = isSlotOutlet(node)
3378
3378
  ? node
3379
3379
  : isTemplate &&
@@ -3394,8 +3394,8 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
3394
3394
  else if (needFragmentWrapper) {
3395
3395
  // <template v-for="..."> with text or multi-elements
3396
3396
  // should generate a fragment block for each loop
3397
- childBlock = createVNodeCall(context, helper(FRAGMENT), keyProperty ? createObjectExpression([keyProperty]) : undefined, node.children, 64 /* STABLE_FRAGMENT */ +
3398
- (` /* ${PatchFlagNames[64 /* STABLE_FRAGMENT */]} */`
3397
+ childBlock = createVNodeCall(context, helper(FRAGMENT), keyProperty ? createObjectExpression([keyProperty]) : undefined, node.children, 64 /* PatchFlags.STABLE_FRAGMENT */ +
3398
+ (` /* ${PatchFlagNames[64 /* PatchFlags.STABLE_FRAGMENT */]} */`
3399
3399
  ), undefined, undefined, true, undefined, false /* isComponent */);
3400
3400
  }
3401
3401
  else {
@@ -3452,7 +3452,7 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
3452
3452
  // target-agnostic transform used for both Client and SSR
3453
3453
  function processFor(node, dir, context, processCodegen) {
3454
3454
  if (!dir.exp) {
3455
- context.onError(createCompilerError(31 /* X_V_FOR_NO_EXPRESSION */, dir.loc));
3455
+ context.onError(createCompilerError(31 /* ErrorCodes.X_V_FOR_NO_EXPRESSION */, dir.loc));
3456
3456
  return;
3457
3457
  }
3458
3458
  const parseResult = parseForExpression(
@@ -3460,13 +3460,13 @@ function processFor(node, dir, context, processCodegen) {
3460
3460
  // before expression transform.
3461
3461
  dir.exp, context);
3462
3462
  if (!parseResult) {
3463
- context.onError(createCompilerError(32 /* X_V_FOR_MALFORMED_EXPRESSION */, dir.loc));
3463
+ context.onError(createCompilerError(32 /* ErrorCodes.X_V_FOR_MALFORMED_EXPRESSION */, dir.loc));
3464
3464
  return;
3465
3465
  }
3466
3466
  const { addIdentifiers, removeIdentifiers, scopes } = context;
3467
3467
  const { source, value, key, index } = parseResult;
3468
3468
  const forNode = {
3469
- type: 11 /* FOR */,
3469
+ type: 11 /* NodeTypes.FOR */,
3470
3470
  loc: dir.loc,
3471
3471
  source,
3472
3472
  valueAlias: value,
@@ -3566,9 +3566,9 @@ const defaultFallback = createSimpleExpression(`undefined`, false);
3566
3566
  // Note the exit callback is executed before buildSlots() on the same node,
3567
3567
  // so only nested slots see positive numbers.
3568
3568
  const trackSlotScopes = (node, context) => {
3569
- if (node.type === 1 /* ELEMENT */ &&
3570
- (node.tagType === 1 /* COMPONENT */ ||
3571
- node.tagType === 3 /* TEMPLATE */)) {
3569
+ if (node.type === 1 /* NodeTypes.ELEMENT */ &&
3570
+ (node.tagType === 1 /* ElementTypes.COMPONENT */ ||
3571
+ node.tagType === 3 /* ElementTypes.TEMPLATE */)) {
3572
3572
  // We are only checking non-empty v-slot here
3573
3573
  // since we only care about slots that introduce scope variables.
3574
3574
  const vSlot = findDir(node, 'slot');
@@ -3630,20 +3630,21 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3630
3630
  let hasNamedDefaultSlot = false;
3631
3631
  const implicitDefaultChildren = [];
3632
3632
  const seenSlotNames = new Set();
3633
+ let conditionalBranchIndex = 0;
3633
3634
  for (let i = 0; i < children.length; i++) {
3634
3635
  const slotElement = children[i];
3635
3636
  let slotDir;
3636
3637
  if (!isTemplateNode(slotElement) ||
3637
3638
  !(slotDir = findDir(slotElement, 'slot', true))) {
3638
3639
  // not a <template v-slot>, skip.
3639
- if (slotElement.type !== 3 /* COMMENT */) {
3640
+ if (slotElement.type !== 3 /* NodeTypes.COMMENT */) {
3640
3641
  implicitDefaultChildren.push(slotElement);
3641
3642
  }
3642
3643
  continue;
3643
3644
  }
3644
3645
  if (onComponentSlot) {
3645
3646
  // already has on-component slot - this is incorrect usage.
3646
- context.onError(createCompilerError(37 /* X_V_SLOT_MIXED_SLOT_USAGE */, slotDir.loc));
3647
+ context.onError(createCompilerError(37 /* ErrorCodes.X_V_SLOT_MIXED_SLOT_USAGE */, slotDir.loc));
3647
3648
  break;
3648
3649
  }
3649
3650
  hasTemplateSlots = true;
@@ -3664,7 +3665,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3664
3665
  let vFor;
3665
3666
  if ((vIf = findDir(slotElement, 'if'))) {
3666
3667
  hasDynamicSlots = true;
3667
- dynamicSlots.push(createConditionalExpression(vIf.exp, buildDynamicSlot(slotName, slotFunction), defaultFallback));
3668
+ dynamicSlots.push(createConditionalExpression(vIf.exp, buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++), defaultFallback));
3668
3669
  }
3669
3670
  else if ((vElse = findDir(slotElement, /^else(-if)?$/, true /* allowEmpty */))) {
3670
3671
  // find adjacent v-if
@@ -3672,7 +3673,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3672
3673
  let prev;
3673
3674
  while (j--) {
3674
3675
  prev = children[j];
3675
- if (prev.type !== 3 /* COMMENT */) {
3676
+ if (prev.type !== 3 /* NodeTypes.COMMENT */) {
3676
3677
  break;
3677
3678
  }
3678
3679
  }
@@ -3682,15 +3683,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3682
3683
  i--;
3683
3684
  // attach this slot to previous conditional
3684
3685
  let conditional = dynamicSlots[dynamicSlots.length - 1];
3685
- while (conditional.alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
3686
+ while (conditional.alternate.type === 19 /* NodeTypes.JS_CONDITIONAL_EXPRESSION */) {
3686
3687
  conditional = conditional.alternate;
3687
3688
  }
3688
3689
  conditional.alternate = vElse.exp
3689
- ? createConditionalExpression(vElse.exp, buildDynamicSlot(slotName, slotFunction), defaultFallback)
3690
- : buildDynamicSlot(slotName, slotFunction);
3690
+ ? createConditionalExpression(vElse.exp, buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++), defaultFallback)
3691
+ : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
3691
3692
  }
3692
3693
  else {
3693
- context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, vElse.loc));
3694
+ context.onError(createCompilerError(30 /* ErrorCodes.X_V_ELSE_NO_ADJACENT_IF */, vElse.loc));
3694
3695
  }
3695
3696
  }
3696
3697
  else if ((vFor = findDir(slotElement, 'for'))) {
@@ -3706,14 +3707,14 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3706
3707
  ]));
3707
3708
  }
3708
3709
  else {
3709
- context.onError(createCompilerError(32 /* X_V_FOR_MALFORMED_EXPRESSION */, vFor.loc));
3710
+ context.onError(createCompilerError(32 /* ErrorCodes.X_V_FOR_MALFORMED_EXPRESSION */, vFor.loc));
3710
3711
  }
3711
3712
  }
3712
3713
  else {
3713
3714
  // check duplicate static names
3714
3715
  if (staticSlotName) {
3715
3716
  if (seenSlotNames.has(staticSlotName)) {
3716
- context.onError(createCompilerError(38 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */, dirLoc));
3717
+ context.onError(createCompilerError(38 /* ErrorCodes.X_V_SLOT_DUPLICATE_SLOT_NAMES */, dirLoc));
3717
3718
  continue;
3718
3719
  }
3719
3720
  seenSlotNames.add(staticSlotName);
@@ -3743,7 +3744,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3743
3744
  implicitDefaultChildren.some(node => isNonWhitespaceContent(node))) {
3744
3745
  // implicit default slot (mixed with named slots)
3745
3746
  if (hasNamedDefaultSlot) {
3746
- context.onError(createCompilerError(39 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */, implicitDefaultChildren[0].loc));
3747
+ context.onError(createCompilerError(39 /* ErrorCodes.X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */, implicitDefaultChildren[0].loc));
3747
3748
  }
3748
3749
  else {
3749
3750
  slotsProperties.push(buildDefaultSlotProperty(undefined, implicitDefaultChildren));
@@ -3751,10 +3752,10 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3751
3752
  }
3752
3753
  }
3753
3754
  const slotFlag = hasDynamicSlots
3754
- ? 2 /* DYNAMIC */
3755
+ ? 2 /* SlotFlags.DYNAMIC */
3755
3756
  : hasForwardedSlots(node.children)
3756
- ? 3 /* FORWARDED */
3757
- : 1 /* STABLE */;
3757
+ ? 3 /* SlotFlags.FORWARDED */
3758
+ : 1 /* SlotFlags.STABLE */;
3758
3759
  let slots = createObjectExpression(slotsProperties.concat(createObjectProperty(`_`,
3759
3760
  // 2 = compiled but dynamic = can skip normalization, but must run diff
3760
3761
  // 1 = compiled and static = can skip normalization AND diff as optimized
@@ -3770,28 +3771,32 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3770
3771
  hasDynamicSlots
3771
3772
  };
3772
3773
  }
3773
- function buildDynamicSlot(name, fn) {
3774
- return createObjectExpression([
3774
+ function buildDynamicSlot(name, fn, index) {
3775
+ const props = [
3775
3776
  createObjectProperty(`name`, name),
3776
3777
  createObjectProperty(`fn`, fn)
3777
- ]);
3778
+ ];
3779
+ if (index != null) {
3780
+ props.push(createObjectProperty(`key`, createSimpleExpression(String(index), true)));
3781
+ }
3782
+ return createObjectExpression(props);
3778
3783
  }
3779
3784
  function hasForwardedSlots(children) {
3780
3785
  for (let i = 0; i < children.length; i++) {
3781
3786
  const child = children[i];
3782
3787
  switch (child.type) {
3783
- case 1 /* ELEMENT */:
3784
- if (child.tagType === 2 /* SLOT */ ||
3788
+ case 1 /* NodeTypes.ELEMENT */:
3789
+ if (child.tagType === 2 /* ElementTypes.SLOT */ ||
3785
3790
  hasForwardedSlots(child.children)) {
3786
3791
  return true;
3787
3792
  }
3788
3793
  break;
3789
- case 9 /* IF */:
3794
+ case 9 /* NodeTypes.IF */:
3790
3795
  if (hasForwardedSlots(child.branches))
3791
3796
  return true;
3792
3797
  break;
3793
- case 10 /* IF_BRANCH */:
3794
- case 11 /* FOR */:
3798
+ case 10 /* NodeTypes.IF_BRANCH */:
3799
+ case 11 /* NodeTypes.FOR */:
3795
3800
  if (hasForwardedSlots(child.children))
3796
3801
  return true;
3797
3802
  break;
@@ -3800,9 +3805,9 @@ function hasForwardedSlots(children) {
3800
3805
  return false;
3801
3806
  }
3802
3807
  function isNonWhitespaceContent(node) {
3803
- if (node.type !== 2 /* TEXT */ && node.type !== 12 /* TEXT_CALL */)
3808
+ if (node.type !== 2 /* NodeTypes.TEXT */ && node.type !== 12 /* NodeTypes.TEXT_CALL */)
3804
3809
  return true;
3805
- return node.type === 2 /* TEXT */
3810
+ return node.type === 2 /* NodeTypes.TEXT */
3806
3811
  ? !!node.content.trim()
3807
3812
  : isNonWhitespaceContent(node.content);
3808
3813
  }
@@ -3816,13 +3821,13 @@ const transformElement = (node, context) => {
3816
3821
  // processed and merged.
3817
3822
  return function postTransformElement() {
3818
3823
  node = context.currentNode;
3819
- if (!(node.type === 1 /* ELEMENT */ &&
3820
- (node.tagType === 0 /* ELEMENT */ ||
3821
- node.tagType === 1 /* COMPONENT */))) {
3824
+ if (!(node.type === 1 /* NodeTypes.ELEMENT */ &&
3825
+ (node.tagType === 0 /* ElementTypes.ELEMENT */ ||
3826
+ node.tagType === 1 /* ElementTypes.COMPONENT */))) {
3822
3827
  return;
3823
3828
  }
3824
3829
  const { tag, props } = node;
3825
- const isComponent = node.tagType === 1 /* COMPONENT */;
3830
+ const isComponent = node.tagType === 1 /* ElementTypes.COMPONENT */;
3826
3831
  // The goal of the transform is to create a codegenNode implementing the
3827
3832
  // VNodeCall interface.
3828
3833
  let vnodeTag = isComponent
@@ -3873,9 +3878,9 @@ const transformElement = (node, context) => {
3873
3878
  // collected by a parent block.
3874
3879
  shouldUseBlock = true;
3875
3880
  // 2. Force keep-alive to always be updated, since it uses raw children.
3876
- patchFlag |= 1024 /* DYNAMIC_SLOTS */;
3881
+ patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
3877
3882
  if (node.children.length > 1) {
3878
- context.onError(createCompilerError(45 /* X_KEEP_ALIVE_INVALID_CHILDREN */, {
3883
+ context.onError(createCompilerError(45 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */, {
3879
3884
  start: node.children[0].loc.start,
3880
3885
  end: node.children[node.children.length - 1].loc.end,
3881
3886
  source: ''
@@ -3891,22 +3896,22 @@ const transformElement = (node, context) => {
3891
3896
  const { slots, hasDynamicSlots } = buildSlots(node, context);
3892
3897
  vnodeChildren = slots;
3893
3898
  if (hasDynamicSlots) {
3894
- patchFlag |= 1024 /* DYNAMIC_SLOTS */;
3899
+ patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
3895
3900
  }
3896
3901
  }
3897
3902
  else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
3898
3903
  const child = node.children[0];
3899
3904
  const type = child.type;
3900
3905
  // check for dynamic text children
3901
- const hasDynamicTextChild = type === 5 /* INTERPOLATION */ ||
3902
- type === 8 /* COMPOUND_EXPRESSION */;
3906
+ const hasDynamicTextChild = type === 5 /* NodeTypes.INTERPOLATION */ ||
3907
+ type === 8 /* NodeTypes.COMPOUND_EXPRESSION */;
3903
3908
  if (hasDynamicTextChild &&
3904
- getConstantType(child, context) === 0 /* NOT_CONSTANT */) {
3905
- patchFlag |= 1 /* TEXT */;
3909
+ getConstantType(child, context) === 0 /* ConstantTypes.NOT_CONSTANT */) {
3910
+ patchFlag |= 1 /* PatchFlags.TEXT */;
3906
3911
  }
3907
3912
  // pass directly if the only child is a text node
3908
3913
  // (plain / interpolation / expression)
3909
- if (hasDynamicTextChild || type === 2 /* TEXT */) {
3914
+ if (hasDynamicTextChild || type === 2 /* NodeTypes.TEXT */) {
3910
3915
  vnodeChildren = child;
3911
3916
  }
3912
3917
  else {
@@ -3948,8 +3953,8 @@ function resolveComponentType(node, context, ssr = false) {
3948
3953
  const isProp = findProp(node, 'is');
3949
3954
  if (isProp) {
3950
3955
  if (isExplicitDynamic ||
3951
- (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))) {
3952
- const exp = isProp.type === 6 /* ATTRIBUTE */
3956
+ (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* CompilerDeprecationTypes.COMPILER_IS_ON_ELEMENT */, context))) {
3957
+ const exp = isProp.type === 6 /* NodeTypes.ATTRIBUTE */
3953
3958
  ? isProp.value && createSimpleExpression(isProp.value.content, true)
3954
3959
  : isProp.exp;
3955
3960
  if (exp) {
@@ -3958,7 +3963,7 @@ function resolveComponentType(node, context, ssr = false) {
3958
3963
  ]);
3959
3964
  }
3960
3965
  }
3961
- else if (isProp.type === 6 /* ATTRIBUTE */ &&
3966
+ else if (isProp.type === 6 /* NodeTypes.ATTRIBUTE */ &&
3962
3967
  isProp.value.content.startsWith('vue:')) {
3963
3968
  // <button is="vue:xxx">
3964
3969
  // if not <component>, only is value that starts with "vue:" will be
@@ -4022,9 +4027,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4022
4027
  if (isEventHandler && isReservedProp(name)) {
4023
4028
  hasVnodeHook = true;
4024
4029
  }
4025
- if (value.type === 20 /* JS_CACHE_EXPRESSION */ ||
4026
- ((value.type === 4 /* SIMPLE_EXPRESSION */ ||
4027
- value.type === 8 /* COMPOUND_EXPRESSION */) &&
4030
+ if (value.type === 20 /* NodeTypes.JS_CACHE_EXPRESSION */ ||
4031
+ ((value.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ ||
4032
+ value.type === 8 /* NodeTypes.COMPOUND_EXPRESSION */) &&
4028
4033
  getConstantType(value, context) > 0)) {
4029
4034
  // skip if the prop is a cached handler or has constant value
4030
4035
  return;
@@ -4055,7 +4060,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4055
4060
  for (let i = 0; i < props.length; i++) {
4056
4061
  // static attribute
4057
4062
  const prop = props[i];
4058
- if (prop.type === 6 /* ATTRIBUTE */) {
4063
+ if (prop.type === 6 /* NodeTypes.ATTRIBUTE */) {
4059
4064
  const { loc, name, value } = prop;
4060
4065
  let isStatic = true;
4061
4066
  if (name === 'ref') {
@@ -4068,7 +4073,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4068
4073
  if (name === 'is' &&
4069
4074
  (isComponentTag(tag) ||
4070
4075
  (value && value.content.startsWith('vue:')) ||
4071
- (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
4076
+ (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* CompilerDeprecationTypes.COMPILER_IS_ON_ELEMENT */, context)))) {
4072
4077
  continue;
4073
4078
  }
4074
4079
  properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
@@ -4081,7 +4086,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4081
4086
  // skip v-slot - it is handled by its dedicated transform.
4082
4087
  if (name === 'slot') {
4083
4088
  if (!isComponent) {
4084
- context.onError(createCompilerError(40 /* X_V_SLOT_MISPLACED */, loc));
4089
+ context.onError(createCompilerError(40 /* ErrorCodes.X_V_SLOT_MISPLACED */, loc));
4085
4090
  }
4086
4091
  continue;
4087
4092
  }
@@ -4094,7 +4099,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4094
4099
  (isVBind &&
4095
4100
  isStaticArgOf(arg, 'is') &&
4096
4101
  (isComponentTag(tag) ||
4097
- (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
4102
+ (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* CompilerDeprecationTypes.COMPILER_IS_ON_ELEMENT */, context))))) {
4098
4103
  continue;
4099
4104
  }
4100
4105
  // skip v-on in SSR compilation
@@ -4125,9 +4130,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4125
4130
  // 2.x v-bind object order compat
4126
4131
  {
4127
4132
  const hasOverridableKeys = mergeArgs.some(arg => {
4128
- if (arg.type === 15 /* JS_OBJECT_EXPRESSION */) {
4133
+ if (arg.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
4129
4134
  return arg.properties.some(({ key }) => {
4130
- if (key.type !== 4 /* SIMPLE_EXPRESSION */ ||
4135
+ if (key.type !== 4 /* NodeTypes.SIMPLE_EXPRESSION */ ||
4131
4136
  !key.isStatic) {
4132
4137
  return true;
4133
4138
  }
@@ -4142,10 +4147,10 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4142
4147
  }
4143
4148
  });
4144
4149
  if (hasOverridableKeys) {
4145
- checkCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER" /* COMPILER_V_BIND_OBJECT_ORDER */, context, loc);
4150
+ checkCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER" /* CompilerDeprecationTypes.COMPILER_V_BIND_OBJECT_ORDER */, context, loc);
4146
4151
  }
4147
4152
  }
4148
- if (isCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER" /* COMPILER_V_BIND_OBJECT_ORDER */, context)) {
4153
+ if (isCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER" /* CompilerDeprecationTypes.COMPILER_V_BIND_OBJECT_ORDER */, context)) {
4149
4154
  mergeArgs.unshift(exp);
4150
4155
  continue;
4151
4156
  }
@@ -4155,17 +4160,17 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4155
4160
  else {
4156
4161
  // v-on="obj" -> toHandlers(obj)
4157
4162
  mergeArgs.push({
4158
- type: 14 /* JS_CALL_EXPRESSION */,
4163
+ type: 14 /* NodeTypes.JS_CALL_EXPRESSION */,
4159
4164
  loc,
4160
4165
  callee: context.helper(TO_HANDLERS),
4161
- arguments: [exp]
4166
+ arguments: isComponent ? [exp] : [exp, `true`]
4162
4167
  });
4163
4168
  }
4164
4169
  }
4165
4170
  else {
4166
4171
  context.onError(createCompilerError(isVBind
4167
- ? 34 /* X_V_BIND_NO_EXPRESSION */
4168
- : 35 /* X_V_ON_NO_EXPRESSION */, loc));
4172
+ ? 34 /* ErrorCodes.X_V_BIND_NO_EXPRESSION */
4173
+ : 35 /* ErrorCodes.X_V_ON_NO_EXPRESSION */, loc));
4169
4174
  }
4170
4175
  continue;
4171
4176
  }
@@ -4212,31 +4217,31 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4212
4217
  }
4213
4218
  // patchFlag analysis
4214
4219
  if (hasDynamicKeys) {
4215
- patchFlag |= 16 /* FULL_PROPS */;
4220
+ patchFlag |= 16 /* PatchFlags.FULL_PROPS */;
4216
4221
  }
4217
4222
  else {
4218
4223
  if (hasClassBinding && !isComponent) {
4219
- patchFlag |= 2 /* CLASS */;
4224
+ patchFlag |= 2 /* PatchFlags.CLASS */;
4220
4225
  }
4221
4226
  if (hasStyleBinding && !isComponent) {
4222
- patchFlag |= 4 /* STYLE */;
4227
+ patchFlag |= 4 /* PatchFlags.STYLE */;
4223
4228
  }
4224
4229
  if (dynamicPropNames.length) {
4225
- patchFlag |= 8 /* PROPS */;
4230
+ patchFlag |= 8 /* PatchFlags.PROPS */;
4226
4231
  }
4227
4232
  if (hasHydrationEventBinding) {
4228
- patchFlag |= 32 /* HYDRATE_EVENTS */;
4233
+ patchFlag |= 32 /* PatchFlags.HYDRATE_EVENTS */;
4229
4234
  }
4230
4235
  }
4231
4236
  if (!shouldUseBlock &&
4232
- (patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
4237
+ (patchFlag === 0 || patchFlag === 32 /* PatchFlags.HYDRATE_EVENTS */) &&
4233
4238
  (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
4234
- patchFlag |= 512 /* NEED_PATCH */;
4239
+ patchFlag |= 512 /* PatchFlags.NEED_PATCH */;
4235
4240
  }
4236
4241
  // pre-normalize props, SSR is skipped for now
4237
4242
  if (!context.inSSR && propsExpression) {
4238
4243
  switch (propsExpression.type) {
4239
- case 15 /* JS_OBJECT_EXPRESSION */:
4244
+ case 15 /* NodeTypes.JS_OBJECT_EXPRESSION */:
4240
4245
  // means that there is no v-bind,
4241
4246
  // but still need to deal with dynamic key binding
4242
4247
  let classKeyIndex = -1;
@@ -4267,11 +4272,11 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4267
4272
  // the static style is compiled into an object,
4268
4273
  // so use `hasStyleBinding` to ensure that it is a dynamic style binding
4269
4274
  (hasStyleBinding ||
4270
- (styleProp.value.type === 4 /* SIMPLE_EXPRESSION */ &&
4275
+ (styleProp.value.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
4271
4276
  styleProp.value.content.trim()[0] === `[`) ||
4272
4277
  // v-bind:style and style both exist,
4273
4278
  // v-bind:style with static literal object
4274
- styleProp.value.type === 17 /* JS_ARRAY_EXPRESSION */)) {
4279
+ styleProp.value.type === 17 /* NodeTypes.JS_ARRAY_EXPRESSION */)) {
4275
4280
  styleProp.value = createCallExpression(context.helper(NORMALIZE_STYLE), [styleProp.value]);
4276
4281
  }
4277
4282
  }
@@ -4280,7 +4285,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4280
4285
  propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [propsExpression]);
4281
4286
  }
4282
4287
  break;
4283
- case 14 /* JS_CALL_EXPRESSION */:
4288
+ case 14 /* NodeTypes.JS_CALL_EXPRESSION */:
4284
4289
  // mergeProps call, do nothing
4285
4290
  break;
4286
4291
  default:
@@ -4313,7 +4318,7 @@ function dedupeProperties(properties) {
4313
4318
  for (let i = 0; i < properties.length; i++) {
4314
4319
  const prop = properties[i];
4315
4320
  // dynamic keys are always allowed
4316
- if (prop.key.type === 8 /* COMPOUND_EXPRESSION */ || !prop.key.isStatic) {
4321
+ if (prop.key.type === 8 /* NodeTypes.COMPOUND_EXPRESSION */ || !prop.key.isStatic) {
4317
4322
  deduped.push(prop);
4318
4323
  continue;
4319
4324
  }
@@ -4333,7 +4338,7 @@ function dedupeProperties(properties) {
4333
4338
  return deduped;
4334
4339
  }
4335
4340
  function mergeAsArray(existing, incoming) {
4336
- if (existing.value.type === 17 /* JS_ARRAY_EXPRESSION */) {
4341
+ if (existing.value.type === 17 /* NodeTypes.JS_ARRAY_EXPRESSION */) {
4337
4342
  existing.value.elements.push(incoming.value);
4338
4343
  }
4339
4344
  else {
@@ -4422,7 +4427,7 @@ function processSlotOutlet(node, context) {
4422
4427
  const nonNameProps = [];
4423
4428
  for (let i = 0; i < node.props.length; i++) {
4424
4429
  const p = node.props[i];
4425
- if (p.type === 6 /* ATTRIBUTE */) {
4430
+ if (p.type === 6 /* NodeTypes.ATTRIBUTE */) {
4426
4431
  if (p.value) {
4427
4432
  if (p.name === 'name') {
4428
4433
  slotName = JSON.stringify(p.value.content);
@@ -4450,7 +4455,7 @@ function processSlotOutlet(node, context) {
4450
4455
  const { props, directives } = buildProps(node, context, nonNameProps, false, false);
4451
4456
  slotProps = props;
4452
4457
  if (directives.length) {
4453
- context.onError(createCompilerError(36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
4458
+ context.onError(createCompilerError(36 /* ErrorCodes.X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
4454
4459
  }
4455
4460
  }
4456
4461
  return {
@@ -4463,18 +4468,26 @@ const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*=>|^\s*(async\s+)?functio
4463
4468
  const transformOn = (dir, node, context, augmentor) => {
4464
4469
  const { loc, modifiers, arg } = dir;
4465
4470
  if (!dir.exp && !modifiers.length) {
4466
- context.onError(createCompilerError(35 /* X_V_ON_NO_EXPRESSION */, loc));
4471
+ context.onError(createCompilerError(35 /* ErrorCodes.X_V_ON_NO_EXPRESSION */, loc));
4467
4472
  }
4468
4473
  let eventName;
4469
- if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
4474
+ if (arg.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
4470
4475
  if (arg.isStatic) {
4471
4476
  let rawName = arg.content;
4472
4477
  // TODO deprecate @vnodeXXX usage
4473
4478
  if (rawName.startsWith('vue:')) {
4474
4479
  rawName = `vnode-${rawName.slice(4)}`;
4475
4480
  }
4476
- // for all event listeners, auto convert it to camelCase. See issue #2249
4477
- eventName = createSimpleExpression(toHandlerKey(camelize(rawName)), true, arg.loc);
4481
+ const eventString = node.tagType === 1 /* ElementTypes.COMPONENT */ ||
4482
+ rawName.startsWith('vnode') ||
4483
+ !/[A-Z]/.test(rawName)
4484
+ ? // for component and vnode lifecycle event listeners, auto convert
4485
+ // it to camelCase. See issue #2249
4486
+ toHandlerKey(camelize(rawName))
4487
+ // preserve case for plain element listeners that have uppercase
4488
+ // letters, as these may be custom elements' custom events
4489
+ : `on:${rawName}`;
4490
+ eventName = createSimpleExpression(eventString, true, arg.loc);
4478
4491
  }
4479
4492
  else {
4480
4493
  // #2388
@@ -4541,7 +4554,7 @@ const transformOn = (dir, node, context, augmentor) => {
4541
4554
  const transformBind = (dir, _node, context) => {
4542
4555
  const { exp, modifiers, loc } = dir;
4543
4556
  const arg = dir.arg;
4544
- if (arg.type !== 4 /* SIMPLE_EXPRESSION */) {
4557
+ if (arg.type !== 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
4545
4558
  arg.children.unshift(`(`);
4546
4559
  arg.children.push(`) || ""`);
4547
4560
  }
@@ -4550,7 +4563,7 @@ const transformBind = (dir, _node, context) => {
4550
4563
  }
4551
4564
  // .sync is replaced by v-model:arg
4552
4565
  if (modifiers.includes('camel')) {
4553
- if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
4566
+ if (arg.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
4554
4567
  if (arg.isStatic) {
4555
4568
  arg.content = camelize(arg.content);
4556
4569
  }
@@ -4572,8 +4585,8 @@ const transformBind = (dir, _node, context) => {
4572
4585
  }
4573
4586
  }
4574
4587
  if (!exp ||
4575
- (exp.type === 4 /* SIMPLE_EXPRESSION */ && !exp.content.trim())) {
4576
- context.onError(createCompilerError(34 /* X_V_BIND_NO_EXPRESSION */, loc));
4588
+ (exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ && !exp.content.trim())) {
4589
+ context.onError(createCompilerError(34 /* ErrorCodes.X_V_BIND_NO_EXPRESSION */, loc));
4577
4590
  return {
4578
4591
  props: [createObjectProperty(arg, createSimpleExpression('', true, loc))]
4579
4592
  };
@@ -4583,7 +4596,7 @@ const transformBind = (dir, _node, context) => {
4583
4596
  };
4584
4597
  };
4585
4598
  const injectPrefix = (arg, prefix) => {
4586
- if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
4599
+ if (arg.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
4587
4600
  if (arg.isStatic) {
4588
4601
  arg.content = prefix + arg.content;
4589
4602
  }
@@ -4600,10 +4613,10 @@ const injectPrefix = (arg, prefix) => {
4600
4613
  // Merge adjacent text nodes and expressions into a single expression
4601
4614
  // e.g. <div>abc {{ d }} {{ e }}</div> should have a single expression node as child.
4602
4615
  const transformText = (node, context) => {
4603
- if (node.type === 0 /* ROOT */ ||
4604
- node.type === 1 /* ELEMENT */ ||
4605
- node.type === 11 /* FOR */ ||
4606
- node.type === 10 /* IF_BRANCH */) {
4616
+ if (node.type === 0 /* NodeTypes.ROOT */ ||
4617
+ node.type === 1 /* NodeTypes.ELEMENT */ ||
4618
+ node.type === 11 /* NodeTypes.FOR */ ||
4619
+ node.type === 10 /* NodeTypes.IF_BRANCH */) {
4607
4620
  // perform the transform on node exit so that all expressions have already
4608
4621
  // been processed.
4609
4622
  return () => {
@@ -4638,15 +4651,15 @@ const transformText = (node, context) => {
4638
4651
  // setting textContent of the element.
4639
4652
  // for component root it's always normalized anyway.
4640
4653
  (children.length === 1 &&
4641
- (node.type === 0 /* ROOT */ ||
4642
- (node.type === 1 /* ELEMENT */ &&
4643
- node.tagType === 0 /* ELEMENT */ &&
4654
+ (node.type === 0 /* NodeTypes.ROOT */ ||
4655
+ (node.type === 1 /* NodeTypes.ELEMENT */ &&
4656
+ node.tagType === 0 /* ElementTypes.ELEMENT */ &&
4644
4657
  // #3756
4645
4658
  // custom directives can potentially add DOM elements arbitrarily,
4646
4659
  // we need to avoid setting textContent of the element at runtime
4647
4660
  // to avoid accidentally overwriting the DOM elements added
4648
4661
  // by the user through custom directives.
4649
- !node.props.find(p => p.type === 7 /* DIRECTIVE */ &&
4662
+ !node.props.find(p => p.type === 7 /* NodeTypes.DIRECTIVE */ &&
4650
4663
  !context.directiveTransforms[p.name]) &&
4651
4664
  // in compat mode, <template> tags with no special directives
4652
4665
  // will be rendered as a fragment so its children must be
@@ -4658,21 +4671,21 @@ const transformText = (node, context) => {
4658
4671
  // runtime normalization.
4659
4672
  for (let i = 0; i < children.length; i++) {
4660
4673
  const child = children[i];
4661
- if (isText(child) || child.type === 8 /* COMPOUND_EXPRESSION */) {
4674
+ if (isText(child) || child.type === 8 /* NodeTypes.COMPOUND_EXPRESSION */) {
4662
4675
  const callArgs = [];
4663
4676
  // createTextVNode defaults to single whitespace, so if it is a
4664
4677
  // single space the code could be an empty call to save bytes.
4665
- if (child.type !== 2 /* TEXT */ || child.content !== ' ') {
4678
+ if (child.type !== 2 /* NodeTypes.TEXT */ || child.content !== ' ') {
4666
4679
  callArgs.push(child);
4667
4680
  }
4668
4681
  // mark dynamic text with flag so it gets patched inside a block
4669
4682
  if (!context.ssr &&
4670
- getConstantType(child, context) === 0 /* NOT_CONSTANT */) {
4671
- callArgs.push(1 /* TEXT */ +
4672
- (` /* ${PatchFlagNames[1 /* TEXT */]} */` ));
4683
+ getConstantType(child, context) === 0 /* ConstantTypes.NOT_CONSTANT */) {
4684
+ callArgs.push(1 /* PatchFlags.TEXT */ +
4685
+ (` /* ${PatchFlagNames[1 /* PatchFlags.TEXT */]} */` ));
4673
4686
  }
4674
4687
  children[i] = {
4675
- type: 12 /* TEXT_CALL */,
4688
+ type: 12 /* NodeTypes.TEXT_CALL */,
4676
4689
  content: child,
4677
4690
  loc: child.loc,
4678
4691
  codegenNode: createCallExpression(context.helper(CREATE_TEXT), callArgs)
@@ -4685,7 +4698,7 @@ const transformText = (node, context) => {
4685
4698
 
4686
4699
  const seen = new WeakSet();
4687
4700
  const transformOnce = (node, context) => {
4688
- if (node.type === 1 /* ELEMENT */ && findDir(node, 'once', true)) {
4701
+ if (node.type === 1 /* NodeTypes.ELEMENT */ && findDir(node, 'once', true)) {
4689
4702
  if (seen.has(node) || context.inVOnce) {
4690
4703
  return;
4691
4704
  }
@@ -4705,18 +4718,18 @@ const transformOnce = (node, context) => {
4705
4718
  const transformModel = (dir, node, context) => {
4706
4719
  const { exp, arg } = dir;
4707
4720
  if (!exp) {
4708
- context.onError(createCompilerError(41 /* X_V_MODEL_NO_EXPRESSION */, dir.loc));
4721
+ context.onError(createCompilerError(41 /* ErrorCodes.X_V_MODEL_NO_EXPRESSION */, dir.loc));
4709
4722
  return createTransformProps();
4710
4723
  }
4711
4724
  const rawExp = exp.loc.source;
4712
- const expString = exp.type === 4 /* SIMPLE_EXPRESSION */ ? exp.content : rawExp;
4725
+ const expString = exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ ? exp.content : rawExp;
4713
4726
  // im SFC <script setup> inline mode, the exp may have been transformed into
4714
4727
  // _unref(exp)
4715
4728
  context.bindingMetadata[rawExp];
4716
- const maybeRef = !true /* SETUP_CONST */;
4729
+ const maybeRef = !true /* BindingTypes.SETUP_CONST */;
4717
4730
  if (!expString.trim() ||
4718
4731
  (!isMemberExpression(expString) && !maybeRef)) {
4719
- context.onError(createCompilerError(42 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
4732
+ context.onError(createCompilerError(42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
4720
4733
  return createTransformProps();
4721
4734
  }
4722
4735
  const propName = arg ? arg : createSimpleExpression('modelValue', true);
@@ -4741,7 +4754,7 @@ const transformModel = (dir, node, context) => {
4741
4754
  createObjectProperty(eventName, assignmentExp)
4742
4755
  ];
4743
4756
  // modelModifiers: { foo: true, "bar-baz": true }
4744
- if (dir.modifiers.length && node.tagType === 1 /* COMPONENT */) {
4757
+ if (dir.modifiers.length && node.tagType === 1 /* ElementTypes.COMPONENT */) {
4745
4758
  const modifiers = dir.modifiers
4746
4759
  .map(m => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`)
4747
4760
  .join(`, `);
@@ -4750,7 +4763,7 @@ const transformModel = (dir, node, context) => {
4750
4763
  ? `${arg.content}Modifiers`
4751
4764
  : createCompoundExpression([arg, ' + "Modifiers"'])
4752
4765
  : `modelModifiers`;
4753
- props.push(createObjectProperty(modifiersKey, createSimpleExpression(`{ ${modifiers} }`, false, dir.loc, 2 /* CAN_HOIST */)));
4766
+ props.push(createObjectProperty(modifiersKey, createSimpleExpression(`{ ${modifiers} }`, false, dir.loc, 2 /* ConstantTypes.CAN_HOIST */)));
4754
4767
  }
4755
4768
  return createTransformProps(props);
4756
4769
  };
@@ -4760,17 +4773,17 @@ function createTransformProps(props = []) {
4760
4773
 
4761
4774
  const validDivisionCharRE = /[\w).+\-_$\]]/;
4762
4775
  const transformFilter = (node, context) => {
4763
- if (!isCompatEnabled("COMPILER_FILTER" /* COMPILER_FILTERS */, context)) {
4776
+ if (!isCompatEnabled("COMPILER_FILTER" /* CompilerDeprecationTypes.COMPILER_FILTERS */, context)) {
4764
4777
  return;
4765
4778
  }
4766
- if (node.type === 5 /* INTERPOLATION */) {
4779
+ if (node.type === 5 /* NodeTypes.INTERPOLATION */) {
4767
4780
  // filter rewrite is applied before expression transform so only
4768
4781
  // simple expressions are possible at this stage
4769
4782
  rewriteFilter(node.content, context);
4770
4783
  }
4771
- if (node.type === 1 /* ELEMENT */) {
4784
+ if (node.type === 1 /* NodeTypes.ELEMENT */) {
4772
4785
  node.props.forEach((prop) => {
4773
- if (prop.type === 7 /* DIRECTIVE */ &&
4786
+ if (prop.type === 7 /* NodeTypes.DIRECTIVE */ &&
4774
4787
  prop.name !== 'for' &&
4775
4788
  prop.exp) {
4776
4789
  rewriteFilter(prop.exp, context);
@@ -4779,7 +4792,7 @@ const transformFilter = (node, context) => {
4779
4792
  }
4780
4793
  };
4781
4794
  function rewriteFilter(node, context) {
4782
- if (node.type === 4 /* SIMPLE_EXPRESSION */) {
4795
+ if (node.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
4783
4796
  parseFilter(node, context);
4784
4797
  }
4785
4798
  else {
@@ -4787,13 +4800,13 @@ function rewriteFilter(node, context) {
4787
4800
  const child = node.children[i];
4788
4801
  if (typeof child !== 'object')
4789
4802
  continue;
4790
- if (child.type === 4 /* SIMPLE_EXPRESSION */) {
4803
+ if (child.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
4791
4804
  parseFilter(child, context);
4792
4805
  }
4793
- else if (child.type === 8 /* COMPOUND_EXPRESSION */) {
4806
+ else if (child.type === 8 /* NodeTypes.COMPOUND_EXPRESSION */) {
4794
4807
  rewriteFilter(node, context);
4795
4808
  }
4796
- else if (child.type === 5 /* INTERPOLATION */) {
4809
+ else if (child.type === 5 /* NodeTypes.INTERPOLATION */) {
4797
4810
  rewriteFilter(child.content, context);
4798
4811
  }
4799
4812
  }
@@ -4901,7 +4914,7 @@ function parseFilter(node, context) {
4901
4914
  lastFilterIndex = i + 1;
4902
4915
  }
4903
4916
  if (filters.length) {
4904
- warnDeprecation("COMPILER_FILTER" /* COMPILER_FILTERS */, context, node.loc);
4917
+ warnDeprecation("COMPILER_FILTER" /* CompilerDeprecationTypes.COMPILER_FILTERS */, context, node.loc);
4905
4918
  for (i = 0; i < filters.length; i++) {
4906
4919
  expression = wrapFilter(expression, filters[i], context);
4907
4920
  }
@@ -4925,7 +4938,7 @@ function wrapFilter(exp, filter, context) {
4925
4938
 
4926
4939
  const seen$1 = new WeakSet();
4927
4940
  const transformMemo = (node, context) => {
4928
- if (node.type === 1 /* ELEMENT */) {
4941
+ if (node.type === 1 /* NodeTypes.ELEMENT */) {
4929
4942
  const dir = findDir(node, 'memo');
4930
4943
  if (!dir || seen$1.has(node)) {
4931
4944
  return;
@@ -4934,9 +4947,9 @@ const transformMemo = (node, context) => {
4934
4947
  return () => {
4935
4948
  const codegenNode = node.codegenNode ||
4936
4949
  context.currentNode.codegenNode;
4937
- if (codegenNode && codegenNode.type === 13 /* VNODE_CALL */) {
4950
+ if (codegenNode && codegenNode.type === 13 /* NodeTypes.VNODE_CALL */) {
4938
4951
  // non-component sub tree should be turned into a block
4939
- if (node.tagType !== 1 /* COMPONENT */) {
4952
+ if (node.tagType !== 1 /* ElementTypes.COMPONENT */) {
4940
4953
  makeBlock(codegenNode, context);
4941
4954
  }
4942
4955
  node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
@@ -4980,18 +4993,18 @@ function baseCompile(template, options = {}) {
4980
4993
  /* istanbul ignore if */
4981
4994
  {
4982
4995
  if (options.prefixIdentifiers === true) {
4983
- onError(createCompilerError(46 /* X_PREFIX_ID_NOT_SUPPORTED */));
4996
+ onError(createCompilerError(46 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */));
4984
4997
  }
4985
4998
  else if (isModuleMode) {
4986
- onError(createCompilerError(47 /* X_MODULE_MODE_NOT_SUPPORTED */));
4999
+ onError(createCompilerError(47 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */));
4987
5000
  }
4988
5001
  }
4989
5002
  const prefixIdentifiers = !true ;
4990
5003
  if (options.cacheHandlers) {
4991
- onError(createCompilerError(48 /* X_CACHE_HANDLER_NOT_SUPPORTED */));
5004
+ onError(createCompilerError(48 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */));
4992
5005
  }
4993
5006
  if (options.scopeId && !isModuleMode) {
4994
- onError(createCompilerError(49 /* X_SCOPE_ID_NOT_SUPPORTED */));
5007
+ onError(createCompilerError(49 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */));
4995
5008
  }
4996
5009
  const ast = isString(template) ? baseParse(template, options) : template;
4997
5010
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
@@ -5066,54 +5079,54 @@ const parserOptions = {
5066
5079
  },
5067
5080
  // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
5068
5081
  getNamespace(tag, parent) {
5069
- let ns = parent ? parent.ns : 0 /* HTML */;
5070
- if (parent && ns === 2 /* MATH_ML */) {
5082
+ let ns = parent ? parent.ns : 0 /* DOMNamespaces.HTML */;
5083
+ if (parent && ns === 2 /* DOMNamespaces.MATH_ML */) {
5071
5084
  if (parent.tag === 'annotation-xml') {
5072
5085
  if (tag === 'svg') {
5073
- return 1 /* SVG */;
5086
+ return 1 /* DOMNamespaces.SVG */;
5074
5087
  }
5075
- if (parent.props.some(a => a.type === 6 /* ATTRIBUTE */ &&
5088
+ if (parent.props.some(a => a.type === 6 /* NodeTypes.ATTRIBUTE */ &&
5076
5089
  a.name === 'encoding' &&
5077
5090
  a.value != null &&
5078
5091
  (a.value.content === 'text/html' ||
5079
5092
  a.value.content === 'application/xhtml+xml'))) {
5080
- ns = 0 /* HTML */;
5093
+ ns = 0 /* DOMNamespaces.HTML */;
5081
5094
  }
5082
5095
  }
5083
5096
  else if (/^m(?:[ions]|text)$/.test(parent.tag) &&
5084
5097
  tag !== 'mglyph' &&
5085
5098
  tag !== 'malignmark') {
5086
- ns = 0 /* HTML */;
5099
+ ns = 0 /* DOMNamespaces.HTML */;
5087
5100
  }
5088
5101
  }
5089
- else if (parent && ns === 1 /* SVG */) {
5102
+ else if (parent && ns === 1 /* DOMNamespaces.SVG */) {
5090
5103
  if (parent.tag === 'foreignObject' ||
5091
5104
  parent.tag === 'desc' ||
5092
5105
  parent.tag === 'title') {
5093
- ns = 0 /* HTML */;
5106
+ ns = 0 /* DOMNamespaces.HTML */;
5094
5107
  }
5095
5108
  }
5096
- if (ns === 0 /* HTML */) {
5109
+ if (ns === 0 /* DOMNamespaces.HTML */) {
5097
5110
  if (tag === 'svg') {
5098
- return 1 /* SVG */;
5111
+ return 1 /* DOMNamespaces.SVG */;
5099
5112
  }
5100
5113
  if (tag === 'math') {
5101
- return 2 /* MATH_ML */;
5114
+ return 2 /* DOMNamespaces.MATH_ML */;
5102
5115
  }
5103
5116
  }
5104
5117
  return ns;
5105
5118
  },
5106
5119
  // https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
5107
5120
  getTextMode({ tag, ns }) {
5108
- if (ns === 0 /* HTML */) {
5121
+ if (ns === 0 /* DOMNamespaces.HTML */) {
5109
5122
  if (tag === 'textarea' || tag === 'title') {
5110
- return 1 /* RCDATA */;
5123
+ return 1 /* TextModes.RCDATA */;
5111
5124
  }
5112
5125
  if (isRawTextContainer(tag)) {
5113
- return 2 /* RAWTEXT */;
5126
+ return 2 /* TextModes.RAWTEXT */;
5114
5127
  }
5115
5128
  }
5116
- return 0 /* DATA */;
5129
+ return 0 /* TextModes.DATA */;
5117
5130
  }
5118
5131
  };
5119
5132
 
@@ -5124,12 +5137,12 @@ const parserOptions = {
5124
5137
  // It is then processed by `transformElement` and included in the generated
5125
5138
  // props.
5126
5139
  const transformStyle = node => {
5127
- if (node.type === 1 /* ELEMENT */) {
5140
+ if (node.type === 1 /* NodeTypes.ELEMENT */) {
5128
5141
  node.props.forEach((p, i) => {
5129
- if (p.type === 6 /* ATTRIBUTE */ && p.name === 'style' && p.value) {
5142
+ if (p.type === 6 /* NodeTypes.ATTRIBUTE */ && p.name === 'style' && p.value) {
5130
5143
  // replace p with an expression node
5131
5144
  node.props[i] = {
5132
- type: 7 /* DIRECTIVE */,
5145
+ type: 7 /* NodeTypes.DIRECTIVE */,
5133
5146
  name: `bind`,
5134
5147
  arg: createSimpleExpression(`style`, true, p.loc),
5135
5148
  exp: parseInlineCSS(p.value.content, p.loc),
@@ -5142,33 +5155,33 @@ const transformStyle = node => {
5142
5155
  };
5143
5156
  const parseInlineCSS = (cssText, loc) => {
5144
5157
  const normalized = parseStringStyle(cssText);
5145
- return createSimpleExpression(JSON.stringify(normalized), false, loc, 3 /* CAN_STRINGIFY */);
5158
+ return createSimpleExpression(JSON.stringify(normalized), false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
5146
5159
  };
5147
5160
 
5148
5161
  function createDOMCompilerError(code, loc) {
5149
5162
  return createCompilerError(code, loc, DOMErrorMessages );
5150
5163
  }
5151
5164
  const DOMErrorMessages = {
5152
- [50 /* X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
5153
- [51 /* X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
5154
- [52 /* X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
5155
- [53 /* X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
5156
- [54 /* X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
5157
- [55 /* X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
5158
- [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.`,
5159
- [57 /* X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
5160
- [58 /* X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
5161
- [59 /* X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
5162
- [60 /* X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
5165
+ [50 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
5166
+ [51 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
5167
+ [52 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
5168
+ [53 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
5169
+ [54 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
5170
+ [55 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
5171
+ [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.`,
5172
+ [57 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
5173
+ [58 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
5174
+ [59 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
5175
+ [60 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
5163
5176
  };
5164
5177
 
5165
5178
  const transformVHtml = (dir, node, context) => {
5166
5179
  const { exp, loc } = dir;
5167
5180
  if (!exp) {
5168
- context.onError(createDOMCompilerError(50 /* X_V_HTML_NO_EXPRESSION */, loc));
5181
+ context.onError(createDOMCompilerError(50 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */, loc));
5169
5182
  }
5170
5183
  if (node.children.length) {
5171
- context.onError(createDOMCompilerError(51 /* X_V_HTML_WITH_CHILDREN */, loc));
5184
+ context.onError(createDOMCompilerError(51 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */, loc));
5172
5185
  node.children.length = 0;
5173
5186
  }
5174
5187
  return {
@@ -5181,10 +5194,10 @@ const transformVHtml = (dir, node, context) => {
5181
5194
  const transformVText = (dir, node, context) => {
5182
5195
  const { exp, loc } = dir;
5183
5196
  if (!exp) {
5184
- context.onError(createDOMCompilerError(52 /* X_V_TEXT_NO_EXPRESSION */, loc));
5197
+ context.onError(createDOMCompilerError(52 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */, loc));
5185
5198
  }
5186
5199
  if (node.children.length) {
5187
- context.onError(createDOMCompilerError(53 /* X_V_TEXT_WITH_CHILDREN */, loc));
5200
+ context.onError(createDOMCompilerError(53 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */, loc));
5188
5201
  node.children.length = 0;
5189
5202
  }
5190
5203
  return {
@@ -5201,16 +5214,16 @@ const transformVText = (dir, node, context) => {
5201
5214
  const transformModel$1 = (dir, node, context) => {
5202
5215
  const baseResult = transformModel(dir, node, context);
5203
5216
  // base transform has errors OR component v-model (only need props)
5204
- if (!baseResult.props.length || node.tagType === 1 /* COMPONENT */) {
5217
+ if (!baseResult.props.length || node.tagType === 1 /* ElementTypes.COMPONENT */) {
5205
5218
  return baseResult;
5206
5219
  }
5207
5220
  if (dir.arg) {
5208
- context.onError(createDOMCompilerError(55 /* X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
5221
+ context.onError(createDOMCompilerError(55 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
5209
5222
  }
5210
5223
  function checkDuplicatedValue() {
5211
5224
  const value = findProp(node, 'value');
5212
5225
  if (value) {
5213
- context.onError(createDOMCompilerError(57 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
5226
+ context.onError(createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
5214
5227
  }
5215
5228
  }
5216
5229
  const { tag } = node;
@@ -5224,7 +5237,7 @@ const transformModel$1 = (dir, node, context) => {
5224
5237
  if (tag === 'input' || isCustomElement) {
5225
5238
  const type = findProp(node, `type`);
5226
5239
  if (type) {
5227
- if (type.type === 7 /* DIRECTIVE */) {
5240
+ if (type.type === 7 /* NodeTypes.DIRECTIVE */) {
5228
5241
  // :type="foo"
5229
5242
  directiveToUse = V_MODEL_DYNAMIC;
5230
5243
  }
@@ -5238,7 +5251,7 @@ const transformModel$1 = (dir, node, context) => {
5238
5251
  break;
5239
5252
  case 'file':
5240
5253
  isInvalidType = true;
5241
- context.onError(createDOMCompilerError(56 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
5254
+ context.onError(createDOMCompilerError(56 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
5242
5255
  break;
5243
5256
  default:
5244
5257
  // text type
@@ -5272,11 +5285,11 @@ const transformModel$1 = (dir, node, context) => {
5272
5285
  }
5273
5286
  }
5274
5287
  else {
5275
- context.onError(createDOMCompilerError(54 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
5288
+ context.onError(createDOMCompilerError(54 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
5276
5289
  }
5277
5290
  // native vmodel doesn't need the `modelValue` props since they are also
5278
5291
  // passed to the runtime as `binding.value`. removing it reduces code size.
5279
- baseResult.props = baseResult.props.filter(p => !(p.key.type === 4 /* SIMPLE_EXPRESSION */ &&
5292
+ baseResult.props = baseResult.props.filter(p => !(p.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
5280
5293
  p.key.content === 'modelValue'));
5281
5294
  return baseResult;
5282
5295
  };
@@ -5299,7 +5312,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
5299
5312
  for (let i = 0; i < modifiers.length; i++) {
5300
5313
  const modifier = modifiers[i];
5301
5314
  if (modifier === 'native' &&
5302
- checkCompatEnabled("COMPILER_V_ON_NATIVE" /* COMPILER_V_ON_NATIVE */, context, loc)) {
5315
+ checkCompatEnabled("COMPILER_V_ON_NATIVE" /* CompilerDeprecationTypes.COMPILER_V_ON_NATIVE */, context, loc)) {
5303
5316
  eventOptionModifiers.push(modifier);
5304
5317
  }
5305
5318
  else if (isEventOptionModifier(modifier)) {
@@ -5343,7 +5356,7 @@ const transformClick = (key, event) => {
5343
5356
  const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === 'onclick';
5344
5357
  return isStaticClick
5345
5358
  ? createSimpleExpression(event, true)
5346
- : key.type !== 4 /* SIMPLE_EXPRESSION */
5359
+ : key.type !== 4 /* NodeTypes.SIMPLE_EXPRESSION */
5347
5360
  ? createCompoundExpression([
5348
5361
  `(`,
5349
5362
  key,
@@ -5396,7 +5409,7 @@ const transformOn$1 = (dir, node, context) => {
5396
5409
  const transformShow = (dir, node, context) => {
5397
5410
  const { exp, loc } = dir;
5398
5411
  if (!exp) {
5399
- context.onError(createDOMCompilerError(58 /* X_V_SHOW_NO_EXPRESSION */, loc));
5412
+ context.onError(createDOMCompilerError(58 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */, loc));
5400
5413
  }
5401
5414
  return {
5402
5415
  props: [],
@@ -5405,8 +5418,8 @@ const transformShow = (dir, node, context) => {
5405
5418
  };
5406
5419
 
5407
5420
  const transformTransition = (node, context) => {
5408
- if (node.type === 1 /* ELEMENT */ &&
5409
- node.tagType === 1 /* COMPONENT */) {
5421
+ if (node.type === 1 /* NodeTypes.ELEMENT */ &&
5422
+ node.tagType === 1 /* ElementTypes.COMPONENT */) {
5410
5423
  const component = context.isBuiltInComponent(node.tag);
5411
5424
  if (component === TRANSITION) {
5412
5425
  return () => {
@@ -5415,7 +5428,7 @@ const transformTransition = (node, context) => {
5415
5428
  }
5416
5429
  // warn multiple transition children
5417
5430
  if (hasMultipleChildren(node)) {
5418
- context.onError(createDOMCompilerError(59 /* X_TRANSITION_INVALID_CHILDREN */, {
5431
+ context.onError(createDOMCompilerError(59 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */, {
5419
5432
  start: node.children[0].loc.start,
5420
5433
  end: node.children[node.children.length - 1].loc.end,
5421
5434
  source: ''
@@ -5424,11 +5437,11 @@ const transformTransition = (node, context) => {
5424
5437
  // check if it's s single child w/ v-show
5425
5438
  // if yes, inject "persisted: true" to the transition props
5426
5439
  const child = node.children[0];
5427
- if (child.type === 1 /* ELEMENT */) {
5440
+ if (child.type === 1 /* NodeTypes.ELEMENT */) {
5428
5441
  for (const p of child.props) {
5429
- if (p.type === 7 /* DIRECTIVE */ && p.name === 'show') {
5442
+ if (p.type === 7 /* NodeTypes.DIRECTIVE */ && p.name === 'show') {
5430
5443
  node.props.push({
5431
- type: 6 /* ATTRIBUTE */,
5444
+ type: 6 /* NodeTypes.ATTRIBUTE */,
5432
5445
  name: 'persisted',
5433
5446
  value: undefined,
5434
5447
  loc: node.loc
@@ -5442,19 +5455,19 @@ const transformTransition = (node, context) => {
5442
5455
  };
5443
5456
  function hasMultipleChildren(node) {
5444
5457
  // #1352 filter out potential comment nodes.
5445
- const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */ &&
5446
- !(c.type === 2 /* TEXT */ && !c.content.trim())));
5458
+ const children = (node.children = node.children.filter(c => c.type !== 3 /* NodeTypes.COMMENT */ &&
5459
+ !(c.type === 2 /* NodeTypes.TEXT */ && !c.content.trim())));
5447
5460
  const child = children[0];
5448
5461
  return (children.length !== 1 ||
5449
- child.type === 11 /* FOR */ ||
5450
- (child.type === 9 /* IF */ && child.branches.some(hasMultipleChildren)));
5462
+ child.type === 11 /* NodeTypes.FOR */ ||
5463
+ (child.type === 9 /* NodeTypes.IF */ && child.branches.some(hasMultipleChildren)));
5451
5464
  }
5452
5465
 
5453
5466
  const ignoreSideEffectTags = (node, context) => {
5454
- if (node.type === 1 /* ELEMENT */ &&
5455
- node.tagType === 0 /* ELEMENT */ &&
5467
+ if (node.type === 1 /* NodeTypes.ELEMENT */ &&
5468
+ node.tagType === 0 /* ElementTypes.ELEMENT */ &&
5456
5469
  (node.tag === 'script' || node.tag === 'style')) {
5457
- context.onError(createDOMCompilerError(60 /* X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
5470
+ context.onError(createDOMCompilerError(60 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
5458
5471
  context.removeNode();
5459
5472
  }
5460
5473
  };