@vue/compiler-dom 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,6 +1,3 @@
1
- import { isReferenced } from '@babel/types';
2
- import { walk as walk$1 } from 'estree-walker';
3
-
4
1
  /**
5
2
  * Make a map and return a function for checking if a key
6
3
  * is in that map.
@@ -216,43 +213,44 @@ const errorMessages = {
216
213
  [18 /* UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */]: 'Unquoted attribute value cannot contain U+0022 ("), U+0027 (\'), U+003C (<), U+003D (=), and U+0060 (`).',
217
214
  [19 /* UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */]: "Attribute name cannot start with '='.",
218
215
  [21 /* UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */]: "'<?' is allowed only in XML context.",
219
- [20 /* UNEXPECTED_NULL_CHARACTER */]: `Unexpected null cahracter.`,
216
+ [20 /* UNEXPECTED_NULL_CHARACTER */]: `Unexpected null character.`,
220
217
  [22 /* UNEXPECTED_SOLIDUS_IN_TAG */]: "Illegal '/' in tags.",
221
218
  // Vue-specific parse errors
222
219
  [23 /* X_INVALID_END_TAG */]: 'Invalid end tag.',
223
220
  [24 /* X_MISSING_END_TAG */]: 'Element is missing end tag.',
224
221
  [25 /* X_MISSING_INTERPOLATION_END */]: 'Interpolation end sign was not found.',
225
- [26 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */]: 'End bracket for dynamic directive argument was not found. ' +
222
+ [27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */]: 'End bracket for dynamic directive argument was not found. ' +
226
223
  'Note that dynamic directive argument cannot contain spaces.',
224
+ [26 /* X_MISSING_DIRECTIVE_NAME */]: 'Legal directive name was expected.',
227
225
  // transform errors
