@poe-platform/safe-js 0.1.393 → 0.1.394
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/safe-js/chunks/{chunk-CTMJJJQL.js → chunk-PRG3UPLV.js} +2 -2
- package/dist/safe-js/chunks/{chunk-UDQ7HBDC.js → chunk-XVBBWKP2.js} +21 -9
- package/dist/safe-js/chunks/{chunk-UDQ7HBDC.js.map → chunk-XVBBWKP2.js.map} +3 -3
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/dist/safe-js/snapshot/guest-heap.d.ts +4 -0
- package/package.json +2 -2
- /package/dist/safe-js/chunks/{chunk-CTMJJJQL.js.map → chunk-PRG3UPLV.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-XVBBWKP2.js";
|
|
31
31
|
|
|
32
32
|
// packages/safe-js/src/migrate.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
|
@@ -8249,4 +8249,4 @@ export {
|
|
|
8249
8249
|
parseMcpConfig,
|
|
8250
8250
|
makeMcpModule
|
|
8251
8251
|
};
|
|
8252
|
-
//# sourceMappingURL=chunk-
|
|
8252
|
+
//# sourceMappingURL=chunk-PRG3UPLV.js.map
|
|
@@ -21171,9 +21171,11 @@ async function copyObjectRest(value, excludedKeys, context) {
|
|
|
21171
21171
|
}
|
|
21172
21172
|
}
|
|
21173
21173
|
|
|
21174
|
+
// packages/safe-js/src/interp/promise-resolvers.ts
|
|
21175
|
+
var promiseResolvingFunctions = /* @__PURE__ */ new WeakMap();
|
|
21176
|
+
|
|
21174
21177
|
// packages/safe-js/src/interp/promise.ts
|
|
21175
21178
|
var promiseConstructors = /* @__PURE__ */ new WeakSet();
|
|
21176
|
-
var promiseResolvingFunctions = /* @__PURE__ */ new WeakSet();
|
|
21177
21179
|
var intrinsicPromiseThenMethods = /* @__PURE__ */ new WeakSet();
|
|
21178
21180
|
var intrinsicPromiseConstructors = /* @__PURE__ */ new WeakMap();
|
|
21179
21181
|
var promisePrototypes2 = /* @__PURE__ */ new WeakMap();
|
|
@@ -21201,10 +21203,10 @@ function createPromiseGlobals(options) {
|
|
|
21201
21203
|
);
|
|
21202
21204
|
if (typeof targetPrototype === "object" && targetPrototype !== null && targetPrototype !== prototype)
|
|
21203
21205
|
setSandboxPrototype(pending, targetPrototype, options.budget);
|
|
21204
|
-
|
|
21206
|
+
const resolverState = { promise: pending, settled: false };
|
|
21205
21207
|
const settle = (state, value) => {
|
|
21206
|
-
if (settled) return;
|
|
21207
|
-
settled = true;
|
|
21208
|
+
if (resolverState.settled) return;
|
|
21209
|
+
resolverState.settled = true;
|
|
21208
21210
|
try {
|
|
21209
21211
|
if (state === "rejected") {
|
|
21210
21212
|
reject(budgetSandboxValue2(value, options.budget));
|
|
@@ -21237,7 +21239,7 @@ function createPromiseGlobals(options) {
|
|
|
21237
21239
|
return void 0;
|
|
21238
21240
|
}
|
|
21239
21241
|
});
|
|
21240
|
-
promiseResolvingFunctions.
|
|
21242
|
+
promiseResolvingFunctions.set(resolver, resolverState);
|
|
21241
21243
|
return resolver;
|
|
21242
21244
|
});
|
|
21243
21245
|
const result = executor.call(resolvers, { stack: context?.stack ?? [], thisValue: void 0 });
|
|
@@ -22242,6 +22244,12 @@ function serializeCollectionProperties(value, encode, dataOnly = false) {
|
|
|
22242
22244
|
|
|
22243
22245
|
// packages/safe-js/src/snapshot/guest-heap.ts
|
|
22244
22246
|
function captureGuestHeapNode(value, encode) {
|
|
22247
|
+
const resolver = isSandboxClosure(value) ? promiseResolvingFunctions.get(value) : void 0;
|
|
22248
|
+
if (resolver !== void 0) {
|
|
22249
|
+
const settlement = promiseStates.get(resolver.promise);
|
|
22250
|
+
if (!resolver.settled || settlement === void 0 || settlement.status === "pending") return void 0;
|
|
22251
|
+
return { kind: "promise-resolver", promise: encode(resolver.promise), state: captureObjectState(value, encode) };
|
|
22252
|
+
}
|
|
22245
22253
|
if (isSandboxPromise(value)) {
|
|
22246
22254
|
const settlement = promiseStates.get(value);
|
|
22247
22255
|
if (settlement !== void 0 && settlement.status !== "pending")
|
|
@@ -27691,7 +27699,7 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
27691
27699
|
createRawJson(node.text);
|
|
27692
27700
|
return true;
|
|
27693
27701
|
}
|
|
27694
|
-
if (!["intrinsic", "bound-function", "guest-function", "guest-class", "guest-generator", "scope-frame", "guest-object", "guest-array", "guest-boxed", "guest-date", "guest-regex", "guest-promise", "array-iterator", "string-iterator", "iterator-wrapper", "iterator-helper", "guest-collection-iterator", "guest-regexp-iterator", "map", "set"].includes(String(node.kind))) return false;
|
|
27702
|
+
if (!["intrinsic", "bound-function", "promise-resolver", "guest-function", "guest-class", "guest-generator", "scope-frame", "guest-object", "guest-array", "guest-boxed", "guest-date", "guest-regex", "guest-promise", "array-iterator", "string-iterator", "iterator-wrapper", "iterator-helper", "guest-collection-iterator", "guest-regexp-iterator", "map", "set"].includes(String(node.kind))) return false;
|
|
27695
27703
|
const reference = (value, kinds) => {
|
|
27696
27704
|
const ref = record3(value);
|
|
27697
27705
|
fields(ref, ["kind", "id"]);
|
|
@@ -27702,7 +27710,7 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
27702
27710
|
};
|
|
27703
27711
|
const callable = (value) => {
|
|
27704
27712
|
if (absent(value)) return;
|
|
27705
|
-
const target = reference(value, ["intrinsic", "bound-function", "guest-function", "guest-class"]);
|
|
27713
|
+
const target = reference(value, ["intrinsic", "bound-function", "promise-resolver", "guest-function", "guest-class"]);
|
|
27706
27714
|
if (target.kind === "intrinsic" && intrinsicCatalogue().get(String(target.id)) !== true)
|
|
27707
27715
|
throw new TypeError("Guest accessor reference is not callable.");
|
|
27708
27716
|
};
|
|
@@ -27772,7 +27780,11 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
27772
27780
|
});
|
|
27773
27781
|
return false;
|
|
27774
27782
|
}
|
|
27775
|
-
if (node.kind === "
|
|
27783
|
+
if (node.kind === "promise-resolver") {
|
|
27784
|
+
fields(node, ["kind", "promise", "state"]);
|
|
27785
|
+
reference(node.promise, ["guest-promise"]);
|
|
27786
|
+
state(node.state);
|
|
27787
|
+
} else if (node.kind === "guest-promise") {
|
|
27776
27788
|
fields(node, ["kind", "status", "value", "state"]);
|
|
27777
27789
|
if (node.status !== "fulfilled" && node.status !== "rejected") throw new TypeError("Invalid guest promise settlement.");
|
|
27778
27790
|
if (node.status === "fulfilled" && node.value !== null && typeof node.value === "object" && record3(node.value).kind === "ref" && reference(node.value) === node)
|
|
@@ -44989,4 +45001,4 @@ export {
|
|
|
44989
45001
|
FileSnapshotBackend,
|
|
44990
45002
|
run
|
|
44991
45003
|
};
|
|
44992
|
-
//# sourceMappingURL=chunk-
|
|
45004
|
+
//# sourceMappingURL=chunk-XVBBWKP2.js.map
|