@sentry/wizard 6.6.0 → 6.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE +97 -8
  3. package/dist/bin.js +5 -0
  4. package/dist/bin.js.map +1 -1
  5. package/dist/e2e-tests/tests/help-message.test.js +5 -1
  6. package/dist/e2e-tests/tests/help-message.test.js.map +1 -1
  7. package/dist/e2e-tests/tests/nextjs-15.test.js +79 -0
  8. package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
  9. package/dist/e2e-tests/tests/react-router.test.d.ts +1 -0
  10. package/dist/e2e-tests/tests/react-router.test.js +255 -0
  11. package/dist/e2e-tests/tests/react-router.test.js.map +1 -0
  12. package/dist/e2e-tests/utils/index.d.ts +8 -2
  13. package/dist/e2e-tests/utils/index.js +72 -21
  14. package/dist/e2e-tests/utils/index.js.map +1 -1
  15. package/dist/lib/Constants.d.ts +1 -0
  16. package/dist/lib/Constants.js +5 -0
  17. package/dist/lib/Constants.js.map +1 -1
  18. package/dist/src/android/android-wizard.js +8 -1
  19. package/dist/src/android/android-wizard.js.map +1 -1
  20. package/dist/src/angular/angular-wizard.js +8 -1
  21. package/dist/src/angular/angular-wizard.js.map +1 -1
  22. package/dist/src/apple/apple-wizard.js +8 -1
  23. package/dist/src/apple/apple-wizard.js.map +1 -1
  24. package/dist/src/flutter/flutter-wizard.js +8 -1
  25. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  26. package/dist/src/nextjs/nextjs-wizard.js +35 -9
  27. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  28. package/dist/src/nextjs/templates.d.ts +3 -3
  29. package/dist/src/nextjs/templates.js +18 -7
  30. package/dist/src/nextjs/templates.js.map +1 -1
  31. package/dist/src/nuxt/nuxt-wizard.js +8 -1
  32. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  33. package/dist/src/react-native/react-native-wizard.js +8 -1
  34. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  35. package/dist/src/react-router/codemods/client.entry.d.ts +1 -0
  36. package/dist/src/react-router/codemods/client.entry.js +73 -0
  37. package/dist/src/react-router/codemods/client.entry.js.map +1 -0
  38. package/dist/src/react-router/codemods/react-router-config.d.ts +9 -0
  39. package/dist/src/react-router/codemods/react-router-config.js +178 -0
  40. package/dist/src/react-router/codemods/react-router-config.js.map +1 -0
  41. package/dist/src/react-router/codemods/root.d.ts +1 -0
  42. package/dist/src/react-router/codemods/root.js +171 -0
  43. package/dist/src/react-router/codemods/root.js.map +1 -0
  44. package/dist/src/react-router/codemods/routes-config.d.ts +1 -0
  45. package/dist/src/react-router/codemods/routes-config.js +106 -0
  46. package/dist/src/react-router/codemods/routes-config.js.map +1 -0
  47. package/dist/src/react-router/codemods/server-entry.d.ts +4 -0
  48. package/dist/src/react-router/codemods/server-entry.js +275 -0
  49. package/dist/src/react-router/codemods/server-entry.js.map +1 -0
  50. package/dist/src/react-router/codemods/utils.d.ts +2 -0
  51. package/dist/src/react-router/codemods/utils.js +13 -0
  52. package/dist/src/react-router/codemods/utils.js.map +1 -0
  53. package/dist/src/react-router/codemods/vite.d.ts +8 -0
  54. package/dist/src/react-router/codemods/vite.js +169 -0
  55. package/dist/src/react-router/codemods/vite.js.map +1 -0
  56. package/dist/src/react-router/react-router-wizard.d.ts +2 -0
  57. package/dist/src/react-router/react-router-wizard.js +254 -0
  58. package/dist/src/react-router/react-router-wizard.js.map +1 -0
  59. package/dist/src/react-router/sdk-example.d.ts +18 -0
  60. package/dist/src/react-router/sdk-example.js +306 -0
  61. package/dist/src/react-router/sdk-example.js.map +1 -0
  62. package/dist/src/react-router/sdk-setup.d.ts +17 -0
  63. package/dist/src/react-router/sdk-setup.js +250 -0
  64. package/dist/src/react-router/sdk-setup.js.map +1 -0
  65. package/dist/src/react-router/templates.d.ts +11 -0
  66. package/dist/src/react-router/templates.js +273 -0
  67. package/dist/src/react-router/templates.js.map +1 -0
  68. package/dist/src/remix/remix-wizard.js +8 -1
  69. package/dist/src/remix/remix-wizard.js.map +1 -1
  70. package/dist/src/run.d.ts +2 -1
  71. package/dist/src/run.js +6 -0
  72. package/dist/src/run.js.map +1 -1
  73. package/dist/src/sourcemaps/sourcemaps-wizard.js +8 -1
  74. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  75. package/dist/src/sveltekit/sveltekit-wizard.js +8 -1
  76. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  77. package/dist/src/utils/ast-utils.d.ts +30 -0
  78. package/dist/src/utils/ast-utils.js +71 -1
  79. package/dist/src/utils/ast-utils.js.map +1 -1
  80. package/dist/src/utils/clack/index.d.ts +5 -2
  81. package/dist/src/utils/clack/index.js +14 -2
  82. package/dist/src/utils/clack/index.js.map +1 -1
  83. package/dist/src/utils/types.d.ts +9 -0
  84. package/dist/src/utils/types.js.map +1 -1
  85. package/dist/src/version.d.ts +1 -1
  86. package/dist/src/version.js +1 -1
  87. package/dist/src/version.js.map +1 -1
  88. package/dist/test/nextjs/templates.test.js +20 -0
  89. package/dist/test/nextjs/templates.test.js.map +1 -1
  90. package/dist/test/react-router/codemods/client-entry.test.d.ts +1 -0
  91. package/dist/test/react-router/codemods/client-entry.test.js +168 -0
  92. package/dist/test/react-router/codemods/client-entry.test.js.map +1 -0
  93. package/dist/test/react-router/codemods/react-router-config.test.d.ts +1 -0
  94. package/dist/test/react-router/codemods/react-router-config.test.js +168 -0
  95. package/dist/test/react-router/codemods/react-router-config.test.js.map +1 -0
  96. package/dist/test/react-router/codemods/root.test.d.ts +1 -0
  97. package/dist/test/react-router/codemods/root.test.js +178 -0
  98. package/dist/test/react-router/codemods/root.test.js.map +1 -0
  99. package/dist/test/react-router/codemods/server-entry.test.d.ts +1 -0
  100. package/dist/test/react-router/codemods/server-entry.test.js +415 -0
  101. package/dist/test/react-router/codemods/server-entry.test.js.map +1 -0
  102. package/dist/test/react-router/codemods/vite.test.d.ts +1 -0
  103. package/dist/test/react-router/codemods/vite.test.js +158 -0
  104. package/dist/test/react-router/codemods/vite.test.js.map +1 -0
  105. package/dist/test/react-router/routes-config.test.d.ts +1 -0
  106. package/dist/test/react-router/routes-config.test.js +156 -0
  107. package/dist/test/react-router/routes-config.test.js.map +1 -0
  108. package/dist/test/react-router/sdk-setup.test.d.ts +1 -0
  109. package/dist/test/react-router/sdk-setup.test.js +411 -0
  110. package/dist/test/react-router/sdk-setup.test.js.map +1 -0
  111. package/dist/test/react-router/templates.test.d.ts +1 -0
  112. package/dist/test/react-router/templates.test.js +220 -0
  113. package/dist/test/react-router/templates.test.js.map +1 -0
  114. package/dist/test/utils/clack/index.test.js +1 -1
  115. package/dist/test/utils/clack/index.test.js.map +1 -1
  116. package/package.json +2 -2
