-
Notifications
You must be signed in to change notification settings - Fork 143
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 2020-12-03 to 2021-02-16 #632
Conversation
Codecov Report
@@ Coverage Diff @@
## main #632 +/- ##
==========================================
+ Coverage 82.16% 82.44% +0.28%
==========================================
Files 56 56
Lines 5646 5880 +234
Branches 1330 1327 -3
==========================================
+ Hits 4639 4848 +209
- Misses 724 749 +25
Partials 283 283
Continue to review full report at Codecov.
|
Benchmark resultsBefore this PR: 293 thousand lines per second Measured change: 0.51% faster (0.81% slower to 1.75% faster) |
Instructions: https://github.com/alangpierce/sucrase/wiki/Porting-changes-from-Babel's-parser Changes: 8478027d1a Make sure babel parser throws exactly same recoverable errors when estree plugin is enabled (#12375) 🚫 Only affects error handling. 3bd6a3d781 Make sure estree test should not throw if babel parser does not throw (#12443) 🚫 estree/test code not relevant to Sucrase. 285402d82f Add StaticBlock to Table of Contents in AST spec (#12449) 🚫 Docs only. 2ba9265198 Add missing semicolon in AST spec (#12454) 🚫 Docs only. b422c7f0ef [babel 8] Disallow sequence expressions in JSX expression containers (#12447) 🚫 Only affects error handling. e901454096 v7.12.10 🚫 Release only. a0c1a9a9e4 Disallow non octal decimal escape before use strict (#12366) 🚫 Only affects error handling. a1acfba387 v7.12.11 🚫 Release only. 0dbc3dd4a0 Add errorRecovery option to type definitions in babel-parser (#12564) 🚫 Type definitions only. fbef603c43 Report a SyntaxError for `}` and `>` in JSX text (#12451) 🚫 Error handling only. e8b08523f4 docs: add package-specific documentation links (#12531) 🚫 Docs only. c1473e30b2 [ts]Add optional property to OptionalCallExpression node that has type arguments (#12562) 🚫 AST only. 6c9a481e83 @babel/preset-typescript: fix tsx assigment issue (#12599) 🚫 Bug doesn't appear in Sucrase. 62290aa1ba [babel 8] Don't create `TSParenthesizedType` nodes by default (#12608) 🚫 AST only. 568679e301 fix: start TypePredicate node after returnToken (#12678) 🚫 AST only. 8fcba6eb55 Raise recoverable error for await expressions in sync functions (#12520) 🚫 Validation only. fbfd1b2aa6 fix(parser): throw error with wrong typescript 'export declare' (#12684) 🚫 Validation only. 45fdde0ce2 (ts) Throw for abstract methods in a non-abstract class (#12686) 🚫 Validation only. 8cf0a757d5 Recover from "missing semicolon" errors (#12437) 🚫 Validation only. 108564fdad refactor: raise AwaitNotInAsyncContext when an AwaitExpression will be parsed (#12716) 🚫 Validation only. ecfe20395b spec: disable await binding identifier within static block (#12661) 🚫 Validation only. 20664a430e Permit %%placeholder%% in left-hand-side of a let declaration (#12725) 🚫 Sucrase does not support placeholders. d291edbdf1 v7.12.13 🚫 Release only. 94ba66c89b fix(ts): allow abstract methods with `export default abstract class` (#12748) 🚫 Bug fix in validation code. dd18d87152 v7.12.14 🚫 Release only. d1cf66e8c1 fix(ts): include leading operator in `TSUnionType` and `TSIntersectionType` locations (#12757) 🚫 AST only. b1921d2d9b v7.12.15 🚫 Release only. eccbcca948 [TS] Create `TSUnionType` or `TSIntersectionType` when typealias has a leading operator (#12758) 🚫 AST only. bf523da0b0 fix(ts): include `asserts` in `TSTypePredicate` location (#12763) 🚫 AST only. e735266dee Avoid importing `.json` files (#12759) 🚫 Babel-internal change. d242ea04c8 babel-parser(ts): Raise recoverable error for abstract interface (#12771) 🚫 Only affects AST and error handling. f1a327506e ts: Throw recoverable for duplicates access modifier (#12775) 🚫 Validation only. c07185207c [parser] Fix scope handling of Flow declared functions (#12735) 🚫 Reported bug seems to work fine in Sucrase. The identifier role seems to be missing for flow `declare function`, but the impact is unclear, and flow support is lower priority anyway. dd5c9f958c v7.12.16 🚫 Release only. c22e72eb24 Raise recoverable error for type members with invalid modifiers (#12785) 🚫 Validation only. 4819ce70e4 refactor: fix typo in error.js (#12808) 🚫 Docs only. 8e9143f06f fix(ts): parse multiline declarations correctly (#12776) ✅ Ported the change and also added tests and better docs for `tsParseDeclaration`.
198f58d
to
b31dbd9
Compare
Instructions:
https://github.com/alangpierce/sucrase/wiki/Porting-changes-from-Babel's-parser
Changes:
8478027d1a Make sure babel parser throws exactly same recoverable errors when estree plugin is enabled (#12375)
🚫 Only affects error handling.
3bd6a3d781 Make sure estree test should not throw if babel parser does not throw (#12443)
🚫 estree/test code not relevant to Sucrase.
285402d82f Add StaticBlock to Table of Contents in AST spec (#12449)
🚫 Docs only.
2ba9265198 Add missing semicolon in AST spec (#12454)
🚫 Docs only.
b422c7f0ef [babel 8] Disallow sequence expressions in JSX expression containers (#12447)
🚫 Only affects error handling.
e901454096 v7.12.10
🚫 Release only.
a0c1a9a9e4 Disallow non octal decimal escape before use strict (#12366)
🚫 Only affects error handling.
a1acfba387 v7.12.11
🚫 Release only.
0dbc3dd4a0 Add errorRecovery option to type definitions in babel-parser (#12564)
🚫 Type definitions only.
fbef603c43 Report a SyntaxError for
}
and>
in JSX text (#12451)🚫 Error handling only.
e8b08523f4 docs: add package-specific documentation links (#12531)
🚫 Docs only.
c1473e30b2 [ts]Add optional property to OptionalCallExpression node that has type arguments (#12562)
🚫 AST only.
6c9a481e83 @babel/preset-typescript: fix tsx assigment issue (#12599)
🚫 Bug doesn't appear in Sucrase.
62290aa1ba [babel 8] Don't create
TSParenthesizedType
nodes by default (#12608)🚫 AST only.
568679e301 fix: start TypePredicate node after returnToken (#12678)
🚫 AST only.
8fcba6eb55 Raise recoverable error for await expressions in sync functions (#12520)
🚫 Validation only.
fbfd1b2aa6 fix(parser): throw error with wrong typescript 'export declare' (#12684)
🚫 Validation only.
45fdde0ce2 (ts) Throw for abstract methods in a non-abstract class (#12686)
🚫 Validation only.
8cf0a757d5 Recover from "missing semicolon" errors (#12437)
🚫 Validation only.
108564fdad refactor: raise AwaitNotInAsyncContext when an AwaitExpression will be parsed (#12716)
🚫 Validation only.
ecfe20395b spec: disable await binding identifier within static block (#12661)
🚫 Validation only.
20664a430e Permit %%placeholder%% in left-hand-side of a let declaration (#12725)
🚫 Sucrase does not support placeholders.
d291edbdf1 v7.12.13
🚫 Release only.
94ba66c89b fix(ts): allow abstract methods with
export default abstract class
(#12748)🚫 Bug fix in validation code.
dd18d87152 v7.12.14
🚫 Release only.
d1cf66e8c1 fix(ts): include leading operator in
TSUnionType
andTSIntersectionType
locations (#12757)🚫 AST only.
b1921d2d9b v7.12.15
🚫 Release only.
eccbcca948 [TS] Create
TSUnionType
orTSIntersectionType
when typealias has a leading operator (#12758)🚫 AST only.
bf523da0b0 fix(ts): include
asserts
inTSTypePredicate
location (#12763)🚫 AST only.
e735266dee Avoid importing
.json
files (#12759)🚫 Babel-internal change.
d242ea04c8 babel-parser(ts): Raise recoverable error for abstract interface (#12771)
🚫 Only affects AST and error handling.
f1a327506e ts: Throw recoverable for duplicates access modifier (#12775)
🚫 Validation only.
c07185207c [parser] Fix scope handling of Flow declared functions (#12735)
🚫 Reported bug seems to work fine in Sucrase. The identifier role seems to be missing for flow
declare function
, but theimpact is unclear, and flow support is lower priority anyway.
dd5c9f958c v7.12.16
🚫 Release only.
c22e72eb24 Raise recoverable error for type members with invalid modifiers (#12785)
🚫 Validation only.
4819ce70e4 refactor: fix typo in error.js (#12808)
🚫 Docs only.
8e9143f06f fix(ts): parse multiline declarations correctly (#12776)
✅ Ported the change and also added tests and better docs for
tsParseDeclaration
. This also surfaced other issues with thiscode, which I fixed and wrote tests for.