@dougongjs/reactive 0.7.0 → 0.8.0

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.
@@ -0,0 +1,9 @@
1
+ /** Fails at module load before an unavailable Promise primitive reaches a lifecycle transition. */
2
+ export declare function assertPromiseRuntime(withResolvers: unknown): asserts withResolvers is typeof Promise.withResolvers;
3
+ /** Resolves the conventional protocol key without mutating the ambient Symbol constructor. */
4
+ export declare function resolveDisposalSymbol(native: symbol | undefined, name: "Symbol.dispose" | "Symbol.asyncDispose"): symbol;
5
+ /** Canonical runtime key for Dougong's synchronous disposal protocol. */
6
+ export declare const disposeSymbol: typeof Symbol.dispose;
7
+ /** Canonical runtime key for Dougong's asynchronous disposal protocol. */
8
+ export declare const asyncDisposeSymbol: typeof Symbol.asyncDispose;
9
+ //# sourceMappingURL=disposal-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disposal-runtime.d.ts","sourceRoot":"","sources":["../src/disposal-runtime.ts"],"names":[],"mappings":"AACA,mGAAmG;AACnG,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,OAAO,GACrB,OAAO,CAAC,aAAa,IAAI,OAAO,OAAO,CAAC,aAAa,CAIvD;AAED,8FAA8F;AAC9F,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,IAAI,EAAE,gBAAgB,GAAG,qBAAqB,UAG/C;AAID,yEAAyE;AACzE,eAAO,MAAM,aAAa,EAAE,OAAO,MAAM,CAAC,OAGhB,CAAC;AAC3B,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,EAAE,OAAO,MAAM,CAAC,YAGhB,CAAC"}
package/dist/index.js CHANGED
@@ -1,34 +1,40 @@
1
- function D(t) {
1
+ function R(t) {
2
2
  if (typeof t != "function")
3
3
  throw new Error("Unsupported JavaScript runtime: Promise.withResolvers is required");
4
4
  }
5
- function w(t, e) {
5
+ function y(t, e) {
6
6
  return t ?? Symbol.for(e);
7
7
  }
8
- D(Promise.withResolvers);
9
- const y = w(
8
+ R(Promise.withResolvers);
9
+ const m = y(
10
10
  Symbol.dispose,
11
11
  "Symbol.dispose"
12
- ), m = w(
12
+ ), g = y(
13
13
  Symbol.asyncDispose,
14
14
  "Symbol.asyncDispose"
15
15
  );
16
- function p(t, e) {
17
- if (g(t))
18
- throw Promise.resolve(t).catch(() => {
16
+ function h(t, e) {
17
+ const s = O(t);
18
+ if (s)
19
+ throw s.catch(() => {
19
20
  }), new TypeError(e);
20
21
  }
21
- function g(t) {
22
- return t === null || typeof t != "object" && typeof t != "function" ? !1 : typeof t.then == "function";
22
+ function O(t) {
23
+ if (t === null || typeof t != "object" && typeof t != "function") return;
24
+ const e = t.then;
25
+ if (typeof e == "function")
26
+ return Promise.resolve().then(
27
+ () => new Promise((s, i) => Reflect.apply(e, t, [s, i]))
28
+ );
23
29
  }
24
- let u = 0, l = !1;
25
- const f = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
26
- let h;
30
+ let f = 0, l = !1;
31
+ const p = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
32
+ let a;
27
33
  const d = /* @__PURE__ */ new WeakMap();
28
- function O(t) {
29
- return new R(t);
34
+ function S(t) {
35
+ return new z(t);
30
36
  }
31
- class R {
37
+ class z {
32
38
  #e;
33
39
  constructor(e) {
34
40
  this.#e = e, Object.freeze(this);
@@ -37,80 +43,80 @@ class R {
37
43
  const e = this.#e;
38
44
  this.#e = void 0, e?.();
39
45
  }
40
- [y]() {
46
+ [m]() {
41
47
  this.dispose();
42
48
  }
43
49
  }
44
- function S() {
50
+ function E() {
45
51
  if (l) return;
46
52
  const t = [];
47
53
  l = !0;
48
54
  try {
49
- for (; c.size || f.size; ) {
50
- const e = c.size ? c : f, s = e.values().next().value;
55
+ for (; c.size || p.size; ) {
56
+ const e = c.size ? c : p, s = e.values().next().value;
51
57
  e.delete(s);
52
58
  const i = s.listener;
53
59
  if (i)
54
60
  try {
55
- p(i(), "Signal subscribers must be synchronous");
61
+ h(i(), "Signal subscribers must be synchronous");
56
62
  } catch (n) {
57
63
  t.push(n);
58
64
  }
59
65
  }
60
66
  } finally {
61
- f.clear(), c.clear(), l = !1;
67
+ p.clear(), c.clear(), l = !1;
62
68
  }
63
- z(t);
69
+ P(t);
64
70
  }
65
71
  function k(t) {
66
72
  for (const e of t)
67
- (e.kind === "dependency" ? c : f).add(e);
68
- u || S();
73
+ (e.kind === "dependency" ? c : p).add(e);
74
+ f || E();
69
75
  }
70
76
  function v(t, e, s) {
71
- T(e);
77
+ C(e);
72
78
  const i = { kind: s, listener: e };
73
- return t.add(i), O(() => {
79
+ return t.add(i), S(() => {
74
80
  i.listener = void 0, t.delete(i);
75
81
  });
76
82
  }
77
- function z(t) {
83
+ function P(t) {
78
84
  if (t.length === 1) throw t[0];
79
85
  if (t.length > 1)
80
86
  throw new AggregateError(t, "Reactive subscribers failed");
81
87
  }
82
- function E(t) {
83
- h?.(t);
88
+ function T(t) {
89
+ a?.(t);
84
90
  }
85
- function I(t) {
91
+ function L(t) {
86
92
  if (typeof t != "function") throw new TypeError("batch() expects a function");
87
- u++;
93
+ f++;
88
94
  let e;
89
95
  try {
90
96
  const s = t();
91
- p(s, "Reactive batches must be synchronous"), e = { ok: !0, value: s };
97
+ h(s, "Reactive batches must be synchronous"), e = { ok: !0, value: s };
92
98
  } catch (s) {
93
99
  e = { ok: !1, error: s };
94
100
  } finally {
95
- u--;
101
+ f--;
96
102
  }
97
- if (!u)
103
+ if (!f)
98
104
  try {
99
- S();
105
+ E();
100
106
  } catch (s) {
101
107
  e = e.ok ? { ok: !1, error: s } : { ok: !1, error: new AggregateError([e.error, s], "Reactive batch failed") };
102
108
  }
103
109
  if (!e.ok) throw e.error;
104
110
  return e.value;
105
111
  }
106
- function L(t) {
112
+ function q(t) {
107
113
  let e = t, s = 0;
108
114
  const i = /* @__PURE__ */ new Set(), n = {
109
115
  get() {
110
- return E(n), e;
116
+ return T(n), e;
111
117
  },
112
118
  set(r) {
113
- if (h)
119
+ if (a)
114
120
  throw new TypeError("Computed signal calculations cannot write signals");
115
121
  Object.is(e, r) || (e = r, s++, k(i));
116
122
  },
@@ -127,7 +133,7 @@ function L(t) {
127
133
  subscribeInvalidation: (r) => v(i, r, "dependency")
128
134
  }), Object.freeze(n);
129
135
  }
130
- function q(t) {
136
+ function B(t) {
131
137
  if (typeof t != "function") throw new TypeError("computed() expects a function");
132
138
  return new j(t).view;
133
139
  }
@@ -138,7 +144,7 @@ class j {
138
144
  #n;
139
145
  #r = !1;
140
146
  #t = !0;
141
- #a = 0;
147
+ #c = 0;
142
148
  view;
143
149
  constructor(e) {
144
150
  this.#e = e, this.view = Object.freeze({
@@ -147,7 +153,7 @@ class j {
147
153
  }), d.set(this.view, this);
148
154
  }
149
155
  get version() {
150
- return this.#a;
156
+ return this.#c;
151
157
  }
152
158
  refresh() {
153
159
  if (this.#r) throw new TypeError("Circular computed signal");
@@ -159,9 +165,9 @@ class j {
159
165
  }
160
166
  }
161
167
  #o() {
162
- return this.refresh(), E(this.view), this.#c();
168
+ return this.refresh(), T(this.view), this.#a();
163
169
  }
164
- #c() {
170
+ #a() {
165
171
  const e = this.#n;
166
172
  if (e.phase === "error") throw e.error;
167
173
  return e.value;
@@ -170,15 +176,15 @@ class j {
170
176
  return this.#h(e, "dependency");
171
177
  }
172
178
  #h(e, s = "observer") {
173
- T(e);
179
+ C(e);
174
180
  const i = { kind: s, listener: e }, n = this.#s.size === 0;
175
181
  if (this.#s.add(i), n)
176
182
  try {
177
- this.refresh(), s === "observer" && this.#c(), this.#f();
183
+ this.refresh(), s === "observer" && this.#a(), this.#f();
178
184
  } catch (r) {
179
185
  throw this.#s.delete(i), this.#s.size || this.#u(), r;
180
186
  }
181
- return O(() => {
187
+ return S(() => {
182
188
  i.listener = void 0, this.#s.delete(i), this.#s.size || this.#u();
183
189
  });
184
190
  }
@@ -203,16 +209,16 @@ class j {
203
209
  }
204
210
  if (!this.#t) return;
205
211
  }
206
- const s = /* @__PURE__ */ new Set(), i = h;
207
- h = (r) => s.add(r);
212
+ const s = /* @__PURE__ */ new Set(), i = a;
213
+ a = (r) => s.add(r);
208
214
  let n;
209
215
  try {
210
216
  const r = this.#e();
211
- p(r, "Computed signal calculations must be synchronous"), n = { phase: "value", value: r };
217
+ h(r, "Computed signal calculations must be synchronous"), n = { phase: "value", value: r };
212
218
  } catch (r) {
213
219
  n = { phase: "error", error: r };
214
220
  } finally {
215
- h = i;
221
+ a = i;
216
222
  }
217
223
  for (const [r, o] of this.#i)
218
224
  s.has(r) || (o.subscription?.dispose(), this.#i.delete(r));
@@ -226,46 +232,48 @@ class j {
226
232
  };
227
233
  b.version = o.version, this.#i.set(r, b);
228
234
  }
229
- (!e || (n.phase === "value" ? e.phase !== "value" || !Object.is(e.value, n.value) : e.phase !== "error" || !Object.is(e.error, n.error))) && this.#a++, this.#n = n, this.#t = !1, this.#s.size && this.#f();
235
+ (!e || (n.phase === "value" ? e.phase !== "value" || !Object.is(e.value, n.value) : e.phase !== "error" || !Object.is(e.error, n.error))) && this.#c++, this.#n = n, this.#t = !1, this.#s.size && this.#f();
230
236
  }
231
237
  }
232
- function T(t) {
238
+ function C(t) {
233
239
  if (typeof t != "function")
234
240
  throw new TypeError("Signal subscriber must be a function");
235
241
  }
236
- class P {
242
+ class x {
237
243
  #e;
238
244
  #s;
239
245
  #i;
240
246
  #n = { present: !1 };
241
247
  #r = !1;
242
248
  #t;
243
- #a;
244
- #o;
245
249
  #c;
250
+ #o;
251
+ #a;
246
252
  constructor(e, s, i) {
247
253
  this.#e = { phase: "active", binding: { owner: e, source: s, observer: i } };
248
254
  }
249
255
  start() {
250
256
  const { owner: e, source: s } = this.#b(), i = s.subscribe(() => this.#p());
251
- x(i, "Readable.subscribe()"), this.#s = i, this.#v();
252
- const n = e.spawn((r) => this.#u(r));
253
- A(n), this.#t = n, n.result.then(
257
+ if (A(i, "Readable.subscribe()"), this.#e.phase !== "active")
258
+ throw w(i), new Error("Observation is not active");
259
+ this.#s = i, this.#v();
260
+ const n = e.spawn((o) => this.#u(o)), r = I(n);
261
+ this.#t = n, r.then(
254
262
  () => this.#y(n),
255
263
  () => this.#y(n)
256
264
  );
257
265
  }
258
266
  attachOwnerCleanup(e) {
259
- this.#a = e;
267
+ this.#c = e;
260
268
  }
261
269
  dispose() {
262
- if (this.#c) return this.#c;
270
+ if (this.#a) return this.#a;
263
271
  const e = Promise.withResolvers();
264
- return this.#c = e.promise, this.#a = void 0, this.#m("disposed"), this.#o?.(), this.#h().then(e.resolve, e.reject), e.promise;
272
+ return this.#a = e.promise, this.#c = void 0, this.#m("disposed"), this.#o?.(), this.#h().then(e.resolve, e.reject), e.promise;
265
273
  }
266
274
  async #h() {
267
275
  const e = [];
268
- if (await a(this.#w(), e), await a(this.#O(), e), await a(this.#d(), e), e.length === 1) throw e[0];
276
+ if (await this.#w(e), await u(this.#O(), e), await u(this.#d(), e), e.length === 1) throw e[0];
269
277
  if (e.length > 1) throw new AggregateError(e, "Observation cleanup failed");
270
278
  }
271
279
  #p() {
@@ -285,10 +293,10 @@ class P {
285
293
  try {
286
294
  for (; this.#e.phase === "active" && !e.aborted; )
287
295
  for (await this.#f(e); this.#e.phase === "active" && !e.aborted && this.#r; )
288
- this.#r = !1, await this.#l();
296
+ this.#r = !1, await this.#l(e);
289
297
  } catch (s) {
290
298
  if (this.#e.phase !== "active") throw s;
291
- await this.#k(s);
299
+ await this.#E(s);
292
300
  }
293
301
  }
294
302
  #f(e) {
@@ -309,26 +317,31 @@ class P {
309
317
  * replacement cannot leave a value marked as observed when nothing is
310
318
  * observing it.
311
319
  */
312
- async #l() {
313
- if (this.#e.phase !== "active") return;
314
- const e = this.#e.binding.source.get();
315
- if (this.#n.present && Object.is(e, this.#n.value)) return;
316
- const s = this.#d();
317
- s && await s.dispose(), this.#n = { present: !1 }, this.#e.phase === "active" && this.#v();
320
+ async #l(e) {
321
+ if (this.#e.phase !== "active" || e.aborted) return;
322
+ const s = this.#e.binding.source.get();
323
+ if (this.#n.present && Object.is(s, this.#n.value)) return;
324
+ const i = this.#d();
325
+ i && await i.dispose(), this.#n = { present: !1 }, !(this.#e.phase !== "active" || e.aborted) && this.#v();
318
326
  }
319
327
  #v() {
320
328
  const { owner: e, source: s } = this.#b(), i = e.lifetime("observation");
321
- C(i, "ObservationOwner.lifetime()"), this.#i = i;
329
+ D(i, "ObservationOwner.lifetime()"), this.#i = i;
322
330
  const n = s.get();
323
331
  this.#g(n, i), this.#e.phase === "active" && (this.#n = { present: !0, value: n });
324
332
  }
325
333
  #g(e, s) {
326
334
  const i = this.#b().observer(e, s);
327
- p(i, "Observers must be synchronous; use owner.spawn() for async work");
335
+ h(i, "Observers must be synchronous; use owner.spawn() for async work");
328
336
  }
329
- #w() {
330
- const e = this.#s;
331
- return this.#s = void 0, e;
337
+ async #w(e) {
338
+ const s = this.#s;
339
+ if (this.#s = void 0, !!s)
340
+ try {
341
+ w(s);
342
+ } catch (i) {
343
+ e.push(i);
344
+ }
332
345
  }
333
346
  #d() {
334
347
  const e = this.#i;
@@ -339,15 +352,15 @@ class P {
339
352
  return this.#t = void 0, e;
340
353
  }
341
354
  #S() {
342
- const e = this.#a;
343
- return this.#a = void 0, e;
355
+ const e = this.#c;
356
+ return this.#c = void 0, e;
344
357
  }
345
358
  #y(e) {
346
359
  this.#t === e && (this.#t = void 0);
347
360
  }
348
- async #k(e) {
361
+ async #E(e) {
349
362
  const s = [e];
350
- throw this.#m("stopped"), this.#o?.(), await a(this.#w(), s), await a(this.#d(), s), this.#t = void 0, await a(this.#S(), s), s.length === 1 ? s[0] : new AggregateError(s, "Observation stopped after a replacement failed");
363
+ throw this.#m("stopped"), this.#o?.(), await this.#w(s), await u(this.#d(), s), this.#t = void 0, await u(this.#S(), s), s.length === 1 ? s[0] : new AggregateError(s, "Observation stopped after a replacement failed");
351
364
  }
352
365
  #b() {
353
366
  const e = this.#e;
@@ -358,14 +371,14 @@ class P {
358
371
  this.#e = { phase: e }, this.#n = { present: !1 }, this.#r = !1;
359
372
  }
360
373
  }
361
- function B(t, e, s) {
374
+ function F(t, e, s) {
362
375
  if (!e || typeof e.get != "function" || typeof e.subscribe != "function")
363
376
  throw new TypeError("observe() expects a readable source");
364
377
  if (typeof s != "function") throw new TypeError("Observer must be a function");
365
378
  if (!t || typeof t.cleanup != "function" || typeof t.lifetime != "function" || typeof t.spawn != "function")
366
379
  throw new TypeError("observe() expects an observation owner");
367
- const i = new P(t, e, s), n = t.cleanup(() => i.dispose());
368
- C(n, "ObservationOwner.cleanup()"), i.attachOwnerCleanup(n);
380
+ const i = new x(t, e, s), n = t.cleanup(() => i.dispose());
381
+ D(n, "ObservationOwner.cleanup()"), i.attachOwnerCleanup(n);
369
382
  try {
370
383
  return i.start(), n;
371
384
  } catch (r) {
@@ -373,19 +386,24 @@ function B(t, e, s) {
373
386
  }), r;
374
387
  }
375
388
  }
376
- function x(t, e) {
377
- if (!t || typeof t.dispose != "function" || typeof t[y] != "function")
389
+ function A(t, e) {
390
+ if (!t || typeof t.dispose != "function" || typeof t[m] != "function")
378
391
  throw new TypeError(`${e} must return a Disposable`);
379
392
  }
380
- function C(t, e) {
381
- if (!t || typeof t.dispose != "function" || typeof t[m] != "function")
393
+ function D(t, e) {
394
+ if (!t || typeof t.dispose != "function" || typeof t[g] != "function")
382
395
  throw new TypeError(`${e} must return an AsyncDisposable`);
383
396
  }
384
- function A(t) {
385
- if (!t || typeof t.dispose != "function" || typeof t[m] != "function" || !g(t.result))
397
+ function I(t) {
398
+ const e = t && typeof t.dispose == "function" && typeof t[g] == "function" ? O(t.result) : void 0;
399
+ if (!e)
386
400
  throw new TypeError("ObservationOwner.spawn() must return an ObservationTask");
401
+ return e;
402
+ }
403
+ function w(t) {
404
+ h(t.dispose(), "Readable subscriptions must dispose synchronously");
387
405
  }
388
- async function a(t, e) {
406
+ async function u(t, e) {
389
407
  if (t)
390
408
  try {
391
409
  await t.dispose();
@@ -394,8 +412,8 @@ async function a(t, e) {
394
412
  }
395
413
  }
396
414
  export {
397
- I as batch,
398
- q as computed,
399
- B as observe,
400
- L as signal
415
+ L as batch,
416
+ B as computed,
417
+ F as observe,
418
+ q as signal
401
419
  };
@@ -1 +1 @@
1
- {"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../src/observe.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EAEpB,KAAK,QAAQ,EAEd,MAAM,YAAY,CAAC;AAwBpB,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,IAAI,CAAE,SAAQ,eAAe;IAChE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB,CAAC,KAAK,SAAS,eAAe,GAAG,eAAe;IAC/E,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,OAAO,KAAK,eAAe,CAAC;IAC9D,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,eAAe,CAAC,CAAC,CAAC,CAAC;CAC9F;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,KAAK,SAAS,eAAe,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;AA2N7F;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,SAAS,eAAe,EACtD,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAC9B,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EACnB,QAAQ,EAAE,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC,GAC3B,eAAe,CA2BjB"}
1
+ {"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../src/observe.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EAEpB,KAAK,QAAQ,EACd,MAAM,YAAY,CAAC;AAwBpB,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,IAAI,CAAE,SAAQ,eAAe;IAChE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB,CAAC,KAAK,SAAS,eAAe,GAAG,eAAe;IAC/E,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,OAAO,KAAK,eAAe,CAAC;IAC9D,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,eAAe,CAAC,CAAC,CAAC,CAAC;CAC9F;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,KAAK,SAAS,eAAe,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;AAqO7F;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,SAAS,eAAe,EACtD,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAC9B,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EACnB,QAAQ,EAAE,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC,GAC3B,eAAe,CA2BjB"}
@@ -1,9 +1,4 @@
1
- /** Fails at module load before an unavailable Promise primitive reaches an observation. */
2
- export declare function assertPromiseRuntime(withResolvers: unknown): asserts withResolvers is typeof Promise.withResolvers;
3
- /** Resolves the conventional protocol key without mutating the ambient Symbol constructor. */
4
- export declare function resolveDisposalSymbol(native: symbol | undefined, name: "Symbol.dispose" | "Symbol.asyncDispose"): symbol;
5
- export declare const disposeSymbol: typeof Symbol.dispose;
6
- export declare const asyncDisposeSymbol: typeof Symbol.asyncDispose;
1
+ export { assertPromiseRuntime, resolveDisposalSymbol, asyncDisposeSymbol, disposeSymbol, } from './disposal-runtime';
7
2
  export interface Disposable {
8
3
  dispose(): void;
9
4
  [Symbol.dispose](): void;
@@ -12,7 +7,6 @@ export interface AsyncDisposable {
12
7
  dispose(): Promise<void>;
13
8
  [Symbol.asyncDispose](): Promise<void>;
14
9
  }
15
- export type Resource = Disposable | AsyncDisposable;
16
10
  /** Structural observable protocol shared by signals, ContributionViews and diagnostics. */
17
11
  export interface Readable<T> {
18
12
  get(): T;
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAMA,2FAA2F;AAC3F,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,OAAO,GACrB,OAAO,CAAC,aAAa,IAAI,OAAO,OAAO,CAAC,aAAa,CAIvD;AAED,8FAA8F;AAC9F,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,IAAI,EAAE,gBAAgB,GAAG,qBAAqB,UAG/C;AAID,eAAO,MAAM,aAAa,EAAE,OAAO,MAAM,CAAC,OAGhB,CAAC;AAC3B,eAAO,MAAM,kBAAkB,EAAE,OAAO,MAAM,CAAC,YAGhB,CAAC;AAEhC,MAAM,WAAW,UAAU;IACzB,OAAO,IAAI,IAAI,CAAC;IAChB,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAED,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,eAAe,CAAC;AAEpD,2FAA2F;AAC3F,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,GAAG,IAAI,CAAC,CAAC;IACT,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,UAAU,CAAC;CAC7C"}
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,UAAU;IACzB,OAAO,IAAI,IAAI,CAAC;IAChB,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAED,2FAA2F;AAC3F,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,GAAG,IAAI,CAAC,CAAC;IACT,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,UAAU,CAAC;CAC7C"}
@@ -1,3 +1,3 @@
1
1
  export declare function assertSynchronous(value: unknown, message: string): void;
2
- export declare function isThenable(value: unknown): value is PromiseLike<unknown>;
2
+ export declare function captureThenable(value: unknown): Promise<unknown> | undefined;
3
3
  //# sourceMappingURL=sync-result.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sync-result.d.ts","sourceRoot":"","sources":["../src/sync-result.ts"],"names":[],"mappings":"AAaA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAQvE;AAID,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC,CAGxE"}
1
+ {"version":3,"file":"sync-result.d.ts","sourceRoot":"","sources":["../src/sync-result.ts"],"names":[],"mappings":"AASA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CASvE;AAKD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,CAO5E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dougongjs/reactive",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -47,6 +47,6 @@
47
47
  "access": "public"
48
48
  },
49
49
  "scripts": {
50
- "build": "vite build"
50
+ "build": "node ../../scripts/generate-internal.mjs && vite build"
51
51
  }
52
52
  }