@sentry/webpack-plugin 4.9.0 → 5.0.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.
@@ -0,0 +1,22 @@
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+
3
+ //#region src/component-annotation-transform.ts
4
+ async function transform(source, map) {
5
+ const callback = this.async();
6
+ const { transform: transformFn } = this.query;
7
+ if (!transformFn) return callback(null, source, map);
8
+ try {
9
+ const id = this.resourcePath;
10
+ const result = await transformFn(source, id);
11
+ if (result == null) callback(null, source, map);
12
+ else if (typeof result === "string") callback(null, result, map);
13
+ else callback(null, result.code, result.map || map);
14
+ } catch (error) {
15
+ if (error instanceof Error) callback(error);
16
+ else callback(new Error(String(error)));
17
+ }
18
+ }
19
+
20
+ //#endregion
21
+ exports.default = transform;
22
+ //# sourceMappingURL=component-annotation-transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-annotation-transform.js","names":[],"sources":["../../src/component-annotation-transform.ts"],"sourcesContent":["// Webpack loader for component annotation transform\n// Based on unplugin v1.0.1 transform loader pattern\n\nexport default async function transform(\n this: {\n async: () => (err: Error | null, content?: string, sourceMap?: unknown) => void;\n resourcePath: string;\n query: {\n transform?: (\n code: string,\n id: string\n ) => Promise<{ code: string; map?: unknown } | null | undefined | string>;\n };\n },\n source: string,\n map: unknown\n): Promise<void> {\n const callback = this.async();\n const { transform: transformFn } = this.query;\n\n if (!transformFn) {\n return callback(null, source, map);\n }\n\n try {\n const id = this.resourcePath;\n const result = await transformFn(source, id);\n\n if (result == null) {\n callback(null, source, map);\n } else if (typeof result === \"string\") {\n callback(null, result, map);\n } else {\n callback(null, result.code, result.map || map);\n }\n } catch (error) {\n if (error instanceof Error) {\n callback(error);\n } else {\n callback(new Error(String(error)));\n }\n }\n}\n"],"mappings":";;;AAGA,eAA8B,UAW5B,QACA,KACe;CACf,MAAM,WAAW,KAAK,OAAO;CAC7B,MAAM,EAAE,WAAW,gBAAgB,KAAK;AAExC,KAAI,CAAC,YACH,QAAO,SAAS,MAAM,QAAQ,IAAI;AAGpC,KAAI;EACF,MAAM,KAAK,KAAK;EAChB,MAAM,SAAS,MAAM,YAAY,QAAQ,GAAG;AAE5C,MAAI,UAAU,KACZ,UAAS,MAAM,QAAQ,IAAI;WAClB,OAAO,WAAW,SAC3B,UAAS,MAAM,QAAQ,IAAI;MAE3B,UAAS,MAAM,OAAO,MAAM,OAAO,OAAO,IAAI;UAEzC,OAAO;AACd,MAAI,iBAAiB,MACnB,UAAS,MAAM;MAEf,UAAS,IAAI,MAAM,OAAO,MAAM,CAAC,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -1,71 +1,158 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var webpack4and5 = require('./webpack4and5.js');
6
- var webpack4or5 = require('webpack');
7
- var bundlerPluginCore = require('@sentry/bundler-plugin-core');
8
- require('path');
9
- require('uuid');
10
-
11
- function _interopNamespace(e) {
12
- if (e && e.__esModule) return e;
13
- var n = Object.create(null);
14
- if (e) {
15
- Object.keys(e).forEach(function (k) {
16
- if (k !== 'default') {
17
- var d = Object.getOwnPropertyDescriptor(e, k);
18
- Object.defineProperty(n, k, d.get ? d : {
19
- enumerable: true,
20
- get: function () { return e[k]; }
21
- });
22
- }
23
- });
24
- }
25
- n["default"] = e;
26
- return Object.freeze(n);
27
- }
28
-
29
- var webpack4or5__namespace = /*#__PURE__*/_interopNamespace(webpack4or5);
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) {
14
+ __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ }
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
30
27
 
31
- var _webpack4or5$default, _webpack4or5$default2;
32
- var BannerPlugin = (webpack4or5__namespace === null || webpack4or5__namespace === void 0 ? void 0 : webpack4or5__namespace.BannerPlugin) || (webpack4or5__namespace === null || webpack4or5__namespace === void 0 ? void 0 : (_webpack4or5$default = webpack4or5__namespace["default"]) === null || _webpack4or5$default === void 0 ? void 0 : _webpack4or5$default.BannerPlugin);
33
- var DefinePlugin = (webpack4or5__namespace === null || webpack4or5__namespace === void 0 ? void 0 : webpack4or5__namespace.DefinePlugin) || (webpack4or5__namespace === null || webpack4or5__namespace === void 0 ? void 0 : (_webpack4or5$default2 = webpack4or5__namespace["default"]) === null || _webpack4or5$default2 === void 0 ? void 0 : _webpack4or5$default2.DefinePlugin);
28
+ //#endregion
29
+ let _sentry_bundler_plugin_core = require("@sentry/bundler-plugin-core");
30
+ let node_path = require("node:path");
31
+ node_path = __toESM(node_path);
32
+ let node_url = require("node:url");
33
+ let node_module = require("node:module");
34
+ let uuid = require("uuid");
35
+ let webpack = require("webpack");
36
+ webpack = __toESM(webpack);
34
37
 
35
- // Detect webpack major version for telemetry (helps differentiate webpack 4 vs 5 usage)
38
+ //#region src/webpack4and5.ts
39
+ const dirname = node_path.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
40
+ const COMPONENT_ANNOTATION_LOADER = node_path.resolve(dirname, typeof __dirname !== "undefined" ? "component-annotation-transform.js" : "component-annotation-transform.mjs");
36
41
  function getWebpackMajorVersion() {
37
- try {
38
- var _webpack$version, _webpack$default;
39
- var webpack = webpack4or5__namespace;
40
- 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;
41
- var _webpackMajorVersion = version === null || version === void 0 ? void 0 : version.split(".")[0]; // "4" or "5"
42
- return _webpackMajorVersion;
43
- } catch (error) {
44
- return undefined;
45
- }
42
+ try {
43
+ const webpack = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("webpack");
44
+ return (webpack?.version ?? webpack?.default?.version)?.split(".")[0];
45
+ } catch (error) {
46
+ return;
47
+ }
48
+ }
49
+ /**
50
+ * The factory function accepts BannerPlugin and DefinePlugin classes in
51
+ * order to avoid direct dependencies on webpack.
52
+ *
53
+ * This allow us to export version of the plugin for webpack 5.1+ and compatible environments.
54
+ *
55
+ * Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.
56
+ */
57
+ function sentryWebpackPluginFactory({ BannerPlugin: UnsafeBannerPlugin, DefinePlugin: UnsafeDefinePlugin } = {}) {
58
+ return function sentryWebpackPlugin(userOptions = {}) {
59
+ const sentryBuildPluginManager = (0, _sentry_bundler_plugin_core.createSentryBuildPluginManager)(userOptions, {
60
+ loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? "[sentry-webpack-plugin]",
61
+ buildTool: "webpack",
62
+ buildToolMajorVersion: getWebpackMajorVersion()
63
+ });
64
+ const { logger, normalizedOptions: options, bundleSizeOptimizationReplacementValues: replacementValues, bundleMetadata, createDependencyOnBuildArtifacts } = sentryBuildPluginManager;
65
+ if (options.disable) return { apply() {} };
66
+ if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) logger.warn("Running Sentry plugin from within a `node_modules` folder. Some features may not work.");
67
+ const sourcemapsEnabled = options.sourcemaps?.disable !== true;
68
+ const staticInjectionCode = new _sentry_bundler_plugin_core.CodeInjection();
69
+ if (!options.release.inject) logger.debug("Release injection disabled via `release.inject` option. Will not inject release.");
70
+ else if (!options.release.name) logger.debug("No release name provided. Will not inject release. Please set the `release.name` option to identify your release.");
71
+ else staticInjectionCode.append((0, _sentry_bundler_plugin_core.generateReleaseInjectorCode)({
72
+ release: options.release.name,
73
+ injectBuildInformation: options._experiments.injectBuildInformation || false
74
+ }));
75
+ if (Object.keys(bundleMetadata).length > 0) staticInjectionCode.append((0, _sentry_bundler_plugin_core.generateModuleMetadataInjectorCode)(bundleMetadata));
76
+ const transformAnnotations = options.reactComponentAnnotation?.enabled ? (0, _sentry_bundler_plugin_core.createComponentNameAnnotateHooks)(options.reactComponentAnnotation?.ignoredComponents || [], !!options.reactComponentAnnotation?._experimentalInjectIntoHtml) : void 0;
77
+ const transformReplace = Object.keys(replacementValues).length > 0;
78
+ return { apply(compiler) {
79
+ sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {});
80
+ const BannerPlugin = compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;
81
+ const DefinePlugin = compiler?.webpack?.DefinePlugin || UnsafeDefinePlugin;
82
+ if (!staticInjectionCode.isEmpty() || sourcemapsEnabled) if (!BannerPlugin) logger.warn("BannerPlugin is not available. Skipping code injection. This usually means webpack is not properly configured.");
83
+ else {
84
+ compiler.options.plugins = compiler.options.plugins || [];
85
+ compiler.options.plugins.push(new BannerPlugin({
86
+ raw: true,
87
+ include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
88
+ banner: (arg) => {
89
+ const codeToInject = staticInjectionCode.clone();
90
+ if (sourcemapsEnabled) {
91
+ const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;
92
+ const debugId = hash ? (0, _sentry_bundler_plugin_core.stringToUUID)(hash) : (0, uuid.v4)();
93
+ codeToInject.append((0, _sentry_bundler_plugin_core.getDebugIdSnippet)(debugId));
94
+ }
95
+ return codeToInject.code();
96
+ }
97
+ }));
98
+ }
99
+ if (transformReplace && DefinePlugin) {
100
+ compiler.options.plugins = compiler.options.plugins || [];
101
+ compiler.options.plugins.push(new DefinePlugin(replacementValues));
102
+ }
103
+ if (transformAnnotations?.transform) {
104
+ compiler.options.module = compiler.options.module || {};
105
+ compiler.options.module.rules = compiler.options.module.rules || [];
106
+ compiler.options.module.rules.unshift({
107
+ test: /\.[jt]sx$/,
108
+ exclude: /node_modules/,
109
+ enforce: "pre",
110
+ use: [{
111
+ loader: COMPONENT_ANNOTATION_LOADER,
112
+ options: { transform: transformAnnotations.transform }
113
+ }]
114
+ });
115
+ }
116
+ compiler.hooks.afterEmit.tapAsync("sentry-webpack-plugin", (compilation, callback) => {
117
+ const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
118
+ const upload = (0, _sentry_bundler_plugin_core.createDebugIdUploadFunction)({ sentryBuildPluginManager });
119
+ sentryBuildPluginManager.createRelease().then(async () => {
120
+ if (sourcemapsEnabled && options.sourcemaps?.disable !== "disable-upload") {
121
+ const outputPath = compilation.outputOptions.path ?? node_path.resolve();
122
+ await upload(Object.keys(compilation.assets).map((asset) => node_path.join(outputPath, asset)));
123
+ }
124
+ }).then(() => {
125
+ callback();
126
+ }).finally(() => {
127
+ freeGlobalDependencyOnBuildArtifacts();
128
+ sentryBuildPluginManager.deleteArtifacts();
129
+ });
130
+ });
131
+ if (userOptions._experiments?.forceExitOnBuildCompletion && compiler.options.mode === "production") compiler.hooks.done.tap("sentry-webpack-plugin", () => {
132
+ setTimeout(() => {
133
+ logger.debug("Exiting process after debug file upload");
134
+ process.exit(0);
135
+ });
136
+ });
137
+ } };
138
+ };
46
139
  }
