kibana/packages/kbn-babel-code-parser
Kibana Machine c635144ebe
chore(NA): correctly setup dep order on js_library to fix windows build (#100420) (#100428)
Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
2021-05-20 20:57:21 -04:00
..
src [7.x] Elastic License 2.0 (#90192) 2021-02-03 18:39:13 -08:00
.babelrc
BUILD.bazel chore(NA): correctly setup dep order on js_library to fix windows build (#100420) (#100428) 2021-05-20 20:57:21 -04:00
jest.config.js [7.x] Elastic License 2.0 (#90192) 2021-02-03 18:39:13 -08:00
package.json chore(NA): moving @kbn/babel-code-parser into bazel (#97675) (#98185) 2021-04-23 18:50:40 +00:00
README.md

@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.