0.5.6 • Published 1 month ago

esm-compiler v0.5.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

ESM Compiler

The compiler for esm.sh playground written in Rust, powered by swc and lightningcss.

Usage

import { init, transform } from "https://esm.sh/esm-compiler";

await init("https://esm.sh/esm-compiler/esm_compiler_bg.wasm");

const code = `
import { useState } from "react"

export default App() {
  const [msg] = useState<string>("world")
  return <h1>Hello {msg}!</h1>
}
`

const importMap = {
  "imports": {
    "@jsxImportSource": "https://esm.sh/react@18"
    "react": "https://esm.sh/react@18",
  }
}

const ret = transform("./App.jsx", code, {
  importMap: json.stringify(importMap)
})

console.log(ret.code)

Development Setup

You will need rust 1.60+ and wasm-pack.

Build

wasm-pack build --target web

Run tests

cargo test --all
deno run -A test.ts
0.5.6

1 month ago

0.5.5

1 month ago

0.5.4

1 month ago

0.5.3

2 months ago

0.5.0

2 months ago

0.5.2

2 months ago

0.5.1

2 months ago

0.4.5

3 months ago

0.4.4

4 months ago

0.4.3

4 months ago

0.4.2

4 months ago

0.4.1

4 months ago

0.4.0

4 months ago

0.3.9

4 months ago

0.3.8

4 months ago

0.3.7

4 months ago

0.3.6

5 months ago

0.3.5

5 months ago

0.3.0

6 months ago

0.3.2

6 months ago

0.3.1

6 months ago

0.3.4

6 months ago

0.3.3

6 months ago

0.2.3

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.2.2

1 year ago

0.1.0

1 year ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago