unjs/magicast
🧀 Programmatically modify JavaScript and TypeScript source codes with a simplified, elegant and familiar syntax powered by recast and babel. observed · 2026-08-28
Health v2 · maintenance only
94/100
- Activity 99
- Release rhythm 83
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-02. Adoption (stars, forks) is never an input.
- gap_med: 78
- age_days: 1926
- days_rel: 33
- days_push: 7
- n_releases_24m: 6
Adoption not part of the score
2477 stars · 50 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
Magicast is a TypeScript library for programmatically modifying JavaScript and TypeScript source files using a simple, JSON-like proxy API over ASTs parsed by recast and Babel. It preserves original code formatting while allowing easy manipulation of imports, exports, and function call arguments.
Use cases
- programmatically edit config files like defineConfig calls
- write codemods to update JS/TS source code
- modify module imports and exports in a file
- append values to exported arrays while preserving formatting
- generate or transform TypeScript configuration files
- manipulate function call arguments in source code
When to choose
- you need to edit JS/TS files programmatically without losing formatting
- writing codemods or config file editors (e.g., Nuxt modules)
- you want readable code manipulation instead of raw AST work
When to avoid
- you only need to parse or lint code without writing it back
- you need full AST-level control for complex transformations (use Babel or jscodeshift directly)
- your target language is not JavaScript or TypeScript
Facets
library · maturity active
parser developer-tools developer-tools parsers web-development ast-manipulation codemod typescript recast babel code-generation nodejs javascript
2 sources
- readme: https://github.com/unjs/magicast · fetched 2026-08-28 · 236220fffcb9
- registry_npm: https://registry.npmjs.org/magicast · fetched 2026-08-29 · 4b9044c71ceb
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| unjs/magicast | main | 94 |
For agents
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem