Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function processModule(module: any, docgenCollectionName: string | null) {
const componentDocs = parse(module.userRequest);
if (!componentDocs.length) return;
let source = module._source._value;
componentDocs.forEach(componentDoc => {
source +=
"\n" +
generateDocgenCodeBlock(
componentDoc,
module.userRequest,
docgenCollectionName,
) +
"\n";
});
module._source._value = source;
}
return (filename: string) => {
const filePath = path.resolve(
__dirname,
"__fixtures__/components",
filename,
);
return {
filename,
source: fs.readFileSync(filePath, "utf8"),
componentDocs: parse(filePath, parserOptions),
docgenCollectionName: null,
setDisplayName: true,
typePropName: "type",
} as GeneratorOptions;
};
}
.map(filename => {
const filePath = path.resolve(
__dirname,
"__fixtures__/components",
filename,
);
return {
filename,
source: fs.readFileSync(filePath, "utf8"),
componentDocs: parse(filePath),
docgenCollectionName: null,
setDisplayName: true,
} as GeneratorOptions;
});
}