@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.
@@ -4107,14 +4107,9 @@ function instanceWatch(source, value, options) {
4107
4107
  cb = value.handler;
4108
4108
  options = value;
4109
4109
  }
4110
- const cur = currentInstance;
4111
- setCurrentInstance(this);
4110
+ const reset = setCurrentInstance(this);
4112
4111
  const res = doWatch(getter, cb.bind(publicThis), options);
4113
- if (cur) {
4114
- setCurrentInstance(cur);
4115
- } else {
4116
- unsetCurrentInstance();
4117
- }
4112
+ reset();
4118
4113
  return res;
4119
4114
  }
4120
4115
  function createPathGetter(ctx, path) {
@@ -4166,12 +4161,11 @@ function validateDirectiveName(name) {
4166
4161
  }
4167
4162
  }
4168
4163
  function withDirectives(vnode, directives) {
4169
- const internalInstance = currentRenderingInstance;
4170
- if (internalInstance === null) {
4164
+ if (currentRenderingInstance === null) {
4171
4165
  !!(process.env.NODE_ENV !== "production") && warn$1(`withDirectives can only be used inside render functions.`);
4172
4166
  return vnode;
4173
4167
  }
4174
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4168
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
4175
4169
  const bindings = vnode.dirs || (vnode.dirs = []);
4176
4170
  for (let i = 0; i < directives.length; i++) {
4177
4171
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4968,9 +4962,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4968
4962
  return;
4969
4963
  }
4970
4964
  pauseTracking();
4971
- setCurrentInstance(target);
4965
+ const reset = setCurrentInstance(target);
4972
4966
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4973
- unsetCurrentInstance();
4967
+ reset();
4974
4968
  resetTracking();
4975
4969
  return res;
4976
4970
  });
@@ -6564,7 +6558,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6564
6558
  return vm;
6565
6559
  }
6566
6560
  }
6567
- Vue.version = `2.6.14-compat:${"3.4.6"}`;
6561
+ Vue.version = `2.6.14-compat:${"3.4.7"}`;
6568
6562
  Vue.config = singletonApp.config;
