poe-code 14.0.57 → 14.0.59
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/dist/index.js +461 -417
- package/dist/index.js.map +4 -4
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safe-js/dist/chunks/{chunk-N3CN2ACZ.js → chunk-D4YY44EF.js} +456 -413
- package/packages/safe-js/dist/chunks/{chunk-N3CN2ACZ.js.map → chunk-D4YY44EF.js.map} +4 -4
- package/packages/safe-js/dist/chunks/{chunk-H4O5OPM2.js → chunk-YZGYOQK3.js} +2 -2
- package/packages/safe-js/dist/cli.js +2 -2
- package/packages/safe-js/dist/core.js +1 -1
- package/packages/safe-js/dist/index.js +2 -2
- package/packages/safe-js/dist/interp/interpreter.js +387 -340
- package/packages/safe-js/dist/interp/resources.d.ts +1 -0
- package/packages/safe-js/dist/interp/resources.js +4 -0
- package/packages/safe-js/dist/realm.js +6 -2
- /package/packages/safe-js/dist/chunks/{chunk-H4O5OPM2.js.map → chunk-YZGYOQK3.js.map} +0 -0
|
@@ -6,6 +6,7 @@ export async function withRunResources(signal, execute) {
|
|
|
6
6
|
const cleanups = new Set();
|
|
7
7
|
const resources = {
|
|
8
8
|
signal: controller.signal,
|
|
9
|
+
referenceReleases: new Set(),
|
|
9
10
|
add(close) {
|
|
10
11
|
cleanups.add(close);
|
|
11
12
|
}
|
|
@@ -25,6 +26,9 @@ export async function withRunResources(signal, execute) {
|
|
|
25
26
|
finally {
|
|
26
27
|
signal?.removeEventListener("abort", cancel);
|
|
27
28
|
controller.abort(new Error("SafeJS run finished."));
|
|
29
|
+
for (const release of resources.referenceReleases)
|
|
30
|
+
release();
|
|
31
|
+
resources.referenceReleases.clear();
|
|
28
32
|
const outcomes = await Promise.allSettled([...cleanups].map((close) => Promise.resolve().then(close)));
|
|
29
33
|
errors = outcomes.flatMap((outcome) => (outcome.status === "rejected" ? [outcome.reason] : []));
|
|
30
34
|
}
|
|
@@ -34,6 +34,7 @@ class RealmState {
|
|
|
34
34
|
extensions;
|
|
35
35
|
consoleExtension;
|
|
36
36
|
cleanups = [];
|
|
37
|
+
referenceReleases = new Set();
|
|
37
38
|
callbacks = new Map();
|
|
38
39
|
pendingCallbacks = new Set();
|
|
39
40
|
callbackCache = new WeakMap();
|
|
@@ -458,7 +459,7 @@ class RealmState {
|
|
|
458
459
|
};
|
|
459
460
|
try {
|
|
460
461
|
const active = this.active !== undefined;
|
|
461
|
-
const pending = withSandboxPromiseRejectionTracker(this.tracker, () => runResources.run({ signal: this.controller.signal, add: this.onCleanup }, () => withCancellationSignal(this.controller.signal, () => active && this.phase.getStore()?.active ? runAsyncPrefix(invoke) : this.queue.run(invoke))));
|
|
462
|
+
const pending = withSandboxPromiseRejectionTracker(this.tracker, () => runResources.run({ signal: this.controller.signal, referenceReleases: this.referenceReleases, add: this.onCleanup }, () => withCancellationSignal(this.controller.signal, () => active && this.phase.getStore()?.active ? runAsyncPrefix(invoke) : this.queue.run(invoke))));
|
|
462
463
|
record.promise = active ? pending : this.perform(() => pending);
|
|
463
464
|
return await record.promise;
|
|
464
465
|
}
|
|
@@ -645,7 +646,7 @@ class RealmState {
|
|
|
645
646
|
this.assertOpen();
|
|
646
647
|
if (this.active !== undefined)
|
|
647
648
|
throw new SandboxError("reentry");
|
|
648
|
-
const pending = Promise.resolve().then(() => withSandboxPromiseRejectionTracker(this.tracker, () => runResources.run({ signal: this.controller.signal, add: this.onCleanup }, () => withCancellationSignal(this.controller.signal, task))));
|
|
649
|
+
const pending = Promise.resolve().then(() => withSandboxPromiseRejectionTracker(this.tracker, () => runResources.run({ signal: this.controller.signal, referenceReleases: this.referenceReleases, add: this.onCleanup }, () => withCancellationSignal(this.controller.signal, task))));
|
|
649
650
|
this.active = pending;
|
|
650
651
|
try {
|
|
651
652
|
const result = await pending;
|
|
@@ -701,6 +702,9 @@ class RealmState {
|
|
|
701
702
|
for (const reference of this.guestReferences.keys())
|
|
702
703
|
revokeGuestReference(reference, this);
|
|
703
704
|
this.guestReferences.clear();
|
|
705
|
+
for (const release of this.referenceReleases)
|
|
706
|
+
release();
|
|
707
|
+
this.referenceReleases.clear();
|
|
704
708
|
this.budget.setRetainedValues(this, undefined);
|
|
705
709
|
releaseObjectPrototype(this.budget);
|
|
706
710
|
this.disposal = (async () => {
|
|
File without changes
|