@sentry/bundler-plugins 11.11.0 → 11.13.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.
Files changed (188) hide show
  1. package/build/cjs/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/assertClassBrand.js +6 -0
  2. package/build/cjs/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/checkPrivateRedeclaration.js +5 -0
  3. package/build/cjs/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateFieldGet2.js +6 -0
  4. package/build/cjs/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateFieldInitSpec.js +6 -0
  5. package/build/cjs/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateFieldSet2.js +6 -0
  6. package/build/cjs/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateMethodInitSpec.js +6 -0
  7. package/build/cjs/_virtual/_rolldown/runtime.js +22 -0
  8. package/build/cjs/babel-plugin/component-annotation.js +14 -32
  9. package/build/cjs/babel-plugin/component-annotation.js.map +1 -1
  10. package/build/cjs/babel-plugin/constants.js +140 -122
  11. package/build/cjs/babel-plugin/constants.js.map +1 -1
  12. package/build/cjs/babel-plugin/experimental.js +204 -307
  13. package/build/cjs/babel-plugin/experimental.js.map +1 -1
  14. package/build/cjs/babel-plugin/index.js +315 -437
  15. package/build/cjs/babel-plugin/index.js.map +1 -1
  16. package/build/cjs/bun/index.js +81 -117
  17. package/build/cjs/bun/index.js.map +1 -1
  18. package/build/cjs/core/build-plugin-manager.js +626 -683
  19. package/build/cjs/core/build-plugin-manager.js.map +1 -1
  20. package/build/cjs/core/cli.js +134 -129
  21. package/build/cjs/core/cli.js.map +1 -1
  22. package/build/cjs/core/component-annotate-hooks.js +16 -27
  23. package/build/cjs/core/component-annotate-hooks.js.map +1 -1
  24. package/build/cjs/core/component-annotation-oxc-ast.js +10 -21
  25. package/build/cjs/core/component-annotation-oxc-ast.js.map +1 -1
  26. package/build/cjs/core/component-annotation-oxc-fragments.js +45 -74
  27. package/build/cjs/core/component-annotation-oxc-fragments.js.map +1 -1
  28. package/build/cjs/core/component-annotation-oxc-jsx.js +116 -156
  29. package/build/cjs/core/component-annotation-oxc-jsx.js.map +1 -1
  30. package/build/cjs/core/component-annotation-oxc-walk.js +62 -123
  31. package/build/cjs/core/component-annotation-oxc-walk.js.map +1 -1
  32. package/build/cjs/core/component-annotation-oxc.js +68 -103
  33. package/build/cjs/core/component-annotation-oxc.js.map +1 -1
  34. package/build/cjs/core/debug-id-upload.js +223 -234
  35. package/build/cjs/core/debug-id-upload.js.map +1 -1
  36. package/build/cjs/core/get-code-injection-position.js +59 -74
  37. package/build/cjs/core/get-code-injection-position.js.map +1 -1
  38. package/build/cjs/core/glob.js +9 -7
  39. package/build/cjs/core/glob.js.map +1 -1
  40. package/build/cjs/core/index.js +77 -61
  41. package/build/cjs/core/index.js.map +1 -1
  42. package/build/cjs/core/logger.js +17 -26
  43. package/build/cjs/core/logger.js.map +1 -1
  44. package/build/cjs/core/options-mapping.js +95 -117
  45. package/build/cjs/core/options-mapping.js.map +1 -1
  46. package/build/cjs/core/sentry/telemetry.js +90 -105
  47. package/build/cjs/core/sentry/telemetry.js.map +1 -1
  48. package/build/cjs/core/sentry/transports.js +92 -99
  49. package/build/cjs/core/sentry/transports.js.map +1 -1
  50. package/build/cjs/core/sourcemap-settings.js +98 -61
  51. package/build/cjs/core/sourcemap-settings.js.map +1 -1
  52. package/build/cjs/core/upload-filter.js +52 -0
  53. package/build/cjs/core/upload-filter.js.map +1 -0
  54. package/build/cjs/core/utils.js +228 -219
  55. package/build/cjs/core/utils.js.map +1 -1
  56. package/build/cjs/core/version.js +4 -5
  57. package/build/cjs/core/version.js.map +1 -1
  58. package/build/cjs/esbuild/index.js +180 -210
  59. package/build/cjs/esbuild/index.js.map +1 -1
  60. package/build/cjs/loader-utils/index.js +5 -10
  61. package/build/cjs/rollup/debug-id-injection.js +22 -38
  62. package/build/cjs/rollup/debug-id-injection.js.map +1 -1
  63. package/build/cjs/rollup/debug-id-stamping.js +14 -24
  64. package/build/cjs/rollup/debug-id-stamping.js.map +1 -1
  65. package/build/cjs/rollup/index.js +195 -209
  66. package/build/cjs/rollup/index.js.map +1 -1
  67. package/build/cjs/rollup/source-map-handling.js +178 -0
  68. package/build/cjs/rollup/source-map-handling.js.map +1 -0
  69. package/build/cjs/vite/index.js +19 -35
  70. package/build/cjs/vite/index.js.map +1 -1
  71. package/build/cjs/vite/source-map-hooks.js +116 -0
  72. package/build/cjs/vite/source-map-hooks.js.map +1 -0
  73. package/build/cjs/webpack/component-annotation-transform.js +20 -26
  74. package/build/cjs/webpack/component-annotation-transform.js.map +1 -1
  75. package/build/cjs/webpack/index.js +277 -234
  76. package/build/cjs/webpack/index.js.map +1 -1
  77. package/build/esm/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/assertClassBrand.js +6 -0
  78. package/build/esm/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/checkPrivateRedeclaration.js +5 -0
  79. package/build/esm/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateFieldGet2.js +6 -0
  80. package/build/esm/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateFieldInitSpec.js +6 -0
  81. package/build/esm/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateFieldSet2.js +6 -0
  82. package/build/esm/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/classPrivateMethodInitSpec.js +6 -0
  83. package/build/esm/_virtual/_rolldown/runtime.js +2 -0
  84. package/build/esm/babel-plugin/component-annotation.js +13 -29
  85. package/build/esm/babel-plugin/component-annotation.js.map +1 -1
  86. package/build/esm/babel-plugin/constants.js +140 -120
  87. package/build/esm/babel-plugin/constants.js.map +1 -1
  88. package/build/esm/babel-plugin/experimental.js +204 -305
  89. package/build/esm/babel-plugin/experimental.js.map +1 -1
  90. package/build/esm/babel-plugin/index.js +311 -434
  91. package/build/esm/babel-plugin/index.js.map +1 -1
  92. package/build/esm/bun/index.js +76 -101
  93. package/build/esm/bun/index.js.map +1 -1
  94. package/build/esm/core/build-plugin-manager.js +621 -664
  95. package/build/esm/core/build-plugin-manager.js.map +1 -1
  96. package/build/esm/core/cli.js +134 -127
  97. package/build/esm/core/cli.js.map +1 -1
  98. package/build/esm/core/component-annotate-hooks.js +16 -25
  99. package/build/esm/core/component-annotate-hooks.js.map +1 -1
  100. package/build/esm/core/component-annotation-oxc-ast.js +9 -19
  101. package/build/esm/core/component-annotation-oxc-ast.js.map +1 -1
  102. package/build/esm/core/component-annotation-oxc-fragments.js +44 -72
  103. package/build/esm/core/component-annotation-oxc-fragments.js.map +1 -1
  104. package/build/esm/core/component-annotation-oxc-jsx.js +115 -154
  105. package/build/esm/core/component-annotation-oxc-jsx.js.map +1 -1
  106. package/build/esm/core/component-annotation-oxc-walk.js +61 -121
  107. package/build/esm/core/component-annotation-oxc-walk.js.map +1 -1
  108. package/build/esm/core/component-annotation-oxc.js +65 -96
  109. package/build/esm/core/component-annotation-oxc.js.map +1 -1
  110. package/build/esm/core/debug-id-upload.js +218 -213
  111. package/build/esm/core/debug-id-upload.js.map +1 -1
  112. package/build/esm/core/get-code-injection-position.js +59 -72
  113. package/build/esm/core/get-code-injection-position.js.map +1 -1
  114. package/build/esm/core/glob.js +9 -5
  115. package/build/esm/core/glob.js.map +1 -1
  116. package/build/esm/core/index.js +62 -47
  117. package/build/esm/core/index.js.map +1 -1
  118. package/build/esm/core/logger.js +17 -24
  119. package/build/esm/core/logger.js.map +1 -1
  120. package/build/esm/core/options-mapping.js +95 -115
  121. package/build/esm/core/options-mapping.js.map +1 -1
  122. package/build/esm/core/sentry/telemetry.js +89 -102
  123. package/build/esm/core/sentry/telemetry.js.map +1 -1
  124. package/build/esm/core/sentry/transports.js +90 -83
  125. package/build/esm/core/sentry/transports.js.map +1 -1
  126. package/build/esm/core/sourcemap-settings.js +96 -59
  127. package/build/esm/core/sourcemap-settings.js.map +1 -1
  128. package/build/esm/core/upload-filter.js +50 -0
  129. package/build/esm/core/upload-filter.js.map +1 -0
  130. package/build/esm/core/utils.js +221 -209
  131. package/build/esm/core/utils.js.map +1 -1
  132. package/build/esm/core/version.js +4 -3
  133. package/build/esm/core/version.js.map +1 -1
  134. package/build/esm/esbuild/index.js +176 -194
  135. package/build/esm/esbuild/index.js.map +1 -1
  136. package/build/esm/loader-utils/index.js +4 -3
  137. package/build/esm/package.json +1 -1
  138. package/build/esm/rollup/debug-id-injection.js +22 -36
  139. package/build/esm/rollup/debug-id-injection.js.map +1 -1
  140. package/build/esm/rollup/debug-id-stamping.js +14 -22
  141. package/build/esm/rollup/debug-id-stamping.js.map +1 -1
  142. package/build/esm/rollup/index.js +191 -189
  143. package/build/esm/rollup/index.js.map +1 -1
  144. package/build/esm/rollup/source-map-handling.js +173 -0
  145. package/build/esm/rollup/source-map-handling.js.map +1 -0
  146. package/build/esm/vite/index.js +19 -32
  147. package/build/esm/vite/index.js.map +1 -1
  148. package/build/esm/vite/source-map-hooks.js +114 -0
  149. package/build/esm/vite/source-map-hooks.js.map +1 -0
  150. package/build/esm/webpack/component-annotation-transform.js +17 -24
  151. package/build/esm/webpack/component-annotation-transform.js.map +1 -1
  152. package/build/esm/webpack/index.js +274 -216
  153. package/build/esm/webpack/index.js.map +1 -1
  154. package/build/types/core/build-plugin-manager.d.ts +33 -10
  155. package/build/types/core/build-plugin-manager.d.ts.map +1 -1
  156. package/build/types/core/cli.d.ts +6 -1
  157. package/build/types/core/cli.d.ts.map +1 -1
  158. package/build/types/core/debug-id-upload.d.ts +7 -4
  159. package/build/types/core/debug-id-upload.d.ts.map +1 -1
  160. package/build/types/core/index.d.ts +4 -3
  161. package/build/types/core/index.d.ts.map +1 -1
  162. package/build/types/core/options-mapping.d.ts +4 -3
  163. package/build/types/core/options-mapping.d.ts.map +1 -1
  164. package/build/types/core/sentry/telemetry.d.ts.map +1 -1
  165. package/build/types/core/sourcemap-settings.d.ts +10 -1
  166. package/build/types/core/sourcemap-settings.d.ts.map +1 -1
  167. package/build/types/core/types.d.ts +32 -1
  168. package/build/types/core/types.d.ts.map +1 -1
  169. package/build/types/core/upload-filter.d.ts +9 -0
  170. package/build/types/core/upload-filter.d.ts.map +1 -0
  171. package/build/types/core/utils.d.ts +4 -0
  172. package/build/types/core/utils.d.ts.map +1 -1
  173. package/build/types/core/version.d.ts +1 -1
  174. package/build/types/esbuild/index.d.ts +2 -2
  175. package/build/types/esbuild/index.d.ts.map +1 -1
  176. package/build/types/rollup/index.d.ts +107 -7
  177. package/build/types/rollup/index.d.ts.map +1 -1
  178. package/build/types/rollup/source-map-handling.d.ts +59 -0
  179. package/build/types/rollup/source-map-handling.d.ts.map +1 -0
  180. package/build/types/vite/index.d.ts +4 -8
  181. package/build/types/vite/index.d.ts.map +1 -1
  182. package/build/types/vite/source-map-hooks.d.ts +45 -0
  183. package/build/types/vite/source-map-hooks.d.ts.map +1 -0
  184. package/build/types/webpack/index.d.ts +7 -3
  185. package/build/types/webpack/index.d.ts.map +1 -1
  186. package/package.json +33 -38
  187. package/build/cjs/loader-utils/index.js.map +0 -1
  188. package/build/esm/loader-utils/index.js.map +0 -1
