@sentry/webpack-plugin 4.8.0 → 4.9.1
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/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/webpack4and5.js +19 -1
- package/dist/cjs/webpack4and5.js.map +1 -1
- package/dist/cjs/webpack5.js +1 -0
- package/dist/cjs/webpack5.js.map +1 -1
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/webpack4and5.mjs +19 -1
- package/dist/esm/webpack4and5.mjs.map +1 -1
- package/dist/esm/webpack5.mjs +1 -0
- package/dist/esm/webpack5.mjs.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var webpack4and5 = require('./webpack4and5.js');
|
|
6
6
|
var webpack4or5 = require('webpack');
|
|
7
7
|
var bundlerPluginCore = require('@sentry/bundler-plugin-core');
|
|
8
|
+
require('node:module');
|
|
8
9
|
require('path');
|
|
9
10
|
require('uuid');
|
|
10
11
|
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackUnpluginFactory } from \"./webpack4and5\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore webpack is a peer dep\nimport * as webpack4or5 from \"webpack\";\n\nconst BannerPlugin = webpack4or5?.BannerPlugin || webpack4or5?.default?.BannerPlugin;\n\nconst DefinePlugin = webpack4or5?.DefinePlugin || webpack4or5?.default?.DefinePlugin;\n\nconst sentryUnplugin = sentryWebpackUnpluginFactory({\n BannerPlugin,\n DefinePlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"names":["BannerPlugin","webpack4or5","_webpack4or5$default","DefinePlugin","_webpack4or5$default2","sentryUnplugin","sentryWebpackUnpluginFactory","sentryWebpackPlugin","webpack"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackUnpluginFactory } from \"./webpack4and5\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore webpack is a peer dep\nimport * as webpack4or5 from \"webpack\";\n\nconst BannerPlugin = webpack4or5?.BannerPlugin || webpack4or5?.default?.BannerPlugin;\n\nconst DefinePlugin = webpack4or5?.DefinePlugin || webpack4or5?.default?.DefinePlugin;\n\nconst sentryUnplugin = sentryWebpackUnpluginFactory({\n BannerPlugin,\n DefinePlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"names":["BannerPlugin","webpack4or5","_webpack4or5$default","DefinePlugin","_webpack4or5$default2","sentryUnplugin","sentryWebpackUnpluginFactory","sentryWebpackPlugin","webpack"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAMA,YAAY,GAAG,CAAAC,sBAAW,KAAA,IAAA,IAAXA,sBAAW,KAAXA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,sBAAW,CAAED,YAAY,MAAIC,sBAAW,aAAXA,sBAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAAC,oBAAA,GAAXD,sBAAW,CAAA,SAAA,CAAS,cAAAC,oBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAApBA,oBAAA,CAAsBF,YAAY,CAAA,CAAA;AAEpF,IAAMG,YAAY,GAAG,CAAAF,sBAAW,KAAA,IAAA,IAAXA,sBAAW,KAAXA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,sBAAW,CAAEE,YAAY,MAAIF,sBAAW,aAAXA,sBAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAAG,qBAAA,GAAXH,sBAAW,CAAA,SAAA,CAAS,cAAAG,qBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAApBA,qBAAA,CAAsBD,YAAY,CAAA,CAAA;AAEpF,IAAME,cAAc,GAAGC,yCAA4B,CAAC;AAClDN,EAAAA,YAAY,EAAZA,YAAY;AACZG,EAAAA,YAAY,EAAZA,YAAAA;AACF,CAAC,CAAC,CAAA;;AAEF;AACaI,IAAAA,mBAAkE,GAC7EF,cAAc,CAACG;;;;;;;;"}
|
package/dist/cjs/webpack4and5.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var bundlerPluginCore = require('@sentry/bundler-plugin-core');
|
|
4
|
+
var node_module = require('node:module');
|
|
4
5
|
var path = require('path');
|
|
5
6
|
var uuid = require('uuid');
|
|
6
7
|
|
|
@@ -177,6 +178,22 @@ function webpackDebugIdUploadPlugin(upload, logger, createDependencyOnBuildArtif
|
|
|
177
178
|
};
|
|
178
179
|
}
|
|
179
180
|
|
|
181
|
+
// Detect webpack major version for telemetry (helps differentiate webpack 4 vs 5 usage)
|
|
182
|
+
function getWebpackMajorVersion() {
|
|
183
|
+
try {
|
|
184
|
+
var _webpack$version, _webpack$default;
|
|
185
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
186
|
+
// @ts-ignore - Rollup already transpiles this for us
|
|
187
|
+
var req = node_module.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('webpack4and5.js', document.baseURI).href)));
|
|
188
|
+
var webpack = req("webpack");
|
|
189
|
+
var version = (_webpack$version = webpack === null || webpack === void 0 ? void 0 : webpack.version) !== null && _webpack$version !== void 0 ? _webpack$version : webpack === null || webpack === void 0 ? void 0 : (_webpack$default = webpack["default"]) === null || _webpack$default === void 0 ? void 0 : _webpack$default.version;
|
|
190
|
+
var webpackMajorVersion = version === null || version === void 0 ? void 0 : version.split(".")[0]; // "4" or "5"
|
|
191
|
+
return webpackMajorVersion;
|
|
192
|
+
} catch (error) {
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
180
197
|
/**
|
|
181
198
|
* The factory function accepts BannerPlugin and DefinePlugin classes in
|
|
182
199
|
* order to avoid direct dependencies on webpack.
|
|
@@ -193,7 +210,8 @@ function sentryWebpackUnpluginFactory() {
|
|
|
193
210
|
injectionPlugin: webpackInjectionPlugin(BannerPlugin),
|
|
194
211
|
componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin(),
|
|
195
212
|
debugIdUploadPlugin: webpackDebugIdUploadPlugin,
|
|
196
|
-
bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin)
|
|
213
|
+
bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin),
|
|
214
|
+
getBundlerMajorVersion: getWebpackMajorVersion
|
|
197
215
|
});
|
|
198
216
|
}
|
|
199
217
|
|
|
@@ -1 +1 @@
|
|
|
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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gD,KAAK,CAACmB,IAAI,CAACC,GAAG,CAACtB,UAAU,EAAE,YAAM;AACxCuB,UAAAA,UAAU,CAAC,YAAM;AACf1B,YAAAA,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,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
|
+
{"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 { createRequire } from \"node:module\";\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// Detect webpack major version for telemetry (helps differentiate webpack 4 vs 5 usage)\nfunction getWebpackMajorVersion(): string | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Rollup already transpiles this for us\n const req = createRequire(import.meta.url);\n const webpack = req(\"webpack\") as { version?: string; default?: { version?: string } };\n const version = webpack?.version ?? webpack?.default?.version;\n const webpackMajorVersion = version?.split(\".\")[0]; // \"4\" or \"5\"\n return webpackMajorVersion;\n } catch (error) {\n return undefined;\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 getBundlerMajorVersion: getWebpackMajorVersion,\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","getWebpackMajorVersion","_webpack$version","_webpack$default","req","createRequire","import","version","webpackMajorVersion","split","error","undefined","sentryWebpackUnpluginFactory","_ref2","arguments","length","sentryUnpluginFactory","injectionPlugin","componentNameAnnotatePlugin","debugIdUploadPlugin","bundleSizeOptimizationsPlugin","getBundlerMajorVersion"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA;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,Q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AAS,MAAA4E,IAAAA,IAAAA,gBAAA,KAAhBA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,gBAAA,CAAkBI,OAAO,CAAA;AAC7D,IAAA,IAAMC,mBAAmB,GAAGD,OAAO,KAAPA,IAAAA,IAAAA,OAAO,uBAAPA,OAAO,CAAEE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACnD,IAAA,OAAOD,mBAAmB,CAAA;GAC3B,CAAC,OAAOE,KAAK,EAAE;AACd,IAAA,OAAOC,SAAS,CAAA;AAClB,GAAA;AACF,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,KAAAH,SAAA,GAAAG,SAAA,CAAA,CAAA,CAAA,GAA9C,EAAE;IALJpF,YAAY,GAAAmF,KAAA,CAAZnF,YAAY;IACZqC,YAAY,GAAA8C,KAAA,CAAZ9C,YAAY,CAAA;AAKZ,EAAA,OAAOiD,uCAAqB,CAAC;AAC3BC,IAAAA,eAAe,EAAE/F,sBAAsB,CAACQ,YAAY,CAAC;IACrDwF,2BAA2B,EAAEhE,kCAAkC,EAAE;AACjEiE,IAAAA,mBAAmB,EAAElD,0BAA0B;AAC/CmD,IAAAA,6BAA6B,EAAEzD,oCAAoC,CAACI,YAAY,CAAC;AACjFsD,IAAAA,sBAAsB,EAAEpB,sBAAAA;AAC1B,GAAC,CAAC,CAAA;AACJ;;;;"}
|
package/dist/cjs/webpack5.js
CHANGED
package/dist/cjs/webpack5.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack5.js","sources":["../../src/webpack5.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackUnpluginFactory } from \"./webpack4and5\";\n\nconst sentryUnplugin = sentryWebpackUnpluginFactory();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"names":["sentryUnplugin","sentryWebpackUnpluginFactory","sentryWebpackPlugin","webpack"],"mappings":"
|
|
1
|
+
{"version":3,"file":"webpack5.js","sources":["../../src/webpack5.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackUnpluginFactory } from \"./webpack4and5\";\n\nconst sentryUnplugin = sentryWebpackUnpluginFactory();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"names":["sentryUnplugin","sentryWebpackUnpluginFactory","sentryWebpackPlugin","webpack"],"mappings":";;;;;;;;;;AAEA,IAAMA,cAAc,GAAGC,yCAA4B,EAAE,CAAA;;AAErD;AACaC,IAAAA,mBAAkE,GAC7EF,cAAc,CAACG;;;;;;;;"}
|
package/dist/esm/index.mjs
CHANGED
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackUnpluginFactory } from \"./webpack4and5\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore webpack is a peer dep\nimport * as webpack4or5 from \"webpack\";\n\nconst BannerPlugin = webpack4or5?.BannerPlugin || webpack4or5?.default?.BannerPlugin;\n\nconst DefinePlugin = webpack4or5?.DefinePlugin || webpack4or5?.default?.DefinePlugin;\n\nconst sentryUnplugin = sentryWebpackUnpluginFactory({\n BannerPlugin,\n DefinePlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"names":["BannerPlugin","webpack4or5","_webpack4or5$default","DefinePlugin","_webpack4or5$default2","sentryUnplugin","sentryWebpackUnpluginFactory","sentryWebpackPlugin","webpack"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackUnpluginFactory } from \"./webpack4and5\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore webpack is a peer dep\nimport * as webpack4or5 from \"webpack\";\n\nconst BannerPlugin = webpack4or5?.BannerPlugin || webpack4or5?.default?.BannerPlugin;\n\nconst DefinePlugin = webpack4or5?.DefinePlugin || webpack4or5?.default?.DefinePlugin;\n\nconst sentryUnplugin = sentryWebpackUnpluginFactory({\n BannerPlugin,\n DefinePlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"names":["BannerPlugin","webpack4or5","_webpack4or5$default","DefinePlugin","_webpack4or5$default2","sentryUnplugin","sentryWebpackUnpluginFactory","sentryWebpackPlugin","webpack"],"mappings":";;;;;;;;AAMA,IAAMA,YAAY,GAAG,CAAAC,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAXA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,WAAW,CAAED,YAAY,MAAIC,WAAW,aAAXA,WAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAAC,oBAAA,GAAXD,WAAW,CAAA,SAAA,CAAS,cAAAC,oBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAApBA,oBAAA,CAAsBF,YAAY,CAAA,CAAA;AAEpF,IAAMG,YAAY,GAAG,CAAAF,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAXA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,WAAW,CAAEE,YAAY,MAAIF,WAAW,aAAXA,WAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAAG,qBAAA,GAAXH,WAAW,CAAA,SAAA,CAAS,cAAAG,qBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAApBA,qBAAA,CAAsBD,YAAY,CAAA,CAAA;AAEpF,IAAME,cAAc,GAAGC,4BAA4B,CAAC;AAClDN,EAAAA,YAAY,EAAZA,YAAY;AACZG,EAAAA,YAAY,EAAZA,YAAAA;AACF,CAAC,CAAC,CAAA;;AAEF;AACaI,IAAAA,mBAAkE,GAC7EF,cAAc,CAACG;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { sentryUnpluginFactory, stringToUUID, getDebugIdSnippet, createComponentNameAnnotateHooks } from '@sentry/bundler-plugin-core';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
2
3
|
import * as path from 'path';
|
|
3
4
|
import { v4 } from 'uuid';
|
|
4
5
|
|
|
@@ -155,6 +156,22 @@ function webpackDebugIdUploadPlugin(upload, logger, createDependencyOnBuildArtif
|
|
|
155
156
|
};
|
|
156
157
|
}
|
|
157
158
|
|
|
159
|
+
// Detect webpack major version for telemetry (helps differentiate webpack 4 vs 5 usage)
|
|
160
|
+
function getWebpackMajorVersion() {
|
|
161
|
+
try {
|
|
162
|
+
var _webpack$version, _webpack$default;
|
|
163
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
164
|
+
// @ts-ignore - Rollup already transpiles this for us
|
|
165
|
+
var req = createRequire(import.meta.url);
|
|
166
|
+
var webpack = req("webpack");
|
|
167
|
+
var version = (_webpack$version = webpack === null || webpack === void 0 ? void 0 : webpack.version) !== null && _webpack$version !== void 0 ? _webpack$version : webpack === null || webpack === void 0 ? void 0 : (_webpack$default = webpack["default"]) === null || _webpack$default === void 0 ? void 0 : _webpack$default.version;
|
|
168
|
+
var webpackMajorVersion = version === null || version === void 0 ? void 0 : version.split(".")[0]; // "4" or "5"
|
|
169
|
+
return webpackMajorVersion;
|
|
170
|
+
} catch (error) {
|
|
171
|
+
return undefined;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
158
175
|
/**
|
|
159
176
|
* The factory function accepts BannerPlugin and DefinePlugin classes in
|
|
160
177
|
* order to avoid direct dependencies on webpack.
|
|
@@ -171,7 +188,8 @@ function sentryWebpackUnpluginFactory() {
|
|
|
171
188
|
injectionPlugin: webpackInjectionPlugin(BannerPlugin),
|
|
172
189
|
componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin(),
|
|
173
190
|
debugIdUploadPlugin: webpackDebugIdUploadPlugin,
|
|
174
|
-
bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin)
|
|
191
|
+
bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin),
|
|
192
|
+
getBundlerMajorVersion: getWebpackMajorVersion
|
|
175
193
|
});
|
|
176
194
|
}
|
|
177
195
|
|
|
@@ -1 +1 @@
|
|
|
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,QAAAA,QAAQ,CAACG,OAAO,CAACC,OAAO,CAACC,IAAI;AAC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;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;;;;"}
|
|
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 { createRequire } from \"node:module\";\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// Detect webpack major version for telemetry (helps differentiate webpack 4 vs 5 usage)\nfunction getWebpackMajorVersion(): string | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Rollup already transpiles this for us\n const req = createRequire(import.meta.url);\n const webpack = req(\"webpack\") as { version?: string; default?: { version?: string } };\n const version = webpack?.version ?? webpack?.default?.version;\n const webpackMajorVersion = version?.split(\".\")[0]; // \"4\" or \"5\"\n return webpackMajorVersion;\n } catch (error) {\n return undefined;\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 getBundlerMajorVersion: getWebpackMajorVersion,\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","getWebpackMajorVersion","_webpack$version","_webpack$default","req","createRequire","import","meta","url","version","webpackMajorVersion","split","error","undefined","sentryWebpackUnpluginFactory","_ref2","arguments","length","sentryUnpluginFactory","injectionPlugin","componentNameAnnotatePlugin","debugIdUploadPlugin","bundleSizeOptimizationsPlugin","getBundlerMajorVersion"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA;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,CAAA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AAO,KAAPA,IAAAA,IAAAA,OAAO,uBAAPA,OAAO,CAAEE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACnD,IAAA,OAAOD,mBAAmB,CAAA;GAC3B,CAAC,OAAOE,KAAK,EAAE;AACd,IAAA,OAAOC,SAAS,CAAA;AAClB,GAAA;AACF,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,KAAAH,SAAA,GAAAG,SAAA,CAAA,CAAA,CAAA,GAA9C,EAAE;IALJtF,YAAY,GAAAqF,KAAA,CAAZrF,YAAY;IACZqC,YAAY,GAAAgD,KAAA,CAAZhD,YAAY,CAAA;AAKZ,EAAA,OAAOmD,qBAAqB,CAAC;AAC3BC,IAAAA,eAAe,EAAEjG,sBAAsB,CAACQ,YAAY,CAAC;IACrD0F,2BAA2B,EAAElE,kCAAkC,EAAE;AACjEmE,IAAAA,mBAAmB,EAAEpD,0BAA0B;AAC/CqD,IAAAA,6BAA6B,EAAE3D,oCAAoC,CAACI,YAAY,CAAC;AACjFwD,IAAAA,sBAAsB,EAAEtB,sBAAAA;AAC1B,GAAC,CAAC,CAAA;AACJ;;;;"}
|
package/dist/esm/webpack5.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack5.mjs","sources":["../../src/webpack5.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackUnpluginFactory } from \"./webpack4and5\";\n\nconst sentryUnplugin = sentryWebpackUnpluginFactory();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"names":["sentryUnplugin","sentryWebpackUnpluginFactory","sentryWebpackPlugin","webpack"],"mappings":"
|
|
1
|
+
{"version":3,"file":"webpack5.mjs","sources":["../../src/webpack5.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackUnpluginFactory } from \"./webpack4and5\";\n\nconst sentryUnplugin = sentryWebpackUnpluginFactory();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"names":["sentryUnplugin","sentryWebpackUnpluginFactory","sentryWebpackPlugin","webpack"],"mappings":";;;;;;AAEA,IAAMA,cAAc,GAAGC,4BAA4B,EAAE,CAAA;;AAErD;AACaC,IAAAA,mBAAkE,GAC7EF,cAAc,CAACG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/webpack-plugin",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.1",
|
|
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.
|
|
56
|
+
"@sentry/bundler-plugin-core": "4.9.1",
|
|
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.
|
|
67
|
-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "4.
|
|
66
|
+
"@sentry-internal/eslint-config": "4.9.1",
|
|
67
|
+
"@sentry-internal/sentry-bundler-plugin-tsconfig": "4.9.1",
|
|
68
68
|
"@swc/core": "^1.2.205",
|
|
69
69
|
"@swc/jest": "^0.2.21",
|
|
70
70
|
"@types/jest": "^28.1.3",
|