MCPcopy Index your code
hub / github.com/esm-dev/tsx

github.com/esm-dev/tsx @v1.5.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.5.0 ↗ · + Follow
81 symbols 131 edges 14 files 9 documented · 11%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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",
    "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

Extension points exported contracts — how you extend this code

ImportMap (Interface)
(no doc)
types/index.d.ts
DevOptions (Interface)
(no doc)
types/index.d.ts
TransformOptions (Interface)
(no doc)
types/index.d.ts
TransformResult (Interface)
(no doc)
types/index.d.ts

Core symbols most depended-on inside this repo

new_str
called by 7
src/swc_helpers.rs
resolve
called by 7
src/resolver.rs
simple_member_expr
called by 6
src/swc_helpers.rs
ident_expr
called by 5
src/swc_helpers.rs
window_assign
called by 4
src/swc_helpers.rs
member_expr
called by 4
src/swc_helpers.rs
transform
called by 3
index.mjs
get_object_value
called by 3
src/swc_helpers.rs

Shape

Function 33
Method 27
Class 17
Interface 4

Languages

Rust88%
TypeScript12%

Modules by API surface

src/swc.rs15 symbols
src/swc_prefresh.rs11 symbols
src/swc_helpers.rs10 symbols
src/test.rs7 symbols
src/dev.rs7 symbols
src/error.rs6 symbols
types/index.d.ts4 symbols
test.mjs3 symbols
src/swc_jsx_src.rs3 symbols
src/specifier.rs3 symbols
src/resolver.rs3 symbols
src/lib.rs3 symbols

For agents

$ claude mcp add tsx \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact