@sentry/webpack-plugin 3.3.0-alpha.1 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/cjs/index.js +11 -199
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/webpack4and5-068463fa.js +250 -0
- package/dist/cjs/webpack4and5-068463fa.js.map +1 -0
- package/dist/cjs/webpack5.js +20 -0
- package/dist/cjs/webpack5.js.map +1 -0
- package/dist/esm/index.mjs +11 -199
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/webpack4and5-bffa70d9.js +228 -0
- package/dist/esm/webpack4and5-bffa70d9.js.map +1 -0
- package/dist/esm/webpack5.mjs +12 -0
- package/dist/esm/webpack5.mjs.map +1 -0
- package/dist/types/index.d.ts +1 -14
- package/dist/types/webpack4and5.d.ts +33 -0
- package/dist/types/webpack5.d.ts +4 -0
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -37,6 +37,8 @@ pnpm add @sentry/webpack-plugin --save-dev
|
|
|
37
37
|
```js
|
|
38
38
|
// webpack.config.js
|
|
39
39
|
const { sentryWebpackPlugin } = require("@sentry/webpack-plugin");
|
|
40
|
+
// for webpack 5.1 and webpack compatible environments
|
|
41
|
+
// const { sentryWebpackPlugin } = require("@sentry/webpack-plugin/webpack5");
|
|
40
42
|
|
|
41
43
|
module.exports = {
|
|
42
44
|
// ... other config above ...
|
package/dist/cjs/index.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var path = require('path');
|
|
7
|
-
var uuid = require('uuid');
|
|
5
|
+
var webpack4and5 = require('./webpack4and5-068463fa.js');
|
|
8
6
|
var webpack4or5 = require('webpack');
|
|
7
|
+
var bundlerPluginCore = require('@sentry/bundler-plugin-core');
|
|
8
|
+
require('path');
|
|
9
|
+
require('uuid');
|
|
9
10
|
|
|
10
11
|
function _interopNamespace(e) {
|
|
11
12
|
if (e && e.__esModule) return e;
|
|
@@ -25,205 +26,16 @@ function _interopNamespace(e) {
|
|
|
25
26
|
return Object.freeze(n);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
29
29
|
var webpack4or5__namespace = /*#__PURE__*/_interopNamespace(webpack4or5);
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
})), keys.push.apply(keys, symbols);
|
|
38
|
-
}
|
|
39
|
-
return keys;
|
|
40
|
-
}
|
|
41
|
-
function _objectSpread2(target) {
|
|
42
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
43
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
44
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
45
|
-
_defineProperty(target, key, source[key]);
|
|
46
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
47
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return target;
|
|
51
|
-
}
|
|
52
|
-
function _defineProperty(obj, key, value) {
|
|
53
|
-
key = _toPropertyKey(key);
|
|
54
|
-
if (key in obj) {
|
|
55
|
-
Object.defineProperty(obj, key, {
|
|
56
|
-
value: value,
|
|
57
|
-
enumerable: true,
|
|
58
|
-
configurable: true,
|
|
59
|
-
writable: true
|
|
60
|
-
});
|
|
61
|
-
} else {
|
|
62
|
-
obj[key] = value;
|
|
63
|
-
}
|
|
64
|
-
return obj;
|
|
65
|
-
}
|
|
66
|
-
function _toPrimitive(input, hint) {
|
|
67
|
-
if (typeof input !== "object" || input === null) return input;
|
|
68
|
-
var prim = input[Symbol.toPrimitive];
|
|
69
|
-
if (prim !== undefined) {
|
|
70
|
-
var res = prim.call(input, hint || "default");
|
|
71
|
-
if (typeof res !== "object") return res;
|
|
72
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
73
|
-
}
|
|
74
|
-
return (hint === "string" ? String : Number)(input);
|
|
75
|
-
}
|
|
76
|
-
function _toPropertyKey(arg) {
|
|
77
|
-
var key = _toPrimitive(arg, "string");
|
|
78
|
-
return typeof key === "symbol" ? key : String(key);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function webpackReleaseInjectionPlugin(injectionCode) {
|
|
82
|
-
return {
|
|
83
|
-
name: "sentry-webpack-release-injection-plugin",
|
|
84
|
-
webpack: function webpack(compiler) {
|
|
85
|
-
var _compiler$webpack, _webpack4or5$default;
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
87
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
88
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
89
|
-
var BannerPlugin =
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
91
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
93
|
-
(compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack = compiler.webpack) === null || _compiler$webpack === void 0 ? void 0 : _compiler$webpack.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);
|
|
94
|
-
compiler.options.plugins = compiler.options.plugins || [];
|
|
95
|
-
compiler.options.plugins.push(
|
|
96
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
97
|
-
new BannerPlugin({
|
|
98
|
-
raw: true,
|
|
99
|
-
include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
|
|
100
|
-
banner: injectionCode
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
function webpackComponentNameAnnotatePlugin(ignoredComponents) {
|
|
106
|
-
return {
|
|
107
|
-
name: "sentry-webpack-component-name-annotate-plugin",
|
|
108
|
-
enforce: "pre",
|
|
109
|
-
// Webpack needs this hook for loader logic, so the plugin is not run on unsupported file types
|
|
110
|
-
transformInclude: function transformInclude(id) {
|
|
111
|
-
return id.endsWith(".tsx") || id.endsWith(".jsx");
|
|
112
|
-
},
|
|
113
|
-
transform: bundlerPluginCore.createComponentNameAnnotateHooks(ignoredComponents).transform
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function webpackBundleSizeOptimizationsPlugin(replacementValues) {
|
|
117
|
-
return {
|
|
118
|
-
name: "sentry-webpack-bundle-size-optimizations-plugin",
|
|
119
|
-
webpack: function webpack(compiler) {
|
|
120
|
-
var _compiler$webpack2, _webpack4or5$default2;
|
|
121
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
122
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
123
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
124
|
-
var DefinePlugin =
|
|
125
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
126
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
127
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
128
|
-
(compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack2 = compiler.webpack) === null || _compiler$webpack2 === void 0 ? void 0 : _compiler$webpack2.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);
|
|
129
|
-
compiler.options.plugins = compiler.options.plugins || [];
|
|
130
|
-
compiler.options.plugins.push(
|
|
131
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
132
|
-
new DefinePlugin(_objectSpread2({}, replacementValues)));
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
function webpackDebugIdInjectionPlugin() {
|
|
137
|
-
return {
|
|
138
|
-
name: "sentry-webpack-debug-id-injection-plugin",
|
|
139
|
-
webpack: function webpack(compiler) {
|
|
140
|
-
var _compiler$webpack3, _webpack4or5$default3;
|
|
141
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
142
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
143
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
144
|
-
var BannerPlugin =
|
|
145
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
146
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
147
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
148
|
-
(compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack3 = compiler.webpack) === null || _compiler$webpack3 === void 0 ? void 0 : _compiler$webpack3.BannerPlugin) || (webpack4or5__namespace === null || webpack4or5__namespace === void 0 ? void 0 : webpack4or5__namespace.BannerPlugin) || (webpack4or5__namespace === null || webpack4or5__namespace === void 0 ? void 0 : (_webpack4or5$default3 = webpack4or5__namespace["default"]) === null || _webpack4or5$default3 === void 0 ? void 0 : _webpack4or5$default3.BannerPlugin);
|
|
149
|
-
compiler.options.plugins = compiler.options.plugins || [];
|
|
150
|
-
compiler.options.plugins.push(
|
|
151
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
152
|
-
new BannerPlugin({
|
|
153
|
-
raw: true,
|
|
154
|
-
include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
|
|
155
|
-
banner: function banner(arg) {
|
|
156
|
-
var _arg$chunk$contentHas, _arg$chunk, _arg$chunk$contentHas2, _arg$chunk2;
|
|
157
|
-
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;
|
|
158
|
-
var debugId = hash ? bundlerPluginCore.stringToUUID(hash) : uuid.v4();
|
|
159
|
-
return bundlerPluginCore.getDebugIdSnippet(debugId);
|
|
160
|
-
}
|
|
161
|
-
}));
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
function webpackDebugIdUploadPlugin(upload, logger, createDependencyOnBuildArtifacts, forceExitOnBuildCompletion) {
|
|
166
|
-
var pluginName = "sentry-webpack-debug-id-upload-plugin";
|
|
167
|
-
return {
|
|
168
|
-
name: pluginName,
|
|
169
|
-
webpack: function webpack(compiler) {
|
|
170
|
-
var freeGlobalDependencyOnDebugIdSourcemapArtifacts = createDependencyOnBuildArtifacts();
|
|
171
|
-
compiler.hooks.afterEmit.tapAsync(pluginName, function (compilation, callback) {
|
|
172
|
-
var _ref;
|
|
173
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
174
|
-
var outputPath = (_ref = compilation.outputOptions.path) !== null && _ref !== void 0 ? _ref : path__namespace.resolve();
|
|
175
|
-
var buildArtifacts = Object.keys(compilation.assets).map(function (asset) {
|
|
176
|
-
return path__namespace.join(outputPath, asset);
|
|
177
|
-
});
|
|
178
|
-
void upload(buildArtifacts).then(function () {
|
|
179
|
-
callback();
|
|
180
|
-
})["finally"](function () {
|
|
181
|
-
freeGlobalDependencyOnDebugIdSourcemapArtifacts();
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
if (forceExitOnBuildCompletion && compiler.options.mode === "production") {
|
|
185
|
-
compiler.hooks.done.tap(pluginName, function () {
|
|
186
|
-
setTimeout(function () {
|
|
187
|
-
logger.debug("Exiting process after debug file upload");
|
|
188
|
-
process.exit(0);
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
function webpackModuleMetadataInjectionPlugin(injectionCode) {
|
|
196
|
-
return {
|
|
197
|
-
name: "sentry-webpack-module-metadata-injection-plugin",
|
|
198
|
-
webpack: function webpack(compiler) {
|
|
199
|
-
var _compiler$webpack4, _webpack4or5$default4;
|
|
200
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
201
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
202
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
203
|
-
var BannerPlugin =
|
|
204
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
205
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
206
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
207
|
-
(compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack4 = compiler.webpack) === null || _compiler$webpack4 === void 0 ? void 0 : _compiler$webpack4.BannerPlugin) || (webpack4or5__namespace === null || webpack4or5__namespace === void 0 ? void 0 : webpack4or5__namespace.BannerPlugin) || (webpack4or5__namespace === null || webpack4or5__namespace === void 0 ? void 0 : (_webpack4or5$default4 = webpack4or5__namespace["default"]) === null || _webpack4or5$default4 === void 0 ? void 0 : _webpack4or5$default4.BannerPlugin);
|
|
208
|
-
compiler.options.plugins = compiler.options.plugins || [];
|
|
209
|
-
compiler.options.plugins.push(
|
|
210
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
211
|
-
new BannerPlugin({
|
|
212
|
-
raw: true,
|
|
213
|
-
include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
|
|
214
|
-
banner: injectionCode
|
|
215
|
-
}));
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
var sentryUnplugin = bundlerPluginCore.sentryUnpluginFactory({
|
|
220
|
-
releaseInjectionPlugin: webpackReleaseInjectionPlugin,
|
|
221
|
-
componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin,
|
|
222
|
-
moduleMetadataInjectionPlugin: webpackModuleMetadataInjectionPlugin,
|
|
223
|
-
debugIdInjectionPlugin: webpackDebugIdInjectionPlugin,
|
|
224
|
-
debugIdUploadPlugin: webpackDebugIdUploadPlugin,
|
|
225
|
-
bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin
|
|
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);
|
|
34
|
+
var sentryUnplugin = webpack4and5.sentryWebpackUnpluginFactory({
|
|
35
|
+
BannerPlugin: BannerPlugin,
|
|
36
|
+
DefinePlugin: DefinePlugin
|
|
226
37
|
});
|
|
38
|
+
|
|
227
39
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
228
40
|
var sentryWebpackPlugin = sentryUnplugin.webpack;
|
|
229
41
|
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import {\n getDebugIdSnippet,\n Options,\n sentryUnpluginFactory,\n stringToUUID,\n SentrySDKBuildFlags,\n createComponentNameAnnotateHooks,\n Logger,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"path\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore webpack is a peer dep\nimport * as webpack4or5 from \"webpack\";\n\ninterface BannerPluginCallbackArg {\n chunk?: {\n hash?: string;\n contentHash?: {\n javascript?: string;\n };\n };\n}\n\nfunction webpackReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n return {\n name: \"sentry-webpack-release-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin ||\n webpack4or5?.BannerPlugin ||\n webpack4or5?.default?.BannerPlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: injectionCode,\n })\n );\n },\n };\n}\n\nfunction webpackComponentNameAnnotatePlugin(ignoredComponents?: string[]): UnpluginOptions {\n return {\n name: \"sentry-webpack-component-name-annotate-plugin\",\n enforce: \"pre\",\n // Webpack needs this hook for loader logic, so the plugin is not run on unsupported file types\n transformInclude(id) {\n return id.endsWith(\".tsx\") || id.endsWith(\".jsx\");\n },\n transform: createComponentNameAnnotateHooks(ignoredComponents).transform,\n };\n}\n\nfunction webpackBundleSizeOptimizationsPlugin(\n replacementValues: SentrySDKBuildFlags\n): UnpluginOptions {\n return {\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 ||\n webpack4or5?.DefinePlugin ||\n webpack4or5?.default?.DefinePlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new DefinePlugin({\n ...replacementValues,\n })\n );\n },\n };\n}\n\nfunction webpackDebugIdInjectionPlugin(): UnpluginOptions {\n return {\n name: \"sentry-webpack-debug-id-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin ||\n webpack4or5?.BannerPlugin ||\n webpack4or5?.default?.BannerPlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: (arg?: BannerPluginCallbackArg) => {\n const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;\n const debugId = hash ? stringToUUID(hash) : uuidv4();\n return getDebugIdSnippet(debugId);\n },\n })\n );\n },\n };\n}\n\nfunction webpackDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>,\n logger: Logger,\n createDependencyOnBuildArtifacts: () => () => void,\n forceExitOnBuildCompletion?: boolean\n): UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-upload-plugin\";\n return {\n name: pluginName,\n webpack(compiler) {\n const freeGlobalDependencyOnDebugIdSourcemapArtifacts = createDependencyOnBuildArtifacts();\n\n compiler.hooks.afterEmit.tapAsync(pluginName, (compilation, callback: () => void) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const outputPath = (compilation.outputOptions.path as string | undefined) ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets as Record<string, unknown>).map(\n (asset) => path.join(outputPath, asset)\n );\n void upload(buildArtifacts)\n .then(() => {\n callback();\n })\n .finally(() => {\n freeGlobalDependencyOnDebugIdSourcemapArtifacts();\n });\n });\n\n if (forceExitOnBuildCompletion && compiler.options.mode === \"production\") {\n compiler.hooks.done.tap(pluginName, () => {\n setTimeout(() => {\n logger.debug(\"Exiting process after debug file upload\");\n process.exit(0);\n });\n });\n }\n },\n };\n}\n\nfunction webpackModuleMetadataInjectionPlugin(injectionCode: string): UnpluginOptions {\n return {\n name: \"sentry-webpack-module-metadata-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin ||\n webpack4or5?.BannerPlugin ||\n webpack4or5?.default?.BannerPlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: injectionCode,\n })\n );\n },\n };\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n releaseInjectionPlugin: webpackReleaseInjectionPlugin,\n componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin,\n moduleMetadataInjectionPlugin: webpackModuleMetadataInjectionPlugin,\n debugIdInjectionPlugin: webpackDebugIdInjectionPlugin,\n debugIdUploadPlugin: webpackDebugIdUploadPlugin,\n bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin,\n});\n\ntype 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\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":["webpackReleaseInjectionPlugin","injectionCode","name","webpack","compiler","_compiler$webpack","_webpack4or5$default","BannerPlugin","webpack4or5","options","plugins","push","raw","include","banner","webpackComponentNameAnnotatePlugin","ignoredComponents","enforce","transformInclude","id","endsWith","transform","createComponentNameAnnotateHooks","webpackBundleSizeOptimizationsPlugin","replacementValues","_compiler$webpack2","_webpack4or5$default2","DefinePlugin","_objectSpread","webpackDebugIdInjectionPlugin","_compiler$webpack3","_webpack4or5$default3","arg","_arg$chunk$contentHas","_arg$chunk","_arg$chunk$contentHas2","_arg$chunk2","hash","chunk","contentHash","javascript","debugId","stringToUUID","uuidv4","getDebugIdSnippet","webpackDebugIdUploadPlugin","upload","logger","createDependencyOnBuildArtifacts","forceExitOnBuildCompletion","pluginName","freeGlobalDependencyOnDebugIdSourcemapArtifacts","hooks","afterEmit","tapAsync","compilation","callback","_ref","outputPath","outputOptions","path","resolve","buildArtifacts","Object","keys","assets","map","asset","join","then","mode","done","tap","setTimeout","debug","process","exit","webpackModuleMetadataInjectionPlugin","_compiler$webpack4","_webpack4or5$default4","sentryUnplugin","sentryUnpluginFactory","releaseInjectionPlugin","componentNameAnnotatePlugin","moduleMetadataInjectionPlugin","debugIdInjectionPlugin","debugIdUploadPlugin","bundleSizeOptimizationsPlugin","sentryWebpackPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAASA,6BAA6BA,CAACC,aAAqB,EAAmB;EAC7E,OAAO;AACLC,IAAAA,IAAI,EAAE,yCAAyC;IAC/CC,OAAO,EAAA,SAAAA,OAACC,CAAAA,QAAQ,EAAE;MAAA,IAAAC,iBAAA,EAAAC,oBAAA,CAAA;AAChB;AACA;AACA;AACA,MAAA,IAAMC,YAAY;AAChB;AACA;AACA;AACA,MAAA,CAAAH,QAAQ,KAARA,IAAAA,IAAAA,QAAQ,KA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AAA,KAAAA,CAAAA,GAAAA,kBAAA,CAAmBvE,YAAY,MAC/BC,sBAAW,KAAA,IAAA,IAAXA,sBAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAXA,sBAAW,CAAED,YAAY,CACzBC,KAAAA,sBAAW,aAAXA,sBAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAAuE,qBAAA,GAAXvE,sBAAW,CAAS,SAAA,CAAA,MAAA,IAAA,IAAAuE,qBAAA,KAApBA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,qBAAA,CAAsBxE,YAAY,CAAA,CAAA;MACpCH,QAAQ,CAACK,OAAO,CAACC,OAAO,GAAGN,QAAQ,CAACK,OAAO,CAACC,OAAO,IAAI,EAAE,CAAA;AACzDN,MAAAA,QAAQ,CAACK,OAAO,CAACC,OAAO,CAACC,IAAI;AAC3B;AACA,MAAA,IAAIJ,YAAY,CAAC;AACfK,QAAAA,GAAG,EAAE,IAAI;AACTC,QAAAA,OAAO,EAAE,+CAA+C;AACxDC,QAAAA,MAAM,EAAEb,aAAAA;AACV,OAAC,CACH,CAAC,CAAA;AACH,KAAA;GACD,CAAA;AACH,CAAA;AAEA,IAAM+E,cAAc,GAAGC,uCAAqB,CAAC;AAC3CC,EAAAA,sBAAsB,EAAElF,6BAA6B;AACrDmF,EAAAA,2BAA2B,EAAEpE,kCAAkC;AAC/DqE,EAAAA,6BAA6B,EAAEP,oCAAoC;AACnEQ,EAAAA,sBAAsB,EAAExD,6BAA6B;AACrDyD,EAAAA,mBAAmB,EAAEzC,0BAA0B;AAC/C0C,EAAAA,6BAA6B,EAAEhE,oCAAAA;AACjC,CAAC,CAAC,CAAA;AAgBF;AACaiE,IAAAA,mBAAkE,GAC7ER,cAAc,CAAC7E;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackUnpluginFactory } from \"./webpack4and5\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore webpack is a peer dep\nimport * as webpack4or5 from \"webpack\";\n\nconst BannerPlugin = webpack4or5?.BannerPlugin || webpack4or5?.default?.BannerPlugin;\n\nconst DefinePlugin = webpack4or5?.DefinePlugin || webpack4or5?.default?.DefinePlugin;\n\nconst sentryUnplugin = sentryWebpackUnpluginFactory({\n BannerPlugin,\n DefinePlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"names":["BannerPlugin","webpack4or5","_webpack4or5$default","DefinePlugin","_webpack4or5$default2","sentryUnplugin","sentryWebpackUnpluginFactory","sentryWebpackPlugin","webpack"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAMA,YAAY,GAAG,CAAAC,sBAAW,KAAA,IAAA,IAAXA,sBAAW,KAAXA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,sBAAW,CAAED,YAAY,MAAIC,sBAAW,aAAXA,sBAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAAC,oBAAA,GAAXD,sBAAW,CAAA,SAAA,CAAS,cAAAC,oBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAApBA,oBAAA,CAAsBF,YAAY,CAAA,CAAA;AAEpF,IAAMG,YAAY,GAAG,CAAAF,sBAAW,KAAA,IAAA,IAAXA,sBAAW,KAAXA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,sBAAW,CAAEE,YAAY,MAAIF,sBAAW,aAAXA,sBAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAAG,qBAAA,GAAXH,sBAAW,CAAA,SAAA,CAAS,cAAAG,qBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAApBA,qBAAA,CAAsBD,YAAY,CAAA,CAAA;AAEpF,IAAME,cAAc,GAAGC,yCAA4B,CAAC;AAClDN,EAAAA,YAAY,EAAZA,YAAY;AACZG,EAAAA,YAAY,EAAZA,YAAAA;AACF,CAAC,CAAC,CAAA;;AAEF;AACaI,IAAAA,mBAAkE,GAC7EF,cAAc,CAACG;;;;;;;;"}
|
|
@@ -0,0 +1,250 @@
|
|
|
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 webpackReleaseInjectionPlugin(UnsafeBannerPlugin) {
|
|
80
|
+
return function (injectionCode) {
|
|
81
|
+
return {
|
|
82
|
+
name: "sentry-webpack-release-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: injectionCode
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function webpackComponentNameAnnotatePlugin() {
|
|
106
|
+
return function (ignoredComponents) {
|
|
107
|
+
return {
|
|
108
|
+
name: "sentry-webpack-component-name-annotate-plugin",
|
|
109
|
+
enforce: "pre",
|
|
110
|
+
// Webpack needs this hook for loader logic, so the plugin is not run on unsupported file types
|
|
111
|
+
transformInclude: function transformInclude(id) {
|
|
112
|
+
return id.endsWith(".tsx") || id.endsWith(".jsx");
|
|
113
|
+
},
|
|
114
|
+
transform: bundlerPluginCore.createComponentNameAnnotateHooks(ignoredComponents).transform
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function webpackBundleSizeOptimizationsPlugin(UnsafeDefinePlugin) {
|
|
119
|
+
return function (replacementValues) {
|
|
120
|
+
return {
|
|
121
|
+
name: "sentry-webpack-bundle-size-optimizations-plugin",
|
|
122
|
+
webpack: function webpack(compiler) {
|
|
123
|
+
var _compiler$webpack2;
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
125
|
+
// @ts-ignore webpack version compatibility shenanigans
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
127
|
+
var DefinePlugin =
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
129
|
+
// @ts-ignore webpack version compatibility shenanigans
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
131
|
+
(compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack2 = compiler.webpack) === null || _compiler$webpack2 === void 0 ? void 0 : _compiler$webpack2.DefinePlugin) || UnsafeDefinePlugin;
|
|
132
|
+
compiler.options.plugins = compiler.options.plugins || [];
|
|
133
|
+
compiler.options.plugins.push(
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
135
|
+
new DefinePlugin(_objectSpread2({}, replacementValues)));
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function webpackDebugIdInjectionPlugin(UnsafeBannerPlugin) {
|
|
141
|
+
return function () {
|
|
142
|
+
return {
|
|
143
|
+
name: "sentry-webpack-debug-id-injection-plugin",
|
|
144
|
+
webpack: function webpack(compiler) {
|
|
145
|
+
var _compiler$webpack3;
|
|
146
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
147
|
+
// @ts-ignore webpack version compatibility shenanigans
|
|
148
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
149
|
+
var BannerPlugin =
|
|
150
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
151
|
+
// @ts-ignore webpack version compatibility shenanigans
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
153
|
+
(compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack3 = compiler.webpack) === null || _compiler$webpack3 === void 0 ? void 0 : _compiler$webpack3.BannerPlugin) || UnsafeBannerPlugin;
|
|
154
|
+
compiler.options.plugins = compiler.options.plugins || [];
|
|
155
|
+
compiler.options.plugins.push(
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
157
|
+
new BannerPlugin({
|
|
158
|
+
raw: true,
|
|
159
|
+
include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
|
|
160
|
+
banner: function banner(arg) {
|
|
161
|
+
var _arg$chunk$contentHas, _arg$chunk, _arg$chunk$contentHas2, _arg$chunk2;
|
|
162
|
+
var hash = (_arg$chunk$contentHas = arg === null || arg === void 0 ? void 0 : (_arg$chunk = arg.chunk) === null || _arg$chunk === void 0 ? void 0 : (_arg$chunk$contentHas2 = _arg$chunk.contentHash) === null || _arg$chunk$contentHas2 === void 0 ? void 0 : _arg$chunk$contentHas2.javascript) !== null && _arg$chunk$contentHas !== void 0 ? _arg$chunk$contentHas : arg === null || arg === void 0 ? void 0 : (_arg$chunk2 = arg.chunk) === null || _arg$chunk2 === void 0 ? void 0 : _arg$chunk2.hash;
|
|
163
|
+
var debugId = hash ? bundlerPluginCore.stringToUUID(hash) : uuid.v4();
|
|
164
|
+
return bundlerPluginCore.getDebugIdSnippet(debugId);
|
|
165
|
+
}
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function webpackDebugIdUploadPlugin() {
|
|
172
|
+
var pluginName = "sentry-webpack-debug-id-upload-plugin";
|
|
173
|
+
return function (upload, logger, forceExitOnBuildCompletion) {
|
|
174
|
+
return {
|
|
175
|
+
name: pluginName,
|
|
176
|
+
webpack: function webpack(compiler) {
|
|
177
|
+
compiler.hooks.afterEmit.tapAsync(pluginName, function (compilation, callback) {
|
|
178
|
+
var _ref;
|
|
179
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
180
|
+
var outputPath = (_ref = compilation.outputOptions.path) !== null && _ref !== void 0 ? _ref : path__namespace.resolve();
|
|
181
|
+
var buildArtifacts = Object.keys(compilation.assets).map(function (asset) {
|
|
182
|
+
return path__namespace.join(outputPath, asset);
|
|
183
|
+
});
|
|
184
|
+
void upload(buildArtifacts).then(function () {
|
|
185
|
+
callback();
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
if (forceExitOnBuildCompletion && compiler.options.mode === "production") {
|
|
189
|
+
compiler.hooks.done.tap(pluginName, function () {
|
|
190
|
+
setTimeout(function () {
|
|
191
|
+
logger.debug("Exiting process after debug file upload");
|
|
192
|
+
process.exit(0);
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function webpackModuleMetadataInjectionPlugin(UnsafeBannerPlugin) {
|
|
201
|
+
return function (injectionCode) {
|
|
202
|
+
return {
|
|
203
|
+
name: "sentry-webpack-module-metadata-injection-plugin",
|
|
204
|
+
webpack: function webpack(compiler) {
|
|
205
|
+
var _compiler$webpack4;
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
207
|
+
// @ts-ignore webpack version compatibility shenanigans
|
|
208
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
209
|
+
var BannerPlugin =
|
|
210
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
211
|
+
// @ts-ignore webpack version compatibility shenanigans
|
|
212
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
213
|
+
(compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack4 = compiler.webpack) === null || _compiler$webpack4 === void 0 ? void 0 : _compiler$webpack4.BannerPlugin) || UnsafeBannerPlugin;
|
|
214
|
+
compiler.options.plugins = compiler.options.plugins || [];
|
|
215
|
+
compiler.options.plugins.push(
|
|
216
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
217
|
+
new BannerPlugin({
|
|
218
|
+
raw: true,
|
|
219
|
+
include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
|
|
220
|
+
banner: injectionCode
|
|
221
|
+
}));
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* The factory function accepts BannerPlugin and DefinePlugin classes in
|
|
229
|
+
* order to avoid direct dependencies on webpack.
|
|
230
|
+
*
|
|
231
|
+
* This allow us to export version of the plugin for webpack 5.1+ and compatible environments.
|
|
232
|
+
*
|
|
233
|
+
* Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.
|
|
234
|
+
*/
|
|
235
|
+
function sentryWebpackUnpluginFactory() {
|
|
236
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
237
|
+
BannerPlugin = _ref2.BannerPlugin,
|
|
238
|
+
DefinePlugin = _ref2.DefinePlugin;
|
|
239
|
+
return bundlerPluginCore.sentryUnpluginFactory({
|
|
240
|
+
releaseInjectionPlugin: webpackReleaseInjectionPlugin(BannerPlugin),
|
|
241
|
+
componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin(),
|
|
242
|
+
moduleMetadataInjectionPlugin: webpackModuleMetadataInjectionPlugin(BannerPlugin),
|
|
243
|
+
debugIdInjectionPlugin: webpackDebugIdInjectionPlugin(BannerPlugin),
|
|
244
|
+
debugIdUploadPlugin: webpackDebugIdUploadPlugin(),
|
|
245
|
+
bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin)
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
exports.sentryWebpackUnpluginFactory = sentryWebpackUnpluginFactory;
|
|
250
|
+
//# sourceMappingURL=webpack4and5-068463fa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack4and5-068463fa.js","sources":["../../src/webpack4and5.ts"],"sourcesContent":["import {\n getDebugIdSnippet,\n Options,\n sentryUnpluginFactory,\n stringToUUID,\n SentrySDKBuildFlags,\n createComponentNameAnnotateHooks,\n Logger,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"path\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version\n// https://github.com/webpack/webpack/commit/65eca2e529ce1d79b79200d4bdb1ce1b81141459\n\ninterface BannerPluginCallbackArg {\n chunk?: {\n hash?: string;\n contentHash?: {\n javascript?: string;\n };\n };\n}\n\ntype UnsafeBannerPlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\ntype UnsafeDefinePlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\nfunction webpackReleaseInjectionPlugin(\n UnsafeBannerPlugin: UnsafeBannerPlugin | undefined\n): (injectionCode: string) => UnpluginOptions {\n return (injectionCode: string): UnpluginOptions => ({\n name: \"sentry-webpack-release-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: injectionCode,\n })\n );\n },\n });\n}\n\nfunction webpackComponentNameAnnotatePlugin(): (ignoredComponents?: string[]) => UnpluginOptions {\n return (ignoredComponents?: string[]) => ({\n name: \"sentry-webpack-component-name-annotate-plugin\",\n enforce: \"pre\",\n // Webpack needs this hook for loader logic, so the plugin is not run on unsupported file types\n transformInclude(id) {\n return id.endsWith(\".tsx\") || id.endsWith(\".jsx\");\n },\n transform: createComponentNameAnnotateHooks(ignoredComponents).transform,\n });\n}\n\nfunction webpackBundleSizeOptimizationsPlugin(\n UnsafeDefinePlugin: UnsafeDefinePlugin | undefined\n): (replacementValues: SentrySDKBuildFlags) => UnpluginOptions {\n return (replacementValues: SentrySDKBuildFlags) => ({\n name: \"sentry-webpack-bundle-size-optimizations-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const DefinePlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.DefinePlugin || UnsafeDefinePlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new DefinePlugin({\n ...replacementValues,\n })\n );\n },\n });\n}\n\nfunction webpackDebugIdInjectionPlugin(\n UnsafeBannerPlugin: UnsafeBannerPlugin | undefined\n): () => UnpluginOptions {\n return () => ({\n name: \"sentry-webpack-debug-id-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: (arg?: BannerPluginCallbackArg) => {\n const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;\n const debugId = hash ? stringToUUID(hash) : uuidv4();\n return getDebugIdSnippet(debugId);\n },\n })\n );\n },\n });\n}\n\nfunction webpackDebugIdUploadPlugin(): (\n upload: (buildArtifacts: string[]) => Promise<void>,\n logger: Logger,\n forceExitOnBuildCompletion?: boolean\n) => UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-upload-plugin\";\n return (\n upload: (buildArtifacts: string[]) => Promise<void>,\n logger: Logger,\n forceExitOnBuildCompletion?: boolean\n ) => ({\n name: pluginName,\n webpack(compiler) {\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).then(() => {\n callback();\n });\n });\n\n if (forceExitOnBuildCompletion && compiler.options.mode === \"production\") {\n compiler.hooks.done.tap(pluginName, () => {\n setTimeout(() => {\n logger.debug(\"Exiting process after debug file upload\");\n process.exit(0);\n });\n });\n }\n },\n });\n}\n\nfunction webpackModuleMetadataInjectionPlugin(\n UnsafeBannerPlugin: UnsafeBannerPlugin | undefined\n): (injectionCode: string) => UnpluginOptions {\n return (injectionCode: string) => ({\n name: \"sentry-webpack-module-metadata-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: injectionCode,\n })\n );\n },\n });\n}\n\n/**\n * The factory function accepts BannerPlugin and DefinePlugin classes in\n * order to avoid direct dependencies on webpack.\n *\n * This allow us to export version of the plugin for webpack 5.1+ and compatible environments.\n *\n * Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.\n */\nexport function sentryWebpackUnpluginFactory({\n BannerPlugin,\n DefinePlugin,\n}: {\n BannerPlugin?: UnsafeBannerPlugin;\n DefinePlugin?: UnsafeDefinePlugin;\n} = {}): ReturnType<typeof sentryUnpluginFactory> {\n return sentryUnpluginFactory({\n releaseInjectionPlugin: webpackReleaseInjectionPlugin(BannerPlugin),\n componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin(),\n moduleMetadataInjectionPlugin: webpackModuleMetadataInjectionPlugin(BannerPlugin),\n debugIdInjectionPlugin: webpackDebugIdInjectionPlugin(BannerPlugin),\n debugIdUploadPlugin: webpackDebugIdUploadPlugin(),\n bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin),\n });\n}\n\nexport type SentryWebpackPluginOptions = Options & {\n _experiments?: Options[\"_experiments\"] & {\n /**\n * If enabled, the webpack plugin will exit the build process after the build completes.\n * Use this with caution, as it will terminate the process.\n *\n * More information: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/345\n *\n * @default false\n */\n forceExitOnBuildCompletion?: boolean;\n };\n};\n"],"names":["webpackReleaseInjectionPlugin","UnsafeBannerPlugin","injectionCode","name","webpack","compiler","_compiler$webpack","BannerPlugin","options","plugins","push","raw","include","banner","webpackComponentNameAnnotatePlugin","ignoredComponents","enforce","transformInclude","id","endsWith","transform","createComponentNameAnnotateHooks","webpackBundleSizeOptimizationsPlugin","UnsafeDefinePlugin","replacementValues","_compiler$webpack2","DefinePlugin","_objectSpread","webpackDebugIdInjectionPlugin","_compiler$webpack3","arg","_arg$chunk$contentHas","_arg$chunk","_arg$chunk$contentHas2","_arg$chunk2","hash","chunk","contentHash","javascript","debugId","stringToUUID","uuidv4","getDebugIdSnippet","webpackDebugIdUploadPlugin","pluginName","upload","logger","forceExitOnBuildCompletion","hooks","afterEmit","tapAsync","compilation","callback","_ref","outputPath","outputOptions","path","resolve","buildArtifacts","Object","keys","assets","map","asset","join","then","mode","done","tap","setTimeout","debug","process","exit","webpackModuleMetadataInjectionPlugin","_compiler$webpack4","sentryWebpackUnpluginFactory","_ref2","arguments","length","undefined","sentryUnpluginFactory","releaseInjectionPlugin","componentNameAnnotatePlugin","moduleMetadataInjectionPlugin","debugIdInjectionPlugin","debugIdUploadPlugin","bundleSizeOptimiz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;AACA;AACA;AACA;AACO,SAASyE,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;IALJtE,YAAY,GAAAqE,KAAA,CAAZrE,YAAY;IACZmB,YAAY,GAAAkD,KAAA,CAAZlD,YAAY,CAAA;AAKZ,EAAA,OAAOsD,uCAAqB,CAAC;AAC3BC,IAAAA,sBAAsB,EAAEjF,6BAA6B,CAACO,YAAY,CAAC;IACnE2E,2BAA2B,EAAEpE,kCAAkC,EAAE;AACjEqE,IAAAA,6BAA6B,EAAEV,oCAAoC,CAAClE,YAAY,CAAC;AACjF6E,IAAAA,sBAAsB,EAAExD,6BAA6B,CAACrB,YAAY,CAAC;IACnE8E,mBAAmB,EAAE1C,0BAA0B,EAAE;IACjD2C,6BAA6B,EAAEhE,oCAAoC,CAACI,YAAY,CAAA;AAClF,GAAC,CAAC,CAAA;AACJ;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var webpack4and5 = require('./webpack4and5-068463fa.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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack5.js","sources":["../../src/webpack5.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackUnpluginFactory } from \"./webpack4and5\";\n\nconst sentryUnplugin = sentryWebpackUnpluginFactory();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"names":["sentryUnplugin","sentryWebpackUnpluginFactory","sentryWebpackPlugin","webpack"],"mappings":";;;;;;;;;AAEA,IAAMA,cAAc,GAAGC,yCAA4B,EAAE,CAAA;;AAErD;AACaC,IAAAA,mBAAkE,GAC7EF,cAAc,CAACG;;;;;;;;"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,205 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { sentryCliBinaryExists } from '@sentry/bundler-plugin-core';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import { v4 } from 'uuid';
|
|
1
|
+
import { s as sentryWebpackUnpluginFactory } from './webpack4and5-bffa70d9.js';
|
|
5
2
|
import * as webpack4or5 from 'webpack';
|
|
3
|
+
export { sentryCliBinaryExists } from '@sentry/bundler-plugin-core';
|
|
4
|
+
import 'path';
|
|
5
|
+
import 'uuid';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
})), keys.push.apply(keys, symbols);
|
|
14
|
-
}
|
|
15
|
-
return keys;
|
|
16
|
-
}
|
|
17
|
-
function _objectSpread2(target) {
|
|
18
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
19
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
20
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
21
|
-
_defineProperty(target, key, source[key]);
|
|
22
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
23
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return target;
|
|
27
|
-
}
|
|
28
|
-
function _defineProperty(obj, key, value) {
|
|
29
|
-
key = _toPropertyKey(key);
|
|
30
|
-
if (key in obj) {
|
|
31
|
-
Object.defineProperty(obj, key, {
|
|
32
|
-
value: value,
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true
|
|
36
|
-
});
|
|
37
|
-
} else {
|
|
38
|
-
obj[key] = value;
|
|
39
|
-
}
|
|
40
|
-
return obj;
|
|
41
|
-
}
|
|
42
|
-
function _toPrimitive(input, hint) {
|
|
43
|
-
if (typeof input !== "object" || input === null) return input;
|
|
44
|
-
var prim = input[Symbol.toPrimitive];
|
|
45
|
-
if (prim !== undefined) {
|
|
46
|
-
var res = prim.call(input, hint || "default");
|
|
47
|
-
if (typeof res !== "object") return res;
|
|
48
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
49
|
-
}
|
|
50
|
-
return (hint === "string" ? String : Number)(input);
|
|
51
|
-
}
|
|
52
|
-
function _toPropertyKey(arg) {
|
|
53
|
-
var key = _toPrimitive(arg, "string");
|
|
54
|
-
return typeof key === "symbol" ? key : String(key);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function webpackReleaseInjectionPlugin(injectionCode) {
|
|
58
|
-
return {
|
|
59
|
-
name: "sentry-webpack-release-injection-plugin",
|
|
60
|
-
webpack: function webpack(compiler) {
|
|
61
|
-
var _compiler$webpack, _webpack4or5$default;
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
63
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
65
|
-
var BannerPlugin =
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
67
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
69
|
-
(compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack = compiler.webpack) === null || _compiler$webpack === void 0 ? void 0 : _compiler$webpack.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);
|
|
70
|
-
compiler.options.plugins = compiler.options.plugins || [];
|
|
71
|
-
compiler.options.plugins.push(
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
73
|
-
new BannerPlugin({
|
|
74
|
-
raw: true,
|
|
75
|
-
include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
|
|
76
|
-
banner: injectionCode
|
|
77
|
-
}));
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
function webpackComponentNameAnnotatePlugin(ignoredComponents) {
|
|
82
|
-
return {
|
|
83
|
-
name: "sentry-webpack-component-name-annotate-plugin",
|
|
84
|
-
enforce: "pre",
|
|
85
|
-
// Webpack needs this hook for loader logic, so the plugin is not run on unsupported file types
|
|
86
|
-
transformInclude: function transformInclude(id) {
|
|
87
|
-
return id.endsWith(".tsx") || id.endsWith(".jsx");
|
|
88
|
-
},
|
|
89
|
-
transform: createComponentNameAnnotateHooks(ignoredComponents).transform
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function webpackBundleSizeOptimizationsPlugin(replacementValues) {
|
|
93
|
-
return {
|
|
94
|
-
name: "sentry-webpack-bundle-size-optimizations-plugin",
|
|
95
|
-
webpack: function webpack(compiler) {
|
|
96
|
-
var _compiler$webpack2, _webpack4or5$default2;
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
98
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
100
|
-
var DefinePlugin =
|
|
101
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
102
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
103
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
104
|
-
(compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack2 = compiler.webpack) === null || _compiler$webpack2 === void 0 ? void 0 : _compiler$webpack2.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);
|
|
105
|
-
compiler.options.plugins = compiler.options.plugins || [];
|
|
106
|
-
compiler.options.plugins.push(
|
|
107
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
108
|
-
new DefinePlugin(_objectSpread2({}, replacementValues)));
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
function webpackDebugIdInjectionPlugin() {
|
|
113
|
-
return {
|
|
114
|
-
name: "sentry-webpack-debug-id-injection-plugin",
|
|
115
|
-
webpack: function webpack(compiler) {
|
|
116
|
-
var _compiler$webpack3, _webpack4or5$default3;
|
|
117
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
118
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
119
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
120
|
-
var BannerPlugin =
|
|
121
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
122
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
123
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
124
|
-
(compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack3 = compiler.webpack) === null || _compiler$webpack3 === void 0 ? void 0 : _compiler$webpack3.BannerPlugin) || (webpack4or5 === null || webpack4or5 === void 0 ? void 0 : webpack4or5.BannerPlugin) || (webpack4or5 === null || webpack4or5 === void 0 ? void 0 : (_webpack4or5$default3 = webpack4or5["default"]) === null || _webpack4or5$default3 === void 0 ? void 0 : _webpack4or5$default3.BannerPlugin);
|
|
125
|
-
compiler.options.plugins = compiler.options.plugins || [];
|
|
126
|
-
compiler.options.plugins.push(
|
|
127
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
128
|
-
new BannerPlugin({
|
|
129
|
-
raw: true,
|
|
130
|
-
include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
|
|
131
|
-
banner: function banner(arg) {
|
|
132
|
-
var _arg$chunk$contentHas, _arg$chunk, _arg$chunk$contentHas2, _arg$chunk2;
|
|
133
|
-
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;
|
|
134
|
-
var debugId = hash ? stringToUUID(hash) : v4();
|
|
135
|
-
return getDebugIdSnippet(debugId);
|
|
136
|
-
}
|
|
137
|
-
}));
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function webpackDebugIdUploadPlugin(upload, logger, createDependencyOnBuildArtifacts, forceExitOnBuildCompletion) {
|
|
142
|
-
var pluginName = "sentry-webpack-debug-id-upload-plugin";
|
|
143
|
-
return {
|
|
144
|
-
name: pluginName,
|
|
145
|
-
webpack: function webpack(compiler) {
|
|
146
|
-
var freeGlobalDependencyOnDebugIdSourcemapArtifacts = createDependencyOnBuildArtifacts();
|
|
147
|
-
compiler.hooks.afterEmit.tapAsync(pluginName, function (compilation, callback) {
|
|
148
|
-
var _ref;
|
|
149
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
150
|
-
var outputPath = (_ref = compilation.outputOptions.path) !== null && _ref !== void 0 ? _ref : path.resolve();
|
|
151
|
-
var buildArtifacts = Object.keys(compilation.assets).map(function (asset) {
|
|
152
|
-
return path.join(outputPath, asset);
|
|
153
|
-
});
|
|
154
|
-
void upload(buildArtifacts).then(function () {
|
|
155
|
-
callback();
|
|
156
|
-
})["finally"](function () {
|
|
157
|
-
freeGlobalDependencyOnDebugIdSourcemapArtifacts();
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
if (forceExitOnBuildCompletion && compiler.options.mode === "production") {
|
|
161
|
-
compiler.hooks.done.tap(pluginName, function () {
|
|
162
|
-
setTimeout(function () {
|
|
163
|
-
logger.debug("Exiting process after debug file upload");
|
|
164
|
-
process.exit(0);
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
function webpackModuleMetadataInjectionPlugin(injectionCode) {
|
|
172
|
-
return {
|
|
173
|
-
name: "sentry-webpack-module-metadata-injection-plugin",
|
|
174
|
-
webpack: function webpack(compiler) {
|
|
175
|
-
var _compiler$webpack4, _webpack4or5$default4;
|
|
176
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
177
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
178
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
179
|
-
var BannerPlugin =
|
|
180
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
181
|
-
// @ts-ignore webpack version compatibility shenanigans
|
|
182
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
183
|
-
(compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack4 = compiler.webpack) === null || _compiler$webpack4 === void 0 ? void 0 : _compiler$webpack4.BannerPlugin) || (webpack4or5 === null || webpack4or5 === void 0 ? void 0 : webpack4or5.BannerPlugin) || (webpack4or5 === null || webpack4or5 === void 0 ? void 0 : (_webpack4or5$default4 = webpack4or5["default"]) === null || _webpack4or5$default4 === void 0 ? void 0 : _webpack4or5$default4.BannerPlugin);
|
|
184
|
-
compiler.options.plugins = compiler.options.plugins || [];
|
|
185
|
-
compiler.options.plugins.push(
|
|
186
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
187
|
-
new BannerPlugin({
|
|
188
|
-
raw: true,
|
|
189
|
-
include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
|
|
190
|
-
banner: injectionCode
|
|
191
|
-
}));
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
var sentryUnplugin = sentryUnpluginFactory({
|
|
196
|
-
releaseInjectionPlugin: webpackReleaseInjectionPlugin,
|
|
197
|
-
componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin,
|
|
198
|
-
moduleMetadataInjectionPlugin: webpackModuleMetadataInjectionPlugin,
|
|
199
|
-
debugIdInjectionPlugin: webpackDebugIdInjectionPlugin,
|
|
200
|
-
debugIdUploadPlugin: webpackDebugIdUploadPlugin,
|
|
201
|
-
bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin
|
|
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
|
+
var sentryUnplugin = sentryWebpackUnpluginFactory({
|
|
11
|
+
BannerPlugin: BannerPlugin,
|
|
12
|
+
DefinePlugin: DefinePlugin
|
|
202
13
|
});
|
|
14
|
+
|
|
203
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
204
16
|
var sentryWebpackPlugin = sentryUnplugin.webpack;
|
|
205
17
|
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"sourcesContent":["import {\n getDebugIdSnippet,\n Options,\n sentryUnpluginFactory,\n stringToUUID,\n SentrySDKBuildFlags,\n createComponentNameAnnotateHooks,\n Logger,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"path\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore webpack is a peer dep\nimport * as webpack4or5 from \"webpack\";\n\ninterface BannerPluginCallbackArg {\n chunk?: {\n hash?: string;\n contentHash?: {\n javascript?: string;\n };\n };\n}\n\nfunction webpackReleaseInjectionPlugin(injectionCode: string): UnpluginOptions {\n return {\n name: \"sentry-webpack-release-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin ||\n webpack4or5?.BannerPlugin ||\n webpack4or5?.default?.BannerPlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: injectionCode,\n })\n );\n },\n };\n}\n\nfunction webpackComponentNameAnnotatePlugin(ignoredComponents?: string[]): UnpluginOptions {\n return {\n name: \"sentry-webpack-component-name-annotate-plugin\",\n enforce: \"pre\",\n // Webpack needs this hook for loader logic, so the plugin is not run on unsupported file types\n transformInclude(id) {\n return id.endsWith(\".tsx\") || id.endsWith(\".jsx\");\n },\n transform: createComponentNameAnnotateHooks(ignoredComponents).transform,\n };\n}\n\nfunction webpackBundleSizeOptimizationsPlugin(\n replacementValues: SentrySDKBuildFlags\n): UnpluginOptions {\n return {\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 ||\n webpack4or5?.DefinePlugin ||\n webpack4or5?.default?.DefinePlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new DefinePlugin({\n ...replacementValues,\n })\n );\n },\n };\n}\n\nfunction webpackDebugIdInjectionPlugin(): UnpluginOptions {\n return {\n name: \"sentry-webpack-debug-id-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin ||\n webpack4or5?.BannerPlugin ||\n webpack4or5?.default?.BannerPlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: (arg?: BannerPluginCallbackArg) => {\n const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;\n const debugId = hash ? stringToUUID(hash) : uuidv4();\n return getDebugIdSnippet(debugId);\n },\n })\n );\n },\n };\n}\n\nfunction webpackDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>,\n logger: Logger,\n createDependencyOnBuildArtifacts: () => () => void,\n forceExitOnBuildCompletion?: boolean\n): UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-upload-plugin\";\n return {\n name: pluginName,\n webpack(compiler) {\n const freeGlobalDependencyOnDebugIdSourcemapArtifacts = createDependencyOnBuildArtifacts();\n\n compiler.hooks.afterEmit.tapAsync(pluginName, (compilation, callback: () => void) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const outputPath = (compilation.outputOptions.path as string | undefined) ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets as Record<string, unknown>).map(\n (asset) => path.join(outputPath, asset)\n );\n void upload(buildArtifacts)\n .then(() => {\n callback();\n })\n .finally(() => {\n freeGlobalDependencyOnDebugIdSourcemapArtifacts();\n });\n });\n\n if (forceExitOnBuildCompletion && compiler.options.mode === \"production\") {\n compiler.hooks.done.tap(pluginName, () => {\n setTimeout(() => {\n logger.debug(\"Exiting process after debug file upload\");\n process.exit(0);\n });\n });\n }\n },\n };\n}\n\nfunction webpackModuleMetadataInjectionPlugin(injectionCode: string): UnpluginOptions {\n return {\n name: \"sentry-webpack-module-metadata-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin ||\n webpack4or5?.BannerPlugin ||\n webpack4or5?.default?.BannerPlugin;\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: injectionCode,\n })\n );\n },\n };\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n releaseInjectionPlugin: webpackReleaseInjectionPlugin,\n componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin,\n moduleMetadataInjectionPlugin: webpackModuleMetadataInjectionPlugin,\n debugIdInjectionPlugin: webpackDebugIdInjectionPlugin,\n debugIdUploadPlugin: webpackDebugIdUploadPlugin,\n bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin,\n});\n\ntype 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\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":["webpackReleaseInjectionPlugin","injectionCode","name","webpack","compiler","_compiler$webpack","_webpack4or5$default","BannerPlugin","webpack4or5","options","plugins","push","raw","include","banner","webpackComponentNameAnnotatePlugin","ignoredComponents","enforce","transformInclude","id","endsWith","transform","createComponentNameAnnotateHooks","webpackBundleSizeOptimizationsPlugin","replacementValues","_compiler$webpack2","_webpack4or5$default2","DefinePlugin","_objectSpread","webpackDebugIdInjectionPlugin","_compiler$webpack3","_webpack4or5$default3","arg","_arg$chunk$contentHas","_arg$chunk","_arg$chunk$contentHas2","_arg$chunk2","hash","chunk","contentHash","javascript","debugId","stringToUUID","uuidv4","getDebugIdSnippet","webpackDebugIdUploadPlugin","upload","logger","createDependencyOnBuildArtifacts","forceExitOnBuildCompletion","pluginName","freeGlobalDependencyOnDebugIdSourcemapArtifacts","hooks","afterEmit","tapAsync","compilation","callback","_ref","outputPath","outputOptions","path","resolve","buildArtifacts","Object","keys","assets","map","asset","join","then","mode","done","tap","setTimeout","debug","process","exit","webpackModuleMetadataInjectionPlugin","_compiler$webpack4","_webpack4or5$default4","sentryUnplugin","sentryUnpluginFactory","releaseInjectionPlugin","componentNameAnnotatePlugin","moduleM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EAAElF,6BAA6B;AACrDmF,EAAAA,2BAA2B,EAAEpE,kCAAkC;AAC/DqE,EAAAA,6BAA6B,EAAEP,oCAAoC;AACnEQ,EAAAA,sBAAsB,EAAExD,6BAA6B;AACrDyD,EAAAA,mBAAmB,EAAEzC,0BAA0B;AAC/C0C,EAAAA,6BAA6B,EAAEhE,oCAAAA;AACjC,CAAC,CAAC,CAAA;AAgBF;AACaiE,IAAAA,mBAAkE,GAC7ER,cAAc,CAAC7E;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackUnpluginFactory } from \"./webpack4and5\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore webpack is a peer dep\nimport * as webpack4or5 from \"webpack\";\n\nconst BannerPlugin = webpack4or5?.BannerPlugin || webpack4or5?.default?.BannerPlugin;\n\nconst DefinePlugin = webpack4or5?.DefinePlugin || webpack4or5?.default?.DefinePlugin;\n\nconst sentryUnplugin = sentryWebpackUnpluginFactory({\n BannerPlugin,\n DefinePlugin,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"names":["BannerPlugin","webpack4or5","_webpack4or5$default","DefinePlugin","_webpack4or5$default2","sentryUnplugin","sentryWebpackUnpluginFactory","sentryWebpackPlugin","webpack"],"mappings":";;;;;;;AAMA,IAAMA,YAAY,GAAG,CAAAC,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAXA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,WAAW,CAAED,YAAY,MAAIC,WAAW,aAAXA,WAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAAC,oBAAA,GAAXD,WAAW,CAAA,SAAA,CAAS,cAAAC,oBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAApBA,oBAAA,CAAsBF,YAAY,CAAA,CAAA;AAEpF,IAAMG,YAAY,GAAG,CAAAF,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAXA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,WAAW,CAAEE,YAAY,MAAIF,WAAW,aAAXA,WAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAAG,qBAAA,GAAXH,WAAW,CAAA,SAAA,CAAS,cAAAG,qBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAApBA,qBAAA,CAAsBD,YAAY,CAAA,CAAA;AAEpF,IAAME,cAAc,GAAGC,4BAA4B,CAAC;AAClDN,EAAAA,YAAY,EAAZA,YAAY;AACZG,EAAAA,YAAY,EAAZA,YAAAA;AACF,CAAC,CAAC,CAAA;;AAEF;AACaI,IAAAA,mBAAkE,GAC7EF,cAAc,CAACG;;;;"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { sentryUnpluginFactory, createComponentNameAnnotateHooks, stringToUUID, getDebugIdSnippet } 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 webpackReleaseInjectionPlugin(UnsafeBannerPlugin) {
|
|
58
|
+
return function (injectionCode) {
|
|
59
|
+
return {
|
|
60
|
+
name: "sentry-webpack-release-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: injectionCode
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function webpackComponentNameAnnotatePlugin() {
|
|
84
|
+
return function (ignoredComponents) {
|
|
85
|
+
return {
|
|
86
|
+
name: "sentry-webpack-component-name-annotate-plugin",
|
|
87
|
+
enforce: "pre",
|
|
88
|
+
// Webpack needs this hook for loader logic, so the plugin is not run on unsupported file types
|
|
89
|
+
transformInclude: function transformInclude(id) {
|
|
90
|
+
return id.endsWith(".tsx") || id.endsWith(".jsx");
|
|
91
|
+
},
|
|
92
|
+
transform: createComponentNameAnnotateHooks(ignoredComponents).transform
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function webpackBundleSizeOptimizationsPlugin(UnsafeDefinePlugin) {
|
|
97
|
+
return function (replacementValues) {
|
|
98
|
+
return {
|
|
99
|
+
name: "sentry-webpack-bundle-size-optimizations-plugin",
|
|
100
|
+
webpack: function webpack(compiler) {
|
|
101
|
+
var _compiler$webpack2;
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
103
|
+
// @ts-ignore webpack version compatibility shenanigans
|
|
104
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
105
|
+
var DefinePlugin =
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
107
|
+
// @ts-ignore webpack version compatibility shenanigans
|
|
108
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
109
|
+
(compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack2 = compiler.webpack) === null || _compiler$webpack2 === void 0 ? void 0 : _compiler$webpack2.DefinePlugin) || UnsafeDefinePlugin;
|
|
110
|
+
compiler.options.plugins = compiler.options.plugins || [];
|
|
111
|
+
compiler.options.plugins.push(
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
113
|
+
new DefinePlugin(_objectSpread2({}, replacementValues)));
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function webpackDebugIdInjectionPlugin(UnsafeBannerPlugin) {
|
|
119
|
+
return function () {
|
|
120
|
+
return {
|
|
121
|
+
name: "sentry-webpack-debug-id-injection-plugin",
|
|
122
|
+
webpack: function webpack(compiler) {
|
|
123
|
+
var _compiler$webpack3;
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
125
|
+
// @ts-ignore webpack version compatibility shenanigans
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
127
|
+
var BannerPlugin =
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
129
|
+
// @ts-ignore webpack version compatibility shenanigans
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
131
|
+
(compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack3 = compiler.webpack) === null || _compiler$webpack3 === void 0 ? void 0 : _compiler$webpack3.BannerPlugin) || UnsafeBannerPlugin;
|
|
132
|
+
compiler.options.plugins = compiler.options.plugins || [];
|
|
133
|
+
compiler.options.plugins.push(
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
135
|
+
new BannerPlugin({
|
|
136
|
+
raw: true,
|
|
137
|
+
include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
|
|
138
|
+
banner: function banner(arg) {
|
|
139
|
+
var _arg$chunk$contentHas, _arg$chunk, _arg$chunk$contentHas2, _arg$chunk2;
|
|
140
|
+
var hash = (_arg$chunk$contentHas = arg === null || arg === void 0 ? void 0 : (_arg$chunk = arg.chunk) === null || _arg$chunk === void 0 ? void 0 : (_arg$chunk$contentHas2 = _arg$chunk.contentHash) === null || _arg$chunk$contentHas2 === void 0 ? void 0 : _arg$chunk$contentHas2.javascript) !== null && _arg$chunk$contentHas !== void 0 ? _arg$chunk$contentHas : arg === null || arg === void 0 ? void 0 : (_arg$chunk2 = arg.chunk) === null || _arg$chunk2 === void 0 ? void 0 : _arg$chunk2.hash;
|
|
141
|
+
var debugId = hash ? stringToUUID(hash) : v4();
|
|
142
|
+
return getDebugIdSnippet(debugId);
|
|
143
|
+
}
|
|
144
|
+
}));
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function webpackDebugIdUploadPlugin() {
|
|
150
|
+
var pluginName = "sentry-webpack-debug-id-upload-plugin";
|
|
151
|
+
return function (upload, logger, forceExitOnBuildCompletion) {
|
|
152
|
+
return {
|
|
153
|
+
name: pluginName,
|
|
154
|
+
webpack: function webpack(compiler) {
|
|
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.resolve();
|
|
159
|
+
var buildArtifacts = Object.keys(compilation.assets).map(function (asset) {
|
|
160
|
+
return path.join(outputPath, asset);
|
|
161
|
+
});
|
|
162
|
+
void upload(buildArtifacts).then(function () {
|
|
163
|
+
callback();
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
if (forceExitOnBuildCompletion && compiler.options.mode === "production") {
|
|
167
|
+
compiler.hooks.done.tap(pluginName, function () {
|
|
168
|
+
setTimeout(function () {
|
|
169
|
+
logger.debug("Exiting process after debug file upload");
|
|
170
|
+
process.exit(0);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function webpackModuleMetadataInjectionPlugin(UnsafeBannerPlugin) {
|
|
179
|
+
return function (injectionCode) {
|
|
180
|
+
return {
|
|
181
|
+
name: "sentry-webpack-module-metadata-injection-plugin",
|
|
182
|
+
webpack: function webpack(compiler) {
|
|
183
|
+
var _compiler$webpack4;
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
185
|
+
// @ts-ignore webpack version compatibility shenanigans
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
187
|
+
var BannerPlugin =
|
|
188
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
189
|
+
// @ts-ignore webpack version compatibility shenanigans
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
191
|
+
(compiler === null || compiler === void 0 ? void 0 : (_compiler$webpack4 = compiler.webpack) === null || _compiler$webpack4 === void 0 ? void 0 : _compiler$webpack4.BannerPlugin) || UnsafeBannerPlugin;
|
|
192
|
+
compiler.options.plugins = compiler.options.plugins || [];
|
|
193
|
+
compiler.options.plugins.push(
|
|
194
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
|
|
195
|
+
new BannerPlugin({
|
|
196
|
+
raw: true,
|
|
197
|
+
include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
|
|
198
|
+
banner: injectionCode
|
|
199
|
+
}));
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* The factory function accepts BannerPlugin and DefinePlugin classes in
|
|
207
|
+
* order to avoid direct dependencies on webpack.
|
|
208
|
+
*
|
|
209
|
+
* This allow us to export version of the plugin for webpack 5.1+ and compatible environments.
|
|
210
|
+
*
|
|
211
|
+
* Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.
|
|
212
|
+
*/
|
|
213
|
+
function sentryWebpackUnpluginFactory() {
|
|
214
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
215
|
+
BannerPlugin = _ref2.BannerPlugin,
|
|
216
|
+
DefinePlugin = _ref2.DefinePlugin;
|
|
217
|
+
return sentryUnpluginFactory({
|
|
218
|
+
releaseInjectionPlugin: webpackReleaseInjectionPlugin(BannerPlugin),
|
|
219
|
+
componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin(),
|
|
220
|
+
moduleMetadataInjectionPlugin: webpackModuleMetadataInjectionPlugin(BannerPlugin),
|
|
221
|
+
debugIdInjectionPlugin: webpackDebugIdInjectionPlugin(BannerPlugin),
|
|
222
|
+
debugIdUploadPlugin: webpackDebugIdUploadPlugin(),
|
|
223
|
+
bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin)
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export { sentryWebpackUnpluginFactory as s };
|
|
228
|
+
//# sourceMappingURL=webpack4and5-bffa70d9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack4and5-bffa70d9.js","sources":["../../src/webpack4and5.ts"],"sourcesContent":["import {\n getDebugIdSnippet,\n Options,\n sentryUnpluginFactory,\n stringToUUID,\n SentrySDKBuildFlags,\n createComponentNameAnnotateHooks,\n Logger,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"path\";\nimport { UnpluginOptions } from \"unplugin\";\nimport { v4 as uuidv4 } from \"uuid\";\n\n// since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version\n// https://github.com/webpack/webpack/commit/65eca2e529ce1d79b79200d4bdb1ce1b81141459\n\ninterface BannerPluginCallbackArg {\n chunk?: {\n hash?: string;\n contentHash?: {\n javascript?: string;\n };\n };\n}\n\ntype UnsafeBannerPlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\ntype UnsafeDefinePlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\nfunction webpackReleaseInjectionPlugin(\n UnsafeBannerPlugin: UnsafeBannerPlugin | undefined\n): (injectionCode: string) => UnpluginOptions {\n return (injectionCode: string): UnpluginOptions => ({\n name: \"sentry-webpack-release-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: injectionCode,\n })\n );\n },\n });\n}\n\nfunction webpackComponentNameAnnotatePlugin(): (ignoredComponents?: string[]) => UnpluginOptions {\n return (ignoredComponents?: string[]) => ({\n name: \"sentry-webpack-component-name-annotate-plugin\",\n enforce: \"pre\",\n // Webpack needs this hook for loader logic, so the plugin is not run on unsupported file types\n transformInclude(id) {\n return id.endsWith(\".tsx\") || id.endsWith(\".jsx\");\n },\n transform: createComponentNameAnnotateHooks(ignoredComponents).transform,\n });\n}\n\nfunction webpackBundleSizeOptimizationsPlugin(\n UnsafeDefinePlugin: UnsafeDefinePlugin | undefined\n): (replacementValues: SentrySDKBuildFlags) => UnpluginOptions {\n return (replacementValues: SentrySDKBuildFlags) => ({\n name: \"sentry-webpack-bundle-size-optimizations-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const DefinePlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.DefinePlugin || UnsafeDefinePlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new DefinePlugin({\n ...replacementValues,\n })\n );\n },\n });\n}\n\nfunction webpackDebugIdInjectionPlugin(\n UnsafeBannerPlugin: UnsafeBannerPlugin | undefined\n): () => UnpluginOptions {\n return () => ({\n name: \"sentry-webpack-debug-id-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: (arg?: BannerPluginCallbackArg) => {\n const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;\n const debugId = hash ? stringToUUID(hash) : uuidv4();\n return getDebugIdSnippet(debugId);\n },\n })\n );\n },\n });\n}\n\nfunction webpackDebugIdUploadPlugin(): (\n upload: (buildArtifacts: string[]) => Promise<void>,\n logger: Logger,\n forceExitOnBuildCompletion?: boolean\n) => UnpluginOptions {\n const pluginName = \"sentry-webpack-debug-id-upload-plugin\";\n return (\n upload: (buildArtifacts: string[]) => Promise<void>,\n logger: Logger,\n forceExitOnBuildCompletion?: boolean\n ) => ({\n name: pluginName,\n webpack(compiler) {\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).then(() => {\n callback();\n });\n });\n\n if (forceExitOnBuildCompletion && compiler.options.mode === \"production\") {\n compiler.hooks.done.tap(pluginName, () => {\n setTimeout(() => {\n logger.debug(\"Exiting process after debug file upload\");\n process.exit(0);\n });\n });\n }\n },\n });\n}\n\nfunction webpackModuleMetadataInjectionPlugin(\n UnsafeBannerPlugin: UnsafeBannerPlugin | undefined\n): (injectionCode: string) => UnpluginOptions {\n return (injectionCode: string) => ({\n name: \"sentry-webpack-module-metadata-injection-plugin\",\n webpack(compiler) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n const BannerPlugin =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore webpack version compatibility shenanigans\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: injectionCode,\n })\n );\n },\n });\n}\n\n/**\n * The factory function accepts BannerPlugin and DefinePlugin classes in\n * order to avoid direct dependencies on webpack.\n *\n * This allow us to export version of the plugin for webpack 5.1+ and compatible environments.\n *\n * Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.\n */\nexport function sentryWebpackUnpluginFactory({\n BannerPlugin,\n DefinePlugin,\n}: {\n BannerPlugin?: UnsafeBannerPlugin;\n DefinePlugin?: UnsafeDefinePlugin;\n} = {}): ReturnType<typeof sentryUnpluginFactory> {\n return sentryUnpluginFactory({\n releaseInjectionPlugin: webpackReleaseInjectionPlugin(BannerPlugin),\n componentNameAnnotatePlugin: webpackComponentNameAnnotatePlugin(),\n moduleMetadataInjectionPlugin: webpackModuleMetadataInjectionPlugin(BannerPlugin),\n debugIdInjectionPlugin: webpackDebugIdInjectionPlugin(BannerPlugin),\n debugIdUploadPlugin: webpackDebugIdUploadPlugin(),\n bundleSizeOptimizationsPlugin: webpackBundleSizeOptimizationsPlugin(DefinePlugin),\n });\n}\n\nexport type SentryWebpackPluginOptions = Options & {\n _experiments?: Options[\"_experiments\"] & {\n /**\n * If enabled, the webpack plugin will exit the build process after the build completes.\n * Use this with caution, as it will terminate the process.\n *\n * More information: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/345\n *\n * @default false\n */\n forceExitOnBuildCompletion?: boolean;\n };\n};\n"],"names":["webpackReleaseInjectionPlugin","UnsafeBannerPlugin","injectionCode","name","webpack","compiler","_compiler$webpack","BannerPlugin","options","plugins","push","raw","include","banner","webpackComponentNameAnnotatePlugin","ignoredComponents","enforce","transformInclude","id","endsWith","transform","createComponentNameAnnotateHooks","webpackBundleSizeOptimizationsPlugin","UnsafeDefinePlugin","replacementValues","_compiler$webpack2","DefinePlugin","_objectSpread","webpackDebugIdInjectionPlugin","_compiler$webpack3","arg","_arg$chunk$contentHas","_arg$chunk","_arg$chunk$contentHas2","_arg$chunk2","hash","chunk","contentHash","javascript","debugId","stringToUUID","uuidv4","getDebugIdSnippet","webpackDebugIdUploadPlugin","pluginName","upload","logger","forceExitOnBuildCompletion","hooks","afterEmit","tapAsync","compilation","callback","_ref","outputPath","outputOptions","path","resolve","buildArtifacts","Object","keys","assets","map","asset","join","then","mode","done","tap","setTimeout","debug","process","exit","webpackModuleMetadataInjectionPlugin","_compiler$webpack4","sentryWebpackUnpluginFactory","_ref2","arguments","length","undefined","sentryUnpluginFactory","releaseInjectionPlugin","componentNameAnnotatePlugin","moduleMetadataInjectionPlugin","debugIdInjectionPlugin","debugIdUploadPlugin","bundleSizeOptimizationsPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;AACA;AAqBA,SAASA,6BAA6BA,CACpCC,kBAAkD,EACN;AAC5C,EAAA,OAAO,UAACC,aAAqB,EAA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JtE,YAAY,GAAAqE,KAAA,CAAZrE,YAAY;IACZmB,YAAY,GAAAkD,KAAA,CAAZlD,YAAY,CAAA;AAKZ,EAAA,OAAOsD,qBAAqB,CAAC;AAC3BC,IAAAA,sBAAsB,EAAEjF,6BAA6B,CAACO,YAAY,CAAC;IACnE2E,2BAA2B,EAAEpE,kCAAkC,EAAE;AACjEqE,IAAAA,6BAA6B,EAAEV,oCAAoC,CAAClE,YAAY,CAAC;AACjF6E,IAAAA,sBAAsB,EAAExD,6BAA6B,CAACrB,YAAY,CAAC;IACnE8E,mBAAmB,EAAE1C,0BAA0B,EAAE;IACjD2C,6BAA6B,EAAEhE,oCAAoC,CAACI,YAAY,CAAA;AAClF,GAAC,CAAC,CAAA;AACJ;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { s as sentryWebpackUnpluginFactory } from './webpack4and5-bffa70d9.js';
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack5.mjs","sources":["../../src/webpack5.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackUnpluginFactory } from \"./webpack4and5\";\n\nconst sentryUnplugin = sentryWebpackUnpluginFactory();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryUnplugin.webpack;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"names":["sentryUnplugin","sentryWebpackUnpluginFactory","sentryWebpackPlugin","webpack"],"mappings":";;;;;AAEA,IAAMA,cAAc,GAAGC,4BAA4B,EAAE,CAAA;;AAErD;AACaC,IAAAA,mBAAkE,GAC7EF,cAAc,CAACG;;;;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type SentryWebpackPluginOptions = Options & {
|
|
3
|
-
_experiments?: Options["_experiments"] & {
|
|
4
|
-
/**
|
|
5
|
-
* If enabled, the webpack plugin will exit the build process after the build completes.
|
|
6
|
-
* Use this with caution, as it will terminate the process.
|
|
7
|
-
*
|
|
8
|
-
* More information: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/345
|
|
9
|
-
*
|
|
10
|
-
* @default false
|
|
11
|
-
*/
|
|
12
|
-
forceExitOnBuildCompletion?: boolean;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
1
|
+
import { SentryWebpackPluginOptions } from "./webpack4and5";
|
|
15
2
|
export declare const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any;
|
|
16
3
|
export { sentryCliBinaryExists } from "@sentry/bundler-plugin-core";
|
|
17
4
|
export type { SentryWebpackPluginOptions };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Options, sentryUnpluginFactory } from "@sentry/bundler-plugin-core";
|
|
2
|
+
type UnsafeBannerPlugin = {
|
|
3
|
+
new (options: any): unknown;
|
|
4
|
+
};
|
|
5
|
+
type UnsafeDefinePlugin = {
|
|
6
|
+
new (options: any): unknown;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The factory function accepts BannerPlugin and DefinePlugin classes in
|
|
10
|
+
* order to avoid direct dependencies on webpack.
|
|
11
|
+
*
|
|
12
|
+
* This allow us to export version of the plugin for webpack 5.1+ and compatible environments.
|
|
13
|
+
*
|
|
14
|
+
* Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.
|
|
15
|
+
*/
|
|
16
|
+
export declare function sentryWebpackUnpluginFactory({ BannerPlugin, DefinePlugin, }?: {
|
|
17
|
+
BannerPlugin?: UnsafeBannerPlugin;
|
|
18
|
+
DefinePlugin?: UnsafeDefinePlugin;
|
|
19
|
+
}): ReturnType<typeof sentryUnpluginFactory>;
|
|
20
|
+
export type SentryWebpackPluginOptions = Options & {
|
|
21
|
+
_experiments?: Options["_experiments"] & {
|
|
22
|
+
/**
|
|
23
|
+
* If enabled, the webpack plugin will exit the build process after the build completes.
|
|
24
|
+
* Use this with caution, as it will terminate the process.
|
|
25
|
+
*
|
|
26
|
+
* More information: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/345
|
|
27
|
+
*
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
forceExitOnBuildCompletion?: boolean;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/webpack-plugin",
|
|
3
|
-
"version": "3.3.0
|
|
3
|
+
"version": "3.3.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",
|
|
@@ -23,13 +23,18 @@
|
|
|
23
23
|
"import": "./dist/esm/index.mjs",
|
|
24
24
|
"require": "./dist/cjs/index.js",
|
|
25
25
|
"types": "./dist/types/index.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./webpack5": {
|
|
28
|
+
"import": "./dist/esm/webpack5.mjs",
|
|
29
|
+
"require": "./dist/cjs/webpack5.js",
|
|
30
|
+
"types": "./dist/types/webpack5.d.ts"
|
|
26
31
|
}
|
|
27
32
|
},
|
|
28
33
|
"main": "dist/cjs/index.js",
|
|
29
34
|
"module": "dist/esm/index.mjs",
|
|
30
35
|
"types": "dist/types/index.d.ts",
|
|
31
36
|
"scripts": {
|
|
32
|
-
"build": "rimraf ./
|
|
37
|
+
"build": "rimraf ./dist && run-p build:rollup build:types",
|
|
33
38
|
"build:watch": "run-p build:rollup:watch build:types:watch",
|
|
34
39
|
"build:rollup": "rollup --config rollup.config.js",
|
|
35
40
|
"build:rollup:watch": "rollup --config rollup.config.js --watch --no-watch.clearScreen",
|
|
@@ -48,7 +53,7 @@
|
|
|
48
53
|
"prepack": "ts-node ./src/prepack.ts"
|
|
49
54
|
},
|
|
50
55
|
"dependencies": {
|
|
51
|
-
"@sentry/bundler-plugin-core": "3.3.0
|
|
56
|
+
"@sentry/bundler-plugin-core": "3.3.0",
|
|
52
57
|
"unplugin": "1.0.1",
|
|
53
58
|
"uuid": "^9.0.0"
|
|
54
59
|
},
|
|
@@ -58,8 +63,8 @@
|
|
|
58
63
|
"@babel/preset-typescript": "7.17.12",
|
|
59
64
|
"@rollup/plugin-babel": "5.3.1",
|
|
60
65
|
"@rollup/plugin-commonjs": "22.0.1",
|
|
61
|
-
"@sentry-internal/eslint-config": "3.3.0
|
|
62
|
-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "3.3.0
|
|
66
|
+
"@sentry-internal/eslint-config": "3.3.0",
|
|
67
|
+
"@sentry-internal/sentry-bundler-plugin-tsconfig": "3.3.0",
|
|
63
68
|
"@swc/core": "^1.2.205",
|
|
64
69
|
"@swc/jest": "^0.2.21",
|
|
65
70
|
"@types/jest": "^28.1.3",
|