mutts 1.0.9 → 1.0.10

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 (204) hide show
  1. package/README.md +58 -33
  2. package/dist/browser.cjs +1371 -1206
  3. package/dist/browser.cjs.map +1 -1
  4. package/dist/browser.d.ts +2 -1392
  5. package/dist/browser.dev.cjs +110 -0
  6. package/dist/browser.dev.cjs.map +1 -0
  7. package/dist/browser.dev.d.ts +2 -0
  8. package/dist/browser.dev.esm.js +5 -0
  9. package/dist/browser.dev.esm.js.map +1 -0
  10. package/dist/browser.esm.js +6 -87
  11. package/dist/browser.esm.js.map +1 -1
  12. package/dist/chunks/{async-browser-lvzLOCgk.cjs → async-browser-BU_IfxYD.cjs} +4 -85
  13. package/dist/chunks/async-browser-BU_IfxYD.cjs.map +1 -0
  14. package/dist/chunks/{async-node-C3DeIb0y.cjs → async-node-3PrbVAbB.cjs} +3 -1
  15. package/dist/chunks/async-node-3PrbVAbB.cjs.map +1 -0
  16. package/dist/chunks/{index-2vea86wD.esm.js → index-CaaQQlPJ.esm.js} +1116 -953
  17. package/dist/chunks/index-CaaQQlPJ.esm.js.map +1 -0
  18. package/dist/chunks/node-nKJBk8iJ.esm.js +96 -0
  19. package/dist/chunks/node-nKJBk8iJ.esm.js.map +1 -0
  20. package/dist/chunks/{index-VTO-b2vR.cjs → proxy-Dtg-bJ3T.cjs} +2285 -2983
  21. package/dist/chunks/proxy-Dtg-bJ3T.cjs.map +1 -0
  22. package/dist/chunks/{index-CtA2AWl3.esm.js → proxy-r7lARftl.esm.js} +2273 -2948
  23. package/dist/chunks/proxy-r7lARftl.esm.js.map +1 -0
  24. package/dist/debug.cjs +973 -28
  25. package/dist/debug.cjs.map +1 -1
  26. package/dist/debug.d.ts +36 -37
  27. package/dist/debug.esm.js +949 -1
  28. package/dist/debug.esm.js.map +1 -1
  29. package/dist/devtools/manifest.json +1 -1
  30. package/dist/devtools/panel.html +1 -1
  31. package/dist/devtools/panel.js +107 -94
  32. package/dist/devtools/panel.js.map +1 -1
  33. package/dist/index.d.ts +1447 -1
  34. package/dist/mutts.umd.js +7167 -1
  35. package/dist/mutts.umd.js.map +1 -1
  36. package/dist/mutts.umd.min.js +1 -1
  37. package/dist/mutts.umd.min.js.map +1 -1
  38. package/dist/node.cjs +62 -60
  39. package/dist/node.cjs.map +1 -1
  40. package/dist/node.d.ts +2 -2
  41. package/dist/node.dev.cjs +110 -0
  42. package/dist/node.dev.cjs.map +1 -0
  43. package/dist/node.dev.d.ts +2 -0
  44. package/dist/node.dev.esm.js +6 -0
  45. package/dist/node.dev.esm.js.map +1 -0
  46. package/dist/node.esm.js +4 -97
  47. package/dist/node.esm.js.map +1 -1
  48. package/dist/{types-DaHFfhlN.d.ts → types-W5vD6m2n.d.ts} +99 -44
  49. package/docs/ai/api-reference.md +11 -18
  50. package/docs/ai/manual.md +308 -230
  51. package/docs/reactive/advanced.md +312 -2
  52. package/docs/reactive/attend.md +1 -2
  53. package/docs/reactive/collections.md +21 -39
  54. package/docs/reactive/core.md +7 -37
  55. package/docs/reactive/debugging.md +117 -10
  56. package/docs/reactive/error-handling.md +10 -10
  57. package/docs/reactive/resource.md +125 -0
  58. package/docs/reactive/scan.md +32 -1
  59. package/docs/reactive.md +3 -2
  60. package/docs/utils.md +70 -0
  61. package/package.json +59 -30
  62. package/dist/chunks/async-browser-lvzLOCgk.cjs.map +0 -1
  63. package/dist/chunks/async-node-C3DeIb0y.cjs.map +0 -1
  64. package/dist/chunks/index-2vea86wD.esm.js.map +0 -1
  65. package/dist/chunks/index-CtA2AWl3.esm.js.map +0 -1
  66. package/dist/chunks/index-VTO-b2vR.cjs.map +0 -1
  67. package/dist/debug/debug.d.ts +0 -122
  68. package/dist/debug/debug.d.ts.map +0 -1
  69. package/dist/debug/index.d.ts +0 -4
  70. package/dist/debug/index.d.ts.map +0 -1
  71. package/dist/debug/lineage-panel.d.ts +0 -5
  72. package/dist/debug/lineage-panel.d.ts.map +0 -1
  73. package/dist/debug/lineage.d.ts +0 -79
  74. package/dist/debug/lineage.d.ts.map +0 -1
  75. package/dist/src/async/browser.d.ts +0 -2
  76. package/dist/src/async/browser.d.ts.map +0 -1
  77. package/dist/src/async/index.d.ts +0 -19
  78. package/dist/src/async/index.d.ts.map +0 -1
  79. package/dist/src/async/node.d.ts +0 -2
  80. package/dist/src/async/node.d.ts.map +0 -1
  81. package/dist/src/decorator.d.ts +0 -106
  82. package/dist/src/decorator.d.ts.map +0 -1
  83. package/dist/src/destroyable.d.ts +0 -87
  84. package/dist/src/destroyable.d.ts.map +0 -1
  85. package/dist/src/entry-browser.d.ts +0 -3
  86. package/dist/src/entry-browser.d.ts.map +0 -1
  87. package/dist/src/entry-node.d.ts +0 -3
  88. package/dist/src/entry-node.d.ts.map +0 -1
  89. package/dist/src/eventful.d.ts +0 -20
  90. package/dist/src/eventful.d.ts.map +0 -1
  91. package/dist/src/flavored.d.ts +0 -33
  92. package/dist/src/flavored.d.ts.map +0 -1
  93. package/dist/src/index.d.ts +0 -14
  94. package/dist/src/index.d.ts.map +0 -1
  95. package/dist/src/indexable.d.ts +0 -243
  96. package/dist/src/indexable.d.ts.map +0 -1
  97. package/dist/src/introspection.d.ts +0 -27
  98. package/dist/src/introspection.d.ts.map +0 -1
  99. package/dist/src/iterableWeak.d.ts +0 -53
  100. package/dist/src/iterableWeak.d.ts.map +0 -1
  101. package/dist/src/mixins.d.ts +0 -25
  102. package/dist/src/mixins.d.ts.map +0 -1
  103. package/dist/src/promiseChain.d.ts +0 -20
  104. package/dist/src/promiseChain.d.ts.map +0 -1
  105. package/dist/src/reactive/array.d.ts +0 -48
  106. package/dist/src/reactive/array.d.ts.map +0 -1
  107. package/dist/src/reactive/buffer.d.ts +0 -120
  108. package/dist/src/reactive/buffer.d.ts.map +0 -1
  109. package/dist/src/reactive/change.d.ts +0 -29
  110. package/dist/src/reactive/change.d.ts.map +0 -1
  111. package/dist/src/reactive/deep-touch.d.ts +0 -28
  112. package/dist/src/reactive/deep-touch.d.ts.map +0 -1
  113. package/dist/src/reactive/deep-watch-state.d.ts +0 -25
  114. package/dist/src/reactive/deep-watch-state.d.ts.map +0 -1
  115. package/dist/src/reactive/deep-watch.d.ts +0 -20
  116. package/dist/src/reactive/deep-watch.d.ts.map +0 -1
  117. package/dist/src/reactive/describe.d.ts +0 -12
  118. package/dist/src/reactive/describe.d.ts.map +0 -1
  119. package/dist/src/reactive/effect-context.d.ts +0 -34
  120. package/dist/src/reactive/effect-context.d.ts.map +0 -1
  121. package/dist/src/reactive/effects.d.ts +0 -164
  122. package/dist/src/reactive/effects.d.ts.map +0 -1
  123. package/dist/src/reactive/index.d.ts +0 -19
  124. package/dist/src/reactive/index.d.ts.map +0 -1
  125. package/dist/src/reactive/map.d.ts +0 -28
  126. package/dist/src/reactive/map.d.ts.map +0 -1
  127. package/dist/src/reactive/memoize.d.ts +0 -28
  128. package/dist/src/reactive/memoize.d.ts.map +0 -1
  129. package/dist/src/reactive/non-reactive-state.d.ts +0 -9
  130. package/dist/src/reactive/non-reactive-state.d.ts.map +0 -1
  131. package/dist/src/reactive/non-reactive.d.ts +0 -11
  132. package/dist/src/reactive/non-reactive.d.ts.map +0 -1
  133. package/dist/src/reactive/project.d.ts +0 -40
  134. package/dist/src/reactive/project.d.ts.map +0 -1
  135. package/dist/src/reactive/proxy-state.d.ts +0 -8
  136. package/dist/src/reactive/proxy-state.d.ts.map +0 -1
  137. package/dist/src/reactive/proxy.d.ts +0 -23
  138. package/dist/src/reactive/proxy.d.ts.map +0 -1
  139. package/dist/src/reactive/record.d.ts +0 -115
  140. package/dist/src/reactive/record.d.ts.map +0 -1
  141. package/dist/src/reactive/register.d.ts +0 -125
  142. package/dist/src/reactive/register.d.ts.map +0 -1
  143. package/dist/src/reactive/registry.d.ts +0 -21
  144. package/dist/src/reactive/registry.d.ts.map +0 -1
  145. package/dist/src/reactive/set.d.ts +0 -26
  146. package/dist/src/reactive/set.d.ts.map +0 -1
  147. package/dist/src/reactive/tracking.d.ts +0 -7
  148. package/dist/src/reactive/tracking.d.ts.map +0 -1
  149. package/dist/src/reactive/types.d.ts +0 -424
  150. package/dist/src/reactive/types.d.ts.map +0 -1
  151. package/dist/src/reactive/watch.d.ts +0 -48
  152. package/dist/src/reactive/watch.d.ts.map +0 -1
  153. package/dist/src/std-decorators.d.ts +0 -45
  154. package/dist/src/std-decorators.d.ts.map +0 -1
  155. package/dist/src/utils.d.ts +0 -49
  156. package/dist/src/utils.d.ts.map +0 -1
  157. package/dist/src/zone.d.ts +0 -40
  158. package/dist/src/zone.d.ts.map +0 -1
  159. package/docs/reactive/describe.md +0 -85
  160. package/docs/reactive/project.md +0 -93
  161. package/src/async/browser.ts +0 -323
  162. package/src/async/index.ts +0 -27
  163. package/src/async/node.ts +0 -92
  164. package/src/decorator.ts +0 -272
  165. package/src/destroyable.ts +0 -199
  166. package/src/entry-browser.ts +0 -5
  167. package/src/entry-node.ts +0 -5
  168. package/src/eventful.ts +0 -110
  169. package/src/flavored.ts +0 -106
  170. package/src/index.d.ts +0 -12
  171. package/src/index.ts +0 -64
  172. package/src/indexable.ts +0 -526
  173. package/src/introspection.ts +0 -59
  174. package/src/iterableWeak.ts +0 -233
  175. package/src/mixins.ts +0 -123
  176. package/src/promiseChain.ts +0 -110
  177. package/src/reactive/array.ts +0 -500
  178. package/src/reactive/buffer.ts +0 -328
  179. package/src/reactive/change.ts +0 -131
  180. package/src/reactive/deep-touch.ts +0 -273
  181. package/src/reactive/deep-watch-state.ts +0 -82
  182. package/src/reactive/deep-watch.ts +0 -171
  183. package/src/reactive/describe.ts +0 -39
  184. package/src/reactive/effect-context.ts +0 -83
  185. package/src/reactive/effects.ts +0 -1434
  186. package/src/reactive/index.ts +0 -72
  187. package/src/reactive/map.ts +0 -142
  188. package/src/reactive/memoize.ts +0 -186
  189. package/src/reactive/non-reactive-state.ts +0 -49
  190. package/src/reactive/non-reactive.ts +0 -43
  191. package/src/reactive/project.md +0 -107
  192. package/src/reactive/project.ts +0 -430
  193. package/src/reactive/proxy-state.ts +0 -27
  194. package/src/reactive/proxy.ts +0 -282
  195. package/src/reactive/record.ts +0 -181
  196. package/src/reactive/register.ts +0 -538
  197. package/src/reactive/registry.ts +0 -72
  198. package/src/reactive/set.ts +0 -117
  199. package/src/reactive/tracking.ts +0 -41
  200. package/src/reactive/types.ts +0 -520
  201. package/src/reactive/watch.ts +0 -180
  202. package/src/std-decorators.ts +0 -256
  203. package/src/utils.ts +0 -300
  204. package/src/zone.ts +0 -142
