@sentry/wizard 6.0.0 → 6.1.1

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 (67) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/e2e-tests/tests/angular-17.test.js +6 -0
  3. package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
  4. package/dist/e2e-tests/tests/angular-19.test.js +7 -1
  5. package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
  6. package/dist/e2e-tests/tests/nextjs-14.test.js +5 -1
  7. package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
  8. package/dist/e2e-tests/tests/nextjs-15.test.js +5 -1
  9. package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
  10. package/dist/e2e-tests/tests/nuxt-3.test.js +9 -1
  11. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  12. package/dist/e2e-tests/tests/nuxt-4.test.js +9 -1
  13. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  14. package/dist/e2e-tests/tests/remix.test.js +8 -2
  15. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  16. package/dist/e2e-tests/tests/sveltekit.test.js +15 -3
  17. package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
  18. package/dist/src/angular/angular-wizard.js +6 -1
  19. package/dist/src/angular/angular-wizard.js.map +1 -1
  20. package/dist/src/angular/codemods/main.d.ts +4 -1
  21. package/dist/src/angular/codemods/main.js +3 -0
  22. package/dist/src/angular/codemods/main.js.map +1 -1
  23. package/dist/src/angular/sdk-setup.d.ts +1 -0
  24. package/dist/src/angular/sdk-setup.js.map +1 -1
  25. package/dist/src/apple/templates.js +17 -2
  26. package/dist/src/apple/templates.js.map +1 -1
  27. package/dist/src/apple/xcode-manager.d.ts +23 -0
  28. package/dist/src/apple/xcode-manager.js +140 -40
  29. package/dist/src/apple/xcode-manager.js.map +1 -1
  30. package/dist/src/nextjs/nextjs-wizard.js +6 -1
  31. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  32. package/dist/src/nextjs/templates.d.ts +3 -0
  33. package/dist/src/nextjs/templates.js +15 -2
  34. package/dist/src/nextjs/templates.js.map +1 -1
  35. package/dist/src/nuxt/sdk-setup.js +5 -0
  36. package/dist/src/nuxt/sdk-setup.js.map +1 -1
  37. package/dist/src/nuxt/templates.d.ts +1 -0
  38. package/dist/src/nuxt/templates.js +3 -2
  39. package/dist/src/nuxt/templates.js.map +1 -1
  40. package/dist/src/remix/remix-wizard.js +5 -0
  41. package/dist/src/remix/remix-wizard.js.map +1 -1
  42. package/dist/src/remix/sdk-setup.d.ts +5 -0
  43. package/dist/src/remix/sdk-setup.js +4 -0
  44. package/dist/src/remix/sdk-setup.js.map +1 -1
  45. package/dist/src/sveltekit/sdk-setup.js +11 -0
  46. package/dist/src/sveltekit/sdk-setup.js.map +1 -1
  47. package/dist/src/sveltekit/templates.d.ts +2 -0
  48. package/dist/src/sveltekit/templates.js +10 -0
  49. package/dist/src/sveltekit/templates.js.map +1 -1
  50. package/dist/src/version.d.ts +1 -1
  51. package/dist/src/version.js +1 -1
  52. package/dist/src/version.js.map +1 -1
  53. package/dist/test/apple/templates.test.js +36 -34
  54. package/dist/test/apple/templates.test.js.map +1 -1
  55. package/dist/test/apple/xcode-manager.test.js +418 -0
  56. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  57. package/dist/test/nextjs/templates.test.js +119 -0
  58. package/dist/test/nextjs/templates.test.js.map +1 -1
  59. package/dist/test/nuxt/templates.test.js +119 -0
  60. package/dist/test/nuxt/templates.test.js.map +1 -1
  61. package/dist/test/remix/client-entry.test.js +56 -0
  62. package/dist/test/remix/client-entry.test.js.map +1 -1
  63. package/dist/test/remix/server-instrumentation.test.js +37 -1
  64. package/dist/test/remix/server-instrumentation.test.js.map +1 -1
  65. package/dist/test/sveltekit/templates.test.js +67 -0
  66. package/dist/test/sveltekit/templates.test.js.map +1 -1
  67. package/package.json +1 -1
