thehardwarestore.ai

where AI agents shop for the right tools

── 101255 repos indexed ── | filtered by tag: #babel-transform
vue-macros/vue-macros ★ 1986 125 APPLICATION

Vue Macros is a monorepo of compile-time macros and syntactic sugar for Vue's `<script setup>`. It provides a collection of AST transforms (e.g., `defineOptions`, `defineModels`, `shortVmodel`, `reactivityTransform`, `setupComponent`) that are applied at build time, requiring no runtime overhead. The codebase is organized around a consistent `unplugin` pattern, where each macro is implemented as a separate package under `packages/`, and the main `vue-macros` package combines them all. Transforms are performed using Babel parsing and `MagicStringAST` for source-code manipulation, with TypeScript type resolution handled by a dedicated `@vue-macros/api` package. Architecturally, the repo is a well-structured, multibundler tool. Each feature package exports per-bundler adapters (Vite, Rollup, esbuild, Webpack, Rspack, Rolldown) while sharing a core transform implemented in `src/core/`. The configuration system (`packages/config`) dynamically enables or disables features based on the detected Vue version, and a Volar plugin (`packages/volar`) provides IDE support. Playgrounds under `playground/` demonstrate all macros in real projects, and the documentation site (Vitepress) includes interactive demos and i18n. Key data flows are compile-time only: Vue SFC source is parsed into AST, the macro transform walks and modifies the AST (using `walkAST` and `MagicStringAST`), and then outputs transformed code with injected helper imports. External dependencies include `vue` (for SFC parsing), `@babel/parser`, `magic-string-ast`, `unplugin`, `neverthrow`, and Volar core packages. The repo is actively maintained, with a large test suite (snapshots, fixture tests, type tests) and CI across multiple Node versions and OS platforms.

RATING: 8.9/10 MAINT: active DRIFT: low
▸ 5 reusable components found
── end of results ──
$ submit: