@sentry/wizard 6.12.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 (184) hide show
  1. package/CHANGELOG.md +15 -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/flutter.test.js +60 -0
  9. package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
  10. package/dist/e2e-tests/tests/help-message.test.js +8 -3
  11. package/dist/e2e-tests/tests/help-message.test.js.map +1 -1
  12. package/dist/e2e-tests/tests/nuxt-3.test.js +12 -6
  13. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  14. package/dist/e2e-tests/tests/nuxt-4.test.js +12 -6
  15. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  16. package/dist/e2e-tests/tests/pnpm-workspace.test.js +6 -3
  17. package/dist/e2e-tests/tests/pnpm-workspace.test.js.map +1 -1
  18. package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js +4 -4
  19. package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js.map +1 -1
  20. package/dist/e2e-tests/tests/react-router.test.js +3 -6
  21. package/dist/e2e-tests/tests/react-router.test.js.map +1 -1
  22. package/dist/e2e-tests/tests/remix.test.js +2 -4
  23. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  24. package/dist/e2e-tests/tests/sveltekit-hooks.test.js +24 -8
  25. package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -1
  26. package/dist/e2e-tests/tests/sveltekit-tracing.test.js +6 -3
  27. package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
  28. package/dist/lib/Constants.d.ts +1 -0
  29. package/dist/lib/Constants.js +5 -0
  30. package/dist/lib/Constants.js.map +1 -1
  31. package/dist/lib/Steps/Integrations/Electron.js +2 -2
  32. package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
  33. package/dist/src/android/android-wizard.js +3 -0
  34. package/dist/src/android/android-wizard.js.map +1 -1
  35. package/dist/src/angular/codemods/main.d.ts +1 -1
  36. package/dist/src/angular/codemods/main.js +0 -1
  37. package/dist/src/angular/codemods/main.js.map +1 -1
  38. package/dist/src/apple/apple-wizard.js +2 -3
  39. package/dist/src/apple/apple-wizard.js.map +1 -1
  40. package/dist/src/apple/check-installed-cli.d.ts +1 -1
  41. package/dist/src/apple/check-installed-cli.js +13 -7
  42. package/dist/src/apple/check-installed-cli.js.map +1 -1
  43. package/dist/src/apple/configure-xcode-project.js +8 -1
  44. package/dist/src/apple/configure-xcode-project.js.map +1 -1
  45. package/dist/src/apple/lookup-xcode-project.d.ts +8 -5
  46. package/dist/src/apple/lookup-xcode-project.js +22 -17
  47. package/dist/src/apple/lookup-xcode-project.js.map +1 -1
  48. package/dist/src/apple/options.d.ts +5 -0
  49. package/dist/src/apple/options.js.map +1 -1
  50. package/dist/src/apple/sentry-swift-package.d.ts +4 -0
  51. package/dist/src/apple/sentry-swift-package.js +17 -0
  52. package/dist/src/apple/sentry-swift-package.js.map +1 -0
  53. package/dist/src/apple/snapshots/apple-snapshots-wizard.d.ts +2 -0
  54. package/dist/src/apple/snapshots/apple-snapshots-wizard.js +251 -0
  55. package/dist/src/apple/snapshots/apple-snapshots-wizard.js.map +1 -0
  56. package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.d.ts +13 -0
  57. package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js +48 -0
  58. package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js.map +1 -0
  59. package/dist/src/apple/snapshots/snapshot-test-file.d.ts +18 -0
  60. package/dist/src/apple/snapshots/snapshot-test-file.js +122 -0
  61. package/dist/src/apple/snapshots/snapshot-test-file.js.map +1 -0
  62. package/dist/src/apple/snapshots/snapshot-verification-scheme.d.ts +6 -0
  63. package/dist/src/apple/snapshots/snapshot-verification-scheme.js +147 -0
  64. package/dist/src/apple/snapshots/snapshot-verification-scheme.js.map +1 -0
  65. package/dist/src/apple/snapshots/snapshotpreviews-package.d.ts +4 -0
  66. package/dist/src/apple/snapshots/snapshotpreviews-package.js +8 -0
  67. package/dist/src/apple/snapshots/snapshotpreviews-package.js.map +1 -0
  68. package/dist/src/apple/snapshots/snapshots-cli-preflight.d.ts +23 -0
  69. package/dist/src/apple/snapshots/snapshots-cli-preflight.js +136 -0
  70. package/dist/src/apple/snapshots/snapshots-cli-preflight.js.map +1 -0
  71. package/dist/src/apple/xcode-manager.d.ts +59 -1
  72. package/dist/src/apple/xcode-manager.js +507 -106
  73. package/dist/src/apple/xcode-manager.js.map +1 -1
  74. package/dist/src/flutter/flutter-wizard.js +3 -0
  75. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  76. package/dist/src/nextjs/templates.js +12 -6
  77. package/dist/src/nextjs/templates.js.map +1 -1
  78. package/dist/src/nuxt/templates.js +12 -6
  79. package/dist/src/nuxt/templates.js.map +1 -1
  80. package/dist/src/react-router/codemods/client.entry.d.ts +1 -1
  81. package/dist/src/react-router/codemods/client.entry.js +93 -52
  82. package/dist/src/react-router/codemods/client.entry.js.map +1 -1
  83. package/dist/src/react-router/codemods/server-entry.js +8 -7
  84. package/dist/src/react-router/codemods/server-entry.js.map +1 -1
  85. package/dist/src/react-router/react-router-wizard.js +13 -19
  86. package/dist/src/react-router/react-router-wizard.js.map +1 -1
  87. package/dist/src/react-router/sdk-setup.d.ts +2 -2
  88. package/dist/src/react-router/sdk-setup.js +16 -15
  89. package/dist/src/react-router/sdk-setup.js.map +1 -1
  90. package/dist/src/react-router/templates.d.ts +1 -3
  91. package/dist/src/react-router/templates.js +24 -92
  92. package/dist/src/react-router/templates.js.map +1 -1
  93. package/dist/src/remix/sdk-setup.js +1 -2
  94. package/dist/src/remix/sdk-setup.js.map +1 -1
  95. package/dist/src/run.d.ts +4 -1
  96. package/dist/src/run.js +13 -0
  97. package/dist/src/run.js.map +1 -1
  98. package/dist/src/sourcemaps/tools/remix.js +4 -4
  99. package/dist/src/sourcemaps/tools/remix.js.map +1 -1
  100. package/dist/src/sveltekit/sdk-setup/setup.js +17 -4
  101. package/dist/src/sveltekit/sdk-setup/setup.js.map +1 -1
  102. package/dist/src/sveltekit/templates.js +12 -6
  103. package/dist/src/sveltekit/templates.js.map +1 -1
  104. package/dist/src/utils/clack/index.d.ts +2 -1
  105. package/dist/src/utils/clack/index.js +17 -6
  106. package/dist/src/utils/clack/index.js.map +1 -1
  107. package/dist/src/utils/files.d.ts +2 -0
  108. package/dist/src/utils/files.js +58 -0
  109. package/dist/src/utils/files.js.map +1 -0
  110. package/dist/src/utils/git.d.ts +3 -1
  111. package/dist/src/utils/git.js +2 -1
  112. package/dist/src/utils/git.js.map +1 -1
  113. package/dist/src/utils/line-endings.d.ts +1 -0
  114. package/dist/src/utils/line-endings.js +76 -0
  115. package/dist/src/utils/line-endings.js.map +1 -0
  116. package/dist/src/version.d.ts +1 -1
  117. package/dist/src/version.js +1 -1
  118. package/dist/src/version.js.map +1 -1
  119. package/dist/test/angular/angular-wizard.test.js +0 -5
  120. package/dist/test/angular/angular-wizard.test.js.map +1 -1
  121. package/dist/test/apple/lookup-xcode-project.test.js +167 -0
  122. package/dist/test/apple/lookup-xcode-project.test.js.map +1 -0
  123. package/dist/test/apple/snapshots/apple-snapshots-wizard.test.d.ts +1 -0
  124. package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js +487 -0
  125. package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js.map +1 -0
  126. package/dist/test/apple/snapshots/hosted-test-target-fixture.d.ts +24 -0
  127. package/dist/test/apple/snapshots/hosted-test-target-fixture.js +191 -0
  128. package/dist/test/apple/snapshots/hosted-test-target-fixture.js.map +1 -0
  129. package/dist/test/apple/snapshots/snapshot-test-file.test.d.ts +1 -0
  130. package/dist/test/apple/snapshots/snapshot-test-file.test.js +110 -0
  131. package/dist/test/apple/snapshots/snapshot-test-file.test.js.map +1 -0
  132. package/dist/test/apple/snapshots/snapshot-verification-scheme.test.d.ts +1 -0
  133. package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js +146 -0
  134. package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js.map +1 -0
  135. package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.d.ts +1 -0
  136. package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js +186 -0
  137. package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js.map +1 -0
  138. package/dist/test/apple/snapshots/snapshots-cli-preflight.test.d.ts +1 -0
  139. package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js +192 -0
  140. package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js.map +1 -0
  141. package/dist/test/apple/snapshots/source-file-insertion.test.d.ts +1 -0
  142. package/dist/test/apple/snapshots/source-file-insertion.test.js +77 -0
  143. package/dist/test/apple/snapshots/source-file-insertion.test.js.map +1 -0
  144. package/dist/test/apple/xcode-manager.test.js +452 -43
  145. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  146. package/dist/test/constants.test.d.ts +1 -0
  147. package/dist/test/constants.test.js +12 -0
  148. package/dist/test/constants.test.js.map +1 -0
  149. package/dist/test/nextjs/templates.test.js +66 -33
  150. package/dist/test/nextjs/templates.test.js.map +1 -1
  151. package/dist/test/nuxt/templates.test.js +66 -36
  152. package/dist/test/nuxt/templates.test.js.map +1 -1
  153. package/dist/test/react-router/codemods/client-entry.test.js +15 -11
  154. package/dist/test/react-router/codemods/client-entry.test.js.map +1 -1
  155. package/dist/test/react-router/codemods/server-entry.test.js +21 -8
  156. package/dist/test/react-router/codemods/server-entry.test.js.map +1 -1
  157. package/dist/test/react-router/sdk-setup.test.js +46 -10
  158. package/dist/test/react-router/sdk-setup.test.js.map +1 -1
  159. package/dist/test/react-router/templates.test.js +26 -64
  160. package/dist/test/react-router/templates.test.js.map +1 -1
  161. package/dist/test/remix/build-script.test.d.ts +1 -0
  162. package/dist/test/remix/build-script.test.js +124 -0
  163. package/dist/test/remix/build-script.test.js.map +1 -0
  164. package/dist/test/remix/client-entry.test.js +4 -10
  165. package/dist/test/remix/client-entry.test.js.map +1 -1
  166. package/dist/test/run.test.d.ts +1 -0
  167. package/dist/test/run.test.js +137 -0
  168. package/dist/test/run.test.js.map +1 -0
  169. package/dist/test/sveltekit/templates.test.js +78 -27
  170. package/dist/test/sveltekit/templates.test.js.map +1 -1
  171. package/dist/test/utils/clack/index.test.js +101 -0
  172. package/dist/test/utils/clack/index.test.js.map +1 -1
  173. package/dist/test/utils/git.test.js +10 -0
  174. package/dist/test/utils/git.test.js.map +1 -1
  175. package/dist/test/utils/line-endings.test.d.ts +1 -0
  176. package/dist/test/utils/line-endings.test.js +103 -0
  177. package/dist/test/utils/line-endings.test.js.map +1 -0
  178. package/package.json +2 -2
  179. package/dist/src/react-router/codemods/root.d.ts +0 -1
  180. package/dist/src/react-router/codemods/root.js +0 -170
  181. package/dist/src/react-router/codemods/root.js.map +0 -1
  182. package/dist/test/react-router/codemods/root.test.js +0 -182
  183. package/dist/test/react-router/codemods/root.test.js.map +0 -1
  184. /package/dist/test/{react-router/codemods/root.test.d.ts → apple/lookup-xcode-project.test.d.ts} +0 -0
@@ -52,15 +52,18 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
52
52
  // Enable logs to be sent to Sentry
53
53
  enableLogs: true,
54
54
 
55
- // Enable sending of user PII (Personally Identifiable Information)
56
- // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii
57
- sendDefaultPii: true,
55
+ dataCollection: {
56
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
57
+ // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#dataCollection
58
+ // userInfo: false,
59
+ // httpBodies: [],
60
+ },
58
61
 
59
62
  // Setting this option to true will print useful information to the console while you're setting up Sentry.
60
63
  debug: false,
61
64
  });
62
65
  "
63
- `);
66
+ `);
64
67
  });
65
68
  (0, vitest_1.it)('generates Sentry config with performance monitoring disabled', () => {
66
69
  const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'client', {
@@ -90,15 +93,18 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
90
93
  // Enable logs to be sent to Sentry
91
94
  enableLogs: true,
92
95
 
93
- // Enable sending of user PII (Personally Identifiable Information)
94
- // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii
95
- sendDefaultPii: true,
96
+ dataCollection: {
97
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
98
+ // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#dataCollection
99
+ // userInfo: false,
100
+ // httpBodies: [],
101
+ },
96
102
 
97
103
  // Setting this option to true will print useful information to the console while you're setting up Sentry.
98
104
  debug: false,
99
105
  });
100
106
  "
101
- `);
107
+ `);
102
108
  });
