@sentry/wizard 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.3.0
4
+
5
+ - fix(react-native): Avoid importing `isPlainObject` from `@sentry/utils` ([#1023](https://github.com/getsentry/sentry-wizard/pull/1023))
6
+ - feat(flutter): Add replay configuration option ([#1012](https://github.com/getsentry/sentry-wizard/pull/1012))
7
+
3
8
  ## 5.2.0
4
9
 
5
10
  - fix(nextjs): Update jsx/tsx snippets ([#1015](https://github.com/getsentry/sentry-wizard/pull/1015))
@@ -43,7 +43,11 @@ const vitest_1 = require("vitest");
43
43
  (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
44
44
  // "Do you want to enable Profiling", sometimes doesn't work as `Profiling` can be printed in bold.
45
45
  'to analyze CPU usage and optimize performance-critical code on iOS & macOS?'));
46
- profilingOptionPrompted &&
46
+ const replayOptionPrompted = profilingOptionPrompted &&
47
+ (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
48
+ // "Do you want to enable Session Replay", sometimes doesn't work as `Session Replay` can be printed in bold.
49
+ 'to record user interactions and debug issues?'));
50
+ replayOptionPrompted &&
47
51
  (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Successfully installed the Sentry Flutter SDK!'));
48
52
  wizardInstance.kill();
49
53
  });
@@ -88,7 +92,11 @@ const vitest_1 = require("vitest");
88
92
  (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
89
93
  // "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
90
94
  'to track the performance of your application?'));
91
- tracingOptionPrompted &&
95
+ const replayOptionPrompted = tracingOptionPrompted &&
96
+ (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
97
+ // "Do you want to enable Session Replay", sometimes doesn't work as `Session Replay` can be printed in bold.
98
+ 'to record user interactions and debug issues?'));
99
+ replayOptionPrompted &&
92
100
  (await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Successfully installed the Sentry Flutter SDK!'));
93
101
  wizardInstance.kill();
94
102
  });
@@ -1 +1 @@
1
- {"version":3,"file":"flutter.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/flutter.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,gDAAkC;AAClC,mDAAkD;AAClD,oCAKkB;AAClB,oCAA+C;AAC/C,oCAKkB;AAClB,mCAAqE;AAErE,IAAA,iBAAQ,EAAC,SAAS,EAAE,GAAG,EAAE;IACvB,MAAM,WAAW,GAAG,uBAAW,CAAC,OAAO,CAAC;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,uCAAuC,CACxC,CAAC;IAEF,IAAA,iBAAQ,EAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;YACnB,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;YAEpE,MAAM,qBAAqB,GAAG,MAAM,cAAc,CAAC,aAAa;YAC9D,+FAA+F;YAC/F,+CAA+C,CAChD,CAAC;YAEF,MAAM,uBAAuB,GAC3B,qBAAqB;gBACrB,CAAC,MAAM,cAAc,CAAC,yBAAyB,CAC7C,CAAC,YAAI,CAAC,KAAK,CAAC;gBACZ,mGAAmG;gBACnG,6EAA6E,CAC9E,CAAC,CAAC;YAEL,uBAAuB;gBACrB,CAAC,MAAM,cAAc,CAAC,yBAAyB,CAC7C,CAAC,YAAI,CAAC,KAAK,CAAC,EACZ,gDAAgD,CACjD,CAAC,CAAC;YAEL,cAAc,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,IAAA,iBAAQ,EAA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W,GAAG,EAAE,CAAC,YAAY,CACjC,GAAG,UAAU,gBAAgB,EAC7B,OAAO,CACR,CAAC;YACF,IAAA,eAAM,EAAC,WAAW,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,mCAAmC,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n // checkEnvBuildPlugin,\n cleanupGit,\n revertLocalChanges,\n} from '../utils';\nimport { startWizardInstance } from '../utils';\nimport {\n checkFileContents,\n checkIfFlutterBuilds,\n // checkFileExists,\n checkSentryProperties,\n} from '../utils';\nimport { afterAll, beforeAll, describe, expect, test } from 'vitest';\n\ndescribe('Flutter', () => {\n const integration = Integration.flutter;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/flutter-test-app',\n );\n\n describe('with apple platforms', () => {\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n\n const tracingOptionPrompted = await wizardInstance.waitForOutput(\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n );\n\n const profilingOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Profiling\", sometimes doesn't work as `Profiling` can be printed in bold.\n 'to analyze CPU usage and optimize performance-critical code on iOS & macOS?',\n ));\n\n profilingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Successfully installed the Sentry Flutter SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('pubspec.yaml is updated.', () => {\n checkFileContents(`${projectDir}/pubspec.yaml`, `sentry_flutter:`); // dependencies\n checkFileContents(`${projectDir}/pubspec.yaml`, `sentry_dart_plugin:`); // dev_dependencies\n checkFileContents(`${projectDir}/pubspec.yaml`, `sentry:`); // gradle plugin options\n });\n\n test('sentry.properties exists and has auth token', () => {\n checkSentryProperties(projectDir);\n });\n\n test('.gitignore has sentry.properties', () => {\n checkFileContents(`${projectDir}/.gitignore`, `sentry.properties`);\n });\n\n test('lib/main.dart calls sentry init', () => {\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `import 'package:sentry_flutter/sentry_flutter.dart';`,\n );\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `await SentryFlutter.init(`,\n );\n });\n\n test('lib/main.dart enables tracing and profiling', () => {\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `options.tracesSampleRate = 1.0;`,\n );\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `options.profilesSampleRate = 1.0;`,\n );\n });\n\n test('builds correctly', async () => {\n await checkIfFlutterBuilds(projectDir, '✓ Built build/web');\n });\n });\n\n describe('without apple platforms', () => {\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n\n if (fs.existsSync(`${projectDir}/ios`)) {\n fs.renameSync(`${projectDir}/ios`, `${projectDir}/_ios`);\n }\n if (fs.existsSync(`${projectDir}/macos`)) {\n fs.renameSync(`${projectDir}/macos`, `${projectDir}/_macos`);\n }\n\n const continueOnUncommitedFilesPromted =\n await wizardInstance.waitForOutput('Do you want to continue anyway?');\n\n const tracingOptionPrompted =\n continueOnUncommitedFilesPromted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n ));\n\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Successfully installed the Sentry Flutter SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('lib/main.dart does not add profiling with missing ios and macos folder', () => {\n const fileContent = fs.readFileSync(\n `${projectDir}/lib/main.dart`,\n 'utf-8',\n );\n expect(fileContent).not.toContain(`options.profilesSampleRate = 1.0;`);\n });\n });\n});\n"]}
1
+ {"version":3,"file":"flutter.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/flutter.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,gDAAkC;AAClC,mDAAkD;AAClD,oCAKkB;AAClB,oCAA+C;AAC/C,oCAKkB;AAClB,mCAAqE;AAErE,IAAA,iBAAQ,EAAC,SAAS,EAAE,GAAG,EAAE;IACvB,MAAM,WAAW,GAAG,uBAAW,CAAC,OAAO,CAAC;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,uCAAuC,CACxC,CAAC;IAEF,IAAA,iBAAQ,EAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;YACnB,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;YAEpE,MAAM,qBAAqB,GAAG,MAAM,cAAc,CAAC,aAAa;YAC9D,+FAA+F;YAC/F,+CAA+C,CAChD,CAAC;YAEF,MAAM,uBAAuB,GAC3B,qBAAqB;gBACrB,CAAC,MAAM,cAAc,CAAC,yBAAyB,CAC7C,CAAC,YAAI,CAAC,KAAK,CAAC;gBACZ,mGAAmG;gBACnG,6EAA6E,CAC9E,CAAC,CAAC;YAEL,MAAM,oBAAoB,GACxB,uBAAuB;gBACvB,CAAC,MAAM,cAAc,CAAC,yBAAyB,CAC7C,CAAC,YAAI,CAAC,KAAK,CAAC;gBACZ,6GAA6G;gBAC7G,+CAA+C,CAChD,CAAC,CAAC;YAEL,oBAAoB;gBAClB,CAAC,MAAM,cAAc,CAAC,yBAAyB,CAC7C,CAAC,YAAI,CAAC,KAAK,CAAC,EACZ,gDAAgD,CACjD,CAAC,CAAC;Y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AC;QACxB,CAAC,CAAC,CAAC;QAEH,IAAA,iBAAQ,EAAC,GAAG,EAAE;YACZ,IAAA,0BAAkB,EAAC,UAAU,CAAC,CAAC;YAC/B,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,IAAA,aAAI,EAAC,wEAAwE,EAAE,GAAG,EAAE;YAClF,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CACjC,GAAG,UAAU,gBAAgB,EAC7B,OAAO,CACR,CAAC;YACF,IAAA,eAAM,EAAC,WAAW,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,mCAAmC,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n // checkEnvBuildPlugin,\n cleanupGit,\n revertLocalChanges,\n} from '../utils';\nimport { startWizardInstance } from '../utils';\nimport {\n checkFileContents,\n checkIfFlutterBuilds,\n // checkFileExists,\n checkSentryProperties,\n} from '../utils';\nimport { afterAll, beforeAll, describe, expect, test } from 'vitest';\n\ndescribe('Flutter', () => {\n const integration = Integration.flutter;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/flutter-test-app',\n );\n\n describe('with apple platforms', () => {\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n\n const tracingOptionPrompted = await wizardInstance.waitForOutput(\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n );\n\n const profilingOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Profiling\", sometimes doesn't work as `Profiling` can be printed in bold.\n 'to analyze CPU usage and optimize performance-critical code on iOS & macOS?',\n ));\n\n const replayOptionPrompted =\n profilingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Session Replay\", sometimes doesn't work as `Session Replay` can be printed in bold.\n 'to record user interactions and debug issues?',\n ));\n\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Successfully installed the Sentry Flutter SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('pubspec.yaml is updated.', () => {\n checkFileContents(`${projectDir}/pubspec.yaml`, `sentry_flutter:`); // dependencies\n checkFileContents(`${projectDir}/pubspec.yaml`, `sentry_dart_plugin:`); // dev_dependencies\n checkFileContents(`${projectDir}/pubspec.yaml`, `sentry:`); // gradle plugin options\n });\n\n test('sentry.properties exists and has auth token', () => {\n checkSentryProperties(projectDir);\n });\n\n test('.gitignore has sentry.properties', () => {\n checkFileContents(`${projectDir}/.gitignore`, `sentry.properties`);\n });\n\n test('lib/main.dart calls sentry init', () => {\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `import 'package:sentry_flutter/sentry_flutter.dart';`,\n );\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `await SentryFlutter.init(`,\n );\n });\n\n test('lib/main.dart enables tracing and profiling', () => {\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `options.tracesSampleRate = 1.0;`,\n );\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `options.profilesSampleRate = 1.0;`,\n );\n });\n\n test('builds correctly', async () => {\n await checkIfFlutterBuilds(projectDir, '✓ Built build/web');\n });\n });\n\n describe('without apple platforms', () => {\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n\n if (fs.existsSync(`${projectDir}/ios`)) {\n fs.renameSync(`${projectDir}/ios`, `${projectDir}/_ios`);\n }\n if (fs.existsSync(`${projectDir}/macos`)) {\n fs.renameSync(`${projectDir}/macos`, `${projectDir}/_macos`);\n }\n\n const continueOnUncommitedFilesPromted =\n await wizardInstance.waitForOutput('Do you want to continue anyway?');\n\n const tracingOptionPrompted =\n continueOnUncommitedFilesPromted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Session Replay\", sometimes doesn't work as `Session Replay` can be printed in bold.\n 'to record user interactions and debug issues?',\n ));\n\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Successfully installed the Sentry Flutter SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('lib/main.dart does not add profiling with missing ios and macos folder', () => {\n const fileContent = fs.readFileSync(\n `${projectDir}/lib/main.dart`,\n 'utf-8',\n );\n expect(fileContent).not.toContain(`options.profilesSampleRate = 1.0;`);\n });\n });\n});\n"]}
@@ -11,6 +11,7 @@ export declare function patchMain(mainFile: string | null, dsn: string, canEnabl
11
11
  export declare function patchMainContent(dsn: string, mainContent: string, selectedFeatures: {
12
12
  tracing: boolean;
13
13
  profiling: boolean;
14
+ replay: boolean;
14
15
  }): string;
15
16
  export declare function getLastImportLineLocation(sourceCode: string): number;
16
17
  export declare function getDependenciesLocation(sourceCode: string): number;
@@ -156,12 +156,22 @@ async function patchMain(mainFile, dsn, canEnableProfiling) {
156
156
  enabledHint: 'recommended, tracing must be enabled',
157
157
  });