47
- var webpackMajorVersion = getWebpackMajorVersion();
48
- var sentryUnplugin = webpack4and5.sentryWebpackUnpluginFactory({
49
- BannerPlugin: BannerPlugin,
50
- DefinePlugin: DefinePlugin
51
- });
52
140
 
53
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
54
- var sentryWebpackPlugin = function sentryWebpackPlugin(options) {
55
- var _options$_metaOptions, _options$_metaOptions2, _options$_metaOptions3, _options$_metaOptions4;
56
- var enhancedOptions = webpack4and5._objectSpread2(webpack4and5._objectSpread2({}, options), {}, {
57
- _metaOptions: webpack4and5._objectSpread2(webpack4and5._objectSpread2({}, options === null || options === void 0 ? void 0 : options._metaOptions), {}, {
58
- telemetry: webpack4and5._objectSpread2(webpack4and5._objectSpread2({}, options === null || options === void 0 ? void 0 : (_options$_metaOptions = options._metaOptions) === null || _options$_metaOptions === void 0 ? void 0 : _options$_metaOptions.telemetry), {}, {
59
- bundlerMajorVersion: (_options$_metaOptions2 = options === null || options === void 0 ? void 0 : (_options$_metaOptions3 = options._metaOptions) === null || _options$_metaOptions3 === void 0 ? void 0 : (_options$_metaOptions4 = _options$_metaOptions3.telemetry) === null || _options$_metaOptions4 === void 0 ? void 0 : _options$_metaOptions4.bundlerMajorVersion) !== null && _options$_metaOptions2 !== void 0 ? _options$_metaOptions2 : webpackMajorVersion
60
- })
61
- })
62
- });
63
- return sentryUnplugin.webpack(enhancedOptions);
64
- };
141
+ //#endregion
142
+ //#region src/index.ts
143
+ const BannerPlugin = webpack?.BannerPlugin || webpack?.default?.BannerPlugin;
144
+ const DefinePlugin = webpack?.DefinePlugin || webpack?.default?.DefinePlugin;
145
+ const sentryWebpackPlugin = sentryWebpackPluginFactory({
146
+ BannerPlugin,
147
+ DefinePlugin
148
+ });
65
149
 
150
+ //#endregion
66
151
  Object.defineProperty(exports, 'sentryCliBinaryExists', {
67
152
  enumerable: true,
68
- get: function () { return bundlerPluginCore.sentryCliBinaryExists; }
153
+ get: function () {
154
+ return _sentry_bundler_plugin_core.sentryCliBinaryExists;
155
+ }
69
156
  });
70
157
  exports.sentryWebpackPlugin = sentryWebpackPlugin;
