Versions in this module Expand all Collapse all v1 v1.0.0 Oct 10, 2022 Changes in this version + var IllegalModuleNameError = errors.New("Illegal module name") + var InvalidModuleError = errors.New("Invalid module") + var ModuleFileDoesNotExistError = errors.New("module file does not exist") + func DefaultSourceLoader(filename string) ([]byte, error) + func RegisterNativeModule(name string, loader ModuleLoader) + func Require(runtime *goja.Runtime, name string) goja.Value + type ModuleLoader func(*goja.Runtime, *goja.Object) + type Option func(*Registry) + func WithGlobalFolders(globalFolders ...string) Option + func WithLoader(srcLoader SourceLoader) Option + type Registry struct + func NewRegistry(opts ...Option) *Registry + func NewRegistryWithLoader(srcLoader SourceLoader) *Registry + func (r *Registry) Enable(runtime *goja.Runtime) *RequireModule + func (r *Registry) RegisterNativeModule(name string, loader ModuleLoader) + type RequireModule struct + func (r *RequireModule) Require(p string) (ret goja.Value, err error) + type SourceLoader func(path string) ([]byte, error)