-
Fix U+30FB and U+FF65 in identifier names in ES5 vs. ES6+ (#1599)
The ES6 specification caused two code points that were previously valid in identifier names in ES5 to no longer be valid in identifier names in ES6+. The two code points are:
U+30FB
i.e.KATAKANA MIDDLE DOT
i.e.・
U+FF65
i.e.HALFWIDTH KATAKANA MIDDLE DOT
i.e.・
This means that using ES6+ parsing rules will fail to parse some valid ES5 code, and generating valid ES5 code may fail to be parsed using ES6+ parsing rules. For example, esbuild would previously fail to parse
x.y・
even though it's valid ES5 code (since it's not valid ES6+ code) and esbuild could generate{y・:x}
when minifying even though it's not valid ES6+ code (since it's valid ES5 code). This problem is the result of my incorrect assumption that ES6 is a superset of ES5.As of this release, esbuild will now parse a superset of ES5 and ES6+ and will now quote identifier names when possible if it's not considered to be a valid identifier name in either ES5 or ES6+. In other words, a union of ES5 and ES6 rules is used for parsing and the intersection of ES5 and ES6 rules is used for printing.
-
Fix
++
and--
on class private fields when used with big integers (#1600)Previously when esbuild lowered class private fields (e.g.
#foo
) to older JavaScript syntax, the transform of the++
and--
was not correct if the value is a big integer such as123n
. The transform in esbuild is similar to Babel's transform which has the same problem. Specifically, the code was transformed into code that either adds or subtracts the number1
and123n + 1
throws an exception in JavaScript. This problem has been fixed so this should now work fine starting with this release.