JavaScript and TypeScript toolchain powered by OXC.
Provides parsing, transformation, minification, and bundling of JS/TS code via Rust NIFs — no Node.js or Bun required.
These are thin wrappers around the OXC library. See OXC module docs
for full option details.
Summary
Functions
Bundle multiple TS/JS modules into a single self-executing script.
Bundle multiple TS/JS modules, raising on error.
Bundle an entry file from disk with all its dependencies.
Collect values from an AST tree by walking and filtering nodes.
Extract import specifiers from JS/TS source.
Like imports/2 but raises on errors.
Minify JavaScript source code.
Minify JavaScript source code, raising on error.
Parse JS/TS source into an AST.
Parse JS/TS source into an AST, raising on error.
Apply position-based patches to a source string.
Depth-first post-order AST traversal. Like Macro.postwalk/2.
Depth-first post-order AST traversal with accumulator. Like Macro.postwalk/3.
Transform TypeScript/JSX to plain JavaScript.
Transform TypeScript/JSX to plain JavaScript, raising on error.
Check if JS/TS source is syntactically valid.
Walk an AST tree, calling fun on every node.
Functions
@spec bundle( [{String.t(), String.t()}], keyword() ) :: {:ok, String.t() | map()} | {:error, String.t()}
Bundle multiple TS/JS modules into a single self-executing script.
Accepts a list of {filename, source} tuples. Resolves imports between
them, topologically sorts by dependencies, strips module syntax, and
wraps the result in an IIFE.
files = [
{"utils.ts", "export function add(a: number, b: number) { return a + b }"},
{"main.ts", "import { add } from './utils'\nconsole.log(add(1, 2))"}
]
{:ok, js} = QuickBEAM.JS.bundle(files)Options
:minify— minify the output (default: false):banner— string to prepend before the IIFE:footer— string to append after the IIFE:sourcemap— generate source map (returns%{code, sourcemap}):define— compile-time identifier replacements:drop_console— removeconsole.*calls (default: false)
Bundle multiple TS/JS modules, raising on error.
Bundle an entry file from disk with all its dependencies.
Recursively resolves imports — both relative paths (./utils) and
bare specifiers (lodash-es) via node_modules/. Reads all sources,
then bundles them with OXC.bundle/2.
{:ok, js} = QuickBEAM.JS.bundle_file("src/main.ts")The node_modules/ directory is found by walking up from the entry file.
Override with the :node_modules option.
Accepts all options from bundle/2 plus:
:node_modules— explicit path tonode_modules/directory
Collect values from an AST tree by walking and filtering nodes.
See OXC.collect/2 for details.
Extract import specifiers from JS/TS source.
Faster than parse/2 + collect/2 — skips full AST serialization
and returns only the import source strings. Type-only imports
(import type { ... }) are excluded.
{:ok, imports} = QuickBEAM.JS.imports("import { ref } from 'vue'", "test.ts")
# => {:ok, ["vue"]}
Like imports/2 but raises on errors.
Minify JavaScript source code.
{:ok, min} = QuickBEAM.JS.minify("const x = 1 + 2;", "file.js")Options
:compress— apply compression optimizations (default: true):mangle— mangle variable names (default: true)
Minify JavaScript source code, raising on error.
Parse JS/TS source into an AST.
{:ok, ast} = QuickBEAM.JS.parse("const x: number = 1", "file.ts")
Parse JS/TS source into an AST, raising on error.
Apply position-based patches to a source string.
See OXC.patch_string/2 for details.
Depth-first post-order AST traversal. Like Macro.postwalk/2.
See OXC.postwalk/2 for details.
Depth-first post-order AST traversal with accumulator. Like Macro.postwalk/3.
See OXC.postwalk/3 for details.
Transform TypeScript/JSX to plain JavaScript.
{:ok, js} = QuickBEAM.JS.transform("const x: number = 1", "file.ts")
# => {:ok, "const x = 1;\n"}Options
:jsx— enable JSX transformation (default: auto-detected from filename)
Transform TypeScript/JSX to plain JavaScript, raising on error.
Check if JS/TS source is syntactically valid.
QuickBEAM.JS.valid?("const x = 1", "file.js")
# => true
Walk an AST tree, calling fun on every node.
See OXC.walk/2 for details.