6569
6563
  Vue.use = (p, ...options) => {
6570
6564
  if (p && isFunction(p.install)) {
@@ -7407,12 +7401,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7407
7401
  if (key in propsDefaults) {
7408
7402
  value = propsDefaults[key];
7409
7403
  } else {
7410
- setCurrentInstance(instance);
7404
+ const reset = setCurrentInstance(instance);
7411
7405
  value = propsDefaults[key] = defaultValue.call(
7412
7406
  isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7413
7407
  props
7414
7408
  );
7415
- unsetCurrentInstance();
7409
+ reset();
7416
7410
  }
7417
7411
  } else {
7418
7412
  value = defaultValue;
@@ -10809,14 +10803,7 @@ function createComponentInstance(vnode, parent, suspense) {
10809
10803
  return instance;
10810
10804
  }
10811
10805
  let currentInstance = null;
10812
- const getCurrentInstance = () => {
10813
- if (!!(process.env.NODE_ENV !== "production") && isInComputedGetter) {
10814
- warn$1(
10815
- `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.`
10816
- );
10817
- }
10818
- return currentInstance || currentRenderingInstance;
10819
- };
10806
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10820
10807
  let internalSetCurrentInstance;
10821
10808
  let setInSSRSetupState;
10822
10809
  {
@@ -10843,8 +10830,13 @@ let setInSSRSetupState;
10843
10830
  );
10844
10831
  }
10845
10832
  const setCurrentInstance = (instance) => {
10833
+ const prev = currentInstance;
10846
10834
  internalSetCurrentInstance(instance);
10847
10835
  instance.scope.on();
10836
+ return () => {
10837
+ instance.scope.off();
10838
+ internalSetCurrentInstance(prev);
10839
+ };
10848
10840
  };
10849
10841
  const unsetCurrentInstance = () => {
10850
10842
  currentInstance && currentInstance.scope.off();
@@ -10906,7 +10898,7 @@ function setupStatefulComponent(instance, isSSR) {
10906
10898
  const { setup } = Component;
10907
10899
  if (setup) {
10908
10900
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10909
- setCurrentInstance(instance);
10901
+ const reset = setCurrentInstance(instance);
10910
10902
  pauseTracking();
10911
10903
  const setupResult = callWithErrorHandling(
10912
10904
  setup,
@@ -10918,7 +10910,7 @@ function setupStatefulComponent(instance, isSSR) {
10918
10910
  ]
10919
10911
  );
10920
10912
  resetTracking();
10921
- unsetCurrentInstance();
10913
+ reset();
10922
10914
  if (isPromise(setupResult)) {
10923
10915
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10924
10916
  if (isSSR) {
@@ -11026,13 +11018,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
11026
11018
  }
11027
11019
  }
11028
11020
  if (__VUE_OPTIONS_API__ && !skipOptions) {
11029
- setCurrentInstance(instance);
11021
+ const reset = setCurrentInstance(instance);
11030
11022
  pauseTracking();
11031
11023
  try {
11032
11024
  applyOptions(instance);
11033
11025
  } finally {
11034
11026
  resetTracking();
11035
- unsetCurrentInstance();
11027
+ reset();
11036
11028
  }
11037
11029
  }
11038
11030
  if (!!(process.env.NODE_ENV !== "production") && !Component.render && instance.render === NOOP && !isSSR) {
@@ -11173,25 +11165,7 @@ function isClassComponent(value) {
11173
11165
  return isFunction(value) && "__vccOpts" in value;
11174
11166
  }
11175
11167
 
11176
- let isInComputedGetter = false;
11177
- function wrapComputedGetter(getter) {
11178
- return () => {
11179
- isInComputedGetter = true;
11180
- try {
11181
- return getter();
11182
- } finally {
11183
- isInComputedGetter = false;
11184
- }
11185
- };
11186
- }
11187
11168
  const computed = (getterOrOptions, debugOptions) => {
11188
- if (!!(process.env.NODE_ENV !== "production")) {
11189
- if (isFunction(getterOrOptions)) {
11190
- getterOrOptions = wrapComputedGetter(getterOrOptions);
11191
- } else {
11192
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11193
- }
11194
- }
11195
11169
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11196
11170
  };
11197
11171
 
@@ -11417,7 +11391,7 @@ function isMemoSame(cached, memo) {
11417
11391
  return true;
11418
11392
  }
11419
11393
 
11420
- const version = "3.4.6";
11394
+ const version = "3.4.7";
11421
11395
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11422
11396
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11423
11397
  const devtools = !!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__ ? devtools$1 : void 0;
@@ -15239,7 +15213,7 @@ function onCloseTag(el, end, isImplied = false) {
15239
15213
  }
15240
15214
  }
15241
15215
  }
15242
- if (isCompatEnabled(
15216
+ if (!tokenizer.inSFCRoot && isCompatEnabled(
15243
15217
  "COMPILER_NATIVE_TEMPLATE",
15244
15218
  currentOptions
15245
15219
  ) && el.tag === "template" && !isFragmentTemplate(el)) {
@@ -15853,8 +15827,7 @@ function createTransformContext(root, {
15853
15827
  }
15854
15828
  context.parent.children.splice(removalIndex, 1);
15855
15829
  },
15856
- onNodeRemoved: () => {
15857
- },
15830
+ onNodeRemoved: NOOP,
15858
15831
  addIdentifiers(exp) {
15859
15832
  },
15860
15833
  removeIdentifiers(exp) {
@@ -4076,14 +4076,9 @@ If this is a native custom element, make sure to exclude it from component resol
4076
4076
  cb = value.handler;
4077
4077
  options = value;
4078
4078
  }
4079
- const cur = currentInstance;
4080
- setCurrentInstance(this);
4079
+ const reset = setCurrentInstance(this);
4081
4080
  const res = doWatch(getter, cb.bind(publicThis), options);
4082
- if (cur) {
4083
- setCurrentInstance(cur);
4084
- } else {
4085
- unsetCurrentInstance();
4086
- }
4081
+ reset();
4087
4082
  return res;
4088
4083
  }
4089
4084
  function createPathGetter(ctx, path) {
@@ -4135,12 +4130,11 @@ If this is a native custom element, make sure to exclude it from component resol
4135
4130
  }
4136
4131
  }
4137
4132
  function withDirectives(vnode, directives) {
4138
- const internalInstance = currentRenderingInstance;
4139
- if (internalInstance === null) {
4133
+ if (currentRenderingInstance === null) {
4140
4134
  warn$1(`withDirectives can only be used inside render functions.`);
4141
4135
  return vnode;
4142
4136
  }
4143
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4137
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
4144
4138
  const bindings = vnode.dirs || (vnode.dirs = []);
4145
4139
  for (let i = 0; i < directives.length; i++) {
4146
4140
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4929,9 +4923,9 @@ If this is a native custom element, make sure to exclude it from component resol
4929
4923
  return;
4930
4924
  }
4931
4925
  pauseTracking();
4932
- setCurrentInstance(target);
4926
+ const reset = setCurrentInstance(target);
4933
4927
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4934
- unsetCurrentInstance();
4928
+ reset();
4935
4929
  resetTracking();
4936
4930
  return res;
4937
4931
  });
@@ -6523,7 +6517,7 @@ If this is a native custom element, make sure to exclude it from component resol
6523
6517
  return vm;
6524
6518
  }
6525
6519
  }
6526
- Vue.version = `2.6.14-compat:${"3.4.6"}`;
6520
+ Vue.version = `2.6.14-compat:${"3.4.7"}`;
6527
6521
  Vue.config = singletonApp.config;
6528
6522
  Vue.use = (p, ...options) => {
6529
6523
  if (p && isFunction(p.install)) {
@@ -7363,12 +7357,12 @@ If you want to remount the same app, move your app creation logic into a factory
7363
7357
  if (key in propsDefaults) {
7364
7358
  value = propsDefaults[key];
7365
7359
  } else {
7366
- setCurrentInstance(instance);
7360
+ const reset = setCurrentInstance(instance);
7367
7361
  value = propsDefaults[key] = defaultValue.call(
7368
7362
  isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7369
7363
  props
7370
7364
  );
7371
- unsetCurrentInstance();
7365
+ reset();
7372
7366
  }
7373
7367
  } else {
7374
7368
  value = defaultValue;
@@ -10715,14 +10709,7 @@ Component that was made reactive: `,
10715
10709
  return instance;
10716
10710
  }
10717
10711
  let currentInstance = null;
10718
- const getCurrentInstance = () => {
10719
- if (isInComputedGetter) {
10720
- warn$1(
10721
- `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.`
10722
- );
10723
- }
10724
- return currentInstance || currentRenderingInstance;
10725
- };
10712
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10726
10713
  let internalSetCurrentInstance;
10727
10714
  let setInSSRSetupState;
10728
10715
  {
@@ -10734,8 +10721,13 @@ Component that was made reactive: `,
10734
10721
  };
10735
10722
  }
10736
10723
  const setCurrentInstance = (instance) => {
10724
+ const prev = currentInstance;
10737
10725
  internalSetCurrentInstance(instance);
10738
10726
  instance.scope.on();
10727
+ return () => {
10728
+ instance.scope.off();
10729
+ internalSetCurrentInstance(prev);
10730
+ };
10739
10731
  };
10740
10732
  const unsetCurrentInstance = () => {
10741
10733
  currentInstance && currentInstance.scope.off();
@@ -10797,7 +10789,7 @@ Component that was made reactive: `,
10797
10789
  const { setup } = Component;
10798
10790
  if (setup) {
10799
10791
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10800
- setCurrentInstance(instance);
10792
+ const reset = setCurrentInstance(instance);
10801
10793
  pauseTracking();
10802
10794
  const setupResult = callWithErrorHandling(
10803
10795
  setup,
@@ -10809,7 +10801,7 @@ Component that was made reactive: `,
10809
10801
  ]
10810
10802
  );
10811
10803
  resetTracking();
10812
- unsetCurrentInstance();
10804
+ reset();
10813
10805
  if (isPromise(setupResult)) {
10814
10806
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10815
10807
  if (isSSR) {
@@ -10915,13 +10907,13 @@ Component that was made reactive: `,
10915
10907
  }
10916
10908
  }
10917
10909
  if (!skipOptions) {
10918
- setCurrentInstance(instance);
10910
+ const reset = setCurrentInstance(instance);
10919
10911
  pauseTracking();
10920
10912
  try {
10921
10913
  applyOptions(instance);
10922
10914
  } finally {
10923
10915
  resetTracking();
10924
- unsetCurrentInstance();
10916
+ reset();
10925
10917
  }
10926
10918
  }
10927
10919
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -11048,25 +11040,7 @@ Component that was made reactive: `,
11048
11040
  return isFunction(value) && "__vccOpts" in value;
11049
11041
  }
11050
11042
 
11051
- let isInComputedGetter = false;
11052
- function wrapComputedGetter(getter) {
11053
- return () => {
11054
- isInComputedGetter = true;
11055
- try {
11056
- return getter();
11057
- } finally {
11058
- isInComputedGetter = false;
11059
- }
11060
- };
11061
- }
11062
11043
  const computed = (getterOrOptions, debugOptions) => {
11063
- {
11064
- if (isFunction(getterOrOptions)) {
11065
- getterOrOptions = wrapComputedGetter(getterOrOptions);
11066
- } else {
11067
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11068
- }
11069
- }
11070
11044
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11071
11045
  };
11072
11046
 
@@ -11292,7 +11266,7 @@ Component that was made reactive: `,
11292
11266
  return true;
11293
11267
  }
11294
11268
 
11295
- const version = "3.4.6";
11269
+ const version = "3.4.7";
11296
11270
  const warn = warn$1 ;
11297
11271
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11298
11272
  const devtools = devtools$1 ;
@@ -15052,7 +15026,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15052
15026
  }
15053
15027
  }
15054
15028
  }
15055
- if (isCompatEnabled(
15029
+ if (!tokenizer.inSFCRoot && isCompatEnabled(
15056
15030
  "COMPILER_NATIVE_TEMPLATE",
15057
15031
  currentOptions
15058
15032
  ) && el.tag === "template" && !isFragmentTemplate(el)) {
@@ -15665,8 +15639,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15665
15639
  }
15666
15640
  context.parent.children.splice(removalIndex, 1);
15667
15641
  },
15668
- onNodeRemoved: () => {
15669
- },
15642
+ onNodeRemoved: NOOP,
15670
15643
  addIdentifiers(exp) {
15671
15644
  },
15672
15645
  removeIdentifiers(exp) {