@sentry/wizard 3.3.2 → 3.4.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.4.0
4
+
5
+ - feat(sourcemaps): Add setup flow for esbuild (#327)
6
+ - feat(sourcemaps): Add setup flow for Rollup (#325)
7
+ - feat(sourcemaps): Add setup flow for `tsc` (#324)
8
+
3
9
  ## 3.3.2
4
10
 
5
11
  - fix: Typo in gitignore insertion (#322)
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "3.3.2",
3
+ "version": "3.4.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",
@@ -72,6 +72,9 @@ var is_unicorn_supported_1 = require("../utils/vendor/is-unicorn-supported");
72
72
  var vite_1 = require("./tools/vite");
73
73
  var sentry_cli_1 = require("./tools/sentry-cli");
74
74
  var webpack_1 = require("./tools/webpack");
75
+ var tsc_1 = require("./tools/tsc");
76
+ var rollup_1 = require("./tools/rollup");
77
+ var esbuild_1 = require("./tools/esbuild");
75
78
  function runSourcemapsWizard(options) {
76
79
  return __awaiter(this, void 0, void 0, function () {
77
80
  var _a, sentryUrl, selfHosted, _b, projects, apiKeys, selectedProject, selectedTool, addedEnvVarToCI, arrow;
@@ -111,7 +114,7 @@ function runSourcemapsWizard(options) {
111
114
  })];
112
115
  case 6:
113
116
  _c.sent();
114
- prompts_1.default.log.step('Add the Sentry auth token as an environment variable to your CI setup:');
117
+ prompts_1.default.log.step('Add the Sentry authentication token as an environment variable to your CI setup:');
115
118
  // Intentially logging directly to console here so that the code can be copied/pasted directly
116
119
  // eslint-disable-next-line no-console
117
120
  console.log(chalk_1.default.greenBright("\nSENTRY_AUTH_TOKEN=".concat(apiKeys.token, "\n")));
@@ -135,7 +138,7 @@ function runSourcemapsWizard(options) {
135
138
  prompts_1.default.log.info("Don't forget! :)");
136
139
  }
137
140
  arrow = (0, is_unicorn_supported_1.isUnicodeSupported)() ? '→' : '->';
138
- prompts_1.default.outro("".concat(chalk_1.default.green("That's it - everything is set up!"), "\n\n ").concat(chalk_1.default.cyan("Validate your setup with the following Steps:\n\n 1. Build your application in ".concat(chalk_1.default.bold('production mode'), "\n ").concat(chalk_1.default.gray("".concat(arrow, " You should see source map upload logs in your console when building")), "\n 2. Run your application and throw a test error\n ").concat(chalk_1.default.gray("".concat(arrow, " You should see the error in Sentry")), "\n 3. Open the error in Sentry and verify it's source-mapped\n ").concat(chalk_1.default.gray("".concat(arrow, " If your error is source-mapped, the stack trace should show your original source code")), "\n ")), "\n ").concat(chalk_1.default.dim("If you encounter any issues, follow our Troubleshooting Guide:\n https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js\n\n If the guide didn't help or you encountered a bug, let us know:\n https://github.com/getsentry/sentry-javascript/issues"), "\n"));
141
+ prompts_1.default.outro("".concat(chalk_1.default.green("That's it - everything is set up!"), "\n\n ").concat(chalk_1.default.cyan("Validate your setup with the following Steps:\n\n 1. Build your application in ".concat(chalk_1.default.bold('production mode'), ".\n ").concat(chalk_1.default.gray("".concat(arrow, " You should see source map upload logs in your console.")), "\n 2. Run your application and throw a test error.\n ").concat(chalk_1.default.gray("".concat(arrow, " The error should be visible in Sentry.")), "\n 3. Open the error in Sentry and verify that it's source-mapped.\n ").concat(chalk_1.default.gray("".concat(arrow, " The stack trace should show your original source code.")), "\n ")), "\n ").concat(chalk_1.default.dim("If you encounter any issues, please refer to the Troubleshooting Guide:\n https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js\n\n If the guide doesn't help or you encounter a bug, please let us know:\n https://github.com/getsentry/sentry-javascript/issues"), "\n"));
139
142
  return [2 /*return*/];
140
143
  }
141
144
  });
@@ -160,17 +163,21 @@ function askForUsedBundlerTool() {
160
163
  value: 'vite',
161
164
  hint: 'Configure source maps upload using Vite',
162
165
  },
163
- // TODO: Implement rollup and esbuild flows
164
- // {
165
- // label: 'esbuild',
166
- // value: 'esbuild',
167
- // hint: 'Configure source maps upload using esbuild',
168
- // },
169
- // {
170
- // label: 'Rollup',
171
- // value: 'rollup',
172
- // hint: 'Configure source maps upload using Rollup',
173
- // },
166
+ {
167
+ label: 'esbuild',
168
+ value: 'esbuild',
169
+ hint: 'Configure source maps upload using esbuild',
170
+ },
171
+ {
172
+ label: 'Rollup',
173
+ value: 'rollup',
174
+ hint: 'Configure source maps upload using Rollup',
175
+ },
176
+ {
177
+ label: 'tsc',
178
+ value: 'tsc',
179
+ hint: 'Configure source maps when using tsc as build tool',
180
+ },
174
181
  {
175
182
  label: 'None of the above',
176
183
  value: 'sentry-cli',
@@ -193,23 +200,38 @@ function startToolSetupFlow(selctedTool, options) {
193
200
  case 0:
194
201
  _a = selctedTool;
195
202
  switch (_a) {
196
- case 'vite': return [3 /*break*/, 1];
197
- case 'webpack': return [3 /*break*/, 3];
203
+ case 'webpack': return [3 /*break*/, 1];
204
+ case 'vite': return [3 /*break*/, 3];
205
+ case 'esbuild': return [3 /*break*/, 5];
206
+ case 'rollup': return [3 /*break*/, 7];
207
+ case 'tsc': return [3 /*break*/, 9];
198
208
  }
199
- return [3 /*break*/, 5];
200
- case 1: return [4 /*yield*/, (0, vite_1.configureVitePlugin)(options)];
209
+ return [3 /*break*/, 11];
210
+ case 1: return [4 /*yield*/, (0, webpack_1.configureWebPackPlugin)(options)];
201
211
  case 2:
202
212
  _b.sent();
203
- return [3 /*break*/, 7];
204
- case 3: return [4 /*yield*/, (0, webpack_1.configureWebPackPlugin)(options)];
213
+ return [3 /*break*/, 13];
214
+ case 3: return [4 /*yield*/, (0, vite_1.configureVitePlugin)(options)];
205
215
  case 4:
206
216
  _b.sent();
207
- return [3 /*break*/, 7];
208
- case 5: return [4 /*yield*/, (0, sentry_cli_1.configureSentryCLI)(options)];
217
+ return [3 /*break*/, 13];
218
+ case 5: return [4 /*yield*/, (0, esbuild_1.configureEsbuildPlugin)(options)];
209
219
  case 6:
210
220
  _b.sent();
211
- return [3 /*break*/, 7];
212
- case 7: return [2 /*return*/];
221
+ return [3 /*break*/, 13];
222
+ case 7: return [4 /*yield*/, (0, rollup_1.configureRollupPlugin)(options)];
223
+ case 8:
224
+ _b.sent();
225
+ return [3 /*break*/, 13];
226
+ case 9: return [4 /*yield*/, (0, sentry_cli_1.configureSentryCLI)(options, tsc_1.configureTscSourcemapGenerationFlow)];
227
+ case 10:
228
+ _b.sent();
229
+ return [3 /*break*/, 13];
230
+ case 11: return [4 /*yield*/, (0, sentry_cli_1.configureSentryCLI)(options)];
231
+ case 12:
232
+ _b.sent();
233
+ return [3 /*break*/, 13];
234
+ case 13: return [2 /*return*/];
213
235
  }
214
236
  });
215
237
  });