158
158
  }
159
+ features.push({
160
+ id: 'replay',
161
+ prompt: `Do you want to enable ${chalk_1.default.bold('Session Replay')} to record user interactions and debug issues?`,
162
+ enabledHint: 'recommended',
163
+ });
159
164
  const selectedFeatures = await (0, clack_1.featureSelectionPrompt)(features);
160
165
  const normalizedSelectedFeatures = {
161
166
  tracing: selectedFeatures.tracing ?? false,
162
167
  profiling: selectedFeatures.profiling ?? false,
168
+ replay: selectedFeatures.replay ?? false,
163
169
  };
164
170
  mainContent = patchMainContent(dsn, mainContent, normalizedSelectedFeatures);
171
+ if (normalizedSelectedFeatures.replay) {
172
+ clack.log.info(`Session Replay will be enabled with default settings (replaysSessionSampleRate: ${templates_1.sessionReplaySampleRate}, replaysOnErrorSampleRate: ${templates_1.sessionReplayOnErrorSampleRate}).`);
173
+ clack.log.message('By default, all text content, images, and webviews will be masked for privacy. You can customize this in your code later.');
174
+ }
165
175
  fs.writeFileSync(mainFile, mainContent, 'utf8');
166
176
  clack.log.success(chalk_1.default.greenBright(`Patched ${chalk_1.default.bold('main.dart')} with the Sentry setup and test error snippet.`));
