@esm.sh/tsx
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

tsx

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

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

You will need rust 1.60+ and wasm-pack.

Build

wasm-pack build --target web --no-pack --release

Run tests

cargo test --all

Readme

Keywords

none

Package Sidebar

Install

npm i @esm.sh/tsx

Weekly Downloads

6

Version

1.3.0

License

MIT

Unpacked Size

2.81 MB

Total Files

7

Last publish

Collaborators

  • ije