Closed akshat1 closed 6 years ago
Can you provide a snippet of code? I gander you are not using ES6 imports?
Hey, thanks for responding. You are right, :) I've been playing with typhonjs-escomplex and analyzing https://github.com/es-analysis/plato, which uses require
instead of ES6 imports. Do I need to configure something for that, or is that just not supported?
Apologies for there not being full documentation available presently.
By default CommonJS / require
isn't processed, but you can set commonjs: true
in options
:
escomplex.analyzeModule(source, { commonjs: true })
. You can also set a function for dependencyResolver
which takes a string and returns a value.
You can refer to this section of the source code for how CallExpression AST nodes (functions like require
) are handled in PluginSyntaxESTree.
Please, no apologies required :) Thanks for clarifying the configuration. Is it OK if I mark this question closed now?
It would be great to have the full list of options documented (or linked to) in this project, if someone can find time. Thanks both!
Indeed. I will definitely try and get the documentation up to par in a pending "0.2.0" update in the coming weeks then I'll patch things into the major downstream consumers (plato mainly). I plan to be back to full time OSS work at the end of January, so it might be until the end of the month.
The output of
escomplex.analyzeModule(source)
does not contain dependencies (or rather, the value of dependencies is an empty array). Do I need to supply some configuration value, or a dependency resolver?