@sentry/webpack-plugin 2.0.0-alpha.7 → 2.1.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
@@ -50,27 +50,6 @@ module.exports = {
50
50
  // Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/
51
51
  // and need `project:releases` and `org:read` scopes
52
52
  authToken: process.env.SENTRY_AUTH_TOKEN,
53
-
54
- sourcemaps: {
55
- // Specify the directory containing build artifacts
56
- assets: "./**",
57
- // Don't upload the source maps of dependencies
58
- ignore: ["./node_modules/**"],
59
- },
60
-
61
- // Helps troubleshooting - set to false to make plugin less noisy
62
- debug: true,
63
-
64
- // Use the following option if you're on an SDK version lower than 7.47.0:
65
- // release: {
66
- // uploadLegacySourcemaps: {
67
- // include: ".",
68
- // ignore: ["node_modules"],
69
- // },
70
- // },
71
-
72
- // Optionally uncomment the line below to override automatic release name detection
73
- // release: env.RELEASE,
74
53
  }),
75
54
  ],
76
55
  };
@@ -107,17 +86,13 @@ module.exports = {
107
86
  - [`_experiments`](#option-_experiments)
108
87
  - [`injectBuildInformation`](#option-_experiments-injectbuildinformation)
109
88
 
110
- ### `org`
111
-
112
- <a name="option-org"></a>
89
+ ### <a name="option-org"></a>`org`
113
90
 
114
91
  Type: `string`
115
92
 
116
93
  The slug of the Sentry organization associated with the app.
117
94
 
118
- ### `project`
119
-
120
- <a name="option-project"></a>
95
+ ### <a name="option-project"></a>`project`
121
96
 
122
97
 
123
98
 
@@ -125,9 +100,7 @@ The slug of the Sentry project associated with the app.
125
100
 
126
101
  This value can also be specified via the `SENTRY_PROJECT` environment variable.
127
102
 
128
- ### `authToken`
129
-
130
- <a name="option-authtoken"></a>
103
+ ### <a name="option-authtoken"></a>`authToken`
131
104
 
132
105
  Type: `string`
133
106
 
@@ -135,9 +108,7 @@ The authentication token to use for all communication with Sentry. Can be obtain
135
108
 
136
109
  This value can also be specified via the `SENTRY_AUTH_TOKEN` environment variable.
137
110
 
138
- ### `url`
139
-
140
- <a name="option-url"></a>
111
+ ### <a name="option-url"></a>`url`
141
112
 
142
113
  Type: `string`
143
114
 
@@ -147,33 +118,25 @@ This value can also be set via the SENTRY_URL environment variable.
147
118
 
148
119
  Defaults to https://sentry.io/, which is the correct value for SaaS customers.
149
120
 
150
- ### `headers`
151
-
152
- <a name="option-headers"></a>
121
+ ### <a name="option-headers"></a>`headers`
153
122
 
154
123
  Type: `Record<string, string>`
155
124
 
156
125
  Headers added to every outgoing network request.
157
126
 
158
- ### `debug`
159
-
160
- <a name="option-debug"></a>
127
+ ### <a name="option-debug"></a>`debug`
161
128
 
162
129
  Type: `boolean`
163
130
 
164
131
  Print useful debug information. Defaults to `false`.
165
132
 
166
- ### `silent`
167
-
168
- <a name="option-silent"></a>
133
+ ### <a name="option-silent"></a>`silent`
169
134
 
170
135
  Type: `boolean`
171
136
 
172
137
  Suppresses all logs. Defaults to `false`.
173
138
 
174
- ### `errorHandler`
175
-
176
- <a name="option-errorhandler"></a>
139
+ ### <a name="option-errorhandler"></a>`errorHandler`
177
140
 
178
141
  Type: `(err: Error) => void`
179
142
 
@@ -190,9 +153,7 @@ errorHandler: (err) => {
190
153
  ```
191
154
 
192
155
 
193
- ### `telemetry`
194
-
195
- <a name="option-telemetry"></a>
156
+ ### <a name="option-telemetry"></a>`telemetry`
196
157
 
197
158
  Type: `boolean`
198
159
 
@@ -202,36 +163,30 @@ At Sentry we like to use Sentry ourselves to deliver faster and more stable prod
202
163
 
203
164
  Defaults to `true`.
204
165
 
205
- ### `disable`
206
-
207
- <a name="option-disable"></a>
166
+ ### <a name="option-disable"></a>`disable`
208
167
 
209
168
  Type: `boolean`
210
169
 
211
170
  Completely disables all functionality of the plugin. Defaults to `false`.
212
171
 
213
- ### `sourcemaps`
214
-
215
- <a name="option-sourcemaps"></a>
172
+ ### <a name="option-sourcemaps"></a>`sourcemaps`
216
173
 
217
174
 
218
175
 
219
176
  Options for source maps uploading. Leave this option undefined if you do not want to upload source maps to Sentry.
220
- ### `sourcemaps.assets`
221
-
222
- <a name="option-sourcemaps-assets"></a>
177
+ ### <a name="option-sourcemaps-assets"></a>`sourcemaps.assets`
223
178
 
224
179
  Type: `string | string[]`
225
180
 
226
181
  A glob or an array of globs that specifies the build artifacts that should be uploaded to Sentry.
227
182
 
183
+ If this option is not specified, the plugin will try to upload all JavaScript files and source map files that are created during build.
184
+
228
185
  The globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)
229
186
 
230
187
  Use the `debug` option to print information about which files end up being uploaded.
231
188
 
232
- ### `sourcemaps.ignore`
233
-
234
- <a name="option-sourcemaps-ignore"></a>
189
+ ### <a name="option-sourcemaps-ignore"></a>`sourcemaps.ignore`
235
190
 
236
191
  Type: `string | string[]`
237
192
 
@@ -243,9 +198,7 @@ The globbing patterns follow the implementation of the `glob` package. (https://
243
198
 
244
199
  Use the `debug` option to print information about which files end up being uploaded.
245
200
 
246
- ### `sourcemaps.rewriteSources`
247
-
248
- <a name="option-sourcemaps-rewritesources"></a>
201
+ ### <a name="option-sourcemaps-rewritesources"></a>`sourcemaps.rewriteSources`
249
202
 
250
203
  Type: `(source: string, map: any) => string`
251
204
 
@@ -253,9 +206,7 @@ Hook to rewrite the `sources` field inside the source map before being uploaded
253
206
 
254
207
  Defaults to making all sources relative to `process.cwd()` while building.
255
208
 
256
- ### `sourcemaps.deleteFilesAfterUpload`
257
-
258
- <a name="option-sourcemaps-deletefilesafterupload"></a>
209
+ ### <a name="option-sourcemaps-deletefilesafterupload"></a>`sourcemaps.deleteFilesAfterUpload`
259
210
 
260
211
  Type: `string | string[]`
261
212
 
@@ -265,18 +216,14 @@ The globbing patterns follow the implementation of the `glob` package. (https://
265
216
 
266
217
  Use the `debug` option to print information about which files end up being deleted.
267
218
 
268
- ### `release`
269
-
270
- <a name="option-release"></a>
219
+ ### <a name="option-release"></a>`release`
271
220
 
272
221
 
273
222
 
274
223
  Options related to managing the Sentry releases for a build.
275
224
 
276
225
  More info: https://docs.sentry.io/product/releases/
277
- ### `release.name`
278
-
279
- <a name="option-release-name"></a>
226
+ ### <a name="option-release-name"></a>`release.name`
280
227
 
281
228
  Type: `string`
282
229
 
@@ -288,9 +235,7 @@ Defaults to automatically detecting a value for your environment. This includes
288
235
 
289
236
  If you didn't provide a value and the plugin can't automatically detect one, no release will be created.
290
237
 
291
- ### `release.inject`
292
-
293
- <a name="option-release-inject"></a>
238
+ ### <a name="option-release-inject"></a>`release.inject`
294
239
 
295
240
  Type: `boolean`
296
241
 
@@ -298,9 +243,7 @@ Whether the plugin should inject release information into the build for the SDK
298
243
 
299
244
  Defaults to `true`.
300
245
 
301
- ### `release.create`
302
-
303
- <a name="option-release-create"></a>
246
+ ### <a name="option-release-create"></a>`release.create`
304
247
 
305
248
  Type: `boolean`
306
249
 
@@ -308,9 +251,7 @@ Whether the plugin should create a release on Sentry during the build. Note that
308
251
 
309
252
  Defaults to `true`.
310
253
 
311
- ### `release.finalize`
312
-
313
- <a name="option-release-finalize"></a>
254
+ ### <a name="option-release-finalize"></a>`release.finalize`
314
255
 
315
256
  Type: `boolean`
316
257
 
@@ -318,17 +259,13 @@ Whether the Sentry release should be automatically finalized (meaning an end tim
318
259
 
319
260
  Defaults to `true`.
320
261
 
321
- ### `release.dist`
322
-
323
- <a name="option-release-dist"></a>
262
+ ### <a name="option-release-dist"></a>`release.dist`
324
263
 
325
264
  Type: `string`
326
265
 
327
266
  Unique identifier for the distribution, used to further segment your release.
328
267
 
329
- ### `release.vcsRemote`
330
-
331
- <a name="option-release-vcsremote"></a>
268
+ ### <a name="option-release-vcsremote"></a>`release.vcsRemote`
332
269
 
333
270
  Type: `string`
334
271
 
@@ -338,16 +275,12 @@ This value can also be specified via the `SENTRY_VSC_REMOTE` environment variabl
338
275
 
339
276
  Defaults to 'origin'.
340
277
 
341
- ### `release.setCommits`
342
-
343
- <a name="option-release-setcommits"></a>
278
+ ### <a name="option-release-setcommits"></a>`release.setCommits`
344
279
 
345
280
 
346
281
 
347
282
  Option to associate the created release with its commits in Sentry.
348
- ### `release.setCommits.previousCommit`
349
-
350
- <a name="option-release-setcommits-previouscommit"></a>
283
+ ### <a name="option-release-setcommits-previouscommit"></a>`release.setCommits.previousCommit`
351
284
 
352
285
  Type: `string`
353
286
 
@@ -357,9 +290,7 @@ Defaults to the last commit of the previous release in Sentry.
357
290
 
358
291
  If there was no previous release, the last 10 commits will be used.
359
292
 
360
- ### `release.setCommits.ignoreMissing`
361
-
362
- <a name="option-release-setcommits-ignoremissing"></a>
293
+ ### <a name="option-release-setcommits-ignoremissing"></a>`release.setCommits.ignoreMissing`
363
294
 
364
295
  Type: `boolean`
365
296
 
@@ -367,9 +298,7 @@ If the flag is to `true` and the previous release commit was not found in the re
367
298
 
368
299
  Defaults to `false`.
369
300
 
370
- ### `release.setCommits.ignoreEmpty`
371
-
372
- <a name="option-release-setcommits-ignoreempty"></a>
301
+ ### <a name="option-release-setcommits-ignoreempty"></a>`release.setCommits.ignoreEmpty`
373
302
 
374
303
  Type: `boolean`
375
304
 
@@ -377,9 +306,7 @@ If this flag is set, the setCommits step will not fail and just exit silently if
377
306
 
378
307
  Defaults to `false`.
379
308
 
380
- ### `release.setCommits.auto`
381
-
382
- <a name="option-release-setcommits-auto"></a>
309
+ ### <a name="option-release-setcommits-auto"></a>`release.setCommits.auto`
383
310
 
384
311
  Type: `boolean`
385
312
 
@@ -387,9 +314,7 @@ Automatically sets `commit` and `previousCommit`. Sets `commit` to `HEAD` and `p
387
314
 
388
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`.
389
316
 
390
- ### `release.setCommits.repo`
391
-
392
- <a name="option-release-setcommits-repo"></a>
317
+ ### <a name="option-release-setcommits-repo"></a>`release.setCommits.repo`
393
318
 
394
319
  Type: `string`
395
320
 
@@ -397,9 +322,7 @@ The full repo name as defined in Sentry.
397
322
 
398
323
  Required if the `auto` option is not set to `true`.
399
324
 
400
- ### `release.setCommits.commit`
401
-
402
- <a name="option-release-setcommits-commit"></a>
325
+ ### <a name="option-release-setcommits-commit"></a>`release.setCommits.commit`
403
326
 
404
327
  Type: `string`
405
328
 
@@ -407,64 +330,48 @@ The current (last) commit in the release.
407
330
 
408
331
  Required if the `auto` option is not set to `true`.
409
332
 
410
- ### `release.deploy`
411
-
412
- <a name="option-release-deploy"></a>
333
+ ### <a name="option-release-deploy"></a>`release.deploy`
413
334
 
414
335
 
415
336
 
416
337
  Adds deployment information to the release in Sentry.
417
- ### `release.deploy.env`
418
-
419
- <a name="option-release-deploy-env"></a>
338
+ ### <a name="option-release-deploy-env"></a>`release.deploy.env`
420
339
 
421
340
  Type: `string`
422
341
 
423
342
  Environment for this release. Values that make sense here would be `production` or `staging`.
424
343
 
425
- ### `release.deploy.started`
426
-
427
- <a name="option-release-deploy-started"></a>
344
+ ### <a name="option-release-deploy-started"></a>`release.deploy.started`
428
345
 
429
346
  Type: `number | string`
430
347
 
431
348
  Deployment start time in Unix timestamp (in seconds) or ISO 8601 format.
432
349
 
433
- ### `release.deploy.finished`
434
-
435
- <a name="option-release-deploy-finished"></a>
350
+ ### <a name="option-release-deploy-finished"></a>`release.deploy.finished`
436
351
 
437
352
  Type: `number | string`
438
353
 
439
354
  Deployment finish time in Unix timestamp (in seconds) or ISO 8601 format.
440
355
 
441
- ### `release.deploy.time`
442
-
443
- <a name="option-release-deploy-time"></a>
356
+ ### <a name="option-release-deploy-time"></a>`release.deploy.time`
444
357
 
445
358
  Type: `number`
446
359
 
447
360
  Deployment duration (in seconds). Can be used instead of started and finished.
448
361
 
449
- ### `release.deploy.name`
450
-
451
- <a name="option-release-deploy-name"></a>
362
+ ### <a name="option-release-deploy-name"></a>`release.deploy.name`
452
363
 
453
364
  Type: `string`
454
365
 
455
366
  Human readable name for the deployment.
456
367
 
457
- ### `release.deploy.url`
458
-
459
- <a name="option-release-deploy-url"></a>
368
+ ### <a name="option-release-deploy-url"></a>`release.deploy.url`
460
369
 
461
370
  Type: `string`
462
371
 
463
372
  URL that points to the deployment.
464
373
 
465
- ### `release.cleanArtifacts`
466
-
467
- <a name="option-release-cleanartifacts"></a>
374
+ ### <a name="option-release-cleanartifacts"></a>`release.cleanArtifacts`
468
375
 
469
376
  Type: `boolean`
470
377
 
@@ -472,9 +379,7 @@ Remove all previously uploaded artifacts for this release on Sentry before the u
472
379
 
473
380
  Defaults to `false`.
474
381
 
475
- ### `release.uploadLegacySourcemaps`
476
-
477
- <a name="option-release-uploadlegacysourcemaps"></a>
382
+ ### <a name="option-release-uploadlegacysourcemaps"></a>`release.uploadLegacySourcemaps`
478
383
 
479
384
  Type: `string | IncludeEntry | Array<string | IncludeEntry>`
480
385
 
@@ -574,16 +479,12 @@ type IncludeEntry = {
574
479
 
575
480
 
576
481
 
577
- ### `_experiments`
578
-
579
- <a name="option-_experiments"></a>
482
+ ### <a name="option-_experiments"></a>`_experiments`
580
483
 
581
484
  Type: `string`
582
485
 
583
486
  Options that are considered experimental and subject to change. This option does not follow semantic versioning and may change in any release.
584
- ### `_experiments.injectBuildInformation`
585
-
586
- <a name="option-_experiments-injectbuildinformation"></a>
487
+ ### <a name="option-_experiments-injectbuildinformation"></a>`_experiments.injectBuildInformation`
587
488
 
588
489
  Type: `boolean`
589
490
 
package/dist/cjs/index.js CHANGED
@@ -3,16 +3,35 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var bundlerPluginCore = require('@sentry/bundler-plugin-core');
6
+ var path = require('path');
6
7
  var uuid = require('uuid');
7
8
  var webpack4 = require('webpack-4');
8
9
 
10
+ function _interopNamespace(e) {
11
+ if (e && e.__esModule) return e;
12
+ var n = Object.create(null);
13
+ if (e) {
14
+ Object.keys(e).forEach(function (k) {
15
+ if (k !== 'default') {
16
+ var d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: function () { return e[k]; }
20
+ });
21
+ }
22
+ });
23
+ }
24
+ n["default"] = e;
25
+ return Object.freeze(n);
26
+ }
27
+
28
+ var path__namespace = /*#__PURE__*/_interopNamespace(path);
29
+
9
30
  function webpackReleaseInjectionPlugin(injectionCode) {
10
- var pluginName = "sentry-webpack-release-injection-plugin";
11
31
  return {
12
- name: pluginName,
32
+ name: "sentry-webpack-release-injection-plugin",
13
33
  webpack: function webpack(compiler) {
14
34
  var _compiler$webpack;
15
-
16
35
  if (compiler !== null && compiler !== void 0 && (_compiler$webpack = compiler.webpack) !== null && _compiler$webpack !== void 0 && _compiler$webpack.BannerPlugin) {
17
36
  compiler.options.plugins.push(new compiler.webpack.BannerPlugin({
18
37
  raw: true,
@@ -20,7 +39,8 @@ function webpackReleaseInjectionPlugin(injectionCode) {
20
39
  banner: injectionCode
21
40
  }));
22
41
  } else {
23
- compiler.options.plugins.push( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
42
+ compiler.options.plugins.push(
43
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
24
44
  new webpack4.BannerPlugin({
25
45
  raw: true,
26
46
  include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
@@ -30,14 +50,11 @@ function webpackReleaseInjectionPlugin(injectionCode) {
30
50
  }
31
51
  };
32
52
  }
33
-
34
53
  function webpackDebugIdInjectionPlugin() {
35
- var pluginName = "sentry-webpack-debug-id-injection-plugin";
36
54
  return {
37
- name: pluginName,
55
+ name: "sentry-webpack-debug-id-injection-plugin",
38
56
  webpack: function webpack(compiler) {
39
57
  var _compiler$webpack2;
40
-
41
58
  if (compiler !== null && compiler !== void 0 && (_compiler$webpack2 = compiler.webpack) !== null && _compiler$webpack2 !== void 0 && _compiler$webpack2.BannerPlugin) {
42
59
  compiler.options.plugins.push(new compiler.webpack.BannerPlugin({
43
60
  raw: true,
@@ -47,7 +64,8 @@ function webpackDebugIdInjectionPlugin() {
47
64
  }
48
65
  }));
49
66
  } else {
50
- compiler.options.plugins.push( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
67
+ compiler.options.plugins.push(
68
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
51
69
  new webpack4.BannerPlugin({
52
70
  raw: true,
53
71
  include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
@@ -59,12 +77,31 @@ function webpackDebugIdInjectionPlugin() {
59
77
  }
60
78
  };
61
79
  }
62
-
80
+ function webpackDebugIdUploadPlugin(upload) {
81
+ var pluginName = "sentry-webpack-debug-id-upload-plugin";
82
+ return {
83
+ name: pluginName,
84
+ webpack: function webpack(compiler) {
85
+ compiler.hooks.afterEmit.tapAsync(pluginName, function (compilation, callback) {
86
+ var _compilation$outputOp;
87
+ var outputPath = (_compilation$outputOp = compilation.outputOptions.path) !== null && _compilation$outputOp !== void 0 ? _compilation$outputOp : path__namespace.resolve();
88
+ var buildArtifacts = Object.keys(compilation.assets).map(function (asset) {
89
+ return path__namespace.join(outputPath, asset);
90
+ });
91
+ void upload(buildArtifacts).then(function () {
92
+ callback();
93
+ });
94
+ });
95
+ }
96
+ };
97
+ }
63
98
  var sentryUnplugin = bundlerPluginCore.sentryUnpluginFactory({
64
99
  releaseInjectionPlugin: webpackReleaseInjectionPlugin,
65
- debugIdInjectionPlugin: webpackDebugIdInjectionPlugin
66
- }); // eslint-disable-next-line @typescript-eslint/no-explicit-any
100
+ debugIdInjectionPlugin: webpackDebugIdInjectionPlugin,
101
+ debugIdUploadPlugin: webpackDebugIdUploadPlugin
102
+ });
67
103
 
104
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
68
105
  var sentryWebpackPlugin = sentryUnplugin.webpack;
69
106
 
70
107
  Object.defineProperty(exports, 'sentryCliBinaryExists', {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { getDebugIdSnippet, Options, sentryUnpluginFactory } from \"@sentry/bundler-plugin-core\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore No typedefs for webpack 4\nimport { BannerPlugin as Webpack4BannerPlugin } from \"webpack-4\";\n\nfunction webpackReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n const pluginName = \"sentry-webpack-release-injection-plugin\";\n\n return {\n name: pluginName,\n\n webpack(compiler) {\n if (compiler?.webpack?.BannerPlugin) {\n compiler.options.plugins.push(\n new compiler.webpack.BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n } else {\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new Webpack4BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n }\n },\n };\n}\n\nfunction webpackDebugIdInjectionPlugin(): UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-injection-plugin\";\n\n return {\n name: pluginName,\n\n webpack(compiler) {\n if (compiler?.webpack?.BannerPlugin) {\n compiler.options.plugins.push(\n new compiler.webpack.BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: () => getDebugIdSnippet(uuidv4()),\n })\n );\n } else {\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new Webpack4BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: () => getDebugIdSnippet(uuidv4()),\n })\n );\n }\n },\n };\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n releaseInjectionPlugin: webpackReleaseInjectionPlugin,\n debugIdInjectionPlugin: webpackDebugIdInjectionPlugin,\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","pluginName","name","webpack","compiler","BannerPlugin","options","plugins","push","raw","include","banner","Webpack4BannerPlugin","webpackDebugIdInjectionPlugin","getDebugIdSnippet","uuidv4","sentryUnplugin","sentryUnpluginFactory","releaseInjectionPlugin","debugIdInjectionPlugin","sentryWebpackPlugin"],"mappings":";;;;;;;;AAQA,SAASA,6BAAT,CAAuCC,aAAvC,EAA+E;EAC7E,IAAMC,UAAU,GAAG,yCAAnB,CAAA;EAEA,OAAO;AACLC,IAAAA,IAAI,EAAED,UADD;IAGLE,OAHK,EAAA,SAAA,OAAA,CAGGC,QAHH,EAGa;AAAA,MAAA,IAAA,iBAAA,CAAA;;MAChB,IAAIA,QAAJ,KAAIA,IAAAA,IAAAA,QAAJ,KAAIA,KAAAA,CAAAA,IAAAA,CAAAA,iBAAAA,GAAAA,QAAQ,CAAED,OAAd,MAAA,IAAA,IAAA,iBAAA,KAAA,KAAA,CAAA,IAAI,iBAAmBE,CAAAA,YAAvB,EAAqC;AACnCD,QAAAA,QAAQ,CAACE,OAAT,CAAiBC,OAAjB,CAAyBC,IAAzB,CACE,IAAIJ,QAAQ,CAACD,OAAT,CAAiBE,YAArB,CAAkC;AAChCI,UAAAA,GAAG,EAAE,IAD2B;AAEhCC,UAAAA,OAAO,EAAE,4BAFuB;AAGhCC,UAAAA,MAAM,EAAEX,aAAAA;AAHwB,SAAlC,CADF,CAAA,CAAA;AAOD,OARD,MAQO;AACLI,QAAAA,QAAQ,CAACE,OAAT,CAAiBC,OAAjB,CAAyBC,IAAzB;AAEE,QAAA,IAAII,qBAAJ,CAAyB;AACvBH,UAAAA,GAAG,EAAE,IADkB;AAEvBC,UAAAA,OAAO,EAAE,4BAFc;AAGvBC,UAAAA,MAAM,EAAEX,aAAAA;AAHe,SAAzB,CAFF,CAAA,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AEnB,6BADmB;AAE3CoB,EAAAA,sBAAsB,EAAEN,6BAAAA;AAFmB,CAAD,CAA5C;;AAMaO,IAAAA,mBAA8C,GAAGJ,cAAc,CAACb;;;;;;;;"}
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 No typedefs for webpack 4\nimport { BannerPlugin as Webpack4BannerPlugin } from \"webpack-4\";\n\nfunction webpackReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n return {\n name: \"sentry-webpack-release-injection-plugin\",\n webpack(compiler) {\n if (compiler?.webpack?.BannerPlugin) {\n compiler.options.plugins.push(\n new compiler.webpack.BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n } else {\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new Webpack4BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n }\n },\n };\n}\n\nfunction webpackDebugIdInjectionPlugin(): UnpluginOptions {\n return {\n name: \"sentry-webpack-debug-id-injection-plugin\",\n webpack(compiler) {\n if (compiler?.webpack?.BannerPlugin) {\n compiler.options.plugins.push(\n new compiler.webpack.BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: () => getDebugIdSnippet(uuidv4()),\n })\n );\n } else {\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new Webpack4BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: () => getDebugIdSnippet(uuidv4()),\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) => {\n const outputPath = compilation.outputOptions.path ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets).map((asset) =>\n 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","options","plugins","push","raw","include","banner","Webpack4BannerPlugin","webpackDebugIdInjectionPlugin","_compiler$webpack2","getDebugIdSnippet","uuidv4","webpackDebugIdUploadPlugin","upload","pluginName","hooks","afterEmit","tapAsync","compilation","callback","_compilation$outputOp","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,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C,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,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,15 +1,14 @@
1
1
  import { sentryUnpluginFactory, getDebugIdSnippet } from '@sentry/bundler-plugin-core';
2
2
  export { sentryCliBinaryExists } from '@sentry/bundler-plugin-core';
3
+ import * as path from 'path';
3
4
  import { v4 } from 'uuid';
4
5
  import { BannerPlugin } from 'webpack-4';
5
6
 
6
7
  function webpackReleaseInjectionPlugin(injectionCode) {
7
- var pluginName = "sentry-webpack-release-injection-plugin";
8
8
  return {
9
- name: pluginName,
9
+ name: "sentry-webpack-release-injection-plugin",
10
10
  webpack: function webpack(compiler) {
11
11
  var _compiler$webpack;
12
-
13
12
  if (compiler !== null && compiler !== void 0 && (_compiler$webpack = compiler.webpack) !== null && _compiler$webpack !== void 0 && _compiler$webpack.BannerPlugin) {
14
13
  compiler.options.plugins.push(new compiler.webpack.BannerPlugin({
15
14
  raw: true,
@@ -17,7 +16,8 @@ function webpackReleaseInjectionPlugin(injectionCode) {
17
16
  banner: injectionCode
18
17
  }));
19
18
  } else {
20
- compiler.options.plugins.push( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
19
+ compiler.options.plugins.push(
20
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
21
21
  new BannerPlugin({
22
22
  raw: true,
23
23
  include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
@@ -27,14 +27,11 @@ function webpackReleaseInjectionPlugin(injectionCode) {
27
27
  }
28
28
  };
29
29
  }
30
-
31
30
  function webpackDebugIdInjectionPlugin() {
32
- var pluginName = "sentry-webpack-debug-id-injection-plugin";
33
31
  return {
34
- name: pluginName,
32
+ name: "sentry-webpack-debug-id-injection-plugin",
35
33
  webpack: function webpack(compiler) {
36
34
  var _compiler$webpack2;
37
-
38
35
  if (compiler !== null && compiler !== void 0 && (_compiler$webpack2 = compiler.webpack) !== null && _compiler$webpack2 !== void 0 && _compiler$webpack2.BannerPlugin) {
39
36
  compiler.options.plugins.push(new compiler.webpack.BannerPlugin({
40
37
  raw: true,
@@ -44,7 +41,8 @@ function webpackDebugIdInjectionPlugin() {
44
41
  }
45
42
  }));
46
43
  } else {
47
- compiler.options.plugins.push( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
44
+ compiler.options.plugins.push(
45
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
48
46
  new BannerPlugin({
49
47
  raw: true,
50
48
  include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
@@ -56,12 +54,31 @@ function webpackDebugIdInjectionPlugin() {
56
54
  }
57
55
  };
58
56
  }
59
-
57
+ function webpackDebugIdUploadPlugin(upload) {
58
+ var pluginName = "sentry-webpack-debug-id-upload-plugin";
59
+ return {
60
+ name: pluginName,
61
+ webpack: function webpack(compiler) {
62
+ compiler.hooks.afterEmit.tapAsync(pluginName, function (compilation, callback) {
63
+ var _compilation$outputOp;
64
+ var outputPath = (_compilation$outputOp = compilation.outputOptions.path) !== null && _compilation$outputOp !== void 0 ? _compilation$outputOp : path.resolve();
65
+ var buildArtifacts = Object.keys(compilation.assets).map(function (asset) {
66
+ return path.join(outputPath, asset);
67
+ });
68
+ void upload(buildArtifacts).then(function () {
69
+ callback();
70
+ });
71
+ });
72
+ }
73
+ };
74
+ }
60
75
  var sentryUnplugin = sentryUnpluginFactory({
61
76
  releaseInjectionPlugin: webpackReleaseInjectionPlugin,
62
- debugIdInjectionPlugin: webpackDebugIdInjectionPlugin
63
- }); // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
+ debugIdInjectionPlugin: webpackDebugIdInjectionPlugin,
78
+ debugIdUploadPlugin: webpackDebugIdUploadPlugin
79
+ });
64
80
 
81
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
82
  var sentryWebpackPlugin = sentryUnplugin.webpack;
66
83
 
67
84
  export { sentryWebpackPlugin };
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"sourcesContent":["import { getDebugIdSnippet, Options, sentryUnpluginFactory } from \"@sentry/bundler-plugin-core\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore No typedefs for webpack 4\nimport { BannerPlugin as Webpack4BannerPlugin } from \"webpack-4\";\n\nfunction webpackReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n const pluginName = \"sentry-webpack-release-injection-plugin\";\n\n return {\n name: pluginName,\n\n webpack(compiler) {\n if (compiler?.webpack?.BannerPlugin) {\n compiler.options.plugins.push(\n new compiler.webpack.BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n } else {\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new Webpack4BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n }\n },\n };\n}\n\nfunction webpackDebugIdInjectionPlugin(): UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-injection-plugin\";\n\n return {\n name: pluginName,\n\n webpack(compiler) {\n if (compiler?.webpack?.BannerPlugin) {\n compiler.options.plugins.push(\n new compiler.webpack.BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: () => getDebugIdSnippet(uuidv4()),\n })\n );\n } else {\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new Webpack4BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: () => getDebugIdSnippet(uuidv4()),\n })\n );\n }\n },\n };\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n releaseInjectionPlugin: webpackReleaseInjectionPlugin,\n debugIdInjectionPlugin: webpackDebugIdInjectionPlugin,\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","pluginName","name","webpack","compiler","BannerPlugin","options","plugins","push","raw","include","banner","Webpack4BannerPlugin","webpackDebugIdInjectionPlugin","getDebugIdSnippet","uuidv4","sentryUnplugin","sentryUnpluginFactory","releaseInjectionPlugin","debugIdInjectionPlugin","sentryWebpackPlugin"],"mappings":";;;;;AAQA,SAASA,6BAAT,CAAuCC,aAAvC,EAA+E;EAC7E,IAAMC,UAAU,GAAG,yCAAnB,CAAA;EAEA,OAAO;AACLC,IAAAA,IAAI,EAAED,UADD;IAGLE,OAHK,EAAA,SAAA,OAAA,CAGGC,QAHH,EAGa;AAAA,MAAA,IAAA,iBAAA,CAAA;;MAChB,IAAIA,QAAJ,KAAIA,IAAAA,IAAAA,QAAJ,KAAIA,KAAAA,CAAAA,IAAAA,CAAAA,iBAAAA,GAAAA,QAAQ,CAAED,OAAd,MAAA,IAAA,IAAA,iBAAA,KAAA,KAAA,CAAA,IAAI,iBAAmBE,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AACC,EAAM,EAAP,CAAvB,CAAA;AAAA,WAAA;AAHwB,SAAlC,CADF,CAAA,CAAA;AAOD,OARD,MAQO;AACLX,QAAAA,QAAQ,CAACE,OAAT,CAAiBC,OAAjB,CAAyBC,IAAzB;AAEE,QAAA,IAAII,YAAJ,CAAyB;AACvBH,UAAAA,GAAG,EAAE,IADkB;AAEvBC,UAAAA,OAAO,EAAE,4BAFc;AAGvBC,UAAAA,MAAM,EAAE,SAAA,MAAA,GAAA;AAAA,YAAA,OAAMG,iBAAiB,CAACC,EAAM,EAAP,CAAvB,CAAA;AAAA,WAAA;AAHe,SAAzB,CAFF,CAAA,CAAA;AAQD,OAAA;AACF,KAAA;GAtBH,CAAA;AAwBD,CAAA;;AAED,IAAMC,cAAc,GAAGC,qBAAqB,CAAC;AAC3CC,EAAAA,sBAAsB,EAAEnB,6BADmB;AAE3CoB,EAAAA,sBAAsB,EAAEN,6BAAAA;AAFmB,CAAD,CAA5C;;AAMaO,IAAAA,mBAA8C,GAAGJ,cAAc,CAACb;;;;"}
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 No typedefs for webpack 4\nimport { BannerPlugin as Webpack4BannerPlugin } from \"webpack-4\";\n\nfunction webpackReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n return {\n name: \"sentry-webpack-release-injection-plugin\",\n webpack(compiler) {\n if (compiler?.webpack?.BannerPlugin) {\n compiler.options.plugins.push(\n new compiler.webpack.BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n } else {\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new Webpack4BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: injectionCode,\n })\n );\n }\n },\n };\n}\n\nfunction webpackDebugIdInjectionPlugin(): UnpluginOptions {\n return {\n name: \"sentry-webpack-debug-id-injection-plugin\",\n webpack(compiler) {\n if (compiler?.webpack?.BannerPlugin) {\n compiler.options.plugins.push(\n new compiler.webpack.BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: () => getDebugIdSnippet(uuidv4()),\n })\n );\n } else {\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new Webpack4BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)$/,\n banner: () => getDebugIdSnippet(uuidv4()),\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) => {\n const outputPath = compilation.outputOptions.path ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets).map((asset) =>\n 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","options","plugins","push","raw","include","banner","Webpack4BannerPlugin","webpackDebugIdInjectionPlugin","_compiler$webpack2","getDebugIdSnippet","uuidv4","webpackDebugIdUploadPlugin","upload","pluginName","hooks","afterEmit","tapAsync","compilation","callback","_compilation$outputOp","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,MAAA,IAAID,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,KAAA,CAAA,IAAA,CAAAC,iBAAA,GAARD,QAAQ,CAAED,OAAO,cAAAE,iBAAA,KAAA,KAAA,CAAA,IAAjBA,iBAAA,CAAmBC,YAAY,EAAE;AACnCF,QAAAA,QAAQ,CAACG,OAAO,CAACC,OAAO,CAACC,IAAI,CAC3B,IAAIL,QAAQ,CAACD,OAAO,CAACG,YAAY,CAAC;AAChCI,UAAAA,GAAG,EAAE,IAAI;AACTC,UAAAA,OAAO,EAAE,4BAA4B;AACrCC,UAAAA,MAAM,EAAEX,aAAAA;AACV,SAAC,CACH,CAAC,CAAA;AACH,OAAC,MAAM;AACLG,QAAAA,QAAQ,CAACG,OAAO,CAACC,OAAO,CAACC,IAAI;AAC3B;AACA,QAAA,IAAII,YAAoB,CAAC;AACvBH,UAAAA,GAAG,EAAE,IAAI;AACTC,UAAAA,OAAO,EAAE,4BAA4B;AACrCC,UAAAA,MAAM,EAAEX,aAAAA;AACV,SAAC,CACH,CAAC,CAAA;AACH,OAAA;AACF,KAAA;GACD,CAAA;AACH,CAAA;A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AK,CAACC,SAAS,CAACC,QAAQ,CAACH,UAAU,EAAE,UAACI,WAAW,EAAEC,QAAQ,EAAK;AAAA,QAAA,IAAAC,qBAAA,CAAA;AACvE,QAAA,IAAMC,UAAU,GAAAD,CAAAA,qBAAA,GAAGF,WAAW,CAACI,aAAa,CAACC,IAAI,MAAAH,IAAAA,IAAAA,qBAAA,cAAAA,qBAAA,GAAIG,IAAI,CAACC,OAAO,EAAE,CAAA;AACnE,QAAA,IAAMC,cAAc,GAAGC,MAAM,CAACC,IAAI,CAACT,WAAW,CAACU,MAAM,CAAC,CAACC,GAAG,CAAC,UAACC,KAAK,EAAA;AAAA,UAAA,OAC/DP,IAAI,CAACQ,IAAI,CAACV,UAAU,EAAES,KAAK,CAAC,CAAA;AAAA,SAC9B,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;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/webpack-plugin",
3
- "version": "2.0.0-alpha.7",
3
+ "version": "2.1.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.0.0-alpha.7",
51
+ "@sentry/bundler-plugin-core": "2.1.0",
52
52
  "unplugin": "1.0.1",
53
53
  "uuid": "^9.0.0",
54
54
  "webpack-4": "npm:webpack@^4"
@@ -59,8 +59,8 @@
59
59
  "@babel/preset-typescript": "7.17.12",
60
60
  "@rollup/plugin-babel": "5.3.1",
61
61
  "@rollup/plugin-commonjs": "22.0.1",
62
- "@sentry-internal/eslint-config": "2.0.0-alpha.7",
63
- "@sentry-internal/sentry-bundler-plugin-tsconfig": "2.0.0-alpha.7",
62
+ "@sentry-internal/eslint-config": "2.1.0",
63
+ "@sentry-internal/sentry-bundler-plugin-tsconfig": "2.1.0",
64
64
  "@swc/core": "^1.2.205",
65
65
  "@swc/jest": "^0.2.21",
66
66
  "@types/jest": "^28.1.3",