71
- //# sourceMappingURL=index.js.map
158
+ //# sourceMappingURL=index.js.map
@@ -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\n// Detect webpack major version for telemetry (helps differentiate webpack 4 vs 5 usage)\nfunction getWebpackMajorVersion(): string | undefined {\n try {\n const webpack = webpack4or5 as unknown as\n | { version?: string; default?: { version?: string } }\n | undefined;\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\nconst webpackMajorVersion = getWebpackMajorVersion();\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 = (options) => {\n const enhancedOptions: SentryWebpackPluginOptions = {\n ...options,\n _metaOptions: {\n ...options?._metaOptions,\n telemetry: {\n ...options?._metaOptions?.telemetry,\n bundlerMajorVersion:\n options?._metaOptions?.telemetry?.bundlerMajorVersion ?? webpackMajorVersion,\n },\n },\n };\n return sentryUnplugin.webpack(enhancedOptions);\n};\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"names":["BannerPlugin","webpack4or5","_webpack4or5$default","DefinePlugin","_webpack4or5$default2","getWebpackMajorVersion","_webpack$version","_webpack$default","webpack","version","webpackMajorVersion","split","error","undefined","sentryUnplugin","sentryWebpackUnpluginFactory","sentryWebpackPlugin","options","_options$_metaOptions","_options$_metaOptions2","_options$_metaOptions3","_options$_metaOptions4","enhancedOptions","_objectSpread","_metaOptions","telemetry","bundlerMajorVersion"],"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;AACA,SAASE,sBAAsBA,GAAuB;EACpD,IAAI;IAAA,IAAAC,gBAAA,EAAAC,gBAAA,CAAA;IACF,IAAMC,OAAO,GAAGP,sBAEH,CAAA;AACb,IAAA,IAAMQ,OAAO,GAAA,CAAAH,gBAAA,GAAGE,OAAO,KAAA,IAAA,IAAPA,OAAO,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAPA,OAAO,CAAEC,OAAO,MAAA,IAAA,IAAAH,gBAAA,KAAA,KAAA,CAAA,GAAAA,gBAAA,GAAIE,OAAO,KAAA,IAAA,IAAPA,OAAO,KA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AAN,qBAAA,KAArBA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,qBAAA,CAAuBO,SAAS,CAAA,EAAA,EAAA,EAAA;AACnCC,QAAAA,mBAAmB,EAAAP,CAAAA,sBAAA,GACjBF,OAAO,KAAPA,IAAAA,IAAAA,OAAO,KAAAG,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,CAAAA,sBAAA,GAAPH,OAAO,CAAEO,YAAY,cAAAJ,sBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAAC,sBAAA,GAArBD,sBAAA,CAAuBK,SAAS,MAAA,IAAA,IAAAJ,sBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAhCA,sBAAA,CAAkCK,mBAAmB,MAAA,IAAA,IAAAP,sBAAA,KAAA,KAAA,CAAA,GAAAA,sBAAA,GAAIT,mBAAAA;AAAmB,OAAA,CAAA;AAC/E,KAAA,CAAA;GAEJ,CAAA,CAAA;AACD,EAAA,OAAOI,cAAc,CAACN,OAAO,CAACc,eAAe,CAAC,CAAA;AAChD;;;;;;;;"}
1
+ {"version":3,"file":"index.js","names":["path","CodeInjection","webpack4or5"],"sources":["../../src/webpack4and5.ts","../../src/index.ts"],"sourcesContent":["import {\n Options,\n createSentryBuildPluginManager,\n generateReleaseInjectorCode,\n generateModuleMetadataInjectorCode,\n stringToUUID,\n createComponentNameAnnotateHooks,\n CodeInjection,\n getDebugIdSnippet,\n createDebugIdUploadFunction,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { createRequire } from \"node:module\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore Rollup transpiles import.meta for us for CJS\nconst dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst COMPONENT_ANNOTATION_LOADER = path.resolve(\n dirname,\n typeof __dirname !== \"undefined\"\n ? \"component-annotation-transform.js\" // CJS\n : \"component-annotation-transform.mjs\" // ESM\n);\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\ntype WebpackModule = {\n resource?: string;\n};\n\ntype WebpackLoaderCallback = (err: Error | null, content?: string, sourceMap?: unknown) => void;\n\ntype WebpackLoaderContext = {\n callback: WebpackLoaderCallback;\n};\n\ntype WebpackCompilationContext = {\n compiler: {\n webpack?: {\n NormalModule?: {\n getCompilationHooks: (compilation: WebpackCompilationContext) => {\n loader: {\n tap: (\n name: string,\n callback: (loaderContext: WebpackLoaderContext, module: WebpackModule) => void\n ) => void;\n };\n };\n };\n };\n };\n hooks: {\n normalModuleLoader?: {\n tap: (\n name: string,\n callback: (loaderContext: WebpackLoaderContext, module: WebpackModule) => void\n ) => void;\n };\n };\n};\n\ntype WebpackCompiler = {\n options: {\n plugins?: unknown[];\n mode?: string;\n module?: {\n rules?: unknown[];\n };\n };\n hooks: {\n thisCompilation: {\n tap: (name: string, callback: (compilation: WebpackCompilationContext) => void) => void;\n };\n afterEmit: {\n tapAsync: (\n name: string,\n callback: (compilation: WebpackCompilation, cb: () => void) => void\n ) => void;\n };\n done: {\n tap: (name: string, callback: () => void) => void;\n };\n };\n webpack?: {\n BannerPlugin?: UnsafeBannerPlugin;\n DefinePlugin?: UnsafeDefinePlugin;\n };\n};\n\ntype WebpackCompilation = {\n outputOptions: {\n path?: string;\n };\n assets: Record<string, unknown>;\n hooks: {\n processAssets: {\n tap: (options: { name: string; stage: number }, callback: () => void) => void;\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 sentryWebpackPluginFactory({\n BannerPlugin: UnsafeBannerPlugin,\n DefinePlugin: UnsafeDefinePlugin,\n}: {\n BannerPlugin?: UnsafeBannerPlugin;\n DefinePlugin?: UnsafeDefinePlugin;\n} = {}) {\n return function sentryWebpackPlugin(userOptions: SentryWebpackPluginOptions = {}) {\n const sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {\n loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? \"[sentry-webpack-plugin]\",\n buildTool: \"webpack\",\n buildToolMajorVersion: getWebpackMajorVersion(),\n });\n\n const {\n logger,\n normalizedOptions: options,\n bundleSizeOptimizationReplacementValues: replacementValues,\n bundleMetadata,\n createDependencyOnBuildArtifacts,\n } = sentryBuildPluginManager;\n\n if (options.disable) {\n return {\n apply() {\n // noop plugin\n },\n };\n }\n\n if (process.cwd().match(/\\\\node_modules\\\\|\\/node_modules\\//)) {\n logger.warn(\n \"Running Sentry plugin from within a `node_modules` folder. Some features may not work.\"\n );\n }\n\n const sourcemapsEnabled = options.sourcemaps?.disable !== true;\n const staticInjectionCode = new CodeInjection();\n\n if (!options.release.inject) {\n logger.debug(\n \"Release injection disabled via `release.inject` option. Will not inject release.\"\n );\n } else if (!options.release.name) {\n logger.debug(\n \"No release name provided. Will not inject release. Please set the `release.name` option to identify your release.\"\n );\n } else {\n staticInjectionCode.append(\n generateReleaseInjectorCode({\n release: options.release.name,\n injectBuildInformation: options._experiments.injectBuildInformation || false,\n })\n );\n }\n\n if (Object.keys(bundleMetadata).length > 0) {\n staticInjectionCode.append(generateModuleMetadataInjectorCode(bundleMetadata));\n }\n\n const transformAnnotations = options.reactComponentAnnotation?.enabled\n ? createComponentNameAnnotateHooks(\n options.reactComponentAnnotation?.ignoredComponents || [],\n !!options.reactComponentAnnotation?._experimentalInjectIntoHtml\n )\n : undefined;\n\n const transformReplace = Object.keys(replacementValues).length > 0;\n\n return {\n apply(compiler: WebpackCompiler) {\n void sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {\n // Telemetry failures are acceptable\n });\n\n // Get the correct plugin classes (webpack 5.1+ vs older versions)\n const BannerPlugin = compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n const DefinePlugin = compiler?.webpack?.DefinePlugin || UnsafeDefinePlugin;\n\n // Add BannerPlugin for code injection (release, metadata, debug IDs)\n if (!staticInjectionCode.isEmpty() || sourcemapsEnabled) {\n if (!BannerPlugin) {\n logger.warn(\n \"BannerPlugin is not available. Skipping code injection. This usually means webpack is not properly configured.\"\n );\n } else {\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: (arg?: BannerPluginCallbackArg) => {\n const codeToInject = staticInjectionCode.clone();\n if (sourcemapsEnabled) {\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 // Add DefinePlugin for bundle size optimizations\n if (transformReplace && DefinePlugin) {\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(new DefinePlugin(replacementValues));\n }\n\n // Add component name annotation transform\n if (transformAnnotations?.transform) {\n compiler.options.module = compiler.options.module || {};\n compiler.options.module.rules = compiler.options.module.rules || [];\n compiler.options.module.rules.unshift({\n test: /\\.[jt]sx$/,\n exclude: /node_modules/,\n enforce: \"pre\",\n use: [\n {\n loader: COMPONENT_ANNOTATION_LOADER,\n options: {\n transform: transformAnnotations.transform,\n },\n },\n ],\n });\n }\n\n compiler.hooks.afterEmit.tapAsync(\n \"sentry-webpack-plugin\",\n (compilation: WebpackCompilation, callback: () => void) => {\n const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();\n const upload = createDebugIdUploadFunction({ sentryBuildPluginManager });\n\n void sentryBuildPluginManager\n .createRelease()\n .then(async () => {\n if (sourcemapsEnabled && options.sourcemaps?.disable !== \"disable-upload\") {\n const outputPath = compilation.outputOptions.path ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets).map((asset) =>\n path.join(outputPath, asset)\n );\n await upload(buildArtifacts);\n }\n })\n .then(() => {\n callback();\n })\n .finally(() => {\n freeGlobalDependencyOnBuildArtifacts();\n void sentryBuildPluginManager.deleteArtifacts();\n });\n }\n );\n\n if (\n userOptions._experiments?.forceExitOnBuildCompletion &&\n compiler.options.mode === \"production\"\n ) {\n compiler.hooks.done.tap(\"sentry-webpack-plugin\", () => {\n setTimeout(() => {\n logger.debug(\"Exiting process after debug file upload\");\n process.exit(0);\n });\n });\n }\n },\n };\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","import { SentryWebpackPluginOptions, sentryWebpackPluginFactory } from \"./webpack4and5\";\nimport * as webpack4or5 from \"webpack\";\n\nconst BannerPlugin = webpack4or5?.BannerPlugin || webpack4or5?.default?.BannerPlugin;\n\nconst DefinePlugin = webpack4or5?.DefinePlugin || webpack4or5?.default?.DefinePlugin;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryWebpackPluginFactory({\n BannerPlugin,\n DefinePlugin,\n });\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,UAAUA,UAAK,kFAAsC,CAAC;AAE5D,MAAM,8BAA8BA,UAAK,QACvC,SACA,OAAO,cAAc,cACjB,sCACA,qCACL;AAoGD,SAAS,yBAA6C;AACpD,KAAI;EAIF,MAAM,uFADoC,CACtB,UAAU;AAG9B,UAFgB,SAAS,WAAW,SAAS,SAAS,UACjB,MAAM,IAAI,CAAC;UAEzC,OAAO;AACd;;;;;;;;;;;AAYJ,SAAgB,2BAA2B,EACzC,cAAc,oBACd,cAAc,uBAIZ,EAAE,EAAE;AACN,QAAO,SAAS,oBAAoB,cAA0C,EAAE,EAAE;EAChF,MAAM,2FAA0D,aAAa;GAC3E,cAAc,YAAY,cAAc,wBAAwB;GAChE,WAAW;GACX,uBAAuB,wBAAwB;GAChD,CAAC;EAEF,MAAM,EACJ,QACA,mBAAmB,SACnB,yCAAyC,mBACzC,gBACA,qCACE;AAEJ,MAAI,QAAQ,QACV,QAAO,EACL,QAAQ,IAGT;AAGH,MAAI,QAAQ,KAAK,CAAC,MAAM,oCAAoC,CAC1D,QAAO,KACL,yFACD;EAGH,MAAM,oBAAoB,QAAQ,YAAY,YAAY;EAC1D,MAAM,sBAAsB,IAAIC,2CAAe;AAE/C,MAAI,CAAC,QAAQ,QAAQ,OACnB,QAAO,MACL,mFACD;WACQ,CAAC,QAAQ,QAAQ,KAC1B,QAAO,MACL,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AO,SAAS,EAAE;AACnE,aAAS,QAAQ,OAAO,MAAM,QAAQ;KACpC,MAAM;KACN,SAAS;KACT,SAAS;KACT,KAAK,CACH;MACE,QAAQ;MACR,SAAS,EACP,WAAW,qBAAqB,WACjC;MACF,CACF;KACF,CAAC;;AAGJ,YAAS,MAAM,UAAU,SACvB,0BACC,aAAiC,aAAyB;IACzD,MAAM,uCAAuC,kCAAkC;IAC/E,MAAM,sEAAqC,EAAE,0BAA0B,CAAC;AAExE,IAAK,yBACF,eAAe,CACf,KAAK,YAAY;AAChB,SAAI,qBAAqB,QAAQ,YAAY,YAAY,kBAAkB;MACzE,MAAM,aAAa,YAAY,cAAc,QAAQD,UAAK,SAAS;AAInE,YAAM,OAHiB,OAAO,KAAK,YAAY,OAAO,CAAC,KAAK,UAC1DA,UAAK,KAAK,YAAY,MAAM,CAC7B,CAC2B;;MAE9B,CACD,WAAW;AACV,eAAU;MACV,CACD,cAAc;AACb,2CAAsC;AACtC,KAAK,yBAAyB,iBAAiB;MAC/C;KAEP;AAED,OACE,YAAY,cAAc,8BAC1B,SAAS,QAAQ,SAAS,aAE1B,UAAS,MAAM,KAAK,IAAI,+BAA+B;AACrD,qBAAiB;AACf,YAAO,MAAM,0CAA0C;AACvD,aAAQ,KAAK,EAAE;MACf;KACF;KAGP;;;;;;ACzTL,MAAM,eAAeE,SAAa,gBAAgBA,SAAa,SAAS;AAExE,MAAM,eAAeA,SAAa,gBAAgBA,SAAa,SAAS;AAGxE,MAAa,sBACX,2BAA2B;CACzB;CACA;CACD,CAAC"}
@@ -0,0 +1,20 @@
1
+ //#region src/component-annotation-transform.ts
2
+ async function transform(source, map) {
3
+ const callback = this.async();
4
+ const { transform: transformFn } = this.query;
5
+ if (!transformFn) return callback(null, source, map);
6
+ try {
7
+ const id = this.resourcePath;
8
+ const result = await transformFn(source, id);
9
+ if (result == null) callback(null, source, map);
10
+ else if (typeof result === "string") callback(null, result, map);
11
+ else callback(null, result.code, result.map || map);
12
+ } catch (error) {
13
+ if (error instanceof Error) callback(error);
14
+ else callback(new Error(String(error)));
15
+ }
16
+ }
17
+
18
+ //#endregion
19
+ export { transform as default };
20
+ //# sourceMappingURL=component-annotation-transform.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-annotation-transform.mjs","names":[],"sources":["../../src/component-annotation-transform.ts"],"sourcesContent":["// Webpack loader for component annotation transform\n// Based on unplugin v1.0.1 transform loader pattern\n\nexport default async function transform(\n this: {\n async: () => (err: Error | null, content?: string, sourceMap?: unknown) => void;\n resourcePath: string;\n query: {\n transform?: (\n code: string,\n id: string\n ) => Promise<{ code: string; map?: unknown } | null | undefined | string>;\n };\n },\n source: string,\n map: unknown\n): Promise<void> {\n const callback = this.async();\n const { transform: transformFn } = this.query;\n\n if (!transformFn) {\n return callback(null, source, map);\n }\n\n try {\n const id = this.resourcePath;\n const result = await transformFn(source, id);\n\n if (result == null) {\n callback(null, source, map);\n } else if (typeof result === \"string\") {\n callback(null, result, map);\n } else {\n callback(null, result.code, result.map || map);\n }\n } catch (error) {\n if (error instanceof Error) {\n callback(error);\n } else {\n callback(new Error(String(error)));\n }\n }\n}\n"],"mappings":";AAGA,eAA8B,UAW5B,QACA,KACe;CACf,MAAM,WAAW,KAAK,OAAO;CAC7B,MAAM,EAAE,WAAW,gBAAgB,KAAK;AAExC,KAAI,CAAC,YACH,QAAO,SAAS,MAAM,QAAQ,IAAI;AAGpC,KAAI;EACF,MAAM,KAAK,KAAK;EAChB,MAAM,SAAS,MAAM,YAAY,QAAQ,GAAG;AAE5C,MAAI,UAAU,KACZ,UAAS,MAAM,QAAQ,IAAI;WAClB,OAAO,WAAW,SAC3B,UAAS,MAAM,QAAQ,IAAI;MAE3B,UAAS,MAAM,OAAO,MAAM,OAAO,OAAO,IAAI;UAEzC,OAAO;AACd,MAAI,iBAAiB,MACnB,UAAS,MAAM;MAEf,UAAS,IAAI,MAAM,OAAO,MAAM,CAAC,CAAC"}
@@ -1,43 +1,122 @@
1
- import { s as sentryWebpackUnpluginFactory, _ as _objectSpread2 } from './webpack4and5.mjs';
2
- import * as webpack4or5 from 'webpack';
3
- export { sentryCliBinaryExists } from '@sentry/bundler-plugin-core';
4
- import 'path';
5
- import 'uuid';
1
+ import { createRequire } from "node:module";
2
+ import { CodeInjection, createComponentNameAnnotateHooks, createDebugIdUploadFunction, createSentryBuildPluginManager, generateModuleMetadataInjectorCode, generateReleaseInjectorCode, getDebugIdSnippet, sentryCliBinaryExists, stringToUUID } from "@sentry/bundler-plugin-core";
3
+ import * as path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { v4 } from "uuid";
6
+ import * as webpack4or5 from "webpack";
6
7
 
7
- var _webpack4or5$default, _webpack4or5$default2;
8
- var BannerPlugin = (webpack4or5 === null || webpack4or5 === void 0 ? void 0 : webpack4or5.BannerPlugin) || (webpack4or5 === null || webpack4or5 === void 0 ? void 0 : (_webpack4or5$default = webpack4or5["default"]) === null || _webpack4or5$default === void 0 ? void 0 : _webpack4or5$default.BannerPlugin);
9
- var DefinePlugin = (webpack4or5 === null || webpack4or5 === void 0 ? void 0 : webpack4or5.DefinePlugin) || (webpack4or5 === null || webpack4or5 === void 0 ? void 0 : (_webpack4or5$default2 = webpack4or5["default"]) === null || _webpack4or5$default2 === void 0 ? void 0 : _webpack4or5$default2.DefinePlugin);
10
-
11
- // Detect webpack major version for telemetry (helps differentiate webpack 4 vs 5 usage)
8
+ //#region src/webpack4and5.ts
9
+ const dirname = path.dirname(fileURLToPath(import.meta.url));
10
+ const COMPONENT_ANNOTATION_LOADER = path.resolve(dirname, typeof __dirname !== "undefined" ? "component-annotation-transform.js" : "component-annotation-transform.mjs");
12
11
  function getWebpackMajorVersion() {
13
- try {
14
- var _webpack$version, _webpack$default;
15
- var webpack = webpack4or5;
16
- 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;
17
- var _webpackMajorVersion = version === null || version === void 0 ? void 0 : version.split(".")[0]; // "4" or "5"
18
- return _webpackMajorVersion;
19
- } catch (error) {
20
- return undefined;
21
- }
12
+ try {
13
+ const webpack = createRequire(import.meta.url)("webpack");
14
+ return (webpack?.version ?? webpack?.default?.version)?.split(".")[0];
15
+ } catch (error) {
16
+ return;
17
+ }
18
+ }
19
+ /**
20
+ * The factory function accepts BannerPlugin and DefinePlugin classes in
21
+ * order to avoid direct dependencies on webpack.
22
+ *
23
+ * This allow us to export version of the plugin for webpack 5.1+ and compatible environments.
24
+ *
25
+ * Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.
26
+ */
27
+ function sentryWebpackPluginFactory({ BannerPlugin: UnsafeBannerPlugin, DefinePlugin: UnsafeDefinePlugin } = {}) {
28
+ return function sentryWebpackPlugin(userOptions = {}) {
29
+ const sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {
30
+ loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? "[sentry-webpack-plugin]",
31
+ buildTool: "webpack",
32
+ buildToolMajorVersion: getWebpackMajorVersion()
33
+ });
34
+ const { logger, normalizedOptions: options, bundleSizeOptimizationReplacementValues: replacementValues, bundleMetadata, createDependencyOnBuildArtifacts } = sentryBuildPluginManager;
35
+ if (options.disable) return { apply() {} };
36
+ if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) logger.warn("Running Sentry plugin from within a `node_modules` folder. Some features may not work.");
37
+ const sourcemapsEnabled = options.sourcemaps?.disable !== true;
38
+ const staticInjectionCode = new CodeInjection();
39
+ if (!options.release.inject) logger.debug("Release injection disabled via `release.inject` option. Will not inject release.");
40
+ else if (!options.release.name) logger.debug("No release name provided. Will not inject release. Please set the `release.name` option to identify your release.");
41
+ else staticInjectionCode.append(generateReleaseInjectorCode({
42
+ release: options.release.name,
43
+ injectBuildInformation: options._experiments.injectBuildInformation || false
44
+ }));
45
+ if (Object.keys(bundleMetadata).length > 0) staticInjectionCode.append(generateModuleMetadataInjectorCode(bundleMetadata));
46
+ const transformAnnotations = options.reactComponentAnnotation?.enabled ? createComponentNameAnnotateHooks(options.reactComponentAnnotation?.ignoredComponents || [], !!options.reactComponentAnnotation?._experimentalInjectIntoHtml) : void 0;
47
+ const transformReplace = Object.keys(replacementValues).length > 0;
48
+ return { apply(compiler) {
49
+ sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {});
50
+ const BannerPlugin = compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;
51
+ const DefinePlugin = compiler?.webpack?.DefinePlugin || UnsafeDefinePlugin;
52
+ if (!staticInjectionCode.isEmpty() || sourcemapsEnabled) if (!BannerPlugin) logger.warn("BannerPlugin is not available. Skipping code injection. This usually means webpack is not properly configured.");
53
+ else {
54
+ compiler.options.plugins = compiler.options.plugins || [];
55
+ compiler.options.plugins.push(new BannerPlugin({
56
+ raw: true,
57
+ include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
58
+ banner: (arg) => {
59
+ const codeToInject = staticInjectionCode.clone();
60
+ if (sourcemapsEnabled) {
61
+ const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;
62
+ const debugId = hash ? stringToUUID(hash) : v4();
63
+ codeToInject.append(getDebugIdSnippet(debugId));
64
+ }
65
+ return codeToInject.code();
66
+ }
67
+ }));
68
+ }
69
+ if (transformReplace && DefinePlugin) {
70
+ compiler.options.plugins = compiler.options.plugins || [];
71
+ compiler.options.plugins.push(new DefinePlugin(replacementValues));
72
+ }
73
+ if (transformAnnotations?.transform) {
74
+ compiler.options.module = compiler.options.module || {};
75
+ compiler.options.module.rules = compiler.options.module.rules || [];
76
+ compiler.options.module.rules.unshift({
77
+ test: /\.[jt]sx$/,
78
+ exclude: /node_modules/,
79
+ enforce: "pre",
80
+ use: [{
81
+ loader: COMPONENT_ANNOTATION_LOADER,
82
+ options: { transform: transformAnnotations.transform }
83
+ }]
84
+ });
85
+ }
86
+ compiler.hooks.afterEmit.tapAsync("sentry-webpack-plugin", (compilation, callback) => {
87
+ const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
88
+ const upload = createDebugIdUploadFunction({ sentryBuildPluginManager });
89
+ sentryBuildPluginManager.createRelease().then(async () => {
90
+ if (sourcemapsEnabled && options.sourcemaps?.disable !== "disable-upload") {
91
+ const outputPath = compilation.outputOptions.path ?? path.resolve();
92
+ await upload(Object.keys(compilation.assets).map((asset) => path.join(outputPath, asset)));
93
+ }
94
+ }).then(() => {
95
+ callback();
96
+ }).finally(() => {
97
+ freeGlobalDependencyOnBuildArtifacts();
98
+ sentryBuildPluginManager.deleteArtifacts();
99
+ });
100
+ });
101
+ if (userOptions._experiments?.forceExitOnBuildCompletion && compiler.options.mode === "production") compiler.hooks.done.tap("sentry-webpack-plugin", () => {
102
+ setTimeout(() => {
103
+ logger.debug("Exiting process after debug file upload");
104
+ process.exit(0);
105
+ });
106
+ });
107
+ } };
108
+ };
22
109
  }
