@sentry/wizard 6.4.0 → 6.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/e2e-tests/tests/angular-17.test.js +1 -0
- package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
- package/dist/e2e-tests/tests/angular-19.test.js +1 -0
- package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
- package/dist/e2e-tests/tests/expo.test.js +13 -3
- package/dist/e2e-tests/tests/expo.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js +6 -0
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +6 -0
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-native.test.js +14 -4
- package/dist/e2e-tests/tests/react-native.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +2 -1
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js +13 -2
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js +4 -0
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
- package/dist/src/android/android-wizard.js +9 -1
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/android/manifest.d.ts +1 -1
- package/dist/src/android/manifest.js +2 -2
- package/dist/src/android/manifest.js.map +1 -1
- package/dist/src/android/templates.d.ts +1 -1
- package/dist/src/android/templates.js +4 -1
- package/dist/src/android/templates.js.map +1 -1
- package/dist/src/angular/codemods/main.js +1 -0
- package/dist/src/angular/codemods/main.js.map +1 -1
- package/dist/src/apple/templates.js +0 -2
- package/dist/src/apple/templates.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +1 -1
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.js +6 -4
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/templates.js +10 -2
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/react-native/javascript.d.ts +6 -4
- package/dist/src/react-native/javascript.js +11 -7
- package/dist/src/react-native/javascript.js.map +1 -1
- package/dist/src/react-native/react-native-wizard.js +9 -0
- package/dist/src/react-native/react-native-wizard.js.map +1 -1
- package/dist/src/react-native/xcode.js +5 -3
- package/dist/src/react-native/xcode.js.map +1 -1
- package/dist/src/remix/sdk-setup.js +1 -0
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup/setup.d.ts +6 -0
- package/dist/src/sveltekit/sdk-setup/setup.js +4 -1
- package/dist/src/sveltekit/sdk-setup/setup.js.map +1 -1
- package/dist/src/sveltekit/templates.js +9 -0
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/utils/clack/index.js +4 -1
- package/dist/src/utils/clack/index.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/test/angular/angular-wizard.test.js +113 -17
- package/dist/test/angular/angular-wizard.test.js.map +1 -1
- package/dist/test/apple/code-tools.test.js +0 -3
- package/dist/test/apple/code-tools.test.js.map +1 -1
- package/dist/test/apple/templates.test.js +0 -4
- package/dist/test/apple/templates.test.js.map +1 -1
- package/dist/test/nextjs/templates.test.js +33 -22
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/nuxt/templates.test.js +50 -10
- package/dist/test/nuxt/templates.test.js.map +1 -1
- package/dist/test/react-native/javascript.test.js +225 -0
- package/dist/test/react-native/javascript.test.js.map +1 -1
- package/dist/test/react-native/xcode.test.js +20 -2
- package/dist/test/react-native/xcode.test.js.map +1 -1
- package/dist/test/remix/client-entry.test.js +10 -4
- package/dist/test/remix/client-entry.test.js.map +1 -1
- package/dist/test/sveltekit/templates.test.js +214 -0
- package/dist/test/sveltekit/templates.test.js.map +1 -1
- package/package.json +3 -3
|
@@ -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,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,MAAM,EAAE,SAAS,CAAC,CAAC;IAE/D,MAAM,WAAW,GAAG,IAAA,gCAAiB,EAAC,MA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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
|
+
{"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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Q,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:\n 'Warning: The Sentry SDK is only compatible with Turbopack on Next.js version 15.4.1 or later.',\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"]}
|
|
@@ -139,8 +139,9 @@ import * as Sentry from "@sentry/nextjs";
|
|
|
139
139
|
Sentry.init({
|
|
140
140
|
dsn: "${dsn}",${performanceOptions}${logsOptions}
|
|
141
141
|
|
|
142
|
-
//
|
|
143
|
-
|
|
142
|
+
// Enable sending user PII (Personally Identifiable Information)
|
|
143
|
+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
|
|
144
|
+
sendDefaultPii: true,
|
|
144
145
|
});
|
|
145
146
|
`;
|
|
146
147
|
}
|
|
@@ -183,8 +184,9 @@ import * as Sentry from "@sentry/nextjs";
|
|
|
183
184
|
Sentry.init({
|
|
184
185
|
dsn: "${dsn}",${integrationsOptions}${performanceOptions}${logsOptions}${replayOptions}
|
|
185
186
|
|
|
186
|
-
//
|
|
187
|
-
|
|
187
|
+
// Enable sending user PII (Personally Identifiable Information)
|
|
188
|
+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
|
|
189
|
+
sendDefaultPii: true,
|
|
188
190
|
});
|
|
189
191
|
|
|
190
192
|
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/nextjs/templates.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,0CAAiD;AAUjD,SAAgB,kCAAkC,CAAC,EACjD,OAAO,EACP,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,GACe;IACxB,OAAO;;;;YAIG,OAAO;gBACH,WAAW,KACvB,UAAU,CAAC,CAAC,CAAC,qBAAqB,SAAS,IAAI,CAAC,CAAC,CAAC,EACpD;;;;;;;;;;;SAYI,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,oBAC1B;;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,YAAY,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;GAW1D,IAAI;IACF,CAAC,CAAC;;EAEJ;IACE,CAAC,CAAC,EACN;;;;;;;CAOC,CAAC;AA7BW,QAAA,iCAAiC,qCA6B5C","sourcesContent":["import chalk from 'chalk';\nimport { makeCodeSnippet } from '../utils/clack';\n\ntype WithSentryConfigOptions = {\n orgSlug: string;\n projectSlug: string;\n selfHosted: boolean;\n sentryUrl: string;\n tunnelRoute: boolean;\n};\n\nexport function getWithSentryConfigOptionsTemplate({\n orgSlug,\n projectSlug,\n selfHosted,\n tunnelRoute,\n sentryUrl,\n}: WithSentryConfigOptions): string {\n return `{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"${orgSlug}\",\n project: \"${projectSlug}\",${\n selfHosted ? `\\n sentryUrl: \"${sentryUrl}\",` : ''\n }\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // ${\n tunnelRoute ? 'Route' : 'Uncomment to route'\n } browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n ${tunnelRoute ? '' : '// '}tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }`;\n}\n\nexport function getNextjsConfigCjsTemplate(\n withSentryConfigOptionsTemplate: string,\n): string {\n return `const { withSentryConfig } = require(\"@sentry/nextjs\");\n\n/** @type {import('next').NextConfig} */\nconst nextConfig = {};\n\nmodule.exports = withSentryConfig(\n nextConfig,\n ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigMjsTemplate(\n withSentryConfigOptionsTemplate: string,\n): string {\n return `import { withSentryConfig } from \"@sentry/nextjs\";\n\n/** @type {import('next').NextConfig} */\nconst nextConfig = {};\n\nexport default withSentryConfig(\n nextConfig,\n ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigCjsAppendix(\n withSentryConfigOptionsTemplate: string,\n): string {\n return `\n\n// Injected content via Sentry wizard below\n\nconst { withSentryConfig } = require(\"@sentry/nextjs\");\n\nmodule.exports = withSentryConfig(\n module.exports,\n ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigEsmCopyPasteSnippet(\n withSentryConfigOptionsTemplate: string,\n): string {\n return `\n\n// next.config.mjs\nimport { withSentryConfig } from \"@sentry/nextjs\";\n\nexport default withSentryConfig(\n yourNextConfig,\n ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nfunction getClientIntegrationsSnippet(features: { replay: boolean }) {\n if (features.replay) {\n return `\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],`;\n }\n\n return '';\n}\n\nexport function getSentryServersideConfigContents(\n dsn: string,\n config: 'server' | 'edge',\n selectedFeaturesMap: {\n replay: boolean;\n performance: boolean;\n logs: boolean;\n },\n): string {\n let primer;\n if (config === 'server') {\n primer = `// This file configures the initialization of Sentry on the server.\n// The config you add here will be used whenever the server handles a request.\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/`;\n } else if (config === 'edge') {\n primer = `// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n// The config you add here will be used whenever one of the edge features is loaded.\n// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/`;\n }\n\n let performanceOptions = '';\n if (selectedFeaturesMap.performance) {\n performanceOptions += `\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,`;\n }\n\n let logsOptions = '';\n if (selectedFeaturesMap.logs) {\n logsOptions += `\n\n // Enable logs to be sent to Sentry\n enableLogs: true,`;\n }\n\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n return `${primer}\n\nimport * as Sentry from \"@sentry/nextjs\";\n\nSentry.init({\n dsn: \"${dsn}\",${performanceOptions}${logsOptions}\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n});\n`;\n}\n\nexport function getInstrumentationClientFileContents(\n dsn: string,\n selectedFeaturesMap: {\n replay: boolean;\n performance: boolean;\n logs: boolean;\n },\n): string {\n const integrationsOptions = getClientIntegrationsSnippet({\n replay: selectedFeaturesMap.replay,\n });\n\n let replayOptions = '';\n\n if (selectedFeaturesMap.replay) {\n replayOptions += `\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,`;\n }\n\n let performanceOptions = '';\n if (selectedFeaturesMap.performance) {\n performanceOptions += `\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,`;\n }\n\n let logsOptions = '';\n if (selectedFeaturesMap.logs) {\n logsOptions += `\n // Enable logs to be sent to Sentry\n enableLogs: true,`;\n }\n\n return `// This file configures the initialization of Sentry on the client.\n// The added config here will be used whenever a users loads a page in their browser.\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\nimport * as Sentry from \"@sentry/nextjs\";\n\nSentry.init({\n dsn: \"${dsn}\",${integrationsOptions}${performanceOptions}${logsOptions}${replayOptions}\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n});\n\nexport const onRouterTransitionStart = Sentry.captureRouterTransitionStart;`;\n}\n\nexport function getSentryExamplePageContents(options: {\n selfHosted: boolean;\n sentryUrl: string;\n orgSlug: string;\n projectId: string;\n useClient: boolean;\n isTypeScript?: boolean;\n}): string {\n const issuesPageLink = options.selfHosted\n ? `${options.sentryUrl}organizations/${options.orgSlug}/issues/?project=${options.projectId}`\n : `https://${options.orgSlug}.sentry.io/issues/?project=${options.projectId}`;\n\n return `${\n options.useClient ? '\"use client\";\\n\\n' : ''\n }import Head from \"next/head\";\nimport * as Sentry from \"@sentry/nextjs\";\nimport { useState, useEffect } from \"react\";\n\nclass SentryExampleFrontendError extends Error {\n constructor(message${options.isTypeScript ? ': string | undefined' : ''}) {\n super(message);\n this.name = \"SentryExampleFrontendError\";\n }\n}\n\nexport default function Page() {\n const [hasSentError, setHasSentError] = useState(false);\n const [isConnected, setIsConnected] = useState(true);\n \n useEffect(() => {\n async function checkConnectivity() {\n const result = await Sentry.diagnoseSdkConnectivity();\n setIsConnected(result !== 'sentry-unreachable');\n }\n checkConnectivity();\n }, []);\n\n return (\n <div>\n <Head>\n <title>sentry-example-page</title>\n <meta name=\"description\" content=\"Test Sentry for your Next.js app!\" />\n </Head>\n\n <main>\n <div className=\"flex-spacer\" />\n <svg height=\"40\" width=\"40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z\" fill=\"currentcolor\"/>\n </svg>\n <h1>\n sentry-example-page\n </h1>\n\n <p className=\"description\">\n Click the button below, and view the sample error on the Sentry <a target=\"_blank\" href=\"${issuesPageLink}\">Issues Page</a>.\n For more details about setting up Sentry, <a target=\"_blank\"\n href=\"https://docs.sentry.io/platforms/javascript/guides/nextjs/\">read our docs</a>.\n </p>\n\n <button\n type=\"button\"\n onClick={async () => {\n await Sentry.startSpan({\n name: 'Example Frontend/Backend Span',\n op: 'test'\n }, async () => {\n const res = await fetch(\"/api/sentry-example-api\");\n if (!res.ok) {\n setHasSentError(true);\n }\n });\n throw new SentryExampleFrontendError(\"This error is raised on the frontend of the example page.\");\n }}\n disabled={!isConnected}\n >\n <span>\n Throw Sample Error\n </span>\n </button>\n\n {hasSentError ? (\n <p className=\"success\">\n Error sent to Sentry.\n </p>\n ) : !isConnected ? (\n <div className=\"connectivity-error\">\n <p>It looks like network requests to Sentry are being blocked, which will prevent errors from being captured. Try disabling your ad-blocker to complete the test.</p>\n </div>\n ) : (\n <div className=\"success_placeholder\" />\n )}\n\n <div className=\"flex-spacer\" />\n \n </main>\n\n <style>{\\`\n main {\n display: flex;\n min-height: 100vh;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 16px;\n padding: 16px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", sans-serif;\n }\n\n h1 {\n padding: 0px 4px;\n border-radius: 4px;\n background-color: rgba(24, 20, 35, 0.03);\n font-family: monospace;\n font-size: 20px;\n line-height: 1.2;\n }\n\n p {\n margin: 0;\n font-size: 20px;\n }\n\n a {\n color: #6341F0;\n text-decoration: underline;\n cursor: pointer;\n\n @media (prefers-color-scheme: dark) {\n color: #B3A1FF;\n }\n }\n\n button {\n border-radius: 8px;\n color: white;\n cursor: pointer;\n background-color: #553DB8;\n border: none;\n padding: 0;\n margin-top: 4px;\n\n & > span {\n display: inline-block;\n padding: 12px 16px;\n border-radius: inherit;\n font-size: 20px;\n font-weight: bold;\n line-height: 1;\n background-color: #7553FF;\n border: 1px solid #553DB8;\n transform: translateY(-4px);\n }\n\n &:hover > span {\n transform: translateY(-8px);\n }\n\n &:active > span {\n transform: translateY(0);\n }\n\n &:disabled {\n\t cursor: not-allowed;\n\t opacity: 0.6;\n\t\n\t & > span {\n\t transform: translateY(0);\n\t border: none\n\t }\n\t }\n }\n\n .description {\n text-align: center;\n color: #6E6C75;\n max-width: 500px;\n line-height: 1.5;\n font-size: 20px;\n\n @media (prefers-color-scheme: dark) {\n color: #A49FB5;\n }\n }\n\n .flex-spacer {\n flex: 1;\n }\n\n .success {\n padding: 12px 16px;\n border-radius: 8px;\n font-size: 20px;\n line-height: 1;\n background-color: #00F261;\n border: 1px solid #00BF4D;\n color: #181423;\n }\n\n .success_placeholder {\n height: 46px;\n }\n\n .connectivity-error {\n padding: 12px 16px;\n background-color: #E50045;\n border-radius: 8px;\n width: 500px;\n color: #FFFFFF;\n border: 1px solid #A80033;\n text-align: center;\n margin: 0;\n }\n \n .connectivity-error a {\n color: #FFFFFF;\n text-decoration: underline;\n }\n \\`}</style>\n </div>\n );\n}\n`;\n}\n\nexport function getSentryExamplePagesDirApiRoute({\n isTypeScript,\n}: {\n isTypeScript: boolean;\n}) {\n return `// Custom error class for Sentry testing\nclass SentryExampleAPIError extends Error {\n constructor(message${isTypeScript ? ': string | undefined' : ''}) {\n super(message);\n this.name = \"SentryExampleAPIError\";\n }\n}\n// A faulty API route to test Sentry's error monitoring\nexport default function handler(_req, res) {\nthrow new SentryExampleAPIError(\"This error is raised on the backend called by the example page.\");\nres.status(200).json({ name: \"John Doe\" });\n}\n`;\n}\n\nexport function getSentryExampleAppDirApiRoute({\n isTypeScript,\n}: {\n isTypeScript: boolean;\n}) {\n return `import { NextResponse } from \"next/server\";\n\nexport const dynamic = \"force-dynamic\";\nclass SentryExampleAPIError extends Error {\n constructor(message${isTypeScript ? ': string | undefined' : ''}) {\n super(message);\n this.name = \"SentryExampleAPIError\";\n }\n}\n// A faulty API route to test Sentry's error monitoring\nexport function GET() {\n throw new SentryExampleAPIError(\"This error is raised on the backend called by the example page.\");\n return NextResponse.json({ data: \"Testing Sentry Error...\" });\n}\n`;\n}\n\nexport function getSentryDefaultUnderscoreErrorPage() {\n return `import * as Sentry from \"@sentry/nextjs\";\nimport Error from \"next/error\";\n\nconst CustomErrorComponent = (props) => {\n return <Error statusCode={props.statusCode} />;\n};\n\nCustomErrorComponent.getInitialProps = async (contextData) => {\n // In case this is running in a serverless function, await this in order to give Sentry\n // time to send the error before the lambda exits\n await Sentry.captureUnderscoreErrorException(contextData);\n\n // This will contain the status code of the response\n return Error.getInitialProps(contextData);\n};\n\nexport default CustomErrorComponent;\n`;\n}\n\nexport function getSimpleUnderscoreErrorCopyPasteSnippet() {\n return `\n${chalk.green(`import * as Sentry from '@sentry/nextjs';`)}\n${chalk.green(`import Error from \"next/error\";`)}\n\n${chalk.dim(\n '// Replace \"YourCustomErrorComponent\" with your custom error component!',\n)}\nYourCustomErrorComponent.getInitialProps = async (${chalk.green(\n 'contextData',\n )}) => {\n ${chalk.green('await Sentry.captureUnderscoreErrorException(contextData);')}\n\n ${chalk.dim('// ...other getInitialProps code')}\n\n return Error.getInitialProps(contextData);\n};\n`;\n}\n\nexport function getGenerateMetadataSnippet(isTs: boolean) {\n return makeCodeSnippet(true, (unchanged, plus) => {\n return plus(`\n import * as Sentry from '@sentry/nextjs';\n ${isTs ? `import type { Metadata } from 'next';` : ''}\n\n ${unchanged(\n '// Add or edit your \"generateMetadata\" to include the Sentry trace data:',\n )}\n export function generateMetadata()${isTs ? ': Metadata' : ''} {\n return {\n // ... your existing metadata\n other: {\n ...Sentry.getTraceData()\n }\n };\n }\n`);\n });\n}\n\nexport function getFullUnderscoreErrorCopyPasteSnippet(isTs: boolean) {\n return `\nimport * as Sentry from '@sentry/nextjs';${\n isTs ? '\\nimport type { NextPageContext } from \"next\";' : ''\n }\nimport Error from \"next/error\";\n\n${chalk.dim(\n '// Replace \"YourCustomErrorComponent\" with your custom error component!',\n)}\nYourCustomErrorComponent.getInitialProps = async (contextData${\n isTs ? ': NextPageContext' : ''\n }) => {\n await Sentry.captureUnderscoreErrorException(contextData);\n\n return Error.getInitialProps(contextData);\n};\n`;\n}\n\nexport function getInstrumentationHookContent(\n instrumentationHookLocation: 'src' | 'root',\n) {\n return `import * as Sentry from '@sentry/nextjs';\n\nexport async function register() {\n if (process.env.NEXT_RUNTIME === 'nodejs') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.server.config');\n }\n\n if (process.env.NEXT_RUNTIME === 'edge') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.edge.config');\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;\n`;\n}\n\nexport function getInstrumentationHookCopyPasteSnippet(\n instrumentationHookLocation: 'src' | 'root',\n) {\n return makeCodeSnippet(true, (unchanged, plus) => {\n return unchanged(`${plus(\"import * as Sentry from '@sentry/nextjs';\")}\n\nexport ${plus('async')} function register() {\n ${plus(`if (process.env.NEXT_RUNTIME === 'nodejs') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.server.config');\n }\n\n if (process.env.NEXT_RUNTIME === 'edge') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.edge.config');\n }`)}\n}\n\n${plus('export const onRequestError = Sentry.captureRequestError;')}\n`);\n });\n}\n\nexport function getInstrumentationClientHookCopyPasteSnippet(\n dsn: string,\n selectedFeaturesMap: {\n replay: boolean;\n performance: boolean;\n logs: boolean;\n },\n) {\n return makeCodeSnippet(true, (unchanged, plus) => {\n return plus(getInstrumentationClientFileContents(dsn, selectedFeaturesMap));\n });\n}\n\nexport function getSentryDefaultGlobalErrorPage(isTs: boolean) {\n return isTs\n ? `\"use client\";\n\nimport * as Sentry from \"@sentry/nextjs\";\nimport NextError from \"next/error\";\nimport { useEffect } from \"react\";\n\nexport default function GlobalError({ error }: { error: Error & { digest?: string } }) {\n useEffect(() => {\n Sentry.captureException(error);\n }, [error]);\n\n return (\n <html>\n <body>\n {/* \\`NextError\\` is the default Next.js error page component. Its type\n definition requires a \\`statusCode\\` prop. However, since the App Router\n does not expose status codes for errors, we simply pass 0 to render a\n generic error message. */}\n <NextError statusCode={0} />\n </body>\n </html>\n );\n}`\n : `\"use client\";\n\nimport * as Sentry from \"@sentry/nextjs\";\nimport NextError from \"next/error\";\nimport { useEffect } from \"react\";\n\nexport default function GlobalError({ error }) {\n useEffect(() => {\n Sentry.captureException(error);\n }, [error]);\n\n return (\n <html>\n <body>\n {/* \\`NextError\\` is the default Next.js error page component. Its type\n definition requires a \\`statusCode\\` prop. However, since the App Router\n does not expose status codes for errors, we simply pass 0 to render a\n generic error message. */}\n <NextError statusCode={0} />\n </body>\n </html>\n );\n}\n`;\n}\n\nexport function getGlobalErrorCopyPasteSnippet(isTs: boolean) {\n if (isTs) {\n return `\"use client\";\n\n${chalk.green('import * as Sentry from \"@sentry/nextjs\";')}\n${chalk.green('import Error from \"next/error\";')}\n${chalk.green('import { useEffect } from \"react\";')}\n\nexport default function GlobalError(${chalk.green(\n '{ error }: { error: Error }',\n )}) {\n ${chalk.green(`useEffect(() => {\n Sentry.captureException(error);\n }, [error]);`)}\n\n return (\n <html>\n <body>\n {/* Your Error component here... */}\n </body>\n </html>\n );\n}\n`;\n }\n return `\"use client\";\n\n${chalk.green('import * as Sentry from \"@sentry/nextjs\";')}\n${chalk.green('import Error from \"next/error\";')}\n${chalk.green('import { useEffect } from \"react\";')}\n\nexport default function GlobalError(${chalk.green('{ error }')}) {\n ${chalk.green(`useEffect(() => {\n Sentry.captureException(error);\n }, [error]);`)}\n\n return (\n <html>\n <body>\n {/* Your Error component here... */}\n </body>\n </html>\n );\n}\n`;\n}\n\nexport const getRootLayout = (\n isTs: boolean,\n) => `// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n// You can delete this file at any time.\n\nexport const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n}\n\nexport default function RootLayout({\n children,\n}${\n isTs\n ? `: {\n children: React.ReactNode\n}`\n : ''\n}) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n}\n`;\n\nexport const getRootLayoutWithGenerateMetadata = (\n isTs: boolean,\n) => `// This file was generated by the Sentry wizard because we couldn't find a root layout file.\nimport * as Sentry from '@sentry/nextjs';\n${isTs ? `import type { Metadata } from 'next';` : ''}\n\nexport function generateMetadata()${isTs ? ': Metadata' : ''} {\n return {\n other: {\n ...Sentry.getTraceData(),\n }\n }\n};\n\nexport default function RootLayout({\n children,\n}${\n isTs\n ? `: {\n children: React.ReactNode\n}`\n : ''\n}) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n}\n`;\n"]}
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/nextjs/templates.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,0CAAiD;AAUjD,SAAgB,kCAAkC,CAAC,EACjD,OAAO,EACP,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,GACe;IACxB,OAAO;;;;YAIG,OAAO;gBACH,WAAW,KACvB,UAAU,CAAC,CAAC,CAAC,qBAAqB,SAAS,IAAI,CAAC,CAAC,CAAC,EACpD;;;;;;;;;;;SAYI,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,oBAC1B;;;;MAIE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;;;;;;;;;;IAU1B,CAAC;AACL,CAAC;AA1CD,gFA0CC;AAED,SAAgB,0BA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W,QAAA,iCAAiC,qCA6B5C","sourcesContent":["import chalk from 'chalk';\nimport { makeCodeSnippet } from '../utils/clack';\n\ntype WithSentryConfigOptions = {\n orgSlug: string;\n projectSlug: string;\n selfHosted: boolean;\n sentryUrl: string;\n tunnelRoute: boolean;\n};\n\nexport function getWithSentryConfigOptionsTemplate({\n orgSlug,\n projectSlug,\n selfHosted,\n tunnelRoute,\n sentryUrl,\n}: WithSentryConfigOptions): string {\n return `{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"${orgSlug}\",\n project: \"${projectSlug}\",${\n selfHosted ? `\\n sentryUrl: \"${sentryUrl}\",` : ''\n }\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // ${\n tunnelRoute ? 'Route' : 'Uncomment to route'\n } browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n ${tunnelRoute ? '' : '// '}tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }`;\n}\n\nexport function getNextjsConfigCjsTemplate(\n withSentryConfigOptionsTemplate: string,\n): string {\n return `const { withSentryConfig } = require(\"@sentry/nextjs\");\n\n/** @type {import('next').NextConfig} */\nconst nextConfig = {};\n\nmodule.exports = withSentryConfig(\n nextConfig,\n ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigMjsTemplate(\n withSentryConfigOptionsTemplate: string,\n): string {\n return `import { withSentryConfig } from \"@sentry/nextjs\";\n\n/** @type {import('next').NextConfig} */\nconst nextConfig = {};\n\nexport default withSentryConfig(\n nextConfig,\n ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigCjsAppendix(\n withSentryConfigOptionsTemplate: string,\n): string {\n return `\n\n// Injected content via Sentry wizard below\n\nconst { withSentryConfig } = require(\"@sentry/nextjs\");\n\nmodule.exports = withSentryConfig(\n module.exports,\n ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigEsmCopyPasteSnippet(\n withSentryConfigOptionsTemplate: string,\n): string {\n return `\n\n// next.config.mjs\nimport { withSentryConfig } from \"@sentry/nextjs\";\n\nexport default withSentryConfig(\n yourNextConfig,\n ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nfunction getClientIntegrationsSnippet(features: { replay: boolean }) {\n if (features.replay) {\n return `\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],`;\n }\n\n return '';\n}\n\nexport function getSentryServersideConfigContents(\n dsn: string,\n config: 'server' | 'edge',\n selectedFeaturesMap: {\n replay: boolean;\n performance: boolean;\n logs: boolean;\n },\n): string {\n let primer;\n if (config === 'server') {\n primer = `// This file configures the initialization of Sentry on the server.\n// The config you add here will be used whenever the server handles a request.\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/`;\n } else if (config === 'edge') {\n primer = `// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n// The config you add here will be used whenever one of the edge features is loaded.\n// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/`;\n }\n\n let performanceOptions = '';\n if (selectedFeaturesMap.performance) {\n performanceOptions += `\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,`;\n }\n\n let logsOptions = '';\n if (selectedFeaturesMap.logs) {\n logsOptions += `\n\n // Enable logs to be sent to Sentry\n enableLogs: true,`;\n }\n\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n return `${primer}\n\nimport * as Sentry from \"@sentry/nextjs\";\n\nSentry.init({\n dsn: \"${dsn}\",${performanceOptions}${logsOptions}\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n});\n`;\n}\n\nexport function getInstrumentationClientFileContents(\n dsn: string,\n selectedFeaturesMap: {\n replay: boolean;\n performance: boolean;\n logs: boolean;\n },\n): string {\n const integrationsOptions = getClientIntegrationsSnippet({\n replay: selectedFeaturesMap.replay,\n });\n\n let replayOptions = '';\n\n if (selectedFeaturesMap.replay) {\n replayOptions += `\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,`;\n }\n\n let performanceOptions = '';\n if (selectedFeaturesMap.performance) {\n performanceOptions += `\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,`;\n }\n\n let logsOptions = '';\n if (selectedFeaturesMap.logs) {\n logsOptions += `\n // Enable logs to be sent to Sentry\n enableLogs: true,`;\n }\n\n return `// This file configures the initialization of Sentry on the client.\n// The added config here will be used whenever a users loads a page in their browser.\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\nimport * as Sentry from \"@sentry/nextjs\";\n\nSentry.init({\n dsn: \"${dsn}\",${integrationsOptions}${performanceOptions}${logsOptions}${replayOptions}\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n});\n\nexport const onRouterTransitionStart = Sentry.captureRouterTransitionStart;`;\n}\n\nexport function getSentryExamplePageContents(options: {\n selfHosted: boolean;\n sentryUrl: string;\n orgSlug: string;\n projectId: string;\n useClient: boolean;\n isTypeScript?: boolean;\n}): string {\n const issuesPageLink = options.selfHosted\n ? `${options.sentryUrl}organizations/${options.orgSlug}/issues/?project=${options.projectId}`\n : `https://${options.orgSlug}.sentry.io/issues/?project=${options.projectId}`;\n\n return `${\n options.useClient ? '\"use client\";\\n\\n' : ''\n }import Head from \"next/head\";\nimport * as Sentry from \"@sentry/nextjs\";\nimport { useState, useEffect } from \"react\";\n\nclass SentryExampleFrontendError extends Error {\n constructor(message${options.isTypeScript ? ': string | undefined' : ''}) {\n super(message);\n this.name = \"SentryExampleFrontendError\";\n }\n}\n\nexport default function Page() {\n const [hasSentError, setHasSentError] = useState(false);\n const [isConnected, setIsConnected] = useState(true);\n \n useEffect(() => {\n async function checkConnectivity() {\n const result = await Sentry.diagnoseSdkConnectivity();\n setIsConnected(result !== 'sentry-unreachable');\n }\n checkConnectivity();\n }, []);\n\n return (\n <div>\n <Head>\n <title>sentry-example-page</title>\n <meta name=\"description\" content=\"Test Sentry for your Next.js app!\" />\n </Head>\n\n <main>\n <div className=\"flex-spacer\" />\n <svg height=\"40\" width=\"40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z\" fill=\"currentcolor\"/>\n </svg>\n <h1>\n sentry-example-page\n </h1>\n\n <p className=\"description\">\n Click the button below, and view the sample error on the Sentry <a target=\"_blank\" href=\"${issuesPageLink}\">Issues Page</a>.\n For more details about setting up Sentry, <a target=\"_blank\"\n href=\"https://docs.sentry.io/platforms/javascript/guides/nextjs/\">read our docs</a>.\n </p>\n\n <button\n type=\"button\"\n onClick={async () => {\n await Sentry.startSpan({\n name: 'Example Frontend/Backend Span',\n op: 'test'\n }, async () => {\n const res = await fetch(\"/api/sentry-example-api\");\n if (!res.ok) {\n setHasSentError(true);\n }\n });\n throw new SentryExampleFrontendError(\"This error is raised on the frontend of the example page.\");\n }}\n disabled={!isConnected}\n >\n <span>\n Throw Sample Error\n </span>\n </button>\n\n {hasSentError ? (\n <p className=\"success\">\n Error sent to Sentry.\n </p>\n ) : !isConnected ? (\n <div className=\"connectivity-error\">\n <p>It looks like network requests to Sentry are being blocked, which will prevent errors from being captured. Try disabling your ad-blocker to complete the test.</p>\n </div>\n ) : (\n <div className=\"success_placeholder\" />\n )}\n\n <div className=\"flex-spacer\" />\n \n </main>\n\n <style>{\\`\n main {\n display: flex;\n min-height: 100vh;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 16px;\n padding: 16px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", sans-serif;\n }\n\n h1 {\n padding: 0px 4px;\n border-radius: 4px;\n background-color: rgba(24, 20, 35, 0.03);\n font-family: monospace;\n font-size: 20px;\n line-height: 1.2;\n }\n\n p {\n margin: 0;\n font-size: 20px;\n }\n\n a {\n color: #6341F0;\n text-decoration: underline;\n cursor: pointer;\n\n @media (prefers-color-scheme: dark) {\n color: #B3A1FF;\n }\n }\n\n button {\n border-radius: 8px;\n color: white;\n cursor: pointer;\n background-color: #553DB8;\n border: none;\n padding: 0;\n margin-top: 4px;\n\n & > span {\n display: inline-block;\n padding: 12px 16px;\n border-radius: inherit;\n font-size: 20px;\n font-weight: bold;\n line-height: 1;\n background-color: #7553FF;\n border: 1px solid #553DB8;\n transform: translateY(-4px);\n }\n\n &:hover > span {\n transform: translateY(-8px);\n }\n\n &:active > span {\n transform: translateY(0);\n }\n\n &:disabled {\n\t cursor: not-allowed;\n\t opacity: 0.6;\n\t\n\t & > span {\n\t transform: translateY(0);\n\t border: none\n\t }\n\t }\n }\n\n .description {\n text-align: center;\n color: #6E6C75;\n max-width: 500px;\n line-height: 1.5;\n font-size: 20px;\n\n @media (prefers-color-scheme: dark) {\n color: #A49FB5;\n }\n }\n\n .flex-spacer {\n flex: 1;\n }\n\n .success {\n padding: 12px 16px;\n border-radius: 8px;\n font-size: 20px;\n line-height: 1;\n background-color: #00F261;\n border: 1px solid #00BF4D;\n color: #181423;\n }\n\n .success_placeholder {\n height: 46px;\n }\n\n .connectivity-error {\n padding: 12px 16px;\n background-color: #E50045;\n border-radius: 8px;\n width: 500px;\n color: #FFFFFF;\n border: 1px solid #A80033;\n text-align: center;\n margin: 0;\n }\n \n .connectivity-error a {\n color: #FFFFFF;\n text-decoration: underline;\n }\n \\`}</style>\n </div>\n );\n}\n`;\n}\n\nexport function getSentryExamplePagesDirApiRoute({\n isTypeScript,\n}: {\n isTypeScript: boolean;\n}) {\n return `// Custom error class for Sentry testing\nclass SentryExampleAPIError extends Error {\n constructor(message${isTypeScript ? ': string | undefined' : ''}) {\n super(message);\n this.name = \"SentryExampleAPIError\";\n }\n}\n// A faulty API route to test Sentry's error monitoring\nexport default function handler(_req, res) {\nthrow new SentryExampleAPIError(\"This error is raised on the backend called by the example page.\");\nres.status(200).json({ name: \"John Doe\" });\n}\n`;\n}\n\nexport function getSentryExampleAppDirApiRoute({\n isTypeScript,\n}: {\n isTypeScript: boolean;\n}) {\n return `import { NextResponse } from \"next/server\";\n\nexport const dynamic = \"force-dynamic\";\nclass SentryExampleAPIError extends Error {\n constructor(message${isTypeScript ? ': string | undefined' : ''}) {\n super(message);\n this.name = \"SentryExampleAPIError\";\n }\n}\n// A faulty API route to test Sentry's error monitoring\nexport function GET() {\n throw new SentryExampleAPIError(\"This error is raised on the backend called by the example page.\");\n return NextResponse.json({ data: \"Testing Sentry Error...\" });\n}\n`;\n}\n\nexport function getSentryDefaultUnderscoreErrorPage() {\n return `import * as Sentry from \"@sentry/nextjs\";\nimport Error from \"next/error\";\n\nconst CustomErrorComponent = (props) => {\n return <Error statusCode={props.statusCode} />;\n};\n\nCustomErrorComponent.getInitialProps = async (contextData) => {\n // In case this is running in a serverless function, await this in order to give Sentry\n // time to send the error before the lambda exits\n await Sentry.captureUnderscoreErrorException(contextData);\n\n // This will contain the status code of the response\n return Error.getInitialProps(contextData);\n};\n\nexport default CustomErrorComponent;\n`;\n}\n\nexport function getSimpleUnderscoreErrorCopyPasteSnippet() {\n return `\n${chalk.green(`import * as Sentry from '@sentry/nextjs';`)}\n${chalk.green(`import Error from \"next/error\";`)}\n\n${chalk.dim(\n '// Replace \"YourCustomErrorComponent\" with your custom error component!',\n)}\nYourCustomErrorComponent.getInitialProps = async (${chalk.green(\n 'contextData',\n )}) => {\n ${chalk.green('await Sentry.captureUnderscoreErrorException(contextData);')}\n\n ${chalk.dim('// ...other getInitialProps code')}\n\n return Error.getInitialProps(contextData);\n};\n`;\n}\n\nexport function getGenerateMetadataSnippet(isTs: boolean) {\n return makeCodeSnippet(true, (unchanged, plus) => {\n return plus(`\n import * as Sentry from '@sentry/nextjs';\n ${isTs ? `import type { Metadata } from 'next';` : ''}\n\n ${unchanged(\n '// Add or edit your \"generateMetadata\" to include the Sentry trace data:',\n )}\n export function generateMetadata()${isTs ? ': Metadata' : ''} {\n return {\n // ... your existing metadata\n other: {\n ...Sentry.getTraceData()\n }\n };\n }\n`);\n });\n}\n\nexport function getFullUnderscoreErrorCopyPasteSnippet(isTs: boolean) {\n return `\nimport * as Sentry from '@sentry/nextjs';${\n isTs ? '\\nimport type { NextPageContext } from \"next\";' : ''\n }\nimport Error from \"next/error\";\n\n${chalk.dim(\n '// Replace \"YourCustomErrorComponent\" with your custom error component!',\n)}\nYourCustomErrorComponent.getInitialProps = async (contextData${\n isTs ? ': NextPageContext' : ''\n }) => {\n await Sentry.captureUnderscoreErrorException(contextData);\n\n return Error.getInitialProps(contextData);\n};\n`;\n}\n\nexport function getInstrumentationHookContent(\n instrumentationHookLocation: 'src' | 'root',\n) {\n return `import * as Sentry from '@sentry/nextjs';\n\nexport async function register() {\n if (process.env.NEXT_RUNTIME === 'nodejs') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.server.config');\n }\n\n if (process.env.NEXT_RUNTIME === 'edge') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.edge.config');\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;\n`;\n}\n\nexport function getInstrumentationHookCopyPasteSnippet(\n instrumentationHookLocation: 'src' | 'root',\n) {\n return makeCodeSnippet(true, (unchanged, plus) => {\n return unchanged(`${plus(\"import * as Sentry from '@sentry/nextjs';\")}\n\nexport ${plus('async')} function register() {\n ${plus(`if (process.env.NEXT_RUNTIME === 'nodejs') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.server.config');\n }\n\n if (process.env.NEXT_RUNTIME === 'edge') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.edge.config');\n }`)}\n}\n\n${plus('export const onRequestError = Sentry.captureRequestError;')}\n`);\n });\n}\n\nexport function getInstrumentationClientHookCopyPasteSnippet(\n dsn: string,\n selectedFeaturesMap: {\n replay: boolean;\n performance: boolean;\n logs: boolean;\n },\n) {\n return makeCodeSnippet(true, (unchanged, plus) => {\n return plus(getInstrumentationClientFileContents(dsn, selectedFeaturesMap));\n });\n}\n\nexport function getSentryDefaultGlobalErrorPage(isTs: boolean) {\n return isTs\n ? `\"use client\";\n\nimport * as Sentry from \"@sentry/nextjs\";\nimport NextError from \"next/error\";\nimport { useEffect } from \"react\";\n\nexport default function GlobalError({ error }: { error: Error & { digest?: string } }) {\n useEffect(() => {\n Sentry.captureException(error);\n }, [error]);\n\n return (\n <html>\n <body>\n {/* \\`NextError\\` is the default Next.js error page component. Its type\n definition requires a \\`statusCode\\` prop. However, since the App Router\n does not expose status codes for errors, we simply pass 0 to render a\n generic error message. */}\n <NextError statusCode={0} />\n </body>\n </html>\n );\n}`\n : `\"use client\";\n\nimport * as Sentry from \"@sentry/nextjs\";\nimport NextError from \"next/error\";\nimport { useEffect } from \"react\";\n\nexport default function GlobalError({ error }) {\n useEffect(() => {\n Sentry.captureException(error);\n }, [error]);\n\n return (\n <html>\n <body>\n {/* \\`NextError\\` is the default Next.js error page component. Its type\n definition requires a \\`statusCode\\` prop. However, since the App Router\n does not expose status codes for errors, we simply pass 0 to render a\n generic error message. */}\n <NextError statusCode={0} />\n </body>\n </html>\n );\n}\n`;\n}\n\nexport function getGlobalErrorCopyPasteSnippet(isTs: boolean) {\n if (isTs) {\n return `\"use client\";\n\n${chalk.green('import * as Sentry from \"@sentry/nextjs\";')}\n${chalk.green('import Error from \"next/error\";')}\n${chalk.green('import { useEffect } from \"react\";')}\n\nexport default function GlobalError(${chalk.green(\n '{ error }: { error: Error }',\n )}) {\n ${chalk.green(`useEffect(() => {\n Sentry.captureException(error);\n }, [error]);`)}\n\n return (\n <html>\n <body>\n {/* Your Error component here... */}\n </body>\n </html>\n );\n}\n`;\n }\n return `\"use client\";\n\n${chalk.green('import * as Sentry from \"@sentry/nextjs\";')}\n${chalk.green('import Error from \"next/error\";')}\n${chalk.green('import { useEffect } from \"react\";')}\n\nexport default function GlobalError(${chalk.green('{ error }')}) {\n ${chalk.green(`useEffect(() => {\n Sentry.captureException(error);\n }, [error]);`)}\n\n return (\n <html>\n <body>\n {/* Your Error component here... */}\n </body>\n </html>\n );\n}\n`;\n}\n\nexport const getRootLayout = (\n isTs: boolean,\n) => `// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n// You can delete this file at any time.\n\nexport const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n}\n\nexport default function RootLayout({\n children,\n}${\n isTs\n ? `: {\n children: React.ReactNode\n}`\n : ''\n}) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n}\n`;\n\nexport const getRootLayoutWithGenerateMetadata = (\n isTs: boolean,\n) => `// This file was generated by the Sentry wizard because we couldn't find a root layout file.\nimport * as Sentry from '@sentry/nextjs';\n${isTs ? `import type { Metadata } from 'next';` : ''}\n\nexport function generateMetadata()${isTs ? ': Metadata' : ''} {\n return {\n other: {\n ...Sentry.getTraceData(),\n }\n }\n};\n\nexport default function RootLayout({\n children,\n}${\n isTs\n ? `: {\n children: React.ReactNode\n}`\n : ''\n}) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n}\n`;\n"]}
|
|
@@ -78,7 +78,11 @@ Sentry.init({
|
|
|
78
78
|
// If set up, you can use your runtime config here
|
|
79
79
|
// dsn: useRuntimeConfig().public.sentry.dsn,
|
|
80
80
|
${getConfigBody(dsn, 'client', selectedFeatures)}
|
|
81
|
-
|
|
81
|
+
|
|
82
|
+
// Enable sending of user PII (Personally Identifiable Information)
|
|
83
|
+
// https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii
|
|
84
|
+
sendDefaultPii: true,
|
|
85
|
+
|
|
82
86
|
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
83
87
|
debug: false,
|
|
84
88
|
});
|
|
@@ -89,7 +93,11 @@ function getSentryServerConfigContents(dsn, selectedFeatures) {
|
|
|
89
93
|
|
|
90
94
|
Sentry.init({
|
|
91
95
|
${getConfigBody(dsn, 'server', selectedFeatures)}
|
|
92
|
-
|
|
96
|
+
|
|
97
|
+
// Enable sending of user PII (Personally Identifiable Information)
|
|
98
|
+
// https://docs.sentry.io/platforms/javascript/guides/nuxt/configuration/options/#sendDefaultPii
|
|
99
|
+
sendDefaultPii: true,
|
|
100
|
+
|
|
93
101
|
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
94
102
|
debug: false,
|
|
95
103
|
});
|