Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch off of module-deps #716

Open
tmcw opened this issue Apr 10, 2017 · 3 comments
Open

Switch off of module-deps #716

tmcw opened this issue Apr 10, 2017 · 3 comments
Labels

Comments

@tmcw
Copy link
Member

tmcw commented Apr 10, 2017

The more I look at this problem, the more sure I am that documentation.js should no longer rely on module-deps, and instead implement dependency resolution via a Babel-based solution, or drop dependency resolution entirely.

Rationale:

  • module-deps requires that we parse, transform, parse, and then re-parse JavaScript for every file. For small file trees, it's nearly half of documentation.js's runtime
  • module-deps doesn't get us any closer to inferring whether something is public or private, whereas our current --document-exported flow can
  • document-exported is essentially a close of module-deps, but for ES6
  • module-deps is agressively async in a way that doesn't help documentation.js
@tmcw tmcw added the refactor label Apr 12, 2017
@ianwremmel
Copy link

would pulling in something like detective-es6 help? or is that targeted at too-specific a use-case?

@tmcw
Copy link
Member Author

tmcw commented Jun 24, 2017

It's certainly a consideration! (link to detective-es6 for reference).

One point of hesitation I do have though is that, like detective before it, detective-es6 walks dependencies by parsing them (with node-source-walk, which uses babylon) and outputs them as a string. Then documentation.js would need to re-load the files and re-parse them with babylon. I'd much rather keep a babylon AST around if we ever create one, to save the duplicated work.

@ianwremmel
Copy link

ah, good point. could node-source-walk be used as the documentation.js entrypoint? e.g. while processing each file for docs purposes, recursively do dependency resolution if appropropriate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants