@hew-lang/sandbox-vm 0.6.2 → 0.6.3
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 +43 -4
- package/cli/test-runner.mjs +4 -1
- package/dist/interpreter/interpreter.d.ts +1 -1
- package/dist/interpreter/interpreter.js +1 -1
- package/dist/interpreter/parity-runner.js +1 -1
- package/dist/interpreter/run-program.d.ts +3 -2
- package/dist/interpreter/run-program.js +5 -3
- package/dist/interpreter/schema-validator.d.ts +9 -4
- package/dist/interpreter/schema-validator.js +15 -49
- package/dist/interpreter/types.d.ts +4 -0
- package/dist/interpreter/v1/browser-directory.d.ts +107 -0
- package/dist/interpreter/v1/browser-directory.js +288 -0
- package/dist/interpreter/v1/calendar.d.ts +4 -0
- package/dist/interpreter/v1/calendar.js +64 -0
- package/dist/interpreter/v1/codecs.js +2 -2
- package/dist/interpreter/v1/exec.d.ts +2 -2
- package/dist/interpreter/v1/exec.js +439 -183
- package/dist/interpreter/v1/instructions.generated.d.ts +1135 -0
- package/dist/interpreter/v1/instructions.generated.js +106 -0
- package/dist/interpreter/v1/package-graph.d.ts +2 -0
- package/dist/interpreter/v1/package-graph.js +729 -0
- package/dist/interpreter/v1/package-validator.generated.d.ts +3 -0
- package/dist/interpreter/v1/package-validator.generated.js +75902 -0
- package/dist/interpreter/v1/package.d.ts +5 -680
- package/dist/interpreter/v1/package.js +0 -12
- package/dist/interpreter/v1/scheduler.d.ts +5 -1
- package/dist/interpreter/v1/scheduler.js +32 -3
- package/dist/interpreter/v1/shims.d.ts +250 -7
- package/dist/interpreter/v1/shims.js +430 -150
- package/dist/interpreter/v1/structural.d.ts +2 -28
- package/dist/interpreter/v1/timestamp.d.ts +7 -0
- package/dist/interpreter/v1/timestamp.js +54 -0
- package/dist/interpreter/v1/validate.d.ts +8 -2
- package/dist/interpreter/v1/validate.js +190 -202
- package/dist/interpreter/v1/value-operations.d.ts +7 -2
- package/dist/interpreter/v1/value-operations.js +13 -6
- package/dist/interpreter/values.d.ts +4 -0
- package/dist/interpreter/values.js +6 -0
- package/dist/interpreter/worker.js +4 -3
- package/package.json +4 -4
|
@@ -29,6 +29,8 @@ export function cloneValue(value) {
|
|
|
29
29
|
throw new Error("cannot copy a released Weak");
|
|
30
30
|
value.cell.weak += 1;
|
|
31
31
|
return { kind: "weak", cell: value.cell, closed: false };
|
|
32
|
+
case "host_resource":
|
|
33
|
+
throw new Error("a filesystem owner cannot be copied");
|
|
32
34
|
case "timer":
|
|
33
35
|
throw new Error("a timer cancellation handle cannot be copied");
|
|
34
36
|
case "unit":
|
|
@@ -204,6 +206,8 @@ export function renderF64(value) {
|
|
|
204
206
|
}
|
|
205
207
|
export function renderStdout(value) {
|
|
206
208
|
switch (value.kind) {
|
|
209
|
+
case "host_resource":
|
|
210
|
+
return "FilesystemOwner";
|
|
207
211
|
case "timer":
|
|
208
212
|
return "Timer";
|
|
209
213
|
case "unit":
|
|
@@ -261,6 +265,8 @@ export function renderStdout(value) {
|
|
|
261
265
|
}
|
|
262
266
|
export function toJsonValue(value) {
|
|
263
267
|
switch (value.kind) {
|
|
268
|
+
case "host_resource":
|
|
269
|
+
return "FilesystemOwner";
|
|
264
270
|
case "timer":
|
|
265
271
|
return "Timer";
|
|
266
272
|
case "unit":
|
|
@@ -3,18 +3,19 @@ import { buildPlaygroundState } from "./playground.js";
|
|
|
3
3
|
import { runProgram } from "./run-program.js";
|
|
4
4
|
import { BytecodeValidationError } from "./schema-validator.js";
|
|
5
5
|
const worker = globalThis;
|
|
6
|
-
worker.addEventListener("message", (event) => {
|
|
6
|
+
worker.addEventListener("message", async (event) => {
|
|
7
7
|
const { id } = event.data;
|
|
8
8
|
try {
|
|
9
9
|
if (event.data.kind === "run") {
|
|
10
|
-
const result = runProgram(event.data.source, event.data.stdin);
|
|
10
|
+
const result = await runProgram(event.data.source, event.data.stdin, undefined, event.data.options);
|
|
11
11
|
worker.postMessage({ id, ok: true, result });
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
const { bytecode, options } = event.data;
|
|
15
|
-
const trace = runBytecode(bytecode, {
|
|
15
|
+
const trace = await runBytecode(bytecode, {
|
|
16
16
|
...options,
|
|
17
17
|
codecBridge: globalThis.__hewSandboxExecuteCodec,
|
|
18
|
+
calendarBridge: globalThis.__hewSandboxExecuteCalendar,
|
|
18
19
|
});
|
|
19
20
|
worker.postMessage({
|
|
20
21
|
id,
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hew-lang/sandbox-vm",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"hewSource": {
|
|
5
|
-
"commit": "
|
|
6
|
-
"tag": "v0.6.
|
|
5
|
+
"commit": "97c1d865aa46afca1c75cf8ef2c1ea0d7f232471",
|
|
6
|
+
"tag": "v0.6.3",
|
|
7
7
|
"dirty": false
|
|
8
8
|
},
|
|
9
9
|
"description": "Deterministic TypeScript interpreter for the Hew educational sandbox",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"cli/"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@hew-lang/wasm": "0.6.
|
|
24
|
+
"@hew-lang/wasm": "0.6.3"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [
|
|
27
27
|
"hew",
|