@vue/runtime-core 3.4.3 → 3.4.5

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.
@@ -1455,7 +1455,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1455
1455
  hiddenContainer,
1456
1456
  anchor,
1457
1457
  deps: 0,
1458
- pendingId: 0,
1458
+ pendingId: suspenseId++,
1459
1459
  timeout: typeof timeout === "number" ? timeout : -1,
1460
1460
  activeBranch: null,
1461
1461
  pendingBranch: null,
@@ -1794,7 +1794,6 @@ function doWatch(source, cb, {
1794
1794
  onTrack,
1795
1795
  onTrigger
1796
1796
  } = shared.EMPTY_OBJ) {
1797
- var _a;
1798
1797
  if (cb && once) {
1799
1798
  const _cb = cb;
1800
1799
  cb = (...args) => {
@@ -1802,6 +1801,11 @@ function doWatch(source, cb, {
1802
1801
  unwatch();
1803
1802
  };
1804
1803
  }
1804
+ if (deep !== void 0 && typeof deep === "number") {
1805
+ warn$1(
1806
+ `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
1807
+ );
1808
+ }
1805
1809
  if (!cb) {
1806
1810
  if (immediate !== void 0) {
1807
1811
  warn$1(
@@ -1826,7 +1830,11 @@ function doWatch(source, cb, {
1826
1830
  `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1827
1831
  );
1828
1832
  };
1829
- const instance = reactivity.getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;
1833
+ const instance = currentInstance;
1834
+ const reactiveGetter = (source2) => deep === true ? source2 : (
1835
+ // for deep: false, only traverse root-level properties
1836
+ traverse(source2, deep === false ? 1 : void 0)
1837
+ );
1830
1838
  let getter;
1831
1839
  let forceTrigger = false;
1832
1840
  let isMultiSource = false;
@@ -1834,7 +1842,7 @@ function doWatch(source, cb, {
1834
1842
  getter = () => source.value;
1835
1843
  forceTrigger = reactivity.isShallow(source);
1836
1844
  } else if (reactivity.isReactive(source)) {
1837
- getter = reactivity.isShallow(source) || deep === false ? () => traverse(source, 1) : () => traverse(source);
1845
+ getter = () => reactiveGetter(source);
1838
1846
  forceTrigger = true;
1839
1847
  } else if (shared.isArray(source)) {
1840
1848
  isMultiSource = true;
@@ -1843,7 +1851,7 @@ function doWatch(source, cb, {
1843
1851
  if (reactivity.isRef(s)) {
1844
1852
  return s.value;
1845
1853
  } else if (reactivity.isReactive(s)) {
1846
- return traverse(s, reactivity.isShallow(s) || deep === false ? 1 : void 0);
1854
+ return reactiveGetter(s);
1847
1855
  } else if (shared.isFunction(s)) {
1848
1856
  return callWithErrorHandling(s, instance, 2);
1849
1857
  } else {
@@ -1855,9 +1863,6 @@ function doWatch(source, cb, {
1855
1863
  getter = () => callWithErrorHandling(source, instance, 2);
1856
1864
  } else {
1857
1865
  getter = () => {
1858
- if (instance && instance.isUnmounted) {
1859
- return;
1860
- }
1861
1866
  if (cleanup) {
1862
1867
  cleanup();
1863
1868
  }
@@ -1939,10 +1944,11 @@ function doWatch(source, cb, {
1939
1944
  scheduler = () => queueJob(job);
1940
1945
  }
1941
1946
  const effect = new reactivity.ReactiveEffect(getter, shared.NOOP, scheduler);
1947
+ const scope = reactivity.getCurrentScope();
1942
1948
  const unwatch = () => {
1943
1949
  effect.stop();
1944
- if (instance && instance.scope) {
1945
- shared.remove(instance.scope.effects, effect);
1950
+ if (scope) {
1951
+ shared.remove(scope.effects, effect);
1946
1952
  }
1947
1953
  };
1948
1954
  {
@@ -3293,6 +3299,7 @@ function useModel(props, name, options = shared.EMPTY_OBJ) {
3293
3299
  return reactivity.ref();
3294
3300
  }
3295
3301
  const camelizedName = shared.camelize(name);
3302
+ const hyphenatedName = shared.hyphenate(name);
3296
3303
  const res = reactivity.customRef((track, trigger) => {
3297
3304
  let localValue;
3298
3305
  watchSyncEffect(() => {
@@ -3310,7 +3317,7 @@ function useModel(props, name, options = shared.EMPTY_OBJ) {
3310
3317
  set(value) {
3311
3318
  const rawProps = i.vnode.props;
3312
3319
  if (!(rawProps && // check if parent has passed v-model
3313
- (name in rawProps || camelizedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps)) && shared.hasChanged(value, localValue)) {
3320
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && shared.hasChanged(value, localValue)) {
3314
3321
  localValue = value;
3315
3322
  trigger();
3316
3323
  }
@@ -7985,7 +7992,7 @@ function isMemoSame(cached, memo) {
7985
7992
  return true;
7986
7993
  }
7987
7994
 
7988
- const version = "3.4.3";
7995
+ const version = "3.4.5";
7989
7996
  const warn = warn$1 ;
7990
7997
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
7991
7998
  const devtools = devtools$1 ;
@@ -944,7 +944,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
944
944
  hiddenContainer,
945
945
  anchor,
946
946
  deps: 0,
947
- pendingId: 0,
947
+ pendingId: suspenseId++,
948
948
  timeout: typeof timeout === "number" ? timeout : -1,
949
949
  activeBranch: null,
950
950
  pendingBranch: null,
@@ -1252,7 +1252,6 @@ function doWatch(source, cb, {
1252
1252
  onTrack,
1253
1253
  onTrigger
1254
1254
  } = shared.EMPTY_OBJ) {
1255
- var _a;
1256
1255
  if (cb && once) {
1257
1256
  const _cb = cb;
1258
1257
  cb = (...args) => {
@@ -1260,7 +1259,11 @@ function doWatch(source, cb, {
1260
1259
  unwatch();
1261
1260
  };
1262
1261
  }
1263
- const instance = reactivity.getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;
1262
+ const instance = currentInstance;
1263
+ const reactiveGetter = (source2) => deep === true ? source2 : (
1264
+ // for deep: false, only traverse root-level properties
1265
+ traverse(source2, deep === false ? 1 : void 0)
1266
+ );
1264
1267
  let getter;
1265
1268
  let forceTrigger = false;
1266
1269
  let isMultiSource = false;
@@ -1268,7 +1271,7 @@ function doWatch(source, cb, {
1268
1271
  getter = () => source.value;
1269
1272
  forceTrigger = reactivity.isShallow(source);
1270
1273
  } else if (reactivity.isReactive(source)) {
1271
- getter = reactivity.isShallow(source) || deep === false ? () => traverse(source, 1) : () => traverse(source);
1274
+ getter = () => reactiveGetter(source);
1272
1275
  forceTrigger = true;
1273
1276
  } else if (shared.isArray(source)) {
1274
1277
  isMultiSource = true;
@@ -1277,7 +1280,7 @@ function doWatch(source, cb, {
1277
1280
  if (reactivity.isRef(s)) {
1278
1281
  return s.value;
1279
1282
  } else if (reactivity.isReactive(s)) {
1280
- return traverse(s, reactivity.isShallow(s) || deep === false ? 1 : void 0);
1283
+ return reactiveGetter(s);
1281
1284
  } else if (shared.isFunction(s)) {
1282
1285
  return callWithErrorHandling(s, instance, 2);
1283
1286
  } else ;
@@ -1287,9 +1290,6 @@ function doWatch(source, cb, {
1287
1290
  getter = () => callWithErrorHandling(source, instance, 2);
1288
1291
  } else {
1289
1292
  getter = () => {
1290
- if (instance && instance.isUnmounted) {
1291
- return;
1292
- }
1293
1293
  if (cleanup) {
1294
1294
  cleanup();
1295
1295
  }
@@ -1370,10 +1370,11 @@ function doWatch(source, cb, {
1370
1370
  scheduler = () => queueJob(job);
1371
1371
  }
1372
1372
  const effect = new reactivity.ReactiveEffect(getter, shared.NOOP, scheduler);
1373
+ const scope = reactivity.getCurrentScope();
1373
1374
  const unwatch = () => {
1374
1375
  effect.stop();
1375
- if (instance && instance.scope) {
1376
- shared.remove(instance.scope.effects, effect);
1376
+ if (scope) {
1377
+ shared.remove(scope.effects, effect);
1377
1378
  }
1378
1379
  };
1379
1380
  if (cb) {
@@ -2529,6 +2530,7 @@ function useAttrs() {
2529
2530
  function useModel(props, name, options = shared.EMPTY_OBJ) {
2530
2531
  const i = getCurrentInstance();
2531
2532
  const camelizedName = shared.camelize(name);
2533
+ const hyphenatedName = shared.hyphenate(name);
2532
2534
  const res = reactivity.customRef((track, trigger) => {
2533
2535
  let localValue;
2534
2536
  watchSyncEffect(() => {
@@ -2546,7 +2548,7 @@ function useModel(props, name, options = shared.EMPTY_OBJ) {
2546
2548
  set(value) {
2547
2549
  const rawProps = i.vnode.props;
2548
2550
  if (!(rawProps && // check if parent has passed v-model
2549
- (name in rawProps || camelizedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps)) && shared.hasChanged(value, localValue)) {
2551
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && shared.hasChanged(value, localValue)) {
2550
2552
  localValue = value;
2551
2553
  trigger();
2552
2554
  }
@@ -6253,7 +6255,7 @@ function isMemoSame(cached, memo) {
6253
6255
  return true;
6254
6256
  }
6255
6257
 
6256
- const version = "3.4.3";
6258
+ const version = "3.4.5";
6257
6259
  const warn$1 = shared.NOOP;
6258
6260
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
6259
6261
  const devtools = void 0;
@@ -1,6 +1,6 @@
1
- import { pauseTracking, resetTracking, isRef, toRaw, getCurrentScope, isShallow as isShallow$1, isReactive, ReactiveEffect, ref, shallowReadonly, track, customRef, reactive, shallowReactive, trigger, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1, isReadonly } from '@vue/reactivity';
1
+ import { pauseTracking, resetTracking, isRef, toRaw, isShallow as isShallow$1, isReactive, ReactiveEffect, getCurrentScope, ref, shallowReadonly, track, customRef, reactive, shallowReactive, trigger, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1, isReadonly } from '@vue/reactivity';
2
2
  export { EffectScope, ReactiveEffect, TrackOpTypes, TriggerOpTypes, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
3
- import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, capitalize, toNumber, isSet, isMap, isPlainObject, hasChanged, remove, isBuiltInDirective, invokeArrayFns, isRegExp, isGloballyAllowed, NO, def, isReservedProp, EMPTY_ARR, toRawType, makeMap, normalizeClass, stringifyStyle, normalizeStyle, isKnownSvgAttr, isBooleanAttr, isKnownHtmlAttr, includeBooleanAttr } from '@vue/shared';
3
+ import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, capitalize, toNumber, hasChanged, remove, isSet, isMap, isPlainObject, isBuiltInDirective, invokeArrayFns, isRegExp, isGloballyAllowed, NO, def, isReservedProp, EMPTY_ARR, toRawType, makeMap, normalizeClass, stringifyStyle, normalizeStyle, isKnownSvgAttr, isBooleanAttr, isKnownHtmlAttr, includeBooleanAttr } from '@vue/shared';
4
4
  export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
5
5
 
6
6
  const stack = [];
@@ -1457,7 +1457,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1457
1457
  hiddenContainer,
1458
1458
  anchor,
1459
1459
  deps: 0,
1460
- pendingId: 0,
1460
+ pendingId: suspenseId++,
1461
1461
  timeout: typeof timeout === "number" ? timeout : -1,
1462
1462
  activeBranch: null,
1463
1463
  pendingBranch: null,
@@ -1796,7 +1796,6 @@ function doWatch(source, cb, {
1796
1796
  onTrack,
1797
1797
  onTrigger
1798
1798
  } = EMPTY_OBJ) {
1799
- var _a;
1800
1799
  if (cb && once) {
1801
1800
  const _cb = cb;
1802
1801
  cb = (...args) => {
@@ -1804,6 +1803,11 @@ function doWatch(source, cb, {
1804
1803
  unwatch();
1805
1804
  };
1806
1805
  }
1806
+ if (!!(process.env.NODE_ENV !== "production") && deep !== void 0 && typeof deep === "number") {
1807
+ warn$1(
1808
+ `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
1809
+ );
1810
+ }
1807
1811
  if (!!(process.env.NODE_ENV !== "production") && !cb) {
1808
1812
  if (immediate !== void 0) {
1809
1813
  warn$1(
@@ -1828,7 +1832,11 @@ function doWatch(source, cb, {
1828
1832
  `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1829
1833
  );
1830
1834
  };
1831
- const instance = getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;
1835
+ const instance = currentInstance;
1836
+ const reactiveGetter = (source2) => deep === true ? source2 : (
1837
+ // for deep: false, only traverse root-level properties
1838
+ traverse(source2, deep === false ? 1 : void 0)
1839
+ );
1832
1840
  let getter;
1833
1841
  let forceTrigger = false;
1834
1842
  let isMultiSource = false;
@@ -1836,7 +1844,7 @@ function doWatch(source, cb, {
1836
1844
  getter = () => source.value;
1837
1845
  forceTrigger = isShallow$1(source);
1838
1846
  } else if (isReactive(source)) {
1839
- getter = isShallow$1(source) || deep === false ? () => traverse(source, 1) : () => traverse(source);
1847
+ getter = () => reactiveGetter(source);
1840
1848
  forceTrigger = true;
1841
1849
  } else if (isArray(source)) {
1842
1850
  isMultiSource = true;
@@ -1845,7 +1853,7 @@ function doWatch(source, cb, {
1845
1853
  if (isRef(s)) {
1846
1854
  return s.value;
1847
1855
  } else if (isReactive(s)) {
1848
- return traverse(s, isShallow$1(s) || deep === false ? 1 : void 0);
1856
+ return reactiveGetter(s);
1849
1857
  } else if (isFunction(s)) {
1850
1858
  return callWithErrorHandling(s, instance, 2);
1851
1859
  } else {
@@ -1857,9 +1865,6 @@ function doWatch(source, cb, {
1857
1865
  getter = () => callWithErrorHandling(source, instance, 2);
1858
1866
  } else {
1859
1867
  getter = () => {
1860
- if (instance && instance.isUnmounted) {
1861
- return;
1862
- }
1863
1868
  if (cleanup) {
1864
1869
  cleanup();
1865
1870
  }
@@ -1941,10 +1946,11 @@ function doWatch(source, cb, {
1941
1946
  scheduler = () => queueJob(job);
1942
1947
  }
1943
1948
  const effect = new ReactiveEffect(getter, NOOP, scheduler);
1949
+ const scope = getCurrentScope();
1944
1950
  const unwatch = () => {
1945
1951
  effect.stop();
1946
- if (instance && instance.scope) {
1947
- remove(instance.scope.effects, effect);
1952
+ if (scope) {
1953
+ remove(scope.effects, effect);
1948
1954
  }
1949
1955
  };
1950
1956
  if (!!(process.env.NODE_ENV !== "production")) {
@@ -3297,6 +3303,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
3297
3303
  return ref();
3298
3304
  }
3299
3305
  const camelizedName = camelize(name);
3306
+ const hyphenatedName = hyphenate(name);
3300
3307
  const res = customRef((track, trigger) => {
3301
3308
  let localValue;
3302
3309
  watchSyncEffect(() => {
@@ -3314,7 +3321,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
3314
3321
  set(value) {
3315
3322
  const rawProps = i.vnode.props;
3316
3323
  if (!(rawProps && // check if parent has passed v-model
3317
- (name in rawProps || camelizedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps)) && hasChanged(value, localValue)) {
3324
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
3318
3325
  localValue = value;
3319
3326
  trigger();
3320
3327
  }
@@ -8057,7 +8064,7 @@ function isMemoSame(cached, memo) {
8057
8064
  return true;
8058
8065
  }
8059
8066
 
8060
- const version = "3.4.3";
8067
+ const version = "3.4.5";
8061
8068
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
8062
8069
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
8063
8070
  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.3",
3
+ "version": "3.4.5",
4
4
  "description": "@vue/runtime-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/runtime-core.esm-bundler.js",
@@ -9,6 +9,19 @@
9
9
  "index.js",
10
10
  "dist"
11
11
  ],
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/runtime-core.d.ts",
15
+ "node": {
16
+ "production": "./dist/runtime-core.cjs.prod.js",
17
+ "development": "./dist/runtime-core.cjs.js",
18
+ "default": "./index.js"
19
+ },
20
+ "import": "./dist/runtime-core.esm-bundler.js",
21
+ "require": "./index.js"
22
+ },
23
+ "./*": "./*"
24
+ },
12
25
  "buildOptions": {
13
26
  "name": "VueRuntimeCore",
14
27
  "formats": [
@@ -32,7 +45,7 @@
32
45
  },
33
46
  "homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
34
47
  "dependencies": {
35
- "@vue/shared": "3.4.3",
36
- "@vue/reactivity": "3.4.3"
48
+ "@vue/shared": "3.4.5",
49
+ "@vue/reactivity": "3.4.5"
37
50
  }
38
51
  }