Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func DefaultSourceLoader ¶
DefaultSourceLoader reads module files from the host filesystem.
func RegisterNativeModule ¶
func RegisterNativeModule(name string, loader ModuleLoader)
Types ¶
type Option ¶
type Option func(*Registry)
func WithGlobalFolders ¶
WithGlobalFolders appends paths searched for modules not found elsewhere.
func WithLoader ¶
func WithLoader(srcLoader SourceLoader) Option
WithLoader configures the source and external source-map loader used by require.
type Registry ¶
Registry contains a cache of compiled modules which can be shared by runtimes.
func NewRegistry ¶
func NewRegistryWithLoader ¶
func NewRegistryWithLoader(srcLoader SourceLoader) *Registry
func (*Registry) Enable ¶
func (r *Registry) Enable(runtime *js.Runtime) *RequireModule
Enable adds require() to runtime.
func (*Registry) RegisterNativeModule ¶
func (r *Registry) RegisterNativeModule(name string, loader ModuleLoader)
type RequireModule ¶
type RequireModule struct {
// contains filtered or unexported fields
}
type SourceLoader ¶
SourceLoader returns file data for a path. It must return ModuleFileDoesNotExistError when the path does not exist or is a directory.
Click to show internal directories.
Click to hide internal directories.