Documentation
¶
Overview ¶
Package jsruleset prepares local JavaScript rulesets for vacuum's rule engine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Prepared ¶
type Prepared struct {
// contains filtered or unexported fields
}
Prepared owns immutable compiled code and normalized rule data. It is safe to share across documents; each execution must open its own Scope.
func Prepare ¶
Prepare compiles a local module graph without installing packages or loading remote code. Initialization and export inspection have a five-second limit.
func PrepareWithReader ¶
func PrepareWithReader(ctx context.Context, entry string, readFile func(string) ([]byte, error)) (*Prepared, error)
PrepareWithReader compiles modules using the supplied reader for every captured file.
func (*Prepared) Data ¶
Data returns the normalized declarative ruleset, with stable callable handles.
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope owns one module instance and serializes JavaScript calls for a document. Close cancels pending work and waits for the VM owner before releasing it.
func (*Scope) Close ¶
func (s *Scope) Close()
Close stops work owned by this scope. It is safe to call more than once.
func (*Scope) Functions ¶
func (s *Scope) Functions() map[string]model.RuleFunction
Functions returns adapters bound to this document scope.
func (*Scope) MatchFormats ¶
MatchFormats evaluates callable predicates against the original document once.
func (*Scope) SetNativeFunctions ¶
func (s *Scope) SetNativeFunctions(functions map[string]model.RuleFunction)
SetNativeFunctions binds existing engine functions before document execution.