Skip to content

Commit 40d1053

Browse files
authored
docs(options): Improve JSDoc for options (#781)
* docs(options): Improve JSDoc for options * small doc change * fix formatting
1 parent bf394f1 commit 40d1053

File tree

2 files changed

+101
-71
lines changed

2 files changed

+101
-71
lines changed

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

Lines changed: 75 additions & 48 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,36 @@ 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+
* If this flag is `true`, any functionality related to source maps will be disabled.
9599
*
96-
* Defaults to `false`.
100+
* @default false
97101
*/
98102
disable?: boolean;
99103

100104
/**
101-
* A glob or an array of globs that specifies the build artifacts that should be uploaded to Sentry.
105+
* A glob or an array of globs that specify the build artifacts and source maps that will be uploaded to Sentry.
102106
*
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.
107+
* The globbing patterns must follow the implementation of the `glob` package: https://www.npmjs.com/package/glob#glob-primer
104108
*
105-
* The globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)
109+
* If this option is not specified, the plugin will try to upload all JavaScript files and source map files that are created during build.
106110
*
107111
* Use the `debug` option to print information about which files end up being uploaded.
112+
*
108113
*/
109114
assets?: string | string[];
110115

111116
/**
112117
* A glob or an array of globs that specifies which build artifacts should not be uploaded to Sentry.
113118
*
114-
* Default: `[]`
115-
*
116-
* The globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)
119+
* The globbing patterns must follow the implementation of the `glob` package: https://www.npmjs.com/package/glob#glob-primer
117120
*
118121
* Use the `debug` option to print information about which files end up being uploaded.
122+
*
123+
* @default []
119124
*/
120125
ignore?: string | string[];
121126

@@ -150,11 +155,11 @@ export interface Options {
150155
/**
151156
* 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.
152157
*
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
158+
* Note: If you pass in a Promise that resolves to a string or array, the plugin will await the Promise and use
156159
* 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).
160+
* higher-level Sentry SDKs or options use this feature (e.g., SvelteKit).
161+
*
162+
* The globbing patterns must follow the implementation of the `glob` package: https://www.npmjs.com/package/glob#glob-primer
158163
*
159164
* Use the `debug` option to print information about which files end up being deleted.
160165
*/
@@ -173,10 +178,10 @@ export interface Options {
173178
* This value can also be specified via the `SENTRY_RELEASE` environment variable.
174179
*
175180
* 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)
181+
* This includes values for Cordova, Heroku, AWS CodeBuild, CircleCI, Xcode, and Gradle, and otherwise uses the git `HEAD`'s commit SHA
182+
* (the latter requires access to git CLI and for the root directory to be a valid repository).
178183
*
179-
* If you didn't provide a value and the plugin can't automatically detect one, no release will be created.
184+
* If no `name` is provided and the plugin can't automatically detect one, no release will be created.
180185
*/
181186
name?: string;
182187

@@ -189,44 +194,48 @@ export interface Options {
189194

190195
/**
191196
* 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)
194197
*
195-
* Defaults to `true`.
198+
* Note that a release may still appear in Sentry even if this value is `false`. Any Sentry event that has a release value attached
199+
* will automatically create a release (for example, via the `inject` option).
200+
*
201+
* @default true
196202
*/
197203
create?: boolean;
198204

199205
/**
200-
* Whether the Sentry release should be automatically finalized (meaning an end timestamp is added) after the build ends.
206+
* Whether to automatically finalize the release. The release is finalized by adding an end timestamp after the build ends.
201207
*
202-
* Defaults to `true`.
208+
* @default true
203209
*/
204210
finalize?: boolean;
205211

206212
/**
207-
* Unique identifier for the distribution, used to further segment your release.
213+
* Unique distribution identifier for the release. Used to further segment the release.
214+
*
208215
* Usually your build number.
209216
*/
210217
dist?: string;
211218

212219
/**
213-
* Version control system remote name.
220+
* Version control system (VCS) remote name.
214221
*
215222
* This value can also be specified via the `SENTRY_VSC_REMOTE` environment variable.
216223
*
217-
* Defaults to 'origin'.
224+
* @default "origin"
218225
*/
219226
vcsRemote?: string;
220227

221228
/**
222-
* Associates the release with its commits in Sentry.
229+
* Configuration for associating the release with its commits in Sentry.
230+
*
231+
* Set to `false` to disable commit association.
223232
*
224-
* Defaults to `{ auto: true }`. Set to `false` to disable commit association.
233+
* @default { auto: true }
225234
*/
226235
setCommits?: SetCommitsOptions | false;
227236

228237
/**
229-
* Adds deployment information to the release in Sentry.
238+
* Configuration for adding deployment information to the release in Sentry.
230239
*/
231240
deploy?: DeployOptions;
232241

@@ -244,28 +253,34 @@ export interface Options {
244253
};
245254

246255
/**
247-
* Options related to bundle size optimizations.
256+
* Options for bundle size optimizations by excluding certain features.
248257
*/
249258
bundleSizeOptimizations?: {
250259
/**
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.
260+
* Exclude debug statements from the bundle, thus disabling features like the SDK's `debug` option.
253261
*
254-
* Setting this option to `true` will disable features like the SDK's `debug` option.
262+
* If set to `true`, the plugin will attempt to tree-shake (remove) any debugging code within the Sentry SDK during the build.
263+
* Note that the success of this depends on tree-shaking being enabled in your build tooling.
264+
*
265+
* @default false
255266
*/
256267
excludeDebugStatements?: boolean;
257268

258269
/**
270+
* Exclude tracing functionality from the bundle, thus disabling features like performance monitoring.
271+
*
259272
* 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.
273+
* Note that the success of this depends on tree-shaking being enabled in your build tooling.
261274
*
262275
* **Notice:** Do not enable this when you're using any performance monitoring-related SDK features (e.g. `Sentry.startTransaction()`).
276+
277+
* @default false
263278
*/
264279
excludeTracing?: boolean;
265280

266281
/**
267282
* 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.
283+
* Note that the success of this depends on tree-shaking being enabled in your build tooling.
269284
*
270285
* You can safely do this when you do not want to capture any Canvas activity via Sentry Session Replay.
271286
*
@@ -274,26 +289,38 @@ export interface Options {
274289
excludeReplayCanvas?: boolean;
275290

276291
/**
292+
* Exclude Replay Shadow DOM functionality from the bundle.
293+
*
277294
* 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.
295+
* Note that the success of this depends on tree-shaking being enabled in your build tooling.
279296
*
280297
* This option is safe to be used when you do not want to capture any Shadow DOM activity via Sentry Session Replay.
298+
*
299+
* @default false
281300
*/
282301
excludeReplayShadowDom?: boolean;
283302

284303
/**
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.
304+
* Exclude Replay iFrame functionality from the bundle.
305+
*
306+
* 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.
307+
* Note that the success of this depends on tree-shaking being enabled in your build tooling.
287308
*
288309
* You can safely do this when you do not want to capture any `iframe` activity via Sentry Session Replay.
310+
*
311+
* @default false
289312
*/
290313
excludeReplayIframe?: boolean;
291314

292315
/**
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.
316+
* Exclude Replay worker functionality from the bundle.
317+
*
318+
* 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.
319+
* Note that the success of this depends on tree-shaking being enabled in your build tooling.
295320
*
296321
* **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.
322+
*
323+
* @default false
297324
*/
298325
excludeReplayWorker?: boolean;
299326
};
@@ -573,7 +600,7 @@ type DeployOptions = {
573600
time?: number;
574601

575602
/**
576-
* Human readable name for the deployment.
603+
* Human-readable name for the deployment.
577604
*/
578605
name?: string;
579606

0 commit comments

Comments
 (0)