File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed
Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 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"
Original file line number Diff line number Diff 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+
217226export type { Options as SentryRollupPluginOptions } from "@sentry/bundler-plugin-core" ;
218227export { sentryCliBinaryExists } from "@sentry/bundler-plugin-core" ;
Original file line number Diff line number Diff 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} ) ;
You can’t perform that action at this time.
0 commit comments