23
- var webpackMajorVersion = getWebpackMajorVersion();
24
- var sentryUnplugin = sentryWebpackUnpluginFactory({
25
- BannerPlugin: BannerPlugin,
26
- DefinePlugin: DefinePlugin
27
- });
28
110
 
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
- var sentryWebpackPlugin = function sentryWebpackPlugin(options) {
31
- var _options$_metaOptions, _options$_metaOptions2, _options$_metaOptions3, _options$_metaOptions4;
32
- var enhancedOptions = _objectSpread2(_objectSpread2({}, options), {}, {
33
- _metaOptions: _objectSpread2(_objectSpread2({}, options === null || options === void 0 ? void 0 : options._metaOptions), {}, {
34
- telemetry: _objectSpread2(_objectSpread2({}, options === null || options === void 0 ? void 0 : (_options$_metaOptions = options._metaOptions) === null || _options$_metaOptions === void 0 ? void 0 : _options$_metaOptions.telemetry), {}, {
35
- bundlerMajorVersion: (_options$_metaOptions2 = options === null || options === void 0 ? void 0 : (_options$_metaOptions3 = options._metaOptions) === null || _options$_metaOptions3 === void 0 ? void 0 : (_options$_metaOptions4 = _options$_metaOptions3.telemetry) === null || _options$_metaOptions4 === void 0 ? void 0 : _options$_metaOptions4.bundlerMajorVersion) !== null && _options$_metaOptions2 !== void 0 ? _options$_metaOptions2 : webpackMajorVersion
36
- })
37
- })
38
- });
39
- return sentryUnplugin.webpack(enhancedOptions);
40
- };
111
+ //#endregion
112
+ //#region src/index.ts
113
+ const BannerPlugin = webpack4or5?.BannerPlugin || webpack4or5?.default?.BannerPlugin;
114
+ const DefinePlugin = webpack4or5?.DefinePlugin || webpack4or5?.default?.DefinePlugin;
115
+ const sentryWebpackPlugin = sentryWebpackPluginFactory({
116
+ BannerPlugin,
117
+ DefinePlugin
118
+ });
41
119
 
