@sentry/wizard 3.23.3 → 3.24.1

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 (40) hide show
  1. package/CHANGELOG.md +14 -2
  2. package/dist/package.json +2 -2
  3. package/dist/src/nextjs/templates.js +1 -1
  4. package/dist/src/nextjs/templates.js.map +1 -1
  5. package/dist/src/react-native/glob.js +24 -4
  6. package/dist/src/react-native/glob.js.map +1 -1
  7. package/dist/src/remix/codemods/express-server.d.ts +0 -4
  8. package/dist/src/remix/codemods/express-server.js +1 -80
  9. package/dist/src/remix/codemods/express-server.js.map +1 -1
  10. package/dist/src/remix/codemods/handle-error.js +2 -2
  11. package/dist/src/remix/codemods/handle-error.js.map +1 -1
  12. package/dist/src/remix/remix-wizard.js +62 -19
  13. package/dist/src/remix/remix-wizard.js.map +1 -1
  14. package/dist/src/remix/sdk-example.js +1 -1
  15. package/dist/src/remix/sdk-example.js.map +1 -1
  16. package/dist/src/remix/sdk-setup.d.ts +5 -3
  17. package/dist/src/remix/sdk-setup.js +98 -38
  18. package/dist/src/remix/sdk-setup.js.map +1 -1
  19. package/dist/src/remix/templates.d.ts +1 -1
  20. package/dist/src/remix/templates.js +1 -1
  21. package/dist/src/remix/templates.js.map +1 -1
  22. package/dist/src/remix/utils.d.ts +9 -3
  23. package/dist/src/remix/utils.js +39 -10
  24. package/dist/src/remix/utils.js.map +1 -1
  25. package/dist/src/sourcemaps/sourcemaps-wizard.js +1 -1
  26. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  27. package/dist/test/nextjs/templates.test.js +1 -1
  28. package/dist/test/nextjs/templates.test.js.map +1 -1
  29. package/package.json +2 -2
  30. package/src/nextjs/templates.ts +1 -1
  31. package/src/react-native/glob.ts +1 -1
  32. package/src/remix/codemods/express-server.ts +0 -121
  33. package/src/remix/codemods/handle-error.ts +3 -2
  34. package/src/remix/remix-wizard.ts +45 -17
  35. package/src/remix/sdk-example.ts +0 -2
  36. package/src/remix/sdk-setup.ts +125 -33
  37. package/src/remix/templates.ts +1 -1
  38. package/src/remix/utils.ts +57 -7
  39. package/src/sourcemaps/sourcemaps-wizard.ts +1 -1
  40. package/test/nextjs/templates.test.ts +1 -1
@@ -95,7 +95,7 @@ function getSentryExamplePageContents(options) {
95
95
  var issuesPageLink = options.selfHosted
96
96
  ? "".concat(options.url, "organizations/").concat(options.orgSlug, "/issues/?project=").concat(options.projectId)
97
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");
98
+ return "\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
99
  }
100
100
  exports.getSentryExamplePageContents = getSentryExamplePageContents;
101
101
  //# sourceMappingURL=sdk-example.js.map
