1
0
Fork 0
Find a file
Daniel Baumann e3142e4b5e
Adding debian version 0.0~git20250409.f7acab6-1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-05-22 11:58:48 +02:00
.github Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
buffer Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
console Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
debian Adding debian version 0.0~git20250409.f7acab6-1. 2025-05-22 11:58:48 +02:00
errors Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
eventloop Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
global-types Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
goutil Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
process Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
require Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
url Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
util Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
.gitignore Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
assert.js Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
go.mod Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
go.sum Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
LICENSE Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
package-lock.json Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
package.json Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
README.md Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00
staticcheck.conf Adding upstream version 0.0~git20250409.f7acab6. 2025-05-22 11:36:18 +02:00

Nodejs compatibility library for Goja

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

Example:

package main

import (
    "github.com/dop251/goja"
    "github.com/dop251/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
}

Type Definitions

Type definitions are published to https://npmjs.com as @dop251/types-goja_nodejs-MODULE. They only include what's been implemented so far.

To make use of them you need to install the appropriate modules and add node_modules/@dop251 to typeRoots in tsconfig.json.

I didn't want to add those to DefinitelyTyped partly because I don't think they really belong there, and partly because I'd like to fully control the release cycle, i.e. publish the modules by an automated CI job and exactly at the same time as the Go code is released.

And the reason for splitting them into different packages is that the modules can be enabled or disabled individually, unlike in nodejs.

More modules will be added. Contributions welcome too.