@@ -1 +1 @@
1
- {"version":3,"file":"sourcemaps-wizard.js","sourceRoot":"","sources":["../../../src/sourcemaps/sourcemaps-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,mDAAuC;AAEvC,oDAO8B;AAC9B,6EAA0E;AAE1E,qCAAmD;AACnD,iDAAwD;AACxD,2CAAyD;AAUzD,SAAsB,mBAAmB,CACvC,OAAgC;;;;;;oBAEhC,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,gDAAgD;wBAC5D,OAAO,EACL,yQAAyQ;wBAC3Q,SAAS,EAAE,OAAO,CAAC,SAAS;qBAC7B,CAAC,CAAC;oBAEH,qBAAM,IAAA,gDAAkC,GAAE,EAAA;;oBAA1C,SAA0C,CAAC;oBAEJ,qBAAM,IAAA,8BAAgB,GAAE,EAAA;;oBAAzD,KAAiC,SAAwB,EAAlD,SAAS,SAAA,EAAE,UAAU,gBAAA;oBAEJ,qBAAM,IA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EAAE,mBAAmB;gCAC1B,KAAK,EAAE,YAAY;gCACnB,IAAI,EAAE,iEAAiE;6BACxE;yBACF;qBACF,CAAC,CACH,EAAA;;oBAhCK,YAAY,GAAoC,SAgCrD;oBAED,sBAAO,YAAY,EAAC;;;;CACrB;AAED,SAAe,kBAAkB,CAC/B,WAAmC,EACnC,OAAgD;;;;;;oBAExC,KAAA,WAAW,CAAA;;6BACZ,MAAM,CAAC,CAAP,wBAAM;6BAGN,SAAS,CAAC,CAAV,wBAAS;;;wBAFZ,qBAAM,IAAA,0BAAmB,EAAC,OAAO,CAAC,EAAA;;oBAAlC,SAAkC,CAAC;oBACnC,wBAAM;wBAEN,qBAAM,IAAA,gCAAsB,EAAC,OAAO,CAAC,EAAA;;oBAArC,SAAqC,CAAC;oBACtC,wBAAM;wBAGN,qBAAM,IAAA,+BAAkB,EAAC,OAAO,CAAC,EAAA;;oBAAjC,SAAiC,CAAC;oBAClC,wBAAM;;;;;CAEX","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as Sentry from '@sentry/node';\n\nimport {\n abortIfCancelled,\n askForProjectSelection,\n askForSelfHosted,\n askForWizardLogin,\n confirmContinueEvenThoughNoGitRepo,\n printWelcome,\n} from '../utils/clack-utils';\nimport { isUnicodeSupported } from '../utils/vendor/is-unicorn-supported';\nimport { SourceMapUploadToolConfigurationOptions } from './tools/types';\nimport { configureVitePlugin } from './tools/vite';\nimport { configureSentryCLI } from './tools/sentry-cli';\nimport { configureWebPackPlugin } from './tools/webpack';\n\ninterface SourceMapsWizardOptions {\n promoCode?: string;\n}\n\ntype SupportedBundlers = 'webpack' | 'vite' | 'rollup' | 'esbuild';\ntype SupportedTools = 'sentry-cli';\ntype SupportedBundlersTools = SupportedBundlers | SupportedTools;\n\nexport async function runSourcemapsWizard(\n options: SourceMapsWizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Source Maps Upload Configuration Wizard',\n message:\n 'This wizard will help you upload source maps to Sentry as part of your build.\\nThank you for using Sentry :)\\n\\n(This setup wizard sends telemetry data and crash reports to Sentry.\\nYou can turn this off by running the wizard with the `--disable-telemetry` flag.)',\n promoCode: options.promoCode,\n });\n\n await confirmContinueEvenThoughNoGitRepo();\n\n const { url: sentryUrl, selfHosted } = await askForSelfHosted();\n\n const { projects, apiKeys } = await askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n });\n\n const selectedProject = await askForProjectSelection(projects);\n\n const selectedTool = await askForUsedBundlerTool();\n\n Sentry.setTag('selected-tool', selectedTool);\n\n await startToolSetupFlow(selectedTool, {\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n authToken: apiKeys.token,\n });\n\n clack.log.step(\n 'Add the Sentry auth token as an environment variable to your CI setup:',\n );\n\n // Intentially logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(\n chalk.greenBright(`\nSENTRY_AUTH_TOKEN=${apiKeys.token}\n`),\n );\n\n clack.log.warn(\n chalk.yellow('DO NOT commit this auth token to your repository!'),\n );\n\n const addedEnvVarToCI = await abortIfCancelled(\n clack.select({\n message: 'Did you configure CI as shown above?',\n options: [\n { label: 'Yes, continue!', value: true },\n {\n label: \"I'll do it later...\",\n value: false,\n hint: chalk.yellow(\n 'You need to set the auth token to upload source maps in CI',\n ),\n },\n ],\n initialValue: true,\n }),\n );\n\n Sentry.setTag('added-env-var-to-ci', addedEnvVarToCI);\n\n if (!addedEnvVarToCI) {\n clack.log.info(\"Don't forget! :)\");\n }\n\n const arrow = isUnicodeSupported() ? '→' : '->';\n\n clack.outro(`${chalk.green(\"That's it - everything is set up!\")}\n\n ${chalk.cyan(`Validate your setup with the following Steps:\n\n 1. Build your application in ${chalk.bold('production mode')}\n ${chalk.gray(\n `${arrow} You should see source map upload logs in your console when building`,\n )}\n 2. Run your application and throw a test error\n ${chalk.gray(`${arrow} You should see the error in Sentry`)}\n 3. Open the error in Sentry and verify it's source-mapped\n ${chalk.gray(\n `${arrow} If your error is source-mapped, the stack trace should show your original source code`,\n )}\n `)}\n ${chalk.dim(\n `If you encounter any issues, follow our Troubleshooting Guide:\n https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js\n\n If the guide didn't help or you encountered a bug, let us know:\n https://github.com/getsentry/sentry-javascript/issues`,\n )}\n`);\n}\n\nasync function askForUsedBundlerTool(): Promise<SupportedBundlersTools> {\n const selectedTool: SupportedBundlersTools | symbol = await abortIfCancelled(\n clack.select({\n message: 'Which bundler or build tool are you using?',\n options: [\n {\n label: 'Webpack',\n value: 'webpack',\n hint: 'Configure source maps upload using Webpack',\n },\n {\n label: 'Vite',\n value: 'vite',\n hint: 'Configure source maps upload using Vite',\n },\n // TODO: Implement rollup and esbuild flows\n // {\n // label: 'esbuild',\n // value: 'esbuild',\n // hint: 'Configure source maps upload using esbuild',\n // },\n // {\n // label: 'Rollup',\n // value: 'rollup',\n // hint: 'Configure source maps upload using Rollup',\n // },\n {\n label: 'None of the above',\n value: 'sentry-cli',\n hint: 'This will configure source maps upload for you using sentry-cli',\n },\n ],\n }),\n );\n\n return selectedTool;\n}\n\nasync function startToolSetupFlow(\n selctedTool: SupportedBundlersTools,\n options: SourceMapUploadToolConfigurationOptions,\n): Promise<void> {\n switch (selctedTool) {\n case 'vite':\n await configureVitePlugin(options);\n break;\n case 'webpack':\n await configureWebPackPlugin(options);\n break;\n // TODO: implement other bundlers\n default:\n await configureSentryCLI(options);\n break;\n }\n}\n"]}
1
+ {"version":3,"file":"sourcemaps-wizard.js","sourceRoot":"","sources":["../../../src/sourcemaps/sourcemaps-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,mDAAuC;AAEvC,oDAO8B;AAC9B,6EAA0E;AAE1E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BACtC,yBAAM;wBAEN,qBAAM,IAAA,8BAAqB,EAAC,OAAO,CAAC,EAAA;;oBAApC,SAAoC,CAAC;oBACrC,yBAAM;wBAEN,qBAAM,IAAA,+BAAkB,EAAC,OAAO,EAAE,yCAAmC,CAAC,EAAA;;oBAAtE,SAAsE,CAAC;oBACvE,yBAAM;yBAEN,qBAAM,IAAA,+BAAkB,EAAC,OAAO,CAAC,EAAA;;oBAAjC,SAAiC,CAAC;oBAClC,yBAAM;;;;;CAEX","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as Sentry from '@sentry/node';\n\nimport {\n abortIfCancelled,\n askForProjectSelection,\n askForSelfHosted,\n askForWizardLogin,\n confirmContinueEvenThoughNoGitRepo,\n printWelcome,\n} from '../utils/clack-utils';\nimport { isUnicodeSupported } from '../utils/vendor/is-unicorn-supported';\nimport { SourceMapUploadToolConfigurationOptions } from './tools/types';\nimport { configureVitePlugin } from './tools/vite';\nimport { configureSentryCLI } from './tools/sentry-cli';\nimport { configureWebPackPlugin } from './tools/webpack';\nimport { configureTscSourcemapGenerationFlow } from './tools/tsc';\nimport { configureRollupPlugin } from './tools/rollup';\nimport { configureEsbuildPlugin } from './tools/esbuild';\n\ninterface SourceMapsWizardOptions {\n promoCode?: string;\n}\n\ntype SupportedTools =\n | 'webpack'\n | 'vite'\n | 'rollup'\n | 'esbuild'\n | 'tsc'\n | 'sentry-cli';\n\nexport async function runSourcemapsWizard(\n options: SourceMapsWizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Source Maps Upload Configuration Wizard',\n message:\n 'This wizard will help you upload source maps to Sentry as part of your build.\\nThank you for using Sentry :)\\n\\n(This setup wizard sends telemetry data and crash reports to Sentry.\\nYou can turn this off by running the wizard with the `--disable-telemetry` flag.)',\n promoCode: options.promoCode,\n });\n\n await confirmContinueEvenThoughNoGitRepo();\n\n const { url: sentryUrl, selfHosted } = await askForSelfHosted();\n\n const { projects, apiKeys } = await askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n });\n\n const selectedProject = await askForProjectSelection(projects);\n\n const selectedTool = await askForUsedBundlerTool();\n\n Sentry.setTag('selected-tool', selectedTool);\n\n await startToolSetupFlow(selectedTool, {\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n authToken: apiKeys.token,\n });\n\n clack.log.step(\n 'Add the Sentry authentication token as an environment variable to your CI setup:',\n );\n\n // Intentially logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(\n chalk.greenBright(`\nSENTRY_AUTH_TOKEN=${apiKeys.token}\n`),\n );\n\n clack.log.warn(\n chalk.yellow('DO NOT commit this auth token to your repository!'),\n );\n\n const addedEnvVarToCI = await abortIfCancelled(\n clack.select({\n message: 'Did you configure CI as shown above?',\n options: [\n { label: 'Yes, continue!', value: true },\n {\n label: \"I'll do it later...\",\n value: false,\n hint: chalk.yellow(\n 'You need to set the auth token to upload source maps in CI',\n ),\n },\n ],\n initialValue: true,\n }),\n );\n\n Sentry.setTag('added-env-var-to-ci', addedEnvVarToCI);\n\n if (!addedEnvVarToCI) {\n clack.log.info(\"Don't forget! :)\");\n }\n\n const arrow = isUnicodeSupported() ? '→' : '->';\n\n clack.outro(`${chalk.green(\"That's it - everything is set up!\")}\n\n ${chalk.cyan(`Validate your setup with the following Steps:\n\n 1. Build your application in ${chalk.bold('production mode')}.\n ${chalk.gray(\n `${arrow} You should see source map upload logs in your console.`,\n )}\n 2. Run your application and throw a test error.\n ${chalk.gray(`${arrow} The error should be visible in Sentry.`)}\n 3. Open the error in Sentry and verify that it's source-mapped.\n ${chalk.gray(\n `${arrow} The stack trace should show your original source code.`,\n )}\n `)}\n ${chalk.dim(\n `If you encounter any issues, please refer to the Troubleshooting Guide:\n https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js\n\n If the guide doesn't help or you encounter a bug, please let us know:\n https://github.com/getsentry/sentry-javascript/issues`,\n )}\n`);\n}\n\nasync function askForUsedBundlerTool(): Promise<SupportedTools> {\n const selectedTool: SupportedTools | symbol = await abortIfCancelled(\n clack.select({\n message: 'Which bundler or build tool are you using?',\n options: [\n {\n label: 'Webpack',\n value: 'webpack',\n hint: 'Configure source maps upload using Webpack',\n },\n {\n label: 'Vite',\n value: 'vite',\n hint: 'Configure source maps upload using Vite',\n },\n {\n label: 'esbuild',\n value: 'esbuild',\n hint: 'Configure source maps upload using esbuild',\n },\n {\n label: 'Rollup',\n value: 'rollup',\n hint: 'Configure source maps upload using Rollup',\n },\n {\n label: 'tsc',\n value: 'tsc',\n hint: 'Configure source maps when using tsc as build tool',\n },\n {\n label: 'None of the above',\n value: 'sentry-cli',\n hint: 'This will configure source maps upload for you using sentry-cli',\n },\n ],\n }),\n );\n\n return selectedTool;\n}\n\nasync function startToolSetupFlow(\n selctedTool: SupportedTools,\n options: SourceMapUploadToolConfigurationOptions,\n): Promise<void> {\n switch (selctedTool) {\n case 'webpack':\n await configureWebPackPlugin(options);\n break;\n case 'vite':\n await configureVitePlugin(options);\n break;\n case 'esbuild':\n await configureEsbuildPlugin(options);\n break;\n case 'rollup':\n await configureRollupPlugin(options);\n break;\n case 'tsc':\n await configureSentryCLI(options, configureTscSourcemapGenerationFlow);\n break;\n default:\n await configureSentryCLI(options);\n break;\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import { SourceMapUploadToolConfigurationFunction } from './types';
2
+ export declare const configureEsbuildPlugin: SourceMapUploadToolConfigurationFunction;
@@ -0,0 +1,109 @@
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.configureEsbuildPlugin = void 0;
66
+ // @ts-ignore - clack is ESM and TS complains about that. It works though
67
+ var prompts_1 = __importStar(require("@clack/prompts"));
68
+ var chalk_1 = __importDefault(require("chalk"));
69
+ var clack_utils_1 = require("../../utils/clack-utils");
70
+ var getCodeSnippet = function (options) {
71
+ return chalk_1.default.gray("\n".concat(chalk_1.default.greenBright('const { sentryEsbuildPlugin } = require("@sentry/esbuild-plugin");'), "\n\nrequire(\"esbuild\").build({\n ").concat(chalk_1.default.greenBright('sourcemap: true, // Source map generation must be turned on'), "\n plugins: [\n // Put the Sentry esbuild plugin after all other plugins\n ").concat(chalk_1.default.greenBright("sentryEsbuildPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"".concat(options.orgSlug, "\",\n project: \"").concat(options.projectSlug, "\",").concat(options.selfHosted ? "\n url: \"".concat(options.url, "\",") : '', "\n }),")), "\n ],\n});\n"));
72
+ };
73
+ var configureEsbuildPlugin = function (options) { return __awaiter(void 0, void 0, void 0, function () {
74
+ var _a, _b, _c;
75
+ var _d;
76
+ return __generator(this, function (_e) {
77
+ switch (_e.label) {
78
+ case 0:
79
+ _a = clack_utils_1.installPackage;
80
+ _d = {
81
+ packageName: '@sentry/esbuild-plugin'
82
+ };
83
+ _b = clack_utils_1.hasPackageInstalled;
84
+ _c = ['@sentry/esbuild-plugin'];
85
+ return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
86
+ case 1: return [4 /*yield*/, _a.apply(void 0, [(_d.alreadyInstalled = _b.apply(void 0, _c.concat([_e.sent()])),
87
+ _d)])];
88
+ case 2:
89
+ _e.sent();
90
+ prompts_1.default.log.step("Add the following code to your esbuild config:");
91
+ // Intentially logging directly to console here so that the code can be copied/pasted directly
92
+ // eslint-disable-next-line no-console
93
+ console.log(getCodeSnippet(options));
94
+ return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)((0, prompts_1.select)({
95
+ message: 'Did you copy the snippet above?',
96
+ options: [{ label: 'Yes, continue!', value: true }],
97
+ initialValue: true,
98
+ }))];
99
+ case 3:
100
+ _e.sent();
101
+ return [4 /*yield*/, (0, clack_utils_1.addDotEnvSentryBuildPluginFile)(options.authToken)];
102
+ case 4:
103
+ _e.sent();
104
+ return [2 /*return*/];
105
+ }
106
+ });
107
+ }); };
108
+ exports.configureEsbuildPlugin = configureEsbuildPlugin;
109
+ //# sourceMappingURL=esbuild.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"esbuild.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/esbuild.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,wDAA+C;AAC/C,gDAA0B;AAC1B,uDAMiC;AAOjC,IAAM,cAAc,GAAG,UAAC,OAAgD;IACtE,OAAA,eAAK,CAAC,IAAI,CAAC,YACX,eAAK,CAAC,WAAW,CACjB,oEAAoE,CACrE,iDAGG,eAAK,CAAC,WAAW,CACjB,6DAA6D,CAC9D,+FAGG,eAAK,CAAC,WAAW,CAAC,+FAEV,OAAO,CAAC,OAAO,mCACX,OAAO,CAAC,WAAW,gBAC/B,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,yBAAiB,OAAO,CAAC,GAAG,QAAI,CAAC,CAAC,CAAC,EAAE,cAExD,CAAC,kBAGR,CAAC;AApBA,CAoBA,CAAC;AAEI,IAAM,sBAAsB,GACjC,UAAO,OAAO;;;;;;gBACN,KAAA,4BAAc,CAAA;;oBAClB,WAAW,EAAE,wBAAwB;;gBACnB,KAAA,iCAAmB,CAAA;sBACnC,wBAAwB;gBACxB,qBAAM,IAAA,+BAAiB,GAAE,EAAA;oBAJ7B,qBAAM,mBAEJ,mBAAgB,GAAE,4BAEhB,SAAyB,GAC1B;6BACD,EAAA;;gBANF,SAME,CAAC;gBAEH,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;gBAEjE,8FAA8F;gBAC9F,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;gBAErC,qBAAM,IAAA,8BAAgB,EACpB,IAAA,gBAAM,EAAC;wBACL,OAAO,EAAE,iCAAiC;wBAC1C,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;wBACnD,YAAY,EAAE,IAAI;qBACnB,CAAC,CACH,EAAA;;gBAND,SAMC,CAAC;gBAEF,qBAAM,IAAA,4CAA8B,EAAC,OAAO,CAAC,SAAS,CAAC,EAAA;;gBAAvD,SAAuD,CAAC;;;;KACzD,CAAC;AAzBS,QAAA,sBAAsB,0BAyB/B","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack, { select } from '@clack/prompts';\nimport chalk from 'chalk';\nimport {\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n getPackageDotJson,\n hasPackageInstalled,\n installPackage,\n} from '../../utils/clack-utils';\n\nimport {\n SourceMapUploadToolConfigurationFunction,\n SourceMapUploadToolConfigurationOptions,\n} from './types';\n\nconst getCodeSnippet = (options: SourceMapUploadToolConfigurationOptions) =>\n chalk.gray(`\n${chalk.greenBright(\n 'const { sentryEsbuildPlugin } = require(\"@sentry/esbuild-plugin\");',\n)}\n\nrequire(\"esbuild\").build({\n ${chalk.greenBright(\n 'sourcemap: true, // Source map generation must be turned on',\n )}\n plugins: [\n // Put the Sentry esbuild plugin after all other plugins\n ${chalk.greenBright(`sentryEsbuildPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"${options.orgSlug}\",\n project: \"${options.projectSlug}\",${\n options.selfHosted ? `\\n url: \"${options.url}\",` : ''\n }\n }),`)}\n ],\n});\n`);\n\nexport const configureEsbuildPlugin: SourceMapUploadToolConfigurationFunction =\n async (options) => {\n await installPackage({\n packageName: '@sentry/esbuild-plugin',\n alreadyInstalled: hasPackageInstalled(\n '@sentry/esbuild-plugin',\n await getPackageDotJson(),\n ),\n });\n\n clack.log.step(`Add the following code to your esbuild config:`);\n\n // Intentially logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(getCodeSnippet(options));\n\n await abortIfCancelled(\n select({\n message: 'Did you copy the snippet above?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n\n await addDotEnvSentryBuildPluginFile(options.authToken);\n };\n"]}
@@ -0,0 +1,2 @@
1
+ import { SourceMapUploadToolConfigurationFunction } from './types';
2
+ export declare const configureRollupPlugin: SourceMapUploadToolConfigurationFunction;
@@ -0,0 +1,109 @@
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.configureRollupPlugin = void 0;
66
+ // @ts-ignore - clack is ESM and TS complains about that. It works though
67
+ var prompts_1 = __importStar(require("@clack/prompts"));
68
+ var chalk_1 = __importDefault(require("chalk"));
69
+ var clack_utils_1 = require("../../utils/clack-utils");
70
+ var getCodeSnippet = function (options) {
71
+ return chalk_1.default.gray("\n".concat(chalk_1.default.greenBright('import { sentryRollupPlugin } from "@sentry/rollup-plugin";'), "\n\nexport default {\n output: {\n ").concat(chalk_1.default.greenBright('sourcemap: true, // Source map generation must be turned on'), "\n },\n plugins: [\n // Put the Sentry rollup plugin after all other plugins\n ").concat(chalk_1.default.greenBright("sentryRollupPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"".concat(options.orgSlug, "\",\n project: \"").concat(options.projectSlug, "\",").concat(options.selfHosted ? "\n url: \"".concat(options.url, "\",") : '', "\n }),")), "\n ],\n};\n"));
72
+ };
73
+ var configureRollupPlugin = function (options) { return __awaiter(void 0, void 0, void 0, function () {
74
+ var _a, _b, _c;
75
+ var _d;
76
+ return __generator(this, function (_e) {
77
+ switch (_e.label) {
78
+ case 0:
79
+ _a = clack_utils_1.installPackage;
80
+ _d = {
81
+ packageName: '@sentry/rollup-plugin'
82
+ };
83
+ _b = clack_utils_1.hasPackageInstalled;
84
+ _c = ['@sentry/rollup-plugin'];
85
+ return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
86
+ case 1: return [4 /*yield*/, _a.apply(void 0, [(_d.alreadyInstalled = _b.apply(void 0, _c.concat([_e.sent()])),
87
+ _d)])];
88
+ case 2:
89
+ _e.sent();
90
+ prompts_1.default.log.step("Add the following code to your rollup config:");
91
+ // Intentially logging directly to console here so that the code can be copied/pasted directly
92
+ // eslint-disable-next-line no-console
93
+ console.log(getCodeSnippet(options));
94
+ return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)((0, prompts_1.select)({
95
+ message: 'Did you copy the snippet above?',
96
+ options: [{ label: 'Yes, continue!', value: true }],
97
+ initialValue: true,
98
+ }))];
99
+ case 3:
100
+ _e.sent();
101
+ return [4 /*yield*/, (0, clack_utils_1.addDotEnvSentryBuildPluginFile)(options.authToken)];
102
+ case 4:
103
+ _e.sent();
104
+ return [2 /*return*/];
105
+ }
106
+ });
107
+ }); };
108
+ exports.configureRollupPlugin = configureRollupPlugin;
109
+ //# sourceMappingURL=rollup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,wDAA+C;AAC/C,gDAA0B;AAC1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ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack, { select } from '@clack/prompts';\nimport chalk from 'chalk';\nimport {\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n getPackageDotJson,\n hasPackageInstalled,\n installPackage,\n} from '../../utils/clack-utils';\n\nimport {\n SourceMapUploadToolConfigurationFunction,\n SourceMapUploadToolConfigurationOptions,\n} from './types';\n\nconst getCodeSnippet = (options: SourceMapUploadToolConfigurationOptions) =>\n chalk.gray(`\n${chalk.greenBright(\n 'import { sentryRollupPlugin } from \"@sentry/rollup-plugin\";',\n)}\n\nexport default {\n output: {\n ${chalk.greenBright(\n 'sourcemap: true, // Source map generation must be turned on',\n )}\n },\n plugins: [\n // Put the Sentry rollup plugin after all other plugins\n ${chalk.greenBright(`sentryRollupPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"${options.orgSlug}\",\n project: \"${options.projectSlug}\",${\n options.selfHosted ? `\\n url: \"${options.url}\",` : ''\n }\n }),`)}\n ],\n};\n`);\n\nexport const configureRollupPlugin: SourceMapUploadToolConfigurationFunction =\n async (options) => {\n await installPackage({\n packageName: '@sentry/rollup-plugin',\n alreadyInstalled: hasPackageInstalled(\n '@sentry/rollup-plugin',\n await getPackageDotJson(),\n ),\n });\n\n clack.log.step(\n `Add the following code to your rollup config:`,\n );\n\n // Intentially logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(getCodeSnippet(options));\n\n await abortIfCancelled(\n select({\n message: 'Did you copy the snippet above?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n\n await addDotEnvSentryBuildPluginFile(options.authToken);\n };\n"]}
@@ -1,2 +1,2 @@
1
- import { SourceMapUploadToolConfigurationFunction } from './types';
2
- export declare const configureSentryCLI: SourceMapUploadToolConfigurationFunction;
1
+ import { SourceMapUploadToolConfigurationOptions } from './types';
2
+ export declare function configureSentryCLI(options: SourceMapUploadToolConfigurationOptions, configureSourcemapGenerationFlow?: () => Promise<void>): Promise<void>;