@sentry/wizard 6.1.2 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/e2e-tests/tests/angular-17.test.js +5 -0
  3. package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
  4. package/dist/e2e-tests/tests/angular-19.test.js +5 -0
  5. package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
  6. package/dist/e2e-tests/tests/expo.test.js +9 -2
  7. package/dist/e2e-tests/tests/expo.test.js.map +1 -1
  8. package/dist/e2e-tests/tests/flutter.test.js +32 -4
  9. package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
  10. package/dist/e2e-tests/tests/nextjs-14.test.js +4 -3
  11. package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
  12. package/dist/e2e-tests/tests/nextjs-15.test.js +17 -4
  13. package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
  14. package/dist/e2e-tests/tests/nuxt-3.test.js +9 -2
  15. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  16. package/dist/e2e-tests/tests/nuxt-4.test.js +9 -2
  17. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  18. package/dist/e2e-tests/tests/react-native.test.js +8 -1
  19. package/dist/e2e-tests/tests/react-native.test.js.map +1 -1
  20. package/dist/e2e-tests/tests/remix.test.js +19 -4
  21. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  22. package/dist/e2e-tests/tests/sveltekit.test.js +16 -2
  23. package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
  24. package/dist/lib/Steps/Integrations/Electron.js +4 -0
  25. package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
  26. package/dist/src/android/android-wizard.js +3 -0
  27. package/dist/src/android/android-wizard.js.map +1 -1
  28. package/dist/src/angular/angular-wizard.js +3 -0
  29. package/dist/src/angular/angular-wizard.js.map +1 -1
  30. package/dist/src/apple/apple-wizard.js +13 -0
  31. package/dist/src/apple/apple-wizard.js.map +1 -1
  32. package/dist/src/apple/code-tools.d.ts +1 -1
  33. package/dist/src/apple/code-tools.js +3 -3
  34. package/dist/src/apple/code-tools.js.map +1 -1
  35. package/dist/src/apple/inject-code-snippet.d.ts +2 -1
  36. package/dist/src/apple/inject-code-snippet.js +2 -2
  37. package/dist/src/apple/inject-code-snippet.js.map +1 -1
  38. package/dist/src/apple/templates.d.ts +2 -2
  39. package/dist/src/apple/templates.js +22 -6
  40. package/dist/src/apple/templates.js.map +1 -1
  41. package/dist/src/flutter/code-tools.d.ts +1 -0
  42. package/dist/src/flutter/code-tools.js +6 -0
  43. package/dist/src/flutter/code-tools.js.map +1 -1
  44. package/dist/src/flutter/flutter-wizard.js +3 -0
  45. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  46. package/dist/src/flutter/templates.d.ts +1 -0
  47. package/dist/src/flutter/templates.js +5 -0
  48. package/dist/src/flutter/templates.js.map +1 -1
  49. package/dist/src/nextjs/nextjs-wizard.js +14 -7
  50. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  51. package/dist/src/nextjs/utils.d.ts +8 -0
  52. package/dist/src/nextjs/utils.js +36 -1
  53. package/dist/src/nextjs/utils.js.map +1 -1
  54. package/dist/src/nuxt/nuxt-wizard.js +3 -0
  55. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  56. package/dist/src/react-native/expo-metro.d.ts +2 -2
  57. package/dist/src/react-native/expo-metro.js +32 -27
  58. package/dist/src/react-native/expo-metro.js.map +1 -1
  59. package/dist/src/react-native/metro.d.ts +4 -4
  60. package/dist/src/react-native/metro.js +39 -17
  61. package/dist/src/react-native/metro.js.map +1 -1
  62. package/dist/src/react-native/react-native-wizard.js +3 -0
  63. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  64. package/dist/src/remix/codemods/root.d.ts +1 -0
  65. package/dist/src/remix/codemods/root.js +30 -2
  66. package/dist/src/remix/codemods/root.js.map +1 -1
  67. package/dist/src/remix/remix-wizard.d.ts +4 -0
  68. package/dist/src/remix/remix-wizard.js +7 -0
  69. package/dist/src/remix/remix-wizard.js.map +1 -1
  70. package/dist/src/sveltekit/sveltekit-wizard.js +3 -0
  71. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  72. package/dist/src/utils/clack/mcp-config.d.ts +7 -0
  73. package/dist/src/utils/clack/mcp-config.js +427 -0
  74. package/dist/src/utils/clack/mcp-config.js.map +1 -0
  75. package/dist/src/version.d.ts +1 -1
  76. package/dist/src/version.js +1 -1
  77. package/dist/src/version.js.map +1 -1
  78. package/dist/test/angular/angular-wizard.test.js +3 -0
  79. package/dist/test/angular/angular-wizard.test.js.map +1 -1
  80. package/dist/test/apple/code-tools.test.js +62 -14
  81. package/dist/test/apple/code-tools.test.js.map +1 -1
  82. package/dist/test/apple/templates.test.js +71 -2
  83. package/dist/test/apple/templates.test.js.map +1 -1
  84. package/dist/test/flutter/code-tools.test.js +1 -0
  85. package/dist/test/flutter/code-tools.test.js.map +1 -1
  86. package/dist/test/flutter/templates.test.js +31 -1
  87. package/dist/test/flutter/templates.test.js.map +1 -1
  88. package/dist/test/nextjs/wizard-double-wrap-prevention.test.d.ts +1 -0
  89. package/dist/test/nextjs/wizard-double-wrap-prevention.test.js +269 -0
  90. package/dist/test/nextjs/wizard-double-wrap-prevention.test.js.map +1 -0
  91. package/dist/test/nuxt/templates.test.js +3 -0
  92. package/dist/test/nuxt/templates.test.js.map +1 -1
  93. package/dist/test/react-native/expo-metro.test.js +3 -3
  94. package/dist/test/react-native/expo-metro.test.js.map +1 -1
  95. package/dist/test/react-native/metro.test.js +76 -15
  96. package/dist/test/react-native/metro.test.js.map +1 -1
  97. package/dist/test/remix/root.test.js +229 -0
  98. package/dist/test/remix/root.test.js.map +1 -1
  99. package/dist/test/sveltekit/templates.test.js +3 -0
  100. package/dist/test/sveltekit/templates.test.js.map +1 -1
  101. package/dist/test/utils/clack/mcp-config.test.d.ts +1 -0
  102. package/dist/test/utils/clack/mcp-config.test.js +520 -0
  103. package/dist/test/utils/clack/mcp-config.test.js.map +1 -0
  104. package/package.json +1 -9
@@ -40,6 +40,7 @@ const sourcemaps_wizard_1 = require("../sourcemaps/sourcemaps-wizard");
40
40
  const telemetry_1 = require("../telemetry");
41
41
  const clack_1 = require("../utils/clack");
42
42
  const package_json_1 = require("../utils/package-json");
43
+ const mcp_config_1 = require("../utils/clack/mcp-config");
43
44
  const templates_1 = require("./templates");
44
45
  const utils_1 = require("./utils");
