MCPcopy Create free account
hub / github.com/buke/quickjs-go / CompileModule

Method CompileModule

context.go:1043–1046  ·  view source on GitHub ↗

CompileModule returns a compiled bytecode with given code and module name.

(filePath string, moduleName string, opts ...EvalOption)

Source from the content-addressed store, hash-verified

1041
1042// CompileModule returns a compiled bytecode with given code and module name.
1043func (ctx *Context) CompileModule(filePath string, moduleName string, opts ...EvalOption) ([]byte, error) {
1044 opts = append(opts, EvalFileName(moduleName))
1045 return ctx.CompileFile(filePath, opts...)
1046}
1047
1048// LoadModuleBytecode returns a js value from the given bytecode.
1049// Only load bytecode produced by a trusted source. QuickJS bytecode is not a

Callers 1

TestContextModulesFunction · 0.95

Calls 2

CompileFileMethod · 0.95
EvalFileNameFunction · 0.85

Tested by 1

TestContextModulesFunction · 0.76