@sentry/wizard 4.4.0 → 4.6.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 +23 -1
- package/README.md +23 -19
- package/dist/bin.js +13 -0
- package/dist/bin.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-14.test.js +4 -5
- package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-15.test.js +3 -5
- package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
- package/dist/e2e-tests/utils/index.d.ts +1 -1
- package/dist/e2e-tests/utils/index.js +20 -2
- package/dist/e2e-tests/utils/index.js.map +1 -1
- package/dist/lib/Constants.d.ts +2 -0
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Helper/File.d.ts +1 -1
- package/dist/lib/Helper/File.js +1 -3
- package/dist/lib/Helper/File.js.map +1 -1
- package/dist/lib/Helper/Logging.d.ts +3 -0
- package/dist/lib/Helper/Logging.js +3 -0
- package/dist/lib/Helper/Logging.js.map +1 -1
- package/dist/lib/Helper/Package.d.ts +5 -3
- package/dist/lib/Helper/Package.js +2 -2
- package/dist/lib/Helper/Package.js.map +1 -1
- package/dist/lib/Helper/SentryCli.d.ts +20 -7
- package/dist/lib/Helper/SentryCli.js +21 -13
- package/dist/lib/Helper/SentryCli.js.map +1 -1
- package/dist/lib/Helper/Wizard.js +9 -5
- package/dist/lib/Helper/Wizard.js.map +1 -1
- package/dist/lib/Helper/__tests__/SentryCli.js +21 -4
- package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
- package/dist/lib/Setup.d.ts +3 -1
- package/dist/lib/Setup.js.map +1 -1
- package/dist/lib/Steps/Integrations/BaseIntegration.js +1 -2
- package/dist/lib/Steps/Integrations/BaseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/Cordova.js +14 -10
- package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.d.ts +4 -1
- package/dist/lib/Steps/Integrations/Electron.js +1 -1
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/lib/Steps/Integrations/MobileProject.d.ts +3 -1
- package/dist/lib/Steps/Integrations/MobileProject.js +1 -1
- package/dist/lib/Steps/Integrations/MobileProject.js.map +1 -1
- package/dist/lib/Steps/PromptForParameters.d.ts +4 -1
- package/dist/lib/Steps/PromptForParameters.js.map +1 -1
- package/dist/lib/Steps/SentryProjectSelector.d.ts +42 -1
- package/dist/lib/Steps/SentryProjectSelector.js +1 -1
- package/dist/lib/Steps/SentryProjectSelector.js.map +1 -1
- package/dist/lib/Steps/WaitForSentry.d.ts +3 -1
- package/dist/lib/Steps/WaitForSentry.js +4 -4
- package/dist/lib/Steps/WaitForSentry.js.map +1 -1
- package/dist/lib/Types.d.ts +14 -0
- package/dist/lib/Types.js +3 -0
- package/dist/lib/Types.js.map +1 -0
- package/dist/lib/__tests__/Env.js +6 -13
- package/dist/lib/__tests__/Env.js.map +1 -1
- package/dist/src/android/android-wizard.js +15 -12
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/android/code-tools.js +1 -1
- package/dist/src/android/code-tools.js.map +1 -1
- package/dist/src/android/gradle.js +4 -4
- package/dist/src/android/gradle.js.map +1 -1
- package/dist/src/android/manifest.js +1 -1
- package/dist/src/android/manifest.js.map +1 -1
- package/dist/src/apple/apple-wizard.d.ts +2 -2
- package/dist/src/apple/apple-wizard.js +37 -118
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/apple/check-installed-cli.d.ts +1 -0
- package/dist/src/apple/check-installed-cli.js +60 -0
- package/dist/src/apple/check-installed-cli.js.map +1 -0
- package/dist/src/apple/cocoapod.js +1 -1
- package/dist/src/apple/cocoapod.js.map +1 -1
- package/dist/src/apple/code-tools.js +1 -1
- package/dist/src/apple/code-tools.js.map +1 -1
- package/dist/src/apple/configure-fastlane.d.ts +5 -0
- package/dist/src/apple/configure-fastlane.js +66 -0
- package/dist/src/apple/configure-fastlane.js.map +1 -0
- package/dist/src/apple/fastlane.d.ts +1 -1
- package/dist/src/apple/fastlane.js +5 -5
- package/dist/src/apple/fastlane.js.map +1 -1
- package/dist/src/apple/lookup-xcode-project.d.ts +7 -0
- package/dist/src/apple/lookup-xcode-project.js +98 -0
- package/dist/src/apple/lookup-xcode-project.js.map +1 -0
- package/dist/src/apple/options.d.ts +4 -0
- package/dist/src/apple/options.js +3 -0
- package/dist/src/apple/options.js.map +1 -0
- package/dist/src/apple/search-xcode-project-at-path.d.ts +1 -0
- package/dist/src/apple/search-xcode-project-at-path.js +70 -0
- package/dist/src/apple/search-xcode-project-at-path.js.map +1 -0
- package/dist/src/apple/xcode-manager.js +1 -1
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/flutter/code-tools.js +3 -3
- package/dist/src/flutter/code-tools.js.map +1 -1
- package/dist/src/flutter/flutter-wizard.js +21 -15
- package/dist/src/flutter/flutter-wizard.js.map +1 -1
- package/dist/src/flutter/templates.js +4 -4
- package/dist/src/flutter/templates.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +118 -67
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.d.ts +11 -3
- package/dist/src/nextjs/templates.js +193 -71
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/nuxt-wizard.js +21 -16
- package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
- package/dist/src/nuxt/sdk-example.js +3 -3
- package/dist/src/nuxt/sdk-example.js.map +1 -1
- package/dist/src/nuxt/sdk-setup.js +9 -9
- package/dist/src/nuxt/sdk-setup.js.map +1 -1
- package/dist/src/nuxt/templates.js +173 -58
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/nuxt/utils.js +6 -3
- package/dist/src/nuxt/utils.js.map +1 -1
- package/dist/src/react-native/expo-env-file.js +1 -1
- package/dist/src/react-native/expo-env-file.js.map +1 -1
- package/dist/src/react-native/expo-metro.js +4 -4
- package/dist/src/react-native/expo-metro.js.map +1 -1
- package/dist/src/react-native/expo.js +4 -4
- package/dist/src/react-native/expo.js.map +1 -1
- package/dist/src/react-native/javascript.js +7 -7
- package/dist/src/react-native/javascript.js.map +1 -1
- package/dist/src/react-native/metro.js +8 -8
- package/dist/src/react-native/metro.js.map +1 -1
- package/dist/src/react-native/react-native-wizard.d.ts +1 -1
- package/dist/src/react-native/react-native-wizard.js +36 -31
- package/dist/src/react-native/react-native-wizard.js.map +1 -1
- package/dist/src/react-native/uninstall.js +8 -5
- package/dist/src/react-native/uninstall.js.map +1 -1
- package/dist/src/react-native/xcode.d.ts +2 -1
- package/dist/src/react-native/xcode.js +1 -2
- package/dist/src/react-native/xcode.js.map +1 -1
- package/dist/src/remix/codemods/handle-error.js +4 -1
- package/dist/src/remix/codemods/handle-error.js.map +1 -1
- package/dist/src/remix/remix-wizard.js +23 -18
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/remix/sdk-example.js +163 -64
- package/dist/src/remix/sdk-example.js.map +1 -1
- package/dist/src/remix/sdk-setup.js +11 -7
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/run.d.ts +3 -1
- package/dist/src/run.js +29 -9
- package/dist/src/run.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.js +30 -28
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/angular.js +3 -3
- package/dist/src/sourcemaps/tools/angular.js.map +1 -1
- package/dist/src/sourcemaps/tools/create-react-app.js +3 -3
- package/dist/src/sourcemaps/tools/create-react-app.js.map +1 -1
- package/dist/src/sourcemaps/tools/esbuild.js +6 -6
- package/dist/src/sourcemaps/tools/esbuild.js.map +1 -1
- package/dist/src/sourcemaps/tools/nextjs.js +5 -5
- package/dist/src/sourcemaps/tools/nextjs.js.map +1 -1
- package/dist/src/sourcemaps/tools/remix.js +4 -4
- package/dist/src/sourcemaps/tools/remix.js.map +1 -1
- package/dist/src/sourcemaps/tools/rollup.js +6 -6
- package/dist/src/sourcemaps/tools/rollup.js.map +1 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js +23 -16
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/tools/tsc.js +6 -6
- package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
- package/dist/src/sourcemaps/tools/vite.js +12 -12
- package/dist/src/sourcemaps/tools/vite.js.map +1 -1
- package/dist/src/sourcemaps/tools/webpack.js +10 -10
- package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
- package/dist/src/sourcemaps/utils/detect-tool.js +2 -2
- package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
- package/dist/src/sourcemaps/utils/other-wizards.js +5 -5
- package/dist/src/sourcemaps/utils/other-wizards.js.map +1 -1
- package/dist/src/sourcemaps/utils/sdk-version.js +7 -7
- package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -1
- package/dist/src/sveltekit/sdk-example.js +1 -1
- package/dist/src/sveltekit/sdk-example.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup.js +15 -14
- package/dist/src/sveltekit/sdk-setup.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +25 -20
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/sveltekit/templates.js +126 -37
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/telemetry.js +11 -0
- package/dist/src/telemetry.js.map +1 -1
- package/dist/src/utils/{clack-utils.d.ts → clack/index.d.ts} +54 -15
- package/dist/src/utils/{clack-utils.js → clack/index.js} +107 -24
- package/dist/src/utils/clack/index.js.map +1 -0
- package/dist/src/utils/debug.js +1 -1
- package/dist/src/utils/debug.js.map +1 -1
- package/dist/src/utils/find-files-with-extension.d.ts +1 -0
- package/dist/src/utils/find-files-with-extension.js +39 -0
- package/dist/src/utils/find-files-with-extension.js.map +1 -0
- package/dist/src/utils/package-manager.d.ts +6 -1
- package/dist/src/utils/package-manager.js +32 -27
- package/dist/src/utils/package-manager.js.map +1 -1
- package/dist/src/utils/sentrycli-utils.js +0 -1
- package/dist/src/utils/sentrycli-utils.js.map +1 -1
- package/dist/src/utils/types.d.ts +4 -0
- package/dist/src/utils/types.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/test/android/code-tools.test.js +0 -1
- package/dist/test/android/code-tools.test.js.map +1 -1
- package/dist/test/apple/cocoapod.test.js +1 -1
- package/dist/test/apple/cocoapod.test.js.map +1 -1
- package/dist/test/apple/code-tools.test.js +1 -1
- package/dist/test/apple/code-tools.test.js.map +1 -1
- package/dist/test/apple/fastfile.test.js +1 -1
- package/dist/test/apple/fastfile.test.js.map +1 -1
- package/dist/test/apple/xcode-manager.test.js +26 -2
- package/dist/test/apple/xcode-manager.test.js.map +1 -1
- package/dist/test/flutter/code-tools.test.js +0 -2
- package/dist/test/flutter/code-tools.test.js.map +1 -1
- package/dist/test/flutter/templates.test.js +23 -23
- package/dist/test/flutter/templates.test.js.map +1 -1
- package/dist/test/nextjs/templates.test.js +127 -133
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/react-native/expo-metro.test.js +1 -1
- package/dist/test/react-native/expo-metro.test.js.map +1 -1
- package/dist/test/react-native/javascript.test.js +1 -1
- package/dist/test/react-native/javascript.test.js.map +1 -1
- package/dist/test/react-native/metro.test.js +1 -1
- package/dist/test/react-native/metro.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/sentry-cli.test.js +14 -3
- package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -1
- package/dist/test/utils/{clack-utils.test.js → clack/index.test.js} +131 -41
- package/dist/test/utils/clack/index.test.js.map +1 -0
- package/dist/test/utils/package-manager.test.d.ts +1 -0
- package/dist/test/utils/package-manager.test.js +29 -0
- package/dist/test/utils/package-manager.test.js.map +1 -0
- package/package.json +1 -1
- package/dist/src/utils/clack-utils.js.map +0 -1
- package/dist/test/utils/clack-utils.test.js.map +0 -1
- /package/dist/test/utils/{clack-utils.test.d.ts → clack/index.test.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xcode.js","sourceRoot":"","sources":["../../../src/react-native/xcode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA4D;AAC5D,sDAAsD;AACtD,+DAA+D;AAC/D,4CAA8B;AAC9B,yEAAyE;AACzE,6DAAmC;AACnC,kDAA0B;AAK1B,8DAA8D;AAC9D,SAAgB,2BAA2B,CAAC,YAAiB;IAC3D,MAAM,GAAG,GAAkB,EAAE,CAAC;IAC9B,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,wBAAwB,IAAI,EAAE,CAAC;IAC7E,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE;QACrB,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACrB,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;KAC7B;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AATD,kEASC;AAED,SAAgB,gBAAgB,CAC9B,WAAmC,EACnC,KAAiC;IAEjC,IAAI,CAAC,WAAW,EAAE;QAChB,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,kBAAkB,eAAK,CAAC,IAAI,CAC1B,qCAAqC,CACtC,eAAe,CACjB,CAAC;QACF,OAAO;KACR;IAED,MAAM,yBAAyB,GAAG,4BAA4B,CAAC,WAAW,CAAC,CAAC;IAC5E,IAAI,yBAAyB,EAAE;QAC7B,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,eAAe,eAAK,CAAC,IAAI,CACvB,qCAAqC,CACtC,2BAA2B,CAC7B,CAAC;QACF,OAAO;KACR;IAED,MAAM,MAAM,GAAW,IAAI,CAAC,KAAK,CAAC,WAAW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AC,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,EAAE;QAC7D,MAAM,sBAAsB,GAC1B,OAAO,UAAU,KAAK,QAAQ;YAC9B,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,CAC5B,iDAAiD,CAClD,CAAC;QACJ,MAAM,0BAA0B,GAC9B,OAAO,UAAU,KAAK,QAAQ;YAC9B,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC;QACjE,OAAO,sBAAsB,IAAI,0BAA0B,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC;AAdD,8DAcC;AAED,8DAA8D;AAC9D,SAAgB,iBAAiB,CAAC,gBAAwB,EAAE,YAAiB;IAC3E,MAAM,UAAU,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAG,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IAClE,IAAI,UAAU,KAAK,cAAc,EAAE;QACjC,OAAO;KACR;IAED,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACxD,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,eAAK,CAAC,KAAK,CAAC,iBAAiB,eAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAC5E,CAAC;AACJ,CAAC;AAXD,8CAWC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\nimport * as fs from 'node:fs';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\ntype BuildPhase = { shellScript: string };\ntype BuildPhaseMap = Record<string, BuildPhase>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getValidExistingBuildPhases(xcodeProject: any): BuildPhaseMap {\n const map: BuildPhaseMap = {};\n const raw = xcodeProject.hash.project.objects.PBXShellScriptBuildPhase || {};\n for (const key in raw) {\n const val = raw[key];\n val.isa && (map[key] = val);\n }\n\n return map;\n}\n\nexport function patchBundlePhase(\n bundlePhase: BuildPhase | undefined,\n patch: (script: string) => string,\n) {\n if (!bundlePhase) {\n clack.log.warn(\n `Could not find ${chalk.cyan(\n 'Bundle React Native code and images',\n )} build phase.`,\n );\n return;\n }\n\n const bundlePhaseIncludesSentry = doesBundlePhaseIncludeSentry(bundlePhase);\n if (bundlePhaseIncludesSentry) {\n clack.log.warn(\n `Build phase ${chalk.cyan(\n 'Bundle React Native code and images',\n )} already includes Sentry.`,\n );\n return;\n }\n\n const script: string = JSON.parse(bundlePhase.shellScript);\n bundlePhase.shellScript = JSON.stringify(patch(script));\n clack.log.success(\n `Patched Build phase ${chalk.cyan('Bundle React Native code and images')}.`,\n );\n}\n\nexport function unPatchBundlePhase(bundlePhase: BuildPhase | undefined) {\n if (!bundlePhase) {\n clack.log.warn(\n `Could not find ${chalk.cyan(\n 'Bundle React Native code and images',\n )} build phase.`,\n );\n return;\n }\n\n if (\n !bundlePhase.shellScript.match(/sentry-cli\\s+react-native\\s+xcode/i) &&\n !bundlePhase.shellScript.includes('sentry-xcode.sh')\n ) {\n clack.log.success(\n `Build phase ${chalk.cyan(\n 'Bundle React Native code and images',\n )} does not include Sentry.`,\n );\n return;\n }\n\n bundlePhase.shellScript = JSON.stringify(\n removeSentryFromBundleShellScript(\n <string>JSON.parse(bundlePhase.shellScript),\n ),\n );\n clack.log.success(\n `Build phase ${chalk.cyan(\n 'Bundle React Native code and images',\n )} unpatched successfully.`,\n );\n}\n\nexport function removeSentryFromBundleShellScript(script: string): string {\n return (\n script\n // remove sentry properties export\n .replace(/^export SENTRY_PROPERTIES=sentry.properties\\r?\\n/m, '')\n .replace(\n /^\\/bin\\/sh .*?..\\/node_modules\\/@sentry\\/react-native\\/scripts\\/collect-modules.sh\"?\\r?\\n/m,\n '',\n )\n // unwrap react-native-xcode.sh command. In case someone replaced it\n // entirely with the sentry-cli command we need to put the original\n // version back in.\n .replace(\n /\\.\\.\\/node_modules\\/@sentry\\/cli\\/bin\\/sentry-cli\\s+react-native\\s+xcode\\s+\\$REACT_NATIVE_XCODE/i,\n '$REACT_NATIVE_XCODE',\n )\n .replace(\n // eslint-disable-next-line no-useless-escape\n /\\\"\\/bin\\/sh.*?sentry-xcode.sh\\s+\\$REACT_NATIVE_XCODE/i,\n // eslint-disable-next-line no-useless-escape\n '\"$REACT_NATIVE_XCODE',\n )\n );\n}\n\nexport function findBundlePhase(buildPhases: BuildPhaseMap) {\n return Object.values(buildPhases).find((buildPhase) =>\n buildPhase.shellScript.match(/\\/scripts\\/react-native-xcode\\.sh/i),\n );\n}\n\nexport function doesBundlePhaseIncludeSentry(buildPhase: BuildPhase) {\n const containsSentryCliRNCommand = !!buildPhase.shellScript.match(\n /sentry-cli\\s+react-native\\s+xcode/i,\n );\n const containsBundledScript =\n buildPhase.shellScript.includes('sentry-xcode.sh');\n return containsSentryCliRNCommand || containsBundledScript;\n}\n\nexport function addSentryWithBundledScriptsToBundleShellScript(\n script: string,\n): string {\n const isLikelyPlainReactNativeScript = script.includes('$REACT_NATIVE_XCODE');\n if (isLikelyPlainReactNativeScript) {\n return script.replace(\n '$REACT_NATIVE_XCODE',\n // eslint-disable-next-line no-useless-escape\n '\\\\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\\\\\"',\n );\n }\n\n const isLikelyExpoScript = script.includes('expo');\n if (isLikelyExpoScript) {\n const SENTRY_REACT_NATIVE_XCODE_PATH =\n \"`\\\"$NODE_BINARY\\\" --print \\\"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'\\\"`\";\n return script.replace(\n /^.*?(packager|scripts)\\/react-native-xcode\\.sh\\s*(\\\\'\\\\\\\\\")?/m,\n // eslint-disable-next-line no-useless-escape\n (match: string) => `/bin/sh ${SENTRY_REACT_NATIVE_XCODE_PATH} ${match}`,\n );\n }\n\n return script;\n}\n\nexport function addSentryWithCliToBundleShellScript(script: string): string {\n return (\n 'export SENTRY_PROPERTIES=sentry.properties\\n' +\n 'export EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\\n' +\n script.replace(\n '$REACT_NATIVE_XCODE',\n () =>\n // eslint-disable-next-line no-useless-escape\n '\\\\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\\\"',\n ) +\n '\\n/bin/sh -c \"$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh\"\\n'\n );\n}\n\nexport function addDebugFilesUploadPhaseWithBundledScripts(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xcodeProject: any,\n { debugFilesUploadPhaseExists }: { debugFilesUploadPhaseExists: boolean },\n) {\n if (debugFilesUploadPhaseExists) {\n clack.log.warn(\n `Build phase ${chalk.cyan(\n 'Upload Debug Symbols to Sentry',\n )} already exists.`,\n );\n return;\n }\n\n xcodeProject.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n null,\n {\n shellPath: '/bin/sh',\n shellScript: `/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,\n },\n );\n clack.log.success(\n `Added Build phase ${chalk.cyan('Upload Debug Symbols to Sentry')}.`,\n );\n}\n\nexport function addDebugFilesUploadPhaseWithCli(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xcodeProject: any,\n { debugFilesUploadPhaseExists }: { debugFilesUploadPhaseExists: boolean },\n) {\n if (debugFilesUploadPhaseExists) {\n clack.log.warn(\n `Build phase ${chalk.cyan(\n 'Upload Debug Symbols to Sentry',\n )} already exists.`,\n );\n return;\n }\n\n xcodeProject.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n null,\n {\n shellPath: '/bin/sh',\n shellScript: `\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nif [ -f \"$WITH_ENVIRONMENT\" ]; then\n . \"$WITH_ENVIRONMENT\"\nfi\nexport SENTRY_PROPERTIES=sentry.properties\n[ \"$SENTRY_INCLUDE_NATIVE_SOURCES\" = \"true\" ] && INCLUDE_SOURCES_FLAG=\"--include-sources\" || INCLUDE_SOURCES_FLAG=\"\"\n../node_modules/@sentry/cli/bin/sentry-cli debug-files upload \"$INCLUDE_SOURCES_FLAG\" \"$DWARF_DSYM_FOLDER_PATH\"\n`,\n },\n );\n clack.log.success(\n `Added Build phase ${chalk.cyan('Upload Debug Symbols to Sentry')}.`,\n );\n}\n\nexport function unPatchDebugFilesUploadPhase(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xcodeProject: any,\n) {\n const buildPhasesMap =\n xcodeProject.hash.project.objects.PBXShellScriptBuildPhase || {};\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const debugFilesUploadPhaseResult = findDebugFilesUploadPhase(buildPhasesMap);\n if (!debugFilesUploadPhaseResult) {\n clack.log.success(\n `Build phase ${chalk.cyan('Upload Debug Symbols to Sentry')} not found.`,\n );\n return;\n }\n\n const [debugFilesUploadPhaseKey] = debugFilesUploadPhaseResult;\n const firstTarget: string = xcodeProject.getFirstTarget().uuid;\n const nativeTargets = xcodeProject.hash.project.objects.PBXNativeTarget;\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete buildPhasesMap[debugFilesUploadPhaseKey];\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete buildPhasesMap[`${debugFilesUploadPhaseKey}_comment`];\n const phases = nativeTargets[firstTarget].buildPhases;\n if (phases) {\n for (let i = 0; i < phases.length; i++) {\n if (phases[i].value === debugFilesUploadPhaseKey) {\n phases.splice(i, 1);\n break;\n }\n }\n }\n clack.log.success(\n `Build phase ${chalk.cyan(\n 'Upload Debug Symbols to Sentry',\n )} removed successfully.`,\n );\n}\n\nexport function findDebugFilesUploadPhase(\n buildPhasesMap: Record<string, BuildPhase>,\n): [key: string, buildPhase: BuildPhase] | undefined {\n return Object.entries(buildPhasesMap).find(([_, buildPhase]) => {\n const containsCliDebugUpload =\n typeof buildPhase !== 'string' &&\n !!buildPhase.shellScript.match(\n /sentry-cli\\s+(upload-dsym|debug-files upload)\\b/,\n );\n const containsBundledDebugUpload =\n typeof buildPhase !== 'string' &&\n buildPhase.shellScript.includes('sentry-xcode-debug-files.sh');\n return containsCliDebugUpload || containsBundledDebugUpload;\n });\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function writeXcodeProject(xcodeProjectPath: string, xcodeProject: any) {\n const newContent = xcodeProject.writeSync();\n const currentContent = fs.readFileSync(xcodeProjectPath, 'utf-8');\n if (newContent === currentContent) {\n return;\n }\n\n fs.writeFileSync(xcodeProjectPath, newContent, 'utf-8');\n clack.log.success(\n chalk.green(`Xcode project ${chalk.cyan(xcodeProjectPath)} changes saved.`),\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"xcode.js","sourceRoot":"","sources":["../../../src/react-native/xcode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA4D;AAC5D,sDAAsD;AACtD,+DAA+D;AAC/D,4CAA8B;AAC9B,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAM1B,8DAA8D;AAC9D,SAAgB,2BAA2B,CAAC,YAAiB;IAC3D,MAAM,GAAG,GAAkB,EAAE,CAAC;IAC9B,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,wBAAwB,IAAI,EAAE,CAAC;IAC7E,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE;QACrB,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACrB,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CA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iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,eAAK,CAAC,KAAK,CAAC,iBAAiB,eAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAC5E,CAAC;AACJ,CAAC;AAdD,8CAcC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\nimport * as fs from 'node:fs';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { Project } from 'xcode';\n\ntype BuildPhase = { shellScript: string };\ntype BuildPhaseMap = Record<string, BuildPhase>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getValidExistingBuildPhases(xcodeProject: any): BuildPhaseMap {\n const map: BuildPhaseMap = {};\n const raw = xcodeProject.hash.project.objects.PBXShellScriptBuildPhase || {};\n for (const key in raw) {\n const val = raw[key];\n val.isa && (map[key] = val);\n }\n\n return map;\n}\n\nexport function patchBundlePhase(\n bundlePhase: BuildPhase | undefined,\n patch: (script: string) => string,\n) {\n if (!bundlePhase) {\n clack.log.warn(\n `Could not find ${chalk.cyan(\n 'Bundle React Native code and images',\n )} build phase.`,\n );\n return;\n }\n\n const bundlePhaseIncludesSentry = doesBundlePhaseIncludeSentry(bundlePhase);\n if (bundlePhaseIncludesSentry) {\n clack.log.warn(\n `Build phase ${chalk.cyan(\n 'Bundle React Native code and images',\n )} already includes Sentry.`,\n );\n return;\n }\n\n const script: string = JSON.parse(bundlePhase.shellScript);\n bundlePhase.shellScript = JSON.stringify(patch(script));\n clack.log.success(\n `Patched Build phase ${chalk.cyan('Bundle React Native code and images')}.`,\n );\n}\n\nexport function unPatchBundlePhase(bundlePhase: BuildPhase | undefined) {\n if (!bundlePhase) {\n clack.log.warn(\n `Could not find ${chalk.cyan(\n 'Bundle React Native code and images',\n )} build phase.`,\n );\n return;\n }\n\n if (\n !bundlePhase.shellScript.match(/sentry-cli\\s+react-native\\s+xcode/i) &&\n !bundlePhase.shellScript.includes('sentry-xcode.sh')\n ) {\n clack.log.success(\n `Build phase ${chalk.cyan(\n 'Bundle React Native code and images',\n )} does not include Sentry.`,\n );\n return;\n }\n\n bundlePhase.shellScript = JSON.stringify(\n removeSentryFromBundleShellScript(\n <string>JSON.parse(bundlePhase.shellScript),\n ),\n );\n clack.log.success(\n `Build phase ${chalk.cyan(\n 'Bundle React Native code and images',\n )} unpatched successfully.`,\n );\n}\n\nexport function removeSentryFromBundleShellScript(script: string): string {\n return (\n script\n // remove sentry properties export\n .replace(/^export SENTRY_PROPERTIES=sentry.properties\\r?\\n/m, '')\n .replace(\n /^\\/bin\\/sh .*?..\\/node_modules\\/@sentry\\/react-native\\/scripts\\/collect-modules.sh\"?\\r?\\n/m,\n '',\n )\n // unwrap react-native-xcode.sh command. In case someone replaced it\n // entirely with the sentry-cli command we need to put the original\n // version back in.\n .replace(\n /\\.\\.\\/node_modules\\/@sentry\\/cli\\/bin\\/sentry-cli\\s+react-native\\s+xcode\\s+\\$REACT_NATIVE_XCODE/i,\n '$REACT_NATIVE_XCODE',\n )\n .replace(\n // eslint-disable-next-line no-useless-escape\n /\\\"\\/bin\\/sh.*?sentry-xcode.sh\\s+\\$REACT_NATIVE_XCODE/i,\n // eslint-disable-next-line no-useless-escape\n '\"$REACT_NATIVE_XCODE',\n )\n );\n}\n\nexport function findBundlePhase(buildPhases: BuildPhaseMap) {\n return Object.values(buildPhases).find((buildPhase) =>\n buildPhase.shellScript.match(/\\/scripts\\/react-native-xcode\\.sh/i),\n );\n}\n\nexport function doesBundlePhaseIncludeSentry(buildPhase: BuildPhase) {\n const containsSentryCliRNCommand = !!buildPhase.shellScript.match(\n /sentry-cli\\s+react-native\\s+xcode/i,\n );\n const containsBundledScript =\n buildPhase.shellScript.includes('sentry-xcode.sh');\n return containsSentryCliRNCommand || containsBundledScript;\n}\n\nexport function addSentryWithBundledScriptsToBundleShellScript(\n script: string,\n): string {\n const isLikelyPlainReactNativeScript = script.includes('$REACT_NATIVE_XCODE');\n if (isLikelyPlainReactNativeScript) {\n return script.replace(\n '$REACT_NATIVE_XCODE',\n // eslint-disable-next-line no-useless-escape\n '\\\\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\\\\\"',\n );\n }\n\n const isLikelyExpoScript = script.includes('expo');\n if (isLikelyExpoScript) {\n const SENTRY_REACT_NATIVE_XCODE_PATH =\n \"`\\\"$NODE_BINARY\\\" --print \\\"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'\\\"`\";\n return script.replace(\n /^.*?(packager|scripts)\\/react-native-xcode\\.sh\\s*(\\\\'\\\\\\\\\")?/m,\n // eslint-disable-next-line no-useless-escape\n (match: string) => `/bin/sh ${SENTRY_REACT_NATIVE_XCODE_PATH} ${match}`,\n );\n }\n\n return script;\n}\n\nexport function addSentryWithCliToBundleShellScript(script: string): string {\n return (\n 'export SENTRY_PROPERTIES=sentry.properties\\n' +\n 'export EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\\n' +\n script.replace(\n '$REACT_NATIVE_XCODE',\n () =>\n // eslint-disable-next-line no-useless-escape\n '\\\\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\\\"',\n ) +\n '\\n/bin/sh -c \"$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh\"\\n'\n );\n}\n\nexport function addDebugFilesUploadPhaseWithBundledScripts(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xcodeProject: any,\n { debugFilesUploadPhaseExists }: { debugFilesUploadPhaseExists: boolean },\n) {\n if (debugFilesUploadPhaseExists) {\n clack.log.warn(\n `Build phase ${chalk.cyan(\n 'Upload Debug Symbols to Sentry',\n )} already exists.`,\n );\n return;\n }\n\n xcodeProject.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n null,\n {\n shellPath: '/bin/sh',\n shellScript: `/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,\n },\n );\n clack.log.success(\n `Added Build phase ${chalk.cyan('Upload Debug Symbols to Sentry')}.`,\n );\n}\n\nexport function addDebugFilesUploadPhaseWithCli(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xcodeProject: any,\n { debugFilesUploadPhaseExists }: { debugFilesUploadPhaseExists: boolean },\n) {\n if (debugFilesUploadPhaseExists) {\n clack.log.warn(\n `Build phase ${chalk.cyan(\n 'Upload Debug Symbols to Sentry',\n )} already exists.`,\n );\n return;\n }\n\n xcodeProject.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n null,\n {\n shellPath: '/bin/sh',\n shellScript: `\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nif [ -f \"$WITH_ENVIRONMENT\" ]; then\n . \"$WITH_ENVIRONMENT\"\nfi\nexport SENTRY_PROPERTIES=sentry.properties\n[ \"$SENTRY_INCLUDE_NATIVE_SOURCES\" = \"true\" ] && INCLUDE_SOURCES_FLAG=\"--include-sources\" || INCLUDE_SOURCES_FLAG=\"\"\n../node_modules/@sentry/cli/bin/sentry-cli debug-files upload \"$INCLUDE_SOURCES_FLAG\" \"$DWARF_DSYM_FOLDER_PATH\"\n`,\n },\n );\n clack.log.success(\n `Added Build phase ${chalk.cyan('Upload Debug Symbols to Sentry')}.`,\n );\n}\n\nexport function unPatchDebugFilesUploadPhase(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xcodeProject: any,\n) {\n const buildPhasesMap =\n xcodeProject.hash.project.objects.PBXShellScriptBuildPhase || {};\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const debugFilesUploadPhaseResult = findDebugFilesUploadPhase(buildPhasesMap);\n if (!debugFilesUploadPhaseResult) {\n clack.log.success(\n `Build phase ${chalk.cyan('Upload Debug Symbols to Sentry')} not found.`,\n );\n return;\n }\n\n const [debugFilesUploadPhaseKey] = debugFilesUploadPhaseResult;\n const firstTarget: string = xcodeProject.getFirstTarget().uuid;\n const nativeTargets = xcodeProject.hash.project.objects.PBXNativeTarget;\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete buildPhasesMap[debugFilesUploadPhaseKey];\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete buildPhasesMap[`${debugFilesUploadPhaseKey}_comment`];\n const phases = nativeTargets[firstTarget].buildPhases;\n if (phases) {\n for (let i = 0; i < phases.length; i++) {\n if (phases[i].value === debugFilesUploadPhaseKey) {\n phases.splice(i, 1);\n break;\n }\n }\n }\n clack.log.success(\n `Build phase ${chalk.cyan(\n 'Upload Debug Symbols to Sentry',\n )} removed successfully.`,\n );\n}\n\nexport function findDebugFilesUploadPhase(\n buildPhasesMap: Record<string, BuildPhase>,\n): [key: string, buildPhase: BuildPhase] | undefined {\n return Object.entries(buildPhasesMap).find(([_, buildPhase]) => {\n const containsCliDebugUpload =\n typeof buildPhase !== 'string' &&\n !!buildPhase.shellScript.match(\n /sentry-cli\\s+(upload-dsym|debug-files upload)\\b/,\n );\n const containsBundledDebugUpload =\n typeof buildPhase !== 'string' &&\n buildPhase.shellScript.includes('sentry-xcode-debug-files.sh');\n return containsCliDebugUpload || containsBundledDebugUpload;\n });\n}\n\nexport function writeXcodeProject(\n xcodeProjectPath: string,\n xcodeProject: Project,\n) {\n const newContent = xcodeProject.writeSync();\n const currentContent = fs.readFileSync(xcodeProjectPath, 'utf-8');\n if (newContent === currentContent) {\n return;\n }\n\n fs.writeFileSync(xcodeProjectPath, newContent, 'utf-8');\n clack.log.success(\n chalk.green(`Xcode project ${chalk.cyan(xcodeProjectPath)} changes saved.`),\n );\n}\n"]}
|
|
@@ -36,7 +36,10 @@ const prompts_1 = __importDefault(require("@clack/prompts"));
|
|
|
36
36
|
const chalk_1 = __importDefault(require("chalk"));
|
|
37
37
|
// @ts-expect-error - magicast is ESM and TS complains about that. It works though
|
|
38
38
|
const magicast_1 = require("magicast");
|
|
39
|
-
function instrumentHandleError(
|
|
39
|
+
function instrumentHandleError(
|
|
40
|
+
// MagicAst returns `ProxifiedModule<any>` so therefore we have to use `any` here
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
+
originalEntryServerMod, serverEntryFilename) {
|
|
40
43
|
const originalEntryServerModAST = originalEntryServerMod.$ast;
|
|
41
44
|
const handleErrorFunctionExport = originalEntryServerModAST.body.find((node) => {
|
|
42
45
|
return (node.type === 'ExportNamedDeclaration' &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-error.js","sourceRoot":"","sources":["../../../../src/remix/codemods/handle-error.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAM5D,+CAAiC;AAEjC,4CAAwD;AACxD,oCAA2E;AAE3E,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAE1B,kFAAkF;AAClF,uCAAwC;AAExC,SAAgB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"handle-error.js","sourceRoot":"","sources":["../../../../src/remix/codemods/handle-error.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAM5D,+CAAiC;AAEjC,4CAAwD;AACxD,oCAA2E;AAE3E,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAE1B,kFAAkF;AAClF,uCAAwC;AAExC,SAAgB,qBAAqB;AACnC,iFAAiF;AACjF,8DAA8D;AAC9D,sBAA4C,EAC5C,mBAA2B;IAE3B,MAAM,yBAAyB,GAAG,sBAAsB,CAAC,IAAe,CAAC;IAEzE,MAAM,yBAAyB,GAAG,yBAAyB,CAAC,IAAI,CAAC,IAAI,CACnE,CAAC,IAAI,EAAE,EAAE;QACP,OAAO,CACL,IAAI,CAA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c,CAAC;KAC3E;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AArGD,sDAqGC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport type { ProxifiedModule } from 'magicast';\nimport type { Program } from '@babel/types';\n\nimport * as recast from 'recast';\n\nimport { HANDLE_ERROR_TEMPLATE_V2 } from '../templates';\nimport { getAfterImportsInsertionIndex, hasSentryContent } from '../utils';\n\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { generateCode } from 'magicast';\n\nexport function instrumentHandleError(\n // MagicAst returns `ProxifiedModule<any>` so therefore we have to use `any` here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalEntryServerMod: ProxifiedModule<any>,\n serverEntryFilename: string,\n): boolean {\n const originalEntryServerModAST = originalEntryServerMod.$ast as Program;\n\n const handleErrorFunctionExport = originalEntryServerModAST.body.find(\n (node) => {\n return (\n node.type === 'ExportNamedDeclaration' &&\n node.declaration?.type === 'FunctionDeclaration' &&\n node.declaration.id?.name === 'handleError'\n );\n },\n );\n\n const handleErrorFunctionVariableDeclarationExport =\n originalEntryServerModAST.body.find(\n (node) =>\n node.type === 'ExportNamedDeclaration' &&\n node.declaration?.type === 'VariableDeclaration' &&\n // @ts-expect-error - id should always have a name in this case\n node.declaration.declarations[0].id.name === 'handleError',\n );\n\n if (\n !handleErrorFunctionExport &&\n !handleErrorFunctionVariableDeclarationExport\n ) {\n clack.log.warn(\n `Could not find function ${chalk.cyan('handleError')} in ${chalk.cyan(\n serverEntryFilename,\n )}. Creating one for you.`,\n );\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const implementation = recast.parse(HANDLE_ERROR_TEMPLATE_V2).program\n .body[0];\n\n originalEntryServerModAST.body.splice(\n getAfterImportsInsertionIndex(originalEntryServerModAST),\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n recast.types.builders.exportNamedDeclaration(implementation),\n );\n } else if (\n (handleErrorFunctionExport &&\n ['wrapHandleErrorWithSentry', 'sentryHandleError'].some((util) =>\n hasSentryContent(\n generateCode(handleErrorFunctionExport).code,\n originalEntryServerMod.$code,\n util,\n ),\n )) ||\n (handleErrorFunctionVariableDeclarationExport &&\n ['wrapHandleErrorWithSentry', 'sentryHandleError'].some((util) =>\n hasSentryContent(\n generateCode(handleErrorFunctionVariableDeclarationExport).code,\n originalEntryServerMod.$code,\n util,\n ),\n ))\n ) {\n return false;\n } else if (handleErrorFunctionExport) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const implementation = recast.parse(HANDLE_ERROR_TEMPLATE_V2).program\n .body[0];\n\n // If the current handleError function has a body, we need to merge the new implementation with the existing one\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n implementation.declarations[0].init.arguments[0].body.body.unshift(\n // @ts-expect-error - declaration works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ...handleErrorFunctionExport.declaration.body.body,\n );\n\n // @ts-expect-error - declaration works here because the AST is proxified by magicast\n handleErrorFunctionExport.declaration = implementation;\n } else if (handleErrorFunctionVariableDeclarationExport) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const implementation = recast.parse(HANDLE_ERROR_TEMPLATE_V2).program\n .body[0];\n\n // If the current handleError function has a body, we need to merge the new implementation with the existing one\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n implementation.declarations[0].init.arguments[0].body.body.unshift(\n // @ts-expect-error - declaration works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ...handleErrorFunctionVariableDeclarationExport.declaration\n .declarations[0].init.body.body,\n );\n\n // @ts-expect-error - declaration works here because the AST is proxified by magicast\n handleErrorFunctionVariableDeclarationExport.declaration = implementation;\n }\n\n return true;\n}\n"]}
|
|
@@ -7,16 +7,16 @@ exports.runRemixWizard = void 0;
|
|
|
7
7
|
// @ts-expect-error - clack is ESM and TS complains about that. It works though
|
|
8
8
|
const prompts_1 = __importDefault(require("@clack/prompts"));
|
|
9
9
|
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
-
const clack_utils_1 = require("../utils/clack-utils");
|
|
11
|
-
const package_json_1 = require("../utils/package-json");
|
|
12
|
-
const sdk_setup_1 = require("./sdk-setup");
|
|
13
|
-
const debug_1 = require("../utils/debug");
|
|
14
|
-
const telemetry_1 = require("../telemetry");
|
|
15
|
-
const utils_1 = require("./utils");
|
|
16
10
|
const Constants_1 = require("../../lib/Constants");
|
|
17
|
-
const ast_utils_1 = require("../utils/ast-utils");
|
|
18
11
|
const vite_1 = require("../sourcemaps/tools/vite");
|
|
12
|
+
const telemetry_1 = require("../telemetry");
|
|
13
|
+
const ast_utils_1 = require("../utils/ast-utils");
|
|
14
|
+
const clack_1 = require("../utils/clack");
|
|
15
|
+
const debug_1 = require("../utils/debug");
|
|
16
|
+
const package_json_1 = require("../utils/package-json");
|
|
19
17
|
const sdk_example_1 = require("./sdk-example");
|
|
18
|
+
const sdk_setup_1 = require("./sdk-setup");
|
|
19
|
+
const utils_1 = require("./utils");
|
|
20
20
|
async function runRemixWizard(options) {
|
|
21
21
|
return (0, telemetry_1.withTelemetry)({
|
|
22
22
|
enabled: options.telemetryEnabled,
|
|
@@ -27,28 +27,31 @@ async function runRemixWizard(options) {
|
|
|
27
27
|
exports.runRemixWizard = runRemixWizard;
|
|
28
28
|
async function runRemixWizardWithTelemetry(options) {
|
|
29
29
|
const { promoCode, telemetryEnabled, forceInstall } = options;
|
|
30
|
-
(0,
|
|
30
|
+
(0, clack_1.printWelcome)({
|
|
31
31
|
wizardName: 'Sentry Remix Wizard',
|
|
32
32
|
promoCode,
|
|
33
33
|
telemetryEnabled,
|
|
34
34
|
});
|
|
35
|
-
await (0,
|
|
35
|
+
await (0, clack_1.confirmContinueIfNoOrDirtyGitRepo)({
|
|
36
|
+
ignoreGitChanges: options.ignoreGitChanges,
|
|
37
|
+
cwd: undefined,
|
|
38
|
+
});
|
|
36
39
|
const remixConfig = await (0, sdk_setup_1.loadRemixConfig)();
|
|
37
|
-
const packageJson = await (0,
|
|
40
|
+
const packageJson = await (0, clack_1.getPackageDotJson)();
|
|
38
41
|
// We expect `@remix-run/dev` to be installed for every Remix project
|
|
39
|
-
await (0,
|
|
40
|
-
const { selectedProject, authToken, sentryUrl, selfHosted } = await (0,
|
|
41
|
-
await (0,
|
|
42
|
+
await (0, clack_1.ensurePackageIsInstalled)(packageJson, '@remix-run/dev', 'Remix');
|
|
43
|
+
const { selectedProject, authToken, sentryUrl, selfHosted } = await (0, clack_1.getOrAskForProjectData)(options, 'javascript-remix');
|
|
44
|
+
await (0, clack_1.installPackage)({
|
|
42
45
|
packageName: '@sentry/remix@^9',
|
|
43
46
|
packageNameDisplayLabel: '@sentry/remix',
|
|
44
47
|
alreadyInstalled: (0, package_json_1.hasPackageInstalled)('@sentry/remix', packageJson),
|
|
45
48
|
forceInstall,
|
|
46
49
|
});
|
|
47
50
|
const dsn = selectedProject.keys[0].dsn.public;
|
|
48
|
-
const isTS = (0,
|
|
51
|
+
const isTS = (0, clack_1.isUsingTypeScript)();
|
|
49
52
|
const isV2 = (0, sdk_setup_1.isRemixV2)(remixConfig, packageJson);
|
|
50
53
|
const viteConfig = (0, ast_utils_1.findFile)('vite.config');
|
|
51
|
-
const selectedFeatures = await (0,
|
|
54
|
+
const selectedFeatures = await (0, clack_1.featureSelectionPrompt)([
|
|
52
55
|
{
|
|
53
56
|
id: 'performance',
|
|
54
57
|
prompt: `Do you want to enable ${chalk_1.default.bold('Tracing')} to track the performance of your application?`,
|
|
@@ -88,7 +91,7 @@ async function runRemixWizardWithTelemetry(options) {
|
|
|
88
91
|
url: sentryUrl === Constants_1.DEFAULT_URL ? undefined : sentryUrl,
|
|
89
92
|
isHydrogen: (0, utils_1.isHydrogenApp)(packageJson),
|
|
90
93
|
});
|
|
91
|
-
await (0,
|
|
94
|
+
await (0, clack_1.addSentryCliConfig)({ authToken }, clack_1.rcCliSetupConfig);
|
|
92
95
|
}
|
|
93
96
|
catch (e) {
|
|
94
97
|
prompts_1.default.log
|
|
@@ -171,7 +174,7 @@ async function runRemixWizardWithTelemetry(options) {
|
|
|
171
174
|
(0, debug_1.debug)(e);
|
|
172
175
|
}
|
|
173
176
|
});
|
|
174
|
-
const shouldCreateExamplePage = await (0,
|
|
177
|
+
const shouldCreateExamplePage = await (0, clack_1.askShouldCreateExamplePage)();
|
|
175
178
|
if (shouldCreateExamplePage) {
|
|
176
179
|
await (0, telemetry_1.traceStep)('Create example page', async () => {
|
|
177
180
|
await (0, sdk_example_1.createExamplePage)({
|
|
@@ -183,7 +186,9 @@ async function runRemixWizardWithTelemetry(options) {
|
|
|
183
186
|
});
|
|
184
187
|
});
|
|
185
188
|
}
|
|
186
|
-
await (0,
|
|
189
|
+
await (0, clack_1.runPrettierIfInstalled)({
|
|
190
|
+
cwd: undefined,
|
|
191
|
+
});
|
|
187
192
|
prompts_1.default.outro(`
|
|
188
193
|
${chalk_1.default.green('Sentry has been successfully configured for your Remix project.')}
|
|
189
194
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remix-wizard.js","sourceRoot":"","sources":["../../../src/remix/remix-wizard.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAE1B,sDAa8B;AAC9B,wDAA4D;AAE5D,2CAWqB;AACrB,0CAAuC;AACvC,4CAAwD;AACxD,mCAAwC;AACxC,mDAAkD;AAClD,kDAA8C;AAC9C,mDAA+D;AAC/D,+CAAkD;AAE3C,KAAK,UAAU,cAAc,CAAC,OAAsB;IACzD,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;Q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B,EAAE,KAAK,IAAI,EAAE;YAChD,MAAM,IAAA,+BAAiB,EAAC;gBACtB,IAAI;gBACJ,UAAU;gBACV,OAAO,EAAE,eAAe,CAAC,YAAY,CAAC,IAAI;gBAC1C,SAAS,EAAE,eAAe,CAAC,EAAE;gBAC7B,GAAG,EAAE,SAAS;aACf,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;KACJ;IAED,MAAM,IAAA,oCAAsB,GAAE,CAAC;IAE/B,iBAAK,CAAC,KAAK,CAAC;EACZ,eAAK,CAAC,KAAK,CACX,iEAAiE,CAClE;;EAEC,eAAK,CAAC,IAAI,CAAC,0DAA0D,CAAC;;EAEtE,eAAK,CAAC,IAAI,CACV;0DACwD,CACzD,EAAE,CAAC,CAAC;AACL,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n addSentryCliConfig,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n rcCliSetupConfig,\n runPrettierIfInstalled,\n} from '../utils/clack-utils';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport type { WizardOptions } from '../utils/types';\nimport {\n initializeSentryOnEntryClient,\n instrumentSentryOnEntryServer,\n updateBuildScript,\n instrumentRootRoute,\n isRemixV2,\n loadRemixConfig,\n runRemixReveal,\n insertServerInstrumentationFile,\n createServerInstrumentationFile,\n updateStartScript,\n} from './sdk-setup';\nimport { debug } from '../utils/debug';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { isHydrogenApp } from './utils';\nimport { DEFAULT_URL } from '../../lib/Constants';\nimport { findFile } from '../utils/ast-utils';\nimport { configureVitePlugin } from '../sourcemaps/tools/vite';\nimport { createExamplePage } from './sdk-example';\n\nexport async function runRemixWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'remix',\n wizardOptions: options,\n },\n () => runRemixWizardWithTelemetry(options),\n );\n}\n\nasync function runRemixWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n const { promoCode, telemetryEnabled, forceInstall } = options;\n\n printWelcome({\n wizardName: 'Sentry Remix Wizard',\n promoCode,\n telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const remixConfig = await loadRemixConfig();\n const packageJson = await getPackageDotJson();\n\n // We expect `@remix-run/dev` to be installed for every Remix project\n await ensurePackageIsInstalled(packageJson, '@remix-run/dev', 'Remix');\n\n const { selectedProject, authToken, sentryUrl, selfHosted } =\n await getOrAskForProjectData(options, 'javascript-remix');\n\n await installPackage({\n packageName: '@sentry/remix@^9',\n packageNameDisplayLabel: '@sentry/remix',\n alreadyInstalled: hasPackageInstalled('@sentry/remix', packageJson),\n forceInstall,\n });\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const isTS = isUsingTypeScript();\n const isV2 = isRemixV2(remixConfig, packageJson);\n const viteConfig = findFile('vite.config');\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\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 id: 'replay',\n prompt: `Do you want to enable ${chalk.bold(\n 'Session Replay',\n )} to get a video-like reproduction of errors during a user session?`,\n enabledHint: 'recommended, but increases bundle size',\n },\n ] as const);\n\n if (viteConfig) {\n await traceStep(\n 'Update vite configuration for sourcemap uploads',\n async () => {\n try {\n await configureVitePlugin({\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n selfHosted,\n authToken,\n });\n } catch (e) {\n clack.log\n .warn(`Could not update vite configuration to generate and upload sourcemaps.\n Please update your vite configuration manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n },\n );\n } else {\n await traceStep('Update build script for sourcemap uploads', async () => {\n try {\n await updateBuildScript({\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n url: sentryUrl === DEFAULT_URL ? undefined : sentryUrl,\n isHydrogen: isHydrogenApp(packageJson),\n });\n\n await addSentryCliConfig({ authToken }, rcCliSetupConfig);\n } catch (e) {\n clack.log\n .warn(`Could not update build script to generate and upload sourcemaps.\n Please update your build script manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n });\n }\n\n await traceStep('Instrument root route', async () => {\n try {\n await instrumentRootRoute(isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not instrument root route.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n traceStep('Reveal missing entry files', () => {\n try {\n runRemixReveal(isTS);\n } catch (e) {\n clack.log.warn(`Could not run 'npx remix reveal'.\n Please create your entry files manually`);\n debug(e);\n }\n });\n\n await traceStep('Initialize Sentry on client entry', async () => {\n try {\n await initializeSentryOnEntryClient(dsn, isTS, selectedFeatures);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on client entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n let instrumentationFile = '';\n\n await traceStep('Create server instrumentation file', async () => {\n try {\n instrumentationFile = await createServerInstrumentationFile(\n dsn,\n selectedFeatures,\n );\n } catch (e) {\n clack.log.warn(\n 'Could not create a server instrumentation file. Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/',\n );\n debug(e);\n }\n });\n\n let serverFileInstrumented = false;\n\n await traceStep(\n 'Create server instrumentation file and import it',\n async () => {\n try {\n serverFileInstrumented = await insertServerInstrumentationFile(\n dsn,\n selectedFeatures,\n );\n } catch (e) {\n clack.log.warn(\n 'Could not create a server instrumentation file. Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/',\n );\n debug(e);\n }\n },\n );\n\n if (!serverFileInstrumented && instrumentationFile) {\n await traceStep(\n 'Update `start` script to import instrumentation file.',\n async () => {\n try {\n await updateStartScript(instrumentationFile);\n } catch (e) {\n clack.log\n .warn(`Could not automatically add Sentry initialization to server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n },\n );\n }\n\n await traceStep('Instrument server `handleError`', async () => {\n try {\n await instrumentSentryOnEntryServer(isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage();\n\n if (shouldCreateExamplePage) {\n await traceStep('Create example page', async () => {\n await createExamplePage({\n isTS,\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n url: sentryUrl,\n });\n });\n }\n\n await runPrettierIfInstalled();\n\n clack.outro(`\n${chalk.green(\n 'Sentry has been successfully configured for your Remix project.',\n)}\n\n${chalk.cyan('You can now deploy your project to see Sentry in action.')}\n\n${chalk.cyan(\n `To learn more about how to use Sentry with Remix, visit our documentation:\nhttps://docs.sentry.io/platforms/javascript/guides/remix/`,\n)}`);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"remix-wizard.js","sourceRoot":"","sources":["../../../src/remix/remix-wizard.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAE1B,mDAAkD;AAClD,mDAA+D;AAC/D,4CAAwD;AACxD,kDAA8C;AAC9C,0CAawB;AACxB,0CAAuC;AACvC,wDAA4D;AAE5D,+CAAkD;AAClD,2CAWqB;AACrB,mCAAwC;AAEjC,KAAK,UAAU,cAAc,CAAC,OAAsB;IACzD,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;QACjC,WAAW,EAAE,OAAO;QACpB,aAAa,EAA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AC3B,MAAM,IAAA,qBAAS,EAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;YAChD,MAAM,IAAA,+BAAiB,EAAC;gBACtB,IAAI;gBACJ,UAAU;gBACV,OAAO,EAAE,eAAe,CAAC,YAAY,CAAC,IAAI;gBAC1C,SAAS,EAAE,eAAe,CAAC,EAAE;gBAC7B,GAAG,EAAE,SAAS;aACf,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;KACJ;IAED,MAAM,IAAA,8BAAsB,EAAC;QAC3B,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEH,iBAAK,CAAC,KAAK,CAAC;EACZ,eAAK,CAAC,KAAK,CACX,iEAAiE,CAClE;;EAEC,eAAK,CAAC,IAAI,CAAC,0DAA0D,CAAC;;EAEtE,eAAK,CAAC,IAAI,CACV;0DACwD,CACzD,EAAE,CAAC,CAAC;AACL,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport { DEFAULT_URL } from '../../lib/Constants';\nimport { configureVitePlugin } from '../sourcemaps/tools/vite';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { findFile } from '../utils/ast-utils';\nimport {\n addSentryCliConfig,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n rcCliSetupConfig,\n runPrettierIfInstalled,\n} from '../utils/clack';\nimport { debug } from '../utils/debug';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport type { WizardOptions } from '../utils/types';\nimport { createExamplePage } from './sdk-example';\nimport {\n createServerInstrumentationFile,\n initializeSentryOnEntryClient,\n insertServerInstrumentationFile,\n instrumentRootRoute,\n instrumentSentryOnEntryServer,\n isRemixV2,\n loadRemixConfig,\n runRemixReveal,\n updateBuildScript,\n updateStartScript,\n} from './sdk-setup';\nimport { isHydrogenApp } from './utils';\n\nexport async function runRemixWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'remix',\n wizardOptions: options,\n },\n () => runRemixWizardWithTelemetry(options),\n );\n}\n\nasync function runRemixWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n const { promoCode, telemetryEnabled, forceInstall } = options;\n\n printWelcome({\n wizardName: 'Sentry Remix Wizard',\n promoCode,\n telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n const remixConfig = await loadRemixConfig();\n const packageJson = await getPackageDotJson();\n\n // We expect `@remix-run/dev` to be installed for every Remix project\n await ensurePackageIsInstalled(packageJson, '@remix-run/dev', 'Remix');\n\n const { selectedProject, authToken, sentryUrl, selfHosted } =\n await getOrAskForProjectData(options, 'javascript-remix');\n\n await installPackage({\n packageName: '@sentry/remix@^9',\n packageNameDisplayLabel: '@sentry/remix',\n alreadyInstalled: hasPackageInstalled('@sentry/remix', packageJson),\n forceInstall,\n });\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const isTS = isUsingTypeScript();\n const isV2 = isRemixV2(remixConfig, packageJson);\n const viteConfig = findFile('vite.config');\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\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 id: 'replay',\n prompt: `Do you want to enable ${chalk.bold(\n 'Session Replay',\n )} to get a video-like reproduction of errors during a user session?`,\n enabledHint: 'recommended, but increases bundle size',\n },\n ] as const);\n\n if (viteConfig) {\n await traceStep(\n 'Update vite configuration for sourcemap uploads',\n async () => {\n try {\n await configureVitePlugin({\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n selfHosted,\n authToken,\n });\n } catch (e) {\n clack.log\n .warn(`Could not update vite configuration to generate and upload sourcemaps.\n Please update your vite configuration manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n },\n );\n } else {\n await traceStep('Update build script for sourcemap uploads', async () => {\n try {\n await updateBuildScript({\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n url: sentryUrl === DEFAULT_URL ? undefined : sentryUrl,\n isHydrogen: isHydrogenApp(packageJson),\n });\n\n await addSentryCliConfig({ authToken }, rcCliSetupConfig);\n } catch (e) {\n clack.log\n .warn(`Could not update build script to generate and upload sourcemaps.\n Please update your build script manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n });\n }\n\n await traceStep('Instrument root route', async () => {\n try {\n await instrumentRootRoute(isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not instrument root route.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n traceStep('Reveal missing entry files', () => {\n try {\n runRemixReveal(isTS);\n } catch (e) {\n clack.log.warn(`Could not run 'npx remix reveal'.\n Please create your entry files manually`);\n debug(e);\n }\n });\n\n await traceStep('Initialize Sentry on client entry', async () => {\n try {\n await initializeSentryOnEntryClient(dsn, isTS, selectedFeatures);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on client entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n let instrumentationFile = '';\n\n await traceStep('Create server instrumentation file', async () => {\n try {\n instrumentationFile = await createServerInstrumentationFile(\n dsn,\n selectedFeatures,\n );\n } catch (e) {\n clack.log.warn(\n 'Could not create a server instrumentation file. Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/',\n );\n debug(e);\n }\n });\n\n let serverFileInstrumented = false;\n\n await traceStep(\n 'Create server instrumentation file and import it',\n async () => {\n try {\n serverFileInstrumented = await insertServerInstrumentationFile(\n dsn,\n selectedFeatures,\n );\n } catch (e) {\n clack.log.warn(\n 'Could not create a server instrumentation file. Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/',\n );\n debug(e);\n }\n },\n );\n\n if (!serverFileInstrumented && instrumentationFile) {\n await traceStep(\n 'Update `start` script to import instrumentation file.',\n async () => {\n try {\n await updateStartScript(instrumentationFile);\n } catch (e) {\n clack.log\n .warn(`Could not automatically add Sentry initialization to server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n },\n );\n }\n\n await traceStep('Instrument server `handleError`', async () => {\n try {\n await instrumentSentryOnEntryServer(isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage();\n\n if (shouldCreateExamplePage) {\n await traceStep('Create example page', async () => {\n await createExamplePage({\n isTS,\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n url: sentryUrl,\n });\n });\n }\n\n await runPrettierIfInstalled({\n cwd: undefined,\n });\n\n clack.outro(`\n${chalk.green(\n 'Sentry has been successfully configured for your Remix project.',\n)}\n\n${chalk.cyan('You can now deploy your project to see Sentry in action.')}\n\n${chalk.cyan(\n `To learn more about how to use Sentry with Remix, visit our documentation:\nhttps://docs.sentry.io/platforms/javascript/guides/remix/`,\n)}`);\n}\n"]}
|
|
@@ -29,7 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.getSentryExamplePageContents = exports.createExamplePage = void 0;
|
|
30
30
|
const fs = __importStar(require("fs"));
|
|
31
31
|
const path = __importStar(require("path"));
|
|
32
|
-
// @ts-
|
|
32
|
+
// @ts-expect-error - clack is ESM and TS complains about that. It works though
|
|
33
33
|
const prompts_1 = __importDefault(require("@clack/prompts"));
|
|
34
34
|
/**
|
|
35
35
|
* Creates an example Remix page to test Sentry
|
|
@@ -52,71 +52,170 @@ function getSentryExamplePageContents(options) {
|
|
|
52
52
|
const issuesPageLink = options.selfHosted
|
|
53
53
|
? `${options.url}organizations/${options.orgSlug}/issues/?project=${options.projectId}`
|
|
54
54
|
: `https://${options.orgSlug}.sentry.io/issues/?project=${options.projectId}`;
|
|
55
|
-
return `
|
|
55
|
+
return `import * as Sentry from "@sentry/remix";
|
|
56
|
+
import { useState } from "react";
|
|
57
|
+
|
|
58
|
+
export const meta = () => {
|
|
59
|
+
return [
|
|
60
|
+
{ title: "sentry-example-page" },
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
|
|
56
64
|
export default function SentryExamplePage() {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
https://docs.sentry.io/platforms/javascript/guides/remix/
|
|
114
|
-
</a>
|
|
115
|
-
</p>
|
|
116
|
-
</main>
|
|
117
|
-
</div>
|
|
118
|
-
);
|
|
65
|
+
const [hasSentError, setHasSentError] = useState(false);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div>
|
|
69
|
+
<main>
|
|
70
|
+
<div className="flex-spacer" />
|
|
71
|
+
<svg height="40" width="40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
72
|
+
<path d="M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z" fill="currentcolor"/>
|
|
73
|
+
</svg>
|
|
74
|
+
<h1>
|
|
75
|
+
sentry-example-page
|
|
76
|
+
</h1>
|
|
77
|
+
|
|
78
|
+
<p className="description">
|
|
79
|
+
Click the button below, and view the sample error on the Sentry <a target="_blank" rel="noreferrer" href="${issuesPageLink}">Issues Page</a>.
|
|
80
|
+
For more details about setting up Sentry, <a target="_blank" rel="noreferrer" href="https://docs.sentry.io/platforms/javascript/guides/remix/">read our docs</a>.
|
|
81
|
+
</p>
|
|
82
|
+
|
|
83
|
+
<button
|
|
84
|
+
type="button"
|
|
85
|
+
onClick={async () => {
|
|
86
|
+
await Sentry.startSpan({
|
|
87
|
+
name: 'Example Frontend Span',
|
|
88
|
+
op: 'test'
|
|
89
|
+
}, async () => {
|
|
90
|
+
const res = await fetch("/api/sentry-example-api");
|
|
91
|
+
if (!res.ok) {
|
|
92
|
+
setHasSentError(true);
|
|
93
|
+
throw new Error("Sentry Example Frontend Error");
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
<span>
|
|
99
|
+
Throw Sample Error
|
|
100
|
+
</span>
|
|
101
|
+
</button>
|
|
102
|
+
|
|
103
|
+
{hasSentError ? (
|
|
104
|
+
<p className="success">
|
|
105
|
+
Sample error was sent to Sentry.
|
|
106
|
+
</p>
|
|
107
|
+
) : (
|
|
108
|
+
<div className="success_placeholder" />
|
|
109
|
+
)}
|
|
110
|
+
|
|
111
|
+
<div className="flex-spacer" />
|
|
112
|
+
<p className="description">
|
|
113
|
+
Adblockers will prevent errors from being sent to Sentry.
|
|
114
|
+
</p>
|
|
115
|
+
</main>
|
|
116
|
+
|
|
117
|
+
{/* Not for production use! We're just saving you from having to delete an extra CSS file ;) */}
|
|
118
|
+
<style dangerouslySetInnerHTML={{ __html: styles }}></style>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
119
121
|
}
|
|
122
|
+
|
|
123
|
+
const styles = \`
|
|
124
|
+
main {
|
|
125
|
+
display: flex;
|
|
126
|
+
min-height: 100vh;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
align-items: center;
|
|
130
|
+
gap: 16px;
|
|
131
|
+
padding: 16px;
|
|
132
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
h1 {
|
|
136
|
+
padding: 0px 4px;
|
|
137
|
+
border-radius: 4px;
|
|
138
|
+
background-color: rgba(24, 20, 35, 0.03);
|
|
139
|
+
font-family: monospace;
|
|
140
|
+
font-size: 20px;
|
|
141
|
+
line-height: 1.2;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
p {
|
|
145
|
+
margin: 0;
|
|
146
|
+
font-size: 20px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
a {
|
|
150
|
+
color: #6341F0;
|
|
151
|
+
text-decoration: underline;
|
|
152
|
+
cursor: pointer;
|
|
153
|
+
|
|
154
|
+
@media (prefers-color-scheme: dark) {
|
|
155
|
+
color: #B3A1FF;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
button {
|
|
160
|
+
border-radius: 8px;
|
|
161
|
+
color: white;
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
background-color: #553DB8;
|
|
164
|
+
border: none;
|
|
165
|
+
padding: 0;
|
|
166
|
+
margin-top: 4px;
|
|
167
|
+
|
|
168
|
+
& > span {
|
|
169
|
+
display: inline-block;
|
|
170
|
+
padding: 12px 16px;
|
|
171
|
+
border-radius: inherit;
|
|
172
|
+
font-size: 20px;
|
|
173
|
+
font-weight: bold;
|
|
174
|
+
line-height: 1;
|
|
175
|
+
background-color: #7553FF;
|
|
176
|
+
border: 1px solid #553DB8;
|
|
177
|
+
transform: translateY(-4px);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&:hover > span {
|
|
181
|
+
transform: translateY(-8px);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
&:active > span {
|
|
185
|
+
transform: translateY(0);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.description {
|
|
190
|
+
text-align: center;
|
|
191
|
+
color: #6E6C75;
|
|
192
|
+
max-width: 500px;
|
|
193
|
+
line-height: 1.5;
|
|
194
|
+
font-size: 20px;
|
|
195
|
+
|
|
196
|
+
@media (prefers-color-scheme: dark) {
|
|
197
|
+
color: #A49FB5;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.flex-spacer {
|
|
202
|
+
flex: 1;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.success {
|
|
206
|
+
padding: 12px 16px;
|
|
207
|
+
border-radius: 8px;
|
|
208
|
+
font-size: 20px;
|
|
209
|
+
line-height: 1;
|
|
210
|
+
background-color: #00F261;
|
|
211
|
+
border: 1px solid #00BF4D;
|
|
212
|
+
color: #181423;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.success_placeholder {
|
|
216
|
+
height: 46px;
|
|
217
|
+
}
|
|
218
|
+
\`;
|
|
120
219
|
`;
|
|
121
220
|
}
|
|
122
221
|
exports.getSentryExamplePageContents = getSentryExamplePageContents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-example.js","sourceRoot":"","sources":["../../../src/remix/sdk-example.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B
|
|
1
|
+
{"version":3,"file":"sdk-example.js","sourceRoot":"","sources":["../../../src/remix/sdk-example.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,+EAA+E;AAC/E,6DAAmC;AAEnC;;GAEG;AACI,KAAK,UAAU,iBAAiB,CAAC,OAMvC;IACC,MAAM,UAAU,GAAG,YAAY,CAAC;IAEhC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QAC9B,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;KAC/C;IAED,MAAM,gBAAgB,GAAG,kCACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IACxB,GAAG,CAAC;IAEJ,IAAI,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QACnC,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,uDAAuD,IAAI,CAAC,QAAQ,CAClE,gBAAgB,CACjB,wCAAwC,CAC1C,CAAC;QACF,OAAO;KACR;IAED,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,gBAAgB,EAChB,4BAA4B,CAAC,OAAO,CAAC,CACtC,CAAC;IAEF,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,kCAAkC,gBAAgB,GAAG,CAAC,CAAC;AACxE,CAAC;AAhCD,8CAgCC;AAED,SAAgB,4BAA4B,CAAC,OAM5C;IACC,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU;QACvC,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,iBAAiB,OAAO,CAAC,OAAO,oBAAoB,OAAO,CAAC,SAAS,EAAE;QACvF,CAAC,CAAC,WAAW,OAAO,CAAC,OAAO,8BAA8B,OAAO,CAAC,SAAS,EAAE,CAAC;IAEhF,OAAO;;;;;;;;;;;;;;;;;;;;;;;;sHAwB6G,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4InI,CAAC;AACF,CAAC;AAhLD,oEAgLC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\n\n/**\n * Creates an example Remix page to test Sentry\n */\nexport async function createExamplePage(options: {\n selfHosted: boolean;\n orgSlug: string;\n projectId: string;\n url: string;\n isTS: boolean;\n}) {\n const routesPath = 'app/routes';\n\n if (!fs.existsSync(routesPath)) {\n fs.mkdirSync(routesPath, { recursive: true });\n }\n\n const exampleRoutePath = `app/routes/sentry-example-page.${\n options.isTS ? 'ts' : 'js'\n }x`;\n\n if (fs.existsSync(exampleRoutePath)) {\n clack.log.warn(\n `It seems like a sentry example page already exists (${path.basename(\n exampleRoutePath,\n )}). Skipping creation of example route.`,\n );\n return;\n }\n\n await fs.promises.writeFile(\n exampleRoutePath,\n getSentryExamplePageContents(options),\n );\n\n clack.log.info(`Created sentry example page at ${exampleRoutePath}.`);\n}\n\nexport function getSentryExamplePageContents(options: {\n selfHosted: boolean;\n orgSlug: string;\n projectId: string;\n url: string;\n isTS?: boolean;\n}) {\n const issuesPageLink = options.selfHosted\n ? `${options.url}organizations/${options.orgSlug}/issues/?project=${options.projectId}`\n : `https://${options.orgSlug}.sentry.io/issues/?project=${options.projectId}`;\n\n return `import * as Sentry from \"@sentry/remix\";\nimport { useState } from \"react\";\n\nexport const meta = () => {\n return [\n { title: \"sentry-example-page\" },\n ];\n}\n\nexport default function SentryExamplePage() {\n const [hasSentError, setHasSentError] = useState(false);\n\n return (\n <div>\n <main>\n <div className=\"flex-spacer\" />\n <svg height=\"40\" width=\"40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21.85 2.995a3.698 3.698 0 0 1 1.353 1.354l16.303 28.278a3.703 3.703 0 0 1-1.354 5.053 3.694 3.694 0 0 1-1.848.496h-3.828a31.149 31.149 0 0 0 0-3.09h3.815a.61.61 0 0 0 .537-.917L20.523 5.893a.61.61 0 0 0-1.057 0l-3.739 6.494a28.948 28.948 0 0 1 9.63 10.453 28.988 28.988 0 0 1 3.499 13.78v1.542h-9.852v-1.544a19.106 19.106 0 0 0-2.182-8.85 19.08 19.08 0 0 0-6.032-6.829l-1.85 3.208a15.377 15.377 0 0 1 6.382 12.484v1.542H3.696A3.694 3.694 0 0 1 0 34.473c0-.648.17-1.286.494-1.849l2.33-4.074a8.562 8.562 0 0 1 2.689 1.536L3.158 34.17a.611.611 0 0 0 .538.917h8.448a12.481 12.481 0 0 0-6.037-9.09l-1.344-.772 4.908-8.545 1.344.77a22.16 22.16 0 0 1 7.705 7.444 22.193 22.193 0 0 1 3.316 10.193h3.699a25.892 25.892 0 0 0-3.811-12.033 25.856 25.856 0 0 0-9.046-8.796l-1.344-.772 5.269-9.136a3.698 3.698 0 0 1 3.2-1.849c.648 0 1.285.17 1.847.495Z\" fill=\"currentcolor\"/>\n </svg>\n <h1>\n sentry-example-page\n </h1>\n\n <p className=\"description\">\n Click the button below, and view the sample error on the Sentry <a target=\"_blank\" rel=\"noreferrer\" href=\"${issuesPageLink}\">Issues Page</a>. \n For more details about setting up Sentry, <a target=\"_blank\" rel=\"noreferrer\" href=\"https://docs.sentry.io/platforms/javascript/guides/remix/\">read our docs</a>.\n </p>\n\n <button\n type=\"button\"\n onClick={async () => {\n await Sentry.startSpan({\n name: 'Example Frontend Span',\n op: 'test'\n }, async () => {\n const res = await fetch(\"/api/sentry-example-api\");\n if (!res.ok) {\n setHasSentError(true);\n throw new Error(\"Sentry Example Frontend Error\");\n }\n });\n }}\n >\n <span>\n Throw Sample Error\n </span>\n </button>\n\n {hasSentError ? (\n <p className=\"success\">\n Sample error was sent to Sentry.\n </p>\n ) : (\n <div className=\"success_placeholder\" />\n )}\n\n <div className=\"flex-spacer\" />\n <p className=\"description\">\n Adblockers will prevent errors from being sent to Sentry.\n </p>\n </main>\n\n {/* Not for production use! We're just saving you from having to delete an extra CSS file ;) */}\n <style dangerouslySetInnerHTML={{ __html: styles }}></style>\n </div>\n );\n}\n\nconst styles = \\`\n main {\n display: flex;\n min-height: 100vh;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 16px;\n padding: 16px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", sans-serif;\n }\n\n h1 {\n padding: 0px 4px;\n border-radius: 4px;\n background-color: rgba(24, 20, 35, 0.03);\n font-family: monospace;\n font-size: 20px;\n line-height: 1.2;\n }\n\n p {\n margin: 0;\n font-size: 20px;\n }\n\n a {\n color: #6341F0;\n text-decoration: underline;\n cursor: pointer;\n\n @media (prefers-color-scheme: dark) {\n color: #B3A1FF;\n }\n }\n\n button {\n border-radius: 8px;\n color: white;\n cursor: pointer;\n background-color: #553DB8;\n border: none;\n padding: 0;\n margin-top: 4px;\n\n & > span {\n display: inline-block;\n padding: 12px 16px;\n border-radius: inherit;\n font-size: 20px;\n font-weight: bold;\n line-height: 1;\n background-color: #7553FF;\n border: 1px solid #553DB8;\n transform: translateY(-4px);\n }\n\n &:hover > span {\n transform: translateY(-8px);\n }\n\n &:active > span {\n transform: translateY(0);\n }\n }\n\n .description {\n text-align: center;\n color: #6E6C75;\n max-width: 500px;\n line-height: 1.5;\n font-size: 20px;\n\n @media (prefers-color-scheme: dark) {\n color: #A49FB5;\n }\n }\n\n .flex-spacer {\n flex: 1;\n }\n\n .success {\n padding: 12px 16px;\n border-radius: 8px;\n font-size: 20px;\n line-height: 1;\n background-color: #00F261;\n border: 1px solid #00BF4D;\n color: #181423;\n }\n\n .success_placeholder {\n height: 46px;\n }\n\\`;\n`;\n}\n"]}
|