async-reactivity 2.0.22 → 2.0.24

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/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # Purpose
2
+
3
+ This library is inspired by Vue.js implementation of reactivity. You can familiarize with the concept of reactivity [here](https://vuejs.org/guide/extras/reactivity-in-depth.html). Short excerpt:
4
+
5
+ > Reactivity is a programming paradigm that allows us to adjust to changes in a declarative manner.
6
+
7
+ However Vue.js reactivity is limited to synchronous computation. This library solves this limitation and supports both - synchronous and asynchronous computation.
8
+
9
+ You can familiarize with sample use [here](https://github.com/donatas-luciunas/async-reactivity-sample).
10
+
11
+ # Concepts
12
+
13
+ We refer to values of many variables as "state".
14
+
15
+ We refer to values of many reactive variables as "reactive state".
16
+
17
+ For **reactive state** to be **reactive** dependencies need to be tracked. So it is easier to think about reactive state as a dependency graph (for example A → B → C). Here A → B means:
18
+ * A depends on B
19
+ * B is [dependency](./src/dependency.ts)
20
+ * A is [dependent](./src/dependent.ts)
21
+
22
+ There are few types of reactive variables:
23
+
24
+ * [ref](./src/ref.ts)
25
+ * simply stores a given value (Vue.js `shallowRef` equivalent)
26
+ * can only be dependency (only incoming arrows)
27
+ * [computed](./src/computed.ts)
28
+ * defined by pure function (Vue.js `computed` equivalent)
29
+ * can be both - dependent and dependency (incoming and outgoing arrows)
30
+
31
+ To integrate state with reactive state you can use:
32
+ * [listener](./src/listener.ts)
33
+ * inherits `ref`
34
+ * can only be dependency (only incoming arrows)
35
+ * `start` function is called when listener gets first dependent
36
+ * it ensures value is updated
37
+ * `stop` function is called when listener loses last dependent
38
+ * [watcher](./src/watcher.ts)
39
+ * a function that is called when dependency changes
40
+ * can only be dependent (only outgoing arrows)
41
+
42
+ # Behavior
43
+
44
+ You can familiarize with behavior by reading tests.
package/lib/computed.js CHANGED
@@ -15,7 +15,7 @@ export default class Computed extends Tracker {
15
15
  getter;
16
16
  isEqual;
17
17
  state = ComputedState.Invalid;
18
- dependencies = new Map();
18
+ dependencies = new Map(); // boolean indicates whether value is up to date in regards to the dependency (false - up to date, true - needs update)
19
19
  computePromise;
20
20
  computePromiseActions;
21
21
  lastComputeAttemptPromise;
@@ -50,21 +50,14 @@ export default class Computed extends Tracker {
50
50
  }
51
51
  compute() {
52
52
  if (this.state === ComputedState.Uncertain) {
53
- for (const dependency of this.dependencies.keys()) {
54
- this.dependencies.set(dependency, true);
55
- }
56
- if ([...this.dependencies.keys()].every(d => {
57
- if (d instanceof Computed) {
58
- if (d.state === ComputedState.Valid) {
59
- return true;
60
- }
61
- else if (d.state === ComputedState.Uncertain) {
62
- d.value;
63
- return !this.dependencies.get(d);
64
- }
53
+ const upToDate = ![...this.dependencies.entries()].some(([d, needsUpdate]) => {
54
+ if (needsUpdate && d instanceof Computed && d.state === ComputedState.Uncertain) {
55
+ d.value;
56
+ return this.dependencies.get(d);
65
57
  }
66
- return false;
67
- })) {
58
+ return needsUpdate;
59
+ });
60
+ if (upToDate) {
68
61
  this.finalizeComputing();
69
62
  this.validateDependents();
70
63
  return this._value;
@@ -113,10 +106,13 @@ export default class Computed extends Tracker {
113
106
  }
114
107
  }
115
108
  innerTrackDependency(dependency) {
109
+ if (dependency === undefined) {
110
+ return undefined;
111
+ }
116
112
  if (this.dependents.has(dependency)) {
117
113
  throw new CircularDependencyError();
118
114
  }
119
- this.dependencies.set(dependency, true);
115
+ this.dependencies.set(dependency, false);
120
116
  dependency.addDependent(this);
121
117
  return dependency.value;
122
118
  }
@@ -127,19 +123,29 @@ export default class Computed extends Tracker {
127
123
  this.abortController = undefined;
128
124
  this.prepareComputePromise();
129
125
  }
130
- invalidate() {
126
+ invalidate(dependency) {
131
127
  if (this.state === ComputedState.Computing) {
132
128
  this.lastComputeAttemptPromise = undefined; // prevent finalizeComputing if it is in the event loop already
133
129
  Promise.resolve().then(this.compute.bind(this));
134
130
  }
135
131
  else if (this.state === ComputedState.Valid) {
136
132
  this.state = ComputedState.Uncertain;
133
+ if (dependency) {
134
+ this.dependencies.set(dependency, true);
135
+ }
136
+ else {
137
+ for (const dep of this.dependencies.keys()) {
138
+ this.dependencies.set(dep, true);
139
+ }
140
+ }
137
141
  super.invalidate();
138
142
  }
139
143
  }
140
144
  forceInvalidate() {
141
145
  this.invalidate();
142
- this.state = ComputedState.Invalid;
146
+ if (this.state !== ComputedState.Computing) {
147
+ this.state = ComputedState.Invalid;
148
+ }
143
149
  }
144
150
  validate(dependency) {
145
151
  this.dependencies.set(dependency, false);
@@ -130,6 +130,22 @@ describe('computed', function () {
130
130
  assert.strictEqual(c.value, 6);
131
131
  assert.strictEqual(gate, 2);
132
132
  });
133
+ it('compute and abort when forced', async function () {
134
+ let gate = 0;
135
+ const b = new Computed(async (_value, _previousValue, abortSignal) => {
136
+ await new Promise(resolve => setTimeout(resolve, 10));
137
+ if (abortSignal.aborted) {
138
+ gate++;
139
+ throw new Error();
140
+ }
141
+ return 5;
142
+ });
143
+ const v = b.value;
144
+ await new Promise(resolve => setTimeout(resolve, 5));
145
+ b.forceInvalidate();
146
+ assert.strictEqual(await v, 5);
147
+ assert.strictEqual(gate, 1);
148
+ });
133
149
  it('isEqual', function () {
134
150
  const a = new Ref(1);
135
151
  const b = new Computed((value) => {
package/lib/tracker.js CHANGED
@@ -9,7 +9,7 @@ export default class Tracker {
9
9
  }
10
10
  invalidate() {
11
11
  for (const dependent of [...this.dependents.keys()]) {
12
- dependent.invalidate();
12
+ dependent.invalidate(this);
13
13
  }
14
14
  }
15
15
  get value() {
package/lib/watcher.js CHANGED
@@ -34,6 +34,7 @@ export default class Watcher extends Tracker {
34
34
  });
35
35
  }
36
36
  validate() {
37
+ console.log('validate');
37
38
  this.state = WatchState.Valid;
38
39
  }
39
40
  dispose() {
@@ -74,4 +74,24 @@ describe('watcher', function () {
74
74
  assert.strictEqual(computedGate, 3);
75
75
  assert.strictEqual(watcherGate, 2);
76
76
  });
77
+ it('parallel compute', async function () {
78
+ const r = new Ref(5);
79
+ const c = new Computed((value) => value(r) + 1);
80
+ const c1 = new Computed((value) => value(c) + 1);
81
+ const c2 = new Computed((value) => value(c) + 2);
82
+ let gate1 = 0, gate2 = 0;
83
+ new Watcher(c1, () => {
84
+ gate1++;
85
+ });
86
+ new Watcher(c2, () => {
87
+ gate2++;
88
+ });
89
+ await new Promise(resolve => setTimeout(resolve, 10));
90
+ r.value = 6;
91
+ await new Promise(resolve => setTimeout(resolve, 10));
92
+ r.value = 7;
93
+ await new Promise(resolve => setTimeout(resolve, 10));
94
+ assert.strictEqual(gate1, 3);
95
+ assert.strictEqual(gate2, 3);
96
+ });
77
97
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "async-reactivity",
3
- "version": "2.0.22",
3
+ "version": "2.0.24",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "types/index.d.ts",
@@ -153,6 +153,24 @@ describe('computed', function () {
153
153
  assert.strictEqual(gate, 2);
154
154
  });
155
155
 
156
+ it('compute and abort when forced', async function () {
157
+ let gate = 0;
158
+ const b = new Computed(async (_value, _previousValue, abortSignal) => {
159
+ await new Promise(resolve => setTimeout(resolve, 10));
160
+ if (abortSignal.aborted) {
161
+ gate++;
162
+ throw new Error();
163
+ }
164
+ return 5;
165
+ });
166
+
167
+ const v = b.value;
168
+ await new Promise(resolve => setTimeout(resolve, 5));
169
+ b.forceInvalidate();
170
+ assert.strictEqual(await v, 5);
171
+ assert.strictEqual(gate, 1);
172
+ });
173
+
156
174
  it('isEqual', function() {
157
175
  const a = new Ref(1);
158
176
  const b = new Computed((value) => {
package/src/computed.ts CHANGED
@@ -5,7 +5,7 @@ import defaultIsEqual from "./defaultIsEqual.js";
5
5
  import { Deferrer } from "./deferrer.js";
6
6
  import { debounce } from 'lodash-es';
7
7
 
8
- export declare type TrackValue = <T>(dependency: Dependency<T>) => T;
8
+ export declare type TrackValue = (<T>(dependency: Dependency<T>) => T) & (<T>(dependency: Dependency<T> | undefined) => T | undefined);
9
9
  export declare type ComputeFunc<T> = (value: TrackValue, previousValue: T | undefined, abortSignal: AbortSignal) => T;
10
10
  export declare type ComputeFuncScoped<T1, T2> = (value: TrackValue, scope: T1, previousValue: T2 | undefined, abortSignal: AbortSignal) => T2;
11
11
 
@@ -22,8 +22,8 @@ export default class Computed<T> extends Tracker<T> implements Dependent, Depend
22
22
  getter: ComputeFunc<T>;
23
23
  isEqual: typeof defaultIsEqual<T>;
24
24
  private state = ComputedState.Invalid;
25
- private dependencies = new Map<Dependency<any>, boolean>();
26
- private computePromise?: Promise<any>;
25
+ private dependencies = new Map<Dependency<unknown>, boolean>(); // boolean indicates whether value is up to date in regards to the dependency (false - up to date, true - needs update)
26
+ private computePromise?: Promise<unknown>;
27
27
  private computePromiseActions?: { resolve: Function, reject: Function };
28
28
  private lastComputeAttemptPromise?: Promise<void>;
29
29
  private deferrer?: Deferrer;
@@ -63,20 +63,14 @@ export default class Computed<T> extends Tracker<T> implements Dependent, Depend
63
63
 
64
64
  private compute() {
65
65
  if (this.state === ComputedState.Uncertain) {
66
- for (const dependency of this.dependencies.keys()) {
67
- this.dependencies.set(dependency, true);
68
- }
69
- if ([...this.dependencies.keys()].every(d => {
70
- if (d instanceof Computed) {
71
- if (d.state === ComputedState.Valid) {
72
- return true;
73
- } else if (d.state === ComputedState.Uncertain) {
74
- d.value;
75
- return !this.dependencies.get(d);
76
- }
66
+ const upToDate = ![...this.dependencies.entries()].some(([d, needsUpdate]) => {
67
+ if (needsUpdate && d instanceof Computed && d.state === ComputedState.Uncertain) {
68
+ d.value;
69
+ return this.dependencies.get(d);
77
70
  }
78
- return false;
79
- })) {
71
+ return needsUpdate;
72
+ });
73
+ if (upToDate) {
80
74
  this.finalizeComputing();
81
75
  this.validateDependents();
82
76
  return this._value!;
@@ -127,16 +121,19 @@ export default class Computed<T> extends Tracker<T> implements Dependent, Depend
127
121
  }
128
122
  }
129
123
 
130
- private innerTrackDependency(this: Computed<T>, dependency: Dependency<any>) {
124
+ private innerTrackDependency(this: Computed<T>, dependency?: Dependency<unknown>) {
125
+ if (dependency === undefined) {
126
+ return undefined;
127
+ }
131
128
  if (this.dependents.has(dependency as any)) {
132
129
  throw new CircularDependencyError();
133
130
  }
134
- this.dependencies.set(dependency, true);
131
+ this.dependencies.set(dependency, false);
135
132
  dependency.addDependent(this);
136
133
  return dependency.value;
137
134
  }
138
135
 
139
- private trackDependency = this.innerTrackDependency.bind(this);
136
+ private trackDependency = this.innerTrackDependency.bind(this) as TrackValue;
140
137
 
141
138
  private finalizeComputing() {
142
139
  this.state = ComputedState.Valid;
@@ -145,22 +142,31 @@ export default class Computed<T> extends Tracker<T> implements Dependent, Depend
145
142
  this.prepareComputePromise();
146
143
  }
147
144
 
148
- public invalidate() {
145
+ public invalidate(dependency?: Dependency<unknown>) {
149
146
  if (this.state === ComputedState.Computing) {
150
147
  this.lastComputeAttemptPromise = undefined; // prevent finalizeComputing if it is in the event loop already
151
148
  Promise.resolve().then(this.compute.bind(this));
152
149
  } else if (this.state === ComputedState.Valid) {
153
150
  this.state = ComputedState.Uncertain;
151
+ if (dependency) {
152
+ this.dependencies.set(dependency, true);
153
+ } else {
154
+ for (const dep of this.dependencies.keys()) {
155
+ this.dependencies.set(dep, true);
156
+ }
157
+ }
154
158
  super.invalidate();
155
159
  }
156
160
  }
157
161
 
158
162
  public forceInvalidate() {
159
163
  this.invalidate();
160
- this.state = ComputedState.Invalid;
164
+ if (this.state !== ComputedState.Computing) {
165
+ this.state = ComputedState.Invalid;
166
+ }
161
167
  }
162
168
 
163
- public validate(dependency: Dependency<any>) {
169
+ public validate(dependency: Dependency<unknown>) {
164
170
  this.dependencies.set(dependency, false);
165
171
  }
166
172
 
package/src/deferrer.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export class Deferrer {
2
- private lastPromise?: Promise<any>;
2
+ private lastPromise?: Promise<unknown>;
3
3
 
4
4
  constructor(private readonly callback: Function) { }
5
5
 
6
- finally(promise: Promise<any>) {
6
+ finally(promise: Promise<unknown>) {
7
7
  const currentPromise = Promise.all([this.lastPromise, promise])
8
8
  .finally(() => {
9
9
  if (this.lastPromise === currentPromise) {
package/src/dependency.ts CHANGED
@@ -3,5 +3,5 @@ import Dependent from "./dependent.js";
3
3
  export default interface Dependency<T> {
4
4
  get value(): T;
5
5
  addDependent(dependent: Dependent): void;
6
- removeDependent(dependent: Dependent, promise?: Promise<any>): void;
6
+ removeDependent(dependent: Dependent, promise?: Promise<unknown>): void;
7
7
  }
package/src/dependent.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import Dependency from "./dependency.js";
2
2
 
3
3
  export default interface Dependent {
4
- invalidate(): void;
5
- validate(dependency: Dependency<any>): void;
4
+ invalidate(dependency?: Dependency<unknown>): void;
5
+ validate(dependency: Dependency<unknown>): void;
6
6
  dispose(): void;
7
7
  }
package/src/tracker.ts CHANGED
@@ -14,7 +14,7 @@ export default class Tracker<T> {
14
14
 
15
15
  public invalidate(): void {
16
16
  for (const dependent of [...this.dependents.keys()]) {
17
- dependent.invalidate();
17
+ dependent.invalidate(this);
18
18
  }
19
19
  }
20
20
 
@@ -79,4 +79,29 @@ describe('watcher', function () {
79
79
  assert.strictEqual(computedGate, 3);
80
80
  assert.strictEqual(watcherGate, 2);
81
81
  });
82
+
83
+ it('parallel compute', async function () {
84
+ const r = new Ref(5);
85
+ const c = new Computed((value) => value(r) + 1);
86
+ const c1 = new Computed((value) => value(c) + 1);
87
+ const c2 = new Computed((value) => value(c) + 2);
88
+ let gate1 = 0, gate2 = 0;
89
+
90
+ new Watcher(c1, () => {
91
+ gate1++;
92
+ });
93
+ new Watcher(c2, () => {
94
+ gate2++;
95
+ });
96
+ await new Promise(resolve => setTimeout(resolve, 10));
97
+
98
+ r.value = 6;
99
+ await new Promise(resolve => setTimeout(resolve, 10));
100
+
101
+ r.value = 7;
102
+ await new Promise(resolve => setTimeout(resolve, 10));
103
+
104
+ assert.strictEqual(gate1, 3);
105
+ assert.strictEqual(gate2, 3);
106
+ });
82
107
  });
package/src/watcher.ts CHANGED
@@ -43,6 +43,7 @@ export default class Watcher<T> extends Tracker<T> implements Dependent {
43
43
  }
44
44
 
45
45
  public validate() {
46
+ console.log('validate');
46
47
  this.state = WatchState.Valid;
47
48
  }
48
49
 
@@ -2,7 +2,7 @@ import Dependency from "./dependency.js";
2
2
  import Dependent from "./dependent.js";
3
3
  import Tracker from "./tracker.js";
4
4
  import defaultIsEqual from "./defaultIsEqual.js";
5
- export declare type TrackValue = <T>(dependency: Dependency<T>) => T;
5
+ export declare type TrackValue = (<T>(dependency: Dependency<T>) => T) & (<T>(dependency: Dependency<T> | undefined) => T | undefined);
6
6
  export declare type ComputeFunc<T> = (value: TrackValue, previousValue: T | undefined, abortSignal: AbortSignal) => T;
7
7
  export declare type ComputeFuncScoped<T1, T2> = (value: TrackValue, scope: T1, previousValue: T2 | undefined, abortSignal: AbortSignal) => T2;
8
8
  export default class Computed<T> extends Tracker<T> implements Dependent, Dependency<T> {
@@ -25,9 +25,9 @@ export default class Computed<T> extends Tracker<T> implements Dependent, Depend
25
25
  private innerTrackDependency;
26
26
  private trackDependency;
27
27
  private finalizeComputing;
28
- invalidate(): void;
28
+ invalidate(dependency?: Dependency<unknown>): void;
29
29
  forceInvalidate(): void;
30
- validate(dependency: Dependency<any>): void;
30
+ validate(dependency: Dependency<unknown>): void;
31
31
  private validateDependents;
32
32
  removeDependent(dependent: Dependent, promise?: Promise<void>): void;
33
33
  reset(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"computed.d.ts","sourceRoot":"","sources":["../src/computed.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAIjD,MAAM,CAAC,OAAO,MAAM,UAAU,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACrE,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AAyB;IACtC,OAAO,CAAC,YAAY,CAA2C;IAC/D,OAAO,CAAC,cAAc,CAAC,CAAmB;IAC1C,OAAO,CAAC,qBAAqB,CAAC,CAA0C;IACxE,OAAO,CAAC,yBAAyB,CAAC,CAAgB;IAClD,OAAO,CAAC,QAAQ,CAAC,CAAW;IAC5B,OAAO,CAAC,eAAe,CAAC,CAAkB;gBAE9B,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,4BAAoB,EAAE,UAAU,CAAC,EAAE,MAAM;IAepF,OAAO,CAAC,qBAAqB;IAS7B,IAAW,KAAK,IAAI,CAAC,CAMpB;IAED,OAAO,CAAC,OAAO;IAuCf,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,eAAe,CAAsD;IAE7E,OAAO,CAAC,iBAAiB;IAOlB,UAAU,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC;IAiB3C,eAAe;IAOf,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC;IAI/C,OAAO,CAAC,kBAAkB;IAMnB,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,gBAAoB,GAAG,IAAI;IAKxE,KAAK;IAQL,OAAO;CAGjB"}
@@ -2,6 +2,6 @@ export declare class Deferrer {
2
2
  private readonly callback;
3
3
  private lastPromise?;
4
4
  constructor(callback: Function);
5
- finally(promise: Promise<any>): void;
5
+ finally(promise: Promise<unknown>): void;
6
6
  }
7
7
  //# sourceMappingURL=deferrer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deferrer.d.ts","sourceRoot":"","sources":["../src/deferrer.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ;IAGL,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAFrC,OAAO,CAAC,WAAW,CAAC,CAAe;gBAEN,QAAQ,EAAE,QAAQ;IAE/C,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC;CAUhC"}
1
+ {"version":3,"file":"deferrer.d.ts","sourceRoot":"","sources":["../src/deferrer.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ;IAGL,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAFrC,OAAO,CAAC,WAAW,CAAC,CAAmB;gBAEV,QAAQ,EAAE,QAAQ;IAE/C,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;CAUpC"}
@@ -2,6 +2,6 @@ import Dependent from "./dependent.js";
2
2
  export default interface Dependency<T> {
3
3
  get value(): T;
4
4
  addDependent(dependent: Dependent): void;
5
- removeDependent(dependent: Dependent, promise?: Promise<any>): void;
5
+ removeDependent(dependent: Dependent, promise?: Promise<unknown>): void;
6
6
  }
7
7
  //# sourceMappingURL=dependency.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dependency.d.ts","sourceRoot":"","sources":["../src/dependency.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAEvC,MAAM,CAAC,OAAO,WAAW,UAAU,CAAC,CAAC;IACjC,IAAI,KAAK,IAAI,CAAC,CAAC;IACf,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IACzC,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;CACvE"}
1
+ {"version":3,"file":"dependency.d.ts","sourceRoot":"","sources":["../src/dependency.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAEvC,MAAM,CAAC,OAAO,WAAW,UAAU,CAAC,CAAC;IACjC,IAAI,KAAK,IAAI,CAAC,CAAC;IACf,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IACzC,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;CAC3E"}
@@ -1,7 +1,7 @@
1
1
  import Dependency from "./dependency.js";
2
2
  export default interface Dependent {
3
- invalidate(): void;
4
- validate(dependency: Dependency<any>): void;
3
+ invalidate(dependency?: Dependency<unknown>): void;
4
+ validate(dependency: Dependency<unknown>): void;
5
5
  dispose(): void;
6
6
  }
7
7
  //# sourceMappingURL=dependent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dependent.d.ts","sourceRoot":"","sources":["../src/dependent.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,MAAM,CAAC,OAAO,WAAW,SAAS;IAC9B,UAAU,IAAI,IAAI,CAAC;IACnB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAC5C,OAAO,IAAI,IAAI,CAAC;CACnB"}
1
+ {"version":3,"file":"dependent.d.ts","sourceRoot":"","sources":["../src/dependent.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,MAAM,CAAC,OAAO,WAAW,SAAS;IAC9B,UAAU,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IACnD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAChD,OAAO,IAAI,IAAI,CAAC;CACnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../src/watcher.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,OAAO,MAAM,cAAc,CAAC;AAOnC,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;AAE3D,MAAM,CAA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