UTTORI ASM ยท IN DEVELOPMENT
Host lifecycle
Integrate host lifecycle through supported Uttori ASM APIs.
import { Assembler } from "@uttori/asm-core";
import { NodePluginLoader } from "@uttori/asm-plugin-loader-node";
const loader = new NodePluginLoader();
try {
const loaded = await loader.loadProjectEnvironment({ cwd: process.cwd() });
const session = new Assembler({
environment: loaded.environment,
target: loaded.target,
architecture: loaded.architecture,
targetOptions: loaded.targetOptions,
});
try {
session.setIncludePaths([...loaded.includePaths]);
session.assembleSource("org $008000\nsei", "main.asm"); // Requires a configured 65816 target.
const bytes = Uint8Array.from(session.getBinaryOutput());
console.log(bytes);
} finally {
session.dispose();
}
} finally {
await loader.dispose();
}
For in-memory plugins, create a PluginManager, await activatePlugins, then call freeze().
activateModules accepts already-imported module namespaces. It does not import paths itself.
Dispose the manager in finally, including when activation or freezing fails.
One environment can serve multiple independent sessions. Each session owns its mutable runtime. The host owns the manager/loader and file provider. Finish and dispose sessions before replacing or disposing their environment. Calls on a manager or loader must be serialized. Assembler operations are synchronous and must not be re-entered from plugin callbacks.