@poe-platform/safe-js 0.1.400 → 0.1.401
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-L5I53V56.js → chunk-HDEGJ4AI.js} +62 -6
- package/dist/safe-js/chunks/chunk-HDEGJ4AI.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-ETP3MEHS.js → chunk-YFCLIG72.js} +2 -2
- 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 +8 -0
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-L5I53V56.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-ETP3MEHS.js.map → chunk-YFCLIG72.js.map} +0 -0
|
@@ -8817,12 +8817,18 @@ var promiseAdoptionBridges = /* @__PURE__ */ new WeakMap();
|
|
|
8817
8817
|
var promiseAdoptionResolvers = /* @__PURE__ */ new WeakMap();
|
|
8818
8818
|
var promiseContinuations = /* @__PURE__ */ new WeakMap();
|
|
8819
8819
|
var promiseReactionResults = /* @__PURE__ */ new WeakMap();
|
|
8820
|
+
var promiseProducers = /* @__PURE__ */ new WeakMap();
|
|
8820
8821
|
function trackPromiseContinuation(promise, continuation) {
|
|
8821
8822
|
promiseContinuations.set(promise, continuation);
|
|
8822
8823
|
if (continuation.kind === "reaction") {
|
|
8823
8824
|
let results = promiseReactionResults.get(continuation.source);
|
|
8824
8825
|
if (results === void 0) promiseReactionResults.set(continuation.source, results = /* @__PURE__ */ new Set());
|
|
8825
8826
|
results.add(promise);
|
|
8827
|
+
if (continuation.capability !== void 0) {
|
|
8828
|
+
let producers = promiseProducers.get(continuation.capability.promise);
|
|
8829
|
+
if (producers === void 0) promiseProducers.set(continuation.capability.promise, producers = /* @__PURE__ */ new Set());
|
|
8830
|
+
producers.add(promise);
|
|
8831
|
+
}
|
|
8826
8832
|
}
|
|
8827
8833
|
const release = () => {
|
|
8828
8834
|
promiseContinuations.delete(promise);
|
|
@@ -8831,6 +8837,11 @@ function trackPromiseContinuation(promise, continuation) {
|
|
|
8831
8837
|
const results = promiseReactionResults.get(continuation.source);
|
|
8832
8838
|
results?.delete(promise);
|
|
8833
8839
|
if (results?.size === 0) promiseReactionResults.delete(continuation.source);
|
|
8840
|
+
if (continuation.capability !== void 0) {
|
|
8841
|
+
const producers = promiseProducers.get(continuation.capability.promise);
|
|
8842
|
+
producers?.delete(promise);
|
|
8843
|
+
if (producers?.size === 0) promiseProducers.delete(continuation.capability.promise);
|
|
8844
|
+
}
|
|
8834
8845
|
}
|
|
8835
8846
|
};
|
|
8836
8847
|
promise.promise.then(release, release);
|
|
@@ -21549,18 +21560,28 @@ function getPromisePrototype(budget) {
|
|
|
21549
21560
|
const finish = (constructor2) => {
|
|
21550
21561
|
if (!isSandboxPromiseConstructor(constructor2)) {
|
|
21551
21562
|
return createPromiseCapability(constructor2, budget, context).then((capability) => {
|
|
21552
|
-
|
|
21553
|
-
|
|
21554
|
-
|
|
21563
|
+
observeSandboxPromise(target, isSandboxPromise(capability.promise));
|
|
21564
|
+
const continuation2 = isSandboxPromise(capability.promise) ? {
|
|
21565
|
+
kind: "reaction",
|
|
21566
|
+
phase: "waiting",
|
|
21567
|
+
source: target,
|
|
21568
|
+
onFulfilled,
|
|
21569
|
+
onRejected,
|
|
21570
|
+
capability: { ...capability, promise: capability.promise }
|
|
21571
|
+
} : void 0;
|
|
21572
|
+
const completion = createSandboxPromise(target.promise.then(
|
|
21555
21573
|
(value) => {
|
|
21574
|
+
if (continuation2 !== void 0) continuation2.phase = "running";
|
|
21556
21575
|
consumeSettledHostCall(target);
|
|
21557
21576
|
return runCapabilityReaction(onFulfilled, value, "fulfilled", capability, budget, context);
|
|
21558
21577
|
},
|
|
21559
21578
|
(reason) => {
|
|
21579
|
+
if (continuation2 !== void 0) continuation2.phase = "running";
|
|
21560
21580
|
consumeSettledHostCall(target);
|
|
21561
21581
|
return runCapabilityReaction(onRejected, reason, "rejected", capability, budget, context);
|
|
21562
21582
|
}
|
|
21563
21583
|
));
|
|
21584
|
+
if (continuation2 !== void 0) trackPromiseContinuation(completion, continuation2);
|
|
21564
21585
|
return capability.promise;
|
|
21565
21586
|
});
|
|
21566
21587
|
}
|
|
@@ -22339,12 +22360,14 @@ function captureGuestHeapNode(value, encode) {
|
|
|
22339
22360
|
return { kind: "promise-resolver", promise: encode(resolver.promise), state: captureObjectState(value, encode) };
|
|
22340
22361
|
}
|
|
22341
22362
|
if (isSandboxPromise(value)) {
|
|
22363
|
+
const producerState = promiseProducers.has(value) ? { producers: [...promiseProducers.get(value)].map(encode) } : {};
|
|
22342
22364
|
const settlement = promiseStates.get(value);
|
|
22343
22365
|
if (settlement !== void 0 && settlement.status !== "pending")
|
|
22344
22366
|
return {
|
|
22345
22367
|
kind: "guest-promise",
|
|
22346
22368
|
status: settlement.status,
|
|
22347
22369
|
value: encode(settlement.value),
|
|
22370
|
+
...producerState,
|
|
22348
22371
|
...promiseReactionResults.has(value) ? { reactions: [...promiseReactionResults.get(value)].map(encode) } : {},
|
|
22349
22372
|
state: captureObjectState(value, encode)
|
|
22350
22373
|
};
|
|
@@ -22358,6 +22381,7 @@ function captureGuestHeapNode(value, encode) {
|
|
|
22358
22381
|
return {
|
|
22359
22382
|
kind: "pending-promise",
|
|
22360
22383
|
...continuation.state.settled ? { adoption: encode(adoption) } : {},
|
|
22384
|
+
...producerState,
|
|
22361
22385
|
reactions: [...promiseReactionResults.get(value) ?? []].map(encode),
|
|
22362
22386
|
state: captureObjectState(value, encode)
|
|
22363
22387
|
};
|
|
@@ -22366,6 +22390,12 @@ function captureGuestHeapNode(value, encode) {
|
|
|
22366
22390
|
return {
|
|
22367
22391
|
kind: "promise-reaction",
|
|
22368
22392
|
source: encode(continuation.source),
|
|
22393
|
+
...producerState,
|
|
22394
|
+
...continuation.capability === void 0 ? {} : { capability: {
|
|
22395
|
+
promise: encode(continuation.capability.promise),
|
|
22396
|
+
resolve: encode(continuation.capability.resolve),
|
|
22397
|
+
reject: encode(continuation.capability.reject)
|
|
22398
|
+
} },
|
|
22369
22399
|
onFulfilled: encode(continuation.onFulfilled),
|
|
22370
22400
|
onRejected: encode(continuation.onRejected),
|
|
22371
22401
|
reactions: [...promiseReactionResults.get(value) ?? []].map(encode),
|
|
@@ -27900,6 +27930,15 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
27900
27930
|
if (typeof descriptor.enumerable !== "boolean" || typeof descriptor.configurable !== "boolean") throw new TypeError("Invalid guest descriptor flags.");
|
|
27901
27931
|
}
|
|
27902
27932
|
};
|
|
27933
|
+
if (Object.hasOwn(node, "producers")) {
|
|
27934
|
+
const producers = /* @__PURE__ */ new Set();
|
|
27935
|
+
for (const entry of array(node.producers)) {
|
|
27936
|
+
const producer = reference(entry, ["promise-reaction"]);
|
|
27937
|
+
if (producers.has(producer) || reference(record3(producer.capability).promise) !== node)
|
|
27938
|
+
throw new TypeError("Invalid promise producer ownership.");
|
|
27939
|
+
producers.add(producer);
|
|
27940
|
+
}
|
|
27941
|
+
}
|
|
27903
27942
|
if (node.kind === "map" || node.kind === "set") {
|
|
27904
27943
|
fields(node, ["kind", node.kind === "map" ? "entries" : "values"], ["propertyState", "prototype", "privateElements"]);
|
|
27905
27944
|
if (node.privateElements !== void 0) privateState(node.privateElements);
|
|
@@ -27941,12 +27980,23 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
27941
27980
|
throw new TypeError("Invalid promise resolver action.");
|
|
27942
27981
|
state(node.state);
|
|
27943
27982
|
} else if (node.kind === "pending-promise" || node.kind === "promise-reaction") {
|
|
27944
|
-
fields(node, node.kind === "pending-promise" ? ["kind", "reactions", "state"] : ["kind", "source", "onFulfilled", "onRejected", "reactions", "state"], node.kind === "pending-promise" ? ["adoption"] : []);
|
|
27983
|
+
fields(node, node.kind === "pending-promise" ? ["kind", "reactions", "state"] : ["kind", "source", "onFulfilled", "onRejected", "reactions", "state"], node.kind === "pending-promise" ? ["adoption", "producers"] : ["capability", "producers"]);
|
|
27945
27984
|
if (node.kind === "pending-promise" && Object.hasOwn(node, "adoption")) {
|
|
27946
27985
|
const bridge = reference(node.adoption, ["promise-adoption"]);
|
|
27947
27986
|
if (reference(bridge.owner, ["pending-promise"]) !== node) throw new TypeError("Invalid promise adoption owner.");
|
|
27948
27987
|
}
|
|
27949
27988
|
if (node.kind === "promise-reaction") {
|
|
27989
|
+
if (Object.hasOwn(node, "capability")) {
|
|
27990
|
+
const capability = record3(node.capability);
|
|
27991
|
+
fields(capability, ["promise", "resolve", "reject"]);
|
|
27992
|
+
const result = reference(capability.promise, ["pending-promise", "guest-promise", "promise-reaction"]);
|
|
27993
|
+
if (result === node) throw new TypeError("Invalid promise producer ownership.");
|
|
27994
|
+
if (!Array.isArray(result.producers) || !result.producers.some((entry) => reference(entry, ["promise-reaction"]) === node))
|
|
27995
|
+
throw new TypeError("Unlisted promise producer.");
|
|
27996
|
+
if (absent(capability.resolve) || absent(capability.reject)) throw new TypeError("Missing promise producer resolver.");
|
|
27997
|
+
callable(capability.resolve);
|
|
27998
|
+
callable(capability.reject);
|
|
27999
|
+
}
|
|
27950
28000
|
const source = reference(node.source, ["pending-promise", "promise-reaction", "guest-promise"]);
|
|
27951
28001
|
if (!Array.isArray(source.reactions) || !source.reactions.some((entry) => reference(entry, ["promise-reaction"]) === node))
|
|
27952
28002
|
throw new TypeError("Unlisted promise reaction.");
|
|
@@ -27961,7 +28011,7 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
27961
28011
|
}
|
|
27962
28012
|
state(node.state);
|
|
27963
28013
|
} else if (node.kind === "guest-promise") {
|
|
27964
|
-
fields(node, ["kind", "status", "value", "state"], ["reactions"]);
|
|
28014
|
+
fields(node, ["kind", "status", "value", "state"], ["reactions", "producers"]);
|
|
27965
28015
|
if (Object.hasOwn(node, "reactions")) {
|
|
27966
28016
|
if (!Array.isArray(node.reactions)) throw new TypeError("Invalid promise reactions.");
|
|
27967
28017
|
const reactions = /* @__PURE__ */ new Set();
|
|
@@ -30200,8 +30250,14 @@ function measureSandboxData(values, options = {}) {
|
|
|
30200
30250
|
visit(continuation.source, depth + 1);
|
|
30201
30251
|
visit(continuation.onFulfilled, depth + 1);
|
|
30202
30252
|
visit(continuation.onRejected, depth + 1);
|
|
30253
|
+
if (continuation.capability !== void 0) {
|
|
30254
|
+
visit(continuation.capability.promise, depth + 1);
|
|
30255
|
+
visit(continuation.capability.resolve, depth + 1);
|
|
30256
|
+
visit(continuation.capability.reject, depth + 1);
|
|
30257
|
+
}
|
|
30203
30258
|
}
|
|
30204
30259
|
for (const reaction of promiseReactionResults.get(value) ?? []) visit(reaction, depth + 1);
|
|
30260
|
+
for (const producer of promiseProducers.get(value) ?? []) visit(producer, depth + 1);
|
|
30205
30261
|
for (const key of Reflect.ownKeys(getPromiseProperties(value))) {
|
|
30206
30262
|
const descriptor = Object.getOwnPropertyDescriptor(getPromiseProperties(value), key);
|
|
30207
30263
|
usage += typeof key === "string" ? key.length + 1 : 1;
|
|
@@ -45217,4 +45273,4 @@ export {
|
|
|
45217
45273
|
FileSnapshotBackend,
|
|
45218
45274
|
run
|
|
45219
45275
|
};
|
|
45220
|
-
//# sourceMappingURL=chunk-
|
|
45276
|
+
//# sourceMappingURL=chunk-HDEGJ4AI.js.map
|