Closed maksimr closed 9 years ago
I am guessing that your preprocessor converts jsx files into js? While I can see that there is common functionality in the jsdoc file reader, I am not sure that providing a "pipeline" of file readers is that intuitive as it stands, since fileReaders take a fileInfo
object and return a doc
object. It wouldn't make sense to pass the doc
into a second fileReader.
Instead I think it would be more profitable to factor out the jsdoc processing (i.e. the esprima parsing, etc) into its own service that can then be used by the jsdoc fileReader and any other such as your jsx fileReader.
Alternatively, how about providing an explicit preprocessor property on the sourceFile
object:
readFilesProcessor.sourceFiles = [
includeL 'js/**/*.jsx',
preprocessors: ['jsxPreprocessor'],
fileReader: 'jsdocFileReader'
];
These preprocessors could modify the content
before it gets to the fileReader.
What do you think?
I am guessing that your preprocessor converts jsx files into js?
yep
Alternatively, how about providing an explicit preprocessor property on the sourceFile object:
I agree that it's more clear
Would you like to make a pull request?
@petebacondarwin @maksimr any luck putting this together by now? I am having a hard time figuring it out. We also have JSX files that we would like to use with dgeni.
@gbbr I don't have time right now to work on this. But if you don't want to try to create a general PR that adds preprocessing, you could look into making your own custom file reader that is a copy of https://github.com/angular/dgeni-packages/blob/master/jsdoc/file-readers/jsdoc.js but with additional jsx parsing before it gets sent to the jsParser
service.
Thanks! I'll make a PR if I manage to work it out...
For example. We have jsx with jsdoc comments. Before passing file content to
jsdocFileReader
we should before pass file content throughjsx
preprocessor.Now solution look like, create jsxFileReader which will be use jsdocFileReader. But more sophisticated solution will be something like (IMHO):
What do you think about this?