@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.esm-browser.js
CHANGED
|
@@ -7,6 +7,96 @@ function makeMap(str, expectsLowerCase) {
|
|
|
7
7
|
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
const EMPTY_OBJ = Object.freeze({}) ;
|
|
11
|
+
const EMPTY_ARR = Object.freeze([]) ;
|
|
12
|
+
const NOOP = () => {
|
|
13
|
+
};
|
|
14
|
+
const NO = () => false;
|
|
15
|
+
const onRE = /^on[^a-z]/;
|
|
16
|
+
const isOn = (key) => onRE.test(key);
|
|
17
|
+
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
18
|
+
const extend = Object.assign;
|
|
19
|
+
const remove = (arr, el) => {
|
|
20
|
+
const i = arr.indexOf(el);
|
|
21
|
+
if (i > -1) {
|
|
22
|
+
arr.splice(i, 1);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
26
|
+
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
|
|
27
|
+
const isArray = Array.isArray;
|
|
28
|
+
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
29
|
+
const isSet = (val) => toTypeString(val) === "[object Set]";
|
|
30
|
+
const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
31
|
+
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
|
32
|
+
const isFunction = (val) => typeof val === "function";
|
|
33
|
+
const isString = (val) => typeof val === "string";
|
|
34
|
+
const isSymbol = (val) => typeof val === "symbol";
|
|
35
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
36
|
+
const isPromise = (val) => {
|
|
37
|
+
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
38
|
+
};
|
|
39
|
+
const objectToString = Object.prototype.toString;
|
|
40
|
+
const toTypeString = (value) => objectToString.call(value);
|
|
41
|
+
const toRawType = (value) => {
|
|
42
|
+
return toTypeString(value).slice(8, -1);
|
|
43
|
+
};
|
|
44
|
+
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
45
|
+
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
46
|
+
const isReservedProp = /* @__PURE__ */ makeMap(
|
|
47
|
+
// the leading comma is intentional so empty string "" is also included
|
|
48
|
+
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
49
|
+
);
|
|
50
|
+
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
51
|
+
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
52
|
+
);
|
|
53
|
+
const cacheStringFunction = (fn) => {
|
|
54
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
55
|
+
return (str) => {
|
|
56
|
+
const hit = cache[str];
|
|
57
|
+
return hit || (cache[str] = fn(str));
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const camelizeRE = /-(\w)/g;
|
|
61
|
+
const camelize = cacheStringFunction((str) => {
|
|
62
|
+
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
63
|
+
});
|
|
64
|
+
const hyphenateRE = /\B([A-Z])/g;
|
|
65
|
+
const hyphenate = cacheStringFunction(
|
|
66
|
+
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
|
67
|
+
);
|
|
68
|
+
const capitalize = cacheStringFunction(
|
|
69
|
+
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
70
|
+
);
|
|
71
|
+
const toHandlerKey = cacheStringFunction(
|
|
72
|
+
(str) => str ? `on${capitalize(str)}` : ``
|
|
73
|
+
);
|
|
74
|
+
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
75
|
+
const invokeArrayFns = (fns, arg) => {
|
|
76
|
+
for (let i = 0; i < fns.length; i++) {
|
|
77
|
+
fns[i](arg);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const def = (obj, key, value) => {
|
|
81
|
+
Object.defineProperty(obj, key, {
|
|
82
|
+
configurable: true,
|
|
83
|
+
enumerable: false,
|
|
84
|
+
value
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
const looseToNumber = (val) => {
|
|
88
|
+
const n = parseFloat(val);
|
|
89
|
+
return isNaN(n) ? val : n;
|
|
90
|
+
};
|
|
91
|
+
const toNumber = (val) => {
|
|
92
|
+
const n = isString(val) ? Number(val) : NaN;
|
|
93
|
+
return isNaN(n) ? val : n;
|
|
94
|
+
};
|
|
95
|
+
let _globalThis;
|
|
96
|
+
const getGlobalThis = () => {
|
|
97
|
+
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
98
|
+
};
|
|
99
|
+
|
|
10
100
|
const PatchFlagNames = {
|
|
11
101
|
[1]: `TEXT`,
|
|
12
102
|
[2]: `CLASS`,
|
|
@@ -226,96 +316,6 @@ const replacer = (_key, val) => {
|
|
|
226
316
|
return val;
|
|
227
317
|
};
|
|
228
318
|
|
|
229
|
-
const EMPTY_OBJ = Object.freeze({}) ;
|
|
230
|
-
const EMPTY_ARR = Object.freeze([]) ;
|
|
231
|
-
const NOOP = () => {
|
|
232
|
-
};
|
|
233
|
-
const NO = () => false;
|
|
234
|
-
const onRE = /^on[^a-z]/;
|
|
235
|
-
const isOn = (key) => onRE.test(key);
|
|
236
|
-
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
237
|
-
const extend = Object.assign;
|
|
238
|
-
const remove = (arr, el) => {
|
|
239
|
-
const i = arr.indexOf(el);
|
|
240
|
-
if (i > -1) {
|
|
241
|
-
arr.splice(i, 1);
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
245
|
-
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
|
|
246
|
-
const isArray = Array.isArray;
|
|
247
|
-
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
248
|
-
const isSet = (val) => toTypeString(val) === "[object Set]";
|
|
249
|
-
const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
250
|
-
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
|
251
|
-
const isFunction = (val) => typeof val === "function";
|
|
252
|
-
const isString = (val) => typeof val === "string";
|
|
253
|
-
const isSymbol = (val) => typeof val === "symbol";
|
|
254
|
-
const isObject = (val) => val !== null && typeof val === "object";
|
|
255
|
-
const isPromise = (val) => {
|
|
256
|
-
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
257
|
-
};
|
|
258
|
-
const objectToString = Object.prototype.toString;
|
|
259
|
-
const toTypeString = (value) => objectToString.call(value);
|
|
260
|
-
const toRawType = (value) => {
|
|
261
|
-
return toTypeString(value).slice(8, -1);
|
|
262
|
-
};
|
|
263
|
-
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
264
|
-
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
265
|
-
const isReservedProp = /* @__PURE__ */ makeMap(
|
|
266
|
-
// the leading comma is intentional so empty string "" is also included
|
|
267
|
-
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
268
|
-
);
|
|
269
|
-
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
270
|
-
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
271
|
-
);
|
|
272
|
-
const cacheStringFunction = (fn) => {
|
|
273
|
-
const cache = /* @__PURE__ */ Object.create(null);
|
|
274
|
-
return (str) => {
|
|
275
|
-
const hit = cache[str];
|
|
276
|
-
return hit || (cache[str] = fn(str));
|
|
277
|
-
};
|
|
278
|
-
};
|
|
279
|
-
const camelizeRE = /-(\w)/g;
|
|
280
|
-
const camelize = cacheStringFunction((str) => {
|
|
281
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
282
|
-
});
|
|
283
|
-
const hyphenateRE = /\B([A-Z])/g;
|
|
284
|
-
const hyphenate = cacheStringFunction(
|
|
285
|
-
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
|
286
|
-
);
|
|
287
|
-
const capitalize = cacheStringFunction(
|
|
288
|
-
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
289
|
-
);
|
|
290
|
-
const toHandlerKey = cacheStringFunction(
|
|
291
|
-
(str) => str ? `on${capitalize(str)}` : ``
|
|
292
|
-
);
|
|
293
|
-
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
294
|
-
const invokeArrayFns = (fns, arg) => {
|
|
295
|
-
for (let i = 0; i < fns.length; i++) {
|
|
296
|
-
fns[i](arg);
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
const def = (obj, key, value) => {
|
|
300
|
-
Object.defineProperty(obj, key, {
|
|
301
|
-
configurable: true,
|
|
302
|
-
enumerable: false,
|
|
303
|
-
value
|
|
304
|
-
});
|
|
305
|
-
};
|
|
306
|
-
const looseToNumber = (val) => {
|
|
307
|
-
const n = parseFloat(val);
|
|
308
|
-
return isNaN(n) ? val : n;
|
|
309
|
-
};
|
|
310
|
-
const toNumber = (val) => {
|
|
311
|
-
const n = isString(val) ? Number(val) : NaN;
|
|
312
|
-
return isNaN(n) ? val : n;
|
|
313
|
-
};
|
|
314
|
-
let _globalThis;
|
|
315
|
-
const getGlobalThis = () => {
|
|
316
|
-
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
317
|
-
};
|
|
318
|
-
|
|
319
319
|
function warn$1(msg, ...args) {
|
|
320
320
|
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
321
321
|
}
|
|
@@ -1465,7 +1465,7 @@ function warn(msg, ...args) {
|
|
|
1465
1465
|
callWithErrorHandling(
|
|
1466
1466
|
appWarnHandler,
|
|
1467
1467
|
instance,
|
|
1468
|
-
|
|
1468
|
+
11,
|
|
1469
1469
|
[
|
|
1470
1470
|
msg + args.join(""),
|
|
1471
1471
|
instance && instance.proxy,
|
|
@@ -1578,21 +1578,21 @@ const ErrorTypeStrings = {
|
|
|
1578
1578
|
["ec"]: "errorCaptured hook",
|
|
1579
1579
|
["rtc"]: "renderTracked hook",
|
|
1580
1580
|
["rtg"]: "renderTriggered hook",
|
|
1581
|
-
[
|
|
1582
|
-
[
|
|
1583
|
-
[
|
|
1584
|
-
[
|
|
1585
|
-
[
|
|
1586
|
-
[
|
|
1587
|
-
[
|
|
1588
|
-
[
|
|
1589
|
-
[
|
|
1590
|
-
[
|
|
1591
|
-
[
|
|
1592
|
-
[
|
|
1593
|
-
[
|
|
1594
|
-
[
|
|
1595
|
-
[
|
|
1581
|
+
[0]: "setup function",
|
|
1582
|
+
[1]: "render function",
|
|
1583
|
+
[2]: "watcher getter",
|
|
1584
|
+
[3]: "watcher callback",
|
|
1585
|
+
[4]: "watcher cleanup function",
|
|
1586
|
+
[5]: "native event handler",
|
|
1587
|
+
[6]: "component event handler",
|
|
1588
|
+
[7]: "vnode hook",
|
|
1589
|
+
[8]: "directive hook",
|
|
1590
|
+
[9]: "transition hook",
|
|
1591
|
+
[10]: "app errorHandler",
|
|
1592
|
+
[11]: "app warnHandler",
|
|
1593
|
+
[12]: "ref function",
|
|
1594
|
+
[13]: "async component loader",
|
|
1595
|
+
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"
|
|
1596
1596
|
};
|
|
1597
1597
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
1598
1598
|
let res;
|
|
@@ -1641,7 +1641,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
1641
1641
|
callWithErrorHandling(
|
|
1642
1642
|
appErrorHandler,
|
|
1643
1643
|
null,
|
|
1644
|
-
|
|
1644
|
+
10,
|
|
1645
1645
|
[err, exposedInstance, errorInfo]
|
|
1646
1646
|
);
|
|
1647
1647
|
return;
|
|
@@ -1794,7 +1794,7 @@ function flushJobs(seen) {
|
|
|
1794
1794
|
if (check(job)) {
|
|
1795
1795
|
continue;
|
|
1796
1796
|
}
|
|
1797
|
-
callWithErrorHandling(job, null,
|
|
1797
|
+
callWithErrorHandling(job, null, 14);
|
|
1798
1798
|
}
|
|
1799
1799
|
}
|
|
1800
1800
|
} finally {
|
|
@@ -2412,7 +2412,7 @@ function emit$1(instance, event, args) {
|
|
|
2412
2412
|
callWithAsyncErrorHandling(
|
|
2413
2413
|
cbs.map((cb) => cb.bind(instance.proxy)),
|
|
2414
2414
|
instance,
|
|
2415
|
-
|
|
2415
|
+
6,
|
|
2416
2416
|
args
|
|
2417
2417
|
);
|
|
2418
2418
|
}
|
|
@@ -2474,7 +2474,7 @@ function compatModelEmit(instance, event, args) {
|
|
|
2474
2474
|
callWithErrorHandling(
|
|
2475
2475
|
modelHandler,
|
|
2476
2476
|
instance,
|
|
2477
|
-
|
|
2477
|
+
6,
|
|
2478
2478
|
args
|
|
2479
2479
|
);
|
|
2480
2480
|
}
|
|
@@ -2546,7 +2546,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
2546
2546
|
callWithAsyncErrorHandling(
|
|
2547
2547
|
handler,
|
|
2548
2548
|
instance,
|
|
2549
|
-
|
|
2549
|
+
6,
|
|
2550
2550
|
args
|
|
2551
2551
|
);
|
|
2552
2552
|
}
|
|
@@ -2561,7 +2561,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
2561
2561
|
callWithAsyncErrorHandling(
|
|
2562
2562
|
onceHandler,
|
|
2563
2563
|
instance,
|
|
2564
|
-
|
|
2564
|
+
6,
|
|
2565
2565
|
args
|
|
2566
2566
|
);
|
|
2567
2567
|
}
|
|
@@ -2745,7 +2745,7 @@ function renderComponentRoot(instance) {
|
|
|
2745
2745
|
}
|
|
2746
2746
|
} catch (err) {
|
|
2747
2747
|
blockStack.length = 0;
|
|
2748
|
-
handleError(err, instance,
|
|
2748
|
+
handleError(err, instance, 1);
|
|
2749
2749
|
result = createVNode(Comment);
|
|
2750
2750
|
}
|
|
2751
2751
|
let root = result;
|
|
@@ -3272,7 +3272,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
3272
3272
|
if (delayEnter) {
|
|
3273
3273
|
activeBranch.transition.afterLeave = () => {
|
|
3274
3274
|
if (pendingId === suspense.pendingId) {
|
|
3275
|
-
move(pendingBranch, container2, anchor2,
|
|
3275
|
+
move(pendingBranch, container2, anchor2, 0);
|
|
3276
3276
|
}
|
|
3277
3277
|
};
|
|
3278
3278
|
}
|
|
@@ -3282,7 +3282,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
3282
3282
|
unmount(activeBranch, parentComponent2, suspense, true);
|
|
3283
3283
|
}
|
|
3284
3284
|
if (!delayEnter) {
|
|
3285
|
-
move(pendingBranch, container2, anchor2,
|
|
3285
|
+
move(pendingBranch, container2, anchor2, 0);
|
|
3286
3286
|
}
|
|
3287
3287
|
}
|
|
3288
3288
|
setActiveBranch(suspense, pendingBranch);
|
|
@@ -3360,7 +3360,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
3360
3360
|
}
|
|
3361
3361
|
const hydratedEl = instance.vnode.el;
|
|
3362
3362
|
instance.asyncDep.catch((err) => {
|
|
3363
|
-
handleError(err, instance,
|
|
3363
|
+
handleError(err, instance, 0);
|
|
3364
3364
|
}).then((asyncSetupResult) => {
|
|
3365
3365
|
if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
|
|
3366
3366
|
return;
|
|
@@ -3604,14 +3604,14 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3604
3604
|
} else if (isReactive(s)) {
|
|
3605
3605
|
return traverse(s);
|
|
3606
3606
|
} else if (isFunction(s)) {
|
|
3607
|
-
return callWithErrorHandling(s, instance,
|
|
3607
|
+
return callWithErrorHandling(s, instance, 2);
|
|
3608
3608
|
} else {
|
|
3609
3609
|
warnInvalidSource(s);
|
|
3610
3610
|
}
|
|
3611
3611
|
});
|
|
3612
3612
|
} else if (isFunction(source)) {
|
|
3613
3613
|
if (cb) {
|
|
3614
|
-
getter = () => callWithErrorHandling(source, instance,
|
|
3614
|
+
getter = () => callWithErrorHandling(source, instance, 2);
|
|
3615
3615
|
} else {
|
|
3616
3616
|
getter = () => {
|
|
3617
3617
|
if (instance && instance.isUnmounted) {
|
|
@@ -3623,7 +3623,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3623
3623
|
return callWithAsyncErrorHandling(
|
|
3624
3624
|
source,
|
|
3625
3625
|
instance,
|
|
3626
|
-
|
|
3626
|
+
3,
|
|
3627
3627
|
[onCleanup]
|
|
3628
3628
|
);
|
|
3629
3629
|
};
|
|
@@ -3649,7 +3649,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3649
3649
|
let cleanup;
|
|
3650
3650
|
let onCleanup = (fn) => {
|
|
3651
3651
|
cleanup = effect.onStop = () => {
|
|
3652
|
-
callWithErrorHandling(fn, instance,
|
|
3652
|
+
callWithErrorHandling(fn, instance, 4);
|
|
3653
3653
|
};
|
|
3654
3654
|
};
|
|
3655
3655
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
@@ -3665,7 +3665,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3665
3665
|
if (cleanup) {
|
|
3666
3666
|
cleanup();
|
|
3667
3667
|
}
|
|
3668
|
-
callWithAsyncErrorHandling(cb, instance,
|
|
3668
|
+
callWithAsyncErrorHandling(cb, instance, 3, [
|
|
3669
3669
|
newValue,
|
|
3670
3670
|
// pass undefined as the old value when it's changed for the first time
|
|
3671
3671
|
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
@@ -3943,7 +3943,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
3943
3943
|
hook && callWithAsyncErrorHandling(
|
|
3944
3944
|
hook,
|
|
3945
3945
|
instance,
|
|
3946
|
-
|
|
3946
|
+
9,
|
|
3947
3947
|
args
|
|
3948
3948
|
);
|
|
3949
3949
|
};
|
|
@@ -4175,7 +4175,7 @@ function defineAsyncComponent(source) {
|
|
|
4175
4175
|
handleError(
|
|
4176
4176
|
err,
|
|
4177
4177
|
instance,
|
|
4178
|
-
|
|
4178
|
+
13,
|
|
4179
4179
|
!errorComponent
|
|
4180
4180
|
/* do not throw in dev if user provided error component */
|
|
4181
4181
|
);
|
|
@@ -4274,7 +4274,7 @@ const KeepAliveImpl = {
|
|
|
4274
4274
|
const storageContainer = createElement("div");
|
|
4275
4275
|
sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
|
|
4276
4276
|
const instance2 = vnode.component;
|
|
4277
|
-
move(vnode, container, anchor,
|
|
4277
|
+
move(vnode, container, anchor, 0, parentSuspense);
|
|
4278
4278
|
patch(
|
|
4279
4279
|
instance2.vnode,
|
|
4280
4280
|
vnode,
|
|
@@ -4302,7 +4302,7 @@ const KeepAliveImpl = {
|
|
|
4302
4302
|
};
|
|
4303
4303
|
sharedContext.deactivate = (vnode) => {
|
|
4304
4304
|
const instance2 = vnode.component;
|
|
4305
|
-
move(vnode, storageContainer, null,
|
|
4305
|
+
move(vnode, storageContainer, null, 1, parentSuspense);
|
|
4306
4306
|
queuePostRenderEffect(() => {
|
|
4307
4307
|
if (instance2.da) {
|
|
4308
4308
|
invokeArrayFns(instance2.da);
|
|
@@ -4660,7 +4660,7 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
|
4660
4660
|
}
|
|
4661
4661
|
if (hook) {
|
|
4662
4662
|
pauseTracking();
|
|
4663
|
-
callWithAsyncErrorHandling(hook, instance,
|
|
4663
|
+
callWithAsyncErrorHandling(hook, instance, 8, [
|
|
4664
4664
|
vnode.el,
|
|
4665
4665
|
binding,
|
|
4666
4666
|
vnode,
|
|
@@ -4677,7 +4677,7 @@ const FILTERS = "filters";
|
|
|
4677
4677
|
function resolveComponent(name, maybeSelfReference) {
|
|
4678
4678
|
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
4679
4679
|
}
|
|
4680
|
-
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
4680
|
+
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
4681
4681
|
function resolveDynamicComponent(component) {
|
|
4682
4682
|
if (isString(component)) {
|
|
4683
4683
|
return resolveAsset(COMPONENTS, component, false) || component;
|
|
@@ -6643,7 +6643,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
6643
6643
|
return vm;
|
|
6644
6644
|
}
|
|
6645
6645
|
}
|
|
6646
|
-
Vue.version = `2.6.14-compat:${"3.3.0-alpha.
|
|
6646
|
+
Vue.version = `2.6.14-compat:${"3.3.0-alpha.5"}`;
|
|
6647
6647
|
Vue.config = singletonApp.config;
|
|
6648
6648
|
Vue.use = (p, ...options) => {
|
|
6649
6649
|
if (p && isFunction(p.install)) {
|
|
@@ -7224,7 +7224,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
7224
7224
|
}
|
|
7225
7225
|
}
|
|
7226
7226
|
if (isFunction(ref)) {
|
|
7227
|
-
callWithErrorHandling(ref, owner,
|
|
7227
|
+
callWithErrorHandling(ref, owner, 12, [value, refs]);
|
|
7228
7228
|
} else {
|
|
7229
7229
|
const _isString = isString(ref);
|
|
7230
7230
|
const _isRef = isRef(ref);
|
|
@@ -8897,7 +8897,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8897
8897
|
);
|
|
8898
8898
|
} else if (moved) {
|
|
8899
8899
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
8900
|
-
move(nextChild, container, anchor,
|
|
8900
|
+
move(nextChild, container, anchor, 2);
|
|
8901
8901
|
} else {
|
|
8902
8902
|
j--;
|
|
8903
8903
|
}
|
|
@@ -8931,9 +8931,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8931
8931
|
moveStaticNode(vnode, container, anchor);
|
|
8932
8932
|
return;
|
|
8933
8933
|
}
|
|
8934
|
-
const needTransition = moveType !==
|
|
8934
|
+
const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
|
|
8935
8935
|
if (needTransition) {
|
|
8936
|
-
if (moveType ===
|
|
8936
|
+
if (moveType === 0) {
|
|
8937
8937
|
transition.beforeEnter(el);
|
|
8938
8938
|
hostInsert(el, container, anchor);
|
|
8939
8939
|
queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
|
@@ -9340,7 +9340,7 @@ const TeleportImpl = {
|
|
|
9340
9340
|
container,
|
|
9341
9341
|
mainAnchor,
|
|
9342
9342
|
internals,
|
|
9343
|
-
|
|
9343
|
+
1
|
|
9344
9344
|
);
|
|
9345
9345
|
}
|
|
9346
9346
|
} else {
|
|
@@ -9355,7 +9355,7 @@ const TeleportImpl = {
|
|
|
9355
9355
|
nextTarget,
|
|
9356
9356
|
null,
|
|
9357
9357
|
internals,
|
|
9358
|
-
|
|
9358
|
+
0
|
|
9359
9359
|
);
|
|
9360
9360
|
} else {
|
|
9361
9361
|
warn(
|
|
@@ -9370,7 +9370,7 @@ const TeleportImpl = {
|
|
|
9370
9370
|
target,
|
|
9371
9371
|
targetAnchor,
|
|
9372
9372
|
internals,
|
|
9373
|
-
|
|
9373
|
+
1
|
|
9374
9374
|
);
|
|
9375
9375
|
}
|
|
9376
9376
|
}
|
|
@@ -9401,12 +9401,12 @@ const TeleportImpl = {
|
|
|
9401
9401
|
move: moveTeleport,
|
|
9402
9402
|
hydrate: hydrateTeleport
|
|
9403
9403
|
};
|
|
9404
|
-
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType =
|
|
9405
|
-
if (moveType ===
|
|
9404
|
+
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
|
|
9405
|
+
if (moveType === 0) {
|
|
9406
9406
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
9407
9407
|
}
|
|
9408
9408
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
9409
|
-
const isReorder = moveType ===
|
|
9409
|
+
const isReorder = moveType === 2;
|
|
9410
9410
|
if (isReorder) {
|
|
9411
9411
|
insert(el, container, parentAnchor);
|
|
9412
9412
|
}
|
|
@@ -9417,7 +9417,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
9417
9417
|
children[i],
|
|
9418
9418
|
container,
|
|
9419
9419
|
parentAnchor,
|
|
9420
|
-
|
|
9420
|
+
2
|
|
9421
9421
|
);
|
|
9422
9422
|
}
|
|
9423
9423
|
}
|
|
@@ -9538,10 +9538,10 @@ function convertLegacyComponent(comp, instance) {
|
|
|
9538
9538
|
return comp;
|
|
9539
9539
|
}
|
|
9540
9540
|
|
|
9541
|
-
const Fragment = Symbol("
|
|
9542
|
-
const Text = Symbol("
|
|
9543
|
-
const Comment = Symbol("
|
|
9544
|
-
const Static = Symbol("
|
|
9541
|
+
const Fragment = Symbol.for("v-fgt");
|
|
9542
|
+
const Text = Symbol.for("v-txt");
|
|
9543
|
+
const Comment = Symbol.for("v-cmt");
|
|
9544
|
+
const Static = Symbol.for("v-stc");
|
|
9545
9545
|
const blockStack = [];
|
|
9546
9546
|
let currentBlock = null;
|
|
9547
9547
|
function openBlock(disableTracking = false) {
|
|
@@ -9906,7 +9906,7 @@ function mergeProps(...args) {
|
|
|
9906
9906
|
return ret;
|
|
9907
9907
|
}
|
|
9908
9908
|
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
9909
|
-
callWithAsyncErrorHandling(hook, instance,
|
|
9909
|
+
callWithAsyncErrorHandling(hook, instance, 7, [
|
|
9910
9910
|
vnode,
|
|
9911
9911
|
prevVNode
|
|
9912
9912
|
]);
|
|
@@ -10003,13 +10003,19 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
10003
10003
|
}
|
|
10004
10004
|
let currentInstance = null;
|
|
10005
10005
|
const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
|
10006
|
+
let internalSetCurrentInstance;
|
|
10007
|
+
{
|
|
10008
|
+
internalSetCurrentInstance = (i) => {
|
|
10009
|
+
currentInstance = i;
|
|
10010
|
+
};
|
|
10011
|
+
}
|
|
10006
10012
|
const setCurrentInstance = (instance) => {
|
|
10007
|
-
|
|
10013
|
+
internalSetCurrentInstance(instance);
|
|
10008
10014
|
instance.scope.on();
|
|
10009
10015
|
};
|
|
10010
10016
|
const unsetCurrentInstance = () => {
|
|
10011
10017
|
currentInstance && currentInstance.scope.off();
|
|
10012
|
-
|
|
10018
|
+
internalSetCurrentInstance(null);
|
|
10013
10019
|
};
|
|
10014
10020
|
const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
|
|
10015
10021
|
function validateComponentName(name, config) {
|
|
@@ -10072,7 +10078,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
10072
10078
|
const setupResult = callWithErrorHandling(
|
|
10073
10079
|
setup,
|
|
10074
10080
|
instance,
|
|
10075
|
-
|
|
10081
|
+
0,
|
|
10076
10082
|
[shallowReadonly(instance.props) , setupContext]
|
|
10077
10083
|
);
|
|
10078
10084
|
resetTracking();
|
|
@@ -10083,7 +10089,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
10083
10089
|
return setupResult.then((resolvedResult) => {
|
|
10084
10090
|
handleSetupResult(instance, resolvedResult, isSSR);
|
|
10085
10091
|
}).catch((e) => {
|
|
10086
|
-
handleError(e, instance,
|
|
10092
|
+
handleError(e, instance, 0);
|
|
10087
10093
|
});
|
|
10088
10094
|
} else {
|
|
10089
10095
|
instance.asyncDep = setupResult;
|
|
@@ -10421,7 +10427,7 @@ function h(type, propsOrChildren, children) {
|
|
|
10421
10427
|
}
|
|
10422
10428
|
}
|
|
10423
10429
|
|
|
10424
|
-
const ssrContextKey = Symbol(
|
|
10430
|
+
const ssrContextKey = Symbol.for("v-scx");
|
|
10425
10431
|
const useSSRContext = () => {
|
|
10426
10432
|
{
|
|
10427
10433
|
const ctx = inject(ssrContextKey);
|
|
@@ -10635,7 +10641,7 @@ function isMemoSame(cached, memo) {
|
|
|
10635
10641
|
return true;
|
|
10636
10642
|
}
|
|
10637
10643
|
|
|
10638
|
-
const version = "3.3.0-alpha.
|
|
10644
|
+
const version = "3.3.0-alpha.5";
|
|
10639
10645
|
const ssrUtils = null;
|
|
10640
10646
|
const resolveFilter = resolveFilter$1 ;
|
|
10641
10647
|
const _compatUtils = {
|
|
@@ -10967,7 +10973,7 @@ function createInvoker(initialValue, instance) {
|
|
|
10967
10973
|
callWithAsyncErrorHandling(
|
|
10968
10974
|
patchStopImmediatePropagation(e, invoker.value),
|
|
10969
10975
|
instance,
|
|
10970
|
-
|
|
10976
|
+
5,
|
|
10971
10977
|
[e]
|
|
10972
10978
|
);
|
|
10973
10979
|
};
|
|
@@ -12445,63 +12451,63 @@ function createCompilerError(code, loc, messages, additionalMessage) {
|
|
|
12445
12451
|
}
|
|
12446
12452
|
const errorMessages = {
|
|
12447
12453
|
// parse errors
|
|
12448
|
-
[
|
|
12449
|
-
[
|
|
12450
|
-
[
|
|
12451
|
-
[
|
|
12452
|
-
[
|
|
12453
|
-
[
|
|
12454
|
-
[
|
|
12455
|
-
[
|
|
12456
|
-
[
|
|
12457
|
-
[
|
|
12458
|
-
[
|
|
12459
|
-
[
|
|
12460
|
-
[
|
|
12461
|
-
[
|
|
12462
|
-
[
|
|
12463
|
-
[
|
|
12464
|
-
[
|
|
12465
|
-
[
|
|
12466
|
-
[
|
|
12467
|
-
[
|
|
12468
|
-
[
|
|
12469
|
-
[
|
|
12470
|
-
[
|
|
12454
|
+
[0]: "Illegal comment.",
|
|
12455
|
+
[1]: "CDATA section is allowed only in XML context.",
|
|
12456
|
+
[2]: "Duplicate attribute.",
|
|
12457
|
+
[3]: "End tag cannot have attributes.",
|
|
12458
|
+
[4]: "Illegal '/' in tags.",
|
|
12459
|
+
[5]: "Unexpected EOF in tag.",
|
|
12460
|
+
[6]: "Unexpected EOF in CDATA section.",
|
|
12461
|
+
[7]: "Unexpected EOF in comment.",
|
|
12462
|
+
[8]: "Unexpected EOF in script.",
|
|
12463
|
+
[9]: "Unexpected EOF in tag.",
|
|
12464
|
+
[10]: "Incorrectly closed comment.",
|
|
12465
|
+
[11]: "Incorrectly opened comment.",
|
|
12466
|
+
[12]: "Illegal tag name. Use '<' to print '<'.",
|
|
12467
|
+
[13]: "Attribute value was expected.",
|
|
12468
|
+
[14]: "End tag name was expected.",
|
|
12469
|
+
[15]: "Whitespace was expected.",
|
|
12470
|
+
[16]: "Unexpected '<!--' in comment.",
|
|
12471
|
+
[17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
|
|
12472
|
+
[18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
|
|
12473
|
+
[19]: "Attribute name cannot start with '='.",
|
|
12474
|
+
[21]: "'<?' is allowed only in XML context.",
|
|
12475
|
+
[20]: `Unexpected null character.`,
|
|
12476
|
+
[22]: "Illegal '/' in tags.",
|
|
12471
12477
|
// Vue-specific parse errors
|
|
12472
|
-
[
|
|
12473
|
-
[
|
|
12474
|
-
[
|
|
12475
|
-
[
|
|
12476
|
-
[
|
|
12478
|
+
[23]: "Invalid end tag.",
|
|
12479
|
+
[24]: "Element is missing end tag.",
|
|
12480
|
+
[25]: "Interpolation end sign was not found.",
|
|
12481
|
+
[27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
|
|
12482
|
+
[26]: "Legal directive name was expected.",
|
|
12477
12483
|
// transform errors
|
|
12478
|
-
[
|
|
12479
|
-
[
|
|
12480
|
-
[
|
|
12481
|
-
[
|
|
12482
|
-
[
|
|
12483
|
-
[
|
|
12484
|
-
[
|
|
12485
|
-
[
|
|
12486
|
-
[
|
|
12487
|
-
[
|
|
12488
|
-
[
|
|
12489
|
-
[
|
|
12490
|
-
[
|
|
12491
|
-
[
|
|
12492
|
-
[
|
|
12493
|
-
[
|
|
12494
|
-
[
|
|
12484
|
+
[28]: `v-if/v-else-if is missing expression.`,
|
|
12485
|
+
[29]: `v-if/else branches must use unique keys.`,
|
|
12486
|
+
[30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
|
|
12487
|
+
[31]: `v-for is missing expression.`,
|
|
12488
|
+
[32]: `v-for has invalid expression.`,
|
|
12489
|
+
[33]: `<template v-for> key should be placed on the <template> tag.`,
|
|
12490
|
+
[34]: `v-bind is missing expression.`,
|
|
12491
|
+
[35]: `v-on is missing expression.`,
|
|
12492
|
+
[36]: `Unexpected custom directive on <slot> outlet.`,
|
|
12493
|
+
[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.`,
|
|
12494
|
+
[38]: `Duplicate slot names found. `,
|
|
12495
|
+
[39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
|
|
12496
|
+
[40]: `v-slot can only be used on components or <template> tags.`,
|
|
12497
|
+
[41]: `v-model is missing expression.`,
|
|
12498
|
+
[42]: `v-model value must be a valid JavaScript member expression.`,
|
|
12499
|
+
[43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
12500
|
+
[44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
|
|
12495
12501
|
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
12496
|
-
[
|
|
12497
|
-
[
|
|
12502
|
+
[45]: `Error parsing JavaScript expression: `,
|
|
12503
|
+
[46]: `<KeepAlive> expects exactly one child component.`,
|
|
12498
12504
|
// generic errors
|
|
12499
|
-
[
|
|
12500
|
-
[
|
|
12501
|
-
[
|
|
12502
|
-
[
|
|
12505
|
+
[47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
12506
|
+
[48]: `ES module mode is not supported in this build of compiler.`,
|
|
12507
|
+
[49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
12508
|
+
[50]: `"scopeId" option is only supported in module mode.`,
|
|
12503
12509
|
// just to fulfill types
|
|
12504
|
-
[
|
|
12510
|
+
[51]: ``
|
|
12505
12511
|
};
|
|
12506
12512
|
|
|
12507
12513
|
const FRAGMENT = Symbol(`Fragment` );
|
|
@@ -12599,7 +12605,7 @@ const locStub = {
|
|
|
12599
12605
|
};
|
|
12600
12606
|
function createRoot(children, loc = locStub) {
|
|
12601
12607
|
return {
|
|
12602
|
-
type:
|
|
12608
|
+
type: 0,
|
|
12603
12609
|
children,
|
|
12604
12610
|
helpers: /* @__PURE__ */ new Set(),
|
|
12605
12611
|
components: [],
|
|
@@ -12625,7 +12631,7 @@ function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps,
|
|
|
12625
12631
|
}
|
|
12626
12632
|
}
|
|
12627
12633
|
return {
|
|
12628
|
-
type:
|
|
12634
|
+
type: 13,
|
|
12629
12635
|
tag,
|
|
12630
12636
|
props,
|
|
12631
12637
|
children,
|
|
@@ -12640,21 +12646,21 @@ function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps,
|
|
|
12640
12646
|
}
|
|
12641
12647
|
function createArrayExpression(elements, loc = locStub) {
|
|
12642
12648
|
return {
|
|
12643
|
-
type:
|
|
12649
|
+
type: 17,
|
|
12644
12650
|
loc,
|
|
12645
12651
|
elements
|
|
12646
12652
|
};
|
|
12647
12653
|
}
|
|
12648
12654
|
function createObjectExpression(properties, loc = locStub) {
|
|
12649
12655
|
return {
|
|
12650
|
-
type:
|
|
12656
|
+
type: 15,
|
|
12651
12657
|
loc,
|
|
12652
12658
|
properties
|
|
12653
12659
|
};
|
|
12654
12660
|
}
|
|
12655
12661
|
function createObjectProperty(key, value) {
|
|
12656
12662
|
return {
|
|
12657
|
-
type:
|
|
12663
|
+
type: 16,
|
|
12658
12664
|
loc: locStub,
|
|
12659
12665
|
key: isString(key) ? createSimpleExpression(key, true) : key,
|
|
12660
12666
|
value
|
|
@@ -12662,23 +12668,23 @@ function createObjectProperty(key, value) {
|
|
|
12662
12668
|
}
|
|
12663
12669
|
function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) {
|
|
12664
12670
|
return {
|
|
12665
|
-
type:
|
|
12671
|
+
type: 4,
|
|
12666
12672
|
loc,
|
|
12667
12673
|
content,
|
|
12668
12674
|
isStatic,
|
|
12669
|
-
constType: isStatic ?
|
|
12675
|
+
constType: isStatic ? 3 : constType
|
|
12670
12676
|
};
|
|
12671
12677
|
}
|
|
12672
12678
|
function createCompoundExpression(children, loc = locStub) {
|
|
12673
12679
|
return {
|
|
12674
|
-
type:
|
|
12680
|
+
type: 8,
|
|
12675
12681
|
loc,
|
|
12676
12682
|
children
|
|
12677
12683
|
};
|
|
12678
12684
|
}
|
|
12679
12685
|
function createCallExpression(callee, args = [], loc = locStub) {
|
|
12680
12686
|
return {
|
|
12681
|
-
type:
|
|
12687
|
+
type: 14,
|
|
12682
12688
|
loc,
|
|
12683
12689
|
callee,
|
|
12684
12690
|
arguments: args
|
|
@@ -12686,7 +12692,7 @@ function createCallExpression(callee, args = [], loc = locStub) {
|
|
|
12686
12692
|
}
|
|
12687
12693
|
function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) {
|
|
12688
12694
|
return {
|
|
12689
|
-
type:
|
|
12695
|
+
type: 18,
|
|
12690
12696
|
params,
|
|
12691
12697
|
returns,
|
|
12692
12698
|
newline,
|
|
@@ -12696,7 +12702,7 @@ function createFunctionExpression(params, returns = void 0, newline = false, isS
|
|
|
12696
12702
|
}
|
|
12697
12703
|
function createConditionalExpression(test, consequent, alternate, newline = true) {
|
|
12698
12704
|
return {
|
|
12699
|
-
type:
|
|
12705
|
+
type: 19,
|
|
12700
12706
|
test,
|
|
12701
12707
|
consequent,
|
|
12702
12708
|
alternate,
|
|
@@ -12706,7 +12712,7 @@ function createConditionalExpression(test, consequent, alternate, newline = true
|
|
|
12706
12712
|
}
|
|
12707
12713
|
function createCacheExpression(index, value, isVNode = false) {
|
|
12708
12714
|
return {
|
|
12709
|
-
type:
|
|
12715
|
+
type: 20,
|
|
12710
12716
|
index,
|
|
12711
12717
|
value,
|
|
12712
12718
|
isVNode,
|
|
@@ -12715,13 +12721,27 @@ function createCacheExpression(index, value, isVNode = false) {
|
|
|
12715
12721
|
}
|
|
12716
12722
|
function createBlockStatement(body) {
|
|
12717
12723
|
return {
|
|
12718
|
-
type:
|
|
12724
|
+
type: 21,
|
|
12719
12725
|
body,
|
|
12720
12726
|
loc: locStub
|
|
12721
12727
|
};
|
|
12722
12728
|
}
|
|
12729
|
+
function getVNodeHelper(ssr, isComponent) {
|
|
12730
|
+
return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
|
|
12731
|
+
}
|
|
12732
|
+
function getVNodeBlockHelper(ssr, isComponent) {
|
|
12733
|
+
return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
|
|
12734
|
+
}
|
|
12735
|
+
function convertToBlock(node, { helper, removeHelper, inSSR }) {
|
|
12736
|
+
if (!node.isBlock) {
|
|
12737
|
+
node.isBlock = true;
|
|
12738
|
+
removeHelper(getVNodeHelper(inSSR, node.isComponent));
|
|
12739
|
+
helper(OPEN_BLOCK);
|
|
12740
|
+
helper(getVNodeBlockHelper(inSSR, node.isComponent));
|
|
12741
|
+
}
|
|
12742
|
+
}
|
|
12723
12743
|
|
|
12724
|
-
const isStaticExp = (p) => p.type ===
|
|
12744
|
+
const isStaticExp = (p) => p.type === 4 && p.isStatic;
|
|
12725
12745
|
const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
|
|
12726
12746
|
function isCoreComponent(tag) {
|
|
12727
12747
|
if (isBuiltInType(tag, "Teleport")) {
|
|
@@ -12847,7 +12867,7 @@ function assert(condition, msg) {
|
|
|
12847
12867
|
function findDir(node, name, allowEmpty = false) {
|
|
12848
12868
|
for (let i = 0; i < node.props.length; i++) {
|
|
12849
12869
|
const p = node.props[i];
|
|
12850
|
-
if (p.type ===
|
|
12870
|
+
if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
|
|
12851
12871
|
return p;
|
|
12852
12872
|
}
|
|
12853
12873
|
}
|
|
@@ -12855,7 +12875,7 @@ function findDir(node, name, allowEmpty = false) {
|
|
|
12855
12875
|
function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
|
|
12856
12876
|
for (let i = 0; i < node.props.length; i++) {
|
|
12857
12877
|
const p = node.props[i];
|
|
12858
|
-
if (p.type ===
|
|
12878
|
+
if (p.type === 6) {
|
|
12859
12879
|
if (dynamicOnly)
|
|
12860
12880
|
continue;
|
|
12861
12881
|
if (p.name === name && (p.value || allowEmpty)) {
|
|
@@ -12871,33 +12891,27 @@ function isStaticArgOf(arg, name) {
|
|
|
12871
12891
|
}
|
|
12872
12892
|
function hasDynamicKeyVBind(node) {
|
|
12873
12893
|
return node.props.some(
|
|
12874
|
-
(p) => p.type ===
|
|
12875
|
-
p.arg.type !==
|
|
12894
|
+
(p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
|
|
12895
|
+
p.arg.type !== 4 || // v-bind:[_ctx.foo]
|
|
12876
12896
|
!p.arg.isStatic)
|
|
12877
12897
|
// v-bind:[foo]
|
|
12878
12898
|
);
|
|
12879
12899
|
}
|
|
12880
12900
|
function isText$1(node) {
|
|
12881
|
-
return node.type ===
|
|
12901
|
+
return node.type === 5 || node.type === 2;
|
|
12882
12902
|
}
|
|
12883
12903
|
function isVSlot(p) {
|
|
12884
|
-
return p.type ===
|
|
12904
|
+
return p.type === 7 && p.name === "slot";
|
|
12885
12905
|
}
|
|
12886
12906
|
function isTemplateNode(node) {
|
|
12887
|
-
return node.type ===
|
|
12907
|
+
return node.type === 1 && node.tagType === 3;
|
|
12888
12908
|
}
|
|
12889
12909
|
function isSlotOutlet(node) {
|
|
12890
|
-
return node.type ===
|
|
12891
|
-
}
|
|
12892
|
-
function getVNodeHelper(ssr, isComponent) {
|
|
12893
|
-
return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
|
|
12894
|
-
}
|
|
12895
|
-
function getVNodeBlockHelper(ssr, isComponent) {
|
|
12896
|
-
return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
|
|
12910
|
+
return node.type === 1 && node.tagType === 2;
|
|
12897
12911
|
}
|
|
12898
12912
|
const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
|
|
12899
12913
|
function getUnnormalizedProps(props, callPath = []) {
|
|
12900
|
-
if (props && !isString(props) && props.type ===
|
|
12914
|
+
if (props && !isString(props) && props.type === 14) {
|
|
12901
12915
|
const callee = props.callee;
|
|
12902
12916
|
if (!isString(callee) && propsHelperSet.has(callee)) {
|
|
12903
12917
|
return getUnnormalizedProps(
|
|
@@ -12910,10 +12924,10 @@ function getUnnormalizedProps(props, callPath = []) {
|
|
|
12910
12924
|
}
|
|
12911
12925
|
function injectProp(node, prop, context) {
|
|
12912
12926
|
let propsWithInjection;
|
|
12913
|
-
let props = node.type ===
|
|
12927
|
+
let props = node.type === 13 ? node.props : node.arguments[2];
|
|
12914
12928
|
let callPath = [];
|
|
12915
12929
|
let parentCall;
|
|
12916
|
-
if (props && !isString(props) && props.type ===
|
|
12930
|
+
if (props && !isString(props) && props.type === 14) {
|
|
12917
12931
|
const ret = getUnnormalizedProps(props);
|
|
12918
12932
|
props = ret[0];
|
|
12919
12933
|
callPath = ret[1];
|
|
@@ -12921,9 +12935,9 @@ function injectProp(node, prop, context) {
|
|
|
12921
12935
|
}
|
|
12922
12936
|
if (props == null || isString(props)) {
|
|
12923
12937
|
propsWithInjection = createObjectExpression([prop]);
|
|
12924
|
-
} else if (props.type ===
|
|
12938
|
+
} else if (props.type === 14) {
|
|
12925
12939
|
const first = props.arguments[0];
|
|
12926
|
-
if (!isString(first) && first.type ===
|
|
12940
|
+
if (!isString(first) && first.type === 15) {
|
|
12927
12941
|
if (!hasProp(prop, first)) {
|
|
12928
12942
|
first.properties.unshift(prop);
|
|
12929
12943
|
}
|
|
@@ -12938,7 +12952,7 @@ function injectProp(node, prop, context) {
|
|
|
12938
12952
|
}
|
|
12939
12953
|
}
|
|
12940
12954
|
!propsWithInjection && (propsWithInjection = props);
|
|
12941
|
-
} else if (props.type ===
|
|
12955
|
+
} else if (props.type === 15) {
|
|
12942
12956
|
if (!hasProp(prop, props)) {
|
|
12943
12957
|
props.properties.unshift(prop);
|
|
12944
12958
|
}
|
|
@@ -12952,7 +12966,7 @@ function injectProp(node, prop, context) {
|
|
|
12952
12966
|
parentCall = callPath[callPath.length - 2];
|
|
12953
12967
|
}
|
|
12954
12968
|
}
|
|
12955
|
-
if (node.type ===
|
|
12969
|
+
if (node.type === 13) {
|
|
12956
12970
|
if (parentCall) {
|
|
12957
12971
|
parentCall.arguments[0] = propsWithInjection;
|
|
12958
12972
|
} else {
|
|
@@ -12968,10 +12982,10 @@ function injectProp(node, prop, context) {
|
|
|
12968
12982
|
}
|
|
12969
12983
|
function hasProp(prop, props) {
|
|
12970
12984
|
let result = false;
|
|
12971
|
-
if (prop.key.type ===
|
|
12985
|
+
if (prop.key.type === 4) {
|
|
12972
12986
|
const propKeyName = prop.key.content;
|
|
12973
12987
|
result = props.properties.some(
|
|
12974
|
-
(p) => p.key.type ===
|
|
12988
|
+
(p) => p.key.type === 4 && p.key.content === propKeyName
|
|
12975
12989
|
);
|
|
12976
12990
|
}
|
|
12977
12991
|
return result;
|
|
@@ -12982,20 +12996,12 @@ function toValidAssetId(name, type) {
|
|
|
12982
12996
|
})}`;
|
|
12983
12997
|
}
|
|
12984
12998
|
function getMemoedVNodeCall(node) {
|
|
12985
|
-
if (node.type ===
|
|
12999
|
+
if (node.type === 14 && node.callee === WITH_MEMO) {
|
|
12986
13000
|
return node.arguments[1].returns;
|
|
12987
13001
|
} else {
|
|
12988
13002
|
return node;
|
|
12989
13003
|
}
|
|
12990
13004
|
}
|
|
12991
|
-
function makeBlock(node, { helper, removeHelper, inSSR }) {
|
|
12992
|
-
if (!node.isBlock) {
|
|
12993
|
-
node.isBlock = true;
|
|
12994
|
-
removeHelper(getVNodeHelper(inSSR, node.isComponent));
|
|
12995
|
-
helper(OPEN_BLOCK);
|
|
12996
|
-
helper(getVNodeBlockHelper(inSSR, node.isComponent));
|
|
12997
|
-
}
|
|
12998
|
-
}
|
|
12999
13005
|
|
|
13000
13006
|
const deprecationData = {
|
|
13001
13007
|
["COMPILER_IS_ON_ELEMENT"]: {
|
|
@@ -13079,8 +13085,8 @@ const decodeMap = {
|
|
|
13079
13085
|
};
|
|
13080
13086
|
const defaultParserOptions = {
|
|
13081
13087
|
delimiters: [`{{`, `}}`],
|
|
13082
|
-
getNamespace: () =>
|
|
13083
|
-
getTextMode: () =>
|
|
13088
|
+
getNamespace: () => 0,
|
|
13089
|
+
getTextMode: () => 0,
|
|
13084
13090
|
isVoidTag: NO,
|
|
13085
13091
|
isPreTag: NO,
|
|
13086
13092
|
isCustomElement: NO,
|
|
@@ -13093,7 +13099,7 @@ function baseParse(content, options = {}) {
|
|
|
13093
13099
|
const context = createParserContext(content, options);
|
|
13094
13100
|
const start = getCursor(context);
|
|
13095
13101
|
return createRoot(
|
|
13096
|
-
parseChildren(context,
|
|
13102
|
+
parseChildren(context, 0, []),
|
|
13097
13103
|
getSelection(context, start)
|
|
13098
13104
|
);
|
|
13099
13105
|
}
|
|
@@ -13117,48 +13123,48 @@ function createParserContext(content, rawOptions) {
|
|
|
13117
13123
|
}
|
|
13118
13124
|
function parseChildren(context, mode, ancestors) {
|
|
13119
13125
|
const parent = last(ancestors);
|
|
13120
|
-
const ns = parent ? parent.ns :
|
|
13126
|
+
const ns = parent ? parent.ns : 0;
|
|
13121
13127
|
const nodes = [];
|
|
13122
13128
|
while (!isEnd(context, mode, ancestors)) {
|
|
13123
13129
|
const s = context.source;
|
|
13124
13130
|
let node = void 0;
|
|
13125
|
-
if (mode ===
|
|
13131
|
+
if (mode === 0 || mode === 1) {
|
|
13126
13132
|
if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
|
|
13127
13133
|
node = parseInterpolation(context, mode);
|
|
13128
|
-
} else if (mode ===
|
|
13134
|
+
} else if (mode === 0 && s[0] === "<") {
|
|
13129
13135
|
if (s.length === 1) {
|
|
13130
|
-
emitError(context,
|
|
13136
|
+
emitError(context, 5, 1);
|
|
13131
13137
|
} else if (s[1] === "!") {
|
|
13132
13138
|
if (startsWith(s, "<!--")) {
|
|
13133
13139
|
node = parseComment(context);
|
|
13134
13140
|
} else if (startsWith(s, "<!DOCTYPE")) {
|
|
13135
13141
|
node = parseBogusComment(context);
|
|
13136
13142
|
} else if (startsWith(s, "<![CDATA[")) {
|
|
13137
|
-
if (ns !==
|
|
13143
|
+
if (ns !== 0) {
|
|
13138
13144
|
node = parseCDATA(context, ancestors);
|
|
13139
13145
|
} else {
|
|
13140
|
-
emitError(context,
|
|
13146
|
+
emitError(context, 1);
|
|
13141
13147
|
node = parseBogusComment(context);
|
|
13142
13148
|
}
|
|
13143
13149
|
} else {
|
|
13144
|
-
emitError(context,
|
|
13150
|
+
emitError(context, 11);
|
|
13145
13151
|
node = parseBogusComment(context);
|
|
13146
13152
|
}
|
|
13147
13153
|
} else if (s[1] === "/") {
|
|
13148
13154
|
if (s.length === 2) {
|
|
13149
|
-
emitError(context,
|
|
13155
|
+
emitError(context, 5, 2);
|
|
13150
13156
|
} else if (s[2] === ">") {
|
|
13151
|
-
emitError(context,
|
|
13157
|
+
emitError(context, 14, 2);
|
|
13152
13158
|
advanceBy(context, 3);
|
|
13153
13159
|
continue;
|
|
13154
13160
|
} else if (/[a-z]/i.test(s[2])) {
|
|
13155
|
-
emitError(context,
|
|
13161
|
+
emitError(context, 23);
|
|
13156
13162
|
parseTag(context, TagType.End, parent);
|
|
13157
13163
|
continue;
|
|
13158
13164
|
} else {
|
|
13159
13165
|
emitError(
|
|
13160
13166
|
context,
|
|
13161
|
-
|
|
13167
|
+
12,
|
|
13162
13168
|
2
|
|
13163
13169
|
);
|
|
13164
13170
|
node = parseBogusComment(context);
|
|
@@ -13169,7 +13175,7 @@ function parseChildren(context, mode, ancestors) {
|
|
|
13169
13175
|
"COMPILER_NATIVE_TEMPLATE",
|
|
13170
13176
|
context
|
|
13171
13177
|
) && node && node.tag === "template" && !node.props.some(
|
|
13172
|
-
(p) => p.type ===
|
|
13178
|
+
(p) => p.type === 7 && isSpecialTemplateDirective(p.name)
|
|
13173
13179
|
)) {
|
|
13174
13180
|
warnDeprecation(
|
|
13175
13181
|
"COMPILER_NATIVE_TEMPLATE",
|
|
@@ -13181,12 +13187,12 @@ function parseChildren(context, mode, ancestors) {
|
|
|
13181
13187
|
} else if (s[1] === "?") {
|
|
13182
13188
|
emitError(
|
|
13183
13189
|
context,
|
|
13184
|
-
|
|
13190
|
+
21,
|
|
13185
13191
|
1
|
|
13186
13192
|
);
|
|
13187
13193
|
node = parseBogusComment(context);
|
|
13188
13194
|
} else {
|
|
13189
|
-
emitError(context,
|
|
13195
|
+
emitError(context, 12, 1);
|
|
13190
13196
|
}
|
|
13191
13197
|
}
|
|
13192
13198
|
}
|
|
@@ -13202,16 +13208,16 @@ function parseChildren(context, mode, ancestors) {
|
|
|
13202
13208
|
}
|
|
13203
13209
|
}
|
|
13204
13210
|
let removedWhitespace = false;
|
|
13205
|
-
if (mode !==
|
|
13211
|
+
if (mode !== 2 && mode !== 1) {
|
|
13206
13212
|
const shouldCondense = context.options.whitespace !== "preserve";
|
|
13207
13213
|
for (let i = 0; i < nodes.length; i++) {
|
|
13208
13214
|
const node = nodes[i];
|
|
13209
|
-
if (node.type ===
|
|
13215
|
+
if (node.type === 2) {
|
|
13210
13216
|
if (!context.inPre) {
|
|
13211
13217
|
if (!/[^\t\r\n\f ]/.test(node.content)) {
|
|
13212
13218
|
const prev = nodes[i - 1];
|
|
13213
13219
|
const next = nodes[i + 1];
|
|
13214
|
-
if (!prev || !next || shouldCondense && (prev.type ===
|
|
13220
|
+
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))) {
|
|
13215
13221
|
removedWhitespace = true;
|
|
13216
13222
|
nodes[i] = null;
|
|
13217
13223
|
} else {
|
|
@@ -13223,14 +13229,14 @@ function parseChildren(context, mode, ancestors) {
|
|
|
13223
13229
|
} else {
|
|
13224
13230
|
node.content = node.content.replace(/\r\n/g, "\n");
|
|
13225
13231
|
}
|
|
13226
|
-
} else if (node.type ===
|
|
13232
|
+
} else if (node.type === 3 && !context.options.comments) {
|
|
13227
13233
|
removedWhitespace = true;
|
|
13228
13234
|
nodes[i] = null;
|
|
13229
13235
|
}
|
|
13230
13236
|
}
|
|
13231
13237
|
if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
|
|
13232
13238
|
const first = nodes[0];
|
|
13233
|
-
if (first && first.type ===
|
|
13239
|
+
if (first && first.type === 2) {
|
|
13234
13240
|
first.content = first.content.replace(/^\r?\n/, "");
|
|
13235
13241
|
}
|
|
13236
13242
|
}
|
|
@@ -13238,9 +13244,9 @@ function parseChildren(context, mode, ancestors) {
|
|
|
13238
13244
|
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
13239
13245
|
}
|
|
13240
13246
|
function pushNode(nodes, node) {
|
|
13241
|
-
if (node.type ===
|
|
13247
|
+
if (node.type === 2) {
|
|
13242
13248
|
const prev = last(nodes);
|
|
13243
|
-
if (prev && prev.type ===
|
|
13249
|
+
if (prev && prev.type === 2 && prev.loc.end.offset === node.loc.start.offset) {
|
|
13244
13250
|
prev.content += node.content;
|
|
13245
13251
|
prev.loc.end = node.loc.end;
|
|
13246
13252
|
prev.loc.source += node.loc.source;
|
|
@@ -13251,9 +13257,9 @@ function pushNode(nodes, node) {
|
|
|
13251
13257
|
}
|
|
13252
13258
|
function parseCDATA(context, ancestors) {
|
|
13253
13259
|
advanceBy(context, 9);
|
|
13254
|
-
const nodes = parseChildren(context,
|
|
13260
|
+
const nodes = parseChildren(context, 3, ancestors);
|
|
13255
13261
|
if (context.source.length === 0) {
|
|
13256
|
-
emitError(context,
|
|
13262
|
+
emitError(context, 6);
|
|
13257
13263
|
} else {
|
|
13258
13264
|
advanceBy(context, 3);
|
|
13259
13265
|
}
|
|
@@ -13266,13 +13272,13 @@ function parseComment(context) {
|
|
|
13266
13272
|
if (!match) {
|
|
13267
13273
|
content = context.source.slice(4);
|
|
13268
13274
|
advanceBy(context, context.source.length);
|
|
13269
|
-
emitError(context,
|
|
13275
|
+
emitError(context, 7);
|
|
13270
13276
|
} else {
|
|
13271
13277
|
if (match.index <= 3) {
|
|
13272
|
-
emitError(context,
|
|
13278
|
+
emitError(context, 0);
|
|
13273
13279
|
}
|
|
13274
13280
|
if (match[1]) {
|
|
13275
|
-
emitError(context,
|
|
13281
|
+
emitError(context, 10);
|
|
13276
13282
|
}
|
|
13277
13283
|
content = context.source.slice(4, match.index);
|
|
13278
13284
|
const s = context.source.slice(0, match.index);
|
|
@@ -13280,14 +13286,14 @@ function parseComment(context) {
|
|
|
13280
13286
|
while ((nestedIndex = s.indexOf("<!--", prevIndex)) !== -1) {
|
|
13281
13287
|
advanceBy(context, nestedIndex - prevIndex + 1);
|
|
13282
13288
|
if (nestedIndex + 4 < s.length) {
|
|
13283
|
-
emitError(context,
|
|
13289
|
+
emitError(context, 16);
|
|
13284
13290
|
}
|
|
13285
13291
|
prevIndex = nestedIndex + 1;
|
|
13286
13292
|
}
|
|
13287
13293
|
advanceBy(context, match.index + match[0].length - prevIndex + 1);
|
|
13288
13294
|
}
|
|
13289
13295
|
return {
|
|
13290
|
-
type:
|
|
13296
|
+
type: 3,
|
|
13291
13297
|
content,
|
|
13292
13298
|
loc: getSelection(context, start)
|
|
13293
13299
|
};
|
|
@@ -13305,7 +13311,7 @@ function parseBogusComment(context) {
|
|
|
13305
13311
|
advanceBy(context, closeIndex + 1);
|
|
13306
13312
|
}
|
|
13307
13313
|
return {
|
|
13308
|
-
type:
|
|
13314
|
+
type: 3,
|
|
13309
13315
|
content,
|
|
13310
13316
|
loc: getSelection(context, start)
|
|
13311
13317
|
};
|
|
@@ -13332,7 +13338,7 @@ function parseElement(context, ancestors) {
|
|
|
13332
13338
|
ancestors.pop();
|
|
13333
13339
|
{
|
|
13334
13340
|
const inlineTemplateProp = element.props.find(
|
|
13335
|
-
(p) => p.type ===
|
|
13341
|
+
(p) => p.type === 6 && p.name === "inline-template"
|
|
13336
13342
|
);
|
|
13337
13343
|
if (inlineTemplateProp && checkCompatEnabled(
|
|
13338
13344
|
"COMPILER_INLINE_TEMPLATE",
|
|
@@ -13341,7 +13347,7 @@ function parseElement(context, ancestors) {
|
|
|
13341
13347
|
)) {
|
|
13342
13348
|
const loc = getSelection(context, element.loc.end);
|
|
13343
13349
|
inlineTemplateProp.value = {
|
|
13344
|
-
type:
|
|
13350
|
+
type: 2,
|
|
13345
13351
|
content: loc.source,
|
|
13346
13352
|
loc
|
|
13347
13353
|
};
|
|
@@ -13351,11 +13357,11 @@ function parseElement(context, ancestors) {
|
|
|
13351
13357
|
if (startsWithEndTagOpen(context.source, element.tag)) {
|
|
13352
13358
|
parseTag(context, TagType.End, parent);
|
|
13353
13359
|
} else {
|
|
13354
|
-
emitError(context,
|
|
13360
|
+
emitError(context, 24, 0, element.loc.start);
|
|
13355
13361
|
if (context.source.length === 0 && element.tag.toLowerCase() === "script") {
|
|
13356
13362
|
const first = children[0];
|
|
13357
13363
|
if (first && startsWith(first.loc.source, "<!--")) {
|
|
13358
|
-
emitError(context,
|
|
13364
|
+
emitError(context, 8);
|
|
13359
13365
|
}
|
|
13360
13366
|
}
|
|
13361
13367
|
}
|
|
@@ -13389,7 +13395,7 @@ function parseTag(context, type, parent) {
|
|
|
13389
13395
|
context.inPre = true;
|
|
13390
13396
|
}
|
|
13391
13397
|
let props = parseAttributes(context, type);
|
|
13392
|
-
if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type ===
|
|
13398
|
+
if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type === 7 && p.name === "pre")) {
|
|
13393
13399
|
context.inVPre = true;
|
|
13394
13400
|
extend(context, cursor);
|
|
13395
13401
|
context.source = currentSource;
|
|
@@ -13397,11 +13403,11 @@ function parseTag(context, type, parent) {
|
|
|
13397
13403
|
}
|
|
13398
13404
|
let isSelfClosing = false;
|
|
13399
13405
|
if (context.source.length === 0) {
|
|
13400
|
-
emitError(context,
|
|
13406
|
+
emitError(context, 9);
|
|
13401
13407
|
} else {
|
|
13402
13408
|
isSelfClosing = startsWith(context.source, "/>");
|
|
13403
13409
|
if (type === 1 /* End */ && isSelfClosing) {
|
|
13404
|
-
emitError(context,
|
|
13410
|
+
emitError(context, 4);
|
|
13405
13411
|
}
|
|
13406
13412
|
advanceBy(context, isSelfClosing ? 2 : 1);
|
|
13407
13413
|
}
|
|
@@ -13416,7 +13422,7 @@ function parseTag(context, type, parent) {
|
|
|
13416
13422
|
let hasFor = false;
|
|
13417
13423
|
for (let i = 0; i < props.length; i++) {
|
|
13418
13424
|
const p = props[i];
|
|
13419
|
-
if (p.type ===
|
|
13425
|
+
if (p.type === 7) {
|
|
13420
13426
|
if (p.name === "if") {
|
|
13421
13427
|
hasIf = true;
|
|
13422
13428
|
} else if (p.name === "for") {
|
|
@@ -13433,22 +13439,22 @@ function parseTag(context, type, parent) {
|
|
|
13433
13439
|
}
|
|
13434
13440
|
}
|
|
13435
13441
|
}
|
|
13436
|
-
let tagType =
|
|
13442
|
+
let tagType = 0;
|
|
13437
13443
|
if (!context.inVPre) {
|
|
13438
13444
|
if (tag === "slot") {
|
|
13439
|
-
tagType =
|
|
13445
|
+
tagType = 2;
|
|
13440
13446
|
} else if (tag === "template") {
|
|
13441
13447
|
if (props.some(
|
|
13442
|
-
(p) => p.type ===
|
|
13448
|
+
(p) => p.type === 7 && isSpecialTemplateDirective(p.name)
|
|
13443
13449
|
)) {
|
|
13444
|
-
tagType =
|
|
13450
|
+
tagType = 3;
|
|
13445
13451
|
}
|
|
13446
13452
|
} else if (isComponent(tag, props, context)) {
|
|
13447
|
-
tagType =
|
|
13453
|
+
tagType = 1;
|
|
13448
13454
|
}
|
|
13449
13455
|
}
|
|
13450
13456
|
return {
|
|
13451
|
-
type:
|
|
13457
|
+
type: 1,
|
|
13452
13458
|
ns,
|
|
13453
13459
|
tag,
|
|
13454
13460
|
tagType,
|
|
@@ -13470,7 +13476,7 @@ function isComponent(tag, props, context) {
|
|
|
13470
13476
|
}
|
|
13471
13477
|
for (let i = 0; i < props.length; i++) {
|
|
13472
13478
|
const p = props[i];
|
|
13473
|
-
if (p.type ===
|
|
13479
|
+
if (p.type === 6) {
|
|
13474
13480
|
if (p.name === "is" && p.value) {
|
|
13475
13481
|
if (p.value.content.startsWith("vue:")) {
|
|
13476
13482
|
return true;
|
|
@@ -13503,23 +13509,23 @@ function parseAttributes(context, type) {
|
|
|
13503
13509
|
const attributeNames = /* @__PURE__ */ new Set();
|
|
13504
13510
|
while (context.source.length > 0 && !startsWith(context.source, ">") && !startsWith(context.source, "/>")) {
|
|
13505
13511
|
if (startsWith(context.source, "/")) {
|
|
13506
|
-
emitError(context,
|
|
13512
|
+
emitError(context, 22);
|
|
13507
13513
|
advanceBy(context, 1);
|
|
13508
13514
|
advanceSpaces(context);
|
|
13509
13515
|
continue;
|
|
13510
13516
|
}
|
|
13511
13517
|
if (type === 1 /* End */) {
|
|
13512
|
-
emitError(context,
|
|
13518
|
+
emitError(context, 3);
|
|
13513
13519
|
}
|
|
13514
13520
|
const attr = parseAttribute(context, attributeNames);
|
|
13515
|
-
if (attr.type ===
|
|
13521
|
+
if (attr.type === 6 && attr.value && attr.name === "class") {
|
|
13516
13522
|
attr.value.content = attr.value.content.replace(/\s+/g, " ").trim();
|
|
13517
13523
|
}
|
|
13518
13524
|
if (type === 0 /* Start */) {
|
|
13519
13525
|
props.push(attr);
|
|
13520
13526
|
}
|
|
13521
13527
|
if (/^[^\t\r\n\f />]/.test(context.source)) {
|
|
13522
|
-
emitError(context,
|
|
13528
|
+
emitError(context, 15);
|
|
13523
13529
|
}
|
|
13524
13530
|
advanceSpaces(context);
|
|
13525
13531
|
}
|
|
@@ -13530,11 +13536,11 @@ function parseAttribute(context, nameSet) {
|
|
|
13530
13536
|
const match = /^[^\t\r\n\f />][^\t\r\n\f />=]*/.exec(context.source);
|
|
13531
13537
|
const name = match[0];
|
|
13532
13538
|
if (nameSet.has(name)) {
|
|
13533
|
-
emitError(context,
|
|
13539
|
+
emitError(context, 2);
|
|
13534
13540
|
}
|
|
13535
13541
|
nameSet.add(name);
|
|
13536
13542
|
if (name[0] === "=") {
|
|
13537
|
-
emitError(context,
|
|
13543
|
+
emitError(context, 19);
|
|
13538
13544
|
}
|
|
13539
13545
|
{
|
|
13540
13546
|
const pattern = /["'<]/g;
|
|
@@ -13542,7 +13548,7 @@ function parseAttribute(context, nameSet) {
|
|
|
13542
13548
|
while (m = pattern.exec(name)) {
|
|
13543
13549
|
emitError(
|
|
13544
13550
|
context,
|
|
13545
|
-
|
|
13551
|
+
17,
|
|
13546
13552
|
m.index
|
|
13547
13553
|
);
|
|
13548
13554
|
}
|
|
@@ -13555,7 +13561,7 @@ function parseAttribute(context, nameSet) {
|
|
|
13555
13561
|
advanceSpaces(context);
|
|
13556
13562
|
value = parseAttributeValue(context);
|
|
13557
13563
|
if (!value) {
|
|
13558
|
-
emitError(context,
|
|
13564
|
+
emitError(context, 13);
|
|
13559
13565
|
}
|
|
13560
13566
|
}
|
|
13561
13567
|
const loc = getSelection(context, start);
|
|
@@ -13585,7 +13591,7 @@ function parseAttribute(context, nameSet) {
|
|
|
13585
13591
|
if (!content.endsWith("]")) {
|
|
13586
13592
|
emitError(
|
|
13587
13593
|
context,
|
|
13588
|
-
|
|
13594
|
+
27
|
|
13589
13595
|
);
|
|
13590
13596
|
content = content.slice(1);
|
|
13591
13597
|
} else {
|
|
@@ -13595,10 +13601,10 @@ function parseAttribute(context, nameSet) {
|
|
|
13595
13601
|
content += match2[3] || "";
|
|
13596
13602
|
}
|
|
13597
13603
|
arg = {
|
|
13598
|
-
type:
|
|
13604
|
+
type: 4,
|
|
13599
13605
|
content,
|
|
13600
13606
|
isStatic,
|
|
13601
|
-
constType: isStatic ?
|
|
13607
|
+
constType: isStatic ? 3 : 0,
|
|
13602
13608
|
loc: loc2
|
|
13603
13609
|
};
|
|
13604
13610
|
}
|
|
@@ -13631,10 +13637,10 @@ function parseAttribute(context, nameSet) {
|
|
|
13631
13637
|
}
|
|
13632
13638
|
}
|
|
13633
13639
|
return {
|
|
13634
|
-
type:
|
|
13640
|
+
type: 7,
|
|
13635
13641
|
name: dirName,
|
|
13636
13642
|
exp: value && {
|
|
13637
|
-
type:
|
|
13643
|
+
type: 4,
|
|
13638
13644
|
content: value.content,
|
|
13639
13645
|
isStatic: false,
|
|
13640
13646
|
// Treat as non-constant by default. This can be potentially set to
|
|
@@ -13648,13 +13654,13 @@ function parseAttribute(context, nameSet) {
|
|
|
13648
13654
|
};
|
|
13649
13655
|
}
|
|
13650
13656
|
if (!context.inVPre && startsWith(name, "v-")) {
|
|
13651
|
-
emitError(context,
|
|
13657
|
+
emitError(context, 26);
|
|
13652
13658
|
}
|
|
13653
13659
|
return {
|
|
13654
|
-
type:
|
|
13660
|
+
type: 6,
|
|
13655
13661
|
name,
|
|
13656
13662
|
value: value && {
|
|
13657
|
-
type:
|
|
13663
|
+
type: 2,
|
|
13658
13664
|
content: value.content,
|
|
13659
13665
|
loc: value.loc
|
|
13660
13666
|
},
|
|
@@ -13673,10 +13679,10 @@ function parseAttributeValue(context) {
|
|
|
13673
13679
|
content = parseTextData(
|
|
13674
13680
|
context,
|
|
13675
13681
|
context.source.length,
|
|
13676
|
-
|
|
13682
|
+
4
|
|
13677
13683
|
);
|
|
13678
13684
|
} else {
|
|
13679
|
-
content = parseTextData(context, endIndex,
|
|
13685
|
+
content = parseTextData(context, endIndex, 4);
|
|
13680
13686
|
advanceBy(context, 1);
|
|
13681
13687
|
}
|
|
13682
13688
|
} else {
|
|
@@ -13689,11 +13695,11 @@ function parseAttributeValue(context) {
|
|
|
13689
13695
|
while (m = unexpectedChars.exec(match[0])) {
|
|
13690
13696
|
emitError(
|
|
13691
13697
|
context,
|
|
13692
|
-
|
|
13698
|
+
18,
|
|
13693
13699
|
m.index
|
|
13694
13700
|
);
|
|
13695
13701
|
}
|
|
13696
|
-
content = parseTextData(context, match[0].length,
|
|
13702
|
+
content = parseTextData(context, match[0].length, 4);
|
|
13697
13703
|
}
|
|
13698
13704
|
return { content, isQuoted, loc: getSelection(context, start) };
|
|
13699
13705
|
}
|
|
@@ -13701,7 +13707,7 @@ function parseInterpolation(context, mode) {
|
|
|
13701
13707
|
const [open, close] = context.options.delimiters;
|
|
13702
13708
|
const closeIndex = context.source.indexOf(close, open.length);
|
|
13703
13709
|
if (closeIndex === -1) {
|
|
13704
|
-
emitError(context,
|
|
13710
|
+
emitError(context, 25);
|
|
13705
13711
|
return void 0;
|
|
13706
13712
|
}
|
|
13707
13713
|
const start = getCursor(context);
|
|
@@ -13720,9 +13726,9 @@ function parseInterpolation(context, mode) {
|
|
|
13720
13726
|
advancePositionWithMutation(innerEnd, rawContent, endOffset);
|
|
13721
13727
|
advanceBy(context, close.length);
|
|
13722
13728
|
return {
|
|
13723
|
-
type:
|
|
13729
|
+
type: 5,
|
|
13724
13730
|
content: {
|
|
13725
|
-
type:
|
|
13731
|
+
type: 4,
|
|
13726
13732
|
isStatic: false,
|
|
13727
13733
|
// Set `isConstant` to false by default and will decide in transformExpression
|
|
13728
13734
|
constType: 0,
|
|
@@ -13733,7 +13739,7 @@ function parseInterpolation(context, mode) {
|
|
|
13733
13739
|
};
|
|
13734
13740
|
}
|
|
13735
13741
|
function parseText(context, mode) {
|
|
13736
|
-
const endTokens = mode ===
|
|
13742
|
+
const endTokens = mode === 3 ? ["]]>"] : ["<", context.options.delimiters[0]];
|
|
13737
13743
|
let endIndex = context.source.length;
|
|
13738
13744
|
for (let i = 0; i < endTokens.length; i++) {
|
|
13739
13745
|
const index = context.source.indexOf(endTokens[i], 1);
|
|
@@ -13744,7 +13750,7 @@ function parseText(context, mode) {
|
|
|
13744
13750
|
const start = getCursor(context);
|
|
13745
13751
|
const content = parseTextData(context, endIndex, mode);
|
|
13746
13752
|
return {
|
|
13747
|
-
type:
|
|
13753
|
+
type: 2,
|
|
13748
13754
|
content,
|
|
13749
13755
|
loc: getSelection(context, start)
|
|
13750
13756
|
};
|
|
@@ -13752,12 +13758,12 @@ function parseText(context, mode) {
|
|
|
13752
13758
|
function parseTextData(context, length, mode) {
|
|
13753
13759
|
const rawText = context.source.slice(0, length);
|
|
13754
13760
|
advanceBy(context, length);
|
|
13755
|
-
if (mode ===
|
|
13761
|
+
if (mode === 2 || mode === 3 || !rawText.includes("&")) {
|
|
13756
13762
|
return rawText;
|
|
13757
13763
|
} else {
|
|
13758
13764
|
return context.options.decodeEntities(
|
|
13759
13765
|
rawText,
|
|
13760
|
-
mode ===
|
|
13766
|
+
mode === 4
|
|
13761
13767
|
);
|
|
13762
13768
|
}
|
|
13763
13769
|
}
|
|
@@ -13813,7 +13819,7 @@ function emitError(context, code, offset, loc = getCursor(context)) {
|
|
|
13813
13819
|
function isEnd(context, mode, ancestors) {
|
|
13814
13820
|
const s = context.source;
|
|
13815
13821
|
switch (mode) {
|
|
13816
|
-
case
|
|
13822
|
+
case 0:
|
|
13817
13823
|
if (startsWith(s, "</")) {
|
|
13818
13824
|
for (let i = ancestors.length - 1; i >= 0; --i) {
|
|
13819
13825
|
if (startsWithEndTagOpen(s, ancestors[i].tag)) {
|
|
@@ -13822,15 +13828,15 @@ function isEnd(context, mode, ancestors) {
|
|
|
13822
13828
|
}
|
|
13823
13829
|
}
|
|
13824
13830
|
break;
|
|
13825
|
-
case
|
|
13826
|
-
case
|
|
13831
|
+
case 1:
|
|
13832
|
+
case 2: {
|
|
13827
13833
|
const parent = last(ancestors);
|
|
13828
13834
|
if (parent && startsWithEndTagOpen(s, parent.tag)) {
|
|
13829
13835
|
return true;
|
|
13830
13836
|
}
|
|
13831
13837
|
break;
|
|
13832
13838
|
}
|
|
13833
|
-
case
|
|
13839
|
+
case 3:
|
|
13834
13840
|
if (startsWith(s, "]]>")) {
|
|
13835
13841
|
return true;
|
|
13836
13842
|
}
|
|
@@ -13853,7 +13859,7 @@ function hoistStatic(root, context) {
|
|
|
13853
13859
|
}
|
|
13854
13860
|
function isSingleElementRoot(root, child) {
|
|
13855
13861
|
const { children } = root;
|
|
13856
|
-
return children.length === 1 && child.type ===
|
|
13862
|
+
return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
|
|
13857
13863
|
}
|
|
13858
13864
|
function walk(node, context, doNotHoistNode = false) {
|
|
13859
13865
|
const { children } = node;
|
|
@@ -13861,10 +13867,10 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
13861
13867
|
let hoistedCount = 0;
|
|
13862
13868
|
for (let i = 0; i < children.length; i++) {
|
|
13863
13869
|
const child = children[i];
|
|
13864
|
-
if (child.type ===
|
|
13870
|
+
if (child.type === 1 && child.tagType === 0) {
|
|
13865
13871
|
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
13866
13872
|
if (constantType > 0) {
|
|
13867
|
-
if (constantType >=
|
|
13873
|
+
if (constantType >= 2) {
|
|
13868
13874
|
child.codegenNode.patchFlag = -1 + (` /* HOISTED */` );
|
|
13869
13875
|
child.codegenNode = context.hoist(child.codegenNode);
|
|
13870
13876
|
hoistedCount++;
|
|
@@ -13872,9 +13878,9 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
13872
13878
|
}
|
|
13873
13879
|
} else {
|
|
13874
13880
|
const codegenNode = child.codegenNode;
|
|
13875
|
-
if (codegenNode.type ===
|
|
13881
|
+
if (codegenNode.type === 13) {
|
|
13876
13882
|
const flag = getPatchFlag(codegenNode);
|
|
13877
|
-
if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >=
|
|
13883
|
+
if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
|
|
13878
13884
|
const props = getNodeProps(child);
|
|
13879
13885
|
if (props) {
|
|
13880
13886
|
codegenNode.props = context.hoist(props);
|
|
@@ -13886,8 +13892,8 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
13886
13892
|
}
|
|
13887
13893
|
}
|
|
13888
13894
|
}
|
|
13889
|
-
if (child.type ===
|
|
13890
|
-
const isComponent = child.tagType ===
|
|
13895
|
+
if (child.type === 1) {
|
|
13896
|
+
const isComponent = child.tagType === 1;
|
|
13891
13897
|
if (isComponent) {
|
|
13892
13898
|
context.scopes.vSlot++;
|
|
13893
13899
|
}
|
|
@@ -13895,9 +13901,9 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
13895
13901
|
if (isComponent) {
|
|
13896
13902
|
context.scopes.vSlot--;
|
|
13897
13903
|
}
|
|
13898
|
-
} else if (child.type ===
|
|
13904
|
+
} else if (child.type === 11) {
|
|
13899
13905
|
walk(child, context, child.children.length === 1);
|
|
13900
|
-
} else if (child.type ===
|
|
13906
|
+
} else if (child.type === 9) {
|
|
13901
13907
|
for (let i2 = 0; i2 < child.branches.length; i2++) {
|
|
13902
13908
|
walk(
|
|
13903
13909
|
child.branches[i2],
|
|
@@ -13910,7 +13916,7 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
13910
13916
|
if (hoistedCount && context.transformHoist) {
|
|
13911
13917
|
context.transformHoist(children, context, node);
|
|
13912
13918
|
}
|
|
13913
|
-
if (hoistedCount && hoistedCount === originalCount && node.type ===
|
|
13919
|
+
if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
|
|
13914
13920
|
node.codegenNode.children = context.hoist(
|
|
13915
13921
|
createArrayExpression(node.codegenNode.children)
|
|
13916
13922
|
);
|
|
@@ -13919,8 +13925,8 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
13919
13925
|
function getConstantType(node, context) {
|
|
13920
13926
|
const { constantCache } = context;
|
|
13921
13927
|
switch (node.type) {
|
|
13922
|
-
case
|
|
13923
|
-
if (node.tagType !==
|
|
13928
|
+
case 1:
|
|
13929
|
+
if (node.tagType !== 0) {
|
|
13924
13930
|
return 0;
|
|
13925
13931
|
}
|
|
13926
13932
|
const cached = constantCache.get(node);
|
|
@@ -13928,7 +13934,7 @@ function getConstantType(node, context) {
|
|
|
13928
13934
|
return cached;
|
|
13929
13935
|
}
|
|
13930
13936
|
const codegenNode = node.codegenNode;
|
|
13931
|
-
if (codegenNode.type !==
|
|
13937
|
+
if (codegenNode.type !== 13) {
|
|
13932
13938
|
return 0;
|
|
13933
13939
|
}
|
|
13934
13940
|
if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
|
|
@@ -13936,7 +13942,7 @@ function getConstantType(node, context) {
|
|
|
13936
13942
|
}
|
|
13937
13943
|
const flag = getPatchFlag(codegenNode);
|
|
13938
13944
|
if (!flag) {
|
|
13939
|
-
let returnType2 =
|
|
13945
|
+
let returnType2 = 3;
|
|
13940
13946
|
const generatedPropsType = getGeneratedPropsConstantType(node, context);
|
|
13941
13947
|
if (generatedPropsType === 0) {
|
|
13942
13948
|
constantCache.set(node, 0);
|
|
@@ -13955,10 +13961,10 @@ function getConstantType(node, context) {
|
|
|
13955
13961
|
returnType2 = childType;
|
|
13956
13962
|
}
|
|
13957
13963
|
}
|
|
13958
|
-
if (returnType2 >
|
|
13964
|
+
if (returnType2 > 1) {
|
|
13959
13965
|
for (let i = 0; i < node.props.length; i++) {
|
|
13960
13966
|
const p = node.props[i];
|
|
13961
|
-
if (p.type ===
|
|
13967
|
+
if (p.type === 7 && p.name === "bind" && p.exp) {
|
|
13962
13968
|
const expType = getConstantType(p.exp, context);
|
|
13963
13969
|
if (expType === 0) {
|
|
13964
13970
|
constantCache.set(node, 0);
|
|
@@ -13973,7 +13979,7 @@ function getConstantType(node, context) {
|
|
|
13973
13979
|
if (codegenNode.isBlock) {
|
|
13974
13980
|
for (let i = 0; i < node.props.length; i++) {
|
|
13975
13981
|
const p = node.props[i];
|
|
13976
|
-
if (p.type ===
|
|
13982
|
+
if (p.type === 7) {
|
|
13977
13983
|
constantCache.set(node, 0);
|
|
13978
13984
|
return 0;
|
|
13979
13985
|
}
|
|
@@ -13991,20 +13997,20 @@ function getConstantType(node, context) {
|
|
|
13991
13997
|
constantCache.set(node, 0);
|
|
13992
13998
|
return 0;
|
|
13993
13999
|
}
|
|
13994
|
-
case
|
|
13995
|
-
case
|
|
13996
|
-
return
|
|
13997
|
-
case
|
|
13998
|
-
case
|
|
13999
|
-
case
|
|
14000
|
+
case 2:
|
|
14001
|
+
case 3:
|
|
14002
|
+
return 3;
|
|
14003
|
+
case 9:
|
|
14004
|
+
case 11:
|
|
14005
|
+
case 10:
|
|
14000
14006
|
return 0;
|
|
14001
|
-
case
|
|
14002
|
-
case
|
|
14007
|
+
case 5:
|
|
14008
|
+
case 12:
|
|
14003
14009
|
return getConstantType(node.content, context);
|
|
14004
|
-
case
|
|
14010
|
+
case 4:
|
|
14005
14011
|
return node.constType;
|
|
14006
|
-
case
|
|
14007
|
-
let returnType =
|
|
14012
|
+
case 8:
|
|
14013
|
+
let returnType = 3;
|
|
14008
14014
|
for (let i = 0; i < node.children.length; i++) {
|
|
14009
14015
|
const child = node.children[i];
|
|
14010
14016
|
if (isString(child) || isSymbol(child)) {
|
|
@@ -14029,20 +14035,20 @@ const allowHoistedHelperSet = /* @__PURE__ */ new Set([
|
|
|
14029
14035
|
GUARD_REACTIVE_PROPS
|
|
14030
14036
|
]);
|
|
14031
14037
|
function getConstantTypeOfHelperCall(value, context) {
|
|
14032
|
-
if (value.type ===
|
|
14038
|
+
if (value.type === 14 && !isString(value.callee) && allowHoistedHelperSet.has(value.callee)) {
|
|
14033
14039
|
const arg = value.arguments[0];
|
|
14034
|
-
if (arg.type ===
|
|
14040
|
+
if (arg.type === 4) {
|
|
14035
14041
|
return getConstantType(arg, context);
|
|
14036
|
-
} else if (arg.type ===
|
|
14042
|
+
} else if (arg.type === 14) {
|
|
14037
14043
|
return getConstantTypeOfHelperCall(arg, context);
|
|
14038
14044
|
}
|
|
14039
14045
|
}
|
|
14040
14046
|
return 0;
|
|
14041
14047
|
}
|
|
14042
14048
|
function getGeneratedPropsConstantType(node, context) {
|
|
14043
|
-
let returnType =
|
|
14049
|
+
let returnType = 3;
|
|
14044
14050
|
const props = getNodeProps(node);
|
|
14045
|
-
if (props && props.type ===
|
|
14051
|
+
if (props && props.type === 15) {
|
|
14046
14052
|
const { properties } = props;
|
|
14047
14053
|
for (let i = 0; i < properties.length; i++) {
|
|
14048
14054
|
const { key, value } = properties[i];
|
|
@@ -14054,9 +14060,9 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
14054
14060
|
returnType = keyType;
|
|
14055
14061
|
}
|
|
14056
14062
|
let valueType;
|
|
14057
|
-
if (value.type ===
|
|
14063
|
+
if (value.type === 4) {
|
|
14058
14064
|
valueType = getConstantType(value, context);
|
|
14059
|
-
} else if (value.type ===
|
|
14065
|
+
} else if (value.type === 14) {
|
|
14060
14066
|
valueType = getConstantTypeOfHelperCall(value, context);
|
|
14061
14067
|
} else {
|
|
14062
14068
|
valueType = 0;
|
|
@@ -14073,7 +14079,7 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
14073
14079
|
}
|
|
14074
14080
|
function getNodeProps(node) {
|
|
14075
14081
|
const codegenNode = node.codegenNode;
|
|
14076
|
-
if (codegenNode.type ===
|
|
14082
|
+
if (codegenNode.type === 13) {
|
|
14077
14083
|
return codegenNode.props;
|
|
14078
14084
|
}
|
|
14079
14085
|
}
|
|
@@ -14215,7 +14221,7 @@ function createTransformContext(root, {
|
|
|
14215
14221
|
`_hoisted_${context.hoists.length}`,
|
|
14216
14222
|
false,
|
|
14217
14223
|
exp.loc,
|
|
14218
|
-
|
|
14224
|
+
2
|
|
14219
14225
|
);
|
|
14220
14226
|
identifier.hoisted = exp;
|
|
14221
14227
|
return identifier;
|
|
@@ -14256,8 +14262,8 @@ function createRootCodegen(root, context) {
|
|
|
14256
14262
|
const child = children[0];
|
|
14257
14263
|
if (isSingleElementRoot(root, child) && child.codegenNode) {
|
|
14258
14264
|
const codegenNode = child.codegenNode;
|
|
14259
|
-
if (codegenNode.type ===
|
|
14260
|
-
|
|
14265
|
+
if (codegenNode.type === 13) {
|
|
14266
|
+
convertToBlock(codegenNode, context);
|
|
14261
14267
|
}
|
|
14262
14268
|
root.codegenNode = codegenNode;
|
|
14263
14269
|
} else {
|
|
@@ -14266,7 +14272,7 @@ function createRootCodegen(root, context) {
|
|
|
14266
14272
|
} else if (children.length > 1) {
|
|
14267
14273
|
let patchFlag = 64;
|
|
14268
14274
|
let patchFlagText = PatchFlagNames[64];
|
|
14269
|
-
if (children.filter((c) => c.type !==
|
|
14275
|
+
if (children.filter((c) => c.type !== 3).length === 1) {
|
|
14270
14276
|
patchFlag |= 2048;
|
|
14271
14277
|
patchFlagText += `, ${PatchFlagNames[2048]}`;
|
|
14272
14278
|
}
|
|
@@ -14320,25 +14326,25 @@ function traverseNode(node, context) {
|
|
|
14320
14326
|
}
|
|
14321
14327
|
}
|
|
14322
14328
|
switch (node.type) {
|
|
14323
|
-
case
|
|
14329
|
+
case 3:
|
|
14324
14330
|
if (!context.ssr) {
|
|
14325
14331
|
context.helper(CREATE_COMMENT);
|
|
14326
14332
|
}
|
|
14327
14333
|
break;
|
|
14328
|
-
case
|
|
14334
|
+
case 5:
|
|
14329
14335
|
if (!context.ssr) {
|
|
14330
14336
|
context.helper(TO_DISPLAY_STRING);
|
|
14331
14337
|
}
|
|
14332
14338
|
break;
|
|
14333
|
-
case
|
|
14339
|
+
case 9:
|
|
14334
14340
|
for (let i2 = 0; i2 < node.branches.length; i2++) {
|
|
14335
14341
|
traverseNode(node.branches[i2], context);
|
|
14336
14342
|
}
|
|
14337
14343
|
break;
|
|
14338
|
-
case
|
|
14339
|
-
case
|
|
14340
|
-
case
|
|
14341
|
-
case
|
|
14344
|
+
case 10:
|
|
14345
|
+
case 11:
|
|
14346
|
+
case 1:
|
|
14347
|
+
case 0:
|
|
14342
14348
|
traverseChildren(node, context);
|
|
14343
14349
|
break;
|
|
14344
14350
|
}
|
|
@@ -14351,15 +14357,15 @@ function traverseNode(node, context) {
|
|
|
14351
14357
|
function createStructuralDirectiveTransform(name, fn) {
|
|
14352
14358
|
const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
|
|
14353
14359
|
return (node, context) => {
|
|
14354
|
-
if (node.type ===
|
|
14360
|
+
if (node.type === 1) {
|
|
14355
14361
|
const { props } = node;
|
|
14356
|
-
if (node.tagType ===
|
|
14362
|
+
if (node.tagType === 3 && props.some(isVSlot)) {
|
|
14357
14363
|
return;
|
|
14358
14364
|
}
|
|
14359
14365
|
const exitFns = [];
|
|
14360
14366
|
for (let i = 0; i < props.length; i++) {
|
|
14361
14367
|
const prop = props[i];
|
|
14362
|
-
if (prop.type ===
|
|
14368
|
+
if (prop.type === 7 && matches(prop.name)) {
|
|
14363
14369
|
props.splice(i, 1);
|
|
14364
14370
|
i--;
|
|
14365
14371
|
const onExit = fn(node, prop, context);
|
|
@@ -14594,7 +14600,7 @@ function genHoists(hoists, context) {
|
|
|
14594
14600
|
context.pure = false;
|
|
14595
14601
|
}
|
|
14596
14602
|
function isText(n) {
|
|
14597
|
-
return isString(n) || n.type ===
|
|
14603
|
+
return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
|
|
14598
14604
|
}
|
|
14599
14605
|
function genNodeListAsArray(nodes, context) {
|
|
14600
14606
|
const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
|
|
@@ -14635,68 +14641,68 @@ function genNode(node, context) {
|
|
|
14635
14641
|
return;
|
|
14636
14642
|
}
|
|
14637
14643
|
switch (node.type) {
|
|
14638
|
-
case
|
|
14639
|
-
case
|
|
14640
|
-
case
|
|
14644
|
+
case 1:
|
|
14645
|
+
case 9:
|
|
14646
|
+
case 11:
|
|
14641
14647
|
assert(
|
|
14642
14648
|
node.codegenNode != null,
|
|
14643
14649
|
`Codegen node is missing for element/if/for node. Apply appropriate transforms first.`
|
|
14644
14650
|
);
|
|
14645
14651
|
genNode(node.codegenNode, context);
|
|
14646
14652
|
break;
|
|
14647
|
-
case
|
|
14653
|
+
case 2:
|
|
14648
14654
|
genText(node, context);
|
|
14649
14655
|
break;
|
|
14650
|
-
case
|
|
14656
|
+
case 4:
|
|
14651
14657
|
genExpression(node, context);
|
|
14652
14658
|
break;
|
|
14653
|
-
case
|
|
14659
|
+
case 5:
|
|
14654
14660
|
genInterpolation(node, context);
|
|
14655
14661
|
break;
|
|
14656
|
-
case
|
|
14662
|
+
case 12:
|
|
14657
14663
|
genNode(node.codegenNode, context);
|
|
14658
14664
|
break;
|
|
14659
|
-
case
|
|
14665
|
+
case 8:
|
|
14660
14666
|
genCompoundExpression(node, context);
|
|
14661
14667
|
break;
|
|
14662
|
-
case
|
|
14668
|
+
case 3:
|
|
14663
14669
|
genComment(node, context);
|
|
14664
14670
|
break;
|
|
14665
|
-
case
|
|
14671
|
+
case 13:
|
|
14666
14672
|
genVNodeCall(node, context);
|
|
14667
14673
|
break;
|
|
14668
|
-
case
|
|
14674
|
+
case 14:
|
|
14669
14675
|
genCallExpression(node, context);
|
|
14670
14676
|
break;
|
|
14671
|
-
case
|
|
14677
|
+
case 15:
|
|
14672
14678
|
genObjectExpression(node, context);
|
|
14673
14679
|
break;
|
|
14674
|
-
case
|
|
14680
|
+
case 17:
|
|
14675
14681
|
genArrayExpression(node, context);
|
|
14676
14682
|
break;
|
|
14677
|
-
case
|
|
14683
|
+
case 18:
|
|
14678
14684
|
genFunctionExpression(node, context);
|
|
14679
14685
|
break;
|
|
14680
|
-
case
|
|
14686
|
+
case 19:
|
|
14681
14687
|
genConditionalExpression(node, context);
|
|
14682
14688
|
break;
|
|
14683
|
-
case
|
|
14689
|
+
case 20:
|
|
14684
14690
|
genCacheExpression(node, context);
|
|
14685
14691
|
break;
|
|
14686
|
-
case
|
|
14692
|
+
case 21:
|
|
14687
14693
|
genNodeList(node.body, context, true, false);
|
|
14688
14694
|
break;
|
|
14689
|
-
case
|
|
14695
|
+
case 22:
|
|
14690
14696
|
break;
|
|
14691
|
-
case
|
|
14697
|
+
case 23:
|
|
14692
14698
|
break;
|
|
14693
|
-
case
|
|
14699
|
+
case 24:
|
|
14694
14700
|
break;
|
|
14695
|
-
case
|
|
14701
|
+
case 25:
|
|
14696
14702
|
break;
|
|
14697
|
-
case
|
|
14703
|
+
case 26:
|
|
14698
14704
|
break;
|
|
14699
|
-
case
|
|
14705
|
+
case 10:
|
|
14700
14706
|
break;
|
|
14701
14707
|
default:
|
|
14702
14708
|
{
|
|
@@ -14733,7 +14739,7 @@ function genCompoundExpression(node, context) {
|
|
|
14733
14739
|
}
|
|
14734
14740
|
function genExpressionAsPropertyKey(node, context) {
|
|
14735
14741
|
const { push } = context;
|
|
14736
|
-
if (node.type ===
|
|
14742
|
+
if (node.type === 8) {
|
|
14737
14743
|
push(`[`);
|
|
14738
14744
|
genCompoundExpression(node, context);
|
|
14739
14745
|
push(`]`);
|
|
@@ -14814,7 +14820,7 @@ function genObjectExpression(node, context) {
|
|
|
14814
14820
|
push(`{}`, node);
|
|
14815
14821
|
return;
|
|
14816
14822
|
}
|
|
14817
|
-
const multilines = properties.length > 1 || properties.some((p) => p.value.type !==
|
|
14823
|
+
const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
|
|
14818
14824
|
push(multilines ? `{` : `{ `);
|
|
14819
14825
|
multilines && indent();
|
|
14820
14826
|
for (let i = 0; i < properties.length; i++) {
|
|
@@ -14876,7 +14882,7 @@ function genFunctionExpression(node, context) {
|
|
|
14876
14882
|
function genConditionalExpression(node, context) {
|
|
14877
14883
|
const { test, consequent, alternate, newline: needNewline } = node;
|
|
14878
14884
|
const { push, indent, deindent, newline } = context;
|
|
14879
|
-
if (test.type ===
|
|
14885
|
+
if (test.type === 4) {
|
|
14880
14886
|
const needsParens = !isSimpleIdentifier(test.content);
|
|
14881
14887
|
needsParens && push(`(`);
|
|
14882
14888
|
genExpression(test, context);
|
|
@@ -14895,7 +14901,7 @@ function genConditionalExpression(node, context) {
|
|
|
14895
14901
|
needNewline && newline();
|
|
14896
14902
|
needNewline || push(` `);
|
|
14897
14903
|
push(`: `);
|
|
14898
|
-
const isNested = alternate.type ===
|
|
14904
|
+
const isNested = alternate.type === 19;
|
|
14899
14905
|
if (!isNested) {
|
|
14900
14906
|
context.indentLevel++;
|
|
14901
14907
|
}
|
|
@@ -14950,7 +14956,7 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
|
|
|
14950
14956
|
}
|
|
14951
14957
|
context.onError(
|
|
14952
14958
|
createCompilerError(
|
|
14953
|
-
|
|
14959
|
+
45,
|
|
14954
14960
|
node.loc,
|
|
14955
14961
|
void 0,
|
|
14956
14962
|
message
|
|
@@ -14960,18 +14966,18 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
|
|
|
14960
14966
|
}
|
|
14961
14967
|
|
|
14962
14968
|
const transformExpression = (node, context) => {
|
|
14963
|
-
if (node.type ===
|
|
14969
|
+
if (node.type === 5) {
|
|
14964
14970
|
node.content = processExpression(
|
|
14965
14971
|
node.content,
|
|
14966
14972
|
context
|
|
14967
14973
|
);
|
|
14968
|
-
} else if (node.type ===
|
|
14974
|
+
} else if (node.type === 1) {
|
|
14969
14975
|
for (let i = 0; i < node.props.length; i++) {
|
|
14970
14976
|
const dir = node.props[i];
|
|
14971
|
-
if (dir.type ===
|
|
14977
|
+
if (dir.type === 7 && dir.name !== "for") {
|
|
14972
14978
|
const exp = dir.exp;
|
|
14973
14979
|
const arg = dir.arg;
|
|
14974
|
-
if (exp && exp.type ===
|
|
14980
|
+
if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
|
|
14975
14981
|
dir.exp = processExpression(
|
|
14976
14982
|
exp,
|
|
14977
14983
|
context,
|
|
@@ -14979,7 +14985,7 @@ const transformExpression = (node, context) => {
|
|
|
14979
14985
|
dir.name === "slot"
|
|
14980
14986
|
);
|
|
14981
14987
|
}
|
|
14982
|
-
if (arg && arg.type ===
|
|
14988
|
+
if (arg && arg.type === 4 && !arg.isStatic) {
|
|
14983
14989
|
dir.arg = processExpression(arg, context);
|
|
14984
14990
|
}
|
|
14985
14991
|
}
|
|
@@ -15004,7 +15010,7 @@ const transformIf = createStructuralDirectiveTransform(
|
|
|
15004
15010
|
let key = 0;
|
|
15005
15011
|
while (i-- >= 0) {
|
|
15006
15012
|
const sibling = siblings[i];
|
|
15007
|
-
if (sibling && sibling.type ===
|
|
15013
|
+
if (sibling && sibling.type === 9) {
|
|
15008
15014
|
key += sibling.branches.length;
|
|
15009
15015
|
}
|
|
15010
15016
|
}
|
|
@@ -15031,7 +15037,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
15031
15037
|
if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) {
|
|
15032
15038
|
const loc = dir.exp ? dir.exp.loc : node.loc;
|
|
15033
15039
|
context.onError(
|
|
15034
|
-
createCompilerError(
|
|
15040
|
+
createCompilerError(28, dir.loc)
|
|
15035
15041
|
);
|
|
15036
15042
|
dir.exp = createSimpleExpression(`true`, false, loc);
|
|
15037
15043
|
}
|
|
@@ -15041,7 +15047,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
15041
15047
|
if (dir.name === "if") {
|
|
15042
15048
|
const branch = createIfBranch(node, dir);
|
|
15043
15049
|
const ifNode = {
|
|
15044
|
-
type:
|
|
15050
|
+
type: 9,
|
|
15045
15051
|
loc: node.loc,
|
|
15046
15052
|
branches: [branch]
|
|
15047
15053
|
};
|
|
@@ -15055,25 +15061,25 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
15055
15061
|
let i = siblings.indexOf(node);
|
|
15056
15062
|
while (i-- >= -1) {
|
|
15057
15063
|
const sibling = siblings[i];
|
|
15058
|
-
if (sibling && sibling.type ===
|
|
15064
|
+
if (sibling && sibling.type === 3) {
|
|
15059
15065
|
context.removeNode(sibling);
|
|
15060
15066
|
comments.unshift(sibling);
|
|
15061
15067
|
continue;
|
|
15062
15068
|
}
|
|
15063
|
-
if (sibling && sibling.type ===
|
|
15069
|
+
if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
|
|
15064
15070
|
context.removeNode(sibling);
|
|
15065
15071
|
continue;
|
|
15066
15072
|
}
|
|
15067
|
-
if (sibling && sibling.type ===
|
|
15073
|
+
if (sibling && sibling.type === 9) {
|
|
15068
15074
|
if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
|
|
15069
15075
|
context.onError(
|
|
15070
|
-
createCompilerError(
|
|
15076
|
+
createCompilerError(30, node.loc)
|
|
15071
15077
|
);
|
|
15072
15078
|
}
|
|
15073
15079
|
context.removeNode();
|
|
15074
15080
|
const branch = createIfBranch(node, dir);
|
|
15075
15081
|
if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
|
|
15076
|
-
!(context.parent && context.parent.type ===
|
|
15082
|
+
!(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
|
|
15077
15083
|
branch.children = [...comments, ...branch.children];
|
|
15078
15084
|
}
|
|
15079
15085
|
{
|
|
@@ -15083,7 +15089,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
15083
15089
|
if (isSameKey(userKey, key)) {
|
|
15084
15090
|
context.onError(
|
|
15085
15091
|
createCompilerError(
|
|
15086
|
-
|
|
15092
|
+
29,
|
|
15087
15093
|
branch.userKey.loc
|
|
15088
15094
|
)
|
|
15089
15095
|
);
|
|
@@ -15099,7 +15105,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
15099
15105
|
context.currentNode = null;
|
|
15100
15106
|
} else {
|
|
15101
15107
|
context.onError(
|
|
15102
|
-
createCompilerError(
|
|
15108
|
+
createCompilerError(30, node.loc)
|
|
15103
15109
|
);
|
|
15104
15110
|
}
|
|
15105
15111
|
break;
|
|
@@ -15107,9 +15113,9 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
15107
15113
|
}
|
|
15108
15114
|
}
|
|
15109
15115
|
function createIfBranch(node, dir) {
|
|
15110
|
-
const isTemplateIf = node.tagType ===
|
|
15116
|
+
const isTemplateIf = node.tagType === 3;
|
|
15111
15117
|
return {
|
|
15112
|
-
type:
|
|
15118
|
+
type: 10,
|
|
15113
15119
|
loc: node.loc,
|
|
15114
15120
|
condition: dir.name === "else" ? void 0 : dir.exp,
|
|
15115
15121
|
children: isTemplateIf && !findDir(node, "for") ? node.children : [node],
|
|
@@ -15141,21 +15147,21 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
15141
15147
|
`${keyIndex}`,
|
|
15142
15148
|
false,
|
|
15143
15149
|
locStub,
|
|
15144
|
-
|
|
15150
|
+
2
|
|
15145
15151
|
)
|
|
15146
15152
|
);
|
|
15147
15153
|
const { children } = branch;
|
|
15148
15154
|
const firstChild = children[0];
|
|
15149
|
-
const needFragmentWrapper = children.length !== 1 || firstChild.type !==
|
|
15155
|
+
const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
|
|
15150
15156
|
if (needFragmentWrapper) {
|
|
15151
|
-
if (children.length === 1 && firstChild.type ===
|
|
15157
|
+
if (children.length === 1 && firstChild.type === 11) {
|
|
15152
15158
|
const vnodeCall = firstChild.codegenNode;
|
|
15153
15159
|
injectProp(vnodeCall, keyProperty, context);
|
|
15154
15160
|
return vnodeCall;
|
|
15155
15161
|
} else {
|
|
15156
15162
|
let patchFlag = 64;
|
|
15157
15163
|
let patchFlagText = PatchFlagNames[64];
|
|
15158
|
-
if (!branch.isTemplateIf && children.filter((c) => c.type !==
|
|
15164
|
+
if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
|
|
15159
15165
|
patchFlag |= 2048;
|
|
15160
15166
|
patchFlagText += `, ${PatchFlagNames[2048]}`;
|
|
15161
15167
|
}
|
|
@@ -15176,8 +15182,8 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
15176
15182
|
} else {
|
|
15177
15183
|
const ret = firstChild.codegenNode;
|
|
15178
15184
|
const vnodeCall = getMemoedVNodeCall(ret);
|
|
15179
|
-
if (vnodeCall.type ===
|
|
15180
|
-
|
|
15185
|
+
if (vnodeCall.type === 13) {
|
|
15186
|
+
convertToBlock(vnodeCall, context);
|
|
15181
15187
|
}
|
|
15182
15188
|
injectProp(vnodeCall, keyProperty, context);
|
|
15183
15189
|
return ret;
|
|
@@ -15187,7 +15193,7 @@ function isSameKey(a, b) {
|
|
|
15187
15193
|
if (!a || a.type !== b.type) {
|
|
15188
15194
|
return false;
|
|
15189
15195
|
}
|
|
15190
|
-
if (a.type ===
|
|
15196
|
+
if (a.type === 6) {
|
|
15191
15197
|
if (a.value.content !== b.value.content) {
|
|
15192
15198
|
return false;
|
|
15193
15199
|
}
|
|
@@ -15197,7 +15203,7 @@ function isSameKey(a, b) {
|
|
|
15197
15203
|
if (exp.type !== branchExp.type) {
|
|
15198
15204
|
return false;
|
|
15199
15205
|
}
|
|
15200
|
-
if (exp.type !==
|
|
15206
|
+
if (exp.type !== 4 || exp.isStatic !== branchExp.isStatic || exp.content !== branchExp.content) {
|
|
15201
15207
|
return false;
|
|
15202
15208
|
}
|
|
15203
15209
|
}
|
|
@@ -15205,13 +15211,13 @@ function isSameKey(a, b) {
|
|
|
15205
15211
|
}
|
|
15206
15212
|
function getParentCondition(node) {
|
|
15207
15213
|
while (true) {
|
|
15208
|
-
if (node.type ===
|
|
15209
|
-
if (node.alternate.type ===
|
|
15214
|
+
if (node.type === 19) {
|
|
15215
|
+
if (node.alternate.type === 19) {
|
|
15210
15216
|
node = node.alternate;
|
|
15211
15217
|
} else {
|
|
15212
15218
|
return node;
|
|
15213
15219
|
}
|
|
15214
|
-
} else if (node.type ===
|
|
15220
|
+
} else if (node.type === 20) {
|
|
15215
15221
|
node = node.value;
|
|
15216
15222
|
}
|
|
15217
15223
|
}
|
|
@@ -15228,9 +15234,9 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
15228
15234
|
const isTemplate = isTemplateNode(node);
|
|
15229
15235
|
const memo = findDir(node, "memo");
|
|
15230
15236
|
const keyProp = findProp(node, `key`);
|
|
15231
|
-
const keyExp = keyProp && (keyProp.type ===
|
|
15237
|
+
const keyExp = keyProp && (keyProp.type === 6 ? createSimpleExpression(keyProp.value.content, true) : keyProp.exp);
|
|
15232
15238
|
const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null;
|
|
15233
|
-
const isStableFragment = forNode.source.type ===
|
|
15239
|
+
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
|
|
15234
15240
|
const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
|
|
15235
15241
|
forNode.codegenNode = createVNodeCall(
|
|
15236
15242
|
context,
|
|
@@ -15250,12 +15256,12 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
15250
15256
|
const { children } = forNode;
|
|
15251
15257
|
if (isTemplate) {
|
|
15252
15258
|
node.children.some((c) => {
|
|
15253
|
-
if (c.type ===
|
|
15259
|
+
if (c.type === 1) {
|
|
15254
15260
|
const key = findProp(c, "key");
|
|
15255
15261
|
if (key) {
|
|
15256
15262
|
context.onError(
|
|
15257
15263
|
createCompilerError(
|
|
15258
|
-
|
|
15264
|
+
33,
|
|
15259
15265
|
key.loc
|
|
15260
15266
|
)
|
|
15261
15267
|
);
|
|
@@ -15264,7 +15270,7 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
15264
15270
|
}
|
|
15265
15271
|
});
|
|
15266
15272
|
}
|
|
15267
|
-
const needFragmentWrapper = children.length !== 1 || children[0].type !==
|
|
15273
|
+
const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
|
|
15268
15274
|
const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
|
|
15269
15275
|
if (slotOutlet) {
|
|
15270
15276
|
childBlock = slotOutlet.codegenNode;
|
|
@@ -15351,7 +15357,7 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
15351
15357
|
function processFor(node, dir, context, processCodegen) {
|
|
15352
15358
|
if (!dir.exp) {
|
|
15353
15359
|
context.onError(
|
|
15354
|
-
createCompilerError(
|
|
15360
|
+
createCompilerError(31, dir.loc)
|
|
15355
15361
|
);
|
|
15356
15362
|
return;
|
|
15357
15363
|
}
|
|
@@ -15363,14 +15369,14 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
15363
15369
|
);
|
|
15364
15370
|
if (!parseResult) {
|
|
15365
15371
|
context.onError(
|
|
15366
|
-
createCompilerError(
|
|
15372
|
+
createCompilerError(32, dir.loc)
|
|
15367
15373
|
);
|
|
15368
15374
|
return;
|
|
15369
15375
|
}
|
|
15370
15376
|
const { addIdentifiers, removeIdentifiers, scopes } = context;
|
|
15371
15377
|
const { source, value, key, index } = parseResult;
|
|
15372
15378
|
const forNode = {
|
|
15373
|
-
type:
|
|
15379
|
+
type: 11,
|
|
15374
15380
|
loc: dir.loc,
|
|
15375
15381
|
source,
|
|
15376
15382
|
valueAlias: value,
|
|
@@ -15483,7 +15489,7 @@ function createParamsList(args) {
|
|
|
15483
15489
|
|
|
15484
15490
|
const defaultFallback = createSimpleExpression(`undefined`, false);
|
|
15485
15491
|
const trackSlotScopes = (node, context) => {
|
|
15486
|
-
if (node.type ===
|
|
15492
|
+
if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
|
|
15487
15493
|
const vSlot = findDir(node, "slot");
|
|
15488
15494
|
if (vSlot) {
|
|
15489
15495
|
vSlot.exp;
|
|
@@ -15529,14 +15535,14 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
15529
15535
|
const slotElement = children[i];
|
|
15530
15536
|
let slotDir;
|
|
15531
15537
|
if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
|
|
15532
|
-
if (slotElement.type !==
|
|
15538
|
+
if (slotElement.type !== 3) {
|
|
15533
15539
|
implicitDefaultChildren.push(slotElement);
|
|
15534
15540
|
}
|
|
15535
15541
|
continue;
|
|
15536
15542
|
}
|
|
15537
15543
|
if (onComponentSlot) {
|
|
15538
15544
|
context.onError(
|
|
15539
|
-
createCompilerError(
|
|
15545
|
+
createCompilerError(37, slotDir.loc)
|
|
15540
15546
|
);
|
|
15541
15547
|
break;
|
|
15542
15548
|
}
|
|
@@ -15576,7 +15582,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
15576
15582
|
let prev;
|
|
15577
15583
|
while (j--) {
|
|
15578
15584
|
prev = children[j];
|
|
15579
|
-
if (prev.type !==
|
|
15585
|
+
if (prev.type !== 3) {
|
|
15580
15586
|
break;
|
|
15581
15587
|
}
|
|
15582
15588
|
}
|
|
@@ -15584,7 +15590,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
15584
15590
|
children.splice(i, 1);
|
|
15585
15591
|
i--;
|
|
15586
15592
|
let conditional = dynamicSlots[dynamicSlots.length - 1];
|
|
15587
|
-
while (conditional.alternate.type ===
|
|
15593
|
+
while (conditional.alternate.type === 19) {
|
|
15588
15594
|
conditional = conditional.alternate;
|
|
15589
15595
|
}
|
|
15590
15596
|
conditional.alternate = vElse.exp ? createConditionalExpression(
|
|
@@ -15598,7 +15604,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
15598
15604
|
) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++);
|
|
15599
15605
|
} else {
|
|
15600
15606
|
context.onError(
|
|
15601
|
-
createCompilerError(
|
|
15607
|
+
createCompilerError(30, vElse.loc)
|
|
15602
15608
|
);
|
|
15603
15609
|
}
|
|
15604
15610
|
} else if (vFor = findDir(slotElement, "for")) {
|
|
@@ -15618,7 +15624,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
15618
15624
|
);
|
|
15619
15625
|
} else {
|
|
15620
15626
|
context.onError(
|
|
15621
|
-
createCompilerError(
|
|
15627
|
+
createCompilerError(32, vFor.loc)
|
|
15622
15628
|
);
|
|
15623
15629
|
}
|
|
15624
15630
|
} else {
|
|
@@ -15626,7 +15632,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
15626
15632
|
if (seenSlotNames.has(staticSlotName)) {
|
|
15627
15633
|
context.onError(
|
|
15628
15634
|
createCompilerError(
|
|
15629
|
-
|
|
15635
|
+
38,
|
|
15630
15636
|
dirLoc
|
|
15631
15637
|
)
|
|
15632
15638
|
);
|
|
@@ -15657,7 +15663,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
15657
15663
|
if (hasNamedDefaultSlot) {
|
|
15658
15664
|
context.onError(
|
|
15659
15665
|
createCompilerError(
|
|
15660
|
-
|
|
15666
|
+
39,
|
|
15661
15667
|
implicitDefaultChildren[0].loc
|
|
15662
15668
|
)
|
|
15663
15669
|
);
|
|
@@ -15710,17 +15716,17 @@ function hasForwardedSlots(children) {
|
|
|
15710
15716
|
for (let i = 0; i < children.length; i++) {
|
|
15711
15717
|
const child = children[i];
|
|
15712
15718
|
switch (child.type) {
|
|
15713
|
-
case
|
|
15714
|
-
if (child.tagType ===
|
|
15719
|
+
case 1:
|
|
15720
|
+
if (child.tagType === 2 || hasForwardedSlots(child.children)) {
|
|
15715
15721
|
return true;
|
|
15716
15722
|
}
|
|
15717
15723
|
break;
|
|
15718
|
-
case
|
|
15724
|
+
case 9:
|
|
15719
15725
|
if (hasForwardedSlots(child.branches))
|
|
15720
15726
|
return true;
|
|
15721
15727
|
break;
|
|
15722
|
-
case
|
|
15723
|
-
case
|
|
15728
|
+
case 10:
|
|
15729
|
+
case 11:
|
|
15724
15730
|
if (hasForwardedSlots(child.children))
|
|
15725
15731
|
return true;
|
|
15726
15732
|
break;
|
|
@@ -15729,20 +15735,20 @@ function hasForwardedSlots(children) {
|
|
|
15729
15735
|
return false;
|
|
15730
15736
|
}
|
|
15731
15737
|
function isNonWhitespaceContent(node) {
|
|
15732
|
-
if (node.type !==
|
|
15738
|
+
if (node.type !== 2 && node.type !== 12)
|
|
15733
15739
|
return true;
|
|
15734
|
-
return node.type ===
|
|
15740
|
+
return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
|
|
15735
15741
|
}
|
|
15736
15742
|
|
|
15737
15743
|
const directiveImportMap = /* @__PURE__ */ new WeakMap();
|
|
15738
15744
|
const transformElement = (node, context) => {
|
|
15739
15745
|
return function postTransformElement() {
|
|
15740
15746
|
node = context.currentNode;
|
|
15741
|
-
if (!(node.type ===
|
|
15747
|
+
if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
|
|
15742
15748
|
return;
|
|
15743
15749
|
}
|
|
15744
15750
|
const { tag, props } = node;
|
|
15745
|
-
const isComponent = node.tagType ===
|
|
15751
|
+
const isComponent = node.tagType === 1;
|
|
15746
15752
|
let vnodeTag = isComponent ? resolveComponentType(node, context) : `"${tag}"`;
|
|
15747
15753
|
const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
|
|
15748
15754
|
let vnodeProps;
|
|
@@ -15785,7 +15791,7 @@ const transformElement = (node, context) => {
|
|
|
15785
15791
|
patchFlag |= 1024;
|
|
15786
15792
|
if (node.children.length > 1) {
|
|
15787
15793
|
context.onError(
|
|
15788
|
-
createCompilerError(
|
|
15794
|
+
createCompilerError(46, {
|
|
15789
15795
|
start: node.children[0].loc.start,
|
|
15790
15796
|
end: node.children[node.children.length - 1].loc.end,
|
|
15791
15797
|
source: ""
|
|
@@ -15805,11 +15811,11 @@ const transformElement = (node, context) => {
|
|
|
15805
15811
|
} else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
|
|
15806
15812
|
const child = node.children[0];
|
|
15807
15813
|
const type = child.type;
|
|
15808
|
-
const hasDynamicTextChild = type ===
|
|
15814
|
+
const hasDynamicTextChild = type === 5 || type === 8;
|
|
15809
15815
|
if (hasDynamicTextChild && getConstantType(child, context) === 0) {
|
|
15810
15816
|
patchFlag |= 1;
|
|
15811
15817
|
}
|
|
15812
|
-
if (hasDynamicTextChild || type ===
|
|
15818
|
+
if (hasDynamicTextChild || type === 2) {
|
|
15813
15819
|
vnodeChildren = child;
|
|
15814
15820
|
} else {
|
|
15815
15821
|
vnodeChildren = node.children;
|
|
@@ -15855,13 +15861,13 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
15855
15861
|
"COMPILER_IS_ON_ELEMENT",
|
|
15856
15862
|
context
|
|
15857
15863
|
)) {
|
|
15858
|
-
const exp = isProp.type ===
|
|
15864
|
+
const exp = isProp.type === 6 ? isProp.value && createSimpleExpression(isProp.value.content, true) : isProp.exp;
|
|
15859
15865
|
if (exp) {
|
|
15860
15866
|
return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
|
|
15861
15867
|
exp
|
|
15862
15868
|
]);
|
|
15863
15869
|
}
|
|
15864
|
-
} else if (isProp.type ===
|
|
15870
|
+
} else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) {
|
|
15865
15871
|
tag = isProp.value.content.slice(4);
|
|
15866
15872
|
}
|
|
15867
15873
|
}
|
|
@@ -15920,7 +15926,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
15920
15926
|
if (isEventHandler && isReservedProp(name)) {
|
|
15921
15927
|
hasVnodeHook = true;
|
|
15922
15928
|
}
|
|
15923
|
-
if (value.type ===
|
|
15929
|
+
if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
|
|
15924
15930
|
return;
|
|
15925
15931
|
}
|
|
15926
15932
|
if (name === "ref") {
|
|
@@ -15941,7 +15947,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
15941
15947
|
};
|
|
15942
15948
|
for (let i = 0; i < props.length; i++) {
|
|
15943
15949
|
const prop = props[i];
|
|
15944
|
-
if (prop.type ===
|
|
15950
|
+
if (prop.type === 6) {
|
|
15945
15951
|
const { loc, name, value } = prop;
|
|
15946
15952
|
let isStatic = true;
|
|
15947
15953
|
if (name === "ref") {
|
|
@@ -15982,7 +15988,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
15982
15988
|
if (name === "slot") {
|
|
15983
15989
|
if (!isComponent) {
|
|
15984
15990
|
context.onError(
|
|
15985
|
-
createCompilerError(
|
|
15991
|
+
createCompilerError(40, loc)
|
|
15986
15992
|
);
|
|
15987
15993
|
}
|
|
15988
15994
|
continue;
|
|
@@ -16023,9 +16029,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16023
16029
|
{
|
|
16024
16030
|
{
|
|
16025
16031
|
const hasOverridableKeys = mergeArgs.some((arg2) => {
|
|
16026
|
-
if (arg2.type ===
|
|
16032
|
+
if (arg2.type === 15) {
|
|
16027
16033
|
return arg2.properties.some(({ key }) => {
|
|
16028
|
-
if (key.type !==
|
|
16034
|
+
if (key.type !== 4 || !key.isStatic) {
|
|
16029
16035
|
return true;
|
|
16030
16036
|
}
|
|
16031
16037
|
return key.content !== "class" && key.content !== "style" && !isOn(key.content);
|
|
@@ -16053,7 +16059,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16053
16059
|
mergeArgs.push(exp);
|
|
16054
16060
|
} else {
|
|
16055
16061
|
pushMergeArg({
|
|
16056
|
-
type:
|
|
16062
|
+
type: 14,
|
|
16057
16063
|
loc,
|
|
16058
16064
|
callee: context.helper(TO_HANDLERS),
|
|
16059
16065
|
arguments: isComponent ? [exp] : [exp, `true`]
|
|
@@ -16062,7 +16068,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16062
16068
|
} else {
|
|
16063
16069
|
context.onError(
|
|
16064
16070
|
createCompilerError(
|
|
16065
|
-
isVBind ?
|
|
16071
|
+
isVBind ? 34 : 35,
|
|
16066
16072
|
loc
|
|
16067
16073
|
)
|
|
16068
16074
|
);
|
|
@@ -16131,7 +16137,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16131
16137
|
}
|
|
16132
16138
|
if (!context.inSSR && propsExpression) {
|
|
16133
16139
|
switch (propsExpression.type) {
|
|
16134
|
-
case
|
|
16140
|
+
case 15:
|
|
16135
16141
|
let classKeyIndex = -1;
|
|
16136
16142
|
let styleKeyIndex = -1;
|
|
16137
16143
|
let hasDynamicKey = false;
|
|
@@ -16158,9 +16164,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16158
16164
|
}
|
|
16159
16165
|
if (styleProp && // the static style is compiled into an object,
|
|
16160
16166
|
// so use `hasStyleBinding` to ensure that it is a dynamic style binding
|
|
16161
|
-
(hasStyleBinding || styleProp.value.type ===
|
|
16167
|
+
(hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist,
|
|
16162
16168
|
// v-bind:style with static literal object
|
|
16163
|
-
styleProp.value.type ===
|
|
16169
|
+
styleProp.value.type === 17)) {
|
|
16164
16170
|
styleProp.value = createCallExpression(
|
|
16165
16171
|
context.helper(NORMALIZE_STYLE),
|
|
16166
16172
|
[styleProp.value]
|
|
@@ -16173,7 +16179,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16173
16179
|
);
|
|
16174
16180
|
}
|
|
16175
16181
|
break;
|
|
16176
|
-
case
|
|
16182
|
+
case 14:
|
|
16177
16183
|
break;
|
|
16178
16184
|
default:
|
|
16179
16185
|
propsExpression = createCallExpression(
|
|
@@ -16200,7 +16206,7 @@ function dedupeProperties(properties) {
|
|
|
16200
16206
|
const deduped = [];
|
|
16201
16207
|
for (let i = 0; i < properties.length; i++) {
|
|
16202
16208
|
const prop = properties[i];
|
|
16203
|
-
if (prop.key.type ===
|
|
16209
|
+
if (prop.key.type === 8 || !prop.key.isStatic) {
|
|
16204
16210
|
deduped.push(prop);
|
|
16205
16211
|
continue;
|
|
16206
16212
|
}
|
|
@@ -16218,7 +16224,7 @@ function dedupeProperties(properties) {
|
|
|
16218
16224
|
return deduped;
|
|
16219
16225
|
}
|
|
16220
16226
|
function mergeAsArray(existing, incoming) {
|
|
16221
|
-
if (existing.value.type ===
|
|
16227
|
+
if (existing.value.type === 17) {
|
|
16222
16228
|
existing.value.elements.push(incoming.value);
|
|
16223
16229
|
} else {
|
|
16224
16230
|
existing.value = createArrayExpression(
|
|
@@ -16317,7 +16323,7 @@ function processSlotOutlet(node, context) {
|
|
|
16317
16323
|
const nonNameProps = [];
|
|
16318
16324
|
for (let i = 0; i < node.props.length; i++) {
|
|
16319
16325
|
const p = node.props[i];
|
|
16320
|
-
if (p.type ===
|
|
16326
|
+
if (p.type === 6) {
|
|
16321
16327
|
if (p.value) {
|
|
16322
16328
|
if (p.name === "name") {
|
|
16323
16329
|
slotName = JSON.stringify(p.value.content);
|
|
@@ -16350,7 +16356,7 @@ function processSlotOutlet(node, context) {
|
|
|
16350
16356
|
if (directives.length) {
|
|
16351
16357
|
context.onError(
|
|
16352
16358
|
createCompilerError(
|
|
16353
|
-
|
|
16359
|
+
36,
|
|
16354
16360
|
directives[0].loc
|
|
16355
16361
|
)
|
|
16356
16362
|
);
|
|
@@ -16366,16 +16372,16 @@ const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+
|
|
|
16366
16372
|
const transformOn$1 = (dir, node, context, augmentor) => {
|
|
16367
16373
|
const { loc, modifiers, arg } = dir;
|
|
16368
16374
|
if (!dir.exp && !modifiers.length) {
|
|
16369
|
-
context.onError(createCompilerError(
|
|
16375
|
+
context.onError(createCompilerError(35, loc));
|
|
16370
16376
|
}
|
|
16371
16377
|
let eventName;
|
|
16372
|
-
if (arg.type ===
|
|
16378
|
+
if (arg.type === 4) {
|
|
16373
16379
|
if (arg.isStatic) {
|
|
16374
16380
|
let rawName = arg.content;
|
|
16375
16381
|
if (rawName.startsWith("vue:")) {
|
|
16376
16382
|
rawName = `vnode-${rawName.slice(4)}`;
|
|
16377
16383
|
}
|
|
16378
|
-
const eventString = node.tagType !==
|
|
16384
|
+
const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? (
|
|
16379
16385
|
// for non-element and vnode lifecycle event listeners, auto convert
|
|
16380
16386
|
// it to camelCase. See issue #2249
|
|
16381
16387
|
toHandlerKey(camelize(rawName))
|
|
@@ -16443,14 +16449,14 @@ const transformOn$1 = (dir, node, context, augmentor) => {
|
|
|
16443
16449
|
const transformBind = (dir, _node, context) => {
|
|
16444
16450
|
const { exp, modifiers, loc } = dir;
|
|
16445
16451
|
const arg = dir.arg;
|
|
16446
|
-
if (arg.type !==
|
|
16452
|
+
if (arg.type !== 4) {
|
|
16447
16453
|
arg.children.unshift(`(`);
|
|
16448
16454
|
arg.children.push(`) || ""`);
|
|
16449
16455
|
} else if (!arg.isStatic) {
|
|
16450
16456
|
arg.content = `${arg.content} || ""`;
|
|
16451
16457
|
}
|
|
16452
16458
|
if (modifiers.includes("camel")) {
|
|
16453
|
-
if (arg.type ===
|
|
16459
|
+
if (arg.type === 4) {
|
|
16454
16460
|
if (arg.isStatic) {
|
|
16455
16461
|
arg.content = camelize(arg.content);
|
|
16456
16462
|
} else {
|
|
@@ -16469,8 +16475,8 @@ const transformBind = (dir, _node, context) => {
|
|
|
16469
16475
|
injectPrefix(arg, "^");
|
|
16470
16476
|
}
|
|
16471
16477
|
}
|
|
16472
|
-
if (!exp || exp.type ===
|
|
16473
|
-
context.onError(createCompilerError(
|
|
16478
|
+
if (!exp || exp.type === 4 && !exp.content.trim()) {
|
|
16479
|
+
context.onError(createCompilerError(34, loc));
|
|
16474
16480
|
return {
|
|
16475
16481
|
props: [createObjectProperty(arg, createSimpleExpression("", true, loc))]
|
|
16476
16482
|
};
|
|
@@ -16480,7 +16486,7 @@ const transformBind = (dir, _node, context) => {
|
|
|
16480
16486
|
};
|
|
16481
16487
|
};
|
|
16482
16488
|
const injectPrefix = (arg, prefix) => {
|
|
16483
|
-
if (arg.type ===
|
|
16489
|
+
if (arg.type === 4) {
|
|
16484
16490
|
if (arg.isStatic) {
|
|
16485
16491
|
arg.content = prefix + arg.content;
|
|
16486
16492
|
} else {
|
|
@@ -16493,7 +16499,7 @@ const injectPrefix = (arg, prefix) => {
|
|
|
16493
16499
|
};
|
|
16494
16500
|
|
|
16495
16501
|
const transformText = (node, context) => {
|
|
16496
|
-
if (node.type ===
|
|
16502
|
+
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
16497
16503
|
return () => {
|
|
16498
16504
|
const children = node.children;
|
|
16499
16505
|
let currentContainer = void 0;
|
|
@@ -16525,13 +16531,13 @@ const transformText = (node, context) => {
|
|
|
16525
16531
|
// as-is since the runtime has dedicated fast path for this by directly
|
|
16526
16532
|
// setting textContent of the element.
|
|
16527
16533
|
// for component root it's always normalized anyway.
|
|
16528
|
-
children.length === 1 && (node.type ===
|
|
16534
|
+
children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
|
|
16529
16535
|
// custom directives can potentially add DOM elements arbitrarily,
|
|
16530
16536
|
// we need to avoid setting textContent of the element at runtime
|
|
16531
16537
|
// to avoid accidentally overwriting the DOM elements added
|
|
16532
16538
|
// by the user through custom directives.
|
|
16533
16539
|
!node.props.find(
|
|
16534
|
-
(p) => p.type ===
|
|
16540
|
+
(p) => p.type === 7 && !context.directiveTransforms[p.name]
|
|
16535
16541
|
) && // in compat mode, <template> tags with no special directives
|
|
16536
16542
|
// will be rendered as a fragment so its children must be
|
|
16537
16543
|
// converted into vnodes.
|
|
@@ -16540,9 +16546,9 @@ const transformText = (node, context) => {
|
|
|
16540
16546
|
}
|
|
16541
16547
|
for (let i = 0; i < children.length; i++) {
|
|
16542
16548
|
const child = children[i];
|
|
16543
|
-
if (isText$1(child) || child.type ===
|
|
16549
|
+
if (isText$1(child) || child.type === 8) {
|
|
16544
16550
|
const callArgs = [];
|
|
16545
|
-
if (child.type !==
|
|
16551
|
+
if (child.type !== 2 || child.content !== " ") {
|
|
16546
16552
|
callArgs.push(child);
|
|
16547
16553
|
}
|
|
16548
16554
|
if (!context.ssr && getConstantType(child, context) === 0) {
|
|
@@ -16551,7 +16557,7 @@ const transformText = (node, context) => {
|
|
|
16551
16557
|
);
|
|
16552
16558
|
}
|
|
16553
16559
|
children[i] = {
|
|
16554
|
-
type:
|
|
16560
|
+
type: 12,
|
|
16555
16561
|
content: child,
|
|
16556
16562
|
loc: child.loc,
|
|
16557
16563
|
codegenNode: createCallExpression(
|
|
@@ -16567,7 +16573,7 @@ const transformText = (node, context) => {
|
|
|
16567
16573
|
|
|
16568
16574
|
const seen$1 = /* @__PURE__ */ new WeakSet();
|
|
16569
16575
|
const transformOnce = (node, context) => {
|
|
16570
|
-
if (node.type ===
|
|
16576
|
+
if (node.type === 1 && findDir(node, "once", true)) {
|
|
16571
16577
|
if (seen$1.has(node) || context.inVOnce) {
|
|
16572
16578
|
return;
|
|
16573
16579
|
}
|
|
@@ -16592,21 +16598,21 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
16592
16598
|
const { exp, arg } = dir;
|
|
16593
16599
|
if (!exp) {
|
|
16594
16600
|
context.onError(
|
|
16595
|
-
createCompilerError(
|
|
16601
|
+
createCompilerError(41, dir.loc)
|
|
16596
16602
|
);
|
|
16597
16603
|
return createTransformProps();
|
|
16598
16604
|
}
|
|
16599
16605
|
const rawExp = exp.loc.source;
|
|
16600
|
-
const expString = exp.type ===
|
|
16606
|
+
const expString = exp.type === 4 ? exp.content : rawExp;
|
|
16601
16607
|
const bindingType = context.bindingMetadata[rawExp];
|
|
16602
16608
|
if (bindingType === "props" || bindingType === "props-aliased") {
|
|
16603
|
-
context.onError(createCompilerError(
|
|
16609
|
+
context.onError(createCompilerError(44, exp.loc));
|
|
16604
16610
|
return createTransformProps();
|
|
16605
16611
|
}
|
|
16606
16612
|
const maybeRef = false;
|
|
16607
16613
|
if (!expString.trim() || !isMemberExpression(expString) && !maybeRef) {
|
|
16608
16614
|
context.onError(
|
|
16609
|
-
createCompilerError(
|
|
16615
|
+
createCompilerError(42, exp.loc)
|
|
16610
16616
|
);
|
|
16611
16617
|
return createTransformProps();
|
|
16612
16618
|
}
|
|
@@ -16627,7 +16633,7 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
16627
16633
|
// "onUpdate:modelValue": $event => (foo = $event)
|
|
16628
16634
|
createObjectProperty(eventName, assignmentExp)
|
|
16629
16635
|
];
|
|
16630
|
-
if (dir.modifiers.length && node.tagType ===
|
|
16636
|
+
if (dir.modifiers.length && node.tagType === 1) {
|
|
16631
16637
|
const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
|
|
16632
16638
|
const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
|
|
16633
16639
|
props.push(
|
|
@@ -16637,7 +16643,7 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
16637
16643
|
`{ ${modifiers} }`,
|
|
16638
16644
|
false,
|
|
16639
16645
|
dir.loc,
|
|
16640
|
-
|
|
16646
|
+
2
|
|
16641
16647
|
)
|
|
16642
16648
|
)
|
|
16643
16649
|
);
|
|
@@ -16653,30 +16659,30 @@ const transformFilter = (node, context) => {
|
|
|
16653
16659
|
if (!isCompatEnabled("COMPILER_FILTER", context)) {
|
|
16654
16660
|
return;
|
|
16655
16661
|
}
|
|
16656
|
-
if (node.type ===
|
|
16662
|
+
if (node.type === 5) {
|
|
16657
16663
|
rewriteFilter(node.content, context);
|
|
16658
16664
|
}
|
|
16659
|
-
if (node.type ===
|
|
16665
|
+
if (node.type === 1) {
|
|
16660
16666
|
node.props.forEach((prop) => {
|
|
16661
|
-
if (prop.type ===
|
|
16667
|
+
if (prop.type === 7 && prop.name !== "for" && prop.exp) {
|
|
16662
16668
|
rewriteFilter(prop.exp, context);
|
|
16663
16669
|
}
|
|
16664
16670
|
});
|
|
16665
16671
|
}
|
|
16666
16672
|
};
|
|
16667
16673
|
function rewriteFilter(node, context) {
|
|
16668
|
-
if (node.type ===
|
|
16674
|
+
if (node.type === 4) {
|
|
16669
16675
|
parseFilter(node, context);
|
|
16670
16676
|
} else {
|
|
16671
16677
|
for (let i = 0; i < node.children.length; i++) {
|
|
16672
16678
|
const child = node.children[i];
|
|
16673
16679
|
if (typeof child !== "object")
|
|
16674
16680
|
continue;
|
|
16675
|
-
if (child.type ===
|
|
16681
|
+
if (child.type === 4) {
|
|
16676
16682
|
parseFilter(child, context);
|
|
16677
|
-
} else if (child.type ===
|
|
16683
|
+
} else if (child.type === 8) {
|
|
16678
16684
|
rewriteFilter(node, context);
|
|
16679
|
-
} else if (child.type ===
|
|
16685
|
+
} else if (child.type === 5) {
|
|
16680
16686
|
rewriteFilter(child.content, context);
|
|
16681
16687
|
}
|
|
16682
16688
|
}
|
|
@@ -16797,7 +16803,7 @@ function wrapFilter(exp, filter, context) {
|
|
|
16797
16803
|
|
|
16798
16804
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
16799
16805
|
const transformMemo = (node, context) => {
|
|
16800
|
-
if (node.type ===
|
|
16806
|
+
if (node.type === 1) {
|
|
16801
16807
|
const dir = findDir(node, "memo");
|
|
16802
16808
|
if (!dir || seen.has(node)) {
|
|
16803
16809
|
return;
|
|
@@ -16805,9 +16811,9 @@ const transformMemo = (node, context) => {
|
|
|
16805
16811
|
seen.add(node);
|
|
16806
16812
|
return () => {
|
|
16807
16813
|
const codegenNode = node.codegenNode || context.currentNode.codegenNode;
|
|
16808
|
-
if (codegenNode && codegenNode.type ===
|
|
16809
|
-
if (node.tagType !==
|
|
16810
|
-
|
|
16814
|
+
if (codegenNode && codegenNode.type === 13) {
|
|
16815
|
+
if (node.tagType !== 1) {
|
|
16816
|
+
convertToBlock(codegenNode, context);
|
|
16811
16817
|
}
|
|
16812
16818
|
node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
|
|
16813
16819
|
dir.exp,
|
|
@@ -16846,17 +16852,17 @@ function baseCompile(template, options = {}) {
|
|
|
16846
16852
|
const isModuleMode = options.mode === "module";
|
|
16847
16853
|
{
|
|
16848
16854
|
if (options.prefixIdentifiers === true) {
|
|
16849
|
-
onError(createCompilerError(
|
|
16855
|
+
onError(createCompilerError(47));
|
|
16850
16856
|
} else if (isModuleMode) {
|
|
16851
|
-
onError(createCompilerError(
|
|
16857
|
+
onError(createCompilerError(48));
|
|
16852
16858
|
}
|
|
16853
16859
|
}
|
|
16854
16860
|
const prefixIdentifiers = false;
|
|
16855
16861
|
if (options.cacheHandlers) {
|
|
16856
|
-
onError(createCompilerError(
|
|
16862
|
+
onError(createCompilerError(49));
|
|
16857
16863
|
}
|
|
16858
16864
|
if (options.scopeId && !isModuleMode) {
|
|
16859
|
-
onError(createCompilerError(
|
|
16865
|
+
onError(createCompilerError(50));
|
|
16860
16866
|
}
|
|
16861
16867
|
const ast = isString(template) ? baseParse(template, options) : template;
|
|
16862
16868
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
|
|
@@ -16943,30 +16949,30 @@ const parserOptions = {
|
|
|
16943
16949
|
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
|
16944
16950
|
getNamespace(tag, parent) {
|
|
16945
16951
|
let ns = parent ? parent.ns : 0;
|
|
16946
|
-
if (parent && ns ===
|
|
16952
|
+
if (parent && ns === 2) {
|
|
16947
16953
|
if (parent.tag === "annotation-xml") {
|
|
16948
16954
|
if (tag === "svg") {
|
|
16949
|
-
return
|
|
16955
|
+
return 1;
|
|
16950
16956
|
}
|
|
16951
16957
|
if (parent.props.some(
|
|
16952
|
-
(a) => a.type ===
|
|
16958
|
+
(a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
|
|
16953
16959
|
)) {
|
|
16954
16960
|
ns = 0;
|
|
16955
16961
|
}
|
|
16956
16962
|
} else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
|
|
16957
16963
|
ns = 0;
|
|
16958
16964
|
}
|
|
16959
|
-
} else if (parent && ns ===
|
|
16965
|
+
} else if (parent && ns === 1) {
|
|
16960
16966
|
if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
|
|
16961
16967
|
ns = 0;
|
|
16962
16968
|
}
|
|
16963
16969
|
}
|
|
16964
16970
|
if (ns === 0) {
|
|
16965
16971
|
if (tag === "svg") {
|
|
16966
|
-
return
|
|
16972
|
+
return 1;
|
|
16967
16973
|
}
|
|
16968
16974
|
if (tag === "math") {
|
|
16969
|
-
return
|
|
16975
|
+
return 2;
|
|
16970
16976
|
}
|
|
16971
16977
|
}
|
|
16972
16978
|
return ns;
|
|
@@ -16975,22 +16981,22 @@ const parserOptions = {
|
|
|
16975
16981
|
getTextMode({ tag, ns }) {
|
|
16976
16982
|
if (ns === 0) {
|
|
16977
16983
|
if (tag === "textarea" || tag === "title") {
|
|
16978
|
-
return
|
|
16984
|
+
return 1;
|
|
16979
16985
|
}
|
|
16980
16986
|
if (isRawTextContainer(tag)) {
|
|
16981
|
-
return
|
|
16987
|
+
return 2;
|
|
16982
16988
|
}
|
|
16983
16989
|
}
|
|
16984
|
-
return
|
|
16990
|
+
return 0;
|
|
16985
16991
|
}
|
|
16986
16992
|
};
|
|
16987
16993
|
|
|
16988
16994
|
const transformStyle = (node) => {
|
|
16989
|
-
if (node.type ===
|
|
16995
|
+
if (node.type === 1) {
|
|
16990
16996
|
node.props.forEach((p, i) => {
|
|
16991
|
-
if (p.type ===
|
|
16997
|
+
if (p.type === 6 && p.name === "style" && p.value) {
|
|
16992
16998
|
node.props[i] = {
|
|
16993
|
-
type:
|
|
16999
|
+
type: 7,
|
|
16994
17000
|
name: `bind`,
|
|
16995
17001
|
arg: createSimpleExpression(`style`, true, p.loc),
|
|
16996
17002
|
exp: parseInlineCSS(p.value.content, p.loc),
|
|
@@ -17007,7 +17013,7 @@ const parseInlineCSS = (cssText, loc) => {
|
|
|
17007
17013
|
JSON.stringify(normalized),
|
|
17008
17014
|
false,
|
|
17009
17015
|
loc,
|
|
17010
|
-
|
|
17016
|
+
3
|
|
17011
17017
|
);
|
|
17012
17018
|
};
|
|
17013
17019
|
|
|
@@ -17020,16 +17026,16 @@ function createDOMCompilerError(code, loc) {
|
|
|
17020
17026
|
}
|
|
17021
17027
|
const DOMErrorMessages = {
|
|
17022
17028
|
[51]: `v-html is missing expression.`,
|
|
17023
|
-
[
|
|
17024
|
-
[
|
|
17025
|
-
[
|
|
17026
|
-
[
|
|
17027
|
-
[
|
|
17028
|
-
[
|
|
17029
|
-
[
|
|
17030
|
-
[
|
|
17031
|
-
[
|
|
17032
|
-
[
|
|
17029
|
+
[52]: `v-html will override element children.`,
|
|
17030
|
+
[53]: `v-text is missing expression.`,
|
|
17031
|
+
[54]: `v-text will override element children.`,
|
|
17032
|
+
[55]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
|
17033
|
+
[56]: `v-model argument is not supported on plain elements.`,
|
|
17034
|
+
[57]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
|
17035
|
+
[58]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
|
17036
|
+
[59]: `v-show is missing expression.`,
|
|
17037
|
+
[60]: `<Transition> expects exactly one child element or component.`,
|
|
17038
|
+
[61]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
|
17033
17039
|
};
|
|
17034
17040
|
|
|
17035
17041
|
const transformVHtml = (dir, node, context) => {
|
|
@@ -17041,7 +17047,7 @@ const transformVHtml = (dir, node, context) => {
|
|
|
17041
17047
|
}
|
|
17042
17048
|
if (node.children.length) {
|
|
17043
17049
|
context.onError(
|
|
17044
|
-
createDOMCompilerError(
|
|
17050
|
+
createDOMCompilerError(52, loc)
|
|
17045
17051
|
);
|
|
17046
17052
|
node.children.length = 0;
|
|
17047
17053
|
}
|
|
@@ -17059,12 +17065,12 @@ const transformVText = (dir, node, context) => {
|
|
|
17059
17065
|
const { exp, loc } = dir;
|
|
17060
17066
|
if (!exp) {
|
|
17061
17067
|
context.onError(
|
|
17062
|
-
createDOMCompilerError(
|
|
17068
|
+
createDOMCompilerError(53, loc)
|
|
17063
17069
|
);
|
|
17064
17070
|
}
|
|
17065
17071
|
if (node.children.length) {
|
|
17066
17072
|
context.onError(
|
|
17067
|
-
createDOMCompilerError(
|
|
17073
|
+
createDOMCompilerError(54, loc)
|
|
17068
17074
|
);
|
|
17069
17075
|
node.children.length = 0;
|
|
17070
17076
|
}
|
|
@@ -17084,13 +17090,13 @@ const transformVText = (dir, node, context) => {
|
|
|
17084
17090
|
|
|
17085
17091
|
const transformModel = (dir, node, context) => {
|
|
17086
17092
|
const baseResult = transformModel$1(dir, node, context);
|
|
17087
|
-
if (!baseResult.props.length || node.tagType ===
|
|
17093
|
+
if (!baseResult.props.length || node.tagType === 1) {
|
|
17088
17094
|
return baseResult;
|
|
17089
17095
|
}
|
|
17090
17096
|
if (dir.arg) {
|
|
17091
17097
|
context.onError(
|
|
17092
17098
|
createDOMCompilerError(
|
|
17093
|
-
|
|
17099
|
+
56,
|
|
17094
17100
|
dir.arg.loc
|
|
17095
17101
|
)
|
|
17096
17102
|
);
|
|
@@ -17100,7 +17106,7 @@ const transformModel = (dir, node, context) => {
|
|
|
17100
17106
|
if (value) {
|
|
17101
17107
|
context.onError(
|
|
17102
17108
|
createDOMCompilerError(
|
|
17103
|
-
|
|
17109
|
+
58,
|
|
17104
17110
|
value.loc
|
|
17105
17111
|
)
|
|
17106
17112
|
);
|
|
@@ -17114,7 +17120,7 @@ const transformModel = (dir, node, context) => {
|
|
|
17114
17120
|
if (tag === "input" || isCustomElement) {
|
|
17115
17121
|
const type = findProp(node, `type`);
|
|
17116
17122
|
if (type) {
|
|
17117
|
-
if (type.type ===
|
|
17123
|
+
if (type.type === 7) {
|
|
17118
17124
|
directiveToUse = V_MODEL_DYNAMIC;
|
|
17119
17125
|
} else if (type.value) {
|
|
17120
17126
|
switch (type.value.content) {
|
|
@@ -17128,7 +17134,7 @@ const transformModel = (dir, node, context) => {
|
|
|
17128
17134
|
isInvalidType = true;
|
|
17129
17135
|
context.onError(
|
|
17130
17136
|
createDOMCompilerError(
|
|
17131
|
-
|
|
17137
|
+
57,
|
|
17132
17138
|
dir.loc
|
|
17133
17139
|
)
|
|
17134
17140
|
);
|
|
@@ -17154,13 +17160,13 @@ const transformModel = (dir, node, context) => {
|
|
|
17154
17160
|
} else {
|
|
17155
17161
|
context.onError(
|
|
17156
17162
|
createDOMCompilerError(
|
|
17157
|
-
|
|
17163
|
+
55,
|
|
17158
17164
|
dir.loc
|
|
17159
17165
|
)
|
|
17160
17166
|
);
|
|
17161
17167
|
}
|
|
17162
17168
|
baseResult.props = baseResult.props.filter(
|
|
17163
|
-
(p) => !(p.key.type ===
|
|
17169
|
+
(p) => !(p.key.type === 4 && p.key.content === "modelValue")
|
|
17164
17170
|
);
|
|
17165
17171
|
return baseResult;
|
|
17166
17172
|
};
|
|
@@ -17218,7 +17224,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
|
|
|
17218
17224
|
};
|
|
17219
17225
|
const transformClick = (key, event) => {
|
|
17220
17226
|
const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
|
|
17221
|
-
return isStaticClick ? createSimpleExpression(event, true) : key.type !==
|
|
17227
|
+
return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
|
|
17222
17228
|
`(`,
|
|
17223
17229
|
key,
|
|
17224
17230
|
`) === "onClick" ? "${event}" : (`,
|
|
@@ -17266,7 +17272,7 @@ const transformShow = (dir, node, context) => {
|
|
|
17266
17272
|
const { exp, loc } = dir;
|
|
17267
17273
|
if (!exp) {
|
|
17268
17274
|
context.onError(
|
|
17269
|
-
createDOMCompilerError(
|
|
17275
|
+
createDOMCompilerError(59, loc)
|
|
17270
17276
|
);
|
|
17271
17277
|
}
|
|
17272
17278
|
return {
|
|
@@ -17276,7 +17282,7 @@ const transformShow = (dir, node, context) => {
|
|
|
17276
17282
|
};
|
|
17277
17283
|
|
|
17278
17284
|
const transformTransition = (node, context) => {
|
|
17279
|
-
if (node.type ===
|
|
17285
|
+
if (node.type === 1 && node.tagType === 1) {
|
|
17280
17286
|
const component = context.isBuiltInComponent(node.tag);
|
|
17281
17287
|
if (component === TRANSITION) {
|
|
17282
17288
|
return () => {
|
|
@@ -17286,7 +17292,7 @@ const transformTransition = (node, context) => {
|
|
|
17286
17292
|
if (hasMultipleChildren(node)) {
|
|
17287
17293
|
context.onError(
|
|
17288
17294
|
createDOMCompilerError(
|
|
17289
|
-
|
|
17295
|
+
60,
|
|
17290
17296
|
{
|
|
17291
17297
|
start: node.children[0].loc.start,
|
|
17292
17298
|
end: node.children[node.children.length - 1].loc.end,
|
|
@@ -17296,11 +17302,11 @@ const transformTransition = (node, context) => {
|
|
|
17296
17302
|
);
|
|
17297
17303
|
}
|
|
17298
17304
|
const child = node.children[0];
|
|
17299
|
-
if (child.type ===
|
|
17305
|
+
if (child.type === 1) {
|
|
17300
17306
|
for (const p of child.props) {
|
|
17301
|
-
if (p.type ===
|
|
17307
|
+
if (p.type === 7 && p.name === "show") {
|
|
17302
17308
|
node.props.push({
|
|
17303
|
-
type:
|
|
17309
|
+
type: 6,
|
|
17304
17310
|
name: "persisted",
|
|
17305
17311
|
value: void 0,
|
|
17306
17312
|
loc: node.loc
|
|
@@ -17314,16 +17320,16 @@ const transformTransition = (node, context) => {
|
|
|
17314
17320
|
};
|
|
17315
17321
|
function hasMultipleChildren(node) {
|
|
17316
17322
|
const children = node.children = node.children.filter(
|
|
17317
|
-
(c) => c.type !==
|
|
17323
|
+
(c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
|
|
17318
17324
|
);
|
|
17319
17325
|
const child = children[0];
|
|
17320
|
-
return children.length !== 1 || child.type ===
|
|
17326
|
+
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
|
|
17321
17327
|
}
|
|
17322
17328
|
|
|
17323
17329
|
const ignoreSideEffectTags = (node, context) => {
|
|
17324
|
-
if (node.type ===
|
|
17330
|
+
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
|
|
17325
17331
|
context.onError(
|
|
17326
|
-
createDOMCompilerError(
|
|
17332
|
+
createDOMCompilerError(61, node.loc)
|
|
17327
17333
|
);
|
|
17328
17334
|
context.removeNode();
|
|
17329
17335
|
}
|