@poe-platform/safe-js 0.1.322 → 0.1.324
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-ECGDQJ7F.js → chunk-CMWXZ76K.js} +32 -9
- package/dist/safe-js/chunks/chunk-CMWXZ76K.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-CBU6A7YV.js → chunk-WWBX6TN2.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/array-buffer.d.ts +2 -1
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-ECGDQJ7F.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-CBU6A7YV.js.map → chunk-WWBX6TN2.js.map} +0 -0
|
@@ -14883,7 +14883,7 @@ function createFloat32ArrayPrototypes(budget, constructor) {
|
|
|
14883
14883
|
getters.push(getter);
|
|
14884
14884
|
Object.defineProperty(shared, key, { get: accessorAdapter(getter, "get"), configurable: true });
|
|
14885
14885
|
}
|
|
14886
|
-
for (const key of ["set", "slice", "subarray"])
|
|
14886
|
+
for (const key of ["set", "slice", "subarray", "fill"])
|
|
14887
14887
|
Object.defineProperty(shared, key, { value: getFloat32Member(new Float32Array(0), key, budget, constructor), writable: true, configurable: true });
|
|
14888
14888
|
const arrayPrototype = resolveIntrinsicIdentity(budget, '["Array","prototype"]');
|
|
14889
14889
|
Object.defineProperty(shared, "toString", { value: getSandboxDataProperty(arrayPrototype, "toString", budget), writable: true, configurable: true });
|
|
@@ -14965,17 +14965,17 @@ function getFloat32Member(value, property, budget, defaultConstructor) {
|
|
|
14965
14965
|
if (key === "byteLength") return storage.length * 4;
|
|
14966
14966
|
if (key === "byteOffset") return storage.byteOffset;
|
|
14967
14967
|
if (key === "BYTES_PER_ELEMENT") return 4;
|
|
14968
|
-
if (!["set", "slice", "subarray"].includes(key)) return void 0;
|
|
14968
|
+
if (!["set", "slice", "subarray", "fill"].includes(key)) return void 0;
|
|
14969
14969
|
return createSandboxClosure({
|
|
14970
14970
|
guest: true,
|
|
14971
14971
|
sandbox: true,
|
|
14972
14972
|
name: key,
|
|
14973
|
-
length: key === "set" ? 1 : 2,
|
|
14973
|
+
length: key === "set" || key === "fill" ? 1 : 2,
|
|
14974
14974
|
call: (args, context) => {
|
|
14975
14975
|
const receiver = context?.thisValue;
|
|
14976
14976
|
if (!isFloat32Array(receiver))
|
|
14977
14977
|
throw new TypeError(`Float32Array#${key} requires a Float32Array receiver.`);
|
|
14978
|
-
const storage2 = float32Storage(receiver, key === "slice");
|
|
14978
|
+
const storage2 = float32Storage(receiver, key === "slice" || key === "fill");
|
|
14979
14979
|
const bridge = {
|
|
14980
14980
|
...context,
|
|
14981
14981
|
stack: context?.stack ?? [],
|
|
@@ -14986,6 +14986,24 @@ function getFloat32Member(value, property, budget, defaultConstructor) {
|
|
|
14986
14986
|
}),
|
|
14987
14987
|
invokeClosure: context?.invokeClosure ?? ((callee, values, thisValue, construct) => invokeBuiltinClosure(callee, values, budget, context, thisValue, construct))
|
|
14988
14988
|
};
|
|
14989
|
+
if (key === "fill") {
|
|
14990
|
+
return (async () => {
|
|
14991
|
+
const release = retainValues(budget, () => [receiver, ...args]);
|
|
14992
|
+
try {
|
|
14993
|
+
const value2 = await sandboxNumber(args[0], budget, bridge);
|
|
14994
|
+
const start = relativeIndex(await sandboxNumber(args[1], budget, bridge), storage2.length);
|
|
14995
|
+
const end = args[2] === void 0 ? storage2.length : relativeIndex(await sandboxNumber(args[2], budget, bridge), storage2.length);
|
|
14996
|
+
const current = float32Storage(receiver, true);
|
|
14997
|
+
for (let index = start; index < Math.min(end, current.length); index++) {
|
|
14998
|
+
budget.visitNode();
|
|
14999
|
+
receiver[index] = value2;
|
|
15000
|
+
}
|
|
15001
|
+
return receiver;
|
|
15002
|
+
} finally {
|
|
15003
|
+
release();
|
|
15004
|
+
}
|
|
15005
|
+
})();
|
|
15006
|
+
}
|
|
14989
15007
|
if (key === "set") {
|
|
14990
15008
|
return (async () => {
|
|
14991
15009
|
const [source, offsetValue = 0] = args;
|
|
@@ -21251,9 +21269,10 @@ function validateArrayBufferStorage(value) {
|
|
|
21251
21269
|
if (Object.hasOwn(value, "maxByteLength") && (!Array.isArray(value.bytes) || !Number.isSafeInteger(value.maxByteLength) || Number(value.maxByteLength) < value.bytes.length))
|
|
21252
21270
|
throw new TypeError("Invalid ArrayBuffer maximum length.");
|
|
21253
21271
|
}
|
|
21254
|
-
function decodeArrayBufferStorage(value, resolve) {
|
|
21272
|
+
function decodeArrayBufferStorage(value, resolve, budget) {
|
|
21255
21273
|
validateArrayBufferStorage(value);
|
|
21256
21274
|
if (Array.isArray(value.bytes)) {
|
|
21275
|
+
budget?.allocateArrayLength(Number(value.maxByteLength ?? value.bytes.length));
|
|
21257
21276
|
const buffer = Reflect.construct(ArrayBuffer, [
|
|
21258
21277
|
value.bytes.length,
|
|
21259
21278
|
Object.hasOwn(value, "maxByteLength") ? { maxByteLength: value.maxByteLength } : void 0
|
|
@@ -22163,7 +22182,7 @@ function decodeReplayData(input, options = {}, parent) {
|
|
|
22163
22182
|
}
|
|
22164
22183
|
if (kind === "arraybuffer") {
|
|
22165
22184
|
if (typeof node.extensible !== "boolean") throw new TypeError("Invalid ArrayBuffer extensibility.");
|
|
22166
|
-
const result3 = decodeArrayBufferStorage(node, child);
|
|
22185
|
+
const result3 = decodeArrayBufferStorage(node, child, compilation.owner?.budget);
|
|
22167
22186
|
restored.set(id, result3);
|
|
22168
22187
|
initializeValues.push(() => {
|
|
22169
22188
|
defineProperties(result3, record2(own(node, "properties")), child, node.symbolEntries);
|
|
@@ -23064,7 +23083,7 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path) {
|
|
|
23064
23083
|
const existing = state.seen.get(value);
|
|
23065
23084
|
if (existing !== void 0) return existing;
|
|
23066
23085
|
const length = arrayBufferLength(value);
|
|
23067
|
-
budget.allocateArrayLength(length);
|
|
23086
|
+
budget.allocateArrayLength(arrayBufferOptions(value)?.maxByteLength ?? length);
|
|
23068
23087
|
budget.provisionDataUsage(length + 1)();
|
|
23069
23088
|
const copy = copyArrayBufferStorage(value, state);
|
|
23070
23089
|
state.seen.set(value, copy);
|
|
@@ -23087,6 +23106,8 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path) {
|
|
|
23087
23106
|
if (isFloat32Array(value)) {
|
|
23088
23107
|
const existing = state.seen.get(value);
|
|
23089
23108
|
if (existing !== void 0) return existing;
|
|
23109
|
+
const capacity = arrayBufferOptions(float32Storage(value).buffer)?.maxByteLength;
|
|
23110
|
+
if (capacity !== void 0) budget.allocateArrayLength(capacity);
|
|
23090
23111
|
checkFloat32Allocation(Math.ceil(float32Storage(value).byteLength / 4), budget);
|
|
23091
23112
|
const copy = copyFloat32Storage(value, state);
|
|
23092
23113
|
state.seen.set(value, copy);
|
|
@@ -28084,7 +28105,7 @@ function allocateSandboxValue2(value, budget, seen) {
|
|
|
28084
28105
|
if (isSandboxArrayBuffer(value)) {
|
|
28085
28106
|
if (seen.has(value)) return;
|
|
28086
28107
|
seen.add(value);
|
|
28087
|
-
budget.allocateArrayLength(arrayBufferLength(value));
|
|
28108
|
+
budget.allocateArrayLength(arrayBufferOptions(value)?.maxByteLength ?? arrayBufferLength(value));
|
|
28088
28109
|
for (const [key, descriptor] of arrayBufferDataProperties(value)) {
|
|
28089
28110
|
if (typeof key === "string") budget.allocateString(key);
|
|
28090
28111
|
allocateSandboxValue2(descriptor.value, budget, seen);
|
|
@@ -28106,6 +28127,8 @@ function allocateSandboxValue2(value, budget, seen) {
|
|
|
28106
28127
|
if (seen.has(value)) return;
|
|
28107
28128
|
seen.add(value);
|
|
28108
28129
|
budget.allocateArrayLength(Math.ceil(float32Storage(value).byteLength / 4));
|
|
28130
|
+
const capacity = arrayBufferOptions(float32Storage(value).buffer)?.maxByteLength;
|
|
28131
|
+
if (capacity !== void 0) budget.allocateArrayLength(capacity);
|
|
28109
28132
|
for (const [key, descriptor] of float32DataProperties(value)) {
|
|
28110
28133
|
budget.allocateString(key);
|
|
28111
28134
|
allocateSandboxValue2(descriptor.value, budget, seen);
|
|
@@ -42341,4 +42364,4 @@ export {
|
|
|
42341
42364
|
FileSnapshotBackend,
|
|
42342
42365
|
run
|
|
42343
42366
|
};
|
|
42344
|
-
//# sourceMappingURL=chunk-
|
|
42367
|
+
//# sourceMappingURL=chunk-CMWXZ76K.js.map
|