@vue/compat 3.4.0-alpha.3 → 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 +232 -81
- package/dist/vue.cjs.prod.js +228 -63
- package/dist/vue.esm-browser.js +172 -62
- package/dist/vue.esm-browser.prod.js +5 -5
- package/dist/vue.esm-bundler.js +172 -62
- package/dist/vue.global.js +171 -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 +121 -31
- 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 {
|
|
@@ -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++) {
|
|
@@ -12137,7 +12241,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
12137
12241
|
setLocEnd(currentProp.nameLoc, end);
|
|
12138
12242
|
} else {
|
|
12139
12243
|
const isStatic = arg[0] !== `[`;
|
|
12140
|
-
currentProp.arg =
|
|
12244
|
+
currentProp.arg = createExp(
|
|
12141
12245
|
isStatic ? arg : arg.slice(1, -1),
|
|
12142
12246
|
isStatic,
|
|
12143
12247
|
getLoc(start, end),
|
|
@@ -12204,10 +12308,22 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
12204
12308
|
tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
|
|
12205
12309
|
}
|
|
12206
12310
|
} else {
|
|
12207
|
-
|
|
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(
|
|
12208
12322
|
currentAttrValue,
|
|
12209
12323
|
false,
|
|
12210
|
-
getLoc(currentAttrStartIndex, currentAttrEndIndex)
|
|
12324
|
+
getLoc(currentAttrStartIndex, currentAttrEndIndex),
|
|
12325
|
+
0,
|
|
12326
|
+
expParseMode
|
|
12211
12327
|
);
|
|
12212
12328
|
if (currentProp.name === "for") {
|
|
12213
12329
|
currentProp.forParseResult = parseForExpression(currentProp.exp);
|
|
@@ -12310,10 +12426,16 @@ function parseForExpression(input) {
|
|
|
12310
12426
|
if (!inMatch)
|
|
12311
12427
|
return;
|
|
12312
12428
|
const [, LHS, RHS] = inMatch;
|
|
12313
|
-
const createAliasExpression = (content, offset) => {
|
|
12429
|
+
const createAliasExpression = (content, offset, asParam = false) => {
|
|
12314
12430
|
const start = loc.start.offset + offset;
|
|
12315
12431
|
const end = start + content.length;
|
|
12316
|
-
return
|
|
12432
|
+
return createExp(
|
|
12433
|
+
content,
|
|
12434
|
+
false,
|
|
12435
|
+
getLoc(start, end),
|
|
12436
|
+
0,
|
|
12437
|
+
asParam ? 1 /* Params */ : 0 /* Normal */
|
|
12438
|
+
);
|
|
12317
12439
|
};
|
|
12318
12440
|
const result = {
|
|
12319
12441
|
source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
|
|
@@ -12331,7 +12453,7 @@ function parseForExpression(input) {
|
|
|
12331
12453
|
let keyOffset;
|
|
12332
12454
|
if (keyContent) {
|
|
12333
12455
|
keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
|
|
12334
|
-
result.key = createAliasExpression(keyContent, keyOffset);
|
|
12456
|
+
result.key = createAliasExpression(keyContent, keyOffset, true);
|
|
12335
12457
|
}
|
|
12336
12458
|
if (iteratorMatch[2]) {
|
|
12337
12459
|
const indexContent = iteratorMatch[2].trim();
|
|
@@ -12341,13 +12463,14 @@ function parseForExpression(input) {
|
|
|
12341
12463
|
exp.indexOf(
|
|
12342
12464
|
indexContent,
|
|
12343
12465
|
result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
|
|
12344
|
-
)
|
|
12466
|
+
),
|
|
12467
|
+
true
|
|
12345
12468
|
);
|
|
12346
12469
|
}
|
|
12347
12470
|
}
|
|
12348
12471
|
}
|
|
12349
12472
|
if (valueContent) {
|
|
12350
|
-
result.value = createAliasExpression(valueContent, trimmedOffset);
|
|
12473
|
+
result.value = createAliasExpression(valueContent, trimmedOffset, true);
|
|
12351
12474
|
}
|
|
12352
12475
|
return result;
|
|
12353
12476
|
}
|
|
@@ -12418,7 +12541,7 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
12418
12541
|
inPre--;
|
|
12419
12542
|
}
|
|
12420
12543
|
if (currentVPreBoundary === el) {
|
|
12421
|
-
inVPre = false;
|
|
12544
|
+
inVPre = tokenizer.inVPre = false;
|
|
12422
12545
|
currentVPreBoundary = null;
|
|
12423
12546
|
}
|
|
12424
12547
|
if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
|
|
@@ -12623,8 +12746,36 @@ function dirToAttr(dir) {
|
|
|
12623
12746
|
}
|
|
12624
12747
|
return attr;
|
|
12625
12748
|
}
|
|
12626
|
-
function
|
|
12627
|
-
|
|
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
|
+
);
|
|
12628
12779
|
}
|
|
12629
12780
|
function reset() {
|
|
12630
12781
|
tokenizer.reset();
|
|
@@ -12648,6 +12799,7 @@ function baseParse(input, options) {
|
|
|
12648
12799
|
}
|
|
12649
12800
|
}
|
|
12650
12801
|
tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
|
|
12802
|
+
tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
|
|
12651
12803
|
const delimiters = options == null ? void 0 : options.delimiters;
|
|
12652
12804
|
if (delimiters) {
|
|
12653
12805
|
tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
|
|
@@ -13975,7 +14127,7 @@ function genReturnStatement({ returns }, context) {
|
|
|
13975
14127
|
}
|
|
13976
14128
|
|
|
13977
14129
|
function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
|
|
13978
|
-
const rootExp = root.type === "Program"
|
|
14130
|
+
const rootExp = root.type === "Program" ? root.body[0].type === "ExpressionStatement" && root.body[0].expression : root;
|
|
13979
14131
|
estreeWalker.walk(root, {
|
|
13980
14132
|
enter(node, parent) {
|
|
13981
14133
|
parent && parentStack.push(parent);
|
|
@@ -14324,7 +14476,11 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
14324
14476
|
};
|
|
14325
14477
|
const rawExp = node.content;
|
|
14326
14478
|
const bailConstant = constantBailRE.test(rawExp);
|
|
14327
|
-
|
|
14479
|
+
let ast = node.ast;
|
|
14480
|
+
if (ast === false) {
|
|
14481
|
+
return node;
|
|
14482
|
+
}
|
|
14483
|
+
if (ast === null || !ast && isSimpleIdentifier(rawExp)) {
|
|
14328
14484
|
const isScopeVarReference = context.identifiers[rawExp];
|
|
14329
14485
|
const isAllowedGlobal = isGloballyAllowed(rawExp);
|
|
14330
14486
|
const isLiteral = isLiteralWhitelisted(rawExp);
|
|
@@ -14342,22 +14498,23 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
14342
14498
|
}
|
|
14343
14499
|
return node;
|
|
14344
14500
|
}
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
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
|
+
}
|
|
14361
14518
|
}
|
|
14362
14519
|
const ids = [];
|
|
14363
14520
|
const parentStack = [];
|
|
@@ -14400,15 +14557,15 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
14400
14557
|
if (leadingText.length || id.prefix) {
|
|
14401
14558
|
children.push(leadingText + (id.prefix || ``));
|
|
14402
14559
|
}
|
|
14403
|
-
const
|
|
14560
|
+
const source = rawExp.slice(start, end);
|
|
14404
14561
|
children.push(
|
|
14405
14562
|
createSimpleExpression(
|
|
14406
14563
|
id.name,
|
|
14407
14564
|
false,
|
|
14408
14565
|
{
|
|
14409
|
-
start: advancePositionWithClone(node.loc.start,
|
|
14410
|
-
end: advancePositionWithClone(node.loc.start,
|
|
14411
|
-
source
|
|
14566
|
+
start: advancePositionWithClone(node.loc.start, source, start),
|
|
14567
|
+
end: advancePositionWithClone(node.loc.start, source, end),
|
|
14568
|
+
source
|
|
14412
14569
|
},
|
|
14413
14570
|
id.isConstant ? 3 : 0
|
|
14414
14571
|
)
|
|
@@ -14420,6 +14577,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
14420
14577
|
let ret;
|
|
14421
14578
|
if (children.length) {
|
|
14422
14579
|
ret = createCompoundExpression(children, node.loc);
|
|
14580
|
+
ret.ast = ast;
|
|
14423
14581
|
} else {
|
|
14424
14582
|
ret = node;
|
|
14425
14583
|
ret.constType = bailConstant ? 0 : 3;
|
|
@@ -15354,6 +15512,10 @@ function resolveSetupReference(name, context) {
|
|
|
15354
15512
|
`${context.helperString(UNREF)}(${fromMaybeRef})`
|
|
15355
15513
|
) : `$setup[${JSON.stringify(fromMaybeRef)}]`;
|
|
15356
15514
|
}
|
|
15515
|
+
const fromProps = checkType("props");
|
|
15516
|
+
if (fromProps) {
|
|
15517
|
+
return `${context.helperString(UNREF)}(${context.inline ? "__props" : "$props"}[${JSON.stringify(fromProps)}])`;
|
|
15518
|
+
}
|
|
15357
15519
|
}
|
|
15358
15520
|
function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
|
|
15359
15521
|
const { tag, loc: elementLoc, children } = node;
|
|
@@ -15394,6 +15556,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
15394
15556
|
if (isEventHandler && isReservedProp(name)) {
|
|
15395
15557
|
hasVnodeHook = true;
|
|
15396
15558
|
}
|
|
15559
|
+
if (isEventHandler && value.type === 14) {
|
|
15560
|
+
value = value.arguments[0];
|
|
15561
|
+
}
|
|
15397
15562
|
if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
|
|
15398
15563
|
return;
|
|
15399
15564
|
}
|
|
@@ -16366,10 +16531,10 @@ function baseCompile(source, options = {}) {
|
|
|
16366
16531
|
const isModuleMode = options.mode === "module";
|
|
16367
16532
|
const prefixIdentifiers = options.prefixIdentifiers === true || isModuleMode;
|
|
16368
16533
|
if (!prefixIdentifiers && options.cacheHandlers) {
|
|
16369
|
-
onError(createCompilerError(
|
|
16534
|
+
onError(createCompilerError(50));
|
|
16370
16535
|
}
|
|
16371
16536
|
if (options.scopeId && !isModuleMode) {
|
|
16372
|
-
onError(createCompilerError(
|
|
16537
|
+
onError(createCompilerError(51));
|
|
16373
16538
|
}
|
|
16374
16539
|
const ast = isString(source) ? baseParse(source, options) : source;
|
|
16375
16540
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
|