@poe-platform/safe-js 0.1.273 → 0.1.275
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-Y7SBHDZT.js → chunk-MPVIYBZC.js} +31 -14
- package/dist/safe-js/chunks/chunk-MPVIYBZC.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-D6UH6V3H.js → chunk-XDACAERJ.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/package.json +2 -2
- package/dist/safe-js/chunks/chunk-Y7SBHDZT.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-D6UH6V3H.js.map → chunk-XDACAERJ.js.map} +0 -0
|
@@ -7783,6 +7783,7 @@ var intrinsicPrototypes = /* @__PURE__ */ new WeakMap();
|
|
|
7783
7783
|
var boxedPrototypes = /* @__PURE__ */ new WeakMap();
|
|
7784
7784
|
var regexPrototypes = /* @__PURE__ */ new WeakMap();
|
|
7785
7785
|
var collectionPrototypes = /* @__PURE__ */ new WeakMap();
|
|
7786
|
+
var promisePrototypes = /* @__PURE__ */ new WeakMap();
|
|
7786
7787
|
var initialRegexDescriptors = /* @__PURE__ */ new WeakMap();
|
|
7787
7788
|
var intrinsicPrototypeRoots = /* @__PURE__ */ new WeakMap();
|
|
7788
7789
|
var intrinsicConstructors = /* @__PURE__ */ new WeakMap();
|
|
@@ -7858,6 +7859,10 @@ function installCollectionPrototype(budget, name, prototype, constructor) {
|
|
|
7858
7859
|
state.set(name, prototype);
|
|
7859
7860
|
registerIntrinsicPrototype(budget, prototype, constructor);
|
|
7860
7861
|
}
|
|
7862
|
+
function installPromisePrototype(budget, prototype, constructor) {
|
|
7863
|
+
promisePrototypes.set(budget, prototype);
|
|
7864
|
+
registerIntrinsicPrototype(budget, prototype, constructor);
|
|
7865
|
+
}
|
|
7861
7866
|
function hasRegexPropertyOverride(value, keys, budget) {
|
|
7862
7867
|
const initial = initialRegexDescriptors.get(budget);
|
|
7863
7868
|
const prototype = regexPrototypes.get(budget);
|
|
@@ -7937,11 +7942,13 @@ function releaseObjectPrototype(budget) {
|
|
|
7937
7942
|
boxedPrototypes.delete(budget);
|
|
7938
7943
|
regexPrototypes.delete(budget);
|
|
7939
7944
|
collectionPrototypes.delete(budget);
|
|
7945
|
+
promisePrototypes.delete(budget);
|
|
7940
7946
|
initialRegexDescriptors.delete(budget);
|
|
7941
7947
|
intrinsicPrototypes.delete(budget);
|
|
7942
7948
|
}
|
|
7943
7949
|
function getSandboxPrototype(value, budget) {
|
|
7944
7950
|
if (prototypes.has(value)) return prototypes.get(value) ?? null;
|
|
7951
|
+
if (budget !== void 0 && isSandboxPromise(value)) return promisePrototypes.get(budget) ?? null;
|
|
7945
7952
|
if (budget !== void 0 && (isSandboxMap(value) || isSandboxSet(value)))
|
|
7946
7953
|
return collectionPrototypes.get(budget)?.get(isSandboxMap(value) ? "Map" : "Set") ?? null;
|
|
7947
7954
|
if (budget !== void 0 && isSandboxRegex(value)) return regexPrototypes.get(budget) ?? null;
|
|
@@ -8005,7 +8012,7 @@ function setSandboxPrototype(value, prototype, budget) {
|
|
|
8005
8012
|
if (budget !== void 0 && intrinsicPrototypes.get(budget) === value && prototype !== null) {
|
|
8006
8013
|
throw new TypeError("Object.prototype has an immutable null prototype.");
|
|
8007
8014
|
}
|
|
8008
|
-
if (!Array.isArray(value) && !isSandboxRegex(value) && !isSandboxMap(value) && !isSandboxSet(value) && !isPrototypeRecord(value) || prototype !== null && !Array.isArray(prototype) && !isSandboxRegex(prototype) && !isSandboxMap(prototype) && !isSandboxSet(prototype) && !isPrototypeRecord(prototype)) {
|
|
8015
|
+
if (!Array.isArray(value) && !isSandboxPromise(value) && !isSandboxRegex(value) && !isSandboxMap(value) && !isSandboxSet(value) && !isPrototypeRecord(value) || prototype !== null && !Array.isArray(prototype) && !isSandboxPromise(prototype) && !isSandboxRegex(prototype) && !isSandboxMap(prototype) && !isSandboxSet(prototype) && !isPrototypeRecord(prototype)) {
|
|
8009
8016
|
throw new TypeError(
|
|
8010
8017
|
"Prototype links require supported sandbox objects."
|
|
8011
8018
|
);
|
|
@@ -8014,7 +8021,7 @@ function setSandboxPrototype(value, prototype, budget) {
|
|
|
8014
8021
|
if (prototype === null) prototypes.set(value, null);
|
|
8015
8022
|
return;
|
|
8016
8023
|
}
|
|
8017
|
-
if (!Object.isExtensible(isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value)) {
|
|
8024
|
+
if (!Object.isExtensible(isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value)) {
|
|
8018
8025
|
throw new TypeError("Cannot change the prototype of a non-extensible object.");
|
|
8019
8026
|
}
|
|
8020
8027
|
let depth = 0;
|
|
@@ -11598,13 +11605,14 @@ function syncIterator(iterator) {
|
|
|
11598
11605
|
|
|
11599
11606
|
// packages/safe-js/src/interp/promise.ts
|
|
11600
11607
|
var promiseConstructors = /* @__PURE__ */ new WeakSet();
|
|
11608
|
+
var intrinsicPromiseThenMethods = /* @__PURE__ */ new WeakSet();
|
|
11601
11609
|
var intrinsicPromiseConstructors = /* @__PURE__ */ new WeakMap();
|
|
11602
|
-
var
|
|
11610
|
+
var promisePrototypes2 = /* @__PURE__ */ new WeakMap();
|
|
11603
11611
|
function isSandboxPromiseConstructor(value) {
|
|
11604
11612
|
return isSandboxClosure(value) && promiseConstructors.has(value);
|
|
11605
11613
|
}
|
|
11606
11614
|
function createPromiseGlobals(options) {
|
|
11607
|
-
|
|
11615
|
+
promisePrototypes2.delete(options.budget);
|
|
11608
11616
|
const prototype = getPromisePrototype(options.budget);
|
|
11609
11617
|
const construct = async ([executor], context) => {
|
|
11610
11618
|
if (!isSandboxClosure(executor)) throw new TypeError("Promise executor must be a function.");
|
|
@@ -11751,7 +11759,7 @@ function createPromiseGlobals(options) {
|
|
|
11751
11759
|
};
|
|
11752
11760
|
if (!isSandboxPromise(value)) return finish(void 0);
|
|
11753
11761
|
const descriptor = getSandboxPropertyDescriptor(value, "constructor", options.budget);
|
|
11754
|
-
const actualConstructor = descriptor === void 0 ? getPromiseMember("constructor", options.budget) : readPropertyDescriptor(descriptor, value, context, true);
|
|
11762
|
+
const actualConstructor = descriptor === void 0 ? hasExplicitSandboxPrototype(value) ? void 0 : getPromiseMember("constructor", options.budget) : readPropertyDescriptor(descriptor, value, context, true);
|
|
11755
11763
|
return actualConstructor instanceof Promise ? actualConstructor.then(finish) : finish(actualConstructor);
|
|
11756
11764
|
},
|
|
11757
11765
|
guest: true,
|
|
@@ -11800,6 +11808,7 @@ function createPromiseGlobals(options) {
|
|
|
11800
11808
|
intrinsicPromiseConstructors.set(options.budget, promiseConstructor);
|
|
11801
11809
|
registerIntrinsicFunction(options.budget, species);
|
|
11802
11810
|
registerIntrinsicFunction(options.budget, promiseConstructor);
|
|
11811
|
+
installPromisePrototype(options.budget, prototype, promiseConstructor);
|
|
11803
11812
|
for (const method of [
|
|
11804
11813
|
...Object.values(properties),
|
|
11805
11814
|
...Object.values(Object.getOwnPropertyDescriptors(prototype)).map((descriptor) => descriptor.value)
|
|
@@ -11875,7 +11884,7 @@ async function callPromiseClosure(callback, args, thisValue, budget, context) {
|
|
|
11875
11884
|
}
|
|
11876
11885
|
}
|
|
11877
11886
|
function getPromisePrototype(budget) {
|
|
11878
|
-
const existing =
|
|
11887
|
+
const existing = promisePrototypes2.get(budget);
|
|
11879
11888
|
if (existing !== void 0) return existing;
|
|
11880
11889
|
const prototype = {
|
|
11881
11890
|
then: createSandboxClosure({
|
|
@@ -12018,13 +12027,15 @@ function getPromisePrototype(budget) {
|
|
|
12018
12027
|
length: 1
|
|
12019
12028
|
})
|
|
12020
12029
|
};
|
|
12030
|
+
intrinsicPromiseThenMethods.add(prototype.then);
|
|
12021
12031
|
for (const name of Object.keys(prototype)) {
|
|
12022
12032
|
Object.defineProperty(prototype, name, { enumerable: false });
|
|
12023
12033
|
}
|
|
12024
|
-
|
|
12034
|
+
promisePrototypes2.set(budget, prototype);
|
|
12025
12035
|
return prototype;
|
|
12026
12036
|
}
|
|
12027
12037
|
function readPromiseReceiverProperty(receiver, property, prototype, context) {
|
|
12038
|
+
if (isSandboxPromise(receiver) && hasExplicitSandboxPrototype(receiver)) return void 0;
|
|
12028
12039
|
if (!isSandboxPromise(receiver) && context?.getProperty !== void 0)
|
|
12029
12040
|
return context.getProperty(receiver, property);
|
|
12030
12041
|
const properties = isSandboxPromise(receiver) ? prototype : isSandboxClosure(receiver) ? receiver.properties : receiver;
|
|
@@ -12210,7 +12221,7 @@ function resolveSandboxValueNow(value, options) {
|
|
|
12210
12221
|
options.budget === void 0 ? new TypeError("Promise cannot resolve to itself.") : createSubsetErrorValue("TypeError", "Promise cannot resolve to itself.", [], options.budget)
|
|
12211
12222
|
);
|
|
12212
12223
|
}
|
|
12213
|
-
if (isSandboxPromise(value) &&
|
|
12224
|
+
if (isSandboxPromise(value) && !hasCustomPromiseThen(value, options.budget)) {
|
|
12214
12225
|
if (options.budget !== void 0) {
|
|
12215
12226
|
return resolvePromiseResult(value, options.budget, options.self);
|
|
12216
12227
|
}
|
|
@@ -12393,10 +12404,10 @@ function resolvePromiseResult(result, budget, self) {
|
|
|
12393
12404
|
createSubsetErrorValue("TypeError", "Promise cannot resolve to itself.", [], budget)
|
|
12394
12405
|
);
|
|
12395
12406
|
}
|
|
12396
|
-
if (!isSandboxPromise(result) ||
|
|
12407
|
+
if (!isSandboxPromise(result) || hasCustomPromiseThen(result, budget)) {
|
|
12397
12408
|
return resolveSandboxValue(result, { budget, self });
|
|
12398
12409
|
}
|
|
12399
|
-
const then = getPromiseMember("then", budget);
|
|
12410
|
+
const then = getSandboxPropertyDescriptor(result, "then", budget)?.value ?? getPromiseMember("then", budget);
|
|
12400
12411
|
if (!isSandboxClosure(then)) return Promise.resolve(result);
|
|
12401
12412
|
return new Promise((resolve, reject) => {
|
|
12402
12413
|
let settled = false;
|
|
@@ -12453,6 +12464,11 @@ function resolvePromiseResult(result, budget, self) {
|
|
|
12453
12464
|
function isSelfResolution(result, self) {
|
|
12454
12465
|
return self !== void 0 && (result === self || isSandboxPromise(result) && result.promise === self.promise);
|
|
12455
12466
|
}
|
|
12467
|
+
function hasCustomPromiseThen(value, budget) {
|
|
12468
|
+
const descriptor = getSandboxPropertyDescriptor(value, "then", budget);
|
|
12469
|
+
if (descriptor === void 0 && isSandboxPromise(value) && hasExplicitSandboxPrototype(value)) return true;
|
|
12470
|
+
return descriptor !== void 0 && (!isSandboxClosure(descriptor.value) || !intrinsicPromiseThenMethods.has(descriptor.value));
|
|
12471
|
+
}
|
|
12456
12472
|
function requiresPromiseResolution(value, budget) {
|
|
12457
12473
|
if (isSandboxPromise(value)) return true;
|
|
12458
12474
|
const descriptor = getSandboxPropertyDescriptor(value, "then", budget);
|
|
@@ -18177,7 +18193,7 @@ function getPropertyValue(target, property, context, receiver = target) {
|
|
|
18177
18193
|
return getCollectionIteratorMember(target, property, context.budget);
|
|
18178
18194
|
if (isSandboxGenerator(target)) return getGeneratorMember(target, property, context.budget);
|
|
18179
18195
|
if (isSandboxClosure(target)) return getClosureMemberValue(target, property, context);
|
|
18180
|
-
if (isSandboxPromise(target)) return getPromiseMember(property, context.budget);
|
|
18196
|
+
if (isSandboxPromise(target)) return hasExplicitSandboxPrototype(target) ? void 0 : getPromiseMember(property, context.budget);
|
|
18181
18197
|
if (isSandboxRegex(target)) return hasExplicitSandboxPrototype(target) || getSandboxPrototype(target, context.budget) !== null ? void 0 : getRegexMember(target, property, context.budget, createCoercionContext(context));
|
|
18182
18198
|
if (!isIndexableSandboxValue(target)) {
|
|
18183
18199
|
throw new TypeError("Attempted to read a property from a non-object value.");
|
|
@@ -18759,7 +18775,6 @@ async function evaluateInstanceof(left, right, context) {
|
|
|
18759
18775
|
context.budget.visitNode();
|
|
18760
18776
|
right = right.boundTarget;
|
|
18761
18777
|
}
|
|
18762
|
-
if (isSandboxPromiseConstructor(right)) return isSandboxPromise(left);
|
|
18763
18778
|
if (isFloat32ArrayConstructor(right)) return isFloat32Array(left);
|
|
18764
18779
|
if (isDateConstructor(right))
|
|
18765
18780
|
return isSandboxDate(left) && getDatePrototype(left, context.budget, context.compilation?.owner) !== null;
|
|
@@ -21485,6 +21500,7 @@ function serializeSafeJSSnapshot(snapshot) {
|
|
|
21485
21500
|
}
|
|
21486
21501
|
function createDumpFile(snapshot) {
|
|
21487
21502
|
const state = {
|
|
21503
|
+
replayPromises: inMemoryRunSnapshots.has(snapshot),
|
|
21488
21504
|
float32Buffers: /* @__PURE__ */ new WeakMap(),
|
|
21489
21505
|
heap: {},
|
|
21490
21506
|
...indexHeapContainers(snapshot),
|
|
@@ -21541,7 +21557,7 @@ function serializeDumpValue(value, path, state) {
|
|
|
21541
21557
|
}
|
|
21542
21558
|
return { kind: "ref", id };
|
|
21543
21559
|
}
|
|
21544
|
-
if (hasGuestObjectState(value)) {
|
|
21560
|
+
if (hasGuestObjectState(value) && !(state.replayPromises && isSandboxPromise(value))) {
|
|
21545
21561
|
throw new TypeError("Guest function properties and prototype links cannot be serialized.");
|
|
21546
21562
|
}
|
|
21547
21563
|
if (isSandboxRegExpIterator(value) || isSandboxRegex(value) && hasCustomRegexProperties(value) || isSandboxBox(value) || isSandboxDate(value) || isFloat32Array(value)) return serializeHeapReference(value, path, state);
|
|
@@ -25900,6 +25916,7 @@ function copyFromSandbox(value, state, path = "<root>", options, depth = 0) {
|
|
|
25900
25916
|
value: copyFromSandbox(descriptor.value, state, `${path}.<property>`, options, depth + 1)
|
|
25901
25917
|
});
|
|
25902
25918
|
}
|
|
25919
|
+
if (hasNullObjectPrototype(value)) Object.setPrototypeOf(copy, null);
|
|
25903
25920
|
if (!Object.isExtensible(properties)) Object.preventExtensions(copy);
|
|
25904
25921
|
return copy;
|
|
25905
25922
|
}
|
|
@@ -40224,4 +40241,4 @@ export {
|
|
|
40224
40241
|
FileSnapshotBackend,
|
|
40225
40242
|
run
|
|
40226
40243
|
};
|
|
40227
|
-
//# sourceMappingURL=chunk-
|
|
40244
|
+
//# sourceMappingURL=chunk-MPVIYBZC.js.map
|