@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.
package/dist/vue.cjs.js CHANGED
@@ -4151,14 +4151,9 @@ function instanceWatch(source, value, options) {
4151
4151
  cb = value.handler;
4152
4152
  options = value;
4153
4153
  }
4154
- const cur = currentInstance;
4155
- setCurrentInstance(this);
4154
+ const reset = setCurrentInstance(this);
4156
4155
  const res = doWatch(getter, cb.bind(publicThis), options);
4157
- if (cur) {
4158
- setCurrentInstance(cur);
4159
- } else {
4160
- unsetCurrentInstance();
4161
- }
4156
+ reset();
4162
4157
  return res;
4163
4158
  }
4164
4159
  function createPathGetter(ctx, path) {
@@ -4210,12 +4205,11 @@ function validateDirectiveName(name) {
4210
4205
  }
4211
4206
  }
4212
4207
  function withDirectives(vnode, directives) {
4213
- const internalInstance = currentRenderingInstance;
4214
- if (internalInstance === null) {
4208
+ if (currentRenderingInstance === null) {
4215
4209
  warn$1(`withDirectives can only be used inside render functions.`);
4216
4210
  return vnode;
4217
4211
  }
4218
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4212
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
4219
4213
  const bindings = vnode.dirs || (vnode.dirs = []);
4220
4214
  for (let i = 0; i < directives.length; i++) {
4221
4215
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -5010,9 +5004,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
5010
5004
  return;
5011
5005
  }
5012
5006
  pauseTracking();
5013
- setCurrentInstance(target);
5007
+ const reset = setCurrentInstance(target);
5014
5008
  const res = callWithAsyncErrorHandling(hook, target, type, args);
5015
- unsetCurrentInstance();
5009
+ reset();
5016
5010
  resetTracking();
5017
5011
  return res;
5018
5012
  });
@@ -6604,7 +6598,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6604
6598
  return vm;
6605
6599
  }
6606
6600
  }
6607
- Vue.version = `2.6.14-compat:${"3.4.6"}`;
6601
+ Vue.version = `2.6.14-compat:${"3.4.7"}`;
6608
6602
  Vue.config = singletonApp.config;
