diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..94f480de --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf \ No newline at end of file diff --git a/package.json b/package.json index faec26e2..f7d9d9b3 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,9 @@ "packages/vite-plugin", "packages/webpack-plugin", "packages/integration-tests-next", - "packages/integration-tests-next/fixtures/rolldown" + "packages/integration-tests-next/fixtures/rolldown", + "packages/integration-tests-next/fixtures/rollup3", + "packages/integration-tests-next/fixtures/rollup4" ], "scripts": { "postinstall": "patch-package", diff --git a/packages/integration-tests-next/fixtures/configs/after-upload-deletion.config.d.ts b/packages/integration-tests-next/fixtures/configs/after-upload-deletion.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/after-upload-deletion.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/after-upload-deletion.config.js b/packages/integration-tests-next/fixtures/configs/after-upload-deletion.config.js new file mode 100644 index 00000000..ae8efaa2 --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/after-upload-deletion.config.js @@ -0,0 +1,6 @@ +export const sentryConfig = { + telemetry: false, + sourcemaps: { + filesToDeleteAfterUpload: ["out/after-upload-deletion/basic.js.map"], + }, +}; diff --git a/packages/integration-tests-next/fixtures/configs/application-key.config.d.ts b/packages/integration-tests-next/fixtures/configs/application-key.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/application-key.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/application-key.config.js b/packages/integration-tests-next/fixtures/configs/application-key.config.js new file mode 100644 index 00000000..26041ce4 --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/application-key.config.js @@ -0,0 +1,4 @@ +export const sentryConfig = { + telemetry: false, + applicationKey: "1234567890abcdef", +}; diff --git a/packages/integration-tests-next/fixtures/configs/basic-release-disabled.config.d.ts b/packages/integration-tests-next/fixtures/configs/basic-release-disabled.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/basic-release-disabled.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/basic-release-disabled.config.js b/packages/integration-tests-next/fixtures/configs/basic-release-disabled.config.js new file mode 100644 index 00000000..9d6c407e --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/basic-release-disabled.config.js @@ -0,0 +1,4 @@ +export const sentryConfig = { + telemetry: false, + release: { create: false, inject: false }, +}; diff --git a/packages/integration-tests-next/fixtures/configs/basic-sourcemaps.config.d.ts b/packages/integration-tests-next/fixtures/configs/basic-sourcemaps.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/basic-sourcemaps.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/basic-sourcemaps.config.js b/packages/integration-tests-next/fixtures/configs/basic-sourcemaps.config.js new file mode 100644 index 00000000..d96d240d --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/basic-sourcemaps.config.js @@ -0,0 +1,6 @@ +export const sentryConfig = { + telemetry: false, + authToken: "fake-auth", + org: "fake-org", + project: "fake-project", +}; diff --git a/packages/integration-tests-next/fixtures/configs/basic.config.d.ts b/packages/integration-tests-next/fixtures/configs/basic.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/basic.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/basic.config.js b/packages/integration-tests-next/fixtures/configs/basic.config.js new file mode 100644 index 00000000..d96d240d --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/basic.config.js @@ -0,0 +1,6 @@ +export const sentryConfig = { + telemetry: false, + authToken: "fake-auth", + org: "fake-org", + project: "fake-project", +}; diff --git a/packages/integration-tests-next/fixtures/configs/build-info.config.d.ts b/packages/integration-tests-next/fixtures/configs/build-info.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/build-info.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/build-info.config.js b/packages/integration-tests-next/fixtures/configs/build-info.config.js new file mode 100644 index 00000000..5eaff477 --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/build-info.config.js @@ -0,0 +1,7 @@ +export const sentryConfig = { + telemetry: false, + release: { + name: "build-information-injection-test", + }, + _experiments: { injectBuildInformation: true }, +}; diff --git a/packages/integration-tests-next/fixtures/configs/bundle-size-optimizations.config.d.ts b/packages/integration-tests-next/fixtures/configs/bundle-size-optimizations.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/bundle-size-optimizations.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/bundle-size-optimizations.config.js b/packages/integration-tests-next/fixtures/configs/bundle-size-optimizations.config.js new file mode 100644 index 00000000..6e7f6b72 --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/bundle-size-optimizations.config.js @@ -0,0 +1,11 @@ +export const sentryConfig = { + telemetry: false, + bundleSizeOptimizations: { + excludeDebugStatements: true, + excludeTracing: true, + excludeReplayCanvas: true, + excludeReplayIframe: true, + excludeReplayShadowDom: true, + excludeReplayWorker: true, + }, +}; diff --git a/packages/integration-tests-next/fixtures/configs/component-annotation-disabled.config.d.ts b/packages/integration-tests-next/fixtures/configs/component-annotation-disabled.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/component-annotation-disabled.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/component-annotation-disabled.config.js b/packages/integration-tests-next/fixtures/configs/component-annotation-disabled.config.js new file mode 100644 index 00000000..8891d92b --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/component-annotation-disabled.config.js @@ -0,0 +1,3 @@ +export const sentryConfig = { + telemetry: false, +}; diff --git a/packages/integration-tests-next/fixtures/configs/component-annotation-next.config.d.ts b/packages/integration-tests-next/fixtures/configs/component-annotation-next.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/component-annotation-next.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/component-annotation-next.config.js b/packages/integration-tests-next/fixtures/configs/component-annotation-next.config.js new file mode 100644 index 00000000..6ef1a7fe --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/component-annotation-next.config.js @@ -0,0 +1,4 @@ +export const sentryConfig = { + telemetry: false, + reactComponentAnnotation: { enabled: true, _experimentalInjectIntoHtml: true }, +}; diff --git a/packages/integration-tests-next/fixtures/configs/component-annotation.config.d.ts b/packages/integration-tests-next/fixtures/configs/component-annotation.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/component-annotation.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/component-annotation.config.js b/packages/integration-tests-next/fixtures/configs/component-annotation.config.js new file mode 100644 index 00000000..484acf9d --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/component-annotation.config.js @@ -0,0 +1,4 @@ +export const sentryConfig = { + telemetry: false, + reactComponentAnnotation: { enabled: true }, +}; diff --git a/packages/integration-tests-next/fixtures/configs/debugid-disabled.config.d.ts b/packages/integration-tests-next/fixtures/configs/debugid-disabled.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/debugid-disabled.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/debugid-disabled.config.js b/packages/integration-tests-next/fixtures/configs/debugid-disabled.config.js new file mode 100644 index 00000000..471befe9 --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/debugid-disabled.config.js @@ -0,0 +1,9 @@ +export const sentryConfig = { + telemetry: false, + sourcemaps: { + disable: true, + }, + release: { + inject: false, + }, +}; diff --git a/packages/integration-tests-next/fixtures/configs/debugids-already-injected.config.d.ts b/packages/integration-tests-next/fixtures/configs/debugids-already-injected.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/debugids-already-injected.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/debugids-already-injected.config.js b/packages/integration-tests-next/fixtures/configs/debugids-already-injected.config.js new file mode 100644 index 00000000..e9dc3f97 --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/debugids-already-injected.config.js @@ -0,0 +1,7 @@ +export const sentryConfig = { + telemetry: false, + // We need to specify these so that upload is attempted. Debug IDs will be injected before then... + authToken: "fake-auth", + org: "fake-org", + project: "fake-project", +}; diff --git a/packages/integration-tests-next/fixtures/configs/module-metadata.config.d.ts b/packages/integration-tests-next/fixtures/configs/module-metadata.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/module-metadata.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/module-metadata.config.js b/packages/integration-tests-next/fixtures/configs/module-metadata.config.js new file mode 100644 index 00000000..e0a7cb1f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/module-metadata.config.js @@ -0,0 +1,4 @@ +export const sentryConfig = { + telemetry: false, + moduleMetadata: { something: "value", another: 999 }, +}; diff --git a/packages/integration-tests-next/fixtures/configs/multiple-entry-points.config.d.ts b/packages/integration-tests-next/fixtures/configs/multiple-entry-points.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/multiple-entry-points.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/multiple-entry-points.config.js b/packages/integration-tests-next/fixtures/configs/multiple-entry-points.config.js new file mode 100644 index 00000000..9e60b27e --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/multiple-entry-points.config.js @@ -0,0 +1,4 @@ +export const sentryConfig = { + telemetry: false, + release: { inject: false }, +}; diff --git a/packages/integration-tests-next/fixtures/configs/package.json b/packages/integration-tests-next/fixtures/configs/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/packages/integration-tests-next/fixtures/configs/query-param.config.d.ts b/packages/integration-tests-next/fixtures/configs/query-param.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/query-param.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/query-param.config.js b/packages/integration-tests-next/fixtures/configs/query-param.config.js new file mode 100644 index 00000000..8891d92b --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/query-param.config.js @@ -0,0 +1,3 @@ +export const sentryConfig = { + telemetry: false, +}; diff --git a/packages/integration-tests-next/fixtures/configs/release-disabled.config.d.ts b/packages/integration-tests-next/fixtures/configs/release-disabled.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/release-disabled.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/release-disabled.config.js b/packages/integration-tests-next/fixtures/configs/release-disabled.config.js new file mode 100644 index 00000000..b0c5a5fb --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/release-disabled.config.js @@ -0,0 +1,7 @@ +export const sentryConfig = { + telemetry: false, + authToken: "fake-auth", + org: "fake-org", + project: "fake-project", + release: { create: false }, +}; diff --git a/packages/integration-tests-next/fixtures/configs/telemetry.config.d.ts b/packages/integration-tests-next/fixtures/configs/telemetry.config.d.ts new file mode 100644 index 00000000..f739482f --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/telemetry.config.d.ts @@ -0,0 +1,2 @@ +import type { SentryRollupPluginOptions } from "@sentry/rollup-plugin"; +export declare const sentryConfig: SentryRollupPluginOptions; diff --git a/packages/integration-tests-next/fixtures/configs/telemetry.config.js b/packages/integration-tests-next/fixtures/configs/telemetry.config.js new file mode 100644 index 00000000..789aad8b --- /dev/null +++ b/packages/integration-tests-next/fixtures/configs/telemetry.config.js @@ -0,0 +1 @@ +export const sentryConfig = {}; diff --git a/packages/integration-tests-next/fixtures/rolldown/after-upload-deletion.config.ts b/packages/integration-tests-next/fixtures/rolldown/after-upload-deletion.config.ts index dd228f17..5a95ed13 100644 --- a/packages/integration-tests-next/fixtures/rolldown/after-upload-deletion.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/after-upload-deletion.config.ts @@ -1,5 +1,6 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/after-upload-deletion.config.js"; export default defineConfig({ input: "src/basic.js", @@ -7,12 +8,5 @@ export default defineConfig({ file: "out/after-upload-deletion/basic.js", sourcemap: true, }, - plugins: [ - sentryRollupPlugin({ - telemetry: false, - sourcemaps: { - filesToDeleteAfterUpload: ["out/after-upload-deletion/basic.js.map"], - }, - }), - ], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/after-upload-deletion.test.ts b/packages/integration-tests-next/fixtures/rolldown/after-upload-deletion.test.ts index 2adae022..b9900075 100644 --- a/packages/integration-tests-next/fixtures/rolldown/after-upload-deletion.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/after-upload-deletion.test.ts @@ -1,8 +1,8 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles, runFileInNode }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` { "basic.js": "//#region src/basic.js diff --git a/packages/integration-tests-next/fixtures/rolldown/application-key.config.ts b/packages/integration-tests-next/fixtures/rolldown/application-key.config.ts index 9b6c7fb2..2c64afa1 100644 --- a/packages/integration-tests-next/fixtures/rolldown/application-key.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/application-key.config.ts @@ -1,10 +1,11 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/application-key.config.js"; export default defineConfig({ input: "src/basic.js", output: { file: "out/application-key/basic.js", }, - plugins: [sentryRollupPlugin({ telemetry: false, applicationKey: "1234567890abcdef" })], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/application-key.test.ts b/packages/integration-tests-next/fixtures/rolldown/application-key.test.ts index 99e7f1fd..460d301b 100644 --- a/packages/integration-tests-next/fixtures/rolldown/application-key.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/application-key.test.ts @@ -1,8 +1,8 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` { "basic.js": "//#region src/basic.js diff --git a/packages/integration-tests-next/fixtures/rolldown/basic-release-disabled.config.ts b/packages/integration-tests-next/fixtures/rolldown/basic-release-disabled.config.ts index ea1a1453..dd8d811d 100644 --- a/packages/integration-tests-next/fixtures/rolldown/basic-release-disabled.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/basic-release-disabled.config.ts @@ -1,10 +1,11 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/basic-release-disabled.config.js"; export default defineConfig({ input: "src/basic.js", output: { file: "out/basic-release-disabled/basic.js", }, - plugins: [sentryRollupPlugin({ telemetry: false, release: { create: false, inject: false } })], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/basic-release-disabled.test.ts b/packages/integration-tests-next/fixtures/rolldown/basic-release-disabled.test.ts index 4d5038b2..76252834 100644 --- a/packages/integration-tests-next/fixtures/rolldown/basic-release-disabled.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/basic-release-disabled.test.ts @@ -1,8 +1,8 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` { "basic.js": "//#region src/basic.js diff --git a/packages/integration-tests-next/fixtures/rolldown/basic-sourcemaps.config.ts b/packages/integration-tests-next/fixtures/rolldown/basic-sourcemaps.config.ts index 56b5a6f5..0109e892 100644 --- a/packages/integration-tests-next/fixtures/rolldown/basic-sourcemaps.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/basic-sourcemaps.config.ts @@ -1,5 +1,6 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/basic-sourcemaps.config.js"; export default defineConfig({ input: "src/basic.js", @@ -7,12 +8,5 @@ export default defineConfig({ file: "out/basic-sourcemaps/basic.js", sourcemap: true, }, - plugins: [ - sentryRollupPlugin({ - telemetry: false, - authToken: "fake-auth", - org: "fake-org", - project: "fake-project", - }), - ], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/basic-sourcemaps.test.ts b/packages/integration-tests-next/fixtures/rolldown/basic-sourcemaps.test.ts index 390d99bb..4f158672 100644 --- a/packages/integration-tests-next/fixtures/rolldown/basic-sourcemaps.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/basic-sourcemaps.test.ts @@ -1,8 +1,8 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles, runFileInNode }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` { "basic.js": "//#region src/basic.js diff --git a/packages/integration-tests-next/fixtures/rolldown/basic.config.ts b/packages/integration-tests-next/fixtures/rolldown/basic.config.ts index 689db6b9..b026f594 100644 --- a/packages/integration-tests-next/fixtures/rolldown/basic.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/basic.config.ts @@ -1,17 +1,11 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/basic.config.js"; export default defineConfig({ input: "src/basic.js", output: { file: "out/basic/basic.js", }, - plugins: [ - sentryRollupPlugin({ - telemetry: false, - authToken: "fake-auth", - org: "fake-org", - project: "fake-project", - }), - ], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/basic.test.ts b/packages/integration-tests-next/fixtures/rolldown/basic.test.ts index e8754b21..b3e85d7b 100644 --- a/packages/integration-tests-next/fixtures/rolldown/basic.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/basic.test.ts @@ -1,8 +1,8 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles, runFileInNode }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` { "basic.js": "//#region src/basic.js diff --git a/packages/integration-tests-next/fixtures/rolldown/build-info.config.ts b/packages/integration-tests-next/fixtures/rolldown/build-info.config.ts index 6d059dae..b1bd49d7 100644 --- a/packages/integration-tests-next/fixtures/rolldown/build-info.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/build-info.config.ts @@ -1,18 +1,11 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/build-info.config.js"; export default defineConfig({ input: "src/basic.js", output: { file: "out/build-info/basic.js", }, - plugins: [ - sentryRollupPlugin({ - telemetry: false, - release: { - name: "build-information-injection-test", - }, - _experiments: { injectBuildInformation: true }, - }), - ], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/build-info.test.ts b/packages/integration-tests-next/fixtures/rolldown/build-info.test.ts index 57c07363..127e8c17 100644 --- a/packages/integration-tests-next/fixtures/rolldown/build-info.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/build-info.test.ts @@ -1,8 +1,8 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` { "basic.js": "//#region src/basic.js diff --git a/packages/integration-tests-next/fixtures/rolldown/bundle-size-optimizations.config.ts b/packages/integration-tests-next/fixtures/rolldown/bundle-size-optimizations.config.ts index c7cbbd24..bb5adc2e 100644 --- a/packages/integration-tests-next/fixtures/rolldown/bundle-size-optimizations.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/bundle-size-optimizations.config.ts @@ -1,22 +1,11 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/bundle-size-optimizations.config.js"; export default defineConfig({ input: "src/bundle.js", output: { file: "out/bundle-size-optimizations/bundle.js", }, - plugins: [ - sentryRollupPlugin({ - telemetry: false, - bundleSizeOptimizations: { - excludeDebugStatements: true, - excludeTracing: true, - excludeReplayCanvas: true, - excludeReplayIframe: true, - excludeReplayShadowDom: true, - excludeReplayWorker: true, - }, - }), - ], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/bundle-size-optimizations.test.ts b/packages/integration-tests-next/fixtures/rolldown/bundle-size-optimizations.test.ts index 7f7c1b6a..5e4bb51f 100644 --- a/packages/integration-tests-next/fixtures/rolldown/bundle-size-optimizations.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/bundle-size-optimizations.test.ts @@ -1,8 +1,8 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles, runFileInNode }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` { "bundle.js": "//#region src/bundle.js diff --git a/packages/integration-tests-next/fixtures/rolldown/component-annotation-disabled.config.ts b/packages/integration-tests-next/fixtures/rolldown/component-annotation-disabled.config.ts index 6408342c..9d9258fd 100644 --- a/packages/integration-tests-next/fixtures/rolldown/component-annotation-disabled.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/component-annotation-disabled.config.ts @@ -1,5 +1,6 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/component-annotation-disabled.config.js"; export default defineConfig({ input: "src/app.jsx", @@ -9,5 +10,5 @@ export default defineConfig({ output: { file: "out/component-annotation-disabled/app.js", }, - plugins: [sentryRollupPlugin({ telemetry: false })], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/component-annotation-disabled.test.ts b/packages/integration-tests-next/fixtures/rolldown/component-annotation-disabled.test.ts index f6579e7a..3f98e67c 100644 --- a/packages/integration-tests-next/fixtures/rolldown/component-annotation-disabled.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/component-annotation-disabled.test.ts @@ -1,25 +1,25 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` - { - "app.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ea5adc74-2664-4c38-8492-6e4971efd2be",e._sentryDebugIdIdentifier="sentry-dbid-ea5adc74-2664-4c38-8492-6e4971efd2be");}catch(e){}}();import { jsx, jsxs } from "../node_modules/react/jsx-runtime.js"; + { + "app.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b0a43d00-208c-4b0e-b024-c0951a1c11f8",e._sentryDebugIdIdentifier="sentry-dbid-b0a43d00-208c-4b0e-b024-c0951a1c11f8");}catch(e){}}();import { jsx, jsxs } from "../../../../../node_modules/react/jsx-runtime.js"; - //#region src/component-a.jsx - function ComponentA() { - return /* @__PURE__ */ jsx("span", { children: "Component A" }); - } + //#region src/component-a.jsx + function ComponentA() { + return /* @__PURE__ */ jsx("span", { children: "Component A" }); + } - //#endregion - //#region src/app.jsx - function App() { - return /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx(ComponentA, {}), ";"] }); - } + //#endregion + //#region src/app.jsx + function App() { + return /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx(ComponentA, {}), ";"] }); + } - //#endregion - export { App as default };", - } - `); + //#endregion + export { App as default };", + } + `); }); diff --git a/packages/integration-tests-next/fixtures/rolldown/component-annotation-next.config.ts b/packages/integration-tests-next/fixtures/rolldown/component-annotation-next.config.ts index 6023cb4c..09fc2874 100644 --- a/packages/integration-tests-next/fixtures/rolldown/component-annotation-next.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/component-annotation-next.config.ts @@ -1,5 +1,6 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/component-annotation-next.config.js"; export default defineConfig({ input: "src/app.jsx", @@ -9,10 +10,5 @@ export default defineConfig({ output: { file: "out/component-annotation-next/app.js", }, - plugins: [ - sentryRollupPlugin({ - telemetry: false, - reactComponentAnnotation: { enabled: true, _experimentalInjectIntoHtml: true }, - }), - ], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/component-annotation-next.test.ts b/packages/integration-tests-next/fixtures/rolldown/component-annotation-next.test.ts index 22d0fb42..e3795304 100644 --- a/packages/integration-tests-next/fixtures/rolldown/component-annotation-next.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/component-annotation-next.test.ts @@ -1,31 +1,31 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` - { - "app.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="aa1666c7-eaca-4b84-8c40-9ac56cc75bfb",e._sentryDebugIdIdentifier="sentry-dbid-aa1666c7-eaca-4b84-8c40-9ac56cc75bfb");}catch(e){}}();import { jsx, jsxs } from "../node_modules/react/jsx-runtime.js"; + { + "app.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4bdf6d53-8b4d-4766-b048-143c5e6d2cbd",e._sentryDebugIdIdentifier="sentry-dbid-4bdf6d53-8b4d-4766-b048-143c5e6d2cbd");}catch(e){}}();import { jsx, jsxs } from "../../../../../node_modules/react/jsx-runtime.js"; - //#region src/component-a.jsx - function ComponentA() { - return /* @__PURE__ */ jsx("span", { - "data-sentry-component": "ComponentA", - children: "Component A" - }); - } + //#region src/component-a.jsx + function ComponentA() { + return /* @__PURE__ */ jsx("span", { + "data-sentry-component": "ComponentA", + children: "Component A" + }); + } - //#endregion - //#region src/app.jsx - function App() { - return /* @__PURE__ */ jsxs("span", { - "data-sentry-component": "App", - children: [/* @__PURE__ */ jsx(ComponentA, {}), ";"] - }); - } + //#endregion + //#region src/app.jsx + function App() { + return /* @__PURE__ */ jsxs("span", { + "data-sentry-component": "App", + children: [/* @__PURE__ */ jsx(ComponentA, {}), ";"] + }); + } - //#endregion - export { App as default };", - } - `); + //#endregion + export { App as default };", + } + `); }); diff --git a/packages/integration-tests-next/fixtures/rolldown/component-annotation.config.ts b/packages/integration-tests-next/fixtures/rolldown/component-annotation.config.ts index aa013df1..6c7f330a 100644 --- a/packages/integration-tests-next/fixtures/rolldown/component-annotation.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/component-annotation.config.ts @@ -1,5 +1,6 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/component-annotation.config.js"; export default defineConfig({ input: "src/app.jsx", @@ -9,5 +10,5 @@ export default defineConfig({ output: { file: "out/component-annotation/app.js", }, - plugins: [sentryRollupPlugin({ telemetry: false, reactComponentAnnotation: { enabled: true } })], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/component-annotation.test.ts b/packages/integration-tests-next/fixtures/rolldown/component-annotation.test.ts index cf57acfb..fc9c8203 100644 --- a/packages/integration-tests-next/fixtures/rolldown/component-annotation.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/component-annotation.test.ts @@ -1,36 +1,36 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` - { - "app.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="adb3af3a-5b4a-49fd-b8ae-7ea0905020b6",e._sentryDebugIdIdentifier="sentry-dbid-adb3af3a-5b4a-49fd-b8ae-7ea0905020b6");}catch(e){}}();import { jsx, jsxs } from "../node_modules/react/jsx-runtime.js"; + { + "app.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0880f8a4-f072-4b80-b577-4bb7d5be4841",e._sentryDebugIdIdentifier="sentry-dbid-0880f8a4-f072-4b80-b577-4bb7d5be4841");}catch(e){}}();import { jsx, jsxs } from "../../../../../node_modules/react/jsx-runtime.js"; - //#region src/component-a.jsx - function ComponentA() { - return /* @__PURE__ */ jsx("span", { - "data-sentry-component": "ComponentA", - "data-sentry-source-file": "component-a.jsx", - children: "Component A" - }); - } + //#region src/component-a.jsx + function ComponentA() { + return /* @__PURE__ */ jsx("span", { + "data-sentry-component": "ComponentA", + "data-sentry-source-file": "component-a.jsx", + children: "Component A" + }); + } - //#endregion - //#region src/app.jsx - function App() { - return /* @__PURE__ */ jsxs("span", { - "data-sentry-component": "App", - "data-sentry-source-file": "app.jsx", - children: [/* @__PURE__ */ jsx(ComponentA, { - "data-sentry-element": "ComponentA", - "data-sentry-source-file": "app.jsx" - }), ";"] - }); - } + //#endregion + //#region src/app.jsx + function App() { + return /* @__PURE__ */ jsxs("span", { + "data-sentry-component": "App", + "data-sentry-source-file": "app.jsx", + children: [/* @__PURE__ */ jsx(ComponentA, { + "data-sentry-element": "ComponentA", + "data-sentry-source-file": "app.jsx" + }), ";"] + }); + } - //#endregion - export { App as default };", - } - `); + //#endregion + export { App as default };", + } + `); }); diff --git a/packages/integration-tests-next/fixtures/rolldown/debugid-disabled.config.ts b/packages/integration-tests-next/fixtures/rolldown/debugid-disabled.config.ts index 48a93f32..1edff6ab 100644 --- a/packages/integration-tests-next/fixtures/rolldown/debugid-disabled.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/debugid-disabled.config.ts @@ -1,5 +1,6 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/debugid-disabled.config.js"; export default defineConfig({ input: "src/basic.js", @@ -7,15 +8,5 @@ export default defineConfig({ file: "out/debugid-disabled/basic.js", sourcemap: true, }, - plugins: [ - sentryRollupPlugin({ - telemetry: false, - sourcemaps: { - disable: true, - }, - release: { - inject: false, - }, - }), - ], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/debugid-disabled.test.ts b/packages/integration-tests-next/fixtures/rolldown/debugid-disabled.test.ts index 37f9debd..34262984 100644 --- a/packages/integration-tests-next/fixtures/rolldown/debugid-disabled.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/debugid-disabled.test.ts @@ -1,8 +1,8 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` { "basic.js": "//#region src/basic.js diff --git a/packages/integration-tests-next/fixtures/rolldown/debugids-already-injected.config.ts b/packages/integration-tests-next/fixtures/rolldown/debugids-already-injected.config.ts index 4a31b424..01ad08fe 100644 --- a/packages/integration-tests-next/fixtures/rolldown/debugids-already-injected.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/debugids-already-injected.config.ts @@ -1,5 +1,6 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/debugids-already-injected.config.js"; export default defineConfig({ input: "src/basic.js", @@ -8,13 +9,5 @@ export default defineConfig({ sourcemap: true, sourcemapDebugIds: true, }, - plugins: [ - sentryRollupPlugin({ - telemetry: false, - // We need to specify these so that upload is attempted. Debug IDs will be injected before then... - authToken: "fake-auth", - org: "fake-org", - project: "fake-project", - }), - ], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/debugids-already-injected.test.ts b/packages/integration-tests-next/fixtures/rolldown/debugids-already-injected.test.ts index 19d68f7a..398dc71f 100644 --- a/packages/integration-tests-next/fixtures/rolldown/debugids-already-injected.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/debugids-already-injected.test.ts @@ -2,10 +2,10 @@ import { expect } from "vitest"; import { readAllFiles } from "../utils"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, createTempDir }) => { +test(import.meta.url, ({ runBundler, createTempDir }) => { const tempDir = createTempDir(); - runRolldown({ SENTRY_TEST_OVERRIDE_TEMP_DIR: tempDir }); + runBundler({ SENTRY_TEST_OVERRIDE_TEMP_DIR: tempDir }); const files = readAllFiles(tempDir); expect(files).toMatchInlineSnapshot(` { diff --git a/packages/integration-tests-next/fixtures/rolldown/module-metadata.config.ts b/packages/integration-tests-next/fixtures/rolldown/module-metadata.config.ts index 9c867075..48999991 100644 --- a/packages/integration-tests-next/fixtures/rolldown/module-metadata.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/module-metadata.config.ts @@ -1,12 +1,11 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/module-metadata.config.js"; export default defineConfig({ input: "src/basic.js", output: { file: "out/module-metadata/basic.js", }, - plugins: [ - sentryRollupPlugin({ telemetry: false, moduleMetadata: { something: "value", another: 999 } }), - ], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/module-metadata.test.ts b/packages/integration-tests-next/fixtures/rolldown/module-metadata.test.ts index 74ef2b31..ece716eb 100644 --- a/packages/integration-tests-next/fixtures/rolldown/module-metadata.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/module-metadata.test.ts @@ -1,8 +1,8 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles, runFileInNode }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` { "basic.js": "//#region src/basic.js diff --git a/packages/integration-tests-next/fixtures/rolldown/multiple-entry-points.config.ts b/packages/integration-tests-next/fixtures/rolldown/multiple-entry-points.config.ts index 038f7c09..59cf33a0 100644 --- a/packages/integration-tests-next/fixtures/rolldown/multiple-entry-points.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/multiple-entry-points.config.ts @@ -1,5 +1,6 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/multiple-entry-points.config.js"; export default defineConfig({ input: ["src/entry1.js", "src/entry2.js"], @@ -7,5 +8,5 @@ export default defineConfig({ dir: "out/multiple-entry-points", chunkFileNames: "[name].js", }, - plugins: [sentryRollupPlugin({ telemetry: false, release: { inject: false } })], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/multiple-entry-points.test.ts b/packages/integration-tests-next/fixtures/rolldown/multiple-entry-points.test.ts index 11fcadbb..7659f27b 100644 --- a/packages/integration-tests-next/fixtures/rolldown/multiple-entry-points.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/multiple-entry-points.test.ts @@ -1,8 +1,8 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles, runFileInNode }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` { "common.js": "//#region src/common.js diff --git a/packages/integration-tests-next/fixtures/rolldown/query-param.config.ts b/packages/integration-tests-next/fixtures/rolldown/query-param.config.ts index d7697c48..81e15c2e 100644 --- a/packages/integration-tests-next/fixtures/rolldown/query-param.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/query-param.config.ts @@ -1,5 +1,6 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/query-param.config.js"; export default defineConfig({ input: ["src/entry1.js", "src/entry2.js"], @@ -7,5 +8,5 @@ export default defineConfig({ dir: "out/query-param", chunkFileNames: "[name].js?seP58q4g", }, - plugins: [sentryRollupPlugin({ telemetry: false })], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/query-param.test.ts b/packages/integration-tests-next/fixtures/rolldown/query-param.test.ts index 76cf7baf..5b3a013a 100644 --- a/packages/integration-tests-next/fixtures/rolldown/query-param.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/query-param.test.ts @@ -1,13 +1,13 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles, ctx }) => { +test(import.meta.url, ({ runBundler, readOutputFiles, ctx }) => { if (process.platform === "win32") { ctx.skip("Query params do not work in paths on Windows"); return; } - runRolldown(); + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` { "common.js?seP58q4g": "//#region src/common.js diff --git a/packages/integration-tests-next/fixtures/rolldown/release-disabled.config.ts b/packages/integration-tests-next/fixtures/rolldown/release-disabled.config.ts index ac3468c0..549c2298 100644 --- a/packages/integration-tests-next/fixtures/rolldown/release-disabled.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/release-disabled.config.ts @@ -1,18 +1,11 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/release-disabled.config.js"; export default defineConfig({ input: "src/basic.js", output: { file: "out/release-disabled/basic.js", }, - plugins: [ - sentryRollupPlugin({ - telemetry: false, - authToken: "fake-auth", - org: "fake-org", - project: "fake-project", - release: { create: false }, - }), - ], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/release-disabled.test.ts b/packages/integration-tests-next/fixtures/rolldown/release-disabled.test.ts index dfb0642d..18821086 100644 --- a/packages/integration-tests-next/fixtures/rolldown/release-disabled.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/release-disabled.test.ts @@ -1,8 +1,8 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` { "basic.js": "//#region src/basic.js diff --git a/packages/integration-tests-next/fixtures/rolldown/telemetry.config.ts b/packages/integration-tests-next/fixtures/rolldown/telemetry.config.ts index c6781218..15a329ca 100644 --- a/packages/integration-tests-next/fixtures/rolldown/telemetry.config.ts +++ b/packages/integration-tests-next/fixtures/rolldown/telemetry.config.ts @@ -1,10 +1,11 @@ import { sentryRollupPlugin } from "@sentry/rollup-plugin"; import { defineConfig } from "rolldown"; +import { sentryConfig } from "../configs/telemetry.config.js"; export default defineConfig({ input: "src/basic.js", output: { file: "out/telemetry/basic.js", }, - plugins: [sentryRollupPlugin()], + plugins: [sentryRollupPlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/rolldown/telemetry.test.ts b/packages/integration-tests-next/fixtures/rolldown/telemetry.test.ts index 59bddafa..7fe93c65 100644 --- a/packages/integration-tests-next/fixtures/rolldown/telemetry.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/telemetry.test.ts @@ -1,8 +1,8 @@ import { expect } from "vitest"; import { test } from "./utils"; -test(import.meta.url, ({ runRolldown, readOutputFiles, runFileInNode }) => { - runRolldown(); +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` { "basic.js": "//#region src/basic.js diff --git a/packages/integration-tests-next/fixtures/rolldown/utils.ts b/packages/integration-tests-next/fixtures/rolldown/utils.ts index 7fae183f..3b00ad73 100644 --- a/packages/integration-tests-next/fixtures/rolldown/utils.ts +++ b/packages/integration-tests-next/fixtures/rolldown/utils.ts @@ -10,7 +10,7 @@ const NODE_MAJOR_VERSION = parseInt(process.versions.node.split(".")[0] || "0", type TestCallback = (props: { outDir: string; - runRolldown: (env?: Record) => void; + runBundler: (env?: Record) => void; readOutputFiles: () => Record; runFileInNode: (file: string) => string; createTempDir: () => string; @@ -34,7 +34,7 @@ export function test(url: string, callback: TestCallback) { vitestTest(`rolldown > ${testName}`, (ctx) => callback({ outDir, - runRolldown: (env) => + runBundler: (env) => runBundler( `rolldown --config ${testName}.config.ts`, { diff --git a/packages/integration-tests-next/fixtures/rollup3/after-upload-deletion.config.js b/packages/integration-tests-next/fixtures/rollup3/after-upload-deletion.config.js new file mode 100644 index 00000000..36abdcfc --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/after-upload-deletion.config.js @@ -0,0 +1,12 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/after-upload-deletion.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/after-upload-deletion/basic.js", + sourcemap: true, + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/after-upload-deletion.test.ts b/packages/integration-tests-next/fixtures/rollup3/after-upload-deletion.test.ts new file mode 100644 index 00000000..10892756 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/after-upload-deletion.test.ts @@ -0,0 +1,17 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + //# sourceMappingURL=basic.js.map + ", + } + `); + + const output = runFileInNode("basic.js"); + expect(output).toBe("hello world\n"); +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/application-key.config.js b/packages/integration-tests-next/fixtures/rollup3/application-key.config.js new file mode 100644 index 00000000..fed66578 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/application-key.config.js @@ -0,0 +1,11 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/application-key.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/application-key/basic.js", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/application-key.test.ts b/packages/integration-tests-next/fixtures/rollup3/application-key.test.ts new file mode 100644 index 00000000..eb1bfb06 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/application-key.test.ts @@ -0,0 +1,13 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=function(e){for(var n=1;n { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + ", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/basic-sourcemaps.config.js b/packages/integration-tests-next/fixtures/rollup3/basic-sourcemaps.config.js new file mode 100644 index 00000000..4d708921 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/basic-sourcemaps.config.js @@ -0,0 +1,12 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/basic-sourcemaps.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/basic-sourcemaps/basic.js", + sourcemap: true, + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/basic-sourcemaps.test.ts b/packages/integration-tests-next/fixtures/rollup3/basic-sourcemaps.test.ts new file mode 100644 index 00000000..e6c86989 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/basic-sourcemaps.test.ts @@ -0,0 +1,23 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + //# sourceMappingURL=basic.js.map + ", + "basic.js.map": "{"version":3,"file":"basic.js","sources":["../../src/basic.js"],"sourcesContent":["// eslint-disable-next-line no-console\\nconsole.log(\\"hello world\\");\\n"],"names":[],"mappings":"AAAA,CAAA,CAAA,CAAA,MAAA,CAAA,OAAA,CAAA,IAAA,CAAA,IAAA,CAAA,EAAA,CAAA;scACA,OAAO,CAAC,GAAG,CAAC,CAAA,KAAA,CAAA,KAAA,CAAa,CAAC"}", + "sentry-cli-mock.json": "["releases","new","CURRENT_SHA"], + ["releases","set-commits","CURRENT_SHA","--auto","--ignore-missing"], + ["releases","finalize","CURRENT_SHA"], + ["sourcemaps","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path","--ignore","node_modules","--no-rewrite"], + ", + } + `); + + const output = runFileInNode("basic.js"); + expect(output).toBe("hello world\n"); +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/basic.config.js b/packages/integration-tests-next/fixtures/rollup3/basic.config.js new file mode 100644 index 00000000..8f36cde5 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/basic.config.js @@ -0,0 +1,11 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/basic.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/basic/basic.js", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/basic.test.ts b/packages/integration-tests-next/fixtures/rollup3/basic.test.ts new file mode 100644 index 00000000..47d05666 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/basic.test.ts @@ -0,0 +1,21 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + ", + "sentry-cli-mock.json": "["releases","new","CURRENT_SHA"], + ["releases","set-commits","CURRENT_SHA","--auto","--ignore-missing"], + ["releases","finalize","CURRENT_SHA"], + ["sourcemaps","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path","--ignore","node_modules","--no-rewrite"], + ", + } + `); + + const output = runFileInNode("basic.js"); + expect(output).toBe("hello world\n"); +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/build-info.config.js b/packages/integration-tests-next/fixtures/rollup3/build-info.config.js new file mode 100644 index 00000000..984f33b2 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/build-info.config.js @@ -0,0 +1,11 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/build-info.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/build-info/basic.js", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/build-info.test.ts b/packages/integration-tests-next/fixtures/rollup3/build-info.test.ts new file mode 100644 index 00000000..a6c895dc --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/build-info.test.ts @@ -0,0 +1,13 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"build-information-injection-test"};e.SENTRY_BUILD_INFO={"deps":["@rollup/plugin-babel","@rollup/plugin-node-resolve","react","rollup"],"depsVersions":{"react":19,"rollup":3},"nodeVersion":"NODE_VERSION"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + ", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/bundle-size-optimizations.config.js b/packages/integration-tests-next/fixtures/rollup3/bundle-size-optimizations.config.js new file mode 100644 index 00000000..6b37e5cc --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/bundle-size-optimizations.config.js @@ -0,0 +1,11 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/bundle-size-optimizations.config.js"; + +export default defineConfig({ + input: "src/bundle.js", + output: { + file: "out/bundle-size-optimizations/bundle.js", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/bundle-size-optimizations.test.ts b/packages/integration-tests-next/fixtures/rollup3/bundle-size-optimizations.test.ts new file mode 100644 index 00000000..f7ddff94 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/bundle-size-optimizations.test.ts @@ -0,0 +1,27 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "bundle.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9ba2eb17-5b67-4bb4-bfcf-dca3e3b993b4",e._sentryDebugIdIdentifier="sentry-dbid-9ba2eb17-5b67-4bb4-bfcf-dca3e3b993b4");}catch(e){}}();console.log( + JSON.stringify({ + debug: "b", + trace: "b", + replayCanvas: "a" , + replayIframe: "a" , + replayShadowDom: "a" , + replayWorker: "a" , + }) + ); + ", + } + `); + + const output = runFileInNode("bundle.js"); + expect(output).toMatchInlineSnapshot(` + "{"debug":"b","trace":"b","replayCanvas":"a","replayIframe":"a","replayShadowDom":"a","replayWorker":"a"} + " + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/component-annotation-disabled.config.js b/packages/integration-tests-next/fixtures/rollup3/component-annotation-disabled.config.js new file mode 100644 index 00000000..aaa7dfec --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/component-annotation-disabled.config.js @@ -0,0 +1,28 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/component-annotation-disabled.config.js"; +import { babel } from "@rollup/plugin-babel"; +import resolve from "@rollup/plugin-node-resolve"; + +const RESOLVABLE_EXTENSIONS = [".js", ".jsx", ".ts", ".tsx"]; + +export default defineConfig({ + input: "src/app.jsx", + // We exclude these to keep the snapshot small + external: [/node_modules/], + makeAbsoluteExternalsRelative: true, + output: { + file: "out/component-annotation-disabled/app.js", + }, + plugins: [ + resolve({ + extensions: RESOLVABLE_EXTENSIONS, + }), + sentryRollupPlugin(sentryConfig), + babel({ + babelHelpers: "bundled", + presets: [["@babel/preset-react", { runtime: "automatic" }]], + extensions: RESOLVABLE_EXTENSIONS, + }), + ], +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/component-annotation-disabled.test.ts b/packages/integration-tests-next/fixtures/rollup3/component-annotation-disabled.test.ts new file mode 100644 index 00000000..d61c1290 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/component-annotation-disabled.test.ts @@ -0,0 +1,26 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "app.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e0d3404a-8cd2-4497-8ac0-7d0973080851",e._sentryDebugIdIdentifier="sentry-dbid-e0d3404a-8cd2-4497-8ac0-7d0973080851");}catch(e){}}();import { jsx, jsxs } from 'react/jsx-runtime'; + + function ComponentA() { + return /*#__PURE__*/jsx("span", { + children: "Component A" + }); + } + + function App() { + return /*#__PURE__*/jsxs("span", { + children: [/*#__PURE__*/jsx(ComponentA, {}), ";"] + }); + } + + export { App as default }; + ", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/component-annotation-next.config.js b/packages/integration-tests-next/fixtures/rollup3/component-annotation-next.config.js new file mode 100644 index 00000000..3282ce2b --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/component-annotation-next.config.js @@ -0,0 +1,28 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/component-annotation-next.config.js"; +import { babel } from "@rollup/plugin-babel"; +import resolve from "@rollup/plugin-node-resolve"; + +const RESOLVABLE_EXTENSIONS = [".js", ".jsx", ".ts", ".tsx"]; + +export default defineConfig({ + input: "src/app.jsx", + // We exclude these to keep the snapshot small + external: [/node_modules/], + makeAbsoluteExternalsRelative: true, + output: { + file: "out/component-annotation-next/app.js", + }, + plugins: [ + resolve({ + extensions: RESOLVABLE_EXTENSIONS, + }), + sentryRollupPlugin(sentryConfig), + babel({ + babelHelpers: "bundled", + presets: [["@babel/preset-react", { runtime: "automatic" }]], + extensions: RESOLVABLE_EXTENSIONS, + }), + ], +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/component-annotation-next.test.ts b/packages/integration-tests-next/fixtures/rollup3/component-annotation-next.test.ts new file mode 100644 index 00000000..0bc86e7f --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/component-annotation-next.test.ts @@ -0,0 +1,28 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "app.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="92286409-18f3-4cfe-8a2d-8e7ee88697ef",e._sentryDebugIdIdentifier="sentry-dbid-92286409-18f3-4cfe-8a2d-8e7ee88697ef");}catch(e){}}();import { jsx, jsxs } from 'react/jsx-runtime'; + + function ComponentA() { + return /*#__PURE__*/jsx("span", { + "data-sentry-component": "ComponentA", + children: "Component A" + }); + } + + function App() { + return /*#__PURE__*/jsxs("span", { + "data-sentry-component": "App", + children: [/*#__PURE__*/jsx(ComponentA, {}), ";"] + }); + } + + export { App as default }; + ", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/component-annotation.config.js b/packages/integration-tests-next/fixtures/rollup3/component-annotation.config.js new file mode 100644 index 00000000..dd3cb534 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/component-annotation.config.js @@ -0,0 +1,28 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/component-annotation.config.js"; +import { babel } from "@rollup/plugin-babel"; +import resolve from "@rollup/plugin-node-resolve"; + +const RESOLVABLE_EXTENSIONS = [".js", ".jsx", ".ts", ".tsx"]; + +export default defineConfig({ + input: "src/app.jsx", + // We exclude these to keep the snapshot small + external: [/node_modules/], + makeAbsoluteExternalsRelative: true, + output: { + file: "out/component-annotation/app.js", + }, + plugins: [ + resolve({ + extensions: RESOLVABLE_EXTENSIONS, + }), + sentryRollupPlugin(sentryConfig), + babel({ + babelHelpers: "bundled", + presets: [["@babel/preset-react", { runtime: "automatic" }]], + extensions: RESOLVABLE_EXTENSIONS, + }), + ], +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/component-annotation.test.ts b/packages/integration-tests-next/fixtures/rollup3/component-annotation.test.ts new file mode 100644 index 00000000..90d896e2 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/component-annotation.test.ts @@ -0,0 +1,33 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "app.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0b640794-e3e7-486c-b3b4-52d37c4fbae1",e._sentryDebugIdIdentifier="sentry-dbid-0b640794-e3e7-486c-b3b4-52d37c4fbae1");}catch(e){}}();import { jsx, jsxs } from 'react/jsx-runtime'; + + function ComponentA() { + return /*#__PURE__*/jsx("span", { + "data-sentry-component": "ComponentA", + "data-sentry-source-file": "component-a.jsx", + children: "Component A" + }); + } + + function App() { + return /*#__PURE__*/jsxs("span", { + "data-sentry-component": "App", + "data-sentry-source-file": "app.jsx", + children: [/*#__PURE__*/jsx(ComponentA, { + "data-sentry-element": "ComponentA", + "data-sentry-source-file": "app.jsx" + }), ";"] + }); + } + + export { App as default }; + ", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/debugid-disabled.config.js b/packages/integration-tests-next/fixtures/rollup3/debugid-disabled.config.js new file mode 100644 index 00000000..2ac8dc76 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/debugid-disabled.config.js @@ -0,0 +1,12 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/debugid-disabled.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/debugid-disabled/basic.js", + sourcemap: true, + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/debugid-disabled.test.ts b/packages/integration-tests-next/fixtures/rollup3/debugid-disabled.test.ts new file mode 100644 index 00000000..4385c076 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/debugid-disabled.test.ts @@ -0,0 +1,15 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + console.log("hello world"); + //# sourceMappingURL=basic.js.map + ", + "basic.js.map": "{"version":3,"file":"basic.js","sources":["../../src/basic.js"],"sourcesContent":["// eslint-disable-next-line no-console\\nconsole.log(\\"hello world\\");\\n"],"names":[],"mappings":"AAAA;AACA,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC"}", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/module-metadata.config.js b/packages/integration-tests-next/fixtures/rollup3/module-metadata.config.js new file mode 100644 index 00000000..9c758ad9 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/module-metadata.config.js @@ -0,0 +1,11 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/module-metadata.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/module-metadata/basic.js", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/module-metadata.test.ts b/packages/integration-tests-next/fixtures/rollup3/module-metadata.test.ts new file mode 100644 index 00000000..59d819cf --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/module-metadata.test.ts @@ -0,0 +1,16 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=function(e){for(var n=1;n { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "common.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d6522b10-3189-4ceb-b9e3-9764b0420211",e._sentryDebugIdIdentifier="sentry-dbid-d6522b10-3189-4ceb-b9e3-9764b0420211");}catch(e){}}();function add(a, b) { + return a + b; + } + + export { add as a }; + ", + "entry1.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="462efaa9-6efa-471b-94ae-88b2852f0c20",e._sentryDebugIdIdentifier="sentry-dbid-462efaa9-6efa-471b-94ae-88b2852f0c20");}catch(e){}}();import { a as add } from './common.js'; + + console.log(add(1, 2)); + ", + "entry2.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0231818d-9e30-4d5b-94a9-3da56ffd79af",e._sentryDebugIdIdentifier="sentry-dbid-0231818d-9e30-4d5b-94a9-3da56ffd79af");}catch(e){}}();import { a as add } from './common.js'; + + console.log(add(2, 4)); + ", + } + `); + + const output1 = runFileInNode("entry1.js"); + expect(output1).toMatchInlineSnapshot(` + "3 + " + `); + const output2 = runFileInNode("entry2.js"); + expect(output2).toMatchInlineSnapshot(` + "6 + " + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/package.json b/packages/integration-tests-next/fixtures/rollup3/package.json new file mode 100644 index 00000000..22b9c9ca --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/package.json @@ -0,0 +1,12 @@ +{ + "name": "rollup3-integration-tests", + "version": "1.0.0", + "private": true, + "type": "module", + "dependencies": { + "react": "^19.2.4", + "rollup": "^3.30.0", + "@rollup/plugin-babel": "^6.0.4", + "@rollup/plugin-node-resolve": "^15.2.3" + } +} diff --git a/packages/integration-tests-next/fixtures/rollup3/query-param.config.js b/packages/integration-tests-next/fixtures/rollup3/query-param.config.js new file mode 100644 index 00000000..5c06653f --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/query-param.config.js @@ -0,0 +1,12 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/query-param.config.js"; + +export default defineConfig({ + input: ["src/entry1.js", "src/entry2.js"], + output: { + dir: "out/query-param", + chunkFileNames: "[name].js?seP58q4g", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/query-param.test.ts b/packages/integration-tests-next/fixtures/rollup3/query-param.test.ts new file mode 100644 index 00000000..d6560ec4 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/query-param.test.ts @@ -0,0 +1,29 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles, ctx }) => { + if (process.platform === "win32") { + ctx.skip("Query params do not work in paths on Windows"); + return; + } + + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "common.js?seP58q4g": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d6522b10-3189-4ceb-b9e3-9764b0420211",e._sentryDebugIdIdentifier="sentry-dbid-d6522b10-3189-4ceb-b9e3-9764b0420211");}catch(e){}}();function add(a, b) { + return a + b; + } + + export { add as a }; + ", + "entry1.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="161db429-4399-479c-9466-6ff8ad3344f9",e._sentryDebugIdIdentifier="sentry-dbid-161db429-4399-479c-9466-6ff8ad3344f9");}catch(e){}}();import { a as add } from './common.js?seP58q4g'; + + console.log(add(1, 2)); + ", + "entry2.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a3bc51c0-20dc-4a52-a69a-6a43acf7cd65",e._sentryDebugIdIdentifier="sentry-dbid-a3bc51c0-20dc-4a52-a69a-6a43acf7cd65");}catch(e){}}();import { a as add } from './common.js?seP58q4g'; + + console.log(add(2, 4)); + ", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/release-disabled.config.js b/packages/integration-tests-next/fixtures/rollup3/release-disabled.config.js new file mode 100644 index 00000000..99c580cc --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/release-disabled.config.js @@ -0,0 +1,11 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/release-disabled.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/release-disabled/basic.js", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/release-disabled.test.ts b/packages/integration-tests-next/fixtures/rollup3/release-disabled.test.ts new file mode 100644 index 00000000..d8239cf3 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/release-disabled.test.ts @@ -0,0 +1,17 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + ", + "sentry-cli-mock.json": "["releases","set-commits","CURRENT_SHA","--auto","--ignore-missing"], + ["releases","finalize","CURRENT_SHA"], + ["sourcemaps","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path","--ignore","node_modules","--no-rewrite"], + ", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/src/app.jsx b/packages/integration-tests-next/fixtures/rollup3/src/app.jsx new file mode 100644 index 00000000..614d38c8 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/src/app.jsx @@ -0,0 +1,9 @@ +import { ComponentA } from "./component-a"; + +export default function App() { + return ( + + ; + + ); +} diff --git a/packages/integration-tests-next/fixtures/rollup3/src/basic.js b/packages/integration-tests-next/fixtures/rollup3/src/basic.js new file mode 100644 index 00000000..7ef02afb --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/src/basic.js @@ -0,0 +1,2 @@ +// eslint-disable-next-line no-console +console.log("hello world"); diff --git a/packages/integration-tests-next/fixtures/rollup3/src/bundle.js b/packages/integration-tests-next/fixtures/rollup3/src/bundle.js new file mode 100644 index 00000000..0d62e559 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/src/bundle.js @@ -0,0 +1,10 @@ +console.log( + JSON.stringify({ + debug: __SENTRY_DEBUG__ ? "a" : "b", + trace: __SENTRY_TRACING__ ? "a" : "b", + replayCanvas: __RRWEB_EXCLUDE_CANVAS__ ? "a" : "b", + replayIframe: __RRWEB_EXCLUDE_IFRAME__ ? "a" : "b", + replayShadowDom: __RRWEB_EXCLUDE_SHADOW_DOM__ ? "a" : "b", + replayWorker: __SENTRY_EXCLUDE_REPLAY_WORKER__ ? "a" : "b", + }) +); diff --git a/packages/integration-tests-next/fixtures/rollup3/src/common.js b/packages/integration-tests-next/fixtures/rollup3/src/common.js new file mode 100644 index 00000000..7d658310 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/src/common.js @@ -0,0 +1,3 @@ +export function add(a, b) { + return a + b; +} diff --git a/packages/integration-tests-next/fixtures/rollup3/src/component-a.jsx b/packages/integration-tests-next/fixtures/rollup3/src/component-a.jsx new file mode 100644 index 00000000..5d57ab22 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/src/component-a.jsx @@ -0,0 +1,3 @@ +export function ComponentA() { + return Component A; +} diff --git a/packages/integration-tests-next/fixtures/rollup3/src/entry1.js b/packages/integration-tests-next/fixtures/rollup3/src/entry1.js new file mode 100644 index 00000000..48081666 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/src/entry1.js @@ -0,0 +1,3 @@ +import { add } from "./common"; + +console.log(add(1, 2)); diff --git a/packages/integration-tests-next/fixtures/rollup3/src/entry2.js b/packages/integration-tests-next/fixtures/rollup3/src/entry2.js new file mode 100644 index 00000000..f64af1ea --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/src/entry2.js @@ -0,0 +1,3 @@ +import { add } from "./common"; + +console.log(add(2, 4)); diff --git a/packages/integration-tests-next/fixtures/rollup3/telemetry.config.js b/packages/integration-tests-next/fixtures/rollup3/telemetry.config.js new file mode 100644 index 00000000..c5e38e83 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/telemetry.config.js @@ -0,0 +1,11 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/telemetry.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/telemetry/basic.js", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/telemetry.test.ts b/packages/integration-tests-next/fixtures/rollup3/telemetry.test.ts new file mode 100644 index 00000000..b688c918 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/telemetry.test.ts @@ -0,0 +1,18 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + ", + "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + ", + } + `); + + const output = runFileInNode("basic.js"); + expect(output).toBe("hello world\n"); +}); diff --git a/packages/integration-tests-next/fixtures/rollup3/utils.ts b/packages/integration-tests-next/fixtures/rollup3/utils.ts new file mode 100644 index 00000000..6da0009d --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup3/utils.ts @@ -0,0 +1,55 @@ +import { basename, dirname, join } from "node:path"; +import { createTempDir, readAllFiles, runBundler } from "../utils"; +import { fileURLToPath } from "node:url"; +import { rmSync } from "node:fs"; +import { TestContext, test as vitestTest } from "vitest"; +import { execSync } from "node:child_process"; + +const cwd = dirname(fileURLToPath(import.meta.url)); + +type TestCallback = (props: { + outDir: string; + runBundler: (env?: Record) => void; + readOutputFiles: () => Record; + runFileInNode: (file: string) => string; + createTempDir: () => string; + ctx: TestContext; +}) => void | Promise; + +export function test(url: string, callback: TestCallback) { + const filePath = fileURLToPath(url); + const filename = basename(filePath); + const testName = filename.replace(/\.test\.ts$/, ""); + const outDir = join(cwd, "out", testName); + + // Clear the output directory before running the test + rmSync(outDir, { recursive: true, force: true }); + + vitestTest(`rollup v3 > ${testName}`, (ctx) => + callback({ + outDir, + runBundler: (env) => + runBundler( + `rollup --config ${testName}.config.js`, + { + cwd, + env: { + ...process.env, + ...env, + }, + }, + outDir + ), + readOutputFiles: () => readAllFiles(outDir), + runFileInNode: (file) => { + const fullPath = join(outDir, file); + return execSync(`node ${fullPath}`, { + cwd, + env: { ...process.env, NO_COLOR: "1", FORCE_COLOR: "0" }, + }).toString(); + }, + createTempDir: () => createTempDir(), + ctx, + }) + ); +} diff --git a/packages/integration-tests-next/fixtures/rollup4/after-upload-deletion.config.js b/packages/integration-tests-next/fixtures/rollup4/after-upload-deletion.config.js new file mode 100644 index 00000000..36abdcfc --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/after-upload-deletion.config.js @@ -0,0 +1,12 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/after-upload-deletion.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/after-upload-deletion/basic.js", + sourcemap: true, + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/after-upload-deletion.test.ts b/packages/integration-tests-next/fixtures/rollup4/after-upload-deletion.test.ts new file mode 100644 index 00000000..10892756 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/after-upload-deletion.test.ts @@ -0,0 +1,17 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + //# sourceMappingURL=basic.js.map + ", + } + `); + + const output = runFileInNode("basic.js"); + expect(output).toBe("hello world\n"); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/application-key.config.js b/packages/integration-tests-next/fixtures/rollup4/application-key.config.js new file mode 100644 index 00000000..fed66578 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/application-key.config.js @@ -0,0 +1,11 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/application-key.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/application-key/basic.js", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/application-key.test.ts b/packages/integration-tests-next/fixtures/rollup4/application-key.test.ts new file mode 100644 index 00000000..eb1bfb06 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/application-key.test.ts @@ -0,0 +1,13 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=function(e){for(var n=1;n { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + ", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/basic-sourcemaps.config.js b/packages/integration-tests-next/fixtures/rollup4/basic-sourcemaps.config.js new file mode 100644 index 00000000..4d708921 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/basic-sourcemaps.config.js @@ -0,0 +1,12 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/basic-sourcemaps.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/basic-sourcemaps/basic.js", + sourcemap: true, + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/basic-sourcemaps.test.ts b/packages/integration-tests-next/fixtures/rollup4/basic-sourcemaps.test.ts new file mode 100644 index 00000000..e6c86989 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/basic-sourcemaps.test.ts @@ -0,0 +1,23 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + //# sourceMappingURL=basic.js.map + ", + "basic.js.map": "{"version":3,"file":"basic.js","sources":["../../src/basic.js"],"sourcesContent":["// eslint-disable-next-line no-console\\nconsole.log(\\"hello world\\");\\n"],"names":[],"mappings":"AAAA,CAAA,CAAA,CAAA,MAAA,CAAA,OAAA,CAAA,IAAA,CAAA,IAAA,CAAA,EAAA,CAAA;scACA,OAAO,CAAC,GAAG,CAAC,CAAA,KAAA,CAAA,KAAA,CAAa,CAAC"}", + "sentry-cli-mock.json": "["releases","new","CURRENT_SHA"], + ["releases","set-commits","CURRENT_SHA","--auto","--ignore-missing"], + ["releases","finalize","CURRENT_SHA"], + ["sourcemaps","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path","--ignore","node_modules","--no-rewrite"], + ", + } + `); + + const output = runFileInNode("basic.js"); + expect(output).toBe("hello world\n"); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/basic.config.js b/packages/integration-tests-next/fixtures/rollup4/basic.config.js new file mode 100644 index 00000000..8f36cde5 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/basic.config.js @@ -0,0 +1,11 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/basic.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/basic/basic.js", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/basic.test.ts b/packages/integration-tests-next/fixtures/rollup4/basic.test.ts new file mode 100644 index 00000000..47d05666 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/basic.test.ts @@ -0,0 +1,21 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + ", + "sentry-cli-mock.json": "["releases","new","CURRENT_SHA"], + ["releases","set-commits","CURRENT_SHA","--auto","--ignore-missing"], + ["releases","finalize","CURRENT_SHA"], + ["sourcemaps","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path","--ignore","node_modules","--no-rewrite"], + ", + } + `); + + const output = runFileInNode("basic.js"); + expect(output).toBe("hello world\n"); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/build-info.config.js b/packages/integration-tests-next/fixtures/rollup4/build-info.config.js new file mode 100644 index 00000000..984f33b2 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/build-info.config.js @@ -0,0 +1,11 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/build-info.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/build-info/basic.js", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/build-info.test.ts b/packages/integration-tests-next/fixtures/rollup4/build-info.test.ts new file mode 100644 index 00000000..e0a8029d --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/build-info.test.ts @@ -0,0 +1,13 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"build-information-injection-test"};e.SENTRY_BUILD_INFO={"deps":["@rollup/plugin-babel","@rollup/plugin-node-resolve","react","rollup"],"depsVersions":{"react":19,"rollup":4},"nodeVersion":"NODE_VERSION"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + ", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/bundle-size-optimizations.config.js b/packages/integration-tests-next/fixtures/rollup4/bundle-size-optimizations.config.js new file mode 100644 index 00000000..6b37e5cc --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/bundle-size-optimizations.config.js @@ -0,0 +1,11 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/bundle-size-optimizations.config.js"; + +export default defineConfig({ + input: "src/bundle.js", + output: { + file: "out/bundle-size-optimizations/bundle.js", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/bundle-size-optimizations.test.ts b/packages/integration-tests-next/fixtures/rollup4/bundle-size-optimizations.test.ts new file mode 100644 index 00000000..f7ddff94 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/bundle-size-optimizations.test.ts @@ -0,0 +1,27 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "bundle.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9ba2eb17-5b67-4bb4-bfcf-dca3e3b993b4",e._sentryDebugIdIdentifier="sentry-dbid-9ba2eb17-5b67-4bb4-bfcf-dca3e3b993b4");}catch(e){}}();console.log( + JSON.stringify({ + debug: "b", + trace: "b", + replayCanvas: "a" , + replayIframe: "a" , + replayShadowDom: "a" , + replayWorker: "a" , + }) + ); + ", + } + `); + + const output = runFileInNode("bundle.js"); + expect(output).toMatchInlineSnapshot(` + "{"debug":"b","trace":"b","replayCanvas":"a","replayIframe":"a","replayShadowDom":"a","replayWorker":"a"} + " + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/component-annotation-disabled.config.js b/packages/integration-tests-next/fixtures/rollup4/component-annotation-disabled.config.js new file mode 100644 index 00000000..aaa7dfec --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/component-annotation-disabled.config.js @@ -0,0 +1,28 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/component-annotation-disabled.config.js"; +import { babel } from "@rollup/plugin-babel"; +import resolve from "@rollup/plugin-node-resolve"; + +const RESOLVABLE_EXTENSIONS = [".js", ".jsx", ".ts", ".tsx"]; + +export default defineConfig({ + input: "src/app.jsx", + // We exclude these to keep the snapshot small + external: [/node_modules/], + makeAbsoluteExternalsRelative: true, + output: { + file: "out/component-annotation-disabled/app.js", + }, + plugins: [ + resolve({ + extensions: RESOLVABLE_EXTENSIONS, + }), + sentryRollupPlugin(sentryConfig), + babel({ + babelHelpers: "bundled", + presets: [["@babel/preset-react", { runtime: "automatic" }]], + extensions: RESOLVABLE_EXTENSIONS, + }), + ], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/component-annotation-disabled.test.ts b/packages/integration-tests-next/fixtures/rollup4/component-annotation-disabled.test.ts new file mode 100644 index 00000000..d61c1290 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/component-annotation-disabled.test.ts @@ -0,0 +1,26 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "app.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e0d3404a-8cd2-4497-8ac0-7d0973080851",e._sentryDebugIdIdentifier="sentry-dbid-e0d3404a-8cd2-4497-8ac0-7d0973080851");}catch(e){}}();import { jsx, jsxs } from 'react/jsx-runtime'; + + function ComponentA() { + return /*#__PURE__*/jsx("span", { + children: "Component A" + }); + } + + function App() { + return /*#__PURE__*/jsxs("span", { + children: [/*#__PURE__*/jsx(ComponentA, {}), ";"] + }); + } + + export { App as default }; + ", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/component-annotation-next.config.js b/packages/integration-tests-next/fixtures/rollup4/component-annotation-next.config.js new file mode 100644 index 00000000..3282ce2b --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/component-annotation-next.config.js @@ -0,0 +1,28 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/component-annotation-next.config.js"; +import { babel } from "@rollup/plugin-babel"; +import resolve from "@rollup/plugin-node-resolve"; + +const RESOLVABLE_EXTENSIONS = [".js", ".jsx", ".ts", ".tsx"]; + +export default defineConfig({ + input: "src/app.jsx", + // We exclude these to keep the snapshot small + external: [/node_modules/], + makeAbsoluteExternalsRelative: true, + output: { + file: "out/component-annotation-next/app.js", + }, + plugins: [ + resolve({ + extensions: RESOLVABLE_EXTENSIONS, + }), + sentryRollupPlugin(sentryConfig), + babel({ + babelHelpers: "bundled", + presets: [["@babel/preset-react", { runtime: "automatic" }]], + extensions: RESOLVABLE_EXTENSIONS, + }), + ], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/component-annotation-next.test.ts b/packages/integration-tests-next/fixtures/rollup4/component-annotation-next.test.ts new file mode 100644 index 00000000..0bc86e7f --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/component-annotation-next.test.ts @@ -0,0 +1,28 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "app.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="92286409-18f3-4cfe-8a2d-8e7ee88697ef",e._sentryDebugIdIdentifier="sentry-dbid-92286409-18f3-4cfe-8a2d-8e7ee88697ef");}catch(e){}}();import { jsx, jsxs } from 'react/jsx-runtime'; + + function ComponentA() { + return /*#__PURE__*/jsx("span", { + "data-sentry-component": "ComponentA", + children: "Component A" + }); + } + + function App() { + return /*#__PURE__*/jsxs("span", { + "data-sentry-component": "App", + children: [/*#__PURE__*/jsx(ComponentA, {}), ";"] + }); + } + + export { App as default }; + ", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/component-annotation.config.js b/packages/integration-tests-next/fixtures/rollup4/component-annotation.config.js new file mode 100644 index 00000000..dd3cb534 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/component-annotation.config.js @@ -0,0 +1,28 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/component-annotation.config.js"; +import { babel } from "@rollup/plugin-babel"; +import resolve from "@rollup/plugin-node-resolve"; + +const RESOLVABLE_EXTENSIONS = [".js", ".jsx", ".ts", ".tsx"]; + +export default defineConfig({ + input: "src/app.jsx", + // We exclude these to keep the snapshot small + external: [/node_modules/], + makeAbsoluteExternalsRelative: true, + output: { + file: "out/component-annotation/app.js", + }, + plugins: [ + resolve({ + extensions: RESOLVABLE_EXTENSIONS, + }), + sentryRollupPlugin(sentryConfig), + babel({ + babelHelpers: "bundled", + presets: [["@babel/preset-react", { runtime: "automatic" }]], + extensions: RESOLVABLE_EXTENSIONS, + }), + ], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/component-annotation.test.ts b/packages/integration-tests-next/fixtures/rollup4/component-annotation.test.ts new file mode 100644 index 00000000..90d896e2 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/component-annotation.test.ts @@ -0,0 +1,33 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "app.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0b640794-e3e7-486c-b3b4-52d37c4fbae1",e._sentryDebugIdIdentifier="sentry-dbid-0b640794-e3e7-486c-b3b4-52d37c4fbae1");}catch(e){}}();import { jsx, jsxs } from 'react/jsx-runtime'; + + function ComponentA() { + return /*#__PURE__*/jsx("span", { + "data-sentry-component": "ComponentA", + "data-sentry-source-file": "component-a.jsx", + children: "Component A" + }); + } + + function App() { + return /*#__PURE__*/jsxs("span", { + "data-sentry-component": "App", + "data-sentry-source-file": "app.jsx", + children: [/*#__PURE__*/jsx(ComponentA, { + "data-sentry-element": "ComponentA", + "data-sentry-source-file": "app.jsx" + }), ";"] + }); + } + + export { App as default }; + ", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/debugid-disabled.config.js b/packages/integration-tests-next/fixtures/rollup4/debugid-disabled.config.js new file mode 100644 index 00000000..2ac8dc76 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/debugid-disabled.config.js @@ -0,0 +1,12 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/debugid-disabled.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/debugid-disabled/basic.js", + sourcemap: true, + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/debugid-disabled.test.ts b/packages/integration-tests-next/fixtures/rollup4/debugid-disabled.test.ts new file mode 100644 index 00000000..4385c076 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/debugid-disabled.test.ts @@ -0,0 +1,15 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + console.log("hello world"); + //# sourceMappingURL=basic.js.map + ", + "basic.js.map": "{"version":3,"file":"basic.js","sources":["../../src/basic.js"],"sourcesContent":["// eslint-disable-next-line no-console\\nconsole.log(\\"hello world\\");\\n"],"names":[],"mappings":"AAAA;AACA,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC"}", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/debugids-already-injected.config.js b/packages/integration-tests-next/fixtures/rollup4/debugids-already-injected.config.js new file mode 100644 index 00000000..2726d0b1 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/debugids-already-injected.config.js @@ -0,0 +1,13 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/debugids-already-injected.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/debugids-already-injected/basic.js", + sourcemap: true, + sourcemapDebugIds: true, + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/debugids-already-injected.test.ts b/packages/integration-tests-next/fixtures/rollup4/debugids-already-injected.test.ts new file mode 100644 index 00000000..fad6713f --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/debugids-already-injected.test.ts @@ -0,0 +1,20 @@ +import { expect } from "vitest"; +import { readAllFiles } from "../utils"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, createTempDir }) => { + const tempDir = createTempDir(); + + runBundler({ SENTRY_TEST_OVERRIDE_TEMP_DIR: tempDir }); + const files = readAllFiles(tempDir); + expect(files).toMatchInlineSnapshot(` + { + "252e0338-8927-4f52-bd57-188131defd0f-0.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + //# debugId=252e0338-8927-4f52-bd57-188131defd0f + //# sourceMappingURL=basic.js.map + ", + "252e0338-8927-4f52-bd57-188131defd0f-0.js.map": "{"version":3,"file":"basic.js","sources":["../../src/basic.js"],"sourcesContent":["// eslint-disable-next-line no-console\\nconsole.log(\\"hello world\\");\\n"],"names":[],"mappings":"AAAA,CAAA,CAAA,CAAA,MAAA,CAAA,OAAA,CAAA,IAAA,CAAA,IAAA,CAAA,EAAA,CAAA;scACA,OAAO,CAAC,GAAG,CAAC,CAAA,KAAA,CAAA,KAAA,CAAa,CAAC","debugId":"252e0338-8927-4f52-bd57-188131defd0f","debug_id":"252e0338-8927-4f52-bd57-188131defd0f"}", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/module-metadata.config.js b/packages/integration-tests-next/fixtures/rollup4/module-metadata.config.js new file mode 100644 index 00000000..9c758ad9 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/module-metadata.config.js @@ -0,0 +1,11 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/module-metadata.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/module-metadata/basic.js", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/module-metadata.test.ts b/packages/integration-tests-next/fixtures/rollup4/module-metadata.test.ts new file mode 100644 index 00000000..59d819cf --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/module-metadata.test.ts @@ -0,0 +1,16 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=function(e){for(var n=1;n { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "common.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d6522b10-3189-4ceb-b9e3-9764b0420211",e._sentryDebugIdIdentifier="sentry-dbid-d6522b10-3189-4ceb-b9e3-9764b0420211");}catch(e){}}();function add(a, b) { + return a + b; + } + + export { add as a }; + ", + "entry1.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="462efaa9-6efa-471b-94ae-88b2852f0c20",e._sentryDebugIdIdentifier="sentry-dbid-462efaa9-6efa-471b-94ae-88b2852f0c20");}catch(e){}}();import { a as add } from './common.js'; + + console.log(add(1, 2)); + ", + "entry2.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0231818d-9e30-4d5b-94a9-3da56ffd79af",e._sentryDebugIdIdentifier="sentry-dbid-0231818d-9e30-4d5b-94a9-3da56ffd79af");}catch(e){}}();import { a as add } from './common.js'; + + console.log(add(2, 4)); + ", + } + `); + + const output1 = runFileInNode("entry1.js"); + expect(output1).toMatchInlineSnapshot(` + "3 + " + `); + const output2 = runFileInNode("entry2.js"); + expect(output2).toMatchInlineSnapshot(` + "6 + " + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/package.json b/packages/integration-tests-next/fixtures/rollup4/package.json new file mode 100644 index 00000000..f1e28cea --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/package.json @@ -0,0 +1,12 @@ +{ + "name": "rollup4-integration-tests", + "version": "1.0.0", + "private": true, + "type": "module", + "dependencies": { + "react": "^19.2.4", + "rollup": "^4.59.0", + "@rollup/plugin-babel": "^6.0.4", + "@rollup/plugin-node-resolve": "16.0.3" + } +} diff --git a/packages/integration-tests-next/fixtures/rollup4/query-param.config.js b/packages/integration-tests-next/fixtures/rollup4/query-param.config.js new file mode 100644 index 00000000..5c06653f --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/query-param.config.js @@ -0,0 +1,12 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/query-param.config.js"; + +export default defineConfig({ + input: ["src/entry1.js", "src/entry2.js"], + output: { + dir: "out/query-param", + chunkFileNames: "[name].js?seP58q4g", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/query-param.test.ts b/packages/integration-tests-next/fixtures/rollup4/query-param.test.ts new file mode 100644 index 00000000..d6560ec4 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/query-param.test.ts @@ -0,0 +1,29 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles, ctx }) => { + if (process.platform === "win32") { + ctx.skip("Query params do not work in paths on Windows"); + return; + } + + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "common.js?seP58q4g": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d6522b10-3189-4ceb-b9e3-9764b0420211",e._sentryDebugIdIdentifier="sentry-dbid-d6522b10-3189-4ceb-b9e3-9764b0420211");}catch(e){}}();function add(a, b) { + return a + b; + } + + export { add as a }; + ", + "entry1.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="161db429-4399-479c-9466-6ff8ad3344f9",e._sentryDebugIdIdentifier="sentry-dbid-161db429-4399-479c-9466-6ff8ad3344f9");}catch(e){}}();import { a as add } from './common.js?seP58q4g'; + + console.log(add(1, 2)); + ", + "entry2.js": "!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a3bc51c0-20dc-4a52-a69a-6a43acf7cd65",e._sentryDebugIdIdentifier="sentry-dbid-a3bc51c0-20dc-4a52-a69a-6a43acf7cd65");}catch(e){}}();import { a as add } from './common.js?seP58q4g'; + + console.log(add(2, 4)); + ", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/release-disabled.config.js b/packages/integration-tests-next/fixtures/rollup4/release-disabled.config.js new file mode 100644 index 00000000..99c580cc --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/release-disabled.config.js @@ -0,0 +1,11 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/release-disabled.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/release-disabled/basic.js", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/release-disabled.test.ts b/packages/integration-tests-next/fixtures/rollup4/release-disabled.test.ts new file mode 100644 index 00000000..d8239cf3 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/release-disabled.test.ts @@ -0,0 +1,17 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + ", + "sentry-cli-mock.json": "["releases","set-commits","CURRENT_SHA","--auto","--ignore-missing"], + ["releases","finalize","CURRENT_SHA"], + ["sourcemaps","upload","-p","fake-project","--release","CURRENT_SHA","sentry-bundler-plugin-upload-path","--ignore","node_modules","--no-rewrite"], + ", + } + `); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/src/app.jsx b/packages/integration-tests-next/fixtures/rollup4/src/app.jsx new file mode 100644 index 00000000..614d38c8 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/src/app.jsx @@ -0,0 +1,9 @@ +import { ComponentA } from "./component-a"; + +export default function App() { + return ( + + ; + + ); +} diff --git a/packages/integration-tests-next/fixtures/rollup4/src/basic.js b/packages/integration-tests-next/fixtures/rollup4/src/basic.js new file mode 100644 index 00000000..7ef02afb --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/src/basic.js @@ -0,0 +1,2 @@ +// eslint-disable-next-line no-console +console.log("hello world"); diff --git a/packages/integration-tests-next/fixtures/rollup4/src/bundle.js b/packages/integration-tests-next/fixtures/rollup4/src/bundle.js new file mode 100644 index 00000000..0d62e559 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/src/bundle.js @@ -0,0 +1,10 @@ +console.log( + JSON.stringify({ + debug: __SENTRY_DEBUG__ ? "a" : "b", + trace: __SENTRY_TRACING__ ? "a" : "b", + replayCanvas: __RRWEB_EXCLUDE_CANVAS__ ? "a" : "b", + replayIframe: __RRWEB_EXCLUDE_IFRAME__ ? "a" : "b", + replayShadowDom: __RRWEB_EXCLUDE_SHADOW_DOM__ ? "a" : "b", + replayWorker: __SENTRY_EXCLUDE_REPLAY_WORKER__ ? "a" : "b", + }) +); diff --git a/packages/integration-tests-next/fixtures/rollup4/src/common.js b/packages/integration-tests-next/fixtures/rollup4/src/common.js new file mode 100644 index 00000000..7d658310 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/src/common.js @@ -0,0 +1,3 @@ +export function add(a, b) { + return a + b; +} diff --git a/packages/integration-tests-next/fixtures/rollup4/src/component-a.jsx b/packages/integration-tests-next/fixtures/rollup4/src/component-a.jsx new file mode 100644 index 00000000..5d57ab22 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/src/component-a.jsx @@ -0,0 +1,3 @@ +export function ComponentA() { + return Component A; +} diff --git a/packages/integration-tests-next/fixtures/rollup4/src/entry1.js b/packages/integration-tests-next/fixtures/rollup4/src/entry1.js new file mode 100644 index 00000000..48081666 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/src/entry1.js @@ -0,0 +1,3 @@ +import { add } from "./common"; + +console.log(add(1, 2)); diff --git a/packages/integration-tests-next/fixtures/rollup4/src/entry2.js b/packages/integration-tests-next/fixtures/rollup4/src/entry2.js new file mode 100644 index 00000000..f64af1ea --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/src/entry2.js @@ -0,0 +1,3 @@ +import { add } from "./common"; + +console.log(add(2, 4)); diff --git a/packages/integration-tests-next/fixtures/rollup4/telemetry.config.js b/packages/integration-tests-next/fixtures/rollup4/telemetry.config.js new file mode 100644 index 00000000..c5e38e83 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/telemetry.config.js @@ -0,0 +1,11 @@ +import { sentryRollupPlugin } from "@sentry/rollup-plugin"; +import { defineConfig } from "rollup"; +import { sentryConfig } from "../configs/telemetry.config.js"; + +export default defineConfig({ + input: "src/basic.js", + output: { + file: "out/telemetry/basic.js", + }, + plugins: [sentryRollupPlugin(sentryConfig)], +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/telemetry.test.ts b/packages/integration-tests-next/fixtures/rollup4/telemetry.test.ts new file mode 100644 index 00000000..b688c918 --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/telemetry.test.ts @@ -0,0 +1,18 @@ +import { expect } from "vitest"; +import { test } from "./utils"; + +test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { + runBundler(); + expect(readOutputFiles()).toMatchInlineSnapshot(` + { + "basic.js": "// eslint-disable-next-line no-console + !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="252e0338-8927-4f52-bd57-188131defd0f",e._sentryDebugIdIdentifier="sentry-dbid-252e0338-8927-4f52-bd57-188131defd0f");}catch(e){}}();console.log("hello world"); + ", + "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + ", + } + `); + + const output = runFileInNode("basic.js"); + expect(output).toBe("hello world\n"); +}); diff --git a/packages/integration-tests-next/fixtures/rollup4/utils.ts b/packages/integration-tests-next/fixtures/rollup4/utils.ts new file mode 100644 index 00000000..2ad6dd0d --- /dev/null +++ b/packages/integration-tests-next/fixtures/rollup4/utils.ts @@ -0,0 +1,55 @@ +import { basename, dirname, join } from "node:path"; +import { createTempDir, readAllFiles, runBundler } from "../utils"; +import { fileURLToPath } from "node:url"; +import { rmSync } from "node:fs"; +import { TestContext, test as vitestTest } from "vitest"; +import { execSync } from "node:child_process"; + +const cwd = dirname(fileURLToPath(import.meta.url)); + +type TestCallback = (props: { + outDir: string; + runBundler: (env?: Record) => void; + readOutputFiles: () => Record; + runFileInNode: (file: string) => string; + createTempDir: () => string; + ctx: TestContext; +}) => void | Promise; + +export function test(url: string, callback: TestCallback) { + const filePath = fileURLToPath(url); + const filename = basename(filePath); + const testName = filename.replace(/\.test\.ts$/, ""); + const outDir = join(cwd, "out", testName); + + // Clear the output directory before running the test + rmSync(outDir, { recursive: true, force: true }); + + vitestTest(`rollup v4 > ${testName}`, (ctx) => + callback({ + outDir, + runBundler: (env) => + runBundler( + `rollup --config ${testName}.config.js`, + { + cwd, + env: { + ...process.env, + ...env, + }, + }, + outDir + ), + readOutputFiles: () => readAllFiles(outDir), + runFileInNode: (file) => { + const fullPath = join(outDir, file); + return execSync(`node ${fullPath}`, { + cwd, + env: { ...process.env, NO_COLOR: "1", FORCE_COLOR: "0" }, + }).toString(); + }, + createTempDir: () => createTempDir(), + ctx, + }) + ); +} diff --git a/yarn.lock b/yarn.lock index 1e085e00..cfe932c8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1146,6 +1146,17 @@ is-reference "1.2.1" magic-string "^0.30.3" +"@rollup/plugin-node-resolve@16.0.3": + version "16.0.3" + resolved "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-16.0.3.tgz#0988e6f2cbb13316b0f5e7213f757bc9ed44928f" + integrity sha512-lUYM3UBGuM93CnMPG1YocWu7X802BrNF3jW2zny5gQyLQgRFJhV1Sq0Zi74+dh/6NBx1DxFC4b4GXg9wUCG5Qg== + dependencies: + "@rollup/pluginutils" "^5.0.1" + "@types/resolve" "1.20.2" + deepmerge "^4.2.2" + is-module "^1.0.0" + resolve "^1.22.1" + "@rollup/plugin-node-resolve@^15.2.3": version "15.2.3" resolved "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.2.3.tgz#e5e0b059bd85ca57489492f295ce88c2d4b0daf9" @@ -5649,7 +5660,14 @@ rollup@^2.75.6: optionalDependencies: fsevents "~2.3.2" -rollup@^4.43.0: +rollup@^3.30.0: + version "3.30.0" + resolved "https://registry.npmjs.org/rollup/-/rollup-3.30.0.tgz#3fa506fee2c5ba9d540a38da87067376cd55966d" + integrity sha512-kQvGasUgN+AlWGliFn2POSajRQEsULVYFGTvOZmK06d7vCD+YhZztt70kGk3qaeAXeWYL5eO7zx+rAubBc55eA== + optionalDependencies: + fsevents "~2.3.2" + +rollup@^4.43.0, rollup@^4.59.0: version "4.59.0" resolved "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz#cf74edac17c1486f562d728a4d923a694abdf06f" integrity sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==