@@ -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 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n TEST_ARGS,\n checkEnvBuildPlugin,\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n cleanupGit,\n createFile,\n modifyFile,\n revertLocalChanges,\n startWizardInstance,\n} from '../utils';\nimport { afterAll, beforeAll, describe, test } from 'vitest';\n\nconst SERVER_TEMPLATE = `import { createRequestHandler } from '@remix-run/express';\nimport { installGlobals } from '@remix-run/node';\nimport compression from 'compression';\nimport express from 'express';\nimport morgan from 'morgan';\n\ninstallGlobals();\n\nconst viteDevServer =\n process.env.NODE_ENV === 'production'\n ? undefined\n : await import('vite').then(vite =>\n vite.createServer({\n server: { middlewareMode: true },\n }),\n );\n\nconst app = express();\n\napp.use(compression());\napp.disable('x-powered-by');\n\nif (viteDevServer) {\n app.use(viteDevServer.middlewares);\n} else {\n app.use('/assets', express.static('build/client/assets', { immutable: true, maxAge: '1y' }));\n}\n\napp.use(express.static('build/client', { maxAge: '1h' }));\napp.use(morgan('tiny'));\n\napp.all(\n '*',\n createRequestHandler({\n build: viteDevServer\n ? () => viteDevServer.ssrLoadModule('virtual:remix/server-build')\n : await import('./build/server/index.js'),\n }),\n);\n\napp.listen(0, () => console.log('Express server listening'));\n`;\n\nasync function runWizardOnRemixProject(\n projectDir: string,\n integration: Integration,\n fileModificationFn?: (\n projectDir: string,\n integration: Integration,\n ) => unknown,\n) {\n const wizardInstance = startWizardInstance(integration, projectDir);\n let packageManagerPrompted = false;\n\n if (fileModificationFn) {\n fileModificationFn(projectDir, integration);\n\n await wizardInstance.waitForOutput('Do you want to continue anyway?');\n\n packageManagerPrompted = await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Please select your package manager.',\n );\n } else {\n packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n }\n\n const tracingOptionPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n {\n timeout: 240_000,\n },\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER, KEYS.ENTER],\n 'Sentry has been successfully configured for your Remix project',\n );\n\n wizardInstance.kill();\n}\n\nfunction checkRemixProject(\n projectDir: string,\n integration: Integration,\n options?: {\n devModeExpectedOutput?: string;\n prodModeExpectedOutput?: string;\n },\n) {\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('.env-sentry-build-plugin is created and contains the auth token', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('example page exists', () => {\n checkFileExists(`${projectDir}/app/routes/sentry-example-page.tsx`);\n });\n\n test('instrumentation.server file exists', () => {\n checkFileExists(`${projectDir}/instrumentation.server.mjs`);\n });\n\n test('entry.client file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/app/entry.client.tsx`, [\n 'import { init, replayIntegration, browserTracingIntegration } from \"@sentry/remix\";',\n `init({\n dsn: \"${TEST_ARGS.PROJECT_DSN}\",\n tracesSampleRate: 1,\n\n integrations: [browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n }), replayIntegration({\n maskAllText: true,\n blockAllMedia: true\n })],\n\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1\n})`,\n ]);\n });\n\n test('entry.server file contains Sentry code', () => {\n checkFileContents(`${projectDir}/app/entry.server.tsx`, [\n 'import * as Sentry from \"@sentry/remix\";',\n `export const handleError = Sentry.wrapHandleErrorWithSentry((error, { request }) => {\n // Custom handleError implementation\n});`,\n ]);\n });\n\n test('instrumentation.server file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/instrumentation.server.mjs`, [\n 'import * as Sentry from \"@sentry/remix\";',\n `Sentry.init({\n dsn: \"${TEST_ARGS.PROJECT_DSN}\",\n tracesSampleRate: 1\n})`,\n ]);\n });\n\n test('root file contains Sentry ErrorBoundary', () => {\n checkFileContents(`${projectDir}/app/root.tsx`, [\n 'import { captureRemixErrorBoundaryError } from \"@sentry/remix\";',\n `export const ErrorBoundary = () => {\n const error = useRouteError();\n captureRemixErrorBoundaryError(error);\n return <div>Something went wrong</div>;\n};`,\n ]);\n });\n\n test('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(\n projectDir,\n options?.devModeExpectedOutput || 'to expose',\n );\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(\n projectDir,\n options?.prodModeExpectedOutput || '[remix-serve]',\n );\n });\n}\n\ndescribe('Remix', () => {\n describe('with empty project', () => {\n const integration = Integration.remix;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/remix-test-app',\n );\n\n beforeAll(async () => {\n await runWizardOnRemixProject(projectDir, integration);\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkRemixProject(projectDir, integration);\n });\n\n describe('with existing custom Express server', () => {\n const integration = Integration.remix;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/remix-test-app',\n );\n\n beforeAll(async () => {\n await runWizardOnRemixProject(projectDir, integration, (projectDir) => {\n createFile(`${projectDir}/server.mjs`, SERVER_TEMPLATE);\n\n modifyFile(`${projectDir}/package.json`, {\n '\"start\": \"remix-serve ./build/server/index.js\"':\n '\"start\": \"node ./server.mjs\"',\n '\"dev\": \"remix vite:dev\"': '\"dev\": \"node ./server.mjs\"',\n });\n });\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkRemixProject(projectDir, integration, {\n devModeExpectedOutput: 'Express server listening',\n prodModeExpectedOutput: 'Express server listening',\n });\n\n test('server.mjs contains instrumentation file import', () => {\n checkFileContents(`${projectDir}/server.mjs`, [\n \"import './instrumentation.server.mjs';\",\n ]);\n });\n });\n});\n"]}
1
+ {"version":3,"file":"remix.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/remix.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAkD;AAClD,oCAekB;AAClB,mCAA6D;AAE7D,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCvB,CAAC;AAEF,KAAK,UAAU,uBAAuB,CACpC,UAAkB,EAClB,WAAwB,EACxB,kBAGY;IAEZ,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACpE,IAAI,sBAAsB,GAAG,KAAK,CAAC;IAEnC,IAAI,kBAAkB,EAAE;QACtB,kBAAkB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAE5C,MAAM,cAAc,CAAC,aAAa,CAAC,iCAAiC,CAAC,CAAC;QAEtE,sBAAsB,GAAG,MAAM,cAAc,CAAC,yBAAyB,CACrE,CAAC,YAAI,CAAC,KAAK,CAAC,EACZ,qCAAqC,CACtC,CAAC;KACH;SAAM;QACL,sBAAsB,GAAG,MAAM,cAAc,CAAC,aAAa,CACzD,qCAAqC,CACtC,CAAC;KACH;IAED,MAAM,qBAAqB,GACzB,sBAAsB;QACtB,CAAC,MAAM,cAAc,CAAC,yBAAyB;QAC7C,0CAA0C;QAC1C,CAAC,YAAI,CAAC,IAAI,EAAE,YAAI,CAAC,KAAK,CAAC;QACvB,+FAA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E;YACZ,IAAA,0BAAkB,EAAC,UAAU,CAAC,CAAC;YAC/B,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,iBAAiB,CAAC,UAAU,EAAE,WAAW,EAAE;YACzC,qBAAqB,EAAE,0BAA0B;YACjD,sBAAsB,EAAE,0BAA0B;SACnD,CAAC,CAAC;QAEH,IAAA,aAAI,EAAC,iDAAiD,EAAE,GAAG,EAAE;YAC3D,IAAA,yBAAiB,EAAC,GAAG,UAAU,aAAa,EAAE;gBAC5C,wCAAwC;aACzC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n TEST_ARGS,\n checkEnvBuildPlugin,\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n cleanupGit,\n createFile,\n modifyFile,\n revertLocalChanges,\n startWizardInstance,\n} from '../utils';\nimport { afterAll, beforeAll, describe, test } from 'vitest';\n\nconst SERVER_TEMPLATE = `import { createRequestHandler } from '@remix-run/express';\nimport { installGlobals } from '@remix-run/node';\nimport compression from 'compression';\nimport express from 'express';\nimport morgan from 'morgan';\n\ninstallGlobals();\n\nconst viteDevServer =\n process.env.NODE_ENV === 'production'\n ? undefined\n : await import('vite').then(vite =>\n vite.createServer({\n server: { middlewareMode: true },\n }),\n );\n\nconst app = express();\n\napp.use(compression());\napp.disable('x-powered-by');\n\nif (viteDevServer) {\n app.use(viteDevServer.middlewares);\n} else {\n app.use('/assets', express.static('build/client/assets', { immutable: true, maxAge: '1y' }));\n}\n\napp.use(express.static('build/client', { maxAge: '1h' }));\napp.use(morgan('tiny'));\n\napp.all(\n '*',\n createRequestHandler({\n build: viteDevServer\n ? () => viteDevServer.ssrLoadModule('virtual:remix/server-build')\n : await import('./build/server/index.js'),\n }),\n);\n\napp.listen(0, () => console.log('Express server listening'));\n`;\n\nasync function runWizardOnRemixProject(\n projectDir: string,\n integration: Integration,\n fileModificationFn?: (\n projectDir: string,\n integration: Integration,\n ) => unknown,\n) {\n const wizardInstance = startWizardInstance(integration, projectDir);\n let packageManagerPrompted = false;\n\n if (fileModificationFn) {\n fileModificationFn(projectDir, integration);\n\n await wizardInstance.waitForOutput('Do you want to continue anyway?');\n\n packageManagerPrompted = await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Please select your package manager.',\n );\n } else {\n packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n }\n\n const tracingOptionPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n {\n timeout: 240_000,\n },\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n const logOptionPrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Logs\", sometimes doesn't work as `Logs` can be printed in bold.\n 'to send your application logs to Sentry?',\n ));\n\n logOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER, KEYS.ENTER],\n 'Sentry has been successfully configured for your Remix project',\n );\n\n wizardInstance.kill();\n}\n\nfunction checkRemixProject(\n projectDir: string,\n integration: Integration,\n options?: {\n devModeExpectedOutput?: string;\n prodModeExpectedOutput?: string;\n },\n) {\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('.env-sentry-build-plugin is created and contains the auth token', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('example page exists', () => {\n checkFileExists(`${projectDir}/app/routes/sentry-example-page.tsx`);\n });\n\n test('instrumentation.server file exists', () => {\n checkFileExists(`${projectDir}/instrumentation.server.mjs`);\n });\n\n test('entry.client file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/app/entry.client.tsx`, [\n 'import { init, replayIntegration, browserTracingIntegration } from \"@sentry/remix\";',\n `init({\n dsn: \"${TEST_ARGS.PROJECT_DSN}\",\n tracesSampleRate: 1,\n enableLogs: true,\n\n integrations: [browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n }), replayIntegration({\n maskAllText: true,\n blockAllMedia: true\n })],\n\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1\n})`,\n ]);\n });\n\n test('entry.server file contains Sentry code', () => {\n checkFileContents(`${projectDir}/app/entry.server.tsx`, [\n 'import * as Sentry from \"@sentry/remix\";',\n `export const handleError = Sentry.wrapHandleErrorWithSentry((error, { request }) => {\n // Custom handleError implementation\n});`,\n ]);\n });\n\n test('instrumentation.server file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/instrumentation.server.mjs`, [\n 'import * as Sentry from \"@sentry/remix\";',\n `Sentry.init({\n dsn: \"${TEST_ARGS.PROJECT_DSN}\",\n tracesSampleRate: 1,\n enableLogs: true\n})`,\n ]);\n });\n\n test('root file contains Sentry ErrorBoundary', () => {\n checkFileContents(`${projectDir}/app/root.tsx`, [\n 'import { captureRemixErrorBoundaryError } from \"@sentry/remix\";',\n `export const ErrorBoundary = () => {\n const error = useRouteError();\n captureRemixErrorBoundaryError(error);\n return <div>Something went wrong</div>;\n};`,\n ]);\n });\n\n test('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(\n projectDir,\n options?.devModeExpectedOutput || 'to expose',\n );\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(\n projectDir,\n options?.prodModeExpectedOutput || '[remix-serve]',\n );\n });\n}\n\ndescribe('Remix', () => {\n describe('with empty project', () => {\n const integration = Integration.remix;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/remix-test-app',\n );\n\n beforeAll(async () => {\n await runWizardOnRemixProject(projectDir, integration);\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkRemixProject(projectDir, integration);\n });\n\n describe('with existing custom Express server', () => {\n const integration = Integration.remix;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/remix-test-app',\n );\n\n beforeAll(async () => {\n await runWizardOnRemixProject(projectDir, integration, (projectDir) => {\n createFile(`${projectDir}/server.mjs`, SERVER_TEMPLATE);\n\n modifyFile(`${projectDir}/package.json`, {\n '\"start\": \"remix-serve ./build/server/index.js\"':\n '\"start\": \"node ./server.mjs\"',\n '\"dev\": \"remix vite:dev\"': '\"dev\": \"node ./server.mjs\"',\n });\n });\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkRemixProject(projectDir, integration, {\n devModeExpectedOutput: 'Express server listening',\n prodModeExpectedOutput: 'Express server listening',\n });\n\n test('server.mjs contains instrumentation file import', () => {\n checkFileContents(`${projectDir}/server.mjs`, [\n \"import './instrumentation.server.mjs';\",\n ]);\n });\n });\n});\n"]}
@@ -74,7 +74,11 @@ async function runWizardOnSvelteKitProject(projectDir, integration, fileModifica
74
74
  (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
75
75
  // "Do you want to enable Sentry Session Replay", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.
76
76
  'to get a video-like reproduction of errors during a user session?'));
77
- replayOptionPrompted &&
77
+ const logsOptionPrompted = replayOptionPrompted &&
78
+ (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
79
+ // "Do you want to enable Logs", sometimes doesn't work as `Logs` can be printed in bold.
80
+ 'to send your application logs to Sentry?'));
81
+ logsOptionPrompted &&
78
82
  (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Do you want to create an example page', {
79
83
  optional: true,
80
84
  }));
@@ -131,6 +135,9 @@ function checkSvelteKitProject(projectDir, integration, options) {
131
135
 
132
136
  tracesSampleRate: 1.0,
133
137
 
138
+ // Enable logs to be sent to Sentry
139
+ enableLogs: true,
140
+
134
141
  // This sets the sample rate to be 10%. You may want this to be 100% while
135
142
  // in development and sample at a lower rate in production
136
143
  replaysSessionSampleRate: 0.1,
@@ -153,6 +160,9 @@ function checkSvelteKitProject(projectDir, integration, options) {
153
160
 
154
161
  tracesSampleRate: 1.0,
155
162
 
163
+ // Enable logs to be sent to Sentry
164
+ enableLogs: true,
165
+
156
166
  // uncomment the line below to enable Spotlight (https://spotlightjs.com)
157
167
  // spotlight: import.meta.env.DEV,
158
168
  });`,
@@ -184,7 +194,8 @@ function checkSvelteKitProject(projectDir, integration, options) {
184
194
  tracesSampleRate: 1,
185
195
  replaysSessionSampleRate: 0.1,
186
196
  replaysOnErrorSampleRate: 1,
187
- integrations: [Sentry.replayIntegration()]
197
+ integrations: [Sentry.replayIntegration()],
198
+ enableLogs: true
188
199
  })`,
189
200
  'export const handleError = Sentry.handleErrorWithSentry(',
190
201
  ]);
