@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,4 +1,4 @@
1
- var VueCompilerDOM = (function (exports, types, estreeWalker) {
1
+ var VueCompilerDOM = (function (exports) {
2
2
  'use strict';
3
3
 
4
4
  /**
@@ -216,43 +216,44 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
216
216
  [18 /* UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */]: 'Unquoted attribute value cannot contain U+0022 ("), U+0027 (\'), U+003C (<), U+003D (=), and U+0060 (`).',
217
217
  [19 /* UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */]: "Attribute name cannot start with '='.",
218
218
  [21 /* UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */]: "'<?' is allowed only in XML context.",
219
- [20 /* UNEXPECTED_NULL_CHARACTER */]: `Unexpected null cahracter.`,
219
+ [20 /* UNEXPECTED_NULL_CHARACTER */]: `Unexpected null character.`,
220
220
  [22 /* UNEXPECTED_SOLIDUS_IN_TAG */]: "Illegal '/' in tags.",
221
221
  // Vue-specific parse errors
222
222
  [23 /* X_INVALID_END_TAG */]: 'Invalid end tag.',
223
223
  [24 /* X_MISSING_END_TAG */]: 'Element is missing end tag.',
224
224
  [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. ' +
225
+ [27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */]: 'End bracket for dynamic directive argument was not found. ' +
226
226
  'Note that dynamic directive argument cannot contain spaces.',
227
+ [26 /* X_MISSING_DIRECTIVE_NAME */]: 'Legal directive name was expected.',
227
228
  // 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>.` +
229
+ [28 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
230
+ [29 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
231
+ [30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if.`,
232
+ [31 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
233
+ [32 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
234
+ [33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
235
+ [34 /* X_V_BIND_NO_EXPRESSION */]: `v-bind is missing expression.`,
236
+ [35 /* X_V_ON_NO_EXPRESSION */]: `v-on is missing expression.`,
237
+ [36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */]: `Unexpected custom directive on <slot> outlet.`,
238
+ [37 /* X_V_SLOT_MIXED_SLOT_USAGE */]: `Mixed v-slot usage on both the component and nested <template>.` +
238
239
  `When there are multiple named slots, all slots should use <template> ` +
239
240
  `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 ` +
241
+ [38 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */]: `Duplicate slot names found. `,
242
+ [39 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */]: `Extraneous children found when component already has explicitly named ` +
242
243
  `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.`,
244
+ [40 /* X_V_SLOT_MISPLACED */]: `v-slot can only be used on components or <template> tags.`,
245
+ [41 /* X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
246
+ [42 /* X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
247
+ [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.`,
248
+ [44 /* X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
249
+ [45 /* X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
249
250
  // 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.`,
251
+ [46 /* X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
252
+ [47 /* X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
253
+ [48 /* X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
254
+ [49 /* X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
254
255
  // just to fullfill types
255
- [49 /* __EXTEND_POINT__ */]: ``
256
+ [50 /* __EXTEND_POINT__ */]: ``
256
257
  };
257
258
 
258
259
  const FRAGMENT = Symbol(`Fragment` );
@@ -289,7 +290,6 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
289
290
  const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` );
290
291
  const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
291
292
  const POP_SCOPE_ID = Symbol(`popScopeId` );
292
- const WITH_SCOPE_ID = Symbol(`withScopeId` );
293
293
  const WITH_CTX = Symbol(`withCtx` );
294
294
  const UNREF = Symbol(`unref` );
295
295
  const IS_REF = Symbol(`isRef` );
@@ -333,7 +333,6 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
333
333
  [SET_BLOCK_TRACKING]: `setBlockTracking`,
334
334
  [PUSH_SCOPE_ID]: `pushScopeId`,
335
335
  [POP_SCOPE_ID]: `popScopeId`,
336
- [WITH_SCOPE_ID]: `withScopeId`,
337
336
  [WITH_CTX]: `withCtx`,
338
337
  [UNREF]: `unref`,
339
338
  [IS_REF]: `isRef`,
@@ -1512,7 +1511,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
1512
1511
  }
1513
1512
  }
1514
1513
  const loc = getSelection(context, start);
1515
- if (!context.inVPre && /^(v-|:|\.|@|#)/.test(name)) {
1514
+ if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
1516
1515
  const match = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(name);
1517
1516
  let isPropShorthand = startsWith(name, '.');
1518
1517
  let dirName = match[1] ||
@@ -1531,7 +1530,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
1531
1530
  if (content.startsWith('[')) {
1532
1531
  isStatic = false;
1533
1532
  if (!content.endsWith(']')) {
1534
- emitError(context, 26 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
1533
+ emitError(context, 27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
1535
1534
  }
1536
1535
  content = content.substr(1, content.length - 2);
1537
1536
  }
@@ -1589,6 +1588,10 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
1589
1588
  loc
1590
1589
  };
1591
1590
  }
1591
+ // missing directive name or illegal directive name
1592
+ if (!context.inVPre && startsWith(name, 'v-')) {
1593
+ emitError(context, 26 /* X_MISSING_DIRECTIVE_NAME */);
1594
+ }
1592
1595
  return {
1593
1596
  type: 6 /* ATTRIBUTE */,
1594
1597
  name,
@@ -1668,10 +1671,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
1668
1671
  };
1669
1672
  }
1670
1673
  function parseText(context, mode) {
1671
- const endTokens = ['<', context.options.delimiters[0]];
1672
- if (mode === 3 /* CDATA */) {
1673
- endTokens.push(']]>');
1674
- }
1674
+ const endTokens = mode === 3 /* CDATA */ ? [']]>'] : ['<', context.options.delimiters[0]];
1675
1675
  let endIndex = context.source.length;
1676
1676
  for (let i = 0; i < endTokens.length; i++) {
1677
1677
  const index = context.source.indexOf(endTokens[i], 1);
@@ -2919,75 +2919,14 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
2919
2919
  }
2920
2920
 
2921
2921
  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
- estreeWalker.walk(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
- });
2922
+ {
2923
+ return;
2924
+ }
2968
2925
  }
2969
2926
  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') {
2927
+ {
2975
2928
  return false;
2976
2929
  }
2977
- if (types.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
2930
  }
2992
2931
  function isInDestructureAssignment(parent, parentStack) {
2993
2932
  if (parent &&
@@ -3068,19 +3007,6 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
3068
3007
  }
3069
3008
  return nodes;
3070
3009
  }
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
3010
  const isFunctionType = (node) => {
3085
3011
  return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
3086
3012
  };
@@ -3125,7 +3051,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
3125
3051
  if (keywordMatch) {
3126
3052
  message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
3127
3053
  }
3128
- context.onError(createCompilerError(43 /* X_INVALID_EXPRESSION */, node.loc, undefined, message));
3054
+ context.onError(createCompilerError(44 /* X_INVALID_EXPRESSION */, node.loc, undefined, message));
3129
3055
  }
3130
3056
  }
3131
3057
 
@@ -3165,7 +3091,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
3165
3091
  // function params
3166
3092
  asParams = false,
3167
3093
  // v-on handler values may contain multiple statements
3168
- asRawStatements = false) {
3094
+ asRawStatements = false, localVars = Object.create(context.identifiers)) {
3169
3095
  {
3170
3096
  {
3171
3097
  // simple in-browser validation (same logic in 2.x)
@@ -3208,7 +3134,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
3208
3134
  if (dir.name !== 'else' &&
3209
3135
  (!dir.exp || !dir.exp.content.trim())) {
3210
3136
  const loc = dir.exp ? dir.exp.loc : node.loc;
3211
- context.onError(createCompilerError(27 /* X_V_IF_NO_EXPRESSION */, dir.loc));
3137
+ context.onError(createCompilerError(28 /* X_V_IF_NO_EXPRESSION */, dir.loc));
3212
3138
  dir.exp = createSimpleExpression(`true`, false, loc);
3213
3139
  }
3214
3140
  if (dir.exp) {
@@ -3261,7 +3187,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
3261
3187
  if (key) {
3262
3188
  sibling.branches.forEach(({ userKey }) => {
3263
3189
  if (isSameKey(userKey, key)) {
3264
- context.onError(createCompilerError(28 /* X_V_IF_SAME_KEY */, branch.userKey.loc));
3190
+ context.onError(createCompilerError(29 /* X_V_IF_SAME_KEY */, branch.userKey.loc));
3265
3191
  }
3266
3192
  });
3267
3193
  }
@@ -3279,7 +3205,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
3279
3205
  context.currentNode = null;
3280
3206
  }
3281
3207
  else {
3282
- context.onError(createCompilerError(29 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
3208
+ context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
3283
3209
  }
3284
3210
  break;
3285
3211
  }
@@ -3422,7 +3348,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
3422
3348
  if (c.type === 1 /* ELEMENT */) {
3423
3349
  const key = findProp(c, 'key');
3424
3350
  if (key) {
3425
- context.onError(createCompilerError(32 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */, key.loc));
3351
+ context.onError(createCompilerError(33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */, key.loc));
3426
3352
  return true;
3427
3353
  }
3428
3354
  }
@@ -3507,7 +3433,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
3507
3433
  // target-agnostic transform used for both Client and SSR
3508
3434
  function processFor(node, dir, context, processCodegen) {
3509
3435
  if (!dir.exp) {
3510
- context.onError(createCompilerError(30 /* X_V_FOR_NO_EXPRESSION */, dir.loc));
3436
+ context.onError(createCompilerError(31 /* X_V_FOR_NO_EXPRESSION */, dir.loc));
3511
3437
  return;
3512
3438
  }
3513
3439
  const parseResult = parseForExpression(
@@ -3515,7 +3441,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
3515
3441
  // before expression transform.
3516
3442
  dir.exp, context);
3517
3443
  if (!parseResult) {
3518
- context.onError(createCompilerError(31 /* X_V_FOR_MALFORMED_EXPRESSION */, dir.loc));
3444
+ context.onError(createCompilerError(32 /* X_V_FOR_MALFORMED_EXPRESSION */, dir.loc));
3519
3445
  return;
3520
3446
  }
3521
3447
  const { addIdentifiers, removeIdentifiers, scopes } = context;
@@ -3698,7 +3624,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
3698
3624
  }
3699
3625
  if (onComponentSlot) {
3700
3626
  // already has on-component slot - this is incorrect usage.
3701
- context.onError(createCompilerError(36 /* X_V_SLOT_MIXED_SLOT_USAGE */, slotDir.loc));
3627
+ context.onError(createCompilerError(37 /* X_V_SLOT_MIXED_SLOT_USAGE */, slotDir.loc));
3702
3628
  break;
3703
3629
  }
3704
3630
  hasTemplateSlots = true;
@@ -3745,7 +3671,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
3745
3671
  : buildDynamicSlot(slotName, slotFunction);
3746
3672
  }
3747
3673
  else {
3748
- context.onError(createCompilerError(29 /* X_V_ELSE_NO_ADJACENT_IF */, vElse.loc));
3674
+ context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, vElse.loc));
3749
3675
  }
3750
3676
  }
3751
3677
  else if ((vFor = findDir(slotElement, 'for'))) {
@@ -3761,14 +3687,14 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
3761
3687
  ]));
3762
3688
  }
3763
3689
  else {
3764
- context.onError(createCompilerError(31 /* X_V_FOR_MALFORMED_EXPRESSION */, vFor.loc));
3690
+ context.onError(createCompilerError(32 /* X_V_FOR_MALFORMED_EXPRESSION */, vFor.loc));
3765
3691
  }
3766
3692
  }
3767
3693
  else {
3768
3694
  // check duplicate static names
3769
3695
  if (staticSlotName) {
3770
3696
  if (seenSlotNames.has(staticSlotName)) {
3771
- context.onError(createCompilerError(37 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */, dirLoc));
3697
+ context.onError(createCompilerError(38 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */, dirLoc));
3772
3698
  continue;
3773
3699
  }
3774
3700
  seenSlotNames.add(staticSlotName);
@@ -3798,7 +3724,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
3798
3724
  implicitDefaultChildren.some(node => isNonWhitespaceContent(node))) {
3799
3725
  // implicit default slot (mixed with named slots)
3800
3726
  if (hasNamedDefaultSlot) {
3801
- context.onError(createCompilerError(38 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */, implicitDefaultChildren[0].loc));
3727
+ context.onError(createCompilerError(39 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */, implicitDefaultChildren[0].loc));
3802
3728
  }
3803
3729
  else {
3804
3730
  slotsProperties.push(buildDefaultSlotProperty(undefined, implicitDefaultChildren));
@@ -3930,7 +3856,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
3930
3856
  // 2. Force keep-alive to always be updated, since it uses raw children.
3931
3857
  patchFlag |= 1024 /* DYNAMIC_SLOTS */;
3932
3858
  if (node.children.length > 1) {
3933
- context.onError(createCompilerError(44 /* X_KEEP_ALIVE_INVALID_CHILDREN */, {
3859
+ context.onError(createCompilerError(45 /* X_KEEP_ALIVE_INVALID_CHILDREN */, {
3934
3860
  start: node.children[0].loc.start,
3935
3861
  end: node.children[node.children.length - 1].loc.end,
3936
3862
  source: ''
@@ -4111,7 +4037,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
4111
4037
  const prop = props[i];
4112
4038
  if (prop.type === 6 /* ATTRIBUTE */) {
4113
4039
  const { loc, name, value } = prop;
4114
- let isStatic = true;
4040
+ let valueNode = createSimpleExpression(value ? value.content : '', true, value ? value.loc : loc);
4115
4041
  if (name === 'ref') {
4116
4042
  hasRef = true;
4117
4043
  }
@@ -4122,7 +4048,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
4122
4048
  (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
4123
4049
  continue;
4124
4050
  }
4125
- properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
4051
+ properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), valueNode));
4126
4052
  }
4127
4053
  else {
4128
4054
  // directives
@@ -4132,7 +4058,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
4132
4058
  // skip v-slot - it is handled by its dedicated transform.
4133
4059
  if (name === 'slot') {
4134
4060
  if (!isComponent) {
4135
- context.onError(createCompilerError(39 /* X_V_SLOT_MISPLACED */, loc));
4061
+ context.onError(createCompilerError(40 /* X_V_SLOT_MISPLACED */, loc));
4136
4062
  }
4137
4063
  continue;
4138
4064
  }
@@ -4204,8 +4130,8 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
4204
4130
  }
4205
4131
  else {
4206
4132
  context.onError(createCompilerError(isVBind
4207
- ? 33 /* X_V_BIND_NO_EXPRESSION */
4208
- : 34 /* X_V_ON_NO_EXPRESSION */, loc));
4133
+ ? 34 /* X_V_BIND_NO_EXPRESSION */
4134
+ : 35 /* X_V_ON_NO_EXPRESSION */, loc));
4209
4135
  }
4210
4136
  continue;
4211
4137
  }
@@ -4490,7 +4416,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
4490
4416
  const { props, directives } = buildProps(node, context, nonNameProps);
4491
4417
  slotProps = props;
4492
4418
  if (directives.length) {
4493
- context.onError(createCompilerError(35 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
4419
+ context.onError(createCompilerError(36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
4494
4420
  }
4495
4421
  }
4496
4422
  return {
@@ -4503,7 +4429,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
4503
4429
  const transformOn = (dir, node, context, augmentor) => {
4504
4430
  const { loc, modifiers, arg } = dir;
4505
4431
  if (!dir.exp && !modifiers.length) {
4506
- context.onError(createCompilerError(34 /* X_V_ON_NO_EXPRESSION */, loc));
4432
+ context.onError(createCompilerError(35 /* X_V_ON_NO_EXPRESSION */, loc));
4507
4433
  }
4508
4434
  let eventName;
4509
4435
  if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
@@ -4609,7 +4535,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
4609
4535
  }
4610
4536
  if (!exp ||
4611
4537
  (exp.type === 4 /* SIMPLE_EXPRESSION */ && !exp.content.trim())) {
4612
- context.onError(createCompilerError(33 /* X_V_BIND_NO_EXPRESSION */, loc));
4538
+ context.onError(createCompilerError(34 /* X_V_BIND_NO_EXPRESSION */, loc));
4613
4539
  return {
4614
4540
  props: [createObjectProperty(arg, createSimpleExpression('', true, loc))]
4615
4541
  };
@@ -4745,7 +4671,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
4745
4671
  const transformModel = (dir, node, context) => {
4746
4672
  const { exp, arg } = dir;
4747
4673
  if (!exp) {
4748
- context.onError(createCompilerError(40 /* X_V_MODEL_NO_EXPRESSION */, dir.loc));
4674
+ context.onError(createCompilerError(41 /* X_V_MODEL_NO_EXPRESSION */, dir.loc));
4749
4675
  return createTransformProps();
4750
4676
  }
4751
4677
  const rawExp = exp.loc.source;
@@ -4755,7 +4681,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
4755
4681
  context.bindingMetadata[rawExp];
4756
4682
  const maybeRef = !true /* SETUP_CONST */;
4757
4683
  if (!expString.trim() || (!isMemberExpression(expString) && !maybeRef)) {
4758
- context.onError(createCompilerError(41 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
4684
+ context.onError(createCompilerError(42 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
4759
4685
  return createTransformProps();
4760
4686
  }
4761
4687
  const propName = arg ? arg : createSimpleExpression('modelValue', true);
@@ -5019,18 +4945,18 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
5019
4945
  /* istanbul ignore if */
5020
4946
  {
5021
4947
  if (options.prefixIdentifiers === true) {
5022
- onError(createCompilerError(45 /* X_PREFIX_ID_NOT_SUPPORTED */));
4948
+ onError(createCompilerError(46 /* X_PREFIX_ID_NOT_SUPPORTED */));
5023
4949
  }
5024
4950
  else if (isModuleMode) {
5025
- onError(createCompilerError(46 /* X_MODULE_MODE_NOT_SUPPORTED */));
4951
+ onError(createCompilerError(47 /* X_MODULE_MODE_NOT_SUPPORTED */));
5026
4952
  }
5027
4953
  }
5028
4954
  const prefixIdentifiers = !true ;
5029
4955
  if (options.cacheHandlers) {
5030
- onError(createCompilerError(47 /* X_CACHE_HANDLER_NOT_SUPPORTED */));
4956
+ onError(createCompilerError(48 /* X_CACHE_HANDLER_NOT_SUPPORTED */));
5031
4957
  }
5032
4958
  if (options.scopeId && !isModuleMode) {
5033
- onError(createCompilerError(48 /* X_SCOPE_ID_NOT_SUPPORTED */));
4959
+ onError(createCompilerError(49 /* X_SCOPE_ID_NOT_SUPPORTED */));
5034
4960
  }
5035
4961
  const ast = isString(template) ? baseParse(template, options) : template;
5036
4962
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
@@ -5188,26 +5114,26 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
5188
5114
  return createCompilerError(code, loc, DOMErrorMessages );
5189
5115
  }
5190
5116
  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.`
5117
+ [50 /* X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
5118
+ [51 /* X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
5119
+ [52 /* X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
5120
+ [53 /* X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
5121
+ [54 /* X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
5122
+ [55 /* X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
5123
+ [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.`,
5124
+ [57 /* X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
5125
+ [58 /* X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
5126
+ [59 /* X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
5127
+ [60 /* X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
5202
5128
  };
5203
5129
 
5204
5130
  const transformVHtml = (dir, node, context) => {
5205
5131
  const { exp, loc } = dir;
5206
5132
  if (!exp) {
5207
- context.onError(createDOMCompilerError(49 /* X_V_HTML_NO_EXPRESSION */, loc));
5133
+ context.onError(createDOMCompilerError(50 /* X_V_HTML_NO_EXPRESSION */, loc));
5208
5134
  }
5209
5135
  if (node.children.length) {
5210
- context.onError(createDOMCompilerError(50 /* X_V_HTML_WITH_CHILDREN */, loc));
5136
+ context.onError(createDOMCompilerError(51 /* X_V_HTML_WITH_CHILDREN */, loc));
5211
5137
  node.children.length = 0;
5212
5138
  }
5213
5139
  return {
@@ -5220,10 +5146,10 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
5220
5146
  const transformVText = (dir, node, context) => {
5221
5147
  const { exp, loc } = dir;
5222
5148
  if (!exp) {
5223
- context.onError(createDOMCompilerError(51 /* X_V_TEXT_NO_EXPRESSION */, loc));
5149
+ context.onError(createDOMCompilerError(52 /* X_V_TEXT_NO_EXPRESSION */, loc));
5224
5150
  }
5225
5151
  if (node.children.length) {
5226
- context.onError(createDOMCompilerError(52 /* X_V_TEXT_WITH_CHILDREN */, loc));
5152
+ context.onError(createDOMCompilerError(53 /* X_V_TEXT_WITH_CHILDREN */, loc));
5227
5153
  node.children.length = 0;
5228
5154
  }
5229
5155
  return {
@@ -5242,12 +5168,12 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
5242
5168
  return baseResult;
5243
5169
  }
5244
5170
  if (dir.arg) {
5245
- context.onError(createDOMCompilerError(54 /* X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
5171
+ context.onError(createDOMCompilerError(55 /* X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
5246
5172
  }
5247
5173
  function checkDuplicatedValue() {
5248
5174
  const value = findProp(node, 'value');
5249
5175
  if (value) {
5250
- context.onError(createDOMCompilerError(56 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
5176
+ context.onError(createDOMCompilerError(57 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
5251
5177
  }
5252
5178
  }
5253
5179
  const { tag } = node;
@@ -5275,7 +5201,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
5275
5201
  break;
5276
5202
  case 'file':
5277
5203
  isInvalidType = true;
5278
- context.onError(createDOMCompilerError(55 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
5204
+ context.onError(createDOMCompilerError(56 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
5279
5205
  break;
5280
5206
  default:
5281
5207
  // text type
@@ -5309,7 +5235,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
5309
5235
  }
5310
5236
  }
5311
5237
  else {
5312
- context.onError(createDOMCompilerError(53 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
5238
+ context.onError(createDOMCompilerError(54 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
5313
5239
  }
5314
5240
  // native vmodel doesn't need the `modelValue` props since they are also
5315
5241
  // passed to the runtime as `binding.value`. removing it reduces code size.
@@ -5433,7 +5359,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
5433
5359
  const transformShow = (dir, node, context) => {
5434
5360
  const { exp, loc } = dir;
5435
5361
  if (!exp) {
5436
- context.onError(createDOMCompilerError(57 /* X_V_SHOW_NO_EXPRESSION */, loc));
5362
+ context.onError(createDOMCompilerError(58 /* X_V_SHOW_NO_EXPRESSION */, loc));
5437
5363
  }
5438
5364
  return {
5439
5365
  props: [],
@@ -5448,7 +5374,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
5448
5374
  if (component === TRANSITION) {
5449
5375
  return () => {
5450
5376
  if (node.children.length && hasMultipleChildren(node)) {
5451
- context.onError(createDOMCompilerError(58 /* X_TRANSITION_INVALID_CHILDREN */, {
5377
+ context.onError(createDOMCompilerError(59 /* X_TRANSITION_INVALID_CHILDREN */, {
5452
5378
  start: node.children[0].loc.start,
5453
5379
  end: node.children[node.children.length - 1].loc.end,
5454
5380
  source: ''
@@ -5471,7 +5397,7 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
5471
5397
  if (node.type === 1 /* ELEMENT */ &&
5472
5398
  node.tagType === 0 /* ELEMENT */ &&
5473
5399
  (node.tag === 'script' || node.tag === 'style')) {
5474
- context.onError(createDOMCompilerError(59 /* X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
5400
+ context.onError(createDOMCompilerError(60 /* X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
5475
5401
  context.removeNode();
5476
5402
  }
5477
5403
  };
@@ -5557,7 +5483,6 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
5557
5483
  exports.WITH_CTX = WITH_CTX;
5558
5484
  exports.WITH_DIRECTIVES = WITH_DIRECTIVES;
5559
5485
  exports.WITH_MEMO = WITH_MEMO;
5560
- exports.WITH_SCOPE_ID = WITH_SCOPE_ID;
5561
5486
  exports.advancePositionWithClone = advancePositionWithClone;
5562
5487
  exports.advancePositionWithMutation = advancePositionWithMutation;
5563
5488
  exports.assert = assert;
@@ -5650,4 +5575,4 @@ var VueCompilerDOM = (function (exports, types, estreeWalker) {
5650
5575
 
5651
5576
  return exports;
5652
5577
 
5653
- }({}, types, estreeWalker));
5578
+ }({}));