@poe-platform/safe-js 0.1.245 → 0.1.246
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-ITCCCKXY.js → chunk-KQJOGTEH.js} +2 -2
- package/dist/safe-js/chunks/{chunk-NOQSV7MP.js → chunk-SIFD2ANX.js} +120 -3
- package/dist/safe-js/chunks/{chunk-NOQSV7MP.js.map → chunk-SIFD2ANX.js.map} +4 -4
- 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-ITCCCKXY.js.map → chunk-KQJOGTEH.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-SIFD2ANX.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-KQJOGTEH.js.map
|
|
@@ -21566,6 +21566,120 @@ function getEnumerableDataValues(value) {
|
|
|
21566
21566
|
return getEnumerableDataEntries(value).map(([, entry]) => entry);
|
|
21567
21567
|
}
|
|
21568
21568
|
|
|
21569
|
+
// packages/safe-js/src/interp/globals/json-parse.ts
|
|
21570
|
+
async function parseJsonWithReviver(text, reviver, budget, context) {
|
|
21571
|
+
budget.visitNode(text.length);
|
|
21572
|
+
JSON.parse(text);
|
|
21573
|
+
const originalValues = [];
|
|
21574
|
+
let position = 0;
|
|
21575
|
+
const root = readValue();
|
|
21576
|
+
const holder = { "": root.value };
|
|
21577
|
+
const release = retainValues(budget, () => [holder, reviver, text, ...originalValues]);
|
|
21578
|
+
try {
|
|
21579
|
+
return await internalize(holder, "", root);
|
|
21580
|
+
} finally {
|
|
21581
|
+
release();
|
|
21582
|
+
}
|
|
21583
|
+
function skipWhitespace2() {
|
|
21584
|
+
while (position < text.length && " \r\n".includes(text[position])) position++;
|
|
21585
|
+
}
|
|
21586
|
+
function readToken() {
|
|
21587
|
+
const start = position;
|
|
21588
|
+
if (text[position] === '"') {
|
|
21589
|
+
position++;
|
|
21590
|
+
while (text[position] !== '"') position += text[position] === "\\" ? 2 : 1;
|
|
21591
|
+
position++;
|
|
21592
|
+
} else {
|
|
21593
|
+
while (position < text.length && !",]} \r\n".includes(text[position])) position++;
|
|
21594
|
+
}
|
|
21595
|
+
return text.slice(start, position);
|
|
21596
|
+
}
|
|
21597
|
+
function readValue() {
|
|
21598
|
+
budget.visitNode();
|
|
21599
|
+
const leave = budget.enterCall();
|
|
21600
|
+
try {
|
|
21601
|
+
skipWhitespace2();
|
|
21602
|
+
const opening = text[position];
|
|
21603
|
+
if (opening !== "[" && opening !== "{") {
|
|
21604
|
+
const source = readToken();
|
|
21605
|
+
const value2 = JSON.parse(source);
|
|
21606
|
+
if (typeof value2 === "string") budget.allocateString(value2);
|
|
21607
|
+
originalValues.push(value2);
|
|
21608
|
+
return { value: value2, source };
|
|
21609
|
+
}
|
|
21610
|
+
const array2 = opening === "[";
|
|
21611
|
+
const value = array2 ? [] : /* @__PURE__ */ Object.create(null);
|
|
21612
|
+
const children = /* @__PURE__ */ new Map();
|
|
21613
|
+
position++;
|
|
21614
|
+
skipWhitespace2();
|
|
21615
|
+
let index = 0;
|
|
21616
|
+
while (text[position] !== (array2 ? "]" : "}")) {
|
|
21617
|
+
let key;
|
|
21618
|
+
if (array2) {
|
|
21619
|
+
budget.allocateArrayLength(index + 1);
|
|
21620
|
+
key = String(index++);
|
|
21621
|
+
} else {
|
|
21622
|
+
key = JSON.parse(readToken());
|
|
21623
|
+
skipWhitespace2();
|
|
21624
|
+
position++;
|
|
21625
|
+
}
|
|
21626
|
+
const child = readValue();
|
|
21627
|
+
children.set(key, child);
|
|
21628
|
+
Object.defineProperty(value, key, { value: child.value, configurable: true, enumerable: true, writable: true });
|
|
21629
|
+
skipWhitespace2();
|
|
21630
|
+
if (text[position] === ",") {
|
|
21631
|
+
position++;
|
|
21632
|
+
skipWhitespace2();
|
|
21633
|
+
}
|
|
21634
|
+
}
|
|
21635
|
+
position++;
|
|
21636
|
+
originalValues.push(value);
|
|
21637
|
+
return { value, children };
|
|
21638
|
+
} finally {
|
|
21639
|
+
leave();
|
|
21640
|
+
}
|
|
21641
|
+
}
|
|
21642
|
+
async function internalize(holder2, key, record3) {
|
|
21643
|
+
budget.visitNode();
|
|
21644
|
+
const leave = budget.enterCall();
|
|
21645
|
+
let value;
|
|
21646
|
+
const callbackContext = {};
|
|
21647
|
+
const release2 = retainValues(budget, () => [holder2, value, callbackContext]);
|
|
21648
|
+
try {
|
|
21649
|
+
if (context?.getProperty !== void 0) value = await context.getProperty(holder2, key);
|
|
21650
|
+
else {
|
|
21651
|
+
const descriptor = getSandboxPropertyDescriptor(holder2, key, budget);
|
|
21652
|
+
value = descriptor === void 0 ? void 0 : await readPropertyDescriptor(descriptor, holder2, context);
|
|
21653
|
+
}
|
|
21654
|
+
const original = record3 !== void 0 && Object.is(value, record3.value) ? record3 : void 0;
|
|
21655
|
+
if (original?.source !== void 0) callbackContext.source = budget.allocateString(original.source);
|
|
21656
|
+
if (typeof value === "object" && value !== null) {
|
|
21657
|
+
if (Array.isArray(value)) budget.allocateArrayLength(value.length);
|
|
21658
|
+
const keys = Array.isArray(value) ? Array.from({ length: value.length }, (_, index) => String(index)) : ownEnumerableSandboxKeys(value);
|
|
21659
|
+
budget.allocateArrayLength(keys.length);
|
|
21660
|
+
for (const name of keys) {
|
|
21661
|
+
const replacement = await internalize(value, name, original?.children?.get(name));
|
|
21662
|
+
const properties = isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : value;
|
|
21663
|
+
if (replacement === void 0) Reflect.deleteProperty(properties, name);
|
|
21664
|
+
else Reflect.defineProperty(properties, name, {
|
|
21665
|
+
value: replacement,
|
|
21666
|
+
configurable: true,
|
|
21667
|
+
enumerable: true,
|
|
21668
|
+
writable: true
|
|
21669
|
+
});
|
|
21670
|
+
context?.reconcileData?.(value);
|
|
21671
|
+
}
|
|
21672
|
+
}
|
|
21673
|
+
const result = await reviver.call([key, value, callbackContext], { stack: [], thisValue: holder2 });
|
|
21674
|
+
if (isSandboxPromise(result) && result.synchronousPrefix !== void 0) await result.synchronousPrefix;
|
|
21675
|
+
return allocateProducedSandboxValue(result, budget);
|
|
21676
|
+
} finally {
|
|
21677
|
+
release2();
|
|
21678
|
+
leave();
|
|
21679
|
+
}
|
|
21680
|
+
}
|
|
21681
|
+
}
|
|
21682
|
+
|
|
21569
21683
|
// packages/safe-js/src/interp/globals/console-json.ts
|
|
21570
21684
|
function createConsoleJsonGlobals(options) {
|
|
21571
21685
|
const sink = options.sink ?? console;
|
|
@@ -21573,10 +21687,13 @@ function createConsoleJsonGlobals(options) {
|
|
|
21573
21687
|
JSON: {
|
|
21574
21688
|
parse: createSandboxClosure({
|
|
21575
21689
|
sandbox: true,
|
|
21576
|
-
|
|
21690
|
+
length: 2,
|
|
21691
|
+
call: async ([text, reviver], context) => {
|
|
21577
21692
|
const converted = sandboxString(text, options.budget, context);
|
|
21693
|
+
const source = converted instanceof Promise ? await converted : converted;
|
|
21694
|
+
if (isSandboxClosure(reviver)) return parseJsonWithReviver(source, reviver, options.budget, context);
|
|
21578
21695
|
return copyJsonToSandbox(
|
|
21579
|
-
JSON.parse(
|
|
21696
|
+
JSON.parse(source),
|
|
21580
21697
|
options.budget
|
|
21581
21698
|
);
|
|
21582
21699
|
},
|
|
@@ -39347,4 +39464,4 @@ export {
|
|
|
39347
39464
|
FileSnapshotBackend,
|
|
39348
39465
|
run
|
|
39349
39466
|
};
|
|
39350
|
-
//# sourceMappingURL=chunk-
|
|
39467
|
+
//# sourceMappingURL=chunk-SIFD2ANX.js.map
|