marcoroth/stimulus-parser

GitHub: marcoroth/stimulus-parser

用于静态解析项目中 Stimulus 控制器定义信息的工具库,帮助开发者在不运行代码的情况下提取 action、target、class、value 等元数据。

Stars: 44 | Forks: 11

stimulus-parser

NPM Version NPM Downloads NPM Bundle Size

## 安装 要在您的项目中添加 `stimulus-parser`,请在终端中运行以下命令: ``` yarn add stimulus-parser ``` ## 用法 ``` import { Project } from "stimulus-parser" const project = new Project("/Users/user/path/to/project") await project.initialize() 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: "" } }] ``` ## 演练场 您可以在托管的演练场上查看解析结果:https://stimulus-parser.hotwire.io。 ## 开发 运行测试: ``` yarn install yarn build yarn test ```
标签:AST解析, CMS安全, Hotwire, JavaScript, MITM代理, NPM包, OSV-Scalibr, Ruby on Rails, Stimulus, Syscall, TypeScript, Web开发, 云安全监控, 代码审查, 代码检测, 代码解析, 内存转储, 前端工具, 威胁情报, 安全插件, 开发者工具, 控制器分析, 数据可视化, 自动化攻击, 语法树, 静态分析