@vue/compiler-dom 3.2.44 → 3.2.45
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-dom.cjs.js +22 -22
- package/dist/compiler-dom.cjs.prod.js +20 -20
- package/dist/compiler-dom.d.ts +12 -12
- package/dist/compiler-dom.esm-browser.js +44 -37
- package/dist/compiler-dom.esm-browser.prod.js +1 -1
- package/dist/compiler-dom.esm-bundler.js +22 -22
- package/dist/compiler-dom.global.js +44 -37
- package/dist/compiler-dom.global.prod.js +1 -1
- package/package.json +3 -3
package/dist/compiler-dom.cjs.js
CHANGED
|
@@ -2483,26 +2483,26 @@ function createDOMCompilerError(code, loc) {
|
|
|
2483
2483
|
return compilerCore.createCompilerError(code, loc, DOMErrorMessages );
|
|
2484
2484
|
}
|
|
2485
2485
|
const DOMErrorMessages = {
|
|
2486
|
-
[
|
|
2487
|
-
[
|
|
2488
|
-
[
|
|
2489
|
-
[
|
|
2490
|
-
[
|
|
2491
|
-
[
|
|
2492
|
-
[
|
|
2493
|
-
[
|
|
2494
|
-
[
|
|
2495
|
-
[
|
|
2496
|
-
[
|
|
2486
|
+
[51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
|
|
2487
|
+
[52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
|
|
2488
|
+
[53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
|
|
2489
|
+
[54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
|
|
2490
|
+
[55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
|
2491
|
+
[56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
|
|
2492
|
+
[57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
|
2493
|
+
[58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
|
2494
|
+
[59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
|
|
2495
|
+
[60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
|
|
2496
|
+
[61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
|
2497
2497
|
};
|
|
2498
2498
|
|
|
2499
2499
|
const transformVHtml = (dir, node, context) => {
|
|
2500
2500
|
const { exp, loc } = dir;
|
|
2501
2501
|
if (!exp) {
|
|
2502
|
-
context.onError(createDOMCompilerError(
|
|
2502
|
+
context.onError(createDOMCompilerError(51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */, loc));
|
|
2503
2503
|
}
|
|
2504
2504
|
if (node.children.length) {
|
|
2505
|
-
context.onError(createDOMCompilerError(
|
|
2505
|
+
context.onError(createDOMCompilerError(52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */, loc));
|
|
2506
2506
|
node.children.length = 0;
|
|
2507
2507
|
}
|
|
2508
2508
|
return {
|
|
@@ -2515,10 +2515,10 @@ const transformVHtml = (dir, node, context) => {
|
|
|
2515
2515
|
const transformVText = (dir, node, context) => {
|
|
2516
2516
|
const { exp, loc } = dir;
|
|
2517
2517
|
if (!exp) {
|
|
2518
|
-
context.onError(createDOMCompilerError(
|
|
2518
|
+
context.onError(createDOMCompilerError(53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */, loc));
|
|
2519
2519
|
}
|
|
2520
2520
|
if (node.children.length) {
|
|
2521
|
-
context.onError(createDOMCompilerError(
|
|
2521
|
+
context.onError(createDOMCompilerError(54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */, loc));
|
|
2522
2522
|
node.children.length = 0;
|
|
2523
2523
|
}
|
|
2524
2524
|
return {
|
|
@@ -2539,12 +2539,12 @@ const transformModel = (dir, node, context) => {
|
|
|
2539
2539
|
return baseResult;
|
|
2540
2540
|
}
|
|
2541
2541
|
if (dir.arg) {
|
|
2542
|
-
context.onError(createDOMCompilerError(
|
|
2542
|
+
context.onError(createDOMCompilerError(56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
|
|
2543
2543
|
}
|
|
2544
2544
|
function checkDuplicatedValue() {
|
|
2545
2545
|
const value = compilerCore.findProp(node, 'value');
|
|
2546
2546
|
if (value) {
|
|
2547
|
-
context.onError(createDOMCompilerError(
|
|
2547
|
+
context.onError(createDOMCompilerError(58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
|
|
2548
2548
|
}
|
|
2549
2549
|
}
|
|
2550
2550
|
const { tag } = node;
|
|
@@ -2572,7 +2572,7 @@ const transformModel = (dir, node, context) => {
|
|
|
2572
2572
|
break;
|
|
2573
2573
|
case 'file':
|
|
2574
2574
|
isInvalidType = true;
|
|
2575
|
-
context.onError(createDOMCompilerError(
|
|
2575
|
+
context.onError(createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
|
|
2576
2576
|
break;
|
|
2577
2577
|
default:
|
|
2578
2578
|
// text type
|
|
@@ -2606,7 +2606,7 @@ const transformModel = (dir, node, context) => {
|
|
|
2606
2606
|
}
|
|
2607
2607
|
}
|
|
2608
2608
|
else {
|
|
2609
|
-
context.onError(createDOMCompilerError(
|
|
2609
|
+
context.onError(createDOMCompilerError(55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
|
|
2610
2610
|
}
|
|
2611
2611
|
// native vmodel doesn't need the `modelValue` props since they are also
|
|
2612
2612
|
// passed to the runtime as `binding.value`. removing it reduces code size.
|
|
@@ -2730,7 +2730,7 @@ const transformOn = (dir, node, context) => {
|
|
|
2730
2730
|
const transformShow = (dir, node, context) => {
|
|
2731
2731
|
const { exp, loc } = dir;
|
|
2732
2732
|
if (!exp) {
|
|
2733
|
-
context.onError(createDOMCompilerError(
|
|
2733
|
+
context.onError(createDOMCompilerError(59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */, loc));
|
|
2734
2734
|
}
|
|
2735
2735
|
return {
|
|
2736
2736
|
props: [],
|
|
@@ -2749,7 +2749,7 @@ const transformTransition = (node, context) => {
|
|
|
2749
2749
|
}
|
|
2750
2750
|
// warn multiple transition children
|
|
2751
2751
|
if (hasMultipleChildren(node)) {
|
|
2752
|
-
context.onError(createDOMCompilerError(
|
|
2752
|
+
context.onError(createDOMCompilerError(60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */, {
|
|
2753
2753
|
start: node.children[0].loc.start,
|
|
2754
2754
|
end: node.children[node.children.length - 1].loc.end,
|
|
2755
2755
|
source: ''
|
|
@@ -3084,7 +3084,7 @@ const ignoreSideEffectTags = (node, context) => {
|
|
|
3084
3084
|
if (node.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
3085
3085
|
node.tagType === 0 /* ElementTypes.ELEMENT */ &&
|
|
3086
3086
|
(node.tag === 'script' || node.tag === 'style')) {
|
|
3087
|
-
context.onError(createDOMCompilerError(
|
|
3087
|
+
context.onError(createDOMCompilerError(61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
|
|
3088
3088
|
context.removeNode();
|
|
3089
3089
|
}
|
|
3090
3090
|
};
|
|
@@ -2483,26 +2483,26 @@ function createDOMCompilerError(code, loc) {
|
|
|
2483
2483
|
return compilerCore.createCompilerError(code, loc, DOMErrorMessages );
|
|
2484
2484
|
}
|
|
2485
2485
|
const DOMErrorMessages = {
|
|
2486
|
-
[
|
|
2487
|
-
[
|
|
2488
|
-
[
|
|
2489
|
-
[
|
|
2490
|
-
[
|
|
2491
|
-
[
|
|
2492
|
-
[
|
|
2493
|
-
[
|
|
2494
|
-
[
|
|
2495
|
-
[
|
|
2496
|
-
[
|
|
2486
|
+
[51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
|
|
2487
|
+
[52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
|
|
2488
|
+
[53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
|
|
2489
|
+
[54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
|
|
2490
|
+
[55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
|
2491
|
+
[56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
|
|
2492
|
+
[57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
|
2493
|
+
[58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
|
2494
|
+
[59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
|
|
2495
|
+
[60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
|
|
2496
|
+
[61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
|
2497
2497
|
};
|
|
2498
2498
|
|
|
2499
2499
|
const transformVHtml = (dir, node, context) => {
|
|
2500
2500
|
const { exp, loc } = dir;
|
|
2501
2501
|
if (!exp) {
|
|
2502
|
-
context.onError(createDOMCompilerError(
|
|
2502
|
+
context.onError(createDOMCompilerError(51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */, loc));
|
|
2503
2503
|
}
|
|
2504
2504
|
if (node.children.length) {
|
|
2505
|
-
context.onError(createDOMCompilerError(
|
|
2505
|
+
context.onError(createDOMCompilerError(52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */, loc));
|
|
2506
2506
|
node.children.length = 0;
|
|
2507
2507
|
}
|
|
2508
2508
|
return {
|
|
@@ -2515,10 +2515,10 @@ const transformVHtml = (dir, node, context) => {
|
|
|
2515
2515
|
const transformVText = (dir, node, context) => {
|
|
2516
2516
|
const { exp, loc } = dir;
|
|
2517
2517
|
if (!exp) {
|
|
2518
|
-
context.onError(createDOMCompilerError(
|
|
2518
|
+
context.onError(createDOMCompilerError(53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */, loc));
|
|
2519
2519
|
}
|
|
2520
2520
|
if (node.children.length) {
|
|
2521
|
-
context.onError(createDOMCompilerError(
|
|
2521
|
+
context.onError(createDOMCompilerError(54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */, loc));
|
|
2522
2522
|
node.children.length = 0;
|
|
2523
2523
|
}
|
|
2524
2524
|
return {
|
|
@@ -2539,7 +2539,7 @@ const transformModel = (dir, node, context) => {
|
|
|
2539
2539
|
return baseResult;
|
|
2540
2540
|
}
|
|
2541
2541
|
if (dir.arg) {
|
|
2542
|
-
context.onError(createDOMCompilerError(
|
|
2542
|
+
context.onError(createDOMCompilerError(56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
|
|
2543
2543
|
}
|
|
2544
2544
|
const { tag } = node;
|
|
2545
2545
|
const isCustomElement = context.isCustomElement(tag);
|
|
@@ -2566,7 +2566,7 @@ const transformModel = (dir, node, context) => {
|
|
|
2566
2566
|
break;
|
|
2567
2567
|
case 'file':
|
|
2568
2568
|
isInvalidType = true;
|
|
2569
|
-
context.onError(createDOMCompilerError(
|
|
2569
|
+
context.onError(createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
|
|
2570
2570
|
break;
|
|
2571
2571
|
}
|
|
2572
2572
|
}
|
|
@@ -2590,7 +2590,7 @@ const transformModel = (dir, node, context) => {
|
|
|
2590
2590
|
}
|
|
2591
2591
|
}
|
|
2592
2592
|
else {
|
|
2593
|
-
context.onError(createDOMCompilerError(
|
|
2593
|
+
context.onError(createDOMCompilerError(55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
|
|
2594
2594
|
}
|
|
2595
2595
|
// native vmodel doesn't need the `modelValue` props since they are also
|
|
2596
2596
|
// passed to the runtime as `binding.value`. removing it reduces code size.
|
|
@@ -2714,7 +2714,7 @@ const transformOn = (dir, node, context) => {
|
|
|
2714
2714
|
const transformShow = (dir, node, context) => {
|
|
2715
2715
|
const { exp, loc } = dir;
|
|
2716
2716
|
if (!exp) {
|
|
2717
|
-
context.onError(createDOMCompilerError(
|
|
2717
|
+
context.onError(createDOMCompilerError(59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */, loc));
|
|
2718
2718
|
}
|
|
2719
2719
|
return {
|
|
2720
2720
|
props: [],
|
|
@@ -3022,7 +3022,7 @@ const ignoreSideEffectTags = (node, context) => {
|
|
|
3022
3022
|
if (node.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
3023
3023
|
node.tagType === 0 /* ElementTypes.ELEMENT */ &&
|
|
3024
3024
|
(node.tag === 'script' || node.tag === 'style')) {
|
|
3025
|
-
context.onError(createDOMCompilerError(
|
|
3025
|
+
context.onError(createDOMCompilerError(61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
|
|
3026
3026
|
context.removeNode();
|
|
3027
3027
|
}
|
|
3028
3028
|
};
|
package/dist/compiler-dom.d.ts
CHANGED
|
@@ -18,18 +18,18 @@ declare interface DOMCompilerError extends CompilerError {
|
|
|
18
18
|
export declare const DOMDirectiveTransforms: Record<string, DirectiveTransform>;
|
|
19
19
|
|
|
20
20
|
export declare const enum DOMErrorCodes {
|
|
21
|
-
X_V_HTML_NO_EXPRESSION =
|
|
22
|
-
X_V_HTML_WITH_CHILDREN =
|
|
23
|
-
X_V_TEXT_NO_EXPRESSION =
|
|
24
|
-
X_V_TEXT_WITH_CHILDREN =
|
|
25
|
-
X_V_MODEL_ON_INVALID_ELEMENT =
|
|
26
|
-
X_V_MODEL_ARG_ON_ELEMENT =
|
|
27
|
-
X_V_MODEL_ON_FILE_INPUT_ELEMENT =
|
|
28
|
-
X_V_MODEL_UNNECESSARY_VALUE =
|
|
29
|
-
X_V_SHOW_NO_EXPRESSION =
|
|
30
|
-
X_TRANSITION_INVALID_CHILDREN =
|
|
31
|
-
X_IGNORED_SIDE_EFFECT_TAG =
|
|
32
|
-
__EXTEND_POINT__ =
|
|
21
|
+
X_V_HTML_NO_EXPRESSION = 51,
|
|
22
|
+
X_V_HTML_WITH_CHILDREN = 52,
|
|
23
|
+
X_V_TEXT_NO_EXPRESSION = 53,
|
|
24
|
+
X_V_TEXT_WITH_CHILDREN = 54,
|
|
25
|
+
X_V_MODEL_ON_INVALID_ELEMENT = 55,
|
|
26
|
+
X_V_MODEL_ARG_ON_ELEMENT = 56,
|
|
27
|
+
X_V_MODEL_ON_FILE_INPUT_ELEMENT = 57,
|
|
28
|
+
X_V_MODEL_UNNECESSARY_VALUE = 58,
|
|
29
|
+
X_V_SHOW_NO_EXPRESSION = 59,
|
|
30
|
+
X_TRANSITION_INVALID_CHILDREN = 60,
|
|
31
|
+
X_IGNORED_SIDE_EFFECT_TAG = 61,
|
|
32
|
+
__EXTEND_POINT__ = 62
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export declare const DOMNodeTransforms: NodeTransform[];
|
|
@@ -259,15 +259,16 @@ const errorMessages = {
|
|
|
259
259
|
[41 /* ErrorCodes.X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
|
|
260
260
|
[42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
|
|
261
261
|
[43 /* ErrorCodes.X_V_MODEL_ON_SCOPE_VARIABLE */]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
262
|
-
[44 /* ErrorCodes.
|
|
263
|
-
[45 /* ErrorCodes.
|
|
262
|
+
[44 /* ErrorCodes.X_V_MODEL_ON_PROPS */]: `v-model cannot be used on a prop, because local prop bindings are not writable.\nUse a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
263
|
+
[45 /* ErrorCodes.X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
|
|
264
|
+
[46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
|
|
264
265
|
// generic errors
|
|
265
|
-
[
|
|
266
|
-
[
|
|
267
|
-
[
|
|
268
|
-
[
|
|
266
|
+
[47 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
267
|
+
[48 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
|
|
268
|
+
[49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
269
|
+
[50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
|
|
269
270
|
// just to fulfill types
|
|
270
|
-
[
|
|
271
|
+
[51 /* ErrorCodes.__EXTEND_POINT__ */]: ``
|
|
271
272
|
};
|
|
272
273
|
|
|
273
274
|
const FRAGMENT = Symbol(`Fragment` );
|
|
@@ -3081,7 +3082,7 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
|
|
|
3081
3082
|
if (keywordMatch) {
|
|
3082
3083
|
message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
|
|
3083
3084
|
}
|
|
3084
|
-
context.onError(createCompilerError(
|
|
3085
|
+
context.onError(createCompilerError(45 /* ErrorCodes.X_INVALID_EXPRESSION */, node.loc, undefined, message));
|
|
3085
3086
|
}
|
|
3086
3087
|
}
|
|
3087
3088
|
|
|
@@ -3910,7 +3911,7 @@ const transformElement = (node, context) => {
|
|
|
3910
3911
|
// 2. Force keep-alive to always be updated, since it uses raw children.
|
|
3911
3912
|
patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
3912
3913
|
if (node.children.length > 1) {
|
|
3913
|
-
context.onError(createCompilerError(
|
|
3914
|
+
context.onError(createCompilerError(46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */, {
|
|
3914
3915
|
start: node.children[0].loc.start,
|
|
3915
3916
|
end: node.children[node.children.length - 1].loc.end,
|
|
3916
3917
|
source: ''
|
|
@@ -4765,8 +4766,14 @@ const transformModel = (dir, node, context) => {
|
|
|
4765
4766
|
const expString = exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ ? exp.content : rawExp;
|
|
4766
4767
|
// im SFC <script setup> inline mode, the exp may have been transformed into
|
|
4767
4768
|
// _unref(exp)
|
|
4768
|
-
context.bindingMetadata[rawExp];
|
|
4769
|
-
|
|
4769
|
+
const bindingType = context.bindingMetadata[rawExp];
|
|
4770
|
+
// check props
|
|
4771
|
+
if (bindingType === "props" /* BindingTypes.PROPS */ ||
|
|
4772
|
+
bindingType === "props-aliased" /* BindingTypes.PROPS_ALIASED */) {
|
|
4773
|
+
context.onError(createCompilerError(44 /* ErrorCodes.X_V_MODEL_ON_PROPS */, exp.loc));
|
|
4774
|
+
return createTransformProps();
|
|
4775
|
+
}
|
|
4776
|
+
const maybeRef = !true ;
|
|
4770
4777
|
if (!expString.trim() ||
|
|
4771
4778
|
(!isMemberExpression(expString) && !maybeRef)) {
|
|
4772
4779
|
context.onError(createCompilerError(42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
|
|
@@ -5033,18 +5040,18 @@ function baseCompile(template, options = {}) {
|
|
|
5033
5040
|
/* istanbul ignore if */
|
|
5034
5041
|
{
|
|
5035
5042
|
if (options.prefixIdentifiers === true) {
|
|
5036
|
-
onError(createCompilerError(
|
|
5043
|
+
onError(createCompilerError(47 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */));
|
|
5037
5044
|
}
|
|
5038
5045
|
else if (isModuleMode) {
|
|
5039
|
-
onError(createCompilerError(
|
|
5046
|
+
onError(createCompilerError(48 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */));
|
|
5040
5047
|
}
|
|
5041
5048
|
}
|
|
5042
5049
|
const prefixIdentifiers = !true ;
|
|
5043
5050
|
if (options.cacheHandlers) {
|
|
5044
|
-
onError(createCompilerError(
|
|
5051
|
+
onError(createCompilerError(49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */));
|
|
5045
5052
|
}
|
|
5046
5053
|
if (options.scopeId && !isModuleMode) {
|
|
5047
|
-
onError(createCompilerError(
|
|
5054
|
+
onError(createCompilerError(50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */));
|
|
5048
5055
|
}
|
|
5049
5056
|
const ast = isString(template) ? baseParse(template, options) : template;
|
|
5050
5057
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
|
|
@@ -5202,26 +5209,26 @@ function createDOMCompilerError(code, loc) {
|
|
|
5202
5209
|
return createCompilerError(code, loc, DOMErrorMessages );
|
|
5203
5210
|
}
|
|
5204
5211
|
const DOMErrorMessages = {
|
|
5205
|
-
[
|
|
5206
|
-
[
|
|
5207
|
-
[
|
|
5208
|
-
[
|
|
5209
|
-
[
|
|
5210
|
-
[
|
|
5211
|
-
[
|
|
5212
|
-
[
|
|
5213
|
-
[
|
|
5214
|
-
[
|
|
5215
|
-
[
|
|
5212
|
+
[51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
|
|
5213
|
+
[52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
|
|
5214
|
+
[53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
|
|
5215
|
+
[54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
|
|
5216
|
+
[55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
|
5217
|
+
[56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
|
|
5218
|
+
[57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
|
5219
|
+
[58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
|
5220
|
+
[59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
|
|
5221
|
+
[60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
|
|
5222
|
+
[61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
|
5216
5223
|
};
|
|
5217
5224
|
|
|
5218
5225
|
const transformVHtml = (dir, node, context) => {
|
|
5219
5226
|
const { exp, loc } = dir;
|
|
5220
5227
|
if (!exp) {
|
|
5221
|
-
context.onError(createDOMCompilerError(
|
|
5228
|
+
context.onError(createDOMCompilerError(51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */, loc));
|
|
5222
5229
|
}
|
|
5223
5230
|
if (node.children.length) {
|
|
5224
|
-
context.onError(createDOMCompilerError(
|
|
5231
|
+
context.onError(createDOMCompilerError(52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */, loc));
|
|
5225
5232
|
node.children.length = 0;
|
|
5226
5233
|
}
|
|
5227
5234
|
return {
|
|
@@ -5234,10 +5241,10 @@ const transformVHtml = (dir, node, context) => {
|
|
|
5234
5241
|
const transformVText = (dir, node, context) => {
|
|
5235
5242
|
const { exp, loc } = dir;
|
|
5236
5243
|
if (!exp) {
|
|
5237
|
-
context.onError(createDOMCompilerError(
|
|
5244
|
+
context.onError(createDOMCompilerError(53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */, loc));
|
|
5238
5245
|
}
|
|
5239
5246
|
if (node.children.length) {
|
|
5240
|
-
context.onError(createDOMCompilerError(
|
|
5247
|
+
context.onError(createDOMCompilerError(54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */, loc));
|
|
5241
5248
|
node.children.length = 0;
|
|
5242
5249
|
}
|
|
5243
5250
|
return {
|
|
@@ -5258,12 +5265,12 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
5258
5265
|
return baseResult;
|
|
5259
5266
|
}
|
|
5260
5267
|
if (dir.arg) {
|
|
5261
|
-
context.onError(createDOMCompilerError(
|
|
5268
|
+
context.onError(createDOMCompilerError(56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
|
|
5262
5269
|
}
|
|
5263
5270
|
function checkDuplicatedValue() {
|
|
5264
5271
|
const value = findProp(node, 'value');
|
|
5265
5272
|
if (value) {
|
|
5266
|
-
context.onError(createDOMCompilerError(
|
|
5273
|
+
context.onError(createDOMCompilerError(58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
|
|
5267
5274
|
}
|
|
5268
5275
|
}
|
|
5269
5276
|
const { tag } = node;
|
|
@@ -5291,7 +5298,7 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
5291
5298
|
break;
|
|
5292
5299
|
case 'file':
|
|
5293
5300
|
isInvalidType = true;
|
|
5294
|
-
context.onError(createDOMCompilerError(
|
|
5301
|
+
context.onError(createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
|
|
5295
5302
|
break;
|
|
5296
5303
|
default:
|
|
5297
5304
|
// text type
|
|
@@ -5325,7 +5332,7 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
5325
5332
|
}
|
|
5326
5333
|
}
|
|
5327
5334
|
else {
|
|
5328
|
-
context.onError(createDOMCompilerError(
|
|
5335
|
+
context.onError(createDOMCompilerError(55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
|
|
5329
5336
|
}
|
|
5330
5337
|
// native vmodel doesn't need the `modelValue` props since they are also
|
|
5331
5338
|
// passed to the runtime as `binding.value`. removing it reduces code size.
|
|
@@ -5449,7 +5456,7 @@ const transformOn$1 = (dir, node, context) => {
|
|
|
5449
5456
|
const transformShow = (dir, node, context) => {
|
|
5450
5457
|
const { exp, loc } = dir;
|
|
5451
5458
|
if (!exp) {
|
|
5452
|
-
context.onError(createDOMCompilerError(
|
|
5459
|
+
context.onError(createDOMCompilerError(59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */, loc));
|
|
5453
5460
|
}
|
|
5454
5461
|
return {
|
|
5455
5462
|
props: [],
|
|
@@ -5468,7 +5475,7 @@ const transformTransition = (node, context) => {
|
|
|
5468
5475
|
}
|
|
5469
5476
|
// warn multiple transition children
|
|
5470
5477
|
if (hasMultipleChildren(node)) {
|
|
5471
|
-
context.onError(createDOMCompilerError(
|
|
5478
|
+
context.onError(createDOMCompilerError(60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */, {
|
|
5472
5479
|
start: node.children[0].loc.start,
|
|
5473
5480
|
end: node.children[node.children.length - 1].loc.end,
|
|
5474
5481
|
source: ''
|
|
@@ -5507,7 +5514,7 @@ const ignoreSideEffectTags = (node, context) => {
|
|
|
5507
5514
|
if (node.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
5508
5515
|
node.tagType === 0 /* ElementTypes.ELEMENT */ &&
|
|
5509
5516
|
(node.tag === 'script' || node.tag === 'style')) {
|
|
5510
|
-
context.onError(createDOMCompilerError(
|
|
5517
|
+
context.onError(createDOMCompilerError(61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
|
|
5511
5518
|
context.removeNode();
|
|
5512
5519
|
}
|
|
5513
5520
|
};
|