mutts 1.0.7 → 1.0.9

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.
Files changed (191) hide show
  1. package/README.md +72 -17
  2. package/dist/browser.cjs +3111 -0
  3. package/dist/browser.cjs.map +1 -0
  4. package/dist/browser.d.ts +1391 -1
  5. package/dist/browser.esm.js +264 -35
  6. package/dist/browser.esm.js.map +1 -1
  7. package/dist/chunks/async-browser-lvzLOCgk.cjs +297 -0
  8. package/dist/chunks/async-browser-lvzLOCgk.cjs.map +1 -0
  9. package/dist/chunks/async-core-CRLKP3l-.cjs +29 -0
  10. package/dist/chunks/async-core-CRLKP3l-.cjs.map +1 -0
  11. package/dist/chunks/async-node-C3DeIb0y.cjs +96 -0
  12. package/dist/chunks/async-node-C3DeIb0y.cjs.map +1 -0
  13. package/dist/chunks/index-2vea86wD.esm.js +3011 -0
  14. package/dist/chunks/index-2vea86wD.esm.js.map +1 -0
  15. package/dist/chunks/index-CtA2AWl3.esm.js +4376 -0
  16. package/dist/chunks/index-CtA2AWl3.esm.js.map +1 -0
  17. package/dist/chunks/index-VTO-b2vR.cjs +4461 -0
  18. package/dist/chunks/index-VTO-b2vR.cjs.map +1 -0
  19. package/dist/debug/debug.d.ts +122 -0
  20. package/dist/debug/debug.d.ts.map +1 -0
  21. package/dist/debug/index.d.ts +4 -0
  22. package/dist/debug/index.d.ts.map +1 -0
  23. package/dist/debug/lineage-panel.d.ts +5 -0
  24. package/dist/debug/lineage-panel.d.ts.map +1 -0
  25. package/dist/debug/lineage.d.ts +79 -0
  26. package/dist/debug/lineage.d.ts.map +1 -0
  27. package/dist/debug.cjs +35 -0
  28. package/dist/debug.cjs.map +1 -0
  29. package/dist/debug.d.ts +209 -0
  30. package/dist/debug.esm.js +2 -0
  31. package/dist/debug.esm.js.map +1 -0
  32. package/dist/devtools/devtool/devtools.d.ts +1 -0
  33. package/dist/devtools/devtool/devtools.d.ts.map +1 -0
  34. package/dist/devtools/devtool/panel.d.ts +2 -0
  35. package/dist/devtools/devtool/panel.d.ts.map +1 -0
  36. package/dist/index.d.ts +1 -0
  37. package/dist/mutts.umd.js +1 -1
  38. package/dist/mutts.umd.js.map +1 -1
  39. package/dist/mutts.umd.min.js +1 -1
  40. package/dist/mutts.umd.min.js.map +1 -1
  41. package/dist/node.cjs +107 -0
  42. package/dist/node.cjs.map +1 -0
  43. package/dist/node.d.ts +2 -2
  44. package/dist/node.esm.js +86 -33
  45. package/dist/node.esm.js.map +1 -1
  46. package/dist/src/async/browser.d.ts +2 -0
  47. package/dist/src/async/browser.d.ts.map +1 -0
  48. package/dist/src/async/index.d.ts +19 -0
  49. package/dist/src/async/index.d.ts.map +1 -0
  50. package/dist/src/async/node.d.ts +2 -0
  51. package/dist/src/async/node.d.ts.map +1 -0
  52. package/dist/src/decorator.d.ts +106 -0
  53. package/dist/src/decorator.d.ts.map +1 -0
  54. package/dist/src/destroyable.d.ts +87 -0
  55. package/dist/src/destroyable.d.ts.map +1 -0
  56. package/dist/src/entry-browser.d.ts +3 -0
  57. package/dist/src/entry-browser.d.ts.map +1 -0
  58. package/dist/src/entry-node.d.ts +3 -0
  59. package/dist/src/entry-node.d.ts.map +1 -0
  60. package/dist/src/eventful.d.ts +20 -0
  61. package/dist/src/eventful.d.ts.map +1 -0
  62. package/dist/src/flavored.d.ts +33 -0
  63. package/dist/src/flavored.d.ts.map +1 -0
  64. package/dist/src/index.d.ts +14 -0
  65. package/dist/src/index.d.ts.map +1 -0
  66. package/dist/src/indexable.d.ts +243 -0
  67. package/dist/src/indexable.d.ts.map +1 -0
  68. package/dist/src/introspection.d.ts +27 -0
  69. package/dist/src/introspection.d.ts.map +1 -0
  70. package/dist/src/iterableWeak.d.ts +53 -0
  71. package/dist/src/iterableWeak.d.ts.map +1 -0
  72. package/dist/src/mixins.d.ts +25 -0
  73. package/dist/src/mixins.d.ts.map +1 -0
  74. package/dist/src/promiseChain.d.ts +20 -0
  75. package/dist/src/promiseChain.d.ts.map +1 -0
  76. package/dist/src/reactive/array.d.ts +48 -0
  77. package/dist/src/reactive/array.d.ts.map +1 -0
  78. package/dist/src/reactive/buffer.d.ts +120 -0
  79. package/dist/src/reactive/buffer.d.ts.map +1 -0
  80. package/dist/src/reactive/change.d.ts +29 -0
  81. package/dist/src/reactive/change.d.ts.map +1 -0
  82. package/dist/src/reactive/deep-touch.d.ts +28 -0
  83. package/dist/src/reactive/deep-touch.d.ts.map +1 -0
  84. package/dist/src/reactive/deep-watch-state.d.ts +25 -0
  85. package/dist/src/reactive/deep-watch-state.d.ts.map +1 -0
  86. package/dist/src/reactive/deep-watch.d.ts +20 -0
  87. package/dist/src/reactive/deep-watch.d.ts.map +1 -0
  88. package/dist/src/reactive/describe.d.ts +12 -0
  89. package/dist/src/reactive/describe.d.ts.map +1 -0
  90. package/dist/src/reactive/effect-context.d.ts +34 -0
  91. package/dist/src/reactive/effect-context.d.ts.map +1 -0
  92. package/dist/src/reactive/effects.d.ts +164 -0
  93. package/dist/src/reactive/effects.d.ts.map +1 -0
  94. package/dist/src/reactive/index.d.ts +19 -0
  95. package/dist/src/reactive/index.d.ts.map +1 -0
  96. package/dist/src/reactive/map.d.ts +28 -0
  97. package/dist/src/reactive/map.d.ts.map +1 -0
  98. package/dist/src/reactive/memoize.d.ts +28 -0
  99. package/dist/src/reactive/memoize.d.ts.map +1 -0
  100. package/dist/src/reactive/non-reactive-state.d.ts +9 -0
  101. package/dist/src/reactive/non-reactive-state.d.ts.map +1 -0
  102. package/dist/src/reactive/non-reactive.d.ts +11 -0
  103. package/dist/src/reactive/non-reactive.d.ts.map +1 -0
  104. package/dist/src/reactive/project.d.ts +40 -0
  105. package/dist/src/reactive/project.d.ts.map +1 -0
  106. package/dist/src/reactive/proxy-state.d.ts +8 -0
  107. package/dist/src/reactive/proxy-state.d.ts.map +1 -0
  108. package/dist/src/reactive/proxy.d.ts +23 -0
  109. package/dist/src/reactive/proxy.d.ts.map +1 -0
  110. package/dist/src/reactive/record.d.ts +115 -0
  111. package/dist/src/reactive/record.d.ts.map +1 -0
  112. package/dist/src/reactive/register.d.ts +125 -0
  113. package/dist/src/reactive/register.d.ts.map +1 -0
  114. package/dist/src/reactive/registry.d.ts +21 -0
  115. package/dist/src/reactive/registry.d.ts.map +1 -0
  116. package/dist/src/reactive/set.d.ts +26 -0
  117. package/dist/src/reactive/set.d.ts.map +1 -0
  118. package/dist/src/reactive/tracking.d.ts +7 -0
  119. package/dist/src/reactive/tracking.d.ts.map +1 -0
  120. package/dist/src/reactive/types.d.ts +424 -0
  121. package/dist/src/reactive/types.d.ts.map +1 -0
  122. package/dist/src/reactive/watch.d.ts +48 -0
  123. package/dist/src/reactive/watch.d.ts.map +1 -0
  124. package/dist/src/std-decorators.d.ts +45 -0
  125. package/dist/src/std-decorators.d.ts.map +1 -0
  126. package/dist/src/utils.d.ts +49 -0
  127. package/dist/src/utils.d.ts.map +1 -0
  128. package/dist/src/zone.d.ts +40 -0
  129. package/dist/src/zone.d.ts.map +1 -0
  130. package/dist/types-DaHFfhlN.d.ts +414 -0
  131. package/docs/ai/api-reference.md +1 -1
  132. package/docs/ai/manual.md +443 -17
  133. package/docs/events.md +57 -2
  134. package/docs/flavored.md +210 -0
  135. package/docs/reactive/advanced.md +2 -3
  136. package/docs/reactive/attend.md +143 -0
  137. package/docs/reactive/collections.md +55 -0
  138. package/docs/reactive/core.md +120 -4
  139. package/docs/reactive/debugging.md +8 -10
  140. package/docs/reactive/describe.md +85 -0
  141. package/docs/reactive/error-handling.md +121 -0
  142. package/docs/reactive/project.md +1 -1
  143. package/docs/reactive/scan.md +215 -0
  144. package/docs/reactive.md +2 -0
  145. package/docs/std-decorators.md +171 -52
  146. package/docs/zone.md +9 -6
  147. package/package.json +44 -27
  148. package/src/async/browser.ts +277 -41
  149. package/src/async/index.ts +23 -4
  150. package/src/async/node.ts +78 -32
  151. package/src/entry-browser.ts +5 -0
  152. package/src/entry-node.ts +5 -0
  153. package/src/eventful.ts +82 -49
  154. package/src/flavored.ts +106 -0
  155. package/src/index.d.ts +12 -9
  156. package/src/index.ts +2 -1
  157. package/src/introspection.ts +1 -1
  158. package/src/reactive/array.ts +160 -80
  159. package/src/reactive/buffer.ts +187 -27
  160. package/src/reactive/change.ts +16 -23
  161. package/src/reactive/deep-touch.ts +19 -14
  162. package/src/reactive/deep-watch-state.ts +3 -3
  163. package/src/reactive/deep-watch.ts +7 -4
  164. package/src/reactive/describe.ts +39 -0
  165. package/src/reactive/effect-context.ts +71 -6
  166. package/src/reactive/effects.ts +445 -393
  167. package/src/reactive/index.ts +12 -14
  168. package/src/reactive/map.ts +8 -24
  169. package/src/reactive/memoize.ts +26 -3
  170. package/src/reactive/project.md +107 -0
  171. package/src/reactive/project.ts +48 -71
  172. package/src/reactive/proxy.ts +21 -3
  173. package/src/reactive/record.ts +30 -45
  174. package/src/reactive/register.ts +138 -19
  175. package/src/reactive/registry.ts +22 -9
  176. package/src/reactive/set.ts +7 -20
  177. package/src/reactive/tracking.ts +9 -12
  178. package/src/reactive/types.ts +104 -24
  179. package/src/reactive/{interface.ts → watch.ts} +29 -59
  180. package/src/std-decorators.ts +56 -17
  181. package/src/utils.ts +3 -4
  182. package/src/zone.ts +43 -28
  183. package/dist/browser.js +0 -161
  184. package/dist/browser.js.map +0 -1
  185. package/dist/chunks/index-BFYK02LG.js +0 -6378
  186. package/dist/chunks/index-BFYK02LG.js.map +0 -1
  187. package/dist/chunks/index-CNR6QRUl.esm.js +0 -6291
  188. package/dist/chunks/index-CNR6QRUl.esm.js.map +0 -1
  189. package/dist/node.js +0 -136
  190. package/dist/node.js.map +0 -1
  191. package/src/reactive/debug.ts +0 -517
