(static-js was taken (So was js-engine))
A (work in progress) JavaScript interpreter built on the TC39 ECMAScript standard, implementing asyncronous / non-blocking execution, sandboxing, modern language features, and full debugging support.
A spiritual successor to static-eval.
Try it out in the sandbox!
This project is being ran against the Test262 test suite to ensure spec compliance. This is a work-in-progress, and full coverage has not yet been obtained.
Core engine and javascript evaluator
import { StaticJsRealm, createTimeSharingTaskRunner } from "@suntime-js/core";
let myModuleResolveAwait;
const realm = StaticJsRealm({
runTask: createTimeSharingTaskRunner({
yieldTime: 100,
operationsPerIteration: 1000,
maxRunTime: 60 * 1000
}),
global: {
properties: {
sayHello: {
value: () => console.log("Hello World");
},
registerCallback: {
value: (cb) => myModuleResolveAwait = cb;
}
}
},
modules: {
"my-module": `
const { promise, resolve } = Promise.withResolvers();
registerCallback(resolve);
await promise;
export const foo = 42;
`
}
});
const module = await realm.evaluateModule(`
import { foo } from "my-module";
export function addFoo(value) {
return value + foo;
}
`);
myModuleResolveAwait();
const addFoo = await module.getExportAsync("addFoo");
const result = await addFoo.callAsync(realm.types.undefined, realm.types.number(10));See the documentation or readme for more information.
A stepping debugger for @suntime-js/core, providing breakpoint support and stack inspection.
Provides a DAP (Debugger Adapter Protocol) adapter for visual studio code. Adapters for for both vscode (external process) and the web-based CodinGame/monaco-vscode-api are provided.