@sentry/esbuild-plugin 5.1.1 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/cjs/index.js +19 -22
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +4 -5
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +8 -13
package/README.md
CHANGED
|
@@ -240,10 +240,12 @@ Default: `[]`
|
|
|
240
240
|
|
|
241
241
|
### `sourcemaps.rewriteSources`
|
|
242
242
|
|
|
243
|
-
Type: `(source: string, map: any) => string`
|
|
243
|
+
Type: `(source: string, map: any, context?: { mapDir: string }) => string`
|
|
244
244
|
|
|
245
245
|
Hook to rewrite the `sources` field inside the source map before being uploaded to Sentry. Does not modify the actual source map. Effectively, this modifies how files inside the stacktrace will show up in Sentry.
|
|
246
246
|
|
|
247
|
+
The `context.mapDir` parameter provides the directory path of the source map file, which is useful for resolving relative source paths (e.g. `path.resolve(context.mapDir, source)`).
|
|
248
|
+
|
|
247
249
|
Defaults to making all sources relative to `process.cwd()` while building.
|
|
248
250
|
|
|
249
251
|
### `sourcemaps.resolveSourceMap`
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
//#region \0rolldown/runtime.js
|
|
3
6
|
var __create = Object.create;
|
|
4
7
|
var __defProp = Object.defineProperty;
|
|
@@ -7,16 +10,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
10
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
11
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
12
|
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
+
key = keys[i];
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: ((k) => from[k]).bind(null, key),
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
20
19
|
}
|
|
21
20
|
return to;
|
|
22
21
|
};
|
|
@@ -24,14 +23,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
23
|
value: mod,
|
|
25
24
|
enumerable: true
|
|
26
25
|
}) : target, mod));
|
|
27
|
-
|
|
28
26
|
//#endregion
|
|
29
27
|
let _sentry_bundler_plugin_core = require("@sentry/bundler-plugin-core");
|
|
30
28
|
let node_path = require("node:path");
|
|
31
29
|
node_path = __toESM(node_path);
|
|
32
30
|
let node_module = require("node:module");
|
|
33
|
-
let
|
|
34
|
-
|
|
31
|
+
let node_crypto = require("node:crypto");
|
|
35
32
|
//#region src/index.ts
|
|
36
33
|
function getEsbuildMajorVersion() {
|
|
37
34
|
try {
|
|
@@ -137,7 +134,7 @@ function sentryEsbuildPlugin(userOptions = {}) {
|
|
|
137
134
|
sideEffects: true,
|
|
138
135
|
pluginName,
|
|
139
136
|
namespace: "sentry-debug-id-stub",
|
|
140
|
-
suffix: "?sentry-module-id=" + (0,
|
|
137
|
+
suffix: "?sentry-module-id=" + (0, node_crypto.randomUUID)()
|
|
141
138
|
};
|
|
142
139
|
});
|
|
143
140
|
onLoad({
|
|
@@ -147,7 +144,7 @@ function sentryEsbuildPlugin(userOptions = {}) {
|
|
|
147
144
|
return {
|
|
148
145
|
loader: "js",
|
|
149
146
|
pluginName,
|
|
150
|
-
contents: (0, _sentry_bundler_plugin_core.getDebugIdSnippet)((0,
|
|
147
|
+
contents: (0, _sentry_bundler_plugin_core.getDebugIdSnippet)((0, node_crypto.randomUUID)()).code()
|
|
151
148
|
};
|
|
152
149
|
});
|
|
153
150
|
}
|
|
@@ -166,14 +163,14 @@ function sentryEsbuildPlugin(userOptions = {}) {
|
|
|
166
163
|
}
|
|
167
164
|
};
|
|
168
165
|
}
|
|
169
|
-
|
|
170
166
|
//#endregion
|
|
171
167
|
exports.default = sentryEsbuildPlugin;
|
|
172
168
|
exports.sentryEsbuildPlugin = sentryEsbuildPlugin;
|
|
173
|
-
Object.defineProperty(exports,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
169
|
+
Object.defineProperty(exports, "sentryCliBinaryExists", {
|
|
170
|
+
enumerable: true,
|
|
171
|
+
get: function() {
|
|
172
|
+
return _sentry_bundler_plugin_core.sentryCliBinaryExists;
|
|
173
|
+
}
|
|
178
174
|
});
|
|
175
|
+
|
|
179
176
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 { v4 as uuidv4 } from \"uuid\";\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=\" + uuidv4(),\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(uuidv4()).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,sFAH0C,CACtB,UAAU,CAEf,SAAS,MAAM,IAAI,CAAC;UAC5B,KAAK;;AAOhB,MAAM,aAAa;AAGnB,SAAgB,oBAAoB,cAAuB,EAAE,EAAO;CAClE,MAAM,2FAA0D,aAAa;EAC3E,cAAc,YAAY,cAAc,wBAAwB,IAAI,WAAW;EAC/E,WAAW;EACX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IH,MAAM,uCAAuC,kCAAkC;GAC/E,MAAM,sEAAqC,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"}
|
|
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,QAA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AAO,KAAK,OAAO,SAAS,QAAQ,GAAG,EAAE,CACtD;cAEtB;AACR,2CAAsC;AACtC,WAAM,yBAAyB,iBAAiB;;KAElD;;EAEL"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { CodeInjection, createDebugIdUploadFunction, createSentryBuildPluginManager, generateModuleMetadataInjectorCode, generateReleaseInjectorCode, getDebugIdSnippet, sentryCliBinaryExists } from "@sentry/bundler-plugin-core";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
6
5
|
//#region src/index.ts
|
|
7
6
|
function getEsbuildMajorVersion() {
|
|
8
7
|
try {
|
|
@@ -108,7 +107,7 @@ function sentryEsbuildPlugin(userOptions = {}) {
|
|
|
108
107
|
sideEffects: true,
|
|
109
108
|
pluginName,
|
|
110
109
|
namespace: "sentry-debug-id-stub",
|
|
111
|
-
suffix: "?sentry-module-id=" +
|
|
110
|
+
suffix: "?sentry-module-id=" + randomUUID()
|
|
112
111
|
};
|
|
113
112
|
});
|
|
114
113
|
onLoad({
|
|
@@ -118,7 +117,7 @@ function sentryEsbuildPlugin(userOptions = {}) {
|
|
|
118
117
|
return {
|
|
119
118
|
loader: "js",
|
|
120
119
|
pluginName,
|
|
121
|
-
contents: getDebugIdSnippet(
|
|
120
|
+
contents: getDebugIdSnippet(randomUUID()).code()
|
|
122
121
|
};
|
|
123
122
|
});
|
|
124
123
|
}
|
|
@@ -137,7 +136,7 @@ function sentryEsbuildPlugin(userOptions = {}) {
|
|
|
137
136
|
}
|
|
138
137
|
};
|
|
139
138
|
}
|
|
140
|
-
|
|
141
139
|
//#endregion
|
|
142
140
|
export { sentryEsbuildPlugin as default, sentryEsbuildPlugin, sentryCliBinaryExists };
|
|
141
|
+
|
|
143
142
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["uuidv4"],"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 { v4 as uuidv4 } from \"uuid\";\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=\" + uuidv4(),\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(uuidv4()).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,SAHY,cAAc,OAAO,KAAK,IAAI,CACtB,UAAU,CAEf,SAAS,MAAM,IAAI,CAAC;UAC5B,KAAK;;AAOhB,MAAM,aAAa;AAGnB,SAAgB,oBAAoB,cAAuB,EAAE,EAAO;CAClE,MAAM,2BAA2B,+BAA+B,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,IAAI,eAAe;AAE/C,KAAI,CAAC,QAAQ,QAAQ,OACnB,QAAO,MACL,mFACD;UACQ,CAAC,QAAQ,QAAQ,KAC1B,QAAO,MACL,oHACD;KAED,qBAAoB,OAClB,4BAA4B;EAC1B,SAAS,QAAQ,QAAQ;EACzB,wBAAwB,QAAQ,aAAa,0BAA0B;EACxE,CAAC,CACH;AAGH,KAAI,OAAO,KAAK,eAAe,CAAC,SAAS,EACvC,qBAAoB,OAAO,mCAAmC,eAAe,CAAC;AAIhF,KAAI,QAAQ,0BAA0B,QACpC,QAAO,KACL,qIACD;CAGH,MAAM,mBAAmB,OAAO,KAAK,kBAAkB,CAAC,SAAS;CAGjE,MAAM,sCAAsB,IAAI,KAAa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AAS;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,uBAAuBA,IAAQ;MACxC;MACD;AAEF,WACE;KAAE,QAAQ;KAAmC,WAAW;KAAwB,QAC1E;AACJ,YAAO;MACL,QAAQ;MACR;MACA,UAAU,kBAAkBA,IAAQ,CAAC,CAAC,MAAM;MAC7C;MAEJ;;GAIH,MAAM,uCAAuC,kCAAkC;GAC/E,MAAM,SAAS,4BAA4B,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"}
|
|
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 SentryEsbuildPluginOptions } from \"@sentry/bundler-plugin-core\";\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n"],"mappings":";;;;;AAoEA,SAAS,yBAA6C;AACpD,KAAI;AAMF,SAHY,cAAc,OAAO,KAAK,IAAI,CACtB,UAAU,CAEf,SAAS,MAAM,IAAI,CAAC;UAC5B,KAAK;;AAOhB,MAAM,aAAa;AAGnB,SAAgB,oBAAoB,cAAuB,EA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E,QAAQ;KAAmC,WAAW;KAAwB,QAC1E;AACJ,YAAO;MACL,QAAQ;MACR;MACA,UAAU,kBAAkB,YAAY,CAAC,CAAC,MAAM;MACjD;MAEJ;;GAIH,MAAM,uCAAuC,kCAAkC;GAC/E,MAAM,SAAS,4BAA4B,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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/esbuild-plugin",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.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",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"module": "dist/esm/index.mjs",
|
|
30
30
|
"types": "dist/types/index.d.ts",
|
|
31
31
|
"scripts": {
|
|
32
|
-
"build": "premove ./out && run-p build:rollup build:types",
|
|
32
|
+
"build": "premove ./out && run-p build:rollup build:types && run-s build:npm",
|
|
33
33
|
"build:watch": "run-p build:rollup:watch build:types:watch",
|
|
34
34
|
"build:rollup": "rolldown --config rollup.config.mjs",
|
|
35
35
|
"build:rollup:watch": "rolldown --config rollup.config.mjs --watch --no-watch.clearScreen",
|
|
@@ -43,26 +43,21 @@
|
|
|
43
43
|
"clean:all": "run-p clean clean:deps",
|
|
44
44
|
"clean:build": "premove ./dist *.tgz",
|
|
45
45
|
"clean:deps": "premove node_modules",
|
|
46
|
-
"test": "
|
|
46
|
+
"test": "vitest run",
|
|
47
47
|
"lint": "eslint ./src ./test",
|
|
48
48
|
"prepack": "ts-node ./src/prepack.ts"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@sentry/bundler-plugin-core": "5.
|
|
52
|
-
"uuid": "^9.0.0"
|
|
51
|
+
"@sentry/bundler-plugin-core": "5.2.0"
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
55
|
-
"@sentry-internal/eslint-config": "5.
|
|
56
|
-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "5.
|
|
57
|
-
"@swc/core": "^1.2.205",
|
|
58
|
-
"@swc/jest": "^0.2.21",
|
|
59
|
-
"@types/jest": "^28.1.3",
|
|
54
|
+
"@sentry-internal/eslint-config": "5.2.0",
|
|
55
|
+
"@sentry-internal/sentry-bundler-plugin-tsconfig": "5.2.0",
|
|
60
56
|
"@types/node": "^18.6.3",
|
|
61
|
-
"@types/uuid": "^9.0.1",
|
|
62
57
|
"eslint": "^8.18.0",
|
|
63
|
-
"
|
|
58
|
+
"vitest": "^4.0.0",
|
|
64
59
|
"premove": "^4.0.0",
|
|
65
|
-
"rolldown": "
|
|
60
|
+
"rolldown": "1.0.0-rc.10",
|
|
66
61
|
"ts-node": "^10.9.1",
|
|
67
62
|
"typescript": "^4.7.4"
|
|
68
63
|
},
|