@poe-platform/safe-js 0.1.248 → 0.1.250
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-HTFX2QV6.js → chunk-GFCWDIHP.js} +2 -2
- package/dist/safe-js/chunks/{chunk-FAZ46PGV.js → chunk-WHDYVYXQ.js} +34 -6
- package/dist/safe-js/chunks/chunk-WHDYVYXQ.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/dist/safe-js/snapshot/dump-format.d.ts +1 -0
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-FAZ46PGV.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-HTFX2QV6.js.map → chunk-GFCWDIHP.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-WHDYVYXQ.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-GFCWDIHP.js.map
|
|
@@ -7859,9 +7859,14 @@ function registerIntrinsicPrototype(budget, prototype, constructor) {
|
|
|
7859
7859
|
}
|
|
7860
7860
|
function registerIntrinsicFunction(budget, closure) {
|
|
7861
7861
|
if (closure.name === void 0) throw new TypeError("Intrinsic functions require an installation name.");
|
|
7862
|
-
|
|
7862
|
+
if (getIntrinsicIdentity(closure) === void 0)
|
|
7863
|
+
registerBuiltinIdentities(budget, { [closure.name]: closure });
|
|
7863
7864
|
trackIntrinsicState(budget, closure, closure, [closure]);
|
|
7864
7865
|
}
|
|
7866
|
+
function registerIntrinsicObject(budget, value) {
|
|
7867
|
+
const methods = Object.values(Object.getOwnPropertyDescriptors(value)).map((descriptor) => descriptor.value).filter(isGuestClosure);
|
|
7868
|
+
trackIntrinsicState(budget, value, value, [value, ...methods]);
|
|
7869
|
+
}
|
|
7865
7870
|
function trackIntrinsicState(budget, root, owner, targets) {
|
|
7866
7871
|
let roots = intrinsicPrototypeRoots.get(budget);
|
|
7867
7872
|
if (roots === void 0) intrinsicPrototypeRoots.set(budget, roots = /* @__PURE__ */ new Set());
|
|
@@ -21306,6 +21311,7 @@ function serializeDate(value, encode) {
|
|
|
21306
21311
|
|
|
21307
21312
|
// packages/safe-js/src/snapshot/dump-format.ts
|
|
21308
21313
|
var DUMP_FORMAT_VERSION = 2;
|
|
21314
|
+
var inMemoryRunSnapshots = /* @__PURE__ */ new WeakSet();
|
|
21309
21315
|
var EXECUTION_SEMANTICS = "jobs-v8";
|
|
21310
21316
|
var SKIP_VALUE = /* @__PURE__ */ Symbol("SafeJS.skip-dump-value");
|
|
21311
21317
|
function serializeSafeJSSnapshot(snapshot) {
|
|
@@ -21736,10 +21742,11 @@ async function parseJsonWithReviver(text, reviver, budget, context) {
|
|
|
21736
21742
|
// packages/safe-js/src/interp/globals/console-json.ts
|
|
21737
21743
|
function createConsoleJsonGlobals(options) {
|
|
21738
21744
|
const sink = options.sink ?? console;
|
|
21739
|
-
|
|
21745
|
+
const globals = {
|
|
21740
21746
|
JSON: {
|
|
21741
21747
|
rawJSON: createSandboxClosure({
|
|
21742
21748
|
sandbox: true,
|
|
21749
|
+
guest: true,
|
|
21743
21750
|
name: "rawJSON",
|
|
21744
21751
|
length: 1,
|
|
21745
21752
|
call: async ([value], context) => {
|
|
@@ -21750,12 +21757,14 @@ function createConsoleJsonGlobals(options) {
|
|
|
21750
21757
|
}),
|
|
21751
21758
|
isRawJSON: createSandboxClosure({
|
|
21752
21759
|
sandbox: true,
|
|
21760
|
+
guest: true,
|
|
21753
21761
|
name: "isRawJSON",
|
|
21754
21762
|
length: 1,
|
|
21755
21763
|
call: ([value]) => isRawJson(value)
|
|
21756
21764
|
}),
|
|
21757
21765
|
parse: createSandboxClosure({
|
|
21758
21766
|
sandbox: true,
|
|
21767
|
+
guest: true,
|
|
21759
21768
|
length: 2,
|
|
21760
21769
|
call: async ([text, reviver], context) => {
|
|
21761
21770
|
const converted = sandboxString(text, options.budget, context);
|
|
@@ -21770,6 +21779,8 @@ function createConsoleJsonGlobals(options) {
|
|
|
21770
21779
|
}),
|
|
21771
21780
|
stringify: createSandboxClosure({
|
|
21772
21781
|
sandbox: true,
|
|
21782
|
+
guest: true,
|
|
21783
|
+
length: 3,
|
|
21773
21784
|
call: async ([value, replacer, indent], context) => stringifyJson(value, replacer, indent, options.budget, context),
|
|
21774
21785
|
name: "stringify"
|
|
21775
21786
|
})
|
|
@@ -21832,6 +21843,15 @@ function createConsoleJsonGlobals(options) {
|
|
|
21832
21843
|
}
|
|
21833
21844
|
)
|
|
21834
21845
|
};
|
|
21846
|
+
const jsonMethods = Object.entries(globals.JSON);
|
|
21847
|
+
for (const [name] of jsonMethods) {
|
|
21848
|
+
Object.defineProperty(globals.JSON, name, { enumerable: false });
|
|
21849
|
+
}
|
|
21850
|
+
Object.defineProperty(globals.JSON, Symbol.toStringTag, { value: "JSON", configurable: true });
|
|
21851
|
+
registerBuiltinIdentities(options.budget, { JSON: globals.JSON });
|
|
21852
|
+
for (const [, method] of jsonMethods) registerIntrinsicFunction(options.budget, method);
|
|
21853
|
+
registerIntrinsicObject(options.budget, globals.JSON);
|
|
21854
|
+
return globals;
|
|
21835
21855
|
}
|
|
21836
21856
|
async function stringifyJson(value, replacer, indent, budget, context) {
|
|
21837
21857
|
const allocation = {};
|
|
@@ -26332,7 +26352,13 @@ var SnapshotMismatchError = class extends Error {
|
|
|
26332
26352
|
};
|
|
26333
26353
|
function restore(snapshot, options, owner) {
|
|
26334
26354
|
assertSnapshotInactive(snapshot);
|
|
26335
|
-
|
|
26355
|
+
try {
|
|
26356
|
+
validateDumpEnvelope(snapshot);
|
|
26357
|
+
} catch (error) {
|
|
26358
|
+
if (!(error instanceof SnapshotValidationError) || error.code !== "invalidState" || !inMemoryRunSnapshots.has(snapshot)) throw error;
|
|
26359
|
+
snapshot = JSON.parse(serializeSafeJSSnapshot(snapshot));
|
|
26360
|
+
validateDumpEnvelope(snapshot);
|
|
26361
|
+
}
|
|
26336
26362
|
validateSnapshotMigration(snapshot.migration, snapshot.sourceHash, owner);
|
|
26337
26363
|
if (snapshot.executionSemantics !== EXECUTION_SEMANTICS && snapshot.executionSemantics !== "jobs-v6" && snapshot.executionSemantics !== "jobs-v7" && (snapshot.executionSemantics !== void 0 || snapshot.promiseReplay !== void 0 || snapshot.replay !== void 0 || snapshot.initialInputs !== void 0)) {
|
|
26338
26364
|
throw new SnapshotValidationError(
|
|
@@ -39004,7 +39030,7 @@ function run(source, options = {}) {
|
|
|
39004
39030
|
runResources.getStore().functionSourceText = executionSemantics === EXECUTION_SEMANTICS;
|
|
39005
39031
|
const convertInitialInput = (convert) => executionSemantics === "jobs-v6" ? convert() : promiseReplayContext.exit(convert);
|
|
39006
39032
|
if (restoredSnapshot !== void 0) {
|
|
39007
|
-
leaveSnapshotRun = enterSnapshotRun(restoredSnapshot);
|
|
39033
|
+
leaveSnapshotRun = enterSnapshotRun(options.snapshot ?? restoredSnapshot);
|
|
39008
39034
|
}
|
|
39009
39035
|
promiseReplay.attachBudget(budget);
|
|
39010
39036
|
const filename = options.filename ?? "<input>";
|
|
@@ -39430,7 +39456,7 @@ function createExecutableNode(module) {
|
|
|
39430
39456
|
};
|
|
39431
39457
|
}
|
|
39432
39458
|
function createRunSnapshot(input) {
|
|
39433
|
-
|
|
39459
|
+
const snapshot = {
|
|
39434
39460
|
version: DUMP_FORMAT_VERSION,
|
|
39435
39461
|
executionSemantics: input.executionSemantics,
|
|
39436
39462
|
sourceHash: input.sourceHash,
|
|
@@ -39450,6 +39476,8 @@ function createRunSnapshot(input) {
|
|
|
39450
39476
|
state: input.random.generator.snapshot()
|
|
39451
39477
|
}
|
|
39452
39478
|
};
|
|
39479
|
+
inMemoryRunSnapshots.add(snapshot);
|
|
39480
|
+
return snapshot;
|
|
39453
39481
|
}
|
|
39454
39482
|
function readHostCallSnapshot(snapshot) {
|
|
39455
39483
|
if (snapshot === void 0 || !Array.isArray(snapshot.hostCalls)) {
|
|
@@ -39547,4 +39575,4 @@ export {
|
|
|
39547
39575
|
FileSnapshotBackend,
|
|
39548
39576
|
run
|
|
39549
39577
|
};
|
|
39550
|
-
//# sourceMappingURL=chunk-
|
|
39578
|
+
//# sourceMappingURL=chunk-WHDYVYXQ.js.map
|