@@ -0,0 +1,110 @@
1
+ 'use strict';
2
+
3
+ require('./debug.cjs');
4
+ require('./chunks/async-browser-BU_IfxYD.cjs');
5
+ var browser = require('./browser.cjs');
6
+ var proxy = require('./chunks/proxy-Dtg-bJ3T.cjs');
7
+ var asyncCore = require('./chunks/async-core-CRLKP3l-.cjs');
8
+ require('./chunks/async-node-3PrbVAbB.cjs');
9
+ require('node:async_hooks');
10
+
11
+
12
+
13
+ exports.ArrayReadForward = browser.ArrayReadForward;
14
+ exports.Destroyable = browser.Destroyable;
15
+ exports.DestructionError = browser.DestructionError;
16
+ exports.Eventful = browser.Eventful;
17
+ exports.Indexable = browser.Indexable;
18
+ exports.Register = browser.Register;
19
+ exports.allocated = browser.allocated;
20
+ exports.allocatedValues = browser.allocatedValues;
21
+ exports.arrayDiff = browser.arrayDiff;
22
+ exports.attend = browser.attend;
23
+ exports.cache = browser.cache;
24
+ exports.cached = browser.cached;
25
+ exports.callOnGC = browser.callOnGC;
26
+ exports.chainPromise = browser.chainPromise;
27
+ exports.debounce = browser.debounce;
28
+ exports.deepWatch = browser.deepWatch;
29
+ exports.deprecated = browser.deprecated;
30
+ exports.descriptor = browser.descriptor;
31
+ exports.destructor = browser.destructor;
32
+ exports.forwardArray = browser.forwardArray;
33
+ exports.getAt = browser.getAt;
34
+ exports.isCached = browser.isCached;
35
+ exports.lift = browser.lift;
36
+ exports.memoize = browser.memoize;
37
+ exports.morph = browser.morph;
38
+ exports.organize = browser.organize;
39
+ exports.organized = browser.organized;
40
+ exports.profileInfo = browser.profileInfo;
41
+ exports.project = browser.morph;
42
+ exports.register = browser.register;
43
+ exports.resource = browser.resource;
44
+ exports.scan = browser.scan;
45
+ exports.setAt = browser.setAt;
46
+ exports.throttle = browser.throttle;
47
+ exports.unreactive = browser.unreactive;
48
+ exports.watch = browser.watch;
49
+ exports.when = browser.when;
50
+ exports.AZone = proxy.AZone;
51
+ exports.DecoratorError = proxy.DecoratorError;
52
+ exports.IterableWeakMap = proxy.IterableWeakMap;
53
+ exports.IterableWeakSet = proxy.IterableWeakSet;
54
+ exports.ReactiveBase = proxy.ReactiveBase;
55
+ exports.ReactiveError = proxy.ReactiveError;
56
+ Object.defineProperty(exports, "ReactiveErrorCode", {
57
+ enumerable: true,
58
+ get: function () { return proxy.ReactiveErrorCode; }
59
+ });
60
+ exports.Zone = proxy.Zone;
61
+ exports.ZoneAggregator = proxy.ZoneAggregator;
62
+ exports.ZoneHistory = proxy.ZoneHistory;
63
+ exports.addBatchCleanup = proxy.addBatchCleanup;
64
+ exports.arrayEquals = proxy.arrayEquals;
65
+ exports.asyncZone = proxy.asyncZone;
66
+ exports.atom = proxy.atom;
67
+ exports.atomic = proxy.atomic;
68
+ exports.biDi = proxy.biDi;
69
+ exports.caught = proxy.caught;
70
+ exports.cleanedBy = proxy.cleanedBy;
71
+ exports.cleanup = proxy.cleanup;
72
+ exports.createFlavor = proxy.createFlavor;
73
+ exports.decorator = proxy.decorator;
74
+ exports.deepCompare = proxy.deepCompare;
75
+ exports.defer = proxy.defer;
76
+ exports.effect = proxy.effect;
77
+ exports.effectAggregator = proxy.effectAggregator;
78
+ exports.flavorOptions = proxy.flavorOptions;
79
+ exports.flavored = proxy.flavored;
80
+ exports.formatCleanupReason = proxy.formatCleanupReason;
81
+ exports.getActivationLog = proxy.getActivationLog;
82
+ exports.getActiveEffect = proxy.getActiveEffect;
83
+ exports.getState = proxy.getState;
84
+ exports.immutables = proxy.immutables;
85
+ exports.isConstructor = proxy.isConstructor;
86
+ exports.isNonReactive = proxy.isNonReactive;
87
+ exports.isObject = proxy.isObject;
88
+ exports.isReactive = proxy.isReactive;
89
+ exports.legacyDecorator = proxy.legacyDecorator;
90
+ exports.mixin = proxy.mixin;
91
+ exports.modernDecorator = proxy.modernDecorator;
92
+ exports.named = proxy.named;
93
+ exports.objectToProxy = proxy.objectToProxy;
94
+ exports.onEffectThrow = proxy.onEffectThrow;
95
+ exports.proxyToObject = proxy.proxyToObject;
96
+ exports.reactive = proxy.reactive;
97
+ exports.reactiveOptions = proxy.options;
98
+ exports.reset = proxy.reset;
99
+ exports.root = proxy.root;
100
+ exports.stopped = proxy.stopped;
101
+ exports.tag = proxy.tag;
102
+ exports.touched = proxy.touched;
103
+ exports.touched1 = proxy.touched1;
104
+ exports.untracked = proxy.untracked;
105
+ exports.unwrap = proxy.unwrap;
106
+ exports.zip = proxy.zip;
107
+ exports.asyncHook = asyncCore.asyncHook;
108
+ exports.asyncHooks = asyncCore.asyncHooks;
109
+ exports.hooks = asyncCore.hooks;
110
+ //# sourceMappingURL=browser.dev.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.dev.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export { A as AZone, h as CleanupReason, e as EffectAccess, b as EffectCleanup, d as EffectCloser, g as EffectOptions, E as EffectTrigger, a as Evolution, F as FunctionWrapper, P as PropTrigger, R as ReactiveError, i as ReactiveErrorCode, S as ScopedCallback, j as Zone, Z as ZoneAggregator, k as ZoneHistory, l as asyncZone, c as cleanup, m as formatCleanupReason, n as isReactive, o as objectToProxy, p as proxyToObject, q as reactiveOptions, s as stopped, u as unwrap } from './types-W5vD6m2n.js';
2
+ export { ArrayDiffResult, ArrayReadForward, ContextManager, Decorator, DecoratorDescription, DecoratorError, DecoratorFactory, Destroyable, DestructionError, Eventful, EventsBase, GenericClassDecorator, Hook, Indexable, IterableWeakMap, IterableWeakSet, LegacyClassDecorator, LegacyPropertyDecorator, Memoizable, MemoizableArgument, MixinClass, MixinFunction, ModernAccessorDecorator, ModernClassDecorator, ModernGetterDecorator, ModernMethodDecorator, ModernSetterDecorator, PromiseChain, ReactiveBase, Register, Resource, Restorer, ScanResult, addBatchCleanup, allocated, allocatedValues, arrayDiff, arrayEquals, asyncHook, asyncHooks, atom, atomic, attend, biDi, cache, cached, callOnGC, caught, chainPromise, cleanedBy, createFlavor, debounce, decorator, deepCompare, deepWatch, defer, deprecated, descriptor, destructor, effect, effectAggregator, flavorOptions, flavored, forwardArray, getActivationLog, getActiveEffect, getAt, getState, hooks, immutables, isCached, isConstructor, isNonReactive, isObject, legacyDecorator, lift, memoize, mixin, modernDecorator, morph, named, onEffectThrow, organize, organized, profileInfo, morph as project, reactive, register, reset, resource, root, scan, setAt, tag, throttle, touched, touched1, unreactive, untracked, watch, when, zip } from './index.js';
@@ -0,0 +1,5 @@
1
+ import './debug.esm.js';
2
+ import './browser.esm.js';
3
+ 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 arrayDiff, e as attend, f as cache, g as cached, h as callOnGC, i as chainPromise, j as debounce, k as deepWatch, l as deprecated, m as descriptor, n as destructor, o as forwardArray, p as getAt, q as isCached, r as lift, s as memoize, t as morph, u as organize, v as organized, w as profileInfo, t as project, x as register, y as resource, z as scan, B as setAt, C as throttle, F as unreactive, G as watch, H as when } from './chunks/index-CaaQQlPJ.esm.js';
4
+ export { A as AZone, D as DecoratorError, I as IterableWeakMap, a as IterableWeakSet, R as ReactiveBase, b as ReactiveError, c as ReactiveErrorCode, Z as Zone, d as ZoneAggregator, e as ZoneHistory, f as addBatchCleanup, g as arrayEquals, h as asyncHook, i as asyncHooks, j as asyncZone, k as atom, l as atomic, m as biDi, n as caught, o as cleanedBy, p as cleanup, q as createFlavor, r as decorator, s as deepCompare, t as defer, u as effect, v as effectAggregator, w as flavorOptions, x as flavored, y as formatCleanupReason, z as getActivationLog, B as getActiveEffect, C as getState, E as hooks, F as immutables, G as isConstructor, H as isNonReactive, J as isObject, K as isReactive, L as legacyDecorator, M as mixin, N as modernDecorator, O as named, P as objectToProxy, Q as onEffectThrow, S as proxyToObject, T as reactive, U as reactiveOptions, V as reset, W as root, X as stopped, Y as tag, _ as touched, $ as touched1, a0 as untracked, a1 as unwrap, a2 as zip } from './chunks/proxy-r7lARftl.esm.js';
5
+ //# sourceMappingURL=browser.dev.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.dev.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1,6 +1,6 @@
1
- import { h as hooks, a as asyncHooks } from './chunks/index-CtA2AWl3.esm.js';
2
- 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, 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';
3
- 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';
1
+ import { E as hooks, i as asyncHooks } from './chunks/proxy-r7lARftl.esm.js';
2
+ export { A as AZone, D as DecoratorError, I as IterableWeakMap, a as IterableWeakSet, R as ReactiveBase, b as ReactiveError, c as ReactiveErrorCode, Z as Zone, d as ZoneAggregator, e as ZoneHistory, f as addBatchCleanup, g as arrayEquals, h as asyncHook, j as asyncZone, k as atom, l as atomic, m as biDi, n as caught, o as cleanedBy, p as cleanup, q as createFlavor, r as decorator, s as deepCompare, t as defer, u as effect, v as effectAggregator, w as flavorOptions, x as flavored, y as formatCleanupReason, z as getActivationLog, B as getActiveEffect, C as getState, F as immutables, G as isConstructor, H as isNonReactive, J as isObject, K as isReactive, L as legacyDecorator, M as mixin, N as modernDecorator, O as named, P as objectToProxy, Q as onEffectThrow, S as proxyToObject, T as reactive, U as reactiveOptions, V as reset, W as root, X as stopped, Y as tag, _ as touched, $ as touched1, a0 as untracked, a1 as unwrap, a2 as zip } from './chunks/proxy-r7lARftl.esm.js';
3
+ 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 arrayDiff, e as attend, f as cache, g as cached, h as callOnGC, i as chainPromise, j as debounce, k as deepWatch, l as deprecated, m as descriptor, n as destructor, o as forwardArray, p as getAt, q as isCached, r as lift, s as memoize, t as morph, u as organize, v as organized, w as profileInfo, t as project, x as register, y as resource, z as scan, B as setAt, C as throttle, F as unreactive, G as watch, H as when } from './chunks/index-CaaQQlPJ.esm.js';
4
4
 
