@poe-platform/safe-js 0.1.799 → 0.1.800
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 +3 -1
- package/dist/safe-js/chunks/{chunk-ULPZIHB5.js → chunk-5RLD4TVI.js} +174 -127
- package/dist/safe-js/chunks/{chunk-TBZILU4U.js → chunk-7THYP46K.js} +1 -1
- package/dist/safe-js/chunks/{chunk-UU4T2KIT.js → chunk-CK3YK2EC.js} +1 -1
- package/dist/safe-js/chunks/{chunk-3O7HA6WT.js → chunk-F6Y734YA.js} +2 -2
- package/dist/safe-js/chunks/{chunk-OPYN6N5M.js → chunk-HPHCQNFV.js} +154 -1
- package/dist/safe-js/chunks/{chunk-W6C3Q6U4.js → chunk-LWHXSNF6.js} +2 -2
- package/dist/safe-js/chunks/{chunk-ZKLJW27N.js → chunk-PMOXSLM5.js} +1 -1
- package/dist/safe-js/chunks/{chunk-M6S3F3WM.js → chunk-QEDOBN2G.js} +4 -4
- package/dist/safe-js/chunks/chunk-QRWRR6IA.js +78 -0
- package/dist/safe-js/chunks/{chunk-MCFRB5X3.js → chunk-SHMRT4QX.js} +76 -6
- package/dist/safe-js/chunks/{chunk-KULEMOAE.js → chunk-XAV2RKLO.js} +3 -154
- package/dist/safe-js/chunks/{chunk-MDJ7MJYI.js → chunk-XOMGWE37.js} +2 -2
- package/dist/safe-js/chunks/{chunk-QTCPJ7FN.js → chunk-XV5OYKND.js} +1 -1
- package/dist/safe-js/chunks/{chunk-OTVZWRYE.js → chunk-YAHDXC7P.js} +1 -1
- package/dist/safe-js/chunks/{cli-runtime-DYXJZCGV.js → cli-runtime-OCWFX4TM.js} +15 -15
- package/dist/safe-js/chunks/{dump-XDJEF2LG.js → dump-KUPBSXSL.js} +2 -2
- package/dist/safe-js/chunks/{harness-32OOFC5A.js → harness-3DDUS3RY.js} +2 -2
- package/dist/safe-js/chunks/{mcp-PTCA53MN.js → mcp-4D3WWY7U.js} +3 -3
- package/dist/safe-js/chunks/{migration-file-EEGIOHQB.js → migration-file-4CYSJ6LO.js} +3 -3
- package/dist/safe-js/chunks/{restore-U3CCH36B.js → restore-GDHBT5ZD.js} +3 -3
- package/dist/safe-js/chunks/{run-Q74MU3QQ.js → run-3X6J7FPV.js} +5 -5
- package/dist/safe-js/chunks/{runtime-modules-SL5D6LAJ.js → runtime-modules-MGSXY4BN.js} +2 -2
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.d.ts +6 -0
- package/dist/safe-js/core.js +33 -7
- package/dist/safe-js/index.js +24 -93
- package/dist/safe-js/interp/data-copy.d.ts +3 -2
- package/dist/safe-js/interp/host-bridge.d.ts +5 -4
- package/dist/safe-js/modules/fs.js +2 -2
- package/dist/safe-js/node-unavailable.d.ts +1 -0
- package/dist/safe-js/portable/chunks/chunk-H5X3T5VP.js +909 -0
- package/dist/safe-js/portable/chunks/chunk-KYJVK33V.js +58698 -0
- package/dist/safe-js/portable/chunks/chunk-XCTU25SU.js +111 -0
- package/dist/safe-js/portable/chunks/source-files-CVU252FB.js +7 -0
- package/dist/safe-js/portable/core.js +14757 -0
- package/dist/safe-js/portable/modules/fs.js +9 -0
- package/dist/safe-js/snapshot/arguments.d.ts +2 -0
- package/dist/safe-js/snapshot/property-descriptors.d.ts +2 -0
- package/dist/safe-js/snapshot/regexp-properties.d.ts +2 -0
- package/dist/safe-js/snapshot/symbols.d.ts +2 -0
- package/dist/safe-js/workerd.d.ts +3 -0
- package/dist/safe-js/workerd.js +74425 -0
- package/package.json +30 -6
|
@@ -3,22 +3,22 @@ import {
|
|
|
3
3
|
extractBlock,
|
|
4
4
|
formatInterpreterError,
|
|
5
5
|
makeAgentModule,
|
|
6
|
-
makeEnvModule,
|
|
7
|
-
makeFailModule,
|
|
8
6
|
makeLogModule,
|
|
9
|
-
makeMetricModule,
|
|
10
7
|
maskSource,
|
|
11
|
-
parseEnvConfig,
|
|
12
8
|
parseFsConfig,
|
|
13
9
|
resolveFsConfig,
|
|
14
10
|
splitFrontmatter
|
|
15
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-XAV2RKLO.js";
|
|
16
12
|
import {
|
|
17
13
|
parseMcpConfig
|
|
18
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SHMRT4QX.js";
|
|
19
15
|
import {
|
|
20
|
-
lint
|
|
21
|
-
|
|
16
|
+
lint,
|
|
17
|
+
makeEnvModule,
|
|
18
|
+
makeFailModule,
|
|
19
|
+
makeMetricModule,
|
|
20
|
+
parseEnvConfig
|
|
21
|
+
} from "./chunk-HPHCQNFV.js";
|
|
22
22
|
import {
|
|
23
23
|
createBrokenPipeState,
|
|
24
24
|
createSafeOutputStream,
|
|
@@ -72,7 +72,7 @@ async function runCli(argv, options, usage) {
|
|
|
72
72
|
async () => {
|
|
73
73
|
try {
|
|
74
74
|
if (argv[0] === "migrate") {
|
|
75
|
-
const { migrateSnapshotFile } = await import("./migration-file-
|
|
75
|
+
const { migrateSnapshotFile } = await import("./migration-file-4CYSJ6LO.js");
|
|
76
76
|
const result = await migrateSnapshotFile({
|
|
77
77
|
...parseMigrationArgs(argv.slice(1)),
|
|
78
78
|
cwd: options.cwd ?? readCurrentWorkingDirectory(),
|
|
@@ -291,12 +291,12 @@ async function assertHarnessFile(input) {
|
|
|
291
291
|
}
|
|
292
292
|
async function runScriptFile(filepath, parsed, options) {
|
|
293
293
|
const [{ run }, { restore }, { dump, dumpCurrent }, { createLintModulesFromRuntimeRegistry }, { makeFsModule }, { makeMcpModule }] = await Promise.all([
|
|
294
|
-
import("./run-
|
|
295
|
-
import("./restore-
|
|
296
|
-
import("./dump-
|
|
297
|
-
import("./runtime-modules-
|
|
294
|
+
import("./run-3X6J7FPV.js"),
|
|
295
|
+
import("./restore-GDHBT5ZD.js"),
|
|
296
|
+
import("./dump-KUPBSXSL.js"),
|
|
297
|
+
import("./runtime-modules-MGSXY4BN.js"),
|
|
298
298
|
import("../modules/fs.js"),
|
|
299
|
-
import("./mcp-
|
|
299
|
+
import("./mcp-4D3WWY7U.js")
|
|
300
300
|
]);
|
|
301
301
|
const loaded = loadExecutableSource(filepath, await options.readFile(filepath, "utf8"));
|
|
302
302
|
const meta = {
|
|
@@ -534,7 +534,7 @@ async function createRuntime(frontmatter, meta, options) {
|
|
|
534
534
|
};
|
|
535
535
|
}
|
|
536
536
|
const [{ makeHarnessModule }, { makeFsModule }] = await Promise.all([
|
|
537
|
-
import("./harness-
|
|
537
|
+
import("./harness-3DDUS3RY.js"),
|
|
538
538
|
import("../modules/fs.js")
|
|
539
539
|
]);
|
|
540
540
|
const state = {
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
dump,
|
|
5
5
|
dumpCurrent,
|
|
6
6
|
serializeRunSnapshot
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-XV5OYKND.js";
|
|
8
|
+
import "./chunk-5RLD4TVI.js";
|
|
9
9
|
import "./chunk-A3LXCGMJ.js";
|
|
10
10
|
import "./chunk-JCHJGIQA.js";
|
|
11
11
|
import "./chunk-CQ52GEHY.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeMcpModule
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-LWHXSNF6.js";
|
|
4
|
+
import "./chunk-SHMRT4QX.js";
|
|
5
|
+
import "./chunk-5RLD4TVI.js";
|
|
6
6
|
import "./chunk-A3LXCGMJ.js";
|
|
7
7
|
import "./chunk-JCHJGIQA.js";
|
|
8
8
|
import "./chunk-CQ52GEHY.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
migrateSnapshotFile
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-F6Y734YA.js";
|
|
4
4
|
import "./chunk-DIG26TEI.js";
|
|
5
5
|
import "./chunk-ONWFPHUI.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-PMOXSLM5.js";
|
|
7
|
+
import "./chunk-5RLD4TVI.js";
|
|
8
8
|
import "./chunk-A3LXCGMJ.js";
|
|
9
9
|
import "./chunk-MMN3IESA.js";
|
|
10
10
|
import "./chunk-JCHJGIQA.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SnapshotMismatchError,
|
|
3
3
|
restore
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-XOMGWE37.js";
|
|
5
|
+
import "./chunk-PMOXSLM5.js";
|
|
6
|
+
import "./chunk-5RLD4TVI.js";
|
|
7
7
|
import "./chunk-A3LXCGMJ.js";
|
|
8
8
|
import "./chunk-JCHJGIQA.js";
|
|
9
9
|
import "./chunk-CQ52GEHY.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnhandledRejectionError,
|
|
3
3
|
run
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QEDOBN2G.js";
|
|
5
5
|
import "./chunk-DHGJSEFX.js";
|
|
6
6
|
import "./chunk-DIG26TEI.js";
|
|
7
7
|
import "./chunk-ONWFPHUI.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-XOMGWE37.js";
|
|
9
|
+
import "./chunk-PMOXSLM5.js";
|
|
10
|
+
import "./chunk-XV5OYKND.js";
|
|
11
|
+
import "./chunk-5RLD4TVI.js";
|
|
12
12
|
import "./chunk-A3LXCGMJ.js";
|
|
13
13
|
import "./chunk-MMN3IESA.js";
|
|
14
14
|
import "./chunk-JCHJGIQA.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLintModulesFromRuntimeRegistry
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-7THYP46K.js";
|
|
4
|
+
import "./chunk-5RLD4TVI.js";
|
|
5
5
|
import "./chunk-A3LXCGMJ.js";
|
|
6
6
|
import "./chunk-JCHJGIQA.js";
|
|
7
7
|
import "./chunk-CQ52GEHY.js";
|
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-OCWFX4TM.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-OCWFX4TM.js");
|
|
36
36
|
return exitCodeForError(error);
|
|
37
37
|
}
|
|
38
38
|
}
|
package/dist/safe-js/core.d.ts
CHANGED
|
@@ -12,3 +12,9 @@ export { Budget } from "./interp/budget.js";
|
|
|
12
12
|
export type { SnapshotValidationCode } from "./snapshot/validation.js";
|
|
13
13
|
export type { SourceResolver, SourceModule } from "./modules/source-graph.js";
|
|
14
14
|
export { createRootedSourceResolver } from "./modules/source-files.js";
|
|
15
|
+
export * from "./modules/env.js";
|
|
16
|
+
export * from "./modules/fail.js";
|
|
17
|
+
export * from "./modules/fs.js";
|
|
18
|
+
export * from "./modules/harness.js";
|
|
19
|
+
export * from "./modules/metric.js";
|
|
20
|
+
export * from "./modules/time.js";
|
package/dist/safe-js/core.js
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunks/chunk-
|
|
2
|
+
makeTimeModule
|
|
3
|
+
} from "./chunks/chunk-QRWRR6IA.js";
|
|
4
|
+
import {
|
|
5
|
+
makeHarnessModule
|
|
6
|
+
} from "./chunks/chunk-CK3YK2EC.js";
|
|
7
|
+
import {
|
|
8
|
+
EnvAccessError,
|
|
9
|
+
HarnessFailure,
|
|
10
|
+
lint,
|
|
11
|
+
makeEnvModule,
|
|
12
|
+
makeFailModule,
|
|
13
|
+
makeMetricModule,
|
|
14
|
+
parseEnvConfig
|
|
15
|
+
} from "./chunks/chunk-HPHCQNFV.js";
|
|
16
|
+
import {
|
|
17
|
+
FS_OPTION_SURFACE,
|
|
18
|
+
makeFsModule
|
|
19
|
+
} from "./chunks/chunk-YAHDXC7P.js";
|
|
4
20
|
import {
|
|
5
21
|
createRootedSourceResolver
|
|
6
22
|
} from "./chunks/chunk-3NFTBEZR.js";
|
|
@@ -8,17 +24,17 @@ import {
|
|
|
8
24
|
createRealm,
|
|
9
25
|
createReplayableRandom,
|
|
10
26
|
run
|
|
11
|
-
} from "./chunks/chunk-
|
|
27
|
+
} from "./chunks/chunk-QEDOBN2G.js";
|
|
12
28
|
import "./chunks/chunk-DHGJSEFX.js";
|
|
13
29
|
import "./chunks/chunk-DIG26TEI.js";
|
|
14
30
|
import "./chunks/chunk-ONWFPHUI.js";
|
|
15
|
-
import "./chunks/chunk-
|
|
16
|
-
import "./chunks/chunk-
|
|
17
|
-
import "./chunks/chunk-
|
|
31
|
+
import "./chunks/chunk-XOMGWE37.js";
|
|
32
|
+
import "./chunks/chunk-PMOXSLM5.js";
|
|
33
|
+
import "./chunks/chunk-XV5OYKND.js";
|
|
18
34
|
import {
|
|
19
35
|
admitNativePromiseProperties,
|
|
20
36
|
defineExtension
|
|
21
|
-
} from "./chunks/chunk-
|
|
37
|
+
} from "./chunks/chunk-5RLD4TVI.js";
|
|
22
38
|
import {
|
|
23
39
|
Budget
|
|
24
40
|
} from "./chunks/chunk-A3LXCGMJ.js";
|
|
@@ -27,11 +43,21 @@ import "./chunks/chunk-JCHJGIQA.js";
|
|
|
27
43
|
import "./chunks/chunk-CQ52GEHY.js";
|
|
28
44
|
export {
|
|
29
45
|
Budget,
|
|
46
|
+
EnvAccessError,
|
|
47
|
+
FS_OPTION_SURFACE,
|
|
48
|
+
HarnessFailure,
|
|
30
49
|
admitNativePromiseProperties,
|
|
31
50
|
createRealm,
|
|
32
51
|
createReplayableRandom,
|
|
33
52
|
createRootedSourceResolver,
|
|
34
53
|
defineExtension,
|
|
35
54
|
lint,
|
|
55
|
+
makeEnvModule,
|
|
56
|
+
makeFailModule,
|
|
57
|
+
makeFsModule,
|
|
58
|
+
makeHarnessModule,
|
|
59
|
+
makeMetricModule,
|
|
60
|
+
makeTimeModule,
|
|
61
|
+
parseEnvConfig,
|
|
36
62
|
run
|
|
37
63
|
};
|
package/dist/safe-js/index.js
CHANGED
|
@@ -2,47 +2,50 @@ import {
|
|
|
2
2
|
inspectSnapshotMigration,
|
|
3
3
|
migrateSnapshot,
|
|
4
4
|
migrateSnapshotFile
|
|
5
|
-
} from "./chunks/chunk-
|
|
5
|
+
} from "./chunks/chunk-F6Y734YA.js";
|
|
6
6
|
import {
|
|
7
7
|
createLintModulesFromRuntimeRegistry
|
|
8
|
-
} from "./chunks/chunk-
|
|
9
|
-
import {
|
|
10
|
-
makeHarnessModule
|
|
11
|
-
} from "./chunks/chunk-UU4T2KIT.js";
|
|
8
|
+
} from "./chunks/chunk-7THYP46K.js";
|
|
12
9
|
import {
|
|
13
10
|
makeMcpModule
|
|
14
|
-
} from "./chunks/chunk-
|
|
11
|
+
} from "./chunks/chunk-LWHXSNF6.js";
|
|
15
12
|
import {
|
|
16
13
|
AgentSpawnError,
|
|
17
|
-
EnvAccessError,
|
|
18
14
|
SPAWN_MODES,
|
|
19
15
|
countLineBreaks,
|
|
20
16
|
createSpawnUsageAccumulator,
|
|
21
17
|
extractBlock,
|
|
22
18
|
formatInterpreterError,
|
|
23
19
|
makeAgentModule,
|
|
24
|
-
makeEnvModule,
|
|
25
|
-
makeFailModule,
|
|
26
20
|
makeLogModule,
|
|
27
|
-
makeMetricModule,
|
|
28
21
|
maskSource,
|
|
29
|
-
parseEnvConfig,
|
|
30
22
|
parseFsConfig,
|
|
31
23
|
resolveFsConfig,
|
|
32
24
|
runWithSpawnUsageAccumulator,
|
|
33
25
|
splitFrontmatter,
|
|
34
26
|
supportsSpawnMode
|
|
35
|
-
} from "./chunks/chunk-
|
|
27
|
+
} from "./chunks/chunk-XAV2RKLO.js";
|
|
36
28
|
import {
|
|
37
29
|
parseMcpConfig
|
|
38
|
-
} from "./chunks/chunk-
|
|
30
|
+
} from "./chunks/chunk-SHMRT4QX.js";
|
|
31
|
+
import {
|
|
32
|
+
makeTimeModule
|
|
33
|
+
} from "./chunks/chunk-QRWRR6IA.js";
|
|
39
34
|
import {
|
|
40
|
-
|
|
41
|
-
} from "./chunks/chunk-
|
|
35
|
+
makeHarnessModule
|
|
36
|
+
} from "./chunks/chunk-CK3YK2EC.js";
|
|
37
|
+
import {
|
|
38
|
+
EnvAccessError,
|
|
39
|
+
lint,
|
|
40
|
+
makeEnvModule,
|
|
41
|
+
makeFailModule,
|
|
42
|
+
makeMetricModule,
|
|
43
|
+
parseEnvConfig
|
|
44
|
+
} from "./chunks/chunk-HPHCQNFV.js";
|
|
42
45
|
import "./chunks/chunk-X3YCE3ZH.js";
|
|
43
46
|
import {
|
|
44
47
|
makeFsModule
|
|
45
|
-
} from "./chunks/chunk-
|
|
48
|
+
} from "./chunks/chunk-YAHDXC7P.js";
|
|
46
49
|
import {
|
|
47
50
|
createRootedSourceResolver
|
|
48
51
|
} from "./chunks/chunk-3NFTBEZR.js";
|
|
@@ -51,7 +54,7 @@ import {
|
|
|
51
54
|
createRealm,
|
|
52
55
|
createReplayableRandom,
|
|
53
56
|
run
|
|
54
|
-
} from "./chunks/chunk-
|
|
57
|
+
} from "./chunks/chunk-QEDOBN2G.js";
|
|
55
58
|
import "./chunks/chunk-DHGJSEFX.js";
|
|
56
59
|
import {
|
|
57
60
|
fsCodec
|
|
@@ -61,23 +64,22 @@ import {
|
|
|
61
64
|
} from "./chunks/chunk-ONWFPHUI.js";
|
|
62
65
|
import {
|
|
63
66
|
restore
|
|
64
|
-
} from "./chunks/chunk-
|
|
65
|
-
import "./chunks/chunk-
|
|
67
|
+
} from "./chunks/chunk-XOMGWE37.js";
|
|
68
|
+
import "./chunks/chunk-PMOXSLM5.js";
|
|
66
69
|
import {
|
|
67
70
|
dump
|
|
68
|
-
} from "./chunks/chunk-
|
|
71
|
+
} from "./chunks/chunk-XV5OYKND.js";
|
|
69
72
|
import {
|
|
70
73
|
HostCallResumabilityError,
|
|
71
74
|
HostOperationResumePolicyError,
|
|
72
75
|
SnapshotValidationError,
|
|
73
76
|
admitNativePromiseProperties,
|
|
74
|
-
createSeededRandom,
|
|
75
77
|
declareHostOperation,
|
|
76
78
|
deepCopyFromSandbox,
|
|
77
79
|
deepCopyToSandbox,
|
|
78
80
|
defineExtension,
|
|
79
81
|
registerPendingHostCallPolicy
|
|
80
|
-
} from "./chunks/chunk-
|
|
82
|
+
} from "./chunks/chunk-5RLD4TVI.js";
|
|
81
83
|
import {
|
|
82
84
|
Budget,
|
|
83
85
|
SandboxError,
|
|
@@ -370,77 +372,6 @@ function findExportedConstInitializer(module, name) {
|
|
|
370
372
|
return void 0;
|
|
371
373
|
}
|
|
372
374
|
|
|
373
|
-
// packages/safe-js/src/modules/time.ts
|
|
374
|
-
function makeTimeModule(options = {}) {
|
|
375
|
-
const hasDeterministicRandom = options.random !== void 0 || options.seed !== void 0;
|
|
376
|
-
const random = options.random ?? (options.seed === void 0 ? () => Math.random() : createSeededRandom(options.seed).next);
|
|
377
|
-
const now = options.now ?? (() => Date.now());
|
|
378
|
-
const signal = options.signal;
|
|
379
|
-
async function sleep(ms) {
|
|
380
|
-
assertSleepDelay(ms);
|
|
381
|
-
return await new Promise((resolve, reject) => {
|
|
382
|
-
if (signal?.aborted === true) {
|
|
383
|
-
reject(createSleepAbortError());
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
const start = performance.now();
|
|
387
|
-
let timeout = setTimeout(resolveSleep, ms);
|
|
388
|
-
function cleanup() {
|
|
389
|
-
clearTimeout(timeout);
|
|
390
|
-
signal?.removeEventListener("abort", rejectSleep);
|
|
391
|
-
}
|
|
392
|
-
function resolveSleep() {
|
|
393
|
-
const remainingMs = ms - (performance.now() - start);
|
|
394
|
-
if (remainingMs > 0) {
|
|
395
|
-
timeout = setTimeout(resolveSleep, remainingMs);
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
cleanup();
|
|
399
|
-
resolve();
|
|
400
|
-
}
|
|
401
|
-
function rejectSleep() {
|
|
402
|
-
cleanup();
|
|
403
|
-
reject(createSleepAbortError());
|
|
404
|
-
}
|
|
405
|
-
signal?.addEventListener("abort", rejectSleep, { once: true });
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
return {
|
|
409
|
-
random,
|
|
410
|
-
now,
|
|
411
|
-
sleep,
|
|
412
|
-
uuid: hasDeterministicRandom ? () => createRandomUuid(random) : () => globalThis.crypto.randomUUID()
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
function createRandomUuid(random) {
|
|
416
|
-
const bytes = Array.from({ length: 16 }, () => Math.floor(readRandomUnit(random()) * 256));
|
|
417
|
-
bytes[6] = bytes[6] & 15 | 64;
|
|
418
|
-
bytes[8] = bytes[8] & 63 | 128;
|
|
419
|
-
const hex = bytes.map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
420
|
-
return [
|
|
421
|
-
hex.slice(0, 8),
|
|
422
|
-
hex.slice(8, 12),
|
|
423
|
-
hex.slice(12, 16),
|
|
424
|
-
hex.slice(16, 20),
|
|
425
|
-
hex.slice(20)
|
|
426
|
-
].join("-");
|
|
427
|
-
}
|
|
428
|
-
function readRandomUnit(value) {
|
|
429
|
-
if (Number.isFinite(value) && value >= 0 && value < 1) {
|
|
430
|
-
return value;
|
|
431
|
-
}
|
|
432
|
-
throw new RangeError("time.uuid() random source must return a number in [0, 1).");
|
|
433
|
-
}
|
|
434
|
-
function assertSleepDelay(ms) {
|
|
435
|
-
if (Number.isFinite(ms) && ms >= 0) {
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
438
|
-
throw new RangeError("time.sleep(ms) requires a non-negative finite millisecond delay.");
|
|
439
|
-
}
|
|
440
|
-
function createSleepAbortError() {
|
|
441
|
-
return new Error("time.sleep aborted.");
|
|
442
|
-
}
|
|
443
|
-
|
|
444
375
|
// packages/safe-js/src/index.ts
|
|
445
376
|
var parseModule2 = parseModule;
|
|
446
377
|
var parseSourceModule2 = parseSourceModule;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export type DataCopyOperation<T> = Generator<DataCopyOperation<T>,
|
|
2
|
-
export declare function
|
|
1
|
+
export type DataCopyOperation<T, Result = T> = Generator<DataCopyOperation<T>, Result, T>;
|
|
2
|
+
export declare function dataCopyIterable<T, Result>(operation: DataCopyOperation<T, Result>): Iterable<DataCopyOperation<T>, Result, T>;
|
|
3
|
+
export declare function runDataCopy<T, Result = T>(operation: DataCopyOperation<T, Result>): Result;
|
|
@@ -49,11 +49,12 @@ export declare function wrapHostConstructor(name: string, construct: CallerInjec
|
|
|
49
49
|
hasInstance?: CallerInjectedFunction;
|
|
50
50
|
constants: Record<string, number>;
|
|
51
51
|
}): SandboxClosure;
|
|
52
|
-
|
|
53
|
-
errorData?: boolean;
|
|
54
|
-
}, state: {
|
|
52
|
+
type HostCopyState = {
|
|
55
53
|
seen: WeakMap<object, SandboxValue>;
|
|
56
54
|
float32Buffers?: WeakMap<ArrayBufferLike, ArrayBufferLike>;
|
|
57
55
|
promiseIdentities?: WeakMap<object, SandboxValue>;
|
|
58
|
-
}
|
|
56
|
+
};
|
|
57
|
+
export declare function copyHostValueToSandbox(value: unknown, stackFrames: readonly string[], options: HostBridgeOptions & {
|
|
58
|
+
errorData?: boolean;
|
|
59
|
+
}, state: HostCopyState, path: string): SandboxValue;
|
|
59
60
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FS_OPTION_SURFACE,
|
|
3
3
|
makeFsModule
|
|
4
|
-
} from "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-YAHDXC7P.js";
|
|
5
5
|
import "../chunks/chunk-DIG26TEI.js";
|
|
6
6
|
import "../chunks/chunk-ONWFPHUI.js";
|
|
7
|
-
import "../chunks/chunk-
|
|
7
|
+
import "../chunks/chunk-5RLD4TVI.js";
|
|
8
8
|
import "../chunks/chunk-A3LXCGMJ.js";
|
|
9
9
|
import "../chunks/chunk-MMN3IESA.js";
|
|
10
10
|
import "../chunks/chunk-JCHJGIQA.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|