@poe-platform/safe-js 0.1.272 → 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-5AXKUJ6N.js → chunk-4MTUBJBW.js} +55 -18
- package/dist/safe-js/chunks/chunk-4MTUBJBW.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-3ANG72OY.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-5AXKUJ6N.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-3ANG72OY.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.");
|
|
@@ -11695,7 +11703,9 @@ function createPromiseGlobals(options) {
|
|
|
11695
11703
|
context === void 0 ? promiseConstructor : context.thisValue,
|
|
11696
11704
|
context
|
|
11697
11705
|
),
|
|
11698
|
-
|
|
11706
|
+
guest: true,
|
|
11707
|
+
name: "all",
|
|
11708
|
+
length: 1
|
|
11699
11709
|
}),
|
|
11700
11710
|
race: createSandboxClosure({
|
|
11701
11711
|
sandbox: true,
|
|
@@ -11706,7 +11716,9 @@ function createPromiseGlobals(options) {
|
|
|
11706
11716
|
context === void 0 ? promiseConstructor : context.thisValue,
|
|
11707
11717
|
context
|
|
11708
11718
|
),
|
|
11709
|
-
|
|
11719
|
+
guest: true,
|
|
11720
|
+
name: "race",
|
|
11721
|
+
length: 1
|
|
11710
11722
|
}),
|
|
11711
11723
|
allSettled: createSandboxClosure({
|
|
11712
11724
|
sandbox: true,
|
|
@@ -11717,7 +11729,9 @@ function createPromiseGlobals(options) {
|
|
|
11717
11729
|
context === void 0 ? promiseConstructor : context.thisValue,
|
|
11718
11730
|
context
|
|
11719
11731
|
),
|
|
11720
|
-
|
|
11732
|
+
guest: true,
|
|
11733
|
+
name: "allSettled",
|
|
11734
|
+
length: 1
|
|
11721
11735
|
}),
|
|
11722
11736
|
any: createSandboxClosure({
|
|
11723
11737
|
sandbox: true,
|
|
@@ -11728,7 +11742,9 @@ function createPromiseGlobals(options) {
|
|
|
11728
11742
|
context === void 0 ? promiseConstructor : context.thisValue,
|
|
11729
11743
|
context
|
|
11730
11744
|
),
|
|
11731
|
-
|
|
11745
|
+
guest: true,
|
|
11746
|
+
name: "any",
|
|
11747
|
+
length: 1
|
|
11732
11748
|
}),
|
|
11733
11749
|
resolve: createSandboxClosure({
|
|
11734
11750
|
sandbox: true,
|
|
@@ -11746,7 +11762,9 @@ function createPromiseGlobals(options) {
|
|
|
11746
11762
|
const actualConstructor = descriptor === void 0 ? getPromiseMember("constructor", options.budget) : readPropertyDescriptor(descriptor, value, context, true);
|
|
11747
11763
|
return actualConstructor instanceof Promise ? actualConstructor.then(finish) : finish(actualConstructor);
|
|
11748
11764
|
},
|
|
11749
|
-
|
|
11765
|
+
guest: true,
|
|
11766
|
+
name: "resolve",
|
|
11767
|
+
length: 1
|
|
11750
11768
|
}),
|
|
11751
11769
|
reject: createSandboxClosure({
|
|
11752
11770
|
sandbox: true,
|
|
@@ -11754,7 +11772,9 @@ function createPromiseGlobals(options) {
|
|
|
11754
11772
|
const constructor = context === void 0 ? promiseConstructor : context.thisValue;
|
|
11755
11773
|
return isSandboxPromiseConstructor(constructor) ? createRejectedSandboxPromise(reason, options.budget, context?.span) : settleConstructedPromise(constructor, reason, "rejected", options.budget, context);
|
|
11756
11774
|
},
|
|
11757
|
-
|
|
11775
|
+
guest: true,
|
|
11776
|
+
name: "reject",
|
|
11777
|
+
length: 1
|
|
11758
11778
|
})
|
|
11759
11779
|
};
|
|
11760
11780
|
const promiseConstructor = createSandboxClosure({
|
|
@@ -11788,6 +11808,13 @@ function createPromiseGlobals(options) {
|
|
|
11788
11808
|
intrinsicPromiseConstructors.set(options.budget, promiseConstructor);
|
|
11789
11809
|
registerIntrinsicFunction(options.budget, species);
|
|
11790
11810
|
registerIntrinsicFunction(options.budget, promiseConstructor);
|
|
11811
|
+
installPromisePrototype(options.budget, prototype, promiseConstructor);
|
|
11812
|
+
for (const method of [
|
|
11813
|
+
...Object.values(properties),
|
|
11814
|
+
...Object.values(Object.getOwnPropertyDescriptors(prototype)).map((descriptor) => descriptor.value)
|
|
11815
|
+
]) {
|
|
11816
|
+
if (isSandboxClosure(method)) registerIntrinsicFunction(options.budget, method);
|
|
11817
|
+
}
|
|
11791
11818
|
return { Promise: promiseConstructor };
|
|
11792
11819
|
}
|
|
11793
11820
|
function getPromiseMember(property, budget) {
|
|
@@ -11857,7 +11884,7 @@ async function callPromiseClosure(callback, args, thisValue, budget, context) {
|
|
|
11857
11884
|
}
|
|
11858
11885
|
}
|
|
11859
11886
|
function getPromisePrototype(budget) {
|
|
11860
|
-
const existing =
|
|
11887
|
+
const existing = promisePrototypes2.get(budget);
|
|
11861
11888
|
if (existing !== void 0) return existing;
|
|
11862
11889
|
const prototype = {
|
|
11863
11890
|
then: createSandboxClosure({
|
|
@@ -11901,7 +11928,9 @@ function getPromisePrototype(budget) {
|
|
|
11901
11928
|
const constructor = getPromiseSpeciesConstructor(target, prototype, budget, context);
|
|
11902
11929
|
return constructor instanceof Promise ? constructor.then(finish) : finish(constructor);
|
|
11903
11930
|
},
|
|
11904
|
-
|
|
11931
|
+
guest: true,
|
|
11932
|
+
name: "then",
|
|
11933
|
+
length: 2
|
|
11905
11934
|
}),
|
|
11906
11935
|
catch: createSandboxClosure({
|
|
11907
11936
|
sandbox: true,
|
|
@@ -11921,7 +11950,9 @@ function getPromisePrototype(budget) {
|
|
|
11921
11950
|
const then = descriptor === void 0 ? readPromiseReceiverProperty(target, "then", prototype, context) : readPropertyDescriptor(descriptor, target, context, true);
|
|
11922
11951
|
return then instanceof Promise ? then.then(invoke) : invoke(then);
|
|
11923
11952
|
},
|
|
11924
|
-
|
|
11953
|
+
guest: true,
|
|
11954
|
+
name: "catch",
|
|
11955
|
+
length: 1
|
|
11925
11956
|
}),
|
|
11926
11957
|
finally: createSandboxClosure({
|
|
11927
11958
|
sandbox: true,
|
|
@@ -11991,13 +12022,16 @@ function getPromisePrototype(budget) {
|
|
|
11991
12022
|
const constructor = getPromiseSpeciesConstructor(target, prototype, budget, context);
|
|
11992
12023
|
return constructor instanceof Promise ? constructor.then(finish) : finish(constructor);
|
|
11993
12024
|
},
|
|
11994
|
-
|
|
12025
|
+
guest: true,
|
|
12026
|
+
name: "finally",
|
|
12027
|
+
length: 1
|
|
11995
12028
|
})
|
|
11996
12029
|
};
|
|
12030
|
+
intrinsicPromiseThenMethods.add(prototype.then);
|
|
11997
12031
|
for (const name of Object.keys(prototype)) {
|
|
11998
12032
|
Object.defineProperty(prototype, name, { enumerable: false });
|
|
11999
12033
|
}
|
|
12000
|
-
|
|
12034
|
+
promisePrototypes2.set(budget, prototype);
|
|
12001
12035
|
return prototype;
|
|
12002
12036
|
}
|
|
12003
12037
|
function readPromiseReceiverProperty(receiver, property, prototype, context) {
|
|
@@ -12186,7 +12220,7 @@ function resolveSandboxValueNow(value, options) {
|
|
|
12186
12220
|
options.budget === void 0 ? new TypeError("Promise cannot resolve to itself.") : createSubsetErrorValue("TypeError", "Promise cannot resolve to itself.", [], options.budget)
|
|
12187
12221
|
);
|
|
12188
12222
|
}
|
|
12189
|
-
if (isSandboxPromise(value) &&
|
|
12223
|
+
if (isSandboxPromise(value) && !hasCustomPromiseThen(value, options.budget)) {
|
|
12190
12224
|
if (options.budget !== void 0) {
|
|
12191
12225
|
return resolvePromiseResult(value, options.budget, options.self);
|
|
12192
12226
|
}
|
|
@@ -12369,10 +12403,10 @@ function resolvePromiseResult(result, budget, self) {
|
|
|
12369
12403
|
createSubsetErrorValue("TypeError", "Promise cannot resolve to itself.", [], budget)
|
|
12370
12404
|
);
|
|
12371
12405
|
}
|
|
12372
|
-
if (!isSandboxPromise(result) ||
|
|
12406
|
+
if (!isSandboxPromise(result) || hasCustomPromiseThen(result, budget)) {
|
|
12373
12407
|
return resolveSandboxValue(result, { budget, self });
|
|
12374
12408
|
}
|
|
12375
|
-
const then = getPromiseMember("then", budget);
|
|
12409
|
+
const then = getSandboxPropertyDescriptor(result, "then", budget)?.value ?? getPromiseMember("then", budget);
|
|
12376
12410
|
if (!isSandboxClosure(then)) return Promise.resolve(result);
|
|
12377
12411
|
return new Promise((resolve, reject) => {
|
|
12378
12412
|
let settled = false;
|
|
@@ -12429,6 +12463,10 @@ function resolvePromiseResult(result, budget, self) {
|
|
|
12429
12463
|
function isSelfResolution(result, self) {
|
|
12430
12464
|
return self !== void 0 && (result === self || isSandboxPromise(result) && result.promise === self.promise);
|
|
12431
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
|
+
}
|
|
12432
12470
|
function requiresPromiseResolution(value, budget) {
|
|
12433
12471
|
if (isSandboxPromise(value)) return true;
|
|
12434
12472
|
const descriptor = getSandboxPropertyDescriptor(value, "then", budget);
|
|
@@ -18735,7 +18773,6 @@ async function evaluateInstanceof(left, right, context) {
|
|
|
18735
18773
|
context.budget.visitNode();
|
|
18736
18774
|
right = right.boundTarget;
|
|
18737
18775
|
}
|
|
18738
|
-
if (isSandboxPromiseConstructor(right)) return isSandboxPromise(left);
|
|
18739
18776
|
if (isFloat32ArrayConstructor(right)) return isFloat32Array(left);
|
|
18740
18777
|
if (isDateConstructor(right))
|
|
18741
18778
|
return isSandboxDate(left) && getDatePrototype(left, context.budget, context.compilation?.owner) !== null;
|
|
@@ -40200,4 +40237,4 @@ export {
|
|
|
40200
40237
|
FileSnapshotBackend,
|
|
40201
40238
|
run
|
|
40202
40239
|
};
|
|
40203
|
-
//# sourceMappingURL=chunk-
|
|
40240
|
+
//# sourceMappingURL=chunk-4MTUBJBW.js.map
|