practice-golang / goja_nodejs

Nodejs compatibility library for Goja

Repository from Github https://github.compractice-golang/goja_nodejsRepository from Github https://github.compractice-golang/goja_nodejs

Fork for using sobek


Nodejs compatibility library for Sobek

This is a collection of Goja modules that provide nodejs compatibility.

Example:

package main

import (
    "github.com/grafana/sobek"
    "github.com/practice-golang/goja_nodejs/require"
)

func main() {
    registry := new(require.Registry) // this can be shared by multiple runtimes

    runtime := goja.New()
    req := registry.Enable(runtime)

    runtime.RunString(`
    var m = require("./m.js");
    m.test();
    `)

    m, err := req.Require("./m.js")
    _, _ = m, err
}

More modules will be added. Contributions welcome too.

About

Nodejs compatibility library for Goja

License:MIT License


Languages

Language:Go 98.0%Language:JavaScript 2.0%