42
- export { sentryWebpackPlugin };
43
- //# sourceMappingURL=index.mjs.map
120
+ //#endregion
121
+ export { sentryCliBinaryExists, sentryWebpackPlugin };
122
+ //# sourceMappingURL=index.mjs.map
@@ -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\n// Detect webpack major version for telemetry (helps differentiate webpack 4 vs 5 usage)\nfunction getWebpackMajorVersion(): string | undefined {\n try {\n const webpack = webpack4or5 as unknown as\n | { version?: string; default?: { version?: string } }\n | undefined;\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\nconst webpackMajorVersion = getWebpackMajorVersion();\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 = (options) => {\n const enhancedOptions: SentryWebpackPluginOptions = {\n ...options,\n _metaOptions: {\n ...options?._metaOptions,\n telemetry: {\n ...options?._metaOptions?.telemetry,\n bundlerMajorVersion:\n options?._metaOptions?.telemetry?.bundlerMajorVersion ?? webpackMajorVersion,\n },\n },\n };\n return sentryUnplugin.webpack(enhancedOptions);\n};\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"names":["BannerPlugin","webpack4or5","_webpack4or5$default","DefinePlugin","_webpack4or5$default2","getWebpackMajorVersion","_webpack$version","_webpack$default","webpack","version","webpackMajorVersion","split","error","undefined","sentryUnplugin","sentryWebpackUnpluginFactory","sentryWebpackPlugin","options","_options$_metaOptions","_options$_metaOptions2","_options$_metaOptions3","_options$_metaOptions4","enhancedOptions","_objectSpread","_metaOptions","telemetry","bundlerMajorVersion"],"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,GA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","../../src/index.ts"],"sourcesContent":["import {\n Options,\n createSentryBuildPluginManager,\n generateReleaseInjectorCode,\n generateModuleMetadataInjectorCode,\n stringToUUID,\n createComponentNameAnnotateHooks,\n CodeInjection,\n getDebugIdSnippet,\n createDebugIdUploadFunction,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { createRequire } from \"node:module\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore Rollup transpiles import.meta for us for CJS\nconst dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst COMPONENT_ANNOTATION_LOADER = path.resolve(\n dirname,\n typeof __dirname !== \"undefined\"\n ? \"component-annotation-transform.js\" // CJS\n : \"component-annotation-transform.mjs\" // ESM\n);\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\ntype WebpackModule = {\n resource?: string;\n};\n\ntype WebpackLoaderCallback = (err: Error | null, content?: string, sourceMap?: unknown) => void;\n\ntype WebpackLoaderContext = {\n callback: WebpackLoaderCallback;\n};\n\ntype WebpackCompilationContext = {\n compiler: {\n webpack?: {\n NormalModule?: {\n getCompilationHooks: (compilation: WebpackCompilationContext) => {\n loader: {\n tap: (\n name: string,\n callback: (loaderContext: WebpackLoaderContext, module: WebpackModule) => void\n ) => void;\n };\n };\n };\n };\n };\n hooks: {\n normalModuleLoader?: {\n tap: (\n name: string,\n callback: (loaderContext: WebpackLoaderContext, module: WebpackModule) => void\n ) => void;\n };\n };\n};\n\ntype WebpackCompiler = {\n options: {\n plugins?: unknown[];\n mode?: string;\n module?: {\n rules?: unknown[];\n };\n };\n hooks: {\n thisCompilation: {\n tap: (name: string, callback: (compilation: WebpackCompilationContext) => void) => void;\n };\n afterEmit: {\n tapAsync: (\n name: string,\n callback: (compilation: WebpackCompilation, cb: () => void) => void\n ) => void;\n };\n done: {\n tap: (name: string, callback: () => void) => void;\n };\n };\n webpack?: {\n BannerPlugin?: UnsafeBannerPlugin;\n DefinePlugin?: UnsafeDefinePlugin;\n };\n};\n\ntype WebpackCompilation = {\n outputOptions: {\n path?: string;\n };\n assets: Record<string, unknown>;\n hooks: {\n processAssets: {\n tap: (options: { name: string; stage: number }, callback: () => void) => void;\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 sentryWebpackPluginFactory({\n BannerPlugin: UnsafeBannerPlugin,\n DefinePlugin: UnsafeDefinePlugin,\n}: {\n BannerPlugin?: UnsafeBannerPlugin;\n DefinePlugin?: UnsafeDefinePlugin;\n} = {}) {\n return function sentryWebpackPlugin(userOptions: SentryWebpackPluginOptions = {}) {\n const sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {\n loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? \"[sentry-webpack-plugin]\",\n buildTool: \"webpack\",\n buildToolMajorVersion: getWebpackMajorVersion(),\n });\n\n const {\n logger,\n normalizedOptions: options,\n bundleSizeOptimizationReplacementValues: replacementValues,\n bundleMetadata,\n createDependencyOnBuildArtifacts,\n } = sentryBuildPluginManager;\n\n if (options.disable) {\n return {\n apply() {\n // noop plugin\n },\n };\n }\n\n if (process.cwd().match(/\\\\node_modules\\\\|\\/node_modules\\//)) {\n logger.warn(\n \"Running Sentry plugin from within a `node_modules` folder. Some features may not work.\"\n );\n }\n\n const sourcemapsEnabled = options.sourcemaps?.disable !== true;\n const staticInjectionCode = new CodeInjection();\n\n if (!options.release.inject) {\n logger.debug(\n \"Release injection disabled via `release.inject` option. Will not inject release.\"\n );\n } else if (!options.release.name) {\n logger.debug(\n \"No release name provided. Will not inject release. Please set the `release.name` option to identify your release.\"\n );\n } else {\n staticInjectionCode.append(\n generateReleaseInjectorCode({\n release: options.release.name,\n injectBuildInformation: options._experiments.injectBuildInformation || false,\n })\n );\n }\n\n if (Object.keys(bundleMetadata).length > 0) {\n staticInjectionCode.append(generateModuleMetadataInjectorCode(bundleMetadata));\n }\n\n const transformAnnotations = options.reactComponentAnnotation?.enabled\n ? createComponentNameAnnotateHooks(\n options.reactComponentAnnotation?.ignoredComponents || [],\n !!options.reactComponentAnnotation?._experimentalInjectIntoHtml\n )\n : undefined;\n\n const transformReplace = Object.keys(replacementValues).length > 0;\n\n return {\n apply(compiler: WebpackCompiler) {\n void sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {\n // Telemetry failures are acceptable\n });\n\n // Get the correct plugin classes (webpack 5.1+ vs older versions)\n const BannerPlugin = compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n const DefinePlugin = compiler?.webpack?.DefinePlugin || UnsafeDefinePlugin;\n\n // Add BannerPlugin for code injection (release, metadata, debug IDs)\n if (!staticInjectionCode.isEmpty() || sourcemapsEnabled) {\n if (!BannerPlugin) {\n logger.warn(\n \"BannerPlugin is not available. Skipping code injection. This usually means webpack is not properly configured.\"\n );\n } else {\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: (arg?: BannerPluginCallbackArg) => {\n const codeToInject = staticInjectionCode.clone();\n if (sourcemapsEnabled) {\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 // Add DefinePlugin for bundle size optimizations\n if (transformReplace && DefinePlugin) {\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(new DefinePlugin(replacementValues));\n }\n\n // Add component name annotation transform\n if (transformAnnotations?.transform) {\n compiler.options.module = compiler.options.module || {};\n compiler.options.module.rules = compiler.options.module.rules || [];\n compiler.options.module.rules.unshift({\n test: /\\.[jt]sx$/,\n exclude: /node_modules/,\n enforce: \"pre\",\n use: [\n {\n loader: COMPONENT_ANNOTATION_LOADER,\n options: {\n transform: transformAnnotations.transform,\n },\n },\n ],\n });\n }\n\n compiler.hooks.afterEmit.tapAsync(\n \"sentry-webpack-plugin\",\n (compilation: WebpackCompilation, callback: () => void) => {\n const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();\n const upload = createDebugIdUploadFunction({ sentryBuildPluginManager });\n\n void sentryBuildPluginManager\n .createRelease()\n .then(async () => {\n if (sourcemapsEnabled && options.sourcemaps?.disable !== \"disable-upload\") {\n const outputPath = compilation.outputOptions.path ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets).map((asset) =>\n path.join(outputPath, asset)\n );\n await upload(buildArtifacts);\n }\n })\n .then(() => {\n callback();\n })\n .finally(() => {\n freeGlobalDependencyOnBuildArtifacts();\n void sentryBuildPluginManager.deleteArtifacts();\n });\n }\n );\n\n if (\n userOptions._experiments?.forceExitOnBuildCompletion &&\n compiler.options.mode === \"production\"\n ) {\n compiler.hooks.done.tap(\"sentry-webpack-plugin\", () => {\n setTimeout(() => {\n logger.debug(\"Exiting process after debug file upload\");\n process.exit(0);\n });\n });\n }\n },\n };\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","import { SentryWebpackPluginOptions, sentryWebpackPluginFactory } from \"./webpack4and5\";\nimport * as webpack4or5 from \"webpack\";\n\nconst BannerPlugin = webpack4or5?.BannerPlugin || webpack4or5?.default?.BannerPlugin;\n\nconst DefinePlugin = webpack4or5?.DefinePlugin || webpack4or5?.default?.DefinePlugin;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryWebpackPluginFactory({\n BannerPlugin,\n DefinePlugin,\n });\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"mappings":";;;;;;;;AAkBA,MAAM,UAAU,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAE5D,MAAM,8BAA8B,KAAK,QACvC,SACA,OAAO,cAAc,cACjB,sCACA,qCACL;AAoGD,SAAS,yBAA6C;AACpD,KAAI;EAIF,MAAM,UADM,cAAc,OAAO,KAAK,IAAI,CACtB,UAAU;AAG9B,UAFgB,SAAS,WAAW,SAAS,SAAS,UACjB,MAAM,IAAI,CAAC;UAEzC,OAAO;AACd;;;;;;;;;;;AAYJ,SAAgB,2BAA2B,EACzC,cAAc,oBACd,cAAc,uBAIZ,EAAE,EAAE;AACN,QAAO,SAAS,oBAAoB,cAA0C,E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AAK,IAAI,+BAA+B;AACrD,qBAAiB;AACf,YAAO,MAAM,0CAA0C;AACvD,aAAQ,KAAK,EAAE;MACf;KACF;KAGP;;;;;;ACzTL,MAAM,eAAe,aAAa,gBAAgB,aAAa,SAAS;AAExE,MAAM,eAAe,aAAa,gBAAgB,aAAa,SAAS;AAGxE,MAAa,sBACX,2BAA2B;CACzB;CACA;CACD,CAAC"}
@@ -0,0 +1,10 @@
1
+ export default function transform(this: {
2
+ async: () => (err: Error | null, content?: string, sourceMap?: unknown) => void;
3
+ resourcePath: string;
4
+ query: {
5
+ transform?: (code: string, id: string) => Promise<{
6
+ code: string;
7
+ map?: unknown;
8
+ } | null | undefined | string>;
9
+ };
10
+ }, source: string, map: unknown): Promise<void>;
@@ -1,10 +1,73 @@
1
- import { Options, sentryUnpluginFactory } from "@sentry/bundler-plugin-core";
1
+ import { Options } from "@sentry/bundler-plugin-core";
2
2
  type UnsafeBannerPlugin = {
3
3
  new (options: any): unknown;
4
4
  };
