gojavm

package
v1.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package gojavm adapts zip's embedded JavaScript runtime (github.com/hanzoai/zip/runtime) to base's extruntime.Runtime SPI, so a manifest with `"runtime": "goja"` loads here. There is now exactly ONE goja engine in the Hanzo stack — zip's *runtime.JSRuntime — and base, cloud and every other zip consumer share it. gojavm is the thin extruntime projection of that engine: it owns manifest loading, TS/JSX/ESM bundling (esbuild, see transpile.go) and the JSON-bytes Invoke wire; the VM pool, host-fn registration and per-request VM isolation all live in zip/runtime.

This is the lightweight JS option — pure Go, no cgo, shares the host heap. Use it when you don't need a hard sandbox.

It sits alongside plugins/jsvm (the hook-style goja host for .base.js hook files). Extension directories with extension.json + runtime=goja go through here; hook files still go through jsvm. Collapsing jsvm onto zip/runtime as well is tracked separately — it needs base's host-API binds surface lifted into zip first.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRuntime

func NewRuntime() extruntime.Runtime

NewRuntime constructs a goja-backed extruntime.Runtime. The goja engine is zip's *runtime.JSRuntime; one process-wide pool is shared by every module this runtime loads. require()/console/process are provided by zip's VM provisioning, so migrated TypeScript backends that `require(...)`, `console.log(...)` or read `process.env` run unchanged.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL