szTheory / stimulus-parser

[mirror] Statically analyze Stimulus controllers in your project.

Home Page:https://hotwire.io/ecosystem/tooling/stimulus-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stimulus-parser

NPM Version NPM Downloads NPM Bundle Size

Installation

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

yarn add stimulus-parser

Usage

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.methods)
// => ["connect", "click", "disconnect"]

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

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

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

Development

To run the tests:

yarn install
yarn build
yarn test

About

[mirror] Statically analyze Stimulus controllers in your project.

https://hotwire.io/ecosystem/tooling/stimulus-parser

License:MIT License


Languages

Language:TypeScript 100.0%