@bigbertha/sdk 0.1.4 → 0.1.5

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.md CHANGED
@@ -55,14 +55,20 @@ import { withBertha } from "@bigbertha/sdk/next/config"
55
55
  export default withBertha({ /* your config */ })
56
56
  ```
57
57
 
58
- `withBertha` options: `release`, `keepMaps` (default false), `disableUpload`. It also
59
- stamps the environment, so a Vercel preview reports as staging.
58
+ `withBertha` options: `release`, `keepMaps`, `disableUpload`. It removes the maps under
59
+ `.next/static` (the ones browsers can fetch) and keeps the server's, which aren't served
60
+ and which Vercel's build output can need. `keepMaps` takes `true`, `false` or a function
61
+ of the path inside `.next`. It also stamps the environment, so a Vercel preview reports
62
+ as staging.
60
63
 
61
64
  For your own options (`beforeSend`, `tags`, `sampleRate`), call `init` from
62
65
  `@bigbertha/sdk/browser` in `instrumentation-client.ts` instead of importing
63
66
  `next/client`, and `init` from `@bigbertha/sdk/node` in `register()`. The build plugin
64
67
  works the same either way, and it keeps the debug ids another tool (such as Sentry's
65
- plugin) already gave the bundles, so both can run side by side.
68
+ plugin) already gave the bundles, so both can run side by side. Wrap it inside
69
+ `withSentryConfig` and set Sentry's `sourcemaps.deleteSourcemapsAfterUpload: false`:
70
+ Sentry's plugin runs first, and the maps it deletes never reach bertha. bertha removes
71
+ the served ones afterwards.
66
72
 
67
73
  ## Vite (browser)
68
74
 
@@ -1 +1 @@
1
- export declare const VERSION = "0.1.4";
1
+ export declare const VERSION = "0.1.5";
@@ -1 +1 @@
1
- export const VERSION = "0.1.4";
1
+ export const VERSION = "0.1.5";
@@ -1,8 +1,13 @@
1
1
  export interface BerthaNextOptions {
2
2
  release?: string;
3
- /** Keep .map files in `.next` after uploading. Default false. */
4
- keepMaps?: boolean;
3
+ /**
4
+ * Which .map files stay in `.next` after uploading, by path inside it. Defaults to
5
+ * the server's: only `static/` is served to browsers, and removing server maps can
6
+ * break Vercel's build output (getsentry/sentry-javascript#13099).
7
+ */
8
+ keepMaps?: boolean | ((file: string) => boolean);
5
9
  /** Skip the post-build step entirely (the release is still stamped). */
6
10
  disableUpload?: boolean;
7
11
  }
12
+ export declare const keepServerMaps: (file: string) => boolean;
8
13
  export declare function withBertha<C extends object>(config?: C, options?: BerthaNextOptions): C;
@@ -6,6 +6,7 @@
6
6
  import { join } from "node:path";
7
7
  import { detectRelease, processDirectory } from "../build/index.js";
8
8
  import { firstEnv } from "../core/env.js";
9
+ export const keepServerMaps = (file) => !file.startsWith("static/");
9
10
  export function withBertha(config = {}, options = {}) {
10
11
  const c = config;
11
12
  const release = options.release ?? detectRelease();
@@ -31,7 +32,7 @@ export function withBertha(config = {}, options = {}) {
31
32
  release,
32
33
  url: firstEnv("BERTHA_URL", "NEXT_PUBLIC_BERTHA_URL"),
33
34
  uploadKey: firstEnv("BERTHA_UPLOAD_KEY"),
34
- keepMaps: options.keepMaps,
35
+ keepMaps: options.keepMaps ?? keepServerMaps,
35
36
  skip: ["cache", "standalone", "types"],
36
37
  log: (m) => console.log(`[bertha] ${m}`),
37
38
  }).catch((e) => console.warn(`[bertha] Source maps weren't processed: ${String(e)}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbertha/sdk",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Error reporting for bertha: browser, Node, edge and Next.js, with source maps by debug id.",
5
5
  "license": "MIT",
6
6
  "repository": {