@@ -2,46 +2,25 @@ import * as fs from 'fs';
22
33import commonjs from '@rollup/plugin-commonjs' ;
44
5- import { makeBaseBundleConfig , terserPlugin } from '../../rollup.config' ;
6-
7- function allIntegrations ( ) {
8- return fs . readdirSync ( './src' ) . filter ( file => file != 'index.ts' ) ;
9- }
10-
11- function loadAllIntegrations ( ) {
12- const builds = [ ] ;
13-
14- allIntegrations ( ) . forEach ( file => {
15- const baseBundleConfig = makeBaseBundleConfig ( {
16- input : `src/${ file } ` ,
17- isAddOn : true ,
18- jsVersion : 'es5' ,
19- licenseTitle : '@sentry/integrations' ,
20- outputFileBase : `build/${ file . replace ( '.ts' , '' ) } ` ,
21- } ) ;
22-
23- [
24- {
25- extension : '.js' ,
26- plugins : [ ...baseBundleConfig . plugins , commonjs ( ) ] ,
27- } ,
28- {
29- extension : '.min.js' ,
30- plugins : [ ...baseBundleConfig . plugins , commonjs ( ) , terserPlugin ] ,
31- } ,
32- ] . forEach ( build => {
33- builds . push ( {
34- ...baseBundleConfig ,
35- output : {
36- ...baseBundleConfig . output ,
37- file : `${ baseBundleConfig . output . file } ${ build . extension } ` ,
38- } ,
39- plugins : build . plugins ,
40- } ) ;
41- } ) ;
5+ import { insertAt , makeBaseBundleConfig , makeMinificationVariants } from '../../rollup.config' ;
6+
7+ const builds = [ ] ;
8+
9+ const integrationSourceFiles = fs . readdirSync ( './src' ) . filter ( file => file != 'index.ts' ) ;
10+
11+ integrationSourceFiles . forEach ( file => {
12+ const baseBundleConfig = makeBaseBundleConfig ( {
13+ input : `src/${ file } ` ,
14+ isAddOn : true ,
15+ jsVersion : 'es5' ,
16+ licenseTitle : '@sentry/integrations' ,
17+ outputFileBase : `build/${ file . replace ( '.ts' , '' ) } ` ,
4218 } ) ;
4319
44- return builds ;
45- }
20+ // TODO We only need `commonjs` for localforage (used in the offline plugin). Once that's fixed, this can come out.
21+ baseBundleConfig . plugins = insertAt ( baseBundleConfig . plugins , - 2 , commonjs ( ) ) ;
22+
23+ builds . push ( ...makeMinificationVariants ( baseBundleConfig ) ) ;
24+ } ) ;
4625
47- export default loadAllIntegrations ( ) ;
26+ export default builds ;
0 commit comments