@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.
- package/CHANGELOG.md +15 -0
- package/dist/bin.js +16 -1
- package/dist/bin.js.map +1 -1
- package/dist/e2e-tests/tests/angular-17.test.js +3 -4
- package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
- package/dist/e2e-tests/tests/angular-19.test.js +3 -4
- package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
- package/dist/e2e-tests/tests/flutter.test.js +60 -0
- package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
- package/dist/e2e-tests/tests/help-message.test.js +8 -3
- package/dist/e2e-tests/tests/help-message.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js +12 -6
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +12 -6
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/e2e-tests/tests/pnpm-workspace.test.js +6 -3
- package/dist/e2e-tests/tests/pnpm-workspace.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js +4 -4
- package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-router.test.js +3 -6
- package/dist/e2e-tests/tests/react-router.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +2 -4
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js +24 -8
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js +6 -3
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
- package/dist/lib/Constants.d.ts +1 -0
- package/dist/lib/Constants.js +5 -0
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.js +2 -2
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/src/android/android-wizard.js +3 -0
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/angular/codemods/main.d.ts +1 -1
- package/dist/src/angular/codemods/main.js +0 -1
- package/dist/src/angular/codemods/main.js.map +1 -1
- package/dist/src/apple/apple-wizard.js +2 -3
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/apple/check-installed-cli.d.ts +1 -1
- package/dist/src/apple/check-installed-cli.js +13 -7
- package/dist/src/apple/check-installed-cli.js.map +1 -1
- package/dist/src/apple/configure-xcode-project.js +8 -1
- package/dist/src/apple/configure-xcode-project.js.map +1 -1
- package/dist/src/apple/lookup-xcode-project.d.ts +8 -5
- package/dist/src/apple/lookup-xcode-project.js +22 -17
- package/dist/src/apple/lookup-xcode-project.js.map +1 -1
- package/dist/src/apple/options.d.ts +5 -0
- package/dist/src/apple/options.js.map +1 -1
- package/dist/src/apple/sentry-swift-package.d.ts +4 -0
- package/dist/src/apple/sentry-swift-package.js +17 -0
- package/dist/src/apple/sentry-swift-package.js.map +1 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.d.ts +2 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.js +251 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.js.map +1 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.d.ts +13 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js +48 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js.map +1 -0
- package/dist/src/apple/snapshots/snapshot-test-file.d.ts +18 -0
- package/dist/src/apple/snapshots/snapshot-test-file.js +122 -0
- package/dist/src/apple/snapshots/snapshot-test-file.js.map +1 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.d.ts +6 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.js +147 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.js.map +1 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.d.ts +4 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.js +8 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.js.map +1 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.d.ts +23 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.js +136 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.js.map +1 -0
- package/dist/src/apple/xcode-manager.d.ts +59 -1
- package/dist/src/apple/xcode-manager.js +507 -106
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/flutter/flutter-wizard.js +3 -0
- package/dist/src/flutter/flutter-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.js +12 -6
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/templates.js +12 -6
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/react-router/codemods/client.entry.d.ts +1 -1
- package/dist/src/react-router/codemods/client.entry.js +93 -52
- package/dist/src/react-router/codemods/client.entry.js.map +1 -1
- package/dist/src/react-router/codemods/server-entry.js +8 -7
- package/dist/src/react-router/codemods/server-entry.js.map +1 -1
- package/dist/src/react-router/react-router-wizard.js +13 -19
- package/dist/src/react-router/react-router-wizard.js.map +1 -1
- package/dist/src/react-router/sdk-setup.d.ts +2 -2
- package/dist/src/react-router/sdk-setup.js +16 -15
- package/dist/src/react-router/sdk-setup.js.map +1 -1
- package/dist/src/react-router/templates.d.ts +1 -3
- package/dist/src/react-router/templates.js +24 -92
- package/dist/src/react-router/templates.js.map +1 -1
- package/dist/src/remix/sdk-setup.js +1 -2
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/run.d.ts +4 -1
- package/dist/src/run.js +13 -0
- package/dist/src/run.js.map +1 -1
- package/dist/src/sourcemaps/tools/remix.js +4 -4
- package/dist/src/sourcemaps/tools/remix.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup/setup.js +17 -4
- package/dist/src/sveltekit/sdk-setup/setup.js.map +1 -1
- package/dist/src/sveltekit/templates.js +12 -6
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/utils/clack/index.d.ts +2 -1
- package/dist/src/utils/clack/index.js +17 -6
- package/dist/src/utils/clack/index.js.map +1 -1
- package/dist/src/utils/files.d.ts +2 -0
- package/dist/src/utils/files.js +58 -0
- package/dist/src/utils/files.js.map +1 -0
- package/dist/src/utils/git.d.ts +3 -1
- package/dist/src/utils/git.js +2 -1
- package/dist/src/utils/git.js.map +1 -1
- package/dist/src/utils/line-endings.d.ts +1 -0
- package/dist/src/utils/line-endings.js +76 -0
- package/dist/src/utils/line-endings.js.map +1 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/test/angular/angular-wizard.test.js +0 -5
- package/dist/test/angular/angular-wizard.test.js.map +1 -1
- package/dist/test/apple/lookup-xcode-project.test.js +167 -0
- package/dist/test/apple/lookup-xcode-project.test.js.map +1 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.d.ts +1 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js +487 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js.map +1 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.d.ts +24 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.js +191 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.js.map +1 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.js +110 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js +146 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js +186 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js +192 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js.map +1 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.d.ts +1 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.js +77 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.js.map +1 -0
- package/dist/test/apple/xcode-manager.test.js +452 -43
- package/dist/test/apple/xcode-manager.test.js.map +1 -1
- package/dist/test/constants.test.d.ts +1 -0
- package/dist/test/constants.test.js +12 -0
- package/dist/test/constants.test.js.map +1 -0
- package/dist/test/nextjs/templates.test.js +66 -33
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/nuxt/templates.test.js +66 -36
- package/dist/test/nuxt/templates.test.js.map +1 -1
- package/dist/test/react-router/codemods/client-entry.test.js +15 -11
- package/dist/test/react-router/codemods/client-entry.test.js.map +1 -1
- package/dist/test/react-router/codemods/server-entry.test.js +21 -8
- package/dist/test/react-router/codemods/server-entry.test.js.map +1 -1
- package/dist/test/react-router/sdk-setup.test.js +46 -10
- package/dist/test/react-router/sdk-setup.test.js.map +1 -1
- package/dist/test/react-router/templates.test.js +26 -64
- package/dist/test/react-router/templates.test.js.map +1 -1
- package/dist/test/remix/build-script.test.d.ts +1 -0
- package/dist/test/remix/build-script.test.js +124 -0
- package/dist/test/remix/build-script.test.js.map +1 -0
- package/dist/test/remix/client-entry.test.js +4 -10
- package/dist/test/remix/client-entry.test.js.map +1 -1
- package/dist/test/run.test.d.ts +1 -0
- package/dist/test/run.test.js +137 -0
- package/dist/test/run.test.js.map +1 -0
- package/dist/test/sveltekit/templates.test.js +78 -27
- package/dist/test/sveltekit/templates.test.js.map +1 -1
- package/dist/test/utils/clack/index.test.js +101 -0
- package/dist/test/utils/clack/index.test.js.map +1 -1
- package/dist/test/utils/git.test.js +10 -0
- package/dist/test/utils/git.test.js.map +1 -1
- package/dist/test/utils/line-endings.test.d.ts +1 -0
- package/dist/test/utils/line-endings.test.js +103 -0
- package/dist/test/utils/line-endings.test.js.map +1 -0
- package/package.json +2 -2
- package/dist/src/react-router/codemods/root.d.ts +0 -1
- package/dist/src/react-router/codemods/root.js +0 -170
- package/dist/src/react-router/codemods/root.js.map +0 -1
- package/dist/test/react-router/codemods/root.test.js +0 -182
- package/dist/test/react-router/codemods/root.test.js.map +0 -1
- /package/dist/test/{react-router/codemods/root.test.d.ts → apple/lookup-xcode-project.test.d.ts} +0 -0
|
@@ -236,6 +236,15 @@ Skipping adding Sentry functionality to it.`);
|
|
|
236
236
|
prompts_1.default.log.success(`Added Sentry.init code to ${chalk_1.default.cyan(filename)}`);
|
|
237
237
|
Sentry.setTag(`modified-instrumentation-server`, 'success');
|
|
238
238
|
}
|
|
239
|
+
const DATA_COLLECTION_HINT = [
|
|
240
|
+
'',
|
|
241
|
+
' dataCollection: {',
|
|
242
|
+
' // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:',
|
|
243
|
+
' // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection',
|
|
244
|
+
' // userInfo: false,',
|
|
245
|
+
' // httpBodies: [],',
|
|
246
|
+
' },',
|
|
247
|
+
].join('\n');
|
|
239
248
|
function insertClientInitCall(dsn,
|
|
240
249
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
241
250
|
originalHooksMod, selectedFeatures) {
|
|
@@ -256,14 +265,16 @@ originalHooksMod, selectedFeatures) {
|
|
|
256
265
|
if (selectedFeatures.logs) {
|
|
257
266
|
initArgs.enableLogs = true;
|
|
258
267
|
}
|
|
259
|
-
initArgs.sendDefaultPii = true;
|
|
260
268
|
// This assignment of any values is fine because we're just creating a function call in magicast
|
|
261
269
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
262
270
|
const initCall = magicast_1.builders.functionCall('Sentry.init', initArgs);
|
|
271
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
272
|
+
const generatedInitCode = (0, magicast_1.generateCode)(initCall).code;
|
|
273
|
+
const initCodeWithHint = generatedInitCode.replace(/\n\}\)$/, `,${DATA_COLLECTION_HINT}\n})`);
|
|
263
274
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
264
275
|
const initCallWithComment = magicast_1.builders.raw(
|
|
265
276
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
266
|
-
`${initCallComment}\n${
|
|
277
|
+
`${initCallComment}\n${initCodeWithHint}`);
|
|
267
278
|
const originalHooksModAST = originalHooksMod.$ast;
|
|
268
279
|
const initCallInsertionIndex = getInitCallInsertionIndex(originalHooksModAST);
|
|
269
280
|
originalHooksModAST.body.splice(initCallInsertionIndex, 0,
|
|
@@ -284,16 +295,18 @@ originalMod, selectedFeatures) {
|
|
|
284
295
|
if (selectedFeatures.logs) {
|
|
285
296
|
initArgs.enableLogs = true;
|
|
286
297
|
}
|
|
287
|
-
initArgs.sendDefaultPii = true;
|
|
288
298
|
// This assignment of any values is fine because we're just creating a function call in magicast
|
|
289
299
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
290
300
|
const initCall = magicast_1.builders.functionCall('Sentry.init', initArgs);
|
|
301
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
302
|
+
const generatedInitCode = (0, magicast_1.generateCode)(initCall).code;
|
|
303
|
+
const initCodeWithHint = generatedInitCode.replace(/\n\}\)$/, `,${DATA_COLLECTION_HINT}\n})`);
|
|
291
304
|
const originalModAST = originalMod.$ast;
|
|
292
305
|
const initCallInsertionIndex = getInitCallInsertionIndex(originalModAST);
|
|
293
306
|
originalModAST.body.splice(initCallInsertionIndex, 0,
|
|
294
307
|
// @ts-expect-error - string works here because the AST is proxified by magicast
|
|
295
308
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
296
|
-
|
|
309
|
+
initCodeWithHint);
|
|
297
310
|
}
|
|
298
311
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
299
312
|
function wrapHandleError(mod) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../../src/sveltekit/sdk-setup/setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAAyB;AACzB,2CAA6B;AAC7B,kDAA0B;AAE1B,qDAAuC;AAEvC,8EAA8E;AAC9E,6DAAmC;AAGnC,kFAAkF;AAClF,uCAA4D;AAC5D,4CAIsB;AACtB,6CAI2B;AAC3B,qDAAmE;AAKnE,mDAGyB;AAEzB,iCAA0C;AAC1C,mCAA8C;AAC9C,6CAA0C;AAEnC,KAAK,UAAU,2BAA2B,CAC/C,WAAwB,EACxB,YAA4D,EAC5D,wBAAiC;IAEjC,MAAM,gBAAgB,GAAG,MAAM,IAAA,8BAAsB,EAAC;QACpD;YACE,EAAE,EAAE,aAAa;YACjB,MAAM,EAAE,yBAAyB,eAAK,CAAC,IAAI,CACzC,SAAS,CACV,gDAAgD;YACjD,WAAW,EAAE,aAAa;SAC3B;QACD;YACE,EAAE,EAAE,QAAQ;YACZ,MAAM,EAAE,yBAAyB,eAAK,CAAC,IAAI,CACzC,gBAAgB,CACjB,oEAAoE;YACrE,WAAW,EAAE,wCAAwC;SACtD;QACD;YACE,EAAE,EAAE,MAAM;YACV,MAAM,EAAE,yBAAyB,eAAK,CAAC,IAAI,CACzC,MAAM,CACP,2CAA2C;YAC5C,WAAW,EAAE,aAAa;SAC3B;KACO,CAAC,CAAC;IAEZ,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAE9E,uEAAuE;IACvE,MAAM,uBAAuB,GAAG,IAAA,oBAAQ,EAAC,eAAe,CAAC,CAAC;IAC1D,MAAM,uBAAuB,GAAG,IAA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H,SAAS,yBAAyB,CAAC,cAAuB;IACxD,6DAA6D;IAC7D,MAAM,eAAe,GAAG,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,qBAAqB,GAAG,eAAe;SAC1C,OAAO,EAAE;SACT,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,mBAAmB,CAAC,CAAC;IAErD,MAAM,sBAAsB,GAAG,qBAAqB;QAClD,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,GAAG,CAAC;QACxD,CAAC,CAAC,CAAC,CAAC;IACN,OAAO,sBAAsB,CAAC;AAChC,CAAC","sourcesContent":["import type { ExportNamedDeclaration, Program } from '@babel/types';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport chalk from 'chalk';\n\nimport * as Sentry from '@sentry/node';\n\n//@ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport type { ProxifiedModule } from 'magicast';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { builders, generateCode, loadFile } from 'magicast';\nimport {\n getClientHooksTemplate,\n getInstrumentationServerTemplate,\n getServerHooksTemplate,\n} from '../templates';\nimport {\n featureSelectionPrompt,\n isUsingTypeScript,\n showCopyPasteInstructions,\n} from '../../utils/clack';\nimport { findFile, hasSentryContent } from '../../utils/ast-utils';\n\nimport * as recast from 'recast';\nimport x = recast.types;\nimport t = x.namedTypes;\nimport {\n enableTracingAndInstrumentation,\n type PartialBackwardsForwardsCompatibleSvelteConfig,\n} from './svelte-config';\nimport { ProjectInfo } from './types';\nimport { modifyViteConfig } from './vite';\nimport { modifyAndRecordFail } from './utils';\nimport { debug } from '../../utils/debug';\n\nexport async function createOrMergeSvelteKitFiles(\n projectInfo: ProjectInfo,\n svelteConfig: PartialBackwardsForwardsCompatibleSvelteConfig,\n setupForSvelteKitTracing: boolean,\n): Promise<void> {\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n {\n id: 'replay',\n prompt: `Do you want to enable ${chalk.bold(\n 'Session Replay',\n )} to get a video-like reproduction of errors during a user session?`,\n enabledHint: 'recommended, but increases bundle size',\n },\n {\n id: 'logs',\n prompt: `Do you want to enable ${chalk.bold(\n 'Logs',\n )} to send your application logs to Sentry?`,\n enabledHint: 'recommended',\n },\n ] as const);\n\n const { clientHooksPath, serverHooksPath } = getHooksConfigDirs(svelteConfig);\n\n // full file paths with correct file ending (or undefined if not found)\n const originalClientHooksFile = findFile(clientHooksPath);\n const originalServerHooksFile = findFile(serverHooksPath);\n const originalInstrumentationServerFile = findFile(\n path.resolve(process.cwd(), 'src', 'instrumentation.server'),\n );\n\n const viteConfig = findFile(path.resolve(process.cwd(), 'vite.config'));\n\n const fileEnding = isUsingTypeScript() ? 'ts' : 'js';\n\n const { dsn } = projectInfo;\n\n if (setupForSvelteKitTracing) {\n await enableTracingAndInstrumentation(\n svelteConfig,\n selectedFeatures.performance,\n );\n\n try {\n if (!originalInstrumentationServerFile) {\n await createNewInstrumentationServerFile(dsn, selectedFeatures);\n } else {\n await mergeInstrumentationServerFile(\n originalInstrumentationServerFile,\n dsn,\n selectedFeatures,\n );\n }\n } catch (e) {\n clack.log.warn(\n `Failed to automatically set up ${chalk.cyan(\n `instrumentation.server.${\n fileEnding ?? isUsingTypeScript() ? 'ts' : 'js'\n }`,\n )}.`,\n );\n debug(e);\n\n await showCopyPasteInstructions({\n codeSnippet: getInstrumentationServerTemplate(dsn, selectedFeatures),\n filename: `instrumentation.server.${\n fileEnding ?? isUsingTypeScript() ? 'ts' : 'js'\n }`,\n });\n\n Sentry.setTag('created-instrumentation-server', 'fail');\n }\n }\n\n Sentry.setTag(\n 'server-hooks-file-strategy',\n originalServerHooksFile ? 'merge' : 'create',\n );\n\n if (!originalServerHooksFile) {\n await createNewHooksFile(\n `${serverHooksPath}.${fileEnding}`,\n 'server',\n dsn,\n selectedFeatures,\n !setupForSvelteKitTracing,\n );\n } else {\n await mergeHooksFile(\n originalServerHooksFile,\n 'server',\n dsn,\n selectedFeatures,\n !setupForSvelteKitTracing,\n );\n }\n\n Sentry.setTag(\n 'client-hooks-file-strategy',\n originalClientHooksFile ? 'merge' : 'create',\n );\n if (!originalClientHooksFile) {\n await createNewHooksFile(\n `${clientHooksPath}.${fileEnding}`,\n 'client',\n dsn,\n selectedFeatures,\n true,\n );\n } else {\n await mergeHooksFile(\n originalClientHooksFile,\n 'client',\n dsn,\n selectedFeatures,\n true,\n );\n }\n\n if (viteConfig) {\n await modifyViteConfig(viteConfig, projectInfo);\n }\n}\n\n/**\n * Attempts to read the svelte.config.js file to find the location of the hooks files.\n * If users specified a custom location, we'll use that. Otherwise, we'll use the default.\n */\nfunction getHooksConfigDirs(\n svelteConfig: PartialBackwardsForwardsCompatibleSvelteConfig,\n): {\n clientHooksPath: string;\n serverHooksPath: string;\n} {\n const relativeUserClientHooksPath = svelteConfig?.kit?.files?.hooks?.client;\n const relativeUserServerHooksPath = svelteConfig?.kit?.files?.hooks?.server;\n const userClientHooksPath =\n relativeUserClientHooksPath &&\n path.resolve(process.cwd(), relativeUserClientHooksPath);\n const userServerHooksPath =\n relativeUserServerHooksPath &&\n path.resolve(process.cwd(), relativeUserServerHooksPath);\n\n const defaulHooksDir = path.resolve(process.cwd(), 'src');\n const defaultClientHooksPath = path.resolve(defaulHooksDir, 'hooks.client'); // file ending missing on purpose\n const defaultServerHooksPath = path.resolve(defaulHooksDir, 'hooks.server'); // same here\n\n return {\n clientHooksPath: userClientHooksPath || defaultClientHooksPath,\n serverHooksPath: userServerHooksPath || defaultServerHooksPath,\n };\n}\n\n/**\n * Reads the template, replaces the dsn placeholder with the actual dsn and writes the file to @param hooksFileDest\n */\nasync function createNewHooksFile(\n hooksFileDest: string,\n hooktype: 'client' | 'server',\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n setupForSvelteKitTracing: boolean,\n): Promise<void> {\n const filledTemplate =\n hooktype === 'client'\n ? getClientHooksTemplate(dsn, selectedFeatures)\n : getServerHooksTemplate(dsn, selectedFeatures, setupForSvelteKitTracing);\n\n await fs.promises.mkdir(path.dirname(hooksFileDest), { recursive: true });\n await fs.promises.writeFile(hooksFileDest, filledTemplate);\n\n clack.log.success(`Created ${hooksFileDest}`);\n Sentry.setTag(`created-${hooktype}-hooks`, 'success');\n}\n\nasync function createNewInstrumentationServerFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n logs: boolean;\n },\n): Promise<void> {\n const filledTemplate = getInstrumentationServerTemplate(\n dsn,\n selectedFeatures,\n );\n\n const fileEnding = isUsingTypeScript() ? 'ts' : 'js';\n\n const instrumentationServerFile = path.resolve(\n process.cwd(),\n 'src',\n `instrumentation.server.${fileEnding}`,\n );\n\n await fs.promises.mkdir(path.dirname(instrumentationServerFile), {\n recursive: true,\n });\n\n await fs.promises.writeFile(instrumentationServerFile, filledTemplate);\n\n clack.log.success(\n `Created ${chalk.cyan(path.basename(instrumentationServerFile))}`,\n );\n Sentry.setTag('created-instrumentation-server', 'success');\n}\n\n/**\n * Merges the users' hooks file with Sentry-related code.\n *\n * Both hooks:\n * - add import * as Sentry\n * - add Sentry.init\n * - add handleError hook wrapper\n *\n * Additionally in Server hook:\n * - add handle hook handler\n */\nasync function mergeHooksFile(\n hooksFile: string,\n hookType: 'client' | 'server',\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n includeSentryInit: boolean,\n): Promise<void> {\n const originalHooksMod = await loadFile(hooksFile);\n\n const file: 'server-hooks' | 'client-hooks' = `${hookType}-hooks`;\n\n if (hasSentryContent(originalHooksMod.$ast as t.Program)) {\n // We don't want to mess with files that already have Sentry content.\n // Let's just bail out at this point.\n clack.log.warn(\n `File ${chalk.cyan(\n path.basename(hooksFile),\n )} already contains Sentry code.\nSkipping adding Sentry functionality to.`,\n );\n Sentry.setTag(`modified-${file}`, 'fail');\n Sentry.setTag(`${file}-fail-reason`, 'has-sentry-content');\n return;\n }\n\n await modifyAndRecordFail(\n () =>\n originalHooksMod.imports.$add({\n from: '@sentry/sveltekit',\n imported: '*',\n local: 'Sentry',\n }),\n 'import-injection',\n file,\n );\n\n if (hookType === 'client' || includeSentryInit) {\n await modifyAndRecordFail(\n () => {\n if (hookType === 'client') {\n insertClientInitCall(dsn, originalHooksMod, selectedFeatures);\n } else {\n insertServerInitCall(dsn, originalHooksMod, selectedFeatures);\n }\n },\n 'init-call-injection',\n file,\n );\n }\n\n await modifyAndRecordFail(\n () => wrapHandleError(originalHooksMod),\n 'wrap-handle-error',\n file,\n );\n\n if (hookType === 'server') {\n await modifyAndRecordFail(\n () => wrapHandle(originalHooksMod),\n 'wrap-handle',\n 'server-hooks',\n );\n }\n\n await modifyAndRecordFail(\n async () => {\n const modifiedCode = originalHooksMod.generate().code;\n await fs.promises.writeFile(hooksFile, modifiedCode);\n },\n 'write-file',\n file,\n );\n\n clack.log.success(`Added Sentry code to ${hooksFile}`);\n Sentry.setTag(`modified-${hookType}-hooks`, 'success');\n}\n\n/**\n * Merges the users' instrumentation.server file with Sentry-related code.\n *\n * Both hooks:\n * - add import * as Sentry\n * - add Sentry.init\n * - add handleError hook wrapper\n *\n * Additionally in Server hook:\n * - add handle hook handler\n */\nasync function mergeInstrumentationServerFile(\n instrumentationServerFilePath: string,\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): Promise<void> {\n const originalInstrumentationServerMod = await loadFile(\n instrumentationServerFilePath,\n );\n const filename = path.basename(instrumentationServerFilePath);\n\n if (hasSentryContent(originalInstrumentationServerMod.$ast as t.Program)) {\n // We don't want to mess with files that already have Sentry content.\n // Let's just bail out at this point.\n clack.log.warn(\n `File ${chalk.cyan(filename)} already contains Sentry code.\nSkipping adding Sentry functionality to it.`,\n );\n Sentry.setTag(`modified-instrumentation-server`, 'fail');\n Sentry.setTag(`instrumentation-server-fail-reason`, 'has-sentry-content');\n return;\n }\n\n await modifyAndRecordFail(\n () =>\n originalInstrumentationServerMod.imports.$add({\n from: '@sentry/sveltekit',\n imported: '*',\n local: 'Sentry',\n }),\n 'import-injection',\n 'instrumentation-server',\n );\n\n await modifyAndRecordFail(\n () => {\n insertServerInitCall(\n dsn,\n originalInstrumentationServerMod,\n selectedFeatures,\n );\n },\n 'init-call-injection',\n 'instrumentation-server',\n );\n\n await modifyAndRecordFail(\n async () => {\n const modifiedCode = originalInstrumentationServerMod.generate().code;\n await fs.promises.writeFile(instrumentationServerFilePath, modifiedCode);\n },\n 'write-file',\n 'instrumentation-server',\n );\n\n clack.log.success(`Added Sentry.init code to ${chalk.cyan(filename)}`);\n Sentry.setTag(`modified-instrumentation-server`, 'success');\n}\n\nexport function insertClientInitCall(\n dsn: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalHooksMod: ProxifiedModule<any>,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): void {\n const initCallComment = `\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.`;\n\n const initArgs: {\n dsn: string;\n tracesSampleRate?: number;\n replaysSessionSampleRate?: number;\n replaysOnErrorSampleRate?: number;\n integrations?: string[];\n enableLogs?: boolean;\n sendDefaultPii?: boolean;\n } = {\n dsn,\n };\n\n if (selectedFeatures.performance) {\n initArgs.tracesSampleRate = 1.0;\n }\n\n if (selectedFeatures.replay) {\n initArgs.replaysSessionSampleRate = 0.1;\n initArgs.replaysOnErrorSampleRate = 1.0;\n initArgs.integrations = [builders.functionCall('Sentry.replayIntegration')];\n }\n\n if (selectedFeatures.logs) {\n initArgs.enableLogs = true;\n }\n\n initArgs.sendDefaultPii = true;\n\n // This assignment of any values is fine because we're just creating a function call in magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const initCall = builders.functionCall('Sentry.init', initArgs);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const initCallWithComment = builders.raw(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n `${initCallComment}\\n${generateCode(initCall).code}`,\n );\n\n const originalHooksModAST = originalHooksMod.$ast as Program;\n\n const initCallInsertionIndex = getInitCallInsertionIndex(originalHooksModAST);\n\n originalHooksModAST.body.splice(\n initCallInsertionIndex,\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n generateCode(initCallWithComment).code,\n );\n}\n\nfunction insertServerInitCall(\n dsn: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalMod: ProxifiedModule<any>,\n selectedFeatures: {\n performance: boolean;\n logs: boolean;\n },\n): void {\n const initArgs: {\n dsn: string;\n tracesSampleRate?: number;\n enableLogs?: boolean;\n sendDefaultPii?: boolean;\n } = {\n dsn,\n };\n\n if (selectedFeatures.performance) {\n initArgs.tracesSampleRate = 1.0;\n }\n\n if (selectedFeatures.logs) {\n initArgs.enableLogs = true;\n }\n\n initArgs.sendDefaultPii = true;\n\n // This assignment of any values is fine because we're just creating a function call in magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const initCall = builders.functionCall('Sentry.init', initArgs);\n\n const originalModAST = originalMod.$ast as Program;\n\n const initCallInsertionIndex = getInitCallInsertionIndex(originalModAST);\n\n originalModAST.body.splice(\n initCallInsertionIndex,\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n generateCode(initCall).code,\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction wrapHandleError(mod: ProxifiedModule<any>): void {\n const modAst = mod.exports.$ast as Program;\n const namedExports = modAst.body.filter(\n (node) => node.type === 'ExportNamedDeclaration',\n ) as ExportNamedDeclaration[];\n\n let foundHandleError = false;\n\n namedExports.forEach((modExport) => {\n const declaration = modExport.declaration;\n if (!declaration) {\n return;\n }\n if (declaration.type === 'FunctionDeclaration') {\n if (!declaration.id || declaration.id.name !== 'handleError') {\n return;\n }\n foundHandleError = true;\n const userCode = generateCode(declaration).code;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n mod.exports.handleError = builders.raw(\n `Sentry.handleErrorWithSentry(${userCode.replace(\n 'handleError',\n '_handleError',\n )})`,\n );\n // because magicast doesn't overwrite the original function export, we need to remove it manually\n modAst.body = modAst.body.filter((node) => node !== modExport);\n } else if (declaration.type === 'VariableDeclaration') {\n const declarations = declaration.declarations;\n declarations.forEach((declaration) => {\n // @ts-expect-error - id should always have a name in this case\n if (!declaration.id || declaration.id.name !== 'handleError') {\n return;\n }\n foundHandleError = true;\n const userCode = declaration.init;\n const stringifiedUserCode = userCode ? generateCode(userCode).code : '';\n // @ts-expect-error - we can just place a string here, magicast will convert it to a node\n declaration.init = `Sentry.handleErrorWithSentry(${stringifiedUserCode})`;\n });\n }\n });\n\n if (!foundHandleError) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n mod.exports.handleError = builders.functionCall(\n 'Sentry.handleErrorWithSentry',\n );\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction wrapHandle(mod: ProxifiedModule<any>): void {\n const modAst = mod.exports.$ast as Program;\n const namedExports = modAst.body.filter(\n (node) => node.type === 'ExportNamedDeclaration',\n ) as ExportNamedDeclaration[];\n\n let foundHandle = false;\n\n namedExports.forEach((modExport) => {\n const declaration = modExport.declaration;\n if (!declaration) {\n return;\n }\n if (declaration.type === 'FunctionDeclaration') {\n if (!declaration.id || declaration.id.name !== 'handle') {\n return;\n }\n foundHandle = true;\n const userCode = generateCode(declaration).code;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n mod.exports.handle = builders.raw(\n `sequence(Sentry.sentryHandle(), ${userCode.replace(\n 'handle',\n '_handle',\n )})`,\n );\n // because of an issue with magicast, we need to remove the original export\n modAst.body = modAst.body.filter((node) => node !== modExport);\n } else if (declaration.type === 'VariableDeclaration') {\n const declarations = declaration.declarations;\n declarations.forEach((declaration) => {\n if (\n !declaration.id ||\n declaration.id.type !== 'Identifier' ||\n (declaration.id.name && declaration.id.name !== 'handle')\n ) {\n return;\n }\n const userCode = declaration.init;\n const stringifiedUserCode = userCode ? generateCode(userCode).code : '';\n // @ts-expect-error - we can just place a string here, magicast will convert it to a node\n declaration.init = `sequence(Sentry.sentryHandle(), ${stringifiedUserCode})`;\n foundHandle = true;\n });\n }\n });\n\n if (!foundHandle) {\n // can't use builders.functionCall here because it doesn't yet\n // support member expressions (Sentry.sentryHandle()) in args\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n mod.exports.handle = builders.raw('sequence(Sentry.sentryHandle())');\n }\n\n try {\n mod.imports.$add({\n from: '@sveltejs/kit/hooks',\n imported: 'sequence',\n local: 'sequence',\n });\n } catch (_) {\n // It's possible sequence is already imported. in this case, magicast throws but that's fine.\n }\n}\n\n/**\n * We want to insert the init call on top of the file but after all import statements\n */\nfunction getInitCallInsertionIndex(originalModAST: Program): number {\n // We need to deep-copy here because reverse mutates in place\n const copiedBodyNodes = [...originalModAST.body];\n const lastImportDeclaration = copiedBodyNodes\n .reverse()\n .find((node) => node.type === 'ImportDeclaration');\n\n const initCallInsertionIndex = lastImportDeclaration\n ? originalModAST.body.indexOf(lastImportDeclaration) + 1\n : 0;\n return initCallInsertionIndex;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../../src/sveltekit/sdk-setup/setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAAyB;AACzB,2CAA6B;AAC7B,kDAA0B;AAE1B,qDAAuC;AAEvC,8EAA8E;AAC9E,6DAAmC;AAGnC,kFAAkF;AAClF,uCAA4D;AAC5D,4CAIsB;AACtB,6CAI2B;AA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;IAC7D,MAAM,eAAe,GAAG,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,qBAAqB,GAAG,eAAe;SAC1C,OAAO,EAAE;SACT,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,mBAAmB,CAAC,CAAC;IAErD,MAAM,sBAAsB,GAAG,qBAAqB;QAClD,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,GAAG,CAAC;QACxD,CAAC,CAAC,CAAC,CAAC;IACN,OAAO,sBAAsB,CAAC;AAChC,CAAC","sourcesContent":["import type { ExportNamedDeclaration, Program } from '@babel/types';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport chalk from 'chalk';\n\nimport * as Sentry from '@sentry/node';\n\n//@ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport type { ProxifiedModule } from 'magicast';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { builders, generateCode, loadFile } from 'magicast';\nimport {\n getClientHooksTemplate,\n getInstrumentationServerTemplate,\n getServerHooksTemplate,\n} from '../templates';\nimport {\n featureSelectionPrompt,\n isUsingTypeScript,\n showCopyPasteInstructions,\n} from '../../utils/clack';\nimport { findFile, hasSentryContent } from '../../utils/ast-utils';\n\nimport * as recast from 'recast';\nimport x = recast.types;\nimport t = x.namedTypes;\nimport {\n enableTracingAndInstrumentation,\n type PartialBackwardsForwardsCompatibleSvelteConfig,\n} from './svelte-config';\nimport { ProjectInfo } from './types';\nimport { modifyViteConfig } from './vite';\nimport { modifyAndRecordFail } from './utils';\nimport { debug } from '../../utils/debug';\n\nexport async function createOrMergeSvelteKitFiles(\n projectInfo: ProjectInfo,\n svelteConfig: PartialBackwardsForwardsCompatibleSvelteConfig,\n setupForSvelteKitTracing: boolean,\n): Promise<void> {\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n {\n id: 'replay',\n prompt: `Do you want to enable ${chalk.bold(\n 'Session Replay',\n )} to get a video-like reproduction of errors during a user session?`,\n enabledHint: 'recommended, but increases bundle size',\n },\n {\n id: 'logs',\n prompt: `Do you want to enable ${chalk.bold(\n 'Logs',\n )} to send your application logs to Sentry?`,\n enabledHint: 'recommended',\n },\n ] as const);\n\n const { clientHooksPath, serverHooksPath } = getHooksConfigDirs(svelteConfig);\n\n // full file paths with correct file ending (or undefined if not found)\n const originalClientHooksFile = findFile(clientHooksPath);\n const originalServerHooksFile = findFile(serverHooksPath);\n const originalInstrumentationServerFile = findFile(\n path.resolve(process.cwd(), 'src', 'instrumentation.server'),\n );\n\n const viteConfig = findFile(path.resolve(process.cwd(), 'vite.config'));\n\n const fileEnding = isUsingTypeScript() ? 'ts' : 'js';\n\n const { dsn } = projectInfo;\n\n if (setupForSvelteKitTracing) {\n await enableTracingAndInstrumentation(\n svelteConfig,\n selectedFeatures.performance,\n );\n\n try {\n if (!originalInstrumentationServerFile) {\n await createNewInstrumentationServerFile(dsn, selectedFeatures);\n } else {\n await mergeInstrumentationServerFile(\n originalInstrumentationServerFile,\n dsn,\n selectedFeatures,\n );\n }\n } catch (e) {\n clack.log.warn(\n `Failed to automatically set up ${chalk.cyan(\n `instrumentation.server.${\n fileEnding ?? isUsingTypeScript() ? 'ts' : 'js'\n }`,\n )}.`,\n );\n debug(e);\n\n await showCopyPasteInstructions({\n codeSnippet: getInstrumentationServerTemplate(dsn, selectedFeatures),\n filename: `instrumentation.server.${\n fileEnding ?? isUsingTypeScript() ? 'ts' : 'js'\n }`,\n });\n\n Sentry.setTag('created-instrumentation-server', 'fail');\n }\n }\n\n Sentry.setTag(\n 'server-hooks-file-strategy',\n originalServerHooksFile ? 'merge' : 'create',\n );\n\n if (!originalServerHooksFile) {\n await createNewHooksFile(\n `${serverHooksPath}.${fileEnding}`,\n 'server',\n dsn,\n selectedFeatures,\n !setupForSvelteKitTracing,\n );\n } else {\n await mergeHooksFile(\n originalServerHooksFile,\n 'server',\n dsn,\n selectedFeatures,\n !setupForSvelteKitTracing,\n );\n }\n\n Sentry.setTag(\n 'client-hooks-file-strategy',\n originalClientHooksFile ? 'merge' : 'create',\n );\n if (!originalClientHooksFile) {\n await createNewHooksFile(\n `${clientHooksPath}.${fileEnding}`,\n 'client',\n dsn,\n selectedFeatures,\n true,\n );\n } else {\n await mergeHooksFile(\n originalClientHooksFile,\n 'client',\n dsn,\n selectedFeatures,\n true,\n );\n }\n\n if (viteConfig) {\n await modifyViteConfig(viteConfig, projectInfo);\n }\n}\n\n/**\n * Attempts to read the svelte.config.js file to find the location of the hooks files.\n * If users specified a custom location, we'll use that. Otherwise, we'll use the default.\n */\nfunction getHooksConfigDirs(\n svelteConfig: PartialBackwardsForwardsCompatibleSvelteConfig,\n): {\n clientHooksPath: string;\n serverHooksPath: string;\n} {\n const relativeUserClientHooksPath = svelteConfig?.kit?.files?.hooks?.client;\n const relativeUserServerHooksPath = svelteConfig?.kit?.files?.hooks?.server;\n const userClientHooksPath =\n relativeUserClientHooksPath &&\n path.resolve(process.cwd(), relativeUserClientHooksPath);\n const userServerHooksPath =\n relativeUserServerHooksPath &&\n path.resolve(process.cwd(), relativeUserServerHooksPath);\n\n const defaulHooksDir = path.resolve(process.cwd(), 'src');\n const defaultClientHooksPath = path.resolve(defaulHooksDir, 'hooks.client'); // file ending missing on purpose\n const defaultServerHooksPath = path.resolve(defaulHooksDir, 'hooks.server'); // same here\n\n return {\n clientHooksPath: userClientHooksPath || defaultClientHooksPath,\n serverHooksPath: userServerHooksPath || defaultServerHooksPath,\n };\n}\n\n/**\n * Reads the template, replaces the dsn placeholder with the actual dsn and writes the file to @param hooksFileDest\n */\nasync function createNewHooksFile(\n hooksFileDest: string,\n hooktype: 'client' | 'server',\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n setupForSvelteKitTracing: boolean,\n): Promise<void> {\n const filledTemplate =\n hooktype === 'client'\n ? getClientHooksTemplate(dsn, selectedFeatures)\n : getServerHooksTemplate(dsn, selectedFeatures, setupForSvelteKitTracing);\n\n await fs.promises.mkdir(path.dirname(hooksFileDest), { recursive: true });\n await fs.promises.writeFile(hooksFileDest, filledTemplate);\n\n clack.log.success(`Created ${hooksFileDest}`);\n Sentry.setTag(`created-${hooktype}-hooks`, 'success');\n}\n\nasync function createNewInstrumentationServerFile(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n logs: boolean;\n },\n): Promise<void> {\n const filledTemplate = getInstrumentationServerTemplate(\n dsn,\n selectedFeatures,\n );\n\n const fileEnding = isUsingTypeScript() ? 'ts' : 'js';\n\n const instrumentationServerFile = path.resolve(\n process.cwd(),\n 'src',\n `instrumentation.server.${fileEnding}`,\n );\n\n await fs.promises.mkdir(path.dirname(instrumentationServerFile), {\n recursive: true,\n });\n\n await fs.promises.writeFile(instrumentationServerFile, filledTemplate);\n\n clack.log.success(\n `Created ${chalk.cyan(path.basename(instrumentationServerFile))}`,\n );\n Sentry.setTag('created-instrumentation-server', 'success');\n}\n\n/**\n * Merges the users' hooks file with Sentry-related code.\n *\n * Both hooks:\n * - add import * as Sentry\n * - add Sentry.init\n * - add handleError hook wrapper\n *\n * Additionally in Server hook:\n * - add handle hook handler\n */\nasync function mergeHooksFile(\n hooksFile: string,\n hookType: 'client' | 'server',\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n includeSentryInit: boolean,\n): Promise<void> {\n const originalHooksMod = await loadFile(hooksFile);\n\n const file: 'server-hooks' | 'client-hooks' = `${hookType}-hooks`;\n\n if (hasSentryContent(originalHooksMod.$ast as t.Program)) {\n // We don't want to mess with files that already have Sentry content.\n // Let's just bail out at this point.\n clack.log.warn(\n `File ${chalk.cyan(\n path.basename(hooksFile),\n )} already contains Sentry code.\nSkipping adding Sentry functionality to.`,\n );\n Sentry.setTag(`modified-${file}`, 'fail');\n Sentry.setTag(`${file}-fail-reason`, 'has-sentry-content');\n return;\n }\n\n await modifyAndRecordFail(\n () =>\n originalHooksMod.imports.$add({\n from: '@sentry/sveltekit',\n imported: '*',\n local: 'Sentry',\n }),\n 'import-injection',\n file,\n );\n\n if (hookType === 'client' || includeSentryInit) {\n await modifyAndRecordFail(\n () => {\n if (hookType === 'client') {\n insertClientInitCall(dsn, originalHooksMod, selectedFeatures);\n } else {\n insertServerInitCall(dsn, originalHooksMod, selectedFeatures);\n }\n },\n 'init-call-injection',\n file,\n );\n }\n\n await modifyAndRecordFail(\n () => wrapHandleError(originalHooksMod),\n 'wrap-handle-error',\n file,\n );\n\n if (hookType === 'server') {\n await modifyAndRecordFail(\n () => wrapHandle(originalHooksMod),\n 'wrap-handle',\n 'server-hooks',\n );\n }\n\n await modifyAndRecordFail(\n async () => {\n const modifiedCode = originalHooksMod.generate().code;\n await fs.promises.writeFile(hooksFile, modifiedCode);\n },\n 'write-file',\n file,\n );\n\n clack.log.success(`Added Sentry code to ${hooksFile}`);\n Sentry.setTag(`modified-${hookType}-hooks`, 'success');\n}\n\n/**\n * Merges the users' instrumentation.server file with Sentry-related code.\n *\n * Both hooks:\n * - add import * as Sentry\n * - add Sentry.init\n * - add handleError hook wrapper\n *\n * Additionally in Server hook:\n * - add handle hook handler\n */\nasync function mergeInstrumentationServerFile(\n instrumentationServerFilePath: string,\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): Promise<void> {\n const originalInstrumentationServerMod = await loadFile(\n instrumentationServerFilePath,\n );\n const filename = path.basename(instrumentationServerFilePath);\n\n if (hasSentryContent(originalInstrumentationServerMod.$ast as t.Program)) {\n // We don't want to mess with files that already have Sentry content.\n // Let's just bail out at this point.\n clack.log.warn(\n `File ${chalk.cyan(filename)} already contains Sentry code.\nSkipping adding Sentry functionality to it.`,\n );\n Sentry.setTag(`modified-instrumentation-server`, 'fail');\n Sentry.setTag(`instrumentation-server-fail-reason`, 'has-sentry-content');\n return;\n }\n\n await modifyAndRecordFail(\n () =>\n originalInstrumentationServerMod.imports.$add({\n from: '@sentry/sveltekit',\n imported: '*',\n local: 'Sentry',\n }),\n 'import-injection',\n 'instrumentation-server',\n );\n\n await modifyAndRecordFail(\n () => {\n insertServerInitCall(\n dsn,\n originalInstrumentationServerMod,\n selectedFeatures,\n );\n },\n 'init-call-injection',\n 'instrumentation-server',\n );\n\n await modifyAndRecordFail(\n async () => {\n const modifiedCode = originalInstrumentationServerMod.generate().code;\n await fs.promises.writeFile(instrumentationServerFilePath, modifiedCode);\n },\n 'write-file',\n 'instrumentation-server',\n );\n\n clack.log.success(`Added Sentry.init code to ${chalk.cyan(filename)}`);\n Sentry.setTag(`modified-instrumentation-server`, 'success');\n}\n\nconst DATA_COLLECTION_HINT = [\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/sveltekit/configuration/options/#dataCollection',\n ' // userInfo: false,',\n ' // httpBodies: [],',\n ' },',\n].join('\\n');\n\nexport function insertClientInitCall(\n dsn: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalHooksMod: ProxifiedModule<any>,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): void {\n const initCallComment = `\n // If you don't want to use Session Replay, remove the \\`Replay\\` integration,\n // \\`replaysSessionSampleRate\\` and \\`replaysOnErrorSampleRate\\` options.`;\n\n const initArgs: {\n dsn: string;\n tracesSampleRate?: number;\n replaysSessionSampleRate?: number;\n replaysOnErrorSampleRate?: number;\n integrations?: string[];\n enableLogs?: boolean;\n } = {\n dsn,\n };\n\n if (selectedFeatures.performance) {\n initArgs.tracesSampleRate = 1.0;\n }\n\n if (selectedFeatures.replay) {\n initArgs.replaysSessionSampleRate = 0.1;\n initArgs.replaysOnErrorSampleRate = 1.0;\n initArgs.integrations = [builders.functionCall('Sentry.replayIntegration')];\n }\n\n if (selectedFeatures.logs) {\n initArgs.enableLogs = true;\n }\n\n // This assignment of any values is fine because we're just creating a function call in magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const initCall = builders.functionCall('Sentry.init', initArgs);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const generatedInitCode = generateCode(initCall).code;\n const initCodeWithHint = generatedInitCode.replace(\n /\\n\\}\\)$/,\n `,${DATA_COLLECTION_HINT}\\n})`,\n );\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const initCallWithComment = builders.raw(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n `${initCallComment}\\n${initCodeWithHint}`,\n );\n\n const originalHooksModAST = originalHooksMod.$ast as Program;\n\n const initCallInsertionIndex = getInitCallInsertionIndex(originalHooksModAST);\n\n originalHooksModAST.body.splice(\n initCallInsertionIndex,\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n generateCode(initCallWithComment).code,\n );\n}\n\nfunction insertServerInitCall(\n dsn: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalMod: ProxifiedModule<any>,\n selectedFeatures: {\n performance: boolean;\n logs: boolean;\n },\n): void {\n const initArgs: {\n dsn: string;\n tracesSampleRate?: number;\n enableLogs?: boolean;\n } = {\n dsn,\n };\n\n if (selectedFeatures.performance) {\n initArgs.tracesSampleRate = 1.0;\n }\n\n if (selectedFeatures.logs) {\n initArgs.enableLogs = true;\n }\n\n // This assignment of any values is fine because we're just creating a function call in magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const initCall = builders.functionCall('Sentry.init', initArgs);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const generatedInitCode = generateCode(initCall).code;\n const initCodeWithHint = generatedInitCode.replace(\n /\\n\\}\\)$/,\n `,${DATA_COLLECTION_HINT}\\n})`,\n );\n\n const originalModAST = originalMod.$ast as Program;\n\n const initCallInsertionIndex = getInitCallInsertionIndex(originalModAST);\n\n originalModAST.body.splice(\n initCallInsertionIndex,\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n initCodeWithHint,\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction wrapHandleError(mod: ProxifiedModule<any>): void {\n const modAst = mod.exports.$ast as Program;\n const namedExports = modAst.body.filter(\n (node) => node.type === 'ExportNamedDeclaration',\n ) as ExportNamedDeclaration[];\n\n let foundHandleError = false;\n\n namedExports.forEach((modExport) => {\n const declaration = modExport.declaration;\n if (!declaration) {\n return;\n }\n if (declaration.type === 'FunctionDeclaration') {\n if (!declaration.id || declaration.id.name !== 'handleError') {\n return;\n }\n foundHandleError = true;\n const userCode = generateCode(declaration).code;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n mod.exports.handleError = builders.raw(\n `Sentry.handleErrorWithSentry(${userCode.replace(\n 'handleError',\n '_handleError',\n )})`,\n );\n // because magicast doesn't overwrite the original function export, we need to remove it manually\n modAst.body = modAst.body.filter((node) => node !== modExport);\n } else if (declaration.type === 'VariableDeclaration') {\n const declarations = declaration.declarations;\n declarations.forEach((declaration) => {\n // @ts-expect-error - id should always have a name in this case\n if (!declaration.id || declaration.id.name !== 'handleError') {\n return;\n }\n foundHandleError = true;\n const userCode = declaration.init;\n const stringifiedUserCode = userCode ? generateCode(userCode).code : '';\n // @ts-expect-error - we can just place a string here, magicast will convert it to a node\n declaration.init = `Sentry.handleErrorWithSentry(${stringifiedUserCode})`;\n });\n }\n });\n\n if (!foundHandleError) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n mod.exports.handleError = builders.functionCall(\n 'Sentry.handleErrorWithSentry',\n );\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction wrapHandle(mod: ProxifiedModule<any>): void {\n const modAst = mod.exports.$ast as Program;\n const namedExports = modAst.body.filter(\n (node) => node.type === 'ExportNamedDeclaration',\n ) as ExportNamedDeclaration[];\n\n let foundHandle = false;\n\n namedExports.forEach((modExport) => {\n const declaration = modExport.declaration;\n if (!declaration) {\n return;\n }\n if (declaration.type === 'FunctionDeclaration') {\n if (!declaration.id || declaration.id.name !== 'handle') {\n return;\n }\n foundHandle = true;\n const userCode = generateCode(declaration).code;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n mod.exports.handle = builders.raw(\n `sequence(Sentry.sentryHandle(), ${userCode.replace(\n 'handle',\n '_handle',\n )})`,\n );\n // because of an issue with magicast, we need to remove the original export\n modAst.body = modAst.body.filter((node) => node !== modExport);\n } else if (declaration.type === 'VariableDeclaration') {\n const declarations = declaration.declarations;\n declarations.forEach((declaration) => {\n if (\n !declaration.id ||\n declaration.id.type !== 'Identifier' ||\n (declaration.id.name && declaration.id.name !== 'handle')\n ) {\n return;\n }\n const userCode = declaration.init;\n const stringifiedUserCode = userCode ? generateCode(userCode).code : '';\n // @ts-expect-error - we can just place a string here, magicast will convert it to a node\n declaration.init = `sequence(Sentry.sentryHandle(), ${stringifiedUserCode})`;\n foundHandle = true;\n });\n }\n });\n\n if (!foundHandle) {\n // can't use builders.functionCall here because it doesn't yet\n // support member expressions (Sentry.sentryHandle()) in args\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n mod.exports.handle = builders.raw('sequence(Sentry.sentryHandle())');\n }\n\n try {\n mod.imports.$add({\n from: '@sveltejs/kit/hooks',\n imported: 'sequence',\n local: 'sequence',\n });\n } catch (_) {\n // It's possible sequence is already imported. in this case, magicast throws but that's fine.\n }\n}\n\n/**\n * We want to insert the init call on top of the file but after all import statements\n */\nfunction getInitCallInsertionIndex(originalModAST: Program): number {\n // We need to deep-copy here because reverse mutates in place\n const copiedBodyNodes = [...originalModAST.body];\n const lastImportDeclaration = copiedBodyNodes\n .reverse()\n .find((node) => node.type === 'ImportDeclaration');\n\n const initCallInsertionIndex = lastImportDeclaration\n ? originalModAST.body.indexOf(lastImportDeclaration) + 1\n : 0;\n return initCallInsertionIndex;\n}\n"]}
|
|
@@ -30,9 +30,12 @@ ${selectedFeatures.replay
|
|
|
30
30
|
integrations: [replayIntegration()],`
|
|
31
31
|
: ''}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
dataCollection: {
|
|
34
|
+
// To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
|
|
35
|
+
// https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
|
|
36
|
+
// userInfo: false,
|
|
37
|
+
// httpBodies: [],
|
|
38
|
+
},
|
|
36
39
|
});
|
|
37
40
|
|
|
38
41
|
// If you have a custom error handler, pass it to \`handleErrorWithSentry\`
|
|
@@ -57,9 +60,12 @@ ${selectedFeatures.logs
|
|
|
57
60
|
`
|
|
58
61
|
: ''}
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
dataCollection: {
|
|
64
|
+
// To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
|
|
65
|
+
// https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
|
|
66
|
+
// userInfo: false,
|
|
67
|
+
// httpBodies: [],
|
|
68
|
+
},
|
|
63
69
|
|
|
64
70
|
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
|
|
65
71
|
// spotlight: import.meta.env.DEV,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/sveltekit/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,sBAAsB,CACpC,GAAW,EACX,gBAIC;IAED,OAAO;;;;UAIC,GAAG;EAEX,gBAAgB,CAAC,WAAW;QAC1B,CAAC,CAAC;;CAEL;QACG,CAAC,CAAC,EACN;EAEE,gBAAgB,CAAC,IAAI;QACnB,CAAC,CAAC;;CAEL;QACG,CAAC,CAAC,EACN;EAEE,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CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4J1C,CAAC;AACF,CAAC;AA7ND,gEA6NC;AAED,SAAgB,wBAAwB;IACtC,OAAO;;;;;;CAMR,CAAC;AACF,CAAC;AARD,4DAQC","sourcesContent":["export function getClientHooksTemplate(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n return `import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\nimport * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '${dsn}',\n${\n selectedFeatures.performance\n ? `\n tracesSampleRate: 1.0,\n`\n : ''\n}\n${\n selectedFeatures.logs\n ? ` // Enable logs to be sent to Sentry\n enableLogs: true,\n`\n : ''\n}\n${\n selectedFeatures.replay\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\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n});\n\n// If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\nexport const handleError = handleErrorWithSentry();\n`;\n}\n\nexport function getServerHooksTemplate(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n includeSentryInit: boolean,\n) {\n const sentryInit = includeSentryInit\n ? `import * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '${dsn}',\n${\n selectedFeatures.performance\n ? `\n tracesSampleRate: 1.0,\n`\n : ''\n}\n${\n selectedFeatures.logs\n ? ` // Enable logs to be sent to Sentry\n enableLogs: true,\n`\n : ''\n}\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n});`\n : ``;\n\n return `import { sequence } from \"@sveltejs/kit/hooks\";\nimport { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n${sentryInit}\n\n// If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\nexport const handle = sequence(sentryHandle());\n\n// If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\nexport const handleError = handleErrorWithSentry();\n`;\n}\n\nexport function getInstrumentationServerTemplate(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n logs: boolean;\n },\n) {\n return `import * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '${dsn}',\n${\n selectedFeatures.performance\n ? `\n tracesSampleRate: 1.0,\n`\n : ''\n}\n${\n selectedFeatures.logs\n ? ` // Enable logs to be sent to Sentry\n enableLogs: true,\n`\n : ''\n}\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n});`;\n}\n\n/**\n * +page.svelte with Sentry example\n */\nexport function getSentryExampleSveltePage(options: {\n selfHosted: boolean;\n url: string;\n orgSlug: string;\n projectId: string;\n isUsingSvelte5: boolean;\n}) {\n const issuesPageLink = options.selfHosted\n ? `${options.url}organizations/${options.orgSlug}/issues/?project=${options.projectId}`\n : `https://${options.orgSlug}.sentry.io/issues/?project=${options.projectId}`;\n\n return `<!--\nThis is just a very simple page with a button to throw an example error.\nFeel free to delete this file and the entire sentry route.\n-->\n\n<script>\n import * as Sentry from '@sentry/sveltekit';\n import { onMount } from 'svelte';\n \n let hasSentError = ${options.isUsingSvelte5 ? '$state(false)' : 'false'};\n let isConnected = true;\n\n onMount(async () => {\n const result = await Sentry.diagnoseSdkConnectivity();\n isConnected = result !== 'sentry-unreachable';\n });\n\n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const res = await fetch('/sentry-example-page');\n if (!res.ok) {\n hasSentError = true;\n throw new Error('Sentry Example Frontend Error');\n }\n }\n );\n }\n</script>\n\n<title>sentry-example-page</title>\n\n<div>\n <main>\n <div class=\"flex-spacer\"></div>\n <svg height=\"40\" width=\"40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z\" fill=\"currentcolor\"/>\n </svg>\n <h1>\n sentry-example-page\n </h1>\n\n <p class=\"description\">\n Click the button below, and view the sample error on the Sentry <a target=\"_blank\" href=\"${issuesPageLink}\">Issues Page</a>. \n For more details about setting up Sentry, <a target=\"_blank\" href=\"https://docs.sentry.io/platforms/javascript/guides/sveltekit/\">read our docs</a>.\n </p>\n\n <button\n type=\"button\"\n on${options.isUsingSvelte5 ? '' : ':'}click={getSentryData}\n disabled={!isConnected}\n >\n <span>\n Throw Sample Error\n </span>\n </button>\n\n {#if hasSentError}\n <p class=\"success\">\n Sample error was sent to Sentry.\n </p>\n {:else if !isConnected}\n <div class=\"connectivity-error\">\n <p>It looks like network requests to Sentry are being blocked, which will prevent errors from being captured. Try disabling your ad-blocker to complete the test.</p>\n </div>\n {:else}\n <div class=\"success_placeholder\"></div>\n {/if}\n <div class=\"flex-spacer\"></div>\n </main>\n</div>\n\n<style>\n :global(body) {\n margin: 0;\n\n @media (prefers-color-scheme: dark) {\n color: #ededed;\n background-color: #0a0a0a;\n }\n }\n\n main {\n display: flex;\n min-height: 100vh;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n gap: 16px;\n margin: 0;\n padding: 16px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", sans-serif;\n }\n\n h1 {\n padding: 0px 4px;\n border-radius: 4px;\n background-color: rgba(24, 20, 35, 0.03);\n font-family: monospace;\n font-size: 20px;\n line-height: 1.2;\n }\n\n p {\n margin: 0;\n font-size: 20px;\n }\n\n a {\n color: #6341F0;\n text-decoration: underline;\n cursor: pointer;\n\n @media (prefers-color-scheme: dark) {\n color: #B3A1FF;\n }\n }\n\n button {\n border-radius: 8px;\n color: white;\n cursor: pointer;\n background-color: #553DB8;\n border: none;\n padding: 0;\n margin-top: 4px;\n\n & > span {\n display: inline-block;\n padding: 12px 16px;\n border-radius: inherit;\n font-size: 20px;\n font-weight: bold;\n line-height: 1;\n background-color: #7553FF;\n border: 1px solid #553DB8;\n transform: translateY(-4px);\n }\n\n &:hover > span {\n transform: translateY(-8px);\n }\n\n &:active > span {\n transform: translateY(0);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n\n & > span {\n transform: translateY(0);\n border: none;\n }\n }\n }\n\n .description {\n text-align: center;\n color: #6E6C75;\n max-width: 500px;\n line-height: 1.5;\n font-size: 20px;\n\n @media (prefers-color-scheme: dark) {\n color: #A49FB5;\n }\n }\n\n .flex-spacer {\n flex: 1;\n }\n\n .success {\n padding: 12px 16px;\n border-radius: 8px;\n font-size: 20px;\n line-height: 1;\n background-color: #00F261;\n border: 1px solid #00BF4D;\n color: #181423;\n }\n\n .success_placeholder {\n height: 46px;\n }\n\n .connectivity-error {\n padding: 12px 16px;\n background-color: #E50045;\n border-radius: 8px;\n width: 500px;\n color: #FFFFFF;\n border: 1px solid #A80033;\n text-align: center;\n margin: 0;\n }\n \n .connectivity-error a {\n color: #FFFFFF;\n text-decoration: underline;\n }\n</style>\n`;\n}\n\nexport function getSentryExampleApiRoute() {\n return `// This is just a very simple API route that throws an example error.\n// Feel free to delete this file and the entire sentry route.\n\nexport const GET = async () => {\n throw new Error(\"Sentry Example API Route Error\");\n};\n`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/sveltekit/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,sBAAsB,CACpC,GAAW,EACX,gBAIC;IAED,OAAO;;;;UAIC,GAAG;EAEX,gBAAgB,CAAC,WAAW;QAC1B,CAAC,CAAC;;CAEL;QACG,CAAC,CAAC,EACN;EAEE,gBAAgB,CAAC,IAAI;QACnB,CAAC,CAAC;;CAEL;QACG,CAAC,CAAC,EACN;EAEE,gBAAgB,CAAC,MAAM;QACrB,CAAC,CAAC;;;;;;;;;uCASiC;QACnC,CAAC,CAAC,EACN;;;;;;;;;;;;CAYC,CAAC;AACF,CAAC;AArDD,wDAqDC;AAED,SAAgB,sBAAsB,CACpC,GAAW,EACX,gBAIC,EACD,iBAA0B;IAE1B,MAAM,UAAU,GAAG,iBAAiB;QAClC,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;;;;;;;;CA4J1C,CAAC;AACF,CAAC;AA7ND,gEA6NC;AAED,SAAgB,wBAAwB;IACtC,OAAO;;;;;;CAMR,CAAC;AACF,CAAC;AARD,4DAQC","sourcesContent":["export function getClientHooksTemplate(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n) {\n return `import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\nimport * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '${dsn}',\n${\n selectedFeatures.performance\n ? `\n tracesSampleRate: 1.0,\n`\n : ''\n}\n${\n selectedFeatures.logs\n ? ` // Enable logs to be sent to Sentry\n enableLogs: true,\n`\n : ''\n}\n${\n selectedFeatures.replay\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\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/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n});\n\n// If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\nexport const handleError = handleErrorWithSentry();\n`;\n}\n\nexport function getServerHooksTemplate(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n includeSentryInit: boolean,\n) {\n const sentryInit = includeSentryInit\n ? `import * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '${dsn}',\n${\n selectedFeatures.performance\n ? `\n tracesSampleRate: 1.0,\n`\n : ''\n}\n${\n selectedFeatures.logs\n ? ` // Enable logs to be sent to Sentry\n enableLogs: true,\n`\n : ''\n}\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/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n});`\n : ``;\n\n return `import { sequence } from \"@sveltejs/kit/hooks\";\nimport { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n${sentryInit}\n\n// If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\nexport const handle = sequence(sentryHandle());\n\n// If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\nexport const handleError = handleErrorWithSentry();\n`;\n}\n\nexport function getInstrumentationServerTemplate(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n logs: boolean;\n },\n) {\n return `import * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '${dsn}',\n${\n selectedFeatures.performance\n ? `\n tracesSampleRate: 1.0,\n`\n : ''\n}\n${\n selectedFeatures.logs\n ? ` // Enable logs to be sent to Sentry\n enableLogs: true,\n`\n : ''\n}\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n});`;\n}\n\n/**\n * +page.svelte with Sentry example\n */\nexport function getSentryExampleSveltePage(options: {\n selfHosted: boolean;\n url: string;\n orgSlug: string;\n projectId: string;\n isUsingSvelte5: boolean;\n}) {\n const issuesPageLink = options.selfHosted\n ? `${options.url}organizations/${options.orgSlug}/issues/?project=${options.projectId}`\n : `https://${options.orgSlug}.sentry.io/issues/?project=${options.projectId}`;\n\n return `<!--\nThis is just a very simple page with a button to throw an example error.\nFeel free to delete this file and the entire sentry route.\n-->\n\n<script>\n import * as Sentry from '@sentry/sveltekit';\n import { onMount } from 'svelte';\n \n let hasSentError = ${options.isUsingSvelte5 ? '$state(false)' : 'false'};\n let isConnected = true;\n\n onMount(async () => {\n const result = await Sentry.diagnoseSdkConnectivity();\n isConnected = result !== 'sentry-unreachable';\n });\n\n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const res = await fetch('/sentry-example-page');\n if (!res.ok) {\n hasSentError = true;\n throw new Error('Sentry Example Frontend Error');\n }\n }\n );\n }\n</script>\n\n<title>sentry-example-page</title>\n\n<div>\n <main>\n <div class=\"flex-spacer\"></div>\n <svg height=\"40\" width=\"40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z\" fill=\"currentcolor\"/>\n </svg>\n <h1>\n sentry-example-page\n </h1>\n\n <p class=\"description\">\n Click the button below, and view the sample error on the Sentry <a target=\"_blank\" href=\"${issuesPageLink}\">Issues Page</a>. \n For more details about setting up Sentry, <a target=\"_blank\" href=\"https://docs.sentry.io/platforms/javascript/guides/sveltekit/\">read our docs</a>.\n </p>\n\n <button\n type=\"button\"\n on${options.isUsingSvelte5 ? '' : ':'}click={getSentryData}\n disabled={!isConnected}\n >\n <span>\n Throw Sample Error\n </span>\n </button>\n\n {#if hasSentError}\n <p class=\"success\">\n Sample error was sent to Sentry.\n </p>\n {:else if !isConnected}\n <div class=\"connectivity-error\">\n <p>It looks like network requests to Sentry are being blocked, which will prevent errors from being captured. Try disabling your ad-blocker to complete the test.</p>\n </div>\n {:else}\n <div class=\"success_placeholder\"></div>\n {/if}\n <div class=\"flex-spacer\"></div>\n </main>\n</div>\n\n<style>\n :global(body) {\n margin: 0;\n\n @media (prefers-color-scheme: dark) {\n color: #ededed;\n background-color: #0a0a0a;\n }\n }\n\n main {\n display: flex;\n min-height: 100vh;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n gap: 16px;\n margin: 0;\n padding: 16px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", sans-serif;\n }\n\n h1 {\n padding: 0px 4px;\n border-radius: 4px;\n background-color: rgba(24, 20, 35, 0.03);\n font-family: monospace;\n font-size: 20px;\n line-height: 1.2;\n }\n\n p {\n margin: 0;\n font-size: 20px;\n }\n\n a {\n color: #6341F0;\n text-decoration: underline;\n cursor: pointer;\n\n @media (prefers-color-scheme: dark) {\n color: #B3A1FF;\n }\n }\n\n button {\n border-radius: 8px;\n color: white;\n cursor: pointer;\n background-color: #553DB8;\n border: none;\n padding: 0;\n margin-top: 4px;\n\n & > span {\n display: inline-block;\n padding: 12px 16px;\n border-radius: inherit;\n font-size: 20px;\n font-weight: bold;\n line-height: 1;\n background-color: #7553FF;\n border: 1px solid #553DB8;\n transform: translateY(-4px);\n }\n\n &:hover > span {\n transform: translateY(-8px);\n }\n\n &:active > span {\n transform: translateY(0);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n\n & > span {\n transform: translateY(0);\n border: none;\n }\n }\n }\n\n .description {\n text-align: center;\n color: #6E6C75;\n max-width: 500px;\n line-height: 1.5;\n font-size: 20px;\n\n @media (prefers-color-scheme: dark) {\n color: #A49FB5;\n }\n }\n\n .flex-spacer {\n flex: 1;\n }\n\n .success {\n padding: 12px 16px;\n border-radius: 8px;\n font-size: 20px;\n line-height: 1;\n background-color: #00F261;\n border: 1px solid #00BF4D;\n color: #181423;\n }\n\n .success_placeholder {\n height: 46px;\n }\n\n .connectivity-error {\n padding: 12px 16px;\n background-color: #E50045;\n border-radius: 8px;\n width: 500px;\n color: #FFFFFF;\n border: 1px solid #A80033;\n text-align: center;\n margin: 0;\n }\n \n .connectivity-error a {\n color: #FFFFFF;\n text-decoration: underline;\n }\n</style>\n`;\n}\n\nexport function getSentryExampleApiRoute() {\n return `// This is just a very simple API route that throws an example error.\n// Feel free to delete this file and the entire sentry route.\n\nexport const GET = async () => {\n throw new Error(\"Sentry Example API Route Error\");\n};\n`;\n}\n"]}
|
|
@@ -49,9 +49,10 @@ export declare function printWelcome(options: {
|
|
|
49
49
|
* @param options.ignoreGitChanges If true, the wizard will not check if the project is a git repository.
|
|
50
50
|
* @param options.cwd The directory of the project. If undefined, the current process working directory will be used.
|
|
51
51
|
*/
|
|
52
|
-
export declare function confirmContinueIfNoOrDirtyGitRepo(
|
|
52
|
+
export declare function confirmContinueIfNoOrDirtyGitRepo({ ignoreGitChanges, cwd, nonInteractive, }: {
|
|
53
53
|
ignoreGitChanges: boolean | undefined;
|
|
54
54
|
cwd: string | undefined;
|
|
55
|
+
nonInteractive?: boolean;
|
|
55
56
|
}): Promise<void>;
|
|
56
57
|
export declare function askToInstallSentryCLI(): Promise<boolean>;
|
|
57
58
|
export declare function askForItemSelection(items: string[], message: string): Promise<{
|
|
@@ -172,12 +172,17 @@ exports.printWelcome = printWelcome;
|
|
|
172
172
|
* @param options.ignoreGitChanges If true, the wizard will not check if the project is a git repository.
|
|
173
173
|
* @param options.cwd The directory of the project. If undefined, the current process working directory will be used.
|
|
174
174
|
*/
|
|
175
|
-
async function confirmContinueIfNoOrDirtyGitRepo(
|
|
175
|
+
async function confirmContinueIfNoOrDirtyGitRepo({ ignoreGitChanges, cwd, nonInteractive = false, }) {
|
|
176
176
|
return (0, telemetry_1.traceStep)('check-git-status', async () => {
|
|
177
177
|
if (!(0, git_1.isInGitRepo)({
|
|
178
|
-
cwd:
|
|
178
|
+
cwd: cwd,
|
|
179
179
|
}) &&
|
|
180
|
-
|
|
180
|
+
ignoreGitChanges !== true) {
|
|
181
|
+
if (nonInteractive) {
|
|
182
|
+
clack.log.error('Project is not inside a git repository in non-interactive mode. Run from a git repository or pass --ignore-git-changes to skip this safety check.');
|
|
183
|
+
Sentry.setTag('continue-without-git', false);
|
|
184
|
+
await abort();
|
|
185
|
+
}
|
|
181
186
|
const continueWithoutGit = await abortIfCancelled(clack.confirm({
|
|
182
187
|
message: 'You are not inside a git repository. The wizard will create and update files. Do you want to continue anyway?',
|
|
183
188
|
}));
|
|
@@ -188,14 +193,20 @@ async function confirmContinueIfNoOrDirtyGitRepo(options) {
|
|
|
188
193
|
// return early to avoid checking for uncommitted files
|
|
189
194
|
return;
|
|
190
195
|
}
|
|
191
|
-
const uncommittedOrUntrackedFiles = (0, git_1.getUncommittedOrUntrackedFiles)(
|
|
192
|
-
|
|
193
|
-
|
|
196
|
+
const uncommittedOrUntrackedFiles = (0, git_1.getUncommittedOrUntrackedFiles)({
|
|
197
|
+
cwd: cwd,
|
|
198
|
+
});
|
|
199
|
+
if (uncommittedOrUntrackedFiles.length && ignoreGitChanges !== true) {
|
|
194
200
|
clack.log.warn(`You have uncommitted or untracked files in your repo:
|
|
195
201
|
|
|
196
202
|
${uncommittedOrUntrackedFiles.join('\n')}
|
|
197
203
|
|
|
198
204
|
The wizard will create and update files.`);
|
|
205
|
+
if (nonInteractive) {
|
|
206
|
+
clack.log.error('Project has uncommitted or untracked files in non-interactive mode. Commit or stash your changes, or pass --ignore-git-changes to skip this safety check.');
|
|
207
|
+
Sentry.setTag('continue-with-dirty-repo', false);
|
|
208
|
+
await abort();
|
|
209
|
+
}
|
|
199
210
|
const continueWithDirtyRepo = await abortIfCancelled(clack.confirm({
|
|
200
211
|
message: 'Do you want to continue anyway?',
|
|
201
212
|
}));
|