@sentry/wizard 6.6.1 → 6.8.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 (122) 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/pnpm-workspace.test.d.ts +1 -0
  10. package/dist/e2e-tests/tests/pnpm-workspace.test.js +206 -0
  11. package/dist/e2e-tests/tests/pnpm-workspace.test.js.map +1 -0
  12. package/dist/e2e-tests/tests/react-router.test.d.ts +1 -0
  13. package/dist/e2e-tests/tests/react-router.test.js +255 -0
  14. package/dist/e2e-tests/tests/react-router.test.js.map +1 -0
  15. package/dist/e2e-tests/utils/index.d.ts +8 -2
  16. package/dist/e2e-tests/utils/index.js +72 -21
  17. package/dist/e2e-tests/utils/index.js.map +1 -1
  18. package/dist/lib/Constants.d.ts +1 -0
  19. package/dist/lib/Constants.js +5 -0
  20. package/dist/lib/Constants.js.map +1 -1
  21. package/dist/src/android/android-wizard.js +8 -1
  22. package/dist/src/android/android-wizard.js.map +1 -1
  23. package/dist/src/angular/angular-wizard.js +8 -1
  24. package/dist/src/angular/angular-wizard.js.map +1 -1
  25. package/dist/src/apple/apple-wizard.js +8 -1
  26. package/dist/src/apple/apple-wizard.js.map +1 -1
  27. package/dist/src/flutter/flutter-wizard.js +8 -1
  28. package/dist/src/flutter/flutter-wizard.js.map +1 -1
  29. package/dist/src/nextjs/nextjs-wizard.js +35 -9
  30. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  31. package/dist/src/nextjs/templates.d.ts +3 -3
  32. package/dist/src/nextjs/templates.js +18 -7
  33. package/dist/src/nextjs/templates.js.map +1 -1
  34. package/dist/src/nuxt/nuxt-wizard.js +8 -1
  35. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  36. package/dist/src/react-native/react-native-wizard.js +8 -1
  37. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  38. package/dist/src/react-router/codemods/client.entry.d.ts +1 -0
  39. package/dist/src/react-router/codemods/client.entry.js +73 -0
  40. package/dist/src/react-router/codemods/client.entry.js.map +1 -0
  41. package/dist/src/react-router/codemods/react-router-config.d.ts +9 -0
  42. package/dist/src/react-router/codemods/react-router-config.js +178 -0
  43. package/dist/src/react-router/codemods/react-router-config.js.map +1 -0
  44. package/dist/src/react-router/codemods/root.d.ts +1 -0
  45. package/dist/src/react-router/codemods/root.js +171 -0
  46. package/dist/src/react-router/codemods/root.js.map +1 -0
  47. package/dist/src/react-router/codemods/routes-config.d.ts +1 -0
  48. package/dist/src/react-router/codemods/routes-config.js +106 -0
  49. package/dist/src/react-router/codemods/routes-config.js.map +1 -0
  50. package/dist/src/react-router/codemods/server-entry.d.ts +4 -0
  51. package/dist/src/react-router/codemods/server-entry.js +275 -0
  52. package/dist/src/react-router/codemods/server-entry.js.map +1 -0
  53. package/dist/src/react-router/codemods/utils.d.ts +2 -0
  54. package/dist/src/react-router/codemods/utils.js +13 -0
  55. package/dist/src/react-router/codemods/utils.js.map +1 -0
  56. package/dist/src/react-router/codemods/vite.d.ts +8 -0
  57. package/dist/src/react-router/codemods/vite.js +169 -0
  58. package/dist/src/react-router/codemods/vite.js.map +1 -0
  59. package/dist/src/react-router/react-router-wizard.d.ts +2 -0
  60. package/dist/src/react-router/react-router-wizard.js +254 -0
  61. package/dist/src/react-router/react-router-wizard.js.map +1 -0
  62. package/dist/src/react-router/sdk-example.d.ts +18 -0
  63. package/dist/src/react-router/sdk-example.js +306 -0
  64. package/dist/src/react-router/sdk-example.js.map +1 -0
  65. package/dist/src/react-router/sdk-setup.d.ts +17 -0
  66. package/dist/src/react-router/sdk-setup.js +250 -0
  67. package/dist/src/react-router/sdk-setup.js.map +1 -0
  68. package/dist/src/react-router/templates.d.ts +11 -0
  69. package/dist/src/react-router/templates.js +273 -0
  70. package/dist/src/react-router/templates.js.map +1 -0
  71. package/dist/src/remix/remix-wizard.js +8 -1
  72. package/dist/src/remix/remix-wizard.js.map +1 -1
  73. package/dist/src/run.d.ts +2 -1
  74. package/dist/src/run.js +6 -0
  75. package/dist/src/run.js.map +1 -1
  76. package/dist/src/sourcemaps/sourcemaps-wizard.js +8 -1
  77. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  78. package/dist/src/sveltekit/sveltekit-wizard.js +8 -1
  79. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  80. package/dist/src/utils/ast-utils.d.ts +30 -0
  81. package/dist/src/utils/ast-utils.js +71 -1
  82. package/dist/src/utils/ast-utils.js.map +1 -1
  83. package/dist/src/utils/clack/index.d.ts +5 -2
  84. package/dist/src/utils/clack/index.js +8 -0
  85. package/dist/src/utils/clack/index.js.map +1 -1
  86. package/dist/src/utils/package-json.js +86 -2
  87. package/dist/src/utils/package-json.js.map +1 -1
  88. package/dist/src/utils/types.d.ts +9 -0
  89. package/dist/src/utils/types.js.map +1 -1
  90. package/dist/src/version.d.ts +1 -1
  91. package/dist/src/version.js +1 -1
  92. package/dist/src/version.js.map +1 -1
  93. package/dist/test/nextjs/templates.test.js +20 -0
  94. package/dist/test/nextjs/templates.test.js.map +1 -1
  95. package/dist/test/react-router/codemods/client-entry.test.d.ts +1 -0
  96. package/dist/test/react-router/codemods/client-entry.test.js +168 -0
  97. package/dist/test/react-router/codemods/client-entry.test.js.map +1 -0
  98. package/dist/test/react-router/codemods/react-router-config.test.d.ts +1 -0
  99. package/dist/test/react-router/codemods/react-router-config.test.js +168 -0
  100. package/dist/test/react-router/codemods/react-router-config.test.js.map +1 -0
  101. package/dist/test/react-router/codemods/root.test.d.ts +1 -0
  102. package/dist/test/react-router/codemods/root.test.js +178 -0
  103. package/dist/test/react-router/codemods/root.test.js.map +1 -0
  104. package/dist/test/react-router/codemods/server-entry.test.d.ts +1 -0
  105. package/dist/test/react-router/codemods/server-entry.test.js +415 -0
  106. package/dist/test/react-router/codemods/server-entry.test.js.map +1 -0
  107. package/dist/test/react-router/codemods/vite.test.d.ts +1 -0
  108. package/dist/test/react-router/codemods/vite.test.js +158 -0
  109. package/dist/test/react-router/codemods/vite.test.js.map +1 -0
  110. package/dist/test/react-router/routes-config.test.d.ts +1 -0
  111. package/dist/test/react-router/routes-config.test.js +156 -0
  112. package/dist/test/react-router/routes-config.test.js.map +1 -0
  113. package/dist/test/react-router/sdk-setup.test.d.ts +1 -0
  114. package/dist/test/react-router/sdk-setup.test.js +411 -0
  115. package/dist/test/react-router/sdk-setup.test.js.map +1 -0
  116. package/dist/test/react-router/templates.test.d.ts +1 -0
  117. package/dist/test/react-router/templates.test.js +220 -0
  118. package/dist/test/react-router/templates.test.js.map +1 -0
  119. package/dist/test/utils/package-json.test.d.ts +1 -0
  120. package/dist/test/utils/package-json.test.js +428 -0
  121. package/dist/test/utils/package-json.test.js.map +1 -0
  122. package/package.json +4 -2