@@ -1,674 +1,631 @@
1
- import { DEFAULT_ENVIRONMENT, makeSession, startSpan, setMeasurement, closeSession } from '@sentry/core';
2
- import * as dotenv from 'dotenv';
3
- import * as fs from 'fs';
4
- import * as os from 'os';
5
- import * as path from 'path';
6
- import { escape } from 'glob';
7
- import { SentryCliAdapter } from './cli.js';
8
- import { normalizeUserOptions, validateOptions } from './options-mapping.js';
9
- import { createLogger } from './logger.js';
10
- import { allowedToSendTelemetry, createSentryInstance, safeFlushTelemetry } from './sentry/telemetry.js';
11
- import { getProjects, stripQueryAndHashFromPath, getTurborepoEnvPassthroughWarning, arrayify } from './utils.js';
12
- import { defaultRewriteSourcesHook, prepareArtifactForUpload, writePreparedArtifact, prepareBundleForDebugIdUpload } from './debug-id-upload.js';
13
- import { globFiles } from './glob.js';
14
- import { decideSourceMapHandling } from './sourcemap-settings.js';
15
- import { LIB_VERSION } from './version.js';
16
-
1
+ import { SentryCliAdapter } from "./cli.js";
2
+ import { normalizeUserOptions, validateOptions } from "./options-mapping.js";
3
+ import { createLogger } from "./logger.js";
4
+ import { allowedToSendTelemetry, createSentryInstance, safeFlushTelemetry } from "./sentry/telemetry.js";
5
+ import { arrayify, getProjects, getTurborepoEnvPassthroughWarning, stripQueryAndHashFromPath } from "./utils.js";
6
+ import { defaultRewriteSourcesHook, prepareArtifactForUpload, prepareBundleForDebugIdUpload, writePreparedArtifact } from "./debug-id-upload.js";
7
+ import { globFiles } from "./glob.js";
8
+ import { decideSourceMapHandling } from "./sourcemap-settings.js";
9
+ import { createUploadFilter } from "./upload-filter.js";
10
+ import { LIB_VERSION } from "./version.js";
11
+ import * as path from "path";
12
+ import * as fs from "fs";
13
+ import * as os from "os";
14
+ import { escape } from "glob";
15
+ import { DEFAULT_ENVIRONMENT, closeSession, makeSession, setMeasurement, startSpan } from "@sentry/core";
16
+ import * as dotenv from "dotenv";
17
+ // src/core/build-plugin-manager.ts
17
18
  const _deployedReleases = /* @__PURE__ */ new Set();
19
+ /**
20
+ * Creates a build plugin manager that exposes primitives for everything that a Sentry JavaScript SDK or build tooling may do during a build.
21
+ *
22
+ * The build plugin manager's behavior strongly depends on the options that are passed in.
23
+ */
18
24
  function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
