@poe-platform/safe-js 0.1.273 → 0.1.274
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-4MTUBJBW.js} +22 -9
- package/dist/safe-js/chunks/chunk-4MTUBJBW.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-D6UH6V3H.js → chunk-DFCAK73K.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-DFCAK73K.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;
|
|
@@ -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.");
|
|
@@ -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,10 +12027,11 @@ 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) {
|
|
@@ -12210,7 +12220,7 @@ function resolveSandboxValueNow(value, options) {
|
|
|
12210
12220
|
options.budget === void 0 ? new TypeError("Promise cannot resolve to itself.") : createSubsetErrorValue("TypeError", "Promise cannot resolve to itself.", [], options.budget)
|
|
12211
12221
|
);
|
|
12212
12222
|
}
|
|
12213
|
-
if (isSandboxPromise(value) &&
|
|
12223
|
+
if (isSandboxPromise(value) && !hasCustomPromiseThen(value, options.budget)) {
|
|
12214
12224
|
if (options.budget !== void 0) {
|
|
12215
12225
|
return resolvePromiseResult(value, options.budget, options.self);
|
|
12216
12226
|
}
|
|
@@ -12393,10 +12403,10 @@ function resolvePromiseResult(result, budget, self) {
|
|
|
12393
12403
|
createSubsetErrorValue("TypeError", "Promise cannot resolve to itself.", [], budget)
|
|
12394
12404
|
);
|
|
12395
12405
|
}
|
|
12396
|
-
if (!isSandboxPromise(result) ||
|
|
12406
|
+
if (!isSandboxPromise(result) || hasCustomPromiseThen(result, budget)) {
|
|
12397
12407
|
return resolveSandboxValue(result, { budget, self });
|
|
12398
12408
|
}
|
|
12399
|
-
const then = getPromiseMember("then", budget);
|
|
12409
|
+
const then = getSandboxPropertyDescriptor(result, "then", budget)?.value ?? getPromiseMember("then", budget);
|
|
12400
12410
|
if (!isSandboxClosure(then)) return Promise.resolve(result);
|
|
12401
12411
|
return new Promise((resolve, reject) => {
|
|
12402
12412
|
let settled = false;
|
|
@@ -12453,6 +12463,10 @@ function resolvePromiseResult(result, budget, self) {
|
|
|
12453
12463
|
function isSelfResolution(result, self) {
|
|
12454
12464
|
return self !== void 0 && (result === self || isSandboxPromise(result) && result.promise === self.promise);
|
|
12455
12465
|
}
|
|
12466
|
+
function hasCustomPromiseThen(value, budget) {
|
|
12467
|
+
const descriptor = getSandboxPropertyDescriptor(value, "then", budget);
|
|
12468
|
+
return descriptor !== void 0 && (!isSandboxClosure(descriptor.value) || !intrinsicPromiseThenMethods.has(descriptor.value));
|
|
12469
|
+
}
|
|
12456
12470
|
function requiresPromiseResolution(value, budget) {
|
|
12457
12471
|
if (isSandboxPromise(value)) return true;
|
|
12458
12472
|
const descriptor = getSandboxPropertyDescriptor(value, "then", budget);
|
|
@@ -18759,7 +18773,6 @@ async function evaluateInstanceof(left, right, context) {
|
|
|
18759
18773
|
context.budget.visitNode();
|
|
18760
18774
|
right = right.boundTarget;
|
|
18761
18775
|
}
|
|
18762
|
-
if (isSandboxPromiseConstructor(right)) return isSandboxPromise(left);
|
|
18763
18776
|
if (isFloat32ArrayConstructor(right)) return isFloat32Array(left);
|
|
18764
18777
|
if (isDateConstructor(right))
|
|
18765
18778
|
return isSandboxDate(left) && getDatePrototype(left, context.budget, context.compilation?.owner) !== null;
|
|
@@ -40224,4 +40237,4 @@ export {
|
|
|
40224
40237
|
FileSnapshotBackend,
|
|
40225
40238
|
run
|
|
40226
40239
|
};
|
|
40227
|
-
//# sourceMappingURL=chunk-
|
|
40240
|
+
//# sourceMappingURL=chunk-4MTUBJBW.js.map
|