@@ -1 +1 @@
1
- {"version":3,"file":"package-json.js","sourceRoot":"","sources":["../../../src/utils/package-json.ts"],"names":[],"mappings":";;;AAiBA;;;;;GAKG;AACH,SAAgB,4BAA4B,CAC1C,gBAA0B,EAC1B,WAA2B;IAE3B,OAAO,gBAAgB;SACpB,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACrB,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC;KACrD,CAAC,CAAC;SACF,IAAI,CAAC,CAAC,UAAU,EAA4B,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAC1E,CAAC;AAVD,oEAUC;AAED,SAAgB,mBAAmB,CACjC,WAAmB,EACnB,WAA2B;IAE3B,OAAO,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC,KAAK,SAAS,CAAC;AACnE,CAAC;AALD,kDAKC;AAED,SAAgB,iBAAiB,CAC/B,WAAmB,EACnB,WAA2B;IAE3B,OAAO,CACL,WAAW,EAAE,YAAY,EAAE,CAAC,WAAW,CAAC;QACxC,WAAW,EAAE,eAAe,EAAE,CAAC,WAAW,CAAC,CAC5C,CAAC;AACJ,CAAC;AARD,8CAQC","sourcesContent":["export type PackageDotJson = {\n version?: string;\n scripts?: Record<string, string | undefined>;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n resolutions?: Record<string, string>;\n overrides?: Record<string, string>;\n pnpm?: {\n overrides?: Record<string, string>;\n };\n};\n\ntype NpmPackage = {\n name: string;\n version: string;\n};\n\n/**\n * Checks if @param packageJson has any of the @param packageNamesList package names\n * listed as a dependency or devDependency.\n * If so, it returns the first package name that is found, including the\n * version (range) specified in the package.json.\n */\nexport function findInstalledPackageFromList(\n packageNamesList: string[],\n packageJson: PackageDotJson,\n): NpmPackage | undefined {\n return packageNamesList\n .map((packageName) => ({\n name: packageName,\n version: getPackageVersion(packageName, packageJson),\n }))\n .find((sdkPackage): sdkPackage is NpmPackage => !!sdkPackage.version);\n}\n\nexport function hasPackageInstalled(\n packageName: string,\n packageJson: PackageDotJson,\n): boolean {\n return getPackageVersion(packageName, packageJson) !== undefined;\n}\n\nexport function getPackageVersion(\n packageName: string,\n packageJson: PackageDotJson,\n): string | undefined {\n return (\n packageJson?.dependencies?.[packageName] ||\n packageJson?.devDependencies?.[packageName]\n );\n}\n"]}
1
+ {"version":3,"file":"package-json.js","sourceRoot":"","sources":["../../../src/utils/package-json.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,sDAAwC;AACxC,uCAAyB;AACzB,2CAA6B;AAC7B,sDAA2B;AA2B3B;;;;GAIG;AACH,SAAS,gBAAgB;IACvB,IAAI,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;I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,OAAO,OAAO,EAAE,CAAC,WAAW,CAAC,CAAC;AAChC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,4BAA4B,CAC1C,gBAA0B,EAC1B,WAA2B;IAE3B,OAAO,gBAAgB;SACpB,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACrB,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC;KACrD,CAAC,CAAC;SACF,IAAI,CAAC,CAAC,UAAU,EAA4B,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAC1E,CAAC;AAVD,oEAUC;AAED,SAAgB,mBAAmB,CACjC,WAAmB,EACnB,WAA2B;IAE3B,OAAO,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC,KAAK,SAAS,CAAC;AACnE,CAAC;AALD,kDAKC;AAED,SAAgB,iBAAiB,CAC/B,WAAmB,EACnB,WAA2B;IAE3B,MAAM,UAAU,GACd,WAAW,EAAE,YAAY,EAAE,CAAC,WAAW,CAAC;QACxC,WAAW,EAAE,eAAe,EAAE,CAAC,WAAW,CAAC,CAAC;IAE9C,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC;QAC/C,CAAC,CAAC,qBAAqB,CAAC,UAAU,EAAE,WAAW,CAAC;QAChD,CAAC,CAAC,UAAU,CAAC;IAEf,OAAO,OAAO,CAAC;AACjB,CAAC;AAjBD,8CAiBC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport yaml from 'js-yaml';\n\nexport type PackageDotJson = {\n version?: string;\n scripts?: Record<string, string | undefined>;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n resolutions?: Record<string, string>;\n overrides?: Record<string, string>;\n pnpm?: {\n overrides?: Record<string, string>;\n };\n};\n\ntype NpmPackage = {\n name: string;\n version: string;\n};\n\ntype PnpmCatalogs = Record<string, Record<string, string>>;\n\ntype PnpmWorkspace = {\n catalog?: Record<string, string>;\n catalogs?: PnpmCatalogs;\n [key: string]: unknown;\n};\n\n/**\n * Finds and parses the pnpm-workspace.yaml file to extract catalog definitions.\n * Searches up to 10 parent directories from the current working directory.\n * Returns null if the file doesn't exist or can't be parsed.\n */\nfunction getPnpmWorkspace(): PnpmWorkspace | null {\n let currentDir = process.cwd();\n const maxLevels = 10;\n\n for (let i = 0; i < maxLevels; i++) {\n const workspaceFile = path.join(currentDir, 'pnpm-workspace.yaml');\n\n if (fs.existsSync(workspaceFile)) {\n const content = fs.readFileSync(workspaceFile, 'utf-8');\n\n try {\n const parsed = yaml.load(content) as PnpmWorkspace;\n\n return parsed ?? null;\n } catch {\n clack.log.error('Could not parse pnpm-workspace.yaml.');\n return null;\n }\n }\n\n const parentDir = path.dirname(currentDir);\n\n // Stop if we've reached the root directory\n if (parentDir === currentDir) {\n break;\n }\n\n currentDir = parentDir;\n }\n\n clack.log.error('Could not find pnpm-workspace.yaml.');\n\n return null;\n}\n\n/**\n * Resolves a catalog reference (e.g., \"catalog:\" or \"catalog:sveltekit\") to the actual version.\n * - \"catalog:\" refers to the default catalog (workspace.catalog)\n * - \"catalog:customcatalog\" refers to a named catalog (workspace.catalogs.customcatalog)\n * Returns the actual version if found, or undefined if the catalog or package doesn't exist.\n */\nfunction resolveCatalogVersion(\n catalogRef: string,\n packageName: string,\n): string | undefined {\n const catalogName = catalogRef.replace(/^catalog:/, '');\n const workspace = getPnpmWorkspace();\n\n if (!workspace) {\n return undefined;\n }\n\n const catalog =\n catalogName === '' ? workspace.catalog : workspace.catalogs?.[catalogName];\n\n return catalog?.[packageName];\n}\n\n/**\n * Checks if @param packageJson has any of the @param packageNamesList package names\n * listed as a dependency or devDependency.\n * If so, it returns the first package name that is found, including the\n * version (range) specified in the package.json.\n */\nexport function findInstalledPackageFromList(\n packageNamesList: string[],\n packageJson: PackageDotJson,\n): NpmPackage | undefined {\n return packageNamesList\n .map((packageName) => ({\n name: packageName,\n version: getPackageVersion(packageName, packageJson),\n }))\n .find((sdkPackage): sdkPackage is NpmPackage => !!sdkPackage.version);\n}\n\nexport function hasPackageInstalled(\n packageName: string,\n packageJson: PackageDotJson,\n): boolean {\n return getPackageVersion(packageName, packageJson) !== undefined;\n}\n\nexport function getPackageVersion(\n packageName: string,\n packageJson: PackageDotJson,\n): string | undefined {\n const rawVersion =\n packageJson?.dependencies?.[packageName] ||\n packageJson?.devDependencies?.[packageName];\n\n if (!rawVersion) {\n return undefined;\n }\n\n const version = rawVersion.startsWith('catalog:')\n ? resolveCatalogVersion(rawVersion, packageName)\n : rawVersion;\n\n return version;\n}\n"]}
@@ -72,6 +72,15 @@ export type WizardOptions = {
72
72
  * If this is set, the wizard will ignore any git changes in the project and not prompt for confirmation.
73
73
  */
74
74
  ignoreGitChanges?: boolean;
75
+ /**
76
+ * Enable Spotlight mode for local development without Sentry authentication.
77
+ * When enabled:
78
+ * - Skips login and project selection
79
+ * - Uses empty DSN
80
+ * - Skips auth token file creation
81
+ * This can be passed via the `--spotlight` arg.
82
+ */
83
+ spotlight?: boolean;
75
84
  };