package/dist/node.cjs ADDED
@@ -0,0 +1,107 @@
1
+ 'use strict';
2
+
3
+ require('./chunks/async-node-C3DeIb0y.cjs');
4
+ var browser = require('./browser.cjs');
5
+ var debug = require('./chunks/index-VTO-b2vR.cjs');
6
+ var asyncCore = require('./chunks/async-core-CRLKP3l-.cjs');
7
+ require('node:async_hooks');
8
+ require('./chunks/async-browser-lvzLOCgk.cjs');
9
+
10
+
11
+
12
+ exports.ArrayReadForward = browser.ArrayReadForward;
13
+ exports.Destroyable = browser.Destroyable;
14
+ exports.DestructionError = browser.DestructionError;
15
+ exports.Eventful = browser.Eventful;
16
+ exports.Indexable = browser.Indexable;
17
+ exports.Register = browser.Register;
18
+ exports.allocated = browser.allocated;
19
+ exports.allocatedValues = browser.allocatedValues;
20
+ exports.attend = browser.attend;
21
+ exports.cache = browser.cache;
22
+ exports.cached = browser.cached;
23
+ exports.callOnGC = browser.callOnGC;
24
+ exports.chainPromise = browser.chainPromise;
25
+ exports.debounce = browser.debounce;
26
+ exports.deepWatch = browser.deepWatch;
27
+ exports.deprecated = browser.deprecated;
28
+ exports.describe = browser.describe;
29
+ exports.descriptor = browser.descriptor;
30
+ exports.destructor = browser.destructor;
31
+ exports.forwardArray = browser.forwardArray;
32
+ exports.getActiveProjection = browser.getActiveProjection;
33
+ exports.getAt = browser.getAt;
34
+ exports.isCached = browser.isCached;
35
+ exports.lift = browser.lift;
36
+ exports.memoize = browser.memoize;
37
+ exports.organize = browser.organize;
38
+ exports.organized = browser.organized;
39
+ exports.profileInfo = browser.profileInfo;
40
+ exports.project = browser.project;
41
+ exports.register = browser.register;
42
+ exports.scan = browser.scan;
43
+ exports.setAt = browser.setAt;
44
+ exports.throttle = browser.throttle;
45
+ exports.unreactive = browser.unreactive;
46
+ exports.watch = browser.watch;
47
+ exports.AZone = debug.AZone;
48
+ exports.DecoratorError = debug.DecoratorError;
49
+ exports.FoolProof = debug.FoolProof;
50
+ exports.IterableWeakMap = debug.IterableWeakMap;
51
+ exports.IterableWeakSet = debug.IterableWeakSet;
52
+ exports.ReactiveBase = debug.ReactiveBase;
53
+ exports.ReactiveError = debug.ReactiveError;
54
+ Object.defineProperty(exports, "ReactiveErrorCode", {
55
+ enumerable: true,
56
+ get: function () { return debug.ReactiveErrorCode; }
57
+ });
58
+ exports.Zone = debug.Zone;
59
+ exports.ZoneAggregator = debug.ZoneAggregator;
60
+ exports.ZoneHistory = debug.ZoneHistory;
61
+ exports.addBatchCleanup = debug.addBatchCleanup;
62
+ exports.arrayEquals = debug.arrayEquals;
63
+ exports.asyncZone = debug.asyncZone;
64
+ exports.atomic = debug.atomic;
65
+ exports.biDi = debug.biDi;
66
+ exports.cleanedBy = debug.cleanedBy;
67
+ exports.cleanup = debug.cleanup;
68
+ exports.contentRef = debug.contentRef;
69
+ exports.createFlavor = debug.createFlavor;
70
+ exports.decorator = debug.decorator;
71
+ exports.deepCompare = debug.deepCompare;
72
+ exports.defer = debug.defer;
73
+ exports.derived = debug.derived;
74
+ exports.effect = debug.effect;
75
+ exports.effectAggregator = debug.effectAggregator;
76
+ exports.flavorOptions = debug.flavorOptions;
77
+ exports.flavored = debug.flavored;
78
+ exports.getActivationLog = debug.getActivationLog;
79
+ exports.getActiveEffect = debug.getActiveEffect;
80
+ exports.getState = debug.getState;
81
+ exports.immutables = debug.immutables;
82
+ exports.isConstructor = debug.isConstructor;
83
+ exports.isNonReactive = debug.isNonReactive;
84
+ exports.isOwnAccessor = debug.isOwnAccessor;
85
+ exports.isReactive = debug.isReactive;
86
+ exports.legacyDecorator = debug.legacyDecorator;
87
+ exports.mixin = debug.mixin;
88
+ exports.modernDecorator = debug.modernDecorator;
89
+ exports.named = debug.named;
90
+ exports.onEffectThrow = debug.onEffectThrow;
91
+ exports.onEffectTrigger = debug.onEffectTrigger;
92
+ exports.reactive = debug.reactive;
93
+ exports.reactiveOptions = debug.options;
94
+ exports.registerNativeReactivity = debug.registerNativeReactivity;
95
+ exports.renamed = debug.renamed;
96
+ exports.reset = debug.reset;
97
+ exports.root = debug.root;
98
+ exports.tag = debug.tag;
99
+ exports.touched = debug.touched;
100
+ exports.touched1 = debug.touched1;
101
+ exports.untracked = debug.untracked;
102
+ exports.unwrap = debug.unwrap;
103
+ exports.zip = debug.zip;
104
+ exports.asyncHook = asyncCore.asyncHook;
105
+ exports.asyncHooks = asyncCore.asyncHooks;
106
+ exports.hooks = asyncCore.hooks;
107
+ //# sourceMappingURL=node.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/node.d.ts CHANGED
@@ -1,2 +1,2 @@
1
-
2
- export { };
1
+ export { ArrayReadForward, ContextManager, Decorator, DecoratorDescription, DecoratorError, DecoratorFactory, Destroyable, DestructionError, Eventful, EventsBase, FoolProof, GenericClassDecorator, Hook, Indexable, IterableWeakMap, IterableWeakSet, LegacyClassDecorator, LegacyPropertyDecorator, Memoizable, MixinClass, MixinFunction, ModernAccessorDecorator, ModernClassDecorator, ModernGetterDecorator, ModernMethodDecorator, ModernSetterDecorator, PromiseChain, ReactiveBase, Register, Restorer, ScanResult, addBatchCleanup, allocated, allocatedValues, arrayEquals, asyncHook, asyncHooks, atomic, attend, biDi, cache, cached, callOnGC, chainPromise, cleanedBy, contentRef, debounce, decorator, deepCompare, deepWatch, defer, deprecated, derived, describe, descriptor, destructor, effect, effectAggregator, forwardArray, getActivationLog, getActiveEffect, getActiveProjection, getAt, getState, hooks, immutables, isCached, isConstructor, isNonReactive, isOwnAccessor, isReactive, legacyDecorator, lift, memoize, mixin, modernDecorator, named, onEffectThrow, onEffectTrigger, organize, organized, profileInfo, project, reactive, register, registerNativeReactivity, renamed, reset, root, scan, setAt, tag, throttle, touched, touched1, unreactive, untracked, unwrap, watch, zip } from './browser.js';
2
+ export { A as AZone, e as DependencyAccess, b as EffectCleanup, g as EffectOptions, E as EffectTrigger, a as Evolution, F as FunctionWrapper, R as ReactiveError, h as ReactiveErrorCode, S as ScopedCallback, i as Zone, Z as ZoneAggregator, j as ZoneHistory, k as asyncZone, c as cleanup, o as reactiveOptions } from './types-DaHFfhlN.js';
package/dist/node.esm.js CHANGED
@@ -1,45 +1,98 @@
1
1
  import { createHook } from 'node:async_hooks';
