@vue/compiler-core 3.3.0-alpha.3 → 3.3.0-alpha.5
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 +397 -397
- package/dist/compiler-core.cjs.prod.js +389 -389
- package/dist/compiler-core.d.ts +4 -4
- package/dist/compiler-core.esm-bundler.js +384 -384
- package/package.json +2 -2
|
@@ -16,63 +16,63 @@ function createCompilerError(code, loc, messages, additionalMessage) {
|
|
|
16
16
|
}
|
|
17
17
|
const errorMessages = {
|
|
18
18
|
// parse errors
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
35
|
-
[
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
[
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[
|
|
19
|
+
[0]: "Illegal comment.",
|
|
20
|
+
[1]: "CDATA section is allowed only in XML context.",
|
|
21
|
+
[2]: "Duplicate attribute.",
|
|
22
|
+
[3]: "End tag cannot have attributes.",
|
|
23
|
+
[4]: "Illegal '/' in tags.",
|
|
24
|
+
[5]: "Unexpected EOF in tag.",
|
|
25
|
+
[6]: "Unexpected EOF in CDATA section.",
|
|
26
|
+
[7]: "Unexpected EOF in comment.",
|
|
27
|
+
[8]: "Unexpected EOF in script.",
|
|
28
|
+
[9]: "Unexpected EOF in tag.",
|
|
29
|
+
[10]: "Incorrectly closed comment.",
|
|
30
|
+
[11]: "Incorrectly opened comment.",
|
|
31
|
+
[12]: "Illegal tag name. Use '<' to print '<'.",
|
|
32
|
+
[13]: "Attribute value was expected.",
|
|
33
|
+
[14]: "End tag name was expected.",
|
|
34
|
+
[15]: "Whitespace was expected.",
|
|
35
|
+
[16]: "Unexpected '<!--' in comment.",
|
|
36
|
+
[17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
|
|
37
|
+
[18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
|
|
38
|
+
[19]: "Attribute name cannot start with '='.",
|
|
39
|
+
[21]: "'<?' is allowed only in XML context.",
|
|
40
|
+
[20]: `Unexpected null character.`,
|
|
41
|
+
[22]: "Illegal '/' in tags.",
|
|
42
42
|
// Vue-specific parse errors
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
-
[
|
|
47
|
-
[
|
|
43
|
+
[23]: "Invalid end tag.",
|
|
44
|
+
[24]: "Element is missing end tag.",
|
|
45
|
+
[25]: "Interpolation end sign was not found.",
|
|
46
|
+
[27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
|
|
47
|
+
[26]: "Legal directive name was expected.",
|
|
48
48
|
// transform errors
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[
|
|
54
|
-
[
|
|
55
|
-
[
|
|
56
|
-
[
|
|
57
|
-
[
|
|
58
|
-
[
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
[
|
|
62
|
-
[
|
|
63
|
-
[
|
|
64
|
-
[
|
|
65
|
-
[
|
|
49
|
+
[28]: `v-if/v-else-if is missing expression.`,
|
|
50
|
+
[29]: `v-if/else branches must use unique keys.`,
|
|
51
|
+
[30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
|
|
52
|
+
[31]: `v-for is missing expression.`,
|
|
53
|
+
[32]: `v-for has invalid expression.`,
|
|
54
|
+
[33]: `<template v-for> key should be placed on the <template> tag.`,
|
|
55
|
+
[34]: `v-bind is missing expression.`,
|
|
56
|
+
[35]: `v-on is missing expression.`,
|
|
57
|
+
[36]: `Unexpected custom directive on <slot> outlet.`,
|
|
58
|
+
[37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
|
|
59
|
+
[38]: `Duplicate slot names found. `,
|
|
60
|
+
[39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
|
|
61
|
+
[40]: `v-slot can only be used on components or <template> tags.`,
|
|
62
|
+
[41]: `v-model is missing expression.`,
|
|
63
|
+
[42]: `v-model value must be a valid JavaScript member expression.`,
|
|
64
|
+
[43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
65
|
+
[44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
|
|
66
66
|
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
67
|
-
[
|
|
68
|
-
[
|
|
67
|
+
[45]: `Error parsing JavaScript expression: `,
|
|
68
|
+
[46]: `<KeepAlive> expects exactly one child component.`,
|
|
69
69
|
// generic errors
|
|
70
|
-
[
|
|
71
|
-
[
|
|
72
|
-
[
|
|
73
|
-
[
|
|
70
|
+
[47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
71
|
+
[48]: `ES module mode is not supported in this build of compiler.`,
|
|
72
|
+
[49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
73
|
+
[50]: `"scopeId" option is only supported in module mode.`,
|
|
74
74
|
// just to fulfill types
|
|
75
|
-
[
|
|
75
|
+
[51]: ``
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
const FRAGMENT = Symbol(process.env.NODE_ENV !== "production" ? `Fragment` : ``);
|
|
@@ -170,7 +170,7 @@ const locStub = {
|
|
|
170
170
|
};
|
|
171
171
|
function createRoot(children, loc = locStub) {
|
|
172
172
|
return {
|
|
173
|
-
type:
|
|
173
|
+
type: 0,
|
|
174
174
|
children,
|
|
175
175
|
helpers: /* @__PURE__ */ new Set(),
|
|
176
176
|
components: [],
|
|
@@ -196,7 +196,7 @@ function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps,
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
return {
|
|
199
|
-
type:
|
|
199
|
+
type: 13,
|
|
200
200
|
tag,
|
|
201
201
|
props,
|
|
202
202
|
children,
|
|
@@ -211,21 +211,21 @@ function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps,
|
|
|
211
211
|
}
|
|
212
212
|
function createArrayExpression(elements, loc = locStub) {
|
|
213
213
|
return {
|
|
214
|
-
type:
|
|
214
|
+
type: 17,
|
|
215
215
|
loc,
|
|
216
216
|
elements
|
|
217
217
|
};
|
|
218
218
|
}
|
|
219
219
|
function createObjectExpression(properties, loc = locStub) {
|
|
220
220
|
return {
|
|
221
|
-
type:
|
|
221
|
+
type: 15,
|
|
222
222
|
loc,
|
|
223
223
|
properties
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
226
|
function createObjectProperty(key, value) {
|
|
227
227
|
return {
|
|
228
|
-
type:
|
|
228
|
+
type: 16,
|
|
229
229
|
loc: locStub,
|
|
230
230
|
key: isString(key) ? createSimpleExpression(key, true) : key,
|
|
231
231
|
value
|
|
@@ -233,30 +233,30 @@ function createObjectProperty(key, value) {
|
|
|
233
233
|
}
|
|
234
234
|
function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
|
|
235
235
|
return {
|
|
236
|
-
type:
|
|
236
|
+
type: 4,
|
|
237
237
|
loc,
|
|
238
238
|
content,
|
|
239
239
|
isStatic,
|
|
240
|
-
constType: isStatic ?
|
|
240
|
+
constType: isStatic ? 3 : constType
|
|
241
241
|
};
|
|
242
242
|
}
|
|
243
243
|
function createInterpolation(content, loc) {
|
|
244
244
|
return {
|
|
245
|
-
type:
|
|
245
|
+
type: 5,
|
|
246
246
|
loc,
|
|
247
247
|
content: isString(content) ? createSimpleExpression(content, false, loc) : content
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
250
|
function createCompoundExpression(children, loc = locStub) {
|
|
251
251
|
return {
|
|
252
|
-
type:
|
|
252
|
+
type: 8,
|
|
253
253
|
loc,
|
|
254
254
|
children
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
257
|
function createCallExpression(callee, args = [], loc = locStub) {
|
|
258
258
|
return {
|
|
259
|
-
type:
|
|
259
|
+
type: 14,
|
|
260
260
|
loc,
|
|
261
261
|
callee,
|
|
262
262
|
arguments: args
|
|
@@ -264,7 +264,7 @@ function createCallExpression(callee, args = [], loc = locStub) {
|
|
|
264
264
|
}
|
|
265
265
|
function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
|
|
266
266
|
return {
|
|
267
|
-
type:
|
|
267
|
+
type: 18,
|
|
268
268
|
params,
|
|
269
269
|
returns,
|
|
270
270
|
newline,
|
|
@@ -274,7 +274,7 @@ function createFunctionExpression(params, returns = void 0, newline = false, isS
|
|
|
274
274
|
}
|
|
275
275
|
function createConditionalExpression(test, consequent, alternate, newline = true) {
|
|
276
276
|
return {
|
|
277
|
-
type:
|
|
277
|
+
type: 19,
|
|
278
278
|
test,
|
|
279
279
|
consequent,
|
|
280
280
|
alternate,
|
|
@@ -284,7 +284,7 @@ function createConditionalExpression(test, consequent, alternate, newline = true
|
|
|
284
284
|
}
|
|
285
285
|
function createCacheExpression(index, value, isVNode = false) {
|
|
286
286
|
return {
|
|
287
|
-
type:
|
|
287
|
+
type: 20,
|
|
288
288
|
index,
|
|
289
289
|
value,
|
|
290
290
|
isVNode,
|
|
@@ -293,21 +293,21 @@ function createCacheExpression(index, value, isVNode = false) {
|
|
|
293
293
|
}
|
|
294
294
|
function createBlockStatement(body) {
|
|
295
295
|
return {
|
|
296
|
-
type:
|
|
296
|
+
type: 21,
|
|
297
297
|
body,
|
|
298
298
|
loc: locStub
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
301
|
function createTemplateLiteral(elements) {
|
|
302
302
|
return {
|
|
303
|
-
type:
|
|
303
|
+
type: 22,
|
|
304
304
|
elements,
|
|
305
305
|
loc: locStub
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
308
|
function createIfStatement(test, consequent, alternate) {
|
|
309
309
|
return {
|
|
310
|
-
type:
|
|
310
|
+
type: 23,
|
|
311
311
|
test,
|
|
312
312
|
consequent,
|
|
313
313
|
alternate,
|
|
@@ -316,7 +316,7 @@ function createIfStatement(test, consequent, alternate) {
|
|
|
316
316
|
}
|
|
317
317
|
function createAssignmentExpression(left, right) {
|
|
318
318
|
return {
|
|
319
|
-
type:
|
|
319
|
+
type: 24,
|
|
320
320
|
left,
|
|
321
321
|
right,
|
|
322
322
|
loc: locStub
|
|
@@ -324,20 +324,34 @@ function createAssignmentExpression(left, right) {
|
|
|
324
324
|
}
|
|
325
325
|
function createSequenceExpression(expressions) {
|
|
326
326
|
return {
|
|
327
|
-
type:
|
|
327
|
+
type: 25,
|
|
328
328
|
expressions,
|
|
329
329
|
loc: locStub
|
|
330
330
|
};
|
|
331
331
|
}
|
|
332
332
|
function createReturnStatement(returns) {
|
|
333
333
|
return {
|
|
334
|
-
type:
|
|
334
|
+
type: 26,
|
|
335
335
|
returns,
|
|
336
336
|
loc: locStub
|
|
337
337
|
};
|
|
338
338
|
}
|
|
339
|
+
function getVNodeHelper(ssr, isComponent) {
|
|
340
|
+
return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
|
|
341
|
+
}
|
|
342
|
+
function getVNodeBlockHelper(ssr, isComponent) {
|
|
343
|
+
return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
|
|
344
|
+
}
|
|
345
|
+
function convertToBlock(node, { helper, removeHelper, inSSR }) {
|
|
346
|
+
if (!node.isBlock) {
|
|
347
|
+
node.isBlock = true;
|
|
348
|
+
removeHelper(getVNodeHelper(inSSR, node.isComponent));
|
|
349
|
+
helper(OPEN_BLOCK);
|
|
350
|
+
helper(getVNodeBlockHelper(inSSR, node.isComponent));
|
|
351
|
+
}
|
|
352
|
+
}
|
|
339
353
|
|
|
340
|
-
const isStaticExp = (p) => p.type ===
|
|
354
|
+
const isStaticExp = (p) => p.type === 4 && p.isStatic;
|
|
341
355
|
const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
|
|
342
356
|
function isCoreComponent(tag) {
|
|
343
357
|
if (isBuiltInType(tag, "Teleport")) {
|
|
@@ -464,7 +478,7 @@ function assert(condition, msg) {
|
|
|
464
478
|
function findDir(node, name, allowEmpty = false) {
|
|
465
479
|
for (let i = 0; i < node.props.length; i++) {
|
|
466
480
|
const p = node.props[i];
|
|
467
|
-
if (p.type ===
|
|
481
|
+
if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
|
|
468
482
|
return p;
|
|
469
483
|
}
|
|
470
484
|
}
|
|
@@ -472,7 +486,7 @@ function findDir(node, name, allowEmpty = false) {
|
|
|
472
486
|
function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
|
|
473
487
|
for (let i = 0; i < node.props.length; i++) {
|
|
474
488
|
const p = node.props[i];
|
|
475
|
-
if (p.type ===
|
|
489
|
+
if (p.type === 6) {
|
|
476
490
|
if (dynamicOnly)
|
|
477
491
|
continue;
|
|
478
492
|
if (p.name === name && (p.value || allowEmpty)) {
|
|
@@ -488,33 +502,27 @@ function isStaticArgOf(arg, name) {
|
|
|
488
502
|
}
|
|
489
503
|
function hasDynamicKeyVBind(node) {
|
|
490
504
|
return node.props.some(
|
|
491
|
-
(p) => p.type ===
|
|
492
|
-
p.arg.type !==
|
|
505
|
+
(p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
|
|
506
|
+
p.arg.type !== 4 || // v-bind:[_ctx.foo]
|
|
493
507
|
!p.arg.isStatic)
|
|
494
508
|
// v-bind:[foo]
|
|
495
509
|
);
|
|
496
510
|
}
|
|
497
511
|
function isText$1(node) {
|
|
498
|
-
return node.type ===
|
|
512
|
+
return node.type === 5 || node.type === 2;
|
|
499
513
|
}
|
|
500
514
|
function isVSlot(p) {
|
|
501
|
-
return p.type ===
|
|
515
|
+
return p.type === 7 && p.name === "slot";
|
|
502
516
|
}
|
|
503
517
|
function isTemplateNode(node) {
|
|
504
|
-
return node.type ===
|
|
518
|
+
return node.type === 1 && node.tagType === 3;
|
|
505
519
|
}
|
|
506
520
|
function isSlotOutlet(node) {
|
|
507
|
-
return node.type ===
|
|
508
|
-
}
|
|
509
|
-
function getVNodeHelper(ssr, isComponent) {
|
|
510
|
-
return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
|
|
511
|
-
}
|
|
512
|
-
function getVNodeBlockHelper(ssr, isComponent) {
|
|
513
|
-
return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
|
|
521
|
+
return node.type === 1 && node.tagType === 2;
|
|
514
522
|
}
|
|
515
523
|
const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
|
|
516
524
|
function getUnnormalizedProps(props, callPath = []) {
|
|
517
|
-
if (props && !isString(props) && props.type ===
|
|
525
|
+
if (props && !isString(props) && props.type === 14) {
|
|
518
526
|
const callee = props.callee;
|
|
519
527
|
if (!isString(callee) && propsHelperSet.has(callee)) {
|
|
520
528
|
return getUnnormalizedProps(
|
|
@@ -527,10 +535,10 @@ function getUnnormalizedProps(props, callPath = []) {
|
|
|
527
535
|
}
|
|
528
536
|
function injectProp(node, prop, context) {
|
|
529
537
|
let propsWithInjection;
|
|
530
|
-
let props = node.type ===
|
|
538
|
+
let props = node.type === 13 ? node.props : node.arguments[2];
|
|
531
539
|
let callPath = [];
|
|
532
540
|
let parentCall;
|
|
533
|
-
if (props && !isString(props) && props.type ===
|
|
541
|
+
if (props && !isString(props) && props.type === 14) {
|
|
534
542
|
const ret = getUnnormalizedProps(props);
|
|
535
543
|
props = ret[0];
|
|
536
544
|
callPath = ret[1];
|
|
@@ -538,9 +546,9 @@ function injectProp(node, prop, context) {
|
|
|
538
546
|
}
|
|
539
547
|
if (props == null || isString(props)) {
|
|
540
548
|
propsWithInjection = createObjectExpression([prop]);
|
|
541
|
-
} else if (props.type ===
|
|
549
|
+
} else if (props.type === 14) {
|
|
542
550
|
const first = props.arguments[0];
|
|
543
|
-
if (!isString(first) && first.type ===
|
|
551
|
+
if (!isString(first) && first.type === 15) {
|
|
544
552
|
if (!hasProp(prop, first)) {
|
|
545
553
|
first.properties.unshift(prop);
|
|
546
554
|
}
|
|
@@ -555,7 +563,7 @@ function injectProp(node, prop, context) {
|
|
|
555
563
|
}
|
|
556
564
|
}
|
|
557
565
|
!propsWithInjection && (propsWithInjection = props);
|
|
558
|
-
} else if (props.type ===
|
|
566
|
+
} else if (props.type === 15) {
|
|
559
567
|
if (!hasProp(prop, props)) {
|
|
560
568
|
props.properties.unshift(prop);
|
|
561
569
|
}
|
|
@@ -569,7 +577,7 @@ function injectProp(node, prop, context) {
|
|
|
569
577
|
parentCall = callPath[callPath.length - 2];
|
|
570
578
|
}
|
|
571
579
|
}
|
|
572
|
-
if (node.type ===
|
|
580
|
+
if (node.type === 13) {
|
|
573
581
|
if (parentCall) {
|
|
574
582
|
parentCall.arguments[0] = propsWithInjection;
|
|
575
583
|
} else {
|
|
@@ -585,10 +593,10 @@ function injectProp(node, prop, context) {
|
|
|
585
593
|
}
|
|
586
594
|
function hasProp(prop, props) {
|
|
587
595
|
let result = false;
|
|
588
|
-
if (prop.key.type ===
|
|
596
|
+
if (prop.key.type === 4) {
|
|
589
597
|
const propKeyName = prop.key.content;
|
|
590
598
|
result = props.properties.some(
|
|
591
|
-
(p) => p.key.type ===
|
|
599
|
+
(p) => p.key.type === 4 && p.key.content === propKeyName
|
|
592
600
|
);
|
|
593
601
|
}
|
|
594
602
|
return result;
|
|
@@ -603,35 +611,35 @@ function hasScopeRef(node, ids) {
|
|
|
603
611
|
return false;
|
|
604
612
|
}
|
|
605
613
|
switch (node.type) {
|
|
606
|
-
case
|
|
614
|
+
case 1:
|
|
607
615
|
for (let i = 0; i < node.props.length; i++) {
|
|
608
616
|
const p = node.props[i];
|
|
609
|
-
if (p.type ===
|
|
617
|
+
if (p.type === 7 && (hasScopeRef(p.arg, ids) || hasScopeRef(p.exp, ids))) {
|
|
610
618
|
return true;
|
|
611
619
|
}
|
|
612
620
|
}
|
|
613
621
|
return node.children.some((c) => hasScopeRef(c, ids));
|
|
614
|
-
case
|
|
622
|
+
case 11:
|
|
615
623
|
if (hasScopeRef(node.source, ids)) {
|
|
616
624
|
return true;
|
|
617
625
|
}
|
|
618
626
|
return node.children.some((c) => hasScopeRef(c, ids));
|
|
619
|
-
case
|
|
627
|
+
case 9:
|
|
620
628
|
return node.branches.some((b) => hasScopeRef(b, ids));
|
|
621
|
-
case
|
|
629
|
+
case 10:
|
|
622
630
|
if (hasScopeRef(node.condition, ids)) {
|
|
623
631
|
return true;
|
|
624
632
|
}
|
|
625
633
|
return node.children.some((c) => hasScopeRef(c, ids));
|
|
626
|
-
case
|
|
634
|
+
case 4:
|
|
627
635
|
return !node.isStatic && isSimpleIdentifier(node.content) && !!ids[node.content];
|
|
628
|
-
case
|
|
636
|
+
case 8:
|
|
629
637
|
return node.children.some((c) => isObject(c) && hasScopeRef(c, ids));
|
|
630
|
-
case
|
|
631
|
-
case
|
|
638
|
+
case 5:
|
|
639
|
+
case 12:
|
|
632
640
|
return hasScopeRef(node.content, ids);
|
|
633
|
-
case
|
|
634
|
-
case
|
|
641
|
+
case 2:
|
|
642
|
+
case 3:
|
|
635
643
|
return false;
|
|
636
644
|
default:
|
|
637
645
|
if (process.env.NODE_ENV !== "production") ;
|
|
@@ -639,20 +647,12 @@ function hasScopeRef(node, ids) {
|
|
|
639
647
|
}
|
|
640
648
|
}
|
|
641
649
|
function getMemoedVNodeCall(node) {
|
|
642
|
-
if (node.type ===
|
|
650
|
+
if (node.type === 14 && node.callee === WITH_MEMO) {
|
|
643
651
|
return node.arguments[1].returns;
|
|
644
652
|
} else {
|
|
645
653
|
return node;
|
|
646
654
|
}
|
|
647
655
|
}
|
|
648
|
-
function makeBlock(node, { helper, removeHelper, inSSR }) {
|
|
649
|
-
if (!node.isBlock) {
|
|
650
|
-
node.isBlock = true;
|
|
651
|
-
removeHelper(getVNodeHelper(inSSR, node.isComponent));
|
|
652
|
-
helper(OPEN_BLOCK);
|
|
653
|
-
helper(getVNodeBlockHelper(inSSR, node.isComponent));
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
656
|
|
|
657
657
|
const deprecationData = {
|
|
658
658
|
["COMPILER_IS_ON_ELEMENT"]: {
|
|
@@ -736,8 +736,8 @@ const decodeMap = {
|
|
|
736
736
|
};
|
|
737
737
|
const defaultParserOptions = {
|
|
738
738
|
delimiters: [`{{`, `}}`],
|
|
739
|
-
getNamespace: () =>
|
|
740
|
-
getTextMode: () =>
|
|
739
|
+
getNamespace: () => 0,
|
|
740
|
+
getTextMode: () => 0,
|
|
741
741
|
isVoidTag: NO,
|
|
742
742
|
isPreTag: NO,
|
|
743
743
|
isCustomElement: NO,
|
|
@@ -750,7 +750,7 @@ function baseParse(content, options = {}) {
|
|
|
750
750
|
const context = createParserContext(content, options);
|
|
751
751
|
const start = getCursor(context);
|
|
752
752
|
return createRoot(
|
|
753
|
-
parseChildren(context,
|
|
753
|
+
parseChildren(context, 0, []),
|
|
754
754
|
getSelection(context, start)
|
|
755
755
|
);
|
|
756
756
|
}
|
|
@@ -774,48 +774,48 @@ function createParserContext(content, rawOptions) {
|
|
|
774
774
|
}
|
|
775
775
|
function parseChildren(context, mode, ancestors) {
|
|
776
776
|
const parent = last(ancestors);
|
|
777
|
-
const ns = parent ? parent.ns :
|
|
777
|
+
const ns = parent ? parent.ns : 0;
|
|
778
778
|
const nodes = [];
|
|
779
779
|
while (!isEnd(context, mode, ancestors)) {
|
|
780
780
|
const s = context.source;
|
|
781
781
|
let node = void 0;
|
|
782
|
-
if (mode ===
|
|
782
|
+
if (mode === 0 || mode === 1) {
|
|
783
783
|
if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
|
|
784
784
|
node = parseInterpolation(context, mode);
|
|
785
|
-
} else if (mode ===
|
|
785
|
+
} else if (mode === 0 && s[0] === "<") {
|
|
786
786
|
if (s.length === 1) {
|
|
787
|
-
emitError(context,
|
|
787
|
+
emitError(context, 5, 1);
|
|
788
788
|
} else if (s[1] === "!") {
|
|
789
789
|
if (startsWith(s, "<!--")) {
|
|
790
790
|
node = parseComment(context);
|
|
791
791
|
} else if (startsWith(s, "<!DOCTYPE")) {
|
|
792
792
|
node = parseBogusComment(context);
|
|
793
793
|
} else if (startsWith(s, "<![CDATA[")) {
|
|
794
|
-
if (ns !==
|
|
794
|
+
if (ns !== 0) {
|
|
795
795
|
node = parseCDATA(context, ancestors);
|
|
796
796
|
} else {
|
|
797
|
-
emitError(context,
|
|
797
|
+
emitError(context, 1);
|
|
798
798
|
node = parseBogusComment(context);
|
|
799
799
|
}
|
|
800
800
|
} else {
|
|
801
|
-
emitError(context,
|
|
801
|
+
emitError(context, 11);
|
|
802
802
|
node = parseBogusComment(context);
|
|
803
803
|
}
|
|
804
804
|
} else if (s[1] === "/") {
|
|
805
805
|
if (s.length === 2) {
|
|
806
|
-
emitError(context,
|
|
806
|
+
emitError(context, 5, 2);
|
|
807
807
|
} else if (s[2] === ">") {
|
|
808
|
-
emitError(context,
|
|
808
|
+
emitError(context, 14, 2);
|
|
809
809
|
advanceBy(context, 3);
|
|
810
810
|
continue;
|
|
811
811
|
} else if (/[a-z]/i.test(s[2])) {
|
|
812
|
-
emitError(context,
|
|
812
|
+
emitError(context, 23);
|
|
813
813
|
parseTag(context, TagType.End, parent);
|
|
814
814
|
continue;
|
|
815
815
|
} else {
|
|
816
816
|
emitError(
|
|
817
817
|
context,
|
|
818
|
-
|
|
818
|
+
12,
|
|
819
819
|
2
|
|
820
820
|
);
|
|
821
821
|
node = parseBogusComment(context);
|
|
@@ -826,7 +826,7 @@ function parseChildren(context, mode, ancestors) {
|
|
|
826
826
|
"COMPILER_NATIVE_TEMPLATE",
|
|
827
827
|
context
|
|
828
828
|
) && node && node.tag === "template" && !node.props.some(
|
|
829
|
-
(p) => p.type ===
|
|
829
|
+
(p) => p.type === 7 && isSpecialTemplateDirective(p.name)
|
|
830
830
|
)) {
|
|
831
831
|
process.env.NODE_ENV !== "production" && warnDeprecation(
|
|
832
832
|
"COMPILER_NATIVE_TEMPLATE",
|
|
@@ -838,12 +838,12 @@ function parseChildren(context, mode, ancestors) {
|
|
|
838
838
|
} else if (s[1] === "?") {
|
|
839
839
|
emitError(
|
|
840
840
|
context,
|
|
841
|
-
|
|
841
|
+
21,
|
|
842
842
|
1
|
|
843
843
|
);
|
|
844
844
|
node = parseBogusComment(context);
|
|
845
845
|
} else {
|
|
846
|
-
emitError(context,
|
|
846
|
+
emitError(context, 12, 1);
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
849
|
}
|
|
@@ -859,16 +859,16 @@ function parseChildren(context, mode, ancestors) {
|
|
|
859
859
|
}
|
|
860
860
|
}
|
|
861
861
|
let removedWhitespace = false;
|
|
862
|
-
if (mode !==
|
|
862
|
+
if (mode !== 2 && mode !== 1) {
|
|
863
863
|
const shouldCondense = context.options.whitespace !== "preserve";
|
|
864
864
|
for (let i = 0; i < nodes.length; i++) {
|
|
865
865
|
const node = nodes[i];
|
|
866
|
-
if (node.type ===
|
|
866
|
+
if (node.type === 2) {
|
|
867
867
|
if (!context.inPre) {
|
|
868
868
|
if (!/[^\t\r\n\f ]/.test(node.content)) {
|
|
869
869
|
const prev = nodes[i - 1];
|
|
870
870
|
const next = nodes[i + 1];
|
|
871
|
-
if (!prev || !next || shouldCondense && (prev.type ===
|
|
871
|
+
if (!prev || !next || shouldCondense && (prev.type === 3 && next.type === 3 || prev.type === 3 && next.type === 1 || prev.type === 1 && next.type === 3 || prev.type === 1 && next.type === 1 && /[\r\n]/.test(node.content))) {
|
|
872
872
|
removedWhitespace = true;
|
|
873
873
|
nodes[i] = null;
|
|
874
874
|
} else {
|
|
@@ -880,14 +880,14 @@ function parseChildren(context, mode, ancestors) {
|
|
|
880
880
|
} else {
|
|
881
881
|
node.content = node.content.replace(/\r\n/g, "\n");
|
|
882
882
|
}
|
|
883
|
-
} else if (node.type ===
|
|
883
|
+
} else if (node.type === 3 && !context.options.comments) {
|
|
884
884
|
removedWhitespace = true;
|
|
885
885
|
nodes[i] = null;
|
|
886
886
|
}
|
|
887
887
|
}
|
|
888
888
|
if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
|
|
889
889
|
const first = nodes[0];
|
|
890
|
-
if (first && first.type ===
|
|
890
|
+
if (first && first.type === 2) {
|
|
891
891
|
first.content = first.content.replace(/^\r?\n/, "");
|
|
892
892
|
}
|
|
893
893
|
}
|
|
@@ -895,9 +895,9 @@ function parseChildren(context, mode, ancestors) {
|
|
|
895
895
|
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
896
896
|
}
|
|
897
897
|
function pushNode(nodes, node) {
|
|
898
|
-
if (node.type ===
|
|
898
|
+
if (node.type === 2) {
|
|
899
899
|
const prev = last(nodes);
|
|
900
|
-
if (prev && prev.type ===
|
|
900
|
+
if (prev && prev.type === 2 && prev.loc.end.offset === node.loc.start.offset) {
|
|
901
901
|
prev.content += node.content;
|
|
902
902
|
prev.loc.end = node.loc.end;
|
|
903
903
|
prev.loc.source += node.loc.source;
|
|
@@ -908,9 +908,9 @@ function pushNode(nodes, node) {
|
|
|
908
908
|
}
|
|
909
909
|
function parseCDATA(context, ancestors) {
|
|
910
910
|
advanceBy(context, 9);
|
|
911
|
-
const nodes = parseChildren(context,
|
|
911
|
+
const nodes = parseChildren(context, 3, ancestors);
|
|
912
912
|
if (context.source.length === 0) {
|
|
913
|
-
emitError(context,
|
|
913
|
+
emitError(context, 6);
|
|
914
914
|
} else {
|
|
915
915
|
advanceBy(context, 3);
|
|
916
916
|
}
|
|
@@ -923,13 +923,13 @@ function parseComment(context) {
|
|
|
923
923
|
if (!match) {
|
|
924
924
|
content = context.source.slice(4);
|
|
925
925
|
advanceBy(context, context.source.length);
|
|
926
|
-
emitError(context,
|
|
926
|
+
emitError(context, 7);
|
|
927
927
|
} else {
|
|
928
928
|
if (match.index <= 3) {
|
|
929
|
-
emitError(context,
|
|
929
|
+
emitError(context, 0);
|
|
930
930
|
}
|
|
931
931
|
if (match[1]) {
|
|
932
|
-
emitError(context,
|
|
932
|
+
emitError(context, 10);
|
|
933
933
|
}
|
|
934
934
|
content = context.source.slice(4, match.index);
|
|
935
935
|
const s = context.source.slice(0, match.index);
|
|
@@ -937,14 +937,14 @@ function parseComment(context) {
|
|
|
937
937
|
while ((nestedIndex = s.indexOf("<!--", prevIndex)) !== -1) {
|
|
938
938
|
advanceBy(context, nestedIndex - prevIndex + 1);
|
|
939
939
|
if (nestedIndex + 4 < s.length) {
|
|
940
|
-
emitError(context,
|
|
940
|
+
emitError(context, 16);
|
|
941
941
|
}
|
|
942
942
|
prevIndex = nestedIndex + 1;
|
|
943
943
|
}
|
|
944
944
|
advanceBy(context, match.index + match[0].length - prevIndex + 1);
|
|
945
945
|
}
|
|
946
946
|
return {
|
|
947
|
-
type:
|
|
947
|
+
type: 3,
|
|
948
948
|
content,
|
|
949
949
|
loc: getSelection(context, start)
|
|
950
950
|
};
|
|
@@ -962,7 +962,7 @@ function parseBogusComment(context) {
|
|
|
962
962
|
advanceBy(context, closeIndex + 1);
|
|
963
963
|
}
|
|
964
964
|
return {
|
|
965
|
-
type:
|
|
965
|
+
type: 3,
|
|
966
966
|
content,
|
|
967
967
|
loc: getSelection(context, start)
|
|
968
968
|
};
|
|
@@ -989,7 +989,7 @@ function parseElement(context, ancestors) {
|
|
|
989
989
|
ancestors.pop();
|
|
990
990
|
{
|
|
991
991
|
const inlineTemplateProp = element.props.find(
|
|
992
|
-
(p) => p.type ===
|
|
992
|
+
(p) => p.type === 6 && p.name === "inline-template"
|
|
993
993
|
);
|
|
994
994
|
if (inlineTemplateProp && checkCompatEnabled(
|
|
995
995
|
"COMPILER_INLINE_TEMPLATE",
|
|
@@ -998,7 +998,7 @@ function parseElement(context, ancestors) {
|
|
|
998
998
|
)) {
|
|
999
999
|
const loc = getSelection(context, element.loc.end);
|
|
1000
1000
|
inlineTemplateProp.value = {
|
|
1001
|
-
type:
|
|
1001
|
+
type: 2,
|
|
1002
1002
|
content: loc.source,
|
|
1003
1003
|
loc
|
|
1004
1004
|
};
|
|
@@ -1008,11 +1008,11 @@ function parseElement(context, ancestors) {
|
|
|
1008
1008
|
if (startsWithEndTagOpen(context.source, element.tag)) {
|
|
1009
1009
|
parseTag(context, TagType.End, parent);
|
|
1010
1010
|
} else {
|
|
1011
|
-
emitError(context,
|
|
1011
|
+
emitError(context, 24, 0, element.loc.start);
|
|
1012
1012
|
if (context.source.length === 0 && element.tag.toLowerCase() === "script") {
|
|
1013
1013
|
const first = children[0];
|
|
1014
1014
|
if (first && startsWith(first.loc.source, "<!--")) {
|
|
1015
|
-
emitError(context,
|
|
1015
|
+
emitError(context, 8);
|
|
1016
1016
|
}
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
@@ -1046,7 +1046,7 @@ function parseTag(context, type, parent) {
|
|
|
1046
1046
|
context.inPre = true;
|
|
1047
1047
|
}
|
|
1048
1048
|
let props = parseAttributes(context, type);
|
|
1049
|
-
if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type ===
|
|
1049
|
+
if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type === 7 && p.name === "pre")) {
|
|
1050
1050
|
context.inVPre = true;
|
|
1051
1051
|
extend(context, cursor);
|
|
1052
1052
|
context.source = currentSource;
|
|
@@ -1054,11 +1054,11 @@ function parseTag(context, type, parent) {
|
|
|
1054
1054
|
}
|
|
1055
1055
|
let isSelfClosing = false;
|
|
1056
1056
|
if (context.source.length === 0) {
|
|
1057
|
-
emitError(context,
|
|
1057
|
+
emitError(context, 9);
|
|
1058
1058
|
} else {
|
|
1059
1059
|
isSelfClosing = startsWith(context.source, "/>");
|
|
1060
1060
|
if (type === 1 /* End */ && isSelfClosing) {
|
|
1061
|
-
emitError(context,
|
|
1061
|
+
emitError(context, 4);
|
|
1062
1062
|
}
|
|
1063
1063
|
advanceBy(context, isSelfClosing ? 2 : 1);
|
|
1064
1064
|
}
|
|
@@ -1073,7 +1073,7 @@ function parseTag(context, type, parent) {
|
|
|
1073
1073
|
let hasFor = false;
|
|
1074
1074
|
for (let i = 0; i < props.length; i++) {
|
|
1075
1075
|
const p = props[i];
|
|
1076
|
-
if (p.type ===
|
|
1076
|
+
if (p.type === 7) {
|
|
1077
1077
|
if (p.name === "if") {
|
|
1078
1078
|
hasIf = true;
|
|
1079
1079
|
} else if (p.name === "for") {
|
|
@@ -1090,22 +1090,22 @@ function parseTag(context, type, parent) {
|
|
|
1090
1090
|
}
|
|
1091
1091
|
}
|
|
1092
1092
|
}
|
|
1093
|
-
let tagType =
|
|
1093
|
+
let tagType = 0;
|
|
1094
1094
|
if (!context.inVPre) {
|
|
1095
1095
|
if (tag === "slot") {
|
|
1096
|
-
tagType =
|
|
1096
|
+
tagType = 2;
|
|
1097
1097
|
} else if (tag === "template") {
|
|
1098
1098
|
if (props.some(
|
|
1099
|
-
(p) => p.type ===
|
|
1099
|
+
(p) => p.type === 7 && isSpecialTemplateDirective(p.name)
|
|
1100
1100
|
)) {
|
|
1101
|
-
tagType =
|
|
1101
|
+
tagType = 3;
|
|
1102
1102
|
}
|
|
1103
1103
|
} else if (isComponent(tag, props, context)) {
|
|
1104
|
-
tagType =
|
|
1104
|
+
tagType = 1;
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
1107
|
return {
|
|
1108
|
-
type:
|
|
1108
|
+
type: 1,
|
|
1109
1109
|
ns,
|
|
1110
1110
|
tag,
|
|
1111
1111
|
tagType,
|
|
@@ -1127,7 +1127,7 @@ function isComponent(tag, props, context) {
|
|
|
1127
1127
|
}
|
|
1128
1128
|
for (let i = 0; i < props.length; i++) {
|
|
1129
1129
|
const p = props[i];
|
|
1130
|
-
if (p.type ===
|
|
1130
|
+
if (p.type === 6) {
|
|
1131
1131
|
if (p.name === "is" && p.value) {
|
|
1132
1132
|
if (p.value.content.startsWith("vue:")) {
|
|
1133
1133
|
return true;
|
|
@@ -1160,23 +1160,23 @@ function parseAttributes(context, type) {
|
|
|
1160
1160
|
const attributeNames = /* @__PURE__ */ new Set();
|
|
1161
1161
|
while (context.source.length > 0 && !startsWith(context.source, ">") && !startsWith(context.source, "/>")) {
|
|
1162
1162
|
if (startsWith(context.source, "/")) {
|
|
1163
|
-
emitError(context,
|
|
1163
|
+
emitError(context, 22);
|
|
1164
1164
|
advanceBy(context, 1);
|
|
1165
1165
|
advanceSpaces(context);
|
|
1166
1166
|
continue;
|
|
1167
1167
|
}
|
|
1168
1168
|
if (type === 1 /* End */) {
|
|
1169
|
-
emitError(context,
|
|
1169
|
+
emitError(context, 3);
|
|
1170
1170
|
}
|
|
1171
1171
|
const attr = parseAttribute(context, attributeNames);
|
|
1172
|
-
if (attr.type ===
|
|
1172
|
+
if (attr.type === 6 && attr.value && attr.name === "class") {
|
|
1173
1173
|
attr.value.content = attr.value.content.replace(/\s+/g, " ").trim();
|
|
1174
1174
|
}
|
|
1175
1175
|
if (type === 0 /* Start */) {
|
|
1176
1176
|
props.push(attr);
|
|
1177
1177
|
}
|
|
1178
1178
|
if (/^[^\t\r\n\f />]/.test(context.source)) {
|
|
1179
|
-
emitError(context,
|
|
1179
|
+
emitError(context, 15);
|
|
1180
1180
|
}
|
|
1181
1181
|
advanceSpaces(context);
|
|
1182
1182
|
}
|
|
@@ -1187,11 +1187,11 @@ function parseAttribute(context, nameSet) {
|
|
|
1187
1187
|
const match = /^[^\t\r\n\f />][^\t\r\n\f />=]*/.exec(context.source);
|
|
1188
1188
|
const name = match[0];
|
|
1189
1189
|
if (nameSet.has(name)) {
|
|
1190
|
-
emitError(context,
|
|
1190
|
+
emitError(context, 2);
|
|
1191
1191
|
}
|
|
1192
1192
|
nameSet.add(name);
|
|
1193
1193
|
if (name[0] === "=") {
|
|
1194
|
-
emitError(context,
|
|
1194
|
+
emitError(context, 19);
|
|
1195
1195
|
}
|
|
1196
1196
|
{
|
|
1197
1197
|
const pattern = /["'<]/g;
|
|
@@ -1199,7 +1199,7 @@ function parseAttribute(context, nameSet) {
|
|
|
1199
1199
|
while (m = pattern.exec(name)) {
|
|
1200
1200
|
emitError(
|
|
1201
1201
|
context,
|
|
1202
|
-
|
|
1202
|
+
17,
|
|
1203
1203
|
m.index
|
|
1204
1204
|
);
|
|
1205
1205
|
}
|
|
@@ -1212,7 +1212,7 @@ function parseAttribute(context, nameSet) {
|
|
|
1212
1212
|
advanceSpaces(context);
|
|
1213
1213
|
value = parseAttributeValue(context);
|
|
1214
1214
|
if (!value) {
|
|
1215
|
-
emitError(context,
|
|
1215
|
+
emitError(context, 13);
|
|
1216
1216
|
}
|
|
1217
1217
|
}
|
|
1218
1218
|
const loc = getSelection(context, start);
|
|
@@ -1242,7 +1242,7 @@ function parseAttribute(context, nameSet) {
|
|
|
1242
1242
|
if (!content.endsWith("]")) {
|
|
1243
1243
|
emitError(
|
|
1244
1244
|
context,
|
|
1245
|
-
|
|
1245
|
+
27
|
|
1246
1246
|
);
|
|
1247
1247
|
content = content.slice(1);
|
|
1248
1248
|
} else {
|
|
@@ -1252,10 +1252,10 @@ function parseAttribute(context, nameSet) {
|
|
|
1252
1252
|
content += match2[3] || "";
|
|
1253
1253
|
}
|
|
1254
1254
|
arg = {
|
|
1255
|
-
type:
|
|
1255
|
+
type: 4,
|
|
1256
1256
|
content,
|
|
1257
1257
|
isStatic,
|
|
1258
|
-
constType: isStatic ?
|
|
1258
|
+
constType: isStatic ? 3 : 0,
|
|
1259
1259
|
loc: loc2
|
|
1260
1260
|
};
|
|
1261
1261
|
}
|
|
@@ -1288,10 +1288,10 @@ function parseAttribute(context, nameSet) {
|
|
|
1288
1288
|
}
|
|
1289
1289
|
}
|
|
1290
1290
|
return {
|
|
1291
|
-
type:
|
|
1291
|
+
type: 7,
|
|
1292
1292
|
name: dirName,
|
|
1293
1293
|
exp: value && {
|
|
1294
|
-
type:
|
|
1294
|
+
type: 4,
|
|
1295
1295
|
content: value.content,
|
|
1296
1296
|
isStatic: false,
|
|
1297
1297
|
// Treat as non-constant by default. This can be potentially set to
|
|
@@ -1305,13 +1305,13 @@ function parseAttribute(context, nameSet) {
|
|
|
1305
1305
|
};
|
|
1306
1306
|
}
|
|
1307
1307
|
if (!context.inVPre && startsWith(name, "v-")) {
|
|
1308
|
-
emitError(context,
|
|
1308
|
+
emitError(context, 26);
|
|
1309
1309
|
}
|
|
1310
1310
|
return {
|
|
1311
|
-
type:
|
|
1311
|
+
type: 6,
|
|
1312
1312
|
name,
|
|
1313
1313
|
value: value && {
|
|
1314
|
-
type:
|
|
1314
|
+
type: 2,
|
|
1315
1315
|
content: value.content,
|
|
1316
1316
|
loc: value.loc
|
|
1317
1317
|
},
|
|
@@ -1330,10 +1330,10 @@ function parseAttributeValue(context) {
|
|
|
1330
1330
|
content = parseTextData(
|
|
1331
1331
|
context,
|
|
1332
1332
|
context.source.length,
|
|
1333
|
-
|
|
1333
|
+
4
|
|
1334
1334
|
);
|
|
1335
1335
|
} else {
|
|
1336
|
-
content = parseTextData(context, endIndex,
|
|
1336
|
+
content = parseTextData(context, endIndex, 4);
|
|
1337
1337
|
advanceBy(context, 1);
|
|
1338
1338
|
}
|
|
1339
1339
|
} else {
|
|
@@ -1346,11 +1346,11 @@ function parseAttributeValue(context) {
|
|
|
1346
1346
|
while (m = unexpectedChars.exec(match[0])) {
|
|
1347
1347
|
emitError(
|
|
1348
1348
|
context,
|
|
1349
|
-
|
|
1349
|
+
18,
|
|
1350
1350
|
m.index
|
|
1351
1351
|
);
|
|
1352
1352
|
}
|
|
1353
|
-
content = parseTextData(context, match[0].length,
|
|
1353
|
+
content = parseTextData(context, match[0].length, 4);
|
|
1354
1354
|
}
|
|
1355
1355
|
return { content, isQuoted, loc: getSelection(context, start) };
|
|
1356
1356
|
}
|
|
@@ -1358,7 +1358,7 @@ function parseInterpolation(context, mode) {
|
|
|
1358
1358
|
const [open, close] = context.options.delimiters;
|
|
1359
1359
|
const closeIndex = context.source.indexOf(close, open.length);
|
|
1360
1360
|
if (closeIndex === -1) {
|
|
1361
|
-
emitError(context,
|
|
1361
|
+
emitError(context, 25);
|
|
1362
1362
|
return void 0;
|
|
1363
1363
|
}
|
|
1364
1364
|
const start = getCursor(context);
|
|
@@ -1377,9 +1377,9 @@ function parseInterpolation(context, mode) {
|
|
|
1377
1377
|
advancePositionWithMutation(innerEnd, rawContent, endOffset);
|
|
1378
1378
|
advanceBy(context, close.length);
|
|
1379
1379
|
return {
|
|
1380
|
-
type:
|
|
1380
|
+
type: 5,
|
|
1381
1381
|
content: {
|
|
1382
|
-
type:
|
|
1382
|
+
type: 4,
|
|
1383
1383
|
isStatic: false,
|
|
1384
1384
|
// Set `isConstant` to false by default and will decide in transformExpression
|
|
1385
1385
|
constType: 0,
|
|
@@ -1390,7 +1390,7 @@ function parseInterpolation(context, mode) {
|
|
|
1390
1390
|
};
|
|
1391
1391
|
}
|
|
1392
1392
|
function parseText(context, mode) {
|
|
1393
|
-
const endTokens = mode ===
|
|
1393
|
+
const endTokens = mode === 3 ? ["]]>"] : ["<", context.options.delimiters[0]];
|
|
1394
1394
|
let endIndex = context.source.length;
|
|
1395
1395
|
for (let i = 0; i < endTokens.length; i++) {
|
|
1396
1396
|
const index = context.source.indexOf(endTokens[i], 1);
|
|
@@ -1401,7 +1401,7 @@ function parseText(context, mode) {
|
|
|
1401
1401
|
const start = getCursor(context);
|
|
1402
1402
|
const content = parseTextData(context, endIndex, mode);
|
|
1403
1403
|
return {
|
|
1404
|
-
type:
|
|
1404
|
+
type: 2,
|
|
1405
1405
|
content,
|
|
1406
1406
|
loc: getSelection(context, start)
|
|
1407
1407
|
};
|
|
@@ -1409,12 +1409,12 @@ function parseText(context, mode) {
|
|
|
1409
1409
|
function parseTextData(context, length, mode) {
|
|
1410
1410
|
const rawText = context.source.slice(0, length);
|
|
1411
1411
|
advanceBy(context, length);
|
|
1412
|
-
if (mode ===
|
|
1412
|
+
if (mode === 2 || mode === 3 || !rawText.includes("&")) {
|
|
1413
1413
|
return rawText;
|
|
1414
1414
|
} else {
|
|
1415
1415
|
return context.options.decodeEntities(
|
|
1416
1416
|
rawText,
|
|
1417
|
-
mode ===
|
|
1417
|
+
mode === 4
|
|
1418
1418
|
);
|
|
1419
1419
|
}
|
|
1420
1420
|
}
|
|
@@ -1470,7 +1470,7 @@ function emitError(context, code, offset, loc = getCursor(context)) {
|
|
|
1470
1470
|
function isEnd(context, mode, ancestors) {
|
|
1471
1471
|
const s = context.source;
|
|
1472
1472
|
switch (mode) {
|
|
1473
|
-
case
|
|
1473
|
+
case 0:
|
|
1474
1474
|
if (startsWith(s, "</")) {
|
|
1475
1475
|
for (let i = ancestors.length - 1; i >= 0; --i) {
|
|
1476
1476
|
if (startsWithEndTagOpen(s, ancestors[i].tag)) {
|
|
@@ -1479,15 +1479,15 @@ function isEnd(context, mode, ancestors) {
|
|
|
1479
1479
|
}
|
|
1480
1480
|
}
|
|
1481
1481
|
break;
|
|
1482
|
-
case
|
|
1483
|
-
case
|
|
1482
|
+
case 1:
|
|
1483
|
+
case 2: {
|
|
1484
1484
|
const parent = last(ancestors);
|
|
1485
1485
|
if (parent && startsWithEndTagOpen(s, parent.tag)) {
|
|
1486
1486
|
return true;
|
|
1487
1487
|
}
|
|
1488
1488
|
break;
|
|
1489
1489
|
}
|
|
1490
|
-
case
|
|
1490
|
+
case 3:
|
|
1491
1491
|
if (startsWith(s, "]]>")) {
|
|
1492
1492
|
return true;
|
|
1493
1493
|
}
|
|
@@ -1510,7 +1510,7 @@ function hoistStatic(root, context) {
|
|
|
1510
1510
|
}
|
|
1511
1511
|
function isSingleElementRoot(root, child) {
|
|
1512
1512
|
const { children } = root;
|
|
1513
|
-
return children.length === 1 && child.type ===
|
|
1513
|
+
return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
|
|
1514
1514
|
}
|
|
1515
1515
|
function walk(node, context, doNotHoistNode = false) {
|
|
1516
1516
|
const { children } = node;
|
|
@@ -1518,10 +1518,10 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
1518
1518
|
let hoistedCount = 0;
|
|
1519
1519
|
for (let i = 0; i < children.length; i++) {
|
|
1520
1520
|
const child = children[i];
|
|
1521
|
-
if (child.type ===
|
|
1521
|
+
if (child.type === 1 && child.tagType === 0) {
|
|
1522
1522
|
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
1523
1523
|
if (constantType > 0) {
|
|
1524
|
-
if (constantType >=
|
|
1524
|
+
if (constantType >= 2) {
|
|
1525
1525
|
child.codegenNode.patchFlag = -1 + (process.env.NODE_ENV !== "production" ? ` /* HOISTED */` : ``);
|
|
1526
1526
|
child.codegenNode = context.hoist(child.codegenNode);
|
|
1527
1527
|
hoistedCount++;
|
|
@@ -1529,9 +1529,9 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
1529
1529
|
}
|
|
1530
1530
|
} else {
|
|
1531
1531
|
const codegenNode = child.codegenNode;
|
|
1532
|
-
if (codegenNode.type ===
|
|
1532
|
+
if (codegenNode.type === 13) {
|
|
1533
1533
|
const flag = getPatchFlag(codegenNode);
|
|
1534
|
-
if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >=
|
|
1534
|
+
if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
|
|
1535
1535
|
const props = getNodeProps(child);
|
|
1536
1536
|
if (props) {
|
|
1537
1537
|
codegenNode.props = context.hoist(props);
|
|
@@ -1543,8 +1543,8 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
1543
1543
|
}
|
|
1544
1544
|
}
|
|
1545
1545
|
}
|
|
1546
|
-
if (child.type ===
|
|
1547
|
-
const isComponent = child.tagType ===
|
|
1546
|
+
if (child.type === 1) {
|
|
1547
|
+
const isComponent = child.tagType === 1;
|
|
1548
1548
|
if (isComponent) {
|
|
1549
1549
|
context.scopes.vSlot++;
|
|
1550
1550
|
}
|
|
@@ -1552,9 +1552,9 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
1552
1552
|
if (isComponent) {
|
|
1553
1553
|
context.scopes.vSlot--;
|
|
1554
1554
|
}
|
|
1555
|
-
} else if (child.type ===
|
|
1555
|
+
} else if (child.type === 11) {
|
|
1556
1556
|
walk(child, context, child.children.length === 1);
|
|
1557
|
-
} else if (child.type ===
|
|
1557
|
+
} else if (child.type === 9) {
|
|
1558
1558
|
for (let i2 = 0; i2 < child.branches.length; i2++) {
|
|
1559
1559
|
walk(
|
|
1560
1560
|
child.branches[i2],
|
|
@@ -1567,7 +1567,7 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
1567
1567
|
if (hoistedCount && context.transformHoist) {
|
|
1568
1568
|
context.transformHoist(children, context, node);
|
|
1569
1569
|
}
|
|
1570
|
-
if (hoistedCount && hoistedCount === originalCount && node.type ===
|
|
1570
|
+
if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
|
|
1571
1571
|
node.codegenNode.children = context.hoist(
|
|
1572
1572
|
createArrayExpression(node.codegenNode.children)
|
|
1573
1573
|
);
|
|
@@ -1576,8 +1576,8 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
1576
1576
|
function getConstantType(node, context) {
|
|
1577
1577
|
const { constantCache } = context;
|
|
1578
1578
|
switch (node.type) {
|
|
1579
|
-
case
|
|
1580
|
-
if (node.tagType !==
|
|
1579
|
+
case 1:
|
|
1580
|
+
if (node.tagType !== 0) {
|
|
1581
1581
|
return 0;
|
|
1582
1582
|
}
|
|
1583
1583
|
const cached = constantCache.get(node);
|
|
@@ -1585,7 +1585,7 @@ function getConstantType(node, context) {
|
|
|
1585
1585
|
return cached;
|
|
1586
1586
|
}
|
|
1587
1587
|
const codegenNode = node.codegenNode;
|
|
1588
|
-
if (codegenNode.type !==
|
|
1588
|
+
if (codegenNode.type !== 13) {
|
|
1589
1589
|
return 0;
|
|
1590
1590
|
}
|
|
1591
1591
|
if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
|
|
@@ -1593,7 +1593,7 @@ function getConstantType(node, context) {
|
|
|
1593
1593
|
}
|
|
1594
1594
|
const flag = getPatchFlag(codegenNode);
|
|
1595
1595
|
if (!flag) {
|
|
1596
|
-
let returnType2 =
|
|
1596
|
+
let returnType2 = 3;
|
|
1597
1597
|
const generatedPropsType = getGeneratedPropsConstantType(node, context);
|
|
1598
1598
|
if (generatedPropsType === 0) {
|
|
1599
1599
|
constantCache.set(node, 0);
|
|
@@ -1612,10 +1612,10 @@ function getConstantType(node, context) {
|
|
|
1612
1612
|
returnType2 = childType;
|
|
1613
1613
|
}
|
|
1614
1614
|
}
|
|
1615
|
-
if (returnType2 >
|
|
1615
|
+
if (returnType2 > 1) {
|
|
1616
1616
|
for (let i = 0; i < node.props.length; i++) {
|
|
1617
1617
|
const p = node.props[i];
|
|
1618
|
-
if (p.type ===
|
|
1618
|
+
if (p.type === 7 && p.name === "bind" && p.exp) {
|
|
1619
1619
|
const expType = getConstantType(p.exp, context);
|
|
1620
1620
|
if (expType === 0) {
|
|
1621
1621
|
constantCache.set(node, 0);
|
|
@@ -1630,7 +1630,7 @@ function getConstantType(node, context) {
|
|
|
1630
1630
|
if (codegenNode.isBlock) {
|
|
1631
1631
|
for (let i = 0; i < node.props.length; i++) {
|
|
1632
1632
|
const p = node.props[i];
|
|
1633
|
-
if (p.type ===
|
|
1633
|
+
if (p.type === 7) {
|
|
1634
1634
|
constantCache.set(node, 0);
|
|
1635
1635
|
return 0;
|
|
1636
1636
|
}
|
|
@@ -1648,20 +1648,20 @@ function getConstantType(node, context) {
|
|
|
1648
1648
|
constantCache.set(node, 0);
|
|
1649
1649
|
return 0;
|
|
1650
1650
|
}
|
|
1651
|
-
case
|
|
1652
|
-
case
|
|
1653
|
-
return
|
|
1654
|
-
case
|
|
1655
|
-
case
|
|
1656
|
-
case
|
|
1651
|
+
case 2:
|
|
1652
|
+
case 3:
|
|
1653
|
+
return 3;
|
|
1654
|
+
case 9:
|
|
1655
|
+
case 11:
|
|
1656
|
+
case 10:
|
|
1657
1657
|
return 0;
|
|
1658
|
-
case
|
|
1659
|
-
case
|
|
1658
|
+
case 5:
|
|
1659
|
+
case 12:
|
|
1660
1660
|
return getConstantType(node.content, context);
|
|
1661
|
-
case
|
|
1661
|
+
case 4:
|
|
1662
1662
|
return node.constType;
|
|
1663
|
-
case
|
|
1664
|
-
let returnType =
|
|
1663
|
+
case 8:
|
|
1664
|
+
let returnType = 3;
|
|
1665
1665
|
for (let i = 0; i < node.children.length; i++) {
|
|
1666
1666
|
const child = node.children[i];
|
|
1667
1667
|
if (isString(child) || isSymbol(child)) {
|
|
@@ -1687,20 +1687,20 @@ const allowHoistedHelperSet = /* @__PURE__ */ new Set([
|
|
|
1687
1687
|
GUARD_REACTIVE_PROPS
|
|
1688
1688
|
]);
|
|
1689
1689
|
function getConstantTypeOfHelperCall(value, context) {
|
|
1690
|
-
if (value.type ===
|
|
1690
|
+
if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
|
|
1691
1691
|
const arg = value.arguments[0];
|
|
1692
|
-
if (arg.type ===
|
|
1692
|
+
if (arg.type === 4) {
|
|
1693
1693
|
return getConstantType(arg, context);
|
|
1694
|
-
} else if (arg.type ===
|
|
1694
|
+
} else if (arg.type === 14) {
|
|
1695
1695
|
return getConstantTypeOfHelperCall(arg, context);
|
|
1696
1696
|
}
|
|
1697
1697
|
}
|
|
1698
1698
|
return 0;
|
|
1699
1699
|
}
|
|
1700
1700
|
function getGeneratedPropsConstantType(node, context) {
|
|
1701
|
-
let returnType =
|
|
1701
|
+
let returnType = 3;
|
|
1702
1702
|
const props = getNodeProps(node);
|
|
1703
|
-
if (props && props.type ===
|
|
1703
|
+
if (props && props.type === 15) {
|
|
1704
1704
|
const { properties } = props;
|
|
1705
1705
|
for (let i = 0; i < properties.length; i++) {
|
|
1706
1706
|
const { key, value } = properties[i];
|
|
@@ -1712,9 +1712,9 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
1712
1712
|
returnType = keyType;
|
|
1713
1713
|
}
|
|
1714
1714
|
let valueType;
|
|
1715
|
-
if (value.type ===
|
|
1715
|
+
if (value.type === 4) {
|
|
1716
1716
|
valueType = getConstantType(value, context);
|
|
1717
|
-
} else if (value.type ===
|
|
1717
|
+
} else if (value.type === 14) {
|
|
1718
1718
|
valueType = getConstantTypeOfHelperCall(value, context);
|
|
1719
1719
|
} else {
|
|
1720
1720
|
valueType = 0;
|
|
@@ -1731,7 +1731,7 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
1731
1731
|
}
|
|
1732
1732
|
function getNodeProps(node) {
|
|
1733
1733
|
const codegenNode = node.codegenNode;
|
|
1734
|
-
if (codegenNode.type ===
|
|
1734
|
+
if (codegenNode.type === 13) {
|
|
1735
1735
|
return codegenNode.props;
|
|
1736
1736
|
}
|
|
1737
1737
|
}
|
|
@@ -1873,7 +1873,7 @@ function createTransformContext(root, {
|
|
|
1873
1873
|
`_hoisted_${context.hoists.length}`,
|
|
1874
1874
|
false,
|
|
1875
1875
|
exp.loc,
|
|
1876
|
-
|
|
1876
|
+
2
|
|
1877
1877
|
);
|
|
1878
1878
|
identifier.hoisted = exp;
|
|
1879
1879
|
return identifier;
|
|
@@ -1914,8 +1914,8 @@ function createRootCodegen(root, context) {
|
|
|
1914
1914
|
const child = children[0];
|
|
1915
1915
|
if (isSingleElementRoot(root, child) && child.codegenNode) {
|
|
1916
1916
|
const codegenNode = child.codegenNode;
|
|
1917
|
-
if (codegenNode.type ===
|
|
1918
|
-
|
|
1917
|
+
if (codegenNode.type === 13) {
|
|
1918
|
+
convertToBlock(codegenNode, context);
|
|
1919
1919
|
}
|
|
1920
1920
|
root.codegenNode = codegenNode;
|
|
1921
1921
|
} else {
|
|
@@ -1924,7 +1924,7 @@ function createRootCodegen(root, context) {
|
|
|
1924
1924
|
} else if (children.length > 1) {
|
|
1925
1925
|
let patchFlag = 64;
|
|
1926
1926
|
let patchFlagText = PatchFlagNames[64];
|
|
1927
|
-
if (process.env.NODE_ENV !== "production" && children.filter((c) => c.type !==
|
|
1927
|
+
if (process.env.NODE_ENV !== "production" && children.filter((c) => c.type !== 3).length === 1) {
|
|
1928
1928
|
patchFlag |= 2048;
|
|
1929
1929
|
patchFlagText += `, ${PatchFlagNames[2048]}`;
|
|
1930
1930
|
}
|
|
@@ -1978,25 +1978,25 @@ function traverseNode(node, context) {
|
|
|
1978
1978
|
}
|
|
1979
1979
|
}
|
|
1980
1980
|
switch (node.type) {
|
|
1981
|
-
case
|
|
1981
|
+
case 3:
|
|
1982
1982
|
if (!context.ssr) {
|
|
1983
1983
|
context.helper(CREATE_COMMENT);
|
|
1984
1984
|
}
|
|
1985
1985
|
break;
|
|
1986
|
-
case
|
|
1986
|
+
case 5:
|
|
1987
1987
|
if (!context.ssr) {
|
|
1988
1988
|
context.helper(TO_DISPLAY_STRING);
|
|
1989
1989
|
}
|
|
1990
1990
|
break;
|
|
1991
|
-
case
|
|
1991
|
+
case 9:
|
|
1992
1992
|
for (let i2 = 0; i2 < node.branches.length; i2++) {
|
|
1993
1993
|
traverseNode(node.branches[i2], context);
|
|
1994
1994
|
}
|
|
1995
1995
|
break;
|
|
1996
|
-
case
|
|
1997
|
-
case
|
|
1998
|
-
case
|
|
1999
|
-
case
|
|
1996
|
+
case 10:
|
|
1997
|
+
case 11:
|
|
1998
|
+
case 1:
|
|
1999
|
+
case 0:
|
|
2000
2000
|
traverseChildren(node, context);
|
|
2001
2001
|
break;
|
|
2002
2002
|
}
|
|
@@ -2009,15 +2009,15 @@ function traverseNode(node, context) {
|
|
|
2009
2009
|
function createStructuralDirectiveTransform(name, fn) {
|
|
2010
2010
|
const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
|
|
2011
2011
|
return (node, context) => {
|
|
2012
|
-
if (node.type ===
|
|
2012
|
+
if (node.type === 1) {
|
|
2013
2013
|
const { props } = node;
|
|
2014
|
-
if (node.tagType ===
|
|
2014
|
+
if (node.tagType === 3 && props.some(isVSlot)) {
|
|
2015
2015
|
return;
|
|
2016
2016
|
}
|
|
2017
2017
|
const exitFns = [];
|
|
2018
2018
|
for (let i = 0; i < props.length; i++) {
|
|
2019
2019
|
const prop = props[i];
|
|
2020
|
-
if (prop.type ===
|
|
2020
|
+
if (prop.type === 7 && matches(prop.name)) {
|
|
2021
2021
|
props.splice(i, 1);
|
|
2022
2022
|
i--;
|
|
2023
2023
|
const onExit = fn(node, prop, context);
|
|
@@ -2252,7 +2252,7 @@ function genHoists(hoists, context) {
|
|
|
2252
2252
|
context.pure = false;
|
|
2253
2253
|
}
|
|
2254
2254
|
function isText(n) {
|
|
2255
|
-
return isString(n) || n.type ===
|
|
2255
|
+
return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
|
|
2256
2256
|
}
|
|
2257
2257
|
function genNodeListAsArray(nodes, context) {
|
|
2258
2258
|
const multilines = nodes.length > 3 || process.env.NODE_ENV !== "production" && nodes.some((n) => isArray(n) || !isText(n));
|
|
@@ -2293,68 +2293,68 @@ function genNode(node, context) {
|
|
|
2293
2293
|
return;
|
|
2294
2294
|
}
|
|
2295
2295
|
switch (node.type) {
|
|
2296
|
-
case
|
|
2297
|
-
case
|
|
2298
|
-
case
|
|
2296
|
+
case 1:
|
|
2297
|
+
case 9:
|
|
2298
|
+
case 11:
|
|
2299
2299
|
process.env.NODE_ENV !== "production" && assert(
|
|
2300
2300
|
node.codegenNode != null,
|
|
2301
2301
|
`Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
|
|
2302
2302
|
);
|
|
2303
2303
|
genNode(node.codegenNode, context);
|
|
2304
2304
|
break;
|
|
2305
|
-
case
|
|
2305
|
+
case 2:
|
|
2306
2306
|
genText(node, context);
|
|
2307
2307
|
break;
|
|
2308
|
-
case
|
|
2308
|
+
case 4:
|
|
2309
2309
|
genExpression(node, context);
|
|
2310
2310
|
break;
|
|
2311
|
-
case
|
|
2311
|
+
case 5:
|
|
2312
2312
|
genInterpolation(node, context);
|
|
2313
2313
|
break;
|
|
2314
|
-
case
|
|
2314
|
+
case 12:
|
|
2315
2315
|
genNode(node.codegenNode, context);
|
|
2316
2316
|
break;
|
|
2317
|
-
case
|
|
2317
|
+
case 8:
|
|
2318
2318
|
genCompoundExpression(node, context);
|
|
2319
2319
|
break;
|
|
2320
|
-
case
|
|
2320
|
+
case 3:
|
|
2321
2321
|
genComment(node, context);
|
|
2322
2322
|
break;
|
|
2323
|
-
case
|
|
2323
|
+
case 13:
|
|
2324
2324
|
genVNodeCall(node, context);
|
|
2325
2325
|
break;
|
|
2326
|
-
case
|
|
2326
|
+
case 14:
|
|
2327
2327
|
genCallExpression(node, context);
|
|
2328
2328
|
break;
|
|
2329
|
-
case
|
|
2329
|
+
case 15:
|
|
2330
2330
|
genObjectExpression(node, context);
|
|
2331
2331
|
break;
|
|
2332
|
-
case
|
|
2332
|
+
case 17:
|
|
2333
2333
|
genArrayExpression(node, context);
|
|
2334
2334
|
break;
|
|
2335
|
-
case
|
|
2335
|
+
case 18:
|
|
2336
2336
|
genFunctionExpression(node, context);
|
|
2337
2337
|
break;
|
|
2338
|
-
case
|
|
2338
|
+
case 19:
|
|
2339
2339
|
genConditionalExpression(node, context);
|
|
2340
2340
|
break;
|
|
2341
|
-
case
|
|
2341
|
+
case 20:
|
|
2342
2342
|
genCacheExpression(node, context);
|
|
2343
2343
|
break;
|
|
2344
|
-
case
|
|
2344
|
+
case 21:
|
|
2345
2345
|
genNodeList(node.body, context, true, false);
|
|
2346
2346
|
break;
|
|
2347
|
-
case
|
|
2347
|
+
case 22:
|
|
2348
2348
|
break;
|
|
2349
|
-
case
|
|
2349
|
+
case 23:
|
|
2350
2350
|
break;
|
|
2351
|
-
case
|
|
2351
|
+
case 24:
|
|
2352
2352
|
break;
|
|
2353
|
-
case
|
|
2353
|
+
case 25:
|
|
2354
2354
|
break;
|
|
2355
|
-
case
|
|
2355
|
+
case 26:
|
|
2356
2356
|
break;
|
|
2357
|
-
case
|
|
2357
|
+
case 10:
|
|
2358
2358
|
break;
|
|
2359
2359
|
default:
|
|
2360
2360
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -2391,7 +2391,7 @@ function genCompoundExpression(node, context) {
|
|
|
2391
2391
|
}
|
|
2392
2392
|
function genExpressionAsPropertyKey(node, context) {
|
|
2393
2393
|
const { push } = context;
|
|
2394
|
-
if (node.type ===
|
|
2394
|
+
if (node.type === 8) {
|
|
2395
2395
|
push(`[`);
|
|
2396
2396
|
genCompoundExpression(node, context);
|
|
2397
2397
|
push(`]`);
|
|
@@ -2472,7 +2472,7 @@ function genObjectExpression(node, context) {
|
|
|
2472
2472
|
push(`{}`, node);
|
|
2473
2473
|
return;
|
|
2474
2474
|
}
|
|
2475
|
-
const multilines = properties.length > 1 || process.env.NODE_ENV !== "production" && properties.some((p) => p.value.type !==
|
|
2475
|
+
const multilines = properties.length > 1 || process.env.NODE_ENV !== "production" && properties.some((p) => p.value.type !== 4);
|
|
2476
2476
|
push(multilines ? `{` : `{ `);
|
|
2477
2477
|
multilines && indent();
|
|
2478
2478
|
for (let i = 0; i < properties.length; i++) {
|
|
@@ -2534,7 +2534,7 @@ function genFunctionExpression(node, context) {
|
|
|
2534
2534
|
function genConditionalExpression(node, context) {
|
|
2535
2535
|
const { test, consequent, alternate, newline: needNewline } = node;
|
|
2536
2536
|
const { push, indent, deindent, newline } = context;
|
|
2537
|
-
if (test.type ===
|
|
2537
|
+
if (test.type === 4) {
|
|
2538
2538
|
const needsParens = !isSimpleIdentifier(test.content);
|
|
2539
2539
|
needsParens && push(`(`);
|
|
2540
2540
|
genExpression(test, context);
|
|
@@ -2553,7 +2553,7 @@ function genConditionalExpression(node, context) {
|
|
|
2553
2553
|
needNewline && newline();
|
|
2554
2554
|
needNewline || push(` `);
|
|
2555
2555
|
push(`: `);
|
|
2556
|
-
const isNested = alternate.type ===
|
|
2556
|
+
const isNested = alternate.type === 19;
|
|
2557
2557
|
if (!isNested) {
|
|
2558
2558
|
context.indentLevel++;
|
|
2559
2559
|
}
|
|
@@ -2698,7 +2698,7 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
|
|
|
2698
2698
|
}
|
|
2699
2699
|
context.onError(
|
|
2700
2700
|
createCompilerError(
|
|
2701
|
-
|
|
2701
|
+
45,
|
|
2702
2702
|
node.loc,
|
|
2703
2703
|
void 0,
|
|
2704
2704
|
message
|
|
@@ -2708,18 +2708,18 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
|
|
|
2708
2708
|
}
|
|
2709
2709
|
|
|
2710
2710
|
const transformExpression = (node, context) => {
|
|
2711
|
-
if (node.type ===
|
|
2711
|
+
if (node.type === 5) {
|
|
2712
2712
|
node.content = processExpression(
|
|
2713
2713
|
node.content,
|
|
2714
2714
|
context
|
|
2715
2715
|
);
|
|
2716
|
-
} else if (node.type ===
|
|
2716
|
+
} else if (node.type === 1) {
|
|
2717
2717
|
for (let i = 0; i < node.props.length; i++) {
|
|
2718
2718
|
const dir = node.props[i];
|
|
2719
|
-
if (dir.type ===
|
|
2719
|
+
if (dir.type === 7 && dir.name !== "for") {
|
|
2720
2720
|
const exp = dir.exp;
|
|
2721
2721
|
const arg = dir.arg;
|
|
2722
|
-
if (exp && exp.type ===
|
|
2722
|
+
if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
|
|
2723
2723
|
dir.exp = processExpression(
|
|
2724
2724
|
exp,
|
|
2725
2725
|
context,
|
|
@@ -2727,7 +2727,7 @@ const transformExpression = (node, context) => {
|
|
|
2727
2727
|
dir.name === "slot"
|
|
2728
2728
|
);
|
|
2729
2729
|
}
|
|
2730
|
-
if (arg && arg.type ===
|
|
2730
|
+
if (arg && arg.type === 4 && !arg.isStatic) {
|
|
2731
2731
|
dir.arg = processExpression(arg, context);
|
|
2732
2732
|
}
|
|
2733
2733
|
}
|
|
@@ -2745,7 +2745,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
2745
2745
|
function stringifyExpression(exp) {
|
|
2746
2746
|
if (isString(exp)) {
|
|
2747
2747
|
return exp;
|
|
2748
|
-
} else if (exp.type ===
|
|
2748
|
+
} else if (exp.type === 4) {
|
|
2749
2749
|
return exp.content;
|
|
2750
2750
|
} else {
|
|
2751
2751
|
return exp.children.map(stringifyExpression).join("");
|
|
@@ -2761,7 +2761,7 @@ const transformIf = createStructuralDirectiveTransform(
|
|
|
2761
2761
|
let key = 0;
|
|
2762
2762
|
while (i-- >= 0) {
|
|
2763
2763
|
const sibling = siblings[i];
|
|
2764
|
-
if (sibling && sibling.type ===
|
|
2764
|
+
if (sibling && sibling.type === 9) {
|
|
2765
2765
|
key += sibling.branches.length;
|
|
2766
2766
|
}
|
|
2767
2767
|
}
|
|
@@ -2788,7 +2788,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
2788
2788
|
if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
|
|
2789
2789
|
const loc = dir.exp ? dir.exp.loc : node.loc;
|
|
2790
2790
|
context.onError(
|
|
2791
|
-
createCompilerError(
|
|
2791
|
+
createCompilerError(28, dir.loc)
|
|
2792
2792
|
);
|
|
2793
2793
|
dir.exp = createSimpleExpression(`true`, false, loc);
|
|
2794
2794
|
}
|
|
@@ -2798,7 +2798,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
2798
2798
|
if (dir.name === "if") {
|
|
2799
2799
|
const branch = createIfBranch(node, dir);
|
|
2800
2800
|
const ifNode = {
|
|
2801
|
-
type:
|
|
2801
|
+
type: 9,
|
|
2802
2802
|
loc: node.loc,
|
|
2803
2803
|
branches: [branch]
|
|
2804
2804
|
};
|
|
@@ -2812,25 +2812,25 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
2812
2812
|
let i = siblings.indexOf(node);
|
|
2813
2813
|
while (i-- >= -1) {
|
|
2814
2814
|
const sibling = siblings[i];
|
|
2815
|
-
if (sibling && sibling.type ===
|
|
2815
|
+
if (sibling && sibling.type === 3) {
|
|
2816
2816
|
context.removeNode(sibling);
|
|
2817
2817
|
process.env.NODE_ENV !== "production" && comments.unshift(sibling);
|
|
2818
2818
|
continue;
|
|
2819
2819
|
}
|
|
2820
|
-
if (sibling && sibling.type ===
|
|
2820
|
+
if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
|
|
2821
2821
|
context.removeNode(sibling);
|
|
2822
2822
|
continue;
|
|
2823
2823
|
}
|
|
2824
|
-
if (sibling && sibling.type ===
|
|
2824
|
+
if (sibling && sibling.type === 9) {
|
|
2825
2825
|
if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
|
|
2826
2826
|
context.onError(
|
|
2827
|
-
createCompilerError(
|
|
2827
|
+
createCompilerError(30, node.loc)
|
|
2828
2828
|
);
|
|
2829
2829
|
}
|
|
2830
2830
|
context.removeNode();
|
|
2831
2831
|
const branch = createIfBranch(node, dir);
|
|
2832
2832
|
if (process.env.NODE_ENV !== "production" && comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
|
|
2833
|
-
!(context.parent && context.parent.type ===
|
|
2833
|
+
!(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
|
|
2834
2834
|
branch.children = [...comments, ...branch.children];
|
|
2835
2835
|
}
|
|
2836
2836
|
if (process.env.NODE_ENV !== "production" || false) {
|
|
@@ -2840,7 +2840,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
2840
2840
|
if (isSameKey(userKey, key)) {
|
|
2841
2841
|
context.onError(
|
|
2842
2842
|
createCompilerError(
|
|
2843
|
-
|
|
2843
|
+
29,
|
|
2844
2844
|
branch.userKey.loc
|
|
2845
2845
|
)
|
|
2846
2846
|
);
|
|
@@ -2856,7 +2856,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
2856
2856
|
context.currentNode = null;
|
|
2857
2857
|
} else {
|
|
2858
2858
|
context.onError(
|
|
2859
|
-
createCompilerError(
|
|
2859
|
+
createCompilerError(30, node.loc)
|
|
2860
2860
|
);
|
|
2861
2861
|
}
|
|
2862
2862
|
break;
|
|
@@ -2864,9 +2864,9 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
2864
2864
|
}
|
|
2865
2865
|
}
|
|
2866
2866
|
function createIfBranch(node, dir) {
|
|
2867
|
-
const isTemplateIf = node.tagType ===
|
|
2867
|
+
const isTemplateIf = node.tagType === 3;
|
|
2868
2868
|
return {
|
|
2869
|
-
type:
|
|
2869
|
+
type: 10,
|
|
2870
2870
|
loc: node.loc,
|
|
2871
2871
|
condition: dir.name === "else" ? void 0 : dir.exp,
|
|
2872
2872
|
children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
|
|
@@ -2898,21 +2898,21 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
2898
2898
|
`${keyIndex}`,
|
|
2899
2899
|
false,
|
|
2900
2900
|
locStub,
|
|
2901
|
-
|
|
2901
|
+
2
|
|
2902
2902
|
)
|
|
2903
2903
|
);
|
|
2904
2904
|
const { children } = branch;
|
|
2905
2905
|
const firstChild = children[0];
|
|
2906
|
-
const needFragmentWrapper = children.length !== 1 || firstChild.type !==
|
|
2906
|
+
const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
|
|
2907
2907
|
if (needFragmentWrapper) {
|
|
2908
|
-
if (children.length === 1 && firstChild.type ===
|
|
2908
|
+
if (children.length === 1 && firstChild.type === 11) {
|
|
2909
2909
|
const vnodeCall = firstChild.codegenNode;
|
|
2910
2910
|
injectProp(vnodeCall, keyProperty, context);
|
|
2911
2911
|
return vnodeCall;
|
|
2912
2912
|
} else {
|
|
2913
2913
|
let patchFlag = 64;
|
|
2914
2914
|
let patchFlagText = PatchFlagNames[64];
|
|
2915
|
-
if (process.env.NODE_ENV !== "production" && !branch.isTemplateIf && children.filter((c) => c.type !==
|
|
2915
|
+
if (process.env.NODE_ENV !== "production" && !branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
|
|
2916
2916
|
patchFlag |= 2048;
|
|
2917
2917
|
patchFlagText += `, ${PatchFlagNames[2048]}`;
|
|
2918
2918
|
}
|
|
@@ -2933,8 +2933,8 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
2933
2933
|
} else {
|
|
2934
2934
|
const ret = firstChild.codegenNode;
|
|
2935
2935
|
const vnodeCall = getMemoedVNodeCall(ret);
|
|
2936
|
-
if (vnodeCall.type ===
|
|
2937
|
-
|
|
2936
|
+
if (vnodeCall.type === 13) {
|
|
2937
|
+
convertToBlock(vnodeCall, context);
|
|
2938
2938
|
}
|
|
2939
2939
|
injectProp(vnodeCall, keyProperty, context);
|
|
2940
2940
|
return ret;
|
|
@@ -2944,7 +2944,7 @@ function isSameKey(a, b) {
|
|
|
2944
2944
|
if (!a || a.type !== b.type) {
|
|
2945
2945
|
return false;
|
|
2946
2946
|
}
|
|
2947
|
-
if (a.type ===
|
|
2947
|
+
if (a.type === 6) {
|
|
2948
2948
|
if (a.value.content !== b.value.content) {
|
|
2949
2949
|
return false;
|
|
2950
2950
|
}
|
|
@@ -2954,7 +2954,7 @@ function isSameKey(a, b) {
|
|
|
2954
2954
|
if (exp.type !== branchExp.type) {
|
|
2955
2955
|
return false;
|
|
2956
2956
|
}
|
|
2957
|
-
if (exp.type !==
|
|
2957
|
+
if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
|
|
2958
2958
|
return false;
|
|
2959
2959
|
}
|
|
2960
2960
|
}
|
|
@@ -2962,13 +2962,13 @@ function isSameKey(a, b) {
|
|
|
2962
2962
|
}
|
|
2963
2963
|
function getParentCondition(node) {
|
|
2964
2964
|
while (true) {
|
|
2965
|
-
if (node.type ===
|
|
2966
|
-
if (node.alternate.type ===
|
|
2965
|
+
if (node.type === 19) {
|
|
2966
|
+
if (node.alternate.type === 19) {
|
|
2967
2967
|
node = node.alternate;
|
|
2968
2968
|
} else {
|
|
2969
2969
|
return node;
|
|
2970
2970
|
}
|
|
2971
|
-
} else if (node.type ===
|
|
2971
|
+
} else if (node.type === 20) {
|
|
2972
2972
|
node = node.value;
|
|
2973
2973
|
}
|
|
2974
2974
|
}
|
|
@@ -2985,9 +2985,9 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
2985
2985
|
const isTemplate = isTemplateNode(node);
|
|
2986
2986
|
const memo = findDir(node, "memo");
|
|
2987
2987
|
const keyProp = findProp(node, `key`);
|
|
2988
|
-
const keyExp = keyProp && (keyProp.type ===
|
|
2988
|
+
const keyExp = keyProp && (keyProp.type === 6 ? createSimpleExpression(keyProp.value.content, true) : keyProp.exp);
|
|
2989
2989
|
const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null;
|
|
2990
|
-
const isStableFragment = forNode.source.type ===
|
|
2990
|
+
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
|
|
2991
2991
|
const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
|
|
2992
2992
|
forNode.codegenNode = createVNodeCall(
|
|
2993
2993
|
context,
|
|
@@ -3007,12 +3007,12 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
3007
3007
|
const { children } = forNode;
|
|
3008
3008
|
if ((process.env.NODE_ENV !== "production" || false) && isTemplate) {
|
|
3009
3009
|
node.children.some((c) => {
|
|
3010
|
-
if (c.type ===
|
|
3010
|
+
if (c.type === 1) {
|
|
3011
3011
|
const key = findProp(c, "key");
|
|
3012
3012
|
if (key) {
|
|
3013
3013
|
context.onError(
|
|
3014
3014
|
createCompilerError(
|
|
3015
|
-
|
|
3015
|
+
33,
|
|
3016
3016
|
key.loc
|
|
3017
3017
|
)
|
|
3018
3018
|
);
|
|
@@ -3021,7 +3021,7 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
3021
3021
|
}
|
|
3022
3022
|
});
|
|
3023
3023
|
}
|
|
3024
|
-
const needFragmentWrapper = children.length !== 1 || children[0].type !==
|
|
3024
|
+
const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
|
|
3025
3025
|
const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
|
|
3026
3026
|
if (slotOutlet) {
|
|
3027
3027
|
childBlock = slotOutlet.codegenNode;
|
|
@@ -3108,7 +3108,7 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
3108
3108
|
function processFor(node, dir, context, processCodegen) {
|
|
3109
3109
|
if (!dir.exp) {
|
|
3110
3110
|
context.onError(
|
|
3111
|
-
createCompilerError(
|
|
3111
|
+
createCompilerError(31, dir.loc)
|
|
3112
3112
|
);
|
|
3113
3113
|
return;
|
|
3114
3114
|
}
|
|
@@ -3120,14 +3120,14 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
3120
3120
|
);
|
|
3121
3121
|
if (!parseResult) {
|
|
3122
3122
|
context.onError(
|
|
3123
|
-
createCompilerError(
|
|
3123
|
+
createCompilerError(32, dir.loc)
|
|
3124
3124
|
);
|
|
3125
3125
|
return;
|
|
3126
3126
|
}
|
|
3127
3127
|
const { addIdentifiers, removeIdentifiers, scopes } = context;
|
|
3128
3128
|
const { source, value, key, index } = parseResult;
|
|
3129
3129
|
const forNode = {
|
|
3130
|
-
type:
|
|
3130
|
+
type: 11,
|
|
3131
3131
|
loc: dir.loc,
|
|
3132
3132
|
source,
|
|
3133
3133
|
valueAlias: value,
|
|
@@ -3240,7 +3240,7 @@ function createParamsList(args) {
|
|
|
3240
3240
|
|
|
3241
3241
|
const defaultFallback = createSimpleExpression(`undefined`, false);
|
|
3242
3242
|
const trackSlotScopes = (node, context) => {
|
|
3243
|
-
if (node.type ===
|
|
3243
|
+
if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
|
|
3244
3244
|
const vSlot = findDir(node, "slot");
|
|
3245
3245
|
if (vSlot) {
|
|
3246
3246
|
vSlot.exp;
|
|
@@ -3307,14 +3307,14 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
3307
3307
|
const slotElement = children[i];
|
|
3308
3308
|
let slotDir;
|
|
3309
3309
|
if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
|
|
3310
|
-
if (slotElement.type !==
|
|
3310
|
+
if (slotElement.type !== 3) {
|
|
3311
3311
|
implicitDefaultChildren.push(slotElement);
|
|
3312
3312
|
}
|
|
3313
3313
|
continue;
|
|
3314
3314
|
}
|
|
3315
3315
|
if (onComponentSlot) {
|
|
3316
3316
|
context.onError(
|
|
3317
|
-
createCompilerError(
|
|
3317
|
+
createCompilerError(37, slotDir.loc)
|
|
3318
3318
|
);
|
|
3319
3319
|
break;
|
|
3320
3320
|
}
|
|
@@ -3354,7 +3354,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
3354
3354
|
let prev;
|
|
3355
3355
|
while (j--) {
|
|
3356
3356
|
prev = children[j];
|
|
3357
|
-
if (prev.type !==
|
|
3357
|
+
if (prev.type !== 3) {
|
|
3358
3358
|
break;
|
|
3359
3359
|
}
|
|
3360
3360
|
}
|
|
@@ -3362,7 +3362,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
3362
3362
|
children.splice(i, 1);
|
|
3363
3363
|
i--;
|
|
3364
3364
|
let conditional = dynamicSlots[dynamicSlots.length - 1];
|
|
3365
|
-
while (conditional.alternate.type ===
|
|
3365
|
+
while (conditional.alternate.type === 19) {
|
|
3366
3366
|
conditional = conditional.alternate;
|
|
3367
3367
|
}
|
|
3368
3368
|
conditional.alternate = vElse.exp ? createConditionalExpression(
|
|
@@ -3376,7 +3376,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
3376
3376
|
) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
|
|
3377
3377
|
} else {
|
|
3378
3378
|
context.onError(
|
|
3379
|
-
createCompilerError(
|
|
3379
|
+
createCompilerError(30, vElse.loc)
|
|
3380
3380
|
);
|
|
3381
3381
|
}
|
|
3382
3382
|
} else if (vFor = findDir(slotElement, "for")) {
|
|
@@ -3396,7 +3396,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
3396
3396
|
);
|
|
3397
3397
|
} else {
|
|
3398
3398
|
context.onError(
|
|
3399
|
-
createCompilerError(
|
|
3399
|
+
createCompilerError(32, vFor.loc)
|
|
3400
3400
|
);
|
|
3401
3401
|
}
|
|
3402
3402
|
} else {
|
|
@@ -3404,7 +3404,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
3404
3404
|
if (seenSlotNames.has(staticSlotName)) {
|
|
3405
3405
|
context.onError(
|
|
3406
3406
|
createCompilerError(
|
|
3407
|
-
|
|
3407
|
+
38,
|
|
3408
3408
|
dirLoc
|
|
3409
3409
|
)
|
|
3410
3410
|
);
|
|
@@ -3435,7 +3435,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
3435
3435
|
if (hasNamedDefaultSlot) {
|
|
3436
3436
|
context.onError(
|
|
3437
3437
|
createCompilerError(
|
|
3438
|
-
|
|
3438
|
+
39,
|
|
3439
3439
|
implicitDefaultChildren[0].loc
|
|
3440
3440
|
)
|
|
3441
3441
|
);
|
|
@@ -3488,17 +3488,17 @@ function hasForwardedSlots(children) {
|
|
|
3488
3488
|
for (let i = 0; i < children.length; i++) {
|
|
3489
3489
|
const child = children[i];
|
|
3490
3490
|
switch (child.type) {
|
|
3491
|
-
case
|
|
3492
|
-
if (child.tagType ===
|
|
3491
|
+
case 1:
|
|
3492
|
+
if (child.tagType === 2 || hasForwardedSlots(child.children)) {
|
|
3493
3493
|
return true;
|
|
3494
3494
|
}
|
|
3495
3495
|
break;
|
|
3496
|
-
case
|
|
3496
|
+
case 9:
|
|
3497
3497
|
if (hasForwardedSlots(child.branches))
|
|
3498
3498
|
return true;
|
|
3499
3499
|
break;
|
|
3500
|
-
case
|
|
3501
|
-
case
|
|
3500
|
+
case 10:
|
|
3501
|
+
case 11:
|
|
3502
3502
|
if (hasForwardedSlots(child.children))
|
|
3503
3503
|
return true;
|
|
3504
3504
|
break;
|
|
@@ -3507,20 +3507,20 @@ function hasForwardedSlots(children) {
|
|
|
3507
3507
|
return false;
|
|
3508
3508
|
}
|
|
3509
3509
|
function isNonWhitespaceContent(node) {
|
|
3510
|
-
if (node.type !==
|
|
3510
|
+
if (node.type !== 2 && node.type !== 12)
|
|
3511
3511
|
return true;
|
|
3512
|
-
return node.type ===
|
|
3512
|
+
return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
|
|
3513
3513
|
}
|
|
3514
3514
|
|
|
3515
3515
|
const directiveImportMap = /* @__PURE__ */ new WeakMap();
|
|
3516
3516
|
const transformElement = (node, context) => {
|
|
3517
3517
|
return function postTransformElement() {
|
|
3518
3518
|
node = context.currentNode;
|
|
3519
|
-
if (!(node.type ===
|
|
3519
|
+
if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
|
|
3520
3520
|
return;
|
|
3521
3521
|
}
|
|
3522
3522
|
const { tag, props } = node;
|
|
3523
|
-
const isComponent = node.tagType ===
|
|
3523
|
+
const isComponent = node.tagType === 1;
|
|
3524
3524
|
let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
|
|
3525
3525
|
const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
|
|
3526
3526
|
let vnodeProps;
|
|
@@ -3563,7 +3563,7 @@ const transformElement = (node, context) => {
|
|
|
3563
3563
|
patchFlag |= 1024;
|
|
3564
3564
|
if (process.env.NODE_ENV !== "production" && node.children.length > 1) {
|
|
3565
3565
|
context.onError(
|
|
3566
|
-
createCompilerError(
|
|
3566
|
+
createCompilerError(46, {
|
|
3567
3567
|
start: node.children[0].loc.start,
|
|
3568
3568
|
end: node.children[node.children.length - 1].loc.end,
|
|
3569
3569
|
source: ""
|
|
@@ -3583,11 +3583,11 @@ const transformElement = (node, context) => {
|
|
|
3583
3583
|
} else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
|
|
3584
3584
|
const child = node.children[0];
|
|
3585
3585
|
const type = child.type;
|
|
3586
|
-
const hasDynamicTextChild = type ===
|
|
3586
|
+
const hasDynamicTextChild = type === 5 || type === 8;
|
|
3587
3587
|
if (hasDynamicTextChild && getConstantType(child, context) === 0) {
|
|
3588
3588
|
patchFlag |= 1;
|
|
3589
3589
|
}
|
|
3590
|
-
if (hasDynamicTextChild || type ===
|
|
3590
|
+
if (hasDynamicTextChild || type === 2) {
|
|
3591
3591
|
vnodeChildren = child;
|
|
3592
3592
|
} else {
|
|
3593
3593
|
vnodeChildren = node.children;
|
|
@@ -3635,13 +3635,13 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
3635
3635
|
"COMPILER_IS_ON_ELEMENT",
|
|
3636
3636
|
context
|
|
3637
3637
|
)) {
|
|
3638
|
-
const exp = isProp.type ===
|
|
3638
|
+
const exp = isProp.type === 6 ? isProp.value && createSimpleExpression(isProp.value.content, true) : isProp.exp;
|
|
3639
3639
|
if (exp) {
|
|
3640
3640
|
return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
|
|
3641
3641
|
exp
|
|
3642
3642
|
]);
|
|
3643
3643
|
}
|
|
3644
|
-
} else if (isProp.type ===
|
|
3644
|
+
} else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
|
|
3645
3645
|
tag = isProp.value.content.slice(4);
|
|
3646
3646
|
}
|
|
3647
3647
|
}
|
|
@@ -3700,7 +3700,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3700
3700
|
if (isEventHandler && isReservedProp(name)) {
|
|
3701
3701
|
hasVnodeHook = true;
|
|
3702
3702
|
}
|
|
3703
|
-
if (value.type ===
|
|
3703
|
+
if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
|
|
3704
3704
|
return;
|
|
3705
3705
|
}
|
|
3706
3706
|
if (name === "ref") {
|
|
@@ -3721,7 +3721,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3721
3721
|
};
|
|
3722
3722
|
for (let i = 0; i < props.length; i++) {
|
|
3723
3723
|
const prop = props[i];
|
|
3724
|
-
if (prop.type ===
|
|
3724
|
+
if (prop.type === 6) {
|
|
3725
3725
|
const { loc, name, value } = prop;
|
|
3726
3726
|
let isStatic = true;
|
|
3727
3727
|
if (name === "ref") {
|
|
@@ -3762,7 +3762,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3762
3762
|
if (name === "slot") {
|
|
3763
3763
|
if (!isComponent) {
|
|
3764
3764
|
context.onError(
|
|
3765
|
-
createCompilerError(
|
|
3765
|
+
createCompilerError(40, loc)
|
|
3766
3766
|
);
|
|
3767
3767
|
}
|
|
3768
3768
|
continue;
|
|
@@ -3803,9 +3803,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3803
3803
|
{
|
|
3804
3804
|
if (process.env.NODE_ENV !== "production") {
|
|
3805
3805
|
const hasOverridableKeys = mergeArgs.some((arg2) => {
|
|
3806
|
-
if (arg2.type ===
|
|
3806
|
+
if (arg2.type === 15) {
|
|
3807
3807
|
return arg2.properties.some(({ key }) => {
|
|
3808
|
-
if (key.type !==
|
|
3808
|
+
if (key.type !== 4 || !key.isStatic) {
|
|
3809
3809
|
return true;
|
|
3810
3810
|
}
|
|
3811
3811
|
return key.content !== "class" && key.content !== "style" && !isOn(key.content);
|
|
@@ -3833,7 +3833,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3833
3833
|
mergeArgs.push(exp);
|
|
3834
3834
|
} else {
|
|
3835
3835
|
pushMergeArg({
|
|
3836
|
-
type:
|
|
3836
|
+
type: 14,
|
|
3837
3837
|
loc,
|
|
3838
3838
|
callee: context.helper(TO_HANDLERS),
|
|
3839
3839
|
arguments: isComponent ? [exp] : [exp, `true`]
|
|
@@ -3842,7 +3842,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3842
3842
|
} else {
|
|
3843
3843
|
context.onError(
|
|
3844
3844
|
createCompilerError(
|
|
3845
|
-
isVBind ?
|
|
3845
|
+
isVBind ? 34 : 35,
|
|
3846
3846
|
loc
|
|
3847
3847
|
)
|
|
3848
3848
|
);
|
|
@@ -3911,7 +3911,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3911
3911
|
}
|
|
3912
3912
|
if (!context.inSSR && propsExpression) {
|
|
3913
3913
|
switch (propsExpression.type) {
|
|
3914
|
-
case
|
|
3914
|
+
case 15:
|
|
3915
3915
|
let classKeyIndex = -1;
|
|
3916
3916
|
let styleKeyIndex = -1;
|
|
3917
3917
|
let hasDynamicKey = false;
|
|
@@ -3938,9 +3938,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3938
3938
|
}
|
|
3939
3939
|
if (styleProp && // the static style is compiled into an object,
|
|
3940
3940
|
// so use `hasStyleBinding` to ensure that it is a dynamic style binding
|
|
3941
|
-
(hasStyleBinding || styleProp.value.type ===
|
|
3941
|
+
(hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
|
|
3942
3942
|
// v-bind:style with static literal object
|
|
3943
|
-
styleProp.value.type ===
|
|
3943
|
+
styleProp.value.type === 17)) {
|
|
3944
3944
|
styleProp.value = createCallExpression(
|
|
3945
3945
|
context.helper(NORMALIZE_STYLE),
|
|
3946
3946
|
[styleProp.value]
|
|
@@ -3953,7 +3953,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3953
3953
|
);
|
|
3954
3954
|
}
|
|
3955
3955
|
break;
|
|
3956
|
-
case
|
|
3956
|
+
case 14:
|
|
3957
3957
|
break;
|
|
3958
3958
|
default:
|
|
3959
3959
|
propsExpression = createCallExpression(
|
|
@@ -3980,7 +3980,7 @@ function dedupeProperties(properties) {
|
|
|
3980
3980
|
const deduped = [];
|
|
3981
3981
|
for (let i = 0; i < properties.length; i++) {
|
|
3982
3982
|
const prop = properties[i];
|
|
3983
|
-
if (prop.key.type ===
|
|
3983
|
+
if (prop.key.type === 8 || !prop.key.isStatic) {
|
|
3984
3984
|
deduped.push(prop);
|
|
3985
3985
|
continue;
|
|
3986
3986
|
}
|
|
@@ -3998,7 +3998,7 @@ function dedupeProperties(properties) {
|
|
|
3998
3998
|
return deduped;
|
|
3999
3999
|
}
|
|
4000
4000
|
function mergeAsArray(existing, incoming) {
|
|
4001
|
-
if (existing.value.type ===
|
|
4001
|
+
if (existing.value.type === 17) {
|
|
4002
4002
|
existing.value.elements.push(incoming.value);
|
|
4003
4003
|
} else {
|
|
4004
4004
|
existing.value = createArrayExpression(
|
|
@@ -4097,7 +4097,7 @@ function processSlotOutlet(node, context) {
|
|
|
4097
4097
|
const nonNameProps = [];
|
|
4098
4098
|
for (let i = 0; i < node.props.length; i++) {
|
|
4099
4099
|
const p = node.props[i];
|
|
4100
|
-
if (p.type ===
|
|
4100
|
+
if (p.type === 6) {
|
|
4101
4101
|
if (p.value) {
|
|
4102
4102
|
if (p.name === "name") {
|
|
4103
4103
|
slotName = JSON.stringify(p.value.content);
|
|
@@ -4130,7 +4130,7 @@ function processSlotOutlet(node, context) {
|
|
|
4130
4130
|
if (directives.length) {
|
|
4131
4131
|
context.onError(
|
|
4132
4132
|
createCompilerError(
|
|
4133
|
-
|
|
4133
|
+
36,
|
|
4134
4134
|
directives[0].loc
|
|
4135
4135
|
)
|
|
4136
4136
|
);
|
|
@@ -4146,16 +4146,16 @@ const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+
|
|
|
4146
4146
|
const transformOn = (dir, node, context, augmentor) => {
|
|
4147
4147
|
const { loc, modifiers, arg } = dir;
|
|
4148
4148
|
if (!dir.exp && !modifiers.length) {
|
|
4149
|
-
context.onError(createCompilerError(
|
|
4149
|
+
context.onError(createCompilerError(35, loc));
|
|
4150
4150
|
}
|
|
4151
4151
|
let eventName;
|
|
4152
|
-
if (arg.type ===
|
|
4152
|
+
if (arg.type === 4) {
|
|
4153
4153
|
if (arg.isStatic) {
|
|
4154
4154
|
let rawName = arg.content;
|
|
4155
4155
|
if (rawName.startsWith("vue:")) {
|
|
4156
4156
|
rawName = `vnode-${rawName.slice(4)}`;
|
|
4157
4157
|
}
|
|
4158
|
-
const eventString = node.tagType !==
|
|
4158
|
+
const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
|
|
4159
4159
|
// for non-element and vnode lifecycle event listeners, auto convert
|
|
4160
4160
|
// it to camelCase. See issue #2249
|
|
4161
4161
|
toHandlerKey(camelize(rawName))
|
|
@@ -4223,14 +4223,14 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
4223
4223
|
const transformBind = (dir, _node, context) => {
|
|
4224
4224
|
const { exp, modifiers, loc } = dir;
|
|
4225
4225
|
const arg = dir.arg;
|
|
4226
|
-
if (arg.type !==
|
|
4226
|
+
if (arg.type !== 4) {
|
|
4227
4227
|
arg.children.unshift(`(`);
|
|
4228
4228
|
arg.children.push(`) || ""`);
|
|
4229
4229
|
} else if (!arg.isStatic) {
|
|
4230
4230
|
arg.content = `${arg.content} || ""`;
|
|
4231
4231
|
}
|
|
4232
4232
|
if (modifiers.includes("camel")) {
|
|
4233
|
-
if (arg.type ===
|
|
4233
|
+
if (arg.type === 4) {
|
|
4234
4234
|
if (arg.isStatic) {
|
|
4235
4235
|
arg.content = camelize(arg.content);
|
|
4236
4236
|
} else {
|
|
@@ -4249,8 +4249,8 @@ const transformBind = (dir, _node, context) => {
|
|
|
4249
4249
|
injectPrefix(arg, "^");
|
|
4250
4250
|
}
|
|
4251
4251
|
}
|
|
4252
|
-
if (!exp || exp.type ===
|
|
4253
|
-
context.onError(createCompilerError(
|
|
4252
|
+
if (!exp || exp.type === 4 && !exp.content.trim()) {
|
|
4253
|
+
context.onError(createCompilerError(34, loc));
|
|
4254
4254
|
return {
|
|
4255
4255
|
props: [createObjectProperty(arg, createSimpleExpression("", true, loc))]
|
|
4256
4256
|
};
|
|
@@ -4260,7 +4260,7 @@ const transformBind = (dir, _node, context) => {
|
|
|
4260
4260
|
};
|
|
4261
4261
|
};
|
|
4262
4262
|
const injectPrefix = (arg, prefix) => {
|
|
4263
|
-
if (arg.type ===
|
|
4263
|
+
if (arg.type === 4) {
|
|
4264
4264
|
if (arg.isStatic) {
|
|
4265
4265
|
arg.content = prefix + arg.content;
|
|
4266
4266
|
} else {
|
|
@@ -4273,7 +4273,7 @@ const injectPrefix = (arg, prefix) => {
|
|
|
4273
4273
|
};
|
|
4274
4274
|
|
|
4275
4275
|
const transformText = (node, context) => {
|
|
4276
|
-
if (node.type ===
|
|
4276
|
+
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
4277
4277
|
return () => {
|
|
4278
4278
|
const children = node.children;
|
|
4279
4279
|
let currentContainer = void 0;
|
|
@@ -4305,13 +4305,13 @@ const transformText = (node, context) => {
|
|
|
4305
4305
|
// as-is since the runtime has dedicated fast path for this by directly
|
|
4306
4306
|
// setting textContent of the element.
|
|
4307
4307
|
// for component root it's always normalized anyway.
|
|
4308
|
-
children.length === 1 && (node.type ===
|
|
4308
|
+
children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
|
|
4309
4309
|
// custom directives can potentially add DOM elements arbitrarily,
|
|
4310
4310
|
// we need to avoid setting textContent of the element at runtime
|
|
4311
4311
|
// to avoid accidentally overwriting the DOM elements added
|
|
4312
4312
|
// by the user through custom directives.
|
|
4313
4313
|
!node.props.find(
|
|
4314
|
-
(p) => p.type ===
|
|
4314
|
+
(p) => p.type === 7 && !context.directiveTransforms[p.name]
|
|
4315
4315
|
) && // in compat mode, <template> tags with no special directives
|
|
4316
4316
|
// will be rendered as a fragment so its children must be
|
|
4317
4317
|
// converted into vnodes.
|
|
@@ -4320,9 +4320,9 @@ const transformText = (node, context) => {
|
|
|
4320
4320
|
}
|
|
4321
4321
|
for (let i = 0; i < children.length; i++) {
|
|
4322
4322
|
const child = children[i];
|
|
4323
|
-
if (isText$1(child) || child.type ===
|
|
4323
|
+
if (isText$1(child) || child.type === 8) {
|
|
4324
4324
|
const callArgs = [];
|
|
4325
|
-
if (child.type !==
|
|
4325
|
+
if (child.type !== 2 || child.content !== " ") {
|
|
4326
4326
|
callArgs.push(child);
|
|
4327
4327
|
}
|
|
4328
4328
|
if (!context.ssr && getConstantType(child, context) === 0) {
|
|
@@ -4331,7 +4331,7 @@ const transformText = (node, context) => {
|
|
|
4331
4331
|
);
|
|
4332
4332
|
}
|
|
4333
4333
|
children[i] = {
|
|
4334
|
-
type:
|
|
4334
|
+
type: 12,
|
|
4335
4335
|
content: child,
|
|
4336
4336
|
loc: child.loc,
|
|
4337
4337
|
codegenNode: createCallExpression(
|
|
@@ -4347,7 +4347,7 @@ const transformText = (node, context) => {
|
|
|
4347
4347
|
|
|
4348
4348
|
const seen$1 = /* @__PURE__ */ new WeakSet();
|
|
4349
4349
|
const transformOnce = (node, context) => {
|
|
4350
|
-
if (node.type ===
|
|
4350
|
+
if (node.type === 1 && findDir(node, "once", true)) {
|
|
4351
4351
|
if (seen$1.has(node) || context.inVOnce) {
|
|
4352
4352
|
return;
|
|
4353
4353
|
}
|
|
@@ -4372,21 +4372,21 @@ const transformModel = (dir, node, context) => {
|
|
|
4372
4372
|
const { exp, arg } = dir;
|
|
4373
4373
|
if (!exp) {
|
|
4374
4374
|
context.onError(
|
|
4375
|
-
createCompilerError(
|
|
4375
|
+
createCompilerError(41, dir.loc)
|
|
4376
4376
|
);
|
|
4377
4377
|
return createTransformProps();
|
|
4378
4378
|
}
|
|
4379
4379
|
const rawExp = exp.loc.source;
|
|
4380
|
-
const expString = exp.type ===
|
|
4380
|
+
const expString = exp.type === 4 ? exp.content : rawExp;
|
|
4381
4381
|
const bindingType = context.bindingMetadata[rawExp];
|
|
4382
4382
|
if (bindingType === "props" || bindingType === "props-aliased") {
|
|
4383
|
-
context.onError(createCompilerError(
|
|
4383
|
+
context.onError(createCompilerError(44, exp.loc));
|
|
4384
4384
|
return createTransformProps();
|
|
4385
4385
|
}
|
|
4386
4386
|
const maybeRef = false;
|
|
4387
4387
|
if (!expString.trim() || !isMemberExpression(expString) && !maybeRef) {
|
|
4388
4388
|
context.onError(
|
|
4389
|
-
createCompilerError(
|
|
4389
|
+
createCompilerError(42, exp.loc)
|
|
4390
4390
|
);
|
|
4391
4391
|
return createTransformProps();
|
|
4392
4392
|
}
|
|
@@ -4407,7 +4407,7 @@ const transformModel = (dir, node, context) => {
|
|
|
4407
4407
|
// "onUpdate:modelValue": $event => (foo = $event)
|
|
4408
4408
|
createObjectProperty(eventName, assignmentExp)
|
|
4409
4409
|
];
|
|
4410
|
-
if (dir.modifiers.length && node.tagType ===
|
|
4410
|
+
if (dir.modifiers.length && node.tagType === 1) {
|
|
4411
4411
|
const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
|
|
4412
4412
|
const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
|
|
4413
4413
|
props.push(
|
|
@@ -4417,7 +4417,7 @@ const transformModel = (dir, node, context) => {
|
|
|
4417
4417
|
`{ ${modifiers} }`,
|
|
4418
4418
|
false,
|
|
4419
4419
|
dir.loc,
|
|
4420
|
-
|
|
4420
|
+
2
|
|
4421
4421
|
)
|
|
4422
4422
|
)
|
|
4423
4423
|
);
|
|
@@ -4433,30 +4433,30 @@ const transformFilter = (node, context) => {
|
|
|
4433
4433
|
if (!isCompatEnabled("COMPILER_FILTER", context)) {
|
|
4434
4434
|
return;
|
|
4435
4435
|
}
|
|
4436
|
-
if (node.type ===
|
|
4436
|
+
if (node.type === 5) {
|
|
4437
4437
|
rewriteFilter(node.content, context);
|
|
4438
4438
|
}
|
|
4439
|
-
if (node.type ===
|
|
4439
|
+
if (node.type === 1) {
|
|
4440
4440
|
node.props.forEach((prop) => {
|
|
4441
|
-
if (prop.type ===
|
|
4441
|
+
if (prop.type === 7 && prop.name !== "for" && prop.exp) {
|
|
4442
4442
|
rewriteFilter(prop.exp, context);
|
|
4443
4443
|
}
|
|
4444
4444
|
});
|
|
4445
4445
|
}
|
|
4446
4446
|
};
|
|
4447
4447
|
function rewriteFilter(node, context) {
|
|
4448
|
-
if (node.type ===
|
|
4448
|
+
if (node.type === 4) {
|
|
4449
4449
|
parseFilter(node, context);
|
|
4450
4450
|
} else {
|
|
4451
4451
|
for (let i = 0; i < node.children.length; i++) {
|
|
4452
4452
|
const child = node.children[i];
|
|
4453
4453
|
if (typeof child !== "object")
|
|
4454
4454
|
continue;
|
|
4455
|
-
if (child.type ===
|
|
4455
|
+
if (child.type === 4) {
|
|
4456
4456
|
parseFilter(child, context);
|
|
4457
|
-
} else if (child.type ===
|
|
4457
|
+
} else if (child.type === 8) {
|
|
4458
4458
|
rewriteFilter(node, context);
|
|
4459
|
-
} else if (child.type ===
|
|
4459
|
+
} else if (child.type === 5) {
|
|
4460
4460
|
rewriteFilter(child.content, context);
|
|
4461
4461
|
}
|
|
4462
4462
|
}
|
|
@@ -4577,7 +4577,7 @@ function wrapFilter(exp, filter, context) {
|
|
|
4577
4577
|
|
|
4578
4578
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
4579
4579
|
const transformMemo = (node, context) => {
|
|
4580
|
-
if (node.type ===
|
|
4580
|
+
if (node.type === 1) {
|
|
4581
4581
|
const dir = findDir(node, "memo");
|
|
4582
4582
|
if (!dir || seen.has(node)) {
|
|
4583
4583
|
return;
|
|
@@ -4585,9 +4585,9 @@ const transformMemo = (node, context) => {
|
|
|
4585
4585
|
seen.add(node);
|
|
4586
4586
|
return () => {
|
|
4587
4587
|
const codegenNode = node.codegenNode || context.currentNode.codegenNode;
|
|
4588
|
-
if (codegenNode && codegenNode.type ===
|
|
4589
|
-
if (node.tagType !==
|
|
4590
|
-
|
|
4588
|
+
if (codegenNode && codegenNode.type === 13) {
|
|
4589
|
+
if (node.tagType !== 1) {
|
|
4590
|
+
convertToBlock(codegenNode, context);
|
|
4591
4591
|
}
|
|
4592
4592
|
node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
|
|
4593
4593
|
dir.exp,
|
|
@@ -4626,17 +4626,17 @@ function baseCompile(template, options = {}) {
|
|
|
4626
4626
|
const isModuleMode = options.mode === "module";
|
|
4627
4627
|
{
|
|
4628
4628
|
if (options.prefixIdentifiers === true) {
|
|
4629
|
-
onError(createCompilerError(
|
|
4629
|
+
onError(createCompilerError(47));
|
|
4630
4630
|
} else if (isModuleMode) {
|
|
4631
|
-
onError(createCompilerError(
|
|
4631
|
+
onError(createCompilerError(48));
|
|
4632
4632
|
}
|
|
4633
4633
|
}
|
|
4634
4634
|
const prefixIdentifiers = false;
|
|
4635
4635
|
if (options.cacheHandlers) {
|
|
4636
|
-
onError(createCompilerError(
|
|
4636
|
+
onError(createCompilerError(49));
|
|
4637
4637
|
}
|
|
4638
4638
|
if (options.scopeId && !isModuleMode) {
|
|
4639
|
-
onError(createCompilerError(
|
|
4639
|
+
onError(createCompilerError(50));
|
|
4640
4640
|
}
|
|
4641
4641
|
const ast = isString(template) ? baseParse(template, options) : template;
|
|
4642
4642
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
|
|
@@ -4667,4 +4667,4 @@ function baseCompile(template, options = {}) {
|
|
|
4667
4667
|
|
|
4668
4668
|
const noopDirectiveTransform = () => ({ props: [] });
|
|
4669
4669
|
|
|
4670
|
-
export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, getBaseTransformPreset, getConstantType, getInnerRange, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isBuiltInType, isCoreComponent, isFunctionType, isInDestructureAssignment, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVSlot, locStub,
|
|
4670
|
+
export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, convertToBlock, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, getBaseTransformPreset, getConstantType, getInnerRange, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isBuiltInType, isCoreComponent, isFunctionType, isInDestructureAssignment, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVSlot, locStub, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
|