@vue/runtime-core 3.6.0-beta.13 → 3.6.0-beta.15
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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-core v3.6.0-beta.
|
|
2
|
+
* @vue/runtime-core v3.6.0-beta.15
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -383,6 +383,7 @@ function flushJobs(seen) {
|
|
|
383
383
|
}
|
|
384
384
|
flushIndex = 0;
|
|
385
385
|
jobsLength = 0;
|
|
386
|
+
jobs.length = 0;
|
|
386
387
|
flushPostFlushCbs(seen);
|
|
387
388
|
currentFlushPromise = null;
|
|
388
389
|
if (jobsLength || postJobs.length) flushJobs(seen);
|
|
@@ -440,6 +441,14 @@ function createRecord(id, initialDef) {
|
|
|
440
441
|
function normalizeClassComponent(component) {
|
|
441
442
|
return isClassComponent(component) ? component.__vccOpts : component;
|
|
442
443
|
}
|
|
444
|
+
function hasDirtyAncestor(instance, dirtyInstances) {
|
|
445
|
+
let parent = instance.parent;
|
|
446
|
+
while (parent) {
|
|
447
|
+
if (dirtyInstances.has(parent)) return true;
|
|
448
|
+
parent = parent.parent;
|
|
449
|
+
}
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
443
452
|
function rerender(id, newRender) {
|
|
444
453
|
const record = map.get(id);
|
|
445
454
|
if (!record) return;
|
|
@@ -471,42 +480,69 @@ function reload(id, newComp) {
|
|
|
471
480
|
const isVapor = record.initialDef.__vapor;
|
|
472
481
|
updateComponentDef(record.initialDef, newComp);
|
|
473
482
|
const instances = [...record.instances];
|
|
474
|
-
if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
|
|
483
|
+
if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
|
|
475
484
|
for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
const
|
|
479
|
-
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
480
|
-
if (!dirtyInstances) {
|
|
481
|
-
if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
|
|
482
|
-
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
483
|
-
}
|
|
484
|
-
dirtyInstances.add(instance);
|
|
485
|
-
hmrDirtyComponentsMode.set(oldComp, !!isVapor);
|
|
486
|
-
instance.appContext.propsCache.delete(instance.type);
|
|
487
|
-
instance.appContext.emitsCache.delete(instance.type);
|
|
488
|
-
instance.appContext.optionsCache.delete(instance.type);
|
|
489
|
-
if (instance.ceReload) {
|
|
490
|
-
dirtyInstances.add(instance);
|
|
491
|
-
instance.ceReload(newComp.styles);
|
|
492
|
-
dirtyInstances.delete(instance);
|
|
493
|
-
} else if (instance.parent) queueJob(() => {
|
|
494
|
-
isHmrUpdating = true;
|
|
485
|
+
const dirtyInstances = new Set(instances);
|
|
486
|
+
const rerenderedParents = /* @__PURE__ */ new Set();
|
|
487
|
+
for (const instance of instances) {
|
|
495
488
|
const parent = instance.parent;
|
|
496
|
-
if (parent
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
489
|
+
if (parent) {
|
|
490
|
+
if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
|
|
491
|
+
rerenderedParents.add(parent);
|
|
492
|
+
parent.hmrRerender();
|
|
493
|
+
}
|
|
494
|
+
} else instance.hmrReload(newComp);
|
|
495
|
+
}
|
|
496
|
+
} else {
|
|
497
|
+
const parentUpdates = /* @__PURE__ */ new Map();
|
|
498
|
+
const dirtyInstanceSet = new Set(instances);
|
|
499
|
+
for (const instance of instances) {
|
|
500
|
+
const oldComp = normalizeClassComponent(instance.type);
|
|
501
|
+
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
502
|
+
if (!dirtyInstances) {
|
|
503
|
+
if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
|
|
504
|
+
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
500
505
|
}
|
|
501
|
-
|
|
502
|
-
|
|
506
|
+
dirtyInstances.add(instance);
|
|
507
|
+
hmrDirtyComponentsMode.set(oldComp, !!isVapor);
|
|
508
|
+
instance.appContext.propsCache.delete(instance.type);
|
|
509
|
+
instance.appContext.emitsCache.delete(instance.type);
|
|
510
|
+
instance.appContext.optionsCache.delete(instance.type);
|
|
511
|
+
if (instance.ceReload) {
|
|
512
|
+
dirtyInstances.add(instance);
|
|
513
|
+
instance.ceReload(newComp.styles);
|
|
514
|
+
dirtyInstances.delete(instance);
|
|
515
|
+
} else if (instance.parent) {
|
|
516
|
+
const parent = instance.parent;
|
|
517
|
+
if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
|
|
518
|
+
let updates = parentUpdates.get(parent);
|
|
519
|
+
if (!updates) parentUpdates.set(parent, updates = []);
|
|
520
|
+
updates.push([instance, dirtyInstances]);
|
|
521
|
+
}
|
|
522
|
+
} else if (instance.appContext.reload) instance.appContext.reload();
|
|
523
|
+
else if (typeof window !== "undefined") window.location.reload();
|
|
524
|
+
else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
525
|
+
if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
|
|
526
|
+
}
|
|
527
|
+
parentUpdates.forEach((updates, parent) => {
|
|
528
|
+
queueJob(() => {
|
|
529
|
+
isHmrUpdating = true;
|
|
530
|
+
if (parent.vapor) parent.hmrRerender();
|
|
531
|
+
else {
|
|
532
|
+
const i = parent;
|
|
533
|
+
if (!(i.effect.flags & 1024)) {
|
|
534
|
+
i.renderCache = [];
|
|
535
|
+
i.effect.run();
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
nextTick(() => {
|
|
539
|
+
isHmrUpdating = false;
|
|
540
|
+
});
|
|
541
|
+
updates.forEach(([instance, dirtyInstances]) => {
|
|
542
|
+
dirtyInstances.delete(instance);
|
|
543
|
+
});
|
|
503
544
|
});
|
|
504
|
-
dirtyInstances.delete(instance);
|
|
505
545
|
});
|
|
506
|
-
else if (instance.appContext.reload) instance.appContext.reload();
|
|
507
|
-
else if (typeof window !== "undefined") window.location.reload();
|
|
508
|
-
else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
509
|
-
if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
|
|
510
546
|
}
|
|
511
547
|
queuePostFlushCb(() => {
|
|
512
548
|
hmrDirtyComponents.clear();
|
|
@@ -2004,11 +2040,16 @@ function defineAsyncComponent(source) {
|
|
|
2004
2040
|
onError(err);
|
|
2005
2041
|
return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
|
|
2006
2042
|
});
|
|
2007
|
-
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
|
|
2043
|
+
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
|
|
2008
2044
|
load().then(() => {
|
|
2045
|
+
if (instance.isUnmounted) return;
|
|
2009
2046
|
loaded.value = true;
|
|
2010
2047
|
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
|
|
2011
2048
|
}).catch((err) => {
|
|
2049
|
+
if (instance.isUnmounted) {
|
|
2050
|
+
setPendingRequest(null);
|
|
2051
|
+
return;
|
|
2052
|
+
}
|
|
2012
2053
|
onError(err);
|
|
2013
2054
|
error.value = err;
|
|
2014
2055
|
});
|
|
@@ -2066,14 +2107,22 @@ function createAsyncComponentContext(source) {
|
|
|
2066
2107
|
setPendingRequest: (request) => pendingRequest = request
|
|
2067
2108
|
};
|
|
2068
2109
|
}
|
|
2069
|
-
const useAsyncComponentState = (delay, timeout, onError) => {
|
|
2110
|
+
const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
|
|
2070
2111
|
const loaded = (0, _vue_reactivity.ref)(false);
|
|
2071
2112
|
const error = (0, _vue_reactivity.ref)();
|
|
2072
2113
|
const delayed = (0, _vue_reactivity.ref)(!!delay);
|
|
2073
|
-
|
|
2114
|
+
let timeoutTimer;
|
|
2115
|
+
let delayTimer;
|
|
2116
|
+
if (instance) onUnmounted(() => {
|
|
2117
|
+
if (timeoutTimer != null) clearTimeout(timeoutTimer);
|
|
2118
|
+
if (delayTimer != null) clearTimeout(delayTimer);
|
|
2119
|
+
}, instance);
|
|
2120
|
+
if (delay) delayTimer = setTimeout(() => {
|
|
2121
|
+
if (instance && instance.isUnmounted) return;
|
|
2074
2122
|
delayed.value = false;
|
|
2075
2123
|
}, delay);
|
|
2076
|
-
if (timeout != null) setTimeout(() => {
|
|
2124
|
+
if (timeout != null) timeoutTimer = setTimeout(() => {
|
|
2125
|
+
if (instance && instance.isUnmounted) return;
|
|
2077
2126
|
if (!loaded.value && !error.value) {
|
|
2078
2127
|
const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
|
|
2079
2128
|
onError(err);
|
|
@@ -2480,6 +2529,7 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
2480
2529
|
slot: vaporSlot,
|
|
2481
2530
|
fallback
|
|
2482
2531
|
};
|
|
2532
|
+
if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
|
|
2483
2533
|
return ret;
|
|
2484
2534
|
}
|
|
2485
2535
|
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
@@ -3334,12 +3384,13 @@ function useModel(props, name, options = _vue_shared.EMPTY_OBJ) {
|
|
|
3334
3384
|
for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
|
|
3335
3385
|
else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
|
|
3336
3386
|
}
|
|
3337
|
-
|
|
3387
|
+
const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
|
|
3388
|
+
if (!hasVModel) {
|
|
3338
3389
|
localValue = value;
|
|
3339
3390
|
trigger();
|
|
3340
3391
|
}
|
|
3341
3392
|
i.emit(`update:${name}`, emittedValue);
|
|
3342
|
-
if ((0, _vue_shared.hasChanged)(value,
|
|
3393
|
+
if ((0, _vue_shared.hasChanged)(value, prevSetValue) && ((0, _vue_shared.hasChanged)(value, emittedValue) && !(0, _vue_shared.hasChanged)(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== _vue_shared.EMPTY_OBJ && !(0, _vue_shared.hasChanged)(emittedValue, localValue))) trigger();
|
|
3343
3394
|
prevSetValue = value;
|
|
3344
3395
|
prevEmittedValue = emittedValue;
|
|
3345
3396
|
}
|
|
@@ -6195,7 +6246,7 @@ function isMemoSame(cached, memo) {
|
|
|
6195
6246
|
}
|
|
6196
6247
|
//#endregion
|
|
6197
6248
|
//#region packages/runtime-core/src/index.ts
|
|
6198
|
-
const version = "3.6.0-beta.
|
|
6249
|
+
const version = "3.6.0-beta.15";
|
|
6199
6250
|
const warn = warn$1;
|
|
6200
6251
|
/**
|
|
6201
6252
|
* Runtime error messages. Only exposed in dev or esm builds.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-core v3.6.0-beta.
|
|
2
|
+
* @vue/runtime-core v3.6.0-beta.15
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -273,6 +273,7 @@ function flushJobs(seen) {
|
|
|
273
273
|
}
|
|
274
274
|
flushIndex = 0;
|
|
275
275
|
jobsLength = 0;
|
|
276
|
+
jobs.length = 0;
|
|
276
277
|
flushPostFlushCbs(seen);
|
|
277
278
|
currentFlushPromise = null;
|
|
278
279
|
if (jobsLength || postJobs.length) flushJobs(seen);
|
|
@@ -1511,11 +1512,16 @@ function defineAsyncComponent(source) {
|
|
|
1511
1512
|
onError(err);
|
|
1512
1513
|
return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
|
|
1513
1514
|
});
|
|
1514
|
-
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
|
|
1515
|
+
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
|
|
1515
1516
|
load().then(() => {
|
|
1517
|
+
if (instance.isUnmounted) return;
|
|
1516
1518
|
loaded.value = true;
|
|
1517
1519
|
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
|
|
1518
1520
|
}).catch((err) => {
|
|
1521
|
+
if (instance.isUnmounted) {
|
|
1522
|
+
setPendingRequest(null);
|
|
1523
|
+
return;
|
|
1524
|
+
}
|
|
1519
1525
|
onError(err);
|
|
1520
1526
|
error.value = err;
|
|
1521
1527
|
});
|
|
@@ -1571,14 +1577,22 @@ function createAsyncComponentContext(source) {
|
|
|
1571
1577
|
setPendingRequest: (request) => pendingRequest = request
|
|
1572
1578
|
};
|
|
1573
1579
|
}
|
|
1574
|
-
const useAsyncComponentState = (delay, timeout, onError) => {
|
|
1580
|
+
const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
|
|
1575
1581
|
const loaded = (0, _vue_reactivity.ref)(false);
|
|
1576
1582
|
const error = (0, _vue_reactivity.ref)();
|
|
1577
1583
|
const delayed = (0, _vue_reactivity.ref)(!!delay);
|
|
1578
|
-
|
|
1584
|
+
let timeoutTimer;
|
|
1585
|
+
let delayTimer;
|
|
1586
|
+
if (instance) onUnmounted(() => {
|
|
1587
|
+
if (timeoutTimer != null) clearTimeout(timeoutTimer);
|
|
1588
|
+
if (delayTimer != null) clearTimeout(delayTimer);
|
|
1589
|
+
}, instance);
|
|
1590
|
+
if (delay) delayTimer = setTimeout(() => {
|
|
1591
|
+
if (instance && instance.isUnmounted) return;
|
|
1579
1592
|
delayed.value = false;
|
|
1580
1593
|
}, delay);
|
|
1581
|
-
if (timeout != null) setTimeout(() => {
|
|
1594
|
+
if (timeout != null) timeoutTimer = setTimeout(() => {
|
|
1595
|
+
if (instance && instance.isUnmounted) return;
|
|
1582
1596
|
if (!loaded.value && !error.value) {
|
|
1583
1597
|
const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
|
|
1584
1598
|
onError(err);
|
|
@@ -1967,6 +1981,7 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
1967
1981
|
slot: vaporSlot,
|
|
1968
1982
|
fallback
|
|
1969
1983
|
};
|
|
1984
|
+
if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
|
|
1970
1985
|
return ret;
|
|
1971
1986
|
}
|
|
1972
1987
|
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
@@ -2656,12 +2671,13 @@ function useModel(props, name, options = _vue_shared.EMPTY_OBJ) {
|
|
|
2656
2671
|
for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
|
|
2657
2672
|
else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
|
|
2658
2673
|
}
|
|
2659
|
-
|
|
2674
|
+
const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
|
|
2675
|
+
if (!hasVModel) {
|
|
2660
2676
|
localValue = value;
|
|
2661
2677
|
trigger();
|
|
2662
2678
|
}
|
|
2663
2679
|
i.emit(`update:${name}`, emittedValue);
|
|
2664
|
-
if ((0, _vue_shared.hasChanged)(value,
|
|
2680
|
+
if ((0, _vue_shared.hasChanged)(value, prevSetValue) && ((0, _vue_shared.hasChanged)(value, emittedValue) && !(0, _vue_shared.hasChanged)(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== _vue_shared.EMPTY_OBJ && !(0, _vue_shared.hasChanged)(emittedValue, localValue))) trigger();
|
|
2665
2681
|
prevSetValue = value;
|
|
2666
2682
|
prevEmittedValue = emittedValue;
|
|
2667
2683
|
}
|
|
@@ -4891,7 +4907,7 @@ function isMemoSame(cached, memo) {
|
|
|
4891
4907
|
}
|
|
4892
4908
|
//#endregion
|
|
4893
4909
|
//#region packages/runtime-core/src/index.ts
|
|
4894
|
-
const version = "3.6.0-beta.
|
|
4910
|
+
const version = "3.6.0-beta.15";
|
|
4895
4911
|
const warn = _vue_shared.NOOP;
|
|
4896
4912
|
/**
|
|
4897
4913
|
* Runtime error messages. Only exposed in dev or esm builds.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-core v3.6.0-beta.
|
|
2
|
+
* @vue/runtime-core v3.6.0-beta.15
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -389,6 +389,7 @@ function flushJobs(seen) {
|
|
|
389
389
|
}
|
|
390
390
|
flushIndex = 0;
|
|
391
391
|
jobsLength = 0;
|
|
392
|
+
jobs.length = 0;
|
|
392
393
|
flushPostFlushCbs(seen);
|
|
393
394
|
currentFlushPromise = null;
|
|
394
395
|
if (jobsLength || postJobs.length) flushJobs(seen);
|
|
@@ -446,6 +447,14 @@ function createRecord(id, initialDef) {
|
|
|
446
447
|
function normalizeClassComponent(component) {
|
|
447
448
|
return isClassComponent(component) ? component.__vccOpts : component;
|
|
448
449
|
}
|
|
450
|
+
function hasDirtyAncestor(instance, dirtyInstances) {
|
|
451
|
+
let parent = instance.parent;
|
|
452
|
+
while (parent) {
|
|
453
|
+
if (dirtyInstances.has(parent)) return true;
|
|
454
|
+
parent = parent.parent;
|
|
455
|
+
}
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
449
458
|
function rerender(id, newRender) {
|
|
450
459
|
const record = map.get(id);
|
|
451
460
|
if (!record) return;
|
|
@@ -477,42 +486,69 @@ function reload(id, newComp) {
|
|
|
477
486
|
const isVapor = record.initialDef.__vapor;
|
|
478
487
|
updateComponentDef(record.initialDef, newComp);
|
|
479
488
|
const instances = [...record.instances];
|
|
480
|
-
if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
|
|
489
|
+
if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
|
|
481
490
|
for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
const
|
|
485
|
-
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
486
|
-
if (!dirtyInstances) {
|
|
487
|
-
if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
|
|
488
|
-
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
489
|
-
}
|
|
490
|
-
dirtyInstances.add(instance);
|
|
491
|
-
hmrDirtyComponentsMode.set(oldComp, !!isVapor);
|
|
492
|
-
instance.appContext.propsCache.delete(instance.type);
|
|
493
|
-
instance.appContext.emitsCache.delete(instance.type);
|
|
494
|
-
instance.appContext.optionsCache.delete(instance.type);
|
|
495
|
-
if (instance.ceReload) {
|
|
496
|
-
dirtyInstances.add(instance);
|
|
497
|
-
instance.ceReload(newComp.styles);
|
|
498
|
-
dirtyInstances.delete(instance);
|
|
499
|
-
} else if (instance.parent) queueJob(() => {
|
|
500
|
-
isHmrUpdating = true;
|
|
491
|
+
const dirtyInstances = new Set(instances);
|
|
492
|
+
const rerenderedParents = /* @__PURE__ */ new Set();
|
|
493
|
+
for (const instance of instances) {
|
|
501
494
|
const parent = instance.parent;
|
|
502
|
-
if (parent
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
495
|
+
if (parent) {
|
|
496
|
+
if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
|
|
497
|
+
rerenderedParents.add(parent);
|
|
498
|
+
parent.hmrRerender();
|
|
499
|
+
}
|
|
500
|
+
} else instance.hmrReload(newComp);
|
|
501
|
+
}
|
|
502
|
+
} else {
|
|
503
|
+
const parentUpdates = /* @__PURE__ */ new Map();
|
|
504
|
+
const dirtyInstanceSet = new Set(instances);
|
|
505
|
+
for (const instance of instances) {
|
|
506
|
+
const oldComp = normalizeClassComponent(instance.type);
|
|
507
|
+
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
508
|
+
if (!dirtyInstances) {
|
|
509
|
+
if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
|
|
510
|
+
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
506
511
|
}
|
|
507
|
-
|
|
508
|
-
|
|
512
|
+
dirtyInstances.add(instance);
|
|
513
|
+
hmrDirtyComponentsMode.set(oldComp, !!isVapor);
|
|
514
|
+
instance.appContext.propsCache.delete(instance.type);
|
|
515
|
+
instance.appContext.emitsCache.delete(instance.type);
|
|
516
|
+
instance.appContext.optionsCache.delete(instance.type);
|
|
517
|
+
if (instance.ceReload) {
|
|
518
|
+
dirtyInstances.add(instance);
|
|
519
|
+
instance.ceReload(newComp.styles);
|
|
520
|
+
dirtyInstances.delete(instance);
|
|
521
|
+
} else if (instance.parent) {
|
|
522
|
+
const parent = instance.parent;
|
|
523
|
+
if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
|
|
524
|
+
let updates = parentUpdates.get(parent);
|
|
525
|
+
if (!updates) parentUpdates.set(parent, updates = []);
|
|
526
|
+
updates.push([instance, dirtyInstances]);
|
|
527
|
+
}
|
|
528
|
+
} else if (instance.appContext.reload) instance.appContext.reload();
|
|
529
|
+
else if (typeof window !== "undefined") window.location.reload();
|
|
530
|
+
else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
531
|
+
if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
|
|
532
|
+
}
|
|
533
|
+
parentUpdates.forEach((updates, parent) => {
|
|
534
|
+
queueJob(() => {
|
|
535
|
+
isHmrUpdating = true;
|
|
536
|
+
if (parent.vapor) parent.hmrRerender();
|
|
537
|
+
else {
|
|
538
|
+
const i = parent;
|
|
539
|
+
if (!(i.effect.flags & 1024)) {
|
|
540
|
+
i.renderCache = [];
|
|
541
|
+
i.effect.run();
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
nextTick(() => {
|
|
545
|
+
isHmrUpdating = false;
|
|
546
|
+
});
|
|
547
|
+
updates.forEach(([instance, dirtyInstances]) => {
|
|
548
|
+
dirtyInstances.delete(instance);
|
|
549
|
+
});
|
|
509
550
|
});
|
|
510
|
-
dirtyInstances.delete(instance);
|
|
511
551
|
});
|
|
512
|
-
else if (instance.appContext.reload) instance.appContext.reload();
|
|
513
|
-
else if (typeof window !== "undefined") window.location.reload();
|
|
514
|
-
else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
515
|
-
if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
|
|
516
552
|
}
|
|
517
553
|
queuePostFlushCb(() => {
|
|
518
554
|
hmrDirtyComponents.clear();
|
|
@@ -2041,11 +2077,16 @@ function defineAsyncComponent(source) {
|
|
|
2041
2077
|
onError(err);
|
|
2042
2078
|
return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
|
|
2043
2079
|
});
|
|
2044
|
-
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
|
|
2080
|
+
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
|
|
2045
2081
|
load().then(() => {
|
|
2082
|
+
if (instance.isUnmounted) return;
|
|
2046
2083
|
loaded.value = true;
|
|
2047
2084
|
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
|
|
2048
2085
|
}).catch((err) => {
|
|
2086
|
+
if (instance.isUnmounted) {
|
|
2087
|
+
setPendingRequest(null);
|
|
2088
|
+
return;
|
|
2089
|
+
}
|
|
2049
2090
|
onError(err);
|
|
2050
2091
|
error.value = err;
|
|
2051
2092
|
});
|
|
@@ -2103,14 +2144,22 @@ function createAsyncComponentContext(source) {
|
|
|
2103
2144
|
setPendingRequest: (request) => pendingRequest = request
|
|
2104
2145
|
};
|
|
2105
2146
|
}
|
|
2106
|
-
const useAsyncComponentState = (delay, timeout, onError) => {
|
|
2147
|
+
const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
|
|
2107
2148
|
const loaded = ref$1(false);
|
|
2108
2149
|
const error = ref$1();
|
|
2109
2150
|
const delayed = ref$1(!!delay);
|
|
2110
|
-
|
|
2151
|
+
let timeoutTimer;
|
|
2152
|
+
let delayTimer;
|
|
2153
|
+
if (instance) onUnmounted(() => {
|
|
2154
|
+
if (timeoutTimer != null) clearTimeout(timeoutTimer);
|
|
2155
|
+
if (delayTimer != null) clearTimeout(delayTimer);
|
|
2156
|
+
}, instance);
|
|
2157
|
+
if (delay) delayTimer = setTimeout(() => {
|
|
2158
|
+
if (instance && instance.isUnmounted) return;
|
|
2111
2159
|
delayed.value = false;
|
|
2112
2160
|
}, delay);
|
|
2113
|
-
if (timeout != null) setTimeout(() => {
|
|
2161
|
+
if (timeout != null) timeoutTimer = setTimeout(() => {
|
|
2162
|
+
if (instance && instance.isUnmounted) return;
|
|
2114
2163
|
if (!loaded.value && !error.value) {
|
|
2115
2164
|
const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
|
|
2116
2165
|
onError(err);
|
|
@@ -2517,6 +2566,7 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
2517
2566
|
slot: vaporSlot,
|
|
2518
2567
|
fallback
|
|
2519
2568
|
};
|
|
2569
|
+
if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
|
|
2520
2570
|
return ret;
|
|
2521
2571
|
}
|
|
2522
2572
|
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
@@ -3378,12 +3428,13 @@ function useModel(props, name, options = EMPTY_OBJ) {
|
|
|
3378
3428
|
for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
|
|
3379
3429
|
else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
|
|
3380
3430
|
}
|
|
3381
|
-
|
|
3431
|
+
const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
|
|
3432
|
+
if (!hasVModel) {
|
|
3382
3433
|
localValue = value;
|
|
3383
3434
|
trigger();
|
|
3384
3435
|
}
|
|
3385
3436
|
i.emit(`update:${name}`, emittedValue);
|
|
3386
|
-
if (hasChanged(value,
|
|
3437
|
+
if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
|
|
3387
3438
|
prevSetValue = value;
|
|
3388
3439
|
prevEmittedValue = emittedValue;
|
|
3389
3440
|
}
|
|
@@ -6303,7 +6354,7 @@ function isMemoSame(cached, memo) {
|
|
|
6303
6354
|
}
|
|
6304
6355
|
//#endregion
|
|
6305
6356
|
//#region packages/runtime-core/src/index.ts
|
|
6306
|
-
const version = "3.6.0-beta.
|
|
6357
|
+
const version = "3.6.0-beta.15";
|
|
6307
6358
|
const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
|
|
6308
6359
|
/**
|
|
6309
6360
|
* Runtime error messages. Only exposed in dev or esm builds.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/runtime-core",
|
|
3
|
-
"version": "3.6.0-beta.
|
|
3
|
+
"version": "3.6.0-beta.15",
|
|
4
4
|
"description": "@vue/runtime-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/runtime-core.esm-bundler.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@vue/shared": "3.6.0-beta.
|
|
50
|
-
"@vue/reactivity": "3.6.0-beta.
|
|
49
|
+
"@vue/shared": "3.6.0-beta.15",
|
|
50
|
+
"@vue/reactivity": "3.6.0-beta.15"
|
|
51
51
|
}
|
|
52
52
|
}
|