@poe-platform/safe-js 0.1.350 → 0.1.352
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-KCCF2JJV.js → chunk-J2YBAXLB.js} +2 -2
- package/dist/safe-js/chunks/{chunk-QDFP6UGN.js → chunk-ZCAXO5OU.js} +61 -2
- package/dist/safe-js/chunks/chunk-ZCAXO5OU.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-QDFP6UGN.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-KCCF2JJV.js.map → chunk-J2YBAXLB.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-ZCAXO5OU.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-J2YBAXLB.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,6 +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;
|
|
25472
|
+
var transferBuffer = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "transfer")?.value;
|
|
25461
25473
|
function createArrayBufferGlobal(budget) {
|
|
25462
25474
|
const prototype = /* @__PURE__ */ Object.create(null);
|
|
25463
25475
|
const constructor = createSandboxClosure({
|
|
@@ -25600,6 +25612,52 @@ function createArrayBufferGlobal(budget) {
|
|
|
25600
25612
|
}
|
|
25601
25613
|
})
|
|
25602
25614
|
});
|
|
25615
|
+
Object.defineProperty(prototype, "transfer", {
|
|
25616
|
+
writable: true,
|
|
25617
|
+
configurable: true,
|
|
25618
|
+
value: createSandboxClosure({
|
|
25619
|
+
guest: true,
|
|
25620
|
+
sandbox: true,
|
|
25621
|
+
name: "transfer",
|
|
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 = arrayBufferOptions(receiver);
|
|
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
|
+
});
|
|
25603
25661
|
Object.defineProperty(prototype, "resize", {
|
|
25604
25662
|
writable: true,
|
|
25605
25663
|
configurable: true,
|
|
@@ -25628,7 +25686,7 @@ function createArrayBufferGlobal(budget) {
|
|
|
25628
25686
|
}
|
|
25629
25687
|
})
|
|
25630
25688
|
});
|
|
25631
|
-
for (const key of ["byteLength", "maxByteLength", "resizable"]) {
|
|
25689
|
+
for (const key of ["byteLength", "maxByteLength", "resizable", "detached"]) {
|
|
25632
25690
|
const getter = createSandboxClosure({
|
|
25633
25691
|
guest: true,
|
|
25634
25692
|
sandbox: true,
|
|
@@ -25637,6 +25695,7 @@ function createArrayBufferGlobal(budget) {
|
|
|
25637
25695
|
call: (_args, context) => {
|
|
25638
25696
|
if (!isSandboxArrayBuffer(context?.thisValue)) throw new TypeError(`ArrayBuffer ${key} requires a buffer receiver.`);
|
|
25639
25697
|
if (key === "byteLength") return arrayBufferLength(context.thisValue);
|
|
25698
|
+
if (key === "detached") return arrayBufferDetached(context.thisValue);
|
|
25640
25699
|
const options = arrayBufferOptions(context.thisValue);
|
|
25641
25700
|
return key === "resizable" ? options !== void 0 : options?.maxByteLength ?? arrayBufferLength(context.thisValue);
|
|
25642
25701
|
}
|
|
@@ -42677,4 +42736,4 @@ export {
|
|
|
42677
42736
|
FileSnapshotBackend,
|
|
42678
42737
|
run
|
|
42679
42738
|
};
|
|
42680
|
-
//# sourceMappingURL=chunk-
|
|
42739
|
+
//# sourceMappingURL=chunk-ZCAXO5OU.js.map
|