2
- import { a as asyncHooks } from './chunks/index-CNR6QRUl.esm.js';
3
- export { A as AZone, b as ArrayReadForward, D as DecoratorError, c as Destroyable, d as DestructionError, E as Eventful, F as FoolProof, I as Indexable, e as IterableWeakMap, f as IterableWeakSet, R as ReactiveBase, g as ReactiveError, h as ReactiveErrorCode, i as Register, Z as Zone, j as ZoneAggregator, k as ZoneHistory, l as addBatchCleanup, m as allocated, n as allocatedValues, o as arrayEquals, p as asyncZone, q as atomic, r as biDi, s as buildReactivityGraph, t as cache, u as cached, v as callOnGC, w as chainPromise, x as cleanedBy, y as cleanup, z as contentRef, B as debounce, C as decorator, G as deepCompare, H as deepWatch, J as defer, K as deprecated, L as derived, M as describe, N as destructor, O as effect, P as enableDevTools, Q as forwardArray, S as getActivationLog, T as getActiveProjection, U as getAt, V as getState, W as immutables, X as isCached, Y as isConstructor, _ as isDevtoolsEnabled, $ as isNonReactive, a0 as isOwnAccessor, a1 as isReactive, a2 as legacyDecorator, a3 as memoize, a4 as mixin, a5 as modernDecorator, a6 as named, a7 as organize, a8 as organized, a9 as profileInfo, aa as project, ab as reactive, ac as reactiveOptions, ad as register, ae as registerEffectForDebug, af as registerNativeReactivity, ag as registerObjectForDebug, ah as renamed, ai as root, aj as scan, ak as setAt, al as setEffectName, am as setObjectName, an as tag, ao as throttle, ap as touched, aq as touched1, ar as trackEffect, as as unreactive, at as untracked, au as unwrap, av as watch, aw as zip } from './chunks/index-CNR6QRUl.esm.js';
2
+ import { h as hooks } from './chunks/index-CtA2AWl3.esm.js';
3
+ export { A as AZone, D as DecoratorError, F as FoolProof, I as IterableWeakMap, b as IterableWeakSet, R as ReactiveBase, c as ReactiveError, d as ReactiveErrorCode, Z as Zone, e as ZoneAggregator, f as ZoneHistory, g as addBatchCleanup, i as arrayEquals, j as asyncHook, a as asyncHooks, k as asyncZone, l as atomic, m as biDi, n as cleanedBy, o as cleanup, p as contentRef, q as createFlavor, r as decorator, s as deepCompare, t as defer, u as derived, v as effect, w as effectAggregator, x as flavorOptions, y as flavored, z as getActivationLog, B as getActiveEffect, C as getState, E as immutables, G as isConstructor, H as isNonReactive, J as isOwnAccessor, K as isReactive, L as legacyDecorator, M as mixin, N as modernDecorator, O as named, P as onEffectThrow, Q as onEffectTrigger, S as reactive, T as reactiveOptions, U as registerNativeReactivity, V as renamed, W as reset, X as root, Y as tag, _ as touched, $ as touched1, a0 as untracked, a1 as unwrap, a2 as zip } from './chunks/index-CtA2AWl3.esm.js';
4
+ export { A as ArrayReadForward, D as Destroyable, a as DestructionError, E as Eventful, I as Indexable, R as Register, b as allocated, c as allocatedValues, d as attend, e as cache, f as cached, g as callOnGC, h as chainPromise, i as debounce, j as deepWatch, k as deprecated, l as describe, m as descriptor, n as destructor, o as forwardArray, p as getActiveProjection, q as getAt, r as isCached, s as lift, t as memoize, u as organize, v as organized, w as profileInfo, x as project, y as register, z as scan, B as setAt, C as throttle, F as unreactive, G as watch } from './chunks/index-2vea86wD.esm.js';
4
5
 
