Skip to content
Open
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 @@ -16,6 +16,23 @@

Work in this release was contributed by @lazerg and @chiliec. 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.10.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,33 @@
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",
"common.js.map",
"entry1.js",
"entry2.js",
"entry2.js.map",
"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,35 @@
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",
"entry2.js.map",
"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"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only integration changes are an extra sourcemap upload line in the basic, basic-cjs and release-disabled snapshots. Unit tests cover the staging in depth, but none uses the Rollup CLI or several outputs, which is how concern 1 shows up in practice.

Suggestion: add one integration fixture with an array of outputs into one directory and mixed sourcemap settings. It runs through the real CLI path and would catch the note on packages/bundler-plugins/src/rollup/source-map-handling.ts line 82

",
}
`);
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,33 @@
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",
"common.js.map",
"entry1.js",
"entry2.js",
"entry2.js.map",
"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