
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
gatsby-transformer-react-docgen
Advanced tools
Expose React component metadata and prop information as GraphQL types
Parses inline component-documentation using react-docgen.
npm install gatsby-transformer-react-docgen
Add a plugin-entry to your gatsby-config.js
module.exports = {
plugins: [`gatsby-transformer-react-docgen`],
}
For custom resolvers or handlers, all config options are passed directly to react-docgen.
In addition any custom handlers are passed the component file Node object as their last
argument for more Gatsby specific handler behavior.
module.exports = {
plugins: [
{
resolve: "gatsby-transformer-react-docgen",
options: {
resolver: require("./custom-resolver"),
},
},
],
}
By default, your local .babelrc will be used to determine how to parse source files. Don't worry
if you don't have a local babel config and are using Gatsby's default settings! If there isn't any config react-docgen will
use it's own, permissive parsing options.
In the case of more complex sites with local custom configs, such as in a monorepo, you may have to tell babel (via react-docgen), how to properly resolve your local babel config. See the react-docgen documentation for more details.
module.exports = {
plugins: [
{
resolve: "gatsby-transformer-react-docgen",
options: {
babelrcRoots: ["../packages/*"],
},
},
],
}
You'll also need to include a source-plugin, such as gatsby-source-filesystem, so that the transformer has access to source data.
Note: that at least one of your React Components must have PropTypes defined.
An example graphql query to get nodes:
{
allComponentMetadata {
edges {
node {
displayName
description
props {
name
type
required
}
}
}
}
}
FAQs
Expose React component metadata and prop information as GraphQL types
The npm package gatsby-transformer-react-docgen receives a total of 2,405 weekly downloads. As such, gatsby-transformer-react-docgen popularity was classified as popular.
We found that gatsby-transformer-react-docgen demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.