@vue/runtime-core 3.3.7 → 3.4.0-alpha.1
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();
|
|
@@ -1646,8 +1648,15 @@ function watch(source, cb, options) {
|
|
|
1646
1648
|
}
|
|
1647
1649
|
return doWatch(source, cb, options);
|
|
1648
1650
|
}
|
|
1649
|
-
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = shared.EMPTY_OBJ) {
|
|
1651
|
+
function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = shared.EMPTY_OBJ) {
|
|
1650
1652
|
var _a;
|
|
1653
|
+
if (cb && once) {
|
|
1654
|
+
const _cb = cb;
|
|
1655
|
+
cb = (...args) => {
|
|
1656
|
+
_cb(...args);
|
|
1657
|
+
unwatch();
|
|
1658
|
+
};
|
|
1659
|
+
}
|
|
1651
1660
|
if (!cb) {
|
|
1652
1661
|
if (immediate !== void 0) {
|
|
1653
1662
|
warn(
|
|
@@ -1659,6 +1668,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1659
1668
|
`watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
|
|
1660
1669
|
);
|
|
1661
1670
|
}
|
|
1671
|
+
if (once !== void 0) {
|
|
1672
|
+
warn(
|
|
1673
|
+
`watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
|
|
1674
|
+
);
|
|
1675
|
+
}
|
|
1662
1676
|
}
|
|
1663
1677
|
const warnInvalidSource = (s) => {
|
|
1664
1678
|
warn(
|
|
@@ -1745,7 +1759,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1745
1759
|
}
|
|
1746
1760
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
1747
1761
|
const job = () => {
|
|
1748
|
-
if (!effect.active) {
|
|
1762
|
+
if (!effect.active || !effect.dirty) {
|
|
1749
1763
|
return;
|
|
1750
1764
|
}
|
|
1751
1765
|
if (cb) {
|
|
@@ -1778,7 +1792,13 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1778
1792
|
job.id = instance.uid;
|
|
1779
1793
|
scheduler = () => queueJob(job);
|
|
1780
1794
|
}
|
|
1781
|
-
const effect = new reactivity.ReactiveEffect(getter, scheduler);
|
|
1795
|
+
const effect = new reactivity.ReactiveEffect(getter, shared.NOOP, scheduler);
|
|
1796
|
+
const unwatch = () => {
|
|
1797
|
+
effect.stop();
|
|
1798
|
+
if (instance && instance.scope) {
|
|
1799
|
+
shared.remove(instance.scope.effects, effect);
|
|
1800
|
+
}
|
|
1801
|
+
};
|
|
1782
1802
|
{
|
|
1783
1803
|
effect.onTrack = onTrack;
|
|
1784
1804
|
effect.onTrigger = onTrigger;
|
|
@@ -1797,12 +1817,6 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1797
1817
|
} else {
|
|
1798
1818
|
effect.run();
|
|
1799
1819
|
}
|
|
1800
|
-
const unwatch = () => {
|
|
1801
|
-
effect.stop();
|
|
1802
|
-
if (instance && instance.scope) {
|
|
1803
|
-
shared.remove(instance.scope.effects, effect);
|
|
1804
|
-
}
|
|
1805
|
-
};
|
|
1806
1820
|
if (ssrCleanup)
|
|
1807
1821
|
ssrCleanup.push(unwatch);
|
|
1808
1822
|
return unwatch;
|
|
@@ -2034,6 +2048,7 @@ const BaseTransitionImpl = {
|
|
|
2034
2048
|
leavingHooks.afterLeave = () => {
|
|
2035
2049
|
state.isLeaving = false;
|
|
2036
2050
|
if (instance.update.active !== false) {
|
|
2051
|
+
instance.effect.dirty = true;
|
|
2037
2052
|
instance.update();
|
|
2038
2053
|
}
|
|
2039
2054
|
};
|
|
@@ -2369,6 +2384,7 @@ function defineAsyncComponent(source) {
|
|
|
2369
2384
|
load().then(() => {
|
|
2370
2385
|
loaded.value = true;
|
|
2371
2386
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
2387
|
+
instance.parent.effect.dirty = true;
|
|
2372
2388
|
queueJob(instance.parent.update);
|
|
2373
2389
|
}
|
|
2374
2390
|
}).catch((err) => {
|
|
@@ -2669,7 +2685,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
2669
2685
|
}
|
|
2670
2686
|
return wrappedHook;
|
|
2671
2687
|
} else {
|
|
2672
|
-
const apiName = shared.toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
|
|
2688
|
+
const apiName = shared.toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
|
2673
2689
|
warn(
|
|
2674
2690
|
`${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.` )
|
|
2675
2691
|
);
|
|
@@ -2891,7 +2907,10 @@ const publicPropertiesMap = (
|
|
|
2891
2907
|
$root: (i) => getPublicInstance(i.root),
|
|
2892
2908
|
$emit: (i) => i.emit,
|
|
2893
2909
|
$options: (i) => resolveMergedOptions(i) ,
|
|
2894
|
-
$forceUpdate: (i) => i.f || (i.f = () =>
|
|
2910
|
+
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
2911
|
+
i.effect.dirty = true;
|
|
2912
|
+
queueJob(i.update);
|
|
2913
|
+
}),
|
|
2895
2914
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
2896
2915
|
$watch: (i) => instanceWatch.bind(i)
|
|
2897
2916
|
})
|
|
@@ -5642,6 +5661,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5642
5661
|
} else {
|
|
5643
5662
|
instance.next = n2;
|
|
5644
5663
|
invalidateJob(instance.update);
|
|
5664
|
+
instance.effect.dirty = true;
|
|
5645
5665
|
instance.update();
|
|
5646
5666
|
}
|
|
5647
5667
|
} else {
|
|
@@ -5811,11 +5831,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5811
5831
|
};
|
|
5812
5832
|
const effect = instance.effect = new reactivity.ReactiveEffect(
|
|
5813
5833
|
componentUpdateFn,
|
|
5834
|
+
shared.NOOP,
|
|
5814
5835
|
() => queueJob(update),
|
|
5815
5836
|
instance.scope
|
|
5816
5837
|
// track it in component's effect scope
|
|
5817
5838
|
);
|
|
5818
|
-
const update = instance.update = () =>
|
|
5839
|
+
const update = instance.update = () => {
|
|
5840
|
+
if (effect.dirty) {
|
|
5841
|
+
effect.run();
|
|
5842
|
+
}
|
|
5843
|
+
};
|
|
5819
5844
|
update.id = instance.uid;
|
|
5820
5845
|
toggleRecurse(instance, true);
|
|
5821
5846
|
{
|
|
@@ -7721,7 +7746,8 @@ function isMemoSame(cached, memo) {
|
|
|
7721
7746
|
return true;
|
|
7722
7747
|
}
|
|
7723
7748
|
|
|
7724
|
-
const version = "3.
|
|
7749
|
+
const version = "3.4.0-alpha.1";
|
|
7750
|
+
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
7725
7751
|
const _ssrUtils = {
|
|
7726
7752
|
createComponentInstance,
|
|
7727
7753
|
setupComponent,
|
|
@@ -7771,6 +7797,7 @@ exports.toHandlerKey = shared.toHandlerKey;
|
|
|
7771
7797
|
exports.BaseTransition = BaseTransition;
|
|
7772
7798
|
exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
|
|
7773
7799
|
exports.Comment = Comment;
|
|
7800
|
+
exports.ErrorTypeStrings = ErrorTypeStrings;
|
|
7774
7801
|
exports.Fragment = Fragment;
|
|
7775
7802
|
exports.KeepAlive = KeepAlive;
|
|
7776
7803
|
exports.Static = Static;
|
|
@@ -1128,8 +1128,15 @@ const INITIAL_WATCHER_VALUE = {};
|
|
|
1128
1128
|
function watch(source, cb, options) {
|
|
1129
1129
|
return doWatch(source, cb, options);
|
|
1130
1130
|
}
|
|
1131
|
-
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = shared.EMPTY_OBJ) {
|
|
1131
|
+
function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = shared.EMPTY_OBJ) {
|
|
1132
1132
|
var _a;
|
|
1133
|
+
if (cb && once) {
|
|
1134
|
+
const _cb = cb;
|
|
1135
|
+
cb = (...args) => {
|
|
1136
|
+
_cb(...args);
|
|
1137
|
+
unwatch();
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1133
1140
|
const instance = reactivity.getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;
|
|
1134
1141
|
let getter;
|
|
1135
1142
|
let forceTrigger = false;
|
|
@@ -1205,7 +1212,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1205
1212
|
}
|
|
1206
1213
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
1207
1214
|
const job = () => {
|
|
1208
|
-
if (!effect.active) {
|
|
1215
|
+
if (!effect.active || !effect.dirty) {
|
|
1209
1216
|
return;
|
|
1210
1217
|
}
|
|
1211
1218
|
if (cb) {
|
|
@@ -1238,7 +1245,13 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1238
1245
|
job.id = instance.uid;
|
|
1239
1246
|
scheduler = () => queueJob(job);
|
|
1240
1247
|
}
|
|
1241
|
-
const effect = new reactivity.ReactiveEffect(getter, scheduler);
|
|
1248
|
+
const effect = new reactivity.ReactiveEffect(getter, shared.NOOP, scheduler);
|
|
1249
|
+
const unwatch = () => {
|
|
1250
|
+
effect.stop();
|
|
1251
|
+
if (instance && instance.scope) {
|
|
1252
|
+
shared.remove(instance.scope.effects, effect);
|
|
1253
|
+
}
|
|
1254
|
+
};
|
|
1242
1255
|
if (cb) {
|
|
1243
1256
|
if (immediate) {
|
|
1244
1257
|
job();
|
|
@@ -1253,12 +1266,6 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1253
1266
|
} else {
|
|
1254
1267
|
effect.run();
|
|
1255
1268
|
}
|
|
1256
|
-
const unwatch = () => {
|
|
1257
|
-
effect.stop();
|
|
1258
|
-
if (instance && instance.scope) {
|
|
1259
|
-
shared.remove(instance.scope.effects, effect);
|
|
1260
|
-
}
|
|
1261
|
-
};
|
|
1262
1269
|
if (ssrCleanup)
|
|
1263
1270
|
ssrCleanup.push(unwatch);
|
|
1264
1271
|
return unwatch;
|
|
@@ -1474,6 +1481,7 @@ const BaseTransitionImpl = {
|
|
|
1474
1481
|
leavingHooks.afterLeave = () => {
|
|
1475
1482
|
state.isLeaving = false;
|
|
1476
1483
|
if (instance.update.active !== false) {
|
|
1484
|
+
instance.effect.dirty = true;
|
|
1477
1485
|
instance.update();
|
|
1478
1486
|
}
|
|
1479
1487
|
};
|
|
@@ -1801,6 +1809,7 @@ function defineAsyncComponent(source) {
|
|
|
1801
1809
|
load().then(() => {
|
|
1802
1810
|
loaded.value = true;
|
|
1803
1811
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
1812
|
+
instance.parent.effect.dirty = true;
|
|
1804
1813
|
queueJob(instance.parent.update);
|
|
1805
1814
|
}
|
|
1806
1815
|
}).catch((err) => {
|
|
@@ -2284,7 +2293,10 @@ const publicPropertiesMap = (
|
|
|
2284
2293
|
$root: (i) => getPublicInstance(i.root),
|
|
2285
2294
|
$emit: (i) => i.emit,
|
|
2286
2295
|
$options: (i) => resolveMergedOptions(i) ,
|
|
2287
|
-
$forceUpdate: (i) => i.f || (i.f = () =>
|
|
2296
|
+
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
2297
|
+
i.effect.dirty = true;
|
|
2298
|
+
queueJob(i.update);
|
|
2299
|
+
}),
|
|
2288
2300
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
2289
2301
|
$watch: (i) => instanceWatch.bind(i)
|
|
2290
2302
|
})
|
|
@@ -4441,6 +4453,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4441
4453
|
} else {
|
|
4442
4454
|
instance.next = n2;
|
|
4443
4455
|
invalidateJob(instance.update);
|
|
4456
|
+
instance.effect.dirty = true;
|
|
4444
4457
|
instance.update();
|
|
4445
4458
|
}
|
|
4446
4459
|
} else {
|
|
@@ -4562,11 +4575,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4562
4575
|
};
|
|
4563
4576
|
const effect = instance.effect = new reactivity.ReactiveEffect(
|
|
4564
4577
|
componentUpdateFn,
|
|
4578
|
+
shared.NOOP,
|
|
4565
4579
|
() => queueJob(update),
|
|
4566
4580
|
instance.scope
|
|
4567
4581
|
// track it in component's effect scope
|
|
4568
4582
|
);
|
|
4569
|
-
const update = instance.update = () =>
|
|
4583
|
+
const update = instance.update = () => {
|
|
4584
|
+
if (effect.dirty) {
|
|
4585
|
+
effect.run();
|
|
4586
|
+
}
|
|
4587
|
+
};
|
|
4570
4588
|
update.id = instance.uid;
|
|
4571
4589
|
toggleRecurse(instance, true);
|
|
4572
4590
|
update();
|
|
@@ -6070,7 +6088,8 @@ function isMemoSame(cached, memo) {
|
|
|
6070
6088
|
return true;
|
|
6071
6089
|
}
|
|
6072
6090
|
|
|
6073
|
-
const version = "3.
|
|
6091
|
+
const version = "3.4.0-alpha.1";
|
|
6092
|
+
const ErrorTypeStrings = null;
|
|
6074
6093
|
const _ssrUtils = {
|
|
6075
6094
|
createComponentInstance,
|
|
6076
6095
|
setupComponent,
|
|
@@ -6120,6 +6139,7 @@ exports.toHandlerKey = shared.toHandlerKey;
|
|
|
6120
6139
|
exports.BaseTransition = BaseTransition;
|
|
6121
6140
|
exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
|
|
6122
6141
|
exports.Comment = Comment;
|
|
6142
|
+
exports.ErrorTypeStrings = ErrorTypeStrings;
|
|
6123
6143
|
exports.Fragment = Fragment;
|
|
6124
6144
|
exports.KeepAlive = KeepAlive;
|
|
6125
6145
|
exports.Static = Static;
|
package/dist/runtime-core.d.ts
CHANGED
|
@@ -1112,6 +1112,7 @@ export interface WatchOptionsBase extends DebuggerOptions {
|
|
|
1112
1112
|
export interface WatchOptions<Immediate = boolean> extends WatchOptionsBase {
|
|
1113
1113
|
immediate?: Immediate;
|
|
1114
1114
|
deep?: boolean;
|
|
1115
|
+
once?: boolean;
|
|
1115
1116
|
}
|
|
1116
1117
|
export type WatchStopHandle = () => void;
|
|
1117
1118
|
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();
|
|
@@ -1650,8 +1652,15 @@ function watch(source, cb, options) {
|
|
|
1650
1652
|
}
|
|
1651
1653
|
return doWatch(source, cb, options);
|
|
1652
1654
|
}
|
|
1653
|
-
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
1655
|
+
function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
1654
1656
|
var _a;
|
|
1657
|
+
if (cb && once) {
|
|
1658
|
+
const _cb = cb;
|
|
1659
|
+
cb = (...args) => {
|
|
1660
|
+
_cb(...args);
|
|
1661
|
+
unwatch();
|
|
1662
|
+
};
|
|
1663
|
+
}
|
|
1655
1664
|
if (!!(process.env.NODE_ENV !== "production") && !cb) {
|
|
1656
1665
|
if (immediate !== void 0) {
|
|
1657
1666
|
warn(
|
|
@@ -1663,6 +1672,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1663
1672
|
`watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
|
|
1664
1673
|
);
|
|
1665
1674
|
}
|
|
1675
|
+
if (once !== void 0) {
|
|
1676
|
+
warn(
|
|
1677
|
+
`watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
|
|
1678
|
+
);
|
|
1679
|
+
}
|
|
1666
1680
|
}
|
|
1667
1681
|
const warnInvalidSource = (s) => {
|
|
1668
1682
|
warn(
|
|
@@ -1749,7 +1763,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1749
1763
|
}
|
|
1750
1764
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
1751
1765
|
const job = () => {
|
|
1752
|
-
if (!effect.active) {
|
|
1766
|
+
if (!effect.active || !effect.dirty) {
|
|
1753
1767
|
return;
|
|
1754
1768
|
}
|
|
1755
1769
|
if (cb) {
|
|
@@ -1782,7 +1796,13 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1782
1796
|
job.id = instance.uid;
|
|
1783
1797
|
scheduler = () => queueJob(job);
|
|
1784
1798
|
}
|
|
1785
|
-
const effect = new ReactiveEffect(getter, scheduler);
|
|
1799
|
+
const effect = new ReactiveEffect(getter, NOOP, scheduler);
|
|
1800
|
+
const unwatch = () => {
|
|
1801
|
+
effect.stop();
|
|
1802
|
+
if (instance && instance.scope) {
|
|
1803
|
+
remove(instance.scope.effects, effect);
|
|
1804
|
+
}
|
|
1805
|
+
};
|
|
1786
1806
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1787
1807
|
effect.onTrack = onTrack;
|
|
1788
1808
|
effect.onTrigger = onTrigger;
|
|
@@ -1801,12 +1821,6 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1801
1821
|
} else {
|
|
1802
1822
|
effect.run();
|
|
1803
1823
|
}
|
|
1804
|
-
const unwatch = () => {
|
|
1805
|
-
effect.stop();
|
|
1806
|
-
if (instance && instance.scope) {
|
|
1807
|
-
remove(instance.scope.effects, effect);
|
|
1808
|
-
}
|
|
1809
|
-
};
|
|
1810
1824
|
if (ssrCleanup)
|
|
1811
1825
|
ssrCleanup.push(unwatch);
|
|
1812
1826
|
return unwatch;
|
|
@@ -2040,6 +2054,7 @@ const BaseTransitionImpl = {
|
|
|
2040
2054
|
leavingHooks.afterLeave = () => {
|
|
2041
2055
|
state.isLeaving = false;
|
|
2042
2056
|
if (instance.update.active !== false) {
|
|
2057
|
+
instance.effect.dirty = true;
|
|
2043
2058
|
instance.update();
|
|
2044
2059
|
}
|
|
2045
2060
|
};
|
|
@@ -2375,6 +2390,7 @@ function defineAsyncComponent(source) {
|
|
|
2375
2390
|
load().then(() => {
|
|
2376
2391
|
loaded.value = true;
|
|
2377
2392
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
2393
|
+
instance.parent.effect.dirty = true;
|
|
2378
2394
|
queueJob(instance.parent.update);
|
|
2379
2395
|
}
|
|
2380
2396
|
}).catch((err) => {
|
|
@@ -2675,7 +2691,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
2675
2691
|
}
|
|
2676
2692
|
return wrappedHook;
|
|
2677
2693
|
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2678
|
-
const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
|
|
2694
|
+
const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
|
2679
2695
|
warn(
|
|
2680
2696
|
`${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.` )
|
|
2681
2697
|
);
|
|
@@ -2897,7 +2913,10 @@ const publicPropertiesMap = (
|
|
|
2897
2913
|
$root: (i) => getPublicInstance(i.root),
|
|
2898
2914
|
$emit: (i) => i.emit,
|
|
2899
2915
|
$options: (i) => __VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type,
|
|
2900
|
-
$forceUpdate: (i) => i.f || (i.f = () =>
|
|
2916
|
+
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
2917
|
+
i.effect.dirty = true;
|
|
2918
|
+
queueJob(i.update);
|
|
2919
|
+
}),
|
|
2901
2920
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
2902
2921
|
$watch: (i) => __VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP
|
|
2903
2922
|
})
|
|
@@ -5686,6 +5705,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5686
5705
|
} else {
|
|
5687
5706
|
instance.next = n2;
|
|
5688
5707
|
invalidateJob(instance.update);
|
|
5708
|
+
instance.effect.dirty = true;
|
|
5689
5709
|
instance.update();
|
|
5690
5710
|
}
|
|
5691
5711
|
} else {
|
|
@@ -5855,11 +5875,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5855
5875
|
};
|
|
5856
5876
|
const effect = instance.effect = new ReactiveEffect(
|
|
5857
5877
|
componentUpdateFn,
|
|
5878
|
+
NOOP,
|
|
5858
5879
|
() => queueJob(update),
|
|
5859
5880
|
instance.scope
|
|
5860
5881
|
// track it in component's effect scope
|
|
5861
5882
|
);
|
|
5862
|
-
const update = instance.update = () =>
|
|
5883
|
+
const update = instance.update = () => {
|
|
5884
|
+
if (effect.dirty) {
|
|
5885
|
+
effect.run();
|
|
5886
|
+
}
|
|
5887
|
+
};
|
|
5863
5888
|
update.id = instance.uid;
|
|
5864
5889
|
toggleRecurse(instance, true);
|
|
5865
5890
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
@@ -7781,7 +7806,8 @@ function isMemoSame(cached, memo) {
|
|
|
7781
7806
|
return true;
|
|
7782
7807
|
}
|
|
7783
7808
|
|
|
7784
|
-
const version = "3.
|
|
7809
|
+
const version = "3.4.0-alpha.1";
|
|
7810
|
+
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
7785
7811
|
const _ssrUtils = {
|
|
7786
7812
|
createComponentInstance,
|
|
7787
7813
|
setupComponent,
|
|
@@ -7794,4 +7820,4 @@ const ssrUtils = _ssrUtils ;
|
|
|
7794
7820
|
const resolveFilter = null;
|
|
7795
7821
|
const compatUtils = null;
|
|
7796
7822
|
|
|
7797
|
-
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 };
|
|
7823
|
+
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.1",
|
|
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.1",
|
|
36
|
+
"@vue/reactivity": "3.4.0-alpha.1"
|
|
37
37
|
}
|
|
38
38
|
}
|