Skip to content

feat!: Consolidate Metadata Transformation Options into descriptorFields#208

Merged
andrii-bodnar merged 6 commits into
mainfrom
feat/descriptorFields
Apr 17, 2026
Merged

feat!: Consolidate Metadata Transformation Options into descriptorFields#208
andrii-bodnar merged 6 commits into
mainfrom
feat/descriptorFields

Conversation

@timofei-iatsenko
Copy link
Copy Markdown
Collaborator

Related PR in Babel version: lingui/js-lingui#2513

Related issue: lingui/js-lingui#2511

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.23%. Comparing base (0e5c2d9) to head (f63efc6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #208      +/-   ##
==========================================
+ Coverage   93.01%   93.23%   +0.22%     
==========================================
  Files           8        8              
  Lines        1531     1581      +50     
==========================================
+ Hits         1424     1474      +50     
  Misses        107      107              
Flag Coverage Δ
unittests 93.23% <100.00%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/js_macro_folder.rs 97.89% <100.00%> (ø)
src/lib.rs 92.01% <100.00%> (+0.03%) ⬆️
src/options.rs 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timofei-iatsenko timofei-iatsenko changed the base branch from next to main April 14, 2026 13:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new descriptorFields option to control which message-descriptor properties (e.g., message, context, comment) are preserved during SWC macro transformation, replacing the previous boolean stripNonEssentialFields behavior and aligning with the related Babel change.

Changes:

  • Add DescriptorFields enum and replace strip_non_essential_fields with descriptor_fields across config parsing and runtime options (with auto env-based defaults).
  • Update macro transforms to conditionally emit message, context, and comment based on descriptor_fields.
  • Update docs, tests, and SWC snapshot fixtures to cover the new configuration modes (id-only, message, etc.).

Reviewed changes

Copilot reviewed 12 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/options.rs Introduces DescriptorFields, updates config parsing/defaulting, and replaces the old boolean option.
src/lib.rs Updates JSX macro transform to conditionally include descriptor fields and exports DescriptorFields.
src/js_macro_folder.rs Updates JS macro transforms (t, defineMessage, etc.) to respect descriptor_fields for message/context/comment.
README.md Documents descriptorFields behavior and supported values.
tests/jsx.rs Adjusts tests to use descriptor_fields and adds coverage for "message" mode.
tests/jsx_icu.rs Adjusts tests to use descriptor_fields and adds coverage for "message" mode with ICU JSX.
tests/js_t.rs Adjusts tests to use descriptor_fields and adds coverage for "message" mode.
tests/js_define_message.rs Adjusts tests to use descriptor_fields and adds coverage for "message" mode.
tests/__swc_snapshots__/... Updates/adds snapshots reflecting new field-preservation behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib.rs Outdated
Comment thread src/options.rs
Comment thread src/options.rs
@andrii-bodnar
Copy link
Copy Markdown
Contributor

@timofei-iatsenko please take a look at the failing formatting check

@andrii-bodnar andrii-bodnar merged commit 6322816 into main Apr 17, 2026
4 checks passed
@andrii-bodnar andrii-bodnar deleted the feat/descriptorFields branch April 17, 2026 11:33
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.

3 participants