gleam-compiler
TypeScript icon, indicating that this package has built-in type declarations

0.30.5 • Public • Published

Gleam Compiler

The Gleam compiler in WASM, typed and built for easy use.

npm install gleam-compiler
import { compile, type CompilerOptions, target, mode } from "gleam-compiler";

const options = {
    target: target.JavaScript // or "javascript"
    files: {"/src/main.gleam": "pub fn main() { 42 }"},
    dependencies: [],
    mode: mode.Dev // or "Dev"
} satisfies CompilerOptions;

const { Ok, Err } = compile(options);

if (Ok) {
    console.log(Ok) 
    // {"/build/dev/javascript/gleam-wasm/gleam.mjs": "export class CustomType {\n  inspect() {\n    let field = (label) => {\n      let value = inspect(this[label]);\n...", "/build/dev/javascript/gleam-wasm/main.mjs": "export function main() {\n  return 42;\n}\n"}

}

Package Sidebar

Install

npm i gleam-compiler

Weekly Downloads

13

Version

0.30.5

License

Apache-2.0

Unpacked Size

3.27 MB

Total Files

12

Last publish

Collaborators

  • endercheif