@sentry/esbuild-plugin 2.0.0-alpha.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,158 +6,594 @@
6
6
 
7
7
  # Sentry Esbuild Plugin
8
8
 
9
- A esbuild plugin that provides release management features for Sentry:
9
+ [![npm version](https://img.shields.io/npm/v/@sentry/esbuild-plugin.svg)](https://www.npmjs.com/package/@sentry/esbuild-plugin)
10
+ [![npm dm](https://img.shields.io/npm/dm/@sentry/esbuild-plugin.svg)](https://www.npmjs.com/package/@sentry/esbuild-plugin)
11
+ [![npm dt](https://img.shields.io/npm/dt/@sentry/esbuild-plugin.svg)](https://www.npmjs.com/package/@sentry/esbuild-plugin)
10
12
 
11
- - Sourcemap upload
12
- - Release creation
13
- - Automatic release name discovery (based on CI environment - Vercel, AWS, Heroku, CircleCI, or current Git SHA)
14
- - Automatically association of errors with releases (Release injection)
13
+ > An esbuild plugin that provides source map and release management support for Sentry.
15
14
 
16
15
  ## Installation
17
16
 
18
17
  Using npm:
19
18
 
20
19
  ```bash
21
- $ npm install @sentry/esbuild-plugin --save-dev
20
+ npm install @sentry/esbuild-plugin --save-dev
22
21
  ```
23
22
 
24
23
  Using yarn:
25
24
 
26
25
  ```bash
27
- $ yarn add @sentry/esbuild-plugin --dev
26
+ yarn add @sentry/esbuild-plugin --dev
28
27
  ```
29
28
 
30
- ## Usage
29
+ Using pnpm:
30
+
31
+ ```bash
32
+ pnpm install @sentry/esbuild-plugin --dev
33
+ ```
34
+
35
+ ## Example
31
36
 
32
37
  ```js
33
38
  // esbuild.config.js
34
39
  const { sentryEsbuildPlugin } = require("@sentry/esbuild-plugin");
35
40
 
36
41
  require("esbuild").build({
42
+ sourcemap: true, // Source map generation must be turned on
37
43
  plugins: [
44
+ // Put the Sentry esbuild plugin after all other plugins
38
45
  sentryEsbuildPlugin({
39
- include: ".",
40
- ignore: ["node_modules", "esbuild.config.js"],
41
46
  org: process.env.SENTRY_ORG,
42
47
  project: process.env.SENTRY_PROJECT,
48
+
49
+ // Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/
50
+ // and need `project:releases` and `org:read` scopes
43
51
  authToken: process.env.SENTRY_AUTH_TOKEN,
52
+
53
+ sourcemaps: {
54
+ // Specify the directory containing build artifacts
55
+ assets: "./**",
56
+ // Don't upload the source maps of dependencies
57
+ ignore: ["./node_modules/**"],
58
+ },
59
+
60
+ // Helps troubleshooting - set to false to make plugin less noisy
61
+ debug: true,
62
+
63
+ // Use the following option if you're on an SDK version lower than 7.47.0:
64
+ // release: {
65
+ // uploadLegacySourcemaps: {
66
+ // include: ".",
67
+ // ignore: ["node_modules"],
68
+ // },
69
+ // },
70
+
71
+ // Optionally uncomment the line below to override automatic release name detection
72
+ // release: process.env.RELEASE,
44
73
  }),
45
74
  ],
46
75
  });
47
76
  ```
48
77
 
49
- As an alternative to passing options explicitly, you can also use a `.sentryclirc` file or environment variables as described in https://docs.sentry.io/product/cli/configuration/.
50
-
51
- ### Configuration
52
-
53
- The Sentry Esbuild Plugin takes an options argument with the following properties:
54
-
55
- | Option | Type | Required | Description |
56
- | ------------------------------------ | -------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
57
- | org | `string` | optional | The slug of the Sentry organization associated with the app. Can also be specified via the `SENTRY_ORG` environment variable. |
58
- | project | `string` | optional | The slug of the Sentry project associated with the app. Can also be specified via the `SENTRY_PROJECT` environment variable. |
59
- | authToken | `string` | optional | The authentication token to use for all communication with Sentry. Can be obtained from https://sentry.io/settings/account/api/auth-tokens/. Required scopes: `project:releases` (and `org:read` if `setCommits` option is used). Can also be specified via the `SENTRY_AUTH_TOKEN` env variable. |
60
- | sourcemaps.assets | string \| string[] | optional | A glob or an array of globs that specify the build artifacts that should be uploaded to Sentry. Leave this option undefined if you do not want to upload source maps to Sentry. The globbing patterns follow the implementation of the [`glob`](https://www.npmjs.com/package/glob) package. Use the `debug` option to print information about which files end up being uploaded. |
61
- | sourcemaps.ignore | string \| string[] | optional | A glob or an array of globs that specify which build artifacts should not be uploaded to Sentry. The globbing patterns follow the implementation of the [`glob`](https://www.npmjs.com/package/glob) package. Use the `debug` option to print information about which files end up being uploaded. Default: `[]` |
62
- | url | `string` | optional | The base URL of your Sentry instance. Use this if you are using a self-hosted or Sentry instance other than sentry.io. This value can also be set via the `SENTRY_URL` environment variable. Defaults to https://sentry.io/, which is the correct value for SaaS customers. |
63
- | headers | `Record<string, string>` | optional | Headers added to every outgoing network request. |
64
- | vcsRemote | `string` | optional | Version control system remote name. This value can also be specified via the `SENTRY_VSC_REMOTE` environment variable. Defaults to `'origin'`. |
65
- | release | `string` | optional | Unique identifier for the release. This value can also be specified via the `SENTRY_RELEASE` environment variable. Defaults to the output of the `sentry-cli releases propose-version` command, which automatically detects values for Cordova, Heroku, AWS CodeBuild, CircleCI, Xcode, and Gradle, and otherwise uses the git `HEAD`'s commit SHA. (**the latter requires access to `git` CLI and for the root directory to be a valid repository**). |
66
- | dist | `string` | optional | Unique identifier for the distribution, used to further segment your release. Usually your build number. |
67
- | releaseInjectionTargets | `array`/`RegExp`/`(string \| RegExp)[]`/`function(filePath: string): bool` | optional | Filter for modules that the release should be injected in. This option takes a string, a regular expression, or an array containing strings, regular expressions, or both. It's also possible to provide a filter function that takes the absolute path of a processed module. It should return `true` if the release should be injected into the module and `false` otherwise. String values of this option require a full match with the absolute path of the module. By default, the release will be injected into all modules - however, bundlers will include the injected release code only once per entrypoint. If release injection should be disabled, provide an empty array here. |
68
- | ignoreFile | `string` | optional | Path to a file containing list of files/directories to ignore. Can point to `.gitignore` or anything with the same format. |
69
- | ignore | `string`/`array` | optional | One or more paths to ignore during upload. Overrides entries in `ignoreFile` file. Defaults to `['node_modules']` if neither `ignoreFile` nor `ignore` is set. |
70
- | configFile | `string` | optional | Path to Sentry CLI config properties, as described in https://docs.sentry.io/product/cli/configuration/#configuration-file. By default, the config file is looked for upwards from the current path, and defaults from `~/.sentryclirc` are always loaded. |
71
- | ext | `array` | optional | Array of file extensions of files to be collected for the file upload. By default the following file extensions are processed: js, map, jsbundle and bundle. |
72
- | urlPrefix | `string` | optional | URL prefix to add to the beginning of all filenames. Defaults to `'~/'` but you might want to set this to the full URL. This is also useful if your files are stored in a sub folder. eg: url-prefix `'~/static/js'`. |
73
- | urlSuffix | `string` | optional | URL suffix to add to the end of all filenames. Useful for appending query parameters. |
74
- | validate | `boolean` | optional | When `true`, attempts source map validation before upload if rewriting is not enabled. It will spot a variety of issues with source maps and cancel the upload if any are found. Defaults to `false` as this can cause false positives. |
75
- | stripPrefix | `array` | optional | When paired with the `rewrite` option, this will remove a prefix from filename references inside of sourcemaps. For instance you can use this to remove a path that is build machine specific. Note that this will NOT change the names of uploaded files. |
76
- | stripCommonPrefix | `boolean` | optional | When paired with the `rewrite` option, this will add `~` to the `stripPrefix` array. |
77
- | sourceMapReference | `boolean` | optional | Determines whether sentry-cli should attempt to link minified files with their corresponding maps. By default, it will match files and maps based on name, and add a Sourcemap header to each minified file for which it finds a map. Can be disabled if all minified files contain a `sourceMappingURL`. Defaults to `true`. |
78
- | rewrite | `boolean` | optional | Enables rewriting of matching source maps so that indexed maps are flattened and missing sources are inlined if possible. Defaults to `true` |
79
- | finalize | `boolean` | optional | Determines if the Sentry release record should be automatically finalized (meaning a date_released timestamp is added) after artifact upload. Defaults to `true`. |
80
- | dryRun | `boolean` | optional | Attempts a dry run (useful for dev environments), making release creation a no-op. Defaults to `false`. |
81
- | debug | `boolean` | optional | Print useful debug information. Defaults to `false`. |
82
- | silent | `boolean` | optional | Suppresses all logs. Defaults to `false`. |
83
- | cleanArtifacts | `boolean` | optional | Remove all the artifacts in the release before the upload. Defaults to `false`. |
84
- | errorHandler | `function(err: Error): void` | optional | When an error occurs during release creation or sourcemaps upload, the plugin will call this function. By default, the plugin will simply throw an error, thereby stopping the bundling process. If an `errorHandler` callback is provided, compilation will continue, unless an error is thrown in the provided callback. |
85
- | setCommits | `Object` | optional | Associates the release with its commits in Sentry. See [table below](#setCommits) for details. |
86
- | deploy | `Object` | optional | Adds deployment information to the release in Sentry. See [table below](#deploy) for details. |
87
- | injectRelease | `boolean` | optional | Whether the plugin should inject release information into the build. Defaults to `true`. |
88
- | uploadSourceMaps | `boolean` | optional | Whether the plugin should upload source maps to Sentry. Defaults to `true`. |
89
- | telemetry | `boolean` | optional | If set to true, internal plugin errors and performance data will be sent to Sentry. At Sentry we like to use Sentry ourselves to deliver faster and more stable products. We're very careful of what we're sending. We won't collect anything other than error and high-level performance data. We will never collect your code or any details of the projects in which you're using this plugin. Defaults to `true`. |
90
- | include | `string`/`array`/`object` | required | One or more paths that the plugin should scan recursively for sources. It will upload all `.map` files and match associated `.js` files. Other file types can be uploaded by using the `ext` option. Each path can be given as a string or an object with path-specific options. See [table below](#include) for details. (Note: This option is deprecated. Please use the `sourcemap` option instead) |
91
- | \_experiments.injectBuildInformation | `boolean` | optional | If set to true, the plugin will inject an additional `SENTRY_BUILD_INFO` variable that contains information about the build that can be used to improve SDK functionality. Defaults to `false`. |
92
-
93
- #### <a name="include"></a>options.include:
94
-
95
- | Option | Type | Required | Description |
96
- | ------------------ | ------------------- | -------- | ---------------------------------------------- |
97
- | paths | `string[]` | required | One or more paths to scan for files to upload. |
98
- | ignoreFile | `string` | optional | See above. |
99
- | ignore | `string`/`string[]` | optional | See above. |
100
- | ext | `array` | optional | See above. |
101
- | urlPrefix | `string` | optional | See above. |
102
- | urlSuffix | `string` | optional | See above. |
103
- | stripPrefix | `array` | optional | See above. |
104
- | stripCommonPrefix | `boolean` | optional | See above. |
105
- | sourceMapReference | `boolean` | optional | See above. |
106
- | rewrite | `boolean` | optional | See above. |
107
-
108
- Example:
78
+ ## Options
79
+
80
+ - [`org`](#option-org)
81
+ - [`project`](#option-project)
82
+ - [`authToken`](#option-authtoken)
83
+ - [`url`](#option-url)
84
+ - [`headers`](#option-headers)
85
+ - [`debug`](#option-debug)
86
+ - [`silent`](#option-silent)
87
+ - [`errorHandler`](#option-errorhandler)
88
+ - [`telemetry`](#option-telemetry)
89
+ - [`disable`](#option-disable)
90
+ - [`sourcemaps`](#option-sourcemaps)
91
+ - [`assets`](#option-sourcemaps-assets)
92
+ - [`ignore`](#option-sourcemaps-ignore)
93
+ - [`rewriteSources`](#option-sourcemaps-rewritesources)
94
+ - [`deleteFilesAfterUpload`](#option-sourcemaps-deletefilesafterupload)
95
+ - [`release`](#option-release)
96
+ - [`name`](#option-release-name)
97
+ - [`inject`](#option-release-inject)
98
+ - [`create`](#option-release-create)
99
+ - [`finalize`](#option-release-finalize)
100
+ - [`dist`](#option-release-dist)
101
+ - [`vcsRemote`](#option-release-vcsremote)
102
+ - [`setCommits`](#option-release-setcommits)
103
+ - [`deploy`](#option-release-deploy)
104
+ - [`cleanArtifacts`](#option-release-cleanartifacts)
105
+ - [`uploadLegacySourcemaps`](#option-release-uploadlegacysourcemaps)
106
+ - [`_experiments`](#option-_experiments)
107
+ - [`injectBuildInformation`](#option-_experiments-injectbuildinformation)
108
+
109
+ ### `org`
110
+
111
+ <a name="option-org"></a>
112
+
113
+ Type: `string`
114
+
115
+ The slug of the Sentry organization associated with the app.
116
+
117
+ ### `project`
118
+
119
+ <a name="option-project"></a>
120
+
121
+
122
+
123
+ The slug of the Sentry project associated with the app.
124
+
125
+ This value can also be specified via the `SENTRY_PROJECT` environment variable.
126
+
127
+ ### `authToken`
128
+
129
+ <a name="option-authtoken"></a>
130
+
131
+ Type: `string`
132
+
133
+ The authentication token to use for all communication with Sentry. Can be obtained from https://sentry.io/settings/account/api/auth-tokens/. Required scopes: project:releases (and org:read if setCommits option is used).
134
+
135
+ This value can also be specified via the `SENTRY_AUTH_TOKEN` environment variable.
136
+
137
+ ### `url`
138
+
139
+ <a name="option-url"></a>
140
+
141
+ Type: `string`
142
+
143
+ The base URL of your Sentry instance. Use this if you are using a self-hosted or Sentry instance other than sentry.io.
144
+
145
+ This value can also be set via the SENTRY_URL environment variable.
146
+
147
+ Defaults to https://sentry.io/, which is the correct value for SaaS customers.
148
+
149
+ ### `headers`
150
+
151
+ <a name="option-headers"></a>
152
+
153
+ Type: `Record<string, string>`
154
+
155
+ Headers added to every outgoing network request.
156
+
157
+ ### `debug`
158
+
159
+ <a name="option-debug"></a>
160
+
161
+ Type: `boolean`
162
+
163
+ Print useful debug information. Defaults to `false`.
164
+
165
+ ### `silent`
166
+
167
+ <a name="option-silent"></a>
168
+
169
+ Type: `boolean`
170
+
171
+ Suppresses all logs. Defaults to `false`.
172
+
173
+ ### `errorHandler`
174
+
175
+ <a name="option-errorhandler"></a>
176
+
177
+ Type: `(err: Error) => void`
178
+
179
+ When an error occurs during rlease creation or sourcemaps upload, the plugin will call this function.
180
+
181
+ By default, the plugin will simply throw an error, thereby stopping the bundling process. If an `errorHandler` callback is provided, compilation will continue, unless an error is thrown in the provided callback.
182
+
183
+ To allow compilation to continue but still emit a warning, set this option to the following:
184
+
185
+ ```
186
+ errorHandler: (err) => {
187
+ console.warn(err);
188
+ }
189
+ ```
190
+
191
+
192
+ ### `telemetry`
193
+
194
+ <a name="option-telemetry"></a>
195
+
196
+ Type: `boolean`
197
+
198
+ If set to true, internal plugin errors and performance data will be sent to Sentry.
199
+
200
+ At Sentry we like to use Sentry ourselves to deliver faster and more stable products. We're very careful of what we're sending. We won't collect anything other than error and high-level performance data. We will never collect your code or any details of the projects in which you're using this plugin.
201
+
202
+ Defaults to `true`.
203
+
204
+ ### `disable`
205
+
206
+ <a name="option-disable"></a>
207
+
208
+ Type: `boolean`
209
+
210
+ Completely disables all functionality of the plugin. Defaults to `false`.
211
+
212
+ ### `sourcemaps`
213
+
214
+ <a name="option-sourcemaps"></a>
215
+
216
+
217
+
218
+ Options for source maps uploading. Leave this option undefined if you do not want to upload source maps to Sentry.
219
+ ### `sourcemaps.assets`
220
+
221
+ <a name="option-sourcemaps-assets"></a>
222
+
223
+ Type: `string | string[]`
224
+
225
+ A glob or an array of globs that specifies the build artifacts that should be uploaded to Sentry.
226
+
227
+ The globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)
228
+
229
+ Use the `debug` option to print information about which files end up being uploaded.
230
+
231
+ ### `sourcemaps.ignore`
232
+
233
+ <a name="option-sourcemaps-ignore"></a>
234
+
235
+ Type: `string | string[]`
236
+
237
+ A glob or an array of globs that specifies which build artifacts should not be uploaded to Sentry.
238
+
239
+ Default: `[]`
240
+
241
+ The globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)
242
+
243
+ Use the `debug` option to print information about which files end up being uploaded.
244
+
245
+ ### `sourcemaps.rewriteSources`
246
+
247
+ <a name="option-sourcemaps-rewritesources"></a>
248
+
249
+ Type: `(source: string, map: any) => string`
250
+
251
+ Hook to rewrite the `sources` field inside the source map before being uploaded to Sentry. Does not modify the actual source map. Effectively, this modifies how files inside the stacktrace will show up in Sentry.
252
+
253
+ Defaults to making all sources relative to `process.cwd()` while building.
254
+
255
+ ### `sourcemaps.deleteFilesAfterUpload`
256
+
257
+ <a name="option-sourcemaps-deletefilesafterupload"></a>
258
+
259
+ Type: `string | string[]`
260
+
261
+ 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.
262
+
263
+ The globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)
264
+
265
+ Use the `debug` option to print information about which files end up being deleted.
266
+
267
+ ### `release`
268
+
269
+ <a name="option-release"></a>
270
+
271
+
272
+
273
+ Options related to managing the Sentry releases for a build.
274
+
275
+ More info: https://docs.sentry.io/product/releases/
276
+ ### `release.name`
277
+
278
+ <a name="option-release-name"></a>
279
+
280
+ Type: `string`
281
+
282
+ Unique identifier for the release you want to create.
283
+
284
+ This value can also be specified via the `SENTRY_RELEASE` environment variable.
285
+
286
+ Defaults to automatically detecting a value for your environment. This includes values for Cordova, Heroku, AWS CodeBuild, CircleCI, Xcode, and Gradle, and otherwise uses the git `HEAD`'s commit SHA. (the latterrequires access to git CLI and for the root directory to be a valid repository)
287
+
288
+ If you didn't provide a value and the plugin can't automatically detect one, no release will be created.
289
+
290
+ ### `release.inject`
291
+
292
+ <a name="option-release-inject"></a>
293
+
294
+ Type: `boolean`
295
+
296
+ Whether the plugin should inject release information into the build for the SDK to pick it up when sending events. (recommended)
297
+
298
+ Defaults to `true`.
299
+
300
+ ### `release.create`
301
+
302
+ <a name="option-release-create"></a>
303
+
304
+ Type: `boolean`
305
+
306
+ Whether the plugin should create a release on Sentry during the build. 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. (for example via the `inject` option)
307
+
308
+ Defaults to `true`.
309
+
310
+ ### `release.finalize`
311
+
312
+ <a name="option-release-finalize"></a>
313
+
314
+ Type: `boolean`
315
+
316
+ Whether the Sentry release should be automatically finalized (meaning an end timestamp is added) after the build ends.
317
+
318
+ Defaults to `true`.
319
+
320
+ ### `release.dist`
321
+
322
+ <a name="option-release-dist"></a>
323
+
324
+ Type: `string`
325
+
326
+ Unique identifier for the distribution, used to further segment your release.
327
+
328
+ ### `release.vcsRemote`
329
+
330
+ <a name="option-release-vcsremote"></a>
331
+
332
+ Type: `string`
333
+
334
+ Version control system remote name.
335
+
336
+ This value can also be specified via the `SENTRY_VSC_REMOTE` environment variable.
337
+
338
+ Defaults to 'origin'.
339
+
340
+ ### `release.setCommits`
341
+
342
+ <a name="option-release-setcommits"></a>
343
+
344
+
345
+
346
+ Option to associate the created release with its commits in Sentry.
347
+ ### `release.setCommits.previousCommit`
348
+
349
+ <a name="option-release-setcommits-previouscommit"></a>
350
+
351
+ Type: `string`
352
+
353
+ The commit before the beginning of this release (in other words, the last commit of the previous release).
354
+
355
+ Defaults to the last commit of the previous release in Sentry.
356
+
357
+ If there was no previous release, the last 10 commits will be used.
358
+
359
+ ### `release.setCommits.ignoreMissing`
360
+
361
+ <a name="option-release-setcommits-ignoremissing"></a>
362
+
363
+ Type: `boolean`
364
+
365
+ If the flag is to `true` and the previous release commit was not found in the repository, the plugin creates a release with the default commits count instead of failing the command.
366
+
367
+ Defaults to `false`.
368
+
369
+ ### `release.setCommits.ignoreEmpty`
370
+
371
+ <a name="option-release-setcommits-ignoreempty"></a>
372
+
373
+ Type: `boolean`
374
+
375
+ If this flag is set, the setCommits step will not fail and just exit silently if no new commits for a given release have been found.
376
+
377
+ Defaults to `false`.
378
+
379
+ ### `release.setCommits.auto`
380
+
381
+ <a name="option-release-setcommits-auto"></a>
382
+
383
+ Type: `boolean`
384
+
385
+ Automatically sets `commit` and `previousCommit`. Sets `commit` to `HEAD` and `previousCommit` as described in the option's documentation.
386
+
387
+ If you set this to `true`, manually specified `commit` and `previousCommit` options will be overridden. It is best to not specify them at all if you set this option to `true`.
388
+
389
+ ### `release.setCommits.repo`
390
+
391
+ <a name="option-release-setcommits-repo"></a>
392
+
393
+ Type: `string`
394
+
395
+ The full repo name as defined in Sentry.
396
+
397
+ Required if the `auto` option is not set to `true`.
398
+
399
+ ### `release.setCommits.commit`
400
+
401
+ <a name="option-release-setcommits-commit"></a>
402
+
403
+ Type: `string`
404
+
405
+ The current (last) commit in the release.
406
+
407
+ Required if the `auto` option is not set to `true`.
408
+
409
+ ### `release.deploy`
410
+
411
+ <a name="option-release-deploy"></a>
412
+
413
+
414
+
415
+ Adds deployment information to the release in Sentry.
416
+ ### `release.deploy.env`
417
+
418
+ <a name="option-release-deploy-env"></a>
419
+
420
+ Type: `string`
421
+
422
+ Environment for this release. Values that make sense here would be `production` or `staging`.
423
+
424
+ ### `release.deploy.started`
425
+
426
+ <a name="option-release-deploy-started"></a>
427
+
428
+ Type: `number | string`
429
+
430
+ Deployment start time in Unix timestamp (in seconds) or ISO 8601 format.
431
+
432
+ ### `release.deploy.finished`
433
+
434
+ <a name="option-release-deploy-finished"></a>
435
+
436
+ Type: `number | string`
437
+
438
+ Deployment finish time in Unix timestamp (in seconds) or ISO 8601 format.
439
+
440
+ ### `release.deploy.time`
441
+
442
+ <a name="option-release-deploy-time"></a>
443
+
444
+ Type: `number`
445
+
446
+ Deployment duration (in seconds). Can be used instead of started and finished.
447
+
448
+ ### `release.deploy.name`
449
+
450
+ <a name="option-release-deploy-name"></a>
451
+
452
+ Type: `string`
453
+
454
+ Human readable name for the deployment.
455
+
456
+ ### `release.deploy.url`
457
+
458
+ <a name="option-release-deploy-url"></a>
459
+
460
+ Type: `string`
461
+
462
+ URL that points to the deployment.
463
+
464
+ ### `release.cleanArtifacts`
465
+
466
+ <a name="option-release-cleanartifacts"></a>
467
+
468
+ Type: `boolean`
469
+
470
+ Remove all previously uploaded artifacts for this release on Sentry before the upload.
471
+
472
+ Defaults to `false`.
473
+
474
+ ### `release.uploadLegacySourcemaps`
475
+
476
+ <a name="option-release-uploadlegacysourcemaps"></a>
477
+
478
+ Type: `string | IncludeEntry | Array<string | IncludeEntry>`
479
+
480
+ Legacy method of uploading source maps. (not recommended unless necessary)
481
+ One or more paths that should be scanned recursively for sources.
482
+
483
+ Each path can be given as a string or an object with more specific options.
484
+
485
+ The modern version of doing source maps upload is more robust and way easier to get working but has to inject a very small snippet of JavaScript into your output bundles.
486
+ In situations where this leads to problems (e.g subresource integrity) you can use this option as a fallback.
487
+
488
+ The `IncludeEntry` type looks as follows:
109
489
 
110
490
  ```ts
111
- // esbuild.config.js
112
- const sentryEsbuildPlugin = require("@sentry/esbuild-plugin");
491
+ type IncludeEntry = {
492
+ /**
493
+ * One or more paths to scan for files to upload.
494
+ */
495
+ paths: string[];
113
496
 
114
- require("esbuild").build({
115
- plugins: [
116
- sentryEsbuildPlugin({
117
- // ...
118
- include: [
119
- {
120
- paths: ["./packages"],
121
- urlPrefix: "~/path/to/packages",
122
- },
123
- {
124
- paths: ["./client"],
125
- urlPrefix: "~/path/to/client",
126
- },
127
- ],
128
- }),
129
- ],
130
- });
497
+ /**
498
+ * One or more paths to ignore during upload.
499
+ * Overrides entries in ignoreFile file.
500
+ *
501
+ * Defaults to `['node_modules']` if neither `ignoreFile` nor `ignore` is set.
502
+ */
503
+ ignore?: string | string[];
504
+
505
+ /**
506
+ * Path to a file containing list of files/directories to ignore.
507
+ *
508
+ * Can point to `.gitignore` or anything with the same format.
509
+ */
510
+ ignoreFile?: string;
511
+
512
+ /**
513
+ * Array of file extensions of files to be collected for the file upload.
514
+ *
515
+ * By default the following file extensions are processed: js, map, jsbundle and bundle.
516
+ */
517
+ ext?: string[];
518
+
519
+ /**
520
+ * URL prefix to add to the beginning of all filenames.
521
+ * Defaults to '~/' but you might want to set this to the full URL.
522
+ *
523
+ * This is also useful if your files are stored in a sub folder. eg: url-prefix '~/static/js'.
524
+ */
525
+ urlPrefix?: string;
526
+
527
+ /**
528
+ * URL suffix to add to the end of all filenames.
529
+ * Useful for appending query parameters.
530
+ */
531
+ urlSuffix?: string;
532
+
533
+ /**
534
+ * When paired with the `rewrite` option, this will remove a prefix from filename references inside of
535
+ * sourcemaps. For instance you can use this to remove a path that is build machine specific.
536
+ * Note that this will NOT change the names of uploaded files.
537
+ */
538
+ stripPrefix?: string[];
539
+
540
+ /**
541
+ * When paired with the `rewrite` option, this will add `~` to the `stripPrefix` array.
542
+ *
543
+ * Defaults to `false`.
544
+ */
545
+ stripCommonPrefix?: boolean;
546
+
547
+ /**
548
+ * Determines whether sentry-cli should attempt to link minified files with their corresponding maps.
549
+ * By default, it will match files and maps based on name, and add a Sourcemap header to each minified file
550
+ * for which it finds a map. Can be disabled if all minified files contain sourceMappingURL.
551
+ *
552
+ * Defaults to true.
553
+ */
554
+ sourceMapReference?: boolean;
555
+
556
+ /**
557
+ * Enables rewriting of matching source maps so that indexed maps are flattened and missing sources
558
+ * are inlined if possible.
559
+ *
560
+ * Defaults to true
561
+ */
562
+ rewrite?: boolean;
563
+
564
+ /**
565
+ * When `true`, attempts source map validation before upload if rewriting is not enabled.
566
+ * It will spot a variety of issues with source maps and cancel the upload if any are found.
567
+ *
568
+ * Defaults to `false` as this can cause false positives.
569
+ */
570
+ validate?: boolean;
571
+ };
131
572
  ```
132
573
 
133
- #### <a name="setCommits"></a>options.setCommits:
134
574
 
135
- | Option | Type | Required | Description |
136
- | -------------- | --------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
137
- | repo | `string` | see notes | The full git repo name as defined in Sentry. Required if the `auto` option is not `true`, otherwise optional. |
138
- | commit | `string` | see notes | The current (most recent) commit in the release. Required if the `auto` option is not `true`, otherwise optional. |
139
- | previousCommit | `string` | optional | The commit before the beginning of this release (in other words, the last commit of the previous release). Defaults to the last commit of the previous release in Sentry. If there was no previous release, the last 10 commits will be used. |
140
- | auto | `boolean` | optional | Automatically sets `commit` and `previousCommit`. Sets `commit` to `HEAD` and `previousCommit` as described in the option's documentation. If you set this to `true`, manually specified `commit` and `previousCommit` options will be overridden. It is best to not specify them at all if you set this option to `true`. |
141
- | ignoreMissing | `boolean` | optional | If the flag is to `true` and the previous release commit was not found in the repository, the plugin creates a release with the default commits count instead of failing the command. Defaults to `false`. |
142
575
 
143
- #### <a name="deploy"></a>options.deploy:
576
+ ### `_experiments`
577
+
578
+ <a name="option-_experiments"></a>
579
+
580
+ Type: `string`
581
+
582
+ Options that are considered experimental and subject to change. This option does not follow semantic versioning and may change in any release.
583
+ ### `_experiments.injectBuildInformation`
584
+
585
+ <a name="option-_experiments-injectbuildinformation"></a>
586
+
587
+ Type: `boolean`
588
+
589
+ If set to true, the plugin will inject an additional `SENTRY_BUILD_INFO` variable. This contains information about the build, e.g. dependencies, node version and other useful data.
590
+
591
+ Defaults to `false`.
144
592
 
145
- | Option | Type | Required | Description |
146
- | -------- | -------- | -------- | -------------------------------------------------------------------------------- |
147
- | env | `string` | required | Environment value for the release, for example `production` or `staging`. |
148
- | started | `number` | optional | Deployment start time in Unix timestamp (in seconds) or ISO 8601 format. |
149
- | finished | `number` | optional | Deployment finish time in Unix timestamp (in seconds) or ISO 8601 format. |
150
- | time | `number` | optional | Deployment duration in seconds. Can be used instead of `started` and `finished`. |
151
- | name | `string` | optional | Human-readable name for this deployment. |
152
- | url | `string` | optional | URL that points to the deployment. |
153
593
 
154
- You can find more information about these options in our official docs:
155
- https://docs.sentry.io/product/cli/releases/#sentry-cli-sourcemaps.
156
594
 
157
- ### More information
595
+ ## More information
158
596
 
159
597
  - [Sentry Documentation](https://docs.sentry.io/quickstart/)
160
- - [Troubleshooting Sourcemaps](https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js/)
161
- - [Sentry CLI](https://docs.sentry.io/learn/cli/)
162
598
  - [Sentry Discord](https://discord.gg/Ww9hbqr)
163
599
  - [Sentry Stackoverflow](http://stackoverflow.com/questions/tagged/sentry)
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/esbuild-plugin",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.0",
4
4
  "description": "Official Sentry esbuild plugin",
5
5
  "repository": "git@github.com:getsentry/sentry-javascript-bundler-plugins.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript-bundler-plugins/tree/main/packages/esbuild-plugin",
@@ -44,10 +44,11 @@
44
44
  "clean:build": "rimraf ./dist *.tgz",
45
45
  "clean:deps": "rimraf node_modules",
46
46
  "test": "jest",
47
- "lint": "eslint ./src ./test"
47
+ "lint": "eslint ./src ./test",
48
+ "prepack": "ts-node ./src/prepack.ts"
48
49
  },
49
50
  "dependencies": {
50
- "@sentry/bundler-plugin-core": "2.0.0-alpha.6",
51
+ "@sentry/bundler-plugin-core": "2.0.0",
51
52
  "unplugin": "1.0.1",
52
53
  "uuid": "^9.0.0"
53
54
  },
@@ -57,8 +58,8 @@
57
58
  "@babel/preset-typescript": "7.17.12",
58
59
  "@rollup/plugin-babel": "5.3.1",
59
60
  "@rollup/plugin-node-resolve": "13.3.0",
60
- "@sentry-internal/eslint-config": "2.0.0-alpha.6",
61
- "@sentry-internal/sentry-bundler-plugin-tsconfig": "2.0.0-alpha.6",
61
+ "@sentry-internal/eslint-config": "2.0.0",
62
+ "@sentry-internal/sentry-bundler-plugin-tsconfig": "2.0.0",
62
63
  "@swc/core": "^1.2.205",
63
64
  "@swc/jest": "^0.2.21",
64
65
  "@types/jest": "^28.1.3",
@@ -68,6 +69,7 @@
68
69
  "jest": "^28.1.1",
69
70
  "rimraf": "^3.0.2",
70
71
  "rollup": "2.75.7",
72
+ "ts-node": "^10.9.1",
71
73
  "typescript": "^4.7.4"
72
74
  },
73
75
  "volta": {