fix(sdk): §4.5 红线补全(act/重放包裹)+ beacon-false 丢批计数 + 空闲负向测试 + es2020

- events.ts:act 回调与 visibilitychange 监听体包 try/catch(字面红线)
- transport.ts:sendBeacon 返回 false(64KB 超限等)按批事件数计 dropped
  ——与 stringify 丢包计数对称的缺口
- index.ts:顶层队列重放双层包裹,单个坏条目只跳过自身不吞后续 init/track
- 测试:30s 空闲负向(active_ms=29000 后停止)、beacon-false 丢批;44→46
- build.mjs target es2018→es2020(代码依赖 globalThis,目标诚实化)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-15 16:40:35 +08:00
parent dc13ae6e0e
commit 21c3cb2423
6 changed files with 54 additions and 6 deletions
+1 -1
View File
@@ -2,5 +2,5 @@ import { build } from "esbuild";
await build({
entryPoints: ["src/index.ts"],
bundle: true, minify: true, format: "iife",
outfile: "dist/v1.js", target: ["es2018"],
outfile: "dist/v1.js", target: ["es2020"], // 代码依赖 globalThis(es2018 目标名不副实)
});