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

Update transform-unicode-escapes test to output minimal strings #11721

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Jun 15, 2020

Q                       A
Fixed Issues?
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? next-8-dev is currently failing; this PR fixes it.
Documentation PR Link
Any Dependency Changes?
License MIT

While merging master into next-8-dev, I noticed that #11384 and #11377 are incompatible with eachother.

This PR attemps to fix it by setting jsescOption.minimal: false when using transform-unicode-escapes.

@nicolo-ribaudo nicolo-ribaudo added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Jun 15, 2020
manipulateOptions(opts) {
opts.generatorOpts.jsescOption = {
minimal: false,
...opts.generatorOpts.jsescOption,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I swap these lines? Or throw an error if jsescOption is set to true?

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 15, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit cd52a04:

Sandbox Source
relaxed-galileo-ye1k8 Configuration
peaceful-liskov-tsw4x Configuration

@babel-bot
Copy link
Collaborator

babel-bot commented Jun 15, 2020

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

Copy link
Member

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think this is fine to leave as is. Given:

// Input
const \u{1d49c} = "\u{1d49c}";

// minimal: false (this PR)
var _ud835_udc9c = "\uD835\uDC9C";

// minimal: true (current next-8)
var _ud835_udc9c = "𝒜";

The non-ASCII 𝒜 inside strings is actually fine, and well-supported back to ES5 browsers. That's actually a valid transform we could have done with #11377.

@nicolo-ribaudo nicolo-ribaudo force-pushed the minimal-strings-transform-escapes-compatibility branch from 10bad01 to cd52a04 Compare June 18, 2020 20:03
Copy link
Member

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing these!

@nicolo-ribaudo nicolo-ribaudo changed the title Do not output minimal strings when using transform-unicode-escapes Update transform-unicode-escapes test to output minimal strings Jun 18, 2020
@nicolo-ribaudo nicolo-ribaudo merged commit 831297f into babel:next-8-dev Jun 18, 2020
@nicolo-ribaudo nicolo-ribaudo deleted the minimal-strings-transform-escapes-compatibility branch June 18, 2020 22:08
@nicolo-ribaudo nicolo-ribaudo added area: tests and removed PR: Bug Fix 🐛 A type of pull request used for our changelog categories labels Jun 18, 2020
@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 Sep 18, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: tests outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants