Skip to content

Modernize Babel build tooling and share preset config - #445

Merged
timotheeguerin merged 3 commits into
alloy-framework:mainfrom
timotheeguerin:modernize-babel-build
Jul 29, 2026
Merged

Modernize Babel build tooling and share preset config#445
timotheeguerin merged 3 commits into
alloy-framework:mainfrom
timotheeguerin:modernize-babel-build

Conversation

@timotheeguerin

@timotheeguerin timotheeguerin commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

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

  • Converted from plain JS to TypeScript with real type declarations, so consumers import the preset without @ts-expect-error.
  • package.json hygiene: description/author/homepage/bugs/exports/types, build/clean scripts, node >=22.

@alloy-js/rollup-plugin

  • Real typed AlloyPluginOptions (addSourceInfo, sourceMaps) that are actually forwarded (previously ignored).
  • Adds a Vite config hook that auto-configures esbuild.jsx: "preserve" and the source resolve/ssr conditions, so consumers no longer set these by hand.
  • Typed PluginOption return (was any).

Consumers

  • @alloy-js/cli and the plugin compose the typed preset chain inline (@babel/preset-typescript + Alloy preset).
  • Removed the now-redundant esbuild/resolve.conditions/ssr boilerplate from 16 vitest.config.ts files.

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: false was required is no longer true — #443 re-enabled the Babel 8 default via explicit type imports, so the preset chain uses typescriptPreset plainly.

- 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
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @alloy-js/babel-preset
  • @alloy-js/cli
  • @alloy-js/core
  • @alloy-js/csharp
  • @alloy-js/go
  • @alloy-js/java
  • @alloy-js/json
  • @alloy-js/markdown
  • @alloy-js/msbuild
  • @alloy-js/python
  • @alloy-js/rollup-plugin
  • @alloy-js/typescript
  • @alloy-js/typespec
Show changes

@alloy-js/babel-preset - feature ✏️

@alloy-js/babel-preset now ships with TypeScript type declarations, so consumers can import the preset without @ts-expect-error.

@alloy-js/rollup-plugin - feature ✏️

The Rollup/Vite plugin now accepts addSourceInfo and sourceMaps options and automatically configures esbuild for Alloy (jsx: "preserve" plus the source resolve conditions). Consumers no longer need to set these by hand in their Vite/Vitest config.

@alloy-js/cli - internal ✏️

Rely on the Rollup/Vite plugin to configure esbuild, removing the duplicated esbuild/resolve boilerplate from each package's vitest.config.ts.

@alloy-js/core - internal ✏️

Rely on the Rollup/Vite plugin to configure esbuild, removing the duplicated esbuild/resolve boilerplate from each package's vitest.config.ts.

@alloy-js/csharp - internal ✏️

Rely on the Rollup/Vite plugin to configure esbuild, removing the duplicated esbuild/resolve boilerplate from each package's vitest.config.ts.

@alloy-js/go - internal ✏️

Rely on the Rollup/Vite plugin to configure esbuild, removing the duplicated esbuild/resolve boilerplate from each package's vitest.config.ts.

@alloy-js/java - internal ✏️

Rely on the Rollup/Vite plugin to configure esbuild, removing the duplicated esbuild/resolve boilerplate from each package's vitest.config.ts.

@alloy-js/json - internal ✏️

Rely on the Rollup/Vite plugin to configure esbuild, removing the duplicated esbuild/resolve boilerplate from each package's vitest.config.ts.

@alloy-js/markdown - internal ✏️

Rely on the Rollup/Vite plugin to configure esbuild, removing the duplicated esbuild/resolve boilerplate from each package's vitest.config.ts.

@alloy-js/msbuild - internal ✏️

Rely on the Rollup/Vite plugin to configure esbuild, removing the duplicated esbuild/resolve boilerplate from each package's vitest.config.ts.

@alloy-js/python - internal ✏️

Rely on the Rollup/Vite plugin to configure esbuild, removing the duplicated esbuild/resolve boilerplate from each package's vitest.config.ts.

@alloy-js/typescript - internal ✏️

Rely on the Rollup/Vite plugin to configure esbuild, removing the duplicated esbuild/resolve boilerplate from each package's vitest.config.ts.

@alloy-js/typespec - internal ✏️

Rely on the Rollup/Vite plugin to configure esbuild, removing the duplicated esbuild/resolve boilerplate from each package's vitest.config.ts.

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).
@timotheeguerin
timotheeguerin marked this pull request as ready for review July 29, 2026 13:37
@timotheeguerin
timotheeguerin merged commit 13ec2e0 into alloy-framework:main Jul 29, 2026
5 checks passed
@timotheeguerin
timotheeguerin deleted the modernize-babel-build branch July 29, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant