js

package module
v0.0.0-...-c46e5f6 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 48 Imported by: 0

README

dbsp JavaScript Runtime

js/ contains the dbsp JavaScript runtime and CLI.

Build it from this directory with:

make build

Documentation lives in /doc/:

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

func NewVM(logger logr.Logger) (*VM, error)

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

func NewVMWithOptions(opts Options) (*VM, error)

NewVMWithOptions creates a VM configured by opts. Use this when callers need explicit logger control or future VM-wide options.

func (*VM) Close

func (v *VM) Close()

func (*VM) RunFile

func (v *VM) RunFile(path string) error

func (*VM) RunStdlibModule

func (v *VM) RunStdlibModule(name string) error

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

func (v *VM) RunString(src string) error

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.

func (*VM) SetProcessArgv

func (v *VM) SetProcessArgv(argv []string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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