feat(@formatjs/unplugin): universal build plugin for Vite, Webpack, Rollup, esbuild, Rspack#6096
Merged
feat(@formatjs/unplugin): universal build plugin for Vite, Webpack, Rollup, esbuild, Rspack#6096
Conversation
080dc04 to
1755e4d
Compare
…k, Rollup, esbuild, and Rspack Implements a single unplugin-based package that provides FormatJS transform support across all major bundlers. Includes integration tests that run real builds with each bundler. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@formatjs/unplugin— a universal build plugin powered by unplugin that provides FormatJS AST transformations (ID generation, description removal, AST pre-parsing) across all major bundlers with a single codebase@formatjs/vite-pluginbecomes a thin 2-line re-export from@formatjs/unplugin/vitefor backward compatibility — zero breaking changes for existing usersCloses UPCOMING.md item #1 (Vite Plugin Adoption: 689/week vs 276K for babel-plugin).
What changed
New:
packages/unplugin/transform.ts— core transform logic (moved from vite-plugin, 451 lines, unchanged)index.ts—createUnpluginfactory withtransformInclude+transformhooksvite.ts,webpack.ts,rollup.ts,esbuild.ts,rspack.ts— bundler entry pointspackage.json— exports for.,./vite,./webpack,./rollup,./esbuild,./rspack,./transformUpdated:
packages/vite-plugin/index.ts→ 2-line re-export from@formatjs/unplugin/vitetransform.ts→ deleted (moved to unplugin)tests/→ deleted (moved to unplugin)Build system
tools/tsconfig.bzl— addedESNEXT_SKIP_LIB_CHECK_TSCONFIG(unplugin's types import from all bundlers)tools/vitest.bzl— addedskipLibCheckto test tsconfig for transitive type compatibilityDocs
docs/src/docs/tooling/unplugin.mdx— full docs with all 5 bundler examples + migration guidesvite-plugin.mdx— tip recommending unplugin for new projectsbundler-plugins.mdx— added unplugin section with tabbed examplesTest plan
bazel test //packages/unplugin:unit_test— 51 tests passbazel test //packages/unplugin:unit_test_typecheck_typecheck_test— type-check passesbazel test //packages/vite-plugin/integration-tests:integration_test— 10 integration tests pass (backward compat)bazel test //docs:docs_metadata_test— docs metadata up to datepnpm t— 484/487 pass (3 pre-existing failures in react-intl/vue-intl sandbox resolution, confirmed on clean main)🤖 Generated with Claude Code