https://github.com/alephjs/aleph-compiler
https://github.com/alephjs/aleph-compiler
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/alephjs/aleph-compiler
- Owner: alephjs
- License: mit
- Created: 2022-05-01T09:15:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-19T23:54:53.000Z (over 2 years ago)
- Last Synced: 2025-04-13T17:44:04.629Z (8 months ago)
- Language: Rust
- Size: 118 MB
- Stars: 29
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://alephjs.org)
# Aleph.js Compiler
The compiler of Aleph.js written in Rust, powered by [swc](https://swc.rs) and [lightningcss](https://lightningcss.dev/).
## Usage
```ts
import { transform } from "https://deno.land/x/aleph_compiler@0.8.4/mod.ts";
const code = `
import { useState, useEffect } from "react"
export default function App() {
const [msg, setMsg] = useState("...")
useEffect(() => {
setTimeout(() => {
setMsg("world!")
}, 1000)
}, [])
return
Hello {msg}
}
`
const ret = await transform("./app.tsx", code, {
importMap: JSON.stringify({
imports: {
"react": "https://esm.sh/react@18",
}
}),
jsxImportSource: "https://esm.sh/react@18",
sourceMap: true,
})
console.log(ret.code, ret.map)
```
## Development Setup
You will need [rust](https://www.rust-lang.org/tools/install) 1.60+ and [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/).
## Build
```bash
deno run -A build.ts
```
## Run tests
```bash
cargo test --all
```