@sentry/wizard 6.2.0 → 6.4.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 (101) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/e2e-tests/tests/angular-17.test.js +5 -0
  3. package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
  4. package/dist/e2e-tests/tests/angular-19.test.js +5 -0
  5. package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
  6. package/dist/e2e-tests/tests/expo.test.js +9 -2
  7. package/dist/e2e-tests/tests/expo.test.js.map +1 -1
  8. package/dist/e2e-tests/tests/flutter.test.js +18 -4
  9. package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
  10. package/dist/e2e-tests/tests/nextjs-14.test.js +4 -3
  11. package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
  12. package/dist/e2e-tests/tests/nextjs-15.test.js +17 -4
  13. package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
  14. package/dist/e2e-tests/tests/nuxt-3.test.js +9 -2
  15. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  16. package/dist/e2e-tests/tests/nuxt-4.test.js +9 -2
  17. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  18. package/dist/e2e-tests/tests/react-native.test.js +8 -1
  19. package/dist/e2e-tests/tests/react-native.test.js.map +1 -1
  20. package/dist/e2e-tests/tests/remix.test.js +16 -2
  21. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  22. package/dist/e2e-tests/tests/{sveltekit.test.js → sveltekit-hooks.test.js} +26 -8
  23. package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -0
  24. package/dist/e2e-tests/tests/sveltekit-tracing.test.d.ts +1 -0
  25. package/dist/e2e-tests/tests/sveltekit-tracing.test.js +203 -0
  26. package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -0
  27. package/dist/src/android/android-wizard.js +3 -0
  28. package/dist/src/android/android-wizard.js.map +1 -1
  29. package/dist/src/angular/angular-wizard.js +3 -0
  30. package/dist/src/angular/angular-wizard.js.map +1 -1
  31. package/dist/src/apple/apple-wizard.js +3 -0
  32. package/dist/src/apple/apple-wizard.js.map +1 -1
  33. package/dist/src/flutter/flutter-wizard.js +3 -0
  34. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  35. package/dist/src/nextjs/nextjs-wizard.js +3 -0
  36. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  37. package/dist/src/nuxt/nuxt-wizard.js +3 -0
  38. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  39. package/dist/src/react-native/react-native-wizard.js +3 -0
  40. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  41. package/dist/src/remix/remix-wizard.d.ts +4 -0
  42. package/dist/src/remix/remix-wizard.js +7 -0
  43. package/dist/src/remix/remix-wizard.js.map +1 -1
  44. package/dist/src/sveltekit/sdk-example.d.ts +2 -2
  45. package/dist/src/sveltekit/sdk-example.js.map +1 -1
  46. package/dist/src/sveltekit/sdk-setup/setup.d.ts +3 -0
  47. package/dist/src/sveltekit/{sdk-setup.js → sdk-setup/setup.js} +113 -157
  48. package/dist/src/sveltekit/sdk-setup/setup.js.map +1 -0
  49. package/dist/src/sveltekit/sdk-setup/svelte-config.d.ts +25 -0
  50. package/dist/src/sveltekit/sdk-setup/svelte-config.js +291 -0
  51. package/dist/src/sveltekit/sdk-setup/svelte-config.js.map +1 -0
  52. package/dist/src/sveltekit/sdk-setup/types.d.ts +7 -0
  53. package/dist/src/sveltekit/sdk-setup/types.js +3 -0
  54. package/dist/src/sveltekit/sdk-setup/types.js.map +1 -0
  55. package/dist/src/sveltekit/sdk-setup/utils.d.ts +6 -0
  56. package/dist/src/sveltekit/sdk-setup/utils.js +45 -0
  57. package/dist/src/sveltekit/sdk-setup/utils.js.map +1 -0
  58. package/dist/src/sveltekit/sdk-setup/vite.d.ts +2 -0
  59. package/dist/src/sveltekit/sdk-setup/vite.js +120 -0
  60. package/dist/src/sveltekit/sdk-setup/vite.js.map +1 -0
  61. package/dist/src/sveltekit/sveltekit-wizard.js +48 -5
  62. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  63. package/dist/src/sveltekit/templates.d.ts +4 -0
  64. package/dist/src/sveltekit/templates.js +33 -10
  65. package/dist/src/sveltekit/templates.js.map +1 -1
  66. package/dist/src/sveltekit/utils.d.ts +2 -1
  67. package/dist/src/sveltekit/utils.js +7 -2
  68. package/dist/src/sveltekit/utils.js.map +1 -1
  69. package/dist/src/utils/clack/mcp-config.d.ts +7 -0
  70. package/dist/src/utils/clack/mcp-config.js +427 -0
  71. package/dist/src/utils/clack/mcp-config.js.map +1 -0
  72. package/dist/src/version.d.ts +1 -1
  73. package/dist/src/version.js +1 -1
  74. package/dist/src/version.js.map +1 -1
  75. package/dist/test/angular/angular-wizard.test.js +3 -0
  76. package/dist/test/angular/angular-wizard.test.js.map +1 -1
  77. package/dist/test/apple/templates.test.js +3 -0
  78. package/dist/test/apple/templates.test.js.map +1 -1
  79. package/dist/test/flutter/templates.test.js +3 -0
  80. package/dist/test/flutter/templates.test.js.map +1 -1
  81. package/dist/test/nextjs/wizard-double-wrap-prevention.test.js +3 -0
  82. package/dist/test/nextjs/wizard-double-wrap-prevention.test.js.map +1 -1
  83. package/dist/test/nuxt/templates.test.js +3 -0
  84. package/dist/test/nuxt/templates.test.js.map +1 -1
  85. package/dist/test/react-native/metro.test.js +3 -0
  86. package/dist/test/react-native/metro.test.js.map +1 -1
  87. package/dist/test/remix/root.test.js +3 -0
  88. package/dist/test/remix/root.test.js.map +1 -1
  89. package/dist/test/sveltekit/sdk-setup/svelte-config.test.d.ts +1 -0
  90. package/dist/test/sveltekit/sdk-setup/svelte-config.test.js +529 -0
  91. package/dist/test/sveltekit/sdk-setup/svelte-config.test.js.map +1 -0
  92. package/dist/test/sveltekit/templates.test.js +106 -10
  93. package/dist/test/sveltekit/templates.test.js.map +1 -1
  94. package/dist/test/utils/clack/mcp-config.test.d.ts +1 -0
  95. package/dist/test/utils/clack/mcp-config.test.js +520 -0
  96. package/dist/test/utils/clack/mcp-config.test.js.map +1 -0
  97. package/package.json +1 -1
  98. package/dist/e2e-tests/tests/sveltekit.test.js.map +0 -1
  99. package/dist/src/sveltekit/sdk-setup.d.ts +0 -21
  100. package/dist/src/sveltekit/sdk-setup.js.map +0 -1
  101. /package/dist/e2e-tests/tests/{sveltekit.test.d.ts → sveltekit-hooks.test.d.ts} +0 -0
