Skip to content

alephjs/aleph-compiler

Repository files navigation

Aleph.js: The Full-stack Framework in Deno.

Aleph.js Compiler

The compiler of Aleph.js written in Rust, powered by swc and lightningcss.

Usage

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 <h1>Hello {msg}</h1>
}
`

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 1.60+ and wasm-pack.

Build

deno run -A build.ts

Run tests

cargo test --all

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published