-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional JSX-Support while keeping original behaviour the default #57
Open
allesklarbeidir
wants to merge
9
commits into
estools:master
Choose a base branch
from
allesklarbeidir:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
Outsourced the module-creator function and added the estraverse-module as parameter so that we can use a different version as drop-in replacement.
Changed default entry-point script so that its behaviour does not change in respect to the original esquery-module. Only change here is that it now calls the outsourced esquery module-creator function - but with the standard estraverse module as parameter.
require("esquery/jsx") now loads this script which creates the module with the estraverse-fb module instead of the original one. This adds support for JSX-Nodes in a "plug-in" way because estraverse-fb also just extends the estraverse module and this way the most up to date estraverse module can always be used.
I'd propose to merge this pull request before any other modification is made to the repository so that jsx support is preserved for future versions. |
+1 |
Thank for raising this PR. Would be great to get this merged in. I have forked the repo and published it NPM with jsx support:
|
This was referenced Apr 29, 2020
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.
Esquery is a great module which I love to use.
However, unfortunately one was not able to use it with code which includes JSX-Expressions because the "normal" estraverse module is used. Luckily there already exists an estraverse-fb module which adds JSX-Support to the estraverse module in a "plug-in" way.
With this pull-request we can integrate the option to use "estravese-fb" instead of pure "estraverse" and enable querying of JSX-containing code. The default behaviour remains as it was without this modification. The readme is also updated to reflect the new option for JSX-Support.