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

Port babel-parser changes from 2021-04-28 to 2021-07-02 #637

Merged
merged 1 commit into from Jul 7, 2021

Conversation

alangpierce
Copy link
Owner

Instructions: https://github.com/alangpierce/sucrase/wiki/Porting-changes-from-Babel's-parser

b116865077 Use this.isThisParam in typescript parser (#13163)
🚫 Refactor not directly relevant to Sucrase.

ceaab0bae7 Parse class fields and private methods by default (#13175)
🚫 Sucrase doesn't gate ES features.

57daba85aa Parse string export names by default (moduleStringNames) (#13195)
🚫 Sucrase doesn't gate ES features.

8433cd0c05 Support parsing Flow's Optional Indexed Access Types (#13224)
βœ… Straightforward port, didn't seem to need the lexer change.

22b0eb038f [ts] Enforce order for the override modifier (#13209)
🚫 TS only.

7f5b212322 babel-parser: Add new typescript plugin option dts: boolean (#13113)
🚫 Only affects error handling.

28d7442aae Parse async do expressions (#13043)
βœ… Ported in a similar way.

a2ac2f39b5 Update @babel/parser fixtures
🚫 Tests only.

0f2a1a8153 Add runFixtureTestsWithoutExactASTMatch in parser test runner (#13227)
🚫 Only affects test infra.

3c0152a217 v7.14.0
🚫 Release only.

2a3e35f026 chore: remove duplicate test262 parser tests (#13241)
🚫 Only affects tests.

fa01fbe052 Parse for await (async of ...) (#13244)
🚫 This feels like unreasonable enough code and enough parser complexity that it feels probably fine to not support in Sucrase, at least for now.

175a51f94e Don't use "composite": true in tsc (until it supports cycles) (#13242)
🚫 Babel-internal.

ef87648f3f Parse static blocks with typescript plugin (#13243)
🚫 Seems to be working fine from my testing.

3ecc7919c5 v7.14.1
🚫 Release only.

278193b6f7 fix: update chunkStart on missing unicode escape (#13261)
🚫 Code not relevant to Sucrase.

a387973821 Refactor private name tokenizing (#13256)
🚫 I'll skip the refactor for now, the benefits don't currently seem compelling.

a8fea4037d Faster identifier tokenizing (#13262)
🚫 I'll skip the refactor for now, the benefits don't currently seem compelling.

1d54419ec4 Parse attributes of import expression with estree plugin (#13284)
🚫 Sucrase doesn't support estree.

b2d9156cc6 Update to Prettier 2.3 (#13288)
🚫 Babel-internal.

7512095c84 v7.14.2
🚫 Release only.

b3d35cd412 [Babel 8]: remove module attributes parser/generator support (#13308)
🚫 Wasn't in Sucrase in the first place.

c2181343f1 Parse let declarations whose id starts with \ (#13325)
🚫 Bug doesn't affect Sucrase.

0d0950f341 fix: preserve tokensLength in tryParse (#13326)
🚫 Only affects recovery mode.

1487a46dd5 v7.14.3
🚫 Release only.

2a5b23186a perf: minimize identifier lookahead when parsing let (#13328)
🚫 Sucrase doesn't special-case the let keyword.

461ba2531a refactor: add parse*Literal parser routines (#13333)
🚫 Benefits don't seem relevant for Sucrase.

d6a5f6190d [ts] Default typeAnnotation of TSTypePredicate to null (#13354)
🚫 AST only.

acf2a10899 Faster tokenizer lookahead (#13341)
🚫 Doesn't seem worth porting for now, unclear if it really applies as-is in Sucrase.

079f8cd5bc fix: disallow surrogate in the end of contextual name (#13377)
🚫 Code not relevant for Sucrase.

1341e560ff Skip flow/typecasts/3 test on Node.js 6 (#13382)
🚫 Babel-internal.

219fd3ab1f v7.14.4
🚫 Release only.

0b29b5c2c0 Add support for d flag of regex literals in parser (#13396)
🚫 Already works in Sucrase.

140ec5aa5c chore: setup Yarn constraints (#13363)
🚫 Babel-internal.

ae3f5d905a Back parser state exportedIdentifiers by set (#13406)
🚫 Not relevant to Sucrase.

cbad50ac1d Faster checkReservedWord (#13386)
🚫 Sucrase does reserved word checking using readWordTree, which is likely faster.

b281fe352c Use set in parser scope (#13408)
🚫 Code path not relevant to Sucrase.

b8175ec060 Relax import assertion key-is-type constraint (#13409)
🚫 Validation only.

a0369fdbfa fix: throw when async() call param is object with assignement (#13410)
🚫 Validation only.

56db172b0e fix(@babel/parser): fix tokenizer context update code (#13422)
🚫 Code not relevant to Sucrase.

a64d08c101 fix(parser): correctly parse record and tuple tokens (#13418)
🚫 Holding off on an implementation for now.

b9c1884a58 Reduce exprAllowed usage (#13431)
🚫 This tokenizer code no longer exists in Sucrase.

d3f4c22c28 update test fixtures (#13440)
🚫 Babel-internal.

7a2a928398 v7.14.5
🚫 Release only.

b1fe831e4a fix: disallow JSX tag after non-null assertion (#13449)
🚫 Bug doesn't appear to come up in Sucrase.

0eb2853732 [ts] Support override modifiers for parameter properties (#13428)
βœ… Ported basic change by allowing override in that position.

6c8b2336f6 Faster readRegexp (#13453)
🚫 Many of the optimizations have been applied already.

1774e2aaef v7.14.6
🚫 Release only.

101249f3aa refactor(parser): remove refNeedsArrowPos (#13419)
🚫 Already removed from Sucrase.

5145c98a73 Simplify token context (#13450)
🚫 Sucrase already removed token context.

268e4ca0de v7.14.7
🚫 Release only.

b0fe6bdbc3 chore(parser): add test to handle optional paramteter in async call (#13504)
🚫 Test only.

e6068cd9a5 enhance benchmark output with thousands separators (#13512)
🚫 Babel-internal.

9bad558d13 [babel 8] Use an identifier for TSTypeParameter.name (#12829)
🚫 AST-only.

Instructions: https://github.com/alangpierce/sucrase/wiki/Porting-changes-from-Babel's-parser

b116865077 Use this.isThisParam in typescript parser (#13163)
🚫 Refactor not directly relevant to Sucrase.

ceaab0bae7 Parse class fields and private methods by default (#13175)
🚫 Sucrase doesn't gate ES features.

57daba85aa Parse string export names by default (`moduleStringNames`) (#13195)
🚫 Sucrase doesn't gate ES features.

8433cd0c05 Support parsing Flow's Optional Indexed Access Types (#13224)
βœ… Straightforward port, didn't seem to need the lexer change.

22b0eb038f [ts] Enforce order for the `override` modifier (#13209)
🚫 TS only.

7f5b212322 babel-parser: Add new `typescript` plugin option `dts: boolean` (#13113)
🚫 Only affects error handling.

28d7442aae Parse async do expressions (#13043)
βœ… Ported in a similar way.

a2ac2f39b5 Update `@babel/parser` fixtures
🚫 Tests only.

0f2a1a8153 Add `runFixtureTestsWithoutExactASTMatch` in parser test runner (#13227)
🚫 Only affects test infra.

3c0152a217 v7.14.0
🚫 Release only.

2a3e35f026 chore: remove duplicate test262 parser tests (#13241)
🚫 Only affects tests.

fa01fbe052 Parse `for await (async of ...)` (#13244)
🚫 This feels like unreasonable enough code and enough parser complexity that it feels probably fine to not support in Sucrase, at least for now.

175a51f94e Don't use `"composite": true` in tsc (until it supports cycles)  (#13242)
🚫 Babel-internal.

ef87648f3f Parse static blocks with typescript plugin (#13243)
🚫 Seems to be working fine from my testing.

3ecc7919c5 v7.14.1
🚫 Release only.

278193b6f7 fix: update chunkStart on missing unicode escape (#13261)
🚫 Code not relevant to Sucrase.

a387973821 Refactor private name tokenizing (#13256)
🚫 I'll skip the refactor for now, the benefits don't currently seem compelling.

a8fea4037d Faster identifier tokenizing (#13262)
🚫 I'll skip the refactor for now, the benefits don't currently seem compelling.

1d54419ec4 Parse attributes of import expression with estree plugin (#13284)
🚫 Sucrase doesn't support estree.

b2d9156cc6 Update to Prettier 2.3 (#13288)
🚫 Babel-internal.

7512095c84 v7.14.2
🚫 Release only.

b3d35cd412 [Babel 8]: remove module attributes parser/generator support (#13308)
🚫 Wasn't in Sucrase in the first place.

c2181343f1 Parse `let` declarations whose id starts with `\` (#13325)
🚫 Bug doesn't affect Sucrase.

0d0950f341 fix: preserve tokensLength in tryParse (#13326)
🚫 Only affects recovery mode.

1487a46dd5 v7.14.3
🚫 Release only.

2a5b23186a perf: minimize identifier lookahead when parsing let (#13328)
🚫 Sucrase doesn't special-case the let keyword.

461ba2531a refactor: add parse*Literal parser routines (#13333)
🚫 Benefits don't seem relevant for Sucrase.

d6a5f6190d [ts] Default `typeAnnotation` of `TSTypePredicate` to `null` (#13354)
🚫 AST only.

acf2a10899 Faster tokenizer lookahead (#13341)
🚫 Doesn't seem worth porting for now, unclear if it really applies as-is in Sucrase.

079f8cd5bc fix: disallow surrogate in the end of contextual name (#13377)
🚫 Code not relevant for Sucrase.

1341e560ff Skip `flow/typecasts/3` test on Node.js 6 (#13382)
🚫 Babel-internal.

219fd3ab1f v7.14.4
🚫 Release only.

0b29b5c2c0 Add support for d flag of regex literals in parser (#13396)
🚫 Already works in Sucrase.

140ec5aa5c chore: setup Yarn constraints (#13363)
🚫 Babel-internal.

ae3f5d905a Back parser state `exportedIdentifiers` by set (#13406)
🚫 Not relevant to Sucrase.

cbad50ac1d Faster checkReservedWord (#13386)
🚫 Sucrase does reserved word checking using readWordTree, which is likely faster.

b281fe352c Use set in parser scope (#13408)
🚫 Code path not relevant to Sucrase.

b8175ec060 Relax import assertion key-is-type constraint (#13409)
🚫 Validation only.

a0369fdbfa fix: throw when `async()` call param is object with assignement (#13410)
🚫 Validation only.

56db172b0e fix(`@babel/parser`): fix tokenizer context update code (#13422)
🚫 Code not relevant to Sucrase.

a64d08c101 fix(parser): correctly parse record and tuple tokens (#13418)
🚫 Holding off on an implementation for now.

b9c1884a58 Reduce `exprAllowed` usage (#13431)
🚫 This tokenizer code no longer exists in Sucrase.

d3f4c22c28 update test fixtures (#13440)
🚫 Babel-internal.

7a2a928398 v7.14.5
🚫 Release only.

b1fe831e4a fix: disallow JSX tag after non-null assertion (#13449)
🚫 Bug doesn't appear to come up in Sucrase.

0eb2853732 [ts] Support override modifiers for parameter properties (#13428)
βœ… Ported basic change by allowing override in that position.

6c8b2336f6 Faster readRegexp (#13453)
🚫 Many of the optimizations have been applied already.

1774e2aaef v7.14.6
🚫 Release only.

101249f3aa refactor(parser): remove refNeedsArrowPos (#13419)
🚫 Already removed from Sucrase.

5145c98a73 Simplify token context (#13450)
🚫 Sucrase already removed token context.

268e4ca0de v7.14.7
🚫 Release only.

b0fe6bdbc3 chore(parser): add test to handle optional paramteter in async call (#13504)
🚫 Test only.

e6068cd9a5 enhance benchmark output with thousands separators (#13512)
🚫 Babel-internal.

9bad558d13 [babel 8] Use an identifier for `TSTypeParameter.name` (#12829)
🚫 AST-only.
@codecov
Copy link

codecov bot commented Jul 7, 2021

Codecov Report

Merging #637 (af86256) into main (45d20de) will increase coverage by 0.00%.
The diff coverage is 83.33%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #637   +/-   ##
=======================================
  Coverage   82.57%   82.58%           
=======================================
  Files          56       56           
  Lines        5686     5689    +3     
  Branches     1342     1343    +1     
=======================================
+ Hits         4695     4698    +3     
  Misses        708      708           
  Partials      283      283           
Impacted Files Coverage Ξ”
src/parser/plugins/typescript.ts 85.42% <ΓΈ> (+0.09%) ⬆️
src/parser/traverser/lval.ts 98.57% <ΓΈ> (ΓΈ)
src/parser/plugins/flow.ts 65.07% <50.00%> (-0.13%) ⬇️
src/parser/traverser/expression.ts 88.49% <100.00%> (+0.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data
Powered by Codecov. Last update 45d20de...af86256. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Jul 7, 2021

Benchmark results

Before this PR: 300 thousand lines per second
After this PR: 298.3 thousand lines per second

Measured change: 0.56% slower (2.9% slower to 0% faster)
Summary: Likely no significant difference

@alangpierce alangpierce merged commit 35b1723 into main Jul 7, 2021
@alangpierce alangpierce deleted the port-babel-parser-2021-04-28-to-2021-07-02 branch July 7, 2021 07:27
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.

None yet

1 participant