45
46
  function runNextjsWizard(options) {
@@ -224,6 +225,8 @@ async function runNextjsWizardWithTelemetry(options) {
224
225
  }
225
226
  const packageManagerForOutro = packageManagerFromInstallStep ?? (await (0, clack_1.getPackageManager)());
226
227
  await (0, clack_1.runPrettierIfInstalled)({ cwd: undefined });
228
+ // Offer optional project-scoped MCP config for Sentry with org and project scope
229
+ await (0, mcp_config_1.offerProjectScopedMcpConfig)(selectedProject.organization.slug, selectedProject.slug);
227
230
  prompts_1.default.outro(`
228
231
  ${chalk_1.default.green('Successfully installed the Sentry Next.js SDK!')} ${shouldCreateExamplePage
229
232
  ? `\n\nYou can validate your setup by (re)starting your dev environment (e.g. ${chalk_1.default.cyan(`${packageManagerForOutro.runScriptCommand} dev`)}) and visiting ${chalk_1.default.cyan('"/sentry-example-page"')}`
@@ -512,19 +515,23 @@ async function createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl,
512
515
  imported: 'withSentryConfig',
513
516
  local: 'withSentryConfig',
514
517
  });
515
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
516
- const expressionToWrap = (0, magicast_1.generateCode)(mod.exports.default.$ast).code;
518
+ if (probablyIncludesSdk) {
519
+ // Prevent double wrapping like: withSentryConfig(withSentryConfig(nextConfig), { ... })
520
+ // Use AST manipulation instead of string parsing for better reliability
521
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
522
+ mod.exports.default.$ast = (0, utils_1.unwrapSentryConfigAst)(
523
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
524
+ mod.exports.default.$ast);
525
+ }
526
+ // Use the shared utility function for wrapping
517
527
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
518
- mod.exports.default = magicast_1.builders.raw(`withSentryConfig(
519
- ${expressionToWrap},
520
- ${withSentryConfigOptionsTemplate}
521
- )`);
528
+ mod.exports.default = (0, utils_1.wrapWithSentryConfig)(mod.exports.default, withSentryConfigOptionsTemplate);
522
529
  const newCode = mod.generate().code;
523
530
  await fs.promises.writeFile(path.join(process.cwd(), foundNextConfigFileFilename), newCode, {
524
531
  encoding: 'utf8',
525
532
  flag: 'w',
526
533
  });
527
- prompts_1.default.log.success(`Added Sentry configuration to ${chalk_1.default.cyan(foundNextConfigFileFilename)}. ${chalk_1.default.dim('(you probably want to clean this up a bit!)')}`);
534
+ prompts_1.default.log.success(`${probablyIncludesSdk ? 'Updated' : 'Added'} Sentry configuration ${probablyIncludesSdk ? 'in' : 'to'} ${chalk_1.default.cyan(foundNextConfigFileFilename)}. ${chalk_1.default.dim('(you probably want to clean this up a bit!)')}`);
528
535
  Sentry.setTag('next-config-mod-result', 'success');
529
536
  }
530
537
  }
@@ -1 +1 @@
1
- {"version":3,"file":"nextjs-wizard.js","sourceRoot":"","sources":["../../../src/nextjs/nextjs-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAC1B,uCAAyB;AACzB,kFAAkF;AAClF,uCAA+D;AAC/D,2CAA6B;AAE7B,qDAAuC;AAEvC,uEAA0D;AAC1D,4CAAwD;AACxD,0CAiBwB;AACxB,wDAA+E;AAE/E,2CAsBqB;AACrB,mCAIiB;AAEjB,SAAgB,eAAe,CAAC,OAAsB;IACpD,OAAO,IAAA,yBAA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,IAAI,EAAE,YAAY,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAAC;QACxD,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAAC;QAEnD,OAAO,oBAAoB,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,6BAA6B;IAC1C,IAAI,kBAA0B,CAAC;IAC/B,IAAI;QACF,kBAAkB,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAC7C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,EACxC,MAAM,CACP,CAAC;KACH;IAAC,MAAM;QACN,OAAO,IAAI,CAAC;KACb;IAED,OAAO,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAChD,CAAC","sourcesContent":["/* eslint-disable max-lines */\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 * as fs from 'fs';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { builders, generateCode, parseModule } from 'magicast';\nimport * as path from 'path';\n\nimport * as Sentry from '@sentry/node';\n\nimport { setupCI } from '../sourcemaps/sourcemaps-wizard';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n abort,\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n createNewConfigFile,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n getPackageManager,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n runPrettierIfInstalled,\n showCopyPasteInstructions,\n} from '../utils/clack';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport type { SentryProjectData, WizardOptions } from '../utils/types';\nimport {\n getFullUnderscoreErrorCopyPasteSnippet,\n getGlobalErrorCopyPasteSnippet,\n getInstrumentationHookContent,\n getInstrumentationHookCopyPasteSnippet,\n getNextjsConfigCjsAppendix,\n getNextjsConfigCjsTemplate,\n getNextjsConfigEsmCopyPasteSnippet,\n getNextjsConfigMjsTemplate,\n getRootLayout,\n getSentryServersideConfigContents,\n getInstrumentationClientFileContents,\n getSentryDefaultGlobalErrorPage,\n getSentryDefaultUnderscoreErrorPage,\n getSentryExampleAppDirApiRoute,\n getSentryExamplePageContents,\n getSentryExamplePagesDirApiRoute,\n getSimpleUnderscoreErrorCopyPasteSnippet,\n getWithSentryConfigOptionsTemplate,\n getInstrumentationClientHookCopyPasteSnippet,\n getRootLayoutWithGenerateMetadata,\n getGenerateMetadataSnippet,\n} from './templates';\nimport {\n getMaybeAppDirLocation,\n getNextJsVersionBucket,\n hasRootLayoutFile,\n} from './utils';\n\nexport function runNextjsWizard(options: WizardOptions) {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'nextjs',\n wizardOptions: options,\n },\n () => runNextjsWizardWithTelemetry(options),\n );\n}\n\nexport async function runNextjsWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n const { promoCode, telemetryEnabled, forceInstall } = options;\n\n printWelcome({\n wizardName: 'Sentry Next.js Wizard',\n promoCode,\n telemetryEnabled,\n });\n\n const typeScriptDetected = isUsingTypeScript();\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, 'next', 'Next.js');\n\n const nextVersion = getPackageVersion('next', packageJson);\n Sentry.setTag('nextjs-version', getNextJsVersionBucket(nextVersion));\n\n const { selectedProject, authToken, selfHosted, sentryUrl } =\n await getOrAskForProjectData(options, 'javascript-nextjs');\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/nextjs',\n packageJson,\n );\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n const { packageManager: packageManagerFromInstallStep } =\n await installPackage({\n packageName: '@sentry/nextjs@^10',\n packageNameDisplayLabel: '@sentry/nextjs',\n alreadyInstalled: !!packageJson?.dependencies?.['@sentry/nextjs'],\n forceInstall,\n });\n\n await traceStep('configure-sdk', async () => {\n const tunnelRoute = await askShouldSetTunnelRoute();\n\n await createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl, {\n tunnelRoute,\n });\n });\n\n await traceStep('create-underscoreerror-page', async () => {\n const srcDir = path.join(process.cwd(), 'src');\n const maybePagesDirPath = path.join(process.cwd(), 'pages');\n const maybeSrcPagesDirPath = path.join(srcDir, 'pages');\n\n const pagesLocation =\n fs.existsSync(maybePagesDirPath) &&\n fs.lstatSync(maybePagesDirPath).isDirectory()\n ? ['pages']\n : fs.existsSync(maybeSrcPagesDirPath) &&\n fs.lstatSync(maybeSrcPagesDirPath).isDirectory()\n ? ['src', 'pages']\n : undefined;\n\n if (!pagesLocation) {\n return;\n }\n\n const underscoreErrorPageFile = fs.existsSync(\n path.join(process.cwd(), ...pagesLocation, '_error.tsx'),\n )\n ? '_error.tsx'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.ts'))\n ? '_error.ts'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.jsx'))\n ? '_error.jsx'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.js'))\n ? '_error.js'\n : undefined;\n\n if (!underscoreErrorPageFile) {\n const underscoreErrorFileName = `_error.${\n typeScriptDetected ? 'tsx' : 'jsx'\n }`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), ...pagesLocation, underscoreErrorFileName),\n getSentryDefaultUnderscoreErrorPage(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorFileName),\n )}.`,\n );\n } else if (\n fs\n .readFileSync(\n path.join(process.cwd(), ...pagesLocation, underscoreErrorPageFile),\n 'utf8',\n )\n .includes('getInitialProps')\n ) {\n clack.log.info(\n `It seems like you already have a custom error page.\\n\\nPlease put the following function call in the ${chalk.bold(\n 'getInitialProps',\n )}\\nmethod of your custom error page at ${chalk.bold(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )}:`,\n );\n\n // eslint-disable-next-line no-console\n console.log(getSimpleUnderscoreErrorCopyPasteSnippet());\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did you modify your ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n } else {\n clack.log.info(\n `It seems like you already have a custom error page.\\n\\nPlease add the following code to your custom error page\\nat ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )}:`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getFullUnderscoreErrorCopyPasteSnippet(\n underscoreErrorPageFile === '_error.ts' ||\n underscoreErrorPageFile === '_error.tsx',\n ),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did you add the code to your ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n });\n\n await traceStep('create-global-error-page', async () => {\n const appDirLocation = getMaybeAppDirLocation();\n\n if (!appDirLocation) {\n return;\n }\n\n const globalErrorPageFile = fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.tsx'),\n )\n ? 'global-error.tsx'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.ts'),\n )\n ? 'global-error.ts'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.jsx'),\n )\n ? 'global-error.jsx'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.js'),\n )\n ? 'global-error.js'\n : undefined;\n\n if (!globalErrorPageFile) {\n const newGlobalErrorFileName = `global-error.${\n typeScriptDetected ? 'tsx' : 'jsx'\n }`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), ...appDirLocation, newGlobalErrorFileName),\n getSentryDefaultGlobalErrorPage(typeScriptDetected),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appDirLocation, newGlobalErrorFileName),\n )}.`,\n );\n } else {\n clack.log.info(\n `It seems like you already have a custom error page for your app directory.\\n\\nPlease add the following code to your custom error page\\nat ${chalk.cyan(\n path.join(...appDirLocation, globalErrorPageFile),\n )}:\\n`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getGlobalErrorCopyPasteSnippet(\n globalErrorPageFile === 'global-error.ts' ||\n globalErrorPageFile === 'global-error.tsx',\n ),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did you add the code to your ${chalk.cyan(\n path.join(...appDirLocation, globalErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n });\n\n await traceStep('add-generate-metadata-function', async () => {\n const isNext14 = getNextJsVersionBucket(nextVersion) === '14.x';\n const appDirLocation = getMaybeAppDirLocation();\n\n // We only need this specific change for app router on next@14\n if (!appDirLocation || !isNext14) {\n return;\n }\n\n const appDirPath = path.join(process.cwd(), ...appDirLocation);\n const hasRootLayout = hasRootLayoutFile(appDirPath);\n\n if (!hasRootLayout) {\n const newRootLayoutFilename = `layout.${\n typeScriptDetected ? 'tsx' : 'jsx'\n }`;\n\n await fs.promises.writeFile(\n path.join(appDirPath, newRootLayoutFilename),\n getRootLayoutWithGenerateMetadata(typeScriptDetected),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appDirLocation, newRootLayoutFilename),\n )}.`,\n );\n } else {\n clack.log.info(\n `It seems like you already have a root layout component. Please add or modify your generateMetadata function.`,\n );\n\n await showCopyPasteInstructions({\n filename: `layout.${typeScriptDetected ? 'tsx' : 'jsx'}`,\n codeSnippet: getGenerateMetadataSnippet(typeScriptDetected),\n });\n }\n });\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage();\n if (shouldCreateExamplePage) {\n await traceStep('create-example-page', async () =>\n createExamplePage(\n selfHosted,\n selectedProject,\n sentryUrl,\n typeScriptDetected,\n ),\n );\n }\n\n await addDotEnvSentryBuildPluginFile(authToken);\n\n const isLikelyUsingTurbopack = await checkIfLikelyIsUsingTurbopack();\n if (isLikelyUsingTurbopack || isLikelyUsingTurbopack === null) {\n await abortIfCancelled(\n clack.select({\n message: `Warning: The Sentry SDK is only compatible with Turbopack on Next.js version 15.3.0 (or 15.3.0-canary.8) or later. ${chalk.bold(\n `If you are using Turbopack with an older Next.js version, temporarily remove \\`--turbo\\` or \\`--turbopack\\` from your dev command until you have verified the SDK is working as expected. Note that the SDK will continue to work for non-Turbopack production builds.`,\n )}`,\n options: [\n {\n label: 'I understand.',\n hint: 'press enter',\n value: true,\n },\n ],\n initialValue: true,\n }),\n );\n }\n\n const mightBeUsingVercel = fs.existsSync(\n path.join(process.cwd(), 'vercel.json'),\n );\n\n if (mightBeUsingVercel && !options.comingFrom) {\n clack.log.info(\n \"▲ It seems like you're using Vercel. We recommend using the Sentry Vercel \\\n integration to set up an auth token for Vercel deployments: https://vercel.com/integrations/sentry\",\n );\n } else {\n await setupCI('nextjs', authToken, options.comingFrom);\n }\n\n const packageManagerForOutro =\n packageManagerFromInstallStep ?? (await getPackageManager());\n\n await runPrettierIfInstalled({ cwd: undefined });\n\n clack.outro(`\n${chalk.green('Successfully installed the Sentry Next.js SDK!')} ${\n shouldCreateExamplePage\n ? `\\n\\nYou can validate your setup by (re)starting your dev environment (e.g. ${chalk.cyan(\n `${packageManagerForOutro.runScriptCommand} dev`,\n )}) and visiting ${chalk.cyan('\"/sentry-example-page\"')}`\n : ''\n }${\n shouldCreateExamplePage && isLikelyUsingTurbopack\n ? `\\nDon't forget to remove \\`--turbo\\` or \\`--turbopack\\` from your dev command until you have verified the SDK is working. You can safely add it back afterwards.`\n : ''\n }\n\n${chalk.dim(\n 'If you encounter any issues, let us know here: https://github.com/getsentry/sentry-javascript/issues',\n)}`);\n}\n\ntype SDKConfigOptions = {\n tunnelRoute: boolean;\n};\n\nasync function createOrMergeNextJsFiles(\n selectedProject: SentryProjectData,\n selfHosted: boolean,\n sentryUrl: string,\n sdkConfigOptions: SDKConfigOptions,\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 '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 typeScriptDetected = isUsingTypeScript();\n\n const configVariants = ['server', 'edge'] as const;\n\n for (const configVariant of configVariants) {\n await traceStep(`create-sentry-${configVariant}-config`, async () => {\n const jsConfig = `sentry.${configVariant}.config.js`;\n const tsConfig = `sentry.${configVariant}.config.ts`;\n\n const jsConfigExists = fs.existsSync(path.join(process.cwd(), jsConfig));\n const tsConfigExists = fs.existsSync(path.join(process.cwd(), tsConfig));\n\n let shouldWriteFile = true;\n\n if (jsConfigExists || tsConfigExists) {\n const existingConfigs = [];\n\n if (jsConfigExists) {\n existingConfigs.push(jsConfig);\n }\n\n if (tsConfigExists) {\n existingConfigs.push(tsConfig);\n }\n\n const overwriteExistingConfigs = await abortIfCancelled(\n clack.confirm({\n message: `Found existing Sentry ${configVariant} config (${existingConfigs.join(\n ', ',\n )}). Overwrite ${existingConfigs.length > 1 ? 'them' : 'it'}?`,\n }),\n );\n Sentry.setTag(\n `overwrite-${configVariant}-config`,\n overwriteExistingConfigs,\n );\n\n shouldWriteFile = overwriteExistingConfigs;\n\n if (overwriteExistingConfigs) {\n if (jsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), jsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(jsConfig)}.`);\n }\n if (tsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), tsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(tsConfig)}.`);\n }\n }\n }\n\n if (shouldWriteFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), typeScriptDetected ? tsConfig : jsConfig),\n getSentryServersideConfigContents(\n selectedProject.keys[0].dsn.public,\n configVariant,\n selectedFeatures,\n ),\n { encoding: 'utf8', flag: 'w' },\n );\n clack.log.success(\n `Created fresh ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )}.`,\n );\n Sentry.setTag(`created-${configVariant}-config`, true);\n }\n });\n }\n\n await traceStep('setup-instrumentation-hook', async () => {\n const hasRootAppDirectory = hasDirectoryPathFromRoot('app');\n const hasRootPagesDirectory = hasDirectoryPathFromRoot('pages');\n const hasSrcDirectory = hasDirectoryPathFromRoot('src');\n\n let instrumentationHookLocation: 'src' | 'root' | 'does-not-exist';\n\n const instrumentationTsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation.ts'),\n );\n const instrumentationJsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation.js'),\n );\n const srcInstrumentationTsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation.ts'),\n );\n const srcInstrumentationJsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation.js'),\n );\n\n // https://nextjs.org/docs/app/building-your-application/configuring/src-directory\n // https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation\n // The logic for where Next.js picks up the instrumentation file is as follows:\n // - If there is either an `app` folder or a `pages` folder in the root directory of your Next.js app, Next.js looks\n // for an `instrumentation.ts` file in the root of the Next.js app.\n // - Otherwise, if there is neither an `app` folder or a `pages` folder in the rood directory of your Next.js app,\n // AND if there is an `src` folder, Next.js will look for the `instrumentation.ts` file in the `src` folder.\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n if (instrumentationJsExists || instrumentationTsExists) {\n instrumentationHookLocation = 'root';\n } else {\n instrumentationHookLocation = 'does-not-exist';\n }\n } else {\n if (srcInstrumentationTsExists || srcInstrumentationJsExists) {\n instrumentationHookLocation = 'src';\n } else {\n instrumentationHookLocation = 'does-not-exist';\n }\n }\n\n const newInstrumentationFileName = `instrumentation.${\n typeScriptDetected ? 'ts' : 'js'\n }`;\n\n if (instrumentationHookLocation === 'does-not-exist') {\n let newInstrumentationHookLocation: 'root' | 'src';\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n newInstrumentationHookLocation = 'root';\n } else if (hasSrcDirectory) {\n newInstrumentationHookLocation = 'src';\n } else {\n newInstrumentationHookLocation = 'root';\n }\n\n const newInstrumentationHookPath =\n newInstrumentationHookLocation === 'root'\n ? path.join(process.cwd(), newInstrumentationFileName)\n : path.join(process.cwd(), 'src', newInstrumentationFileName);\n\n const successfullyCreated = await createNewConfigFile(\n newInstrumentationHookPath,\n getInstrumentationHookContent(newInstrumentationHookLocation),\n );\n\n if (!successfullyCreated) {\n await showCopyPasteInstructions({\n filename: newInstrumentationFileName,\n codeSnippet: getInstrumentationHookCopyPasteSnippet(\n newInstrumentationHookLocation,\n ),\n hint: \"create the file if it doesn't already exist\",\n });\n }\n } else {\n await showCopyPasteInstructions({\n filename:\n srcInstrumentationTsExists || instrumentationTsExists\n ? 'instrumentation.ts'\n : srcInstrumentationJsExists || instrumentationJsExists\n ? 'instrumentation.js'\n : newInstrumentationFileName,\n codeSnippet: getInstrumentationHookCopyPasteSnippet(\n instrumentationHookLocation,\n ),\n });\n }\n });\n\n await traceStep('setup-instrumentation-client-hook', async () => {\n const hasRootAppDirectory = hasDirectoryPathFromRoot('app');\n const hasRootPagesDirectory = hasDirectoryPathFromRoot('pages');\n const hasSrcDirectory = hasDirectoryPathFromRoot('src');\n\n let instrumentationClientHookLocation: 'src' | 'root' | 'does-not-exist';\n\n const instrumentationClientTsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation-client.ts'),\n );\n const instrumentationClientJsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation-client.js'),\n );\n const srcInstrumentationClientTsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation-client.ts'),\n );\n const srcInstrumentationClientJsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation-client.js'),\n );\n\n // https://nextjs.org/docs/app/building-your-application/configuring/src-directory\n // https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation\n // The logic for where Next.js picks up the instrumentation file is as follows:\n // - If there is either an `app` folder or a `pages` folder in the root directory of your Next.js app, Next.js looks\n // for an `instrumentation.ts` file in the root of the Next.js app.\n // - Otherwise, if there is neither an `app` folder or a `pages` folder in the rood directory of your Next.js app,\n // AND if there is an `src` folder, Next.js will look for the `instrumentation.ts` file in the `src` folder.\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n if (instrumentationClientJsExists || instrumentationClientTsExists) {\n instrumentationClientHookLocation = 'root';\n } else {\n instrumentationClientHookLocation = 'does-not-exist';\n }\n } else {\n if (\n srcInstrumentationClientTsExists ||\n srcInstrumentationClientJsExists\n ) {\n instrumentationClientHookLocation = 'src';\n } else {\n instrumentationClientHookLocation = 'does-not-exist';\n }\n }\n\n const newInstrumentationClientFileName = `instrumentation-client.${\n typeScriptDetected ? 'ts' : 'js'\n }`;\n\n if (instrumentationClientHookLocation === 'does-not-exist') {\n let newInstrumentationClientHookLocation: 'root' | 'src';\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n newInstrumentationClientHookLocation = 'root';\n } else if (hasSrcDirectory) {\n newInstrumentationClientHookLocation = 'src';\n } else {\n newInstrumentationClientHookLocation = 'root';\n }\n\n const newInstrumentationClientHookPath =\n newInstrumentationClientHookLocation === 'root'\n ? path.join(process.cwd(), newInstrumentationClientFileName)\n : path.join(process.cwd(), 'src', newInstrumentationClientFileName);\n\n const successfullyCreated = await createNewConfigFile(\n newInstrumentationClientHookPath,\n getInstrumentationClientFileContents(\n selectedProject.keys[0].dsn.public,\n selectedFeatures,\n ),\n );\n\n if (!successfullyCreated) {\n await showCopyPasteInstructions({\n filename: newInstrumentationClientFileName,\n codeSnippet: getInstrumentationClientHookCopyPasteSnippet(\n selectedProject.keys[0].dsn.public,\n selectedFeatures,\n ),\n hint: \"create the file if it doesn't already exist\",\n });\n }\n } else {\n await showCopyPasteInstructions({\n filename:\n srcInstrumentationClientTsExists || instrumentationClientTsExists\n ? 'instrumentation-client.ts'\n : srcInstrumentationClientJsExists || instrumentationClientJsExists\n ? 'instrumentation-client.js'\n : newInstrumentationClientFileName,\n codeSnippet: getInstrumentationClientHookCopyPasteSnippet(\n selectedProject.keys[0].dsn.public,\n selectedFeatures,\n ),\n });\n }\n });\n\n await traceStep('setup-next-config', async () => {\n const withSentryConfigOptionsTemplate = getWithSentryConfigOptionsTemplate({\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n selfHosted,\n sentryUrl,\n tunnelRoute: sdkConfigOptions.tunnelRoute,\n });\n\n const nextConfigPossibleFilesMap = {\n js: 'next.config.js',\n mjs: 'next.config.mjs',\n cjs: 'next.config.cjs',\n ts: 'next.config.ts',\n mts: 'next.config.mts',\n cts: 'next.config.cts',\n };\n\n const foundNextConfigFile = Object.entries(nextConfigPossibleFilesMap).find(\n ([, fileName]) => fs.existsSync(path.join(process.cwd(), fileName)),\n );\n\n if (!foundNextConfigFile) {\n Sentry.setTag('next-config-strategy', 'create');\n\n // Try to figure out whether the user prefers ESM\n let isTypeModule = false;\n try {\n const packageJsonText = await fs.promises.readFile(\n path.join(process.cwd(), 'package.json'),\n 'utf8',\n );\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const packageJson = JSON.parse(packageJsonText);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (packageJson.type === 'module') {\n isTypeModule = true;\n }\n } catch {\n // noop\n }\n\n // We are creating `next.config.(m)js` files by default as they are supported by the most Next.js versions\n const configFilename = isTypeModule\n ? nextConfigPossibleFilesMap.mjs\n : nextConfigPossibleFilesMap.js;\n const configContent = isTypeModule\n ? getNextjsConfigMjsTemplate(withSentryConfigOptionsTemplate)\n : getNextjsConfigCjsTemplate(withSentryConfigOptionsTemplate);\n\n await fs.promises.writeFile(\n path.join(process.cwd(), configFilename),\n configContent,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(configFilename)} with Sentry configuration.`,\n );\n\n return;\n }\n\n const [foundNextConfigFileType, foundNextConfigFileFilename] =\n foundNextConfigFile;\n\n if (foundNextConfigFileType === 'js' || foundNextConfigFileType === 'cjs') {\n Sentry.setTag('next-config-strategy', 'modify');\n\n const nextConfigCjsContent = fs.readFileSync(\n path.join(process.cwd(), foundNextConfigFileFilename),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfigCjsContent.includes('@sentry/nextjs') &&\n nextConfigCjsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.cyan(\n foundNextConfigFileFilename,\n )} already contains Sentry SDK configuration. Should the wizard modify it anyways?`,\n }),\n );\n\n shouldInject = injectAnyhow;\n }\n\n if (shouldInject) {\n await fs.promises.appendFile(\n path.join(process.cwd(), foundNextConfigFileFilename),\n getNextjsConfigCjsAppendix(withSentryConfigOptionsTemplate),\n 'utf8',\n );\n\n clack.log.success(\n `Added Sentry configuration to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}. ${chalk.dim('(you probably want to clean this up a bit!)')}`,\n );\n }\n\n Sentry.setTag('next-config-mod-result', 'success');\n }\n\n if (\n foundNextConfigFileType === 'mjs' ||\n foundNextConfigFileType === 'mts' ||\n foundNextConfigFileType === 'cts' ||\n foundNextConfigFileType === 'ts'\n ) {\n const nextConfigMjsContent = fs.readFileSync(\n path.join(process.cwd(), foundNextConfigFileFilename),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfigMjsContent.includes('@sentry/nextjs') &&\n nextConfigMjsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.cyan(\n foundNextConfigFileFilename,\n )} already contains Sentry SDK configuration. Should the wizard modify it anyways?`,\n }),\n );\n\n shouldInject = injectAnyhow;\n }\n\n try {\n if (shouldInject) {\n const mod = parseModule(nextConfigMjsContent);\n mod.imports.$add({\n from: '@sentry/nextjs',\n imported: 'withSentryConfig',\n local: 'withSentryConfig',\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n const expressionToWrap = generateCode(mod.exports.default.$ast).code;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n mod.exports.default = builders.raw(`withSentryConfig(\n ${expressionToWrap},\n ${withSentryConfigOptionsTemplate}\n)`);\n const newCode = mod.generate().code;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), foundNextConfigFileFilename),\n newCode,\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n clack.log.success(\n `Added Sentry configuration to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}. ${chalk.dim('(you probably want to clean this up a bit!)')}`,\n );\n\n Sentry.setTag('next-config-mod-result', 'success');\n }\n } catch {\n Sentry.setTag('next-config-mod-result', 'fail');\n clack.log.warn(\n chalk.yellow(\n `Something went wrong writing to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}.`,\n ),\n );\n clack.log.info(\n `Please put the following code snippet into ${chalk.cyan(\n foundNextConfigFileFilename,\n )}: ${chalk.dim('You probably have to clean it up a bit.')}\\n`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getNextjsConfigEsmCopyPasteSnippet(withSentryConfigOptionsTemplate),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Are you done putting the snippet above into ${chalk.cyan(\n foundNextConfigFileFilename,\n )}?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n }\n });\n}\n\nfunction hasDirectoryPathFromRoot(dirnameOrDirs: string | string[]): boolean {\n const dirPath = Array.isArray(dirnameOrDirs)\n ? path.join(process.cwd(), ...dirnameOrDirs)\n : path.join(process.cwd(), dirnameOrDirs);\n\n return fs.existsSync(dirPath) && fs.lstatSync(dirPath).isDirectory();\n}\n\nasync function createExamplePage(\n selfHosted: boolean,\n selectedProject: SentryProjectData,\n sentryUrl: string,\n typeScriptDetected: boolean,\n): Promise<void> {\n const hasSrcDirectory = hasDirectoryPathFromRoot('src');\n const hasRootAppDirectory = hasDirectoryPathFromRoot('app');\n const hasRootPagesDirectory = hasDirectoryPathFromRoot('pages');\n const hasSrcAppDirectory = hasDirectoryPathFromRoot(['src', 'app']);\n const hasSrcPagesDirectory = hasDirectoryPathFromRoot(['src', 'pages']);\n\n Sentry.setTag('nextjs-app-dir', hasRootAppDirectory || hasSrcAppDirectory);\n\n // If `pages` or an `app` directory exists in the root, we'll put the example page there.\n // `app` directory takes priority over `pages` directory when they coexist, so we prioritize that.\n // https://nextjs.org/docs/app/building-your-application/routing#the-app-router\n\n const appFolderLocation = hasRootAppDirectory\n ? ['app']\n : hasSrcAppDirectory\n ? ['src', 'app']\n : undefined;\n\n let pagesFolderLocation = hasRootPagesDirectory\n ? ['pages']\n : hasSrcPagesDirectory\n ? ['src', 'pages']\n : undefined;\n\n // If the user has neither pages nor app directory we create a pages folder for them\n if (!appFolderLocation && !pagesFolderLocation) {\n const newPagesFolderLocation = hasSrcDirectory\n ? ['src', 'pages']\n : ['pages'];\n fs.mkdirSync(path.join(process.cwd(), ...newPagesFolderLocation), {\n recursive: true,\n });\n\n pagesFolderLocation = newPagesFolderLocation;\n }\n\n if (appFolderLocation) {\n const appFolderPath = path.join(process.cwd(), ...appFolderLocation);\n\n const hasRootLayout = hasRootLayoutFile(appFolderPath);\n\n if (!hasRootLayout) {\n // In case no root layout file exists, we create a simple one so that\n // the example page can be rendered correctly.\n const newRootLayoutFilename = `layout.${\n typeScriptDetected ? 'tsx' : 'jsx'\n }`;\n\n await fs.promises.writeFile(\n path.join(appFolderPath, newRootLayoutFilename),\n getRootLayout(typeScriptDetected),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appFolderLocation, newRootLayoutFilename),\n )}.`,\n );\n }\n\n const examplePageContents = getSentryExamplePageContents({\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n sentryUrl,\n useClient: true,\n isTypeScript: typeScriptDetected,\n });\n\n fs.mkdirSync(path.join(appFolderPath, 'sentry-example-page'), {\n recursive: true,\n });\n\n const newPageFileName = `page.${typeScriptDetected ? 'tsx' : 'jsx'}`;\n\n await fs.promises.writeFile(\n path.join(appFolderPath, 'sentry-example-page', newPageFileName),\n examplePageContents,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appFolderLocation, 'sentry-example-page', newPageFileName),\n )}.`,\n );\n\n fs.mkdirSync(path.join(appFolderPath, 'api', 'sentry-example-api'), {\n recursive: true,\n });\n\n const newRouteFileName = `route.${typeScriptDetected ? 'ts' : 'js'}`;\n\n await fs.promises.writeFile(\n path.join(appFolderPath, 'api', 'sentry-example-api', newRouteFileName),\n getSentryExampleAppDirApiRoute({ isTypeScript: typeScriptDetected }),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(\n ...appFolderLocation,\n 'api',\n 'sentry-example-api',\n newRouteFileName,\n ),\n )}.`,\n );\n } else if (pagesFolderLocation) {\n const examplePageContents = getSentryExamplePageContents({\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n sentryUrl,\n useClient: false,\n isTypeScript: typeScriptDetected,\n });\n\n const examplePageFileName = `sentry-example-page.${\n typeScriptDetected ? 'tsx' : 'jsx'\n }`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), ...pagesFolderLocation, examplePageFileName),\n examplePageContents,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...pagesFolderLocation, examplePageFileName),\n )}.`,\n );\n\n fs.mkdirSync(path.join(process.cwd(), ...pagesFolderLocation, 'api'), {\n recursive: true,\n });\n\n const apiRouteFileName = `sentry-example-api.${\n typeScriptDetected ? 'ts' : 'js'\n }`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), ...pagesFolderLocation, 'api', apiRouteFileName),\n getSentryExamplePagesDirApiRoute({ isTypeScript: typeScriptDetected }),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...pagesFolderLocation, 'api', apiRouteFileName),\n )}.`,\n );\n }\n}\n\n/**\n * Ask users if they want to set the tunnelRoute option.\n * We can't set this by default because it potentially increases hosting bills.\n * It's valuable enough to for users to justify asking the additional question.\n */\nasync function askShouldSetTunnelRoute() {\n return await traceStep('ask-tunnelRoute-option', async (span) => {\n const shouldSetTunnelRoute = await abortIfCancelled(\n clack.select({\n message:\n 'Do you want to route Sentry requests in the browser through your Next.js server to avoid ad blockers?',\n options: [\n {\n label: 'Yes',\n value: true,\n hint: 'Can increase your server load and hosting bill',\n },\n {\n label: 'No',\n value: false,\n hint: 'Browser errors and events might be blocked by ad blockers before being sent to Sentry',\n },\n ],\n initialValue: true,\n }),\n );\n\n if (!shouldSetTunnelRoute) {\n clack.log.info(\n \"Sounds good! We'll leave the option commented for later, just in case :)\",\n );\n }\n\n span?.setAttribute('tunnelRoute', shouldSetTunnelRoute);\n Sentry.setTag('tunnelRoute', shouldSetTunnelRoute);\n\n return shouldSetTunnelRoute;\n });\n}\n\n/**\n * Returns true or false depending on whether we think the user is using Turbopack. May return null in case we aren't sure.\n */\nasync function checkIfLikelyIsUsingTurbopack(): Promise<boolean | null> {\n let packageJsonContent: string;\n try {\n packageJsonContent = await fs.promises.readFile(\n path.join(process.cwd(), 'package.json'),\n 'utf8',\n );\n } catch {\n return null;\n }\n\n return packageJsonContent.includes('--turbo');\n}\n"]}
1
+ {"version":3,"file":"nextjs-wizard.js","sourceRoot":"","sources":["../../../src/nextjs/nextjs-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAC1B,uCAAyB;AACzB,kFAAkF;AAClF,uCAAuC;AACvC,2CAA6B;AAE7B,qDAAuC;AAEvC,uEAA0D;AAC1D,4CAAwD;AACxD,0CAiBwB;AACxB,wDAA+E;AAE/E,0DAAwE;AACxE,2CAsBqB;AACrB,mCAMiB;AAEjB,SAAgB,eAAe,CAAC,OAAsB;IACpD,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;QACjC,WAAW,EAAE,QAAQ;QACrB,aAAa,EAAE,OAAO;KACvB,EACD,GAAG,EAAE,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAC5C,CAAC;AACJ,CAAC;AATD,0CASC;AAEM,KAAK,UAAU,4BAA4B,CAChD,OAAsB;IAEtB,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAE9D,IAAA,oBAAY,EAAC;QACX,UAAU,EAAE,uBAAuB;QACnC,SAAS;QACT,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,IAAA,yBAAiB,GAAE,CAAC;IAE/C,MAAM,IAAA,yCAAiC,EAAC;QACtC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,MAAM,IAAA,yBAAiB,GAAE,CAAC;IAE9C,MAAM,IAAA,gCAAwB,EAAC,WAAW,EAAE,M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C,QAAQ,CAC7C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,EACxC,MAAM,CACP,CAAC;KACH;IAAC,MAAM;QACN,OAAO,IAAI,CAAC;KACb;IAED,OAAO,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAChD,CAAC","sourcesContent":["/* eslint-disable max-lines */\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 * as fs from 'fs';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { parseModule } from 'magicast';\nimport * as path from 'path';\n\nimport * as Sentry from '@sentry/node';\n\nimport { setupCI } from '../sourcemaps/sourcemaps-wizard';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n abort,\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n createNewConfigFile,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n getPackageManager,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n runPrettierIfInstalled,\n showCopyPasteInstructions,\n} from '../utils/clack';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport type { SentryProjectData, WizardOptions } from '../utils/types';\nimport { offerProjectScopedMcpConfig } from '../utils/clack/mcp-config';\nimport {\n getFullUnderscoreErrorCopyPasteSnippet,\n getGlobalErrorCopyPasteSnippet,\n getInstrumentationHookContent,\n getInstrumentationHookCopyPasteSnippet,\n getNextjsConfigCjsAppendix,\n getNextjsConfigCjsTemplate,\n getNextjsConfigEsmCopyPasteSnippet,\n getNextjsConfigMjsTemplate,\n getRootLayout,\n getSentryServersideConfigContents,\n getInstrumentationClientFileContents,\n getSentryDefaultGlobalErrorPage,\n getSentryDefaultUnderscoreErrorPage,\n getSentryExampleAppDirApiRoute,\n getSentryExamplePageContents,\n getSentryExamplePagesDirApiRoute,\n getSimpleUnderscoreErrorCopyPasteSnippet,\n getWithSentryConfigOptionsTemplate,\n getInstrumentationClientHookCopyPasteSnippet,\n getRootLayoutWithGenerateMetadata,\n getGenerateMetadataSnippet,\n} from './templates';\nimport {\n getMaybeAppDirLocation,\n getNextJsVersionBucket,\n hasRootLayoutFile,\n unwrapSentryConfigAst,\n wrapWithSentryConfig,\n} from './utils';\n\nexport function runNextjsWizard(options: WizardOptions) {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'nextjs',\n wizardOptions: options,\n },\n () => runNextjsWizardWithTelemetry(options),\n );\n}\n\nexport async function runNextjsWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n const { promoCode, telemetryEnabled, forceInstall } = options;\n\n printWelcome({\n wizardName: 'Sentry Next.js Wizard',\n promoCode,\n telemetryEnabled,\n });\n\n const typeScriptDetected = isUsingTypeScript();\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, 'next', 'Next.js');\n\n const nextVersion = getPackageVersion('next', packageJson);\n Sentry.setTag('nextjs-version', getNextJsVersionBucket(nextVersion));\n\n const { selectedProject, authToken, selfHosted, sentryUrl } =\n await getOrAskForProjectData(options, 'javascript-nextjs');\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/nextjs',\n packageJson,\n );\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n const { packageManager: packageManagerFromInstallStep } =\n await installPackage({\n packageName: '@sentry/nextjs@^10',\n packageNameDisplayLabel: '@sentry/nextjs',\n alreadyInstalled: !!packageJson?.dependencies?.['@sentry/nextjs'],\n forceInstall,\n });\n\n await traceStep('configure-sdk', async () => {\n const tunnelRoute = await askShouldSetTunnelRoute();\n\n await createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl, {\n tunnelRoute,\n });\n });\n\n await traceStep('create-underscoreerror-page', async () => {\n const srcDir = path.join(process.cwd(), 'src');\n const maybePagesDirPath = path.join(process.cwd(), 'pages');\n const maybeSrcPagesDirPath = path.join(srcDir, 'pages');\n\n const pagesLocation =\n fs.existsSync(maybePagesDirPath) &&\n fs.lstatSync(maybePagesDirPath).isDirectory()\n ? ['pages']\n : fs.existsSync(maybeSrcPagesDirPath) &&\n fs.lstatSync(maybeSrcPagesDirPath).isDirectory()\n ? ['src', 'pages']\n : undefined;\n\n if (!pagesLocation) {\n return;\n }\n\n const underscoreErrorPageFile = fs.existsSync(\n path.join(process.cwd(), ...pagesLocation, '_error.tsx'),\n )\n ? '_error.tsx'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.ts'))\n ? '_error.ts'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.jsx'))\n ? '_error.jsx'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.js'))\n ? '_error.js'\n : undefined;\n\n if (!underscoreErrorPageFile) {\n const underscoreErrorFileName = `_error.${\n typeScriptDetected ? 'tsx' : 'jsx'\n }`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), ...pagesLocation, underscoreErrorFileName),\n getSentryDefaultUnderscoreErrorPage(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorFileName),\n )}.`,\n );\n } else if (\n fs\n .readFileSync(\n path.join(process.cwd(), ...pagesLocation, underscoreErrorPageFile),\n 'utf8',\n )\n .includes('getInitialProps')\n ) {\n clack.log.info(\n `It seems like you already have a custom error page.\\n\\nPlease put the following function call in the ${chalk.bold(\n 'getInitialProps',\n )}\\nmethod of your custom error page at ${chalk.bold(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )}:`,\n );\n\n // eslint-disable-next-line no-console\n console.log(getSimpleUnderscoreErrorCopyPasteSnippet());\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did you modify your ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n } else {\n clack.log.info(\n `It seems like you already have a custom error page.\\n\\nPlease add the following code to your custom error page\\nat ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )}:`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getFullUnderscoreErrorCopyPasteSnippet(\n underscoreErrorPageFile === '_error.ts' ||\n underscoreErrorPageFile === '_error.tsx',\n ),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did you add the code to your ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n });\n\n await traceStep('create-global-error-page', async () => {\n const appDirLocation = getMaybeAppDirLocation();\n\n if (!appDirLocation) {\n return;\n }\n\n const globalErrorPageFile = fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.tsx'),\n )\n ? 'global-error.tsx'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.ts'),\n )\n ? 'global-error.ts'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.jsx'),\n )\n ? 'global-error.jsx'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.js'),\n )\n ? 'global-error.js'\n : undefined;\n\n if (!globalErrorPageFile) {\n const newGlobalErrorFileName = `global-error.${\n typeScriptDetected ? 'tsx' : 'jsx'\n }`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), ...appDirLocation, newGlobalErrorFileName),\n getSentryDefaultGlobalErrorPage(typeScriptDetected),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appDirLocation, newGlobalErrorFileName),\n )}.`,\n );\n } else {\n clack.log.info(\n `It seems like you already have a custom error page for your app directory.\\n\\nPlease add the following code to your custom error page\\nat ${chalk.cyan(\n path.join(...appDirLocation, globalErrorPageFile),\n )}:\\n`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getGlobalErrorCopyPasteSnippet(\n globalErrorPageFile === 'global-error.ts' ||\n globalErrorPageFile === 'global-error.tsx',\n ),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did you add the code to your ${chalk.cyan(\n path.join(...appDirLocation, globalErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n });\n\n await traceStep('add-generate-metadata-function', async () => {\n const isNext14 = getNextJsVersionBucket(nextVersion) === '14.x';\n const appDirLocation = getMaybeAppDirLocation();\n\n // We only need this specific change for app router on next@14\n if (!appDirLocation || !isNext14) {\n return;\n }\n\n const appDirPath = path.join(process.cwd(), ...appDirLocation);\n const hasRootLayout = hasRootLayoutFile(appDirPath);\n\n if (!hasRootLayout) {\n const newRootLayoutFilename = `layout.${\n typeScriptDetected ? 'tsx' : 'jsx'\n }`;\n\n await fs.promises.writeFile(\n path.join(appDirPath, newRootLayoutFilename),\n getRootLayoutWithGenerateMetadata(typeScriptDetected),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appDirLocation, newRootLayoutFilename),\n )}.`,\n );\n } else {\n clack.log.info(\n `It seems like you already have a root layout component. Please add or modify your generateMetadata function.`,\n );\n\n await showCopyPasteInstructions({\n filename: `layout.${typeScriptDetected ? 'tsx' : 'jsx'}`,\n codeSnippet: getGenerateMetadataSnippet(typeScriptDetected),\n });\n }\n });\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage();\n if (shouldCreateExamplePage) {\n await traceStep('create-example-page', async () =>\n createExamplePage(\n selfHosted,\n selectedProject,\n sentryUrl,\n typeScriptDetected,\n ),\n );\n }\n\n await addDotEnvSentryBuildPluginFile(authToken);\n\n const isLikelyUsingTurbopack = await checkIfLikelyIsUsingTurbopack();\n if (isLikelyUsingTurbopack || isLikelyUsingTurbopack === null) {\n await abortIfCancelled(\n clack.select({\n message: `Warning: The Sentry SDK is only compatible with Turbopack on Next.js version 15.3.0 (or 15.3.0-canary.8) or later. ${chalk.bold(\n `If you are using Turbopack with an older Next.js version, temporarily remove \\`--turbo\\` or \\`--turbopack\\` from your dev command until you have verified the SDK is working as expected. Note that the SDK will continue to work for non-Turbopack production builds.`,\n )}`,\n options: [\n {\n label: 'I understand.',\n hint: 'press enter',\n value: true,\n },\n ],\n initialValue: true,\n }),\n );\n }\n\n const mightBeUsingVercel = fs.existsSync(\n path.join(process.cwd(), 'vercel.json'),\n );\n\n if (mightBeUsingVercel && !options.comingFrom) {\n clack.log.info(\n \"▲ It seems like you're using Vercel. We recommend using the Sentry Vercel \\\n integration to set up an auth token for Vercel deployments: https://vercel.com/integrations/sentry\",\n );\n } else {\n await setupCI('nextjs', authToken, options.comingFrom);\n }\n\n const packageManagerForOutro =\n packageManagerFromInstallStep ?? (await getPackageManager());\n\n await runPrettierIfInstalled({ cwd: undefined });\n\n // Offer optional project-scoped MCP config for Sentry with org and project scope\n await offerProjectScopedMcpConfig(\n selectedProject.organization.slug,\n selectedProject.slug,\n );\n\n clack.outro(`\n${chalk.green('Successfully installed the Sentry Next.js SDK!')} ${\n shouldCreateExamplePage\n ? `\\n\\nYou can validate your setup by (re)starting your dev environment (e.g. ${chalk.cyan(\n `${packageManagerForOutro.runScriptCommand} dev`,\n )}) and visiting ${chalk.cyan('\"/sentry-example-page\"')}`\n : ''\n }${\n shouldCreateExamplePage && isLikelyUsingTurbopack\n ? `\\nDon't forget to remove \\`--turbo\\` or \\`--turbopack\\` from your dev command until you have verified the SDK is working. You can safely add it back afterwards.`\n : ''\n }\n\n${chalk.dim(\n 'If you encounter any issues, let us know here: https://github.com/getsentry/sentry-javascript/issues',\n)}`);\n}\n\ntype SDKConfigOptions = {\n tunnelRoute: boolean;\n};\n\nasync function createOrMergeNextJsFiles(\n selectedProject: SentryProjectData,\n selfHosted: boolean,\n sentryUrl: string,\n sdkConfigOptions: SDKConfigOptions,\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 '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 typeScriptDetected = isUsingTypeScript();\n\n const configVariants = ['server', 'edge'] as const;\n\n for (const configVariant of configVariants) {\n await traceStep(`create-sentry-${configVariant}-config`, async () => {\n const jsConfig = `sentry.${configVariant}.config.js`;\n const tsConfig = `sentry.${configVariant}.config.ts`;\n\n const jsConfigExists = fs.existsSync(path.join(process.cwd(), jsConfig));\n const tsConfigExists = fs.existsSync(path.join(process.cwd(), tsConfig));\n\n let shouldWriteFile = true;\n\n if (jsConfigExists || tsConfigExists) {\n const existingConfigs = [];\n\n if (jsConfigExists) {\n existingConfigs.push(jsConfig);\n }\n\n if (tsConfigExists) {\n existingConfigs.push(tsConfig);\n }\n\n const overwriteExistingConfigs = await abortIfCancelled(\n clack.confirm({\n message: `Found existing Sentry ${configVariant} config (${existingConfigs.join(\n ', ',\n )}). Overwrite ${existingConfigs.length > 1 ? 'them' : 'it'}?`,\n }),\n );\n Sentry.setTag(\n `overwrite-${configVariant}-config`,\n overwriteExistingConfigs,\n );\n\n shouldWriteFile = overwriteExistingConfigs;\n\n if (overwriteExistingConfigs) {\n if (jsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), jsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(jsConfig)}.`);\n }\n if (tsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), tsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(tsConfig)}.`);\n }\n }\n }\n\n if (shouldWriteFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), typeScriptDetected ? tsConfig : jsConfig),\n getSentryServersideConfigContents(\n selectedProject.keys[0].dsn.public,\n configVariant,\n selectedFeatures,\n ),\n { encoding: 'utf8', flag: 'w' },\n );\n clack.log.success(\n `Created fresh ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )}.`,\n );\n Sentry.setTag(`created-${configVariant}-config`, true);\n }\n });\n }\n\n await traceStep('setup-instrumentation-hook', async () => {\n const hasRootAppDirectory = hasDirectoryPathFromRoot('app');\n const hasRootPagesDirectory = hasDirectoryPathFromRoot('pages');\n const hasSrcDirectory = hasDirectoryPathFromRoot('src');\n\n let instrumentationHookLocation: 'src' | 'root' | 'does-not-exist';\n\n const instrumentationTsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation.ts'),\n );\n const instrumentationJsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation.js'),\n );\n const srcInstrumentationTsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation.ts'),\n );\n const srcInstrumentationJsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation.js'),\n );\n\n // https://nextjs.org/docs/app/building-your-application/configuring/src-directory\n // https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation\n // The logic for where Next.js picks up the instrumentation file is as follows:\n // - If there is either an `app` folder or a `pages` folder in the root directory of your Next.js app, Next.js looks\n // for an `instrumentation.ts` file in the root of the Next.js app.\n // - Otherwise, if there is neither an `app` folder or a `pages` folder in the rood directory of your Next.js app,\n // AND if there is an `src` folder, Next.js will look for the `instrumentation.ts` file in the `src` folder.\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n if (instrumentationJsExists || instrumentationTsExists) {\n instrumentationHookLocation = 'root';\n } else {\n instrumentationHookLocation = 'does-not-exist';\n }\n } else {\n if (srcInstrumentationTsExists || srcInstrumentationJsExists) {\n instrumentationHookLocation = 'src';\n } else {\n instrumentationHookLocation = 'does-not-exist';\n }\n }\n\n const newInstrumentationFileName = `instrumentation.${\n typeScriptDetected ? 'ts' : 'js'\n }`;\n\n if (instrumentationHookLocation === 'does-not-exist') {\n let newInstrumentationHookLocation: 'root' | 'src';\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n newInstrumentationHookLocation = 'root';\n } else if (hasSrcDirectory) {\n newInstrumentationHookLocation = 'src';\n } else {\n newInstrumentationHookLocation = 'root';\n }\n\n const newInstrumentationHookPath =\n newInstrumentationHookLocation === 'root'\n ? path.join(process.cwd(), newInstrumentationFileName)\n : path.join(process.cwd(), 'src', newInstrumentationFileName);\n\n const successfullyCreated = await createNewConfigFile(\n newInstrumentationHookPath,\n getInstrumentationHookContent(newInstrumentationHookLocation),\n );\n\n if (!successfullyCreated) {\n await showCopyPasteInstructions({\n filename: newInstrumentationFileName,\n codeSnippet: getInstrumentationHookCopyPasteSnippet(\n newInstrumentationHookLocation,\n ),\n hint: \"create the file if it doesn't already exist\",\n });\n }\n } else {\n await showCopyPasteInstructions({\n filename:\n srcInstrumentationTsExists || instrumentationTsExists\n ? 'instrumentation.ts'\n : srcInstrumentationJsExists || instrumentationJsExists\n ? 'instrumentation.js'\n : newInstrumentationFileName,\n codeSnippet: getInstrumentationHookCopyPasteSnippet(\n instrumentationHookLocation,\n ),\n });\n }\n });\n\n await traceStep('setup-instrumentation-client-hook', async () => {\n const hasRootAppDirectory = hasDirectoryPathFromRoot('app');\n const hasRootPagesDirectory = hasDirectoryPathFromRoot('pages');\n const hasSrcDirectory = hasDirectoryPathFromRoot('src');\n\n let instrumentationClientHookLocation: 'src' | 'root' | 'does-not-exist';\n\n const instrumentationClientTsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation-client.ts'),\n );\n const instrumentationClientJsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation-client.js'),\n );\n const srcInstrumentationClientTsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation-client.ts'),\n );\n const srcInstrumentationClientJsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation-client.js'),\n );\n\n // https://nextjs.org/docs/app/building-your-application/configuring/src-directory\n // https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation\n // The logic for where Next.js picks up the instrumentation file is as follows:\n // - If there is either an `app` folder or a `pages` folder in the root directory of your Next.js app, Next.js looks\n // for an `instrumentation.ts` file in the root of the Next.js app.\n // - Otherwise, if there is neither an `app` folder or a `pages` folder in the rood directory of your Next.js app,\n // AND if there is an `src` folder, Next.js will look for the `instrumentation.ts` file in the `src` folder.\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n if (instrumentationClientJsExists || instrumentationClientTsExists) {\n instrumentationClientHookLocation = 'root';\n } else {\n instrumentationClientHookLocation = 'does-not-exist';\n }\n } else {\n if (\n srcInstrumentationClientTsExists ||\n srcInstrumentationClientJsExists\n ) {\n instrumentationClientHookLocation = 'src';\n } else {\n instrumentationClientHookLocation = 'does-not-exist';\n }\n }\n\n const newInstrumentationClientFileName = `instrumentation-client.${\n typeScriptDetected ? 'ts' : 'js'\n }`;\n\n if (instrumentationClientHookLocation === 'does-not-exist') {\n let newInstrumentationClientHookLocation: 'root' | 'src';\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n newInstrumentationClientHookLocation = 'root';\n } else if (hasSrcDirectory) {\n newInstrumentationClientHookLocation = 'src';\n } else {\n newInstrumentationClientHookLocation = 'root';\n }\n\n const newInstrumentationClientHookPath =\n newInstrumentationClientHookLocation === 'root'\n ? path.join(process.cwd(), newInstrumentationClientFileName)\n : path.join(process.cwd(), 'src', newInstrumentationClientFileName);\n\n const successfullyCreated = await createNewConfigFile(\n newInstrumentationClientHookPath,\n getInstrumentationClientFileContents(\n selectedProject.keys[0].dsn.public,\n selectedFeatures,\n ),\n );\n\n if (!successfullyCreated) {\n await showCopyPasteInstructions({\n filename: newInstrumentationClientFileName,\n codeSnippet: getInstrumentationClientHookCopyPasteSnippet(\n selectedProject.keys[0].dsn.public,\n selectedFeatures,\n ),\n hint: \"create the file if it doesn't already exist\",\n });\n }\n } else {\n await showCopyPasteInstructions({\n filename:\n srcInstrumentationClientTsExists || instrumentationClientTsExists\n ? 'instrumentation-client.ts'\n : srcInstrumentationClientJsExists || instrumentationClientJsExists\n ? 'instrumentation-client.js'\n : newInstrumentationClientFileName,\n codeSnippet: getInstrumentationClientHookCopyPasteSnippet(\n selectedProject.keys[0].dsn.public,\n selectedFeatures,\n ),\n });\n }\n });\n\n await traceStep('setup-next-config', async () => {\n const withSentryConfigOptionsTemplate = getWithSentryConfigOptionsTemplate({\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n selfHosted,\n sentryUrl,\n tunnelRoute: sdkConfigOptions.tunnelRoute,\n });\n\n const nextConfigPossibleFilesMap = {\n js: 'next.config.js',\n mjs: 'next.config.mjs',\n cjs: 'next.config.cjs',\n ts: 'next.config.ts',\n mts: 'next.config.mts',\n cts: 'next.config.cts',\n };\n\n const foundNextConfigFile = Object.entries(nextConfigPossibleFilesMap).find(\n ([, fileName]) => fs.existsSync(path.join(process.cwd(), fileName)),\n );\n\n if (!foundNextConfigFile) {\n Sentry.setTag('next-config-strategy', 'create');\n\n // Try to figure out whether the user prefers ESM\n let isTypeModule = false;\n try {\n const packageJsonText = await fs.promises.readFile(\n path.join(process.cwd(), 'package.json'),\n 'utf8',\n );\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const packageJson = JSON.parse(packageJsonText);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (packageJson.type === 'module') {\n isTypeModule = true;\n }\n } catch {\n // noop\n }\n\n // We are creating `next.config.(m)js` files by default as they are supported by the most Next.js versions\n const configFilename = isTypeModule\n ? nextConfigPossibleFilesMap.mjs\n : nextConfigPossibleFilesMap.js;\n const configContent = isTypeModule\n ? getNextjsConfigMjsTemplate(withSentryConfigOptionsTemplate)\n : getNextjsConfigCjsTemplate(withSentryConfigOptionsTemplate);\n\n await fs.promises.writeFile(\n path.join(process.cwd(), configFilename),\n configContent,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(configFilename)} with Sentry configuration.`,\n );\n\n return;\n }\n\n const [foundNextConfigFileType, foundNextConfigFileFilename] =\n foundNextConfigFile;\n\n if (foundNextConfigFileType === 'js' || foundNextConfigFileType === 'cjs') {\n Sentry.setTag('next-config-strategy', 'modify');\n\n const nextConfigCjsContent = fs.readFileSync(\n path.join(process.cwd(), foundNextConfigFileFilename),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfigCjsContent.includes('@sentry/nextjs') &&\n nextConfigCjsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.cyan(\n foundNextConfigFileFilename,\n )} already contains Sentry SDK configuration. Should the wizard modify it anyways?`,\n }),\n );\n\n shouldInject = injectAnyhow;\n }\n\n if (shouldInject) {\n await fs.promises.appendFile(\n path.join(process.cwd(), foundNextConfigFileFilename),\n getNextjsConfigCjsAppendix(withSentryConfigOptionsTemplate),\n 'utf8',\n );\n\n clack.log.success(\n `Added Sentry configuration to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}. ${chalk.dim('(you probably want to clean this up a bit!)')}`,\n );\n }\n\n Sentry.setTag('next-config-mod-result', 'success');\n }\n\n if (\n foundNextConfigFileType === 'mjs' ||\n foundNextConfigFileType === 'mts' ||\n foundNextConfigFileType === 'cts' ||\n foundNextConfigFileType === 'ts'\n ) {\n const nextConfigMjsContent = fs.readFileSync(\n path.join(process.cwd(), foundNextConfigFileFilename),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfigMjsContent.includes('@sentry/nextjs') &&\n nextConfigMjsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.cyan(\n foundNextConfigFileFilename,\n )} already contains Sentry SDK configuration. Should the wizard modify it anyways?`,\n }),\n );\n\n shouldInject = injectAnyhow;\n }\n\n try {\n if (shouldInject) {\n const mod = parseModule(nextConfigMjsContent);\n mod.imports.$add({\n from: '@sentry/nextjs',\n imported: 'withSentryConfig',\n local: 'withSentryConfig',\n });\n\n if (probablyIncludesSdk) {\n // Prevent double wrapping like: withSentryConfig(withSentryConfig(nextConfig), { ... })\n // Use AST manipulation instead of string parsing for better reliability\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access\n mod.exports.default.$ast = unwrapSentryConfigAst(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access\n mod.exports.default.$ast,\n );\n }\n\n // Use the shared utility function for wrapping\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n mod.exports.default = wrapWithSentryConfig(\n mod.exports.default,\n withSentryConfigOptionsTemplate,\n );\n\n const newCode = mod.generate().code;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), foundNextConfigFileFilename),\n newCode,\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n clack.log.success(\n `${\n probablyIncludesSdk ? 'Updated' : 'Added'\n } Sentry configuration ${\n probablyIncludesSdk ? 'in' : 'to'\n } ${chalk.cyan(foundNextConfigFileFilename)}. ${chalk.dim(\n '(you probably want to clean this up a bit!)',\n )}`,\n );\n\n Sentry.setTag('next-config-mod-result', 'success');\n }\n } catch {\n Sentry.setTag('next-config-mod-result', 'fail');\n clack.log.warn(\n chalk.yellow(\n `Something went wrong writing to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}.`,\n ),\n );\n clack.log.info(\n `Please put the following code snippet into ${chalk.cyan(\n foundNextConfigFileFilename,\n )}: ${chalk.dim('You probably have to clean it up a bit.')}\\n`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getNextjsConfigEsmCopyPasteSnippet(withSentryConfigOptionsTemplate),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Are you done putting the snippet above into ${chalk.cyan(\n foundNextConfigFileFilename,\n )}?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n }\n });\n}\n\nfunction hasDirectoryPathFromRoot(dirnameOrDirs: string | string[]): boolean {\n const dirPath = Array.isArray(dirnameOrDirs)\n ? path.join(process.cwd(), ...dirnameOrDirs)\n : path.join(process.cwd(), dirnameOrDirs);\n\n return fs.existsSync(dirPath) && fs.lstatSync(dirPath).isDirectory();\n}\n\nasync function createExamplePage(\n selfHosted: boolean,\n selectedProject: SentryProjectData,\n sentryUrl: string,\n typeScriptDetected: boolean,\n): Promise<void> {\n const hasSrcDirectory = hasDirectoryPathFromRoot('src');\n const hasRootAppDirectory = hasDirectoryPathFromRoot('app');\n const hasRootPagesDirectory = hasDirectoryPathFromRoot('pages');\n const hasSrcAppDirectory = hasDirectoryPathFromRoot(['src', 'app']);\n const hasSrcPagesDirectory = hasDirectoryPathFromRoot(['src', 'pages']);\n\n Sentry.setTag('nextjs-app-dir', hasRootAppDirectory || hasSrcAppDirectory);\n\n // If `pages` or an `app` directory exists in the root, we'll put the example page there.\n // `app` directory takes priority over `pages` directory when they coexist, so we prioritize that.\n // https://nextjs.org/docs/app/building-your-application/routing#the-app-router\n\n const appFolderLocation = hasRootAppDirectory\n ? ['app']\n : hasSrcAppDirectory\n ? ['src', 'app']\n : undefined;\n\n let pagesFolderLocation = hasRootPagesDirectory\n ? ['pages']\n : hasSrcPagesDirectory\n ? ['src', 'pages']\n : undefined;\n\n // If the user has neither pages nor app directory we create a pages folder for them\n if (!appFolderLocation && !pagesFolderLocation) {\n const newPagesFolderLocation = hasSrcDirectory\n ? ['src', 'pages']\n : ['pages'];\n fs.mkdirSync(path.join(process.cwd(), ...newPagesFolderLocation), {\n recursive: true,\n });\n\n pagesFolderLocation = newPagesFolderLocation;\n }\n\n if (appFolderLocation) {\n const appFolderPath = path.join(process.cwd(), ...appFolderLocation);\n\n const hasRootLayout = hasRootLayoutFile(appFolderPath);\n\n if (!hasRootLayout) {\n // In case no root layout file exists, we create a simple one so that\n // the example page can be rendered correctly.\n const newRootLayoutFilename = `layout.${\n typeScriptDetected ? 'tsx' : 'jsx'\n }`;\n\n await fs.promises.writeFile(\n path.join(appFolderPath, newRootLayoutFilename),\n getRootLayout(typeScriptDetected),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appFolderLocation, newRootLayoutFilename),\n )}.`,\n );\n }\n\n const examplePageContents = getSentryExamplePageContents({\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n sentryUrl,\n useClient: true,\n isTypeScript: typeScriptDetected,\n });\n\n fs.mkdirSync(path.join(appFolderPath, 'sentry-example-page'), {\n recursive: true,\n });\n\n const newPageFileName = `page.${typeScriptDetected ? 'tsx' : 'jsx'}`;\n\n await fs.promises.writeFile(\n path.join(appFolderPath, 'sentry-example-page', newPageFileName),\n examplePageContents,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appFolderLocation, 'sentry-example-page', newPageFileName),\n )}.`,\n );\n\n fs.mkdirSync(path.join(appFolderPath, 'api', 'sentry-example-api'), {\n recursive: true,\n });\n\n const newRouteFileName = `route.${typeScriptDetected ? 'ts' : 'js'}`;\n\n await fs.promises.writeFile(\n path.join(appFolderPath, 'api', 'sentry-example-api', newRouteFileName),\n getSentryExampleAppDirApiRoute({ isTypeScript: typeScriptDetected }),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(\n ...appFolderLocation,\n 'api',\n 'sentry-example-api',\n newRouteFileName,\n ),\n )}.`,\n );\n } else if (pagesFolderLocation) {\n const examplePageContents = getSentryExamplePageContents({\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n sentryUrl,\n useClient: false,\n isTypeScript: typeScriptDetected,\n });\n\n const examplePageFileName = `sentry-example-page.${\n typeScriptDetected ? 'tsx' : 'jsx'\n }`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), ...pagesFolderLocation, examplePageFileName),\n examplePageContents,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...pagesFolderLocation, examplePageFileName),\n )}.`,\n );\n\n fs.mkdirSync(path.join(process.cwd(), ...pagesFolderLocation, 'api'), {\n recursive: true,\n });\n\n const apiRouteFileName = `sentry-example-api.${\n typeScriptDetected ? 'ts' : 'js'\n }`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), ...pagesFolderLocation, 'api', apiRouteFileName),\n getSentryExamplePagesDirApiRoute({ isTypeScript: typeScriptDetected }),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...pagesFolderLocation, 'api', apiRouteFileName),\n )}.`,\n );\n }\n}\n\n/**\n * Ask users if they want to set the tunnelRoute option.\n * We can't set this by default because it potentially increases hosting bills.\n * It's valuable enough to for users to justify asking the additional question.\n */\nasync function askShouldSetTunnelRoute() {\n return await traceStep('ask-tunnelRoute-option', async (span) => {\n const shouldSetTunnelRoute = await abortIfCancelled(\n clack.select({\n message:\n 'Do you want to route Sentry requests in the browser through your Next.js server to avoid ad blockers?',\n options: [\n {\n label: 'Yes',\n value: true,\n hint: 'Can increase your server load and hosting bill',\n },\n {\n label: 'No',\n value: false,\n hint: 'Browser errors and events might be blocked by ad blockers before being sent to Sentry',\n },\n ],\n initialValue: true,\n }),\n );\n\n if (!shouldSetTunnelRoute) {\n clack.log.info(\n \"Sounds good! We'll leave the option commented for later, just in case :)\",\n );\n }\n\n span?.setAttribute('tunnelRoute', shouldSetTunnelRoute);\n Sentry.setTag('tunnelRoute', shouldSetTunnelRoute);\n\n return shouldSetTunnelRoute;\n });\n}\n\n/**\n * Returns true or false depending on whether we think the user is using Turbopack. May return null in case we aren't sure.\n */\nasync function checkIfLikelyIsUsingTurbopack(): Promise<boolean | null> {\n let packageJsonContent: string;\n try {\n packageJsonContent = await fs.promises.readFile(\n path.join(process.cwd(), 'package.json'),\n 'utf8',\n );\n } catch {\n return null;\n }\n\n return packageJsonContent.includes('--turbo');\n}\n"]}
@@ -1,3 +1,11 @@
1
1
  export declare function getNextJsVersionBucket(version: string | undefined): string;
2
2
  export declare function getMaybeAppDirLocation(): string[] | undefined;
3
3
  export declare function hasRootLayoutFile(appFolderPath: string): boolean;
4
+ /**
5
+ * Unwraps a withSentryConfig call expression using magicast.
6
+ */
7
+ export declare function unwrapSentryConfigAst(astNode: unknown): any;
8
+ /**
9
+ * Wraps a magicast module export with withSentryConfig using magicast
10
+ */
11
+ export declare function wrapWithSentryConfig(moduleExport: unknown, optionsTemplate: string): any;
@@ -23,10 +23,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.hasRootLayoutFile = exports.getMaybeAppDirLocation = exports.getNextJsVersionBucket = void 0;
26
+ exports.wrapWithSentryConfig = exports.unwrapSentryConfigAst = exports.hasRootLayoutFile = exports.getMaybeAppDirLocation = exports.getNextJsVersionBucket = void 0;
27
27
  const fs = __importStar(require("fs"));
28
28
  const path = __importStar(require("path"));
29
29
  const semver_1 = require("semver");
30
+ // @ts-expect-error - magicast is ESM and TS complains about that. It works though
31
+ const magicast_1 = require("magicast");
30
32
  function getNextJsVersionBucket(version) {
31
33
  if (!version) {
32
34
  return 'none';
@@ -63,4 +65,37 @@ function hasRootLayoutFile(appFolderPath) {
63
65
  return ['jsx', 'tsx', 'js'].some((ext) => fs.existsSync(path.join(appFolderPath, `layout.${ext}`)));
64
66
  }
65
67
  exports.hasRootLayoutFile = hasRootLayoutFile;
68
+ /**
69
+ * Unwraps a withSentryConfig call expression using magicast.
70
+ */
71
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
72
+ function unwrapSentryConfigAst(astNode) {
73
+ // Check if this is a CallExpression with withSentryConfig
74
+ if (isAstNode(astNode) &&
75
+ astNode.type === 'CallExpression' &&
76
+ astNode.callee?.type === 'Identifier' &&
77
+ astNode.callee?.name === 'withSentryConfig') {
78
+ // Return the first argument (the config being wrapped)
79
+ return astNode.arguments?.[0] || astNode;
80
+ }
81
+ return astNode;
82
+ }
83
+ exports.unwrapSentryConfigAst = unwrapSentryConfigAst;
84
+ /**
85
+ * Wraps a magicast module export with withSentryConfig using magicast
86
+ */
87
+ function wrapWithSentryConfig(moduleExport, optionsTemplate) {
88
+ return magicast_1.builders.functionCall('withSentryConfig', moduleExport, magicast_1.builders.raw(optionsTemplate));
89
+ }
90
+ exports.wrapWithSentryConfig = wrapWithSentryConfig;
91
+ function isAstNode(astNode) {
92
+ return (typeof astNode === 'object' &&
93
+ astNode !== null &&
94
+ 'type' in astNode &&
95
+ 'callee' in astNode &&
96
+ typeof astNode.callee === 'object' &&
97
+ astNode.callee !== null &&
98
+ 'type' in astNode.callee &&
99
+ 'name' in astNode.callee);
100
+ }
66
101
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/nextjs/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,mCAA2C;AAE3C,SAAgB,sBAAsB,CAAC,OAA2B;IAChE,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,MAAM,CAAC;KACf;IAED,IAAI;QACF,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,SAAS,CAAC;SAClB;QACD,MAAM,YAAY,GAAG,IAAA,cAAK,EAAC,MAAM,CAAC,CAAC;QACnC,IAAI,YAAY,IAAI,EAAE,EAAE;YACtB,OAAO,GAAG,YAAY,IAAI,CAAC;SAC5B;QACD,OAAO,SAAS,CAAC;KAClB;IAAC,MAAM;QACN,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAlBD,wDAkBC;AAED,SAAgB,sBAAsB;IACpC,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;IACxD,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAElE,OAAO,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC;QACnC,EAAE,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,WAAW,EAAE;QAC3C,CAAC,CAAC,CAAC,KAAK,CAAC;QACT,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC;YACjC,EAAE,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,WAAW,EAAE;YAChD,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC;YAChB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAXD,wDAWC;AAED,SAAgB,iBAAiB,CAAC,aAAqB;IACrD,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CACvC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,GAAG,EAAE,CAAC,CAAC,CACzD,CAAC;AACJ,CAAC;AAJD,8CAIC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { major, minVersion } from 'semver';\n\nexport function getNextJsVersionBucket(version: string | undefined) {\n if (!version) {\n return 'none';\n }\n\n try {\n const minVer = minVersion(version);\n if (!minVer) {\n return 'invalid';\n }\n const majorVersion = major(minVer);\n if (majorVersion >= 11) {\n return `${majorVersion}.x`;\n }\n return '<11.0.0';\n } catch {\n return 'unknown';\n }\n}\n\nexport function getMaybeAppDirLocation() {\n const maybeAppDirPath = path.join(process.cwd(), 'app');\n const maybeSrcAppDirPath = path.join(process.cwd(), 'src', 'app');\n\n return fs.existsSync(maybeAppDirPath) &&\n fs.lstatSync(maybeAppDirPath).isDirectory()\n ? ['app']\n : fs.existsSync(maybeSrcAppDirPath) &&\n fs.lstatSync(maybeSrcAppDirPath).isDirectory()\n ? ['src', 'app']\n : undefined;\n}\n\nexport function hasRootLayoutFile(appFolderPath: string) {\n return ['jsx', 'tsx', 'js'].some((ext) =>\n fs.existsSync(path.join(appFolderPath, `layout.${ext}`)),\n );\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/nextjs/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,mCAA2C;AAE3C,kFAAkF;AAClF,uCAAoC;AAEpC,SAAgB,sBAAsB,CAAC,OAA2B;IAChE,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,MAAM,CAAC;KACf;IAED,IAAI;QACF,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,SAAS,CAAC;SAClB;QACD,MAAM,YAAY,GAAG,IAAA,cAAK,EAAC,MAAM,CAAC,CAAC;QACnC,IAAI,YAAY,IAAI,EAAE,EAAE;YACtB,OAAO,GAAG,YAAY,IAAI,CAAC;SAC5B;QACD,OAAO,SAAS,CAAC;KAClB;IAAC,MAAM;QACN,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAlBD,wDAkBC;AAED,SAAgB,sBAAsB;IACpC,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;IACxD,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC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Ae,CAAC,CAC9B,CAAC;AACJ,CAAC;AAVD,oDAUC;AAED,SAAS,SAAS,CAAC,OAAgB;IAKjC,OAAO,CACL,OAAO,OAAO,KAAK,QAAQ;QAC3B,OAAO,KAAK,IAAI;QAChB,MAAM,IAAI,OAAO;QACjB,QAAQ,IAAI,OAAO;QACnB,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ;QAClC,OAAO,CAAC,MAAM,KAAK,IAAI;QACvB,MAAM,IAAI,OAAO,CAAC,MAAM;QACxB,MAAM,IAAI,OAAO,CAAC,MAAM,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { major, minVersion } from 'semver';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { builders } from 'magicast';\n\nexport function getNextJsVersionBucket(version: string | undefined) {\n if (!version) {\n return 'none';\n }\n\n try {\n const minVer = minVersion(version);\n if (!minVer) {\n return 'invalid';\n }\n const majorVersion = major(minVer);\n if (majorVersion >= 11) {\n return `${majorVersion}.x`;\n }\n return '<11.0.0';\n } catch {\n return 'unknown';\n }\n}\n\nexport function getMaybeAppDirLocation() {\n const maybeAppDirPath = path.join(process.cwd(), 'app');\n const maybeSrcAppDirPath = path.join(process.cwd(), 'src', 'app');\n\n return fs.existsSync(maybeAppDirPath) &&\n fs.lstatSync(maybeAppDirPath).isDirectory()\n ? ['app']\n : fs.existsSync(maybeSrcAppDirPath) &&\n fs.lstatSync(maybeSrcAppDirPath).isDirectory()\n ? ['src', 'app']\n : undefined;\n}\n\nexport function hasRootLayoutFile(appFolderPath: string) {\n return ['jsx', 'tsx', 'js'].some((ext) =>\n fs.existsSync(path.join(appFolderPath, `layout.${ext}`)),\n );\n}\n\n/**\n * Unwraps a withSentryConfig call expression using magicast.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function unwrapSentryConfigAst(astNode: unknown): any {\n // Check if this is a CallExpression with withSentryConfig\n if (\n isAstNode(astNode) &&\n astNode.type === 'CallExpression' &&\n astNode.callee?.type === 'Identifier' &&\n astNode.callee?.name === 'withSentryConfig'\n ) {\n // Return the first argument (the config being wrapped)\n return astNode.arguments?.[0] || astNode;\n }\n\n return astNode;\n}\n\n/**\n * Wraps a magicast module export with withSentryConfig using magicast\n */\nexport function wrapWithSentryConfig(\n moduleExport: unknown,\n optionsTemplate: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n return builders.functionCall(\n 'withSentryConfig',\n moduleExport,\n builders.raw(optionsTemplate),\n );\n}\n\nfunction isAstNode(astNode: unknown): astNode is {\n type: string;\n callee?: { type: string; name?: string };\n arguments?: unknown[];\n} {\n return (\n typeof astNode === 'object' &&\n astNode !== null &&\n 'type' in astNode &&\n 'callee' in astNode &&\n typeof astNode.callee === 'object' &&\n astNode.callee !== null &&\n 'type' in astNode.callee &&\n 'name' in astNode.callee\n );\n}\n"]}
@@ -35,6 +35,7 @@ const semver_1 = require("semver");
35
35
  const telemetry_1 = require("../telemetry");
36
36
  const clack_1 = require("../utils/clack");
37
37
  const package_json_1 = require("../utils/package-json");
38
+ const mcp_config_1 = require("../utils/clack/mcp-config");
38
39
  const sdk_example_1 = require("./sdk-example");
39
40
  const sdk_setup_1 = require("./sdk-setup");
40
41
  const utils_1 = require("./utils");
@@ -125,6 +126,8 @@ async function runNuxtWizardWithTelemetry(options) {
125
126
  }
126
127
  await (0, clack_1.runPrettierIfInstalled)({ cwd: undefined });
127
128
  await (0, sdk_setup_1.confirmReadImportDocs)(deploymentPlatform);
129
+ // Offer optional project-scoped MCP config for Sentry with org and project scope
130
+ await (0, mcp_config_1.offerProjectScopedMcpConfig)(selectedProject.organization.slug, selectedProject.slug);
128
131
  clack.outro(buildOutroMessage(shouldCreateExamplePage, shouldCreateExampleButton));
129
132
  }
130
133
  exports.runNuxtWizardWithTelemetry = runNuxtWizardWithTelemetry;
@@ -1 +1 @@
1
- {"version":3,"file":"nuxt-wizard.js","sourceRoot":"","sources":["../../../src/nuxt/nu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C,IAAI,CAAC,CAC7B,CAAC;SACH;KACF;IAED,MAAM,IAAA,8BAAsB,EAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IAEjD,MAAM,IAAA,iCAAqB,EAAC,kBAAkB,CAAC,CAAC;IAEhD,KAAK,CAAC,KAAK,CACT,iBAAiB,CAAC,uBAAuB,EAAE,yBAAyB,CAAC,CACtE,CAAC;AACJ,CAAC;AArHD,gEAqHC;AAED,SAAS,iBAAiB,CACxB,uBAAgC,EAChC,yBAAkC;IAElC,IAAI,GAAG,GAAG,eAAK,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAEvE,IAAI,uBAAuB,EAAE;QAC3B,GAAG,IAAI,+CAA+C,eAAK,CAAC,IAAI,CAC9D,wBAAwB,CACzB,GAAG,CAAC;KACN;IACD,IAAI,yBAAyB,EAAE;QAC7B,GAAG,IAAI,iDAAiD,eAAK,CAAC,IAAI,CAChE,uBAAuB,CACxB,yCAAyC,CAAC;KAC5C;IAED,GAAG,IAAI,kEAAkE,eAAK,CAAC,SAAS,CACtF,0DAA0D,CAC3D,EAAE,CAAC;IAEJ,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as Sentry from '@sentry/node';\nimport chalk from 'chalk';\nimport { lt, minVersion } from 'semver';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n abort,\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n askShouldCreateExampleComponent,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n getPackageManager,\n installPackage,\n printWelcome,\n runPrettierIfInstalled,\n} from '../utils/clack';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport type { WizardOptions } from '../utils/types';\nimport {\n createExampleComponent,\n createExamplePage,\n supportsExamplePage,\n} from './sdk-example';\nimport {\n addNuxtOverrides,\n addSDKModule,\n askDeploymentPlatform,\n confirmReadImportDocs,\n createConfigFiles,\n getNuxtConfig,\n} from './sdk-setup';\nimport { isNuxtV4 } from './utils';\n\nexport function runNuxtWizard(options: WizardOptions) {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'nuxt',\n wizardOptions: options,\n },\n () => runNuxtWizardWithTelemetry(options),\n );\n}\n\nexport async function runNuxtWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n const { promoCode, telemetryEnabled, forceInstall } = options;\n\n printWelcome({\n wizardName: 'Sentry Nuxt Wizard',\n promoCode,\n 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, 'nuxt', 'Nuxt');\n\n const nuxtVersion = getPackageVersion('nuxt', packageJson);\n Sentry.setTag('nuxt-version', nuxtVersion);\n\n const minVer = minVersion(nuxtVersion || '0.0.0');\n\n if (!nuxtVersion || !minVer || lt(minVer, '3.7.0')) {\n clack.log.warn(\n \"It seems you're using a Nuxt version <3.7.0 which is not supported by Sentry.\\nWe recommend upgrading to the latest version before you continue.\",\n );\n const shouldContinue = await abortIfCancelled(\n clack.select({\n message: 'Do you want to continue anyway?',\n options: [\n {\n label: 'Yes, continue',\n hint: 'The SDK might not work correctly',\n value: true,\n },\n { label: \"No, I'll upgrade first\", value: false },\n ],\n }),\n );\n if (!shouldContinue) {\n await abort('Exiting Wizard', 0);\n return;\n }\n }\n\n const { authToken, selectedProject, selfHosted, sentryUrl } =\n await getOrAskForProjectData(options, 'javascript-nuxt');\n\n const packageManager = await getPackageManager();\n\n await addNuxtOverrides(packageJson, packageManager, minVer, forceInstall);\n\n const sdkAlreadyInstalled = hasPackageInstalled('@sentry/nuxt', packageJson);\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n await installPackage({\n packageName: '@sentry/nuxt@^10',\n alreadyInstalled: sdkAlreadyInstalled,\n packageManager,\n forceInstall,\n });\n\n await addDotEnvSentryBuildPluginFile(authToken);\n\n const nuxtConfig = await traceStep('load-nuxt-config', getNuxtConfig);\n\n const projectData = {\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n projectId: selectedProject.id,\n url: sentryUrl,\n selfHosted,\n };\n\n const deploymentPlatform = await askDeploymentPlatform();\n Sentry.setTag('deployment-platform', deploymentPlatform);\n\n await traceStep('configure-sdk', async () => {\n await addSDKModule(nuxtConfig, projectData, deploymentPlatform);\n await createConfigFiles(selectedProject.keys[0].dsn.public);\n });\n\n let shouldCreateExamplePage = false;\n let shouldCreateExampleButton = false;\n\n const isV4 = await isNuxtV4(nuxtConfig, nuxtVersion);\n const canCreateExamplePage = await supportsExamplePage(isV4);\n Sentry.setTag('supports-example-page-creation', canCreateExamplePage);\n\n if (canCreateExamplePage) {\n shouldCreateExamplePage = await askShouldCreateExamplePage();\n\n if (shouldCreateExamplePage) {\n await traceStep('create-example-page', async () =>\n createExamplePage(isV4, projectData),\n );\n }\n } else {\n shouldCreateExampleButton = await askShouldCreateExampleComponent();\n\n if (shouldCreateExampleButton) {\n await traceStep('create-example-component', async () =>\n createExampleComponent(isV4),\n );\n }\n }\n\n await runPrettierIfInstalled({ cwd: undefined });\n\n await confirmReadImportDocs(deploymentPlatform);\n\n clack.outro(\n buildOutroMessage(shouldCreateExamplePage, shouldCreateExampleButton),\n );\n}\n\nfunction buildOutroMessage(\n shouldCreateExamplePage: boolean,\n shouldCreateExampleButton: boolean,\n): string {\n let msg = chalk.green('\\nSuccessfully installed the Sentry Nuxt SDK!');\n\n if (shouldCreateExamplePage) {\n msg += `\\n\\nYou can validate your setup by visiting ${chalk.cyan(\n '\"/sentry-example-page\"',\n )}.`;\n }\n if (shouldCreateExampleButton) {\n msg += `\\n\\nYou can validate your setup by adding the ${chalk.cyan(\n '`SentryExampleButton`',\n )} component to a page and triggering it.`;\n }\n\n msg += `\\n\\nCheck out the SDK documentation for further configuration: ${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/',\n )}`;\n\n return msg;\n}\n"]}
1
+ {"version":3,"file":"nuxt-wizard.js","sourceRoot":"","sources":["../../../src/nuxt/nuxt-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,sDAAwC;AACxC,qDAAuC;AACvC,kDAA0B;AAC1B,mCAAwC;AACxC,4CAAwD;AACxD,0CAcwB;AACxB,wDAA+E;AAE/E,0DAAwE;AACxE,+CAIuB;AACvB,2CAOqB;AACrB,mCAAmC;AAEnC,SAAgB,aAAa,CAAC,OAAsB;IAClD,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;QACjC,WAAW,EAAE,MAAM;QACnB,aAAa,EAAE,OAAO;KACvB,EACD,GAAG,EAAE,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAC1C,CAAC;AACJ,CAAC;AATD,sCASC;AAEM,KAAK,UAAU,0BAA0B,CAC9C,OAAsB;IAEtB,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAE9D,IAAA,oBAAY,EAAC;QACX,UAAU,EAAE,oBAAoB;QAChC,SAAS;QACT,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,IAAA,yCAAiC,EAAC;QACtC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,MAAM,IAAA,yBAAiB,GAAE,CAAC;IAE9C,MAAM,IAAA,gCAAwB,EAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAE5D,MAAM,WAAW,GAAG,IAAA,gCAAiB,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC3D,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW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SACH;KACF;SAAM;QACL,yBAAyB,GAAG,MAAM,IAAA,uCAA+B,GAAE,CAAC;QAEpE,IAAI,yBAAyB,EAAE;YAC7B,MAAM,IAAA,qBAAS,EAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE,CACrD,IAAA,oCAAsB,EAAC,IAAI,CAAC,CAC7B,CAAC;SACH;KACF;IAED,MAAM,IAAA,8BAAsB,EAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IAEjD,MAAM,IAAA,iCAAqB,EAAC,kBAAkB,CAAC,CAAC;IAEhD,iFAAiF;IACjF,MAAM,IAAA,wCAA2B,EAC/B,eAAe,CAAC,YAAY,CAAC,IAAI,EACjC,eAAe,CAAC,IAAI,CACrB,CAAC;IAEF,KAAK,CAAC,KAAK,CACT,iBAAiB,CAAC,uBAAuB,EAAE,yBAAyB,CAAC,CACtE,CAAC;AACJ,CAAC;AA3HD,gEA2HC;AAED,SAAS,iBAAiB,CACxB,uBAAgC,EAChC,yBAAkC;IAElC,IAAI,GAAG,GAAG,eAAK,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAEvE,IAAI,uBAAuB,EAAE;QAC3B,GAAG,IAAI,+CAA+C,eAAK,CAAC,IAAI,CAC9D,wBAAwB,CACzB,GAAG,CAAC;KACN;IACD,IAAI,yBAAyB,EAAE;QAC7B,GAAG,IAAI,iDAAiD,eAAK,CAAC,IAAI,CAChE,uBAAuB,CACxB,yCAAyC,CAAC;KAC5C;IAED,GAAG,IAAI,kEAAkE,eAAK,CAAC,SAAS,CACtF,0DAA0D,CAC3D,EAAE,CAAC;IAEJ,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as Sentry from '@sentry/node';\nimport chalk from 'chalk';\nimport { lt, minVersion } from 'semver';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n abort,\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n askShouldCreateExampleComponent,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n getPackageManager,\n installPackage,\n printWelcome,\n runPrettierIfInstalled,\n} from '../utils/clack';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport type { WizardOptions } from '../utils/types';\nimport { offerProjectScopedMcpConfig } from '../utils/clack/mcp-config';\nimport {\n createExampleComponent,\n createExamplePage,\n supportsExamplePage,\n} from './sdk-example';\nimport {\n addNuxtOverrides,\n addSDKModule,\n askDeploymentPlatform,\n confirmReadImportDocs,\n createConfigFiles,\n getNuxtConfig,\n} from './sdk-setup';\nimport { isNuxtV4 } from './utils';\n\nexport function runNuxtWizard(options: WizardOptions) {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'nuxt',\n wizardOptions: options,\n },\n () => runNuxtWizardWithTelemetry(options),\n );\n}\n\nexport async function runNuxtWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n const { promoCode, telemetryEnabled, forceInstall } = options;\n\n printWelcome({\n wizardName: 'Sentry Nuxt Wizard',\n promoCode,\n 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, 'nuxt', 'Nuxt');\n\n const nuxtVersion = getPackageVersion('nuxt', packageJson);\n Sentry.setTag('nuxt-version', nuxtVersion);\n\n const minVer = minVersion(nuxtVersion || '0.0.0');\n\n if (!nuxtVersion || !minVer || lt(minVer, '3.7.0')) {\n clack.log.warn(\n \"It seems you're using a Nuxt version <3.7.0 which is not supported by Sentry.\\nWe recommend upgrading to the latest version before you continue.\",\n );\n const shouldContinue = await abortIfCancelled(\n clack.select({\n message: 'Do you want to continue anyway?',\n options: [\n {\n label: 'Yes, continue',\n hint: 'The SDK might not work correctly',\n value: true,\n },\n { label: \"No, I'll upgrade first\", value: false },\n ],\n }),\n );\n if (!shouldContinue) {\n await abort('Exiting Wizard', 0);\n return;\n }\n }\n\n const { authToken, selectedProject, selfHosted, sentryUrl } =\n await getOrAskForProjectData(options, 'javascript-nuxt');\n\n const packageManager = await getPackageManager();\n\n await addNuxtOverrides(packageJson, packageManager, minVer, forceInstall);\n\n const sdkAlreadyInstalled = hasPackageInstalled('@sentry/nuxt', packageJson);\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n await installPackage({\n packageName: '@sentry/nuxt@^10',\n alreadyInstalled: sdkAlreadyInstalled,\n packageManager,\n forceInstall,\n });\n\n await addDotEnvSentryBuildPluginFile(authToken);\n\n const nuxtConfig = await traceStep('load-nuxt-config', getNuxtConfig);\n\n const projectData = {\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n projectId: selectedProject.id,\n url: sentryUrl,\n selfHosted,\n };\n\n const deploymentPlatform = await askDeploymentPlatform();\n Sentry.setTag('deployment-platform', deploymentPlatform);\n\n await traceStep('configure-sdk', async () => {\n await addSDKModule(nuxtConfig, projectData, deploymentPlatform);\n await createConfigFiles(selectedProject.keys[0].dsn.public);\n });\n\n let shouldCreateExamplePage = false;\n let shouldCreateExampleButton = false;\n\n const isV4 = await isNuxtV4(nuxtConfig, nuxtVersion);\n const canCreateExamplePage = await supportsExamplePage(isV4);\n Sentry.setTag('supports-example-page-creation', canCreateExamplePage);\n\n if (canCreateExamplePage) {\n shouldCreateExamplePage = await askShouldCreateExamplePage();\n\n if (shouldCreateExamplePage) {\n await traceStep('create-example-page', async () =>\n createExamplePage(isV4, projectData),\n );\n }\n } else {\n shouldCreateExampleButton = await askShouldCreateExampleComponent();\n\n if (shouldCreateExampleButton) {\n await traceStep('create-example-component', async () =>\n createExampleComponent(isV4),\n );\n }\n }\n\n await runPrettierIfInstalled({ cwd: undefined });\n\n await confirmReadImportDocs(deploymentPlatform);\n\n // Offer optional project-scoped MCP config for Sentry with org and project scope\n await offerProjectScopedMcpConfig(\n selectedProject.organization.slug,\n selectedProject.slug,\n );\n\n clack.outro(\n buildOutroMessage(shouldCreateExamplePage, shouldCreateExampleButton),\n );\n}\n\nfunction buildOutroMessage(\n shouldCreateExamplePage: boolean,\n shouldCreateExampleButton: boolean,\n): string {\n let msg = chalk.green('\\nSuccessfully installed the Sentry Nuxt SDK!');\n\n if (shouldCreateExamplePage) {\n msg += `\\n\\nYou can validate your setup by visiting ${chalk.cyan(\n '\"/sentry-example-page\"',\n )}.`;\n }\n if (shouldCreateExampleButton) {\n msg += `\\n\\nYou can validate your setup by adding the ${chalk.cyan(\n '`SentryExampleButton`',\n )} component to a page and triggering it.`;\n }\n\n msg += `\\n\\nCheck out the SDK documentation for further configuration: ${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/',\n )}`;\n\n return msg;\n}\n"]}
@@ -3,5 +3,5 @@ import * as recast from 'recast';
3
3
  import x = recast.types;
4
4
  import t = x.namedTypes;
5
5
  export declare function addSentryToExpoMetroConfig(): Promise<void>;
6
- export declare function patchMetroInMemory(mod: ProxifiedModule): boolean;
7
- export declare function addSentryExpoConfigRequire(program: t.Program): void;
6
+ export declare function patchMetroInMemory(mod: ProxifiedModule, metroConfigPath: string): boolean;
7
+ export declare function addSentryExpoConfigRequire(program: t.Program, metroConfigPath: string): void;