@@ -1 +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"]}
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,85FAqDkB,cAAc,0YAYxC,CAAC;AACF,CAAC;AA7ED,oEA6EC","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 `\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"]}
@@ -1,4 +1,4 @@
1
- import { PackageDotJson } from '../utils/package-json';
1
+ import type { PackageDotJson } from '../utils/package-json';
2
2
  export type PartialRemixConfig = {
3
3
  unstable_dev?: boolean;
4
4
  future?: {
@@ -11,6 +11,8 @@ export type PartialRemixConfig = {
11
11
  };
12
12
  };
13
13
  export declare function runRemixReveal(isTS: boolean): void;
14
+ export declare function createServerInstrumentationFile(dsn: string): Promise<string>;
15
+ export declare function insertServerInstrumentationFile(dsn: string): Promise<boolean>;
14
16
  export declare function isRemixV2(remixConfig: PartialRemixConfig, packageJson: PackageDotJson): boolean;
15
17
  export declare function loadRemixConfig(): Promise<PartialRemixConfig>;
16
18
  export declare function instrumentRootRoute(isV2?: boolean, isTS?: boolean): Promise<void>;
@@ -21,5 +23,5 @@ export declare function updateBuildScript(args: {
21
23
  isHydrogen: boolean;
22
24
  }): Promise<void>;
23
25
  export declare function initializeSentryOnEntryClient(dsn: string, isTS: boolean): Promise<void>;
24
- export declare function initializeSentryOnEntryServer(dsn: string, isV2: boolean, isTS: boolean): Promise<void>;
25
- export declare function instrumentExpressServer(): Promise<void>;
26
+ export declare function updateStartScript(instrumentationFile: string): Promise<void>;
27
+ export declare function instrumentSentryOnEntryServer(isV2: boolean, isTS: boolean): Promise<void>;
@@ -63,7 +63,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
63
63
  return (mod && mod.__esModule) ? mod : { "default": mod };
64
64
  };
65
65
  Object.defineProperty(exports, "__esModule", { value: true });
66
- exports.instrumentExpressServer = exports.initializeSentryOnEntryServer = exports.initializeSentryOnEntryClient = exports.updateBuildScript = exports.instrumentRootRoute = exports.loadRemixConfig = exports.isRemixV2 = exports.runRemixReveal = void 0;
66
+ exports.instrumentSentryOnEntryServer = exports.updateStartScript = exports.initializeSentryOnEntryClient = exports.updateBuildScript = exports.instrumentRootRoute = exports.loadRemixConfig = exports.isRemixV2 = exports.insertServerInstrumentationFile = exports.createServerInstrumentationFile = exports.runRemixReveal = void 0;
67
67
  var fs = __importStar(require("fs"));
68
68
  var path = __importStar(require("path"));
69
69
  var url = __importStar(require("url"));
@@ -72,15 +72,14 @@ var childProcess = __importStar(require("child_process"));
72
72
  var prompts_1 = __importDefault(require("@clack/prompts"));
73
73
  var chalk_1 = __importDefault(require("chalk"));
74
74
  var semver_1 = require("semver");
75
- // @ts-expect-error - magicast is ESM and TS complains about that. It works though
76
75
  var magicast_1 = require("magicast");
77
76
  var package_json_1 = require("../utils/package-json");
78
77
  var utils_1 = require("./utils");
79
78
  var root_v1_1 = require("./codemods/root-v1");
80
79
  var root_v2_1 = require("./codemods/root-v2");
81
80
  var handle_error_1 = require("./codemods/handle-error");
82
- var express_server_1 = require("./codemods/express-server");
83
81
  var clack_utils_1 = require("../utils/clack-utils");
82
+ var express_server_1 = require("./codemods/express-server");
84
83
  var REMIX_CONFIG_FILE = 'remix.config.js';
85
84
  var REMIX_REVEAL_COMMAND = 'npx remix reveal';
86
85
  function runRemixReveal(isTS) {
@@ -110,24 +109,74 @@ function insertClientInitCall(dsn, originalHooksMod) {
110
109
  ],
111
110
  });
112
111
  var originalHooksModAST = originalHooksMod.$ast;
113
- var initCallInsertionIndex = (0, utils_1.getInitCallInsertionIndex)(originalHooksModAST);
112
+ var initCallInsertionIndex = (0, utils_1.getAfterImportsInsertionIndex)(originalHooksModAST);
114
113
  originalHooksModAST.body.splice(initCallInsertionIndex, 0,
115
114
  // @ts-expect-error - string works here because the AST is proxified by magicast
116
115
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
117
116
  (0, magicast_1.generateCode)(initCall).code);
118
117
  }
119
- function insertServerInitCall(dsn, originalHooksMod) {
120
- var initCall = magicast_1.builders.functionCall('Sentry.init', {
121
- dsn: dsn,
122
- tracesSampleRate: 1.0,
118
+ function createServerInstrumentationFile(dsn) {
119
+ return __awaiter(this, void 0, void 0, function () {
120
+ var instrumentationFile, instrumentationFileMod, initCall, instrumentationFileModAST, initCallInsertionIndex;
121
+ return __generator(this, function (_a) {
122
+ switch (_a.label) {
123
+ case 0:
124
+ instrumentationFile = 'instrumentation.server.mjs';
125
+ instrumentationFileMod = (0, magicast_1.parseModule)('');
126
+ instrumentationFileMod.imports.$add({
127
+ from: '@sentry/remix',
128
+ imported: '*',
129
+ local: 'Sentry',
130
+ });
131
+ initCall = magicast_1.builders.functionCall('Sentry.init', {
132
+ dsn: dsn,
133
+ tracesSampleRate: 1.0,
134
+ autoInstrumentRemix: true,
135
+ });
136
+ instrumentationFileModAST = instrumentationFileMod.$ast;
137
+ initCallInsertionIndex = (0, utils_1.getAfterImportsInsertionIndex)(instrumentationFileModAST);
138
+ instrumentationFileModAST.body.splice(initCallInsertionIndex, 0,
139
+ // @ts-expect-error - string works here because the AST is proxified by magicast
140
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
141
+ (0, magicast_1.generateCode)(initCall).code);
142
+ return [4 /*yield*/, (0, magicast_1.writeFile)(instrumentationFileModAST, instrumentationFile)];
143
+ case 1:
144
+ _a.sent();
145
+ return [2 /*return*/, instrumentationFile];
146
+ }
147
+ });
123
148
  });
124
- var originalHooksModAST = originalHooksMod.$ast;
125
- var initCallInsertionIndex = (0, utils_1.getInitCallInsertionIndex)(originalHooksModAST);
126
- originalHooksModAST.body.splice(initCallInsertionIndex, 0,
127
- // @ts-expect-error - string works here because the AST is proxified by magicast
128
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
129
- (0, magicast_1.generateCode)(initCall).code);
130
149
  }
150
+ exports.createServerInstrumentationFile = createServerInstrumentationFile;
151
+ function insertServerInstrumentationFile(dsn) {
152
+ return __awaiter(this, void 0, void 0, function () {
153
+ var instrumentationFile, expressServerPath, originalExpressServerMod;
154
+ return __generator(this, function (_a) {
155
+ switch (_a.label) {
156
+ case 0: return [4 /*yield*/, createServerInstrumentationFile(dsn)];
157
+ case 1:
158
+ instrumentationFile = _a.sent();
159
+ return [4 /*yield*/, (0, express_server_1.findCustomExpressServerImplementation)()];
160
+ case 2:
161
+ expressServerPath = _a.sent();
162
+ if (!expressServerPath) {
163
+ return [2 /*return*/, false];
164
+ }
165
+ return [4 /*yield*/, (0, magicast_1.loadFile)(expressServerPath)];
166
+ case 3:
167
+ originalExpressServerMod = _a.sent();
168
+ if ((0, utils_1.serverHasInstrumentationImport)(expressServerPath, originalExpressServerMod.$code)) {
169
+ prompts_1.default.log.warn("File ".concat(chalk_1.default.cyan(path.basename(expressServerPath)), " already contains instrumentation import.\nSkipping adding instrumentation functionality to ").concat(chalk_1.default.cyan(path.basename(expressServerPath)), "."));
170
+ return [2 /*return*/, true];
171
+ }
172
+ originalExpressServerMod.$code = "import './".concat(instrumentationFile, "';\n").concat(originalExpressServerMod.$code);
173
+ fs.writeFileSync(expressServerPath, originalExpressServerMod.$code);
174
+ return [2 /*return*/, true];
175
+ }
176
+ });
177
+ });
178
+ }
179
+ exports.insertServerInstrumentationFile = insertServerInstrumentationFile;
131
180
  function isRemixV2(remixConfig, packageJson) {
132
181
  var _a;
133
182
  var remixVersion = (0, package_json_1.getPackageVersion)('@remix-run/react', packageJson);
@@ -282,7 +331,40 @@ function initializeSentryOnEntryClient(dsn, isTS) {
282
331
  });
283
332
  }
284
333
  exports.initializeSentryOnEntryClient = initializeSentryOnEntryClient;
285
- function initializeSentryOnEntryServer(dsn, isV2, isTS) {
334
+ function updateStartScript(instrumentationFile) {
335
+ return __awaiter(this, void 0, void 0, function () {
336
+ var packageJson, startCommand;
337
+ return __generator(this, function (_a) {
338
+ switch (_a.label) {
339
+ case 0: return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
340
+ case 1:
341
+ packageJson = _a.sent();
342
+ if (!packageJson.scripts || !packageJson.scripts.start) {
343
+ throw new Error("Couldn't find a `start` script in your package.json. Please add one manually.");
344
+ }
345
+ if (packageJson.scripts.start.includes('NODE_OPTIONS')) {
346
+ prompts_1.default.log.warn("Found existing NODE_OPTIONS in ".concat(chalk_1.default.cyan('start'), " script. Skipping adding Sentry initialization."));
347
+ return [2 /*return*/];
348
+ }
349
+ if (!packageJson.scripts.start.includes('remix-serve') &&
350
+ // Adding a following empty space not to match a path that includes `node`
351
+ !packageJson.scripts.start.includes('node ')) {
352
+ prompts_1.default.log.warn("Found a ".concat(chalk_1.default.cyan('start'), " script that doesn't use ").concat(chalk_1.default.cyan('remix-serve'), " or ").concat(chalk_1.default.cyan('node'), ". Skipping adding Sentry initialization."));
353
+ return [2 /*return*/];
354
+ }
355
+ startCommand = packageJson.scripts.start;
356
+ packageJson.scripts.start = "NODE_OPTIONS='--import ./".concat(instrumentationFile, "' ").concat(startCommand);
357
+ return [4 /*yield*/, fs.promises.writeFile(path.join(process.cwd(), 'package.json'), JSON.stringify(packageJson, null, 2))];
358
+ case 2:
359
+ _a.sent();
360
+ prompts_1.default.log.success("Successfully updated ".concat(chalk_1.default.cyan('start'), " script in ").concat(chalk_1.default.cyan('package.json'), " to include Sentry initialization on start."));
361
+ return [2 /*return*/];
362
+ }
363
+ });
364
+ });
365
+ }
366
+ exports.updateStartScript = updateStartScript;
367
+ function instrumentSentryOnEntryServer(isV2, isTS) {
286
368
  return __awaiter(this, void 0, void 0, function () {
287
369
  var serverEntryFilename, originalEntryServer, originalEntryServerMod, handleErrorInstrumented;
288
370
  return __generator(this, function (_a) {
@@ -301,7 +383,6 @@ function initializeSentryOnEntryServer(dsn, isV2, isTS) {
301
383
  imported: '*',
302
384
  local: 'Sentry',
303
385
  });
304
- insertServerInitCall(dsn, originalEntryServerMod);
305
386
  if (isV2) {
306
387
  handleErrorInstrumented = (0, handle_error_1.instrumentHandleError)(originalEntryServerMod, serverEntryFilename);
307
388
  if (handleErrorInstrumented) {
@@ -317,26 +398,5 @@ function initializeSentryOnEntryServer(dsn, isV2, isTS) {
317
398
  });
318
399
  });
319
400
  }
320
- exports.initializeSentryOnEntryServer = initializeSentryOnEntryServer;
321
- function instrumentExpressServer() {
322
- return __awaiter(this, void 0, void 0, function () {
323
- var expressServerPath;
324
- return __generator(this, function (_a) {
325
- switch (_a.label) {
326
- case 0: return [4 /*yield*/, (0, express_server_1.findCustomExpressServerImplementation)()];
327
- case 1:
328
- expressServerPath = _a.sent();
329
- if (!expressServerPath) {
330
- prompts_1.default.log.warn("Could not find custom Express server implementation. Please instrument it manually.");
331
- return [2 /*return*/];
332
- }
333
- return [4 /*yield*/, (0, express_server_1.instrumentExpressCreateRequestHandler)(expressServerPath)];
334
- case 2:
335
- _a.sent();
336
- return [2 /*return*/];
337
- }
338
- });
339
- });
340
- }
341
- exports.instrumentExpressServer = instrumentExpressServer;
401
+ exports.instrumentSentryOnEntryServer = instrumentSentryOnEntryServer;
342
402
  //# sourceMappingURL=sdk-setup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/remix/sdk-setup.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAO5D,qCAAyB;AACzB,yCAA6B;AAC7B,uCAA2B;AAC3B,0DAA8C;AAE9C,+EAA+E;AAC/E,2DAAmC;AACnC,gDAA0B;AAC1B,iCAAyC;AAEzC,kFAAkF;AAClF,qCAAuE;AACvE,sDAA0E;AAC1E,iCAAsE;AACtE,8CAA2D;AAC3D,8CAA2D;AAC3D,wDAAgE;AAChE,4DAGmC;AACnC,oDAAyD;AAczD,IAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAC5C,IAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEhD,SAAgB,cAAc,CAAC,IAAa;IAC1C,qCAAqC;IACrC,IAAM,mBAAmB,GAAG,uBAAgB,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAE,CAAC;IACnE,IAAM,mBAAmB,GAAG,uBAAgB,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAE,CAAC;IAEnE,IAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,E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,CAAE,CACJ,CAAC;yBACH;qBACF;oBAED,qBAAM,IAAA,oBAAS,EACb,sBAAsB,CAAC,IAAI,EAC3B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,mBAAmB,CAAC,CACrD,EAAA;;oBAHD,SAGC,CAAC;oBAEF,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,gEAAyD,eAAK,CAAC,IAAI,CACjE,mBAAmB,CACpB,MAAG,CACL,CAAC;;;;;CACH;AApDD,sEAoDC;AAED,SAAsB,uBAAuB;;;;;wBACjB,qBAAM,IAAA,sDAAqC,GAAE,EAAA;;oBAAjE,iBAAiB,GAAG,SAA6C;oBAEvE,IAAI,CAAC,iBAAiB,EAAE;wBACtB,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,qFAAqF,CACtF,CAAC;wBACF,sBAAO;qBACR;oBAED,qBAAM,IAAA,sDAAqC,EAAC,iBAAiB,CAAC,EAAA;;oBAA9D,SAA8D,CAAC;;;;;CAChE;AAXD,0DAWC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\nimport type { Program } from '@babel/types';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport type { ProxifiedModule } from 'magicast';\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as url from 'url';\nimport * as childProcess from 'child_process';\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';\nimport { gte, minVersion } from 'semver';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { builders, generateCode, loadFile, writeFile } from 'magicast';\nimport { PackageDotJson, getPackageVersion } from '../utils/package-json';\nimport { getInitCallInsertionIndex, hasSentryContent } from './utils';\nimport { instrumentRootRouteV1 } from './codemods/root-v1';\nimport { instrumentRootRouteV2 } from './codemods/root-v2';\nimport { instrumentHandleError } from './codemods/handle-error';\nimport {\n findCustomExpressServerImplementation,\n instrumentExpressCreateRequestHandler,\n} from './codemods/express-server';\nimport { getPackageDotJson } from '../utils/clack-utils';\n\nexport type PartialRemixConfig = {\n unstable_dev?: boolean;\n future?: {\n v2_dev?: boolean;\n v2_errorBoundary?: boolean;\n v2_headers?: boolean;\n v2_meta?: boolean;\n v2_normalizeFormMethod?: boolean;\n v2_routeConvention?: boolean;\n };\n};\n\nconst REMIX_CONFIG_FILE = 'remix.config.js';\nconst REMIX_REVEAL_COMMAND = 'npx remix reveal';\n\nexport function runRemixReveal(isTS: boolean): void {\n // Check if entry files already exist\n const clientEntryFilename = `entry.client.${isTS ? 'tsx' : 'jsx'}`;\n const serverEntryFilename = `entry.server.${isTS ? 'tsx' : 'jsx'}`;\n\n const clientEntryPath = path.join(process.cwd(), 'app', clientEntryFilename);\n const serverEntryPath = path.join(process.cwd(), 'app', serverEntryFilename);\n\n if (fs.existsSync(clientEntryPath) && fs.existsSync(serverEntryPath)) {\n clack.log.info(\n `Found entry files ${chalk.cyan(clientEntryFilename)} and ${chalk.cyan(\n serverEntryFilename,\n )}.`,\n );\n } else {\n clack.log.info(\n `Couldn't find entry files in your project. Trying to run ${chalk.cyan(\n REMIX_REVEAL_COMMAND,\n )}...`,\n );\n\n clack.log.info(childProcess.execSync(REMIX_REVEAL_COMMAND).toString());\n }\n}\n\nfunction insertClientInitCall(\n dsn: string,\n originalHooksMod: ProxifiedModule<any>,\n): void {\n const initCall = builders.functionCall('Sentry.init', {\n dsn,\n tracesSampleRate: 1.0,\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1.0,\n integrations: [\n builders.functionCall(\n 'Sentry.browserTracingIntegration',\n builders.raw('{ useEffect, useLocation, useMatches }'),\n ),\n builders.functionCall('Sentry.replayIntegration'),\n ],\n });\n\n const originalHooksModAST = originalHooksMod.$ast as Program;\n const initCallInsertionIndex = getInitCallInsertionIndex(originalHooksModAST);\n\n originalHooksModAST.body.splice(\n initCallInsertionIndex,\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 generateCode(initCall).code,\n );\n}\n\nfunction insertServerInitCall(\n dsn: string,\n originalHooksMod: ProxifiedModule<any>,\n) {\n const initCall = builders.functionCall('Sentry.init', {\n dsn,\n tracesSampleRate: 1.0,\n });\n\n const originalHooksModAST = originalHooksMod.$ast as Program;\n\n const initCallInsertionIndex = getInitCallInsertionIndex(originalHooksModAST);\n\n originalHooksModAST.body.splice(\n initCallInsertionIndex,\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 generateCode(initCall).code,\n );\n}\n\nexport function isRemixV2(\n remixConfig: PartialRemixConfig,\n packageJson: PackageDotJson,\n): boolean {\n const remixVersion = getPackageVersion('@remix-run/react', packageJson);\n if (!remixVersion) {\n return false;\n }\n\n const minVer = minVersion(remixVersion);\n\n if (!minVer) {\n return false;\n }\n\n const isV2Remix = gte(minVer, '2.0.0');\n\n return isV2Remix || remixConfig?.future?.v2_errorBoundary || false;\n}\n\nexport async function loadRemixConfig(): Promise<PartialRemixConfig> {\n const configFilePath = path.join(process.cwd(), REMIX_CONFIG_FILE);\n\n try {\n if (!fs.existsSync(configFilePath)) {\n return {};\n }\n\n const configUrl = url.pathToFileURL(configFilePath).href;\n const remixConfigModule = (await import(configUrl)) as {\n default: PartialRemixConfig;\n };\n\n return remixConfigModule?.default || {};\n } catch (e: unknown) {\n clack.log.error(`Couldn't load ${REMIX_CONFIG_FILE}.`);\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n\n return {};\n }\n}\n\nexport async function instrumentRootRoute(\n isV2?: boolean,\n isTS?: boolean,\n): Promise<void> {\n const rootFilename = `root.${isTS ? 'tsx' : 'jsx'}`;\n\n if (isV2) {\n await instrumentRootRouteV2(rootFilename);\n } else {\n await instrumentRootRouteV1(rootFilename);\n }\n\n clack.log.success(\n `Successfully instrumented root route ${chalk.cyan(rootFilename)}.`,\n );\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n\nexport async function updateBuildScript(args: {\n org: string;\n project: string;\n url?: string;\n isHydrogen: boolean;\n}): Promise<void> {\n const packageJson = await getPackageDotJson();\n\n if (!packageJson.scripts) {\n packageJson.scripts = {};\n }\n\n const buildCommand = args.isHydrogen\n ? 'shopify hydrogen build'\n : 'remix build';\n\n const instrumentedBuildCommand =\n `${buildCommand} --sourcemap && sentry-upload-sourcemaps --org ${args.org} --project ${args.project}` +\n (args.url ? ` --url ${args.url}` : '') +\n (args.isHydrogen ? ' --buildPath ./dist' : '');\n\n if (!packageJson.scripts.build) {\n packageJson.scripts.build = instrumentedBuildCommand;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n } else if (packageJson.scripts.build.includes(buildCommand)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n packageJson.scripts.build = packageJson.scripts.build.replace(\n buildCommand,\n instrumentedBuildCommand,\n );\n } else {\n throw new Error(\n \"`build` script doesn't contain a known build command. Please update it manually.\",\n );\n }\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageJson, null, 2),\n );\n\n clack.log.success(\n `Successfully updated ${chalk.cyan('build')} script in ${chalk.cyan(\n 'package.json',\n )} to generate and upload sourcemaps.`,\n );\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n\nexport async function initializeSentryOnEntryClient(\n dsn: string,\n isTS: boolean,\n): Promise<void> {\n const clientEntryFilename = `entry.client.${isTS ? 'tsx' : 'jsx'}`;\n\n const originalEntryClient = path.join(\n process.cwd(),\n 'app',\n clientEntryFilename,\n );\n\n const originalEntryClientMod = await loadFile(originalEntryClient);\n\n if (hasSentryContent(originalEntryClient, originalEntryClientMod.$code)) {\n return;\n }\n\n originalEntryClientMod.imports.$add({\n from: '@sentry/remix',\n imported: '*',\n local: 'Sentry',\n });\n\n originalEntryClientMod.imports.$add({\n from: 'react',\n imported: 'useEffect',\n local: 'useEffect',\n });\n\n originalEntryClientMod.imports.$add({\n from: '@remix-run/react',\n imported: 'useLocation',\n local: 'useLocation',\n });\n\n originalEntryClientMod.imports.$add({\n from: '@remix-run/react',\n imported: 'useMatches',\n local: 'useMatches',\n });\n\n insertClientInitCall(dsn, originalEntryClientMod);\n\n await writeFile(\n originalEntryClientMod.$ast,\n path.join(process.cwd(), 'app', clientEntryFilename),\n );\n\n clack.log.success(\n `Successfully initialized Sentry on client entry point ${chalk.cyan(\n clientEntryFilename,\n )}`,\n );\n}\n\nexport async function initializeSentryOnEntryServer(\n dsn: string,\n isV2: boolean,\n isTS: boolean,\n): Promise<void> {\n const serverEntryFilename = `entry.server.${isTS ? 'tsx' : 'jsx'}`;\n\n const originalEntryServer = path.join(\n process.cwd(),\n 'app',\n serverEntryFilename,\n );\n\n const originalEntryServerMod = await loadFile(originalEntryServer);\n\n if (hasSentryContent(originalEntryServer, originalEntryServerMod.$code)) {\n return;\n }\n\n originalEntryServerMod.imports.$add({\n from: '@sentry/remix',\n imported: '*',\n local: 'Sentry',\n });\n\n insertServerInitCall(dsn, originalEntryServerMod);\n\n if (isV2) {\n const handleErrorInstrumented = instrumentHandleError(\n originalEntryServerMod,\n serverEntryFilename,\n );\n\n if (handleErrorInstrumented) {\n clack.log.success(\n `Instrumented ${chalk.cyan('handleError')} in ${chalk.cyan(\n `${serverEntryFilename}`,\n )}`,\n );\n }\n }\n\n await writeFile(\n originalEntryServerMod.$ast,\n path.join(process.cwd(), 'app', serverEntryFilename),\n );\n\n clack.log.success(\n `Successfully initialized Sentry on server entry point ${chalk.cyan(\n serverEntryFilename,\n )}.`,\n );\n}\n\nexport async function instrumentExpressServer() {\n const expressServerPath = await findCustomExpressServerImplementation();\n\n if (!expressServerPath) {\n clack.log.warn(\n `Could not find custom Express server implementation. Please instrument it manually.`,\n );\n return;\n }\n\n await instrumentExpressCreateRequestHandler(expressServerPath);\n}\n"]}
1
+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CAAC,IAAI,CACjE,mBAAmB,CACpB,MAAG,CACL,CAAC;;;;;CACH;AAjDD,sEAiDC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\nimport type { Program } from '@babel/types';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport type { ProxifiedModule } from 'magicast';\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as url from 'url';\nimport * as childProcess from 'child_process';\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';\nimport { gte, minVersion } from 'semver';\n\nimport {\n builders,\n generateCode,\n loadFile,\n parseModule,\n writeFile,\n // @ts-expect-error - magicast is ESM and TS complains about that. It works though\n} from 'magicast';\nimport type { PackageDotJson } from '../utils/package-json';\nimport { getPackageVersion } from '../utils/package-json';\nimport {\n getAfterImportsInsertionIndex,\n hasSentryContent,\n serverHasInstrumentationImport,\n} from './utils';\nimport { instrumentRootRouteV1 } from './codemods/root-v1';\nimport { instrumentRootRouteV2 } from './codemods/root-v2';\nimport { instrumentHandleError } from './codemods/handle-error';\nimport { getPackageDotJson } from '../utils/clack-utils';\nimport { findCustomExpressServerImplementation } from './codemods/express-server';\n\nexport type PartialRemixConfig = {\n unstable_dev?: boolean;\n future?: {\n v2_dev?: boolean;\n v2_errorBoundary?: boolean;\n v2_headers?: boolean;\n v2_meta?: boolean;\n v2_normalizeFormMethod?: boolean;\n v2_routeConvention?: boolean;\n };\n};\n\nconst REMIX_CONFIG_FILE = 'remix.config.js';\nconst REMIX_REVEAL_COMMAND = 'npx remix reveal';\n\nexport function runRemixReveal(isTS: boolean): void {\n // Check if entry files already exist\n const clientEntryFilename = `entry.client.${isTS ? 'tsx' : 'jsx'}`;\n const serverEntryFilename = `entry.server.${isTS ? 'tsx' : 'jsx'}`;\n\n const clientEntryPath = path.join(process.cwd(), 'app', clientEntryFilename);\n const serverEntryPath = path.join(process.cwd(), 'app', serverEntryFilename);\n\n if (fs.existsSync(clientEntryPath) && fs.existsSync(serverEntryPath)) {\n clack.log.info(\n `Found entry files ${chalk.cyan(clientEntryFilename)} and ${chalk.cyan(\n serverEntryFilename,\n )}.`,\n );\n } else {\n clack.log.info(\n `Couldn't find entry files in your project. Trying to run ${chalk.cyan(\n REMIX_REVEAL_COMMAND,\n )}...`,\n );\n\n clack.log.info(childProcess.execSync(REMIX_REVEAL_COMMAND).toString());\n }\n}\n\nfunction insertClientInitCall(\n dsn: string,\n originalHooksMod: ProxifiedModule<any>,\n): void {\n const initCall = builders.functionCall('Sentry.init', {\n dsn,\n tracesSampleRate: 1.0,\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1.0,\n integrations: [\n builders.functionCall(\n 'Sentry.browserTracingIntegration',\n builders.raw('{ useEffect, useLocation, useMatches }'),\n ),\n builders.functionCall('Sentry.replayIntegration'),\n ],\n });\n\n const originalHooksModAST = originalHooksMod.$ast as Program;\n const initCallInsertionIndex =\n getAfterImportsInsertionIndex(originalHooksModAST);\n\n originalHooksModAST.body.splice(\n initCallInsertionIndex,\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 generateCode(initCall).code,\n );\n}\n\nexport async function createServerInstrumentationFile(dsn: string) {\n // create an empty file named `instrument.server.mjs`\n const instrumentationFile = 'instrumentation.server.mjs';\n const instrumentationFileMod = parseModule('');\n\n instrumentationFileMod.imports.$add({\n from: '@sentry/remix',\n imported: '*',\n local: 'Sentry',\n });\n\n const initCall = builders.functionCall('Sentry.init', {\n dsn,\n tracesSampleRate: 1.0,\n autoInstrumentRemix: true,\n });\n\n const instrumentationFileModAST = instrumentationFileMod.$ast as Program;\n\n const initCallInsertionIndex = getAfterImportsInsertionIndex(\n instrumentationFileModAST,\n );\n\n instrumentationFileModAST.body.splice(\n initCallInsertionIndex,\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 generateCode(initCall).code,\n );\n\n await writeFile(instrumentationFileModAST, instrumentationFile);\n\n return instrumentationFile;\n}\n\nexport async function insertServerInstrumentationFile(dsn: string) {\n const instrumentationFile = await createServerInstrumentationFile(dsn);\n\n const expressServerPath = await findCustomExpressServerImplementation();\n\n if (!expressServerPath) {\n return false;\n }\n\n const originalExpressServerMod = await loadFile(expressServerPath);\n\n if (\n serverHasInstrumentationImport(\n expressServerPath,\n originalExpressServerMod.$code,\n )\n ) {\n clack.log.warn(\n `File ${chalk.cyan(\n path.basename(expressServerPath),\n )} already contains instrumentation import.\nSkipping adding instrumentation functionality to ${chalk.cyan(\n path.basename(expressServerPath),\n )}.`,\n );\n\n return true;\n }\n\n originalExpressServerMod.$code = `import './${instrumentationFile}';\\n${originalExpressServerMod.$code}`;\n\n fs.writeFileSync(expressServerPath, originalExpressServerMod.$code);\n\n return true;\n}\n\nexport function isRemixV2(\n remixConfig: PartialRemixConfig,\n packageJson: PackageDotJson,\n): boolean {\n const remixVersion = getPackageVersion('@remix-run/react', packageJson);\n if (!remixVersion) {\n return false;\n }\n\n const minVer = minVersion(remixVersion);\n\n if (!minVer) {\n return false;\n }\n\n const isV2Remix = gte(minVer, '2.0.0');\n\n return isV2Remix || remixConfig?.future?.v2_errorBoundary || false;\n}\n\nexport async function loadRemixConfig(): Promise<PartialRemixConfig> {\n const configFilePath = path.join(process.cwd(), REMIX_CONFIG_FILE);\n\n try {\n if (!fs.existsSync(configFilePath)) {\n return {};\n }\n\n const configUrl = url.pathToFileURL(configFilePath).href;\n const remixConfigModule = (await import(configUrl)) as {\n default: PartialRemixConfig;\n };\n\n return remixConfigModule?.default || {};\n } catch (e: unknown) {\n clack.log.error(`Couldn't load ${REMIX_CONFIG_FILE}.`);\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n\n return {};\n }\n}\n\nexport async function instrumentRootRoute(\n isV2?: boolean,\n isTS?: boolean,\n): Promise<void> {\n const rootFilename = `root.${isTS ? 'tsx' : 'jsx'}`;\n\n if (isV2) {\n await instrumentRootRouteV2(rootFilename);\n } else {\n await instrumentRootRouteV1(rootFilename);\n }\n\n clack.log.success(\n `Successfully instrumented root route ${chalk.cyan(rootFilename)}.`,\n );\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n\nexport async function updateBuildScript(args: {\n org: string;\n project: string;\n url?: string;\n isHydrogen: boolean;\n}): Promise<void> {\n const packageJson = await getPackageDotJson();\n\n if (!packageJson.scripts) {\n packageJson.scripts = {};\n }\n\n const buildCommand = args.isHydrogen\n ? 'shopify hydrogen build'\n : 'remix build';\n\n const instrumentedBuildCommand =\n `${buildCommand} --sourcemap && sentry-upload-sourcemaps --org ${args.org} --project ${args.project}` +\n (args.url ? ` --url ${args.url}` : '') +\n (args.isHydrogen ? ' --buildPath ./dist' : '');\n\n if (!packageJson.scripts.build) {\n packageJson.scripts.build = instrumentedBuildCommand;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n } else if (packageJson.scripts.build.includes(buildCommand)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n packageJson.scripts.build = packageJson.scripts.build.replace(\n buildCommand,\n instrumentedBuildCommand,\n );\n } else {\n throw new Error(\n \"`build` script doesn't contain a known build command. Please update it manually.\",\n );\n }\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageJson, null, 2),\n );\n\n clack.log.success(\n `Successfully updated ${chalk.cyan('build')} script in ${chalk.cyan(\n 'package.json',\n )} to generate and upload sourcemaps.`,\n );\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n\nexport async function initializeSentryOnEntryClient(\n dsn: string,\n isTS: boolean,\n): Promise<void> {\n const clientEntryFilename = `entry.client.${isTS ? 'tsx' : 'jsx'}`;\n\n const originalEntryClient = path.join(\n process.cwd(),\n 'app',\n clientEntryFilename,\n );\n\n const originalEntryClientMod = await loadFile(originalEntryClient);\n\n if (hasSentryContent(originalEntryClient, originalEntryClientMod.$code)) {\n return;\n }\n\n originalEntryClientMod.imports.$add({\n from: '@sentry/remix',\n imported: '*',\n local: 'Sentry',\n });\n\n originalEntryClientMod.imports.$add({\n from: 'react',\n imported: 'useEffect',\n local: 'useEffect',\n });\n\n originalEntryClientMod.imports.$add({\n from: '@remix-run/react',\n imported: 'useLocation',\n local: 'useLocation',\n });\n\n originalEntryClientMod.imports.$add({\n from: '@remix-run/react',\n imported: 'useMatches',\n local: 'useMatches',\n });\n\n insertClientInitCall(dsn, originalEntryClientMod);\n\n await writeFile(\n originalEntryClientMod.$ast,\n path.join(process.cwd(), 'app', clientEntryFilename),\n );\n\n clack.log.success(\n `Successfully initialized Sentry on client entry point ${chalk.cyan(\n clientEntryFilename,\n )}`,\n );\n}\n\nexport async function updateStartScript(instrumentationFile: string) {\n const packageJson = await getPackageDotJson();\n\n if (!packageJson.scripts || !packageJson.scripts.start) {\n throw new Error(\n \"Couldn't find a `start` script in your package.json. Please add one manually.\",\n );\n }\n\n if (packageJson.scripts.start.includes('NODE_OPTIONS')) {\n clack.log.warn(\n `Found existing NODE_OPTIONS in ${chalk.cyan(\n 'start',\n )} script. Skipping adding Sentry initialization.`,\n );\n\n return;\n }\n\n if (\n !packageJson.scripts.start.includes('remix-serve') &&\n // Adding a following empty space not to match a path that includes `node`\n !packageJson.scripts.start.includes('node ')\n ) {\n clack.log.warn(\n `Found a ${chalk.cyan('start')} script that doesn't use ${chalk.cyan(\n 'remix-serve',\n )} or ${chalk.cyan('node')}. Skipping adding Sentry initialization.`,\n );\n\n return;\n }\n\n const startCommand = packageJson.scripts.start;\n\n packageJson.scripts.start = `NODE_OPTIONS='--import ./${instrumentationFile}' ${startCommand}`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageJson, null, 2),\n );\n\n clack.log.success(\n `Successfully updated ${chalk.cyan('start')} script in ${chalk.cyan(\n 'package.json',\n )} to include Sentry initialization on start.`,\n );\n}\n\nexport async function instrumentSentryOnEntryServer(\n isV2: boolean,\n isTS: boolean,\n): Promise<void> {\n const serverEntryFilename = `entry.server.${isTS ? 'tsx' : 'jsx'}`;\n\n const originalEntryServer = path.join(\n process.cwd(),\n 'app',\n serverEntryFilename,\n );\n\n const originalEntryServerMod = await loadFile(originalEntryServer);\n\n if (hasSentryContent(originalEntryServer, originalEntryServerMod.$code)) {\n return;\n }\n\n originalEntryServerMod.imports.$add({\n from: '@sentry/remix',\n imported: '*',\n local: 'Sentry',\n });\n\n if (isV2) {\n const handleErrorInstrumented = instrumentHandleError(\n originalEntryServerMod,\n serverEntryFilename,\n );\n\n if (handleErrorInstrumented) {\n clack.log.success(\n `Instrumented ${chalk.cyan('handleError')} in ${chalk.cyan(\n `${serverEntryFilename}`,\n )}`,\n );\n }\n }\n\n await writeFile(\n originalEntryServerMod.$ast,\n path.join(process.cwd(), 'app', serverEntryFilename),\n );\n\n clack.log.success(\n `Successfully initialized Sentry on server entry point ${chalk.cyan(\n serverEntryFilename,\n )}.`,\n );\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);\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,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);\n}\n";
5
+ exports.HANDLE_ERROR_TEMPLATE_V2 = "function handleError(error, { request }) {\n Sentry.captureRemixServerException(error, 'remix.server', request, true);\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,wHAGvC,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);\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,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,8 +1,14 @@
1
1
  import type { Program } from '@babel/types';
