@sentry/wizard 3.20.5 → 3.22.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 +17 -2
- package/dist/package.json +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +67 -7
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.d.ts +5 -1
- package/dist/src/nextjs/templates.js +8 -3
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/remix/codemods/express-server.d.ts +1 -2
- package/dist/src/remix/codemods/express-server.js +1 -26
- package/dist/src/remix/codemods/express-server.js.map +1 -1
- package/dist/src/remix/remix-wizard.js +26 -1
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/remix/sdk-example.d.ts +17 -0
- package/dist/src/remix/sdk-example.js +101 -0
- package/dist/src/remix/sdk-example.js.map +1 -0
- package/dist/src/sveltekit/templates.js +1 -1
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/package.json +1 -1
- package/src/nextjs/nextjs-wizard.ts +56 -5
- package/src/nextjs/templates.ts +24 -4
- package/src/remix/codemods/express-server.ts +0 -32
- package/src/remix/remix-wizard.ts +16 -0
- package/src/remix/sdk-example.ts +116 -0
- package/src/sveltekit/templates.ts +3 -0
|
@@ -52,6 +52,7 @@ var utils_1 = require("./utils");
|
|
|
52
52
|
var Constants_1 = require("../../lib/Constants");
|
|
53
53
|
var ast_utils_1 = require("../utils/ast-utils");
|
|
54
54
|
var vite_1 = require("../sourcemaps/tools/vite");
|
|
55
|
+
var sdk_example_1 = require("./sdk-example");
|
|
55
56
|
function runRemixWizard(options) {
|
|
56
57
|
return __awaiter(this, void 0, void 0, function () {
|
|
57
58
|
return __generator(this, function (_a) {
|
|
@@ -65,7 +66,7 @@ function runRemixWizard(options) {
|
|
|
65
66
|
exports.runRemixWizard = runRemixWizard;
|
|
66
67
|
function runRemixWizardWithTelemetry(options) {
|
|
67
68
|
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
-
var remixConfig, packageJson, _a, selectedProject, authToken, sentryUrl, selfHosted, dsn, isTS, isV2, viteConfig;
|
|
69
|
+
var remixConfig, packageJson, _a, selectedProject, authToken, sentryUrl, selfHosted, dsn, isTS, isV2, viteConfig, shouldCreateExamplePage;
|
|
69
70
|
var _this = this;
|
|
70
71
|
return __generator(this, function (_b) {
|
|
71
72
|
switch (_b.label) {
|
|
@@ -260,6 +261,30 @@ function runRemixWizardWithTelemetry(options) {
|
|
|
260
261
|
}); })];
|
|
261
262
|
case 15:
|
|
262
263
|
_b.sent();
|
|
264
|
+
return [4 /*yield*/, (0, clack_utils_1.askShouldCreateExamplePage)()];
|
|
265
|
+
case 16:
|
|
266
|
+
shouldCreateExamplePage = _b.sent();
|
|
267
|
+
if (!shouldCreateExamplePage) return [3 /*break*/, 18];
|
|
268
|
+
return [4 /*yield*/, (0, telemetry_1.traceStep)('Create example page', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
269
|
+
return __generator(this, function (_a) {
|
|
270
|
+
switch (_a.label) {
|
|
271
|
+
case 0: return [4 /*yield*/, (0, sdk_example_1.createExamplePage)({
|
|
272
|
+
isTS: isTS,
|
|
273
|
+
selfHosted: selfHosted,
|
|
274
|
+
orgSlug: selectedProject.organization.slug,
|
|
275
|
+
projectId: selectedProject.id,
|
|
276
|
+
url: sentryUrl,
|
|
277
|
+
})];
|
|
278
|
+
case 1:
|
|
279
|
+
_a.sent();
|
|
280
|
+
return [2 /*return*/];
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}); })];
|
|
284
|
+
case 17:
|
|
285
|
+
_b.sent();
|
|
286
|
+
_b.label = 18;
|
|
287
|
+
case 18:
|
|
263
288
|
prompts_1.default.outro("\n".concat(chalk_1.default.green('Sentry has been successfully configured for your Remix project.'), "\n\n").concat(chalk_1.default.cyan('You can now deploy your project to see Sentry in action.'), "\n\n").concat(chalk_1.default.cyan("To learn more about how to use Sentry with Remix, visit our documentation:\nhttps://docs.sentry.io/platforms/javascript/guides/remix/")));
|
|
264
289
|
return [2 /*return*/];
|
|
265
290
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remix-wizard.js","sourceRoot":"","sources":["../../../src/remix/remix-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,2DAAmC;AACnC,gDAA0B;AAE1B,oDAU8B;AAC9B,sDAA4D;AAE5D,yCASqB;AACrB,wCAAuC;AACvC,0CAAwD;AACxD,iCAAwC;AACxC,iDAAkD;AAClD,gDAA8C;AAC9C,iDAA+D;AAE/D,SAAsB,cAAc,CAAC,OAAsB;;;YACzD,sBAAO,IAAA,yBAAa,EAClB;oBACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;oBACjC,WAAW,EAAE,OAAO;iBACrB,EACD,cAAM,OAAA,2BAA2B,CAAC,OAAO,CAAC,EAApC,CAAoC,CAC3C,EAAC;;;CACH;AARD,wCAQC;AAED,SAAe,2BAA2B,CACxC,OAAsB;;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,qBAAqB;wBACjC,SAAS,EAAE,OAAO,CAAC,SAAS;wBAC5B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;qBAC3C,CAAC,CAAC;oBAEH,qBAAM,IAAA,+CAAiC,GAAE,EAAA;;oBAAzC,SAAyC,CAAC;oBAEtB,qBAAM,IAAA,2BAAe,GAAE,EAAA;;oBAArC,WAAW,GAAG,SAAuB;oBACvB,qBAAM,IAAA,+BAAiB,GAAE,EAAA;;oBAAvC,WAAW,GAAG,SAAyB;oBAE7C,qEAAqE;oBACrE,qBAAM,IAAA,sCAAwB,EAAC,WAAW,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAA;;oBADtE,qEAAqE;oBACrE,SAAsE,CAAC;oBAGrE,qBAAM,IAAA,oCAAsB,EAAC,OAAO,EAAE,kBAAkB,CAA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,SAQE,CAAC;oBAEH,qBAAM,IAAA,qBAAS,EAAC,mCAAmC,EAAE;;;;;;wCAEjD,qBAAM,IAAA,yCAA6B,EAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,EAAA;;wCAApD,SAAoD,CAAC;;;;wCAErD,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,sKACkG,CAAC,CAAC;wCACnH,IAAA,aAAK,EAAC,GAAC,CAAC,CAAC;;;;;6BAEZ,CAAC,EAAA;;oBARF,SAQE,CAAC;oBAEH,qBAAM,IAAA,qBAAS,EAAC,kCAAkC,EAAE;;;;;;wCAE1C,iBAAiB,GAAG,IAAA,kCAAmB,EAC3C,oBAAoB,EACpB,WAAW,CACZ,CAAC;wCAEF,IAAI,CAAC,iBAAiB,EAAE;4CACtB,sBAAO;yCACR;wCAED,qBAAM,IAAA,mCAAuB,GAAE,EAAA;;wCAA/B,SAA+B,CAAC;;;;wCAEhC,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,2LACwH,CAAC,CAAC;wCACzI,IAAA,aAAK,EAAC,GAAC,CAAC,CAAC;;;;;6BAEZ,CAAC,EAAA;;oBAjBF,SAiBE,CAAC;oBAEH,iBAAK,CAAC,KAAK,CAAC,YACZ,eAAK,CAAC,KAAK,CACX,iEAAiE,CAClE,iBAEC,eAAK,CAAC,IAAI,CAAC,0DAA0D,CAAC,iBAEtE,eAAK,CAAC,IAAI,CACV,uIACwD,CACzD,CAAE,CAAC,CAAC;;;;;CACJ","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n addSentryCliConfig,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n rcCliSetupConfig,\n} from '../utils/clack-utils';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport { WizardOptions } from '../utils/types';\nimport {\n initializeSentryOnEntryClient,\n initializeSentryOnEntryServer,\n updateBuildScript,\n instrumentRootRoute,\n isRemixV2,\n loadRemixConfig,\n runRemixReveal,\n instrumentExpressServer,\n} from './sdk-setup';\nimport { debug } from '../utils/debug';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { isHydrogenApp } from './utils';\nimport { DEFAULT_URL } from '../../lib/Constants';\nimport { findFile } from '../utils/ast-utils';\nimport { configureVitePlugin } from '../sourcemaps/tools/vite';\n\nexport async function runRemixWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'remix',\n },\n () => runRemixWizardWithTelemetry(options),\n );\n}\n\nasync function runRemixWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Remix Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const remixConfig = await loadRemixConfig();\n const packageJson = await getPackageDotJson();\n\n // We expect `@remix-run/dev` to be installed for every Remix project\n await ensurePackageIsInstalled(packageJson, '@remix-run/dev', 'Remix');\n\n const { selectedProject, authToken, sentryUrl, selfHosted } =\n await getOrAskForProjectData(options, 'javascript-remix');\n\n await installPackage({\n packageName: '@sentry/remix',\n alreadyInstalled: hasPackageInstalled('@sentry/remix', packageJson),\n });\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const isTS = isUsingTypeScript();\n const isV2 = isRemixV2(remixConfig, packageJson);\n const viteConfig = findFile('vite.config');\n\n await addSentryCliConfig({ authToken }, rcCliSetupConfig);\n\n if (viteConfig) {\n await traceStep(\n 'Update vite configuration for sourcemap uploads',\n async () => {\n try {\n await configureVitePlugin({\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n selfHosted,\n authToken,\n });\n } catch (e) {\n clack.log\n .warn(`Could not update vite configuration to generate and upload sourcemaps.\n Please update your vite configuration manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n },\n );\n } else {\n await traceStep('Update build script for sourcemap uploads', async () => {\n try {\n await updateBuildScript({\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n url: sentryUrl === DEFAULT_URL ? undefined : sentryUrl,\n isHydrogen: isHydrogenApp(packageJson),\n });\n } catch (e) {\n clack.log\n .warn(`Could not update build script to generate and upload sourcemaps.\n Please update your build script manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n });\n }\n\n await traceStep('Instrument root route', async () => {\n try {\n await instrumentRootRoute(isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not instrument root route.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n traceStep('Reveal missing entry files', () => {\n try {\n runRemixReveal(isTS);\n } catch (e) {\n clack.log.warn(`Could not run 'npx remix reveal'.\n Please create your entry files manually`);\n debug(e);\n }\n });\n\n await traceStep('Initialize Sentry on client entry', async () => {\n try {\n await initializeSentryOnEntryClient(dsn, isTS);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on client entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n await traceStep('Initialize Sentry on server entry', async () => {\n try {\n await initializeSentryOnEntryServer(dsn, isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n await traceStep('Instrument custom Express server', async () => {\n try {\n const hasExpressAdapter = hasPackageInstalled(\n '@remix-run/express',\n packageJson,\n );\n\n if (!hasExpressAdapter) {\n return;\n }\n\n await instrumentExpressServer();\n } catch (e) {\n clack.log.warn(`Could not instrument custom Express server.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/#custom-express-server`);\n debug(e);\n }\n });\n\n clack.outro(`\n${chalk.green(\n 'Sentry has been successfully configured for your Remix project.',\n)}\n\n${chalk.cyan('You can now deploy your project to see Sentry in action.')}\n\n${chalk.cyan(\n `To learn more about how to use Sentry with Remix, visit our documentation:\nhttps://docs.sentry.io/platforms/javascript/guides/remix/`,\n)}`);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"remix-wizard.js","sourceRoot":"","sources":["../../../src/remix/remix-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,2DAAmC;AACnC,gDAA0B;AAE1B,oDAW8B;AAC9B,sDAA4D;AAE5D,yCASqB;AACrB,wCAAuC;AACvC,0CAAwD;AACxD,iCAAwC;AACxC,iDAAkD;AAClD,gDAA8C;AAC9C,iDAA+D;AAC/D,6CAAkD;AAElD,SAAsB,cAAc,CAAC,OAAsB;;;YACzD,sBAAO,IAAA,yBAAa,EAClB;oBACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;oBACjC,WAAW,EAAE,OAAO;iBACrB,EACD,cAAM,OAAA,2BAA2B,CAAC,OAAO,CAAC,EAApC,CAAoC,CAC3C,EAAC;;;CACH;AARD,wCAQC;AAED,SAAe,2BAA2B,CACxC,OAAsB;;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,qBAAqB;wBACjC,SAAS,EAAE,OAAO,CAAC,SAAS;wBAC5B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;qBAC3C,CAAC,CAAC;oBAEH,qBAAM,IAAA,+CAAiC,GAAE,EAAA;;oBAAzC,SAAyC,CAAC;oBAEtB,qBAAM,IAAA,2BAAe,GAAE,EAAA;;oBAArC,WAAW,GAAG,SAAuB;oBACvB,qBAAM,IAAA,+BAAiB,GAAE,EAAA;;oBAAvC,WAAW,GAAG,SAAyB;oBAE7C,qEAAqE;oBACrE,qBAAM,IAAA,sCAAwB,EAAC,WAAW,EAAE,gBAAgB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;;;6BACJ,CAAC,EAAA;;oBARF,SAQE,CAAC;;;oBAGL,iBAAK,CAAC,KAAK,CAAC,YACZ,eAAK,CAAC,KAAK,CACX,iEAAiE,CAClE,iBAEC,eAAK,CAAC,IAAI,CAAC,0DAA0D,CAAC,iBAEtE,eAAK,CAAC,IAAI,CACV,uIACwD,CACzD,CAAE,CAAC,CAAC;;;;;CACJ","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n addSentryCliConfig,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n rcCliSetupConfig,\n} from '../utils/clack-utils';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport { WizardOptions } from '../utils/types';\nimport {\n initializeSentryOnEntryClient,\n initializeSentryOnEntryServer,\n updateBuildScript,\n instrumentRootRoute,\n isRemixV2,\n loadRemixConfig,\n runRemixReveal,\n instrumentExpressServer,\n} from './sdk-setup';\nimport { debug } from '../utils/debug';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { isHydrogenApp } from './utils';\nimport { DEFAULT_URL } from '../../lib/Constants';\nimport { findFile } from '../utils/ast-utils';\nimport { configureVitePlugin } from '../sourcemaps/tools/vite';\nimport { createExamplePage } from './sdk-example';\n\nexport async function runRemixWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'remix',\n },\n () => runRemixWizardWithTelemetry(options),\n );\n}\n\nasync function runRemixWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Remix Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const remixConfig = await loadRemixConfig();\n const packageJson = await getPackageDotJson();\n\n // We expect `@remix-run/dev` to be installed for every Remix project\n await ensurePackageIsInstalled(packageJson, '@remix-run/dev', 'Remix');\n\n const { selectedProject, authToken, sentryUrl, selfHosted } =\n await getOrAskForProjectData(options, 'javascript-remix');\n\n await installPackage({\n packageName: '@sentry/remix',\n alreadyInstalled: hasPackageInstalled('@sentry/remix', packageJson),\n });\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const isTS = isUsingTypeScript();\n const isV2 = isRemixV2(remixConfig, packageJson);\n const viteConfig = findFile('vite.config');\n\n await addSentryCliConfig({ authToken }, rcCliSetupConfig);\n\n if (viteConfig) {\n await traceStep(\n 'Update vite configuration for sourcemap uploads',\n async () => {\n try {\n await configureVitePlugin({\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n selfHosted,\n authToken,\n });\n } catch (e) {\n clack.log\n .warn(`Could not update vite configuration to generate and upload sourcemaps.\n Please update your vite configuration manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n },\n );\n } else {\n await traceStep('Update build script for sourcemap uploads', async () => {\n try {\n await updateBuildScript({\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n url: sentryUrl === DEFAULT_URL ? undefined : sentryUrl,\n isHydrogen: isHydrogenApp(packageJson),\n });\n } catch (e) {\n clack.log\n .warn(`Could not update build script to generate and upload sourcemaps.\n Please update your build script manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n });\n }\n\n await traceStep('Instrument root route', async () => {\n try {\n await instrumentRootRoute(isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not instrument root route.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n traceStep('Reveal missing entry files', () => {\n try {\n runRemixReveal(isTS);\n } catch (e) {\n clack.log.warn(`Could not run 'npx remix reveal'.\n Please create your entry files manually`);\n debug(e);\n }\n });\n\n await traceStep('Initialize Sentry on client entry', async () => {\n try {\n await initializeSentryOnEntryClient(dsn, isTS);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on client entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n await traceStep('Initialize Sentry on server entry', async () => {\n try {\n await initializeSentryOnEntryServer(dsn, isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n await traceStep('Instrument custom Express server', async () => {\n try {\n const hasExpressAdapter = hasPackageInstalled(\n '@remix-run/express',\n packageJson,\n );\n\n if (!hasExpressAdapter) {\n return;\n }\n\n await instrumentExpressServer();\n } catch (e) {\n clack.log.warn(`Could not instrument custom Express server.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/#custom-express-server`);\n debug(e);\n }\n });\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage();\n\n if (shouldCreateExamplePage) {\n await traceStep('Create example page', async () => {\n await createExamplePage({\n isTS,\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n url: sentryUrl,\n });\n });\n }\n\n clack.outro(`\n${chalk.green(\n 'Sentry has been successfully configured for your Remix project.',\n)}\n\n${chalk.cyan('You can now deploy your project to see Sentry in action.')}\n\n${chalk.cyan(\n `To learn more about how to use Sentry with Remix, visit our documentation:\nhttps://docs.sentry.io/platforms/javascript/guides/remix/`,\n)}`);\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an example Remix page to test Sentry
|
|
3
|
+
*/
|
|
4
|
+
export declare function createExamplePage(options: {
|
|
5
|
+
selfHosted: boolean;
|
|
6
|
+
orgSlug: string;
|
|
7
|
+
projectId: string;
|
|
8
|
+
url: string;
|
|
9
|
+
isTS: boolean;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
export declare function getSentryExamplePageContents(options: {
|
|
12
|
+
selfHosted: boolean;
|
|
13
|
+
orgSlug: string;
|
|
14
|
+
projectId: string;
|
|
15
|
+
url: string;
|
|
16
|
+
isTS?: boolean;
|
|
17
|
+
}): string;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
+
exports.getSentryExamplePageContents = exports.createExamplePage = void 0;
|
|
66
|
+
var fs = __importStar(require("fs"));
|
|
67
|
+
var path = __importStar(require("path"));
|
|
68
|
+
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
69
|
+
var prompts_1 = __importDefault(require("@clack/prompts"));
|
|
70
|
+
/**
|
|
71
|
+
* Creates an example Remix page to test Sentry
|
|
72
|
+
*/
|
|
73
|
+
function createExamplePage(options) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
+
var exampleRoutePath;
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
switch (_a.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
exampleRoutePath = "app/routes/sentry-example-page.".concat(options.isTS ? 'ts' : 'js', "x");
|
|
80
|
+
if (fs.existsSync(exampleRoutePath)) {
|
|
81
|
+
prompts_1.default.log.warn("It seems like a sentry example page already exists (".concat(path.basename(exampleRoutePath), "). Skipping creation of example route."));
|
|
82
|
+
return [2 /*return*/];
|
|
83
|
+
}
|
|
84
|
+
return [4 /*yield*/, fs.promises.writeFile(exampleRoutePath, getSentryExamplePageContents(options))];
|
|
85
|
+
case 1:
|
|
86
|
+
_a.sent();
|
|
87
|
+
prompts_1.default.log.info("Created sentry example page at ".concat(exampleRoutePath, "."));
|
|
88
|
+
return [2 /*return*/];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
exports.createExamplePage = createExamplePage;
|
|
94
|
+
function getSentryExamplePageContents(options) {
|
|
95
|
+
var issuesPageLink = options.selfHosted
|
|
96
|
+
? "".concat(options.url, "organizations/").concat(options.orgSlug, "/issues/?project=").concat(options.projectId)
|
|
97
|
+
: "https://".concat(options.orgSlug, ".sentry.io/issues/?project=").concat(options.projectId);
|
|
98
|
+
return "\nimport * as Sentry from '@sentry/remix';\n\nexport default function SentryExamplePage() {\n return (\n <div>\n <main\n style={{\n minHeight: \"100vh\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n }}\n >\n\n <h1 style={{ fontSize: \"4rem\", margin: \"14px 0\" }}>\n {/* biome-ignore lint/a11y/noSvgWithoutTitle: <explanation> */}\n <svg\n style={{\n height: \"1em\",\n }}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 200 44\"\n >\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 </h1>\n\n <p>Get started by sending us a sample error:</p>\n\n <button\n type=\"button\"\n style={{\n padding: \"12px\",\n cursor: \"pointer\",\n backgroundColor: \"#AD6CAA\",\n borderRadius: \"4px\",\n border: \"none\",\n color: \"white\",\n fontSize: \"14px\",\n margin: \"18px\",\n }}\n onClick={() => {\n throw new Error(\"Sentry Example Frontend Error\");\n }}\n >\n Throw error!\n </button>\n\n <p>\n Next, look for the error on the{\" \"}\n <a href=\"".concat(issuesPageLink, "\">Issues Page</a>.\n </p>\n <p style={{ marginTop: \"24px\" }}>\n For more information, see{\" \"}\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/remix/\">\n https://docs.sentry.io/platforms/javascript/guides/remix/\n </a>\n </p>\n </main>\n </div>\n );\n}\n");
|
|
99
|
+
}
|
|
100
|
+
exports.getSentryExamplePageContents = getSentryExamplePageContents;
|
|
101
|
+
//# sourceMappingURL=sdk-example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-example.js","sourceRoot":"","sources":["../../../src/remix/sdk-example.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yCAA6B;AAC7B,yEAAyE;AACzE,2DAAmC;AAEnC;;GAEG;AACH,SAAsB,iBAAiB,CAAC,OAMvC;;;;;;oBACO,gBAAgB,GAAG,yCACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,MACzB,CAAC;oBAEJ,IAAI,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;wBACnC,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,8DAAuD,IAAI,CAAC,QAAQ,CAClE,gBAAgB,CACjB,2CAAwC,CAC1C,CAAC;wBACF,sBAAO;qBACR;oBAED,qBAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,gBAAgB,EAChB,4BAA4B,CAAC,OAAO,CAAC,CACtC,EAAA;;oBAHD,SAGC,CAAC;oBAEF,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,yCAAkC,gBAAgB,MAAG,CAAC,CAAC;;;;;CACvE;AA1BD,8CA0BC;AAED,SAAgB,4BAA4B,CAAC,OAM5C;IACC,IAAM,cAAc,GAAG,OAAO,CAAC,UAAU;QACvC,CAAC,CAAC,UAAG,OAAO,CAAC,GAAG,2BAAiB,OAAO,CAAC,OAAO,8BAAoB,OAAO,CAAC,SAAS,CAAE;QACvF,CAAC,CAAC,kBAAW,OAAO,CAAC,OAAO,wCAA8B,OAAO,CAAC,SAAS,CAAE,CAAC;IAEhF,OAAO,08FAuDkB,cAAc,0YAYxC,CAAC;AACF,CAAC;AA/ED,oEA+EC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\n\n/**\n * Creates an example Remix page to test Sentry\n */\nexport async function createExamplePage(options: {\n selfHosted: boolean;\n orgSlug: string;\n projectId: string;\n url: string;\n isTS: boolean;\n}) {\n const exampleRoutePath = `app/routes/sentry-example-page.${\n options.isTS ? 'ts' : 'js'\n }x`;\n\n if (fs.existsSync(exampleRoutePath)) {\n clack.log.warn(\n `It seems like a sentry example page already exists (${path.basename(\n exampleRoutePath,\n )}). Skipping creation of example route.`,\n );\n return;\n }\n\n await fs.promises.writeFile(\n exampleRoutePath,\n getSentryExamplePageContents(options),\n );\n\n clack.log.info(`Created sentry example page at ${exampleRoutePath}.`);\n}\n\nexport function getSentryExamplePageContents(options: {\n selfHosted: boolean;\n orgSlug: string;\n projectId: string;\n url: string;\n isTS?: boolean;\n}) {\n const issuesPageLink = options.selfHosted\n ? `${options.url}organizations/${options.orgSlug}/issues/?project=${options.projectId}`\n : `https://${options.orgSlug}.sentry.io/issues/?project=${options.projectId}`;\n\n return `\nimport * as Sentry from '@sentry/remix';\n\nexport default function SentryExamplePage() {\n return (\n <div>\n <main\n style={{\n minHeight: \"100vh\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n }}\n >\n\n <h1 style={{ fontSize: \"4rem\", margin: \"14px 0\" }}>\n {/* biome-ignore lint/a11y/noSvgWithoutTitle: <explanation> */}\n <svg\n style={{\n height: \"1em\",\n }}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 200 44\"\n >\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 </h1>\n\n <p>Get started by sending us a sample error:</p>\n\n <button\n type=\"button\"\n style={{\n padding: \"12px\",\n cursor: \"pointer\",\n backgroundColor: \"#AD6CAA\",\n borderRadius: \"4px\",\n border: \"none\",\n color: \"white\",\n fontSize: \"14px\",\n margin: \"18px\",\n }}\n onClick={() => {\n throw new Error(\"Sentry Example Frontend Error\");\n }}\n >\n Throw error!\n </button>\n\n <p>\n Next, look for the error on the{\" \"}\n <a href=\"${issuesPageLink}\">Issues Page</a>.\n </p>\n <p style={{ marginTop: \"24px\" }}>\n For more information, see{\" \"}\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/remix/\">\n https://docs.sentry.io/platforms/javascript/guides/remix/\n </a>\n </p>\n </main>\n </div>\n );\n}\n`;\n}\n"]}
|
|
@@ -6,7 +6,7 @@ function getClientHooksTemplate(dsn) {
|
|
|
6
6
|
}
|
|
7
7
|
exports.getClientHooksTemplate = getClientHooksTemplate;
|
|
8
8
|
function getServerHooksTemplate(dsn) {
|
|
9
|
-
return "import { sequence } from \"@sveltejs/kit/hooks\";\nimport { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\nimport * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '".concat(dsn, "',\n tracesSampleRate: 1.0,\n});\n\n// If you have custom handlers, make sure to place them after `sentryHandle()` in the `sequence` function.\nexport const handle = sequence(sentryHandle());\n\n// If you have a custom error handler, pass it to `handleErrorWithSentry`\nexport const handleError = handleErrorWithSentry();\n");
|
|
9
|
+
return "import { sequence } from \"@sveltejs/kit/hooks\";\nimport { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\nimport * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '".concat(dsn, "',\n tracesSampleRate: 1.0,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV, \n});\n\n// If you have custom handlers, make sure to place them after `sentryHandle()` in the `sequence` function.\nexport const handle = sequence(sentryHandle());\n\n// If you have a custom error handler, pass it to `handleErrorWithSentry`\nexport const handleError = handleErrorWithSentry();\n");
|
|
10
10
|
}
|
|
11
11
|
exports.getServerHooksTemplate = getServerHooksTemplate;
|
|
12
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/sveltekit/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,kKAIC,GAAG,0mBAiBZ,CAAC;AACF,CAAC;AAvBD,wDAuBC;AAED,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,gNAKC,GAAG,
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/sveltekit/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,kKAIC,GAAG,0mBAiBZ,CAAC;AACF,CAAC;AAvBD,wDAuBC;AAED,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,gNAKC,GAAG,gcAYZ,CAAC;AACF,CAAC;AAnBD,wDAmBC;AAED;;GAEG;AACH,SAAgB,0BAA0B,CAAC,OAK1C;IACC,IAAM,cAAc,GAAG,OAAO,CAAC,UAAU;QACvC,CAAC,CAAC,UAAG,OAAO,CAAC,GAAG,2BAAiB,OAAO,CAAC,OAAO,8BAAoB,OAAO,CAAC,SAAS,CAAE;QACvF,CAAC,CAAC,kBAAW,OAAO,CAAC,OAAO,wCAA8B,OAAO,CAAC,SAAS,CAAE,CAAC;IAEhF,OAAO,y6EAiDQ,cAAc,w7BAgD9B,CAAC;AACF,CAAC;AA5GD,gEA4GC;AAED,SAAgB,wBAAwB;IACtC,OAAO,wOAMR,CAAC;AACF,CAAC;AARD,4DAQC","sourcesContent":["export function getClientHooksTemplate(dsn: string) {\n return `import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\nimport * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '${dsn}',\n tracesSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n});\n\n// If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\nexport const handleError = handleErrorWithSentry();\n`;\n}\n\nexport function getServerHooksTemplate(dsn: string) {\n return `import { sequence } from \"@sveltejs/kit/hooks\";\nimport { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\nimport * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '${dsn}',\n tracesSampleRate: 1.0,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV, \n});\n\n// If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\nexport const handle = sequence(sentryHandle());\n\n// If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\nexport const handleError = handleErrorWithSentry();\n`;\n}\n\n/**\n * +page.svelte with Sentry example\n */\nexport function getSentryExampleSveltePage(options: {\n selfHosted: boolean;\n url: string;\n orgSlug: string;\n projectId: string;\n}) {\n const issuesPageLink = options.selfHosted\n ? `${options.url}organizations/${options.orgSlug}/issues/?project=${options.projectId}`\n : `https://${options.orgSlug}.sentry.io/issues/?project=${options.projectId}`;\n\n return `<!-- \nThis is just a very simple page with a button to throw an example error.\nFeel free to delete this file and the entire sentry route. \n-->\n\n<script>\n import * as Sentry from '@sentry/sveltekit';\n\n function getSentryData() {\n Sentry.startSpan({\n name: 'Example Frontend Span',\n op: 'test',\n }, async () => {\n const res = await fetch('/sentry-example');\n if (!res.ok) {\n throw new Error('Sentry Example Frontend Error');\n }\n });\n }\n</script>\n\n<div>\n <head>\n <title>Sentry Onboarding</title>\n <meta name=\"description\" content=\"Test Sentry for your SvelteKit app!\" />\n </head>\n\n <main>\n <h1>\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 </h1>\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\n type=\"button\"\n on:click={getSentryData}>\n Throw error!\n </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/sveltekit/\">\n Sentry SvelteKit Documentation\n </a>\n </p>\n </main>\n</div>\n\n<style>\n main {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n h1 {\n font-size: 4rem;\n margin: 14px 0;\n }\n\n svg {\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 getSentryExampleApiRoute() {\n return `// This is just a very simple API route that throws an example error.\n// Feel free to delete this file and the entire sentry route.\n\nexport const GET = async () => {\n throw new Error(\"Sentry Example API Route Error\");\n};\n`;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/wizard",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.22.0",
|
|
4
4
|
"homepage": "https://github.com/getsentry/sentry-wizard",
|
|
5
5
|
"repository": "https://github.com/getsentry/sentry-wizard",
|
|
6
6
|
"description": "Sentry wizard helping you to configure your project",
|
|
@@ -82,13 +82,17 @@ export async function runNextjsWizardWithTelemetry(
|
|
|
82
82
|
Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);
|
|
83
83
|
|
|
84
84
|
await installPackage({
|
|
85
|
-
packageName: '@sentry/nextjs',
|
|
85
|
+
packageName: '@sentry/nextjs@^7.105.0',
|
|
86
86
|
alreadyInstalled: !!packageJson?.dependencies?.['@sentry/nextjs'],
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
await traceStep('configure-sdk', async () =>
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
await traceStep('configure-sdk', async () => {
|
|
90
|
+
const tunnelRoute = await askShouldSetTunnelRoute();
|
|
91
|
+
|
|
92
|
+
await createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl, {
|
|
93
|
+
tunnelRoute,
|
|
94
|
+
});
|
|
95
|
+
});
|
|
92
96
|
|
|
93
97
|
await traceStep('create-underscoreerror-page', async () => {
|
|
94
98
|
const srcDir = path.join(process.cwd(), 'src');
|
|
@@ -306,10 +310,15 @@ ${chalk.dim(
|
|
|
306
310
|
)}`);
|
|
307
311
|
}
|
|
308
312
|
|
|
313
|
+
type SDKConfigOptions = {
|
|
314
|
+
tunnelRoute: boolean;
|
|
315
|
+
};
|
|
316
|
+
|
|
309
317
|
async function createOrMergeNextJsFiles(
|
|
310
318
|
selectedProject: SentryProjectData,
|
|
311
319
|
selfHosted: boolean,
|
|
312
320
|
sentryUrl: string,
|
|
321
|
+
sdkConfigOptions: SDKConfigOptions,
|
|
313
322
|
) {
|
|
314
323
|
const typeScriptDetected = isUsingTypeScript();
|
|
315
324
|
|
|
@@ -387,7 +396,12 @@ async function createOrMergeNextJsFiles(
|
|
|
387
396
|
selfHosted,
|
|
388
397
|
sentryUrl,
|
|
389
398
|
);
|
|
390
|
-
|
|
399
|
+
|
|
400
|
+
const { tunnelRoute } = sdkConfigOptions;
|
|
401
|
+
|
|
402
|
+
const sentryBuildOptionsTemplate = getNextjsSentryBuildOptionsTemplate({
|
|
403
|
+
tunnelRoute,
|
|
404
|
+
});
|
|
391
405
|
|
|
392
406
|
const nextConfigJs = 'next.config.js';
|
|
393
407
|
const nextConfigMjs = 'next.config.mjs';
|
|
@@ -701,3 +715,40 @@ async function createExamplePage(
|
|
|
701
715
|
);
|
|
702
716
|
}
|
|
703
717
|
}
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* Ask users if they want to set the tunnelRoute option.
|
|
721
|
+
* We can't set this by default because it potentially increases hosting bills.
|
|
722
|
+
* It's valuable enough to for users to justify asking the additional question.
|
|
723
|
+
*/
|
|
724
|
+
async function askShouldSetTunnelRoute() {
|
|
725
|
+
return await traceStep('ask-tunnelRoute-option', async () => {
|
|
726
|
+
const shouldSetTunnelRoute = await abortIfCancelled(
|
|
727
|
+
clack.select({
|
|
728
|
+
message:
|
|
729
|
+
'Do you want to route Sentry requests in the browser through your NextJS server to avoid ad blockers?',
|
|
730
|
+
options: [
|
|
731
|
+
{
|
|
732
|
+
label: 'Yes',
|
|
733
|
+
value: true,
|
|
734
|
+
hint: 'Can increase your server load and hosting bill',
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
label: 'No',
|
|
738
|
+
value: false,
|
|
739
|
+
hint: 'Browser errors and events might be blocked by ad blockers before being sent to Sentry',
|
|
740
|
+
},
|
|
741
|
+
],
|
|
742
|
+
initialValue: false,
|
|
743
|
+
}),
|
|
744
|
+
);
|
|
745
|
+
|
|
746
|
+
if (!shouldSetTunnelRoute) {
|
|
747
|
+
clack.log.info(
|
|
748
|
+
"Sounds good! We'll leave the option commented for later, just in case :)",
|
|
749
|
+
);
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
return shouldSetTunnelRoute;
|
|
753
|
+
});
|
|
754
|
+
}
|
package/src/nextjs/templates.ts
CHANGED
|
@@ -17,7 +17,13 @@ export function getNextjsWebpackPluginOptionsTemplate(
|
|
|
17
17
|
}`;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
type SentryNextjsBuildOptions = {
|
|
21
|
+
tunnelRoute: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export function getNextjsSentryBuildOptionsTemplate({
|
|
25
|
+
tunnelRoute,
|
|
26
|
+
}: SentryNextjsBuildOptions): string {
|
|
21
27
|
return `{
|
|
22
28
|
// For all available options, see:
|
|
23
29
|
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
|
|
@@ -28,8 +34,13 @@ export function getNextjsSentryBuildOptionsTemplate(): string {
|
|
|
28
34
|
// Transpiles SDK to be compatible with IE11 (increases bundle size)
|
|
29
35
|
transpileClientSDK: true,
|
|
30
36
|
|
|
31
|
-
//
|
|
32
|
-
|
|
37
|
+
// ${
|
|
38
|
+
tunnelRoute ? 'Route' : 'Uncomment to route'
|
|
39
|
+
} browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
|
|
40
|
+
// This can increase your server load as well as your hosting bill.
|
|
41
|
+
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
|
|
42
|
+
// side errors will fail.
|
|
43
|
+
${tunnelRoute ? '' : '// '}tunnelRoute: "/monitoring",
|
|
33
44
|
|
|
34
45
|
// Hides source maps from generated client bundles
|
|
35
46
|
hideSourceMaps: true,
|
|
@@ -137,6 +148,15 @@ export function getSentryConfigContents(
|
|
|
137
148
|
],`;
|
|
138
149
|
}
|
|
139
150
|
|
|
151
|
+
let spotlightOption = '';
|
|
152
|
+
if (config === 'server') {
|
|
153
|
+
spotlightOption = `
|
|
154
|
+
|
|
155
|
+
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
|
|
156
|
+
// spotlight: process.env.NODE_ENV === 'development',
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
|
|
140
160
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
141
161
|
return `${primer}
|
|
142
162
|
|
|
@@ -149,7 +169,7 @@ Sentry.init({
|
|
|
149
169
|
tracesSampleRate: 1,
|
|
150
170
|
|
|
151
171
|
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
152
|
-
debug: false,${additionalOptions}
|
|
172
|
+
debug: false,${additionalOptions}${spotlightOption}
|
|
153
173
|
});
|
|
154
174
|
`;
|
|
155
175
|
}
|
|
@@ -4,7 +4,6 @@ import chalk from 'chalk';
|
|
|
4
4
|
import * as recast from 'recast';
|
|
5
5
|
import { visit } from 'ast-types';
|
|
6
6
|
import {
|
|
7
|
-
ASTNode,
|
|
8
7
|
ProxifiedImportItem,
|
|
9
8
|
generateCode,
|
|
10
9
|
loadFile,
|
|
@@ -17,33 +16,6 @@ import * as fs from 'fs';
|
|
|
17
16
|
import { getInitCallInsertionIndex, hasSentryContent } from '../utils';
|
|
18
17
|
import { findFile } from '../../utils/ast-utils';
|
|
19
18
|
|
|
20
|
-
// Find `loadViteServerBuild` or `unstable_loadViteServerBuild` call inside an arrow function
|
|
21
|
-
// and replace it with await loadViteServerBuild.
|
|
22
|
-
// For context, see: https://github.com/getsentry/sentry-javascript/issues/9500
|
|
23
|
-
export function updateViteBuildParameter(node: ASTNode) {
|
|
24
|
-
const hasViteConfig = findFile('vite.config');
|
|
25
|
-
|
|
26
|
-
if (!hasViteConfig) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
visit(node, {
|
|
31
|
-
visitArrowFunctionExpression(path) {
|
|
32
|
-
if (
|
|
33
|
-
path.value.body.type === 'CallExpression' &&
|
|
34
|
-
path.value.body.callee.type === 'Identifier' &&
|
|
35
|
-
(path.value.body.callee.name === 'unstable_loadViteServerBuild' ||
|
|
36
|
-
path.value.body.callee.name === 'loadViteServerBuild')
|
|
37
|
-
) {
|
|
38
|
-
// Replace the arrow function with a call to await loadViteServerBuild
|
|
39
|
-
path.replace(recast.types.builders.awaitExpression(path.value.body));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
this.traverse(path);
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
19
|
// Try to find the Express server implementation that contains `createRequestHandler` from `@remix-run/express`
|
|
48
20
|
export async function findCustomExpressServerImplementation() {
|
|
49
21
|
const possiblePaths = [
|
|
@@ -150,10 +122,6 @@ export async function instrumentExpressCreateRequestHandler(
|
|
|
150
122
|
createRequestHandlerConst,
|
|
151
123
|
);
|
|
152
124
|
|
|
153
|
-
// Update the Vite build parameter to await loadViteServerBuild if everything goes well.
|
|
154
|
-
// This should be the last thing we do.
|
|
155
|
-
updateViteBuildParameter(originalExpressServerMod.$ast);
|
|
156
|
-
|
|
157
125
|
try {
|
|
158
126
|
await writeFile(originalExpressServerMod.$ast, expressServerPath);
|
|
159
127
|
|
|
@@ -4,6 +4,7 @@ import chalk from 'chalk';
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
addSentryCliConfig,
|
|
7
|
+
askShouldCreateExamplePage,
|
|
7
8
|
confirmContinueIfNoOrDirtyGitRepo,
|
|
8
9
|
ensurePackageIsInstalled,
|
|
9
10
|
getOrAskForProjectData,
|
|
@@ -31,6 +32,7 @@ import { isHydrogenApp } from './utils';
|
|
|
31
32
|
import { DEFAULT_URL } from '../../lib/Constants';
|
|
32
33
|
import { findFile } from '../utils/ast-utils';
|
|
33
34
|
import { configureVitePlugin } from '../sourcemaps/tools/vite';
|
|
35
|
+
import { createExamplePage } from './sdk-example';
|
|
34
36
|
|
|
35
37
|
export async function runRemixWizard(options: WizardOptions): Promise<void> {
|
|
36
38
|
return withTelemetry(
|
|
@@ -172,6 +174,20 @@ async function runRemixWizardWithTelemetry(
|
|
|
172
174
|
}
|
|
173
175
|
});
|
|
174
176
|
|
|
177
|
+
const shouldCreateExamplePage = await askShouldCreateExamplePage();
|
|
178
|
+
|
|
179
|
+
if (shouldCreateExamplePage) {
|
|
180
|
+
await traceStep('Create example page', async () => {
|
|
181
|
+
await createExamplePage({
|
|
182
|
+
isTS,
|
|
183
|
+
selfHosted,
|
|
184
|
+
orgSlug: selectedProject.organization.slug,
|
|
185
|
+
projectId: selectedProject.id,
|
|
186
|
+
url: sentryUrl,
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
175
191
|
clack.outro(`
|
|
176
192
|
${chalk.green(
|
|
177
193
|
'Sentry has been successfully configured for your Remix project.',
|