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

Always print directives with double quotes when minified #14094

Merged
merged 1 commit into from Jan 6, 2022

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Jan 1, 2022

Q                       A
Fixed Issues? n/a
Patch: Bug Fix? Yes
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? Yes
Documentation PR Link n/a
Any Dependency Changes? No
License MIT

@babel/generator outputs all strings with double quotes when minified option is enabled - presumably because it gzips better with consistent quotes.

This PR makes generator do the same for directives.

generate( parse("'use strict';").program.directives[0], { minified: true } ).code

Result before: 'use strict';
Result after: "use strict";

@JLHwung JLHwung added pkg: generator PR: Polish 💅 A type of pull request used for our changelog categories labels Jan 6, 2022
@nicolo-ribaudo nicolo-ribaudo changed the title generator convert directives single quotes to double when minified Always print directives with double quotes when minified Jan 6, 2022
@nicolo-ribaudo nicolo-ribaudo merged commit 3942d72 into babel:main Jan 6, 2022
@nicolo-ribaudo
Copy link
Member

I slightly reworded the PR title so that it fits in a commit header (it was too long when adding (#14094)).

@overlookmotel
Copy link
Contributor Author

Thanks both!

@overlookmotel overlookmotel deleted the directive-quotes branch January 6, 2022 16:33
overlookmotel added a commit to overlookmotel/livepack that referenced this pull request Jan 18, 2022
overlookmotel added a commit to overlookmotel/livepack that referenced this pull request Jan 18, 2022
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Apr 8, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2022
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 pkg: generator PR: Polish 💅 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants