@reactive-vscode/reactivity 0.2.20 → 0.2.22

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,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  /**
4
- * @vue/shared v3.5.13
4
+ * @vue/shared v3.5.17
5
5
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
6
6
  * @license MIT
7
7
  **/
@@ -62,7 +62,7 @@ const def = (obj, key, value, writable = false) => {
62
62
  });
63
63
  };
64
64
  /**
65
- * @vue/reactivity v3.5.13
65
+ * @vue/reactivity v3.5.17
66
66
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
67
67
  * @license MIT
68
68
  **/
@@ -74,6 +74,7 @@ class EffectScope {
74
74
  constructor(detached = false) {
75
75
  this.detached = detached;
76
76
  this._active = true;
77
+ this._on = 0;
77
78
  this.effects = [];
78
79
  this.cleanups = [];
79
80
  this._isPaused = false;
@@ -138,14 +139,20 @@ class EffectScope {
138
139
  * @internal
139
140
  */
140
141
  on() {
141
- activeEffectScope = this;
142
+ if (++this._on === 1) {
143
+ this.prevScope = activeEffectScope;
144
+ activeEffectScope = this;
145
+ }
142
146
  }
143
147
  /**
144
148
  * This should only be called on non-detached scopes
145
149
  * @internal
146
150
  */
147
151
  off() {
148
- activeEffectScope = this.parent;
152
+ if (this._on > 0 && --this._on === 0) {
153
+ activeEffectScope = this.prevScope;
154
+ this.prevScope = void 0;
155
+ }
149
156
  }
150
157
  stop(fromParent) {
151
158
  if (this._active) {
@@ -206,7 +213,9 @@ const EffectFlags = {
206
213
  "ALLOW_RECURSE": 32,
207
214
  "32": "ALLOW_RECURSE",
208
215
  "PAUSED": 64,
209
- "64": "PAUSED"
216
+ "64": "PAUSED",
217
+ "EVALUATED": 128,
218
+ "128": "EVALUATED"
210
219
  };
211
220
  const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
212
221
  class ReactiveEffect {
@@ -227,7 +236,7 @@ class ReactiveEffect {
227
236
  }
228
237
  resume() {
229
238
  if (this.flags & 64) {
230
- this.flags &= ~64;
239
+ this.flags &= -65;
231
240
  if (pausedQueueEffects.has(this)) {
232
241
  pausedQueueEffects.delete(this);
233
242
  this.trigger();
@@ -267,7 +276,7 @@ class ReactiveEffect {
267
276
  cleanupDeps(this);
268
277
  activeSub = prevEffect;
269
278
  shouldTrack = prevShouldTrack;
270
- this.flags &= ~2;
279
+ this.flags &= -3;
271
280
  }
272
281
  }
273
282
  stop() {
@@ -278,7 +287,7 @@ class ReactiveEffect {
278
287
  this.deps = this.depsTail = void 0;
279
288
  cleanupEffect(this);
280
289
  this.onStop && this.onStop();
281
- this.flags &= ~1;
290
+ this.flags &= -2;
282
291
  }
283
292
  }
284
293
  trigger() {
@@ -328,7 +337,7 @@ function endBatch() {
328
337
  while (e) {
329
338
  const next = e.next;
330
339
  e.next = void 0;
331
- e.flags &= ~8;
340
+ e.flags &= -9;
332
341
  e = next;
333
342
  }
334
343
  }
@@ -339,7 +348,7 @@ function endBatch() {
339
348
  while (e) {
340
349
  const next = e.next;
341
350
  e.next = void 0;
342
- e.flags &= ~8;
351
+ e.flags &= -9;
343
352
  if (e.flags & 1) {
344
353
  try {
345
354
  ;
@@ -395,17 +404,16 @@ function refreshComputed(computed2) {
395
404
  if (computed2.flags & 4 && !(computed2.flags & 16)) {
396
405
  return;
397
406
  }
398
- computed2.flags &= ~16;
407
+ computed2.flags &= -17;
399
408
  if (computed2.globalVersion === globalVersion) {
400
409
  return;
401
410
  }
402
411
  computed2.globalVersion = globalVersion;
403
- const dep = computed2.dep;
404
- computed2.flags |= 2;
405
- if (dep.version > 0 && !computed2.isSSR && computed2.deps && !isDirty(computed2)) {
406
- computed2.flags &= ~2;
412
+ if (!computed2.isSSR && computed2.flags & 128 && (!computed2.deps && !computed2._dirty || !isDirty(computed2))) {
407
413
  return;
408
414
  }
415
+ computed2.flags |= 2;
416
+ const dep = computed2.dep;
409
417
  const prevSub = activeSub;
410
418
  const prevShouldTrack = shouldTrack;
411
419
  activeSub = computed2;
@@ -414,6 +422,7 @@ function refreshComputed(computed2) {
414
422
  prepareDeps(computed2);
415
423
  const value = computed2.fn(computed2._value);
416
424
  if (dep.version === 0 || hasChanged(value, computed2._value)) {
425
+ computed2.flags |= 128;
417
426
  computed2._value = value;
418
427
  dep.version++;
419
428
  }
@@ -424,7 +433,7 @@ function refreshComputed(computed2) {
424
433
  activeSub = prevSub;
425
434
  shouldTrack = prevShouldTrack;
426
435
  cleanupDeps(computed2);
427
- computed2.flags &= ~2;
436
+ computed2.flags &= -3;
428
437
  }
429
438
  }
430
439
  function removeSub(link, soft = false) {
@@ -443,7 +452,7 @@ function removeSub(link, soft = false) {
443
452
  if (dep.subs === link) {
444
453
  dep.subs = prevSub;
445
454
  if (!prevSub && dep.computed) {
446
- dep.computed.flags &= ~4;
455
+ dep.computed.flags &= -5;
447
456
  for (let l = dep.computed.deps; l; l = l.nextDep) {
448
457
  removeSub(l, true);
449
458
  }
@@ -531,6 +540,7 @@ class Link {
531
540
  }
532
541
  }
533
542
  class Dep {
543
+ // TODO isolatedDeclarations "__v_skip"
534
544
  constructor(computed2) {
535
545
  this.computed = computed2;
536
546
  this.version = 0;
@@ -539,6 +549,7 @@ class Dep {
539
549
  this.map = void 0;
540
550
  this.key = void 0;
541
551
  this.sc = 0;
552
+ this.__v_skip = true;
542
553
  if (!!(process.env.NODE_ENV !== "production")) {
543
554
  this.subsHead = void 0;
544
555
  }
@@ -1376,14 +1387,14 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1376
1387
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1377
1388
  return target;
1378
1389
  }
1379
- const existingProxy = proxyMap.get(target);
1380
- if (existingProxy) {
1381
- return existingProxy;
1382
- }
1383
1390
  const targetType = getTargetType(target);
1384
1391
  if (targetType === 0) {
1385
1392
  return target;
1386
1393
  }
1394
+ const existingProxy = proxyMap.get(target);
1395
+ if (existingProxy) {
1396
+ return existingProxy;
1397
+ }
1387
1398
  const proxy = new Proxy(
1388
1399
  target,
1389
1400
  targetType === 2 ? collectionHandlers : baseHandlers
@@ -1797,11 +1808,11 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
1797
1808
  oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1798
1809
  boundCleanup
1799
1810
  ];
1811
+ oldValue = newValue;
1800
1812
  call ? call(cb, 3, args) : (
1801
1813
  // @ts-expect-error
1802
1814
  cb(...args)
1803
1815
  );
1804
- oldValue = newValue;
1805
1816
  } finally {
1806
1817
  activeWatcher = currentWatcher;
1807
1818
  }
package/dist/index.d.ts CHANGED
@@ -122,7 +122,8 @@ export declare enum EffectFlags {
122
122
  NOTIFIED = 8,
123
123
  DIRTY = 16,
124
124
  ALLOW_RECURSE = 32,
125
- PAUSED = 64
125
+ PAUSED = 64,
126
+ EVALUATED = 128
126
127
  }
127
128
 
128
129
  export declare type EffectScheduler = (...args: any[]) => any;
@@ -138,6 +139,7 @@ export declare class EffectScope {
138
139
  */
139
140
  resume(): void;
140
141
  run<T>(fn: () => T): T | undefined;
142
+ prevScope: EffectScope | undefined;
141
143
  stop(fromParent?: boolean): void;
142
144
  }
143
145
 
@@ -173,7 +175,7 @@ declare type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
173
175
 
174
176
  /**
175
177
  * Checks if an object is a proxy created by {@link reactive},
176
- * {@link readonly}, {@link shallowReactive} or {@link shallowReadonly()}.
178
+ * {@link readonly}, {@link shallowReactive} or {@link shallowReadonly}.
177
179
  *
178
180
  * @param value - The value to check.
179
181
  * @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
@@ -181,8 +183,8 @@ declare type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
181
183
  export declare function isProxy(value: any): boolean;
182
184
 
183
185
  /**
184
- * Checks if an object is a proxy created by {@link reactive()} or
185
- * {@link shallowReactive()} (or {@link ref()} in some cases).
186
+ * Checks if an object is a proxy created by {@link reactive} or
187
+ * {@link shallowReactive} (or {@link ref} in some cases).
186
188
  *
187
189
  * @example
188
190
  * ```js
@@ -205,7 +207,7 @@ export declare function isReactive(value: unknown): boolean;
205
207
  * readonly object can change, but they can't be assigned directly via the
206
208
  * passed object.
207
209
  *
208
- * The proxies created by {@link readonly()} and {@link shallowReadonly()} are
210
+ * The proxies created by {@link readonly} and {@link shallowReadonly} are
209
211
  * both considered readonly, as is a computed ref without a set function.
210
212
  *
211
213
  * @param value - The value to check.
@@ -246,7 +248,7 @@ declare type MapSources<T, Immediate> = {
246
248
  * ```
247
249
  *
248
250
  * **Warning:** `markRaw()` together with the shallow APIs such as
249
- * {@link shallowReactive()} allow you to selectively opt-out of the default
251
+ * {@link shallowReactive} allow you to selectively opt-out of the default
250
252
  * deep reactive/readonly conversion and embed raw, non-proxied objects in your
251
253
  * state graph.
252
254
  *
@@ -403,7 +405,7 @@ export declare function reactiveReadArray<T>(array: T[]): T[];
403
405
  * the original.
404
406
  *
405
407
  * A readonly proxy is deep: any nested property accessed will be readonly as
406
- * well. It also has the same ref-unwrapping behavior as {@link reactive()},
408
+ * well. It also has the same ref-unwrapping behavior as {@link reactive},
407
409
  * except the unwrapped values will also be made readonly.
408
410
  *
409
411
  * @example
@@ -479,9 +481,9 @@ export declare type ShallowReactive<T> = T & {
479
481
  };
480
482
 
481
483
  /**
482
- * Shallow version of {@link reactive()}.
484
+ * Shallow version of {@link reactive}.
483
485
  *
484
- * Unlike {@link reactive()}, there is no deep conversion: only root-level
486
+ * Unlike {@link reactive}, there is no deep conversion: only root-level
485
487
  * properties are reactive for a shallow reactive object. Property values are
486
488
  * stored and exposed as-is - this also means properties with ref values will
487
489
  * not be automatically unwrapped.
@@ -518,9 +520,9 @@ export declare const ShallowReactiveMarker: unique symbol;
518
520
  export declare function shallowReadArray<T>(arr: T[]): T[];
519
521
 
520
522
  /**
521
- * Shallow version of {@link readonly()}.
523
+ * Shallow version of {@link readonly}.
522
524
  *
523
- * Unlike {@link readonly()}, there is no deep conversion: only root-level
525
+ * Unlike {@link readonly}, there is no deep conversion: only root-level
524
526
  * properties are made readonly. Property values are stored and exposed as-is -
525
527
  * this also means properties with ref values will not be automatically
526
528
  * unwrapped.
@@ -554,7 +556,7 @@ export declare type ShallowRef<T = any, S = T> = Ref<T, S> & {
554
556
  };
555
557
 
556
558
  /**
557
- * Shallow version of {@link ref()}.
559
+ * Shallow version of {@link ref}.
558
560
  *
559
561
  * @example
560
562
  * ```js
@@ -597,8 +599,8 @@ export declare interface Subscriber extends DebuggerOptions {
597
599
  * Returns the raw, original object of a Vue-created proxy.
598
600
  *
599
601
  * `toRaw()` can return the original object from proxies created by
600
- * {@link reactive()}, {@link readonly()}, {@link shallowReactive()} or
601
- * {@link shallowReadonly()}.
602
+ * {@link reactive}, {@link readonly}, {@link shallowReactive} or
603
+ * {@link shallowReadonly}.
602
604
  *
603
605
  * This is an escape hatch that can be used to temporarily read without
604
606
  * incurring proxy access / tracking overhead or write without triggering
@@ -694,7 +696,7 @@ export declare type ToRefs<T = any> = {
694
696
  /**
695
697
  * Converts a reactive object to a plain object where each property of the
696
698
  * resulting object is a ref pointing to the corresponding property of the
697
- * original object. Each individual ref is created using {@link toRef()}.
699
+ * original object. Each individual ref is created using {@link toRef}.
698
700
  *
699
701
  * @param object - Reactive object to be made into an object of linked refs.
700
702
  * @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs}
@@ -703,7 +705,7 @@ export declare function toRefs<T extends object>(object: T): ToRefs<T>;
703
705
 
704
706
  /**
705
707
  * Normalizes values / refs / getters to values.
706
- * This is similar to {@link unref()}, except that it also normalizes getters.
708
+ * This is similar to {@link unref}, except that it also normalizes getters.
707
709
  * If the argument is a getter, it will be invoked and its return value will
708
710
  * be returned.
709
711
  *
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/shared v3.5.13
2
+ * @vue/shared v3.5.17
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -60,7 +60,7 @@ const def = (obj, key, value, writable = false) => {
60
60
  });
61
61
  };
62
62
  /**
63
- * @vue/reactivity v3.5.13
63
+ * @vue/reactivity v3.5.17
64
64
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
65
65
  * @license MIT
66
66
  **/
@@ -72,6 +72,7 @@ class EffectScope {
72
72
  constructor(detached = false) {
73
73
  this.detached = detached;
74
74
  this._active = true;
75
+ this._on = 0;
75
76
  this.effects = [];
76
77
  this.cleanups = [];
77
78
  this._isPaused = false;
@@ -136,14 +137,20 @@ class EffectScope {
136
137
  * @internal
137
138
  */
138
139
  on() {
139
- activeEffectScope = this;
140
+ if (++this._on === 1) {
141
+ this.prevScope = activeEffectScope;
142
+ activeEffectScope = this;
143
+ }
140
144
  }
141
145
  /**
142
146
  * This should only be called on non-detached scopes
143
147
  * @internal
144
148
  */
145
149
  off() {
146
- activeEffectScope = this.parent;
150
+ if (this._on > 0 && --this._on === 0) {
151
+ activeEffectScope = this.prevScope;
152
+ this.prevScope = void 0;
153
+ }
147
154
  }
148
155
  stop(fromParent) {
149
156
  if (this._active) {
@@ -204,7 +211,9 @@ const EffectFlags = {
204
211
  "ALLOW_RECURSE": 32,
205
212
  "32": "ALLOW_RECURSE",
206
213
  "PAUSED": 64,
207
- "64": "PAUSED"
214
+ "64": "PAUSED",
215
+ "EVALUATED": 128,
216
+ "128": "EVALUATED"
208
217
  };
209
218
  const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
210
219
  class ReactiveEffect {
@@ -225,7 +234,7 @@ class ReactiveEffect {
225
234
  }
226
235
  resume() {
227
236
  if (this.flags & 64) {
228
- this.flags &= ~64;
237
+ this.flags &= -65;
229
238
  if (pausedQueueEffects.has(this)) {
230
239
  pausedQueueEffects.delete(this);
231
240
  this.trigger();
@@ -265,7 +274,7 @@ class ReactiveEffect {
265
274
  cleanupDeps(this);
266
275
  activeSub = prevEffect;
267
276
  shouldTrack = prevShouldTrack;
268
- this.flags &= ~2;
277
+ this.flags &= -3;
269
278
  }
270
279
  }
271
280
  stop() {
@@ -276,7 +285,7 @@ class ReactiveEffect {
276
285
  this.deps = this.depsTail = void 0;
277
286
  cleanupEffect(this);
278
287
  this.onStop && this.onStop();
279
- this.flags &= ~1;
288
+ this.flags &= -2;
280
289
  }
281
290
  }
282
291
  trigger() {
@@ -326,7 +335,7 @@ function endBatch() {
326
335
  while (e) {
327
336
  const next = e.next;
328
337
  e.next = void 0;
329
- e.flags &= ~8;
338
+ e.flags &= -9;
330
339
  e = next;
331
340
  }
332
341
  }
@@ -337,7 +346,7 @@ function endBatch() {
337
346
  while (e) {
338
347
  const next = e.next;
339
348
  e.next = void 0;
340
- e.flags &= ~8;
349
+ e.flags &= -9;
341
350
  if (e.flags & 1) {
342
351
  try {
343
352
  ;
@@ -393,17 +402,16 @@ function refreshComputed(computed2) {
393
402
  if (computed2.flags & 4 && !(computed2.flags & 16)) {
394
403
  return;
395
404
  }
396
- computed2.flags &= ~16;
405
+ computed2.flags &= -17;
397
406
  if (computed2.globalVersion === globalVersion) {
398
407
  return;
399
408
  }
400
409
  computed2.globalVersion = globalVersion;
401
- const dep = computed2.dep;
402
- computed2.flags |= 2;
403
- if (dep.version > 0 && !computed2.isSSR && computed2.deps && !isDirty(computed2)) {
404
- computed2.flags &= ~2;
410
+ if (!computed2.isSSR && computed2.flags & 128 && (!computed2.deps && !computed2._dirty || !isDirty(computed2))) {
405
411
  return;
406
412
  }
413
+ computed2.flags |= 2;
414
+ const dep = computed2.dep;
407
415
  const prevSub = activeSub;
408
416
  const prevShouldTrack = shouldTrack;
409
417
  activeSub = computed2;
@@ -412,6 +420,7 @@ function refreshComputed(computed2) {
412
420
  prepareDeps(computed2);
413
421
  const value = computed2.fn(computed2._value);
414
422
  if (dep.version === 0 || hasChanged(value, computed2._value)) {
423
+ computed2.flags |= 128;
415
424
  computed2._value = value;
416
425
  dep.version++;
417
426
  }
@@ -422,7 +431,7 @@ function refreshComputed(computed2) {
422
431
  activeSub = prevSub;
423
432
  shouldTrack = prevShouldTrack;
424
433
  cleanupDeps(computed2);
425
- computed2.flags &= ~2;
434
+ computed2.flags &= -3;
426
435
  }
427
436
  }
428
437
  function removeSub(link, soft = false) {
@@ -441,7 +450,7 @@ function removeSub(link, soft = false) {
441
450
  if (dep.subs === link) {
442
451
  dep.subs = prevSub;
443
452
  if (!prevSub && dep.computed) {
444
- dep.computed.flags &= ~4;
453
+ dep.computed.flags &= -5;
445
454
  for (let l = dep.computed.deps; l; l = l.nextDep) {
446
455
  removeSub(l, true);
447
456
  }
@@ -529,6 +538,7 @@ class Link {
529
538
  }
530
539
  }
531
540
  class Dep {
541
+ // TODO isolatedDeclarations "__v_skip"
532
542
  constructor(computed2) {
533
543
  this.computed = computed2;
534
544
  this.version = 0;
@@ -537,6 +547,7 @@ class Dep {
537
547
  this.map = void 0;
538
548
  this.key = void 0;
539
549
  this.sc = 0;
550
+ this.__v_skip = true;
540
551
  if (!!(process.env.NODE_ENV !== "production")) {
541
552
  this.subsHead = void 0;
542
553
  }
@@ -1374,14 +1385,14 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1374
1385
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1375
1386
  return target;
1376
1387
  }
1377
- const existingProxy = proxyMap.get(target);
1378
- if (existingProxy) {
1379
- return existingProxy;
1380
- }
1381
1388
  const targetType = getTargetType(target);
1382
1389
  if (targetType === 0) {
1383
1390
  return target;
1384
1391
  }
1392
+ const existingProxy = proxyMap.get(target);
1393
+ if (existingProxy) {
1394
+ return existingProxy;
1395
+ }
1385
1396
  const proxy = new Proxy(
1386
1397
  target,
1387
1398
  targetType === 2 ? collectionHandlers : baseHandlers
@@ -1795,11 +1806,11 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
1795
1806
  oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1796
1807
  boundCleanup
1797
1808
  ];
1809
+ oldValue = newValue;
1798
1810
  call ? call(cb, 3, args) : (
1799
1811
  // @ts-expect-error
1800
1812
  cb(...args)
1801
1813
  );
1802
- oldValue = newValue;
1803
1814
  } finally {
1804
1815
  activeWatcher = currentWatcher;
1805
1816
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reactive-vscode/reactivity",
3
3
  "type": "module",
4
- "version": "0.2.20",
4
+ "version": "0.2.22",
5
5
  "description": "Full Vue Reactivity API without DOM",
6
6
  "author": "_Kerman <kermanx@qq.com>",
7
7
  "license": "MIT",
@@ -30,11 +30,11 @@
30
30
  "dist"
31
31
  ],
32
32
  "devDependencies": {
33
- "@vue/reactivity": "^3.5.13",
34
- "@vue/shared": "^3.5.13",
33
+ "@vue/reactivity": "^3.5.17",
34
+ "@vue/shared": "^3.5.17",
35
35
  "typescript": "^5.8.3",
36
36
  "vite": "^5.4.19",
37
- "vite-plugin-dts": "^4.5.3"
37
+ "vite-plugin-dts": "^4.5.4"
38
38
  },
39
39
  "scripts": {
40
40
  "typecheck": "tsc --noEmit",