@vue/compat 3.5.0-beta.1 → 3.5.0-beta.3
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 +412 -280
- package/dist/vue.cjs.prod.js +392 -266
- package/dist/vue.esm-browser.js +342 -279
- package/dist/vue.esm-browser.prod.js +6 -6
- package/dist/vue.esm-bundler.js +342 -279
- package/dist/vue.global.js +330 -258
- package/dist/vue.global.prod.js +6 -6
- package/dist/vue.runtime.esm-browser.js +320 -273
- package/dist/vue.runtime.esm-browser.prod.js +2 -2
- package/dist/vue.runtime.esm-bundler.js +320 -273
- package/dist/vue.runtime.global.js +308 -252
- package/dist/vue.runtime.global.prod.js +2 -2
- package/package.json +2 -2
package/dist/vue.cjs.prod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compat v3.5.0-beta.
|
|
2
|
+
* @vue/compat v3.5.0-beta.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
var parser = require('@babel/parser');
|
|
9
9
|
var estreeWalker = require('estree-walker');
|
|
10
|
-
var decode_js = require('entities/
|
|
10
|
+
var decode_js = require('entities/lib/decode.js');
|
|
11
11
|
var sourceMapJs = require('source-map-js');
|
|
12
12
|
|
|
13
13
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
@@ -501,11 +501,11 @@ class ReactiveEffect {
|
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
503
|
pause() {
|
|
504
|
-
this.flags |=
|
|
504
|
+
this.flags |= 64;
|
|
505
505
|
}
|
|
506
506
|
resume() {
|
|
507
|
-
if (this.flags &
|
|
508
|
-
this.flags &= ~
|
|
507
|
+
if (this.flags & 64) {
|
|
508
|
+
this.flags &= ~64;
|
|
509
509
|
if (pausedQueueEffects.has(this)) {
|
|
510
510
|
pausedQueueEffects.delete(this);
|
|
511
511
|
this.trigger();
|
|
@@ -519,9 +519,6 @@ class ReactiveEffect {
|
|
|
519
519
|
if (this.flags & 2 && !(this.flags & 32)) {
|
|
520
520
|
return;
|
|
521
521
|
}
|
|
522
|
-
if (this.flags & 64) {
|
|
523
|
-
return this.trigger();
|
|
524
|
-
}
|
|
525
522
|
if (!(this.flags & 8)) {
|
|
526
523
|
this.flags |= 8;
|
|
527
524
|
this.nextEffect = batchedEffect;
|
|
@@ -560,7 +557,7 @@ class ReactiveEffect {
|
|
|
560
557
|
}
|
|
561
558
|
}
|
|
562
559
|
trigger() {
|
|
563
|
-
if (this.flags &
|
|
560
|
+
if (this.flags & 64) {
|
|
564
561
|
pausedQueueEffects.add(this);
|
|
565
562
|
} else if (this.scheduler) {
|
|
566
563
|
this.scheduler();
|
|
@@ -590,6 +587,7 @@ function endBatch() {
|
|
|
590
587
|
batchDepth--;
|
|
591
588
|
return;
|
|
592
589
|
}
|
|
590
|
+
batchDepth--;
|
|
593
591
|
let error;
|
|
594
592
|
while (batchedEffect) {
|
|
595
593
|
let e = batchedEffect;
|
|
@@ -608,7 +606,6 @@ function endBatch() {
|
|
|
608
606
|
e = next;
|
|
609
607
|
}
|
|
610
608
|
}
|
|
611
|
-
batchDepth--;
|
|
612
609
|
if (error) throw error;
|
|
613
610
|
}
|
|
614
611
|
function prepareDeps(sub) {
|
|
@@ -971,26 +968,26 @@ const arrayInstrumentations = {
|
|
|
971
968
|
});
|
|
972
969
|
},
|
|
973
970
|
every(fn, thisArg) {
|
|
974
|
-
return apply(this, "every", fn, thisArg);
|
|
971
|
+
return apply(this, "every", fn, thisArg, void 0, arguments);
|
|
975
972
|
},
|
|
976
973
|
filter(fn, thisArg) {
|
|
977
|
-
return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive));
|
|
974
|
+
return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
|
|
978
975
|
},
|
|
979
976
|
find(fn, thisArg) {
|
|
980
|
-
return apply(this, "find", fn, thisArg, toReactive);
|
|
977
|
+
return apply(this, "find", fn, thisArg, toReactive, arguments);
|
|
981
978
|
},
|
|
982
979
|
findIndex(fn, thisArg) {
|
|
983
|
-
return apply(this, "findIndex", fn, thisArg);
|
|
980
|
+
return apply(this, "findIndex", fn, thisArg, void 0, arguments);
|
|
984
981
|
},
|
|
985
982
|
findLast(fn, thisArg) {
|
|
986
|
-
return apply(this, "findLast", fn, thisArg, toReactive);
|
|
983
|
+
return apply(this, "findLast", fn, thisArg, toReactive, arguments);
|
|
987
984
|
},
|
|
988
985
|
findLastIndex(fn, thisArg) {
|
|
989
|
-
return apply(this, "findLastIndex", fn, thisArg);
|
|
986
|
+
return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
|
|
990
987
|
},
|
|
991
988
|
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
992
989
|
forEach(fn, thisArg) {
|
|
993
|
-
return apply(this, "forEach", fn, thisArg);
|
|
990
|
+
return apply(this, "forEach", fn, thisArg, void 0, arguments);
|
|
994
991
|
},
|
|
995
992
|
includes(...args) {
|
|
996
993
|
return searchProxy(this, "includes", args);
|
|
@@ -1006,7 +1003,7 @@ const arrayInstrumentations = {
|
|
|
1006
1003
|
return searchProxy(this, "lastIndexOf", args);
|
|
1007
1004
|
},
|
|
1008
1005
|
map(fn, thisArg) {
|
|
1009
|
-
return apply(this, "map", fn, thisArg);
|
|
1006
|
+
return apply(this, "map", fn, thisArg, void 0, arguments);
|
|
1010
1007
|
},
|
|
1011
1008
|
pop() {
|
|
1012
1009
|
return noTracking(this, "pop");
|
|
@@ -1025,7 +1022,7 @@ const arrayInstrumentations = {
|
|
|
1025
1022
|
},
|
|
1026
1023
|
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
1027
1024
|
some(fn, thisArg) {
|
|
1028
|
-
return apply(this, "some", fn, thisArg);
|
|
1025
|
+
return apply(this, "some", fn, thisArg, void 0, arguments);
|
|
1029
1026
|
},
|
|
1030
1027
|
splice(...args) {
|
|
1031
1028
|
return noTracking(this, "splice", args);
|
|
@@ -1061,12 +1058,17 @@ function iterator(self, method, wrapValue) {
|
|
|
1061
1058
|
}
|
|
1062
1059
|
return iter;
|
|
1063
1060
|
}
|
|
1064
|
-
|
|
1061
|
+
const arrayProto = Array.prototype;
|
|
1062
|
+
function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
1065
1063
|
const arr = shallowReadArray(self);
|
|
1066
|
-
|
|
1064
|
+
const needsWrap = arr !== self && !isShallow(self);
|
|
1065
|
+
const methodFn = arr[method];
|
|
1066
|
+
if (methodFn !== arrayProto[method]) {
|
|
1067
|
+
const result2 = methodFn.apply(arr, args);
|
|
1068
|
+
return needsWrap ? toReactive(result2) : result2;
|
|
1069
|
+
}
|
|
1067
1070
|
let wrappedFn = fn;
|
|
1068
1071
|
if (arr !== self) {
|
|
1069
|
-
needsWrap = !isShallow(self);
|
|
1070
1072
|
if (needsWrap) {
|
|
1071
1073
|
wrappedFn = function(item, index) {
|
|
1072
1074
|
return fn.call(this, toReactive(item), index, self);
|
|
@@ -1077,7 +1079,7 @@ function apply(self, method, fn, thisArg, wrappedRetFn) {
|
|
|
1077
1079
|
};
|
|
1078
1080
|
}
|
|
1079
1081
|
}
|
|
1080
|
-
const result = arr
|
|
1082
|
+
const result = methodFn.call(arr, wrappedFn, thisArg);
|
|
1081
1083
|
return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
|
|
1082
1084
|
}
|
|
1083
1085
|
function reduce(self, method, fn, args) {
|
|
@@ -1860,6 +1862,202 @@ const TriggerOpTypes = {
|
|
|
1860
1862
|
"CLEAR": "clear"
|
|
1861
1863
|
};
|
|
1862
1864
|
|
|
1865
|
+
const INITIAL_WATCHER_VALUE = {};
|
|
1866
|
+
const cleanupMap = /* @__PURE__ */ new WeakMap();
|
|
1867
|
+
let activeWatcher = void 0;
|
|
1868
|
+
function getCurrentWatcher() {
|
|
1869
|
+
return activeWatcher;
|
|
1870
|
+
}
|
|
1871
|
+
function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
|
|
1872
|
+
if (owner) {
|
|
1873
|
+
let cleanups = cleanupMap.get(owner);
|
|
1874
|
+
if (!cleanups) cleanupMap.set(owner, cleanups = []);
|
|
1875
|
+
cleanups.push(cleanupFn);
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
function watch$1(source, cb, options = EMPTY_OBJ) {
|
|
1879
|
+
const { immediate, deep, once, scheduler, augmentJob, call } = options;
|
|
1880
|
+
const reactiveGetter = (source2) => {
|
|
1881
|
+
if (deep) return source2;
|
|
1882
|
+
if (isShallow(source2) || deep === false || deep === 0)
|
|
1883
|
+
return traverse(source2, 1);
|
|
1884
|
+
return traverse(source2);
|
|
1885
|
+
};
|
|
1886
|
+
let effect;
|
|
1887
|
+
let getter;
|
|
1888
|
+
let cleanup;
|
|
1889
|
+
let boundCleanup;
|
|
1890
|
+
let forceTrigger = false;
|
|
1891
|
+
let isMultiSource = false;
|
|
1892
|
+
if (isRef(source)) {
|
|
1893
|
+
getter = () => source.value;
|
|
1894
|
+
forceTrigger = isShallow(source);
|
|
1895
|
+
} else if (isReactive(source)) {
|
|
1896
|
+
getter = () => reactiveGetter(source);
|
|
1897
|
+
forceTrigger = true;
|
|
1898
|
+
} else if (isArray(source)) {
|
|
1899
|
+
isMultiSource = true;
|
|
1900
|
+
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
1901
|
+
getter = () => source.map((s) => {
|
|
1902
|
+
if (isRef(s)) {
|
|
1903
|
+
return s.value;
|
|
1904
|
+
} else if (isReactive(s)) {
|
|
1905
|
+
return reactiveGetter(s);
|
|
1906
|
+
} else if (isFunction(s)) {
|
|
1907
|
+
return call ? call(s, 2) : s();
|
|
1908
|
+
} else ;
|
|
1909
|
+
});
|
|
1910
|
+
} else if (isFunction(source)) {
|
|
1911
|
+
if (cb) {
|
|
1912
|
+
getter = call ? () => call(source, 2) : source;
|
|
1913
|
+
} else {
|
|
1914
|
+
getter = () => {
|
|
1915
|
+
if (cleanup) {
|
|
1916
|
+
pauseTracking();
|
|
1917
|
+
try {
|
|
1918
|
+
cleanup();
|
|
1919
|
+
} finally {
|
|
1920
|
+
resetTracking();
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
const currentEffect = activeWatcher;
|
|
1924
|
+
activeWatcher = effect;
|
|
1925
|
+
try {
|
|
1926
|
+
return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
|
|
1927
|
+
} finally {
|
|
1928
|
+
activeWatcher = currentEffect;
|
|
1929
|
+
}
|
|
1930
|
+
};
|
|
1931
|
+
}
|
|
1932
|
+
} else {
|
|
1933
|
+
getter = NOOP;
|
|
1934
|
+
}
|
|
1935
|
+
if (cb && deep) {
|
|
1936
|
+
const baseGetter = getter;
|
|
1937
|
+
const depth = deep === true ? Infinity : deep;
|
|
1938
|
+
getter = () => traverse(baseGetter(), depth);
|
|
1939
|
+
}
|
|
1940
|
+
if (once) {
|
|
1941
|
+
if (cb) {
|
|
1942
|
+
const _cb = cb;
|
|
1943
|
+
cb = (...args) => {
|
|
1944
|
+
_cb(...args);
|
|
1945
|
+
effect.stop();
|
|
1946
|
+
};
|
|
1947
|
+
} else {
|
|
1948
|
+
const _getter = getter;
|
|
1949
|
+
getter = () => {
|
|
1950
|
+
_getter();
|
|
1951
|
+
effect.stop();
|
|
1952
|
+
};
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
1956
|
+
const job = (immediateFirstRun) => {
|
|
1957
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
1958
|
+
return;
|
|
1959
|
+
}
|
|
1960
|
+
if (cb) {
|
|
1961
|
+
const newValue = effect.run();
|
|
1962
|
+
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
1963
|
+
if (cleanup) {
|
|
1964
|
+
cleanup();
|
|
1965
|
+
}
|
|
1966
|
+
const currentWatcher = activeWatcher;
|
|
1967
|
+
activeWatcher = effect;
|
|
1968
|
+
try {
|
|
1969
|
+
const args = [
|
|
1970
|
+
newValue,
|
|
1971
|
+
// pass undefined as the old value when it's changed for the first time
|
|
1972
|
+
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
1973
|
+
boundCleanup
|
|
1974
|
+
];
|
|
1975
|
+
call ? call(cb, 3, args) : (
|
|
1976
|
+
// @ts-expect-error
|
|
1977
|
+
cb(...args)
|
|
1978
|
+
);
|
|
1979
|
+
oldValue = newValue;
|
|
1980
|
+
} finally {
|
|
1981
|
+
activeWatcher = currentWatcher;
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
} else {
|
|
1985
|
+
effect.run();
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1988
|
+
if (augmentJob) {
|
|
1989
|
+
augmentJob(job);
|
|
1990
|
+
}
|
|
1991
|
+
effect = new ReactiveEffect(getter);
|
|
1992
|
+
effect.scheduler = scheduler ? () => scheduler(job, false) : job;
|
|
1993
|
+
boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
|
|
1994
|
+
cleanup = effect.onStop = () => {
|
|
1995
|
+
const cleanups = cleanupMap.get(effect);
|
|
1996
|
+
if (cleanups) {
|
|
1997
|
+
if (call) {
|
|
1998
|
+
call(cleanups, 4);
|
|
1999
|
+
} else {
|
|
2000
|
+
for (const cleanup2 of cleanups) cleanup2();
|
|
2001
|
+
}
|
|
2002
|
+
cleanupMap.delete(effect);
|
|
2003
|
+
}
|
|
2004
|
+
};
|
|
2005
|
+
if (cb) {
|
|
2006
|
+
if (immediate) {
|
|
2007
|
+
job(true);
|
|
2008
|
+
} else {
|
|
2009
|
+
oldValue = effect.run();
|
|
2010
|
+
}
|
|
2011
|
+
} else if (scheduler) {
|
|
2012
|
+
scheduler(job.bind(null, true), true);
|
|
2013
|
+
} else {
|
|
2014
|
+
effect.run();
|
|
2015
|
+
}
|
|
2016
|
+
const scope = getCurrentScope();
|
|
2017
|
+
const watchHandle = () => {
|
|
2018
|
+
effect.stop();
|
|
2019
|
+
if (scope) {
|
|
2020
|
+
remove(scope.effects, effect);
|
|
2021
|
+
}
|
|
2022
|
+
};
|
|
2023
|
+
watchHandle.pause = effect.pause.bind(effect);
|
|
2024
|
+
watchHandle.resume = effect.resume.bind(effect);
|
|
2025
|
+
watchHandle.stop = watchHandle;
|
|
2026
|
+
return watchHandle;
|
|
2027
|
+
}
|
|
2028
|
+
function traverse(value, depth = Infinity, seen) {
|
|
2029
|
+
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
2030
|
+
return value;
|
|
2031
|
+
}
|
|
2032
|
+
seen = seen || /* @__PURE__ */ new Set();
|
|
2033
|
+
if (seen.has(value)) {
|
|
2034
|
+
return value;
|
|
2035
|
+
}
|
|
2036
|
+
seen.add(value);
|
|
2037
|
+
depth--;
|
|
2038
|
+
if (isRef(value)) {
|
|
2039
|
+
traverse(value.value, depth, seen);
|
|
2040
|
+
} else if (isArray(value)) {
|
|
2041
|
+
for (let i = 0; i < value.length; i++) {
|
|
2042
|
+
traverse(value[i], depth, seen);
|
|
2043
|
+
}
|
|
2044
|
+
} else if (isSet(value) || isMap(value)) {
|
|
2045
|
+
value.forEach((v) => {
|
|
2046
|
+
traverse(v, depth, seen);
|
|
2047
|
+
});
|
|
2048
|
+
} else if (isPlainObject(value)) {
|
|
2049
|
+
for (const key in value) {
|
|
2050
|
+
traverse(value[key], depth, seen);
|
|
2051
|
+
}
|
|
2052
|
+
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
2053
|
+
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
2054
|
+
traverse(value[key], depth, seen);
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
return value;
|
|
2059
|
+
}
|
|
2060
|
+
|
|
1863
2061
|
function assertNumber(val, type) {
|
|
1864
2062
|
return;
|
|
1865
2063
|
}
|
|
@@ -1869,12 +2067,6 @@ const ErrorCodes = {
|
|
|
1869
2067
|
"0": "SETUP_FUNCTION",
|
|
1870
2068
|
"RENDER_FUNCTION": 1,
|
|
1871
2069
|
"1": "RENDER_FUNCTION",
|
|
1872
|
-
"WATCH_GETTER": 2,
|
|
1873
|
-
"2": "WATCH_GETTER",
|
|
1874
|
-
"WATCH_CALLBACK": 3,
|
|
1875
|
-
"3": "WATCH_CALLBACK",
|
|
1876
|
-
"WATCH_CLEANUP": 4,
|
|
1877
|
-
"4": "WATCH_CLEANUP",
|
|
1878
2070
|
"NATIVE_EVENT_HANDLER": 5,
|
|
1879
2071
|
"5": "NATIVE_EVENT_HANDLER",
|
|
1880
2072
|
"COMPONENT_EVENT_HANDLER": 6,
|
|
@@ -2011,7 +2203,7 @@ function nextTick(fn) {
|
|
|
2011
2203
|
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
2012
2204
|
}
|
|
2013
2205
|
function findInsertionIndex(id) {
|
|
2014
|
-
let start = flushIndex + 1;
|
|
2206
|
+
let start = isFlushing ? flushIndex + 1 : 0;
|
|
2015
2207
|
let end = queue.length;
|
|
2016
2208
|
while (start < end) {
|
|
2017
2209
|
const middle = start + end >>> 1;
|
|
@@ -2027,15 +2219,13 @@ function findInsertionIndex(id) {
|
|
|
2027
2219
|
}
|
|
2028
2220
|
function queueJob(job) {
|
|
2029
2221
|
if (!(job.flags & 1)) {
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
!(job.flags & 2) && job.id >= (queue[queue.length - 1] && queue[queue.length - 1].id || 0)
|
|
2035
|
-
) {
|
|
2222
|
+
const jobId = getId(job);
|
|
2223
|
+
const lastJob = queue[queue.length - 1];
|
|
2224
|
+
if (!lastJob || // fast path when the job id is larger than the tail
|
|
2225
|
+
!(job.flags & 2) && jobId >= getId(lastJob)) {
|
|
2036
2226
|
queue.push(job);
|
|
2037
2227
|
} else {
|
|
2038
|
-
queue.splice(findInsertionIndex(
|
|
2228
|
+
queue.splice(findInsertionIndex(jobId), 0, job);
|
|
2039
2229
|
}
|
|
2040
2230
|
if (!(job.flags & 4)) {
|
|
2041
2231
|
job.flags |= 1;
|
|
@@ -2049,12 +2239,6 @@ function queueFlush() {
|
|
|
2049
2239
|
currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
2050
2240
|
}
|
|
2051
2241
|
}
|
|
2052
|
-
function invalidateJob(job) {
|
|
2053
|
-
const i = queue.indexOf(job);
|
|
2054
|
-
if (i > flushIndex) {
|
|
2055
|
-
queue.splice(i, 1);
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
2242
|
function queuePostFlushCb(cb) {
|
|
2059
2243
|
if (!isArray(cb)) {
|
|
2060
2244
|
if (activePostFlushCbs && cb.id === -1) {
|
|
@@ -2104,21 +2288,10 @@ function flushPostFlushCbs(seen) {
|
|
|
2104
2288
|
postFlushIndex = 0;
|
|
2105
2289
|
}
|
|
2106
2290
|
}
|
|
2107
|
-
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
2108
|
-
const comparator = (a, b) => {
|
|
2109
|
-
const diff = getId(a) - getId(b);
|
|
2110
|
-
if (diff === 0) {
|
|
2111
|
-
const isAPre = a.flags & 2;
|
|
2112
|
-
const isBPre = b.flags & 2;
|
|
2113
|
-
if (isAPre && !isBPre) return -1;
|
|
2114
|
-
if (isBPre && !isAPre) return 1;
|
|
2115
|
-
}
|
|
2116
|
-
return diff;
|
|
2117
|
-
};
|
|
2291
|
+
const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
|
|
2118
2292
|
function flushJobs(seen) {
|
|
2119
2293
|
isFlushPending = false;
|
|
2120
2294
|
isFlushing = true;
|
|
2121
|
-
queue.sort(comparator);
|
|
2122
2295
|
try {
|
|
2123
2296
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
2124
2297
|
const job = queue[flushIndex];
|
|
@@ -2261,7 +2434,7 @@ function on(instance, event, fn) {
|
|
|
2261
2434
|
function once(instance, event, fn) {
|
|
2262
2435
|
const wrapped = (...args) => {
|
|
2263
2436
|
off(instance, event, wrapped);
|
|
2264
|
-
fn.
|
|
2437
|
+
fn.apply(instance.proxy, args);
|
|
2265
2438
|
};
|
|
2266
2439
|
wrapped.fn = fn;
|
|
2267
2440
|
on(instance, event, wrapped);
|
|
@@ -3229,6 +3402,7 @@ const logMismatchError = () => {
|
|
|
3229
3402
|
const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
|
|
3230
3403
|
const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
|
|
3231
3404
|
const getContainerType = (container) => {
|
|
3405
|
+
if (container.nodeType !== 1) return void 0;
|
|
3232
3406
|
if (isSVGContainer(container)) return "svg";
|
|
3233
3407
|
if (isMathMLContainer(container)) return "mathml";
|
|
3234
3408
|
return void 0;
|
|
@@ -3975,7 +4149,7 @@ const KeepAliveImpl = {
|
|
|
3975
4149
|
function pruneCache(filter) {
|
|
3976
4150
|
cache.forEach((vnode, key) => {
|
|
3977
4151
|
const name = getComponentName(vnode.type);
|
|
3978
|
-
if (name &&
|
|
4152
|
+
if (name && !filter(name)) {
|
|
3979
4153
|
pruneCacheEntry(key);
|
|
3980
4154
|
}
|
|
3981
4155
|
});
|
|
@@ -4094,6 +4268,7 @@ function matches(pattern, name) {
|
|
|
4094
4268
|
} else if (isString(pattern)) {
|
|
4095
4269
|
return pattern.split(",").includes(name);
|
|
4096
4270
|
} else if (isRegExp(pattern)) {
|
|
4271
|
+
pattern.lastIndex = 0;
|
|
4097
4272
|
return pattern.test(name);
|
|
4098
4273
|
}
|
|
4099
4274
|
return false;
|
|
@@ -5297,21 +5472,41 @@ function callHook$1(hook, instance, type) {
|
|
|
5297
5472
|
);
|
|
5298
5473
|
}
|
|
5299
5474
|
function createWatcher(raw, ctx, publicThis, key) {
|
|
5300
|
-
|
|
5475
|
+
let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
|
|
5476
|
+
const options = {};
|
|
5477
|
+
{
|
|
5478
|
+
const instance = currentInstance && getCurrentScope() === currentInstance.scope ? currentInstance : null;
|
|
5479
|
+
const newValue = getter();
|
|
5480
|
+
if (isArray(newValue) && isCompatEnabled$1("WATCH_ARRAY", instance)) {
|
|
5481
|
+
options.deep = true;
|
|
5482
|
+
}
|
|
5483
|
+
const baseGetter = getter;
|
|
5484
|
+
getter = () => {
|
|
5485
|
+
const val = baseGetter();
|
|
5486
|
+
if (isArray(val) && checkCompatEnabled$1("WATCH_ARRAY", instance)) {
|
|
5487
|
+
traverse(val);
|
|
5488
|
+
}
|
|
5489
|
+
return val;
|
|
5490
|
+
};
|
|
5491
|
+
}
|
|
5301
5492
|
if (isString(raw)) {
|
|
5302
5493
|
const handler = ctx[raw];
|
|
5303
5494
|
if (isFunction(handler)) {
|
|
5304
|
-
|
|
5495
|
+
{
|
|
5496
|
+
watch(getter, handler, options);
|
|
5497
|
+
}
|
|
5305
5498
|
}
|
|
5306
5499
|
} else if (isFunction(raw)) {
|
|
5307
|
-
|
|
5500
|
+
{
|
|
5501
|
+
watch(getter, raw.bind(publicThis), options);
|
|
5502
|
+
}
|
|
5308
5503
|
} else if (isObject(raw)) {
|
|
5309
5504
|
if (isArray(raw)) {
|
|
5310
5505
|
raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
|
5311
5506
|
} else {
|
|
5312
5507
|
const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
|
|
5313
5508
|
if (isFunction(handler)) {
|
|
5314
|
-
watch(getter, handler, raw);
|
|
5509
|
+
watch(getter, handler, extend$1(raw, options) );
|
|
5315
5510
|
}
|
|
5316
5511
|
}
|
|
5317
5512
|
} else ;
|
|
@@ -5502,7 +5697,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
5502
5697
|
return vm;
|
|
5503
5698
|
}
|
|
5504
5699
|
}
|
|
5505
|
-
Vue.version = `2.6.14-compat:${"3.5.0-beta.
|
|
5700
|
+
Vue.version = `2.6.14-compat:${"3.5.0-beta.3"}`;
|
|
5506
5701
|
Vue.config = singletonApp.config;
|
|
5507
5702
|
Vue.use = (plugin, ...options) => {
|
|
5508
5703
|
if (plugin && isFunction(plugin.install)) {
|
|
@@ -5796,7 +5991,7 @@ function defineReactive(obj, key, val) {
|
|
|
5796
5991
|
if (isArray(val)) {
|
|
5797
5992
|
methodsToPatch.forEach((m) => {
|
|
5798
5993
|
val[m] = (...args) => {
|
|
5799
|
-
Array.prototype[m].
|
|
5994
|
+
Array.prototype[m].apply(reactiveVal, args);
|
|
5800
5995
|
};
|
|
5801
5996
|
});
|
|
5802
5997
|
} else {
|
|
@@ -6694,7 +6889,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6694
6889
|
}
|
|
6695
6890
|
if (parentComponent) {
|
|
6696
6891
|
let subTree = parentComponent.subTree;
|
|
6697
|
-
if (vnode === subTree) {
|
|
6892
|
+
if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
|
|
6698
6893
|
const parentVNode = parentComponent.vnode;
|
|
6699
6894
|
setScopeId(
|
|
6700
6895
|
el,
|
|
@@ -6993,7 +7188,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6993
7188
|
return;
|
|
6994
7189
|
} else {
|
|
6995
7190
|
instance.next = n2;
|
|
6996
|
-
invalidateJob(instance.update);
|
|
6997
7191
|
instance.update();
|
|
6998
7192
|
}
|
|
6999
7193
|
} else {
|
|
@@ -7836,179 +8030,57 @@ function watchSyncEffect(effect, options) {
|
|
|
7836
8030
|
{ flush: "sync" }
|
|
7837
8031
|
);
|
|
7838
8032
|
}
|
|
7839
|
-
const INITIAL_WATCHER_VALUE = {};
|
|
7840
8033
|
function watch(source, cb, options) {
|
|
7841
8034
|
return doWatch(source, cb, options);
|
|
7842
8035
|
}
|
|
7843
|
-
function doWatch(source, cb, {
|
|
7844
|
-
immediate,
|
|
7845
|
-
|
|
7846
|
-
flush,
|
|
7847
|
-
once,
|
|
7848
|
-
onTrack,
|
|
7849
|
-
onTrigger
|
|
7850
|
-
} = EMPTY_OBJ) {
|
|
7851
|
-
if (cb && once) {
|
|
7852
|
-
const _cb = cb;
|
|
7853
|
-
cb = (...args) => {
|
|
7854
|
-
_cb(...args);
|
|
7855
|
-
watchHandle();
|
|
7856
|
-
};
|
|
7857
|
-
}
|
|
7858
|
-
const instance = currentInstance;
|
|
7859
|
-
const reactiveGetter = (source2) => {
|
|
7860
|
-
if (deep) return source2;
|
|
7861
|
-
if (isShallow(source2) || deep === false || deep === 0)
|
|
7862
|
-
return traverse(source2, 1);
|
|
7863
|
-
return traverse(source2);
|
|
7864
|
-
};
|
|
7865
|
-
let getter;
|
|
7866
|
-
let forceTrigger = false;
|
|
7867
|
-
let isMultiSource = false;
|
|
7868
|
-
if (isRef(source)) {
|
|
7869
|
-
getter = () => source.value;
|
|
7870
|
-
forceTrigger = isShallow(source);
|
|
7871
|
-
} else if (isReactive(source)) {
|
|
7872
|
-
getter = () => reactiveGetter(source);
|
|
7873
|
-
forceTrigger = true;
|
|
7874
|
-
} else if (isArray(source)) {
|
|
7875
|
-
isMultiSource = true;
|
|
7876
|
-
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
7877
|
-
getter = () => source.map((s) => {
|
|
7878
|
-
if (isRef(s)) {
|
|
7879
|
-
return s.value;
|
|
7880
|
-
} else if (isReactive(s)) {
|
|
7881
|
-
return reactiveGetter(s);
|
|
7882
|
-
} else if (isFunction(s)) {
|
|
7883
|
-
return callWithErrorHandling(s, instance, 2);
|
|
7884
|
-
} else ;
|
|
7885
|
-
});
|
|
7886
|
-
} else if (isFunction(source)) {
|
|
7887
|
-
if (cb) {
|
|
7888
|
-
getter = () => callWithErrorHandling(source, instance, 2);
|
|
7889
|
-
} else {
|
|
7890
|
-
getter = () => {
|
|
7891
|
-
if (cleanup) {
|
|
7892
|
-
cleanup();
|
|
7893
|
-
}
|
|
7894
|
-
return callWithAsyncErrorHandling(
|
|
7895
|
-
source,
|
|
7896
|
-
instance,
|
|
7897
|
-
3,
|
|
7898
|
-
[onCleanup]
|
|
7899
|
-
);
|
|
7900
|
-
};
|
|
7901
|
-
}
|
|
7902
|
-
} else {
|
|
7903
|
-
getter = NOOP;
|
|
7904
|
-
}
|
|
7905
|
-
if (cb && !deep) {
|
|
7906
|
-
const baseGetter = getter;
|
|
7907
|
-
getter = () => {
|
|
7908
|
-
const val = baseGetter();
|
|
7909
|
-
if (isArray(val) && checkCompatEnabled$1("WATCH_ARRAY", instance)) {
|
|
7910
|
-
traverse(val);
|
|
7911
|
-
}
|
|
7912
|
-
return val;
|
|
7913
|
-
};
|
|
7914
|
-
}
|
|
7915
|
-
if (cb && deep) {
|
|
7916
|
-
const baseGetter = getter;
|
|
7917
|
-
const depth = deep === true ? Infinity : deep;
|
|
7918
|
-
getter = () => traverse(baseGetter(), depth);
|
|
7919
|
-
}
|
|
7920
|
-
let cleanup;
|
|
7921
|
-
let onCleanup = (fn) => {
|
|
7922
|
-
cleanup = effect.onStop = () => {
|
|
7923
|
-
callWithErrorHandling(fn, instance, 4);
|
|
7924
|
-
cleanup = effect.onStop = void 0;
|
|
7925
|
-
};
|
|
7926
|
-
};
|
|
8036
|
+
function doWatch(source, cb, options = EMPTY_OBJ) {
|
|
8037
|
+
const { immediate, deep, flush, once } = options;
|
|
8038
|
+
const baseWatchOptions = extend$1({}, options);
|
|
7927
8039
|
let ssrCleanup;
|
|
7928
8040
|
if (isInSSRComponentSetup) {
|
|
7929
|
-
onCleanup = NOOP;
|
|
7930
|
-
if (!cb) {
|
|
7931
|
-
getter();
|
|
7932
|
-
} else if (immediate) {
|
|
7933
|
-
callWithAsyncErrorHandling(cb, instance, 3, [
|
|
7934
|
-
getter(),
|
|
7935
|
-
isMultiSource ? [] : void 0,
|
|
7936
|
-
onCleanup
|
|
7937
|
-
]);
|
|
7938
|
-
}
|
|
7939
8041
|
if (flush === "sync") {
|
|
7940
8042
|
const ctx = useSSRContext();
|
|
7941
8043
|
ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
|
|
8044
|
+
} else if (!cb || immediate) {
|
|
8045
|
+
baseWatchOptions.once = true;
|
|
7942
8046
|
} else {
|
|
7943
|
-
|
|
8047
|
+
return {
|
|
8048
|
+
stop: NOOP,
|
|
8049
|
+
resume: NOOP,
|
|
8050
|
+
pause: NOOP
|
|
7944
8051
|
};
|
|
7945
|
-
watchHandle2.stop = NOOP;
|
|
7946
|
-
watchHandle2.resume = NOOP;
|
|
7947
|
-
watchHandle2.pause = NOOP;
|
|
7948
|
-
return watchHandle2;
|
|
7949
8052
|
}
|
|
7950
8053
|
}
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
7966
|
-
onCleanup
|
|
7967
|
-
]);
|
|
7968
|
-
oldValue = newValue;
|
|
8054
|
+
const instance = currentInstance;
|
|
8055
|
+
baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
|
|
8056
|
+
let isPre = false;
|
|
8057
|
+
if (flush === "post") {
|
|
8058
|
+
baseWatchOptions.scheduler = (job) => {
|
|
8059
|
+
queuePostRenderEffect(job, instance && instance.suspense);
|
|
8060
|
+
};
|
|
8061
|
+
} else if (flush !== "sync") {
|
|
8062
|
+
isPre = true;
|
|
8063
|
+
baseWatchOptions.scheduler = (job, isFirstRun) => {
|
|
8064
|
+
if (isFirstRun) {
|
|
8065
|
+
job();
|
|
8066
|
+
} else {
|
|
8067
|
+
queueJob(job);
|
|
7969
8068
|
}
|
|
7970
|
-
}
|
|
7971
|
-
effect.run();
|
|
7972
|
-
}
|
|
7973
|
-
};
|
|
7974
|
-
if (cb) job.flags |= 4;
|
|
7975
|
-
const effect = new ReactiveEffect(getter);
|
|
7976
|
-
let scheduler;
|
|
7977
|
-
if (flush === "sync") {
|
|
7978
|
-
effect.flags |= 64;
|
|
7979
|
-
scheduler = job;
|
|
7980
|
-
} else if (flush === "post") {
|
|
7981
|
-
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
7982
|
-
} else {
|
|
7983
|
-
job.flags |= 2;
|
|
7984
|
-
if (instance) job.id = instance.uid;
|
|
7985
|
-
scheduler = () => queueJob(job);
|
|
8069
|
+
};
|
|
7986
8070
|
}
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
effect.stop();
|
|
7991
|
-
if (scope) {
|
|
7992
|
-
remove(scope.effects, effect);
|
|
8071
|
+
baseWatchOptions.augmentJob = (job) => {
|
|
8072
|
+
if (cb) {
|
|
8073
|
+
job.flags |= 4;
|
|
7993
8074
|
}
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
job(true);
|
|
8001
|
-
} else {
|
|
8002
|
-
oldValue = effect.run();
|
|
8075
|
+
if (isPre) {
|
|
8076
|
+
job.flags |= 2;
|
|
8077
|
+
if (instance) {
|
|
8078
|
+
job.id = instance.uid;
|
|
8079
|
+
job.i = instance;
|
|
8080
|
+
}
|
|
8003
8081
|
}
|
|
8004
|
-
}
|
|
8005
|
-
|
|
8006
|
-
effect.run.bind(effect),
|
|
8007
|
-
instance && instance.suspense
|
|
8008
|
-
);
|
|
8009
|
-
} else {
|
|
8010
|
-
effect.run();
|
|
8011
|
-
}
|
|
8082
|
+
};
|
|
8083
|
+
const watchHandle = watch$1(source, cb, baseWatchOptions);
|
|
8012
8084
|
if (ssrCleanup) ssrCleanup.push(watchHandle);
|
|
8013
8085
|
return watchHandle;
|
|
8014
8086
|
}
|
|
@@ -8037,38 +8109,6 @@ function createPathGetter(ctx, path) {
|
|
|
8037
8109
|
return cur;
|
|
8038
8110
|
};
|
|
8039
8111
|
}
|
|
8040
|
-
function traverse(value, depth = Infinity, seen) {
|
|
8041
|
-
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
8042
|
-
return value;
|
|
8043
|
-
}
|
|
8044
|
-
seen = seen || /* @__PURE__ */ new Set();
|
|
8045
|
-
if (seen.has(value)) {
|
|
8046
|
-
return value;
|
|
8047
|
-
}
|
|
8048
|
-
seen.add(value);
|
|
8049
|
-
depth--;
|
|
8050
|
-
if (isRef(value)) {
|
|
8051
|
-
traverse(value.value, depth, seen);
|
|
8052
|
-
} else if (isArray(value)) {
|
|
8053
|
-
for (let i = 0; i < value.length; i++) {
|
|
8054
|
-
traverse(value[i], depth, seen);
|
|
8055
|
-
}
|
|
8056
|
-
} else if (isSet(value) || isMap(value)) {
|
|
8057
|
-
value.forEach((v) => {
|
|
8058
|
-
traverse(v, depth, seen);
|
|
8059
|
-
});
|
|
8060
|
-
} else if (isPlainObject(value)) {
|
|
8061
|
-
for (const key in value) {
|
|
8062
|
-
traverse(value[key], depth, seen);
|
|
8063
|
-
}
|
|
8064
|
-
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
8065
|
-
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
8066
|
-
traverse(value[key], depth, seen);
|
|
8067
|
-
}
|
|
8068
|
-
}
|
|
8069
|
-
}
|
|
8070
|
-
return value;
|
|
8071
|
-
}
|
|
8072
8112
|
|
|
8073
8113
|
function useModel(props, name, options = EMPTY_OBJ) {
|
|
8074
8114
|
const i = getCurrentInstance();
|
|
@@ -9793,7 +9833,7 @@ function isMemoSame(cached, memo) {
|
|
|
9793
9833
|
return true;
|
|
9794
9834
|
}
|
|
9795
9835
|
|
|
9796
|
-
const version = "3.5.0-beta.
|
|
9836
|
+
const version = "3.5.0-beta.3";
|
|
9797
9837
|
const warn$1 = NOOP;
|
|
9798
9838
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
9799
9839
|
const devtools = void 0;
|
|
@@ -10648,7 +10688,6 @@ class VueElement extends BaseClass {
|
|
|
10648
10688
|
this._ob = null;
|
|
10649
10689
|
if (this.shadowRoot && _createApp !== createApp) {
|
|
10650
10690
|
this._root = this.shadowRoot;
|
|
10651
|
-
this._mount(_def);
|
|
10652
10691
|
} else {
|
|
10653
10692
|
if (_def.shadowRoot !== false) {
|
|
10654
10693
|
this.attachShadow({ mode: "open" });
|
|
@@ -10656,9 +10695,9 @@ class VueElement extends BaseClass {
|
|
|
10656
10695
|
} else {
|
|
10657
10696
|
this._root = this;
|
|
10658
10697
|
}
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10698
|
+
}
|
|
10699
|
+
if (!this._def.__asyncLoader) {
|
|
10700
|
+
this._resolveProps(this._def);
|
|
10662
10701
|
}
|
|
10663
10702
|
}
|
|
10664
10703
|
connectedCallback() {
|
|
@@ -10849,6 +10888,7 @@ class VueElement extends BaseClass {
|
|
|
10849
10888
|
vnode.ce = (instance) => {
|
|
10850
10889
|
this._instance = instance;
|
|
10851
10890
|
instance.ce = this;
|
|
10891
|
+
instance.isCE = true;
|
|
10852
10892
|
const dispatch = (event, args) => {
|
|
10853
10893
|
this.dispatchEvent(
|
|
10854
10894
|
new CustomEvent(
|
|
@@ -11595,6 +11635,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
|
|
|
11595
11635
|
effectScope: effectScope,
|
|
11596
11636
|
getCurrentInstance: getCurrentInstance,
|
|
11597
11637
|
getCurrentScope: getCurrentScope,
|
|
11638
|
+
getCurrentWatcher: getCurrentWatcher,
|
|
11598
11639
|
getTransitionRawChildren: getTransitionRawChildren,
|
|
11599
11640
|
guardReactiveProps: guardReactiveProps,
|
|
11600
11641
|
h: h,
|
|
@@ -11637,6 +11678,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
|
|
|
11637
11678
|
onServerPrefetch: onServerPrefetch,
|
|
11638
11679
|
onUnmounted: onUnmounted,
|
|
11639
11680
|
onUpdated: onUpdated,
|
|
11681
|
+
onWatcherCleanup: onWatcherCleanup,
|
|
11640
11682
|
openBlock: openBlock,
|
|
11641
11683
|
popScopeId: popScopeId,
|
|
11642
11684
|
provide: provide,
|
|
@@ -13150,6 +13192,9 @@ const isStaticProperty = (node) => node && (node.type === "ObjectProperty" || no
|
|
|
13150
13192
|
const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node;
|
|
13151
13193
|
function isReferenced(node, parent, grandparent) {
|
|
13152
13194
|
switch (parent.type) {
|
|
13195
|
+
// yes: PARENT[NODE]
|
|
13196
|
+
// yes: NODE.child
|
|
13197
|
+
// no: parent.NODE
|
|
13153
13198
|
case "MemberExpression":
|
|
13154
13199
|
case "OptionalMemberExpression":
|
|
13155
13200
|
if (parent.property === node) {
|
|
@@ -13158,12 +13203,23 @@ function isReferenced(node, parent, grandparent) {
|
|
|
13158
13203
|
return parent.object === node;
|
|
13159
13204
|
case "JSXMemberExpression":
|
|
13160
13205
|
return parent.object === node;
|
|
13206
|
+
// no: let NODE = init;
|
|
13207
|
+
// yes: let id = NODE;
|
|
13161
13208
|
case "VariableDeclarator":
|
|
13162
13209
|
return parent.init === node;
|
|
13210
|
+
// yes: () => NODE
|
|
13211
|
+
// no: (NODE) => {}
|
|
13163
13212
|
case "ArrowFunctionExpression":
|
|
13164
13213
|
return parent.body === node;
|
|
13214
|
+
// no: class { #NODE; }
|
|
13215
|
+
// no: class { get #NODE() {} }
|
|
13216
|
+
// no: class { #NODE() {} }
|
|
13217
|
+
// no: class { fn() { return this.#NODE; } }
|
|
13165
13218
|
case "PrivateName":
|
|
13166
13219
|
return false;
|
|
13220
|
+
// no: class { NODE() {} }
|
|
13221
|
+
// yes: class { [NODE]() {} }
|
|
13222
|
+
// no: class { foo(NODE) {} }
|
|
13167
13223
|
case "ClassMethod":
|
|
13168
13224
|
case "ClassPrivateMethod":
|
|
13169
13225
|
case "ObjectMethod":
|
|
@@ -13171,11 +13227,18 @@ function isReferenced(node, parent, grandparent) {
|
|
|
13171
13227
|
return !!parent.computed;
|
|
13172
13228
|
}
|
|
13173
13229
|
return false;
|
|
13230
|
+
// yes: { [NODE]: "" }
|
|
13231
|
+
// no: { NODE: "" }
|
|
13232
|
+
// depends: { NODE }
|
|
13233
|
+
// depends: { key: NODE }
|
|
13174
13234
|
case "ObjectProperty":
|
|
13175
13235
|
if (parent.key === node) {
|
|
13176
13236
|
return !!parent.computed;
|
|
13177
13237
|
}
|
|
13178
13238
|
return !grandparent;
|
|
13239
|
+
// no: class { NODE = value; }
|
|
13240
|
+
// yes: class { [NODE] = value; }
|
|
13241
|
+
// yes: class { key = NODE; }
|
|
13179
13242
|
case "ClassProperty":
|
|
13180
13243
|
if (parent.key === node) {
|
|
13181
13244
|
return !!parent.computed;
|
|
@@ -13183,47 +13246,80 @@ function isReferenced(node, parent, grandparent) {
|
|
|
13183
13246
|
return true;
|
|
13184
13247
|
case "ClassPrivateProperty":
|
|
13185
13248
|
return parent.key !== node;
|
|
13249
|
+
// no: class NODE {}
|
|
13250
|
+
// yes: class Foo extends NODE {}
|
|
13186
13251
|
case "ClassDeclaration":
|
|
13187
13252
|
case "ClassExpression":
|
|
13188
13253
|
return parent.superClass === node;
|
|
13254
|
+
// yes: left = NODE;
|
|
13255
|
+
// no: NODE = right;
|
|
13189
13256
|
case "AssignmentExpression":
|
|
13190
13257
|
return parent.right === node;
|
|
13258
|
+
// no: [NODE = foo] = [];
|
|
13259
|
+
// yes: [foo = NODE] = [];
|
|
13191
13260
|
case "AssignmentPattern":
|
|
13192
13261
|
return parent.right === node;
|
|
13262
|
+
// no: NODE: for (;;) {}
|
|
13193
13263
|
case "LabeledStatement":
|
|
13194
13264
|
return false;
|
|
13265
|
+
// no: try {} catch (NODE) {}
|
|
13195
13266
|
case "CatchClause":
|
|
13196
13267
|
return false;
|
|
13268
|
+
// no: function foo(...NODE) {}
|
|
13197
13269
|
case "RestElement":
|
|
13198
13270
|
return false;
|
|
13199
13271
|
case "BreakStatement":
|
|
13200
13272
|
case "ContinueStatement":
|
|
13201
13273
|
return false;
|
|
13274
|
+
// no: function NODE() {}
|
|
13275
|
+
// no: function foo(NODE) {}
|
|
13202
13276
|
case "FunctionDeclaration":
|
|
13203
13277
|
case "FunctionExpression":
|
|
13204
13278
|
return false;
|
|
13279
|
+
// no: export NODE from "foo";
|
|
13280
|
+
// no: export * as NODE from "foo";
|
|
13205
13281
|
case "ExportNamespaceSpecifier":
|
|
13206
13282
|
case "ExportDefaultSpecifier":
|
|
13207
13283
|
return false;
|
|
13284
|
+
// no: export { foo as NODE };
|
|
13285
|
+
// yes: export { NODE as foo };
|
|
13286
|
+
// no: export { NODE as foo } from "foo";
|
|
13208
13287
|
case "ExportSpecifier":
|
|
13209
13288
|
return parent.local === node;
|
|
13289
|
+
// no: import NODE from "foo";
|
|
13290
|
+
// no: import * as NODE from "foo";
|
|
13291
|
+
// no: import { NODE as foo } from "foo";
|
|
13292
|
+
// no: import { foo as NODE } from "foo";
|
|
13293
|
+
// no: import NODE from "bar";
|
|
13210
13294
|
case "ImportDefaultSpecifier":
|
|
13211
13295
|
case "ImportNamespaceSpecifier":
|
|
13212
13296
|
case "ImportSpecifier":
|
|
13213
13297
|
return false;
|
|
13298
|
+
// no: import "foo" assert { NODE: "json" }
|
|
13214
13299
|
case "ImportAttribute":
|
|
13215
13300
|
return false;
|
|
13301
|
+
// no: <div NODE="foo" />
|
|
13216
13302
|
case "JSXAttribute":
|
|
13217
13303
|
return false;
|
|
13304
|
+
// no: [NODE] = [];
|
|
13305
|
+
// no: ({ NODE }) = [];
|
|
13218
13306
|
case "ObjectPattern":
|
|
13219
13307
|
case "ArrayPattern":
|
|
13220
13308
|
return false;
|
|
13309
|
+
// no: new.NODE
|
|
13310
|
+
// no: NODE.target
|
|
13221
13311
|
case "MetaProperty":
|
|
13222
13312
|
return false;
|
|
13313
|
+
// yes: type X = { someProperty: NODE }
|
|
13314
|
+
// no: type X = { NODE: OtherType }
|
|
13223
13315
|
case "ObjectTypeProperty":
|
|
13224
13316
|
return parent.key !== node;
|
|
13317
|
+
// yes: enum X { Foo = NODE }
|
|
13318
|
+
// no: enum X { NODE }
|
|
13225
13319
|
case "TSEnumMember":
|
|
13226
13320
|
return parent.id !== node;
|
|
13321
|
+
// yes: { [NODE]: value }
|
|
13322
|
+
// no: { NODE: value }
|
|
13227
13323
|
case "TSPropertySignature":
|
|
13228
13324
|
if (parent.key === node) {
|
|
13229
13325
|
return !!parent.computed;
|
|
@@ -13271,10 +13367,11 @@ function isCoreComponent(tag) {
|
|
|
13271
13367
|
}
|
|
13272
13368
|
const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
|
|
13273
13369
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
13274
|
-
const
|
|
13370
|
+
const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
|
|
13371
|
+
const isMemberExpressionNode = (exp, context) => {
|
|
13275
13372
|
try {
|
|
13276
|
-
let ret = parser.parseExpression(
|
|
13277
|
-
plugins: context.expressionPlugins
|
|
13373
|
+
let ret = exp.ast || parser.parseExpression(getExpSource(exp), {
|
|
13374
|
+
plugins: context.expressionPlugins ? [...context.expressionPlugins, "typescript"] : ["typescript"]
|
|
13278
13375
|
});
|
|
13279
13376
|
ret = unwrapTSNode(ret);
|
|
13280
13377
|
return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier" && ret.name !== "undefined";
|
|
@@ -13283,6 +13380,24 @@ const isMemberExpressionNode = (path, context) => {
|
|
|
13283
13380
|
}
|
|
13284
13381
|
};
|
|
13285
13382
|
const isMemberExpression = isMemberExpressionNode;
|
|
13383
|
+
const isFnExpressionNode = (exp, context) => {
|
|
13384
|
+
try {
|
|
13385
|
+
let ret = exp.ast || parser.parseExpression(getExpSource(exp), {
|
|
13386
|
+
plugins: context.expressionPlugins ? [...context.expressionPlugins, "typescript"] : ["typescript"]
|
|
13387
|
+
});
|
|
13388
|
+
if (ret.type === "Program") {
|
|
13389
|
+
ret = ret.body[0];
|
|
13390
|
+
if (ret.type === "ExpressionStatement") {
|
|
13391
|
+
ret = ret.expression;
|
|
13392
|
+
}
|
|
13393
|
+
}
|
|
13394
|
+
ret = unwrapTSNode(ret);
|
|
13395
|
+
return ret.type === "FunctionExpression" || ret.type === "ArrowFunctionExpression";
|
|
13396
|
+
} catch (e) {
|
|
13397
|
+
return false;
|
|
13398
|
+
}
|
|
13399
|
+
};
|
|
13400
|
+
const isFnExpression = isFnExpressionNode;
|
|
13286
13401
|
function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
|
|
13287
13402
|
return advancePositionWithMutation(
|
|
13288
13403
|
{
|
|
@@ -13792,7 +13907,9 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
13792
13907
|
case 17:
|
|
13793
13908
|
case 18:
|
|
13794
13909
|
case 19:
|
|
13910
|
+
// "
|
|
13795
13911
|
case 20:
|
|
13912
|
+
// '
|
|
13796
13913
|
case 21:
|
|
13797
13914
|
emitError(9, end);
|
|
13798
13915
|
break;
|
|
@@ -14762,6 +14879,7 @@ function traverseNode(node, context) {
|
|
|
14762
14879
|
context.helper(TO_DISPLAY_STRING);
|
|
14763
14880
|
}
|
|
14764
14881
|
break;
|
|
14882
|
+
// for container types, further traverse downwards
|
|
14765
14883
|
case 9:
|
|
14766
14884
|
for (let i2 = 0; i2 < node.branches.length; i2++) {
|
|
14767
14885
|
traverseNode(node.branches[i2], context);
|
|
@@ -15238,6 +15356,7 @@ function genNode(node, context) {
|
|
|
15238
15356
|
case 21:
|
|
15239
15357
|
genNodeList(node.body, context, true, false);
|
|
15240
15358
|
break;
|
|
15359
|
+
// SSR only types
|
|
15241
15360
|
case 22:
|
|
15242
15361
|
genTemplateLiteral(node, context);
|
|
15243
15362
|
break;
|
|
@@ -17265,7 +17384,6 @@ function processSlotOutlet(node, context) {
|
|
|
17265
17384
|
};
|
|
17266
17385
|
}
|
|
17267
17386
|
|
|
17268
|
-
const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
17269
17387
|
const transformOn$1 = (dir, node, context, augmentor) => {
|
|
17270
17388
|
const { loc, modifiers, arg } = dir;
|
|
17271
17389
|
if (!dir.exp && !modifiers.length) {
|
|
@@ -17306,8 +17424,8 @@ const transformOn$1 = (dir, node, context, augmentor) => {
|
|
|
17306
17424
|
}
|
|
17307
17425
|
let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
|
|
17308
17426
|
if (exp) {
|
|
17309
|
-
const isMemberExp = isMemberExpression(exp
|
|
17310
|
-
const isInlineStatement = !(isMemberExp ||
|
|
17427
|
+
const isMemberExp = isMemberExpression(exp, context);
|
|
17428
|
+
const isInlineStatement = !(isMemberExp || isFnExpression(exp, context));
|
|
17311
17429
|
const hasMultipleStatements = exp.content.includes(`;`);
|
|
17312
17430
|
if (context.prefixIdentifiers) {
|
|
17313
17431
|
isInlineStatement && context.addIdentifiers(`$event`);
|
|
@@ -17477,7 +17595,7 @@ const transformModel$1 = (dir, node, context) => {
|
|
|
17477
17595
|
return createTransformProps();
|
|
17478
17596
|
}
|
|
17479
17597
|
const maybeRef = context.inline && (bindingType === "setup-let" || bindingType === "setup-ref" || bindingType === "setup-maybe-ref");
|
|
17480
|
-
if (!expString.trim() || !isMemberExpression(
|
|
17598
|
+
if (!expString.trim() || !isMemberExpression(exp, context) && !maybeRef) {
|
|
17481
17599
|
context.onError(
|
|
17482
17600
|
createCompilerError(42, exp.loc)
|
|
17483
17601
|
);
|
|
@@ -17612,27 +17730,35 @@ function parseFilter(node, context) {
|
|
|
17612
17730
|
case 34:
|
|
17613
17731
|
inDouble = true;
|
|
17614
17732
|
break;
|
|
17733
|
+
// "
|
|
17615
17734
|
case 39:
|
|
17616
17735
|
inSingle = true;
|
|
17617
17736
|
break;
|
|
17737
|
+
// '
|
|
17618
17738
|
case 96:
|
|
17619
17739
|
inTemplateString = true;
|
|
17620
17740
|
break;
|
|
17741
|
+
// `
|
|
17621
17742
|
case 40:
|
|
17622
17743
|
paren++;
|
|
17623
17744
|
break;
|
|
17745
|
+
// (
|
|
17624
17746
|
case 41:
|
|
17625
17747
|
paren--;
|
|
17626
17748
|
break;
|
|
17749
|
+
// )
|
|
17627
17750
|
case 91:
|
|
17628
17751
|
square++;
|
|
17629
17752
|
break;
|
|
17753
|
+
// [
|
|
17630
17754
|
case 93:
|
|
17631
17755
|
square--;
|
|
17632
17756
|
break;
|
|
17757
|
+
// ]
|
|
17633
17758
|
case 123:
|
|
17634
17759
|
curly++;
|
|
17635
17760
|
break;
|
|
17761
|
+
// {
|
|
17636
17762
|
case 125:
|
|
17637
17763
|
curly--;
|
|
17638
17764
|
break;
|