5
5
  const promiseContexts = new WeakMap();
6
6
  // [HACK]: Sanitization
@@ -57,89 +57,6 @@ function wrap(fn, capturedRestorers) {
57
57
  }
58
58
  };
59
59
  }
60
- const targetWrappers = new WeakMap();
61
- function patchEventTarget(proto) {
62
- if (!proto || !proto.addEventListener || !proto.removeEventListener)
63
- return;
64
- const nativeAdd = proto.addEventListener;
65
- const nativeRemove = proto.removeEventListener;
66
- proto.addEventListener = function (type, listener, options) {
67
- if (typeof listener !== 'function') {
68
- return nativeAdd.call(this, type, listener, options);
69
- }
70
- let types = targetWrappers.get(this);
71
- if (!types) {
72
- types = new Map();
73
- targetWrappers.set(this, types);
74
- }
75
- let listeners = types.get(type);
76
- if (!listeners) {
77
- listeners = new WeakMap();
78
- types.set(type, listeners);
79
- }
80
- let wrapped = listeners.get(listener);
81
- if (!wrapped) {
82
- wrapped = wrap(listener);
83
- listeners.set(listener, wrapped);
84
- }
85
- return nativeAdd.call(this, type, wrapped, options);
86
- };
87
- proto.removeEventListener = function (type, listener, options) {
88
- if (typeof listener !== 'function') {
89
- return nativeRemove.call(this, type, listener, options);
90
- }
91
- const types = targetWrappers.get(this);
92
- if (types) {
93
- const listeners = types.get(type);
94
- if (listeners) {
95
- const wrapped = listeners.get(listener);
96
- if (wrapped) {
97
- return nativeRemove.call(this, type, wrapped, options);
98
- }
99
- }
100
- }
101
- return nativeRemove.call(this, type, listener, options);
102
- };
103
- }
104
- function patchOnProperties(proto) {
105
- if (!proto)
106
- return;
107
- for (const prop of Object.getOwnPropertyNames(proto)) {
108
- if (prop.startsWith('on')) {
109
- const desc = Object.getOwnPropertyDescriptor(proto, prop);
110
- if (desc && desc.set && desc.configurable) {
111
- const nativeSet = desc.set;
112
- Object.defineProperty(proto, prop, {
113
- ...desc,
114
- set: function (fn) {
115
- nativeSet.call(this, wrap(fn));
116
- },
117
- });
118
- }
119
- }
120
- }
121
- }
122
- if (typeof EventTarget !== 'undefined') {
123
- patchEventTarget(EventTarget.prototype);
124
- }
125
- const prototypesToPatch = [
126
- typeof EventTarget !== 'undefined' && EventTarget.prototype,
127
- typeof HTMLElement !== 'undefined' && HTMLElement.prototype,
128
- typeof Window !== 'undefined' && Window.prototype,
129
- typeof Document !== 'undefined' && Document.prototype,
130
- typeof MessagePort !== 'undefined' && MessagePort.prototype,
131
- typeof XMLHttpRequest !== 'undefined' && XMLHttpRequest.prototype,
132
- typeof IDBRequest !== 'undefined' && IDBRequest.prototype,
133
- typeof IDBTransaction !== 'undefined' && IDBTransaction.prototype,
134
- typeof IDBDatabase !== 'undefined' && IDBDatabase.prototype,
135
- typeof FileReader !== 'undefined' && FileReader.prototype,
136
- typeof AbortSignal !== 'undefined' && AbortSignal.prototype,
137
- ];
138
- for (const proto of prototypesToPatch) {
139
- if (proto) {
140
- patchOnProperties(proto);
141
- }
142
- }
143
60
  const GLOBAL_ORIGINALS = Symbol.for('mutts.originals');
