# @astrojs/compiler-binding

> Astro Compiler

Latest version **0.4.0** (published 2026-08-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @astrojs/compiler-binding
pnpm add @astrojs/compiler-binding
yarn add @astrojs/compiler-binding
bun add @astrojs/compiler-binding
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2026-08-10 |
| First published | 2026-02-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^20.19.0 \|\| >=22.12.0 |
| Dependencies | 0 |
| Unpacked size | 39.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 81 |
| Author | Astro contributors |
| Maintainers | fredkschott, matthewp |
| Keywords | astro, compiler, javascript, typescript |

## Links

- npm: https://www.npmjs.com/package/@astrojs/compiler-binding
- Repository: https://github.com/withastro/compiler-rs
- Homepage: https://astro.build
- Issues: https://github.com/withastro/compiler/issues
- npm.io page: https://npm.io/package/@astrojs/compiler-binding

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.4.0 (latest) — 2026-08-10
- 0.3.2 — 2026-07-29
- 0.3.1 — 2026-07-10
- 0.3.0 — 2026-06-30
- 0.2.3 — 2026-06-24
- 0.2.2 — 2026-06-10
- 0.2.1 — 2026-05-21
- 0.2.0 — 2026-05-12
- 0.1.10 — 2026-04-24
- 0.1.9 — 2026-04-23
- 0.1.8 — 2026-04-20
- 0.1.7 — 2026-04-15
- 0.1.6 — 2026-03-19
- 0.1.5 — 2026-03-16
- 0.1.4 — 2026-02-26
- … 5 more at https://npm.io/package/@astrojs/compiler-binding/versions

## README

# Astro Compiler

Astro's compiler, written in Rust with [NAPI-RS](https://napi.rs/) bindings for Node.js.

## Install

```
npm install @astrojs/compiler-rs
```

## Usage

#### Transform `.astro` to JavaScript

The Astro compiler transforms `.astro` component files into JavaScript modules whose default export generates HTML.

```js
import { transform } from "@astrojs/compiler-rs";

const result = transform(source, {
  filename: "/Users/astro/Code/project/src/pages/index.astro",
  sourcemap: "both",
});
```

#### Parse `.astro` and return an AST

The compiler can emit an ESTree-compatible AST using the `parse` method.

```js
import { parse } from "@astrojs/compiler-rs";

const result = parse(source);

console.log(JSON.stringify(result.ast, null, 2));
```

## Contributing

**New contributors welcome!** Check out our [Contributors Guide](CONTRIBUTING.md) for help getting started.

Join us on [Discord](https://astro.build/chat) to meet other maintainers. We'll help you get your first contribution in no time!

## Links

- [License (MIT)](LICENSE)
- [Code of Conduct](https://github.com/withastro/.github/blob/main/CODE_OF_CONDUCT.md)
- [Open Governance & Voting](https://github.com/withastro/.github/blob/main/GOVERNANCE.md)
- [Project Funding](https://github.com/withastro/.github/blob/main/FUNDING.md)
- [Website](https://astro.build/)

## Sponsors

Astro is free, open source software made possible by these wonderful sponsors.

[❤️ Sponsor Astro! ❤️](https://github.com/withastro/.github/blob/main/FUNDING.md)

<p align="center">
  <a target="_blank" href="https://opencollective.com/astrodotbuild">
    <img src="https://astro.build/sponsors.png" alt="Sponsor logos including the current Astro Sponsors, Gold Sponsors, and Exclusive Partner Sponsors: Netlify, Sentry, and Project IDX." />
  </a>
</p>

---
_Source: https://npm.io/package/@astrojs/compiler-binding · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
