@poe-platform/safe-js 0.1.729 → 0.1.731
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/README.md +5 -5
- package/dist/safe-js/chunks/{chunk-SJZWSPWD.js → chunk-2GVBG23M.js} +1 -1
- package/dist/safe-js/chunks/{chunk-SJZWSPWD.js.map → chunk-2GVBG23M.js.map} +1 -1
- package/dist/safe-js/chunks/{chunk-VIMROAQA.js → chunk-E4XLBT7R.js} +2 -2
- package/dist/safe-js/chunks/chunk-F6CV74HU.js +114 -0
- package/dist/safe-js/chunks/chunk-F6CV74HU.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-OZLTLIHX.js → chunk-G6WTEIJJ.js} +2 -2
- package/dist/safe-js/chunks/{chunk-XX57YCGZ.js → chunk-GNEORAQI.js} +55 -50
- package/dist/safe-js/chunks/chunk-GNEORAQI.js.map +7 -0
- package/dist/safe-js/chunks/chunk-GVKXZW53.js +76 -0
- package/dist/safe-js/chunks/chunk-GVKXZW53.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-2S4YRXI6.js → chunk-IRDQDZ5R.js} +4 -4
- package/dist/safe-js/chunks/{chunk-MRULOD5J.js → chunk-K4T4EBED.js} +59 -38
- package/dist/safe-js/chunks/chunk-K4T4EBED.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-MFCEBCGV.js → chunk-KETIFEA7.js} +17 -8
- package/dist/safe-js/chunks/chunk-KETIFEA7.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-S5YDMMM3.js → chunk-MDIWQFYU.js} +95 -169
- package/dist/safe-js/chunks/{chunk-S5YDMMM3.js.map → chunk-MDIWQFYU.js.map} +4 -4
- package/dist/safe-js/chunks/{chunk-BRBOVGNC.js → chunk-MGHE7ZFI.js} +78 -67
- package/dist/safe-js/chunks/chunk-MGHE7ZFI.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-EN724VH3.js → chunk-O4IDRXW7.js} +4 -4
- package/dist/safe-js/chunks/{chunk-EA7AHM2X.js → chunk-PSVV3IG2.js} +3 -3
- package/dist/safe-js/chunks/{chunk-Y5EZYHU6.js → chunk-QKO4FATZ.js} +33 -5
- package/dist/safe-js/chunks/chunk-QKO4FATZ.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-EG3QWREA.js → chunk-RULU2F5J.js} +2 -2
- package/dist/safe-js/chunks/chunk-UQPYTZOZ.js +72 -0
- package/dist/safe-js/chunks/chunk-UQPYTZOZ.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-LRSWTDIV.js → chunk-W4SWUHCQ.js} +58 -23
- package/dist/safe-js/chunks/chunk-W4SWUHCQ.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-W3IY6FKO.js → chunk-WS2FJBH6.js} +2 -2
- package/dist/safe-js/chunks/{chunk-MVLDRXWS.js → chunk-X3CKAZQ4.js} +3 -3
- package/dist/safe-js/chunks/chunk-YUQFFRUF.js +26 -0
- package/dist/safe-js/chunks/chunk-YUQFFRUF.js.map +7 -0
- package/dist/safe-js/chunks/{cli-runtime-6VVBO2SS.js → cli-runtime-NUEFUM64.js} +51 -30
- package/dist/safe-js/chunks/cli-runtime-NUEFUM64.js.map +7 -0
- package/dist/safe-js/chunks/{dump-UNYK24YS.js → dump-RGRC3CG3.js} +5 -4
- package/dist/safe-js/chunks/harness-UMOMFXDT.js +11 -0
- package/dist/safe-js/chunks/mcp-S672263Q.js +12 -0
- package/dist/safe-js/chunks/migration-file-KRXQYI3Q.js +15 -0
- package/dist/safe-js/chunks/restore-GEO7VN2R.js +14 -0
- package/dist/safe-js/chunks/run-ZSFX66RN.js +20 -0
- package/dist/safe-js/chunks/runtime-modules-A3U2DKFL.js +11 -0
- package/dist/safe-js/chunks/source-files-L3SGK63Z.js +10 -0
- package/dist/safe-js/cli-runtime.d.ts +2 -0
- package/dist/safe-js/cli.js +4 -4
- package/dist/safe-js/core.d.ts +1 -0
- package/dist/safe-js/core.js +15 -8
- package/dist/safe-js/error/shape.js +170 -0
- package/dist/safe-js/index.js +42 -33
- package/dist/safe-js/index.js.map +2 -2
- package/dist/safe-js/interp/budget.js +600 -0
- package/dist/safe-js/interp/internal-symbols.js +1 -0
- package/dist/safe-js/interp/promise-replay.d.ts +1 -1
- package/dist/safe-js/interp/template-cache.js +7 -0
- package/dist/safe-js/migration-file.d.ts +2 -0
- package/dist/safe-js/modules/fs-config.d.ts +3 -1
- package/dist/safe-js/modules/fs.d.ts +8 -4
- package/dist/safe-js/modules/fs.js +16 -0
- package/dist/safe-js/modules/source-files.d.ts +3 -2
- package/dist/safe-js/platform/context.js +58 -0
- package/dist/safe-js/platform/node.js +64 -0
- package/dist/safe-js/platform/types.js +63 -0
- package/dist/safe-js/platform/workerd.js +39 -0
- package/dist/safe-js/runner/run-harness.d.ts +2 -0
- package/dist/safe-js/snapshot/backend.d.ts +2 -0
- package/package.json +9 -2
- package/dist/safe-js/chunks/chunk-BRBOVGNC.js.map +0 -7
- package/dist/safe-js/chunks/chunk-FCCA27RC.js +0 -69
- package/dist/safe-js/chunks/chunk-FCCA27RC.js.map +0 -7
- package/dist/safe-js/chunks/chunk-LRSWTDIV.js.map +0 -7
- package/dist/safe-js/chunks/chunk-MFCEBCGV.js.map +0 -7
- package/dist/safe-js/chunks/chunk-MRULOD5J.js.map +0 -7
- package/dist/safe-js/chunks/chunk-XX57YCGZ.js.map +0 -7
- package/dist/safe-js/chunks/chunk-Y5EZYHU6.js.map +0 -7
- package/dist/safe-js/chunks/cli-runtime-6VVBO2SS.js.map +0 -7
- package/dist/safe-js/chunks/fs-AOV77RQC.js +0 -13
- package/dist/safe-js/chunks/harness-ZIEO7NAV.js +0 -10
- package/dist/safe-js/chunks/mcp-WBM7ZOAN.js +0 -11
- package/dist/safe-js/chunks/migration-file-3SWGNDS2.js +0 -12
- package/dist/safe-js/chunks/restore-FCTWPLU3.js +0 -13
- package/dist/safe-js/chunks/run-ESJHEXCE.js +0 -17
- package/dist/safe-js/chunks/runtime-modules-7V6BWCRK.js +0 -10
- package/dist/safe-js/chunks/source-files-73OHLNGH.js +0 -8
- /package/dist/safe-js/chunks/{chunk-VIMROAQA.js.map → chunk-E4XLBT7R.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-OZLTLIHX.js.map → chunk-G6WTEIJJ.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-2S4YRXI6.js.map → chunk-IRDQDZ5R.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-EN724VH3.js.map → chunk-O4IDRXW7.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-EA7AHM2X.js.map → chunk-PSVV3IG2.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-EG3QWREA.js.map → chunk-RULU2F5J.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-W3IY6FKO.js.map → chunk-WS2FJBH6.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-MVLDRXWS.js.map → chunk-X3CKAZQ4.js.map} +0 -0
- /package/dist/safe-js/chunks/{dump-UNYK24YS.js.map → dump-RGRC3CG3.js.map} +0 -0
- /package/dist/safe-js/chunks/{fs-AOV77RQC.js.map → harness-UMOMFXDT.js.map} +0 -0
- /package/dist/safe-js/chunks/{harness-ZIEO7NAV.js.map → mcp-S672263Q.js.map} +0 -0
- /package/dist/safe-js/chunks/{mcp-WBM7ZOAN.js.map → migration-file-KRXQYI3Q.js.map} +0 -0
- /package/dist/safe-js/chunks/{migration-file-3SWGNDS2.js.map → restore-GEO7VN2R.js.map} +0 -0
- /package/dist/safe-js/chunks/{restore-FCTWPLU3.js.map → run-ZSFX66RN.js.map} +0 -0
- /package/dist/safe-js/chunks/{run-ESJHEXCE.js.map → runtime-modules-A3U2DKFL.js.map} +0 -0
- /package/dist/safe-js/chunks/{runtime-modules-7V6BWCRK.js.map → source-files-L3SGK63Z.js.map} +0 -0
- /package/dist/safe-js/{chunks/source-files-73OHLNGH.js.map → modules/fs.js.map} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FS_OPTION_SURFACE,
|
|
3
|
+
makeFsModule
|
|
4
|
+
} from "../chunks/chunk-K4T4EBED.js";
|
|
5
|
+
import "../chunks/chunk-GVKXZW53.js";
|
|
6
|
+
import "../chunks/chunk-2GVBG23M.js";
|
|
7
|
+
import "../chunks/chunk-MDIWQFYU.js";
|
|
8
|
+
import "../chunks/chunk-QKO4FATZ.js";
|
|
9
|
+
import "../chunks/chunk-YUQFFRUF.js";
|
|
10
|
+
import "../chunks/chunk-UQPYTZOZ.js";
|
|
11
|
+
import "../chunks/chunk-4YIDX44G.js";
|
|
12
|
+
export {
|
|
13
|
+
FS_OPTION_SURFACE,
|
|
14
|
+
makeFsModule
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=fs.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type FileSystem } from "@poe-platform/safe-fs/core";
|
|
1
2
|
import type { SourceResolver } from "./source-graph.js";
|
|
2
|
-
/** Explicit
|
|
3
|
-
export declare function createRootedSourceResolver(root: string): Promise<SourceResolver & {
|
|
3
|
+
/** Explicit filesystem grant. No package lookup, extension search, or URL loading. */
|
|
4
|
+
export declare function createRootedSourceResolver(root: string, adapter?: FileSystem): Promise<SourceResolver & {
|
|
4
5
|
entryId(filename?: string): Promise<string>;
|
|
5
6
|
}>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** Stack-scoped context for hosts without native asynchronous context support.
|
|
2
|
+
* Continuations scheduled by SafeJS capture and restore these stacks explicitly.
|
|
3
|
+
*/
|
|
4
|
+
export class StackContext {
|
|
5
|
+
static stores = new Set();
|
|
6
|
+
value;
|
|
7
|
+
generation = 0;
|
|
8
|
+
constructor() { StackContext.stores.add(new WeakRef(this)); }
|
|
9
|
+
getStore() { return this.value; }
|
|
10
|
+
run(value, callback) {
|
|
11
|
+
const previous = this.value;
|
|
12
|
+
const generation = this.generation;
|
|
13
|
+
this.value = value;
|
|
14
|
+
try {
|
|
15
|
+
return callback();
|
|
16
|
+
}
|
|
17
|
+
finally {
|
|
18
|
+
if (this.generation === generation)
|
|
19
|
+
this.value = previous;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exit(callback) {
|
|
23
|
+
const previous = this.value;
|
|
24
|
+
const generation = this.generation;
|
|
25
|
+
this.value = undefined;
|
|
26
|
+
try {
|
|
27
|
+
return callback();
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
if (this.generation === generation)
|
|
31
|
+
this.value = previous;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
disable() { this.value = undefined; this.generation++; }
|
|
35
|
+
static snapshot() {
|
|
36
|
+
const values = [];
|
|
37
|
+
for (const reference of StackContext.stores) {
|
|
38
|
+
const store = reference.deref();
|
|
39
|
+
if (store === undefined)
|
|
40
|
+
StackContext.stores.delete(reference);
|
|
41
|
+
else
|
|
42
|
+
values.push([store, store.value, store.generation]);
|
|
43
|
+
}
|
|
44
|
+
return callback => {
|
|
45
|
+
const restore = values.map(([store]) => store.value);
|
|
46
|
+
for (const [store, value, generation] of values)
|
|
47
|
+
if (store.generation === generation)
|
|
48
|
+
store.value = value;
|
|
49
|
+
try {
|
|
50
|
+
return callback();
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
values.forEach(([store, , generation], index) => { if (store.generation === generation)
|
|
54
|
+
store.value = restore[index]; });
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as nodeUtil from "node:util";
|
|
2
|
+
import * as nativeFsPromises from "node:fs/promises";
|
|
3
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
|
+
import { MessageChannel, MessagePort, receiveMessageOnPort } from "node:worker_threads";
|
|
5
|
+
const nativeClone = structuredClone;
|
|
6
|
+
const sharedByteLength = Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength").get;
|
|
7
|
+
const postMessage = MessagePort.prototype.postMessage;
|
|
8
|
+
const closePort = MessagePort.prototype.close;
|
|
9
|
+
// Probe private storage once: a broken native clone must never copy a guest's
|
|
10
|
+
// potentially large allocation before selecting the shared-wrapper fallback.
|
|
11
|
+
const probe = new SharedArrayBuffer(1);
|
|
12
|
+
let nativeSharesStorage = false;
|
|
13
|
+
try {
|
|
14
|
+
const copy = nativeClone(probe);
|
|
15
|
+
Reflect.apply(sharedByteLength, copy, []);
|
|
16
|
+
new Uint8Array(copy)[0] = 1;
|
|
17
|
+
nativeSharesStorage = copy !== probe && new Uint8Array(probe)[0] === 1;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// Some supported hosts do not implement shared-buffer structured cloning.
|
|
21
|
+
}
|
|
22
|
+
export const cloneSharedBufferWrapper = nativeSharesStorage
|
|
23
|
+
? nativeClone
|
|
24
|
+
: (value) => {
|
|
25
|
+
Reflect.apply(sharedByteLength, value, []);
|
|
26
|
+
const { port1, port2 } = new MessageChannel();
|
|
27
|
+
try {
|
|
28
|
+
Reflect.apply(postMessage, port1, [value]);
|
|
29
|
+
const copy = receiveMessageOnPort(port2)?.message;
|
|
30
|
+
Reflect.apply(sharedByteLength, copy, []);
|
|
31
|
+
if (copy === value)
|
|
32
|
+
throw new TypeError("Shared storage requires a distinct wrapper.");
|
|
33
|
+
return copy;
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
Reflect.apply(closePort, port1, []);
|
|
37
|
+
Reflect.apply(closePort, port2, []);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export function createHostCallbackContext() {
|
|
41
|
+
return new AsyncLocalStorage();
|
|
42
|
+
}
|
|
43
|
+
export const accessDeniedSystemError = readSystemError("EACCES");
|
|
44
|
+
function readSystemError(code) {
|
|
45
|
+
const fallback = new Map([
|
|
46
|
+
[process.platform === "win32" ? -4092 : -13, ["EACCES", "permission denied"]]
|
|
47
|
+
]);
|
|
48
|
+
const systemErrors = nodeUtil.getSystemErrorMap?.() ?? fallback;
|
|
49
|
+
for (const [errno, [name, message]] of systemErrors) {
|
|
50
|
+
if (name === code) {
|
|
51
|
+
return [errno, message];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
throw new Error(`node does not define the ${code} system error.`);
|
|
55
|
+
}
|
|
56
|
+
export { AsyncLocalStorage };
|
|
57
|
+
export const types = nodeUtil.types;
|
|
58
|
+
export { setImmediate as yieldToHost } from "node:timers/promises";
|
|
59
|
+
export { inspect } from "node:util";
|
|
60
|
+
export { formatWithOptions } from "node:util";
|
|
61
|
+
export { constants as fsConstants } from "node:fs";
|
|
62
|
+
export const hostFs = nativeFsPromises;
|
|
63
|
+
export const hostCwd = process.cwd.bind(process);
|
|
64
|
+
export const hostPlatform = process.platform;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Slot probes do not read user properties or Symbol.toStringTag.
|
|
2
|
+
function slot(method, value) {
|
|
3
|
+
if (typeof value !== "object" || value === null)
|
|
4
|
+
return false;
|
|
5
|
+
try {
|
|
6
|
+
Reflect.apply(method, value, []);
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const getter = (prototype, key) => Object.getOwnPropertyDescriptor(prototype, key).get;
|
|
14
|
+
const regexpPrototype = RegExp.prototype;
|
|
15
|
+
const regexpSource = getter(regexpPrototype, "source");
|
|
16
|
+
const booleanValue = Boolean.prototype.valueOf;
|
|
17
|
+
const numberValue = Number.prototype.valueOf;
|
|
18
|
+
const stringValue = String.prototype.valueOf;
|
|
19
|
+
const bigintValue = BigInt.prototype.valueOf;
|
|
20
|
+
const symbolValue = Symbol.prototype.valueOf;
|
|
21
|
+
const dateValue = Date.prototype.getTime;
|
|
22
|
+
const asyncFunctionPrototype = Object.getPrototypeOf(async function () { });
|
|
23
|
+
const generatorFunctionPrototype = Object.getPrototypeOf(function* () { });
|
|
24
|
+
const arrayBufferLength = getter(ArrayBuffer.prototype, "byteLength");
|
|
25
|
+
const dataViewBuffer = getter(DataView.prototype, "buffer");
|
|
26
|
+
const mapSize = getter(Map.prototype, "size");
|
|
27
|
+
const promiseThen = Promise.prototype.then;
|
|
28
|
+
const NativeError = Error;
|
|
29
|
+
const nativeIsError = Reflect.get(NativeError, "isError");
|
|
30
|
+
const proxies = new WeakSet();
|
|
31
|
+
export function createTrackedProxy(target, handler) {
|
|
32
|
+
const proxy = new Proxy(target, handler);
|
|
33
|
+
proxies.add(proxy);
|
|
34
|
+
return proxy;
|
|
35
|
+
}
|
|
36
|
+
export const types = {
|
|
37
|
+
isProxy: (value) => (typeof value === "object" && value !== null || typeof value === "function") && proxies.has(value),
|
|
38
|
+
isBooleanObject: (value) => typeof value === "object" && value !== null && slot(booleanValue, value),
|
|
39
|
+
isNumberObject: (value) => typeof value === "object" && value !== null && slot(numberValue, value),
|
|
40
|
+
isStringObject: (value) => typeof value === "object" && slot(stringValue, value),
|
|
41
|
+
isBigIntObject: (value) => typeof value === "object" && value !== null && slot(bigintValue, value),
|
|
42
|
+
isSymbolObject: (value) => typeof value === "object" && value !== null && slot(symbolValue, value),
|
|
43
|
+
isDate: (value) => slot(dateValue, value),
|
|
44
|
+
isRegExp: (value) => value !== regexpPrototype && slot(regexpSource, value),
|
|
45
|
+
isArrayBuffer: (value) => slot(arrayBufferLength, value),
|
|
46
|
+
isDataView: (value) => slot(dataViewBuffer, value),
|
|
47
|
+
isMap: (value) => slot(mapSize, value),
|
|
48
|
+
isPromise(value) {
|
|
49
|
+
// Promise has no exposed slot getter. Handle both branches so the probe
|
|
50
|
+
// cannot introduce an unhandled rejection.
|
|
51
|
+
try {
|
|
52
|
+
Reflect.apply(promiseThen, value, [() => undefined, () => undefined]);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
isAsyncFunction: (value) => typeof value === "function" && Object.getPrototypeOf(value) === asyncFunctionPrototype,
|
|
60
|
+
isGeneratorFunction: (value) => typeof value === "function" && Object.getPrototypeOf(value) === generatorFunctionPrototype,
|
|
61
|
+
isNativeError: (value) => typeof value === "object" && value !== null &&
|
|
62
|
+
(typeof nativeIsError === "function" ? Reflect.apply(nativeIsError, NativeError, [value]) === true : value instanceof NativeError)
|
|
63
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { StackContext } from "./context.js";
|
|
2
|
+
// Hosts may supply native asynchronous context without Node module resolution.
|
|
3
|
+
export const AsyncLocalStorage = Reflect.get(globalThis, "AsyncLocalStorage") ?? StackContext;
|
|
4
|
+
export { types } from "./types.js";
|
|
5
|
+
import { SandboxError } from "../interp/budget.js";
|
|
6
|
+
export const cloneSharedBufferWrapper = structuredClone;
|
|
7
|
+
export function createHostCallbackContext() {
|
|
8
|
+
let storage = new AsyncLocalStorage();
|
|
9
|
+
return {
|
|
10
|
+
run(value, callback) {
|
|
11
|
+
if (storage === undefined)
|
|
12
|
+
throw new SandboxError("reentry");
|
|
13
|
+
return storage.run(value, callback);
|
|
14
|
+
},
|
|
15
|
+
getStore() {
|
|
16
|
+
return storage?.getStore();
|
|
17
|
+
},
|
|
18
|
+
disable() {
|
|
19
|
+
// Workerd has no native disable. Retire access even in retained async contexts.
|
|
20
|
+
storage = undefined;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export const accessDeniedSystemError = [-13, "permission denied"];
|
|
25
|
+
export const yieldToHost = () => new Promise(resolve => setTimeout(resolve, 0));
|
|
26
|
+
export const hostCwd = () => "/";
|
|
27
|
+
export const hostPlatform = "workerd";
|
|
28
|
+
export const fsConstants = { F_OK: 0, R_OK: 4, W_OK: 2, X_OK: 1, COPYFILE_EXCL: 1 };
|
|
29
|
+
export const hostFs = new Proxy({}, {
|
|
30
|
+
get() { throw new TypeError("A filesystem adapter is required on this host."); }
|
|
31
|
+
});
|
|
32
|
+
// Diagnostics use data descriptors and never invoke a caller's toString.
|
|
33
|
+
export function inspect(value, _options) {
|
|
34
|
+
if (typeof value === "string")
|
|
35
|
+
return "'" + value.replaceAll("'", "\\'") + "'";
|
|
36
|
+
if (typeof value === "object" && value !== null)
|
|
37
|
+
return Array.isArray(value) ? "[Array]" : "[Object]";
|
|
38
|
+
return String(value);
|
|
39
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FileSystem } from "@poe-platform/safe-fs/core";
|
|
1
2
|
import { type Diagnostic } from "../lint.js";
|
|
2
3
|
import type { ModuleRegistry } from "../modules/registry.js";
|
|
3
4
|
import type { OtelSink } from "../observability/otel.js";
|
|
@@ -9,6 +10,7 @@ type HarnessMeta = {
|
|
|
9
10
|
version: unknown;
|
|
10
11
|
};
|
|
11
12
|
export type RunHarnessOptions = {
|
|
13
|
+
adapter?: FileSystem;
|
|
12
14
|
budget?: RunOptions["budget"];
|
|
13
15
|
modulesFor: (frontmatter: Record<string, unknown>, meta: HarnessMeta) => ModuleRegistry;
|
|
14
16
|
otelSink?: OtelSink;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FileSystem } from "@poe-platform/safe-fs/core";
|
|
1
2
|
import type { SafeJSSnapshot } from "../restore.js";
|
|
2
3
|
export type Snapshot = SafeJSSnapshot;
|
|
3
4
|
export interface SnapshotBackend {
|
|
@@ -6,6 +7,7 @@ export interface SnapshotBackend {
|
|
|
6
7
|
remove(): Promise<void>;
|
|
7
8
|
}
|
|
8
9
|
export type FileSnapshotBackendOptions = {
|
|
10
|
+
adapter?: FileSystem;
|
|
9
11
|
writeMaxAttempts?: number;
|
|
10
12
|
writeRetryDelayMs?: number;
|
|
11
13
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poe-platform/safe-js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.731",
|
|
4
4
|
"description": "Budgeted JavaScript interpreter with explicit host capabilities and resumable execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@poe-platform/safe-fs": "0.1.
|
|
61
|
+
"@poe-platform/safe-fs": "0.1.731",
|
|
62
62
|
"@petamoriken/float16": "^3.9.3",
|
|
63
63
|
"@noble/hashes": "2.4.0",
|
|
64
64
|
"@formatjs/intl-localematcher": "0.8.13",
|
|
@@ -70,6 +70,13 @@
|
|
|
70
70
|
"@formatjs/intl-numberformat": "9.4.0",
|
|
71
71
|
"@types/node": "^25.2.2"
|
|
72
72
|
},
|
|
73
|
+
"imports": {
|
|
74
|
+
"#safe-js-platform": {
|
|
75
|
+
"workerd": "./dist/safe-js/platform/workerd.js",
|
|
76
|
+
"browser": "./dist/safe-js/platform/workerd.js",
|
|
77
|
+
"default": "./dist/safe-js/platform/node.js"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
73
80
|
"bin": {
|
|
74
81
|
"poe-safejs": "./dist/safe-js/cli.js",
|
|
75
82
|
"poe-safe-js": "./dist/safe-js/cli.js"
|