@reactive-vscode/reactivity 0.3.0 → 0.3.2

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.21
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.21
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
  },
@@ -1017,7 +1016,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1017
1016
  }
1018
1017
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1019
1018
  if (isOldValueReadonly) {
1020
- return false;
1019
+ if (!!(process.env.NODE_ENV !== "production")) {
1020
+ warn$1(
1021
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1022
+ target[key]
1023
+ );
1024
+ }
1025
+ return true;
1021
1026
  } else {
1022
1027
  oldValue.value = value;
1023
1028
  return true;
@@ -1161,7 +1166,7 @@ function createInstrumentations(readonly2, shallow) {
1161
1166
  get size() {
1162
1167
  const target = this["__v_raw"];
1163
1168
  !readonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
1164
- return Reflect.get(target, "size", target);
1169
+ return target.size;
1165
1170
  },
1166
1171
  has(key) {
1167
1172
  const target = this["__v_raw"];
@@ -1862,11 +1867,11 @@ function traverse(value, depth = Infinity, seen) {
1862
1867
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
1863
1868
  return value;
1864
1869
  }
1865
- seen = seen || /* @__PURE__ */ new Set();
1866
- if (seen.has(value)) {
1870
+ seen = seen || /* @__PURE__ */ new Map();
1871
+ if ((seen.get(value) || 0) >= depth) {
1867
1872
  return value;
1868
1873
  }
1869
- seen.add(value);
1874
+ seen.set(value, depth);
1870
1875
  depth--;
1871
1876
  if (isRef(value)) {
1872
1877
  traverse(value.value, depth, seen);
@@ -2052,10 +2057,10 @@ function flushPostFlushCbs(seen) {
2052
2057
  continue;
2053
2058
  }
2054
2059
  if (cb.flags & 4) {
2055
- cb.flags &= ~1;
2060
+ cb.flags &= -2;
2056
2061
  }
2057
2062
  if (!(cb.flags & 8)) cb();
2058
- cb.flags &= ~1;
2063
+ cb.flags &= -2;
2059
2064
  }
2060
2065
  activePostFlushCbs = null;
2061
2066
  postFlushIndex = 0;
@@ -2091,7 +2096,7 @@ function flushJobs(seen) {
2091
2096
  for (; flushIndex < queue.length; flushIndex++) {
2092
2097
  const job = queue[flushIndex];
2093
2098
  if (job) {
2094
- job.flags &= ~1;
2099
+ job.flags &= -2;
2095
2100
  }
2096
2101
  }
2097
2102
  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.21
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.21
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
  },
@@ -1015,7 +1014,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1015
1014
  }
1016
1015
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1017
1016
  if (isOldValueReadonly) {
1018
- return false;
1017
+ if (!!(process.env.NODE_ENV !== "production")) {
1018
+ warn$1(
1019
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1020
+ target[key]
1021
+ );
1022
+ }
1023
+ return true;
1019
1024
  } else {
1020
1025
  oldValue.value = value;
1021
1026
  return true;
@@ -1159,7 +1164,7 @@ function createInstrumentations(readonly2, shallow) {
1159
1164
  get size() {
1160
1165
  const target = this["__v_raw"];
1161
1166
  !readonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
1162
- return Reflect.get(target, "size", target);
1167
+ return target.size;
1163
1168
  },
1164
1169
  has(key) {
1165
1170
  const target = this["__v_raw"];
@@ -1860,11 +1865,11 @@ function traverse(value, depth = Infinity, seen) {
1860
1865
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
1861
1866
  return value;
1862
1867
  }
1863
- seen = seen || /* @__PURE__ */ new Set();
1864
- if (seen.has(value)) {
1868
+ seen = seen || /* @__PURE__ */ new Map();
1869
+ if ((seen.get(value) || 0) >= depth) {
1865
1870
  return value;
1866
1871
  }
1867
- seen.add(value);
1872
+ seen.set(value, depth);
1868
1873
  depth--;
1869
1874
  if (isRef(value)) {
1870
1875
  traverse(value.value, depth, seen);
@@ -2050,10 +2055,10 @@ function flushPostFlushCbs(seen) {
2050
2055
  continue;
2051
2056
  }
2052
2057
  if (cb.flags & 4) {
2053
- cb.flags &= ~1;
2058
+ cb.flags &= -2;
2054
2059
  }
2055
2060
  if (!(cb.flags & 8)) cb();
2056
- cb.flags &= ~1;
2061
+ cb.flags &= -2;
2057
2062
  }
2058
2063
  activePostFlushCbs = null;
2059
2064
  postFlushIndex = 0;
@@ -2089,7 +2094,7 @@ function flushJobs(seen) {
2089
2094
  for (; flushIndex < queue.length; flushIndex++) {
2090
2095
  const job = queue[flushIndex];
2091
2096
  if (job) {
2092
- job.flags &= ~1;
2097
+ job.flags &= -2;
2093
2098
  }
2094
2099
  }
2095
2100
  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.0",
4
+ "version": "0.3.2",
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.21",
34
+ "@vue/shared": "^3.5.21",
35
+ "typescript": "^5.9.2",
36
+ "vite": "^7.1.4",
37
37
  "vite-plugin-dts": "^4.5.4"
38
38
  },
39
39
  "scripts": {