5
5
  type UnsafeDefinePlugin = {
6
6
  new (options: any): unknown;
7
7
  };
8
+ type WebpackModule = {
9
+ resource?: string;
10
+ };
11
+ type WebpackLoaderCallback = (err: Error | null, content?: string, sourceMap?: unknown) => void;
12
+ type WebpackLoaderContext = {
13
+ callback: WebpackLoaderCallback;
14
+ };
15
+ type WebpackCompilationContext = {
16
+ compiler: {
17
+ webpack?: {
18
+ NormalModule?: {
19
+ getCompilationHooks: (compilation: WebpackCompilationContext) => {
20
+ loader: {
21
+ tap: (name: string, callback: (loaderContext: WebpackLoaderContext, module: WebpackModule) => void) => void;
22
+ };
23
+ };
24
+ };
25
+ };
26
+ };
27
+ hooks: {
28
+ normalModuleLoader?: {
29
+ tap: (name: string, callback: (loaderContext: WebpackLoaderContext, module: WebpackModule) => void) => void;
30
+ };
31
+ };
32
+ };
33
+ type WebpackCompiler = {
34
+ options: {
35
+ plugins?: unknown[];
36
+ mode?: string;
37
+ module?: {
38
+ rules?: unknown[];
39
+ };
40
+ };
41
+ hooks: {
42
+ thisCompilation: {
43
+ tap: (name: string, callback: (compilation: WebpackCompilationContext) => void) => void;
44
+ };
45
+ afterEmit: {
46
+ tapAsync: (name: string, callback: (compilation: WebpackCompilation, cb: () => void) => void) => void;
47
+ };
48
+ done: {
49
+ tap: (name: string, callback: () => void) => void;
50
+ };
51
+ };
52
+ webpack?: {
53
+ BannerPlugin?: UnsafeBannerPlugin;
54
+ DefinePlugin?: UnsafeDefinePlugin;
55
+ };
56
+ };
57
+ type WebpackCompilation = {
58
+ outputOptions: {
59
+ path?: string;
60
+ };
61
+ assets: Record<string, unknown>;
62
+ hooks: {
63
+ processAssets: {
64
+ tap: (options: {
65
+ name: string;
66
+ stage: number;
67
+ }, callback: () => void) => void;
68
+ };
69
+ };
70
+ };
8
71
  /**
9
72
  * The factory function accepts BannerPlugin and DefinePlugin classes in
10
73
  * order to avoid direct dependencies on webpack.
@@ -13,10 +76,12 @@ type UnsafeDefinePlugin = {
13
76
  *
14
77
  * Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.
15
78
  */
