@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.
- package/dist/compiler-core.cjs.js +78 -70
- package/dist/compiler-core.cjs.prod.js +77 -69
- package/dist/compiler-core.d.ts +26 -27
- package/dist/compiler-core.esm-bundler.js +66 -142
- package/package.json +2 -2
|
@@ -45,43 +45,44 @@ const errorMessages = {
|
|
|
45
45
|
[18 /* UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */]: 'Unquoted attribute value cannot contain U+0022 ("), U+0027 (\'), U+003C (<), U+003D (=), and U+0060 (`).',
|
|
46
46
|
[19 /* UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */]: "Attribute name cannot start with '='.",
|
|
47
47
|
[21 /* UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */]: "'<?' is allowed only in XML context.",
|
|
48
|
-
[20 /* UNEXPECTED_NULL_CHARACTER */]: `Unexpected null
|
|
48
|
+
[20 /* UNEXPECTED_NULL_CHARACTER */]: `Unexpected null character.`,
|
|
49
49
|
[22 /* UNEXPECTED_SOLIDUS_IN_TAG */]: "Illegal '/' in tags.",
|
|
50
50
|
// Vue-specific parse errors
|
|
51
51
|
[23 /* X_INVALID_END_TAG */]: 'Invalid end tag.',
|
|
52
52
|
[24 /* X_MISSING_END_TAG */]: 'Element is missing end tag.',
|
|
53
53
|
[25 /* X_MISSING_INTERPOLATION_END */]: 'Interpolation end sign was not found.',
|
|
54
|
-
[
|
|
54
|
+
[27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */]: 'End bracket for dynamic directive argument was not found. ' +
|
|
55
55
|
'Note that dynamic directive argument cannot contain spaces.',
|
|
56
|
+
[26 /* X_MISSING_DIRECTIVE_NAME */]: 'Legal directive name was expected.',
|
|
56
57
|
// transform errors
|
|
57
|
-
[
|
|
58
|
-
[
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
[
|
|
62
|
-
[
|
|
63
|
-
[
|
|
64
|
-
[
|
|
65
|
-
[
|
|
66
|
-
[
|
|
58
|
+
[28 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
|
|
59
|
+
[29 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
|
|
60
|
+
[30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if.`,
|
|
61
|
+
[31 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
|
|
62
|
+
[32 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
|
|
63
|
+
[33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
|
|
64
|
+
[34 /* X_V_BIND_NO_EXPRESSION */]: `v-bind is missing expression.`,
|
|
65
|
+
[35 /* X_V_ON_NO_EXPRESSION */]: `v-on is missing expression.`,
|
|
66
|
+
[36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */]: `Unexpected custom directive on <slot> outlet.`,
|
|
67
|
+
[37 /* X_V_SLOT_MIXED_SLOT_USAGE */]: `Mixed v-slot usage on both the component and nested <template>.` +
|
|
67
68
|
`When there are multiple named slots, all slots should use <template> ` +
|
|
68
69
|
`syntax to avoid scope ambiguity.`,
|
|
69
|
-
[
|
|
70
|
-
[
|
|
70
|
+
[38 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */]: `Duplicate slot names found. `,
|
|
71
|
+
[39 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */]: `Extraneous children found when component already has explicitly named ` +
|
|
71
72
|
`default slot. These children will be ignored.`,
|
|
72
|
-
[
|
|
73
|
-
[
|
|
74
|
-
[
|
|
75
|
-
[
|
|
76
|
-
[
|
|
77
|
-
[
|
|
73
|
+
[40 /* X_V_SLOT_MISPLACED */]: `v-slot can only be used on components or <template> tags.`,
|
|
74
|
+
[41 /* X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
|
|
75
|
+
[42 /* X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
|
|
76
|
+
[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.`,
|
|
77
|
+
[44 /* X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
|
|
78
|
+
[45 /* X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
|
|
78
79
|
// generic errors
|
|
79
|
-
[
|
|
80
|
-
[
|
|
81
|
-
[
|
|
82
|
-
[
|
|
80
|
+
[46 /* X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
81
|
+
[47 /* X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
|
|
82
|
+
[48 /* X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
83
|
+
[49 /* X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
|
|
83
84
|
// just to fullfill types
|
|
84
|
-
[
|
|
85
|
+
[50 /* __EXTEND_POINT__ */]: ``
|
|
85
86
|
};
|
|
86
87
|
|
|
87
88
|
const FRAGMENT = Symbol(`Fragment` );
|
|
@@ -118,7 +119,6 @@ const TO_HANDLER_KEY = Symbol(`toHandlerKey` );
|
|
|
118
119
|
const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` );
|
|
119
120
|
const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
|
|
120
121
|
const POP_SCOPE_ID = Symbol(`popScopeId` );
|
|
121
|
-
const WITH_SCOPE_ID = Symbol(`withScopeId` );
|
|
122
122
|
const WITH_CTX = Symbol(`withCtx` );
|
|
123
123
|
const UNREF = Symbol(`unref` );
|
|
124
124
|
const IS_REF = Symbol(`isRef` );
|
|
@@ -162,7 +162,6 @@ const helperNameMap = {
|
|
|
162
162
|
[SET_BLOCK_TRACKING]: `setBlockTracking`,
|
|
163
163
|
[PUSH_SCOPE_ID]: `pushScopeId`,
|
|
164
164
|
[POP_SCOPE_ID]: `popScopeId`,
|
|
165
|
-
[WITH_SCOPE_ID]: `withScopeId`,
|
|
166
165
|
[WITH_CTX]: `withCtx`,
|
|
167
166
|
[UNREF]: `unref`,
|
|
168
167
|
[IS_REF]: `isRef`,
|
|
@@ -1341,7 +1340,7 @@ function parseAttribute(context, nameSet) {
|
|
|
1341
1340
|
}
|
|
1342
1341
|
}
|
|
1343
1342
|
const loc = getSelection(context, start);
|
|
1344
|
-
if (!context.inVPre && /^(v
|
|
1343
|
+
if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
|
|
1345
1344
|
const match = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(name);
|
|
1346
1345
|
let isPropShorthand = startsWith(name, '.');
|
|
1347
1346
|
let dirName = match[1] ||
|
|
@@ -1360,7 +1359,7 @@ function parseAttribute(context, nameSet) {
|
|
|
1360
1359
|
if (content.startsWith('[')) {
|
|
1361
1360
|
isStatic = false;
|
|
1362
1361
|
if (!content.endsWith(']')) {
|
|
1363
|
-
emitError(context,
|
|
1362
|
+
emitError(context, 27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
|
|
1364
1363
|
}
|
|
1365
1364
|
content = content.substr(1, content.length - 2);
|
|
1366
1365
|
}
|
|
@@ -1418,6 +1417,10 @@ function parseAttribute(context, nameSet) {
|
|
|
1418
1417
|
loc
|
|
1419
1418
|
};
|
|
1420
1419
|
}
|
|
1420
|
+
// missing directive name or illegal directive name
|
|
1421
|
+
if (!context.inVPre && startsWith(name, 'v-')) {
|
|
1422
|
+
emitError(context, 26 /* X_MISSING_DIRECTIVE_NAME */);
|
|
1423
|
+
}
|
|
1421
1424
|
return {
|
|
1422
1425
|
type: 6 /* ATTRIBUTE */,
|
|
1423
1426
|
name,
|
|
@@ -1497,10 +1500,7 @@ function parseInterpolation(context, mode) {
|
|
|
1497
1500
|
};
|
|
1498
1501
|
}
|
|
1499
1502
|
function parseText(context, mode) {
|
|
1500
|
-
const endTokens = ['<', context.options.delimiters[0]];
|
|
1501
|
-
if (mode === 3 /* CDATA */) {
|
|
1502
|
-
endTokens.push(']]>');
|
|
1503
|
-
}
|
|
1503
|
+
const endTokens = mode === 3 /* CDATA */ ? [']]>'] : ['<', context.options.delimiters[0]];
|
|
1504
1504
|
let endIndex = context.source.length;
|
|
1505
1505
|
for (let i = 0; i < endTokens.length; i++) {
|
|
1506
1506
|
const index = context.source.indexOf(endTokens[i], 1);
|
|
@@ -2462,11 +2462,8 @@ function genFunctionPreamble(ast, context) {
|
|
|
2462
2462
|
}
|
|
2463
2463
|
function genModulePreamble(ast, context, genScopeId, inline) {
|
|
2464
2464
|
const { push, newline, optimizeImports, runtimeModuleName } = context;
|
|
2465
|
-
if (genScopeId) {
|
|
2466
|
-
ast.helpers.push(
|
|
2467
|
-
if (ast.hoists.length) {
|
|
2468
|
-
ast.helpers.push(PUSH_SCOPE_ID, POP_SCOPE_ID);
|
|
2469
|
-
}
|
|
2465
|
+
if (genScopeId && ast.hoists.length) {
|
|
2466
|
+
ast.helpers.push(PUSH_SCOPE_ID, POP_SCOPE_ID);
|
|
2470
2467
|
}
|
|
2471
2468
|
// generate import statements for helpers
|
|
2472
2469
|
if (ast.helpers.length) {
|
|
@@ -3187,7 +3184,7 @@ function processExpression(node, context,
|
|
|
3187
3184
|
// function params
|
|
3188
3185
|
asParams = false,
|
|
3189
3186
|
// v-on handler values may contain multiple statements
|
|
3190
|
-
asRawStatements = false) {
|
|
3187
|
+
asRawStatements = false, localVars = Object.create(context.identifiers)) {
|
|
3191
3188
|
if (!context.prefixIdentifiers || !node.content.trim()) {
|
|
3192
3189
|
return node;
|
|
3193
3190
|
}
|
|
@@ -3201,7 +3198,7 @@ asRawStatements = false) {
|
|
|
3201
3198
|
const isUpdateArg = parent && parent.type === 'UpdateExpression' && parent.argument === id;
|
|
3202
3199
|
// ({ x } = y)
|
|
3203
3200
|
const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack);
|
|
3204
|
-
if (type === "setup-const" /* SETUP_CONST */) {
|
|
3201
|
+
if (type === "setup-const" /* SETUP_CONST */ || localVars[raw]) {
|
|
3205
3202
|
return raw;
|
|
3206
3203
|
}
|
|
3207
3204
|
else if (type === "setup-ref" /* SETUP_REF */) {
|
|
@@ -3225,7 +3222,7 @@ asRawStatements = false) {
|
|
|
3225
3222
|
// x = y --> isRef(x) ? x.value = y : x = y
|
|
3226
3223
|
const { right: rVal, operator } = parent;
|
|
3227
3224
|
const rExp = rawExp.slice(rVal.start - 1, rVal.end - 1);
|
|
3228
|
-
const rExpString = stringifyExpression(processExpression(createSimpleExpression(rExp, false), context));
|
|
3225
|
+
const rExpString = stringifyExpression(processExpression(createSimpleExpression(rExp, false), context, false, false, knownIds));
|
|
3229
3226
|
return `${context.helperString(IS_REF)}(${raw})${context.isTS ? ` //@ts-ignore\n` : ``} ? ${raw}.value ${operator} ${rExpString} : ${raw}`;
|
|
3230
3227
|
}
|
|
3231
3228
|
else if (isUpdateArg) {
|
|
@@ -3311,7 +3308,7 @@ asRawStatements = false) {
|
|
|
3311
3308
|
}).program;
|
|
3312
3309
|
}
|
|
3313
3310
|
catch (e) {
|
|
3314
|
-
context.onError(createCompilerError(
|
|
3311
|
+
context.onError(createCompilerError(44 /* X_INVALID_EXPRESSION */, node.loc, undefined, e.message));
|
|
3315
3312
|
return node;
|
|
3316
3313
|
}
|
|
3317
3314
|
const ids = [];
|
|
@@ -3441,7 +3438,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
3441
3438
|
if (dir.name !== 'else' &&
|
|
3442
3439
|
(!dir.exp || !dir.exp.content.trim())) {
|
|
3443
3440
|
const loc = dir.exp ? dir.exp.loc : node.loc;
|
|
3444
|
-
context.onError(createCompilerError(
|
|
3441
|
+
context.onError(createCompilerError(28 /* X_V_IF_NO_EXPRESSION */, dir.loc));
|
|
3445
3442
|
dir.exp = createSimpleExpression(`true`, false, loc);
|
|
3446
3443
|
}
|
|
3447
3444
|
if (context.prefixIdentifiers && dir.exp) {
|
|
@@ -3496,7 +3493,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
3496
3493
|
if (key) {
|
|
3497
3494
|
sibling.branches.forEach(({ userKey }) => {
|
|
3498
3495
|
if (isSameKey(userKey, key)) {
|
|
3499
|
-
context.onError(createCompilerError(
|
|
3496
|
+
context.onError(createCompilerError(29 /* X_V_IF_SAME_KEY */, branch.userKey.loc));
|
|
3500
3497
|
}
|
|
3501
3498
|
});
|
|
3502
3499
|
}
|
|
@@ -3514,7 +3511,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
3514
3511
|
context.currentNode = null;
|
|
3515
3512
|
}
|
|
3516
3513
|
else {
|
|
3517
|
-
context.onError(createCompilerError(
|
|
3514
|
+
context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
|
|
3518
3515
|
}
|
|
3519
3516
|
break;
|
|
3520
3517
|
}
|
|
@@ -3665,7 +3662,7 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
|
|
|
3665
3662
|
if (c.type === 1 /* ELEMENT */) {
|
|
3666
3663
|
const key = findProp(c, 'key');
|
|
3667
3664
|
if (key) {
|
|
3668
|
-
context.onError(createCompilerError(
|
|
3665
|
+
context.onError(createCompilerError(33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */, key.loc));
|
|
3669
3666
|
return true;
|
|
3670
3667
|
}
|
|
3671
3668
|
}
|
|
@@ -3750,7 +3747,7 @@ const transformFor = createStructuralDirectiveTransform('for', (node, dir, conte
|
|
|
3750
3747
|
// target-agnostic transform used for both Client and SSR
|
|
3751
3748
|
function processFor(node, dir, context, processCodegen) {
|
|
3752
3749
|
if (!dir.exp) {
|
|
3753
|
-
context.onError(createCompilerError(
|
|
3750
|
+
context.onError(createCompilerError(31 /* X_V_FOR_NO_EXPRESSION */, dir.loc));
|
|
3754
3751
|
return;
|
|
3755
3752
|
}
|
|
3756
3753
|
const parseResult = parseForExpression(
|
|
@@ -3758,7 +3755,7 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
3758
3755
|
// before expression transform.
|
|
3759
3756
|
dir.exp, context);
|
|
3760
3757
|
if (!parseResult) {
|
|
3761
|
-
context.onError(createCompilerError(
|
|
3758
|
+
context.onError(createCompilerError(32 /* X_V_FOR_MALFORMED_EXPRESSION */, dir.loc));
|
|
3762
3759
|
return;
|
|
3763
3760
|
}
|
|
3764
3761
|
const { addIdentifiers, removeIdentifiers, scopes } = context;
|
|
@@ -3964,7 +3961,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
3964
3961
|
}
|
|
3965
3962
|
if (onComponentSlot) {
|
|
3966
3963
|
// already has on-component slot - this is incorrect usage.
|
|
3967
|
-
context.onError(createCompilerError(
|
|
3964
|
+
context.onError(createCompilerError(37 /* X_V_SLOT_MIXED_SLOT_USAGE */, slotDir.loc));
|
|
3968
3965
|
break;
|
|
3969
3966
|
}
|
|
3970
3967
|
hasTemplateSlots = true;
|
|
@@ -4011,7 +4008,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
4011
4008
|
: buildDynamicSlot(slotName, slotFunction);
|
|
4012
4009
|
}
|
|
4013
4010
|
else {
|
|
4014
|
-
context.onError(createCompilerError(
|
|
4011
|
+
context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, vElse.loc));
|
|
4015
4012
|
}
|
|
4016
4013
|
}
|
|
4017
4014
|
else if ((vFor = findDir(slotElement, 'for'))) {
|
|
@@ -4027,14 +4024,14 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
4027
4024
|
]));
|
|
4028
4025
|
}
|
|
4029
4026
|
else {
|
|
4030
|
-
context.onError(createCompilerError(
|
|
4027
|
+
context.onError(createCompilerError(32 /* X_V_FOR_MALFORMED_EXPRESSION */, vFor.loc));
|
|
4031
4028
|
}
|
|
4032
4029
|
}
|
|
4033
4030
|
else {
|
|
4034
4031
|
// check duplicate static names
|
|
4035
4032
|
if (staticSlotName) {
|
|
4036
4033
|
if (seenSlotNames.has(staticSlotName)) {
|
|
4037
|
-
context.onError(createCompilerError(
|
|
4034
|
+
context.onError(createCompilerError(38 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */, dirLoc));
|
|
4038
4035
|
continue;
|
|
4039
4036
|
}
|
|
4040
4037
|
seenSlotNames.add(staticSlotName);
|
|
@@ -4064,7 +4061,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
4064
4061
|
implicitDefaultChildren.some(node => isNonWhitespaceContent(node))) {
|
|
4065
4062
|
// implicit default slot (mixed with named slots)
|
|
4066
4063
|
if (hasNamedDefaultSlot) {
|
|
4067
|
-
context.onError(createCompilerError(
|
|
4064
|
+
context.onError(createCompilerError(39 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */, implicitDefaultChildren[0].loc));
|
|
4068
4065
|
}
|
|
4069
4066
|
else {
|
|
4070
4067
|
slotsProperties.push(buildDefaultSlotProperty(undefined, implicitDefaultChildren));
|
|
@@ -4196,7 +4193,7 @@ const transformElement = (node, context) => {
|
|
|
4196
4193
|
// 2. Force keep-alive to always be updated, since it uses raw children.
|
|
4197
4194
|
patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
4198
4195
|
if (node.children.length > 1) {
|
|
4199
|
-
context.onError(createCompilerError(
|
|
4196
|
+
context.onError(createCompilerError(45 /* X_KEEP_ALIVE_INVALID_CHILDREN */, {
|
|
4200
4197
|
start: node.children[0].loc.start,
|
|
4201
4198
|
end: node.children[node.children.length - 1].loc.end,
|
|
4202
4199
|
source: ''
|
|
@@ -4438,14 +4435,15 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4438
4435
|
const prop = props[i];
|
|
4439
4436
|
if (prop.type === 6 /* ATTRIBUTE */) {
|
|
4440
4437
|
const { loc, name, value } = prop;
|
|
4441
|
-
let
|
|
4438
|
+
let valueNode = createSimpleExpression(value ? value.content : '', true, value ? value.loc : loc);
|
|
4442
4439
|
if (name === 'ref') {
|
|
4443
4440
|
hasRef = true;
|
|
4444
4441
|
// in inline mode there is no setupState object, so we can't use string
|
|
4445
4442
|
// keys to set the ref. Instead, we need to transform it to pass the
|
|
4446
4443
|
// acrtual ref instead.
|
|
4447
|
-
if (context.inline) {
|
|
4448
|
-
|
|
4444
|
+
if (context.inline && (value === null || value === void 0 ? void 0 : value.content)) {
|
|
4445
|
+
valueNode = createFunctionExpression(['_value', '_refs']);
|
|
4446
|
+
valueNode.body = createBlockStatement(processInlineRef(context.bindingMetadata, value.content));
|
|
4449
4447
|
}
|
|
4450
4448
|
}
|
|
4451
4449
|
// skip is on <component>, or is="vue:xxx"
|
|
@@ -4455,7 +4453,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4455
4453
|
(isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
|
|
4456
4454
|
continue;
|
|
4457
4455
|
}
|
|
4458
|
-
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)),
|
|
4456
|
+
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), valueNode));
|
|
4459
4457
|
}
|
|
4460
4458
|
else {
|
|
4461
4459
|
// directives
|
|
@@ -4465,7 +4463,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4465
4463
|
// skip v-slot - it is handled by its dedicated transform.
|
|
4466
4464
|
if (name === 'slot') {
|
|
4467
4465
|
if (!isComponent) {
|
|
4468
|
-
context.onError(createCompilerError(
|
|
4466
|
+
context.onError(createCompilerError(40 /* X_V_SLOT_MISPLACED */, loc));
|
|
4469
4467
|
}
|
|
4470
4468
|
continue;
|
|
4471
4469
|
}
|
|
@@ -4537,8 +4535,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4537
4535
|
}
|
|
4538
4536
|
else {
|
|
4539
4537
|
context.onError(createCompilerError(isVBind
|
|
4540
|
-
?
|
|
4541
|
-
:
|
|
4538
|
+
? 34 /* X_V_BIND_NO_EXPRESSION */
|
|
4539
|
+
: 35 /* X_V_ON_NO_EXPRESSION */, loc));
|
|
4542
4540
|
}
|
|
4543
4541
|
continue;
|
|
4544
4542
|
}
|
|
@@ -4764,6 +4762,17 @@ function stringifyDynamicPropNames(props) {
|
|
|
4764
4762
|
}
|
|
4765
4763
|
function isComponentTag(tag) {
|
|
4766
4764
|
return tag[0].toLowerCase() + tag.slice(1) === 'component';
|
|
4765
|
+
}
|
|
4766
|
+
function processInlineRef(bindings, raw) {
|
|
4767
|
+
const body = [createSimpleExpression(`_refs['${raw}'] = _value`)];
|
|
4768
|
+
const type = bindings[raw];
|
|
4769
|
+
if (type === "setup-ref" /* SETUP_REF */) {
|
|
4770
|
+
body.push(createSimpleExpression(`${raw}.value = _value`));
|
|
4771
|
+
}
|
|
4772
|
+
else if (type === "setup-let" /* SETUP_LET */) {
|
|
4773
|
+
body.push(createSimpleExpression(`${raw} = _value`));
|
|
4774
|
+
}
|
|
4775
|
+
return body;
|
|
4767
4776
|
}
|
|
4768
4777
|
|
|
4769
4778
|
Object.freeze({})
|
|
@@ -4847,7 +4856,7 @@ function processSlotOutlet(node, context) {
|
|
|
4847
4856
|
const { props, directives } = buildProps(node, context, nonNameProps);
|
|
4848
4857
|
slotProps = props;
|
|
4849
4858
|
if (directives.length) {
|
|
4850
|
-
context.onError(createCompilerError(
|
|
4859
|
+
context.onError(createCompilerError(36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
|
|
4851
4860
|
}
|
|
4852
4861
|
}
|
|
4853
4862
|
return {
|
|
@@ -4860,7 +4869,7 @@ const fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^\s*function(?:\s+[\w$]+)?\s*\(/;
|
|
|
4860
4869
|
const transformOn = (dir, node, context, augmentor) => {
|
|
4861
4870
|
const { loc, modifiers, arg } = dir;
|
|
4862
4871
|
if (!dir.exp && !modifiers.length) {
|
|
4863
|
-
context.onError(createCompilerError(
|
|
4872
|
+
context.onError(createCompilerError(35 /* X_V_ON_NO_EXPRESSION */, loc));
|
|
4864
4873
|
}
|
|
4865
4874
|
let eventName;
|
|
4866
4875
|
if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
|
|
@@ -5001,7 +5010,7 @@ const transformBind = (dir, _node, context) => {
|
|
|
5001
5010
|
}
|
|
5002
5011
|
if (!exp ||
|
|
5003
5012
|
(exp.type === 4 /* SIMPLE_EXPRESSION */ && !exp.content.trim())) {
|
|
5004
|
-
context.onError(createCompilerError(
|
|
5013
|
+
context.onError(createCompilerError(34 /* X_V_BIND_NO_EXPRESSION */, loc));
|
|
5005
5014
|
return {
|
|
5006
5015
|
props: [createObjectProperty(arg, createSimpleExpression('', true, loc))]
|
|
5007
5016
|
};
|
|
@@ -5137,7 +5146,7 @@ const transformOnce = (node, context) => {
|
|
|
5137
5146
|
const transformModel = (dir, node, context) => {
|
|
5138
5147
|
const { exp, arg } = dir;
|
|
5139
5148
|
if (!exp) {
|
|
5140
|
-
context.onError(createCompilerError(
|
|
5149
|
+
context.onError(createCompilerError(41 /* X_V_MODEL_NO_EXPRESSION */, dir.loc));
|
|
5141
5150
|
return createTransformProps();
|
|
5142
5151
|
}
|
|
5143
5152
|
const rawExp = exp.loc.source;
|
|
@@ -5149,13 +5158,13 @@ const transformModel = (dir, node, context) => {
|
|
|
5149
5158
|
bindingType &&
|
|
5150
5159
|
bindingType !== "setup-const" /* SETUP_CONST */;
|
|
5151
5160
|
if (!expString.trim() || (!isMemberExpression(expString) && !maybeRef)) {
|
|
5152
|
-
context.onError(createCompilerError(
|
|
5161
|
+
context.onError(createCompilerError(42 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
|
|
5153
5162
|
return createTransformProps();
|
|
5154
5163
|
}
|
|
5155
5164
|
if (context.prefixIdentifiers &&
|
|
5156
5165
|
isSimpleIdentifier(expString) &&
|
|
5157
5166
|
context.identifiers[expString]) {
|
|
5158
|
-
context.onError(createCompilerError(
|
|
5167
|
+
context.onError(createCompilerError(43 /* X_V_MODEL_ON_SCOPE_VARIABLE */, exp.loc));
|
|
5159
5168
|
return createTransformProps();
|
|
5160
5169
|
}
|
|
5161
5170
|
const propName = arg ? arg : createSimpleExpression('modelValue', true);
|
|
@@ -5450,10 +5459,10 @@ function baseCompile(template, options = {}) {
|
|
|
5450
5459
|
const isModuleMode = options.mode === 'module';
|
|
5451
5460
|
const prefixIdentifiers = (options.prefixIdentifiers === true || isModuleMode);
|
|
5452
5461
|
if (!prefixIdentifiers && options.cacheHandlers) {
|
|
5453
|
-
onError(createCompilerError(
|
|
5462
|
+
onError(createCompilerError(48 /* X_CACHE_HANDLER_NOT_SUPPORTED */));
|
|
5454
5463
|
}
|
|
5455
5464
|
if (options.scopeId && !isModuleMode) {
|
|
5456
|
-
onError(createCompilerError(
|
|
5465
|
+
onError(createCompilerError(49 /* X_SCOPE_ID_NOT_SUPPORTED */));
|
|
5457
5466
|
}
|
|
5458
5467
|
const ast = shared.isString(template) ? baseParse(template, options) : template;
|
|
5459
5468
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
|
|
@@ -5513,7 +5522,6 @@ exports.UNREF = UNREF;
|
|
|
5513
5522
|
exports.WITH_CTX = WITH_CTX;
|
|
5514
5523
|
exports.WITH_DIRECTIVES = WITH_DIRECTIVES;
|
|
5515
5524
|
exports.WITH_MEMO = WITH_MEMO;
|
|
5516
|
-
exports.WITH_SCOPE_ID = WITH_SCOPE_ID;
|
|
5517
5525
|
exports.advancePositionWithClone = advancePositionWithClone;
|
|
5518
5526
|
exports.advancePositionWithMutation = advancePositionWithMutation;
|
|
5519
5527
|
exports.assert = assert;
|