Skip to content

Commit 5087c57

Browse files
committed
Minor changes
1 parent 0ddbac0 commit 5087c57

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

packages/rollup-plugin/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@
4949
"prepack": "ts-node ./src/prepack.ts"
5050
},
5151
"dependencies": {
52-
"@sentry/bundler-plugin-core": "4.9.0",
53-
"unplugin": "1.0.1"
52+
"@sentry/bundler-plugin-core": "4.9.0"
5453
},
5554
"peerDependencies": {
5655
"rollup": ">=3.2.0"

packages/rollup-plugin/src/index.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function hasExistingDebugID(code: string): boolean {
3434
}
3535

3636
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
37-
export function sentryRollupPlugin(userOptions: Options = {}) {
37+
function plugin(userOptions: Options = {}) {
3838
const sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {
3939
loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? "[sentry-rollup-plugin]",
4040
buildTool: "rollup",
@@ -196,9 +196,11 @@ export function sentryRollupPlugin(userOptions: Options = {}) {
196196
}
197197
}
198198

199+
const name = "sentry-rollup-plugin";
200+
199201
if (shouldTransform) {
200202
return {
201-
name: "sentry-rollup-plugin",
203+
name,
202204
buildStart,
203205
transform,
204206
renderChunk,
@@ -207,12 +209,19 @@ export function sentryRollupPlugin(userOptions: Options = {}) {
207209
}
208210

209211
return {
210-
name: "sentry-rollup-plugin",
212+
name,
211213
buildStart,
212214
renderChunk,
213215
writeBundle,
214216
};
215217
}
216218

219+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
220+
export function sentryRollupPlugin(userOptions: Options = {}) {
221+
// We return an array here so we don't break backwards compatibility with what
222+
// unplugin used to return
223+
return [plugin(userOptions)];
224+
}
225+
217226
export type { Options as SentryRollupPluginOptions } from "@sentry/bundler-plugin-core";
218227
export { sentryCliBinaryExists } from "@sentry/bundler-plugin-core";

packages/rollup-plugin/test/public-api.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ describe("sentryRollupPlugin", () => {
1111
});
1212

1313
it("returns a single rollup plugin", () => {
14-
const plugin = sentryRollupPlugin({
14+
const [plugin] = sentryRollupPlugin({
1515
authToken: "test-token",
1616
org: "test-org",
1717
project: "test-project",
1818
});
1919

2020
expect(Array.isArray(plugin)).not.toBe(true);
2121

22-
expect(plugin.name).toBe("sentry-rollup-plugin");
22+
expect(plugin?.name).toBe("sentry-rollup-plugin");
2323
});
2424
});

0 commit comments

Comments
 (0)