167
177
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"code-tools.js","sourceRoot":"","sources":["../../../src/flutter/code-tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,qDAAuC;AACvC,+EAA+E;AAC/E,sDAAwC;AACxC,kDAA0B;AAC1B,2CAKqB;AACrB,0CAAwD;AAExD;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,GAAW,EAAE,IAAY;IAChD,MAAM,KAAK,GAAa,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAE5C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,QAAQ,GAAW,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC9C,MAAM,KAAK,GAAa,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAE9C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE;YACvB,MAAM,MAAM,GAAkB,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACvD,IAAI,MAAM,EAAE;gBACV,OAAO,MAAM,CAAC;aACf;SACF;aAAM,IAAI,IAAI,KAAK,IAAI,EAAE;YACxB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KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QAChD,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KACjC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as Sentry from '@sentry/node';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport {\n sentryImport,\n pubspecOptions,\n sentryProperties,\n initSnippet,\n} from './templates';\nimport { featureSelectionPrompt } from '../utils/clack';\n\n/**\n * Recursively finds a file per name in subfolders.\n * @param dir - The directory to start searching.\n * @param name - The name of the file including path extension.\n * @returns The path to the main.dart file or null if not found.\n */\nexport function findFile(dir: string, name: string): string | null {\n const files: string[] = fs.readdirSync(dir);\n\n for (const file of files) {\n const fullPath: string = path.join(dir, file);\n const stats: fs.Stats = fs.statSync(fullPath);\n\n if (stats.isDirectory()) {\n const result: string | null = findFile(fullPath, name);\n if (result) {\n return result;\n }\n } else if (file === name) {\n return fullPath;\n }\n }\n\n return null;\n}\n\nexport function patchPubspec(\n pubspecFile: string | null,\n sentryDartFlutterVersion: string,\n sentryDartPluginVersion: string,\n project: string,\n org: string,\n): boolean {\n try {\n if (!pubspecFile) {\n throw new Error('pubspec.yaml is not provided or invalid.');\n }\n\n let pubspecContent = fs.readFileSync(pubspecFile, 'utf8');\n\n if (!pubspecContent.includes('sentry_flutter:')) {\n const dependenciesIndex = getDependenciesLocation(pubspecContent);\n\n pubspecContent =\n pubspecContent.slice(0, dependenciesIndex) +\n ` sentry_flutter: ${sentryDartFlutterVersion}\\n` +\n pubspecContent.slice(dependenciesIndex);\n\n clack.log.success(\n chalk.greenBright(\n `${chalk.bold('sentry_flutter')} added to pubspec.yaml`,\n ),\n );\n } else {\n clack.log.success(\n chalk.greenBright(\n `${chalk.bold('sentry_flutter')} is already included in pubspec.yaml`,\n ),\n );\n }\n\n if (!pubspecContent.includes('sentry_dart_plugin:')) {\n const devDependenciesIndex = getDevDependenciesLocation(pubspecContent);\n pubspecContent =\n pubspecContent.slice(0, devDependenciesIndex) +\n ` sentry_dart_plugin: ${sentryDartPluginVersion}\\n` +\n pubspecContent.slice(devDependenciesIndex);\n\n clack.log.success(\n chalk.greenBright(\n `${chalk.bold('sentry_dart_plugin')} added to pubspec.yaml`,\n ),\n );\n } else {\n clack.log.success(\n chalk.greenBright(\n `${chalk.bold(\n 'sentry_dart_plugin',\n )} is already included in pubspec.yaml`,\n ),\n );\n }\n\n if (!pubspecContent.includes('sentry:')) {\n pubspecContent += '\\n';\n pubspecContent += pubspecOptions(project, org);\n\n clack.log.success(\n chalk.greenBright(\n `${chalk.bold('sentry plugin configuration')} added to pubspec.yaml`,\n ),\n );\n } else {\n clack.log.success(\n chalk.greenBright(\n `${chalk.bold(\n 'sentry plugin configuration',\n )} is already included in pubspec.yaml`,\n ),\n );\n }\n\n fs.writeFileSync(pubspecFile, pubspecContent, 'utf8');\n\n return true;\n } catch (error) {\n clack.log.warn(`Failed to read/write ${chalk.cyan('pubspec.yaml')} file.`);\n Sentry.captureException(error);\n return false;\n }\n}\n\nexport function addProperties(pubspecFile: string | null, authToken: string) {\n try {\n if (!pubspecFile) {\n throw new Error('pubspec.yaml is not provided or invalid.');\n }\n\n const pubspecDir = path.dirname(pubspecFile);\n const sentryPropertiesFileName = 'sentry.properties';\n const sentryPropertiesFile = path.join(\n pubspecDir,\n sentryPropertiesFileName,\n );\n const sentryPropertiesContent = sentryProperties(authToken);\n\n fs.writeFileSync(sentryPropertiesFile, sentryPropertiesContent, 'utf8');\n\n const gitignoreFile = path.join(pubspecDir, '.gitignore');\n if (fs.existsSync(gitignoreFile)) {\n fs.appendFileSync(gitignoreFile, `\\n${sentryPropertiesFileName}\\n`);\n } else {\n fs.writeFileSync(gitignoreFile, `${sentryPropertiesFileName}\\n`, 'utf8');\n }\n return true;\n } catch (error) {\n clack.log.warn(`Failed to read/write ${chalk.cyan('pubspec.yaml')} file.`);\n Sentry.captureException(error);\n return false;\n }\n}\n\nexport async function patchMain(\n mainFile: string | null,\n dsn: string,\n canEnableProfiling: boolean,\n): Promise<boolean> {\n try {\n if (!mainFile) {\n throw new Error('pubspec.yaml is not provided or invalid.');\n }\n\n let mainContent = fs.readFileSync(mainFile, 'utf8');\n if (\n /import\\s+['\"]package[:]sentry_flutter\\/sentry_flutter\\.dart['\"];?/i.test(\n mainContent,\n )\n ) {\n // sentry is already configured\n clack.log.success(\n chalk.greenBright(\n `${chalk.bold('main.dart')} already has Sentry configured.`,\n ),\n );\n return true;\n }\n\n const features = [\n {\n id: 'tracing',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n ];\n if (canEnableProfiling) {\n features.push({\n id: 'profiling',\n prompt: `Do you want to enable ${chalk.bold(\n 'Profiling',\n )} to analyze CPU usage and optimize performance-critical code on iOS & macOS?`,\n enabledHint: 'recommended, tracing must be enabled',\n });\n }\n\n const selectedFeatures = await featureSelectionPrompt(features);\n const normalizedSelectedFeatures = {\n tracing: selectedFeatures.tracing ?? false,\n profiling: selectedFeatures.profiling ?? false,\n };\n mainContent = patchMainContent(\n dsn,\n mainContent,\n normalizedSelectedFeatures,\n );\n\n fs.writeFileSync(mainFile, mainContent, 'utf8');\n\n clack.log.success(\n chalk.greenBright(\n `Patched ${chalk.bold(\n 'main.dart',\n )} with the Sentry setup and test error snippet.`,\n ),\n );\n\n return true;\n } catch (error) {\n clack.log.warn(`Failed to read/write ${chalk.cyan('main.dart')} file.`);\n Sentry.captureException(error);\n return false;\n }\n}\n\nexport function patchMainContent(\n dsn: string,\n mainContent: string,\n selectedFeatures: {\n tracing: boolean;\n profiling: boolean;\n },\n): string {\n const importIndex = getLastImportLineLocation(mainContent);\n mainContent =\n mainContent.slice(0, importIndex) +\n sentryImport +\n mainContent.slice(importIndex);\n\n // Find and replace `runApp(...)`\n mainContent = mainContent.replace(\n /runApp\\(([\\s\\S]*?)\\);/g, // Match the `runApp(...)` invocation\n (_, runAppArgs) => initSnippet(dsn, selectedFeatures, runAppArgs as string),\n );\n\n // Make the `main` function async if it's not already\n mainContent = mainContent.replace(\n /void\\s+main\\(\\)\\s*\\{/g,\n 'Future<void> main() async {',\n );\n\n return mainContent;\n}\n\nexport function getLastImportLineLocation(sourceCode: string): number {\n const importRegex = /import\\s+['\"].*['\"].*;/gim;\n return getLastReqExpLocation(sourceCode, importRegex);\n}\n\nexport function getDependenciesLocation(sourceCode: string): number {\n const dependencyRegex = /^dependencies:\\s*$/gim;\n return getLastReqExpLocation(sourceCode, dependencyRegex);\n}\n\nexport function getDevDependenciesLocation(sourceCode: string): number {\n const dependencyRegex = /^dev_dependencies:\\s*$/gim;\n return getLastReqExpLocation(sourceCode, dependencyRegex);\n}\n\n// Helper\n\nfunction getLastReqExpLocation(sourceCode: string, regExp: RegExp): number {\n let match = regExp.exec(sourceCode);\n let importIndex = 0;\n while (match) {\n importIndex = match.index + match[0].length + 1;\n match = regExp.exec(sourceCode);\n }\n return importIndex;\n}\n"]}
1
+ {"version":3,"file":"code-tools.js","sourceRoot":"","sources":["../../../src/flutter/code-tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,qDAAuC;AACvC,+EAA+E;AAC/E,sDAAwC;AACxC,kDAA0B;AAC1B,2CAOqB;AACrB,0CAAwD;AAExD;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,GAAW,EAAE,IAAY;IAChD,MAAM,KAAK,GAAa,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAE5C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,QAAQ,GAAW,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC9C,MAAM,KAAK,GAAa,EAAE,CAAC,QAAQ,CAAC,QAAQ,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;IAC1D,MAAM,WAAW,GAAG,2BAA2B,CAAC;IAChD,OAAO,qBAAqB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AACxD,CAAC;AAHD,8DAGC;AAED,SAAgB,uBAAuB,CAAC,UAAkB;IACxD,MAAM,eAAe,GAAG,uBAAuB,CAAC;IAChD,OAAO,qBAAqB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AAC5D,CAAC;AAHD,0DAGC;AAED,SAAgB,0BAA0B,CAAC,UAAkB;IAC3D,MAAM,eAAe,GAAG,2BAA2B,CAAC;IACpD,OAAO,qBAAqB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AAC5D,CAAC;AAHD,gEAGC;AAED,SAAS;AAET,SAAS,qBAAqB,CAAC,UAAkB,EAAE,MAAc;IAC/D,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpC,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,OAAO,KAAK,EAAE;QACZ,WAAW,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QAChD,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KACjC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as Sentry from '@sentry/node';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport {\n sentryImport,\n pubspecOptions,\n sentryProperties,\n initSnippet,\n sessionReplaySampleRate,\n sessionReplayOnErrorSampleRate,\n} from './templates';\nimport { featureSelectionPrompt } from '../utils/clack';\n\n/**\n * Recursively finds a file per name in subfolders.\n * @param dir - The directory to start searching.\n * @param name - The name of the file including path extension.\n * @returns The path to the main.dart file or null if not found.\n */\nexport function findFile(dir: string, name: string): string | null {\n const files: string[] = fs.readdirSync(dir);\n\n for (const file of files) {\n const fullPath: string = path.join(dir, file);\n const stats: fs.Stats = fs.statSync(fullPath);\n\n if (stats.isDirectory()) {\n const result: string | null = findFile(fullPath, name);\n if (result) {\n return result;\n }\n } else if (file === name) {\n return fullPath;\n }\n }\n\n return null;\n}\n\nexport function patchPubspec(\n pubspecFile: string | null,\n sentryDartFlutterVersion: string,\n sentryDartPluginVersion: string,\n project: string,\n org: string,\n): boolean {\n try {\n if (!pubspecFile) {\n throw new Error('pubspec.yaml is not provided or invalid.');\n }\n\n let pubspecContent = fs.readFileSync(pubspecFile, 'utf8');\n\n if (!pubspecContent.includes('sentry_flutter:')) {\n const dependenciesIndex = getDependenciesLocation(pubspecContent);\n\n pubspecContent =\n pubspecContent.slice(0, dependenciesIndex) +\n ` sentry_flutter: ${sentryDartFlutterVersion}\\n` +\n pubspecContent.slice(dependenciesIndex);\n\n clack.log.success(\n chalk.greenBright(\n `${chalk.bold('sentry_flutter')} added to pubspec.yaml`,\n ),\n );\n } else {\n clack.log.success(\n chalk.greenBright(\n `${chalk.bold('sentry_flutter')} is already included in pubspec.yaml`,\n ),\n );\n }\n\n if (!pubspecContent.includes('sentry_dart_plugin:')) {\n const devDependenciesIndex = getDevDependenciesLocation(pubspecContent);\n pubspecContent =\n pubspecContent.slice(0, devDependenciesIndex) +\n ` sentry_dart_plugin: ${sentryDartPluginVersion}\\n` +\n pubspecContent.slice(devDependenciesIndex);\n\n clack.log.success(\n chalk.greenBright(\n `${chalk.bold('sentry_dart_plugin')} added to pubspec.yaml`,\n ),\n );\n } else {\n clack.log.success(\n chalk.greenBright(\n `${chalk.bold(\n 'sentry_dart_plugin',\n )} is already included in pubspec.yaml`,\n ),\n );\n }\n\n if (!pubspecContent.includes('sentry:')) {\n pubspecContent += '\\n';\n pubspecContent += pubspecOptions(project, org);\n\n clack.log.success(\n chalk.greenBright(\n `${chalk.bold('sentry plugin configuration')} added to pubspec.yaml`,\n ),\n );\n } else {\n clack.log.success(\n chalk.greenBright(\n `${chalk.bold(\n 'sentry plugin configuration',\n )} is already included in pubspec.yaml`,\n ),\n );\n }\n\n fs.writeFileSync(pubspecFile, pubspecContent, 'utf8');\n\n return true;\n } catch (error) {\n clack.log.warn(`Failed to read/write ${chalk.cyan('pubspec.yaml')} file.`);\n Sentry.captureException(error);\n return false;\n }\n}\n\nexport function addProperties(pubspecFile: string | null, authToken: string) {\n try {\n if (!pubspecFile) {\n throw new Error('pubspec.yaml is not provided or invalid.');\n }\n\n const pubspecDir = path.dirname(pubspecFile);\n const sentryPropertiesFileName = 'sentry.properties';\n const sentryPropertiesFile = path.join(\n pubspecDir,\n sentryPropertiesFileName,\n );\n const sentryPropertiesContent = sentryProperties(authToken);\n\n fs.writeFileSync(sentryPropertiesFile, sentryPropertiesContent, 'utf8');\n\n const gitignoreFile = path.join(pubspecDir, '.gitignore');\n if (fs.existsSync(gitignoreFile)) {\n fs.appendFileSync(gitignoreFile, `\\n${sentryPropertiesFileName}\\n`);\n } else {\n fs.writeFileSync(gitignoreFile, `${sentryPropertiesFileName}\\n`, 'utf8');\n }\n return true;\n } catch (error) {\n clack.log.warn(`Failed to read/write ${chalk.cyan('pubspec.yaml')} file.`);\n Sentry.captureException(error);\n return false;\n }\n}\n\nexport async function patchMain(\n mainFile: string | null,\n dsn: string,\n canEnableProfiling: boolean,\n): Promise<boolean> {\n try {\n if (!mainFile) {\n throw new Error('pubspec.yaml is not provided or invalid.');\n }\n\n let mainContent = fs.readFileSync(mainFile, 'utf8');\n if (\n /import\\s+['\"]package[:]sentry_flutter\\/sentry_flutter\\.dart['\"];?/i.test(\n mainContent,\n )\n ) {\n // sentry is already configured\n clack.log.success(\n chalk.greenBright(\n `${chalk.bold('main.dart')} already has Sentry configured.`,\n ),\n );\n return true;\n }\n\n const features = [\n {\n id: 'tracing',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n ];\n if (canEnableProfiling) {\n features.push({\n id: 'profiling',\n prompt: `Do you want to enable ${chalk.bold(\n 'Profiling',\n )} to analyze CPU usage and optimize performance-critical code on iOS & macOS?`,\n enabledHint: 'recommended, tracing must be enabled',\n });\n }\n features.push({\n id: 'replay',\n prompt: `Do you want to enable ${chalk.bold(\n 'Session Replay',\n )} to record user interactions and debug issues?`,\n enabledHint: 'recommended',\n });\n\n const selectedFeatures = await featureSelectionPrompt(features);\n const normalizedSelectedFeatures = {\n tracing: selectedFeatures.tracing ?? false,\n profiling: selectedFeatures.profiling ?? false,\n replay: selectedFeatures.replay ?? false,\n };\n mainContent = patchMainContent(\n dsn,\n mainContent,\n normalizedSelectedFeatures,\n );\n\n if (normalizedSelectedFeatures.replay) {\n clack.log.info(\n `Session Replay will be enabled with default settings (replaysSessionSampleRate: ${sessionReplaySampleRate}, replaysOnErrorSampleRate: ${sessionReplayOnErrorSampleRate}).`,\n );\n clack.log.message(\n 'By default, all text content, images, and webviews will be masked for privacy. You can customize this in your code later.',\n );\n }\n\n fs.writeFileSync(mainFile, mainContent, 'utf8');\n\n clack.log.success(\n chalk.greenBright(\n `Patched ${chalk.bold(\n 'main.dart',\n )} with the Sentry setup and test error snippet.`,\n ),\n );\n\n return true;\n } catch (error) {\n clack.log.warn(`Failed to read/write ${chalk.cyan('main.dart')} file.`);\n Sentry.captureException(error);\n return false;\n }\n}\n\nexport function patchMainContent(\n dsn: string,\n mainContent: string,\n selectedFeatures: {\n tracing: boolean;\n profiling: boolean;\n replay: boolean;\n },\n): string {\n const importIndex = getLastImportLineLocation(mainContent);\n mainContent =\n mainContent.slice(0, importIndex) +\n sentryImport +\n mainContent.slice(importIndex);\n\n // Find and replace `runApp(...)`\n mainContent = mainContent.replace(\n /runApp\\(([\\s\\S]*?)\\);/g, // Match the `runApp(...)` invocation\n (_, runAppArgs) => initSnippet(dsn, selectedFeatures, runAppArgs as string),\n );\n\n // Make the `main` function async if it's not already\n mainContent = mainContent.replace(\n /void\\s+main\\(\\)\\s*\\{/g,\n 'Future<void> main() async {',\n );\n\n return mainContent;\n}\n\nexport function getLastImportLineLocation(sourceCode: string): number {\n const importRegex = /import\\s+['\"].*['\"].*;/gim;\n return getLastReqExpLocation(sourceCode, importRegex);\n}\n\nexport function getDependenciesLocation(sourceCode: string): number {\n const dependencyRegex = /^dependencies:\\s*$/gim;\n return getLastReqExpLocation(sourceCode, dependencyRegex);\n}\n\nexport function getDevDependenciesLocation(sourceCode: string): number {\n const dependencyRegex = /^dev_dependencies:\\s*$/gim;\n return getLastReqExpLocation(sourceCode, dependencyRegex);\n}\n\n// Helper\n\nfunction getLastReqExpLocation(sourceCode: string, regExp: RegExp): number {\n let match = regExp.exec(sourceCode);\n let importIndex = 0;\n while (match) {\n importIndex = match.index + match[0].length + 1;\n match = regExp.exec(sourceCode);\n }\n return importIndex;\n}\n"]}
@@ -1,9 +1,12 @@
1
1
  export declare const sentryImport = "import 'package:sentry_flutter/sentry_flutter.dart';\n";
