sentry-miniapp 1.7.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +45 -32
- package/README.md +45 -30
- package/dist/sentry-miniapp.cjs.js +5 -5
- package/dist/sentry-miniapp.cjs.js.map +1 -1
- package/dist/sentry-miniapp.esm.js +1303 -1194
- package/dist/sentry-miniapp.esm.js.map +1 -1
- package/dist/sentry-miniapp.umd.js +5 -5
- package/dist/sentry-miniapp.umd.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -3
package/README.en.md
CHANGED
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
# Sentry Miniapp SDK — Mini Program Monitoring SDK
|
|
2
2
|
|
|
3
|
-

|
|
4
|
-

|
|
5
|
-

|
|
6
|
-

|
|
3
|
+
[](https://www.npmjs.com/package/sentry-miniapp)
|
|
4
|
+
[](https://www.npmjs.com/package/sentry-miniapp)
|
|
5
|
+
[](https://github.com/lizhiyao/sentry-miniapp/network/members)
|
|
6
|
+
[](https://github.com/lizhiyao/sentry-miniapp/stargazers)
|
|
7
7
|

|
|
8
|
-

|
|
8
|
+
[](./LICENSE)
|
|
9
9
|
|
|
10
10
|
[简体中文](./README.md) | English
|
|
11
11
|
|
|
12
|
-
A **mini program monitoring SDK** built on `@sentry/core
|
|
12
|
+
A **mini program monitoring SDK** built on `@sentry/core`, providing **error monitoring**, **performance monitoring**, offline caching, and distributed tracing. Supports WeChat, Alipay, ByteDance, Baidu, QQ, DingTalk, Kuaishou mini programs and cross-platform frameworks (Taro / uni-app).
|
|
13
13
|
|
|
14
14
|
> **What are Mini Programs?** Mini programs (小程序) are lightweight apps that run inside super-apps like WeChat, Alipay, and ByteDance/Douyin. They form a massive ecosystem in China with **hundreds of millions of daily active users**, but have no direct equivalent in the Western tech stack. Think of them as a hybrid between PWAs and native apps, but hosted within a platform's sandbox.
|
|
15
15
|
|
|
16
|
-
>
|
|
17
|
-
|
|
18
|
-
>
|
|
19
|
-
|
|
16
|
+
> **📰 Featured Article (Chinese)**: [《我把 Sentry 接进了 7 端小程序:从异常捕获、Breadcrumb 到 Source Map 定位》](https://juejin.cn/post/7621871037853843465) — multi-platform integration, Breadcrumb context, offline buffering, and Source Map workflow walked through end-to-end. If you find this project useful, please consider giving it a ⭐ Star.
|
|
17
|
+
|
|
18
|
+
<details>
|
|
19
|
+
<summary><b>🆕 What's New: v1.3 → v1.8 (click to expand)</b></summary>
|
|
20
|
+
|
|
21
|
+
| Version | Highlights |
|
|
22
|
+
|---|---|
|
|
23
|
+
| **v1.8.0** | AI-assisted integration skill — auto onboarding via Claude Code / Cursor |
|
|
24
|
+
| **v1.7.0** | New `tracesSampler` for dynamic sampling; complete Source Map configuration guide |
|
|
25
|
+
| **v1.6.0** | 13 enhancements + 16 fixes; enabled esbuild minification — bundle size reduced by ~**59%** |
|
|
26
|
+
| **v1.5.0** | Performance enhancements (configurable thresholds / slow `setData` detection / memory sampling); new page lifecycle, user interaction, and Console breadcrumbs; route integration covers all platforms |
|
|
27
|
+
| **v1.4.0** | `NetworkBreadcrumbs` captures Request / Response body; configurable offline cache limit; deprecated `showReportDialog` in favor of `captureFeedback` |
|
|
28
|
+
| **v1.3.0** | 🎯 Build pipeline rewrite (Vite + bundle-inline): **zero external deps**, fully resolves the `miniprogram_npm` module-resolution issue; 🎯 built-in Source Map path normalization across all platforms |
|
|
29
|
+
|
|
30
|
+
See [CHANGELOG.md](./CHANGELOG.md) for full details.
|
|
31
|
+
|
|
32
|
+
</details>
|
|
20
33
|
|
|
21
34
|
---
|
|
22
35
|
|
|
@@ -41,7 +54,7 @@ A **mini program monitoring SDK** built on `@sentry/core` (v10.45.0), providing
|
|
|
41
54
|
## Installation
|
|
42
55
|
|
|
43
56
|
```bash
|
|
44
|
-
npm install sentry-miniapp
|
|
57
|
+
npm install sentry-miniapp
|
|
45
58
|
```
|
|
46
59
|
|
|
47
60
|
> **Note:** Starting from `v1.1.0`, the build strategy has been optimized (dependencies are inlined), so there is **no need** to install `@sentry/core` separately.
|
|
@@ -50,6 +63,18 @@ npm install sentry-miniapp --save
|
|
|
50
63
|
|
|
51
64
|
---
|
|
52
65
|
|
|
66
|
+
## AI-Assisted Setup
|
|
67
|
+
|
|
68
|
+
If you use [Claude Code](https://claude.ai/code) or [Cursor](https://cursor.com), get AI-guided setup with one command:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npx skills add https://github.com/lizhiyao/sentry-miniapp --skill sentry-miniapp-sdk
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
After installation, just ask "help me set up Sentry monitoring" in your AI editor.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
53
78
|
## Quick Start
|
|
54
79
|
|
|
55
80
|
### 1. Prerequisites
|
|
@@ -155,13 +180,15 @@ Sentry.addBreadcrumb({
|
|
|
155
180
|
### Custom Performance Measurement
|
|
156
181
|
|
|
157
182
|
```javascript
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
183
|
+
await Sentry.startSpan(
|
|
184
|
+
{
|
|
185
|
+
name: 'fetch-user-data',
|
|
186
|
+
op: 'http.client',
|
|
187
|
+
},
|
|
188
|
+
async () => {
|
|
189
|
+
await fetchUserData();
|
|
190
|
+
},
|
|
191
|
+
);
|
|
165
192
|
```
|
|
166
193
|
|
|
167
194
|
### Dynamic Sampling (tracesSampler)
|
|
@@ -309,20 +336,6 @@ If errors are not being reported, check:
|
|
|
309
336
|
|
|
310
337
|
---
|
|
311
338
|
|
|
312
|
-
## Contributing
|
|
313
|
-
|
|
314
|
-
We welcome Pull Requests and Issues!
|
|
315
|
-
|
|
316
|
-
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup and guidelines.
|
|
317
|
-
|
|
318
|
-
Quick start:
|
|
319
|
-
|
|
320
|
-
1. `npm install` — install dependencies
|
|
321
|
-
2. `npm run dev` — start watch mode
|
|
322
|
-
3. `npm run test:all` — run full test suite (unit + integration)
|
|
323
|
-
|
|
324
|
-
---
|
|
325
|
-
|
|
326
339
|
## Community
|
|
327
340
|
|
|
328
341
|
Have questions or want to discuss mini program monitoring? Join our community.
|
package/README.md
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
# Sentry Miniapp SDK — 小程序监控 SDK
|
|
2
2
|
|
|
3
|
-

|
|
4
|
-

|
|
5
|
-

|
|
6
|
-

|
|
3
|
+
[](https://www.npmjs.com/package/sentry-miniapp)
|
|
4
|
+
[](https://www.npmjs.com/package/sentry-miniapp)
|
|
5
|
+
[](https://github.com/lizhiyao/sentry-miniapp/network/members)
|
|
6
|
+
[](https://github.com/lizhiyao/sentry-miniapp/stargazers)
|
|
7
7
|

|
|
8
|
-

|
|
8
|
+
[](./LICENSE)
|
|
9
9
|
|
|
10
10
|
简体中文 | [English](./README.en.md)
|
|
11
11
|
|
|
12
|
-
一个基于 `@sentry/core`
|
|
12
|
+
一个基于 `@sentry/core` 核心构建的**小程序监控 SDK**,提供**异常监控**、**性能监控**、离线缓存、分布式追踪等能力。支持微信、支付宝、字节跳动、百度、QQ、钉钉、快手等多端小程序及 Taro / uni-app 等跨端框架。
|
|
13
13
|
|
|
14
|
-
>
|
|
15
|
-
|
|
16
|
-
>
|
|
17
|
-
|
|
14
|
+
> **📰 最新文章**:[《我把 Sentry 接进了 7 端小程序:从异常捕获、Breadcrumb 到 Source Map 定位》](https://juejin.cn/post/7621871037853843465) — 多端统一接入、Breadcrumb 上下文、弱网兜底、Source Map 实战,一篇串完整套方案。觉得有用请帮忙点个 ⭐ Star,让更多小程序团队找到它。
|
|
15
|
+
|
|
16
|
+
<details>
|
|
17
|
+
<summary><b>🆕 v1.3 → v1.8 What's New(点击展开)</b></summary>
|
|
18
|
+
|
|
19
|
+
| 版本 | 亮点 |
|
|
20
|
+
|---|---|
|
|
21
|
+
| **v1.8.0** | AI 辅助接入 skill — Claude Code / Cursor 自动引导集成 |
|
|
22
|
+
| **v1.7.0** | 新增 `tracesSampler` 动态采样;新增 Source Map 完整配置指南 |
|
|
23
|
+
| **v1.6.0** | 13 项功能优化 + 16 项问题修复;启用 esbuild 压缩,包体积减少约 **59%** |
|
|
24
|
+
| **v1.5.0** | Performance 增强(可配阈值 / setData 慢渲染检测 / 内存采集);新增页面生命周期、用户交互、Console 三类 Breadcrumb;Route 集成全平台适配 |
|
|
25
|
+
| **v1.4.0** | NetworkBreadcrumbs 抓 Request / Response Body;离线缓存上限可配;废弃 `showReportDialog` 引导至 `captureFeedback` |
|
|
26
|
+
| **v1.3.0** | 🎯 重构构建(迁移 Vite + bundle-inline):对外**零依赖**,彻底修掉「`miniprogram_npm` 模块解析」问题;🎯 内置 Source Map 路径自动抹平,跨端堆栈统一映射 |
|
|
27
|
+
|
|
28
|
+
完整变更见 [CHANGELOG.md](./CHANGELOG.md)。
|
|
29
|
+
|
|
30
|
+
</details>
|
|
18
31
|
|
|
19
32
|
---
|
|
20
33
|
|
|
@@ -41,7 +54,7 @@
|
|
|
41
54
|
推荐使用 `npm` 进行安装。
|
|
42
55
|
|
|
43
56
|
```bash
|
|
44
|
-
npm install sentry-miniapp
|
|
57
|
+
npm install sentry-miniapp
|
|
45
58
|
```
|
|
46
59
|
|
|
47
60
|
> **注意:** `v1.1.0` 及以上版本已优化构建策略(内联依赖),**无需**再额外安装 `@sentry/core`。
|
|
@@ -50,6 +63,18 @@ npm install sentry-miniapp --save
|
|
|
50
63
|
|
|
51
64
|
---
|
|
52
65
|
|
|
66
|
+
## 🤖 AI 辅助接入
|
|
67
|
+
|
|
68
|
+
如果你使用 [Claude Code](https://claude.ai/code) 或 [Cursor](https://cursor.com),AI 可以自动引导你完成接入:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npx skills add https://github.com/lizhiyao/sentry-miniapp --skill sentry-miniapp-sdk
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
安装后,在 AI 编辑器中输入"帮我接入 Sentry 监控"即可触发向导。
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
53
78
|
## 🚀 快速接入
|
|
54
79
|
|
|
55
80
|
### 1. 前置准备
|
|
@@ -156,13 +181,15 @@ Sentry.addBreadcrumb({
|
|
|
156
181
|
### 自定义性能测速 (Performance)
|
|
157
182
|
|
|
158
183
|
```javascript
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
184
|
+
await Sentry.startSpan(
|
|
185
|
+
{
|
|
186
|
+
name: 'fetch-user-data',
|
|
187
|
+
op: 'http.client',
|
|
188
|
+
},
|
|
189
|
+
async () => {
|
|
190
|
+
await fetchUserData();
|
|
191
|
+
},
|
|
192
|
+
);
|
|
166
193
|
```
|
|
167
194
|
|
|
168
195
|
### 动态采样 (tracesSampler)
|
|
@@ -324,18 +351,6 @@ Sentry 官方的 Replay 功能强依赖于浏览器标准 DOM 环境(通过 rr
|
|
|
324
351
|
|
|
325
352
|
---
|
|
326
353
|
|
|
327
|
-
## 🤝 参与贡献
|
|
328
|
-
|
|
329
|
-
我们非常欢迎开发者提交 `Pull Request` 或通过 `Issues` 提出宝贵意见!
|
|
330
|
-
|
|
331
|
-
要参与本地开发:
|
|
332
|
-
|
|
333
|
-
1. `npm install` 安装依赖
|
|
334
|
-
2. `npm run dev` 启动监听编译
|
|
335
|
-
3. `npm run test:all` 运行完整的单元测试与集成测试套件
|
|
336
|
-
|
|
337
|
-
---
|
|
338
|
-
|
|
339
354
|
## 💬 联系与交流
|
|
340
355
|
|
|
341
356
|
遇到问题?想探讨小程序监控方案?欢迎加入我们的交流群。
|