devtype
v0.1.0-rc.1
Published
The DevType compiler — a statically-typed language that compiles to JavaScript. CLI: check / build / explain-rebuild.
Maintainers
Readme
devtype
The DevType compiler — a statically-typed language that compiles to clean,
readable JavaScript (ESM). This package ships the DevType command-line compiler as
a prebuilt native binary, distributed the same way as esbuild and swc: installing
devtype pulls in a single small @devshram/devtype-<platform> package containing the
binary for your OS/CPU, and a thin launcher execs it.
Install
$ npm install -D devtypeNo Rust toolchain required — the compiler is a native binary selected automatically for your platform. Supported platforms:
| OS | Arch | Package |
| --- | --- | --- |
| macOS | arm64 / x64 | @devshram/devtype-darwin-arm64, @devshram/devtype-darwin-x64 |
| Linux (glibc) | x64 / arm64 | @devshram/devtype-linux-x64-gnu, @devshram/devtype-linux-arm64-gnu |
| Linux (musl) | x64 | @devshram/devtype-linux-x64-musl |
| Windows | x64 | @devshram/devtype-win32-x64 |
The standard library ships inside this package; the launcher points the
compiler at it automatically, so your project's devtype.json needs no Std alias.
Quickstart
Create a project:
hello/
├─ devtype.json
└─ src/
└─ Main.dtdevtype.json (note: no Std alias needed):
{
"version": 1,
"target": "esm",
"outDir": "dist",
"entries": { "main": { "module": "App.Main" } },
"aliases": { "App": "./src" }
}src/Main.dt:
module App.Main
import Std.Console (println)
export function main() -> Effect<Unit> {
println("Hello from DevType!")
}Check and build with the packaged CLI:
$ npx devtype check hello
devtype: ok
$ npx devtype build hello
Build: 1 chunk(s), 1 std module(s) + loader. Sizes: estimate.
Wrote 6 to hello/dist
devtype: okRun the emitted program under Node:
$ cd hello/dist
$ node --input-type=module -e '
import fs from "node:fs";
const m = JSON.parse(fs.readFileSync("./manifest.json", "utf8"));
const mod = await import("./" + m.chunks[m.entries.main].file);
mod.main()();
'
Hello from DevType!CLI
| Command | What it does |
| --- | --- |
| devtype check [PATH] | Parse, resolve, type-check, verify FFI companions. |
| devtype build [PATH] | check, then emit + bundle to outDir. |
| devtype explain-rebuild [PATH] | check, then print the per-module rebuild/cache table. |
| devtype --version | Print the compiler version. |
PATH defaults to the current directory.
Pointing at a different std library
The launcher sets DEVTYPE_STD_DIR to the std library bundled in this package. To
override it (for example, to use a std checked out from source), set the env var
yourself, or add an explicit Std alias to your devtype.json — an explicit alias
always wins.
Documentation
Full docs, guide, and language reference: https://github.com/avi892nash/devtype/tree/main/docs — start with getting-started.