@@ -194,7 +205,8 @@ function checkSvelteKitProject(projectDir, integration, options) {
194
205
  `import * as Sentry from '@sentry/sveltekit';`,
195
206
  `Sentry.init({
196
207
  dsn: "${utils_1.TEST_ARGS.PROJECT_DSN}",
197
- tracesSampleRate: 1
208
+ tracesSampleRate: 1,
209
+ enableLogs: true
198
210
  })`,
199
211
  'export const handleError = Sentry.handleErrorWithSentry();',
200
212
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"sveltekit.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/sveltekit.test.ts"],"names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B,CAAC,EAAE;gBACjE,8CAA8C;gBAC9C;YACI,iBAAS,CAAC,WAAW;;;;;GAK9B;gBACK,0DAA0D;aAC3D,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,aAAI,EAAC,sCAAsC,EAAE,GAAG,EAAE;YAChD,IAAA,yBAAiB,EAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAAE;gBACjE,8CAA8C;gBAC9C;YACI,iBAAS,CAAC,WAAW;;GAE9B;gBACK,4DAA4D;aAC7D,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n TEST_ARGS,\n checkEnvBuildPlugin,\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n cleanupGit,\n createFile,\n revertLocalChanges,\n startWizardInstance,\n} from '../utils';\nimport { afterAll, beforeAll, describe, test } from 'vitest';\n\nconst SERVER_HOOK_TEMPLATE = `import type { Handle } from '@sveltejs/kit';\n\nexport const handle: Handle = async ({ event, resolve }) => {\n\tif (event.url.pathname.startsWith('/custom')) {\n\t\treturn new Response('custom response');\n\t}\n\n\tconst response = await resolve(event);\n\treturn response;\n};\n`;\nconst CLIENT_HOOK_TEMPLATE = `\nexport async function handleError({ error, event }) {\n // you can capture the \\`error\\` and \\`event\\` from the client\n // but it only runs if the unexpected error comes from \\`+ page.ts\\`\n console.log(error)\n\n return {\n // don't show sensitive data to the user\n message: 'Yikes! 💩',\n }\n}\n`;\n\nasync function runWizardOnSvelteKitProject(\n projectDir: string,\n integration: Integration,\n fileModificationFn?: (\n projectDir: string,\n integration: Integration,\n ) => unknown,\n) {\n const wizardInstance = startWizardInstance(integration, projectDir);\n let packageManagerPrompted = false;\n\n if (fileModificationFn) {\n fileModificationFn(projectDir, integration);\n\n // As we modified project, we have a warning prompt before we get the package manager prompt\n await wizardInstance.waitForOutput('Do you want to continue anyway?');\n\n packageManagerPrompted = await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Please select your package manager.',\n );\n } else {\n packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager',\n );\n }\n\n const tracingOptionPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n {\n timeout: 240_000,\n },\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER, KEYS.ENTER],\n 'Successfully installed the Sentry SvelteKit SDK!',\n );\n\n wizardInstance.kill();\n}\n\nfunction checkSvelteKitProject(\n projectDir: string,\n integration: Integration,\n options?: {\n devModeExpectedOutput: string;\n prodModeExpectedOutput: string;\n },\n) {\n test('should have the correct package.json', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('should have the correct .env.sentry-build-plugin', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('example page exists', () => {\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+page.svelte'),\n );\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+server.js'),\n );\n });\n\n test('vite.config contains sentry plugin', () => {\n checkFileContents(\n path.resolve(projectDir, 'vite.config.ts'),\n `plugins: [sentrySvelteKit({\n sourceMapsUploadOptions: {\n`,\n );\n });\n\n test('hook files created', () => {\n checkFileExists(path.resolve(projectDir, 'src/hooks.server.ts'));\n checkFileExists(path.resolve(projectDir, 'src/hooks.client.ts'));\n });\n\n test('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(\n projectDir,\n options?.devModeExpectedOutput || 'ready in',\n );\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(\n projectDir,\n options?.prodModeExpectedOutput || 'to expose',\n 'preview',\n );\n });\n}\n\ndescribe('Sveltekit', () => {\n describe('without existing hooks', () => {\n const integration = Integration.sveltekit;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/sveltekit-test-app',\n );\n\n beforeAll(async () => {\n await runWizardOnSvelteKitProject(projectDir, integration);\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkSvelteKitProject(projectDir, integration);\n\n test('hooks.client.ts contains sentry', () => {\n checkFileContents(path.resolve(projectDir, 'src/hooks.client.ts'), [\n `import * as Sentry from '@sentry/sveltekit';`,\n `Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\n\n tracesSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n});`,\n 'export const handleError = handleErrorWithSentry(',\n ]);\n });\n\n test('hooks.server.ts contains sentry', () => {\n checkFileContents(path.resolve(projectDir, 'src/hooks.server.ts'), [\n `import * as Sentry from '@sentry/sveltekit';`,\n `Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\n\n tracesSampleRate: 1.0,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n});`,\n 'export const handleError = handleErrorWithSentry();',\n ]);\n });\n });\n\n describe('with existing hooks', () => {\n const integration = Integration.sveltekit;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/sveltekit-test-app',\n );\n\n beforeAll(async () => {\n await runWizardOnSvelteKitProject(\n projectDir,\n integration,\n (projectDir) => {\n createFile(\n path.resolve(projectDir, 'src/hooks.server.ts'),\n SERVER_HOOK_TEMPLATE,\n );\n\n createFile(\n path.resolve(projectDir, 'src/hooks.client.ts'),\n CLIENT_HOOK_TEMPLATE,\n );\n },\n );\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkSvelteKitProject(projectDir, integration);\n\n // These are removed from the common tests as the content is different\n // when the hooks are merged instead of created from the template\n test('hooks.client.ts contains sentry instrumentation', () => {\n checkFileContents(path.resolve(projectDir, 'src/hooks.client.ts'), [\n `import * as Sentry from '@sentry/sveltekit';`,\n `Sentry.init({\n dsn: \"${TEST_ARGS.PROJECT_DSN}\",\n tracesSampleRate: 1,\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.replayIntegration()]\n})`,\n 'export const handleError = Sentry.handleErrorWithSentry(',\n ]);\n });\n\n test('hooks.server.ts contains sentry init', () => {\n checkFileContents(path.resolve(projectDir, 'src/hooks.server.ts'), [\n `import * as Sentry from '@sentry/sveltekit';`,\n `Sentry.init({\n dsn: \"${TEST_ARGS.PROJECT_DSN}\",\n tracesSampleRate: 1\n})`,\n 'export const handleError = Sentry.handleErrorWithSentry();',\n ]);\n });\n });\n});\n"]}
1
+ {"version":3,"file":"sveltekit.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/sveltekit.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAkD;AAClD,oCAckB;AAClB,mCAA6D;AAE7D,MAAM,oBAAoB,GAAG;;;;;;;;;;CAU5B,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,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAAE;gBACjE,8CAA8C;gBAC9C;YACI,iBAAS,CAAC,WAAW;;;;;;GAM9B;gBACK,0DAA0D;aAC3D,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,aAAI,EAAC,sCAAsC,EAAE,GAAG,EAAE;YAChD,IAAA,yBAAiB,EAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAAE;gBACjE,8CAA8C;gBAC9C;YACI,iBAAS,CAAC,WAAW;;;GAG9B;gBACK,4DAA4D;aAC7D,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n TEST_ARGS,\n checkEnvBuildPlugin,\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n cleanupGit,\n createFile,\n revertLocalChanges,\n startWizardInstance,\n} from '../utils';\nimport { afterAll, beforeAll, describe, test } from 'vitest';\n\nconst SERVER_HOOK_TEMPLATE = `import type { Handle } from '@sveltejs/kit';\n\nexport const handle: Handle = async ({ event, resolve }) => {\n\tif (event.url.pathname.startsWith('/custom')) {\n\t\treturn new Response('custom response');\n\t}\n\n\tconst response = await resolve(event);\n\treturn response;\n};\n`;\nconst CLIENT_HOOK_TEMPLATE = `\nexport async function handleError({ error, event }) {\n // you can capture the \\`error\\` and \\`event\\` from the client\n // but it only runs if the unexpected error comes from \\`+ page.ts\\`\n console.log(error)\n\n return {\n // don't show sensitive data to the user\n message: 'Yikes! 💩',\n }\n}\n`;\n\nasync function runWizardOnSvelteKitProject(\n projectDir: string,\n integration: Integration,\n fileModificationFn?: (\n projectDir: string,\n integration: Integration,\n ) => unknown,\n) {\n const wizardInstance = startWizardInstance(integration, projectDir);\n let packageManagerPrompted = false;\n\n if (fileModificationFn) {\n fileModificationFn(projectDir, integration);\n\n // As we modified project, we have a warning prompt before we get the package manager prompt\n await wizardInstance.waitForOutput('Do you want to continue anyway?');\n\n packageManagerPrompted = await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Please select your package manager.',\n );\n } else {\n packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager',\n );\n }\n\n const tracingOptionPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n {\n timeout: 240_000,\n },\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n const logsOptionPrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Logs\", sometimes doesn't work as `Logs` can be printed in bold.\n 'to send your application logs to Sentry?',\n ));\n\n logsOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER, KEYS.ENTER],\n 'Successfully installed the Sentry SvelteKit SDK!',\n );\n\n wizardInstance.kill();\n}\n\nfunction checkSvelteKitProject(\n projectDir: string,\n integration: Integration,\n options?: {\n devModeExpectedOutput: string;\n prodModeExpectedOutput: string;\n },\n) {\n test('should have the correct package.json', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('should have the correct .env.sentry-build-plugin', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('example page exists', () => {\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+page.svelte'),\n );\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+server.js'),\n );\n });\n\n test('vite.config contains sentry plugin', () => {\n checkFileContents(\n path.resolve(projectDir, 'vite.config.ts'),\n `plugins: [sentrySvelteKit({\n sourceMapsUploadOptions: {\n`,\n );\n });\n\n test('hook files created', () => {\n checkFileExists(path.resolve(projectDir, 'src/hooks.server.ts'));\n checkFileExists(path.resolve(projectDir, 'src/hooks.client.ts'));\n });\n\n test('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(\n projectDir,\n options?.devModeExpectedOutput || 'ready in',\n );\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(\n projectDir,\n options?.prodModeExpectedOutput || 'to expose',\n 'preview',\n );\n });\n}\n\ndescribe('Sveltekit', () => {\n describe('without existing hooks', () => {\n const integration = Integration.sveltekit;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/sveltekit-test-app',\n );\n\n beforeAll(async () => {\n await runWizardOnSvelteKitProject(projectDir, integration);\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkSvelteKitProject(projectDir, integration);\n\n test('hooks.client.ts contains sentry', () => {\n checkFileContents(path.resolve(projectDir, 'src/hooks.client.ts'), [\n `import * as Sentry from '@sentry/sveltekit';`,\n `Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\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 'export const handleError = handleErrorWithSentry(',\n ]);\n });\n\n test('hooks.server.ts contains sentry', () => {\n checkFileContents(path.resolve(projectDir, 'src/hooks.server.ts'), [\n `import * as Sentry from '@sentry/sveltekit';`,\n `Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\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 'export const handleError = handleErrorWithSentry();',\n ]);\n });\n });\n\n describe('with existing hooks', () => {\n const integration = Integration.sveltekit;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/sveltekit-test-app',\n );\n\n beforeAll(async () => {\n await runWizardOnSvelteKitProject(\n projectDir,\n integration,\n (projectDir) => {\n createFile(\n path.resolve(projectDir, 'src/hooks.server.ts'),\n SERVER_HOOK_TEMPLATE,\n );\n\n createFile(\n path.resolve(projectDir, 'src/hooks.client.ts'),\n CLIENT_HOOK_TEMPLATE,\n );\n },\n );\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkSvelteKitProject(projectDir, integration);\n\n // These are removed from the common tests as the content is different\n // when the hooks are merged instead of created from the template\n test('hooks.client.ts contains sentry instrumentation', () => {\n checkFileContents(path.resolve(projectDir, 'src/hooks.client.ts'), [\n `import * as Sentry from '@sentry/sveltekit';`,\n `Sentry.init({\n dsn: \"${TEST_ARGS.PROJECT_DSN}\",\n tracesSampleRate: 1,\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1,\n integrations: [Sentry.replayIntegration()],\n enableLogs: true\n})`,\n 'export const handleError = Sentry.handleErrorWithSentry(',\n ]);\n });\n\n test('hooks.server.ts contains sentry init', () => {\n checkFileContents(path.resolve(projectDir, 'src/hooks.server.ts'), [\n `import * as Sentry from '@sentry/sveltekit';`,\n `Sentry.init({\n dsn: \"${TEST_ARGS.PROJECT_DSN}\",\n tracesSampleRate: 1,\n enableLogs: true\n})`,\n 'export const handleError = Sentry.handleErrorWithSentry();',\n ]);\n });\n });\n});\n"]}
@@ -110,7 +110,7 @@ Apologies for the inconvenience!`);
110
110
  const sdkAlreadyInstalled = (0, package_json_1.hasPackageInstalled)('@sentry/angular', packageJson);
111
111
  Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);
112
112
  await (0, clack_1.installPackage)({
113
- packageName: '@sentry/angular',
113
+ packageName: '@sentry/angular@^9',
114
114
  packageNameDisplayLabel: '@sentry/angular',
115
115
  alreadyInstalled: sdkAlreadyInstalled,
116
116
  });
@@ -125,6 +125,11 @@ Apologies for the inconvenience!`);
125
125
  prompt: `Do you want to enable ${chalk_1.default.bold('Sentry Session Replay')} to get a video-like reproduction of errors during a user session?`,
