@depup/sentry__webpack-plugin 5.2.0-depup.0 → 5.4.0-depup.5
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 +9 -3
- package/changes.json +8 -3
- package/dist/cjs/index.js +8 -20
- package/dist/cjs/webpack5.js +8 -12
- package/dist/esm/index.mjs +2 -11
- package/dist/esm/webpack5.mjs +2 -7
- package/dist/types/index.d.ts +2 -4
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/webpack5.d.ts +2 -4
- package/dist/types/webpack5.d.ts.map +1 -0
- package/package.json +15 -17
- package/dist/cjs/component-annotation-transform.js +0 -24
- package/dist/cjs/component-annotation-transform.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/webpack4and5.js +0 -145
- package/dist/cjs/webpack4and5.js.map +0 -1
- package/dist/cjs/webpack5.js.map +0 -1
- package/dist/esm/component-annotation-transform.mjs +0 -20
- package/dist/esm/component-annotation-transform.mjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/webpack4and5.mjs +0 -111
- package/dist/esm/webpack4and5.mjs.map +0 -1
- package/dist/esm/webpack5.mjs.map +0 -1
- package/dist/types/component-annotation-transform.d.ts +0 -10
- package/dist/types/prepack.d.ts +0 -1
- package/dist/types/webpack4and5.d.ts +0 -98
package/README.md
CHANGED
|
@@ -13,10 +13,16 @@ npm install @depup/sentry__webpack-plugin
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [@sentry/webpack-plugin](https://www.npmjs.com/package/@sentry/webpack-plugin) @ 5.
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [@sentry/webpack-plugin](https://www.npmjs.com/package/@sentry/webpack-plugin) @ 5.4.0 |
|
|
17
|
+
| Processed | 2026-07-24 |
|
|
18
18
|
| Smoke test | failed |
|
|
19
|
-
| Deps updated |
|
|
19
|
+
| Deps updated | 1 |
|
|
20
|
+
|
|
21
|
+
## Dependency Changes
|
|
22
|
+
|
|
23
|
+
| Dependency | From | To |
|
|
24
|
+
|------------|------|-----|
|
|
25
|
+
| @sentry/bundler-plugins | ^10.64.0 | ^10.68.0 |
|
|
20
26
|
|
|
21
27
|
---
|
|
22
28
|
|
package/changes.json
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
BannerPlugin,
|
|
11
|
-
DefinePlugin
|
|
2
|
+
var _sentry_bundler_plugins_webpack = require("@sentry/bundler-plugins/webpack");
|
|
3
|
+
Object.keys(_sentry_bundler_plugins_webpack).forEach(function(k) {
|
|
4
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function() {
|
|
7
|
+
return _sentry_bundler_plugins_webpack[k];
|
|
8
|
+
}
|
|
9
|
+
});
|
|
12
10
|
});
|
|
13
|
-
//#endregion
|
|
14
|
-
Object.defineProperty(exports, "sentryCliBinaryExists", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function() {
|
|
17
|
-
return _sentry_bundler_plugin_core.sentryCliBinaryExists;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
exports.sentryWebpackPlugin = sentryWebpackPlugin;
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/webpack5.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
2
|
+
var _sentry_bundler_plugins_webpack5 = require("@sentry/bundler-plugins/webpack5");
|
|
3
|
+
Object.keys(_sentry_bundler_plugins_webpack5).forEach(function(k) {
|
|
4
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function() {
|
|
7
|
+
return _sentry_bundler_plugins_webpack5[k];
|
|
8
|
+
}
|
|
9
|
+
});
|
|
11
10
|
});
|
|
12
|
-
exports.sentryWebpackPlugin = sentryWebpackPlugin;
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=webpack5.js.map
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import * as webpack4or5 from "webpack";
|
|
4
|
-
const sentryWebpackPlugin = sentryWebpackPluginFactory({
|
|
5
|
-
BannerPlugin: webpack4or5?.BannerPlugin || webpack4or5?.default?.BannerPlugin,
|
|
6
|
-
DefinePlugin: webpack4or5?.DefinePlugin || webpack4or5?.default?.DefinePlugin
|
|
7
|
-
});
|
|
8
|
-
//#endregion
|
|
9
|
-
export { sentryCliBinaryExists, sentryWebpackPlugin };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
export * from "@sentry/bundler-plugins/webpack";
|
|
2
|
+
export {};
|
package/dist/esm/webpack5.mjs
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const sentryWebpackPlugin = sentryWebpackPluginFactory();
|
|
4
|
-
//#endregion
|
|
5
|
-
export { sentryCliBinaryExists, sentryWebpackPlugin };
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=webpack5.mjs.map
|
|
1
|
+
export * from "@sentry/bundler-plugins/webpack5";
|
|
2
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { sentryCliBinaryExists } from "@sentry/bundler-plugin-core";
|
|
4
|
-
export type { SentryWebpackPluginOptions };
|
|
1
|
+
export * from "@sentry/bundler-plugins/webpack";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
|
package/dist/types/webpack5.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { sentryCliBinaryExists } from "@sentry/bundler-plugin-core";
|
|
4
|
-
export type { SentryWebpackPluginOptions };
|
|
1
|
+
export * from "@sentry/bundler-plugins/webpack5";
|
|
2
|
+
//# sourceMappingURL=webpack5.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack5.d.ts","sourceRoot":"","sources":["../../src/webpack5.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/sentry__webpack-plugin",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0-depup.5",
|
|
4
4
|
"description": "Official Sentry Webpack plugin (with updated dependencies)",
|
|
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",
|
|
@@ -46,30 +46,23 @@
|
|
|
46
46
|
"build:types": "tsc --project types.tsconfig.json",
|
|
47
47
|
"build:types:watch": "tsc --project types.tsconfig.json --watch --preserveWatchOutput",
|
|
48
48
|
"check:types": "run-p check:types:src check:types:test",
|
|
49
|
-
"check:types:src": "tsc --project ./
|
|
49
|
+
"check:types:src": "tsc --project ./tsconfig.json --noEmit",
|
|
50
50
|
"check:types:test": "tsc --project ./test/tsconfig.json --noEmit",
|
|
51
51
|
"build:npm": "npm pack",
|
|
52
52
|
"clean": "run-s clean:build",
|
|
53
53
|
"clean:all": "run-p clean clean:deps",
|
|
54
54
|
"clean:build": "premove ./dist *.tgz",
|
|
55
|
-
"clean:deps": "premove node_modules"
|
|
56
|
-
"test": "vitest run",
|
|
57
|
-
"lint": "eslint ./src ./test"
|
|
55
|
+
"clean:deps": "premove node_modules"
|
|
58
56
|
},
|
|
59
57
|
"dependencies": {
|
|
60
|
-
"@sentry/bundler-
|
|
58
|
+
"@sentry/bundler-plugins": "^10.68.0"
|
|
61
59
|
},
|
|
62
60
|
"devDependencies": {
|
|
63
|
-
"@sentry-internal/
|
|
64
|
-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "5.2.0",
|
|
61
|
+
"@sentry-internal/dev-utils": "5.4.0",
|
|
65
62
|
"@types/node": "^18.6.3",
|
|
66
63
|
"@types/webpack": "npm:@types/webpack@^4",
|
|
67
|
-
"eslint": "^8.18.0",
|
|
68
|
-
"vitest": "^4.0.0",
|
|
69
64
|
"premove": "^4.0.0",
|
|
70
|
-
"rolldown": "1.0.0
|
|
71
|
-
"ts-node": "^10.9.1",
|
|
72
|
-
"typescript": "^4.7.4",
|
|
65
|
+
"rolldown": "^1.0.0",
|
|
73
66
|
"webpack": "5.76.0"
|
|
74
67
|
},
|
|
75
68
|
"peerDependencies": {
|
|
@@ -82,11 +75,16 @@
|
|
|
82
75
|
"node": ">= 18"
|
|
83
76
|
},
|
|
84
77
|
"depup": {
|
|
85
|
-
"changes": {
|
|
86
|
-
|
|
78
|
+
"changes": {
|
|
79
|
+
"@sentry/bundler-plugins": {
|
|
80
|
+
"from": "^10.64.0",
|
|
81
|
+
"to": "^10.68.0"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"depsUpdated": 1,
|
|
87
85
|
"originalPackage": "@sentry/webpack-plugin",
|
|
88
|
-
"originalVersion": "5.
|
|
89
|
-
"processedAt": "2026-
|
|
86
|
+
"originalVersion": "5.4.0",
|
|
87
|
+
"processedAt": "2026-07-24T16:34:02.952Z",
|
|
90
88
|
"smokeTest": "failed"
|
|
91
89
|
}
|
|
92
90
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
//#region src/component-annotation-transform.ts
|
|
6
|
-
async function transform(source, map) {
|
|
7
|
-
const callback = this.async();
|
|
8
|
-
const { transform: transformFn } = this.query;
|
|
9
|
-
if (!transformFn) return callback(null, source, map);
|
|
10
|
-
try {
|
|
11
|
-
const id = this.resourcePath;
|
|
12
|
-
const result = await transformFn(source, id);
|
|
13
|
-
if (result == null) callback(null, source, map);
|
|
14
|
-
else if (typeof result === "string") callback(null, result, map);
|
|
15
|
-
else callback(null, result.code, result.map || map);
|
|
16
|
-
} catch (error) {
|
|
17
|
-
if (error instanceof Error) callback(error);
|
|
18
|
-
else callback(new Error(String(error)));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
exports.default = transform;
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=component-annotation-transform.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-annotation-transform.js","names":[],"sources":["../../src/component-annotation-transform.ts"],"sourcesContent":["// Webpack loader for component annotation transform\n// Based on unplugin v1.0.1 transform loader pattern\n\nexport default async function transform(\n this: {\n async: () => (err: Error | null, content?: string, sourceMap?: unknown) => void;\n resourcePath: string;\n query: {\n transform?: (\n code: string,\n id: string\n ) => Promise<{ code: string; map?: unknown } | null | undefined | string>;\n };\n },\n source: string,\n map: unknown\n): Promise<void> {\n const callback = this.async();\n const { transform: transformFn } = this.query;\n\n if (!transformFn) {\n return callback(null, source, map);\n }\n\n try {\n const id = this.resourcePath;\n const result = await transformFn(source, id);\n\n if (result == null) {\n callback(null, source, map);\n } else if (typeof result === \"string\") {\n callback(null, result, map);\n } else {\n callback(null, result.code, result.map || map);\n }\n } catch (error) {\n if (error instanceof Error) {\n callback(error);\n } else {\n callback(new Error(String(error)));\n }\n }\n}\n"],"mappings":";;;;;AAGA,eAA8B,UAW5B,QACA,KACe;CACf,MAAM,WAAW,KAAK,OAAO;CAC7B,MAAM,EAAE,WAAW,gBAAgB,KAAK;AAExC,KAAI,CAAC,YACH,QAAO,SAAS,MAAM,QAAQ,IAAI;AAGpC,KAAI;EACF,MAAM,KAAK,KAAK;EAChB,MAAM,SAAS,MAAM,YAAY,QAAQ,GAAG;AAE5C,MAAI,UAAU,KACZ,UAAS,MAAM,QAAQ,IAAI;WAClB,OAAO,WAAW,SAC3B,UAAS,MAAM,QAAQ,IAAI;MAE3B,UAAS,MAAM,OAAO,MAAM,OAAO,OAAO,IAAI;UAEzC,OAAO;AACd,MAAI,iBAAiB,MACnB,UAAS,MAAM;MAEf,UAAS,IAAI,MAAM,OAAO,MAAM,CAAC,CAAC"}
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["webpack4or5","sentryWebpackPluginFactory"],"sources":["../../src/index.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackPluginFactory } from \"./webpack4and5\";\nimport * as webpack4or5 from \"webpack\";\n\nconst BannerPlugin = webpack4or5?.BannerPlugin || webpack4or5?.default?.BannerPlugin;\n\nconst DefinePlugin = webpack4or5?.DefinePlugin || webpack4or5?.default?.DefinePlugin;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryWebpackPluginFactory({\n BannerPlugin,\n DefinePlugin,\n });\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"mappings":";;;;;;AAGA,MAAM,eAAeA,SAAa,gBAAgBA,SAAa,SAAS;AAExE,MAAM,eAAeA,SAAa,gBAAgBA,SAAa,SAAS;AAGxE,MAAa,sBACXC,qBAAAA,2BAA2B;CACzB;CACA;CACD,CAAC"}
|
package/dist/cjs/webpack4and5.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
//#endregion
|
|
23
|
-
let _sentry_bundler_plugin_core = require("@sentry/bundler-plugin-core");
|
|
24
|
-
let node_path = require("node:path");
|
|
25
|
-
node_path = __toESM(node_path);
|
|
26
|
-
let node_url = require("node:url");
|
|
27
|
-
let node_module = require("node:module");
|
|
28
|
-
let node_crypto = require("node:crypto");
|
|
29
|
-
//#region src/webpack4and5.ts
|
|
30
|
-
const dirname = node_path.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
31
|
-
const COMPONENT_ANNOTATION_LOADER = node_path.resolve(dirname, typeof __dirname !== "undefined" ? "component-annotation-transform.js" : "component-annotation-transform.mjs");
|
|
32
|
-
function getWebpackMajorVersion() {
|
|
33
|
-
try {
|
|
34
|
-
const webpack = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("webpack");
|
|
35
|
-
return (webpack?.version ?? webpack?.default?.version)?.split(".")[0];
|
|
36
|
-
} catch (error) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* The factory function accepts BannerPlugin and DefinePlugin classes in
|
|
42
|
-
* order to avoid direct dependencies on webpack.
|
|
43
|
-
*
|
|
44
|
-
* This allow us to export version of the plugin for webpack 5.1+ and compatible environments.
|
|
45
|
-
*
|
|
46
|
-
* Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.
|
|
47
|
-
*/
|
|
48
|
-
function sentryWebpackPluginFactory({ BannerPlugin: UnsafeBannerPlugin, DefinePlugin: UnsafeDefinePlugin } = {}) {
|
|
49
|
-
return function sentryWebpackPlugin(userOptions = {}) {
|
|
50
|
-
const sentryBuildPluginManager = (0, _sentry_bundler_plugin_core.createSentryBuildPluginManager)(userOptions, {
|
|
51
|
-
loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? "[sentry-webpack-plugin]",
|
|
52
|
-
buildTool: "webpack",
|
|
53
|
-
buildToolMajorVersion: getWebpackMajorVersion()
|
|
54
|
-
});
|
|
55
|
-
const { logger, normalizedOptions: options, bundleSizeOptimizationReplacementValues: replacementValues, bundleMetadata, createDependencyOnBuildArtifacts } = sentryBuildPluginManager;
|
|
56
|
-
if (options.disable) return { apply() {} };
|
|
57
|
-
if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) logger.warn("Running Sentry plugin from within a `node_modules` folder. Some features may not work.");
|
|
58
|
-
const sourcemapsEnabled = options.sourcemaps?.disable !== true;
|
|
59
|
-
const staticInjectionCode = new _sentry_bundler_plugin_core.CodeInjection();
|
|
60
|
-
if (!options.release.inject) logger.debug("Release injection disabled via `release.inject` option. Will not inject release.");
|
|
61
|
-
else if (!options.release.name) logger.debug("No release name provided. Will not inject release. Please set the `release.name` option to identify your release.");
|
|
62
|
-
else staticInjectionCode.append((0, _sentry_bundler_plugin_core.generateReleaseInjectorCode)({
|
|
63
|
-
release: options.release.name,
|
|
64
|
-
injectBuildInformation: options._experiments.injectBuildInformation || false
|
|
65
|
-
}));
|
|
66
|
-
if (Object.keys(bundleMetadata).length > 0) staticInjectionCode.append((0, _sentry_bundler_plugin_core.generateModuleMetadataInjectorCode)(bundleMetadata));
|
|
67
|
-
const transformAnnotations = options.reactComponentAnnotation?.enabled ? (0, _sentry_bundler_plugin_core.createComponentNameAnnotateHooks)(options.reactComponentAnnotation?.ignoredComponents || [], !!options.reactComponentAnnotation?._experimentalInjectIntoHtml) : void 0;
|
|
68
|
-
const transformReplace = Object.keys(replacementValues).length > 0;
|
|
69
|
-
return { apply(compiler) {
|
|
70
|
-
sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {});
|
|
71
|
-
const BannerPlugin = compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;
|
|
72
|
-
const DefinePlugin = compiler?.webpack?.DefinePlugin || UnsafeDefinePlugin;
|
|
73
|
-
if (!staticInjectionCode.isEmpty() || sourcemapsEnabled) if (!BannerPlugin) logger.warn("BannerPlugin is not available. Skipping code injection. This usually means webpack is not properly configured.");
|
|
74
|
-
else {
|
|
75
|
-
compiler.options.plugins = compiler.options.plugins || [];
|
|
76
|
-
compiler.options.plugins.push(new BannerPlugin({
|
|
77
|
-
raw: true,
|
|
78
|
-
include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
|
|
79
|
-
banner: (arg) => {
|
|
80
|
-
const codeToInject = staticInjectionCode.clone();
|
|
81
|
-
if (sourcemapsEnabled) {
|
|
82
|
-
const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;
|
|
83
|
-
const debugId = hash ? (0, _sentry_bundler_plugin_core.stringToUUID)(hash) : (0, node_crypto.randomUUID)();
|
|
84
|
-
codeToInject.append((0, _sentry_bundler_plugin_core.getDebugIdSnippet)(debugId));
|
|
85
|
-
}
|
|
86
|
-
return codeToInject.code();
|
|
87
|
-
}
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
if (transformReplace && DefinePlugin) {
|
|
91
|
-
compiler.options.plugins = compiler.options.plugins || [];
|
|
92
|
-
compiler.options.plugins.push(new DefinePlugin(replacementValues));
|
|
93
|
-
}
|
|
94
|
-
if (transformAnnotations?.transform) {
|
|
95
|
-
compiler.options.module = compiler.options.module || {};
|
|
96
|
-
compiler.options.module.rules = compiler.options.module.rules || [];
|
|
97
|
-
compiler.options.module.rules.unshift({
|
|
98
|
-
test: /\.[jt]sx$/,
|
|
99
|
-
exclude: /node_modules/,
|
|
100
|
-
enforce: "pre",
|
|
101
|
-
use: [{
|
|
102
|
-
loader: COMPONENT_ANNOTATION_LOADER,
|
|
103
|
-
options: { transform: transformAnnotations.transform }
|
|
104
|
-
}]
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
compiler.hooks.afterEmit.tapAsync("sentry-webpack-plugin", (compilation, callback) => {
|
|
108
|
-
const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
|
|
109
|
-
const upload = (0, _sentry_bundler_plugin_core.createDebugIdUploadFunction)({ sentryBuildPluginManager });
|
|
110
|
-
sentryBuildPluginManager.createRelease().then(async () => {
|
|
111
|
-
if (sourcemapsEnabled && options.sourcemaps?.disable !== "disable-upload") {
|
|
112
|
-
const outputPath = compilation.outputOptions.path ?? node_path.resolve();
|
|
113
|
-
await upload(Object.keys(compilation.assets).map((asset) => node_path.join(outputPath, asset)));
|
|
114
|
-
}
|
|
115
|
-
}).then(() => {
|
|
116
|
-
callback();
|
|
117
|
-
}).finally(() => {
|
|
118
|
-
freeGlobalDependencyOnBuildArtifacts();
|
|
119
|
-
sentryBuildPluginManager.deleteArtifacts();
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
if (userOptions._experiments?.forceExitOnBuildCompletion && compiler.options.mode === "production") compiler.hooks.done.tap("sentry-webpack-plugin", () => {
|
|
123
|
-
setTimeout(() => {
|
|
124
|
-
logger.debug("Exiting process after debug file upload");
|
|
125
|
-
process.exit(0);
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
} };
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
//#endregion
|
|
132
|
-
Object.defineProperty(exports, "__toESM", {
|
|
133
|
-
enumerable: true,
|
|
134
|
-
get: function() {
|
|
135
|
-
return __toESM;
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
Object.defineProperty(exports, "sentryWebpackPluginFactory", {
|
|
139
|
-
enumerable: true,
|
|
140
|
-
get: function() {
|
|
141
|
-
return sentryWebpackPluginFactory;
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
//# sourceMappingURL=webpack4and5.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webpack4and5.js","names":["path","CodeInjection"],"sources":["../../src/webpack4and5.ts"],"sourcesContent":["import {\n Options,\n createSentryBuildPluginManager,\n generateReleaseInjectorCode,\n generateModuleMetadataInjectorCode,\n stringToUUID,\n createComponentNameAnnotateHooks,\n CodeInjection,\n getDebugIdSnippet,\n createDebugIdUploadFunction,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { createRequire } from \"node:module\";\nimport { randomUUID } from \"node:crypto\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore Rollup transpiles import.meta for us for CJS\nconst dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst COMPONENT_ANNOTATION_LOADER = path.resolve(\n dirname,\n typeof __dirname !== \"undefined\"\n ? \"component-annotation-transform.js\" // CJS\n : \"component-annotation-transform.mjs\" // ESM\n);\n\n// since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version\n// https://github.com/webpack/webpack/commit/65eca2e529ce1d79b79200d4bdb1ce1b81141459\n\ninterface BannerPluginCallbackArg {\n chunk?: {\n hash?: string;\n contentHash?: {\n javascript?: string;\n };\n };\n}\n\ntype UnsafeBannerPlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\ntype UnsafeDefinePlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\ntype WebpackModule = {\n resource?: string;\n};\n\ntype WebpackLoaderCallback = (err: Error | null, content?: string, sourceMap?: unknown) => void;\n\ntype WebpackLoaderContext = {\n callback: WebpackLoaderCallback;\n};\n\ntype WebpackCompilationContext = {\n compiler: {\n webpack?: {\n NormalModule?: {\n getCompilationHooks: (compilation: WebpackCompilationContext) => {\n loader: {\n tap: (\n name: string,\n callback: (loaderContext: WebpackLoaderContext, module: WebpackModule) => void\n ) => void;\n };\n };\n };\n };\n };\n hooks: {\n normalModuleLoader?: {\n tap: (\n name: string,\n callback: (loaderContext: WebpackLoaderContext, module: WebpackModule) => void\n ) => void;\n };\n };\n};\n\ntype WebpackCompiler = {\n options: {\n plugins?: unknown[];\n mode?: string;\n module?: {\n rules?: unknown[];\n };\n };\n hooks: {\n thisCompilation: {\n tap: (name: string, callback: (compilation: WebpackCompilationContext) => void) => void;\n };\n afterEmit: {\n tapAsync: (\n name: string,\n callback: (compilation: WebpackCompilation, cb: () => void) => void\n ) => void;\n };\n done: {\n tap: (name: string, callback: () => void) => void;\n };\n };\n webpack?: {\n BannerPlugin?: UnsafeBannerPlugin;\n DefinePlugin?: UnsafeDefinePlugin;\n };\n};\n\ntype WebpackCompilation = {\n outputOptions: {\n path?: string;\n };\n assets: Record<string, unknown>;\n hooks: {\n processAssets: {\n tap: (options: { name: string; stage: number }, callback: () => void) => void;\n };\n };\n};\n\n// Detect webpack major version for telemetry (helps differentiate webpack 4 vs 5 usage)\nfunction getWebpackMajorVersion(): string | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Rollup already transpiles this for us\n const req = createRequire(import.meta.url);\n const webpack = req(\"webpack\") as { version?: string; default?: { version?: string } };\n const version = webpack?.version ?? webpack?.default?.version;\n const webpackMajorVersion = version?.split(\".\")[0]; // \"4\" or \"5\"\n return webpackMajorVersion;\n } catch (error) {\n return undefined;\n }\n}\n\n/**\n * The factory function accepts BannerPlugin and DefinePlugin classes in\n * order to avoid direct dependencies on webpack.\n *\n * This allow us to export version of the plugin for webpack 5.1+ and compatible environments.\n *\n * Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.\n */\nexport function sentryWebpackPluginFactory({\n BannerPlugin: UnsafeBannerPlugin,\n DefinePlugin: UnsafeDefinePlugin,\n}: {\n BannerPlugin?: UnsafeBannerPlugin;\n DefinePlugin?: UnsafeDefinePlugin;\n} = {}) {\n return function sentryWebpackPlugin(userOptions: SentryWebpackPluginOptions = {}) {\n const sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {\n loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? \"[sentry-webpack-plugin]\",\n buildTool: \"webpack\",\n buildToolMajorVersion: getWebpackMajorVersion(),\n });\n\n const {\n logger,\n normalizedOptions: options,\n bundleSizeOptimizationReplacementValues: replacementValues,\n bundleMetadata,\n createDependencyOnBuildArtifacts,\n } = sentryBuildPluginManager;\n\n if (options.disable) {\n return {\n apply() {\n // noop plugin\n },\n };\n }\n\n if (process.cwd().match(/\\\\node_modules\\\\|\\/node_modules\\//)) {\n logger.warn(\n \"Running Sentry plugin from within a `node_modules` folder. Some features may not work.\"\n );\n }\n\n const sourcemapsEnabled = options.sourcemaps?.disable !== true;\n const staticInjectionCode = new CodeInjection();\n\n if (!options.release.inject) {\n logger.debug(\n \"Release injection disabled via `release.inject` option. Will not inject release.\"\n );\n } else if (!options.release.name) {\n logger.debug(\n \"No release name provided. Will not inject release. Please set the `release.name` option to identify your release.\"\n );\n } else {\n staticInjectionCode.append(\n generateReleaseInjectorCode({\n release: options.release.name,\n injectBuildInformation: options._experiments.injectBuildInformation || false,\n })\n );\n }\n\n if (Object.keys(bundleMetadata).length > 0) {\n staticInjectionCode.append(generateModuleMetadataInjectorCode(bundleMetadata));\n }\n\n const transformAnnotations = options.reactComponentAnnotation?.enabled\n ? createComponentNameAnnotateHooks(\n options.reactComponentAnnotation?.ignoredComponents || [],\n !!options.reactComponentAnnotation?._experimentalInjectIntoHtml\n )\n : undefined;\n\n const transformReplace = Object.keys(replacementValues).length > 0;\n\n return {\n apply(compiler: WebpackCompiler) {\n void sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {\n // Telemetry failures are acceptable\n });\n\n // Get the correct plugin classes (webpack 5.1+ vs older versions)\n const BannerPlugin = compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n const DefinePlugin = compiler?.webpack?.DefinePlugin || UnsafeDefinePlugin;\n\n // Add BannerPlugin for code injection (release, metadata, debug IDs)\n if (!staticInjectionCode.isEmpty() || sourcemapsEnabled) {\n if (!BannerPlugin) {\n logger.warn(\n \"BannerPlugin is not available. Skipping code injection. This usually means webpack is not properly configured.\"\n );\n } else {\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: (arg?: BannerPluginCallbackArg) => {\n const codeToInject = staticInjectionCode.clone();\n if (sourcemapsEnabled) {\n const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;\n const debugId = hash ? stringToUUID(hash) : randomUUID();\n codeToInject.append(getDebugIdSnippet(debugId));\n }\n return codeToInject.code();\n },\n })\n );\n }\n }\n\n // Add DefinePlugin for bundle size optimizations\n if (transformReplace && DefinePlugin) {\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(new DefinePlugin(replacementValues));\n }\n\n // Add component name annotation transform\n if (transformAnnotations?.transform) {\n compiler.options.module = compiler.options.module || {};\n compiler.options.module.rules = compiler.options.module.rules || [];\n compiler.options.module.rules.unshift({\n test: /\\.[jt]sx$/,\n exclude: /node_modules/,\n enforce: \"pre\",\n use: [\n {\n loader: COMPONENT_ANNOTATION_LOADER,\n options: {\n transform: transformAnnotations.transform,\n },\n },\n ],\n });\n }\n\n compiler.hooks.afterEmit.tapAsync(\n \"sentry-webpack-plugin\",\n (compilation: WebpackCompilation, callback: () => void) => {\n const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();\n const upload = createDebugIdUploadFunction({ sentryBuildPluginManager });\n\n void sentryBuildPluginManager\n .createRelease()\n .then(async () => {\n if (sourcemapsEnabled && options.sourcemaps?.disable !== \"disable-upload\") {\n const outputPath = compilation.outputOptions.path ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets).map((asset) =>\n path.join(outputPath, asset)\n );\n await upload(buildArtifacts);\n }\n })\n .then(() => {\n callback();\n })\n .finally(() => {\n freeGlobalDependencyOnBuildArtifacts();\n void sentryBuildPluginManager.deleteArtifacts();\n });\n }\n );\n\n if (\n userOptions._experiments?.forceExitOnBuildCompletion &&\n compiler.options.mode === \"production\"\n ) {\n compiler.hooks.done.tap(\"sentry-webpack-plugin\", () => {\n setTimeout(() => {\n logger.debug(\"Exiting process after debug file upload\");\n process.exit(0);\n });\n });\n }\n },\n };\n };\n}\n\nexport type SentryWebpackPluginOptions = Options & {\n _experiments?: Options[\"_experiments\"] & {\n /**\n * If enabled, the webpack plugin will exit the build process after the build completes.\n * Use this with caution, as it will terminate the process.\n *\n * More information: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/345\n *\n * @default false\n */\n forceExitOnBuildCompletion?: boolean;\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;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Q;MACR,SAAS,EACP,WAAW,qBAAqB,WACjC;MACF,CACF;KACF,CAAC;;AAGJ,YAAS,MAAM,UAAU,SACvB,0BACC,aAAiC,aAAyB;IACzD,MAAM,uCAAuC,kCAAkC;IAC/E,MAAM,UAAA,GAAA,4BAAA,6BAAqC,EAAE,0BAA0B,CAAC;AAEnE,6BACF,eAAe,CACf,KAAK,YAAY;AAChB,SAAI,qBAAqB,QAAQ,YAAY,YAAY,kBAAkB;MACzE,MAAM,aAAa,YAAY,cAAc,QAAQD,UAAK,SAAS;AAInE,YAAM,OAHiB,OAAO,KAAK,YAAY,OAAO,CAAC,KAAK,UAC1DA,UAAK,KAAK,YAAY,MAAM,CAC7B,CAC2B;;MAE9B,CACD,WAAW;AACV,eAAU;MACV,CACD,cAAc;AACb,2CAAsC;AACjC,8BAAyB,iBAAiB;MAC/C;KAEP;AAED,OACE,YAAY,cAAc,8BAC1B,SAAS,QAAQ,SAAS,aAE1B,UAAS,MAAM,KAAK,IAAI,+BAA+B;AACrD,qBAAiB;AACf,YAAO,MAAM,0CAA0C;AACvD,aAAQ,KAAK,EAAE;MACf;KACF;KAGP"}
|
package/dist/cjs/webpack5.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webpack5.js","names":["sentryWebpackPluginFactory"],"sources":["../../src/webpack5.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackPluginFactory } from \"./webpack4and5\";\n\nconst createSentryWebpackPlugin = sentryWebpackPluginFactory();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n createSentryWebpackPlugin;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"mappings":";;;AAKA,MAAa,sBAHqBA,qBAAAA,4BAA4B"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//#region src/component-annotation-transform.ts
|
|
2
|
-
async function transform(source, map) {
|
|
3
|
-
const callback = this.async();
|
|
4
|
-
const { transform: transformFn } = this.query;
|
|
5
|
-
if (!transformFn) return callback(null, source, map);
|
|
6
|
-
try {
|
|
7
|
-
const id = this.resourcePath;
|
|
8
|
-
const result = await transformFn(source, id);
|
|
9
|
-
if (result == null) callback(null, source, map);
|
|
10
|
-
else if (typeof result === "string") callback(null, result, map);
|
|
11
|
-
else callback(null, result.code, result.map || map);
|
|
12
|
-
} catch (error) {
|
|
13
|
-
if (error instanceof Error) callback(error);
|
|
14
|
-
else callback(new Error(String(error)));
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
export { transform as default };
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=component-annotation-transform.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-annotation-transform.mjs","names":[],"sources":["../../src/component-annotation-transform.ts"],"sourcesContent":["// Webpack loader for component annotation transform\n// Based on unplugin v1.0.1 transform loader pattern\n\nexport default async function transform(\n this: {\n async: () => (err: Error | null, content?: string, sourceMap?: unknown) => void;\n resourcePath: string;\n query: {\n transform?: (\n code: string,\n id: string\n ) => Promise<{ code: string; map?: unknown } | null | undefined | string>;\n };\n },\n source: string,\n map: unknown\n): Promise<void> {\n const callback = this.async();\n const { transform: transformFn } = this.query;\n\n if (!transformFn) {\n return callback(null, source, map);\n }\n\n try {\n const id = this.resourcePath;\n const result = await transformFn(source, id);\n\n if (result == null) {\n callback(null, source, map);\n } else if (typeof result === \"string\") {\n callback(null, result, map);\n } else {\n callback(null, result.code, result.map || map);\n }\n } catch (error) {\n if (error instanceof Error) {\n callback(error);\n } else {\n callback(new Error(String(error)));\n }\n }\n}\n"],"mappings":";AAGA,eAA8B,UAW5B,QACA,KACe;CACf,MAAM,WAAW,KAAK,OAAO;CAC7B,MAAM,EAAE,WAAW,gBAAgB,KAAK;AAExC,KAAI,CAAC,YACH,QAAO,SAAS,MAAM,QAAQ,IAAI;AAGpC,KAAI;EACF,MAAM,KAAK,KAAK;EAChB,MAAM,SAAS,MAAM,YAAY,QAAQ,GAAG;AAE5C,MAAI,UAAU,KACZ,UAAS,MAAM,QAAQ,IAAI;WAClB,OAAO,WAAW,SAC3B,UAAS,MAAM,QAAQ,IAAI;MAE3B,UAAS,MAAM,OAAO,MAAM,OAAO,OAAO,IAAI;UAEzC,OAAO;AACd,MAAI,iBAAiB,MACnB,UAAS,MAAM;MAEf,UAAS,IAAI,MAAM,OAAO,MAAM,CAAC,CAAC"}
|
package/dist/esm/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackPluginFactory } from \"./webpack4and5\";\nimport * as webpack4or5 from \"webpack\";\n\nconst BannerPlugin = webpack4or5?.BannerPlugin || webpack4or5?.default?.BannerPlugin;\n\nconst DefinePlugin = webpack4or5?.DefinePlugin || webpack4or5?.default?.DefinePlugin;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n sentryWebpackPluginFactory({\n BannerPlugin,\n DefinePlugin,\n });\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"mappings":";;;AAQA,MAAa,sBACX,2BAA2B;CACzB,cAPiB,aAAa,gBAAgB,aAAa,SAAS;CAQpE,cANiB,aAAa,gBAAgB,aAAa,SAAS;CAOrE,CAAC"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
import { CodeInjection, createComponentNameAnnotateHooks, createDebugIdUploadFunction, createSentryBuildPluginManager, generateModuleMetadataInjectorCode, generateReleaseInjectorCode, getDebugIdSnippet, stringToUUID } from "@sentry/bundler-plugin-core";
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { randomUUID } from "node:crypto";
|
|
6
|
-
//#region src/webpack4and5.ts
|
|
7
|
-
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
const COMPONENT_ANNOTATION_LOADER = path.resolve(dirname, typeof __dirname !== "undefined" ? "component-annotation-transform.js" : "component-annotation-transform.mjs");
|
|
9
|
-
function getWebpackMajorVersion() {
|
|
10
|
-
try {
|
|
11
|
-
const webpack = createRequire(import.meta.url)("webpack");
|
|
12
|
-
return (webpack?.version ?? webpack?.default?.version)?.split(".")[0];
|
|
13
|
-
} catch (error) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* The factory function accepts BannerPlugin and DefinePlugin classes in
|
|
19
|
-
* order to avoid direct dependencies on webpack.
|
|
20
|
-
*
|
|
21
|
-
* This allow us to export version of the plugin for webpack 5.1+ and compatible environments.
|
|
22
|
-
*
|
|
23
|
-
* Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.
|
|
24
|
-
*/
|
|
25
|
-
function sentryWebpackPluginFactory({ BannerPlugin: UnsafeBannerPlugin, DefinePlugin: UnsafeDefinePlugin } = {}) {
|
|
26
|
-
return function sentryWebpackPlugin(userOptions = {}) {
|
|
27
|
-
const sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {
|
|
28
|
-
loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? "[sentry-webpack-plugin]",
|
|
29
|
-
buildTool: "webpack",
|
|
30
|
-
buildToolMajorVersion: getWebpackMajorVersion()
|
|
31
|
-
});
|
|
32
|
-
const { logger, normalizedOptions: options, bundleSizeOptimizationReplacementValues: replacementValues, bundleMetadata, createDependencyOnBuildArtifacts } = sentryBuildPluginManager;
|
|
33
|
-
if (options.disable) return { apply() {} };
|
|
34
|
-
if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) logger.warn("Running Sentry plugin from within a `node_modules` folder. Some features may not work.");
|
|
35
|
-
const sourcemapsEnabled = options.sourcemaps?.disable !== true;
|
|
36
|
-
const staticInjectionCode = new CodeInjection();
|
|
37
|
-
if (!options.release.inject) logger.debug("Release injection disabled via `release.inject` option. Will not inject release.");
|
|
38
|
-
else if (!options.release.name) logger.debug("No release name provided. Will not inject release. Please set the `release.name` option to identify your release.");
|
|
39
|
-
else staticInjectionCode.append(generateReleaseInjectorCode({
|
|
40
|
-
release: options.release.name,
|
|
41
|
-
injectBuildInformation: options._experiments.injectBuildInformation || false
|
|
42
|
-
}));
|
|
43
|
-
if (Object.keys(bundleMetadata).length > 0) staticInjectionCode.append(generateModuleMetadataInjectorCode(bundleMetadata));
|
|
44
|
-
const transformAnnotations = options.reactComponentAnnotation?.enabled ? createComponentNameAnnotateHooks(options.reactComponentAnnotation?.ignoredComponents || [], !!options.reactComponentAnnotation?._experimentalInjectIntoHtml) : void 0;
|
|
45
|
-
const transformReplace = Object.keys(replacementValues).length > 0;
|
|
46
|
-
return { apply(compiler) {
|
|
47
|
-
sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {});
|
|
48
|
-
const BannerPlugin = compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;
|
|
49
|
-
const DefinePlugin = compiler?.webpack?.DefinePlugin || UnsafeDefinePlugin;
|
|
50
|
-
if (!staticInjectionCode.isEmpty() || sourcemapsEnabled) if (!BannerPlugin) logger.warn("BannerPlugin is not available. Skipping code injection. This usually means webpack is not properly configured.");
|
|
51
|
-
else {
|
|
52
|
-
compiler.options.plugins = compiler.options.plugins || [];
|
|
53
|
-
compiler.options.plugins.push(new BannerPlugin({
|
|
54
|
-
raw: true,
|
|
55
|
-
include: /\.(js|ts|jsx|tsx|mjs|cjs)(\?[^?]*)?(#[^#]*)?$/,
|
|
56
|
-
banner: (arg) => {
|
|
57
|
-
const codeToInject = staticInjectionCode.clone();
|
|
58
|
-
if (sourcemapsEnabled) {
|
|
59
|
-
const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;
|
|
60
|
-
const debugId = hash ? stringToUUID(hash) : randomUUID();
|
|
61
|
-
codeToInject.append(getDebugIdSnippet(debugId));
|
|
62
|
-
}
|
|
63
|
-
return codeToInject.code();
|
|
64
|
-
}
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
if (transformReplace && DefinePlugin) {
|
|
68
|
-
compiler.options.plugins = compiler.options.plugins || [];
|
|
69
|
-
compiler.options.plugins.push(new DefinePlugin(replacementValues));
|
|
70
|
-
}
|
|
71
|
-
if (transformAnnotations?.transform) {
|
|
72
|
-
compiler.options.module = compiler.options.module || {};
|
|
73
|
-
compiler.options.module.rules = compiler.options.module.rules || [];
|
|
74
|
-
compiler.options.module.rules.unshift({
|
|
75
|
-
test: /\.[jt]sx$/,
|
|
76
|
-
exclude: /node_modules/,
|
|
77
|
-
enforce: "pre",
|
|
78
|
-
use: [{
|
|
79
|
-
loader: COMPONENT_ANNOTATION_LOADER,
|
|
80
|
-
options: { transform: transformAnnotations.transform }
|
|
81
|
-
}]
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
compiler.hooks.afterEmit.tapAsync("sentry-webpack-plugin", (compilation, callback) => {
|
|
85
|
-
const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
|
|
86
|
-
const upload = createDebugIdUploadFunction({ sentryBuildPluginManager });
|
|
87
|
-
sentryBuildPluginManager.createRelease().then(async () => {
|
|
88
|
-
if (sourcemapsEnabled && options.sourcemaps?.disable !== "disable-upload") {
|
|
89
|
-
const outputPath = compilation.outputOptions.path ?? path.resolve();
|
|
90
|
-
await upload(Object.keys(compilation.assets).map((asset) => path.join(outputPath, asset)));
|
|
91
|
-
}
|
|
92
|
-
}).then(() => {
|
|
93
|
-
callback();
|
|
94
|
-
}).finally(() => {
|
|
95
|
-
freeGlobalDependencyOnBuildArtifacts();
|
|
96
|
-
sentryBuildPluginManager.deleteArtifacts();
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
if (userOptions._experiments?.forceExitOnBuildCompletion && compiler.options.mode === "production") compiler.hooks.done.tap("sentry-webpack-plugin", () => {
|
|
100
|
-
setTimeout(() => {
|
|
101
|
-
logger.debug("Exiting process after debug file upload");
|
|
102
|
-
process.exit(0);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
} };
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
//#endregion
|
|
109
|
-
export { sentryWebpackPluginFactory as t };
|
|
110
|
-
|
|
111
|
-
//# sourceMappingURL=webpack4and5.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webpack4and5.mjs","names":[],"sources":["../../src/webpack4and5.ts"],"sourcesContent":["import {\n Options,\n createSentryBuildPluginManager,\n generateReleaseInjectorCode,\n generateModuleMetadataInjectorCode,\n stringToUUID,\n createComponentNameAnnotateHooks,\n CodeInjection,\n getDebugIdSnippet,\n createDebugIdUploadFunction,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { createRequire } from \"node:module\";\nimport { randomUUID } from \"node:crypto\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore Rollup transpiles import.meta for us for CJS\nconst dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst COMPONENT_ANNOTATION_LOADER = path.resolve(\n dirname,\n typeof __dirname !== \"undefined\"\n ? \"component-annotation-transform.js\" // CJS\n : \"component-annotation-transform.mjs\" // ESM\n);\n\n// since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version\n// https://github.com/webpack/webpack/commit/65eca2e529ce1d79b79200d4bdb1ce1b81141459\n\ninterface BannerPluginCallbackArg {\n chunk?: {\n hash?: string;\n contentHash?: {\n javascript?: string;\n };\n };\n}\n\ntype UnsafeBannerPlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\ntype UnsafeDefinePlugin = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (options: any): unknown;\n};\n\ntype WebpackModule = {\n resource?: string;\n};\n\ntype WebpackLoaderCallback = (err: Error | null, content?: string, sourceMap?: unknown) => void;\n\ntype WebpackLoaderContext = {\n callback: WebpackLoaderCallback;\n};\n\ntype WebpackCompilationContext = {\n compiler: {\n webpack?: {\n NormalModule?: {\n getCompilationHooks: (compilation: WebpackCompilationContext) => {\n loader: {\n tap: (\n name: string,\n callback: (loaderContext: WebpackLoaderContext, module: WebpackModule) => void\n ) => void;\n };\n };\n };\n };\n };\n hooks: {\n normalModuleLoader?: {\n tap: (\n name: string,\n callback: (loaderContext: WebpackLoaderContext, module: WebpackModule) => void\n ) => void;\n };\n };\n};\n\ntype WebpackCompiler = {\n options: {\n plugins?: unknown[];\n mode?: string;\n module?: {\n rules?: unknown[];\n };\n };\n hooks: {\n thisCompilation: {\n tap: (name: string, callback: (compilation: WebpackCompilationContext) => void) => void;\n };\n afterEmit: {\n tapAsync: (\n name: string,\n callback: (compilation: WebpackCompilation, cb: () => void) => void\n ) => void;\n };\n done: {\n tap: (name: string, callback: () => void) => void;\n };\n };\n webpack?: {\n BannerPlugin?: UnsafeBannerPlugin;\n DefinePlugin?: UnsafeDefinePlugin;\n };\n};\n\ntype WebpackCompilation = {\n outputOptions: {\n path?: string;\n };\n assets: Record<string, unknown>;\n hooks: {\n processAssets: {\n tap: (options: { name: string; stage: number }, callback: () => void) => void;\n };\n };\n};\n\n// Detect webpack major version for telemetry (helps differentiate webpack 4 vs 5 usage)\nfunction getWebpackMajorVersion(): string | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Rollup already transpiles this for us\n const req = createRequire(import.meta.url);\n const webpack = req(\"webpack\") as { version?: string; default?: { version?: string } };\n const version = webpack?.version ?? webpack?.default?.version;\n const webpackMajorVersion = version?.split(\".\")[0]; // \"4\" or \"5\"\n return webpackMajorVersion;\n } catch (error) {\n return undefined;\n }\n}\n\n/**\n * The factory function accepts BannerPlugin and DefinePlugin classes in\n * order to avoid direct dependencies on webpack.\n *\n * This allow us to export version of the plugin for webpack 5.1+ and compatible environments.\n *\n * Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.\n */\nexport function sentryWebpackPluginFactory({\n BannerPlugin: UnsafeBannerPlugin,\n DefinePlugin: UnsafeDefinePlugin,\n}: {\n BannerPlugin?: UnsafeBannerPlugin;\n DefinePlugin?: UnsafeDefinePlugin;\n} = {}) {\n return function sentryWebpackPlugin(userOptions: SentryWebpackPluginOptions = {}) {\n const sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {\n loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? \"[sentry-webpack-plugin]\",\n buildTool: \"webpack\",\n buildToolMajorVersion: getWebpackMajorVersion(),\n });\n\n const {\n logger,\n normalizedOptions: options,\n bundleSizeOptimizationReplacementValues: replacementValues,\n bundleMetadata,\n createDependencyOnBuildArtifacts,\n } = sentryBuildPluginManager;\n\n if (options.disable) {\n return {\n apply() {\n // noop plugin\n },\n };\n }\n\n if (process.cwd().match(/\\\\node_modules\\\\|\\/node_modules\\//)) {\n logger.warn(\n \"Running Sentry plugin from within a `node_modules` folder. Some features may not work.\"\n );\n }\n\n const sourcemapsEnabled = options.sourcemaps?.disable !== true;\n const staticInjectionCode = new CodeInjection();\n\n if (!options.release.inject) {\n logger.debug(\n \"Release injection disabled via `release.inject` option. Will not inject release.\"\n );\n } else if (!options.release.name) {\n logger.debug(\n \"No release name provided. Will not inject release. Please set the `release.name` option to identify your release.\"\n );\n } else {\n staticInjectionCode.append(\n generateReleaseInjectorCode({\n release: options.release.name,\n injectBuildInformation: options._experiments.injectBuildInformation || false,\n })\n );\n }\n\n if (Object.keys(bundleMetadata).length > 0) {\n staticInjectionCode.append(generateModuleMetadataInjectorCode(bundleMetadata));\n }\n\n const transformAnnotations = options.reactComponentAnnotation?.enabled\n ? createComponentNameAnnotateHooks(\n options.reactComponentAnnotation?.ignoredComponents || [],\n !!options.reactComponentAnnotation?._experimentalInjectIntoHtml\n )\n : undefined;\n\n const transformReplace = Object.keys(replacementValues).length > 0;\n\n return {\n apply(compiler: WebpackCompiler) {\n void sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {\n // Telemetry failures are acceptable\n });\n\n // Get the correct plugin classes (webpack 5.1+ vs older versions)\n const BannerPlugin = compiler?.webpack?.BannerPlugin || UnsafeBannerPlugin;\n const DefinePlugin = compiler?.webpack?.DefinePlugin || UnsafeDefinePlugin;\n\n // Add BannerPlugin for code injection (release, metadata, debug IDs)\n if (!staticInjectionCode.isEmpty() || sourcemapsEnabled) {\n if (!BannerPlugin) {\n logger.warn(\n \"BannerPlugin is not available. Skipping code injection. This usually means webpack is not properly configured.\"\n );\n } else {\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(\n new BannerPlugin({\n raw: true,\n include: /\\.(js|ts|jsx|tsx|mjs|cjs)(\\?[^?]*)?(#[^#]*)?$/,\n banner: (arg?: BannerPluginCallbackArg) => {\n const codeToInject = staticInjectionCode.clone();\n if (sourcemapsEnabled) {\n const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;\n const debugId = hash ? stringToUUID(hash) : randomUUID();\n codeToInject.append(getDebugIdSnippet(debugId));\n }\n return codeToInject.code();\n },\n })\n );\n }\n }\n\n // Add DefinePlugin for bundle size optimizations\n if (transformReplace && DefinePlugin) {\n compiler.options.plugins = compiler.options.plugins || [];\n compiler.options.plugins.push(new DefinePlugin(replacementValues));\n }\n\n // Add component name annotation transform\n if (transformAnnotations?.transform) {\n compiler.options.module = compiler.options.module || {};\n compiler.options.module.rules = compiler.options.module.rules || [];\n compiler.options.module.rules.unshift({\n test: /\\.[jt]sx$/,\n exclude: /node_modules/,\n enforce: \"pre\",\n use: [\n {\n loader: COMPONENT_ANNOTATION_LOADER,\n options: {\n transform: transformAnnotations.transform,\n },\n },\n ],\n });\n }\n\n compiler.hooks.afterEmit.tapAsync(\n \"sentry-webpack-plugin\",\n (compilation: WebpackCompilation, callback: () => void) => {\n const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();\n const upload = createDebugIdUploadFunction({ sentryBuildPluginManager });\n\n void sentryBuildPluginManager\n .createRelease()\n .then(async () => {\n if (sourcemapsEnabled && options.sourcemaps?.disable !== \"disable-upload\") {\n const outputPath = compilation.outputOptions.path ?? path.resolve();\n const buildArtifacts = Object.keys(compilation.assets).map((asset) =>\n path.join(outputPath, asset)\n );\n await upload(buildArtifacts);\n }\n })\n .then(() => {\n callback();\n })\n .finally(() => {\n freeGlobalDependencyOnBuildArtifacts();\n void sentryBuildPluginManager.deleteArtifacts();\n });\n }\n );\n\n if (\n userOptions._experiments?.forceExitOnBuildCompletion &&\n compiler.options.mode === \"production\"\n ) {\n compiler.hooks.done.tap(\"sentry-webpack-plugin\", () => {\n setTimeout(() => {\n logger.debug(\"Exiting process after debug file upload\");\n process.exit(0);\n });\n });\n }\n },\n };\n };\n}\n\nexport type SentryWebpackPluginOptions = Options & {\n _experiments?: Options[\"_experiments\"] & {\n /**\n * If enabled, the webpack plugin will exit the build process after the build completes.\n * Use this with caution, as it will terminate the process.\n *\n * More information: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/345\n *\n * @default false\n */\n forceExitOnBuildCompletion?: boolean;\n };\n};\n"],"mappings":";;;;;;AAkBA,MAAM,UAAU,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAE5D,MAAM,8BAA8B,KAAK,QACvC,SACA,OAAO,cAAc,cACjB,sCACA,qCACL;AAoGD,SAAS,yBAA6C;AACpD,KAAI;EAIF,MAAM,UADM,cAAc,OAAO,KAAK,IAAI,CACtB,UAAU;AAG9B,UAFgB,SAAS,WAAW,SAAS,SAAS,UACjB,MAAM,IAAI,CAAC;UAEzC,OAAO;AACd;;;;;;;;;;;AAYJ,SAAgB,2BAA2B,EACzC,cAAc,oBACd,cAAc,uBAIZ,EAAE,EAAE;AACN,QAAO,SAAS,o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,KAAK,IAAI,+BAA+B;AACrD,qBAAiB;AACf,YAAO,MAAM,0CAA0C;AACvD,aAAQ,KAAK,EAAE;MACf;KACF;KAGP"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webpack5.mjs","names":[],"sources":["../../src/webpack5.ts"],"sourcesContent":["import { SentryWebpackPluginOptions, sentryWebpackPluginFactory } from \"./webpack4and5\";\n\nconst createSentryWebpackPlugin = sentryWebpackPluginFactory();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryWebpackPlugin: (options?: SentryWebpackPluginOptions) => any =\n createSentryWebpackPlugin;\n\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n\nexport type { SentryWebpackPluginOptions };\n"],"mappings":";;AAKA,MAAa,sBAHqB,4BAA4B"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default function transform(this: {
|
|
2
|
-
async: () => (err: Error | null, content?: string, sourceMap?: unknown) => void;
|
|
3
|
-
resourcePath: string;
|
|
4
|
-
query: {
|
|
5
|
-
transform?: (code: string, id: string) => Promise<{
|
|
6
|
-
code: string;
|
|
7
|
-
map?: unknown;
|
|
8
|
-
} | null | undefined | string>;
|
|
9
|
-
};
|
|
10
|
-
}, source: string, map: unknown): Promise<void>;
|
package/dist/types/prepack.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Options } from "@sentry/bundler-plugin-core";
|
|
2
|
-
type UnsafeBannerPlugin = {
|
|
3
|
-
new (options: any): unknown;
|
|
4
|
-
};
|
|
5
|
-
type UnsafeDefinePlugin = {
|
|
6
|
-
new (options: any): unknown;
|
|
7
|
-
};
|
|
8
|
-
type WebpackModule = {
|
|
9
|
-
resource?: string;
|
|
10
|
-
};
|
|
11
|
-
type WebpackLoaderCallback = (err: Error | null, content?: string, sourceMap?: unknown) => void;
|
|
12
|
-
type WebpackLoaderContext = {
|
|
13
|
-
callback: WebpackLoaderCallback;
|
|
14
|
-
};
|
|
15
|
-
type WebpackCompilationContext = {
|
|
16
|
-
compiler: {
|
|
17
|
-
webpack?: {
|
|
18
|
-
NormalModule?: {
|
|
19
|
-
getCompilationHooks: (compilation: WebpackCompilationContext) => {
|
|
20
|
-
loader: {
|
|
21
|
-
tap: (name: string, callback: (loaderContext: WebpackLoaderContext, module: WebpackModule) => void) => void;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
hooks: {
|
|
28
|
-
normalModuleLoader?: {
|
|
29
|
-
tap: (name: string, callback: (loaderContext: WebpackLoaderContext, module: WebpackModule) => void) => void;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
type WebpackCompiler = {
|
|
34
|
-
options: {
|
|
35
|
-
plugins?: unknown[];
|
|
36
|
-
mode?: string;
|
|
37
|
-
module?: {
|
|
38
|
-
rules?: unknown[];
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
hooks: {
|
|
42
|
-
thisCompilation: {
|
|
43
|
-
tap: (name: string, callback: (compilation: WebpackCompilationContext) => void) => void;
|
|
44
|
-
};
|
|
45
|
-
afterEmit: {
|
|
46
|
-
tapAsync: (name: string, callback: (compilation: WebpackCompilation, cb: () => void) => void) => void;
|
|
47
|
-
};
|
|
48
|
-
done: {
|
|
49
|
-
tap: (name: string, callback: () => void) => void;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
webpack?: {
|
|
53
|
-
BannerPlugin?: UnsafeBannerPlugin;
|
|
54
|
-
DefinePlugin?: UnsafeDefinePlugin;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
type WebpackCompilation = {
|
|
58
|
-
outputOptions: {
|
|
59
|
-
path?: string;
|
|
60
|
-
};
|
|
61
|
-
assets: Record<string, unknown>;
|
|
62
|
-
hooks: {
|
|
63
|
-
processAssets: {
|
|
64
|
-
tap: (options: {
|
|
65
|
-
name: string;
|
|
66
|
-
stage: number;
|
|
67
|
-
}, callback: () => void) => void;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* The factory function accepts BannerPlugin and DefinePlugin classes in
|
|
73
|
-
* order to avoid direct dependencies on webpack.
|
|
74
|
-
*
|
|
75
|
-
* This allow us to export version of the plugin for webpack 5.1+ and compatible environments.
|
|
76
|
-
*
|
|
77
|
-
* Since webpack 5.1 compiler contains webpack module so plugins always use correct webpack version.
|
|
78
|
-
*/
|
|
79
|
-
export declare function sentryWebpackPluginFactory({ BannerPlugin: UnsafeBannerPlugin, DefinePlugin: UnsafeDefinePlugin, }?: {
|
|
80
|
-
BannerPlugin?: UnsafeBannerPlugin;
|
|
81
|
-
DefinePlugin?: UnsafeDefinePlugin;
|
|
82
|
-
}): (userOptions?: SentryWebpackPluginOptions) => {
|
|
83
|
-
apply(compiler: WebpackCompiler): void;
|
|
84
|
-
};
|
|
85
|
-
export type SentryWebpackPluginOptions = Options & {
|
|
86
|
-
_experiments?: Options["_experiments"] & {
|
|
87
|
-
/**
|
|
88
|
-
* If enabled, the webpack plugin will exit the build process after the build completes.
|
|
89
|
-
* Use this with caution, as it will terminate the process.
|
|
90
|
-
*
|
|
91
|
-
* More information: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/345
|
|
92
|
-
*
|
|
93
|
-
* @default false
|
|
94
|
-
*/
|
|
95
|
-
forceExitOnBuildCompletion?: boolean;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
export {};
|