@sentry/esbuild-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
@@ -56,42 +56,42 @@ require("esbuild").build({
56
56
 
57
57
  ## Options
58
58
 
59
- - [`org`](#option-org)
60
- - [`project`](#option-project)
61
- - [`authToken`](#option-authtoken)
62
- - [`url`](#option-url)
63
- - [`headers`](#option-headers)
64
- - [`debug`](#option-debug)
65
- - [`silent`](#option-silent)
66
- - [`errorHandler`](#option-errorhandler)
67
- - [`telemetry`](#option-telemetry)
68
- - [`disable`](#option-disable)
69
- - [`sourcemaps`](#option-sourcemaps)
70
- - [`assets`](#option-sourcemaps-assets)
71
- - [`ignore`](#option-sourcemaps-ignore)
72
- - [`rewriteSources`](#option-sourcemaps-rewritesources)
73
- - [`deleteFilesAfterUpload`](#option-sourcemaps-deletefilesafterupload)
74
- - [`release`](#option-release)
75
- - [`name`](#option-release-name)
76
- - [`inject`](#option-release-inject)
77
- - [`create`](#option-release-create)
78
- - [`finalize`](#option-release-finalize)
79
- - [`dist`](#option-release-dist)
80
- - [`vcsRemote`](#option-release-vcsremote)
81
- - [`setCommits`](#option-release-setcommits)
82
- - [`deploy`](#option-release-deploy)
83
- - [`cleanArtifacts`](#option-release-cleanartifacts)
84
- - [`uploadLegacySourcemaps`](#option-release-uploadlegacysourcemaps)
85
- - [`_experiments`](#option-_experiments)
86
- - [`injectBuildInformation`](#option-_experiments-injectbuildinformation)
87
-
88
- ### <a name="option-org"></a>`org`
59
+ - [`org`](#org)
60
+ - [`project`](#project)
61
+ - [`authToken`](#authtoken)
62
+ - [`url`](#url)
63
+ - [`headers`](#headers)
64
+ - [`debug`](#debug)
65
+ - [`silent`](#silent)
66
+ - [`errorHandler`](#errorhandler)
67
+ - [`telemetry`](#telemetry)
68
+ - [`disable`](#disable)
69
+ - [`sourcemaps`](#sourcemaps)
70
+ - [`assets`](#sourcemapsassets)
71
+ - [`ignore`](#sourcemapsignore)
72
+ - [`rewriteSources`](#sourcemapsrewritesources)
73
+ - [`filesToDeleteAfterUpload`](#sourcemapsfilestodeleteafterupload)
74
+ - [`release`](#release)
75
+ - [`name`](#releasename)
76
+ - [`inject`](#releaseinject)
77
+ - [`create`](#releasecreate)
78
+ - [`finalize`](#releasefinalize)
79
+ - [`dist`](#releasedist)
80
+ - [`vcsRemote`](#releasevcsremote)
81
+ - [`setCommits`](#releasesetcommits)
82
+ - [`deploy`](#releasedeploy)
83
+ - [`cleanArtifacts`](#releasecleanartifacts)
84
+ - [`uploadLegacySourcemaps`](#releaseuploadlegacysourcemaps)
85
+ - [`_experiments`](#_experiments)
86
+ - [`injectBuildInformation`](#_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
- ### <a name="option-project"></a>`project`
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
- ### <a name="option-authtoken"></a>`authToken`
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
- ### <a name="option-url"></a>`url`
110
+ ### `url`
111
111
 
112
112
  Type: `string`
113
113
 
@@ -117,29 +117,29 @@ 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
- ### <a name="option-headers"></a>`headers`
120
+ ### `headers`
121
121
 
122
122
  Type: `Record<string, string>`
123
123
 
124
124
  Headers added to every outgoing network request.
125
125
 
126
- ### <a name="option-debug"></a>`debug`
126
+ ### `debug`
127
127
 
128
128
  Type: `boolean`
129
129
 
130
130
  Print useful debug information. Defaults to `false`.
131
131
 
132
- ### <a name="option-silent"></a>`silent`
132
+ ### `silent`
133
133
 
134
134
  Type: `boolean`
135
135
 
136
136
  Suppresses all logs. Defaults to `false`.
137
137
 
138
- ### <a name="option-errorhandler"></a>`errorHandler`
138
+ ### `errorHandler`
139
139
 
140
140
  Type: `(err: Error) => void`
141
141
 
142
- When an error occurs during rlease creation or sourcemaps upload, the plugin will call this function.
142
+ When an error occurs during release creation or sourcemaps upload, the plugin will call this function.
143
143
 
144
144
  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.
145
145
 
@@ -152,7 +152,7 @@ errorHandler: (err) => {
152
152
  ```
153
153
 
154
154
 
155
- ### <a name="option-telemetry"></a>`telemetry`
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
- ### <a name="option-disable"></a>`disable`
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
- ### <a name="option-sourcemaps"></a>`sourcemaps`
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
- ### <a name="option-sourcemaps-assets"></a>`sourcemaps.assets`
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
- ### <a name="option-sourcemaps-ignore"></a>`sourcemaps.ignore`
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
- ### <a name="option-sourcemaps-rewritesources"></a>`sourcemaps.rewriteSources`
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
- ### <a name="option-sourcemaps-deletefilesafterupload"></a>`sourcemaps.deleteFilesAfterUpload`
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
- ### <a name="option-release"></a>`release`
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
- ### <a name="option-release-name"></a>`release.name`
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
- ### <a name="option-release-inject"></a>`release.inject`
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
- ### <a name="option-release-create"></a>`release.create`
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
- ### <a name="option-release-finalize"></a>`release.finalize`
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
- ### <a name="option-release-dist"></a>`release.dist`
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
- ### <a name="option-release-vcsremote"></a>`release.vcsRemote`
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
- ### <a name="option-release-setcommits"></a>`release.setCommits`
277
+ ### `release.setCommits`
278
278
 
279
279
 
280
280
 
281
281
  Option to associate the created release with its commits in Sentry.
282
- ### <a name="option-release-setcommits-previouscommit"></a>`release.setCommits.previousCommit`
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
- ### <a name="option-release-setcommits-ignoremissing"></a>`release.setCommits.ignoreMissing`
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
- ### <a name="option-release-setcommits-ignoreempty"></a>`release.setCommits.ignoreEmpty`
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
- ### <a name="option-release-setcommits-auto"></a>`release.setCommits.auto`
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
- ### <a name="option-release-setcommits-repo"></a>`release.setCommits.repo`
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
- ### <a name="option-release-setcommits-commit"></a>`release.setCommits.commit`
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
- ### <a name="option-release-deploy"></a>`release.deploy`
332
+ ### `release.deploy`
333
333
 
334
334
 
335
335
 
336
336
  Adds deployment information to the release in Sentry.
337
- ### <a name="option-release-deploy-env"></a>`release.deploy.env`
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
- ### <a name="option-release-deploy-started"></a>`release.deploy.started`
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
- ### <a name="option-release-deploy-finished"></a>`release.deploy.finished`
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
- ### <a name="option-release-deploy-time"></a>`release.deploy.time`
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
- ### <a name="option-release-deploy-name"></a>`release.deploy.name`
361
+ ### `release.deploy.name`
362
362
 
363
363
  Type: `string`
364
364
 
365
365
  Human readable name for the deployment.
366
366
 
367
- ### <a name="option-release-deploy-url"></a>`release.deploy.url`
367
+ ### `release.deploy.url`
368
368
 
369
369
  Type: `string`
370
370
 
371
371
  URL that points to the deployment.
372
372
 
373
- ### <a name="option-release-cleanartifacts"></a>`release.cleanArtifacts`
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
- ### <a name="option-release-uploadlegacysourcemaps"></a>`release.uploadLegacySourcemaps`
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
- ### <a name="option-_experiments"></a>`_experiments`
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
- ### <a name="option-_experiments-injectbuildinformation"></a>`_experiments.injectBuildInformation`
486
+ ### `_experiments.injectBuildInformation`
487
487
 
488
488
  Type: `boolean`
489
489
 
@@ -493,6 +493,10 @@ Defaults to `false`.
493
493
 
494
494
 
495
495
 
496
+ ### Configuration File
497
+
498
+ As an additional configuration method, the Sentry esbuild plugin will pick up environment variables configured inside a `.env.sentry-build-plugin` file located in the current working directory when building your app.
499
+
496
500
  ## More information
497
501
 
498
502
  - [Sentry Documentation](https://docs.sentry.io/quickstart/)
package/dist/cjs/index.js CHANGED
@@ -416,7 +416,14 @@ function esbuildDebugIdInjectionPlugin() {
416
416
  isProxyResolver: true,
417
417
  originalPath: args.path,
418
418
  originalResolveDir: args.resolveDir
419
- }
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"
420
427
  };
421
428
  }
422
429
  });
@@ -436,7 +443,8 @@ function esbuildDebugIdInjectionPlugin() {
436
443
  return {
437
444
  loader: "js",
438
445
  pluginName: pluginName,
439
- contents: "\n import \"_sentry-debug-id-injection-stub\";\n import * as OriginalModule from \"".concat(originalPath, "\";\n export default OriginalModule.default;\n export * from \"").concat(originalPath, "\";"),
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), ";"),
440
448
  resolveDir: originalResolveDir
441
449
  };
442
450
  });
@@ -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 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 };\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 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","stubNamespace","_ref2","kind","isAbsolute","join","resolveDir","pluginData","isProxyResolver","originalPath","originalResolveDir","_args$pluginData","concat","namespace","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","sentryEsbuildPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAASA,6BAA6BA,CAAC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c,CAACtD;;;;;;;;"}
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAASA,6BAA6BA,CAACC,aAAqB,EAAmB;EAC7E,IAAMC,UAAU,GAAG,yCAAyC,CAAA;EAC5D,IAAMC,+BAA+B,GAAGC,eAAI,CAACC,OAAO,CA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a6B,IAAAA,mBAA8C,GAAGL,cAAc,CAACxD;;;;;;;;"}
@@ -393,7 +393,14 @@ function esbuildDebugIdInjectionPlugin() {
393
393
  isProxyResolver: true,
394
394
  originalPath: args.path,
395
395
  originalResolveDir: args.resolveDir
396
- }
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"
397
404
  };
398
405
  }
399
406
  });
@@ -413,7 +420,8 @@ function esbuildDebugIdInjectionPlugin() {
413
420
  return {
414
421
  loader: "js",
415
422
  pluginName: pluginName,
416
- contents: "\n import \"_sentry-debug-id-injection-stub\";\n import * as OriginalModule from \"".concat(originalPath, "\";\n export default OriginalModule.default;\n export * from \"").concat(originalPath, "\";"),
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), ";"),
417
425
  resolveDir: originalResolveDir
418
426
  };
419
427
  });
@@ -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 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 };\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 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","stubNamespace","_ref2","kind","isAbsolute","join","resolveDir","pluginData","isProxyResolver","originalPath","originalResolveDir","_args$pluginData","concat","namespace","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","sentryEsbuildPlugin"],"mappings":";;;;;;;;;;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OAAA,UAAAY,EAAA,EAAA;AAAA,YAAA,OAAAhB,KAAA,CAAAiB,KAAA,CAAA,IAAA,EAAAC,SAAA,CAAA,CAAA;AAAA,WAAA,CAAA;SAAC,EAAA,CAAA,CAAA;AACJ,OAAA;AACF,KAAA;GACD,CAAA;AACH,CAAA;AAEA,IAAMC,cAAc,GAAGC,qBAAqB,CAAC;AAC3CC,EAAAA,sBAAsB,EAAE/D,6BAA6B;AACrDgE,EAAAA,sBAAsB,EAAE5C,6BAA6B;AACrD6C,EAAAA,mBAAmB,EAAE5B,0BAAAA;AACvB,CAAC,CAAC,CAAA;;AAEF;AACa6B,IAAAA,mBAA8C,GAAGL,cAAc,CAACtD;;;;"}
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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,OAAA,UAAAY,EAAA,EAAA;AAAA,YAAA,OAAAhB,KAAA,CAAAiB,KAAA,CAAA,IAAA,EAAAC,SAAA,CAAA,CAAA;AAAA,WAAA,CAAA;SAAC,EAAA,CAAA,CAAA;AACJ,OAAA;AACF,KAAA;GACD,CAAA;AACH,CAAA;AAEA,IAAMC,cAAc,GAAGC,qBAAqB,CAAC;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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/esbuild-plugin",
3
- "version": "2.2.2",
3
+ "version": "2.4.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.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-node-resolve": "13.3.0",
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",
@@ -76,6 +76,6 @@
76
76
  "extends": "../../package.json"
77
77
  },
78
78
  "engines": {
79
- "node": ">= 10"
79
+ "node": ">= 14"
80
80
  }
81
81
  }