144
61
  const GLOBAL_PROMISE = Symbol.for('mutts.OriginalPromise');
145
62
  let originals;
@@ -151,6 +68,7 @@ if (globalThis[GLOBAL_ORIGINALS]) {
151
68
  else {
152
69
  OriginalPromise = globalThis.Promise;
153
70
  originals = {
71
+ // biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching
154
72
  then: OriginalPromise.prototype.then,
155
73
  catch: OriginalPromise.prototype.catch,
156
74
  finally: OriginalPromise.prototype.finally,
@@ -261,6 +179,7 @@ PatchedPromise.any = ((values) => {
261
179
  // Note: OriginalPromise.prototype might be shared if we used the global one.
262
180
  // We must ensure we don't patch it twice if it's the SAME object.
263
181
  if (OriginalPromise.prototype.then !== patchedThen) {
182
+ // biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching
264
183
  OriginalPromise.prototype.then = patchedThen;
265
184
  OriginalPromise.prototype.catch = patchedCatch;
266
185
  OriginalPromise.prototype.finally = patchedFinally;
@@ -271,7 +190,7 @@ try {
271
190
  configurable: true,
272
191
  });
273
192
  }
274
- catch (e) { }
193
+ catch (_e) { }
275
194
  globalThis.Promise = PatchedPromise;
276
195
  globalThis.setTimeout = ((callback, ...args) => {
277
196
  return originals.setTimeout.call(globalThis, wrap(callback), ...args);
@@ -1 +1 @@
1
- {"version":3,"file":"browser.esm.js","sources":["../src/async/browser.ts"],"sourcesContent":["import { asyncHooks, hooks, type Restorer } from '.'\n\nconst promiseContexts = new WeakMap<Promise<any>, Set<Restorer>>()\n\n// [HACK]: Sanitization\n// If a Promise is created inside the zone, it carries the \"Sticky\" zone context.\n// If returned to the outer scope, that context leaks. We wrap it in a new Promise\n// created here (in the outer scope) to break the chain and sanitize the return value.\n// See BROWSER_ASYNC_POLYFILL.md for full details.\nasyncHooks.sanitizePromise = (res: any) => {\n\tif (res && typeof (res as any).then === 'function') {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tsetTimeout(() => {\n\t\t\t\t;(res as any).then(resolve, reject)\n\t\t\t}, 0)\n\t\t})\n\t}\n\treturn res\n}\n\nfunction captureRestorers() {\n\tconst restorers = new Set<Restorer>()\n\tfor (const hook of hooks) {\n\t\tconst restorer = hook()\n\t\tif (restorer) restorers.add(restorer)\n\t}\n\treturn restorers\n}\n\nfunction wrap<Args extends any[], R>(\n\tfn: ((...args: Args) => R) | null | undefined,\n\tcapturedRestorers?: Set<Restorer>\n) {\n\tif (typeof fn !== 'function') return fn\n\tconst restorers = capturedRestorers || captureRestorers()\n\treturn function (this: any, ...args: Args) {\n\t\tconst undoers: (() => void)[] = []\n\t\tfor (const restore of restorers) undoers.push(restore())\n\t\ttry {\n\t\t\treturn fn.apply(this, args)\n\t\t} finally {\n\t\t\tif (originals.queueMicrotask) {\n\t\t\t\t// Double microtask ensures we run after the first await resumption microtask\n\t\t\t\toriginals.queueMicrotask.call(globalThis, () => {\n\t\t\t\t\toriginals.queueMicrotask.call(globalThis, () => {\n\t\t\t\t\t\toriginals.queueMicrotask.call(globalThis, () => {\n\t\t\t\t\t\t\tfor (let i = undoers.length - 1; i >= 0; i--) undoers[i]()\n\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tfor (let i = undoers.length - 1; i >= 0; i--) undoers[i]()\n\t\t\t}\n\t\t}\n\t}\n}\n\nconst targetWrappers = new WeakMap<any, Map<string, WeakMap<Function, Function>>>()\n\nfunction patchEventTarget(proto: any) {\n\tif (!proto || !proto.addEventListener || !proto.removeEventListener) return\n\tconst nativeAdd = proto.addEventListener\n\tconst nativeRemove = proto.removeEventListener\n\n\tproto.addEventListener = function (this: any, type: string, listener: any, options: any) {\n\t\tif (typeof listener !== 'function') {\n\t\t\treturn nativeAdd.call(this, type, listener, options)\n\t\t}\n\n\t\tlet types = targetWrappers.get(this)\n\t\tif (!types) {\n\t\t\ttypes = new Map()\n\t\t\ttargetWrappers.set(this, types)\n\t\t}\n\t\tlet listeners = types.get(type)\n\t\tif (!listeners) {\n\t\t\tlisteners = new WeakMap()\n\t\t\ttypes.set(type, listeners)\n\t\t}\n\n\t\tlet wrapped = listeners.get(listener)\n\t\tif (!wrapped) {\n\t\t\twrapped = wrap(listener)\n\t\t\tlisteners.set(listener, wrapped)\n\t\t}\n\n\t\treturn nativeAdd.call(this, type, wrapped, options)\n\t}\n\n\tproto.removeEventListener = function (this: any, type: string, listener: any, options: any) {\n\t\tif (typeof listener !== 'function') {\n\t\t\treturn nativeRemove.call(this, type, listener, options)\n\t\t}\n\n\t\tconst types = targetWrappers.get(this)\n\t\tif (types) {\n\t\t\tconst listeners = types.get(type)\n\t\t\tif (listeners) {\n\t\t\t\tconst wrapped = listeners.get(listener)\n\t\t\t\tif (wrapped) {\n\t\t\t\t\treturn nativeRemove.call(this, type, wrapped, options)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn nativeRemove.call(this, type, listener, options)\n\t}\n}\n\nfunction patchOnProperties(proto: any) {\n\tif (!proto) return\n\tfor (const prop of Object.getOwnPropertyNames(proto)) {\n\t\tif (prop.startsWith('on')) {\n\t\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\t\tif (desc && desc.set && desc.configurable) {\n\t\t\t\tconst nativeSet = desc.set\n\t\t\t\tObject.defineProperty(proto, prop, {\n\t\t\t\t\t...desc,\n\t\t\t\t\tset: function (this: any, fn: any) {\n\t\t\t\t\t\tnativeSet.call(this, wrap(fn))\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n}\n\nif (typeof EventTarget !== 'undefined') {\n\tpatchEventTarget(EventTarget.prototype)\n}\n\nconst prototypesToPatch = [\n\ttypeof EventTarget !== 'undefined' && EventTarget.prototype,\n\ttypeof HTMLElement !== 'undefined' && HTMLElement.prototype,\n\ttypeof Window !== 'undefined' && Window.prototype,\n\ttypeof Document !== 'undefined' && Document.prototype,\n\ttypeof MessagePort !== 'undefined' && MessagePort.prototype,\n\ttypeof XMLHttpRequest !== 'undefined' && XMLHttpRequest.prototype,\n\ttypeof IDBRequest !== 'undefined' && IDBRequest.prototype,\n\ttypeof IDBTransaction !== 'undefined' && IDBTransaction.prototype,\n\ttypeof IDBDatabase !== 'undefined' && IDBDatabase.prototype,\n\ttypeof FileReader !== 'undefined' && FileReader.prototype,\n\ttypeof AbortSignal !== 'undefined' && AbortSignal.prototype,\n]\n\nfor (const proto of prototypesToPatch) {\n\tif (proto) {\n\t\tpatchOnProperties(proto)\n\t}\n}\n\nconst GLOBAL_ORIGINALS = Symbol.for('mutts.originals')\nconst GLOBAL_PROMISE = Symbol.for('mutts.OriginalPromise')\n\nlet originals: any\nlet OriginalPromise: any\n\nif ((globalThis as any)[GLOBAL_ORIGINALS]) {\n\toriginals = (globalThis as any)[GLOBAL_ORIGINALS]\n\tOriginalPromise = (globalThis as any)[GLOBAL_PROMISE]\n} else {\n\tOriginalPromise = globalThis.Promise\n\toriginals = {\n\t\tthen: OriginalPromise.prototype.then,\n\t\tcatch: OriginalPromise.prototype.catch,\n\t\tfinally: OriginalPromise.prototype.finally,\n\t\tresolve: OriginalPromise.resolve,\n\t\treject: OriginalPromise.reject,\n\t\tall: OriginalPromise.all,\n\t\tallSettled: (OriginalPromise as any).allSettled,\n\t\trace: OriginalPromise.race,\n\t\tany: (OriginalPromise as any).any,\n\t\tsetTimeout: globalThis.setTimeout,\n\t\tsetInterval: globalThis.setInterval,\n\t\tsetImmediate: (globalThis as any).setImmediate,\n\t\trequestAnimationFrame: (globalThis as any).requestAnimationFrame,\n\t\tqueueMicrotask: globalThis.queueMicrotask,\n\t}\n\t;(globalThis as any)[GLOBAL_ORIGINALS] = originals\n\t;(globalThis as any)[GLOBAL_PROMISE] = OriginalPromise\n}\n\n// Ensure modern statics are captured even if originals was cached from an older version\nif (!originals.allSettled) originals.allSettled = (OriginalPromise as any).allSettled\nif (!originals.any) originals.any = (OriginalPromise as any).any\nif (!originals.race) originals.race = OriginalPromise.race\n\nfunction patchedThen(this: any, onFulfilled: any, onRejected: any) {\n\tconst context = promiseContexts.get(this) || captureRestorers()\n\tconst nextPromise = originals.then.call(\n\t\tthis,\n\t\twrap(onFulfilled, context),\n\t\twrap(onRejected, context)\n\t)\n\tif (context.size > 0) promiseContexts.set(nextPromise, context)\n\treturn nextPromise\n}\n\nfunction patchedCatch(this: any, onRejected: any) {\n\tconst context = promiseContexts.get(this) || captureRestorers()\n\tconst nextPromise = originals.catch.call(this, wrap(onRejected, context))\n\tif (context.size > 0) promiseContexts.set(nextPromise, context)\n\treturn nextPromise\n}\n\nfunction patchedFinally(this: any, onFinally: any) {\n\tconst context = promiseContexts.get(this) || captureRestorers()\n\tconst nextPromise = originals.finally.call(this, wrap(onFinally, context))\n\tif (context.size > 0) promiseContexts.set(nextPromise, context)\n\treturn nextPromise\n}\n\nfunction PatchedPromise<T>(\n\tthis: any,\n\texecutor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void\n) {\n\tif (typeof executor === 'function') {\n\t\tconst p = new OriginalPromise((resolve, reject) => {\n\t\t\tconst wrappedResolve = wrap(resolve)\n\t\t\tconst wrappedReject = wrap(reject)\n\t\t\texecutor(wrappedResolve, wrappedReject)\n\t\t})\n\t\tconst context = captureRestorers()\n\t\tpromiseContexts.set(p, context) // Always set, even if empty (Sticky Root)\n\t\treturn p\n\t}\n\treturn new OriginalPromise(executor)\n}\n\n// Copy statics\nObject.assign(PatchedPromise, OriginalPromise as any)\n\n// Inherit prototype for instanceof checks\nPatchedPromise.prototype = OriginalPromise.prototype\n\nPatchedPromise.resolve = (<T>(value?: T | PromiseLike<T>): Promise<T> => {\n\tconst p = originals.resolve.call(OriginalPromise, value) as Promise<T>\n\tconst context = captureRestorers()\n\t// Ensure we don't overwrite if it already has context (e.g. from constructor)\n\tif (context.size > 0 && !promiseContexts.has(p)) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.reject = (<T = never>(reason?: any): Promise<T> => {\n\tconst p = originals.reject.call(OriginalPromise, reason) as Promise<T>\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.all = (<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]> => {\n\tconst p = originals.all.call(OriginalPromise, values) as Promise<Awaited<T>[]>\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.allSettled = (<T>(\n\tvalues: Iterable<T | PromiseLike<T>>\n): Promise<PromiseSettledResult<Awaited<T>>[]> => {\n\tconst p = (originals.allSettled as any).call(OriginalPromise, values)\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.race = (<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>> => {\n\tconst p = originals.race.call(OriginalPromise, values) as Promise<Awaited<T>>\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.any = (<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>> => {\n\tconst p = (originals.any as any).call(OriginalPromise, values)\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\n// Only apply patches if not already applied (or re-apply safely)\n// Note: OriginalPromise.prototype might be shared if we used the global one.\n// We must ensure we don't patch it twice if it's the SAME object.\nif (OriginalPromise.prototype.then !== patchedThen) {\n\tOriginalPromise.prototype.then = patchedThen as any\n\tOriginalPromise.prototype.catch = patchedCatch as any\n\tOriginalPromise.prototype.finally = patchedFinally as any\n}\n\ntry {\n\tObject.defineProperty(OriginalPromise, Symbol.species, {\n\t\tget: () => PatchedPromise,\n\t\tconfigurable: true,\n\t})\n} catch (e) {}\n\n;(globalThis as any).Promise = PatchedPromise\n\nglobalThis.setTimeout = ((callback: Function, ...args: any[]) => {\n\treturn originals.setTimeout.call(globalThis, wrap(callback as any), ...args)\n}) as any\n\nglobalThis.setInterval = ((callback: Function, ...args: any[]) => {\n\treturn originals.setInterval.call(globalThis, wrap(callback as any), ...args)\n}) as any\n\nif (originals.setImmediate) {\n\t;(globalThis as any).setImmediate = ((callback: Function, ...args: any[]) => {\n\t\treturn originals.setImmediate.call(globalThis, wrap(callback as any), ...args)\n\t}) as any\n}\n\nif (originals.requestAnimationFrame) {\n\tglobalThis.requestAnimationFrame = (callback: FrameRequestCallback) => {\n\t\treturn originals.requestAnimationFrame.call(globalThis, wrap(callback))\n\t}\n}\n\nif (originals.queueMicrotask) {\n\tglobalThis.queueMicrotask = (callback: VoidFunction): void => {\n\t\toriginals.queueMicrotask.call(globalThis, wrap(callback))\n\t}\n}\n"],"names":[],"mappings":";;;;AAEA,MAAM,eAAe,GAAG,IAAI,OAAO,EAA+B;AAElE;AACA;AACA;AACA;AACA;AACA,UAAU,CAAC,eAAe,GAAG,CAAC,GAAQ,KAAI;IACzC,IAAI,GAAG,IAAI,OAAQ,GAAW,CAAC,IAAI,KAAK,UAAU,EAAE;QACnD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;YACtC,UAAU,CAAC,MAAK;AACb,gBAAA,GAAW,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;YACpC,CAAC,EAAE,CAAC,CAAC;AACN,QA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CAAC,QAAkB,EAAE,GAAG,IAAW,KAAI;AAC3E,QAAA,OAAO,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAe,CAAC,EAAE,GAAG,IAAI,CAAC;AAC/E,IAAA,CAAC,CAAQ;AACV;AAEA,IAAI,SAAS,CAAC,qBAAqB,EAAE;AACpC,IAAA,UAAU,CAAC,qBAAqB,GAAG,CAAC,QAA8B,KAAI;AACrE,QAAA,OAAO,SAAS,CAAC,qBAAqB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;AACxE,IAAA,CAAC;AACF;AAEA,IAAI,SAAS,CAAC,cAAc,EAAE;AAC7B,IAAA,UAAU,CAAC,cAAc,GAAG,CAAC,QAAsB,KAAU;AAC5D,QAAA,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1D,IAAA,CAAC;AACF;;;;"}
1
+ {"version":3,"file":"browser.esm.js","sources":["../src/async/browser.ts"],"sourcesContent":["import { asyncHooks, hooks, type Restorer } from '.'\n\nconst promiseContexts = new WeakMap<Promise<any>, Set<Restorer>>()\n\n// [HACK]: Sanitization\n// If a Promise is created inside the zone, it carries the \"Sticky\" zone context.\n// If returned to the outer scope, that context leaks. We wrap it in a new Promise\n// created here (in the outer scope) to break the chain and sanitize the return value.\n// See BROWSER_ASYNC_POLYFILL.md for full details.\nasyncHooks.sanitizePromise = (res: any) => {\n\tif (res && typeof (res as any).then === 'function') {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tsetTimeout(() => {\n\t\t\t\t;(res as any).then(resolve, reject)\n\t\t\t}, 0)\n\t\t})\n\t}\n\treturn res\n}\n\nfunction captureRestorers() {\n\tconst restorers = new Set<Restorer>()\n\tfor (const hook of hooks) {\n\t\tconst restorer = hook()\n\t\tif (restorer) restorers.add(restorer)\n\t}\n\treturn restorers\n}\n\nfunction wrap<Args extends any[], R>(\n\tfn: ((...args: Args) => R) | null | undefined,\n\tcapturedRestorers?: Set<Restorer>\n) {\n\tif (typeof fn !== 'function') return fn\n\tconst restorers = capturedRestorers || captureRestorers()\n\treturn function (this: any, ...args: Args) {\n\t\tconst undoers: (() => void)[] = []\n\t\tfor (const restore of restorers) undoers.push(restore())\n\t\ttry {\n\t\t\treturn fn.apply(this, args)\n\t\t} finally {\n\t\t\tif (originals.queueMicrotask) {\n\t\t\t\t// Double microtask ensures we run after the first await resumption microtask\n\t\t\t\toriginals.queueMicrotask.call(globalThis, () => {\n\t\t\t\t\toriginals.queueMicrotask.call(globalThis, () => {\n\t\t\t\t\t\toriginals.queueMicrotask.call(globalThis, () => {\n\t\t\t\t\t\t\tfor (let i = undoers.length - 1; i >= 0; i--) undoers[i]()\n\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tfor (let i = undoers.length - 1; i >= 0; i--) undoers[i]()\n\t\t\t}\n\t\t}\n\t}\n}\n\nconst GLOBAL_ORIGINALS = Symbol.for('mutts.originals')\nconst GLOBAL_PROMISE = Symbol.for('mutts.OriginalPromise')\n\nlet originals: any\nlet OriginalPromise: any\n\nif ((globalThis as any)[GLOBAL_ORIGINALS]) {\n\toriginals = (globalThis as any)[GLOBAL_ORIGINALS]\n\tOriginalPromise = (globalThis as any)[GLOBAL_PROMISE]\n} else {\n\tOriginalPromise = globalThis.Promise\n\toriginals = {\n\t\t// biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching\n\t\tthen: OriginalPromise.prototype.then,\n\t\tcatch: OriginalPromise.prototype.catch,\n\t\tfinally: OriginalPromise.prototype.finally,\n\t\tresolve: OriginalPromise.resolve,\n\t\treject: OriginalPromise.reject,\n\t\tall: OriginalPromise.all,\n\t\tallSettled: (OriginalPromise as any).allSettled,\n\t\trace: OriginalPromise.race,\n\t\tany: (OriginalPromise as any).any,\n\t\tsetTimeout: globalThis.setTimeout,\n\t\tsetInterval: globalThis.setInterval,\n\t\tsetImmediate: (globalThis as any).setImmediate,\n\t\trequestAnimationFrame: (globalThis as any).requestAnimationFrame,\n\t\tqueueMicrotask: globalThis.queueMicrotask,\n\t}\n\t;(globalThis as any)[GLOBAL_ORIGINALS] = originals\n\t;(globalThis as any)[GLOBAL_PROMISE] = OriginalPromise\n}\n\n// Ensure modern statics are captured even if originals was cached from an older version\nif (!originals.allSettled) originals.allSettled = (OriginalPromise as any).allSettled\nif (!originals.any) originals.any = (OriginalPromise as any).any\nif (!originals.race) originals.race = OriginalPromise.race\n\nfunction patchedThen(this: any, onFulfilled: any, onRejected: any) {\n\tconst context = promiseContexts.get(this) || captureRestorers()\n\tconst nextPromise = originals.then.call(\n\t\tthis,\n\t\twrap(onFulfilled, context),\n\t\twrap(onRejected, context)\n\t)\n\tif (context.size > 0) promiseContexts.set(nextPromise, context)\n\treturn nextPromise\n}\n\nfunction patchedCatch(this: any, onRejected: any) {\n\tconst context = promiseContexts.get(this) || captureRestorers()\n\tconst nextPromise = originals.catch.call(this, wrap(onRejected, context))\n\tif (context.size > 0) promiseContexts.set(nextPromise, context)\n\treturn nextPromise\n}\n\nfunction patchedFinally(this: any, onFinally: any) {\n\tconst context = promiseContexts.get(this) || captureRestorers()\n\tconst nextPromise = originals.finally.call(this, wrap(onFinally, context))\n\tif (context.size > 0) promiseContexts.set(nextPromise, context)\n\treturn nextPromise\n}\n\nfunction PatchedPromise<T>(\n\tthis: any,\n\texecutor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void\n) {\n\tif (typeof executor === 'function') {\n\t\tconst p = new OriginalPromise((resolve, reject) => {\n\t\t\tconst wrappedResolve = wrap(resolve)\n\t\t\tconst wrappedReject = wrap(reject)\n\t\t\texecutor(wrappedResolve, wrappedReject)\n\t\t})\n\t\tconst context = captureRestorers()\n\t\tpromiseContexts.set(p, context) // Always set, even if empty (Sticky Root)\n\t\treturn p\n\t}\n\treturn new OriginalPromise(executor)\n}\n\n// Copy statics\nObject.assign(PatchedPromise, OriginalPromise as any)\n\n// Inherit prototype for instanceof checks\nPatchedPromise.prototype = OriginalPromise.prototype\n\nPatchedPromise.resolve = (<T>(value?: T | PromiseLike<T>): Promise<T> => {\n\tconst p = originals.resolve.call(OriginalPromise, value) as Promise<T>\n\tconst context = captureRestorers()\n\t// Ensure we don't overwrite if it already has context (e.g. from constructor)\n\tif (context.size > 0 && !promiseContexts.has(p)) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.reject = (<T = never>(reason?: any): Promise<T> => {\n\tconst p = originals.reject.call(OriginalPromise, reason) as Promise<T>\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.all = (<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]> => {\n\tconst p = originals.all.call(OriginalPromise, values) as Promise<Awaited<T>[]>\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.allSettled = (<T>(\n\tvalues: Iterable<T | PromiseLike<T>>\n): Promise<PromiseSettledResult<Awaited<T>>[]> => {\n\tconst p = (originals.allSettled as any).call(OriginalPromise, values)\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.race = (<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>> => {\n\tconst p = originals.race.call(OriginalPromise, values) as Promise<Awaited<T>>\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.any = (<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>> => {\n\tconst p = (originals.any as any).call(OriginalPromise, values)\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\n// Only apply patches if not already applied (or re-apply safely)\n// Note: OriginalPromise.prototype might be shared if we used the global one.\n// We must ensure we don't patch it twice if it's the SAME object.\nif (OriginalPromise.prototype.then !== patchedThen) {\n\t// biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching\n\tOriginalPromise.prototype.then = patchedThen as any\n\tOriginalPromise.prototype.catch = patchedCatch as any\n\tOriginalPromise.prototype.finally = patchedFinally as any\n}\n\ntry {\n\tObject.defineProperty(OriginalPromise, Symbol.species, {\n\t\tget: () => PatchedPromise,\n\t\tconfigurable: true,\n\t})\n} catch (_e) {}\n\n;(globalThis as any).Promise = PatchedPromise\n\nglobalThis.setTimeout = ((callback: Function, ...args: any[]) => {\n\treturn originals.setTimeout.call(globalThis, wrap(callback as any), ...args)\n}) as any\n\nglobalThis.setInterval = ((callback: Function, ...args: any[]) => {\n\treturn originals.setInterval.call(globalThis, wrap(callback as any), ...args)\n}) as any\n\nif (originals.setImmediate) {\n\t;(globalThis as any).setImmediate = ((callback: Function, ...args: any[]) => {\n\t\treturn originals.setImmediate.call(globalThis, wrap(callback as any), ...args)\n\t}) as any\n}\n\nif (originals.requestAnimationFrame) {\n\tglobalThis.requestAnimationFrame = (callback: FrameRequestCallback) => {\n\t\treturn originals.requestAnimationFrame.call(globalThis, wrap(callback))\n\t}\n}\n\nif (originals.queueMicrotask) {\n\tglobalThis.queueMicrotask = (callback: VoidFunction): void => {\n\t\toriginals.queueMicrotask.call(globalThis, wrap(callback))\n\t}\n}\n"],"names":[],"mappings":";;;;AAEA,MAAM,eAAe,GAAG,IAAI,OAAO,EAA+B;AAElE;AACA;AACA;AACA;AACA;AACA,UAAU,CAAC,eAAe,GAAG,CAAC,GAAQ,KAAI;IACzC,IAAI,GAAG,IAAI,OAAQ,GAAW,CAAC,IAAI,KAAK,UAAU,EAAE;QACnD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;YACtC,UAAU,CAAC,MAAK;AACb,gBAAA,GAAW,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;YACpC,CAAC,EAAE,CAAC,CAA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AAkB,EAAE,GAAG,IAAW,KAAI;AAChE,IAAA,OAAO,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAe,CAAC,EAAE,GAAG,IAAI,CAAC;AAC9E,CAAC,CAAQ;AAET,IAAI,SAAS,CAAC,YAAY,EAAE;IACzB,UAAkB,CAAC,YAAY,IAAI,CAAC,QAAkB,EAAE,GAAG,IAAW,KAAI;AAC3E,QAAA,OAAO,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAe,CAAC,EAAE,GAAG,IAAI,CAAC;AAC/E,IAAA,CAAC,CAAQ;AACV;AAEA,IAAI,SAAS,CAAC,qBAAqB,EAAE;AACpC,IAAA,UAAU,CAAC,qBAAqB,GAAG,CAAC,QAA8B,KAAI;AACrE,QAAA,OAAO,SAAS,CAAC,qBAAqB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;AACxE,IAAA,CAAC;AACF;AAEA,IAAI,SAAS,CAAC,cAAc,EAAE;AAC7B,IAAA,UAAU,CAAC,cAAc,GAAG,CAAC,QAAsB,KAAU;AAC5D,QAAA,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1D,IAAA,CAAC;AACF;;;;"}
@@ -57,89 +57,6 @@ function wrap(fn, capturedRestorers) {
57
57
  }
58
58
  };
59
59
  }
60
- const targetWrappers = new WeakMap();
61
- function patchEventTarget(proto) {
62
- if (!proto || !proto.addEventListener || !proto.removeEventListener)
63
- return;
64
- const nativeAdd = proto.addEventListener;
65
- const nativeRemove = proto.removeEventListener;
66
- proto.addEventListener = function (type, listener, options) {
67
- if (typeof listener !== 'function') {
68
- return nativeAdd.call(this, type, listener, options);
69
- }
70
- let types = targetWrappers.get(this);
71
- if (!types) {
72
- types = new Map();
73
- targetWrappers.set(this, types);
74
- }
75
- let listeners = types.get(type);
76
- if (!listeners) {
77
- listeners = new WeakMap();
78
- types.set(type, listeners);
79
- }
80
- let wrapped = listeners.get(listener);
81
- if (!wrapped) {
82
- wrapped = wrap(listener);
83
- listeners.set(listener, wrapped);
84
- }
85
- return nativeAdd.call(this, type, wrapped, options);
86
- };
87
- proto.removeEventListener = function (type, listener, options) {
88
- if (typeof listener !== 'function') {
89
- return nativeRemove.call(this, type, listener, options);
90
- }
91
- const types = targetWrappers.get(this);
92
- if (types) {
93
- const listeners = types.get(type);
94
- if (listeners) {
95
- const wrapped = listeners.get(listener);
96
- if (wrapped) {
97
- return nativeRemove.call(this, type, wrapped, options);
98
- }
99
- }
100
- }
101
- return nativeRemove.call(this, type, listener, options);
102
- };
103
- }
104
- function patchOnProperties(proto) {
105
- if (!proto)
106
- return;
107
- for (const prop of Object.getOwnPropertyNames(proto)) {
108
- if (prop.startsWith('on')) {
109
- const desc = Object.getOwnPropertyDescriptor(proto, prop);
110
- if (desc && desc.set && desc.configurable) {
111
- const nativeSet = desc.set;
112
- Object.defineProperty(proto, prop, {
113
- ...desc,
114
- set: function (fn) {
115
- nativeSet.call(this, wrap(fn));
116
- },
117
- });
118
- }
119
- }
120
- }
121
- }
122
- if (typeof EventTarget !== 'undefined') {
123
- patchEventTarget(EventTarget.prototype);
124
- }
125
- const prototypesToPatch = [
126
- typeof EventTarget !== 'undefined' && EventTarget.prototype,
127
- typeof HTMLElement !== 'undefined' && HTMLElement.prototype,
128
- typeof Window !== 'undefined' && Window.prototype,
129
- typeof Document !== 'undefined' && Document.prototype,
130
- typeof MessagePort !== 'undefined' && MessagePort.prototype,
131
- typeof XMLHttpRequest !== 'undefined' && XMLHttpRequest.prototype,
132
- typeof IDBRequest !== 'undefined' && IDBRequest.prototype,
133
- typeof IDBTransaction !== 'undefined' && IDBTransaction.prototype,
134
- typeof IDBDatabase !== 'undefined' && IDBDatabase.prototype,
135
- typeof FileReader !== 'undefined' && FileReader.prototype,
136
- typeof AbortSignal !== 'undefined' && AbortSignal.prototype,
137
- ];
138
- for (const proto of prototypesToPatch) {
139
- if (proto) {
140
- patchOnProperties(proto);
141
- }
142
- }
143
60
  const GLOBAL_ORIGINALS = Symbol.for('mutts.originals');
144
61
  const GLOBAL_PROMISE = Symbol.for('mutts.OriginalPromise');
145
62
  let originals;
@@ -151,6 +68,7 @@ if (globalThis[GLOBAL_ORIGINALS]) {
151
68
  else {
152
69
  OriginalPromise = globalThis.Promise;
153
70
  originals = {
71
+ // biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching
154
72
  then: OriginalPromise.prototype.then,
155
73
  catch: OriginalPromise.prototype.catch,
156
74
  finally: OriginalPromise.prototype.finally,
@@ -261,6 +179,7 @@ PatchedPromise.any = ((values) => {
261
179
  // Note: OriginalPromise.prototype might be shared if we used the global one.
262
180
  // We must ensure we don't patch it twice if it's the SAME object.
263
181
  if (OriginalPromise.prototype.then !== patchedThen) {
182
+ // biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching
264
183
  OriginalPromise.prototype.then = patchedThen;
265
184
  OriginalPromise.prototype.catch = patchedCatch;
266
185
  OriginalPromise.prototype.finally = patchedFinally;
@@ -271,7 +190,7 @@ try {
271
190
  configurable: true,
272
191
  });
273
192
  }
274
- catch (e) { }
193
+ catch (_e) { }
275
194
  globalThis.Promise = PatchedPromise;
276
195
  globalThis.setTimeout = ((callback, ...args) => {
277
196
  return originals.setTimeout.call(globalThis, wrap(callback), ...args);
@@ -294,4 +213,4 @@ if (originals.queueMicrotask) {
294
213
  originals.queueMicrotask.call(globalThis, wrap(callback));
295
214
  };
296
215
  }
297
- //# sourceMappingURL=async-browser-lvzLOCgk.cjs.map
216
+ //# sourceMappingURL=async-browser-BU_IfxYD.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-browser-BU_IfxYD.cjs","sources":["../../src/async/browser.ts"],"sourcesContent":["import { asyncHooks, hooks, type Restorer } from '.'\n\nconst promiseContexts = new WeakMap<Promise<any>, Set<Restorer>>()\n\n// [HACK]: Sanitization\n// If a Promise is created inside the zone, it carries the \"Sticky\" zone context.\n// If returned to the outer scope, that context leaks. We wrap it in a new Promise\n// created here (in the outer scope) to break the chain and sanitize the return value.\n// See BROWSER_ASYNC_POLYFILL.md for full details.\nasyncHooks.sanitizePromise = (res: any) => {\n\tif (res && typeof (res as any).then === 'function') {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tsetTimeout(() => {\n\t\t\t\t;(res as any).then(resolve, reject)\n\t\t\t}, 0)\n\t\t})\n\t}\n\treturn res\n}\n\nfunction captureRestorers() {\n\tconst restorers = new Set<Restorer>()\n\tfor (const hook of hooks) {\n\t\tconst restorer = hook()\n\t\tif (restorer) restorers.add(restorer)\n\t}\n\treturn restorers\n}\n\nfunction wrap<Args extends any[], R>(\n\tfn: ((...args: Args) => R) | null | undefined,\n\tcapturedRestorers?: Set<Restorer>\n) {\n\tif (typeof fn !== 'function') return fn\n\tconst restorers = capturedRestorers || captureRestorers()\n\treturn function (this: any, ...args: Args) {\n\t\tconst undoers: (() => void)[] = []\n\t\tfor (const restore of restorers) undoers.push(restore())\n\t\ttry {\n\t\t\treturn fn.apply(this, args)\n\t\t} finally {\n\t\t\tif (originals.queueMicrotask) {\n\t\t\t\t// Double microtask ensures we run after the first await resumption microtask\n\t\t\t\toriginals.queueMicrotask.call(globalThis, () => {\n\t\t\t\t\toriginals.queueMicrotask.call(globalThis, () => {\n\t\t\t\t\t\toriginals.queueMicrotask.call(globalThis, () => {\n\t\t\t\t\t\t\tfor (let i = undoers.length - 1; i >= 0; i--) undoers[i]()\n\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tfor (let i = undoers.length - 1; i >= 0; i--) undoers[i]()\n\t\t\t}\n\t\t}\n\t}\n}\n\nconst GLOBAL_ORIGINALS = Symbol.for('mutts.originals')\nconst GLOBAL_PROMISE = Symbol.for('mutts.OriginalPromise')\n\nlet originals: any\nlet OriginalPromise: any\n\nif ((globalThis as any)[GLOBAL_ORIGINALS]) {\n\toriginals = (globalThis as any)[GLOBAL_ORIGINALS]\n\tOriginalPromise = (globalThis as any)[GLOBAL_PROMISE]\n} else {\n\tOriginalPromise = globalThis.Promise\n\toriginals = {\n\t\t// biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching\n\t\tthen: OriginalPromise.prototype.then,\n\t\tcatch: OriginalPromise.prototype.catch,\n\t\tfinally: OriginalPromise.prototype.finally,\n\t\tresolve: OriginalPromise.resolve,\n\t\treject: OriginalPromise.reject,\n\t\tall: OriginalPromise.all,\n\t\tallSettled: (OriginalPromise as any).allSettled,\n\t\trace: OriginalPromise.race,\n\t\tany: (OriginalPromise as any).any,\n\t\tsetTimeout: globalThis.setTimeout,\n\t\tsetInterval: globalThis.setInterval,\n\t\tsetImmediate: (globalThis as any).setImmediate,\n\t\trequestAnimationFrame: (globalThis as any).requestAnimationFrame,\n\t\tqueueMicrotask: globalThis.queueMicrotask,\n\t}\n\t;(globalThis as any)[GLOBAL_ORIGINALS] = originals\n\t;(globalThis as any)[GLOBAL_PROMISE] = OriginalPromise\n}\n\n// Ensure modern statics are captured even if originals was cached from an older version\nif (!originals.allSettled) originals.allSettled = (OriginalPromise as any).allSettled\nif (!originals.any) originals.any = (OriginalPromise as any).any\nif (!originals.race) originals.race = OriginalPromise.race\n\nfunction patchedThen(this: any, onFulfilled: any, onRejected: any) {\n\tconst context = promiseContexts.get(this) || captureRestorers()\n\tconst nextPromise = originals.then.call(\n\t\tthis,\n\t\twrap(onFulfilled, context),\n\t\twrap(onRejected, context)\n\t)\n\tif (context.size > 0) promiseContexts.set(nextPromise, context)\n\treturn nextPromise\n}\n\nfunction patchedCatch(this: any, onRejected: any) {\n\tconst context = promiseContexts.get(this) || captureRestorers()\n\tconst nextPromise = originals.catch.call(this, wrap(onRejected, context))\n\tif (context.size > 0) promiseContexts.set(nextPromise, context)\n\treturn nextPromise\n}\n\nfunction patchedFinally(this: any, onFinally: any) {\n\tconst context = promiseContexts.get(this) || captureRestorers()\n\tconst nextPromise = originals.finally.call(this, wrap(onFinally, context))\n\tif (context.size > 0) promiseContexts.set(nextPromise, context)\n\treturn nextPromise\n}\n\nfunction PatchedPromise<T>(\n\tthis: any,\n\texecutor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void\n) {\n\tif (typeof executor === 'function') {\n\t\tconst p = new OriginalPromise((resolve, reject) => {\n\t\t\tconst wrappedResolve = wrap(resolve)\n\t\t\tconst wrappedReject = wrap(reject)\n\t\t\texecutor(wrappedResolve, wrappedReject)\n\t\t})\n\t\tconst context = captureRestorers()\n\t\tpromiseContexts.set(p, context) // Always set, even if empty (Sticky Root)\n\t\treturn p\n\t}\n\treturn new OriginalPromise(executor)\n}\n\n// Copy statics\nObject.assign(PatchedPromise, OriginalPromise as any)\n\n// Inherit prototype for instanceof checks\nPatchedPromise.prototype = OriginalPromise.prototype\n\nPatchedPromise.resolve = (<T>(value?: T | PromiseLike<T>): Promise<T> => {\n\tconst p = originals.resolve.call(OriginalPromise, value) as Promise<T>\n\tconst context = captureRestorers()\n\t// Ensure we don't overwrite if it already has context (e.g. from constructor)\n\tif (context.size > 0 && !promiseContexts.has(p)) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.reject = (<T = never>(reason?: any): Promise<T> => {\n\tconst p = originals.reject.call(OriginalPromise, reason) as Promise<T>\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.all = (<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]> => {\n\tconst p = originals.all.call(OriginalPromise, values) as Promise<Awaited<T>[]>\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.allSettled = (<T>(\n\tvalues: Iterable<T | PromiseLike<T>>\n): Promise<PromiseSettledResult<Awaited<T>>[]> => {\n\tconst p = (originals.allSettled as any).call(OriginalPromise, values)\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.race = (<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>> => {\n\tconst p = originals.race.call(OriginalPromise, values) as Promise<Awaited<T>>\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\nPatchedPromise.any = (<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>> => {\n\tconst p = (originals.any as any).call(OriginalPromise, values)\n\tconst context = captureRestorers()\n\tif (context.size > 0) promiseContexts.set(p, context)\n\treturn p\n}) as any\n\n// Only apply patches if not already applied (or re-apply safely)\n// Note: OriginalPromise.prototype might be shared if we used the global one.\n// We must ensure we don't patch it twice if it's the SAME object.\nif (OriginalPromise.prototype.then !== patchedThen) {\n\t// biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching\n\tOriginalPromise.prototype.then = patchedThen as any\n\tOriginalPromise.prototype.catch = patchedCatch as any\n\tOriginalPromise.prototype.finally = patchedFinally as any\n}\n\ntry {\n\tObject.defineProperty(OriginalPromise, Symbol.species, {\n\t\tget: () => PatchedPromise,\n\t\tconfigurable: true,\n\t})\n} catch (_e) {}\n\n;(globalThis as any).Promise = PatchedPromise\n\nglobalThis.setTimeout = ((callback: Function, ...args: any[]) => {\n\treturn originals.setTimeout.call(globalThis, wrap(callback as any), ...args)\n}) as any\n\nglobalThis.setInterval = ((callback: Function, ...args: any[]) => {\n\treturn originals.setInterval.call(globalThis, wrap(callback as any), ...args)\n}) as any\n\nif (originals.setImmediate) {\n\t;(globalThis as any).setImmediate = ((callback: Function, ...args: any[]) => {\n\t\treturn originals.setImmediate.call(globalThis, wrap(callback as any), ...args)\n\t}) as any\n}\n\nif (originals.requestAnimationFrame) {\n\tglobalThis.requestAnimationFrame = (callback: FrameRequestCallback) => {\n\t\treturn originals.requestAnimationFrame.call(globalThis, wrap(callback))\n\t}\n}\n\nif (originals.queueMicrotask) {\n\tglobalThis.queueMicrotask = (callback: VoidFunction): void => {\n\t\toriginals.queueMicrotask.call(globalThis, wrap(callback))\n\t}\n}\n"],"names":["asyncHooks","hooks"],"mappings":";;;;AAEA,MAAM,eAAe,GAAG,IAAI,OAAO,EAA+B;AAElE;AACA;AACA;AACA;AACA;AACAA,oBAAU,CAAC,eAAe,GAAG,CAAC,GAAQ,KAAI;IACzC,IAAI,GAAG,IAAI,OAAQ,GAAW,CAAC,IAAI,KAAK,UAAU,EAAE;QACnD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;YACtC,UAAU,CAAC,MAAK;AACb,gBAAA,GAAW,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;YACpC,CAAC,EAAE,CAAC,CAAC;AACN,QAAA,CAAC,CAAC;IACH;AACA,IAAA,OAAO,GAAG;AACX,CAAC;AAED,SAAS,gBAAgB,GAAA;AACxB,IAAA,MAAM,SAAS,GAAG,IAAI,GAAG,EAAY;AACrC,IAAA,KAAK,MAAM,IAAI,IAAIC,eAAK,EAAE;AACzB,QAAA,MAAM,QAAQ,GAAG,IAAI,EAAE;AACvB,QAAA,IAAI,QAAQ;AAAE,YAAA,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC;IACtC;AACA,IAAA,OAAO,SAAS;AACjB;AAEA,SAAS,IAAI,CACZ,EAA6C,EAC7C,iBAAiC,EAAA;IAEjC,IAAI,OAAO,EAAE,KAAK,UAAU;AAAE,QAAA,OAAO,EAAE;AACvC,IAAA,MAAM,SAAS,GAAG,iBAAiB,IAAI,gBAAgB,EAAE;IACzD,OAAO,UAAqB,GAAG,IAAU,EAAA;QACxC,MAAM,OAAO,GAAmB,EAAE;QAClC,KAAK,MAAM,OAAO,IAAI,SAAS;AAAE,YAAA,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;AACxD,QAAA,IAAI;YACH,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAA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,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1D,IAAA,CAAC;AACF;;"}
@@ -80,10 +80,12 @@ hook.enable();
80
80
  // Ensures V8 await resumptions are visible as .then callbacks, wrapping them to restore context.
81
81
  const OriginalPromise = globalThis.Promise;
82
82
  const originalMethods = {
83
+ // biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching
83
84
  then: OriginalPromise.prototype.then,
84
85
  catch: OriginalPromise.prototype.catch,
85
86
  finally: OriginalPromise.prototype.finally};
86
87
  // Patch prototype
88
+ // biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching
87
89
  OriginalPromise.prototype.then = function (onFulfilled, onRejected) {
88
90
  return originalMethods.then.call(this, wrap(onFulfilled), wrap(onRejected));
89
91
  };
@@ -93,4 +95,4 @@ OriginalPromise.prototype.catch = function (onRejected) {
93
95
  OriginalPromise.prototype.finally = function (onFinally) {
94
96
  return originalMethods.finally.call(this, wrap(onFinally));
95
97
  };
96
- //# sourceMappingURL=async-node-C3DeIb0y.cjs.map
98
+ //# sourceMappingURL=async-node-3PrbVAbB.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-node-3PrbVAbB.cjs","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\t// biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching\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\n// biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching\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":["hooks","createHook"],"mappings":";;;;;AAGA;AACA;AAEA,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAsB;AAC9C,MAAM,aAAa,GAAG,IAAI,GAAG,EAA0B;AAEvD;AACA,SAAS,gBAAgB,GAAA;AACxB,IAAA,IAAIA,eAAK,CAAC,IAAI,KAAK,CAAC;AAAE,QAAA,OAAO,EAAE;IAC/B,MAAM,SAAS,GAAe,EAAE;AAChC,IAAA,KAAK,MAAM,CAAC,IAAIA,eAAK,EAAE;AACtB,QAAA,MAAM,CAAC,GAAG,CAAC,EAAE;AACb,QAAA,IAAI,CAAC;AAAE,YAAA,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACzB;AACA,IAAA,OAAO,SAAS;AACjB;AAEA;AACA,SAAS,IAAI,CAAwB,EAA6C,EAAA;IACjF,IAAI,OAAO,EAAE,KAAK,UAAU;AAAE,QAAA,OAAO,EAAE;AACvC,IAAA,MAAM,SAAS,GAAG,gBAAgB,EAAE;AACpC,IAAA,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,EAAE;IAErC,OAAO,UAAqB,GAAG,IAAU,EAAA;QACxC,MAAM,OAAO,GAAmB,EAAE;AAClC,QAAA,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE;AAChC,YAAA,MAAM,CAAC,GAAG,OAAO,EAAE;AACnB,YAAA,IAAI,CAAC;AAAE,gBAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACvB;AACA,QAAA,IAAI;YACH,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;QAC5B;gBAAU;AACT,YAAA,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