@sentry/webpack-plugin 4.6.2 → 4.8.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
@@ -123,6 +123,7 @@ SENTRY_PROJECT=frontend-team-a,frontend-team-b,frontend-team-c
123
123
  - [`reactComponentAnnotation`](#reactcomponentannotation)
124
124
  - [`enabled`](#reactcomponentannotationenabled)
125
125
  - [`ignoredComponents`](#reactcomponentannotationignoredcomponents)
126
+ - [`_experimentalInjectIntoHtml`](#reactcomponentannotation_experimentalinjectintohtml)
126
127
  - [`moduleMetadata`](#modulemetadata)
127
128
  - [`applicationKey`](#applicationkey)
128
129
  - [`_experiments`](#_experiments)
@@ -663,6 +664,12 @@ Type: `string[]`
663
664
 
664
665
  A list of strings representing the names of components to ignore. The plugin will not perform apply `data-sentry` annotations on the DOM element for these components.
665
666
 
667
+ ### `reactComponentAnnotation._experimentalInjectIntoHtml`
668
+
669
+ Type: `boolean`
670
+
671
+ An experimental component annotation injection mode that injects annotations into HTML rather than React components.
672
+
666
673
  ### `moduleMetadata`
667
674
 
668
675
  Type: `Record<string, any> | (args: { org?: string; project?: string; release?: string; }) => Record<string, any>`
@@ -76,10 +76,10 @@ function _toPropertyKey(arg) {
76
76
 
77
77
  // since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version
78
78
  // https://github.com/webpack/webpack/commit/65eca2e529ce1d79b79200d4bdb1ce1b81141459
79
- function webpackReleaseInjectionPlugin(UnsafeBannerPlugin) {
80
- return function (injectionCode) {
79
+ function webpackInjectionPlugin(UnsafeBannerPlugin) {
80
+ return function (injectionCode, debugIds) {
81
81
  return {
82
- name: "sentry-webpack-release-injection-plugin",
82
+ name: "sentry-webpack-injection-plugin",
83
83
  webpack: function webpack(compiler) {
84
84
  var _compiler$webpack;
85
85
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -96,14 +96,23 @@ function webpackReleaseInjectionPlugin(UnsafeBannerPlugin) {
96
96
  new BannerPlugin({
97
97
  raw: true,
98
98
  include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
99
- banner: injectionCode
99
+ banner: function banner(arg) {
100
+ var codeToInject = injectionCode.clone();
101
+ if (debugIds) {
102
+ var _arg$chunk$contentHas, _arg$chunk, _arg$chunk$contentHas2, _arg$chunk2;
103
+ var hash = (_arg$chunk$contentHas = arg === null || arg === void 0 ? void 0 : (_arg$chunk = arg.chunk) === null || _arg$chunk === void 0 ? void 0 : (_arg$chunk$contentHas2 = _arg$chunk.contentHash) === null || _arg$chunk$contentHas2 === void 0 ? void 0 : _arg$chunk$contentHas2.javascript) !== null && _arg$chunk$contentHas !== void 0 ? _arg$chunk$contentHas : arg === null || arg === void 0 ? void 0 : (_arg$chunk2 = arg.chunk) === null || _arg$chunk2 === void 0 ? void 0 : _arg$chunk2.hash;
104
+ var debugId = hash ? bundlerPluginCore.stringToUUID(hash) : uuid.v4();
105
+ codeToInject.append(bundlerPluginCore.getDebugIdSnippet(debugId));
106
+ }
107
+ return codeToInject.code();
108
+ }
100
109
  }));
101
110
  }
102
111
  };
103
112
  };
104
113
  }
105
114
  function webpackComponentNameAnnotatePlugin() {
106
- return function (ignoredComponents) {
115
+ return function (ignoredComponents, injectIntoHtml) {
107
116
  return {
108
117
  name: "sentry-webpack-component-name-annotate-plugin",
109
118
  enforce: "pre",
@@ -111,7 +120,7 @@ function webpackComponentNameAnnotatePlugin() {
111
120
  transformInclude: function transformInclude(id) {
112
121
  return id.endsWith(".tsx") || id.endsWith(".jsx");
113
122
  },
114
- transform: bundlerPluginCore.createComponentNameAnnotateHooks(ignoredComponents).transform
123
+ transform: bundlerPluginCore.createComponentNameAnnotateHooks(ignoredComponents, injectIntoHtml).transform
115
124
  };
116
125
  };
117
126
  }
@@ -137,37 +146,6 @@ function webpackBundleSizeOptimizationsPlugin(UnsafeDefinePlugin) {
137
146
  };
138
147
  };
139
148
  }
140
- function webpackDebugIdInjectionPlugin(UnsafeBannerPlugin) {
141
- return function () {
142
- return {
143
- name: "sentry-webpack-debug-id-injection-plugin",
144
- webpack: function webpack(compiler) {
145
- var _compiler$webpack3;
146
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
147
- // @ts-ignore webpack version compatibility shenanigans
148
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
149
- var BannerPlugin =
150
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
151
- // @ts-ignore webpack version compatibility shenanigans
152
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
153
- (compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack3 = compiler.webpack) === null || _compiler$webpack3 === void 0 ? void 0 : _compiler$webpack3.BannerPlugin) || UnsafeBannerPlugin;
154
- compiler.options.plugins = compiler.options.plugins || [];
155
- compiler.options.plugins.push(
156
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
157
- new BannerPlugin({
158
- raw: true,
159
- include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
160
- banner: function banner(arg) {
161
- var _arg$chunk$contentHas, _arg$chunk, _arg$chunk$contentHas2, _arg$chunk2;
162
- var hash = (_arg$chunk$contentHas = arg === null || arg === void 0 ? void 0 : (_arg$chunk = arg.chunk) === null || _arg$chunk === void 0 ? void 0 : (_arg$chunk$contentHas2 = _arg$chunk.contentHash) === null || _arg$chunk$contentHas2 === void 0 ? void 0 : _arg$chunk$contentHas2.javascript) !== null && _arg$chunk$contentHas !== void 0 ? _arg$chunk$contentHas : arg === null || arg === void 0 ? void 0 : (_arg$chunk2 = arg.chunk) === null || _arg$chunk2 === void 0 ? void 0 : _arg$chunk2.hash;
163
- var debugId = hash ? bundlerPluginCore.stringToUUID(hash) : uuid.v4();
164
- return bundlerPluginCore.getDebugIdSnippet(debugId);
165
- }
166
- }));
167
- }
168
- };
169
- };
170
- }
171
149
  function webpackDebugIdUploadPlugin(upload, logger, createDependencyOnBuildArtifacts, forceExitOnBuildCompletion) {
172
150
  var pluginName = "sentry-webpack-debug-id-upload-plugin";
173
151
  return {
@@ -198,32 +176,6 @@ function webpackDebugIdUploadPlugin(upload, logger, createDependencyOnBuildArtif
198
176
  }
199
177
  };
200
178
  }
201
- function webpackModuleMetadataInjectionPlugin(UnsafeBannerPlugin) {
202
- return function (injectionCode) {
203
- return {
204
- name: "sentry-webpack-module-metadata-injection-plugin",
205
- webpack: function webpack(compiler) {
206
- var _compiler$webpack4;
207
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
208
- // @ts-ignore webpack version compatibility shenanigans
209
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
210
- var BannerPlugin =
211
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
212
- // @ts-ignore webpack version compatibility shenanigans
213
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
214
- (compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack4 = compiler.webpack) === null || _compiler$webpack4 === void 0 ? void 0 : _compiler$webpack4.BannerPlugin) || UnsafeBannerPlugin;
215
- compiler.options.plugins = compiler.options.plugins || [];
216
- compiler.options.plugins.push(
217
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
218
- new BannerPlugin({
219
- raw: true,
220
- include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
221
- banner: injectionCode
222
- }));
223
- }
224
- };
225
- };
226
- }
227
179
 
228
180
  /**
229
181
  * The factory function accepts BannerPlugin and DefinePlugin classes in
@@ -238,10 +190,8 @@ function sentryWebpackUnpluginFactory() {
238
190
  BannerPlugin = _ref2.BannerPlugin,
239
191
  DefinePlugin = _ref2.DefinePlugin;
240
192
  return bundlerPluginCore.sentryUnpluginFactory({
241
- releaseInjectionPlugin: webpackReleaseInjectionPlugin(BannerPlugin),
193
+ injectionPlugin: webpackInjectionPlugin(BannerPlugin),
242
194
  componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin(),
243
- moduleMetadataInjectionPlugin: webpackModuleMetadataInjectionPlugin(BannerPlugin),
244
- debugIdInjectionPlugin: webpackDebugIdInjectionPlugin(BannerPlugin),
245
195
  debugIdUploadPlugin: webpackDebugIdUploadPlugin,
246
196
  bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin)
247
197
  });
@@ -1 +1 @@
1
- {"version":3,"file":"webpack4and5.js","sources":["../../src/webpack4and5.ts"],"sourcesContent":["import {\n getDebugIdSnippet,\n Options,\n sentryUnpluginFactory,\n stringToUUID,\n SentrySDKBuildFlags,\n createComponentNameAnnotateHooks,\n Logger,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"path\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version\n// https://github.com/webpack/webpack/commit/65eca2e529ce1d79b79200d4bdb1ce1b81141459\n\ninterface BannerPluginCallbackArg {\n chunk?: {\n hash?: string;\n contentHash?: {\n javascript?: string;\n };\n };\n}\n\ntype UnsafeBannerPlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\ntype UnsafeDefinePlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\nfunction webpackReleaseInjectionPlugin(\n UnsafeBannerPlugin: UnsafeBannerPlugin | undefined\n): (injectionCode: string) => UnpluginOptions {\n return (injectionCode: string): UnpluginOptions => ({\n name: \"sentry-webpack-release-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: injectionCode,\n })\n );\n },\n });\n}\n\nfunction webpackComponentNameAnnotatePlugin(): (ignoredComponents?: string[]) => UnpluginOptions {\n return (ignoredComponents?: string[]) => ({\n name: \"sentry-webpack-component-name-annotate-plugin\",\n enforce: \"pre\",\n // Webpack needs this hook for loader logic, so the plugin is not run on unsupported file types\n transformInclude(id) {\n return id.endsWith(\".tsx\") || id.endsWith(\".jsx\");\n },\n transform: createComponentNameAnnotateHooks(ignoredComponents).transform,\n });\n}\n\nfunction webpackBundleSizeOptimizationsPlugin(\n UnsafeDefinePlugin: UnsafeDefinePlugin | undefined\n): (replacementValues: SentrySDKBuildFlags) => UnpluginOptions {\n return (replacementValues: SentrySDKBuildFlags) => ({\n name: \"sentry-webpack-bundle-size-optimizations-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const DefinePlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.DefinePlugin || UnsafeDefinePlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new DefinePlugin({\n ...replacementValues,\n })\n );\n },\n });\n}\n\nfunction webpackDebugIdInjectionPlugin(\n UnsafeBannerPlugin: UnsafeBannerPlugin | undefined\n): () => UnpluginOptions {\n return () => ({\n name: \"sentry-webpack-debug-id-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: (arg?: BannerPluginCallbackArg) => {\n const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;\n const debugId = hash ? stringToUUID(hash) : uuidv4();\n return getDebugIdSnippet(debugId);\n },\n })\n );\n },\n });\n}\n\nfunction webpackDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>,\n logger: Logger,\n createDependencyOnBuildArtifacts: () => () => void,\n forceExitOnBuildCompletion?: boolean\n): UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-upload-plugin\";\n return {\n name: pluginName,\n webpack(compiler) {\n const freeGlobalDependencyOnDebugIdSourcemapArtifacts = createDependencyOnBuildArtifacts();\n\n compiler.hooks.afterEmit.tapAsync(pluginName, (compilation, callback: () => void) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const outputPath = (compilation.outputOptions.path as string | undefined) ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets as Record<string, unknown>).map(\n (asset) => path.join(outputPath, asset)\n );\n void upload(buildArtifacts)\n .then(() => {\n callback();\n })\n .finally(() => {\n freeGlobalDependencyOnDebugIdSourcemapArtifacts();\n });\n });\n\n if (forceExitOnBuildCompletion && compiler.options.mode === \"production\") {\n compiler.hooks.done.tap(pluginName, () => {\n setTimeout(() => {\n logger.debug(\"Exiting process after debug file upload\");\n process.exit(0);\n });\n });\n }\n },\n };\n}\n\nfunction webpackModuleMetadataInjectionPlugin(\n UnsafeBannerPlugin: UnsafeBannerPlugin | undefined\n): (injectionCode: string) => UnpluginOptions {\n return (injectionCode: string) => ({\n name: \"sentry-webpack-module-metadata-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: injectionCode,\n })\n );\n },\n });\n}\n\n/**\n * The factory function accepts BannerPlugin and DefinePlugin classes in\n * order to avoid direct dependencies on webpack.\n *\n * This allow us to export version of the plugin for webpack 5.1+ and compatible environments.\n *\n * Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.\n */\nexport function sentryWebpackUnpluginFactory({\n BannerPlugin,\n DefinePlugin,\n}: {\n BannerPlugin?: UnsafeBannerPlugin;\n DefinePlugin?: UnsafeDefinePlugin;\n} = {}): ReturnType<typeof sentryUnpluginFactory> {\n return sentryUnpluginFactory({\n releaseInjectionPlugin: webpackReleaseInjectionPlugin(BannerPlugin),\n componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin(),\n moduleMetadataInjectionPlugin: webpackModuleMetadataInjectionPlugin(BannerPlugin),\n debugIdInjectionPlugin: webpackDebugIdInjectionPlugin(BannerPlugin),\n debugIdUploadPlugin: webpackDebugIdUploadPlugin,\n bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin),\n });\n}\n\nexport type SentryWebpackPluginOptions = Options & {\n _experiments?: Options[\"_experiments\"] & {\n /**\n * If enabled, the webpack plugin will exit the build process after the build completes.\n * Use this with caution, as it will terminate the process.\n *\n * More information: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/345\n *\n * @default false\n */\n forceExitOnBuildCompletion?: boolean;\n };\n};\n"],"names":["webpackReleaseInjectionPlugin","UnsafeBannerPlugin","injectionCode","name","webpack","compiler","_compiler$webpack","BannerPlugin","options","plugins","push","raw","include","banner","webpackComponentNameAnnotatePlugin","ignoredComponents","enforce","transformInclude","id","endsWith","transform","createComponentNameAnnotateHooks","webpackBundleSizeOptimizationsPlugin","UnsafeDefinePlugin","replacementValues","_compiler$webpack2","DefinePlugin","_objectSpread","webpackDebugIdInjectionPlugin","_compiler$webpack3","arg","_arg$chunk$contentHas","_arg$chunk","_arg$chunk$contentHas2","_arg$chunk2","hash","chunk","contentHash","javascript","debugId","stringToUUID","uuidv4","getDebugIdSnippet","webpackDebugIdUploadPlugin","upload","logger","createDependencyOnBuildArtifacts","forceExitOnBuildCompletion","pluginName","freeGlobalDependencyOnDebugIdSourcemapArtifacts","hooks","afterEmit","tapAsync","compilation","callback","_ref","outputPath","outputOptions","path","resolve","buildArtifacts","Object","keys","assets","map","asset","join","then","mode","done","tap","setTimeout","debug","process","exit","webpackModuleMetadataInjectionPlugin","_compiler$webpack4","sentryWebpackUnpluginFactory","_ref2","arguments","length","undefined","sentryUnpluginFactory","releaseInjectionPlugin","componentNameAnnotatePlugin","moduleMetadataInjectionPlugin","debugIdInjectionPlugin","debugIdUpload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ACxDC,UAAAA,MAAM,EAAEX,aAAAA;AACV,SAAC,CACH,CAAC,CAAA;AACH,OAAA;KACD,CAAA;GAAC,CAAA;AACJ,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS2E,4BAA4BA,GAMM;AAAA,EAAA,IAAAC,KAAA,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAA9C,EAAE;IALJxE,YAAY,GAAAuE,KAAA,CAAZvE,YAAY;IACZmB,YAAY,GAAAoD,KAAA,CAAZpD,YAAY,CAAA;AAKZ,EAAA,OAAOwD,uCAAqB,CAAC;AAC3BC,IAAAA,sBAAsB,EAAEnF,6BAA6B,CAACO,YAAY,CAAC;IACnE6E,2BAA2B,EAAEtE,kCAAkC,EAAE;AACjEuE,IAAAA,6BAA6B,EAAEV,oCAAoC,CAACpE,YAAY,CAAC;AACjF+E,IAAAA,sBAAsB,EAAE1D,6BAA6B,CAACrB,YAAY,CAAC;AACnEgF,IAAAA,mBAAmB,EAAE5C,0BAA0B;IAC/C6C,6BAA6B,EAAElE,oCAAoC,CAACI,YAAY,CAAA;AAClF,GAAC,CAAC,CAAA;AACJ;;;;"}
1
+ {"version":3,"file":"webpack4and5.js","sources":["../../src/webpack4and5.ts"],"sourcesContent":["import {\n Options,\n sentryUnpluginFactory,\n stringToUUID,\n SentrySDKBuildFlags,\n createComponentNameAnnotateHooks,\n Logger,\n CodeInjection,\n getDebugIdSnippet,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"path\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version\n// https://github.com/webpack/webpack/commit/65eca2e529ce1d79b79200d4bdb1ce1b81141459\n\ninterface BannerPluginCallbackArg {\n chunk?: {\n hash?: string;\n contentHash?: {\n javascript?: string;\n };\n };\n}\n\ntype UnsafeBannerPlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\ntype UnsafeDefinePlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\nfunction webpackInjectionPlugin(\n UnsafeBannerPlugin: UnsafeBannerPlugin | undefined\n): (injectionCode: CodeInjection, debugIds: boolean) => UnpluginOptions {\n return (injectionCode: CodeInjection, debugIds: boolean): UnpluginOptions => ({\n name: \"sentry-webpack-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: (arg?: BannerPluginCallbackArg) => {\n const codeToInject = injectionCode.clone();\n if (debugIds) {\n const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;\n const debugId = hash ? stringToUUID(hash) : uuidv4();\n codeToInject.append(getDebugIdSnippet(debugId));\n }\n return codeToInject.code();\n },\n })\n );\n },\n });\n}\n\nfunction webpackComponentNameAnnotatePlugin(): (\n ignoredComponents: string[],\n injectIntoHtml: boolean\n) => UnpluginOptions {\n return (ignoredComponents: string[], injectIntoHtml: boolean) => ({\n name: \"sentry-webpack-component-name-annotate-plugin\",\n enforce: \"pre\",\n // Webpack needs this hook for loader logic, so the plugin is not run on unsupported file types\n transformInclude(id) {\n return id.endsWith(\".tsx\") || id.endsWith(\".jsx\");\n },\n transform: createComponentNameAnnotateHooks(ignoredComponents, injectIntoHtml).transform,\n });\n}\n\nfunction webpackBundleSizeOptimizationsPlugin(\n UnsafeDefinePlugin: UnsafeDefinePlugin | undefined\n): (replacementValues: SentrySDKBuildFlags) => UnpluginOptions {\n return (replacementValues: SentrySDKBuildFlags) => ({\n name: \"sentry-webpack-bundle-size-optimizations-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const DefinePlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.DefinePlugin || UnsafeDefinePlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new DefinePlugin({\n ...replacementValues,\n })\n );\n },\n });\n}\n\nfunction webpackDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>,\n logger: Logger,\n createDependencyOnBuildArtifacts: () => () => void,\n forceExitOnBuildCompletion?: boolean\n): UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-upload-plugin\";\n return {\n name: pluginName,\n webpack(compiler) {\n const freeGlobalDependencyOnDebugIdSourcemapArtifacts = createDependencyOnBuildArtifacts();\n\n compiler.hooks.afterEmit.tapAsync(pluginName, (compilation, callback: () => void) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const outputPath = (compilation.outputOptions.path as string | undefined) ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets as Record<string, unknown>).map(\n (asset) => path.join(outputPath, asset)\n );\n void upload(buildArtifacts)\n .then(() => {\n callback();\n })\n .finally(() => {\n freeGlobalDependencyOnDebugIdSourcemapArtifacts();\n });\n });\n\n if (forceExitOnBuildCompletion && compiler.options.mode === \"production\") {\n compiler.hooks.done.tap(pluginName, () => {\n setTimeout(() => {\n logger.debug(\"Exiting process after debug file upload\");\n process.exit(0);\n });\n });\n }\n },\n };\n}\n\n/**\n * The factory function accepts BannerPlugin and DefinePlugin classes in\n * order to avoid direct dependencies on webpack.\n *\n * This allow us to export version of the plugin for webpack 5.1+ and compatible environments.\n *\n * Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.\n */\nexport function sentryWebpackUnpluginFactory({\n BannerPlugin,\n DefinePlugin,\n}: {\n BannerPlugin?: UnsafeBannerPlugin;\n DefinePlugin?: UnsafeDefinePlugin;\n} = {}): ReturnType<typeof sentryUnpluginFactory> {\n return sentryUnpluginFactory({\n injectionPlugin: webpackInjectionPlugin(BannerPlugin),\n componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin(),\n debugIdUploadPlugin: webpackDebugIdUploadPlugin,\n bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin),\n });\n}\n\nexport type SentryWebpackPluginOptions = Options & {\n _experiments?: Options[\"_experiments\"] & {\n /**\n * If enabled, the webpack plugin will exit the build process after the build completes.\n * Use this with caution, as it will terminate the process.\n *\n * More information: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/345\n *\n * @default false\n */\n forceExitOnBuildCompletion?: boolean;\n };\n};\n"],"names":["webpackInjectionPlugin","UnsafeBannerPlugin","injectionCode","debugIds","name","webpack","compiler","_compiler$webpack","BannerPlugin","options","plugins","push","raw","include","banner","arg","codeToInject","clone","_arg$chunk$contentHas","_arg$chunk","_arg$chunk$contentHas2","_arg$chunk2","hash","chunk","contentHash","javascript","debugId","stringToUUID","uuidv4","append","getDebugIdSnippet","code","webpackComponentNameAnnotatePlugin","ignoredComponents","injectIntoHtml","enforce","transformInclude","id","endsWith","transform","createComponentNameAnnotateHooks","webpackBundleSizeOptimizationsPlugin","UnsafeDefinePlugin","replacementValues","_compiler$webpack2","DefinePlugin","_objectSpread","webpackDebugIdUploadPlugin","upload","logger","createDependencyOnBuildArtifacts","forceExitOnBuildCompletion","pluginName","freeGlobalDependencyOnDebugIdSourcemapArtifacts","hooks","afterEmit","tapAsync","compilation","callback","_ref","outputPath","outputOptions","path","resolve","buildArtifacts","Object","keys","assets","map","asset","join","then","mode","done","tap","setTimeout","debug","process","exit","sentryWebpackUnpluginFactory","_ref2","arguments","length","undefined","sentryUnpluginFactory","injectionPlugin","componentNameAnnotatePlugin","debugIdUploadPlugin","bundleSizeOptimizationsPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA;AACA;AAqBA,SAASA,sBAAsBA,CAC7BC,kBAAkD,EACoB;EACtE,OAAO,UAACC,aAA4B,EAAEC,QAAiB,EAAA;IAAA,OAAuB;AAC5EC,MAAAA,IAAI,EAAE,iCAAiC;MACvCC,OAAO,EAAA,SAAAA,OAACC,CAAAA,QAAQ,EAAE;AAAA,QAAA,IAAAC,iBAAA,CAAA;AAChB;AACA;AACA;AACA,QAAA,IAAMC,YAAY;AAChB;AACA;AACA;AACA,QAAA,CAAAF,QAAQ,KAARA,IAAAA,IAAAA,QAAQ,KAAAC,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,CAAAA,iBAAA,GAARD,QAAQ,CAAED,OAAO,MAAA,IAAA,IAAAE,iBAAA,KAAjBA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,iBAAA,CAAmBC,YAAY,KAAIP,kBAAkB,CAAA;QAEvDK,QAAQ,CAACG,OAAO,CAACC,OAAO,GAAGJ,QAAQ,CAACG,OAAO,CAACC,OAAO,IAAI,EAAE,CAAA;AACzDJ,QAAAA,QAAQ,CAACG,OAAO,CAACC,OAAO,CAACC,IAAI;AAC3B;AACA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C,YAAAA,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,WAAC,CAAC,CAAA;AACJ,SAAC,CAAC,CAAA;AACJ,OAAA;AACF,KAAA;GACD,CAAA;AACH,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,4BAA4BA,GAMM;AAAA,EAAA,IAAAC,KAAA,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAA9C,EAAE;IALJzE,YAAY,GAAAwE,KAAA,CAAZxE,YAAY;IACZqC,YAAY,GAAAmC,KAAA,CAAZnC,YAAY,CAAA;AAKZ,EAAA,OAAOuC,uCAAqB,CAAC;AAC3BC,IAAAA,eAAe,EAAErF,sBAAsB,CAACQ,YAAY,CAAC;IACrD8E,2BAA2B,EAAEtD,kCAAkC,EAAE;AACjEuD,IAAAA,mBAAmB,EAAExC,0BAA0B;IAC/CyC,6BAA6B,EAAE/C,oCAAoC,CAACI,YAAY,CAAA;AAClF,GAAC,CAAC,CAAA;AACJ;;;;"}
@@ -1,4 +1,4 @@
1
- import { sentryUnpluginFactory, createComponentNameAnnotateHooks, stringToUUID, getDebugIdSnippet } from '@sentry/bundler-plugin-core';
1
+ import { sentryUnpluginFactory, stringToUUID, getDebugIdSnippet, createComponentNameAnnotateHooks } from '@sentry/bundler-plugin-core';
2
2
  import * as path from 'path';
3
3
  import { v4 } from 'uuid';
4
4
 
@@ -54,10 +54,10 @@ function _toPropertyKey(arg) {
54
54
 
55
55
  // since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version
56
56
  // https://github.com/webpack/webpack/commit/65eca2e529ce1d79b79200d4bdb1ce1b81141459
57
- function webpackReleaseInjectionPlugin(UnsafeBannerPlugin) {
58
- return function (injectionCode) {
57
+ function webpackInjectionPlugin(UnsafeBannerPlugin) {
58
+ return function (injectionCode, debugIds) {
59
59
  return {
60
- name: "sentry-webpack-release-injection-plugin",
60
+ name: "sentry-webpack-injection-plugin",
61
61
  webpack: function webpack(compiler) {
62
62
  var _compiler$webpack;
63
63
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -74,14 +74,23 @@ function webpackReleaseInjectionPlugin(UnsafeBannerPlugin) {
74
74
  new BannerPlugin({
75
75
  raw: true,
76
76
  include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
77
- banner: injectionCode
77
+ banner: function banner(arg) {
78
+ var codeToInject = injectionCode.clone();
79
+ if (debugIds) {
80
+ var _arg$chunk$contentHas, _arg$chunk, _arg$chunk$contentHas2, _arg$chunk2;
81
+ var hash = (_arg$chunk$contentHas = arg === null || arg === void 0 ? void 0 : (_arg$chunk = arg.chunk) === null || _arg$chunk === void 0 ? void 0 : (_arg$chunk$contentHas2 = _arg$chunk.contentHash) === null || _arg$chunk$contentHas2 === void 0 ? void 0 : _arg$chunk$contentHas2.javascript) !== null && _arg$chunk$contentHas !== void 0 ? _arg$chunk$contentHas : arg === null || arg === void 0 ? void 0 : (_arg$chunk2 = arg.chunk) === null || _arg$chunk2 === void 0 ? void 0 : _arg$chunk2.hash;
82
+ var debugId = hash ? stringToUUID(hash) : v4();
83
+ codeToInject.append(getDebugIdSnippet(debugId));
84
+ }
85
+ return codeToInject.code();
86
+ }
78
87
  }));
79
88
  }
80
89
  };
81
90
  };
82
91
  }
83
92
  function webpackComponentNameAnnotatePlugin() {
84
- return function (ignoredComponents) {
93
+ return function (ignoredComponents, injectIntoHtml) {
85
94
  return {
86
95
  name: "sentry-webpack-component-name-annotate-plugin",
87
96
  enforce: "pre",
@@ -89,7 +98,7 @@ function webpackComponentNameAnnotatePlugin() {
89
98
  transformInclude: function transformInclude(id) {
90
99
  return id.endsWith(".tsx") || id.endsWith(".jsx");
91
100
  },
92
- transform: createComponentNameAnnotateHooks(ignoredComponents).transform
101
+ transform: createComponentNameAnnotateHooks(ignoredComponents, injectIntoHtml).transform
93
102
  };
94
103
  };
95
104
  }
@@ -115,37 +124,6 @@ function webpackBundleSizeOptimizationsPlugin(UnsafeDefinePlugin) {
115
124
  };
116
125
  };
117
126
  }
118
- function webpackDebugIdInjectionPlugin(UnsafeBannerPlugin) {
119
- return function () {
120
- return {
121
- name: "sentry-webpack-debug-id-injection-plugin",
122
- webpack: function webpack(compiler) {
123
- var _compiler$webpack3;
124
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
125
- // @ts-ignore webpack version compatibility shenanigans
126
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
127
- var BannerPlugin =
128
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
129
- // @ts-ignore webpack version compatibility shenanigans
130
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
131
- (compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack3 = compiler.webpack) === null || _compiler$webpack3 === void 0 ? void 0 : _compiler$webpack3.BannerPlugin) || UnsafeBannerPlugin;
132
- compiler.options.plugins = compiler.options.plugins || [];
133
- compiler.options.plugins.push(
134
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
135
- new BannerPlugin({
136
- raw: true,
137
- include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
138
- banner: function banner(arg) {
139
- var _arg$chunk$contentHas, _arg$chunk, _arg$chunk$contentHas2, _arg$chunk2;
140
- var hash = (_arg$chunk$contentHas = arg === null || arg === void 0 ? void 0 : (_arg$chunk = arg.chunk) === null || _arg$chunk === void 0 ? void 0 : (_arg$chunk$contentHas2 = _arg$chunk.contentHash) === null || _arg$chunk$contentHas2 === void 0 ? void 0 : _arg$chunk$contentHas2.javascript) !== null && _arg$chunk$contentHas !== void 0 ? _arg$chunk$contentHas : arg === null || arg === void 0 ? void 0 : (_arg$chunk2 = arg.chunk) === null || _arg$chunk2 === void 0 ? void 0 : _arg$chunk2.hash;
141
- var debugId = hash ? stringToUUID(hash) : v4();
142
- return getDebugIdSnippet(debugId);
143
- }
144
- }));
145
- }
146
- };
147
- };
148
- }
149
127
  function webpackDebugIdUploadPlugin(upload, logger, createDependencyOnBuildArtifacts, forceExitOnBuildCompletion) {
150
128
  var pluginName = "sentry-webpack-debug-id-upload-plugin";
151
129
  return {
@@ -176,32 +154,6 @@ function webpackDebugIdUploadPlugin(upload, logger, createDependencyOnBuildArtif
176
154
  }
177
155
  };
178
156
  }
179
- function webpackModuleMetadataInjectionPlugin(UnsafeBannerPlugin) {
180
- return function (injectionCode) {
181
- return {
182
- name: "sentry-webpack-module-metadata-injection-plugin",
183
- webpack: function webpack(compiler) {
184
- var _compiler$webpack4;
185
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
186
- // @ts-ignore webpack version compatibility shenanigans
187
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
188
- var BannerPlugin =
189
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
190
- // @ts-ignore webpack version compatibility shenanigans
191
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
192
- (compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack4 = compiler.webpack) === null || _compiler$webpack4 === void 0 ? void 0 : _compiler$webpack4.BannerPlugin) || UnsafeBannerPlugin;
193
- compiler.options.plugins = compiler.options.plugins || [];
194
- compiler.options.plugins.push(
195
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
196
- new BannerPlugin({
197
- raw: true,
198
- include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
199
- banner: injectionCode
200
- }));
201
- }
202
- };
203
- };
204
- }
205
157
 
206
158
  /**
207
159
  * The factory function accepts BannerPlugin and DefinePlugin classes in
@@ -216,10 +168,8 @@ function sentryWebpackUnpluginFactory() {
216
168
  BannerPlugin = _ref2.BannerPlugin,
217
169
  DefinePlugin = _ref2.DefinePlugin;
218
170
  return sentryUnpluginFactory({
219
- releaseInjectionPlugin: webpackReleaseInjectionPlugin(BannerPlugin),
171
+ injectionPlugin: webpackInjectionPlugin(BannerPlugin),
220
172
  componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin(),
221
- moduleMetadataInjectionPlugin: webpackModuleMetadataInjectionPlugin(BannerPlugin),
222
- debugIdInjectionPlugin: webpackDebugIdInjectionPlugin(BannerPlugin),
223
173
  debugIdUploadPlugin: webpackDebugIdUploadPlugin,
224
174
  bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin)
225
175
  });
@@ -1 +1 @@
1
- {"version":3,"file":"webpack4and5.mjs","sources":["../../src/webpack4and5.ts"],"sourcesContent":["import {\n getDebugIdSnippet,\n Options,\n sentryUnpluginFactory,\n stringToUUID,\n SentrySDKBuildFlags,\n createComponentNameAnnotateHooks,\n Logger,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"path\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version\n// https://github.com/webpack/webpack/commit/65eca2e529ce1d79b79200d4bdb1ce1b81141459\n\ninterface BannerPluginCallbackArg {\n chunk?: {\n hash?: string;\n contentHash?: {\n javascript?: string;\n };\n };\n}\n\ntype UnsafeBannerPlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\ntype UnsafeDefinePlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\nfunction webpackReleaseInjectionPlugin(\n UnsafeBannerPlugin: UnsafeBannerPlugin | undefined\n): (injectionCode: string) => UnpluginOptions {\n return (injectionCode: string): UnpluginOptions => ({\n name: \"sentry-webpack-release-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: injectionCode,\n })\n );\n },\n });\n}\n\nfunction webpackComponentNameAnnotatePlugin(): (ignoredComponents?: string[]) => UnpluginOptions {\n return (ignoredComponents?: string[]) => ({\n name: \"sentry-webpack-component-name-annotate-plugin\",\n enforce: \"pre\",\n // Webpack needs this hook for loader logic, so the plugin is not run on unsupported file types\n transformInclude(id) {\n return id.endsWith(\".tsx\") || id.endsWith(\".jsx\");\n },\n transform: createComponentNameAnnotateHooks(ignoredComponents).transform,\n });\n}\n\nfunction webpackBundleSizeOptimizationsPlugin(\n UnsafeDefinePlugin: UnsafeDefinePlugin | undefined\n): (replacementValues: SentrySDKBuildFlags) => UnpluginOptions {\n return (replacementValues: SentrySDKBuildFlags) => ({\n name: \"sentry-webpack-bundle-size-optimizations-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const DefinePlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.DefinePlugin || UnsafeDefinePlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new DefinePlugin({\n ...replacementValues,\n })\n );\n },\n });\n}\n\nfunction webpackDebugIdInjectionPlugin(\n UnsafeBannerPlugin: UnsafeBannerPlugin | undefined\n): () => UnpluginOptions {\n return () => ({\n name: \"sentry-webpack-debug-id-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: (arg?: BannerPluginCallbackArg) => {\n const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;\n const debugId = hash ? stringToUUID(hash) : uuidv4();\n return getDebugIdSnippet(debugId);\n },\n })\n );\n },\n });\n}\n\nfunction webpackDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>,\n logger: Logger,\n createDependencyOnBuildArtifacts: () => () => void,\n forceExitOnBuildCompletion?: boolean\n): UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-upload-plugin\";\n return {\n name: pluginName,\n webpack(compiler) {\n const freeGlobalDependencyOnDebugIdSourcemapArtifacts = createDependencyOnBuildArtifacts();\n\n compiler.hooks.afterEmit.tapAsync(pluginName, (compilation, callback: () => void) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const outputPath = (compilation.outputOptions.path as string | undefined) ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets as Record<string, unknown>).map(\n (asset) => path.join(outputPath, asset)\n );\n void upload(buildArtifacts)\n .then(() => {\n callback();\n })\n .finally(() => {\n freeGlobalDependencyOnDebugIdSourcemapArtifacts();\n });\n });\n\n if (forceExitOnBuildCompletion && compiler.options.mode === \"production\") {\n compiler.hooks.done.tap(pluginName, () => {\n setTimeout(() => {\n logger.debug(\"Exiting process after debug file upload\");\n process.exit(0);\n });\n });\n }\n },\n };\n}\n\nfunction webpackModuleMetadataInjectionPlugin(\n UnsafeBannerPlugin: UnsafeBannerPlugin | undefined\n): (injectionCode: string) => UnpluginOptions {\n return (injectionCode: string) => ({\n name: \"sentry-webpack-module-metadata-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: injectionCode,\n })\n );\n },\n });\n}\n\n/**\n * The factory function accepts BannerPlugin and DefinePlugin classes in\n * order to avoid direct dependencies on webpack.\n *\n * This allow us to export version of the plugin for webpack 5.1+ and compatible environments.\n *\n * Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.\n */\nexport function sentryWebpackUnpluginFactory({\n BannerPlugin,\n DefinePlugin,\n}: {\n BannerPlugin?: UnsafeBannerPlugin;\n DefinePlugin?: UnsafeDefinePlugin;\n} = {}): ReturnType<typeof sentryUnpluginFactory> {\n return sentryUnpluginFactory({\n releaseInjectionPlugin: webpackReleaseInjectionPlugin(BannerPlugin),\n componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin(),\n moduleMetadataInjectionPlugin: webpackModuleMetadataInjectionPlugin(BannerPlugin),\n debugIdInjectionPlugin: webpackDebugIdInjectionPlugin(BannerPlugin),\n debugIdUploadPlugin: webpackDebugIdUploadPlugin,\n bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin),\n });\n}\n\nexport type SentryWebpackPluginOptions = Options & {\n _experiments?: Options[\"_experiments\"] & {\n /**\n * If enabled, the webpack plugin will exit the build process after the build completes.\n * Use this with caution, as it will terminate the process.\n *\n * More information: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/345\n *\n * @default false\n */\n forceExitOnBuildCompletion?: boolean;\n };\n};\n"],"names":["webpackReleaseInjectionPlugin","UnsafeBannerPlugin","injectionCode","name","webpack","compiler","_compiler$webpack","BannerPlugin","options","plugins","push","raw","include","banner","webpackComponentNameAnnotatePlugin","ignoredComponents","enforce","transformInclude","id","endsWith","transform","createComponentNameAnnotateHooks","webpackBundleSizeOptimizationsPlugin","UnsafeDefinePlugin","replacementValues","_compiler$webpack2","DefinePlugin","_objectSpread","webpackDebugIdInjectionPlugin","_compiler$webpack3","arg","_arg$chunk$contentHas","_arg$chunk","_arg$chunk$contentHas2","_arg$chunk2","hash","chunk","contentHash","javascript","debugId","stringToUUID","uuidv4","getDebugIdSnippet","webpackDebugIdUploadPlugin","upload","logger","createDependencyOnBuildArtifacts","forceExitOnBuildCompletion","pluginName","freeGlobalDependencyOnDebugIdSourcemapArtifacts","hooks","afterEmit","tapAsync","compilation","callback","_ref","outputPath","outputOptions","path","resolve","buildArtifacts","Object","keys","assets","map","asset","join","then","mode","done","tap","setTimeout","debug","process","exit","webpackModuleMetadataInjectionPlugin","_compiler$webpack4","sentryWebpackUnpluginFactory","_ref2","arguments","length","undefined","sentryUnpluginFactory","releaseInjectionPlugin","componentNameAnnotatePlugin","moduleMetadataInjectionPlugin","debugIdInjectionPlugin","debugIdUploadPlugin","bundleSizeOptimizationsPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;AACA;AAqBA,SAASA,6BAA6BA,CACpCC,kBAAkD,EACN;AAC5C,EAAA,OAAO,UAACC,aAAqB,EAAA;IAAA,OAAuB;AAClDC,MAAAA,IAAI,EAAE,yCAAyC;MAC/CC,OAAO,EAAA,SAAAA,OAACC,CAAAA,QAAQ,EAAE;AAAA,QAAA,IAAAC,iBAAA,CAAA;AAChB;AACA;AACA;AACA,QAAA,IAAMC,YAAY;AAChB;AACA;AACA;AACA,QAAA,CAAAF,QAAQ,KAARA,IAAAA,IAAAA,QAAQ,KAAAC,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,CAAAA,iBAAA,GAARD,QAAQ,CAAED,OAAO,MAAA,IAAA,IAAAE,iBAAA,KAAjBA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,iBAAA,CAAmBC,YAAY,KAAIN,kBAAkB,CAAA;QAEvDI,QAAQ,CAACG,OAAO,CAACC,OAAO,GAAGJ,QAAQ,CAACG,OAAO,CAACC,OAAO,IAAI,EAAE,CAAA;AACzDJ,QAAAA,QAAQ,CAACG,OAAO,CAACC,OAAO,CAACC,IAAI;AAC3B;AACA,QAAA,IAAIH,YAAY,CAAC;AACfI,UAAAA,GAAG,EAAE,IAAI;AACTC,UAAAA,OAAO,EAAE,+CAA+C;AACxDC,UAAAA,MAAM,EAAEX,aAAAA;AACV,SAAC,CACH,CAAC,CAAA;AACH,OAAA;KACD,CAAA;GAAC,CAAA;AACJ,CAAA;AAEA,SAASY,kCAAkCA,GAAsD;AAC/F,EAAA,OAAO,UAACC,iBAA4B,EAAA;IAAA,OAAM;AACxCZ,MAAAA,IAAI,EAAE,+C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H,YAAY,CAAC;AACfI,UAAAA,GAAG,EAAE,IAAI;AACTC,UAAAA,OAAO,EAAE,+CAA+C;AACxDC,UAAAA,MAAM,EAAEX,aAAAA;AACV,SAAC,CACH,CAAC,CAAA;AACH,OAAA;KACD,CAAA;GAAC,CAAA;AACJ,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS2E,4BAA4BA,GAMM;AAAA,EAAA,IAAAC,KAAA,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAA9C,EAAE;IALJxE,YAAY,GAAAuE,KAAA,CAAZvE,YAAY;IACZmB,YAAY,GAAAoD,KAAA,CAAZpD,YAAY,CAAA;AAKZ,EAAA,OAAOwD,qBAAqB,CAAC;AAC3BC,IAAAA,sBAAsB,EAAEnF,6BAA6B,CAACO,YAAY,CAAC;IACnE6E,2BAA2B,EAAEtE,kCAAkC,EAAE;AACjEuE,IAAAA,6BAA6B,EAAEV,oCAAoC,CAACpE,YAAY,CAAC;AACjF+E,IAAAA,sBAAsB,EAAE1D,6BAA6B,CAACrB,YAAY,CAAC;AACnEgF,IAAAA,mBAAmB,EAAE5C,0BAA0B;IAC/C6C,6BAA6B,EAAElE,oCAAoC,CAACI,YAAY,CAAA;AAClF,GAAC,CAAC,CAAA;AACJ;;;;"}
1
+ {"version":3,"file":"webpack4and5.mjs","sources":["../../src/webpack4and5.ts"],"sourcesContent":["import {\n Options,\n sentryUnpluginFactory,\n stringToUUID,\n SentrySDKBuildFlags,\n createComponentNameAnnotateHooks,\n Logger,\n CodeInjection,\n getDebugIdSnippet,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"path\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version\n// https://github.com/webpack/webpack/commit/65eca2e529ce1d79b79200d4bdb1ce1b81141459\n\ninterface BannerPluginCallbackArg {\n chunk?: {\n hash?: string;\n contentHash?: {\n javascript?: string;\n };\n };\n}\n\ntype UnsafeBannerPlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\ntype UnsafeDefinePlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\nfunction webpackInjectionPlugin(\n UnsafeBannerPlugin: UnsafeBannerPlugin | undefined\n): (injectionCode: CodeInjection, debugIds: boolean) => UnpluginOptions {\n return (injectionCode: CodeInjection, debugIds: boolean): UnpluginOptions => ({\n name: \"sentry-webpack-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: (arg?: BannerPluginCallbackArg) => {\n const codeToInject = injectionCode.clone();\n if (debugIds) {\n const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;\n const debugId = hash ? stringToUUID(hash) : uuidv4();\n codeToInject.append(getDebugIdSnippet(debugId));\n }\n return codeToInject.code();\n },\n })\n );\n },\n });\n}\n\nfunction webpackComponentNameAnnotatePlugin(): (\n ignoredComponents: string[],\n injectIntoHtml: boolean\n) => UnpluginOptions {\n return (ignoredComponents: string[], injectIntoHtml: boolean) => ({\n name: \"sentry-webpack-component-name-annotate-plugin\",\n enforce: \"pre\",\n // Webpack needs this hook for loader logic, so the plugin is not run on unsupported file types\n transformInclude(id) {\n return id.endsWith(\".tsx\") || id.endsWith(\".jsx\");\n },\n transform: createComponentNameAnnotateHooks(ignoredComponents, injectIntoHtml).transform,\n });\n}\n\nfunction webpackBundleSizeOptimizationsPlugin(\n UnsafeDefinePlugin: UnsafeDefinePlugin | undefined\n): (replacementValues: SentrySDKBuildFlags) => UnpluginOptions {\n return (replacementValues: SentrySDKBuildFlags) => ({\n name: \"sentry-webpack-bundle-size-optimizations-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const DefinePlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.DefinePlugin || UnsafeDefinePlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new DefinePlugin({\n ...replacementValues,\n })\n );\n },\n });\n}\n\nfunction webpackDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>,\n logger: Logger,\n createDependencyOnBuildArtifacts: () => () => void,\n forceExitOnBuildCompletion?: boolean\n): UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-upload-plugin\";\n return {\n name: pluginName,\n webpack(compiler) {\n const freeGlobalDependencyOnDebugIdSourcemapArtifacts = createDependencyOnBuildArtifacts();\n\n compiler.hooks.afterEmit.tapAsync(pluginName, (compilation, callback: () => void) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const outputPath = (compilation.outputOptions.path as string | undefined) ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets as Record<string, unknown>).map(\n (asset) => path.join(outputPath, asset)\n );\n void upload(buildArtifacts)\n .then(() => {\n callback();\n })\n .finally(() => {\n freeGlobalDependencyOnDebugIdSourcemapArtifacts();\n });\n });\n\n if (forceExitOnBuildCompletion && compiler.options.mode === \"production\") {\n compiler.hooks.done.tap(pluginName, () => {\n setTimeout(() => {\n logger.debug(\"Exiting process after debug file upload\");\n process.exit(0);\n });\n });\n }\n },\n };\n}\n\n/**\n * The factory function accepts BannerPlugin and DefinePlugin classes in\n * order to avoid direct dependencies on webpack.\n *\n * This allow us to export version of the plugin for webpack 5.1+ and compatible environments.\n *\n * Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.\n */\nexport function sentryWebpackUnpluginFactory({\n BannerPlugin,\n DefinePlugin,\n}: {\n BannerPlugin?: UnsafeBannerPlugin;\n DefinePlugin?: UnsafeDefinePlugin;\n} = {}): ReturnType<typeof sentryUnpluginFactory> {\n return sentryUnpluginFactory({\n injectionPlugin: webpackInjectionPlugin(BannerPlugin),\n componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin(),\n debugIdUploadPlugin: webpackDebugIdUploadPlugin,\n bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin),\n });\n}\n\nexport type SentryWebpackPluginOptions = Options & {\n _experiments?: Options[\"_experiments\"] & {\n /**\n * If enabled, the webpack plugin will exit the build process after the build completes.\n * Use this with caution, as it will terminate the process.\n *\n * More information: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/345\n *\n * @default false\n */\n forceExitOnBuildCompletion?: boolean;\n };\n};\n"],"names":["webpackInjectionPlugin","UnsafeBannerPlugin","injectionCode","debugIds","name","webpack","compiler","_compiler$webpack","BannerPlugin","options","plugins","push","raw","include","banner","arg","codeToInject","clone","_arg$chunk$contentHas","_arg$chunk","_arg$chunk$contentHas2","_arg$chunk2","hash","chunk","contentHash","javascript","debugId","stringToUUID","uuidv4","append","getDebugIdSnippet","code","webpackComponentNameAnnotatePlugin","ignoredComponents","injectIntoHtml","enforce","transformInclude","id","endsWith","transform","createComponentNameAnnotateHooks","webpackBundleSizeOptimizationsPlugin","UnsafeDefinePlugin","replacementValues","_compiler$webpack2","DefinePlugin","_objectSpread","webpackDebugIdUploadPlugin","upload","logger","createDependencyOnBuildArtifacts","forceExitOnBuildCompletion","pluginName","freeGlobalDependencyOnDebugIdSourcemapArtifacts","hooks","afterEmit","tapAsync","compilation","callback","_ref","outputPath","outputOptions","path","resolve","buildArtifacts","Object","keys","assets","map","asset","join","then","mode","done","tap","setTimeout","debug","process","exit","sentryWebpackUnpluginFactory","_ref2","arguments","length","undefined","sentryUnpluginFactory","injectionPlugin","componentNameAnnotatePlugin","debugIdUploadPlugin","bundleSizeOptimizationsPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA;AACA;AAqBA,SAASA,sBAAsBA,CAC7BC,kBAAkD,EACoB;EACtE,OAAO,UAACC,aAA4B,EAAEC,QAAiB,EAAA;IAAA,OAAuB;AAC5EC,MAAAA,IAAI,EAAE,iCAAiC;MACvCC,OAAO,EAAA,SAAAA,OAACC,CAAAA,QAAQ,EAAE;AAAA,QAAA,IAAAC,iBAAA,CAAA;AAChB;AACA;AACA;AACA,QAAA,IAAMC,YAAY;AAChB;AACA;AACA;AACA,QAAA,CAAAF,QAAQ,KAARA,IAAAA,IAAAA,QAAQ,KAAAC,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,CAAAA,iBAAA,GAARD,QAAQ,CAAED,OAAO,MAAA,IAAA,IAAAE,iBAAA,KAAjBA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,iBAAA,CAAmBC,YAAY,KAAIP,kBAAkB,CAAA;QAEvDK,QAAQ,CAACG,OAAO,CAACC,OAAO,GAAGJ,QAAQ,CAACG,OAAO,CAACC,OAAO,IAAI,EAAE,CAAA;AACzDJ,QAAA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AA,MAAM,CAAC2B,KAAK,CAAC,yCAAyC,CAAC,CAAA;AACvDC,YAAAA,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,WAAC,CAAC,CAAA;AACJ,SAAC,CAAC,CAAA;AACJ,OAAA;AACF,KAAA;GACD,CAAA;AACH,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,4BAA4BA,GAMM;AAAA,EAAA,IAAAC,KAAA,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAA9C,EAAE;IALJzE,YAAY,GAAAwE,KAAA,CAAZxE,YAAY;IACZqC,YAAY,GAAAmC,KAAA,CAAZnC,YAAY,CAAA;AAKZ,EAAA,OAAOuC,qBAAqB,CAAC;AAC3BC,IAAAA,eAAe,EAAErF,sBAAsB,CAACQ,YAAY,CAAC;IACrD8E,2BAA2B,EAAEtD,kCAAkC,EAAE;AACjEuD,IAAAA,mBAAmB,EAAExC,0BAA0B;IAC/CyC,6BAA6B,EAAE/C,oCAAoC,CAACI,YAAY,CAAA;AAClF,GAAC,CAAC,CAAA;AACJ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/webpack-plugin",
3
- "version": "4.6.2",
3
+ "version": "4.8.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",
@@ -53,7 +53,7 @@
53
53
  "prepack": "ts-node ./src/prepack.ts"
54
54
  },
55
55
  "dependencies": {
56
- "@sentry/bundler-plugin-core": "4.6.2",
56
+ "@sentry/bundler-plugin-core": "4.8.0",
57
57
  "unplugin": "1.0.1",
58
58
  "uuid": "^9.0.0"
59
59
  },
@@ -63,8 +63,8 @@
63
63
  "@babel/preset-typescript": "7.17.12",
64
64
  "@rollup/plugin-babel": "5.3.1",
65
65
  "@rollup/plugin-commonjs": "22.0.1",
66
- "@sentry-internal/eslint-config": "4.6.2",
67
- "@sentry-internal/sentry-bundler-plugin-tsconfig": "4.6.2",
66
+ "@sentry-internal/eslint-config": "4.8.0",
67
+ "@sentry-internal/sentry-bundler-plugin-tsconfig": "4.8.0",
68
68
  "@swc/core": "^1.2.205",
69
69
  "@swc/jest": "^0.2.21",
70
70
  "@types/jest": "^28.1.3",