16
- export declare function sentryWebpackUnpluginFactory({ BannerPlugin, DefinePlugin, }?: {
79
+ export declare function sentryWebpackPluginFactory({ BannerPlugin: UnsafeBannerPlugin, DefinePlugin: UnsafeDefinePlugin, }?: {
17
80
  BannerPlugin?: UnsafeBannerPlugin;
18
81
  DefinePlugin?: UnsafeDefinePlugin;
19
- }): ReturnType<typeof sentryUnpluginFactory>;
82
+ }): (userOptions?: SentryWebpackPluginOptions) => {
83
+ apply(compiler: WebpackCompiler): void;
84
+ };
20
85
  export type SentryWebpackPluginOptions = Options & {
21
86
  _experiments?: Options["_experiments"] & {
22
87
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/webpack-plugin",
3
- "version": "4.9.0",
3
+ "version": "5.0.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",
@@ -36,8 +36,8 @@
36
36
  "scripts": {
37
37
  "build": "premove ./dist && run-p build:rollup build:types",
38
38
  "build:watch": "run-p build:rollup:watch build:types:watch",
39
- "build:rollup": "rollup --config rollup.config.js",
40
- "build:rollup:watch": "rollup --config rollup.config.js --watch --no-watch.clearScreen",
39
+ "build:rollup": "rolldown --config rollup.config.mjs",
40
+ "build:rollup:watch": "rolldown --config rollup.config.mjs --watch --no-watch.clearScreen",
41
41
  "build:types": "tsc --project types.tsconfig.json",
42
42
  "build:types:watch": "tsc --project types.tsconfig.json --watch --preserveWatchOutput",
43
43
  "check:types": "run-p check:types:src check:types:test",
@@ -53,18 +53,12 @@
53
53
  "prepack": "ts-node ./src/prepack.ts"
54
54
  },
55
55
  "dependencies": {
56
- "@sentry/bundler-plugin-core": "4.9.0",
57
- "unplugin": "1.0.1",
56
+ "@sentry/bundler-plugin-core": "5.0.0",
58
57
  "uuid": "^9.0.0"
59
58
  },
60
59
  "devDependencies": {
61
- "@babel/core": "7.18.5",
62
- "@babel/preset-env": "7.18.2",
63
- "@babel/preset-typescript": "7.17.12",
64
- "@rollup/plugin-babel": "5.3.1",
65
- "@rollup/plugin-commonjs": "22.0.1",
66
- "@sentry-internal/eslint-config": "4.9.0",
67
- "@sentry-internal/sentry-bundler-plugin-tsconfig": "4.9.0",
60
+ "@sentry-internal/eslint-config": "5.0.0",
61
+ "@sentry-internal/sentry-bundler-plugin-tsconfig": "5.0.0",
68
62
  "@swc/core": "^1.2.205",
69
63
  "@swc/jest": "^0.2.21",
70
64
  "@types/jest": "^28.1.3",
@@ -74,13 +68,13 @@
74
68
  "eslint": "^8.18.0",
75
69
  "jest": "^28.1.1",
76
70
  "premove": "^4.0.0",
77
- "rollup": "2.79.2",
71
+ "rolldown": "^1.0.0-rc.4",
78
72
  "ts-node": "^10.9.1",
79
73
  "typescript": "^4.7.4",
80
- "webpack": "npm:webpack@^4"
74
+ "webpack": "5.0.0"
81
75
  },
82
76
  "peerDependencies": {
83
- "webpack": ">=4.40.0"
77
+ "webpack": ">=5.0.0"
84
78
  },
85
79
  "volta": {
86
80
  "extends": "../../package.json"
@@ -1,202 +0,0 @@
1
- 'use strict';
2
-
3
- var bundlerPluginCore = require('@sentry/bundler-plugin-core');
4
- var path = require('path');
5
- var uuid = require('uuid');
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n["default"] = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var path__namespace = /*#__PURE__*/_interopNamespace(path);
26
-
27
- function ownKeys(object, enumerableOnly) {
28
- var keys = Object.keys(object);
29
- if (Object.getOwnPropertySymbols) {
30
- var symbols = Object.getOwnPropertySymbols(object);
31
- enumerableOnly && (symbols = symbols.filter(function (sym) {
32
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
33
- })), keys.push.apply(keys, symbols);
34
- }
35
- return keys;
36
- }
37
- function _objectSpread2(target) {
38
- for (var i = 1; i < arguments.length; i++) {
39
- var source = null != arguments[i] ? arguments[i] : {};
40
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
41
- _defineProperty(target, key, source[key]);
42
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
43
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
44
- });
45
- }
46
- return target;
47
- }
48
- function _defineProperty(obj, key, value) {
49
- key = _toPropertyKey(key);
50
- if (key in obj) {
51
- Object.defineProperty(obj, key, {
52
- value: value,
53
- enumerable: true,
54
- configurable: true,
55
- writable: true
56
- });
57
- } else {
58
- obj[key] = value;
59
- }
60
- return obj;
61
- }
62
- function _toPrimitive(input, hint) {
63
- if (typeof input !== "object" || input === null) return input;
64
- var prim = input[Symbol.toPrimitive];
65
- if (prim !== undefined) {
66
- var res = prim.call(input, hint || "default");
67
- if (typeof res !== "object") return res;
68
- throw new TypeError("@@toPrimitive must return a primitive value.");
69
- }
70
- return (hint === "string" ? String : Number)(input);
71
- }
72
- function _toPropertyKey(arg) {
73
- var key = _toPrimitive(arg, "string");
74
- return typeof key === "symbol" ? key : String(key);
75
- }
76
-
77
- // since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version
78
- // https://github.com/webpack/webpack/commit/65eca2e529ce1d79b79200d4bdb1ce1b81141459
79
- function webpackInjectionPlugin(UnsafeBannerPlugin) {
80
- return function (injectionCode, debugIds) {
81
- return {
82
- name: "sentry-webpack-injection-plugin",
83
- webpack: function webpack(compiler) {
84
- var _compiler$webpack;
85
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
86
- // @ts-ignore webpack version compatibility shenanigans
87
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
88
- var BannerPlugin =
89
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
90
- // @ts-ignore webpack version compatibility shenanigans
91
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
92
- (compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack = compiler.webpack) === null || _compiler$webpack === void 0 ? void 0 : _compiler$webpack.BannerPlugin) || UnsafeBannerPlugin;
93
- compiler.options.plugins = compiler.options.plugins || [];
94
- compiler.options.plugins.push(
95
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
96
- new BannerPlugin({
97
- raw: true,
98
- include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
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
- }
109
- }));
110
- }
111
- };
112
- };
113
- }
114
- function webpackComponentNameAnnotatePlugin() {
115
- return function (ignoredComponents, injectIntoHtml) {
116
- return {
117
- name: "sentry-webpack-component-name-annotate-plugin",
118
- enforce: "pre",
119
- // Webpack needs this hook for loader logic, so the plugin is not run on unsupported file types
120
- transformInclude: function transformInclude(id) {
121
- return id.endsWith(".tsx") || id.endsWith(".jsx");
122
- },
123
- transform: bundlerPluginCore.createComponentNameAnnotateHooks(ignoredComponents, injectIntoHtml).transform
124
- };
125
- };
126
- }
127
- function webpackBundleSizeOptimizationsPlugin(UnsafeDefinePlugin) {
128
- return function (replacementValues) {
129
- return {
130
- name: "sentry-webpack-bundle-size-optimizations-plugin",
131
- webpack: function webpack(compiler) {
132
- var _compiler$webpack2;
133
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
134
- // @ts-ignore webpack version compatibility shenanigans
135
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
136
- var DefinePlugin =
137
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
138
- // @ts-ignore webpack version compatibility shenanigans
139
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
140
- (compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack2 = compiler.webpack) === null || _compiler$webpack2 === void 0 ? void 0 : _compiler$webpack2.DefinePlugin) || UnsafeDefinePlugin;
141
- compiler.options.plugins = compiler.options.plugins || [];
142
- compiler.options.plugins.push(
143
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
144
- new DefinePlugin(_objectSpread2({}, replacementValues)));
145
- }
146
- };
147
- };
148
- }
149
- function webpackDebugIdUploadPlugin(upload, logger, createDependencyOnBuildArtifacts, forceExitOnBuildCompletion) {
150
- var pluginName = "sentry-webpack-debug-id-upload-plugin";
151
- return {
152
- name: pluginName,
153
- webpack: function webpack(compiler) {
154
- var freeGlobalDependencyOnDebugIdSourcemapArtifacts = createDependencyOnBuildArtifacts();
155
- compiler.hooks.afterEmit.tapAsync(pluginName, function (compilation, callback) {
156
- var _ref;
157
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
158
- var outputPath = (_ref = compilation.outputOptions.path) !== null && _ref !== void 0 ? _ref : path__namespace.resolve();
159
- var buildArtifacts = Object.keys(compilation.assets).map(function (asset) {
160
- return path__namespace.join(outputPath, asset);
161
- });
162
- void upload(buildArtifacts).then(function () {
163
- callback();
164
- })["finally"](function () {
165
- freeGlobalDependencyOnDebugIdSourcemapArtifacts();
166
- });
167
- });
168
- if (forceExitOnBuildCompletion && compiler.options.mode === "production") {
169
- compiler.hooks.done.tap(pluginName, function () {
170
- setTimeout(function () {
171
- logger.debug("Exiting process after debug file upload");
172
- process.exit(0);
173
- });
174
- });
175
- }
176
- }
177
- };
178
- }
179
-
180
- /**
181
- * The factory function accepts BannerPlugin and DefinePlugin classes in
182
- * order to avoid direct dependencies on webpack.
183
- *
184
- * This allow us to export version of the plugin for webpack 5.1+ and compatible environments.
185
- *
186
- * Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.
187
- */
188
- function sentryWebpackUnpluginFactory() {
189
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
190
- BannerPlugin = _ref2.BannerPlugin,
191
- DefinePlugin = _ref2.DefinePlugin;
192
- return bundlerPluginCore.sentryUnpluginFactory({
193
- injectionPlugin: webpackInjectionPlugin(BannerPlugin),
194
- componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin(),
195
- debugIdUploadPlugin: webpackDebugIdUploadPlugin,
196
- bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin)
197
- });
198
- }
199
-
200
- exports._objectSpread2 = _objectSpread2;
201
- exports.sentryWebpackUnpluginFactory = sentryWebpackUnpluginFactory;
202
- //# sourceMappingURL=webpack4and5.js.map
@@ -1 +0,0 @@
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","bund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,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,20 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var webpack4and5 = require('./webpack4and5.js');
6
- var bundlerPluginCore = require('@sentry/bundler-plugin-core');
7
- require('path');
8
- require('uuid');
9
-
10
- var sentryUnplugin = webpack4and5.sentryWebpackUnpluginFactory();
11
-
12
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
- var sentryWebpackPlugin = sentryUnplugin.webpack;
14
-
15
- Object.defineProperty(exports, 'sentryCliBinaryExists', {
16
- enumerable: true,
17
- get: function () { return bundlerPluginCore.sentryCliBinaryExists; }
18
- });
19
- exports.sentryWebpackPlugin = sentryWebpackPlugin;
20
- //# sourceMappingURL=webpack5.js.map
@@ -1 +0,0 @@
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;;;;;;;;"}
@@ -1,179 +0,0 @@
1
- import { sentryUnpluginFactory, stringToUUID, getDebugIdSnippet, createComponentNameAnnotateHooks } from '@sentry/bundler-plugin-core';
2
- import * as path from 'path';
3
- import { v4 } from 'uuid';
4
-
5
- function ownKeys(object, enumerableOnly) {
6
- var keys = Object.keys(object);
7
- if (Object.getOwnPropertySymbols) {
8
- var symbols = Object.getOwnPropertySymbols(object);
9
- enumerableOnly && (symbols = symbols.filter(function (sym) {
10
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
11
- })), keys.push.apply(keys, symbols);
12
- }
13
- return keys;
14
- }
15
- function _objectSpread2(target) {
16
- for (var i = 1; i < arguments.length; i++) {
17
- var source = null != arguments[i] ? arguments[i] : {};
18
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
19
- _defineProperty(target, key, source[key]);
20
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
21
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
22
- });
23
- }
24
- return target;
25
- }
26
- function _defineProperty(obj, key, value) {
27
- key = _toPropertyKey(key);
28
- if (key in obj) {
29
- Object.defineProperty(obj, key, {
30
- value: value,
31
- enumerable: true,
32
- configurable: true,
33
- writable: true
34
- });
35
- } else {
36
- obj[key] = value;
37
- }
38
- return obj;
39
- }
40
- function _toPrimitive(input, hint) {
41
- if (typeof input !== "object" || input === null) return input;
42
- var prim = input[Symbol.toPrimitive];
43
- if (prim !== undefined) {
44
- var res = prim.call(input, hint || "default");
45
- if (typeof res !== "object") return res;
46
- throw new TypeError("@@toPrimitive must return a primitive value.");
47
- }
48
- return (hint === "string" ? String : Number)(input);
49
- }
50
- function _toPropertyKey(arg) {
51
- var key = _toPrimitive(arg, "string");
52
- return typeof key === "symbol" ? key : String(key);
53
- }
54
-
55
- // since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version
56
- // https://github.com/webpack/webpack/commit/65eca2e529ce1d79b79200d4bdb1ce1b81141459
57
- function webpackInjectionPlugin(UnsafeBannerPlugin) {
58
- return function (injectionCode, debugIds) {
59
- return {
60
- name: "sentry-webpack-injection-plugin",
61
- webpack: function webpack(compiler) {
62
- var _compiler$webpack;
63
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
64
- // @ts-ignore webpack version compatibility shenanigans
65
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
66
- var BannerPlugin =
67
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
68
- // @ts-ignore webpack version compatibility shenanigans
69
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
70
- (compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack = compiler.webpack) === null || _compiler$webpack === void 0 ? void 0 : _compiler$webpack.BannerPlugin) || UnsafeBannerPlugin;
71
- compiler.options.plugins = compiler.options.plugins || [];
72
- compiler.options.plugins.push(
73
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
74
- new BannerPlugin({
75
- raw: true,
76
- include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
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
- }
87
- }));
88
- }
89
- };
90
- };
91
- }
92
- function webpackComponentNameAnnotatePlugin() {
93
- return function (ignoredComponents, injectIntoHtml) {
94
- return {
95
- name: "sentry-webpack-component-name-annotate-plugin",
96
- enforce: "pre",
97
- // Webpack needs this hook for loader logic, so the plugin is not run on unsupported file types
98
- transformInclude: function transformInclude(id) {
99
- return id.endsWith(".tsx") || id.endsWith(".jsx");
100
- },
101
- transform: createComponentNameAnnotateHooks(ignoredComponents, injectIntoHtml).transform
102
- };
103
- };
104
- }
105
- function webpackBundleSizeOptimizationsPlugin(UnsafeDefinePlugin) {
106
- return function (replacementValues) {
107
- return {
108
- name: "sentry-webpack-bundle-size-optimizations-plugin",
109
- webpack: function webpack(compiler) {
110
- var _compiler$webpack2;
111
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
112
- // @ts-ignore webpack version compatibility shenanigans
113
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
114
- var DefinePlugin =
115
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
116
- // @ts-ignore webpack version compatibility shenanigans
117
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
118
- (compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack2 = compiler.webpack) === null || _compiler$webpack2 === void 0 ? void 0 : _compiler$webpack2.DefinePlugin) || UnsafeDefinePlugin;
119
- compiler.options.plugins = compiler.options.plugins || [];
120
- compiler.options.plugins.push(
121
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
122
- new DefinePlugin(_objectSpread2({}, replacementValues)));
123
- }
124
- };
125
- };
126
- }
127
- function webpackDebugIdUploadPlugin(upload, logger, createDependencyOnBuildArtifacts, forceExitOnBuildCompletion) {
128
- var pluginName = "sentry-webpack-debug-id-upload-plugin";
129
- return {
130
- name: pluginName,
131
- webpack: function webpack(compiler) {
132
- var freeGlobalDependencyOnDebugIdSourcemapArtifacts = createDependencyOnBuildArtifacts();
133
- compiler.hooks.afterEmit.tapAsync(pluginName, function (compilation, callback) {
134
- var _ref;
135
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
136
- var outputPath = (_ref = compilation.outputOptions.path) !== null && _ref !== void 0 ? _ref : path.resolve();
137
- var buildArtifacts = Object.keys(compilation.assets).map(function (asset) {
138
- return path.join(outputPath, asset);
139
- });
140
- void upload(buildArtifacts).then(function () {
141
- callback();
142
- })["finally"](function () {
143
- freeGlobalDependencyOnDebugIdSourcemapArtifacts();
144
- });
145
- });
146
- if (forceExitOnBuildCompletion && compiler.options.mode === "production") {
147
- compiler.hooks.done.tap(pluginName, function () {
148
- setTimeout(function () {
149
- logger.debug("Exiting process after debug file upload");
150
- process.exit(0);
151
- });
152
- });
153
- }
154
- }
155
- };
156
- }
157
-
158
- /**
159
- * The factory function accepts BannerPlugin and DefinePlugin classes in
160
- * order to avoid direct dependencies on webpack.
161
- *
162
- * This allow us to export version of the plugin for webpack 5.1+ and compatible environments.
163
- *
164
- * Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.
165
- */
166
- function sentryWebpackUnpluginFactory() {
167
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
168
- BannerPlugin = _ref2.BannerPlugin,
169
- DefinePlugin = _ref2.DefinePlugin;
170
- return sentryUnpluginFactory({
171
- injectionPlugin: webpackInjectionPlugin(BannerPlugin),
172
- componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin(),
173
- debugIdUploadPlugin: webpackDebugIdUploadPlugin,
174
- bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin)
175
- });
176
- }
177
-
178
- export { _objectSpread2 as _, sentryWebpackUnpluginFactory as s };
179
- //# sourceMappingURL=webpack4and5.mjs.map
@@ -1 +0,0 @@
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,Q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AA;SACX,CAAC,CACM,SAAA,CAAA,CAAC,YAAM;AACbL,UAAAA,+CAA+C,EAAE,CAAA;AACnD,SAAC,CAAC,CAAA;AACN,OAAC,CAAC,CAAA;MAEF,IAAIF,0BAA0B,IAAI7C,QAAQ,CAACG,OAAO,CAAC+D,IAAI,KAAK,YAAY,EAAE;QACxElE,QAAQ,CAACgD,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,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,12 +0,0 @@
1
- import { s as sentryWebpackUnpluginFactory } from './webpack4and5.mjs';
2
- export { sentryCliBinaryExists } from '@sentry/bundler-plugin-core';
3
- import 'path';
4
- import 'uuid';
5
-
6
- var sentryUnplugin = sentryWebpackUnpluginFactory();
7
-
8
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
- var sentryWebpackPlugin = sentryUnplugin.webpack;
10
-
11
- export { sentryWebpackPlugin };
12
- //# sourceMappingURL=webpack5.mjs.map
@@ -1 +0,0 @@
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;;;;"}