6609
6603
  Vue.use = (p, ...options) => {
6610
6604
  if (p && isFunction(p.install)) {
@@ -7444,12 +7438,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7444
7438
  if (key in propsDefaults) {
7445
7439
  value = propsDefaults[key];
7446
7440
  } else {
7447
- setCurrentInstance(instance);
7441
+ const reset = setCurrentInstance(instance);
7448
7442
  value = propsDefaults[key] = defaultValue.call(
7449
7443
  isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7450
7444
  props
7451
7445
  );
7452
- unsetCurrentInstance();
7446
+ reset();
7453
7447
  }
7454
7448
  } else {
7455
7449
  value = defaultValue;
@@ -10796,14 +10790,7 @@ function createComponentInstance(vnode, parent, suspense) {
10796
10790
  return instance;
10797
10791
  }
10798
10792
  let currentInstance = null;
10799
- const getCurrentInstance = () => {
10800
- if (isInComputedGetter) {
10801
- warn$1(
10802
- `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.`
10803
- );
10804
- }
10805
- return currentInstance || currentRenderingInstance;
10806
- };
10793
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10807
10794
  let internalSetCurrentInstance;
10808
10795
  let setInSSRSetupState;
10809
10796
  {
@@ -10830,8 +10817,13 @@ let setInSSRSetupState;
10830
10817
  );
10831
10818
  }
10832
10819
  const setCurrentInstance = (instance) => {
10820
+ const prev = currentInstance;
10833
10821
  internalSetCurrentInstance(instance);
10834
10822
  instance.scope.on();
10823
+ return () => {
10824
+ instance.scope.off();
10825
+ internalSetCurrentInstance(prev);
10826
+ };
10835
10827
  };
10836
10828
  const unsetCurrentInstance = () => {
10837
10829
  currentInstance && currentInstance.scope.off();
@@ -10893,7 +10885,7 @@ function setupStatefulComponent(instance, isSSR) {
10893
10885
  const { setup } = Component;
10894
10886
  if (setup) {
10895
10887
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10896
- setCurrentInstance(instance);
10888
+ const reset = setCurrentInstance(instance);
10897
10889
  pauseTracking();
10898
10890
  const setupResult = callWithErrorHandling(
10899
10891
  setup,
@@ -10905,7 +10897,7 @@ function setupStatefulComponent(instance, isSSR) {
10905
10897
  ]
10906
10898
  );
10907
10899
  resetTracking();
10908
- unsetCurrentInstance();
10900
+ reset();
10909
10901
  if (isPromise(setupResult)) {
10910
10902
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10911
10903
  if (isSSR) {
@@ -11013,13 +11005,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
11013
11005
  }
11014
11006
  }
11015
11007
  if (!skipOptions) {
11016
- setCurrentInstance(instance);
11008
+ const reset = setCurrentInstance(instance);
11017
11009
  pauseTracking();
11018
11010
  try {
11019
11011
  applyOptions(instance);
11020
11012
  } finally {
11021
11013
  resetTracking();
11022
- unsetCurrentInstance();
11014
+ reset();
11023
11015
  }
11024
11016
  }
11025
11017
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -11146,25 +11138,7 @@ function isClassComponent(value) {
11146
11138
  return isFunction(value) && "__vccOpts" in value;
11147
11139
  }
11148
11140
 
11149
- let isInComputedGetter = false;
11150
- function wrapComputedGetter(getter) {
11151
- return () => {
11152
- isInComputedGetter = true;
11153
- try {
11154
- return getter();
11155
- } finally {
11156
- isInComputedGetter = false;
11157
- }
11158
- };
11159
- }
11160
11141
  const computed = (getterOrOptions, debugOptions) => {
11161
- {
11162
- if (isFunction(getterOrOptions)) {
11163
- getterOrOptions = wrapComputedGetter(getterOrOptions);
11164
- } else {
11165
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11166
- }
11167
- }
11168
11142
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11169
11143
  };
11170
11144
 
@@ -11390,7 +11364,7 @@ function isMemoSame(cached, memo) {
11390
11364
  return true;
11391
11365
  }
11392
11366
 
11393
- const version = "3.4.6";
11367
+ const version = "3.4.7";
11394
11368
  const warn = warn$1 ;
11395
11369
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11396
11370
  const devtools = devtools$1 ;
@@ -15504,7 +15478,7 @@ function onCloseTag(el, end, isImplied = false) {
15504
15478
  }
15505
15479
  }
15506
15480
  }
15507
- if (isCompatEnabled(
15481
+ if (!tokenizer.inSFCRoot && isCompatEnabled(
15508
15482
  "COMPILER_NATIVE_TEMPLATE",
15509
15483
  currentOptions
15510
15484
  ) && el.tag === "template" && !isFragmentTemplate(el)) {
@@ -16139,8 +16113,7 @@ function createTransformContext(root, {
16139
16113
  }
16140
16114
  context.parent.children.splice(removalIndex, 1);
16141
16115
  },
16142
- onNodeRemoved: () => {
16143
- },
16116
+ onNodeRemoved: NOOP,
16144
16117
  addIdentifiers(exp) {
16145
16118
  {
16146
16119
  if (isString(exp)) {
@@ -3137,14 +3137,9 @@ function instanceWatch(source, value, options) {
3137
3137
  cb = value.handler;
3138
3138
  options = value;
3139
3139
  }
3140
- const cur = currentInstance;
3141
- setCurrentInstance(this);
3140
+ const reset = setCurrentInstance(this);
3142
3141
  const res = doWatch(getter, cb.bind(publicThis), options);
3143
- if (cur) {
3144
- setCurrentInstance(cur);
3145
- } else {
3146
- unsetCurrentInstance();
3147
- }
3142
+ reset();
3148
3143
  return res;
3149
3144
  }
3150
3145
  function createPathGetter(ctx, path) {
@@ -3191,11 +3186,10 @@ function traverse(value, depth, currentDepth = 0, seen) {
3191
3186
  }
3192
3187
 
3193
3188
  function withDirectives(vnode, directives) {
3194
- const internalInstance = currentRenderingInstance;
3195
- if (internalInstance === null) {
3189
+ if (currentRenderingInstance === null) {
3196
3190
  return vnode;
3197
3191
  }
3198
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3192
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
3199
3193
  const bindings = vnode.dirs || (vnode.dirs = []);
3200
3194
  for (let i = 0; i < directives.length; i++) {
3201
3195
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -3960,9 +3954,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
3960
3954
  return;
3961
3955
  }
3962
3956
  pauseTracking();
3963
- setCurrentInstance(target);
3957
+ const reset = setCurrentInstance(target);
3964
3958
  const res = callWithAsyncErrorHandling(hook, target, type, args);
3965
- unsetCurrentInstance();
3959
+ reset();
3966
3960
  resetTracking();
3967
3961
  return res;
3968
3962
  });
@@ -5285,7 +5279,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5285
5279
  return vm;
5286
5280
  }
5287
5281
  }
5288
- Vue.version = `2.6.14-compat:${"3.4.6"}`;
5282
+ Vue.version = `2.6.14-compat:${"3.4.7"}`;
5289
5283
  Vue.config = singletonApp.config;
5290
5284
  Vue.use = (p, ...options) => {
5291
5285
  if (p && isFunction(p.install)) {
@@ -6002,12 +5996,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
6002
5996
  if (key in propsDefaults) {
6003
5997
  value = propsDefaults[key];
6004
5998
  } else {
6005
- setCurrentInstance(instance);
5999
+ const reset = setCurrentInstance(instance);
6006
6000
  value = propsDefaults[key] = defaultValue.call(
6007
6001
  isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props) : null,
6008
6002
  props
6009
6003
  );
6010
- unsetCurrentInstance();
6004
+ reset();
6011
6005
  }
6012
6006
  } else {
6013
6007
  value = defaultValue;
@@ -8834,9 +8828,7 @@ function createComponentInstance(vnode, parent, suspense) {
8834
8828
  return instance;
8835
8829
  }
8836
8830
  let currentInstance = null;
8837
- const getCurrentInstance = () => {
8838
- return currentInstance || currentRenderingInstance;
8839
- };
8831
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
8840
8832
  let internalSetCurrentInstance;
8841
8833
  let setInSSRSetupState;
8842
8834
  {
@@ -8863,8 +8855,13 @@ let setInSSRSetupState;
8863
8855
  );
8864
8856
  }
8865
8857
  const setCurrentInstance = (instance) => {
8858
+ const prev = currentInstance;
8866
8859
  internalSetCurrentInstance(instance);
8867
8860
  instance.scope.on();
8861
+ return () => {
8862
+ instance.scope.off();
8863
+ internalSetCurrentInstance(prev);
8864
+ };
8868
8865
  };
8869
8866
  const unsetCurrentInstance = () => {
8870
8867
  currentInstance && currentInstance.scope.off();
@@ -8891,7 +8888,7 @@ function setupStatefulComponent(instance, isSSR) {
8891
8888
  const { setup } = Component;
8892
8889
  if (setup) {
8893
8890
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
8894
- setCurrentInstance(instance);
8891
+ const reset = setCurrentInstance(instance);
8895
8892
  pauseTracking();
8896
8893
  const setupResult = callWithErrorHandling(
8897
8894
  setup,
@@ -8903,7 +8900,7 @@ function setupStatefulComponent(instance, isSSR) {
8903
8900
  ]
8904
8901
  );
8905
8902
  resetTracking();
8906
- unsetCurrentInstance();
8903
+ reset();
8907
8904
  if (isPromise(setupResult)) {
8908
8905
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
8909
8906
  if (isSSR) {
@@ -8981,13 +8978,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
8981
8978
  }
8982
8979
  }
8983
8980
  if (!skipOptions) {
8984
- setCurrentInstance(instance);
8981
+ const reset = setCurrentInstance(instance);
8985
8982
  pauseTracking();
8986
8983
  try {
8987
8984
  applyOptions(instance);
8988
8985
  } finally {
8989
8986
  resetTracking();
8990
- unsetCurrentInstance();
8987
+ reset();
8991
8988
  }
8992
8989
  }
8993
8990
  }
@@ -9096,7 +9093,7 @@ function isMemoSame(cached, memo) {
9096
9093
  return true;
9097
9094
  }
9098
9095
 
9099
- const version = "3.4.6";
9096
+ const version = "3.4.7";
9100
9097
  const warn$1 = NOOP;
9101
9098
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9102
9099
  const devtools = void 0;
@@ -13006,7 +13003,7 @@ function onCloseTag(el, end, isImplied = false) {
13006
13003
  }
13007
13004
  {
13008
13005
  const props = el.props;
13009
- if (isCompatEnabled(
13006
+ if (!tokenizer.inSFCRoot && isCompatEnabled(
13010
13007
  "COMPILER_NATIVE_TEMPLATE",
13011
13008
  currentOptions
13012
13009
  ) && el.tag === "template" && !isFragmentTemplate(el)) {
@@ -13615,8 +13612,7 @@ function createTransformContext(root, {
13615
13612
  }
13616
13613
  context.parent.children.splice(removalIndex, 1);
13617
13614
  },
13618
- onNodeRemoved: () => {
13619
- },
13615
+ onNodeRemoved: NOOP,
13620
13616
  addIdentifiers(exp) {
13621
13617
  {
13622
13618
  if (isString(exp)) {
@@ -4079,14 +4079,9 @@ function instanceWatch(source, value, options) {
4079
4079
  cb = value.handler;
4080
4080
  options = value;
4081
4081
  }
4082
- const cur = currentInstance;
4083
- setCurrentInstance(this);
4082
+ const reset = setCurrentInstance(this);
4084
4083
  const res = doWatch(getter, cb.bind(publicThis), options);
4085
- if (cur) {
4086
- setCurrentInstance(cur);
4087
- } else {
4088
- unsetCurrentInstance();
4089
- }
4084
+ reset();
4090
4085
  return res;
4091
4086
  }
4092
4087
  function createPathGetter(ctx, path) {
@@ -4138,12 +4133,11 @@ function validateDirectiveName(name) {
4138
4133
  }
4139
4134
  }
4140
4135
  function withDirectives(vnode, directives) {
4141
- const internalInstance = currentRenderingInstance;
4142
- if (internalInstance === null) {
4136
+ if (currentRenderingInstance === null) {
4143
4137
  warn$1(`withDirectives can only be used inside render functions.`);
4144
4138
  return vnode;
4145
4139
  }
4146
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4140
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
4147
4141
  const bindings = vnode.dirs || (vnode.dirs = []);
4148
4142
  for (let i = 0; i < directives.length; i++) {
4149
4143
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4932,9 +4926,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4932
4926
  return;
4933
4927
  }
4934
4928
  pauseTracking();
4935
- setCurrentInstance(target);
4929
+ const reset = setCurrentInstance(target);
4936
4930
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4937
- unsetCurrentInstance();
4931
+ reset();
4938
4932
  resetTracking();
4939
4933
  return res;
4940
4934
  });
@@ -6526,7 +6520,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6526
6520
  return vm;
6527
6521
  }
6528
6522
  }
6529
- Vue.version = `2.6.14-compat:${"3.4.6"}`;
6523
+ Vue.version = `2.6.14-compat:${"3.4.7"}`;
6530
6524
  Vue.config = singletonApp.config;
6531
6525
  Vue.use = (p, ...options) => {
6532
6526
  if (p && isFunction(p.install)) {
@@ -7366,12 +7360,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7366
7360
  if (key in propsDefaults) {
7367
7361
  value = propsDefaults[key];
7368
7362
  } else {
7369
- setCurrentInstance(instance);
7363
+ const reset = setCurrentInstance(instance);
7370
7364
  value = propsDefaults[key] = defaultValue.call(
7371
7365
  isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7372
7366
  props
7373
7367
  );
7374
- unsetCurrentInstance();
7368
+ reset();
7375
7369
  }
7376
7370
  } else {
7377
7371
  value = defaultValue;
@@ -10718,14 +10712,7 @@ function createComponentInstance(vnode, parent, suspense) {
10718
10712
  return instance;
10719
10713
  }
10720
10714
  let currentInstance = null;
10721
- const getCurrentInstance = () => {
10722
- if (isInComputedGetter) {
10723
- warn$1(
10724
- `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.`
10725
- );
10726
- }
10727
- return currentInstance || currentRenderingInstance;
10728
- };
10715
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10729
10716
  let internalSetCurrentInstance;
10730
10717
  let setInSSRSetupState;
10731
10718
  {
@@ -10737,8 +10724,13 @@ let setInSSRSetupState;
10737
10724
  };
10738
10725
  }
10739
10726
  const setCurrentInstance = (instance) => {
10727
+ const prev = currentInstance;
10740
10728
  internalSetCurrentInstance(instance);
10741
10729
  instance.scope.on();
10730
+ return () => {
10731
+ instance.scope.off();
10732
+ internalSetCurrentInstance(prev);
10733
+ };
10742
10734
  };
10743
10735
  const unsetCurrentInstance = () => {
10744
10736
  currentInstance && currentInstance.scope.off();
@@ -10800,7 +10792,7 @@ function setupStatefulComponent(instance, isSSR) {
10800
10792
  const { setup } = Component;
10801
10793
  if (setup) {
10802
10794
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10803
- setCurrentInstance(instance);
10795
+ const reset = setCurrentInstance(instance);
10804
10796
  pauseTracking();
10805
10797
  const setupResult = callWithErrorHandling(
10806
10798
  setup,
@@ -10812,7 +10804,7 @@ function setupStatefulComponent(instance, isSSR) {
10812
10804
  ]
10813
10805
  );
10814
10806
  resetTracking();
10815
- unsetCurrentInstance();
10807
+ reset();
10816
10808
  if (isPromise(setupResult)) {
10817
10809
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10818
10810
  if (isSSR) {
@@ -10918,13 +10910,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
10918
10910
  }
10919
10911
  }
10920
10912
  if (!skipOptions) {
10921
- setCurrentInstance(instance);
10913
+ const reset = setCurrentInstance(instance);
10922
10914
  pauseTracking();
10923
10915
  try {
10924
10916
  applyOptions(instance);
10925
10917
  } finally {
10926
10918
  resetTracking();
10927
- unsetCurrentInstance();
10919
+ reset();
10928
10920
  }
10929
10921
  }
10930
10922
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -11051,25 +11043,7 @@ function isClassComponent(value) {
11051
11043
  return isFunction(value) && "__vccOpts" in value;
11052
11044
  }
11053
11045
 
11054
- let isInComputedGetter = false;
11055
- function wrapComputedGetter(getter) {
11056
- return () => {
11057
- isInComputedGetter = true;
11058
- try {
11059
- return getter();
11060
- } finally {
11061
- isInComputedGetter = false;
11062
- }
11063
- };
11064
- }
11065
11046
  const computed = (getterOrOptions, debugOptions) => {
11066
- {
11067
- if (isFunction(getterOrOptions)) {
11068
- getterOrOptions = wrapComputedGetter(getterOrOptions);
11069
- } else {
11070
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11071
- }
11072
- }
11073
11047
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11074
11048
  };
11075
11049
 
@@ -11295,7 +11269,7 @@ function isMemoSame(cached, memo) {
11295
11269
  return true;
11296
11270
  }
11297
11271
 
11298
- const version = "3.4.6";
11272
+ const version = "3.4.7";
11299
11273
  const warn = warn$1 ;
11300
11274
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11301
11275
  const devtools = devtools$1 ;
@@ -15067,7 +15041,7 @@ function onCloseTag(el, end, isImplied = false) {
15067
15041
  }
15068
15042
  }
15069
15043
  }
15070
- if (isCompatEnabled(
15044
+ if (!tokenizer.inSFCRoot && isCompatEnabled(
15071
15045
  "COMPILER_NATIVE_TEMPLATE",
15072
15046
  currentOptions
15073
15047
  ) && el.tag === "template" && !isFragmentTemplate(el)) {
@@ -15680,8 +15654,7 @@ function createTransformContext(root, {
15680
15654
  }
15681
15655
  context.parent.children.splice(removalIndex, 1);
15682
15656
  },
15683
- onNodeRemoved: () => {
15684
- },
15657
+ onNodeRemoved: NOOP,
15685
15658
  addIdentifiers(exp) {
15686
15659
  },
15687
15660
  removeIdentifiers(exp) {