@poe-platform/safe-js 0.1.583 → 0.1.584
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-YUMLRCTH.js → chunk-4DPRV34R.js} +2 -2
- package/dist/safe-js/chunks/{chunk-4WKBTY6W.js → chunk-63JRSQOL.js} +3 -3
- package/dist/safe-js/chunks/{chunk-QNAVME3B.js → chunk-7PX7MOB4.js} +6 -6
- package/dist/safe-js/chunks/{chunk-7IEVHJ7R.js → chunk-AMO5WXVQ.js} +4 -4
- package/dist/safe-js/chunks/{chunk-ZEN6IY6M.js → chunk-AMY5ETO5.js} +4 -4
- package/dist/safe-js/chunks/{chunk-P3M3BXHT.js → chunk-EAHOLZQ2.js} +3 -3
- package/dist/safe-js/chunks/{chunk-27YAKAEE.js → chunk-EUQCKN74.js} +3 -3
- package/dist/safe-js/chunks/{chunk-CGIQDK6Z.js → chunk-F6K7WXYP.js} +2 -2
- package/dist/safe-js/chunks/{chunk-XM6DQK7C.js → chunk-J23VJ4EG.js} +2 -2
- package/dist/safe-js/chunks/{chunk-HUD3ISAJ.js → chunk-OMSG6GZF.js} +57 -12
- package/dist/safe-js/chunks/chunk-OMSG6GZF.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-3YD5RZJH.js → chunk-PTB5KJXJ.js} +2 -2
- package/dist/safe-js/chunks/{chunk-FRTUNUVH.js → chunk-Q2PTRBJS.js} +2 -2
- package/dist/safe-js/chunks/{chunk-HENSQ4YT.js → chunk-XXUVGE2L.js} +2 -2
- package/dist/safe-js/chunks/{cli-runtime-R4XQ76EV.js → cli-runtime-PRCR2J63.js} +13 -13
- package/dist/safe-js/chunks/{dump-7N6NYNQE.js → dump-SGDGD32M.js} +4 -4
- package/dist/safe-js/chunks/{fs-DJXSKCFB.js → fs-LOAD43QB.js} +4 -4
- package/dist/safe-js/chunks/harness-PYDC7ICR.js +10 -0
- package/dist/safe-js/chunks/mcp-SL5B3WKQ.js +11 -0
- package/dist/safe-js/chunks/migration-file-RIMCERFB.js +12 -0
- package/dist/safe-js/chunks/restore-CJSMB4QO.js +13 -0
- package/dist/safe-js/chunks/run-ZTGDITEC.js +17 -0
- package/dist/safe-js/chunks/runtime-modules-M5XUCL6O.js +10 -0
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +7 -7
- package/dist/safe-js/index.js +13 -13
- package/dist/safe-js/workerd.js +56 -11
- package/dist/safe-js/workerd.js.map +2 -2
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-HUD3ISAJ.js.map +0 -7
- package/dist/safe-js/chunks/harness-I47WMMSB.js +0 -10
- package/dist/safe-js/chunks/mcp-43SITYLO.js +0 -11
- package/dist/safe-js/chunks/migration-file-TKW2VXE5.js +0 -12
- package/dist/safe-js/chunks/restore-ITFWVMAU.js +0 -13
- package/dist/safe-js/chunks/run-P3JBDBSD.js +0 -17
- package/dist/safe-js/chunks/runtime-modules-AAL3MW44.js +0 -10
- /package/dist/safe-js/chunks/{chunk-YUMLRCTH.js.map → chunk-4DPRV34R.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-4WKBTY6W.js.map → chunk-63JRSQOL.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-QNAVME3B.js.map → chunk-7PX7MOB4.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-7IEVHJ7R.js.map → chunk-AMO5WXVQ.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-ZEN6IY6M.js.map → chunk-AMY5ETO5.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-P3M3BXHT.js.map → chunk-EAHOLZQ2.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-27YAKAEE.js.map → chunk-EUQCKN74.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-CGIQDK6Z.js.map → chunk-F6K7WXYP.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-XM6DQK7C.js.map → chunk-J23VJ4EG.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-3YD5RZJH.js.map → chunk-PTB5KJXJ.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-FRTUNUVH.js.map → chunk-Q2PTRBJS.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-HENSQ4YT.js.map → chunk-XXUVGE2L.js.map} +0 -0
- /package/dist/safe-js/chunks/{cli-runtime-R4XQ76EV.js.map → cli-runtime-PRCR2J63.js.map} +0 -0
- /package/dist/safe-js/chunks/{dump-7N6NYNQE.js.map → dump-SGDGD32M.js.map} +0 -0
- /package/dist/safe-js/chunks/{fs-DJXSKCFB.js.map → fs-LOAD43QB.js.map} +0 -0
- /package/dist/safe-js/chunks/{harness-I47WMMSB.js.map → harness-PYDC7ICR.js.map} +0 -0
- /package/dist/safe-js/chunks/{mcp-43SITYLO.js.map → mcp-SL5B3WKQ.js.map} +0 -0
- /package/dist/safe-js/chunks/{migration-file-TKW2VXE5.js.map → migration-file-RIMCERFB.js.map} +0 -0
- /package/dist/safe-js/chunks/{restore-ITFWVMAU.js.map → restore-CJSMB4QO.js.map} +0 -0
- /package/dist/safe-js/chunks/{run-P3JBDBSD.js.map → run-ZTGDITEC.js.map} +0 -0
- /package/dist/safe-js/chunks/{runtime-modules-AAL3MW44.js.map → runtime-modules-M5XUCL6O.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isSandboxClosure
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4DPRV34R.js";
|
|
4
4
|
|
|
5
5
|
// packages/safe-js/src/lint/runtime-modules.ts
|
|
6
6
|
var AsyncFunction = (async () => void 0).constructor;
|
|
@@ -34,4 +34,4 @@ function isAsyncRuntimeExport(value) {
|
|
|
34
34
|
export {
|
|
35
35
|
createLintModulesFromRuntimeRegistry
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
37
|
+
//# sourceMappingURL=chunk-PTB5KJXJ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
deepCopyToSandbox
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4DPRV34R.js";
|
|
4
4
|
|
|
5
5
|
// packages/safe-js/src/modules/harness.ts
|
|
6
6
|
function makeHarnessModule(frontmatter, meta) {
|
|
@@ -52,4 +52,4 @@ ${prompt}`;
|
|
|
52
52
|
export {
|
|
53
53
|
makeHarnessModule
|
|
54
54
|
};
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
55
|
+
//# sourceMappingURL=chunk-Q2PTRBJS.js.map
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
safeEndSpan,
|
|
14
14
|
safeRecordException,
|
|
15
15
|
safeStartSpan
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-OMSG6GZF.js";
|
|
17
17
|
|
|
18
18
|
// packages/safe-js/src/error/format.ts
|
|
19
19
|
var DEFAULT_MAX_MESSAGE_LENGTH = 1e4;
|
|
@@ -2842,4 +2842,4 @@ export {
|
|
|
2842
2842
|
makeLogModule,
|
|
2843
2843
|
makeMetricModule
|
|
2844
2844
|
};
|
|
2845
|
-
//# sourceMappingURL=chunk-
|
|
2845
|
+
//# sourceMappingURL=chunk-XXUVGE2L.js.map
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
parseFsConfig,
|
|
13
13
|
resolveFsConfig,
|
|
14
14
|
splitFrontmatter
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-XXUVGE2L.js";
|
|
16
16
|
import {
|
|
17
17
|
parseMcpConfig
|
|
18
18
|
} from "./chunk-HMJGGU6F.js";
|
|
19
19
|
import {
|
|
20
20
|
lint
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-J23VJ4EG.js";
|
|
22
22
|
import {
|
|
23
23
|
createBrokenPipeState,
|
|
24
24
|
createSafeOutputStream,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
SandboxError,
|
|
33
33
|
parseModule,
|
|
34
34
|
replaceErrorStack
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-OMSG6GZF.js";
|
|
36
36
|
import "./chunk-4YIDX44G.js";
|
|
37
37
|
|
|
38
38
|
// packages/safe-js/src/cli-runtime.ts
|
|
@@ -53,7 +53,7 @@ async function runCli(argv, options, usage) {
|
|
|
53
53
|
async () => {
|
|
54
54
|
try {
|
|
55
55
|
if (argv[0] === "migrate") {
|
|
56
|
-
const { migrateSnapshotFile } = await import("./migration-file-
|
|
56
|
+
const { migrateSnapshotFile } = await import("./migration-file-RIMCERFB.js");
|
|
57
57
|
const result = await migrateSnapshotFile({
|
|
58
58
|
...parseMigrationArgs(argv.slice(1)),
|
|
59
59
|
cwd: options.cwd ?? readCurrentWorkingDirectory()
|
|
@@ -258,12 +258,12 @@ async function assertHarnessFile(input) {
|
|
|
258
258
|
}
|
|
259
259
|
async function runScriptFile(filepath, parsed, options) {
|
|
260
260
|
const [{ run }, { restore }, { dump, dumpCurrent }, { createLintModulesFromRuntimeRegistry }, { makeFsModule }, { makeMcpModule }] = await Promise.all([
|
|
261
|
-
import("./run-
|
|
262
|
-
import("./restore-
|
|
263
|
-
import("./dump-
|
|
264
|
-
import("./runtime-modules-
|
|
265
|
-
import("./fs-
|
|
266
|
-
import("./mcp-
|
|
261
|
+
import("./run-ZTGDITEC.js"),
|
|
262
|
+
import("./restore-CJSMB4QO.js"),
|
|
263
|
+
import("./dump-SGDGD32M.js"),
|
|
264
|
+
import("./runtime-modules-M5XUCL6O.js"),
|
|
265
|
+
import("./fs-LOAD43QB.js"),
|
|
266
|
+
import("./mcp-SL5B3WKQ.js")
|
|
267
267
|
]);
|
|
268
268
|
const loaded = loadExecutableSource(filepath, await options.readFile(filepath, "utf8"));
|
|
269
269
|
const meta = {
|
|
@@ -491,8 +491,8 @@ async function createRuntime(frontmatter, meta, options) {
|
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
493
|
const [{ makeHarnessModule }, { makeFsModule }] = await Promise.all([
|
|
494
|
-
import("./harness-
|
|
495
|
-
import("./fs-
|
|
494
|
+
import("./harness-PYDC7ICR.js"),
|
|
495
|
+
import("./fs-LOAD43QB.js")
|
|
496
496
|
]);
|
|
497
497
|
const state = {
|
|
498
498
|
metricCalls: /* @__PURE__ */ new Map(),
|
|
@@ -682,4 +682,4 @@ export {
|
|
|
682
682
|
exitCodeForError,
|
|
683
683
|
runCli
|
|
684
684
|
};
|
|
685
|
-
//# sourceMappingURL=cli-runtime-
|
|
685
|
+
//# sourceMappingURL=cli-runtime-PRCR2J63.js.map
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
dump,
|
|
5
5
|
dumpCurrent,
|
|
6
6
|
serializeRunSnapshot
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-EAHOLZQ2.js";
|
|
8
|
+
import "./chunk-4DPRV34R.js";
|
|
9
|
+
import "./chunk-OMSG6GZF.js";
|
|
10
10
|
import "./chunk-4YIDX44G.js";
|
|
11
11
|
export {
|
|
12
12
|
attachDumpController,
|
|
@@ -15,4 +15,4 @@ export {
|
|
|
15
15
|
dumpCurrent,
|
|
16
16
|
serializeRunSnapshot
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=dump-
|
|
18
|
+
//# sourceMappingURL=dump-SGDGD32M.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FS_OPTION_SURFACE,
|
|
3
3
|
makeFsModule
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-F6K7WXYP.js";
|
|
5
5
|
import "./chunk-BRFJ7BKN.js";
|
|
6
6
|
import "./chunk-SJZWSPWD.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-4DPRV34R.js";
|
|
8
|
+
import "./chunk-OMSG6GZF.js";
|
|
9
9
|
import "./chunk-4YIDX44G.js";
|
|
10
10
|
export {
|
|
11
11
|
FS_OPTION_SURFACE,
|
|
12
12
|
makeFsModule
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=fs-
|
|
14
|
+
//# sourceMappingURL=fs-LOAD43QB.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
makeMcpModule
|
|
3
|
+
} from "./chunk-EUQCKN74.js";
|
|
4
|
+
import "./chunk-HMJGGU6F.js";
|
|
5
|
+
import "./chunk-4DPRV34R.js";
|
|
6
|
+
import "./chunk-OMSG6GZF.js";
|
|
7
|
+
import "./chunk-4YIDX44G.js";
|
|
8
|
+
export {
|
|
9
|
+
makeMcpModule
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=mcp-SL5B3WKQ.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
migrateSnapshotFile
|
|
3
|
+
} from "./chunk-AMO5WXVQ.js";
|
|
4
|
+
import "./chunk-SJZWSPWD.js";
|
|
5
|
+
import "./chunk-63JRSQOL.js";
|
|
6
|
+
import "./chunk-4DPRV34R.js";
|
|
7
|
+
import "./chunk-OMSG6GZF.js";
|
|
8
|
+
import "./chunk-4YIDX44G.js";
|
|
9
|
+
export {
|
|
10
|
+
migrateSnapshotFile
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=migration-file-RIMCERFB.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SnapshotMismatchError,
|
|
3
|
+
restore
|
|
4
|
+
} from "./chunk-AMY5ETO5.js";
|
|
5
|
+
import "./chunk-63JRSQOL.js";
|
|
6
|
+
import "./chunk-4DPRV34R.js";
|
|
7
|
+
import "./chunk-OMSG6GZF.js";
|
|
8
|
+
import "./chunk-4YIDX44G.js";
|
|
9
|
+
export {
|
|
10
|
+
SnapshotMismatchError,
|
|
11
|
+
restore
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=restore-CJSMB4QO.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
UnhandledRejectionError,
|
|
3
|
+
run
|
|
4
|
+
} from "./chunk-7PX7MOB4.js";
|
|
5
|
+
import "./chunk-BRFJ7BKN.js";
|
|
6
|
+
import "./chunk-AMY5ETO5.js";
|
|
7
|
+
import "./chunk-EAHOLZQ2.js";
|
|
8
|
+
import "./chunk-SJZWSPWD.js";
|
|
9
|
+
import "./chunk-63JRSQOL.js";
|
|
10
|
+
import "./chunk-4DPRV34R.js";
|
|
11
|
+
import "./chunk-OMSG6GZF.js";
|
|
12
|
+
import "./chunk-4YIDX44G.js";
|
|
13
|
+
export {
|
|
14
|
+
UnhandledRejectionError,
|
|
15
|
+
run
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=run-ZTGDITEC.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createLintModulesFromRuntimeRegistry
|
|
3
|
+
} from "./chunk-PTB5KJXJ.js";
|
|
4
|
+
import "./chunk-4DPRV34R.js";
|
|
5
|
+
import "./chunk-OMSG6GZF.js";
|
|
6
|
+
import "./chunk-4YIDX44G.js";
|
|
7
|
+
export {
|
|
8
|
+
createLintModulesFromRuntimeRegistry
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=runtime-modules-M5XUCL6O.js.map
|
package/dist/safe-js/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import path from "node:path";
|
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
14
14
|
async function runCli(argv, options = {}) {
|
|
15
15
|
if (!argv.includes("--help") && !argv.includes("-h")) {
|
|
16
|
-
const runtime = await import("./chunks/cli-runtime-
|
|
16
|
+
const runtime = await import("./chunks/cli-runtime-PRCR2J63.js");
|
|
17
17
|
return runtime.runCli(argv, options, createUsage());
|
|
18
18
|
}
|
|
19
19
|
const brokenPipe = createBrokenPipeState();
|
|
@@ -32,7 +32,7 @@ async function runCli(argv, options = {}) {
|
|
|
32
32
|
stderr.write(`${error instanceof Error ? error.message : String(error)}
|
|
33
33
|
`);
|
|
34
34
|
if (brokenPipe.closed) return 0;
|
|
35
|
-
const { exitCodeForError } = await import("./chunks/cli-runtime-
|
|
35
|
+
const { exitCodeForError } = await import("./chunks/cli-runtime-PRCR2J63.js");
|
|
36
36
|
return exitCodeForError(error);
|
|
37
37
|
}
|
|
38
38
|
}
|
package/dist/safe-js/core.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
lint
|
|
3
|
-
} from "./chunks/chunk-
|
|
3
|
+
} from "./chunks/chunk-J23VJ4EG.js";
|
|
4
4
|
import {
|
|
5
5
|
createRealm,
|
|
6
6
|
createReplayableRandom,
|
|
7
7
|
run
|
|
8
|
-
} from "./chunks/chunk-
|
|
8
|
+
} from "./chunks/chunk-7PX7MOB4.js";
|
|
9
9
|
import "./chunks/chunk-BRFJ7BKN.js";
|
|
10
|
-
import "./chunks/chunk-
|
|
11
|
-
import "./chunks/chunk-
|
|
10
|
+
import "./chunks/chunk-AMY5ETO5.js";
|
|
11
|
+
import "./chunks/chunk-EAHOLZQ2.js";
|
|
12
12
|
import "./chunks/chunk-SJZWSPWD.js";
|
|
13
|
-
import "./chunks/chunk-
|
|
13
|
+
import "./chunks/chunk-63JRSQOL.js";
|
|
14
14
|
import {
|
|
15
15
|
admitNativePromiseProperties,
|
|
16
16
|
defineExtension
|
|
17
|
-
} from "./chunks/chunk-
|
|
17
|
+
} from "./chunks/chunk-4DPRV34R.js";
|
|
18
18
|
import {
|
|
19
19
|
Budget
|
|
20
|
-
} from "./chunks/chunk-
|
|
20
|
+
} from "./chunks/chunk-OMSG6GZF.js";
|
|
21
21
|
import "./chunks/chunk-4YIDX44G.js";
|
|
22
22
|
export {
|
|
23
23
|
Budget,
|
package/dist/safe-js/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeFsModule
|
|
3
|
-
} from "./chunks/chunk-
|
|
3
|
+
} from "./chunks/chunk-F6K7WXYP.js";
|
|
4
4
|
import {
|
|
5
5
|
makeHarnessModule
|
|
6
|
-
} from "./chunks/chunk-
|
|
6
|
+
} from "./chunks/chunk-Q2PTRBJS.js";
|
|
7
7
|
import {
|
|
8
8
|
makeMcpModule
|
|
9
|
-
} from "./chunks/chunk-
|
|
9
|
+
} from "./chunks/chunk-EUQCKN74.js";
|
|
10
10
|
import {
|
|
11
11
|
AgentSpawnError,
|
|
12
12
|
EnvAccessError,
|
|
@@ -27,39 +27,39 @@ import {
|
|
|
27
27
|
runWithSpawnUsageAccumulator,
|
|
28
28
|
splitFrontmatter,
|
|
29
29
|
supportsSpawnMode
|
|
30
|
-
} from "./chunks/chunk-
|
|
30
|
+
} from "./chunks/chunk-XXUVGE2L.js";
|
|
31
31
|
import {
|
|
32
32
|
parseMcpConfig
|
|
33
33
|
} from "./chunks/chunk-HMJGGU6F.js";
|
|
34
34
|
import {
|
|
35
35
|
lint
|
|
36
|
-
} from "./chunks/chunk-
|
|
36
|
+
} from "./chunks/chunk-J23VJ4EG.js";
|
|
37
37
|
import "./chunks/chunk-OZLTLIHX.js";
|
|
38
38
|
import {
|
|
39
39
|
FileSnapshotBackend,
|
|
40
40
|
createRealm,
|
|
41
41
|
createReplayableRandom,
|
|
42
42
|
run
|
|
43
|
-
} from "./chunks/chunk-
|
|
43
|
+
} from "./chunks/chunk-7PX7MOB4.js";
|
|
44
44
|
import "./chunks/chunk-BRFJ7BKN.js";
|
|
45
45
|
import {
|
|
46
46
|
restore
|
|
47
|
-
} from "./chunks/chunk-
|
|
47
|
+
} from "./chunks/chunk-AMY5ETO5.js";
|
|
48
48
|
import {
|
|
49
49
|
dump
|
|
50
|
-
} from "./chunks/chunk-
|
|
50
|
+
} from "./chunks/chunk-EAHOLZQ2.js";
|
|
51
51
|
import {
|
|
52
52
|
inspectSnapshotMigration,
|
|
53
53
|
migrateSnapshot,
|
|
54
54
|
migrateSnapshotFile
|
|
55
|
-
} from "./chunks/chunk-
|
|
55
|
+
} from "./chunks/chunk-AMO5WXVQ.js";
|
|
56
56
|
import {
|
|
57
57
|
hasOwnErrorCode
|
|
58
58
|
} from "./chunks/chunk-SJZWSPWD.js";
|
|
59
|
-
import "./chunks/chunk-
|
|
59
|
+
import "./chunks/chunk-63JRSQOL.js";
|
|
60
60
|
import {
|
|
61
61
|
createLintModulesFromRuntimeRegistry
|
|
62
|
-
} from "./chunks/chunk-
|
|
62
|
+
} from "./chunks/chunk-PTB5KJXJ.js";
|
|
63
63
|
import {
|
|
64
64
|
HostCallResumabilityError,
|
|
65
65
|
HostOperationResumePolicyError,
|
|
@@ -71,14 +71,14 @@ import {
|
|
|
71
71
|
deepCopyToSandbox,
|
|
72
72
|
defineExtension,
|
|
73
73
|
registerPendingHostCallPolicy
|
|
74
|
-
} from "./chunks/chunk-
|
|
74
|
+
} from "./chunks/chunk-4DPRV34R.js";
|
|
75
75
|
import {
|
|
76
76
|
Budget,
|
|
77
77
|
SandboxError,
|
|
78
78
|
noopOtelSink,
|
|
79
79
|
parse,
|
|
80
80
|
parseModule
|
|
81
|
-
} from "./chunks/chunk-
|
|
81
|
+
} from "./chunks/chunk-OMSG6GZF.js";
|
|
82
82
|
import "./chunks/chunk-4YIDX44G.js";
|
|
83
83
|
|
|
84
84
|
// packages/safe-js/src/parse.ts
|
package/dist/safe-js/workerd.js
CHANGED
|
@@ -4536,7 +4536,7 @@ var Lexer = class {
|
|
|
4536
4536
|
line = 1;
|
|
4537
4537
|
column = 1;
|
|
4538
4538
|
tokens = [];
|
|
4539
|
-
|
|
4539
|
+
groupingState = { stack: [], classHeads: [], tokenCount: 0 };
|
|
4540
4540
|
lastClosedStatementBoundary = false;
|
|
4541
4541
|
legacyStringEscape = false;
|
|
4542
4542
|
lineHasToken = false;
|
|
@@ -4709,7 +4709,7 @@ var Lexer = class {
|
|
|
4709
4709
|
skipTemplateExpression(start) {
|
|
4710
4710
|
let depth = 1;
|
|
4711
4711
|
const tokens = [];
|
|
4712
|
-
const
|
|
4712
|
+
const groupingState = { stack: [], classHeads: [], tokenCount: 0 };
|
|
4713
4713
|
let lastClosedStatementBoundary = false;
|
|
4714
4714
|
while (!this.isAtEnd() && depth > 0) {
|
|
4715
4715
|
this.skipTrivia();
|
|
@@ -4779,8 +4779,9 @@ var Lexer = class {
|
|
|
4779
4779
|
if (char === "{") {
|
|
4780
4780
|
depth += 1;
|
|
4781
4781
|
this.advance();
|
|
4782
|
-
|
|
4782
|
+
const previousToken = tokens[tokens.length - 1];
|
|
4783
4783
|
tokens.push({ type: "punctuator", value: "{" });
|
|
4784
|
+
updateGroupingState(groupingState, previousToken, "{", lastClosedStatementBoundary, false, tokens);
|
|
4784
4785
|
lastClosedStatementBoundary = false;
|
|
4785
4786
|
continue;
|
|
4786
4787
|
}
|
|
@@ -4790,8 +4791,9 @@ var Lexer = class {
|
|
|
4790
4791
|
if (depth === 0) {
|
|
4791
4792
|
return;
|
|
4792
4793
|
}
|
|
4793
|
-
|
|
4794
|
+
const previousToken = tokens[tokens.length - 1];
|
|
4794
4795
|
tokens.push({ type: "punctuator", value: "}" });
|
|
4796
|
+
lastClosedStatementBoundary = updateGroupingState(groupingState, previousToken, "}", lastClosedStatementBoundary, false, tokens);
|
|
4795
4797
|
continue;
|
|
4796
4798
|
}
|
|
4797
4799
|
if (char === "/" && shouldRejectRegexLiteral(tokens[tokens.length - 1], lastClosedStatementBoundary, tokens)) {
|
|
@@ -4810,12 +4812,12 @@ var Lexer = class {
|
|
|
4810
4812
|
this.advanceBy(punctuator.length);
|
|
4811
4813
|
tokens.push({ type: "punctuator", value: punctuator });
|
|
4812
4814
|
lastClosedStatementBoundary = updateGroupingState(
|
|
4813
|
-
|
|
4815
|
+
groupingState,
|
|
4814
4816
|
previousToken,
|
|
4815
4817
|
punctuator,
|
|
4816
4818
|
lastClosedStatementBoundary,
|
|
4817
4819
|
false,
|
|
4818
|
-
tokens
|
|
4820
|
+
tokens
|
|
4819
4821
|
);
|
|
4820
4822
|
continue;
|
|
4821
4823
|
}
|
|
@@ -5174,12 +5176,12 @@ var Lexer = class {
|
|
|
5174
5176
|
this.tokens.push(token);
|
|
5175
5177
|
if (type === "punctuator") {
|
|
5176
5178
|
this.lastClosedStatementBoundary = updateGroupingState(
|
|
5177
|
-
this.
|
|
5179
|
+
this.groupingState,
|
|
5178
5180
|
previousToken,
|
|
5179
5181
|
value,
|
|
5180
5182
|
this.lastClosedStatementBoundary,
|
|
5181
5183
|
this.options.statementList === true,
|
|
5182
|
-
this.tokens
|
|
5184
|
+
this.tokens
|
|
5183
5185
|
);
|
|
5184
5186
|
return;
|
|
5185
5187
|
}
|
|
@@ -5430,11 +5432,39 @@ function endsWithForOfSeparator(tokens) {
|
|
|
5430
5432
|
}
|
|
5431
5433
|
return false;
|
|
5432
5434
|
}
|
|
5433
|
-
function updateGroupingState(
|
|
5435
|
+
function updateGroupingState(state, previousToken, punctuator, previousStatementBoundary, initialStatementList, tokens) {
|
|
5436
|
+
const groupingStack = state.stack;
|
|
5437
|
+
const functionBody = state.functionBody;
|
|
5438
|
+
state.functionBody = false;
|
|
5439
|
+
for (let index = state.tokenCount; index < tokens.length; index++) {
|
|
5440
|
+
const token = tokens[index];
|
|
5441
|
+
if (token.type !== "keyword" || token.value !== "class") continue;
|
|
5442
|
+
const before = tokens[index - 1];
|
|
5443
|
+
if (before?.value === "." || before?.value === "?.") continue;
|
|
5444
|
+
const next = tokens[index + 1]?.value;
|
|
5445
|
+
const afterName = tokens[index + 2]?.value;
|
|
5446
|
+
if (next !== "{" && next !== "extends" && afterName !== "{" && afterName !== "extends") continue;
|
|
5447
|
+
const parent = groupingStack[groupingStack.length - 1];
|
|
5448
|
+
if (parent?.classBody && (before === void 0 || ["{", "}", ";", "static"].includes(before.value) || ["identifier", "numeric", "string", "template", "regex"].includes(before.type))) continue;
|
|
5449
|
+
state.classHeads.push({
|
|
5450
|
+
depth: groupingStack.length,
|
|
5451
|
+
declaration: isDeclarationPosition(tokens, index, groupingStack, initialStatementList)
|
|
5452
|
+
});
|
|
5453
|
+
}
|
|
5454
|
+
state.tokenCount = tokens.length;
|
|
5455
|
+
const beforePreviousToken = tokens[tokens.length - 3];
|
|
5434
5456
|
if (punctuator === "(") {
|
|
5457
|
+
let functionIndex = tokens.length - 2;
|
|
5458
|
+
if (tokens[functionIndex]?.value !== "function") {
|
|
5459
|
+
if (tokens[functionIndex]?.value !== "*") functionIndex--;
|
|
5460
|
+
if (tokens[functionIndex]?.value === "*") functionIndex--;
|
|
5461
|
+
}
|
|
5462
|
+
const functionParameters = tokens[functionIndex]?.type === "keyword" && tokens[functionIndex].value === "function";
|
|
5463
|
+
const functionDeclaration = functionParameters && isDeclarationPosition(tokens, functionIndex, groupingStack, initialStatementList);
|
|
5435
5464
|
groupingStack.push({
|
|
5436
5465
|
value: "(",
|
|
5437
|
-
|
|
5466
|
+
functionParameters,
|
|
5467
|
+
isControlCondition: functionDeclaration || (previousToken?.type === "keyword" || previousToken?.type === "identifier") && (CONTROL_FLOW_PAREN_KEYWORDS.has(previousToken.value) || previousToken.value === "await" && beforePreviousToken?.type === "keyword" && beforePreviousToken.value === "for") && beforePreviousToken?.value !== "." && beforePreviousToken?.value !== "?."
|
|
5438
5468
|
});
|
|
5439
5469
|
return false;
|
|
5440
5470
|
}
|
|
@@ -5443,6 +5473,12 @@ function updateGroupingState(groupingStack, previousToken, punctuator, previousS
|
|
|
5443
5473
|
return false;
|
|
5444
5474
|
}
|
|
5445
5475
|
if (punctuator === "{") {
|
|
5476
|
+
const classHead = state.classHeads[state.classHeads.length - 1];
|
|
5477
|
+
if (!functionBody && previousToken?.value !== "=>" && classHead?.depth === groupingStack.length) {
|
|
5478
|
+
state.classHeads.pop();
|
|
5479
|
+
groupingStack.push({ value: "{", classBody: true, closesStatement: classHead.declaration });
|
|
5480
|
+
return false;
|
|
5481
|
+
}
|
|
5446
5482
|
const parent = groupingStack[groupingStack.length - 1];
|
|
5447
5483
|
const closesStatement = previousToken === void 0 ? initialStatementList : previousStatementBoundary || ["{", ";"].includes(previousToken.value) && (parent === void 0 || parent.statementList === true) || previousToken.type === "keyword" && ["else", "do", "try", "finally"].includes(previousToken.value);
|
|
5448
5484
|
groupingStack.push({
|
|
@@ -5453,7 +5489,9 @@ function updateGroupingState(groupingStack, previousToken, punctuator, previousS
|
|
|
5453
5489
|
return false;
|
|
5454
5490
|
}
|
|
5455
5491
|
if (punctuator === ")") {
|
|
5456
|
-
|
|
5492
|
+
const group = popGroupingContext(groupingStack, "(");
|
|
5493
|
+
state.functionBody = group?.functionParameters === true;
|
|
5494
|
+
return group?.isControlCondition === true;
|
|
5457
5495
|
}
|
|
5458
5496
|
if (punctuator === "]") {
|
|
5459
5497
|
popGroupingContext(groupingStack, "[");
|
|
@@ -5464,6 +5502,13 @@ function updateGroupingState(groupingStack, previousToken, punctuator, previousS
|
|
|
5464
5502
|
}
|
|
5465
5503
|
return false;
|
|
5466
5504
|
}
|
|
5505
|
+
function isDeclarationPosition(tokens, index, groupingStack, initialStatementList) {
|
|
5506
|
+
const parent = groupingStack[groupingStack.length - 1];
|
|
5507
|
+
if (parent === void 0 ? !initialStatementList : parent.statementList !== true) return false;
|
|
5508
|
+
if (tokens[index - 1]?.value === "async") index--;
|
|
5509
|
+
const previous = tokens[index - 1];
|
|
5510
|
+
return previous === void 0 || ["{", "}", ";", ")", "]", "export", "default"].includes(previous.value) || ["identifier", "numeric", "string", "template", "regex"].includes(previous.type) || previous.type === "keyword" && EXPRESSION_ENDING_KEYWORDS.has(previous.value);
|
|
5511
|
+
}
|
|
5467
5512
|
function popGroupingContext(groupingStack, expected) {
|
|
5468
5513
|
const top = groupingStack[groupingStack.length - 1];
|
|
5469
5514
|
if (top?.value !== expected) {
|