@vue/runtime-core 3.3.9 → 3.4.0-alpha.2
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/runtime-core.cjs.js +43 -16
- package/dist/runtime-core.cjs.prod.js +32 -12
- package/dist/runtime-core.d.ts +1 -0
- package/dist/runtime-core.esm-bundler.js +43 -17
- package/package.json +3 -3
package/dist/runtime-core.cjs.js
CHANGED
|
@@ -119,7 +119,7 @@ function assertNumber(val, type) {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
const ErrorTypeStrings = {
|
|
122
|
+
const ErrorTypeStrings$1 = {
|
|
123
123
|
["sp"]: "serverPrefetch hook",
|
|
124
124
|
["bc"]: "beforeCreate hook",
|
|
125
125
|
["c"]: "created hook",
|
|
@@ -180,7 +180,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
180
180
|
if (instance) {
|
|
181
181
|
let cur = instance.parent;
|
|
182
182
|
const exposedInstance = instance.proxy;
|
|
183
|
-
const errorInfo = ErrorTypeStrings[type] ;
|
|
183
|
+
const errorInfo = ErrorTypeStrings$1[type] ;
|
|
184
184
|
while (cur) {
|
|
185
185
|
const errorCapturedHooks = cur.ec;
|
|
186
186
|
if (errorCapturedHooks) {
|
|
@@ -207,7 +207,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
207
207
|
}
|
|
208
208
|
function logError(err, type, contextVNode, throwInDev = true) {
|
|
209
209
|
{
|
|
210
|
-
const info = ErrorTypeStrings[type];
|
|
210
|
+
const info = ErrorTypeStrings$1[type];
|
|
211
211
|
if (contextVNode) {
|
|
212
212
|
pushWarningContext(contextVNode);
|
|
213
213
|
}
|
|
@@ -435,6 +435,7 @@ function rerender(id, newRender) {
|
|
|
435
435
|
}
|
|
436
436
|
instance.renderCache = [];
|
|
437
437
|
isHmrUpdating = true;
|
|
438
|
+
instance.effect.dirty = true;
|
|
438
439
|
instance.update();
|
|
439
440
|
isHmrUpdating = false;
|
|
440
441
|
});
|
|
@@ -462,6 +463,7 @@ function reload(id, newComp) {
|
|
|
462
463
|
instance.ceReload(newComp.styles);
|
|
463
464
|
hmrDirtyComponents.delete(oldComp);
|
|
464
465
|
} else if (instance.parent) {
|
|
466
|
+
instance.parent.effect.dirty = true;
|
|
465
467
|
queueJob(instance.parent.update);
|
|
466
468
|
} else if (instance.appContext.reload) {
|
|
467
469
|
instance.appContext.reload();
|
|
@@ -1711,8 +1713,15 @@ function watch(source, cb, options) {
|
|
|
1711
1713
|
}
|
|
1712
1714
|
return doWatch(source, cb, options);
|
|
1713
1715
|
}
|
|
1714
|
-
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = shared.EMPTY_OBJ) {
|
|
1716
|
+
function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = shared.EMPTY_OBJ) {
|
|
1715
1717
|
var _a;
|
|
1718
|
+
if (cb && once) {
|
|
1719
|
+
const _cb = cb;
|
|
1720
|
+
cb = (...args) => {
|
|
1721
|
+
_cb(...args);
|
|
1722
|
+
unwatch();
|
|
1723
|
+
};
|
|
1724
|
+
}
|
|
1716
1725
|
if (!cb) {
|
|
1717
1726
|
if (immediate !== void 0) {
|
|
1718
1727
|
warn(
|
|
@@ -1724,6 +1733,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1724
1733
|
`watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
|
|
1725
1734
|
);
|
|
1726
1735
|
}
|
|
1736
|
+
if (once !== void 0) {
|
|
1737
|
+
warn(
|
|
1738
|
+
`watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
|
|
1739
|
+
);
|
|
1740
|
+
}
|
|
1727
1741
|
}
|
|
1728
1742
|
const warnInvalidSource = (s) => {
|
|
1729
1743
|
warn(
|
|
@@ -1811,7 +1825,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1811
1825
|
}
|
|
1812
1826
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
1813
1827
|
const job = () => {
|
|
1814
|
-
if (!effect.active) {
|
|
1828
|
+
if (!effect.active || !effect.dirty) {
|
|
1815
1829
|
return;
|
|
1816
1830
|
}
|
|
1817
1831
|
if (cb) {
|
|
@@ -1844,7 +1858,13 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1844
1858
|
job.id = instance.uid;
|
|
1845
1859
|
scheduler = () => queueJob(job);
|
|
1846
1860
|
}
|
|
1847
|
-
const effect = new reactivity.ReactiveEffect(getter, scheduler);
|
|
1861
|
+
const effect = new reactivity.ReactiveEffect(getter, shared.NOOP, scheduler);
|
|
1862
|
+
const unwatch = () => {
|
|
1863
|
+
effect.stop();
|
|
1864
|
+
if (instance && instance.scope) {
|
|
1865
|
+
shared.remove(instance.scope.effects, effect);
|
|
1866
|
+
}
|
|
1867
|
+
};
|
|
1848
1868
|
{
|
|
1849
1869
|
effect.onTrack = onTrack;
|
|
1850
1870
|
effect.onTrigger = onTrigger;
|
|
@@ -1863,12 +1883,6 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1863
1883
|
} else {
|
|
1864
1884
|
effect.run();
|
|
1865
1885
|
}
|
|
1866
|
-
const unwatch = () => {
|
|
1867
|
-
effect.stop();
|
|
1868
|
-
if (instance && instance.scope) {
|
|
1869
|
-
shared.remove(instance.scope.effects, effect);
|
|
1870
|
-
}
|
|
1871
|
-
};
|
|
1872
1886
|
if (ssrCleanup)
|
|
1873
1887
|
ssrCleanup.push(unwatch);
|
|
1874
1888
|
return unwatch;
|
|
@@ -2100,6 +2114,7 @@ const BaseTransitionImpl = {
|
|
|
2100
2114
|
leavingHooks.afterLeave = () => {
|
|
2101
2115
|
state.isLeaving = false;
|
|
2102
2116
|
if (instance.update.active !== false) {
|
|
2117
|
+
instance.effect.dirty = true;
|
|
2103
2118
|
instance.update();
|
|
2104
2119
|
}
|
|
2105
2120
|
};
|
|
@@ -2439,6 +2454,7 @@ function defineAsyncComponent(source) {
|
|
|
2439
2454
|
load().then(() => {
|
|
2440
2455
|
loaded.value = true;
|
|
2441
2456
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
2457
|
+
instance.parent.effect.dirty = true;
|
|
2442
2458
|
queueJob(instance.parent.update);
|
|
2443
2459
|
}
|
|
2444
2460
|
}).catch((err) => {
|
|
@@ -2739,7 +2755,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
2739
2755
|
}
|
|
2740
2756
|
return wrappedHook;
|
|
2741
2757
|
} else {
|
|
2742
|
-
const apiName = shared.toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
|
|
2758
|
+
const apiName = shared.toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
|
2743
2759
|
warn(
|
|
2744
2760
|
`${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
|
|
2745
2761
|
);
|
|
@@ -2906,7 +2922,10 @@ const publicPropertiesMap = (
|
|
|
2906
2922
|
$root: (i) => getPublicInstance(i.root),
|
|
2907
2923
|
$emit: (i) => i.emit,
|
|
2908
2924
|
$options: (i) => resolveMergedOptions(i) ,
|
|
2909
|
-
$forceUpdate: (i) => i.f || (i.f = () =>
|
|
2925
|
+
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
2926
|
+
i.effect.dirty = true;
|
|
2927
|
+
queueJob(i.update);
|
|
2928
|
+
}),
|
|
2910
2929
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
2911
2930
|
$watch: (i) => instanceWatch.bind(i)
|
|
2912
2931
|
})
|
|
@@ -5674,6 +5693,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5674
5693
|
} else {
|
|
5675
5694
|
instance.next = n2;
|
|
5676
5695
|
invalidateJob(instance.update);
|
|
5696
|
+
instance.effect.dirty = true;
|
|
5677
5697
|
instance.update();
|
|
5678
5698
|
}
|
|
5679
5699
|
} else {
|
|
@@ -5843,11 +5863,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5843
5863
|
};
|
|
5844
5864
|
const effect = instance.effect = new reactivity.ReactiveEffect(
|
|
5845
5865
|
componentUpdateFn,
|
|
5866
|
+
shared.NOOP,
|
|
5846
5867
|
() => queueJob(update),
|
|
5847
5868
|
instance.scope
|
|
5848
5869
|
// track it in component's effect scope
|
|
5849
5870
|
);
|
|
5850
|
-
const update = instance.update = () =>
|
|
5871
|
+
const update = instance.update = () => {
|
|
5872
|
+
if (effect.dirty) {
|
|
5873
|
+
effect.run();
|
|
5874
|
+
}
|
|
5875
|
+
};
|
|
5851
5876
|
update.id = instance.uid;
|
|
5852
5877
|
toggleRecurse(instance, true);
|
|
5853
5878
|
{
|
|
@@ -7754,7 +7779,8 @@ function isMemoSame(cached, memo) {
|
|
|
7754
7779
|
return true;
|
|
7755
7780
|
}
|
|
7756
7781
|
|
|
7757
|
-
const version = "3.
|
|
7782
|
+
const version = "3.4.0-alpha.2";
|
|
7783
|
+
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
7758
7784
|
const _ssrUtils = {
|
|
7759
7785
|
createComponentInstance,
|
|
7760
7786
|
setupComponent,
|
|
@@ -7804,6 +7830,7 @@ exports.toHandlerKey = shared.toHandlerKey;
|
|
|
7804
7830
|
exports.BaseTransition = BaseTransition;
|
|
7805
7831
|
exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
|
|
7806
7832
|
exports.Comment = Comment;
|
|
7833
|
+
exports.ErrorTypeStrings = ErrorTypeStrings;
|
|
7807
7834
|
exports.Fragment = Fragment;
|
|
7808
7835
|
exports.KeepAlive = KeepAlive;
|
|
7809
7836
|
exports.Static = Static;
|
|
@@ -1184,8 +1184,15 @@ const INITIAL_WATCHER_VALUE = {};
|
|
|
1184
1184
|
function watch(source, cb, options) {
|
|
1185
1185
|
return doWatch(source, cb, options);
|
|
1186
1186
|
}
|
|
1187
|
-
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = shared.EMPTY_OBJ) {
|
|
1187
|
+
function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = shared.EMPTY_OBJ) {
|
|
1188
1188
|
var _a;
|
|
1189
|
+
if (cb && once) {
|
|
1190
|
+
const _cb = cb;
|
|
1191
|
+
cb = (...args) => {
|
|
1192
|
+
_cb(...args);
|
|
1193
|
+
unwatch();
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1189
1196
|
const instance = reactivity.getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;
|
|
1190
1197
|
let getter;
|
|
1191
1198
|
let forceTrigger = false;
|
|
@@ -1262,7 +1269,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1262
1269
|
}
|
|
1263
1270
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
1264
1271
|
const job = () => {
|
|
1265
|
-
if (!effect.active) {
|
|
1272
|
+
if (!effect.active || !effect.dirty) {
|
|
1266
1273
|
return;
|
|
1267
1274
|
}
|
|
1268
1275
|
if (cb) {
|
|
@@ -1295,7 +1302,13 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1295
1302
|
job.id = instance.uid;
|
|
1296
1303
|
scheduler = () => queueJob(job);
|
|
1297
1304
|
}
|
|
1298
|
-
const effect = new reactivity.ReactiveEffect(getter, scheduler);
|
|
1305
|
+
const effect = new reactivity.ReactiveEffect(getter, shared.NOOP, scheduler);
|
|
1306
|
+
const unwatch = () => {
|
|
1307
|
+
effect.stop();
|
|
1308
|
+
if (instance && instance.scope) {
|
|
1309
|
+
shared.remove(instance.scope.effects, effect);
|
|
1310
|
+
}
|
|
1311
|
+
};
|
|
1299
1312
|
if (cb) {
|
|
1300
1313
|
if (immediate) {
|
|
1301
1314
|
job();
|
|
@@ -1310,12 +1323,6 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1310
1323
|
} else {
|
|
1311
1324
|
effect.run();
|
|
1312
1325
|
}
|
|
1313
|
-
const unwatch = () => {
|
|
1314
|
-
effect.stop();
|
|
1315
|
-
if (instance && instance.scope) {
|
|
1316
|
-
shared.remove(instance.scope.effects, effect);
|
|
1317
|
-
}
|
|
1318
|
-
};
|
|
1319
1326
|
if (ssrCleanup)
|
|
1320
1327
|
ssrCleanup.push(unwatch);
|
|
1321
1328
|
return unwatch;
|
|
@@ -1531,6 +1538,7 @@ const BaseTransitionImpl = {
|
|
|
1531
1538
|
leavingHooks.afterLeave = () => {
|
|
1532
1539
|
state.isLeaving = false;
|
|
1533
1540
|
if (instance.update.active !== false) {
|
|
1541
|
+
instance.effect.dirty = true;
|
|
1534
1542
|
instance.update();
|
|
1535
1543
|
}
|
|
1536
1544
|
};
|
|
@@ -1862,6 +1870,7 @@ function defineAsyncComponent(source) {
|
|
|
1862
1870
|
load().then(() => {
|
|
1863
1871
|
loaded.value = true;
|
|
1864
1872
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
1873
|
+
instance.parent.effect.dirty = true;
|
|
1865
1874
|
queueJob(instance.parent.update);
|
|
1866
1875
|
}
|
|
1867
1876
|
}).catch((err) => {
|
|
@@ -2299,7 +2308,10 @@ const publicPropertiesMap = (
|
|
|
2299
2308
|
$root: (i) => getPublicInstance(i.root),
|
|
2300
2309
|
$emit: (i) => i.emit,
|
|
2301
2310
|
$options: (i) => resolveMergedOptions(i) ,
|
|
2302
|
-
$forceUpdate: (i) => i.f || (i.f = () =>
|
|
2311
|
+
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
2312
|
+
i.effect.dirty = true;
|
|
2313
|
+
queueJob(i.update);
|
|
2314
|
+
}),
|
|
2303
2315
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
2304
2316
|
$watch: (i) => instanceWatch.bind(i)
|
|
2305
2317
|
})
|
|
@@ -4456,6 +4468,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4456
4468
|
} else {
|
|
4457
4469
|
instance.next = n2;
|
|
4458
4470
|
invalidateJob(instance.update);
|
|
4471
|
+
instance.effect.dirty = true;
|
|
4459
4472
|
instance.update();
|
|
4460
4473
|
}
|
|
4461
4474
|
} else {
|
|
@@ -4577,11 +4590,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4577
4590
|
};
|
|
4578
4591
|
const effect = instance.effect = new reactivity.ReactiveEffect(
|
|
4579
4592
|
componentUpdateFn,
|
|
4593
|
+
shared.NOOP,
|
|
4580
4594
|
() => queueJob(update),
|
|
4581
4595
|
instance.scope
|
|
4582
4596
|
// track it in component's effect scope
|
|
4583
4597
|
);
|
|
4584
|
-
const update = instance.update = () =>
|
|
4598
|
+
const update = instance.update = () => {
|
|
4599
|
+
if (effect.dirty) {
|
|
4600
|
+
effect.run();
|
|
4601
|
+
}
|
|
4602
|
+
};
|
|
4585
4603
|
update.id = instance.uid;
|
|
4586
4604
|
toggleRecurse(instance, true);
|
|
4587
4605
|
update();
|
|
@@ -6086,7 +6104,8 @@ function isMemoSame(cached, memo) {
|
|
|
6086
6104
|
return true;
|
|
6087
6105
|
}
|
|
6088
6106
|
|
|
6089
|
-
const version = "3.
|
|
6107
|
+
const version = "3.4.0-alpha.2";
|
|
6108
|
+
const ErrorTypeStrings = null;
|
|
6090
6109
|
const _ssrUtils = {
|
|
6091
6110
|
createComponentInstance,
|
|
6092
6111
|
setupComponent,
|
|
@@ -6136,6 +6155,7 @@ exports.toHandlerKey = shared.toHandlerKey;
|
|
|
6136
6155
|
exports.BaseTransition = BaseTransition;
|
|
6137
6156
|
exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
|
|
6138
6157
|
exports.Comment = Comment;
|
|
6158
|
+
exports.ErrorTypeStrings = ErrorTypeStrings;
|
|
6139
6159
|
exports.Fragment = Fragment;
|
|
6140
6160
|
exports.KeepAlive = KeepAlive;
|
|
6141
6161
|
exports.Static = Static;
|
package/dist/runtime-core.d.ts
CHANGED
|
@@ -1132,6 +1132,7 @@ export interface WatchOptionsBase extends DebuggerOptions {
|
|
|
1132
1132
|
export interface WatchOptions<Immediate = boolean> extends WatchOptionsBase {
|
|
1133
1133
|
immediate?: Immediate;
|
|
1134
1134
|
deep?: boolean;
|
|
1135
|
+
once?: boolean;
|
|
1135
1136
|
}
|
|
1136
1137
|
export type WatchStopHandle = () => void;
|
|
1137
1138
|
export declare function watchEffect(effect: WatchEffect, options?: WatchOptionsBase): WatchStopHandle;
|
|
@@ -121,7 +121,7 @@ function assertNumber(val, type) {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
const ErrorTypeStrings = {
|
|
124
|
+
const ErrorTypeStrings$1 = {
|
|
125
125
|
["sp"]: "serverPrefetch hook",
|
|
126
126
|
["bc"]: "beforeCreate hook",
|
|
127
127
|
["c"]: "created hook",
|
|
@@ -182,7 +182,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
182
182
|
if (instance) {
|
|
183
183
|
let cur = instance.parent;
|
|
184
184
|
const exposedInstance = instance.proxy;
|
|
185
|
-
const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings[type] : type;
|
|
185
|
+
const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings$1[type] : type;
|
|
186
186
|
while (cur) {
|
|
187
187
|
const errorCapturedHooks = cur.ec;
|
|
188
188
|
if (errorCapturedHooks) {
|
|
@@ -209,7 +209,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
209
209
|
}
|
|
210
210
|
function logError(err, type, contextVNode, throwInDev = true) {
|
|
211
211
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
212
|
-
const info = ErrorTypeStrings[type];
|
|
212
|
+
const info = ErrorTypeStrings$1[type];
|
|
213
213
|
if (contextVNode) {
|
|
214
214
|
pushWarningContext(contextVNode);
|
|
215
215
|
}
|
|
@@ -439,6 +439,7 @@ function rerender(id, newRender) {
|
|
|
439
439
|
}
|
|
440
440
|
instance.renderCache = [];
|
|
441
441
|
isHmrUpdating = true;
|
|
442
|
+
instance.effect.dirty = true;
|
|
442
443
|
instance.update();
|
|
443
444
|
isHmrUpdating = false;
|
|
444
445
|
});
|
|
@@ -466,6 +467,7 @@ function reload(id, newComp) {
|
|
|
466
467
|
instance.ceReload(newComp.styles);
|
|
467
468
|
hmrDirtyComponents.delete(oldComp);
|
|
468
469
|
} else if (instance.parent) {
|
|
470
|
+
instance.parent.effect.dirty = true;
|
|
469
471
|
queueJob(instance.parent.update);
|
|
470
472
|
} else if (instance.appContext.reload) {
|
|
471
473
|
instance.appContext.reload();
|
|
@@ -1715,8 +1717,15 @@ function watch(source, cb, options) {
|
|
|
1715
1717
|
}
|
|
1716
1718
|
return doWatch(source, cb, options);
|
|
1717
1719
|
}
|
|
1718
|
-
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
1720
|
+
function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
1719
1721
|
var _a;
|
|
1722
|
+
if (cb && once) {
|
|
1723
|
+
const _cb = cb;
|
|
1724
|
+
cb = (...args) => {
|
|
1725
|
+
_cb(...args);
|
|
1726
|
+
unwatch();
|
|
1727
|
+
};
|
|
1728
|
+
}
|
|
1720
1729
|
if (!!(process.env.NODE_ENV !== "production") && !cb) {
|
|
1721
1730
|
if (immediate !== void 0) {
|
|
1722
1731
|
warn(
|
|
@@ -1728,6 +1737,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1728
1737
|
`watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
|
|
1729
1738
|
);
|
|
1730
1739
|
}
|
|
1740
|
+
if (once !== void 0) {
|
|
1741
|
+
warn(
|
|
1742
|
+
`watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
|
|
1743
|
+
);
|
|
1744
|
+
}
|
|
1731
1745
|
}
|
|
1732
1746
|
const warnInvalidSource = (s) => {
|
|
1733
1747
|
warn(
|
|
@@ -1815,7 +1829,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1815
1829
|
}
|
|
1816
1830
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
1817
1831
|
const job = () => {
|
|
1818
|
-
if (!effect.active) {
|
|
1832
|
+
if (!effect.active || !effect.dirty) {
|
|
1819
1833
|
return;
|
|
1820
1834
|
}
|
|
1821
1835
|
if (cb) {
|
|
@@ -1848,7 +1862,13 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1848
1862
|
job.id = instance.uid;
|
|
1849
1863
|
scheduler = () => queueJob(job);
|
|
1850
1864
|
}
|
|
1851
|
-
const effect = new ReactiveEffect(getter, scheduler);
|
|
1865
|
+
const effect = new ReactiveEffect(getter, NOOP, scheduler);
|
|
1866
|
+
const unwatch = () => {
|
|
1867
|
+
effect.stop();
|
|
1868
|
+
if (instance && instance.scope) {
|
|
1869
|
+
remove(instance.scope.effects, effect);
|
|
1870
|
+
}
|
|
1871
|
+
};
|
|
1852
1872
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1853
1873
|
effect.onTrack = onTrack;
|
|
1854
1874
|
effect.onTrigger = onTrigger;
|
|
@@ -1867,12 +1887,6 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1867
1887
|
} else {
|
|
1868
1888
|
effect.run();
|
|
1869
1889
|
}
|
|
1870
|
-
const unwatch = () => {
|
|
1871
|
-
effect.stop();
|
|
1872
|
-
if (instance && instance.scope) {
|
|
1873
|
-
remove(instance.scope.effects, effect);
|
|
1874
|
-
}
|
|
1875
|
-
};
|
|
1876
1890
|
if (ssrCleanup)
|
|
1877
1891
|
ssrCleanup.push(unwatch);
|
|
1878
1892
|
return unwatch;
|
|
@@ -2106,6 +2120,7 @@ const BaseTransitionImpl = {
|
|
|
2106
2120
|
leavingHooks.afterLeave = () => {
|
|
2107
2121
|
state.isLeaving = false;
|
|
2108
2122
|
if (instance.update.active !== false) {
|
|
2123
|
+
instance.effect.dirty = true;
|
|
2109
2124
|
instance.update();
|
|
2110
2125
|
}
|
|
2111
2126
|
};
|
|
@@ -2445,6 +2460,7 @@ function defineAsyncComponent(source) {
|
|
|
2445
2460
|
load().then(() => {
|
|
2446
2461
|
loaded.value = true;
|
|
2447
2462
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
2463
|
+
instance.parent.effect.dirty = true;
|
|
2448
2464
|
queueJob(instance.parent.update);
|
|
2449
2465
|
}
|
|
2450
2466
|
}).catch((err) => {
|
|
@@ -2745,7 +2761,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
2745
2761
|
}
|
|
2746
2762
|
return wrappedHook;
|
|
2747
2763
|
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2748
|
-
const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
|
|
2764
|
+
const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
|
2749
2765
|
warn(
|
|
2750
2766
|
`${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
|
|
2751
2767
|
);
|
|
@@ -2912,7 +2928,10 @@ const publicPropertiesMap = (
|
|
|
2912
2928
|
$root: (i) => getPublicInstance(i.root),
|
|
2913
2929
|
$emit: (i) => i.emit,
|
|
2914
2930
|
$options: (i) => __VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type,
|
|
2915
|
-
$forceUpdate: (i) => i.f || (i.f = () =>
|
|
2931
|
+
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
2932
|
+
i.effect.dirty = true;
|
|
2933
|
+
queueJob(i.update);
|
|
2934
|
+
}),
|
|
2916
2935
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
2917
2936
|
$watch: (i) => __VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP
|
|
2918
2937
|
})
|
|
@@ -5718,6 +5737,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5718
5737
|
} else {
|
|
5719
5738
|
instance.next = n2;
|
|
5720
5739
|
invalidateJob(instance.update);
|
|
5740
|
+
instance.effect.dirty = true;
|
|
5721
5741
|
instance.update();
|
|
5722
5742
|
}
|
|
5723
5743
|
} else {
|
|
@@ -5887,11 +5907,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5887
5907
|
};
|
|
5888
5908
|
const effect = instance.effect = new ReactiveEffect(
|
|
5889
5909
|
componentUpdateFn,
|
|
5910
|
+
NOOP,
|
|
5890
5911
|
() => queueJob(update),
|
|
5891
5912
|
instance.scope
|
|
5892
5913
|
// track it in component's effect scope
|
|
5893
5914
|
);
|
|
5894
|
-
const update = instance.update = () =>
|
|
5915
|
+
const update = instance.update = () => {
|
|
5916
|
+
if (effect.dirty) {
|
|
5917
|
+
effect.run();
|
|
5918
|
+
}
|
|
5919
|
+
};
|
|
5895
5920
|
update.id = instance.uid;
|
|
5896
5921
|
toggleRecurse(instance, true);
|
|
5897
5922
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
@@ -7814,7 +7839,8 @@ function isMemoSame(cached, memo) {
|
|
|
7814
7839
|
return true;
|
|
7815
7840
|
}
|
|
7816
7841
|
|
|
7817
|
-
const version = "3.
|
|
7842
|
+
const version = "3.4.0-alpha.2";
|
|
7843
|
+
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
7818
7844
|
const _ssrUtils = {
|
|
7819
7845
|
createComponentInstance,
|
|
7820
7846
|
setupComponent,
|
|
@@ -7827,4 +7853,4 @@ const ssrUtils = _ssrUtils ;
|
|
|
7827
7853
|
const resolveFilter = null;
|
|
7828
7854
|
const compatUtils = null;
|
|
7829
7855
|
|
|
7830
|
-
export { BaseTransition, BaseTransitionPropsValidators, Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, computed, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSlots, devtools, getCurrentInstance, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, initCustomFormatter, inject, isMemoSame, isRuntimeOnly, isVNode, mergeDefaults, mergeModels, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, pushScopeId, queuePostFlushCb, registerRuntimeCompiler, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, ssrContextKey, ssrUtils, toHandlers, transformVNodeArgs, useAttrs, useModel, useSSRContext, useSlots, useTransitionState, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId };
|
|
7856
|
+
export { BaseTransition, BaseTransitionPropsValidators, Comment, ErrorTypeStrings, Fragment, KeepAlive, Static, Suspense, Teleport, Text, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, computed, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSlots, devtools, getCurrentInstance, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, initCustomFormatter, inject, isMemoSame, isRuntimeOnly, isVNode, mergeDefaults, mergeModels, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, pushScopeId, queuePostFlushCb, registerRuntimeCompiler, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, ssrContextKey, ssrUtils, toHandlers, transformVNodeArgs, useAttrs, useModel, useSSRContext, useSlots, useTransitionState, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/runtime-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0-alpha.2",
|
|
4
4
|
"description": "@vue/runtime-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/runtime-core.esm-bundler.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vue/shared": "3.
|
|
36
|
-
"@vue/reactivity": "3.
|
|
35
|
+
"@vue/shared": "3.4.0-alpha.2",
|
|
36
|
+
"@vue/reactivity": "3.4.0-alpha.2"
|
|
37
37
|
}
|
|
38
38
|
}
|