@reactive-vscode/reactivity 0.3.1 → 0.3.3

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/index.cjs CHANGED
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  /**
4
- * @vue/shared v3.5.17
4
+ * @vue/shared v3.5.22
5
5
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
6
6
  * @license MIT
7
7
  **/
8
- /*! #__NO_SIDE_EFFECTS__ */
9
8
  // @__NO_SIDE_EFFECTS__
10
9
  function makeMap(str) {
11
10
  const map = /* @__PURE__ */ Object.create(null);
@@ -44,10 +43,10 @@ const isPlainObject = (val) => toTypeString(val) === "[object Object]";
44
43
  const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
45
44
  const cacheStringFunction = (fn) => {
46
45
  const cache = /* @__PURE__ */ Object.create(null);
47
- return (str) => {
46
+ return ((str) => {
48
47
  const hit = cache[str];
49
48
  return hit || (cache[str] = fn(str));
50
- };
49
+ });
51
50
  };
52
51
  const capitalize = cacheStringFunction((str) => {
53
52
  return str.charAt(0).toUpperCase() + str.slice(1);
@@ -62,7 +61,7 @@ const def = (obj, key, value, writable = false) => {
62
61
  });
63
62
  };
64
63
  /**
65
- * @vue/reactivity v3.5.17
64
+ * @vue/reactivity v3.5.22
66
65
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
67
66
  * @license MIT
68
67
  **/
@@ -817,7 +816,7 @@ const arrayInstrumentations = {
817
816
  join(separator) {
818
817
  return reactiveReadArray(this).join(separator);
819
818
  },
820
- // keys() iterator only reads `length`, no optimisation required
819
+ // keys() iterator only reads `length`, no optimization required
821
820
  lastIndexOf(...args) {
822
821
  return searchProxy(this, "lastIndexOf", args);
823
822
  },
@@ -869,7 +868,7 @@ function iterator(self, method, wrapValue) {
869
868
  iter._next = iter.next;
870
869
  iter.next = () => {
871
870
  const result = iter._next();
872
- if (result.value) {
871
+ if (!result.done) {
873
872
  result.value = wrapValue(result.value);
874
873
  }
875
874
  return result;
@@ -995,7 +994,8 @@ class BaseReactiveHandler {
995
994
  return res;
996
995
  }
997
996
  if (isRef(res)) {
998
- return targetIsArray && isIntegerKey(key) ? res : res.value;
997
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
998
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
999
999
  }
1000
1000
  if (isObject(res)) {
1001
1001
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -1017,7 +1017,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1017
1017
  }
1018
1018
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1019
1019
  if (isOldValueReadonly) {
1020
- return false;
1020
+ if (!!(process.env.NODE_ENV !== "production")) {
1021
+ warn$1(
1022
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1023
+ target[key]
1024
+ );
1025
+ }
1026
+ return true;
1021
1027
  } else {
1022
1028
  oldValue.value = value;
1023
1029
  return true;
@@ -1161,7 +1167,7 @@ function createInstrumentations(readonly2, shallow) {
1161
1167
  get size() {
1162
1168
  const target = this["__v_raw"];
1163
1169
  !readonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
1164
- return Reflect.get(target, "size", target);
1170
+ return target.size;
1165
1171
  },
1166
1172
  has(key) {
1167
1173
  const target = this["__v_raw"];
@@ -1862,11 +1868,11 @@ function traverse(value, depth = Infinity, seen) {
1862
1868
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
1863
1869
  return value;
1864
1870
  }
1865
- seen = seen || /* @__PURE__ */ new Set();
1866
- if (seen.has(value)) {
1871
+ seen = seen || /* @__PURE__ */ new Map();
1872
+ if ((seen.get(value) || 0) >= depth) {
1867
1873
  return value;
1868
1874
  }
1869
- seen.add(value);
1875
+ seen.set(value, depth);
1870
1876
  depth--;
1871
1877
  if (isRef(value)) {
1872
1878
  traverse(value.value, depth, seen);
@@ -2052,10 +2058,10 @@ function flushPostFlushCbs(seen) {
2052
2058
  continue;
2053
2059
  }
2054
2060
  if (cb.flags & 4) {
2055
- cb.flags &= ~1;
2061
+ cb.flags &= -2;
2056
2062
  }
2057
2063
  if (!(cb.flags & 8)) cb();
2058
- cb.flags &= ~1;
2064
+ cb.flags &= -2;
2059
2065
  }
2060
2066
  activePostFlushCbs = null;
2061
2067
  postFlushIndex = 0;
@@ -2091,7 +2097,7 @@ function flushJobs(seen) {
2091
2097
  for (; flushIndex < queue.length; flushIndex++) {
2092
2098
  const job = queue[flushIndex];
2093
2099
  if (job) {
2094
- job.flags &= ~1;
2100
+ job.flags &= -2;
2095
2101
  }
2096
2102
  }
2097
2103
  flushIndex = -1;
package/dist/index.d.ts CHANGED
@@ -739,7 +739,7 @@ export declare enum TrackOpTypes {
739
739
  ITERATE = "iterate"
740
740
  }
741
741
 
742
- export declare function traverse(value: unknown, depth?: number, seen?: Set<unknown>): unknown;
742
+ export declare function traverse(value: unknown, depth?: number, seen?: Map<unknown, number>): unknown;
743
743
 
744
744
  /**
745
745
  * Finds all deps associated with the target (or a specific property) and
package/dist/index.js CHANGED
@@ -1,9 +1,8 @@
1
1
  /**
2
- * @vue/shared v3.5.17
2
+ * @vue/shared v3.5.22
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- /*! #__NO_SIDE_EFFECTS__ */
7
6
  // @__NO_SIDE_EFFECTS__
8
7
  function makeMap(str) {
9
8
  const map = /* @__PURE__ */ Object.create(null);
@@ -42,10 +41,10 @@ const isPlainObject = (val) => toTypeString(val) === "[object Object]";
42
41
  const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
43
42
  const cacheStringFunction = (fn) => {
44
43
  const cache = /* @__PURE__ */ Object.create(null);
45
- return (str) => {
44
+ return ((str) => {
46
45
  const hit = cache[str];
47
46
  return hit || (cache[str] = fn(str));
48
- };
47
+ });
49
48
  };
50
49
  const capitalize = cacheStringFunction((str) => {
51
50
  return str.charAt(0).toUpperCase() + str.slice(1);
@@ -60,7 +59,7 @@ const def = (obj, key, value, writable = false) => {
60
59
  });
61
60
  };
62
61
  /**
63
- * @vue/reactivity v3.5.17
62
+ * @vue/reactivity v3.5.22
64
63
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
65
64
  * @license MIT
66
65
  **/
@@ -815,7 +814,7 @@ const arrayInstrumentations = {
815
814
  join(separator) {
816
815
  return reactiveReadArray(this).join(separator);
817
816
  },
818
- // keys() iterator only reads `length`, no optimisation required
817
+ // keys() iterator only reads `length`, no optimization required
819
818
  lastIndexOf(...args) {
820
819
  return searchProxy(this, "lastIndexOf", args);
821
820
  },
@@ -867,7 +866,7 @@ function iterator(self, method, wrapValue) {
867
866
  iter._next = iter.next;
868
867
  iter.next = () => {
869
868
  const result = iter._next();
870
- if (result.value) {
869
+ if (!result.done) {
871
870
  result.value = wrapValue(result.value);
872
871
  }
873
872
  return result;
@@ -993,7 +992,8 @@ class BaseReactiveHandler {
993
992
  return res;
994
993
  }
995
994
  if (isRef(res)) {
996
- return targetIsArray && isIntegerKey(key) ? res : res.value;
995
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
996
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
997
997
  }
998
998
  if (isObject(res)) {
999
999
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -1015,7 +1015,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1015
1015
  }
1016
1016
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1017
1017
  if (isOldValueReadonly) {
1018
- return false;
1018
+ if (!!(process.env.NODE_ENV !== "production")) {
1019
+ warn$1(
1020
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1021
+ target[key]
1022
+ );
1023
+ }
1024
+ return true;
1019
1025
  } else {
1020
1026
  oldValue.value = value;
1021
1027
  return true;
@@ -1159,7 +1165,7 @@ function createInstrumentations(readonly2, shallow) {
1159
1165
  get size() {
1160
1166
  const target = this["__v_raw"];
1161
1167
  !readonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
1162
- return Reflect.get(target, "size", target);
1168
+ return target.size;
1163
1169
  },
1164
1170
  has(key) {
1165
1171
  const target = this["__v_raw"];
@@ -1860,11 +1866,11 @@ function traverse(value, depth = Infinity, seen) {
1860
1866
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
1861
1867
  return value;
1862
1868
  }
1863
- seen = seen || /* @__PURE__ */ new Set();
1864
- if (seen.has(value)) {
1869
+ seen = seen || /* @__PURE__ */ new Map();
1870
+ if ((seen.get(value) || 0) >= depth) {
1865
1871
  return value;
1866
1872
  }
1867
- seen.add(value);
1873
+ seen.set(value, depth);
1868
1874
  depth--;
1869
1875
  if (isRef(value)) {
1870
1876
  traverse(value.value, depth, seen);
@@ -2050,10 +2056,10 @@ function flushPostFlushCbs(seen) {
2050
2056
  continue;
2051
2057
  }
2052
2058
  if (cb.flags & 4) {
2053
- cb.flags &= ~1;
2059
+ cb.flags &= -2;
2054
2060
  }
2055
2061
  if (!(cb.flags & 8)) cb();
2056
- cb.flags &= ~1;
2062
+ cb.flags &= -2;
2057
2063
  }
2058
2064
  activePostFlushCbs = null;
2059
2065
  postFlushIndex = 0;
@@ -2089,7 +2095,7 @@ function flushJobs(seen) {
2089
2095
  for (; flushIndex < queue.length; flushIndex++) {
2090
2096
  const job = queue[flushIndex];
2091
2097
  if (job) {
2092
- job.flags &= ~1;
2098
+ job.flags &= -2;
2093
2099
  }
2094
2100
  }
2095
2101
  flushIndex = -1;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reactive-vscode/reactivity",
3
3
  "type": "module",
4
- "version": "0.3.1",
4
+ "version": "0.3.3",
5
5
  "description": "Full Vue Reactivity API without DOM",
6
6
  "author": "_Kerman <kermanx@qq.com>",
7
7
  "license": "MIT",
@@ -30,10 +30,10 @@
30
30
  "dist"
31
31
  ],
32
32
  "devDependencies": {
33
- "@vue/reactivity": "^3.5.17",
34
- "@vue/shared": "^3.5.17",
35
- "typescript": "^5.8.3",
36
- "vite": "^5.4.19",
33
+ "@vue/reactivity": "^3.5.22",
34
+ "@vue/shared": "^3.5.22",
35
+ "typescript": "^5.9.3",
36
+ "vite": "^7.1.8",
37
37
  "vite-plugin-dts": "^4.5.4"
38
38
  },
39
39
  "scripts": {