@vue/compiler-core 3.2.5 → 3.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,5 @@
1
1
  import { isString, hyphenate, extend, isObject, NO, isArray, makeMap, isSymbol, NOOP, EMPTY_OBJ, capitalize, camelize as camelize$1, PatchFlagNames, slotFlagsText, isOn, isReservedProp, toHandlerKey } from '@vue/shared';
2
2
  export { generateCodeFrame } from '@vue/shared';
3
- import { isReferenced } from '@babel/types';
4
- import { walk as walk$1 } from 'estree-walker';
5
3
 
6
4
  function defaultOnError(error) {
7
5
  throw error;
@@ -41,43 +39,44 @@ const errorMessages = {
41
39
  [18 /* UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */]: 'Unquoted attribute value cannot contain U+0022 ("), U+0027 (\'), U+003C (<), U+003D (=), and U+0060 (`).',
42
40
  [19 /* UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */]: "Attribute name cannot start with '='.",
43
41
  [21 /* UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */]: "'<?' is allowed only in XML context.",
44
- [20 /* UNEXPECTED_NULL_CHARACTER */]: `Unexpected null cahracter.`,
42
+ [20 /* UNEXPECTED_NULL_CHARACTER */]: `Unexpected null character.`,
45
43
  [22 /* UNEXPECTED_SOLIDUS_IN_TAG */]: "Illegal '/' in tags.",
46
44
  // Vue-specific parse errors
47
45
  [23 /* X_INVALID_END_TAG */]: 'Invalid end tag.',
48
46
  [24 /* X_MISSING_END_TAG */]: 'Element is missing end tag.',
49
47
  [25 /* X_MISSING_INTERPOLATION_END */]: 'Interpolation end sign was not found.',
50
- [26 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */]: 'End bracket for dynamic directive argument was not found. ' +
48
+ [27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */]: 'End bracket for dynamic directive argument was not found. ' +
51
49
  'Note that dynamic directive argument cannot contain spaces.',
50
+ [26 /* X_MISSING_DIRECTIVE_NAME */]: 'Legal directive name was expected.',
52
51
  // transform errors
53
- [27 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
54
- [28 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
55
- [29 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if.`,
56
- [30 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
57
- [31 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
58
- [32 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
59
- [33 /* X_V_BIND_NO_EXPRESSION */]: `v-bind is missing expression.`,
60
- [34 /* X_V_ON_NO_EXPRESSION */]: `v-on is missing expression.`,
61
- [35 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */]: `Unexpected custom directive on <slot> outlet.`,
62
- [36 /* X_V_SLOT_MIXED_SLOT_USAGE */]: `Mixed v-slot usage on both the component and nested <template>.` +
52
+ [28 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
53
+ [29 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
54
+ [30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if.`,
55
+ [31 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
56
+ [32 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
57
+ [33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
58
+ [34 /* X_V_BIND_NO_EXPRESSION */]: `v-bind is missing expression.`,
59
+ [35 /* X_V_ON_NO_EXPRESSION */]: `v-on is missing expression.`,
60
+ [36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */]: `Unexpected custom directive on <slot> outlet.`,
61
+ [37 /* X_V_SLOT_MIXED_SLOT_USAGE */]: `Mixed v-slot usage on both the component and nested <template>.` +
63
62
  `When there are multiple named slots, all slots should use <template> ` +
64
63
  `syntax to avoid scope ambiguity.`,
65
- [37 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */]: `Duplicate slot names found. `,
66
- [38 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */]: `Extraneous children found when component already has explicitly named ` +
64
+ [38 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */]: `Duplicate slot names found. `,
65
+ [39 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */]: `Extraneous children found when component already has explicitly named ` +
67
66
  `default slot. These children will be ignored.`,
68
- [39 /* X_V_SLOT_MISPLACED */]: `v-slot can only be used on components or <template> tags.`,
69
- [40 /* X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
70
- [41 /* X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
71
- [42 /* X_V_MODEL_ON_SCOPE_VARIABLE */]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
72
- [43 /* X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
73
- [44 /* X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
67
+ [40 /* X_V_SLOT_MISPLACED */]: `v-slot can only be used on components or <template> tags.`,
68
+ [41 /* X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
69
+ [42 /* X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
70
+ [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.`,
71
+ [44 /* X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
72
+ [45 /* X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
74
73
  // generic errors
75
- [45 /* X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
76
- [46 /* X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
77
- [47 /* X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
78
- [48 /* X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
74
+ [46 /* X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
75
+ [47 /* X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
76
+ [48 /* X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
77
+ [49 /* X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
79
78
  // just to fullfill types
80
- [49 /* __EXTEND_POINT__ */]: ``
79
+ [50 /* __EXTEND_POINT__ */]: ``
81
80
  };
82
81
 
83
82
  const FRAGMENT = Symbol((process.env.NODE_ENV !== 'production') ? `Fragment` : ``);
@@ -114,7 +113,6 @@ const TO_HANDLER_KEY = Symbol((process.env.NODE_ENV !== 'production') ? `toHandl
114
113
  const SET_BLOCK_TRACKING = Symbol((process.env.NODE_ENV !== 'production') ? `setBlockTracking` : ``);
115
114
  const PUSH_SCOPE_ID = Symbol((process.env.NODE_ENV !== 'production') ? `pushScopeId` : ``);
116
115
  const POP_SCOPE_ID = Symbol((process.env.NODE_ENV !== 'production') ? `popScopeId` : ``);
117
- const WITH_SCOPE_ID = Symbol((process.env.NODE_ENV !== 'production') ? `withScopeId` : ``);
118
116
  const WITH_CTX = Symbol((process.env.NODE_ENV !== 'production') ? `withCtx` : ``);
119
117
  const UNREF = Symbol((process.env.NODE_ENV !== 'production') ? `unref` : ``);
120
118
  const IS_REF = Symbol((process.env.NODE_ENV !== 'production') ? `isRef` : ``);
@@ -158,7 +156,6 @@ const helperNameMap = {
158
156
  [SET_BLOCK_TRACKING]: `setBlockTracking`,
159
157
  [PUSH_SCOPE_ID]: `pushScopeId`,
160
158
  [POP_SCOPE_ID]: `popScopeId`,
161
- [WITH_SCOPE_ID]: `withScopeId`,
162
159
  [WITH_CTX]: `withCtx`,
163
160
  [UNREF]: `unref`,
164
161
  [IS_REF]: `isRef`,
@@ -1340,7 +1337,7 @@ function parseAttribute(context, nameSet) {
1340
1337
  }
1341
1338
  }
1342
1339
  const loc = getSelection(context, start);
1343
- if (!context.inVPre && /^(v-|:|\.|@|#)/.test(name)) {
1340
+ if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
1344
1341
  const match = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(name);
1345
1342
  let isPropShorthand = startsWith(name, '.');
1346
1343
  let dirName = match[1] ||
@@ -1359,7 +1356,7 @@ function parseAttribute(context, nameSet) {
1359
1356
  if (content.startsWith('[')) {
1360
1357
  isStatic = false;
1361
1358
  if (!content.endsWith(']')) {
1362
- emitError(context, 26 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
1359
+ emitError(context, 27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
1363
1360
  }
1364
1361
  content = content.substr(1, content.length - 2);
1365
1362
  }
@@ -1417,6 +1414,10 @@ function parseAttribute(context, nameSet) {
1417
1414
  loc
1418
1415
  };
1419
1416
  }
1417
+ // missing directive name or illegal directive name
1418
+ if (!context.inVPre && startsWith(name, 'v-')) {
1419
+ emitError(context, 26 /* X_MISSING_DIRECTIVE_NAME */);
1420
+ }
1420
1421
  return {
1421
1422
  type: 6 /* ATTRIBUTE */,
1422
1423
  name,
@@ -1496,10 +1497,7 @@ function parseInterpolation(context, mode) {
1496
1497
  };
1497
1498
  }
1498
1499
  function parseText(context, mode) {
1499
- const endTokens = ['<', context.options.delimiters[0]];
1500
- if (mode === 3 /* CDATA */) {
1501
- endTokens.push(']]>');
1502
- }
1500
+ const endTokens = mode === 3 /* CDATA */ ? [']]>'] : ['<', context.options.delimiters[0]];
1503
1501
  let endIndex = context.source.length;
1504
1502
  for (let i = 0; i < endTokens.length; i++) {
1505
1503
  const index = context.source.indexOf(endTokens[i], 1);
@@ -2751,75 +2749,14 @@ function genCacheExpression(node, context) {
2751
2749
  }
2752
2750
 
2753
2751
  function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = Object.create(null)) {
2754
- const rootExp = root.type === 'Program' &&
2755
- root.body[0].type === 'ExpressionStatement' &&
2756
- root.body[0].expression;
2757
- walk$1(root, {
2758
- enter(node, parent) {
2759
- parent && parentStack.push(parent);
2760
- if (parent &&
2761
- parent.type.startsWith('TS') &&
2762
- parent.type !== 'TSAsExpression' &&
2763
- parent.type !== 'TSNonNullExpression' &&
2764
- parent.type !== 'TSTypeAssertion') {
2765
- return this.skip();
2766
- }
2767
- if (node.type === 'Identifier') {
2768
- const isLocal = !!knownIds[node.name];
2769
- const isRefed = isReferencedIdentifier(node, parent, parentStack);
2770
- if (includeAll || (isRefed && !isLocal)) {
2771
- onIdentifier(node, parent, parentStack, isRefed, isLocal);
2772
- }
2773
- }
2774
- else if (node.type === 'ObjectProperty' &&
2775
- parent.type === 'ObjectPattern') {
2776
- node.inPattern = true;
2777
- }
2778
- else if (isFunctionType(node)) {
2779
- // walk function expressions and add its arguments to known identifiers
2780
- // so that we don't prefix them
2781
- walkFunctionParams(node, id => markScopeIdentifier(node, id, knownIds));
2782
- }
2783
- else if (node.type === 'BlockStatement') {
2784
- // #3445 record block-level local variables
2785
- walkBlockDeclarations(node, id => markScopeIdentifier(node, id, knownIds));
2786
- }
2787
- },
2788
- leave(node, parent) {
2789
- parent && parentStack.pop();
2790
- if (node !== rootExp && node.scopeIds) {
2791
- for (const id of node.scopeIds) {
2792
- knownIds[id]--;
2793
- if (knownIds[id] === 0) {
2794
- delete knownIds[id];
2795
- }
2796
- }
2797
- }
2798
- }
2799
- });
2752
+ {
2753
+ return;
2754
+ }
2800
2755
  }
2801
2756
  function isReferencedIdentifier(id, parent, parentStack) {
2802
- if (!parent) {
2803
- return true;
2804
- }
2805
- // is a special keyword but parsed as identifier
2806
- if (id.name === 'arguments') {
2757
+ {
2807
2758
  return false;
2808
2759
  }
2809
- if (isReferenced(id, parent)) {
2810
- return true;
2811
- }
2812
- // babel's isReferenced check returns false for ids being assigned to, so we
2813
- // need to cover those cases here
2814
- switch (parent.type) {
2815
- case 'AssignmentExpression':
2816
- case 'AssignmentPattern':
2817
- return true;
2818
- case 'ObjectPattern':
2819
- case 'ArrayPattern':
2820
- return isInDestructureAssignment(parent, parentStack);
2821
- }
2822
- return false;
2823
2760
  }
2824
2761
  function isInDestructureAssignment(parent, parentStack) {
2825
2762
  if (parent &&
@@ -2900,19 +2837,6 @@ function extractIdentifiers(param, nodes = []) {
2900
2837
  }
2901
2838
  return nodes;
2902
2839
  }
2903
- function markScopeIdentifier(node, child, knownIds) {
2904
- const { name } = child;
2905
- if (node.scopeIds && node.scopeIds.has(name)) {
2906
- return;
2907
- }
2908
- if (name in knownIds) {
2909
- knownIds[name]++;
2910
- }
2911
- else {
2912
- knownIds[name] = 1;
2913
- }
2914
- (node.scopeIds || (node.scopeIds = new Set())).add(name);
2915
- }
2916
2840
  const isFunctionType = (node) => {
2917
2841
  return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
2918
2842
  };
@@ -2957,7 +2881,7 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
2957
2881
  if (keywordMatch) {
2958
2882
  message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
2959
2883
  }
2960
- context.onError(createCompilerError(43 /* X_INVALID_EXPRESSION */, node.loc, undefined, message));
2884
+ context.onError(createCompilerError(44 /* X_INVALID_EXPRESSION */, node.loc, undefined, message));
2961
2885
  }
2962
2886
  }
2963
2887
 
@@ -2997,7 +2921,7 @@ function processExpression(node, context,
2997
2921
  // function params
2998
2922
  asParams = false,
2999
2923
  // v-on handler values may contain multiple statements
3000
- asRawStatements = false) {
2924
+ asRawStatements = false, localVars = Object.create(context.identifiers)) {
3001
2925
  {
3002
2926
  if ((process.env.NODE_ENV !== 'production')) {
3003
2927
  // simple in-browser validation (same logic in 2.x)
@@ -3040,7 +2964,7 @@ function processIf(node, dir, context, processCodegen) {
3040
2964
  if (dir.name !== 'else' &&
3041
2965
  (!dir.exp || !dir.exp.content.trim())) {
3042
2966
  const loc = dir.exp ? dir.exp.loc : node.loc;
3043
- context.onError(createCompilerError(27 /* X_V_IF_NO_EXPRESSION */, dir.loc));
2967
+ context.onError(createCompilerError(28 /* X_V_IF_NO_EXPRESSION */, dir.loc));
3044
2968
  dir.exp = createSimpleExpression(`true`, false, loc);
3045
2969
  }
3046
2970
  if ((process.env.NODE_ENV !== 'production') && true && dir.exp) {
@@ -3094,7 +3018,7 @@ function processIf(node, dir, context, processCodegen) {
3094
3018
  if (key) {
3095
3019
  sibling.branches.forEach(({ userKey }) => {
3096
3020
  if (isSameKey(userKey, key)) {
3097
- context.onError(createCompilerError(28 /* X_V_IF_SAME_KEY */, branch.userKey.loc));
3021
+ context.onError(createCompilerError(29 /* X_V_IF_SAME_KEY */, branch.userKey.loc));
3098
3022
  }
3099
3023
  });
3100
3024
  }
@@ -3112,7 +3036,7 @@ function processIf(node, dir, context, processCodegen) {
3112
3036
  context.currentNode = null;
3113
3037
  }
3114
3038
  else {
3115
- context.onError(createCompilerError(29 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
3039
+ context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
3116
3040
  }
3117
3041
  break;
3118
3042
  }
@@ -3256,7 +3180,7 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
3256
3180
  if (c.type === 1 /* ELEMENT */) {
3257
3181
  const key = findProp(c, 'key');
3258
3182
  if (key) {
3259
- context.onError(createCompilerError(32 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */, key.loc));
3183
+ context.onError(createCompilerError(33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */, key.loc));
3260
3184
  return true;
3261
3185
  }
3262
3186
  }
@@ -3342,7 +3266,7 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
3342
3266
  // target-agnostic transform used for both Client and SSR
3343
3267
  function processFor(node, dir, context, processCodegen) {
3344
3268
  if (!dir.exp) {
3345
- context.onError(createCompilerError(30 /* X_V_FOR_NO_EXPRESSION */, dir.loc));
3269
+ context.onError(createCompilerError(31 /* X_V_FOR_NO_EXPRESSION */, dir.loc));
3346
3270
  return;
3347
3271
  }
3348
3272
  const parseResult = parseForExpression(
@@ -3350,7 +3274,7 @@ function processFor(node, dir, context, processCodegen) {
3350
3274
  // before expression transform.
3351
3275
  dir.exp, context);
3352
3276
  if (!parseResult) {
3353
- context.onError(createCompilerError(31 /* X_V_FOR_MALFORMED_EXPRESSION */, dir.loc));
3277
+ context.onError(createCompilerError(32 /* X_V_FOR_MALFORMED_EXPRESSION */, dir.loc));
3354
3278
  return;
3355
3279
  }
3356
3280
  const { addIdentifiers, removeIdentifiers, scopes } = context;
@@ -3533,7 +3457,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3533
3457
  }
3534
3458
  if (onComponentSlot) {
3535
3459
  // already has on-component slot - this is incorrect usage.
3536
- context.onError(createCompilerError(36 /* X_V_SLOT_MIXED_SLOT_USAGE */, slotDir.loc));
3460
+ context.onError(createCompilerError(37 /* X_V_SLOT_MIXED_SLOT_USAGE */, slotDir.loc));
3537
3461
  break;
3538
3462
  }
3539
3463
  hasTemplateSlots = true;
@@ -3580,7 +3504,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3580
3504
  : buildDynamicSlot(slotName, slotFunction);
3581
3505
  }
3582
3506
  else {
3583
- context.onError(createCompilerError(29 /* X_V_ELSE_NO_ADJACENT_IF */, vElse.loc));
3507
+ context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, vElse.loc));
3584
3508
  }
3585
3509
  }
3586
3510
  else if ((vFor = findDir(slotElement, 'for'))) {
@@ -3596,14 +3520,14 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3596
3520
  ]));
3597
3521
  }
3598
3522
  else {
3599
- context.onError(createCompilerError(31 /* X_V_FOR_MALFORMED_EXPRESSION */, vFor.loc));
3523
+ context.onError(createCompilerError(32 /* X_V_FOR_MALFORMED_EXPRESSION */, vFor.loc));
3600
3524
  }
3601
3525
  }
3602
3526
  else {
3603
3527
  // check duplicate static names
3604
3528
  if (staticSlotName) {
3605
3529
  if (seenSlotNames.has(staticSlotName)) {
3606
- context.onError(createCompilerError(37 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */, dirLoc));
3530
+ context.onError(createCompilerError(38 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */, dirLoc));
3607
3531
  continue;
3608
3532
  }
3609
3533
  seenSlotNames.add(staticSlotName);
@@ -3633,7 +3557,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3633
3557
  implicitDefaultChildren.some(node => isNonWhitespaceContent(node))) {
3634
3558
  // implicit default slot (mixed with named slots)
3635
3559
  if (hasNamedDefaultSlot) {
3636
- context.onError(createCompilerError(38 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */, implicitDefaultChildren[0].loc));
3560
+ context.onError(createCompilerError(39 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */, implicitDefaultChildren[0].loc));
3637
3561
  }
3638
3562
  else {
3639
3563
  slotsProperties.push(buildDefaultSlotProperty(undefined, implicitDefaultChildren));
@@ -3765,7 +3689,7 @@ const transformElement = (node, context) => {
3765
3689
  // 2. Force keep-alive to always be updated, since it uses raw children.
3766
3690
  patchFlag |= 1024 /* DYNAMIC_SLOTS */;
3767
3691
  if ((process.env.NODE_ENV !== 'production') && node.children.length > 1) {
3768
- context.onError(createCompilerError(44 /* X_KEEP_ALIVE_INVALID_CHILDREN */, {
3692
+ context.onError(createCompilerError(45 /* X_KEEP_ALIVE_INVALID_CHILDREN */, {
3769
3693
  start: node.children[0].loc.start,
3770
3694
  end: node.children[node.children.length - 1].loc.end,
3771
3695
  source: ''
@@ -3949,7 +3873,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
3949
3873
  const prop = props[i];
3950
3874
  if (prop.type === 6 /* ATTRIBUTE */) {
3951
3875
  const { loc, name, value } = prop;
3952
- let isStatic = true;
3876
+ let valueNode = createSimpleExpression(value ? value.content : '', true, value ? value.loc : loc);
3953
3877
  if (name === 'ref') {
3954
3878
  hasRef = true;
3955
3879
  }
@@ -3960,7 +3884,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
3960
3884
  (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
3961
3885
  continue;
3962
3886
  }
3963
- properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
3887
+ properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), valueNode));
3964
3888
  }
3965
3889
  else {
3966
3890
  // directives
@@ -3970,7 +3894,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
3970
3894
  // skip v-slot - it is handled by its dedicated transform.
3971
3895
  if (name === 'slot') {
3972
3896
  if (!isComponent) {
3973
- context.onError(createCompilerError(39 /* X_V_SLOT_MISPLACED */, loc));
3897
+ context.onError(createCompilerError(40 /* X_V_SLOT_MISPLACED */, loc));
3974
3898
  }
3975
3899
  continue;
3976
3900
  }
@@ -4042,8 +3966,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
4042
3966
  }
4043
3967
  else {
4044
3968
  context.onError(createCompilerError(isVBind
4045
- ? 33 /* X_V_BIND_NO_EXPRESSION */
4046
- : 34 /* X_V_ON_NO_EXPRESSION */, loc));
3969
+ ? 34 /* X_V_BIND_NO_EXPRESSION */
3970
+ : 35 /* X_V_ON_NO_EXPRESSION */, loc));
4047
3971
  }
4048
3972
  continue;
4049
3973
  }
@@ -4347,7 +4271,7 @@ function processSlotOutlet(node, context) {
4347
4271
  const { props, directives } = buildProps(node, context, nonNameProps);
4348
4272
  slotProps = props;
4349
4273
  if (directives.length) {
4350
- context.onError(createCompilerError(35 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
4274
+ context.onError(createCompilerError(36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
4351
4275
  }
4352
4276
  }
4353
4277
  return {
@@ -4360,7 +4284,7 @@ const fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^\s*function(?:\s+[\w$]+)?\s*\(/;
4360
4284
  const transformOn = (dir, node, context, augmentor) => {
4361
4285
  const { loc, modifiers, arg } = dir;
4362
4286
  if (!dir.exp && !modifiers.length) {
4363
- context.onError(createCompilerError(34 /* X_V_ON_NO_EXPRESSION */, loc));
4287
+ context.onError(createCompilerError(35 /* X_V_ON_NO_EXPRESSION */, loc));
4364
4288
  }
4365
4289
  let eventName;
4366
4290
  if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
@@ -4466,7 +4390,7 @@ const transformBind = (dir, _node, context) => {
4466
4390
  }
4467
4391
  if (!exp ||
4468
4392
  (exp.type === 4 /* SIMPLE_EXPRESSION */ && !exp.content.trim())) {
4469
- context.onError(createCompilerError(33 /* X_V_BIND_NO_EXPRESSION */, loc));
4393
+ context.onError(createCompilerError(34 /* X_V_BIND_NO_EXPRESSION */, loc));
4470
4394
  return {
4471
4395
  props: [createObjectProperty(arg, createSimpleExpression('', true, loc))]
4472
4396
  };
@@ -4602,7 +4526,7 @@ const transformOnce = (node, context) => {
4602
4526
  const transformModel = (dir, node, context) => {
4603
4527
  const { exp, arg } = dir;
4604
4528
  if (!exp) {
4605
- context.onError(createCompilerError(40 /* X_V_MODEL_NO_EXPRESSION */, dir.loc));
4529
+ context.onError(createCompilerError(41 /* X_V_MODEL_NO_EXPRESSION */, dir.loc));
4606
4530
  return createTransformProps();
4607
4531
  }
4608
4532
  const rawExp = exp.loc.source;
@@ -4612,7 +4536,7 @@ const transformModel = (dir, node, context) => {
4612
4536
  context.bindingMetadata[rawExp];
4613
4537
  const maybeRef = !true /* SETUP_CONST */;
4614
4538
  if (!expString.trim() || (!isMemberExpression(expString) && !maybeRef)) {
4615
- context.onError(createCompilerError(41 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
4539
+ context.onError(createCompilerError(42 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
4616
4540
  return createTransformProps();
4617
4541
  }
4618
4542
  const propName = arg ? arg : createSimpleExpression('modelValue', true);
@@ -4878,18 +4802,18 @@ function baseCompile(template, options = {}) {
4878
4802
  /* istanbul ignore if */
4879
4803
  {
4880
4804
  if (options.prefixIdentifiers === true) {
4881
- onError(createCompilerError(45 /* X_PREFIX_ID_NOT_SUPPORTED */));
4805
+ onError(createCompilerError(46 /* X_PREFIX_ID_NOT_SUPPORTED */));
4882
4806
  }
4883
4807
  else if (isModuleMode) {
4884
- onError(createCompilerError(46 /* X_MODULE_MODE_NOT_SUPPORTED */));
4808
+ onError(createCompilerError(47 /* X_MODULE_MODE_NOT_SUPPORTED */));
4885
4809
  }
4886
4810
  }
4887
4811
  const prefixIdentifiers = !true ;
4888
4812
  if (options.cacheHandlers) {
4889
- onError(createCompilerError(47 /* X_CACHE_HANDLER_NOT_SUPPORTED */));
4813
+ onError(createCompilerError(48 /* X_CACHE_HANDLER_NOT_SUPPORTED */));
4890
4814
  }
4891
4815
  if (options.scopeId && !isModuleMode) {
4892
- onError(createCompilerError(48 /* X_SCOPE_ID_NOT_SUPPORTED */));
4816
+ onError(createCompilerError(49 /* X_SCOPE_ID_NOT_SUPPORTED */));
4893
4817
  }
4894
4818
  const ast = isString(template) ? baseParse(template, options) : template;
4895
4819
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
@@ -4909,4 +4833,4 @@ function baseCompile(template, options = {}) {
4909
4833
 
4910
4834
  const noopDirectiveTransform = () => ({ props: [] });
4911
4835
 
4912
- export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, WITH_SCOPE_ID, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildProps, buildSlots, checkCompatEnabled, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, getBaseTransformPreset, getInnerRange, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isBindKey, isBuiltInType, isCoreComponent, isFunctionType, isInDestructureAssignment, isMemberExpression, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText, isVSlot, locStub, makeBlock, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
4836
+ export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildProps, buildSlots, checkCompatEnabled, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, getBaseTransformPreset, getInnerRange, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isBindKey, isBuiltInType, isCoreComponent, isFunctionType, isInDestructureAssignment, isMemberExpression, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText, isVSlot, locStub, makeBlock, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-core",
3
- "version": "3.2.5",
3
+ "version": "3.2.9",
4
4
  "description": "@vue/compiler-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/compiler-core.esm-bundler.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-core#readme",
34
34
  "dependencies": {
35
- "@vue/shared": "3.2.5",
35
+ "@vue/shared": "3.2.9",
36
36
  "@babel/parser": "^7.15.0",
37
37
  "@babel/types": "^7.15.0",
38
38
  "estree-walker": "^2.0.2",