126
126
  enabledHint: 'recommended, but increases bundle size',
127
127
  },
128
+ {
129
+ id: 'logs',
130
+ prompt: `Do you want to enable ${chalk_1.default.bold('Logs')} to send your application logs to Sentry?`,
131
+ enabledHint: 'recommended',
132
+ },
128
133
  ]);
129
134
  await (0, telemetry_1.traceStep)('Initialize Sentry on Angular application entry point', async () => {
130
135
  await (0, sdk_setup_1.initializeSentryOnApplicationEntry)(dsn, selectedFeatures);
@@ -1 +1 @@
1
- {"version":3,"file":"angular-wizard.js","sourceRoot":"","sources":["../../../src/angular/angular-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AAEnC,kDAA0B;AAE1B,4CAAwD;AACxD,0CAYwB;AACxB,wDAA+E;AAC/E,mCAAiD;AAEjD,qDAAuC;AACvC,2CAAiE;AACjE,2CAA8C;AAC9C,uEAAsE;AACtE,sDAAuE;AACvE,2DAA6D;AAE7D,MAAM,6BAA6B,GAAG,QAAQ,CAAC;AAC/C,MAAM,oCAAoC,GAAG,QAAQ,CAAC;AAE/C,KAAK,UAAU,gBAAgB,CAAC,OAAsB;IAC3D,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,OAAO,CAAC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AAE;QAC3B,GAAG,IAAI,qEAAqE,eAAK,CAAC,IAAI,CACpF,UAAU,CACX,mDAAmD,CAAC;KACtD;IAED,GAAG,IAAI;4DACmD,CAAC;IAE3D,OAAO,GAAG,CAAC;AACb,CAAC;AAbD,8CAaC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\n\nimport chalk from 'chalk';\nimport type { WizardOptions } from '../utils/types';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n abortIfCancelled,\n askShouldCreateExampleComponent,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n printWelcome,\n runPrettierIfInstalled,\n abort,\n} from '../utils/clack';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { gte, minVersion, SemVer } from 'semver';\n\nimport * as Sentry from '@sentry/node';\nimport { initializeSentryOnApplicationEntry } from './sdk-setup';\nimport { updateAppConfig } from './sdk-setup';\nimport { runSourcemapsWizard } from '../sourcemaps/sourcemaps-wizard';\nimport { addSourcemapEntryToAngularJSON } from './codemods/sourcemaps';\nimport { createExampleComponent } from './example-component';\n\nconst MIN_SUPPORTED_ANGULAR_VERSION = '14.0.0';\nconst MIN_SUPPORTED_WIZARD_ANGULAR_VERSION = '17.0.0';\n\nexport async function runAngularWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'angular',\n wizardOptions: options,\n },\n () => runAngularWizardWithTelemetry(options),\n );\n}\n\nasync function runAngularWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Angular Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, '@angular/core', 'Angular');\n\n let installedAngularVersion = getPackageVersion('@angular/core', packageJson);\n\n if (!installedAngularVersion) {\n clack.log.warn('Could not determine installed Angular version.');\n\n installedAngularVersion = await abortIfCancelled(\n clack.text({\n message: `Please enter your installed Angular major version (e.g. ${chalk.cyan(\n '18',\n )} for Angular 18)`,\n validate(value) {\n if (!value) {\n return 'Angular version is required';\n }\n\n try {\n if (!minVersion(value)) {\n return `Invalid Angular version provided: ${value}`;\n }\n } catch (error) {\n return `Invalid Angular version provided: ${value}`;\n }\n },\n }),\n );\n }\n\n Sentry.setTag('angular-version', installedAngularVersion);\n\n const installedMinVersion = minVersion(installedAngularVersion) as SemVer;\n\n const sdkSupportsAngularVersion = gte(\n installedMinVersion,\n MIN_SUPPORTED_ANGULAR_VERSION,\n );\n\n const wizardSupportsAngularVersion = gte(\n installedMinVersion,\n MIN_SUPPORTED_WIZARD_ANGULAR_VERSION,\n );\n\n if (!sdkSupportsAngularVersion) {\n Sentry.setTag('angular-version-compatible', false);\n\n clack.log.warn(\n `Angular version ${chalk.cyan(\n MIN_SUPPORTED_ANGULAR_VERSION,\n )} or higher is required for the Sentry SDK.`,\n );\n clack.log.warn(\n `Please refer to Sentry's version compatibility table for more information:\n\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/angular/#angular-version-compatibility',\n)}\n`,\n );\n\n return abort('Exiting the wizard.', 0);\n }\n\n if (!wizardSupportsAngularVersion) {\n Sentry.setTag('angular-wizard-version-compatible', false);\n\n clack.log.warn(\n `The Sentry Angular Wizard requires Angular version ${chalk.cyan(\n MIN_SUPPORTED_WIZARD_ANGULAR_VERSION,\n )} or higher.`,\n );\n clack.log.warn(\n `Your Angular version (${installedAngularVersion}) is compatible with the Sentry SDK but you need to set it up manually by following our documentation:\n\n${chalk.underline('https://docs.sentry.io/platforms/javascript/guides/angular')}\n\nApologies for the inconvenience!`,\n );\n\n return abort('Exiting the wizard.', 0);\n }\n\n const { selectedProject, authToken, sentryUrl, selfHosted } =\n await getOrAskForProjectData(options, 'javascript-angular');\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/angular',\n packageJson,\n );\n\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n await installPackage({\n packageName: '@sentry/angular',\n packageNameDisplayLabel: '@sentry/angular',\n alreadyInstalled: sdkAlreadyInstalled,\n });\n\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 'Sentry Session Replay',\n )} to get a video-like reproduction of errors during a user session?`,\n enabledHint: 'recommended, but increases bundle size',\n },\n ] as const);\n\n await traceStep(\n 'Initialize Sentry on Angular application entry point',\n async () => {\n await initializeSentryOnApplicationEntry(dsn, selectedFeatures);\n },\n );\n\n await traceStep('Update Angular project configuration', async () => {\n await updateAppConfig(installedMinVersion, selectedFeatures.performance);\n });\n\n await traceStep('Setup for sourcemap uploads', async () => {\n await addSourcemapEntryToAngularJSON();\n\n if (!options.preSelectedProject) {\n options.preSelectedProject = {\n authToken,\n selfHosted,\n project: {\n organization: {\n id: selectedProject.organization.id,\n name: selectedProject.organization.name,\n slug: selectedProject.organization.slug,\n },\n id: selectedProject.id,\n slug: selectedProject.slug,\n keys: [\n {\n dsn: {\n public: dsn,\n },\n },\n ],\n },\n };\n\n options.url = sentryUrl;\n }\n\n await runSourcemapsWizard(options, 'angular');\n });\n\n const shouldCreateExampleComponent = await askShouldCreateExampleComponent();\n\n Sentry.setTag('create-example-component', shouldCreateExampleComponent);\n\n if (shouldCreateExampleComponent) {\n await traceStep(\n 'create-example-component',\n async () =>\n await createExampleComponent({\n url: sentryUrl,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n }),\n );\n }\n\n await traceStep('Run Prettier', async () => {\n await runPrettierIfInstalled({ cwd: undefined });\n });\n\n clack.outro(buildOutroMessage(shouldCreateExampleComponent));\n}\n\nexport function buildOutroMessage(createdExampleComponent: boolean): string {\n let msg = chalk.green('\\nSuccessfully installed the Sentry Angular SDK!');\n\n if (createdExampleComponent) {\n msg += `\\n\\nYou can validate your setup by starting your dev environment (${chalk.cyan(\n 'ng serve',\n )}) and throwing an error in the example component.`;\n }\n\n msg += `\\n\\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/javascript/guides/angular/`;\n\n return msg;\n}\n"]}
1
+ {"version":3,"file":"angular-wizard.js","sourceRoot":"","sources":["../../../src/angular/angular-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AAEnC,kDAA0B;AAE1B,4CAAwD;AACxD,0CAYwB;AACxB,wDAA+E;AAC/E,mCAAiD;AAEjD,qDAAuC;AACvC,2CAAiE;AACjE,2CAA8C;AAC9C,uEAAsE;AACtE,sDAAuE;AACvE,2DAA6D;AAE7D,MAAM,6BAA6B,GAAG,QAAQ,CAAC;AAC/C,MAAM,oCAAoC,GAAG,QAAQ,CAAC;AAE/C,KAAK,UAAU,gBAAgB,CAAC,OAAsB;IAC3D,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;QACjC,WAAW,EAAE,SAAS;QACtB,aAAa,EAAE,OAAO;KACvB,EACD,GAAG,EAAE,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAC7C,CAAC;AACJ,CAAC;AATD,4CASC;AAED,KAAK,UAAU,6BAA6B,CAC1C,OAAsB;IAEtB,IAAA,oBAAY,EAAC;QACX,UAAU,EAAE,uBAAuB;QACnC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;KAC3C,CAAC,CAAC;IAEH,MAAM,IAAA,yCAAiC,EAAC;QACtC,gBAAgB,EAAE,OAA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ACE,GAAG,EAAE;gCACH,MAAM,EAAE,GAAG;6BACZ;yBACF;qBACF;iBACF;aACF,CAAC;YAEF,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;SACzB;QAED,MAAM,IAAA,uCAAmB,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,MAAM,4BAA4B,GAAG,MAAM,IAAA,uCAA+B,GAAE,CAAC;IAE7E,MAAM,CAAC,MAAM,CAAC,0BAA0B,EAAE,4BAA4B,CAAC,CAAC;IAExE,IAAI,4BAA4B,EAAE;QAChC,MAAM,IAAA,qBAAS,EACb,0BAA0B,EAC1B,KAAK,IAAI,EAAE,CACT,MAAM,IAAA,0CAAsB,EAAC;YAC3B,GAAG,EAAE,SAAS;YACd,OAAO,EAAE,eAAe,CAAC,YAAY,CAAC,IAAI;YAC1C,SAAS,EAAE,eAAe,CAAC,EAAE;SAC9B,CAAC,CACL,CAAC;KACH;IAED,MAAM,IAAA,qBAAS,EAAC,cAAc,EAAE,KAAK,IAAI,EAAE;QACzC,MAAM,IAAA,8BAAsB,EAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,iBAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,SAAgB,iBAAiB,CAAC,uBAAgC;IAChE,IAAI,GAAG,GAAG,eAAK,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAE1E,IAAI,uBAAuB,EAAE;QAC3B,GAAG,IAAI,qEAAqE,eAAK,CAAC,IAAI,CACpF,UAAU,CACX,mDAAmD,CAAC;KACtD;IAED,GAAG,IAAI;4DACmD,CAAC;IAE3D,OAAO,GAAG,CAAC;AACb,CAAC;AAbD,8CAaC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\n\nimport chalk from 'chalk';\nimport type { WizardOptions } from '../utils/types';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n abortIfCancelled,\n askShouldCreateExampleComponent,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n printWelcome,\n runPrettierIfInstalled,\n abort,\n} from '../utils/clack';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { gte, minVersion, SemVer } from 'semver';\n\nimport * as Sentry from '@sentry/node';\nimport { initializeSentryOnApplicationEntry } from './sdk-setup';\nimport { updateAppConfig } from './sdk-setup';\nimport { runSourcemapsWizard } from '../sourcemaps/sourcemaps-wizard';\nimport { addSourcemapEntryToAngularJSON } from './codemods/sourcemaps';\nimport { createExampleComponent } from './example-component';\n\nconst MIN_SUPPORTED_ANGULAR_VERSION = '14.0.0';\nconst MIN_SUPPORTED_WIZARD_ANGULAR_VERSION = '17.0.0';\n\nexport async function runAngularWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'angular',\n wizardOptions: options,\n },\n () => runAngularWizardWithTelemetry(options),\n );\n}\n\nasync function runAngularWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Angular Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, '@angular/core', 'Angular');\n\n let installedAngularVersion = getPackageVersion('@angular/core', packageJson);\n\n if (!installedAngularVersion) {\n clack.log.warn('Could not determine installed Angular version.');\n\n installedAngularVersion = await abortIfCancelled(\n clack.text({\n message: `Please enter your installed Angular major version (e.g. ${chalk.cyan(\n '18',\n )} for Angular 18)`,\n validate(value) {\n if (!value) {\n return 'Angular version is required';\n }\n\n try {\n if (!minVersion(value)) {\n return `Invalid Angular version provided: ${value}`;\n }\n } catch (error) {\n return `Invalid Angular version provided: ${value}`;\n }\n },\n }),\n );\n }\n\n Sentry.setTag('angular-version', installedAngularVersion);\n\n const installedMinVersion = minVersion(installedAngularVersion) as SemVer;\n\n const sdkSupportsAngularVersion = gte(\n installedMinVersion,\n MIN_SUPPORTED_ANGULAR_VERSION,\n );\n\n const wizardSupportsAngularVersion = gte(\n installedMinVersion,\n MIN_SUPPORTED_WIZARD_ANGULAR_VERSION,\n );\n\n if (!sdkSupportsAngularVersion) {\n Sentry.setTag('angular-version-compatible', false);\n\n clack.log.warn(\n `Angular version ${chalk.cyan(\n MIN_SUPPORTED_ANGULAR_VERSION,\n )} or higher is required for the Sentry SDK.`,\n );\n clack.log.warn(\n `Please refer to Sentry's version compatibility table for more information:\n\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/angular/#angular-version-compatibility',\n)}\n`,\n );\n\n return abort('Exiting the wizard.', 0);\n }\n\n if (!wizardSupportsAngularVersion) {\n Sentry.setTag('angular-wizard-version-compatible', false);\n\n clack.log.warn(\n `The Sentry Angular Wizard requires Angular version ${chalk.cyan(\n MIN_SUPPORTED_WIZARD_ANGULAR_VERSION,\n )} or higher.`,\n );\n clack.log.warn(\n `Your Angular version (${installedAngularVersion}) is compatible with the Sentry SDK but you need to set it up manually by following our documentation:\n\n${chalk.underline('https://docs.sentry.io/platforms/javascript/guides/angular')}\n\nApologies for the inconvenience!`,\n );\n\n return abort('Exiting the wizard.', 0);\n }\n\n const { selectedProject, authToken, sentryUrl, selfHosted } =\n await getOrAskForProjectData(options, 'javascript-angular');\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/angular',\n packageJson,\n );\n\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n await installPackage({\n packageName: '@sentry/angular@^9',\n packageNameDisplayLabel: '@sentry/angular',\n alreadyInstalled: sdkAlreadyInstalled,\n });\n\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 'Sentry 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 await traceStep(\n 'Initialize Sentry on Angular application entry point',\n async () => {\n await initializeSentryOnApplicationEntry(dsn, selectedFeatures);\n },\n );\n\n await traceStep('Update Angular project configuration', async () => {\n await updateAppConfig(installedMinVersion, selectedFeatures.performance);\n });\n\n await traceStep('Setup for sourcemap uploads', async () => {\n await addSourcemapEntryToAngularJSON();\n\n if (!options.preSelectedProject) {\n options.preSelectedProject = {\n authToken,\n selfHosted,\n project: {\n organization: {\n id: selectedProject.organization.id,\n name: selectedProject.organization.name,\n slug: selectedProject.organization.slug,\n },\n id: selectedProject.id,\n slug: selectedProject.slug,\n keys: [\n {\n dsn: {\n public: dsn,\n },\n },\n ],\n },\n };\n\n options.url = sentryUrl;\n }\n\n await runSourcemapsWizard(options, 'angular');\n });\n\n const shouldCreateExampleComponent = await askShouldCreateExampleComponent();\n\n Sentry.setTag('create-example-component', shouldCreateExampleComponent);\n\n if (shouldCreateExampleComponent) {\n await traceStep(\n 'create-example-component',\n async () =>\n await createExampleComponent({\n url: sentryUrl,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n }),\n );\n }\n\n await traceStep('Run Prettier', async () => {\n await runPrettierIfInstalled({ cwd: undefined });\n });\n\n clack.outro(buildOutroMessage(shouldCreateExampleComponent));\n}\n\nexport function buildOutroMessage(createdExampleComponent: boolean): string {\n let msg = chalk.green('\\nSuccessfully installed the Sentry Angular SDK!');\n\n if (createdExampleComponent) {\n msg += `\\n\\nYou can validate your setup by starting your dev environment (${chalk.cyan(\n 'ng serve',\n )}) and throwing an error in the example component.`;\n }\n\n msg += `\\n\\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/javascript/guides/angular/`;\n\n return msg;\n}\n"]}
@@ -3,15 +3,18 @@ import { Proxified, type ProxifiedModule } from 'magicast';
3
3
  export declare function updateAppEntryMod(originalAppModuleMod: ProxifiedModule<any>, dsn: string, selectedFeatures: {
4
4
  performance: boolean;
5
5
  replay: boolean;
6
+ logs: boolean;
6
7
  }): ProxifiedModule<any>;
7
8
  export declare function insertInitCall(originalAppModuleMod: ProxifiedModule<any>, dsn: string, selectedFeatures: {
8
9
  performance: boolean;
9
10
  replay: boolean;
11
+ logs: boolean;
10
12
  }): void;
11
- type InitCallArgs = Record<string, string | number | Array<Proxified>>;
13
+ type InitCallArgs = Record<string, string | number | boolean | Array<Proxified>>;
12
14
  export declare function getInitCallArgs(dsn: string, selectedFeatures: {
13
15
  performance: boolean;
14
16
  replay: boolean;
17
+ logs: boolean;
15
18
  }): InitCallArgs;
16
19
  /**
17
20
  * We want to insert the handleError function just after all imports
@@ -44,6 +44,9 @@ function getInitCallArgs(dsn, selectedFeatures) {
44
44
  initCallArgs.replaysOnErrorSampleRate = 1.0;
45
45
  }
46
46
  }
47
+ if (selectedFeatures.logs) {
48
+ initCallArgs.enableLogs = true;
49
+ }
47
50
  return initCallArgs;
48
51
  }
49
52
  exports.getInitCallArgs = getInitCallArgs;
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../src/angular/codemods/main.ts"],"names":[],"mappings":";;;AAEA,uCAMkB;AAElB,SAAgB,iBAAiB;AAC/B,8DAA8D;AAC9D,oBAA0C,EAC1C,GAAW,EACX,gBAGC;IAGD,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC;QAChC,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,GAAG;QACb,KAAK,EAAE,QAAQ;KA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AG,CAAC;YAC5C,YAAY,CAAC,wBAAwB,GAAG,GAAG,CAAC;SAC7C;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAhCD,0CAgCC;AAED;;GAEG;AACH,SAAgB,6BAA6B,CAC3C,yBAAkC;IAElC,KAAK,IAAI,CAAC,GAAG,yBAAyB,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACnE,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAmB,EAAE;YAClE,OAAO,CAAC,GAAG,CAAC,CAAC;SACd;KACF;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAVD,sEAUC","sourcesContent":["import type { Program } from '@babel/types';\n\nimport {\n builders,\n generateCode,\n Proxified,\n type ProxifiedModule,\n // @ts-expect-error - magicast is ESM and TS complains about that. It works though\n} from 'magicast';\n\nexport function updateAppEntryMod(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalAppModuleMod: ProxifiedModule<any>,\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): ProxifiedModule<any> {\n originalAppModuleMod.imports.$add({\n from: '@sentry/angular',\n imported: '*',\n local: 'Sentry',\n });\n\n insertInitCall(originalAppModuleMod, dsn, selectedFeatures);\n\n return originalAppModuleMod;\n}\n\nexport function insertInitCall(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalAppModuleMod: ProxifiedModule<any>,\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n },\n): void {\n const initCallArgs = getInitCallArgs(dsn, selectedFeatures);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- builders return Proxified which defaults to any\n const initCall = builders.functionCall('Sentry.init', initCallArgs);\n const originalAppModuleModAst = originalAppModuleMod.$ast as Program;\n\n const initCallInsertionIndex = getAfterImportsInsertionIndex(\n originalAppModuleModAst,\n );\n\n originalAppModuleModAst.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 -- builders return Proxified which defaults to any.\n generateCode(initCall).code,\n );\n}\n\ntype InitCallArgs = Record<string, string | number | Array<Proxified>>;\n\nexport function getInitCallArgs(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n },\n): InitCallArgs {\n const initCallArgs: InitCallArgs = {\n dsn,\n };\n\n if (selectedFeatures.replay || selectedFeatures.performance) {\n initCallArgs.integrations = [];\n\n if (selectedFeatures.performance) {\n initCallArgs.integrations.push(\n builders.functionCall('Sentry.browserTracingIntegration'),\n );\n initCallArgs.tracesSampleRate = 1.0;\n }\n\n if (selectedFeatures.replay) {\n initCallArgs.integrations.push(\n builders.functionCall('Sentry.replayIntegration'),\n );\n\n initCallArgs.replaysSessionSampleRate = 0.1;\n initCallArgs.replaysOnErrorSampleRate = 1.0;\n }\n }\n\n return initCallArgs;\n}\n\n/**\n * We want to insert the handleError function just after all imports\n */\nexport function getAfterImportsInsertionIndex(\n originalEntryServerModAST: Program,\n): number {\n for (let x = originalEntryServerModAST.body.length - 1; x >= 0; x--) {\n if (originalEntryServerModAST.body[x].type === 'ImportDeclaration') {\n return x + 1;\n }\n }\n\n return 0;\n}\n"]}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../src/angular/codemods/main.ts"],"names":[],"mappings":";;;AAEA,uCAMkB;AAElB,SAAgB,iBAAiB;AAC/B,8DAA8D;AAC9D,oBAA0C,EAC1C,GAAW,EACX,gBAIC;IAGD,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC;QAChC,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,GAAG;QACb,KAAK,EAAE,QAAQ;KAChB,CAAC,CAAC;IAEH,cAAc,CAAC,oBAAoB,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAE5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,CAAC,IAAI,EAAE;QACzB,YAAY,CAAC,UAAU,GAAG,IAAI,CAAC;KAChC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AArCD,0CAqCC;AAED;;GAEG;AACH,SAAgB,6BAA6B,CAC3C,yBAAkC;IAElC,KAAK,IAAI,CAAC,GAAG,yBAAyB,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACnE,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAmB,EAAE;YAClE,OAAO,CAAC,GAAG,CAAC,CAAC;SACd;KACF;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAVD,sEAUC","sourcesContent":["import type { Program } from '@babel/types';\n\nimport {\n builders,\n generateCode,\n Proxified,\n type ProxifiedModule,\n // @ts-expect-error - magicast is ESM and TS complains about that. It works though\n} from 'magicast';\n\nexport function updateAppEntryMod(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalAppModuleMod: ProxifiedModule<any>,\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): ProxifiedModule<any> {\n originalAppModuleMod.imports.$add({\n from: '@sentry/angular',\n imported: '*',\n local: 'Sentry',\n });\n\n insertInitCall(originalAppModuleMod, dsn, selectedFeatures);\n\n return originalAppModuleMod;\n}\n\nexport function insertInitCall(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalAppModuleMod: ProxifiedModule<any>,\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): void {\n const initCallArgs = getInitCallArgs(dsn, selectedFeatures);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- builders return Proxified which defaults to any\n const initCall = builders.functionCall('Sentry.init', initCallArgs);\n const originalAppModuleModAst = originalAppModuleMod.$ast as Program;\n\n const initCallInsertionIndex = getAfterImportsInsertionIndex(\n originalAppModuleModAst,\n );\n\n originalAppModuleModAst.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 -- builders return Proxified which defaults to any.\n generateCode(initCall).code,\n );\n}\n\ntype InitCallArgs = Record<\n string,\n string | number | boolean | Array<Proxified>\n>;\n\nexport function getInitCallArgs(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): InitCallArgs {\n const initCallArgs: InitCallArgs = {\n dsn,\n };\n\n if (selectedFeatures.replay || selectedFeatures.performance) {\n initCallArgs.integrations = [];\n\n if (selectedFeatures.performance) {\n initCallArgs.integrations.push(\n builders.functionCall('Sentry.browserTracingIntegration'),\n );\n initCallArgs.tracesSampleRate = 1.0;\n }\n\n if (selectedFeatures.replay) {\n initCallArgs.integrations.push(\n builders.functionCall('Sentry.replayIntegration'),\n );\n\n initCallArgs.replaysSessionSampleRate = 0.1;\n initCallArgs.replaysOnErrorSampleRate = 1.0;\n }\n }\n\n if (selectedFeatures.logs) {\n initCallArgs.enableLogs = true;\n }\n\n return initCallArgs;\n}\n\n/**\n * We want to insert the handleError function just after all imports\n */\nexport function getAfterImportsInsertionIndex(\n originalEntryServerModAST: Program,\n): number {\n for (let x = originalEntryServerModAST.body.length - 1; x >= 0; x--) {\n if (originalEntryServerModAST.body[x].type === 'ImportDeclaration') {\n return x + 1;\n }\n }\n\n return 0;\n}\n"]}
@@ -2,5 +2,6 @@ import type { SemVer } from 'semver';
2
2
  export declare function initializeSentryOnApplicationEntry(dsn: string, selectedFeatures: {
3
3
  performance: boolean;
4
4
  replay: boolean;
5
+ logs: boolean;
5
6
  }): Promise<void>;
