poe-code 12.0.3 → 12.0.4
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/index.js +423 -5
- package/dist/index.js.map +4 -4
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safejs/dist/chunks/{chunk-T55OILHA.js → chunk-LF5LY5O3.js} +2 -2
- package/packages/safejs/dist/chunks/{chunk-Z3ZMLYCK.js → chunk-XBRQ72W6.js} +387 -5
- package/packages/safejs/dist/chunks/chunk-XBRQ72W6.js.map +7 -0
- package/packages/safejs/dist/cli.js +2 -2
- package/packages/safejs/dist/core.js +1 -1
- package/packages/safejs/dist/index.js +2 -2
- package/packages/safejs/dist/interp/float32.d.ts +16 -0
- package/packages/safejs/dist/interp/float32.js +65 -0
- package/packages/safejs/dist/interp/globals/float32array.d.ts +6 -0
- package/packages/safejs/dist/interp/globals/float32array.js +130 -0
- package/packages/safejs/dist/interp/globals/object-array.js +6 -0
- package/packages/safejs/dist/interp/host-bridge.js +18 -0
- package/packages/safejs/dist/interp/host-call.js +15 -0
- package/packages/safejs/dist/interp/interpreter.js +17 -1
- package/packages/safejs/dist/interp/iteration.js +4 -0
- package/packages/safejs/dist/interp/values.d.ts +1 -1
- package/packages/safejs/dist/interp/values.js +56 -0
- package/packages/safejs/dist/lint/rules/known-globals.d.ts +1 -1
- package/packages/safejs/dist/lint/rules/known-globals.js +1 -0
- package/packages/safejs/dist/run.js +2 -0
- package/packages/safejs/dist/snapshot/dump-format.js +20 -2
- package/packages/safejs/dist/snapshot/float32array.d.ts +12 -0
- package/packages/safejs/dist/snapshot/float32array.js +46 -0
- package/packages/safejs/dist/snapshot/replay-data.d.ts +5 -1
- package/packages/safejs/dist/snapshot/replay-data.js +29 -0
- package/packages/safejs/dist/snapshot/restore.js +14 -0
- package/packages/safejs/dist/snapshot/serialize.d.ts +5 -2
- package/packages/safejs/dist/snapshot/serialize.js +17 -2
- package/packages/safejs/dist/snapshot/validation.js +11 -1
- package/packages/safejs/dist/chunks/chunk-Z3ZMLYCK.js.map +0 -7
- /package/packages/safejs/dist/chunks/{chunk-T55OILHA.js.map → chunk-LF5LY5O3.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -124867,6 +124867,7 @@ var init_known_globals = __esm({
|
|
|
124867
124867
|
"isNaN",
|
|
124868
124868
|
"JSON",
|
|
124869
124869
|
"Map",
|
|
124870
|
+
"Float32Array",
|
|
124870
124871
|
"Math",
|
|
124871
124872
|
"NaN",
|
|
124872
124873
|
"Number",
|
|
@@ -135766,6 +135767,74 @@ var init_otel2 = __esm({
|
|
|
135766
135767
|
}
|
|
135767
135768
|
});
|
|
135768
135769
|
|
|
135770
|
+
// packages/safejs/src/interp/float32.ts
|
|
135771
|
+
function isFloat32Array(value) {
|
|
135772
|
+
return ArrayBuffer.isView(value) && Object.getPrototypeOf(value) === Float32Array.prototype && Reflect.apply(readTag, value, []) === "Float32Array";
|
|
135773
|
+
}
|
|
135774
|
+
function float32Storage(value) {
|
|
135775
|
+
const buffer = Reflect.apply(readBuffer, value, []);
|
|
135776
|
+
if (Object.getPrototypeOf(buffer) !== ArrayBuffer.prototype || bufferResizable !== void 0 && Reflect.apply(bufferResizable, buffer, [])) {
|
|
135777
|
+
throw new TypeError("Float32Array requires a fixed, non-shared ArrayBuffer.");
|
|
135778
|
+
}
|
|
135779
|
+
return {
|
|
135780
|
+
buffer,
|
|
135781
|
+
byteOffset: Reflect.apply(readOffset, value, []),
|
|
135782
|
+
length: Reflect.apply(readLength, value, []),
|
|
135783
|
+
byteLength: Reflect.apply(bufferLength, buffer, [])
|
|
135784
|
+
};
|
|
135785
|
+
}
|
|
135786
|
+
function float32DataProperties(value) {
|
|
135787
|
+
if (Object.getOwnPropertySymbols(value).length > 0)
|
|
135788
|
+
throw new TypeError("Float32Array symbol properties are not supported.");
|
|
135789
|
+
const properties = [];
|
|
135790
|
+
for (const [key3, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value))) {
|
|
135791
|
+
if (isFloat32Index(key3)) continue;
|
|
135792
|
+
if (!("value" in descriptor))
|
|
135793
|
+
throw new TypeError(`Float32Array accessor property '${key3}' is not supported.`);
|
|
135794
|
+
properties.push([key3, descriptor]);
|
|
135795
|
+
}
|
|
135796
|
+
return properties;
|
|
135797
|
+
}
|
|
135798
|
+
function isFloat32Index(key3) {
|
|
135799
|
+
return key3 === "-0" || String(Number(key3)) === key3;
|
|
135800
|
+
}
|
|
135801
|
+
function float32Number(value) {
|
|
135802
|
+
if (value !== null && typeof value === "object" || typeof value === "function" || typeof value === "symbol" || typeof value === "bigint") {
|
|
135803
|
+
throw new TypeError(
|
|
135804
|
+
"Float32Array numeric arguments must be primitive numeric-coercible values."
|
|
135805
|
+
);
|
|
135806
|
+
}
|
|
135807
|
+
return Number(value);
|
|
135808
|
+
}
|
|
135809
|
+
function checkFloat32Allocation(length, budget) {
|
|
135810
|
+
budget.allocateArrayLength(length);
|
|
135811
|
+
budget.provisionDataUsage(length * Float32Array.BYTES_PER_ELEMENT + 1)();
|
|
135812
|
+
}
|
|
135813
|
+
function copyFloat32Storage(value, state) {
|
|
135814
|
+
const storage2 = float32Storage(value);
|
|
135815
|
+
state.float32Buffers ??= /* @__PURE__ */ new WeakMap();
|
|
135816
|
+
let buffer = state.float32Buffers.get(storage2.buffer);
|
|
135817
|
+
if (buffer === void 0) {
|
|
135818
|
+
buffer = new ArrayBuffer(storage2.byteLength);
|
|
135819
|
+
new Uint8Array(buffer).set(new Uint8Array(storage2.buffer));
|
|
135820
|
+
state.float32Buffers.set(storage2.buffer, buffer);
|
|
135821
|
+
}
|
|
135822
|
+
return new Float32Array(buffer, storage2.byteOffset, storage2.length);
|
|
135823
|
+
}
|
|
135824
|
+
var typedArrayPrototype, readLength, readOffset, readBuffer, readTag, bufferLength, bufferResizable;
|
|
135825
|
+
var init_float32 = __esm({
|
|
135826
|
+
"packages/safejs/src/interp/float32.ts"() {
|
|
135827
|
+
"use strict";
|
|
135828
|
+
typedArrayPrototype = Object.getPrototypeOf(Float32Array.prototype);
|
|
135829
|
+
readLength = Object.getOwnPropertyDescriptor(typedArrayPrototype, "length").get;
|
|
135830
|
+
readOffset = Object.getOwnPropertyDescriptor(typedArrayPrototype, "byteOffset").get;
|
|
135831
|
+
readBuffer = Object.getOwnPropertyDescriptor(typedArrayPrototype, "buffer").get;
|
|
135832
|
+
readTag = Object.getOwnPropertyDescriptor(typedArrayPrototype, Symbol.toStringTag).get;
|
|
135833
|
+
bufferLength = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
|
|
135834
|
+
bufferResizable = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "resizable")?.get;
|
|
135835
|
+
}
|
|
135836
|
+
});
|
|
135837
|
+
|
|
135769
135838
|
// packages/safejs/src/interp/budget.ts
|
|
135770
135839
|
function allocateRegexSteps(steps) {
|
|
135771
135840
|
if (!Number.isInteger(steps) || steps < 0) {
|
|
@@ -136351,6 +136420,48 @@ var init_arrays = __esm({
|
|
|
136351
136420
|
}
|
|
136352
136421
|
});
|
|
136353
136422
|
|
|
136423
|
+
// packages/safejs/src/snapshot/float32array.ts
|
|
136424
|
+
function encodeFloat32Storage(value, id, buffers, reference) {
|
|
136425
|
+
const storage2 = float32Storage(value);
|
|
136426
|
+
const existing = buffers.get(storage2.buffer);
|
|
136427
|
+
if (existing === void 0) buffers.set(storage2.buffer, id);
|
|
136428
|
+
return {
|
|
136429
|
+
kind: "float32array",
|
|
136430
|
+
byteOffset: storage2.byteOffset,
|
|
136431
|
+
length: storage2.length,
|
|
136432
|
+
...existing === void 0 ? { bytes: Array.from(new Uint8Array(storage2.buffer)) } : { buffer: reference(existing) }
|
|
136433
|
+
};
|
|
136434
|
+
}
|
|
136435
|
+
function validateFloat32Storage(value) {
|
|
136436
|
+
if (!Number.isSafeInteger(value.length) || Number(value.length) < 0 || !Number.isSafeInteger(value.byteOffset) || Number(value.byteOffset) < 0 || Number(value.byteOffset) % 4 !== 0)
|
|
136437
|
+
throw new TypeError("Invalid Float32Array view dimensions.");
|
|
136438
|
+
if (Object.hasOwn(value, "bytes") === Object.hasOwn(value, "buffer"))
|
|
136439
|
+
throw new TypeError("Float32Array requires one backing storage description.");
|
|
136440
|
+
if (Object.hasOwn(value, "bytes")) {
|
|
136441
|
+
if (!Array.isArray(value.bytes) || value.bytes.some((byte) => !Number.isInteger(byte) || byte < 0 || byte > 255) || Number(value.length) > Math.floor((value.bytes.length - Number(value.byteOffset)) / 4))
|
|
136442
|
+
throw new TypeError("Invalid Float32Array backing bytes.");
|
|
136443
|
+
}
|
|
136444
|
+
}
|
|
136445
|
+
function decodeFloat32Storage(value, resolve17) {
|
|
136446
|
+
validateFloat32Storage(value);
|
|
136447
|
+
let buffer;
|
|
136448
|
+
if (Array.isArray(value.bytes)) {
|
|
136449
|
+
buffer = new ArrayBuffer(value.bytes.length);
|
|
136450
|
+
new Uint8Array(buffer).set(value.bytes);
|
|
136451
|
+
} else {
|
|
136452
|
+
const referenced = resolve17(value.buffer);
|
|
136453
|
+
if (!isFloat32Array(referenced)) throw new TypeError("Invalid Float32Array backing reference.");
|
|
136454
|
+
buffer = float32Storage(referenced).buffer;
|
|
136455
|
+
}
|
|
136456
|
+
return new Float32Array(buffer, Number(value.byteOffset), Number(value.length));
|
|
136457
|
+
}
|
|
136458
|
+
var init_float32array = __esm({
|
|
136459
|
+
"packages/safejs/src/snapshot/float32array.ts"() {
|
|
136460
|
+
"use strict";
|
|
136461
|
+
init_float32();
|
|
136462
|
+
}
|
|
136463
|
+
});
|
|
136464
|
+
|
|
136354
136465
|
// packages/safejs/src/snapshot/dump-format.ts
|
|
136355
136466
|
function serializeSafeJSSnapshot(snapshot2) {
|
|
136356
136467
|
const replayError = Object.getOwnPropertyDescriptor(snapshot2, "replayError");
|
|
@@ -136367,6 +136478,7 @@ function serializeSafeJSSnapshot(snapshot2) {
|
|
|
136367
136478
|
}
|
|
136368
136479
|
function createDumpFile(snapshot2) {
|
|
136369
136480
|
const state = {
|
|
136481
|
+
float32Buffers: /* @__PURE__ */ new WeakMap(),
|
|
136370
136482
|
heap: {},
|
|
136371
136483
|
heapIds: indexHeapContainers(snapshot2),
|
|
136372
136484
|
serializedHeapIds: /* @__PURE__ */ new Set()
|
|
@@ -136405,6 +136517,7 @@ function serializeDumpValue(value, path191, state) {
|
|
|
136405
136517
|
if (typeof value !== "object") {
|
|
136406
136518
|
return SKIP_VALUE;
|
|
136407
136519
|
}
|
|
136520
|
+
if (isFloat32Array(value)) return serializeHeapReference(value, path191, state);
|
|
136408
136521
|
if (Array.isArray(value)) {
|
|
136409
136522
|
const reference2 = serializeHeapReference(value, path191, state);
|
|
136410
136523
|
if (reference2 !== void 0) {
|
|
@@ -136428,7 +136541,18 @@ function serializeHeapReference(value, path191, state) {
|
|
|
136428
136541
|
}
|
|
136429
136542
|
if (!state.serializedHeapIds.has(id)) {
|
|
136430
136543
|
state.serializedHeapIds.add(id);
|
|
136431
|
-
if (
|
|
136544
|
+
if (isFloat32Array(value)) {
|
|
136545
|
+
const storage2 = encodeFloat32Storage(value, id, state.float32Buffers, (id2) => ({
|
|
136546
|
+
kind: "ref",
|
|
136547
|
+
id: id2
|
|
136548
|
+
}));
|
|
136549
|
+
const entries = /* @__PURE__ */ Object.create(null);
|
|
136550
|
+
state.heap[String(id)] = { ...storage2, entries };
|
|
136551
|
+
for (const [key3, descriptor] of float32DataProperties(value)) {
|
|
136552
|
+
const serialized = serializeDumpValue(descriptor.value, `${path191}.${key3}`, state);
|
|
136553
|
+
entries[key3] = serialized === SKIP_VALUE ? { kind: "undefined" } : serialized;
|
|
136554
|
+
}
|
|
136555
|
+
} else if (isSandboxArguments(value)) {
|
|
136432
136556
|
state.heap[String(id)] = serializeArguments(value, (entry, key3) => {
|
|
136433
136557
|
const serialized = serializeDumpValue(entry, `${path191}.${key3}`, state);
|
|
136434
136558
|
return serialized === SKIP_VALUE ? { kind: "undefined" } : serialized;
|
|
@@ -136474,7 +136598,7 @@ function indexHeapContainers(snapshot2) {
|
|
|
136474
136598
|
const heapIds = /* @__PURE__ */ new WeakMap();
|
|
136475
136599
|
let nextId = 1;
|
|
136476
136600
|
for (const [value, stat36] of stats2.entries()) {
|
|
136477
|
-
if (stat36.count > 1 || stat36.cyclic || Array.isArray(value) && requiresArrayEntries(value) || isSandboxArguments(value) || sandboxErrorTypes.has(value)) {
|
|
136601
|
+
if (stat36.count > 1 || stat36.cyclic || isFloat32Array(value) || Array.isArray(value) && requiresArrayEntries(value) || isSandboxArguments(value) || sandboxErrorTypes.has(value)) {
|
|
136478
136602
|
heapIds.set(value, nextId);
|
|
136479
136603
|
nextId += 1;
|
|
136480
136604
|
}
|
|
@@ -136485,7 +136609,7 @@ function collectContainerStats(value, stats2, ancestors) {
|
|
|
136485
136609
|
if (value === null || typeof value !== "object") {
|
|
136486
136610
|
return;
|
|
136487
136611
|
}
|
|
136488
|
-
if (!Array.isArray(value) && !isPlainObject9(value)) {
|
|
136612
|
+
if (!Array.isArray(value) && !isPlainObject9(value) && !isFloat32Array(value)) {
|
|
136489
136613
|
return;
|
|
136490
136614
|
}
|
|
136491
136615
|
let stat36 = stats2.get(value);
|
|
@@ -136553,6 +136677,8 @@ var init_dump_format = __esm({
|
|
|
136553
136677
|
init_arguments();
|
|
136554
136678
|
init_arguments2();
|
|
136555
136679
|
init_arrays();
|
|
136680
|
+
init_float32();
|
|
136681
|
+
init_float32array();
|
|
136556
136682
|
DUMP_FORMAT_VERSION = 1;
|
|
136557
136683
|
EXECUTION_SEMANTICS = "jobs-v7";
|
|
136558
136684
|
SKIP_VALUE = /* @__PURE__ */ Symbol("SafeJS.skip-dump-value");
|
|
@@ -136606,6 +136732,11 @@ function validateDumpHeap(root, state) {
|
|
|
136606
136732
|
addUnique2(heapIds, id, path191);
|
|
136607
136733
|
const entry = requireRecord3(value, path191);
|
|
136608
136734
|
validateErrorType(entry, path191);
|
|
136735
|
+
if (entry.kind === "float32array") {
|
|
136736
|
+
validateFloat32Storage(entry);
|
|
136737
|
+
requireRecord3(entry.entries, `${path191}.entries`);
|
|
136738
|
+
continue;
|
|
136739
|
+
}
|
|
136609
136740
|
if (entry.kind === "arguments") {
|
|
136610
136741
|
validateArgumentsProperties(entry, path191);
|
|
136611
136742
|
continue;
|
|
@@ -136971,6 +137102,7 @@ var init_validation = __esm({
|
|
|
136971
137102
|
init_shape();
|
|
136972
137103
|
init_dump_format();
|
|
136973
137104
|
init_graph_depth();
|
|
137105
|
+
init_float32array();
|
|
136974
137106
|
DEFAULT_MAX_DEPTH = MAX_DATA_DEPTH;
|
|
136975
137107
|
DEFAULT_MAX_ENTRIES = 1e5;
|
|
136976
137108
|
DEFAULT_MAX_STRING_LENGTH = 1e6;
|
|
@@ -137362,6 +137494,7 @@ var init_promise_replay = __esm({
|
|
|
137362
137494
|
function encodeReplayData(value, options = {}) {
|
|
137363
137495
|
const nodes = [];
|
|
137364
137496
|
const seen = /* @__PURE__ */ new WeakMap();
|
|
137497
|
+
const float32Buffers = /* @__PURE__ */ new WeakMap();
|
|
137365
137498
|
const encode = (entry, depth, path191) => {
|
|
137366
137499
|
if (depth > MAX_DATA_DEPTH) throw new TypeError("Replay data exceeds the nesting limit.");
|
|
137367
137500
|
if (entry === null || typeof entry === "boolean" || typeof entry === "string") return entry;
|
|
@@ -137402,6 +137535,21 @@ function encodeReplayData(value, options = {}) {
|
|
|
137402
137535
|
id: capabilityId,
|
|
137403
137536
|
properties: child(entry.properties, "properties")
|
|
137404
137537
|
};
|
|
137538
|
+
} else if (isFloat32Array(entry)) {
|
|
137539
|
+
const storage2 = encodeFloat32Storage(entry, id, float32Buffers, (id2) => ({
|
|
137540
|
+
tag: "ref",
|
|
137541
|
+
id: id2
|
|
137542
|
+
}));
|
|
137543
|
+
const properties = /* @__PURE__ */ Object.create(null);
|
|
137544
|
+
for (const [key3, descriptor] of float32DataProperties(entry)) {
|
|
137545
|
+
properties[key3] = {
|
|
137546
|
+
value: child(descriptor.value, key3),
|
|
137547
|
+
configurable: descriptor.configurable === true,
|
|
137548
|
+
enumerable: descriptor.enumerable === true,
|
|
137549
|
+
writable: descriptor.writable === true
|
|
137550
|
+
};
|
|
137551
|
+
}
|
|
137552
|
+
nodes[id] = { ...storage2, properties, extensible: Object.isExtensible(entry) };
|
|
137405
137553
|
} else if (isSandboxMap(entry)) {
|
|
137406
137554
|
nodes[id] = {
|
|
137407
137555
|
kind: "map",
|
|
@@ -137534,6 +137682,15 @@ function decodeReplayData(input, options = {}) {
|
|
|
137534
137682
|
options.onCapabilityRestored?.(capability, copy);
|
|
137535
137683
|
return copy;
|
|
137536
137684
|
}
|
|
137685
|
+
if (kind === "float32array") {
|
|
137686
|
+
if (typeof node.extensible !== "boolean")
|
|
137687
|
+
throw new TypeError("Invalid Float32Array extensibility.");
|
|
137688
|
+
const result2 = decodeFloat32Storage(node, child);
|
|
137689
|
+
restored.set(id, result2);
|
|
137690
|
+
defineProperties(result2, record(own(node, "properties")), child);
|
|
137691
|
+
if (!node.extensible) Object.preventExtensions(result2);
|
|
137692
|
+
return result2;
|
|
137693
|
+
}
|
|
137537
137694
|
if (kind === "map") {
|
|
137538
137695
|
const result2 = createSandboxMap();
|
|
137539
137696
|
restored.set(id, result2);
|
|
@@ -137627,6 +137784,8 @@ var init_replay_data = __esm({
|
|
|
137627
137784
|
"packages/safejs/src/snapshot/replay-data.ts"() {
|
|
137628
137785
|
"use strict";
|
|
137629
137786
|
init_graph_depth();
|
|
137787
|
+
init_float32();
|
|
137788
|
+
init_float32array();
|
|
137630
137789
|
init_shape();
|
|
137631
137790
|
init_values();
|
|
137632
137791
|
init_arguments2();
|
|
@@ -137859,6 +138018,22 @@ function normalize2(value, seen) {
|
|
|
137859
138018
|
if (seen.has(value)) throw new TypeError("Host call arguments cannot contain cycles.");
|
|
137860
138019
|
seen.add(value);
|
|
137861
138020
|
try {
|
|
138021
|
+
if (isFloat32Array(value)) {
|
|
138022
|
+
const storage2 = float32Storage(value);
|
|
138023
|
+
const properties = /* @__PURE__ */ Object.create(null);
|
|
138024
|
+
for (const [key3, descriptor] of float32DataProperties(value).sort(
|
|
138025
|
+
([left], [right]) => left < right ? -1 : left > right ? 1 : 0
|
|
138026
|
+
)) {
|
|
138027
|
+
defineOwnDataProperty(properties, key3, normalize2(descriptor.value, seen));
|
|
138028
|
+
}
|
|
138029
|
+
return Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
138030
|
+
$type: "float32array",
|
|
138031
|
+
bytes: normalize2(Array.from(new Uint8Array(storage2.buffer)), seen),
|
|
138032
|
+
byteOffset: storage2.byteOffset,
|
|
138033
|
+
length: storage2.length,
|
|
138034
|
+
properties
|
|
138035
|
+
});
|
|
138036
|
+
}
|
|
137862
138037
|
if (Array.isArray(value)) {
|
|
137863
138038
|
const normalized2 = new Array(value.length);
|
|
137864
138039
|
Object.setPrototypeOf(normalized2, null);
|
|
@@ -137890,6 +138065,7 @@ var HostCallResumabilityError, UnresolvedReplayCapabilityError, HostCallJournal;
|
|
|
137890
138065
|
var init_host_call = __esm({
|
|
137891
138066
|
"packages/safejs/src/interp/host-call.ts"() {
|
|
137892
138067
|
"use strict";
|
|
138068
|
+
init_float32();
|
|
137893
138069
|
init_values();
|
|
137894
138070
|
init_replay_data();
|
|
137895
138071
|
init_validation();
|
|
@@ -138750,6 +138926,9 @@ var init_running_state = __esm({
|
|
|
138750
138926
|
|
|
138751
138927
|
// packages/safejs/src/interp/iteration.ts
|
|
138752
138928
|
function getSandboxIterator(value) {
|
|
138929
|
+
if (isFloat32Array(value)) {
|
|
138930
|
+
return syncIterator(Float32Array.prototype.values.call(value));
|
|
138931
|
+
}
|
|
138753
138932
|
if (isSandboxGenerator(value)) {
|
|
138754
138933
|
return generatorIterator(value);
|
|
138755
138934
|
}
|
|
@@ -138847,6 +139026,7 @@ var init_iteration = __esm({
|
|
|
138847
139026
|
"use strict";
|
|
138848
139027
|
init_values();
|
|
138849
139028
|
init_running_state();
|
|
139029
|
+
init_float32();
|
|
138850
139030
|
}
|
|
138851
139031
|
});
|
|
138852
139032
|
|
|
@@ -140063,6 +140243,18 @@ function measureSandboxData(values, options = {}) {
|
|
|
140063
140243
|
if (seen.has(value)) return;
|
|
140064
140244
|
seen.add(value);
|
|
140065
140245
|
usage += 1;
|
|
140246
|
+
if (isFloat32Array(value)) {
|
|
140247
|
+
const storage2 = float32Storage(value);
|
|
140248
|
+
if (!seen.has(storage2.buffer)) {
|
|
140249
|
+
seen.add(storage2.buffer);
|
|
140250
|
+
usage += storage2.byteLength;
|
|
140251
|
+
}
|
|
140252
|
+
for (const [key3, descriptor] of float32DataProperties(value)) {
|
|
140253
|
+
usage += key3.length + 1;
|
|
140254
|
+
visit(descriptor.value);
|
|
140255
|
+
}
|
|
140256
|
+
return;
|
|
140257
|
+
}
|
|
140066
140258
|
if (Array.isArray(value)) {
|
|
140067
140259
|
usage += value.length;
|
|
140068
140260
|
for (let index = 0; index < value.length; index += 1) {
|
|
@@ -140171,6 +140363,26 @@ function copyToSandbox(value, state, path191 = "<root>", cloneSandboxCollections
|
|
|
140171
140363
|
}
|
|
140172
140364
|
return sandboxPromise;
|
|
140173
140365
|
}
|
|
140366
|
+
if (isFloat32Array(value)) {
|
|
140367
|
+
const existing = state.seen.get(value);
|
|
140368
|
+
if (existing !== void 0) return existing;
|
|
140369
|
+
const copy = copyFloat32Storage(value, state);
|
|
140370
|
+
state.seen.set(value, copy);
|
|
140371
|
+
for (const [key3, descriptor] of float32DataProperties(value)) {
|
|
140372
|
+
Object.defineProperty(copy, key3, {
|
|
140373
|
+
...descriptor,
|
|
140374
|
+
value: copyToSandbox(
|
|
140375
|
+
descriptor.value,
|
|
140376
|
+
state,
|
|
140377
|
+
joinPath(path191, key3),
|
|
140378
|
+
cloneSandboxCollections,
|
|
140379
|
+
depth + 1
|
|
140380
|
+
)
|
|
140381
|
+
});
|
|
140382
|
+
}
|
|
140383
|
+
if (!Object.isExtensible(value)) Object.preventExtensions(copy);
|
|
140384
|
+
return copy;
|
|
140385
|
+
}
|
|
140174
140386
|
if (value instanceof Map) {
|
|
140175
140387
|
const existing = state.seen.get(value);
|
|
140176
140388
|
if (existing !== void 0) {
|
|
@@ -140265,6 +140477,20 @@ function copyFromSandbox(value, state, path191 = "<root>", options, depth = 0) {
|
|
|
140265
140477
|
if (isSandboxPrimitive(value)) {
|
|
140266
140478
|
return value;
|
|
140267
140479
|
}
|
|
140480
|
+
if (isFloat32Array(value)) {
|
|
140481
|
+
const existing = state.seen.get(value);
|
|
140482
|
+
if (existing !== void 0) return existing;
|
|
140483
|
+
const copy = copyFloat32Storage(value, state);
|
|
140484
|
+
state.seen.set(value, copy);
|
|
140485
|
+
for (const [key3, descriptor] of float32DataProperties(value)) {
|
|
140486
|
+
Object.defineProperty(copy, key3, {
|
|
140487
|
+
...descriptor,
|
|
140488
|
+
value: copyFromSandbox(descriptor.value, state, joinPath(path191, key3), options, depth + 1)
|
|
140489
|
+
});
|
|
140490
|
+
}
|
|
140491
|
+
if (!Object.isExtensible(value)) Object.preventExtensions(copy);
|
|
140492
|
+
return copy;
|
|
140493
|
+
}
|
|
140268
140494
|
if (isSandboxClosure(value)) {
|
|
140269
140495
|
if (options.wrapClosure === void 0) {
|
|
140270
140496
|
throw new TypeError(
|
|
@@ -140380,6 +140606,16 @@ function allocateSandboxValue2(value, budget, seen) {
|
|
|
140380
140606
|
budget.allocateString(value);
|
|
140381
140607
|
return;
|
|
140382
140608
|
}
|
|
140609
|
+
if (isFloat32Array(value)) {
|
|
140610
|
+
if (seen.has(value)) return;
|
|
140611
|
+
seen.add(value);
|
|
140612
|
+
budget.allocateArrayLength(Math.ceil(float32Storage(value).byteLength / 4));
|
|
140613
|
+
for (const [key3, descriptor] of float32DataProperties(value)) {
|
|
140614
|
+
budget.allocateString(key3);
|
|
140615
|
+
allocateSandboxValue2(descriptor.value, budget, seen);
|
|
140616
|
+
}
|
|
140617
|
+
return;
|
|
140618
|
+
}
|
|
140383
140619
|
if (Array.isArray(value)) {
|
|
140384
140620
|
if (seen.has(value)) {
|
|
140385
140621
|
return;
|
|
@@ -140513,6 +140749,7 @@ var init_values = __esm({
|
|
|
140513
140749
|
"packages/safejs/src/interp/values.ts"() {
|
|
140514
140750
|
"use strict";
|
|
140515
140751
|
init_otel2();
|
|
140752
|
+
init_float32();
|
|
140516
140753
|
init_budget2();
|
|
140517
140754
|
init_promise_tracker();
|
|
140518
140755
|
init_promise_replay();
|
|
@@ -141992,6 +142229,27 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path191) {
|
|
|
141992
142229
|
state
|
|
141993
142230
|
);
|
|
141994
142231
|
}
|
|
142232
|
+
if (isFloat32Array(value)) {
|
|
142233
|
+
const existing = state.seen.get(value);
|
|
142234
|
+
if (existing !== void 0) return existing;
|
|
142235
|
+
checkFloat32Allocation(Math.ceil(float32Storage(value).byteLength / 4), budget);
|
|
142236
|
+
const copy = copyFloat32Storage(value, state);
|
|
142237
|
+
state.seen.set(value, copy);
|
|
142238
|
+
for (const [key3, descriptor] of float32DataProperties(value)) {
|
|
142239
|
+
Object.defineProperty(copy, key3, {
|
|
142240
|
+
...descriptor,
|
|
142241
|
+
value: copyHostValueToSandbox(
|
|
142242
|
+
descriptor.value,
|
|
142243
|
+
stackFrames,
|
|
142244
|
+
{ ...options, capabilityPath: [...options.capabilityPath ?? [], key3] },
|
|
142245
|
+
state,
|
|
142246
|
+
joinPath2(path191, key3)
|
|
142247
|
+
)
|
|
142248
|
+
});
|
|
142249
|
+
}
|
|
142250
|
+
if (!Object.isExtensible(value)) Object.preventExtensions(copy);
|
|
142251
|
+
return copy;
|
|
142252
|
+
}
|
|
141995
142253
|
if (!options.errorData && isPromiseLike5(value)) {
|
|
141996
142254
|
if (options.proofFunctions !== void 0)
|
|
141997
142255
|
throw new TypeError(`Unsupported proof value at ${path191}: promise`);
|
|
@@ -142254,6 +142512,7 @@ var init_host_bridge = __esm({
|
|
|
142254
142512
|
init_async();
|
|
142255
142513
|
init_shape();
|
|
142256
142514
|
init_budget2();
|
|
142515
|
+
init_float32();
|
|
142257
142516
|
init_exceptions();
|
|
142258
142517
|
init_otel2();
|
|
142259
142518
|
init_host_call();
|
|
@@ -142674,6 +142933,139 @@ var init_collections = __esm({
|
|
|
142674
142933
|
}
|
|
142675
142934
|
});
|
|
142676
142935
|
|
|
142936
|
+
// packages/safejs/src/interp/globals/float32array.ts
|
|
142937
|
+
function createFloat32ArrayGlobal(budget) {
|
|
142938
|
+
const constructor = createSandboxClosure({
|
|
142939
|
+
sandbox: true,
|
|
142940
|
+
name: "Float32Array",
|
|
142941
|
+
length: 3,
|
|
142942
|
+
properties: { BYTES_PER_ELEMENT: 4 },
|
|
142943
|
+
call: () => {
|
|
142944
|
+
throw new TypeError("Constructor Float32Array requires 'new'.");
|
|
142945
|
+
},
|
|
142946
|
+
construct: ([source]) => {
|
|
142947
|
+
if (Array.isArray(source) || isFloat32Array(source)) {
|
|
142948
|
+
const length2 = isFloat32Array(source) ? float32Storage(source).length : source.length;
|
|
142949
|
+
checkFloat32Allocation(length2, budget);
|
|
142950
|
+
if (isFloat32Array(source)) return new Float32Array(source);
|
|
142951
|
+
const result = new Float32Array(length2);
|
|
142952
|
+
for (let index = 0; index < length2; index += 1) {
|
|
142953
|
+
budget.visitNode();
|
|
142954
|
+
const descriptor = Object.getOwnPropertyDescriptor(source, index);
|
|
142955
|
+
if (descriptor !== void 0 && !("value" in descriptor))
|
|
142956
|
+
throw new TypeError("Float32Array input accessors are not supported.");
|
|
142957
|
+
result[index] = float32Number(descriptor?.value);
|
|
142958
|
+
}
|
|
142959
|
+
return result;
|
|
142960
|
+
}
|
|
142961
|
+
const number = float32Number(source);
|
|
142962
|
+
const length = Number.isNaN(number) ? 0 : Math.trunc(number);
|
|
142963
|
+
if (length < 0 || !Number.isSafeInteger(length))
|
|
142964
|
+
throw new RangeError("Invalid typed array length.");
|
|
142965
|
+
checkFloat32Allocation(length, budget);
|
|
142966
|
+
return new Float32Array(length);
|
|
142967
|
+
}
|
|
142968
|
+
});
|
|
142969
|
+
constructors.add(constructor);
|
|
142970
|
+
return constructor;
|
|
142971
|
+
}
|
|
142972
|
+
function isFloat32ArrayConstructor(value) {
|
|
142973
|
+
return typeof value === "object" && value !== null && constructors.has(value);
|
|
142974
|
+
}
|
|
142975
|
+
function getFloat32Member(value, property, budget) {
|
|
142976
|
+
const key3 = String(property);
|
|
142977
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key3);
|
|
142978
|
+
if (descriptor !== void 0) {
|
|
142979
|
+
if (!("value" in descriptor)) throw new TypeError("Float32Array accessors are not supported.");
|
|
142980
|
+
return descriptor.value;
|
|
142981
|
+
}
|
|
142982
|
+
const storage2 = float32Storage(value);
|
|
142983
|
+
if (key3 === "length") return storage2.length;
|
|
142984
|
+
if (key3 === "byteLength") return storage2.length * 4;
|
|
142985
|
+
if (key3 === "byteOffset") return storage2.byteOffset;
|
|
142986
|
+
if (key3 === "BYTES_PER_ELEMENT") return 4;
|
|
142987
|
+
if (!["set", "slice", "subarray"].includes(key3)) return void 0;
|
|
142988
|
+
return createSandboxClosure({
|
|
142989
|
+
sandbox: true,
|
|
142990
|
+
name: key3,
|
|
142991
|
+
length: key3 === "set" ? 1 : 2,
|
|
142992
|
+
call: (args, context) => {
|
|
142993
|
+
const receiver = context?.thisValue;
|
|
142994
|
+
if (!isFloat32Array(receiver))
|
|
142995
|
+
throw new TypeError(`Float32Array#${key3} requires a Float32Array receiver.`);
|
|
142996
|
+
const storage3 = float32Storage(receiver);
|
|
142997
|
+
if (key3 === "set") {
|
|
142998
|
+
const [source, offsetValue = 0] = args;
|
|
142999
|
+
if (!Array.isArray(source) && !isFloat32Array(source))
|
|
143000
|
+
throw new TypeError("Float32Array#set requires an array or Float32Array.");
|
|
143001
|
+
const number = float32Number(offsetValue);
|
|
143002
|
+
const offset = Number.isNaN(number) ? 0 : Math.trunc(number);
|
|
143003
|
+
const length2 = isFloat32Array(source) ? float32Storage(source).length : source.length;
|
|
143004
|
+
if (offset < 0 || !Number.isSafeInteger(offset) || offset + length2 > storage3.length)
|
|
143005
|
+
throw new RangeError("Float32Array#set source is out of bounds.");
|
|
143006
|
+
if (isFloat32Array(source)) {
|
|
143007
|
+
Float32Array.prototype.set.call(receiver, source, offset);
|
|
143008
|
+
return void 0;
|
|
143009
|
+
}
|
|
143010
|
+
checkFloat32Allocation(length2, budget);
|
|
143011
|
+
const copied = new Float32Array(length2);
|
|
143012
|
+
for (let index = 0; index < length2; index += 1) {
|
|
143013
|
+
budget.visitNode();
|
|
143014
|
+
const entry = Object.getOwnPropertyDescriptor(source, index);
|
|
143015
|
+
if (entry !== void 0 && !("value" in entry))
|
|
143016
|
+
throw new TypeError("Float32Array input accessors are not supported.");
|
|
143017
|
+
copied[index] = float32Number(entry?.value);
|
|
143018
|
+
}
|
|
143019
|
+
Float32Array.prototype.set.call(receiver, copied, offset);
|
|
143020
|
+
return void 0;
|
|
143021
|
+
}
|
|
143022
|
+
const start = relativeIndex(args[0], storage3.length, 0);
|
|
143023
|
+
const end = relativeIndex(args[1], storage3.length, storage3.length);
|
|
143024
|
+
const length = Math.max(end - start, 0);
|
|
143025
|
+
if (key3 === "subarray")
|
|
143026
|
+
return new Float32Array(storage3.buffer, storage3.byteOffset + start * 4, length);
|
|
143027
|
+
checkFloat32Allocation(length, budget);
|
|
143028
|
+
const result = new Float32Array(length);
|
|
143029
|
+
new Uint8Array(result.buffer).set(
|
|
143030
|
+
new Uint8Array(storage3.buffer, storage3.byteOffset + start * 4, length * 4)
|
|
143031
|
+
);
|
|
143032
|
+
return result;
|
|
143033
|
+
}
|
|
143034
|
+
});
|
|
143035
|
+
}
|
|
143036
|
+
function setFloat32Member(value, property, entry) {
|
|
143037
|
+
const key3 = String(property);
|
|
143038
|
+
if (isFloat32Index(key3)) {
|
|
143039
|
+
Reflect.set(value, key3, float32Number(entry));
|
|
143040
|
+
return;
|
|
143041
|
+
}
|
|
143042
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key3);
|
|
143043
|
+
if (descriptor === void 0 && ["length", "byteLength", "byteOffset", "buffer", "BYTES_PER_ELEMENT"].includes(key3))
|
|
143044
|
+
throw new TypeError(`Cannot assign to read only property '${key3}'.`);
|
|
143045
|
+
if (descriptor !== void 0 && (!("value" in descriptor) || !descriptor.writable))
|
|
143046
|
+
throw new TypeError(`Cannot assign to read only property '${key3}'.`);
|
|
143047
|
+
Object.defineProperty(
|
|
143048
|
+
value,
|
|
143049
|
+
key3,
|
|
143050
|
+
descriptor === void 0 ? { value: entry, configurable: true, enumerable: true, writable: true } : { value: entry }
|
|
143051
|
+
);
|
|
143052
|
+
}
|
|
143053
|
+
function relativeIndex(value, length, fallback) {
|
|
143054
|
+
if (value === void 0) return fallback;
|
|
143055
|
+
const numeric = float32Number(value);
|
|
143056
|
+
const integer2 = Number.isNaN(numeric) ? 0 : Math.trunc(numeric);
|
|
143057
|
+
return integer2 < 0 ? Math.max(length + integer2, 0) : Math.min(integer2, length);
|
|
143058
|
+
}
|
|
143059
|
+
var constructors;
|
|
143060
|
+
var init_float32array2 = __esm({
|
|
143061
|
+
"packages/safejs/src/interp/globals/float32array.ts"() {
|
|
143062
|
+
"use strict";
|
|
143063
|
+
init_float32();
|
|
143064
|
+
init_values();
|
|
143065
|
+
constructors = /* @__PURE__ */ new WeakSet();
|
|
143066
|
+
}
|
|
143067
|
+
});
|
|
143068
|
+
|
|
142677
143069
|
// packages/safejs/src/interp/globals/error.ts
|
|
142678
143070
|
function createErrorGlobals(options) {
|
|
142679
143071
|
return Object.fromEntries(
|
|
@@ -143030,6 +143422,10 @@ function assignSandboxValues(target, sources) {
|
|
|
143030
143422
|
continue;
|
|
143031
143423
|
}
|
|
143032
143424
|
for (const [key3, value] of getOwnEnumerableEntries(source)) {
|
|
143425
|
+
if (isFloat32Array(target)) {
|
|
143426
|
+
setFloat32Member(target, key3, value);
|
|
143427
|
+
continue;
|
|
143428
|
+
}
|
|
143033
143429
|
Object.defineProperty(target, key3, {
|
|
143034
143430
|
configurable: true,
|
|
143035
143431
|
enumerable: true,
|
|
@@ -143127,6 +143523,8 @@ var init_object_array = __esm({
|
|
|
143127
143523
|
"packages/safejs/src/interp/globals/object-array.ts"() {
|
|
143128
143524
|
"use strict";
|
|
143129
143525
|
init_shape();
|
|
143526
|
+
init_float32();
|
|
143527
|
+
init_float32array2();
|
|
143130
143528
|
init_iteration();
|
|
143131
143529
|
init_values();
|
|
143132
143530
|
}
|
|
@@ -146011,7 +146409,7 @@ function forInObject(value) {
|
|
|
146011
146409
|
if (value === null || value === void 0 || isSandboxClosure(value) || isSandboxPromise(value)) {
|
|
146012
146410
|
return void 0;
|
|
146013
146411
|
}
|
|
146014
|
-
if (typeof value === "string" || Array.isArray(value) || isPlainForInObject(value)) {
|
|
146412
|
+
if (typeof value === "string" || Array.isArray(value) || isFloat32Array(value) || isPlainForInObject(value)) {
|
|
146015
146413
|
return Object(value);
|
|
146016
146414
|
}
|
|
146017
146415
|
return void 0;
|
|
@@ -146513,6 +146911,7 @@ function getPropertyValue(target, property, context) {
|
|
|
146513
146911
|
if (typeof target === "string") return getStringMember(target, property, context.budget);
|
|
146514
146912
|
if (typeof target === "number") return getNumberMember(target, property, context.budget);
|
|
146515
146913
|
if (typeof target === "boolean") return void 0;
|
|
146914
|
+
if (isFloat32Array(target)) return getFloat32Member(target, property, context.budget);
|
|
146516
146915
|
if (isSandboxMap(target)) return getMapMember(target, property, createMapMethodOptions(context));
|
|
146517
146916
|
if (isSandboxSet(target)) return getSetMember(target, property, createSetMethodOptions(context));
|
|
146518
146917
|
if (isSandboxGenerator(target)) return getGeneratorMember(target, property, context.budget);
|
|
@@ -146741,6 +147140,14 @@ async function evaluateMemberCallExpression(node, context) {
|
|
|
146741
147140
|
context
|
|
146742
147141
|
);
|
|
146743
147142
|
}
|
|
147143
|
+
if (isFloat32Array(member.object)) {
|
|
147144
|
+
return evaluateResolvedCallExpression(
|
|
147145
|
+
node,
|
|
147146
|
+
getFloat32Member(member.object, member.property, context.budget),
|
|
147147
|
+
context,
|
|
147148
|
+
member.object
|
|
147149
|
+
);
|
|
147150
|
+
}
|
|
146744
147151
|
if (isSandboxSet(member.object)) {
|
|
146745
147152
|
return evaluatePrimitiveMemberCall(
|
|
146746
147153
|
node,
|
|
@@ -146983,6 +147390,7 @@ function applyBinaryOperator(node, left, right, context) {
|
|
|
146983
147390
|
if (isSandboxMapConstructor(right) && isSandboxMap(left)) {
|
|
146984
147391
|
return true;
|
|
146985
147392
|
}
|
|
147393
|
+
if (isFloat32ArrayConstructor(right)) return isFloat32Array(left);
|
|
146986
147394
|
if (isSandboxSetConstructor(right) && isSandboxSet(left)) {
|
|
146987
147395
|
return true;
|
|
146988
147396
|
}
|
|
@@ -147201,6 +147609,10 @@ function getArrayMemberValue(target, property, context) {
|
|
|
147201
147609
|
return getArrayMember(target, property, createArrayMethodOptions(context));
|
|
147202
147610
|
}
|
|
147203
147611
|
function setSandboxProperty(target, property, value) {
|
|
147612
|
+
if (isFloat32Array(target)) {
|
|
147613
|
+
setFloat32Member(target, property, value);
|
|
147614
|
+
return;
|
|
147615
|
+
}
|
|
147204
147616
|
if (isSandboxRegex(target)) {
|
|
147205
147617
|
setRegexMember(target, property, value);
|
|
147206
147618
|
return;
|
|
@@ -147500,6 +147912,8 @@ var init_interpreter = __esm({
|
|
|
147500
147912
|
init_set();
|
|
147501
147913
|
init_error();
|
|
147502
147914
|
init_collections();
|
|
147915
|
+
init_float32array2();
|
|
147916
|
+
init_float32();
|
|
147503
147917
|
init_values();
|
|
147504
147918
|
init_scope();
|
|
147505
147919
|
init_var_hoist();
|
|
@@ -148113,6 +148527,8 @@ var init_serialize = __esm({
|
|
|
148113
148527
|
init_graph_depth();
|
|
148114
148528
|
init_arguments2();
|
|
148115
148529
|
init_arrays();
|
|
148530
|
+
init_float32();
|
|
148531
|
+
init_float32array();
|
|
148116
148532
|
init_values();
|
|
148117
148533
|
UnsnapshotableValueError = class extends Error {
|
|
148118
148534
|
path;
|
|
@@ -148304,6 +148720,7 @@ function run(source, options = {}) {
|
|
|
148304
148720
|
sink: options.sink
|
|
148305
148721
|
}),
|
|
148306
148722
|
...createCollectionGlobals({ budget }),
|
|
148723
|
+
Float32Array: createFloat32ArrayGlobal(budget),
|
|
148307
148724
|
...createErrorGlobals({
|
|
148308
148725
|
budget
|
|
148309
148726
|
}),
|
|
@@ -148771,6 +149188,7 @@ var init_run7 = __esm({
|
|
|
148771
149188
|
init_host_call();
|
|
148772
149189
|
init_console_json();
|
|
148773
149190
|
init_collections();
|
|
149191
|
+
init_float32array2();
|
|
148774
149192
|
init_error();
|
|
148775
149193
|
init_math();
|
|
148776
149194
|
init_regex();
|
|
@@ -155792,7 +156210,7 @@ var init_package2 = __esm({
|
|
|
155792
156210
|
"package.json"() {
|
|
155793
156211
|
package_default2 = {
|
|
155794
156212
|
name: "poe-code",
|
|
155795
|
-
version: "12.0.
|
|
156213
|
+
version: "12.0.4",
|
|
155796
156214
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
155797
156215
|
license: "MIT",
|
|
155798
156216
|
type: "module",
|