@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.
@@ -4042,14 +4042,9 @@ function instanceWatch(source, value, options) {
4042
4042
  cb = value.handler;
4043
4043
  options = value;
4044
4044
  }
4045
- const cur = currentInstance;
4046
- setCurrentInstance(this);
4045
+ const reset = setCurrentInstance(this);
4047
4046
  const res = doWatch(getter, cb.bind(publicThis), options);
4048
- if (cur) {
4049
- setCurrentInstance(cur);
4050
- } else {
4051
- unsetCurrentInstance();
4052
- }
4047
+ reset();
4053
4048
  return res;
4054
4049
  }
4055
4050
  function createPathGetter(ctx, path) {
@@ -4101,12 +4096,11 @@ function validateDirectiveName(name) {
4101
4096
  }
4102
4097
  }
4103
4098
  function withDirectives(vnode, directives) {
4104
- const internalInstance = currentRenderingInstance;
4105
- if (internalInstance === null) {
4099
+ if (currentRenderingInstance === null) {
4106
4100
  !!(process.env.NODE_ENV !== "production") && warn$1(`withDirectives can only be used inside render functions.`);
4107
4101
  return vnode;
4108
4102
  }
4109
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4103
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
4110
4104
  const bindings = vnode.dirs || (vnode.dirs = []);
4111
4105
  for (let i = 0; i < directives.length; i++) {
4112
4106
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4903,9 +4897,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4903
4897
  return;
4904
4898
  }
4905
4899
  pauseTracking();
4906
- setCurrentInstance(target);
4900
+ const reset = setCurrentInstance(target);
4907
4901
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4908
- unsetCurrentInstance();
4902
+ reset();
4909
4903
  resetTracking();
4910
4904
  return res;
4911
4905
  });
@@ -6499,7 +6493,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6499
6493
  return vm;
6500
6494
  }
6501
6495
  }
6502
- Vue.version = `2.6.14-compat:${"3.4.6"}`;
6496
+ Vue.version = `2.6.14-compat:${"3.4.7"}`;
6503
6497
  Vue.config = singletonApp.config;
