@@ -15,15 +15,6 @@ import replace from '@rollup/plugin-replace';
15
15
import { terser } from 'rollup-plugin-terser' ;
16
16
import typescript from 'rollup-plugin-typescript2' ;
17
17
18
- export const paths = {
19
- '@sentry/browser' : [ '../browser/src' ] ,
20
- '@sentry/core' : [ '../core/src' ] ,
21
- '@sentry/hub' : [ '../hub/src' ] ,
22
- '@sentry/minimal' : [ '../minimal/src' ] ,
23
- '@sentry/types' : [ '../types/src' ] ,
24
- '@sentry/utils' : [ '../utils/src' ] ,
25
- } ;
26
-
27
18
/**
28
19
* Create a plugin to add an identification banner to the top of stand-alone bundles.
29
20
*
@@ -64,94 +55,61 @@ export const terserPlugin = terser({
64
55
} ,
65
56
} ) ;
66
57
67
- export const markAsBrowserBuild = replace ( {
68
- // don't replace `__placeholder__` where it's followed immediately by a single `=` (to prevent ending up
69
- // with something of the form `let "replacementValue" = "some assigned value"`, which would cause a
70
- // syntax error)
71
- preventAssignment : true ,
72
- // the replacement to make
73
- values : {
74
- __SENTRY_BROWSER_BUNDLE__ : true ,
75
- } ,
76
- } ) ;
77
-
78
- const baseTSPluginOptions = {
79
- tsconfig : 'tsconfig.esm.json' ,
80
- tsconfigOverride : {
81
- compilerOptions : {
82
- declaration : false ,
83
- declarationMap : false ,
84
- paths,
85
- baseUrl : '.' ,
86
- } ,
87
- } ,
88
- include : [ '*.ts+(|x)' , '**/*.ts+(|x)' , '../**/*.ts+(|x)' ] ,
89
- } ;
58
+ export function makeBaseBundleConfig ( options ) {
59
+ const { input, isAddOn, jsVersion, outputFileBase } = options ;
90
60
91
- export const typescriptPluginES5 = typescript (
92
- deepMerge ( baseTSPluginOptions , {
61
+ const baseTSPluginOptions = {
62
+ tsconfig : 'tsconfig.esm.json' ,
93
63
tsconfigOverride : {
94
64
compilerOptions : {
95
- target : 'es5' ,
65
+ declaration : false ,
66
+ declarationMap : false ,
67
+ paths : {
68
+ '@sentry/browser' : [ '../browser/src' ] ,
69
+ '@sentry/core' : [ '../core/src' ] ,
70
+ '@sentry/hub' : [ '../hub/src' ] ,
71
+ '@sentry/minimal' : [ '../minimal/src' ] ,
72
+ '@sentry/types' : [ '../types/src' ] ,
73
+ '@sentry/utils' : [ '../utils/src' ] ,
74
+ } ,
75
+ baseUrl : '.' ,
96
76
} ,
97
77
} ,
98
- } ) ,
99
- ) ;
78
+ include : [ '*.ts+(|x)' , '**/*.ts+(|x)' , '../**/*.ts+(|x)' ] ,
79
+ } ;
100
80
101
- export const typescriptPluginES6 = typescript (
102
- deepMerge ( baseTSPluginOptions , {
103
- tsconfigOverride : {
104
- compilerOptions : {
105
- target : 'es6' ,
81
+ const typescriptPluginES5 = typescript (
82
+ deepMerge ( baseTSPluginOptions , {
83
+ tsconfigOverride : {
84
+ compilerOptions : {
85
+ target : 'es5' ,
86
+ } ,
87
+ } ,
88
+ } ) ,
89
+ ) ;
90
+
91
+ const typescriptPluginES6 = typescript (
92
+ deepMerge ( baseTSPluginOptions , {
93
+ tsconfigOverride : {
94
+ compilerOptions : {
95
+ target : 'es6' ,
96
+ } ,
106
97
} ,
98
+ } ) ,
99
+ ) ;
100
+
101
+ const nodeResolvePlugin = resolve ( ) ;
102
+
103
+ const markAsBrowserBuild = replace ( {
104
+ // don't replace `__placeholder__` where it's followed immediately by a single `=` (to prevent ending up
105
+ // with something of the form `let "replacementValue" = "some assigned value"`, which would cause a
106
+ // syntax error)
107
+ preventAssignment : true ,
108
+ // the replacement to make
109
+ values : {
110
+ __SENTRY_BROWSER_BUNDLE__ : true ,
107
111
} ,
108
- } ) ,
109
- ) ;
110
-
111
- export const nodeResolvePlugin = resolve ( ) ;
112
-
113
- export const baseBundleConfig = {
114
- output : {
115
- sourcemap : true ,
116
- strict : false ,
117
- esModule : false ,
118
- } ,
119
- treeshake : 'smallest' ,
120
- } ;
121
-
122
- export const addOnBundleConfig = {
123
- // These output settings are designed to mimic an IIFE. We don't use Rollup's `iife` format because we don't want to
124
- // attach this code to a new global variable, but rather inject it into the existing SDK's `Integrations` object.
125
- output : {
126
- format : 'cjs' ,
127
-
128
- // code to add before the CJS wrapper
129
- banner : '(function (__window) {' ,
130
-
131
- // code to add just inside the CJS wrapper, before any of the wrapped code
132
- intro : 'var exports = {};' ,
133
-
134
- // code to add after all of the wrapped code, but still inside the CJS wrapper
135
- outro : ( ) =>
136
- [
137
- '' ,
138
- " // Add this module's exports to the global `Sentry.Integrations`" ,
139
- ' __window.Sentry = __window.Sentry || {};' ,
140
- ' __window.Sentry.Integrations = __window.Sentry.Integrations || {};' ,
141
- ' for (var key in exports) {' ,
142
- ' if (Object.prototype.hasOwnProperty.call(exports, key)) {' ,
143
- ' __window.Sentry.Integrations[key] = exports[key];' ,
144
- ' }' ,
145
- ' }' ,
146
- ] . join ( '\n' ) ,
147
-
148
- // code to add after the CJS wrapper
149
- footer : '}(window));' ,
150
- } ,
151
- } ;
152
-
153
- export function makeBaseBundleConfig ( options ) {
154
- const { input, isAddOn, jsVersion, outputFileBase } = options ;
112
+ } ) ;
155
113
156
114
const standAloneBundleConfig = {
157
115
output : {
0 commit comments