6
7
  export declare function updateAppConfig(angularVersion: SemVer, isTracingEnabled: boolean): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/angular/sdk-setup.ts"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,GAAG,CAAC,KAAK,CACb,wCAAwC,eAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CACzE,CAAC;QAEF,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,eAAK,CAAC,GAAG,CACP,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,IAAI,UAAU,IAAI,KAAK;YAC/D,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE;YAClB,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ;gBAC3B,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,EAAE,CACP,CACF,CAAC;QAEF,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC;EACjB,eAAK,CAAC,SAAS,CACf,uEAAuE,CACxE,EAAE,CAAC,CAAC;QAED,OAAO;KACR;IAED,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,wCAAwC,eAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CACxE,CAAC;AACJ,CAAC;AA5ED,0CA4EC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { loadFile, writeFile } from 'magicast';\n\nimport * as fs from 'fs';\nimport * as path from 'path';\n\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { updateAppConfigMod } from './codemods/app-config';\nimport { updateAppEntryMod } from './codemods/main';\nimport { hasSentryContent } from '../utils/ast-utils';\nimport * as Sentry from '@sentry/node';\n\nimport type { namedTypes as t } from 'ast-types';\nimport type { SemVer } from 'semver';\n\nexport async function initializeSentryOnApplicationEntry(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n },\n): Promise<void> {\n const appEntryFilename = 'main.ts';\n const appEntryPath = path.join(process.cwd(), 'src', appEntryFilename);\n\n const originalAppEntry = await loadFile(appEntryPath);\n\n if (hasSentryContent(originalAppEntry.$ast as t.Program)) {\n clack.log.warn(\n `File ${chalk.cyan(appEntryFilename)} already contains Sentry.\nSkipping adding Sentry functionality to ${chalk.cyan(appEntryFilename)}.`,\n );\n\n return;\n }\n\n const updatedAppEntryMod = updateAppEntryMod(\n originalAppEntry,\n dsn,\n selectedFeatures,\n );\n\n try {\n await writeFile(updatedAppEntryMod.$ast, appEntryPath);\n } catch (error: unknown) {\n clack.log.error(\n `Error while adding Sentry to ${chalk.cyan(appEntryFilename)}`,\n );\n\n clack.log.warn(\n `Please refer to the documentation for manual setup:\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/angular/#configure',\n)}`,\n );\n\n return;\n }\n\n clack.log.success(\n `Successfully initialized Sentry on ${chalk.cyan(appEntryFilename)}`,\n );\n}\n\nexport async function updateAppConfig(\n angularVersion: SemVer,\n isTracingEnabled: boolean,\n): Promise<void> {\n const appConfigFilename = 'app.config.ts';\n const appConfigPath = path.join(\n process.cwd(),\n 'src',\n 'app',\n appConfigFilename,\n );\n\n if (!fs.existsSync(appConfigPath)) {\n Sentry.setTag('angular-app-config-found', false);\n\n clack.log.warn(\n `File ${chalk.cyan(\n appConfigFilename,\n )} not found. Skipping adding Sentry functionality.`,\n );\n\n clack.log.warn(`Please refer to the documentation for manual setup:\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/angular/#configure',\n)}`);\n\n return;\n }\n\n Sentry.setTag('angular-app-config-found', true);\n\n const appConfig = await loadFile(appConfigPath);\n\n if (hasSentryContent(appConfig.$ast as t.Program)) {\n clack.log.warn(\n `File ${chalk.cyan(appConfigFilename)} already contains Sentry.\n Skipping adding Sentry functionality to ${chalk.cyan(appConfigFilename)}.`,\n );\n\n return;\n }\n\n try {\n const updatedAppConfigMod = updateAppConfigMod(\n appConfig,\n angularVersion,\n isTracingEnabled,\n );\n\n await writeFile(updatedAppConfigMod.$ast, appConfigPath);\n } catch (error: unknown) {\n clack.log.error(\n `Error while updating your app config ${chalk.cyan(appConfigFilename)}.`,\n );\n\n clack.log.info(\n chalk.dim(\n typeof error === 'object' && error != null && 'toString' in error\n ? error.toString()\n : typeof error === 'string'\n ? error\n : '',\n ),\n );\n\n clack.log.warn(`Please refer to the documentation for manual setup:\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/angular/#configure',\n)}`);\n\n return;\n }\n\n clack.log.success(\n `Successfully updated your app config ${chalk.cyan(appConfigFilename)}`,\n );\n}\n"]}
