@sentry/wizard 4.4.0 → 4.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 +23 -1
- package/README.md +23 -19
- package/dist/bin.js +13 -0
- package/dist/bin.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-14.test.js +4 -5
- package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-15.test.js +3 -5
- package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
- package/dist/e2e-tests/utils/index.d.ts +1 -1
- package/dist/e2e-tests/utils/index.js +20 -2
- package/dist/e2e-tests/utils/index.js.map +1 -1
- package/dist/lib/Constants.d.ts +2 -0
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Helper/File.d.ts +1 -1
- package/dist/lib/Helper/File.js +1 -3
- package/dist/lib/Helper/File.js.map +1 -1
- package/dist/lib/Helper/Logging.d.ts +3 -0
- package/dist/lib/Helper/Logging.js +3 -0
- package/dist/lib/Helper/Logging.js.map +1 -1
- package/dist/lib/Helper/Package.d.ts +5 -3
- package/dist/lib/Helper/Package.js +2 -2
- package/dist/lib/Helper/Package.js.map +1 -1
- package/dist/lib/Helper/SentryCli.d.ts +20 -7
- package/dist/lib/Helper/SentryCli.js +21 -13
- package/dist/lib/Helper/SentryCli.js.map +1 -1
- package/dist/lib/Helper/Wizard.js +9 -5
- package/dist/lib/Helper/Wizard.js.map +1 -1
- package/dist/lib/Helper/__tests__/SentryCli.js +21 -4
- package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
- package/dist/lib/Setup.d.ts +3 -1
- package/dist/lib/Setup.js.map +1 -1
- package/dist/lib/Steps/Integrations/BaseIntegration.js +1 -2
- package/dist/lib/Steps/Integrations/BaseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/Cordova.js +14 -10
- package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.d.ts +4 -1
- package/dist/lib/Steps/Integrations/Electron.js +1 -1
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/lib/Steps/Integrations/MobileProject.d.ts +3 -1
- package/dist/lib/Steps/Integrations/MobileProject.js +1 -1
- package/dist/lib/Steps/Integrations/MobileProject.js.map +1 -1
- package/dist/lib/Steps/PromptForParameters.d.ts +4 -1
- package/dist/lib/Steps/PromptForParameters.js.map +1 -1
- package/dist/lib/Steps/SentryProjectSelector.d.ts +42 -1
- package/dist/lib/Steps/SentryProjectSelector.js +1 -1
- package/dist/lib/Steps/SentryProjectSelector.js.map +1 -1
- package/dist/lib/Steps/WaitForSentry.d.ts +3 -1
- package/dist/lib/Steps/WaitForSentry.js +4 -4
- package/dist/lib/Steps/WaitForSentry.js.map +1 -1
- package/dist/lib/Types.d.ts +14 -0
- package/dist/lib/Types.js +3 -0
- package/dist/lib/Types.js.map +1 -0
- package/dist/lib/__tests__/Env.js +6 -13
- package/dist/lib/__tests__/Env.js.map +1 -1
- package/dist/src/android/android-wizard.js +15 -12
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/android/code-tools.js +1 -1
- package/dist/src/android/code-tools.js.map +1 -1
- package/dist/src/android/gradle.js +4 -4
- package/dist/src/android/gradle.js.map +1 -1
- package/dist/src/android/manifest.js +1 -1
- package/dist/src/android/manifest.js.map +1 -1
- package/dist/src/apple/apple-wizard.d.ts +2 -2
- package/dist/src/apple/apple-wizard.js +37 -118
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/apple/check-installed-cli.d.ts +1 -0
- package/dist/src/apple/check-installed-cli.js +60 -0
- package/dist/src/apple/check-installed-cli.js.map +1 -0
- package/dist/src/apple/cocoapod.js +1 -1
- package/dist/src/apple/cocoapod.js.map +1 -1
- package/dist/src/apple/code-tools.js +1 -1
- package/dist/src/apple/code-tools.js.map +1 -1
- package/dist/src/apple/configure-fastlane.d.ts +5 -0
- package/dist/src/apple/configure-fastlane.js +66 -0
- package/dist/src/apple/configure-fastlane.js.map +1 -0
- package/dist/src/apple/fastlane.d.ts +1 -1
- package/dist/src/apple/fastlane.js +5 -5
- package/dist/src/apple/fastlane.js.map +1 -1
- package/dist/src/apple/lookup-xcode-project.d.ts +7 -0
- package/dist/src/apple/lookup-xcode-project.js +98 -0
- package/dist/src/apple/lookup-xcode-project.js.map +1 -0
- package/dist/src/apple/options.d.ts +4 -0
- package/dist/src/apple/options.js +3 -0
- package/dist/src/apple/options.js.map +1 -0
- package/dist/src/apple/search-xcode-project-at-path.d.ts +1 -0
- package/dist/src/apple/search-xcode-project-at-path.js +70 -0
- package/dist/src/apple/search-xcode-project-at-path.js.map +1 -0
- package/dist/src/apple/xcode-manager.js +1 -1
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/flutter/code-tools.js +3 -3
- package/dist/src/flutter/code-tools.js.map +1 -1
- package/dist/src/flutter/flutter-wizard.js +21 -15
- package/dist/src/flutter/flutter-wizard.js.map +1 -1
- package/dist/src/flutter/templates.js +4 -4
- package/dist/src/flutter/templates.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +118 -67
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.d.ts +11 -3
- package/dist/src/nextjs/templates.js +193 -71
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/nuxt-wizard.js +21 -16
- package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
- package/dist/src/nuxt/sdk-example.js +3 -3
- package/dist/src/nuxt/sdk-example.js.map +1 -1
- package/dist/src/nuxt/sdk-setup.js +9 -9
- package/dist/src/nuxt/sdk-setup.js.map +1 -1
- package/dist/src/nuxt/templates.js +173 -58
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/nuxt/utils.js +6 -3
- package/dist/src/nuxt/utils.js.map +1 -1
- package/dist/src/react-native/expo-env-file.js +1 -1
- package/dist/src/react-native/expo-env-file.js.map +1 -1
- package/dist/src/react-native/expo-metro.js +4 -4
- package/dist/src/react-native/expo-metro.js.map +1 -1
- package/dist/src/react-native/expo.js +4 -4
- package/dist/src/react-native/expo.js.map +1 -1
- package/dist/src/react-native/javascript.js +7 -7
- package/dist/src/react-native/javascript.js.map +1 -1
- package/dist/src/react-native/metro.js +8 -8
- package/dist/src/react-native/metro.js.map +1 -1
- package/dist/src/react-native/react-native-wizard.d.ts +1 -1
- package/dist/src/react-native/react-native-wizard.js +36 -31
- package/dist/src/react-native/react-native-wizard.js.map +1 -1
- package/dist/src/react-native/uninstall.js +8 -5
- package/dist/src/react-native/uninstall.js.map +1 -1
- package/dist/src/react-native/xcode.d.ts +2 -1
- package/dist/src/react-native/xcode.js +1 -2
- package/dist/src/react-native/xcode.js.map +1 -1
- package/dist/src/remix/codemods/handle-error.js +4 -1
- package/dist/src/remix/codemods/handle-error.js.map +1 -1
- package/dist/src/remix/remix-wizard.js +23 -18
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/remix/sdk-example.js +163 -64
- package/dist/src/remix/sdk-example.js.map +1 -1
- package/dist/src/remix/sdk-setup.js +11 -7
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/run.d.ts +3 -1
- package/dist/src/run.js +29 -9
- package/dist/src/run.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.js +30 -28
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/angular.js +3 -3
- package/dist/src/sourcemaps/tools/angular.js.map +1 -1
- package/dist/src/sourcemaps/tools/create-react-app.js +3 -3
- package/dist/src/sourcemaps/tools/create-react-app.js.map +1 -1
- package/dist/src/sourcemaps/tools/esbuild.js +6 -6
- package/dist/src/sourcemaps/tools/esbuild.js.map +1 -1
- package/dist/src/sourcemaps/tools/nextjs.js +5 -5
- package/dist/src/sourcemaps/tools/nextjs.js.map +1 -1
- package/dist/src/sourcemaps/tools/remix.js +4 -4
- package/dist/src/sourcemaps/tools/remix.js.map +1 -1
- package/dist/src/sourcemaps/tools/rollup.js +6 -6
- package/dist/src/sourcemaps/tools/rollup.js.map +1 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js +23 -16
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/tools/tsc.js +6 -6
- package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
- package/dist/src/sourcemaps/tools/vite.js +12 -12
- package/dist/src/sourcemaps/tools/vite.js.map +1 -1
- package/dist/src/sourcemaps/tools/webpack.js +10 -10
- package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
- package/dist/src/sourcemaps/utils/detect-tool.js +2 -2
- package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
- package/dist/src/sourcemaps/utils/other-wizards.js +5 -5
- package/dist/src/sourcemaps/utils/other-wizards.js.map +1 -1
- package/dist/src/sourcemaps/utils/sdk-version.js +7 -7
- package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -1
- package/dist/src/sveltekit/sdk-example.js +1 -1
- package/dist/src/sveltekit/sdk-example.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup.js +15 -14
- package/dist/src/sveltekit/sdk-setup.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +25 -20
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/sveltekit/templates.js +126 -37
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/telemetry.js +11 -0
- package/dist/src/telemetry.js.map +1 -1
- package/dist/src/utils/{clack-utils.d.ts → clack/index.d.ts} +54 -15
- package/dist/src/utils/{clack-utils.js → clack/index.js} +107 -24
- package/dist/src/utils/clack/index.js.map +1 -0
- package/dist/src/utils/debug.js +1 -1
- package/dist/src/utils/debug.js.map +1 -1
- package/dist/src/utils/find-files-with-extension.d.ts +1 -0
- package/dist/src/utils/find-files-with-extension.js +39 -0
- package/dist/src/utils/find-files-with-extension.js.map +1 -0
- package/dist/src/utils/package-manager.d.ts +6 -1
- package/dist/src/utils/package-manager.js +32 -27
- package/dist/src/utils/package-manager.js.map +1 -1
- package/dist/src/utils/sentrycli-utils.js +0 -1
- package/dist/src/utils/sentrycli-utils.js.map +1 -1
- package/dist/src/utils/types.d.ts +4 -0
- package/dist/src/utils/types.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/android/code-tools.test.js +0 -1
- package/dist/test/android/code-tools.test.js.map +1 -1
- package/dist/test/apple/cocoapod.test.js +1 -1
- package/dist/test/apple/cocoapod.test.js.map +1 -1
- package/dist/test/apple/code-tools.test.js +1 -1
- package/dist/test/apple/code-tools.test.js.map +1 -1
- package/dist/test/apple/fastfile.test.js +1 -1
- package/dist/test/apple/fastfile.test.js.map +1 -1
- package/dist/test/apple/xcode-manager.test.js +26 -2
- package/dist/test/apple/xcode-manager.test.js.map +1 -1
- package/dist/test/flutter/code-tools.test.js +0 -2
- package/dist/test/flutter/code-tools.test.js.map +1 -1
- package/dist/test/flutter/templates.test.js +23 -23
- package/dist/test/flutter/templates.test.js.map +1 -1
- package/dist/test/nextjs/templates.test.js +127 -133
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/react-native/expo-metro.test.js +1 -1
- package/dist/test/react-native/expo-metro.test.js.map +1 -1
- package/dist/test/react-native/javascript.test.js +1 -1
- package/dist/test/react-native/javascript.test.js.map +1 -1
- package/dist/test/react-native/metro.test.js +1 -1
- package/dist/test/react-native/metro.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/sentry-cli.test.js +14 -3
- package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -1
- package/dist/test/utils/{clack-utils.test.js → clack/index.test.js} +131 -41
- package/dist/test/utils/clack/index.test.js.map +1 -0
- package/dist/test/utils/package-manager.test.d.ts +1 -0
- package/dist/test/utils/package-manager.test.js +29 -0
- package/dist/test/utils/package-manager.test.js.map +1 -0
- package/package.json +1 -1
- package/dist/src/utils/clack-utils.js.map +0 -1
- package/dist/test/utils/clack-utils.test.js.map +0 -1
- /package/dist/test/utils/{clack-utils.test.d.ts → clack/index.test.d.ts} +0 -0
|
@@ -32,7 +32,7 @@ const path = __importStar(require("path"));
|
|
|
32
32
|
// @ts-expect-error - clack is ESM and TS complains about that. It works though
|
|
33
33
|
const prompts_1 = __importDefault(require("@clack/prompts"));
|
|
34
34
|
const templates_1 = require("./templates");
|
|
35
|
-
const
|
|
35
|
+
const clack_1 = require("../utils/clack");
|
|
36
36
|
const chalk_1 = __importDefault(require("chalk"));
|
|
37
37
|
const Sentry = __importStar(require("@sentry/node"));
|
|
38
38
|
function getSrcDirectory(isNuxtV4) {
|
|
@@ -80,7 +80,7 @@ async function createExamplePage(isNuxtV4, options) {
|
|
|
80
80
|
if (!fs.existsSync(path.resolve(api))) {
|
|
81
81
|
fs.mkdirSync(path.resolve(api), { recursive: true });
|
|
82
82
|
}
|
|
83
|
-
const exampleApi = path.join(api, (0,
|
|
83
|
+
const exampleApi = path.join(api, (0, clack_1.isUsingTypeScript)() ? 'sentry-example-api.ts' : 'sentry-example-api.js');
|
|
84
84
|
await fs.promises.writeFile(path.resolve(exampleApi), (0, templates_1.getSentryExampleApiTemplate)());
|
|
85
85
|
prompts_1.default.log.success(`Created ${chalk_1.default.cyan(exampleApi)}.`);
|
|
86
86
|
}
|
|
@@ -92,7 +92,7 @@ async function createExamplePage(isNuxtV4, options) {
|
|
|
92
92
|
? e
|
|
93
93
|
: 'Unknown error'));
|
|
94
94
|
Sentry.captureException('Error while creating an example Nuxt page to test Sentry');
|
|
95
|
-
await (0,
|
|
95
|
+
await (0, clack_1.abort)('Exiting Wizard');
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
exports.createExamplePage = createExamplePage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-example.js","sourceRoot":"","sources":["../../../src/nuxt/sdk-example.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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AAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAEhD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,EAAE;QAC5C,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;KAC7D;IAED,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAAC;IAExE,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAC9B,IAAA,wCAA4B,GAAE,CAC/B,CAAC;IAEF,iBAAK,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,eAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAChE,CAAC;AAhBD,wDAgBC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport {\n getIndexRouteTemplate,\n getSentryExampleApiTemplate,\n getSentryExamplePageTemplate,\n getSentryErrorButtonTemplate,\n} from './templates';\nimport { abort, isUsingTypeScript } from '../utils/clack';\nimport chalk from 'chalk';\nimport * as Sentry from '@sentry/node';\n\nfunction getSrcDirectory(isNuxtV4: boolean) {\n // In nuxt v4, the src directory is `app/` unless\n // users already had a `pages` directory\n return isNuxtV4 && !fs.existsSync(path.resolve('pages')) ? 'app' : '.';\n}\n\nexport async function supportsExamplePage(isNuxtV4: boolean) {\n // We currently only support creating an example page\n // if users can reliably access it without having to\n // add code changes themselves.\n //\n // If users have an `app.vue` layout without the\n // needed component to render routes (<NuxtPage/>),\n // we bail out of creating an example page altogether.\n const src = getSrcDirectory(isNuxtV4);\n const app = path.join(src, 'app.vue');\n\n // If there's no `app.vue` layout, nuxt automatically renders\n // the routes.\n if (!fs.existsSync(path.resolve(app))) {\n return true;\n }\n\n const content = await fs.promises.readFile(path.resolve(app), 'utf8');\n return !!content.match(/<NuxtPage/g);\n}\n\nexport async function createExamplePage(\n isNuxtV4: boolean,\n options: {\n org: string;\n project: string;\n projectId: string;\n url: string;\n },\n) {\n try {\n const src = getSrcDirectory(isNuxtV4);\n const pages = path.join(src, 'pages');\n\n if (!fs.existsSync(path.resolve(pages))) {\n fs.mkdirSync(path.resolve(pages), { recursive: true });\n\n const indexPage = path.join(pages, 'index.vue');\n\n await fs.promises.writeFile(\n path.resolve(indexPage),\n getIndexRouteTemplate(),\n );\n\n clack.log.success(`Created ${chalk.cyan(indexPage)}.`);\n }\n\n const examplePage = path.join(pages, 'sentry-example-page.vue');\n\n if (fs.existsSync(path.resolve(examplePage))) {\n clack.log.warn(\n `It seems like a sentry example page already exists. Skipping creation of example page.`,\n );\n return;\n }\n\n await fs.promises.writeFile(\n path.resolve(examplePage),\n getSentryExamplePageTemplate(options),\n );\n\n clack.log.success(`Created ${chalk.cyan(examplePage)}.`);\n\n const api = path.join('server', 'api');\n\n if (!fs.existsSync(path.resolve(api))) {\n fs.mkdirSync(path.resolve(api), { recursive: true });\n }\n\n const exampleApi = path.join(\n api,\n isUsingTypeScript() ? 'sentry-example-api.ts' : 'sentry-example-api.js',\n );\n\n await fs.promises.writeFile(\n path.resolve(exampleApi),\n getSentryExampleApiTemplate(),\n );\n\n clack.log.success(`Created ${chalk.cyan(exampleApi)}.`);\n } catch (e: unknown) {\n clack.log.error('Error while creating an example page to test Sentry:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n Sentry.captureException(\n 'Error while creating an example Nuxt page to test Sentry',\n );\n await abort('Exiting Wizard');\n }\n}\n\nexport async function createExampleComponent(isNuxtV4: boolean) {\n const src = getSrcDirectory(isNuxtV4);\n const components = path.join(src, 'components');\n\n if (!fs.existsSync(path.resolve(components))) {\n fs.mkdirSync(path.resolve(components), { recursive: true });\n }\n\n const exampleComponent = path.join(components, 'SentryErrorButton.vue');\n\n await fs.promises.writeFile(\n path.resolve(exampleComponent),\n getSentryErrorButtonTemplate(),\n );\n\n clack.log.success(`Created ${chalk.cyan(exampleComponent)}.`);\n}\n"]}
|
|
@@ -40,7 +40,7 @@ const helpers_1 = require("magicast/helpers");
|
|
|
40
40
|
const opn_1 = __importDefault(require("opn"));
|
|
41
41
|
const semver_1 = require("semver");
|
|
42
42
|
const telemetry_1 = require("../telemetry");
|
|
43
|
-
const
|
|
43
|
+
const clack_1 = require("../utils/clack");
|
|
44
44
|
const package_json_1 = require("../utils/package-json");
|
|
45
45
|
const package_manager_1 = require("../utils/package-manager");
|
|
46
46
|
const templates_1 = require("./templates");
|
|
@@ -67,7 +67,7 @@ async function getNuxtConfig() {
|
|
|
67
67
|
}
|
|
68
68
|
exports.getNuxtConfig = getNuxtConfig;
|
|
69
69
|
async function askDeploymentPlatform() {
|
|
70
|
-
return await (0,
|
|
70
|
+
return await (0, clack_1.abortIfCancelled)(clack.select({
|
|
71
71
|
message: 'Please select your deployment platform.',
|
|
72
72
|
options: types_1.deploymentPlatforms.map((platform) => ({
|
|
73
73
|
value: platform,
|
|
@@ -162,7 +162,7 @@ function showFallbackInstructions(config, options, shouldTopLevelImport) {
|
|
|
162
162
|
console.log(`\n\n${(0, templates_1.getNuxtModuleFallbackTemplate)(options, shouldTopLevelImport)}\n\n`);
|
|
163
163
|
}
|
|
164
164
|
async function createConfigFiles(dsn) {
|
|
165
|
-
const selectedFeatures = await (0,
|
|
165
|
+
const selectedFeatures = await (0, clack_1.featureSelectionPrompt)([
|
|
166
166
|
{
|
|
167
167
|
id: 'performance',
|
|
168
168
|
prompt: `Do you want to enable ${chalk_1.default.bold('Tracing')} to track the performance of your application?`,
|
|
@@ -174,7 +174,7 @@ async function createConfigFiles(dsn) {
|
|
|
174
174
|
enabledHint: 'recommended, but increases bundle size',
|
|
175
175
|
},
|
|
176
176
|
]);
|
|
177
|
-
const typeScriptDetected = (0,
|
|
177
|
+
const typeScriptDetected = (0, clack_1.isUsingTypeScript)();
|
|
178
178
|
const configVariants = ['server', 'client'];
|
|
179
179
|
for (const configVariant of configVariants) {
|
|
180
180
|
await (0, telemetry_1.traceStep)(`create-sentry-${configVariant}-config`, async () => {
|
|
@@ -191,7 +191,7 @@ async function createConfigFiles(dsn) {
|
|
|
191
191
|
if (tsConfigExists) {
|
|
192
192
|
existingConfigs.push(tsConfig);
|
|
193
193
|
}
|
|
194
|
-
const overwriteExistingConfigs = await (0,
|
|
194
|
+
const overwriteExistingConfigs = await (0, clack_1.abortIfCancelled)(clack.confirm({
|
|
195
195
|
message: `Found existing Sentry ${configVariant} config (${existingConfigs.join(', ')}). Overwrite ${existingConfigs.length > 1 ? 'them' : 'it'}?`,
|
|
196
196
|
}));
|
|
197
197
|
Sentry.setTag(`overwrite-${configVariant}-config`, overwriteExistingConfigs);
|
|
@@ -238,7 +238,7 @@ async function addNuxtOverrides(packageJson, packageManager, nuxtMinVer, forceIn
|
|
|
238
238
|
? `\n\nand ${chalk_1.default.underline('https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle')}`
|
|
239
239
|
: ''}`);
|
|
240
240
|
for (const { pkgName, pkgVersion } of overrides) {
|
|
241
|
-
const shouldAddOverride = await (0,
|
|
241
|
+
const shouldAddOverride = await (0, clack_1.askShouldAddPackageOverride)(pkgName, pkgVersion);
|
|
242
242
|
if (shouldAddOverride) {
|
|
243
243
|
await packageManager.addOverride(pkgName, pkgVersion);
|
|
244
244
|
}
|
|
@@ -248,9 +248,9 @@ async function addNuxtOverrides(packageJson, packageManager, nuxtMinVer, forceIn
|
|
|
248
248
|
// See: https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle
|
|
249
249
|
const iitmAlreadyInstalled = (0, package_json_1.hasPackageInstalled)('import-in-the-middle', packageJson);
|
|
250
250
|
Sentry.setTag('iitm-already-installed', iitmAlreadyInstalled);
|
|
251
|
-
const shouldInstallIitm = await (0,
|
|
251
|
+
const shouldInstallIitm = await (0, clack_1.askShouldInstallPackage)('import-in-the-middle');
|
|
252
252
|
if (shouldInstallIitm) {
|
|
253
|
-
await (0,
|
|
253
|
+
await (0, clack_1.installPackage)({
|
|
254
254
|
packageName: 'import-in-the-middle',
|
|
255
255
|
alreadyInstalled: iitmAlreadyInstalled,
|
|
256
256
|
packageManager,
|
|
@@ -268,7 +268,7 @@ async function confirmReadImportDocs(deploymentPlatform) {
|
|
|
268
268
|
}
|
|
269
269
|
const docsUrl = 'https://docs.sentry.io/platforms/javascript/guides/nuxt/install/cli-import/#initializing-sentry-with---import';
|
|
270
270
|
clack.log.info(`After building your Nuxt app, you need to ${chalk_1.default.bold('--import')} the Sentry server config file when running your app.\n\nFor more info, see:\n\n${chalk_1.default.underline(docsUrl)}`);
|
|
271
|
-
const shouldOpenDocs = await (0,
|
|
271
|
+
const shouldOpenDocs = await (0, clack_1.abortIfCancelled)(clack.confirm({ message: 'Do you want to open the docs?' }));
|
|
272
272
|
Sentry.setTag('init-with-import-docs-opened', shouldOpenDocs);
|
|
273
273
|
if (shouldOpenDocs) {
|
|
274
274
|
// opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/nuxt/sdk-setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAC7B,+EAA+E;AAC/E,sDAAwC;AACxC,qDAAuC;AACvC,kDAA0B;AAC1B,kFAAkF;AAClF,uCAAkD;AAClD,kFAAkF;AAClF,8CAAiD;AACjD,8CAAsB;AACtB,mCAAyC;AACzC,4CAAyC;AACzC,sDAO8B;AAC9B,wDAG+B;AAC/B,8DAAqE;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ED,4CAiEC;AAEM,KAAK,UAAU,qBAAqB,CACzC,kBAA+C;IAE/C,MAAM,+BAA+B,GACnC,kBAAkB,KAAK,QAAQ,IAAI,kBAAkB,KAAK,SAAS,CAAC;IAEtE,IAAI,CAAC,+BAA+B,EAAE;QACpC,gFAAgF;QAChF,OAAO;KACR;IAED,MAAM,OAAO,GACX,+GAA+G,CAAC;IAElH,KAAK,CAAC,GAAG,CAAC,IAAI,CACZ,6CAA6C,eAAK,CAAC,IAAI,CACrD,UAAU,CACX,mFAAmF,eAAK,CAAC,SAAS,CACjG,OAAO,CACR,EAAE,CACJ,CAAC;IAEF,MAAM,cAAc,GAAG,MAAM,IAAA,8BAAgB,EAC3C,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAAC,CAC5D,CAAC;IAEF,MAAM,CAAC,MAAM,CAAC,8BAA8B,EAAE,cAAc,CAAC,CAAC;IAE9D,IAAI,cAAc,EAAE;QAClB,iGAAiG;QACjG,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,2DAA2D;QAClF,IAAA,aAAG,EAAC,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;KACxE;AACH,CAAC;AAjCD,sDAiCC","sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as Sentry from '@sentry/node';\nimport chalk from 'chalk';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { generateCode, loadFile } from 'magicast';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { addNuxtModule } from 'magicast/helpers';\nimport opn from 'opn';\nimport { type SemVer, lt } from 'semver';\nimport { traceStep } from '../telemetry';\nimport {\n abortIfCancelled,\n askShouldAddPackageOverride,\n askShouldInstallPackage,\n featureSelectionPrompt,\n installPackage,\n isUsingTypeScript,\n} from '../utils/clack-utils';\nimport {\n type PackageDotJson,\n hasPackageInstalled,\n} from '../utils/package-json';\nimport { PNPM, type PackageManager } from '../utils/package-manager';\nimport {\n getConfigBody,\n getDefaultNuxtConfig,\n getNuxtModuleFallbackTemplate,\n getSentryConfigContents,\n} from './templates';\nimport { type DeploymentPlatform, deploymentPlatforms } from './types';\n\nconst possibleNuxtConfig = [\n 'nuxt.config.js',\n 'nuxt.config.mjs',\n 'nuxt.config.cjs',\n 'nuxt.config.ts',\n 'nuxt.config.mts',\n 'nuxt.config.cts',\n];\n\nexport async function getNuxtConfig(): Promise<string> {\n let configFile = possibleNuxtConfig.find((fileName) =>\n fs.existsSync(path.join(process.cwd(), fileName)),\n );\n\n if (!configFile) {\n clack.log.info('No Nuxt config file found, creating a new one.');\n Sentry.setTag('nuxt-config-strategy', 'create');\n // nuxt recommends its config to be .ts by default\n configFile = 'nuxt.config.ts';\n\n await fs.promises.writeFile(\n path.join(process.cwd(), configFile),\n getDefaultNuxtConfig(),\n { encoding: 'utf-8', flag: 'w' },\n );\n\n clack.log.success(`Created ${chalk.cyan('nuxt.config.ts')}.`);\n }\n\n return path.join(process.cwd(), configFile);\n}\n\nexport async function askDeploymentPlatform(): Promise<\n DeploymentPlatform | symbol\n> {\n return await abortIfCancelled(\n clack.select({\n message: 'Please select your deployment platform.',\n options: deploymentPlatforms.map((platform) => ({\n value: platform,\n label: `${platform.charAt(0).toUpperCase()}${platform.slice(1)}`,\n })),\n }),\n );\n}\n\nexport async function addSDKModule(\n config: string,\n options: { org: string; project: string; url: string; selfHosted: boolean },\n deploymentPlatform: DeploymentPlatform | symbol,\n): Promise<void> {\n const failureTagKey = 'modify-nuxt-config-error';\n\n const shouldTopLevelImport =\n deploymentPlatform === 'vercel' || deploymentPlatform === 'netlify';\n\n if (shouldTopLevelImport) {\n clack.log.warn(\n `Sentry needs to be initialized before the application starts. ${chalk.cyan(\n `${deploymentPlatform\n .charAt(0)\n .toUpperCase()}${deploymentPlatform.slice(1)}`,\n )} does not support this yet.\\n\\nWe will inject the Sentry server-side config at the top of your Nuxt server entry file instead.\\n\\nThis comes with some restrictions, for more info see:\\n\\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/install/top-level-import/',\n )} `,\n );\n }\n\n let module;\n\n try {\n module = await loadFile(config);\n } catch (e) {\n if (e instanceof Error) {\n if (e instanceof SyntaxError || e.message.includes('Unexpected token')) {\n Sentry.setTag(failureTagKey, 'loadFile-failed-syntax-error');\n } else if (\n e.message.includes('ENOENT') ||\n e.message.includes('no such file')\n ) {\n Sentry.setTag(failureTagKey, 'loadFile-failed-file-not-found');\n }\n } else {\n Sentry.setTag(failureTagKey, 'loadFile-failed');\n }\n\n clack.log.error(\n `Error while loading Nuxt config file: ${\n e instanceof Error ? e.message : 'Unknown'\n }`,\n );\n\n showFallbackInstructions(config, options, shouldTopLevelImport);\n throw e;\n }\n\n try {\n addNuxtModule(module, '@sentry/nuxt/module', 'sentry', {\n sourceMapsUploadOptions: {\n org: options.org,\n project: options.project,\n ...(options.selfHosted && { url: options.url }),\n },\n ...(shouldTopLevelImport && {\n autoInjectServerSentry: 'top-level-import',\n }),\n });\n } catch (e) {\n Sentry.setTag(failureTagKey, 'adding-sentry-options-failed');\n\n clack.log.error(\n `Error while modifying 'sentry' in Nuxt config: ${\n e instanceof Error ? e.message : 'Unknown'\n }`,\n );\n\n showFallbackInstructions(config, options, shouldTopLevelImport);\n throw e;\n }\n\n try {\n addNuxtModule(module, '@sentry/nuxt/module', 'sourcemap', {\n client: 'hidden',\n });\n } catch (e) {\n Sentry.setTag(failureTagKey, 'adding-sourcemap-options-failed');\n\n clack.log.error(\n `Error while modifying 'sourcemap' in Nuxt config: ${\n e instanceof Error ? e.message : 'Unknown'\n }`,\n );\n\n showFallbackInstructions(config, options, shouldTopLevelImport);\n throw e;\n }\n\n let code;\n\n try {\n ({ code } = generateCode(module));\n } catch (e) {\n Sentry.setTag(failureTagKey, 'generateCode-failed');\n\n clack.log.error(\n `Error while generating module code: ${\n e instanceof Error ? e.message : 'Unknown'\n }`,\n );\n\n showFallbackInstructions(config, options, shouldTopLevelImport);\n throw e;\n }\n\n try {\n await fs.promises.writeFile(config, code, { encoding: 'utf-8', flag: 'w' });\n\n clack.log.success(\n `Added Sentry Nuxt Module to ${chalk.cyan(path.basename(config))}.`,\n );\n } catch (e: unknown) {\n Sentry.setTag(failureTagKey, 'writeFile-failed');\n\n clack.log.error(\n `Error while writing Nuxt config: ${\n e instanceof Error ? e.message : 'Unknown'\n }`,\n );\n\n showFallbackInstructions(config, options, shouldTopLevelImport);\n throw e;\n }\n}\n\nfunction showFallbackInstructions(\n config: string,\n options: { org: string; project: string; url: string; selfHosted: boolean },\n shouldTopLevelImport: boolean,\n) {\n clack.log.warn(\n `Please add the following settings to ${chalk.cyan(\n path.basename(config),\n )}:`,\n );\n // eslint-disable-next-line no-console\n console.log(\n `\\n\\n${getNuxtModuleFallbackTemplate(options, shouldTopLevelImport)}\\n\\n`,\n );\n}\n\nexport async function createConfigFiles(dsn: string) {\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 ] as const);\n\n const typeScriptDetected = isUsingTypeScript();\n\n const configVariants = ['server', 'client'] 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 getSentryConfigContents(dsn, configVariant, selectedFeatures),\n { encoding: 'utf8', flag: 'w' },\n );\n clack.log.success(\n `Created new ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )}.`,\n );\n Sentry.setTag(`created-${configVariant}-config`, true);\n } else {\n clack.log.info(\n `Okay, here are the changes your ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )} should contain:`,\n );\n // eslint-disable-next-line no-console\n console.log(\n '\\n\\n ' +\n getConfigBody(dsn, configVariant, selectedFeatures) +\n '\\n\\n',\n );\n }\n });\n }\n}\n\nexport async function addNuxtOverrides(\n packageJson: PackageDotJson,\n packageManager: PackageManager,\n nuxtMinVer: SemVer | null,\n forceInstall?: boolean,\n) {\n const isPNPM = PNPM.detect();\n\n const overrides = [\n {\n pkgName: '@vercel/nft',\n pkgVersion: '^0.27.4',\n },\n ...(nuxtMinVer && lt(nuxtMinVer, '3.14.0')\n ? [{ pkgName: 'ofetch', pkgVersion: '^1.4.0' }]\n : []),\n ];\n\n clack.log.warn(\n `To ensure Sentry can properly instrument your code it needs to add version overrides for some Nuxt dependencies${\n isPNPM ? ` and install ${chalk.cyan('import-in-the-middle')}.` : '.'\n }\\n\\nFor more info see: ${chalk.underline(\n 'https://github.com/getsentry/sentry-javascript/issues/14514',\n )}${\n isPNPM\n ? `\\n\\nand ${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle',\n )}`\n : ''\n }`,\n );\n\n for (const { pkgName, pkgVersion } of overrides) {\n const shouldAddOverride = await askShouldAddPackageOverride(\n pkgName,\n pkgVersion,\n );\n\n if (shouldAddOverride) {\n await packageManager.addOverride(pkgName, pkgVersion);\n }\n }\n\n if (PNPM.detect()) {\n // For pnpm, we want to install iitm\n // See: https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle\n const iitmAlreadyInstalled = hasPackageInstalled(\n 'import-in-the-middle',\n packageJson,\n );\n Sentry.setTag('iitm-already-installed', iitmAlreadyInstalled);\n\n const shouldInstallIitm = await askShouldInstallPackage(\n 'import-in-the-middle',\n );\n\n if (shouldInstallIitm) {\n await installPackage({\n packageName: 'import-in-the-middle',\n alreadyInstalled: iitmAlreadyInstalled,\n packageManager,\n forceInstall,\n });\n }\n }\n}\n\nexport async function confirmReadImportDocs(\n deploymentPlatform: DeploymentPlatform | symbol,\n) {\n const canImportSentryServerConfigFile =\n deploymentPlatform !== 'vercel' && deploymentPlatform !== 'netlify';\n\n if (!canImportSentryServerConfigFile) {\n // Nothing to do, users have been set up with automatic top-level-import instead\n return;\n }\n\n const docsUrl =\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/install/cli-import/#initializing-sentry-with---import';\n\n clack.log.info(\n `After building your Nuxt app, you need to ${chalk.bold(\n '--import',\n )} the Sentry server config file when running your app.\\n\\nFor more info, see:\\n\\n${chalk.underline(\n docsUrl,\n )}`,\n );\n\n const shouldOpenDocs = await abortIfCancelled(\n clack.confirm({ message: 'Do you want to open the docs?' }),\n );\n\n Sentry.setTag('init-with-import-docs-opened', shouldOpenDocs);\n\n if (shouldOpenDocs) {\n // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here\n const noop = () => {}; // eslint-disable-line @typescript-eslint/no-empty-function\n opn(docsUrl, { wait: false }).then((cp) => cp.on('error', noop), noop);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/nuxt/sdk-setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAC7B,+EAA+E;AAC/E,sDAAwC;AACxC,qDAAuC;AACvC,kDAA0B;AAC1B,kFAAkF;AAClF,uCAAkD;AAClD,kFAAkF;AAClF,8CAAiD;AACjD,8CAAsB;AACtB,mCAAyC;AACzC,4CAAyC;AACzC,0CAOwB;AACxB,wDAG+B;AAC/B,8DAAqE;AACrE,2CAKqB;AACrB,mCAAuE;AAEvE,MAAM,kBAAkB,GAAG;IACzB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;CAClB,CAAC;AAEK,KAAK,UAAU,aAAa;IACjC,IAAI,UAAU,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CACpD,iBAAE,CAAC,UAAU,CAAC,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC,CAClD,CAAC;IAEF,IAAI,CAAC,UAAU,EAAE;QACf,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;QACjE,MAAM,CAAC,MAAM,CAAC,sBAAsB,EAAE,QAAQ,CAAC,CAAC;QAChD,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AAC,8BAA8B,EAAE,cAAc,CAAC,CAAC;IAE9D,IAAI,cAAc,EAAE;QAClB,iGAAiG;QACjG,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,2DAA2D;QAClF,IAAA,aAAG,EAAC,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;KACxE;AACH,CAAC;AAjCD,sDAiCC","sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as Sentry from '@sentry/node';\nimport chalk from 'chalk';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { generateCode, loadFile } from 'magicast';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { addNuxtModule } from 'magicast/helpers';\nimport opn from 'opn';\nimport { type SemVer, lt } from 'semver';\nimport { traceStep } from '../telemetry';\nimport {\n abortIfCancelled,\n askShouldAddPackageOverride,\n askShouldInstallPackage,\n featureSelectionPrompt,\n installPackage,\n isUsingTypeScript,\n} from '../utils/clack';\nimport {\n type PackageDotJson,\n hasPackageInstalled,\n} from '../utils/package-json';\nimport { PNPM, type PackageManager } from '../utils/package-manager';\nimport {\n getConfigBody,\n getDefaultNuxtConfig,\n getNuxtModuleFallbackTemplate,\n getSentryConfigContents,\n} from './templates';\nimport { type DeploymentPlatform, deploymentPlatforms } from './types';\n\nconst possibleNuxtConfig = [\n 'nuxt.config.js',\n 'nuxt.config.mjs',\n 'nuxt.config.cjs',\n 'nuxt.config.ts',\n 'nuxt.config.mts',\n 'nuxt.config.cts',\n];\n\nexport async function getNuxtConfig(): Promise<string> {\n let configFile = possibleNuxtConfig.find((fileName) =>\n fs.existsSync(path.join(process.cwd(), fileName)),\n );\n\n if (!configFile) {\n clack.log.info('No Nuxt config file found, creating a new one.');\n Sentry.setTag('nuxt-config-strategy', 'create');\n // nuxt recommends its config to be .ts by default\n configFile = 'nuxt.config.ts';\n\n await fs.promises.writeFile(\n path.join(process.cwd(), configFile),\n getDefaultNuxtConfig(),\n { encoding: 'utf-8', flag: 'w' },\n );\n\n clack.log.success(`Created ${chalk.cyan('nuxt.config.ts')}.`);\n }\n\n return path.join(process.cwd(), configFile);\n}\n\nexport async function askDeploymentPlatform(): Promise<\n DeploymentPlatform | symbol\n> {\n return await abortIfCancelled(\n clack.select({\n message: 'Please select your deployment platform.',\n options: deploymentPlatforms.map((platform) => ({\n value: platform,\n label: `${platform.charAt(0).toUpperCase()}${platform.slice(1)}`,\n })),\n }),\n );\n}\n\nexport async function addSDKModule(\n config: string,\n options: { org: string; project: string; url: string; selfHosted: boolean },\n deploymentPlatform: DeploymentPlatform | symbol,\n): Promise<void> {\n const failureTagKey = 'modify-nuxt-config-error';\n\n const shouldTopLevelImport =\n deploymentPlatform === 'vercel' || deploymentPlatform === 'netlify';\n\n if (shouldTopLevelImport) {\n clack.log.warn(\n `Sentry needs to be initialized before the application starts. ${chalk.cyan(\n `${deploymentPlatform\n .charAt(0)\n .toUpperCase()}${deploymentPlatform.slice(1)}`,\n )} does not support this yet.\\n\\nWe will inject the Sentry server-side config at the top of your Nuxt server entry file instead.\\n\\nThis comes with some restrictions, for more info see:\\n\\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/install/top-level-import/',\n )} `,\n );\n }\n\n let module;\n\n try {\n module = await loadFile(config);\n } catch (e) {\n if (e instanceof Error) {\n if (e instanceof SyntaxError || e.message.includes('Unexpected token')) {\n Sentry.setTag(failureTagKey, 'loadFile-failed-syntax-error');\n } else if (\n e.message.includes('ENOENT') ||\n e.message.includes('no such file')\n ) {\n Sentry.setTag(failureTagKey, 'loadFile-failed-file-not-found');\n }\n } else {\n Sentry.setTag(failureTagKey, 'loadFile-failed');\n }\n\n clack.log.error(\n `Error while loading Nuxt config file: ${\n e instanceof Error ? e.message : 'Unknown'\n }`,\n );\n\n showFallbackInstructions(config, options, shouldTopLevelImport);\n throw e;\n }\n\n try {\n addNuxtModule(module, '@sentry/nuxt/module', 'sentry', {\n sourceMapsUploadOptions: {\n org: options.org,\n project: options.project,\n ...(options.selfHosted && { url: options.url }),\n },\n ...(shouldTopLevelImport && {\n autoInjectServerSentry: 'top-level-import',\n }),\n });\n } catch (e) {\n Sentry.setTag(failureTagKey, 'adding-sentry-options-failed');\n\n clack.log.error(\n `Error while modifying 'sentry' in Nuxt config: ${\n e instanceof Error ? e.message : 'Unknown'\n }`,\n );\n\n showFallbackInstructions(config, options, shouldTopLevelImport);\n throw e;\n }\n\n try {\n addNuxtModule(module, '@sentry/nuxt/module', 'sourcemap', {\n client: 'hidden',\n });\n } catch (e) {\n Sentry.setTag(failureTagKey, 'adding-sourcemap-options-failed');\n\n clack.log.error(\n `Error while modifying 'sourcemap' in Nuxt config: ${\n e instanceof Error ? e.message : 'Unknown'\n }`,\n );\n\n showFallbackInstructions(config, options, shouldTopLevelImport);\n throw e;\n }\n\n let code;\n\n try {\n ({ code } = generateCode(module));\n } catch (e) {\n Sentry.setTag(failureTagKey, 'generateCode-failed');\n\n clack.log.error(\n `Error while generating module code: ${\n e instanceof Error ? e.message : 'Unknown'\n }`,\n );\n\n showFallbackInstructions(config, options, shouldTopLevelImport);\n throw e;\n }\n\n try {\n await fs.promises.writeFile(config, code, { encoding: 'utf-8', flag: 'w' });\n\n clack.log.success(\n `Added Sentry Nuxt Module to ${chalk.cyan(path.basename(config))}.`,\n );\n } catch (e: unknown) {\n Sentry.setTag(failureTagKey, 'writeFile-failed');\n\n clack.log.error(\n `Error while writing Nuxt config: ${\n e instanceof Error ? e.message : 'Unknown'\n }`,\n );\n\n showFallbackInstructions(config, options, shouldTopLevelImport);\n throw e;\n }\n}\n\nfunction showFallbackInstructions(\n config: string,\n options: { org: string; project: string; url: string; selfHosted: boolean },\n shouldTopLevelImport: boolean,\n) {\n clack.log.warn(\n `Please add the following settings to ${chalk.cyan(\n path.basename(config),\n )}:`,\n );\n // eslint-disable-next-line no-console\n console.log(\n `\\n\\n${getNuxtModuleFallbackTemplate(options, shouldTopLevelImport)}\\n\\n`,\n );\n}\n\nexport async function createConfigFiles(dsn: string) {\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 ] as const);\n\n const typeScriptDetected = isUsingTypeScript();\n\n const configVariants = ['server', 'client'] 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 getSentryConfigContents(dsn, configVariant, selectedFeatures),\n { encoding: 'utf8', flag: 'w' },\n );\n clack.log.success(\n `Created new ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )}.`,\n );\n Sentry.setTag(`created-${configVariant}-config`, true);\n } else {\n clack.log.info(\n `Okay, here are the changes your ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )} should contain:`,\n );\n // eslint-disable-next-line no-console\n console.log(\n '\\n\\n ' +\n getConfigBody(dsn, configVariant, selectedFeatures) +\n '\\n\\n',\n );\n }\n });\n }\n}\n\nexport async function addNuxtOverrides(\n packageJson: PackageDotJson,\n packageManager: PackageManager,\n nuxtMinVer: SemVer | null,\n forceInstall?: boolean,\n) {\n const isPNPM = PNPM.detect();\n\n const overrides = [\n {\n pkgName: '@vercel/nft',\n pkgVersion: '^0.27.4',\n },\n ...(nuxtMinVer && lt(nuxtMinVer, '3.14.0')\n ? [{ pkgName: 'ofetch', pkgVersion: '^1.4.0' }]\n : []),\n ];\n\n clack.log.warn(\n `To ensure Sentry can properly instrument your code it needs to add version overrides for some Nuxt dependencies${\n isPNPM ? ` and install ${chalk.cyan('import-in-the-middle')}.` : '.'\n }\\n\\nFor more info see: ${chalk.underline(\n 'https://github.com/getsentry/sentry-javascript/issues/14514',\n )}${\n isPNPM\n ? `\\n\\nand ${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle',\n )}`\n : ''\n }`,\n );\n\n for (const { pkgName, pkgVersion } of overrides) {\n const shouldAddOverride = await askShouldAddPackageOverride(\n pkgName,\n pkgVersion,\n );\n\n if (shouldAddOverride) {\n await packageManager.addOverride(pkgName, pkgVersion);\n }\n }\n\n if (PNPM.detect()) {\n // For pnpm, we want to install iitm\n // See: https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle\n const iitmAlreadyInstalled = hasPackageInstalled(\n 'import-in-the-middle',\n packageJson,\n );\n Sentry.setTag('iitm-already-installed', iitmAlreadyInstalled);\n\n const shouldInstallIitm = await askShouldInstallPackage(\n 'import-in-the-middle',\n );\n\n if (shouldInstallIitm) {\n await installPackage({\n packageName: 'import-in-the-middle',\n alreadyInstalled: iitmAlreadyInstalled,\n packageManager,\n forceInstall,\n });\n }\n }\n}\n\nexport async function confirmReadImportDocs(\n deploymentPlatform: DeploymentPlatform | symbol,\n) {\n const canImportSentryServerConfigFile =\n deploymentPlatform !== 'vercel' && deploymentPlatform !== 'netlify';\n\n if (!canImportSentryServerConfigFile) {\n // Nothing to do, users have been set up with automatic top-level-import instead\n return;\n }\n\n const docsUrl =\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/install/cli-import/#initializing-sentry-with---import';\n\n clack.log.info(\n `After building your Nuxt app, you need to ${chalk.bold(\n '--import',\n )} the Sentry server config file when running your app.\\n\\nFor more info, see:\\n\\n${chalk.underline(\n docsUrl,\n )}`,\n );\n\n const shouldOpenDocs = await abortIfCancelled(\n clack.confirm({ message: 'Do you want to open the docs?' }),\n );\n\n Sentry.setTag('init-with-import-docs-opened', shouldOpenDocs);\n\n if (shouldOpenDocs) {\n // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here\n const noop = () => {}; // eslint-disable-line @typescript-eslint/no-empty-function\n opn(docsUrl, { wait: false }).then((cp) => cp.on('error', noop), noop);\n }\n}\n"]}
|
|
@@ -114,6 +114,8 @@ Feel free to delete this file.
|
|
|
114
114
|
<script setup>
|
|
115
115
|
import * as Sentry from '@sentry/nuxt';
|
|
116
116
|
import { useFetch} from '#imports'
|
|
117
|
+
|
|
118
|
+
const hasSentError = ref(false);
|
|
117
119
|
|
|
118
120
|
function getSentryData() {
|
|
119
121
|
Sentry.startSpan(
|
|
@@ -124,6 +126,7 @@ Feel free to delete this file.
|
|
|
124
126
|
async () => {
|
|
125
127
|
const { error } = await useFetch('/api/sentry-example-api');
|
|
126
128
|
if (error.value) {
|
|
129
|
+
hasSentError.value = true;
|
|
127
130
|
throw new Error('Sentry Example Frontend Error');
|
|
128
131
|
}
|
|
129
132
|
}
|
|
@@ -134,66 +137,147 @@ Feel free to delete this file.
|
|
|
134
137
|
<template>
|
|
135
138
|
<title>Sentry Onboarding</title>
|
|
136
139
|
<div>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
<
|
|
140
|
-
fill="
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
</
|
|
140
|
+
<main>
|
|
141
|
+
<div class="flex-spacer" />
|
|
142
|
+
<svg height="40" width="40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
143
|
+
<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"/>
|
|
144
|
+
</svg>
|
|
145
|
+
<h1>
|
|
146
|
+
sentry-example-page
|
|
147
|
+
</h1>
|
|
148
|
+
|
|
149
|
+
<p class="description">
|
|
150
|
+
Click the button below, and view the sample error on the Sentry <a target="_blank" href="${issuesPageLink}">Issues Page</a>.
|
|
151
|
+
For more details about setting up Sentry, <a target="_blank" href="https://docs.sentry.io/platforms/javascript/guides/nuxt/">read our docs</a>.
|
|
152
|
+
</p>
|
|
153
|
+
|
|
154
|
+
<button
|
|
155
|
+
type="button"
|
|
156
|
+
@click="getSentryData"
|
|
157
|
+
>
|
|
158
|
+
<span>
|
|
159
|
+
Throw Sample Error
|
|
160
|
+
</span>
|
|
161
|
+
</button>
|
|
162
|
+
|
|
163
|
+
<p v-if="hasSentError" class="success">
|
|
164
|
+
Sample error was sent to Sentry.
|
|
165
|
+
</p>
|
|
166
|
+
<div v-else class="success_placeholder" />
|
|
167
|
+
|
|
168
|
+
<div class="flex-spacer" />
|
|
169
|
+
<p class="description">
|
|
170
|
+
Adblockers will prevent errors from being sent to Sentry.
|
|
171
|
+
</p>
|
|
172
|
+
</main>
|
|
173
|
+
</div>
|
|
163
174
|
</template>
|
|
164
175
|
|
|
165
176
|
<style scoped>
|
|
177
|
+
:global(body) {
|
|
178
|
+
margin: 0;
|
|
179
|
+
|
|
180
|
+
@media (prefers-color-scheme: dark) {
|
|
181
|
+
color: #ededed;
|
|
182
|
+
background-color: #0a0a0a;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
166
186
|
main {
|
|
167
187
|
display: flex;
|
|
188
|
+
min-height: 100vh;
|
|
189
|
+
box-sizing: border-box;
|
|
168
190
|
flex-direction: column;
|
|
169
191
|
justify-content: center;
|
|
170
192
|
align-items: center;
|
|
193
|
+
gap: 16px;
|
|
194
|
+
padding: 16px;
|
|
195
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
h1 {
|
|
199
|
+
padding: 0px 4px;
|
|
200
|
+
margin: 0;
|
|
201
|
+
border-radius: 4px;
|
|
202
|
+
background-color: rgba(24, 20, 35, 0.03);
|
|
203
|
+
font-family: monospace;
|
|
204
|
+
font-size: 20px;
|
|
205
|
+
line-height: 1.2;
|
|
171
206
|
}
|
|
172
207
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
208
|
+
p {
|
|
209
|
+
margin: 0;
|
|
210
|
+
font-size: 20px;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
a {
|
|
214
|
+
color: #6341F0;
|
|
215
|
+
text-decoration: underline;
|
|
216
|
+
cursor: pointer;
|
|
217
|
+
|
|
218
|
+
@media (prefers-color-scheme: dark) {
|
|
219
|
+
color: #B3A1FF;
|
|
220
|
+
}
|
|
177
221
|
}
|
|
178
222
|
|
|
179
223
|
button {
|
|
180
|
-
|
|
224
|
+
border-radius: 8px;
|
|
225
|
+
color: white;
|
|
181
226
|
cursor: pointer;
|
|
182
|
-
background-color:
|
|
183
|
-
border-radius: 4px;
|
|
227
|
+
background-color: #553DB8;
|
|
184
228
|
border: none;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
229
|
+
padding: 0;
|
|
230
|
+
margin-top: 4px;
|
|
231
|
+
|
|
232
|
+
& > span {
|
|
233
|
+
display: inline-block;
|
|
234
|
+
padding: 12px 16px;
|
|
235
|
+
border-radius: inherit;
|
|
236
|
+
font-size: 20px;
|
|
237
|
+
font-weight: bold;
|
|
238
|
+
line-height: 1;
|
|
239
|
+
background-color: #7553FF;
|
|
240
|
+
border: 1px solid #553DB8;
|
|
241
|
+
transform: translateY(-4px);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
&:hover > span {
|
|
245
|
+
transform: translateY(-8px);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
&:active > span {
|
|
249
|
+
transform: translateY(0);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.description {
|
|
254
|
+
text-align: center;
|
|
255
|
+
color: #6E6C75;
|
|
256
|
+
max-width: 500px;
|
|
257
|
+
line-height: 1.5;
|
|
258
|
+
font-size: 20px;
|
|
259
|
+
|
|
260
|
+
@media (prefers-color-scheme: dark) {
|
|
261
|
+
color: #A49FB5;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.flex-spacer {
|
|
266
|
+
flex: 1;
|
|
189
267
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
268
|
+
|
|
269
|
+
.success {
|
|
270
|
+
padding: 12px 16px;
|
|
271
|
+
border-radius: 8px;
|
|
272
|
+
font-size: 20px;
|
|
273
|
+
line-height: 1;
|
|
274
|
+
background-color: #00F261;
|
|
275
|
+
border: 1px solid #00BF4D;
|
|
276
|
+
color: #181423;
|
|
194
277
|
}
|
|
195
|
-
|
|
196
|
-
|
|
278
|
+
|
|
279
|
+
.success_placeholder {
|
|
280
|
+
height: 46px;
|
|
197
281
|
}
|
|
198
282
|
</style>
|
|
199
283
|
`;
|
|
@@ -218,6 +302,8 @@ Feel free to delete this file.
|
|
|
218
302
|
|
|
219
303
|
<script setup>
|
|
220
304
|
import * as Sentry from '@sentry/nuxt';
|
|
305
|
+
|
|
306
|
+
const hasSentError = ref(false);
|
|
221
307
|
|
|
222
308
|
const throwError = () => {
|
|
223
309
|
Sentry.startSpan(
|
|
@@ -226,6 +312,7 @@ Feel free to delete this file.
|
|
|
226
312
|
op: 'test'
|
|
227
313
|
},
|
|
228
314
|
() => {
|
|
315
|
+
hasSentError.value = true;
|
|
229
316
|
throw new Error('Sentry Example Error');
|
|
230
317
|
}
|
|
231
318
|
)
|
|
@@ -233,28 +320,56 @@ Feel free to delete this file.
|
|
|
233
320
|
</script>
|
|
234
321
|
|
|
235
322
|
<template>
|
|
236
|
-
<
|
|
323
|
+
<div v-if="hasSentError" class="success">
|
|
324
|
+
Sample error was sent to Sentry.
|
|
325
|
+
</div>
|
|
326
|
+
<button v-else @click="throwError">
|
|
327
|
+
<span>Throw Sample Error</span>
|
|
328
|
+
</button>
|
|
237
329
|
</template>
|
|
238
330
|
|
|
239
331
|
<style scoped>
|
|
240
332
|
button {
|
|
241
|
-
|
|
333
|
+
border-radius: 8px;
|
|
334
|
+
color: white;
|
|
242
335
|
cursor: pointer;
|
|
243
|
-
background-color:
|
|
244
|
-
border-radius: 4px;
|
|
336
|
+
background-color: #553DB8;
|
|
245
337
|
border: none;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
338
|
+
padding: 0;
|
|
339
|
+
margin-top: 4px;
|
|
340
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
|
|
341
|
+
|
|
342
|
+
& > span {
|
|
343
|
+
display: inline-block;
|
|
344
|
+
padding: 12px 16px;
|
|
345
|
+
border-radius: inherit;
|
|
346
|
+
font-size: 20px;
|
|
347
|
+
font-weight: bold;
|
|
348
|
+
line-height: 1;
|
|
349
|
+
background-color: #7553FF;
|
|
350
|
+
border: 1px solid #553DB8;
|
|
351
|
+
transform: translateY(-4px);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
&:hover > span {
|
|
355
|
+
transform: translateY(-8px);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
&:active > span {
|
|
359
|
+
transform: translateY(0);
|
|
360
|
+
}
|
|
255
361
|
}
|
|
256
|
-
|
|
257
|
-
|
|
362
|
+
|
|
363
|
+
.success {
|
|
364
|
+
width: max-content;
|
|
365
|
+
padding: 12px 16px;
|
|
366
|
+
border-radius: 8px;
|
|
367
|
+
font-size: 20px;
|
|
368
|
+
line-height: 1;
|
|
369
|
+
background-color: #00F261;
|
|
370
|
+
border: 1px solid #00BF4D;
|
|
371
|
+
color: #181423;
|
|
372
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
|
|
258
373
|
}
|
|
259
374
|
</style>
|
|
260
375
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/nuxt/templates.ts"],"names":[],"mappings":";;;AAAA,sCAAiD;AAOjD,SAAgB,oBAAoB;IAClC,OAAO;;;;;CAKR,CAAC;AACF,CAAC;AAPD,oDAOC;AAED,SAAgB,6BAA6B,CAC3C,OAKC,EACD,oBAA6B;IAE7B,OAAO;;;cAGK,OAAO,CAAC,GAAG;kBACP,OAAO,CAAC,OAAO,KAC7B,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,EAC1D;QAEI,oBAAoB;QAClB,CAAC,CAAC,mDAAmD;QACrD,CAAC,CAAC,EACN;;mCAE+B,CAAC;AACpC,CAAC;AAvBD,sEAuBC;AAED,SAAgB,uBAAuB,CACrC,GAAW,EACX,MAA2B,EAC3B,gBAAwC;IAExC,IAAI,MAAM,KAAK,QAAQ,EAAE;QACvB,OAAO,6BAA6B,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;KAC7D;IAED,OAAO,6BAA6B,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AAC9D,CAAC;AAVD,0DAUC;AAED,MAAM,iBAAiB,GAAiD;IACtE,WAAW,EAAE;QACX,8EAA8E;QA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gB,qBAAqB;IACnC,OAAO;;;;;sBAKa,CAAC;AACvB,CAAC;AAPD,sDAOC;AAED,SAAgB,4BAA4B,CAAC,OAI5C;IACC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IACxC,MAAM,cAAc,GAAG,IAAA,uBAAiB,EAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IAE3E,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4CQ,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8C9B,CAAC;AACF,CAAC;AAnGD,oEAmGC;AAED,SAAgB,2BAA2B;IACzC,OAAO;;;;;;;CAOR,CAAC;AACF,CAAC;AATD,kEASC;AAED,SAAgB,4BAA4B;IAC1C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CR,CAAC;AACF,CAAC;AAhDD,oEAgDC","sourcesContent":["import { getIssueStreamUrl } from '../utils/url';\n\ntype SelectedSentryFeatures = {\n performance: boolean;\n replay: boolean;\n};\n\nexport function getDefaultNuxtConfig(): string {\n return `// https://nuxt.com/docs/api/configuration/nuxt-config\nexport default defineNuxtConfig({\n compatibilityDate: '2024-04-03',\n devtools: { enabled: true }\n})\n`;\n}\n\nexport function getNuxtModuleFallbackTemplate(\n options: {\n org: string;\n project: string;\n url: string;\n selfHosted: boolean;\n },\n shouldTopLevelImport: boolean,\n): string {\n return ` modules: [\"@sentry/nuxt/module\"],\n sentry: {\n sourceMapsUploadOptions: {\n org: \"${options.org}\",\n project: \"${options.project}\",${\n options.selfHosted ? `\\n url: \"${options.url}\",` : ''\n }\n },${\n shouldTopLevelImport\n ? `\\n autoInjectServerSentry: \"top-level-import\",`\n : ''\n }\n },\n sourcemap: { client: \"hidden\" },`;\n}\n\nexport function getSentryConfigContents(\n dsn: string,\n config: 'client' | 'server',\n selectedFeatures: SelectedSentryFeatures,\n): string {\n if (config === 'client') {\n return getSentryClientConfigContents(dsn, selectedFeatures);\n }\n\n return getSentryServerConfigContents(dsn, selectedFeatures);\n}\n\nconst featuresConfigMap: Record<keyof SelectedSentryFeatures, string> = {\n performance: [\n ' // We recommend adjusting this value in production, or using tracesSampler',\n ' // for finer control',\n ' tracesSampleRate: 1.0,',\n ].join('\\n'),\n replay: [\n ' // This sets the sample rate to be 10%. You may want this to be 100% while',\n ' // in development and sample at a lower rate in production',\n ' replaysSessionSampleRate: 0.1,',\n ' ',\n ' // If the entire session is not sampled, use the below sample rate to sample',\n ' // sessions when an error occurs.',\n ' replaysOnErrorSampleRate: 1.0,',\n ' ',\n \" // If you don't want to use Session Replay, just remove the line below:\",\n ' integrations: [Sentry.replayIntegration()],',\n ].join('\\n'),\n};\n\nconst featuresMap: Record<\n 'client' | 'server',\n Array<keyof SelectedSentryFeatures>\n> = {\n client: ['performance', 'replay'],\n server: ['performance'],\n};\n\nexport function getConfigBody(\n dsn: string,\n variant: 'client' | 'server',\n selectedFeatures: SelectedSentryFeatures,\n) {\n return [\n `dsn: \"${dsn}\",`,\n Object.entries(selectedFeatures)\n .map(([feature, activated]: [keyof SelectedSentryFeatures, boolean]) => {\n return featuresMap[variant].includes(feature) && activated\n ? featuresConfigMap[feature]\n : null;\n })\n .filter(Boolean)\n .join('\\n\\n'),\n ]\n .filter(Boolean)\n .join('\\n\\n');\n}\n\nfunction getSentryClientConfigContents(\n dsn: string,\n selectedFeatures: SelectedSentryFeatures,\n): string {\n return `import * as Sentry from \"@sentry/nuxt\";\n\nSentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n ${getConfigBody(dsn, 'client', selectedFeatures)}\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\nfunction getSentryServerConfigContents(\n dsn: string,\n selectedFeatures: SelectedSentryFeatures,\n): string {\n return `import * as Sentry from \"@sentry/nuxt\";\n \nSentry.init({\n ${getConfigBody(dsn, 'server', selectedFeatures)}\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 getIndexRouteTemplate(): string {\n return `<!--\nThis is just to verify the sentry-example-page.\nFeel free to delete this file.\n-->\n\n<template></template>`;\n}\n\nexport function getSentryExamplePageTemplate(options: {\n url: string;\n org: string;\n projectId: string;\n}): string {\n const { url, org, projectId } = options;\n const issuesPageLink = getIssueStreamUrl({ url, orgSlug: org, projectId });\n\n return `<!--\nThis is just a very simple page with a button to throw an example error.\nFeel free to delete this file.\n-->\n\n<script setup>\n import * as Sentry from '@sentry/nuxt';\n import { useFetch} from '#imports'\n \n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const { error } = await useFetch('/api/sentry-example-api');\n if (error.value) {\n throw new Error('Sentry Example Frontend Error');\n }\n }\n )\n }\n</script>\n\n<template>\n <title>Sentry Onboarding</title>\n <div>\n <main>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 200 44\">\n <path\n fill=\"currentColor\"\n d=\"M124.32,28.28,109.56,9.22h-3.68V34.77h3.73V15.19l15.18,19.58h3.26V9.22h-3.73ZM87.15,23.54h13.23V20.22H87.14V12.53h14.93V9.21H83.34V34.77h18.92V31.45H87.14ZM71.59,20.3h0C66.44,19.06,65,18.08,65,15.7c0-2.14,1.89-3.59,4.71-3.59a12.06,12.06,0,0,1,7.07,2.55l2-2.83a14.1,14.1,0,0,0-9-3c-5.06,0-8.59,3-8.59,7.27,0,4.6,3,6.19,8.46,7.52C74.51,24.74,76,25.78,76,28.11s-2,3.77-5.09,3.77a12.34,12.34,0,0,1-8.3-3.26l-2.25,2.69a15.94,15.94,0,0,0,10.42,3.85c5.48,0,9-2.95,9-7.51C79.75,23.79,77.47,21.72,71.59,20.3ZM195.7,9.22l-7.69,12-7.64-12h-4.46L186,24.67V34.78h3.84V24.55L200,9.22Zm-64.63,3.46h8.37v22.1h3.84V12.68h8.37V9.22H131.08ZM169.41,24.8c3.86-1.07,6-3.77,6-7.63,0-4.91-3.59-8-9.38-8H154.67V34.76h3.8V25.58h6.45l6.48,9.2h4.44l-7-9.82Zm-10.95-2.5V12.6h7.17c3.74,0,5.88,1.77,5.88,4.84s-2.29,4.86-5.84,4.86Z M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z\"\n />\n </svg>\n <p>\n Get Started with this <strong>simple Example:</strong>\n </p>\n\n <p>1. Send us a sample error:</p>\n <button type=\"button\" @click=\"getSentryData\"> Throw error! </button>\n\n <p>\n 2. Look for the error on the\n <a href=\"${issuesPageLink}\">Issues Page</a>.\n </p>\n <p style=\"margin-top: 24px;\">\n For more information, take a look at the\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/nuxt/\">\n Sentry Nuxt Documentation\n </a>\n </p>\n </main>\n</div>\n</template>\n\n<style scoped>\n main {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n svg {\n font-size: 4rem;\n margin: 14px 0;\n height: 1em;\n }\n\n button {\n padding: 12px;\n cursor: pointer;\n background-color: rgb(54, 45, 89);\n border-radius: 4px;\n border: none;\n color: white;\n font-size: 1em;\n margin: 1em;\n transition: all 0.25s ease-in-out;\n }\n button:hover {\n background-color: #8c5393;\n box-shadow: 4px;\n box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);\n }\n button:active {\n background-color: #c73852;\n }\n</style>\n`;\n}\n\nexport function getSentryExampleApiTemplate() {\n return `// This is just a very simple API route that throws an example error.\n// Feel free to delete this file.\nimport { defineEventHandler } from '#imports';\n\nexport default defineEventHandler(() => {\n throw new Error(\"Sentry Example API Route Error\");\n});\n`;\n}\n\nexport function getSentryErrorButtonTemplate() {\n return `<!--\nThis is just a very simple component that throws an example error.\nFeel free to delete this file.\n-->\n\n<script setup>\n import * as Sentry from '@sentry/nuxt';\n \n const throwError = () => {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n () => {\n throw new Error('Sentry Example Error');\n }\n )\n };\n</script>\n\n<template>\n <button id=\"errorBtn\" @click=\"throwError\"> Throw Error! </button>\n</template>\n\n<style scoped>\n button {\n padding: 12px;\n cursor: pointer;\n background-color: rgb(54, 45, 89);\n border-radius: 4px;\n border: none;\n color: white;\n font-size: 1em;\n margin: 1em;\n transition: all 0.25s ease-in-out;\n }\n button:hover {\n background-color: #8c5393;\n box-shadow: 4px;\n box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);\n }\n button:active {\n background-color: #c73852;\n }\n</style>\n`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/nuxt/templates.ts"],"names":[],"mappings":";;;AAAA,sCAAiD;AAOjD,SAAgB,oBAAoB;IAClC,OAAO;;;;;CAKR,CAAC;AACF,CAAC;AAPD,oDAOC;AAED,SAAgB,6BAA6B,CAC3C,OAKC,EACD,oBAA6B;IAE7B,OAAO;;;cAGK,OAAO,CAAC,GAAG;kBACP,OAAO,CAAC,OAAO,KAC7B,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAA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import { getIssueStreamUrl } from '../utils/url';\n\ntype SelectedSentryFeatures = {\n performance: boolean;\n replay: boolean;\n};\n\nexport function getDefaultNuxtConfig(): string {\n return `// https://nuxt.com/docs/api/configuration/nuxt-config\nexport default defineNuxtConfig({\n compatibilityDate: '2024-04-03',\n devtools: { enabled: true }\n})\n`;\n}\n\nexport function getNuxtModuleFallbackTemplate(\n options: {\n org: string;\n project: string;\n url: string;\n selfHosted: boolean;\n },\n shouldTopLevelImport: boolean,\n): string {\n return ` modules: [\"@sentry/nuxt/module\"],\n sentry: {\n sourceMapsUploadOptions: {\n org: \"${options.org}\",\n project: \"${options.project}\",${\n options.selfHosted ? `\\n url: \"${options.url}\",` : ''\n }\n },${\n shouldTopLevelImport\n ? `\\n autoInjectServerSentry: \"top-level-import\",`\n : ''\n }\n },\n sourcemap: { client: \"hidden\" },`;\n}\n\nexport function getSentryConfigContents(\n dsn: string,\n config: 'client' | 'server',\n selectedFeatures: SelectedSentryFeatures,\n): string {\n if (config === 'client') {\n return getSentryClientConfigContents(dsn, selectedFeatures);\n }\n\n return getSentryServerConfigContents(dsn, selectedFeatures);\n}\n\nconst featuresConfigMap: Record<keyof SelectedSentryFeatures, string> = {\n performance: [\n ' // We recommend adjusting this value in production, or using tracesSampler',\n ' // for finer control',\n ' tracesSampleRate: 1.0,',\n ].join('\\n'),\n replay: [\n ' // This sets the sample rate to be 10%. You may want this to be 100% while',\n ' // in development and sample at a lower rate in production',\n ' replaysSessionSampleRate: 0.1,',\n ' ',\n ' // If the entire session is not sampled, use the below sample rate to sample',\n ' // sessions when an error occurs.',\n ' replaysOnErrorSampleRate: 1.0,',\n ' ',\n \" // If you don't want to use Session Replay, just remove the line below:\",\n ' integrations: [Sentry.replayIntegration()],',\n ].join('\\n'),\n};\n\nconst featuresMap: Record<\n 'client' | 'server',\n Array<keyof SelectedSentryFeatures>\n> = {\n client: ['performance', 'replay'],\n server: ['performance'],\n};\n\nexport function getConfigBody(\n dsn: string,\n variant: 'client' | 'server',\n selectedFeatures: SelectedSentryFeatures,\n) {\n return [\n `dsn: \"${dsn}\",`,\n Object.entries(selectedFeatures)\n .map(([feature, activated]: [keyof SelectedSentryFeatures, boolean]) => {\n return featuresMap[variant].includes(feature) && activated\n ? featuresConfigMap[feature]\n : null;\n })\n .filter(Boolean)\n .join('\\n\\n'),\n ]\n .filter(Boolean)\n .join('\\n\\n');\n}\n\nfunction getSentryClientConfigContents(\n dsn: string,\n selectedFeatures: SelectedSentryFeatures,\n): string {\n return `import * as Sentry from \"@sentry/nuxt\";\n\nSentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n ${getConfigBody(dsn, 'client', selectedFeatures)}\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\nfunction getSentryServerConfigContents(\n dsn: string,\n selectedFeatures: SelectedSentryFeatures,\n): string {\n return `import * as Sentry from \"@sentry/nuxt\";\n \nSentry.init({\n ${getConfigBody(dsn, 'server', selectedFeatures)}\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 getIndexRouteTemplate(): string {\n return `<!--\nThis is just to verify the sentry-example-page.\nFeel free to delete this file.\n-->\n\n<template></template>`;\n}\n\nexport function getSentryExamplePageTemplate(options: {\n url: string;\n org: string;\n projectId: string;\n}): string {\n const { url, org, projectId } = options;\n const issuesPageLink = getIssueStreamUrl({ url, orgSlug: org, projectId });\n\n return `<!--\nThis is just a very simple page with a button to throw an example error.\nFeel free to delete this file.\n-->\n\n<script setup>\n import * as Sentry from '@sentry/nuxt';\n import { useFetch} from '#imports'\n\n const hasSentError = ref(false);\n \n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const { error } = await useFetch('/api/sentry-example-api');\n if (error.value) {\n hasSentError.value = true;\n throw new Error('Sentry Example Frontend Error');\n }\n }\n )\n }\n</script>\n\n<template>\n <title>Sentry Onboarding</title>\n <div>\n <main>\n <div class=\"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 class=\"description\">\n Click the button below, and view the sample error on the Sentry <a target=\"_blank\" href=\"${issuesPageLink}\">Issues Page</a>. \n For more details about setting up Sentry, <a target=\"_blank\" href=\"https://docs.sentry.io/platforms/javascript/guides/nuxt/\">read our docs</a>.\n </p>\n\n <button\n type=\"button\"\n @click=\"getSentryData\"\n >\n <span>\n Throw Sample Error\n </span>\n </button>\n\n <p v-if=\"hasSentError\" class=\"success\">\n Sample error was sent to Sentry.\n </p>\n <div v-else class=\"success_placeholder\" />\n\n <div class=\"flex-spacer\" />\n <p class=\"description\">\n Adblockers will prevent errors from being sent to Sentry.\n </p>\n </main>\n </div>\n</template>\n\n<style scoped>\n :global(body) {\n margin: 0;\n\n @media (prefers-color-scheme: dark) {\n color: #ededed;\n background-color: #0a0a0a;\n }\n }\n\n main {\n display: flex;\n min-height: 100vh;\n box-sizing: border-box;\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 margin: 0;\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\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</style>\n`;\n}\n\nexport function getSentryExampleApiTemplate() {\n return `// This is just a very simple API route that throws an example error.\n// Feel free to delete this file.\nimport { defineEventHandler } from '#imports';\n\nexport default defineEventHandler(() => {\n throw new Error(\"Sentry Example API Route Error\");\n});\n`;\n}\n\nexport function getSentryErrorButtonTemplate() {\n return `<!--\nThis is just a very simple component that throws an example error.\nFeel free to delete this file.\n-->\n\n<script setup>\n import * as Sentry from '@sentry/nuxt';\n\n const hasSentError = ref(false);\n \n const throwError = () => {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n () => {\n hasSentError.value = true;\n throw new Error('Sentry Example Error');\n }\n )\n };\n</script>\n\n<template>\n <div v-if=\"hasSentError\" class=\"success\">\n Sample error was sent to Sentry.\n </div>\n <button v-else @click=\"throwError\">\n <span>Throw Sample Error</span>\n </button>\n</template>\n\n<style scoped>\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 font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", sans-serif;\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\n .success {\n width: max-content;\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 font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", sans-serif;\n }\n</style>\n`;\n}\n"]}
|