@agrarium/plugin-bemjsd

Agrarium plugin for BEM JSDoc. More info about JSD parser here.

Usage no npm install needed!

<script type="module">
  import agrariumPluginBemjsd from 'https://cdn.skypack.dev/@agrarium/plugin-bemjsd';
</script>

README

Agrarium BemJSD Plugin

Agrarium plugin for BEM JSDoc. More info about JSD parser here.

Usage

npm i agrarium

Or use it standalone:

npm i @agrarium/plugin-bemjsd

In your .agrarium.js file:

const { PluginBemJSD } = require('agrarium');

module.exports = {
    src: ['./src/components'],
    plugins: [
        new PluginBemJSD()
    ]
};

Example of result data

console.log(chunk.data)

{
    bemjsd: [{
        jsd: {
            "jsdocType": "root",
            "modules": [
                {
                    "jsdocType": "module",
                    "name": "button",
                    "exports": {
                        "jsdocType": "class",
                        "name": "button",
                        "proto": {
                            "jsdocType": "type",
                            "jsType": "Object",
                            "props": [
                                {
                                    "key": "getText",
                                    "val": {
                                        "jsdocType": "type",
                                        "jsType": "Function",
                                        "returns": {
                                            "jsdocType": "returns",
                                            "description": "",
                                            "jsType": "String"
                                        },
                                        "description": "Returns text of the button"
                                    }
                                },
                                {
                                    "key": "setText",
                                    "val": {
                                        "jsdocType": "type",
                                        "jsType": "Function",
                                        "params": [
                                            {
                                                "jsdocType": "param",
                                                "name": "text",
                                                "description": "",
                                                "jsType": "String"
                                            }
                                        ],
                                        "returns": {
                                            "jsdocType": "returns",
                                            "description": "this",
                                            "jsType": "button"
                                        },
                                        "description": "Sets text to the button"
                                    }
                                }
                            ]
                        },
                        "augments": {
                            "jsdocType": "type",
                            "jsType": "control"
                        },
                        "bem": {
                            "jsdocType": "bem",
                            "block": "button"
                        }
                    },
                    "classes": {
                        "button": {
                            "jsdocType": "class",
                            "name": "button",
                            "proto": {
                                "jsdocType": "type",
                                "jsType": "Object",
                                "props": [
                                    {
                                        "key": "getText",
                                        "val": {
                                            "jsdocType": "type",
                                            "jsType": "Function",
                                            "returns": {
                                                "jsdocType": "returns",
                                                "description": "",
                                                "jsType": "String"
                                            },
                                            "description": "Returns text of the button"
                                        }
                                    },
                                    {
                                        "key": "setText",
                                        "val": {
                                            "jsdocType": "type",
                                            "jsType": "Function",
                                            "params": [
                                                {
                                                    "jsdocType": "param",
                                                    "name": "text",
                                                    "description": "",
                                                    "jsType": "String"
                                                }
                                            ],
                                            "returns": {
                                                "jsdocType": "returns",
                                                "description": "this",
                                                "jsType": "button"
                                            },
                                            "description": "Sets text to the button"
                                        }
                                    }
                                ]
                            },
                            "augments": {
                                "jsdocType": "type",
                                "jsType": "control"
                            },
                            "bem": {
                                "jsdocType": "bem",
                                "block": "button"
                            }
                        }
                    }
                }
            ]
        }
    }]
}

License MIT