How to use the react-docgen-typescript/lib/parser.js.parse function in react-docgen-typescript

To help you get started, we’ve selected a few react-docgen-typescript examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strothj / react-docgen-typescript-loader / src / plugin / Plugin.ts View on Github external
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;
}
github strothj / react-docgen-typescript-loader / src / generateDocgenCodeBlock.spec.ts View on Github external
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;
  };
}
github strothj / react-docgen-typescript-loader / packages / react-docgen-typescript-loader / src / generateDocgenCodeBlock.spec.ts View on Github external
.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;
    });
}

react-docgen-typescript

[![Build Status](https://github.com/styleguidist/react-docgen-typescript/actions/workflows/nodejs.yml/badge.svg)](https://github.com/styleguidist/react-docgen-typescript/actions/workflows/nodejs.yml)

MIT
Latest version published 2 years ago

Package Health Score

67 / 100
Full package analysis

Similar packages