76
85
  export interface Feature {
77
86
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface SentryProjectData {\n id: string;\n slug: string;\n organization: {\n id: string;\n name: string;\n slug: string;\n };\n keys: [{ dsn: { public: string } }];\n}\n\nexport type PreselectedProject = {\n project: SentryProjectData;\n authToken: string;\n selfHosted: boolean;\n};\n\nexport type WizardOptions = {\n /**\n * Controls whether the wizard should send telemetry data to Sentry.\n */\n telemetryEnabled: boolean;\n\n /**\n * The promo code to use while signing up for Sentry.\n * This can be passed via the --promo-code arg.\n */\n promoCode?: string;\n\n /**\n * The url of the Sentry instance to use.\n * This can be passed via the `-u` or `--url` arg.\n */\n url?: string;\n\n /**\n * The org to pre-select in the wizard.\n * This can be passed via the `--org` arg.\n * Example: `--org my-org`\n */\n orgSlug?: string;\n\n /**\n * Project slug to pre-select in the wizard.\n * This can be passed via the `--project` arg.\n * Example: `--project my-project`\n */\n projectSlug?: string;\n\n /**\n * If this option is set, the wizard will skip the self-hosted or SaaS\n * selection step and directly assume that the wizard is used for Sentry SaaS.\n */\n saas?: boolean;\n\n /**\n * If this is set, the wizard will skip the login and project selection step.\n */\n preSelectedProject?: PreselectedProject;\n\n /**\n * Force-install the SDK package to continue with the installation in case\n * any package manager checks are failing (e.g. peer dependency versions).\n *\n * Use with caution and only if you know what you're doing.\n *\n * Does not apply to all wizard flows (currently NPM only)\n */\n forceInstall?: boolean;\n\n /**\n * Used when the wizard command is copied from partner sites (e.g. Vercel)\n * to display login/signup instructions specific to organizations provisioned\n * through the partner.\n */\n comingFrom?: string;\n\n /**\n * If this is set, the wizard will ignore any git changes in the project and not prompt for confirmation.\n */\n ignoreGitChanges?: boolean;\n};\n\nexport interface Feature {\n id: string;\n prompt: string;\n enabledHint?: string;\n disabledHint?: string;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface SentryProjectData {\n id: string;\n slug: string;\n organization: {\n id: string;\n name: string;\n slug: string;\n };\n keys: [{ dsn: { public: string } }];\n}\n\nexport type PreselectedProject = {\n project: SentryProjectData;\n authToken: string;\n selfHosted: boolean;\n};\n\nexport type WizardOptions = {\n /**\n * Controls whether the wizard should send telemetry data to Sentry.\n */\n telemetryEnabled: boolean;\n\n /**\n * The promo code to use while signing up for Sentry.\n * This can be passed via the --promo-code arg.\n */\n promoCode?: string;\n\n /**\n * The url of the Sentry instance to use.\n * This can be passed via the `-u` or `--url` arg.\n */\n url?: string;\n\n /**\n * The org to pre-select in the wizard.\n * This can be passed via the `--org` arg.\n * Example: `--org my-org`\n */\n orgSlug?: string;\n\n /**\n * Project slug to pre-select in the wizard.\n * This can be passed via the `--project` arg.\n * Example: `--project my-project`\n */\n projectSlug?: string;\n\n /**\n * If this option is set, the wizard will skip the self-hosted or SaaS\n * selection step and directly assume that the wizard is used for Sentry SaaS.\n */\n saas?: boolean;\n\n /**\n * If this is set, the wizard will skip the login and project selection step.\n */\n preSelectedProject?: PreselectedProject;\n\n /**\n * Force-install the SDK package to continue with the installation in case\n * any package manager checks are failing (e.g. peer dependency versions).\n *\n * Use with caution and only if you know what you're doing.\n *\n * Does not apply to all wizard flows (currently NPM only)\n */\n forceInstall?: boolean;\n\n /**\n * Used when the wizard command is copied from partner sites (e.g. Vercel)\n * to display login/signup instructions specific to organizations provisioned\n * through the partner.\n */\n comingFrom?: string;\n\n /**\n * If this is set, the wizard will ignore any git changes in the project and not prompt for confirmation.\n */\n ignoreGitChanges?: boolean;\n\n /**\n * Enable Spotlight mode for local development without Sentry authentication.\n * When enabled:\n * - Skips login and project selection\n * - Uses empty DSN\n * - Skips auth token file creation\n * This can be passed via the `--spotlight` arg.\n */\n spotlight?: boolean;\n};\n\nexport interface Feature {\n id: string;\n prompt: string;\n enabledHint?: string;\n disabledHint?: string;\n}\n"]}
@@ -1 +1 @@
1
- export declare const WIZARD_VERSION = "6.6.1";
1
+ export declare const WIZARD_VERSION = "6.8.0";
@@ -3,5 +3,5 @@
3
3
  // This is file is updated at release time.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.WIZARD_VERSION = void 0;
6
- exports.WIZARD_VERSION = '6.6.1';
6
+ exports.WIZARD_VERSION = '6.8.0';
7
7
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA,oCAAoC;AACpC,2CAA2C;;;AAE9B,QAAA,cAAc,GAAG,OAAO,CAAC","sourcesContent":["// DO NOT modify this file manually!\n// This is file is updated at release time.\n\nexport const WIZARD_VERSION = '6.6.1';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA,oCAAoC;AACpC,2CAA2C;;;AAE9B,QAAA,cAAc,GAAG,OAAO,CAAC","sourcesContent":["// DO NOT modify this file manually!\n// This is file is updated at release time.\n\nexport const WIZARD_VERSION = '6.8.0';\n"]}
@@ -154,6 +154,16 @@ const templates_1 = require("../../src/nextjs/templates");
154
154
  export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;"
155
155
  `);
156
156
  });
157
+ (0, vitest_1.it)('uses empty DSN in spotlight mode', () => {
158
+ const template = (0, templates_1.getInstrumentationClientFileContents)('', {
159
+ performance: true,
160
+ replay: false,
161
+ logs: false,
162
+ }, true);
163
+ // Verify DSN is empty for spotlight
164
+ (0, vitest_1.expect)(template).toContain('dsn: ""');
165
+ (0, vitest_1.expect)(template).toContain('spotlight: true');
166
+ });
157
167
  });
158
168
  (0, vitest_1.describe)('getSentryServersideConfigContents', () => {
159
169
  (0, vitest_1.describe)('server-side', () => {
@@ -267,6 +277,16 @@ const templates_1 = require("../../src/nextjs/templates");
267
277
  "
268
278
  `);
269
279
  });
