@poe-platform/safe-js 0.1.17 → 0.1.19
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 +17 -1
- package/dist/safe-js/chunks/{chunk-Z3D76J4U.js → chunk-B7H4ZL65.js} +17065 -16803
- package/dist/safe-js/chunks/chunk-B7H4ZL65.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-ZYYMVUYU.js → chunk-GMDOPMVZ.js} +2 -2
- 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/interp/interpreter.d.ts +7 -1
- package/dist/safe-js/interp/patterns.d.ts +24 -0
- package/dist/safe-js/interp/values.d.ts +2 -0
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-Z3D76J4U.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-ZYYMVUYU.js.map → chunk-GMDOPMVZ.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-B7H4ZL65.js";
|
|
31
31
|
|
|
32
32
|
// packages/safe-js/src/migrate.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
|
@@ -8245,4 +8245,4 @@ export {
|
|
|
8245
8245
|
parseMcpConfig,
|
|
8246
8246
|
makeMcpModule
|
|
8247
8247
|
};
|
|
8248
|
-
//# sourceMappingURL=chunk-
|
|
8248
|
+
//# sourceMappingURL=chunk-GMDOPMVZ.js.map
|
package/dist/safe-js/cli.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveFsConfig,
|
|
23
23
|
splitFrontmatter,
|
|
24
24
|
withBrokenPipeGuard
|
|
25
|
-
} from "./chunks/chunk-
|
|
25
|
+
} from "./chunks/chunk-GMDOPMVZ.js";
|
|
26
26
|
import {
|
|
27
27
|
Budget,
|
|
28
28
|
SandboxError,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
replaceErrorStack,
|
|
35
35
|
restore,
|
|
36
36
|
run
|
|
37
|
-
} from "./chunks/chunk-
|
|
37
|
+
} from "./chunks/chunk-B7H4ZL65.js";
|
|
38
38
|
import "./chunks/chunk-4YIDX44G.js";
|
|
39
39
|
|
|
40
40
|
// packages/safe-js/src/cli.ts
|
package/dist/safe-js/core.js
CHANGED
package/dist/safe-js/index.js
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
runWithSpawnUsageAccumulator,
|
|
27
27
|
splitFrontmatter,
|
|
28
28
|
supportsSpawnMode
|
|
29
|
-
} from "./chunks/chunk-
|
|
29
|
+
} from "./chunks/chunk-GMDOPMVZ.js";
|
|
30
30
|
import {
|
|
31
31
|
Budget,
|
|
32
32
|
FileSnapshotBackend,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
registerPendingHostCallPolicy,
|
|
49
49
|
restore,
|
|
50
50
|
run
|
|
51
|
-
} from "./chunks/chunk-
|
|
51
|
+
} from "./chunks/chunk-B7H4ZL65.js";
|
|
52
52
|
import "./chunks/chunk-4YIDX44G.js";
|
|
53
53
|
|
|
54
54
|
// packages/safe-js/src/parse.ts
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ParseResult, SourceSpan } from "../parse.js";
|
|
2
|
-
import { type InterpreterYieldPoint } from "./async.js";
|
|
2
|
+
import { type AsyncEvaluationContext, type AsyncEvaluationResult, type InterpreterYieldPoint } from "./async.js";
|
|
3
3
|
import type { GeneratorCompletion } from "./generator.js";
|
|
4
4
|
import { Budget, type CompileOwner } from "./budget.js";
|
|
5
5
|
import { CompileScope } from "./regex/compile-guard.js";
|
|
6
|
+
import { type PatternContext } from "./patterns.js";
|
|
6
7
|
import { type SandboxValue } from "./values.js";
|
|
7
8
|
import { Scope } from "./scope.js";
|
|
8
9
|
export type InterpreterValue = SandboxValue;
|
|
@@ -59,5 +60,10 @@ export type InterpretOptions = {
|
|
|
59
60
|
};
|
|
60
61
|
snapshot?: InterpreterSnapshot;
|
|
61
62
|
};
|
|
63
|
+
type EvaluationContext = AsyncEvaluationContext;
|
|
64
|
+
type EvaluationResult = AsyncEvaluationResult;
|
|
62
65
|
export declare function interpret(node: ParseResult, options?: InterpretOptions): Promise<InterpreterResult>;
|
|
63
66
|
export { Scope } from "./scope.js";
|
|
67
|
+
declare function evaluateNode(node: ParseResult, context: EvaluationContext): Promise<EvaluationResult>;
|
|
68
|
+
export declare function createPatternContext(context: AsyncEvaluationContext, scope?: Scope, evaluate?: typeof evaluateNode): PatternContext;
|
|
69
|
+
export declare function setSandboxProperty(target: SandboxValue, property: string | number, value: SandboxValue, budget: Budget): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AssignmentPattern, MemberExpression, ParseResult, RestElement, VariableDeclarationKind, VariableDeclarator } from "../parse.js";
|
|
2
|
+
import type { AsyncEvaluationResult } from "./async.js";
|
|
3
|
+
import type { Scope } from "./scope.js";
|
|
4
|
+
import { type SandboxValue } from "./values.js";
|
|
5
|
+
type Pattern = VariableDeclarator["id"] | AssignmentPattern | MemberExpression | RestElement;
|
|
6
|
+
export type PatternTarget = {
|
|
7
|
+
kind: VariableDeclarationKind;
|
|
8
|
+
initialize?: true;
|
|
9
|
+
} | {
|
|
10
|
+
assign: true;
|
|
11
|
+
};
|
|
12
|
+
export type PatternContext = {
|
|
13
|
+
evaluate(node: ParseResult): Promise<AsyncEvaluationResult>;
|
|
14
|
+
getProperty(value: SandboxValue, key: string | number): SandboxValue;
|
|
15
|
+
setProperty(target: SandboxValue, key: string | number, value: SandboxValue): void;
|
|
16
|
+
};
|
|
17
|
+
export type BindPatternResult = {
|
|
18
|
+
ok: true;
|
|
19
|
+
} | {
|
|
20
|
+
ok: false;
|
|
21
|
+
result: AsyncEvaluationResult;
|
|
22
|
+
};
|
|
23
|
+
export declare function bindPattern(pattern: Pattern, value: SandboxValue, target: PatternTarget, scope: Scope, context: PatternContext): Promise<BindPatternResult>;
|
|
24
|
+
export {};
|
|
@@ -89,6 +89,7 @@ type CopyFromSandboxOptions = {
|
|
|
89
89
|
compilation?: CompileScope;
|
|
90
90
|
};
|
|
91
91
|
export declare function createSandboxClosure(input: {
|
|
92
|
+
guest?: boolean;
|
|
92
93
|
async?: boolean;
|
|
93
94
|
sandbox?: boolean;
|
|
94
95
|
boundTarget?: SandboxClosure;
|
|
@@ -100,6 +101,7 @@ export declare function createSandboxClosure(input: {
|
|
|
100
101
|
properties?: SandboxObject | ((closure: SandboxClosure) => SandboxObject);
|
|
101
102
|
retainedValues?: () => Iterable<SandboxValue>;
|
|
102
103
|
}): SandboxClosure;
|
|
104
|
+
export declare function ownEnumerableSandboxEntries(value: SandboxValue): Array<[string, SandboxValue]>;
|
|
103
105
|
export declare function createSandboxPromise(promise: Promise<SandboxValue>, metadata?: {
|
|
104
106
|
trackReplay?: boolean;
|
|
105
107
|
synchronousPrefix?: Promise<void>;
|
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.19",
|
|
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.19",
|
|
62
62
|
"yaml": "^2.8.2",
|
|
63
63
|
"jose": "^6.1.3",
|
|
64
64
|
"@types/node": "^25.2.2"
|