@sentry/esbuild-plugin 5.2.1 → 5.4.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/dist/cjs/index.js +12 -146
- package/dist/esm/index.mjs +3 -142
- package/dist/types/index.d.ts +3 -5
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +6 -13
- package/dist/cjs/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/types/prepack.d.ts +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -24,153 +24,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
enumerable: true
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
//#endregion
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
let node_module = require("node:module");
|
|
31
|
-
let node_crypto = require("node:crypto");
|
|
32
|
-
//#region src/index.ts
|
|
33
|
-
function getEsbuildMajorVersion() {
|
|
34
|
-
try {
|
|
35
|
-
return (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("esbuild").version?.split(".")[1];
|
|
36
|
-
} catch (err) {}
|
|
37
|
-
}
|
|
38
|
-
const pluginName = "sentry-esbuild-plugin";
|
|
39
|
-
function sentryEsbuildPlugin(userOptions = {}) {
|
|
40
|
-
const sentryBuildPluginManager = (0, _sentry_bundler_plugin_core.createSentryBuildPluginManager)(userOptions, {
|
|
41
|
-
loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? `[${pluginName}]`,
|
|
42
|
-
buildTool: "esbuild",
|
|
43
|
-
buildToolMajorVersion: getEsbuildMajorVersion()
|
|
44
|
-
});
|
|
45
|
-
const { logger, normalizedOptions: options, bundleSizeOptimizationReplacementValues: replacementValues, bundleMetadata, createDependencyOnBuildArtifacts } = sentryBuildPluginManager;
|
|
46
|
-
if (options.disable) return {
|
|
47
|
-
name: "sentry-esbuild-noop-plugin",
|
|
48
|
-
setup() {}
|
|
49
|
-
};
|
|
50
|
-
if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) logger.warn("Running Sentry plugin from within a `node_modules` folder. Some features may not work.");
|
|
51
|
-
const sourcemapsEnabled = options.sourcemaps?.disable !== true;
|
|
52
|
-
const staticInjectionCode = new _sentry_bundler_plugin_core.CodeInjection();
|
|
53
|
-
if (!options.release.inject) logger.debug("Release injection disabled via `release.inject` option. Will not inject release.");
|
|
54
|
-
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.");
|
|
55
|
-
else staticInjectionCode.append((0, _sentry_bundler_plugin_core.generateReleaseInjectorCode)({
|
|
56
|
-
release: options.release.name,
|
|
57
|
-
injectBuildInformation: options._experiments.injectBuildInformation || false
|
|
58
|
-
}));
|
|
59
|
-
if (Object.keys(bundleMetadata).length > 0) staticInjectionCode.append((0, _sentry_bundler_plugin_core.generateModuleMetadataInjectorCode)(bundleMetadata));
|
|
60
|
-
if (options.reactComponentAnnotation?.enabled) logger.warn("Component name annotation is not supported in esbuild. Please use a separate transform step or consider using a different bundler.");
|
|
61
|
-
const transformReplace = Object.keys(replacementValues).length > 0;
|
|
62
|
-
const debugIdWrappedPaths = /* @__PURE__ */ new Set();
|
|
63
|
-
sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {});
|
|
64
|
-
return {
|
|
65
|
-
name: pluginName,
|
|
66
|
-
setup({ initialOptions, onLoad, onResolve, onEnd }) {
|
|
67
|
-
if (!staticInjectionCode.isEmpty()) {
|
|
68
|
-
const virtualInjectionFilePath = node_path.resolve("_sentry-injection-stub");
|
|
69
|
-
initialOptions.inject = initialOptions.inject || [];
|
|
70
|
-
initialOptions.inject.push(virtualInjectionFilePath);
|
|
71
|
-
onResolve({ filter: /_sentry-injection-stub/ }, (args) => {
|
|
72
|
-
return {
|
|
73
|
-
path: args.path,
|
|
74
|
-
sideEffects: true,
|
|
75
|
-
pluginName
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
|
-
onLoad({ filter: /_sentry-injection-stub/ }, () => {
|
|
79
|
-
return {
|
|
80
|
-
loader: "js",
|
|
81
|
-
pluginName,
|
|
82
|
-
contents: staticInjectionCode.code()
|
|
83
|
-
};
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
if (transformReplace) {
|
|
87
|
-
const replacementStringValues = {};
|
|
88
|
-
Object.entries(replacementValues).forEach(([key, value]) => {
|
|
89
|
-
replacementStringValues[key] = JSON.stringify(value);
|
|
90
|
-
});
|
|
91
|
-
initialOptions.define = {
|
|
92
|
-
...initialOptions.define,
|
|
93
|
-
...replacementStringValues
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
if (sourcemapsEnabled) {
|
|
97
|
-
debugIdWrappedPaths.clear();
|
|
98
|
-
if (!initialOptions.bundle) logger.warn("The Sentry esbuild plugin only supports esbuild with `bundle: true` being set in the esbuild build options. Esbuild will probably crash now. Sorry about that. If you need to upload sourcemaps without `bundle: true`, it is recommended to use Sentry CLI instead: https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/cli/");
|
|
99
|
-
onResolve({ filter: /.*/ }, (args) => {
|
|
100
|
-
if (args.kind !== "entry-point") return;
|
|
101
|
-
if (initialOptions.inject?.includes(args.path)) return;
|
|
102
|
-
const resolvedPath = node_path.isAbsolute(args.path) ? args.path : node_path.join(args.resolveDir, args.path);
|
|
103
|
-
if (debugIdWrappedPaths.has(resolvedPath)) return;
|
|
104
|
-
debugIdWrappedPaths.add(resolvedPath);
|
|
105
|
-
return {
|
|
106
|
-
pluginName,
|
|
107
|
-
path: resolvedPath,
|
|
108
|
-
pluginData: {
|
|
109
|
-
isDebugIdProxy: true,
|
|
110
|
-
originalPath: args.path,
|
|
111
|
-
originalResolveDir: args.resolveDir
|
|
112
|
-
},
|
|
113
|
-
suffix: "?sentryDebugIdProxy=true"
|
|
114
|
-
};
|
|
115
|
-
});
|
|
116
|
-
onLoad({ filter: /.*/ }, (args) => {
|
|
117
|
-
if (!args.pluginData?.isDebugIdProxy) return null;
|
|
118
|
-
const originalPath = args.pluginData.originalPath;
|
|
119
|
-
const originalResolveDir = args.pluginData.originalResolveDir;
|
|
120
|
-
return {
|
|
121
|
-
loader: "js",
|
|
122
|
-
pluginName,
|
|
123
|
-
contents: `
|
|
124
|
-
import "_sentry-debug-id-injection-stub";
|
|
125
|
-
import * as OriginalModule from ${JSON.stringify(originalPath)};
|
|
126
|
-
export default OriginalModule.default;
|
|
127
|
-
export * from ${JSON.stringify(originalPath)};`,
|
|
128
|
-
resolveDir: originalResolveDir
|
|
129
|
-
};
|
|
130
|
-
});
|
|
131
|
-
onResolve({ filter: /_sentry-debug-id-injection-stub/ }, (args) => {
|
|
132
|
-
return {
|
|
133
|
-
path: args.path,
|
|
134
|
-
sideEffects: true,
|
|
135
|
-
pluginName,
|
|
136
|
-
namespace: "sentry-debug-id-stub",
|
|
137
|
-
suffix: "?sentry-module-id=" + (0, node_crypto.randomUUID)()
|
|
138
|
-
};
|
|
139
|
-
});
|
|
140
|
-
onLoad({
|
|
141
|
-
filter: /_sentry-debug-id-injection-stub/,
|
|
142
|
-
namespace: "sentry-debug-id-stub"
|
|
143
|
-
}, () => {
|
|
144
|
-
return {
|
|
145
|
-
loader: "js",
|
|
146
|
-
pluginName,
|
|
147
|
-
contents: (0, _sentry_bundler_plugin_core.getDebugIdSnippet)((0, node_crypto.randomUUID)()).code()
|
|
148
|
-
};
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
|
|
152
|
-
const upload = (0, _sentry_bundler_plugin_core.createDebugIdUploadFunction)({ sentryBuildPluginManager });
|
|
153
|
-
initialOptions.metafile = true;
|
|
154
|
-
onEnd(async (result) => {
|
|
155
|
-
try {
|
|
156
|
-
await sentryBuildPluginManager.createRelease();
|
|
157
|
-
if (sourcemapsEnabled && options.sourcemaps?.disable !== "disable-upload") await upload(result.metafile ? Object.keys(result.metafile.outputs) : []);
|
|
158
|
-
} finally {
|
|
159
|
-
freeGlobalDependencyOnBuildArtifacts();
|
|
160
|
-
await sentryBuildPluginManager.deleteArtifacts();
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
//#endregion
|
|
167
|
-
exports.default = sentryEsbuildPlugin;
|
|
168
|
-
exports.sentryEsbuildPlugin = sentryEsbuildPlugin;
|
|
169
|
-
Object.defineProperty(exports, "sentryCliBinaryExists", {
|
|
27
|
+
let _sentry_bundler_plugins_esbuild = require("@sentry/bundler-plugins/esbuild");
|
|
28
|
+
_sentry_bundler_plugins_esbuild = __toESM(_sentry_bundler_plugins_esbuild);
|
|
29
|
+
Object.defineProperty(exports, "default", {
|
|
170
30
|
enumerable: true,
|
|
171
31
|
get: function() {
|
|
172
|
-
return
|
|
32
|
+
return _sentry_bundler_plugins_esbuild.default;
|
|
173
33
|
}
|
|
174
34
|
});
|
|
175
|
-
|
|
176
|
-
|
|
35
|
+
Object.keys(_sentry_bundler_plugins_esbuild).forEach(function(k) {
|
|
36
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function() {
|
|
39
|
+
return _sentry_bundler_plugins_esbuild[k];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,142 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { randomUUID } from "node:crypto";
|
|
5
|
-
//#region src/index.ts
|
|
6
|
-
function getEsbuildMajorVersion() {
|
|
7
|
-
try {
|
|
8
|
-
return createRequire(import.meta.url)("esbuild").version?.split(".")[1];
|
|
9
|
-
} catch (err) {}
|
|
10
|
-
}
|
|
11
|
-
const pluginName = "sentry-esbuild-plugin";
|
|
12
|
-
function sentryEsbuildPlugin(userOptions = {}) {
|
|
13
|
-
const sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {
|
|
14
|
-
loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? `[${pluginName}]`,
|
|
15
|
-
buildTool: "esbuild",
|
|
16
|
-
buildToolMajorVersion: getEsbuildMajorVersion()
|
|
17
|
-
});
|
|
18
|
-
const { logger, normalizedOptions: options, bundleSizeOptimizationReplacementValues: replacementValues, bundleMetadata, createDependencyOnBuildArtifacts } = sentryBuildPluginManager;
|
|
19
|
-
if (options.disable) return {
|
|
20
|
-
name: "sentry-esbuild-noop-plugin",
|
|
21
|
-
setup() {}
|
|
22
|
-
};
|
|
23
|
-
if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) logger.warn("Running Sentry plugin from within a `node_modules` folder. Some features may not work.");
|
|
24
|
-
const sourcemapsEnabled = options.sourcemaps?.disable !== true;
|
|
25
|
-
const staticInjectionCode = new CodeInjection();
|
|
26
|
-
if (!options.release.inject) logger.debug("Release injection disabled via `release.inject` option. Will not inject release.");
|
|
27
|
-
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.");
|
|
28
|
-
else staticInjectionCode.append(generateReleaseInjectorCode({
|
|
29
|
-
release: options.release.name,
|
|
30
|
-
injectBuildInformation: options._experiments.injectBuildInformation || false
|
|
31
|
-
}));
|
|
32
|
-
if (Object.keys(bundleMetadata).length > 0) staticInjectionCode.append(generateModuleMetadataInjectorCode(bundleMetadata));
|
|
33
|
-
if (options.reactComponentAnnotation?.enabled) logger.warn("Component name annotation is not supported in esbuild. Please use a separate transform step or consider using a different bundler.");
|
|
34
|
-
const transformReplace = Object.keys(replacementValues).length > 0;
|
|
35
|
-
const debugIdWrappedPaths = /* @__PURE__ */ new Set();
|
|
36
|
-
sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {});
|
|
37
|
-
return {
|
|
38
|
-
name: pluginName,
|
|
39
|
-
setup({ initialOptions, onLoad, onResolve, onEnd }) {
|
|
40
|
-
if (!staticInjectionCode.isEmpty()) {
|
|
41
|
-
const virtualInjectionFilePath = path.resolve("_sentry-injection-stub");
|
|
42
|
-
initialOptions.inject = initialOptions.inject || [];
|
|
43
|
-
initialOptions.inject.push(virtualInjectionFilePath);
|
|
44
|
-
onResolve({ filter: /_sentry-injection-stub/ }, (args) => {
|
|
45
|
-
return {
|
|
46
|
-
path: args.path,
|
|
47
|
-
sideEffects: true,
|
|
48
|
-
pluginName
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
onLoad({ filter: /_sentry-injection-stub/ }, () => {
|
|
52
|
-
return {
|
|
53
|
-
loader: "js",
|
|
54
|
-
pluginName,
|
|
55
|
-
contents: staticInjectionCode.code()
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
if (transformReplace) {
|
|
60
|
-
const replacementStringValues = {};
|
|
61
|
-
Object.entries(replacementValues).forEach(([key, value]) => {
|
|
62
|
-
replacementStringValues[key] = JSON.stringify(value);
|
|
63
|
-
});
|
|
64
|
-
initialOptions.define = {
|
|
65
|
-
...initialOptions.define,
|
|
66
|
-
...replacementStringValues
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
if (sourcemapsEnabled) {
|
|
70
|
-
debugIdWrappedPaths.clear();
|
|
71
|
-
if (!initialOptions.bundle) logger.warn("The Sentry esbuild plugin only supports esbuild with `bundle: true` being set in the esbuild build options. Esbuild will probably crash now. Sorry about that. If you need to upload sourcemaps without `bundle: true`, it is recommended to use Sentry CLI instead: https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/cli/");
|
|
72
|
-
onResolve({ filter: /.*/ }, (args) => {
|
|
73
|
-
if (args.kind !== "entry-point") return;
|
|
74
|
-
if (initialOptions.inject?.includes(args.path)) return;
|
|
75
|
-
const resolvedPath = path.isAbsolute(args.path) ? args.path : path.join(args.resolveDir, args.path);
|
|
76
|
-
if (debugIdWrappedPaths.has(resolvedPath)) return;
|
|
77
|
-
debugIdWrappedPaths.add(resolvedPath);
|
|
78
|
-
return {
|
|
79
|
-
pluginName,
|
|
80
|
-
path: resolvedPath,
|
|
81
|
-
pluginData: {
|
|
82
|
-
isDebugIdProxy: true,
|
|
83
|
-
originalPath: args.path,
|
|
84
|
-
originalResolveDir: args.resolveDir
|
|
85
|
-
},
|
|
86
|
-
suffix: "?sentryDebugIdProxy=true"
|
|
87
|
-
};
|
|
88
|
-
});
|
|
89
|
-
onLoad({ filter: /.*/ }, (args) => {
|
|
90
|
-
if (!args.pluginData?.isDebugIdProxy) return null;
|
|
91
|
-
const originalPath = args.pluginData.originalPath;
|
|
92
|
-
const originalResolveDir = args.pluginData.originalResolveDir;
|
|
93
|
-
return {
|
|
94
|
-
loader: "js",
|
|
95
|
-
pluginName,
|
|
96
|
-
contents: `
|
|
97
|
-
import "_sentry-debug-id-injection-stub";
|
|
98
|
-
import * as OriginalModule from ${JSON.stringify(originalPath)};
|
|
99
|
-
export default OriginalModule.default;
|
|
100
|
-
export * from ${JSON.stringify(originalPath)};`,
|
|
101
|
-
resolveDir: originalResolveDir
|
|
102
|
-
};
|
|
103
|
-
});
|
|
104
|
-
onResolve({ filter: /_sentry-debug-id-injection-stub/ }, (args) => {
|
|
105
|
-
return {
|
|
106
|
-
path: args.path,
|
|
107
|
-
sideEffects: true,
|
|
108
|
-
pluginName,
|
|
109
|
-
namespace: "sentry-debug-id-stub",
|
|
110
|
-
suffix: "?sentry-module-id=" + randomUUID()
|
|
111
|
-
};
|
|
112
|
-
});
|
|
113
|
-
onLoad({
|
|
114
|
-
filter: /_sentry-debug-id-injection-stub/,
|
|
115
|
-
namespace: "sentry-debug-id-stub"
|
|
116
|
-
}, () => {
|
|
117
|
-
return {
|
|
118
|
-
loader: "js",
|
|
119
|
-
pluginName,
|
|
120
|
-
contents: getDebugIdSnippet(randomUUID()).code()
|
|
121
|
-
};
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
|
|
125
|
-
const upload = createDebugIdUploadFunction({ sentryBuildPluginManager });
|
|
126
|
-
initialOptions.metafile = true;
|
|
127
|
-
onEnd(async (result) => {
|
|
128
|
-
try {
|
|
129
|
-
await sentryBuildPluginManager.createRelease();
|
|
130
|
-
if (sourcemapsEnabled && options.sourcemaps?.disable !== "disable-upload") await upload(result.metafile ? Object.keys(result.metafile.outputs) : []);
|
|
131
|
-
} finally {
|
|
132
|
-
freeGlobalDependencyOnBuildArtifacts();
|
|
133
|
-
await sentryBuildPluginManager.deleteArtifacts();
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
//#endregion
|
|
140
|
-
export { sentryEsbuildPlugin as default, sentryEsbuildPlugin, sentryCliBinaryExists };
|
|
141
|
-
|
|
142
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
import esbuild_default from "@sentry/bundler-plugins/esbuild";
|
|
2
|
+
export * from "@sentry/bundler-plugins/esbuild";
|
|
3
|
+
export { esbuild_default as default };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export type { Options as SentryEsbuildPluginOptions } from "@sentry/bundler-plugin-core";
|
|
5
|
-
export { sentryCliBinaryExists } from "@sentry/bundler-plugin-core";
|
|
1
|
+
export * from "@sentry/bundler-plugins/esbuild";
|
|
2
|
+
export { default } from "@sentry/bundler-plugins/esbuild";
|
|
3
|
+
//# 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;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/esbuild-plugin",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "Official Sentry esbuild 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/esbuild-plugin",
|
|
@@ -37,29 +37,22 @@
|
|
|
37
37
|
"build:types:watch": "tsc --project types.tsconfig.json --watch --preserveWatchOutput",
|
|
38
38
|
"build:npm": "npm pack",
|
|
39
39
|
"check:types": "run-p check:types:src check:types:test",
|
|
40
|
-
"check:types:src": "tsc --project ./
|
|
40
|
+
"check:types:src": "tsc --project ./tsconfig.json --noEmit",
|
|
41
41
|
"check:types:test": "tsc --project ./test/tsconfig.json --noEmit",
|
|
42
42
|
"clean": "run-s clean:build",
|
|
43
43
|
"clean:all": "run-p clean clean:deps",
|
|
44
44
|
"clean:build": "premove ./dist *.tgz",
|
|
45
45
|
"clean:deps": "premove node_modules",
|
|
46
|
-
"
|
|
47
|
-
"lint": "eslint ./src ./test",
|
|
48
|
-
"prepack": "ts-node ./src/prepack.ts"
|
|
46
|
+
"prepack": "node ./prepack.mjs"
|
|
49
47
|
},
|
|
50
48
|
"dependencies": {
|
|
51
|
-
"@sentry/bundler-
|
|
49
|
+
"@sentry/bundler-plugins": "^10.64.0"
|
|
52
50
|
},
|
|
53
51
|
"devDependencies": {
|
|
54
|
-
"@sentry-internal/
|
|
55
|
-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "5.2.1",
|
|
52
|
+
"@sentry-internal/dev-utils": "5.4.0",
|
|
56
53
|
"@types/node": "^18.6.3",
|
|
57
|
-
"eslint": "^8.18.0",
|
|
58
|
-
"vitest": "^4.0.0",
|
|
59
54
|
"premove": "^4.0.0",
|
|
60
|
-
"rolldown": "1.0.0
|
|
61
|
-
"ts-node": "^10.9.1",
|
|
62
|
-
"typescript": "^4.7.4"
|
|
55
|
+
"rolldown": "^1.0.0"
|
|
63
56
|
},
|
|
64
57
|
"volta": {
|
|
65
58
|
"extends": "../../package.json"
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["CodeInjection","path"],"sources":["../../src/index.ts"],"sourcesContent":["import {\n createSentryBuildPluginManager,\n generateReleaseInjectorCode,\n generateModuleMetadataInjectorCode,\n Options,\n getDebugIdSnippet,\n createDebugIdUploadFunction,\n CodeInjection,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"node:path\";\nimport { createRequire } from \"node:module\";\nimport { randomUUID } from \"node:crypto\";\n\ninterface EsbuildOnResolveArgs {\n path: string;\n kind: string;\n importer?: string;\n resolveDir: string;\n pluginData?: unknown;\n}\n\ninterface EsbuildOnResolveResult {\n path: string;\n sideEffects?: boolean;\n pluginName?: string;\n namespace?: string;\n suffix?: string;\n pluginData?: unknown;\n}\n\ninterface EsbuildOnLoadArgs {\n path: string;\n pluginData?: unknown;\n}\n\ninterface EsbuildOnLoadResult {\n loader: string;\n pluginName: string;\n contents: string;\n resolveDir?: string;\n}\n\ninterface EsbuildOnEndArgs {\n metafile?: {\n outputs: Record<string, unknown>;\n };\n}\n\ninterface EsbuildInitialOptions {\n bundle?: boolean;\n inject?: string[];\n metafile?: boolean;\n define?: Record<string, string>;\n}\n\ninterface EsbuildPluginBuild {\n initialOptions: EsbuildInitialOptions;\n onLoad: (\n options: { filter: RegExp; namespace?: string },\n callback: (args: EsbuildOnLoadArgs) => EsbuildOnLoadResult | null\n ) => void;\n onResolve: (\n options: { filter: RegExp },\n callback: (args: EsbuildOnResolveArgs) => EsbuildOnResolveResult | undefined\n ) => void;\n onEnd: (callback: (result: EsbuildOnEndArgs) => void | Promise<void>) => void;\n}\n\nfunction getEsbuildMajorVersion(): string | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - esbuild transpiles this for us\n const req = createRequire(import.meta.url);\n const esbuild = req(\"esbuild\") as { version?: string };\n // esbuild hasn't released a v1 yet, so we'll return the minor version as the major version\n return esbuild.version?.split(\".\")[1];\n } catch (err) {\n // do nothing, we'll just not report a version\n }\n\n return undefined;\n}\n\nconst pluginName = \"sentry-esbuild-plugin\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function sentryEsbuildPlugin(userOptions: Options = {}): any {\n const sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {\n loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? `[${pluginName}]`,\n buildTool: \"esbuild\",\n buildToolMajorVersion: getEsbuildMajorVersion(),\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 name: \"sentry-esbuild-noop-plugin\",\n setup() {\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 // Component annotation warning\n if (options.reactComponentAnnotation?.enabled) {\n logger.warn(\n \"Component name annotation is not supported in esbuild. Please use a separate transform step or consider using a different bundler.\"\n );\n }\n\n const transformReplace = Object.keys(replacementValues).length > 0;\n\n // Track entry points wrapped for debug ID injection\n const debugIdWrappedPaths = new Set<string>();\n\n void sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {\n // Telemetry failures are acceptable\n });\n\n return {\n name: pluginName,\n setup({ initialOptions, onLoad, onResolve, onEnd }: EsbuildPluginBuild) {\n // Release and/or metadata injection\n if (!staticInjectionCode.isEmpty()) {\n const virtualInjectionFilePath = path.resolve(\"_sentry-injection-stub\");\n initialOptions.inject = initialOptions.inject || [];\n initialOptions.inject.push(virtualInjectionFilePath);\n\n onResolve({ filter: /_sentry-injection-stub/ }, (args) => {\n return {\n path: args.path,\n sideEffects: true,\n pluginName,\n };\n });\n\n onLoad({ filter: /_sentry-injection-stub/ }, () => {\n return {\n loader: \"js\",\n pluginName,\n contents: staticInjectionCode.code(),\n };\n });\n }\n\n // Bundle size optimizations\n if (transformReplace) {\n const replacementStringValues: Record<string, string> = {};\n Object.entries(replacementValues).forEach(([key, value]) => {\n replacementStringValues[key] = JSON.stringify(value);\n });\n\n initialOptions.define = { ...initialOptions.define, ...replacementStringValues };\n }\n\n // Debug ID injection - requires per-entry-point unique IDs\n if (sourcemapsEnabled) {\n // Clear state from previous builds (important for watch mode and test suites)\n debugIdWrappedPaths.clear();\n\n if (!initialOptions.bundle) {\n logger.warn(\n \"The Sentry esbuild plugin only supports esbuild with `bundle: true` being set in the esbuild build options. Esbuild will probably crash now. Sorry about that. If you need to upload sourcemaps without `bundle: true`, it is recommended to use Sentry CLI instead: https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/cli/\"\n );\n }\n\n // Wrap entry points to inject debug IDs\n onResolve({ filter: /.*/ }, (args) => {\n if (args.kind !== \"entry-point\") {\n return;\n }\n\n // Skip injecting debug IDs into modules specified in the esbuild `inject` option\n // since they're already part of the entry points\n if (initialOptions.inject?.includes(args.path)) {\n return;\n }\n\n const resolvedPath = path.isAbsolute(args.path)\n ? args.path\n : path.join(args.resolveDir, args.path);\n\n // Skip injecting debug IDs into paths that have already been wrapped\n if (debugIdWrappedPaths.has(resolvedPath)) {\n return;\n }\n debugIdWrappedPaths.add(resolvedPath);\n\n return {\n pluginName,\n path: resolvedPath,\n pluginData: {\n isDebugIdProxy: true,\n originalPath: args.path,\n originalResolveDir: args.resolveDir,\n },\n // We need to add a suffix here, otherwise esbuild will mark the entrypoint as resolved and won't traverse\n // the module tree any further down past the proxy module because we're essentially creating a dependency\n // loop back to the proxy module.\n // By setting a suffix we're telling esbuild that the entrypoint and proxy module are two different things,\n // making it re-resolve the entrypoint when it is imported from the proxy module.\n // Super confusing? Yes. Works? Apparently... Let's see.\n suffix: \"?sentryDebugIdProxy=true\",\n };\n });\n\n onLoad({ filter: /.*/ }, (args) => {\n if (!(args.pluginData as { isDebugIdProxy?: boolean })?.isDebugIdProxy) {\n return null;\n }\n\n const originalPath = (args.pluginData as { originalPath: string }).originalPath;\n const originalResolveDir = (args.pluginData as { originalResolveDir: string })\n .originalResolveDir;\n\n return {\n loader: \"js\",\n pluginName,\n contents: `\n import \"_sentry-debug-id-injection-stub\";\n import * as OriginalModule from ${JSON.stringify(originalPath)};\n export default OriginalModule.default;\n export * from ${JSON.stringify(originalPath)};`,\n resolveDir: originalResolveDir,\n };\n });\n\n onResolve({ filter: /_sentry-debug-id-injection-stub/ }, (args) => {\n return {\n path: args.path,\n sideEffects: true,\n pluginName,\n namespace: \"sentry-debug-id-stub\",\n suffix: \"?sentry-module-id=\" + randomUUID(),\n };\n });\n\n onLoad(\n { filter: /_sentry-debug-id-injection-stub/, namespace: \"sentry-debug-id-stub\" },\n () => {\n return {\n loader: \"js\",\n pluginName,\n contents: getDebugIdSnippet(randomUUID()).code(),\n };\n }\n );\n }\n\n // Create release and optionally upload\n const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();\n const upload = createDebugIdUploadFunction({ sentryBuildPluginManager });\n\n initialOptions.metafile = true;\n onEnd(async (result) => {\n try {\n await sentryBuildPluginManager.createRelease();\n\n if (sourcemapsEnabled && options.sourcemaps?.disable !== \"disable-upload\") {\n const buildArtifacts = result.metafile ? Object.keys(result.metafile.outputs) : [];\n await upload(buildArtifacts);\n }\n } finally {\n freeGlobalDependencyOnBuildArtifacts();\n await sentryBuildPluginManager.deleteArtifacts();\n }\n });\n },\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport default sentryEsbuildPlugin;\nexport type { Options as SentryEsbuildPluginOptions } from \"@sentry/bundler-plugin-core\";\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA,SAAS,yBAA6C;AACpD,KAAI;AAMF,UAAA,GAAA,YAAA,eAAA,QAAA,MAAA,CAAA,cAAA,WAAA,CAAA,KAH0C,CACtB,UAAU,CAEf,SAAS,MAAM,IAAI,CAAC;UAC5B,KAAK;;AAOhB,MAAM,aAAa;AAGnB,SAAgB,oBAAoB,cAAuB,EAAE,EAAO;CAClE,MAAM,4BAAA,GAAA,4BAAA,gCAA0D,aAAa;EAC3E,cAAc,YAAY,cAAc,wBAAwB,IAAI,WAAW;EAC/E,WAAW;EACX,uBAAuB,wBAAwB;EAChD,CAAC;CAEF,MAAM,EACJ,QACA,mBAAmB,SACnB,yCAAyC,mBACzC,gBACA,qCACE;AAEJ,KAAI,QAAQ,QACV,QAAO;EACL,MAAM;EACN,QAAQ;EAGT;AAGH,KAAI,QAAQ,KAAK,CAAC,MAAM,oCAAoC,CAC1D,QAAO,KACL,yFACD;CAGH,MAAM,oBAAoB,QAAQ,YAAY,YAAY;CAC1D,MAAM,sBAAsB,IAAIA,4BAAAA,eAAe;AAE/C,KAAI,CAAC,QAAQ,QAAQ,OACnB,QAAO,MACL,mFACD;UACQ,CAAC,QAAQ,QAAQ,KAC1B,QAAO,MACL,oHACD;KAED,qBAAoB,QAAA,GAAA,4BAAA,6BACU;EAC1B,SAAS,QAAQ,QAAQ;EACzB,wBAAwB,QAAQ,aAAa,0BAA0B;EACxE,CAAC,CACH;AAGH,KAAI,OAAO,KAAK,eAAe,CAAC,SAAS,EACvC,qBAAo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AoB,IAAI,aAAa;AAErC,YAAO;MACL;MACA,MAAM;MACN,YAAY;OACV,gBAAgB;OAChB,cAAc,KAAK;OACnB,oBAAoB,KAAK;OAC1B;MAOD,QAAQ;MACT;MACD;AAEF,WAAO,EAAE,QAAQ,MAAM,GAAG,SAAS;AACjC,SAAI,CAAE,KAAK,YAA6C,eACtD,QAAO;KAGT,MAAM,eAAgB,KAAK,WAAwC;KACnE,MAAM,qBAAsB,KAAK,WAC9B;AAEH,YAAO;MACL,QAAQ;MACR;MACA,UAAU;;gDAE0B,KAAK,UAAU,aAAa,CAAC;;8BAE/C,KAAK,UAAU,aAAa,CAAC;MAC/C,YAAY;MACb;MACD;AAEF,cAAU,EAAE,QAAQ,mCAAmC,GAAG,SAAS;AACjE,YAAO;MACL,MAAM,KAAK;MACX,aAAa;MACb;MACA,WAAW;MACX,QAAQ,wBAAA,GAAA,YAAA,aAAmC;MAC5C;MACD;AAEF,WACE;KAAE,QAAQ;KAAmC,WAAW;KAAwB,QAC1E;AACJ,YAAO;MACL,QAAQ;MACR;MACA,WAAA,GAAA,4BAAA,oBAAA,GAAA,YAAA,aAAwC,CAAC,CAAC,MAAM;MACjD;MAEJ;;GAIH,MAAM,uCAAuC,kCAAkC;GAC/E,MAAM,UAAA,GAAA,4BAAA,6BAAqC,EAAE,0BAA0B,CAAC;AAExE,kBAAe,WAAW;AAC1B,SAAM,OAAO,WAAW;AACtB,QAAI;AACF,WAAM,yBAAyB,eAAe;AAE9C,SAAI,qBAAqB,QAAQ,YAAY,YAAY,iBAEvD,OAAM,OADiB,OAAO,WAAW,OAAO,KAAK,OAAO,SAAS,QAAQ,GAAG,EAAE,CACtD;cAEtB;AACR,2CAAsC;AACtC,WAAM,yBAAyB,iBAAiB;;KAElD;;EAEL"}
|
package/dist/esm/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import {\n createSentryBuildPluginManager,\n generateReleaseInjectorCode,\n generateModuleMetadataInjectorCode,\n Options,\n getDebugIdSnippet,\n createDebugIdUploadFunction,\n CodeInjection,\n} from \"@sentry/bundler-plugin-core\";\nimport * as path from \"node:path\";\nimport { createRequire } from \"node:module\";\nimport { randomUUID } from \"node:crypto\";\n\ninterface EsbuildOnResolveArgs {\n path: string;\n kind: string;\n importer?: string;\n resolveDir: string;\n pluginData?: unknown;\n}\n\ninterface EsbuildOnResolveResult {\n path: string;\n sideEffects?: boolean;\n pluginName?: string;\n namespace?: string;\n suffix?: string;\n pluginData?: unknown;\n}\n\ninterface EsbuildOnLoadArgs {\n path: string;\n pluginData?: unknown;\n}\n\ninterface EsbuildOnLoadResult {\n loader: string;\n pluginName: string;\n contents: string;\n resolveDir?: string;\n}\n\ninterface EsbuildOnEndArgs {\n metafile?: {\n outputs: Record<string, unknown>;\n };\n}\n\ninterface EsbuildInitialOptions {\n bundle?: boolean;\n inject?: string[];\n metafile?: boolean;\n define?: Record<string, string>;\n}\n\ninterface EsbuildPluginBuild {\n initialOptions: EsbuildInitialOptions;\n onLoad: (\n options: { filter: RegExp; namespace?: string },\n callback: (args: EsbuildOnLoadArgs) => EsbuildOnLoadResult | null\n ) => void;\n onResolve: (\n options: { filter: RegExp },\n callback: (args: EsbuildOnResolveArgs) => EsbuildOnResolveResult | undefined\n ) => void;\n onEnd: (callback: (result: EsbuildOnEndArgs) => void | Promise<void>) => void;\n}\n\nfunction getEsbuildMajorVersion(): string | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - esbuild transpiles this for us\n const req = createRequire(import.meta.url);\n const esbuild = req(\"esbuild\") as { version?: string };\n // esbuild hasn't released a v1 yet, so we'll return the minor version as the major version\n return esbuild.version?.split(\".\")[1];\n } catch (err) {\n // do nothing, we'll just not report a version\n }\n\n return undefined;\n}\n\nconst pluginName = \"sentry-esbuild-plugin\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function sentryEsbuildPlugin(userOptions: Options = {}): any {\n const sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {\n loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? `[${pluginName}]`,\n buildTool: \"esbuild\",\n buildToolMajorVersion: getEsbuildMajorVersion(),\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 name: \"sentry-esbuild-noop-plugin\",\n setup() {\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 // Component annotation warning\n if (options.reactComponentAnnotation?.enabled) {\n logger.warn(\n \"Component name annotation is not supported in esbuild. Please use a separate transform step or consider using a different bundler.\"\n );\n }\n\n const transformReplace = Object.keys(replacementValues).length > 0;\n\n // Track entry points wrapped for debug ID injection\n const debugIdWrappedPaths = new Set<string>();\n\n void sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {\n // Telemetry failures are acceptable\n });\n\n return {\n name: pluginName,\n setup({ initialOptions, onLoad, onResolve, onEnd }: EsbuildPluginBuild) {\n // Release and/or metadata injection\n if (!staticInjectionCode.isEmpty()) {\n const virtualInjectionFilePath = path.resolve(\"_sentry-injection-stub\");\n initialOptions.inject = initialOptions.inject || [];\n initialOptions.inject.push(virtualInjectionFilePath);\n\n onResolve({ filter: /_sentry-injection-stub/ }, (args) => {\n return {\n path: args.path,\n sideEffects: true,\n pluginName,\n };\n });\n\n onLoad({ filter: /_sentry-injection-stub/ }, () => {\n return {\n loader: \"js\",\n pluginName,\n contents: staticInjectionCode.code(),\n };\n });\n }\n\n // Bundle size optimizations\n if (transformReplace) {\n const replacementStringValues: Record<string, string> = {};\n Object.entries(replacementValues).forEach(([key, value]) => {\n replacementStringValues[key] = JSON.stringify(value);\n });\n\n initialOptions.define = { ...initialOptions.define, ...replacementStringValues };\n }\n\n // Debug ID injection - requires per-entry-point unique IDs\n if (sourcemapsEnabled) {\n // Clear state from previous builds (important for watch mode and test suites)\n debugIdWrappedPaths.clear();\n\n if (!initialOptions.bundle) {\n logger.warn(\n \"The Sentry esbuild plugin only supports esbuild with `bundle: true` being set in the esbuild build options. Esbuild will probably crash now. Sorry about that. If you need to upload sourcemaps without `bundle: true`, it is recommended to use Sentry CLI instead: https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/cli/\"\n );\n }\n\n // Wrap entry points to inject debug IDs\n onResolve({ filter: /.*/ }, (args) => {\n if (args.kind !== \"entry-point\") {\n return;\n }\n\n // Skip injecting debug IDs into modules specified in the esbuild `inject` option\n // since they're already part of the entry points\n if (initialOptions.inject?.includes(args.path)) {\n return;\n }\n\n const resolvedPath = path.isAbsolute(args.path)\n ? args.path\n : path.join(args.resolveDir, args.path);\n\n // Skip injecting debug IDs into paths that have already been wrapped\n if (debugIdWrappedPaths.has(resolvedPath)) {\n return;\n }\n debugIdWrappedPaths.add(resolvedPath);\n\n return {\n pluginName,\n path: resolvedPath,\n pluginData: {\n isDebugIdProxy: true,\n originalPath: args.path,\n originalResolveDir: args.resolveDir,\n },\n // We need to add a suffix here, otherwise esbuild will mark the entrypoint as resolved and won't traverse\n // the module tree any further down past the proxy module because we're essentially creating a dependency\n // loop back to the proxy module.\n // By setting a suffix we're telling esbuild that the entrypoint and proxy module are two different things,\n // making it re-resolve the entrypoint when it is imported from the proxy module.\n // Super confusing? Yes. Works? Apparently... Let's see.\n suffix: \"?sentryDebugIdProxy=true\",\n };\n });\n\n onLoad({ filter: /.*/ }, (args) => {\n if (!(args.pluginData as { isDebugIdProxy?: boolean })?.isDebugIdProxy) {\n return null;\n }\n\n const originalPath = (args.pluginData as { originalPath: string }).originalPath;\n const originalResolveDir = (args.pluginData as { originalResolveDir: string })\n .originalResolveDir;\n\n return {\n loader: \"js\",\n pluginName,\n contents: `\n import \"_sentry-debug-id-injection-stub\";\n import * as OriginalModule from ${JSON.stringify(originalPath)};\n export default OriginalModule.default;\n export * from ${JSON.stringify(originalPath)};`,\n resolveDir: originalResolveDir,\n };\n });\n\n onResolve({ filter: /_sentry-debug-id-injection-stub/ }, (args) => {\n return {\n path: args.path,\n sideEffects: true,\n pluginName,\n namespace: \"sentry-debug-id-stub\",\n suffix: \"?sentry-module-id=\" + randomUUID(),\n };\n });\n\n onLoad(\n { filter: /_sentry-debug-id-injection-stub/, namespace: \"sentry-debug-id-stub\" },\n () => {\n return {\n loader: \"js\",\n pluginName,\n contents: getDebugIdSnippet(randomUUID()).code(),\n };\n }\n );\n }\n\n // Create release and optionally upload\n const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();\n const upload = createDebugIdUploadFunction({ sentryBuildPluginManager });\n\n initialOptions.metafile = true;\n onEnd(async (result) => {\n try {\n await sentryBuildPluginManager.createRelease();\n\n if (sourcemapsEnabled && options.sourcemaps?.disable !== \"disable-upload\") {\n const buildArtifacts = result.metafile ? Object.keys(result.metafile.outputs) : [];\n await upload(buildArtifacts);\n }\n } finally {\n freeGlobalDependencyOnBuildArtifacts();\n await sentryBuildPluginManager.deleteArtifacts();\n }\n });\n },\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport default sentryEsbuildPlugin;\nexport type { Options as SentryEsbu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