@vue/compat 3.4.0-alpha.2 → 3.4.0-alpha.4
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 +234 -81
- package/dist/vue.cjs.prod.js +231 -64
- package/dist/vue.esm-browser.js +174 -62
- package/dist/vue.esm-browser.prod.js +5 -5
- package/dist/vue.esm-bundler.js +176 -64
- package/dist/vue.global.js +173 -61
- package/dist/vue.global.prod.js +5 -5
- package/dist/vue.runtime.esm-browser.js +121 -31
- package/dist/vue.runtime.esm-browser.prod.js +5 -5
- package/dist/vue.runtime.esm-bundler.js +122 -32
- package/dist/vue.runtime.global.js +120 -30
- package/dist/vue.runtime.global.prod.js +5 -5
- package/package.json +3 -3
package/dist/vue.cjs.prod.js
CHANGED
|
@@ -15,8 +15,8 @@ const EMPTY_ARR = [];
|
|
|
15
15
|
const NOOP = () => {
|
|
16
16
|
};
|
|
17
17
|
const NO = () => false;
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
|
19
|
+
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
|
20
20
|
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
21
21
|
const extend = Object.assign;
|
|
22
22
|
const remove = (arr, el) => {
|
|
@@ -105,7 +105,7 @@ function genPropsAccessExp(name) {
|
|
|
105
105
|
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
|
|
108
|
+
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
|
|
109
109
|
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
|
|
110
110
|
|
|
111
111
|
function normalizeStyle(value) {
|
|
@@ -1418,6 +1418,18 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1418
1418
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1419
1419
|
}
|
|
1420
1420
|
|
|
1421
|
+
const TrackOpTypes = {
|
|
1422
|
+
"GET": "get",
|
|
1423
|
+
"HAS": "has",
|
|
1424
|
+
"ITERATE": "iterate"
|
|
1425
|
+
};
|
|
1426
|
+
const TriggerOpTypes = {
|
|
1427
|
+
"SET": "set",
|
|
1428
|
+
"ADD": "add",
|
|
1429
|
+
"DELETE": "delete",
|
|
1430
|
+
"CLEAR": "clear"
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1421
1433
|
function warn$1(msg, ...args) {
|
|
1422
1434
|
return;
|
|
1423
1435
|
}
|
|
@@ -1425,6 +1437,38 @@ function assertNumber(val, type) {
|
|
|
1425
1437
|
return;
|
|
1426
1438
|
}
|
|
1427
1439
|
|
|
1440
|
+
const ErrorCodes = {
|
|
1441
|
+
"SETUP_FUNCTION": 0,
|
|
1442
|
+
"0": "SETUP_FUNCTION",
|
|
1443
|
+
"RENDER_FUNCTION": 1,
|
|
1444
|
+
"1": "RENDER_FUNCTION",
|
|
1445
|
+
"WATCH_GETTER": 2,
|
|
1446
|
+
"2": "WATCH_GETTER",
|
|
1447
|
+
"WATCH_CALLBACK": 3,
|
|
1448
|
+
"3": "WATCH_CALLBACK",
|
|
1449
|
+
"WATCH_CLEANUP": 4,
|
|
1450
|
+
"4": "WATCH_CLEANUP",
|
|
1451
|
+
"NATIVE_EVENT_HANDLER": 5,
|
|
1452
|
+
"5": "NATIVE_EVENT_HANDLER",
|
|
1453
|
+
"COMPONENT_EVENT_HANDLER": 6,
|
|
1454
|
+
"6": "COMPONENT_EVENT_HANDLER",
|
|
1455
|
+
"VNODE_HOOK": 7,
|
|
1456
|
+
"7": "VNODE_HOOK",
|
|
1457
|
+
"DIRECTIVE_HOOK": 8,
|
|
1458
|
+
"8": "DIRECTIVE_HOOK",
|
|
1459
|
+
"TRANSITION_HOOK": 9,
|
|
1460
|
+
"9": "TRANSITION_HOOK",
|
|
1461
|
+
"APP_ERROR_HANDLER": 10,
|
|
1462
|
+
"10": "APP_ERROR_HANDLER",
|
|
1463
|
+
"APP_WARN_HANDLER": 11,
|
|
1464
|
+
"11": "APP_WARN_HANDLER",
|
|
1465
|
+
"FUNCTION_REF": 12,
|
|
1466
|
+
"12": "FUNCTION_REF",
|
|
1467
|
+
"ASYNC_COMPONENT_LOADER": 13,
|
|
1468
|
+
"13": "ASYNC_COMPONENT_LOADER",
|
|
1469
|
+
"SCHEDULER": 14,
|
|
1470
|
+
"14": "SCHEDULER"
|
|
1471
|
+
};
|
|
1428
1472
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
1429
1473
|
let res;
|
|
1430
1474
|
try {
|
|
@@ -1455,7 +1499,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
1455
1499
|
if (instance) {
|
|
1456
1500
|
let cur = instance.parent;
|
|
1457
1501
|
const exposedInstance = instance.proxy;
|
|
1458
|
-
const errorInfo = type
|
|
1502
|
+
const errorInfo = `https://vuejs.org/errors/#runtime-${type}`;
|
|
1459
1503
|
while (cur) {
|
|
1460
1504
|
const errorCapturedHooks = cur.ec;
|
|
1461
1505
|
if (errorCapturedHooks) {
|
|
@@ -1646,6 +1690,50 @@ function setDevtoolsHook(hook, target) {
|
|
|
1646
1690
|
}
|
|
1647
1691
|
}
|
|
1648
1692
|
|
|
1693
|
+
const DeprecationTypes$1 = {
|
|
1694
|
+
"GLOBAL_MOUNT": "GLOBAL_MOUNT",
|
|
1695
|
+
"GLOBAL_MOUNT_CONTAINER": "GLOBAL_MOUNT_CONTAINER",
|
|
1696
|
+
"GLOBAL_EXTEND": "GLOBAL_EXTEND",
|
|
1697
|
+
"GLOBAL_PROTOTYPE": "GLOBAL_PROTOTYPE",
|
|
1698
|
+
"GLOBAL_SET": "GLOBAL_SET",
|
|
1699
|
+
"GLOBAL_DELETE": "GLOBAL_DELETE",
|
|
1700
|
+
"GLOBAL_OBSERVABLE": "GLOBAL_OBSERVABLE",
|
|
1701
|
+
"GLOBAL_PRIVATE_UTIL": "GLOBAL_PRIVATE_UTIL",
|
|
1702
|
+
"CONFIG_SILENT": "CONFIG_SILENT",
|
|
1703
|
+
"CONFIG_DEVTOOLS": "CONFIG_DEVTOOLS",
|
|
1704
|
+
"CONFIG_KEY_CODES": "CONFIG_KEY_CODES",
|
|
1705
|
+
"CONFIG_PRODUCTION_TIP": "CONFIG_PRODUCTION_TIP",
|
|
1706
|
+
"CONFIG_IGNORED_ELEMENTS": "CONFIG_IGNORED_ELEMENTS",
|
|
1707
|
+
"CONFIG_WHITESPACE": "CONFIG_WHITESPACE",
|
|
1708
|
+
"CONFIG_OPTION_MERGE_STRATS": "CONFIG_OPTION_MERGE_STRATS",
|
|
1709
|
+
"INSTANCE_SET": "INSTANCE_SET",
|
|
1710
|
+
"INSTANCE_DELETE": "INSTANCE_DELETE",
|
|
1711
|
+
"INSTANCE_DESTROY": "INSTANCE_DESTROY",
|
|
1712
|
+
"INSTANCE_EVENT_EMITTER": "INSTANCE_EVENT_EMITTER",
|
|
1713
|
+
"INSTANCE_EVENT_HOOKS": "INSTANCE_EVENT_HOOKS",
|
|
1714
|
+
"INSTANCE_CHILDREN": "INSTANCE_CHILDREN",
|
|
1715
|
+
"INSTANCE_LISTENERS": "INSTANCE_LISTENERS",
|
|
1716
|
+
"INSTANCE_SCOPED_SLOTS": "INSTANCE_SCOPED_SLOTS",
|
|
1717
|
+
"INSTANCE_ATTRS_CLASS_STYLE": "INSTANCE_ATTRS_CLASS_STYLE",
|
|
1718
|
+
"OPTIONS_DATA_FN": "OPTIONS_DATA_FN",
|
|
1719
|
+
"OPTIONS_DATA_MERGE": "OPTIONS_DATA_MERGE",
|
|
1720
|
+
"OPTIONS_BEFORE_DESTROY": "OPTIONS_BEFORE_DESTROY",
|
|
1721
|
+
"OPTIONS_DESTROYED": "OPTIONS_DESTROYED",
|
|
1722
|
+
"WATCH_ARRAY": "WATCH_ARRAY",
|
|
1723
|
+
"PROPS_DEFAULT_THIS": "PROPS_DEFAULT_THIS",
|
|
1724
|
+
"V_ON_KEYCODE_MODIFIER": "V_ON_KEYCODE_MODIFIER",
|
|
1725
|
+
"CUSTOM_DIR": "CUSTOM_DIR",
|
|
1726
|
+
"ATTR_FALSE_VALUE": "ATTR_FALSE_VALUE",
|
|
1727
|
+
"ATTR_ENUMERATED_COERCION": "ATTR_ENUMERATED_COERCION",
|
|
1728
|
+
"TRANSITION_CLASSES": "TRANSITION_CLASSES",
|
|
1729
|
+
"TRANSITION_GROUP_ROOT": "TRANSITION_GROUP_ROOT",
|
|
1730
|
+
"COMPONENT_ASYNC": "COMPONENT_ASYNC",
|
|
1731
|
+
"COMPONENT_FUNCTIONAL": "COMPONENT_FUNCTIONAL",
|
|
1732
|
+
"COMPONENT_V_MODEL": "COMPONENT_V_MODEL",
|
|
1733
|
+
"RENDER_FUNCTION": "RENDER_FUNCTION",
|
|
1734
|
+
"FILTERS": "FILTERS",
|
|
1735
|
+
"PRIVATE_APIS": "PRIVATE_APIS"
|
|
1736
|
+
};
|
|
1649
1737
|
function warnDeprecation(key, instance, ...args) {
|
|
1650
1738
|
{
|
|
1651
1739
|
return;
|
|
@@ -2531,7 +2619,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
2531
2619
|
if (delayEnter) {
|
|
2532
2620
|
activeBranch.transition.afterLeave = () => {
|
|
2533
2621
|
if (pendingId === suspense.pendingId) {
|
|
2534
|
-
move(
|
|
2622
|
+
move(
|
|
2623
|
+
pendingBranch,
|
|
2624
|
+
container2,
|
|
2625
|
+
next(activeBranch),
|
|
2626
|
+
0
|
|
2627
|
+
);
|
|
2535
2628
|
queuePostFlushCb(effects);
|
|
2536
2629
|
}
|
|
2537
2630
|
};
|
|
@@ -2578,7 +2671,6 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
2578
2671
|
}
|
|
2579
2672
|
const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
|
|
2580
2673
|
triggerEvent(vnode2, "onFallback");
|
|
2581
|
-
const anchor2 = next(activeBranch);
|
|
2582
2674
|
const mountFallback = () => {
|
|
2583
2675
|
if (!suspense.isInFallback) {
|
|
2584
2676
|
return;
|
|
@@ -2587,7 +2679,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
2587
2679
|
null,
|
|
2588
2680
|
fallbackVNode,
|
|
2589
2681
|
container2,
|
|
2590
|
-
|
|
2682
|
+
next(activeBranch),
|
|
2591
2683
|
parentComponent2,
|
|
2592
2684
|
null,
|
|
2593
2685
|
// fallback tree will not have suspense context
|
|
@@ -5122,7 +5214,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
5122
5214
|
return vm;
|
|
5123
5215
|
}
|
|
5124
5216
|
}
|
|
5125
|
-
Vue.version = `2.6.14-compat:${"3.4.0-alpha.
|
|
5217
|
+
Vue.version = `2.6.14-compat:${"3.4.0-alpha.4"}`;
|
|
5126
5218
|
Vue.config = singletonApp.config;
|
|
5127
5219
|
Vue.use = (p, ...options) => {
|
|
5128
5220
|
if (p && isFunction(p.install)) {
|
|
@@ -8857,7 +8949,7 @@ function isMemoSame(cached, memo) {
|
|
|
8857
8949
|
return true;
|
|
8858
8950
|
}
|
|
8859
8951
|
|
|
8860
|
-
const version = "3.4.0-alpha.
|
|
8952
|
+
const version = "3.4.0-alpha.4";
|
|
8861
8953
|
const ErrorTypeStrings = null;
|
|
8862
8954
|
const _ssrUtils = {
|
|
8863
8955
|
createComponentInstance,
|
|
@@ -8877,6 +8969,7 @@ const _compatUtils = {
|
|
|
8877
8969
|
softAssertCompatEnabled
|
|
8878
8970
|
};
|
|
8879
8971
|
const compatUtils = _compatUtils ;
|
|
8972
|
+
const DeprecationTypes = DeprecationTypes$1 ;
|
|
8880
8973
|
|
|
8881
8974
|
const svgNS = "http://www.w3.org/2000/svg";
|
|
8882
8975
|
const doc = typeof document !== "undefined" ? document : null;
|
|
@@ -9550,7 +9643,8 @@ function patchStopImmediatePropagation(e, value) {
|
|
|
9550
9643
|
}
|
|
9551
9644
|
}
|
|
9552
9645
|
|
|
9553
|
-
const
|
|
9646
|
+
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
|
|
9647
|
+
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
|
|
9554
9648
|
const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
|
|
9555
9649
|
if (key === "class") {
|
|
9556
9650
|
patchClass(el, nextValue, isSVG);
|
|
@@ -9584,7 +9678,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
9584
9678
|
if (key === "innerHTML" || key === "textContent") {
|
|
9585
9679
|
return true;
|
|
9586
9680
|
}
|
|
9587
|
-
if (key in el &&
|
|
9681
|
+
if (key in el && isNativeOn(key) && isFunction(value)) {
|
|
9588
9682
|
return true;
|
|
9589
9683
|
}
|
|
9590
9684
|
return false;
|
|
@@ -9601,7 +9695,11 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
9601
9695
|
if (key === "type" && el.tagName === "TEXTAREA") {
|
|
9602
9696
|
return false;
|
|
9603
9697
|
}
|
|
9604
|
-
if (
|
|
9698
|
+
if (key === "width" || key === "height") {
|
|
9699
|
+
const tag = el.tagName;
|
|
9700
|
+
return !(tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE");
|
|
9701
|
+
}
|
|
9702
|
+
if (isNativeOn(key) && isString(value)) {
|
|
9605
9703
|
return false;
|
|
9606
9704
|
}
|
|
9607
9705
|
return key in el;
|
|
@@ -10243,14 +10341,14 @@ const modifierGuards = {
|
|
|
10243
10341
|
exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
|
|
10244
10342
|
};
|
|
10245
10343
|
const withModifiers = (fn, modifiers) => {
|
|
10246
|
-
return (event, ...args) => {
|
|
10344
|
+
return fn._withMods || (fn._withMods = (event, ...args) => {
|
|
10247
10345
|
for (let i = 0; i < modifiers.length; i++) {
|
|
10248
10346
|
const guard = modifierGuards[modifiers[i]];
|
|
10249
10347
|
if (guard && guard(event, modifiers))
|
|
10250
10348
|
return;
|
|
10251
10349
|
}
|
|
10252
10350
|
return fn(event, ...args);
|
|
10253
|
-
};
|
|
10351
|
+
});
|
|
10254
10352
|
};
|
|
10255
10353
|
const keyNames = {
|
|
10256
10354
|
esc: "escape",
|
|
@@ -10272,7 +10370,7 @@ const withKeys = (fn, modifiers) => {
|
|
|
10272
10370
|
}
|
|
10273
10371
|
}
|
|
10274
10372
|
}
|
|
10275
|
-
return (event) => {
|
|
10373
|
+
return fn._withKeys || (fn._withKeys = (event) => {
|
|
10276
10374
|
if (!("key" in event)) {
|
|
10277
10375
|
return;
|
|
10278
10376
|
}
|
|
@@ -10300,7 +10398,7 @@ const withKeys = (fn, modifiers) => {
|
|
|
10300
10398
|
}
|
|
10301
10399
|
}
|
|
10302
10400
|
}
|
|
10303
|
-
};
|
|
10401
|
+
});
|
|
10304
10402
|
};
|
|
10305
10403
|
|
|
10306
10404
|
const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
|
|
@@ -10373,7 +10471,9 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
|
|
|
10373
10471
|
BaseTransition: BaseTransition,
|
|
10374
10472
|
BaseTransitionPropsValidators: BaseTransitionPropsValidators,
|
|
10375
10473
|
Comment: Comment,
|
|
10474
|
+
DeprecationTypes: DeprecationTypes,
|
|
10376
10475
|
EffectScope: EffectScope,
|
|
10476
|
+
ErrorCodes: ErrorCodes,
|
|
10377
10477
|
ErrorTypeStrings: ErrorTypeStrings,
|
|
10378
10478
|
Fragment: Fragment,
|
|
10379
10479
|
KeepAlive: KeepAlive,
|
|
@@ -10382,8 +10482,10 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
|
|
|
10382
10482
|
Suspense: Suspense,
|
|
10383
10483
|
Teleport: Teleport,
|
|
10384
10484
|
Text: Text,
|
|
10485
|
+
TrackOpTypes: TrackOpTypes,
|
|
10385
10486
|
Transition: Transition,
|
|
10386
10487
|
TransitionGroup: TransitionGroup,
|
|
10488
|
+
TriggerOpTypes: TriggerOpTypes,
|
|
10387
10489
|
VueElement: VueElement,
|
|
10388
10490
|
assertNumber: assertNumber,
|
|
10389
10491
|
callWithAsyncErrorHandling: callWithAsyncErrorHandling,
|
|
@@ -10840,7 +10942,9 @@ class Tokenizer {
|
|
|
10840
10942
|
this.inRCDATA = false;
|
|
10841
10943
|
/** For disabling RCDATA tags handling */
|
|
10842
10944
|
this.inXML = false;
|
|
10843
|
-
/**
|
|
10945
|
+
/** For disabling interpolation parsing in v-pre */
|
|
10946
|
+
this.inVPre = false;
|
|
10947
|
+
/** Record newline positions for fast line / column calculation */
|
|
10844
10948
|
this.newlines = [];
|
|
10845
10949
|
this.mode = 0;
|
|
10846
10950
|
this.delimiterOpen = defaultDelimitersOpen;
|
|
@@ -10865,6 +10969,7 @@ class Tokenizer {
|
|
|
10865
10969
|
this.sectionStart = 0;
|
|
10866
10970
|
this.index = 0;
|
|
10867
10971
|
this.baseState = 1;
|
|
10972
|
+
this.inRCDATA = false;
|
|
10868
10973
|
this.currentSequence = void 0;
|
|
10869
10974
|
this.newlines.length = 0;
|
|
10870
10975
|
this.delimiterOpen = defaultDelimitersOpen;
|
|
@@ -10905,7 +11010,7 @@ class Tokenizer {
|
|
|
10905
11010
|
this.sectionStart = this.index;
|
|
10906
11011
|
} else if (c === 38) {
|
|
10907
11012
|
this.startEntity();
|
|
10908
|
-
} else if (c === this.delimiterOpen[0]) {
|
|
11013
|
+
} else if (!this.inVPre && c === this.delimiterOpen[0]) {
|
|
10909
11014
|
this.state = 2;
|
|
10910
11015
|
this.delimiterIndex = 0;
|
|
10911
11016
|
this.stateInterpolationOpen(c);
|
|
@@ -11723,16 +11828,14 @@ const errorMessages = {
|
|
|
11723
11828
|
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
11724
11829
|
[45]: `Error parsing JavaScript expression: `,
|
|
11725
11830
|
[46]: `<KeepAlive> expects exactly one child component.`,
|
|
11831
|
+
[47]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
|
|
11726
11832
|
// generic errors
|
|
11727
|
-
[
|
|
11728
|
-
[
|
|
11729
|
-
[
|
|
11730
|
-
[
|
|
11731
|
-
// deprecations
|
|
11732
|
-
[51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
|
|
11733
|
-
[52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
|
|
11833
|
+
[48]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
11834
|
+
[49]: `ES module mode is not supported in this build of compiler.`,
|
|
11835
|
+
[50]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
11836
|
+
[51]: `"scopeId" option is only supported in module mode.`,
|
|
11734
11837
|
// just to fulfill types
|
|
11735
|
-
[
|
|
11838
|
+
[52]: ``
|
|
11736
11839
|
};
|
|
11737
11840
|
|
|
11738
11841
|
const isStaticExp = (p) => p.type === 4 && p.isStatic;
|
|
@@ -11982,7 +12085,8 @@ const defaultParserOptions = {
|
|
|
11982
12085
|
isCustomElement: NO,
|
|
11983
12086
|
onError: defaultOnError,
|
|
11984
12087
|
onWarn: defaultOnWarn,
|
|
11985
|
-
comments: false
|
|
12088
|
+
comments: false,
|
|
12089
|
+
prefixIdentifiers: false
|
|
11986
12090
|
};
|
|
11987
12091
|
let currentOptions = defaultParserOptions;
|
|
11988
12092
|
let currentRoot = null;
|
|
@@ -12024,7 +12128,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
12024
12128
|
}
|
|
12025
12129
|
addNode({
|
|
12026
12130
|
type: 5,
|
|
12027
|
-
content:
|
|
12131
|
+
content: createExp(exp, false, getLoc(innerStart, innerEnd)),
|
|
12028
12132
|
loc: getLoc(start, end)
|
|
12029
12133
|
});
|
|
12030
12134
|
},
|
|
@@ -12117,7 +12221,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
12117
12221
|
loc: getLoc(start)
|
|
12118
12222
|
};
|
|
12119
12223
|
if (name === "pre") {
|
|
12120
|
-
inVPre = true;
|
|
12224
|
+
inVPre = tokenizer.inVPre = true;
|
|
12121
12225
|
currentVPreBoundary = currentOpenTag;
|
|
12122
12226
|
const props = currentOpenTag.props;
|
|
12123
12227
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -12129,13 +12233,15 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
12129
12233
|
}
|
|
12130
12234
|
},
|
|
12131
12235
|
ondirarg(start, end) {
|
|
12236
|
+
if (start === end)
|
|
12237
|
+
return;
|
|
12132
12238
|
const arg = getSlice(start, end);
|
|
12133
12239
|
if (inVPre) {
|
|
12134
12240
|
currentProp.name += arg;
|
|
12135
12241
|
setLocEnd(currentProp.nameLoc, end);
|
|
12136
12242
|
} else {
|
|
12137
12243
|
const isStatic = arg[0] !== `[`;
|
|
12138
|
-
currentProp.arg =
|
|
12244
|
+
currentProp.arg = createExp(
|
|
12139
12245
|
isStatic ? arg : arg.slice(1, -1),
|
|
12140
12246
|
isStatic,
|
|
12141
12247
|
getLoc(start, end),
|
|
@@ -12202,10 +12308,22 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
12202
12308
|
tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
|
|
12203
12309
|
}
|
|
12204
12310
|
} else {
|
|
12205
|
-
|
|
12311
|
+
let expParseMode = 0 /* Normal */;
|
|
12312
|
+
{
|
|
12313
|
+
if (currentProp.name === "for") {
|
|
12314
|
+
expParseMode = 3 /* Skip */;
|
|
12315
|
+
} else if (currentProp.name === "slot") {
|
|
12316
|
+
expParseMode = 1 /* Params */;
|
|
12317
|
+
} else if (currentProp.name === "on" && currentAttrValue.includes(";")) {
|
|
12318
|
+
expParseMode = 2 /* Statements */;
|
|
12319
|
+
}
|
|
12320
|
+
}
|
|
12321
|
+
currentProp.exp = createExp(
|
|
12206
12322
|
currentAttrValue,
|
|
12207
12323
|
false,
|
|
12208
|
-
getLoc(currentAttrStartIndex, currentAttrEndIndex)
|
|
12324
|
+
getLoc(currentAttrStartIndex, currentAttrEndIndex),
|
|
12325
|
+
0,
|
|
12326
|
+
expParseMode
|
|
12209
12327
|
);
|
|
12210
12328
|
if (currentProp.name === "for") {
|
|
12211
12329
|
currentProp.forParseResult = parseForExpression(currentProp.exp);
|
|
@@ -12308,10 +12426,16 @@ function parseForExpression(input) {
|
|
|
12308
12426
|
if (!inMatch)
|
|
12309
12427
|
return;
|
|
12310
12428
|
const [, LHS, RHS] = inMatch;
|
|
12311
|
-
const createAliasExpression = (content, offset) => {
|
|
12429
|
+
const createAliasExpression = (content, offset, asParam = false) => {
|
|
12312
12430
|
const start = loc.start.offset + offset;
|
|
12313
12431
|
const end = start + content.length;
|
|
12314
|
-
return
|
|
12432
|
+
return createExp(
|
|
12433
|
+
content,
|
|
12434
|
+
false,
|
|
12435
|
+
getLoc(start, end),
|
|
12436
|
+
0,
|
|
12437
|
+
asParam ? 1 /* Params */ : 0 /* Normal */
|
|
12438
|
+
);
|
|
12315
12439
|
};
|
|
12316
12440
|
const result = {
|
|
12317
12441
|
source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
|
|
@@ -12329,7 +12453,7 @@ function parseForExpression(input) {
|
|
|
12329
12453
|
let keyOffset;
|
|
12330
12454
|
if (keyContent) {
|
|
12331
12455
|
keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
|
|
12332
|
-
result.key = createAliasExpression(keyContent, keyOffset);
|
|
12456
|
+
result.key = createAliasExpression(keyContent, keyOffset, true);
|
|
12333
12457
|
}
|
|
12334
12458
|
if (iteratorMatch[2]) {
|
|
12335
12459
|
const indexContent = iteratorMatch[2].trim();
|
|
@@ -12339,13 +12463,14 @@ function parseForExpression(input) {
|
|
|
12339
12463
|
exp.indexOf(
|
|
12340
12464
|
indexContent,
|
|
12341
12465
|
result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
|
|
12342
|
-
)
|
|
12466
|
+
),
|
|
12467
|
+
true
|
|
12343
12468
|
);
|
|
12344
12469
|
}
|
|
12345
12470
|
}
|
|
12346
12471
|
}
|
|
12347
12472
|
if (valueContent) {
|
|
12348
|
-
result.value = createAliasExpression(valueContent, trimmedOffset);
|
|
12473
|
+
result.value = createAliasExpression(valueContent, trimmedOffset, true);
|
|
12349
12474
|
}
|
|
12350
12475
|
return result;
|
|
12351
12476
|
}
|
|
@@ -12416,7 +12541,7 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
12416
12541
|
inPre--;
|
|
12417
12542
|
}
|
|
12418
12543
|
if (currentVPreBoundary === el) {
|
|
12419
|
-
inVPre = false;
|
|
12544
|
+
inVPre = tokenizer.inVPre = false;
|
|
12420
12545
|
currentVPreBoundary = null;
|
|
12421
12546
|
}
|
|
12422
12547
|
if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
|
|
@@ -12621,8 +12746,36 @@ function dirToAttr(dir) {
|
|
|
12621
12746
|
}
|
|
12622
12747
|
return attr;
|
|
12623
12748
|
}
|
|
12624
|
-
function
|
|
12625
|
-
|
|
12749
|
+
function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
|
|
12750
|
+
const exp = createSimpleExpression(content, isStatic, loc, constType);
|
|
12751
|
+
if (!isStatic && currentOptions.prefixIdentifiers && parseMode !== 3 /* Skip */ && content.trim()) {
|
|
12752
|
+
if (isSimpleIdentifier(content)) {
|
|
12753
|
+
exp.ast = null;
|
|
12754
|
+
return exp;
|
|
12755
|
+
}
|
|
12756
|
+
try {
|
|
12757
|
+
const plugins = currentOptions.expressionPlugins;
|
|
12758
|
+
const options = {
|
|
12759
|
+
plugins: plugins ? [...plugins, "typescript"] : ["typescript"]
|
|
12760
|
+
};
|
|
12761
|
+
if (parseMode === 2 /* Statements */) {
|
|
12762
|
+
exp.ast = parser.parse(` ${content} `, options).program;
|
|
12763
|
+
} else if (parseMode === 1 /* Params */) {
|
|
12764
|
+
exp.ast = parser.parseExpression(`(${content})=>{}`, options);
|
|
12765
|
+
} else {
|
|
12766
|
+
exp.ast = parser.parseExpression(`(${content})`, options);
|
|
12767
|
+
}
|
|
12768
|
+
} catch (e) {
|
|
12769
|
+
exp.ast = false;
|
|
12770
|
+
emitError(45, loc.start.offset, e.message);
|
|
12771
|
+
}
|
|
12772
|
+
}
|
|
12773
|
+
return exp;
|
|
12774
|
+
}
|
|
12775
|
+
function emitError(code, index, message) {
|
|
12776
|
+
currentOptions.onError(
|
|
12777
|
+
createCompilerError(code, getLoc(index, index), void 0, message)
|
|
12778
|
+
);
|
|
12626
12779
|
}
|
|
12627
12780
|
function reset() {
|
|
12628
12781
|
tokenizer.reset();
|
|
@@ -12646,6 +12799,7 @@ function baseParse(input, options) {
|
|
|
12646
12799
|
}
|
|
12647
12800
|
}
|
|
12648
12801
|
tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
|
|
12802
|
+
tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
|
|
12649
12803
|
const delimiters = options == null ? void 0 : options.delimiters;
|
|
12650
12804
|
if (delimiters) {
|
|
12651
12805
|
tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
|
|
@@ -13973,7 +14127,7 @@ function genReturnStatement({ returns }, context) {
|
|
|
13973
14127
|
}
|
|
13974
14128
|
|
|
13975
14129
|
function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
|
|
13976
|
-
const rootExp = root.type === "Program"
|
|
14130
|
+
const rootExp = root.type === "Program" ? root.body[0].type === "ExpressionStatement" && root.body[0].expression : root;
|
|
13977
14131
|
estreeWalker.walk(root, {
|
|
13978
14132
|
enter(node, parent) {
|
|
13979
14133
|
parent && parentStack.push(parent);
|
|
@@ -14322,7 +14476,11 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
14322
14476
|
};
|
|
14323
14477
|
const rawExp = node.content;
|
|
14324
14478
|
const bailConstant = constantBailRE.test(rawExp);
|
|
14325
|
-
|
|
14479
|
+
let ast = node.ast;
|
|
14480
|
+
if (ast === false) {
|
|
14481
|
+
return node;
|
|
14482
|
+
}
|
|
14483
|
+
if (ast === null || !ast && isSimpleIdentifier(rawExp)) {
|
|
14326
14484
|
const isScopeVarReference = context.identifiers[rawExp];
|
|
14327
14485
|
const isAllowedGlobal = isGloballyAllowed(rawExp);
|
|
14328
14486
|
const isLiteral = isLiteralWhitelisted(rawExp);
|
|
@@ -14340,22 +14498,23 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
14340
14498
|
}
|
|
14341
14499
|
return node;
|
|
14342
14500
|
}
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14501
|
+
if (!ast) {
|
|
14502
|
+
const source = asRawStatements ? ` ${rawExp} ` : `(${rawExp})${asParams ? `=>{}` : ``}`;
|
|
14503
|
+
try {
|
|
14504
|
+
ast = parser.parse(source, {
|
|
14505
|
+
plugins: context.expressionPlugins
|
|
14506
|
+
}).program;
|
|
14507
|
+
} catch (e) {
|
|
14508
|
+
context.onError(
|
|
14509
|
+
createCompilerError(
|
|
14510
|
+
45,
|
|
14511
|
+
node.loc,
|
|
14512
|
+
void 0,
|
|
14513
|
+
e.message
|
|
14514
|
+
)
|
|
14515
|
+
);
|
|
14516
|
+
return node;
|
|
14517
|
+
}
|
|
14359
14518
|
}
|
|
14360
14519
|
const ids = [];
|
|
14361
14520
|
const parentStack = [];
|
|
@@ -14398,15 +14557,15 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
14398
14557
|
if (leadingText.length || id.prefix) {
|
|
14399
14558
|
children.push(leadingText + (id.prefix || ``));
|
|
14400
14559
|
}
|
|
14401
|
-
const
|
|
14560
|
+
const source = rawExp.slice(start, end);
|
|
14402
14561
|
children.push(
|
|
14403
14562
|
createSimpleExpression(
|
|
14404
14563
|
id.name,
|
|
14405
14564
|
false,
|
|
14406
14565
|
{
|
|
14407
|
-
start: advancePositionWithClone(node.loc.start,
|
|
14408
|
-
end: advancePositionWithClone(node.loc.start,
|
|
14409
|
-
source
|
|
14566
|
+
start: advancePositionWithClone(node.loc.start, source, start),
|
|
14567
|
+
end: advancePositionWithClone(node.loc.start, source, end),
|
|
14568
|
+
source
|
|
14410
14569
|
},
|
|
14411
14570
|
id.isConstant ? 3 : 0
|
|
14412
14571
|
)
|
|
@@ -14418,6 +14577,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
14418
14577
|
let ret;
|
|
14419
14578
|
if (children.length) {
|
|
14420
14579
|
ret = createCompoundExpression(children, node.loc);
|
|
14580
|
+
ret.ast = ast;
|
|
14421
14581
|
} else {
|
|
14422
14582
|
ret = node;
|
|
14423
14583
|
ret.constType = bailConstant ? 0 : 3;
|
|
@@ -15352,6 +15512,10 @@ function resolveSetupReference(name, context) {
|
|
|
15352
15512
|
`${context.helperString(UNREF)}(${fromMaybeRef})`
|
|
15353
15513
|
) : `$setup[${JSON.stringify(fromMaybeRef)}]`;
|
|
15354
15514
|
}
|
|
15515
|
+
const fromProps = checkType("props");
|
|
15516
|
+
if (fromProps) {
|
|
15517
|
+
return `${context.helperString(UNREF)}(${context.inline ? "__props" : "$props"}[${JSON.stringify(fromProps)}])`;
|
|
15518
|
+
}
|
|
15355
15519
|
}
|
|
15356
15520
|
function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
|
|
15357
15521
|
const { tag, loc: elementLoc, children } = node;
|
|
@@ -15392,6 +15556,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
15392
15556
|
if (isEventHandler && isReservedProp(name)) {
|
|
15393
15557
|
hasVnodeHook = true;
|
|
15394
15558
|
}
|
|
15559
|
+
if (isEventHandler && value.type === 14) {
|
|
15560
|
+
value = value.arguments[0];
|
|
15561
|
+
}
|
|
15395
15562
|
if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
|
|
15396
15563
|
return;
|
|
15397
15564
|
}
|
|
@@ -16364,10 +16531,10 @@ function baseCompile(source, options = {}) {
|
|
|
16364
16531
|
const isModuleMode = options.mode === "module";
|
|
16365
16532
|
const prefixIdentifiers = options.prefixIdentifiers === true || isModuleMode;
|
|
16366
16533
|
if (!prefixIdentifiers && options.cacheHandlers) {
|
|
16367
|
-
onError(createCompilerError(
|
|
16534
|
+
onError(createCompilerError(50));
|
|
16368
16535
|
}
|
|
16369
16536
|
if (options.scopeId && !isModuleMode) {
|
|
16370
|
-
onError(createCompilerError(
|
|
16537
|
+
onError(createCompilerError(51));
|
|
16371
16538
|
}
|
|
16372
16539
|
const ast = isString(source) ? baseParse(source, options) : source;
|
|
16373
16540
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
|