@vue/compat 3.4.6 → 3.4.7

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.
@@ -4014,14 +4014,9 @@ function instanceWatch(source, value, options) {
4014
4014
  cb = value.handler;
4015
4015
  options = value;
4016
4016
  }
4017
- const cur = currentInstance;
4018
- setCurrentInstance(this);
4017
+ const reset = setCurrentInstance(this);
4019
4018
  const res = doWatch(getter, cb.bind(publicThis), options);
4020
- if (cur) {
4021
- setCurrentInstance(cur);
4022
- } else {
4023
- unsetCurrentInstance();
4024
- }
4019
+ reset();
4025
4020
  return res;
4026
4021
  }
4027
4022
  function createPathGetter(ctx, path) {
@@ -4073,12 +4068,11 @@ function validateDirectiveName(name) {
4073
4068
  }
4074
4069
  }
4075
4070
  function withDirectives(vnode, directives) {
4076
- const internalInstance = currentRenderingInstance;
4077
- if (internalInstance === null) {
4071
+ if (currentRenderingInstance === null) {
4078
4072
  warn$1(`withDirectives can only be used inside render functions.`);
4079
4073
  return vnode;
4080
4074
  }
4081
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4075
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
4082
4076
  const bindings = vnode.dirs || (vnode.dirs = []);
4083
4077
  for (let i = 0; i < directives.length; i++) {
4084
4078
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4867,9 +4861,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4867
4861
  return;
4868
4862
  }
4869
4863
  pauseTracking();
4870
- setCurrentInstance(target);
4864
+ const reset = setCurrentInstance(target);
4871
4865
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4872
- unsetCurrentInstance();
4866
+ reset();
4873
4867
  resetTracking();
4874
4868
  return res;
4875
4869
  });
@@ -6461,7 +6455,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6461
6455
  return vm;
6462
6456
  }
6463
6457
  }
6464
- Vue.version = `2.6.14-compat:${"3.4.6"}`;
6458
+ Vue.version = `2.6.14-compat:${"3.4.7"}`;
6465
6459
  Vue.config = singletonApp.config;
6466
6460
  Vue.use = (p, ...options) => {
6467
6461
  if (p && isFunction(p.install)) {
@@ -7301,12 +7295,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7301
7295
  if (key in propsDefaults) {
7302
7296
  value = propsDefaults[key];
7303
7297
  } else {
7304
- setCurrentInstance(instance);
7298
+ const reset = setCurrentInstance(instance);
7305
7299
  value = propsDefaults[key] = defaultValue.call(
7306
7300
  isCompatEnabled("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7307
7301
  props
7308
7302
  );
7309
- unsetCurrentInstance();
7303
+ reset();
7310
7304
  }
7311
7305
  } else {
7312
7306
  value = defaultValue;
@@ -10653,14 +10647,7 @@ function createComponentInstance(vnode, parent, suspense) {
10653
10647
  return instance;
10654
10648
  }
10655
10649
  let currentInstance = null;
10656
- const getCurrentInstance = () => {
10657
- if (isInComputedGetter) {
10658
- warn$1(
10659
- `getCurrentInstance() called inside a computed getter. This is incorrect usage as computed getters are not guaranteed to be executed with an active component instance. If you are using a composable inside a computed getter, move it ouside to the setup scope.`
10660
- );
10661
- }
10662
- return currentInstance || currentRenderingInstance;
10663
- };
10650
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10664
10651
  let internalSetCurrentInstance;
10665
10652
  let setInSSRSetupState;
10666
10653
  {
@@ -10672,8 +10659,13 @@ let setInSSRSetupState;
10672
10659
  };
10673
10660
  }
10674
10661
  const setCurrentInstance = (instance) => {
10662
+ const prev = currentInstance;
10675
10663
  internalSetCurrentInstance(instance);
10676
10664
  instance.scope.on();
10665
+ return () => {
10666
+ instance.scope.off();
10667
+ internalSetCurrentInstance(prev);
10668
+ };
10677
10669
  };
10678
10670
  const unsetCurrentInstance = () => {
10679
10671
  currentInstance && currentInstance.scope.off();
@@ -10735,7 +10727,7 @@ function setupStatefulComponent(instance, isSSR) {
10735
10727
  const { setup } = Component;
10736
10728
  if (setup) {
10737
10729
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10738
- setCurrentInstance(instance);
10730
+ const reset = setCurrentInstance(instance);
10739
10731
  pauseTracking();
10740
10732
  const setupResult = callWithErrorHandling(
10741
10733
  setup,
@@ -10747,7 +10739,7 @@ function setupStatefulComponent(instance, isSSR) {
10747
10739
  ]
10748
10740
  );
10749
10741
  resetTracking();
10750
- unsetCurrentInstance();
10742
+ reset();
10751
10743
  if (isPromise(setupResult)) {
10752
10744
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10753
10745
  if (isSSR) {
@@ -10853,13 +10845,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
10853
10845
  }
10854
10846
  }
10855
10847
  if (!skipOptions) {
10856
- setCurrentInstance(instance);
10848
+ const reset = setCurrentInstance(instance);
10857
10849
  pauseTracking();
10858
10850
  try {
10859
10851
  applyOptions(instance);
10860
10852
  } finally {
10861
10853
  resetTracking();
10862
- unsetCurrentInstance();
10854
+ reset();
10863
10855
  }
10864
10856
  }
10865
10857
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -10986,25 +10978,7 @@ function isClassComponent(value) {
10986
10978
  return isFunction(value) && "__vccOpts" in value;
10987
10979
  }
10988
10980
 
10989
- let isInComputedGetter = false;
10990
- function wrapComputedGetter(getter) {
10991
- return () => {
10992
- isInComputedGetter = true;
10993
- try {
10994
- return getter();
10995
- } finally {
10996
- isInComputedGetter = false;
10997
- }
10998
- };
10999
- }
11000
10981
  const computed = (getterOrOptions, debugOptions) => {
11001
- {
11002
- if (isFunction(getterOrOptions)) {
11003
- getterOrOptions = wrapComputedGetter(getterOrOptions);
11004
- } else {
11005
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11006
- }
11007
- }
11008
10982
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11009
10983
  };
11010
10984
 
@@ -11230,7 +11204,7 @@ function isMemoSame(cached, memo) {
11230
11204
  return true;
11231
11205
  }
11232
11206
 
11233
- const version = "3.4.6";
11207
+ const version = "3.4.7";
11234
11208
  const warn = warn$1 ;
11235
11209
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11236
11210
  const devtools = devtools$1 ;