@@ -2,8 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const vitest_1 = require("vitest");
4
4
  const templates_1 = require("../../src/sveltekit/templates");
5
+ vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({
6
+ offerProjectScopedMcpConfig: vitest_1.vi.fn().mockResolvedValue(undefined),
7
+ }));
5
8
  (0, vitest_1.describe)('getClientHooksTemplate', () => {
6
- (0, vitest_1.it)('should generate client hooks template with all features enabled', () => {
9
+ (0, vitest_1.it)('generates client hooks template with all features enabled', () => {
7
10
  const result = (0, templates_1.getClientHooksTemplate)('https://sentry.io/123', {
8
11
  performance: true,
9
12
  replay: true,
@@ -38,7 +41,7 @@ const templates_1 = require("../../src/sveltekit/templates");
38
41
  "
39
42
  `);
40
43
  });
41
- (0, vitest_1.it)('should generate client hooks template when performance disabled', () => {
44
+ (0, vitest_1.it)('generates client hooks template when performance disabled', () => {
42
45
  const result = (0, templates_1.getClientHooksTemplate)('https://sentry.io/123', {
43
46
  performance: false,
44
47
  replay: true,
@@ -69,7 +72,7 @@ const templates_1 = require("../../src/sveltekit/templates");
69
72
  "
70
73
  `);
71
74
  });
72
- (0, vitest_1.it)('should generate client hooks template when replay disabled', () => {
75
+ (0, vitest_1.it)('generates client hooks template when replay disabled', () => {
73
76
  const result = (0, templates_1.getClientHooksTemplate)('https://sentry.io/123', {
74
77
  performance: true,
75
78
  replay: false,
@@ -93,7 +96,7 @@ const templates_1 = require("../../src/sveltekit/templates");
93
96
  "
94
97
  `);
95
98
  });
96
- (0, vitest_1.it)('should generate client hooks template with only logs enabled', () => {
99
+ (0, vitest_1.it)('generates client hooks template with only logs enabled', () => {
97
100
  const result = (0, templates_1.getClientHooksTemplate)('https://sentry.io/123', {
98
101
  performance: false,
99
102
  replay: false,
@@ -119,12 +122,12 @@ const templates_1 = require("../../src/sveltekit/templates");
119
122
  });
120
123
  });
121
124
  (0, vitest_1.describe)('getServerHooksTemplate', () => {
122
- (0, vitest_1.it)('should generate server hooks template with all features enabled', () => {
125
+ (0, vitest_1.it)('generates server hooks template with all features enabled', () => {
123
126
  const result = (0, templates_1.getServerHooksTemplate)('https://sentry.io/123', {
124
127
  performance: true,
125
128
  replay: true,
126
129
  logs: true,
127
- });
130
+ }, true);
128
131
  (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
129
132
  "import { sequence } from "@sveltejs/kit/hooks";
130
133
  import { handleErrorWithSentry, sentryHandle } from "@sentry/sveltekit";
@@ -150,12 +153,12 @@ const templates_1 = require("../../src/sveltekit/templates");
150
153
  "
151
154
  `);
152
155
  });
153
- (0, vitest_1.it)('should generate server hooks template when performance disabled', () => {
156
+ (0, vitest_1.it)('generates server hooks template when performance disabled', () => {
154
157
  const result = (0, templates_1.getServerHooksTemplate)('https://sentry.io/123', {
155
158
  performance: false,
156
159
  replay: true,
157
160
  logs: false,
158
- });
161
+ }, true);
159
162
  (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
160
163
  "import { sequence } from "@sveltejs/kit/hooks";
161
164
  import { handleErrorWithSentry, sentryHandle } from "@sentry/sveltekit";
@@ -177,12 +180,12 @@ const templates_1 = require("../../src/sveltekit/templates");
177
180
  "
178
181
  `);
179
182
  });
180
- (0, vitest_1.it)('should generate server hooks template with only logs enabled', () => {
183
+ (0, vitest_1.it)('generates server hooks template with only logs enabled', () => {
181
184
  const result = (0, templates_1.getServerHooksTemplate)('https://sentry.io/123', {
182
185
  performance: false,
183
186
  replay: false,
184
187
  logs: true,
185
- });
188
+ }, true);
186
189
  (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
187
190
  "import { sequence } from "@sveltejs/kit/hooks";
188
191
  import { handleErrorWithSentry, sentryHandle } from "@sentry/sveltekit";
@@ -206,5 +209,98 @@ const templates_1 = require("../../src/sveltekit/templates");
206
209
  "
207
210
  `);
208
211
  });
212
+ (0, vitest_1.it)('generates server hooks template without Sentry.init if includeSentryInit is false', () => {
213
+ const result = (0, templates_1.getServerHooksTemplate)('https://sentry.io/123', {
214
+ performance: false,
215
+ replay: false,
216
+ logs: true,
217
+ }, false);
218
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
219
+ "import { sequence } from "@sveltejs/kit/hooks";
220
+ import { handleErrorWithSentry, sentryHandle } from "@sentry/sveltekit";
221
+
222
+
223
+ // If you have custom handlers, make sure to place them after \`sentryHandle()\` in the \`sequence\` function.
224
+ export const handle = sequence(sentryHandle());
225
+
226
+ // If you have a custom error handler, pass it to \`handleErrorWithSentry\`
227
+ export const handleError = handleErrorWithSentry();
228
+ "
229
+ `);
230
+ });
231
+ });
232
+ (0, vitest_1.describe)('getInstrumentationServerTemplate', () => {
233
+ (0, vitest_1.it)('generates instrumentation.server template with all features enabled', () => {
234
+ const result = (0, templates_1.getInstrumentationServerTemplate)('https://sentry.io/123', {
235
+ performance: true,
236
+ logs: true,
237
+ });
238
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
239
+ "import * as Sentry from '@sentry/sveltekit';
240
+
241
+ Sentry.init({
242
+ dsn: 'https://sentry.io/123',
243
+
244
+ tracesSampleRate: 1.0,
245
+
246
+ // Enable logs to be sent to Sentry
247
+ enableLogs: true,
248
+
249
+ // uncomment the line below to enable Spotlight (https://spotlightjs.com)
250
+ // spotlight: import.meta.env.DEV,
251
+ });"`);
252
+ });
253
+ (0, vitest_1.it)('generates instrumentation.server template with only logs enabled', () => {
254
+ const result = (0, templates_1.getInstrumentationServerTemplate)('https://sentry.io/123', {
255
+ performance: false,
256
+ logs: true,
257
+ });
258
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
259
+ "import * as Sentry from '@sentry/sveltekit';
260
+
261
+ Sentry.init({
262
+ dsn: 'https://sentry.io/123',
263
+
264
+ // Enable logs to be sent to Sentry
265
+ enableLogs: true,
266
+
267
+ // uncomment the line below to enable Spotlight (https://spotlightjs.com)
268
+ // spotlight: import.meta.env.DEV,
269
+ });"`);
270
+ });
271
+ (0, vitest_1.it)('generates instrumentation.server template with only tracesSampleRate enabled', () => {
272
+ const result = (0, templates_1.getInstrumentationServerTemplate)('https://sentry.io/123', {
273
+ performance: true,
274
+ logs: false,
275
+ });
276
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
277
+ "import * as Sentry from '@sentry/sveltekit';
278
+
279
+ Sentry.init({
280
+ dsn: 'https://sentry.io/123',
281
+
282
+ tracesSampleRate: 1.0,
283
+
284
+
285
+ // uncomment the line below to enable Spotlight (https://spotlightjs.com)
286
+ // spotlight: import.meta.env.DEV,
287
+ });"`);
288
+ });
289
+ (0, vitest_1.it)('generates instrumentation.server template without any extra features enabled', () => {
290
+ const result = (0, templates_1.getInstrumentationServerTemplate)('https://sentry.io/123', {
291
+ performance: false,
292
+ logs: false,
293
+ });
294
+ (0, vitest_1.expect)(result).toMatchInlineSnapshot(`
295
+ "import * as Sentry from '@sentry/sveltekit';
296
+
297
+ Sentry.init({
298
+ dsn: 'https://sentry.io/123',
299
+
300
+
301
+ // uncomment the line below to enable Spotlight (https://spotlightjs.com)
302
+ // spotlight: import.meta.env.DEV,
303
+ });"`);
304
+ });
209
305
  });
210
306
  //# sourceMappingURL=templates.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/sveltekit/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,6DAGuC;AAEvC,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,WAAE,EAAC,iEAAiE,EAAE,GAAG,EAA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CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,WAAE,EAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;KAuBpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;KAmBpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,8DAA8D,EAAE,GAAG,EAAE;QACtE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;KAqBpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n getClientHooksTemplate,\n getServerHooksTemplate,\n} from '../../src/sveltekit/templates';\n\ndescribe('getClientHooksTemplate', () => {\n it('should generate client hooks template with all features enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\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: [replayIntegration()],\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('should generate client hooks template when performance disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\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: [replayIntegration()],\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('should generate client hooks template when replay disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('should generate client hooks template with only logs enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getServerHooksTemplate', () => {\n it('should generate server hooks template with all features enabled', () => {\n const result = getServerHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('should generate server hooks template when performance disabled', () => {\n const result = getServerHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('should generate server hooks template with only logs enabled', () => {\n const result = getServerHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n"]}
1
+ {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/sveltekit/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAAkD;AAClD,6DAIuC;AAEvC,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,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,WAAE,EAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,MAAM,GAA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KAAK;SACZ,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;WAS9B,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it, vi } from 'vitest';\nimport {\n getClientHooksTemplate,\n getInstrumentationServerTemplate,\n getServerHooksTemplate,\n} from '../../src/sveltekit/templates';\n\nvi.mock('../../src/utils/clack/mcp-config', () => ({\n offerProjectScopedMcpConfig: vi.fn().mockResolvedValue(undefined),\n}));\n\ndescribe('getClientHooksTemplate', () => {\n it('generates client hooks template with all features enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\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: [replayIntegration()],\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template when performance disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\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: [replayIntegration()],\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template when replay disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates client hooks template with only logs enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getServerHooksTemplate', () => {\n it('generates server hooks template with all features enabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: true,\n replay: true,\n logs: true,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template when performance disabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: true,\n logs: false,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template with only logs enabled', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n true,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('generates server hooks template without Sentry.init if includeSentryInit is false', () => {\n const result = getServerHooksTemplate(\n 'https://sentry.io/123',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n false,\n );\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getInstrumentationServerTemplate', () => {\n it('generates instrumentation.server template with all features enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template with only logs enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template with only tracesSampleRate enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n\n it('generates instrumentation.server template without any extra features enabled', () => {\n const result = getInstrumentationServerTemplate('https://sentry.io/123', {\n performance: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"`);\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ export {};