228
- [27 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
229
- [28 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
230
- [29 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if.`,
231
- [30 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
232
- [31 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
233
- [32 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
234
- [33 /* X_V_BIND_NO_EXPRESSION */]: `v-bind is missing expression.`,
235
- [34 /* X_V_ON_NO_EXPRESSION */]: `v-on is missing expression.`,
236
- [35 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */]: `Unexpected custom directive on <slot> outlet.`,
237
- [36 /* X_V_SLOT_MIXED_SLOT_USAGE */]: `Mixed v-slot usage on both the component and nested <template>.` +
226
+ [28 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
227
+ [29 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
228
+ [30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if.`,
229
+ [31 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
230
+ [32 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
231
+ [33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
232
+ [34 /* X_V_BIND_NO_EXPRESSION */]: `v-bind is missing expression.`,
233
+ [35 /* X_V_ON_NO_EXPRESSION */]: `v-on is missing expression.`,
234
+ [36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */]: `Unexpected custom directive on <slot> outlet.`,
235
+ [37 /* X_V_SLOT_MIXED_SLOT_USAGE */]: `Mixed v-slot usage on both the component and nested <template>.` +
238
236
  `When there are multiple named slots, all slots should use <template> ` +
239
237
  `syntax to avoid scope ambiguity.`,
240
- [37 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */]: `Duplicate slot names found. `,
241
- [38 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */]: `Extraneous children found when component already has explicitly named ` +
238
+ [38 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */]: `Duplicate slot names found. `,
239
+ [39 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */]: `Extraneous children found when component already has explicitly named ` +
242
240
  `default slot. These children will be ignored.`,
243
- [39 /* X_V_SLOT_MISPLACED */]: `v-slot can only be used on components or <template> tags.`,
244
- [40 /* X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
245
- [41 /* X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
246
- [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.`,
247
- [43 /* X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
248
- [44 /* X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
241
+ [40 /* X_V_SLOT_MISPLACED */]: `v-slot can only be used on components or <template> tags.`,
242
+ [41 /* X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
243
+ [42 /* X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
244
+ [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.`,
245
+ [44 /* X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
246
+ [45 /* X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
249
247
  // generic errors
250
- [45 /* X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
251
- [46 /* X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
252
- [47 /* X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
253
- [48 /* X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
248
+ [46 /* X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
249
+ [47 /* X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
250
+ [48 /* X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
251
+ [49 /* X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
254
252
  // just to fullfill types
255
- [49 /* __EXTEND_POINT__ */]: ``
253
+ [50 /* __EXTEND_POINT__ */]: ``
256
254
  };
257
255
 
258
256
  const FRAGMENT = Symbol(`Fragment` );
@@ -289,7 +287,6 @@ const TO_HANDLER_KEY = Symbol(`toHandlerKey` );
289
287
  const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` );
290
288
  const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
291
289
  const POP_SCOPE_ID = Symbol(`popScopeId` );
292
- const WITH_SCOPE_ID = Symbol(`withScopeId` );
293
290
  const WITH_CTX = Symbol(`withCtx` );
294
291
  const UNREF = Symbol(`unref` );
295
292
  const IS_REF = Symbol(`isRef` );
@@ -333,7 +330,6 @@ const helperNameMap = {
333
330
  [SET_BLOCK_TRACKING]: `setBlockTracking`,
334
331
  [PUSH_SCOPE_ID]: `pushScopeId`,
335
332
  [POP_SCOPE_ID]: `popScopeId`,
336
- [WITH_SCOPE_ID]: `withScopeId`,
337
333
  [WITH_CTX]: `withCtx`,
338
334
  [UNREF]: `unref`,
339
335
  [IS_REF]: `isRef`,
@@ -1512,7 +1508,7 @@ function parseAttribute(context, nameSet) {
1512
1508
  }
1513
1509
  }
1514
1510
  const loc = getSelection(context, start);
1515
- if (!context.inVPre && /^(v-|:|\.|@|#)/.test(name)) {
1511
+ if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
1516
1512
  const match = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(name);
1517
1513
  let isPropShorthand = startsWith(name, '.');
1518
1514
  let dirName = match[1] ||
@@ -1531,7 +1527,7 @@ function parseAttribute(context, nameSet) {
1531
1527
  if (content.startsWith('[')) {
1532
1528
  isStatic = false;
1533
1529
  if (!content.endsWith(']')) {
1534
- emitError(context, 26 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
1530
+ emitError(context, 27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
1535
1531
  }
1536
1532
  content = content.substr(1, content.length - 2);
1537
1533
  }
@@ -1589,6 +1585,10 @@ function parseAttribute(context, nameSet) {
1589
1585
  loc
1590
1586
  };
1591
1587
  }
1588
+ // missing directive name or illegal directive name
1589
+ if (!context.inVPre && startsWith(name, 'v-')) {
1590
+ emitError(context, 26 /* X_MISSING_DIRECTIVE_NAME */);
1591
+ }
1592
1592
  return {
1593
1593
  type: 6 /* ATTRIBUTE */,
1594
1594
  name,
@@ -1668,10 +1668,7 @@ function parseInterpolation(context, mode) {
1668
1668
  };
1669
1669
  }
1670
1670
  function parseText(context, mode) {
1671
- const endTokens = ['<', context.options.delimiters[0]];
1672
- if (mode === 3 /* CDATA */) {
1673
- endTokens.push(']]>');
1674
- }
1671
+ const endTokens = mode === 3 /* CDATA */ ? [']]>'] : ['<', context.options.delimiters[0]];
1675
1672
  let endIndex = context.source.length;
1676
1673
  for (let i = 0; i < endTokens.length; i++) {
1677
1674
  const index = context.source.indexOf(endTokens[i], 1);
@@ -2919,75 +2916,14 @@ function genCacheExpression(node, context) {
2919
2916
  }
2920
2917
 
2921
2918
  function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = Object.create(null)) {
2922
- const rootExp = root.type === 'Program' &&
2923
- root.body[0].type === 'ExpressionStatement' &&
2924
- root.body[0].expression;
2925
- walk$1(root, {
2926
- enter(node, parent) {
2927
- parent && parentStack.push(parent);
2928
- if (parent &&
2929
- parent.type.startsWith('TS') &&
2930
- parent.type !== 'TSAsExpression' &&
2931
- parent.type !== 'TSNonNullExpression' &&
2932
- parent.type !== 'TSTypeAssertion') {
2933
- return this.skip();
2934
- }
2935
- if (node.type === 'Identifier') {
2936
- const isLocal = !!knownIds[node.name];
2937
- const isRefed = isReferencedIdentifier(node, parent, parentStack);
2938
- if (includeAll || (isRefed && !isLocal)) {
2939
- onIdentifier(node, parent, parentStack, isRefed, isLocal);
2940
- }
2941
- }
2942
- else if (node.type === 'ObjectProperty' &&
2943
- parent.type === 'ObjectPattern') {
2944
- node.inPattern = true;
2945
- }
2946
- else if (isFunctionType(node)) {
2947
- // walk function expressions and add its arguments to known identifiers
2948
- // so that we don't prefix them
2949
- walkFunctionParams(node, id => markScopeIdentifier(node, id, knownIds));
2950
- }
2951
- else if (node.type === 'BlockStatement') {
2952
- // #3445 record block-level local variables
2953
- walkBlockDeclarations(node, id => markScopeIdentifier(node, id, knownIds));
2954
- }
2955
- },
2956
- leave(node, parent) {
2957
- parent && parentStack.pop();
2958
- if (node !== rootExp && node.scopeIds) {
2959
- for (const id of node.scopeIds) {
2960
- knownIds[id]--;
2961
- if (knownIds[id] === 0) {
2962
- delete knownIds[id];
2963
- }
2964
- }
2965
- }
2966
- }
2967
- });
2919
+ {
2920
+ return;
2921
+ }
2968
2922
  }
2969
2923
  function isReferencedIdentifier(id, parent, parentStack) {
2970
- if (!parent) {
2971
- return true;
2972
- }
2973
- // is a special keyword but parsed as identifier
2974
- if (id.name === 'arguments') {
2924
+ {
2975
2925
  return false;
2976
2926
  }
2977
- if (isReferenced(id, parent)) {
2978
- return true;
2979
- }
2980
- // babel's isReferenced check returns false for ids being assigned to, so we
2981
- // need to cover those cases here
2982
- switch (parent.type) {
2983
- case 'AssignmentExpression':
2984
- case 'AssignmentPattern':
2985
- return true;
2986
- case 'ObjectPattern':
2987
- case 'ArrayPattern':
2988
- return isInDestructureAssignment(parent, parentStack);
2989
- }
2990
- return false;
2991
2927
  }
2992
2928
  function isInDestructureAssignment(parent, parentStack) {
2993
2929
  if (parent &&
@@ -3068,19 +3004,6 @@ function extractIdentifiers(param, nodes = []) {
3068
3004
  }
3069
3005
  return nodes;
3070
3006
  }
3071
- function markScopeIdentifier(node, child, knownIds) {
3072
- const { name } = child;
3073
- if (node.scopeIds && node.scopeIds.has(name)) {
3074
- return;
3075
- }
3076
- if (name in knownIds) {
3077
- knownIds[name]++;
3078
- }
3079
- else {
3080
- knownIds[name] = 1;
3081
- }
3082
- (node.scopeIds || (node.scopeIds = new Set())).add(name);
3083
- }
3084
3007
  const isFunctionType = (node) => {
3085
3008
  return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
3086
3009
  };
@@ -3125,7 +3048,7 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
3125
3048
  if (keywordMatch) {
3126
3049
  message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
3127
3050
  }
3128
- context.onError(createCompilerError(43 /* X_INVALID_EXPRESSION */, node.loc, undefined, message));
3051
+ context.onError(createCompilerError(44 /* X_INVALID_EXPRESSION */, node.loc, undefined, message));
3129
3052
  }
3130
3053
  }
3131
3054
 
@@ -3165,7 +3088,7 @@ function processExpression(node, context,
3165
3088
  // function params
3166
3089
  asParams = false,
3167
3090
  // v-on handler values may contain multiple statements
3168
- asRawStatements = false) {
3091
+ asRawStatements = false, localVars = Object.create(context.identifiers)) {
3169
3092
  {
3170
3093
  {
3171
3094
  // simple in-browser validation (same logic in 2.x)
@@ -3208,7 +3131,7 @@ function processIf(node, dir, context, processCodegen) {
3208
3131
  if (dir.name !== 'else' &&
3209
3132
  (!dir.exp || !dir.exp.content.trim())) {
3210
3133
  const loc = dir.exp ? dir.exp.loc : node.loc;
3211
- context.onError(createCompilerError(27 /* X_V_IF_NO_EXPRESSION */, dir.loc));
3134
+ context.onError(createCompilerError(28 /* X_V_IF_NO_EXPRESSION */, dir.loc));
3212
3135
  dir.exp = createSimpleExpression(`true`, false, loc);
3213
3136
  }
3214
3137
  if (dir.exp) {
@@ -3261,7 +3184,7 @@ function processIf(node, dir, context, processCodegen) {
3261
3184
  if (key) {
3262
3185
  sibling.branches.forEach(({ userKey }) => {
3263
3186
  if (isSameKey(userKey, key)) {
3264
- context.onError(createCompilerError(28 /* X_V_IF_SAME_KEY */, branch.userKey.loc));
3187
+ context.onError(createCompilerError(29 /* X_V_IF_SAME_KEY */, branch.userKey.loc));
3265
3188
  }
3266
3189
  });
3267
3190
  }
@@ -3279,7 +3202,7 @@ function processIf(node, dir, context, processCodegen) {
3279
3202
  context.currentNode = null;
3280
3203
  }
3281
3204
  else {
3282
- context.onError(createCompilerError(29 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
3205
+ context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
3283
3206
  }
3284
3207
  break;
3285
3208
  }
@@ -3422,7 +3345,7 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
3422
3345
  if (c.type === 1 /* ELEMENT */) {
3423
3346
  const key = findProp(c, 'key');
3424
3347
  if (key) {
3425
- context.onError(createCompilerError(32 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */, key.loc));
3348
+ context.onError(createCompilerError(33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */, key.loc));
3426
3349
  return true;
3427
3350
  }
3428
3351
  }
@@ -3507,7 +3430,7 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
3507
3430
  // target-agnostic transform used for both Client and SSR
3508
3431
  function processFor(node, dir, context, processCodegen) {
3509
3432
  if (!dir.exp) {
3510
- context.onError(createCompilerError(30 /* X_V_FOR_NO_EXPRESSION */, dir.loc));
3433
+ context.onError(createCompilerError(31 /* X_V_FOR_NO_EXPRESSION */, dir.loc));
3511
3434
  return;
3512
3435
  }
3513
3436
  const parseResult = parseForExpression(
@@ -3515,7 +3438,7 @@ function processFor(node, dir, context, processCodegen) {
3515
3438
  // before expression transform.
3516
3439
  dir.exp, context);
3517
3440
  if (!parseResult) {
3518
- context.onError(createCompilerError(31 /* X_V_FOR_MALFORMED_EXPRESSION */, dir.loc));
3441
+ context.onError(createCompilerError(32 /* X_V_FOR_MALFORMED_EXPRESSION */, dir.loc));
3519
3442
  return;
3520
3443
  }
3521
3444
  const { addIdentifiers, removeIdentifiers, scopes } = context;
@@ -3698,7 +3621,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3698
3621
  }
3699
3622
  if (onComponentSlot) {
3700
3623
  // already has on-component slot - this is incorrect usage.
3701
- context.onError(createCompilerError(36 /* X_V_SLOT_MIXED_SLOT_USAGE */, slotDir.loc));
3624
+ context.onError(createCompilerError(37 /* X_V_SLOT_MIXED_SLOT_USAGE */, slotDir.loc));
3702
3625
  break;
3703
3626
  }
3704
3627
  hasTemplateSlots = true;
@@ -3745,7 +3668,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3745
3668
  : buildDynamicSlot(slotName, slotFunction);
3746
3669
  }
3747
3670
  else {
3748
- context.onError(createCompilerError(29 /* X_V_ELSE_NO_ADJACENT_IF */, vElse.loc));
3671
+ context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, vElse.loc));
3749
3672
  }
3750
3673
  }
3751
3674
  else if ((vFor = findDir(slotElement, 'for'))) {
@@ -3761,14 +3684,14 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3761
3684
  ]));
3762
3685
  }
3763
3686
  else {
3764
- context.onError(createCompilerError(31 /* X_V_FOR_MALFORMED_EXPRESSION */, vFor.loc));
3687
+ context.onError(createCompilerError(32 /* X_V_FOR_MALFORMED_EXPRESSION */, vFor.loc));
3765
3688
  }
3766
3689
  }
3767
3690
  else {
3768
3691
  // check duplicate static names
3769
3692
  if (staticSlotName) {
3770
3693
  if (seenSlotNames.has(staticSlotName)) {
3771
- context.onError(createCompilerError(37 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */, dirLoc));
3694
+ context.onError(createCompilerError(38 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */, dirLoc));
3772
3695
  continue;
3773
3696
  }
3774
3697
  seenSlotNames.add(staticSlotName);
@@ -3798,7 +3721,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3798
3721
  implicitDefaultChildren.some(node => isNonWhitespaceContent(node))) {
3799
3722
  // implicit default slot (mixed with named slots)
3800
3723
  if (hasNamedDefaultSlot) {
3801
- context.onError(createCompilerError(38 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */, implicitDefaultChildren[0].loc));
3724
+ context.onError(createCompilerError(39 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */, implicitDefaultChildren[0].loc));
3802
3725
  }
3803
3726
  else {
3804
3727
  slotsProperties.push(buildDefaultSlotProperty(undefined, implicitDefaultChildren));
@@ -3930,7 +3853,7 @@ const transformElement = (node, context) => {
3930
3853
  // 2. Force keep-alive to always be updated, since it uses raw children.
3931
3854
  patchFlag |= 1024 /* DYNAMIC_SLOTS */;
3932
3855
  if (node.children.length > 1) {
3933
- context.onError(createCompilerError(44 /* X_KEEP_ALIVE_INVALID_CHILDREN */, {
3856
+ context.onError(createCompilerError(45 /* X_KEEP_ALIVE_INVALID_CHILDREN */, {
3934
3857
  start: node.children[0].loc.start,
3935
3858
  end: node.children[node.children.length - 1].loc.end,
3936
3859
  source: ''
@@ -4111,7 +4034,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
4111
4034
  const prop = props[i];
4112
4035
  if (prop.type === 6 /* ATTRIBUTE */) {
4113
4036
  const { loc, name, value } = prop;
4114
- let isStatic = true;
4037
+ let valueNode = createSimpleExpression(value ? value.content : '', true, value ? value.loc : loc);
4115
4038
  if (name === 'ref') {
4116
4039
  hasRef = true;
4117
4040
  }
@@ -4122,7 +4045,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
4122
4045
  (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
4123
4046
  continue;
4124
4047
  }
4125
- properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
4048
+ properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), valueNode));
4126
4049
  }
4127
4050
  else {
4128
4051
  // directives
@@ -4132,7 +4055,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
4132
4055
  // skip v-slot - it is handled by its dedicated transform.
4133
4056
  if (name === 'slot') {
4134
4057
  if (!isComponent) {
4135
- context.onError(createCompilerError(39 /* X_V_SLOT_MISPLACED */, loc));
4058
+ context.onError(createCompilerError(40 /* X_V_SLOT_MISPLACED */, loc));
4136
4059
  }
4137
4060
  continue;
4138
4061
  }
@@ -4204,8 +4127,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
4204
4127
  }
4205
4128
  else {
4206
4129
  context.onError(createCompilerError(isVBind
4207
- ? 33 /* X_V_BIND_NO_EXPRESSION */
4208
- : 34 /* X_V_ON_NO_EXPRESSION */, loc));
4130
+ ? 34 /* X_V_BIND_NO_EXPRESSION */
4131
+ : 35 /* X_V_ON_NO_EXPRESSION */, loc));
4209
4132
  }
4210
4133
  continue;
4211
4134
  }
@@ -4490,7 +4413,7 @@ function processSlotOutlet(node, context) {
4490
4413
  const { props, directives } = buildProps(node, context, nonNameProps);
4491
4414
  slotProps = props;
4492
4415
  if (directives.length) {
4493
- context.onError(createCompilerError(35 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
4416
+ context.onError(createCompilerError(36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
4494
4417
  }
4495
4418
  }
4496
4419
  return {
@@ -4503,7 +4426,7 @@ const fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^\s*function(?:\s+[\w$]+)?\s*\(/;
4503
4426
  const transformOn = (dir, node, context, augmentor) => {
4504
4427
  const { loc, modifiers, arg } = dir;
4505
4428
  if (!dir.exp && !modifiers.length) {
4506
- context.onError(createCompilerError(34 /* X_V_ON_NO_EXPRESSION */, loc));
4429
+ context.onError(createCompilerError(35 /* X_V_ON_NO_EXPRESSION */, loc));
4507
4430
  }
4508
4431
  let eventName;
4509
4432
  if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
@@ -4609,7 +4532,7 @@ const transformBind = (dir, _node, context) => {
4609
4532
  }
4610
4533
  if (!exp ||
4611
4534
  (exp.type === 4 /* SIMPLE_EXPRESSION */ && !exp.content.trim())) {
4612
- context.onError(createCompilerError(33 /* X_V_BIND_NO_EXPRESSION */, loc));
4535
+ context.onError(createCompilerError(34 /* X_V_BIND_NO_EXPRESSION */, loc));
4613
4536
  return {
4614
4537
  props: [createObjectProperty(arg, createSimpleExpression('', true, loc))]
4615
4538
  };
@@ -4745,7 +4668,7 @@ const transformOnce = (node, context) => {
4745
4668
  const transformModel = (dir, node, context) => {
4746
4669
  const { exp, arg } = dir;
4747
4670
  if (!exp) {
4748
- context.onError(createCompilerError(40 /* X_V_MODEL_NO_EXPRESSION */, dir.loc));
4671
+ context.onError(createCompilerError(41 /* X_V_MODEL_NO_EXPRESSION */, dir.loc));
4749
4672
  return createTransformProps();
4750
4673
  }
4751
4674
  const rawExp = exp.loc.source;
@@ -4755,7 +4678,7 @@ const transformModel = (dir, node, context) => {
4755
4678
  context.bindingMetadata[rawExp];
4756
4679
  const maybeRef = !true /* SETUP_CONST */;
4757
4680
  if (!expString.trim() || (!isMemberExpression(expString) && !maybeRef)) {
4758
- context.onError(createCompilerError(41 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
4681
+ context.onError(createCompilerError(42 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
4759
4682
  return createTransformProps();
4760
4683
  }
4761
4684
  const propName = arg ? arg : createSimpleExpression('modelValue', true);
@@ -5019,18 +4942,18 @@ function baseCompile(template, options = {}) {
5019
4942
  /* istanbul ignore if */
5020
4943
  {
5021
4944
  if (options.prefixIdentifiers === true) {
5022
- onError(createCompilerError(45 /* X_PREFIX_ID_NOT_SUPPORTED */));
4945
+ onError(createCompilerError(46 /* X_PREFIX_ID_NOT_SUPPORTED */));
5023
4946
  }
5024
4947
  else if (isModuleMode) {
5025
- onError(createCompilerError(46 /* X_MODULE_MODE_NOT_SUPPORTED */));
4948
+ onError(createCompilerError(47 /* X_MODULE_MODE_NOT_SUPPORTED */));
5026
4949
  }
5027
4950
  }
5028
4951
  const prefixIdentifiers = !true ;
5029
4952
  if (options.cacheHandlers) {
5030
- onError(createCompilerError(47 /* X_CACHE_HANDLER_NOT_SUPPORTED */));
4953
+ onError(createCompilerError(48 /* X_CACHE_HANDLER_NOT_SUPPORTED */));
5031
4954
  }
5032
4955
  if (options.scopeId && !isModuleMode) {
5033
- onError(createCompilerError(48 /* X_SCOPE_ID_NOT_SUPPORTED */));
4956
+ onError(createCompilerError(49 /* X_SCOPE_ID_NOT_SUPPORTED */));
5034
4957
  }
5035
4958
  const ast = isString(template) ? baseParse(template, options) : template;
5036
4959
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
@@ -5188,26 +5111,26 @@ function createDOMCompilerError(code, loc) {
5188
5111
  return createCompilerError(code, loc, DOMErrorMessages );
5189
5112
  }
5190
5113
  const DOMErrorMessages = {
5191
- [49 /* X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
5192
- [50 /* X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
5193
- [51 /* X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
5194
- [52 /* X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
5195
- [53 /* X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
5196
- [54 /* X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
5197
- [55 /* 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.`,
5198
- [56 /* X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
5199
- [57 /* X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
5200
- [58 /* X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
5201
- [59 /* X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
5114
+ [50 /* X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
5115
+ [51 /* X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
5116
+ [52 /* X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
5117
+ [53 /* X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
5118
+ [54 /* X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
5119
+ [55 /* X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
5120
+ [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.`,
5121
+ [57 /* X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
5122
+ [58 /* X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
5123
+ [59 /* X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
5124
+ [60 /* X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
5202
5125
  };
5203
5126
 
5204
5127
  const transformVHtml = (dir, node, context) => {
5205
5128
  const { exp, loc } = dir;
5206
5129
  if (!exp) {
5207
- context.onError(createDOMCompilerError(49 /* X_V_HTML_NO_EXPRESSION */, loc));
5130
+ context.onError(createDOMCompilerError(50 /* X_V_HTML_NO_EXPRESSION */, loc));
5208
5131
  }
5209
5132
  if (node.children.length) {
5210
- context.onError(createDOMCompilerError(50 /* X_V_HTML_WITH_CHILDREN */, loc));
5133
+ context.onError(createDOMCompilerError(51 /* X_V_HTML_WITH_CHILDREN */, loc));
5211
5134
  node.children.length = 0;
5212
5135
  }
5213
5136
  return {
@@ -5220,10 +5143,10 @@ const transformVHtml = (dir, node, context) => {
5220
5143
  const transformVText = (dir, node, context) => {
5221
5144
  const { exp, loc } = dir;
5222
5145
  if (!exp) {
5223
- context.onError(createDOMCompilerError(51 /* X_V_TEXT_NO_EXPRESSION */, loc));
5146
+ context.onError(createDOMCompilerError(52 /* X_V_TEXT_NO_EXPRESSION */, loc));
5224
5147
  }
5225
5148
  if (node.children.length) {
5226
- context.onError(createDOMCompilerError(52 /* X_V_TEXT_WITH_CHILDREN */, loc));
5149
+ context.onError(createDOMCompilerError(53 /* X_V_TEXT_WITH_CHILDREN */, loc));
5227
5150
  node.children.length = 0;
5228
5151
  }
5229
5152
  return {
@@ -5242,12 +5165,12 @@ const transformModel$1 = (dir, node, context) => {
5242
5165
  return baseResult;
5243
5166
  }
5244
5167
  if (dir.arg) {
5245
- context.onError(createDOMCompilerError(54 /* X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
5168
+ context.onError(createDOMCompilerError(55 /* X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
5246
5169
  }
5247
5170
  function checkDuplicatedValue() {
5248
5171
  const value = findProp(node, 'value');
5249
5172
  if (value) {
5250
- context.onError(createDOMCompilerError(56 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
5173
+ context.onError(createDOMCompilerError(57 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
5251
5174
  }
5252
5175
  }
5253
5176
  const { tag } = node;
@@ -5275,7 +5198,7 @@ const transformModel$1 = (dir, node, context) => {
5275
5198
  break;
5276
5199
  case 'file':
5277
5200
  isInvalidType = true;
5278
- context.onError(createDOMCompilerError(55 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
5201
+ context.onError(createDOMCompilerError(56 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
5279
5202
  break;
5280
5203
  default:
5281
5204
  // text type
@@ -5309,7 +5232,7 @@ const transformModel$1 = (dir, node, context) => {
5309
5232
  }
5310
5233
  }
5311
5234
  else {
5312
- context.onError(createDOMCompilerError(53 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
5235
+ context.onError(createDOMCompilerError(54 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
5313
5236
  }
5314
5237
  // native vmodel doesn't need the `modelValue` props since they are also
5315
5238
  // passed to the runtime as `binding.value`. removing it reduces code size.
@@ -5433,7 +5356,7 @@ const transformOn$1 = (dir, node, context) => {
5433
5356
  const transformShow = (dir, node, context) => {
5434
5357
  const { exp, loc } = dir;
5435
5358
  if (!exp) {
5436
- context.onError(createDOMCompilerError(57 /* X_V_SHOW_NO_EXPRESSION */, loc));
5359
+ context.onError(createDOMCompilerError(58 /* X_V_SHOW_NO_EXPRESSION */, loc));
5437
5360
  }
5438
5361
  return {
5439
5362
  props: [],
@@ -5448,7 +5371,7 @@ const warnTransitionChildren = (node, context) => {
5448
5371
  if (component === TRANSITION) {
5449
5372
  return () => {
5450
5373
  if (node.children.length && hasMultipleChildren(node)) {
5451
- context.onError(createDOMCompilerError(58 /* X_TRANSITION_INVALID_CHILDREN */, {
5374
+ context.onError(createDOMCompilerError(59 /* X_TRANSITION_INVALID_CHILDREN */, {
5452
5375
  start: node.children[0].loc.start,
5453
5376
  end: node.children[node.children.length - 1].loc.end,
5454
5377
  source: ''
@@ -5471,7 +5394,7 @@ const ignoreSideEffectTags = (node, context) => {
5471
5394
  if (node.type === 1 /* ELEMENT */ &&
5472
5395
  node.tagType === 0 /* ELEMENT */ &&
5473
5396
  (node.tag === 'script' || node.tag === 'style')) {
5474
- context.onError(createDOMCompilerError(59 /* X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
5397
+ context.onError(createDOMCompilerError(60 /* X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
5475
5398
  context.removeNode();
5476
5399
  }
5477
5400
  };
@@ -5506,4 +5429,4 @@ function parse(template, options = {}) {
5506
5429
  return baseParse(template, extend({}, parserOptions, options));
5507
5430
  }
5508
5431
 
5509
- export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, DOMDirectiveTransforms, DOMNodeTransforms, 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, TRANSITION, TRANSITION_GROUP, UNREF, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, WITH_SCOPE_ID, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildProps, buildSlots, checkCompatEnabled, compile, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createDOMCompilerError, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, generateCodeFrame, 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, parse, parserOptions, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, transformStyle, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
5432
+ export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, DOMDirectiveTransforms, DOMNodeTransforms, 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, TRANSITION, TRANSITION_GROUP, UNREF, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildProps, buildSlots, checkCompatEnabled, compile, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createDOMCompilerError, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, generateCodeFrame, 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, parse, parserOptions, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, transformStyle, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };