@sentry/wizard 3.25.0 → 3.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/bin.ts +10 -2
  3. package/dist/bin.js +12 -3
  4. package/dist/bin.js.map +1 -1
  5. package/dist/lib/Helper/Env.js +1 -0
  6. package/dist/lib/Helper/Env.js.map +1 -1
  7. package/dist/lib/Setup.d.ts +6 -0
  8. package/dist/lib/Setup.js +6 -0
  9. package/dist/lib/Setup.js.map +1 -1
  10. package/dist/lib/Steps/ChooseIntegration.js +0 -29
  11. package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
  12. package/dist/package.json +2 -1
  13. package/dist/src/remix/codemods/handle-error.js +35 -33
  14. package/dist/src/remix/codemods/handle-error.js.map +1 -1
  15. package/dist/src/remix/templates.d.ts +1 -1
  16. package/dist/src/remix/templates.js +1 -1
  17. package/dist/src/remix/templates.js.map +1 -1
  18. package/dist/src/run.d.ts +16 -0
  19. package/dist/src/run.js +195 -0
  20. package/dist/src/run.js.map +1 -0
  21. package/dist/src/utils/clack-utils.js +1 -1
  22. package/dist/src/utils/clack-utils.js.map +1 -1
  23. package/dist/src/utils/package-json.d.ts +1 -0
  24. package/dist/src/utils/package-json.js.map +1 -1
  25. package/lib/Helper/Env.ts +1 -0
  26. package/lib/Setup.ts +6 -0
  27. package/lib/Steps/ChooseIntegration.ts +0 -29
  28. package/package.json +2 -1
  29. package/src/remix/codemods/handle-error.ts +57 -37
  30. package/src/remix/templates.ts +3 -3
  31. package/src/run.ts +142 -0
  32. package/src/utils/clack-utils.ts +1 -1
  33. package/src/utils/package-json.ts +1 -0
  34. package/dist/lib/Steps/Integrations/Android.d.ts +0 -9
  35. package/dist/lib/Steps/Integrations/Android.js +0 -86
  36. package/dist/lib/Steps/Integrations/Android.js.map +0 -1
  37. package/dist/lib/Steps/Integrations/Apple.d.ts +0 -10
  38. package/dist/lib/Steps/Integrations/Apple.js +0 -92
  39. package/dist/lib/Steps/Integrations/Apple.js.map +0 -1
  40. package/dist/lib/Steps/Integrations/NextJsShim.d.ts +0 -13
  41. package/dist/lib/Steps/Integrations/NextJsShim.js +0 -99
  42. package/dist/lib/Steps/Integrations/NextJsShim.js.map +0 -1
  43. package/dist/lib/Steps/Integrations/ReactNative.d.ts +0 -10
  44. package/dist/lib/Steps/Integrations/ReactNative.js +0 -93
  45. package/dist/lib/Steps/Integrations/ReactNative.js.map +0 -1
  46. package/dist/lib/Steps/Integrations/Remix.d.ts +0 -12
  47. package/dist/lib/Steps/Integrations/Remix.js +0 -98
  48. package/dist/lib/Steps/Integrations/Remix.js.map +0 -1
  49. package/dist/lib/Steps/Integrations/SourceMapsShim.d.ts +0 -13
  50. package/dist/lib/Steps/Integrations/SourceMapsShim.js +0 -94
  51. package/dist/lib/Steps/Integrations/SourceMapsShim.js.map +0 -1
  52. package/dist/lib/Steps/Integrations/SvelteKitShim.d.ts +0 -13
  53. package/dist/lib/Steps/Integrations/SvelteKitShim.js +0 -99
  54. package/dist/lib/Steps/Integrations/SvelteKitShim.js.map +0 -1
  55. package/lib/Steps/Integrations/Android.ts +0 -23
  56. package/lib/Steps/Integrations/Apple.ts +0 -27
  57. package/lib/Steps/Integrations/NextJsShim.ts +0 -33
  58. package/lib/Steps/Integrations/ReactNative.ts +0 -28
  59. package/lib/Steps/Integrations/Remix.ts +0 -32
  60. package/lib/Steps/Integrations/SourceMapsShim.ts +0 -28
  61. package/lib/Steps/Integrations/SvelteKitShim.ts +0 -33
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.25.2
4
+
5
+ - ref: Improve intro and wizard selection (#625)
6
+
7
+ ## 3.25.1
8
+
9
+ - fix(remix): Change `handleError` in server entry (#621)
10
+
3
11
  ## 3.25.0
4
12
 
5
13
  - feat(react-native): Add support for Expo projects (#505)
package/bin.ts CHANGED
@@ -2,6 +2,9 @@
2
2
  import { satisfies } from 'semver';
3
3
  import { red } from './lib/Helper/Logging';
4
4
 
5
+ import yargs from 'yargs';
6
+ import { hideBin } from 'yargs/helpers';
7
+
5
8
  const NODE_VERSION_RANGE = '>=14.18.0';
6
9
 
7
10
  // Have to run this above the other imports because they are importing clack that
@@ -14,11 +17,12 @@ if (!satisfies(process.version, NODE_VERSION_RANGE)) {
14
17
  }
15
18
 
16
19
  import { Integration, Platform } from './lib/Constants';
17
- import { run } from './lib/Setup';
20
+ import { run } from './src/run';
21
+
18
22
  export * from './lib/Setup';
19
23
 
20
24
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
21
- const argv = require('yargs')
25
+ const argv = yargs(hideBin(process.argv))
22
26
  .option('debug', {
23
27
  default: false,
24
28
  describe: 'Enable verbose logging\nenv: SENTRY_WIZARD_DEBUG',
@@ -70,6 +74,10 @@ const argv = require('yargs')
70
74
  .option('promo-code', {
71
75
  alias: 'promo-code',
72
76
  describe: 'A promo code that will be applied during signup',
77
+ type: 'string',
73
78
  }).argv;
74
79
 
80
+ // @ts-expect-error - for some reason TS doesn't recognize the aliases as valid properties
81
+ // meaning it only knows e.g. u but not url. Maybe a bug in this old version of yargs?
82
+ // Can't upgrade yargs though without dropping support for Node 14.
75
83
  void run(argv);
package/dist/bin.js CHANGED
@@ -14,9 +14,14 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
14
14
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
16
  };
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
17
20
  Object.defineProperty(exports, "__esModule", { value: true });
18
21
  var semver_1 = require("semver");
19
22
  var Logging_1 = require("./lib/Helper/Logging");
23
+ var yargs_1 = __importDefault(require("yargs"));
24
+ var helpers_1 = require("yargs/helpers");
20
25
  var NODE_VERSION_RANGE = '>=14.18.0';
21
26
  // Have to run this above the other imports because they are importing clack that
22
27
  // has the problematic imports.
@@ -25,10 +30,10 @@ if (!(0, semver_1.satisfies)(process.version, NODE_VERSION_RANGE)) {
25
30
  process.exit(1);
26
31
  }
27
32
  var Constants_1 = require("./lib/Constants");
28
- var Setup_1 = require("./lib/Setup");
33
+ var run_1 = require("./src/run");
29
34
  __exportStar(require("./lib/Setup"), exports);
30
35
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
31
- var argv = require('yargs')
36
+ var argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
32
37
  .option('debug', {
33
38
  default: false,
34
39
  describe: 'Enable verbose logging\nenv: SENTRY_WIZARD_DEBUG',
@@ -78,6 +83,10 @@ var argv = require('yargs')
78
83
  .option('promo-code', {
79
84
  alias: 'promo-code',
80
85
  describe: 'A promo code that will be applied during signup',
86
+ type: 'string',
81
87
  }).argv;
82
- void (0, Setup_1.run)(argv);
88
+ // @ts-expect-error - for some reason TS doesn't recognize the aliases as valid properties
89
+ // meaning it only knows e.g. u but not url. Maybe a bug in this old version of yargs?
90
+ // Can't upgrade yargs though without dropping support for Node 14.
91
+ void (0, run_1.run)(argv);
83
92
  //# sourceMappingURL=bin.js.map
package/dist/bin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.js","sourceRoot":"","sources":["../bin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,iCAAmC;AACnC,gDAA2C;AAE3C,IAAM,kBAAkB,GAAG,WAAW,CAAC;AAEvC,iFAAiF;AACjF,+BAA+B;AAC/B,IAAI,CAAC,IAAA,kBAAS,EAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE;IACnD,IAAA,aAAG,EACD,yCAAkC,kBAAkB,qCAA2B,OAAO,CAAC,OAAO,2CAAwC,CAC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,KAAK;IACd,QAAQ,EAAE,qCAAqC;IAC/C,IAAI,EAAE,SAAS;CAChB,CAAC;KACD,MAAM,CAAC,YAAY,EAAE;IACpB,KAAK,EAAE,YAAY;IACnB,QAAQ,EAAE,iDAAiD;CAC5D,CAAC,CAAC,IAAI,CAAC;AAEV,KAAK,IAAA,WAAG,EAAC,IAAI,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { satisfies } from 'semver';\nimport { red } from './lib/Helper/Logging';\n\nconst NODE_VERSION_RANGE = '>=14.18.0';\n\n// Have to run this above the other imports because they are importing clack that\n// has the problematic imports.\nif (!satisfies(process.version, NODE_VERSION_RANGE)) {\n red(\n `Sentry wizard requires Node.js ${NODE_VERSION_RANGE}. You are using Node.js ${process.version}. Please upgrade your Node.js version.`,\n );\n process.exit(1);\n}\n\nimport { Integration, Platform } from './lib/Constants';\nimport { run } from './lib/Setup';\nexport * from './lib/Setup';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\nconst argv = require('yargs')\n .option('debug', {\n default: false,\n describe: 'Enable verbose logging\\nenv: SENTRY_WIZARD_DEBUG',\n type: 'boolean',\n })\n .option('uninstall', {\n default: false,\n describe: 'Revert project setup process\\nenv: SENTRY_WIZARD_UNINSTALL',\n type: 'boolean',\n })\n .option('skip-connect', {\n default: false,\n describe:\n 'Skips the connection to the server\\nenv: SENTRY_WIZARD_SKIP_CONNECT',\n type: 'boolean',\n })\n .option('quiet', {\n default: false,\n describe:\n 'Do not fallback to prompting user asking questions\\nenv: SENTRY_WIZARD_QUIET',\n type: 'boolean',\n })\n .option('i', {\n alias: 'integration',\n choices: Object.keys(Integration),\n describe: 'Choose the integration to setup\\nenv: SENTRY_WIZARD_INTEGRATION',\n })\n .option('p', {\n alias: 'platform',\n choices: Object.keys(Platform),\n describe: 'Choose platform(s)\\nenv: SENTRY_WIZARD_PLATFORM',\n type: 'array',\n })\n .option('u', {\n alias: 'url',\n describe: 'The url to your Sentry installation\\nenv: SENTRY_WIZARD_URL',\n })\n .option('s', {\n alias: 'signup',\n default: false,\n describe: 'Redirect to signup page if not logged in',\n type: 'boolean',\n })\n .option('disable-telemetry', {\n default: false,\n describe: \"Don't send telemetry data to Sentry\",\n type: 'boolean',\n })\n .option('promo-code', {\n alias: 'promo-code',\n describe: 'A promo code that will be applied during signup',\n }).argv;\n\nvoid run(argv);\n"]}
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../bin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,iCAAmC;AACnC,gDAA2C;AAE3C,gDAA0B;AAC1B,yCAAwC;AAExC,IAAM,kBAAkB,GAAG,WAAW,CAAC;AAEvC,iFAAiF;AACjF,+BAA+B;AAC/B,IAAI,CAAC,IAAA,kBAAS,EAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE;IACnD,IAAA,aAAG,EACD,yCAAkC,kBAAkB,qCAA2B,OAAO,CAAC,OAAO,2CAAwC,CACvI,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,6CAAwD;AACxD,iCAAgC;AAEhC,8CAA4B;AAE5B,kJAAkJ;AAClJ,IAAM,IAAI,GAAG,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACtC,MAAM,CAAC,OAAO,EAAE;IACf,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,kDAAkD;IAC5D,IAAI,EAAE,SAAS;CAChB,CAAC;KACD,MAAM,CAAC,WAAW,EAAE;IACnB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,4DAA4D;IACtE,IAAI,EAAE,SAAS;CAChB,CAAC;KACD,MAAM,CAAC,cAAc,EAAE;IACtB,OAAO,EAAE,KAAK;IACd,QAAQ,EACN,qEAAqE;IACvE,IAAI,EAAE,SAAS;CAChB,CAAC;KACD,MAAM,CAAC,OAAO,EAAE;IACf,OAAO,EAAE,KAAK;IACd,QAAQ,EACN,8EAA8E;IAChF,IAAI,EAAE,SAAS;CAChB,CAAC;KACD,MAAM,CAAC,GAAG,EAAE;IACX,KAAK,EAAE,aAAa;IACpB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,uBAAW,CAAC;IACjC,QAAQ,EAAE,iEAAiE;CAC5E,CAAC;KACD,MAAM,CAAC,GAAG,EAAE;IACX,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,oBAAQ,CAAC;IAC9B,QAAQ,EAAE,iDAAiD;IAC3D,IAAI,EAAE,OAAO;CACd,CAAC;KACD,MAAM,CAAC,GAAG,EAAE;IACX,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,6DAA6D;CACxE,CAAC;KACD,MAAM,CAAC,GAAG,EAAE;IACX,KAAK,EAAE,QAAQ;IACf,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,0CAA0C;IACpD,IAAI,EAAE,SAAS;CAChB,CAAC;KACD,MAAM,CAAC,mBAAmB,EAAE;IAC3B,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,qCAAqC;IAC/C,IAAI,EAAE,SAAS;CAChB,CAAC;KACD,MAAM,CAAC,YAAY,EAAE;IACpB,KAAK,EAAE,YAAY;IACnB,QAAQ,EAAE,iDAAiD;IAC3D,IAAI,EAAE,QAAQ;CACf,CAAC,CAAC,IAAI,CAAC;AAEV,0FAA0F;AAC1F,sFAAsF;AACtF,mEAAmE;AACnE,KAAK,IAAA,SAAG,EAAC,IAAI,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { satisfies } from 'semver';\nimport { red } from './lib/Helper/Logging';\n\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nconst NODE_VERSION_RANGE = '>=14.18.0';\n\n// Have to run this above the other imports because they are importing clack that\n// has the problematic imports.\nif (!satisfies(process.version, NODE_VERSION_RANGE)) {\n red(\n `Sentry wizard requires Node.js ${NODE_VERSION_RANGE}. You are using Node.js ${process.version}. Please upgrade your Node.js version.`,\n );\n process.exit(1);\n}\n\nimport { Integration, Platform } from './lib/Constants';\nimport { run } from './src/run';\n\nexport * from './lib/Setup';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\nconst argv = yargs(hideBin(process.argv))\n .option('debug', {\n default: false,\n describe: 'Enable verbose logging\\nenv: SENTRY_WIZARD_DEBUG',\n type: 'boolean',\n })\n .option('uninstall', {\n default: false,\n describe: 'Revert project setup process\\nenv: SENTRY_WIZARD_UNINSTALL',\n type: 'boolean',\n })\n .option('skip-connect', {\n default: false,\n describe:\n 'Skips the connection to the server\\nenv: SENTRY_WIZARD_SKIP_CONNECT',\n type: 'boolean',\n })\n .option('quiet', {\n default: false,\n describe:\n 'Do not fallback to prompting user asking questions\\nenv: SENTRY_WIZARD_QUIET',\n type: 'boolean',\n })\n .option('i', {\n alias: 'integration',\n choices: Object.keys(Integration),\n describe: 'Choose the integration to setup\\nenv: SENTRY_WIZARD_INTEGRATION',\n })\n .option('p', {\n alias: 'platform',\n choices: Object.keys(Platform),\n describe: 'Choose platform(s)\\nenv: SENTRY_WIZARD_PLATFORM',\n type: 'array',\n })\n .option('u', {\n alias: 'url',\n describe: 'The url to your Sentry installation\\nenv: SENTRY_WIZARD_URL',\n })\n .option('s', {\n alias: 'signup',\n default: false,\n describe: 'Redirect to signup page if not logged in',\n type: 'boolean',\n })\n .option('disable-telemetry', {\n default: false,\n describe: \"Don't send telemetry data to Sentry\",\n type: 'boolean',\n })\n .option('promo-code', {\n alias: 'promo-code',\n describe: 'A promo code that will be applied during signup',\n type: 'string',\n }).argv;\n\n// @ts-expect-error - for some reason TS doesn't recognize the aliases as valid properties\n// meaning it only knows e.g. u but not url. Maybe a bug in this old version of yargs?\n// Can't upgrade yargs though without dropping support for Node 14.\nvoid run(argv);\n"]}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.readEnvironment = void 0;
4
4
  var readEnv = require('read-env').default;
5
+ // TODO: move to src/utils (+tests)
5
6
  function readEnvironment() {
6
7
  var result = readEnv('SENTRY_WIZARD');
7
8
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"Env.js","sourceRoot":"","sources":["../../../lib/Helper/Env.ts"],"names":[],"mappings":";;;AAAA,IAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;AAE5C,SAAgB,eAAe;IAC7B,IAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC;AAChB,CAAC;AAHD,0CAGC","sourcesContent":["const readEnv = require('read-env').default;\n\nexport function readEnvironment(): Record<string, unknown> {\n const result = readEnv('SENTRY_WIZARD');\n return result;\n}\n"]}
1
+ {"version":3,"file":"Env.js","sourceRoot":"","sources":["../../../lib/Helper/Env.ts"],"names":[],"mappings":";;;AAAA,IAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;AAE5C,mCAAmC;AACnC,SAAgB,eAAe;IAC7B,IAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC;AAChB,CAAC;AAHD,0CAGC","sourcesContent":["const readEnv = require('read-env').default;\n\n// TODO: move to src/utils (+tests)\nexport function readEnvironment(): Record<string, unknown> {\n const result = readEnv('SENTRY_WIZARD');\n return result;\n}\n"]}
@@ -1 +1,7 @@
1
+ /**
2
+ * @deprecated this function is the entry point to the old, step-based wizards located in `lib`.
3
+ * When creating new wizards, we now add them to clack-based wizards under `src`.
4
+ * Therefor, do not call this function anymore.
5
+ * Use `run` from {@link ../src/run.ts} instead.
6
+ */
1
7
  export declare function run(argv: any): Promise<any>;
package/dist/lib/Setup.js CHANGED
@@ -85,6 +85,12 @@ var debug_1 = require("../src/utils/debug");
85
85
  var Env_1 = require("./Helper/Env");
86
86
  var Wizard_1 = require("./Helper/Wizard");
87
87
  var Step = __importStar(require("./Steps"));
88
+ /**
89
+ * @deprecated this function is the entry point to the old, step-based wizards located in `lib`.
90
+ * When creating new wizards, we now add them to clack-based wizards under `src`.
91
+ * Therefor, do not call this function anymore.
92
+ * Use `run` from {@link ../src/run.ts} instead.
93
+ */
88
94
  function run(argv) {
89
95
  return __awaiter(this, void 0, void 0, function () {
90
96
  var args, steps;
@@ -1 +1 @@
1
- {"version":3,"file":"Setup.js","sourceRoot":"","sources":["../../lib/Setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAA4B;AAC5B,4CAAqD;AAErD,oCAA+C;AAC/C,0CAA8C;AAC9C,4CAAgC;AAEhC,SAAsB,GAAG,CAAC,IAAS;;;;YAC3B,IAAI,yBAAQ,IAAI,GAAK,IAAA,qBAAe,GAAE,CAAE,CAAC;YAE/C,IAAI,IAAI,CAAC,KAAK,EAAE;gBACd,IAAA,uBAAe,GAAE,CAAC;aACnB;YAED,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE;gBAChC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;aACxB;YACG,KAAK,GAAG;gBACV,IAAI,CAAC,OAAO;gBACZ,IAAI,CAAC,OAAO;gBACZ,IAAI,CAAC,iBAAiB;gBACtB,IAAI,CAAC,eAAe;aACrB,CAAC;YACF,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE;gBAC5B,KAAK,GAAG,CAAC,CAAC,MAAM,CACd,KAAK,EACL,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,qBAAqB,EAC1B,IAAI,CAAC,mBAAmB,CACzB,CAAC;aACH;YACD,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC5D,sBAAO,oBAAW,8BAAC,IAAI,GAAK,KAAK,WAAE;;;CACpC;AA3BD,kBA2BC","sourcesContent":["import * as _ from 'lodash';\nimport { enableDebugLogs } from '../src/utils/debug';\n\nimport { readEnvironment } from './Helper/Env';\nimport { startWizard } from './Helper/Wizard';\nimport * as Step from './Steps';\n\nexport async function run(argv: any): Promise<any> {\n const args = { ...argv, ...readEnvironment() };\n\n if (argv.debug) {\n enableDebugLogs();\n }\n\n if (args.uninstall === undefined) {\n args.uninstall = false;\n }\n let steps = [\n Step.Initial,\n Step.Welcome,\n Step.ChooseIntegration,\n Step.ShouldConfigure,\n ];\n if (args.uninstall === false) {\n steps = _.concat(\n steps,\n Step.OpenSentry,\n Step.WaitForSentry,\n Step.SentryProjectSelector,\n Step.PromptForParameters,\n );\n }\n steps = _.concat(steps, Step.ConfigureProject, Step.Result);\n return startWizard(args, ...steps);\n}\n"]}
1
+ {"version":3,"file":"Setup.js","sourceRoot":"","sources":["../../lib/Setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAA4B;AAC5B,4CAAqD;AAErD,oCAA+C;AAC/C,0CAA8C;AAC9C,4CAAgC;AAEhC;;;;;GAKG;AACH,SAAsB,GAAG,CAAC,IAAS;;;;YAC3B,IAAI,yBAAQ,IAAI,GAAK,IAAA,qBAAe,GAAE,CAAE,CAAC;YAE/C,IAAI,IAAI,CAAC,KAAK,EAAE;gBACd,IAAA,uBAAe,GAAE,CAAC;aACnB;YAED,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE;gBAChC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;aACxB;YACG,KAAK,GAAG;gBACV,IAAI,CAAC,OAAO;gBACZ,IAAI,CAAC,OAAO;gBACZ,IAAI,CAAC,iBAAiB;gBACtB,IAAI,CAAC,eAAe;aACrB,CAAC;YACF,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE;gBAC5B,KAAK,GAAG,CAAC,CAAC,MAAM,CACd,KAAK,EACL,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,qBAAqB,EAC1B,IAAI,CAAC,mBAAmB,CACzB,CAAC;aACH;YACD,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC5D,sBAAO,oBAAW,8BAAC,IAAI,GAAK,KAAK,WAAE;;;CACpC;AA3BD,kBA2BC","sourcesContent":["import * as _ from 'lodash';\nimport { enableDebugLogs } from '../src/utils/debug';\n\nimport { readEnvironment } from './Helper/Env';\nimport { startWizard } from './Helper/Wizard';\nimport * as Step from './Steps';\n\n/**\n * @deprecated this function is the entry point to the old, step-based wizards located in `lib`.\n * When creating new wizards, we now add them to clack-based wizards under `src`.\n * Therefor, do not call this function anymore.\n * Use `run` from {@link ../src/run.ts} instead.\n */\nexport async function run(argv: any): Promise<any> {\n const args = { ...argv, ...readEnvironment() };\n\n if (argv.debug) {\n enableDebugLogs();\n }\n\n if (args.uninstall === undefined) {\n args.uninstall = false;\n }\n let steps = [\n Step.Initial,\n Step.Welcome,\n Step.ChooseIntegration,\n Step.ShouldConfigure,\n ];\n if (args.uninstall === false) {\n steps = _.concat(\n steps,\n Step.OpenSentry,\n Step.WaitForSentry,\n Step.SentryProjectSelector,\n Step.PromptForParameters,\n );\n }\n steps = _.concat(steps, Step.ConfigureProject, Step.Result);\n return startWizard(args, ...steps);\n}\n"]}
@@ -57,14 +57,7 @@ var Constants_1 = require("../Constants");
57
57
  var BaseStep_1 = require("./BaseStep");
58
58
  var Cordova_1 = require("./Integrations/Cordova");
59
59
  var Electron_1 = require("./Integrations/Electron");
60
- var NextJsShim_1 = require("./Integrations/NextJsShim");
61
- var ReactNative_1 = require("./Integrations/ReactNative");
62
- var SourceMapsShim_1 = require("./Integrations/SourceMapsShim");
63
- var Apple_1 = require("./Integrations/Apple");
64
- var SvelteKitShim_1 = require("./Integrations/SvelteKitShim");
65
60
  var package_json_1 = require("../../src/utils/package-json");
66
- var Remix_1 = require("./Integrations/Remix");
67
- var Android_1 = require("./Integrations/Android");
68
61
  var Logging_1 = require("../Helper/Logging");
69
62
  var projectPackage = {};
70
63
  try {
@@ -89,34 +82,12 @@ var ChooseIntegration = /** @class */ (function (_super) {
89
82
  integrationPrompt = _a.sent();
90
83
  integration = null;
91
84
  switch (integrationPrompt.integration) {
92
- case Constants_1.Integration.android:
93
- integration = new Android_1.Android(this._argv);
94
- break;
95
85
  case Constants_1.Integration.cordova:
96
86
  integration = new Cordova_1.Cordova(sanitizeUrl(this._argv));
97
87
  break;
98
88
  case Constants_1.Integration.electron:
99
89
  integration = new Electron_1.Electron(sanitizeUrl(this._argv));
100
90
  break;
101
- case Constants_1.Integration.nextjs:
102
- integration = new NextJsShim_1.NextJsShim(this._argv);
103
- break;
104
- case Constants_1.Integration.remix:
105
- integration = new Remix_1.Remix(this._argv);
106
- break;
107
- case Constants_1.Integration.sveltekit:
108
- integration = new SvelteKitShim_1.SvelteKitShim(this._argv);
109
- break;
110
- case Constants_1.Integration.sourcemaps:
111
- integration = new SourceMapsShim_1.SourceMapsShim(this._argv);
112
- break;
113
- case Constants_1.Integration.ios:
114
- integration = new Apple_1.Apple(this._argv);
115
- break;
116
- case Constants_1.Integration.reactNative:
117
- default:
118
- integration = new ReactNative_1.ReactNative(this._argv);
119
- break;
120
91
  }
121
92
  return [2 /*return*/, { integration: integration }];
122
93
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ChooseIntegration.js","sourceRoot":"","sources":["../../../lib/Steps/ChooseIntegration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAAkC;AAElC,0CAKsB;AACtB,uCAAsC;AACtC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URL,\n getIntegrationChoices,\n Integration,\n} from '../Constants';\nimport { BaseStep } from './BaseStep';\nimport { Cordova } from './Integrations/Cordova';\nimport { Electron } from './Integrations/Electron';\nimport { NextJsShim } from './Integrations/NextJsShim';\nimport { ReactNative } from './Integrations/ReactNative';\nimport { SourceMapsShim } from './Integrations/SourceMapsShim';\nimport { Apple } from './Integrations/Apple';\nimport { SvelteKitShim } from './Integrations/SvelteKitShim';\nimport { hasPackageInstalled } from '../../src/utils/package-json';\nimport { Remix } from './Integrations/Remix';\nimport { Android } from './Integrations/Android';\nimport { dim } from '../Helper/Logging';\n\nlet projectPackage: any = {};\n\ntry {\n // If we run directly in setup-wizard\n projectPackage = require('../../package.json');\n} catch {\n projectPackage = require(`${process.cwd()}/package.json`);\n}\n\ntype IntegrationPromptAnswer = {\n integration: Integration;\n};\n\nexport class ChooseIntegration extends BaseStep {\n public async emit(_answers: Answers): Promise<Answers> {\n const integrationPrompt = await this._getIntegrationPromptSelection();\n\n let integration = null;\n switch (integrationPrompt.integration) {\n case Integration.android:\n integration = new Android(this._argv);\n break;\n case Integration.cordova:\n integration = new Cordova(sanitizeUrl(this._argv));\n break;\n case Integration.electron:\n integration = new Electron(sanitizeUrl(this._argv));\n break;\n case Integration.nextjs:\n integration = new NextJsShim(this._argv);\n break;\n case Integration.remix:\n integration = new Remix(this._argv);\n break;\n case Integration.sveltekit:\n integration = new SvelteKitShim(this._argv);\n break;\n case Integration.sourcemaps:\n integration = new SourceMapsShim(this._argv);\n break;\n case Integration.ios:\n integration = new Apple(this._argv);\n break;\n case Integration.reactNative:\n default:\n integration = new ReactNative(this._argv);\n break;\n }\n\n return { integration };\n }\n\n public tryDetectingIntegration(): Integration | undefined {\n if (hasPackageInstalled('react-native', projectPackage)) {\n return Integration.reactNative;\n }\n if (hasPackageInstalled('cordova', projectPackage)) {\n return Integration.cordova;\n }\n if (hasPackageInstalled('electron', projectPackage)) {\n return Integration.electron;\n }\n if (hasPackageInstalled('next', projectPackage)) {\n return Integration.nextjs;\n }\n if (hasPackageInstalled('remix-run', projectPackage)) {\n return Integration.remix;\n }\n if (hasPackageInstalled('@sveltejs/kit', projectPackage)) {\n return Integration.sveltekit;\n }\n\n return;\n }\n\n private async _getIntegrationPromptSelection(): Promise<IntegrationPromptAnswer> {\n // If we receive project type as an arg we skip asking\n if (this._argv.integration) {\n return { integration: this._argv.integration };\n } else {\n if (this._argv.quiet) {\n throw new Error('You need to choose a platform');\n }\n\n const detectedDefaultSelection = this.tryDetectingIntegration();\n\n return prompt([\n {\n choices: getIntegrationChoices(),\n default: detectedDefaultSelection,\n message: 'What platform do you want to set up?',\n name: 'integration',\n type: 'list',\n pageSize: 10,\n },\n ]);\n }\n }\n}\n\n/**\n * For the `clack`-based wizard flows, which we only shim here, we don't set\n * a default url value. For backwards-compatibility with the other flows,\n * we fill it here and sanitize a user-enterd url.\n */\nfunction sanitizeUrl(argv: Args): Args {\n if (!argv.url) {\n argv.url = DEFAULT_URL;\n dim(`no URL provided, fallback to ${argv.url}`);\n return argv;\n }\n\n let baseUrl = argv.url;\n baseUrl += baseUrl.endsWith('/') ? '' : '/';\n baseUrl = baseUrl.replace(/:\\/(?!\\/)/g, '://');\n argv.url = baseUrl;\n\n return argv;\n}\n"]}
1
+ {"version":3,"file":"ChooseIntegration.js","sourceRoot":"","sources":["../../../lib/Steps/ChooseIntegration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAAkC;AAElC,0CAKsB;AACtB,uCAAsC;AACtC,kDAAiD;AACjD,oDAAmD;AACnD,6DAAmE;AACnE,6CAAwC;AAExC,IAAI,cAAc,GAAQ,EAAE,CAAC;AAE7B,IAAI;IACF,qCAAqC;IACrC,cAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAChD;AAAC,WAAM;IACN,cAAc,GAAG,OAAO,CAAC,UAAG,OAAO,CAAC,GAAG,EAAE,kBAAe,CAAC,CAAC;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{ Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\n\nimport {\n Args,\n DEFAULT_URL,\n getIntegrationChoices,\n Integration,\n} from '../Constants';\nimport { BaseStep } from './BaseStep';\nimport { Cordova } from './Integrations/Cordova';\nimport { Electron } from './Integrations/Electron';\nimport { hasPackageInstalled } from '../../src/utils/package-json';\nimport { dim } from '../Helper/Logging';\n\nlet projectPackage: any = {};\n\ntry {\n // If we run directly in setup-wizard\n projectPackage = require('../../package.json');\n} catch {\n projectPackage = require(`${process.cwd()}/package.json`);\n}\n\ntype IntegrationPromptAnswer = {\n integration: Integration;\n};\n\nexport class ChooseIntegration extends BaseStep {\n public async emit(_answers: Answers): Promise<Answers> {\n const integrationPrompt = await this._getIntegrationPromptSelection();\n\n let integration = null;\n switch (integrationPrompt.integration) {\n case Integration.cordova:\n integration = new Cordova(sanitizeUrl(this._argv));\n break;\n case Integration.electron:\n integration = new Electron(sanitizeUrl(this._argv));\n break;\n }\n\n return { integration };\n }\n\n public tryDetectingIntegration(): Integration | undefined {\n if (hasPackageInstalled('react-native', projectPackage)) {\n return Integration.reactNative;\n }\n if (hasPackageInstalled('cordova', projectPackage)) {\n return Integration.cordova;\n }\n if (hasPackageInstalled('electron', projectPackage)) {\n return Integration.electron;\n }\n if (hasPackageInstalled('next', projectPackage)) {\n return Integration.nextjs;\n }\n if (hasPackageInstalled('remix-run', projectPackage)) {\n return Integration.remix;\n }\n if (hasPackageInstalled('@sveltejs/kit', projectPackage)) {\n return Integration.sveltekit;\n }\n\n return;\n }\n\n private async _getIntegrationPromptSelection(): Promise<IntegrationPromptAnswer> {\n // If we receive project type as an arg we skip asking\n if (this._argv.integration) {\n return { integration: this._argv.integration };\n } else {\n if (this._argv.quiet) {\n throw new Error('You need to choose a platform');\n }\n\n const detectedDefaultSelection = this.tryDetectingIntegration();\n\n return prompt([\n {\n choices: getIntegrationChoices(),\n default: detectedDefaultSelection,\n message: 'What platform do you want to set up?',\n name: 'integration',\n type: 'list',\n pageSize: 10,\n },\n ]);\n }\n }\n}\n\n/**\n * For the `clack`-based wizard flows, which we only shim here, we don't set\n * a default url value. For backwards-compatibility with the other flows,\n * we fill it here and sanitize a user-enterd url.\n */\nfunction sanitizeUrl(argv: Args): Args {\n if (!argv.url) {\n argv.url = DEFAULT_URL;\n dim(`no URL provided, fallback to ${argv.url}`);\n return argv;\n }\n\n let baseUrl = argv.url;\n baseUrl += baseUrl.endsWith('/') ? '' : '/';\n baseUrl = baseUrl.replace(/:\\/(?!\\/)/g, '://');\n argv.url = baseUrl;\n\n return argv;\n}\n"]}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "3.25.0",
3
+ "version": "3.25.2",
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",
@@ -50,6 +50,7 @@
50
50
  "@types/node": "^10.11.0",
51
51
  "@types/rimraf": "^3.0.2",
52
52
  "@types/semver": "^7.3.7",
53
+ "@types/yargs": "^16.0.9",
53
54
  "@typescript-eslint/eslint-plugin": "^5.13.0",
54
55
  "@typescript-eslint/parser": "^5.13.0",
55
56
  "eslint": "^8.18.0",
@@ -39,13 +39,21 @@ var magicast_1 = require("magicast");
39
39
  function instrumentHandleError(originalEntryServerMod, serverEntryFilename) {
40
40
  var _a, _b;
41
41
  var originalEntryServerModAST = originalEntryServerMod.$ast;
42
- var handleErrorFunction = originalEntryServerModAST.body.find(function (node) {
42
+ var handleErrorFunctionExport = originalEntryServerModAST.body.find(function (node) {
43
43
  var _a, _b;
44
- return node.type === 'ExportNamedDeclaration' &&
44
+ return (node.type === 'ExportNamedDeclaration' &&
45
45
  ((_a = node.declaration) === null || _a === void 0 ? void 0 : _a.type) === 'FunctionDeclaration' &&
46
- ((_b = node.declaration.id) === null || _b === void 0 ? void 0 : _b.name) === 'handleError';
46
+ ((_b = node.declaration.id) === null || _b === void 0 ? void 0 : _b.name) === 'handleError');
47
+ });
48
+ var handleErrorFunctionVariableDeclarationExport = originalEntryServerModAST.body.find(function (node) {
49
+ var _a;
50
+ return node.type === 'ExportNamedDeclaration' &&
51
+ ((_a = node.declaration) === null || _a === void 0 ? void 0 : _a.type) === 'VariableDeclaration' &&
52
+ // @ts-expect-error - id should always have a name in this case
53
+ node.declaration.declarations[0].id.name === 'handleError';
47
54
  });
48
- if (!handleErrorFunction) {
55
+ if (!handleErrorFunctionExport &&
56
+ !handleErrorFunctionVariableDeclarationExport) {
49
57
  prompts_1.default.log.warn("Could not find function ".concat(chalk_1.default.cyan('handleError'), " in ").concat(chalk_1.default.cyan(serverEntryFilename), ". Creating one for you."));
50
58
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
51
59
  var implementation = recast.parse(templates_1.HANDLE_ERROR_TEMPLATE_V2).program
@@ -55,42 +63,36 @@ function instrumentHandleError(originalEntryServerMod, serverEntryFilename) {
55
63
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
56
64
  recast.types.builders.exportNamedDeclaration(implementation));
57
65
  }
58
- else if ((0, utils_1.hasSentryContent)((0, magicast_1.generateCode)(handleErrorFunction).code, originalEntryServerMod.$code, 'captureRemixServerException')) {
66
+ else if ((handleErrorFunctionExport &&
67
+ ['wrapHandleErrorWithSentry', 'sentryHandleError'].some(function (util) {
68
+ return (0, utils_1.hasSentryContent)((0, magicast_1.generateCode)(handleErrorFunctionExport).code, originalEntryServerMod.$code, util);
69
+ })) ||
70
+ (handleErrorFunctionVariableDeclarationExport &&
71
+ ['wrapHandleErrorWithSentry', 'sentryHandleError'].some(function (util) {
72
+ return (0, utils_1.hasSentryContent)((0, magicast_1.generateCode)(handleErrorFunctionVariableDeclarationExport).code, originalEntryServerMod.$code, util);
73
+ }))) {
59
74
  return false;
60
75
  }
61
- else {
76
+ else if (handleErrorFunctionExport) {
62
77
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
63
78
  var implementation = recast.parse(templates_1.HANDLE_ERROR_TEMPLATE_V2).program
64
79
  .body[0];
65
- // @ts-expect-error - string works here because the AST is proxified by magicast
80
+ // If the current handleError function has a body, we need to merge the new implementation with the existing one
66
81
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
67
- handleErrorFunction.declaration.body.body.unshift(
68
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
69
- recast.parse(templates_1.HANDLE_ERROR_TEMPLATE_V2).program.body[0].body.body[0]);
70
- // First parameter is the error
71
- //
72
- // @ts-expect-error - string works here because the AST is proxified by magicast
73
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
74
- handleErrorFunction.declaration.params[0] = implementation.params[0];
75
- // Second parameter is the request inside an object
76
- // Merging the object properties to make sure it includes request
77
- //
78
- // @ts-expect-error - string works here because the AST is proxified by magicast
82
+ (_a = implementation.declarations[0].init.arguments[0].body.body).unshift.apply(_a, handleErrorFunctionExport.declaration.body.body);
83
+ // @ts-expect-error - declaration works here because the AST is proxified by magicast
84
+ handleErrorFunctionExport.declaration = implementation;
85
+ }
86
+ else if (handleErrorFunctionVariableDeclarationExport) {
79
87
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
80
- if ((_b = (_a = handleErrorFunction.declaration.params) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.properties) {
81
- // @ts-expect-error - string works here because the AST is proxified by magicast
82
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
83
- handleErrorFunction.declaration.params[1].properties.push(
84
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
85
- implementation.params[1].properties[0]);
86
- }
87
- else {
88
- // Create second parameter if it doesn't exist
89
- //
90
- // @ts-expect-error - string works here because the AST is proxified by magicast
91
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
92
- handleErrorFunction.declaration.params[1] = implementation.params[1];
93
- }
88
+ var implementation = recast.parse(templates_1.HANDLE_ERROR_TEMPLATE_V2).program
89
+ .body[0];
90
+ // If the current handleError function has a body, we need to merge the new implementation with the existing one
91
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
92
+ (_b = implementation.declarations[0].init.arguments[0].body.body).unshift.apply(_b, handleErrorFunctionVariableDeclarationExport.declaration
93
+ .declarations[0].init.body.body);
94
+ // @ts-expect-error - declaration works here because the AST is proxified by magicast
95
+ handleErrorFunctionVariableDeclarationExport.declaration = implementation;
94
96
  }
95
97
  return true;
96
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"handle-error.js","sourceRoot":"","sources":["../../../../src/remix/codemods/handle-error.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAM5D,6CAAiC;AAEjC,0CAAwD;AACxD,kCAA2E;AAE3E,+EAA+E;AAC/E,2DAAmC;AACnC,gDAA0B;AAE1B,kFAAkF;AAClF,qCAAwC;AAExC,SAAgB,qBAAqB,CACnC,sBAA4C,EAC5C,mBAA2B;;IAE3B,IAAM,yBAAyB,GAAG,sBAAsB,CAAC,IAAe,CAAC;IAEzE,IAAM,mBAAmB,GAAG,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAC7D,UAAC,IAAI;;QACH,OAAA,IAAI,CAAC,IAAI,KAAK,wBAAwB;YACtC,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,MAAK,qBAAqB;YAChD,CAAA,MAAA,IAAI,CAAC,WAAW,CAAC,EAAE,0CAAE,IAAI,MAAK,aAAa,CAAA;KAAA,CAC9C,CAAC;IAEF,IAAI,CAAC,mBAAmB,EAAE;QACxB,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,kCAA2B,eAAK,CAAC,IAAI,CAAC,aAAa,CAAC,iBAAO,eAAK,CAAC,IAAI,CACnE,mBAAmB,CACpB,4BAAyB,CAC3B,CAAC;QAEF,sEAAsE;QACtE,IAAM,cAAc,GAAG,MAAM,CAAC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C,UAAU,CAAC,IAAI;YACvD,sEAAsE;YACtE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CACvC,CAAC;SACH;aAAM;YACL,8CAA8C;YAC9C,EAAE;YACF,gFAAgF;YAChF,sEAAsE;YACtE,mBAAmB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACtE;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AA/ED,sDA+EC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport type { ProxifiedModule } from 'magicast';\nimport type { Program } from '@babel/types';\n\nimport * as recast from 'recast';\n\nimport { HANDLE_ERROR_TEMPLATE_V2 } from '../templates';\nimport { getAfterImportsInsertionIndex, hasSentryContent } from '../utils';\n\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { generateCode } from 'magicast';\n\nexport function instrumentHandleError(\n originalEntryServerMod: ProxifiedModule<any>,\n serverEntryFilename: string,\n): boolean {\n const originalEntryServerModAST = originalEntryServerMod.$ast as Program;\n\n const handleErrorFunction = originalEntryServerModAST.body.find(\n (node) =>\n node.type === 'ExportNamedDeclaration' &&\n node.declaration?.type === 'FunctionDeclaration' &&\n node.declaration.id?.name === 'handleError',\n );\n\n if (!handleErrorFunction) {\n clack.log.warn(\n `Could not find function ${chalk.cyan('handleError')} in ${chalk.cyan(\n serverEntryFilename,\n )}. Creating one for you.`,\n );\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const implementation = recast.parse(HANDLE_ERROR_TEMPLATE_V2).program\n .body[0];\n\n originalEntryServerModAST.body.splice(\n getAfterImportsInsertionIndex(originalEntryServerModAST),\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n recast.types.builders.exportNamedDeclaration(implementation),\n );\n } else if (\n hasSentryContent(\n generateCode(handleErrorFunction).code,\n originalEntryServerMod.$code,\n 'captureRemixServerException',\n )\n ) {\n return false;\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const implementation = recast.parse(HANDLE_ERROR_TEMPLATE_V2).program\n .body[0];\n\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n handleErrorFunction.declaration.body.body.unshift(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n recast.parse(HANDLE_ERROR_TEMPLATE_V2).program.body[0].body.body[0],\n );\n\n // First parameter is the error\n //\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n handleErrorFunction.declaration.params[0] = implementation.params[0];\n\n // Second parameter is the request inside an object\n // Merging the object properties to make sure it includes request\n //\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (handleErrorFunction.declaration.params?.[1]?.properties) {\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n handleErrorFunction.declaration.params[1].properties.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n implementation.params[1].properties[0],\n );\n } else {\n // Create second parameter if it doesn't exist\n //\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n handleErrorFunction.declaration.params[1] = implementation.params[1];\n }\n }\n\n return true;\n}\n"]}
1
+ {"version":3,"file":"handle-error.js","sourceRoot":"","sources":["../../../../src/remix/codemods/handle-error.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ClE,IAAI,CAAC,CAAC,CAAC,CAAC;QAEX,gHAAgH;QAChH,yGAAyG;QACzG,CAAA,KAAA,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA,CAAC,OAAO,WAG7D,4CAA4C,CAAC,WAAW;aACxD,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EACjC;QAEF,qFAAqF;QACrF,4CAA4C,CAAC,WAAW,GAAG,cAAc,CAAC;KAC3E;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAnGD,sDAmGC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport type { ProxifiedModule } from 'magicast';\nimport type { Program } from '@babel/types';\n\nimport * as recast from 'recast';\n\nimport { HANDLE_ERROR_TEMPLATE_V2 } from '../templates';\nimport { getAfterImportsInsertionIndex, hasSentryContent } from '../utils';\n\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { generateCode } from 'magicast';\n\nexport function instrumentHandleError(\n originalEntryServerMod: ProxifiedModule<any>,\n serverEntryFilename: string,\n): boolean {\n const originalEntryServerModAST = originalEntryServerMod.$ast as Program;\n\n const handleErrorFunctionExport = originalEntryServerModAST.body.find(\n (node) => {\n return (\n node.type === 'ExportNamedDeclaration' &&\n node.declaration?.type === 'FunctionDeclaration' &&\n node.declaration.id?.name === 'handleError'\n );\n },\n );\n\n const handleErrorFunctionVariableDeclarationExport =\n originalEntryServerModAST.body.find(\n (node) =>\n node.type === 'ExportNamedDeclaration' &&\n node.declaration?.type === 'VariableDeclaration' &&\n // @ts-expect-error - id should always have a name in this case\n node.declaration.declarations[0].id.name === 'handleError',\n );\n\n if (\n !handleErrorFunctionExport &&\n !handleErrorFunctionVariableDeclarationExport\n ) {\n clack.log.warn(\n `Could not find function ${chalk.cyan('handleError')} in ${chalk.cyan(\n serverEntryFilename,\n )}. Creating one for you.`,\n );\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const implementation = recast.parse(HANDLE_ERROR_TEMPLATE_V2).program\n .body[0];\n\n originalEntryServerModAST.body.splice(\n getAfterImportsInsertionIndex(originalEntryServerModAST),\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n recast.types.builders.exportNamedDeclaration(implementation),\n );\n } else if (\n (handleErrorFunctionExport &&\n ['wrapHandleErrorWithSentry', 'sentryHandleError'].some((util) =>\n hasSentryContent(\n generateCode(handleErrorFunctionExport).code,\n originalEntryServerMod.$code,\n util,\n ),\n )) ||\n (handleErrorFunctionVariableDeclarationExport &&\n ['wrapHandleErrorWithSentry', 'sentryHandleError'].some((util) =>\n hasSentryContent(\n generateCode(handleErrorFunctionVariableDeclarationExport).code,\n originalEntryServerMod.$code,\n util,\n ),\n ))\n ) {\n return false;\n } else if (handleErrorFunctionExport) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const implementation = recast.parse(HANDLE_ERROR_TEMPLATE_V2).program\n .body[0];\n\n // If the current handleError function has a body, we need to merge the new implementation with the existing one\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n implementation.declarations[0].init.arguments[0].body.body.unshift(\n // @ts-expect-error - declaration works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ...handleErrorFunctionExport.declaration.body.body,\n );\n\n // @ts-expect-error - declaration works here because the AST is proxified by magicast\n handleErrorFunctionExport.declaration = implementation;\n } else if (handleErrorFunctionVariableDeclarationExport) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const implementation = recast.parse(HANDLE_ERROR_TEMPLATE_V2).program\n .body[0];\n\n // If the current handleError function has a body, we need to merge the new implementation with the existing one\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n implementation.declarations[0].init.arguments[0].body.body.unshift(\n // @ts-expect-error - declaration works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ...handleErrorFunctionVariableDeclarationExport.declaration\n .declarations[0].init.body.body,\n );\n\n // @ts-expect-error - declaration works here because the AST is proxified by magicast\n handleErrorFunctionVariableDeclarationExport.declaration = implementation;\n }\n\n return true;\n}\n"]}
@@ -1,2 +1,2 @@
1
1
  export declare const ERROR_BOUNDARY_TEMPLATE_V2 = "const ErrorBoundary = () => {\n const error = useRouteError();\n captureRemixErrorBoundaryError(error);\n return <div>Something went wrong</div>;\n};\n";
2
- export declare const HANDLE_ERROR_TEMPLATE_V2 = "function handleError(error, { request }) {\n Sentry.captureRemixServerException(error, 'remix.server', request, true);\n}\n";
2
+ export declare const HANDLE_ERROR_TEMPLATE_V2 = "const handleError = Sentry.wrapHandleErrorWithSentry((error, { request }) => {\n // Custom handleError implementation\n});\n";
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HANDLE_ERROR_TEMPLATE_V2 = exports.ERROR_BOUNDARY_TEMPLATE_V2 = void 0;
4
4
  exports.ERROR_BOUNDARY_TEMPLATE_V2 = "const ErrorBoundary = () => {\n const error = useRouteError();\n captureRemixErrorBoundaryError(error);\n return <div>Something went wrong</div>;\n};\n";
5
- exports.HANDLE_ERROR_TEMPLATE_V2 = "function handleError(error, { request }) {\n Sentry.captureRemixServerException(error, 'remix.server', request, true);\n}\n";
5
+ exports.HANDLE_ERROR_TEMPLATE_V2 = "const handleError = Sentry.wrapHandleErrorWithSentry((error, { request }) => {\n // Custom handleError implementation\n});\n";
6
6
  //# sourceMappingURL=templates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/remix/templates.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG,4JAKzC,CAAC;AAEW,QAAA,wBAAwB,GAAG,8HAGvC,CAAC","sourcesContent":["export const ERROR_BOUNDARY_TEMPLATE_V2 = `const ErrorBoundary = () => {\n const error = useRouteError();\n captureRemixErrorBoundaryError(error);\n return <div>Something went wrong</div>;\n};\n`;\n\nexport const HANDLE_ERROR_TEMPLATE_V2 = `function handleError(error, { request }) {\n Sentry.captureRemixServerException(error, 'remix.server', request, true);\n}\n`;\n"]}
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/remix/templates.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG,4JAKzC,CAAC;AAEW,QAAA,wBAAwB,GAAG,+HAGvC,CAAC","sourcesContent":["export const ERROR_BOUNDARY_TEMPLATE_V2 = `const ErrorBoundary = () => {\n const error = useRouteError();\n captureRemixErrorBoundaryError(error);\n return <div>Something went wrong</div>;\n};\n`;\n\nexport const HANDLE_ERROR_TEMPLATE_V2 = `const handleError = Sentry.wrapHandleErrorWithSentry((error, { request }) => {\n // Custom handleError implementation\n});\n`;\n"]}
@@ -0,0 +1,16 @@
1
+ import { Platform } from '../lib/Constants';
2
+ type WizardIntegration = 'reactNative' | 'ios' | 'android' | 'cordova' | 'electron' | 'nextjs' | 'remix' | 'sveltekit' | 'sourcemaps';
3
+ type Args = {
4
+ integration?: WizardIntegration;
5
+ uninstall: boolean;
6
+ signup: boolean;
7
+ skipConnect: boolean;
8
+ debug: boolean;
9
+ quiet: boolean;
10
+ disableTelemetry: boolean;
11
+ promoCode?: string;
12
+ url?: string;
13
+ platform?: Platform[];
14
+ };
15
+ export declare function run(argv: Args): Promise<void>;
16
+ export {};