Conversation
…matjs ID generation When flatten=true, apply printAST(hoistSelectors(parse(message))) before generating the ID, matching the behavior of babel-plugin-formatjs and the Rust formatjs_cli. Previously the Vite plugin only applied simple whitespace normalization, producing a different hash input and therefore different IDs. Fixes #6177 Co-authored-by: Long Ho <longlho@users.noreply.github.com>
longlho
commented
Mar 23, 2026
packages/unplugin/transform.ts
Outdated
| additionalFunctionNames = [], | ||
| ast: preParseAst = false, | ||
| preserveWhitespace = false, | ||
| flatten = false, |
| const input = `<FormattedMessage defaultMessage="Are you sure you want to delete {count,plural,one {this report template} other {these # report templates}}?" />` | ||
| const result = t(input, {flatten: true}) | ||
| // Hoisted form: plural wraps the full sentence | ||
| expect(result).toContain( |
Member
Author
There was a problem hiding this comment.
compare the whole output, not just toContain
|
Claude finished @longlho's task in 8m 11s —— View job Addressed Review Comments
Changes Made
|
…assertions in tests - Change `flatten` option default from `false` to `true` to match babel-plugin-formatjs and Rust CLI behavior out of the box - Update flatten tests to use `toBe` for whole-output assertions instead of multiple `toContain` checks Co-authored-by: Long Ho <longlho@users.noreply.github.com>
Member
Author
|
@claude add conformance integration tests to check between formatjs_cli and our vite plugin to make sure default set of options matches. Make sure to bazel it |
|
Claude finished @longlho's task in 7m 55s —— View job Adding Conformance Integration Tests
|
Verify that formatjs_cli extract --flatten and the unplugin transform (default options: flatten=true) generate identical IDs for the same source, ensuring extraction and bundling pipelines stay in sync. Co-authored-by: Long Ho <longlho@users.noreply.github.com>
|
Thanks for the lightning-fast fix & release! ❤️ |
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.

When
flatten=true, applyprintAST(hoistSelectors(parse(message)))before generating the ID, matching the behavior of babel-plugin-formatjs and the Rust formatjs_cli. Previously the Vite plugin only applied simple whitespace normalization, producing a different hash input and therefore different IDs.Fixes #6177
Generated with Claude Code