npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@captison/acid-plugin-react

v0.0.2

Published

A React plugin for ACID

Readme

React Plugin for ACID

Use this to document and render React components on the ACID platform.

Typescript is not (yet) supported.

Install

As a dev dependency:

npm install @captison/acid-plugin-react --save-dev

Usage

Add as an extension.

{
    configs: [ "@captison/acid-plugin-react" ]
}

Parser and renderer records will be applied to the ACID configuration automatically.

The extension and the parser and renderer are all individually accessible.

import acidReact from '@captison/acid-plugin-react'
import acidReactParser from '@captison/acid-plugin-react/parser'
import acidReactRenderer from '@captison/acid-plugin-react/renderer'

Config

Here are the config options with their defaults.

{
    configs: 
    [ 
        [ 
            '@captison/acid-plugin-react',
            {
                // source file types for parsing
                exts: '.jsx',
                // language types for code blocks
                types: [ 'jsx', 'react' ],
                // module specifier for the renderer (added to importmap)
                specifier: 'react-render',
                // output file name for the renderer
                filename: 'acid-react-render.js'
            }             
        ]
    ]
}

The parser and renderer extensions themselves do not have config parameters nor do they orient themselves based on language type.

Parsing Notes

This plugin scans source files as best it can to find component details for documentation. As such it has some expectations for how code and comments should be organized in order to work properly.

  • Only one component should be defined per source file, provided via export default.
  • Only JsDoc-style block comments are included (i.e. opening with /**).
  • The component's comment is assumed to be directly above the export default statement. Failing that, the comment having a @component tag will be used if it exists.

For component props not documented within the component comment...

  • Props are expected to be defined within an object named "propTypes".
  • PropTypes must literally appear within the type assignment for each prop.
  • A prop's comment is assumed to be directly above its definition.

Check the ACID docs for what gets documented from the comment blocks.

In order for this plugin to determine the name of a component the export default statement must one of

  • an identifier
  • a named function declaration
  • a class declaration
  • a variable declaration

If export default is a function call or some other exotic mechanism, a name for the component will not be provided to ACID (see ACID docs for how this is handled).

Rendering Notes

React and ReactDOM are added using the importmap.

{
    "imports":
    {
        "react": "https://esm.sh/react@19",
        "react-dom/client": "https://esm.sh/react-dom@19/client"
    }
}

Babel standalone is also pulled into the page (as global "Babel" var).

This plugin supports imports for CoBE renderer records. React and the configured imports are injected into code blocks.

`
    import React from 'react'
    ${imports}
`

If you need to, for instance, import hooks or set the default rendering mode, you can merge additional settings with matching types record(s) in the config.

cobe: { types: [ 'jsx', 'react' ], imports: { react: /^use/ }, mode: 'edit' }

See the ACID config docs for more details on how the cobe setting works.

If a markdown code block starts with import or export it is assumed to be a complete ESM module with an export default that provides the custom component.

```jsx
export default function ()
{
    let [ value, setValue ] = useState(false);

    return (
        <label>
          <Checkbox value={value} onChange={setValue} /> 
          { value ? 'Checked' : 'Unchecked' }.
        </label>
    );
}
```

Otherwise, the code is assumed to be a partitioned block. Put any JS at the top of the block and then put your JSX template below.

```jsx
let [ value, setValue ] = useState(false);

<label>
  <Checkbox value={value} onChange={setValue} /> { value ? 'Checked' : 'Unchecked' }.
</label>
```

Attempting static imports within a partitioned block will result in parsing errors.