Skip to content

Conversation

@sainthkh
Copy link
Contributor

@sainthkh sainthkh commented Apr 5, 2020

Description

Extract export statements from a JavaScript file.

How has this been tested?

Unit testing.

Screenshots

N/A

Types of changes

Breakdown of #21238.

Note

To incorporate type system, the AST of TypeScript is very different from other JS parsers.

To solve that problem, the simple getExportTokens() had to be re-written in this way.

const getExportTokens = ( ast ) =>
ast.body.filter( ( node ) =>
[
'ExportNamedDeclaration',
'ExportDefaultDeclaration',
'ExportAllDeclaration',
].some( ( declaration ) => declaration === node.type )
);

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • [N/A] My code follows the accessibility standards.
  • My code has proper inline documentation.
  • [N/A] I've included developer documentation if appropriate.
  • [N/A] I've updated all React Native files affected by any refactorings/renamings in this PR.

@sainthkh sainthkh requested a review from oandregal as a code owner April 5, 2020 09:35
@sainthkh sainthkh changed the title [Docgen-TypeScript] Add getExportStatement() [docgen-ts] Add getExportStatement() Apr 5, 2020
@sainthkh sainthkh force-pushed the docgen-ts/get-export-statement branch from ef12ac9 to f32cc6f Compare April 5, 2020 09:56
@sainthkh sainthkh force-pushed the docgen-ts/get-export-statement branch from f32cc6f to 2f9c885 Compare April 5, 2020 10:40
@sainthkh
Copy link
Contributor Author

Close because we decided to use babel instead.

@sainthkh sainthkh closed this Apr 29, 2020
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.

1 participant