280
+ (0, vitest_1.it)('uses empty DSN in spotlight mode', () => {
281
+ const template = (0, templates_1.getSentryServersideConfigContents)('', 'server', {
282
+ performance: true,
283
+ replay: false,
284
+ logs: false,
285
+ }, true);
286
+ // Verify DSN is empty for spotlight
287
+ (0, vitest_1.expect)(template).toContain('dsn: ""');
288
+ (0, vitest_1.expect)(template).toContain('spotlight: true');
289
+ });
270
290
  });
271
291
  (0, vitest_1.describe)('edge', () => {
272
292
  (0, vitest_1.it)('generates edge Sentry config with all features enabled', () => {
@@ -1 +1 @@
1
- {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/nextjs/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,0DAUoC;AAEpC,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,iBAAQ,E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AAM,QAAQ,GAAG,IAAA,0CAA8B,EAAC;gBAC9C,YAAY,EAAE,KAAK;aACpB,CAAC,CAAC;YAEH,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;YACnD,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,2CAA2C,CAAC,CAAC;YACxE,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;YACpD,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n getRootLayout,\n getSentryServersideConfigContents,\n getInstrumentationClientFileContents,\n getWithSentryConfigOptionsTemplate,\n getGenerateMetadataSnippet,\n getRootLayoutWithGenerateMetadata,\n getSentryExamplePageContents,\n getSentryExamplePagesDirApiRoute,\n getSentryExampleAppDirApiRoute,\n} from '../../src/nextjs/templates';\n\ndescribe('Next.js code templates', () => {\n describe('getInstrumentationClientFileContents', () => {\n it('generates client-side Sentry config with all features enabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with performance monitoring disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: false,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with session replay disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: false,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with logs disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: true,\n logs: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n });\n\n describe('getSentryServersideConfigContents', () => {\n describe('server-side', () => {\n it('generates server-side Sentry config with all features enabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with performance monitoring disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: false,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with spotlight disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with logs disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n logs: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n \"\n `);\n });\n });\n\n describe('edge', () => {\n it('generates edge Sentry config with all features enabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n \"\n `);\n });\n\n it('generates edge Sentry config with performance monitoring disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: false,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n \"\n `);\n });\n\n it('generates edge Sentry config with logs disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: true,\n replay: true,\n logs: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n \"\n `);\n });\n });\n });\n\n describe('getWithSentryConfigOptionsTemplate', () => {\n it('generates options for SaaS', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('generates options for self-hosted', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: true,\n sentryUrl: 'https://my-sentry.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n sentryUrl: \"https://my-sentry.com\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('comments out tunnelRoute if `tunnelRoute` option is disabled', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n // tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n });\n\n describe('getRootLayout', () => {\n it('generates a root layout component with types', () => {\n expect(getRootLayout(true)).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n // You can delete this file at any time.\n\n export const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n }\n\n export default function RootLayout({\n children,\n }: {\n children: React.ReactNode\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n it('generates a root layout component without types', () => {\n expect(getRootLayout(false)).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n // You can delete this file at any time.\n\n export const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n }\n\n export default function RootLayout({\n children,\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n });\n\n describe('getGenerateMetadataSnippet', () => {\n it('generates metadata snippet with TypeScript types', () => {\n const template = getGenerateMetadataSnippet(true);\n\n expect(template).toMatchInlineSnapshot(`\n\"\n import * as Sentry from '@sentry/nextjs';\n import type { Metadata } from 'next';\n\n // Add or edit your \"generateMetadata\" to include the Sentry trace data:\n export function generateMetadata(): Metadata {\n return {\n // ... your existing metadata\n other: {\n ...Sentry.getTraceData()\n }\n };\n }\n\"\n`);\n });\n\n it('generates metadata snippet without TypeScript types', () => {\n const template = getGenerateMetadataSnippet(false);\n\n expect(template).toMatchInlineSnapshot(`\n\"\n import * as Sentry from '@sentry/nextjs';\n \n\n // Add or edit your \"generateMetadata\" to include the Sentry trace data:\n export function generateMetadata() {\n return {\n // ... your existing metadata\n other: {\n ...Sentry.getTraceData()\n }\n };\n }\n\"\n `);\n });\n });\n\n describe('getRootLayoutWithGenerateMetadata', () => {\n it('generates root layout with TypeScript types', () => {\n const template = getRootLayoutWithGenerateMetadata(true);\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n import * as Sentry from '@sentry/nextjs';\n import type { Metadata } from 'next';\n\n export function generateMetadata(): Metadata {\n return {\n other: {\n ...Sentry.getTraceData(),\n }\n }\n };\n\n export default function RootLayout({\n children,\n }: {\n children: React.ReactNode\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n\n it('generates root layout without TypeScript types', () => {\n const template = getRootLayoutWithGenerateMetadata(false);\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n import * as Sentry from '@sentry/nextjs';\n\n \n export function generateMetadata() {\n return {\n other: {\n ...Sentry.getTraceData(),\n }\n }\n };\n\n export default function RootLayout({\n children,\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n });\n\n describe('getSentryExamplePageContents', () => {\n it('generates example page with TypeScript types', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: true,\n isTypeScript: true,\n });\n\n expect(template).toContain('\"use client\";');\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain(\n 'class SentryExampleFrontendError extends Error',\n );\n });\n\n it('generates example page without TypeScript types', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: true,\n isTypeScript: false,\n });\n\n expect(template).toContain('\"use client\";');\n expect(template).toContain('constructor(message)');\n expect(template).toContain(\n 'class SentryExampleFrontendError extends Error',\n );\n });\n\n it('generates example page without useClient directive', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: false,\n isTypeScript: true,\n });\n\n expect(template).not.toContain('\"use client\";');\n expect(template).toContain(\n 'https://my-org.sentry.io/issues/?project=123',\n );\n });\n });\n\n describe('getSentryExamplePagesDirApiRoute', () => {\n it('generates Pages Router API route with TypeScript types', () => {\n const template = getSentryExamplePagesDirApiRoute({\n isTypeScript: true,\n });\n\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export default function handler(_req, res)');\n });\n\n it('generates Pages Router API route without TypeScript types', () => {\n const template = getSentryExamplePagesDirApiRoute({\n isTypeScript: false,\n });\n\n expect(template).toContain('constructor(message)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export default function handler(_req, res)');\n });\n });\n\n describe('getSentryExampleAppDirApiRoute', () => {\n it('generates App Router API route with TypeScript types', () => {\n const template = getSentryExampleAppDirApiRoute({\n isTypeScript: true,\n });\n\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export function GET()');\n expect(template).toContain('export const dynamic = \"force-dynamic\";');\n });\n\n it('generates App Router API route without TypeScript types', () => {\n const template = getSentryExampleAppDirApiRoute({\n isTypeScript: false,\n });\n\n expect(template).toContain('constructor(message)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export function GET()');\n expect(template).toContain('export const dynamic = \"force-dynamic\";');\n });\n });\n});\n"]}
1
+ {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/nextjs/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,0DAUoC;AAEpC,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,iBAAQ,EAAC,sCAAsC,EAAE,GAAG,EAAE;QACpD,IAAA,WAAE,EAAC,+DAA+D,EAAE,GAAG,EAAE;YACvE,MAAM,QAAQ,GAAG,IAAA,gDAAoC,EAAC,QAAQ,EAAE;gBAC9D,WAAW,EAAE,IAAI;gBACjB,MAAM,EAAE,IAAI;gBACZ,IAAI,EAAE,IAAI;aACX,CAAC,CAAC;YAEH,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,0EAA0E,EAAE,GAAG,EAAE;YAClF,MAAM,QAAQ,GAAG,IAAA,gDAAoC,EAAC,QAAQ,EAAE;gBAC9D,WAAW,EAAE,KAAK;gBAClB,MAAM,EAAE,IAAI;gBACZ,IAAI,EAAE,IAAI;aACX,CAAC,CAAC;YAEH,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,kEAAkE,EAAE,GAAG,EAAE;YAC1E,MAAM,QAAQ,GAAG,IAAA,gDAAoC,EAAC,QAAQ,EAAE;gBAC9D,WAAW,EAAE,IAAI;gBACjB,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,IAAI;aACX,CAAC,CAAC;YAEH,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;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M,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,2CAA2C,CAAC,CAAC;YACxE,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;YACpD,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n getRootLayout,\n getSentryServersideConfigContents,\n getInstrumentationClientFileContents,\n getWithSentryConfigOptionsTemplate,\n getGenerateMetadataSnippet,\n getRootLayoutWithGenerateMetadata,\n getSentryExamplePageContents,\n getSentryExamplePagesDirApiRoute,\n getSentryExampleAppDirApiRoute,\n} from '../../src/nextjs/templates';\n\ndescribe('Next.js code templates', () => {\n describe('getInstrumentationClientFileContents', () => {\n it('generates client-side Sentry config with all features enabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with performance monitoring disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: false,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with session replay disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: false,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n\n it('generates client-side Sentry config with logs disabled', () => {\n const template = getInstrumentationClientFileContents('my-dsn', {\n performance: true,\n replay: true,\n logs: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the client.\n // The added config here will be used whenever a users loads a page in their browser.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Define how likely Replay events are sampled.\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;\"\n `);\n });\n it('uses empty DSN in spotlight mode', () => {\n const template = getInstrumentationClientFileContents(\n '',\n {\n performance: true,\n replay: false,\n logs: false,\n },\n true, // spotlight\n );\n\n // Verify DSN is empty for spotlight\n expect(template).toContain('dsn: \"\"');\n expect(template).toContain('spotlight: true');\n });\n });\n\n describe('getSentryServersideConfigContents', () => {\n describe('server-side', () => {\n it('generates server-side Sentry config with all features enabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with performance monitoring disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: false,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with spotlight disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n \"\n `);\n });\n\n it('generates server-side Sentry config with logs disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'server', {\n performance: true,\n replay: true,\n logs: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry on the server.\n // The config you add here will be used whenever the server handles a request.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n \"\n `);\n });\n\n it('uses empty DSN in spotlight mode', () => {\n const template = getSentryServersideConfigContents(\n '',\n 'server',\n {\n performance: true,\n replay: false,\n logs: false,\n },\n true, // spotlight\n );\n\n // Verify DSN is empty for spotlight\n expect(template).toContain('dsn: \"\"');\n expect(template).toContain('spotlight: true');\n });\n });\n\n describe('edge', () => {\n it('generates edge Sentry config with all features enabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n \"\n `);\n });\n\n it('generates edge Sentry config with performance monitoring disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: false,\n replay: true,\n logs: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n \"\n `);\n });\n\n it('generates edge Sentry config with logs disabled', () => {\n const template = getSentryServersideConfigContents('my-dsn', 'edge', {\n performance: true,\n replay: true,\n logs: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n // The config you add here will be used whenever one of the edge features is loaded.\n // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/\n\n import * as Sentry from \"@sentry/nextjs\";\n\n Sentry.init({\n dsn: \"my-dsn\",\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n \"\n `);\n });\n });\n });\n\n describe('getWithSentryConfigOptionsTemplate', () => {\n it('generates options for SaaS', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('generates options for self-hosted', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: true,\n sentryUrl: 'https://my-sentry.com',\n tunnelRoute: true,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n sentryUrl: \"https://my-sentry.com\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n\n it('comments out tunnelRoute if `tunnelRoute` option is disabled', () => {\n const template = getWithSentryConfigOptionsTemplate({\n orgSlug: 'my-org',\n projectSlug: 'my-project',\n selfHosted: false,\n sentryUrl: 'https://dont-use-this-url.com',\n tunnelRoute: false,\n });\n\n expect(template).toMatchInlineSnapshot(`\n \"{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"my-org\",\n project: \"my-project\",\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n // tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }\"\n `);\n });\n });\n\n describe('getRootLayout', () => {\n it('generates a root layout component with types', () => {\n expect(getRootLayout(true)).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n // You can delete this file at any time.\n\n export const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n }\n\n export default function RootLayout({\n children,\n }: {\n children: React.ReactNode\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n it('generates a root layout component without types', () => {\n expect(getRootLayout(false)).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n // You can delete this file at any time.\n\n export const metadata = {\n title: 'Sentry NextJS Example',\n description: 'Generated by Sentry',\n }\n\n export default function RootLayout({\n children,\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n });\n\n describe('getGenerateMetadataSnippet', () => {\n it('generates metadata snippet with TypeScript types', () => {\n const template = getGenerateMetadataSnippet(true);\n\n expect(template).toMatchInlineSnapshot(`\n\"\n import * as Sentry from '@sentry/nextjs';\n import type { Metadata } from 'next';\n\n // Add or edit your \"generateMetadata\" to include the Sentry trace data:\n export function generateMetadata(): Metadata {\n return {\n // ... your existing metadata\n other: {\n ...Sentry.getTraceData()\n }\n };\n }\n\"\n`);\n });\n\n it('generates metadata snippet without TypeScript types', () => {\n const template = getGenerateMetadataSnippet(false);\n\n expect(template).toMatchInlineSnapshot(`\n\"\n import * as Sentry from '@sentry/nextjs';\n \n\n // Add or edit your \"generateMetadata\" to include the Sentry trace data:\n export function generateMetadata() {\n return {\n // ... your existing metadata\n other: {\n ...Sentry.getTraceData()\n }\n };\n }\n\"\n `);\n });\n });\n\n describe('getRootLayoutWithGenerateMetadata', () => {\n it('generates root layout with TypeScript types', () => {\n const template = getRootLayoutWithGenerateMetadata(true);\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n import * as Sentry from '@sentry/nextjs';\n import type { Metadata } from 'next';\n\n export function generateMetadata(): Metadata {\n return {\n other: {\n ...Sentry.getTraceData(),\n }\n }\n };\n\n export default function RootLayout({\n children,\n }: {\n children: React.ReactNode\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n\n it('generates root layout without TypeScript types', () => {\n const template = getRootLayoutWithGenerateMetadata(false);\n\n expect(template).toMatchInlineSnapshot(`\n \"// This file was generated by the Sentry wizard because we couldn't find a root layout file.\n import * as Sentry from '@sentry/nextjs';\n\n \n export function generateMetadata() {\n return {\n other: {\n ...Sentry.getTraceData(),\n }\n }\n };\n\n export default function RootLayout({\n children,\n }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n )\n }\n \"\n `);\n });\n });\n\n describe('getSentryExamplePageContents', () => {\n it('generates example page with TypeScript types', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: true,\n isTypeScript: true,\n });\n\n expect(template).toContain('\"use client\";');\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain(\n 'class SentryExampleFrontendError extends Error',\n );\n });\n\n it('generates example page without TypeScript types', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: true,\n isTypeScript: false,\n });\n\n expect(template).toContain('\"use client\";');\n expect(template).toContain('constructor(message)');\n expect(template).toContain(\n 'class SentryExampleFrontendError extends Error',\n );\n });\n\n it('generates example page without useClient directive', () => {\n const template = getSentryExamplePageContents({\n selfHosted: false,\n sentryUrl: 'https://sentry.io',\n orgSlug: 'my-org',\n projectId: '123',\n useClient: false,\n isTypeScript: true,\n });\n\n expect(template).not.toContain('\"use client\";');\n expect(template).toContain(\n 'https://my-org.sentry.io/issues/?project=123',\n );\n });\n });\n\n describe('getSentryExamplePagesDirApiRoute', () => {\n it('generates Pages Router API route with TypeScript types', () => {\n const template = getSentryExamplePagesDirApiRoute({\n isTypeScript: true,\n });\n\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export default function handler(_req, res)');\n });\n\n it('generates Pages Router API route without TypeScript types', () => {\n const template = getSentryExamplePagesDirApiRoute({\n isTypeScript: false,\n });\n\n expect(template).toContain('constructor(message)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export default function handler(_req, res)');\n });\n });\n\n describe('getSentryExampleAppDirApiRoute', () => {\n it('generates App Router API route with TypeScript types', () => {\n const template = getSentryExampleAppDirApiRoute({\n isTypeScript: true,\n });\n\n expect(template).toContain('constructor(message: string | undefined)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export function GET()');\n expect(template).toContain('export const dynamic = \"force-dynamic\";');\n });\n\n it('generates App Router API route without TypeScript types', () => {\n const template = getSentryExampleAppDirApiRoute({\n isTypeScript: false,\n });\n\n expect(template).toContain('constructor(message)');\n expect(template).toContain('class SentryExampleAPIError extends Error');\n expect(template).toContain('export function GET()');\n expect(template).toContain('export const dynamic = \"force-dynamic\";');\n });\n });\n});\n"]}
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const vitest_1 = require("vitest");
27
+ const fs = __importStar(require("fs"));
28
+ const path = __importStar(require("path"));
29
+ const client_entry_1 = require("../../../src/react-router/codemods/client.entry");
30
+ vitest_1.vi.mock('@clack/prompts', () => {
31
+ const mock = {
32
+ log: {
33
+ warn: vitest_1.vi.fn(),
34
+ info: vitest_1.vi.fn(),
35
+ success: vitest_1.vi.fn(),
36
+ },
37
+ };
38
+ return {
39
+ default: mock,
40
+ ...mock,
41
+ };
42
+ });
43
+ (0, vitest_1.describe)('instrumentClientEntry', () => {
44
+ const fixturesDir = path.join(__dirname, 'fixtures', 'client-entry');
45
+ let tmpDir;
46
+ let tmpFile;
47
+ (0, vitest_1.beforeEach)(() => {
48
+ vitest_1.vi.clearAllMocks();
49
+ // Create unique tmp directory for each test
50
+ tmpDir = path.join(fixturesDir, 'tmp', `test-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`);
51
+ tmpFile = path.join(tmpDir, 'entry.client.tsx');
52
+ // Ensure tmp directory exists
53
+ fs.mkdirSync(tmpDir, { recursive: true });
54
+ });
55
+ (0, vitest_1.afterEach)(() => {
56
+ // Clean up tmp directory
57
+ if (fs.existsSync(tmpDir)) {
58
+ fs.rmSync(tmpDir, { recursive: true });
59
+ }
60
+ });
61
+ (0, vitest_1.it)('should add Sentry import and initialization with all features enabled', async () => {
62
+ const basicContent = fs.readFileSync(path.join(fixturesDir, 'basic.tsx'), 'utf8');
63
+ fs.writeFileSync(tmpFile, basicContent);
64
+ await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', true, true, true);
65
+ const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
66
+ (0, vitest_1.expect)(modifiedContent).toContain('import * as Sentry from "@sentry/react-router";');
67
+ (0, vitest_1.expect)(modifiedContent).toContain('Sentry.init({');
68
+ (0, vitest_1.expect)(modifiedContent).toContain('dsn: "test-dsn"');
69
+ (0, vitest_1.expect)(modifiedContent).toContain('integrations: [');
70
+ (0, vitest_1.expect)(modifiedContent).toContain('Sentry.reactRouterTracingIntegration()');
71
+ (0, vitest_1.expect)(modifiedContent).toContain('Sentry.replayIntegration(');
72
+ (0, vitest_1.expect)(modifiedContent).toContain('enableLogs: true');
73
+ });
74
+ (0, vitest_1.it)('should add Sentry initialization with only tracing enabled', async () => {
75
+ const basicContent = fs.readFileSync(path.join(fixturesDir, 'basic.tsx'), 'utf8');
76
+ fs.writeFileSync(tmpFile, basicContent);
77
+ await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', true, false, false);
78
+ const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
79
+ (0, vitest_1.expect)(modifiedContent).toContain('import * as Sentry from "@sentry/react-router";');
80
+ (0, vitest_1.expect)(modifiedContent).toContain('Sentry.init({');
81
+ (0, vitest_1.expect)(modifiedContent).toContain('dsn: "test-dsn"');
82
+ (0, vitest_1.expect)(modifiedContent).toContain('integrations: [');
83
+ (0, vitest_1.expect)(modifiedContent).toContain('Sentry.reactRouterTracingIntegration()');
84
+ (0, vitest_1.expect)(modifiedContent).not.toContain('Sentry.replayIntegration()');
85
+ (0, vitest_1.expect)(modifiedContent).not.toContain('enableLogs: true');
86
+ });
87
+ (0, vitest_1.it)('should add Sentry initialization with only replay enabled', async () => {
88
+ const basicContent = fs.readFileSync(path.join(fixturesDir, 'basic.tsx'), 'utf8');
89
+ fs.writeFileSync(tmpFile, basicContent);
90
+ await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', false, true, false);
91
+ const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
92
+ (0, vitest_1.expect)(modifiedContent).toContain('import * as Sentry from "@sentry/react-router";');
93
+ (0, vitest_1.expect)(modifiedContent).toContain('Sentry.init({');
94
+ (0, vitest_1.expect)(modifiedContent).toContain('dsn: "test-dsn"');
95
+ (0, vitest_1.expect)(modifiedContent).toContain('integrations: [');
96
+ (0, vitest_1.expect)(modifiedContent).not.toContain('Sentry.reactRouterTracingIntegration()');
97
+ (0, vitest_1.expect)(modifiedContent).toContain('Sentry.replayIntegration(');
98
+ (0, vitest_1.expect)(modifiedContent).not.toContain('enableLogs: true');
99
+ });
100
+ (0, vitest_1.it)('should add Sentry initialization with only logs enabled', async () => {
101
+ const basicContent = fs.readFileSync(path.join(fixturesDir, 'basic.tsx'), 'utf8');
102
+ fs.writeFileSync(tmpFile, basicContent);
103
+ await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', false, false, true);
104
+ const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
105
+ (0, vitest_1.expect)(modifiedContent).toContain('import * as Sentry from "@sentry/react-router";');
106
+ (0, vitest_1.expect)(modifiedContent).toContain('Sentry.init({');
107
+ (0, vitest_1.expect)(modifiedContent).toContain('dsn: "test-dsn"');
108
+ (0, vitest_1.expect)(modifiedContent).toContain('integrations: [');
109
+ (0, vitest_1.expect)(modifiedContent).not.toContain('Sentry.reactRouterTracingIntegration()');
110
+ (0, vitest_1.expect)(modifiedContent).not.toContain('Sentry.replayIntegration()');
111
+ (0, vitest_1.expect)(modifiedContent).toContain('enableLogs: true');
112
+ });
113
+ (0, vitest_1.it)('should add minimal Sentry initialization when all features are disabled', async () => {
114
+ const basicContent = fs.readFileSync(path.join(fixturesDir, 'basic.tsx'), 'utf8');
115
+ fs.writeFileSync(tmpFile, basicContent);
116
+ await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', false, false, false);
117
+ const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
118
+ (0, vitest_1.expect)(modifiedContent).toContain('import * as Sentry from "@sentry/react-router";');
119
+ (0, vitest_1.expect)(modifiedContent).toContain('Sentry.init({');
120
+ (0, vitest_1.expect)(modifiedContent).toContain('dsn: "test-dsn"');
121
+ (0, vitest_1.expect)(modifiedContent).toContain('integrations: []');
122
+ (0, vitest_1.expect)(modifiedContent).not.toContain('Sentry.reactRouterTracingIntegration()');
123
+ (0, vitest_1.expect)(modifiedContent).not.toContain('Sentry.replayIntegration()');
124
+ (0, vitest_1.expect)(modifiedContent).not.toContain('enableLogs: true');
125
+ });
126
+ (0, vitest_1.it)('should not modify file when Sentry content already exists', async () => {
127
+ const withSentryContent = fs.readFileSync(path.join(fixturesDir, 'with-sentry.tsx'), 'utf8');
128
+ fs.writeFileSync(tmpFile, withSentryContent);
129
+ await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', true, true, true);
130
+ const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
131
+ // Content should remain unchanged
132
+ (0, vitest_1.expect)(modifiedContent).toBe(withSentryContent);
133
+ });
134
+ (0, vitest_1.it)('should insert Sentry initialization after imports', async () => {
135
+ const withImportsContent = fs.readFileSync(path.join(fixturesDir, 'with-imports.tsx'), 'utf8');
136
+ fs.writeFileSync(tmpFile, withImportsContent);
137
+ await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', true, false, false);
138
+ const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
139
+ (0, vitest_1.expect)(modifiedContent).toContain('import * as Sentry from "@sentry/react-router";');
140
+ (0, vitest_1.expect)(modifiedContent).toContain('Sentry.init({');
141
+ // Check that the Sentry import is before the init call
142
+ const sentryImportIndex = modifiedContent.indexOf('import * as Sentry from "@sentry/react-router";');
143
+ const sentryInitIndex = modifiedContent.indexOf('Sentry.init({');
144
+ (0, vitest_1.expect)(sentryImportIndex).toBeLessThan(sentryInitIndex);
145
+ });
146
+ (0, vitest_1.it)('should handle files with no imports', async () => {
147
+ const noImportsContent = fs.readFileSync(path.join(fixturesDir, 'no-imports.tsx'), 'utf8');
148
+ fs.writeFileSync(tmpFile, noImportsContent);
149
+ await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', false, true, false);
150
+ const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
151
+ (0, vitest_1.expect)(modifiedContent).toContain('import * as Sentry from "@sentry/react-router";');
152
+ (0, vitest_1.expect)(modifiedContent).toContain('Sentry.init({');
153
+ (0, vitest_1.expect)(modifiedContent).toContain('Sentry.replayIntegration(');
154
+ });
155
+ (0, vitest_1.it)('should preserve existing code structure', async () => {
156
+ const complexContent = fs.readFileSync(path.join(fixturesDir, 'complex.tsx'), 'utf8');
157
+ fs.writeFileSync(tmpFile, complexContent);
158
+ await (0, client_entry_1.instrumentClientEntry)(tmpFile, 'test-dsn', true, true, false);
159
+ const modifiedContent = fs.readFileSync(tmpFile, 'utf8');
160
+ (0, vitest_1.expect)(modifiedContent).toContain('import * as Sentry from "@sentry/react-router";');
161
+ (0, vitest_1.expect)(modifiedContent).toContain('Sentry.init({');
162
+ // Original content should still be there
163
+ (0, vitest_1.expect)(modifiedContent).toContain('startTransition');
164
+ (0, vitest_1.expect)(modifiedContent).toContain('hydrateRoot');
165
+ (0, vitest_1.expect)(modifiedContent).toContain('<StrictMode>');
166
+ });
167
+ });
168
+ //# sourceMappingURL=client-entry.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-entry.test.js","sourceRoot":"","sources":["../../../../test/react-router/codemods/client-entry.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAyE;AACzE,uCAAyB;AACzB,2CAA6B;AAC7B,kFAAwF;AAExF,WAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC7B,MAAM,IAAI,GAAG;QACX,GAAG,EAAE;YACH,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,IAAI,EAAE,WAAE,CAAC,EAAE,EAAE;YACb,OAAO,EAAE,WAAE,CAAC,EAAE,EAAE;SACjB;KACF,CAAC;IACF,OAAO;QACL,OAAO,EAAE,IAAI;QACb,GAAG,IAAI;KACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAA,iBAAQ,EAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;IACrE,IAAI,MAAc,CAAC;IACnB,IAAI,OAAe,CAAC;IAEpB,IAAA,mBAAU,EAAC,GAAG,EAAE;QACd,WAAE,CAAC,aAAa,EAAE,CAAC;QAEnB,4CAA4C;QAC5C,MAAM,GAAG,IAAI,CAAC,IAAI,CAChB,WAAW,EACX,KAAK,EACL,QAAQ,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,C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AAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;QACvD,MAAM,cAAc,GAAG,EAAE,CAAC,YAAY,CACpC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,EACrC,MAAM,CACP,CAAC;QAEF,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAE1C,MAAM,IAAA,oCAAqB,EAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAEpE,MAAM,eAAe,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAEzD,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,SAAS,CAC/B,iDAAiD,CAClD,CAAC;QACF,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;QAEnD,yCAAyC;QACzC,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QACrD,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACjD,IAAA,eAAM,EAAC,eAAe,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { instrumentClientEntry } from '../../../src/react-router/codemods/client.entry';\n\nvi.mock('@clack/prompts', () => {\n const mock = {\n log: {\n warn: vi.fn(),\n info: vi.fn(),\n success: vi.fn(),\n },\n };\n return {\n default: mock,\n ...mock,\n };\n});\n\ndescribe('instrumentClientEntry', () => {\n const fixturesDir = path.join(__dirname, 'fixtures', 'client-entry');\n let tmpDir: string;\n let tmpFile: string;\n\n beforeEach(() => {\n vi.clearAllMocks();\n\n // Create unique tmp directory for each test\n tmpDir = path.join(\n fixturesDir,\n 'tmp',\n `test-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n );\n tmpFile = path.join(tmpDir, 'entry.client.tsx');\n\n // Ensure tmp directory exists\n fs.mkdirSync(tmpDir, { recursive: true });\n });\n\n afterEach(() => {\n // Clean up tmp directory\n if (fs.existsSync(tmpDir)) {\n fs.rmSync(tmpDir, { recursive: true });\n }\n });\n\n it('should add Sentry import and initialization with all features enabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, true, true);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: [');\n expect(modifiedContent).toContain('Sentry.reactRouterTracingIntegration()');\n expect(modifiedContent).toContain('Sentry.replayIntegration(');\n expect(modifiedContent).toContain('enableLogs: true');\n });\n\n it('should add Sentry initialization with only tracing enabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, false, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: [');\n expect(modifiedContent).toContain('Sentry.reactRouterTracingIntegration()');\n expect(modifiedContent).not.toContain('Sentry.replayIntegration()');\n expect(modifiedContent).not.toContain('enableLogs: true');\n });\n\n it('should add Sentry initialization with only replay enabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', false, true, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: [');\n expect(modifiedContent).not.toContain(\n 'Sentry.reactRouterTracingIntegration()',\n );\n expect(modifiedContent).toContain('Sentry.replayIntegration(');\n expect(modifiedContent).not.toContain('enableLogs: true');\n });\n\n it('should add Sentry initialization with only logs enabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', false, false, true);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: [');\n expect(modifiedContent).not.toContain(\n 'Sentry.reactRouterTracingIntegration()',\n );\n expect(modifiedContent).not.toContain('Sentry.replayIntegration()');\n expect(modifiedContent).toContain('enableLogs: true');\n });\n\n it('should add minimal Sentry initialization when all features are disabled', async () => {\n const basicContent = fs.readFileSync(\n path.join(fixturesDir, 'basic.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, basicContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', false, false, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('dsn: \"test-dsn\"');\n expect(modifiedContent).toContain('integrations: []');\n expect(modifiedContent).not.toContain(\n 'Sentry.reactRouterTracingIntegration()',\n );\n expect(modifiedContent).not.toContain('Sentry.replayIntegration()');\n expect(modifiedContent).not.toContain('enableLogs: true');\n });\n\n it('should not modify file when Sentry content already exists', async () => {\n const withSentryContent = fs.readFileSync(\n path.join(fixturesDir, 'with-sentry.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, withSentryContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, true, true);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n // Content should remain unchanged\n expect(modifiedContent).toBe(withSentryContent);\n });\n\n it('should insert Sentry initialization after imports', async () => {\n const withImportsContent = fs.readFileSync(\n path.join(fixturesDir, 'with-imports.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, withImportsContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, false, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n\n // Check that the Sentry import is before the init call\n const sentryImportIndex = modifiedContent.indexOf(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n const sentryInitIndex = modifiedContent.indexOf('Sentry.init({');\n expect(sentryImportIndex).toBeLessThan(sentryInitIndex);\n });\n\n it('should handle files with no imports', async () => {\n const noImportsContent = fs.readFileSync(\n path.join(fixturesDir, 'no-imports.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, noImportsContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', false, true, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n expect(modifiedContent).toContain('Sentry.replayIntegration(');\n });\n\n it('should preserve existing code structure', async () => {\n const complexContent = fs.readFileSync(\n path.join(fixturesDir, 'complex.tsx'),\n 'utf8',\n );\n\n fs.writeFileSync(tmpFile, complexContent);\n\n await instrumentClientEntry(tmpFile, 'test-dsn', true, true, false);\n\n const modifiedContent = fs.readFileSync(tmpFile, 'utf8');\n\n expect(modifiedContent).toContain(\n 'import * as Sentry from \"@sentry/react-router\";',\n );\n expect(modifiedContent).toContain('Sentry.init({');\n\n // Original content should still be there\n expect(modifiedContent).toContain('startTransition');\n expect(modifiedContent).toContain('hydrateRoot');\n expect(modifiedContent).toContain('<StrictMode>');\n });\n});\n"]}