Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/marcoroth/stimulus-parser

Statically analyze Stimulus controllers in your project.
https://github.com/marcoroth/stimulus-parser

hacktoberfest hotwire parser static-analysis stimulus

Last synced: 3 days ago
JSON representation

Statically analyze Stimulus controllers in your project.

Lists

README

        

stimulus-parser






NPM Version


NPM Downloads


NPM Bundle Size

## Installation

To add `stimulus-parser` to your project, run the following command in your terminal:

```bash
yarn add stimulus-parser
```

## Usage

```js
import { Project } from "stimulus-parser"

const project = new Project("/Users/user/path/to/project")

const controllers = project.controllerDefinitions
const controller = controllers[0]

console.log(controller.actionNames)
// => ["connect", "click", "disconnect"]

console.log(controller.targetNames)
// => ["name", "output"]

console.log(controller.classNames)
// => ["loading"]

console.log(controller.values)
// => [{ url: { type: "String", default: "" } }]
```

## Playground

You can inspect parse results on the hosted playground at https://stimulus-parser.hotwire.io.

## Development

To run the tests:

```bash
yarn install
yarn build
yarn test
```