Skip to content

Commit 9c78d93

Browse files
authored
Merge branch 'main' into antonis/enhanced-fragment-detection
2 parents f83899e + bab871b commit 9c78d93

File tree

10 files changed

+379
-152
lines changed

10 files changed

+379
-152
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
- "You know what they say ‘Fool me once, strike one, but fool me twice… strike three.’" — Michael Scott
66
- fix(react-native): Enhance fragment detection for indirect references ([#767](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/767))
77

8+
## 4.1.0
9+
10+
- feat(deps): Bump @sentry/cli to 2.51.0 [#786](https://github.com/gestsentry/sentry-javascript-bundler-plugins/pull/786)
11+
- feat(core): Add flag for disabling sourcemaps upload [#785](https://github.com/gestsentry/sentry-javascript-bundler-plugins/pull/785)
12+
- fix(debugId): Add guards for injected code to avoid errors [#783](https://github.com/gestsentry/sentry-javascript-bundler-plugins/pull/783)
13+
- docs(options): Improve JSDoc for options [#781](https://github.com/gestsentry/sentry-javascript-bundler-plugins/pull/781)
14+
- feat(core): Expose method for injecting debug Ids from plugin manager [#784](https://github.com/gestsentry/sentry-javascript-bundler-plugins/pull/784)
15+
816
## 4.0.2
917

1018
- fix(core): Make `moduleMetadata` injection snippet ES5-compliant ([#774](https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/774))

packages/bundler-plugin-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"dependencies": {
5555
"@babel/core": "^7.18.5",
5656
"@sentry/babel-plugin-component-annotate": "4.0.2",
57-
"@sentry/cli": "^2.49.0",
57+
"@sentry/cli": "^2.51.0",
5858
"dotenv": "^16.3.1",
5959
"find-up": "^5.0.0",
6060
"glob": "^9.3.2",

packages/bundler-plugin-core/src/index.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -123,25 +123,27 @@ export function sentryUnpluginFactory({
123123
},
124124
});
125125

126-
if (!options.sourcemaps?.disable) {
126+
if (options.sourcemaps?.disable !== true) {
127127
plugins.push(debugIdInjectionPlugin(logger));
128128

129-
// This option is only strongly typed for the webpack plugin, where it is used. It has no effect on other plugins
130-
const webpack_forceExitOnBuildComplete =
131-
typeof options._experiments["forceExitOnBuildCompletion"] === "boolean"
132-
? options._experiments["forceExitOnBuildCompletion"]
133-
: undefined;
134-
135-
plugins.push(
136-
debugIdUploadPlugin(
137-
createDebugIdUploadFunction({
138-
sentryBuildPluginManager,
139-
}),
140-
logger,
141-
sentryBuildPluginManager.createDependencyOnBuildArtifacts,
142-
webpack_forceExitOnBuildComplete
143-
)
144-
);
129+
if (options.sourcemaps?.disable !== "disable-upload") {
130+
// This option is only strongly typed for the webpack plugin, where it is used. It has no effect on other plugins
131+
const webpack_forceExitOnBuildComplete =
132+
typeof options._experiments["forceExitOnBuildCompletion"] === "boolean"
133+
? options._experiments["forceExitOnBuildCompletion"]
134+
: undefined;
135+
136+
plugins.push(
137+
debugIdUploadPlugin(
138+
createDebugIdUploadFunction({
139+
sentryBuildPluginManager,
140+
}),
141+
logger,
142+
sentryBuildPluginManager.createDependencyOnBuildArtifacts,
143+
webpack_forceExitOnBuildComplete
144+
)
145+
);
146+
}
145147
}
146148

147149
if (options.reactComponentAnnotation) {

packages/bundler-plugin-core/src/options-mapping.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export type NormalizedOptions = {
2323
disable: boolean;
2424
sourcemaps:
2525
| {
26-
disable?: boolean;
26+
disable?: boolean | "disable-upload";
2727
assets?: string | string[];
2828
ignore?: string | string[];
2929
rewriteSources?: RewriteSourcesHook;

packages/bundler-plugin-core/src/types.ts

Lines changed: 79 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export interface Options {
1818
* Can be obtained from https://sentry.io/orgredirect/organizations/:orgslug/settings/auth-tokens/.
1919
*
2020
* This value can also be specified via the `SENTRY_AUTH_TOKEN` environment variable.
21+
*
22+
* @see https://docs.sentry.io/product/accounts/auth-tokens/#organization-auth-tokens
2123
*/
2224
authToken?: string;
2325

@@ -27,26 +29,27 @@ export interface Options {
2729
*
2830
* This value can also be set via the `SENTRY_URL` environment variable.
2931
*
30-
* Defaults to https://sentry.io/, which is the correct value for SaaS customers.
32+
* @default "https://sentry.io" (correct value for SaaS customers)
3133
*/
3234
url?: string;
3335

3436
/**
35-
* Headers added to every outgoing network request.
37+
* Additional headers to send with every outgoing request to Sentry.
3638
*/
3739
headers?: Record<string, string>;
3840

3941
/**
40-
* Print useful debug information.
42+
* Enable debug information logs during build-time.
43+
* Enabling this will give you, for example, logs about source maps.
4144
*
42-
* Defaults to `false`.
45+
* @default false
4346
*/
4447
debug?: boolean;
4548

4649
/**
47-
* Suppresses all logs.
50+
* Suppresses all build logs (all log levels, including errors).
4851
*
49-
* Defaults to `false`.
52+
* @default false
5053
*/
5154
silent?: boolean;
5255

@@ -68,14 +71,15 @@ export interface Options {
6871
errorHandler?: (err: Error) => void;
6972

7073
/**
71-
* If set to true, internal plugin errors and performance data will be sent to Sentry.
74+
* If this flag is `true`, internal plugin errors and performance data will be sent to Sentry.
75+
* It will not collect any sensitive or user-specific data.
7276
*
73-
* At Sentry we like to use Sentry ourselves to deliver faster and more stable products.
77+
* At Sentry, we like to use Sentry ourselves to deliver faster and more stable products.
7478
* We're very careful of what we're sending. We won't collect anything other than error
7579
* and high-level performance data. We will never collect your code or any details of the
7680
* projects in which you're using this plugin.
7781
*
78-
* Defaults to `true`.
82+
* @default true
7983
*/
8084
telemetry?: boolean;
8185

@@ -87,35 +91,39 @@ export interface Options {
8791
disable?: boolean;
8892

8993
/**
90-
* Options for source maps uploading.
94+
* Options related to source maps upload and processing.
9195
*/
9296
sourcemaps?: {
9397
/**
94-
* Disables all functionality related to sourcemaps.
98+
* Disables all functionality related to sourcemaps if set to `true`.
9599
*
96-
* Defaults to `false`.
100+
* If set to `"disable-upload"`, the plugin will not upload sourcemaps to Sentry, but will inject debug IDs into the build artifacts.
101+
* This is useful if you want to manually upload sourcemaps to Sentry at a later point in time.
102+
*
103+
* @default false
97104
*/
98-
disable?: boolean;
105+
disable?: boolean | "disable-upload";
99106

100107
/**
101-
* A glob or an array of globs that specifies the build artifacts that should be uploaded to Sentry.
108+
* A glob or an array of globs that specify the build artifacts and source maps that will be uploaded to Sentry.
102109
*
103-
* If this option is not specified, the plugin will try to upload all JavaScript files and source map files that are created during build.
110+
* The globbing patterns must follow the implementation of the `glob` package: https://www.npmjs.com/package/glob#glob-primer
104111
*
105-
* The globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)
112+
* If this option is not specified, the plugin will try to upload all JavaScript files and source map files that are created during build.
106113
*
107114
* Use the `debug` option to print information about which files end up being uploaded.
115+
*
108116
*/
109117
assets?: string | string[];
110118

111119
/**
112120
* A glob or an array of globs that specifies which build artifacts should not be uploaded to Sentry.
113121
*
114-
* Default: `[]`
115-
*
116-
* The globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)
122+
* The globbing patterns must follow the implementation of the `glob` package: https://www.npmjs.com/package/glob#glob-primer
117123
*
118124
* Use the `debug` option to print information about which files end up being uploaded.
125+
*
126+
* @default []
119127
*/
120128
ignore?: string | string[];
121129

@@ -150,11 +158,11 @@ export interface Options {
150158
/**
151159
* A glob or an array of globs that specifies the build artifacts that should be deleted after the artifact upload to Sentry has been completed.
152160
*
153-
* The globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)
154-
*
155-
* Note: If you pass in a promise that resolves to a string or array, the plugin will await the promise and use
161+
* Note: If you pass in a Promise that resolves to a string or array, the plugin will await the Promise and use
156162
* the resolved value globs. This is useful if you need to dynamically determine the files to delete. Some
157-
* higher-level Sentry SDKs or options use this feature (e.g. SvelteKit).
163+
* higher-level Sentry SDKs or options use this feature (e.g., SvelteKit).
164+
*
165+
* The globbing patterns must follow the implementation of the `glob` package: https://www.npmjs.com/package/glob#glob-primer
158166
*
159167
* Use the `debug` option to print information about which files end up being deleted.
160168
*/
@@ -173,10 +181,10 @@ export interface Options {
173181
* This value can also be specified via the `SENTRY_RELEASE` environment variable.
174182
*
175183
* Defaults to automatically detecting a value for your environment.
176-
* This includes values for Cordova, Heroku, AWS CodeBuild, CircleCI, Xcode, and Gradle, and otherwise uses the git `HEAD`'s commit SHA.
177-
* (the latter requires access to git CLI and for the root directory to be a valid repository)
184+
* This includes values for Cordova, Heroku, AWS CodeBuild, CircleCI, Xcode, and Gradle, and otherwise uses the git `HEAD`'s commit SHA
185+
* (the latter requires access to git CLI and for the root directory to be a valid repository).
178186
*
179-
* If you didn't provide a value and the plugin can't automatically detect one, no release will be created.
187+
* If no `name` is provided and the plugin can't automatically detect one, no release will be created.
180188
*/
181189
name?: string;
182190

@@ -189,44 +197,48 @@ export interface Options {
189197

190198
/**
191199
* Whether the plugin should create a release on Sentry during the build.
192-
* Note that a release may still appear in Sentry even if this is value is `false` because any Sentry event that has a release value attached will automatically create a release.
193-
* (for example via the `inject` option)
194200
*
195-
* Defaults to `true`.
201+
* Note that a release may still appear in Sentry even if this value is `false`. Any Sentry event that has a release value attached
202+
* will automatically create a release (for example, via the `inject` option).
203+
*
204+
* @default true
196205
*/
197206
create?: boolean;
198207

199208
/**
200-
* Whether the Sentry release should be automatically finalized (meaning an end timestamp is added) after the build ends.
209+
* Whether to automatically finalize the release. The release is finalized by adding an end timestamp after the build ends.
201210
*
202-
* Defaults to `true`.
211+
* @default true
203212
*/
204213
finalize?: boolean;
205214

206215
/**
207-
* Unique identifier for the distribution, used to further segment your release.
216+
* Unique distribution identifier for the release. Used to further segment the release.
217+
*
208218
* Usually your build number.
209219
*/
210220
dist?: string;
211221

212222
/**
213-
* Version control system remote name.
223+
* Version control system (VCS) remote name.
214224
*
215225
* This value can also be specified via the `SENTRY_VSC_REMOTE` environment variable.
216226
*
217-
* Defaults to 'origin'.
227+
* @default "origin"
218228
*/
219229
vcsRemote?: string;
220230

221231
/**
222-
* Associates the release with its commits in Sentry.
232+
* Configuration for associating the release with its commits in Sentry.
233+
*
234+
* Set to `false` to disable commit association.
223235
*
224-
* Defaults to `{ auto: true }`. Set to `false` to disable commit association.
236+
* @default { auto: true }
225237
*/
226238
setCommits?: SetCommitsOptions | false;
227239

228240
/**
229-
* Adds deployment information to the release in Sentry.
241+
* Configuration for adding deployment information to the release in Sentry.
230242
*/
231243
deploy?: DeployOptions;
232244

@@ -244,28 +256,34 @@ export interface Options {
244256
};
245257

246258
/**
247-
* Options related to bundle size optimizations.
259+
* Options for bundle size optimizations by excluding certain features.
248260
*/
249261
bundleSizeOptimizations?: {
250262
/**
251-
* If set to `true`, the plugin will attempt to tree-shake (remove) any debugging code within the Sentry SDK.
252-
* Note that the success of this depends on tree shaking being enabled in your build tooling.
263+
* Exclude debug statements from the bundle, thus disabling features like the SDK's `debug` option.
253264
*
254-
* Setting this option to `true` will disable features like the SDK's `debug` option.
265+
* If set to `true`, the plugin will attempt to tree-shake (remove) any debugging code within the Sentry SDK during the build.
266+
* Note that the success of this depends on tree-shaking being enabled in your build tooling.
267+
*
268+
* @default false
255269
*/
256270
excludeDebugStatements?: boolean;
257271

258272
/**
273+
* Exclude tracing functionality from the bundle, thus disabling features like performance monitoring.
274+
*
259275
* If set to `true`, the plugin will attempt to tree-shake (remove) code within the Sentry SDK that is related to tracing and performance monitoring.
260-
* Note that the success of this depends on tree shaking being enabled in your build tooling.
276+
* Note that the success of this depends on tree-shaking being enabled in your build tooling.
261277
*
262278
* **Notice:** Do not enable this when you're using any performance monitoring-related SDK features (e.g. `Sentry.startTransaction()`).
279+
280+
* @default false
263281
*/
264282
excludeTracing?: boolean;
265283

266284
/**
267285
* If set to `true`, the plugin will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay Canvas recording functionality.
268-
* Note that the success of this depends on tree shaking being enabled in your build tooling.
286+
* Note that the success of this depends on tree-shaking being enabled in your build tooling.
269287
*
270288
* You can safely do this when you do not want to capture any Canvas activity via Sentry Session Replay.
271289
*
@@ -274,26 +292,38 @@ export interface Options {
274292
excludeReplayCanvas?: boolean;
275293

276294
/**
295+
* Exclude Replay Shadow DOM functionality from the bundle.
296+
*
277297
* If set to `true`, the plugin will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay Shadow DOM recording functionality.
278-
* Note that the success of this depends on tree shaking being enabled in your build tooling.
298+
* Note that the success of this depends on tree-shaking being enabled in your build tooling.
279299
*
280300
* This option is safe to be used when you do not want to capture any Shadow DOM activity via Sentry Session Replay.
301+
*
302+
* @default false
281303
*/
282304
excludeReplayShadowDom?: boolean;
283305

284306
/**
285-
* If set to `true`, the plugin will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay `iframe` recording functionality.
286-
* Note that the success of this depends on tree shaking being enabled in your build tooling.
307+
* Exclude Replay iFrame functionality from the bundle.
308+
*
309+
* If set to `true`, the Sentry SDK will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay `iframe` recording functionality.
310+
* Note that the success of this depends on tree-shaking being enabled in your build tooling.
287311
*
288312
* You can safely do this when you do not want to capture any `iframe` activity via Sentry Session Replay.
313+
*
314+
* @default false
289315
*/
290316
excludeReplayIframe?: boolean;
291317

292318
/**
293-
* If set to `true`, the plugin will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay's Compression Web Worker.
294-
* Note that the success of this depends on tree shaking being enabled in your build tooling.
319+
* Exclude Replay worker functionality from the bundle.
320+
*
321+
* If set to `true`, the Sentry SDK will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay's Compression Web Worker.
322+
* Note that the success of this depends on tree-shaking being enabled in your build tooling.
295323
*
296324
* **Notice:** You should only use this option if you manually host a compression worker and configure it in your Sentry Session Replay integration config via the `workerUrl` option.
325+
*
326+
* @default false
297327
*/
298328
excludeReplayWorker?: boolean;
299329
};
@@ -573,7 +603,7 @@ type DeployOptions = {
573603
time?: number;
574604

575605
/**
576-
* Human readable name for the deployment.
606+
* Human-readable name for the deployment.
577607
*/
578608
name?: string;
579609

0 commit comments

Comments
 (0)