2
2
  import { PackageDotJson } from '../utils/package-json';
3
- export declare function hasSentryContent(fileName: string, fileContent: string): boolean;
3
+ export declare const POSSIBLE_SERVER_INSTRUMENTATION_PATHS: string[];
4
+ export declare function hasSentryContent(fileName: string, fileContent: string, expectedContent?: string): boolean;
5
+ export declare function serverHasInstrumentationImport(serverFileName: string, serverFileContent: string): boolean;
4
6
  /**
5
- * We want to insert the init call on top of the file but after all import statements
7
+ * We want to insert the init call on top of the file, before any other imports.
6
8
  */
7
- export declare function getInitCallInsertionIndex(originalHooksModAST: Program): number;
9
+ export declare function getBeforeImportsInsertionIndex(originalHooksModAST: Program): number;
10
+ /**
11
+ * We want to insert the handleError function just after all imports
12
+ */
13
+ export declare function getAfterImportsInsertionIndex(originalEntryServerModAST: Program): number;
8
14
  export declare function isHydrogenApp(packageJson: PackageDotJson): boolean;
@@ -26,33 +26,62 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.isHydrogenApp = exports.getInitCallInsertionIndex = exports.hasSentryContent = void 0;
29
+ exports.isHydrogenApp = exports.getAfterImportsInsertionIndex = exports.getBeforeImportsInsertionIndex = exports.serverHasInstrumentationImport = exports.hasSentryContent = exports.POSSIBLE_SERVER_INSTRUMENTATION_PATHS = void 0;
30
30
  var path = __importStar(require("path"));