103
109
  (0, vitest_1.it)('generates Sentry config with session replay disabled', () => {
104
110
  const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'client', {
@@ -121,9 +127,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
121
127
  // Enable logs to be sent to Sentry
122
128
  enableLogs: true,
123
129
 
124
- // Enable sending of user PII (Personally Identifiable Information)
125
- // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii
126
- sendDefaultPii: true,
130
+ dataCollection: {
131
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
132
+ // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#dataCollection
133
+ // userInfo: false,
134
+ // httpBodies: [],
135
+ },
127
136
 
128
137
  // Setting this option to true will print useful information to the console while you're setting up Sentry.
129
138
  debug: false,
@@ -160,9 +169,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
160
169
  // If you don't want to use Session Replay, just remove the line below:
161
170
  integrations: [Sentry.replayIntegration()],
162
171
 
163
- // Enable sending of user PII (Personally Identifiable Information)
164
- // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii
165
- sendDefaultPii: true,
172
+ dataCollection: {
173
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
174
+ // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#dataCollection
175
+ // userInfo: false,
176
+ // httpBodies: [],
177
+ },
166
178
 
167
179
  // Setting this option to true will print useful information to the console while you're setting up Sentry.
168
180
  debug: false,
@@ -187,9 +199,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
187
199
  // Enable logs to be sent to Sentry
188
200
  enableLogs: true,
189
201
 
190
- // Enable sending of user PII (Personally Identifiable Information)
191
- // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii
192
- sendDefaultPii: true,
202
+ dataCollection: {
203
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
204
+ // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#dataCollection
205
+ // userInfo: false,
206
+ // httpBodies: [],
207
+ },
193
208
 
194
209
  // Setting this option to true will print useful information to the console while you're setting up Sentry.
195
210
  debug: false,
@@ -211,9 +226,12 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
211
226
  // dsn: useRuntimeConfig().public.sentry.dsn,
212
227
  dsn: "https://sentry.io/123",
213
228
 
214
- // Enable sending of user PII (Personally Identifiable Information)
215
- // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii
216
- sendDefaultPii: true,
229
+ dataCollection: {
230
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
231
+ // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#dataCollection
232
+ // userInfo: false,
233
+ // httpBodies: [],
234
+ },
217
235
 
218
236
  // Setting this option to true will print useful information to the console while you're setting up Sentry.
219
237
  debug: false,
@@ -242,15 +260,18 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
242
260
  // Enable logs to be sent to Sentry
243
261
  enableLogs: true,
244
262
 
245
- // Enable sending of user PII (Personally Identifiable Information)
246
- // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii
247
- sendDefaultPii: true,
263
+ dataCollection: {
264
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
265
+ // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#dataCollection
266
+ // userInfo: false,
267
+ // httpBodies: [],
268
+ },
248
269
 
249
270
  // Setting this option to true will print useful information to the console while you're setting up Sentry.
250
271
  debug: false,
251
272
  });
252
273
  "
253
- `);
274
+ `);
254
275
  });
255
276
  (0, vitest_1.it)('generates Sentry config with performance monitoring disabled', () => {
256
277
  const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'server', {
@@ -267,15 +288,18 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
267
288
  // Enable logs to be sent to Sentry
268
289
  enableLogs: true,
269
290
 
270
- // Enable sending of user PII (Personally Identifiable Information)
271
- // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii
272
- sendDefaultPii: true,
291
+ dataCollection: {
292
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
293
+ // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#dataCollection
294
+ // userInfo: false,
295
+ // httpBodies: [],
296
+ },
273
297
 
274
298
  // Setting this option to true will print useful information to the console while you're setting up Sentry.
275
299
  debug: false,
276
300
  });
277
301
  "
278
- `);
302
+ `);
279
303
  });
280
304
  (0, vitest_1.it)('generates Sentry config with logs disabled', () => {
281
305
  const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'server', {
@@ -293,15 +317,18 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
293
317
  // for finer control
294
318
  tracesSampleRate: 1.0,
295
319
 
296
- // Enable sending of user PII (Personally Identifiable Information)
297
- // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii
298
- sendDefaultPii: true,
320
+ dataCollection: {
321
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
322
+ // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#dataCollection
323
+ // userInfo: false,
324
+ // httpBodies: [],
325
+ },
299
326
 
300
327
  // Setting this option to true will print useful information to the console while you're setting up Sentry.
301
328
  debug: false,
302
329
  });
303
330
  "
304
- `);
331
+ `);
305
332
  });
306
333
  (0, vitest_1.it)('generates Sentry config with all features disabled', () => {
307
334
  const template = (0, templates_1.getSentryConfigContents)('https://sentry.io/123', 'server', {
@@ -315,15 +342,18 @@ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
315
342
  Sentry.init({
316
343
  dsn: "https://sentry.io/123",
317
344
 
318
- // Enable sending of user PII (Personally Identifiable Information)
319
- // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii
320
- sendDefaultPii: true,
345
+ dataCollection: {
346
+ // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
347
+ // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#dataCollection
348
+ // userInfo: false,
349
+ // httpBodies: [],
350
+ },
321
351
 
322
352
  // Setting this option to true will print useful information to the console while you're setting up Sentry.
323
353
  debug: false,
324
354
  });
325
355
  "
326
- `);
356
+ `);
327
357
  });
328
358
  });
329
359
  });
