npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

csmx-watch-sdk

v1.0.0

Published

[![npm version](https://img.shields.io/npm/v/csmx-watch-sdk)](https://www.npmjs.com/package/csmx-watch-sdk) [![license](https://img.shields.io/badge/license-MIT-blue)](LICENSE) [![CI Status](https://github.com/angleneo/frontend-monitor-sdk/actions/workflo

Readme

Frontend Monitor SDK

npm version license CI Status

轻量级前端监控解决方案,支持 React/Vue/原生项目,提供错误监控、性能采集、用户行为追踪等功能。支持插件化扩展,灵活配置采样率。

✨ 功能特性

  • 🚨 错误监控

    • JS 运行时错误捕获
    • 自动错误上下文收集
    • 错误堆栈解析
    • 框架级错误边界
  • ⏱️ 性能监控

    • 核心性能指标采集
    • 自动性能数据收集
    • 支持手动触发采集
  • 🔌 插件系统

    • 支持自定义插件扩展
    • 插件生命周期管理
    • 灵活的数据处理能力
  • 🛡️ 生产优化

    • 数据队列管理
    • 采样率控制
    • 事件过滤处理
    • 错误恢复机制

📦 安装

# NPM
npm install csmx-watch-sdk

# Yarn
yarn add csmx-watch-sdk

# PNPM
pnpm add csmx-watch-sdk

🚀 快速开始

基础使用

import { createMonitor } from "csmx-watch-sdk";

const monitor = createMonitor({
  maxQueueSize: 30 * 1024,
  sampleRate: 0.8,
  performance: true,
  errorTracking: true,
  beforeSend: (event) => event, // 数据发送前处理
});

// 自定义事件上报
monitor.track("userAction", {
  type: "click",
  target: "button",
});

// 手动采集性能数据
monitor.capturePerformance();

// 手动上报错误
monitor.captureError(new Error("Something went wrong"), {
  userId: "user_123",
});

React 集成

import { withReactMonitor } from "csmx-watch-sdk";

const ErrorBoundary = withReactMonitor(React, monitor);

function App() {
  return (
    <ErrorBoundary fallback={ErrorFallback}>
      <YourComponents />
    </ErrorBoundary>
  );
}

Vue 集成

import { vueMonitor } from "csmx-watch-sdk";

app.use(vueMonitor, { monitor });

插件开发

const customPlugin = {
  name: "CustomPlugin",
  setup: (monitor) => {
    // 插件初始化逻辑
  },
};

monitor.addPlugin(customPlugin);

⚙️ 配置项

| 参数 | 类型 | 默认值 | 必填 | 说明 | | ------------- | --------------- | ---------------- | ---- | ------------------ | | maxQueueSize | number | 30720 | 否 | 上报队列大小(字节) | | performance | boolean | true | 否 | 是否启用性能监控 | | errorTracking | boolean | true | 否 | 是否启用错误监控 | | sampleRate | number | 1.0 | 否 | 采样率(0-1) | | framework | string | 'vanilla' | 否 | 框架类型 | | plugins | MonitorPlugin[] | [] | 否 | 插件列表 | | beforeSend | Function | (event) => event | 否 | 数据发送前处理函数 |

🔨 本地开发

# 安装依赖
npm install

# 开发模式
npm run dev

# 生产构建
npm run build

🌐 浏览器兼容性

| Chrome | Firefox | Edge | Safari | | :-----------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------: | | 50+ | 45+ | 15+ | 10+ |

📄 许可证

MIT License © 2025 AngleNeo