1
+ {"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/angular/sdk-setup.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE5D,kFAAkF;AAClF,uCAA+C;AAE/C,uCAAyB;AACzB,2CAA6B;AAE7B,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAC1B,sDAA2D;AAC3D,0CAAoD;AACpD,kDAAsD;AACtD,qDAAuC;AAKhC,KAAK,UAAU,kCAAkC,CACtD,GAAW,EACX,gBAIC;IAED,MAAM,gBAAgB,GAAG,SAAS,CAAC;IACnC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC;IAEvE,MAAM,gBAAgB,GAAG,MAAM,IAAA,mBAAQ,EAAC,YAAY,CAAC,CAAC;IAEtD,IAAI,IAAA,4BAAgB,EAAC,gBAAgB,CAAC,IAAiB,CAAC,EAAE;QACxD,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,QAAQ,eAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC;0CACA,eAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CACpE,CAAC;QAEF,OAAO;KACR;IAED,MAAM,kBAAkB,GAAG,IAAA,wBAAiB,EAC1C,gBAAgB,EAChB,GAAG,EACH,gBAAgB,CACjB,CAAC;IAEF,IAAI;QACF,MAAM,IAAA,oBAAS,EAAC,kBAAkB,CAAC,IAAI,EAAE,YAAY,C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I,CAAC,iBAAiB,CAAC;4CACC,eAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CACvE,CAAC;QAEF,OAAO;KACR;IAED,IAAI;QACF,MAAM,mBAAmB,GAAG,IAAA,+BAAkB,EAC5C,SAAS,EACT,cAAc,EACd,gBAAgB,CACjB,CAAC;QAEF,MAAM,IAAA,oBAAS,EAAC,mBAAmB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;KAC1D;IAAC,OAAO,KAAc,EAAE;QACvB,iBAAK,CAAC,GAAG,CAAC,KAAK,CACb,wCAAwC,eAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CACzE,CAAC;QAEF,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,eAAK,CAAC,GAAG,CACP,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,IAAI,UAAU,IAAI,KAAK;YAC/D,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE;YAClB,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ;gBAC3B,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,EAAE,CACP,CACF,CAAC;QAEF,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC;EACjB,eAAK,CAAC,SAAS,CACf,uEAAuE,CACxE,EAAE,CAAC,CAAC;QAED,OAAO;KACR;IAED,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,wCAAwC,eAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CACxE,CAAC;AACJ,CAAC;AA5ED,0CA4EC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { loadFile, writeFile } from 'magicast';\n\nimport * as fs from 'fs';\nimport * as path from 'path';\n\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { updateAppConfigMod } from './codemods/app-config';\nimport { updateAppEntryMod } from './codemods/main';\nimport { hasSentryContent } from '../utils/ast-utils';\nimport * as Sentry from '@sentry/node';\n\nimport type { namedTypes as t } from 'ast-types';\nimport type { SemVer } from 'semver';\n\nexport async function initializeSentryOnApplicationEntry(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): Promise<void> {\n const appEntryFilename = 'main.ts';\n const appEntryPath = path.join(process.cwd(), 'src', appEntryFilename);\n\n const originalAppEntry = await loadFile(appEntryPath);\n\n if (hasSentryContent(originalAppEntry.$ast as t.Program)) {\n clack.log.warn(\n `File ${chalk.cyan(appEntryFilename)} already contains Sentry.\nSkipping adding Sentry functionality to ${chalk.cyan(appEntryFilename)}.`,\n );\n\n return;\n }\n\n const updatedAppEntryMod = updateAppEntryMod(\n originalAppEntry,\n dsn,\n selectedFeatures,\n );\n\n try {\n await writeFile(updatedAppEntryMod.$ast, appEntryPath);\n } catch (error: unknown) {\n clack.log.error(\n `Error while adding Sentry to ${chalk.cyan(appEntryFilename)}`,\n );\n\n clack.log.warn(\n `Please refer to the documentation for manual setup:\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/angular/#configure',\n)}`,\n );\n\n return;\n }\n\n clack.log.success(\n `Successfully initialized Sentry on ${chalk.cyan(appEntryFilename)}`,\n );\n}\n\nexport async function updateAppConfig(\n angularVersion: SemVer,\n isTracingEnabled: boolean,\n): Promise<void> {\n const appConfigFilename = 'app.config.ts';\n const appConfigPath = path.join(\n process.cwd(),\n 'src',\n 'app',\n appConfigFilename,\n );\n\n if (!fs.existsSync(appConfigPath)) {\n Sentry.setTag('angular-app-config-found', false);\n\n clack.log.warn(\n `File ${chalk.cyan(\n appConfigFilename,\n )} not found. Skipping adding Sentry functionality.`,\n );\n\n clack.log.warn(`Please refer to the documentation for manual setup:\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/angular/#configure',\n)}`);\n\n return;\n }\n\n Sentry.setTag('angular-app-config-found', true);\n\n const appConfig = await loadFile(appConfigPath);\n\n if (hasSentryContent(appConfig.$ast as t.Program)) {\n clack.log.warn(\n `File ${chalk.cyan(appConfigFilename)} already contains Sentry.\n Skipping adding Sentry functionality to ${chalk.cyan(appConfigFilename)}.`,\n );\n\n return;\n }\n\n try {\n const updatedAppConfigMod = updateAppConfigMod(\n appConfig,\n angularVersion,\n isTracingEnabled,\n );\n\n await writeFile(updatedAppConfigMod.$ast, appConfigPath);\n } catch (error: unknown) {\n clack.log.error(\n `Error while updating your app config ${chalk.cyan(appConfigFilename)}.`,\n );\n\n clack.log.info(\n chalk.dim(\n typeof error === 'object' && error != null && 'toString' in error\n ? error.toString()\n : typeof error === 'string'\n ? error\n : '',\n ),\n );\n\n clack.log.warn(`Please refer to the documentation for manual setup:\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/angular/#configure',\n)}`);\n\n return;\n }\n\n clack.log.success(\n `Successfully updated your app config ${chalk.cyan(appConfigFilename)}`,\n );\n}\n"]}
@@ -4,9 +4,24 @@ exports.getFastlaneSnippet = exports.getObjcSnippet = exports.getSwiftSnippet =
4
4
  function getRunScriptTemplate(orgSlug, projectSlug, uploadSource, includeHomebrewPath) {
5
5
  // eslint-disable-next-line no-useless-escape
6
6
  const includeHomebrew = includeHomebrewPath
7
- ? '\\nif [[ "$(uname -m)" == arm64 ]]; then\\nexport PATH="/opt/homebrew/bin:$PATH"\\nfi'
7
+ ? `
8
+ if [[ "$(uname -m)" == arm64 ]]; then
9
+ export PATH="/opt/homebrew/bin:$PATH"
10
+ fi
11
+ `
8
12
  : '';
9
- return `# This script is responsible for uploading debug symbols and source context for Sentry.${includeHomebrew}\\nif which sentry-cli >/dev/null; then\\nexport SENTRY_ORG=${orgSlug}\\nexport SENTRY_PROJECT=${projectSlug}\\nERROR=$(sentry-cli debug-files upload ${uploadSource ? '--include-sources ' : ''}"$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)\\nif [ ! $? -eq 0 ]; then\\necho "warning: sentry-cli - $ERROR"\\nfi\\nelse\\necho "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"\\nfi\\n`;
13
+ return `# This script is responsible for uploading debug symbols and source context for Sentry.${includeHomebrew}
14
+ if which sentry-cli >/dev/null; then
15
+ export SENTRY_ORG=${orgSlug}
16
+ export SENTRY_PROJECT=${projectSlug}
17
+ ERROR=$(sentry-cli debug-files upload ${uploadSource ? '--include-sources ' : ''}"$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
18
+ if [ ! $? -eq 0 ]; then
19
+ echo "warning: sentry-cli - $ERROR"
20
+ fi
21
+ else
22
+ echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
23
+ fi
24
+ `;
10
25
  }
