@vue/compiler-dom 3.6.0-alpha.7 → 3.6.0-beta.10
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 +656 -848
- package/dist/compiler-dom.cjs.prod.js +631 -806
- package/dist/compiler-dom.d.ts +43 -35
- package/dist/compiler-dom.esm-browser.js +4505 -6227
- package/dist/compiler-dom.esm-browser.prod.js +10 -13
- package/dist/compiler-dom.esm-bundler.js +476 -631
- package/dist/compiler-dom.global.js +5169 -6893
- package/dist/compiler-dom.global.prod.js +10 -13
- package/package.json +3 -3
package/dist/compiler-dom.cjs.js
CHANGED
|
@@ -1,920 +1,723 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-dom v3.6.0-
|
|
3
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
-
* @license MIT
|
|
5
|
-
**/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var compilerCore = require('@vue/compiler-core');
|
|
11
|
-
var shared = require('@vue/shared');
|
|
12
|
-
|
|
13
|
-
const V_MODEL_RADIO = Symbol(`vModelRadio` );
|
|
14
|
-
const V_MODEL_CHECKBOX = Symbol(
|
|
15
|
-
`vModelCheckbox`
|
|
16
|
-
);
|
|
17
|
-
const V_MODEL_TEXT = Symbol(`vModelText` );
|
|
18
|
-
const V_MODEL_SELECT = Symbol(
|
|
19
|
-
`vModelSelect`
|
|
20
|
-
);
|
|
21
|
-
const V_MODEL_DYNAMIC = Symbol(
|
|
22
|
-
`vModelDynamic`
|
|
23
|
-
);
|
|
24
|
-
const V_ON_WITH_MODIFIERS = Symbol(
|
|
25
|
-
`vOnModifiersGuard`
|
|
26
|
-
);
|
|
27
|
-
const V_ON_WITH_KEYS = Symbol(
|
|
28
|
-
`vOnKeysGuard`
|
|
29
|
-
);
|
|
30
|
-
const V_SHOW = Symbol(`vShow` );
|
|
31
|
-
const TRANSITION = Symbol(`Transition` );
|
|
32
|
-
const TRANSITION_GROUP = Symbol(
|
|
33
|
-
`TransitionGroup`
|
|
34
|
-
);
|
|
35
|
-
compilerCore.registerRuntimeHelpers({
|
|
36
|
-
[V_MODEL_RADIO]: `vModelRadio`,
|
|
37
|
-
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
|
|
38
|
-
[V_MODEL_TEXT]: `vModelText`,
|
|
39
|
-
[V_MODEL_SELECT]: `vModelSelect`,
|
|
40
|
-
[V_MODEL_DYNAMIC]: `vModelDynamic`,
|
|
41
|
-
[V_ON_WITH_MODIFIERS]: `withModifiers`,
|
|
42
|
-
[V_ON_WITH_KEYS]: `withKeys`,
|
|
43
|
-
[V_SHOW]: `vShow`,
|
|
44
|
-
[TRANSITION]: `Transition`,
|
|
45
|
-
[TRANSITION_GROUP]: `TransitionGroup`
|
|
2
|
+
* @vue/compiler-dom v3.6.0-beta.10
|
|
3
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
+
* @license MIT
|
|
5
|
+
**/
|
|
6
|
+
Object.defineProperties(exports, {
|
|
7
|
+
__esModule: { value: true },
|
|
8
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
46
9
|
});
|
|
47
|
-
|
|
10
|
+
let _vue_compiler_core = require("@vue/compiler-core");
|
|
11
|
+
let _vue_shared = require("@vue/shared");
|
|
12
|
+
//#region packages/compiler-dom/src/runtimeHelpers.ts
|
|
13
|
+
const V_MODEL_RADIO = Symbol(`vModelRadio`);
|
|
14
|
+
const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox`);
|
|
15
|
+
const V_MODEL_TEXT = Symbol(`vModelText`);
|
|
16
|
+
const V_MODEL_SELECT = Symbol(`vModelSelect`);
|
|
17
|
+
const V_MODEL_DYNAMIC = Symbol(`vModelDynamic`);
|
|
18
|
+
const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard`);
|
|
19
|
+
const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard`);
|
|
20
|
+
const V_SHOW = Symbol(`vShow`);
|
|
21
|
+
const TRANSITION = Symbol(`Transition`);
|
|
22
|
+
const TRANSITION_GROUP = Symbol(`TransitionGroup`);
|
|
23
|
+
(0, _vue_compiler_core.registerRuntimeHelpers)({
|
|
24
|
+
[V_MODEL_RADIO]: `vModelRadio`,
|
|
25
|
+
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
|
|
26
|
+
[V_MODEL_TEXT]: `vModelText`,
|
|
27
|
+
[V_MODEL_SELECT]: `vModelSelect`,
|
|
28
|
+
[V_MODEL_DYNAMIC]: `vModelDynamic`,
|
|
29
|
+
[V_ON_WITH_MODIFIERS]: `withModifiers`,
|
|
30
|
+
[V_ON_WITH_KEYS]: `withKeys`,
|
|
31
|
+
[V_SHOW]: `vShow`,
|
|
32
|
+
[TRANSITION]: `Transition`,
|
|
33
|
+
[TRANSITION_GROUP]: `TransitionGroup`
|
|
34
|
+
});
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region packages/compiler-dom/src/parserOptions.ts
|
|
48
37
|
const parserOptions = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
} else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
|
|
76
|
-
ns = 0;
|
|
77
|
-
}
|
|
78
|
-
} else if (parent && ns === 1) {
|
|
79
|
-
if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
|
|
80
|
-
ns = 0;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (ns === 0) {
|
|
84
|
-
if (shared.isSVGTag(tag)) {
|
|
85
|
-
return 1;
|
|
86
|
-
}
|
|
87
|
-
if (shared.isMathMLTag(tag)) {
|
|
88
|
-
return 2;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return ns;
|
|
92
|
-
}
|
|
38
|
+
parseMode: "html",
|
|
39
|
+
isVoidTag: _vue_shared.isVoidTag,
|
|
40
|
+
isNativeTag: (tag) => (0, _vue_shared.isHTMLTag)(tag) || (0, _vue_shared.isSVGTag)(tag) || (0, _vue_shared.isMathMLTag)(tag),
|
|
41
|
+
isPreTag: (tag) => tag === "pre",
|
|
42
|
+
isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
|
|
43
|
+
decodeEntities: void 0,
|
|
44
|
+
isBuiltInComponent: (tag) => {
|
|
45
|
+
if (tag === "Transition" || tag === "transition") return TRANSITION;
|
|
46
|
+
else if (tag === "TransitionGroup" || tag === "transition-group") return TRANSITION_GROUP;
|
|
47
|
+
},
|
|
48
|
+
getNamespace(tag, parent, rootNamespace) {
|
|
49
|
+
let ns = parent ? parent.ns : rootNamespace;
|
|
50
|
+
if (parent && ns === 2) {
|
|
51
|
+
if (parent.tag === "annotation-xml") {
|
|
52
|
+
if ((0, _vue_shared.isSVGTag)(tag)) return 1;
|
|
53
|
+
if (parent.props.some((a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml"))) ns = 0;
|
|
54
|
+
} else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") ns = 0;
|
|
55
|
+
} else if (parent && ns === 1) {
|
|
56
|
+
if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") ns = 0;
|
|
57
|
+
}
|
|
58
|
+
if (ns === 0) {
|
|
59
|
+
if ((0, _vue_shared.isSVGTag)(tag)) return 1;
|
|
60
|
+
if ((0, _vue_shared.isMathMLTag)(tag)) return 2;
|
|
61
|
+
}
|
|
62
|
+
return ns;
|
|
63
|
+
}
|
|
93
64
|
};
|
|
94
|
-
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region packages/compiler-dom/src/transforms/transformStyle.ts
|
|
95
67
|
const transformStyle = (node) => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}
|
|
68
|
+
if (node.type === 1) node.props.forEach((p, i) => {
|
|
69
|
+
if (p.type === 6 && p.name === "style" && p.value) node.props[i] = {
|
|
70
|
+
type: 7,
|
|
71
|
+
name: `bind`,
|
|
72
|
+
arg: (0, _vue_compiler_core.createSimpleExpression)(`style`, true, p.loc),
|
|
73
|
+
exp: parseInlineCSS(p.value.content, p.loc),
|
|
74
|
+
modifiers: [],
|
|
75
|
+
loc: p.loc
|
|
76
|
+
};
|
|
77
|
+
});
|
|
110
78
|
};
|
|
111
79
|
const parseInlineCSS = (cssText, loc) => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
JSON.stringify(normalized),
|
|
115
|
-
false,
|
|
116
|
-
loc,
|
|
117
|
-
3
|
|
118
|
-
);
|
|
80
|
+
const normalized = (0, _vue_shared.parseStringStyle)(cssText);
|
|
81
|
+
return (0, _vue_compiler_core.createSimpleExpression)(JSON.stringify(normalized), false, loc, 3);
|
|
119
82
|
};
|
|
120
|
-
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region packages/compiler-dom/src/errors.ts
|
|
121
85
|
function createDOMCompilerError(code, loc) {
|
|
122
|
-
|
|
123
|
-
code,
|
|
124
|
-
loc,
|
|
125
|
-
DOMErrorMessages
|
|
126
|
-
);
|
|
86
|
+
return (0, _vue_compiler_core.createCompilerError)(code, loc, DOMErrorMessages);
|
|
127
87
|
}
|
|
128
88
|
const DOMErrorCodes = {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
89
|
+
"X_V_HTML_NO_EXPRESSION": 54,
|
|
90
|
+
"54": "X_V_HTML_NO_EXPRESSION",
|
|
91
|
+
"X_V_HTML_WITH_CHILDREN": 55,
|
|
92
|
+
"55": "X_V_HTML_WITH_CHILDREN",
|
|
93
|
+
"X_V_TEXT_NO_EXPRESSION": 56,
|
|
94
|
+
"56": "X_V_TEXT_NO_EXPRESSION",
|
|
95
|
+
"X_V_TEXT_WITH_CHILDREN": 57,
|
|
96
|
+
"57": "X_V_TEXT_WITH_CHILDREN",
|
|
97
|
+
"X_V_MODEL_ON_INVALID_ELEMENT": 58,
|
|
98
|
+
"58": "X_V_MODEL_ON_INVALID_ELEMENT",
|
|
99
|
+
"X_V_MODEL_ARG_ON_ELEMENT": 59,
|
|
100
|
+
"59": "X_V_MODEL_ARG_ON_ELEMENT",
|
|
101
|
+
"X_V_MODEL_ON_FILE_INPUT_ELEMENT": 60,
|
|
102
|
+
"60": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
|
|
103
|
+
"X_V_MODEL_UNNECESSARY_VALUE": 61,
|
|
104
|
+
"61": "X_V_MODEL_UNNECESSARY_VALUE",
|
|
105
|
+
"X_V_SHOW_NO_EXPRESSION": 62,
|
|
106
|
+
"62": "X_V_SHOW_NO_EXPRESSION",
|
|
107
|
+
"X_TRANSITION_INVALID_CHILDREN": 63,
|
|
108
|
+
"63": "X_TRANSITION_INVALID_CHILDREN",
|
|
109
|
+
"X_IGNORED_SIDE_EFFECT_TAG": 64,
|
|
110
|
+
"64": "X_IGNORED_SIDE_EFFECT_TAG",
|
|
111
|
+
"__EXTEND_POINT__": 65,
|
|
112
|
+
"65": "__EXTEND_POINT__"
|
|
153
113
|
};
|
|
154
114
|
const DOMErrorMessages = {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
[64]: ``
|
|
115
|
+
[54]: `v-html is missing expression.`,
|
|
116
|
+
[55]: `v-html will override element children.`,
|
|
117
|
+
[56]: `v-text is missing expression.`,
|
|
118
|
+
[57]: `v-text will override element children.`,
|
|
119
|
+
[58]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
|
120
|
+
[59]: `v-model argument is not supported on plain elements.`,
|
|
121
|
+
[60]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
|
122
|
+
[61]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
|
123
|
+
[62]: `v-show is missing expression.`,
|
|
124
|
+
[63]: `<Transition> expects exactly one child element or component.`,
|
|
125
|
+
[64]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
|
|
126
|
+
[65]: ``
|
|
168
127
|
};
|
|
169
|
-
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region packages/compiler-dom/src/transforms/vHtml.ts
|
|
170
130
|
const transformVHtml = (dir, node, context) => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
context.onError(
|
|
179
|
-
createDOMCompilerError(54, loc)
|
|
180
|
-
);
|
|
181
|
-
node.children.length = 0;
|
|
182
|
-
}
|
|
183
|
-
return {
|
|
184
|
-
props: [
|
|
185
|
-
compilerCore.createObjectProperty(
|
|
186
|
-
compilerCore.createSimpleExpression(`innerHTML`, true, loc),
|
|
187
|
-
exp || compilerCore.createSimpleExpression("", true)
|
|
188
|
-
)
|
|
189
|
-
]
|
|
190
|
-
};
|
|
131
|
+
const { exp, loc } = dir;
|
|
132
|
+
if (!exp) context.onError(createDOMCompilerError(54, loc));
|
|
133
|
+
if (node.children.length) {
|
|
134
|
+
context.onError(createDOMCompilerError(55, loc));
|
|
135
|
+
node.children.length = 0;
|
|
136
|
+
}
|
|
137
|
+
return { props: [(0, _vue_compiler_core.createObjectProperty)((0, _vue_compiler_core.createSimpleExpression)(`innerHTML`, true, loc), exp || (0, _vue_compiler_core.createSimpleExpression)("", true))] };
|
|
191
138
|
};
|
|
192
|
-
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region packages/compiler-dom/src/transforms/vText.ts
|
|
193
141
|
const transformVText = (dir, node, context) => {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
context.onError(
|
|
202
|
-
createDOMCompilerError(56, loc)
|
|
203
|
-
);
|
|
204
|
-
node.children.length = 0;
|
|
205
|
-
}
|
|
206
|
-
return {
|
|
207
|
-
props: [
|
|
208
|
-
compilerCore.createObjectProperty(
|
|
209
|
-
compilerCore.createSimpleExpression(`textContent`, true),
|
|
210
|
-
exp ? compilerCore.getConstantType(exp, context) > 0 ? exp : compilerCore.createCallExpression(
|
|
211
|
-
context.helperString(compilerCore.TO_DISPLAY_STRING),
|
|
212
|
-
[exp],
|
|
213
|
-
loc
|
|
214
|
-
) : compilerCore.createSimpleExpression("", true)
|
|
215
|
-
)
|
|
216
|
-
]
|
|
217
|
-
};
|
|
142
|
+
const { exp, loc } = dir;
|
|
143
|
+
if (!exp) context.onError(createDOMCompilerError(56, loc));
|
|
144
|
+
if (node.children.length) {
|
|
145
|
+
context.onError(createDOMCompilerError(57, loc));
|
|
146
|
+
node.children.length = 0;
|
|
147
|
+
}
|
|
148
|
+
return { props: [(0, _vue_compiler_core.createObjectProperty)((0, _vue_compiler_core.createSimpleExpression)(`textContent`, true), exp ? (0, _vue_compiler_core.getConstantType)(exp, context) > 0 ? exp : (0, _vue_compiler_core.createCallExpression)(context.helperString(_vue_compiler_core.TO_DISPLAY_STRING), [exp], loc) : (0, _vue_compiler_core.createSimpleExpression)("", true))] };
|
|
218
149
|
};
|
|
219
|
-
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region packages/compiler-dom/src/transforms/vModel.ts
|
|
220
152
|
const transformModel = (dir, node, context) => {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
directiveToUse = V_MODEL_CHECKBOX;
|
|
261
|
-
break;
|
|
262
|
-
case "file":
|
|
263
|
-
isInvalidType = true;
|
|
264
|
-
context.onError(
|
|
265
|
-
createDOMCompilerError(
|
|
266
|
-
59,
|
|
267
|
-
dir.loc
|
|
268
|
-
)
|
|
269
|
-
);
|
|
270
|
-
break;
|
|
271
|
-
default:
|
|
272
|
-
checkDuplicatedValue();
|
|
273
|
-
break;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
} else if (compilerCore.hasDynamicKeyVBind(node)) {
|
|
277
|
-
directiveToUse = V_MODEL_DYNAMIC;
|
|
278
|
-
} else {
|
|
279
|
-
checkDuplicatedValue();
|
|
280
|
-
}
|
|
281
|
-
} else if (tag === "select") {
|
|
282
|
-
directiveToUse = V_MODEL_SELECT;
|
|
283
|
-
} else {
|
|
284
|
-
checkDuplicatedValue();
|
|
285
|
-
}
|
|
286
|
-
if (!isInvalidType) {
|
|
287
|
-
baseResult.needRuntime = context.helper(directiveToUse);
|
|
288
|
-
}
|
|
289
|
-
} else {
|
|
290
|
-
context.onError(
|
|
291
|
-
createDOMCompilerError(
|
|
292
|
-
57,
|
|
293
|
-
dir.loc
|
|
294
|
-
)
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
baseResult.props = baseResult.props.filter(
|
|
298
|
-
(p) => !(p.key.type === 4 && p.key.content === "modelValue")
|
|
299
|
-
);
|
|
300
|
-
return baseResult;
|
|
153
|
+
const baseResult = (0, _vue_compiler_core.transformModel)(dir, node, context);
|
|
154
|
+
if (!baseResult.props.length || node.tagType === 1) return baseResult;
|
|
155
|
+
if (dir.arg) context.onError(createDOMCompilerError(59, dir.arg.loc));
|
|
156
|
+
function checkDuplicatedValue() {
|
|
157
|
+
const value = (0, _vue_compiler_core.findDir)(node, "bind");
|
|
158
|
+
if (value && (0, _vue_compiler_core.isStaticArgOf)(value.arg, "value")) context.onError(createDOMCompilerError(61, value.loc));
|
|
159
|
+
}
|
|
160
|
+
const { tag } = node;
|
|
161
|
+
const isCustomElement = context.isCustomElement(tag);
|
|
162
|
+
if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
|
|
163
|
+
let directiveToUse = V_MODEL_TEXT;
|
|
164
|
+
let isInvalidType = false;
|
|
165
|
+
if (tag === "input" || isCustomElement) {
|
|
166
|
+
const type = (0, _vue_compiler_core.findProp)(node, `type`);
|
|
167
|
+
if (type) {
|
|
168
|
+
if (type.type === 7) directiveToUse = V_MODEL_DYNAMIC;
|
|
169
|
+
else if (type.value) switch (type.value.content) {
|
|
170
|
+
case "radio":
|
|
171
|
+
directiveToUse = V_MODEL_RADIO;
|
|
172
|
+
break;
|
|
173
|
+
case "checkbox":
|
|
174
|
+
directiveToUse = V_MODEL_CHECKBOX;
|
|
175
|
+
break;
|
|
176
|
+
case "file":
|
|
177
|
+
isInvalidType = true;
|
|
178
|
+
context.onError(createDOMCompilerError(60, dir.loc));
|
|
179
|
+
break;
|
|
180
|
+
default:
|
|
181
|
+
checkDuplicatedValue();
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
} else if ((0, _vue_compiler_core.hasDynamicKeyVBind)(node)) directiveToUse = V_MODEL_DYNAMIC;
|
|
185
|
+
else checkDuplicatedValue();
|
|
186
|
+
} else if (tag === "select") directiveToUse = V_MODEL_SELECT;
|
|
187
|
+
else checkDuplicatedValue();
|
|
188
|
+
if (!isInvalidType) baseResult.needRuntime = context.helper(directiveToUse);
|
|
189
|
+
} else context.onError(createDOMCompilerError(58, dir.loc));
|
|
190
|
+
baseResult.props = baseResult.props.filter((p) => !(p.key.type === 4 && p.key.content === "modelValue"));
|
|
191
|
+
return baseResult;
|
|
301
192
|
};
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
);
|
|
308
|
-
const maybeKeyModifier = /* @__PURE__ */ shared.makeMap("left,right");
|
|
309
|
-
const isKeyboardEvent = /* @__PURE__ */ shared.makeMap(
|
|
310
|
-
`onkeyup,onkeydown,onkeypress`
|
|
311
|
-
);
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region packages/compiler-dom/src/transforms/vOn.ts
|
|
195
|
+
const isEventOptionModifier = /* @__PURE__ */ (0, _vue_shared.makeMap)(`passive,once,capture`);
|
|
196
|
+
const isNonKeyModifier = /* @__PURE__ */ (0, _vue_shared.makeMap)("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
|
|
197
|
+
const maybeKeyModifier = /* @__PURE__ */ (0, _vue_shared.makeMap)("left,right");
|
|
198
|
+
const isKeyboardEvent = /* @__PURE__ */ (0, _vue_shared.makeMap)(`onkeyup,onkeydown,onkeypress`);
|
|
312
199
|
const resolveModifiers = (key, modifiers, context, loc) => {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
nonKeyModifiers.push(modifier);
|
|
338
|
-
}
|
|
339
|
-
} else {
|
|
340
|
-
if (isNonKeyModifier(modifier)) {
|
|
341
|
-
nonKeyModifiers.push(modifier);
|
|
342
|
-
} else {
|
|
343
|
-
keyModifiers.push(modifier);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return {
|
|
349
|
-
keyModifiers,
|
|
350
|
-
nonKeyModifiers,
|
|
351
|
-
eventOptionModifiers
|
|
352
|
-
};
|
|
200
|
+
const keyModifiers = [];
|
|
201
|
+
const nonKeyModifiers = [];
|
|
202
|
+
const eventOptionModifiers = [];
|
|
203
|
+
for (let i = 0; i < modifiers.length; i++) {
|
|
204
|
+
const modifier = modifiers[i].content;
|
|
205
|
+
if (modifier === "native" && context && (0, _vue_compiler_core.checkCompatEnabled)("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
|
|
206
|
+
else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
|
|
207
|
+
else {
|
|
208
|
+
const keyString = (0, _vue_shared.isString)(key) ? key : (0, _vue_compiler_core.isStaticExp)(key) ? key.content : null;
|
|
209
|
+
if (maybeKeyModifier(modifier)) if (keyString) if (isKeyboardEvent(keyString.toLowerCase())) keyModifiers.push(modifier);
|
|
210
|
+
else nonKeyModifiers.push(modifier);
|
|
211
|
+
else {
|
|
212
|
+
keyModifiers.push(modifier);
|
|
213
|
+
nonKeyModifiers.push(modifier);
|
|
214
|
+
}
|
|
215
|
+
else if (isNonKeyModifier(modifier)) nonKeyModifiers.push(modifier);
|
|
216
|
+
else keyModifiers.push(modifier);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
keyModifiers,
|
|
221
|
+
nonKeyModifiers,
|
|
222
|
+
eventOptionModifiers
|
|
223
|
+
};
|
|
353
224
|
};
|
|
354
225
|
const transformClick = (key, event) => {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
]) : key;
|
|
226
|
+
return (0, _vue_compiler_core.isStaticExp)(key) && key.content.toLowerCase() === "onclick" ? (0, _vue_compiler_core.createSimpleExpression)(event, true) : key.type !== 4 ? (0, _vue_compiler_core.createCompoundExpression)([
|
|
227
|
+
`(`,
|
|
228
|
+
key,
|
|
229
|
+
`) === "onClick" ? "${event}" : (`,
|
|
230
|
+
key,
|
|
231
|
+
`)`
|
|
232
|
+
]) : key;
|
|
363
233
|
};
|
|
364
234
|
const transformOn = (dir, node, context) => {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_KEYS), [
|
|
385
|
-
handlerExp,
|
|
386
|
-
JSON.stringify(keyModifiers)
|
|
387
|
-
]);
|
|
388
|
-
}
|
|
389
|
-
if (eventOptionModifiers.length) {
|
|
390
|
-
const modifierPostfix = eventOptionModifiers.map(shared.capitalize).join("");
|
|
391
|
-
key = compilerCore.isStaticExp(key) ? compilerCore.createSimpleExpression(`${key.content}${modifierPostfix}`, true) : compilerCore.createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
|
|
392
|
-
}
|
|
393
|
-
return {
|
|
394
|
-
props: [compilerCore.createObjectProperty(key, handlerExp)]
|
|
395
|
-
};
|
|
396
|
-
});
|
|
235
|
+
return (0, _vue_compiler_core.transformOn)(dir, node, context, (baseResult) => {
|
|
236
|
+
const { modifiers } = dir;
|
|
237
|
+
if (!modifiers.length) return baseResult;
|
|
238
|
+
let { key, value: handlerExp } = baseResult.props[0];
|
|
239
|
+
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
|
|
240
|
+
if (nonKeyModifiers.includes("right")) key = transformClick(key, `onContextmenu`);
|
|
241
|
+
if (nonKeyModifiers.includes("middle")) key = transformClick(key, `onMouseup`);
|
|
242
|
+
if (nonKeyModifiers.length) handlerExp = (0, _vue_compiler_core.createCallExpression)(context.helper(V_ON_WITH_MODIFIERS), [handlerExp, JSON.stringify(nonKeyModifiers)]);
|
|
243
|
+
if (keyModifiers.length && (!(0, _vue_compiler_core.isStaticExp)(key) || isKeyboardEvent(key.content.toLowerCase()))) handlerExp = (0, _vue_compiler_core.createCallExpression)(context.helper(V_ON_WITH_KEYS), [handlerExp, JSON.stringify(keyModifiers)]);
|
|
244
|
+
if (eventOptionModifiers.length) {
|
|
245
|
+
const modifierPostfix = eventOptionModifiers.map(_vue_shared.capitalize).join("");
|
|
246
|
+
key = (0, _vue_compiler_core.isStaticExp)(key) ? (0, _vue_compiler_core.createSimpleExpression)(`${key.content}${modifierPostfix}`, true) : (0, _vue_compiler_core.createCompoundExpression)([
|
|
247
|
+
`(`,
|
|
248
|
+
key,
|
|
249
|
+
`) + "${modifierPostfix}"`
|
|
250
|
+
]);
|
|
251
|
+
}
|
|
252
|
+
return { props: [(0, _vue_compiler_core.createObjectProperty)(key, handlerExp)] };
|
|
253
|
+
});
|
|
397
254
|
};
|
|
398
|
-
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region packages/compiler-dom/src/transforms/vShow.ts
|
|
399
257
|
const transformShow = (dir, node, context) => {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
return {
|
|
407
|
-
props: [],
|
|
408
|
-
needRuntime: context.helper(V_SHOW)
|
|
409
|
-
};
|
|
258
|
+
const { exp, loc } = dir;
|
|
259
|
+
if (!exp) context.onError(createDOMCompilerError(62, loc));
|
|
260
|
+
return {
|
|
261
|
+
props: [],
|
|
262
|
+
needRuntime: context.helper(V_SHOW)
|
|
263
|
+
};
|
|
410
264
|
};
|
|
411
|
-
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region packages/compiler-dom/src/transforms/Transition.ts
|
|
412
267
|
const transformTransition = (node, context) => {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
return postTransformTransition(node, context.onError);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
268
|
+
if (node.type === 1 && node.tagType === 1) {
|
|
269
|
+
if (context.isBuiltInComponent(node.tag) === TRANSITION) return postTransformTransition(node, context.onError);
|
|
270
|
+
}
|
|
419
271
|
};
|
|
420
272
|
function postTransformTransition(node, onError, hasMultipleChildren = defaultHasMultipleChildren) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
type: 6,
|
|
440
|
-
name: "persisted",
|
|
441
|
-
nameLoc: node.loc,
|
|
442
|
-
value: void 0,
|
|
443
|
-
loc: node.loc
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
};
|
|
273
|
+
return () => {
|
|
274
|
+
if (!node.children.length) return;
|
|
275
|
+
if (hasMultipleChildren(node)) onError(createDOMCompilerError(63, {
|
|
276
|
+
start: node.children[0].loc.start,
|
|
277
|
+
end: node.children[node.children.length - 1].loc.end,
|
|
278
|
+
source: ""
|
|
279
|
+
}));
|
|
280
|
+
const child = node.children[0];
|
|
281
|
+
if (child.type === 1) {
|
|
282
|
+
for (const p of child.props) if (p.type === 7 && p.name === "show") node.props.push({
|
|
283
|
+
type: 6,
|
|
284
|
+
name: "persisted",
|
|
285
|
+
nameLoc: node.loc,
|
|
286
|
+
value: void 0,
|
|
287
|
+
loc: node.loc
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
};
|
|
449
291
|
}
|
|
450
292
|
function defaultHasMultipleChildren(node) {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
const child = children[0];
|
|
455
|
-
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
|
|
293
|
+
const children = node.children = node.children.filter((c) => !(0, _vue_compiler_core.isCommentOrWhitespace)(c));
|
|
294
|
+
const child = children[0];
|
|
295
|
+
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
|
|
456
296
|
}
|
|
457
|
-
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region packages/compiler-dom/src/transforms/stringifyStatic.ts
|
|
299
|
+
/**
|
|
300
|
+
* This module is Node-only.
|
|
301
|
+
*/
|
|
302
|
+
/**
|
|
303
|
+
* Regex for replacing placeholders for embedded constant variables
|
|
304
|
+
* (e.g. import URL string constants generated by compiler-sfc)
|
|
305
|
+
*/
|
|
458
306
|
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
|
|
307
|
+
/**
|
|
308
|
+
* Turn eligible hoisted static trees into stringified static nodes, e.g.
|
|
309
|
+
*
|
|
310
|
+
* ```js
|
|
311
|
+
* const _hoisted_1 = createStaticVNode(`<div class="foo">bar</div>`)
|
|
312
|
+
* ```
|
|
313
|
+
*
|
|
314
|
+
* A single static vnode can contain stringified content for **multiple**
|
|
315
|
+
* consecutive nodes (element and plain text), called a "chunk".
|
|
316
|
+
* `@vue/runtime-dom` will create the content via innerHTML in a hidden
|
|
317
|
+
* container element and insert all the nodes in place. The call must also
|
|
318
|
+
* provide the number of nodes contained in the chunk so that during hydration
|
|
319
|
+
* we can know how many nodes the static vnode should adopt.
|
|
320
|
+
*
|
|
321
|
+
* The optimization scans a children list that contains hoisted nodes, and
|
|
322
|
+
* tries to find the largest chunk of consecutive hoisted nodes before running
|
|
323
|
+
* into a non-hoisted node or the end of the list. A chunk is then converted
|
|
324
|
+
* into a single static vnode and replaces the hoisted expression of the first
|
|
325
|
+
* node in the chunk. Other nodes in the chunk are considered "merged" and
|
|
326
|
+
* therefore removed from both the hoist list and the children array.
|
|
327
|
+
*
|
|
328
|
+
* This optimization is only performed in Node.js.
|
|
329
|
+
*/
|
|
459
330
|
const stringifyStatic = (children, context, parent) => {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
for (; i < children.length; i++) {
|
|
507
|
-
const child = children[i];
|
|
508
|
-
const isCached = isParentCached || getCachedNode(child);
|
|
509
|
-
if (isCached) {
|
|
510
|
-
const result = analyzeNode(child);
|
|
511
|
-
if (result) {
|
|
512
|
-
nc += result[0];
|
|
513
|
-
ec += result[1];
|
|
514
|
-
currentChunk.push(child);
|
|
515
|
-
continue;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
i -= stringifyCurrentChunk(i);
|
|
519
|
-
nc = 0;
|
|
520
|
-
ec = 0;
|
|
521
|
-
currentChunk.length = 0;
|
|
522
|
-
}
|
|
523
|
-
stringifyCurrentChunk(i);
|
|
331
|
+
if (context.scopes.vSlot > 0) return;
|
|
332
|
+
const isParentCached = parent.type === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !(0, _vue_shared.isArray)(parent.codegenNode.children) && parent.codegenNode.children.type === 20;
|
|
333
|
+
let nc = 0;
|
|
334
|
+
let ec = 0;
|
|
335
|
+
const currentChunk = [];
|
|
336
|
+
const stringifyCurrentChunk = (currentIndex) => {
|
|
337
|
+
if (nc >= 20 || ec >= 5) {
|
|
338
|
+
const staticCall = (0, _vue_compiler_core.createCallExpression)(context.helper(_vue_compiler_core.CREATE_STATIC), [JSON.stringify(currentChunk.map((node) => stringifyNode(node, context)).join("")).replace(expReplaceRE, `" + $1 + "`), String(currentChunk.length)]);
|
|
339
|
+
const deleteCount = currentChunk.length - 1;
|
|
340
|
+
if (isParentCached) children.splice(currentIndex - currentChunk.length, currentChunk.length, staticCall);
|
|
341
|
+
else {
|
|
342
|
+
currentChunk[0].codegenNode.value = staticCall;
|
|
343
|
+
if (currentChunk.length > 1) {
|
|
344
|
+
children.splice(currentIndex - currentChunk.length + 1, deleteCount);
|
|
345
|
+
const cacheIndex = context.cached.indexOf(currentChunk[currentChunk.length - 1].codegenNode);
|
|
346
|
+
if (cacheIndex > -1) {
|
|
347
|
+
for (let i = cacheIndex; i < context.cached.length; i++) {
|
|
348
|
+
const c = context.cached[i];
|
|
349
|
+
if (c) c.index -= deleteCount;
|
|
350
|
+
}
|
|
351
|
+
context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return deleteCount;
|
|
356
|
+
}
|
|
357
|
+
return 0;
|
|
358
|
+
};
|
|
359
|
+
let i = 0;
|
|
360
|
+
for (; i < children.length; i++) {
|
|
361
|
+
const child = children[i];
|
|
362
|
+
if (isParentCached || getCachedNode(child)) {
|
|
363
|
+
const result = analyzeNode(child);
|
|
364
|
+
if (result) {
|
|
365
|
+
nc += result[0];
|
|
366
|
+
ec += result[1];
|
|
367
|
+
currentChunk.push(child);
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
i -= stringifyCurrentChunk(i);
|
|
372
|
+
nc = 0;
|
|
373
|
+
ec = 0;
|
|
374
|
+
currentChunk.length = 0;
|
|
375
|
+
}
|
|
376
|
+
stringifyCurrentChunk(i);
|
|
524
377
|
};
|
|
525
378
|
const getCachedNode = (node) => {
|
|
526
|
-
|
|
527
|
-
return node.codegenNode;
|
|
528
|
-
}
|
|
379
|
+
if ((node.type === 1 && node.tagType === 0 || node.type === 12) && node.codegenNode && node.codegenNode.type === 20) return node.codegenNode;
|
|
529
380
|
};
|
|
530
381
|
const dataAriaRE = /^(?:data|aria)-/;
|
|
531
382
|
const isStringifiableAttr = (name, ns) => {
|
|
532
|
-
|
|
383
|
+
return (ns === 0 ? (0, _vue_shared.isKnownHtmlAttr)(name) : ns === 1 ? (0, _vue_shared.isKnownSvgAttr)(name) : ns === 2 ? (0, _vue_shared.isKnownMathMLAttr)(name) : false) || dataAriaRE.test(name);
|
|
533
384
|
};
|
|
534
|
-
const isNonStringifiable = /* @__PURE__ */
|
|
535
|
-
|
|
536
|
-
|
|
385
|
+
const isNonStringifiable = /* @__PURE__ */ (0, _vue_shared.makeMap)(`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`);
|
|
386
|
+
/**
|
|
387
|
+
* for a cached node, analyze it and return:
|
|
388
|
+
* - false: bailed (contains non-stringifiable props or runtime constant)
|
|
389
|
+
* - [nc, ec] where
|
|
390
|
+
* - nc is the number of nodes inside
|
|
391
|
+
* - ec is the number of element with bindings inside
|
|
392
|
+
*/
|
|
537
393
|
function analyzeNode(node) {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
for (let i = 0; i < node2.children.length; i++) {
|
|
574
|
-
nc++;
|
|
575
|
-
const child = node2.children[i];
|
|
576
|
-
if (child.type === 1) {
|
|
577
|
-
if (child.props.length > 0) {
|
|
578
|
-
ec++;
|
|
579
|
-
}
|
|
580
|
-
walk(child);
|
|
581
|
-
if (bailed) {
|
|
582
|
-
return false;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
return true;
|
|
587
|
-
}
|
|
588
|
-
return walk(node) ? [nc, ec] : false;
|
|
394
|
+
if (node.type === 1 && isNonStringifiable(node.tag)) return false;
|
|
395
|
+
if (node.type === 1 && (0, _vue_compiler_core.findDir)(node, "once", true)) return false;
|
|
396
|
+
if (node.type === 12) return [1, 0];
|
|
397
|
+
let nc = 1;
|
|
398
|
+
let ec = node.props.length > 0 ? 1 : 0;
|
|
399
|
+
let bailed = false;
|
|
400
|
+
const bail = () => {
|
|
401
|
+
bailed = true;
|
|
402
|
+
return false;
|
|
403
|
+
};
|
|
404
|
+
function walk(node) {
|
|
405
|
+
const isOptionTag = node.tag === "option" && node.ns === 0;
|
|
406
|
+
for (let i = 0; i < node.props.length; i++) {
|
|
407
|
+
const p = node.props[i];
|
|
408
|
+
if (p.type === 6 && !isStringifiableAttr(p.name, node.ns)) return bail();
|
|
409
|
+
if (p.type === 7 && p.name === "bind") {
|
|
410
|
+
if (p.arg && (p.arg.type === 8 || p.arg.isStatic && !isStringifiableAttr(p.arg.content, node.ns))) return bail();
|
|
411
|
+
if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) return bail();
|
|
412
|
+
if (isOptionTag && (0, _vue_compiler_core.isStaticArgOf)(p.arg, "value") && p.exp && !p.exp.isStatic) return bail();
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
416
|
+
nc++;
|
|
417
|
+
const child = node.children[i];
|
|
418
|
+
if (child.type === 1) {
|
|
419
|
+
if (child.props.length > 0) ec++;
|
|
420
|
+
walk(child);
|
|
421
|
+
if (bailed) return false;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return true;
|
|
425
|
+
}
|
|
426
|
+
return walk(node) ? [nc, ec] : false;
|
|
589
427
|
}
|
|
590
428
|
function stringifyNode(node, context) {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
case 3:
|
|
603
|
-
return `<!--${shared.escapeHtml(node.content)}-->`;
|
|
604
|
-
case 5:
|
|
605
|
-
return shared.escapeHtml(shared.toDisplayString(evaluateConstant(node.content)));
|
|
606
|
-
case 8:
|
|
607
|
-
return shared.escapeHtml(evaluateConstant(node));
|
|
608
|
-
case 12:
|
|
609
|
-
return stringifyNode(node.content, context);
|
|
610
|
-
default:
|
|
611
|
-
return "";
|
|
612
|
-
}
|
|
429
|
+
if ((0, _vue_shared.isString)(node)) return node;
|
|
430
|
+
if ((0, _vue_shared.isSymbol)(node)) return ``;
|
|
431
|
+
switch (node.type) {
|
|
432
|
+
case 1: return stringifyElement(node, context);
|
|
433
|
+
case 2: return (0, _vue_shared.escapeHtml)(node.content);
|
|
434
|
+
case 3: return `<!--${(0, _vue_shared.escapeHtml)(node.content)}-->`;
|
|
435
|
+
case 5: return (0, _vue_shared.escapeHtml)((0, _vue_shared.toDisplayString)(evaluateConstant(node.content)));
|
|
436
|
+
case 8: return (0, _vue_shared.escapeHtml)(evaluateConstant(node));
|
|
437
|
+
case 12: return stringifyNode(node.content, context);
|
|
438
|
+
default: return "";
|
|
439
|
+
}
|
|
613
440
|
}
|
|
614
441
|
function stringifyElement(node, context) {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
innerHTML = evaluateConstant(p.exp);
|
|
648
|
-
} else if (p.name === "text") {
|
|
649
|
-
innerHTML = shared.escapeHtml(
|
|
650
|
-
shared.toDisplayString(evaluateConstant(p.exp))
|
|
651
|
-
);
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
if (context.scopeId) {
|
|
656
|
-
res += ` ${context.scopeId}`;
|
|
657
|
-
}
|
|
658
|
-
res += `>`;
|
|
659
|
-
if (innerHTML) {
|
|
660
|
-
res += innerHTML;
|
|
661
|
-
} else {
|
|
662
|
-
for (let i = 0; i < node.children.length; i++) {
|
|
663
|
-
res += stringifyNode(node.children[i], context);
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
if (!shared.isVoidTag(node.tag)) {
|
|
667
|
-
res += `</${node.tag}>`;
|
|
668
|
-
}
|
|
669
|
-
return res;
|
|
442
|
+
let res = `<${node.tag}`;
|
|
443
|
+
let innerHTML = "";
|
|
444
|
+
for (let i = 0; i < node.props.length; i++) {
|
|
445
|
+
const p = node.props[i];
|
|
446
|
+
if (p.type === 6) {
|
|
447
|
+
res += ` ${p.name}`;
|
|
448
|
+
if (p.value) res += `="${(0, _vue_shared.escapeHtml)(p.value.content)}"`;
|
|
449
|
+
} else if (p.type === 7) {
|
|
450
|
+
if (p.name === "bind") {
|
|
451
|
+
const exp = p.exp;
|
|
452
|
+
if (exp.content[0] === "_") {
|
|
453
|
+
res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
if ((0, _vue_shared.isBooleanAttr)(p.arg.content) && exp.content === "false") continue;
|
|
457
|
+
let evaluated = evaluateConstant(exp);
|
|
458
|
+
if (evaluated != null) {
|
|
459
|
+
const arg = p.arg && p.arg.content;
|
|
460
|
+
if (arg === "class") evaluated = (0, _vue_shared.normalizeClass)(evaluated);
|
|
461
|
+
else if (arg === "style") evaluated = (0, _vue_shared.stringifyStyle)((0, _vue_shared.normalizeStyle)(evaluated));
|
|
462
|
+
res += ` ${p.arg.content}="${(0, _vue_shared.escapeHtml)(evaluated)}"`;
|
|
463
|
+
}
|
|
464
|
+
} else if (p.name === "html") innerHTML = evaluateConstant(p.exp);
|
|
465
|
+
else if (p.name === "text") innerHTML = (0, _vue_shared.escapeHtml)((0, _vue_shared.toDisplayString)(evaluateConstant(p.exp)));
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
if (context.scopeId) res += ` ${context.scopeId}`;
|
|
469
|
+
res += `>`;
|
|
470
|
+
if (innerHTML) res += innerHTML;
|
|
471
|
+
else for (let i = 0; i < node.children.length; i++) res += stringifyNode(node.children[i], context);
|
|
472
|
+
if (!(0, _vue_shared.isVoidTag)(node.tag)) res += `</${node.tag}>`;
|
|
473
|
+
return res;
|
|
670
474
|
}
|
|
671
475
|
function evaluateConstant(exp) {
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
res += shared.toDisplayString(evaluateConstant(c.content));
|
|
684
|
-
} else {
|
|
685
|
-
res += evaluateConstant(c);
|
|
686
|
-
}
|
|
687
|
-
});
|
|
688
|
-
return res;
|
|
689
|
-
}
|
|
476
|
+
if (exp.type === 4) return new Function(`return (${exp.content})`)();
|
|
477
|
+
else {
|
|
478
|
+
let res = ``;
|
|
479
|
+
exp.children.forEach((c) => {
|
|
480
|
+
if ((0, _vue_shared.isString)(c) || (0, _vue_shared.isSymbol)(c)) return;
|
|
481
|
+
if (c.type === 2) res += c.content;
|
|
482
|
+
else if (c.type === 5) res += (0, _vue_shared.toDisplayString)(evaluateConstant(c.content));
|
|
483
|
+
else res += evaluateConstant(c);
|
|
484
|
+
});
|
|
485
|
+
return res;
|
|
486
|
+
}
|
|
690
487
|
}
|
|
691
|
-
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region packages/compiler-dom/src/transforms/ignoreSideEffectTags.ts
|
|
692
490
|
const ignoreSideEffectTags = (node, context) => {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
node.loc
|
|
698
|
-
)
|
|
699
|
-
);
|
|
700
|
-
context.removeNode();
|
|
701
|
-
}
|
|
491
|
+
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
|
|
492
|
+
context.onError(createDOMCompilerError(64, node.loc));
|
|
493
|
+
context.removeNode();
|
|
494
|
+
}
|
|
702
495
|
};
|
|
703
|
-
|
|
496
|
+
//#endregion
|
|
497
|
+
//#region packages/compiler-dom/src/htmlNesting.ts
|
|
498
|
+
/**
|
|
499
|
+
* Copied from https://github.com/MananTank/validate-html-nesting
|
|
500
|
+
* with ISC license
|
|
501
|
+
*
|
|
502
|
+
* To avoid runtime dependency on validate-html-nesting
|
|
503
|
+
* This file should not change very often in the original repo
|
|
504
|
+
* but we may need to keep it up-to-date from time to time.
|
|
505
|
+
*/
|
|
506
|
+
/**
|
|
507
|
+
* returns true if given parent-child nesting is valid HTML
|
|
508
|
+
*/
|
|
704
509
|
function isValidHTMLNesting(parent, child) {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
if (knownInvalidChildren[parent].has(child)) return false;
|
|
716
|
-
}
|
|
717
|
-
if (child in knownInvalidParents) {
|
|
718
|
-
if (knownInvalidParents[child].has(parent)) return false;
|
|
719
|
-
}
|
|
720
|
-
return true;
|
|
510
|
+
if (parent === "template") return true;
|
|
511
|
+
if (parent in onlyValidChildren) return onlyValidChildren[parent].has(child);
|
|
512
|
+
if (child in onlyValidParents) return onlyValidParents[child].has(parent);
|
|
513
|
+
if (parent in knownInvalidChildren) {
|
|
514
|
+
if (knownInvalidChildren[parent].has(child)) return false;
|
|
515
|
+
}
|
|
516
|
+
if (child in knownInvalidParents) {
|
|
517
|
+
if (knownInvalidParents[child].has(parent)) return false;
|
|
518
|
+
}
|
|
519
|
+
return true;
|
|
721
520
|
}
|
|
722
|
-
const headings =
|
|
521
|
+
const headings = new Set([
|
|
522
|
+
"h1",
|
|
523
|
+
"h2",
|
|
524
|
+
"h3",
|
|
525
|
+
"h4",
|
|
526
|
+
"h5",
|
|
527
|
+
"h6"
|
|
528
|
+
]);
|
|
723
529
|
const emptySet = /* @__PURE__ */ new Set([]);
|
|
530
|
+
/**
|
|
531
|
+
* maps element to set of elements that can be it's children, no other */
|
|
724
532
|
const onlyValidChildren = {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
533
|
+
head: new Set([
|
|
534
|
+
"base",
|
|
535
|
+
"basefront",
|
|
536
|
+
"bgsound",
|
|
537
|
+
"link",
|
|
538
|
+
"meta",
|
|
539
|
+
"title",
|
|
540
|
+
"noscript",
|
|
541
|
+
"noframes",
|
|
542
|
+
"style",
|
|
543
|
+
"script",
|
|
544
|
+
"template"
|
|
545
|
+
]),
|
|
546
|
+
optgroup: new Set(["option"]),
|
|
547
|
+
select: new Set([
|
|
548
|
+
"optgroup",
|
|
549
|
+
"option",
|
|
550
|
+
"hr"
|
|
551
|
+
]),
|
|
552
|
+
table: new Set([
|
|
553
|
+
"caption",
|
|
554
|
+
"colgroup",
|
|
555
|
+
"tbody",
|
|
556
|
+
"tfoot",
|
|
557
|
+
"thead"
|
|
558
|
+
]),
|
|
559
|
+
tr: new Set(["td", "th"]),
|
|
560
|
+
colgroup: new Set(["col"]),
|
|
561
|
+
tbody: new Set(["tr"]),
|
|
562
|
+
thead: new Set(["tr"]),
|
|
563
|
+
tfoot: new Set(["tr"]),
|
|
564
|
+
script: emptySet,
|
|
565
|
+
iframe: emptySet,
|
|
566
|
+
option: emptySet,
|
|
567
|
+
textarea: emptySet,
|
|
568
|
+
style: emptySet,
|
|
569
|
+
title: emptySet
|
|
754
570
|
};
|
|
571
|
+
/** maps elements to set of elements which can be it's parent, no other */
|
|
755
572
|
const onlyValidParents = {
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
area: /* @__PURE__ */ new Set(["map"])
|
|
573
|
+
html: emptySet,
|
|
574
|
+
body: new Set(["html"]),
|
|
575
|
+
head: new Set(["html"]),
|
|
576
|
+
td: new Set(["tr"]),
|
|
577
|
+
colgroup: new Set(["table"]),
|
|
578
|
+
caption: new Set(["table"]),
|
|
579
|
+
tbody: new Set(["table"]),
|
|
580
|
+
tfoot: new Set(["table"]),
|
|
581
|
+
col: new Set(["colgroup"]),
|
|
582
|
+
th: new Set(["tr"]),
|
|
583
|
+
thead: new Set(["table"]),
|
|
584
|
+
tr: new Set([
|
|
585
|
+
"tbody",
|
|
586
|
+
"thead",
|
|
587
|
+
"tfoot"
|
|
588
|
+
]),
|
|
589
|
+
dd: new Set(["dl", "div"]),
|
|
590
|
+
dt: new Set(["dl", "div"]),
|
|
591
|
+
figcaption: new Set(["figure"]),
|
|
592
|
+
summary: new Set(["details"]),
|
|
593
|
+
area: new Set(["map"])
|
|
778
594
|
};
|
|
595
|
+
/** maps element to set of elements that can not be it's children, others can */
|
|
779
596
|
const knownInvalidChildren = {
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
597
|
+
p: new Set([
|
|
598
|
+
"address",
|
|
599
|
+
"article",
|
|
600
|
+
"aside",
|
|
601
|
+
"blockquote",
|
|
602
|
+
"center",
|
|
603
|
+
"details",
|
|
604
|
+
"dialog",
|
|
605
|
+
"dir",
|
|
606
|
+
"div",
|
|
607
|
+
"dl",
|
|
608
|
+
"fieldset",
|
|
609
|
+
"figure",
|
|
610
|
+
"footer",
|
|
611
|
+
"form",
|
|
612
|
+
"h1",
|
|
613
|
+
"h2",
|
|
614
|
+
"h3",
|
|
615
|
+
"h4",
|
|
616
|
+
"h5",
|
|
617
|
+
"h6",
|
|
618
|
+
"header",
|
|
619
|
+
"hgroup",
|
|
620
|
+
"hr",
|
|
621
|
+
"li",
|
|
622
|
+
"main",
|
|
623
|
+
"nav",
|
|
624
|
+
"menu",
|
|
625
|
+
"ol",
|
|
626
|
+
"p",
|
|
627
|
+
"pre",
|
|
628
|
+
"section",
|
|
629
|
+
"table",
|
|
630
|
+
"ul"
|
|
631
|
+
]),
|
|
632
|
+
svg: new Set([
|
|
633
|
+
"b",
|
|
634
|
+
"blockquote",
|
|
635
|
+
"br",
|
|
636
|
+
"code",
|
|
637
|
+
"dd",
|
|
638
|
+
"div",
|
|
639
|
+
"dl",
|
|
640
|
+
"dt",
|
|
641
|
+
"em",
|
|
642
|
+
"embed",
|
|
643
|
+
"h1",
|
|
644
|
+
"h2",
|
|
645
|
+
"h3",
|
|
646
|
+
"h4",
|
|
647
|
+
"h5",
|
|
648
|
+
"h6",
|
|
649
|
+
"hr",
|
|
650
|
+
"i",
|
|
651
|
+
"img",
|
|
652
|
+
"li",
|
|
653
|
+
"menu",
|
|
654
|
+
"meta",
|
|
655
|
+
"ol",
|
|
656
|
+
"p",
|
|
657
|
+
"pre",
|
|
658
|
+
"ruby",
|
|
659
|
+
"s",
|
|
660
|
+
"small",
|
|
661
|
+
"span",
|
|
662
|
+
"strong",
|
|
663
|
+
"sub",
|
|
664
|
+
"sup",
|
|
665
|
+
"table",
|
|
666
|
+
"u",
|
|
667
|
+
"ul",
|
|
668
|
+
"var"
|
|
669
|
+
])
|
|
853
670
|
};
|
|
671
|
+
/** maps element to set of elements that can not be it's parent, others can */
|
|
854
672
|
const knownInvalidParents = {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
673
|
+
a: new Set(["a"]),
|
|
674
|
+
button: new Set(["button"]),
|
|
675
|
+
dd: new Set(["dd", "dt"]),
|
|
676
|
+
dt: new Set(["dd", "dt"]),
|
|
677
|
+
form: new Set(["form"]),
|
|
678
|
+
li: new Set(["li"]),
|
|
679
|
+
h1: headings,
|
|
680
|
+
h2: headings,
|
|
681
|
+
h3: headings,
|
|
682
|
+
h4: headings,
|
|
683
|
+
h5: headings,
|
|
684
|
+
h6: headings
|
|
867
685
|
};
|
|
868
|
-
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region packages/compiler-dom/src/transforms/validateHtmlNesting.ts
|
|
869
688
|
const validateHtmlNesting = (node, context) => {
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
context.onWarn(error);
|
|
876
|
-
}
|
|
689
|
+
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
|
|
690
|
+
const error = /* @__PURE__ */ new SyntaxError(`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`);
|
|
691
|
+
error.loc = node.loc;
|
|
692
|
+
context.onWarn(error);
|
|
693
|
+
}
|
|
877
694
|
};
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
...[transformTransition, validateHtmlNesting]
|
|
882
|
-
];
|
|
695
|
+
//#endregion
|
|
696
|
+
//#region packages/compiler-dom/src/index.ts
|
|
697
|
+
const DOMNodeTransforms = [transformStyle, ...[transformTransition, validateHtmlNesting]];
|
|
883
698
|
const DOMDirectiveTransforms = {
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
// override compiler-core
|
|
891
|
-
show: transformShow
|
|
699
|
+
cloak: _vue_compiler_core.noopDirectiveTransform,
|
|
700
|
+
html: transformVHtml,
|
|
701
|
+
text: transformVText,
|
|
702
|
+
model: transformModel,
|
|
703
|
+
on: transformOn,
|
|
704
|
+
show: transformShow
|
|
892
705
|
};
|
|
893
706
|
function compile(src, options = {}) {
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
...options.nodeTransforms || []
|
|
904
|
-
],
|
|
905
|
-
directiveTransforms: shared.extend(
|
|
906
|
-
{},
|
|
907
|
-
DOMDirectiveTransforms,
|
|
908
|
-
options.directiveTransforms || {}
|
|
909
|
-
),
|
|
910
|
-
transformHoist: stringifyStatic
|
|
911
|
-
})
|
|
912
|
-
);
|
|
707
|
+
return (0, _vue_compiler_core.baseCompile)(src, (0, _vue_shared.extend)({}, parserOptions, options, {
|
|
708
|
+
nodeTransforms: [
|
|
709
|
+
ignoreSideEffectTags,
|
|
710
|
+
...DOMNodeTransforms,
|
|
711
|
+
...options.nodeTransforms || []
|
|
712
|
+
],
|
|
713
|
+
directiveTransforms: (0, _vue_shared.extend)({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
|
|
714
|
+
transformHoist: stringifyStatic
|
|
715
|
+
}));
|
|
913
716
|
}
|
|
914
717
|
function parse(template, options = {}) {
|
|
915
|
-
|
|
718
|
+
return (0, _vue_compiler_core.baseParse)(template, (0, _vue_shared.extend)({}, parserOptions, options));
|
|
916
719
|
}
|
|
917
|
-
|
|
720
|
+
//#endregion
|
|
918
721
|
exports.DOMDirectiveTransforms = DOMDirectiveTransforms;
|
|
919
722
|
exports.DOMErrorCodes = DOMErrorCodes;
|
|
920
723
|
exports.DOMErrorMessages = DOMErrorMessages;
|
|
@@ -938,6 +741,11 @@ exports.parserOptions = parserOptions;
|
|
|
938
741
|
exports.postTransformTransition = postTransformTransition;
|
|
939
742
|
exports.resolveModifiers = resolveModifiers;
|
|
940
743
|
exports.transformStyle = transformStyle;
|
|
941
|
-
Object.keys(
|
|
942
|
-
|
|
744
|
+
Object.keys(_vue_compiler_core).forEach(function(k) {
|
|
745
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
746
|
+
enumerable: true,
|
|
747
|
+
get: function() {
|
|
748
|
+
return _vue_compiler_core[k];
|
|
749
|
+
}
|
|
750
|
+
});
|
|
943
751
|
});
|