19
- const logger = createLogger({
20
- prefix: bundlerPluginMetaContext.loggerPrefix,
21
- silent: userOptions.silent ?? false,
22
- debug: userOptions.debug ?? false
23
- });
24
- try {
25
- const dotenvFile = fs.readFileSync(path.join(process.cwd(), ".env.sentry-build-plugin"), "utf-8");
26
- const dotenvResult = dotenv.parse(dotenvFile);
27
- Object.assign(process.env, dotenvResult);
28
- logger.info('Using environment variables configured in ".env.sentry-build-plugin".');
29
- } catch (e) {
30
- if (typeof e === "object" && e && "code" in e && e.code !== "ENOENT") {
31
- throw e;
32
- }
33
- }
34
- const options = normalizeUserOptions(userOptions);
35
- if (options.disable) {
36
- return {
37
- normalizedOptions: options,
38
- logger,
39
- bundleSizeOptimizationReplacementValues: {},
40
- telemetry: {
41
- emitBundlerPluginExecutionSignal: async () => {
42
- }
43
- },
44
- bundleMetadata: {},
45
- createRelease: async () => {
46
- },
47
- uploadSourcemaps: async () => ({ uploaded: false }),
48
- createUploadStaging: async () => ({
49
- dir: "",
50
- count: 0,
51
- stagedChunkPaths: /* @__PURE__ */ new Set(),
52
- stage: async () => "skipped",
53
- discard: async () => {
54
- },
55
- keep: async () => {
56
- }
57
- }),
58
- sourceMaps: {
59
- uploadPossible: false,
60
- decide: () => ({ enableHidden: false, deleteAfterUpload: false })
61
- },
62
- deleteArtifacts: async () => {
63
- },
64
- createDependencyOnBuildArtifacts: () => () => {
65
- },
66
- injectDebugIds: async () => {
67
- }
68
- };
69
- }
70
- const shouldSendTelemetry = allowedToSendTelemetry(options);
71
- const { sentryScope, sentryClient } = createSentryInstance(
72
- options,
73
- shouldSendTelemetry,
74
- bundlerPluginMetaContext.buildTool,
75
- bundlerPluginMetaContext.buildToolMajorVersion
76
- );
77
- const { release, environment = DEFAULT_ENVIRONMENT } = sentryClient.getOptions();
78
- const sentrySession = makeSession({ release, environment });
79
- sentryScope.setSession(sentrySession);
80
- sentryClient.captureSession(sentrySession);
81
- let sessionHasEnded = false;
82
- function endSession() {
83
- if (sessionHasEnded) {
84
- return;
85
- }
86
- closeSession(sentrySession);
87
- sentryClient.captureSession(sentrySession);
88
- sessionHasEnded = true;
89
- }
90
- process.on("beforeExit", () => {
91
- endSession();
92
- });
93
- process.env["SENTRY_PIPELINE"] = `${bundlerPluginMetaContext.buildTool}-plugin/${LIB_VERSION}`;
94
- if (options.debug && !process.env["SENTRY_LOG_LEVEL"]) {
95
- process.env["SENTRY_LOG_LEVEL"] = "debug";
96
- }
97
- const isDevMode = process.env["NODE_ENV"] === "development";
98
- function handleRecoverableError(unknownError, throwByDefault) {
99
- sentrySession.status = "abnormal";
100
- try {
101
- if (options.errorHandler) {
102
- try {
103
- if (unknownError instanceof Error) {
104
- options.errorHandler(unknownError);
105
- } else {
106
- options.errorHandler(new Error("An unknown error occurred"));
107
- }
108
- } catch (e) {
109
- sentrySession.status = "crashed";
110
- throw e;
111
- }
112
- } else {
113
- sentrySession.status = "crashed";
114
- if (throwByDefault) {
115
- throw unknownError;
116
- }
117
- logger.error("An error occurred. Couldn't finish all operations:", unknownError);
118
- }
119
- } finally {
120
- endSession();
121
- }
122
- }
123
- if (!validateOptions(options, logger)) {
124
- handleRecoverableError(new Error("Options were not set correctly. See output above for more details."), true);
125
- }
126
- const dependenciesOnBuildArtifacts = /* @__PURE__ */ new Set();
127
- const buildArtifactsDependencySubscribers = [];
128
- function notifyBuildArtifactDependencySubscribers() {
129
- buildArtifactsDependencySubscribers.forEach((subscriber) => {
130
- subscriber();
131
- });
132
- }
133
- function createDependencyOnBuildArtifacts() {
134
- const dependencyIdentifier = /* @__PURE__ */ Symbol();
135
- dependenciesOnBuildArtifacts.add(dependencyIdentifier);
136
- return function freeDependencyOnBuildArtifacts() {
137
- dependenciesOnBuildArtifacts.delete(dependencyIdentifier);
138
- notifyBuildArtifactDependencySubscribers();
139
- };
140
- }
141
- const sourceMapUploadPossible = getSourceMapUploadBlocker(options, isDevMode) === void 0;
142
- const loggedSourceMapMessages = /* @__PURE__ */ new Set();
143
- function waitUntilBuildArtifactDependenciesAreFreed() {
144
- return new Promise((resolve) => {
145
- buildArtifactsDependencySubscribers.push(() => {
146
- if (dependenciesOnBuildArtifacts.size === 0) {
147
- resolve();
148
- }
149
- });
150
- if (dependenciesOnBuildArtifacts.size === 0) {
151
- resolve();
152
- }
153
- });
154
- }
155
- const bundleSizeOptimizationReplacementValues = {};
156
- if (options.bundleSizeOptimizations) {
157
- const { bundleSizeOptimizations } = options;
158
- if (bundleSizeOptimizations.excludeDebugStatements) {
159
- bundleSizeOptimizationReplacementValues["__SENTRY_DEBUG__"] = false;
160
- }
161
- if (bundleSizeOptimizations.excludeTracing) {
162
- bundleSizeOptimizationReplacementValues["__SENTRY_TRACING__"] = false;
163
- }
164
- if (bundleSizeOptimizations.excludeChannelInjection) {
165
- bundleSizeOptimizationReplacementValues["__SENTRY_CHANNEL_INJECTION__"] = false;
166
- }
167
- if (bundleSizeOptimizations.excludeReplayCanvas) {
168
- bundleSizeOptimizationReplacementValues["__RRWEB_EXCLUDE_CANVAS__"] = true;
169
- }
170
- if (bundleSizeOptimizations.excludeReplayIframe) {
171
- bundleSizeOptimizationReplacementValues["__RRWEB_EXCLUDE_IFRAME__"] = true;
172
- }
173
- if (bundleSizeOptimizations.excludeReplayShadowDom) {
174
- bundleSizeOptimizationReplacementValues["__RRWEB_EXCLUDE_SHADOW_DOM__"] = true;
175
- }
176
- if (bundleSizeOptimizations.excludeReplayWorker) {
177
- bundleSizeOptimizationReplacementValues["__SENTRY_EXCLUDE_REPLAY_WORKER__"] = true;
178
- }
179
- }
180
- let bundleMetadata = {};
181
- if (options.moduleMetadata || options.applicationKey) {
182
- if (options.applicationKey) {
183
- bundleMetadata[`_sentryBundlerPluginAppKey:${options.applicationKey}`] = true;
184
- }
185
- if (typeof options.moduleMetadata === "function") {
186
- const args = {
187
- org: options.org,
188
- project: getProjects(options.project)?.[0],
189
- projects: getProjects(options.project),
190
- release: options.release.name
191
- };
192
- bundleMetadata = { ...bundleMetadata, ...options.moduleMetadata(args) };
193
- } else {
194
- bundleMetadata = { ...bundleMetadata, ...options.moduleMetadata };
195
- }
196
- }
197
- return {
198
- /**
199
- * A logger instance that takes the options passed to the build plugin manager into account. (for silencing and log level etc.)
200
- */
201
- logger,
202
- /**
203
- * Options after normalization. Includes things like the inferred release name.
204
- */
205
- normalizedOptions: options,
206
- /**
207
- * Magic strings and their replacement values that can be used for bundle size optimizations. This already takes
208
- * into account the options passed to the build plugin manager.
209
- */
210
- bundleSizeOptimizationReplacementValues,
211
- /**
212
- * Metadata that should be injected into bundles if possible. Takes into account options passed to the build plugin manager.
213
- */
214
- // See `generateModuleMetadataInjectorCode` for how this should be used exactly
215
- bundleMetadata,
216
- /**
217
- * Contains utility functions for emitting telemetry via the build plugin manager.
218
- */
219
- telemetry: {
220
- /**
221
- * Emits a `Sentry Bundler Plugin execution` signal.
222
- */
223
- async emitBundlerPluginExecutionSignal() {
224
- if (await shouldSendTelemetry) {
225
- logger.info(
226
- "Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`."
227
- );
228
- startSpan({ name: "Sentry Bundler Plugin execution", scope: sentryScope }, () => {
229
- });
230
- await safeFlushTelemetry(sentryClient);
231
- }
232
- }
233
- },
234
- /**
235
- * Will potentially create a release based on the build plugin manager options.
236
- *
237
- * Also
238
- * - finalizes the release
239
- * - sets commits
240
- * - uploads legacy sourcemaps
241
- * - adds deploy information
242
- */
243
- async createRelease() {
244
- if (!options.release.name) {
245
- logger.debug(
246
- "No release name provided. Will not create release. Please set the `release.name` option to identify your release."
247
- );
248
- return;
249
- } else if (isDevMode) {
250
- logger.debug("Running in development mode. Will not create release.");
251
- return;
252
- } else if (!options.authToken) {
253
- logger.warn(
254
- `No auth token provided. Will not create release. Please set the \`authToken\` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/${getTurborepoEnvPassthroughWarning("SENTRY_AUTH_TOKEN")}`
255
- );
256
- return;
257
- } else if (!options.org && !options.authToken.startsWith("sntrys_")) {
258
- logger.warn(
259
- `No organization slug provided. Will not create release. Please set the \`org\` option to your Sentry organization slug.${getTurborepoEnvPassthroughWarning("SENTRY_ORG")}`
260
- );
261
- return;
262
- } else if (!options.project || Array.isArray(options.project) && options.project.length === 0) {
263
- logger.warn(
264
- `No project provided. Will not create release. Please set the \`project\` option to your Sentry project slug.${getTurborepoEnvPassthroughWarning("SENTRY_PROJECT")}`
265
- );
266
- return;
267
- }
268
- const freeWriteBundleInvocationDependencyOnSourcemapFiles = createDependencyOnBuildArtifacts();
269
- const releaseName = options.release.name;
270
- try {
271
- const cliInstance = new SentryCliAdapter(options);
272
- if (options.release.create) {
273
- const releaseOutput = await cliInstance.createRelease(releaseName);
274
- logger.debug("Release created:", releaseOutput);
275
- }
276
- if (options.release.uploadLegacySourcemaps) {
277
- const uploadTargets = arrayify(options.release.uploadLegacySourcemaps).map((includeItem) => typeof includeItem === "string" ? { paths: [includeItem] } : includeItem).flatMap(
278
- (includeEntry) => includeEntry.paths.map((directory) => ({
279
- directory,
280
- dist: options.release.dist,
281
- ext: includeEntry.ext ? includeEntry.ext.map((extension) => `.${extension.replace(/^\./, "")}`) : [".js", ".map", ".jsbundle", ".bundle"],
282
- // The old CLI only skipped `node_modules` when neither ignore source was configured.
283
- ignore: includeEntry.ignore ? arrayify(includeEntry.ignore) : includeEntry.ignoreFile ? void 0 : ["node_modules"],
284
- ignoreFile: includeEntry.ignoreFile,
285
- urlPrefix: includeEntry.urlPrefix
286
- }))
287
- );
288
- await cliInstance.uploadSourcemaps(releaseName, uploadTargets);
289
- }
290
- if (options.release.setCommits !== false) {
291
- try {
292
- await cliInstance.setCommits(
293
- releaseName,
294
- // set commits always exists due to the normalize function
295
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
296
- options.release.setCommits
297
- );
298
- } catch (e) {
299
- if (options.release.setCommits && "shouldNotThrowOnFailure" in options.release.setCommits && options.release.setCommits.shouldNotThrowOnFailure) {
300
- logger.debug(
301
- "An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):",
302
- e
303
- );
304
- } else {
305
- throw e;
306
- }
307
- }
308
- }
309
- if (options.release.finalize) {
310
- await cliInstance.finalizeRelease(releaseName);
311
- }
312
- if (options.release.deploy && !_deployedReleases.has(releaseName)) {
313
- await cliInstance.newDeploy(releaseName, options.release.deploy);
314
- _deployedReleases.add(releaseName);
315
- }
316
- } catch (e) {
317
- sentryScope.captureException('Error in "releaseManagementPlugin" writeBundle hook');
318
- await safeFlushTelemetry(sentryClient);
319
- handleRecoverableError(e, false);
320
- } finally {
321
- freeWriteBundleInvocationDependencyOnSourcemapFiles();
322
- }
323
- },
324
- /*
325
- Injects debug IDs into the build artifacts.
326
-
327
- This is a separate function from `uploadSourcemaps` because that needs to run before the sourcemaps are uploaded.
328
- Usually the respective bundler-plugin will take care of this before the sourcemaps are uploaded.
329
- Only use this if you need to manually inject debug IDs into the build artifacts.
330
- */
331
- async injectDebugIds(buildArtifactPaths) {
332
- await startSpan({ name: "inject-debug-ids", scope: sentryScope, forceTransaction: true }, async () => {
333
- try {
334
- const cliInstance = new SentryCliAdapter(options);
335
- await cliInstance.injectDebugIds(buildArtifactPaths, options.sourcemaps?.ignore);
336
- } catch (e) {
337
- sentryScope.captureException('Error in "debugIdInjectionPlugin" writeBundle hook');
338
- handleRecoverableError(e, false);
339
- } finally {
340
- await safeFlushTelemetry(sentryClient);
341
- }
342
- });
343
- },
344
- /**
345
- * Uploads sourcemaps using the "Debug ID" method.
346
- *
347
- * By default, this prepares bundles in a temporary folder before uploading. You can opt into an
348
- * in-place, direct upload path by setting `prepareArtifacts` to `false`. If `prepareArtifacts` is set to
349
- * `false`, no preparation (e.g. adding `//# debugId=...` and writing adjusted source maps) is performed and no temp folder is used.
350
- *
351
- * @param buildArtifactPaths - The paths of the build artifacts to upload
352
- * @param opts - Optional flags to control temp folder usage and preparation
353
- */
354
- async uploadSourcemaps(buildArtifactPaths, opts) {
355
- const staging = opts?.staging;
356
- if (!canUploadSourceMaps(options, logger, isDevMode)) {
357
- await staging?.discard();
358
- return { uploaded: false };
359
- }
360
- const assets = options.sourcemaps?.assets;
361
- let uploaded = false;
362
- await startSpan(
363
- // This is `forceTransaction`ed because this span is used in dashboards in the form of indexed transactions.
364
- // oxlint-disable-next-line typescript/no-deprecated
365
- { name: "debug-id-sourcemap-upload", scope: sentryScope, forceTransaction: true },
366
- async () => {
367
- const shouldPrepare = opts?.prepareArtifacts ?? true;
368
- let folderToCleanUp = staging?.dir;
369
- const freeUploadDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
370
- try {
371
- if (!shouldPrepare) {
372
- let pathsToUpload;
373
- if (assets) {
374
- pathsToUpload = Array.isArray(assets) ? assets : [assets];
375
- logger.debug(
376
- `Direct upload mode: passing user-provided assets directly to CLI: ${pathsToUpload.join(", ")}`
377
- );
378
- } else {
379
- pathsToUpload = buildArtifactPaths;
380
- }
381
- if (staging && staging.count > 0) {
382
- pathsToUpload = [...pathsToUpload, staging.dir];
383
- }
384
- if (pathsToUpload.length === 0) {
385
- logger.warn(
386
- "Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option."
387
- );
388
- return;
389
- }
390
- await startSpan({ name: "upload", scope: sentryScope }, async () => {
391
- const cliInstance = new SentryCliAdapter(options);
392
- await cliInstance.uploadSourcemaps(
393
- options.release.name ?? "undefined",
394
- pathsToUpload.map((directory) => ({
395
- directory,
396
- dist: options.release.dist,
397
- ignore: options.sourcemaps?.ignore
398
- }))
399
- );
400
- });
401
- uploaded = true;
402
- logger.info("Successfully uploaded source maps to Sentry");
403
- } else {
404
- let globAssets;
405
- if (assets) {
406
- globAssets = assets;
407
- } else {
408
- logger.debug(
409
- "No `sourcemaps.assets` option provided, falling back to uploading detected build artifacts."
410
- );
411
- globAssets = buildArtifactPaths.map((asset) => escape(asset.split(path.sep).join("/")));
412
- }
413
- const globResult = await startSpan(
414
- { name: "glob", scope: sentryScope },
415
- async () => globFiles(globAssets, { ignore: options.sourcemaps?.ignore })
416
- );
417
- const debugIdChunkFilePaths = globResult.filter((debugIdChunkFilePath) => {
418
- const filePath = stripQueryAndHashFromPath(debugIdChunkFilePath);
419
- return !!filePath.match(/\.(js|mjs|cjs)$/) && !staging?.stagedChunkPaths.has(path.resolve(filePath));
420
- });
421
- debugIdChunkFilePaths.sort();
422
- const stagedCount = staging?.count ?? 0;
423
- if (debugIdChunkFilePaths.length === 0 && stagedCount === 0) {
424
- logger.warn(
425
- "Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option."
426
- );
427
- } else {
428
- const tmpUploadFolder = staging?.dir ?? await startSpan({ name: "mkdtemp", scope: sentryScope }, () => createTempUploadFolder());
429
- folderToCleanUp = tmpUploadFolder;
430
- await startSpan({ name: "prepare-bundles", scope: sentryScope }, async (prepBundlesSpan) => {
431
- const preparationTasks = debugIdChunkFilePaths.map((chunkFilePath, chunkIndex) => async () => {
432
- await prepareBundleForDebugIdUpload(
433
- chunkFilePath,
434
- tmpUploadFolder,
435
- stagedCount + chunkIndex,
436
- logger,
437
- options.sourcemaps?.rewriteSources ?? defaultRewriteSourcesHook,
438
- options.sourcemaps?.resolveSourceMap
439
- );
440
- });
441
- const workers = [];
442
- const worker = async () => {
443
- while (preparationTasks.length > 0) {
444
- const task = preparationTasks.shift();
445
- if (task) {
446
- await task();
447
- }
448
- }
449
- };
450
- for (let workerIndex = 0; workerIndex < 16; workerIndex++) {
451
- workers.push(worker());
452
- }
453
- await Promise.all(workers);
454
- const files = await fs.promises.readdir(tmpUploadFolder);
455
- const stats = files.map((file) => fs.promises.stat(path.join(tmpUploadFolder, file)));
456
- const uploadSize = (await Promise.all(stats)).reduce(
457
- (accumulator, { size }) => accumulator + size,
458
- 0
459
- );
460
- setMeasurement("files", files.length, "none", prepBundlesSpan);
461
- setMeasurement("upload_size", uploadSize, "byte", prepBundlesSpan);
462
- if (files.length === 0) {
463
- logger.warn(
464
- `No source maps found for any of the ${debugIdChunkFilePaths.length + stagedCount} matched build artifacts, so no source maps were uploaded to Sentry. This usually means source map generation is not enabled in your bundler. Enable it so Sentry can un-minify your stack traces.`
465
- );
466
- return;
467
- }
468
- await startSpan({ name: "upload", scope: sentryScope }, async () => {
469
- const cliInstance = new SentryCliAdapter(options);
470
- await cliInstance.uploadSourcemaps(options.release.name ?? "undefined", [
471
- {
472
- directory: tmpUploadFolder,
473
- dist: options.release.dist
474
- }
475
- ]);
476
- });
477
- uploaded = true;
478
- logger.info("Successfully uploaded source maps to Sentry");
479
- });
480
- }
481
- }
482
- } catch (e) {
483
- if (staging && folderToCleanUp) {
484
- await staging.keep("Source map upload failed.");
485
- folderToCleanUp = void 0;
486
- }
487
- sentryScope.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
488
- handleRecoverableError(e, false);
489
- } finally {
490
- if (folderToCleanUp && !process.env?.["SENTRY_TEST_OVERRIDE_TEMP_DIR"]) {
491
- logger.debug("Cleaning up temporary files...");
492
- try {
493
- await startSpan({ name: "cleanup", scope: sentryScope }, async () => {
494
- if (folderToCleanUp) {
495
- await fs.promises.rm(folderToCleanUp, { recursive: true, force: true });
496
- logger.debug(`Temporary folder deleted: ${folderToCleanUp}`);
497
- }
498
- });
499
- } catch (e) {
500
- logger.debug("Failed to clean up temporary folder:", e);
501
- }
502
- }
503
- logger.debug("Freeing upload dependencies...");
504
- freeUploadDependencyOnBuildArtifacts();
505
- logger.debug("Flushing telemetry data...");
506
- await safeFlushTelemetry(sentryClient);
507
- logger.debug("Telemetry flushed. Plugin upload process complete.");
508
- }
509
- }
510
- );
511
- return { uploaded };
512
- },
513
- async createUploadStaging() {
514
- const dir = await createTempUploadFolder();
515
- const rewriteSourcesHook = options.sourcemaps?.rewriteSources ?? defaultRewriteSourcesHook;
516
- let count = 0;
517
- let discarded = false;
518
- const stagedChunkPaths = /* @__PURE__ */ new Set();
519
- const discard = async () => {
520
- if (discarded) {
521
- return;
522
- }
523
- discarded = true;
524
- if (process.env["SENTRY_TEST_OVERRIDE_TEMP_DIR"]) {
525
- return;
526
- }
527
- try {
528
- await fs.promises.rm(dir, { recursive: true, force: true });
529
- } catch (e) {
530
- logger.debug(`Failed to remove staging folder ${dir}:`, e);
531
- }
532
- };
533
- return {
534
- dir,
535
- get count() {
536
- return count;
537
- },
538
- stagedChunkPaths,
539
- async stage(input) {
540
- const result = prepareArtifactForUpload({
541
- code: input.code,
542
- mapSource: input.mapSource,
543
- mapDir: input.mapDir,
544
- rewriteSourcesHook
545
- });
546
- if (!result.ok) {
547
- logger.debug(`Not staging ${input.fileName} for upload: ${result.reason}`);
548
- return "skipped";
549
- }
550
- const index = count++;
551
- try {
552
- await writePreparedArtifact(dir, `${result.artifact.debugId}-${index}`, result.artifact);
553
- stagedChunkPaths.add(path.resolve(input.mapDir, path.basename(input.fileName)));
554
- return "staged";
555
- } catch (e) {
556
- sentryScope.captureException("Error staging build artifact for upload");
557
- handleRecoverableError(e, true);
558
- return "failed";
559
- }
560
- },
561
- discard,
562
- async keep(reason) {
563
- if (count === 0) {
564
- await discard();
565
- return;
566
- }
567
- if (discarded) {
568
- return;
569
- }
570
- discarded = true;
571
- logger.error(
572
- `${reason} The source maps were kept in ${dir}. Upload them with \`sentry sourcemap upload ${dir}\`.`
573
- );
574
- }
575
- };
576
- },
577
- sourceMaps: {
578
- uploadPossible: sourceMapUploadPossible,
579
- decide(kind) {
580
- const decision = decideSourceMapHandling(kind, options, sourceMapUploadPossible);
581
- if (decision.log && !loggedSourceMapMessages.has(decision.log.message)) {
582
- loggedSourceMapMessages.add(decision.log.message);
583
- logger[decision.log.level](decision.log.message);
584
- }
585
- return decision;
586
- }
587
- },
588
- /**
589
- * Will delete artifacts based on the passed `sourcemaps.filesToDeleteAfterUpload` option.
590
- */
591
- async deleteArtifacts() {
592
- try {
593
- const filesToDelete = await options.sourcemaps?.filesToDeleteAfterUpload;
594
- if (filesToDelete !== void 0) {
595
- const filePathsToDelete = await globFiles(filesToDelete);
596
- logger.debug("Waiting for dependencies on generated files to be freed before deleting...");
597
- await waitUntilBuildArtifactDependenciesAreFreed();
598
- filePathsToDelete.forEach((filePathToDelete) => {
599
- logger.debug(`Deleting asset after upload: ${filePathToDelete}`);
600
- });
601
- await Promise.all(
602
- filePathsToDelete.map(
603
- (filePathToDelete) => fs.promises.rm(filePathToDelete, { force: true }).catch((e) => {
604
- logger.debug(`An error occurred while attempting to delete asset: ${filePathToDelete}`, e);
605
- })
606
- )
607
- );
608
- }
609
- } catch (e) {
610
- sentryScope.captureException('Error in "sentry-file-deletion-plugin" buildEnd hook');
611
- await safeFlushTelemetry(sentryClient);
612
- handleRecoverableError(e, true);
613
- }
614
- },
615
- createDependencyOnBuildArtifacts
616
- };
25
+ const logger = createLogger({
26
+ prefix: bundlerPluginMetaContext.loggerPrefix,
27
+ silent: userOptions.silent ?? false,
28
+ debug: userOptions.debug ?? false
29
+ });
30
+ try {
31
+ const dotenvFile = fs.readFileSync(path.join(process.cwd(), ".env.sentry-build-plugin"), "utf-8");
32
+ const dotenvResult = dotenv.parse(dotenvFile);
33
+ Object.assign(process.env, dotenvResult);
34
+ logger.info("Using environment variables configured in \".env.sentry-build-plugin\".");
35
+ } catch (e) {
36
+ if (typeof e === "object" && e && "code" in e && e.code !== "ENOENT") throw e;
37
+ }
38
+ const options = normalizeUserOptions(userOptions);
39
+ if (options.disable) return {
40
+ normalizedOptions: options,
41
+ logger,
42
+ bundleSizeOptimizationReplacementValues: {},
43
+ telemetry: { emitBundlerPluginExecutionSignal: async () => {} },
44
+ bundleMetadata: {},
45
+ createRelease: async () => {},
46
+ uploadSourcemaps: async () => ({
47
+ uploaded: false,
48
+ uploadedSourceMapPaths: []
49
+ }),
50
+ createUploadStaging: async () => ({
51
+ dir: "",
52
+ count: 0,
53
+ stagedChunkPaths: /* @__PURE__ */ new Set(),
54
+ stage: async () => "skipped",
55
+ discard: async () => {},
56
+ keep: async () => {}
57
+ }),
58
+ sourceMaps: {
59
+ uploadPossible: false,
60
+ decide: () => ({
61
+ enableHidden: false,
62
+ deleteAfterUpload: false
63
+ }),
64
+ logDecision: () => void 0,
65
+ shouldUpload: () => false,
66
+ deleteFromOutput: async () => {}
67
+ },
68
+ deleteArtifacts: async () => {},
69
+ createDependencyOnBuildArtifacts: () => () => {},
70
+ injectDebugIds: async () => {}
71
+ };
72
+ const shouldSendTelemetry = allowedToSendTelemetry(options);
73
+ const { sentryScope, sentryClient } = createSentryInstance(options, shouldSendTelemetry, bundlerPluginMetaContext.buildTool, bundlerPluginMetaContext.buildToolMajorVersion);
74
+ const { release, environment = DEFAULT_ENVIRONMENT } = sentryClient.getOptions();
75
+ const sentrySession = makeSession({
76
+ release,
77
+ environment
78
+ });
79
+ sentryScope.setSession(sentrySession);
80
+ sentryClient.captureSession(sentrySession);
81
+ let sessionHasEnded = false;
82
+ function endSession() {
83
+ if (sessionHasEnded) return;
84
+ closeSession(sentrySession);
85
+ sentryClient.captureSession(sentrySession);
86
+ sessionHasEnded = true;
87
+ }
88
+ process.on("beforeExit", () => {
89
+ endSession();
90
+ });
91
+ process.env["SENTRY_PIPELINE"] = `${bundlerPluginMetaContext.buildTool}-plugin/${LIB_VERSION}`;
92
+ if (options.debug && !process.env["SENTRY_LOG_LEVEL"]) process.env["SENTRY_LOG_LEVEL"] = "debug";
93
+ const isDevMode = process.env.NODE_ENV === "development";
94
+ /**
95
+ * Handles errors caught and emitted in various areas of the plugin.
96
+ *
97
+ * Also sets the sentry session status according to the error handling.
98
+ *
99
+ * If users specify their custom `errorHandler` we'll leave the decision to throw
100
+ * or continue up to them. By default, @param throwByDefault controls if the plugin
101
+ * should throw an error (which causes a build fail in most bundlers) or continue.
102
+ */
103
+ function handleRecoverableError(unknownError, throwByDefault) {
104
+ sentrySession.status = "abnormal";
105
+ try {
106
+ if (options.errorHandler) try {
107
+ if (unknownError instanceof Error) options.errorHandler(unknownError);
108
+ else options.errorHandler(/* @__PURE__ */ new Error("An unknown error occurred"));
109
+ } catch (e) {
110
+ sentrySession.status = "crashed";
111
+ throw e;
112
+ }
113
+ else {
114
+ sentrySession.status = "crashed";
115
+ if (throwByDefault) throw unknownError;
116
+ logger.error("An error occurred. Couldn't finish all operations:", unknownError);
117
+ }
118
+ } finally {
119
+ endSession();
120
+ }
121
+ }
122
+ if (!validateOptions(options, logger)) handleRecoverableError(/* @__PURE__ */ new Error("Options were not set correctly. See output above for more details."), true);
123
+ const dependenciesOnBuildArtifacts = /* @__PURE__ */ new Set();
124
+ const buildArtifactsDependencySubscribers = [];
125
+ function notifyBuildArtifactDependencySubscribers() {
126
+ buildArtifactsDependencySubscribers.forEach((subscriber) => {
127
+ subscriber();
128
+ });
129
+ }
130
+ function createDependencyOnBuildArtifacts() {
131
+ const dependencyIdentifier = Symbol();
132
+ dependenciesOnBuildArtifacts.add(dependencyIdentifier);
133
+ return function freeDependencyOnBuildArtifacts() {
134
+ dependenciesOnBuildArtifacts.delete(dependencyIdentifier);
135
+ notifyBuildArtifactDependencySubscribers();
136
+ };
137
+ }
138
+ const sourceMapUploadPossible = getSourceMapUploadBlocker(options, isDevMode) === void 0;
139
+ const loggedSourceMapMessages = /* @__PURE__ */ new Set();
140
+ const shouldUpload = createUploadFilter(options);
141
+ function logDecision(decision) {
142
+ if (decision.log && !loggedSourceMapMessages.has(decision.log.message)) {
143
+ loggedSourceMapMessages.add(decision.log.message);
144
+ logger[decision.log.level](decision.log.message);
145
+ }
146
+ }
147
+ /**
148
+ * Returns a Promise that resolves when all the currently active dependencies are freed again.
149
+ *
150
+ * It is very important that this function is called as late as possible before wanting to await the Promise to give
151
+ * the dependency producers as much time as possible to register themselves.
152
+ */
153
+ function waitUntilBuildArtifactDependenciesAreFreed() {
154
+ return new Promise((resolve) => {
155
+ buildArtifactsDependencySubscribers.push(() => {
156
+ if (dependenciesOnBuildArtifacts.size === 0) resolve();
157
+ });
158
+ if (dependenciesOnBuildArtifacts.size === 0) resolve();
159
+ });
160
+ }
161
+ const bundleSizeOptimizationReplacementValues = {};
162
+ if (options.bundleSizeOptimizations) {
163
+ const { bundleSizeOptimizations } = options;
164
+ if (bundleSizeOptimizations.excludeDebugStatements) bundleSizeOptimizationReplacementValues["__SENTRY_DEBUG__"] = false;
165
+ if (bundleSizeOptimizations.excludeTracing) bundleSizeOptimizationReplacementValues["__SENTRY_TRACING__"] = false;
166
+ if (bundleSizeOptimizations.excludeChannelInjection) bundleSizeOptimizationReplacementValues["__SENTRY_CHANNEL_INJECTION__"] = false;
167
+ if (bundleSizeOptimizations.excludeReplayCanvas) bundleSizeOptimizationReplacementValues["__RRWEB_EXCLUDE_CANVAS__"] = true;
168
+ if (bundleSizeOptimizations.excludeReplayIframe) bundleSizeOptimizationReplacementValues["__RRWEB_EXCLUDE_IFRAME__"] = true;
169
+ if (bundleSizeOptimizations.excludeReplayShadowDom) bundleSizeOptimizationReplacementValues["__RRWEB_EXCLUDE_SHADOW_DOM__"] = true;
170
+ if (bundleSizeOptimizations.excludeReplayWorker) bundleSizeOptimizationReplacementValues["__SENTRY_EXCLUDE_REPLAY_WORKER__"] = true;
171
+ }
172
+ let bundleMetadata = {};
173
+ if (options.moduleMetadata || options.applicationKey) {
174
+ if (options.applicationKey) bundleMetadata[`_sentryBundlerPluginAppKey:${options.applicationKey}`] = true;
175
+ if (typeof options.moduleMetadata === "function") {
176
+ const args = {
177
+ org: options.org,
178
+ project: getProjects(options.project)?.[0],
179
+ projects: getProjects(options.project),
180
+ release: options.release.name
181
+ };
182
+ bundleMetadata = {
183
+ ...bundleMetadata,
184
+ ...options.moduleMetadata(args)
185
+ };
186
+ } else bundleMetadata = {
187
+ ...bundleMetadata,
188
+ ...options.moduleMetadata
189
+ };
190
+ }
191
+ return {
192
+ /**
193
+ * A logger instance that takes the options passed to the build plugin manager into account. (for silencing and log level etc.)
194
+ */
195
+ logger,
196
+ /**
197
+ * Options after normalization. Includes things like the inferred release name.
198
+ */
199
+ normalizedOptions: options,
200
+ /**
201
+ * Magic strings and their replacement values that can be used for bundle size optimizations. This already takes
202
+ * into account the options passed to the build plugin manager.
203
+ */
204
+ bundleSizeOptimizationReplacementValues,
205
+ /**
206
+ * Metadata that should be injected into bundles if possible. Takes into account options passed to the build plugin manager.
207
+ */
208
+ bundleMetadata,
209
+ /**
210
+ * Contains utility functions for emitting telemetry via the build plugin manager.
211
+ */
212
+ telemetry: {
213
+ /**
214
+ * Emits a `Sentry Bundler Plugin execution` signal.
215
+ */
216
+ async emitBundlerPluginExecutionSignal() {
217
+ if (await shouldSendTelemetry) {
218
+ logger.info("Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.");
219
+ startSpan({
220
+ name: "Sentry Bundler Plugin execution",
221
+ scope: sentryScope
222
+ }, () => {});
223
+ await safeFlushTelemetry(sentryClient);
224
+ }
225
+ } },
226
+ /**
227
+ * Will potentially create a release based on the build plugin manager options.
228
+ *
229
+ * Also
230
+ * - finalizes the release
231
+ * - sets commits
232
+ * - uploads legacy sourcemaps
233
+ * - adds deploy information
234
+ */
235
+ async createRelease() {
236
+ if (!options.release.name) {
237
+ logger.debug("No release name provided. Will not create release. Please set the `release.name` option to identify your release.");
238
+ return;
239
+ } else if (isDevMode) {
240
+ logger.debug("Running in development mode. Will not create release.");
241
+ return;
242
+ } else if (!options.authToken) {
243
+ logger.warn(`No auth token provided. Will not create release. Please set the \`authToken\` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/${getTurborepoEnvPassthroughWarning("SENTRY_AUTH_TOKEN")}`);
244
+ return;
245
+ } else if (!options.org && !options.authToken.startsWith("sntrys_")) {
246
+ logger.warn(`No organization slug provided. Will not create release. Please set the \`org\` option to your Sentry organization slug.${getTurborepoEnvPassthroughWarning("SENTRY_ORG")}`);
247
+ return;
248
+ } else if (!options.project || Array.isArray(options.project) && options.project.length === 0) {
249
+ logger.warn(`No project provided. Will not create release. Please set the \`project\` option to your Sentry project slug.${getTurborepoEnvPassthroughWarning("SENTRY_PROJECT")}`);
250
+ return;
251
+ }
252
+ const freeWriteBundleInvocationDependencyOnSourcemapFiles = createDependencyOnBuildArtifacts();
253
+ const releaseName = options.release.name;
254
+ try {
255
+ const cliInstance = new SentryCliAdapter(options);
256
+ if (options.release.create) {
257
+ const releaseOutput = await cliInstance.createRelease(releaseName);
258
+ logger.debug("Release created:", releaseOutput);
259
+ }
260
+ if (options.release.uploadLegacySourcemaps) {
261
+ const uploadTargets = arrayify(options.release.uploadLegacySourcemaps).map((includeItem) => typeof includeItem === "string" ? { paths: [includeItem] } : includeItem).flatMap((includeEntry) => includeEntry.paths.map((directory) => ({
262
+ directory,
263
+ dist: options.release.dist,
264
+ ext: includeEntry.ext ? includeEntry.ext.map((extension) => `.${extension.replace(/^\./, "")}`) : [
265
+ ".js",
266
+ ".map",
267
+ ".jsbundle",
268
+ ".bundle"
269
+ ],
270
+ ignore: includeEntry.ignore ? arrayify(includeEntry.ignore) : includeEntry.ignoreFile ? void 0 : ["node_modules"],
271
+ ignoreFile: includeEntry.ignoreFile,
272
+ urlPrefix: includeEntry.urlPrefix
273
+ })));
274
+ warnAboutDirectoriesWithoutSourcemaps(logger, await cliInstance.uploadSourcemaps(releaseName, uploadTargets));
275
+ }
276
+ if (options.release.setCommits !== false) try {
277
+ await cliInstance.setCommits(releaseName, options.release.setCommits);
278
+ } catch (e) {
279
+ if (options.release.setCommits && "shouldNotThrowOnFailure" in options.release.setCommits && options.release.setCommits.shouldNotThrowOnFailure) logger.debug("An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):", e);
280
+ else throw e;
281
+ }
282
+ if (options.release.finalize) await cliInstance.finalizeRelease(releaseName);
283
+ if (options.release.deploy && !_deployedReleases.has(releaseName)) {
284
+ await cliInstance.newDeploy(releaseName, options.release.deploy);
285
+ _deployedReleases.add(releaseName);
286
+ }
287
+ } catch (e) {
288
+ sentryScope.captureException("Error in \"releaseManagementPlugin\" writeBundle hook");
289
+ await safeFlushTelemetry(sentryClient);
290
+ handleRecoverableError(e, false);
291
+ } finally {
292
+ freeWriteBundleInvocationDependencyOnSourcemapFiles();
293
+ }
294
+ },
295
+ async injectDebugIds(buildArtifactPaths) {
296
+ await startSpan({
297
+ name: "inject-debug-ids",
298
+ scope: sentryScope,
299
+ forceTransaction: true
300
+ }, async () => {
301
+ try {
302
+ await new SentryCliAdapter(options).injectDebugIds(buildArtifactPaths, options.sourcemaps?.ignore);
303
+ } catch (e) {
304
+ sentryScope.captureException("Error in \"debugIdInjectionPlugin\" writeBundle hook");
305
+ handleRecoverableError(e, false);
306
+ } finally {
307
+ await safeFlushTelemetry(sentryClient);
308
+ }
309
+ });
310
+ },
311
+ /**
312
+ * Uploads sourcemaps using the "Debug ID" method.
313
+ *
314
+ * By default, this prepares bundles in a temporary folder before uploading. You can opt into an
315
+ * in-place, direct upload path by setting `prepareArtifacts` to `false`. If `prepareArtifacts` is set to
316
+ * `false`, no preparation (e.g. adding `//# debugId=...` and writing adjusted source maps) is performed and no temp folder is used.
317
+ *
318
+ * @param buildArtifactPaths - The paths of the build artifacts to upload
319
+ * @param opts - Optional flags to control temp folder usage and preparation
320
+ */
321
+ async uploadSourcemaps(buildArtifactPaths, opts) {
322
+ const staging = opts?.staging;
323
+ if (!canUploadSourceMaps(options, logger, isDevMode)) {
324
+ await staging?.discard();
325
+ return {
326
+ uploaded: false,
327
+ uploadedSourceMapPaths: []
328
+ };
329
+ }
330
+ const assets = options.sourcemaps?.assets;
331
+ let uploaded = false;
332
+ const preparedSourceMapPaths = [];
333
+ await startSpan({
334
+ name: "debug-id-sourcemap-upload",
335
+ scope: sentryScope,
336
+ forceTransaction: true
337
+ }, async () => {
338
+ const shouldPrepare = opts?.prepareArtifacts ?? true;
339
+ let folderToCleanUp = staging?.dir;
340
+ const freeUploadDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
341
+ try {
342
+ if (!shouldPrepare) {
343
+ let pathsToUpload;
344
+ if (assets) {
345
+ pathsToUpload = Array.isArray(assets) ? assets : [assets];
346
+ logger.debug(`Direct upload mode: passing user-provided assets directly to CLI: ${pathsToUpload.join(", ")}`);
347
+ } else pathsToUpload = buildArtifactPaths;
348
+ if (staging && staging.count > 0) pathsToUpload = [...pathsToUpload, staging.dir];
349
+ if (pathsToUpload.length === 0) {
350
+ logger.warn("Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.");
351
+ return;
352
+ }
353
+ const emptyDirectories = await startSpan({
354
+ name: "upload",
355
+ scope: sentryScope
356
+ }, async () => {
357
+ return new SentryCliAdapter(options).uploadSourcemaps(options.release.name ?? "undefined", pathsToUpload.map((directory) => ({
358
+ directory,
359
+ dist: options.release.dist,
360
+ ignore: options.sourcemaps?.ignore
361
+ })));
362
+ });
363
+ warnAboutDirectoriesWithoutSourcemaps(logger, emptyDirectories);
364
+ if (emptyDirectories.length < pathsToUpload.length) {
365
+ uploaded = true;
366
+ logger.info("Successfully uploaded source maps to Sentry");
367
+ }
368
+ } else {
369
+ let globAssets;
370
+ if (assets) globAssets = assets;
371
+ else {
372
+ logger.debug("No `sourcemaps.assets` option provided, falling back to uploading detected build artifacts.");
373
+ globAssets = buildArtifactPaths.map((asset) => escape(asset.split(path.sep).join("/")));
374
+ }
375
+ const debugIdChunkFilePaths = (await startSpan({
376
+ name: "glob",
377
+ scope: sentryScope
378
+ }, async () => globFiles(globAssets, { ignore: options.sourcemaps?.ignore }))).filter((debugIdChunkFilePath) => {
379
+ const filePath = stripQueryAndHashFromPath(debugIdChunkFilePath);
380
+ return !!filePath.match(/\.(js|mjs|cjs)$/) && !staging?.stagedChunkPaths.has(path.resolve(filePath));
381
+ });
382
+ debugIdChunkFilePaths.sort();
383
+ const stagedCount = staging?.count ?? 0;
384
+ if (debugIdChunkFilePaths.length === 0 && stagedCount === 0) logger.warn("Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.");
385
+ else {
386
+ const tmpUploadFolder = staging?.dir ?? await startSpan({
387
+ name: "mkdtemp",
388
+ scope: sentryScope
389
+ }, () => createTempUploadFolder());
390
+ folderToCleanUp = tmpUploadFolder;
391
+ await startSpan({
392
+ name: "prepare-bundles",
393
+ scope: sentryScope
394
+ }, async (prepBundlesSpan) => {
395
+ const preparationTasks = debugIdChunkFilePaths.map((chunkFilePath, chunkIndex) => async () => {
396
+ const prepared = await prepareBundleForDebugIdUpload(chunkFilePath, tmpUploadFolder, stagedCount + chunkIndex, logger, options.sourcemaps?.rewriteSources ?? defaultRewriteSourcesHook, options.sourcemaps?.resolveSourceMap);
397
+ if (prepared?.sourceMapPath !== void 0) preparedSourceMapPaths.push(prepared.sourceMapPath);
398
+ });
399
+ const workers = [];
400
+ const worker = async () => {
401
+ while (preparationTasks.length > 0) {
402
+ const task = preparationTasks.shift();
403
+ if (task) await task();
404
+ }
405
+ };
406
+ for (let workerIndex = 0; workerIndex < 16; workerIndex++) workers.push(worker());
407
+ await Promise.all(workers);
408
+ const files = await fs.promises.readdir(tmpUploadFolder);
409
+ const stats = files.map((file) => fs.promises.stat(path.join(tmpUploadFolder, file)));
410
+ const uploadSize = (await Promise.all(stats)).reduce((accumulator, { size }) => accumulator + size, 0);
411
+ setMeasurement("files", files.length, "none", prepBundlesSpan);
412
+ setMeasurement("upload_size", uploadSize, "byte", prepBundlesSpan);
413
+ if (files.length === 0) {
414
+ logger.warn(`No source maps found for any of the ${debugIdChunkFilePaths.length + stagedCount} matched build artifacts, so no source maps were uploaded to Sentry. This usually means source map generation is not enabled in your bundler. Enable it so Sentry can un-minify your stack traces.`);
415
+ return;
416
+ }
417
+ await startSpan({
418
+ name: "upload",
419
+ scope: sentryScope
420
+ }, async () => {
421
+ await new SentryCliAdapter(options).uploadSourcemaps(options.release.name ?? "undefined", [{
422
+ directory: tmpUploadFolder,
423
+ dist: options.release.dist
424
+ }]);
425
+ });
426
+ uploaded = true;
427
+ logger.info("Successfully uploaded source maps to Sentry");
428
+ });
429
+ }
430
+ }
431
+ } catch (e) {
432
+ if (staging && folderToCleanUp) {
433
+ await staging.keep("Source map upload failed.");
434
+ folderToCleanUp = void 0;
435
+ }
436
+ sentryScope.captureException("Error in \"debugIdUploadPlugin\" writeBundle hook");
437
+ handleRecoverableError(e, false);
438
+ } finally {
439
+ if (folderToCleanUp && !process.env?.["SENTRY_TEST_OVERRIDE_TEMP_DIR"]) {
440
+ logger.debug("Cleaning up temporary files...");
441
+ try {
442
+ await startSpan({
443
+ name: "cleanup",
444
+ scope: sentryScope
445
+ }, async () => {
446
+ if (folderToCleanUp) {
447
+ await fs.promises.rm(folderToCleanUp, {
448
+ recursive: true,
449
+ force: true
450
+ });
451
+ logger.debug(`Temporary folder deleted: ${folderToCleanUp}`);
452
+ }
453
+ });
454
+ } catch (e) {
455
+ logger.debug("Failed to clean up temporary folder:", e);
456
+ }
457
+ }
458
+ logger.debug("Freeing upload dependencies...");
459
+ freeUploadDependencyOnBuildArtifacts();
460
+ logger.debug("Flushing telemetry data...");
461
+ await safeFlushTelemetry(sentryClient);
462
+ logger.debug("Telemetry flushed. Plugin upload process complete.");
463
+ }
464
+ });
465
+ return {
466
+ uploaded,
467
+ uploadedSourceMapPaths: uploaded ? preparedSourceMapPaths.sort() : []
468
+ };
469
+ },
470
+ async createUploadStaging() {
471
+ const dir = await createTempUploadFolder();
472
+ const rewriteSourcesHook = options.sourcemaps?.rewriteSources ?? defaultRewriteSourcesHook;
473
+ let count = 0;
474
+ let discarded = false;
475
+ const stagedChunkPaths = /* @__PURE__ */ new Set();
476
+ const discard = async () => {
477
+ if (discarded) return;
478
+ discarded = true;
479
+ if (process.env["SENTRY_TEST_OVERRIDE_TEMP_DIR"]) return;
480
+ try {
481
+ await fs.promises.rm(dir, {
482
+ recursive: true,
483
+ force: true
484
+ });
485
+ } catch (e) {
486
+ logger.debug(`Failed to remove staging folder ${dir}:`, e);
487
+ }
488
+ };
489
+ return {
490
+ dir,
491
+ get count() {
492
+ return count;
493
+ },
494
+ stagedChunkPaths,
495
+ async stage(input) {
496
+ const chunkPath = path.resolve(input.chunkPath);
497
+ const chunkName = path.basename(chunkPath);
498
+ if (!shouldUpload(chunkPath)) {
499
+ logger.debug(`Not staging ${chunkName} for upload: excluded by \`sourcemaps.assets\` or \`sourcemaps.ignore\`.`);
500
+ return "excluded";
501
+ }
502
+ const result = prepareArtifactForUpload({
503
+ code: input.code,
504
+ mapSource: input.mapSource,
505
+ mapDir: input.mapDir,
506
+ rewriteSourcesHook
507
+ });
508
+ if (!result.ok) {
509
+ logger.debug(`Not staging ${chunkName} for upload: ${result.reason}`);
510
+ return "skipped";
511
+ }
512
+ const index = count++;
513
+ try {
514
+ await writePreparedArtifact(dir, `${result.artifact.debugId}-${index}`, result.artifact);
515
+ stagedChunkPaths.add(chunkPath);
516
+ return "staged";
517
+ } catch (e) {
518
+ sentryScope.captureException("Error staging build artifact for upload");
519
+ handleRecoverableError(e, true);
520
+ return "failed";
521
+ }
522
+ },
523
+ discard,
524
+ async keep(reason) {
525
+ if (count === 0) {
526
+ await discard();
527
+ return;
528
+ }
529
+ if (discarded) return;
530
+ discarded = true;
531
+ logger.error(`${reason} The source maps were kept in ${dir}. Upload them with \`sentry sourcemap upload ${dir}\`.`);
532
+ }
533
+ };
534
+ },
535
+ sourceMaps: {
536
+ uploadPossible: sourceMapUploadPossible,
537
+ decide(kind, { log = true, environment } = {}) {
538
+ const decision = isDevMode ? {
539
+ enableHidden: false,
540
+ deleteAfterUpload: false
541
+ } : decideSourceMapHandling(kind, options, sourceMapUploadPossible, environment);
542
+ if (log) logDecision(decision);
543
+ return decision;
544
+ },
545
+ logDecision,
546
+ shouldUpload,
547
+ async deleteFromOutput(sourceMapPaths) {
548
+ try {
549
+ await Promise.all(sourceMapPaths.map(async (sourceMapPath) => {
550
+ try {
551
+ await fs.promises.rm(sourceMapPath, { force: true });
552
+ } catch (e) {
553
+ logger.error(`Could not delete source map ${sourceMapPath} from the build output.`);
554
+ throw e;
555
+ }
556
+ }));
557
+ } catch (e) {
558
+ sentryScope.captureException("Error deleting source maps after upload");
559
+ await safeFlushTelemetry(sentryClient);
560
+ handleRecoverableError(e, true);
561
+ }
562
+ }
563
+ },
564
+ /**
565
+ * Will delete artifacts based on the passed `sourcemaps.filesToDeleteAfterUpload` option.
566
+ */
567
+ async deleteArtifacts() {
568
+ try {
569
+ const filesToDelete = await options.sourcemaps?.filesToDeleteAfterUpload;
570
+ if (filesToDelete !== void 0) {
571
+ const filePathsToDelete = await globFiles(filesToDelete);
572
+ logger.debug("Waiting for dependencies on generated files to be freed before deleting...");
573
+ await waitUntilBuildArtifactDependenciesAreFreed();
574
+ filePathsToDelete.forEach((filePathToDelete) => {
575
+ logger.debug(`Deleting asset after upload: ${filePathToDelete}`);
576
+ });
577
+ await Promise.all(filePathsToDelete.map((filePathToDelete) => fs.promises.rm(filePathToDelete, { force: true }).catch((e) => {
578
+ logger.debug(`An error occurred while attempting to delete asset: ${filePathToDelete}`, e);
579
+ })));
580
+ }
581
+ } catch (e) {
582
+ sentryScope.captureException("Error in \"sentry-file-deletion-plugin\" buildEnd hook");
583
+ await safeFlushTelemetry(sentryClient);
584
+ handleRecoverableError(e, true);
585
+ }
586
+ },
587
+ createDependencyOnBuildArtifacts
588
+ };
617
589
  }
