mutts 1.0.8 → 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.
- package/README.md +77 -35
- package/dist/browser.cjs +2144 -5355
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +2 -1655
- package/dist/browser.dev.cjs +110 -0
- package/dist/browser.dev.cjs.map +1 -0
- package/dist/browser.dev.d.ts +2 -0
- package/dist/browser.dev.esm.js +5 -0
- package/dist/browser.dev.esm.js.map +1 -0
- package/dist/browser.esm.js +20 -107
- package/dist/browser.esm.js.map +1 -1
- package/dist/chunks/{async-browser-CA0jPWIi.cjs → async-browser-BU_IfxYD.cjs} +19 -107
- package/dist/chunks/async-browser-BU_IfxYD.cjs.map +1 -0
- package/dist/chunks/{async-core-UqHzvJ-S.cjs → async-core-CRLKP3l-.cjs} +8 -4
- package/dist/chunks/async-core-CRLKP3l-.cjs.map +1 -0
- package/dist/chunks/{async-node-BYHuGTni.cjs → async-node-3PrbVAbB.cjs} +7 -12
- package/dist/chunks/async-node-3PrbVAbB.cjs.map +1 -0
- package/dist/chunks/index-CaaQQlPJ.esm.js +3174 -0
- package/dist/chunks/index-CaaQQlPJ.esm.js.map +1 -0
- package/dist/chunks/node-nKJBk8iJ.esm.js +96 -0
- package/dist/chunks/node-nKJBk8iJ.esm.js.map +1 -0
- package/dist/chunks/proxy-Dtg-bJ3T.cjs +3763 -0
- package/dist/chunks/proxy-Dtg-bJ3T.cjs.map +1 -0
- package/dist/chunks/proxy-r7lARftl.esm.js +3701 -0
- package/dist/chunks/proxy-r7lARftl.esm.js.map +1 -0
- package/dist/debug.cjs +980 -0
- package/dist/debug.cjs.map +1 -0
- package/dist/debug.d.ts +208 -0
- package/dist/debug.esm.js +950 -0
- package/dist/debug.esm.js.map +1 -0
- package/dist/devtools/manifest.json +1 -1
- package/dist/devtools/panel.html +1 -1
- package/dist/devtools/panel.js +107 -94
- package/dist/devtools/panel.js.map +1 -1
- package/dist/index.d.ts +1447 -13
- package/dist/mutts.umd.js +7167 -1
- package/dist/mutts.umd.js.map +1 -1
- package/dist/mutts.umd.min.js +1 -1
- package/dist/mutts.umd.min.js.map +1 -1
- package/dist/node.cjs +70 -66
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +2 -1
- package/dist/node.dev.cjs +110 -0
- package/dist/node.dev.cjs.map +1 -0
- package/dist/node.dev.d.ts +2 -0
- package/dist/node.dev.esm.js +6 -0
- package/dist/node.dev.esm.js.map +1 -0
- package/dist/node.esm.js +4 -103
- package/dist/node.esm.js.map +1 -1
- package/dist/{reactive/types.d.ts → types-W5vD6m2n.d.ts} +186 -93
- package/docs/ai/api-reference.md +12 -19
- package/docs/ai/manual.md +521 -17
- package/docs/events.md +57 -2
- package/docs/flavored.md +210 -0
- package/docs/reactive/advanced.md +314 -5
- package/docs/reactive/attend.md +142 -0
- package/docs/reactive/collections.md +76 -39
- package/docs/reactive/core.md +100 -14
- package/docs/reactive/debugging.md +123 -18
- package/docs/reactive/error-handling.md +121 -0
- package/docs/reactive/resource.md +125 -0
- package/docs/reactive/scan.md +247 -1
- package/docs/reactive.md +4 -1
- package/docs/std-decorators.md +102 -51
- package/docs/utils.md +70 -0
- package/docs/zone.md +3 -7
- package/package.json +64 -30
- package/dist/async/browser.d.ts +0 -2
- package/dist/async/browser.d.ts.map +0 -1
- package/dist/async/index.d.ts +0 -18
- package/dist/async/index.d.ts.map +0 -1
- package/dist/async/node.d.ts +0 -2
- package/dist/async/node.d.ts.map +0 -1
- package/dist/chunks/async-browser-CA0jPWIi.cjs.map +0 -1
- package/dist/chunks/async-core-UqHzvJ-S.cjs.map +0 -1
- package/dist/chunks/async-node-BYHuGTni.cjs.map +0 -1
- package/dist/chunks/index-DhaOVusv.esm.js +0 -6411
- package/dist/chunks/index-DhaOVusv.esm.js.map +0 -1
- package/dist/decorator.d.ts +0 -106
- package/dist/decorator.d.ts.map +0 -1
- package/dist/destroyable.d.ts +0 -87
- package/dist/destroyable.d.ts.map +0 -1
- package/dist/entry-browser.d.ts +0 -3
- package/dist/entry-browser.d.ts.map +0 -1
- package/dist/entry-node.d.ts +0 -3
- package/dist/entry-node.d.ts.map +0 -1
- package/dist/eventful.d.ts +0 -18
- package/dist/eventful.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/indexable.d.ts +0 -243
- package/dist/indexable.d.ts.map +0 -1
- package/dist/introspection.d.ts +0 -27
- package/dist/introspection.d.ts.map +0 -1
- package/dist/iterableWeak.d.ts +0 -53
- package/dist/iterableWeak.d.ts.map +0 -1
- package/dist/mixins.d.ts +0 -25
- package/dist/mixins.d.ts.map +0 -1
- package/dist/promiseChain.d.ts +0 -20
- package/dist/promiseChain.d.ts.map +0 -1
- package/dist/reactive/array.d.ts +0 -49
- package/dist/reactive/array.d.ts.map +0 -1
- package/dist/reactive/buffer.d.ts +0 -44
- package/dist/reactive/buffer.d.ts.map +0 -1
- package/dist/reactive/change.d.ts +0 -29
- package/dist/reactive/change.d.ts.map +0 -1
- package/dist/reactive/debug.d.ts +0 -111
- package/dist/reactive/debug.d.ts.map +0 -1
- package/dist/reactive/deep-touch.d.ts +0 -28
- package/dist/reactive/deep-touch.d.ts.map +0 -1
- package/dist/reactive/deep-watch-state.d.ts +0 -25
- package/dist/reactive/deep-watch-state.d.ts.map +0 -1
- package/dist/reactive/deep-watch.d.ts +0 -19
- package/dist/reactive/deep-watch.d.ts.map +0 -1
- package/dist/reactive/effect-context.d.ts +0 -7
- package/dist/reactive/effect-context.d.ts.map +0 -1
- package/dist/reactive/effects.d.ts +0 -151
- package/dist/reactive/effects.d.ts.map +0 -1
- package/dist/reactive/index.d.ts +0 -20
- package/dist/reactive/index.d.ts.map +0 -1
- package/dist/reactive/interface.d.ts +0 -64
- package/dist/reactive/interface.d.ts.map +0 -1
- package/dist/reactive/map.d.ts +0 -30
- package/dist/reactive/map.d.ts.map +0 -1
- package/dist/reactive/memoize.d.ts +0 -5
- package/dist/reactive/memoize.d.ts.map +0 -1
- package/dist/reactive/non-reactive-state.d.ts +0 -9
- package/dist/reactive/non-reactive-state.d.ts.map +0 -1
- package/dist/reactive/non-reactive.d.ts +0 -11
- package/dist/reactive/non-reactive.d.ts.map +0 -1
- package/dist/reactive/project.d.ts +0 -41
- package/dist/reactive/project.d.ts.map +0 -1
- package/dist/reactive/proxy-state.d.ts +0 -8
- package/dist/reactive/proxy-state.d.ts.map +0 -1
- package/dist/reactive/proxy.d.ts +0 -23
- package/dist/reactive/proxy.d.ts.map +0 -1
- package/dist/reactive/record.d.ts +0 -116
- package/dist/reactive/record.d.ts.map +0 -1
- package/dist/reactive/register.d.ts +0 -64
- package/dist/reactive/register.d.ts.map +0 -1
- package/dist/reactive/registry.d.ts +0 -20
- package/dist/reactive/registry.d.ts.map +0 -1
- package/dist/reactive/set.d.ts +0 -28
- package/dist/reactive/set.d.ts.map +0 -1
- package/dist/reactive/tracking.d.ts +0 -7
- package/dist/reactive/tracking.d.ts.map +0 -1
- package/dist/reactive/types.d.ts.map +0 -1
- package/dist/std-decorators.d.ts +0 -50
- package/dist/std-decorators.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -49
- package/dist/utils.d.ts.map +0 -1
- package/dist/zone.d.ts +0 -40
- package/dist/zone.d.ts.map +0 -1
- package/docs/reactive/project.md +0 -93
- package/src/async/browser.ts +0 -319
- package/src/async/index.ts +0 -23
- package/src/async/node.ts +0 -104
- package/src/decorator.ts +0 -272
- package/src/destroyable.ts +0 -199
- package/src/entry-browser.ts +0 -5
- package/src/entry-node.ts +0 -5
- package/src/eventful.ts +0 -77
- package/src/index.d.ts +0 -12
- package/src/index.ts +0 -64
- package/src/indexable.ts +0 -526
- package/src/introspection.ts +0 -59
- package/src/iterableWeak.ts +0 -233
- package/src/mixins.ts +0 -123
- package/src/promiseChain.ts +0 -110
- package/src/reactive/array.ts +0 -507
- package/src/reactive/buffer.ts +0 -168
- package/src/reactive/change.ts +0 -138
- package/src/reactive/debug.ts +0 -517
- package/src/reactive/deep-touch.ts +0 -268
- package/src/reactive/deep-watch-state.ts +0 -82
- package/src/reactive/deep-watch.ts +0 -168
- package/src/reactive/effect-context.ts +0 -18
- package/src/reactive/effects.ts +0 -1382
- package/src/reactive/index.ts +0 -75
- package/src/reactive/interface.ts +0 -210
- package/src/reactive/map.ts +0 -158
- package/src/reactive/memoize.ts +0 -163
- package/src/reactive/non-reactive-state.ts +0 -49
- package/src/reactive/non-reactive.ts +0 -43
- package/src/reactive/project.ts +0 -453
- package/src/reactive/proxy-state.ts +0 -27
- package/src/reactive/proxy.ts +0 -264
- package/src/reactive/record.ts +0 -196
- package/src/reactive/register.ts +0 -419
- package/src/reactive/registry.ts +0 -59
- package/src/reactive/set.ts +0 -130
- package/src/reactive/tracking.ts +0 -44
- package/src/reactive/types.ts +0 -440
- package/src/std-decorators.ts +0 -217
- package/src/utils.ts +0 -301
- package/src/zone.ts +0 -138
|
@@ -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":";;;"}
|
package/dist/browser.esm.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AZone,
|
|
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';
|
|
3
4
|
|
|
4
|
-
const hooks = new Set();
|
|
5
5
|
const promiseContexts = new WeakMap();
|
|
6
|
-
asyncHooks.addHook = function (hook) {
|
|
7
|
-
hooks.add(hook);
|
|
8
|
-
return () => {
|
|
9
|
-
hooks.delete(hook);
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
6
|
// [HACK]: Sanitization
|
|
13
7
|
// If a Promise is created inside the zone, it carries the "Sticky" zone context.
|
|
14
8
|
// If returned to the outer scope, that context leaks. We wrap it in a new Promise
|
|
@@ -63,89 +57,6 @@ function wrap(fn, capturedRestorers) {
|
|
|
63
57
|
}
|
|
64
58
|
};
|
|
65
59
|
}
|
|
66
|
-
const targetWrappers = new WeakMap();
|
|
67
|
-
function patchEventTarget(proto) {
|
|
68
|
-
if (!proto || !proto.addEventListener || !proto.removeEventListener)
|
|
69
|
-
return;
|
|
70
|
-
const nativeAdd = proto.addEventListener;
|
|
71
|
-
const nativeRemove = proto.removeEventListener;
|
|
72
|
-
proto.addEventListener = function (type, listener, options) {
|
|
73
|
-
if (typeof listener !== 'function') {
|
|
74
|
-
return nativeAdd.call(this, type, listener, options);
|
|
75
|
-
}
|
|
76
|
-
let types = targetWrappers.get(this);
|
|
77
|
-
if (!types) {
|
|
78
|
-
types = new Map();
|
|
79
|
-
targetWrappers.set(this, types);
|
|
80
|
-
}
|
|
81
|
-
let listeners = types.get(type);
|
|
82
|
-
if (!listeners) {
|
|
83
|
-
listeners = new WeakMap();
|
|
84
|
-
types.set(type, listeners);
|
|
85
|
-
}
|
|
86
|
-
let wrapped = listeners.get(listener);
|
|
87
|
-
if (!wrapped) {
|
|
88
|
-
wrapped = wrap(listener);
|
|
89
|
-
listeners.set(listener, wrapped);
|
|
90
|
-
}
|
|
91
|
-
return nativeAdd.call(this, type, wrapped, options);
|
|
92
|
-
};
|
|
93
|
-
proto.removeEventListener = function (type, listener, options) {
|
|
94
|
-
if (typeof listener !== 'function') {
|
|
95
|
-
return nativeRemove.call(this, type, listener, options);
|
|
96
|
-
}
|
|
97
|
-
const types = targetWrappers.get(this);
|
|
98
|
-
if (types) {
|
|
99
|
-
const listeners = types.get(type);
|
|
100
|
-
if (listeners) {
|
|
101
|
-
const wrapped = listeners.get(listener);
|
|
102
|
-
if (wrapped) {
|
|
103
|
-
return nativeRemove.call(this, type, wrapped, options);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return nativeRemove.call(this, type, listener, options);
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
function patchOnProperties(proto) {
|
|
111
|
-
if (!proto)
|
|
112
|
-
return;
|
|
113
|
-
for (const prop of Object.getOwnPropertyNames(proto)) {
|
|
114
|
-
if (prop.startsWith('on')) {
|
|
115
|
-
const desc = Object.getOwnPropertyDescriptor(proto, prop);
|
|
116
|
-
if (desc && desc.set && desc.configurable) {
|
|
117
|
-
const nativeSet = desc.set;
|
|
118
|
-
Object.defineProperty(proto, prop, {
|
|
119
|
-
...desc,
|
|
120
|
-
set: function (fn) {
|
|
121
|
-
nativeSet.call(this, wrap(fn));
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
if (typeof EventTarget !== 'undefined') {
|
|
129
|
-
patchEventTarget(EventTarget.prototype);
|
|
130
|
-
}
|
|
131
|
-
const prototypesToPatch = [
|
|
132
|
-
typeof EventTarget !== 'undefined' && EventTarget.prototype,
|
|
133
|
-
typeof HTMLElement !== 'undefined' && HTMLElement.prototype,
|
|
134
|
-
typeof Window !== 'undefined' && Window.prototype,
|
|
135
|
-
typeof Document !== 'undefined' && Document.prototype,
|
|
136
|
-
typeof MessagePort !== 'undefined' && MessagePort.prototype,
|
|
137
|
-
typeof XMLHttpRequest !== 'undefined' && XMLHttpRequest.prototype,
|
|
138
|
-
typeof IDBRequest !== 'undefined' && IDBRequest.prototype,
|
|
139
|
-
typeof IDBTransaction !== 'undefined' && IDBTransaction.prototype,
|
|
140
|
-
typeof IDBDatabase !== 'undefined' && IDBDatabase.prototype,
|
|
141
|
-
typeof FileReader !== 'undefined' && FileReader.prototype,
|
|
142
|
-
typeof AbortSignal !== 'undefined' && AbortSignal.prototype,
|
|
143
|
-
];
|
|
144
|
-
for (const proto of prototypesToPatch) {
|
|
145
|
-
if (proto) {
|
|
146
|
-
patchOnProperties(proto);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
60
|
const GLOBAL_ORIGINALS = Symbol.for('mutts.originals');
|
|
150
61
|
const GLOBAL_PROMISE = Symbol.for('mutts.OriginalPromise');
|
|
151
62
|
let originals;
|
|
@@ -157,6 +68,7 @@ if (globalThis[GLOBAL_ORIGINALS]) {
|
|
|
157
68
|
else {
|
|
158
69
|
OriginalPromise = globalThis.Promise;
|
|
159
70
|
originals = {
|
|
71
|
+
// biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching
|
|
160
72
|
then: OriginalPromise.prototype.then,
|
|
161
73
|
catch: OriginalPromise.prototype.catch,
|
|
162
74
|
finally: OriginalPromise.prototype.finally,
|
|
@@ -220,53 +132,54 @@ function PatchedPromise(executor) {
|
|
|
220
132
|
Object.assign(PatchedPromise, OriginalPromise);
|
|
221
133
|
// Inherit prototype for instanceof checks
|
|
222
134
|
PatchedPromise.prototype = OriginalPromise.prototype;
|
|
223
|
-
PatchedPromise.resolve =
|
|
135
|
+
PatchedPromise.resolve = ((value) => {
|
|
224
136
|
const p = originals.resolve.call(OriginalPromise, value);
|
|
225
137
|
const context = captureRestorers();
|
|
226
138
|
// Ensure we don't overwrite if it already has context (e.g. from constructor)
|
|
227
139
|
if (context.size > 0 && !promiseContexts.has(p))
|
|
228
140
|
promiseContexts.set(p, context);
|
|
229
141
|
return p;
|
|
230
|
-
};
|
|
231
|
-
PatchedPromise.reject =
|
|
142
|
+
});
|
|
143
|
+
PatchedPromise.reject = ((reason) => {
|
|
232
144
|
const p = originals.reject.call(OriginalPromise, reason);
|
|
233
145
|
const context = captureRestorers();
|
|
234
146
|
if (context.size > 0)
|
|
235
147
|
promiseContexts.set(p, context);
|
|
236
148
|
return p;
|
|
237
|
-
};
|
|
238
|
-
PatchedPromise.all =
|
|
149
|
+
});
|
|
150
|
+
PatchedPromise.all = ((values) => {
|
|
239
151
|
const p = originals.all.call(OriginalPromise, values);
|
|
240
152
|
const context = captureRestorers();
|
|
241
153
|
if (context.size > 0)
|
|
242
154
|
promiseContexts.set(p, context);
|
|
243
155
|
return p;
|
|
244
|
-
};
|
|
245
|
-
PatchedPromise.allSettled =
|
|
156
|
+
});
|
|
157
|
+
PatchedPromise.allSettled = ((values) => {
|
|
246
158
|
const p = originals.allSettled.call(OriginalPromise, values);
|
|
247
159
|
const context = captureRestorers();
|
|
248
160
|
if (context.size > 0)
|
|
249
161
|
promiseContexts.set(p, context);
|
|
250
162
|
return p;
|
|
251
|
-
};
|
|
252
|
-
PatchedPromise.race =
|
|
163
|
+
});
|
|
164
|
+
PatchedPromise.race = ((values) => {
|
|
253
165
|
const p = originals.race.call(OriginalPromise, values);
|
|
254
166
|
const context = captureRestorers();
|
|
255
167
|
if (context.size > 0)
|
|
256
168
|
promiseContexts.set(p, context);
|
|
257
169
|
return p;
|
|
258
|
-
};
|
|
259
|
-
PatchedPromise.any =
|
|
170
|
+
});
|
|
171
|
+
PatchedPromise.any = ((values) => {
|
|
260
172
|
const p = originals.any.call(OriginalPromise, values);
|
|
261
173
|
const context = captureRestorers();
|
|
262
174
|
if (context.size > 0)
|
|
263
175
|
promiseContexts.set(p, context);
|
|
264
176
|
return p;
|
|
265
|
-
};
|
|
177
|
+
});
|
|
266
178
|
// Only apply patches if not already applied (or re-apply safely)
|
|
267
179
|
// Note: OriginalPromise.prototype might be shared if we used the global one.
|
|
268
180
|
// We must ensure we don't patch it twice if it's the SAME object.
|
|
269
181
|
if (OriginalPromise.prototype.then !== patchedThen) {
|
|
182
|
+
// biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching
|
|
270
183
|
OriginalPromise.prototype.then = patchedThen;
|
|
271
184
|
OriginalPromise.prototype.catch = patchedCatch;
|
|
272
185
|
OriginalPromise.prototype.finally = patchedFinally;
|
|
@@ -274,10 +187,10 @@ if (OriginalPromise.prototype.then !== patchedThen) {
|
|
|
274
187
|
try {
|
|
275
188
|
Object.defineProperty(OriginalPromise, Symbol.species, {
|
|
276
189
|
get: () => PatchedPromise,
|
|
277
|
-
configurable: true
|
|
190
|
+
configurable: true,
|
|
278
191
|
});
|
|
279
192
|
}
|
|
280
|
-
catch (
|
|
193
|
+
catch (_e) { }
|
|
281
194
|
globalThis.Promise = PatchedPromise;
|
|
282
195
|
globalThis.setTimeout = ((callback, ...args) => {
|
|
283
196
|
return originals.setTimeout.call(globalThis, wrap(callback), ...args);
|
|
@@ -301,5 +214,5 @@ if (originals.queueMicrotask) {
|
|
|
301
214
|
};
|
|
302
215
|
}
|
|
303
216
|
|
|
304
|
-
export { asyncHooks };
|
|
217
|
+
export { asyncHooks, hooks };
|
|
305
218
|
//# sourceMappingURL=browser.esm.js.map
|
package/dist/browser.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.esm.js","sources":["../src/async/browser.ts"],"sourcesContent":["import { Hook, Restorer, asyncHooks } from '.'\n\nconst hooks = new Set<Hook>()\nconst promiseContexts = new WeakMap<Promise<any>, Set<Restorer>>()\n\nasyncHooks.addHook = function (hook: Hook) {\n\thooks.add(hook)\n\treturn () => {\n\t\thooks.delete(hook)\n\t}\n}\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 if (res && typeof (res as any).then === 'function') {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n (res as any).then(resolve, reject)\n }, 0)\n })\n }\n return 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>(fn: ((...args: Args) => R) | null | undefined, capturedRestorers?: Set<Restorer>) {\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\t\t\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\t\t\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 originals = (globalThis as any)[GLOBAL_ORIGINALS];\n OriginalPromise = (globalThis as any)[GLOBAL_PROMISE];\n} else {\n OriginalPromise = globalThis.Promise;\n originals = {\n then: OriginalPromise.prototype.then,\n catch: OriginalPromise.prototype.catch,\n finally: OriginalPromise.prototype.finally,\n resolve: OriginalPromise.resolve,\n reject: OriginalPromise.reject,\n all: OriginalPromise.all,\n allSettled: (OriginalPromise as any).allSettled,\n race: OriginalPromise.race,\n any: (OriginalPromise as any).any,\n setTimeout: globalThis.setTimeout,\n setInterval: globalThis.setInterval,\n setImmediate: (globalThis as any).setImmediate,\n requestAnimationFrame: (globalThis as any).requestAnimationFrame,\n queueMicrotask: globalThis.queueMicrotask,\n };\n (globalThis as any)[GLOBAL_ORIGINALS] = originals;\n (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(this, wrap(onFulfilled, context), wrap(onRejected, context))\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>(this: any, executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void) {\n if (typeof executor === 'function') {\n const p = new OriginalPromise((resolve, reject) => {\n const wrappedResolve = wrap(resolve)\n const wrappedReject = wrap(reject)\n executor(wrappedResolve, wrappedReject)\n })\n const context = captureRestorers()\n promiseContexts.set(p, context) // Always set, even if empty (Sticky Root)\n return p\n }\n return 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 = function<T>(value?: T | PromiseLike<T>): Promise<T> {\n const p = originals.resolve.call(OriginalPromise, value) as Promise<T>\n const context = captureRestorers()\n // Ensure we don't overwrite if it already has context (e.g. from constructor)\n if (context.size > 0 && !promiseContexts.has(p)) promiseContexts.set(p, context)\n return p\n} as any\n\nPatchedPromise.reject = function<T = never>(reason?: any): Promise<T> {\n const p = originals.reject.call(OriginalPromise, reason) as Promise<T>\n const context = captureRestorers()\n if (context.size > 0) promiseContexts.set(p, context)\n return p\n} as any\n\nPatchedPromise.all = function<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]> {\n const p = originals.all.call(OriginalPromise, values) as Promise<Awaited<T>[]>\n const context = captureRestorers()\n if (context.size > 0) promiseContexts.set(p, context)\n return p\n} as any\n\nPatchedPromise.allSettled = function<T>(values: Iterable<T | PromiseLike<T>>): Promise<PromiseSettledResult<Awaited<T>>[]> {\n const p = (originals.allSettled as any).call(OriginalPromise, values)\n const context = captureRestorers()\n if (context.size > 0) promiseContexts.set(p, context)\n return p\n} as any\n\nPatchedPromise.race = function<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>> {\n const p = originals.race.call(OriginalPromise, values) as Promise<Awaited<T>>\n const context = captureRestorers()\n if (context.size > 0) promiseContexts.set(p, context)\n return p\n} as any\n\nPatchedPromise.any = function<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>> {\n const p = (originals.any as any).call(OriginalPromise, values)\n const context = captureRestorers()\n if (context.size > 0) promiseContexts.set(p, context)\n return 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 OriginalPromise.prototype.then = patchedThen as any\n OriginalPromise.prototype.catch = patchedCatch as any\n OriginalPromise.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,KAAK,GAAG,IAAI,GAAG,EAAQ;AAC7B,MAAM,eAAe,GAAG,IAAI,OAAO,EAA+B;AAElE,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;AAED;AACA;AACA;AACA;AACA;AACA,UAAU,CAAC,eAAe,GAAG,CAAC,GAAQ,KAAI;IACtC,IAAI,GAAG,IAAI,OAAQ,GAAW,CAAC,IAAI,KAAK,UAAU,EAAE;QAChD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;YACnC,UAAU,CAAC,MAAK;AACX,gBAAA,GAAW,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;YACtC,CAAC,EAAE,CAAC,CAAC;AACT,QAAA,CAAC,CAAC;IACN;AACA,IAAA,OAAO,GAAG;AACd,CAAC;AAED,SAAS,gBAAgB,GAAA;AACxB,IAAA,MAAM,SAAS,GAAG,IAAI,GAAG,EAAY;AACrC,IAAA,KAAK,MAAM,IAAI,IAAI,KAAK,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,CA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AAC;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,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,IAAI,KAAK,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,E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C/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,15 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var asyncCore = require('./async-core-
|
|
3
|
+
var asyncCore = require('./async-core-CRLKP3l-.cjs');
|
|
4
4
|
|
|
5
|
-
const hooks = new Set();
|
|
6
5
|
const promiseContexts = new WeakMap();
|
|
7
|
-
asyncCore.asyncHooks.addHook = function (hook) {
|
|
8
|
-
hooks.add(hook);
|
|
9
|
-
return () => {
|
|
10
|
-
hooks.delete(hook);
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
6
|
// [HACK]: Sanitization
|
|
14
7
|
// If a Promise is created inside the zone, it carries the "Sticky" zone context.
|
|
15
8
|
// If returned to the outer scope, that context leaks. We wrap it in a new Promise
|
|
@@ -27,7 +20,7 @@ asyncCore.asyncHooks.sanitizePromise = (res) => {
|
|
|
27
20
|
};
|
|
28
21
|
function captureRestorers() {
|
|
29
22
|
const restorers = new Set();
|
|
30
|
-
for (const hook of hooks) {
|
|
23
|
+
for (const hook of asyncCore.hooks) {
|
|
31
24
|
const restorer = hook();
|
|
32
25
|
if (restorer)
|
|
33
26
|
restorers.add(restorer);
|
|
@@ -64,89 +57,6 @@ function wrap(fn, capturedRestorers) {
|
|
|
64
57
|
}
|
|
65
58
|
};
|
|
66
59
|
}
|
|
67
|
-
const targetWrappers = new WeakMap();
|
|
68
|
-
function patchEventTarget(proto) {
|
|
69
|
-
if (!proto || !proto.addEventListener || !proto.removeEventListener)
|
|
70
|
-
return;
|
|
71
|
-
const nativeAdd = proto.addEventListener;
|
|
72
|
-
const nativeRemove = proto.removeEventListener;
|
|
73
|
-
proto.addEventListener = function (type, listener, options) {
|
|
74
|
-
if (typeof listener !== 'function') {
|
|
75
|
-
return nativeAdd.call(this, type, listener, options);
|
|
76
|
-
}
|
|
77
|
-
let types = targetWrappers.get(this);
|
|
78
|
-
if (!types) {
|
|
79
|
-
types = new Map();
|
|
80
|
-
targetWrappers.set(this, types);
|
|
81
|
-
}
|
|
82
|
-
let listeners = types.get(type);
|
|
83
|
-
if (!listeners) {
|
|
84
|
-
listeners = new WeakMap();
|
|
85
|
-
types.set(type, listeners);
|
|
86
|
-
}
|
|
87
|
-
let wrapped = listeners.get(listener);
|
|
88
|
-
if (!wrapped) {
|
|
89
|
-
wrapped = wrap(listener);
|
|
90
|
-
listeners.set(listener, wrapped);
|
|
91
|
-
}
|
|
92
|
-
return nativeAdd.call(this, type, wrapped, options);
|
|
93
|
-
};
|
|
94
|
-
proto.removeEventListener = function (type, listener, options) {
|
|
95
|
-
if (typeof listener !== 'function') {
|
|
96
|
-
return nativeRemove.call(this, type, listener, options);
|
|
97
|
-
}
|
|
98
|
-
const types = targetWrappers.get(this);
|
|
99
|
-
if (types) {
|
|
100
|
-
const listeners = types.get(type);
|
|
101
|
-
if (listeners) {
|
|
102
|
-
const wrapped = listeners.get(listener);
|
|
103
|
-
if (wrapped) {
|
|
104
|
-
return nativeRemove.call(this, type, wrapped, options);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return nativeRemove.call(this, type, listener, options);
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
function patchOnProperties(proto) {
|
|
112
|
-
if (!proto)
|
|
113
|
-
return;
|
|
114
|
-
for (const prop of Object.getOwnPropertyNames(proto)) {
|
|
115
|
-
if (prop.startsWith('on')) {
|
|
116
|
-
const desc = Object.getOwnPropertyDescriptor(proto, prop);
|
|
117
|
-
if (desc && desc.set && desc.configurable) {
|
|
118
|
-
const nativeSet = desc.set;
|
|
119
|
-
Object.defineProperty(proto, prop, {
|
|
120
|
-
...desc,
|
|
121
|
-
set: function (fn) {
|
|
122
|
-
nativeSet.call(this, wrap(fn));
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (typeof EventTarget !== 'undefined') {
|
|
130
|
-
patchEventTarget(EventTarget.prototype);
|
|
131
|
-
}
|
|
132
|
-
const prototypesToPatch = [
|
|
133
|
-
typeof EventTarget !== 'undefined' && EventTarget.prototype,
|
|
134
|
-
typeof HTMLElement !== 'undefined' && HTMLElement.prototype,
|
|
135
|
-
typeof Window !== 'undefined' && Window.prototype,
|
|
136
|
-
typeof Document !== 'undefined' && Document.prototype,
|
|
137
|
-
typeof MessagePort !== 'undefined' && MessagePort.prototype,
|
|
138
|
-
typeof XMLHttpRequest !== 'undefined' && XMLHttpRequest.prototype,
|
|
139
|
-
typeof IDBRequest !== 'undefined' && IDBRequest.prototype,
|
|
140
|
-
typeof IDBTransaction !== 'undefined' && IDBTransaction.prototype,
|
|
141
|
-
typeof IDBDatabase !== 'undefined' && IDBDatabase.prototype,
|
|
142
|
-
typeof FileReader !== 'undefined' && FileReader.prototype,
|
|
143
|
-
typeof AbortSignal !== 'undefined' && AbortSignal.prototype,
|
|
144
|
-
];
|
|
145
|
-
for (const proto of prototypesToPatch) {
|
|
146
|
-
if (proto) {
|
|
147
|
-
patchOnProperties(proto);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
60
|
const GLOBAL_ORIGINALS = Symbol.for('mutts.originals');
|
|
151
61
|
const GLOBAL_PROMISE = Symbol.for('mutts.OriginalPromise');
|
|
152
62
|
let originals;
|
|
@@ -158,6 +68,7 @@ if (globalThis[GLOBAL_ORIGINALS]) {
|
|
|
158
68
|
else {
|
|
159
69
|
OriginalPromise = globalThis.Promise;
|
|
160
70
|
originals = {
|
|
71
|
+
// biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching
|
|
161
72
|
then: OriginalPromise.prototype.then,
|
|
162
73
|
catch: OriginalPromise.prototype.catch,
|
|
163
74
|
finally: OriginalPromise.prototype.finally,
|
|
@@ -221,53 +132,54 @@ function PatchedPromise(executor) {
|
|
|
221
132
|
Object.assign(PatchedPromise, OriginalPromise);
|
|
222
133
|
// Inherit prototype for instanceof checks
|
|
223
134
|
PatchedPromise.prototype = OriginalPromise.prototype;
|
|
224
|
-
PatchedPromise.resolve =
|
|
135
|
+
PatchedPromise.resolve = ((value) => {
|
|
225
136
|
const p = originals.resolve.call(OriginalPromise, value);
|
|
226
137
|
const context = captureRestorers();
|
|
227
138
|
// Ensure we don't overwrite if it already has context (e.g. from constructor)
|
|
228
139
|
if (context.size > 0 && !promiseContexts.has(p))
|
|
229
140
|
promiseContexts.set(p, context);
|
|
230
141
|
return p;
|
|
231
|
-
};
|
|
232
|
-
PatchedPromise.reject =
|
|
142
|
+
});
|
|
143
|
+
PatchedPromise.reject = ((reason) => {
|
|
233
144
|
const p = originals.reject.call(OriginalPromise, reason);
|
|
234
145
|
const context = captureRestorers();
|
|
235
146
|
if (context.size > 0)
|
|
236
147
|
promiseContexts.set(p, context);
|
|
237
148
|
return p;
|
|
238
|
-
};
|
|
239
|
-
PatchedPromise.all =
|
|
149
|
+
});
|
|
150
|
+
PatchedPromise.all = ((values) => {
|
|
240
151
|
const p = originals.all.call(OriginalPromise, values);
|
|
241
152
|
const context = captureRestorers();
|
|
242
153
|
if (context.size > 0)
|
|
243
154
|
promiseContexts.set(p, context);
|
|
244
155
|
return p;
|
|
245
|
-
};
|
|
246
|
-
PatchedPromise.allSettled =
|
|
156
|
+
});
|
|
157
|
+
PatchedPromise.allSettled = ((values) => {
|
|
247
158
|
const p = originals.allSettled.call(OriginalPromise, values);
|
|
248
159
|
const context = captureRestorers();
|
|
249
160
|
if (context.size > 0)
|
|
250
161
|
promiseContexts.set(p, context);
|
|
251
162
|
return p;
|
|
252
|
-
};
|
|
253
|
-
PatchedPromise.race =
|
|
163
|
+
});
|
|
164
|
+
PatchedPromise.race = ((values) => {
|
|
254
165
|
const p = originals.race.call(OriginalPromise, values);
|
|
255
166
|
const context = captureRestorers();
|
|
256
167
|
if (context.size > 0)
|
|
257
168
|
promiseContexts.set(p, context);
|
|
258
169
|
return p;
|
|
259
|
-
};
|
|
260
|
-
PatchedPromise.any =
|
|
170
|
+
});
|
|
171
|
+
PatchedPromise.any = ((values) => {
|
|
261
172
|
const p = originals.any.call(OriginalPromise, values);
|
|
262
173
|
const context = captureRestorers();
|
|
263
174
|
if (context.size > 0)
|
|
264
175
|
promiseContexts.set(p, context);
|
|
265
176
|
return p;
|
|
266
|
-
};
|
|
177
|
+
});
|
|
267
178
|
// Only apply patches if not already applied (or re-apply safely)
|
|
268
179
|
// Note: OriginalPromise.prototype might be shared if we used the global one.
|
|
269
180
|
// We must ensure we don't patch it twice if it's the SAME object.
|
|
270
181
|
if (OriginalPromise.prototype.then !== patchedThen) {
|
|
182
|
+
// biome-ignore lint/suspicious/noThenProperty: Intentional Promise.prototype patching
|
|
271
183
|
OriginalPromise.prototype.then = patchedThen;
|
|
272
184
|
OriginalPromise.prototype.catch = patchedCatch;
|
|
273
185
|
OriginalPromise.prototype.finally = patchedFinally;
|
|
@@ -275,10 +187,10 @@ if (OriginalPromise.prototype.then !== patchedThen) {
|
|
|
275
187
|
try {
|
|
276
188
|
Object.defineProperty(OriginalPromise, Symbol.species, {
|
|
277
189
|
get: () => PatchedPromise,
|
|
278
|
-
configurable: true
|
|
190
|
+
configurable: true,
|
|
279
191
|
});
|
|
280
192
|
}
|
|
281
|
-
catch (
|
|
193
|
+
catch (_e) { }
|
|
282
194
|
globalThis.Promise = PatchedPromise;
|
|
283
195
|
globalThis.setTimeout = ((callback, ...args) => {
|
|
284
196
|
return originals.setTimeout.call(globalThis, wrap(callback), ...args);
|
|
@@ -301,4 +213,4 @@ if (originals.queueMicrotask) {
|
|
|
301
213
|
originals.queueMicrotask.call(globalThis, wrap(callback));
|
|
302
214
|
};
|
|
303
215
|
}
|
|
304
|
-
//# sourceMappingURL=async-browser-
|
|
216
|
+
//# sourceMappingURL=async-browser-BU_IfxYD.cjs.map
|