You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
documentation.js uses Babel to get an abstract syntax tree, which is what it uses to run inference - we look at the AST structure and derive parameters and so on. Babel transforms-away a lot of the things we'd want to document - destructuring parameters, for instance, are transformed into a single parameter and then destructuring within the function. For inference to work, we need to have a look at the original source, not a transformed version.
When we link to github, run lint, or output an error, we rely on correct line numbers - line numbers that match the original source code, so that you can find the error. Babel's transformation changes the code and the line numbers.
We're using babelify as kind of a hack: we use module-deps to find dependencies, and to find dependencies in es6 code, it needs to invoke babelify - otherwise, module-deps would choke on es6 syntax and import statements and so on. So we aren't actually using babelify for its usual purpose of transforming code for output - we're only transforming code to figure out where dependencies are.
We parse code with babylon in lib/parsers/javascript, which gives us the AST, and that's the source of truth for inference.
in lib/input/dependency.js
why?
The text was updated successfully, but these errors were encountered: