Modernize Babel build tooling and share preset config - #445
Conversation
- Convert @alloy-js/babel-preset to TypeScript with typed exports and a new alloyBabelPresets() helper for the shared preset chain - Give @alloy-js/rollup-plugin a typed options API (addSourceInfo, sourceMaps) and auto-configure esbuild (jsx: preserve + source conditions) - Consume the shared helper from @alloy-js/cli and drop duplicated config - Remove now-redundant esbuild/resolve boilerplate from vitest configs
|
All changed packages have been documented.
Show changes
|
The shared helper was unnecessary indirection for such a small duplication. The CLI and Rollup/Vite plugin now compose the typed preset directly (still without @ts-expect-error thanks to the TS conversion of @alloy-js/babel-preset).
What
Cleans up and modernizes the Babel-based build tooling, removing duplicated configuration and giving the Rollup/Vite plugin a real API.
@alloy-js/babel-preset@ts-expect-error.build/cleanscripts,node >=22.@alloy-js/rollup-pluginAlloyPluginOptions(addSourceInfo,sourceMaps) that are actually forwarded (previously ignored).confighook that auto-configuresesbuild.jsx: "preserve"and thesourceresolve/ssr conditions, so consumers no longer set these by hand.PluginOptionreturn (wasany).Consumers
@alloy-js/cliand the plugin compose the typed preset chain inline (@babel/preset-typescript+ Alloy preset).esbuild/resolve.conditions/ssrboilerplate from 16vitest.config.tsfiles.Validation
pnpm build✔pnpm test— 243 files / 2103 tests ✔pnpm run lint(0 warnings),format:check,sync-publish-config:check,chronus verify✔Notes
The stale assumption that
onlyRemoveTypeImports: falsewas required is no longer true — #443 re-enabled the Babel 8 default via explicit type imports, so the preset chain usestypescriptPresetplainly.