2
+ export declare const sessionReplaySampleRate = 0.1;
3
+ export declare const sessionReplayOnErrorSampleRate = 1;
2
4
  export declare function pubspecOptions(project: string, org: string): string;
3
5
  export declare function sentryProperties(authToken: string): string;
4
6
  export declare function initSnippet(dsn: string, selectedFeaturesMap: {
5
7
  tracing: boolean;
6
8
  profiling: boolean;
9
+ replay: boolean;
7
10
  }, runApp: string): string;
8
11
  export declare function pubspecSnippetColored(sentryVersion: string, pluginVersion: string, project: string, org: string): string;
9
12
  export declare function initSnippetColored(dsn: string): string;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initSnippetColored = exports.pubspecSnippetColored = exports.initSnippet = exports.sentryProperties = exports.pubspecOptions = exports.sentryImport = void 0;
3
+ exports.initSnippetColored = exports.pubspecSnippetColored = exports.initSnippet = exports.sentryProperties = exports.pubspecOptions = exports.sessionReplayOnErrorSampleRate = exports.sessionReplaySampleRate = exports.sentryImport = void 0;
4
4
  const clack_1 = require("../utils/clack");
5
5
  exports.sentryImport = `import 'package:sentry_flutter/sentry_flutter.dart';\n`;
6
+ exports.sessionReplaySampleRate = 0.1;
7
+ exports.sessionReplayOnErrorSampleRate = 1.0;
6
8
  function pubspecOptions(project, org) {
7
9
  return `sentry:
8
10
  upload_debug_symbols: true
@@ -35,6 +37,16 @@ function initSnippet(dsn, selectedFeaturesMap, runApp) {
35
37
  // Setting to 1.0 will profile 100% of sampled transactions:
36
38
  options.profilesSampleRate = 1.0;`;
37
39
  }
40
+ if (selectedFeaturesMap.replay) {
41
+ snippet += `
42
+ // Configure Session Replay
43
+ options.replay.sessionSampleRate = ${exports.sessionReplaySampleRate % 1 === 0
44
+ ? `${exports.sessionReplaySampleRate}.0`
45
+ : exports.sessionReplaySampleRate};
46
+ options.replay.onErrorSampleRate = ${exports.sessionReplayOnErrorSampleRate % 1 === 0
47
+ ? `${exports.sessionReplayOnErrorSampleRate}.0`
48
+ : exports.sessionReplayOnErrorSampleRate};`;
49
+ }
38
50
  snippet += `
39
51
  },
40
52
  appRunner: () => runApp(SentryWidget(child: ${runApp})),
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/flutter/templates.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;AAEpC,QAAA,YAAY,GAAG,wDAAwD,CAAC;AAErF,SAAgB,cAAc,CAAC,OAAe,EAAE,GAAW;IACzD,OAAO;;;aAGI,OAAO;SACX,GAAG;CACX,CAAC;AACF,CAAC;AAPD,wCAOC;AAED,SAAgB,gBAAgB,CAAC,SAAiB;IAChD,OAAO,cAAc,SAAS,EAAE,CAAC;AACnC,CAAC;AAFD,4CAEC;AAED,SAAgB,WAAW,CACzB,GAAW,EACX,mBAGC,EACD,MAAc;IAEd,IAAI,OAAO,GAAG;;uBAEO,GAAG;;;qCAGW,CAAC;IAEpC,IAAI,mBAAmB,CAAC,OAAO,EAAE;QAC/B,OAAO,IAAI;;;sCAGuB,CAAC;KACpC;IAED,IAAI,mBAAmB,CAAC,SAAS,IAAI,mBAAmB,CAAC,OAAO,EAAE;QAChE,OAAO,IAAI;;;wCAGyB,CAAC;KACtC;IAED,OAAO,IAAI;;kDAEqC,MAAM;;;4EAGoB,CAAC;IAE3E,OAAO,OAAO,CAAC;AACjB,CAAC;AArCD,kCAqCC;AAED,SAAgB,qBAAqB,CACnC,aAAqB,EACrB,aAAqB,EACrB,OAAe,EACf,GAAW;IAEX,MAAM,OAAO,GAAG;oBACE,aAAa;;;wBAGT,aAAa;;EAEnC,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;IAE/B,OAAO,IAAA,uBAAe,EAAC,IAAI,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC;AAjBD,sDAiBC;AAED,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,MAAM,OAAO,GAAG;;;;;uBAKK,GAAG;;;;;;;;;;EAUxB,CAAC;IACD,OAAO,IAAA,uBAAe,EAAC,IAAI,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC;AApBD,gDAoBC","sourcesContent":["import { makeCodeSnippet } from '../utils/clack';\n\nexport const sentryImport = `import 'package:sentry_flutter/sentry_flutter.dart';\\n`;\n\nexport function pubspecOptions(project: string, org: string): string {\n return `sentry:\n upload_debug_symbols: true\n upload_source_maps: true\n project: ${project}\n org: ${org}\n`;\n}\n\nexport function sentryProperties(authToken: string): string {\n return `auth_token=${authToken}`;\n}\n\nexport function initSnippet(\n dsn: string,\n selectedFeaturesMap: {\n tracing: boolean;\n profiling: boolean;\n },\n runApp: string,\n): string {\n let snippet = `await SentryFlutter.init(\n (options) {\n options.dsn = '${dsn}';\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/\n options.sendDefaultPii = true;`;\n\n if (selectedFeaturesMap.tracing) {\n snippet += `\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0;`;\n }\n\n if (selectedFeaturesMap.profiling && selectedFeaturesMap.tracing) {\n snippet += `\n // The sampling rate for profiling is relative to tracesSampleRate\n // Setting to 1.0 will profile 100% of sampled transactions:\n options.profilesSampleRate = 1.0;`;\n }\n\n snippet += `\n },\n appRunner: () => runApp(SentryWidget(child: ${runApp})),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(StateError('This is a sample exception.'));`;\n\n return snippet;\n}\n\nexport function pubspecSnippetColored(\n sentryVersion: string,\n pluginVersion: string,\n project: string,\n org: string,\n): string {\n const snippet = `dependencies:\n sentry_flutter: ${sentryVersion}\n\ndev_dependencies:\n sentry_dart_plugin: ${pluginVersion}\n \n${pubspecOptions(project, org)}`;\n\n return makeCodeSnippet(true, (_unchanged, plus, _minus) => {\n return plus(snippet);\n });\n}\n\nexport function initSnippetColored(dsn: string): string {\n const snippet = `import 'package:sentry_flutter/sentry_flutter.dart';\n\nFuture<void>main() async {\n await SentryFlutter.init(\n (options) {\n options.dsn = '${dsn}';\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/\n options.sendDefaultPii = true;\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0;\n },\n appRunner: () => runApp(SentryWidget(child: YourApp())),\n )\n}`;\n return makeCodeSnippet(true, (_unchanged, plus, _minus) => {\n return plus(snippet);\n });\n}\n"]}
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/flutter/templates.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;AAEpC,QAAA,YAAY,GAAG,wDAAwD,CAAC;AACxE,QAAA,uBAAuB,GAAG,GAAG,CAAC;AAC9B,QAAA,8BAA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CAAC,CAAC;AACL,CAAC;AAjBD,sDAiBC;AAED,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,MAAM,OAAO,GAAG;;;;;uBAKK,GAAG;;;;;;;;;;EAUxB,CAAC;IACD,OAAO,IAAA,uBAAe,EAAC,IAAI,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC;AApBD,gDAoBC","sourcesContent":["import { makeCodeSnippet } from '../utils/clack';\n\nexport const sentryImport = `import 'package:sentry_flutter/sentry_flutter.dart';\\n`;\nexport const sessionReplaySampleRate = 0.1;\nexport const sessionReplayOnErrorSampleRate = 1.0;\n\nexport function pubspecOptions(project: string, org: string): string {\n return `sentry:\n upload_debug_symbols: true\n upload_source_maps: true\n project: ${project}\n org: ${org}\n`;\n}\n\nexport function sentryProperties(authToken: string): string {\n return `auth_token=${authToken}`;\n}\n\nexport function initSnippet(\n dsn: string,\n selectedFeaturesMap: {\n tracing: boolean;\n profiling: boolean;\n replay: boolean;\n },\n runApp: string,\n): string {\n let snippet = `await SentryFlutter.init(\n (options) {\n options.dsn = '${dsn}';\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/\n options.sendDefaultPii = true;`;\n\n if (selectedFeaturesMap.tracing) {\n snippet += `\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0;`;\n }\n\n if (selectedFeaturesMap.profiling && selectedFeaturesMap.tracing) {\n snippet += `\n // The sampling rate for profiling is relative to tracesSampleRate\n // Setting to 1.0 will profile 100% of sampled transactions:\n options.profilesSampleRate = 1.0;`;\n }\n\n if (selectedFeaturesMap.replay) {\n snippet += `\n // Configure Session Replay\n options.replay.sessionSampleRate = ${\n sessionReplaySampleRate % 1 === 0\n ? `${sessionReplaySampleRate}.0`\n : sessionReplaySampleRate\n };\n options.replay.onErrorSampleRate = ${\n sessionReplayOnErrorSampleRate % 1 === 0\n ? `${sessionReplayOnErrorSampleRate}.0`\n : sessionReplayOnErrorSampleRate\n };`;\n }\n\n snippet += `\n },\n appRunner: () => runApp(SentryWidget(child: ${runApp})),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(StateError('This is a sample exception.'));`;\n\n return snippet;\n}\n\nexport function pubspecSnippetColored(\n sentryVersion: string,\n pluginVersion: string,\n project: string,\n org: string,\n): string {\n const snippet = `dependencies:\n sentry_flutter: ${sentryVersion}\n\ndev_dependencies:\n sentry_dart_plugin: ${pluginVersion}\n \n${pubspecOptions(project, org)}`;\n\n return makeCodeSnippet(true, (_unchanged, plus, _minus) => {\n return plus(snippet);\n });\n}\n\nexport function initSnippetColored(dsn: string): string {\n const snippet = `import 'package:sentry_flutter/sentry_flutter.dart';\n\nFuture<void>main() async {\n await SentryFlutter.init(\n (options) {\n options.dsn = '${dsn}';\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/\n options.sendDefaultPii = true;\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0;\n },\n appRunner: () => runApp(SentryWidget(child: YourApp())),\n )\n}`;\n return makeCodeSnippet(true, (_unchanged, plus, _minus) => {\n return plus(snippet);\n });\n}\n"]}
@@ -32,7 +32,6 @@ const clack = __importStar(require("@clack/prompts"));
32
32
  const chalk_1 = __importDefault(require("chalk"));
33
33
  const fs = __importStar(require("fs"));
34
34
  const os_1 = require("os");
35
- const utils_1 = require("@sentry/utils");
36
35
  const Sentry = __importStar(require("@sentry/node"));
37
36
  const clack_1 = require("../utils/clack");
38
37
  const telemetry_1 = require("../telemetry");
@@ -99,7 +98,7 @@ function addWithSentryToAppConfigJson(appConfigContent, options) {
99
98
  return null;
100
99
  }
101
100
  if (parsedAppConfig.expo !== undefined &&
102
- !(0, utils_1.isPlainObject)(parsedAppConfig.expo)) {
101
+ !isPlainObject(parsedAppConfig.expo)) {
103
102
  Sentry.setTag('app-config-file-status', 'invalid-json');
104
103
  clack.log.error(`Unable to find expo in your ${chalk_1.default.cyan('app.config.json')}. Make sure it has a valid format!`);
105
104
  return null;
@@ -149,4 +148,11 @@ function getSentryAppConfigJsonCodeSnippet({ url, project, org, }) {
149
148
  });
150
149
  }
151
150
  exports.getSentryAppConfigJsonCodeSnippet = getSentryAppConfigJsonCodeSnippet;
151
+ /**
152
+ * Checks whether the given value is a plain object (as opposed to something like a class instance or a primitive).
153
+ * vendored from @sentry/utils to avoid registering the dependency.
154
+ */
155
+ function isPlainObject(what) {
156
+ return Object.prototype.toString.call(what) === '[object Object]';
157
+ }
152
158
  //# sourceMappingURL=expo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"expo.js","sourceRoot":"","sources":["../../../src/react-native/expo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,sDAAwC;AACxC,kDAA0B;AAC1B,uCAAyB;AACzB,2BAAyB;AAEzB,yCAA8C;AAC9C,qDAAuC;AACvC,0CAA4E;AAE5E,4CAAyC;AAE5B,QAAA,uBAAuB,GAAG,2BAA2B,CAAC;AACtD,QAAA,kCAAkC,GAAG,aAAa,CAAC;AAEnD,QAAA,2BAA2B,GAAG,YAAY,CAAC;AAExD,MAAM,eAAe,GAAG,UAAU,CAAC;AAQnC,SAAgB,6BAA6B;IAC3C,KAAK,CAAC,KAAK,CACT,cAAc,eAAK,CAAC,IAAI,CACtB,aAAa,CACd,iFAAiF,eAAK,CAAC,IAAI,CAC1F,sEAAsE,CACvE,EAAE,CACJ,CAAC;AACJ,CAAC;AARD,sEAQC;AAED;;GAEG;AACI,KAAK,UAAU,kBAAkB,CAAC,OAAgC;IACvE,SAAS,gBAAgB;QACvB,OAAO,IAAA,iCAAyB,EAAC;YAC/B,QAAQ,EAAE,eA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AC,IAAI,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACvD,OAAO,SAAS,CAAC;;;MAGf,IAAI,CAAC;;;kBAGO,GAAG;sBACC,OAAO;2BACF,GAAG;;MAExB,CAAC;;EAEL,CAAC,CAAC;IACF,CAAC,CAAC,CAAC;AACL,CAAC;AApBD,8EAoBC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as fs from 'fs';\nimport { EOL } from 'os';\n\nimport { isPlainObject } from '@sentry/utils';\nimport * as Sentry from '@sentry/node';\nimport { makeCodeSnippet, showCopyPasteInstructions } from '../utils/clack';\nimport { RNCliSetupConfigContent } from './react-native-wizard';\nimport { traceStep } from '../telemetry';\n\nexport const SENTRY_EXPO_PLUGIN_NAME = '@sentry/react-native/expo';\nexport const DEPRECATED_SENTRY_EXPO_PLUGIN_NAME = 'sentry-expo';\n\nexport const SENTRY_PLUGIN_FUNCTION_NAME = 'withSentry';\n\nconst APP_CONFIG_JSON = `app.json`;\n\nexport interface AppConfigJson {\n expo?: {\n plugins?: Array<[string, undefined | Record<string, unknown>]>;\n };\n}\n\nexport function printSentryExpoMigrationOutro(): void {\n clack.outro(\n `Deprecated ${chalk.cyan(\n 'sentry-expo',\n )} package installed in your dependencies. Please follow the migration guide at ${chalk.cyan(\n 'https://docs.sentry.io/platforms/react-native/migration/sentry-expo/',\n )}`,\n );\n}\n\n/**\n * Finds app.json in the project root and add Sentry Expo `withSentry` plugin.\n */\nexport async function patchExpoAppConfig(options: RNCliSetupConfigContent) {\n function showInstructions() {\n return showCopyPasteInstructions({\n filename: APP_CONFIG_JSON,\n codeSnippet: getSentryAppConfigJsonCodeSnippet(options),\n hint: 'This ensures auto upload of source maps during native app build.',\n });\n }\n\n const appConfigJsonExists = fs.existsSync(APP_CONFIG_JSON);\n\n Sentry.setTag(\n 'app-config-file-status',\n appConfigJsonExists ? 'found' : 'not-found',\n );\n if (!appConfigJsonExists) {\n return await showInstructions();\n }\n\n const patched = await patchAppConfigJson(APP_CONFIG_JSON, options);\n if (!patched) {\n Sentry.setTag('app-config-file-status', 'patch-error');\n clack.log.error(`Unable to patch ${chalk.cyan('app.config.json')}.`);\n return await showInstructions();\n }\n}\n\nasync function patchAppConfigJson(\n path: string,\n options: RNCliSetupConfigContent,\n): Promise<boolean> {\n const appConfigContent = (\n await fs.promises.readFile(path, { encoding: 'utf-8' })\n ).toString();\n const patchedContent = traceStep('app-config-json-patch', () =>\n addWithSentryToAppConfigJson(appConfigContent, options),\n );\n if (patchedContent === null) {\n return false;\n }\n\n try {\n await fs.promises.writeFile(path, patchedContent);\n } catch (error) {\n Sentry.setTag('app-config-file-status', 'json-write-error');\n clack.log.error(`Unable to write ${chalk.cyan('app.config.json')}.`);\n Sentry.captureException(`Unable to write 'app.config.json'.`);\n return false;\n }\n Sentry.setTag('app-config-file-status', 'json-write-success');\n clack.log.success(\n `Added Sentry Expo plugin to ${chalk.cyan('app.config.json')}.`,\n );\n return true;\n}\n\nexport function addWithSentryToAppConfigJson(\n appConfigContent: string,\n options: RNCliSetupConfigContent,\n): string | null {\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const parsedAppConfig: AppConfigJson = JSON.parse(appConfigContent);\n const includesWithSentry =\n appConfigContent.includes(SENTRY_EXPO_PLUGIN_NAME) ||\n appConfigContent.includes(DEPRECATED_SENTRY_EXPO_PLUGIN_NAME);\n\n if (includesWithSentry) {\n Sentry.setTag('app-config-file-status', 'already-patched');\n clack.log.warn(\n `Your ${chalk.cyan(\n 'app.config.json',\n )} already includes the Sentry Expo plugin.`,\n );\n return null;\n }\n\n if (\n parsedAppConfig.expo !== undefined &&\n !isPlainObject(parsedAppConfig.expo)\n ) {\n Sentry.setTag('app-config-file-status', 'invalid-json');\n clack.log.error(\n `Unable to find expo in your ${chalk.cyan(\n 'app.config.json',\n )}. Make sure it has a valid format!`,\n );\n return null;\n }\n if (\n parsedAppConfig.expo &&\n parsedAppConfig.expo.plugins !== undefined &&\n !Array.isArray(parsedAppConfig.expo.plugins)\n ) {\n Sentry.setTag('app-config-file-status', 'invalid-json');\n clack.log.error(\n `Unable to find expo plugins in your ${chalk.cyan(\n 'app.config.json',\n )}. Make sure it has a valid format!`,\n );\n return null;\n }\n\n parsedAppConfig.expo = parsedAppConfig.expo ?? {};\n parsedAppConfig.expo.plugins = parsedAppConfig.expo.plugins ?? [];\n parsedAppConfig.expo.plugins.push([\n SENTRY_EXPO_PLUGIN_NAME,\n {\n url: options.url,\n project: options.project,\n organization: options.org,\n },\n ]);\n\n return JSON.stringify(parsedAppConfig, null, 2) + EOL;\n } catch (error) {\n Sentry.setTag('app-config-file-status', 'invalid-json');\n clack.log.error(\n `Unable to parse your ${chalk.cyan(\n 'app.config.json',\n )}. Make sure it has a valid format!`,\n );\n Sentry.captureException(`Error to parsing 'app.config.json'`);\n return null;\n }\n}\n\nexport function getSentryAppConfigJsonCodeSnippet({\n url,\n project,\n org,\n}: Omit<RNCliSetupConfigContent, 'authToken'>) {\n return makeCodeSnippet(true, (unchanged, plus, _minus) => {\n return unchanged(`{\n \"name\": \"my app\",\n \"plugins\": [\n ${plus(`[\n \"@sentry/react-native/expo\",\n {\n \"url\": \"${url}\",\n \"project\": \"${project}\",\n \"organization\": \"${org}\"\n }\n ]`)}\n ],\n}`);\n });\n}\n"]}
1
+ {"version":3,"file":"expo.js","sourceRoot":"","sources":["../../../src/react-native/expo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,sDAAwC;AACxC,kDAA0B;AAC1B,uCAAyB;AACzB,2BAAyB;AAEzB,qDAAuC;AACvC,0CAA4E;AAE5E,4CAAyC;AAE5B,QAAA,uBAAuB,GAAG,2BAA2B,CAAC;AACtD,QAAA,kCAAkC,GAAG,aAAa,CAAC;AAEnD,QAAA,2BAA2B,GAAG,YAAY,CAAC;AAExD,MAAM,eAAe,GA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AC,CAAC;QACxD,KAAK,CAAC,GAAG,CAAC,KAAK,CACb,wBAAwB,eAAK,CAAC,IAAI,CAChC,iBAAiB,CAClB,oCAAoC,CACtC,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,oCAAoC,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AArED,oEAqEC;AAED,SAAgB,iCAAiC,CAAC,EAChD,GAAG,EACH,OAAO,EACP,GAAG,GACwC;IAC3C,OAAO,IAAA,uBAAe,EAAC,IAAI,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACvD,OAAO,SAAS,CAAC;;;MAGf,IAAI,CAAC;;;kBAGO,GAAG;sBACC,OAAO;2BACF,GAAG;;MAExB,CAAC;;EAEL,CAAC,CAAC;IACF,CAAC,CAAC,CAAC;AACL,CAAC;AApBD,8EAoBC;AAED;;;GAGG;AACH,SAAS,aAAa,CAAC,IAAa;IAClC,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,iBAAiB,CAAC;AACpE,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as fs from 'fs';\nimport { EOL } from 'os';\n\nimport * as Sentry from '@sentry/node';\nimport { makeCodeSnippet, showCopyPasteInstructions } from '../utils/clack';\nimport { RNCliSetupConfigContent } from './react-native-wizard';\nimport { traceStep } from '../telemetry';\n\nexport const SENTRY_EXPO_PLUGIN_NAME = '@sentry/react-native/expo';\nexport const DEPRECATED_SENTRY_EXPO_PLUGIN_NAME = 'sentry-expo';\n\nexport const SENTRY_PLUGIN_FUNCTION_NAME = 'withSentry';\n\nconst APP_CONFIG_JSON = `app.json`;\n\nexport interface AppConfigJson {\n expo?: {\n plugins?: Array<[string, undefined | Record<string, unknown>]>;\n };\n}\n\nexport function printSentryExpoMigrationOutro(): void {\n clack.outro(\n `Deprecated ${chalk.cyan(\n 'sentry-expo',\n )} package installed in your dependencies. Please follow the migration guide at ${chalk.cyan(\n 'https://docs.sentry.io/platforms/react-native/migration/sentry-expo/',\n )}`,\n );\n}\n\n/**\n * Finds app.json in the project root and add Sentry Expo `withSentry` plugin.\n */\nexport async function patchExpoAppConfig(options: RNCliSetupConfigContent) {\n function showInstructions() {\n return showCopyPasteInstructions({\n filename: APP_CONFIG_JSON,\n codeSnippet: getSentryAppConfigJsonCodeSnippet(options),\n hint: 'This ensures auto upload of source maps during native app build.',\n });\n }\n\n const appConfigJsonExists = fs.existsSync(APP_CONFIG_JSON);\n\n Sentry.setTag(\n 'app-config-file-status',\n appConfigJsonExists ? 'found' : 'not-found',\n );\n if (!appConfigJsonExists) {\n return await showInstructions();\n }\n\n const patched = await patchAppConfigJson(APP_CONFIG_JSON, options);\n if (!patched) {\n Sentry.setTag('app-config-file-status', 'patch-error');\n clack.log.error(`Unable to patch ${chalk.cyan('app.config.json')}.`);\n return await showInstructions();\n }\n}\n\nasync function patchAppConfigJson(\n path: string,\n options: RNCliSetupConfigContent,\n): Promise<boolean> {\n const appConfigContent = (\n await fs.promises.readFile(path, { encoding: 'utf-8' })\n ).toString();\n const patchedContent = traceStep('app-config-json-patch', () =>\n addWithSentryToAppConfigJson(appConfigContent, options),\n );\n if (patchedContent === null) {\n return false;\n }\n\n try {\n await fs.promises.writeFile(path, patchedContent);\n } catch (error) {\n Sentry.setTag('app-config-file-status', 'json-write-error');\n clack.log.error(`Unable to write ${chalk.cyan('app.config.json')}.`);\n Sentry.captureException(`Unable to write 'app.config.json'.`);\n return false;\n }\n Sentry.setTag('app-config-file-status', 'json-write-success');\n clack.log.success(\n `Added Sentry Expo plugin to ${chalk.cyan('app.config.json')}.`,\n );\n return true;\n}\n\nexport function addWithSentryToAppConfigJson(\n appConfigContent: string,\n options: RNCliSetupConfigContent,\n): string | null {\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const parsedAppConfig: AppConfigJson = JSON.parse(appConfigContent);\n const includesWithSentry =\n appConfigContent.includes(SENTRY_EXPO_PLUGIN_NAME) ||\n appConfigContent.includes(DEPRECATED_SENTRY_EXPO_PLUGIN_NAME);\n\n if (includesWithSentry) {\n Sentry.setTag('app-config-file-status', 'already-patched');\n clack.log.warn(\n `Your ${chalk.cyan(\n 'app.config.json',\n )} already includes the Sentry Expo plugin.`,\n );\n return null;\n }\n\n if (\n parsedAppConfig.expo !== undefined &&\n !isPlainObject(parsedAppConfig.expo)\n ) {\n Sentry.setTag('app-config-file-status', 'invalid-json');\n clack.log.error(\n `Unable to find expo in your ${chalk.cyan(\n 'app.config.json',\n )}. Make sure it has a valid format!`,\n );\n return null;\n }\n if (\n parsedAppConfig.expo &&\n parsedAppConfig.expo.plugins !== undefined &&\n !Array.isArray(parsedAppConfig.expo.plugins)\n ) {\n Sentry.setTag('app-config-file-status', 'invalid-json');\n clack.log.error(\n `Unable to find expo plugins in your ${chalk.cyan(\n 'app.config.json',\n )}. Make sure it has a valid format!`,\n );\n return null;\n }\n\n parsedAppConfig.expo = parsedAppConfig.expo ?? {};\n parsedAppConfig.expo.plugins = parsedAppConfig.expo.plugins ?? [];\n parsedAppConfig.expo.plugins.push([\n SENTRY_EXPO_PLUGIN_NAME,\n {\n url: options.url,\n project: options.project,\n organization: options.org,\n },\n ]);\n\n return JSON.stringify(parsedAppConfig, null, 2) + EOL;\n } catch (error) {\n Sentry.setTag('app-config-file-status', 'invalid-json');\n clack.log.error(\n `Unable to parse your ${chalk.cyan(\n 'app.config.json',\n )}. Make sure it has a valid format!`,\n );\n Sentry.captureException(`Error to parsing 'app.config.json'`);\n return null;\n }\n}\n\nexport function getSentryAppConfigJsonCodeSnippet({\n url,\n project,\n org,\n}: Omit<RNCliSetupConfigContent, 'authToken'>) {\n return makeCodeSnippet(true, (unchanged, plus, _minus) => {\n return unchanged(`{\n \"name\": \"my app\",\n \"plugins\": [\n ${plus(`[\n \"@sentry/react-native/expo\",\n {\n \"url\": \"${url}\",\n \"project\": \"${project}\",\n \"organization\": \"${org}\"\n }\n ]`)}\n ],\n}`);\n });\n}\n\n/**\n * Checks whether the given value is a plain object (as opposed to something like a class instance or a primitive).\n * vendored from @sentry/utils to avoid registering the dependency.\n */\nfunction isPlainObject(what: unknown): boolean {\n return Object.prototype.toString.call(what) === '[object Object]';\n}\n"]}
@@ -1 +1 @@
1
- export declare const WIZARD_VERSION = "5.2.0";
1
+ export declare const WIZARD_VERSION = "5.3.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 = '5.2.0';
6
+ exports.WIZARD_VERSION = '5.3.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 = '5.2.0';\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 = '5.3.0';\n"]}
@@ -35,6 +35,7 @@ void main() {
35
35
  const selectedFeaturesMap = {
36
36
  tracing: true,
37
37
  profiling: true,
38
+ replay: true,
38
39
  };
39
40
  const simpleRunAppPatched = `import 'package:flutter/widgets.dart';
40
41
  import 'package:sentry_flutter/sentry_flutter.dart';
@@ -1 +1 @@
1
- {"version":3,"file":"code-tools.test.js","sourceRoot":"","sources":["../../../test/flutter/code-tools.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,6DAKsC;AACtC,2DAA0D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,IAAA,eAAM,EAAC,IAAA,sCAAyB,EAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAC1C,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CACpC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n patchMainContent,\n getDependenciesLocation,\n getDevDependenciesLocation,\n getLastImportLineLocation,\n} from '../../src/flutter/code-tools';\nimport { initSnippet } from '../../src/flutter/templates';\n\ndescribe('code-tools', () => {\n const pubspec = `name: flutter_example\ndescription: An example flutter app.\nversion: 1.0.0\npublish_to: 'none' # Remove this line if you wish to publish to pub.dev\n\nenvironment:\n sdk: '>=2.17.0 <4.0.0'\n flutter: '>=3.0.0'\n\ndependencies:\n flutter:\n sdk: flutter\n\ndev_dependencies:\n flutter_lints: ^2.0.0\n`;\n\n const simpleRunApp = `import 'package:flutter/widgets.dart';\n\nvoid main() {\n runApp(const MyApp());\n}\n`;\n\n const asyncRunApp = `import 'package:flutter/widgets.dart';\n\nvoid main() {\n runApp(const MyApp());\n}\n`;\n\n const selectedFeaturesMap = {\n tracing: true,\n profiling: true,\n };\n\n const simpleRunAppPatched = `import 'package:flutter/widgets.dart';\nimport 'package:sentry_flutter/sentry_flutter.dart';\n\nFuture<void> main() async {\n ${initSnippet('dsn', selectedFeaturesMap, 'const MyApp()')}\n}\n`;\n\n const paramRunApp = `import 'package:flutter/widgets.dart';\n\nFuture<void> main() async {\n await someFunction();\n runApp(MyApp(param: SomeParam()));\n await anotherFunction();\n}\n`;\n\n const paramRunAppPatched = `import 'package:flutter/widgets.dart';\nimport 'package:sentry_flutter/sentry_flutter.dart';\n\nFuture<void> main() async {\n await someFunction();\n ${initSnippet('dsn', selectedFeaturesMap, 'MyApp(param: SomeParam())')}\n await anotherFunction();\n}\n`;\n\n const multilineRunApp = `import 'package:flutter/widgets.dart';\n\nvoid main() {\n runApp(\n MyApp(\n param: Param(),\n multi: Another(1),\n line: await bites(the: \"dust\"),\n ),\n );\n anotherFunction();\n}\n`;\n\n const multilineRunAppPatched = `import 'package:flutter/widgets.dart';\nimport 'package:sentry_flutter/sentry_flutter.dart';\n\nFuture<void> main() async {\n ${initSnippet(\n 'dsn',\n selectedFeaturesMap,\n `\n MyApp(\n param: Param(),\n multi: Another(1),\n line: await bites(the: \"dust\"),\n ),\n `,\n )}\n anotherFunction();\n}\n`;\n\n describe('patchMainContent', () => {\n it('wraps simple runApp', () => {\n expect(patchMainContent('dsn', simpleRunApp, selectedFeaturesMap)).toBe(\n simpleRunAppPatched,\n );\n });\n\n it('wraps async runApp', () => {\n expect(patchMainContent('dsn', asyncRunApp, selectedFeaturesMap)).toBe(\n simpleRunAppPatched,\n );\n });\n\n it('wraps runApp with parameterized app', () => {\n expect(patchMainContent('dsn', paramRunApp, selectedFeaturesMap)).toBe(\n paramRunAppPatched,\n );\n });\n\n it('wraps multiline runApp', () => {\n expect(\n patchMainContent('dsn', multilineRunApp, selectedFeaturesMap),\n ).toBe(multilineRunAppPatched);\n });\n });\n\n describe('pubspec', () => {\n it('returns proper line index for dependencies', () => {\n expect(getDependenciesLocation(pubspec)).toBe(\n pubspec.indexOf(' flutter:\\n'),\n );\n });\n\n it('returns proper line index for dev-dependencies', () => {\n expect(getDevDependenciesLocation(pubspec)).toBe(\n pubspec.indexOf(' flutter_lints: ^2.0.0\\n'),\n );\n });\n });\n\n describe('getLastImportLineLocation', () => {\n it('returns proper line index', () => {\n const code =\n `import 'foo:bar';\\n` + `//<insert-location>\\n` + `class X {}`;\n expect(getLastImportLineLocation(code)).toBe(\n code.indexOf('//<insert-location>'),\n );\n });\n\n it('returns proper line index when alias import is used', () => {\n const code =\n `import 'package:my_library/utils.dart' as utils;\\n` +\n `//<insert-location>\\n` +\n `class X {}`;\n expect(getLastImportLineLocation(code)).toBe(\n code.indexOf('//<insert-location>'),\n );\n });\n\n it('returns proper line index when specific parts import is used', () => {\n const code =\n `import 'dart:math' show pi, sin;\\n` +\n `//<insert-location>\\n` +\n `class X {}`;\n expect(getLastImportLineLocation(code)).toBe(\n code.indexOf('//<insert-location>'),\n );\n });\n\n it('returns proper line index when hide import is used', () => {\n const code =\n `import 'dart:math' hide Random;\\n` +\n `//<insert-location>\\n` +\n `class X {}`;\n expect(getLastImportLineLocation(code)).toBe(\n code.indexOf('//<insert-location>'),\n );\n });\n\n it('returns proper line index when deferred import is used', () => {\n const code =\n `import 'package:my_library/large_library.dart' deferred as largeLibrary;\\n` +\n `//<insert-location>\\n` +\n `class X {}`;\n expect(getLastImportLineLocation(code)).toBe(\n code.indexOf('//<insert-location>'),\n );\n });\n\n it('returns proper line index when multiple imports (with newlines) are present', () => {\n const code =\n `import 'foo:bar';\\n` +\n `import 'package:my_library/utils.dart' as utils;\\n` +\n `import 'dart:math' show pi, sin;\\n` +\n `import 'dart:math' hide Random;\\n` +\n `\\n` +\n `import 'package:my_library/large_library.dart' deferred as largeLibrary;\\n` +\n `//<insert-location>\\n` +\n `class X {}`;\n expect(getLastImportLineLocation(code)).toBe(\n code.indexOf('//<insert-location>'),\n );\n });\n });\n});\n"]}
1
+ {"version":3,"file":"code-tools.test.js","sourceRoot":"","sources":["../../../test/flutter/code-tools.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,6DAKsC;AACtC,2DAA0D;AAE1D,IAAA,iBAAQ,EAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;CAejB,CAAC;IAEA,MAAM,YAAY,GAAG;;;;;CAKtB,CAAC;IAEA,MAAM,WAAW,GAAG;;;;;CAKrB,CAAC;IAEA,MAAM,mBAAmB,GAAG;QAC1B,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,IAAI;KACb,CAAC;IAEF,MAAM,mBAAmB,GAAG;;;;IAI1B,IAAA,uBAAW,EAAC,KAAK,EAAE,mBAAmB,EAAE,eAAe,CAAC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AAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAC1C,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CACpC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,oDAAoD,EAAE,GAAG,EAAE;YAC5D,MAAM,IAAI,GACR,mCAAmC;gBACnC,uBAAuB;gBACvB,YAAY,CAAC;YACf,IAAA,eAAM,EAAC,IAAA,sCAAyB,EAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAC1C,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CACpC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,wDAAwD,EAAE,GAAG,EAAE;YAChE,MAAM,IAAI,GACR,4EAA4E;gBAC5E,uBAAuB;gBACvB,YAAY,CAAC;YACf,IAAA,eAAM,EAAC,IAAA,sCAAyB,EAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAC1C,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CACpC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,6EAA6E,EAAE,GAAG,EAAE;YACrF,MAAM,IAAI,GACR,qBAAqB;gBACrB,oDAAoD;gBACpD,oCAAoC;gBACpC,mCAAmC;gBACnC,IAAI;gBACJ,4EAA4E;gBAC5E,uBAAuB;gBACvB,YAAY,CAAC;YACf,IAAA,eAAM,EAAC,IAAA,sCAAyB,EAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAC1C,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CACpC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n patchMainContent,\n getDependenciesLocation,\n getDevDependenciesLocation,\n getLastImportLineLocation,\n} from '../../src/flutter/code-tools';\nimport { initSnippet } from '../../src/flutter/templates';\n\ndescribe('code-tools', () => {\n const pubspec = `name: flutter_example\ndescription: An example flutter app.\nversion: 1.0.0\npublish_to: 'none' # Remove this line if you wish to publish to pub.dev\n\nenvironment:\n sdk: '>=2.17.0 <4.0.0'\n flutter: '>=3.0.0'\n\ndependencies:\n flutter:\n sdk: flutter\n\ndev_dependencies:\n flutter_lints: ^2.0.0\n`;\n\n const simpleRunApp = `import 'package:flutter/widgets.dart';\n\nvoid main() {\n runApp(const MyApp());\n}\n`;\n\n const asyncRunApp = `import 'package:flutter/widgets.dart';\n\nvoid main() {\n runApp(const MyApp());\n}\n`;\n\n const selectedFeaturesMap = {\n tracing: true,\n profiling: true,\n replay: true,\n };\n\n const simpleRunAppPatched = `import 'package:flutter/widgets.dart';\nimport 'package:sentry_flutter/sentry_flutter.dart';\n\nFuture<void> main() async {\n ${initSnippet('dsn', selectedFeaturesMap, 'const MyApp()')}\n}\n`;\n\n const paramRunApp = `import 'package:flutter/widgets.dart';\n\nFuture<void> main() async {\n await someFunction();\n runApp(MyApp(param: SomeParam()));\n await anotherFunction();\n}\n`;\n\n const paramRunAppPatched = `import 'package:flutter/widgets.dart';\nimport 'package:sentry_flutter/sentry_flutter.dart';\n\nFuture<void> main() async {\n await someFunction();\n ${initSnippet('dsn', selectedFeaturesMap, 'MyApp(param: SomeParam())')}\n await anotherFunction();\n}\n`;\n\n const multilineRunApp = `import 'package:flutter/widgets.dart';\n\nvoid main() {\n runApp(\n MyApp(\n param: Param(),\n multi: Another(1),\n line: await bites(the: \"dust\"),\n ),\n );\n anotherFunction();\n}\n`;\n\n const multilineRunAppPatched = `import 'package:flutter/widgets.dart';\nimport 'package:sentry_flutter/sentry_flutter.dart';\n\nFuture<void> main() async {\n ${initSnippet(\n 'dsn',\n selectedFeaturesMap,\n `\n MyApp(\n param: Param(),\n multi: Another(1),\n line: await bites(the: \"dust\"),\n ),\n `,\n )}\n anotherFunction();\n}\n`;\n\n describe('patchMainContent', () => {\n it('wraps simple runApp', () => {\n expect(patchMainContent('dsn', simpleRunApp, selectedFeaturesMap)).toBe(\n simpleRunAppPatched,\n );\n });\n\n it('wraps async runApp', () => {\n expect(patchMainContent('dsn', asyncRunApp, selectedFeaturesMap)).toBe(\n simpleRunAppPatched,\n );\n });\n\n it('wraps runApp with parameterized app', () => {\n expect(patchMainContent('dsn', paramRunApp, selectedFeaturesMap)).toBe(\n paramRunAppPatched,\n );\n });\n\n it('wraps multiline runApp', () => {\n expect(\n patchMainContent('dsn', multilineRunApp, selectedFeaturesMap),\n ).toBe(multilineRunAppPatched);\n });\n });\n\n describe('pubspec', () => {\n it('returns proper line index for dependencies', () => {\n expect(getDependenciesLocation(pubspec)).toBe(\n pubspec.indexOf(' flutter:\\n'),\n );\n });\n\n it('returns proper line index for dev-dependencies', () => {\n expect(getDevDependenciesLocation(pubspec)).toBe(\n pubspec.indexOf(' flutter_lints: ^2.0.0\\n'),\n );\n });\n });\n\n describe('getLastImportLineLocation', () => {\n it('returns proper line index', () => {\n const code =\n `import 'foo:bar';\\n` + `//<insert-location>\\n` + `class X {}`;\n expect(getLastImportLineLocation(code)).toBe(\n code.indexOf('//<insert-location>'),\n );\n });\n\n it('returns proper line index when alias import is used', () => {\n const code =\n `import 'package:my_library/utils.dart' as utils;\\n` +\n `//<insert-location>\\n` +\n `class X {}`;\n expect(getLastImportLineLocation(code)).toBe(\n code.indexOf('//<insert-location>'),\n );\n });\n\n it('returns proper line index when specific parts import is used', () => {\n const code =\n `import 'dart:math' show pi, sin;\\n` +\n `//<insert-location>\\n` +\n `class X {}`;\n expect(getLastImportLineLocation(code)).toBe(\n code.indexOf('//<insert-location>'),\n );\n });\n\n it('returns proper line index when hide import is used', () => {\n const code =\n `import 'dart:math' hide Random;\\n` +\n `//<insert-location>\\n` +\n `class X {}`;\n expect(getLastImportLineLocation(code)).toBe(\n code.indexOf('//<insert-location>'),\n );\n });\n\n it('returns proper line index when deferred import is used', () => {\n const code =\n `import 'package:my_library/large_library.dart' deferred as largeLibrary;\\n` +\n `//<insert-location>\\n` +\n `class X {}`;\n expect(getLastImportLineLocation(code)).toBe(\n code.indexOf('//<insert-location>'),\n );\n });\n\n it('returns proper line index when multiple imports (with newlines) are present', () => {\n const code =\n `import 'foo:bar';\\n` +\n `import 'package:my_library/utils.dart' as utils;\\n` +\n `import 'dart:math' show pi, sin;\\n` +\n `import 'dart:math' hide Random;\\n` +\n `\\n` +\n `import 'package:my_library/large_library.dart' deferred as largeLibrary;\\n` +\n `//<insert-location>\\n` +\n `class X {}`;\n expect(getLastImportLineLocation(code)).toBe(\n code.indexOf('//<insert-location>'),\n );\n });\n });\n});\n"]}
@@ -27,6 +27,7 @@ const templates_1 = require("../../src/flutter/templates");
27
27
  const template = (0, templates_1.initSnippet)('my-dsn', {
28
28
  tracing: true,
29
29
  profiling: true,
30
+ replay: true,
30
31
  }, 'const MyApp()');
31
32
  (0, vitest_1.expect)(template).toMatchInlineSnapshot(`
32
33
  "await SentryFlutter.init(
@@ -41,6 +42,9 @@ const templates_1 = require("../../src/flutter/templates");
41
42
  // The sampling rate for profiling is relative to tracesSampleRate
42
43
  // Setting to 1.0 will profile 100% of sampled transactions:
43
44
  options.profilesSampleRate = 1.0;
45
+ // Configure Session Replay
46
+ options.replay.sessionSampleRate = 0.1;
47
+ options.replay.onErrorSampleRate = 1.0;
44
48
  },
45
49
  appRunner: () => runApp(SentryWidget(child: const MyApp())),
46
50
  );
@@ -48,10 +52,11 @@ const templates_1 = require("../../src/flutter/templates");
48
52
  await Sentry.captureException(StateError('This is a sample exception.'));"
49
53
  `);
50
54
  });
