Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@

Work in this release was contributed by @lazerg, @rjmcgee53192, and @adityankale190895. Thank you for your contributions!

### Important Changes

- **feat(bundler-plugins): Enable hidden source maps and remove them after upload ([#25637](https://github.com/getsentry/sentry-javascript/pull/25637), [#25645](https://github.com/getsentry/sentry-javascript/pull/25645), [#25646](https://github.com/getsentry/sentry-javascript/pull/25646), [#25647](https://github.com/getsentry/sentry-javascript/pull/25647), [#25648](https://github.com/getsentry/sentry-javascript/pull/25648))**

The Sentry Rollup, Vite, webpack and esbuild plugins now turn on hidden source maps when your bundler has no source maps enabled and the plugin can upload them. They upload the maps to Sentry and remove them from the build output. You no longer need to set `sourcemap: 'hidden'` or `filesToDeleteAfterUpload` globs:

```js
sentryVitePlugin({ org, project, authToken });
```

The new `sourcemaps.deleteSourcemapsAfterUpload` option controls the removal:
- Unset: the plugin removes only the source maps it turned on itself. Source maps you enabled yourself stay in the build output, as before.
- `true`: the plugin also removes source maps you enabled yourself, and switches visible source maps to hidden. Set this if you already use `sourcemap: 'hidden'` and want to drop your `filesToDeleteAfterUpload` globs.
- `false`: the plugin never removes source maps.

Builds in development mode or without an auth token, org and project do not change.

## 11.11.0

### Important Changes
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { SentryRollupPluginOptions } from "@sentry/bundler-plugins/rollup";
export declare const sentryConfig: SentryRollupPluginOptions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const sentryConfig = {
telemetry: false,
authToken: "fake-auth",
org: "fake-org",
project: "fake-project",
release: { inject: false },
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { SentryRollupPluginOptions } from "@sentry/bundler-plugins/rollup";
export declare const sentryConfig: SentryRollupPluginOptions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const sentryConfig = {
telemetry: false,
authToken: "fake-auth",
org: "fake-org",
project: "fake-project",
release: { inject: false },
sourcemaps: {
assets: ["out/sourcemaps-assets-auto/entry1.js"],
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import type { SentryRollupPluginOptions } from "@sentry/bundler-plugins/rollup";
export declare const sentryConfig: SentryRollupPluginOptions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const sentryConfig = {
telemetry: false,
authToken: "fake-auth",
org: "fake-org",
project: "fake-project",
release: { inject: false },
sourcemaps: {
ignore: ["**/entry2.js"],
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => {
"sentry-cli-mock.json": "["release","create","CURRENT_SHA","--project","fake-project"],
["release","set-commits","CURRENT_SHA","--auto"],
["release","finalize","CURRENT_SHA"],
["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],
",
}
`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => {
"sentry-cli-mock.json": "["release","create","CURRENT_SHA","--project","fake-project"],
["release","set-commits","CURRENT_SHA","--auto"],
["release","finalize","CURRENT_SHA"],
["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],
",
}
`);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { sentryRollupPlugin } from "@sentry/bundler-plugins/rollup";
import { defineConfig } from "rolldown";
import { sentryConfig } from "../configs/multiple-outputs-mixed-sourcemaps.config.js";

export default defineConfig({
input: ["src/entry1.js", "src/entry2.js"],
output: [
{
dir: "out/multiple-outputs-mixed-sourcemaps",
format: "es",
entryFileNames: "[name].mjs",
chunkFileNames: "[name].mjs",
sourcemap: true,
},
{
dir: "out/multiple-outputs-mixed-sourcemaps",
format: "cjs",
entryFileNames: "[name].cjs",
chunkFileNames: "[name].cjs",
},
],
plugins: [sentryRollupPlugin(sentryConfig)],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runBundler, readOutputFiles }) => {
runBundler();
const files = readOutputFiles();

expect(Object.keys(files).sort()).toMatchInlineSnapshot(`
[
"common.cjs",
"common.mjs",
"common.mjs.map",
"entry1.cjs",
"entry1.mjs",
"entry1.mjs.map",
"entry2.cjs",
"entry2.mjs",
"entry2.mjs.map",
"sentry-cli-mock.json",
]
`);
// The two outputs write at the same time, so the order of the CLI calls varies.
expect(files["sentry-cli-mock.json"]!.trim().split("\n").sort()).toMatchInlineSnapshot(`
[
"["release","create","CURRENT_SHA","--project","fake-project"],",
"["release","create","CURRENT_SHA","--project","fake-project"],",
"["release","finalize","CURRENT_SHA"],",
"["release","finalize","CURRENT_SHA"],",
"["release","set-commits","CURRENT_SHA","--auto"],",
"["release","set-commits","CURRENT_SHA","--auto"],",
"["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],",
"["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],",
]
`);
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles }) => {
",
"sentry-cli-mock.json": "["release","set-commits","CURRENT_SHA","--auto"],
["release","finalize","CURRENT_SHA"],
["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],
",
}
`);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { sentryRollupPlugin } from "@sentry/bundler-plugins/rollup";
import { defineConfig } from "rolldown";
import { sentryConfig } from "../configs/sourcemaps-assets-auto.config.js";

export default defineConfig({
input: ["src/entry1.js", "src/entry2.js"],
output: {
dir: "out/sourcemaps-assets-auto",
chunkFileNames: "[name].js",
},
plugins: [sentryRollupPlugin(sentryConfig)],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runBundler, readOutputFiles }) => {
runBundler({ SENTRY_TEST_RECORD_UPLOADED_SOURCES: "1" });
const files = readOutputFiles();

expect(Object.keys(files).sort()).toMatchInlineSnapshot(`
[
"common.js",
"entry1.js",
"entry2.js",
"sentry-cli-mock.json",
"sentry-uploaded-sources.json",
]
`);
expect(JSON.parse(files["sentry-uploaded-sources.json"]!)).toMatchInlineSnapshot(`
[
[
"../../src/entry1.js",
],
]
`);
expect(files["sentry-cli-mock.json"]).toMatchInlineSnapshot(`
"["release","create","CURRENT_SHA","--project","fake-project"],
["release","set-commits","CURRENT_SHA","--auto"],
["release","finalize","CURRENT_SHA"],
["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],
"
`);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { sentryRollupPlugin } from "@sentry/bundler-plugins/rollup";
import { defineConfig } from "rolldown";
import { sentryConfig } from "../configs/sourcemaps-ignore-auto.config.js";

export default defineConfig({
input: ["src/entry1.js", "src/entry2.js"],
output: {
dir: "out/sourcemaps-ignore-auto",
chunkFileNames: "[name].js",
},
plugins: [sentryRollupPlugin(sentryConfig)],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runBundler, readOutputFiles }) => {
runBundler({ SENTRY_TEST_RECORD_UPLOADED_SOURCES: "1" });
const files = readOutputFiles();

expect(Object.keys(files).sort()).toMatchInlineSnapshot(`
[
"common.js",
"entry1.js",
"entry2.js",
"sentry-cli-mock.json",
"sentry-uploaded-sources.json",
]
`);
expect(JSON.parse(files["sentry-uploaded-sources.json"]!)).toMatchInlineSnapshot(`
[
[
"../../src/common.js",
],
[
"../../src/entry1.js",
],
]
`);
expect(files["sentry-cli-mock.json"]).toMatchInlineSnapshot(`
"["release","create","CURRENT_SHA","--project","fake-project"],
["release","set-commits","CURRENT_SHA","--auto"],
["release","finalize","CURRENT_SHA"],
["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],
"
`);
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => {
"sentry-cli-mock.json": "["release","create","CURRENT_SHA","--project","fake-project"],
["release","set-commits","CURRENT_SHA","--auto"],
["release","finalize","CURRENT_SHA"],
["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],
",
}
`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => {
"sentry-cli-mock.json": "["release","create","CURRENT_SHA","--project","fake-project"],
["release","set-commits","CURRENT_SHA","--auto"],
["release","finalize","CURRENT_SHA"],
["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],
",
}
`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles }) => {
",
"sentry-cli-mock.json": "["release","set-commits","CURRENT_SHA","--auto"],
["release","finalize","CURRENT_SHA"],
["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],
",
}
`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => {
"sentry-cli-mock.json": "["release","create","CURRENT_SHA","--project","fake-project"],
["release","set-commits","CURRENT_SHA","--auto"],
["release","finalize","CURRENT_SHA"],
["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],
",
}
`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => {
"sentry-cli-mock.json": "["release","create","CURRENT_SHA","--project","fake-project"],
["release","set-commits","CURRENT_SHA","--auto"],
["release","finalize","CURRENT_SHA"],
["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],
Comment thread
timfish marked this conversation as resolved.
Resolved
",
}
`);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { sentryRollupPlugin } from "@sentry/bundler-plugins/rollup";
import { defineConfig } from "rollup";
import { sentryConfig } from "../configs/multiple-outputs-mixed-sourcemaps.config.js";

export default defineConfig({
input: ["src/entry1.js", "src/entry2.js"],
output: [
{
dir: "out/multiple-outputs-mixed-sourcemaps",
format: "es",
entryFileNames: "[name].mjs",
chunkFileNames: "[name].mjs",
sourcemap: true,
},
{
dir: "out/multiple-outputs-mixed-sourcemaps",
format: "cjs",
entryFileNames: "[name].cjs",
chunkFileNames: "[name].cjs",
},
],
plugins: [sentryRollupPlugin(sentryConfig)],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runBundler, readOutputFiles }) => {
runBundler();
const files = readOutputFiles();

expect(Object.keys(files).sort()).toMatchInlineSnapshot(`
[
"common.cjs",
"common.mjs",
"common.mjs.map",
"entry1.cjs",
"entry1.mjs",
"entry1.mjs.map",
"entry2.cjs",
"entry2.mjs",
"entry2.mjs.map",
"sentry-cli-mock.json",
]
`);
// The two outputs write at the same time, so the order of the CLI calls varies.
expect(files["sentry-cli-mock.json"]!.trim().split("\n").sort()).toMatchInlineSnapshot(`
[
"["release","create","CURRENT_SHA","--project","fake-project"],",
"["release","create","CURRENT_SHA","--project","fake-project"],",
"["release","finalize","CURRENT_SHA"],",
"["release","finalize","CURRENT_SHA"],",
"["release","set-commits","CURRENT_SHA","--auto"],",
"["release","set-commits","CURRENT_SHA","--auto"],",
"["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],",
"["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],",
]
`);
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ test(import.meta.url, ({ runBundler, readOutputFiles }) => {
",
"sentry-cli-mock.json": "["release","set-commits","CURRENT_SHA","--auto"],
["release","finalize","CURRENT_SHA"],
["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],
",
}
`);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { sentryRollupPlugin } from "@sentry/bundler-plugins/rollup";
import { defineConfig } from "rollup";
import { sentryConfig } from "../configs/sourcemaps-assets-auto.config.js";

export default defineConfig({
input: ["src/entry1.js", "src/entry2.js"],
output: {
dir: "out/sourcemaps-assets-auto",
chunkFileNames: "[name].js",
},
plugins: [sentryRollupPlugin(sentryConfig)],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { expect } from "vitest";
import { test } from "./utils";

test(import.meta.url, ({ runBundler, readOutputFiles }) => {
runBundler({ SENTRY_TEST_RECORD_UPLOADED_SOURCES: "1" });
const files = readOutputFiles();

expect(Object.keys(files).sort()).toMatchInlineSnapshot(`
[
"common.js",
"entry1.js",
"entry2.js",
"sentry-cli-mock.json",
"sentry-uploaded-sources.json",
]
`);
expect(JSON.parse(files["sentry-uploaded-sources.json"]!)).toMatchInlineSnapshot(`
[
[
"../../src/entry1.js",
],
]
`);
expect(files["sentry-cli-mock.json"]).toMatchInlineSnapshot(`
"["release","create","CURRENT_SHA","--project","fake-project"],
["release","set-commits","CURRENT_SHA","--auto"],
["release","finalize","CURRENT_SHA"],
["sourcemap","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path"],
"
`);
});
Loading
Loading