618
590
  async function createTempUploadFolder() {
619
- return process.env["SENTRY_TEST_OVERRIDE_TEMP_DIR"] || await fs.promises.mkdtemp(path.join(os.tmpdir(), "sentry-bundler-plugin-upload-"));
591
+ return process.env["SENTRY_TEST_OVERRIDE_TEMP_DIR"] || await fs.promises.mkdtemp(path.join(os.tmpdir(), "sentry-bundler-plugin-upload-"));
620
592
  }
621
593
  function getSourceMapUploadBlocker(options, isDevMode) {
622
- if (options.sourcemaps?.disable) {
623
- return "disabled";
624
- }
625
- if (Array.isArray(options.sourcemaps?.assets) && options.sourcemaps.assets.length === 0) {
626
- return "no-assets";
627
- }
628
- if (isDevMode) {
629
- return "dev-mode";
630
- }
631
- if (!options.authToken) {
632
- return "no-auth-token";
633
- }
634
- if (!options.org && !options.authToken.startsWith("sntrys_")) {
635
- return "no-org";
636
- }
637
- if (!getProjects(options.project)?.[0]) {
638
- return "no-project";
639
- }
640
- return void 0;
594
+ if (options.sourcemaps?.disable) return "disabled";
595
+ if (Array.isArray(options.sourcemaps?.assets) && options.sourcemaps.assets.length === 0) return "no-assets";
596
+ if (isDevMode) return "dev-mode";
597
+ if (!options.authToken) return "no-auth-token";
598
+ if (!options.org && !options.authToken.startsWith("sntrys_")) return "no-org";
599
+ if (!getProjects(options.project)?.[0]) return "no-project";
641
600
  }
