Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Logger is the structured logger. If unset, logs are discarded.
Logger logr.Logger
// StdlibPaths overrides stdlib module discovery. When non-empty the VM
// searches only these directories (in order) for named require() calls.
// When empty, auto-discovery is used: DBSP_STDLIB env var → binary-relative
// → cwd-relative fallbacks.
StdlibPaths []string
}
Options configures a VM. Zero values are valid: a VM constructed with Options{} is equivalent to one built with NewVM(logr.Discard()).
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
func NewVM ¶
NewVM creates a VM with the given logger and otherwise default options. It is a thin shim around NewVMWithOptions kept for backward compatibility with existing callers.
func NewVMWithOptions ¶
NewVMWithOptions creates a VM configured by opts. Use this when callers need explicit logger control or future VM-wide options.
func (*VM) RunStdlibModule ¶
RunStdlibModule runs a named CommonJS module as a command. The module must export a function or a .main function; that function receives global argv.
func (*VM) RunString ¶
RunString runs JavaScript source directly and enters the runtime event loop. Callers that want immediate process exit should include an explicit exit() call in src.