Package-level declarations
Types
A module compiled to JVM bytecode by swc4j. Exported functions live on defaultClass as static methods; JIM looks them up (and caches a MethodHandle) when a trigger needs to call one.
The execution engine a module runs on (see JimManifest.engine).
A raw GraalJS guest function. JavaScript tolerates arity mismatches (extra args ignored, missing ones become undefined), so every provided arg is passed through as-is. Must be called on the JS thread (the GraalJS org.graalvm.polyglot.Context is single-threaded) — which is where dispatch already runs.
A module evaluated as an ES module by GraalJS. Its top-level code already ran on load (so top-level Jim.register(...) calls are live); namespace is the module's export namespace, from which named exported functions (for the main/init entry and trigger-name conventions) are read.
The GraalJS execution engine — the "real JavaScript" path. A JIM module's TypeScript is first transpiled to JavaScript by swc4j (here used as a plain TS→JS transpiler, not its bytecode compiler) and then evaluated as an ES module on a GraalJS Context. Scripts get full ECMAScript: real arrays with .map/.filter, closures over reassigned lets, objects, JSON, etc. — none of the bytecode path's "half-Java" workarounds (Store/Num/Args).
A JVM-side callable invoked through a MethodHandle, padded/truncated to paramCount.
A script callback, normalized so the engine can invoke it the same way regardless of which engine produced it:
Compiles a JIM script (TypeScript / modern JS) straight to JVM bytecode using swc4j's ByteCodeCompiler. Scripts run as native JVM classes — every export function becomes a static method on the default $ class, and scripts reach the JIM API by importing our Kotlin objects by package, e.g. import { Jim, Event } from 'ratph6.jim.api'.
The heart of JIM. Compiles each module's TypeScript to JVM bytecode (via JimCompiler), invokes its main() entry point, and dispatches triggers by invoking the named exported function through a cached MethodHandle. No V8, no JNI on the dispatch path.
A compiled, loaded module. Engine-agnostic surface: its manifest/dir, the names of its exported functions, and a uniform JimCallback for any one of them. Two implementations:
Bridge between the entity-render mixin and the engine. Called on the render thread (which is the JS thread), once before and once after each entity model is submitted, with the live PoseStack.
EntityRenderState so JIM can recover the live Entity behind a render state.