5
- const hooks = new Set();
6
- const restorersPerAsyncId = new Map();
7
- const undoersPerAsyncId = new Map();
8
- createHook({
9
- init(asyncId) {
10
- const restorers = new Set();
11
- for (const hook of hooks) {
12
- restorers.add(hook());
6
+ // 1. Generic async_hooks implementation for Hooks
7
+ // This maintains support for 'asyncHooks.addHook' for generic use cases.
8
+ const contexts = new Map();
9
+ const activeUndoers = new Map();
10
+ // Helper to capture current hooks state
11
+ function captureRestorers() {
12
+ if (hooks.size === 0)
13
+ return [];
14
+ const restorers = [];
15
+ for (const h of hooks) {
16
+ const r = h();
17
+ if (r)
18
+ restorers.push(r);
19
+ }
20
+ return restorers;
21
+ }
22
+ // Manual Wrap function to handle Promise callbacks
23
+ function wrap(fn) {
24
+ if (typeof fn !== 'function')
25
+ return fn;
26
+ const restorers = captureRestorers();
27
+ if (restorers.length === 0)
28
+ return fn;
29
+ return function (...args) {
30
+ const undoers = [];
31
+ for (const restore of restorers) {
32
+ const u = restore();
33
+ if (u)
34
+ undoers.push(u);
35
+ }
36
+ try {
37
+ return fn.apply(this, args);
38
+ }
39
+ finally {
40
+ for (let i = undoers.length - 1; i >= 0; i--)
41
+ undoers[i]();
13
42
  }
14
- restorersPerAsyncId.set(asyncId, restorers);
43
+ };
44
+ }
45
+ const hook = createHook({
46
+ init(asyncId, _type, _triggerId, _resource) {
47
+ // Used for native resources like Timers
48
+ const restorers = captureRestorers();
49
+ if (restorers.length > 0)
50
+ contexts.set(asyncId, restorers);
15
51
  },
16
52
  before(asyncId) {
17
- const restorers = restorersPerAsyncId.get(asyncId);
18
- if (restorers) {
19
- const undoers = new Set();
20
- for (const restore of restorers) {
21
- undoers.add(restore());
22
- }
23
- undoersPerAsyncId.set(asyncId, undoers);
53
+ const restorers = contexts.get(asyncId);
54
+ if (!restorers)
55
+ return;
56
+ const undoers = [];
57
+ for (const restore of restorers) {
58
+ const u = restore();
59
+ if (u)
60
+ undoers.push(u);
24
61
  }
62
+ if (undoers.length > 0)
63
+ activeUndoers.set(asyncId, undoers);
25
64
  },
26
65
  after(asyncId) {
27
- const undoers = undoersPerAsyncId.get(asyncId);
28
- if (undoers) {
29
- for (const undo of undoers)
30
- undo();
31
- undoersPerAsyncId.delete(asyncId);
32
- }
66
+ const undoers = activeUndoers.get(asyncId);
67
+ if (!undoers)
68
+ return;
69
+ for (let i = undoers.length - 1; i >= 0; i--)
70
+ undoers[i]();
71
+ activeUndoers.delete(asyncId);
33
72
  },
34
73
  destroy(asyncId) {
35
- restorersPerAsyncId.delete(asyncId);
36
- undoersPerAsyncId.delete(asyncId);
37
- }
38
- }).enable();
39
- asyncHooks.addHook = function (hook) {
40
- hooks.add(hook);
41
- return () => {
42
- hooks.delete(hook);
43
- };
74
+ contexts.delete(asyncId);
75
+ activeUndoers.delete(asyncId);
76
+ },
77
+ });
78
+ hook.enable();
79
+ // 2. Shadow Promise Implementation
80
+ // Ensures V8 await resumptions are visible as .then callbacks, wrapping them to restore context.
81
+ const OriginalPromise = globalThis.Promise;
82
+ const originalMethods = {
83
+ then: OriginalPromise.prototype.then,
84
+ catch: OriginalPromise.prototype.catch,
85
+ finally: OriginalPromise.prototype.finally};
86
+ // Patch prototype
87
+ OriginalPromise.prototype.then = function (onFulfilled, onRejected) {
88
+ return originalMethods.then.call(this, wrap(onFulfilled), wrap(onRejected));
89
+ };
90
+ OriginalPromise.prototype.catch = function (onRejected) {
91
+ return originalMethods.catch.call(this, wrap(onRejected));
44
92
  };
93
+ OriginalPromise.prototype.finally = function (onFinally) {
94
+ return originalMethods.finally.call(this, wrap(onFinally));
95
+ };
96
+
97
+ export { hooks };
45
98
  //# sourceMappingURL=node.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.esm.js","sources":["../src/async/node.ts"],"sourcesContent":["import { createHook } from 'node:async_hooks'\nimport { Hook, Restorer, asyncHooks } from '.'\n\nconst hooks = new Set<Hook>()\nconst restorersPerAsyncId = new Map<number, Set<Restorer>>()\nconst undoersPerAsyncId = new Map<number, Set<() => void>>()\n\ncreateHook({\n\tinit(asyncId) {\n\t\tconst restorers = new Set<Restorer>()\n\t\tfor (const hook of hooks) {\n\t\t\trestorers.add(hook())\n\t\t}\n\t\trestorersPerAsyncId.set(asyncId, restorers)\n\t},\n\tbefore(asyncId) {\n\t\tconst restorers = restorersPerAsyncId.get(asyncId)\n\t\tif (restorers) {\n\t\t\tconst undoers = new Set<() => void>()\n\t\t\tfor (const restore of restorers) {\n\t\t\t\tundoers.add(restore())\n\t\t\t}\n\t\t\tundoersPerAsyncId.set(asyncId, undoers)\n\t\t}\n\t},\n\tafter(asyncId) {\n\t\tconst undoers = undoersPerAsyncId.get(asyncId)\n\t\tif (undoers) {\n\t\t\tfor (const undo of undoers) undo()\n\t\t\tundoersPerAsyncId.delete(asyncId)\n\t\t}\n\t},\n\tdestroy(asyncId) {\n\t\trestorersPerAsyncId.delete(asyncId)\n\t\tundoersPerAsyncId.delete(asyncId)\n\t}\n}).enable()\n\nasy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AA,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC;IAClC;CACA,CAAC,CAAC,MAAM,EAAE;AAEX,UAAU,CAAC,OAAO,GAAG,UAAU,IAAU,EAAA;AACxC,IAAA,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;AACf,IAAA,OAAO,MAAK;AACX,QAAA,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AACnB,IAAA,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"node.esm.js","sources":["../src/async/node.ts"],"sourcesContent":["import { createHook } from 'node:async_hooks'\nimport { hooks, type Restorer } from '.'\n\n// 1. Generic async_hooks implementation for Hooks\n// This maintains support for 'asyncHooks.addHook' for generic use cases.\n\nconst contexts = new Map<number, Restorer[]>()\nconst activeUndoers = new Map<number, (() => void)[]>()\n\n// Helper to capture current hooks state\nfunction captureRestorers() {\n\tif (hooks.size === 0) return []\n\tconst restorers: Restorer[] = []\n\tfor (const h of hooks) {\n\t\tconst r = h()\n\t\tif (r) restorers.push(r)\n\t}\n\treturn restorers\n}\n\n// Manual Wrap function to handle Promise callbacks\nfunction wrap<Args extends any[], R>(fn: ((...args: Args) => R) | null | undefined) {\n\tif (typeof fn !== 'function') return fn\n\tconst restorers = captureRestorers()\n\tif (restorers.length === 0) return fn\n\n\treturn function (this: any, ...args: Args) {\n\t\tconst undoers: (() => void)[] = []\n\t\tfor (const restore of restorers) {\n\t\t\tconst u = restore()\n\t\t\tif (u) undoers.push(u)\n\t\t}\n\t\ttry {\n\t\t\treturn fn.apply(this, args)\n\t\t} finally {\n\t\t\tfor (let i = undoers.length - 1; i >= 0; i--) undoers[i]()\n\t\t}\n\t}\n}\n\nconst hook = createHook({\n\tinit(asyncId, _type, _triggerId, _resource) {\n\t\t// Used for native resources like Timers\n\t\tconst restorers = captureRestorers()\n\t\tif (restorers.length > 0) contexts.set(asyncId, restorers)\n\t},\n\tbefore(asyncId) {\n\t\tconst restorers = contexts.get(asyncId)\n\t\tif (!restorers) return\n\t\tconst undoers: (() => void)[] = []\n\t\tfor (const restore of restorers) {\n\t\t\tconst u = restore()\n\t\t\tif (u) undoers.push(u)\n\t\t}\n\t\tif (undoers.length > 0) activeUndoers.set(asyncId, undoers)\n\t},\n\tafter(asyncId) {\n\t\tconst undoers = activeUndoers.get(asyncId)\n\t\tif (!undoers) return\n\t\tfor (let i = undoers.length - 1; i >= 0; i--) undoers[i]()\n\t\tactiveUndoers.delete(asyncId)\n\t},\n\tdestroy(asyncId) {\n\t\tcontexts.delete(asyncId)\n\t\tactiveUndoers.delete(asyncId)\n\t},\n})\nhook.enable()\n\n// 2. Shadow Promise Implementation\n// Ensures V8 await resumptions are visible as .then callbacks, wrapping them to restore context.\n\nconst OriginalPromise = globalThis.Promise\nconst originalMethods = {\n\tthen: OriginalPromise.prototype.then,\n\tcatch: OriginalPromise.prototype.catch,\n\tfinally: OriginalPromise.prototype.finally,\n\tresolve: OriginalPromise.resolve,\n\treject: OriginalPromise.reject,\n\tall: OriginalPromise.all,\n}\n\n// Patch prototype\nOriginalPromise.prototype.then = function (onFulfilled, onRejected) {\n\treturn originalMethods.then.call(this, wrap(onFulfilled), wrap(onRejected))\n} as any\nOriginalPromise.prototype.catch = function (onRejected) {\n\treturn originalMethods.catch.call(this, wrap(onRejected))\n} as any\nOriginalPromise.prototype.finally = function (onFinally) {\n\treturn originalMethods.finally.call(this, wrap(onFinally))\n} as any\n"],"names":[],"mappings":";;;;;AAGA;AACA;AAEA,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAsB;AAC9C,MAAM,aAAa,GAAG,IAAI,GAAG,EAA0B;AAEvD;AACA,SAAS,gBAAgB,GAAA;AACxB,IAAA,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC;AAAE,QAAA,OAAO,EAAE;IAC/B,MAAM,SAAS,GAAe,EAAE;AAChC,IAAA,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE;AACtB,QAAA,MAAM,CAAC,GAAG,CAAC,EAAE;AACb,QAAA,IAAI,CAAC;A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AAC,WAAW,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAC5E,CAAQ;AACR,eAAe,CAAC,SAAS,CAAC,KAAK,GAAG,UAAU,UAAU,EAAA;AACrD,IAAA,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAC1D,CAAQ;AACR,eAAe,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,SAAS,EAAA;AACtD,IAAA,OAAO,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;AAC3D,CAAQ;;;;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/async/browser.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ export type Restorer = () => () => void;
2
+ export type Hook = () => Restorer;
3
+ export declare const hooks: Set<Hook>;
4
+ export declare const asyncHooks: {
5
+ addHook(hook: Hook): () => void;
6
+ /**
7
+ * [Hack] Sanitize a promise (or value) to prevent context leaks.
8
+ * Default: Identity function.
9
+ * Browser: Uses Macrotask wrapping to break microtask chains.
10
+ */
11
+ sanitizePromise(p: any): any;
12
+ };
13
+ /**
14
+ * Register a hook that will be called whenever an asynchronous operation is initiated.
15
+ * The hook should return a restorer function which will be called just before the async callback runs.
16
+ * That restorer should in turn return an undoer function which will be called just after the async callback finishes.
17
+ */
18
+ export declare const asyncHook: (hook: Hook) => () => void;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/async/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,MAAM,IAAI,CAAA;AACvC,MAAM,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAA;AAGjC,eAAO,MAAM,KAAK,WAAkB,CAAA;AAEpC,eAAO,MAAM,UAAU;kBACR,IAAI,GAAG,MAAM,IAAI;IAI/B;;;;OAIG;uBACgB,GAAG,GAAG,GAAG;CAG5B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,WAnBR,IAmBqC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/async/node.ts"],"names":[],"mappings":""}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Error thrown when decorator operations fail
3
+ */
4
+ export declare class DecoratorError extends Error {
5
+ constructor(message: string);
6
+ }
7
+ /**
8
+ * Legacy property decorator type for methods, getters, and setters
9
+ */
10
+ export type LegacyPropertyDecorator<T> = (target: T, name: string | symbol, descriptor: PropertyDescriptor) => any;
11
+ /**
12
+ * Legacy class decorator type
13
+ */
14
+ export type LegacyClassDecorator<T> = (target: T) => any;
15
+ /**
16
+ * Modern method decorator type
17
+ */
18
+ export type ModernMethodDecorator<T> = (target: T, context: ClassMethodDecoratorContext) => any;
19
+ /**
20
+ * Modern getter decorator type
21
+ */
22
+ export type ModernGetterDecorator<T> = (target: T, context: ClassGetterDecoratorContext) => any;
23
+ /**
24
+ * Modern setter decorator type
25
+ */
26
+ export type ModernSetterDecorator<T> = (target: T, context: ClassSetterDecoratorContext) => any;
27
+ /**
28
+ * Modern accessor decorator type
29
+ */
30
+ export type ModernAccessorDecorator<T> = (target: T, context: ClassAccessorDecoratorContext) => any;
31
+ /**
32
+ * Modern class decorator type
33
+ */
34
+ export type ModernClassDecorator<T> = (target: T, context: ClassDecoratorContext) => any;
35
+ type DDMethod<T> = (original: (this: T, ...args: any[]) => any, target: any, name: PropertyKey) => ((this: T, ...args: any[]) => any) | void;
36
+ type DDGetter<T> = (original: (this: T) => any, target: any, name: PropertyKey) => ((this: T) => any) | void;
37
+ type DDSetter<T> = (original: (this: T, value: any) => void, target: any, name: PropertyKey) => ((this: T, value: any) => void) | void;
38
+ type DDClass<T> = <Ctor extends new (...args: any[]) => T = new (...args: any[]) => T>(target: Ctor) => Ctor | void;
39
+ /**
40
+ * Description object for creating decorators that work with both Legacy and Modern decorator proposals
41
+ */
42
+ export interface DecoratorDescription<T> {
43
+ /** Handler for method decorators */
44
+ method?: DDMethod<T>;
45
+ /** Handler for class decorators */
46
+ class?: DDClass<T>;
47
+ /** Handler for getter decorators */
48
+ getter?: DDGetter<T>;
49
+ /** Handler for setter decorators */
50
+ setter?: DDSetter<T>;
51
+ /** Default handler for any decorator type not explicitly defined */
52
+ default?: (...args: any[]) => any;
53
+ }
54
+ /**
55
+ * Type for decorators that work with both Legacy and Modern decorator proposals
56
+ * Automatically infers the correct decorator type based on the description
57
+ */
58
+ export type Decorator<T, Description extends DecoratorDescription<T>> = (Description extends {
59
+ method: DDMethod<T>;
60
+ } ? LegacyPropertyDecorator<T> & ModernMethodDecorator<T> : unknown) & (Description extends {
61
+ class: DDClass<new (...args: any[]) => T>;
62
+ } ? LegacyClassDecorator<new (...args: any[]) => T> & ModernClassDecorator<new (...args: any[]) => T> : unknown) & (Description extends {
63
+ getter: DDGetter<T>;
64
+ } ? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T> : unknown) & (Description extends {
65
+ setter: DDSetter<T>;
66
+ } ? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T> : unknown) & (Description extends {
67
+ default: infer Signature;
68
+ } ? Signature : unknown);
69
+ /**
70
+ * Factory type for creating decorators that work with both Legacy and Modern decorator proposals
71
+ */
72
+ export type DecoratorFactory<T> = <Description extends DecoratorDescription<T>>(description: Description) => (Description extends {
73
+ method: DDMethod<T>;
74
+ } ? LegacyPropertyDecorator<T> & ModernMethodDecorator<T> : unknown) & (Description extends {
75
+ class: DDClass<new (...args: any[]) => T>;
76
+ } ? LegacyClassDecorator<new (...args: any[]) => T> & ModernClassDecorator<new (...args: any[]) => T> : unknown) & (Description extends {
77
+ getter: DDGetter<T>;
78
+ } ? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T> : unknown) & (Description extends {
79
+ setter: DDSetter<T>;
80
+ } ? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T> : unknown) & (Description extends {
81
+ default: infer Signature;
82
+ } ? Signature : unknown);
83
+ /**
84
+ * Creates a decorator that works with Legacy decorator proposals
85
+ * @param description - The decorator description object
86
+ * @returns A decorator function compatible with Legacy decorators
87
+ */
88
+ export declare function legacyDecorator<T = any>(description: DecoratorDescription<T>): any;
89
+ /**
90
+ * Creates a decorator that works with Modern decorator proposals
91
+ * @param description - The decorator description object
92
+ * @returns A decorator function compatible with Modern decorators
93
+ */
94
+ export declare function modernDecorator<T = any>(description: DecoratorDescription<T>): any;
95
+ /**
96
+ * Main decorator factory that automatically detects and works with both Legacy and Modern decorator proposals
97
+ * @param description - The decorator description object
98
+ * @returns A decorator that works in both Legacy and Modern environments
99
+ */
100
+ export declare const decorator: DecoratorFactory<any>;
101
+ /**
102
+ * Generic class decorator type that works with both Legacy and Modern decorator proposals
103
+ */
104
+ export type GenericClassDecorator<T> = LegacyClassDecorator<abstract new (...args: any[]) => T> & ModernClassDecorator<abstract new (...args: any[]) => T>;
105
+ export {};
106
+ //# sourceMappingURL=decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../src/decorator.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI3B;AAID;;GAEG;AACH,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI,CACxC,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,UAAU,EAAE,kBAAkB,KAC1B,GAAG,CAAA;AAER;;GAEG;AACH,MA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AC,GAC/C,OAAO,CAAC,GACX,CAAC,WAAW,SAAS;IAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;CAAE,GACzC,uBAAuB,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,GAAG,uBAAuB,CAAC,CAAC,CAAC,GAClF,OAAO,CAAC,GACX,CAAC,WAAW,SAAS;IAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;CAAE,GACzC,uBAAuB,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,GAAG,uBAAuB,CAAC,CAAC,CAAC,GAClF,OAAO,CAAC,GACX,CAAC,WAAW,SAAS;IAAE,OAAO,EAAE,MAAM,SAAS,CAAA;CAAE,GAAG,SAAS,GAAG,OAAO,CAAC,CAAA;AAEzE;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,WAAW,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,GAAG,CAwClF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,WAAW,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,GAAG,CAwClF;AAuBD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,GAAG,CAS3C,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,oBAAoB,CAAC,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,GAC9F,oBAAoB,CAAC,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAA"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Symbol for marking destructor methods
3
+ */
4
+ export declare const destructor: unique symbol;
5
+ /**
6
+ * Symbol for accessing allocated values in destroyable objects
7
+ */
8
+ export declare const allocatedValues: unique symbol;
9
+ /**
10
+ * Error thrown when attempting to access a destroyed object
11
+ */
12
+ export declare class DestructionError extends Error {
13
+ static throw<_T = void>(msg: string): () => never;
14
+ constructor(msg: string);
15
+ }
16
+ declare abstract class AbstractDestroyable<Allocated> {
17
+ abstract [destructor](allocated: Allocated): void;
18
+ [Symbol.dispose](): void;
19
+ }
20
+ interface Destructor<Allocated> {
21
+ destructor(allocated: Allocated): void;
22
+ }
23
+ /**
24
+ * Creates a destroyable class with a base class and destructor object
25
+ * @param base - The base class to extend
26
+ * @param destructorObj - Object containing the destructor method
27
+ * @returns A destroyable class with static destroy and isDestroyable methods
28
+ */
29
+ export declare function Destroyable<T extends new (...args: any[]) => any, Allocated extends Partial<InstanceType<T>>>(base: T, destructorObj: Destructor<Allocated>): (new (...args: ConstructorParameters<T>) => InstanceType<T> & {
30
+ [allocatedValues]: Allocated;
31
+ }) & {
32
+ destroy(obj: InstanceType<T>): boolean;
33
+ isDestroyable(obj: InstanceType<T>): boolean;
34
+ };
35
+ /**
36
+ * Creates a destroyable class with only a destructor object (no base class)
37
+ * @param destructorObj - Object containing the destructor method
38
+ * @returns A destroyable class with static destroy and isDestroyable methods
39
+ */
40
+ export declare function Destroyable<Allocated extends Record<PropertyKey, any> = Record<PropertyKey, any>>(destructorObj: Destructor<Allocated>): (new () => {
41
+ [allocatedValues]: Allocated;
42
+ }) & {
43
+ destroy(obj: any): boolean;
44
+ isDestroyable(obj: any): boolean;
45
+ };
46
+ /**
47
+ * Creates a destroyable class with a base class (requires [destructor] method)
48
+ * @param base - The base class to extend
49
+ * @returns A destroyable class with static destroy and isDestroyable methods
50
+ */
51
+ export declare function Destroyable<T extends new (...args: any[]) => any, Allocated extends Record<PropertyKey, any> = Record<PropertyKey, any>>(base: T): (new (...args: ConstructorParameters<T>) => AbstractDestroyable<Allocated> & InstanceType<T> & {
52
+ [allocatedValues]: Allocated;
53
+ }) & {
54
+ destroy(obj: InstanceType<T>): boolean;
55
+ isDestroyable(obj: InstanceType<T>): boolean;
56
+ };
57
+ /**
58
+ * Creates an abstract destroyable base class
59
+ * @returns An abstract destroyable class with static destroy and isDestroyable methods
60
+ */
61
+ export declare function Destroyable<Allocated extends Record<PropertyKey, any> = Record<PropertyKey, any>>(): abstract new () => (AbstractDestroyable<Allocated> & {
62
+ [allocatedValues]: Allocated;
63
+ }) & {
64
+ destroy(obj: any): boolean;
65
+ isDestroyable(obj: any): boolean;
66
+ };
67
+ /**
68
+ * Decorator that marks properties to be stored in the allocated object and passed to the destructor
69
+ * Use with accessor properties or explicit get/set pairs
70
+ */
71
+ export declare const allocated: import("./decorator").LegacyPropertyDecorator<any> & import("./decorator").ModernSetterDecorator<any> & import("./decorator").ModernAccessorDecorator<any>;
72
+ /**
73
+ * Registers a callback to be called when an object is garbage collected
74
+ * @param cb - The callback function to execute on garbage collection
75
+ * @returns The object whose reference can be collected
76
+ */
77
+ export declare function callOnGC(cb: () => void): () => void;
78
+ /**
79
+ * Context Manager Protocol for `using` statement integration
80
+ * Provides automatic resource cleanup when used with the `using` statement
81
+ */
82
+ export interface ContextManager<T = any> {
83
+ [Symbol.dispose](): void;
84
+ value?: T;
85
+ }
86
+ export {};
87
+ //# sourceMappingURL=destroyable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"destroyable.d.ts","sourceRoot":"","sources":["../../src/destroyable.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,UAAU,eAAuB,CAAA;AAC9C;;GAEG;AACH,eAAO,MAAM,eAAe,eAAsB,CAAA;AAClD;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IAC1C,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM;gBAKvB,GAAG,EAAE,MAAM;CAIvB;AAOD,uBAAe,mBAAmB,CAAC,SAAS;IAC3C,QAAQ,CAAC,CAAC,UAAU,CAAC,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IACjD,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;CA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CAAC,KACH,GAAG,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,KAC7B,mBAAmB,CAAC,SAAS,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG;IAAE,CAAC,eAAe,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC,GAAG;IAC3F,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,CAAA;IACtC,aAAa,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,CAAA;CAC5C,CAAA;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAC1B,SAAS,SAAS,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,KACjE,QAAQ,WAAW,CAAC,mBAAmB,CAAC,SAAS,CAAC,GAAG;IACzD,CAAC,eAAe,CAAC,EAAE,SAAS,CAAA;CAC5B,CAAC,GAAG;IACJ,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAA;IAC1B,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAA;CAChC,CAAA;AAwDD;;;GAGG;AACH,eAAO,MAAM,SAAS,4JAOpB,CAAA;AAEF;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,IAAI,cAStC;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,GAAG;IACtC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAA;IACxB,KAAK,CAAC,EAAE,CAAC,CAAA;CACT"}
@@ -0,0 +1,3 @@
1
+ import './async/browser';
2
+ export * from './index';
3
+ //# sourceMappingURL=entry-browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-browser.d.ts","sourceRoot":"","sources":["../../src/entry-browser.ts"],"names":[],"mappings":"AACA,OAAO,iBAAiB,CAAA;AAGxB,cAAc,SAAS,CAAA"}
@@ -0,0 +1,3 @@
1
+ import './async/node';
2
+ export * from './index';
3
+ //# sourceMappingURL=entry-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-node.d.ts","sourceRoot":"","sources":["../../src/entry-node.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,CAAA;AAGrB,cAAc,SAAS,CAAA"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Base type for event maps - all event handlers must be functions
3
+ */
4
+ export type EventsBase = Record<string, (...args: any[]) => void>;
5
+ declare const events: unique symbol;
6
+ declare const hooks: unique symbol;
7
+ /**
8
+ * A type-safe event system that provides a clean API for event handling
9
+ * @template Events - The event map defining event names and their handler signatures
10
+ */
11
+ export declare class Eventful<Events extends EventsBase> {
12
+ private readonly [events];
13
+ private readonly [hooks];
14
+ hook(cb: <EventType extends keyof Events>(event: EventType, ...args: Parameters<Events[EventType]>) => void): () => void;
15
+ on: ((events: Partial<Events>) => void) & (<EventType extends keyof Events>(event: EventType, cb: Events[EventType]) => () => void) & { [event in keyof Events]: (cb: Events[event]) => () => void; };
16
+ off: ((events: Partial<Events>) => void) & (<EventType extends keyof Events>(event: EventType, cb?: Events[EventType]) => void) & { [event in keyof Events]: (cb?: Events[event]) => void; };
17
+ emit: (<EventType extends keyof Events>(event: EventType, ...args: Parameters<Events[EventType]>) => void) & Events;
18
+ }
19
+ export {};
20
+ //# sourceMappingURL=eventful.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventful.d.ts","sourceRoot":"","sources":["../../src/eventful.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC,CAAA;AAEjE,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAqE7B;;;GAGG;AACH,qBAAa,QAAQ,CAAC,MAAM,SAAS,UAAU;IAC9C,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAyD;IAClF,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAsC;IAEvD,IAAI,CACV,EAAE,EAAE,CAAC,SAAS,SAAS,MAAM,MAAM,EAClC,KAAK,EAAE,SAAS,EAChB,GAAG,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAClC,IAAI,GACP,MAAM,IAAI;IAON,EAAE,EAAuC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,GAClF,CAAC,CAAC,SAAS,SAAS,MAAM,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,MAAM,IAAI,CAAC,GAAG,GAC1F,KAAK,IAAI,MAAM,MAAM,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,IAAI,GAC1D,CAAA;IACK,GAAG,EAAwC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,GACpF,CAAC,CAAC,SAAS,SAAS,MAAM,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,GAAG,GACrF,KAAK,IAAI,MAAM,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,GACrD,CAAA;IAEK,IAAI,EAAgD,CAAC,CAAC,SAAS,SAAS,MAAM,MAAM,EAC1F,KAAK,EAAE,SAAS,EAChB,GAAG,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAClC,IAAI,CAAC,GACT,MAAM,CAAA;CACP"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Creates a flavored (extensible) version of a function with chainable property modifiers.
3
+ */
4
+ export declare function flavored<T extends (...args: any[]) => any, F extends Record<string, any>>(fn: T, flavors: F): T & F;
5
+ /**
6
+ * Creates a new flavored function that transforms arguments before calling the base.
7
+ *
8
+ * @param fn - The base flavored function
9
+ * @param transform - Function that receives the original arguments and returns transformed arguments
10
+ * @returns A new flavored function with the transformation applied
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const loudGreet = createFlavor(greet, (name, opts) => [name, { ...opts, loud: true }])
15
+ * ```
16
+ */
17
+ export declare function createFlavor<T extends (...args: any[]) => any>(fn: T, transform: (...args: Parameters<T>) => Parameters<T>, name?: string): T;
18
+ /**
19
+ * Creates a new flavored function that merges options objects.
20
+ * Useful when the last argument is an options object that should be merged.
21
+ *
22
+ * @param fn - The base flavored function
23
+ * @param defaultOptions - Options to merge with the provided options
24
+ * @returns A new flavored function with merged options
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * const opaqueEffect = flavorOptions(effect, { opaque: true })
29
+ * const namedEffect = flavorOptions(effect, { name: 'myEffect' })
30
+ * ```
31
+ */
32
+ export declare function flavorOptions<T extends (...args: any[]) => any>(fn: T, defaultOptions: Record<string, any>, name?: string): T;
33
+ //# sourceMappingURL=flavored.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flavored.d.ts","sourceRoot":"","sources":["../../src/flavored.ts"],"names":[],"mappings":"AA8BA;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxF,EAAE,EAAE,CAAC,EACL,OAAO,EAAE,CAAC,GACR,CAAC,GAAG,CAAC,CAYP;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAC7D,EAAE,EAAE,CAAC,EACL,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,EACpD,IAAI,CAAC,EAAE,MAAM,GACX,CAAC,CAOH;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAC9D,EAAE,EAAE,CAAC,EACL,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnC,IAAI,CAAC,EAAE,MAAM,GACX,CAAC,CAYH"}
@@ -0,0 +1,14 @@
1
+ export * from './async';
2
+ export * from './decorator';
3
+ export * from './destroyable';
4
+ export * from './eventful';
5
+ export * from './flavored';
6
+ export * from './indexable';
7
+ export * from './iterableWeak';
8
+ export * from './mixins';
9
+ export * from './promiseChain';
10
+ export * from './reactive';
11
+ export * from './std-decorators';
12
+ export * from './utils';
13
+ export * from './zone';
14
+ //# sourceMappingURL=index.d.ts.map