mutts 1.0.13 → 1.0.14
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/BROWSER_ASYNC_POLYFILL.md +79 -0
- package/README.md +2 -2
- package/dist/browser.cjs +145 -26
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +42 -9
- package/dist/browser.dev.cjs +12 -2
- package/dist/browser.dev.cjs.map +1 -1
- package/dist/browser.dev.d.ts +2 -2
- package/dist/browser.dev.esm.js +2 -2
- package/dist/browser.esm.js +137 -28
- package/dist/browser.esm.js.map +1 -1
- package/dist/chunks/{index-CAdnMJev.cjs → index-BnTNC9eC.cjs} +158 -90
- package/dist/chunks/index-BnTNC9eC.cjs.map +1 -0
- package/dist/chunks/{index-XsYTUhHx.esm.js → index-CAWVZL7P.esm.js} +156 -88
- package/dist/chunks/index-CAWVZL7P.esm.js.map +1 -0
- package/dist/chunks/node-Df_5r_WA.cjs +187 -0
- package/dist/chunks/node-Df_5r_WA.cjs.map +1 -0
- package/dist/chunks/node-DuIduHw3.esm.js +185 -0
- package/dist/chunks/node-DuIduHw3.esm.js.map +1 -0
- package/dist/chunks/{proxy-BtmPFjSr.esm.js → proxy-C2lnvvbx.esm.js} +652 -222
- package/dist/chunks/proxy-C2lnvvbx.esm.js.map +1 -0
- package/dist/chunks/{proxy-DBHj3kGK.cjs → proxy-HA_QQnd5.cjs} +662 -223
- package/dist/chunks/proxy-HA_QQnd5.cjs.map +1 -0
- package/dist/debug.cjs +37 -10
- package/dist/debug.cjs.map +1 -1
- package/dist/debug.esm.js +37 -10
- package/dist/debug.esm.js.map +1 -1
- package/dist/mutts.umd.js +4086 -3469
- 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 +13 -3
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +2 -2
- package/dist/node.dev.cjs +13 -3
- package/dist/node.dev.cjs.map +1 -1
- package/dist/node.dev.d.ts +2 -2
- package/dist/node.dev.esm.js +3 -3
- package/dist/node.esm.js +3 -3
- package/dist/types.d.ts +30 -15
- package/docs/ai/api-reference.md +3 -1
- package/docs/ai/manual.md +17 -5
- package/docs/reactive/advanced.md +169 -10
- package/docs/reactive/debugging.md +15 -13
- package/docs/reactive.md +2 -1
- package/package.json +12 -7
- package/dist/chunks/index-CAdnMJev.cjs.map +0 -1
- package/dist/chunks/index-XsYTUhHx.esm.js.map +0 -1
- package/dist/chunks/node-DrrphEPf.cjs +0 -98
- package/dist/chunks/node-DrrphEPf.cjs.map +0 -1
- package/dist/chunks/node-NEZvVo4M.esm.js +0 -96
- package/dist/chunks/node-NEZvVo4M.esm.js.map +0 -1
- package/dist/chunks/proxy-BtmPFjSr.esm.js.map +0 -1
- package/dist/chunks/proxy-DBHj3kGK.cjs.map +0 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Browser Async Polyfill
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
|
|
5
|
+
In the browser, JavaScript's `Promise` implementation carries "sticky" context through its prototype chain. When a Promise is created inside a zone (e.g., with `asyncZone`), it inherits the zone's context. If this Promise is then returned to an outer scope, the zone context "leaks" - it remains attached to the Promise even after execution has left the zone.
|
|
6
|
+
|
|
7
|
+
## Solution
|
|
8
|
+
|
|
9
|
+
To prevent context leakage, mutts implements a **sanitization** mechanism for the browser environment:
|
|
10
|
+
|
|
11
|
+
### 1. Promise Sanitization
|
|
12
|
+
|
|
13
|
+
The `asyncHooks.sanitizePromise` function wraps any Promise returned from a zone in a new Promise created in the outer scope:
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
asyncHooks.sanitizePromise = (res: any) => {
|
|
17
|
+
if (res && typeof (res as any).then === 'function') {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
(res as any).then(resolve, reject)
|
|
21
|
+
}, 0)
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
return res
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This breaks the sticky context chain by:
|
|
29
|
+
1. Creating a new Promise in the current (outer) scope
|
|
30
|
+
2. Using `setTimeout` to defer the resolution
|
|
31
|
+
3. The new Promise has no zone context from the inner scope
|
|
32
|
+
|
|
33
|
+
### 2. Promise Patching
|
|
34
|
+
|
|
35
|
+
The browser polyfill patches the global `Promise` constructor and its prototype methods (`then`, `catch`, `finally`) to capture and propagate zone context correctly through the Promise chain.
|
|
36
|
+
|
|
37
|
+
### 3. Scheduler Freezing
|
|
38
|
+
|
|
39
|
+
When the reactive system enters a broken state (unrecoverable error), all async schedulers are frozen to prevent further execution:
|
|
40
|
+
|
|
41
|
+
- `setTimeout` / `clearTimeout`
|
|
42
|
+
- `setInterval` / `clearInterval`
|
|
43
|
+
- `setImmediate` / `clearImmediate` (if available)
|
|
44
|
+
- `requestAnimationFrame` / `cancelAnimationFrame` (if available)
|
|
45
|
+
- `queueMicrotask` (if available)
|
|
46
|
+
|
|
47
|
+
This is a safety mechanism to prevent cascading errors while still allowing DOM event inspection.
|
|
48
|
+
|
|
49
|
+
## Why This is Necessary
|
|
50
|
+
|
|
51
|
+
### Node.js vs Browser
|
|
52
|
+
|
|
53
|
+
- **Node.js**: Uses `async_hooks` API which provides proper async context tracking without sticky Promise issues
|
|
54
|
+
- **Browser**: No native async context API, so mutts must implement its own mechanism using Promise prototype patching
|
|
55
|
+
|
|
56
|
+
### The "Sticky" Problem
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
// Without sanitization:
|
|
60
|
+
asyncZone.with('inner-zone', async () => {
|
|
61
|
+
const promise = Promise.resolve('data')
|
|
62
|
+
return promise // This promise carries 'inner-zone' context
|
|
63
|
+
})
|
|
64
|
+
// In outer scope, the promise still thinks it's in 'inner-zone'
|
|
65
|
+
|
|
66
|
+
// With sanitization:
|
|
67
|
+
asyncZone.with('inner-zone', async () => {
|
|
68
|
+
const promise = Promise.resolve('data')
|
|
69
|
+
return sanitizePromise(promise) // Returns new promise without 'inner-zone' context
|
|
70
|
+
})
|
|
71
|
+
// In outer scope, the promise has no zone context
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Implementation Notes
|
|
75
|
+
|
|
76
|
+
- The polyfill is only applied in the browser environment
|
|
77
|
+
- Original functions are stored and can be restored
|
|
78
|
+
- The polyfill is idempotent - applying it multiple times is safe
|
|
79
|
+
- Symbol.species is overridden to return the patched Promise constructor
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ In a world of "magic" and implicit state, Mutts chooses **Affirmative Logic**: y
|
|
|
14
14
|
A surgical, proxy-based reactivity system that eliminates lifecycle choreography.
|
|
15
15
|
- **Identity-Stable**: `morph()` transforms collections lazily with element-level precision.
|
|
16
16
|
- **Dependency Tracking**: Automatic tracking through objects, arrays, maps, and prototype chains.
|
|
17
|
-
- **Robust Batching**: Nested batch support with deterministic cleanup cycles.
|
|
17
|
+
- **Robust Batching**: Nested batch support with deterministic cleanup cycles and explicit phase-token ordering.
|
|
18
18
|
- **[Read more: Reactive Core](./docs/reactive/core.md)**
|
|
19
19
|
|
|
20
20
|
### 2. Universal Async Context (Zones)
|
|
@@ -88,6 +88,7 @@ A comprehensive reactivity system. See the **[Introduction](./docs/reactive/core
|
|
|
88
88
|
- **Class Reactivity**: `@reactive` decorator and `ReactiveBase` for class-based reactivity
|
|
89
89
|
- **Reactive Mixin**: Always-reactive classes with mixin support (`Reactive`)
|
|
90
90
|
- **Back-Reference System**: Efficient change propagation through object hierarchies
|
|
91
|
+
- **Effect Ordering**: Model render phases with ordinary reactive tokens so dependent effects can run after the work they rely on
|
|
91
92
|
- **Type Safety**: Full TypeScript support with proper type inference
|
|
92
93
|
- **Performance Optimized**: Lazy back-reference creation and efficient dependency tracking
|
|
93
94
|
- **Debugging & Development**: Built-in tools like cycle detection, memoization discrepancy check and effects lineages (logical/virtual stack-trace)
|
|
@@ -261,4 +262,3 @@ A utility for creating extensible functions with chainable property modifiers. T
|
|
|
261
262
|
|
|
262
263
|
## [Utilities](./docs/utils.md)
|
|
263
264
|
Documented helper functions for collections, type checks, and debugging (zip, deepCompare, tag, etc.).
|
|
264
|
-
|
package/dist/browser.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var proxy = require('./chunks/proxy-
|
|
4
|
-
var index = require('./chunks/index-
|
|
3
|
+
var proxy = require('./chunks/proxy-HA_QQnd5.cjs');
|
|
4
|
+
var index = require('./chunks/index-BnTNC9eC.cjs');
|
|
5
5
|
|
|
6
6
|
const promiseContexts = new WeakMap();
|
|
7
7
|
// [HACK]: Sanitization
|
|
@@ -40,28 +40,14 @@ function wrap(fn, capturedRestorers) {
|
|
|
40
40
|
return fn.apply(this, args);
|
|
41
41
|
}
|
|
42
42
|
finally {
|
|
43
|
-
|
|
44
|
-
//
|
|
45
|
-
// We might be in the middle of another promise hook trying to setup the zone
|
|
46
|
-
// TODO We might wish to have a flag :asyncZone.acquired - like a semaphore - that we falsify here and set back when we setup the zone
|
|
47
|
-
// - but this might perhaps be an overkill creating more problems than it solves
|
|
48
|
-
if (originals.queueMicrotask) {
|
|
49
|
-
// Double microtask ensures we run after the first await resumption microtask
|
|
50
|
-
originals.queueMicrotask.call(globalThis, () => {
|
|
51
|
-
originals.queueMicrotask.call(globalThis, () => {
|
|
52
|
-
originals.queueMicrotask.call(globalThis, () => {
|
|
53
|
-
for (let i = undoers.length - 1; i >= 0; i--) undoers[i]()
|
|
54
|
-
})
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
} else {
|
|
58
|
-
for (let i = undoers.length - 1; i >= 0; i--) undoers[i]()
|
|
59
|
-
}*/
|
|
43
|
+
// Browser async context is backed by sticky Promise metadata. Running undoers here
|
|
44
|
+
// breaks await propagation and can orphan reactive resource observers.
|
|
60
45
|
}
|
|
61
46
|
};
|
|
62
47
|
}
|
|
63
48
|
const GLOBAL_ORIGINALS = Symbol.for('mutts.originals');
|
|
64
49
|
const GLOBAL_PROMISE = Symbol.for('mutts.OriginalPromise');
|
|
50
|
+
const schedulerGlobal = globalThis;
|
|
65
51
|
let originals;
|
|
66
52
|
let OriginalPromise;
|
|
67
53
|
if (globalThis[GLOBAL_ORIGINALS]) {
|
|
@@ -82,9 +68,13 @@ else {
|
|
|
82
68
|
race: OriginalPromise.race,
|
|
83
69
|
any: OriginalPromise.any,
|
|
84
70
|
setTimeout: globalThis.setTimeout,
|
|
71
|
+
clearTimeout: globalThis.clearTimeout,
|
|
85
72
|
setInterval: globalThis.setInterval,
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
clearInterval: globalThis.clearInterval,
|
|
74
|
+
setImmediate: schedulerGlobal.setImmediate,
|
|
75
|
+
clearImmediate: schedulerGlobal.clearImmediate,
|
|
76
|
+
requestAnimationFrame: schedulerGlobal.requestAnimationFrame,
|
|
77
|
+
cancelAnimationFrame: schedulerGlobal.cancelAnimationFrame,
|
|
88
78
|
queueMicrotask: globalThis.queueMicrotask,
|
|
89
79
|
};
|
|
90
80
|
globalThis[GLOBAL_ORIGINALS] = originals;
|
|
@@ -97,6 +87,74 @@ if (!originals.any)
|
|
|
97
87
|
originals.any = OriginalPromise.any;
|
|
98
88
|
if (!originals.race)
|
|
99
89
|
originals.race = OriginalPromise.race;
|
|
90
|
+
if (!originals.clearTimeout)
|
|
91
|
+
originals.clearTimeout = globalThis.clearTimeout;
|
|
92
|
+
if (!originals.clearInterval)
|
|
93
|
+
originals.clearInterval = globalThis.clearInterval;
|
|
94
|
+
if (!originals.clearImmediate)
|
|
95
|
+
originals.clearImmediate = schedulerGlobal.clearImmediate;
|
|
96
|
+
if (!originals.cancelAnimationFrame)
|
|
97
|
+
originals.cancelAnimationFrame = schedulerGlobal.cancelAnimationFrame;
|
|
98
|
+
const pendingTimeouts = new Set();
|
|
99
|
+
const pendingIntervals = new Set();
|
|
100
|
+
const pendingImmediates = new Set();
|
|
101
|
+
const pendingAnimationFrames = new Set();
|
|
102
|
+
let asyncSchedulersFrozen = false;
|
|
103
|
+
function clearPendingSchedulers() {
|
|
104
|
+
for (const handle of Array.from(pendingTimeouts))
|
|
105
|
+
originals.clearTimeout.call(globalThis, handle);
|
|
106
|
+
for (const handle of Array.from(pendingIntervals))
|
|
107
|
+
originals.clearInterval.call(globalThis, handle);
|
|
108
|
+
if (originals.clearImmediate) {
|
|
109
|
+
for (const handle of Array.from(pendingImmediates)) {
|
|
110
|
+
originals.clearImmediate.call(globalThis, handle);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (originals.cancelAnimationFrame) {
|
|
114
|
+
for (const handle of Array.from(pendingAnimationFrames)) {
|
|
115
|
+
originals.cancelAnimationFrame.call(globalThis, handle);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
pendingTimeouts.clear();
|
|
119
|
+
pendingIntervals.clear();
|
|
120
|
+
pendingImmediates.clear();
|
|
121
|
+
pendingAnimationFrames.clear();
|
|
122
|
+
}
|
|
123
|
+
function freezeAsyncSchedulers() {
|
|
124
|
+
if (asyncSchedulersFrozen)
|
|
125
|
+
return;
|
|
126
|
+
asyncSchedulersFrozen = true;
|
|
127
|
+
clearPendingSchedulers();
|
|
128
|
+
}
|
|
129
|
+
function resumeAsyncSchedulers() {
|
|
130
|
+
asyncSchedulersFrozen = false;
|
|
131
|
+
}
|
|
132
|
+
function canceledTimeoutHandle() {
|
|
133
|
+
const handle = originals.setTimeout.call(globalThis, () => { }, 0);
|
|
134
|
+
originals.clearTimeout.call(globalThis, handle);
|
|
135
|
+
return handle;
|
|
136
|
+
}
|
|
137
|
+
function canceledIntervalHandle() {
|
|
138
|
+
const handle = originals.setInterval.call(globalThis, () => { }, 0);
|
|
139
|
+
originals.clearInterval.call(globalThis, handle);
|
|
140
|
+
return handle;
|
|
141
|
+
}
|
|
142
|
+
function canceledImmediateHandle() {
|
|
143
|
+
if (!originals.setImmediate || !originals.clearImmediate)
|
|
144
|
+
return undefined;
|
|
145
|
+
const handle = originals.setImmediate.call(globalThis, () => { });
|
|
146
|
+
originals.clearImmediate.call(globalThis, handle);
|
|
147
|
+
return handle;
|
|
148
|
+
}
|
|
149
|
+
function canceledAnimationFrameHandle() {
|
|
150
|
+
if (!originals.requestAnimationFrame || !originals.cancelAnimationFrame)
|
|
151
|
+
return 0;
|
|
152
|
+
const handle = originals.requestAnimationFrame.call(globalThis, () => { });
|
|
153
|
+
originals.cancelAnimationFrame.call(globalThis, handle);
|
|
154
|
+
return handle;
|
|
155
|
+
}
|
|
156
|
+
proxy.onReactiveBroken(freezeAsyncSchedulers);
|
|
157
|
+
proxy.onReactiveReset(resumeAsyncSchedulers);
|
|
100
158
|
function patchedThen(onFulfilled, onRejected) {
|
|
101
159
|
const context = promiseContexts.get(this) || captureRestorers();
|
|
102
160
|
const nextPromise = originals.then.call(this, wrap(onFulfilled, context), wrap(onRejected, context));
|
|
@@ -196,19 +254,70 @@ try {
|
|
|
196
254
|
catch (_e) { }
|
|
197
255
|
globalThis.Promise = PatchedPromise;
|
|
198
256
|
globalThis.setTimeout = ((callback, ...args) => {
|
|
199
|
-
|
|
257
|
+
if (asyncSchedulersFrozen)
|
|
258
|
+
return canceledTimeoutHandle();
|
|
259
|
+
const wrapped = wrap(callback);
|
|
260
|
+
const handle = originals.setTimeout.call(globalThis, (...callbackArgs) => {
|
|
261
|
+
pendingTimeouts.delete(handle);
|
|
262
|
+
wrapped(...callbackArgs);
|
|
263
|
+
}, ...args);
|
|
264
|
+
pendingTimeouts.add(handle);
|
|
265
|
+
return handle;
|
|
266
|
+
});
|
|
267
|
+
globalThis.clearTimeout = ((handle) => {
|
|
268
|
+
pendingTimeouts.delete(handle);
|
|
269
|
+
return originals.clearTimeout.call(globalThis, handle);
|
|
200
270
|
});
|
|
201
271
|
globalThis.setInterval = ((callback, ...args) => {
|
|
202
|
-
|
|
272
|
+
if (asyncSchedulersFrozen)
|
|
273
|
+
return canceledIntervalHandle();
|
|
274
|
+
const wrapped = wrap(callback);
|
|
275
|
+
const handle = originals.setInterval.call(globalThis, (...callbackArgs) => {
|
|
276
|
+
wrapped(...callbackArgs);
|
|
277
|
+
}, ...args);
|
|
278
|
+
pendingIntervals.add(handle);
|
|
279
|
+
return handle;
|
|
280
|
+
});
|
|
281
|
+
globalThis.clearInterval = ((handle) => {
|
|
282
|
+
pendingIntervals.delete(handle);
|
|
283
|
+
return originals.clearInterval.call(globalThis, handle);
|
|
203
284
|
});
|
|
204
285
|
if (originals.setImmediate) {
|
|
205
|
-
|
|
206
|
-
|
|
286
|
+
schedulerGlobal.setImmediate = ((callback, ...args) => {
|
|
287
|
+
if (asyncSchedulersFrozen)
|
|
288
|
+
return canceledImmediateHandle();
|
|
289
|
+
const wrapped = wrap(callback);
|
|
290
|
+
const handle = originals.setImmediate.call(globalThis, (...callbackArgs) => {
|
|
291
|
+
pendingImmediates.delete(handle);
|
|
292
|
+
wrapped(...callbackArgs);
|
|
293
|
+
}, ...args);
|
|
294
|
+
pendingImmediates.add(handle);
|
|
295
|
+
return handle;
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
if (originals.clearImmediate) {
|
|
299
|
+
schedulerGlobal.clearImmediate = ((handle) => {
|
|
300
|
+
pendingImmediates.delete(handle);
|
|
301
|
+
return originals.clearImmediate.call(globalThis, handle);
|
|
207
302
|
});
|
|
208
303
|
}
|
|
209
304
|
if (originals.requestAnimationFrame) {
|
|
210
305
|
globalThis.requestAnimationFrame = (callback) => {
|
|
211
|
-
|
|
306
|
+
if (asyncSchedulersFrozen)
|
|
307
|
+
return canceledAnimationFrameHandle();
|
|
308
|
+
const wrapped = wrap(callback);
|
|
309
|
+
const handle = originals.requestAnimationFrame.call(globalThis, (time) => {
|
|
310
|
+
pendingAnimationFrames.delete(handle);
|
|
311
|
+
wrapped(time);
|
|
312
|
+
});
|
|
313
|
+
pendingAnimationFrames.add(handle);
|
|
314
|
+
return handle;
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
if (originals.cancelAnimationFrame) {
|
|
318
|
+
globalThis.cancelAnimationFrame = (handle) => {
|
|
319
|
+
pendingAnimationFrames.delete(handle);
|
|
320
|
+
return originals.cancelAnimationFrame.call(globalThis, handle);
|
|
212
321
|
};
|
|
213
322
|
}
|
|
214
323
|
if (originals.queueMicrotask) {
|
|
@@ -260,6 +369,7 @@ exports.getActivationLog = proxy.getActivationLog;
|
|
|
260
369
|
exports.getActiveEffect = proxy.getActiveEffect;
|
|
261
370
|
exports.getState = proxy.getState;
|
|
262
371
|
exports.hooks = proxy.hooks;
|
|
372
|
+
exports.inert = proxy.inert;
|
|
263
373
|
exports.inheritCaption = proxy.inheritCaption;
|
|
264
374
|
exports.isConstructor = proxy.isConstructor;
|
|
265
375
|
exports.isDev = proxy.isDev;
|
|
@@ -267,27 +377,36 @@ exports.isNonReactive = proxy.isNonReactive;
|
|
|
267
377
|
exports.isObject = proxy.isObject;
|
|
268
378
|
exports.isProd = proxy.isProd;
|
|
269
379
|
exports.isReactive = proxy.isReactive;
|
|
380
|
+
exports.isReactiveBroken = proxy.isReactiveBroken;
|
|
270
381
|
exports.isTest = proxy.isTest;
|
|
271
382
|
exports.legacyDecorator = proxy.legacyDecorator;
|
|
272
383
|
exports.link = proxy.link;
|
|
384
|
+
exports.markRaw = proxy.markRaw;
|
|
385
|
+
exports.markRawProps = proxy.markRawProps;
|
|
273
386
|
exports.mixin = proxy.mixin;
|
|
274
387
|
exports.modernDecorator = proxy.modernDecorator;
|
|
275
388
|
exports.named = proxy.named;
|
|
276
389
|
exports.objectToProxy = proxy.objectToProxy;
|
|
277
390
|
exports.onEffectThrow = proxy.onEffectThrow;
|
|
391
|
+
exports.onReactiveBroken = proxy.onReactiveBroken;
|
|
392
|
+
exports.onReactiveReset = proxy.onReactiveReset;
|
|
278
393
|
exports.prodPreset = proxy.prodPreset;
|
|
279
394
|
exports.proxyToObject = proxy.proxyToObject;
|
|
280
395
|
exports.reactive = proxy.reactive;
|
|
281
396
|
exports.reactiveOptions = proxy.options;
|
|
397
|
+
exports.readonlyReactive = proxy.readonlyReactive;
|
|
282
398
|
exports.reset = proxy.reset;
|
|
283
399
|
exports.root = proxy.root;
|
|
400
|
+
exports.shallowReactive = proxy.shallowReactive;
|
|
284
401
|
exports.tag = proxy.tag;
|
|
402
|
+
exports.toRaw = proxy.toRaw;
|
|
285
403
|
exports.touched = proxy.touched;
|
|
286
404
|
exports.touched1 = proxy.touched1;
|
|
287
405
|
exports.unlink = proxy.unlink;
|
|
288
406
|
exports.untracked = proxy.untracked;
|
|
289
407
|
exports.unwrap = proxy.unwrap;
|
|
290
408
|
exports.withEffectContext = proxy.withEffectContext;
|
|
409
|
+
exports.wrapInert = proxy.wrapInert;
|
|
291
410
|
exports.zip = proxy.zip;
|
|
292
411
|
exports.ArrayReadForward = index.ArrayReadForward;
|
|
293
412
|
exports.Destroyable = index.Destroyable;
|
package/dist/browser.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.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\t/* cf BROWSER_ASYNC_POLYFILL.md\n\t\t\t// Note: my fear about this code: in between 2~3~4 microtask waits, some other microtasks might have started, stopped, ...\n\t\t\t// We might be in the middle of another promise hook trying to setup the zone\n\t\t\t// TODO We might wish to have a flag :asyncZone.acquired - like a semaphore - that we falsify here and set back when we setup the zone\n\t\t\t// - but this might perhaps be an overkill creating more problems than it solves\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,gBAAU,CAAC,eAAe,GAAG,CAAC,GAAQ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AAe,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.cjs","sources":["../src/async/browser.ts"],"sourcesContent":["import { onReactiveBroken, onReactiveReset } from '../reactive/effects'\nimport { 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\t// Browser async context is backed by sticky Promise metadata. Running undoers here\n\t\t\t// breaks await propagation and can orphan reactive resource observers.\n\t\t}\n\t}\n}\n\nconst GLOBAL_ORIGINALS = Symbol.for('mutts.originals')\nconst GLOBAL_PROMISE = Symbol.for('mutts.OriginalPromise')\n\ntype SchedulerGlobal = typeof globalThis & {\n\tsetImmediate?: typeof setImmediate\n\tclearImmediate?: typeof clearImmediate\n\trequestAnimationFrame?: typeof requestAnimationFrame\n\tcancelAnimationFrame?: typeof cancelAnimationFrame\n}\n\nconst schedulerGlobal = globalThis as SchedulerGlobal\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\tclearTimeout: globalThis.clearTimeout,\n\t\tsetInterval: globalThis.setInterval,\n\t\tclearInterval: globalThis.clearInterval,\n\t\tsetImmediate: schedulerGlobal.setImmediate,\n\t\tclearImmediate: schedulerGlobal.clearImmediate,\n\t\trequestAnimationFrame: schedulerGlobal.requestAnimationFrame,\n\t\tcancelAnimationFrame: schedulerGlobal.cancelAnimationFrame,\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\nif (!originals.clearTimeout) originals.clearTimeout = globalThis.clearTimeout\nif (!originals.clearInterval) originals.clearInterval = globalThis.clearInterval\nif (!originals.clearImmediate) originals.clearImmediate = schedulerGlobal.clearImmediate\nif (!originals.cancelAnimationFrame)\n\toriginals.cancelAnimationFrame = schedulerGlobal.cancelAnimationFrame\n\nconst pendingTimeouts = new Set<unknown>()\nconst pendingIntervals = new Set<unknown>()\nconst pendingImmediates = new Set<unknown>()\nconst pendingAnimationFrames = new Set<unknown>()\nlet asyncSchedulersFrozen = false\n\nfunction clearPendingSchedulers() {\n\tfor (const handle of Array.from(pendingTimeouts)) originals.clearTimeout.call(globalThis, handle)\n\tfor (const handle of Array.from(pendingIntervals))\n\t\toriginals.clearInterval.call(globalThis, handle)\n\tif (originals.clearImmediate) {\n\t\tfor (const handle of Array.from(pendingImmediates)) {\n\t\t\toriginals.clearImmediate.call(globalThis, handle)\n\t\t}\n\t}\n\tif (originals.cancelAnimationFrame) {\n\t\tfor (const handle of Array.from(pendingAnimationFrames)) {\n\t\t\toriginals.cancelAnimationFrame.call(globalThis, handle)\n\t\t}\n\t}\n\tpendingTimeouts.clear()\n\tpendingIntervals.clear()\n\tpendingImmediates.clear()\n\tpendingAnimationFrames.clear()\n}\n\nfunction freezeAsyncSchedulers() {\n\tif (asyncSchedulersFrozen) return\n\tasyncSchedulersFrozen = true\n\tclearPendingSchedulers()\n}\n\nfunction resumeAsyncSchedulers() {\n\tasyncSchedulersFrozen = false\n}\n\nfunction canceledTimeoutHandle() {\n\tconst handle = originals.setTimeout.call(globalThis, () => {}, 0)\n\toriginals.clearTimeout.call(globalThis, handle)\n\treturn handle\n}\n\nfunction canceledIntervalHandle() {\n\tconst handle = originals.setInterval.call(globalThis, () => {}, 0)\n\toriginals.clearInterval.call(globalThis, handle)\n\treturn handle\n}\n\nfunction canceledImmediateHandle() {\n\tif (!originals.setImmediate || !originals.clearImmediate) return undefined\n\tconst handle = originals.setImmediate.call(globalThis, () => {})\n\toriginals.clearImmediate.call(globalThis, handle)\n\treturn handle\n}\n\nfunction canceledAnimationFrameHandle() {\n\tif (!originals.requestAnimationFrame || !originals.cancelAnimationFrame) return 0\n\tconst handle = originals.requestAnimationFrame.call(globalThis, () => {})\n\toriginals.cancelAnimationFrame.call(globalThis, handle)\n\treturn handle\n}\n\nonReactiveBroken(freezeAsyncSchedulers)\nonReactiveReset(resumeAsyncSchedulers)\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\tif (asyncSchedulersFrozen) return canceledTimeoutHandle()\n\tconst wrapped = wrap(callback as any)\n\tconst handle = originals.setTimeout.call(\n\t\tglobalThis,\n\t\t(...callbackArgs: any[]) => {\n\t\t\tpendingTimeouts.delete(handle)\n\t\t\twrapped(...callbackArgs)\n\t\t},\n\t\t...args\n\t)\n\tpendingTimeouts.add(handle)\n\treturn handle\n}) as typeof globalThis.setTimeout\n\nglobalThis.clearTimeout = ((handle?: unknown) => {\n\tpendingTimeouts.delete(handle)\n\treturn originals.clearTimeout.call(globalThis, handle)\n}) as typeof globalThis.clearTimeout\n\nglobalThis.setInterval = ((callback: Function, ...args: any[]) => {\n\tif (asyncSchedulersFrozen) return canceledIntervalHandle()\n\tconst wrapped = wrap(callback as any)\n\tconst handle = originals.setInterval.call(\n\t\tglobalThis,\n\t\t(...callbackArgs: any[]) => {\n\t\t\twrapped(...callbackArgs)\n\t\t},\n\t\t...args\n\t)\n\tpendingIntervals.add(handle)\n\treturn handle\n}) as typeof globalThis.setInterval\n\nglobalThis.clearInterval = ((handle?: unknown) => {\n\tpendingIntervals.delete(handle)\n\treturn originals.clearInterval.call(globalThis, handle)\n}) as typeof globalThis.clearInterval\n\nif (originals.setImmediate) {\n\tschedulerGlobal.setImmediate = ((callback: Function, ...args: any[]) => {\n\t\tif (asyncSchedulersFrozen) return canceledImmediateHandle()\n\t\tconst wrapped = wrap(callback as any)\n\t\tconst handle = originals.setImmediate.call(\n\t\t\tglobalThis,\n\t\t\t(...callbackArgs: any[]) => {\n\t\t\t\tpendingImmediates.delete(handle)\n\t\t\t\twrapped(...callbackArgs)\n\t\t\t},\n\t\t\t...args\n\t\t)\n\t\tpendingImmediates.add(handle)\n\t\treturn handle\n\t}) as typeof setImmediate\n}\n\nif (originals.clearImmediate) {\n\tschedulerGlobal.clearImmediate = ((handle?: unknown) => {\n\t\tpendingImmediates.delete(handle)\n\t\treturn originals.clearImmediate.call(globalThis, handle)\n\t}) as typeof clearImmediate\n}\n\nif (originals.requestAnimationFrame) {\n\tglobalThis.requestAnimationFrame = (callback: FrameRequestCallback) => {\n\t\tif (asyncSchedulersFrozen) return canceledAnimationFrameHandle()\n\t\tconst wrapped = wrap(callback)\n\t\tconst handle = originals.requestAnimationFrame.call(globalThis, (time: DOMHighResTimeStamp) => {\n\t\t\tpendingAnimationFrames.delete(handle)\n\t\t\twrapped(time)\n\t\t})\n\t\tpendingAnimationFrames.add(handle)\n\t\treturn handle\n\t}\n}\n\nif (originals.cancelAnimationFrame) {\n\tglobalThis.cancelAnimationFrame = (handle: number) => {\n\t\tpendingAnimationFrames.delete(handle)\n\t\treturn originals.cancelAnimationFrame.call(globalThis, handle)\n\t}\n}\n\nif (originals.queueMicrotask) {\n\tglobalThis.queueMicrotask = (callback: VoidFunction): void => {\n\t\toriginals.queueMicrotask.call(globalThis, wrap(callback))\n\t}\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AAU,EAAE,CAAC,IAAyB,KAAI;AAC7F,YAAA,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC;YACrC,OAAO,CAAC,IAAI,CAAC;AACd,QAAA,CAAC,CAAC;AACF,QAAA,sBAAsB,CAAC,GAAG,CAAC,MAAM,CAAC;AAClC,QAAA,OAAO,MAAM;AACd,IAAA,CAAC;AACF;AAEA,IAAI,SAAS,CAAC,oBAAoB,EAAE;AACnC,IAAA,UAAU,CAAC,oBAAoB,GAAG,CAAC,MAAc,KAAI;AACpD,QAAA,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC;QACrC,OAAO,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC;AAC/D,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as EffectAccess, d as EffectCloser, S as ScopedCallback, e as State, a as Evolution, b as EffectCleanup, Z as ZoneAggregator, C as CleanupReason, H as HistoryValue, E as EffectTrigger, f as CatchFunction, g as EffectOptions } from './types.js';
|
|
2
|
-
export { A as AZone, G as GetterWrapper, P as PropTrigger, R as ReactiveError,
|
|
2
|
+
export { A as AZone, h as CycleHandlingMode, D as DeprecatedCycleHandlingMode, G as GetterWrapper, P as PropTrigger, R as ReactiveError, i as ReactiveErrorCode, j as SchedulerMode, k as Zone, l as ZoneHistory, m as asyncZone, n as debugPreset, o as devPreset, p as formatCleanupReason, q as isReactive, r as objectToProxy, s as prodPreset, t as proxyToObject, u as reactiveOptions, v as toRaw, w as unwrap } from './types.js';
|
|
3
3
|
|
|
4
4
|
type Restorer = () => () => void;
|
|
5
5
|
type Hook = () => Restorer;
|
|
@@ -243,15 +243,15 @@ declare class Eventful<Events extends EventsBase> {
|
|
|
243
243
|
emit: (<EventType extends keyof Events>(event: EventType, ...args: Parameters<Events[EventType]>) => void) & Events;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
type AnyFunction = (...args: any[]) => any;
|
|
247
|
-
type CaptionedOptions<T extends AnyFunction> = {
|
|
246
|
+
type AnyFunction$1 = (...args: any[]) => any;
|
|
247
|
+
type CaptionedOptions<T extends AnyFunction$1> = {
|
|
248
248
|
callbackIndex?: number;
|
|
249
249
|
name?: string;
|
|
250
250
|
rename?: (caption: string, callback: Function) => unknown;
|
|
251
251
|
warn?: (message: string) => void;
|
|
252
252
|
shouldWarnAnonymous?: (callback: Function, args: Parameters<T>) => boolean;
|
|
253
253
|
};
|
|
254
|
-
type Captioned<T extends AnyFunction> = T & ((strings: TemplateStringsArray, ...values: readonly unknown[]) => T);
|
|
254
|
+
type Captioned<T extends AnyFunction$1> = T & ((strings: TemplateStringsArray, ...values: readonly unknown[]) => T);
|
|
255
255
|
/**
|
|
256
256
|
* Wraps a callback-first function so it also accepts a tagged-template call form.
|
|
257
257
|
*
|
|
@@ -271,8 +271,8 @@ type Captioned<T extends AnyFunction> = T & ((strings: TemplateStringsArray, ...
|
|
|
271
271
|
* Anonymous uncaptioned callbacks may trigger a warning depending on
|
|
272
272
|
* `shouldWarnAnonymous`.
|
|
273
273
|
*/
|
|
274
|
-
declare function captioned<T extends AnyFunction>(fn: T, options?: CaptionedOptions<T>): Captioned<T>;
|
|
275
|
-
declare function inheritCaption<T extends AnyFunction>(source: AnyFunction, target: T): T;
|
|
274
|
+
declare function captioned<T extends AnyFunction$1>(fn: T, options?: CaptionedOptions<T>): Captioned<T>;
|
|
275
|
+
declare function inheritCaption<T extends AnyFunction$1>(source: AnyFunction$1, target: T): T;
|
|
276
276
|
/**
|
|
277
277
|
* Creates a flavored (extensible) version of a function with chainable property modifiers.
|
|
278
278
|
*/
|
|
@@ -592,6 +592,7 @@ declare class IterableWeakSet<K extends WeakKey> implements Set<K> {
|
|
|
592
592
|
[Symbol.iterator](): SetIterator<K>;
|
|
593
593
|
readonly [Symbol.toStringTag]: string;
|
|
594
594
|
union<U>(other: ReadonlySetLike<U>): Set<K | U>;
|
|
595
|
+
union(...sets: Set<K>[]): this;
|
|
595
596
|
intersection<U>(other: ReadonlySetLike<U>): Set<K & U>;
|
|
596
597
|
difference<U>(other: ReadonlySetLike<U>): Set<K>;
|
|
597
598
|
symmetricDifference<U>(other: ReadonlySetLike<U>): Set<K | U>;
|
|
@@ -727,6 +728,15 @@ interface Lift {
|
|
|
727
728
|
* @returns A reactive object synchronized with the callback's result, with a [cleanup] property to stop tracking
|
|
728
729
|
*/
|
|
729
730
|
declare const lift: Lift;
|
|
731
|
+
/**
|
|
732
|
+
* Position object provided to array morph callbacks.
|
|
733
|
+
*
|
|
734
|
+
* @property index - Current index of the item in the source array. The object is stable
|
|
735
|
+
* per item and its `index` updates reactively when the item moves due to shifts/reorders.
|
|
736
|
+
*/
|
|
737
|
+
type MorphPosition = {
|
|
738
|
+
index: number;
|
|
739
|
+
};
|
|
730
740
|
/**
|
|
731
741
|
* Options for `morph` and its variants.
|
|
732
742
|
*
|
|
@@ -746,7 +756,7 @@ type MorphOptions<I> = {
|
|
|
746
756
|
* @see morphRecord
|
|
747
757
|
*/
|
|
748
758
|
type Morph = {
|
|
749
|
-
<I, O>(source: readonly I[] | (() => readonly I[]), fn: (arg: I, access?: EffectAccess) => O, options?: MorphOptions<I>): readonly O[];
|
|
759
|
+
<I, O>(source: readonly I[] | (() => readonly I[]), fn: (arg: I, position: MorphPosition, access?: EffectAccess) => O, options?: MorphOptions<I>): readonly O[];
|
|
750
760
|
<K, V, O>(source: Map<K, V>, fn: (arg: V, key: K, access?: EffectAccess) => O, options?: MorphOptions<V>): Map<K, O>;
|
|
751
761
|
<S extends Record<PropertyKey, any>, O>(source: S, fn: (arg: S[keyof S], key: keyof S, access?: EffectAccess) => O, options?: MorphOptions<S[keyof S]>): {
|
|
752
762
|
[K in keyof S]: O;
|
|
@@ -901,6 +911,12 @@ declare function getActivationLog(): Omit<ActivationRecord, "batchId">[];
|
|
|
901
911
|
declare function caught(onThrow: CatchFunction, effect?: EffectTrigger): void;
|
|
902
912
|
/** @deprecated Use `caught` instead */
|
|
903
913
|
declare const onEffectThrow: typeof caught;
|
|
914
|
+
/** True after an unrecoverable reactive failure until `reset()`. */
|
|
915
|
+
declare function isReactiveBroken(): boolean;
|
|
916
|
+
type ReactiveBrokenHandler = (error: unknown) => void;
|
|
917
|
+
type ReactiveResetHandler = () => void;
|
|
918
|
+
declare function onReactiveBroken(handler: ReactiveBrokenHandler): () => void;
|
|
919
|
+
declare function onReactiveReset(handler: ReactiveResetHandler): () => void;
|
|
904
920
|
/**
|
|
905
921
|
* Adds a cleanup function to be called when the current batch of effects completes
|
|
906
922
|
* @param cleanup - The cleanup function to add
|
|
@@ -999,6 +1015,16 @@ declare const effect: Effect;
|
|
|
999
1015
|
*/
|
|
1000
1016
|
type RootRunner = <T>(fn: () => T) => T;
|
|
1001
1017
|
declare const untracked: Captioned<RootRunner>;
|
|
1018
|
+
type AnyFunction = (this: any, ...args: any[]) => any;
|
|
1019
|
+
declare function wrapInert<Fn extends AnyFunction>(fn: Fn): Fn;
|
|
1020
|
+
type Inert = (<T>(fn: () => T) => T) & MethodDecorator & ((target: any, context: ClassMethodDecoratorContext) => any);
|
|
1021
|
+
/**
|
|
1022
|
+
* Executes a function with fast-path reads that bypass proxy overhead and dependency tracking.
|
|
1023
|
+
* Writes remain fully reactive. Uses a counter for safe nesting.
|
|
1024
|
+
* Can also decorate methods so the whole method body runs inertly.
|
|
1025
|
+
* @param fn - The function to execute
|
|
1026
|
+
*/
|
|
1027
|
+
declare const inert: Inert;
|
|
1002
1028
|
/**
|
|
1003
1029
|
* Executes a function from a virgin/root context - no parent effect, no tracking
|
|
1004
1030
|
* Creates completely independent effects that won't be cleaned up by any parent
|
|
@@ -1082,6 +1108,9 @@ declare const memoize: ReturnType<typeof makeMemoizeDecorator> & {
|
|
|
1082
1108
|
* If a set is provided, merges with existing unreactive properties (never overrides true).
|
|
1083
1109
|
*/
|
|
1084
1110
|
declare function addUnreactiveProps<T extends object>(proto: T, set?: Iterable<PropertyKey>): T;
|
|
1111
|
+
declare function nonReactive<T extends object[]>(...obj: T): T[0];
|
|
1112
|
+
declare const markRaw: typeof nonReactive;
|
|
1113
|
+
declare const markRawProps: typeof addUnreactiveProps;
|
|
1085
1114
|
declare function isNonReactive(obj: any): boolean;
|
|
1086
1115
|
|
|
1087
1116
|
type SubProxy = {
|
|
@@ -1100,11 +1129,15 @@ declare const ReactiveBase: (new (...args: any[]) => {
|
|
|
1100
1129
|
[x: string]: any;
|
|
1101
1130
|
} & Base);
|
|
1102
1131
|
declare function reactiveObject<T>(anyTarget: T, subProxy?: SubProxy): T;
|
|
1132
|
+
declare function shallowReactiveObject<T>(anyTarget: T): T;
|
|
1133
|
+
declare function readonlyReactiveObject<T>(anyTarget: T): T;
|
|
1103
1134
|
/**
|
|
1104
1135
|
* Main decorator for making classes reactive
|
|
1105
1136
|
* Automatically makes class instances reactive when created
|
|
1106
1137
|
*/
|
|
1107
1138
|
declare const reactive: LegacyClassDecorator<new (...args: any[]) => any> & ModernClassDecorator<new (...args: any[]) => any> & typeof reactiveObject;
|
|
1139
|
+
declare const shallowReactive: typeof shallowReactiveObject;
|
|
1140
|
+
declare const readonlyReactive: typeof readonlyReactiveObject;
|
|
1108
1141
|
|
|
1109
1142
|
/**
|
|
1110
1143
|
* Provides type-safe access to a source object's property within the organized callback.
|
|
@@ -1403,5 +1436,5 @@ declare const isDev: boolean;
|
|
|
1403
1436
|
declare const isProd: boolean;
|
|
1404
1437
|
declare const isTest: boolean;
|
|
1405
1438
|
|
|
1406
|
-
export { ArrayReadForward, CleanupReason, CompareSymbol, DecoratorError, Destroyable, DestructionError, EffectAccess, EffectCleanup, EffectCloser, EffectOptions, EffectTrigger, Eventful, Evolution, HistoryValue, Indexable, IterableWeakMap, IterableWeakSet, ReactiveBase, ScopedCallback, ZoneAggregator, addBatchCleanup, addUnreactiveProps, allocated, allocatedValues, arrayDiff, arrayEquals, assertUntracked, asyncHook, asyncHooks, atom, atomic, attend, biDi, cache, cached, callOnGC, captioned, captured, caught, chainPromise, createFlavor, debounce, decorator, deepCompare, deepWatch, defer, deprecated, descriptor, destructor, effect, effectAggregator, effectContext, flavorOptions, flavored, forwardArray, getActivationLog, getActiveEffect, getAt, getState, hooks$1 as hooks, inheritCaption, isCached, isConstructor, isDev, isNonReactive, isObject, isProd, isTest, legacyDecorator, lift, link, memoize, mixin, modernDecorator, morph, named, onEffectThrow, organize, organized, profileInfo, reactive, reset, resource, root, setAt, tag, throttle, touched, touched1, unlink, unreactive, untracked, watch, when, withEffectContext, zip };
|
|
1407
|
-
export type { ArrayDiffResult, Captioned, ContextManager, Decorator, DecoratorDescription, DecoratorFactory, EffectContext, EventsBase, GenericClassDecorator, Hook, LegacyClassDecorator, LegacyPropertyDecorator, Memoizable, MemoizableArgument, MixinClass, MixinFunction, ModernAccessorDecorator, ModernClassDecorator, ModernGetterDecorator, ModernMethodDecorator, ModernSetterDecorator, PromiseChain, Resource, Restorer };
|
|
1439
|
+
export { ArrayReadForward, CleanupReason, CompareSymbol, DecoratorError, Destroyable, DestructionError, EffectAccess, EffectCleanup, EffectCloser, EffectOptions, EffectTrigger, Eventful, Evolution, HistoryValue, Indexable, IterableWeakMap, IterableWeakSet, ReactiveBase, ScopedCallback, ZoneAggregator, addBatchCleanup, addUnreactiveProps, allocated, allocatedValues, arrayDiff, arrayEquals, assertUntracked, asyncHook, asyncHooks, atom, atomic, attend, biDi, cache, cached, callOnGC, captioned, captured, caught, chainPromise, createFlavor, debounce, decorator, deepCompare, deepWatch, defer, deprecated, descriptor, destructor, effect, effectAggregator, effectContext, flavorOptions, flavored, forwardArray, getActivationLog, getActiveEffect, getAt, getState, hooks$1 as hooks, inert, inheritCaption, isCached, isConstructor, isDev, isNonReactive, isObject, isProd, isReactiveBroken, isTest, legacyDecorator, lift, link, markRaw, markRawProps, memoize, mixin, modernDecorator, morph, named, onEffectThrow, onReactiveBroken, onReactiveReset, organize, organized, profileInfo, reactive, readonlyReactive, reset, resource, root, setAt, shallowReactive, tag, throttle, touched, touched1, unlink, unreactive, untracked, watch, when, withEffectContext, wrapInert, zip };
|
|
1440
|
+
export type { ArrayDiffResult, Captioned, ContextManager, Decorator, DecoratorDescription, DecoratorFactory, EffectContext, EventsBase, GenericClassDecorator, Hook, LegacyClassDecorator, LegacyPropertyDecorator, Memoizable, MemoizableArgument, MixinClass, MixinFunction, ModernAccessorDecorator, ModernClassDecorator, ModernGetterDecorator, ModernMethodDecorator, ModernSetterDecorator, MorphPosition, PromiseChain, Resource, Restorer };
|
package/dist/browser.dev.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
require('./debug.cjs');
|
|
4
4
|
require('./browser.cjs');
|
|
5
|
-
var index = require('./chunks/index-
|
|
6
|
-
var proxy = require('./chunks/proxy-
|
|
5
|
+
var index = require('./chunks/index-BnTNC9eC.cjs');
|
|
6
|
+
var proxy = require('./chunks/proxy-HA_QQnd5.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -83,6 +83,7 @@ exports.getActivationLog = proxy.getActivationLog;
|
|
|
83
83
|
exports.getActiveEffect = proxy.getActiveEffect;
|
|
84
84
|
exports.getState = proxy.getState;
|
|
85
85
|
exports.hooks = proxy.hooks;
|
|
86
|
+
exports.inert = proxy.inert;
|
|
86
87
|
exports.inheritCaption = proxy.inheritCaption;
|
|
87
88
|
exports.isConstructor = proxy.isConstructor;
|
|
88
89
|
exports.isDev = proxy.isDev;
|
|
@@ -90,26 +91,35 @@ exports.isNonReactive = proxy.isNonReactive;
|
|
|
90
91
|
exports.isObject = proxy.isObject;
|
|
91
92
|
exports.isProd = proxy.isProd;
|
|
92
93
|
exports.isReactive = proxy.isReactive;
|
|
94
|
+
exports.isReactiveBroken = proxy.isReactiveBroken;
|
|
93
95
|
exports.isTest = proxy.isTest;
|
|
94
96
|
exports.legacyDecorator = proxy.legacyDecorator;
|
|
95
97
|
exports.link = proxy.link;
|
|
98
|
+
exports.markRaw = proxy.markRaw;
|
|
99
|
+
exports.markRawProps = proxy.markRawProps;
|
|
96
100
|
exports.mixin = proxy.mixin;
|
|
97
101
|
exports.modernDecorator = proxy.modernDecorator;
|
|
98
102
|
exports.named = proxy.named;
|
|
99
103
|
exports.objectToProxy = proxy.objectToProxy;
|
|
100
104
|
exports.onEffectThrow = proxy.onEffectThrow;
|
|
105
|
+
exports.onReactiveBroken = proxy.onReactiveBroken;
|
|
106
|
+
exports.onReactiveReset = proxy.onReactiveReset;
|
|
101
107
|
exports.prodPreset = proxy.prodPreset;
|
|
102
108
|
exports.proxyToObject = proxy.proxyToObject;
|
|
103
109
|
exports.reactive = proxy.reactive;
|
|
104
110
|
exports.reactiveOptions = proxy.options;
|
|
111
|
+
exports.readonlyReactive = proxy.readonlyReactive;
|
|
105
112
|
exports.reset = proxy.reset;
|
|
106
113
|
exports.root = proxy.root;
|
|
114
|
+
exports.shallowReactive = proxy.shallowReactive;
|
|
107
115
|
exports.tag = proxy.tag;
|
|
116
|
+
exports.toRaw = proxy.toRaw;
|
|
108
117
|
exports.touched = proxy.touched;
|
|
109
118
|
exports.touched1 = proxy.touched1;
|
|
110
119
|
exports.unlink = proxy.unlink;
|
|
111
120
|
exports.untracked = proxy.untracked;
|
|
112
121
|
exports.unwrap = proxy.unwrap;
|
|
113
122
|
exports.withEffectContext = proxy.withEffectContext;
|
|
123
|
+
exports.wrapInert = proxy.wrapInert;
|
|
114
124
|
exports.zip = proxy.zip;
|
|
115
125
|
//# sourceMappingURL=browser.dev.cjs.map
|
package/dist/browser.dev.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.dev.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"browser.dev.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|