@appsignal/stimulus

中文文档
1.0.21发布于 2025/09/30MITTypeScriptESM + CJS近 30 天下载 7.8万
  • [AppSignal.com website][appsignal] - [Documentation][docs] - [Support][contact]
原始使用文档
文档目录9 节
  1. Installation
  2. Usage
  3. Application.handleError
  4. Development
  5. Installation
  6. Testing
  7. Versioning
  8. Contributing
  9. Support

@appsignal/stimulus

The @appsignal/javascript integration for Stimulus v1.1+.

See also the mono repo README for more information.

Installation

Add the @appsignal/stimulus and @appsignal/javascript packages to your package.json. Then, run yarn install/npm install.

You can also add these packages to your package.json on the command line:

yarn add @appsignal/javascript @appsignal/stimulus
npm install --save @appsignal/javascript @appsignal/stimulus

Usage

Application.handleError

The default Stimulus integration is a function that binds to the Application.handleError property. In a new app created using rails new $APP_NAME --webpack=stimulus, for example, your javascript/controllers/index.js file would look something like this:

import { Application } from "stimulus"
import { definitionsFromContext } from "stimulus/webpack-helpers"

import Appsignal from "@appsignal/javascript"
import { installErrorHandler } from "@appsignal/stimulus"

const appsignal = new Appsignal({
  key: "YOUR FRONTEND API KEY"
})

const application = Application.start()
installErrorHandler(appsignal, application)
const context = require.context("controllers", true, /_controller\.js$/)
application.load(definitionsFromContext(context))

Development

Installation

Make sure mono is installed and bootstrapped, see the project README's development section for more information.

You can then run the following to start the compiler in watch mode in this sub directory. This automatically compiles both the ES Module and CommonJS variants:

yarn build:watch

You can also build the library without watching the directory:

yarn build        # build both CJS and ESM
yarn build:cjs    # just CJS
yarn build:esm    # just ESM

Testing

The tests for this library use Jest as the test runner. Once you've installed the dependencies, you can run the following command in the root of this repository to run the tests for all packages, or in the directory of a package to run only the tests pertaining to that package:

yarn test

Versioning

This repo uses Semantic Versioning (often referred to as semver). Each package in the repository is versioned independently from one another.

@TODO: define how this works once we know more about releasing

Contributing

Thinking of contributing to this repo? Awesome! 🚀

Please follow our Contributing guide in our documentation and follow our Code of Conduct.

Also, we would be very happy to send you Stroopwafles. Have look at everyone we send a package to so far on our Stroopwafles page.

Support

Contact us and speak directly with the engineers working on AppSignal. They will help you get set up, tweak your code and make sure you get the most out of using AppSignal.

版本与发布记录

@appsignal/stimulus 共发布 26 个版本,首次发布于 2019/07/29;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.21latest2025/09/301.1 年前
1.0.202025/07/211.3 年前
1.0.192025/01/031.8 年前
1.0.182023/11/232 年前
1.0.172023/04/213 年前
1.0.162023/04/213 年前

关于 @appsignal/stimulus 的常见问题

@appsignal/stimulus 是什么?

[AppSignal.com website][appsignal] - [Documentation][docs] - [Support][contact]

如何安装 @appsignal/stimulus?

在项目目录运行 npm install @appsignal/stimulus,或使用 pnpm add / yarn add / bun add。

@appsignal/stimulus 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@appsignal/stimulus 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@appsignal/stimulus 可以商用吗?

@appsignal/stimulus 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@appsignal/stimulus 的下载量有多少?

根据 npm 官方下载统计,@appsignal/stimulus 在 2026/10/07 – 2026/11/05 这 30 天内被下载 77,812 次,日均约 2,594 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@appsignal/stimulus 还在维护吗?

最新版本 1.0.21 发布于 2025/09/30(1.1 年前);至今共发布 26 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/07/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。