feat(extractor): expose extractFromFileWithBabel function for better flexibility #1719
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 brings improvement for those who wants more flexibility in what files extractor could understand. It's covering #1717
When user has a Ecmascript feature which is not enabled in the parser by default there is only thing it could do about it override extractor completely and pass all needed plugins manually. This is not future-proof solution, as user have to copy-paste lingui's default implementation and adjust it by its needs.
Solution: I extracted from the default implementation a low level function
extractFromFileWithBabel
which is now a part of a public api and could be used in the userland. I choosed this approach among others, becauseparserPlugins
is not a static list and could vary depending on a file passed for extractor. So this would give to users enough flexibility to express any required logic.Types of changes
Fixes # (issue)
Checklist