642
601
  function canUploadSourceMaps(options, logger, isDevMode) {
643
- switch (getSourceMapUploadBlocker(options, isDevMode)) {
644
- case "disabled":
645
- logger.debug("Source map upload was disabled. Will not upload sourcemaps using debug ID process.");
646
- return false;
647
- case "no-assets":
648
- logger.debug("Empty `sourcemaps.assets` option provided. Will not upload sourcemaps with debug ID.");
649
- return false;
650
- case "dev-mode":
651
- logger.debug("Running in development mode. Will not upload sourcemaps.");
652
- return false;
653
- case "no-auth-token":
654
- logger.warn(
655
- `No auth token provided. Will not upload source maps. Please set the \`authToken\` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/${getTurborepoEnvPassthroughWarning("SENTRY_AUTH_TOKEN")}`
656
- );
657
- return false;
658
- case "no-org":
659
- logger.warn(
660
- `No org provided. Will not upload source maps. Please set the \`org\` option to your Sentry organization slug.${getTurborepoEnvPassthroughWarning("SENTRY_ORG")}`
661
- );
662
- return false;
663
- case "no-project":
664
- logger.warn(
665
- `No project provided. Will not upload source maps. Please set the \`project\` option to your Sentry project slug.${getTurborepoEnvPassthroughWarning("SENTRY_PROJECT")}`
666
- );
667
- return false;
668
- default:
669
- return true;
670
- }
602
+ switch (getSourceMapUploadBlocker(options, isDevMode)) {
603
+ case "disabled":
604
+ logger.debug("Source map upload was disabled. Will not upload sourcemaps using debug ID process.");
605
+ return false;
606
+ case "no-assets":
607
+ logger.debug("Empty `sourcemaps.assets` option provided. Will not upload sourcemaps with debug ID.");
608
+ return false;
609
+ case "dev-mode":
610
+ logger.debug("Running in development mode. Will not upload sourcemaps.");
611
+ return false;
612
+ case "no-auth-token":
613
+ logger.warn(`No auth token provided. Will not upload source maps. Please set the \`authToken\` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/${getTurborepoEnvPassthroughWarning("SENTRY_AUTH_TOKEN")}`);
614
+ return false;
615
+ case "no-org":
616
+ logger.warn(`No org provided. Will not upload source maps. Please set the \`org\` option to your Sentry organization slug.${getTurborepoEnvPassthroughWarning("SENTRY_ORG")}`);
617
+ return false;
618
+ case "no-project":
619
+ logger.warn(`No project provided. Will not upload source maps. Please set the \`project\` option to your Sentry project slug.${getTurborepoEnvPassthroughWarning("SENTRY_PROJECT")}`);
620
+ return false;
621
+ default: return true;
622
+ }
623
+ }
624
+ function warnAboutDirectoriesWithoutSourcemaps(logger, directories) {
625
+ if (directories.length === 0) return;
626
+ const list = directories.map((directory) => ` - ${directory}`).join("\n");
627
+ logger.warn(`No source maps found in the following directories, so nothing was uploaded from them:\n${list}\nThis usually means source map generation is not enabled for these build outputs. Enable it so Sentry can un-minify stack traces from these files.`);
671
628
  }
672
-
673
629
  export { createSentryBuildPluginManager };
674
- //# sourceMappingURL=build-plugin-manager.js.map
630
+
631
+ //# sourceMappingURL=build-plugin-manager.js.map