Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
react-docgen-typescript-plugin
Advanced tools
A webpack plugin to inject react typescript docgen information.
A webpack plugin to inject react typescript docgen information
npm install --save-dev react-docgen-typescript-plugin
# or
yarn add -D react-docgen-typescript-plugin
NOTE: The TypeScript compiler options
allowSyntheticDefaultImports
andesModuleInterop
will makereact-docgen-typescript-plugin
a lot harder! Turn them off for faster build times.
const ts = require('typescript');
const ReactDocgenTypescriptPlugin = require("react-docgen-typescript-plugin").default;
module.exports = {
plugins: [
// Will default to loading your root tsconfig.json
new ReactDocgenTypescriptPlugin(),
// or with a specific tsconfig
new ReactDocgenTypescriptPlugin({ tsconfigPath: "./tsconfig.dev.json" }),
// or with compiler options
new ReactDocgenTypescriptPlugin({ compilerOptions: { jsx: ts.JsxEmit.Preserve } }),
],
};
This plugins support all parser options from react-docgen-typescript and all of the following options
Option | Type | Description | Default |
---|---|---|---|
tsconfigPath | string | Specify the location of the tsconfig.json to use. | null |
compilerOptions | object | Specify compiler options. Cannot be used with tsconfigPath | null |
docgenCollectionName | string or null | Specify the docgen collection name to use. All docgen information will be collected into this global object. Set to null to disable. | STORYBOOK_REACT_CLASSES |
setDisplayName | boolean | Set the components' display name. If you want to set display names yourself or are using another plugin to do this, you should disable this option. | true |
typePropName | string | Specify the name of the property for docgen info prop type. | type |
exclude | glob[] | Glob patterns to ignore and not generate docgen information for. (Great for ignoring large icon libraries) | [] |
include | glob[] | Glob patterns to generate docgen information for | ['**/**.tsx'] |
If you want to see how this plugins is including and excluding modules set the DEBUG
environment variable.
DEBUG=docgen:*
- All logsDEBUG=docgen:include
- Included modulesDEBUG=docgen:exclude
- Excluded modulesDEBUG=docgen:docs
- Generated docsDEBUG=docgen:* npm run storybook
Another great way of debugging your generated docs is to use a
debugger
statement in your component source file. If you turn off source maps you will be able to see the code that this package generates.
Thanks goes to these wonderful people (emoji key):
Andrew Lisowski 💻 🎨 📖 🤔 🚧 🚇 ⚠️ | Michael Shilman 💻 | Kyle Herock 💻 | Juho Vepsäläinen 🚇 ⚠️ 💻 📖 | Egor Pogadaev ⚠️ 💻 | Anton Savoskin 💻 | Trevor Burnham ⚠️ 💻 |
Maxime Meriouma-Caron 🚇 ⚠️ 💻 | Adam Skoufis 💻 | Nicholas Narsing 📖 ⚠️ 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
A webpack plugin to inject react typescript docgen information.
The npm package react-docgen-typescript-plugin receives a total of 295,953 weekly downloads. As such, react-docgen-typescript-plugin popularity was classified as popular.
We found that react-docgen-typescript-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.