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 months ago
JSON representation
Statically analyze Stimulus controllers in your project.
- Host: GitHub
- URL: https://github.com/marcoroth/stimulus-parser
- Owner: marcoroth
- License: mit
- Created: 2023-10-01T14:50:06.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-04T15:36:51.000Z (3 months ago)
- Last Synced: 2025-04-06T03:32:12.806Z (3 months ago)
- Topics: hacktoberfest, hotwire, parser, static-analysis, stimulus
- Language: TypeScript
- Homepage: https://hotwire.io/ecosystem/tooling/stimulus-parser
- Size: 1.41 MB
- Stars: 36
- Watchers: 1
- Forks: 7
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-hotwire - stimulus-parser - A simple parser for Stimulus values. (**Awesome Hotwire** [](https://github.com/sindresorhus/awesome) / Stimulus)
- awesome-hotwire - stimulus-parser - A simple parser for Stimulus values. (**Awesome Hotwire** [](https://github.com/sindresorhus/awesome) / Stimulus)
README
stimulus-parser
## 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
```