11
26
  exports.getRunScriptTemplate = getRunScriptTemplate;
12
27
  exports.scriptInputPath = '"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}"';
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/apple/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,oBAAoB,CAClC,OAAe,EACf,WAAmB,EACnB,YAAqB,EACrB,mBAA4B;IAE5B,6CAA6C;IAC7C,MAAM,eAAe,GAAG,mBAAmB;QACzC,CAAC,CAAC,uFAAuF;QACzF,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,0FAA0F,eAAe,+DAA+D,OAAO,4BAA4B,WAAW,4CAC3N,YAAY,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EACxC,2OAA2O,CAAC;AAC9O,CAAC;AAbD,oDAaC;AAEY,QAAA,eAAe,GAC1B,6FAA6F,CAAC;AAEhG,SAAgB,eAAe,CAAC,GAAW;IACzC,OAAO;6BACoB,GAAG;;;;;;;;;;;;;;;;;;;;;;iEAsBiC,CAAC;AAClE,CAAC;AAzBD,0CAyBC;AAED,SAAgB,cAAc,CAAC,GAAW;IACxC,OAAO;0BACiB,GAAG;;;;;;;;;;;;;;;;;;;;;;2DAsB8B,CAAC;AAC5D,CAAC;AAzBD,wCAyBC;AAED,SAAgB,kBAAkB,CAAC,GAAW,EAAE,OAAe;IAC7D,OAAO;mBACU,GAAG;uBACC,OAAO;;MAExB,CAAC;AACP,CAAC;AAND,gDAMC","sourcesContent":["export function getRunScriptTemplate(\n orgSlug: string,\n projectSlug: string,\n uploadSource: boolean,\n includeHomebrewPath: boolean,\n): string {\n // eslint-disable-next-line no-useless-escape\n const includeHomebrew = includeHomebrewPath\n ? '\\\\nif [[ \"$(uname -m)\" == arm64 ]]; then\\\\nexport PATH=\"/opt/homebrew/bin:$PATH\"\\\\nfi'\n : '';\n return `# This script is responsible for uploading debug symbols and source context for Sentry.${includeHomebrew}\\\\nif which sentry-cli >/dev/null; then\\\\nexport SENTRY_ORG=${orgSlug}\\\\nexport SENTRY_PROJECT=${projectSlug}\\\\nERROR=$(sentry-cli debug-files upload ${\n uploadSource ? '--include-sources ' : ''\n }\"$DWARF_DSYM_FOLDER_PATH\" 2>&1 >/dev/null)\\\\nif [ ! $? -eq 0 ]; then\\\\necho \"warning: sentry-cli - $ERROR\"\\\\nfi\\\\nelse\\\\necho \"warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases\"\\\\nfi\\\\n`;\n}\n\nexport const scriptInputPath =\n '\"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}\"';\n\nexport function getSwiftSnippet(dsn: string): string {\n return ` SentrySDK.start { options in\n options.dsn = \"${dsn}\"\n options.debug = true // Enabled debug when first installing is always helpful\n\n // Adds IP for users.\n // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/\n options.sendDefaultPii = true\n\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n\n // Configure profiling. Visit https://docs.sentry.io/platforms/apple/profiling/ to learn more.\n options.configureProfiling = {\n $0.sessionSampleRate = 1.0 // We recommend adjusting this value in production.\n $0.lifecycle = .trace\n }\n\n // Uncomment the following lines to add more data to your events\n // options.attachScreenshot = true // This adds a screenshot to the error events\n // options.attachViewHierarchy = true // This adds the view hierarchy to the error events\n }\n // Remove the next line after confirming that your Sentry integration is working.\n SentrySDK.capture(message: \"This app uses Sentry! :)\")\\n`;\n}\n\nexport function getObjcSnippet(dsn: string): string {\n return ` [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {\n options.dsn = @\"${dsn}\";\n options.debug = YES; // Enabled debug when first installing is always helpful\n\n // Adds IP for users.\n // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/\n options.sendDefaultPii = YES;\n\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = @1.0;\n\n // Configure profiling. Visit https://docs.sentry.io/platforms/apple/profiling/ to learn more.\n options.configureProfiling = ^(SentryProfileOptions *profiling) {\n profiling.sessionSampleRate = 1.0; // We recommend adjusting this value in production.\n profiling.lifecycle = SentryProfilingLifecycleTrace;\n };\n\n //Uncomment the following lines to add more data to your events\n //options.attachScreenshot = YES; //This will add a screenshot to the error events\n //options.attachViewHierarchy = YES; //This will add the view hierarchy to the error events\n }];\n //Remove the next line after confirming that your Sentry integration is working.\n [SentrySDK captureMessage:@\"This app uses Sentry!\"];\\n`;\n}\n\nexport function getFastlaneSnippet(org: string, project: string): string {\n return ` sentry_cli(\n org_slug: '${org}',\n project_slug: '${project}',\n include_sources: true\n )`;\n}\n"]}
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/apple/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,oBAAoB,CAClC,OAAe,EACf,WAAmB,EACnB,YAAqB,EACrB,mBAA4B;IAE5B,6CAA6C;IAC7C,MAAM,eAAe,GAAG,mBAAmB;QACzC,CAAC,CAAC;;;;CAIL;QACG,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,0FAA0F,eAAe;;sBAE5F,OAAO;0BACH,WAAW;0CAEjC,YAAY,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EACxC;;;;;;;CAOD,CAAC;AACF,CAAC;AA5BD,oDA4BC;AAEY,QAAA,eAAe,GAC1B,6FAA6F,CAAC;AAEhG,SAAgB,eAAe,CAAC,GAAW;IACzC,OAAO;6BACoB,GAAG;;;;;;;;;;;;;;;;;;;;;;iEAsBiC,CAAC;AAClE,CAAC;AAzBD,0CAyBC;AAED,SAAgB,cAAc,CAAC,GAAW;IACxC,OAAO;0BACiB,GAAG;;;;;;;;;;;;;;;;;;;;;;2DAsB8B,CAAC;AAC5D,CAAC;AAzBD,wCAyBC;AAED,SAAgB,kBAAkB,CAAC,GAAW,EAAE,OAAe;IAC7D,OAAO;mBACU,GAAG;uBACC,OAAO;;MAExB,CAAC;AACP,CAAC;AAND,gDAMC","sourcesContent":["export function getRunScriptTemplate(\n orgSlug: string,\n projectSlug: string,\n uploadSource: boolean,\n includeHomebrewPath: boolean,\n): string {\n // eslint-disable-next-line no-useless-escape\n const includeHomebrew = includeHomebrewPath\n ? `\nif [[ \"$(uname -m)\" == arm64 ]]; then\n export PATH=\"/opt/homebrew/bin:$PATH\"\nfi\n`\n : '';\n return `# This script is responsible for uploading debug symbols and source context for Sentry.${includeHomebrew}\nif which sentry-cli >/dev/null; then\n export SENTRY_ORG=${orgSlug}\n export SENTRY_PROJECT=${projectSlug}\n ERROR=$(sentry-cli debug-files upload ${\n uploadSource ? '--include-sources ' : ''\n }\"$DWARF_DSYM_FOLDER_PATH\" 2>&1 >/dev/null)\n if [ ! $? -eq 0 ]; then\n echo \"warning: sentry-cli - $ERROR\"\n fi\nelse\n echo \"warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases\"\nfi\n`;\n}\n\nexport const scriptInputPath =\n '\"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}\"';\n\nexport function getSwiftSnippet(dsn: string): string {\n return ` SentrySDK.start { options in\n options.dsn = \"${dsn}\"\n options.debug = true // Enabled debug when first installing is always helpful\n\n // Adds IP for users.\n // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/\n options.sendDefaultPii = true\n\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n\n // Configure profiling. Visit https://docs.sentry.io/platforms/apple/profiling/ to learn more.\n options.configureProfiling = {\n $0.sessionSampleRate = 1.0 // We recommend adjusting this value in production.\n $0.lifecycle = .trace\n }\n\n // Uncomment the following lines to add more data to your events\n // options.attachScreenshot = true // This adds a screenshot to the error events\n // options.attachViewHierarchy = true // This adds the view hierarchy to the error events\n }\n // Remove the next line after confirming that your Sentry integration is working.\n SentrySDK.capture(message: \"This app uses Sentry! :)\")\\n`;\n}\n\nexport function getObjcSnippet(dsn: string): string {\n return ` [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {\n options.dsn = @\"${dsn}\";\n options.debug = YES; // Enabled debug when first installing is always helpful\n\n // Adds IP for users.\n // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/\n options.sendDefaultPii = YES;\n\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = @1.0;\n\n // Configure profiling. Visit https://docs.sentry.io/platforms/apple/profiling/ to learn more.\n options.configureProfiling = ^(SentryProfileOptions *profiling) {\n profiling.sessionSampleRate = 1.0; // We recommend adjusting this value in production.\n profiling.lifecycle = SentryProfilingLifecycleTrace;\n };\n\n //Uncomment the following lines to add more data to your events\n //options.attachScreenshot = YES; //This will add a screenshot to the error events\n //options.attachViewHierarchy = YES; //This will add the view hierarchy to the error events\n }];\n //Remove the next line after confirming that your Sentry integration is working.\n [SentrySDK captureMessage:@\"This app uses Sentry!\"];\\n`;\n}\n\nexport function getFastlaneSnippet(org: string, project: string): string {\n return ` sentry_cli(\n org_slug: '${org}',\n project_slug: '${project}',\n include_sources: true\n )`;\n}\n"]}
@@ -27,6 +27,11 @@ export declare class XcodeProject {
27
27
  constructor(projectPath: string);
28
28
  getAllTargets(): string[];
29
29
  updateXcodeProject(sentryProject: SentryProjectData, target: string, addSPMReference: boolean, uploadSource?: boolean): void;
30
+ addUploadSymbolsScript({ sentryProject, targetName, uploadSource, }: {
31
+ sentryProject: SentryProjectData;
32
+ targetName: string;
33
+ uploadSource: boolean;
34
+ }): void;
30
35
  /**
31
36
  * Retrieves all source files associated with a specific target in the Xcode project.
32
37
  * This is used to find files where we can inject Sentry initialization code.
@@ -49,6 +54,24 @@ export declare class XcodeProject {
49
54
  * @returns The source build phase, or undefined if the target is not found or has no source build phase
50
55
  */
51
56
  findSourceBuildPhaseInTarget(target: PBXNativeTarget): XcodeProjectObjectWithId<PBXSourcesBuildPhase> | undefined;
57
+ /**
58
+ * Adds a new script build phase to the specified target.
59
+ *
60
+ * @param targetKey - The key of the target to add the build phase to
61
+ * @param name - The name of the build phase
62
+ * @param script - The shell script content
63
+ * @param inputPaths - Array of input paths for the script
64
+ * @returns The UUID of the created build phase
65
+ */
66
+ addScriptBuildPhase(targetKey: string, name: string, script: string, inputPaths?: string[]): string;
67
+ /**
68
+ * Updates an existing script build phase.
69
+ *
70
+ * @param buildPhaseId - The UUID of the build phase to update
71
+ * @param script - The new shell script content
72
+ * @param inputPaths - Array of input paths for the script
73
+ */
74
+ updateScriptBuildPhase(buildPhaseId: string, script: string, inputPaths?: string[]): void;
52
75
  /**
53
76
  * Finds all files in the source build phase of a target.
54
77
  *