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
Port babel-parser changes from 2021-07-02 to 2021-08-14 #673
Conversation
Codecov Report
@@ Coverage Diff @@
## main #673 +/- ##
==========================================
+ Coverage 84.72% 84.73% +0.01%
==========================================
Files 54 54
Lines 5767 5771 +4
Branches 1313 1314 +1
==========================================
+ Hits 4886 4890 +4
Misses 597 597
Partials 284 284
π£ Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
Benchmark resultsBefore this PR: 282.3 thousand lines per second Measured change: 0.52% faster (0.61% slower to 0.74% faster) |
Instructions: https://github.com/alangpierce/sucrase/wiki/Porting-changes-from-Babel's-parser 9bad558d13 [babel 8] Use an identifier for `TSTypeParameter.name` (#12829) π« AST-only. bfd2f8f4b1 fix: disallow computed `async`/`get`/`set` keyword (#13531) π« Validation only. 8a3e0fd960 Async do expression should start at async (#13534) π« AST only. 79d3276f61 Overhaul comment attachment (#13521) π« AST only. 6e57617138 Fix await binding error within static block (#13088) π« Only affects validation and babel-parser scopes, which aren't in Sucrase. 2c6db56696 Allow module block to start a member expression (#13573) π« Module blocks aren't supported yet, tracked in #634 dd942f92af fix: parser `strictMode` option (#13548) π« Option isn't relevant to Sucrase. 22b2f4fc02 Update babel-parser.d.ts (#13575) π« Babel-specific types only. e591780244 v7.14.8 π« Release only. 4a56387330 ts: Check if param is assignable when parsing arrow return type (#13581) β Added test and implemented by re-parsing as a non-arrow-function if we get an error. Fixes #631. Fixes #666. e4de256cdd chore: reorganize benchmarks (#13606) π« Code not relevant to Sucrase. d3a7cd5e8d Replace generic `__clone` call by specific methods (#13611) π« Only affects ASTs. aa2cac5edc v7.14.9 π« Release only. b3ab4769d0 fix(ts): raise error for `export default interface {}` (#13622) π« Validation only. a254ea38a4 Enable ergonomic brand checks (`#priv in`) by default (#13554) π« Already works by default in Sucrase. 6276853eb9 Add support for the "Hack" pipeline proposal (#13191) π« Already works with Sucrase. This babel-parser change updates error handling (not relevant for Sucrase) and switches the default topic reference token to `%`, but more recent discussions have decided against that one. cd4b3fbffe parser: Fix Hack/smart-pipe error positions (#13426) π« AST only. 35e4e1f067 Hack-pipe proposal with `%` topic token (#13416) π« Changes are only to AST, error handling, and `%` topic reference token support. ff287ac5a5 Fix `%==` parsing in hack pipes (#13536) π« Only affects outdated `%` topic reference tokens. c35637e247 feat(ts): raise error for abstract property with initializer (#13523) π« Validation only. ddaf0d4296 Enable top-level `await` parsing by default (#13387) π« Already enabled by default in Sucrase. d5b0d9e33d Add `attachComment` parser option to disable comment attachment (#13229) π« Not relevant to Sucrase. 0671afcf87 [ts] support optional chain call with generic (#13513) π« Already works and has tests. 6912f968a6 v7.15.0 π« Release only. f9dcc4e4bb Fix array destructuring elision parsing in TS arrow functions (#13641) π« Regression that wasn't introduced in Sucrase. e294beb3ac Add `.errors` to the `@babel/parser` return type definitions (#13653) π« Type definitions only. 084870faad v7.15.2 π« Release only. 8a09993e39 fix(parser): add `attachComment` to `ParserOptions` type (#13657) π« Type definitions only. da1d166ea6 perf: minor tokenizer tweaks (#13652) π« Optimizations not relevant to Sucrase. 9d0aa1ec9d Disallow `<T>(a => b)` when parsing Flow (#13645) π« Validation only. e721f61110 [flow] Fix parsing of arrows in conditional exprs in parens (#13655) β Seems to be fixed by above fix. I added a regression test. 1229336fea Fix parse error when using named import "as" with flow parser (#13659) β Added test and ported fix in fairly direct way. 9286cdb072 Re-enable disabled flow parser test (#13661) π« Test only. a5624ea457 v7.15.3 π« Test only. 10640b2aad perf: partially replace `.concat` with `.push` (#13609) π« Sucrase doesn't use `.concat`.
3691bda
to
cf849ab
Compare
) Instructions: https://github.com/alangpierce/sucrase/wiki/Porting-changes-from-Babel's-parser 9bad558d13 [babel 8] Use an identifier for `TSTypeParameter.name` (#12829) π« AST-only. bfd2f8f4b1 fix: disallow computed `async`/`get`/`set` keyword (#13531) π« Validation only. 8a3e0fd960 Async do expression should start at async (#13534) π« AST only. 79d3276f61 Overhaul comment attachment (#13521) π« AST only. 6e57617138 Fix await binding error within static block (#13088) π« Only affects validation and babel-parser scopes, which aren't in Sucrase. 2c6db56696 Allow module block to start a member expression (#13573) π« Module blocks aren't supported yet, tracked in alangpierce#634 dd942f92af fix: parser `strictMode` option (#13548) π« Option isn't relevant to Sucrase. 22b2f4fc02 Update babel-parser.d.ts (#13575) π« Babel-specific types only. e591780244 v7.14.8 π« Release only. 4a56387330 ts: Check if param is assignable when parsing arrow return type (#13581) β Added test and implemented by re-parsing as a non-arrow-function if we get an error. Fixes alangpierce#631. Fixes alangpierce#666. e4de256cdd chore: reorganize benchmarks (#13606) π« Code not relevant to Sucrase. d3a7cd5e8d Replace generic `__clone` call by specific methods (#13611) π« Only affects ASTs. aa2cac5edc v7.14.9 π« Release only. b3ab4769d0 fix(ts): raise error for `export default interface {}` (#13622) π« Validation only. a254ea38a4 Enable ergonomic brand checks (`#priv in`) by default (#13554) π« Already works by default in Sucrase. 6276853eb9 Add support for the "Hack" pipeline proposal (#13191) π« Already works with Sucrase. This babel-parser change updates error handling (not relevant for Sucrase) and switches the default topic reference token to `%`, but more recent discussions have decided against that one. cd4b3fbffe parser: Fix Hack/smart-pipe error positions (#13426) π« AST only. 35e4e1f067 Hack-pipe proposal with `%` topic token (#13416) π« Changes are only to AST, error handling, and `%` topic reference token support. ff287ac5a5 Fix `%==` parsing in hack pipes (#13536) π« Only affects outdated `%` topic reference tokens. c35637e247 feat(ts): raise error for abstract property with initializer (#13523) π« Validation only. ddaf0d4296 Enable top-level `await` parsing by default (#13387) π« Already enabled by default in Sucrase. d5b0d9e33d Add `attachComment` parser option to disable comment attachment (#13229) π« Not relevant to Sucrase. 0671afcf87 [ts] support optional chain call with generic (#13513) π« Already works and has tests. 6912f968a6 v7.15.0 π« Release only. f9dcc4e4bb Fix array destructuring elision parsing in TS arrow functions (#13641) π« Regression that wasn't introduced in Sucrase. e294beb3ac Add `.errors` to the `@babel/parser` return type definitions (#13653) π« Type definitions only. 084870faad v7.15.2 π« Release only. 8a09993e39 fix(parser): add `attachComment` to `ParserOptions` type (#13657) π« Type definitions only. da1d166ea6 perf: minor tokenizer tweaks (#13652) π« Optimizations not relevant to Sucrase. 9d0aa1ec9d Disallow `<T>(a => b)` when parsing Flow (#13645) π« Validation only. e721f61110 [flow] Fix parsing of arrows in conditional exprs in parens (#13655) β Seems to be fixed by above fix. I added a regression test. 1229336fea Fix parse error when using named import "as" with flow parser (#13659) β Added test and ported fix in fairly direct way. 9286cdb072 Re-enable disabled flow parser test (#13661) π« Test only. a5624ea457 v7.15.3 π« Test only. 10640b2aad perf: partially replace `.concat` with `.push` (#13609) π« Sucrase doesn't use `.concat`.
Instructions: https://github.com/alangpierce/sucrase/wiki/Porting-changes-from-Babel's-parser
9bad558d13 [babel 8] Use an identifier for
TSTypeParameter.name
(#12829)π« AST-only.
bfd2f8f4b1 fix: disallow computed
async
/get
/set
keyword (#13531)π« Validation only.
8a3e0fd960 Async do expression should start at async (#13534)
π« AST only.
79d3276f61 Overhaul comment attachment (#13521)
π« AST only.
6e57617138 Fix await binding error within static block (#13088)
π« Only affects validation and babel-parser scopes, which aren't in Sucrase.
2c6db56696 Allow module block to start a member expression (#13573)
π« Module blocks aren't supported yet, tracked in #634
dd942f92af fix: parser
strictMode
option (#13548)π« Option isn't relevant to Sucrase.
22b2f4fc02 Update babel-parser.d.ts (#13575)
π« Babel-specific types only.
e591780244 v7.14.8
π« Release only.
4a56387330 ts: Check if param is assignable when parsing arrow return type (#13581)
β Added test and implemented by re-parsing as a non-arrow-function if we get an error. Fixes #631. Fixes #666.
e4de256cdd chore: reorganize benchmarks (#13606)
π« Code not relevant to Sucrase.
d3a7cd5e8d Replace generic
__clone
call by specific methods (#13611)π« Only affects ASTs.
aa2cac5edc v7.14.9
π« Release only.
b3ab4769d0 fix(ts): raise error for
export default interface {}
(#13622)π« Validation only.
a254ea38a4 Enable ergonomic brand checks (
#priv in
) by default (#13554)π« Already works by default in Sucrase.
6276853eb9 Add support for the "Hack" pipeline proposal (#13191)
π« Already works with Sucrase. This babel-parser change updates error handling (not relevant for Sucrase) and switches the default topic reference token to
%
, but more recent discussions have decided against that one.cd4b3fbffe parser: Fix Hack/smart-pipe error positions (#13426)
π« AST only.
35e4e1f067 Hack-pipe proposal with
%
topic token (#13416)π« Changes are only to AST, error handling, and
%
topic reference token support.ff287ac5a5 Fix
%==
parsing in hack pipes (#13536)π« Only affects outdated
%
topic reference tokens.c35637e247 feat(ts): raise error for abstract property with initializer (#13523)
π« Validation only.
ddaf0d4296 Enable top-level
await
parsing by default (#13387)π« Already enabled by default in Sucrase.
d5b0d9e33d Add
attachComment
parser option to disable comment attachment (#13229)π« Not relevant to Sucrase.
0671afcf87 [ts] support optional chain call with generic (#13513)
π« Already works and has tests.
6912f968a6 v7.15.0
π« Release only.
f9dcc4e4bb Fix array destructuring elision parsing in TS arrow functions (#13641)
π« Regression that wasn't introduced in Sucrase.
e294beb3ac Add
.errors
to the@babel/parser
return type definitions (#13653)π« Type definitions only.
084870faad v7.15.2
π« Release only.
8a09993e39 fix(parser): add
attachComment
toParserOptions
type (#13657)π« Type definitions only.
da1d166ea6 perf: minor tokenizer tweaks (#13652)
π« Optimizations not relevant to Sucrase.
9d0aa1ec9d Disallow
<T>(a => b)
when parsing Flow (#13645)π« Validation only.
e721f61110 [flow] Fix parsing of arrows in conditional exprs in parens (#13655)
β Seems to be fixed by above fix. I added a regression test.
1229336fea Fix parse error when using named import "as" with flow parser (#13659)
β Added test and ported fix in fairly direct way.
9286cdb072 Re-enable disabled flow parser test (#13661)
π« Test only.
a5624ea457 v7.15.3
π« Test only.
10640b2aad perf: partially replace
.concat
with.push
(#13609)π« Sucrase doesn't use
.concat
.