bugstack-sdk 2.0.2 → 2.2.0

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +421 -346
  3. package/bin/bugstack.cjs +6 -0
  4. package/dist/adapters/express/index.d.mts +2 -2
  5. package/dist/adapters/express/index.d.ts +2 -2
  6. package/dist/adapters/express/index.js +130 -15
  7. package/dist/adapters/express/index.js.map +1 -1
  8. package/dist/adapters/express/index.mjs +130 -15
  9. package/dist/adapters/express/index.mjs.map +1 -1
  10. package/dist/adapters/generic/index.d.mts +2 -2
  11. package/dist/adapters/generic/index.d.ts +2 -2
  12. package/dist/adapters/generic/index.js +66 -5
  13. package/dist/adapters/generic/index.js.map +1 -1
  14. package/dist/adapters/generic/index.mjs +66 -5
  15. package/dist/adapters/generic/index.mjs.map +1 -1
  16. package/dist/adapters/nextjs/index.d.mts +2 -2
  17. package/dist/adapters/nextjs/index.d.ts +2 -2
  18. package/dist/adapters/nextjs/index.js +72 -7
  19. package/dist/adapters/nextjs/index.js.map +1 -1
  20. package/dist/adapters/nextjs/index.mjs +72 -7
  21. package/dist/adapters/nextjs/index.mjs.map +1 -1
  22. package/dist/build/cli.d.mts +2 -0
  23. package/dist/build/cli.d.ts +2 -0
  24. package/dist/build/cli.js +256 -0
  25. package/dist/build/cli.js.map +1 -0
  26. package/dist/build/cli.mjs +254 -0
  27. package/dist/build/cli.mjs.map +1 -0
  28. package/dist/build/upload.d.mts +82 -0
  29. package/dist/build/upload.d.ts +82 -0
  30. package/dist/build/upload.js +163 -0
  31. package/dist/build/upload.js.map +1 -0
  32. package/dist/build/upload.mjs +161 -0
  33. package/dist/build/upload.mjs.map +1 -0
  34. package/dist/{client-9EMqVMOl.d.mts → client-DoqE7sNh.d.mts} +42 -1
  35. package/dist/{client-9EMqVMOl.d.ts → client-DoqE7sNh.d.ts} +42 -1
  36. package/dist/index.d.mts +2 -2
  37. package/dist/index.d.ts +2 -2
  38. package/dist/index.js +73 -7
  39. package/dist/index.js.map +1 -1
  40. package/dist/index.mjs +73 -8
  41. package/dist/index.mjs.map +1 -1
  42. package/dist/next-config/index.d.mts +56 -0
  43. package/dist/next-config/index.d.ts +56 -0
  44. package/dist/next-config/index.js +28 -0
  45. package/dist/next-config/index.js.map +1 -0
  46. package/dist/next-config/index.mjs +23 -0
  47. package/dist/next-config/index.mjs.map +1 -0
  48. package/package.json +23 -9
