@sentry/esbuild-plugin 2.2.1 → 2.3.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 +69 -69
- package/dist/cjs/index.js +27 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +27 -13
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -56,42 +56,42 @@ require("esbuild").build({
|
|
|
56
56
|
|
|
57
57
|
## Options
|
|
58
58
|
|
|
59
|
-
- [`org`](#
|
|
60
|
-
- [`project`](#
|
|
61
|
-
- [`authToken`](#
|
|
62
|
-
- [`url`](#
|
|
63
|
-
- [`headers`](#
|
|
64
|
-
- [`debug`](#
|
|
65
|
-
- [`silent`](#
|
|
66
|
-
- [`errorHandler`](#
|
|
67
|
-
- [`telemetry`](#
|
|
68
|
-
- [`disable`](#
|
|
69
|
-
- [`sourcemaps`](#
|
|
70
|
-
- [`assets`](#
|
|
71
|
-
- [`ignore`](#
|
|
72
|
-
- [`rewriteSources`](#
|
|
73
|
-
- [`
|
|
74
|
-
- [`release`](#
|
|
75
|
-
- [`name`](#
|
|
76
|
-
- [`inject`](#
|
|
77
|
-
- [`create`](#
|
|
78
|
-
- [`finalize`](#
|
|
79
|
-
- [`dist`](#
|
|
80
|
-
- [`vcsRemote`](#
|
|
81
|
-
- [`setCommits`](#
|
|
82
|
-
- [`deploy`](#
|
|
83
|
-
- [`cleanArtifacts`](#
|
|
84
|
-
- [`uploadLegacySourcemaps`](#
|
|
85
|
-
- [`_experiments`](#
|
|
86
|
-
- [`injectBuildInformation`](#
|
|
87
|
-
|
|
88
|
-
###
|
|
59
|
+
- [`org`](#optionorg)
|
|
60
|
+
- [`project`](#optionproject)
|
|
61
|
+
- [`authToken`](#optionauthtoken)
|
|
62
|
+
- [`url`](#optionurl)
|
|
63
|
+
- [`headers`](#optionheaders)
|
|
64
|
+
- [`debug`](#optiondebug)
|
|
65
|
+
- [`silent`](#optionsilent)
|
|
66
|
+
- [`errorHandler`](#optionerrorhandler)
|
|
67
|
+
- [`telemetry`](#optiontelemetry)
|
|
68
|
+
- [`disable`](#optiondisable)
|
|
69
|
+
- [`sourcemaps`](#optionsourcemaps)
|
|
70
|
+
- [`assets`](#optionsourcemapsassets)
|
|
71
|
+
- [`ignore`](#optionsourcemapsignore)
|
|
72
|
+
- [`rewriteSources`](#optionsourcemapsrewritesources)
|
|
73
|
+
- [`filesToDeleteAfterUpload`](#optionsourcemapsfilestodeleteafterupload)
|
|
74
|
+
- [`release`](#optionrelease)
|
|
75
|
+
- [`name`](#optionreleasename)
|
|
76
|
+
- [`inject`](#optionreleaseinject)
|
|
77
|
+
- [`create`](#optionreleasecreate)
|
|
78
|
+
- [`finalize`](#optionreleasefinalize)
|
|
79
|
+
- [`dist`](#optionreleasedist)
|
|
80
|
+
- [`vcsRemote`](#optionreleasevcsremote)
|
|
81
|
+
- [`setCommits`](#optionreleasesetcommits)
|
|
82
|
+
- [`deploy`](#optionreleasedeploy)
|
|
83
|
+
- [`cleanArtifacts`](#optionreleasecleanartifacts)
|
|
84
|
+
- [`uploadLegacySourcemaps`](#optionreleaseuploadlegacysourcemaps)
|
|
85
|
+
- [`_experiments`](#option_experiments)
|
|
86
|
+
- [`injectBuildInformation`](#option_experimentsinjectbuildinformation)
|
|
87
|
+
|
|
88
|
+
### `org`
|
|
89
89
|
|
|
90
90
|
Type: `string`
|
|
91
91
|
|
|
92
92
|
The slug of the Sentry organization associated with the app.
|
|
93
93
|
|
|
94
|
-
###
|
|
94
|
+
### `project`
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
|
|
@@ -99,7 +99,7 @@ The slug of the Sentry project associated with the app.
|
|
|
99
99
|
|
|
100
100
|
This value can also be specified via the `SENTRY_PROJECT` environment variable.
|
|
101
101
|
|
|
102
|
-
###
|
|
102
|
+
### `authToken`
|
|
103
103
|
|
|
104
104
|
Type: `string`
|
|
105
105
|
|
|
@@ -107,7 +107,7 @@ The authentication token to use for all communication with Sentry. Can be obtain
|
|
|
107
107
|
|
|
108
108
|
This value can also be specified via the `SENTRY_AUTH_TOKEN` environment variable.
|
|
109
109
|
|
|
110
|
-
###
|
|
110
|
+
### `url`
|
|
111
111
|
|
|
112
112
|
Type: `string`
|
|
113
113
|
|
|
@@ -117,25 +117,25 @@ This value can also be set via the SENTRY_URL environment variable.
|
|
|
117
117
|
|
|
118
118
|
Defaults to https://sentry.io/, which is the correct value for SaaS customers.
|
|
119
119
|
|
|
120
|
-
###
|
|
120
|
+
### `headers`
|
|
121
121
|
|
|
122
122
|
Type: `Record<string, string>`
|
|
123
123
|
|
|
124
124
|
Headers added to every outgoing network request.
|
|
125
125
|
|
|
126
|
-
###
|
|
126
|
+
### `debug`
|
|
127
127
|
|
|
128
128
|
Type: `boolean`
|
|
129
129
|
|
|
130
130
|
Print useful debug information. Defaults to `false`.
|
|
131
131
|
|
|
132
|
-
###
|
|
132
|
+
### `silent`
|
|
133
133
|
|
|
134
134
|
Type: `boolean`
|
|
135
135
|
|
|
136
136
|
Suppresses all logs. Defaults to `false`.
|
|
137
137
|
|
|
138
|
-
###
|
|
138
|
+
### `errorHandler`
|
|
139
139
|
|
|
140
140
|
Type: `(err: Error) => void`
|
|
141
141
|
|
|
@@ -152,7 +152,7 @@ errorHandler: (err) => {
|
|
|
152
152
|
```
|
|
153
153
|
|
|
154
154
|
|
|
155
|
-
###
|
|
155
|
+
### `telemetry`
|
|
156
156
|
|
|
157
157
|
Type: `boolean`
|
|
158
158
|
|
|
@@ -162,18 +162,18 @@ At Sentry we like to use Sentry ourselves to deliver faster and more stable prod
|
|
|
162
162
|
|
|
163
163
|
Defaults to `true`.
|
|
164
164
|
|
|
165
|
-
###
|
|
165
|
+
### `disable`
|
|
166
166
|
|
|
167
167
|
Type: `boolean`
|
|
168
168
|
|
|
169
169
|
Completely disables all functionality of the plugin. Defaults to `false`.
|
|
170
170
|
|
|
171
|
-
###
|
|
171
|
+
### `sourcemaps`
|
|
172
172
|
|
|
173
173
|
|
|
174
174
|
|
|
175
175
|
Options for source maps uploading. Leave this option undefined if you do not want to upload source maps to Sentry.
|
|
176
|
-
###
|
|
176
|
+
### `sourcemaps.assets`
|
|
177
177
|
|
|
178
178
|
Type: `string | string[]`
|
|
179
179
|
|
|
@@ -185,7 +185,7 @@ The globbing patterns follow the implementation of the `glob` package. (https://
|
|
|
185
185
|
|
|
186
186
|
Use the `debug` option to print information about which files end up being uploaded.
|
|
187
187
|
|
|
188
|
-
###
|
|
188
|
+
### `sourcemaps.ignore`
|
|
189
189
|
|
|
190
190
|
Type: `string | string[]`
|
|
191
191
|
|
|
@@ -197,7 +197,7 @@ The globbing patterns follow the implementation of the `glob` package. (https://
|
|
|
197
197
|
|
|
198
198
|
Use the `debug` option to print information about which files end up being uploaded.
|
|
199
199
|
|
|
200
|
-
###
|
|
200
|
+
### `sourcemaps.rewriteSources`
|
|
201
201
|
|
|
202
202
|
Type: `(source: string, map: any) => string`
|
|
203
203
|
|
|
@@ -205,7 +205,7 @@ Hook to rewrite the `sources` field inside the source map before being uploaded
|
|
|
205
205
|
|
|
206
206
|
Defaults to making all sources relative to `process.cwd()` while building.
|
|
207
207
|
|
|
208
|
-
###
|
|
208
|
+
### `sourcemaps.filesToDeleteAfterUpload`
|
|
209
209
|
|
|
210
210
|
Type: `string | string[]`
|
|
211
211
|
|
|
@@ -215,14 +215,14 @@ The globbing patterns follow the implementation of the `glob` package. (https://
|
|
|
215
215
|
|
|
216
216
|
Use the `debug` option to print information about which files end up being deleted.
|
|
217
217
|
|
|
218
|
-
###
|
|
218
|
+
### `release`
|
|
219
219
|
|
|
220
220
|
|
|
221
221
|
|
|
222
222
|
Options related to managing the Sentry releases for a build.
|
|
223
223
|
|
|
224
224
|
More info: https://docs.sentry.io/product/releases/
|
|
225
|
-
###
|
|
225
|
+
### `release.name`
|
|
226
226
|
|
|
227
227
|
Type: `string`
|
|
228
228
|
|
|
@@ -234,7 +234,7 @@ Defaults to automatically detecting a value for your environment. This includes
|
|
|
234
234
|
|
|
235
235
|
If you didn't provide a value and the plugin can't automatically detect one, no release will be created.
|
|
236
236
|
|
|
237
|
-
###
|
|
237
|
+
### `release.inject`
|
|
238
238
|
|
|
239
239
|
Type: `boolean`
|
|
240
240
|
|
|
@@ -242,7 +242,7 @@ Whether the plugin should inject release information into the build for the SDK
|
|
|
242
242
|
|
|
243
243
|
Defaults to `true`.
|
|
244
244
|
|
|
245
|
-
###
|
|
245
|
+
### `release.create`
|
|
246
246
|
|
|
247
247
|
Type: `boolean`
|
|
248
248
|
|
|
@@ -250,7 +250,7 @@ Whether the plugin should create a release on Sentry during the build. Note that
|
|
|
250
250
|
|
|
251
251
|
Defaults to `true`.
|
|
252
252
|
|
|
253
|
-
###
|
|
253
|
+
### `release.finalize`
|
|
254
254
|
|
|
255
255
|
Type: `boolean`
|
|
256
256
|
|
|
@@ -258,13 +258,13 @@ Whether the Sentry release should be automatically finalized (meaning an end tim
|
|
|
258
258
|
|
|
259
259
|
Defaults to `true`.
|
|
260
260
|
|
|
261
|
-
###
|
|
261
|
+
### `release.dist`
|
|
262
262
|
|
|
263
263
|
Type: `string`
|
|
264
264
|
|
|
265
265
|
Unique identifier for the distribution, used to further segment your release.
|
|
266
266
|
|
|
267
|
-
###
|
|
267
|
+
### `release.vcsRemote`
|
|
268
268
|
|
|
269
269
|
Type: `string`
|
|
270
270
|
|
|
@@ -274,12 +274,12 @@ This value can also be specified via the `SENTRY_VSC_REMOTE` environment variabl
|
|
|
274
274
|
|
|
275
275
|
Defaults to 'origin'.
|
|
276
276
|
|
|
277
|
-
###
|
|
277
|
+
### `release.setCommits`
|
|
278
278
|
|
|
279
279
|
|
|
280
280
|
|
|
281
281
|
Option to associate the created release with its commits in Sentry.
|
|
282
|
-
###
|
|
282
|
+
### `release.setCommits.previousCommit`
|
|
283
283
|
|
|
284
284
|
Type: `string`
|
|
285
285
|
|
|
@@ -289,7 +289,7 @@ Defaults to the last commit of the previous release in Sentry.
|
|
|
289
289
|
|
|
290
290
|
If there was no previous release, the last 10 commits will be used.
|
|
291
291
|
|
|
292
|
-
###
|
|
292
|
+
### `release.setCommits.ignoreMissing`
|
|
293
293
|
|
|
294
294
|
Type: `boolean`
|
|
295
295
|
|
|
@@ -297,7 +297,7 @@ If the flag is to `true` and the previous release commit was not found in the re
|
|
|
297
297
|
|
|
298
298
|
Defaults to `false`.
|
|
299
299
|
|
|
300
|
-
###
|
|
300
|
+
### `release.setCommits.ignoreEmpty`
|
|
301
301
|
|
|
302
302
|
Type: `boolean`
|
|
303
303
|
|
|
@@ -305,7 +305,7 @@ If this flag is set, the setCommits step will not fail and just exit silently if
|
|
|
305
305
|
|
|
306
306
|
Defaults to `false`.
|
|
307
307
|
|
|
308
|
-
###
|
|
308
|
+
### `release.setCommits.auto`
|
|
309
309
|
|
|
310
310
|
Type: `boolean`
|
|
311
311
|
|
|
@@ -313,7 +313,7 @@ Automatically sets `commit` and `previousCommit`. Sets `commit` to `HEAD` and `p
|
|
|
313
313
|
|
|
314
314
|
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`.
|
|
315
315
|
|
|
316
|
-
###
|
|
316
|
+
### `release.setCommits.repo`
|
|
317
317
|
|
|
318
318
|
Type: `string`
|
|
319
319
|
|
|
@@ -321,7 +321,7 @@ The full repo name as defined in Sentry.
|
|
|
321
321
|
|
|
322
322
|
Required if the `auto` option is not set to `true`.
|
|
323
323
|
|
|
324
|
-
###
|
|
324
|
+
### `release.setCommits.commit`
|
|
325
325
|
|
|
326
326
|
Type: `string`
|
|
327
327
|
|
|
@@ -329,48 +329,48 @@ The current (last) commit in the release.
|
|
|
329
329
|
|
|
330
330
|
Required if the `auto` option is not set to `true`.
|
|
331
331
|
|
|
332
|
-
###
|
|
332
|
+
### `release.deploy`
|
|
333
333
|
|
|
334
334
|
|
|
335
335
|
|
|
336
336
|
Adds deployment information to the release in Sentry.
|
|
337
|
-
###
|
|
337
|
+
### `release.deploy.env`
|
|
338
338
|
|
|
339
339
|
Type: `string`
|
|
340
340
|
|
|
341
341
|
Environment for this release. Values that make sense here would be `production` or `staging`.
|
|
342
342
|
|
|
343
|
-
###
|
|
343
|
+
### `release.deploy.started`
|
|
344
344
|
|
|
345
345
|
Type: `number | string`
|
|
346
346
|
|
|
347
347
|
Deployment start time in Unix timestamp (in seconds) or ISO 8601 format.
|
|
348
348
|
|
|
349
|
-
###
|
|
349
|
+
### `release.deploy.finished`
|
|
350
350
|
|
|
351
351
|
Type: `number | string`
|
|
352
352
|
|
|
353
353
|
Deployment finish time in Unix timestamp (in seconds) or ISO 8601 format.
|
|
354
354
|
|
|
355
|
-
###
|
|
355
|
+
### `release.deploy.time`
|
|
356
356
|
|
|
357
357
|
Type: `number`
|
|
358
358
|
|
|
359
359
|
Deployment duration (in seconds). Can be used instead of started and finished.
|
|
360
360
|
|
|
361
|
-
###
|
|
361
|
+
### `release.deploy.name`
|
|
362
362
|
|
|
363
363
|
Type: `string`
|
|
364
364
|
|
|
365
365
|
Human readable name for the deployment.
|
|
366
366
|
|
|
367
|
-
###
|
|
367
|
+
### `release.deploy.url`
|
|
368
368
|
|
|
369
369
|
Type: `string`
|
|
370
370
|
|
|
371
371
|
URL that points to the deployment.
|
|
372
372
|
|
|
373
|
-
###
|
|
373
|
+
### `release.cleanArtifacts`
|
|
374
374
|
|
|
375
375
|
Type: `boolean`
|
|
376
376
|
|
|
@@ -378,7 +378,7 @@ Remove all previously uploaded artifacts for this release on Sentry before the u
|
|
|
378
378
|
|
|
379
379
|
Defaults to `false`.
|
|
380
380
|
|
|
381
|
-
###
|
|
381
|
+
### `release.uploadLegacySourcemaps`
|
|
382
382
|
|
|
383
383
|
Type: `string | IncludeEntry | Array<string | IncludeEntry>`
|
|
384
384
|
|
|
@@ -478,12 +478,12 @@ type IncludeEntry = {
|
|
|
478
478
|
|
|
479
479
|
|
|
480
480
|
|
|
481
|
-
###
|
|
481
|
+
### `_experiments`
|
|
482
482
|
|
|
483
483
|
Type: `string`
|
|
484
484
|
|
|
485
485
|
Options that are considered experimental and subject to change. This option does not follow semantic versioning and may change in any release.
|
|
486
|
-
###
|
|
486
|
+
### `_experiments.injectBuildInformation`
|
|
487
487
|
|
|
488
488
|
Type: `boolean`
|
|
489
489
|
|
package/dist/cjs/index.js
CHANGED
|
@@ -395,7 +395,6 @@ function esbuildReleaseInjectionPlugin(injectionCode) {
|
|
|
395
395
|
}
|
|
396
396
|
function esbuildDebugIdInjectionPlugin() {
|
|
397
397
|
var pluginName = "sentry-esbuild-debug-id-injection-plugin";
|
|
398
|
-
var proxyNamespace = "sentry-debug-id-proxy";
|
|
399
398
|
var stubNamespace = "sentry-debug-id-stub";
|
|
400
399
|
return {
|
|
401
400
|
name: pluginName,
|
|
@@ -408,21 +407,35 @@ function esbuildDebugIdInjectionPlugin() {
|
|
|
408
407
|
}, function (args) {
|
|
409
408
|
if (args.kind !== "entry-point") {
|
|
410
409
|
return;
|
|
410
|
+
} else {
|
|
411
|
+
return {
|
|
412
|
+
pluginName: pluginName,
|
|
413
|
+
// needs to be an abs path, otherwise esbuild will complain
|
|
414
|
+
path: path__namespace.isAbsolute(args.path) ? args.path : path__namespace.join(args.resolveDir, args.path),
|
|
415
|
+
pluginData: {
|
|
416
|
+
isProxyResolver: true,
|
|
417
|
+
originalPath: args.path,
|
|
418
|
+
originalResolveDir: args.resolveDir
|
|
419
|
+
},
|
|
420
|
+
// We need to add a suffix here, otherwise esbuild will mark the entrypoint as resolved and won't traverse
|
|
421
|
+
// the module tree any further down past the proxy module because we're essentially creating a dependency
|
|
422
|
+
// loop back to the proxy module.
|
|
423
|
+
// By setting a suffix we're telling esbuild that the entrypoint and proxy module are two different things,
|
|
424
|
+
// making it re-resolve the entrypoint when it is imported from the proxy module.
|
|
425
|
+
// Super confusing? Yes. Works? Apparently... Let's see.
|
|
426
|
+
suffix: "?sentryProxyModule=true"
|
|
427
|
+
};
|
|
411
428
|
}
|
|
412
|
-
return {
|
|
413
|
-
pluginName: pluginName,
|
|
414
|
-
path: args.path,
|
|
415
|
-
namespace: proxyNamespace,
|
|
416
|
-
pluginData: {
|
|
417
|
-
originalPath: args.path,
|
|
418
|
-
originalResolveDir: args.resolveDir
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
429
|
});
|
|
422
430
|
onLoad({
|
|
423
|
-
filter:
|
|
424
|
-
namespace: proxyNamespace
|
|
431
|
+
filter: /.*/
|
|
425
432
|
}, function (args) {
|
|
433
|
+
var _args$pluginData;
|
|
434
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
435
|
+
if (!((_args$pluginData = args.pluginData) !== null && _args$pluginData !== void 0 && _args$pluginData.isProxyResolver)) {
|
|
436
|
+
return null;
|
|
437
|
+
}
|
|
438
|
+
|
|
426
439
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
427
440
|
var originalPath = args.pluginData.originalPath;
|
|
428
441
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
@@ -430,7 +443,8 @@ function esbuildDebugIdInjectionPlugin() {
|
|
|
430
443
|
return {
|
|
431
444
|
loader: "js",
|
|
432
445
|
pluginName: pluginName,
|
|
433
|
-
|
|
446
|
+
// We need to use JSON.stringify below so that any escape backslashes stay escape backslashes, in order not to break paths on windows
|
|
447
|
+
contents: "\n import \"_sentry-debug-id-injection-stub\";\n import * as OriginalModule from ".concat(JSON.stringify(originalPath), ";\n export default OriginalModule.default;\n export * from ").concat(JSON.stringify(originalPath), ";"),
|
|
434
448
|
resolveDir: originalResolveDir
|
|
435
449
|
};
|
|
436
450
|
});
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { sentryUnpluginFactory, Options, getDebugIdSnippet } from \"@sentry/bundler-plugin-core\";\nimport type { UnpluginOptions } from \"unplugin\";\nimport * as path from \"path\";\n\nimport { v4 as uuidv4 } from \"uuid\";\n\nfunction esbuildReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n const pluginName = \"sentry-esbuild-release-injection-plugin\";\n const virtualReleaseInjectionFilePath = path.resolve(\"_sentry-release-injection-stub\"); // needs to be an absolute path for older eslint versions\n\n return {\n name: pluginName,\n\n esbuild: {\n setup({ initialOptions, onLoad, onResolve }) {\n initialOptions.inject = initialOptions.inject || [];\n initialOptions.inject.push(virtualReleaseInjectionFilePath);\n\n onResolve({ filter: /_sentry-release-injection-stub/ }, (args) => {\n return {\n path: args.path,\n sideEffects: true,\n pluginName,\n };\n });\n\n onLoad({ filter: /_sentry-release-injection-stub/ }, () => {\n return {\n loader: \"js\",\n pluginName,\n contents: injectionCode,\n };\n });\n },\n },\n };\n}\n\nfunction esbuildDebugIdInjectionPlugin(): UnpluginOptions {\n const pluginName = \"sentry-esbuild-debug-id-injection-plugin\";\n const proxyNamespace = \"sentry-debug-id-proxy\";\n const stubNamespace = \"sentry-debug-id-stub\";\n\n return {\n name: pluginName,\n\n esbuild: {\n setup({ onLoad, onResolve }) {\n onResolve({ filter: /.*/ }, (args) => {\n if (args.kind !== \"entry-point\") {\n return;\n }\n return {\n pluginName,\n path: args.path,\n namespace: proxyNamespace,\n pluginData: {\n originalPath: args.path,\n originalResolveDir: args.resolveDir,\n },\n };\n });\n\n onLoad({ filter: /.*/, namespace: proxyNamespace }, (args) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const originalPath = args.pluginData.originalPath as string;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const originalResolveDir = args.pluginData.originalResolveDir as string;\n return {\n loader: \"js\",\n pluginName,\n contents: `\n import \"_sentry-debug-id-injection-stub\";\n import * as OriginalModule from \"${originalPath}\";\n export default OriginalModule.default;\n export * from \"${originalPath}\";`,\n resolveDir: originalResolveDir,\n };\n });\n\n onResolve({ filter: /_sentry-debug-id-injection-stub/ }, (args) => {\n return {\n path: args.path,\n sideEffects: true,\n pluginName,\n namespace: stubNamespace,\n suffix: \"?sentry-module-id=\" + uuidv4(), // create different module, each time this is resolved\n };\n });\n\n onLoad({ filter: /_sentry-debug-id-injection-stub/, namespace: stubNamespace }, () => {\n return {\n loader: \"js\",\n pluginName,\n contents: getDebugIdSnippet(uuidv4()),\n };\n });\n },\n },\n };\n}\n\nfunction esbuildDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>\n): UnpluginOptions {\n return {\n name: \"sentry-esbuild-debug-id-upload-plugin\",\n esbuild: {\n setup({ initialOptions, onEnd }) {\n initialOptions.metafile = true;\n onEnd(async (result) => {\n const buildArtifacts = result.metafile ? Object.keys(result.metafile.outputs) : [];\n await upload(buildArtifacts);\n });\n },\n },\n };\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n releaseInjectionPlugin: esbuildReleaseInjectionPlugin,\n debugIdInjectionPlugin: esbuildDebugIdInjectionPlugin,\n debugIdUploadPlugin: esbuildDebugIdUploadPlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryEsbuildPlugin: (options: Options) => any = sentryUnplugin.esbuild;\n\nexport type { Options as SentryEsbuildPluginOptions } from \"@sentry/bundler-plugin-core\";\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n"],"names":["esbuildReleaseInjectionPlugin","injectionCode","pluginName","virtualReleaseInjectionFilePath","path","resolve","name","esbuild","setup","_ref","initialOptions","onLoad","onResolve","inject","push","filter","args","sideEffects","loader","contents","esbuildDebugIdInjectionPlugin","proxyNamespace","stubNamespace","_ref2","kind","namespace","pluginData","originalPath","originalResolveDir","resolveDir","concat","suffix","uuidv4","getDebugIdSnippet","esbuildDebugIdUploadPlugin","upload","_ref3","onEnd","metafile","_ref4","_asyncToGenerator","_regeneratorRuntime","mark","_callee","result","buildArtifacts","wrap","_callee$","_context","prev","next","Object","keys","outputs","stop","_x","apply","arguments","sentryUnplugin","sentryUnpluginFactory","releaseInjectionPlugin","debugIdInjectionPlugin","debugIdUploadPlugin","sentryEs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AA6B;AACrD6D,EAAAA,sBAAsB,EAAEzC,6BAA6B;AACrD0C,EAAAA,mBAAmB,EAAE5B,0BAAAA;AACvB,CAAC,CAAC,CAAA;;AAEF;AACa6B,IAAAA,mBAA8C,GAAGL,cAAc,CAACnD;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { sentryUnpluginFactory, Options, getDebugIdSnippet } from \"@sentry/bundler-plugin-core\";\nimport type { UnpluginOptions } from \"unplugin\";\nimport * as path from \"path\";\n\nimport { v4 as uuidv4 } from \"uuid\";\n\nfunction esbuildReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n const pluginName = \"sentry-esbuild-release-injection-plugin\";\n const virtualReleaseInjectionFilePath = path.resolve(\"_sentry-release-injection-stub\"); // needs to be an absolute path for older eslint versions\n\n return {\n name: pluginName,\n\n esbuild: {\n setup({ initialOptions, onLoad, onResolve }) {\n initialOptions.inject = initialOptions.inject || [];\n initialOptions.inject.push(virtualReleaseInjectionFilePath);\n\n onResolve({ filter: /_sentry-release-injection-stub/ }, (args) => {\n return {\n path: args.path,\n sideEffects: true,\n pluginName,\n };\n });\n\n onLoad({ filter: /_sentry-release-injection-stub/ }, () => {\n return {\n loader: \"js\",\n pluginName,\n contents: injectionCode,\n };\n });\n },\n },\n };\n}\n\nfunction esbuildDebugIdInjectionPlugin(): UnpluginOptions {\n const pluginName = \"sentry-esbuild-debug-id-injection-plugin\";\n const stubNamespace = \"sentry-debug-id-stub\";\n\n return {\n name: pluginName,\n\n esbuild: {\n setup({ onLoad, onResolve }) {\n onResolve({ filter: /.*/ }, (args) => {\n if (args.kind !== \"entry-point\") {\n return;\n } else {\n return {\n pluginName,\n // needs to be an abs path, otherwise esbuild will complain\n path: path.isAbsolute(args.path) ? args.path : path.join(args.resolveDir, args.path),\n pluginData: {\n isProxyResolver: true,\n originalPath: args.path,\n originalResolveDir: args.resolveDir,\n },\n // We need to add a suffix here, otherwise esbuild will mark the entrypoint as resolved and won't traverse\n // the module tree any further down past the proxy module because we're essentially creating a dependency\n // loop back to the proxy module.\n // By setting a suffix we're telling esbuild that the entrypoint and proxy module are two different things,\n // making it re-resolve the entrypoint when it is imported from the proxy module.\n // Super confusing? Yes. Works? Apparently... Let's see.\n suffix: \"?sentryProxyModule=true\",\n };\n }\n });\n\n onLoad({ filter: /.*/ }, (args) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (!(args.pluginData?.isProxyResolver as undefined | boolean)) {\n return null;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const originalPath = args.pluginData.originalPath as string;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const originalResolveDir = args.pluginData.originalResolveDir as string;\n\n return {\n loader: \"js\",\n pluginName,\n // We need to use JSON.stringify below so that any escape backslashes stay escape backslashes, in order not to break paths on windows\n contents: `\n import \"_sentry-debug-id-injection-stub\";\n import * as OriginalModule from ${JSON.stringify(originalPath)};\n export default OriginalModule.default;\n export * from ${JSON.stringify(originalPath)};`,\n resolveDir: originalResolveDir,\n };\n });\n\n onResolve({ filter: /_sentry-debug-id-injection-stub/ }, (args) => {\n return {\n path: args.path,\n sideEffects: true,\n pluginName,\n namespace: stubNamespace,\n suffix: \"?sentry-module-id=\" + uuidv4(), // create different module, each time this is resolved\n };\n });\n\n onLoad({ filter: /_sentry-debug-id-injection-stub/, namespace: stubNamespace }, () => {\n return {\n loader: \"js\",\n pluginName,\n contents: getDebugIdSnippet(uuidv4()),\n };\n });\n },\n },\n };\n}\n\nfunction esbuildDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>\n): UnpluginOptions {\n return {\n name: \"sentry-esbuild-debug-id-upload-plugin\",\n esbuild: {\n setup({ initialOptions, onEnd }) {\n initialOptions.metafile = true;\n onEnd(async (result) => {\n const buildArtifacts = result.metafile ? Object.keys(result.metafile.outputs) : [];\n await upload(buildArtifacts);\n });\n },\n },\n };\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n releaseInjectionPlugin: esbuildReleaseInjectionPlugin,\n debugIdInjectionPlugin: esbuildDebugIdInjectionPlugin,\n debugIdUploadPlugin: esbuildDebugIdUploadPlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryEsbuildPlugin: (options: Options) => any = sentryUnplugin.esbuild;\n\nexport type { Options as SentryEsbuildPluginOptions } from \"@sentry/bundler-plugin-core\";\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n"],"names":["esbuildReleaseInjectionPlugin","injectionCode","pluginName","virtualReleaseInjectionFilePath","path","resolve","name","esbuild","setup","_ref","initialOptions","onLoad","onResolve","inject","push","filter","args","sideEffects","loader","contents","esbuildDebugIdInjectionPlugin","stubNamespace","_ref2","kind","isAbsolute","join","resolveDir","pluginData","isProxyResolver","originalPath","originalResolveDir","suffix","_args$pluginData","concat","JSON","stringify","namespace","uuidv4","getDebugIdSnippet","esbuildDebugIdUploadPlugin","upload","_ref3","onEnd","metafile","_ref4","_asyncToGenerator","_regeneratorRuntime","mark","_callee","result","buildArtifacts","wrap","_callee$","_context","prev","next","Object","keys","outputs","stop","_x","apply","arguments","sentryUnplugin","sentryUnpluginFactory","releaseInjectionPlugin","debugIdInjectionPlugin","debugIdUploadPlugin","sentryEsbuildPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC;AAC3CC,EAAAA,sBAAsB,EAAEjE,6BAA6B;AACrDkE,EAAAA,sBAAsB,EAAE9C,6BAA6B;AACrD+C,EAAAA,mBAAmB,EAAE5B,0BAAAA;AACvB,CAAC,CAAC,CAAA;;AAEF;AACa6B,IAAAA,mBAA8C,GAAGL,cAAc,CAACxD;;;;;;;;"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -372,7 +372,6 @@ function esbuildReleaseInjectionPlugin(injectionCode) {
|
|
|
372
372
|
}
|
|
373
373
|
function esbuildDebugIdInjectionPlugin() {
|
|
374
374
|
var pluginName = "sentry-esbuild-debug-id-injection-plugin";
|
|
375
|
-
var proxyNamespace = "sentry-debug-id-proxy";
|
|
376
375
|
var stubNamespace = "sentry-debug-id-stub";
|
|
377
376
|
return {
|
|
378
377
|
name: pluginName,
|
|
@@ -385,21 +384,35 @@ function esbuildDebugIdInjectionPlugin() {
|
|
|
385
384
|
}, function (args) {
|
|
386
385
|
if (args.kind !== "entry-point") {
|
|
387
386
|
return;
|
|
387
|
+
} else {
|
|
388
|
+
return {
|
|
389
|
+
pluginName: pluginName,
|
|
390
|
+
// needs to be an abs path, otherwise esbuild will complain
|
|
391
|
+
path: path.isAbsolute(args.path) ? args.path : path.join(args.resolveDir, args.path),
|
|
392
|
+
pluginData: {
|
|
393
|
+
isProxyResolver: true,
|
|
394
|
+
originalPath: args.path,
|
|
395
|
+
originalResolveDir: args.resolveDir
|
|
396
|
+
},
|
|
397
|
+
// We need to add a suffix here, otherwise esbuild will mark the entrypoint as resolved and won't traverse
|
|
398
|
+
// the module tree any further down past the proxy module because we're essentially creating a dependency
|
|
399
|
+
// loop back to the proxy module.
|
|
400
|
+
// By setting a suffix we're telling esbuild that the entrypoint and proxy module are two different things,
|
|
401
|
+
// making it re-resolve the entrypoint when it is imported from the proxy module.
|
|
402
|
+
// Super confusing? Yes. Works? Apparently... Let's see.
|
|
403
|
+
suffix: "?sentryProxyModule=true"
|
|
404
|
+
};
|
|
388
405
|
}
|
|
389
|
-
return {
|
|
390
|
-
pluginName: pluginName,
|
|
391
|
-
path: args.path,
|
|
392
|
-
namespace: proxyNamespace,
|
|
393
|
-
pluginData: {
|
|
394
|
-
originalPath: args.path,
|
|
395
|
-
originalResolveDir: args.resolveDir
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
406
|
});
|
|
399
407
|
onLoad({
|
|
400
|
-
filter:
|
|
401
|
-
namespace: proxyNamespace
|
|
408
|
+
filter: /.*/
|
|
402
409
|
}, function (args) {
|
|
410
|
+
var _args$pluginData;
|
|
411
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
412
|
+
if (!((_args$pluginData = args.pluginData) !== null && _args$pluginData !== void 0 && _args$pluginData.isProxyResolver)) {
|
|
413
|
+
return null;
|
|
414
|
+
}
|
|
415
|
+
|
|
403
416
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
404
417
|
var originalPath = args.pluginData.originalPath;
|
|
405
418
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
@@ -407,7 +420,8 @@ function esbuildDebugIdInjectionPlugin() {
|
|
|
407
420
|
return {
|
|
408
421
|
loader: "js",
|
|
409
422
|
pluginName: pluginName,
|
|
410
|
-
|
|
423
|
+
// We need to use JSON.stringify below so that any escape backslashes stay escape backslashes, in order not to break paths on windows
|
|
424
|
+
contents: "\n import \"_sentry-debug-id-injection-stub\";\n import * as OriginalModule from ".concat(JSON.stringify(originalPath), ";\n export default OriginalModule.default;\n export * from ").concat(JSON.stringify(originalPath), ";"),
|
|
411
425
|
resolveDir: originalResolveDir
|
|
412
426
|
};
|
|
413
427
|
});
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"sourcesContent":["import { sentryUnpluginFactory, Options, getDebugIdSnippet } from \"@sentry/bundler-plugin-core\";\nimport type { UnpluginOptions } from \"unplugin\";\nimport * as path from \"path\";\n\nimport { v4 as uuidv4 } from \"uuid\";\n\nfunction esbuildReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n const pluginName = \"sentry-esbuild-release-injection-plugin\";\n const virtualReleaseInjectionFilePath = path.resolve(\"_sentry-release-injection-stub\"); // needs to be an absolute path for older eslint versions\n\n return {\n name: pluginName,\n\n esbuild: {\n setup({ initialOptions, onLoad, onResolve }) {\n initialOptions.inject = initialOptions.inject || [];\n initialOptions.inject.push(virtualReleaseInjectionFilePath);\n\n onResolve({ filter: /_sentry-release-injection-stub/ }, (args) => {\n return {\n path: args.path,\n sideEffects: true,\n pluginName,\n };\n });\n\n onLoad({ filter: /_sentry-release-injection-stub/ }, () => {\n return {\n loader: \"js\",\n pluginName,\n contents: injectionCode,\n };\n });\n },\n },\n };\n}\n\nfunction esbuildDebugIdInjectionPlugin(): UnpluginOptions {\n const pluginName = \"sentry-esbuild-debug-id-injection-plugin\";\n const proxyNamespace = \"sentry-debug-id-proxy\";\n const stubNamespace = \"sentry-debug-id-stub\";\n\n return {\n name: pluginName,\n\n esbuild: {\n setup({ onLoad, onResolve }) {\n onResolve({ filter: /.*/ }, (args) => {\n if (args.kind !== \"entry-point\") {\n return;\n }\n return {\n pluginName,\n path: args.path,\n namespace: proxyNamespace,\n pluginData: {\n originalPath: args.path,\n originalResolveDir: args.resolveDir,\n },\n };\n });\n\n onLoad({ filter: /.*/, namespace: proxyNamespace }, (args) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const originalPath = args.pluginData.originalPath as string;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const originalResolveDir = args.pluginData.originalResolveDir as string;\n return {\n loader: \"js\",\n pluginName,\n contents: `\n import \"_sentry-debug-id-injection-stub\";\n import * as OriginalModule from \"${originalPath}\";\n export default OriginalModule.default;\n export * from \"${originalPath}\";`,\n resolveDir: originalResolveDir,\n };\n });\n\n onResolve({ filter: /_sentry-debug-id-injection-stub/ }, (args) => {\n return {\n path: args.path,\n sideEffects: true,\n pluginName,\n namespace: stubNamespace,\n suffix: \"?sentry-module-id=\" + uuidv4(), // create different module, each time this is resolved\n };\n });\n\n onLoad({ filter: /_sentry-debug-id-injection-stub/, namespace: stubNamespace }, () => {\n return {\n loader: \"js\",\n pluginName,\n contents: getDebugIdSnippet(uuidv4()),\n };\n });\n },\n },\n };\n}\n\nfunction esbuildDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>\n): UnpluginOptions {\n return {\n name: \"sentry-esbuild-debug-id-upload-plugin\",\n esbuild: {\n setup({ initialOptions, onEnd }) {\n initialOptions.metafile = true;\n onEnd(async (result) => {\n const buildArtifacts = result.metafile ? Object.keys(result.metafile.outputs) : [];\n await upload(buildArtifacts);\n });\n },\n },\n };\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n releaseInjectionPlugin: esbuildReleaseInjectionPlugin,\n debugIdInjectionPlugin: esbuildDebugIdInjectionPlugin,\n debugIdUploadPlugin: esbuildDebugIdUploadPlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryEsbuildPlugin: (options: Options) => any = sentryUnplugin.esbuild;\n\nexport type { Options as SentryEsbuildPluginOptions } from \"@sentry/bundler-plugin-core\";\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n"],"names":["esbuildReleaseInjectionPlugin","injectionCode","pluginName","virtualReleaseInjectionFilePath","path","resolve","name","esbuild","setup","_ref","initialOptions","onLoad","onResolve","inject","push","filter","args","sideEffects","loader","contents","esbuildDebugIdInjectionPlugin","proxyNamespace","stubNamespace","_ref2","kind","namespace","pluginData","originalPath","originalResolveDir","resolveDir","concat","suffix","uuidv4","getDebugIdSnippet","esbuildDebugIdUploadPlugin","upload","_ref3","onEnd","metafile","_ref4","_asyncToGenerator","_regeneratorRuntime","mark","_callee","result","buildArtifacts","wrap","_callee$","_context","prev","next","Object","keys","outputs","stop","_x","apply","arguments","sentryUnplugin","sentryUnpluginFactory","releaseInjectionPlugin","debugI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D,6BAA6B;AACrD6D,EAAAA,sBAAsB,EAAEzC,6BAA6B;AACrD0C,EAAAA,mBAAmB,EAAE5B,0BAAAA;AACvB,CAAC,CAAC,CAAA;;AAEF;AACa6B,IAAAA,mBAA8C,GAAGL,cAAc,CAACnD;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"sourcesContent":["import { sentryUnpluginFactory, Options, getDebugIdSnippet } from \"@sentry/bundler-plugin-core\";\nimport type { UnpluginOptions } from \"unplugin\";\nimport * as path from \"path\";\n\nimport { v4 as uuidv4 } from \"uuid\";\n\nfunction esbuildReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n const pluginName = \"sentry-esbuild-release-injection-plugin\";\n const virtualReleaseInjectionFilePath = path.resolve(\"_sentry-release-injection-stub\"); // needs to be an absolute path for older eslint versions\n\n return {\n name: pluginName,\n\n esbuild: {\n setup({ initialOptions, onLoad, onResolve }) {\n initialOptions.inject = initialOptions.inject || [];\n initialOptions.inject.push(virtualReleaseInjectionFilePath);\n\n onResolve({ filter: /_sentry-release-injection-stub/ }, (args) => {\n return {\n path: args.path,\n sideEffects: true,\n pluginName,\n };\n });\n\n onLoad({ filter: /_sentry-release-injection-stub/ }, () => {\n return {\n loader: \"js\",\n pluginName,\n contents: injectionCode,\n };\n });\n },\n },\n };\n}\n\nfunction esbuildDebugIdInjectionPlugin(): UnpluginOptions {\n const pluginName = \"sentry-esbuild-debug-id-injection-plugin\";\n const stubNamespace = \"sentry-debug-id-stub\";\n\n return {\n name: pluginName,\n\n esbuild: {\n setup({ onLoad, onResolve }) {\n onResolve({ filter: /.*/ }, (args) => {\n if (args.kind !== \"entry-point\") {\n return;\n } else {\n return {\n pluginName,\n // needs to be an abs path, otherwise esbuild will complain\n path: path.isAbsolute(args.path) ? args.path : path.join(args.resolveDir, args.path),\n pluginData: {\n isProxyResolver: true,\n originalPath: args.path,\n originalResolveDir: args.resolveDir,\n },\n // We need to add a suffix here, otherwise esbuild will mark the entrypoint as resolved and won't traverse\n // the module tree any further down past the proxy module because we're essentially creating a dependency\n // loop back to the proxy module.\n // By setting a suffix we're telling esbuild that the entrypoint and proxy module are two different things,\n // making it re-resolve the entrypoint when it is imported from the proxy module.\n // Super confusing? Yes. Works? Apparently... Let's see.\n suffix: \"?sentryProxyModule=true\",\n };\n }\n });\n\n onLoad({ filter: /.*/ }, (args) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (!(args.pluginData?.isProxyResolver as undefined | boolean)) {\n return null;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const originalPath = args.pluginData.originalPath as string;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const originalResolveDir = args.pluginData.originalResolveDir as string;\n\n return {\n loader: \"js\",\n pluginName,\n // We need to use JSON.stringify below so that any escape backslashes stay escape backslashes, in order not to break paths on windows\n contents: `\n import \"_sentry-debug-id-injection-stub\";\n import * as OriginalModule from ${JSON.stringify(originalPath)};\n export default OriginalModule.default;\n export * from ${JSON.stringify(originalPath)};`,\n resolveDir: originalResolveDir,\n };\n });\n\n onResolve({ filter: /_sentry-debug-id-injection-stub/ }, (args) => {\n return {\n path: args.path,\n sideEffects: true,\n pluginName,\n namespace: stubNamespace,\n suffix: \"?sentry-module-id=\" + uuidv4(), // create different module, each time this is resolved\n };\n });\n\n onLoad({ filter: /_sentry-debug-id-injection-stub/, namespace: stubNamespace }, () => {\n return {\n loader: \"js\",\n pluginName,\n contents: getDebugIdSnippet(uuidv4()),\n };\n });\n },\n },\n };\n}\n\nfunction esbuildDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>\n): UnpluginOptions {\n return {\n name: \"sentry-esbuild-debug-id-upload-plugin\",\n esbuild: {\n setup({ initialOptions, onEnd }) {\n initialOptions.metafile = true;\n onEnd(async (result) => {\n const buildArtifacts = result.metafile ? Object.keys(result.metafile.outputs) : [];\n await upload(buildArtifacts);\n });\n },\n },\n };\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n releaseInjectionPlugin: esbuildReleaseInjectionPlugin,\n debugIdInjectionPlugin: esbuildDebugIdInjectionPlugin,\n debugIdUploadPlugin: esbuildDebugIdUploadPlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryEsbuildPlugin: (options: Options) => any = sentryUnplugin.esbuild;\n\nexport type { Options as SentryEsbuildPluginOptions } from \"@sentry/bundler-plugin-core\";\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n"],"names":["esbuildReleaseInjectionPlugin","injectionCode","pluginName","virtualReleaseInjectionFilePath","path","resolve","name","esbuild","setup","_ref","initialOptions","onLoad","onResolve","inject","push","filter","args","sideEffects","loader","contents","esbuildDebugIdInjectionPlugin","stubNamespace","_ref2","kind","isAbsolute","join","resolveDir","pluginData","isProxyResolver","originalPath","originalResolveDir","suffix","_args$pluginData","concat","JSON","stringify","namespace","uuidv4","getDebugIdSnippet","esbuildDebugIdUploadPlugin","upload","_ref3","onEnd","metafile","_ref4","_asyncToGenerator","_regeneratorRuntime","mark","_callee","result","buildArtifacts","wrap","_callee$","_context","prev","next","Object","keys","outputs","stop","_x","apply","arguments","sentryUnplugin","sentryUnpluginFactory","releaseInjectionPlugin","debugIdInjectionPlugin","debugIdUploadPlugin","sentryEsbuildPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B,EAAEjE,6BAA6B;AACrDkE,EAAAA,sBAAsB,EAAE9C,6BAA6B;AACrD+C,EAAAA,mBAAmB,EAAE5B,0BAAAA;AACvB,CAAC,CAAC,CAAA;;AAEF;AACa6B,IAAAA,mBAA8C,GAAGL,cAAc,CAACxD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/esbuild-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.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",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"prepack": "ts-node ./src/prepack.ts"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@sentry/bundler-plugin-core": "2.
|
|
51
|
+
"@sentry/bundler-plugin-core": "2.3.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-node-resolve": "13.3.0",
|
|
61
|
-
"@sentry-internal/eslint-config": "2.
|
|
62
|
-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "2.
|
|
61
|
+
"@sentry-internal/eslint-config": "2.3.0",
|
|
62
|
+
"@sentry-internal/sentry-bundler-plugin-tsconfig": "2.3.0",
|
|
63
63
|
"@swc/core": "^1.2.205",
|
|
64
64
|
"@swc/jest": "^0.2.21",
|
|
65
65
|
"@types/jest": "^28.1.3",
|