@vue/compat 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/vue.cjs.js +626 -610
- package/dist/vue.cjs.prod.js +592 -594
- package/dist/vue.esm-browser.js +566 -560
- package/dist/vue.esm-browser.prod.js +1 -1
- package/dist/vue.esm-bundler.js +577 -561
- package/dist/vue.global.js +566 -560
- package/dist/vue.global.prod.js +1 -1
- package/dist/vue.runtime.esm-browser.js +157 -151
- package/dist/vue.runtime.esm-browser.prod.js +1 -1
- package/dist/vue.runtime.esm-bundler.js +168 -152
- package/dist/vue.runtime.global.js +157 -151
- package/dist/vue.runtime.global.prod.js +1 -1
- package/package.json +2 -2
package/dist/vue.cjs.js
CHANGED
|
@@ -13,6 +13,100 @@ function makeMap(str, expectsLowerCase) {
|
|
|
13
13
|
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
const EMPTY_OBJ = Object.freeze({}) ;
|
|
17
|
+
const EMPTY_ARR = Object.freeze([]) ;
|
|
18
|
+
const NOOP = () => {
|
|
19
|
+
};
|
|
20
|
+
const NO = () => false;
|
|
21
|
+
const onRE = /^on[^a-z]/;
|
|
22
|
+
const isOn = (key) => onRE.test(key);
|
|
23
|
+
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
24
|
+
const extend = Object.assign;
|
|
25
|
+
const remove = (arr, el) => {
|
|
26
|
+
const i = arr.indexOf(el);
|
|
27
|
+
if (i > -1) {
|
|
28
|
+
arr.splice(i, 1);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
32
|
+
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
|
|
33
|
+
const isArray = Array.isArray;
|
|
34
|
+
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
35
|
+
const isSet = (val) => toTypeString(val) === "[object Set]";
|
|
36
|
+
const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
37
|
+
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
|
38
|
+
const isFunction = (val) => typeof val === "function";
|
|
39
|
+
const isString = (val) => typeof val === "string";
|
|
40
|
+
const isSymbol = (val) => typeof val === "symbol";
|
|
41
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
42
|
+
const isPromise = (val) => {
|
|
43
|
+
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
44
|
+
};
|
|
45
|
+
const objectToString = Object.prototype.toString;
|
|
46
|
+
const toTypeString = (value) => objectToString.call(value);
|
|
47
|
+
const toRawType = (value) => {
|
|
48
|
+
return toTypeString(value).slice(8, -1);
|
|
49
|
+
};
|
|
50
|
+
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
51
|
+
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
52
|
+
const isReservedProp = /* @__PURE__ */ makeMap(
|
|
53
|
+
// the leading comma is intentional so empty string "" is also included
|
|
54
|
+
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
55
|
+
);
|
|
56
|
+
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
57
|
+
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
58
|
+
);
|
|
59
|
+
const cacheStringFunction = (fn) => {
|
|
60
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
61
|
+
return (str) => {
|
|
62
|
+
const hit = cache[str];
|
|
63
|
+
return hit || (cache[str] = fn(str));
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
const camelizeRE = /-(\w)/g;
|
|
67
|
+
const camelize = cacheStringFunction((str) => {
|
|
68
|
+
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
69
|
+
});
|
|
70
|
+
const hyphenateRE = /\B([A-Z])/g;
|
|
71
|
+
const hyphenate = cacheStringFunction(
|
|
72
|
+
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
|
73
|
+
);
|
|
74
|
+
const capitalize = cacheStringFunction(
|
|
75
|
+
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
76
|
+
);
|
|
77
|
+
const toHandlerKey = cacheStringFunction(
|
|
78
|
+
(str) => str ? `on${capitalize(str)}` : ``
|
|
79
|
+
);
|
|
80
|
+
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
81
|
+
const invokeArrayFns = (fns, arg) => {
|
|
82
|
+
for (let i = 0; i < fns.length; i++) {
|
|
83
|
+
fns[i](arg);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const def = (obj, key, value) => {
|
|
87
|
+
Object.defineProperty(obj, key, {
|
|
88
|
+
configurable: true,
|
|
89
|
+
enumerable: false,
|
|
90
|
+
value
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
const looseToNumber = (val) => {
|
|
94
|
+
const n = parseFloat(val);
|
|
95
|
+
return isNaN(n) ? val : n;
|
|
96
|
+
};
|
|
97
|
+
const toNumber = (val) => {
|
|
98
|
+
const n = isString(val) ? Number(val) : NaN;
|
|
99
|
+
return isNaN(n) ? val : n;
|
|
100
|
+
};
|
|
101
|
+
let _globalThis;
|
|
102
|
+
const getGlobalThis = () => {
|
|
103
|
+
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
104
|
+
};
|
|
105
|
+
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
106
|
+
function genPropsAccessExp(name) {
|
|
107
|
+
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
|
108
|
+
}
|
|
109
|
+
|
|
16
110
|
const PatchFlagNames = {
|
|
17
111
|
[1]: `TEXT`,
|
|
18
112
|
[2]: `CLASS`,
|
|
@@ -295,100 +389,6 @@ const replacer = (_key, val) => {
|
|
|
295
389
|
return val;
|
|
296
390
|
};
|
|
297
391
|
|
|
298
|
-
const EMPTY_OBJ = Object.freeze({}) ;
|
|
299
|
-
const EMPTY_ARR = Object.freeze([]) ;
|
|
300
|
-
const NOOP = () => {
|
|
301
|
-
};
|
|
302
|
-
const NO = () => false;
|
|
303
|
-
const onRE = /^on[^a-z]/;
|
|
304
|
-
const isOn = (key) => onRE.test(key);
|
|
305
|
-
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
306
|
-
const extend = Object.assign;
|
|
307
|
-
const remove = (arr, el) => {
|
|
308
|
-
const i = arr.indexOf(el);
|
|
309
|
-
if (i > -1) {
|
|
310
|
-
arr.splice(i, 1);
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
314
|
-
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
|
|
315
|
-
const isArray = Array.isArray;
|
|
316
|
-
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
317
|
-
const isSet = (val) => toTypeString(val) === "[object Set]";
|
|
318
|
-
const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
319
|
-
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
|
320
|
-
const isFunction = (val) => typeof val === "function";
|
|
321
|
-
const isString = (val) => typeof val === "string";
|
|
322
|
-
const isSymbol = (val) => typeof val === "symbol";
|
|
323
|
-
const isObject = (val) => val !== null && typeof val === "object";
|
|
324
|
-
const isPromise = (val) => {
|
|
325
|
-
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
326
|
-
};
|
|
327
|
-
const objectToString = Object.prototype.toString;
|
|
328
|
-
const toTypeString = (value) => objectToString.call(value);
|
|
329
|
-
const toRawType = (value) => {
|
|
330
|
-
return toTypeString(value).slice(8, -1);
|
|
331
|
-
};
|
|
332
|
-
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
333
|
-
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
334
|
-
const isReservedProp = /* @__PURE__ */ makeMap(
|
|
335
|
-
// the leading comma is intentional so empty string "" is also included
|
|
336
|
-
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
337
|
-
);
|
|
338
|
-
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
339
|
-
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
340
|
-
);
|
|
341
|
-
const cacheStringFunction = (fn) => {
|
|
342
|
-
const cache = /* @__PURE__ */ Object.create(null);
|
|
343
|
-
return (str) => {
|
|
344
|
-
const hit = cache[str];
|
|
345
|
-
return hit || (cache[str] = fn(str));
|
|
346
|
-
};
|
|
347
|
-
};
|
|
348
|
-
const camelizeRE = /-(\w)/g;
|
|
349
|
-
const camelize = cacheStringFunction((str) => {
|
|
350
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
351
|
-
});
|
|
352
|
-
const hyphenateRE = /\B([A-Z])/g;
|
|
353
|
-
const hyphenate = cacheStringFunction(
|
|
354
|
-
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
|
355
|
-
);
|
|
356
|
-
const capitalize = cacheStringFunction(
|
|
357
|
-
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
358
|
-
);
|
|
359
|
-
const toHandlerKey = cacheStringFunction(
|
|
360
|
-
(str) => str ? `on${capitalize(str)}` : ``
|
|
361
|
-
);
|
|
362
|
-
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
363
|
-
const invokeArrayFns = (fns, arg) => {
|
|
364
|
-
for (let i = 0; i < fns.length; i++) {
|
|
365
|
-
fns[i](arg);
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
const def = (obj, key, value) => {
|
|
369
|
-
Object.defineProperty(obj, key, {
|
|
370
|
-
configurable: true,
|
|
371
|
-
enumerable: false,
|
|
372
|
-
value
|
|
373
|
-
});
|
|
374
|
-
};
|
|
375
|
-
const looseToNumber = (val) => {
|
|
376
|
-
const n = parseFloat(val);
|
|
377
|
-
return isNaN(n) ? val : n;
|
|
378
|
-
};
|
|
379
|
-
const toNumber = (val) => {
|
|
380
|
-
const n = isString(val) ? Number(val) : NaN;
|
|
381
|
-
return isNaN(n) ? val : n;
|
|
382
|
-
};
|
|
383
|
-
let _globalThis;
|
|
384
|
-
const getGlobalThis = () => {
|
|
385
|
-
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
386
|
-
};
|
|
387
|
-
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
388
|
-
function genPropsAccessExp(name) {
|
|
389
|
-
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
392
|
function warn$1(msg, ...args) {
|
|
393
393
|
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
394
394
|
}
|
|
@@ -1538,7 +1538,7 @@ function warn(msg, ...args) {
|
|
|
1538
1538
|
callWithErrorHandling(
|
|
1539
1539
|
appWarnHandler,
|
|
1540
1540
|
instance,
|
|
1541
|
-
|
|
1541
|
+
11,
|
|
1542
1542
|
[
|
|
1543
1543
|
msg + args.join(""),
|
|
1544
1544
|
instance && instance.proxy,
|
|
@@ -1651,21 +1651,21 @@ const ErrorTypeStrings = {
|
|
|
1651
1651
|
["ec"]: "errorCaptured hook",
|
|
1652
1652
|
["rtc"]: "renderTracked hook",
|
|
1653
1653
|
["rtg"]: "renderTriggered hook",
|
|
1654
|
-
[
|
|
1655
|
-
[
|
|
1656
|
-
[
|
|
1657
|
-
[
|
|
1658
|
-
[
|
|
1659
|
-
[
|
|
1660
|
-
[
|
|
1661
|
-
[
|
|
1662
|
-
[
|
|
1663
|
-
[
|
|
1664
|
-
[
|
|
1665
|
-
[
|
|
1666
|
-
[
|
|
1667
|
-
[
|
|
1668
|
-
[
|
|
1654
|
+
[0]: "setup function",
|
|
1655
|
+
[1]: "render function",
|
|
1656
|
+
[2]: "watcher getter",
|
|
1657
|
+
[3]: "watcher callback",
|
|
1658
|
+
[4]: "watcher cleanup function",
|
|
1659
|
+
[5]: "native event handler",
|
|
1660
|
+
[6]: "component event handler",
|
|
1661
|
+
[7]: "vnode hook",
|
|
1662
|
+
[8]: "directive hook",
|
|
1663
|
+
[9]: "transition hook",
|
|
1664
|
+
[10]: "app errorHandler",
|
|
1665
|
+
[11]: "app warnHandler",
|
|
1666
|
+
[12]: "ref function",
|
|
1667
|
+
[13]: "async component loader",
|
|
1668
|
+
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"
|
|
1669
1669
|
};
|
|
1670
1670
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
1671
1671
|
let res;
|
|
@@ -1714,7 +1714,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
1714
1714
|
callWithErrorHandling(
|
|
1715
1715
|
appErrorHandler,
|
|
1716
1716
|
null,
|
|
1717
|
-
|
|
1717
|
+
10,
|
|
1718
1718
|
[err, exposedInstance, errorInfo]
|
|
1719
1719
|
);
|
|
1720
1720
|
return;
|
|
@@ -1867,7 +1867,7 @@ function flushJobs(seen) {
|
|
|
1867
1867
|
if (check(job)) {
|
|
1868
1868
|
continue;
|
|
1869
1869
|
}
|
|
1870
|
-
callWithErrorHandling(job, null,
|
|
1870
|
+
callWithErrorHandling(job, null, 14);
|
|
1871
1871
|
}
|
|
1872
1872
|
}
|
|
1873
1873
|
} finally {
|
|
@@ -2485,7 +2485,7 @@ function emit$1(instance, event, args) {
|
|
|
2485
2485
|
callWithAsyncErrorHandling(
|
|
2486
2486
|
cbs.map((cb) => cb.bind(instance.proxy)),
|
|
2487
2487
|
instance,
|
|
2488
|
-
|
|
2488
|
+
6,
|
|
2489
2489
|
args
|
|
2490
2490
|
);
|
|
2491
2491
|
}
|
|
@@ -2547,7 +2547,7 @@ function compatModelEmit(instance, event, args) {
|
|
|
2547
2547
|
callWithErrorHandling(
|
|
2548
2548
|
modelHandler,
|
|
2549
2549
|
instance,
|
|
2550
|
-
|
|
2550
|
+
6,
|
|
2551
2551
|
args
|
|
2552
2552
|
);
|
|
2553
2553
|
}
|
|
@@ -2619,7 +2619,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
2619
2619
|
callWithAsyncErrorHandling(
|
|
2620
2620
|
handler,
|
|
2621
2621
|
instance,
|
|
2622
|
-
|
|
2622
|
+
6,
|
|
2623
2623
|
args
|
|
2624
2624
|
);
|
|
2625
2625
|
}
|
|
@@ -2634,7 +2634,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
2634
2634
|
callWithAsyncErrorHandling(
|
|
2635
2635
|
onceHandler,
|
|
2636
2636
|
instance,
|
|
2637
|
-
|
|
2637
|
+
6,
|
|
2638
2638
|
args
|
|
2639
2639
|
);
|
|
2640
2640
|
}
|
|
@@ -2818,7 +2818,7 @@ function renderComponentRoot(instance) {
|
|
|
2818
2818
|
}
|
|
2819
2819
|
} catch (err) {
|
|
2820
2820
|
blockStack.length = 0;
|
|
2821
|
-
handleError(err, instance,
|
|
2821
|
+
handleError(err, instance, 1);
|
|
2822
2822
|
result = createVNode(Comment);
|
|
2823
2823
|
}
|
|
2824
2824
|
let root = result;
|
|
@@ -3345,7 +3345,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
3345
3345
|
if (delayEnter) {
|
|
3346
3346
|
activeBranch.transition.afterLeave = () => {
|
|
3347
3347
|
if (pendingId === suspense.pendingId) {
|
|
3348
|
-
move(pendingBranch, container2, anchor2,
|
|
3348
|
+
move(pendingBranch, container2, anchor2, 0);
|
|
3349
3349
|
}
|
|
3350
3350
|
};
|
|
3351
3351
|
}
|
|
@@ -3355,7 +3355,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
3355
3355
|
unmount(activeBranch, parentComponent2, suspense, true);
|
|
3356
3356
|
}
|
|
3357
3357
|
if (!delayEnter) {
|
|
3358
|
-
move(pendingBranch, container2, anchor2,
|
|
3358
|
+
move(pendingBranch, container2, anchor2, 0);
|
|
3359
3359
|
}
|
|
3360
3360
|
}
|
|
3361
3361
|
setActiveBranch(suspense, pendingBranch);
|
|
@@ -3433,7 +3433,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
3433
3433
|
}
|
|
3434
3434
|
const hydratedEl = instance.vnode.el;
|
|
3435
3435
|
instance.asyncDep.catch((err) => {
|
|
3436
|
-
handleError(err, instance,
|
|
3436
|
+
handleError(err, instance, 0);
|
|
3437
3437
|
}).then((asyncSetupResult) => {
|
|
3438
3438
|
if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
|
|
3439
3439
|
return;
|
|
@@ -3677,14 +3677,14 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3677
3677
|
} else if (isReactive(s)) {
|
|
3678
3678
|
return traverse(s);
|
|
3679
3679
|
} else if (isFunction(s)) {
|
|
3680
|
-
return callWithErrorHandling(s, instance,
|
|
3680
|
+
return callWithErrorHandling(s, instance, 2);
|
|
3681
3681
|
} else {
|
|
3682
3682
|
warnInvalidSource(s);
|
|
3683
3683
|
}
|
|
3684
3684
|
});
|
|
3685
3685
|
} else if (isFunction(source)) {
|
|
3686
3686
|
if (cb) {
|
|
3687
|
-
getter = () => callWithErrorHandling(source, instance,
|
|
3687
|
+
getter = () => callWithErrorHandling(source, instance, 2);
|
|
3688
3688
|
} else {
|
|
3689
3689
|
getter = () => {
|
|
3690
3690
|
if (instance && instance.isUnmounted) {
|
|
@@ -3696,7 +3696,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3696
3696
|
return callWithAsyncErrorHandling(
|
|
3697
3697
|
source,
|
|
3698
3698
|
instance,
|
|
3699
|
-
|
|
3699
|
+
3,
|
|
3700
3700
|
[onCleanup]
|
|
3701
3701
|
);
|
|
3702
3702
|
};
|
|
@@ -3722,7 +3722,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3722
3722
|
let cleanup;
|
|
3723
3723
|
let onCleanup = (fn) => {
|
|
3724
3724
|
cleanup = effect.onStop = () => {
|
|
3725
|
-
callWithErrorHandling(fn, instance,
|
|
3725
|
+
callWithErrorHandling(fn, instance, 4);
|
|
3726
3726
|
};
|
|
3727
3727
|
};
|
|
3728
3728
|
let ssrCleanup;
|
|
@@ -3731,7 +3731,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3731
3731
|
if (!cb) {
|
|
3732
3732
|
getter();
|
|
3733
3733
|
} else if (immediate) {
|
|
3734
|
-
callWithAsyncErrorHandling(cb, instance,
|
|
3734
|
+
callWithAsyncErrorHandling(cb, instance, 3, [
|
|
3735
3735
|
getter(),
|
|
3736
3736
|
isMultiSource ? [] : void 0,
|
|
3737
3737
|
onCleanup
|
|
@@ -3757,7 +3757,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3757
3757
|
if (cleanup) {
|
|
3758
3758
|
cleanup();
|
|
3759
3759
|
}
|
|
3760
|
-
callWithAsyncErrorHandling(cb, instance,
|
|
3760
|
+
callWithAsyncErrorHandling(cb, instance, 3, [
|
|
3761
3761
|
newValue,
|
|
3762
3762
|
// pass undefined as the old value when it's changed for the first time
|
|
3763
3763
|
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
@@ -4037,7 +4037,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
4037
4037
|
hook && callWithAsyncErrorHandling(
|
|
4038
4038
|
hook,
|
|
4039
4039
|
instance,
|
|
4040
|
-
|
|
4040
|
+
9,
|
|
4041
4041
|
args
|
|
4042
4042
|
);
|
|
4043
4043
|
};
|
|
@@ -4269,7 +4269,7 @@ function defineAsyncComponent(source) {
|
|
|
4269
4269
|
handleError(
|
|
4270
4270
|
err,
|
|
4271
4271
|
instance,
|
|
4272
|
-
|
|
4272
|
+
13,
|
|
4273
4273
|
!errorComponent
|
|
4274
4274
|
/* do not throw in dev if user provided error component */
|
|
4275
4275
|
);
|
|
@@ -4374,7 +4374,7 @@ const KeepAliveImpl = {
|
|
|
4374
4374
|
const storageContainer = createElement("div");
|
|
4375
4375
|
sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
|
|
4376
4376
|
const instance2 = vnode.component;
|
|
4377
|
-
move(vnode, container, anchor,
|
|
4377
|
+
move(vnode, container, anchor, 0, parentSuspense);
|
|
4378
4378
|
patch(
|
|
4379
4379
|
instance2.vnode,
|
|
4380
4380
|
vnode,
|
|
@@ -4402,7 +4402,7 @@ const KeepAliveImpl = {
|
|
|
4402
4402
|
};
|
|
4403
4403
|
sharedContext.deactivate = (vnode) => {
|
|
4404
4404
|
const instance2 = vnode.component;
|
|
4405
|
-
move(vnode, storageContainer, null,
|
|
4405
|
+
move(vnode, storageContainer, null, 1, parentSuspense);
|
|
4406
4406
|
queuePostRenderEffect(() => {
|
|
4407
4407
|
if (instance2.da) {
|
|
4408
4408
|
invokeArrayFns(instance2.da);
|
|
@@ -4760,7 +4760,7 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
|
4760
4760
|
}
|
|
4761
4761
|
if (hook) {
|
|
4762
4762
|
pauseTracking();
|
|
4763
|
-
callWithAsyncErrorHandling(hook, instance,
|
|
4763
|
+
callWithAsyncErrorHandling(hook, instance, 8, [
|
|
4764
4764
|
vnode.el,
|
|
4765
4765
|
binding,
|
|
4766
4766
|
vnode,
|
|
@@ -4777,7 +4777,7 @@ const FILTERS = "filters";
|
|
|
4777
4777
|
function resolveComponent(name, maybeSelfReference) {
|
|
4778
4778
|
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
4779
4779
|
}
|
|
4780
|
-
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
4780
|
+
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
4781
4781
|
function resolveDynamicComponent(component) {
|
|
4782
4782
|
if (isString(component)) {
|
|
4783
4783
|
return resolveAsset(COMPONENTS, component, false) || component;
|
|
@@ -6743,7 +6743,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
6743
6743
|
return vm;
|
|
6744
6744
|
}
|
|
6745
6745
|
}
|
|
6746
|
-
Vue.version = `2.6.14-compat:${"3.3.0-alpha.
|
|
6746
|
+
Vue.version = `2.6.14-compat:${"3.3.0-alpha.5"}`;
|
|
6747
6747
|
Vue.config = singletonApp.config;
|
|
6748
6748
|
Vue.use = (p, ...options) => {
|
|
6749
6749
|
if (p && isFunction(p.install)) {
|
|
@@ -7324,7 +7324,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
7324
7324
|
}
|
|
7325
7325
|
}
|
|
7326
7326
|
if (isFunction(ref)) {
|
|
7327
|
-
callWithErrorHandling(ref, owner,
|
|
7327
|
+
callWithErrorHandling(ref, owner, 12, [value, refs]);
|
|
7328
7328
|
} else {
|
|
7329
7329
|
const _isString = isString(ref);
|
|
7330
7330
|
const _isRef = isRef(ref);
|
|
@@ -8997,7 +8997,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8997
8997
|
);
|
|
8998
8998
|
} else if (moved) {
|
|
8999
8999
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
9000
|
-
move(nextChild, container, anchor,
|
|
9000
|
+
move(nextChild, container, anchor, 2);
|
|
9001
9001
|
} else {
|
|
9002
9002
|
j--;
|
|
9003
9003
|
}
|
|
@@ -9031,9 +9031,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9031
9031
|
moveStaticNode(vnode, container, anchor);
|
|
9032
9032
|
return;
|
|
9033
9033
|
}
|
|
9034
|
-
const needTransition = moveType !==
|
|
9034
|
+
const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
|
|
9035
9035
|
if (needTransition) {
|
|
9036
|
-
if (moveType ===
|
|
9036
|
+
if (moveType === 0) {
|
|
9037
9037
|
transition.beforeEnter(el);
|
|
9038
9038
|
hostInsert(el, container, anchor);
|
|
9039
9039
|
queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
|
@@ -9440,7 +9440,7 @@ const TeleportImpl = {
|
|
|
9440
9440
|
container,
|
|
9441
9441
|
mainAnchor,
|
|
9442
9442
|
internals,
|
|
9443
|
-
|
|
9443
|
+
1
|
|
9444
9444
|
);
|
|
9445
9445
|
}
|
|
9446
9446
|
} else {
|
|
@@ -9455,7 +9455,7 @@ const TeleportImpl = {
|
|
|
9455
9455
|
nextTarget,
|
|
9456
9456
|
null,
|
|
9457
9457
|
internals,
|
|
9458
|
-
|
|
9458
|
+
0
|
|
9459
9459
|
);
|
|
9460
9460
|
} else {
|
|
9461
9461
|
warn(
|
|
@@ -9470,7 +9470,7 @@ const TeleportImpl = {
|
|
|
9470
9470
|
target,
|
|
9471
9471
|
targetAnchor,
|
|
9472
9472
|
internals,
|
|
9473
|
-
|
|
9473
|
+
1
|
|
9474
9474
|
);
|
|
9475
9475
|
}
|
|
9476
9476
|
}
|
|
@@ -9501,12 +9501,12 @@ const TeleportImpl = {
|
|
|
9501
9501
|
move: moveTeleport,
|
|
9502
9502
|
hydrate: hydrateTeleport
|
|
9503
9503
|
};
|
|
9504
|
-
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType =
|
|
9505
|
-
if (moveType ===
|
|
9504
|
+
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
|
|
9505
|
+
if (moveType === 0) {
|
|
9506
9506
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
9507
9507
|
}
|
|
9508
9508
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
9509
|
-
const isReorder = moveType ===
|
|
9509
|
+
const isReorder = moveType === 2;
|
|
9510
9510
|
if (isReorder) {
|
|
9511
9511
|
insert(el, container, parentAnchor);
|
|
9512
9512
|
}
|
|
@@ -9517,7 +9517,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
9517
9517
|
children[i],
|
|
9518
9518
|
container,
|
|
9519
9519
|
parentAnchor,
|
|
9520
|
-
|
|
9520
|
+
2
|
|
9521
9521
|
);
|
|
9522
9522
|
}
|
|
9523
9523
|
}
|
|
@@ -9638,10 +9638,10 @@ function convertLegacyComponent(comp, instance) {
|
|
|
9638
9638
|
return comp;
|
|
9639
9639
|
}
|
|
9640
9640
|
|
|
9641
|
-
const Fragment = Symbol("
|
|
9642
|
-
const Text = Symbol("
|
|
9643
|
-
const Comment = Symbol("
|
|
9644
|
-
const Static = Symbol("
|
|
9641
|
+
const Fragment = Symbol.for("v-fgt");
|
|
9642
|
+
const Text = Symbol.for("v-txt");
|
|
9643
|
+
const Comment = Symbol.for("v-cmt");
|
|
9644
|
+
const Static = Symbol.for("v-stc");
|
|
9645
9645
|
const blockStack = [];
|
|
9646
9646
|
let currentBlock = null;
|
|
9647
9647
|
function openBlock(disableTracking = false) {
|
|
@@ -10006,7 +10006,7 @@ function mergeProps(...args) {
|
|
|
10006
10006
|
return ret;
|
|
10007
10007
|
}
|
|
10008
10008
|
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
10009
|
-
callWithAsyncErrorHandling(hook, instance,
|
|
10009
|
+
callWithAsyncErrorHandling(hook, instance, 7, [
|
|
10010
10010
|
vnode,
|
|
10011
10011
|
prevVNode
|
|
10012
10012
|
]);
|
|
@@ -10103,13 +10103,29 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
10103
10103
|
}
|
|
10104
10104
|
let currentInstance = null;
|
|
10105
10105
|
const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
|
10106
|
+
let internalSetCurrentInstance;
|
|
10107
|
+
let globalCurrentInstanceSetters;
|
|
10108
|
+
let settersKey = "__VUE_INSTANCE_SETTERS__";
|
|
10109
|
+
{
|
|
10110
|
+
if (!(globalCurrentInstanceSetters = getGlobalThis()[settersKey])) {
|
|
10111
|
+
globalCurrentInstanceSetters = getGlobalThis()[settersKey] = [];
|
|
10112
|
+
}
|
|
10113
|
+
globalCurrentInstanceSetters.push((i) => currentInstance = i);
|
|
10114
|
+
internalSetCurrentInstance = (instance) => {
|
|
10115
|
+
if (globalCurrentInstanceSetters.length > 1) {
|
|
10116
|
+
globalCurrentInstanceSetters.forEach((s) => s(instance));
|
|
10117
|
+
} else {
|
|
10118
|
+
globalCurrentInstanceSetters[0](instance);
|
|
10119
|
+
}
|
|
10120
|
+
};
|
|
10121
|
+
}
|
|
10106
10122
|
const setCurrentInstance = (instance) => {
|
|
10107
|
-
|
|
10123
|
+
internalSetCurrentInstance(instance);
|
|
10108
10124
|
instance.scope.on();
|
|
10109
10125
|
};
|
|
10110
10126
|
const unsetCurrentInstance = () => {
|
|
10111
10127
|
currentInstance && currentInstance.scope.off();
|
|
10112
|
-
|
|
10128
|
+
internalSetCurrentInstance(null);
|
|
10113
10129
|
};
|
|
10114
10130
|
const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
|
|
10115
10131
|
function validateComponentName(name, config) {
|
|
@@ -10172,7 +10188,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
10172
10188
|
const setupResult = callWithErrorHandling(
|
|
10173
10189
|
setup,
|
|
10174
10190
|
instance,
|
|
10175
|
-
|
|
10191
|
+
0,
|
|
10176
10192
|
[shallowReadonly(instance.props) , setupContext]
|
|
10177
10193
|
);
|
|
10178
10194
|
resetTracking();
|
|
@@ -10183,7 +10199,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
10183
10199
|
return setupResult.then((resolvedResult) => {
|
|
10184
10200
|
handleSetupResult(instance, resolvedResult, isSSR);
|
|
10185
10201
|
}).catch((e) => {
|
|
10186
|
-
handleError(e, instance,
|
|
10202
|
+
handleError(e, instance, 0);
|
|
10187
10203
|
});
|
|
10188
10204
|
} else {
|
|
10189
10205
|
instance.asyncDep = setupResult;
|
|
@@ -10523,7 +10539,7 @@ function h(type, propsOrChildren, children) {
|
|
|
10523
10539
|
}
|
|
10524
10540
|
}
|
|
10525
10541
|
|
|
10526
|
-
const ssrContextKey = Symbol(
|
|
10542
|
+
const ssrContextKey = Symbol.for("v-scx");
|
|
10527
10543
|
const useSSRContext = () => {
|
|
10528
10544
|
{
|
|
10529
10545
|
const ctx = inject(ssrContextKey);
|
|
@@ -10737,7 +10753,7 @@ function isMemoSame(cached, memo) {
|
|
|
10737
10753
|
return true;
|
|
10738
10754
|
}
|
|
10739
10755
|
|
|
10740
|
-
const version = "3.3.0-alpha.
|
|
10756
|
+
const version = "3.3.0-alpha.5";
|
|
10741
10757
|
const _ssrUtils = {
|
|
10742
10758
|
createComponentInstance,
|
|
10743
10759
|
setupComponent,
|
|
@@ -11077,7 +11093,7 @@ function createInvoker(initialValue, instance) {
|
|
|
11077
11093
|
callWithAsyncErrorHandling(
|
|
11078
11094
|
patchStopImmediatePropagation(e, invoker.value),
|
|
11079
11095
|
instance,
|
|
11080
|
-
|
|
11096
|
+
5,
|
|
11081
11097
|
[e]
|
|
11082
11098
|
);
|
|
11083
11099
|
};
|
|
@@ -12533,63 +12549,63 @@ function createCompilerError(code, loc, messages, additionalMessage) {
|
|
|
12533
12549
|
}
|
|
12534
12550
|
const errorMessages = {
|
|
12535
12551
|
// parse errors
|
|
12536
|
-
[
|
|
12537
|
-
[
|
|
12538
|
-
[
|
|
12539
|
-
[
|
|
12540
|
-
[
|
|
12541
|
-
[
|
|
12542
|
-
[
|
|
12543
|
-
[
|
|
12544
|
-
[
|
|
12545
|
-
[
|
|
12546
|
-
[
|
|
12547
|
-
[
|
|
12548
|
-
[
|
|
12549
|
-
[
|
|
12550
|
-
[
|
|
12551
|
-
[
|
|
12552
|
-
[
|
|
12553
|
-
[
|
|
12554
|
-
[
|
|
12555
|
-
[
|
|
12556
|
-
[
|
|
12557
|
-
[
|
|
12558
|
-
[
|
|
12552
|
+
[0]: "Illegal comment.",
|
|
12553
|
+
[1]: "CDATA section is allowed only in XML context.",
|
|
12554
|
+
[2]: "Duplicate attribute.",
|
|
12555
|
+
[3]: "End tag cannot have attributes.",
|
|
12556
|
+
[4]: "Illegal '/' in tags.",
|
|
12557
|
+
[5]: "Unexpected EOF in tag.",
|
|
12558
|
+
[6]: "Unexpected EOF in CDATA section.",
|
|
12559
|
+
[7]: "Unexpected EOF in comment.",
|
|
12560
|
+
[8]: "Unexpected EOF in script.",
|
|
12561
|
+
[9]: "Unexpected EOF in tag.",
|
|
12562
|
+
[10]: "Incorrectly closed comment.",
|
|
12563
|
+
[11]: "Incorrectly opened comment.",
|
|
12564
|
+
[12]: "Illegal tag name. Use '<' to print '<'.",
|
|
12565
|
+
[13]: "Attribute value was expected.",
|
|
12566
|
+
[14]: "End tag name was expected.",
|
|
12567
|
+
[15]: "Whitespace was expected.",
|
|
12568
|
+
[16]: "Unexpected '<!--' in comment.",
|
|
12569
|
+
[17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
|
|
12570
|
+
[18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
|
|
12571
|
+
[19]: "Attribute name cannot start with '='.",
|
|
12572
|
+
[21]: "'<?' is allowed only in XML context.",
|
|
12573
|
+
[20]: `Unexpected null character.`,
|
|
12574
|
+
[22]: "Illegal '/' in tags.",
|
|
12559
12575
|
// Vue-specific parse errors
|
|
12560
|
-
[
|
|
12561
|
-
[
|
|
12562
|
-
[
|
|
12563
|
-
[
|
|
12564
|
-
[
|
|
12576
|
+
[23]: "Invalid end tag.",
|
|
12577
|
+
[24]: "Element is missing end tag.",
|
|
12578
|
+
[25]: "Interpolation end sign was not found.",
|
|
12579
|
+
[27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
|
|
12580
|
+
[26]: "Legal directive name was expected.",
|
|
12565
12581
|
// transform errors
|
|
12566
|
-
[
|
|
12567
|
-
[
|
|
12568
|
-
[
|
|
12569
|
-
[
|
|
12570
|
-
[
|
|
12571
|
-
[
|
|
12572
|
-
[
|
|
12573
|
-
[
|
|
12574
|
-
[
|
|
12575
|
-
[
|
|
12576
|
-
[
|
|
12577
|
-
[
|
|
12578
|
-
[
|
|
12579
|
-
[
|
|
12580
|
-
[
|
|
12581
|
-
[
|
|
12582
|
-
[
|
|
12582
|
+
[28]: `v-if/v-else-if is missing expression.`,
|
|
12583
|
+
[29]: `v-if/else branches must use unique keys.`,
|
|
12584
|
+
[30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
|
|
12585
|
+
[31]: `v-for is missing expression.`,
|
|
12586
|
+
[32]: `v-for has invalid expression.`,
|
|
12587
|
+
[33]: `<template v-for> key should be placed on the <template> tag.`,
|
|
12588
|
+
[34]: `v-bind is missing expression.`,
|
|
12589
|
+
[35]: `v-on is missing expression.`,
|
|
12590
|
+
[36]: `Unexpected custom directive on <slot> outlet.`,
|
|
12591
|
+
[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.`,
|
|
12592
|
+
[38]: `Duplicate slot names found. `,
|
|
12593
|
+
[39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
|
|
12594
|
+
[40]: `v-slot can only be used on components or <template> tags.`,
|
|
12595
|
+
[41]: `v-model is missing expression.`,
|
|
12596
|
+
[42]: `v-model value must be a valid JavaScript member expression.`,
|
|
12597
|
+
[43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
12598
|
+
[44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
|
|
12583
12599
|
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
12584
|
-
[
|
|
12585
|
-
[
|
|
12600
|
+
[45]: `Error parsing JavaScript expression: `,
|
|
12601
|
+
[46]: `<KeepAlive> expects exactly one child component.`,
|
|
12586
12602
|
// generic errors
|
|
12587
|
-
[
|
|
12588
|
-
[
|
|
12589
|
-
[
|
|
12590
|
-
[
|
|
12603
|
+
[47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
12604
|
+
[48]: `ES module mode is not supported in this build of compiler.`,
|
|
12605
|
+
[49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
12606
|
+
[50]: `"scopeId" option is only supported in module mode.`,
|
|
12591
12607
|
// just to fulfill types
|
|
12592
|
-
[
|
|
12608
|
+
[51]: ``
|
|
12593
12609
|
};
|
|
12594
12610
|
|
|
12595
12611
|
const FRAGMENT = Symbol(`Fragment` );
|
|
@@ -12687,7 +12703,7 @@ const locStub = {
|
|
|
12687
12703
|
};
|
|
12688
12704
|
function createRoot(children, loc = locStub) {
|
|
12689
12705
|
return {
|
|
12690
|
-
type:
|
|
12706
|
+
type: 0,
|
|
12691
12707
|
children,
|
|
12692
12708
|
helpers: /* @__PURE__ */ new Set(),
|
|
12693
12709
|
components: [],
|
|
@@ -12713,7 +12729,7 @@ function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps,
|
|
|
12713
12729
|
}
|
|
12714
12730
|
}
|
|
12715
12731
|
return {
|
|
12716
|
-
type:
|
|
12732
|
+
type: 13,
|
|
12717
12733
|
tag,
|
|
12718
12734
|
props,
|
|
12719
12735
|
children,
|
|
@@ -12728,21 +12744,21 @@ function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps,
|
|
|
12728
12744
|
}
|
|
12729
12745
|
function createArrayExpression(elements, loc = locStub) {
|
|
12730
12746
|
return {
|
|
12731
|
-
type:
|
|
12747
|
+
type: 17,
|
|
12732
12748
|
loc,
|
|
12733
12749
|
elements
|
|
12734
12750
|
};
|
|
12735
12751
|
}
|
|
12736
12752
|
function createObjectExpression(properties, loc = locStub) {
|
|
12737
12753
|
return {
|
|
12738
|
-
type:
|
|
12754
|
+
type: 15,
|
|
12739
12755
|
loc,
|
|
12740
12756
|
properties
|
|
12741
12757
|
};
|
|
12742
12758
|
}
|
|
12743
12759
|
function createObjectProperty(key, value) {
|
|
12744
12760
|
return {
|
|
12745
|
-
type:
|
|
12761
|
+
type: 16,
|
|
12746
12762
|
loc: locStub,
|
|
12747
12763
|
key: isString(key) ? createSimpleExpression(key, true) : key,
|
|
12748
12764
|
value
|
|
@@ -12750,23 +12766,23 @@ function createObjectProperty(key, value) {
|
|
|
12750
12766
|
}
|
|
12751
12767
|
function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
|
|
12752
12768
|
return {
|
|
12753
|
-
type:
|
|
12769
|
+
type: 4,
|
|
12754
12770
|
loc,
|
|
12755
12771
|
content,
|
|
12756
12772
|
isStatic,
|
|
12757
|
-
constType: isStatic ?
|
|
12773
|
+
constType: isStatic ? 3 : constType
|
|
12758
12774
|
};
|
|
12759
12775
|
}
|
|
12760
12776
|
function createCompoundExpression(children, loc = locStub) {
|
|
12761
12777
|
return {
|
|
12762
|
-
type:
|
|
12778
|
+
type: 8,
|
|
12763
12779
|
loc,
|
|
12764
12780
|
children
|
|
12765
12781
|
};
|
|
12766
12782
|
}
|
|
12767
12783
|
function createCallExpression(callee, args = [], loc = locStub) {
|
|
12768
12784
|
return {
|
|
12769
|
-
type:
|
|
12785
|
+
type: 14,
|
|
12770
12786
|
loc,
|
|
12771
12787
|
callee,
|
|
12772
12788
|
arguments: args
|
|
@@ -12774,7 +12790,7 @@ function createCallExpression(callee, args = [], loc = locStub) {
|
|
|
12774
12790
|
}
|
|
12775
12791
|
function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
|
|
12776
12792
|
return {
|
|
12777
|
-
type:
|
|
12793
|
+
type: 18,
|
|
12778
12794
|
params,
|
|
12779
12795
|
returns,
|
|
12780
12796
|
newline,
|
|
@@ -12784,7 +12800,7 @@ function createFunctionExpression(params, returns = void 0, newline = false, isS
|
|
|
12784
12800
|
}
|
|
12785
12801
|
function createConditionalExpression(test, consequent, alternate, newline = true) {
|
|
12786
12802
|
return {
|
|
12787
|
-
type:
|
|
12803
|
+
type: 19,
|
|
12788
12804
|
test,
|
|
12789
12805
|
consequent,
|
|
12790
12806
|
alternate,
|
|
@@ -12794,7 +12810,7 @@ function createConditionalExpression(test, consequent, alternate, newline = true
|
|
|
12794
12810
|
}
|
|
12795
12811
|
function createCacheExpression(index, value, isVNode = false) {
|
|
12796
12812
|
return {
|
|
12797
|
-
type:
|
|
12813
|
+
type: 20,
|
|
12798
12814
|
index,
|
|
12799
12815
|
value,
|
|
12800
12816
|
isVNode,
|
|
@@ -12803,13 +12819,27 @@ function createCacheExpression(index, value, isVNode = false) {
|
|
|
12803
12819
|
}
|
|
12804
12820
|
function createBlockStatement(body) {
|
|
12805
12821
|
return {
|
|
12806
|
-
type:
|
|
12822
|
+
type: 21,
|
|
12807
12823
|
body,
|
|
12808
12824
|
loc: locStub
|
|
12809
12825
|
};
|
|
12810
12826
|
}
|
|
12827
|
+
function getVNodeHelper(ssr, isComponent) {
|
|
12828
|
+
return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
|
|
12829
|
+
}
|
|
12830
|
+
function getVNodeBlockHelper(ssr, isComponent) {
|
|
12831
|
+
return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
|
|
12832
|
+
}
|
|
12833
|
+
function convertToBlock(node, { helper, removeHelper, inSSR }) {
|
|
12834
|
+
if (!node.isBlock) {
|
|
12835
|
+
node.isBlock = true;
|
|
12836
|
+
removeHelper(getVNodeHelper(inSSR, node.isComponent));
|
|
12837
|
+
helper(OPEN_BLOCK);
|
|
12838
|
+
helper(getVNodeBlockHelper(inSSR, node.isComponent));
|
|
12839
|
+
}
|
|
12840
|
+
}
|
|
12811
12841
|
|
|
12812
|
-
const isStaticExp = (p) => p.type ===
|
|
12842
|
+
const isStaticExp = (p) => p.type === 4 && p.isStatic;
|
|
12813
12843
|
const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
|
|
12814
12844
|
function isCoreComponent(tag) {
|
|
12815
12845
|
if (isBuiltInType(tag, "Teleport")) {
|
|
@@ -12883,7 +12913,7 @@ function assert(condition, msg) {
|
|
|
12883
12913
|
function findDir(node, name, allowEmpty = false) {
|
|
12884
12914
|
for (let i = 0; i < node.props.length; i++) {
|
|
12885
12915
|
const p = node.props[i];
|
|
12886
|
-
if (p.type ===
|
|
12916
|
+
if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
|
|
12887
12917
|
return p;
|
|
12888
12918
|
}
|
|
12889
12919
|
}
|
|
@@ -12891,7 +12921,7 @@ function findDir(node, name, allowEmpty = false) {
|
|
|
12891
12921
|
function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
|
|
12892
12922
|
for (let i = 0; i < node.props.length; i++) {
|
|
12893
12923
|
const p = node.props[i];
|
|
12894
|
-
if (p.type ===
|
|
12924
|
+
if (p.type === 6) {
|
|
12895
12925
|
if (dynamicOnly)
|
|
12896
12926
|
continue;
|
|
12897
12927
|
if (p.name === name && (p.value || allowEmpty)) {
|
|
@@ -12907,33 +12937,27 @@ function isStaticArgOf(arg, name) {
|
|
|
12907
12937
|
}
|
|
12908
12938
|
function hasDynamicKeyVBind(node) {
|
|
12909
12939
|
return node.props.some(
|
|
12910
|
-
(p) => p.type ===
|
|
12911
|
-
p.arg.type !==
|
|
12940
|
+
(p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
|
|
12941
|
+
p.arg.type !== 4 || // v-bind:[_ctx.foo]
|
|
12912
12942
|
!p.arg.isStatic)
|
|
12913
12943
|
// v-bind:[foo]
|
|
12914
12944
|
);
|
|
12915
12945
|
}
|
|
12916
12946
|
function isText$1(node) {
|
|
12917
|
-
return node.type ===
|
|
12947
|
+
return node.type === 5 || node.type === 2;
|
|
12918
12948
|
}
|
|
12919
12949
|
function isVSlot(p) {
|
|
12920
|
-
return p.type ===
|
|
12950
|
+
return p.type === 7 && p.name === "slot";
|
|
12921
12951
|
}
|
|
12922
12952
|
function isTemplateNode(node) {
|
|
12923
|
-
return node.type ===
|
|
12953
|
+
return node.type === 1 && node.tagType === 3;
|
|
12924
12954
|
}
|
|
12925
12955
|
function isSlotOutlet(node) {
|
|
12926
|
-
return node.type ===
|
|
12927
|
-
}
|
|
12928
|
-
function getVNodeHelper(ssr, isComponent) {
|
|
12929
|
-
return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
|
|
12930
|
-
}
|
|
12931
|
-
function getVNodeBlockHelper(ssr, isComponent) {
|
|
12932
|
-
return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
|
|
12956
|
+
return node.type === 1 && node.tagType === 2;
|
|
12933
12957
|
}
|
|
12934
12958
|
const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
|
|
12935
12959
|
function getUnnormalizedProps(props, callPath = []) {
|
|
12936
|
-
if (props && !isString(props) && props.type ===
|
|
12960
|
+
if (props && !isString(props) && props.type === 14) {
|
|
12937
12961
|
const callee = props.callee;
|
|
12938
12962
|
if (!isString(callee) && propsHelperSet.has(callee)) {
|
|
12939
12963
|
return getUnnormalizedProps(
|
|
@@ -12946,10 +12970,10 @@ function getUnnormalizedProps(props, callPath = []) {
|
|
|
12946
12970
|
}
|
|
12947
12971
|
function injectProp(node, prop, context) {
|
|
12948
12972
|
let propsWithInjection;
|
|
12949
|
-
let props = node.type ===
|
|
12973
|
+
let props = node.type === 13 ? node.props : node.arguments[2];
|
|
12950
12974
|
let callPath = [];
|
|
12951
12975
|
let parentCall;
|
|
12952
|
-
if (props && !isString(props) && props.type ===
|
|
12976
|
+
if (props && !isString(props) && props.type === 14) {
|
|
12953
12977
|
const ret = getUnnormalizedProps(props);
|
|
12954
12978
|
props = ret[0];
|
|
12955
12979
|
callPath = ret[1];
|
|
@@ -12957,9 +12981,9 @@ function injectProp(node, prop, context) {
|
|
|
12957
12981
|
}
|
|
12958
12982
|
if (props == null || isString(props)) {
|
|
12959
12983
|
propsWithInjection = createObjectExpression([prop]);
|
|
12960
|
-
} else if (props.type ===
|
|
12984
|
+
} else if (props.type === 14) {
|
|
12961
12985
|
const first = props.arguments[0];
|
|
12962
|
-
if (!isString(first) && first.type ===
|
|
12986
|
+
if (!isString(first) && first.type === 15) {
|
|
12963
12987
|
if (!hasProp(prop, first)) {
|
|
12964
12988
|
first.properties.unshift(prop);
|
|
12965
12989
|
}
|
|
@@ -12974,7 +12998,7 @@ function injectProp(node, prop, context) {
|
|
|
12974
12998
|
}
|
|
12975
12999
|
}
|
|
12976
13000
|
!propsWithInjection && (propsWithInjection = props);
|
|
12977
|
-
} else if (props.type ===
|
|
13001
|
+
} else if (props.type === 15) {
|
|
12978
13002
|
if (!hasProp(prop, props)) {
|
|
12979
13003
|
props.properties.unshift(prop);
|
|
12980
13004
|
}
|
|
@@ -12988,7 +13012,7 @@ function injectProp(node, prop, context) {
|
|
|
12988
13012
|
parentCall = callPath[callPath.length - 2];
|
|
12989
13013
|
}
|
|
12990
13014
|
}
|
|
12991
|
-
if (node.type ===
|
|
13015
|
+
if (node.type === 13) {
|
|
12992
13016
|
if (parentCall) {
|
|
12993
13017
|
parentCall.arguments[0] = propsWithInjection;
|
|
12994
13018
|
} else {
|
|
@@ -13004,10 +13028,10 @@ function injectProp(node, prop, context) {
|
|
|
13004
13028
|
}
|
|
13005
13029
|
function hasProp(prop, props) {
|
|
13006
13030
|
let result = false;
|
|
13007
|
-
if (prop.key.type ===
|
|
13031
|
+
if (prop.key.type === 4) {
|
|
13008
13032
|
const propKeyName = prop.key.content;
|
|
13009
13033
|
result = props.properties.some(
|
|
13010
|
-
(p) => p.key.type ===
|
|
13034
|
+
(p) => p.key.type === 4 && p.key.content === propKeyName
|
|
13011
13035
|
);
|
|
13012
13036
|
}
|
|
13013
13037
|
return result;
|
|
@@ -13022,55 +13046,47 @@ function hasScopeRef(node, ids) {
|
|
|
13022
13046
|
return false;
|
|
13023
13047
|
}
|
|
13024
13048
|
switch (node.type) {
|
|
13025
|
-
case
|
|
13049
|
+
case 1:
|
|
13026
13050
|
for (let i = 0; i < node.props.length; i++) {
|
|
13027
13051
|
const p = node.props[i];
|
|
13028
|
-
if (p.type ===
|
|
13052
|
+
if (p.type === 7 && (hasScopeRef(p.arg, ids) || hasScopeRef(p.exp, ids))) {
|
|
13029
13053
|
return true;
|
|
13030
13054
|
}
|
|
13031
13055
|
}
|
|
13032
13056
|
return node.children.some((c) => hasScopeRef(c, ids));
|
|
13033
|
-
case
|
|
13057
|
+
case 11:
|
|
13034
13058
|
if (hasScopeRef(node.source, ids)) {
|
|
13035
13059
|
return true;
|
|
13036
13060
|
}
|
|
13037
13061
|
return node.children.some((c) => hasScopeRef(c, ids));
|
|
13038
|
-
case
|
|
13062
|
+
case 9:
|
|
13039
13063
|
return node.branches.some((b) => hasScopeRef(b, ids));
|
|
13040
|
-
case
|
|
13064
|
+
case 10:
|
|
13041
13065
|
if (hasScopeRef(node.condition, ids)) {
|
|
13042
13066
|
return true;
|
|
13043
13067
|
}
|
|
13044
13068
|
return node.children.some((c) => hasScopeRef(c, ids));
|
|
13045
|
-
case
|
|
13069
|
+
case 4:
|
|
13046
13070
|
return !node.isStatic && isSimpleIdentifier(node.content) && !!ids[node.content];
|
|
13047
|
-
case
|
|
13071
|
+
case 8:
|
|
13048
13072
|
return node.children.some((c) => isObject(c) && hasScopeRef(c, ids));
|
|
13049
|
-
case
|
|
13050
|
-
case
|
|
13073
|
+
case 5:
|
|
13074
|
+
case 12:
|
|
13051
13075
|
return hasScopeRef(node.content, ids);
|
|
13052
|
-
case
|
|
13053
|
-
case
|
|
13076
|
+
case 2:
|
|
13077
|
+
case 3:
|
|
13054
13078
|
return false;
|
|
13055
13079
|
default:
|
|
13056
13080
|
return false;
|
|
13057
13081
|
}
|
|
13058
13082
|
}
|
|
13059
13083
|
function getMemoedVNodeCall(node) {
|
|
13060
|
-
if (node.type ===
|
|
13084
|
+
if (node.type === 14 && node.callee === WITH_MEMO) {
|
|
13061
13085
|
return node.arguments[1].returns;
|
|
13062
13086
|
} else {
|
|
13063
13087
|
return node;
|
|
13064
13088
|
}
|
|
13065
13089
|
}
|
|
13066
|
-
function makeBlock(node, { helper, removeHelper, inSSR }) {
|
|
13067
|
-
if (!node.isBlock) {
|
|
13068
|
-
node.isBlock = true;
|
|
13069
|
-
removeHelper(getVNodeHelper(inSSR, node.isComponent));
|
|
13070
|
-
helper(OPEN_BLOCK);
|
|
13071
|
-
helper(getVNodeBlockHelper(inSSR, node.isComponent));
|
|
13072
|
-
}
|
|
13073
|
-
}
|
|
13074
13090
|
|
|
13075
13091
|
const deprecationData = {
|
|
13076
13092
|
["COMPILER_IS_ON_ELEMENT"]: {
|
|
@@ -13154,8 +13170,8 @@ const decodeMap = {
|
|
|
13154
13170
|
};
|
|
13155
13171
|
const defaultParserOptions = {
|
|
13156
13172
|
delimiters: [`{{`, `}}`],
|
|
13157
|
-
getNamespace: () =>
|
|
13158
|
-
getTextMode: () =>
|
|
13173
|
+
getNamespace: () => 0,
|
|
13174
|
+
getTextMode: () => 0,
|
|
13159
13175
|
isVoidTag: NO,
|
|
13160
13176
|
isPreTag: NO,
|
|
13161
13177
|
isCustomElement: NO,
|
|
@@ -13168,7 +13184,7 @@ function baseParse(content, options = {}) {
|
|
|
13168
13184
|
const context = createParserContext(content, options);
|
|
13169
13185
|
const start = getCursor(context);
|
|
13170
13186
|
return createRoot(
|
|
13171
|
-
parseChildren(context,
|
|
13187
|
+
parseChildren(context, 0, []),
|
|
13172
13188
|
getSelection(context, start)
|
|
13173
13189
|
);
|
|
13174
13190
|
}
|
|
@@ -13192,48 +13208,48 @@ function createParserContext(content, rawOptions) {
|
|
|
13192
13208
|
}
|
|
13193
13209
|
function parseChildren(context, mode, ancestors) {
|
|
13194
13210
|
const parent = last(ancestors);
|
|
13195
|
-
const ns = parent ? parent.ns :
|
|
13211
|
+
const ns = parent ? parent.ns : 0;
|
|
13196
13212
|
const nodes = [];
|
|
13197
13213
|
while (!isEnd(context, mode, ancestors)) {
|
|
13198
13214
|
const s = context.source;
|
|
13199
13215
|
let node = void 0;
|
|
13200
|
-
if (mode ===
|
|
13216
|
+
if (mode === 0 || mode === 1) {
|
|
13201
13217
|
if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
|
|
13202
13218
|
node = parseInterpolation(context, mode);
|
|
13203
|
-
} else if (mode ===
|
|
13219
|
+
} else if (mode === 0 && s[0] === "<") {
|
|
13204
13220
|
if (s.length === 1) {
|
|
13205
|
-
emitError(context,
|
|
13221
|
+
emitError(context, 5, 1);
|
|
13206
13222
|
} else if (s[1] === "!") {
|
|
13207
13223
|
if (startsWith(s, "<!--")) {
|
|
13208
13224
|
node = parseComment(context);
|
|
13209
13225
|
} else if (startsWith(s, "<!DOCTYPE")) {
|
|
13210
13226
|
node = parseBogusComment(context);
|
|
13211
13227
|
} else if (startsWith(s, "<![CDATA[")) {
|
|
13212
|
-
if (ns !==
|
|
13228
|
+
if (ns !== 0) {
|
|
13213
13229
|
node = parseCDATA(context, ancestors);
|
|
13214
13230
|
} else {
|
|
13215
|
-
emitError(context,
|
|
13231
|
+
emitError(context, 1);
|
|
13216
13232
|
node = parseBogusComment(context);
|
|
13217
13233
|
}
|
|
13218
13234
|
} else {
|
|
13219
|
-
emitError(context,
|
|
13235
|
+
emitError(context, 11);
|
|
13220
13236
|
node = parseBogusComment(context);
|
|
13221
13237
|
}
|
|
13222
13238
|
} else if (s[1] === "/") {
|
|
13223
13239
|
if (s.length === 2) {
|
|
13224
|
-
emitError(context,
|
|
13240
|
+
emitError(context, 5, 2);
|
|
13225
13241
|
} else if (s[2] === ">") {
|
|
13226
|
-
emitError(context,
|
|
13242
|
+
emitError(context, 14, 2);
|
|
13227
13243
|
advanceBy(context, 3);
|
|
13228
13244
|
continue;
|
|
13229
13245
|
} else if (/[a-z]/i.test(s[2])) {
|
|
13230
|
-
emitError(context,
|
|
13246
|
+
emitError(context, 23);
|
|
13231
13247
|
parseTag(context, TagType.End, parent);
|
|
13232
13248
|
continue;
|
|
13233
13249
|
} else {
|
|
13234
13250
|
emitError(
|
|
13235
13251
|
context,
|
|
13236
|
-
|
|
13252
|
+
12,
|
|
13237
13253
|
2
|
|
13238
13254
|
);
|
|
13239
13255
|
node = parseBogusComment(context);
|
|
@@ -13244,7 +13260,7 @@ function parseChildren(context, mode, ancestors) {
|
|
|
13244
13260
|
"COMPILER_NATIVE_TEMPLATE",
|
|
13245
13261
|
context
|
|
13246
13262
|
) && node && node.tag === "template" && !node.props.some(
|
|
13247
|
-
(p) => p.type ===
|
|
13263
|
+
(p) => p.type === 7 && isSpecialTemplateDirective(p.name)
|
|
13248
13264
|
)) {
|
|
13249
13265
|
warnDeprecation(
|
|
13250
13266
|
"COMPILER_NATIVE_TEMPLATE",
|
|
@@ -13256,12 +13272,12 @@ function parseChildren(context, mode, ancestors) {
|
|
|
13256
13272
|
} else if (s[1] === "?") {
|
|
13257
13273
|
emitError(
|
|
13258
13274
|
context,
|
|
13259
|
-
|
|
13275
|
+
21,
|
|
13260
13276
|
1
|
|
13261
13277
|
);
|
|
13262
13278
|
node = parseBogusComment(context);
|
|
13263
13279
|
} else {
|
|
13264
|
-
emitError(context,
|
|
13280
|
+
emitError(context, 12, 1);
|
|
13265
13281
|
}
|
|
13266
13282
|
}
|
|
13267
13283
|
}
|
|
@@ -13277,16 +13293,16 @@ function parseChildren(context, mode, ancestors) {
|
|
|
13277
13293
|
}
|
|
13278
13294
|
}
|
|
13279
13295
|
let removedWhitespace = false;
|
|
13280
|
-
if (mode !==
|
|
13296
|
+
if (mode !== 2 && mode !== 1) {
|
|
13281
13297
|
const shouldCondense = context.options.whitespace !== "preserve";
|
|
13282
13298
|
for (let i = 0; i < nodes.length; i++) {
|
|
13283
13299
|
const node = nodes[i];
|
|
13284
|
-
if (node.type ===
|
|
13300
|
+
if (node.type === 2) {
|
|
13285
13301
|
if (!context.inPre) {
|
|
13286
13302
|
if (!/[^\t\r\n\f ]/.test(node.content)) {
|
|
13287
13303
|
const prev = nodes[i - 1];
|
|
13288
13304
|
const next = nodes[i + 1];
|
|
13289
|
-
if (!prev || !next || shouldCondense && (prev.type ===
|
|
13305
|
+
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))) {
|
|
13290
13306
|
removedWhitespace = true;
|
|
13291
13307
|
nodes[i] = null;
|
|
13292
13308
|
} else {
|
|
@@ -13298,14 +13314,14 @@ function parseChildren(context, mode, ancestors) {
|
|
|
13298
13314
|
} else {
|
|
13299
13315
|
node.content = node.content.replace(/\r\n/g, "\n");
|
|
13300
13316
|
}
|
|
13301
|
-
} else if (node.type ===
|
|
13317
|
+
} else if (node.type === 3 && !context.options.comments) {
|
|
13302
13318
|
removedWhitespace = true;
|
|
13303
13319
|
nodes[i] = null;
|
|
13304
13320
|
}
|
|
13305
13321
|
}
|
|
13306
13322
|
if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
|
|
13307
13323
|
const first = nodes[0];
|
|
13308
|
-
if (first && first.type ===
|
|
13324
|
+
if (first && first.type === 2) {
|
|
13309
13325
|
first.content = first.content.replace(/^\r?\n/, "");
|
|
13310
13326
|
}
|
|
13311
13327
|
}
|
|
@@ -13313,9 +13329,9 @@ function parseChildren(context, mode, ancestors) {
|
|
|
13313
13329
|
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
13314
13330
|
}
|
|
13315
13331
|
function pushNode(nodes, node) {
|
|
13316
|
-
if (node.type ===
|
|
13332
|
+
if (node.type === 2) {
|
|
13317
13333
|
const prev = last(nodes);
|
|
13318
|
-
if (prev && prev.type ===
|
|
13334
|
+
if (prev && prev.type === 2 && prev.loc.end.offset === node.loc.start.offset) {
|
|
13319
13335
|
prev.content += node.content;
|
|
13320
13336
|
prev.loc.end = node.loc.end;
|
|
13321
13337
|
prev.loc.source += node.loc.source;
|
|
@@ -13326,9 +13342,9 @@ function pushNode(nodes, node) {
|
|
|
13326
13342
|
}
|
|
13327
13343
|
function parseCDATA(context, ancestors) {
|
|
13328
13344
|
advanceBy(context, 9);
|
|
13329
|
-
const nodes = parseChildren(context,
|
|
13345
|
+
const nodes = parseChildren(context, 3, ancestors);
|
|
13330
13346
|
if (context.source.length === 0) {
|
|
13331
|
-
emitError(context,
|
|
13347
|
+
emitError(context, 6);
|
|
13332
13348
|
} else {
|
|
13333
13349
|
advanceBy(context, 3);
|
|
13334
13350
|
}
|
|
@@ -13341,13 +13357,13 @@ function parseComment(context) {
|
|
|
13341
13357
|
if (!match) {
|
|
13342
13358
|
content = context.source.slice(4);
|
|
13343
13359
|
advanceBy(context, context.source.length);
|
|
13344
|
-
emitError(context,
|
|
13360
|
+
emitError(context, 7);
|
|
13345
13361
|
} else {
|
|
13346
13362
|
if (match.index <= 3) {
|
|
13347
|
-
emitError(context,
|
|
13363
|
+
emitError(context, 0);
|
|
13348
13364
|
}
|
|
13349
13365
|
if (match[1]) {
|
|
13350
|
-
emitError(context,
|
|
13366
|
+
emitError(context, 10);
|
|
13351
13367
|
}
|
|
13352
13368
|
content = context.source.slice(4, match.index);
|
|
13353
13369
|
const s = context.source.slice(0, match.index);
|
|
@@ -13355,14 +13371,14 @@ function parseComment(context) {
|
|
|
13355
13371
|
while ((nestedIndex = s.indexOf("<!--", prevIndex)) !== -1) {
|
|
13356
13372
|
advanceBy(context, nestedIndex - prevIndex + 1);
|
|
13357
13373
|
if (nestedIndex + 4 < s.length) {
|
|
13358
|
-
emitError(context,
|
|
13374
|
+
emitError(context, 16);
|
|
13359
13375
|
}
|
|
13360
13376
|
prevIndex = nestedIndex + 1;
|
|
13361
13377
|
}
|
|
13362
13378
|
advanceBy(context, match.index + match[0].length - prevIndex + 1);
|
|
13363
13379
|
}
|
|
13364
13380
|
return {
|
|
13365
|
-
type:
|
|
13381
|
+
type: 3,
|
|
13366
13382
|
content,
|
|
13367
13383
|
loc: getSelection(context, start)
|
|
13368
13384
|
};
|
|
@@ -13380,7 +13396,7 @@ function parseBogusComment(context) {
|
|
|
13380
13396
|
advanceBy(context, closeIndex + 1);
|
|
13381
13397
|
}
|
|
13382
13398
|
return {
|
|
13383
|
-
type:
|
|
13399
|
+
type: 3,
|
|
13384
13400
|
content,
|
|
13385
13401
|
loc: getSelection(context, start)
|
|
13386
13402
|
};
|
|
@@ -13407,7 +13423,7 @@ function parseElement(context, ancestors) {
|
|
|
13407
13423
|
ancestors.pop();
|
|
13408
13424
|
{
|
|
13409
13425
|
const inlineTemplateProp = element.props.find(
|
|
13410
|
-
(p) => p.type ===
|
|
13426
|
+
(p) => p.type === 6 && p.name === "inline-template"
|
|
13411
13427
|
);
|
|
13412
13428
|
if (inlineTemplateProp && checkCompatEnabled(
|
|
13413
13429
|
"COMPILER_INLINE_TEMPLATE",
|
|
@@ -13416,7 +13432,7 @@ function parseElement(context, ancestors) {
|
|
|
13416
13432
|
)) {
|
|
13417
13433
|
const loc = getSelection(context, element.loc.end);
|
|
13418
13434
|
inlineTemplateProp.value = {
|
|
13419
|
-
type:
|
|
13435
|
+
type: 2,
|
|
13420
13436
|
content: loc.source,
|
|
13421
13437
|
loc
|
|
13422
13438
|
};
|
|
@@ -13426,11 +13442,11 @@ function parseElement(context, ancestors) {
|
|
|
13426
13442
|
if (startsWithEndTagOpen(context.source, element.tag)) {
|
|
13427
13443
|
parseTag(context, TagType.End, parent);
|
|
13428
13444
|
} else {
|
|
13429
|
-
emitError(context,
|
|
13445
|
+
emitError(context, 24, 0, element.loc.start);
|
|
13430
13446
|
if (context.source.length === 0 && element.tag.toLowerCase() === "script") {
|
|
13431
13447
|
const first = children[0];
|
|
13432
13448
|
if (first && startsWith(first.loc.source, "<!--")) {
|
|
13433
|
-
emitError(context,
|
|
13449
|
+
emitError(context, 8);
|
|
13434
13450
|
}
|
|
13435
13451
|
}
|
|
13436
13452
|
}
|
|
@@ -13464,7 +13480,7 @@ function parseTag(context, type, parent) {
|
|
|
13464
13480
|
context.inPre = true;
|
|
13465
13481
|
}
|
|
13466
13482
|
let props = parseAttributes(context, type);
|
|
13467
|
-
if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type ===
|
|
13483
|
+
if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type === 7 && p.name === "pre")) {
|
|
13468
13484
|
context.inVPre = true;
|
|
13469
13485
|
extend(context, cursor);
|
|
13470
13486
|
context.source = currentSource;
|
|
@@ -13472,11 +13488,11 @@ function parseTag(context, type, parent) {
|
|
|
13472
13488
|
}
|
|
13473
13489
|
let isSelfClosing = false;
|
|
13474
13490
|
if (context.source.length === 0) {
|
|
13475
|
-
emitError(context,
|
|
13491
|
+
emitError(context, 9);
|
|
13476
13492
|
} else {
|
|
13477
13493
|
isSelfClosing = startsWith(context.source, "/>");
|
|
13478
13494
|
if (type === 1 /* End */ && isSelfClosing) {
|
|
13479
|
-
emitError(context,
|
|
13495
|
+
emitError(context, 4);
|
|
13480
13496
|
}
|
|
13481
13497
|
advanceBy(context, isSelfClosing ? 2 : 1);
|
|
13482
13498
|
}
|
|
@@ -13491,7 +13507,7 @@ function parseTag(context, type, parent) {
|
|
|
13491
13507
|
let hasFor = false;
|
|
13492
13508
|
for (let i = 0; i < props.length; i++) {
|
|
13493
13509
|
const p = props[i];
|
|
13494
|
-
if (p.type ===
|
|
13510
|
+
if (p.type === 7) {
|
|
13495
13511
|
if (p.name === "if") {
|
|
13496
13512
|
hasIf = true;
|
|
13497
13513
|
} else if (p.name === "for") {
|
|
@@ -13508,22 +13524,22 @@ function parseTag(context, type, parent) {
|
|
|
13508
13524
|
}
|
|
13509
13525
|
}
|
|
13510
13526
|
}
|
|
13511
|
-
let tagType =
|
|
13527
|
+
let tagType = 0;
|
|
13512
13528
|
if (!context.inVPre) {
|
|
13513
13529
|
if (tag === "slot") {
|
|
13514
|
-
tagType =
|
|
13530
|
+
tagType = 2;
|
|
13515
13531
|
} else if (tag === "template") {
|
|
13516
13532
|
if (props.some(
|
|
13517
|
-
(p) => p.type ===
|
|
13533
|
+
(p) => p.type === 7 && isSpecialTemplateDirective(p.name)
|
|
13518
13534
|
)) {
|
|
13519
|
-
tagType =
|
|
13535
|
+
tagType = 3;
|
|
13520
13536
|
}
|
|
13521
13537
|
} else if (isComponent(tag, props, context)) {
|
|
13522
|
-
tagType =
|
|
13538
|
+
tagType = 1;
|
|
13523
13539
|
}
|
|
13524
13540
|
}
|
|
13525
13541
|
return {
|
|
13526
|
-
type:
|
|
13542
|
+
type: 1,
|
|
13527
13543
|
ns,
|
|
13528
13544
|
tag,
|
|
13529
13545
|
tagType,
|
|
@@ -13545,7 +13561,7 @@ function isComponent(tag, props, context) {
|
|
|
13545
13561
|
}
|
|
13546
13562
|
for (let i = 0; i < props.length; i++) {
|
|
13547
13563
|
const p = props[i];
|
|
13548
|
-
if (p.type ===
|
|
13564
|
+
if (p.type === 6) {
|
|
13549
13565
|
if (p.name === "is" && p.value) {
|
|
13550
13566
|
if (p.value.content.startsWith("vue:")) {
|
|
13551
13567
|
return true;
|
|
@@ -13578,23 +13594,23 @@ function parseAttributes(context, type) {
|
|
|
13578
13594
|
const attributeNames = /* @__PURE__ */ new Set();
|
|
13579
13595
|
while (context.source.length > 0 && !startsWith(context.source, ">") && !startsWith(context.source, "/>")) {
|
|
13580
13596
|
if (startsWith(context.source, "/")) {
|
|
13581
|
-
emitError(context,
|
|
13597
|
+
emitError(context, 22);
|
|
13582
13598
|
advanceBy(context, 1);
|
|
13583
13599
|
advanceSpaces(context);
|
|
13584
13600
|
continue;
|
|
13585
13601
|
}
|
|
13586
13602
|
if (type === 1 /* End */) {
|
|
13587
|
-
emitError(context,
|
|
13603
|
+
emitError(context, 3);
|
|
13588
13604
|
}
|
|
13589
13605
|
const attr = parseAttribute(context, attributeNames);
|
|
13590
|
-
if (attr.type ===
|
|
13606
|
+
if (attr.type === 6 && attr.value && attr.name === "class") {
|
|
13591
13607
|
attr.value.content = attr.value.content.replace(/\s+/g, " ").trim();
|
|
13592
13608
|
}
|
|
13593
13609
|
if (type === 0 /* Start */) {
|
|
13594
13610
|
props.push(attr);
|
|
13595
13611
|
}
|
|
13596
13612
|
if (/^[^\t\r\n\f />]/.test(context.source)) {
|
|
13597
|
-
emitError(context,
|
|
13613
|
+
emitError(context, 15);
|
|
13598
13614
|
}
|
|
13599
13615
|
advanceSpaces(context);
|
|
13600
13616
|
}
|
|
@@ -13605,11 +13621,11 @@ function parseAttribute(context, nameSet) {
|
|
|
13605
13621
|
const match = /^[^\t\r\n\f />][^\t\r\n\f />=]*/.exec(context.source);
|
|
13606
13622
|
const name = match[0];
|
|
13607
13623
|
if (nameSet.has(name)) {
|
|
13608
|
-
emitError(context,
|
|
13624
|
+
emitError(context, 2);
|
|
13609
13625
|
}
|
|
13610
13626
|
nameSet.add(name);
|
|
13611
13627
|
if (name[0] === "=") {
|
|
13612
|
-
emitError(context,
|
|
13628
|
+
emitError(context, 19);
|
|
13613
13629
|
}
|
|
13614
13630
|
{
|
|
13615
13631
|
const pattern = /["'<]/g;
|
|
@@ -13617,7 +13633,7 @@ function parseAttribute(context, nameSet) {
|
|
|
13617
13633
|
while (m = pattern.exec(name)) {
|
|
13618
13634
|
emitError(
|
|
13619
13635
|
context,
|
|
13620
|
-
|
|
13636
|
+
17,
|
|
13621
13637
|
m.index
|
|
13622
13638
|
);
|
|
13623
13639
|
}
|
|
@@ -13630,7 +13646,7 @@ function parseAttribute(context, nameSet) {
|
|
|
13630
13646
|
advanceSpaces(context);
|
|
13631
13647
|
value = parseAttributeValue(context);
|
|
13632
13648
|
if (!value) {
|
|
13633
|
-
emitError(context,
|
|
13649
|
+
emitError(context, 13);
|
|
13634
13650
|
}
|
|
13635
13651
|
}
|
|
13636
13652
|
const loc = getSelection(context, start);
|
|
@@ -13660,7 +13676,7 @@ function parseAttribute(context, nameSet) {
|
|
|
13660
13676
|
if (!content.endsWith("]")) {
|
|
13661
13677
|
emitError(
|
|
13662
13678
|
context,
|
|
13663
|
-
|
|
13679
|
+
27
|
|
13664
13680
|
);
|
|
13665
13681
|
content = content.slice(1);
|
|
13666
13682
|
} else {
|
|
@@ -13670,10 +13686,10 @@ function parseAttribute(context, nameSet) {
|
|
|
13670
13686
|
content += match2[3] || "";
|
|
13671
13687
|
}
|
|
13672
13688
|
arg = {
|
|
13673
|
-
type:
|
|
13689
|
+
type: 4,
|
|
13674
13690
|
content,
|
|
13675
13691
|
isStatic,
|
|
13676
|
-
constType: isStatic ?
|
|
13692
|
+
constType: isStatic ? 3 : 0,
|
|
13677
13693
|
loc: loc2
|
|
13678
13694
|
};
|
|
13679
13695
|
}
|
|
@@ -13706,10 +13722,10 @@ function parseAttribute(context, nameSet) {
|
|
|
13706
13722
|
}
|
|
13707
13723
|
}
|
|
13708
13724
|
return {
|
|
13709
|
-
type:
|
|
13725
|
+
type: 7,
|
|
13710
13726
|
name: dirName,
|
|
13711
13727
|
exp: value && {
|
|
13712
|
-
type:
|
|
13728
|
+
type: 4,
|
|
13713
13729
|
content: value.content,
|
|
13714
13730
|
isStatic: false,
|
|
13715
13731
|
// Treat as non-constant by default. This can be potentially set to
|
|
@@ -13723,13 +13739,13 @@ function parseAttribute(context, nameSet) {
|
|
|
13723
13739
|
};
|
|
13724
13740
|
}
|
|
13725
13741
|
if (!context.inVPre && startsWith(name, "v-")) {
|
|
13726
|
-
emitError(context,
|
|
13742
|
+
emitError(context, 26);
|
|
13727
13743
|
}
|
|
13728
13744
|
return {
|
|
13729
|
-
type:
|
|
13745
|
+
type: 6,
|
|
13730
13746
|
name,
|
|
13731
13747
|
value: value && {
|
|
13732
|
-
type:
|
|
13748
|
+
type: 2,
|
|
13733
13749
|
content: value.content,
|
|
13734
13750
|
loc: value.loc
|
|
13735
13751
|
},
|
|
@@ -13748,10 +13764,10 @@ function parseAttributeValue(context) {
|
|
|
13748
13764
|
content = parseTextData(
|
|
13749
13765
|
context,
|
|
13750
13766
|
context.source.length,
|
|
13751
|
-
|
|
13767
|
+
4
|
|
13752
13768
|
);
|
|
13753
13769
|
} else {
|
|
13754
|
-
content = parseTextData(context, endIndex,
|
|
13770
|
+
content = parseTextData(context, endIndex, 4);
|
|
13755
13771
|
advanceBy(context, 1);
|
|
13756
13772
|
}
|
|
13757
13773
|
} else {
|
|
@@ -13764,11 +13780,11 @@ function parseAttributeValue(context) {
|
|
|
13764
13780
|
while (m = unexpectedChars.exec(match[0])) {
|
|
13765
13781
|
emitError(
|
|
13766
13782
|
context,
|
|
13767
|
-
|
|
13783
|
+
18,
|
|
13768
13784
|
m.index
|
|
13769
13785
|
);
|
|
13770
13786
|
}
|
|
13771
|
-
content = parseTextData(context, match[0].length,
|
|
13787
|
+
content = parseTextData(context, match[0].length, 4);
|
|
13772
13788
|
}
|
|
13773
13789
|
return { content, isQuoted, loc: getSelection(context, start) };
|
|
13774
13790
|
}
|
|
@@ -13776,7 +13792,7 @@ function parseInterpolation(context, mode) {
|
|
|
13776
13792
|
const [open, close] = context.options.delimiters;
|
|
13777
13793
|
const closeIndex = context.source.indexOf(close, open.length);
|
|
13778
13794
|
if (closeIndex === -1) {
|
|
13779
|
-
emitError(context,
|
|
13795
|
+
emitError(context, 25);
|
|
13780
13796
|
return void 0;
|
|
13781
13797
|
}
|
|
13782
13798
|
const start = getCursor(context);
|
|
@@ -13795,9 +13811,9 @@ function parseInterpolation(context, mode) {
|
|
|
13795
13811
|
advancePositionWithMutation(innerEnd, rawContent, endOffset);
|
|
13796
13812
|
advanceBy(context, close.length);
|
|
13797
13813
|
return {
|
|
13798
|
-
type:
|
|
13814
|
+
type: 5,
|
|
13799
13815
|
content: {
|
|
13800
|
-
type:
|
|
13816
|
+
type: 4,
|
|
13801
13817
|
isStatic: false,
|
|
13802
13818
|
// Set `isConstant` to false by default and will decide in transformExpression
|
|
13803
13819
|
constType: 0,
|
|
@@ -13808,7 +13824,7 @@ function parseInterpolation(context, mode) {
|
|
|
13808
13824
|
};
|
|
13809
13825
|
}
|
|
13810
13826
|
function parseText(context, mode) {
|
|
13811
|
-
const endTokens = mode ===
|
|
13827
|
+
const endTokens = mode === 3 ? ["]]>"] : ["<", context.options.delimiters[0]];
|
|
13812
13828
|
let endIndex = context.source.length;
|
|
13813
13829
|
for (let i = 0; i < endTokens.length; i++) {
|
|
13814
13830
|
const index = context.source.indexOf(endTokens[i], 1);
|
|
@@ -13819,7 +13835,7 @@ function parseText(context, mode) {
|
|
|
13819
13835
|
const start = getCursor(context);
|
|
13820
13836
|
const content = parseTextData(context, endIndex, mode);
|
|
13821
13837
|
return {
|
|
13822
|
-
type:
|
|
13838
|
+
type: 2,
|
|
13823
13839
|
content,
|
|
13824
13840
|
loc: getSelection(context, start)
|
|
13825
13841
|
};
|
|
@@ -13827,12 +13843,12 @@ function parseText(context, mode) {
|
|
|
13827
13843
|
function parseTextData(context, length, mode) {
|
|
13828
13844
|
const rawText = context.source.slice(0, length);
|
|
13829
13845
|
advanceBy(context, length);
|
|
13830
|
-
if (mode ===
|
|
13846
|
+
if (mode === 2 || mode === 3 || !rawText.includes("&")) {
|
|
13831
13847
|
return rawText;
|
|
13832
13848
|
} else {
|
|
13833
13849
|
return context.options.decodeEntities(
|
|
13834
13850
|
rawText,
|
|
13835
|
-
mode ===
|
|
13851
|
+
mode === 4
|
|
13836
13852
|
);
|
|
13837
13853
|
}
|
|
13838
13854
|
}
|
|
@@ -13888,7 +13904,7 @@ function emitError(context, code, offset, loc = getCursor(context)) {
|
|
|
13888
13904
|
function isEnd(context, mode, ancestors) {
|
|
13889
13905
|
const s = context.source;
|
|
13890
13906
|
switch (mode) {
|
|
13891
|
-
case
|
|
13907
|
+
case 0:
|
|
13892
13908
|
if (startsWith(s, "</")) {
|
|
13893
13909
|
for (let i = ancestors.length - 1; i >= 0; --i) {
|
|
13894
13910
|
if (startsWithEndTagOpen(s, ancestors[i].tag)) {
|
|
@@ -13897,15 +13913,15 @@ function isEnd(context, mode, ancestors) {
|
|
|
13897
13913
|
}
|
|
13898
13914
|
}
|
|
13899
13915
|
break;
|
|
13900
|
-
case
|
|
13901
|
-
case
|
|
13916
|
+
case 1:
|
|
13917
|
+
case 2: {
|
|
13902
13918
|
const parent = last(ancestors);
|
|
13903
13919
|
if (parent && startsWithEndTagOpen(s, parent.tag)) {
|
|
13904
13920
|
return true;
|
|
13905
13921
|
}
|
|
13906
13922
|
break;
|
|
13907
13923
|
}
|
|
13908
|
-
case
|
|
13924
|
+
case 3:
|
|
13909
13925
|
if (startsWith(s, "]]>")) {
|
|
13910
13926
|
return true;
|
|
13911
13927
|
}
|
|
@@ -13928,7 +13944,7 @@ function hoistStatic(root, context) {
|
|
|
13928
13944
|
}
|
|
13929
13945
|
function isSingleElementRoot(root, child) {
|
|
13930
13946
|
const { children } = root;
|
|
13931
|
-
return children.length === 1 && child.type ===
|
|
13947
|
+
return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
|
|
13932
13948
|
}
|
|
13933
13949
|
function walk(node, context, doNotHoistNode = false) {
|
|
13934
13950
|
const { children } = node;
|
|
@@ -13936,10 +13952,10 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
13936
13952
|
let hoistedCount = 0;
|
|
13937
13953
|
for (let i = 0; i < children.length; i++) {
|
|
13938
13954
|
const child = children[i];
|
|
13939
|
-
if (child.type ===
|
|
13955
|
+
if (child.type === 1 && child.tagType === 0) {
|
|
13940
13956
|
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
13941
13957
|
if (constantType > 0) {
|
|
13942
|
-
if (constantType >=
|
|
13958
|
+
if (constantType >= 2) {
|
|
13943
13959
|
child.codegenNode.patchFlag = -1 + (` /* HOISTED */` );
|
|
13944
13960
|
child.codegenNode = context.hoist(child.codegenNode);
|
|
13945
13961
|
hoistedCount++;
|
|
@@ -13947,9 +13963,9 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
13947
13963
|
}
|
|
13948
13964
|
} else {
|
|
13949
13965
|
const codegenNode = child.codegenNode;
|
|
13950
|
-
if (codegenNode.type ===
|
|
13966
|
+
if (codegenNode.type === 13) {
|
|
13951
13967
|
const flag = getPatchFlag(codegenNode);
|
|
13952
|
-
if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >=
|
|
13968
|
+
if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
|
|
13953
13969
|
const props = getNodeProps(child);
|
|
13954
13970
|
if (props) {
|
|
13955
13971
|
codegenNode.props = context.hoist(props);
|
|
@@ -13961,8 +13977,8 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
13961
13977
|
}
|
|
13962
13978
|
}
|
|
13963
13979
|
}
|
|
13964
|
-
if (child.type ===
|
|
13965
|
-
const isComponent = child.tagType ===
|
|
13980
|
+
if (child.type === 1) {
|
|
13981
|
+
const isComponent = child.tagType === 1;
|
|
13966
13982
|
if (isComponent) {
|
|
13967
13983
|
context.scopes.vSlot++;
|
|
13968
13984
|
}
|
|
@@ -13970,9 +13986,9 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
13970
13986
|
if (isComponent) {
|
|
13971
13987
|
context.scopes.vSlot--;
|
|
13972
13988
|
}
|
|
13973
|
-
} else if (child.type ===
|
|
13989
|
+
} else if (child.type === 11) {
|
|
13974
13990
|
walk(child, context, child.children.length === 1);
|
|
13975
|
-
} else if (child.type ===
|
|
13991
|
+
} else if (child.type === 9) {
|
|
13976
13992
|
for (let i2 = 0; i2 < child.branches.length; i2++) {
|
|
13977
13993
|
walk(
|
|
13978
13994
|
child.branches[i2],
|
|
@@ -13985,7 +14001,7 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
13985
14001
|
if (hoistedCount && context.transformHoist) {
|
|
13986
14002
|
context.transformHoist(children, context, node);
|
|
13987
14003
|
}
|
|
13988
|
-
if (hoistedCount && hoistedCount === originalCount && node.type ===
|
|
14004
|
+
if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
|
|
13989
14005
|
node.codegenNode.children = context.hoist(
|
|
13990
14006
|
createArrayExpression(node.codegenNode.children)
|
|
13991
14007
|
);
|
|
@@ -13994,8 +14010,8 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
13994
14010
|
function getConstantType(node, context) {
|
|
13995
14011
|
const { constantCache } = context;
|
|
13996
14012
|
switch (node.type) {
|
|
13997
|
-
case
|
|
13998
|
-
if (node.tagType !==
|
|
14013
|
+
case 1:
|
|
14014
|
+
if (node.tagType !== 0) {
|
|
13999
14015
|
return 0;
|
|
14000
14016
|
}
|
|
14001
14017
|
const cached = constantCache.get(node);
|
|
@@ -14003,7 +14019,7 @@ function getConstantType(node, context) {
|
|
|
14003
14019
|
return cached;
|
|
14004
14020
|
}
|
|
14005
14021
|
const codegenNode = node.codegenNode;
|
|
14006
|
-
if (codegenNode.type !==
|
|
14022
|
+
if (codegenNode.type !== 13) {
|
|
14007
14023
|
return 0;
|
|
14008
14024
|
}
|
|
14009
14025
|
if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
|
|
@@ -14011,7 +14027,7 @@ function getConstantType(node, context) {
|
|
|
14011
14027
|
}
|
|
14012
14028
|
const flag = getPatchFlag(codegenNode);
|
|
14013
14029
|
if (!flag) {
|
|
14014
|
-
let returnType2 =
|
|
14030
|
+
let returnType2 = 3;
|
|
14015
14031
|
const generatedPropsType = getGeneratedPropsConstantType(node, context);
|
|
14016
14032
|
if (generatedPropsType === 0) {
|
|
14017
14033
|
constantCache.set(node, 0);
|
|
@@ -14030,10 +14046,10 @@ function getConstantType(node, context) {
|
|
|
14030
14046
|
returnType2 = childType;
|
|
14031
14047
|
}
|
|
14032
14048
|
}
|
|
14033
|
-
if (returnType2 >
|
|
14049
|
+
if (returnType2 > 1) {
|
|
14034
14050
|
for (let i = 0; i < node.props.length; i++) {
|
|
14035
14051
|
const p = node.props[i];
|
|
14036
|
-
if (p.type ===
|
|
14052
|
+
if (p.type === 7 && p.name === "bind" && p.exp) {
|
|
14037
14053
|
const expType = getConstantType(p.exp, context);
|
|
14038
14054
|
if (expType === 0) {
|
|
14039
14055
|
constantCache.set(node, 0);
|
|
@@ -14048,7 +14064,7 @@ function getConstantType(node, context) {
|
|
|
14048
14064
|
if (codegenNode.isBlock) {
|
|
14049
14065
|
for (let i = 0; i < node.props.length; i++) {
|
|
14050
14066
|
const p = node.props[i];
|
|
14051
|
-
if (p.type ===
|
|
14067
|
+
if (p.type === 7) {
|
|
14052
14068
|
constantCache.set(node, 0);
|
|
14053
14069
|
return 0;
|
|
14054
14070
|
}
|
|
@@ -14066,20 +14082,20 @@ function getConstantType(node, context) {
|
|
|
14066
14082
|
constantCache.set(node, 0);
|
|
14067
14083
|
return 0;
|
|
14068
14084
|
}
|
|
14069
|
-
case
|
|
14070
|
-
case
|
|
14071
|
-
return
|
|
14072
|
-
case
|
|
14073
|
-
case
|
|
14074
|
-
case
|
|
14085
|
+
case 2:
|
|
14086
|
+
case 3:
|
|
14087
|
+
return 3;
|
|
14088
|
+
case 9:
|
|
14089
|
+
case 11:
|
|
14090
|
+
case 10:
|
|
14075
14091
|
return 0;
|
|
14076
|
-
case
|
|
14077
|
-
case
|
|
14092
|
+
case 5:
|
|
14093
|
+
case 12:
|
|
14078
14094
|
return getConstantType(node.content, context);
|
|
14079
|
-
case
|
|
14095
|
+
case 4:
|
|
14080
14096
|
return node.constType;
|
|
14081
|
-
case
|
|
14082
|
-
let returnType =
|
|
14097
|
+
case 8:
|
|
14098
|
+
let returnType = 3;
|
|
14083
14099
|
for (let i = 0; i < node.children.length; i++) {
|
|
14084
14100
|
const child = node.children[i];
|
|
14085
14101
|
if (isString(child) || isSymbol(child)) {
|
|
@@ -14104,20 +14120,20 @@ const allowHoistedHelperSet = /* @__PURE__ */ new Set([
|
|
|
14104
14120
|
GUARD_REACTIVE_PROPS
|
|
14105
14121
|
]);
|
|
14106
14122
|
function getConstantTypeOfHelperCall(value, context) {
|
|
14107
|
-
if (value.type ===
|
|
14123
|
+
if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
|
|
14108
14124
|
const arg = value.arguments[0];
|
|
14109
|
-
if (arg.type ===
|
|
14125
|
+
if (arg.type === 4) {
|
|
14110
14126
|
return getConstantType(arg, context);
|
|
14111
|
-
} else if (arg.type ===
|
|
14127
|
+
} else if (arg.type === 14) {
|
|
14112
14128
|
return getConstantTypeOfHelperCall(arg, context);
|
|
14113
14129
|
}
|
|
14114
14130
|
}
|
|
14115
14131
|
return 0;
|
|
14116
14132
|
}
|
|
14117
14133
|
function getGeneratedPropsConstantType(node, context) {
|
|
14118
|
-
let returnType =
|
|
14134
|
+
let returnType = 3;
|
|
14119
14135
|
const props = getNodeProps(node);
|
|
14120
|
-
if (props && props.type ===
|
|
14136
|
+
if (props && props.type === 15) {
|
|
14121
14137
|
const { properties } = props;
|
|
14122
14138
|
for (let i = 0; i < properties.length; i++) {
|
|
14123
14139
|
const { key, value } = properties[i];
|
|
@@ -14129,9 +14145,9 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
14129
14145
|
returnType = keyType;
|
|
14130
14146
|
}
|
|
14131
14147
|
let valueType;
|
|
14132
|
-
if (value.type ===
|
|
14148
|
+
if (value.type === 4) {
|
|
14133
14149
|
valueType = getConstantType(value, context);
|
|
14134
|
-
} else if (value.type ===
|
|
14150
|
+
} else if (value.type === 14) {
|
|
14135
14151
|
valueType = getConstantTypeOfHelperCall(value, context);
|
|
14136
14152
|
} else {
|
|
14137
14153
|
valueType = 0;
|
|
@@ -14148,7 +14164,7 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
14148
14164
|
}
|
|
14149
14165
|
function getNodeProps(node) {
|
|
14150
14166
|
const codegenNode = node.codegenNode;
|
|
14151
|
-
if (codegenNode.type ===
|
|
14167
|
+
if (codegenNode.type === 13) {
|
|
14152
14168
|
return codegenNode.props;
|
|
14153
14169
|
}
|
|
14154
14170
|
}
|
|
@@ -14284,7 +14300,7 @@ function createTransformContext(root, {
|
|
|
14284
14300
|
addId(exp);
|
|
14285
14301
|
} else if (exp.identifiers) {
|
|
14286
14302
|
exp.identifiers.forEach(addId);
|
|
14287
|
-
} else if (exp.type ===
|
|
14303
|
+
} else if (exp.type === 4) {
|
|
14288
14304
|
addId(exp.content);
|
|
14289
14305
|
}
|
|
14290
14306
|
}
|
|
@@ -14295,7 +14311,7 @@ function createTransformContext(root, {
|
|
|
14295
14311
|
removeId(exp);
|
|
14296
14312
|
} else if (exp.identifiers) {
|
|
14297
14313
|
exp.identifiers.forEach(removeId);
|
|
14298
|
-
} else if (exp.type ===
|
|
14314
|
+
} else if (exp.type === 4) {
|
|
14299
14315
|
removeId(exp.content);
|
|
14300
14316
|
}
|
|
14301
14317
|
}
|
|
@@ -14308,7 +14324,7 @@ function createTransformContext(root, {
|
|
|
14308
14324
|
`_hoisted_${context.hoists.length}`,
|
|
14309
14325
|
false,
|
|
14310
14326
|
exp.loc,
|
|
14311
|
-
|
|
14327
|
+
2
|
|
14312
14328
|
);
|
|
14313
14329
|
identifier.hoisted = exp;
|
|
14314
14330
|
return identifier;
|
|
@@ -14359,8 +14375,8 @@ function createRootCodegen(root, context) {
|
|
|
14359
14375
|
const child = children[0];
|
|
14360
14376
|
if (isSingleElementRoot(root, child) && child.codegenNode) {
|
|
14361
14377
|
const codegenNode = child.codegenNode;
|
|
14362
|
-
if (codegenNode.type ===
|
|
14363
|
-
|
|
14378
|
+
if (codegenNode.type === 13) {
|
|
14379
|
+
convertToBlock(codegenNode, context);
|
|
14364
14380
|
}
|
|
14365
14381
|
root.codegenNode = codegenNode;
|
|
14366
14382
|
} else {
|
|
@@ -14369,7 +14385,7 @@ function createRootCodegen(root, context) {
|
|
|
14369
14385
|
} else if (children.length > 1) {
|
|
14370
14386
|
let patchFlag = 64;
|
|
14371
14387
|
let patchFlagText = PatchFlagNames[64];
|
|
14372
|
-
if (children.filter((c) => c.type !==
|
|
14388
|
+
if (children.filter((c) => c.type !== 3).length === 1) {
|
|
14373
14389
|
patchFlag |= 2048;
|
|
14374
14390
|
patchFlagText += `, ${PatchFlagNames[2048]}`;
|
|
14375
14391
|
}
|
|
@@ -14423,25 +14439,25 @@ function traverseNode(node, context) {
|
|
|
14423
14439
|
}
|
|
14424
14440
|
}
|
|
14425
14441
|
switch (node.type) {
|
|
14426
|
-
case
|
|
14442
|
+
case 3:
|
|
14427
14443
|
if (!context.ssr) {
|
|
14428
14444
|
context.helper(CREATE_COMMENT);
|
|
14429
14445
|
}
|
|
14430
14446
|
break;
|
|
14431
|
-
case
|
|
14447
|
+
case 5:
|
|
14432
14448
|
if (!context.ssr) {
|
|
14433
14449
|
context.helper(TO_DISPLAY_STRING);
|
|
14434
14450
|
}
|
|
14435
14451
|
break;
|
|
14436
|
-
case
|
|
14452
|
+
case 9:
|
|
14437
14453
|
for (let i2 = 0; i2 < node.branches.length; i2++) {
|
|
14438
14454
|
traverseNode(node.branches[i2], context);
|
|
14439
14455
|
}
|
|
14440
14456
|
break;
|
|
14441
|
-
case
|
|
14442
|
-
case
|
|
14443
|
-
case
|
|
14444
|
-
case
|
|
14457
|
+
case 10:
|
|
14458
|
+
case 11:
|
|
14459
|
+
case 1:
|
|
14460
|
+
case 0:
|
|
14445
14461
|
traverseChildren(node, context);
|
|
14446
14462
|
break;
|
|
14447
14463
|
}
|
|
@@ -14454,15 +14470,15 @@ function traverseNode(node, context) {
|
|
|
14454
14470
|
function createStructuralDirectiveTransform(name, fn) {
|
|
14455
14471
|
const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
|
|
14456
14472
|
return (node, context) => {
|
|
14457
|
-
if (node.type ===
|
|
14473
|
+
if (node.type === 1) {
|
|
14458
14474
|
const { props } = node;
|
|
14459
|
-
if (node.tagType ===
|
|
14475
|
+
if (node.tagType === 3 && props.some(isVSlot)) {
|
|
14460
14476
|
return;
|
|
14461
14477
|
}
|
|
14462
14478
|
const exitFns = [];
|
|
14463
14479
|
for (let i = 0; i < props.length; i++) {
|
|
14464
14480
|
const prop = props[i];
|
|
14465
|
-
if (prop.type ===
|
|
14481
|
+
if (prop.type === 7 && matches(prop.name)) {
|
|
14466
14482
|
props.splice(i, 1);
|
|
14467
14483
|
i--;
|
|
14468
14484
|
const onExit = fn(node, prop, context);
|
|
@@ -14520,7 +14536,7 @@ function createCodegenContext(ast, {
|
|
|
14520
14536
|
if (context.map) {
|
|
14521
14537
|
if (node) {
|
|
14522
14538
|
let name;
|
|
14523
|
-
if (node.type ===
|
|
14539
|
+
if (node.type === 4 && !node.isStatic) {
|
|
14524
14540
|
const content = node.content.replace(/^_ctx\./, "");
|
|
14525
14541
|
if (content !== node.content && isSimpleIdentifier(content)) {
|
|
14526
14542
|
name = content;
|
|
@@ -14796,7 +14812,7 @@ function genHoists(hoists, context) {
|
|
|
14796
14812
|
for (let i = 0; i < hoists.length; i++) {
|
|
14797
14813
|
const exp = hoists[i];
|
|
14798
14814
|
if (exp) {
|
|
14799
|
-
const needScopeIdWrapper = genScopeId && exp.type ===
|
|
14815
|
+
const needScopeIdWrapper = genScopeId && exp.type === 13;
|
|
14800
14816
|
push(
|
|
14801
14817
|
`const _hoisted_${i + 1} = ${needScopeIdWrapper ? `${PURE_ANNOTATION} _withScopeId(() => ` : ``}`
|
|
14802
14818
|
);
|
|
@@ -14821,7 +14837,7 @@ function genImports(importsOptions, context) {
|
|
|
14821
14837
|
});
|
|
14822
14838
|
}
|
|
14823
14839
|
function isText(n) {
|
|
14824
|
-
return isString(n) || n.type ===
|
|
14840
|
+
return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
|
|
14825
14841
|
}
|
|
14826
14842
|
function genNodeListAsArray(nodes, context) {
|
|
14827
14843
|
const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
|
|
@@ -14862,73 +14878,73 @@ function genNode(node, context) {
|
|
|
14862
14878
|
return;
|
|
14863
14879
|
}
|
|
14864
14880
|
switch (node.type) {
|
|
14865
|
-
case
|
|
14866
|
-
case
|
|
14867
|
-
case
|
|
14881
|
+
case 1:
|
|
14882
|
+
case 9:
|
|
14883
|
+
case 11:
|
|
14868
14884
|
assert(
|
|
14869
14885
|
node.codegenNode != null,
|
|
14870
14886
|
`Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
|
|
14871
14887
|
);
|
|
14872
14888
|
genNode(node.codegenNode, context);
|
|
14873
14889
|
break;
|
|
14874
|
-
case
|
|
14890
|
+
case 2:
|
|
14875
14891
|
genText(node, context);
|
|
14876
14892
|
break;
|
|
14877
|
-
case
|
|
14893
|
+
case 4:
|
|
14878
14894
|
genExpression(node, context);
|
|
14879
14895
|
break;
|
|
14880
|
-
case
|
|
14896
|
+
case 5:
|
|
14881
14897
|
genInterpolation(node, context);
|
|
14882
14898
|
break;
|
|
14883
|
-
case
|
|
14899
|
+
case 12:
|
|
14884
14900
|
genNode(node.codegenNode, context);
|
|
14885
14901
|
break;
|
|
14886
|
-
case
|
|
14902
|
+
case 8:
|
|
14887
14903
|
genCompoundExpression(node, context);
|
|
14888
14904
|
break;
|
|
14889
|
-
case
|
|
14905
|
+
case 3:
|
|
14890
14906
|
genComment(node, context);
|
|
14891
14907
|
break;
|
|
14892
|
-
case
|
|
14908
|
+
case 13:
|
|
14893
14909
|
genVNodeCall(node, context);
|
|
14894
14910
|
break;
|
|
14895
|
-
case
|
|
14911
|
+
case 14:
|
|
14896
14912
|
genCallExpression(node, context);
|
|
14897
14913
|
break;
|
|
14898
|
-
case
|
|
14914
|
+
case 15:
|
|
14899
14915
|
genObjectExpression(node, context);
|
|
14900
14916
|
break;
|
|
14901
|
-
case
|
|
14917
|
+
case 17:
|
|
14902
14918
|
genArrayExpression(node, context);
|
|
14903
14919
|
break;
|
|
14904
|
-
case
|
|
14920
|
+
case 18:
|
|
14905
14921
|
genFunctionExpression(node, context);
|
|
14906
14922
|
break;
|
|
14907
|
-
case
|
|
14923
|
+
case 19:
|
|
14908
14924
|
genConditionalExpression(node, context);
|
|
14909
14925
|
break;
|
|
14910
|
-
case
|
|
14926
|
+
case 20:
|
|
14911
14927
|
genCacheExpression(node, context);
|
|
14912
14928
|
break;
|
|
14913
|
-
case
|
|
14929
|
+
case 21:
|
|
14914
14930
|
genNodeList(node.body, context, true, false);
|
|
14915
14931
|
break;
|
|
14916
|
-
case
|
|
14932
|
+
case 22:
|
|
14917
14933
|
genTemplateLiteral(node, context);
|
|
14918
14934
|
break;
|
|
14919
|
-
case
|
|
14935
|
+
case 23:
|
|
14920
14936
|
genIfStatement(node, context);
|
|
14921
14937
|
break;
|
|
14922
|
-
case
|
|
14938
|
+
case 24:
|
|
14923
14939
|
genAssignmentExpression(node, context);
|
|
14924
14940
|
break;
|
|
14925
|
-
case
|
|
14941
|
+
case 25:
|
|
14926
14942
|
genSequenceExpression(node, context);
|
|
14927
14943
|
break;
|
|
14928
|
-
case
|
|
14944
|
+
case 26:
|
|
14929
14945
|
genReturnStatement(node, context);
|
|
14930
14946
|
break;
|
|
14931
|
-
case
|
|
14947
|
+
case 10:
|
|
14932
14948
|
break;
|
|
14933
14949
|
default:
|
|
14934
14950
|
{
|
|
@@ -14965,7 +14981,7 @@ function genCompoundExpression(node, context) {
|
|
|
14965
14981
|
}
|
|
14966
14982
|
function genExpressionAsPropertyKey(node, context) {
|
|
14967
14983
|
const { push } = context;
|
|
14968
|
-
if (node.type ===
|
|
14984
|
+
if (node.type === 8) {
|
|
14969
14985
|
push(`[`);
|
|
14970
14986
|
genCompoundExpression(node, context);
|
|
14971
14987
|
push(`]`);
|
|
@@ -15046,7 +15062,7 @@ function genObjectExpression(node, context) {
|
|
|
15046
15062
|
push(`{}`, node);
|
|
15047
15063
|
return;
|
|
15048
15064
|
}
|
|
15049
|
-
const multilines = properties.length > 1 || properties.some((p) => p.value.type !==
|
|
15065
|
+
const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
|
|
15050
15066
|
push(multilines ? `{` : `{ `);
|
|
15051
15067
|
multilines && indent();
|
|
15052
15068
|
for (let i = 0; i < properties.length; i++) {
|
|
@@ -15108,7 +15124,7 @@ function genFunctionExpression(node, context) {
|
|
|
15108
15124
|
function genConditionalExpression(node, context) {
|
|
15109
15125
|
const { test, consequent, alternate, newline: needNewline } = node;
|
|
15110
15126
|
const { push, indent, deindent, newline } = context;
|
|
15111
|
-
if (test.type ===
|
|
15127
|
+
if (test.type === 4) {
|
|
15112
15128
|
const needsParens = !isSimpleIdentifier(test.content);
|
|
15113
15129
|
needsParens && push(`(`);
|
|
15114
15130
|
genExpression(test, context);
|
|
@@ -15127,7 +15143,7 @@ function genConditionalExpression(node, context) {
|
|
|
15127
15143
|
needNewline && newline();
|
|
15128
15144
|
needNewline || push(` `);
|
|
15129
15145
|
push(`: `);
|
|
15130
|
-
const isNested = alternate.type ===
|
|
15146
|
+
const isNested = alternate.type === 19;
|
|
15131
15147
|
if (!isNested) {
|
|
15132
15148
|
context.indentLevel++;
|
|
15133
15149
|
}
|
|
@@ -15193,7 +15209,7 @@ function genIfStatement(node, context) {
|
|
|
15193
15209
|
push(`}`);
|
|
15194
15210
|
if (alternate) {
|
|
15195
15211
|
push(` else `);
|
|
15196
|
-
if (alternate.type ===
|
|
15212
|
+
if (alternate.type === 23) {
|
|
15197
15213
|
genIfStatement(alternate, context);
|
|
15198
15214
|
} else {
|
|
15199
15215
|
push(`{`);
|
|
@@ -15462,18 +15478,18 @@ function isReferenced(node, parent, grandparent) {
|
|
|
15462
15478
|
|
|
15463
15479
|
const isLiteralWhitelisted = /* @__PURE__ */ makeMap("true,false,null,this");
|
|
15464
15480
|
const transformExpression = (node, context) => {
|
|
15465
|
-
if (node.type ===
|
|
15481
|
+
if (node.type === 5) {
|
|
15466
15482
|
node.content = processExpression(
|
|
15467
15483
|
node.content,
|
|
15468
15484
|
context
|
|
15469
15485
|
);
|
|
15470
|
-
} else if (node.type ===
|
|
15486
|
+
} else if (node.type === 1) {
|
|
15471
15487
|
for (let i = 0; i < node.props.length; i++) {
|
|
15472
15488
|
const dir = node.props[i];
|
|
15473
|
-
if (dir.type ===
|
|
15489
|
+
if (dir.type === 7 && dir.name !== "for") {
|
|
15474
15490
|
const exp = dir.exp;
|
|
15475
15491
|
const arg = dir.arg;
|
|
15476
|
-
if (exp && exp.type ===
|
|
15492
|
+
if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
|
|
15477
15493
|
dir.exp = processExpression(
|
|
15478
15494
|
exp,
|
|
15479
15495
|
context,
|
|
@@ -15481,7 +15497,7 @@ const transformExpression = (node, context) => {
|
|
|
15481
15497
|
dir.name === "slot"
|
|
15482
15498
|
);
|
|
15483
15499
|
}
|
|
15484
|
-
if (arg && arg.type ===
|
|
15500
|
+
if (arg && arg.type === 4 && !arg.isStatic) {
|
|
15485
15501
|
dir.arg = processExpression(arg, context);
|
|
15486
15502
|
}
|
|
15487
15503
|
}
|
|
@@ -15557,14 +15573,14 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
15557
15573
|
const isLiteral = isLiteralWhitelisted(rawExp);
|
|
15558
15574
|
if (!asParams && !isScopeVarReference && !isAllowedGlobal && !isLiteral) {
|
|
15559
15575
|
if (bindingMetadata[node.content] === "setup-const") {
|
|
15560
|
-
node.constType =
|
|
15576
|
+
node.constType = 1;
|
|
15561
15577
|
}
|
|
15562
15578
|
node.content = rewriteIdentifier(rawExp);
|
|
15563
15579
|
} else if (!isScopeVarReference) {
|
|
15564
15580
|
if (isLiteral) {
|
|
15565
|
-
node.constType =
|
|
15581
|
+
node.constType = 3;
|
|
15566
15582
|
} else {
|
|
15567
|
-
node.constType =
|
|
15583
|
+
node.constType = 2;
|
|
15568
15584
|
}
|
|
15569
15585
|
}
|
|
15570
15586
|
return node;
|
|
@@ -15578,7 +15594,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
15578
15594
|
} catch (e) {
|
|
15579
15595
|
context.onError(
|
|
15580
15596
|
createCompilerError(
|
|
15581
|
-
|
|
15597
|
+
45,
|
|
15582
15598
|
node.loc,
|
|
15583
15599
|
void 0,
|
|
15584
15600
|
e.message
|
|
@@ -15637,7 +15653,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
15637
15653
|
start: advancePositionWithClone(node.loc.start, source2, start),
|
|
15638
15654
|
end: advancePositionWithClone(node.loc.start, source2, end)
|
|
15639
15655
|
},
|
|
15640
|
-
id.isConstant ?
|
|
15656
|
+
id.isConstant ? 3 : 0
|
|
15641
15657
|
)
|
|
15642
15658
|
);
|
|
15643
15659
|
if (i === ids.length - 1 && end < rawExp.length) {
|
|
@@ -15649,7 +15665,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
15649
15665
|
ret = createCompoundExpression(children, node.loc);
|
|
15650
15666
|
} else {
|
|
15651
15667
|
ret = node;
|
|
15652
|
-
ret.constType = bailConstant ? 0 :
|
|
15668
|
+
ret.constType = bailConstant ? 0 : 3;
|
|
15653
15669
|
}
|
|
15654
15670
|
ret.identifiers = Object.keys(knownIds);
|
|
15655
15671
|
return ret;
|
|
@@ -15666,7 +15682,7 @@ function canPrefix(id) {
|
|
|
15666
15682
|
function stringifyExpression(exp) {
|
|
15667
15683
|
if (isString(exp)) {
|
|
15668
15684
|
return exp;
|
|
15669
|
-
} else if (exp.type ===
|
|
15685
|
+
} else if (exp.type === 4) {
|
|
15670
15686
|
return exp.content;
|
|
15671
15687
|
} else {
|
|
15672
15688
|
return exp.children.map(stringifyExpression).join("");
|
|
@@ -15682,7 +15698,7 @@ const transformIf = createStructuralDirectiveTransform(
|
|
|
15682
15698
|
let key = 0;
|
|
15683
15699
|
while (i-- >= 0) {
|
|
15684
15700
|
const sibling = siblings[i];
|
|
15685
|
-
if (sibling && sibling.type ===
|
|
15701
|
+
if (sibling && sibling.type === 9) {
|
|
15686
15702
|
key += sibling.branches.length;
|
|
15687
15703
|
}
|
|
15688
15704
|
}
|
|
@@ -15709,7 +15725,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
15709
15725
|
if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
|
|
15710
15726
|
const loc = dir.exp ? dir.exp.loc : node.loc;
|
|
15711
15727
|
context.onError(
|
|
15712
|
-
createCompilerError(
|
|
15728
|
+
createCompilerError(28, dir.loc)
|
|
15713
15729
|
);
|
|
15714
15730
|
dir.exp = createSimpleExpression(`true`, false, loc);
|
|
15715
15731
|
}
|
|
@@ -15719,7 +15735,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
15719
15735
|
if (dir.name === "if") {
|
|
15720
15736
|
const branch = createIfBranch(node, dir);
|
|
15721
15737
|
const ifNode = {
|
|
15722
|
-
type:
|
|
15738
|
+
type: 9,
|
|
15723
15739
|
loc: node.loc,
|
|
15724
15740
|
branches: [branch]
|
|
15725
15741
|
};
|
|
@@ -15733,25 +15749,25 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
15733
15749
|
let i = siblings.indexOf(node);
|
|
15734
15750
|
while (i-- >= -1) {
|
|
15735
15751
|
const sibling = siblings[i];
|
|
15736
|
-
if (sibling && sibling.type ===
|
|
15752
|
+
if (sibling && sibling.type === 3) {
|
|
15737
15753
|
context.removeNode(sibling);
|
|
15738
15754
|
comments.unshift(sibling);
|
|
15739
15755
|
continue;
|
|
15740
15756
|
}
|
|
15741
|
-
if (sibling && sibling.type ===
|
|
15757
|
+
if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
|
|
15742
15758
|
context.removeNode(sibling);
|
|
15743
15759
|
continue;
|
|
15744
15760
|
}
|
|
15745
|
-
if (sibling && sibling.type ===
|
|
15761
|
+
if (sibling && sibling.type === 9) {
|
|
15746
15762
|
if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
|
|
15747
15763
|
context.onError(
|
|
15748
|
-
createCompilerError(
|
|
15764
|
+
createCompilerError(30, node.loc)
|
|
15749
15765
|
);
|
|
15750
15766
|
}
|
|
15751
15767
|
context.removeNode();
|
|
15752
15768
|
const branch = createIfBranch(node, dir);
|
|
15753
15769
|
if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
|
|
15754
|
-
!(context.parent && context.parent.type ===
|
|
15770
|
+
!(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
|
|
15755
15771
|
branch.children = [...comments, ...branch.children];
|
|
15756
15772
|
}
|
|
15757
15773
|
{
|
|
@@ -15761,7 +15777,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
15761
15777
|
if (isSameKey(userKey, key)) {
|
|
15762
15778
|
context.onError(
|
|
15763
15779
|
createCompilerError(
|
|
15764
|
-
|
|
15780
|
+
29,
|
|
15765
15781
|
branch.userKey.loc
|
|
15766
15782
|
)
|
|
15767
15783
|
);
|
|
@@ -15777,7 +15793,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
15777
15793
|
context.currentNode = null;
|
|
15778
15794
|
} else {
|
|
15779
15795
|
context.onError(
|
|
15780
|
-
createCompilerError(
|
|
15796
|
+
createCompilerError(30, node.loc)
|
|
15781
15797
|
);
|
|
15782
15798
|
}
|
|
15783
15799
|
break;
|
|
@@ -15785,9 +15801,9 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
15785
15801
|
}
|
|
15786
15802
|
}
|
|
15787
15803
|
function createIfBranch(node, dir) {
|
|
15788
|
-
const isTemplateIf = node.tagType ===
|
|
15804
|
+
const isTemplateIf = node.tagType === 3;
|
|
15789
15805
|
return {
|
|
15790
|
-
type:
|
|
15806
|
+
type: 10,
|
|
15791
15807
|
loc: node.loc,
|
|
15792
15808
|
condition: dir.name === "else" ? void 0 : dir.exp,
|
|
15793
15809
|
children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
|
|
@@ -15819,21 +15835,21 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
15819
15835
|
`${keyIndex}`,
|
|
15820
15836
|
false,
|
|
15821
15837
|
locStub,
|
|
15822
|
-
|
|
15838
|
+
2
|
|
15823
15839
|
)
|
|
15824
15840
|
);
|
|
15825
15841
|
const { children } = branch;
|
|
15826
15842
|
const firstChild = children[0];
|
|
15827
|
-
const needFragmentWrapper = children.length !== 1 || firstChild.type !==
|
|
15843
|
+
const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
|
|
15828
15844
|
if (needFragmentWrapper) {
|
|
15829
|
-
if (children.length === 1 && firstChild.type ===
|
|
15845
|
+
if (children.length === 1 && firstChild.type === 11) {
|
|
15830
15846
|
const vnodeCall = firstChild.codegenNode;
|
|
15831
15847
|
injectProp(vnodeCall, keyProperty, context);
|
|
15832
15848
|
return vnodeCall;
|
|
15833
15849
|
} else {
|
|
15834
15850
|
let patchFlag = 64;
|
|
15835
15851
|
let patchFlagText = PatchFlagNames[64];
|
|
15836
|
-
if (!branch.isTemplateIf && children.filter((c) => c.type !==
|
|
15852
|
+
if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
|
|
15837
15853
|
patchFlag |= 2048;
|
|
15838
15854
|
patchFlagText += `, ${PatchFlagNames[2048]}`;
|
|
15839
15855
|
}
|
|
@@ -15854,8 +15870,8 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
15854
15870
|
} else {
|
|
15855
15871
|
const ret = firstChild.codegenNode;
|
|
15856
15872
|
const vnodeCall = getMemoedVNodeCall(ret);
|
|
15857
|
-
if (vnodeCall.type ===
|
|
15858
|
-
|
|
15873
|
+
if (vnodeCall.type === 13) {
|
|
15874
|
+
convertToBlock(vnodeCall, context);
|
|
15859
15875
|
}
|
|
15860
15876
|
injectProp(vnodeCall, keyProperty, context);
|
|
15861
15877
|
return ret;
|
|
@@ -15865,7 +15881,7 @@ function isSameKey(a, b) {
|
|
|
15865
15881
|
if (!a || a.type !== b.type) {
|
|
15866
15882
|
return false;
|
|
15867
15883
|
}
|
|
15868
|
-
if (a.type ===
|
|
15884
|
+
if (a.type === 6) {
|
|
15869
15885
|
if (a.value.content !== b.value.content) {
|
|
15870
15886
|
return false;
|
|
15871
15887
|
}
|
|
@@ -15875,7 +15891,7 @@ function isSameKey(a, b) {
|
|
|
15875
15891
|
if (exp.type !== branchExp.type) {
|
|
15876
15892
|
return false;
|
|
15877
15893
|
}
|
|
15878
|
-
if (exp.type !==
|
|
15894
|
+
if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
|
|
15879
15895
|
return false;
|
|
15880
15896
|
}
|
|
15881
15897
|
}
|
|
@@ -15883,13 +15899,13 @@ function isSameKey(a, b) {
|
|
|
15883
15899
|
}
|
|
15884
15900
|
function getParentCondition(node) {
|
|
15885
15901
|
while (true) {
|
|
15886
|
-
if (node.type ===
|
|
15887
|
-
if (node.alternate.type ===
|
|
15902
|
+
if (node.type === 19) {
|
|
15903
|
+
if (node.alternate.type === 19) {
|
|
15888
15904
|
node = node.alternate;
|
|
15889
15905
|
} else {
|
|
15890
15906
|
return node;
|
|
15891
15907
|
}
|
|
15892
|
-
} else if (node.type ===
|
|
15908
|
+
} else if (node.type === 20) {
|
|
15893
15909
|
node = node.value;
|
|
15894
15910
|
}
|
|
15895
15911
|
}
|
|
@@ -15906,7 +15922,7 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
15906
15922
|
const isTemplate = isTemplateNode(node);
|
|
15907
15923
|
const memo = findDir(node, "memo");
|
|
15908
15924
|
const keyProp = findProp(node, `key`);
|
|
15909
|
-
const keyExp = keyProp && (keyProp.type ===
|
|
15925
|
+
const keyExp = keyProp && (keyProp.type === 6 ? createSimpleExpression(keyProp.value.content, true) : keyProp.exp);
|
|
15910
15926
|
const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null;
|
|
15911
15927
|
if (isTemplate) {
|
|
15912
15928
|
if (memo) {
|
|
@@ -15915,14 +15931,14 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
15915
15931
|
context
|
|
15916
15932
|
);
|
|
15917
15933
|
}
|
|
15918
|
-
if (keyProperty && keyProp.type !==
|
|
15934
|
+
if (keyProperty && keyProp.type !== 6) {
|
|
15919
15935
|
keyProperty.value = processExpression(
|
|
15920
15936
|
keyProperty.value,
|
|
15921
15937
|
context
|
|
15922
15938
|
);
|
|
15923
15939
|
}
|
|
15924
15940
|
}
|
|
15925
|
-
const isStableFragment = forNode.source.type ===
|
|
15941
|
+
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
|
|
15926
15942
|
const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
|
|
15927
15943
|
forNode.codegenNode = createVNodeCall(
|
|
15928
15944
|
context,
|
|
@@ -15942,12 +15958,12 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
15942
15958
|
const { children } = forNode;
|
|
15943
15959
|
if (isTemplate) {
|
|
15944
15960
|
node.children.some((c) => {
|
|
15945
|
-
if (c.type ===
|
|
15961
|
+
if (c.type === 1) {
|
|
15946
15962
|
const key = findProp(c, "key");
|
|
15947
15963
|
if (key) {
|
|
15948
15964
|
context.onError(
|
|
15949
15965
|
createCompilerError(
|
|
15950
|
-
|
|
15966
|
+
33,
|
|
15951
15967
|
key.loc
|
|
15952
15968
|
)
|
|
15953
15969
|
);
|
|
@@ -15956,7 +15972,7 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
15956
15972
|
}
|
|
15957
15973
|
});
|
|
15958
15974
|
}
|
|
15959
|
-
const needFragmentWrapper = children.length !== 1 || children[0].type !==
|
|
15975
|
+
const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
|
|
15960
15976
|
const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
|
|
15961
15977
|
if (slotOutlet) {
|
|
15962
15978
|
childBlock = slotOutlet.codegenNode;
|
|
@@ -16043,7 +16059,7 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
16043
16059
|
function processFor(node, dir, context, processCodegen) {
|
|
16044
16060
|
if (!dir.exp) {
|
|
16045
16061
|
context.onError(
|
|
16046
|
-
createCompilerError(
|
|
16062
|
+
createCompilerError(31, dir.loc)
|
|
16047
16063
|
);
|
|
16048
16064
|
return;
|
|
16049
16065
|
}
|
|
@@ -16055,14 +16071,14 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
16055
16071
|
);
|
|
16056
16072
|
if (!parseResult) {
|
|
16057
16073
|
context.onError(
|
|
16058
|
-
createCompilerError(
|
|
16074
|
+
createCompilerError(32, dir.loc)
|
|
16059
16075
|
);
|
|
16060
16076
|
return;
|
|
16061
16077
|
}
|
|
16062
16078
|
const { addIdentifiers, removeIdentifiers, scopes } = context;
|
|
16063
16079
|
const { source, value, key, index } = parseResult;
|
|
16064
16080
|
const forNode = {
|
|
16065
|
-
type:
|
|
16081
|
+
type: 11,
|
|
16066
16082
|
loc: dir.loc,
|
|
16067
16083
|
source,
|
|
16068
16084
|
valueAlias: value,
|
|
@@ -16176,7 +16192,7 @@ function createParamsList(args) {
|
|
|
16176
16192
|
|
|
16177
16193
|
const defaultFallback = createSimpleExpression(`undefined`, false);
|
|
16178
16194
|
const trackSlotScopes = (node, context) => {
|
|
16179
|
-
if (node.type ===
|
|
16195
|
+
if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
|
|
16180
16196
|
const vSlot = findDir(node, "slot");
|
|
16181
16197
|
if (vSlot) {
|
|
16182
16198
|
const slotProps = vSlot.exp;
|
|
@@ -16252,14 +16268,14 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
16252
16268
|
const slotElement = children[i];
|
|
16253
16269
|
let slotDir;
|
|
16254
16270
|
if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
|
|
16255
|
-
if (slotElement.type !==
|
|
16271
|
+
if (slotElement.type !== 3) {
|
|
16256
16272
|
implicitDefaultChildren.push(slotElement);
|
|
16257
16273
|
}
|
|
16258
16274
|
continue;
|
|
16259
16275
|
}
|
|
16260
16276
|
if (onComponentSlot) {
|
|
16261
16277
|
context.onError(
|
|
16262
|
-
createCompilerError(
|
|
16278
|
+
createCompilerError(37, slotDir.loc)
|
|
16263
16279
|
);
|
|
16264
16280
|
break;
|
|
16265
16281
|
}
|
|
@@ -16299,7 +16315,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
16299
16315
|
let prev;
|
|
16300
16316
|
while (j--) {
|
|
16301
16317
|
prev = children[j];
|
|
16302
|
-
if (prev.type !==
|
|
16318
|
+
if (prev.type !== 3) {
|
|
16303
16319
|
break;
|
|
16304
16320
|
}
|
|
16305
16321
|
}
|
|
@@ -16307,7 +16323,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
16307
16323
|
children.splice(i, 1);
|
|
16308
16324
|
i--;
|
|
16309
16325
|
let conditional = dynamicSlots[dynamicSlots.length - 1];
|
|
16310
|
-
while (conditional.alternate.type ===
|
|
16326
|
+
while (conditional.alternate.type === 19) {
|
|
16311
16327
|
conditional = conditional.alternate;
|
|
16312
16328
|
}
|
|
16313
16329
|
conditional.alternate = vElse.exp ? createConditionalExpression(
|
|
@@ -16321,7 +16337,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
16321
16337
|
) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
|
|
16322
16338
|
} else {
|
|
16323
16339
|
context.onError(
|
|
16324
|
-
createCompilerError(
|
|
16340
|
+
createCompilerError(30, vElse.loc)
|
|
16325
16341
|
);
|
|
16326
16342
|
}
|
|
16327
16343
|
} else if (vFor = findDir(slotElement, "for")) {
|
|
@@ -16341,7 +16357,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
16341
16357
|
);
|
|
16342
16358
|
} else {
|
|
16343
16359
|
context.onError(
|
|
16344
|
-
createCompilerError(
|
|
16360
|
+
createCompilerError(32, vFor.loc)
|
|
16345
16361
|
);
|
|
16346
16362
|
}
|
|
16347
16363
|
} else {
|
|
@@ -16349,7 +16365,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
16349
16365
|
if (seenSlotNames.has(staticSlotName)) {
|
|
16350
16366
|
context.onError(
|
|
16351
16367
|
createCompilerError(
|
|
16352
|
-
|
|
16368
|
+
38,
|
|
16353
16369
|
dirLoc
|
|
16354
16370
|
)
|
|
16355
16371
|
);
|
|
@@ -16380,7 +16396,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
16380
16396
|
if (hasNamedDefaultSlot) {
|
|
16381
16397
|
context.onError(
|
|
16382
16398
|
createCompilerError(
|
|
16383
|
-
|
|
16399
|
+
39,
|
|
16384
16400
|
implicitDefaultChildren[0].loc
|
|
16385
16401
|
)
|
|
16386
16402
|
);
|
|
@@ -16433,17 +16449,17 @@ function hasForwardedSlots(children) {
|
|
|
16433
16449
|
for (let i = 0; i < children.length; i++) {
|
|
16434
16450
|
const child = children[i];
|
|
16435
16451
|
switch (child.type) {
|
|
16436
|
-
case
|
|
16437
|
-
if (child.tagType ===
|
|
16452
|
+
case 1:
|
|
16453
|
+
if (child.tagType === 2 || hasForwardedSlots(child.children)) {
|
|
16438
16454
|
return true;
|
|
16439
16455
|
}
|
|
16440
16456
|
break;
|
|
16441
|
-
case
|
|
16457
|
+
case 9:
|
|
16442
16458
|
if (hasForwardedSlots(child.branches))
|
|
16443
16459
|
return true;
|
|
16444
16460
|
break;
|
|
16445
|
-
case
|
|
16446
|
-
case
|
|
16461
|
+
case 10:
|
|
16462
|
+
case 11:
|
|
16447
16463
|
if (hasForwardedSlots(child.children))
|
|
16448
16464
|
return true;
|
|
16449
16465
|
break;
|
|
@@ -16452,20 +16468,20 @@ function hasForwardedSlots(children) {
|
|
|
16452
16468
|
return false;
|
|
16453
16469
|
}
|
|
16454
16470
|
function isNonWhitespaceContent(node) {
|
|
16455
|
-
if (node.type !==
|
|
16471
|
+
if (node.type !== 2 && node.type !== 12)
|
|
16456
16472
|
return true;
|
|
16457
|
-
return node.type ===
|
|
16473
|
+
return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
|
|
16458
16474
|
}
|
|
16459
16475
|
|
|
16460
16476
|
const directiveImportMap = /* @__PURE__ */ new WeakMap();
|
|
16461
16477
|
const transformElement = (node, context) => {
|
|
16462
16478
|
return function postTransformElement() {
|
|
16463
16479
|
node = context.currentNode;
|
|
16464
|
-
if (!(node.type ===
|
|
16480
|
+
if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
|
|
16465
16481
|
return;
|
|
16466
16482
|
}
|
|
16467
16483
|
const { tag, props } = node;
|
|
16468
|
-
const isComponent = node.tagType ===
|
|
16484
|
+
const isComponent = node.tagType === 1;
|
|
16469
16485
|
let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
|
|
16470
16486
|
const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
|
|
16471
16487
|
let vnodeProps;
|
|
@@ -16508,7 +16524,7 @@ const transformElement = (node, context) => {
|
|
|
16508
16524
|
patchFlag |= 1024;
|
|
16509
16525
|
if (node.children.length > 1) {
|
|
16510
16526
|
context.onError(
|
|
16511
|
-
createCompilerError(
|
|
16527
|
+
createCompilerError(46, {
|
|
16512
16528
|
start: node.children[0].loc.start,
|
|
16513
16529
|
end: node.children[node.children.length - 1].loc.end,
|
|
16514
16530
|
source: ""
|
|
@@ -16528,11 +16544,11 @@ const transformElement = (node, context) => {
|
|
|
16528
16544
|
} else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
|
|
16529
16545
|
const child = node.children[0];
|
|
16530
16546
|
const type = child.type;
|
|
16531
|
-
const hasDynamicTextChild = type ===
|
|
16547
|
+
const hasDynamicTextChild = type === 5 || type === 8;
|
|
16532
16548
|
if (hasDynamicTextChild && getConstantType(child, context) === 0) {
|
|
16533
16549
|
patchFlag |= 1;
|
|
16534
16550
|
}
|
|
16535
|
-
if (hasDynamicTextChild || type ===
|
|
16551
|
+
if (hasDynamicTextChild || type === 2) {
|
|
16536
16552
|
vnodeChildren = child;
|
|
16537
16553
|
} else {
|
|
16538
16554
|
vnodeChildren = node.children;
|
|
@@ -16578,13 +16594,13 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
16578
16594
|
"COMPILER_IS_ON_ELEMENT",
|
|
16579
16595
|
context
|
|
16580
16596
|
)) {
|
|
16581
|
-
const exp = isProp.type ===
|
|
16597
|
+
const exp = isProp.type === 6 ? isProp.value && createSimpleExpression(isProp.value.content, true) : isProp.exp;
|
|
16582
16598
|
if (exp) {
|
|
16583
16599
|
return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
|
|
16584
16600
|
exp
|
|
16585
16601
|
]);
|
|
16586
16602
|
}
|
|
16587
|
-
} else if (isProp.type ===
|
|
16603
|
+
} else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
|
|
16588
16604
|
tag = isProp.value.content.slice(4);
|
|
16589
16605
|
}
|
|
16590
16606
|
}
|
|
@@ -16694,7 +16710,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16694
16710
|
if (isEventHandler && isReservedProp(name)) {
|
|
16695
16711
|
hasVnodeHook = true;
|
|
16696
16712
|
}
|
|
16697
|
-
if (value.type ===
|
|
16713
|
+
if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
|
|
16698
16714
|
return;
|
|
16699
16715
|
}
|
|
16700
16716
|
if (name === "ref") {
|
|
@@ -16715,7 +16731,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16715
16731
|
};
|
|
16716
16732
|
for (let i = 0; i < props.length; i++) {
|
|
16717
16733
|
const prop = props[i];
|
|
16718
|
-
if (prop.type ===
|
|
16734
|
+
if (prop.type === 6) {
|
|
16719
16735
|
const { loc, name, value } = prop;
|
|
16720
16736
|
let isStatic = true;
|
|
16721
16737
|
if (name === "ref") {
|
|
@@ -16768,7 +16784,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16768
16784
|
if (name === "slot") {
|
|
16769
16785
|
if (!isComponent) {
|
|
16770
16786
|
context.onError(
|
|
16771
|
-
createCompilerError(
|
|
16787
|
+
createCompilerError(40, loc)
|
|
16772
16788
|
);
|
|
16773
16789
|
}
|
|
16774
16790
|
continue;
|
|
@@ -16809,9 +16825,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16809
16825
|
{
|
|
16810
16826
|
{
|
|
16811
16827
|
const hasOverridableKeys = mergeArgs.some((arg2) => {
|
|
16812
|
-
if (arg2.type ===
|
|
16828
|
+
if (arg2.type === 15) {
|
|
16813
16829
|
return arg2.properties.some(({ key }) => {
|
|
16814
|
-
if (key.type !==
|
|
16830
|
+
if (key.type !== 4 || !key.isStatic) {
|
|
16815
16831
|
return true;
|
|
16816
16832
|
}
|
|
16817
16833
|
return key.content !== "class" && key.content !== "style" && !isOn(key.content);
|
|
@@ -16839,7 +16855,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16839
16855
|
mergeArgs.push(exp);
|
|
16840
16856
|
} else {
|
|
16841
16857
|
pushMergeArg({
|
|
16842
|
-
type:
|
|
16858
|
+
type: 14,
|
|
16843
16859
|
loc,
|
|
16844
16860
|
callee: context.helper(TO_HANDLERS),
|
|
16845
16861
|
arguments: isComponent ? [exp] : [exp, `true`]
|
|
@@ -16848,7 +16864,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16848
16864
|
} else {
|
|
16849
16865
|
context.onError(
|
|
16850
16866
|
createCompilerError(
|
|
16851
|
-
isVBind ?
|
|
16867
|
+
isVBind ? 34 : 35,
|
|
16852
16868
|
loc
|
|
16853
16869
|
)
|
|
16854
16870
|
);
|
|
@@ -16917,7 +16933,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16917
16933
|
}
|
|
16918
16934
|
if (!context.inSSR && propsExpression) {
|
|
16919
16935
|
switch (propsExpression.type) {
|
|
16920
|
-
case
|
|
16936
|
+
case 15:
|
|
16921
16937
|
let classKeyIndex = -1;
|
|
16922
16938
|
let styleKeyIndex = -1;
|
|
16923
16939
|
let hasDynamicKey = false;
|
|
@@ -16944,9 +16960,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16944
16960
|
}
|
|
16945
16961
|
if (styleProp && // the static style is compiled into an object,
|
|
16946
16962
|
// so use `hasStyleBinding` to ensure that it is a dynamic style binding
|
|
16947
|
-
(hasStyleBinding || styleProp.value.type ===
|
|
16963
|
+
(hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
|
|
16948
16964
|
// v-bind:style with static literal object
|
|
16949
|
-
styleProp.value.type ===
|
|
16965
|
+
styleProp.value.type === 17)) {
|
|
16950
16966
|
styleProp.value = createCallExpression(
|
|
16951
16967
|
context.helper(NORMALIZE_STYLE),
|
|
16952
16968
|
[styleProp.value]
|
|
@@ -16959,7 +16975,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16959
16975
|
);
|
|
16960
16976
|
}
|
|
16961
16977
|
break;
|
|
16962
|
-
case
|
|
16978
|
+
case 14:
|
|
16963
16979
|
break;
|
|
16964
16980
|
default:
|
|
16965
16981
|
propsExpression = createCallExpression(
|
|
@@ -16986,7 +17002,7 @@ function dedupeProperties(properties) {
|
|
|
16986
17002
|
const deduped = [];
|
|
16987
17003
|
for (let i = 0; i < properties.length; i++) {
|
|
16988
17004
|
const prop = properties[i];
|
|
16989
|
-
if (prop.key.type ===
|
|
17005
|
+
if (prop.key.type === 8 || !prop.key.isStatic) {
|
|
16990
17006
|
deduped.push(prop);
|
|
16991
17007
|
continue;
|
|
16992
17008
|
}
|
|
@@ -17004,7 +17020,7 @@ function dedupeProperties(properties) {
|
|
|
17004
17020
|
return deduped;
|
|
17005
17021
|
}
|
|
17006
17022
|
function mergeAsArray(existing, incoming) {
|
|
17007
|
-
if (existing.value.type ===
|
|
17023
|
+
if (existing.value.type === 17) {
|
|
17008
17024
|
existing.value.elements.push(incoming.value);
|
|
17009
17025
|
} else {
|
|
17010
17026
|
existing.value = createArrayExpression(
|
|
@@ -17106,7 +17122,7 @@ function processSlotOutlet(node, context) {
|
|
|
17106
17122
|
const nonNameProps = [];
|
|
17107
17123
|
for (let i = 0; i < node.props.length; i++) {
|
|
17108
17124
|
const p = node.props[i];
|
|
17109
|
-
if (p.type ===
|
|
17125
|
+
if (p.type === 6) {
|
|
17110
17126
|
if (p.value) {
|
|
17111
17127
|
if (p.name === "name") {
|
|
17112
17128
|
slotName = JSON.stringify(p.value.content);
|
|
@@ -17139,7 +17155,7 @@ function processSlotOutlet(node, context) {
|
|
|
17139
17155
|
if (directives.length) {
|
|
17140
17156
|
context.onError(
|
|
17141
17157
|
createCompilerError(
|
|
17142
|
-
|
|
17158
|
+
36,
|
|
17143
17159
|
directives[0].loc
|
|
17144
17160
|
)
|
|
17145
17161
|
);
|
|
@@ -17155,16 +17171,16 @@ const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+
|
|
|
17155
17171
|
const transformOn$1 = (dir, node, context, augmentor) => {
|
|
17156
17172
|
const { loc, modifiers, arg } = dir;
|
|
17157
17173
|
if (!dir.exp && !modifiers.length) {
|
|
17158
|
-
context.onError(createCompilerError(
|
|
17174
|
+
context.onError(createCompilerError(35, loc));
|
|
17159
17175
|
}
|
|
17160
17176
|
let eventName;
|
|
17161
|
-
if (arg.type ===
|
|
17177
|
+
if (arg.type === 4) {
|
|
17162
17178
|
if (arg.isStatic) {
|
|
17163
17179
|
let rawName = arg.content;
|
|
17164
17180
|
if (rawName.startsWith("vue:")) {
|
|
17165
17181
|
rawName = `vnode-${rawName.slice(4)}`;
|
|
17166
17182
|
}
|
|
17167
|
-
const eventString = node.tagType !==
|
|
17183
|
+
const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
|
|
17168
17184
|
// for non-element and vnode lifecycle event listeners, auto convert
|
|
17169
17185
|
// it to camelCase. See issue #2249
|
|
17170
17186
|
toHandlerKey(camelize(rawName))
|
|
@@ -17207,16 +17223,16 @@ const transformOn$1 = (dir, node, context, augmentor) => {
|
|
|
17207
17223
|
shouldCache = context.cacheHandlers && // unnecessary to cache inside v-once
|
|
17208
17224
|
!context.inVOnce && // runtime constants don't need to be cached
|
|
17209
17225
|
// (this is analyzed by compileScript in SFC <script setup>)
|
|
17210
|
-
!(exp.type ===
|
|
17226
|
+
!(exp.type === 4 && exp.constType > 0) && // #1541 bail if this is a member exp handler passed to a component -
|
|
17211
17227
|
// we need to use the original function to preserve arity,
|
|
17212
17228
|
// e.g. <transition> relies on checking cb.length to determine
|
|
17213
17229
|
// transition end handling. Inline function is ok since its arity
|
|
17214
17230
|
// is preserved even when cached.
|
|
17215
|
-
!(isMemberExp && node.tagType ===
|
|
17231
|
+
!(isMemberExp && node.tagType === 1) && // bail if the function references closure variables (v-for, v-slot)
|
|
17216
17232
|
// it must be passed fresh to avoid stale values.
|
|
17217
17233
|
!hasScopeRef(exp, context.identifiers);
|
|
17218
17234
|
if (shouldCache && isMemberExp) {
|
|
17219
|
-
if (exp.type ===
|
|
17235
|
+
if (exp.type === 4) {
|
|
17220
17236
|
exp.content = `${exp.content} && ${exp.content}(...args)`;
|
|
17221
17237
|
} else {
|
|
17222
17238
|
exp.children = [...exp.children, ` && `, ...exp.children, `(...args)`];
|
|
@@ -17254,14 +17270,14 @@ const transformOn$1 = (dir, node, context, augmentor) => {
|
|
|
17254
17270
|
const transformBind = (dir, _node, context) => {
|
|
17255
17271
|
const { exp, modifiers, loc } = dir;
|
|
17256
17272
|
const arg = dir.arg;
|
|
17257
|
-
if (arg.type !==
|
|
17273
|
+
if (arg.type !== 4) {
|
|
17258
17274
|
arg.children.unshift(`(`);
|
|
17259
17275
|
arg.children.push(`) || ""`);
|
|
17260
17276
|
} else if (!arg.isStatic) {
|
|
17261
17277
|
arg.content = `${arg.content} || ""`;
|
|
17262
17278
|
}
|
|
17263
17279
|
if (modifiers.includes("camel")) {
|
|
17264
|
-
if (arg.type ===
|
|
17280
|
+
if (arg.type === 4) {
|
|
17265
17281
|
if (arg.isStatic) {
|
|
17266
17282
|
arg.content = camelize(arg.content);
|
|
17267
17283
|
} else {
|
|
@@ -17280,8 +17296,8 @@ const transformBind = (dir, _node, context) => {
|
|
|
17280
17296
|
injectPrefix(arg, "^");
|
|
17281
17297
|
}
|
|
17282
17298
|
}
|
|
17283
|
-
if (!exp || exp.type ===
|
|
17284
|
-
context.onError(createCompilerError(
|
|
17299
|
+
if (!exp || exp.type === 4 && !exp.content.trim()) {
|
|
17300
|
+
context.onError(createCompilerError(34, loc));
|
|
17285
17301
|
return {
|
|
17286
17302
|
props: [createObjectProperty(arg, createSimpleExpression("", true, loc))]
|
|
17287
17303
|
};
|
|
@@ -17291,7 +17307,7 @@ const transformBind = (dir, _node, context) => {
|
|
|
17291
17307
|
};
|
|
17292
17308
|
};
|
|
17293
17309
|
const injectPrefix = (arg, prefix) => {
|
|
17294
|
-
if (arg.type ===
|
|
17310
|
+
if (arg.type === 4) {
|
|
17295
17311
|
if (arg.isStatic) {
|
|
17296
17312
|
arg.content = prefix + arg.content;
|
|
17297
17313
|
} else {
|
|
@@ -17304,7 +17320,7 @@ const injectPrefix = (arg, prefix) => {
|
|
|
17304
17320
|
};
|
|
17305
17321
|
|
|
17306
17322
|
const transformText = (node, context) => {
|
|
17307
|
-
if (node.type ===
|
|
17323
|
+
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
17308
17324
|
return () => {
|
|
17309
17325
|
const children = node.children;
|
|
17310
17326
|
let currentContainer = void 0;
|
|
@@ -17336,13 +17352,13 @@ const transformText = (node, context) => {
|
|
|
17336
17352
|
// as-is since the runtime has dedicated fast path for this by directly
|
|
17337
17353
|
// setting textContent of the element.
|
|
17338
17354
|
// for component root it's always normalized anyway.
|
|
17339
|
-
children.length === 1 && (node.type ===
|
|
17355
|
+
children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
|
|
17340
17356
|
// custom directives can potentially add DOM elements arbitrarily,
|
|
17341
17357
|
// we need to avoid setting textContent of the element at runtime
|
|
17342
17358
|
// to avoid accidentally overwriting the DOM elements added
|
|
17343
17359
|
// by the user through custom directives.
|
|
17344
17360
|
!node.props.find(
|
|
17345
|
-
(p) => p.type ===
|
|
17361
|
+
(p) => p.type === 7 && !context.directiveTransforms[p.name]
|
|
17346
17362
|
) && // in compat mode, <template> tags with no special directives
|
|
17347
17363
|
// will be rendered as a fragment so its children must be
|
|
17348
17364
|
// converted into vnodes.
|
|
@@ -17351,9 +17367,9 @@ const transformText = (node, context) => {
|
|
|
17351
17367
|
}
|
|
17352
17368
|
for (let i = 0; i < children.length; i++) {
|
|
17353
17369
|
const child = children[i];
|
|
17354
|
-
if (isText$1(child) || child.type ===
|
|
17370
|
+
if (isText$1(child) || child.type === 8) {
|
|
17355
17371
|
const callArgs = [];
|
|
17356
|
-
if (child.type !==
|
|
17372
|
+
if (child.type !== 2 || child.content !== " ") {
|
|
17357
17373
|
callArgs.push(child);
|
|
17358
17374
|
}
|
|
17359
17375
|
if (!context.ssr && getConstantType(child, context) === 0) {
|
|
@@ -17362,7 +17378,7 @@ const transformText = (node, context) => {
|
|
|
17362
17378
|
);
|
|
17363
17379
|
}
|
|
17364
17380
|
children[i] = {
|
|
17365
|
-
type:
|
|
17381
|
+
type: 12,
|
|
17366
17382
|
content: child,
|
|
17367
17383
|
loc: child.loc,
|
|
17368
17384
|
codegenNode: createCallExpression(
|
|
@@ -17378,7 +17394,7 @@ const transformText = (node, context) => {
|
|
|
17378
17394
|
|
|
17379
17395
|
const seen$1 = /* @__PURE__ */ new WeakSet();
|
|
17380
17396
|
const transformOnce = (node, context) => {
|
|
17381
|
-
if (node.type ===
|
|
17397
|
+
if (node.type === 1 && findDir(node, "once", true)) {
|
|
17382
17398
|
if (seen$1.has(node) || context.inVOnce) {
|
|
17383
17399
|
return;
|
|
17384
17400
|
}
|
|
@@ -17403,27 +17419,27 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
17403
17419
|
const { exp, arg } = dir;
|
|
17404
17420
|
if (!exp) {
|
|
17405
17421
|
context.onError(
|
|
17406
|
-
createCompilerError(
|
|
17422
|
+
createCompilerError(41, dir.loc)
|
|
17407
17423
|
);
|
|
17408
17424
|
return createTransformProps();
|
|
17409
17425
|
}
|
|
17410
17426
|
const rawExp = exp.loc.source;
|
|
17411
|
-
const expString = exp.type ===
|
|
17427
|
+
const expString = exp.type === 4 ? exp.content : rawExp;
|
|
17412
17428
|
const bindingType = context.bindingMetadata[rawExp];
|
|
17413
17429
|
if (bindingType === "props" || bindingType === "props-aliased") {
|
|
17414
|
-
context.onError(createCompilerError(
|
|
17430
|
+
context.onError(createCompilerError(44, exp.loc));
|
|
17415
17431
|
return createTransformProps();
|
|
17416
17432
|
}
|
|
17417
17433
|
const maybeRef = context.inline && (bindingType === "setup-let" || bindingType === "setup-ref" || bindingType === "setup-maybe-ref");
|
|
17418
17434
|
if (!expString.trim() || !isMemberExpression(expString, context) && !maybeRef) {
|
|
17419
17435
|
context.onError(
|
|
17420
|
-
createCompilerError(
|
|
17436
|
+
createCompilerError(42, exp.loc)
|
|
17421
17437
|
);
|
|
17422
17438
|
return createTransformProps();
|
|
17423
17439
|
}
|
|
17424
17440
|
if (context.prefixIdentifiers && isSimpleIdentifier(expString) && context.identifiers[expString]) {
|
|
17425
17441
|
context.onError(
|
|
17426
|
-
createCompilerError(
|
|
17442
|
+
createCompilerError(43, exp.loc)
|
|
17427
17443
|
);
|
|
17428
17444
|
return createTransformProps();
|
|
17429
17445
|
}
|
|
@@ -17462,7 +17478,7 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
17462
17478
|
if (context.prefixIdentifiers && !context.inVOnce && context.cacheHandlers && !hasScopeRef(exp, context.identifiers)) {
|
|
17463
17479
|
props[1].value = context.cache(props[1].value);
|
|
17464
17480
|
}
|
|
17465
|
-
if (dir.modifiers.length && node.tagType ===
|
|
17481
|
+
if (dir.modifiers.length && node.tagType === 1) {
|
|
17466
17482
|
const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
|
|
17467
17483
|
const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
|
|
17468
17484
|
props.push(
|
|
@@ -17472,7 +17488,7 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
17472
17488
|
`{ ${modifiers} }`,
|
|
17473
17489
|
false,
|
|
17474
17490
|
dir.loc,
|
|
17475
|
-
|
|
17491
|
+
2
|
|
17476
17492
|
)
|
|
17477
17493
|
)
|
|
17478
17494
|
);
|
|
@@ -17488,30 +17504,30 @@ const transformFilter = (node, context) => {
|
|
|
17488
17504
|
if (!isCompatEnabled("COMPILER_FILTER", context)) {
|
|
17489
17505
|
return;
|
|
17490
17506
|
}
|
|
17491
|
-
if (node.type ===
|
|
17507
|
+
if (node.type === 5) {
|
|
17492
17508
|
rewriteFilter(node.content, context);
|
|
17493
17509
|
}
|
|
17494
|
-
if (node.type ===
|
|
17510
|
+
if (node.type === 1) {
|
|
17495
17511
|
node.props.forEach((prop) => {
|
|
17496
|
-
if (prop.type ===
|
|
17512
|
+
if (prop.type === 7 && prop.name !== "for" && prop.exp) {
|
|
17497
17513
|
rewriteFilter(prop.exp, context);
|
|
17498
17514
|
}
|
|
17499
17515
|
});
|
|
17500
17516
|
}
|
|
17501
17517
|
};
|
|
17502
17518
|
function rewriteFilter(node, context) {
|
|
17503
|
-
if (node.type ===
|
|
17519
|
+
if (node.type === 4) {
|
|
17504
17520
|
parseFilter(node, context);
|
|
17505
17521
|
} else {
|
|
17506
17522
|
for (let i = 0; i < node.children.length; i++) {
|
|
17507
17523
|
const child = node.children[i];
|
|
17508
17524
|
if (typeof child !== "object")
|
|
17509
17525
|
continue;
|
|
17510
|
-
if (child.type ===
|
|
17526
|
+
if (child.type === 4) {
|
|
17511
17527
|
parseFilter(child, context);
|
|
17512
|
-
} else if (child.type ===
|
|
17528
|
+
} else if (child.type === 8) {
|
|
17513
17529
|
rewriteFilter(node, context);
|
|
17514
|
-
} else if (child.type ===
|
|
17530
|
+
} else if (child.type === 5) {
|
|
17515
17531
|
rewriteFilter(child.content, context);
|
|
17516
17532
|
}
|
|
17517
17533
|
}
|
|
@@ -17632,7 +17648,7 @@ function wrapFilter(exp, filter, context) {
|
|
|
17632
17648
|
|
|
17633
17649
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
17634
17650
|
const transformMemo = (node, context) => {
|
|
17635
|
-
if (node.type ===
|
|
17651
|
+
if (node.type === 1) {
|
|
17636
17652
|
const dir = findDir(node, "memo");
|
|
17637
17653
|
if (!dir || seen.has(node)) {
|
|
17638
17654
|
return;
|
|
@@ -17640,9 +17656,9 @@ const transformMemo = (node, context) => {
|
|
|
17640
17656
|
seen.add(node);
|
|
17641
17657
|
return () => {
|
|
17642
17658
|
const codegenNode = node.codegenNode || context.currentNode.codegenNode;
|
|
17643
|
-
if (codegenNode && codegenNode.type ===
|
|
17644
|
-
if (node.tagType !==
|
|
17645
|
-
|
|
17659
|
+
if (codegenNode && codegenNode.type === 13) {
|
|
17660
|
+
if (node.tagType !== 1) {
|
|
17661
|
+
convertToBlock(codegenNode, context);
|
|
17646
17662
|
}
|
|
17647
17663
|
node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
|
|
17648
17664
|
dir.exp,
|
|
@@ -17685,10 +17701,10 @@ function baseCompile(template, options = {}) {
|
|
|
17685
17701
|
const isModuleMode = options.mode === "module";
|
|
17686
17702
|
const prefixIdentifiers = options.prefixIdentifiers === true || isModuleMode;
|
|
17687
17703
|
if (!prefixIdentifiers && options.cacheHandlers) {
|
|
17688
|
-
onError(createCompilerError(
|
|
17704
|
+
onError(createCompilerError(49));
|
|
17689
17705
|
}
|
|
17690
17706
|
if (options.scopeId && !isModuleMode) {
|
|
17691
|
-
onError(createCompilerError(
|
|
17707
|
+
onError(createCompilerError(50));
|
|
17692
17708
|
}
|
|
17693
17709
|
const ast = isString(template) ? baseParse(template, options) : template;
|
|
17694
17710
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
|
|
@@ -20106,30 +20122,30 @@ const parserOptions = {
|
|
|
20106
20122
|
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
|
20107
20123
|
getNamespace(tag, parent) {
|
|
20108
20124
|
let ns = parent ? parent.ns : 0;
|
|
20109
|
-
if (parent && ns ===
|
|
20125
|
+
if (parent && ns === 2) {
|
|
20110
20126
|
if (parent.tag === "annotation-xml") {
|
|
20111
20127
|
if (tag === "svg") {
|
|
20112
|
-
return
|
|
20128
|
+
return 1;
|
|
20113
20129
|
}
|
|
20114
20130
|
if (parent.props.some(
|
|
20115
|
-
(a) => a.type ===
|
|
20131
|
+
(a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
|
|
20116
20132
|
)) {
|
|
20117
20133
|
ns = 0;
|
|
20118
20134
|
}
|
|
20119
20135
|
} else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
|
|
20120
20136
|
ns = 0;
|
|
20121
20137
|
}
|
|
20122
|
-
} else if (parent && ns ===
|
|
20138
|
+
} else if (parent && ns === 1) {
|
|
20123
20139
|
if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
|
|
20124
20140
|
ns = 0;
|
|
20125
20141
|
}
|
|
20126
20142
|
}
|
|
20127
20143
|
if (ns === 0) {
|
|
20128
20144
|
if (tag === "svg") {
|
|
20129
|
-
return
|
|
20145
|
+
return 1;
|
|
20130
20146
|
}
|
|
20131
20147
|
if (tag === "math") {
|
|
20132
|
-
return
|
|
20148
|
+
return 2;
|
|
20133
20149
|
}
|
|
20134
20150
|
}
|
|
20135
20151
|
return ns;
|
|
@@ -20138,22 +20154,22 @@ const parserOptions = {
|
|
|
20138
20154
|
getTextMode({ tag, ns }) {
|
|
20139
20155
|
if (ns === 0) {
|
|
20140
20156
|
if (tag === "textarea" || tag === "title") {
|
|
20141
|
-
return
|
|
20157
|
+
return 1;
|
|
20142
20158
|
}
|
|
20143
20159
|
if (isRawTextContainer(tag)) {
|
|
20144
|
-
return
|
|
20160
|
+
return 2;
|
|
20145
20161
|
}
|
|
20146
20162
|
}
|
|
20147
|
-
return
|
|
20163
|
+
return 0;
|
|
20148
20164
|
}
|
|
20149
20165
|
};
|
|
20150
20166
|
|
|
20151
20167
|
const transformStyle = (node) => {
|
|
20152
|
-
if (node.type ===
|
|
20168
|
+
if (node.type === 1) {
|
|
20153
20169
|
node.props.forEach((p, i) => {
|
|
20154
|
-
if (p.type ===
|
|
20170
|
+
if (p.type === 6 && p.name === "style" && p.value) {
|
|
20155
20171
|
node.props[i] = {
|
|
20156
|
-
type:
|
|
20172
|
+
type: 7,
|
|
20157
20173
|
name: `bind`,
|
|
20158
20174
|
arg: createSimpleExpression(`style`, true, p.loc),
|
|
20159
20175
|
exp: parseInlineCSS(p.value.content, p.loc),
|
|
@@ -20170,7 +20186,7 @@ const parseInlineCSS = (cssText, loc) => {
|
|
|
20170
20186
|
JSON.stringify(normalized),
|
|
20171
20187
|
false,
|
|
20172
20188
|
loc,
|
|
20173
|
-
|
|
20189
|
+
3
|
|
20174
20190
|
);
|
|
20175
20191
|
};
|
|
20176
20192
|
|
|
@@ -20183,16 +20199,16 @@ function createDOMCompilerError(code, loc) {
|
|
|
20183
20199
|
}
|
|
20184
20200
|
const DOMErrorMessages = {
|
|
20185
20201
|
[51]: `v-html is missing expression.`,
|
|
20186
|
-
[
|
|
20187
|
-
[
|
|
20188
|
-
[
|
|
20189
|
-
[
|
|
20190
|
-
[
|
|
20191
|
-
[
|
|
20192
|
-
[
|
|
20193
|
-
[
|
|
20194
|
-
[
|
|
20195
|
-
[
|
|
20202
|
+
[52]: `v-html will override element children.`,
|
|
20203
|
+
[53]: `v-text is missing expression.`,
|
|
20204
|
+
[54]: `v-text will override element children.`,
|
|
20205
|
+
[55]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
|
20206
|
+
[56]: `v-model argument is not supported on plain elements.`,
|
|
20207
|
+
[57]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
|
20208
|
+
[58]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
|
20209
|
+
[59]: `v-show is missing expression.`,
|
|
20210
|
+
[60]: `<Transition> expects exactly one child element or component.`,
|
|
20211
|
+
[61]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
|
20196
20212
|
};
|
|
20197
20213
|
|
|
20198
20214
|
const transformVHtml = (dir, node, context) => {
|
|
@@ -20204,7 +20220,7 @@ const transformVHtml = (dir, node, context) => {
|
|
|
20204
20220
|
}
|
|
20205
20221
|
if (node.children.length) {
|
|
20206
20222
|
context.onError(
|
|
20207
|
-
createDOMCompilerError(
|
|
20223
|
+
createDOMCompilerError(52, loc)
|
|
20208
20224
|
);
|
|
20209
20225
|
node.children.length = 0;
|
|
20210
20226
|
}
|
|
@@ -20222,12 +20238,12 @@ const transformVText = (dir, node, context) => {
|
|
|
20222
20238
|
const { exp, loc } = dir;
|
|
20223
20239
|
if (!exp) {
|
|
20224
20240
|
context.onError(
|
|
20225
|
-
createDOMCompilerError(
|
|
20241
|
+
createDOMCompilerError(53, loc)
|
|
20226
20242
|
);
|
|
20227
20243
|
}
|
|
20228
20244
|
if (node.children.length) {
|
|
20229
20245
|
context.onError(
|
|
20230
|
-
createDOMCompilerError(
|
|
20246
|
+
createDOMCompilerError(54, loc)
|
|
20231
20247
|
);
|
|
20232
20248
|
node.children.length = 0;
|
|
20233
20249
|
}
|
|
@@ -20247,13 +20263,13 @@ const transformVText = (dir, node, context) => {
|
|
|
20247
20263
|
|
|
20248
20264
|
const transformModel = (dir, node, context) => {
|
|
20249
20265
|
const baseResult = transformModel$1(dir, node, context);
|
|
20250
|
-
if (!baseResult.props.length || node.tagType ===
|
|
20266
|
+
if (!baseResult.props.length || node.tagType === 1) {
|
|
20251
20267
|
return baseResult;
|
|
20252
20268
|
}
|
|
20253
20269
|
if (dir.arg) {
|
|
20254
20270
|
context.onError(
|
|
20255
20271
|
createDOMCompilerError(
|
|
20256
|
-
|
|
20272
|
+
56,
|
|
20257
20273
|
dir.arg.loc
|
|
20258
20274
|
)
|
|
20259
20275
|
);
|
|
@@ -20263,7 +20279,7 @@ const transformModel = (dir, node, context) => {
|
|
|
20263
20279
|
if (value) {
|
|
20264
20280
|
context.onError(
|
|
20265
20281
|
createDOMCompilerError(
|
|
20266
|
-
|
|
20282
|
+
58,
|
|
20267
20283
|
value.loc
|
|
20268
20284
|
)
|
|
20269
20285
|
);
|
|
@@ -20277,7 +20293,7 @@ const transformModel = (dir, node, context) => {
|
|
|
20277
20293
|
if (tag === "input" || isCustomElement) {
|
|
20278
20294
|
const type = findProp(node, `type`);
|
|
20279
20295
|
if (type) {
|
|
20280
|
-
if (type.type ===
|
|
20296
|
+
if (type.type === 7) {
|
|
20281
20297
|
directiveToUse = V_MODEL_DYNAMIC;
|
|
20282
20298
|
} else if (type.value) {
|
|
20283
20299
|
switch (type.value.content) {
|
|
@@ -20291,7 +20307,7 @@ const transformModel = (dir, node, context) => {
|
|
|
20291
20307
|
isInvalidType = true;
|
|
20292
20308
|
context.onError(
|
|
20293
20309
|
createDOMCompilerError(
|
|
20294
|
-
|
|
20310
|
+
57,
|
|
20295
20311
|
dir.loc
|
|
20296
20312
|
)
|
|
20297
20313
|
);
|
|
@@ -20317,13 +20333,13 @@ const transformModel = (dir, node, context) => {
|
|
|
20317
20333
|
} else {
|
|
20318
20334
|
context.onError(
|
|
20319
20335
|
createDOMCompilerError(
|
|
20320
|
-
|
|
20336
|
+
55,
|
|
20321
20337
|
dir.loc
|
|
20322
20338
|
)
|
|
20323
20339
|
);
|
|
20324
20340
|
}
|
|
20325
20341
|
baseResult.props = baseResult.props.filter(
|
|
20326
|
-
(p) => !(p.key.type ===
|
|
20342
|
+
(p) => !(p.key.type === 4 && p.key.content === "modelValue")
|
|
20327
20343
|
);
|
|
20328
20344
|
return baseResult;
|
|
20329
20345
|
};
|
|
@@ -20381,7 +20397,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
|
|
|
20381
20397
|
};
|
|
20382
20398
|
const transformClick = (key, event) => {
|
|
20383
20399
|
const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
|
|
20384
|
-
return isStaticClick ? createSimpleExpression(event, true) : key.type !==
|
|
20400
|
+
return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
|
|
20385
20401
|
`(`,
|
|
20386
20402
|
key,
|
|
20387
20403
|
`) === "onClick" ? "${event}" : (`,
|
|
@@ -20429,7 +20445,7 @@ const transformShow = (dir, node, context) => {
|
|
|
20429
20445
|
const { exp, loc } = dir;
|
|
20430
20446
|
if (!exp) {
|
|
20431
20447
|
context.onError(
|
|
20432
|
-
createDOMCompilerError(
|
|
20448
|
+
createDOMCompilerError(59, loc)
|
|
20433
20449
|
);
|
|
20434
20450
|
}
|
|
20435
20451
|
return {
|
|
@@ -20439,7 +20455,7 @@ const transformShow = (dir, node, context) => {
|
|
|
20439
20455
|
};
|
|
20440
20456
|
|
|
20441
20457
|
const transformTransition = (node, context) => {
|
|
20442
|
-
if (node.type ===
|
|
20458
|
+
if (node.type === 1 && node.tagType === 1) {
|
|
20443
20459
|
const component = context.isBuiltInComponent(node.tag);
|
|
20444
20460
|
if (component === TRANSITION) {
|
|
20445
20461
|
return () => {
|
|
@@ -20449,7 +20465,7 @@ const transformTransition = (node, context) => {
|
|
|
20449
20465
|
if (hasMultipleChildren(node)) {
|
|
20450
20466
|
context.onError(
|
|
20451
20467
|
createDOMCompilerError(
|
|
20452
|
-
|
|
20468
|
+
60,
|
|
20453
20469
|
{
|
|
20454
20470
|
start: node.children[0].loc.start,
|
|
20455
20471
|
end: node.children[node.children.length - 1].loc.end,
|
|
@@ -20459,11 +20475,11 @@ const transformTransition = (node, context) => {
|
|
|
20459
20475
|
);
|
|
20460
20476
|
}
|
|
20461
20477
|
const child = node.children[0];
|
|
20462
|
-
if (child.type ===
|
|
20478
|
+
if (child.type === 1) {
|
|
20463
20479
|
for (const p of child.props) {
|
|
20464
|
-
if (p.type ===
|
|
20480
|
+
if (p.type === 7 && p.name === "show") {
|
|
20465
20481
|
node.props.push({
|
|
20466
|
-
type:
|
|
20482
|
+
type: 6,
|
|
20467
20483
|
name: "persisted",
|
|
20468
20484
|
value: void 0,
|
|
20469
20485
|
loc: node.loc
|
|
@@ -20477,10 +20493,10 @@ const transformTransition = (node, context) => {
|
|
|
20477
20493
|
};
|
|
20478
20494
|
function hasMultipleChildren(node) {
|
|
20479
20495
|
const children = node.children = node.children.filter(
|
|
20480
|
-
(c) => c.type !==
|
|
20496
|
+
(c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
|
|
20481
20497
|
);
|
|
20482
20498
|
const child = children[0];
|
|
20483
|
-
return children.length !== 1 || child.type ===
|
|
20499
|
+
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
|
|
20484
20500
|
}
|
|
20485
20501
|
|
|
20486
20502
|
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
|
|
@@ -20534,10 +20550,10 @@ const stringifyStatic = (children, context, parent) => {
|
|
|
20534
20550
|
}
|
|
20535
20551
|
stringifyCurrentChunk(i);
|
|
20536
20552
|
};
|
|
20537
|
-
const getHoistedNode = (node) => (node.type ===
|
|
20553
|
+
const getHoistedNode = (node) => (node.type === 1 && node.tagType === 0 || node.type == 12) && node.codegenNode && node.codegenNode.type === 4 && node.codegenNode.hoisted;
|
|
20538
20554
|
const dataAriaRE = /^(data|aria)-/;
|
|
20539
20555
|
const isStringifiableAttr = (name, ns) => {
|
|
20540
|
-
return (ns === 0 ? isKnownHtmlAttr(name) : ns ===
|
|
20556
|
+
return (ns === 0 ? isKnownHtmlAttr(name) : ns === 1 ? isKnownSvgAttr(name) : false) || dataAriaRE.test(name);
|
|
20541
20557
|
};
|
|
20542
20558
|
const replaceHoist = (node, replacement, context) => {
|
|
20543
20559
|
const hoistToReplace = node.codegenNode.hoisted;
|
|
@@ -20547,10 +20563,10 @@ const isNonStringifiable = /* @__PURE__ */ makeMap(
|
|
|
20547
20563
|
`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
|
|
20548
20564
|
);
|
|
20549
20565
|
function analyzeNode(node) {
|
|
20550
|
-
if (node.type ===
|
|
20566
|
+
if (node.type === 1 && isNonStringifiable(node.tag)) {
|
|
20551
20567
|
return false;
|
|
20552
20568
|
}
|
|
20553
|
-
if (node.type ===
|
|
20569
|
+
if (node.type === 12) {
|
|
20554
20570
|
return [1, 0];
|
|
20555
20571
|
}
|
|
20556
20572
|
let nc = 1;
|
|
@@ -20563,14 +20579,14 @@ function analyzeNode(node) {
|
|
|
20563
20579
|
function walk(node2) {
|
|
20564
20580
|
for (let i = 0; i < node2.props.length; i++) {
|
|
20565
20581
|
const p = node2.props[i];
|
|
20566
|
-
if (p.type ===
|
|
20582
|
+
if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
|
|
20567
20583
|
return bail();
|
|
20568
20584
|
}
|
|
20569
|
-
if (p.type ===
|
|
20570
|
-
if (p.arg && (p.arg.type ===
|
|
20585
|
+
if (p.type === 7 && p.name === "bind") {
|
|
20586
|
+
if (p.arg && (p.arg.type === 8 || p.arg.isStatic && !isStringifiableAttr(p.arg.content, node2.ns))) {
|
|
20571
20587
|
return bail();
|
|
20572
20588
|
}
|
|
20573
|
-
if (p.exp && (p.exp.type ===
|
|
20589
|
+
if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
|
|
20574
20590
|
return bail();
|
|
20575
20591
|
}
|
|
20576
20592
|
}
|
|
@@ -20578,7 +20594,7 @@ function analyzeNode(node) {
|
|
|
20578
20594
|
for (let i = 0; i < node2.children.length; i++) {
|
|
20579
20595
|
nc++;
|
|
20580
20596
|
const child = node2.children[i];
|
|
20581
|
-
if (child.type ===
|
|
20597
|
+
if (child.type === 1) {
|
|
20582
20598
|
if (child.props.length > 0) {
|
|
20583
20599
|
ec++;
|
|
20584
20600
|
}
|
|
@@ -20600,17 +20616,17 @@ function stringifyNode(node, context) {
|
|
|
20600
20616
|
return ``;
|
|
20601
20617
|
}
|
|
20602
20618
|
switch (node.type) {
|
|
20603
|
-
case
|
|
20619
|
+
case 1:
|
|
20604
20620
|
return stringifyElement(node, context);
|
|
20605
|
-
case
|
|
20621
|
+
case 2:
|
|
20606
20622
|
return escapeHtml(node.content);
|
|
20607
|
-
case
|
|
20623
|
+
case 3:
|
|
20608
20624
|
return `<!--${escapeHtml(node.content)}-->`;
|
|
20609
|
-
case
|
|
20625
|
+
case 5:
|
|
20610
20626
|
return escapeHtml(toDisplayString(evaluateConstant(node.content)));
|
|
20611
|
-
case
|
|
20627
|
+
case 8:
|
|
20612
20628
|
return escapeHtml(evaluateConstant(node));
|
|
20613
|
-
case
|
|
20629
|
+
case 12:
|
|
20614
20630
|
return stringifyNode(node.content, context);
|
|
20615
20631
|
default:
|
|
20616
20632
|
return "";
|
|
@@ -20621,12 +20637,12 @@ function stringifyElement(node, context) {
|
|
|
20621
20637
|
let innerHTML = "";
|
|
20622
20638
|
for (let i = 0; i < node.props.length; i++) {
|
|
20623
20639
|
const p = node.props[i];
|
|
20624
|
-
if (p.type ===
|
|
20640
|
+
if (p.type === 6) {
|
|
20625
20641
|
res += ` ${p.name}`;
|
|
20626
20642
|
if (p.value) {
|
|
20627
20643
|
res += `="${escapeHtml(p.value.content)}"`;
|
|
20628
20644
|
}
|
|
20629
|
-
} else if (p.type ===
|
|
20645
|
+
} else if (p.type === 7) {
|
|
20630
20646
|
if (p.name === "bind") {
|
|
20631
20647
|
const exp = p.exp;
|
|
20632
20648
|
if (exp.content[0] === "_") {
|
|
@@ -20674,7 +20690,7 @@ function stringifyElement(node, context) {
|
|
|
20674
20690
|
return res;
|
|
20675
20691
|
}
|
|
20676
20692
|
function evaluateConstant(exp) {
|
|
20677
|
-
if (exp.type ===
|
|
20693
|
+
if (exp.type === 4) {
|
|
20678
20694
|
return new Function(`return ${exp.content}`)();
|
|
20679
20695
|
} else {
|
|
20680
20696
|
let res = ``;
|
|
@@ -20682,9 +20698,9 @@ function evaluateConstant(exp) {
|
|
|
20682
20698
|
if (isString(c) || isSymbol(c)) {
|
|
20683
20699
|
return;
|
|
20684
20700
|
}
|
|
20685
|
-
if (c.type ===
|
|
20701
|
+
if (c.type === 2) {
|
|
20686
20702
|
res += c.content;
|
|
20687
|
-
} else if (c.type ===
|
|
20703
|
+
} else if (c.type === 5) {
|
|
20688
20704
|
res += toDisplayString(evaluateConstant(c.content));
|
|
20689
20705
|
} else {
|
|
20690
20706
|
res += evaluateConstant(c);
|
|
@@ -20695,9 +20711,9 @@ function evaluateConstant(exp) {
|
|
|
20695
20711
|
}
|
|
20696
20712
|
|
|
20697
20713
|
const ignoreSideEffectTags = (node, context) => {
|
|
20698
|
-
if (node.type ===
|
|
20714
|
+
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
|
|
20699
20715
|
context.onError(
|
|
20700
|
-
createDOMCompilerError(
|
|
20716
|
+
createDOMCompilerError(61, node.loc)
|
|
20701
20717
|
);
|
|
20702
20718
|
context.removeNode();
|
|
20703
20719
|
}
|