@sentry/webpack-plugin 2.2.2 → 2.4.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
@@ -57,42 +57,42 @@ module.exports = {
57
57
 
58
58
  ## Options
59
59
 
60
- - [`org`](#option-org)
61
- - [`project`](#option-project)
62
- - [`authToken`](#option-authtoken)
63
- - [`url`](#option-url)
64
- - [`headers`](#option-headers)
65
- - [`debug`](#option-debug)
66
- - [`silent`](#option-silent)
67
- - [`errorHandler`](#option-errorhandler)
68
- - [`telemetry`](#option-telemetry)
69
- - [`disable`](#option-disable)
70
- - [`sourcemaps`](#option-sourcemaps)
71
- - [`assets`](#option-sourcemaps-assets)
72
- - [`ignore`](#option-sourcemaps-ignore)
73
- - [`rewriteSources`](#option-sourcemaps-rewritesources)
74
- - [`deleteFilesAfterUpload`](#option-sourcemaps-deletefilesafterupload)
75
- - [`release`](#option-release)
76
- - [`name`](#option-release-name)
77
- - [`inject`](#option-release-inject)
78
- - [`create`](#option-release-create)
79
- - [`finalize`](#option-release-finalize)
80
- - [`dist`](#option-release-dist)
81
- - [`vcsRemote`](#option-release-vcsremote)
82
- - [`setCommits`](#option-release-setcommits)
83
- - [`deploy`](#option-release-deploy)
84
- - [`cleanArtifacts`](#option-release-cleanartifacts)
85
- - [`uploadLegacySourcemaps`](#option-release-uploadlegacysourcemaps)
86
- - [`_experiments`](#option-_experiments)
87
- - [`injectBuildInformation`](#option-_experiments-injectbuildinformation)
88
-
89
- ### <a name="option-org"></a>`org`
60
+ - [`org`](#org)
61
+ - [`project`](#project)
62
+ - [`authToken`](#authtoken)
63
+ - [`url`](#url)
64
+ - [`headers`](#headers)
65
+ - [`debug`](#debug)
66
+ - [`silent`](#silent)
67
+ - [`errorHandler`](#errorhandler)
68
+ - [`telemetry`](#telemetry)
69
+ - [`disable`](#disable)
70
+ - [`sourcemaps`](#sourcemaps)
71
+ - [`assets`](#sourcemapsassets)
72
+ - [`ignore`](#sourcemapsignore)
73
+ - [`rewriteSources`](#sourcemapsrewritesources)
74
+ - [`filesToDeleteAfterUpload`](#sourcemapsfilestodeleteafterupload)
75
+ - [`release`](#release)
76
+ - [`name`](#releasename)
77
+ - [`inject`](#releaseinject)
78
+ - [`create`](#releasecreate)
79
+ - [`finalize`](#releasefinalize)
80
+ - [`dist`](#releasedist)
81
+ - [`vcsRemote`](#releasevcsremote)
82
+ - [`setCommits`](#releasesetcommits)
83
+ - [`deploy`](#releasedeploy)
84
+ - [`cleanArtifacts`](#releasecleanartifacts)
85
+ - [`uploadLegacySourcemaps`](#releaseuploadlegacysourcemaps)
86
+ - [`_experiments`](#_experiments)
87
+ - [`injectBuildInformation`](#_experimentsinjectbuildinformation)
88
+
89
+ ### `org`
90
90
 
91
91
  Type: `string`
92
92
 
93
93
  The slug of the Sentry organization associated with the app.
94
94
 
95
- ### <a name="option-project"></a>`project`
95
+ ### `project`
96
96
 
97
97
 
98
98
 
@@ -100,7 +100,7 @@ The slug of the Sentry project associated with the app.
100
100
 
101
101
  This value can also be specified via the `SENTRY_PROJECT` environment variable.
102
102
 
103
- ### <a name="option-authtoken"></a>`authToken`
103
+ ### `authToken`
104
104
 
105
105
  Type: `string`
106
106
 
@@ -108,7 +108,7 @@ The authentication token to use for all communication with Sentry. Can be obtain
108
108
 
109
109
  This value can also be specified via the `SENTRY_AUTH_TOKEN` environment variable.
110
110
 
111
- ### <a name="option-url"></a>`url`
111
+ ### `url`
112
112
 
113
113
  Type: `string`
114
114
 
@@ -118,29 +118,29 @@ This value can also be set via the SENTRY_URL environment variable.
118
118
 
119
119
  Defaults to https://sentry.io/, which is the correct value for SaaS customers.
120
120
 
121
- ### <a name="option-headers"></a>`headers`
121
+ ### `headers`
122
122
 
123
123
  Type: `Record<string, string>`
124
124
 
125
125
  Headers added to every outgoing network request.
126
126
 
127
- ### <a name="option-debug"></a>`debug`
127
+ ### `debug`
128
128
 
129
129
  Type: `boolean`
130
130
 
131
131
  Print useful debug information. Defaults to `false`.
132
132
 
133
- ### <a name="option-silent"></a>`silent`
133
+ ### `silent`
134
134
 
135
135
  Type: `boolean`
136
136
 
137
137
  Suppresses all logs. Defaults to `false`.
138
138
 
139
- ### <a name="option-errorhandler"></a>`errorHandler`
139
+ ### `errorHandler`
140
140
 
141
141
  Type: `(err: Error) => void`
142
142
 
143
- When an error occurs during rlease creation or sourcemaps upload, the plugin will call this function.
143
+ When an error occurs during release creation or sourcemaps upload, the plugin will call this function.
144
144
 
145
145
  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.
146
146
 
@@ -153,7 +153,7 @@ errorHandler: (err) => {
153
153
  ```
154
154
 
155
155
 
156
- ### <a name="option-telemetry"></a>`telemetry`
156
+ ### `telemetry`
157
157
 
158
158
  Type: `boolean`
159
159
 
@@ -163,18 +163,18 @@ At Sentry we like to use Sentry ourselves to deliver faster and more stable prod
163
163
 
164
164
  Defaults to `true`.
165
165
 
166
- ### <a name="option-disable"></a>`disable`
166
+ ### `disable`
167
167
 
168
168
  Type: `boolean`
169
169
 
170
170
  Completely disables all functionality of the plugin. Defaults to `false`.
171
171
 
172
- ### <a name="option-sourcemaps"></a>`sourcemaps`
172
+ ### `sourcemaps`
173
173
 
174
174
 
175
175
 
176
176
  Options for source maps uploading. Leave this option undefined if you do not want to upload source maps to Sentry.
177
- ### <a name="option-sourcemaps-assets"></a>`sourcemaps.assets`
177
+ ### `sourcemaps.assets`
178
178
 
179
179
  Type: `string | string[]`
180
180
 
@@ -186,7 +186,7 @@ The globbing patterns follow the implementation of the `glob` package. (https://
186
186
 
187
187
  Use the `debug` option to print information about which files end up being uploaded.
188
188
 
189
- ### <a name="option-sourcemaps-ignore"></a>`sourcemaps.ignore`
189
+ ### `sourcemaps.ignore`
190
190
 
191
191
  Type: `string | string[]`
192
192
 
@@ -198,7 +198,7 @@ The globbing patterns follow the implementation of the `glob` package. (https://
198
198
 
199
199
  Use the `debug` option to print information about which files end up being uploaded.
200
200
 
201
- ### <a name="option-sourcemaps-rewritesources"></a>`sourcemaps.rewriteSources`
201
+ ### `sourcemaps.rewriteSources`
202
202
 
203
203
  Type: `(source: string, map: any) => string`
204
204
 
@@ -206,7 +206,7 @@ Hook to rewrite the `sources` field inside the source map before being uploaded
206
206
 
207
207
  Defaults to making all sources relative to `process.cwd()` while building.
208
208
 
209
- ### <a name="option-sourcemaps-deletefilesafterupload"></a>`sourcemaps.deleteFilesAfterUpload`
209
+ ### `sourcemaps.filesToDeleteAfterUpload`
210
210
 
211
211
  Type: `string | string[]`
212
212
 
@@ -216,14 +216,14 @@ The globbing patterns follow the implementation of the `glob` package. (https://
216
216
 
217
217
  Use the `debug` option to print information about which files end up being deleted.
218
218
 
219
- ### <a name="option-release"></a>`release`
219
+ ### `release`
220
220
 
221
221
 
222
222
 
223
223
  Options related to managing the Sentry releases for a build.
224
224
 
225
225
  More info: https://docs.sentry.io/product/releases/
226
- ### <a name="option-release-name"></a>`release.name`
226
+ ### `release.name`
227
227
 
228
228
  Type: `string`
229
229
 
@@ -235,7 +235,7 @@ Defaults to automatically detecting a value for your environment. This includes
235
235
 
236
236
  If you didn't provide a value and the plugin can't automatically detect one, no release will be created.
237
237
 
238
- ### <a name="option-release-inject"></a>`release.inject`
238
+ ### `release.inject`
239
239
 
240
240
  Type: `boolean`
241
241
 
@@ -243,7 +243,7 @@ Whether the plugin should inject release information into the build for the SDK
243
243
 
244
244
  Defaults to `true`.
245
245
 
246
- ### <a name="option-release-create"></a>`release.create`
246
+ ### `release.create`
247
247
 
248
248
  Type: `boolean`
249
249
 
@@ -251,7 +251,7 @@ Whether the plugin should create a release on Sentry during the build. Note that
251
251
 
252
252
  Defaults to `true`.
253
253
 
254
- ### <a name="option-release-finalize"></a>`release.finalize`
254
+ ### `release.finalize`
255
255
 
256
256
  Type: `boolean`
257
257
 
@@ -259,13 +259,13 @@ Whether the Sentry release should be automatically finalized (meaning an end tim
259
259
 
260
260
  Defaults to `true`.
261
261
 
262
- ### <a name="option-release-dist"></a>`release.dist`
262
+ ### `release.dist`
263
263
 
264
264
  Type: `string`
265
265
 
266
266
  Unique identifier for the distribution, used to further segment your release.
267
267
 
268
- ### <a name="option-release-vcsremote"></a>`release.vcsRemote`
268
+ ### `release.vcsRemote`
269
269
 
270
270
  Type: `string`
271
271
 
@@ -275,12 +275,12 @@ This value can also be specified via the `SENTRY_VSC_REMOTE` environment variabl
275
275
 
276
276
  Defaults to 'origin'.
277
277
 
278
- ### <a name="option-release-setcommits"></a>`release.setCommits`
278
+ ### `release.setCommits`
279
279
 
280
280
 
281
281
 
282
282
  Option to associate the created release with its commits in Sentry.
283
- ### <a name="option-release-setcommits-previouscommit"></a>`release.setCommits.previousCommit`
283
+ ### `release.setCommits.previousCommit`
284
284
 
285
285
  Type: `string`
286
286
 
@@ -290,7 +290,7 @@ Defaults to the last commit of the previous release in Sentry.
290
290
 
291
291
  If there was no previous release, the last 10 commits will be used.
292
292
 
293
- ### <a name="option-release-setcommits-ignoremissing"></a>`release.setCommits.ignoreMissing`
293
+ ### `release.setCommits.ignoreMissing`
294
294
 
295
295
  Type: `boolean`
296
296
 
@@ -298,7 +298,7 @@ If the flag is to `true` and the previous release commit was not found in the re
298
298
 
299
299
  Defaults to `false`.
300
300
 
301
- ### <a name="option-release-setcommits-ignoreempty"></a>`release.setCommits.ignoreEmpty`
301
+ ### `release.setCommits.ignoreEmpty`
302
302
 
303
303
  Type: `boolean`
304
304
 
@@ -306,7 +306,7 @@ If this flag is set, the setCommits step will not fail and just exit silently if
306
306
 
307
307
  Defaults to `false`.
308
308
 
309
- ### <a name="option-release-setcommits-auto"></a>`release.setCommits.auto`
309
+ ### `release.setCommits.auto`
310
310
 
311
311
  Type: `boolean`
312
312
 
@@ -314,7 +314,7 @@ Automatically sets `commit` and `previousCommit`. Sets `commit` to `HEAD` and `p
314
314
 
315
315
  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`.
316
316
 
317
- ### <a name="option-release-setcommits-repo"></a>`release.setCommits.repo`
317
+ ### `release.setCommits.repo`
318
318
 
319
319
  Type: `string`
320
320
 
@@ -322,7 +322,7 @@ The full repo name as defined in Sentry.
322
322
 
323
323
  Required if the `auto` option is not set to `true`.
324
324
 
325
- ### <a name="option-release-setcommits-commit"></a>`release.setCommits.commit`
325
+ ### `release.setCommits.commit`
326
326
 
327
327
  Type: `string`
328
328
 
@@ -330,48 +330,48 @@ The current (last) commit in the release.
330
330
 
331
331
  Required if the `auto` option is not set to `true`.
332
332
 
333
- ### <a name="option-release-deploy"></a>`release.deploy`
333
+ ### `release.deploy`
334
334
 
335
335
 
336
336
 
337
337
  Adds deployment information to the release in Sentry.
338
- ### <a name="option-release-deploy-env"></a>`release.deploy.env`
338
+ ### `release.deploy.env`
339
339
 
340
340
  Type: `string`
341
341
 
342
342
  Environment for this release. Values that make sense here would be `production` or `staging`.
343
343
 
344
- ### <a name="option-release-deploy-started"></a>`release.deploy.started`
344
+ ### `release.deploy.started`
345
345
 
346
346
  Type: `number | string`
347
347
 
348
348
  Deployment start time in Unix timestamp (in seconds) or ISO 8601 format.
349
349
 
350
- ### <a name="option-release-deploy-finished"></a>`release.deploy.finished`
350
+ ### `release.deploy.finished`
351
351
 
352
352
  Type: `number | string`
353
353
 
354
354
  Deployment finish time in Unix timestamp (in seconds) or ISO 8601 format.
355
355
 
356
- ### <a name="option-release-deploy-time"></a>`release.deploy.time`
356
+ ### `release.deploy.time`
357
357
 
358
358
  Type: `number`
359
359
 
360
360
  Deployment duration (in seconds). Can be used instead of started and finished.
361
361
 
362
- ### <a name="option-release-deploy-name"></a>`release.deploy.name`
362
+ ### `release.deploy.name`
363
363
 
364
364
  Type: `string`
365
365
 
366
366
  Human readable name for the deployment.
367
367
 
368
- ### <a name="option-release-deploy-url"></a>`release.deploy.url`
368
+ ### `release.deploy.url`
369
369
 
370
370
  Type: `string`
371
371
 
372
372
  URL that points to the deployment.
373
373
 
374
- ### <a name="option-release-cleanartifacts"></a>`release.cleanArtifacts`
374
+ ### `release.cleanArtifacts`
375
375
 
376
376
  Type: `boolean`
377
377
 
@@ -379,7 +379,7 @@ Remove all previously uploaded artifacts for this release on Sentry before the u
379
379
 
380
380
  Defaults to `false`.
381
381
 
382
- ### <a name="option-release-uploadlegacysourcemaps"></a>`release.uploadLegacySourcemaps`
382
+ ### `release.uploadLegacySourcemaps`
383
383
 
384
384
  Type: `string | IncludeEntry | Array<string | IncludeEntry>`
385
385
 
@@ -479,12 +479,12 @@ type IncludeEntry = {
479
479
 
480
480
 
481
481
 
482
- ### <a name="option-_experiments"></a>`_experiments`
482
+ ### `_experiments`
483
483
 
484
484
  Type: `string`
485
485
 
486
486
  Options that are considered experimental and subject to change. This option does not follow semantic versioning and may change in any release.
487
- ### <a name="option-_experiments-injectbuildinformation"></a>`_experiments.injectBuildInformation`
487
+ ### `_experiments.injectBuildInformation`
488
488
 
489
489
  Type: `boolean`
490
490
 
@@ -494,6 +494,10 @@ Defaults to `false`.
494
494
 
495
495
 
496
496
 
497
+ ### Configuration File
498
+
499
+ As an additional configuration method, the Sentry Webpack plugin will pick up environment variables configured inside a `.env.sentry-build-plugin` file located in the current working directory when building your app.
500
+
497
501
  ## More information
498
502
 
499
503
  - [Sentry Documentation](https://docs.sentry.io/quickstart/)
package/dist/cjs/index.js CHANGED
@@ -63,8 +63,10 @@ function webpackDebugIdInjectionPlugin() {
63
63
  new BannerPlugin({
64
64
  raw: true,
65
65
  include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
66
- banner: function banner() {
67
- return bundlerPluginCore.getDebugIdSnippet(uuid.v4());
66
+ banner: function banner(arg) {
67
+ var _arg$chunk;
68
+ var debugId = arg !== null && arg !== void 0 && (_arg$chunk = arg.chunk) !== null && _arg$chunk !== void 0 && _arg$chunk.hash ? bundlerPluginCore.stringToUUID(arg.chunk.hash) : uuid.v4();
69
+ return bundlerPluginCore.getDebugIdSnippet(debugId);
68
70
  }
69
71
  }));
70
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { getDebugIdSnippet, Options, sentryUnpluginFactory } from \"@sentry/bundler-plugin-core\";\nimport * as path from \"path\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore webpack is a peer dep\nimport * as webback4or5 from \"webpack\";\n\nfunction webpackReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n return {\n name: \"sentry-webpack-release-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin = compiler?.webpack?.BannerPlugin || webback4or5?.BannerPlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n },\n };\n}\n\nfunction webpackDebugIdInjectionPlugin(): UnpluginOptions {\n return {\n name: \"sentry-webpack-debug-id-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin = compiler?.webpack?.BannerPlugin || webback4or5?.BannerPlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: () => getDebugIdSnippet(uuidv4()),\n })\n );\n },\n };\n}\n\nfunction webpackDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>\n): UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-upload-plugin\";\n return {\n name: pluginName,\n webpack(compiler) {\n compiler.hooks.afterEmit.tapAsync(pluginName, (compilation, callback: () => void) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const outputPath = (compilation.outputOptions.path as string | undefined) ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets as Record<string, unknown>).map(\n (asset) => path.join(outputPath, asset)\n );\n void upload(buildArtifacts).then(() => {\n callback();\n });\n });\n },\n };\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n releaseInjectionPlugin: webpackReleaseInjectionPlugin,\n debugIdInjectionPlugin: webpackDebugIdInjectionPlugin,\n debugIdUploadPlugin: webpackDebugIdUploadPlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options: Options) => any = sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\nexport type { Options as SentryWebpackPluginOptions } from \"@sentry/bundler-plugin-core\";\n"],"names":["webpackReleaseInjectionPlugin","injectionCode","name","webpack","compiler","_compiler$webpack","BannerPlugin","webback4or5","options","plugins","push","raw","include","banner","webpackDebugIdInjectionPlugin","_compiler$webpack2","getDebugIdSnippet","uuidv4","webpackDebugIdUploadPlugin","upload","pluginName","hooks","afterEmit","tapAsync","compilation","callback","_ref","outputPath","outputOptions","path","resolve","buildArtifacts","Object","keys","assets","map","asset","join","then","sentryUnplugin","sentryUnpluginFactory","releaseInjectionPlugin","debugIdInjectionPlugin","debugIdUploadPlugin","sentryWebpackPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,SAASA,6BAA6BA,CAACC,aAAqB,EAAmB;EAC7E,OAAO;AACLC,IAAAA,IAAI,EAAE,yCAAyC;IAC/CC,OAAO,EAAA,SAAAA,OAACC,CAA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cAAc,CAAC,CAACO,IAAI,CAAC,YAAM;AACrCb,UAAAA,QAAQ,EAAE,CAAA;AACZ,SAAC,CAAC,CAAA;AACJ,OAAC,CAAC,CAAA;AACJ,KAAA;GACD,CAAA;AACH,CAAA;AAEA,IAAMc,cAAc,GAAGC,uCAAqB,CAAC;AAC3CC,EAAAA,sBAAsB,EAAEzC,6BAA6B;AACrD0C,EAAAA,sBAAsB,EAAE5B,6BAA6B;AACrD6B,EAAAA,mBAAmB,EAAEzB,0BAAAA;AACvB,CAAC,CAAC,CAAA;;AAEF;AACa0B,IAAAA,mBAA8C,GAAGL,cAAc,CAACpC;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import {\n getDebugIdSnippet,\n Options,\n sentryUnpluginFactory,\n stringToUUID,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"path\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore webpack is a peer dep\nimport * as webback4or5 from \"webpack\";\n\ninterface BannerPluginCallbackArg {\n chunk?: {\n hash?: string;\n };\n}\n\nfunction webpackReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n return {\n name: \"sentry-webpack-release-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin = compiler?.webpack?.BannerPlugin || webback4or5?.BannerPlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n },\n };\n}\n\nfunction webpackDebugIdInjectionPlugin(): UnpluginOptions {\n return {\n name: \"sentry-webpack-debug-id-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin = compiler?.webpack?.BannerPlugin || webback4or5?.BannerPlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: (arg?: BannerPluginCallbackArg) => {\n const debugId = arg?.chunk?.hash ? stringToUUID(arg.chunk.hash) : uuidv4();\n return getDebugIdSnippet(debugId);\n },\n })\n );\n },\n };\n}\n\nfunction webpackDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>\n): UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-upload-plugin\";\n return {\n name: pluginName,\n webpack(compiler) {\n compiler.hooks.afterEmit.tapAsync(pluginName, (compilation, callback: () => void) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const outputPath = (compilation.outputOptions.path as string | undefined) ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets as Record<string, unknown>).map(\n (asset) => path.join(outputPath, asset)\n );\n void upload(buildArtifacts).then(() => {\n callback();\n });\n });\n },\n };\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n releaseInjectionPlugin: webpackReleaseInjectionPlugin,\n debugIdInjectionPlugin: webpackDebugIdInjectionPlugin,\n debugIdUploadPlugin: webpackDebugIdUploadPlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options: Options) => any = sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\nexport type { Options as SentryWebpackPluginOptions } from \"@sentry/bundler-plugin-core\";\n"],"names":["webpackReleaseInjectionPlugin","injectionCode","name","webpack","compiler","_compiler$webpack","BannerPlugin","webback4or5","options","plugins","push","raw","include","banner","webpackDebugIdInjectionPlugin","_compiler$webpack2","arg","_arg$chunk","debugId","chunk","hash","stringToUUID","uuidv4","getDebugIdSnippet","webpackDebugIdUploadPlugin","upload","pluginName","hooks","afterEmit","tapAsync","compilation","callback","_ref","outputPath","outputOptions","path","resolve","buildArtifacts","Object","keys","assets","map","asset","join","then","sentryUnplugin","sentryUnpluginFactory","releaseInjectionPlugin","debugIdInjectionPlugin","debugIdUploadPlugin","sentryWebpackPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,SAASA,6BAA6BA,CAACC,aAAqB,EAAmB;EAC7E,OAAO;AACLC,IAAAA,IAAI,EAAE,yCAAyC;IAC/CC,OAAO,EAAA,SAAAA,OAACC,CAAAA,QAAQ,EAAE;AAAA,MAAA,IAAAC,iBAAA,CAAA;AAChB;AACA;AACA;MACA,IAAMC,YAAY,GAAG,CAAAF,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAAC,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,CAAAA,iBAAA,GAARD,QAAQ,CAAED,OAAO,cAAAE,iBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAjBA,iBAAA,CAAmBC,YAAY,MAAIC,sBAAW,KAAA,IAAA,IAAXA,sBAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAXA,sBAAW,CAAED,YAAY,CAAA,CAAA;MACjFF,QAAQ,CAACI,OAAO,CAACC,OAAO,GAAGL,QAAQ,CAACI,OAAO,CAACC,OAAO,IAAI,EAAE,CAAA;AACzDL,MAAAA,QAAQ,CAACI,OAAO,CAACC,OAAO,CAACC,IAAI;AAC3B;AACA,MAAA,IAAIJ,YAAY,CAAC;AACfK,QAAAA,GAAG,EAAE,IAAI;AACTC,QAAAA,OAAO,EA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AEF;AACa0B,IAAAA,mBAA8C,GAAGL,cAAc,CAAC1C;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { sentryUnpluginFactory, getDebugIdSnippet } from '@sentry/bundler-plugin-core';
1
+ import { sentryUnpluginFactory, stringToUUID, getDebugIdSnippet } from '@sentry/bundler-plugin-core';
2
2
  export { sentryCliBinaryExists } from '@sentry/bundler-plugin-core';
3
3
  import * as path from 'path';
4
4
  import { v4 } from 'uuid';
@@ -39,8 +39,10 @@ function webpackDebugIdInjectionPlugin() {
39
39
  new BannerPlugin({
40
40
  raw: true,
41
41
  include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
42
- banner: function banner() {
43
- return getDebugIdSnippet(v4());
42
+ banner: function banner(arg) {
43
+ var _arg$chunk;
44
+ var debugId = arg !== null && arg !== void 0 && (_arg$chunk = arg.chunk) !== null && _arg$chunk !== void 0 && _arg$chunk.hash ? stringToUUID(arg.chunk.hash) : v4();
45
+ return getDebugIdSnippet(debugId);
44
46
  }
45
47
  }));
46
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"sourcesContent":["import { getDebugIdSnippet, Options, sentryUnpluginFactory } from \"@sentry/bundler-plugin-core\";\nimport * as path from \"path\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore webpack is a peer dep\nimport * as webback4or5 from \"webpack\";\n\nfunction webpackReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n return {\n name: \"sentry-webpack-release-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin = compiler?.webpack?.BannerPlugin || webback4or5?.BannerPlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n },\n };\n}\n\nfunction webpackDebugIdInjectionPlugin(): UnpluginOptions {\n return {\n name: \"sentry-webpack-debug-id-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin = compiler?.webpack?.BannerPlugin || webback4or5?.BannerPlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: () => getDebugIdSnippet(uuidv4()),\n })\n );\n },\n };\n}\n\nfunction webpackDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>\n): UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-upload-plugin\";\n return {\n name: pluginName,\n webpack(compiler) {\n compiler.hooks.afterEmit.tapAsync(pluginName, (compilation, callback: () => void) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const outputPath = (compilation.outputOptions.path as string | undefined) ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets as Record<string, unknown>).map(\n (asset) => path.join(outputPath, asset)\n );\n void upload(buildArtifacts).then(() => {\n callback();\n });\n });\n },\n };\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n releaseInjectionPlugin: webpackReleaseInjectionPlugin,\n debugIdInjectionPlugin: webpackDebugIdInjectionPlugin,\n debugIdUploadPlugin: webpackDebugIdUploadPlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options: Options) => any = sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\nexport type { Options as SentryWebpackPluginOptions } from \"@sentry/bundler-plugin-core\";\n"],"names":["webpackReleaseInjectionPlugin","injectionCode","name","webpack","compiler","_compiler$webpack","BannerPlugin","webback4or5","options","plugins","push","raw","include","banner","webpackDebugIdInjectionPlugin","_compiler$webpack2","getDebugIdSnippet","uuidv4","webpackDebugIdUploadPlugin","upload","pluginName","hooks","afterEmit","tapAsync","compilation","callback","_ref","outputPath","outputOptions","path","resolve","buildArtifacts","Object","keys","assets","map","asset","join","then","sentryUnplugin","sentryUnpluginFactory","releaseInjectionPlugin","debugIdInjectionPlugin","debugIdUploadPlugin","sentryWebpackPlugin"],"mappings":";;;;;;AASA,SAASA,6BAA6BA,CAACC,aAAqB,EAAmB;EAC7E,OAAO;AACLC,IAAAA,IAAI,EAAE,yCAAyC;IAC/CC,OAAO,EAAA,SAAAA,OAACC,CAAAA,QAAQ,EAAE;AAAA,MAAA,IAAAC,iBAAA,CAAA;AAChB;AACA;AACA;MACA,IAAMC,YAAY,GAAG,CAAAF,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAAC,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,CAAAA,iBAAA,GAARD,QAAQ,CAAED,OAAO,cAAAE,iBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAjBA,iBAAA,CAAmBC,YAAY,MAAIC,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAXA,WAAW,CAAED,YAAY,CAAA,CAAA;MACjFF,QAAQ,CAACI,OAAO,CAACC,OAAO,GAAGL,QAAQ,CAACI,OAAO,CAACC,OAAO,IAAI,EAAE,CAAA;AACzDL,MAAAA,QAAQ,CAACI,OAAO,CAACC,OAAO,CAACC,IAAI;AAC3B;AACA,MAAA,IAAIJ,YAAY,CAAC;AACfK,QAAAA,GAAG,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AAO,EAAA,SAAAA,OAACC,CAAAA,QAAQ,EAAE;AAChBA,MAAAA,QAAQ,CAACiB,KAAK,CAACC,SAAS,CAACC,QAAQ,CAACH,UAAU,EAAE,UAACI,WAAW,EAAEC,QAAoB,EAAK;AAAA,QAAA,IAAAC,IAAA,CAAA;AACnF;AACA,QAAA,IAAMC,UAAU,GAAAD,CAAAA,IAAA,GAAIF,WAAW,CAACI,aAAa,CAACC,IAAI,MAAAH,IAAAA,IAAAA,IAAA,cAAAA,IAAA,GAA2BG,IAAI,CAACC,OAAO,EAAE,CAAA;AAC3F,QAAA,IAAMC,cAAc,GAAGC,MAAM,CAACC,IAAI,CAACT,WAAW,CAACU,MAAiC,CAAC,CAACC,GAAG,CACnF,UAACC,KAAK,EAAA;AAAA,UAAA,OAAKP,IAAI,CAACQ,IAAI,CAACV,UAAU,EAAES,KAAK,CAAC,CAAA;AAAA,SACzC,CAAC,CAAA;AACD,QAAA,KAAKjB,MAAM,CAACY,cAAc,CAAC,CAACO,IAAI,CAAC,YAAM;AACrCb,UAAAA,QAAQ,EAAE,CAAA;AACZ,SAAC,CAAC,CAAA;AACJ,OAAC,CAAC,CAAA;AACJ,KAAA;GACD,CAAA;AACH,CAAA;AAEA,IAAMc,cAAc,GAAGC,qBAAqB,CAAC;AAC3CC,EAAAA,sBAAsB,EAAEzC,6BAA6B;AACrD0C,EAAAA,sBAAsB,EAAE5B,6BAA6B;AACrD6B,EAAAA,mBAAmB,EAAEzB,0BAAAA;AACvB,CAAC,CAAC,CAAA;;AAEF;AACa0B,IAAAA,mBAA8C,GAAGL,cAAc,CAACpC;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"sourcesContent":["import {\n getDebugIdSnippet,\n Options,\n sentryUnpluginFactory,\n stringToUUID,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"path\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore webpack is a peer dep\nimport * as webback4or5 from \"webpack\";\n\ninterface BannerPluginCallbackArg {\n chunk?: {\n hash?: string;\n };\n}\n\nfunction webpackReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n return {\n name: \"sentry-webpack-release-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin = compiler?.webpack?.BannerPlugin || webback4or5?.BannerPlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n },\n };\n}\n\nfunction webpackDebugIdInjectionPlugin(): UnpluginOptions {\n return {\n name: \"sentry-webpack-debug-id-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin = compiler?.webpack?.BannerPlugin || webback4or5?.BannerPlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: (arg?: BannerPluginCallbackArg) => {\n const debugId = arg?.chunk?.hash ? stringToUUID(arg.chunk.hash) : uuidv4();\n return getDebugIdSnippet(debugId);\n },\n })\n );\n },\n };\n}\n\nfunction webpackDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>\n): UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-upload-plugin\";\n return {\n name: pluginName,\n webpack(compiler) {\n compiler.hooks.afterEmit.tapAsync(pluginName, (compilation, callback: () => void) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const outputPath = (compilation.outputOptions.path as string | undefined) ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets as Record<string, unknown>).map(\n (asset) => path.join(outputPath, asset)\n );\n void upload(buildArtifacts).then(() => {\n callback();\n });\n });\n },\n };\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n releaseInjectionPlugin: webpackReleaseInjectionPlugin,\n debugIdInjectionPlugin: webpackDebugIdInjectionPlugin,\n debugIdUploadPlugin: webpackDebugIdUploadPlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options: Options) => any = sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\nexport type { Options as SentryWebpackPluginOptions } from \"@sentry/bundler-plugin-core\";\n"],"names":["webpackReleaseInjectionPlugin","injectionCode","name","webpack","compiler","_compiler$webpack","BannerPlugin","webback4or5","options","plugins","push","raw","include","banner","webpackDebugIdInjectionPlugin","_compiler$webpack2","arg","_arg$chunk","debugId","chunk","hash","stringToUUID","uuidv4","getDebugIdSnippet","webpackDebugIdUploadPlugin","upload","pluginName","hooks","afterEmit","tapAsync","compilation","callback","_ref","outputPath","outputOptions","path","resolve","buildArtifacts","Object","keys","assets","map","asset","join","then","sentryUnplugin","sentryUnpluginFactory","releaseInjectionPlugin","debugIdInjectionPlugin","debugIdUploadPlugin","sentryWebpackPlugin"],"mappings":";;;;;;AAoBA,SAASA,6BAA6BA,CAACC,aAAqB,EAAmB;EAC7E,OAAO;AACLC,IAAAA,IAAI,EAAE,yCAAyC;IAC/CC,OAAO,EAAA,SAAAA,OAACC,CAAAA,QAAQ,EAAE;AAAA,MAAA,IAAAC,iBAAA,CAAA;AAChB;AACA;AACA;MACA,IAAMC,YAAY,GAAG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GAAGC,MAAM,CAACC,IAAI,CAACT,WAAW,CAACU,MAAiC,CAAC,CAACC,GAAG,CACnF,UAACC,KAAK,EAAA;AAAA,UAAA,OAAKP,IAAI,CAACQ,IAAI,CAACV,UAAU,EAAES,KAAK,CAAC,CAAA;AAAA,SACzC,CAAC,CAAA;AACD,QAAA,KAAKjB,MAAM,CAACY,cAAc,CAAC,CAACO,IAAI,CAAC,YAAM;AACrCb,UAAAA,QAAQ,EAAE,CAAA;AACZ,SAAC,CAAC,CAAA;AACJ,OAAC,CAAC,CAAA;AACJ,KAAA;GACD,CAAA;AACH,CAAA;AAEA,IAAMc,cAAc,GAAGC,qBAAqB,CAAC;AAC3CC,EAAAA,sBAAsB,EAAE/C,6BAA6B;AACrDgD,EAAAA,sBAAsB,EAAElC,6BAA6B;AACrDmC,EAAAA,mBAAmB,EAAEzB,0BAAAA;AACvB,CAAC,CAAC,CAAA;;AAEF;AACa0B,IAAAA,mBAA8C,GAAGL,cAAc,CAAC1C;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/webpack-plugin",
3
- "version": "2.2.2",
3
+ "version": "2.4.0",
4
4
  "description": "Official Sentry Webpack 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/webpack-plugin",
@@ -48,7 +48,7 @@
48
48
  "prepack": "ts-node ./src/prepack.ts"
49
49
  },
50
50
  "dependencies": {
51
- "@sentry/bundler-plugin-core": "2.2.2",
51
+ "@sentry/bundler-plugin-core": "2.4.0",
52
52
  "unplugin": "1.0.1",
53
53
  "uuid": "^9.0.0"
54
54
  },
@@ -58,8 +58,8 @@
58
58
  "@babel/preset-typescript": "7.17.12",
59
59
  "@rollup/plugin-babel": "5.3.1",
60
60
  "@rollup/plugin-commonjs": "22.0.1",
61
- "@sentry-internal/eslint-config": "2.2.2",
62
- "@sentry-internal/sentry-bundler-plugin-tsconfig": "2.2.2",
61
+ "@sentry-internal/eslint-config": "2.4.0",
62
+ "@sentry-internal/sentry-bundler-plugin-tsconfig": "2.4.0",
63
63
  "@swc/core": "^1.2.205",
64
64
  "@swc/jest": "^0.2.21",
65
65
  "@types/jest": "^28.1.3",
@@ -81,6 +81,6 @@
81
81
  "extends": "../../package.json"
82
82
  },
83
83
  "engines": {
84
- "node": ">= 10"
84
+ "node": ">= 14"
85
85
  }
86
86
  }