@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 +1 @@
1
- {"version":3,"file":"debug-id-injection.js","sources":["../../../src/rollup/debug-id-injection.ts"],"sourcesContent":["import { stringToUUID } from '../core';\n\nexport const ROLLDOWN_DEBUG_ID_PLACEHOLDER = 'SENTRY_DEBUG_ID_PLACEHOLDER_00000000';\n\ntype GeneratedChunk = {\n type: 'chunk';\n fileName: string;\n code: string;\n};\n\ntype GeneratedAsset = {\n type: 'asset';\n fileName: string;\n};\n\nexport type GeneratedBundle = Record<string, GeneratedChunk | GeneratedAsset>;\n\nconst SENTRY_DEBUG_ID_IDENTIFIER = '_sentryDebugIdIdentifier';\nconst SENTRY_DEBUG_ID_IDENTIFIER_PREFIX = 'sentry-dbid-';\n\nexport function hasExistingDebugID(code: string): boolean {\n const chunkStartSnippet = code.slice(0, 6000);\n const chunkEndSnippet = code.slice(-500);\n\n return chunkStartSnippet.includes(SENTRY_DEBUG_ID_IDENTIFIER) || chunkEndSnippet.includes('//# debugId=');\n}\n\nexport function getDebugIdForChunk(code: string, isRolldown: boolean): string {\n return isRolldown ? ROLLDOWN_DEBUG_ID_PLACEHOLDER : stringToUUID(code);\n}\n\nfunction replaceAt(code: string, start: number, search: string, replacement: string): string {\n return `${code.slice(0, start)}${replacement}${code.slice(start + search.length)}`;\n}\n\nexport function finalizeRolldownDebugIds(bundle: GeneratedBundle): void {\n for (const [fileName, output] of Object.entries(bundle)) {\n if (output.type !== 'chunk') {\n continue;\n }\n\n const identifier = `${SENTRY_DEBUG_ID_IDENTIFIER_PREFIX}${ROLLDOWN_DEBUG_ID_PLACEHOLDER}`;\n const identifierPropertyStart = output.code.indexOf(SENTRY_DEBUG_ID_IDENTIFIER);\n const identifierStart = output.code.indexOf(\n identifier,\n identifierPropertyStart + SENTRY_DEBUG_ID_IDENTIFIER.length,\n );\n if (identifierStart === -1) {\n continue;\n }\n\n const identifierPlaceholderStart = identifierStart + SENTRY_DEBUG_ID_IDENTIFIER_PREFIX.length;\n const debugIdsPlaceholderStart = output.code.lastIndexOf(ROLLDOWN_DEBUG_ID_PLACEHOLDER, identifierStart - 1);\n if (debugIdsPlaceholderStart === -1) {\n throw new Error(`Failed to locate the Sentry debug ID placeholder for chunk \\`${fileName}\\`.`);\n }\n\n // The fixed-width replacement happens after Rolldown computes [hash], so the emitted file name\n // still matches the placeholder-bearing chunk. Hashing only the code keeps byte-identical chunks\n // on one ID, as Rollup builds do.\n const debugId = stringToUUID(output.code);\n const codeWithIdentifier = replaceAt(\n output.code,\n identifierPlaceholderStart,\n ROLLDOWN_DEBUG_ID_PLACEHOLDER,\n debugId,\n );\n output.code = replaceAt(codeWithIdentifier, debugIdsPlaceholderStart, ROLLDOWN_DEBUG_ID_PLACEHOLDER, debugId);\n }\n}\n"],"names":["stringToUUID"],"mappings":";;;;AAEO,MAAM,6BAAA,GAAgC;AAe7C,MAAM,0BAAA,GAA6B,0BAAA;AACnC,MAAM,iCAAA,GAAoC,cAAA;AAEnC,SAAS,mBAAmB,IAAA,EAAuB;AACxD,EAAA,MAAM,iBAAA,GAAoB,IAAA,CAAK,KAAA,CAAM,CAAA,EAAG,GAAI,CAAA;AAC5C,EAAA,MAAM,eAAA,GAAkB,IAAA,CAAK,KAAA,CAAM,IAAI,CAAA;AAEvC,EAAA,OAAO,kBAAkB,QAAA,CAAS,0BAA0B,CAAA,IAAK,eAAA,CAAgB,SAAS,cAAc,CAAA;AAC1G;AAEO,SAAS,kBAAA,CAAmB,MAAc,UAAA,EAA6B;AAC5E,EAAA,OAAO,UAAA,GAAa,6BAAA,GAAgCA,kBAAA,CAAa,IAAI,CAAA;AACvE;AAEA,SAAS,SAAA,CAAU,IAAA,EAAc,KAAA,EAAe,MAAA,EAAgB,WAAA,EAA6B;AAC3F,EAAA,OAAO,CAAA,EAAG,IAAA,CAAK,KAAA,CAAM,CAAA,EAAG,KAAK,CAAC,CAAA,EAAG,WAAW,CAAA,EAAG,IAAA,CAAK,KAAA,CAAM,KAAA,GAAQ,MAAA,CAAO,MAAM,CAAC,CAAA,CAAA;AAClF;AAEO,SAAS,yBAAyB,MAAA,EAA+B;AACtE,EAAA,KAAA,MAAW,CAAC,QAAA,EAAU,MAAM,KAAK,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAA,EAAG;AACvD,IAAA,IAAI,MAAA,CAAO,SAAS,OAAA,EAAS;AAC3B,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,UAAA,GAAa,CAAA,EAAG,iCAAiC,CAAA,EAAG,6BAA6B,CAAA,CAAA;AACvF,IAAA,MAAM,uBAAA,GAA0B,MAAA,CAAO,IAAA,CAAK,OAAA,CAAQ,0BAA0B,CAAA;AAC9E,IAAA,MAAM,eAAA,GAAkB,OAAO,IAAA,CAAK,OAAA;AAAA,MAClC,UAAA;AAAA,MACA,0BAA0B,0BAAA,CAA2B;AAAA,KACvD;AACA,IAAA,IAAI,oBAAoB,EAAA,EAAI;AAC1B,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,0BAAA,GAA6B,kBAAkB,iCAAA,CAAkC,MAAA;AACvF,IAAA,MAAM,2BAA2B,MAAA,CAAO,IAAA,CAAK,WAAA,CAAY,6BAAA,EAA+B,kBAAkB,CAAC,CAAA;AAC3G,IAAA,IAAI,6BAA6B,EAAA,EAAI;AACnC,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,6DAAA,EAAgE,QAAQ,CAAA,GAAA,CAAK,CAAA;AAAA,IAC/F;AAKA,IAAA,MAAM,OAAA,GAAUA,kBAAA,CAAa,MAAA,CAAO,IAAI,CAAA;AACxC,IAAA,MAAM,kBAAA,GAAqB,SAAA;AAAA,MACzB,MAAA,CAAO,IAAA;AAAA,MACP,0BAAA;AAAA,MACA,6BAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAA,CAAO,IAAA,GAAO,SAAA,CAAU,kBAAA,EAAoB,wBAAA,EAA0B,+BAA+B,OAAO,CAAA;AAAA,EAC9G;AACF;;;;;;;"}
1
+ {"version":3,"file":"debug-id-injection.js","names":["stringToUUID"],"sources":["../../../src/rollup/debug-id-injection.ts"],"sourcesContent":["import { stringToUUID } from '../core';\n\nexport const ROLLDOWN_DEBUG_ID_PLACEHOLDER = 'SENTRY_DEBUG_ID_PLACEHOLDER_00000000';\n\ntype GeneratedChunk = {\n type: 'chunk';\n fileName: string;\n code: string;\n};\n\ntype GeneratedAsset = {\n type: 'asset';\n fileName: string;\n};\n\nexport type GeneratedBundle = Record<string, GeneratedChunk | GeneratedAsset>;\n\nconst SENTRY_DEBUG_ID_IDENTIFIER = '_sentryDebugIdIdentifier';\nconst SENTRY_DEBUG_ID_IDENTIFIER_PREFIX = 'sentry-dbid-';\n\nexport function hasExistingDebugID(code: string): boolean {\n const chunkStartSnippet = code.slice(0, 6000);\n const chunkEndSnippet = code.slice(-500);\n\n return chunkStartSnippet.includes(SENTRY_DEBUG_ID_IDENTIFIER) || chunkEndSnippet.includes('//# debugId=');\n}\n\nexport function getDebugIdForChunk(code: string, isRolldown: boolean): string {\n return isRolldown ? ROLLDOWN_DEBUG_ID_PLACEHOLDER : stringToUUID(code);\n}\n\nfunction replaceAt(code: string, start: number, search: string, replacement: string): string {\n return `${code.slice(0, start)}${replacement}${code.slice(start + search.length)}`;\n}\n\nexport function finalizeRolldownDebugIds(bundle: GeneratedBundle): void {\n for (const [fileName, output] of Object.entries(bundle)) {\n if (output.type !== 'chunk') {\n continue;\n }\n\n const identifier = `${SENTRY_DEBUG_ID_IDENTIFIER_PREFIX}${ROLLDOWN_DEBUG_ID_PLACEHOLDER}`;\n const identifierPropertyStart = output.code.indexOf(SENTRY_DEBUG_ID_IDENTIFIER);\n const identifierStart = output.code.indexOf(\n identifier,\n identifierPropertyStart + SENTRY_DEBUG_ID_IDENTIFIER.length,\n );\n if (identifierStart === -1) {\n continue;\n }\n\n const identifierPlaceholderStart = identifierStart + SENTRY_DEBUG_ID_IDENTIFIER_PREFIX.length;\n const debugIdsPlaceholderStart = output.code.lastIndexOf(ROLLDOWN_DEBUG_ID_PLACEHOLDER, identifierStart - 1);\n if (debugIdsPlaceholderStart === -1) {\n throw new Error(`Failed to locate the Sentry debug ID placeholder for chunk \\`${fileName}\\`.`);\n }\n\n // The fixed-width replacement happens after Rolldown computes [hash], so the emitted file name\n // still matches the placeholder-bearing chunk. Hashing only the code keeps byte-identical chunks\n // on one ID, as Rollup builds do.\n const debugId = stringToUUID(output.code);\n const codeWithIdentifier = replaceAt(\n output.code,\n identifierPlaceholderStart,\n ROLLDOWN_DEBUG_ID_PLACEHOLDER,\n debugId,\n );\n output.code = replaceAt(codeWithIdentifier, debugIdsPlaceholderStart, ROLLDOWN_DEBUG_ID_PLACEHOLDER, debugId);\n }\n}\n"],"mappings":";;;AAEA,MAAa,gCAAgC;AAe7C,MAAM,6BAA6B;AACnC,MAAM,oCAAoC;AAE1C,SAAgB,mBAAmB,MAAuB;CACxD,MAAM,oBAAoB,KAAK,MAAM,GAAG,GAAI;CAC5C,MAAM,kBAAkB,KAAK,MAAM,IAAI;CAEvC,OAAO,kBAAkB,SAAS,0BAA0B,KAAK,gBAAgB,SAAS,cAAc;AAC1G;AAEA,SAAgB,mBAAmB,MAAc,YAA6B;CAC5E,OAAO,aAAa,gCAAgCA,cAAAA,aAAa,IAAI;AACvE;AAEA,SAAS,UAAU,MAAc,OAAe,QAAgB,aAA6B;CAC3F,OAAO,GAAG,KAAK,MAAM,GAAG,KAAK,IAAI,cAAc,KAAK,MAAM,QAAQ,OAAO,MAAM;AACjF;AAEA,SAAgB,yBAAyB,QAA+B;CACtE,KAAK,MAAM,CAAC,UAAU,WAAW,OAAO,QAAQ,MAAM,GAAG;EACvD,IAAI,OAAO,SAAS,SAClB;EAGF,MAAM,aAAa,GAAG,oCAAoC;EAC1D,MAAM,0BAA0B,OAAO,KAAK,QAAQ,0BAA0B;EAC9E,MAAM,kBAAkB,OAAO,KAAK,QAClC,YACA,0BAA0B,EAC5B;EACA,IAAI,oBAAoB,IACtB;EAGF,MAAM,6BAA6B,kBAAkB;EACrD,MAAM,2BAA2B,OAAO,KAAK,YAAY,+BAA+B,kBAAkB,CAAC;EAC3G,IAAI,6BAA6B,IAC/B,MAAM,IAAI,MAAM,gEAAgE,SAAS,IAAI;EAM/F,MAAM,UAAUA,cAAAA,aAAa,OAAO,IAAI;EAOxC,OAAO,OAAO,UANa,UACzB,OAAO,MACP,4BACA,+BACA,OAEuC,GAAG,0BAA0B,+BAA+B,OAAO;CAC9G;AACF"}
@@ -1,27 +1,17 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const index = require('../core/index.js');
4
- const debugIdUpload = require('../core/debug-id-upload.js');
5
-
1
+ const require_debug_id_upload = require("../core/debug-id-upload.js");
2
+ const require_index = require("../core/index.js");
3
+ // src/rollup/debug-id-stamping.ts
6
4
  function stampDebugIds(bundle, updateChunkCode) {
7
- for (const output of Object.values(bundle)) {
8
- if (output.type !== "chunk" || !index.isJsFile(output.fileName)) {
9
- continue;
10
- }
11
- const sourceMapAsset = bundle[output.sourcemapFileName ?? `${output.fileName}.map`];
12
- const sourceMapSource = sourceMapAsset?.type === "asset" && typeof sourceMapAsset.source === "string" ? sourceMapAsset.source : void 0;
13
- const stamped = debugIdUpload.stampDebugId(output.code, sourceMapSource);
14
- if (!stamped) {
15
- continue;
16
- }
17
- if (updateChunkCode) {
18
- output.code = stamped.bundleSource;
19
- }
20
- if (stamped.sourceMapSource !== void 0 && sourceMapAsset?.type === "asset") {
21
- sourceMapAsset.source = stamped.sourceMapSource;
22
- }
23
- }
5
+ for (const output of Object.values(bundle)) {
6
+ if (output.type !== "chunk" || !require_index.isJsFile(output.fileName)) continue;
7
+ const sourceMapAsset = bundle[output.sourcemapFileName ?? `${output.fileName}.map`];
8
+ const sourceMapSource = sourceMapAsset?.type === "asset" && typeof sourceMapAsset.source === "string" ? sourceMapAsset.source : void 0;
9
+ const stamped = require_debug_id_upload.stampDebugId(output.code, sourceMapSource);
10
+ if (!stamped) continue;
11
+ if (updateChunkCode) output.code = stamped.bundleSource;
12
+ if (stamped.sourceMapSource !== void 0 && sourceMapAsset?.type === "asset") sourceMapAsset.source = stamped.sourceMapSource;
13
+ }
24
14
  }
25
-
26
15
  exports.stampDebugIds = stampDebugIds;
27
- //# sourceMappingURL=debug-id-stamping.js.map
16
+
17
+ //# sourceMappingURL=debug-id-stamping.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"debug-id-stamping.js","sources":["../../../src/rollup/debug-id-stamping.ts"],"sourcesContent":["import { isJsFile, stampDebugId } from '../core';\n\n// The subset of Rollup's `OutputBundle` the stamping hooks read.\nexport type OutputBundle = Record<\n string,\n | { type: 'chunk'; fileName: string; code: string; sourcemapFileName?: string | null }\n | { type: 'asset'; fileName: string; source: string | Uint8Array }\n>;\n\nexport function stampDebugIds(bundle: OutputBundle, updateChunkCode: boolean): void {\n for (const output of Object.values(bundle)) {\n if (output.type !== 'chunk' || !isJsFile(output.fileName)) {\n continue;\n }\n\n const sourceMapAsset = bundle[output.sourcemapFileName ?? `${output.fileName}.map`];\n const sourceMapSource =\n sourceMapAsset?.type === 'asset' && typeof sourceMapAsset.source === 'string' ? sourceMapAsset.source : undefined;\n\n const stamped = stampDebugId(output.code, sourceMapSource);\n if (!stamped) {\n continue;\n }\n\n if (updateChunkCode) {\n output.code = stamped.bundleSource;\n }\n if (stamped.sourceMapSource !== undefined && sourceMapAsset?.type === 'asset') {\n sourceMapAsset.source = stamped.sourceMapSource;\n }\n }\n}\n"],"names":["isJsFile","stampDebugId"],"mappings":";;;;;AASO,SAAS,aAAA,CAAc,QAAsB,eAAA,EAAgC;AAClF,EAAA,KAAA,MAAW,MAAA,IAAU,MAAA,CAAO,MAAA,CAAO,MAAM,CAAA,EAAG;AAC1C,IAAA,IAAI,OAAO,IAAA,KAAS,OAAA,IAAW,CAACA,cAAA,CAAS,MAAA,CAAO,QAAQ,CAAA,EAAG;AACzD,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,iBAAiB,MAAA,CAAO,MAAA,CAAO,qBAAqB,CAAA,EAAG,MAAA,CAAO,QAAQ,CAAA,IAAA,CAAM,CAAA;AAClF,IAAA,MAAM,eAAA,GACJ,gBAAgB,IAAA,KAAS,OAAA,IAAW,OAAO,cAAA,CAAe,MAAA,KAAW,QAAA,GAAW,cAAA,CAAe,MAAA,GAAS,MAAA;AAE1G,IAAA,MAAM,OAAA,GAAUC,0BAAA,CAAa,MAAA,CAAO,IAAA,EAAM,eAAe,CAAA;AACzD,IAAA,IAAI,CAAC,OAAA,EAAS;AACZ,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,eAAA,EAAiB;AACnB,MAAA,MAAA,CAAO,OAAO,OAAA,CAAQ,YAAA;AAAA,IACxB;AACA,IAAA,IAAI,OAAA,CAAQ,eAAA,KAAoB,MAAA,IAAa,cAAA,EAAgB,SAAS,OAAA,EAAS;AAC7E,MAAA,cAAA,CAAe,SAAS,OAAA,CAAQ,eAAA;AAAA,IAClC;AAAA,EACF;AACF;;;;"}
1
+ {"version":3,"file":"debug-id-stamping.js","names":["isJsFile","stampDebugId"],"sources":["../../../src/rollup/debug-id-stamping.ts"],"sourcesContent":["import { isJsFile, stampDebugId } from '../core';\n\n// The subset of Rollup's `OutputBundle` the stamping hooks read.\nexport type OutputBundle = Record<\n string,\n | { type: 'chunk'; fileName: string; code: string; sourcemapFileName?: string | null }\n | { type: 'asset'; fileName: string; source: string | Uint8Array }\n>;\n\nexport function stampDebugIds(bundle: OutputBundle, updateChunkCode: boolean): void {\n for (const output of Object.values(bundle)) {\n if (output.type !== 'chunk' || !isJsFile(output.fileName)) {\n continue;\n }\n\n const sourceMapAsset = bundle[output.sourcemapFileName ?? `${output.fileName}.map`];\n const sourceMapSource =\n sourceMapAsset?.type === 'asset' && typeof sourceMapAsset.source === 'string' ? sourceMapAsset.source : undefined;\n\n const stamped = stampDebugId(output.code, sourceMapSource);\n if (!stamped) {\n continue;\n }\n\n if (updateChunkCode) {\n output.code = stamped.bundleSource;\n }\n if (stamped.sourceMapSource !== undefined && sourceMapAsset?.type === 'asset') {\n sourceMapAsset.source = stamped.sourceMapSource;\n }\n }\n}\n"],"mappings":";;;AASA,SAAgB,cAAc,QAAsB,iBAAgC;CAClF,KAAK,MAAM,UAAU,OAAO,OAAO,MAAM,GAAG;EAC1C,IAAI,OAAO,SAAS,WAAW,CAACA,cAAAA,SAAS,OAAO,QAAQ,GACtD;EAGF,MAAM,iBAAiB,OAAO,OAAO,qBAAqB,GAAG,OAAO,SAAS;EAC7E,MAAM,kBACJ,gBAAgB,SAAS,WAAW,OAAO,eAAe,WAAW,WAAW,eAAe,SAAS,KAAA;EAE1G,MAAM,UAAUC,wBAAAA,aAAa,OAAO,MAAM,eAAe;EACzD,IAAI,CAAC,SACH;EAGF,IAAI,iBACF,OAAO,OAAO,QAAQ;EAExB,IAAI,QAAQ,oBAAoB,KAAA,KAAa,gBAAgB,SAAS,SACpE,eAAe,SAAS,QAAQ;CAEpC;AACF"}
@@ -1,261 +1,207 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const index = require('../core/index.js');
4
- const MagicString = require('magic-string');
5
- const path = require('node:path');
6
- const node_module = require('node:module');
7
- const debugIdInjection = require('./debug-id-injection.js');
8
- const debugIdStamping = require('./debug-id-stamping.js');
9
- const sourceMapHandling = require('./source-map-handling.js');
10
- const sourceMapHooks = require('../vite/source-map-hooks.js');
11
- const buildPluginManager = require('../core/build-plugin-manager.js');
12
- const utils = require('../core/utils.js');
13
- const componentAnnotateHooks = require('../core/component-annotate-hooks.js');
14
- const glob = require('../core/glob.js');
15
- const getCodeInjectionPosition = require('../core/get-code-injection-position.js');
16
- const debugIdUpload = require('../core/debug-id-upload.js');
17
-
18
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
19
- function _interopDefault (e) { return e && e.__esModule ? e.default : e; }
20
-
21
- function _interopNamespace(e) {
22
- if (e && e.__esModule) return e;
23
- const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
24
- if (e) {
25
- for (const k in e) {
26
- n[k] = e[k];
27
- }
28
- }
29
- n.default = e;
30
- return n;
31
- }
32
-
33
- const MagicString__default = /*#__PURE__*/_interopDefault(MagicString);
34
- const path__namespace = /*#__PURE__*/_interopNamespace(path);
35
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_runtime = require("../_virtual/_rolldown/runtime.js");
3
+ const require_utils = require("../core/utils.js");
4
+ const require_glob = require("../core/glob.js");
5
+ const require_get_code_injection_position = require("../core/get-code-injection-position.js");
6
+ const require_component_annotate_hooks = require("../core/component-annotate-hooks.js");
7
+ const require_debug_id_upload = require("../core/debug-id-upload.js");
8
+ const require_build_plugin_manager = require("../core/build-plugin-manager.js");
9
+ const require_index = require("../core/index.js");
10
+ const require_debug_id_injection = require("./debug-id-injection.js");
11
+ const require_debug_id_stamping = require("./debug-id-stamping.js");
12
+ const require_source_map_handling = require("./source-map-handling.js");
13
+ const require_source_map_hooks = require("../vite/source-map-hooks.js");
14
+ let magic_string = require("magic-string");
15
+ magic_string = require_runtime.__toESM(magic_string);
16
+ let node_path = require("node:path");
17
+ node_path = require_runtime.__toESM(node_path);
18
+ let node_module = require("node:module");
19
+ // src/rollup/index.ts
36
20
  let viteParseAstAsyncPromise;
37
21
  const JS_MODULE_ID_FILTER = /\.[cm]?[jt]sx?(?:[?#].*)?$/;
38
22
  function getRollupMajorVersion() {
39
- try {
40
- const req = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('rollup/index.js', document.baseURI).href)));
41
- const rollup = req("rollup");
42
- return rollup.VERSION?.split(".")[0];
43
- } catch {
44
- }
45
- return void 0;
23
+ try {
24
+ return (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("rollup").VERSION?.split(".")[0];
25
+ } catch {}
46
26
  }
47
27
  function getViteParseAstAsync() {
48
- if (!viteParseAstAsyncPromise) {
49
- viteParseAstAsyncPromise = Promise.resolve().then(async () => {
50
- const viteModule = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('rollup/index.js', document.baseURI).href)))("vite");
51
- if (typeof viteModule.parseAstAsync !== "function") {
52
- return null;
53
- }
54
- try {
55
- await viteModule.parseAstAsync("const x = <div />;", { lang: "tsx" });
56
- } catch {
57
- return null;
58
- }
59
- return viteModule.parseAstAsync;
60
- }).catch(() => null);
61
- }
62
- return viteParseAstAsyncPromise;
28
+ if (!viteParseAstAsyncPromise) viteParseAstAsyncPromise = Promise.resolve().then(async () => {
29
+ const viteModule = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("vite");
30
+ if (typeof viteModule.parseAstAsync !== "function") return null;
31
+ try {
32
+ await viteModule.parseAstAsync("const x = <div />;", { lang: "tsx" });
33
+ } catch {
34
+ return null;
35
+ }
36
+ return viteModule.parseAstAsync;
37
+ }).catch(() => null);
38
+ return viteParseAstAsyncPromise;
63
39
  }
40
+ /**
41
+ * @ignore - internal plugin factory shared by the Rollup and Vite plugins.
42
+ *
43
+ * `main` carries injection, release creation and the upload. `post` runs last in `generateBundle`,
44
+ * copies chunks and their source maps into the upload staging folder and drops the map assets
45
+ * from the bundle, so the bundler never writes them.
46
+ */
64
47
  function _createRollupPluginInternals(userOptions = {}, buildTool, buildToolMajorVersion) {
65
- const sentryBuildPluginManager = buildPluginManager.createSentryBuildPluginManager(userOptions, {
66
- loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? `[sentry-${buildTool}-plugin]`,
67
- buildTool,
68
- buildToolMajorVersion: buildToolMajorVersion || getRollupMajorVersion()
69
- });
70
- const {
71
- logger,
72
- normalizedOptions: options,
73
- bundleSizeOptimizationReplacementValues: replacementValues,
74
- bundleMetadata,
75
- createDependencyOnBuildArtifacts
76
- } = sentryBuildPluginManager;
77
- if (options.disable) {
78
- return {
79
- main: {
80
- name: "sentry-noop-plugin"
81
- },
82
- post: void 0
83
- };
84
- }
85
- if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) {
86
- logger.warn("Running Sentry plugin from within a `node_modules` folder. Some features may not work.");
87
- }
88
- const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
89
- const upload = debugIdUpload.createDebugIdUploadFunction({ sentryBuildPluginManager });
90
- const sourcemapsEnabled = options.sourcemaps?.disable !== true;
91
- const sourceMapHandling$1 = sourceMapHandling.createSourceMapHandling(sentryBuildPluginManager);
92
- const releaseInjectionCode = new utils.CodeInjection();
93
- const chunkInjectionCode = new utils.CodeInjection();
94
- if (!options.release.inject) {
95
- logger.debug("Release injection disabled via `release.inject` option. Will not inject release.");
96
- } else if (!options.release.name) {
97
- logger.debug(
98
- "No release name provided. Will not inject release. Please set the `release.name` option to identify your release."
99
- );
100
- } else {
101
- releaseInjectionCode.append(
102
- utils.generateReleaseInjectorCode({
103
- release: options.release.name,
104
- injectBuildInformation: options._experiments.injectBuildInformation || false
105
- })
106
- );
107
- }
108
- if (Object.keys(bundleMetadata).length > 0) {
109
- chunkInjectionCode.append(utils.generateModuleMetadataInjectorCode(bundleMetadata));
110
- }
111
- const transformAnnotations = options.reactComponentAnnotation?.enabled ? componentAnnotateHooks.createComponentNameAnnotateHooks(
112
- options.reactComponentAnnotation?.ignoredComponents || [],
113
- !!options.reactComponentAnnotation?._experimentalInjectIntoHtml,
114
- {
115
- // Vite 8 already loads an oxc-based parser, so reuse it.
116
- getParseAstAsync: buildTool === "vite" && buildToolMajorVersion === "8" ? getViteParseAstAsync : void 0,
117
- logger
118
- }
119
- ) : void 0;
120
- const transformReplace = Object.keys(replacementValues).length > 0;
121
- const shouldTransform = transformAnnotations || transformReplace;
122
- function buildStart() {
123
- void sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {
124
- });
125
- }
126
- async function transform(code, id, meta) {
127
- if (transformAnnotations) {
128
- const result = await transformAnnotations.transform(code, id, meta);
129
- if (result) {
130
- return result;
131
- }
132
- }
133
- if (transformReplace) {
134
- return utils.replaceBooleanFlagsInCode(code, replacementValues);
135
- }
136
- return null;
137
- }
138
- function renderChunk(code, chunk, _, meta) {
139
- if (!index.isJsFile(chunk.fileName)) {
140
- return null;
141
- }
142
- if (index.shouldSkipCodeInjection(code, chunk.facadeModuleId)) {
143
- return null;
144
- }
145
- const injectCode = new utils.CodeInjection();
146
- if (index.isInitialChunk(chunk, meta?.chunks)) {
147
- injectCode.append(releaseInjectionCode);
148
- }
149
- injectCode.append(chunkInjectionCode);
150
- if (sourcemapsEnabled && !debugIdInjection.hasExistingDebugID(code)) {
151
- const debugId = debugIdInjection.getDebugIdForChunk(code, !!this?.meta?.rolldownVersion);
152
- injectCode.append(index.getDebugIdSnippet(debugId));
153
- }
154
- if (injectCode.isEmpty()) {
155
- return null;
156
- }
157
- const ms = meta?.magicString || new MagicString__default(code, { filename: chunk.fileName });
158
- const injectionPosition = getCodeInjectionPosition.getCodeInjectionPosition(code);
159
- const codeToInject = injectionPosition === code.length ? `
160
- ${injectCode.code()}` : injectCode.code();
161
- ms.appendLeft(injectionPosition, codeToInject);
162
- if (ms?.constructor?.name === "BindingMagicString") {
163
- return { code: ms };
164
- }
165
- return {
166
- code: ms.toString(),
167
- map: ms.generateMap({ file: chunk.fileName, hires: "boundary" })
168
- };
169
- }
170
- function generateBundle(_outputOptions, bundle) {
171
- if (this?.meta?.rolldownVersion) {
172
- debugIdInjection.finalizeRolldownDebugIds(bundle);
173
- }
174
- if (options.sourcemaps?.disable !== "disable-upload") {
175
- return;
176
- }
177
- debugIdStamping.stampDebugIds(bundle, true);
178
- }
179
- async function writeBundle(outputOptions, bundle) {
180
- const staging = await sourceMapHandling$1.takeStaging(outputOptions, bundle);
181
- let stagingHandedOver = false;
182
- try {
183
- await sentryBuildPluginManager.createRelease();
184
- if (sourcemapsEnabled && options.sourcemaps?.disable !== "disable-upload") {
185
- let buildArtifacts;
186
- if (outputOptions.dir) {
187
- const outputDir = outputOptions.dir;
188
- const JS_AND_MAP_PATTERNS = [
189
- "/**/*.js",
190
- "/**/*.mjs",
191
- "/**/*.cjs",
192
- "/**/*.js.map",
193
- "/**/*.mjs.map",
194
- "/**/*.cjs.map"
195
- ].map((q) => `${q}?(\\?*)?(#*)`);
196
- buildArtifacts = await glob.globFiles(JS_AND_MAP_PATTERNS, { root: outputDir });
197
- } else if (outputOptions.file) {
198
- buildArtifacts = [outputOptions.file];
199
- } else {
200
- buildArtifacts = Object.keys(bundle ?? {}).map((asset) => path__namespace.join(path__namespace.resolve(), asset));
201
- }
202
- stagingHandedOver = true;
203
- await upload(buildArtifacts, { staging });
204
- } else {
205
- stagingHandedOver = true;
206
- await staging?.discard();
207
- }
208
- } catch (e) {
209
- if (!stagingHandedOver) {
210
- await staging?.keep("The source map upload did not run.");
211
- }
212
- throw e;
213
- } finally {
214
- freeGlobalDependencyOnBuildArtifacts();
215
- await sentryBuildPluginManager.deleteArtifacts();
216
- }
217
- }
218
- const name = `sentry-${buildTool}-plugin`;
219
- const transformHook = buildTool === "vite" ? {
220
- filter: { id: JS_MODULE_ID_FILTER },
221
- handler: transform
222
- } : transform;
223
- const viteSourceMapHooks = buildTool === "vite" ? sourceMapHooks.createViteSourceMapHooks(sentryBuildPluginManager, sourceMapHandling$1) : void 0;
224
- const main = {
225
- name,
226
- buildStart,
227
- ...shouldTransform ? { transform: transformHook } : {},
228
- ...viteSourceMapHooks ? { configResolved: viteSourceMapHooks.configResolved } : { outputOptions: sourceMapHandling$1.outputOptions },
229
- renderChunk,
230
- generateBundle: { order: "pre", handler: generateBundle },
231
- writeBundle
232
- };
233
- const post = {
234
- name: buildTool === "vite" ? "sentry-vite-upload-staging" : "sentry-rollup-upload-staging",
235
- // On the post plugin, so framework plugins that set `build.sourcemap`
236
- // themselves run first and the decision sees the merged setting.
237
- ...viteSourceMapHooks ? { config: viteSourceMapHooks.config } : {},
238
- generateBundle: {
239
- order: "post",
240
- async handler(outputOptions, bundle, isWrite) {
241
- if (buildTool === "vite" && options.sourcemaps?.disable === "disable-upload") {
242
- debugIdStamping.stampDebugIds(bundle, false);
243
- }
244
- await sourceMapHandling$1.stageSourceMaps(outputOptions, bundle, isWrite);
245
- }
246
- }
247
- };
248
- return { main, post };
48
+ const sentryBuildPluginManager = require_build_plugin_manager.createSentryBuildPluginManager(userOptions, {
49
+ loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? `[sentry-${buildTool}-plugin]`,
50
+ buildTool,
51
+ buildToolMajorVersion: buildToolMajorVersion || getRollupMajorVersion()
52
+ });
53
+ const { logger, normalizedOptions: options, bundleSizeOptimizationReplacementValues: replacementValues, bundleMetadata, createDependencyOnBuildArtifacts } = sentryBuildPluginManager;
54
+ if (options.disable) return {
55
+ main: { name: "sentry-noop-plugin" },
56
+ post: void 0
57
+ };
58
+ if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) logger.warn("Running Sentry plugin from within a `node_modules` folder. Some features may not work.");
59
+ const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
60
+ const upload = require_debug_id_upload.createDebugIdUploadFunction({ sentryBuildPluginManager });
61
+ const sourcemapsEnabled = options.sourcemaps?.disable !== true;
62
+ const sourceMapHandling = require_source_map_handling.createSourceMapHandling(sentryBuildPluginManager);
63
+ const releaseInjectionCode = new require_utils.CodeInjection();
64
+ const chunkInjectionCode = new require_utils.CodeInjection();
65
+ if (!options.release.inject) logger.debug("Release injection disabled via `release.inject` option. Will not inject release.");
66
+ else if (!options.release.name) logger.debug("No release name provided. Will not inject release. Please set the `release.name` option to identify your release.");
67
+ else releaseInjectionCode.append(require_utils.generateReleaseInjectorCode({
68
+ release: options.release.name,
69
+ injectBuildInformation: options._experiments.injectBuildInformation || false
70
+ }));
71
+ if (Object.keys(bundleMetadata).length > 0) chunkInjectionCode.append(require_utils.generateModuleMetadataInjectorCode(bundleMetadata));
72
+ const transformAnnotations = options.reactComponentAnnotation?.enabled ? require_component_annotate_hooks.createComponentNameAnnotateHooks(options.reactComponentAnnotation?.ignoredComponents || [], !!options.reactComponentAnnotation?._experimentalInjectIntoHtml, {
73
+ getParseAstAsync: buildTool === "vite" && buildToolMajorVersion === "8" ? getViteParseAstAsync : void 0,
74
+ logger
75
+ }) : void 0;
76
+ const transformReplace = Object.keys(replacementValues).length > 0;
77
+ const shouldTransform = transformAnnotations || transformReplace;
78
+ function buildStart() {
79
+ sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {});
80
+ }
81
+ async function transform(code, id, meta) {
82
+ if (transformAnnotations) {
83
+ const result = await transformAnnotations.transform(code, id, meta);
84
+ if (result) return result;
85
+ }
86
+ if (transformReplace) return require_utils.replaceBooleanFlagsInCode(code, replacementValues);
87
+ return null;
88
+ }
89
+ function renderChunk(code, chunk, _, meta) {
90
+ if (!require_index.isJsFile(chunk.fileName)) return null;
91
+ if (require_index.shouldSkipCodeInjection(code, chunk.facadeModuleId)) return null;
92
+ const injectCode = new require_utils.CodeInjection();
93
+ if (require_index.isInitialChunk(chunk, meta?.chunks)) injectCode.append(releaseInjectionCode);
94
+ injectCode.append(chunkInjectionCode);
95
+ if (sourcemapsEnabled && !require_debug_id_injection.hasExistingDebugID(code)) {
96
+ const debugId = require_debug_id_injection.getDebugIdForChunk(code, !!this?.meta?.rolldownVersion);
97
+ injectCode.append(require_index.getDebugIdSnippet(debugId));
98
+ }
99
+ if (injectCode.isEmpty()) return null;
100
+ const ms = meta?.magicString || new magic_string.default(code, { filename: chunk.fileName });
101
+ const injectionPosition = require_get_code_injection_position.getCodeInjectionPosition(code);
102
+ const codeToInject = injectionPosition === code.length ? `\n${injectCode.code()}` : injectCode.code();
103
+ ms.appendLeft(injectionPosition, codeToInject);
104
+ if (ms?.constructor?.name === "BindingMagicString") return { code: ms };
105
+ return {
106
+ code: ms.toString(),
107
+ map: ms.generateMap({
108
+ file: chunk.fileName,
109
+ hires: "boundary"
110
+ })
111
+ };
112
+ }
113
+ /**
114
+ * Resolves Rolldown's placeholder debug IDs, then stamps debug IDs into the emitted chunks and
115
+ * source maps.
116
+ *
117
+ * `disable-upload` skips the upload routine (which stamps debug IDs into temp copies), so the emitted
118
+ * artifacts get stamped here instead. Not in `renderChunk`: minifiers running after it would strip the
119
+ * comment. Rollup computes `[hash]` file names before this hook, so only plugins that hash the final
120
+ * assets afterwards (e.g. subresource integrity) see the stamped content.
121
+ */
122
+ function generateBundle(_outputOptions, bundle) {
123
+ if (this?.meta?.rolldownVersion) require_debug_id_injection.finalizeRolldownDebugIds(bundle);
124
+ if (options.sourcemaps?.disable !== "disable-upload") return;
125
+ require_debug_id_stamping.stampDebugIds(bundle, true);
126
+ }
127
+ async function writeBundle(outputOptions, bundle) {
128
+ const staging = await sourceMapHandling.takeStaging(outputOptions, bundle);
129
+ let stagingHandedOver = false;
130
+ try {
131
+ await sentryBuildPluginManager.createRelease();
132
+ if (sourcemapsEnabled && options.sourcemaps?.disable !== "disable-upload") {
133
+ let buildArtifacts;
134
+ if (outputOptions.dir) {
135
+ const outputDir = outputOptions.dir;
136
+ const JS_AND_MAP_PATTERNS = [
137
+ "/**/*.js",
138
+ "/**/*.mjs",
139
+ "/**/*.cjs",
140
+ "/**/*.js.map",
141
+ "/**/*.mjs.map",
142
+ "/**/*.cjs.map"
143
+ ].map((q) => `${q}?(\\?*)?(#*)`);
144
+ buildArtifacts = await require_glob.globFiles(JS_AND_MAP_PATTERNS, { root: outputDir });
145
+ } else if (outputOptions.file) buildArtifacts = [outputOptions.file];
146
+ else buildArtifacts = Object.keys(bundle ?? {}).map((asset) => node_path.join(node_path.resolve(), asset));
147
+ stagingHandedOver = true;
148
+ await upload(buildArtifacts, { staging });
149
+ } else {
150
+ stagingHandedOver = true;
151
+ await staging?.discard();
152
+ }
153
+ } catch (e) {
154
+ if (!stagingHandedOver) await staging?.keep("The source map upload did not run.");
155
+ throw e;
156
+ } finally {
157
+ freeGlobalDependencyOnBuildArtifacts();
158
+ await sentryBuildPluginManager.deleteArtifacts();
159
+ }
160
+ }
161
+ const name = `sentry-${buildTool}-plugin`;
162
+ const transformHook = buildTool === "vite" ? {
163
+ filter: { id: JS_MODULE_ID_FILTER },
164
+ handler: transform
165
+ } : transform;
166
+ const viteSourceMapHooks = buildTool === "vite" ? require_source_map_hooks.createViteSourceMapHooks(sentryBuildPluginManager, sourceMapHandling) : void 0;
167
+ return {
168
+ main: {
169
+ name,
170
+ buildStart,
171
+ ...shouldTransform ? { transform: transformHook } : {},
172
+ ...viteSourceMapHooks ? { configResolved: viteSourceMapHooks.configResolved } : { outputOptions: sourceMapHandling.outputOptions },
173
+ renderChunk,
174
+ generateBundle: {
175
+ order: "pre",
176
+ handler: generateBundle
177
+ },
178
+ writeBundle
179
+ },
180
+ post: {
181
+ name: buildTool === "vite" ? "sentry-vite-upload-staging" : "sentry-rollup-upload-staging",
182
+ ...viteSourceMapHooks ? { config: viteSourceMapHooks.config } : {},
183
+ generateBundle: {
184
+ order: "post",
185
+ async handler(outputOptions, bundle, isWrite) {
186
+ if (buildTool === "vite" && options.sourcemaps?.disable === "disable-upload") require_debug_id_stamping.stampDebugIds(bundle, false);
187
+ await sourceMapHandling.stageSourceMaps(outputOptions, bundle, isWrite);
188
+ }
189
+ }
190
+ }
191
+ };
249
192
  }
193
+ /**
194
+ * @ignore - this is the internal plugin factory function only used for the Vite plugin!
195
+ */
250
196
  function _rollupPluginInternal(userOptions = {}, buildTool, buildToolMajorVersion) {
251
- return _createRollupPluginInternals(userOptions, buildTool, buildToolMajorVersion).main;
197
+ return _createRollupPluginInternals(userOptions, buildTool, buildToolMajorVersion).main;
252
198
  }
253
199
  function sentryRollupPlugin(userOptions = {}) {
254
- const { main, post } = _createRollupPluginInternals(userOptions, "rollup");
255
- return post ? [main, post] : [main];
200
+ const { main, post } = _createRollupPluginInternals(userOptions, "rollup");
201
+ return post ? [main, post] : [main];
256
202
  }
257
-
258
203
  exports._createRollupPluginInternals = _createRollupPluginInternals;
259
204
  exports._rollupPluginInternal = _rollupPluginInternal;
260
205
  exports.sentryRollupPlugin = sentryRollupPlugin;
261
- //# sourceMappingURL=index.js.map
206
+
207
+ //# sourceMappingURL=index.js.map