@sentry/bundler-plugins 11.12.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 (184) 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 -702
  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 +41 -46
  53. package/build/cjs/core/upload-filter.js.map +1 -1
  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 -211
  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 +192 -246
  66. package/build/cjs/rollup/index.js.map +1 -1
  67. package/build/cjs/rollup/source-map-handling.js +151 -175
  68. package/build/cjs/rollup/source-map-handling.js.map +1 -1
  69. package/build/cjs/vite/index.js +19 -21
  70. package/build/cjs/vite/index.js.map +1 -1
  71. package/build/cjs/vite/source-map-hooks.js +112 -89
  72. package/build/cjs/vite/source-map-hooks.js.map +1 -1
  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 +271 -340
  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 -683
  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 +39 -30
  129. package/build/esm/core/upload-filter.js.map +1 -1
  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 -195
  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 +189 -226
  143. package/build/esm/rollup/index.js.map +1 -1
  144. package/build/esm/rollup/source-map-handling.js +149 -159
  145. package/build/esm/rollup/source-map-handling.js.map +1 -1
  146. package/build/esm/vite/index.js +19 -18
  147. package/build/esm/vite/index.js.map +1 -1
  148. package/build/esm/vite/source-map-hooks.js +109 -72
  149. package/build/esm/vite/source-map-hooks.js.map +1 -1
  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 +268 -322
  153. package/build/esm/webpack/index.js.map +1 -1
  154. package/build/types/core/build-plugin-manager.d.ts +16 -5
  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 +3 -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 +25 -1
  168. package/build/types/core/types.d.ts.map +1 -1
  169. package/build/types/core/utils.d.ts +4 -0
  170. package/build/types/core/utils.d.ts.map +1 -1
  171. package/build/types/core/version.d.ts +1 -1
  172. package/build/types/esbuild/index.d.ts +2 -2
  173. package/build/types/esbuild/index.d.ts.map +1 -1
  174. package/build/types/rollup/index.d.ts +2 -2
  175. package/build/types/rollup/index.d.ts.map +1 -1
  176. package/build/types/rollup/source-map-handling.d.ts.map +1 -1
  177. package/build/types/vite/index.d.ts +3 -3
  178. package/build/types/vite/index.d.ts.map +1 -1
  179. package/build/types/vite/source-map-hooks.d.ts.map +1 -1
  180. package/build/types/webpack/index.d.ts +7 -3
  181. package/build/types/webpack/index.d.ts.map +1 -1
  182. package/package.json +8 -15
  183. package/build/cjs/loader-utils/index.js.map +0 -1
  184. package/build/esm/loader-utils/index.js.map +0 -1
@@ -1,93 +1,116 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const path = require('node:path');
4
- const sourceMapHandling = require('../rollup/source-map-handling.js');
5
-
6
- function _interopNamespace(e) {
7
- if (e && e.__esModule) return e;
8
- const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
9
- if (e) {
10
- for (const k in e) {
11
- n[k] = e[k];
12
- }
13
- }
14
- n.default = e;
15
- return n;
16
- }
17
-
18
- const path__namespace = /*#__PURE__*/_interopNamespace(path);
19
-
20
- const NO_CHANGE = { enableHidden: false, deleteAfterUpload: false };
1
+ const require_runtime = require("../_virtual/_rolldown/runtime.js");
2
+ const require_sourcemap_settings = require("../core/sourcemap-settings.js");
3
+ require("../core/index.js");
4
+ const require_source_map_handling = require("../rollup/source-map-handling.js");
5
+ let node_path = require("node:path");
6
+ node_path = require_runtime.__toESM(node_path);
7
+ // src/vite/source-map-hooks.ts
8
+ const NO_CHANGE = {
9
+ enableHidden: false,
10
+ deleteAfterUpload: false
11
+ };
12
+ /**
13
+ * The outputs an environment writes: one per entry of `rollupOptions.output` or
14
+ * `rolldownOptions.output`. An output writes to `build.outDir` (relative to the root) unless it
15
+ * sets its own `dir`, which the bundler resolves from the working directory. An output's own
16
+ * `sourcemap` overrides `build.sourcemap`.
17
+ */
21
18
  function getOutputs(root, build) {
22
- const configured = build.rolldownOptions?.output ?? build.rollupOptions?.output;
23
- const outputs = Array.isArray(configured) ? configured : [configured ?? {}];
24
- return outputs.map((output) => {
25
- const sourcemap = output.sourcemap ?? build.sourcemap;
26
- return {
27
- destination: output.dir === void 0 ? path__namespace.resolve(root, build.outDir ?? "dist") : path__namespace.resolve(output.dir),
28
- match: sourceMapHandling.getOutputMatch({ ...output, sourcemap }),
29
- sourcemap,
30
- ownSetting: output.sourcemap !== void 0
31
- };
32
- });
19
+ const configured = build.rolldownOptions?.output ?? build.rollupOptions?.output;
20
+ return (Array.isArray(configured) ? configured : [configured ?? {}]).map((output) => {
21
+ const sourcemap = output.sourcemap ?? build.sourcemap;
22
+ return {
23
+ destination: output.dir === void 0 ? node_path.resolve(root, build.outDir ?? "dist") : node_path.resolve(output.dir),
24
+ match: require_source_map_handling.getOutputMatch({
25
+ ...output,
26
+ sourcemap
27
+ }),
28
+ sourcemap,
29
+ ownSetting: output.sourcemap !== void 0
30
+ };
31
+ });
33
32
  }
