fix: respect corePackage/jsxPackage setting in experimental extractor#2579
Closed
mogelbrod wants to merge 1 commit into
Closed
fix: respect corePackage/jsxPackage setting in experimental extractor#2579mogelbrod wants to merge 1 commit into
mogelbrod wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
6736dfd to
136a9dd
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2579 +/- ##
===========================================
+ Coverage 77.05% 89.79% +12.74%
===========================================
Files 84 124 +40
Lines 2157 3694 +1537
Branches 555 1109 +554
===========================================
+ Hits 1662 3317 +1655
+ Misses 382 339 -43
+ Partials 113 38 -75 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
|
This is already covered in this complete rework of experimental extractor: #2572 |
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.
Description
This PR updates the experimental extractor (
lingui extract-experimental) to respect themacro.corePackage/macro.jsxPackagesettings.Up until now it only considers files that import directly from
@lingui/*/macrofor extraction using a hardcoded regex (/from ["']@lingui(\/.+)?\/macro["']/).Fix
The pre-filter is now built from the configured macro packages (
macro.corePackage+macro.jsxPackage) in addition to the built-in@lingui/*/macroentrypoints (kept for backwards compatibility, so the default config and the legacy@lingui/macropackage keep working even when a project overridescorePackage/jsxPackage). The regex is also built once per plugin instance instead of per file, which removes a latentRegExp-with-/g+.test()lastIndexstatefulness bug.Tests
Added an integration test
should extract messages imported from a configured custom macro packagewith a new fixture (packages/cli/test/extractor-experimental-custom-macro) that importst,msgand<Trans>through a#macrossubpath barrel declared inmacro.corePackage/macro.jsxPackage, and asserts all three messages are extracted. The test fails onmain(no messages extracted) and passes with this change. Existingextractor-experimentaltests continue to pass, covering the backwards-compatible default behavior.Types of changes
Checklist