@@ -1 +1 @@
1
- {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/nuxt/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAAkD;AAClD,wDAIkC;AAElC,WAAE,CAAC,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,CAAC;IACjD,2BAA2B,EAAE,WAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAA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AE,IAAI;aACjB,EACD,IAAI,CACL,CAAC;YAEF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;OActC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it, vi } from 'vitest';\nimport {\n getDefaultNuxtConfig,\n getNuxtModuleFallbackTemplate,\n getSentryConfigContents,\n} from '../../src/nuxt/templates';\n\nvi.mock('../../src/utils/clack/mcp-config', () => ({\n offerProjectScopedMcpConfig: vi.fn().mockResolvedValue(undefined),\n}));\n\ndescribe('Nuxt code templates', () => {\n describe('getDefaultNuxtConfig', () => {\n it('returns a default nuxt config', () => {\n expect(getDefaultNuxtConfig()).toMatchInlineSnapshot(`\n \"// https://nuxt.com/docs/api/configuration/nuxt-config\n export default defineNuxtConfig({\n compatibilityDate: '2024-04-03',\n devtools: { enabled: true }\n })\n \"\n`);\n });\n });\n\n describe('getSentryConfigContents', () => {\n describe('client config', () => {\n it('generates Sentry config with all features enabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: true,\n replay: true,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending of user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: false,\n replay: true,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending of user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with session replay disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: true,\n replay: false,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending of user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with logs disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: true,\n replay: true,\n logs: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\n\n // Enable sending of user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring and session replay disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending of user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with all features disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: false,\n replay: false,\n logs: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // Enable sending of user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n\n describe('server config', () => {\n it('generates Sentry config with all features enabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: true,\n replay: true,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending of user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: false,\n replay: true,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending of user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with logs disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: true,\n replay: true,\n logs: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // Enable sending of user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with all features disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: false,\n replay: false,\n logs: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n\n // Enable sending of user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n });\n\n describe('getNuxtModuleFallbackTemplate', () => {\n it('generates configuration options for the nuxt config', () => {\n const template = getNuxtModuleFallbackTemplate(\n {\n org: 'my-org',\n project: 'my-project',\n url: 'https://sentry.io',\n selfHosted: false,\n },\n false,\n );\n\n expect(template).toMatchInlineSnapshot(`\n \" modules: [\"@sentry/nuxt/module\"],\n sentry: {\n org: \"my-org\",\n project: \"my-project\",\n sourcemaps: { \n // This will delete all .map files in the build output after uploading them to Sentry. Modify as needed.\n // For more information, see: https://docs.sentry.io/platforms/javascript/guides/nuxt/sourcemaps/\n filesToDeleteAfterUpload: ['.*/**/*.map'] \n },\n },\n sourcemap: { client: \"hidden\" },\"\n `);\n });\n\n it('generates configuration options for the nuxt config with top level import', () => {\n const template = getNuxtModuleFallbackTemplate(\n {\n org: 'my-org',\n project: 'my-project',\n url: 'https://sentry.io',\n selfHosted: false,\n },\n true,\n );\n\n expect(template).toMatchInlineSnapshot(`\n \" modules: [\"@sentry/nuxt/module\"],\n sentry: {\n org: \"my-org\",\n project: \"my-project\",\n sourcemaps: { \n // This will delete all .map files in the build output after uploading them to Sentry. Modify as needed.\n // For more information, see: https://docs.sentry.io/platforms/javascript/guides/nuxt/sourcemaps/\n filesToDeleteAfterUpload: ['.*/**/*.map'] \n },\n autoInjectServerSentry: \"top-level-import\",\n },\n sourcemap: { client: \"hidden\" },\"\n `);\n });\n\n it('generates configuration options for the nuxt config with top level import and self-hosted url', () => {\n const template = getNuxtModuleFallbackTemplate(\n {\n org: 'my-org',\n project: 'my-project',\n url: 'https://sentry.io',\n selfHosted: true,\n },\n true,\n );\n\n expect(template).toMatchInlineSnapshot(`\n \" modules: [\"@sentry/nuxt/module\"],\n sentry: {\n org: \"my-org\",\n project: \"my-project\",\n url: \"https://sentry.io\",\n sourcemaps: { \n // This will delete all .map files in the build output after uploading them to Sentry. Modify as needed.\n // For more information, see: https://docs.sentry.io/platforms/javascript/guides/nuxt/sourcemaps/\n filesToDeleteAfterUpload: ['.*/**/*.map'] \n },\n autoInjectServerSentry: \"top-level-import\",\n },\n sourcemap: { client: \"hidden\" },\"\n `);\n });\n });\n});\n"]}
1
+ {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/nuxt/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAAkD;AAClD,wDAIkC;AAElC,WAAE,CAAC,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,CAAC;IACjD,2BAA2B,EAAE,WAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;CAClE,CAAC,CAAC,CAAC;AAEJ,IAAA,iBAAQ,EAAC,qBAAqB,EAAE,GAAG,EAA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M,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;OActC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it, vi } from 'vitest';\nimport {\n getDefaultNuxtConfig,\n getNuxtModuleFallbackTemplate,\n getSentryConfigContents,\n} from '../../src/nuxt/templates';\n\nvi.mock('../../src/utils/clack/mcp-config', () => ({\n offerProjectScopedMcpConfig: vi.fn().mockResolvedValue(undefined),\n}));\n\ndescribe('Nuxt code templates', () => {\n describe('getDefaultNuxtConfig', () => {\n it('returns a default nuxt config', () => {\n expect(getDefaultNuxtConfig()).toMatchInlineSnapshot(`\n \"// https://nuxt.com/docs/api/configuration/nuxt-config\n export default defineNuxtConfig({\n compatibilityDate: '2024-04-03',\n devtools: { enabled: true }\n })\n \"\n`);\n });\n });\n\n describe('getSentryConfigContents', () => {\n describe('client config', () => {\n it('generates Sentry config with all features enabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: true,\n replay: true,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\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/nuxt/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: false,\n replay: true,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\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/nuxt/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with session replay disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: true,\n replay: false,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\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/nuxt/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with logs disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: true,\n replay: true,\n logs: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\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/nuxt/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring and session replay disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\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/nuxt/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with all features disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: false,\n replay: false,\n logs: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\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/nuxt/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n\n describe('server config', () => {\n it('generates Sentry config with all features enabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: true,\n replay: true,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\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/nuxt/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: false,\n replay: true,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\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/nuxt/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with logs disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: true,\n replay: true,\n logs: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\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/nuxt/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with all features disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: false,\n replay: false,\n logs: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\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/nuxt/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n });\n\n describe('getNuxtModuleFallbackTemplate', () => {\n it('generates configuration options for the nuxt config', () => {\n const template = getNuxtModuleFallbackTemplate(\n {\n org: 'my-org',\n project: 'my-project',\n url: 'https://sentry.io',\n selfHosted: false,\n },\n false,\n );\n\n expect(template).toMatchInlineSnapshot(`\n \" modules: [\"@sentry/nuxt/module\"],\n sentry: {\n org: \"my-org\",\n project: \"my-project\",\n sourcemaps: { \n // This will delete all .map files in the build output after uploading them to Sentry. Modify as needed.\n // For more information, see: https://docs.sentry.io/platforms/javascript/guides/nuxt/sourcemaps/\n filesToDeleteAfterUpload: ['.*/**/*.map'] \n },\n },\n sourcemap: { client: \"hidden\" },\"\n `);\n });\n\n it('generates configuration options for the nuxt config with top level import', () => {\n const template = getNuxtModuleFallbackTemplate(\n {\n org: 'my-org',\n project: 'my-project',\n url: 'https://sentry.io',\n selfHosted: false,\n },\n true,\n );\n\n expect(template).toMatchInlineSnapshot(`\n \" modules: [\"@sentry/nuxt/module\"],\n sentry: {\n org: \"my-org\",\n project: \"my-project\",\n sourcemaps: { \n // This will delete all .map files in the build output after uploading them to Sentry. Modify as needed.\n // For more information, see: https://docs.sentry.io/platforms/javascript/guides/nuxt/sourcemaps/\n filesToDeleteAfterUpload: ['.*/**/*.map'] \n },\n autoInjectServerSentry: \"top-level-import\",\n },\n sourcemap: { client: \"hidden\" },\"\n `);\n });\n\n it('generates configuration options for the nuxt config with top level import and self-hosted url', () => {\n const template = getNuxtModuleFallbackTemplate(\n {\n org: 'my-org',\n project: 'my-project',\n url: 'https://sentry.io',\n selfHosted: true,\n },\n true,\n );\n\n expect(template).toMatchInlineSnapshot(`\n \" modules: [\"@sentry/nuxt/module\"],\n sentry: {\n org: \"my-org\",\n project: \"my-project\",\n url: \"https://sentry.io\",\n sourcemaps: { \n // This will delete all .map files in the build output after uploading them to Sentry. Modify as needed.\n // For more information, see: https://docs.sentry.io/platforms/javascript/guides/nuxt/sourcemaps/\n filesToDeleteAfterUpload: ['.*/**/*.map'] \n },\n autoInjectServerSentry: \"top-level-import\",\n },\n sourcemap: { client: \"hidden\" },\"\n `);\n });\n });\n});\n"]}
@@ -61,7 +61,7 @@ vitest_1.vi.mock('@clack/prompts', () => {
61
61
  (0, vitest_1.it)('should add Sentry import and initialization with all features enabled', async () => {
62
62
  const basicContent = fs.readFileSync(path.join(fixturesDir, 'basic.tsx'), 'utf8');
63
63
  fs.writeFileSync(tmpFile, basicContent);
64
- await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', true, true, true);
64
+ await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', true, true, true, false, true);
65
65
  const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
66
66
  (0, vitest_1.expect)(modifiedContent).toContain('import * as Sentry from "@sentry/react-router";');
67
67
  (0, vitest_1.expect)(modifiedContent).toContain('Sentry.init({');
@@ -70,6 +70,7 @@ vitest_1.vi.mock('@clack/prompts', () => {
70
70
  (0, vitest_1.expect)(modifiedContent).toContain('Sentry.reactRouterTracingIntegration()');
71
71
  (0, vitest_1.expect)(modifiedContent).toContain('Sentry.replayIntegration(');
72
72
  (0, vitest_1.expect)(modifiedContent).toContain('enableLogs: true');
73
+ (0, vitest_1.expect)(modifiedContent).toContain('onError={Sentry.sentryOnError}');
73
74
  });
74
75
  (0, vitest_1.it)('should add Sentry initialization with only tracing enabled', async () => {
75
76
  const basicContent = fs.readFileSync(path.join(fixturesDir, 'basic.tsx'), 'utf8');
@@ -123,13 +124,16 @@ vitest_1.vi.mock('@clack/prompts', () => {
123
124
  (0, vitest_1.expect)(modifiedContent).not.toContain('Sentry.replayIntegration()');
124
125
  (0, vitest_1.expect)(modifiedContent).not.toContain('enableLogs: true');
125
126
  });
126
- (0, vitest_1.it)('should not modify file when Sentry content already exists', async () => {
127
+ (0, vitest_1.it)('should not add Sentry.init when Sentry content already exists but still add onError', async () => {
127
128
  const withSentryContent = fs.readFileSync(path.join(fixturesDir, 'with-sentry.tsx'), 'utf8');
128
129
  fs.writeFileSync(tmpFile, withSentryContent);
129
- await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', true, true, true);
130
+ await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', true, true, true, false, true);
130
131
  const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
131
- // Content should remain unchanged
132
- (0, vitest_1.expect)(modifiedContent).toBe(withSentryContent);
132
+ // Should not duplicate Sentry.init
133
+ const initCount = (modifiedContent.match(/Sentry\.init\(/g) || []).length;
134
+ (0, vitest_1.expect)(initCount).toBe(1);
135
+ // Should still add onError prop to HydratedRouter
136
+ (0, vitest_1.expect)(modifiedContent).toContain('onError={Sentry.sentryOnError}');
133
137
  });
134
138
  (0, vitest_1.it)('should insert Sentry initialization after imports', async () => {
135
139
  const withImportsContent = fs.readFileSync(path.join(fixturesDir, 'with-imports.tsx'), 'utf8');
@@ -170,27 +174,27 @@ vitest_1.vi.mock('@clack/prompts', () => {
170
174
  fs.writeFileSync(tmpFile, basicContent);
171
175
  await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', true, false, false, true);
172
176
  const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
173
- (0, vitest_1.expect)(modifiedContent).toContain('const tracing = Sentry.reactRouterTracingIntegration({ useInstrumentationAPI: true });');
177
+ (0, vitest_1.expect)(modifiedContent).toContain('const tracing = Sentry.reactRouterTracingIntegration();');
174
178
  (0, vitest_1.expect)(modifiedContent).toContain('integrations: [tracing]');
175
- (0, vitest_1.expect)(modifiedContent).toContain('unstable_instrumentations={[tracing.clientInstrumentation]}');
179
+ (0, vitest_1.expect)(modifiedContent).toContain('instrumentations={[tracing.clientInstrumentation]}');
176
180
  });
177
181
  (0, vitest_1.it)('should combine instrumentation API with replay', async () => {
178
182
  const basicContent = fs.readFileSync(path.join(fixturesDir, 'basic.tsx'), 'utf8');
179
183
  fs.writeFileSync(tmpFile, basicContent);
180
184
  await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', true, true, false, true);
181
185
  const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
182
- (0, vitest_1.expect)(modifiedContent).toContain('const tracing = Sentry.reactRouterTracingIntegration({ useInstrumentationAPI: true });');
186
+ (0, vitest_1.expect)(modifiedContent).toContain('const tracing = Sentry.reactRouterTracingIntegration();');
183
187
  (0, vitest_1.expect)(modifiedContent).toContain('integrations: [tracing, Sentry.replayIntegration()]');
184
- (0, vitest_1.expect)(modifiedContent).toContain('unstable_instrumentations={[tracing.clientInstrumentation]}');
188
+ (0, vitest_1.expect)(modifiedContent).toContain('instrumentations={[tracing.clientInstrumentation]}');
185
189
  });
186
190
  (0, vitest_1.it)('should not use instrumentation API when useInstrumentationAPI is false', async () => {
187
191
  const basicContent = fs.readFileSync(path.join(fixturesDir, 'basic.tsx'), 'utf8');
188
192
  fs.writeFileSync(tmpFile, basicContent);
189
193
  await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', true, false, false, false);
190
194
  const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
191
- (0, vitest_1.expect)(modifiedContent).not.toContain('const tracing = Sentry.reactRouterTracingIntegration({ useInstrumentationAPI: true });');
195
+ (0, vitest_1.expect)(modifiedContent).not.toContain('const tracing');
192
196
  (0, vitest_1.expect)(modifiedContent).toContain('Sentry.reactRouterTracingIntegration()');
193
- (0, vitest_1.expect)(modifiedContent).not.toContain('unstable_instrumentations');
197
+ (0, vitest_1.expect)(modifiedContent).not.toContain('instrumentations');
194
198
  });
195
199
  });
196
200
  });
@@ -1 +1 @@
1
- {"version":3,"file":"client-entry.test.js","sourceRoot":"","sources":["../../../../test/react-router/codemods/client-entry.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAyE;AACzE,uCAAyB;AACzB,2CAA6B;AAC7B,kFAAwF;AAExF,WAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC7B,MAAM,IAAI,GAAG;QACX,GAAG,EAAE;YACH,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,OAAO,EAAE,WAAE,CAAC,EAAE,EAAE;SACjB;KACF,CAAC;I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,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAEzD,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,SAAS,CAC/B,wFAAwF,CACzF,CAAC;YACF,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,SAAS,CAC/B,qDAAqD,CACtD,CAAC;YACF,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,SAAS,CAC/B,6DAA6D,CAC9D,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,wEAAwE,EAAE,KAAK,IAAI,EAAE;YACtF,MAAM,YAAY,GAAG,EAAE,CAAC,YAAY,CAClC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,EACnC,MAAM,CACP,CAAC;YAEF,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAExC,MAAM,IAAA,oCAAqB,EACzB,OAAO,EACP,UAAU,EACV,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,CACN,CAAC;YAEF,MAAM,eAAe,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAEzD,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,GAAG,CAAC,SAAS,CACnC,wFAAwF,CACzF,CAAC;YACF,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,SAAS,CAC/B,wCAAwC,CACzC,CAAC;YACF,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { instrumentClientEntry } from '../../../src/react-router/codemods/client.entry';\n\nvi.mock('@clack/prompts', () => {\n const mock = {\n log: {\n warn: vi.fn(),\n info: vi.fn(),\n success: vi.fn(),\n },\n };\n return {\n default: mock,\n ...mock,\n };\n});\n\ndescribe('instrumentClientEntry', () => {\n const fixturesDir = path.join(__dirname, 'fixtures', 'client-entry');\n let tmpDir: string;\n let tmpFile: string;\n\n beforeEach(() => {\n vi.clearAllMocks();\n\n // Create unique tmp directory for each test\n tmpDir = path.join(\n fixturesDir,\n 'tmp',\n `test-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n );\n tmpFile = path.join(tmpDir, 'entry.client.tsx');\n\n // Ensure tmp directory exists\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n // Clean up tmp directory\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true });\n }\n });\n\n it('should add Sentry import and initialization with all features enabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, true, true);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: [');\n expect(modifiedContent).toContain('Sentry.reactRouterTracingIntegration()');\n expect(modifiedContent).toContain('Sentry.replayIntegration(');\n expect(modifiedContent).toContain('enableLogs: true');\n });\n\n it('should add Sentry initialization with only tracing enabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, false, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: [');\n expect(modifiedContent).toContain('Sentry.reactRouterTracingIntegration()');\n expect(modifiedContent).not.toContain('Sentry.replayIntegration()');\n expect(modifiedContent).not.toContain('enableLogs: true');\n });\n\n it('should add Sentry initialization with only replay enabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', false, true, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: [');\n expect(modifiedContent).not.toContain(\n 'Sentry.reactRouterTracingIntegration()',\n );\n expect(modifiedContent).toContain('Sentry.replayIntegration(');\n expect(modifiedContent).not.toContain('enableLogs: true');\n });\n\n it('should add Sentry initialization with only logs enabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', false, false, true);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: [');\n expect(modifiedContent).not.toContain(\n 'Sentry.reactRouterTracingIntegration()',\n );\n expect(modifiedContent).not.toContain('Sentry.replayIntegration()');\n expect(modifiedContent).toContain('enableLogs: true');\n });\n\n it('should add minimal Sentry initialization when all features are disabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', false, false, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: []');\n expect(modifiedContent).not.toContain(\n 'Sentry.reactRouterTracingIntegration()',\n );\n expect(modifiedContent).not.toContain('Sentry.replayIntegration()');\n expect(modifiedContent).not.toContain('enableLogs: true');\n });\n\n it('should not modify file when Sentry content already exists', async () => {\n const withSentryContent = fs.readFileSync(\n path.join(fixturesDir, 'with-sentry.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, withSentryContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, true, true);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n // Content should remain unchanged\n expect(modifiedContent).toBe(withSentryContent);\n });\n\n it('should insert Sentry initialization after imports', async () => {\n const withImportsContent = fs.readFileSync(\n path.join(fixturesDir, 'with-imports.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, withImportsContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, false, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n\n // Check that the Sentry import is before the init call\n const sentryImportIndex = modifiedContent.indexOf(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n const sentryInitIndex = modifiedContent.indexOf('Sentry.init({');\n expect(sentryImportIndex).toBeLessThan(sentryInitIndex);\n });\n\n it('should handle files with no imports', async () => {\n const noImportsContent = fs.readFileSync(\n path.join(fixturesDir, 'no-imports.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, noImportsContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', false, true, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('Sentry.replayIntegration(');\n });\n\n it('should preserve existing code structure', async () => {\n const complexContent = fs.readFileSync(\n path.join(fixturesDir, 'complex.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, complexContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, true, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n\n // Original content should still be there\n expect(modifiedContent).toContain('startTransition');\n expect(modifiedContent).toContain('hydrateRoot');\n expect(modifiedContent).toContain('<StrictMode>');\n });\n\n describe('Instrumentation API', () => {\n it('should add instrumentation API setup when enabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(\n tmpFile,\n 'test-dsn',\n true,\n false,\n false,\n true,\n );\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'const tracing = Sentry.reactRouterTracingIntegration({ useInstrumentationAPI: true });',\n );\n expect(modifiedContent).toContain('integrations: [tracing]');\n expect(modifiedContent).toContain(\n 'unstable_instrumentations={[tracing.clientInstrumentation]}',\n );\n });\n\n it('should combine instrumentation API with replay', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, true, false, true);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'const tracing = Sentry.reactRouterTracingIntegration({ useInstrumentationAPI: true });',\n );\n expect(modifiedContent).toContain(\n 'integrations: [tracing, Sentry.replayIntegration()]',\n );\n expect(modifiedContent).toContain(\n 'unstable_instrumentations={[tracing.clientInstrumentation]}',\n );\n });\n\n it('should not use instrumentation API when useInstrumentationAPI is false', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(\n tmpFile,\n 'test-dsn',\n true,\n false,\n false,\n false,\n );\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).not.toContain(\n 'const tracing = Sentry.reactRouterTracingIntegration({ useInstrumentationAPI: true });',\n );\n expect(modifiedContent).toContain(\n 'Sentry.reactRouterTracingIntegration()',\n );\n expect(modifiedContent).not.toContain('unstable_instrumentations');\n });\n });\n});\n"]}
1
+ {"version":3,"file":"client-entry.test.js","sourceRoot":"","sources":["../../../../test/react-router/codemods/client-entry.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAyE;AACzE,uCAAyB;AACzB,2CAA6B;AAC7B,kFAAwF;AAExF,WAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC7B,MAAM,IAAI,GAAG;QACX,GAAG,EAAE;YACH,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,OAAO,EAAE,WAAE,CAAC,EAAE,EAAE;SACjB;KACF,CAAC;IACF,OAAO;QACL,OAAO,EAAE,IAAI;QACb,GAAG,IAAI;KACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAA,iBAAQ,EAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;IACrE,IAAI,MAAc,CAAC;IACnB,IAAI,OAAe,CAAC;IAEpB,IAAA,m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Ae,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAEzD,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,SAAS,CAC/B,yDAAyD,CAC1D,CAAC;YACF,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,SAAS,CAC/B,qDAAqD,CACtD,CAAC;YACF,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,SAAS,CAC/B,oDAAoD,CACrD,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,wEAAwE,EAAE,KAAK,IAAI,EAAE;YACtF,MAAM,YAAY,GAAG,EAAE,CAAC,YAAY,CAClC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,EACnC,MAAM,CACP,CAAC;YAEF,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAExC,MAAM,IAAA,oCAAqB,EACzB,OAAO,EACP,UAAU,EACV,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,CACN,CAAC;YAEF,MAAM,eAAe,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAEzD,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;YACvD,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,SAAS,CAC/B,wCAAwC,CACzC,CAAC;YACF,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { instrumentClientEntry } from '../../../src/react-router/codemods/client.entry';\n\nvi.mock('@clack/prompts', () => {\n const mock = {\n log: {\n warn: vi.fn(),\n info: vi.fn(),\n success: vi.fn(),\n },\n };\n return {\n default: mock,\n ...mock,\n };\n});\n\ndescribe('instrumentClientEntry', () => {\n const fixturesDir = path.join(__dirname, 'fixtures', 'client-entry');\n let tmpDir: string;\n let tmpFile: string;\n\n beforeEach(() => {\n vi.clearAllMocks();\n\n // Create unique tmp directory for each test\n tmpDir = path.join(\n fixturesDir,\n 'tmp',\n `test-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n );\n tmpFile = path.join(tmpDir, 'entry.client.tsx');\n\n // Ensure tmp directory exists\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n // Clean up tmp directory\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true });\n }\n });\n\n it('should add Sentry import and initialization with all features enabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(\n tmpFile,\n 'test-dsn',\n true,\n true,\n true,\n false,\n true,\n );\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: [');\n expect(modifiedContent).toContain('Sentry.reactRouterTracingIntegration()');\n expect(modifiedContent).toContain('Sentry.replayIntegration(');\n expect(modifiedContent).toContain('enableLogs: true');\n expect(modifiedContent).toContain('onError={Sentry.sentryOnError}');\n });\n\n it('should add Sentry initialization with only tracing enabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, false, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: [');\n expect(modifiedContent).toContain('Sentry.reactRouterTracingIntegration()');\n expect(modifiedContent).not.toContain('Sentry.replayIntegration()');\n expect(modifiedContent).not.toContain('enableLogs: true');\n });\n\n it('should add Sentry initialization with only replay enabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', false, true, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: [');\n expect(modifiedContent).not.toContain(\n 'Sentry.reactRouterTracingIntegration()',\n );\n expect(modifiedContent).toContain('Sentry.replayIntegration(');\n expect(modifiedContent).not.toContain('enableLogs: true');\n });\n\n it('should add Sentry initialization with only logs enabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', false, false, true);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: [');\n expect(modifiedContent).not.toContain(\n 'Sentry.reactRouterTracingIntegration()',\n );\n expect(modifiedContent).not.toContain('Sentry.replayIntegration()');\n expect(modifiedContent).toContain('enableLogs: true');\n });\n\n it('should add minimal Sentry initialization when all features are disabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', false, false, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: []');\n expect(modifiedContent).not.toContain(\n 'Sentry.reactRouterTracingIntegration()',\n );\n expect(modifiedContent).not.toContain('Sentry.replayIntegration()');\n expect(modifiedContent).not.toContain('enableLogs: true');\n });\n\n it('should not add Sentry.init when Sentry content already exists but still add onError', async () => {\n const withSentryContent = fs.readFileSync(\n path.join(fixturesDir, 'with-sentry.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, withSentryContent);\n\n await instrumentClientEntry(\n tmpFile,\n 'test-dsn',\n true,\n true,\n true,\n false,\n true,\n );\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n // Should not duplicate Sentry.init\n const initCount = (modifiedContent.match(/Sentry\\.init\\(/g) || []).length;\n expect(initCount).toBe(1);\n\n // Should still add onError prop to HydratedRouter\n expect(modifiedContent).toContain('onError={Sentry.sentryOnError}');\n });\n\n it('should insert Sentry initialization after imports', async () => {\n const withImportsContent = fs.readFileSync(\n path.join(fixturesDir, 'with-imports.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, withImportsContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, false, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n\n // Check that the Sentry import is before the init call\n const sentryImportIndex = modifiedContent.indexOf(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n const sentryInitIndex = modifiedContent.indexOf('Sentry.init({');\n expect(sentryImportIndex).toBeLessThan(sentryInitIndex);\n });\n\n it('should handle files with no imports', async () => {\n const noImportsContent = fs.readFileSync(\n path.join(fixturesDir, 'no-imports.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, noImportsContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', false, true, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('Sentry.replayIntegration(');\n });\n\n it('should preserve existing code structure', async () => {\n const complexContent = fs.readFileSync(\n path.join(fixturesDir, 'complex.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, complexContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, true, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n\n // Original content should still be there\n expect(modifiedContent).toContain('startTransition');\n expect(modifiedContent).toContain('hydrateRoot');\n expect(modifiedContent).toContain('<StrictMode>');\n });\n\n describe('Instrumentation API', () => {\n it('should add instrumentation API setup when enabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(\n tmpFile,\n 'test-dsn',\n true,\n false,\n false,\n true,\n );\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'const tracing = Sentry.reactRouterTracingIntegration();',\n );\n expect(modifiedContent).toContain('integrations: [tracing]');\n expect(modifiedContent).toContain(\n 'instrumentations={[tracing.clientInstrumentation]}',\n );\n });\n\n it('should combine instrumentation API with replay', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, true, false, true);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'const tracing = Sentry.reactRouterTracingIntegration();',\n );\n expect(modifiedContent).toContain(\n 'integrations: [tracing, Sentry.replayIntegration()]',\n );\n expect(modifiedContent).toContain(\n 'instrumentations={[tracing.clientInstrumentation]}',\n );\n });\n\n it('should not use instrumentation API when useInstrumentationAPI is false', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(\n tmpFile,\n 'test-dsn',\n true,\n false,\n false,\n false,\n );\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).not.toContain('const tracing');\n expect(modifiedContent).toContain(\n 'Sentry.reactRouterTracingIntegration()',\n );\n expect(modifiedContent).not.toContain('instrumentations');\n });\n });\n});\n"]}
@@ -449,37 +449,50 @@ export function handleError(error: unknown) {
449
449
  fs.rmSync(tmpDir, { recursive: true });
450
450
  }
451
451
  });
452
- (0, vitest_1.it)('should add unstable_instrumentations export when useInstrumentationAPI is true', async () => {
452
+ (0, vitest_1.it)('should add instrumentations export when useInstrumentationAPI is true', async () => {
453
453
  const basicContent = fs.readFileSync(path.join(fixturesDir, 'basic.tsx'), 'utf8');
454
454
  fs.writeFileSync(tmpFile, basicContent);
455
455
  await (0, server_entry_1.instrumentServerEntry)(tmpFile, true);
456
456
  const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
457
457
  (0, vitest_1.expect)(modifiedContent).toContain('import * as Sentry from "@sentry/react-router";');
458
- (0, vitest_1.expect)(modifiedContent).toContain('export const unstable_instrumentations = [Sentry.createSentryServerInstrumentation()];');
458
+ (0, vitest_1.expect)(modifiedContent).toContain('export const instrumentations = [Sentry.createSentryServerInstrumentation()];');
459
459
  });
460
- (0, vitest_1.it)('should not add unstable_instrumentations export when useInstrumentationAPI is false', async () => {
460
+ (0, vitest_1.it)('should not add instrumentations export when useInstrumentationAPI is false', async () => {
461
461
  const basicContent = fs.readFileSync(path.join(fixturesDir, 'basic.tsx'), 'utf8');
462
462
  fs.writeFileSync(tmpFile, basicContent);
463
463
  await (0, server_entry_1.instrumentServerEntry)(tmpFile, false);
464
464
  const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
465
- (0, vitest_1.expect)(modifiedContent).not.toContain('unstable_instrumentations');
465
+ (0, vitest_1.expect)(modifiedContent).not.toContain('instrumentations');
466
466
  (0, vitest_1.expect)(modifiedContent).not.toContain('createSentryServerInstrumentation');
467
467
  });
468
- (0, vitest_1.it)('should not duplicate unstable_instrumentations export if already present', async () => {
468
+ (0, vitest_1.it)('should not duplicate instrumentations export if already present', async () => {
469
469
  const contentWithInstrumentations = `
470
470
  import { ServerRouter } from 'react-router';
471
471
  import * as Sentry from '@sentry/react-router';
472
472
 
473
473
  export default function handleRequest() {}
474
474
  export const handleError = () => {};
475
- export const unstable_instrumentations = [Sentry.createSentryServerInstrumentation()];
475
+ export const instrumentations = [Sentry.createSentryServerInstrumentation()];
476
476
  `;
477
477
  fs.writeFileSync(tmpFile, contentWithInstrumentations);
478
478
  await (0, server_entry_1.instrumentServerEntry)(tmpFile, true);
479
479
  const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
480
- const count = (modifiedContent.match(/unstable_instrumentations/g) || [])
481
- .length;
480
+ const count = (modifiedContent.match(/\binstrumentations\b/g) || []).length;
482
481
  (0, vitest_1.expect)(count).toBe(1);
483
482
  });
483
+ (0, vitest_1.it)('should not duplicate if legacy unstable_instrumentations export is already present', async () => {
484
+ const contentWithLegacy = `
485
+ import { ServerRouter } from 'react-router';
486
+ import * as Sentry from '@sentry/react-router';
487
+
488
+ export default function handleRequest() {}
489
+ export const handleError = () => {};
490
+ export const unstable_instrumentations = [Sentry.createSentryServerInstrumentation()];
491
+ `;
492
+ fs.writeFileSync(tmpFile, contentWithLegacy);
493
+ await (0, server_entry_1.instrumentServerEntry)(tmpFile, true);
494
+ const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
495
+ (0, vitest_1.expect)(modifiedContent).not.toContain('export const instrumentations =');
496
+ });
484
497
  });
485
498
  //# sourceMappingURL=server-entry.test.js.map