Skip to content
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 %%placeholders%% support to @babel/template #9648

Merged
merged 4 commits into from Mar 18, 2019

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Mar 7, 2019

Q                       A
Fixed Issues? Not really, but the old behavior was confusing to some people: #8723, #8067, #7035
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature? Yes
Tests Added + Pass? Yes
Documentation PR Link babel/website#1988
Any Dependency Changes?
License MIT

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 (when true) and FOO placeholders. If it isn't specified, Babel tries to be "smart" to avoid breaking backward compat: if %%foo%% is used syntacticPlaceholders defaults to true, otherwise to false.

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 template from @babel/core which 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.ast to internally use the new syntax. It is an implementation detail, so it will be possible to change it in a patch release.

@nicolo-ribaudo nicolo-ribaudo added the PR: New Feature 🚀 A type of pull request used for our changelog categories label Mar 7, 2019
@nicolo-ribaudo nicolo-ribaudo added this to the v7.4.0 milestone Mar 7, 2019
@babel-bot
Copy link
Collaborator

babel-bot commented Mar 7, 2019

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/10439/

@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/10429/

@nicolo-ribaudo nicolo-ribaudo marked this pull request as ready for review March 7, 2019 23:59
@nicolo-ribaudo nicolo-ribaudo added the PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release label Mar 12, 2019
@nicolo-ribaudo
Copy link
Member Author

TODO: Docs

@nicolo-ribaudo nicolo-ribaudo merged commit c285d54 into babel:master Mar 18, 2019
@nicolo-ribaudo nicolo-ribaudo deleted the placeholders/3-template branch March 18, 2019 20:23
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: New Feature 🚀 A type of pull request used for our changelog categories PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants