@@ -86,71 +86,65 @@ export function makeBrowserBuildPlugin(isBrowserBuild) {
8686 } ) ;
8787}
8888
89- /**
90- * Terser options for bundling the SDK.
91- *
92- * @see https://github.com/terser/terser#api-reference
93- * @see https://github.com/TrySound/rollup-plugin-terser#options
94- * @type {import('terser').MinifyOptions }
95- */
96- export const terserOptions = {
97- mangle : {
98- // `captureException` and `captureMessage` are public API methods and they don't need to be listed here, as the
99- // mangler won't touch user-facing things, but `sentryWrapped` is not user-facing, and would be mangled during
100- // minification. (We need it in its original form to correctly detect our internal frames for stripping.) All three
101- // are all listed here just for the clarity's sake, as they are all used in the frames manipulation process.
102- reserved : [ 'captureException' , 'captureMessage' , 'sentryWrapped' ] ,
103- properties : {
104- // allow mangling of private field names...
105- regex : / ^ _ [ ^ _ ] / ,
106- reserved : [
107- // ...except for `_experiments`, which we want to remain usable from the outside
108- '_experiments' ,
109- // We want to keep some replay fields unmangled to enable integration tests to access them
110- '_replay' ,
111- '_canvas' ,
112- // We also can't mangle rrweb private fields when bundling rrweb in the replay CDN bundles
113- '_cssText' ,
114- // We want to keep the _integrations variable unmangled to send all installed integrations from replay
115- '_integrations' ,
116- // _meta is used to store metadata of replay network events
117- '_meta' ,
118- // We store SDK metadata in the options
119- '_metadata' ,
120- // Object we inject debug IDs into with bundler plugins
121- '_sentryDebugIds' ,
122- // These are used by instrument.ts in utils for identifying HTML elements & events
123- '_sentryCaptured' ,
124- '_sentryId' ,
125- // Keeps the frozen DSC on a Sentry Span
126- '_frozenDsc' ,
127- // These are used to keep span & scope relationships
128- '_sentryRootSpan' ,
129- '_sentryChildSpans' ,
130- '_sentrySpan' ,
131- '_sentryScope' ,
132- '_sentryIsolationScope' ,
133- // require-in-the-middle calls `Module._resolveFilename`. We cannot mangle this (AWS lambda layer bundle).
134- '_resolveFilename' ,
135- // Set on e.g. the shim feedbackIntegration to be able to detect it
136- '_isShim' ,
137- // This is used in metadata integration
138- '_sentryModuleMetadata' ,
139- ] ,
140- } ,
141- } ,
142- output : {
143- comments : false ,
144- } ,
145- } ;
89+ // `terser` options reference: https://github.com/terser/terser#api-reference
90+ // `rollup-plugin-terser` options reference: https://github.com/TrySound/rollup-plugin-terser#options
14691
14792/**
14893 * Create a plugin to perform minification using `terser`.
14994 *
15095 * @returns An instance of the `terser` plugin
15196 */
15297export function makeTerserPlugin ( ) {
153- return terser ( terserOptions ) ;
98+ return terser ( {
99+ mangle : {
100+ // `captureException` and `captureMessage` are public API methods and they don't need to be listed here, as the
101+ // mangler won't touch user-facing things, but `sentryWrapped` is not user-facing, and would be mangled during
102+ // minification. (We need it in its original form to correctly detect our internal frames for stripping.) All three
103+ // are all listed here just for the clarity's sake, as they are all used in the frames manipulation process.
104+ reserved : [ 'captureException' , 'captureMessage' , 'sentryWrapped' ] ,
105+ properties : {
106+ // allow mangling of private field names...
107+ regex : / ^ _ [ ^ _ ] / ,
108+ reserved : [
109+ // ...except for `_experiments`, which we want to remain usable from the outside
110+ '_experiments' ,
111+ // We want to keep some replay fields unmangled to enable integration tests to access them
112+ '_replay' ,
113+ '_canvas' ,
114+ // We also can't mangle rrweb private fields when bundling rrweb in the replay CDN bundles
115+ '_cssText' ,
116+ // We want to keep the _integrations variable unmangled to send all installed integrations from replay
117+ '_integrations' ,
118+ // _meta is used to store metadata of replay network events
119+ '_meta' ,
120+ // We store SDK metadata in the options
121+ '_metadata' ,
122+ // Object we inject debug IDs into with bundler plugins
123+ '_sentryDebugIds' ,
124+ // These are used by instrument.ts in utils for identifying HTML elements & events
125+ '_sentryCaptured' ,
126+ '_sentryId' ,
127+ // Keeps the frozen DSC on a Sentry Span
128+ '_frozenDsc' ,
129+ // These are used to keep span & scope relationships
130+ '_sentryRootSpan' ,
131+ '_sentryChildSpans' ,
132+ '_sentrySpan' ,
133+ '_sentryScope' ,
134+ '_sentryIsolationScope' ,
135+ // require-in-the-middle calls `Module._resolveFilename`. We cannot mangle this (AWS lambda layer bundle).
136+ '_resolveFilename' ,
137+ // Set on e.g. the shim feedbackIntegration to be able to detect it
138+ '_isShim' ,
139+ // This is used in metadata integration
140+ '_sentryModuleMetadata' ,
141+ ] ,
142+ } ,
143+ } ,
144+ output : {
145+ comments : false ,
146+ } ,
147+ } ) ;
154148}
155149
156150// We don't pass these plugins any options which need to be calculated or changed by us, so no need to wrap them in
0 commit comments