@@ -122,7 +122,14 @@ without SvelteKit's builtin observability.`);
122
122
  }
123
123
  }
124
124
  Sentry.setTag('svelte-version', (0, utils_1.getSvelteVersionBucket)((0, package_json_1.getPackageVersion)('svelte', packageJson)));
125
- const { selectedProject, selfHosted, sentryUrl, authToken } = await (0, clack_1.getOrAskForProjectData)(options, 'javascript-sveltekit');
125
+ const projectData = await (0, clack_1.getOrAskForProjectData)(options, 'javascript-sveltekit');
126
+ if (projectData.spotlight) {
127
+ clack.log.warn('Spotlight mode is not yet supported for SvelteKit.');
128
+ clack.log.info('Spotlight is currently only available for Next.js.');
129
+ await (0, clack_1.abort)('Exiting wizard', 0);
130
+ return;
131
+ }
132
+ const { selectedProject, selfHosted, sentryUrl, authToken } = projectData;
126
133
  const sdkAlreadyInstalled = (0, package_json_1.hasPackageInstalled)('@sentry/sveltekit', packageJson);
127
134
  Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);
128
135
  await (0, clack_1.installPackage)({
@@ -1 +1 @@
1
- {"version":3,"file":"sveltekit-wizard.js","sourceRoot":"","sources":["../../../src/sveltekit/sveltekit-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E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CAC7D,CAAC;YACF,MAAM,IAAA,aAAK,EAAC,gBAAgB,CAAC,CAAC;YAC9B,OAAO;SACR;KACF;IAED,MAAM,IAAA,8BAAsB,EAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IAEjD,iFAAiF;IACjF,MAAM,IAAA,wCAA2B,EAC/B,eAAe,CAAC,YAAY,CAAC,IAAI,EACjC,eAAe,CAAC,IAAI,CACrB,CAAC;IAEF,KAAK,CAAC,KAAK,CAAC,MAAM,iBAAiB,CAAC,uBAAuB,CAAC,CAAC,CAAC;AAChE,CAAC;AApMD,0EAoMC;AAED,KAAK,UAAU,iBAAiB,CAC9B,uBAAgC;IAEhC,MAAM,cAAc,GAAG,MAAM,IAAA,yBAAiB,EAAC,qBAAG,CAAC,CAAC;IAEpD,IAAI,GAAG,GAAG,eAAK,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAE1E,IAAI,uBAAuB,EAAE;QAC3B,GAAG,IAAI,qEAAqE,eAAK,CAAC,IAAI,CACpF,KAAK,cAAc,CAAC,gBAAgB,QAAQ,CAC7C,kBAAkB,eAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC;KAC5D;IAED,GAAG,IAAI;8DACqD,CAAC;IAE7D,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport * as Sentry from '@sentry/node';\n\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n abort,\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n getPackageManager,\n installPackage,\n printWelcome,\n runPrettierIfInstalled,\n} from '../utils/clack';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { NPM } from '../utils/package-manager';\nimport type { WizardOptions } from '../utils/types';\nimport { offerProjectScopedMcpConfig } from '../utils/clack/mcp-config';\nimport { createExamplePage } from './sdk-example';\nimport { createOrMergeSvelteKitFiles } from './sdk-setup/setup';\nimport { loadSvelteConfig } from './sdk-setup/svelte-config';\nimport { getKitVersionBucket, getSvelteVersionBucket } from './utils';\n\nexport async function runSvelteKitWizard(\n options: WizardOptions,\n): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'sveltekit',\n wizardOptions: options,\n },\n () => runSvelteKitWizardWithTelemetry(options),\n );\n}\n\nexport async function runSvelteKitWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n const { promoCode, telemetryEnabled, forceInstall } = options;\n\n printWelcome({\n wizardName: 'Sentry SvelteKit Wizard',\n promoCode,\n telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, '@sveltejs/kit', 'Sveltekit');\n\n const kitVersion = getPackageVersion('@sveltejs/kit', packageJson);\n const kitVersionBucket = getKitVersionBucket(kitVersion);\n Sentry.setTag('sveltekit-version', kitVersionBucket);\n\n if (kitVersionBucket === '0.x') {\n clack.log.warn(\n \"It seems you're using a SvelteKit version <1.0.0 which is not supported by Sentry.\\nWe recommend upgrading to the latest 1.x version before you continue.\",\n );\n const shouldContinue = await abortIfCancelled(\n clack.select({\n message: 'Do you want to continue anyway?',\n options: [\n {\n label: 'Yes, continue',\n hint: 'The SDK might not work correctly',\n value: true,\n },\n { label: \"No, I'll upgrade first\", value: false },\n ],\n }),\n );\n if (!shouldContinue) {\n await abort('Exiting Wizard', 0);\n return;\n }\n }\n\n let setupForSvelteKitTracing = kitVersionBucket === '>=2.31.0';\n\n if (kitVersionBucket !== '>=2.31.0') {\n clack.log.warn(\n `It seems you're using a SvelteKit version ${chalk.cyan(\n '<2.31.0',\n )} (detected ${chalk.cyan(kitVersion ?? 'unknown')}). \n\nWe recommend upgrading SvelteKit to version ${chalk.cyan(\n '>=2.31.0',\n )} to use SvelteKit's builtin observability:\n${chalk.cyan('https://svelte.dev/docs/kit/observability')}\n\nSentry works best with SvelteKit versions ${chalk.cyan('>=2.31.0')}.\n\nIf you prefer, you can stay on your current version and use the Sentry SDK \nwithout SvelteKit's builtin observability.`,\n );\n\n const decision = await abortIfCancelled(\n clack.select({\n message: 'Do you want to continue anyway?',\n options: [\n {\n label: \"No, I'll upgrade SvelteKit first\",\n hint: 'Recommended',\n value: 'exit-to-upgrade',\n },\n {\n label: \"I'm already on SvelteKit >=2.31.0\",\n hint: 'Sorry, my bad!',\n value: 'install-with-kit-tracing',\n },\n {\n label: 'Yes, continue',\n hint: 'No Problem!',\n value: 'install-without-kit-tracing',\n },\n ],\n }),\n );\n\n if (decision === 'install-with-kit-tracing') {\n setupForSvelteKitTracing = true;\n }\n\n if (decision === 'exit-to-upgrade') {\n await abort('Exiting Wizard', 0);\n return;\n }\n }\n\n Sentry.setTag(\n 'svelte-version',\n getSvelteVersionBucket(getPackageVersion('svelte', packageJson)),\n );\n\n const { selectedProject, selfHosted, sentryUrl, authToken } =\n await getOrAskForProjectData(options, 'javascript-sveltekit');\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/sveltekit',\n packageJson,\n );\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n await installPackage({\n packageName: '@sentry/sveltekit@^10',\n packageNameDisplayLabel: '@sentry/sveltekit',\n alreadyInstalled: sdkAlreadyInstalled,\n forceInstall,\n });\n\n await addDotEnvSentryBuildPluginFile(authToken);\n\n const svelteConfig = await traceStep('load-svelte-config', loadSvelteConfig);\n\n try {\n await traceStep('configure-sdk', () =>\n createOrMergeSvelteKitFiles(\n {\n dsn: selectedProject.keys[0].dsn.public,\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n selfHosted,\n url: sentryUrl,\n },\n svelteConfig,\n setupForSvelteKitTracing,\n ),\n );\n } catch (e: unknown) {\n clack.log.error('Error while setting up the SvelteKit SDK:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n Sentry.captureException('Error while setting up the SvelteKit SDK');\n await abort('Exiting Wizard');\n return;\n }\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage(\n '/sentry-example-page',\n );\n\n if (shouldCreateExamplePage) {\n try {\n await traceStep('create-example-page', () =>\n createExamplePage(svelteConfig, {\n selfHosted,\n url: sentryUrl,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n }),\n );\n } catch (e: unknown) {\n clack.log.error('Error while creating an example page to test Sentry:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n Sentry.captureException(\n 'Error while creating an example Svelte page to test Sentry',\n );\n await abort('Exiting Wizard');\n return;\n }\n }\n\n await runPrettierIfInstalled({ cwd: undefined });\n\n // Offer optional project-scoped MCP config for Sentry with org and project scope\n await offerProjectScopedMcpConfig(\n selectedProject.organization.slug,\n selectedProject.slug,\n );\n\n clack.outro(await buildOutroMessage(shouldCreateExamplePage));\n}\n\nasync function buildOutroMessage(\n shouldCreateExamplePage: boolean,\n): Promise<string> {\n const packageManager = await getPackageManager(NPM);\n\n let msg = chalk.green('Successfully installed the Sentry SvelteKit SDK!');\n\n if (shouldCreateExamplePage) {\n msg += `\\n\\nYou can validate your setup by starting your dev environment (${chalk.cyan(\n `\\`${packageManager.runScriptCommand} dev\\``,\n )}) and visiting ${chalk.cyan('\"/sentry-example-page\"')}.`;\n }\n\n msg += `\\n\\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/javascript/guides/sveltekit/`;\n\n return msg;\n}\n"]}
1
+ {"version":3,"file":"sveltekit-wizard.js","sourceRoot":"","sources":["../../../src/sveltekit/sveltekit-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sDAAsD,CAAC,CAAC;YACxE,KAAK,CAAC,GAAG,CAAC,IAAI,CACZ,eAAK,CAAC,GAAG,CACP,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,IAAI,IAAI,IAAI,UAAU,IAAI,CAAC;gBACnD,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;gBACd,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ;oBACvB,CAAC,CAAC,CAAC;oBACH,CAAC,CAAC,eAAe,CACpB,CACF,CAAC;YACF,MAAM,CAAC,gBAAgB,CACrB,4DAA4D,CAC7D,CAAC;YACF,MAAM,IAAA,aAAK,EAAC,gBAAgB,CAAC,CAAC;YAC9B,OAAO;SACR;KACF;IAED,MAAM,IAAA,8BAAsB,EAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IAEjD,iFAAiF;IACjF,MAAM,IAAA,wCAA2B,EAC/B,eAAe,CAAC,YAAY,CAAC,IAAI,EACjC,eAAe,CAAC,IAAI,CACrB,CAAC;IAEF,KAAK,CAAC,KAAK,CAAC,MAAM,iBAAiB,CAAC,uBAAuB,CAAC,CAAC,CAAC;AAChE,CAAC;AA/MD,0EA+MC;AAED,KAAK,UAAU,iBAAiB,CAC9B,uBAAgC;IAEhC,MAAM,cAAc,GAAG,MAAM,IAAA,yBAAiB,EAAC,qBAAG,CAAC,CAAC;IAEpD,IAAI,GAAG,GAAG,eAAK,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAE1E,IAAI,uBAAuB,EAAE;QAC3B,GAAG,IAAI,qEAAqE,eAAK,CAAC,IAAI,CACpF,KAAK,cAAc,CAAC,gBAAgB,QAAQ,CAC7C,kBAAkB,eAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC;KAC5D;IAED,GAAG,IAAI;8DACqD,CAAC;IAE7D,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport * as Sentry from '@sentry/node';\n\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n abort,\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n getPackageManager,\n installPackage,\n printWelcome,\n runPrettierIfInstalled,\n} from '../utils/clack';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { NPM } from '../utils/package-manager';\nimport type { WizardOptions } from '../utils/types';\nimport { offerProjectScopedMcpConfig } from '../utils/clack/mcp-config';\nimport { createExamplePage } from './sdk-example';\nimport { createOrMergeSvelteKitFiles } from './sdk-setup/setup';\nimport { loadSvelteConfig } from './sdk-setup/svelte-config';\nimport { getKitVersionBucket, getSvelteVersionBucket } from './utils';\n\nexport async function runSvelteKitWizard(\n options: WizardOptions,\n): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'sveltekit',\n wizardOptions: options,\n },\n () => runSvelteKitWizardWithTelemetry(options),\n );\n}\n\nexport async function runSvelteKitWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n const { promoCode, telemetryEnabled, forceInstall } = options;\n\n printWelcome({\n wizardName: 'Sentry SvelteKit Wizard',\n promoCode,\n telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, '@sveltejs/kit', 'Sveltekit');\n\n const kitVersion = getPackageVersion('@sveltejs/kit', packageJson);\n const kitVersionBucket = getKitVersionBucket(kitVersion);\n Sentry.setTag('sveltekit-version', kitVersionBucket);\n\n if (kitVersionBucket === '0.x') {\n clack.log.warn(\n \"It seems you're using a SvelteKit version <1.0.0 which is not supported by Sentry.\\nWe recommend upgrading to the latest 1.x version before you continue.\",\n );\n const shouldContinue = await abortIfCancelled(\n clack.select({\n message: 'Do you want to continue anyway?',\n options: [\n {\n label: 'Yes, continue',\n hint: 'The SDK might not work correctly',\n value: true,\n },\n { label: \"No, I'll upgrade first\", value: false },\n ],\n }),\n );\n if (!shouldContinue) {\n await abort('Exiting Wizard', 0);\n return;\n }\n }\n\n let setupForSvelteKitTracing = kitVersionBucket === '>=2.31.0';\n\n if (kitVersionBucket !== '>=2.31.0') {\n clack.log.warn(\n `It seems you're using a SvelteKit version ${chalk.cyan(\n '<2.31.0',\n )} (detected ${chalk.cyan(kitVersion ?? 'unknown')}). \n\nWe recommend upgrading SvelteKit to version ${chalk.cyan(\n '>=2.31.0',\n )} to use SvelteKit's builtin observability:\n${chalk.cyan('https://svelte.dev/docs/kit/observability')}\n\nSentry works best with SvelteKit versions ${chalk.cyan('>=2.31.0')}.\n\nIf you prefer, you can stay on your current version and use the Sentry SDK \nwithout SvelteKit's builtin observability.`,\n );\n\n const decision = await abortIfCancelled(\n clack.select({\n message: 'Do you want to continue anyway?',\n options: [\n {\n label: \"No, I'll upgrade SvelteKit first\",\n hint: 'Recommended',\n value: 'exit-to-upgrade',\n },\n {\n label: \"I'm already on SvelteKit >=2.31.0\",\n hint: 'Sorry, my bad!',\n value: 'install-with-kit-tracing',\n },\n {\n label: 'Yes, continue',\n hint: 'No Problem!',\n value: 'install-without-kit-tracing',\n },\n ],\n }),\n );\n\n if (decision === 'install-with-kit-tracing') {\n setupForSvelteKitTracing = true;\n }\n\n if (decision === 'exit-to-upgrade') {\n await abort('Exiting Wizard', 0);\n return;\n }\n }\n\n Sentry.setTag(\n 'svelte-version',\n getSvelteVersionBucket(getPackageVersion('svelte', packageJson)),\n );\n\n const projectData = await getOrAskForProjectData(\n options,\n 'javascript-sveltekit',\n );\n\n if (projectData.spotlight) {\n clack.log.warn('Spotlight mode is not yet supported for SvelteKit.');\n clack.log.info('Spotlight is currently only available for Next.js.');\n await abort('Exiting wizard', 0);\n return;\n }\n\n const { selectedProject, selfHosted, sentryUrl, authToken } = projectData;\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/sveltekit',\n packageJson,\n );\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n await installPackage({\n packageName: '@sentry/sveltekit@^10',\n packageNameDisplayLabel: '@sentry/sveltekit',\n alreadyInstalled: sdkAlreadyInstalled,\n forceInstall,\n });\n\n await addDotEnvSentryBuildPluginFile(authToken);\n\n const svelteConfig = await traceStep('load-svelte-config', loadSvelteConfig);\n\n try {\n await traceStep('configure-sdk', () =>\n createOrMergeSvelteKitFiles(\n {\n dsn: selectedProject.keys[0].dsn.public,\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n selfHosted,\n url: sentryUrl,\n },\n svelteConfig,\n setupForSvelteKitTracing,\n ),\n );\n } catch (e: unknown) {\n clack.log.error('Error while setting up the SvelteKit SDK:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n Sentry.captureException('Error while setting up the SvelteKit SDK');\n await abort('Exiting Wizard');\n return;\n }\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage(\n '/sentry-example-page',\n );\n\n if (shouldCreateExamplePage) {\n try {\n await traceStep('create-example-page', () =>\n createExamplePage(svelteConfig, {\n selfHosted,\n url: sentryUrl,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n }),\n );\n } catch (e: unknown) {\n clack.log.error('Error while creating an example page to test Sentry:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n Sentry.captureException(\n 'Error while creating an example Svelte page to test Sentry',\n );\n await abort('Exiting Wizard');\n return;\n }\n }\n\n await runPrettierIfInstalled({ cwd: undefined });\n\n // Offer optional project-scoped MCP config for Sentry with org and project scope\n await offerProjectScopedMcpConfig(\n selectedProject.organization.slug,\n selectedProject.slug,\n );\n\n clack.outro(await buildOutroMessage(shouldCreateExamplePage));\n}\n\nasync function buildOutroMessage(\n shouldCreateExamplePage: boolean,\n): Promise<string> {\n const packageManager = await getPackageManager(NPM);\n\n let msg = chalk.green('Successfully installed the Sentry SvelteKit SDK!');\n\n if (shouldCreateExamplePage) {\n msg += `\\n\\nYou can validate your setup by starting your dev environment (${chalk.cyan(\n `\\`${packageManager.runScriptCommand} dev\\``,\n )}) and visiting ${chalk.cyan('\"/sentry-example-page\"')}.`;\n }\n\n msg += `\\n\\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/javascript/guides/sveltekit/`;\n\n return msg;\n}\n"]}
@@ -86,4 +86,34 @@ export declare function printJsonC(ast: t.Program): string;
86
86
  * @returns index of the last `const foo = require('bar');` statement or -1 if none was found.
87
87
  */
88
88
  export declare function getLastRequireIndex(program: t.Program): number;
89
+ /**
90
+ * Safely checks if a callee is an identifier with the given name
91
+ * Prevents crashes when accessing callee.name on non-identifier nodes
92
+ */
93
+ export declare function safeCalleeIdentifierMatch(callee: any, name: string): boolean;
94
+ /**
95
+ * Safely gets the name of an identifier node
96
+ * Returns null if the node is not an identifier or is undefined
97
+ */
98
+ export declare function safeGetIdentifierName(node: any): string | null;
99
+ /**
100
+ * Safely access function body array with proper validation
101
+ * Prevents crashes when accessing body.body on nodes that don't have a body
102
+ */
103
+ export declare function safeGetFunctionBody(node: any): t.Statement[] | null;
104
+ /**
105
+ * Safely insert statement before last statement in function body
106
+ * Typically used to insert code before a return statement
107
+ * Returns true if insertion was successful, false otherwise
108
+ */
109
+ export declare function safeInsertBeforeReturn(body: t.Statement[], statement: t.Statement): boolean;
110
+ /**
111
+ * Finds a property in an ObjectExpression by name.
112
+ * Commonly used for traversing Vite/React Router config objects.
113
+ *
114
+ * @param configObj - The ObjectExpression to search
115
+ * @param name - The property name to find
116
+ * @returns The matching ObjectProperty, or undefined if not found
117
+ */
118
+ export declare function findProperty(configObj: t.ObjectExpression, name: string): t.ObjectProperty | undefined;
89
119
  export {};
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getLastRequireIndex = exports.printJsonC = exports.parseJsonC = exports.setOrUpdateObjectProperty = exports.getOrSetObjectProperty = exports.getObjectProperty = exports.hasSentryContent = exports.findFile = void 0;
26
+ exports.findProperty = exports.safeInsertBeforeReturn = exports.safeGetFunctionBody = exports.safeGetIdentifierName = exports.safeCalleeIdentifierMatch = exports.getLastRequireIndex = exports.printJsonC = exports.parseJsonC = exports.setOrUpdateObjectProperty = exports.getOrSetObjectProperty = exports.getObjectProperty = exports.hasSentryContent = exports.findFile = void 0;
27
27
  const fs = __importStar(require("fs"));
28
28
  const recast = __importStar(require("recast"));
29
29
  const b = recast.types.builders;
@@ -215,4 +215,74 @@ function getLastRequireIndex(program) {
215
215
  return lastRequireIdex;
216
216
  }
217
217
  exports.getLastRequireIndex = getLastRequireIndex;
218
+ /**
219
+ * Safely checks if a callee is an identifier with the given name
220
+ * Prevents crashes when accessing callee.name on non-identifier nodes
221
+ */
222
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
223
+ function safeCalleeIdentifierMatch(callee, name) {
224
+ return Boolean(callee &&
225
+ typeof callee === 'object' &&
226
+ 'type' in callee &&
227
+ callee.type === 'Identifier' &&
228
+ 'name' in callee &&
229
+ callee.name === name);
230
+ }
231
+ exports.safeCalleeIdentifierMatch = safeCalleeIdentifierMatch;
232
+ /**
233
+ * Safely gets the name of an identifier node
234
+ * Returns null if the node is not an identifier or is undefined
235
+ */
236
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
237
+ function safeGetIdentifierName(node) {
238
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
239
+ return node && node.type === 'Identifier' ? String(node.name) : null;
240
+ }
241
+ exports.safeGetIdentifierName = safeGetIdentifierName;
242
+ /**
243
+ * Safely access function body array with proper validation
244
+ * Prevents crashes when accessing body.body on nodes that don't have a body
245
+ */
246
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
247
+ function safeGetFunctionBody(node) {
248
+ if (!node || typeof node !== 'object' || !('body' in node)) {
249
+ return null;
250
+ }
251
+ const nodeBody = node.body;
252
+ if (!nodeBody || typeof nodeBody !== 'object' || !('body' in nodeBody)) {
253
+ return null;
254
+ }
255
+ const bodyArray = nodeBody.body;
256
+ return Array.isArray(bodyArray) ? bodyArray : null;
257
+ }
258
+ exports.safeGetFunctionBody = safeGetFunctionBody;
259
+ /**
260
+ * Safely insert statement before last statement in function body
261
+ * Typically used to insert code before a return statement
262
+ * Returns true if insertion was successful, false otherwise
263
+ */
264
+ function safeInsertBeforeReturn(body, statement) {
265
+ if (!body || !Array.isArray(body) || body.length === 0) {
266
+ return false;
267
+ }
268
+ // Insert before the last statement (typically a return statement)
269
+ const insertIndex = Math.max(0, body.length - 1);
270
+ body.splice(insertIndex, 0, statement);
271
+ return true;
272
+ }
273
+ exports.safeInsertBeforeReturn = safeInsertBeforeReturn;
274
+ /**
275
+ * Finds a property in an ObjectExpression by name.
276
+ * Commonly used for traversing Vite/React Router config objects.
277
+ *
278
+ * @param configObj - The ObjectExpression to search
279
+ * @param name - The property name to find
280
+ * @returns The matching ObjectProperty, or undefined if not found
281
+ */
282
+ function findProperty(configObj, name) {
283
+ return configObj.properties.find((p) => p.type === 'ObjectProperty' &&
284
+ p.key.type === 'Identifier' &&
285
+ p.key.name === name); // Safe: predicate guarantees type
286
+ }
287
+ exports.findProperty = findProperty;
218
288
  //# sourceMappingURL=ast-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ast-utils.js","sourceRoot":"","sources":["../../../src/utils/ast-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,+CAAiC;AAIjC,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;AAEhC;;;GAGG;AACH,S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AAE,CAAC;AACnD,CAAC;AApBD,gCAoBC;AAED;;;;;;;;;GASG;AACH,SAAgB,UAAU,CAAC,GAAc;IACvC,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;IAClC,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACxC,CAAC;AAHD,gCAGC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,OAAkB;IACpD,IAAI,eAAe,GAAG,CAAC,CAAC,CAAC;IACzB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAC5B,IACE,CAAC,CAAC,IAAI,KAAK,qBAAqB;YAChC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,oBAAoB;YAC/C,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI;YAC/B,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW;YAC7C,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,gBAAgB;YAChD,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY;YACnD,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,EAChD;YACA,eAAe,GAAG,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;IACH,OAAO,eAAe,CAAC;AACzB,CAAC;AAhBD,kDAgBC","sourcesContent":["import * as fs from 'fs';\n\nimport * as recast from 'recast';\nimport x = recast.types;\nimport t = x.namedTypes;\n\nconst b = recast.types.builders;\n\n/**\n * Checks if a file where we don't know its concrete file type yet exists\n * and returns the full path to the file with the correct file type.\n */\nexport function findFile(\n filePath: string,\n fileTypes: string[] = ['.js', '.ts', '.mjs', '.cjs'],\n): string | undefined {\n return fileTypes\n .map((type) => `${filePath}${type}`)\n .find((file) => fs.existsSync(file));\n}\n\n/**\n * checks for require('@sentry/*') syntax\n */\nexport function hasSentryContent(program: t.Program): boolean {\n let foundSentry: boolean | undefined = false;\n recast.visit(program, {\n visitStringLiteral(path) {\n foundSentry = foundSentry || path.node.value.startsWith('@sentry/');\n this.traverse(path);\n },\n visitLiteral(path) {\n foundSentry =\n foundSentry || path.node.value?.toString().startsWith('@sentry/');\n this.traverse(path);\n },\n });\n\n return !!foundSentry;\n}\n\n/**\n * Searches for a property of an ObjectExpression by name\n *\n * @param object the ObjectExpression to search in\n * @param name the name of the property to search for\n *\n * @returns the property if it exists\n */\nexport function getObjectProperty(\n object: t.ObjectExpression,\n name: string,\n): t.Property | undefined {\n return object.properties.find((p): p is t.Property => {\n const isObjectProp = p.type === 'Property' || p.type === 'ObjectProperty';\n\n if (!isObjectProp) {\n return false;\n }\n\n const hasMatchingLiteralKey =\n isObjectProp &&\n (p.key.type === 'Literal' || p.key.type === 'StringLiteral') &&\n p.key.value === name;\n\n if (hasMatchingLiteralKey) {\n return true;\n }\n\n // has matching identifier key\n return isObjectProp && p.key.type === 'Identifier' && p.key.name === name;\n });\n}\n\n/**\n * Attempts to find a property of an ObjectExpression by name. If it doesn't exist,\n * the property will be added to the ObjectExpression with the provided default value.\n *\n * @param object the parent object expression to search in\n * @param name the name of the property to search for\n * @param defaultValue the default value to set if the property doesn't exist\n *\n * @returns the\n */\nexport function getOrSetObjectProperty(\n object: t.ObjectExpression,\n name: string,\n defaultValue:\n | t.Literal\n | t.BooleanLiteral\n | t.StringLiteral\n | t.ObjectExpression,\n): t.Property {\n const existingProperty = getObjectProperty(object, name);\n\n if (existingProperty) {\n return existingProperty;\n }\n\n const newProperty = b.property.from({\n kind: 'init',\n key: b.stringLiteral(name),\n value: defaultValue,\n });\n\n object.properties.push(newProperty);\n\n return newProperty;\n}\n\n/**\n * Sets a property of an ObjectExpression if it exists, otherwise adds it\n * to the ObjectExpression. Optionally, a comment can be added to the\n * property.\n *\n * @param object the ObjectExpression to set the property on\n * @param name the name of the property to set\n * @param value the value of the property to set\n * @param comment (optional) a comment to add to the property\n */\nexport function setOrUpdateObjectProperty(\n object: t.ObjectExpression,\n name: string,\n value: t.Literal | t.BooleanLiteral | t.StringLiteral | t.ObjectExpression,\n comment?: string,\n) {\n const newComments =\n comment &&\n comment.split('\\n').map((c) => b.commentLine(` ${c}`, true, false));\n\n const existingProperty = getObjectProperty(object, name);\n\n if (existingProperty) {\n existingProperty.value = value;\n if (newComments) {\n existingProperty.comments = [\n ...(existingProperty?.comments || []),\n ...newComments,\n ];\n }\n } else {\n object.properties.push(\n b.objectProperty.from({\n key: b.stringLiteral(name),\n value,\n ...(newComments && {\n comments: newComments,\n }),\n }),\n );\n }\n}\n\ntype JsonCParseResult =\n | {\n jsonObject: t.ObjectExpression;\n ast: t.Program;\n }\n | {\n jsonObject: undefined;\n ast: undefined;\n };\n\n/**\n * Parses a JSON string with (potential) comments (JSON-C) and returns the JS AST\n * that can be walked and modified with recast like a normal JS AST.\n *\n * This is done by wrapping the JSON-C string in parentheses, thereby making it\n * a JS `Program` with an `ExpressionStatement` as its body. The expression is then\n * extracted from the AST and returned alongside the AST.\n *\n * To preserve as much original formatting as possible, the returned `ast`\n * property should be passed to {@link `printJsonC`} to get the JSON-C string back.\n *\n * If the input is not valid JSON-C, the result will be undefined.\n *\n * @see {@link JsonCParseResult}\n *\n * @param jsonString a JSON-C string\n *\n * @returns a {@link JsonCParseResult}, containing either the JSON-C object and the AST or undefined in both cases\n */\nexport function parseJsonC(jsonString: string): JsonCParseResult {\n try {\n const jsTsConfig = `(${jsonString})`;\n // no idea why recast returns any here, this is dumb :/\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const ast = recast.parse(jsTsConfig.toString()).program as t.Program;\n\n const jsonObject =\n (ast.body[0].type === 'ExpressionStatement' &&\n ast.body[0].expression.type === 'ObjectExpression' &&\n ast.body[0].expression) ||\n undefined;\n\n if (jsonObject) {\n return { jsonObject, ast };\n }\n } catch {\n /* empty */\n }\n return { jsonObject: undefined, ast: undefined };\n}\n\n/**\n * Takes the AST of a parsed JSON-C \"program\" and returns the JSON-C string without\n * any of the temporary JS wrapper code that was previously applied.\n *\n * Only use this in conjunction with {@link `parseJsonC`}\n *\n * @param ast the `ast` returned from {@link `parseJsonC`}\n *\n * @returns the JSON-C string\n */\nexport function printJsonC(ast: t.Program): string {\n const js = recast.print(ast).code;\n return js.substring(1, js.length - 1);\n}\n\n/**\n * Walks the program body and returns index of the last variable assignment initialized by require statement.\n * Only counts top level require statements.\n *\n * @returns index of the last `const foo = require('bar');` statement or -1 if none was found.\n */\nexport function getLastRequireIndex(program: t.Program): number {\n let lastRequireIdex = -1;\n program.body.forEach((s, i) => {\n if (\n s.type === 'VariableDeclaration' &&\n s.declarations[0].type === 'VariableDeclarator' &&\n s.declarations[0].init !== null &&\n typeof s.declarations[0].init !== 'undefined' &&\n s.declarations[0].init.type === 'CallExpression' &&\n s.declarations[0].init.callee.type === 'Identifier' &&\n s.declarations[0].init.callee.name === 'require'\n ) {\n lastRequireIdex = i;\n }\n });\n return lastRequireIdex;\n}\n"]}
1
+ {"version":3,"file":"ast-utils.js","sourceRoot":"","sources":["../../../src/utils/ast-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,+CAAiC;AAIjC,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;AAEhC;;;GAGG;AACH,SAAgB,QAAQ,CACtB,QAAgB,EAChB,YAAsB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;IAEpD,OAAO,SAAS;SACb,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,QAAQ,GAAG,IAAI,EAAE,CAAC;SACnC,I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B,IAAY;IAEZ,OAAO,SAAS,CAAC,UAAU,CAAC,IAAI,CAC9B,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,IAAI,KAAK,gBAAgB;QAC3B,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;QAC3B,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CACU,CAAC,CAAC,kCAAkC;AACvE,CAAC;AAVD,oCAUC","sourcesContent":["import * as fs from 'fs';\n\nimport * as recast from 'recast';\nimport x = recast.types;\nimport t = x.namedTypes;\n\nconst b = recast.types.builders;\n\n/**\n * Checks if a file where we don't know its concrete file type yet exists\n * and returns the full path to the file with the correct file type.\n */\nexport function findFile(\n filePath: string,\n fileTypes: string[] = ['.js', '.ts', '.mjs', '.cjs'],\n): string | undefined {\n return fileTypes\n .map((type) => `${filePath}${type}`)\n .find((file) => fs.existsSync(file));\n}\n\n/**\n * checks for require('@sentry/*') syntax\n */\nexport function hasSentryContent(program: t.Program): boolean {\n let foundSentry: boolean | undefined = false;\n recast.visit(program, {\n visitStringLiteral(path) {\n foundSentry = foundSentry || path.node.value.startsWith('@sentry/');\n this.traverse(path);\n },\n visitLiteral(path) {\n foundSentry =\n foundSentry || path.node.value?.toString().startsWith('@sentry/');\n this.traverse(path);\n },\n });\n\n return !!foundSentry;\n}\n\n/**\n * Searches for a property of an ObjectExpression by name\n *\n * @param object the ObjectExpression to search in\n * @param name the name of the property to search for\n *\n * @returns the property if it exists\n */\nexport function getObjectProperty(\n object: t.ObjectExpression,\n name: string,\n): t.Property | undefined {\n return object.properties.find((p): p is t.Property => {\n const isObjectProp = p.type === 'Property' || p.type === 'ObjectProperty';\n\n if (!isObjectProp) {\n return false;\n }\n\n const hasMatchingLiteralKey =\n isObjectProp &&\n (p.key.type === 'Literal' || p.key.type === 'StringLiteral') &&\n p.key.value === name;\n\n if (hasMatchingLiteralKey) {\n return true;\n }\n\n // has matching identifier key\n return isObjectProp && p.key.type === 'Identifier' && p.key.name === name;\n });\n}\n\n/**\n * Attempts to find a property of an ObjectExpression by name. If it doesn't exist,\n * the property will be added to the ObjectExpression with the provided default value.\n *\n * @param object the parent object expression to search in\n * @param name the name of the property to search for\n * @param defaultValue the default value to set if the property doesn't exist\n *\n * @returns the\n */\nexport function getOrSetObjectProperty(\n object: t.ObjectExpression,\n name: string,\n defaultValue:\n | t.Literal\n | t.BooleanLiteral\n | t.StringLiteral\n | t.ObjectExpression,\n): t.Property {\n const existingProperty = getObjectProperty(object, name);\n\n if (existingProperty) {\n return existingProperty;\n }\n\n const newProperty = b.property.from({\n kind: 'init',\n key: b.stringLiteral(name),\n value: defaultValue,\n });\n\n object.properties.push(newProperty);\n\n return newProperty;\n}\n\n/**\n * Sets a property of an ObjectExpression if it exists, otherwise adds it\n * to the ObjectExpression. Optionally, a comment can be added to the\n * property.\n *\n * @param object the ObjectExpression to set the property on\n * @param name the name of the property to set\n * @param value the value of the property to set\n * @param comment (optional) a comment to add to the property\n */\nexport function setOrUpdateObjectProperty(\n object: t.ObjectExpression,\n name: string,\n value: t.Literal | t.BooleanLiteral | t.StringLiteral | t.ObjectExpression,\n comment?: string,\n) {\n const newComments =\n comment &&\n comment.split('\\n').map((c) => b.commentLine(` ${c}`, true, false));\n\n const existingProperty = getObjectProperty(object, name);\n\n if (existingProperty) {\n existingProperty.value = value;\n if (newComments) {\n existingProperty.comments = [\n ...(existingProperty?.comments || []),\n ...newComments,\n ];\n }\n } else {\n object.properties.push(\n b.objectProperty.from({\n key: b.stringLiteral(name),\n value,\n ...(newComments && {\n comments: newComments,\n }),\n }),\n );\n }\n}\n\ntype JsonCParseResult =\n | {\n jsonObject: t.ObjectExpression;\n ast: t.Program;\n }\n | {\n jsonObject: undefined;\n ast: undefined;\n };\n\n/**\n * Parses a JSON string with (potential) comments (JSON-C) and returns the JS AST\n * that can be walked and modified with recast like a normal JS AST.\n *\n * This is done by wrapping the JSON-C string in parentheses, thereby making it\n * a JS `Program` with an `ExpressionStatement` as its body. The expression is then\n * extracted from the AST and returned alongside the AST.\n *\n * To preserve as much original formatting as possible, the returned `ast`\n * property should be passed to {@link `printJsonC`} to get the JSON-C string back.\n *\n * If the input is not valid JSON-C, the result will be undefined.\n *\n * @see {@link JsonCParseResult}\n *\n * @param jsonString a JSON-C string\n *\n * @returns a {@link JsonCParseResult}, containing either the JSON-C object and the AST or undefined in both cases\n */\nexport function parseJsonC(jsonString: string): JsonCParseResult {\n try {\n const jsTsConfig = `(${jsonString})`;\n // no idea why recast returns any here, this is dumb :/\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const ast = recast.parse(jsTsConfig.toString()).program as t.Program;\n\n const jsonObject =\n (ast.body[0].type === 'ExpressionStatement' &&\n ast.body[0].expression.type === 'ObjectExpression' &&\n ast.body[0].expression) ||\n undefined;\n\n if (jsonObject) {\n return { jsonObject, ast };\n }\n } catch {\n /* empty */\n }\n return { jsonObject: undefined, ast: undefined };\n}\n\n/**\n * Takes the AST of a parsed JSON-C \"program\" and returns the JSON-C string without\n * any of the temporary JS wrapper code that was previously applied.\n *\n * Only use this in conjunction with {@link `parseJsonC`}\n *\n * @param ast the `ast` returned from {@link `parseJsonC`}\n *\n * @returns the JSON-C string\n */\nexport function printJsonC(ast: t.Program): string {\n const js = recast.print(ast).code;\n return js.substring(1, js.length - 1);\n}\n\n/**\n * Walks the program body and returns index of the last variable assignment initialized by require statement.\n * Only counts top level require statements.\n *\n * @returns index of the last `const foo = require('bar');` statement or -1 if none was found.\n */\nexport function getLastRequireIndex(program: t.Program): number {\n let lastRequireIdex = -1;\n program.body.forEach((s, i) => {\n if (\n s.type === 'VariableDeclaration' &&\n s.declarations[0].type === 'VariableDeclarator' &&\n s.declarations[0].init !== null &&\n typeof s.declarations[0].init !== 'undefined' &&\n s.declarations[0].init.type === 'CallExpression' &&\n s.declarations[0].init.callee.type === 'Identifier' &&\n s.declarations[0].init.callee.name === 'require'\n ) {\n lastRequireIdex = i;\n }\n });\n return lastRequireIdex;\n}\n\n/**\n * Safely checks if a callee is an identifier with the given name\n * Prevents crashes when accessing callee.name on non-identifier nodes\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function safeCalleeIdentifierMatch(callee: any, name: string): boolean {\n return Boolean(\n callee &&\n typeof callee === 'object' &&\n 'type' in callee &&\n (callee as { type: string }).type === 'Identifier' &&\n 'name' in callee &&\n (callee as { name: string }).name === name,\n );\n}\n\n/**\n * Safely gets the name of an identifier node\n * Returns null if the node is not an identifier or is undefined\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function safeGetIdentifierName(node: any): string | null {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return node && node.type === 'Identifier' ? String(node.name) : null;\n}\n\n/**\n * Safely access function body array with proper validation\n * Prevents crashes when accessing body.body on nodes that don't have a body\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function safeGetFunctionBody(node: any): t.Statement[] | null {\n if (!node || typeof node !== 'object' || !('body' in node)) {\n return null;\n }\n\n const nodeBody = (node as { body: unknown }).body;\n if (!nodeBody || typeof nodeBody !== 'object' || !('body' in nodeBody)) {\n return null;\n }\n\n const bodyArray = (nodeBody as { body: unknown }).body;\n return Array.isArray(bodyArray) ? (bodyArray as t.Statement[]) : null;\n}\n\n/**\n * Safely insert statement before last statement in function body\n * Typically used to insert code before a return statement\n * Returns true if insertion was successful, false otherwise\n */\nexport function safeInsertBeforeReturn(\n body: t.Statement[],\n statement: t.Statement,\n): boolean {\n if (!body || !Array.isArray(body) || body.length === 0) {\n return false;\n }\n\n // Insert before the last statement (typically a return statement)\n const insertIndex = Math.max(0, body.length - 1);\n body.splice(insertIndex, 0, statement);\n return true;\n}\n\n/**\n * Finds a property in an ObjectExpression by name.\n * Commonly used for traversing Vite/React Router config objects.\n *\n * @param configObj - The ObjectExpression to search\n * @param name - The property name to find\n * @returns The matching ObjectProperty, or undefined if not found\n */\nexport function findProperty(\n configObj: t.ObjectExpression,\n name: string,\n): t.ObjectProperty | undefined {\n return configObj.properties.find(\n (p) =>\n p.type === 'ObjectProperty' &&\n p.key.type === 'Identifier' &&\n p.key.name === name,\n ) as t.ObjectProperty | undefined; // Safe: predicate guarantees type\n}\n"]}
@@ -137,11 +137,14 @@ export declare function isUsingTypeScript(): boolean;
137
137
  * @param platform the platform of the wizard
138
138
  * @returns project data (org, project, token, url)
139
139
  */
140
- export declare function getOrAskForProjectData(options: WizardOptions, platform?: 'javascript-angular' | 'javascript-nextjs' | 'javascript-nuxt' | 'javascript-remix' | 'javascript-sveltekit' | 'apple-ios' | 'android' | 'react-native' | 'flutter'): Promise<{
140
+ export declare function getOrAskForProjectData(options: WizardOptions, platform?: 'javascript-angular' | 'javascript-nextjs' | 'javascript-nuxt' | 'javascript-react-router' | 'javascript-remix' | 'javascript-sveltekit' | 'apple-ios' | 'android' | 'react-native' | 'flutter'): Promise<{
141
141
  sentryUrl: string;
142
142
  selfHosted: boolean;
143
143
  selectedProject: SentryProjectData;
144
144
  authToken: string;
145
+ spotlight: false;
146
+ } | {
147
+ spotlight: true;
145
148
  }>;
146
149
  /**
147
150
  * Exported for testing
@@ -149,7 +152,7 @@ export declare function getOrAskForProjectData(options: WizardOptions, platform?
149
152
  export declare function askForWizardLogin(options: {
150
153
  url: string;
151
154
  promoCode?: string;
152
- platform?: 'javascript-angular' | 'javascript-nextjs' | 'javascript-nuxt' | 'javascript-remix' | 'javascript-sveltekit' | 'apple-ios' | 'android' | 'react-native' | 'flutter';
155
+ platform?: 'javascript-angular' | 'javascript-nextjs' | 'javascript-nuxt' | 'javascript-react-router' | 'javascript-remix' | 'javascript-sveltekit' | 'apple-ios' | 'android' | 'react-native' | 'flutter';
153
156
  orgSlug?: string;
154
157
  projectSlug?: string;
155
158
  comingFrom?: string;
@@ -116,7 +116,9 @@ async function abort(message, status) {
116
116
  sentrySession.status = status === 0 ? 'abnormal' : 'crashed';
117
117
  sentryHub.captureSession(true);
118
118
  }
119
- await Sentry.flush(3000);
119
+ await Sentry.flush(3000).catch(() => {
120
+ // Ignore flush errors during abort
121
+ });
120
122
  return process.exit(status ?? 1);
121
123
  }
122
124
  exports.abort = abort;
@@ -128,7 +130,9 @@ async function abortIfCancelled(input) {
128
130
  sentryTransaction?.setStatus('cancelled');
129
131
  sentryTransaction?.finish();
130
132
  sentryHub.captureSession(true);
131
- await Sentry.flush(3000);
133
+ await Sentry.flush(3000).catch(() => {
134
+ // Ignore flush errors during abort
135
+ });
132
136
  process.exit(0);
133
137
  }
134
138
  else {
@@ -629,12 +633,19 @@ exports.isUsingTypeScript = isUsingTypeScript;
629
633
  * @returns project data (org, project, token, url)
630
634
  */
631
635
  async function getOrAskForProjectData(options, platform) {
636
+ // Spotlight mode: Skip authentication and use local development setup
637
+ if (options.spotlight) {
638
+ clack.log.info(`Spotlight mode enabled! Setting up for local development without Sentry account needed.\n
639
+ Note: Your app will only send data to the local Spotlight debugger, not to Sentry.`);
640
+ return { spotlight: true };
641
+ }
632
642
  if (options.preSelectedProject) {
633
643
  return {
634
644
  selfHosted: options.preSelectedProject.selfHosted,
635
645
  sentryUrl: options.url ?? SAAS_URL,
636
646
  authToken: options.preSelectedProject.authToken,
637
647
  selectedProject: options.preSelectedProject.project,
648
+ spotlight: false,
638
649
  };
639
650
  }
640
651
  const { url: sentryUrl, selfHosted } = await (0, telemetry_1.traceStep)('ask-self-hosted', () => askForSelfHosted(options.url, options.saas));
@@ -671,6 +682,7 @@ ${chalk_1.default.cyan(selfHosted
671
682
  selfHosted,
672
683
  authToken: apiKeys?.token || DUMMY_AUTH_TOKEN,
673
684
  selectedProject,
685
+ spotlight: false,
674
686
  };
675
687
  }
676
688
  exports.getOrAskForProjectData = getOrAskForProjectData;