34
- function createViteSourceMapHooks(sentryBuildPluginManager, sourceMapHandling$1) {
35
- const decisions = /* @__PURE__ */ new Map();
36
- return {
37
- config: (userConfig, env) => {
38
- if (env.command !== "build") {
39
- return null;
40
- }
41
- decisions.clear();
42
- const kind = sourceMapHandling.sourceMapKindFromRollupSetting(userConfig.build?.sourcemap);
43
- const decision = sentryBuildPluginManager.sourceMaps.decide(kind, { log: false });
44
- decisions.set("*", { kind, decision });
45
- const result = decision.enableHidden ? { build: { sourcemap: "hidden" } } : {};
46
- for (const [name, environment] of Object.entries(userConfig.environments ?? {})) {
47
- const setting = environment?.build?.sourcemap;
48
- if (setting === void 0) {
49
- continue;
50
- }
51
- const environmentKind = sourceMapHandling.sourceMapKindFromRollupSetting(setting);
52
- const environmentDecision = sentryBuildPluginManager.sourceMaps.decide(environmentKind, { log: false });
53
- decisions.set(name, { kind: environmentKind, decision: environmentDecision });
54
- if (environmentDecision.enableHidden) {
55
- result.environments = { ...result.environments, [name]: { build: { sourcemap: "hidden" } } };
56
- }
57
- }
58
- return result;
59
- },
60
- configResolved: (config) => {
61
- const environments = config.environments ?? { client: { build: config.build } };
62
- const { uploadPossible } = sentryBuildPluginManager.sourceMaps;
63
- const deleteOption = sentryBuildPluginManager.normalizedOptions.sourcemaps?.deleteSourcemapsAfterUpload;
64
- for (const [name, environment] of Object.entries(environments)) {
65
- const { kind, decision } = decisions.get(name) ?? decisions.get("*") ?? { kind: "unset", decision: NO_CHANGE };
66
- for (const output of getOutputs(config.root, environment.build)) {
67
- if (output.ownSetting) {
68
- sourceMapHandling$1.setDecision(output.destination, {
69
- match: output.match,
70
- kind: sourceMapHandling.sourceMapKindFromRollupSetting(output.sourcemap),
71
- decision: {
72
- enableHidden: false,
73
- deleteAfterUpload: uploadPossible && deleteOption === true && output.sourcemap === "hidden"
74
- }
75
- });
76
- continue;
77
- }
78
- if (decision.deleteAfterUpload && output.sourcemap !== "hidden") {
79
- sentryBuildPluginManager.logger.debug(
80
- `Source maps of the "${name}" environment are set to ${JSON.stringify(output.sourcemap)}. Not removing them after upload.`
81
- );
82
- sourceMapHandling$1.setDecision(output.destination, { match: output.match, kind, decision: NO_CHANGE });
83
- } else {
84
- sourceMapHandling$1.setDecision(output.destination, { match: output.match, kind, decision });
85
- }
86
- }
87
- }
88
- }
89
- };
33
+ /**
34
+ * Vite warns about `rollupOptions.output.sourcemap`, so the Vite plugin decides on `build.sourcemap`
35
+ * in a `config` hook. The hook belongs on the post plugin: framework plugins that set
36
+ * `build.sourcemap` themselves run first, and the decision sees the merged setting. The output
37
+ * directories are only known in `configResolved`, which then records the decision for each of them.
38
+ */
39
+ function createViteSourceMapHooks(sentryBuildPluginManager, sourceMapHandling) {
40
+ const decisions = /* @__PURE__ */ new Map();
41
+ return {
42
+ config: (userConfig, env) => {
43
+ if (env.command !== "build") return null;
44
+ decisions.clear();
45
+ const kind = require_source_map_handling.sourceMapKindFromRollupSetting(userConfig.build?.sourcemap);
46
+ const decision = sentryBuildPluginManager.sourceMaps.decide(kind, { log: false });
47
+ decisions.set("*", {
48
+ kind,
49
+ decision
50
+ });
51
+ const result = decision.enableHidden ? { build: { sourcemap: "hidden" } } : {};
52
+ for (const [name, environment] of Object.entries(userConfig.environments ?? {})) {
53
+ const setting = environment?.build?.sourcemap;
54
+ if (setting === void 0) continue;
55
+ const environmentKind = require_source_map_handling.sourceMapKindFromRollupSetting(setting);
56
+ const environmentDecision = sentryBuildPluginManager.sourceMaps.decide(environmentKind, {
57
+ log: false,
58
+ environment: name
59
+ });
60
+ decisions.set(name, {
61
+ kind: environmentKind,
62
+ decision: environmentDecision
63
+ });
64
+ if (environmentDecision.enableHidden) result.environments = {
65
+ ...result.environments,
66
+ [name]: { build: { sourcemap: "hidden" } }
67
+ };
68
+ }
69
+ return result;
70
+ },
71
+ configResolved: (config) => {
72
+ const environments = config.environments ?? { client: { build: config.build } };
73
+ for (const [name, environment] of Object.entries(environments)) {
74
+ const { kind, decision } = decisions.get(name) ?? decisions.get("*") ?? {
75
+ kind: "unset",
76
+ decision: NO_CHANGE
77
+ };
78
+ const environmentName = decisions.has(name) ? name : void 0;
79
+ const { normalizedOptions } = sentryBuildPluginManager;
80
+ const deleteOption = require_sourcemap_settings.getDeleteSourcemapsAfterUpload(normalizedOptions, environmentName);
81
+ const sdkEnabledSourceMaps = require_sourcemap_settings.getSdkEnabledSourceMaps(normalizedOptions, environmentName);
82
+ for (const output of getOutputs(config.root, environment.build)) {
83
+ if (output.ownSetting) {
84
+ const outputKind = require_source_map_handling.sourceMapKindFromRollupSetting(output.sourcemap);
85
+ const removeAllSourceMaps = sdkEnabledSourceMaps && (outputKind === "hidden" || outputKind === "visible");
86
+ sourceMapHandling.setDecision(output.destination, {
87
+ match: output.match,
88
+ kind: outputKind,
89
+ decision: {
90
+ enableHidden: false,
91
+ deleteAfterUpload: deleteOption === true && (outputKind === "hidden" || removeAllSourceMaps),
92
+ removeAllSourceMaps
93
+ }
94
+ });
95
+ continue;
96
+ }
97
+ if (decision.deleteAfterUpload && output.sourcemap !== "hidden") {
98
+ sentryBuildPluginManager.logger.debug(`Source maps of the "${name}" environment are set to ${JSON.stringify(output.sourcemap)}. Not removing them after upload.`);
99
+ sourceMapHandling.setDecision(output.destination, {
100
+ match: output.match,
101
+ kind,
102
+ decision: NO_CHANGE
103
+ });
104
+ } else sourceMapHandling.setDecision(output.destination, {
105
+ match: output.match,
106
+ kind,
107
+ decision
108
+ });
109
+ }
110
+ }
111
+ }
112
+ };
90
113
  }
91
-
92
114
  exports.createViteSourceMapHooks = createViteSourceMapHooks;
93
- //# sourceMappingURL=source-map-hooks.js.map
115
+
116
+ //# sourceMappingURL=source-map-hooks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"source-map-hooks.js","sources":["../../../src/vite/source-map-hooks.ts"],"sourcesContent":["import * as path from 'node:path';\nimport type { SentryBuildPluginManager, SourceMapDecision, SourceMapKind } from '../core';\nimport type { OutputMatch, RollupSourceMapSetting, SourceMapHandling } from '../rollup/source-map-handling';\nimport { getOutputMatch, sourceMapKindFromRollupSetting } from '../rollup/source-map-handling';\n\ntype BundlerOutput = OutputMatch & { dir?: string; sourcemap?: RollupSourceMapSetting };\ntype BundlerOutputOptions = BundlerOutput | BundlerOutput[] | undefined;\n\ntype ViteBuildOptions = {\n sourcemap?: RollupSourceMapSetting;\n outDir?: string;\n rollupOptions?: { output?: BundlerOutputOptions };\n rolldownOptions?: { output?: BundlerOutputOptions };\n};\n\nexport type ViteUserConfig = {\n build?: ViteBuildOptions;\n environments?: Record<string, { build?: ViteBuildOptions } | undefined>;\n};\n\nexport type ViteResolvedConfig = {\n root: string;\n build: ViteBuildOptions;\n environments?: Record<string, { build: ViteBuildOptions }>;\n};\n\nexport type ViteSourceMapHooks = {\n config: (userConfig: ViteUserConfig, env: { command: string }) => ViteUserConfig | null;\n configResolved: (config: ViteResolvedConfig) => void;\n};\n\nconst NO_CHANGE: SourceMapDecision = { enableHidden: false, deleteAfterUpload: false };\n\ntype EnvironmentOutput = {\n destination: string;\n match: OutputMatch;\n sourcemap: RollupSourceMapSetting;\n /** The output sets `sourcemap` itself, which overrides `build.sourcemap`. */\n ownSetting: boolean;\n};\n\n/**\n * The outputs an environment writes: one per entry of `rollupOptions.output` or\n * `rolldownOptions.output`. An output writes to `build.outDir` (relative to the root) unless it\n * sets its own `dir`, which the bundler resolves from the working directory. An output's own\n * `sourcemap` overrides `build.sourcemap`.\n */\nfunction getOutputs(root: string, build: ViteBuildOptions): EnvironmentOutput[] {\n const configured = build.rolldownOptions?.output ?? build.rollupOptions?.output;\n const outputs = Array.isArray(configured) ? configured : [configured ?? {}];\n\n return outputs.map(output => {\n const sourcemap = output.sourcemap ?? build.sourcemap;\n return {\n destination: output.dir === undefined ? path.resolve(root, build.outDir ?? 'dist') : path.resolve(output.dir),\n match: getOutputMatch({ ...output, sourcemap }),\n sourcemap,\n ownSetting: output.sourcemap !== undefined,\n };\n });\n}\n\n/**\n * Vite warns about `rollupOptions.output.sourcemap`, so the Vite plugin decides on `build.sourcemap`\n * in a `config` hook. The hook belongs on the post plugin: framework plugins that set\n * `build.sourcemap` themselves run first, and the decision sees the merged setting. The output\n * directories are only known in `configResolved`, which then records the decision for each of them.\n */\nexport function createViteSourceMapHooks(\n sentryBuildPluginManager: SentryBuildPluginManager,\n sourceMapHandling: SourceMapHandling,\n): ViteSourceMapHooks {\n // `'*'` for the top-level setting, otherwise the name of an environment with its own.\n const decisions = new Map<string, { kind: SourceMapKind; decision: SourceMapDecision }>();\n\n return {\n config: (userConfig, env) => {\n if (env.command !== 'build') {\n return null;\n }\n\n // The same plugin instances can serve several builds in a row.\n decisions.clear();\n\n const kind = sourceMapKindFromRollupSetting(userConfig.build?.sourcemap);\n // Logged in `generateBundle`, which knows whether the output is written.\n const decision = sentryBuildPluginManager.sourceMaps.decide(kind, { log: false });\n decisions.set('*', { kind, decision });\n\n const result: ViteUserConfig = decision.enableHidden ? { build: { sourcemap: 'hidden' } } : {};\n\n for (const [name, environment] of Object.entries(userConfig.environments ?? {})) {\n const setting = environment?.build?.sourcemap;\n if (setting === undefined) {\n continue;\n }\n\n const environmentKind = sourceMapKindFromRollupSetting(setting);\n const environmentDecision = sentryBuildPluginManager.sourceMaps.decide(environmentKind, { log: false });\n decisions.set(name, { kind: environmentKind, decision: environmentDecision });\n\n if (environmentDecision.enableHidden) {\n result.environments = { ...result.environments, [name]: { build: { sourcemap: 'hidden' } } };\n }\n }\n\n return result;\n },\n\n configResolved: config => {\n const environments = config.environments ?? { client: { build: config.build } };\n\n const { uploadPossible } = sentryBuildPluginManager.sourceMaps;\n const deleteOption = sentryBuildPluginManager.normalizedOptions.sourcemaps?.deleteSourcemapsAfterUpload;\n\n for (const [name, environment] of Object.entries(environments)) {\n const { kind, decision } = decisions.get(name) ?? decisions.get('*') ?? { kind: 'unset', decision: NO_CHANGE };\n\n for (const output of getOutputs(config.root, environment.build)) {\n // The plugin never changes an output's own setting, so the user enabled\n // these maps: only hidden ones the user asked to delete are removed.\n if (output.ownSetting) {\n sourceMapHandling.setDecision(output.destination, {\n match: output.match,\n kind: sourceMapKindFromRollupSetting(output.sourcemap),\n decision: {\n enableHidden: false,\n deleteAfterUpload: uploadPossible && deleteOption === true && output.sourcemap === 'hidden',\n },\n });\n continue;\n }\n\n // A plugin that ran after ours may have changed the setting again.\n if (decision.deleteAfterUpload && output.sourcemap !== 'hidden') {\n sentryBuildPluginManager.logger.debug(\n `Source maps of the \"${name}\" environment are set to ${JSON.stringify(output.sourcemap)}. Not removing them after upload.`,\n );\n sourceMapHandling.setDecision(output.destination, { match: output.match, kind, decision: NO_CHANGE });\n } else {\n sourceMapHandling.setDecision(output.destination, { match: output.match, kind, decision });\n }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AAA,EAAO,IAAA,EAAM,QAAA,EAAU,SAAA,EAAW,CAAA;AAAA,UACtG,CAAA,MAAO;AACL,YAAAA,mBAAA,CAAkB,WAAA,CAAY,OAAO,WAAA,EAAa,EAAE,OAAO,MAAA,CAAO,KAAA,EAAO,IAAA,EAAM,QAAA,EAAU,CAAA;AAAA,UAC3F;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"source-map-hooks.js","names":["path","getOutputMatch","sourceMapKindFromRollupSetting","getDeleteSourcemapsAfterUpload","getSdkEnabledSourceMaps"],"sources":["../../../src/vite/source-map-hooks.ts"],"sourcesContent":["import * as path from 'node:path';\nimport type { SentryBuildPluginManager, SourceMapDecision, SourceMapKind } from '../core';\nimport { getDeleteSourcemapsAfterUpload, getSdkEnabledSourceMaps } from '../core';\nimport type { OutputMatch, RollupSourceMapSetting, SourceMapHandling } from '../rollup/source-map-handling';\nimport { getOutputMatch, sourceMapKindFromRollupSetting } from '../rollup/source-map-handling';\n\ntype BundlerOutput = OutputMatch & { dir?: string; sourcemap?: RollupSourceMapSetting };\ntype BundlerOutputOptions = BundlerOutput | BundlerOutput[] | undefined;\n\ntype ViteBuildOptions = {\n sourcemap?: RollupSourceMapSetting;\n outDir?: string;\n rollupOptions?: { output?: BundlerOutputOptions };\n rolldownOptions?: { output?: BundlerOutputOptions };\n};\n\nexport type ViteUserConfig = {\n build?: ViteBuildOptions;\n environments?: Record<string, { build?: ViteBuildOptions } | undefined>;\n};\n\nexport type ViteResolvedConfig = {\n root: string;\n build: ViteBuildOptions;\n environments?: Record<string, { build: ViteBuildOptions }>;\n};\n\nexport type ViteSourceMapHooks = {\n config: (userConfig: ViteUserConfig, env: { command: string }) => ViteUserConfig | null;\n configResolved: (config: ViteResolvedConfig) => void;\n};\n\nconst NO_CHANGE: SourceMapDecision = { enableHidden: false, deleteAfterUpload: false };\n\ntype EnvironmentOutput = {\n destination: string;\n match: OutputMatch;\n sourcemap: RollupSourceMapSetting;\n /** The output sets `sourcemap` itself, which overrides `build.sourcemap`. */\n ownSetting: boolean;\n};\n\n/**\n * The outputs an environment writes: one per entry of `rollupOptions.output` or\n * `rolldownOptions.output`. An output writes to `build.outDir` (relative to the root) unless it\n * sets its own `dir`, which the bundler resolves from the working directory. An output's own\n * `sourcemap` overrides `build.sourcemap`.\n */\nfunction getOutputs(root: string, build: ViteBuildOptions): EnvironmentOutput[] {\n const configured = build.rolldownOptions?.output ?? build.rollupOptions?.output;\n const outputs = Array.isArray(configured) ? configured : [configured ?? {}];\n\n return outputs.map(output => {\n const sourcemap = output.sourcemap ?? build.sourcemap;\n return {\n destination: output.dir === undefined ? path.resolve(root, build.outDir ?? 'dist') : path.resolve(output.dir),\n match: getOutputMatch({ ...output, sourcemap }),\n sourcemap,\n ownSetting: output.sourcemap !== undefined,\n };\n });\n}\n\n/**\n * Vite warns about `rollupOptions.output.sourcemap`, so the Vite plugin decides on `build.sourcemap`\n * in a `config` hook. The hook belongs on the post plugin: framework plugins that set\n * `build.sourcemap` themselves run first, and the decision sees the merged setting. The output\n * directories are only known in `configResolved`, which then records the decision for each of them.\n */\nexport function createViteSourceMapHooks(\n sentryBuildPluginManager: SentryBuildPluginManager,\n sourceMapHandling: SourceMapHandling,\n): ViteSourceMapHooks {\n // `'*'` for the top-level setting, otherwise the name of an environment with its own.\n const decisions = new Map<string, { kind: SourceMapKind; decision: SourceMapDecision }>();\n\n return {\n config: (userConfig, env) => {\n if (env.command !== 'build') {\n return null;\n }\n\n // The same plugin instances can serve several builds in a row.\n decisions.clear();\n\n const kind = sourceMapKindFromRollupSetting(userConfig.build?.sourcemap);\n // Logged in `generateBundle`, which knows whether the output is written.\n const decision = sentryBuildPluginManager.sourceMaps.decide(kind, { log: false });\n decisions.set('*', { kind, decision });\n\n const result: ViteUserConfig = decision.enableHidden ? { build: { sourcemap: 'hidden' } } : {};\n\n for (const [name, environment] of Object.entries(userConfig.environments ?? {})) {\n const setting = environment?.build?.sourcemap;\n if (setting === undefined) {\n continue;\n }\n\n const environmentKind = sourceMapKindFromRollupSetting(setting);\n const environmentDecision = sentryBuildPluginManager.sourceMaps.decide(environmentKind, {\n log: false,\n environment: name,\n });\n decisions.set(name, { kind: environmentKind, decision: environmentDecision });\n\n if (environmentDecision.enableHidden) {\n result.environments = { ...result.environments, [name]: { build: { sourcemap: 'hidden' } } };\n }\n }\n\n return result;\n },\n\n configResolved: config => {\n const environments = config.environments ?? { client: { build: config.build } };\n\n for (const [name, environment] of Object.entries(environments)) {\n const { kind, decision } = decisions.get(name) ?? decisions.get('*') ?? { kind: 'unset', decision: NO_CHANGE };\n const environmentName = decisions.has(name) ? name : undefined;\n const { normalizedOptions } = sentryBuildPluginManager;\n const deleteOption = getDeleteSourcemapsAfterUpload(normalizedOptions, environmentName);\n const sdkEnabledSourceMaps = getSdkEnabledSourceMaps(normalizedOptions, environmentName);\n\n for (const output of getOutputs(config.root, environment.build)) {\n // The plugin never changes an output's own setting. Hidden maps are\n // removed when the user asks for it, visible ones only when the SDK\n // turned source maps on.\n if (output.ownSetting) {\n const outputKind = sourceMapKindFromRollupSetting(output.sourcemap);\n const removeAllSourceMaps = sdkEnabledSourceMaps && (outputKind === 'hidden' || outputKind === 'visible');\n sourceMapHandling.setDecision(output.destination, {\n match: output.match,\n kind: outputKind,\n decision: {\n enableHidden: false,\n deleteAfterUpload: deleteOption === true && (outputKind === 'hidden' || removeAllSourceMaps),\n removeAllSourceMaps,\n },\n });\n continue;\n }\n\n // A plugin that ran after ours may have changed the setting again.\n if (decision.deleteAfterUpload && output.sourcemap !== 'hidden') {\n sentryBuildPluginManager.logger.debug(\n `Source maps of the \"${name}\" environment are set to ${JSON.stringify(output.sourcemap)}. Not removing them after upload.`,\n );\n sourceMapHandling.setDecision(output.destination, { match: output.match, kind, decision: NO_CHANGE });\n } else {\n sourceMapHandling.setDecision(output.destination, { match: output.match, kind, decision });\n }\n }\n }\n },\n };\n}\n"],"mappings":";;;;;;;AAgCA,MAAM,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MAAM;KAAS,CAAC;IAE7F;GACF;EACF;CACF;AACF"}
@@ -1,29 +1,23 @@
1
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
-
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ // src/webpack/component-annotation-transform.ts
3
6
  async function transform(source, map) {
4
- const callback = this.async();
5
- const { transform: transformFn } = this.query;
6
- if (!transformFn) {
7
- return callback(null, source, map);
8
- }
9
- try {
10
- const id = this.resourcePath;
11
- const result = await transformFn(source, id);
12
- if (result == null) {
13
- callback(null, source, map);
14
- } else if (typeof result === "string") {
15
- callback(null, result, map);
16
- } else {
17
- callback(null, result.code, result.map || map);
18
- }
19
- } catch (error) {
20
- if (error instanceof Error) {
21
- callback(error);
22
- } else {
23
- callback(new Error(String(error)));
24
- }
25
- }
7
+ const callback = this.async();
8
+ const { transform: transformFn } = this.query;
9
+ if (!transformFn) return callback(null, source, map);
10
+ try {
11
+ const id = this.resourcePath;
12
+ const result = await transformFn(source, id);
13
+ if (result == null) callback(null, source, map);
14
+ else if (typeof result === "string") callback(null, result, map);
15
+ else callback(null, result.code, result.map || map);
16
+ } catch (error) {
17
+ if (error instanceof Error) callback(error);
18
+ else callback(new Error(String(error)));
19
+ }
26
20
  }
27
-
28
21
  exports.default = transform;
29
- //# sourceMappingURL=component-annotation-transform.js.map
22
+
23
+ //# sourceMappingURL=component-annotation-transform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component-annotation-transform.js","sources":["../../../src/webpack/component-annotation-transform.ts"],"sourcesContent":["// Webpack loader for component annotation transform\n// Based on unplugin v1.0.1 transform loader pattern\n\nexport default async function transform(\n this: {\n async: () => (err: Error | null, content?: string, sourceMap?: unknown) => void;\n resourcePath: string;\n query: {\n transform?: (code: string, id: string) => Promise<{ code: string; map?: unknown } | null | undefined | string>;\n };\n },\n source: string,\n map: unknown,\n): Promise<void> {\n const callback = this.async();\n const { transform: transformFn } = this.query;\n\n if (!transformFn) {\n return callback(null, source, map);\n }\n\n try {\n const id = this.resourcePath;\n const result = await transformFn(source, id);\n\n if (result == null) {\n callback(null, source, map);\n } else if (typeof result === 'string') {\n callback(null, result, map);\n } else {\n callback(null, result.code, result.map || map);\n }\n } catch (error) {\n if (error instanceof Error) {\n callback(error);\n } else {\n callback(new Error(String(error)));\n }\n }\n}\n"],"names":[],"mappings":";;AAGA,eAA8B,SAAA,CAQ5B,QACA,GAAA,EACe;AACf,EAAA,MAAM,QAAA,GAAW,KAAK,KAAA,EAAM;AAC5B,EAAA,MAAM,EAAE,SAAA,EAAW,WAAA,EAAY,GAAI,IAAA,CAAK,KAAA;AAExC,EAAA,IAAI,CAAC,WAAA,EAAa;AAChB,IAAA,OAAO,QAAA,CAAS,IAAA,EAAM,MAAA,EAAQ,GAAG,CAAA;AAAA,EACnC;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,KAAK,IAAA,CAAK,YAAA;AAChB,IAAA,MAAM,MAAA,GAAS,MAAM,WAAA,CAAY,MAAA,EAAQ,EAAE,CAAA;AAE3C,IAAA,IAAI,UAAU,IAAA,EAAM;AAClB,MAAA,QAAA,CAAS,IAAA,EAAM,QAAQ,GAAG,CAAA;AAAA,IAC5B,CAAA,MAAA,IAAW,OAAO,MAAA,KAAW,QAAA,EAAU;AACrC,MAAA,QAAA,CAAS,IAAA,EAAM,QAAQ,GAAG,CAAA;AAAA,IAC5B,CAAA,MAAO;AACL,MAAA,QAAA,CAAS,IAAA,EAAM,MAAA,CAAO,IAAA,EAAM,MAAA,CAAO,OAAO,GAAG,CAAA;AAAA,IAC/C;AAAA,EACF,SAAS,KAAA,EAAO;AACd,IAAA,IAAI,iBAAiB,KAAA,EAAO;AAC1B,MAAA,QAAA,CAAS,KAAK,CAAA;AAAA,IAChB,CAAA,MAAO;AACL,MAAA,QAAA,CAAS,IAAI,KAAA,CAAM,MAAA,CAAO,KAAK,CAAC,CAAC,CAAA;AAAA,IACnC;AAAA,EACF;AACF;;;;"}
1
+ {"version":3,"file":"component-annotation-transform.js","names":[],"sources":["../../../src/webpack/component-annotation-transform.ts"],"sourcesContent":["// Webpack loader for component annotation transform\n// Based on unplugin v1.0.1 transform loader pattern\n\nexport default async function transform(\n this: {\n async: () => (err: Error | null, content?: string, sourceMap?: unknown) => void;\n resourcePath: string;\n query: {\n transform?: (code: string, id: string) => Promise<{ code: string; map?: unknown } | null | undefined | string>;\n };\n },\n source: string,\n map: unknown,\n): Promise<void> {\n const callback = this.async();\n const { transform: transformFn } = this.query;\n\n if (!transformFn) {\n return callback(null, source, map);\n }\n\n try {\n const id = this.resourcePath;\n const result = await transformFn(source, id);\n\n if (result == null) {\n callback(null, source, map);\n } else if (typeof result === 'string') {\n callback(null, result, map);\n } else {\n callback(null, result.code, result.map || map);\n }\n } catch (error) {\n if (error instanceof Error) {\n callback(error);\n } else {\n callback(new Error(String(error)));\n }\n }\n}\n"],"mappings":";;;;;AAGA,eAA8B,UAQ5B,QACA,KACe;CACf,MAAM,WAAW,KAAK,MAAM;CAC5B,MAAM,EAAE,WAAW,gBAAgB,KAAK;CAExC,IAAI,CAAC,aACH,OAAO,SAAS,MAAM,QAAQ,GAAG;CAGnC,IAAI;EACF,MAAM,KAAK,KAAK;EAChB,MAAM,SAAS,MAAM,YAAY,QAAQ,EAAE;EAE3C,IAAI,UAAU,MACZ,SAAS,MAAM,QAAQ,GAAG;OACrB,IAAI,OAAO,WAAW,UAC3B,SAAS,MAAM,QAAQ,GAAG;OAE1B,SAAS,MAAM,OAAO,MAAM,OAAO,OAAO,GAAG;CAEjD,SAAS,OAAO;EACd,IAAI,iBAAiB,OACnB,SAAS,KAAK;OAEd,SAAS,IAAI,MAAM,OAAO,KAAK,CAAC,CAAC;CAErC;AACF"}