Rules for qjs

load("@bzlparty_rules_quickjs//quickjs:qjs.bzl", "qjs_binary")

qjs_binary

qjs_binary(name, data, entry_point, include_declarations, include_npm_linked_packages,
           include_transitive_sources, qjs_args)

Execute a JavaScript program on QuickJS.

qjs_binary(
    name = "hello_world",
    entry_point = ":hello_world.js",
)

Run the target:

bazel run //path/to:hello_world

qjs_binary is meant to be similar to js_binary and therefore shares some of its attributes.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
data Runtime dependencies of the program.

The transitive closure of the data dependencies will be available in the .runfiles folder for this binary/test.

NB: data files are copied to the Bazel output tree before being passed as inputs to runfiles. See copy_data_to_bin docstring for more info.
List of labels optional []
entry_point - Label required
include_declarations When True, declarations and transitive_declarations from JsInfo providers in data targets are included in the runfiles of the target.

Defaults to false since declarations are generally not needed at runtime and introducing them could slow down developer round trip time due to having to generate typings on source file changes.
Boolean optional False
include_npm_linked_packages When True, files in npm_linked_packages and transitive_npm_linked_packages from JsInfo providers in data targets are included in the runfiles of the target.

transitive_files from NpmPackageStoreInfo providers in data targets are also included in the runfiles of the target.
Boolean optional True
include_transitive_sources When True, transitive_sources from JsInfo providers in data targets are included in the runfiles of the target. Boolean optional True
qjs_args List of arguments passed to the qjs binary List of strings optional []

qjs_test

qjs_test(name, data, entry_point, include_declarations, include_npm_linked_packages,
         include_transitive_sources, qjs_args)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
data Runtime dependencies of the program.

The transitive closure of the data dependencies will be available in the .runfiles folder for this binary/test.

NB: data files are copied to the Bazel output tree before being passed as inputs to runfiles. See copy_data_to_bin docstring for more info.
List of labels optional []
entry_point - Label required
include_declarations When True, declarations and transitive_declarations from JsInfo providers in data targets are included in the runfiles of the target.

Defaults to false since declarations are generally not needed at runtime and introducing them could slow down developer round trip time due to having to generate typings on source file changes.
Boolean optional False
include_npm_linked_packages When True, files in npm_linked_packages and transitive_npm_linked_packages from JsInfo providers in data targets are included in the runfiles of the target.

transitive_files from NpmPackageStoreInfo providers in data targets are also included in the runfiles of the target.
Boolean optional True
include_transitive_sources When True, transitive_sources from JsInfo providers in data targets are included in the runfiles of the target. Boolean optional True
qjs_args List of arguments passed to the qjs binary List of strings optional []