package/CHANGELOG.md ADDED
@@ -0,0 +1,87 @@
1
+ # Changelog
2
+
3
+ All notable changes to `bugstack-sdk` are documented here.
4
+ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
+
6
+ ## [2.2.0] — 2026-04-29
7
+
8
+ ### Added
9
+ - **Source-map upload pipeline for production builds.** Customers can now
10
+ upload server-side source maps to bugstack so the orchestrator resolves
11
+ bundled stack frames (`.next/server/chunks/8393.js:1:8734`) back to
12
+ source-file positions (`app/api/orders/route.ts:42:5`) — turning the
13
+ "Could not identify primary file" failure mode into auto-fixable
14
+ errors. Two-step setup:
15
+ 1. Wrap your `next.config.js`:
16
+ ```js
17
+ const { withBugstack } = require('bugstack-sdk/next-config')
18
+ module.exports = withBugstack({ /* your config */ })
19
+ ```
20
+ This enables `webpack.devtool = 'source-map'` for production
21
+ server builds, preserving any existing webpack hook.
22
+ 2. Append to your `build` script:
23
+ ```json
24
+ "build": "next build && bugstack sourcemaps upload"
25
+ ```
26
+ The CLI walks `.next/server/**/*.map`, uploads each with the
27
+ active release identifier, and never fails the build.
28
+ - New `bugstack` CLI binary (registered via `bin`) — `bugstack sourcemaps
29
+ upload [--api-key X] [--release Y] [--endpoint Z] [--server-dir D]
30
+ [--concurrency N] [--max-bytes N] [--quiet]`. Auto-detects release from
31
+ `BUGSTACK_RELEASE`, `RENDER_GIT_COMMIT`, `VERCEL_GIT_COMMIT_SHA`,
32
+ `GITHUB_SHA`, or `git rev-parse HEAD` in that order.
33
+ - New programmatic API: `import { uploadSourceMaps } from 'bugstack-sdk/build'`
34
+ for callers who want to invoke the uploader from a custom Node script
35
+ rather than via the CLI.
36
+ - New entry: `bugstack-sdk/next-config` exports `withBugstack(config,
37
+ options?)` — the Next.js config wrapper. Idempotent and pass-through
38
+ when `emitServerSourceMaps: false`.
39
+
40
+ ### Internal
41
+ - New tsup entries for `src/build/upload`, `src/build/cli`, and
42
+ `src/next-config`. Bin stub at `bin/bugstack.cjs` requires the built
43
+ CLI so the shebang concern stays in checked-in JavaScript and out of
44
+ the bundler's hands.
45
+
46
+ ## [2.1.0] — 2026-04-29
47
+
48
+ ### Added
49
+ - **Chunk-load error telemetry.** `ChunkLoadError` and the related family
50
+ (`Loading chunk N failed`, `Loading CSS chunk N failed`,
51
+ `Failed to fetch dynamically imported module`,
52
+ `Importing a module script failed`) are now detected and routed to a
53
+ lightweight telemetry endpoint instead of the main fix pipeline. They
54
+ aren't real bugs (stale-tab artifacts after a redeploy) and have no
55
+ source frames the orchestrator could fix, so they were wasting LLM
56
+ cycles when they hit `/api/capture`. The new path lets the dashboard
57
+ render a deploy-health spike detector while keeping the noise out of
58
+ the bug feed.
59
+ - New config option `dropChunkErrors` (default `false`) — set to `true`
60
+ to disable telemetry forwarding entirely and silently discard chunk
61
+ errors instead.
62
+ - New config option `chunkErrorsEndpoint` (default auto-derived from the
63
+ main `endpoint` — `/api/capture` becomes `/api/chunk-errors`). Override
64
+ if your error service splits telemetry across hosts.
65
+ - New exported helper `isChunkLoadError(error)` so callers can reuse the
66
+ same detection logic in their own browser-side error boundaries (e.g.
67
+ to soft-reload the page on first occurrence).
68
+
69
+ ### Fixed
70
+ - The wire header `X-BugStack-SDK-Version` reported `0.2.0` since pre-2.0,
71
+ regardless of the actual installed version. Now injected at build time
72
+ from `package.json` via `tsup`'s `define`, so it stays in sync on every
73
+ release.
74
+
75
+ ### Changed
76
+ - Default behavior of `reportError` for chunk-load errors is now route-to-
77
+ telemetry. Previously these went into the main capture pipeline (where
78
+ they'd create unfixable rows the orchestrator would burn cycles on).
79
+ This is a soft behavior change: customer code is unaffected, but the
80
+ destination endpoint differs. Hosted customers (api.bugstack.ai) get
81
+ the new endpoint automatically; self-hosted error-service deployments
82
+ should pull the matching error-service release for the
83
+ `/api/chunk-errors` ingest route.
84
+
85
+ ## [2.0.2] — 2026-02-27
86
+
87
+ Previous published baseline.