@vue/compat 3.6.0-beta.13 → 3.6.0-beta.14

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.6.0-beta.13
2
+ * @vue/compat v3.6.0-beta.14
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2678,6 +2678,7 @@ function flushJobs(seen) {
2678
2678
  }
2679
2679
  flushIndex = 0;
2680
2680
  jobsLength = 0;
2681
+ jobs.length = 0;
2681
2682
  flushPostFlushCbs(seen);
2682
2683
  currentFlushPromise = null;
2683
2684
  if (jobsLength || postJobs.length) flushJobs(seen);
@@ -2735,6 +2736,14 @@ function createRecord(id, initialDef) {
2735
2736
  function normalizeClassComponent(component) {
2736
2737
  return isClassComponent(component) ? component.__vccOpts : component;
2737
2738
  }
2739
+ function hasDirtyAncestor(instance, dirtyInstances) {
2740
+ let parent = instance.parent;
2741
+ while (parent) {
2742
+ if (dirtyInstances.has(parent)) return true;
2743
+ parent = parent.parent;
2744
+ }
2745
+ return false;
2746
+ }
2738
2747
  function rerender(id, newRender) {
2739
2748
  const record = map.get(id);
2740
2749
  if (!record) return;
@@ -2766,42 +2775,69 @@ function reload(id, newComp) {
2766
2775
  const isVapor = record.initialDef.__vapor;
2767
2776
  updateComponentDef(record.initialDef, newComp);
2768
2777
  const instances = [...record.instances];
2769
- if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
2778
+ if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
2770
2779
  for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
2771
- for (const instance of instances) instance.hmrReload(newComp);
2772
- } else for (const instance of instances) {
2773
- const oldComp = normalizeClassComponent(instance.type);
2774
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
2775
- if (!dirtyInstances) {
2776
- if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2777
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2778
- }
2779
- dirtyInstances.add(instance);
2780
- hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2781
- instance.appContext.propsCache.delete(instance.type);
2782
- instance.appContext.emitsCache.delete(instance.type);
2783
- instance.appContext.optionsCache.delete(instance.type);
2784
- if (instance.ceReload) {
2785
- dirtyInstances.add(instance);
2786
- instance.ceReload(newComp.styles);
2787
- dirtyInstances.delete(instance);
2788
- } else if (instance.parent) queueJob(() => {
2789
- isHmrUpdating = true;
2780
+ const dirtyInstances = new Set(instances);
2781
+ const rerenderedParents = /* @__PURE__ */ new Set();
2782
+ for (const instance of instances) {
2790
2783
  const parent = instance.parent;
2791
- if (parent.vapor) parent.hmrRerender();
2792
- else if (!(parent.effect.flags & 1024)) {
2793
- parent.renderCache = [];
2794
- parent.effect.run();
2784
+ if (parent) {
2785
+ if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
2786
+ rerenderedParents.add(parent);
2787
+ parent.hmrRerender();
2788
+ }
2789
+ } else instance.hmrReload(newComp);
2790
+ }
2791
+ } else {
2792
+ const parentUpdates = /* @__PURE__ */ new Map();
2793
+ const dirtyInstanceSet = new Set(instances);
2794
+ for (const instance of instances) {
2795
+ const oldComp = normalizeClassComponent(instance.type);
2796
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2797
+ if (!dirtyInstances) {
2798
+ if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2799
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2795
2800
  }
2796
- nextTick(() => {
2797
- isHmrUpdating = false;
2801
+ dirtyInstances.add(instance);
2802
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2803
+ instance.appContext.propsCache.delete(instance.type);
2804
+ instance.appContext.emitsCache.delete(instance.type);
2805
+ instance.appContext.optionsCache.delete(instance.type);
2806
+ if (instance.ceReload) {
2807
+ dirtyInstances.add(instance);
2808
+ instance.ceReload(newComp.styles);
2809
+ dirtyInstances.delete(instance);
2810
+ } else if (instance.parent) {
2811
+ const parent = instance.parent;
2812
+ if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
2813
+ let updates = parentUpdates.get(parent);
2814
+ if (!updates) parentUpdates.set(parent, updates = []);
2815
+ updates.push([instance, dirtyInstances]);
2816
+ }
2817
+ } else if (instance.appContext.reload) instance.appContext.reload();
2818
+ else if (typeof window !== "undefined") window.location.reload();
2819
+ else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2820
+ if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2821
+ }
2822
+ parentUpdates.forEach((updates, parent) => {
2823
+ queueJob(() => {
2824
+ isHmrUpdating = true;
2825
+ if (parent.vapor) parent.hmrRerender();
2826
+ else {
2827
+ const i = parent;
2828
+ if (!(i.effect.flags & 1024)) {
2829
+ i.renderCache = [];
2830
+ i.effect.run();
2831
+ }
2832
+ }
2833
+ nextTick(() => {
2834
+ isHmrUpdating = false;
2835
+ });
2836
+ updates.forEach(([instance, dirtyInstances]) => {
2837
+ dirtyInstances.delete(instance);
2838
+ });
2798
2839
  });
2799
- dirtyInstances.delete(instance);
2800
2840
  });
2801
- else if (instance.appContext.reload) instance.appContext.reload();
2802
- else if (typeof window !== "undefined") window.location.reload();
2803
- else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2804
- if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2805
2841
  }
2806
2842
  queuePostFlushCb(() => {
2807
2843
  hmrDirtyComponents.clear();
@@ -5320,6 +5356,7 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5320
5356
  slot: vaporSlot,
5321
5357
  fallback
5322
5358
  };
5359
+ if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
5323
5360
  return ret;
5324
5361
  }
5325
5362
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
@@ -6256,7 +6293,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6256
6293
  if (options.el) return vm.$mount(options.el);
6257
6294
  else return vm;
6258
6295
  }
6259
- Vue.version = `2.6.14-compat:3.6.0-beta.13`;
6296
+ Vue.version = `2.6.14-compat:3.6.0-beta.14`;
6260
6297
  Vue.config = singletonApp.config;
6261
6298
  Vue.use = (plugin, ...options) => {
6262
6299
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -9716,7 +9753,7 @@ function isMemoSame(cached, memo) {
9716
9753
  }
9717
9754
  //#endregion
9718
9755
  //#region packages/runtime-core/src/index.ts
9719
- const version = "3.6.0-beta.13";
9756
+ const version = "3.6.0-beta.14";
9720
9757
  const warn = warn$1;
9721
9758
  /**
9722
9759
  * Runtime error messages. Only exposed in dev or esm builds.