-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat apilinks.json generator #153
base: main
Are you sure you want to change the base?
Conversation
@flakey5 do you need review here? I think I forgot to review this PR! |
As far as the approach yes please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach in general sounds good; Just, some of these utilities are way too complex and big and the git manipulation scripts are possibly dangerous or at least an easy vulnerability hell.
Also, @flakey5 this https://github.com/syntax-tree/estree-util-visit is what I was referring to use to walk through the Nodes of the source code. Since acorn generates an AST that is compatible with estree. |
Closes #152 Signed-off-by: flakey5 <[email protected]>
Co-authored-by: Claudio W <[email protected]>
Signed-off-by: flakey5 <[email protected]>
@flakey5 there are PR conflicts. Could you fix'em? |
indirects: {}, | ||
}; | ||
|
||
if (lhs.object.name === 'exports') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is such a big function. I'd rather have a dedicated file for each one of these "cases" or dedicated functions on a separate file, just to reduce the chunk of this function. Pretty much just thinking on reusability.
Then you could have a map:
import identifierHandler ...
const typeHandlers = {
'Identifier: identifierHandler,
...,
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This applies for all these large function bodies here. You can create a sub directory. I think it becomes easier to read, easier to maintain. And if you have different functions for handling identifiers or expressions, etc. Simply make multiple exports for a file that handles everything related to a given type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this applies to all the helper functions you've made on all these different files. Let's decrease the size of these functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far looking good. Left more comments, will review more once they are addressed-
Closes #152
Opening this as a draft currently to get feedback on the approach since it's a bit non-trivial relative to the other generators.Theapilinks.json
file maps things exported by modules to their source locations on Github.Example:
This means we need to parse the module's javascript source in addition to its markdown.
What the current approach does is doing:
acorn
is used for parsing the source files.js
files, so to run it you need to do pass innode/lib/*.js
as the inputThis is dependent on the Markdown source parsing since it uses thesource_link
metadata in the docsast-js
generatorapi-links
generator is based off of theast-js
result