@vue/runtime-core 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.
@@ -1985,14 +1985,9 @@ function instanceWatch(source, value, options) {
1985
1985
  cb = value.handler;
1986
1986
  options = value;
1987
1987
  }
1988
- const cur = currentInstance;
1989
- setCurrentInstance(this);
1988
+ const reset = setCurrentInstance(this);
1990
1989
  const res = doWatch(getter, cb.bind(publicThis), options);
1991
- if (cur) {
1992
- setCurrentInstance(cur);
1993
- } else {
1994
- unsetCurrentInstance();
1995
- }
1990
+ reset();
1996
1991
  return res;
1997
1992
  }
1998
1993
  function createPathGetter(ctx, path) {
@@ -2044,12 +2039,11 @@ function validateDirectiveName(name) {
2044
2039
  }
2045
2040
  }
2046
2041
  function withDirectives(vnode, directives) {
2047
- const internalInstance = currentRenderingInstance;
2048
- if (internalInstance === null) {
2042
+ if (currentRenderingInstance === null) {
2049
2043
  warn$1(`withDirectives can only be used inside render functions.`);
2050
2044
  return vnode;
2051
2045
  }
2052
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
2046
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
2053
2047
  const bindings = vnode.dirs || (vnode.dirs = []);
2054
2048
  for (let i = 0; i < directives.length; i++) {
2055
2049
  let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
@@ -2835,9 +2829,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
2835
2829
  return;
2836
2830
  }
2837
2831
  reactivity.pauseTracking();
2838
- setCurrentInstance(target);
2832
+ const reset = setCurrentInstance(target);
2839
2833
  const res = callWithAsyncErrorHandling(hook, target, type, args);
2840
- unsetCurrentInstance();
2834
+ reset();
2841
2835
  reactivity.resetTracking();
2842
2836
  return res;
2843
2837
  });
@@ -4222,12 +4216,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
4222
4216
  if (key in propsDefaults) {
4223
4217
  value = propsDefaults[key];
4224
4218
  } else {
4225
- setCurrentInstance(instance);
4219
+ const reset = setCurrentInstance(instance);
4226
4220
  value = propsDefaults[key] = defaultValue.call(
4227
4221
  null,
4228
4222
  props
4229
4223
  );
4230
- unsetCurrentInstance();
4224
+ reset();
4231
4225
  }
4232
4226
  } else {
4233
4227
  value = defaultValue;
@@ -7474,14 +7468,7 @@ function createComponentInstance(vnode, parent, suspense) {
7474
7468
  return instance;
7475
7469
  }
7476
7470
  let currentInstance = null;
7477
- const getCurrentInstance = () => {
7478
- if (isInComputedGetter) {
7479
- warn$1(
7480
- `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.`
7481
- );
7482
- }
7483
- return currentInstance || currentRenderingInstance;
7484
- };
7471
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
7485
7472
  let internalSetCurrentInstance;
7486
7473
  let setInSSRSetupState;
7487
7474
  {
@@ -7508,8 +7495,13 @@ let setInSSRSetupState;
7508
7495
  );
7509
7496
  }
7510
7497
  const setCurrentInstance = (instance) => {
7498
+ const prev = currentInstance;
7511
7499
  internalSetCurrentInstance(instance);
7512
7500
  instance.scope.on();
7501
+ return () => {
7502
+ instance.scope.off();
7503
+ internalSetCurrentInstance(prev);
7504
+ };
7513
7505
  };
7514
7506
  const unsetCurrentInstance = () => {
7515
7507
  currentInstance && currentInstance.scope.off();
@@ -7571,7 +7563,7 @@ function setupStatefulComponent(instance, isSSR) {
7571
7563
  const { setup } = Component;
7572
7564
  if (setup) {
7573
7565
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
7574
- setCurrentInstance(instance);
7566
+ const reset = setCurrentInstance(instance);
7575
7567
  reactivity.pauseTracking();
7576
7568
  const setupResult = callWithErrorHandling(
7577
7569
  setup,
@@ -7583,7 +7575,7 @@ function setupStatefulComponent(instance, isSSR) {
7583
7575
  ]
7584
7576
  );
7585
7577
  reactivity.resetTracking();
7586
- unsetCurrentInstance();
7578
+ reset();
7587
7579
  if (shared.isPromise(setupResult)) {
7588
7580
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
7589
7581
  if (isSSR) {
@@ -7679,13 +7671,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
7679
7671
  }
7680
7672
  }
7681
7673
  {
7682
- setCurrentInstance(instance);
7674
+ const reset = setCurrentInstance(instance);
7683
7675
  reactivity.pauseTracking();
7684
7676
  try {
7685
7677
  applyOptions(instance);
7686
7678
  } finally {
7687
7679
  reactivity.resetTracking();
7688
- unsetCurrentInstance();
7680
+ reset();
7689
7681
  }
7690
7682
  }
7691
7683
  if (!Component.render && instance.render === shared.NOOP && !isSSR) {
@@ -7812,25 +7804,7 @@ function isClassComponent(value) {
7812
7804
  return shared.isFunction(value) && "__vccOpts" in value;
7813
7805
  }
7814
7806
 
7815
- let isInComputedGetter = false;
7816
- function wrapComputedGetter(getter) {
7817
- return () => {
7818
- isInComputedGetter = true;
7819
- try {
7820
- return getter();
7821
- } finally {
7822
- isInComputedGetter = false;
7823
- }
7824
- };
7825
- }
7826
7807
  const computed = (getterOrOptions, debugOptions) => {
7827
- {
7828
- if (shared.isFunction(getterOrOptions)) {
7829
- getterOrOptions = wrapComputedGetter(getterOrOptions);
7830
- } else {
7831
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
7832
- }
7833
- }
7834
7808
  return reactivity.computed(getterOrOptions, debugOptions, isInSSRComponentSetup);
7835
7809
  };
7836
7810
 
@@ -8060,7 +8034,7 @@ function isMemoSame(cached, memo) {
8060
8034
  return true;
8061
8035
  }
8062
8036
 
8063
- const version = "3.4.6";
8037
+ const version = "3.4.7";
8064
8038
  const warn = warn$1 ;
8065
8039
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
8066
8040
  const devtools = devtools$1 ;
@@ -1407,14 +1407,9 @@ function instanceWatch(source, value, options) {
1407
1407
  cb = value.handler;
1408
1408
  options = value;
1409
1409
  }
1410
- const cur = currentInstance;
1411
- setCurrentInstance(this);
1410
+ const reset = setCurrentInstance(this);
1412
1411
  const res = doWatch(getter, cb.bind(publicThis), options);
1413
- if (cur) {
1414
- setCurrentInstance(cur);
1415
- } else {
1416
- unsetCurrentInstance();
1417
- }
1412
+ reset();
1418
1413
  return res;
1419
1414
  }
1420
1415
  function createPathGetter(ctx, path) {
@@ -1461,11 +1456,10 @@ function traverse(value, depth, currentDepth = 0, seen) {
1461
1456
  }
1462
1457
 
1463
1458
  function withDirectives(vnode, directives) {
1464
- const internalInstance = currentRenderingInstance;
1465
- if (internalInstance === null) {
1459
+ if (currentRenderingInstance === null) {
1466
1460
  return vnode;
1467
1461
  }
1468
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
1462
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
1469
1463
  const bindings = vnode.dirs || (vnode.dirs = []);
1470
1464
  for (let i = 0; i < directives.length; i++) {
1471
1465
  let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
@@ -2221,9 +2215,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
2221
2215
  return;
2222
2216
  }
2223
2217
  reactivity.pauseTracking();
2224
- setCurrentInstance(target);
2218
+ const reset = setCurrentInstance(target);
2225
2219
  const res = callWithAsyncErrorHandling(hook, target, type, args);
2226
- unsetCurrentInstance();
2220
+ reset();
2227
2221
  reactivity.resetTracking();
2228
2222
  return res;
2229
2223
  });
@@ -3281,12 +3275,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
3281
3275
  if (key in propsDefaults) {
3282
3276
  value = propsDefaults[key];
3283
3277
  } else {
3284
- setCurrentInstance(instance);
3278
+ const reset = setCurrentInstance(instance);
3285
3279
  value = propsDefaults[key] = defaultValue.call(
3286
3280
  null,
3287
3281
  props
3288
3282
  );
3289
- unsetCurrentInstance();
3283
+ reset();
3290
3284
  }
3291
3285
  } else {
3292
3286
  value = defaultValue;
@@ -6015,9 +6009,7 @@ function createComponentInstance(vnode, parent, suspense) {
6015
6009
  return instance;
6016
6010
  }
6017
6011
  let currentInstance = null;
6018
- const getCurrentInstance = () => {
6019
- return currentInstance || currentRenderingInstance;
6020
- };
6012
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
6021
6013
  let internalSetCurrentInstance;
6022
6014
  let setInSSRSetupState;
6023
6015
  {
@@ -6044,8 +6036,13 @@ let setInSSRSetupState;
6044
6036
  );
6045
6037
  }
6046
6038
  const setCurrentInstance = (instance) => {
6039
+ const prev = currentInstance;
6047
6040
  internalSetCurrentInstance(instance);
6048
6041
  instance.scope.on();
6042
+ return () => {
6043
+ instance.scope.off();
6044
+ internalSetCurrentInstance(prev);
6045
+ };
6049
6046
  };
6050
6047
  const unsetCurrentInstance = () => {
6051
6048
  currentInstance && currentInstance.scope.off();
@@ -6072,7 +6069,7 @@ function setupStatefulComponent(instance, isSSR) {
6072
6069
  const { setup } = Component;
6073
6070
  if (setup) {
6074
6071
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
6075
- setCurrentInstance(instance);
6072
+ const reset = setCurrentInstance(instance);
6076
6073
  reactivity.pauseTracking();
6077
6074
  const setupResult = callWithErrorHandling(
6078
6075
  setup,
@@ -6084,7 +6081,7 @@ function setupStatefulComponent(instance, isSSR) {
6084
6081
  ]
6085
6082
  );
6086
6083
  reactivity.resetTracking();
6087
- unsetCurrentInstance();
6084
+ reset();
6088
6085
  if (shared.isPromise(setupResult)) {
6089
6086
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
6090
6087
  if (isSSR) {
@@ -6153,13 +6150,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
6153
6150
  }
6154
6151
  }
6155
6152
  {
6156
- setCurrentInstance(instance);
6153
+ const reset = setCurrentInstance(instance);
6157
6154
  reactivity.pauseTracking();
6158
6155
  try {
6159
6156
  applyOptions(instance);
6160
6157
  } finally {
6161
6158
  reactivity.resetTracking();
6162
- unsetCurrentInstance();
6159
+ reset();
6163
6160
  }
6164
6161
  }
6165
6162
  }
@@ -6268,7 +6265,7 @@ function isMemoSame(cached, memo) {
6268
6265
  return true;
6269
6266
  }
6270
6267
 
6271
- const version = "3.4.6";
6268
+ const version = "3.4.7";
6272
6269
  const warn$1 = shared.NOOP;
6273
6270
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
6274
6271
  const devtools = void 0;
@@ -1395,7 +1395,7 @@ export declare function h(type: typeof Fragment, props?: RawProps | null, childr
1395
1395
  export declare function h(type: typeof Teleport, props: RawProps & TeleportProps, children: RawChildren | RawSlots): VNode;
1396
1396
  export declare function h(type: typeof Suspense, children?: RawChildren): VNode;
1397
1397
  export declare function h(type: typeof Suspense, props?: (RawProps & SuspenseProps) | null, children?: RawChildren | RawSlots): VNode;
1398
- export declare function h<P, E extends EmitsOptions = {}, S extends Record<string, any> = {}>(type: FunctionalComponent<P, E, S>, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren | RawSlots): VNode;
1398
+ export declare function h<P, E extends EmitsOptions = {}, S extends Record<string, any> = any>(type: FunctionalComponent<P, any, S, any>, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren | IfAny<S, RawSlots, S>): VNode;
1399
1399
  export declare function h(type: Component, children?: RawChildren): VNode;
1400
1400
  export declare function h<P>(type: ConcreteComponent | string, children?: RawChildren): VNode;
1401
1401
  export declare function h<P>(type: ConcreteComponent<P> | string, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren): VNode;
@@ -1987,14 +1987,9 @@ function instanceWatch(source, value, options) {
1987
1987
  cb = value.handler;
1988
1988
  options = value;
1989
1989
  }
1990
- const cur = currentInstance;
1991
- setCurrentInstance(this);
1990
+ const reset = setCurrentInstance(this);
1992
1991
  const res = doWatch(getter, cb.bind(publicThis), options);
1993
- if (cur) {
1994
- setCurrentInstance(cur);
1995
- } else {
1996
- unsetCurrentInstance();
1997
- }
1992
+ reset();
1998
1993
  return res;
1999
1994
  }
2000
1995
  function createPathGetter(ctx, path) {
@@ -2046,12 +2041,11 @@ function validateDirectiveName(name) {
2046
2041
  }
2047
2042
  }
2048
2043
  function withDirectives(vnode, directives) {
2049
- const internalInstance = currentRenderingInstance;
2050
- if (internalInstance === null) {
2044
+ if (currentRenderingInstance === null) {
2051
2045
  !!(process.env.NODE_ENV !== "production") && warn$1(`withDirectives can only be used inside render functions.`);
2052
2046
  return vnode;
2053
2047
  }
2054
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
2048
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
2055
2049
  const bindings = vnode.dirs || (vnode.dirs = []);
2056
2050
  for (let i = 0; i < directives.length; i++) {
2057
2051
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -2839,9 +2833,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
2839
2833
  return;
2840
2834
  }
2841
2835
  pauseTracking();
2842
- setCurrentInstance(target);
2836
+ const reset = setCurrentInstance(target);
2843
2837
  const res = callWithAsyncErrorHandling(hook, target, type, args);
2844
- unsetCurrentInstance();
2838
+ reset();
2845
2839
  resetTracking();
2846
2840
  return res;
2847
2841
  });
@@ -4230,12 +4224,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
4230
4224
  if (key in propsDefaults) {
4231
4225
  value = propsDefaults[key];
4232
4226
  } else {
4233
- setCurrentInstance(instance);
4227
+ const reset = setCurrentInstance(instance);
4234
4228
  value = propsDefaults[key] = defaultValue.call(
4235
4229
  null,
4236
4230
  props
4237
4231
  );
4238
- unsetCurrentInstance();
4232
+ reset();
4239
4233
  }
4240
4234
  } else {
4241
4235
  value = defaultValue;
@@ -7532,14 +7526,7 @@ function createComponentInstance(vnode, parent, suspense) {
7532
7526
  return instance;
7533
7527
  }
7534
7528
  let currentInstance = null;
7535
- const getCurrentInstance = () => {
7536
- if (!!(process.env.NODE_ENV !== "production") && isInComputedGetter) {
7537
- warn$1(
7538
- `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.`
7539
- );
7540
- }
7541
- return currentInstance || currentRenderingInstance;
7542
- };
7529
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
7543
7530
  let internalSetCurrentInstance;
7544
7531
  let setInSSRSetupState;
7545
7532
  {
@@ -7566,8 +7553,13 @@ let setInSSRSetupState;
7566
7553
  );
7567
7554
  }
7568
7555
  const setCurrentInstance = (instance) => {
7556
+ const prev = currentInstance;
7569
7557
  internalSetCurrentInstance(instance);
7570
7558
  instance.scope.on();
7559
+ return () => {
7560
+ instance.scope.off();
7561
+ internalSetCurrentInstance(prev);
7562
+ };
7571
7563
  };
7572
7564
  const unsetCurrentInstance = () => {
7573
7565
  currentInstance && currentInstance.scope.off();
@@ -7629,7 +7621,7 @@ function setupStatefulComponent(instance, isSSR) {
7629
7621
  const { setup } = Component;
7630
7622
  if (setup) {
7631
7623
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
7632
- setCurrentInstance(instance);
7624
+ const reset = setCurrentInstance(instance);
7633
7625
  pauseTracking();
7634
7626
  const setupResult = callWithErrorHandling(
7635
7627
  setup,
@@ -7641,7 +7633,7 @@ function setupStatefulComponent(instance, isSSR) {
7641
7633
  ]
7642
7634
  );
7643
7635
  resetTracking();
7644
- unsetCurrentInstance();
7636
+ reset();
7645
7637
  if (isPromise(setupResult)) {
7646
7638
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
7647
7639
  if (isSSR) {
@@ -7737,13 +7729,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
7737
7729
  }
7738
7730
  }
7739
7731
  if (__VUE_OPTIONS_API__ && true) {
7740
- setCurrentInstance(instance);
7732
+ const reset = setCurrentInstance(instance);
7741
7733
  pauseTracking();
7742
7734
  try {
7743
7735
  applyOptions(instance);
7744
7736
  } finally {
7745
7737
  resetTracking();
7746
- unsetCurrentInstance();
7738
+ reset();
7747
7739
  }
7748
7740
  }
7749
7741
  if (!!(process.env.NODE_ENV !== "production") && !Component.render && instance.render === NOOP && !isSSR) {
@@ -7884,25 +7876,7 @@ function isClassComponent(value) {
7884
7876
  return isFunction(value) && "__vccOpts" in value;
7885
7877
  }
7886
7878
 
7887
- let isInComputedGetter = false;
7888
- function wrapComputedGetter(getter) {
7889
- return () => {
7890
- isInComputedGetter = true;
7891
- try {
7892
- return getter();
7893
- } finally {
7894
- isInComputedGetter = false;
7895
- }
7896
- };
7897
- }
7898
7879
  const computed = (getterOrOptions, debugOptions) => {
7899
- if (!!(process.env.NODE_ENV !== "production")) {
7900
- if (isFunction(getterOrOptions)) {
7901
- getterOrOptions = wrapComputedGetter(getterOrOptions);
7902
- } else {
7903
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
7904
- }
7905
- }
7906
7880
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
7907
7881
  };
7908
7882
 
@@ -8132,7 +8106,7 @@ function isMemoSame(cached, memo) {
8132
8106
  return true;
8133
8107
  }
8134
8108
 
8135
- const version = "3.4.6";
8109
+ const version = "3.4.7";
8136
8110
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
8137
8111
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
8138
8112
  const devtools = !!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__ ? devtools$1 : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/runtime-core",
3
- "version": "3.4.6",
3
+ "version": "3.4.7",
4
4
  "description": "@vue/runtime-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/runtime-core.esm-bundler.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
34
34
  "dependencies": {
35
- "@vue/reactivity": "3.4.6",
36
- "@vue/shared": "3.4.6"
35
+ "@vue/shared": "3.4.7",
36
+ "@vue/reactivity": "3.4.7"
37
37
  }
38
38
  }