Skip to content

esm-dev/tsx

Folders and files

Image for: Folders and files
NameName
Last commit message
Last commit date

Latest commit

Image for: Latest commit
 

History

Image for: History
203 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image for: Repository files navigation

tsx

A TSX transpiler for esm.sh services, powered by swc.

Usage

Image for: Usage
import init, { transform } from "https://esm.sh/@esm.sh/tsx";

// load tsx_bg.wasm
await init();

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

export default App() {
  const [msg] = useState<string>("world")
  return <h1>Hello {msg}!</h1>
}
`;
const importMap = {
  imports: {
    "react": "https://esm.sh/react@19.0.0",
  },
};
const ret = transform({ filename: "/App.tsx", code, importMap });
console.log(ret.code);

More usage check types/index.d.ts.

Development Setup

Image for: Development Setup

You will need rust 1.60+ and wasm-pack.

Build

Image for: Build
wasm-pack build --target web --no-pack --release

Run tests

Image for: Run tests
cargo test --all

About

Image for: About

A TSX transpiler for esm.sh services.

Resources

License

Stars

Watchers

Forks

Packages

Image for: Packages 0
No packages published