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

fix non-bmp characters in identifier validation #1139

Merged
merged 1 commit into from
Apr 11, 2021
Merged

fix non-bmp characters in identifier validation #1139

merged 1 commit into from
Apr 11, 2021

Conversation

evanw
Copy link
Owner

@evanw evanw commented Apr 11, 2021

Property names in object literals do not have to be quoted if the property is a valid JavaScript identifier. This is defined as starting with a character in the ID_Start Unicode category and ending with zero or more characters in the ID_Continue Unicode category. However, esbuild had a bug where non-BMP characters (i.e. characters encoded using two UTF-16 code units instead of one) were always checked against ID_Continue instead of ID_Start because they included a code unit that wasn't at the start. This could result in invalid JavaScript being generated when using --charset=utf8 because ID_Continue is a superset of ID_Start and contains some characters that are not valid at the start of an identifier. This bug has been fixed.

Fixes #977

@evanw evanw merged commit eac9513 into master Apr 11, 2021
@evanw evanw deleted the issues/977 branch April 11, 2021 22:17
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.

Bare unicode characters after bundle of json
1 participant