31
31
  // @ts-expect-error - clack is ESM and TS complains about that. It works though
32
32
  var prompts_1 = __importDefault(require("@clack/prompts"));
33
33
  var chalk_1 = __importDefault(require("chalk"));
34
34
  var package_json_1 = require("../utils/package-json");
35
- // Copied from sveltekit wizard
36
- function hasSentryContent(fileName, fileContent) {
37
- var includesContent = fileContent.includes('@sentry/remix');
35
+ exports.POSSIBLE_SERVER_INSTRUMENTATION_PATHS = [
36
+ './instrumentation',
37
+ './instrumentation.server',
38
+ ];
39
+ function hasSentryContent(fileName, fileContent, expectedContent) {
40
+ if (expectedContent === void 0) { expectedContent = '@sentry/remix'; }
41
+ var includesContent = fileContent.includes(expectedContent);
38
42
  if (includesContent) {
39
- prompts_1.default.log.warn("File ".concat(chalk_1.default.cyan(path.basename(fileName)), " already contains Sentry code.\nSkipping adding Sentry functionality to ").concat(chalk_1.default.cyan(path.basename(fileName)), "."));
43
+ prompts_1.default.log.warn("File ".concat(chalk_1.default.cyan(path.basename(fileName)), " already contains ").concat(expectedContent, ".\nSkipping adding Sentry functionality to ").concat(chalk_1.default.cyan(path.basename(fileName)), "."));
40
44
  }
41
45
  return includesContent;
42
46
  }
43
47
  exports.hasSentryContent = hasSentryContent;
48
+ function serverHasInstrumentationImport(serverFileName, serverFileContent) {
49
+ var includesServerInstrumentationImport = exports.POSSIBLE_SERVER_INSTRUMENTATION_PATHS.some(function (path) {
50
+ return serverFileContent.includes(path);
51
+ });
52
+ if (includesServerInstrumentationImport) {
53
+ prompts_1.default.log.warn("File ".concat(chalk_1.default.cyan(path.basename(serverFileName)), " already contains instrumentation import.\nSkipping adding instrumentation functionality to ").concat(chalk_1.default.cyan(path.basename(serverFileName)), "."));
54
+ }
55
+ return includesServerInstrumentationImport;
56
+ }
57
+ exports.serverHasInstrumentationImport = serverHasInstrumentationImport;
58
+ /**
59
+ * We want to insert the init call on top of the file, before any other imports.
60
+ */
61
+ function getBeforeImportsInsertionIndex(originalHooksModAST) {
62
+ for (var x = 0; x < originalHooksModAST.body.length - 1; x++) {
63
+ if (originalHooksModAST.body[x].type === 'ImportDeclaration' &&
64
+ // @ts-expect-error - source is available in body
65
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
66
+ originalHooksModAST.body[x].source.value === '@sentry/remix') {
67
+ return x + 1;
68
+ }
69
+ }
70
+ return 0;
71
+ }
72
+ exports.getBeforeImportsInsertionIndex = getBeforeImportsInsertionIndex;
44
73
  /**
45
- * We want to insert the init call on top of the file but after all import statements
74
+ * We want to insert the handleError function just after all imports
46
75
  */
47
- function getInitCallInsertionIndex(originalHooksModAST) {
48
- for (var x = originalHooksModAST.body.length - 1; x >= 0; x--) {
49
- if (originalHooksModAST.body[x].type === 'ImportDeclaration') {
76
+ function getAfterImportsInsertionIndex(originalEntryServerModAST) {
77
+ for (var x = originalEntryServerModAST.body.length - 1; x >= 0; x--) {
78
+ if (originalEntryServerModAST.body[x].type === 'ImportDeclaration') {
50
79
  return x + 1;
51
80
  }
52
81
  }
53
82
  return 0;
54
83
  }
55
- exports.getInitCallInsertionIndex = getInitCallInsertionIndex;
84
+ exports.getAfterImportsInsertionIndex = getAfterImportsInsertionIndex;
56
85
  function isHydrogenApp(packageJson) {
57
86
  return (0, package_json_1.hasPackageInstalled)('@shopify/hydrogen', packageJson);
58
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/remix/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAA6B;AAE7B,+EAA+E;AAC/E,2DAAmC;AACnC,gDAA0B;AAC1B,sDAA4E;AAE5E,+BAA+B;AAC/B,SAAgB,gBAAgB,CAC9B,QAAgB,EAChB,WAAmB;IAEnB,IAAM,eAAe,GAAG,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAE9D,IAAI,eAAe,EAAE;QACnB,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,eAAQ,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,qFACP,eAAK,CAAC,IAAI,CAC5C,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACxB,MAAG,CACL,CAAC;KACH;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAhBD,4CAgBC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CACvC,mBAA4B;IAE5B,KAAK,IAAI,CAAC,GAAG,mBAAmB,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QAC7D,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAmB,EAAE;YAC5D,OAAO,CAAC,GAAG,CAAC,CAAC;SACd;KACF;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAVD,8DAUC;AAED,SAAgB,aAAa,CAAC,WAA2B;IACvD,OAAO,IAAA,kCAAmB,EAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;AAC/D,CAAC;AAFD,sCAEC","sourcesContent":["import type { Program } from '@babel/types';\n\nimport * as path from 'path';\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';\nimport { PackageDotJson, hasPackageInstalled } from '../utils/package-json';\n\n// Copied from sveltekit wizard\nexport function hasSentryContent(\n fileName: string,\n fileContent: string,\n): boolean {\n const includesContent = fileContent.includes('@sentry/remix');\n\n if (includesContent) {\n clack.log.warn(\n `File ${chalk.cyan(path.basename(fileName))} already contains Sentry code.\nSkipping adding Sentry functionality to ${chalk.cyan(\n path.basename(fileName),\n )}.`,\n );\n }\n\n return includesContent;\n}\n\n/**\n * We want to insert the init call on top of the file but after all import statements\n */\nexport function getInitCallInsertionIndex(\n originalHooksModAST: Program,\n): number {\n for (let x = originalHooksModAST.body.length - 1; x >= 0; x--) {\n if (originalHooksModAST.body[x].type === 'ImportDeclaration') {\n return x + 1;\n }\n }\n\n return 0;\n}\n\nexport function isHydrogenApp(packageJson: PackageDotJson): boolean {\n return hasPackageInstalled('@shopify/hydrogen', packageJson);\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/remix/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAA6B;AAE7B,+EAA+E;AAC/E,2DAAmC;AACnC,gDAA0B;AAC1B,sDAA4E;AAE/D,QAAA,qCAAqC,GAAG;IACnD,mBAAmB;IACnB,0BAA0B;CAC3B,CAAC;AAEF,SAAgB,gBAAgB,CAC9B,QAAgB,EAChB,WAAmB,EACnB,eAAiC;IAAjC,gCAAA,EAAA,iCAAiC;IAEjC,IAAM,eAAe,GAAG,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAE9D,IAAI,eAAe,EAAE;QACnB,iBAAK,CAAC,G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gB,6BAA6B,CAC3C,yBAAkC;IAElC,KAAK,IAAI,CAAC,GAAG,yBAAyB,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACnE,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAmB,EAAE;YAClE,OAAO,CAAC,GAAG,CAAC,CAAC;SACd;KACF;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAVD,sEAUC;AAED,SAAgB,aAAa,CAAC,WAA2B;IACvD,OAAO,IAAA,kCAAmB,EAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;AAC/D,CAAC;AAFD,sCAEC","sourcesContent":["import type { Program } from '@babel/types';\n\nimport * as path from 'path';\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';\nimport { PackageDotJson, hasPackageInstalled } from '../utils/package-json';\n\nexport const POSSIBLE_SERVER_INSTRUMENTATION_PATHS = [\n './instrumentation',\n './instrumentation.server',\n];\n\nexport function hasSentryContent(\n fileName: string,\n fileContent: string,\n expectedContent = '@sentry/remix',\n): boolean {\n const includesContent = fileContent.includes(expectedContent);\n\n if (includesContent) {\n clack.log.warn(\n `File ${chalk.cyan(\n path.basename(fileName),\n )} already contains ${expectedContent}.\nSkipping adding Sentry functionality to ${chalk.cyan(\n path.basename(fileName),\n )}.`,\n );\n }\n\n return includesContent;\n}\n\nexport function serverHasInstrumentationImport(\n serverFileName: string,\n serverFileContent: string,\n): boolean {\n const includesServerInstrumentationImport =\n POSSIBLE_SERVER_INSTRUMENTATION_PATHS.some((path) =>\n serverFileContent.includes(path),\n );\n\n if (includesServerInstrumentationImport) {\n clack.log.warn(\n `File ${chalk.cyan(\n path.basename(serverFileName),\n )} already contains instrumentation import.\nSkipping adding instrumentation functionality to ${chalk.cyan(\n path.basename(serverFileName),\n )}.`,\n );\n }\n\n return includesServerInstrumentationImport;\n}\n\n/**\n * We want to insert the init call on top of the file, before any other imports.\n */\nexport function getBeforeImportsInsertionIndex(\n originalHooksModAST: Program,\n): number {\n for (let x = 0; x < originalHooksModAST.body.length - 1; x++) {\n if (\n originalHooksModAST.body[x].type === 'ImportDeclaration' &&\n // @ts-expect-error - source is available in body\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n originalHooksModAST.body[x].source.value === '@sentry/remix'\n ) {\n return x + 1;\n }\n }\n\n return 0;\n}\n\n/**\n * We want to insert the handleError function just after all imports\n */\nexport function getAfterImportsInsertionIndex(\n originalEntryServerModAST: Program,\n): number {\n for (let x = originalEntryServerModAST.body.length - 1; x >= 0; x--) {\n if (originalEntryServerModAST.body[x].type === 'ImportDeclaration') {\n return x + 1;\n }\n }\n\n return 0;\n}\n\nexport function isHydrogenApp(packageJson: PackageDotJson): boolean {\n return hasPackageInstalled('@shopify/hydrogen', packageJson);\n}\n"]}
@@ -327,7 +327,7 @@ function configureCI(selectedTool, authToken) {
327
327
  options: [
328
328
  {
329
329
  label: 'Yes',
330
- hint: 'I use a tool like Github Actions, Gitlab, CircleCI, TravisCI, Jenkins, Vercel, ...',
330
+ hint: 'I use a tool like GitHub Actions, GitLab, CircleCI, TravisCI, Jenkins, Vercel, ...',
331
331
  value: true,
332
332
  },
333
333
  {