Add %%placeholders%% support to @babel/template#9648
Merged
nicolo-ribaudo merged 4 commits intobabel:masterfrom Mar 18, 2019
Merged
Add %%placeholders%% support to @babel/template#9648nicolo-ribaudo merged 4 commits intobabel:masterfrom
nicolo-ribaudo merged 4 commits intobabel:masterfrom
Conversation
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/10439/ |
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/10429/ |
0e58e25 to
b39fa7c
Compare
233175b to
1080437
Compare
danez
approved these changes
Mar 11, 2019
existentialism
approved these changes
Mar 12, 2019
Member
Author
|
TODO: Docs |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This is the last step to make #9364 usable in Babel. I'm sorry for opening this PR so late, but I hope to get it in v7.4.
In this PR I added a new option to
@babel/template,syntacticPlaceholders: ?boolean, which toggles between%%foo%%placeholders (whentrue) andFOOplaceholders. If it isn't specified, Babel tries to be "smart" to avoid breaking backward compat: if%%foo%%is usedsyntacticPlaceholdersdefaults totrue, otherwise tofalse.0e58e25 commit shows how some templates we used could be simplified by using this new placeholders syntax (we can't actually do it yet because we are importing
templatefrom@babel/corewhich could be an older version).NOTE: Since I wanted to keep this PR as small as possible to make it easier to review, I didn't migrate
template.astto internally use the new syntax. It is an implementation detail, so it will be possible to change it in a patch release.