kibana/packages/kbn-babel-code-parser
2021-03-10 11:00:11 -05:00
..
src [6.x] Create vendor dll for the client modules (#22618) (#26707) 2018-12-05 19:48:33 +00:00
.babelrc [6.x] Create vendor dll for the client modules (#22618) (#26707) 2018-12-05 19:48:33 +00:00
package.json [6.8] Bump dependencies (#94177) 2021-03-10 11:00:11 -05:00
README.md [6.x] Create vendor dll for the client modules (#22618) (#26707) 2018-12-05 19:48:33 +00:00
yarn.lock [6.8] Add lockfile symlinks (#66212) 2020-05-13 16:13:15 -04:00

@kbn/babel-code-parser

Simple abstraction over the @babel/parser and the @babel/traverse in order to build a code parser on top.

We have two main functions parseSingleFile (sync and sync version) and the parseEntries (only async version). The first one just parse one entry file and the second one parses recursively all the files from a list of start entry points.

Then we have visitors and strategies. The first ones are basically the visitors to use into the ast from the @babel/traverse. They are the only way to collect info when using the parseSingleFile. The strategies are meant to be used with the parseEntries and configures the info we want to collect from our parsed code. After each loop, one per entry file, the parseEntries method will call the given strategy expecting that strategy would call the desired visitors, assemble the important information to collect and adds them to the final results.