6504
6498
  Vue.use = (p, ...options) => {
6505
6499
  if (p && isFunction(p.install)) {
@@ -7342,12 +7336,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7342
7336
  if (key in propsDefaults) {
7343
7337
  value = propsDefaults[key];
7344
7338
  } else {
7345
- setCurrentInstance(instance);
7339
+ const reset = setCurrentInstance(instance);
7346
7340
  value = propsDefaults[key] = defaultValue.call(
7347
7341
  isCompatEnabled("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7348
7342
  props
7349
7343
  );
7350
- unsetCurrentInstance();
7344
+ reset();
7351
7345
  }
7352
7346
  } else {
7353
7347
  value = defaultValue;
@@ -10744,14 +10738,7 @@ function createComponentInstance(vnode, parent, suspense) {
10744
10738
  return instance;
10745
10739
  }
10746
10740
  let currentInstance = null;
10747
- const getCurrentInstance = () => {
10748
- if (!!(process.env.NODE_ENV !== "production") && isInComputedGetter) {
10749
- warn$1(
10750
- `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.`
10751
- );
10752
- }
10753
- return currentInstance || currentRenderingInstance;
10754
- };
10741
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10755
10742
  let internalSetCurrentInstance;
10756
10743
  let setInSSRSetupState;
10757
10744
  {
@@ -10778,8 +10765,13 @@ let setInSSRSetupState;
10778
10765
  );
10779
10766
  }
10780
10767
  const setCurrentInstance = (instance) => {
10768
+ const prev = currentInstance;
10781
10769
  internalSetCurrentInstance(instance);
10782
10770
  instance.scope.on();
10771
+ return () => {
10772
+ instance.scope.off();
10773
+ internalSetCurrentInstance(prev);
10774
+ };
10783
10775
  };
10784
10776
  const unsetCurrentInstance = () => {
10785
10777
  currentInstance && currentInstance.scope.off();
@@ -10841,7 +10833,7 @@ function setupStatefulComponent(instance, isSSR) {
10841
10833
  const { setup } = Component;
10842
10834
  if (setup) {
10843
10835
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10844
- setCurrentInstance(instance);
10836
+ const reset = setCurrentInstance(instance);
10845
10837
  pauseTracking();
10846
10838
  const setupResult = callWithErrorHandling(
10847
10839
  setup,
@@ -10853,7 +10845,7 @@ function setupStatefulComponent(instance, isSSR) {
10853
10845
  ]
10854
10846
  );
10855
10847
  resetTracking();
10856
- unsetCurrentInstance();
10848
+ reset();
10857
10849
  if (isPromise(setupResult)) {
10858
10850
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10859
10851
  if (isSSR) {
@@ -10961,13 +10953,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
10961
10953
  }
10962
10954
  }
10963
10955
  if (__VUE_OPTIONS_API__ && !skipOptions) {
10964
- setCurrentInstance(instance);
10956
+ const reset = setCurrentInstance(instance);
10965
10957
  pauseTracking();
10966
10958
  try {
10967
10959
  applyOptions(instance);
10968
10960
  } finally {
10969
10961
  resetTracking();
10970
- unsetCurrentInstance();
10962
+ reset();
10971
10963
  }
10972
10964
  }
10973
10965
  if (!!(process.env.NODE_ENV !== "production") && !Component.render && instance.render === NOOP && !isSSR) {
@@ -11108,25 +11100,7 @@ function isClassComponent(value) {
11108
11100
  return isFunction(value) && "__vccOpts" in value;
11109
11101
  }
11110
11102
 
11111
- let isInComputedGetter = false;
11112
- function wrapComputedGetter(getter) {
11113
- return () => {
11114
- isInComputedGetter = true;
11115
- try {
11116
- return getter();
11117
- } finally {
11118
- isInComputedGetter = false;
11119
- }
11120
- };
11121
- }
11122
11103
  const computed = (getterOrOptions, debugOptions) => {
11123
- if (!!(process.env.NODE_ENV !== "production")) {
11124
- if (isFunction(getterOrOptions)) {
11125
- getterOrOptions = wrapComputedGetter(getterOrOptions);
11126
- } else {
11127
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11128
- }
11129
- }
11130
11104
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11131
11105
  };
11132
11106
 
@@ -11352,7 +11326,7 @@ function isMemoSame(cached, memo) {
11352
11326
  return true;
11353
11327
  }
11354
11328
 
11355
- const version = "3.4.6";
11329
+ const version = "3.4.7";
11356
11330
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11357
11331
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11358
11332
  const devtools = !!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__ ? devtools$1 : void 0;
@@ -4011,14 +4011,9 @@ If this is a native custom element, make sure to exclude it from component resol
4011
4011
  cb = value.handler;
4012
4012
  options = value;
4013
4013
  }
4014
- const cur = currentInstance;
4015
- setCurrentInstance(this);
4014
+ const reset = setCurrentInstance(this);
4016
4015
  const res = doWatch(getter, cb.bind(publicThis), options);
4017
- if (cur) {
4018
- setCurrentInstance(cur);
4019
- } else {
4020
- unsetCurrentInstance();
4021
- }
4016
+ reset();
4022
4017
  return res;
4023
4018
  }
4024
4019
  function createPathGetter(ctx, path) {
@@ -4070,12 +4065,11 @@ If this is a native custom element, make sure to exclude it from component resol
4070
4065
  }
4071
4066
  }
4072
4067
  function withDirectives(vnode, directives) {
4073
- const internalInstance = currentRenderingInstance;
4074
- if (internalInstance === null) {
4068
+ if (currentRenderingInstance === null) {
4075
4069
  warn$1(`withDirectives can only be used inside render functions.`);
4076
4070
  return vnode;
4077
4071
  }
4078
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4072
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
4079
4073
  const bindings = vnode.dirs || (vnode.dirs = []);
4080
4074
  for (let i = 0; i < directives.length; i++) {
4081
4075
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4864,9 +4858,9 @@ If this is a native custom element, make sure to exclude it from component resol
4864
4858
  return;
4865
4859
  }
4866
4860
  pauseTracking();
4867
- setCurrentInstance(target);
4861
+ const reset = setCurrentInstance(target);
4868
4862
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4869
- unsetCurrentInstance();
4863
+ reset();
4870
4864
  resetTracking();
4871
4865
  return res;
4872
4866
  });
@@ -6458,7 +6452,7 @@ If this is a native custom element, make sure to exclude it from component resol
6458
6452
  return vm;
6459
6453
  }
6460
6454
  }
6461
- Vue.version = `2.6.14-compat:${"3.4.6"}`;
6455
+ Vue.version = `2.6.14-compat:${"3.4.7"}`;
6462
6456
  Vue.config = singletonApp.config;
6463
6457
  Vue.use = (p, ...options) => {
6464
6458
  if (p && isFunction(p.install)) {
@@ -7298,12 +7292,12 @@ If you want to remount the same app, move your app creation logic into a factory
7298
7292
  if (key in propsDefaults) {
7299
7293
  value = propsDefaults[key];
7300
7294
  } else {
7301
- setCurrentInstance(instance);
7295
+ const reset = setCurrentInstance(instance);
7302
7296
  value = propsDefaults[key] = defaultValue.call(
7303
7297
  isCompatEnabled("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7304
7298
  props
7305
7299
  );
7306
- unsetCurrentInstance();
7300
+ reset();
7307
7301
  }
7308
7302
  } else {
7309
7303
  value = defaultValue;
@@ -10650,14 +10644,7 @@ Component that was made reactive: `,
10650
10644
  return instance;
10651
10645
  }
10652
10646
  let currentInstance = null;
10653
- const getCurrentInstance = () => {
10654
- if (isInComputedGetter) {
10655
- warn$1(
10656
- `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.`
10657
- );
10658
- }
10659
- return currentInstance || currentRenderingInstance;
10660
- };
10647
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10661
10648
  let internalSetCurrentInstance;
10662
10649
  let setInSSRSetupState;
10663
10650
  {
@@ -10669,8 +10656,13 @@ Component that was made reactive: `,
10669
10656
  };
10670
10657
  }
10671
10658
  const setCurrentInstance = (instance) => {
10659
+ const prev = currentInstance;
10672
10660
  internalSetCurrentInstance(instance);
10673
10661
  instance.scope.on();
10662
+ return () => {
10663
+ instance.scope.off();
10664
+ internalSetCurrentInstance(prev);
10665
+ };
10674
10666
  };
10675
10667
  const unsetCurrentInstance = () => {
10676
10668
  currentInstance && currentInstance.scope.off();
@@ -10732,7 +10724,7 @@ Component that was made reactive: `,
10732
10724
  const { setup } = Component;
10733
10725
  if (setup) {
10734
10726
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10735
- setCurrentInstance(instance);
10727
+ const reset = setCurrentInstance(instance);
10736
10728
  pauseTracking();
10737
10729
  const setupResult = callWithErrorHandling(
10738
10730
  setup,
@@ -10744,7 +10736,7 @@ Component that was made reactive: `,
10744
10736
  ]
10745
10737
  );
10746
10738
  resetTracking();
10747
- unsetCurrentInstance();
10739
+ reset();
10748
10740
  if (isPromise(setupResult)) {
10749
10741
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10750
10742
  if (isSSR) {
@@ -10850,13 +10842,13 @@ Component that was made reactive: `,
10850
10842
  }
10851
10843
  }
10852
10844
  if (!skipOptions) {
10853
- setCurrentInstance(instance);
10845
+ const reset = setCurrentInstance(instance);
10854
10846
  pauseTracking();
10855
10847
  try {
10856
10848
  applyOptions(instance);
10857
10849
  } finally {
10858
10850
  resetTracking();
10859
- unsetCurrentInstance();
10851
+ reset();
10860
10852
  }
10861
10853
  }
10862
10854
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -10983,25 +10975,7 @@ Component that was made reactive: `,
10983
10975
  return isFunction(value) && "__vccOpts" in value;
10984
10976
  }
10985
10977
 
10986
- let isInComputedGetter = false;
10987
- function wrapComputedGetter(getter) {
10988
- return () => {
10989
- isInComputedGetter = true;
10990
- try {
10991
- return getter();
10992
- } finally {
10993
- isInComputedGetter = false;
10994
- }
10995
- };
10996
- }
10997
10978
  const computed = (getterOrOptions, debugOptions) => {
10998
- {
10999
- if (isFunction(getterOrOptions)) {
11000
- getterOrOptions = wrapComputedGetter(getterOrOptions);
11001
- } else {
11002
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11003
- }
11004
- }
11005
10979
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11006
10980
  };
11007
10981
 
@@ -11227,7 +11201,7 @@ Component that was made reactive: `,
11227
11201
  return true;
11228
11202
  }
11229
11203
 
11230
- const version = "3.4.6";
11204
+ const version = "3.4.7";
11231
11205
  const warn = warn$1 ;
11232
11206
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11233
11207
  const devtools = devtools$1 ;