51
- (0, vitest_1.it)('generates Sentry config with profiling disabled', () => {
55
+ (0, vitest_1.it)('generates Sentry config with profiling & replay disabled', () => {
52
56
  const template = (0, templates_1.initSnippet)('my-dsn', {
53
57
  tracing: true,
54
58
  profiling: false,
59
+ replay: false,
55
60
  }, 'const MyApp()');
56
61
  (0, vitest_1.expect)(template).toMatchInlineSnapshot(`
57
62
  "await SentryFlutter.init(
@@ -70,10 +75,11 @@ const templates_1 = require("../../src/flutter/templates");
70
75
  await Sentry.captureException(StateError('This is a sample exception.'));"
71
76
  `);
72
77
  });
73
- (0, vitest_1.it)('generates Sentry config with tracing disabled', () => {
78
+ (0, vitest_1.it)('generates Sentry config with tracing, profiling & replay disabled', () => {
74
79
  const template = (0, templates_1.initSnippet)('my-dsn', {
75
80
  tracing: false,
76
81
  profiling: false,
82
+ replay: false,
77
83
  }, 'const MyApp()');
78
84
  (0, vitest_1.expect)(template).toMatchInlineSnapshot(`
79
85
  "await SentryFlutter.init(
@@ -1 +1 @@
1
- {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/flutter/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,2DAIqC;AAErC,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,iBAAQ,EAAC,SAAS,EAAE,GAAG,EAAE;QACvB,IAAA,WAAE,EAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,MAAM,QAAQ,GAAG,IAAA,0BAAc,EAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;YAClE,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;aAOhC,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,IAAA,iBAAQ,EAAC,mBAAmB,EAAE,GAAG,EAAE;QACjC,IAAA,WAAE,EAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,MAAM,QAAQ,GAAG,IAAA,4BAAgB,EAAC,eAAe,CAAC,CAAC;YACnD,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,4BAA4B,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,IAAA,iBAAQ,EAAC,MAAM,EAAE,GAAG,EAAE;QACpB,IAAA,WAAE,EAAC,mDAAmD,EAAE,GAAG,EAAE;YAC3D,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAC1B,QAAQ,EACR;gBACE,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,IAAI;aAChB,EACD,eAAe,CAChB,CAAC;YACF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;OAkBtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,iDAAiD,EAAE,GAAG,EAAE;YACzD,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAC1B,QAAQ,EACR;gBACE,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,KAAK;aACjB,EACD,eAAe,CAChB,CAAC;YACF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;OAetC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,+CAA+C,EAAE,GAAG,EAAE;YACvD,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAC1B,QAAQ,EACR;gBACE,OAAO,EAAE,KAAK;gBACd,SAAS,EAAE,KAAK;aACjB,EACD,eAAe,CAChB,CAAC;YACF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;OAYtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n pubspecOptions,\n sentryProperties,\n initSnippet,\n} from '../../src/flutter/templates';\n\ndescribe('Flutter code templates', () => {\n describe('pubspec', () => {\n it('generates pubspec with project and org', () => {\n const template = pubspecOptions('fixture-project', 'fixture-org');\n expect(template).toMatchInlineSnapshot(`\n \"sentry:\n upload_debug_symbols: true\n upload_source_maps: true\n project: fixture-project\n org: fixture-org\n \"\n `);\n });\n });\n describe('sentry.properties', () => {\n it('generates sentry.properties with token', () => {\n const template = sentryProperties('fixture-token');\n expect(template).toMatchInlineSnapshot(`\"auth_token=fixture-token\"`);\n });\n });\n describe('init', () => {\n it('generates Sentry config with all features enabled', () => {\n const template = initSnippet(\n 'my-dsn',\n {\n tracing: true,\n profiling: true,\n },\n 'const MyApp()',\n );\n expect(template).toMatchInlineSnapshot(`\n \"await SentryFlutter.init(\n (options) {\n options.dsn = 'my-dsn';\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/\n options.sendDefaultPii = true;\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0;\n // The sampling rate for profiling is relative to tracesSampleRate\n // Setting to 1.0 will profile 100% of sampled transactions:\n options.profilesSampleRate = 1.0;\n },\n appRunner: () => runApp(SentryWidget(child: const MyApp())),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(StateError('This is a sample exception.'));\"\n `);\n });\n\n it('generates Sentry config with profiling disabled', () => {\n const template = initSnippet(\n 'my-dsn',\n {\n tracing: true,\n profiling: false,\n },\n 'const MyApp()',\n );\n expect(template).toMatchInlineSnapshot(`\n \"await SentryFlutter.init(\n (options) {\n options.dsn = 'my-dsn';\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/\n options.sendDefaultPii = true;\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0;\n },\n appRunner: () => runApp(SentryWidget(child: const MyApp())),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(StateError('This is a sample exception.'));\"\n `);\n });\n\n it('generates Sentry config with tracing disabled', () => {\n const template = initSnippet(\n 'my-dsn',\n {\n tracing: false,\n profiling: false,\n },\n 'const MyApp()',\n );\n expect(template).toMatchInlineSnapshot(`\n \"await SentryFlutter.init(\n (options) {\n options.dsn = 'my-dsn';\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/\n options.sendDefaultPii = true;\n },\n appRunner: () => runApp(SentryWidget(child: const MyApp())),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(StateError('This is a sample exception.'));\"\n `);\n });\n });\n});\n"]}
1
+ {"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/flutter/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,2DAIqC;AAErC,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,iBAAQ,EAAC,SAAS,EAAE,GAAG,EAAE;QACvB,IAAA,WAAE,EAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,MAAM,QAAQ,GAAG,IAAA,0BAAc,EAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;YAClE,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;aAOhC,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,IAAA,iBAAQ,EAAC,mBAAmB,EAAE,GAAG,EAAE;QACjC,IAAA,WAAE,EAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,MAAM,QAAQ,GAAG,IAAA,4BAAgB,EAAC,eAAe,CAAC,CAAC;YACnD,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,4BAA4B,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,IAAA,iBAAQ,EAAC,MAAM,EAAE,GAAG,EAAE;QACpB,IAAA,WAAE,EAAC,mDAAmD,EAAE,GAAG,EAAE;YAC3D,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAC1B,QAAQ,EACR;gBACE,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,IAAI;gBACf,MAAM,EAAE,IAAI;aACb,EACD,eAAe,CAChB,CAAC;YACF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;OAqBtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,0DAA0D,EAAE,GAAG,EAAE;YAClE,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAC1B,QAAQ,EACR;gBACE,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,KAAK;gBAChB,MAAM,EAAE,KAAK;aACd,EACD,eAAe,CAChB,CAAC;YACF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;OAetC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,mEAAmE,EAAE,GAAG,EAAE;YAC3E,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAC1B,QAAQ,EACR;gBACE,OAAO,EAAE,KAAK;gBACd,SAAS,EAAE,KAAK;gBAChB,MAAM,EAAE,KAAK;aACd,EACD,eAAe,CAChB,CAAC;YACF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;OAYtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n pubspecOptions,\n sentryProperties,\n initSnippet,\n} from '../../src/flutter/templates';\n\ndescribe('Flutter code templates', () => {\n describe('pubspec', () => {\n it('generates pubspec with project and org', () => {\n const template = pubspecOptions('fixture-project', 'fixture-org');\n expect(template).toMatchInlineSnapshot(`\n \"sentry:\n upload_debug_symbols: true\n upload_source_maps: true\n project: fixture-project\n org: fixture-org\n \"\n `);\n });\n });\n describe('sentry.properties', () => {\n it('generates sentry.properties with token', () => {\n const template = sentryProperties('fixture-token');\n expect(template).toMatchInlineSnapshot(`\"auth_token=fixture-token\"`);\n });\n });\n describe('init', () => {\n it('generates Sentry config with all features enabled', () => {\n const template = initSnippet(\n 'my-dsn',\n {\n tracing: true,\n profiling: true,\n replay: true,\n },\n 'const MyApp()',\n );\n expect(template).toMatchInlineSnapshot(`\n \"await SentryFlutter.init(\n (options) {\n options.dsn = 'my-dsn';\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/\n options.sendDefaultPii = true;\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0;\n // The sampling rate for profiling is relative to tracesSampleRate\n // Setting to 1.0 will profile 100% of sampled transactions:\n options.profilesSampleRate = 1.0;\n // Configure Session Replay\n options.replay.sessionSampleRate = 0.1;\n options.replay.onErrorSampleRate = 1.0;\n },\n appRunner: () => runApp(SentryWidget(child: const MyApp())),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(StateError('This is a sample exception.'));\"\n `);\n });\n\n it('generates Sentry config with profiling & replay disabled', () => {\n const template = initSnippet(\n 'my-dsn',\n {\n tracing: true,\n profiling: false,\n replay: false,\n },\n 'const MyApp()',\n );\n expect(template).toMatchInlineSnapshot(`\n \"await SentryFlutter.init(\n (options) {\n options.dsn = 'my-dsn';\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/\n options.sendDefaultPii = true;\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0;\n },\n appRunner: () => runApp(SentryWidget(child: const MyApp())),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(StateError('This is a sample exception.'));\"\n `);\n });\n\n it('generates Sentry config with tracing, profiling & replay disabled', () => {\n const template = initSnippet(\n 'my-dsn',\n {\n tracing: false,\n profiling: false,\n replay: false,\n },\n 'const MyApp()',\n );\n expect(template).toMatchInlineSnapshot(`\n \"await SentryFlutter.init(\n (options) {\n options.dsn = 'my-dsn';\n // Adds request headers and IP for users, for more info visit:\n // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/\n options.sendDefaultPii = true;\n },\n appRunner: () => runApp(SentryWidget(child: const MyApp())),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(StateError('This is a sample exception.'));\"\n `);\n });\n });\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "homepage": "https://github.com/getsentry/sentry-wizard",
5
5
  "repository": "https://github.com/getsentry/sentry-wizard",
6
6
  "description": "Sentry wizard helping you to configure your project",