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
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ // src/next-config/index.ts
6
+ function withBugstack(nextConfig = {}, options = {}) {
7
+ const emit = options.emitServerSourceMaps ?? true;
8
+ if (!emit) return nextConfig;
9
+ const serverDevtool = options.serverDevtool ?? "source-map";
10
+ const userWebpack = nextConfig.webpack;
11
+ const wrapped = (config, context) => {
12
+ const next = userWebpack ? userWebpack(config, context) : config;
13
+ if (context.isServer && !context.dev) {
14
+ next.devtool = serverDevtool;
15
+ }
16
+ return next;
17
+ };
18
+ return {
19
+ ...nextConfig,
20
+ webpack: wrapped
21
+ };
22
+ }
23
+ var next_config_default = withBugstack;
24
+
25
+ exports.default = next_config_default;
26
+ exports.withBugstack = withBugstack;
27
+ //# sourceMappingURL=index.js.map
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/next-config/index.ts"],"names":[],"mappings":";;;;;AA0DO,SAAS,aACd,UAAA,GAAgB,EAAC,EACjB,OAAA,GAA+B,EAAC,EAC7B;AACH,EAAA,MAAM,IAAA,GAAO,QAAQ,oBAAA,IAAwB,IAAA;AAC7C,EAAA,IAAI,CAAC,MAAM,OAAO,UAAA;AAElB,EAAA,MAAM,aAAA,GAAgB,QAAQ,aAAA,IAAiB,YAAA;AAC/C,EAAA,MAAM,cAAc,UAAA,CAAW,OAAA;AAE/B,EAAA,MAAM,OAAA,GAAuB,CAAC,MAAA,EAAQ,OAAA,KAAY;AAGhD,IAAA,MAAM,IAAA,GAAO,WAAA,GAAc,WAAA,CAAY,MAAA,EAAQ,OAAO,CAAA,GAAI,MAAA;AAE1D,IAAA,IAAI,OAAA,CAAQ,QAAA,IAAY,CAAC,OAAA,CAAQ,GAAA,EAAK;AACpC,MAAA,IAAA,CAAK,OAAA,GAAU,aAAA;AAAA,IACjB;AACA,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,GAAG,UAAA;AAAA,IACH,OAAA,EAAS;AAAA,GACX;AACF;AAIA,IAAO,mBAAA,GAAQ","file":"index.js","sourcesContent":["/**\r\n * `next.config.js` wrapper for bugstack — turns server-side source-map\r\n * emission on without the user having to touch their webpack config.\r\n *\r\n * Intended use:\r\n *\r\n * // next.config.js\r\n * const { withBugstack } = require('bugstack-sdk/next-config')\r\n *\r\n * module.exports = withBugstack({\r\n * // ...your existing Next config\r\n * })\r\n *\r\n * Once wrapped, `next build` emits .map files alongside server bundles in\r\n * .next/server/. Pair with `bugstack sourcemaps upload` in your build\r\n * script to ship them to bugstack so the orchestrator can resolve\r\n * production stack frames back to source files.\r\n *\r\n * Anything you already pass under `webpack` is preserved and called first;\r\n * we only set `devtool` afterwards, and only for production server builds\r\n * (not dev, not client). Idempotent — wrapping twice is a no-op.\r\n */\r\n\r\n// Minimal NextConfig shape — keeping it loose so we don't pull in `next`\r\n// as a peer dependency just for this wrapper. The underlying type is\r\n// import(\"next\").NextConfig but consumers don't need to know that.\r\ntype WebpackConfig = { devtool?: string | false } & Record<string, unknown>;\r\ntype WebpackContext = {\r\n dev: boolean;\r\n isServer: boolean;\r\n nextRuntime?: \"nodejs\" | \"edge\";\r\n};\r\ntype WebpackHook = (config: WebpackConfig, context: WebpackContext) => WebpackConfig;\r\ntype NextConfigLike = {\r\n webpack?: WebpackHook;\r\n [key: string]: unknown;\r\n};\r\n\r\nexport interface BugstackNextOptions {\r\n /**\r\n * When true (default), enables server-side source-map emission.\r\n * Set false to opt back out — useful if you have your own devtool config\r\n * and want bugstack to leave it alone.\r\n */\r\n emitServerSourceMaps?: boolean;\r\n\r\n /**\r\n * `devtool` value to use for production server builds. Default\r\n * `\"source-map\"` (full external maps). Override to e.g. `\"hidden-source-map\"`\r\n * if you want maps emitted but no `# sourceMappingURL` comment in the JS.\r\n */\r\n serverDevtool?: string;\r\n}\r\n\r\n/**\r\n * Wrap a Next.js config to enable bugstack's source-map pipeline.\r\n * Pass-through if `emitServerSourceMaps` is false.\r\n */\r\nexport function withBugstack<C extends NextConfigLike>(\r\n nextConfig: C = {} as C,\r\n options: BugstackNextOptions = {},\r\n): C {\r\n const emit = options.emitServerSourceMaps ?? true;\r\n if (!emit) return nextConfig;\r\n\r\n const serverDevtool = options.serverDevtool ?? \"source-map\";\r\n const userWebpack = nextConfig.webpack;\r\n\r\n const wrapped: WebpackHook = (config, context) => {\r\n // Run the user's hook first so we don't clobber custom resolve aliases,\r\n // plugins, etc. Their hook may also touch `devtool`; we override after.\r\n const next = userWebpack ? userWebpack(config, context) : config;\r\n\r\n if (context.isServer && !context.dev) {\r\n next.devtool = serverDevtool;\r\n }\r\n return next;\r\n };\r\n\r\n return {\r\n ...nextConfig,\r\n webpack: wrapped,\r\n };\r\n}\r\n\r\n// Default export aliases withBugstack so `require('bugstack-sdk/next-config')`\r\n// also works as a callable wrapper without destructuring.\r\nexport default withBugstack;\r\n"]}
@@ -0,0 +1,23 @@
1
+ // src/next-config/index.ts
2
+ function withBugstack(nextConfig = {}, options = {}) {
3
+ const emit = options.emitServerSourceMaps ?? true;
4
+ if (!emit) return nextConfig;
5
+ const serverDevtool = options.serverDevtool ?? "source-map";
6
+ const userWebpack = nextConfig.webpack;
7
+ const wrapped = (config, context) => {
8
+ const next = userWebpack ? userWebpack(config, context) : config;
9
+ if (context.isServer && !context.dev) {
10
+ next.devtool = serverDevtool;
11
+ }
12
+ return next;
13
+ };
14
+ return {
15
+ ...nextConfig,
16
+ webpack: wrapped
17
+ };
18
+ }
19
+ var next_config_default = withBugstack;
20
+
21
+ export { next_config_default as default, withBugstack };
22
+ //# sourceMappingURL=index.mjs.map
23
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/next-config/index.ts"],"names":[],"mappings":";AA0DO,SAAS,aACd,UAAA,GAAgB,EAAC,EACjB,OAAA,GAA+B,EAAC,EAC7B;AACH,EAAA,MAAM,IAAA,GAAO,QAAQ,oBAAA,IAAwB,IAAA;AAC7C,EAAA,IAAI,CAAC,MAAM,OAAO,UAAA;AAElB,EAAA,MAAM,aAAA,GAAgB,QAAQ,aAAA,IAAiB,YAAA;AAC/C,EAAA,MAAM,cAAc,UAAA,CAAW,OAAA;AAE/B,EAAA,MAAM,OAAA,GAAuB,CAAC,MAAA,EAAQ,OAAA,KAAY;AAGhD,IAAA,MAAM,IAAA,GAAO,WAAA,GAAc,WAAA,CAAY,MAAA,EAAQ,OAAO,CAAA,GAAI,MAAA;AAE1D,IAAA,IAAI,OAAA,CAAQ,QAAA,IAAY,CAAC,OAAA,CAAQ,GAAA,EAAK;AACpC,MAAA,IAAA,CAAK,OAAA,GAAU,aAAA;AAAA,IACjB;AACA,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,GAAG,UAAA;AAAA,IACH,OAAA,EAAS;AAAA,GACX;AACF;AAIA,IAAO,mBAAA,GAAQ","file":"index.mjs","sourcesContent":["/**\r\n * `next.config.js` wrapper for bugstack — turns server-side source-map\r\n * emission on without the user having to touch their webpack config.\r\n *\r\n * Intended use:\r\n *\r\n * // next.config.js\r\n * const { withBugstack } = require('bugstack-sdk/next-config')\r\n *\r\n * module.exports = withBugstack({\r\n * // ...your existing Next config\r\n * })\r\n *\r\n * Once wrapped, `next build` emits .map files alongside server bundles in\r\n * .next/server/. Pair with `bugstack sourcemaps upload` in your build\r\n * script to ship them to bugstack so the orchestrator can resolve\r\n * production stack frames back to source files.\r\n *\r\n * Anything you already pass under `webpack` is preserved and called first;\r\n * we only set `devtool` afterwards, and only for production server builds\r\n * (not dev, not client). Idempotent — wrapping twice is a no-op.\r\n */\r\n\r\n// Minimal NextConfig shape — keeping it loose so we don't pull in `next`\r\n// as a peer dependency just for this wrapper. The underlying type is\r\n// import(\"next\").NextConfig but consumers don't need to know that.\r\ntype WebpackConfig = { devtool?: string | false } & Record<string, unknown>;\r\ntype WebpackContext = {\r\n dev: boolean;\r\n isServer: boolean;\r\n nextRuntime?: \"nodejs\" | \"edge\";\r\n};\r\ntype WebpackHook = (config: WebpackConfig, context: WebpackContext) => WebpackConfig;\r\ntype NextConfigLike = {\r\n webpack?: WebpackHook;\r\n [key: string]: unknown;\r\n};\r\n\r\nexport interface BugstackNextOptions {\r\n /**\r\n * When true (default), enables server-side source-map emission.\r\n * Set false to opt back out — useful if you have your own devtool config\r\n * and want bugstack to leave it alone.\r\n */\r\n emitServerSourceMaps?: boolean;\r\n\r\n /**\r\n * `devtool` value to use for production server builds. Default\r\n * `\"source-map\"` (full external maps). Override to e.g. `\"hidden-source-map\"`\r\n * if you want maps emitted but no `# sourceMappingURL` comment in the JS.\r\n */\r\n serverDevtool?: string;\r\n}\r\n\r\n/**\r\n * Wrap a Next.js config to enable bugstack's source-map pipeline.\r\n * Pass-through if `emitServerSourceMaps` is false.\r\n */\r\nexport function withBugstack<C extends NextConfigLike>(\r\n nextConfig: C = {} as C,\r\n options: BugstackNextOptions = {},\r\n): C {\r\n const emit = options.emitServerSourceMaps ?? true;\r\n if (!emit) return nextConfig;\r\n\r\n const serverDevtool = options.serverDevtool ?? \"source-map\";\r\n const userWebpack = nextConfig.webpack;\r\n\r\n const wrapped: WebpackHook = (config, context) => {\r\n // Run the user's hook first so we don't clobber custom resolve aliases,\r\n // plugins, etc. Their hook may also touch `devtool`; we override after.\r\n const next = userWebpack ? userWebpack(config, context) : config;\r\n\r\n if (context.isServer && !context.dev) {\r\n next.devtool = serverDevtool;\r\n }\r\n return next;\r\n };\r\n\r\n return {\r\n ...nextConfig,\r\n webpack: wrapped,\r\n };\r\n}\r\n\r\n// Default export aliases withBugstack so `require('bugstack-sdk/next-config')`\r\n// also works as a callable wrapper without destructuring.\r\nexport default withBugstack;\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bugstack-sdk",
3
- "version": "2.0.2",
3
+ "version": "2.2.0",
4
4
  "description": "Framework-agnostic error capture SDK with adapters for Next.js, Express, and more - automatically capture, report, and fix errors",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -40,11 +40,26 @@
