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

Support UTF string encodings #55

Merged
merged 5 commits into from
Apr 28, 2021
Merged

Support UTF string encodings #55

merged 5 commits into from
Apr 28, 2021

Conversation

guybedford
Copy link
Collaborator

@guybedford guybedford commented Apr 28, 2021

This supports decoding UTF encodings like "\u{...}" in all JS strings.

To avoid needing to write a custom parser, the JS engine parser is invoked safely using eval, based on the knowledge that the parsed range is definitely a JS string.

This implements string decoding for the string cases of reexport specifier strings, export strings, and require strings.

This does not add support for identifier encodings or filtering for non-surrogate pairs.

Copy link
Contributor

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

I initially thought about using JSON.parse + custom handling of \u{..}, but eval is definitely better for once!

src/lexer.js Outdated Show resolved Hide resolved
test/_unit.js Outdated Show resolved Hide resolved
test/_unit.js Outdated Show resolved Hide resolved
@guybedford guybedford merged commit 47d061a into master Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants