@sentry/wizard 6.11.0 → 6.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 (245) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/dist/bin.js +16 -1
  3. package/dist/bin.js.map +1 -1
  4. package/dist/e2e-tests/tests/angular-17.test.js +3 -4
  5. package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
  6. package/dist/e2e-tests/tests/angular-19.test.js +3 -4
  7. package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
  8. package/dist/e2e-tests/tests/cloudflare-worker.test.js +5 -0
  9. package/dist/e2e-tests/tests/cloudflare-worker.test.js.map +1 -1
  10. package/dist/e2e-tests/tests/flutter.test.js +60 -0
  11. package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
  12. package/dist/e2e-tests/tests/help-message.test.js +8 -3
  13. package/dist/e2e-tests/tests/help-message.test.js.map +1 -1
  14. package/dist/e2e-tests/tests/nuxt-3.test.js +12 -6
  15. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  16. package/dist/e2e-tests/tests/nuxt-4.test.js +12 -6
  17. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  18. package/dist/e2e-tests/tests/pnpm-workspace.test.js +8 -4
  19. package/dist/e2e-tests/tests/pnpm-workspace.test.js.map +1 -1
  20. package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js +96 -0
  21. package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js.map +1 -0
  22. package/dist/e2e-tests/tests/react-router.test.js +6 -7
  23. package/dist/e2e-tests/tests/react-router.test.js.map +1 -1
  24. package/dist/e2e-tests/tests/remix.test.js +2 -4
  25. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  26. package/dist/e2e-tests/tests/sveltekit-hooks.test.js +24 -8
  27. package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -1
  28. package/dist/e2e-tests/tests/sveltekit-tracing.test.js +8 -4
  29. package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
  30. package/dist/lib/Constants.d.ts +1 -0
  31. package/dist/lib/Constants.js +5 -0
  32. package/dist/lib/Constants.js.map +1 -1
  33. package/dist/lib/Steps/Integrations/Electron.js +2 -2
  34. package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
  35. package/dist/src/android/android-wizard.js +3 -0
  36. package/dist/src/android/android-wizard.js.map +1 -1
  37. package/dist/src/angular/codemods/main.d.ts +1 -1
  38. package/dist/src/angular/codemods/main.js +0 -1
  39. package/dist/src/angular/codemods/main.js.map +1 -1
  40. package/dist/src/apple/apple-wizard.js +2 -3
  41. package/dist/src/apple/apple-wizard.js.map +1 -1
  42. package/dist/src/apple/check-installed-cli.d.ts +1 -1
  43. package/dist/src/apple/check-installed-cli.js +13 -7
  44. package/dist/src/apple/check-installed-cli.js.map +1 -1
  45. package/dist/src/apple/code-tools.js +17 -3
  46. package/dist/src/apple/code-tools.js.map +1 -1
  47. package/dist/src/apple/configure-package-manager.js +18 -5
  48. package/dist/src/apple/configure-package-manager.js.map +1 -1
  49. package/dist/src/apple/configure-xcode-project.js +8 -1
  50. package/dist/src/apple/configure-xcode-project.js.map +1 -1
  51. package/dist/src/apple/lookup-xcode-project.d.ts +8 -5
  52. package/dist/src/apple/lookup-xcode-project.js +22 -17
  53. package/dist/src/apple/lookup-xcode-project.js.map +1 -1
  54. package/dist/src/apple/options.d.ts +5 -0
  55. package/dist/src/apple/options.js.map +1 -1
  56. package/dist/src/apple/sentry-swift-package.d.ts +4 -0
  57. package/dist/src/apple/sentry-swift-package.js +17 -0
  58. package/dist/src/apple/sentry-swift-package.js.map +1 -0
  59. package/dist/src/apple/snapshots/apple-snapshots-wizard.d.ts +2 -0
  60. package/dist/src/apple/snapshots/apple-snapshots-wizard.js +251 -0
  61. package/dist/src/apple/snapshots/apple-snapshots-wizard.js.map +1 -0
  62. package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.d.ts +13 -0
  63. package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js +48 -0
  64. package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js.map +1 -0
  65. package/dist/src/apple/snapshots/snapshot-test-file.d.ts +18 -0
  66. package/dist/src/apple/snapshots/snapshot-test-file.js +122 -0
  67. package/dist/src/apple/snapshots/snapshot-test-file.js.map +1 -0
  68. package/dist/src/apple/snapshots/snapshot-verification-scheme.d.ts +6 -0
  69. package/dist/src/apple/snapshots/snapshot-verification-scheme.js +147 -0
  70. package/dist/src/apple/snapshots/snapshot-verification-scheme.js.map +1 -0
  71. package/dist/src/apple/snapshots/snapshotpreviews-package.d.ts +4 -0
  72. package/dist/src/apple/snapshots/snapshotpreviews-package.js +8 -0
  73. package/dist/src/apple/snapshots/snapshotpreviews-package.js.map +1 -0
  74. package/dist/src/apple/snapshots/snapshots-cli-preflight.d.ts +23 -0
  75. package/dist/src/apple/snapshots/snapshots-cli-preflight.js +136 -0
  76. package/dist/src/apple/snapshots/snapshots-cli-preflight.js.map +1 -0
  77. package/dist/src/apple/xcode-manager.d.ts +59 -1
  78. package/dist/src/apple/xcode-manager.js +507 -106
  79. package/dist/src/apple/xcode-manager.js.map +1 -1
  80. package/dist/src/cloudflare/cloudflare-wizard.js +5 -0
  81. package/dist/src/cloudflare/cloudflare-wizard.js.map +1 -1
  82. package/dist/src/cloudflare/sdk-setup.d.ts +1 -0
  83. package/dist/src/cloudflare/sdk-setup.js.map +1 -1
  84. package/dist/src/cloudflare/templates.d.ts +1 -0
  85. package/dist/src/cloudflare/templates.js +7 -1
  86. package/dist/src/cloudflare/templates.js.map +1 -1
  87. package/dist/src/cloudflare/wrap-worker.d.ts +1 -0
  88. package/dist/src/cloudflare/wrap-worker.js +7 -0
  89. package/dist/src/cloudflare/wrap-worker.js.map +1 -1
  90. package/dist/src/flutter/flutter-wizard.js +3 -0
  91. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  92. package/dist/src/nextjs/templates.js +12 -6
  93. package/dist/src/nextjs/templates.js.map +1 -1
  94. package/dist/src/nuxt/templates.js +12 -6
  95. package/dist/src/nuxt/templates.js.map +1 -1
  96. package/dist/src/react-native/expo.d.ts +6 -0
  97. package/dist/src/react-native/expo.js +27 -1
  98. package/dist/src/react-native/expo.js.map +1 -1
  99. package/dist/src/react-native/git.d.ts +5 -0
  100. package/dist/src/react-native/git.js +32 -1
  101. package/dist/src/react-native/git.js.map +1 -1
  102. package/dist/src/react-native/javascript.js +3 -1
  103. package/dist/src/react-native/javascript.js.map +1 -1
  104. package/dist/src/react-native/react-native-wizard.js +12 -6
  105. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  106. package/dist/src/react-router/codemods/client.entry.d.ts +1 -1
  107. package/dist/src/react-router/codemods/client.entry.js +124 -26
  108. package/dist/src/react-router/codemods/client.entry.js.map +1 -1
  109. package/dist/src/react-router/codemods/react-router-config.js +1 -1
  110. package/dist/src/react-router/codemods/react-router-config.js.map +1 -1
  111. package/dist/src/react-router/codemods/server-entry.d.ts +1 -1
  112. package/dist/src/react-router/codemods/server-entry.js +40 -4
  113. package/dist/src/react-router/codemods/server-entry.js.map +1 -1
  114. package/dist/src/react-router/codemods/vite.js +46 -1
  115. package/dist/src/react-router/codemods/vite.js.map +1 -1
  116. package/dist/src/react-router/react-router-wizard.js +62 -21
  117. package/dist/src/react-router/react-router-wizard.js.map +1 -1
  118. package/dist/src/react-router/sdk-setup.d.ts +5 -3
  119. package/dist/src/react-router/sdk-setup.js +44 -16
  120. package/dist/src/react-router/sdk-setup.js.map +1 -1
  121. package/dist/src/react-router/templates.d.ts +2 -4
  122. package/dist/src/react-router/templates.js +89 -87
  123. package/dist/src/react-router/templates.js.map +1 -1
  124. package/dist/src/remix/sdk-setup.js +1 -2
  125. package/dist/src/remix/sdk-setup.js.map +1 -1
  126. package/dist/src/run.d.ts +4 -1
  127. package/dist/src/run.js +13 -0
  128. package/dist/src/run.js.map +1 -1
  129. package/dist/src/sourcemaps/tools/remix.js +4 -4
  130. package/dist/src/sourcemaps/tools/remix.js.map +1 -1
  131. package/dist/src/sourcemaps/tools/vite.js +1 -1
  132. package/dist/src/sourcemaps/tools/vite.js.map +1 -1
  133. package/dist/src/sveltekit/sdk-setup/setup.js +17 -4
  134. package/dist/src/sveltekit/sdk-setup/setup.js.map +1 -1
  135. package/dist/src/sveltekit/sdk-setup/vite.js +1 -1
  136. package/dist/src/sveltekit/sdk-setup/vite.js.map +1 -1
  137. package/dist/src/sveltekit/templates.js +12 -6
  138. package/dist/src/sveltekit/templates.js.map +1 -1
  139. package/dist/src/utils/ast-utils.d.ts +10 -0
  140. package/dist/src/utils/ast-utils.js +19 -1
  141. package/dist/src/utils/ast-utils.js.map +1 -1
  142. package/dist/src/utils/clack/index.d.ts +2 -1
  143. package/dist/src/utils/clack/index.js +17 -6
  144. package/dist/src/utils/clack/index.js.map +1 -1
  145. package/dist/src/utils/files.d.ts +2 -0
  146. package/dist/src/utils/files.js +58 -0
  147. package/dist/src/utils/files.js.map +1 -0
  148. package/dist/src/utils/git.d.ts +3 -1
  149. package/dist/src/utils/git.js +2 -1
  150. package/dist/src/utils/git.js.map +1 -1
  151. package/dist/src/utils/line-endings.d.ts +1 -0
  152. package/dist/src/utils/line-endings.js +76 -0
  153. package/dist/src/utils/line-endings.js.map +1 -0
  154. package/dist/src/version.d.ts +1 -1
  155. package/dist/src/version.js +1 -1
  156. package/dist/src/version.js.map +1 -1
  157. package/dist/test/angular/angular-wizard.test.js +0 -5
  158. package/dist/test/angular/angular-wizard.test.js.map +1 -1
  159. package/dist/test/apple/code-tools.test.js +78 -0
  160. package/dist/test/apple/code-tools.test.js.map +1 -1
  161. package/dist/test/apple/configure-package-manager.test.d.ts +1 -0
  162. package/dist/test/apple/configure-package-manager.test.js +161 -0
  163. package/dist/test/apple/configure-package-manager.test.js.map +1 -0
  164. package/dist/test/apple/lookup-xcode-project.test.d.ts +1 -0
  165. package/dist/test/apple/lookup-xcode-project.test.js +167 -0
  166. package/dist/test/apple/lookup-xcode-project.test.js.map +1 -0
  167. package/dist/test/apple/snapshots/apple-snapshots-wizard.test.d.ts +1 -0
  168. package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js +487 -0
  169. package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js.map +1 -0
  170. package/dist/test/apple/snapshots/hosted-test-target-fixture.d.ts +24 -0
  171. package/dist/test/apple/snapshots/hosted-test-target-fixture.js +191 -0
  172. package/dist/test/apple/snapshots/hosted-test-target-fixture.js.map +1 -0
  173. package/dist/test/apple/snapshots/snapshot-test-file.test.d.ts +1 -0
  174. package/dist/test/apple/snapshots/snapshot-test-file.test.js +110 -0
  175. package/dist/test/apple/snapshots/snapshot-test-file.test.js.map +1 -0
  176. package/dist/test/apple/snapshots/snapshot-verification-scheme.test.d.ts +1 -0
  177. package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js +146 -0
  178. package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js.map +1 -0
  179. package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.d.ts +1 -0
  180. package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js +186 -0
  181. package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js.map +1 -0
  182. package/dist/test/apple/snapshots/snapshots-cli-preflight.test.d.ts +1 -0
  183. package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js +192 -0
  184. package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js.map +1 -0
  185. package/dist/test/apple/snapshots/source-file-insertion.test.d.ts +1 -0
  186. package/dist/test/apple/snapshots/source-file-insertion.test.js +77 -0
  187. package/dist/test/apple/snapshots/source-file-insertion.test.js.map +1 -0
  188. package/dist/test/apple/xcode-manager.test.js +452 -43
  189. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  190. package/dist/test/cloudflare/sdk-setup.test.js +20 -2
  191. package/dist/test/cloudflare/sdk-setup.test.js.map +1 -1
  192. package/dist/test/cloudflare/templates.test.js +54 -0
  193. package/dist/test/cloudflare/templates.test.js.map +1 -1
  194. package/dist/test/cloudflare/wrap-worker.test.js +74 -11
  195. package/dist/test/cloudflare/wrap-worker.test.js.map +1 -1
  196. package/dist/test/constants.test.d.ts +1 -0
  197. package/dist/test/constants.test.js +12 -0
  198. package/dist/test/constants.test.js.map +1 -0
  199. package/dist/test/nextjs/templates.test.js +66 -33
  200. package/dist/test/nextjs/templates.test.js.map +1 -1
  201. package/dist/test/nuxt/templates.test.js +66 -36
  202. package/dist/test/nuxt/templates.test.js.map +1 -1
  203. package/dist/test/react-native/expo.test.js +140 -0
  204. package/dist/test/react-native/expo.test.js.map +1 -1
  205. package/dist/test/react-native/git.test.d.ts +1 -0
  206. package/dist/test/react-native/git.test.js +160 -0
  207. package/dist/test/react-native/git.test.js.map +1 -0
  208. package/dist/test/react-router/codemods/client-entry.test.js +38 -5
  209. package/dist/test/react-router/codemods/client-entry.test.js.map +1 -1
  210. package/dist/test/react-router/codemods/server-entry.test.js +83 -0
  211. package/dist/test/react-router/codemods/server-entry.test.js.map +1 -1
  212. package/dist/test/react-router/codemods/vite.test.js +89 -0
  213. package/dist/test/react-router/codemods/vite.test.js.map +1 -1
  214. package/dist/test/react-router/sdk-setup.test.js +98 -6
  215. package/dist/test/react-router/sdk-setup.test.js.map +1 -1
  216. package/dist/test/react-router/templates.test.js +50 -38
  217. package/dist/test/react-router/templates.test.js.map +1 -1
  218. package/dist/test/remix/build-script.test.d.ts +1 -0
  219. package/dist/test/remix/build-script.test.js +124 -0
  220. package/dist/test/remix/build-script.test.js.map +1 -0
  221. package/dist/test/remix/client-entry.test.js +4 -10
  222. package/dist/test/remix/client-entry.test.js.map +1 -1
  223. package/dist/test/run.test.d.ts +1 -0
  224. package/dist/test/run.test.js +137 -0
  225. package/dist/test/run.test.js.map +1 -0
  226. package/dist/test/sourcemaps/tools/vite.test.js +12 -8
  227. package/dist/test/sourcemaps/tools/vite.test.js.map +1 -1
  228. package/dist/test/sveltekit/templates.test.js +78 -27
  229. package/dist/test/sveltekit/templates.test.js.map +1 -1
  230. package/dist/test/utils/ast-utils.test.js +22 -0
  231. package/dist/test/utils/ast-utils.test.js.map +1 -1
  232. package/dist/test/utils/clack/index.test.js +101 -0
  233. package/dist/test/utils/clack/index.test.js.map +1 -1
  234. package/dist/test/utils/git.test.js +10 -0
  235. package/dist/test/utils/git.test.js.map +1 -1
  236. package/dist/test/utils/line-endings.test.d.ts +1 -0
  237. package/dist/test/utils/line-endings.test.js +103 -0
  238. package/dist/test/utils/line-endings.test.js.map +1 -0
  239. package/package.json +2 -2
  240. package/dist/src/react-router/codemods/root.d.ts +0 -1
  241. package/dist/src/react-router/codemods/root.js +0 -171
  242. package/dist/src/react-router/codemods/root.js.map +0 -1
  243. package/dist/test/react-router/codemods/root.test.js +0 -178
  244. package/dist/test/react-router/codemods/root.test.js.map +0 -1
  245. /package/dist/{test/react-router/codemods/root.test.d.ts → e2e-tests/tests/react-router-instrumentation-api.test.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/react-router/templates.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;AAEjD,SAAS,6BAA6B,CACpC,YAAqB,EACrB,qBAAqB,GAAG,KAAK;IAE7B,MAAM,eAAe,GAAG,YAAY;QAClC,CAAC,CAAC,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,4BAA4B,EAAE;QACxE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAE7B,MAAM,WAAW,GAAG,qBAAqB;QACvC,CAAC,CAAC,0EAA0E;QAC5E,CAAC,CAAC,2FAA2F,CAAC;IAEhG,OAAO,mCAAmC,eAAe,CAAC,KAAK;;;aAGpD,eAAe,CAAC,KAAK;;;;;;;;;MAS5B,WAAW;;;;;;;;;;;;;;;;EAgBf,CAAC;AACH,CAAC;AAEY,QAAA,uBAAuB,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAA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CAAC,YAAY,CAAC;IAClB,IAAI,CAAC;;KAEJ,CAAC;;;;;;;KAOD,CAAC;QACA,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,CACf,0DAA0D,CAC3D;;;IAGL,IAAI,CAAC,YAAY,CAAC;IAClB,IAAI,CAAC;;KAEJ,CAAC;;;;;;;KAOD,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AArCW,QAAA,iCAAiC,qCAqC5C;AAEK,MAAM,0BAA0B,GAAG,CACxC,OAAe,EACf,WAAmB,EACnB,EAAE;IACF,OAAO,IAAA,uBAAe,EAAC,IAAI,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAC/C,SAAS,CAAC,GAAG,IAAI,CACf,2DAA2D,CAC5D;;;;;;;QAOG,IAAI,CAAC;gBACG,OAAO;oBACH,WAAW;;kBAEb,CAAC;;;IAGf,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,0BAA0B,8BAuBrC","sourcesContent":["import { makeCodeSnippet } from '../utils/clack';\n\nfunction generateErrorBoundaryTemplate(\n isTypeScript: boolean,\n forManualInstructions = false,\n): string {\n const typeAnnotations = isTypeScript\n ? { stack: ': string | undefined', props: ': Route.ErrorBoundaryProps' }\n : { stack: '', props: '' };\n\n const commentLine = forManualInstructions\n ? '// you only want to capture non 404-errors that reach the boundary\\n '\n : '// Only capture non-404 errors (all errors here are already non-RouteErrorResponse)\\n ';\n\n return `function ErrorBoundary({ error }${typeAnnotations.props}) {\n let message = \"Oops!\";\n let details = \"An unexpected error occurred.\";\n let stack${typeAnnotations.stack};\n\n if (isRouteErrorResponse(error)) {\n message = error.status === 404 ? \"404\" : \"Error\";\n details =\n error.status === 404\n ? \"The requested page could not be found.\"\n : error.statusText || details;\n } else if (error && error instanceof Error) {\n ${commentLine}Sentry.captureException(error);\n details = error.message;\n stack = error.stack;\n }\n\n return (\n <main>\n <h1>{message}</h1>\n <p>{details}</p>\n {stack && (\n <pre>\n <code>{stack}</code>\n </pre>\n )}\n </main>\n );\n}`;\n}\n\nexport const ERROR_BOUNDARY_TEMPLATE = generateErrorBoundaryTemplate(false);\n\nexport const EXAMPLE_PAGE_TEMPLATE_TSX = `import type { Route } from \"./+types/sentry-example-page\";\n\nexport async function loader() {\n throw new Error(\"some error thrown in a loader\");\n}\n\nexport default function SentryExamplePage() {\n return <div>Loading this page will throw an error</div>;\n}`;\n\nexport const EXAMPLE_PAGE_TEMPLATE_JSX = `export async function loader() {\n throw new Error(\"some error thrown in a loader\");\n}\n\nexport default function SentryExamplePage() {\n return <div>Loading this page will throw an error</div>;\n}`;\n\nfunction generateServerInstrumentationCode(\n dsn: string,\n enableTracing: boolean,\n enableProfiling: boolean,\n enableLogs: boolean,\n): string {\n return `import * as Sentry from '@sentry/react-router';${\n enableProfiling\n ? `\\nimport { nodeProfilingIntegration } from '@sentry/profiling-node';`\n : ''\n }\n\nSentry.init({\n dsn: \"${dsn}\",\n\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options/#sendDefaultPii\n sendDefaultPii: true,${\n enableLogs\n ? '\\n\\n // Enable logs to be sent to Sentry\\n enableLogs: true,'\n : ''\n }${enableProfiling ? '\\n\\n integrations: [nodeProfilingIntegration()],' : ''}\n tracesSampleRate: ${enableTracing ? '1.0' : '0'}, ${\n enableTracing ? '// Capture 100% of the transactions' : ''\n }${\n enableProfiling\n ? '\\n profilesSampleRate: 1.0, // profile every transaction'\n : ''\n }${\n enableTracing\n ? `\n\n // Set up performance monitoring\n beforeSend(event) {\n // Filter out 404s from error reporting\n if (event.exception) {\n const error = event.exception.values?.[0];\n if (error?.type === \"NotFoundException\" || error?.value?.includes(\"404\")) {\n return null;\n }\n }\n return event;\n },`\n : ''\n }\n});`;\n}\n\nexport const getSentryInstrumentationServerContent = (\n dsn: string,\n enableTracing: boolean,\n enableProfiling = false,\n enableLogs = false,\n) => {\n return generateServerInstrumentationCode(\n dsn,\n enableTracing,\n enableProfiling,\n enableLogs,\n );\n};\n\nexport const getManualClientEntryContent = (\n dsn: string,\n enableTracing: boolean,\n enableReplay: boolean,\n enableLogs: boolean,\n) => {\n const integrations = [];\n\n if (enableTracing) {\n integrations.push('Sentry.reactRouterTracingIntegration()');\n }\n\n if (enableReplay) {\n integrations.push('Sentry.replayIntegration()');\n }\n\n const integrationsStr =\n integrations.length > 0 ? integrations.join(',\\n ') : '';\n\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { startTransition, StrictMode } from 'react';\nimport { hydrateRoot } from 'react-dom/client';\nimport { HydratedRouter } from 'react-router/dom';\n\n${plus(`Sentry.init({\n dsn: \"${dsn}\",\n\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n integrations: [\n ${integrationsStr}\n ],\n\n ${\n enableLogs\n ? '// Enable logs to be sent to Sentry\\n enableLogs: true,\\n\\n '\n : ''\n }tracesSampleRate: ${enableTracing ? '1.0' : '0'},${\n enableTracing ? ' // Capture 100% of the transactions' : ''\n}${\n enableTracing\n ? '\\n\\n // Set `tracePropagationTargets` to declare which URL(s) should have trace propagation enabled\\n // In production, replace \"yourserver.io\" with your actual backend domain\\n tracePropagationTargets: [/^\\\\//, /^https:\\\\/\\\\/yourserver\\\\.io\\\\/api/],'\n : ''\n}${\n enableReplay\n ? '\\n\\n // Capture Replay for 10% of all sessions,\\n // plus 100% of sessions with an error\\n replaysSessionSampleRate: 0.1,\\n replaysOnErrorSampleRate: 1.0,'\n : ''\n}\n});`)}\n\nstartTransition(() => {\n hydrateRoot(\n document,\n <StrictMode>\n <HydratedRouter />\n </StrictMode>\n );\n});`),\n );\n};\n\nexport const getManualServerEntryContent = () => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { createReadableStreamFromReadable } from '@react-router/node';\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { ServerRouter } from 'react-router';\n\n${plus(`const handleRequest = Sentry.createSentryHandleRequest({\n ServerRouter,\n renderToPipeableStream,\n createReadableStreamFromReadable,\n});`)}\n\nexport default handleRequest;\n\n${plus(`export const handleError = Sentry.createSentryHandleError({\n logErrors: false\n});`)}\n\n// ... rest of your server entry`),\n );\n};\n\nexport const getManualHandleRequestContent = () => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { createReadableStreamFromReadable } from '@react-router/node';\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { ServerRouter } from 'react-router';\n\n${plus(`// Replace your existing handleRequest function with this Sentry-wrapped version:\nconst handleRequest = Sentry.createSentryHandleRequest({\n ServerRouter,\n renderToPipeableStream,\n createReadableStreamFromReadable,\n});`)}\n\n${plus(`// If you have a custom handleRequest implementation, wrap it like this:\n// export default Sentry.wrapSentryHandleRequest(yourCustomHandleRequest);`)}\n\nexport default handleRequest;`),\n );\n};\n\nexport const getManualRootContent = (isTs: boolean) => {\n const typeAnnotations = isTs\n ? { stack: ': string | undefined', props: ': Route.ErrorBoundaryProps' }\n : { stack: '', props: '' };\n\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\n\nexport function ErrorBoundary({ error }${typeAnnotations.props}) {\n let message = \"Oops!\";\n let details = \"An unexpected error occurred.\";\n let stack${typeAnnotations.stack};\n\n if (isRouteErrorResponse(error)) {\n message = error.status === 404 ? \"404\" : \"Error\";\n details =\n error.status === 404\n ? \"The requested page could not be found.\"\n : error.statusText || details;\n } else if (error && error instanceof Error) {\n // you only want to capture non 404-errors that reach the boundary\n ${plus('Sentry.captureException(error);')}\n details = error.message;\n stack = error.stack;\n }\n\n return (\n <main>\n <h1>{message}</h1>\n <p>{details}</p>\n {stack && (\n <pre>\n <code>{stack}</code>\n </pre>\n )}\n </main>\n );\n}\n// ...`),\n );\n};\n\nexport const getManualServerInstrumentContent = (\n dsn: string,\n enableTracing: boolean,\n enableProfiling: boolean,\n enableLogs = false,\n) => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n plus(\n generateServerInstrumentationCode(\n dsn,\n enableTracing,\n enableProfiling,\n enableLogs,\n ),\n ),\n );\n};\n\nexport const getManualReactRouterConfigContent = (isTS = true) => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n isTS\n ? unchanged(`${plus(\n 'import type { Config } from \"@react-router/dev/config\";',\n )}\n${plus(\"import { sentryOnBuildEnd } from '@sentry/react-router';\")}\n\nexport default {\n ${plus('ssr: true,')}\n ${plus(`buildEnd: async ({ viteConfig, reactRouterConfig, buildManifest }) => {\n await sentryOnBuildEnd({ viteConfig, reactRouterConfig, buildManifest });\n },`)}\n} satisfies Config;\n\n// If you already have a buildEnd hook, modify it to call sentryOnBuildEnd:\n// buildEnd: async (args) => {\n// await yourExistingLogic(args);\n// await sentryOnBuildEnd(args);\n// }`)\n : unchanged(`${plus(\n \"import { sentryOnBuildEnd } from '@sentry/react-router';\",\n )}\n\nexport default {\n ${plus('ssr: true,')}\n ${plus(`buildEnd: async ({ viteConfig, reactRouterConfig, buildManifest }) => {\n await sentryOnBuildEnd({ viteConfig, reactRouterConfig, buildManifest });\n },`)}\n};\n\n// If you already have a buildEnd hook, modify it to call sentryOnBuildEnd:\n// buildEnd: async (args) => {\n// await yourExistingLogic(args);\n// await sentryOnBuildEnd(args);\n// }`),\n );\n};\n\nexport const getManualViteConfigContent = (\n orgSlug: string,\n projectSlug: string,\n) => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\n \"import { sentryReactRouter } from '@sentry/react-router';\",\n )}\nimport { defineConfig } from 'vite';\n\nexport default defineConfig(config => {\n return {\n plugins: [\n // ... your existing plugins\n ${plus(`sentryReactRouter({\n org: \"${orgSlug}\",\n project: \"${projectSlug}\",\n authToken: process.env.SENTRY_AUTH_TOKEN,\n }, config),`)}\n ],\n };\n});`),\n );\n};\n"]}
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/react-router/templates.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;AAEpC,QAAA,yBAAyB,GAAG;;;;;;;;EAQvC,CAAC;AAEU,QAAA,yBAAyB,GAAG;;;;;;EAMvC,CAAC;AAEH,SAAS,iCAAiC,CACxC,GAAW,EACX,aAAsB,EACtB,eAAwB,EACxB,UAAmB;IAEnB,OAAO,kDACL,eAAe;QACb,CAAC,CAAC,sEAAsE;QACxE,CAAC,CAAC,EACN;;;UAGQ,GAAG;;;;;;;MAQT,UAAU;QACR,CAAC,CAAC,gEAAgE;QAClE,CAAC,CAAC,EACN,GAAG,eAAe,CAAC,CAAC,CAAC,mDAAmD,CAAC,CAAC,CAAC,EAAE;sBACzD,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAC7C,aAAa,CAAC,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAC,EAC1D,GACE,eAAe;QACb,CAAC,CAAC,2DAA2D;QAC7D,CAAC,CAAC,EACN,GACE,aAAa;QACX,CAAC,CAAC;;;;;;;;;;;;KAYH;QACC,CAAC,CAAC,EACN;IACE,CAAC;AACL,CAAC;AAEM,MAAM,qCAAqC,GAAG,CACnD,GAAW,EACX,aAAsB,EACtB,eAAe,GAAG,KAAK,EACvB,UAAU,GAAG,KAAK,EAClB,EAAE;IACF,OAAO,iCAAiC,CACtC,GAAG,EACH,aAAa,EACb,eAAe,EACf,UAAU,CACX,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,qCAAqC,yCAYhD;AAEK,MAAM,2BAA2B,GAAG,CACzC,GAAW,EACX,aAAsB,EACtB,YAAqB,EACrB,UAAmB,EACnB,qBAAqB,GAAG,KAAK,EAC7B,UAAU,GAAG,KAAK,EAClB,EAAE;IACF,IAAI,qBAAqB,IAAI,aAAa,EAAE;QAC1C,MAAM,YAAY,GAAG,CAAC,SAAS,CAAC,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AAI,CAAC;gBACG,OAAO;oBACH,WAAW;;kBAEb,CAAC;;MAEb,IAAI,CAAC;;OAEJ,CAAC;;IAEJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AA1BW,QAAA,0BAA0B,8BA0BrC","sourcesContent":["import { makeCodeSnippet } from '../utils/clack';\n\nexport const EXAMPLE_PAGE_TEMPLATE_TSX = `import type { Route } from \"./+types/sentry-example-page\";\n\nexport async function loader() {\n throw new Error(\"some error thrown in a loader\");\n}\n\nexport default function SentryExamplePage() {\n return <div>Loading this page will throw an error</div>;\n}`;\n\nexport const EXAMPLE_PAGE_TEMPLATE_JSX = `export async function loader() {\n throw new Error(\"some error thrown in a loader\");\n}\n\nexport default function SentryExamplePage() {\n return <div>Loading this page will throw an error</div>;\n}`;\n\nfunction generateServerInstrumentationCode(\n dsn: string,\n enableTracing: boolean,\n enableProfiling: boolean,\n enableLogs: boolean,\n): string {\n return `import * as Sentry from '@sentry/react-router';${\n enableProfiling\n ? `\\nimport { nodeProfilingIntegration } from '@sentry/profiling-node';`\n : ''\n }\n\nSentry.init({\n dsn: \"${dsn}\",\n\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },${\n enableLogs\n ? '\\n\\n // Enable logs to be sent to Sentry\\n enableLogs: true,'\n : ''\n }${enableProfiling ? '\\n\\n integrations: [nodeProfilingIntegration()],' : ''}\n tracesSampleRate: ${enableTracing ? '1.0' : '0'}, ${\n enableTracing ? '// Capture 100% of the transactions' : ''\n }${\n enableProfiling\n ? '\\n profilesSampleRate: 1.0, // profile every transaction'\n : ''\n }${\n enableTracing\n ? `\n\n // Set up performance monitoring\n beforeSend(event) {\n // Filter out 404s from error reporting\n if (event.exception) {\n const error = event.exception.values?.[0];\n if (error?.type === \"NotFoundException\" || error?.value?.includes(\"404\")) {\n return null;\n }\n }\n return event;\n },`\n : ''\n }\n});`;\n}\n\nexport const getSentryInstrumentationServerContent = (\n dsn: string,\n enableTracing: boolean,\n enableProfiling = false,\n enableLogs = false,\n) => {\n return generateServerInstrumentationCode(\n dsn,\n enableTracing,\n enableProfiling,\n enableLogs,\n );\n};\n\nexport const getManualClientEntryContent = (\n dsn: string,\n enableTracing: boolean,\n enableReplay: boolean,\n enableLogs: boolean,\n useInstrumentationAPI = false,\n useOnError = false,\n) => {\n if (useInstrumentationAPI && enableTracing) {\n const integrations = ['tracing'];\n if (enableReplay) {\n integrations.push('Sentry.replayIntegration()');\n }\n\n const integrationsStr = integrations.join(',\\n ');\n\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { startTransition, StrictMode } from 'react';\nimport { hydrateRoot } from 'react-dom/client';\nimport { HydratedRouter } from 'react-router/dom';\n\n${plus(`const tracing = Sentry.reactRouterTracingIntegration();`)}\n\n${plus(`Sentry.init({\n dsn: \"${dsn}\",\n\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n integrations: [\n ${integrationsStr}\n ],\n\n ${\n enableLogs\n ? '// Enable logs to be sent to Sentry\\n enableLogs: true,\\n\\n '\n : ''\n }tracesSampleRate: 1.0, // Capture 100% of the transactions\n\n // Set \\`tracePropagationTargets\\` to declare which URL(s) should have trace propagation enabled\n // In production, replace \"yourserver.io\" with your actual backend domain\n tracePropagationTargets: [/^\\\\//, /^https:\\\\/\\\\/yourserver\\\\.io\\\\/api/],${\n enableReplay\n ? '\\n\\n // Capture Replay for 10% of all sessions,\\n // plus 100% of sessions with an error\\n replaysSessionSampleRate: 0.1,\\n replaysOnErrorSampleRate: 1.0,'\n : ''\n }\n});`)}\n\nstartTransition(() => {\n hydrateRoot(\n document,\n <StrictMode>\n ${plus(\n `<HydratedRouter${\n useOnError ? ' onError={Sentry.sentryOnError}' : ''\n } instrumentations={[tracing.clientInstrumentation]} />`,\n )}\n </StrictMode>\n );\n});`),\n );\n }\n\n const integrations = [];\n\n if (enableTracing) {\n integrations.push('Sentry.reactRouterTracingIntegration()');\n }\n\n if (enableReplay) {\n integrations.push('Sentry.replayIntegration()');\n }\n\n const integrationsStr =\n integrations.length > 0 ? integrations.join(',\\n ') : '';\n\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { startTransition, StrictMode } from 'react';\nimport { hydrateRoot } from 'react-dom/client';\nimport { HydratedRouter } from 'react-router/dom';\n\n${plus(`Sentry.init({\n dsn: \"${dsn}\",\n\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n integrations: [\n ${integrationsStr}\n ],\n\n ${\n enableLogs\n ? '// Enable logs to be sent to Sentry\\n enableLogs: true,\\n\\n '\n : ''\n }tracesSampleRate: ${enableTracing ? '1.0' : '0'},${\n enableTracing ? ' // Capture 100% of the transactions' : ''\n}${\n enableTracing\n ? '\\n\\n // Set `tracePropagationTargets` to declare which URL(s) should have trace propagation enabled\\n // In production, replace \"yourserver.io\" with your actual backend domain\\n tracePropagationTargets: [/^\\\\//, /^https:\\\\/\\\\/yourserver\\\\.io\\\\/api/],'\n : ''\n}${\n enableReplay\n ? '\\n\\n // Capture Replay for 10% of all sessions,\\n // plus 100% of sessions with an error\\n replaysSessionSampleRate: 0.1,\\n replaysOnErrorSampleRate: 1.0,'\n : ''\n}\n});`)}\n\nstartTransition(() => {\n hydrateRoot(\n document,\n <StrictMode>\n ${plus(\n `<HydratedRouter${\n useOnError ? ' onError={Sentry.sentryOnError}' : ''\n } />`,\n )}\n </StrictMode>\n );\n});`),\n );\n};\n\nexport const getManualServerEntryContent = (useInstrumentationAPI = false) => {\n if (useInstrumentationAPI) {\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { createReadableStreamFromReadable } from '@react-router/node';\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { ServerRouter } from 'react-router';\n\n${plus(`const handleRequest = Sentry.createSentryHandleRequest({\n ServerRouter,\n renderToPipeableStream,\n createReadableStreamFromReadable,\n});`)}\n\nexport default handleRequest;\n\n${plus(`export const handleError = Sentry.createSentryHandleError({\n logErrors: false\n});`)}\n\n${plus(`// Enable automatic server-side instrumentation for loaders, actions, middleware\nexport const instrumentations = [Sentry.createSentryServerInstrumentation()];`)}\n\n// ... rest of your server entry`),\n );\n }\n\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { createReadableStreamFromReadable } from '@react-router/node';\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { ServerRouter } from 'react-router';\n\n${plus(`const handleRequest = Sentry.createSentryHandleRequest({\n ServerRouter,\n renderToPipeableStream,\n createReadableStreamFromReadable,\n});`)}\n\nexport default handleRequest;\n\n${plus(`export const handleError = Sentry.createSentryHandleError({\n logErrors: false\n});`)}\n\n// ... rest of your server entry`),\n );\n};\n\nexport const getManualHandleRequestContent = () => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\"import * as Sentry from '@sentry/react-router';\")}\nimport { createReadableStreamFromReadable } from '@react-router/node';\nimport { renderToPipeableStream } from 'react-dom/server';\nimport { ServerRouter } from 'react-router';\n\n${plus(`// Replace your existing handleRequest function with this Sentry-wrapped version:\nconst handleRequest = Sentry.createSentryHandleRequest({\n ServerRouter,\n renderToPipeableStream,\n createReadableStreamFromReadable,\n});`)}\n\n${plus(`// If you have a custom handleRequest implementation, wrap it like this:\n// export default Sentry.wrapSentryHandleRequest(yourCustomHandleRequest);`)}\n\nexport default handleRequest;`),\n );\n};\n\nexport const getManualServerInstrumentContent = (\n dsn: string,\n enableTracing: boolean,\n enableProfiling: boolean,\n enableLogs = false,\n) => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n plus(\n generateServerInstrumentationCode(\n dsn,\n enableTracing,\n enableProfiling,\n enableLogs,\n ),\n ),\n );\n};\n\nexport const getManualReactRouterConfigContent = (isTS = true) => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n isTS\n ? unchanged(`${plus(\n 'import type { Config } from \"@react-router/dev/config\";',\n )}\n${plus(\"import { sentryOnBuildEnd } from '@sentry/react-router';\")}\n\nexport default {\n ${plus('ssr: true,')}\n ${plus(`buildEnd: async ({ viteConfig, reactRouterConfig, buildManifest }) => {\n await sentryOnBuildEnd({ viteConfig, reactRouterConfig, buildManifest });\n },`)}\n} satisfies Config;\n\n// If you already have a buildEnd hook, modify it to call sentryOnBuildEnd:\n// buildEnd: async (args) => {\n// await yourExistingLogic(args);\n// await sentryOnBuildEnd(args);\n// }`)\n : unchanged(`${plus(\n \"import { sentryOnBuildEnd } from '@sentry/react-router';\",\n )}\n\nexport default {\n ${plus('ssr: true,')}\n ${plus(`buildEnd: async ({ viteConfig, reactRouterConfig, buildManifest }) => {\n await sentryOnBuildEnd({ viteConfig, reactRouterConfig, buildManifest });\n },`)}\n};\n\n// If you already have a buildEnd hook, modify it to call sentryOnBuildEnd:\n// buildEnd: async (args) => {\n// await yourExistingLogic(args);\n// await sentryOnBuildEnd(args);\n// }`),\n );\n};\n\nexport const getManualViteConfigContent = (\n orgSlug: string,\n projectSlug: string,\n) => {\n return makeCodeSnippet(true, (unchanged, plus) =>\n unchanged(`${plus(\n \"import { sentryReactRouter } from '@sentry/react-router';\",\n )}\nimport { defineConfig } from 'vite';\n\nexport default defineConfig(config => {\n return {\n plugins: [\n // ... your existing plugins\n ${plus(`sentryReactRouter({\n org: \"${orgSlug}\",\n project: \"${projectSlug}\",\n authToken: process.env.SENTRY_AUTH_TOKEN,\n }, config),`)}\n ],\n ${plus(`optimizeDeps: {\n exclude: ['@sentry/react-router'],\n },`)}\n };\n});`),\n );\n};\n"]}
@@ -87,7 +87,6 @@ function getInitCallArgs(dsn, type, selectedFeatures) {
87
87
  initCallArgs.replaysSessionSampleRate = 0.1;
88
88
  initCallArgs.replaysOnErrorSampleRate = 1.0;
89
89
  }
90
- initCallArgs.sendDefaultPii = true;
91
90
  }
92
91
  return initCallArgs;
93
92
  }
@@ -195,7 +194,7 @@ async function updateBuildScript(args) {
195
194
  const buildCommand = args.isHydrogen
196
195
  ? 'shopify hydrogen build'
197
196
  : 'remix build';
198
- const instrumentedBuildCommand = `${buildCommand} --sourcemap && sentry-upload-sourcemaps --org ${args.org} --project ${args.project}` +
197
+ const instrumentedBuildCommand = `${buildCommand} --sourcemap && npx @sentry/remix --upload-sourcemaps --org ${args.org} --project ${args.project}` +
199
198
  (args.url ? ` --url ${args.url}` : '') +
200
199
  (args.isHydrogen ? ' --buildPath ./dist' : '');
201
200
  if (!packageJson.scripts.build) {
@@ -1 +1 @@
1
- {"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/remix/sdk-setup.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAO5D,uCAAyB;AACzB,2CAA6B;AAC7B,yCAA2B;AAC3B,4DAA8C;AAE9C,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAC1B,mCAAyC;AAEzC,uCAOkB;AAElB,wDAA0D;AAC1D,mCAIiB;AACjB,0CAAiD;AACjD,0DAAgE;AAChE,0CAAmD;AACnD,8DAAkF;AAMlF,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAC5C,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEhD,SAAgB,cAAc,CAAC,IAAa;IAC1C,qCAAqC;IACrC,MAAM,mBAAmB,GAAG,gBAAgB,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;IACnE,MAAM,mBAAmB,GAAG,gBAAgB,IAAI,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AAG,IAAA,oCAAqB,EACnD,sBAAsB,EACtB,mBAAmB,CACpB,CAAC;IAEF,IAAI,uBAAuB,EAAE;QAC3B,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,gBAAgB,eAAK,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,eAAK,CAAC,IAAI,CACxD,GAAG,mBAAmB,EAAE,CACzB,EAAE,CACJ,CAAC;KACH;IAED,MAAM,IAAA,oBAAS,EACb,sBAAsB,CAAC,IAAI,EAC3B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,mBAAmB,CAAC,CACrD,CAAC;IAEF,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,yDAAyD,eAAK,CAAC,IAAI,CACjE,mBAAmB,CACpB,GAAG,CACL,CAAC;AACJ,CAAC;AA9CD,sEA8CC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\nimport type { Program } from '@babel/types';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport type { Proxified, ProxifiedModule } from 'magicast';\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as url from 'url';\nimport * as childProcess from 'child_process';\n\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { gte, minVersion } from 'semver';\n\nimport {\n builders,\n generateCode,\n loadFile,\n parseModule,\n writeFile,\n // @ts-expect-error - magicast is ESM and TS complains about that. It works though\n} from 'magicast';\nimport type { PackageDotJson } from '../utils/package-json';\nimport { getPackageVersion } from '../utils/package-json';\nimport {\n getAfterImportsInsertionIndex,\n hasSentryContent,\n serverHasInstrumentationImport,\n} from './utils';\nimport { instrumentRoot } from './codemods/root';\nimport { instrumentHandleError } from './codemods/handle-error';\nimport { getPackageDotJson } from '../utils/clack';\nimport { findCustomExpressServerImplementation } from './codemods/express-server';\n\nexport type PartialRemixConfig = {\n unstable_dev?: boolean;\n};\n\nconst REMIX_CONFIG_FILE = 'remix.config.js';\nconst REMIX_REVEAL_COMMAND = 'npx remix reveal';\n\nexport function runRemixReveal(isTS: boolean): void {\n // Check if entry files already exist\n const clientEntryFilename = `entry.client.${isTS ? 'tsx' : 'jsx'}`;\n const serverEntryFilename = `entry.server.${isTS ? 'tsx' : 'jsx'}`;\n\n const clientEntryPath = path.join(process.cwd(), 'app', clientEntryFilename);\n const serverEntryPath = path.join(process.cwd(), 'app', serverEntryFilename);\n\n if (fs.existsSync(clientEntryPath) && fs.existsSync(serverEntryPath)) {\n clack.log.info(\n `Found entry files ${chalk.cyan(clientEntryFilename)} and ${chalk.cyan(\n serverEntryFilename,\n )}.`,\n );\n } else {\n clack.log.info(\n `Couldn't find entry files in your project. Trying to run ${chalk.cyan(\n REMIX_REVEAL_COMMAND,\n )}...`,\n );\n\n clack.log.info(childProcess.execSync(REMIX_REVEAL_COMMAND).toString());\n }\n}\n\ninterface SdkAstOptions {\n dsn: string;\n tracesSampleRate?: number;\n replaysSessionSampleRate?: number;\n replaysOnErrorSampleRate?: number;\n integrations?: Array<Proxified>;\n enableLogs?: boolean;\n sendDefaultPii?: boolean;\n}\n\nfunction getInitCallArgs(\n dsn: string,\n type: 'client' | 'server',\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n const initCallArgs: SdkAstOptions = {\n dsn,\n };\n\n // Adding tracing sample rate for both client and server\n if (selectedFeatures.performance) {\n initCallArgs.tracesSampleRate = 1.0;\n }\n\n // Adding logs for both client and server\n if (selectedFeatures.logs) {\n initCallArgs.enableLogs = true;\n }\n\n // Adding integrations and replay options only for client\n if (\n type === 'client' &&\n (selectedFeatures.performance || selectedFeatures.replay)\n ) {\n initCallArgs.integrations = [] as Array<Proxified>;\n\n if (selectedFeatures.performance) {\n initCallArgs.integrations.push(\n builders.functionCall(\n 'browserTracingIntegration',\n builders.raw('{ useEffect, useLocation, useMatches }'),\n ),\n );\n }\n\n if (selectedFeatures.replay) {\n initCallArgs.integrations.push(\n builders.functionCall('replayIntegration', {\n maskAllText: true,\n blockAllMedia: true,\n }),\n );\n\n initCallArgs.replaysSessionSampleRate = 0.1;\n initCallArgs.replaysOnErrorSampleRate = 1.0;\n }\n\n initCallArgs.sendDefaultPii = true;\n }\n\n return initCallArgs;\n}\n\nfunction insertClientInitCall(\n dsn: string,\n // MagicAst returns `ProxifiedModule<any>` so therefore we have to use `any` here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalHooksMod: ProxifiedModule<any>,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): void {\n const initCallArgs = getInitCallArgs(dsn, 'client', selectedFeatures);\n const initCall = builders.functionCall('init', initCallArgs);\n\n const originalHooksModAST = originalHooksMod.$ast as Program;\n const initCallInsertionIndex =\n getAfterImportsInsertionIndex(originalHooksModAST);\n\n originalHooksModAST.body.splice(\n initCallInsertionIndex,\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n generateCode(initCall).code,\n );\n}\n\nexport function generateServerInstrumentationFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n // create an empty file named `instrument.server.mjs`\n const instrumentationFile = 'instrumentation.server.mjs';\n const instrumentationFileMod = parseModule('');\n\n instrumentationFileMod.imports.$add({\n from: '@sentry/remix',\n imported: '*',\n local: 'Sentry',\n });\n\n const initCallArgs = getInitCallArgs(dsn, 'server', selectedFeatures);\n const initCall = builders.functionCall('Sentry.init', initCallArgs);\n\n const instrumentationFileModAST = instrumentationFileMod.$ast as Program;\n\n const initCallInsertionIndex = getAfterImportsInsertionIndex(\n instrumentationFileModAST,\n );\n\n instrumentationFileModAST.body.splice(\n initCallInsertionIndex,\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n generateCode(initCall).code,\n );\n\n return { instrumentationFile, instrumentationFileMod };\n}\n\nexport async function createServerInstrumentationFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n const { instrumentationFile, instrumentationFileMod } =\n generateServerInstrumentationFile(dsn, selectedFeatures);\n\n await writeFile(instrumentationFileMod.$ast, instrumentationFile);\n\n return instrumentationFile;\n}\n\nexport async function insertServerInstrumentationFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n const instrumentationFile = await createServerInstrumentationFile(\n dsn,\n selectedFeatures,\n );\n\n const expressServerPath = await findCustomExpressServerImplementation();\n\n if (!expressServerPath) {\n return false;\n }\n\n const originalExpressServerMod = await loadFile(expressServerPath);\n\n if (\n serverHasInstrumentationImport(\n expressServerPath,\n originalExpressServerMod.$code,\n )\n ) {\n clack.log.warn(\n `File ${chalk.cyan(\n path.basename(expressServerPath),\n )} already contains instrumentation import.\nSkipping adding instrumentation functionality to ${chalk.cyan(\n path.basename(expressServerPath),\n )}.`,\n );\n\n return true;\n }\n\n originalExpressServerMod.$code = `import './${instrumentationFile}';\\n${originalExpressServerMod.$code}`;\n\n fs.writeFileSync(expressServerPath, originalExpressServerMod.$code);\n\n return true;\n}\n\nexport function isRemixV2(packageJson: PackageDotJson): boolean {\n const remixVersion = getPackageVersion('@remix-run/react', packageJson);\n if (!remixVersion) {\n return false;\n }\n\n const minVer = minVersion(remixVersion);\n\n if (!minVer) {\n return false;\n }\n\n return gte(minVer, '2.0.0');\n}\n\nexport async function loadRemixConfig(): Promise<PartialRemixConfig> {\n const configFilePath = path.join(process.cwd(), REMIX_CONFIG_FILE);\n\n try {\n if (!fs.existsSync(configFilePath)) {\n return {};\n }\n\n const configUrl = url.pathToFileURL(configFilePath).href;\n const remixConfigModule = (await import(configUrl)) as {\n default: PartialRemixConfig;\n };\n\n return remixConfigModule?.default || {};\n } catch (e: unknown) {\n clack.log.error(`Couldn't load ${REMIX_CONFIG_FILE}.`);\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n\n return {};\n }\n}\n\nexport async function instrumentRootRoute(isTS?: boolean): Promise<void> {\n const rootFilename = `root.${isTS ? 'tsx' : 'jsx'}`;\n\n await instrumentRoot(rootFilename);\n\n clack.log.success(\n `Successfully instrumented root route ${chalk.cyan(rootFilename)}.`,\n );\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n\nexport async function updateBuildScript(args: {\n org: string;\n project: string;\n url?: string;\n isHydrogen: boolean;\n}): Promise<void> {\n const packageJson = await getPackageDotJson();\n\n if (!packageJson.scripts) {\n packageJson.scripts = {};\n }\n\n const buildCommand = args.isHydrogen\n ? 'shopify hydrogen build'\n : 'remix build';\n\n const instrumentedBuildCommand =\n `${buildCommand} --sourcemap && sentry-upload-sourcemaps --org ${args.org} --project ${args.project}` +\n (args.url ? ` --url ${args.url}` : '') +\n (args.isHydrogen ? ' --buildPath ./dist' : '');\n\n if (!packageJson.scripts.build) {\n packageJson.scripts.build = instrumentedBuildCommand;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n } else if (packageJson.scripts.build.includes(buildCommand)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n packageJson.scripts.build = packageJson.scripts.build.replace(\n buildCommand,\n instrumentedBuildCommand,\n );\n } else {\n throw new Error(\n \"`build` script doesn't contain a known build command. Please update it manually.\",\n );\n }\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageJson, null, 2),\n );\n\n clack.log.success(\n `Successfully updated ${chalk.cyan('build')} script in ${chalk.cyan(\n 'package.json',\n )} to generate and upload sourcemaps.`,\n );\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n\nexport function updateEntryClientMod(\n // MagicAst returns `ProxifiedModule<any>` so therefore we have to use `any` here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalEntryClientMod: ProxifiedModule<any>,\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): ProxifiedModule<any> {\n const imports = ['init'];\n if (selectedFeatures.replay) {\n imports.push('replayIntegration');\n }\n if (selectedFeatures.performance) {\n imports.push('browserTracingIntegration');\n }\n originalEntryClientMod.imports.$add({\n from: '@sentry/remix',\n imported: `${imports.join(', ')}`,\n });\n\n if (selectedFeatures.performance) {\n originalEntryClientMod.imports.$add({\n from: '@remix-run/react',\n imported: 'useLocation',\n local: 'useLocation',\n });\n\n originalEntryClientMod.imports.$add({\n from: '@remix-run/react',\n imported: 'useMatches',\n local: 'useMatches',\n });\n\n originalEntryClientMod.imports.$add({\n from: 'react',\n imported: 'useEffect',\n local: 'useEffect',\n });\n }\n\n insertClientInitCall(dsn, originalEntryClientMod, selectedFeatures);\n\n return originalEntryClientMod;\n}\n\nexport async function initializeSentryOnEntryClient(\n dsn: string,\n isTS: boolean,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): Promise<void> {\n const clientEntryFilename = `entry.client.${isTS ? 'tsx' : 'jsx'}`;\n\n const originalEntryClient = path.join(\n process.cwd(),\n 'app',\n clientEntryFilename,\n );\n\n const originalEntryClientMod = await loadFile(originalEntryClient);\n\n if (hasSentryContent(originalEntryClient, originalEntryClientMod.$code)) {\n return;\n }\n\n const updatedEntryClientMod = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n await writeFile(\n updatedEntryClientMod.$ast,\n path.join(process.cwd(), 'app', clientEntryFilename),\n );\n\n clack.log.success(\n `Successfully initialized Sentry on client entry point ${chalk.cyan(\n clientEntryFilename,\n )}`,\n );\n}\n\nexport async function updateStartScript(instrumentationFile: string) {\n const packageJson = await getPackageDotJson();\n\n if (!packageJson.scripts || !packageJson.scripts.start) {\n throw new Error(\n \"Couldn't find a `start` script in your package.json. Please add one manually.\",\n );\n }\n\n if (packageJson.scripts.start.includes('NODE_OPTIONS')) {\n clack.log.warn(\n `Found existing NODE_OPTIONS in ${chalk.cyan(\n 'start',\n )} script. Skipping adding Sentry initialization.`,\n );\n\n return;\n }\n\n if (\n !packageJson.scripts.start.includes('remix-serve') &&\n // Adding a following empty space not to match a path that includes `node`\n !packageJson.scripts.start.includes('node ')\n ) {\n clack.log.warn(\n `Found a ${chalk.cyan('start')} script that doesn't use ${chalk.cyan(\n 'remix-serve',\n )} or ${chalk.cyan('node')}. Skipping adding Sentry initialization.`,\n );\n\n return;\n }\n\n const startCommand = packageJson.scripts.start;\n\n packageJson.scripts.start = `NODE_OPTIONS='--import ./${instrumentationFile}' ${startCommand}`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageJson, null, 2),\n );\n\n clack.log.success(\n `Successfully updated ${chalk.cyan('start')} script in ${chalk.cyan(\n 'package.json',\n )} to include Sentry initialization on start.`,\n );\n}\n\nexport async function instrumentSentryOnEntryServer(\n isTS: boolean,\n): Promise<void> {\n const serverEntryFilename = `entry.server.${isTS ? 'tsx' : 'jsx'}`;\n\n const originalEntryServer = path.join(\n process.cwd(),\n 'app',\n serverEntryFilename,\n );\n\n const originalEntryServerMod = await loadFile(originalEntryServer);\n\n if (hasSentryContent(originalEntryServer, originalEntryServerMod.$code)) {\n return;\n }\n\n originalEntryServerMod.imports.$add({\n from: '@sentry/remix',\n imported: '*',\n local: 'Sentry',\n });\n\n const handleErrorInstrumented = instrumentHandleError(\n originalEntryServerMod,\n serverEntryFilename,\n );\n\n if (handleErrorInstrumented) {\n clack.log.success(\n `Instrumented ${chalk.cyan('handleError')} in ${chalk.cyan(\n `${serverEntryFilename}`,\n )}`,\n );\n }\n\n await writeFile(\n originalEntryServerMod.$ast,\n path.join(process.cwd(), 'app', serverEntryFilename),\n );\n\n clack.log.success(\n `Successfully initialized Sentry on server entry point ${chalk.cyan(\n serverEntryFilename,\n )}.`,\n );\n}\n"]}
1
+ {"version":3,"file":"s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,UAAU,6BAA6B,CACjD,IAAa;IAEb,MAAM,mBAAmB,GAAG,gBAAgB,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;IAEnE,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CACnC,OAAO,CAAC,GAAG,EAAE,EACb,KAAK,EACL,mBAAmB,CACpB,CAAC;IAEF,MAAM,sBAAsB,GAAG,MAAM,IAAA,mBAAQ,EAAC,mBAAmB,CAAC,CAAC;IAEnE,IAAI,IAAA,wBAAgB,EAAC,mBAAmB,EAAE,sBAAsB,CAAC,KAAK,CAAC,EAAE;QACvE,OAAO;KACR;IAED,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC;QAClC,IAAI,EAAE,eAAe;QACrB,QAAQ,EAAE,GAAG;QACb,KAAK,EAAE,QAAQ;KAChB,CAAC,CAAC;IAEH,MAAM,uBAAuB,GAAG,IAAA,oCAAqB,EACnD,sBAAsB,EACtB,mBAAmB,CACpB,CAAC;IAEF,IAAI,uBAAuB,EAAE;QAC3B,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,gBAAgB,eAAK,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,eAAK,CAAC,IAAI,CACxD,GAAG,mBAAmB,EAAE,CACzB,EAAE,CACJ,CAAC;KACH;IAED,MAAM,IAAA,oBAAS,EACb,sBAAsB,CAAC,IAAI,EAC3B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,mBAAmB,CAAC,CACrD,CAAC;IAEF,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,yDAAyD,eAAK,CAAC,IAAI,CACjE,mBAAmB,CACpB,GAAG,CACL,CAAC;AACJ,CAAC;AA9CD,sEA8CC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\nimport type { Program } from '@babel/types';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport type { Proxified, ProxifiedModule } from 'magicast';\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as url from 'url';\nimport * as childProcess from 'child_process';\n\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { gte, minVersion } from 'semver';\n\nimport {\n builders,\n generateCode,\n loadFile,\n parseModule,\n writeFile,\n // @ts-expect-error - magicast is ESM and TS complains about that. It works though\n} from 'magicast';\nimport type { PackageDotJson } from '../utils/package-json';\nimport { getPackageVersion } from '../utils/package-json';\nimport {\n getAfterImportsInsertionIndex,\n hasSentryContent,\n serverHasInstrumentationImport,\n} from './utils';\nimport { instrumentRoot } from './codemods/root';\nimport { instrumentHandleError } from './codemods/handle-error';\nimport { getPackageDotJson } from '../utils/clack';\nimport { findCustomExpressServerImplementation } from './codemods/express-server';\n\nexport type PartialRemixConfig = {\n unstable_dev?: boolean;\n};\n\nconst REMIX_CONFIG_FILE = 'remix.config.js';\nconst REMIX_REVEAL_COMMAND = 'npx remix reveal';\n\nexport function runRemixReveal(isTS: boolean): void {\n // Check if entry files already exist\n const clientEntryFilename = `entry.client.${isTS ? 'tsx' : 'jsx'}`;\n const serverEntryFilename = `entry.server.${isTS ? 'tsx' : 'jsx'}`;\n\n const clientEntryPath = path.join(process.cwd(), 'app', clientEntryFilename);\n const serverEntryPath = path.join(process.cwd(), 'app', serverEntryFilename);\n\n if (fs.existsSync(clientEntryPath) && fs.existsSync(serverEntryPath)) {\n clack.log.info(\n `Found entry files ${chalk.cyan(clientEntryFilename)} and ${chalk.cyan(\n serverEntryFilename,\n )}.`,\n );\n } else {\n clack.log.info(\n `Couldn't find entry files in your project. Trying to run ${chalk.cyan(\n REMIX_REVEAL_COMMAND,\n )}...`,\n );\n\n clack.log.info(childProcess.execSync(REMIX_REVEAL_COMMAND).toString());\n }\n}\n\ninterface SdkAstOptions {\n dsn: string;\n tracesSampleRate?: number;\n replaysSessionSampleRate?: number;\n replaysOnErrorSampleRate?: number;\n integrations?: Array<Proxified>;\n enableLogs?: boolean;\n}\n\nfunction getInitCallArgs(\n dsn: string,\n type: 'client' | 'server',\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n const initCallArgs: SdkAstOptions = {\n dsn,\n };\n\n // Adding tracing sample rate for both client and server\n if (selectedFeatures.performance) {\n initCallArgs.tracesSampleRate = 1.0;\n }\n\n // Adding logs for both client and server\n if (selectedFeatures.logs) {\n initCallArgs.enableLogs = true;\n }\n\n // Adding integrations and replay options only for client\n if (\n type === 'client' &&\n (selectedFeatures.performance || selectedFeatures.replay)\n ) {\n initCallArgs.integrations = [] as Array<Proxified>;\n\n if (selectedFeatures.performance) {\n initCallArgs.integrations.push(\n builders.functionCall(\n 'browserTracingIntegration',\n builders.raw('{ useEffect, useLocation, useMatches }'),\n ),\n );\n }\n\n if (selectedFeatures.replay) {\n initCallArgs.integrations.push(\n builders.functionCall('replayIntegration', {\n maskAllText: true,\n blockAllMedia: true,\n }),\n );\n\n initCallArgs.replaysSessionSampleRate = 0.1;\n initCallArgs.replaysOnErrorSampleRate = 1.0;\n }\n }\n\n return initCallArgs;\n}\n\nfunction insertClientInitCall(\n dsn: string,\n // MagicAst returns `ProxifiedModule<any>` so therefore we have to use `any` here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalHooksMod: ProxifiedModule<any>,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): void {\n const initCallArgs = getInitCallArgs(dsn, 'client', selectedFeatures);\n const initCall = builders.functionCall('init', initCallArgs);\n\n const originalHooksModAST = originalHooksMod.$ast as Program;\n const initCallInsertionIndex =\n getAfterImportsInsertionIndex(originalHooksModAST);\n\n originalHooksModAST.body.splice(\n initCallInsertionIndex,\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n generateCode(initCall).code,\n );\n}\n\nexport function generateServerInstrumentationFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n // create an empty file named `instrument.server.mjs`\n const instrumentationFile = 'instrumentation.server.mjs';\n const instrumentationFileMod = parseModule('');\n\n instrumentationFileMod.imports.$add({\n from: '@sentry/remix',\n imported: '*',\n local: 'Sentry',\n });\n\n const initCallArgs = getInitCallArgs(dsn, 'server', selectedFeatures);\n const initCall = builders.functionCall('Sentry.init', initCallArgs);\n\n const instrumentationFileModAST = instrumentationFileMod.$ast as Program;\n\n const initCallInsertionIndex = getAfterImportsInsertionIndex(\n instrumentationFileModAST,\n );\n\n instrumentationFileModAST.body.splice(\n initCallInsertionIndex,\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n generateCode(initCall).code,\n );\n\n return { instrumentationFile, instrumentationFileMod };\n}\n\nexport async function createServerInstrumentationFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n const { instrumentationFile, instrumentationFileMod } =\n generateServerInstrumentationFile(dsn, selectedFeatures);\n\n await writeFile(instrumentationFileMod.$ast, instrumentationFile);\n\n return instrumentationFile;\n}\n\nexport async function insertServerInstrumentationFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n const instrumentationFile = await createServerInstrumentationFile(\n dsn,\n selectedFeatures,\n );\n\n const expressServerPath = await findCustomExpressServerImplementation();\n\n if (!expressServerPath) {\n return false;\n }\n\n const originalExpressServerMod = await loadFile(expressServerPath);\n\n if (\n serverHasInstrumentationImport(\n expressServerPath,\n originalExpressServerMod.$code,\n )\n ) {\n clack.log.warn(\n `File ${chalk.cyan(\n path.basename(expressServerPath),\n )} already contains instrumentation import.\nSkipping adding instrumentation functionality to ${chalk.cyan(\n path.basename(expressServerPath),\n )}.`,\n );\n\n return true;\n }\n\n originalExpressServerMod.$code = `import './${instrumentationFile}';\\n${originalExpressServerMod.$code}`;\n\n fs.writeFileSync(expressServerPath, originalExpressServerMod.$code);\n\n return true;\n}\n\nexport function isRemixV2(packageJson: PackageDotJson): boolean {\n const remixVersion = getPackageVersion('@remix-run/react', packageJson);\n if (!remixVersion) {\n return false;\n }\n\n const minVer = minVersion(remixVersion);\n\n if (!minVer) {\n return false;\n }\n\n return gte(minVer, '2.0.0');\n}\n\nexport async function loadRemixConfig(): Promise<PartialRemixConfig> {\n const configFilePath = path.join(process.cwd(), REMIX_CONFIG_FILE);\n\n try {\n if (!fs.existsSync(configFilePath)) {\n return {};\n }\n\n const configUrl = url.pathToFileURL(configFilePath).href;\n const remixConfigModule = (await import(configUrl)) as {\n default: PartialRemixConfig;\n };\n\n return remixConfigModule?.default || {};\n } catch (e: unknown) {\n clack.log.error(`Couldn't load ${REMIX_CONFIG_FILE}.`);\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n\n return {};\n }\n}\n\nexport async function instrumentRootRoute(isTS?: boolean): Promise<void> {\n const rootFilename = `root.${isTS ? 'tsx' : 'jsx'}`;\n\n await instrumentRoot(rootFilename);\n\n clack.log.success(\n `Successfully instrumented root route ${chalk.cyan(rootFilename)}.`,\n );\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n\nexport async function updateBuildScript(args: {\n org: string;\n project: string;\n url?: string;\n isHydrogen: boolean;\n}): Promise<void> {\n const packageJson = await getPackageDotJson();\n\n if (!packageJson.scripts) {\n packageJson.scripts = {};\n }\n\n const buildCommand = args.isHydrogen\n ? 'shopify hydrogen build'\n : 'remix build';\n\n const instrumentedBuildCommand =\n `${buildCommand} --sourcemap && npx @sentry/remix --upload-sourcemaps --org ${args.org} --project ${args.project}` +\n (args.url ? ` --url ${args.url}` : '') +\n (args.isHydrogen ? ' --buildPath ./dist' : '');\n\n if (!packageJson.scripts.build) {\n packageJson.scripts.build = instrumentedBuildCommand;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n } else if (packageJson.scripts.build.includes(buildCommand)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n packageJson.scripts.build = packageJson.scripts.build.replace(\n buildCommand,\n instrumentedBuildCommand,\n );\n } else {\n throw new Error(\n \"`build` script doesn't contain a known build command. Please update it manually.\",\n );\n }\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageJson, null, 2),\n );\n\n clack.log.success(\n `Successfully updated ${chalk.cyan('build')} script in ${chalk.cyan(\n 'package.json',\n )} to generate and upload sourcemaps.`,\n );\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n\nexport function updateEntryClientMod(\n // MagicAst returns `ProxifiedModule<any>` so therefore we have to use `any` here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalEntryClientMod: ProxifiedModule<any>,\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): ProxifiedModule<any> {\n const imports = ['init'];\n if (selectedFeatures.replay) {\n imports.push('replayIntegration');\n }\n if (selectedFeatures.performance) {\n imports.push('browserTracingIntegration');\n }\n originalEntryClientMod.imports.$add({\n from: '@sentry/remix',\n imported: `${imports.join(', ')}`,\n });\n\n if (selectedFeatures.performance) {\n originalEntryClientMod.imports.$add({\n from: '@remix-run/react',\n imported: 'useLocation',\n local: 'useLocation',\n });\n\n originalEntryClientMod.imports.$add({\n from: '@remix-run/react',\n imported: 'useMatches',\n local: 'useMatches',\n });\n\n originalEntryClientMod.imports.$add({\n from: 'react',\n imported: 'useEffect',\n local: 'useEffect',\n });\n }\n\n insertClientInitCall(dsn, originalEntryClientMod, selectedFeatures);\n\n return originalEntryClientMod;\n}\n\nexport async function initializeSentryOnEntryClient(\n dsn: string,\n isTS: boolean,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): Promise<void> {\n const clientEntryFilename = `entry.client.${isTS ? 'tsx' : 'jsx'}`;\n\n const originalEntryClient = path.join(\n process.cwd(),\n 'app',\n clientEntryFilename,\n );\n\n const originalEntryClientMod = await loadFile(originalEntryClient);\n\n if (hasSentryContent(originalEntryClient, originalEntryClientMod.$code)) {\n return;\n }\n\n const updatedEntryClientMod = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n await writeFile(\n updatedEntryClientMod.$ast,\n path.join(process.cwd(), 'app', clientEntryFilename),\n );\n\n clack.log.success(\n `Successfully initialized Sentry on client entry point ${chalk.cyan(\n clientEntryFilename,\n )}`,\n );\n}\n\nexport async function updateStartScript(instrumentationFile: string) {\n const packageJson = await getPackageDotJson();\n\n if (!packageJson.scripts || !packageJson.scripts.start) {\n throw new Error(\n \"Couldn't find a `start` script in your package.json. Please add one manually.\",\n );\n }\n\n if (packageJson.scripts.start.includes('NODE_OPTIONS')) {\n clack.log.warn(\n `Found existing NODE_OPTIONS in ${chalk.cyan(\n 'start',\n )} script. Skipping adding Sentry initialization.`,\n );\n\n return;\n }\n\n if (\n !packageJson.scripts.start.includes('remix-serve') &&\n // Adding a following empty space not to match a path that includes `node`\n !packageJson.scripts.start.includes('node ')\n ) {\n clack.log.warn(\n `Found a ${chalk.cyan('start')} script that doesn't use ${chalk.cyan(\n 'remix-serve',\n )} or ${chalk.cyan('node')}. Skipping adding Sentry initialization.`,\n );\n\n return;\n }\n\n const startCommand = packageJson.scripts.start;\n\n packageJson.scripts.start = `NODE_OPTIONS='--import ./${instrumentationFile}' ${startCommand}`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageJson, null, 2),\n );\n\n clack.log.success(\n `Successfully updated ${chalk.cyan('start')} script in ${chalk.cyan(\n 'package.json',\n )} to include Sentry initialization on start.`,\n );\n}\n\nexport async function instrumentSentryOnEntryServer(\n isTS: boolean,\n): Promise<void> {\n const serverEntryFilename = `entry.server.${isTS ? 'tsx' : 'jsx'}`;\n\n const originalEntryServer = path.join(\n process.cwd(),\n 'app',\n serverEntryFilename,\n );\n\n const originalEntryServerMod = await loadFile(originalEntryServer);\n\n if (hasSentryContent(originalEntryServer, originalEntryServerMod.$code)) {\n return;\n }\n\n originalEntryServerMod.imports.$add({\n from: '@sentry/remix',\n imported: '*',\n local: 'Sentry',\n });\n\n const handleErrorInstrumented = instrumentHandleError(\n originalEntryServerMod,\n serverEntryFilename,\n );\n\n if (handleErrorInstrumented) {\n clack.log.success(\n `Instrumented ${chalk.cyan('handleError')} in ${chalk.cyan(\n `${serverEntryFilename}`,\n )}`,\n );\n }\n\n await writeFile(\n originalEntryServerMod.$ast,\n path.join(process.cwd(), 'app', serverEntryFilename),\n );\n\n clack.log.success(\n `Successfully initialized Sentry on server entry point ${chalk.cyan(\n serverEntryFilename,\n )}.`,\n );\n}\n"]}
package/dist/src/run.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type Platform } from '../lib/Constants';
2
- type WizardIntegration = 'angular' | 'reactNative' | 'flutter' | 'ios' | 'android' | 'cordova' | 'electron' | 'nextjs' | 'nuxt' | 'remix' | 'reactRouter' | 'sveltekit' | 'cloudflare' | 'sourcemaps';
2
+ type WizardIntegration = 'angular' | 'reactNative' | 'flutter' | 'ios' | 'appleSnapshots' | 'android' | 'cordova' | 'electron' | 'nextjs' | 'nuxt' | 'remix' | 'reactRouter' | 'sveltekit' | 'cloudflare' | 'sourcemaps';
3
3
  type Args = {
4
4
  integration?: WizardIntegration;
5
5
  uninstall: boolean;
@@ -7,6 +7,7 @@ type Args = {
7
7
  skipConnect: boolean;
8
8
  debug: boolean;
9
9
  quiet: boolean;
10
+ nonInteractive?: boolean;
10
11
  disableTelemetry: boolean;
11
12
  spotlight?: boolean;
12
13
  promoCode?: string;
@@ -30,6 +31,8 @@ type Args = {
30
31
  comingFrom?: string;
31
32
  ignoreGitChanges?: boolean;
32
33
  xcodeProjectDir?: string;
34
+ appTarget?: string;
35
+ hostedTestTarget?: string;
33
36
  };
34
37
  export declare function run(argv: Args): Promise<void>;
35
38
  export {};
package/dist/src/run.js CHANGED
@@ -34,6 +34,7 @@ const Setup_1 = require("../lib/Setup");
34
34
  const android_wizard_1 = require("./android/android-wizard");
35
35
  const angular_wizard_1 = require("./angular/angular-wizard");
36
36
  const apple_wizard_1 = require("./apple/apple-wizard");
37
+ const apple_snapshots_wizard_1 = require("./apple/snapshots/apple-snapshots-wizard");
37
38
  const flutter_wizard_1 = require("./flutter/flutter-wizard");
38
39
  const nextjs_wizard_1 = require("./nextjs/nextjs-wizard");
39
40
  const nuxt_wizard_1 = require("./nuxt/nuxt-wizard");
@@ -87,6 +88,7 @@ async function run(argv) {
87
88
  { value: 'reactNative', label: 'React Native' },
88
89
  { value: 'flutter', label: 'Flutter' },
89
90
  { value: 'ios', label: 'iOS' },
91
+ { value: 'appleSnapshots', label: 'Apple Snapshots' },
90
92
  { value: 'angular', label: 'Angular' },
91
93
  { value: 'android', label: 'Android' },
92
94
  { value: 'cordova', label: 'Cordova' },
@@ -132,6 +134,15 @@ async function run(argv) {
132
134
  projectDir: finalArgs.xcodeProjectDir,
133
135
  });
134
136
  break;
137
+ case 'appleSnapshots':
138
+ await (0, apple_snapshots_wizard_1.runAppleSnapshotsWizard)({
139
+ ...wizardOptions,
140
+ projectDir: finalArgs.xcodeProjectDir,
141
+ appTarget: finalArgs.appTarget,
142
+ hostedTestTarget: finalArgs.hostedTestTarget,
143
+ nonInteractive: finalArgs.nonInteractive ?? false,
144
+ });
145
+ break;
135
146
  case 'android':
136
147
  await (0, android_wizard_1.runAndroidWizard)(wizardOptions);
137
148
  break;
@@ -163,6 +174,7 @@ async function run(argv) {
163
174
  argv.integration = 'cordova';
164
175
  void (0, Setup_1.run)({
165
176
  ...argv,
177
+ quiet: finalArgs.quiet,
166
178
  url: argv.url ?? '',
167
179
  integration: Constants_1.Integration.cordova,
168
180
  platform: argv.platform ?? [],
@@ -172,6 +184,7 @@ async function run(argv) {
172
184
  argv.integration = 'electron';
173
185
  void (0, Setup_1.run)({
174
186
  ...argv,
187
+ quiet: finalArgs.quiet,
175
188
  url: argv.url ?? '',
176
189
  integration: Constants_1.Integration.electron,
177
190
  platform: argv.platform ?? [],
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/run.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,sDAAwC;AACxC,4EAA0E;AAC1E,yCAAiD;AAEjD,gDAA8D;AAC9D,2CAAoD;AACpD,wCAAgD;AAChD,6DAA4D;AAC5D,6DAA4D;AAC5D,uDAAsD;AACtD,6DAA4D;AAC5D,0DAAyD;AACzD,oDAAmD;AACnD,uDAAsD;AACtD,sEAAqE;AACrE,mEAAkE;AAClE,4EAA0E;AAC1E,sEAAqE;AACrE,yCAAgD;AAEhD,uCAA2C;AAmD3C,SAAS,8BAA8B,CACrC,IAAU;IAEV,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;QAC5B,OAAO,SAAS,CAAC;KAClB;IAED,OAAO;QACL,SAAS,EAAE,IAAI,CAAC,kBAAkB,CAAC,SAAS;QAC5C,UAAU,EAAE,IAAI,CAAC,kBAAkB,CAAC,UAAU;QAC9C,OAAO,EAAE;YACP,EAAE,EAAE,IAAI,CAAC,kBAAkB,CAAC,SAAS;YACrC,IAAI,EAAE;gBACJ;oBACE,GAAG,EAAE;wBACH,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,GAAG;qBACpC;iBACF;aACF;YACD,YAAY,EAAE;gBACZ,EAAE,EAAE,IAAI,CAAC,kBAAkB,CAAC,KAAK;gBACjC,IAAI,EAAE,IAAI,CAAC,kBAAkB,CAAC,OAAO;gBACrC,IAAI,EAAE,IAAI,CAAC,kBAAkB,CAAC,OAAO;aACtC;YACD,IAAI,EAAE,IAAI,CAAC,kBAAkB,CAAC,WAAW;SAC1C;KACF,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,GAAG,CAAC,IAAU;IAClC,MAAM,SAAS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BAAe,EAAC,aAAa,CAAC,CAAC;YACrC,MAAM;QAER,KAAK,MAAM;YACT,MAAM,IAAA,2BAAa,EAAC,aAAa,CAAC,CAAC;YACnC,MAAM;QAER,KAAK,OAAO;YACV,MAAM,IAAA,6BAAc,EAAC,aAAa,CAAC,CAAC;YACpC,MAAM;QAER,KAAK,aAAa;YAChB,MAAM,IAAA,0CAAoB,EAAC,aAAa,CAAC,CAAC;YAC1C,MAAM;QAER,KAAK,WAAW;YACd,MAAM,IAAA,qCAAkB,EAAC,aAAa,CAAC,CAAC;YACxC,MAAM;QAER,KAAK,YAAY;YACf,MAAM,IAAA,uCAAmB,EAAC,aAAa,CAAC,CAAC;YACzC,MAAM;QAER,KAAK,YAAY;YACf,MAAM,IAAA,uCAAmB,EAAC,aAAa,CAAC,CAAC;YACzC,MAAM;QAER,KAAK,SAAS;YACZ,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;YAC7B,KAAK,IAAA,WAAS,EACZ;gBACE,GAAG,IAAI;gBACP,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE;gBACnB,WAAW,EAAE,uBAAW,CAAC,OAAO;gBAChC,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;aAC9B,EACD,aAAa,CACd,CAAC;YACF,MAAM;QAER,KAAK,UAAU;YACb,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,KAAK,IAAA,WAAS,EACZ;gBACE,GAAG,IAAI;gBACP,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE;gBACnB,WAAW,EAAE,uBAAW,CAAC,QAAQ;gBACjC,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;aAC9B,EACD,aAAa,CACd,CAAC;YACF,MAAM;QAER;YACE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;KAChD;AACH,CAAC;AA5ID,kBA4IC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport { runReactNativeWizard } from './react-native/react-native-wizard';\nimport { abortIfCancelled } from './utils/clack';\n\nimport { Integration, type Platform } from '../lib/Constants';\nimport { readEnvironment } from '../lib/Helper/Env';\nimport { run as legacyRun } from '../lib/Setup';\nimport { runAndroidWizard } from './android/android-wizard';\nimport { runAngularWizard } from './angular/angular-wizard';\nimport { runAppleWizard } from './apple/apple-wizard';\nimport { runFlutterWizard } from './flutter/flutter-wizard';\nimport { runNextjsWizard } from './nextjs/nextjs-wizard';\nimport { runNuxtWizard } from './nuxt/nuxt-wizard';\nimport { runRemixWizard } from './remix/remix-wizard';\nimport { runSourcemapsWizard } from './sourcemaps/sourcemaps-wizard';\nimport { runSvelteKitWizard } from './sveltekit/sveltekit-wizard';\nimport { runReactRouterWizard } from './react-router/react-router-wizard';\nimport { runCloudflareWizard } from './cloudflare/cloudflare-wizard';\nimport { enableDebugLogs } from './utils/debug';\nimport type { PreselectedProject, WizardOptions } from './utils/types';\nimport { WIZARD_VERSION } from './version';\n\ntype WizardIntegration =\n | 'angular'\n | 'reactNative'\n | 'flutter'\n | 'ios'\n | 'android'\n | 'cordova'\n | 'electron'\n | 'nextjs'\n | 'nuxt'\n | 'remix'\n | 'reactRouter'\n | 'sveltekit'\n | 'cloudflare'\n | 'sourcemaps';\n\ntype Args = {\n integration?: WizardIntegration;\n\n uninstall: boolean; // used in Cordova\n signup: boolean;\n skipConnect: boolean;\n debug: boolean;\n quiet: boolean;\n disableTelemetry: boolean;\n spotlight?: boolean;\n promoCode?: string;\n preSelectedProject?: {\n authToken: string;\n selfHosted: boolean;\n dsn: string;\n projectId: string;\n projectSlug: string;\n projectName: string;\n orgId: string;\n orgName: string;\n orgSlug: string;\n };\n url?: string;\n platform?: Platform[];\n org?: string;\n project?: string;\n saas?: boolean;\n forceInstall?: boolean;\n comingFrom?: string;\n ignoreGitChanges?: boolean;\n xcodeProjectDir?: string;\n};\n\nfunction preSelectedProjectArgsToObject(\n args: Args,\n): PreselectedProject | undefined {\n if (!args.preSelectedProject) {\n return undefined;\n }\n\n return {\n authToken: args.preSelectedProject.authToken,\n selfHosted: args.preSelectedProject.selfHosted,\n project: {\n id: args.preSelectedProject.projectId,\n keys: [\n {\n dsn: {\n public: args.preSelectedProject.dsn,\n },\n },\n ],\n organization: {\n id: args.preSelectedProject.orgId,\n name: args.preSelectedProject.orgName,\n slug: args.preSelectedProject.orgSlug,\n },\n slug: args.preSelectedProject.projectSlug,\n },\n };\n}\n\nexport async function run(argv: Args) {\n const finalArgs = {\n ...argv,\n ...readEnvironment(),\n };\n\n // Enable debug logs if the user has passed the --debug flag\n if (finalArgs.debug) {\n enableDebugLogs();\n }\n\n let integration = finalArgs.integration;\n if (!integration) {\n clack.intro(`Sentry Wizard ${WIZARD_VERSION}`);\n\n integration = await abortIfCancelled(\n clack.select({\n message: 'What do you want to set up?',\n options: [\n { value: 'reactNative', label: 'React Native' },\n { value: 'flutter', label: 'Flutter' },\n { value: 'ios', label: 'iOS' },\n { value: 'angular', label: 'Angular' },\n { value: 'android', label: 'Android' },\n { value: 'cordova', label: 'Cordova' },\n { value: 'electron', label: 'Electron' },\n { value: 'nextjs', label: 'Next.js' },\n { value: 'nuxt', label: 'Nuxt' },\n { value: 'remix', label: 'Remix' },\n { value: 'reactRouter', label: 'React Router' },\n { value: 'sveltekit', label: 'SvelteKit' },\n { value: 'cloudflare', label: 'Cloudflare' },\n { value: 'sourcemaps', label: 'Configure Source Maps Upload' },\n ],\n }),\n );\n\n if (!integration) {\n clack.log.error('No integration selected. Exiting.');\n return;\n }\n\n clack.outro(`Starting ${integration} setup`);\n }\n\n const wizardOptions: WizardOptions = {\n telemetryEnabled: !finalArgs.disableTelemetry,\n promoCode: finalArgs.promoCode,\n url: finalArgs.url,\n orgSlug: finalArgs.org,\n projectSlug: finalArgs.project,\n saas: finalArgs.saas,\n preSelectedProject: preSelectedProjectArgsToObject(finalArgs),\n forceInstall: finalArgs.forceInstall,\n comingFrom: finalArgs.comingFrom,\n ignoreGitChanges: finalArgs.ignoreGitChanges,\n spotlight: finalArgs.spotlight,\n };\n\n switch (integration) {\n case 'reactNative':\n await runReactNativeWizard(wizardOptions);\n break;\n\n case 'flutter':\n await runFlutterWizard(wizardOptions);\n break;\n\n case 'ios':\n await runAppleWizard({\n ...wizardOptions,\n projectDir: finalArgs.xcodeProjectDir,\n });\n break;\n\n case 'android':\n await runAndroidWizard(wizardOptions);\n break;\n\n case 'angular':\n await runAngularWizard(wizardOptions);\n break;\n\n case 'nextjs':\n await runNextjsWizard(wizardOptions);\n break;\n\n case 'nuxt':\n await runNuxtWizard(wizardOptions);\n break;\n\n case 'remix':\n await runRemixWizard(wizardOptions);\n break;\n\n case 'reactRouter':\n await runReactRouterWizard(wizardOptions);\n break;\n\n case 'sveltekit':\n await runSvelteKitWizard(wizardOptions);\n break;\n\n case 'cloudflare':\n await runCloudflareWizard(wizardOptions);\n break;\n\n case 'sourcemaps':\n await runSourcemapsWizard(wizardOptions);\n break;\n\n case 'cordova':\n argv.integration = 'cordova';\n void legacyRun(\n {\n ...argv,\n url: argv.url ?? '',\n integration: Integration.cordova,\n platform: argv.platform ?? [],\n },\n wizardOptions,\n );\n break;\n\n case 'electron':\n argv.integration = 'electron';\n void legacyRun(\n {\n ...argv,\n url: argv.url ?? '',\n integration: Integration.electron,\n platform: argv.platform ?? [],\n },\n wizardOptions,\n );\n break;\n\n default:\n clack.log.error('No setup wizard selected!');\n }\n}\n"]}
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/run.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,sDAAwC;AACxC,4EAA0E;AAC1E,yCAAiD;AAEjD,gDAA8D;AAC9D,2CAAoD;AACpD,wCAAgD;AAChD,6DAA4D;AAC5D,6DAA4D;AAC5D,uDAAsD;AACtD,qFAAmF;AACnF,6DAA4D;AAC5D,0DAAyD;AACzD,oDAAmD;AACnD,uDAAsD;AACtD,sEAAqE;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ACnC,MAAM;QAER,KAAK,OAAO;YACV,MAAM,IAAA,6BAAc,EAAC,aAAa,CAAC,CAAC;YACpC,MAAM;QAER,KAAK,aAAa;YAChB,MAAM,IAAA,0CAAoB,EAAC,aAAa,CAAC,CAAC;YAC1C,MAAM;QAER,KAAK,WAAW;YACd,MAAM,IAAA,qCAAkB,EAAC,aAAa,CAAC,CAAC;YACxC,MAAM;QAER,KAAK,YAAY;YACf,MAAM,IAAA,uCAAmB,EAAC,aAAa,CAAC,CAAC;YACzC,MAAM;QAER,KAAK,YAAY;YACf,MAAM,IAAA,uCAAmB,EAAC,aAAa,CAAC,CAAC;YACzC,MAAM;QAER,KAAK,SAAS;YACZ,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;YAC7B,KAAK,IAAA,WAAS,EACZ;gBACE,GAAG,IAAI;gBACP,KAAK,EAAE,SAAS,CAAC,KAAK;gBACtB,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE;gBACnB,WAAW,EAAE,uBAAW,CAAC,OAAO;gBAChC,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;aAC9B,EACD,aAAa,CACd,CAAC;YACF,MAAM;QAER,KAAK,UAAU;YACb,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,KAAK,IAAA,WAAS,EACZ;gBACE,GAAG,IAAI;gBACP,KAAK,EAAE,SAAS,CAAC,KAAK;gBACtB,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE;gBACnB,WAAW,EAAE,uBAAW,CAAC,QAAQ;gBACjC,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;aAC9B,EACD,aAAa,CACd,CAAC;YACF,MAAM;QAER;YACE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;KAChD;AACH,CAAC;AAzJD,kBAyJC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport { runReactNativeWizard } from './react-native/react-native-wizard';\nimport { abortIfCancelled } from './utils/clack';\n\nimport { Integration, type Platform } from '../lib/Constants';\nimport { readEnvironment } from '../lib/Helper/Env';\nimport { run as legacyRun } from '../lib/Setup';\nimport { runAndroidWizard } from './android/android-wizard';\nimport { runAngularWizard } from './angular/angular-wizard';\nimport { runAppleWizard } from './apple/apple-wizard';\nimport { runAppleSnapshotsWizard } from './apple/snapshots/apple-snapshots-wizard';\nimport { runFlutterWizard } from './flutter/flutter-wizard';\nimport { runNextjsWizard } from './nextjs/nextjs-wizard';\nimport { runNuxtWizard } from './nuxt/nuxt-wizard';\nimport { runRemixWizard } from './remix/remix-wizard';\nimport { runSourcemapsWizard } from './sourcemaps/sourcemaps-wizard';\nimport { runSvelteKitWizard } from './sveltekit/sveltekit-wizard';\nimport { runReactRouterWizard } from './react-router/react-router-wizard';\nimport { runCloudflareWizard } from './cloudflare/cloudflare-wizard';\nimport { enableDebugLogs } from './utils/debug';\nimport type { PreselectedProject, WizardOptions } from './utils/types';\nimport { WIZARD_VERSION } from './version';\n\ntype WizardIntegration =\n | 'angular'\n | 'reactNative'\n | 'flutter'\n | 'ios'\n | 'appleSnapshots'\n | 'android'\n | 'cordova'\n | 'electron'\n | 'nextjs'\n | 'nuxt'\n | 'remix'\n | 'reactRouter'\n | 'sveltekit'\n | 'cloudflare'\n | 'sourcemaps';\n\ntype Args = {\n integration?: WizardIntegration;\n\n uninstall: boolean; // used in Cordova\n signup: boolean;\n skipConnect: boolean;\n debug: boolean;\n quiet: boolean;\n nonInteractive?: boolean;\n disableTelemetry: boolean;\n spotlight?: boolean;\n promoCode?: string;\n preSelectedProject?: {\n authToken: string;\n selfHosted: boolean;\n dsn: string;\n projectId: string;\n projectSlug: string;\n projectName: string;\n orgId: string;\n orgName: string;\n orgSlug: string;\n };\n url?: string;\n platform?: Platform[];\n org?: string;\n project?: string;\n saas?: boolean;\n forceInstall?: boolean;\n comingFrom?: string;\n ignoreGitChanges?: boolean;\n xcodeProjectDir?: string;\n appTarget?: string;\n hostedTestTarget?: string;\n};\n\nfunction preSelectedProjectArgsToObject(\n args: Args,\n): PreselectedProject | undefined {\n if (!args.preSelectedProject) {\n return undefined;\n }\n\n return {\n authToken: args.preSelectedProject.authToken,\n selfHosted: args.preSelectedProject.selfHosted,\n project: {\n id: args.preSelectedProject.projectId,\n keys: [\n {\n dsn: {\n public: args.preSelectedProject.dsn,\n },\n },\n ],\n organization: {\n id: args.preSelectedProject.orgId,\n name: args.preSelectedProject.orgName,\n slug: args.preSelectedProject.orgSlug,\n },\n slug: args.preSelectedProject.projectSlug,\n },\n };\n}\n\nexport async function run(argv: Args) {\n const finalArgs = {\n ...argv,\n ...readEnvironment(),\n };\n\n // Enable debug logs if the user has passed the --debug flag\n if (finalArgs.debug) {\n enableDebugLogs();\n }\n\n let integration = finalArgs.integration;\n if (!integration) {\n clack.intro(`Sentry Wizard ${WIZARD_VERSION}`);\n\n integration = await abortIfCancelled(\n clack.select({\n message: 'What do you want to set up?',\n options: [\n { value: 'reactNative', label: 'React Native' },\n { value: 'flutter', label: 'Flutter' },\n { value: 'ios', label: 'iOS' },\n { value: 'appleSnapshots', label: 'Apple Snapshots' },\n { value: 'angular', label: 'Angular' },\n { value: 'android', label: 'Android' },\n { value: 'cordova', label: 'Cordova' },\n { value: 'electron', label: 'Electron' },\n { value: 'nextjs', label: 'Next.js' },\n { value: 'nuxt', label: 'Nuxt' },\n { value: 'remix', label: 'Remix' },\n { value: 'reactRouter', label: 'React Router' },\n { value: 'sveltekit', label: 'SvelteKit' },\n { value: 'cloudflare', label: 'Cloudflare' },\n { value: 'sourcemaps', label: 'Configure Source Maps Upload' },\n ],\n }),\n );\n\n if (!integration) {\n clack.log.error('No integration selected. Exiting.');\n return;\n }\n\n clack.outro(`Starting ${integration} setup`);\n }\n\n const wizardOptions: WizardOptions = {\n telemetryEnabled: !finalArgs.disableTelemetry,\n promoCode: finalArgs.promoCode,\n url: finalArgs.url,\n orgSlug: finalArgs.org,\n projectSlug: finalArgs.project,\n saas: finalArgs.saas,\n preSelectedProject: preSelectedProjectArgsToObject(finalArgs),\n forceInstall: finalArgs.forceInstall,\n comingFrom: finalArgs.comingFrom,\n ignoreGitChanges: finalArgs.ignoreGitChanges,\n spotlight: finalArgs.spotlight,\n };\n\n switch (integration) {\n case 'reactNative':\n await runReactNativeWizard(wizardOptions);\n break;\n\n case 'flutter':\n await runFlutterWizard(wizardOptions);\n break;\n\n case 'ios':\n await runAppleWizard({\n ...wizardOptions,\n projectDir: finalArgs.xcodeProjectDir,\n });\n break;\n\n case 'appleSnapshots':\n await runAppleSnapshotsWizard({\n ...wizardOptions,\n projectDir: finalArgs.xcodeProjectDir,\n appTarget: finalArgs.appTarget,\n hostedTestTarget: finalArgs.hostedTestTarget,\n nonInteractive: finalArgs.nonInteractive ?? false,\n });\n break;\n\n case 'android':\n await runAndroidWizard(wizardOptions);\n break;\n\n case 'angular':\n await runAngularWizard(wizardOptions);\n break;\n\n case 'nextjs':\n await runNextjsWizard(wizardOptions);\n break;\n\n case 'nuxt':\n await runNuxtWizard(wizardOptions);\n break;\n\n case 'remix':\n await runRemixWizard(wizardOptions);\n break;\n\n case 'reactRouter':\n await runReactRouterWizard(wizardOptions);\n break;\n\n case 'sveltekit':\n await runSvelteKitWizard(wizardOptions);\n break;\n\n case 'cloudflare':\n await runCloudflareWizard(wizardOptions);\n break;\n\n case 'sourcemaps':\n await runSourcemapsWizard(wizardOptions);\n break;\n\n case 'cordova':\n argv.integration = 'cordova';\n void legacyRun(\n {\n ...argv,\n quiet: finalArgs.quiet,\n url: argv.url ?? '',\n integration: Integration.cordova,\n platform: argv.platform ?? [],\n },\n wizardOptions,\n );\n break;\n\n case 'electron':\n argv.integration = 'electron';\n void legacyRun(\n {\n ...argv,\n quiet: finalArgs.quiet,\n url: argv.url ?? '',\n integration: Integration.electron,\n platform: argv.platform ?? [],\n },\n wizardOptions,\n );\n break;\n\n default:\n clack.log.error('No setup wizard selected!');\n }\n}\n"]}
@@ -60,14 +60,14 @@ In case you already tried the wizard, we can also show you how to configure your
60
60
  clack.log.info("Welcome back to the Source Maps wizard - we're almost done ;)");
61
61
  }
62
62
  else {
63
- clack.log.step(`Build your app with ${chalk_1.default.cyan('remix build --sourcemap')}, then upload your source maps using ${chalk_1.default.cyan('sentry-upload-sourcemaps')} cli tool.`);
64
- clack.log.step(`You can add ${chalk_1.default.cyan('sentry-upload-sourcemaps')} to your build script in ${chalk_1.default.cyan('package.json')} like this:`);
63
+ clack.log.step(`Build your app with ${chalk_1.default.cyan('remix build --sourcemap')}, then upload your source maps using ${chalk_1.default.cyan('npx @sentry/remix --upload-sourcemaps')} cli tool.`);
64
+ clack.log.step(`You can add ${chalk_1.default.cyan('npx @sentry/remix --upload-sourcemaps')} to your build script in ${chalk_1.default.cyan('package.json')} like this:`);
65
65
  // Intentially logging directly to console here so that the code can be copied/pasted directly
66
66
  // eslint-disable-next-line no-console
67
67
  console.log(codeSnippet);
68
68
  clack.log.step(`or run it manually after building your app.
69
69
 
70
- To see all available options for ${chalk_1.default.cyan('sentry-upload-sourcemaps')}, run ${chalk_1.default.cyan('sentry-upload-sourcemaps --help')}
70
+ To see all available options, run ${chalk_1.default.cyan('npx @sentry/remix --upload-sourcemaps --help')}
71
71
  `);
72
72
  await (0, clack_1.abortIfCancelled)(clack.select({
73
73
  message: 'Did you finish configuring your build and prod scripts?',
@@ -79,7 +79,7 @@ To see all available options for ${chalk_1.default.cyan('sentry-upload-sourcemap
79
79
  exports.configureRemixSourceMapsUpload = configureRemixSourceMapsUpload;
80
80
  const codeSnippet = chalk_1.default.gray(`
81
81
  "scripts": {
82
- ${chalk_1.default.greenBright('"build": "remix build --sourcemap && sentry-upload-sourcemaps"')};
82
+ ${chalk_1.default.greenBright('"build": "remix build --sourcemap && npx @sentry/remix --upload-sourcemaps"')};
83
83
  }
84
84
  `);
85
85
  //# sourceMappingURL=remix.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"remix.js","sourceRoot":"","sources":["../../../../src/sourc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C,IAAI,CAAC,cAAc,CAAC,aAAa,CACrE,CAAC;QAEF,8FAA8F;QAC9F,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAEzB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;;mCAEgB,eAAK,CAAC,IAAI,CACvC,0BAA0B,CAC3B,SAAS,eAAK,CAAC,IAAI,CAAC,iCAAiC,CAAC;CAC1D,CAAC,CAAC;QAEC,MAAM,IAAA,wBAAgB,EACpB,KAAK,CAAC,MAAM,CAAC;YACX,OAAO,EAAE,yDAAyD;YAClE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YACnD,YAAY,EAAE,IAAI;SACnB,CAAC,CACH,CAAC;KACH;AACH,CAAC,CAAC;AAtEW,QAAA,8BAA8B,kCAsEzC;AAEF,MAAM,WAAW,GAAG,eAAK,CAAC,IAAI,CAAC;;IAE3B,eAAK,CAAC,WAAW,CACjB,gEAAgE,CACjE;;CAEF,CAAC,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { runRemixWizard } from '../../remix/remix-wizard';\nimport { traceStep } from '../../telemetry';\nimport { abortIfCancelled } from '../../utils/clack';\nimport type { WizardOptions } from '../../utils/types';\nimport type { SourceMapUploadToolConfigurationOptions } from './types';\n\nimport * as Sentry from '@sentry/node';\n\nexport const configureRemixSourceMapsUpload = async (\n options: SourceMapUploadToolConfigurationOptions,\n wizardOptions: WizardOptions,\n) => {\n clack.log\n .info(`Source Maps upload for Remix is configured automatically by default if you run the Sentry Wizard for Remix.\nBut don't worry, we can redirect you to the wizard now!\nIn case you already tried the wizard, we can also show you how to configure your ${chalk.cyan(\n 'remix.config.js',\n )} file manually instead.`);\n\n const shouldRedirect: boolean = await abortIfCancelled(\n clack.select({\n message: 'Do you want to run the Sentry Wizard for Remix now?',\n options: [\n {\n label: 'Yes, run the wizard!',\n value: true,\n hint: 'The wizard can also configure your SDK setup',\n },\n {\n label: 'No, show me how to configure it manually',\n value: false,\n },\n ],\n }),\n );\n\n Sentry.setTag('redirect-remix-wizard', shouldRedirect);\n\n if (shouldRedirect) {\n await traceStep('run-remix-wizard', () => runRemixWizard(wizardOptions));\n clack.intro('Sentry Source Maps Upload Configuration Wizard');\n clack.log.info(\n \"Welcome back to the Source Maps wizard - we're almost done ;)\",\n );\n } else {\n clack.log.step(\n `Build your app with ${chalk.cyan(\n 'remix build --sourcemap',\n )}, then upload your source maps using ${chalk.cyan(\n 'sentry-upload-sourcemaps',\n )} cli tool.`,\n );\n\n clack.log.step(\n `You can add ${chalk.cyan(\n 'sentry-upload-sourcemaps',\n )} to your build script in ${chalk.cyan('package.json')} like this:`,\n );\n\n // Intentially logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(codeSnippet);\n\n clack.log.step(`or run it manually after building your app.\n\nTo see all available options for ${chalk.cyan(\n 'sentry-upload-sourcemaps',\n )}, run ${chalk.cyan('sentry-upload-sourcemaps --help')}\n`);\n\n await abortIfCancelled(\n clack.select({\n message: 'Did you finish configuring your build and prod scripts?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n }\n};\n\nconst codeSnippet = chalk.gray(`\n\"scripts\": {\n ${chalk.greenBright(\n '\"build\": \"remix build --sourcemap && sentry-upload-sourcemaps\"',\n )};\n}\n`);\n"]}
1
+ {"version":3,"file":"remix.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/remix.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,sDAAwC;AACxC,kDAA0B;AAC1B,2DAA0D;AAC1D,+CAA4C;AAC5C,6CAAqD;AAIrD,qDAAuC;AAEhC,MAAM,8BAA8B,GAAG,KAAK,EACjD,OAAgD,EAChD,aAA4B,EAC5B,EAAE;IACF,KAAK,CAAC,GA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KAAK,CAAC,MAAM,CAAC;YACX,OAAO,EAAE,yDAAyD;YAClE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YACnD,YAAY,EAAE,IAAI;SACnB,CAAC,CACH,CAAC;KACH;AACH,CAAC,CAAC;AAtEW,QAAA,8BAA8B,kCAsEzC;AAEF,MAAM,WAAW,GAAG,eAAK,CAAC,IAAI,CAAC;;IAE3B,eAAK,CAAC,WAAW,CACjB,6EAA6E,CAC9E;;CAEF,CAAC,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { runRemixWizard } from '../../remix/remix-wizard';\nimport { traceStep } from '../../telemetry';\nimport { abortIfCancelled } from '../../utils/clack';\nimport type { WizardOptions } from '../../utils/types';\nimport type { SourceMapUploadToolConfigurationOptions } from './types';\n\nimport * as Sentry from '@sentry/node';\n\nexport const configureRemixSourceMapsUpload = async (\n options: SourceMapUploadToolConfigurationOptions,\n wizardOptions: WizardOptions,\n) => {\n clack.log\n .info(`Source Maps upload for Remix is configured automatically by default if you run the Sentry Wizard for Remix.\nBut don't worry, we can redirect you to the wizard now!\nIn case you already tried the wizard, we can also show you how to configure your ${chalk.cyan(\n 'remix.config.js',\n )} file manually instead.`);\n\n const shouldRedirect: boolean = await abortIfCancelled(\n clack.select({\n message: 'Do you want to run the Sentry Wizard for Remix now?',\n options: [\n {\n label: 'Yes, run the wizard!',\n value: true,\n hint: 'The wizard can also configure your SDK setup',\n },\n {\n label: 'No, show me how to configure it manually',\n value: false,\n },\n ],\n }),\n );\n\n Sentry.setTag('redirect-remix-wizard', shouldRedirect);\n\n if (shouldRedirect) {\n await traceStep('run-remix-wizard', () => runRemixWizard(wizardOptions));\n clack.intro('Sentry Source Maps Upload Configuration Wizard');\n clack.log.info(\n \"Welcome back to the Source Maps wizard - we're almost done ;)\",\n );\n } else {\n clack.log.step(\n `Build your app with ${chalk.cyan(\n 'remix build --sourcemap',\n )}, then upload your source maps using ${chalk.cyan(\n 'npx @sentry/remix --upload-sourcemaps',\n )} cli tool.`,\n );\n\n clack.log.step(\n `You can add ${chalk.cyan(\n 'npx @sentry/remix --upload-sourcemaps',\n )} to your build script in ${chalk.cyan('package.json')} like this:`,\n );\n\n // Intentially logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(codeSnippet);\n\n clack.log.step(`or run it manually after building your app.\n\nTo see all available options, run ${chalk.cyan(\n 'npx @sentry/remix --upload-sourcemaps --help',\n )}\n`);\n\n await abortIfCancelled(\n clack.select({\n message: 'Did you finish configuring your build and prod scripts?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n }\n};\n\nconst codeSnippet = chalk.gray(`\n\"scripts\": {\n ${chalk.greenBright(\n '\"build\": \"remix build --sourcemap && npx @sentry/remix --upload-sourcemaps\"',\n )};\n}\n`);\n"]}
@@ -128,7 +128,7 @@ async function addVitePluginToConfig(viteConfigPath, options) {
128
128
  ...(selfHosted && { url }),
129
129
  },
130
130
  });
131
- const code = (0, magicast_1.generateCode)(mod.$ast).code;
131
+ const code = (0, ast_utils_1.preserveTrailingNewline)(viteConfigContent, (0, magicast_1.generateCode)(mod.$ast).code);
132
132
  await fs.promises.writeFile(viteConfigPath, code);
133
133
  clack.log.success(`Added the Sentry Vite plugin to ${prettyViteConfigFilename} and enabled source maps`);
134
134
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"vite.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/vite.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,sDAAwC;AACxC,kFAAkF;AAClF,uCAAqD;AACrD,kFAAkF;AAClF,8CAAiD;AAIjD,+CAAiC;AAEjC,qDAAuC;AAEvC,kDAA0B;AAC1B,6CAS2B;AAC3B,2DAA+D;AAM/D,qDAAmE;AAEnE,2C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,OAAO,aAAa,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KAC/C;IAED,IAAI,aAAa,CAAC,WAAW,CAAC,IAAI,KAAK,YAAY,EAAE;QACnD,MAAM,QAAQ,GAAG,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC;QAChD,OAAO,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;KAC1C;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,cAAc,CACrB,QAAgB,EAChB,OAAkB;IAElB,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE;QAC/B,IAAI,IAAI,CAAC,IAAI,KAAK,qBAAqB,EAAE;YACvC,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,YAAY,EAAE;gBAC3C,IACE,WAAW,CAAC,IAAI,KAAK,oBAAoB;oBACzC,WAAW,CAAC,EAAE,CAAC,IAAI,KAAK,YAAY;oBACpC,WAAW,CAAC,EAAE,CAAC,IAAI,KAAK,QAAQ;oBAChC,WAAW,CAAC,IAAI,EAAE,IAAI,KAAK,kBAAkB,EAC7C;oBACA,OAAO,WAAW,CAAC,IAAI,CAAC;iBACzB;aACF;SACF;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { generateCode, parseModule } from 'magicast';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { addVitePlugin } from 'magicast/helpers';\n\nimport type { namedTypes as t } from 'ast-types';\n\nimport * as recast from 'recast';\n\nimport * as Sentry from '@sentry/node';\n\nimport chalk from 'chalk';\nimport {\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n askForToolConfigPath,\n createNewConfigFile,\n getPackageDotJson,\n installPackage,\n makeCodeSnippet,\n showCopyPasteInstructions,\n} from '../../utils/clack';\nimport { hasPackageInstalled } from '../../utils/package-json';\n\nimport {\n SourceMapUploadToolConfigurationFunction,\n SourceMapUploadToolConfigurationOptions,\n} from './types';\nimport { findFile, hasSentryContent } from '../../utils/ast-utils';\n\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport { debug } from '../../utils/debug';\n\nconst getViteConfigSnippet = (\n options: SourceMapUploadToolConfigurationOptions,\n colors: boolean,\n) =>\n makeCodeSnippet(colors, (unchanged, plus, _) =>\n unchanged(`import { defineConfig } from \"vite\";\n${plus('import { sentryVitePlugin } from \"@sentry/vite-plugin\";')}\n\nexport default defineConfig({\n build: {\n ${plus('sourcemap: true, // Source map generation must be turned on')}\n },\n plugins: [\n // Put the Sentry vite plugin after all other plugins\n ${plus(`sentryVitePlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"${options.orgSlug}\",\n project: \"${options.projectSlug}\",${\n options.selfHosted ? `\\n url: \"${options.url}\",` : ''\n }\n }),`)}\n ],\n});`),\n );\n\nexport const configureVitePlugin: SourceMapUploadToolConfigurationFunction =\n async (options) => {\n await installPackage({\n packageName: '@sentry/vite-plugin',\n alreadyInstalled: hasPackageInstalled(\n '@sentry/vite-plugin',\n await getPackageDotJson(),\n ),\n });\n\n const viteConfigPath =\n findFile(path.resolve(process.cwd(), 'vite.config')) ??\n (await askForToolConfigPath('Vite', 'vite.config.js'));\n\n let successfullyAdded = false;\n if (viteConfigPath) {\n successfullyAdded = await addVitePluginToConfig(viteConfigPath, options);\n } else {\n successfullyAdded = await createNewConfigFile(\n path.join(process.cwd(), 'vite.config.js'),\n getViteConfigSnippet(options, false),\n 'More information about vite configs: https://vitejs.dev/config/',\n );\n Sentry.setTag(\n 'created-new-config',\n successfullyAdded ? 'success' : 'fail',\n );\n }\n\n if (successfullyAdded) {\n clack.log.info(\n `We recommend checking the ${\n viteConfigPath ? 'modified' : 'added'\n } file after the wizard finished to ensure it works with your build setup.`,\n );\n\n Sentry.setTag('ast-mod', 'success');\n } else {\n Sentry.setTag('ast-mod', 'fail');\n await showCopyPasteInstructions({\n filename: path.basename(viteConfigPath || 'vite.config.js'),\n codeSnippet: getViteConfigSnippet(options, true),\n });\n }\n\n await addDotEnvSentryBuildPluginFile(options.authToken);\n };\n\nexport async function addVitePluginToConfig(\n viteConfigPath: string,\n options: SourceMapUploadToolConfigurationOptions,\n): Promise<boolean> {\n try {\n const prettyViteConfigFilename = chalk.cyan(path.basename(viteConfigPath));\n\n const viteConfigContent = (\n await fs.promises.readFile(viteConfigPath)\n ).toString();\n\n const mod = parseModule(viteConfigContent);\n\n if (hasSentryContent(mod.$ast as t.Program)) {\n const shouldContinue = await abortIfCancelled(\n clack.select({\n message: `${prettyViteConfigFilename} already contains Sentry-related code. Should the wizard modify it anyway?`,\n options: [\n {\n label: 'Yes, add the Sentry Vite plugin',\n value: true,\n },\n {\n label: 'No, show me instructions to manually add the plugin',\n value: false,\n },\n ],\n initialValue: true,\n }),\n );\n\n if (!shouldContinue) {\n Sentry.setTag('ast-mod-fail-reason', 'has-sentry-content');\n return false;\n }\n }\n\n const enabledSourcemaps = enableSourcemapGeneration(mod.$ast as t.Program);\n if (!enabledSourcemaps) {\n Sentry.setTag('ast-mod-fail-reason', 'insertion-fail');\n return false;\n }\n\n const { orgSlug: org, projectSlug: project, selfHosted, url } = options;\n\n addVitePlugin(mod, {\n imported: 'sentryVitePlugin',\n from: '@sentry/vite-plugin',\n constructor: 'sentryVitePlugin',\n options: {\n org,\n project,\n ...(selfHosted && { url }),\n },\n });\n\n const code = generateCode(mod.$ast).code;\n\n await fs.promises.writeFile(viteConfigPath, code);\n\n clack.log.success(\n `Added the Sentry Vite plugin to ${prettyViteConfigFilename} and enabled source maps`,\n );\n\n return true;\n } catch (e) {\n debug(e);\n Sentry.setTag('ast-mod-fail-reason', 'insertion-fail');\n return false;\n }\n}\n\nfunction enableSourcemapGeneration(program: t.Program): boolean {\n const configObj = getViteConfigObject(program);\n\n if (!configObj) {\n return false;\n }\n\n const b = recast.types.builders;\n\n const buildProp = configObj.properties.find(\n (p: t.ObjectProperty) =>\n p.key.type === 'Identifier' && p.key.name === 'build',\n );\n\n // case 1: build property doesn't exist yet, so we can just add it\n if (!buildProp) {\n configObj.properties.push(\n b.objectProperty(\n b.identifier('build'),\n b.objectExpression([\n b.objectProperty(b.identifier('sourcemap'), b.booleanLiteral(true)),\n ]),\n ),\n );\n return true;\n }\n\n const isValidBuildProp =\n buildProp.type === 'ObjectProperty' &&\n buildProp.value.type === 'ObjectExpression';\n\n if (!isValidBuildProp) {\n return false;\n }\n\n const sourceMapsProp =\n buildProp.value.type === 'ObjectExpression' &&\n buildProp.value.properties.find(\n (p: t.ObjectProperty) =>\n p.key.type === 'Identifier' && p.key.name === 'sourcemap',\n );\n\n // case 2: build.sourcemap property doesn't exist yet, so we just add it\n if (!sourceMapsProp && buildProp.value.type === 'ObjectExpression') {\n buildProp.value.properties.push(\n b.objectProperty(b.identifier('sourcemap'), b.booleanLiteral(true)),\n );\n return true;\n }\n\n if (!sourceMapsProp || sourceMapsProp.type !== 'ObjectProperty') {\n return false;\n }\n\n // case 3: build.sourcemap property exists, and it's set to 'hidden'\n if (\n sourceMapsProp.value.type === 'StringLiteral' &&\n sourceMapsProp.value.value === 'hidden'\n ) {\n // nothing to do for us\n return true;\n }\n\n // case 4: build.sourcemap property exists, but it's not enabled, so we set it to true\n // or it is already true in which case this is a noop\n sourceMapsProp.value = b.booleanLiteral(true);\n return true;\n}\n\nfunction getViteConfigObject(\n program: t.Program,\n): t.ObjectExpression | undefined {\n const defaultExport = program.body.find(\n (s) => s.type === 'ExportDefaultDeclaration',\n ) as t.ExportDefaultDeclaration;\n\n if (!defaultExport) {\n return undefined;\n }\n\n if (defaultExport.declaration.type === 'ObjectExpression') {\n return defaultExport.declaration;\n }\n\n if (\n defaultExport.declaration.type === 'CallExpression' &&\n defaultExport.declaration.arguments[0].type === 'ObjectExpression'\n ) {\n return defaultExport.declaration.arguments[0];\n }\n\n if (defaultExport.declaration.type === 'Identifier') {\n const configId = defaultExport.declaration.name;\n return findConfigNode(configId, program);\n }\n\n return undefined;\n}\n\nfunction findConfigNode(\n configId: string,\n program: t.Program,\n): t.ObjectExpression | undefined {\n for (const node of program.body) {\n if (node.type === 'VariableDeclaration') {\n for (const declaration of node.declarations) {\n if (\n declaration.type === 'VariableDeclarator' &&\n declaration.id.type === 'Identifier' &&\n declaration.id.name === configId &&\n declaration.init?.type === 'ObjectExpression'\n ) {\n return declaration.init;\n }\n }\n }\n }\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"vite.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/vite.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,sDAAwC;AACxC,kFAAkF;AAClF,uCAAqD;AACrD,kFAAkF;AAClF,8CAAiD;AAIjD,+CAAiC;AAEjC,qDAAuC;AAEvC,kDAA0B;AAC1B,6CAS2B;AAC3B,2DAA+D;AAM/D,qDAI+B;AAE/B,2CAA6B;AAC7B,uCAAyB;AACzB,6CAA0C;AAE1C,MAAM,oBAAoB,GAAG,CAC3B,OAAgD,EAChD,MAAe,EACf,EAAE,CACF,IAAA,uBAAe,EAAC,MAAM,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAC7C,SAAS,CAAC;EACZ,IAAI,CAAC,yDAAyD,CAAC;;;;MAI3D,IAAI,CAAC,6DAA6D,CAAC;;;;MAInE,IAAI,CAAC;;cAEG,OAAO,CAAC,OAAO;kBACX,OAAO,CAAC,WAAW,KAC/B,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,EAC1D;QACI,CAAC;;IAEL,CAAC,CACF,CAAC;AAEG,MAAM,mBAAmB,GAC9B,KAAK,EAAE,OAAO,EAAE,EAAE;IAChB,MAAM,IAAA,sBAAc,EAAC;QACnB,WAAW,EAAE,qBAAqB;QAClC,gBAAgB,EAAE,IAAA,kCAAm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pC,WAAW,CAAC,EAAE,CAAC,IAAI,KAAK,QAAQ;oBAChC,WAAW,CAAC,IAAI,EAAE,IAAI,KAAK,kBAAkB,EAC7C;oBACA,OAAO,WAAW,CAAC,IAAI,CAAC;iBACzB;aACF;SACF;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { generateCode, parseModule } from 'magicast';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { addVitePlugin } from 'magicast/helpers';\n\nimport type { namedTypes as t } from 'ast-types';\n\nimport * as recast from 'recast';\n\nimport * as Sentry from '@sentry/node';\n\nimport chalk from 'chalk';\nimport {\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n askForToolConfigPath,\n createNewConfigFile,\n getPackageDotJson,\n installPackage,\n makeCodeSnippet,\n showCopyPasteInstructions,\n} from '../../utils/clack';\nimport { hasPackageInstalled } from '../../utils/package-json';\n\nimport {\n SourceMapUploadToolConfigurationFunction,\n SourceMapUploadToolConfigurationOptions,\n} from './types';\nimport {\n findFile,\n hasSentryContent,\n preserveTrailingNewline,\n} from '../../utils/ast-utils';\n\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport { debug } from '../../utils/debug';\n\nconst getViteConfigSnippet = (\n options: SourceMapUploadToolConfigurationOptions,\n colors: boolean,\n) =>\n makeCodeSnippet(colors, (unchanged, plus, _) =>\n unchanged(`import { defineConfig } from \"vite\";\n${plus('import { sentryVitePlugin } from \"@sentry/vite-plugin\";')}\n\nexport default defineConfig({\n build: {\n ${plus('sourcemap: true, // Source map generation must be turned on')}\n },\n plugins: [\n // Put the Sentry vite plugin after all other plugins\n ${plus(`sentryVitePlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"${options.orgSlug}\",\n project: \"${options.projectSlug}\",${\n options.selfHosted ? `\\n url: \"${options.url}\",` : ''\n }\n }),`)}\n ],\n});`),\n );\n\nexport const configureVitePlugin: SourceMapUploadToolConfigurationFunction =\n async (options) => {\n await installPackage({\n packageName: '@sentry/vite-plugin',\n alreadyInstalled: hasPackageInstalled(\n '@sentry/vite-plugin',\n await getPackageDotJson(),\n ),\n });\n\n const viteConfigPath =\n findFile(path.resolve(process.cwd(), 'vite.config')) ??\n (await askForToolConfigPath('Vite', 'vite.config.js'));\n\n let successfullyAdded = false;\n if (viteConfigPath) {\n successfullyAdded = await addVitePluginToConfig(viteConfigPath, options);\n } else {\n successfullyAdded = await createNewConfigFile(\n path.join(process.cwd(), 'vite.config.js'),\n getViteConfigSnippet(options, false),\n 'More information about vite configs: https://vitejs.dev/config/',\n );\n Sentry.setTag(\n 'created-new-config',\n successfullyAdded ? 'success' : 'fail',\n );\n }\n\n if (successfullyAdded) {\n clack.log.info(\n `We recommend checking the ${\n viteConfigPath ? 'modified' : 'added'\n } file after the wizard finished to ensure it works with your build setup.`,\n );\n\n Sentry.setTag('ast-mod', 'success');\n } else {\n Sentry.setTag('ast-mod', 'fail');\n await showCopyPasteInstructions({\n filename: path.basename(viteConfigPath || 'vite.config.js'),\n codeSnippet: getViteConfigSnippet(options, true),\n });\n }\n\n await addDotEnvSentryBuildPluginFile(options.authToken);\n };\n\nexport async function addVitePluginToConfig(\n viteConfigPath: string,\n options: SourceMapUploadToolConfigurationOptions,\n): Promise<boolean> {\n try {\n const prettyViteConfigFilename = chalk.cyan(path.basename(viteConfigPath));\n\n const viteConfigContent = (\n await fs.promises.readFile(viteConfigPath)\n ).toString();\n\n const mod = parseModule(viteConfigContent);\n\n if (hasSentryContent(mod.$ast as t.Program)) {\n const shouldContinue = await abortIfCancelled(\n clack.select({\n message: `${prettyViteConfigFilename} already contains Sentry-related code. Should the wizard modify it anyway?`,\n options: [\n {\n label: 'Yes, add the Sentry Vite plugin',\n value: true,\n },\n {\n label: 'No, show me instructions to manually add the plugin',\n value: false,\n },\n ],\n initialValue: true,\n }),\n );\n\n if (!shouldContinue) {\n Sentry.setTag('ast-mod-fail-reason', 'has-sentry-content');\n return false;\n }\n }\n\n const enabledSourcemaps = enableSourcemapGeneration(mod.$ast as t.Program);\n if (!enabledSourcemaps) {\n Sentry.setTag('ast-mod-fail-reason', 'insertion-fail');\n return false;\n }\n\n const { orgSlug: org, projectSlug: project, selfHosted, url } = options;\n\n addVitePlugin(mod, {\n imported: 'sentryVitePlugin',\n from: '@sentry/vite-plugin',\n constructor: 'sentryVitePlugin',\n options: {\n org,\n project,\n ...(selfHosted && { url }),\n },\n });\n\n const code = preserveTrailingNewline(\n viteConfigContent,\n generateCode(mod.$ast).code,\n );\n\n await fs.promises.writeFile(viteConfigPath, code);\n\n clack.log.success(\n `Added the Sentry Vite plugin to ${prettyViteConfigFilename} and enabled source maps`,\n );\n\n return true;\n } catch (e) {\n debug(e);\n Sentry.setTag('ast-mod-fail-reason', 'insertion-fail');\n return false;\n }\n}\n\nfunction enableSourcemapGeneration(program: t.Program): boolean {\n const configObj = getViteConfigObject(program);\n\n if (!configObj) {\n return false;\n }\n\n const b = recast.types.builders;\n\n const buildProp = configObj.properties.find(\n (p: t.ObjectProperty) =>\n p.key.type === 'Identifier' && p.key.name === 'build',\n );\n\n // case 1: build property doesn't exist yet, so we can just add it\n if (!buildProp) {\n configObj.properties.push(\n b.objectProperty(\n b.identifier('build'),\n b.objectExpression([\n b.objectProperty(b.identifier('sourcemap'), b.booleanLiteral(true)),\n ]),\n ),\n );\n return true;\n }\n\n const isValidBuildProp =\n buildProp.type === 'ObjectProperty' &&\n buildProp.value.type === 'ObjectExpression';\n\n if (!isValidBuildProp) {\n return false;\n }\n\n const sourceMapsProp =\n buildProp.value.type === 'ObjectExpression' &&\n buildProp.value.properties.find(\n (p: t.ObjectProperty) =>\n p.key.type === 'Identifier' && p.key.name === 'sourcemap',\n );\n\n // case 2: build.sourcemap property doesn't exist yet, so we just add it\n if (!sourceMapsProp && buildProp.value.type === 'ObjectExpression') {\n buildProp.value.properties.push(\n b.objectProperty(b.identifier('sourcemap'), b.booleanLiteral(true)),\n );\n return true;\n }\n\n if (!sourceMapsProp || sourceMapsProp.type !== 'ObjectProperty') {\n return false;\n }\n\n // case 3: build.sourcemap property exists, and it's set to 'hidden'\n if (\n sourceMapsProp.value.type === 'StringLiteral' &&\n sourceMapsProp.value.value === 'hidden'\n ) {\n // nothing to do for us\n return true;\n }\n\n // case 4: build.sourcemap property exists, but it's not enabled, so we set it to true\n // or it is already true in which case this is a noop\n sourceMapsProp.value = b.booleanLiteral(true);\n return true;\n}\n\nfunction getViteConfigObject(\n program: t.Program,\n): t.ObjectExpression | undefined {\n const defaultExport = program.body.find(\n (s) => s.type === 'ExportDefaultDeclaration',\n ) as t.ExportDefaultDeclaration;\n\n if (!defaultExport) {\n return undefined;\n }\n\n if (defaultExport.declaration.type === 'ObjectExpression') {\n return defaultExport.declaration;\n }\n\n if (\n defaultExport.declaration.type === 'CallExpression' &&\n defaultExport.declaration.arguments[0].type === 'ObjectExpression'\n ) {\n return defaultExport.declaration.arguments[0];\n }\n\n if (defaultExport.declaration.type === 'Identifier') {\n const configId = defaultExport.declaration.name;\n return findConfigNode(configId, program);\n }\n\n return undefined;\n}\n\nfunction findConfigNode(\n configId: string,\n program: t.Program,\n): t.ObjectExpression | undefined {\n for (const node of program.body) {\n if (node.type === 'VariableDeclaration') {\n for (const declaration of node.declarations) {\n if (\n declaration.type === 'VariableDeclarator' &&\n declaration.id.type === 'Identifier' &&\n declaration.id.name === configId &&\n declaration.init?.type === 'ObjectExpression'\n ) {\n return declaration.init;\n }\n }\n }\n }\n return undefined;\n}\n"]}
@@ -236,6 +236,15 @@ Skipping adding Sentry functionality to it.`);
236
236
  prompts_1.default.log.success(`Added Sentry.init code to ${chalk_1.default.cyan(filename)}`);
237
237
  Sentry.setTag(`modified-instrumentation-server`, 'success');
238
238
  }
239
+ const DATA_COLLECTION_HINT = [
240
+ '',
241
+ ' dataCollection: {',
242
+ ' // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:',
243
+ ' // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection',
244
+ ' // userInfo: false,',
245
+ ' // httpBodies: [],',
246
+ ' },',
247
+ ].join('\n');
239
248
  function insertClientInitCall(dsn,
240
249
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
241
250
  originalHooksMod, selectedFeatures) {
@@ -256,14 +265,16 @@ originalHooksMod, selectedFeatures) {
256
265
  if (selectedFeatures.logs) {
257
266
  initArgs.enableLogs = true;
258
267
  }
259
- initArgs.sendDefaultPii = true;
260
268
  // This assignment of any values is fine because we're just creating a function call in magicast
261
269
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
262
270
  const initCall = magicast_1.builders.functionCall('Sentry.init', initArgs);
271
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
272
+ const generatedInitCode = (0, magicast_1.generateCode)(initCall).code;
273
+ const initCodeWithHint = generatedInitCode.replace(/\n\}\)$/, `,${DATA_COLLECTION_HINT}\n})`);
263
274
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
264
275
  const initCallWithComment = magicast_1.builders.raw(
265
276
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
266
- `${initCallComment}\n${(0, magicast_1.generateCode)(initCall).code}`);
277
+ `${initCallComment}\n${initCodeWithHint}`);
267
278
  const originalHooksModAST = originalHooksMod.$ast;
268
279
  const initCallInsertionIndex = getInitCallInsertionIndex(originalHooksModAST);
269
280
  originalHooksModAST.body.splice(initCallInsertionIndex, 0,
@@ -284,16 +295,18 @@ originalMod, selectedFeatures) {
284
295
  if (selectedFeatures.logs) {
285
296
  initArgs.enableLogs = true;
286
297
  }
287
- initArgs.sendDefaultPii = true;
288
298
  // This assignment of any values is fine because we're just creating a function call in magicast
289
299
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
290
300
  const initCall = magicast_1.builders.functionCall('Sentry.init', initArgs);
301
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
302
+ const generatedInitCode = (0, magicast_1.generateCode)(initCall).code;
303
+ const initCodeWithHint = generatedInitCode.replace(/\n\}\)$/, `,${DATA_COLLECTION_HINT}\n})`);
291
304
  const originalModAST = originalMod.$ast;
292
305
  const initCallInsertionIndex = getInitCallInsertionIndex(originalModAST);
293
306
  originalModAST.body.splice(initCallInsertionIndex, 0,
294
307
  // @ts-expect-error - string works here because the AST is proxified by magicast
295
308
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
296
- (0, magicast_1.generateCode)(initCall).code);
309
+ initCodeWithHint);
297
310
  }
298
311
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
299
312
  function wrapHandleError(mod) {