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 2022-10-26 to 2022-12-22 #785

Merged
merged 4 commits into from Mar 20, 2023

Conversation

alangpierce
Copy link
Owner

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

dfc4b61856 Parse import reflection (#14926)
✅ Implemented a basic version with tests, without any attempt at CJS support or type import support since the behavior appears unspecified at this point.

83009601f4 Parse using declaration (explicit resource management) (#14968)
✅ Implemented in a similar way with some simplifications since error handling isn't necessary.

04509a3be6 v7.20.0
🚫 Release only.

292e5d6b67 fix: parse a satisfies b as left value (#15096)
✅ Already worked, but added a test.

283720d252 fix: Parse re-declare var in class static body (#15102)
🚫 Error handling bug that didn't affect Sucrase.

cfc453276a Fix(estree): Reset export's start after decorator (#15107)
🚫 estree not relevant to Sucrase.

1893249b67 v7.20.1
🚫 Release only.

b5a6931c23 fix: parser typings for plugins (#15094)
🚫 Babel-internal change.

12a58cb58c v7.20.2
🚫 Release only.

ce09a269d8 fix: support await as for-of-lhs (#15134)
🚫 Sucrase assumes modules, and await is a reserved word in modules.

7c9a8015fe v7.20.3
🚫 Release only.

5fde28b37e fix: Babel 8 types (#15109)
🚫 Babel-internal change.

4dedd57f64 fix: parse import module, ... (#15198)
✅ Fixed in implementation above.

f6546d79d4 Bump typescript to 4.9.3 (#15202)
🚫 Babel-internal change.

4c59d9fb2c Export ParseResult type (#15207)
🚫 Babel-internal change.

4369b33100 Parse using[foo] as computed member expression (#15225)
✅ Fixed with a simpler lookahead approach.

29a97b8ea2 v7.20.5
🚫 Release only.

f543b61bab refactor: remove ModuleDeclaration usage (#15236)
🚫 AST only.

362451b764 chore: Enable eslint rule no-unnecessary-type-assertion (#15260)
🚫 Babel-internal change.

1203f1858d chore: Clean up parser comments (#15252)
🚫 Babel-internal change.

3a71c79a56 fix: Support auto accessors with TypeScript annotations (#15209)
✅ This was already working in Sucrase, but added a test.

d414940e4c v7.20.7
🚫 Release only.

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

dfc4b61856 Parse import reflection (#14926)
✅ Implemented a basic version with tests, without any attempt at CJS support or type import support since the behavior appears unspecified at this point.

83009601f4 Parse `using` declaration (explicit resource management) (#14968)
✅ Implemented in a similar way with some simplifications since error handling isn't necessary.

04509a3be6 v7.20.0
🚫 Release only.

292e5d6b67 fix: parse `a satisfies b` as left value (#15096)
✅ Already worked, but added a test.

283720d252 fix: Parse re-declare var in class static body  (#15102)
🚫 Error handling bug that didn't affect Sucrase.

cfc453276a Fix(estree): Reset export's start after decorator (#15107)
🚫 estree not relevant to Sucrase.

1893249b67 v7.20.1
🚫 Release only.

b5a6931c23 fix: `parser` typings for plugins (#15094)
🚫 Babel-internal change.

12a58cb58c v7.20.2
🚫 Release only.

ce09a269d8 fix: support await as for-of-lhs (#15134)
🚫 Sucrase assumes modules, and `await` is a reserved word in modules.

7c9a8015fe v7.20.3
🚫 Release only.

5fde28b37e fix: Babel 8 types (#15109)
🚫 Babel-internal change.

4dedd57f64 fix: parse `import module, ...` (#15198)
✅ Fixed in implementation above.

f6546d79d4 Bump typescript to 4.9.3 (#15202)
🚫 Babel-internal change.

4c59d9fb2c Export `ParseResult` type (#15207)
🚫 Babel-internal change.

4369b33100 Parse `using[foo]` as computed member expression (#15225)
✅ Fixed with a simpler lookahead approach.

29a97b8ea2 v7.20.5
🚫 Release only.

f543b61bab refactor: remove ModuleDeclaration usage (#15236)
🚫 AST only.

362451b764 chore: Enable eslint rule `no-unnecessary-type-assertion` (#15260)
🚫 Babel-internal change.

1203f1858d chore: Clean up `parser` comments (#15252)
🚫 Babel-internal change.

3a71c79a56 fix: Support auto accessors with TypeScript annotations (#15209)
✅ This was already working in Sucrase, but added a test.

d414940e4c v7.20.7
🚫 Release only.
@codecov
Copy link

codecov bot commented Mar 19, 2023

Codecov Report

Merging #785 (b06d6ac) into main (bf0af52) will increase coverage by 0.52%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #785      +/-   ##
==========================================
+ Coverage   87.61%   88.14%   +0.52%     
==========================================
  Files          55       55              
  Lines        5888     5915      +27     
  Branches     1395     1404       +9     
==========================================
+ Hits         5159     5214      +55     
+ Misses        461      434      -27     
+ Partials      268      267       -1     
Impacted Files Coverage Δ
src/parser/tokenizer/readWordTree.ts 100.00% <ø> (ø)
src/parser/plugins/typescript.ts 90.21% <100.00%> (+2.72%) ⬆️
src/parser/tokenizer/keywords.ts 100.00% <100.00%> (ø)
src/parser/traverser/statement.ts 85.30% <100.00%> (+1.22%) ⬆️
src/transformers/ESMImportTransformer.ts 94.96% <100.00%> (+0.09%) ⬆️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link

github-actions bot commented Mar 19, 2023

Benchmark results

Before this PR: 390.1 thousand lines per second
After this PR: 389.8 thousand lines per second

Measured change: 0.08% slower (1.19% slower to 0% slower)
Summary: Probably slower

@alangpierce alangpierce merged commit c65dd7b into main Mar 20, 2023
8 checks passed
@alangpierce alangpierce deleted the port-babel-parser-2022-10-26-to-2022-12-22 branch March 20, 2023 04:20
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