@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 +547 -111
- package/dist/types/prepack.d.ts +1 -0
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -6,158 +6,594 @@
|
|
|
6
6
|
|
|
7
7
|
# Sentry Esbuild Plugin
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
[](https://www.npmjs.com/package/@sentry/esbuild-plugin)
|
|
10
|
+
[](https://www.npmjs.com/package/@sentry/esbuild-plugin)
|
|
11
|
+
[](https://www.npmjs.com/package/@sentry/esbuild-plugin)
|
|
10
12
|
|
|
11
|
-
|
|
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
|
-
|
|
20
|
+
npm install @sentry/esbuild-plugin --save-dev
|
|
22
21
|
```
|
|
23
22
|
|
|
24
23
|
Using yarn:
|
|
25
24
|
|
|
26
25
|
```bash
|
|
27
|
-
|
|
26
|
+
yarn add @sentry/esbuild-plugin --dev
|
|
28
27
|
```
|
|
29
28
|
|
|
30
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
112
|
-
|
|
491
|
+
type IncludeEntry = {
|
|
492
|
+
/**
|
|
493
|
+
* One or more paths to scan for files to upload.
|
|
494
|
+
*/
|
|
495
|
+
paths: string[];
|
|
113
496
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
61
|
-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "2.0.0
|
|
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": {
|