40
40
  "types": "./dist/adapters/generic/index.d.ts",
41
41
  "import": "./dist/adapters/generic/index.mjs",
42
42
  "require": "./dist/adapters/generic/index.js"
43
+ },
44
+ "./build": {
45
+ "types": "./dist/build/upload.d.ts",
46
+ "import": "./dist/build/upload.mjs",
47
+ "require": "./dist/build/upload.js"
48
+ },
49
+ "./next-config": {
50
+ "types": "./dist/next-config/index.d.ts",
51
+ "import": "./dist/next-config/index.mjs",
52
+ "require": "./dist/next-config/index.js"
43
53
  }
44
54
  },
55
+ "bin": {
56
+ "bugstack": "./bin/bugstack.cjs"
57
+ },
45
58
  "files": [
46
59
  "dist",
47
- "README.md"
60
+ "bin",
61
+ "README.md",
62
+ "CHANGELOG.md"
48
63
  ],
49
64
  "scripts": {
50
65
  "build": "tsup",
@@ -68,9 +83,9 @@
68
83
  },
69
84
  "devDependencies": {
70
85
  "@types/express": "^4.17.21",
71
- "@types/node": "^20.10.0",
72
- "express": "^4.18.2",
73
- "next": "^14.0.0",
86
+ "@types/node": "^24.0.0",
87
+ "express": "^4.22.1",
88
+ "next": "15.5.15",
74
89
  "rimraf": "^5.0.5",
75
90
  "tsup": "^8.0.1",
76
91
  "typescript": "^5.3.0"
@@ -80,11 +95,10 @@
80
95
  },
81
96
  "repository": {
82
97
  "type": "git",
83
- "url": "https://github.com/MasonBachmann7/BugStack.git",
84
- "directory": "packages/error-capture-sdk"
98
+ "url": "https://github.com/MasonBachmann7/Bugstack-SDK-Nextjs.git"
85
99
  },
86
100
  "bugs": {
87
- "url": "https://github.com/MasonBachmann7/BugStack/issues"
101
+ "url": "https://github.com/MasonBachmann7/Bugstack-SDK-Nextjs/issues"
88
102
  },
89
- "homepage": "https://github.com/MasonBachmann7/BugStack/tree/main/packages/error-capture-sdk#readme"
103
+ "homepage": "https://github.com/MasonBachmann7/Bugstack-SDK-Nextjs#readme"
90
104
  }