@poe-platform/safe-js 0.1.351 → 0.1.353
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-Z7WNQACZ.js → chunk-BWBBXXBE.js} +2 -2
- package/dist/safe-js/chunks/{chunk-AS6HS2LE.js → chunk-LZ2NZ2PE.js} +60 -12
- package/dist/safe-js/chunks/chunk-LZ2NZ2PE.js.map +7 -0
- 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-AS6HS2LE.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-Z7WNQACZ.js.map → chunk-BWBBXXBE.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-LZ2NZ2PE.js";
|
|
31
31
|
|
|
32
32
|
// packages/safe-js/src/migrate.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
|
@@ -8249,4 +8249,4 @@ export {
|
|
|
8249
8249
|
parseMcpConfig,
|
|
8250
8250
|
makeMcpModule
|
|
8251
8251
|
};
|
|
8252
|
-
//# sourceMappingURL=chunk-
|
|
8252
|
+
//# sourceMappingURL=chunk-BWBBXXBE.js.map
|
|
@@ -6848,6 +6848,7 @@ import { types as types2 } from "node:util";
|
|
|
6848
6848
|
var readLength = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
|
|
6849
6849
|
var readResizable = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "resizable")?.get;
|
|
6850
6850
|
var readMaxLength = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "maxByteLength")?.get;
|
|
6851
|
+
var readDetached = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "detached")?.get;
|
|
6851
6852
|
var arrayBufferPrototypes = /* @__PURE__ */ new WeakMap();
|
|
6852
6853
|
function isSandboxArrayBuffer(value) {
|
|
6853
6854
|
return types2.isArrayBuffer(value) && Object.getPrototypeOf(value) === ArrayBuffer.prototype;
|
|
@@ -6855,6 +6856,16 @@ function isSandboxArrayBuffer(value) {
|
|
|
6855
6856
|
function arrayBufferLength(value) {
|
|
6856
6857
|
return Reflect.apply(readLength, value, []);
|
|
6857
6858
|
}
|
|
6859
|
+
function arrayBufferDetached(value) {
|
|
6860
|
+
if (readDetached !== void 0) return Reflect.apply(readDetached, value, []);
|
|
6861
|
+
try {
|
|
6862
|
+
new Uint8Array(value, 0, 0);
|
|
6863
|
+
return false;
|
|
6864
|
+
} catch (error) {
|
|
6865
|
+
if (error instanceof TypeError) return true;
|
|
6866
|
+
throw error;
|
|
6867
|
+
}
|
|
6868
|
+
}
|
|
6858
6869
|
function arrayBufferOptions(value) {
|
|
6859
6870
|
return readResizable !== void 0 && Reflect.apply(readResizable, value, []) ? { maxByteLength: Reflect.apply(readMaxLength, value, []) } : void 0;
|
|
6860
6871
|
}
|
|
@@ -25458,7 +25469,7 @@ function createBigIntGlobal(budget) {
|
|
|
25458
25469
|
|
|
25459
25470
|
// packages/safe-js/src/interp/globals/array-buffer.ts
|
|
25460
25471
|
var resizeBuffer2 = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "resize")?.value;
|
|
25461
|
-
var
|
|
25472
|
+
var transferBuffer = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "transfer")?.value;
|
|
25462
25473
|
function createArrayBufferGlobal(budget) {
|
|
25463
25474
|
const prototype = /* @__PURE__ */ Object.create(null);
|
|
25464
25475
|
const constructor = createSandboxClosure({
|
|
@@ -25601,6 +25612,52 @@ function createArrayBufferGlobal(budget) {
|
|
|
25601
25612
|
}
|
|
25602
25613
|
})
|
|
25603
25614
|
});
|
|
25615
|
+
for (const key of ["transfer", "transferToFixedLength"]) Object.defineProperty(prototype, key, {
|
|
25616
|
+
writable: true,
|
|
25617
|
+
configurable: true,
|
|
25618
|
+
value: createSandboxClosure({
|
|
25619
|
+
guest: true,
|
|
25620
|
+
sandbox: true,
|
|
25621
|
+
name: key,
|
|
25622
|
+
length: 0,
|
|
25623
|
+
call: async (args, context) => {
|
|
25624
|
+
const receiver = context?.thisValue;
|
|
25625
|
+
if (!isSandboxArrayBuffer(receiver)) throw new TypeError("ArrayBuffer transfer requires a buffer receiver.");
|
|
25626
|
+
let result;
|
|
25627
|
+
const release = retainValues(budget, () => [receiver, result, ...args]);
|
|
25628
|
+
const checkData = createDataCheckpoint(budget, context);
|
|
25629
|
+
try {
|
|
25630
|
+
const number = args[0] === void 0 ? arrayBufferLength(receiver) : await sandboxNumber(args[0], budget, context);
|
|
25631
|
+
const length = Number.isNaN(number) ? 0 : Math.trunc(number);
|
|
25632
|
+
if (!Number.isSafeInteger(length) || length < 0) throw new RangeError("Invalid ArrayBuffer transfer length.");
|
|
25633
|
+
if (arrayBufferDetached(receiver)) throw new TypeError("Cannot transfer a detached ArrayBuffer.");
|
|
25634
|
+
const options = key === "transfer" ? arrayBufferOptions(receiver) : void 0;
|
|
25635
|
+
if (options !== void 0 && length > options.maxByteLength) throw new RangeError("Transfer length exceeds ArrayBuffer capacity.");
|
|
25636
|
+
budget.allocateArrayLength(options?.maxByteLength ?? length);
|
|
25637
|
+
checkData(receiver, 0, true);
|
|
25638
|
+
budget.provisionDataUsage(length + 1)();
|
|
25639
|
+
result = Reflect.construct(ArrayBuffer, [length, options]);
|
|
25640
|
+
setSandboxPrototype(result, prototype, budget);
|
|
25641
|
+
checkData(result, 0, true);
|
|
25642
|
+
const count = Math.min(length, arrayBufferLength(receiver));
|
|
25643
|
+
budget.visitNode(count);
|
|
25644
|
+
new Uint8Array(result, 0, count).set(new Uint8Array(receiver, 0, count));
|
|
25645
|
+
if (transferBuffer !== void 0) {
|
|
25646
|
+
budget.provisionDataUsage(1)();
|
|
25647
|
+
Reflect.apply(transferBuffer, receiver, [0]);
|
|
25648
|
+
} else {
|
|
25649
|
+
budget.provisionDataUsage(arrayBufferLength(receiver) + 1)();
|
|
25650
|
+
budget.visitNode(arrayBufferLength(receiver));
|
|
25651
|
+
structuredClone(receiver, { transfer: [receiver] });
|
|
25652
|
+
if (!arrayBufferDetached(receiver)) throw new TypeError("ArrayBuffer cannot be detached.");
|
|
25653
|
+
}
|
|
25654
|
+
return result;
|
|
25655
|
+
} finally {
|
|
25656
|
+
release();
|
|
25657
|
+
}
|
|
25658
|
+
}
|
|
25659
|
+
})
|
|
25660
|
+
});
|
|
25604
25661
|
Object.defineProperty(prototype, "resize", {
|
|
25605
25662
|
writable: true,
|
|
25606
25663
|
configurable: true,
|
|
@@ -25638,16 +25695,7 @@ function createArrayBufferGlobal(budget) {
|
|
|
25638
25695
|
call: (_args, context) => {
|
|
25639
25696
|
if (!isSandboxArrayBuffer(context?.thisValue)) throw new TypeError(`ArrayBuffer ${key} requires a buffer receiver.`);
|
|
25640
25697
|
if (key === "byteLength") return arrayBufferLength(context.thisValue);
|
|
25641
|
-
if (key === "detached")
|
|
25642
|
-
if (readDetached !== void 0) return Reflect.apply(readDetached, context.thisValue, []);
|
|
25643
|
-
try {
|
|
25644
|
-
new Uint8Array(context.thisValue, 0, 0);
|
|
25645
|
-
return false;
|
|
25646
|
-
} catch (error) {
|
|
25647
|
-
if (error instanceof TypeError) return true;
|
|
25648
|
-
throw error;
|
|
25649
|
-
}
|
|
25650
|
-
}
|
|
25698
|
+
if (key === "detached") return arrayBufferDetached(context.thisValue);
|
|
25651
25699
|
const options = arrayBufferOptions(context.thisValue);
|
|
25652
25700
|
return key === "resizable" ? options !== void 0 : options?.maxByteLength ?? arrayBufferLength(context.thisValue);
|
|
25653
25701
|
}
|
|
@@ -42688,4 +42736,4 @@ export {
|
|
|
42688
42736
|
FileSnapshotBackend,
|
|
42689
42737
|
run
|
|
42690
42738
|
};
|
|
42691
|
-
//# sourceMappingURL=chunk-
|
|
42739
|
+
//# sourceMappingURL=chunk-LZ2NZ2PE.js.map
|