@sentry/wizard 4.0.0 → 4.0.2
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 +11 -2
- package/dist/NextJs/configs/next.config.js +1 -1
- package/dist/bin.js +2 -1
- package/dist/bin.js.map +1 -1
- package/dist/bump-version.js +28 -0
- package/dist/craft-pre-release.sh +2 -0
- package/dist/lib/Steps/Initial.js +2 -12
- package/dist/lib/Steps/Initial.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.js +1 -1
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/src/nextjs/templates.js +1 -1
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/run.js +2 -18
- package/dist/src/run.js.map +1 -1
- package/dist/src/telemetry.js +2 -16
- package/dist/src/telemetry.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +16 -0
- package/dist/src/utils/clack-utils.js +53 -45
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/version.d.ts +1 -0
- package/dist/src/version.js +7 -0
- package/dist/src/version.js.map +1 -0
- package/dist/test/nextjs/templates.test.js +4 -4
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/utils/clack-utils.test.js +52 -0
- package/dist/test/utils/clack-utils.test.js.map +1 -1
- package/package.json +5 -2
- package/.node-cache/node-v22.14.0-darwin-arm64 +0 -0
- package/.node-cache/node-v22.14.0-darwin-x64 +0 -0
- package/.node-cache/node-v22.14.0-linux-arm64 +0 -0
- package/.node-cache/node-v22.14.0-linux-x64 +0 -0
- package/.node-cache/node-v22.14.0-win-x64.exe +0 -0
- package/COPYING +0 -3575
- package/bin.ts +0 -143
- package/codecov.yml +0 -15
- package/e2e-tests/.env.example +0 -11
- package/e2e-tests/README.md +0 -63
- package/e2e-tests/jest.config.ts +0 -22
- package/e2e-tests/package.json +0 -14
- package/e2e-tests/run.sh +0 -15
- package/e2e-tests/test-applications/apple/damaged-missing-configuration-list/Project.xcodeproj/project.pbxproj +0 -52
- package/e2e-tests/test-applications/apple/damaged-missing-configuration-list/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +0 -78
- package/e2e-tests/test-applications/apple/no-targets/Project.xcodeproj/project.pbxproj +0 -62
- package/e2e-tests/test-applications/apple/no-targets/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +0 -78
- package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project.xcodeproj/project.pbxproj +0 -470
- package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +0 -78
- package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project1/ContentView.swift +0 -7
- package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project1/Project1App.swift +0 -10
- package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project2/ContentView.swift +0 -7
- package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project2/Project2App.swift +0 -10
- package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Project.xcodeproj/project.pbxproj +0 -382
- package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Project.xcodeproj/xcshareddata/xcschemes/Project.xcscheme +0 -78
- package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Sources/ContentView.swift +0 -7
- package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Sources/MainApp.swift +0 -10
- package/e2e-tests/test-applications/flutter-test-app/.metadata +0 -45
- package/e2e-tests/test-applications/flutter-test-app/README.md +0 -16
- package/e2e-tests/test-applications/flutter-test-app/analysis_options.yaml +0 -28
- package/e2e-tests/test-applications/flutter-test-app/android/app/build.gradle +0 -44
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/debug/AndroidManifest.xml +0 -7
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/AndroidManifest.xml +0 -45
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/kotlin/com/example/flutter_magic/MainActivity.kt +0 -5
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/drawable/launch_background.xml +0 -12
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/drawable-v21/launch_background.xml +0 -12
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/values/styles.xml +0 -18
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/values-night/styles.xml +0 -18
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/profile/AndroidManifest.xml +0 -7
- package/e2e-tests/test-applications/flutter-test-app/android/build.gradle +0 -18
- package/e2e-tests/test-applications/flutter-test-app/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/e2e-tests/test-applications/flutter-test-app/android/gradle.properties +0 -3
- package/e2e-tests/test-applications/flutter-test-app/android/settings.gradle +0 -25
- package/e2e-tests/test-applications/flutter-test-app/lib/main.dart +0 -125
- package/e2e-tests/test-applications/flutter-test-app/linux/CMakeLists.txt +0 -145
- package/e2e-tests/test-applications/flutter-test-app/linux/flutter/CMakeLists.txt +0 -88
- package/e2e-tests/test-applications/flutter-test-app/linux/flutter/generated_plugin_registrant.cc +0 -11
- package/e2e-tests/test-applications/flutter-test-app/linux/flutter/generated_plugin_registrant.h +0 -15
- package/e2e-tests/test-applications/flutter-test-app/linux/flutter/generated_plugins.cmake +0 -23
- package/e2e-tests/test-applications/flutter-test-app/linux/main.cc +0 -6
- package/e2e-tests/test-applications/flutter-test-app/linux/my_application.cc +0 -124
- package/e2e-tests/test-applications/flutter-test-app/linux/my_application.h +0 -18
- package/e2e-tests/test-applications/flutter-test-app/macos/Flutter/Flutter-Debug.xcconfig +0 -2
- package/e2e-tests/test-applications/flutter-test-app/macos/Flutter/Flutter-Release.xcconfig +0 -2
- package/e2e-tests/test-applications/flutter-test-app/macos/Flutter/GeneratedPluginRegistrant.swift +0 -10
- package/e2e-tests/test-applications/flutter-test-app/macos/Podfile +0 -43
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/AppDelegate.swift +0 -9
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -68
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Base.lproj/MainMenu.xib +0 -343
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/AppInfo.xcconfig +0 -14
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/Debug.xcconfig +0 -2
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/Release.xcconfig +0 -2
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/Warnings.xcconfig +0 -13
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/DebugProfile.entitlements +0 -12
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Info.plist +0 -32
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/MainFlutterWindow.swift +0 -15
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Release.entitlements +0 -8
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcodeproj/project.pbxproj +0 -705
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +0 -98
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcworkspace/contents.xcworkspacedata +0 -7
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/e2e-tests/test-applications/flutter-test-app/macos/RunnerTests/RunnerTests.swift +0 -12
- package/e2e-tests/test-applications/flutter-test-app/pubspec.lock +0 -213
- package/e2e-tests/test-applications/flutter-test-app/pubspec.yaml +0 -89
- package/e2e-tests/test-applications/flutter-test-app/test/widget_test.dart +0 -30
- package/e2e-tests/test-applications/flutter-test-app/web/favicon.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-192.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-512.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-maskable-192.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-maskable-512.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/web/index.html +0 -38
- package/e2e-tests/test-applications/flutter-test-app/web/manifest.json +0 -35
- package/e2e-tests/test-applications/flutter-test-app/windows/CMakeLists.txt +0 -108
- package/e2e-tests/test-applications/flutter-test-app/windows/flutter/CMakeLists.txt +0 -109
- package/e2e-tests/test-applications/flutter-test-app/windows/flutter/generated_plugin_registrant.cc +0 -11
- package/e2e-tests/test-applications/flutter-test-app/windows/flutter/generated_plugin_registrant.h +0 -15
- package/e2e-tests/test-applications/flutter-test-app/windows/flutter/generated_plugins.cmake +0 -23
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/CMakeLists.txt +0 -40
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/Runner.rc +0 -121
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/flutter_window.cpp +0 -71
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/flutter_window.h +0 -33
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/main.cpp +0 -43
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/resource.h +0 -16
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/resources/app_icon.ico +0 -0
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/runner.exe.manifest +0 -14
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/utils.cpp +0 -65
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/utils.h +0 -19
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/win32_window.cpp +0 -288
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/win32_window.h +0 -102
- package/e2e-tests/test-applications/nextjs-test-app/next.config.mjs +0 -4
- package/e2e-tests/test-applications/nextjs-test-app/package.json +0 -22
- package/e2e-tests/test-applications/nextjs-test-app/src/app/layout.tsx +0 -20
- package/e2e-tests/test-applications/nextjs-test-app/src/app/page.tsx +0 -90
- package/e2e-tests/test-applications/nuxt-3-test-app/README.md +0 -75
- package/e2e-tests/test-applications/nuxt-3-test-app/nuxt.config.ts +0 -5
- package/e2e-tests/test-applications/nuxt-3-test-app/package.json +0 -18
- package/e2e-tests/test-applications/nuxt-3-test-app/public/favicon.ico +0 -0
- package/e2e-tests/test-applications/nuxt-3-test-app/public/robots.txt +0 -1
- package/e2e-tests/test-applications/nuxt-4-test-app/README.md +0 -75
- package/e2e-tests/test-applications/nuxt-4-test-app/nuxt.config.ts +0 -6
- package/e2e-tests/test-applications/nuxt-4-test-app/package.json +0 -18
- package/e2e-tests/test-applications/nuxt-4-test-app/public/favicon.ico +0 -0
- package/e2e-tests/test-applications/nuxt-4-test-app/public/robots.txt +0 -1
- package/e2e-tests/test-applications/remix-test-app/app/entry.client.tsx +0 -18
- package/e2e-tests/test-applications/remix-test-app/app/entry.server.tsx +0 -140
- package/e2e-tests/test-applications/remix-test-app/app/root.tsx +0 -30
- package/e2e-tests/test-applications/remix-test-app/app/routes/_index.tsx +0 -48
- package/e2e-tests/test-applications/remix-test-app/app/tailwind.css +0 -3
- package/e2e-tests/test-applications/remix-test-app/package.json +0 -37
- package/e2e-tests/test-applications/remix-test-app/postcss.config.js +0 -6
- package/e2e-tests/test-applications/remix-test-app/tailwind.config.ts +0 -9
- package/e2e-tests/test-applications/remix-test-app/vite.config.ts +0 -16
- package/e2e-tests/test-applications/sveltekit-test-app/package.json +0 -21
- package/e2e-tests/test-applications/sveltekit-test-app/src/app.d.ts +0 -13
- package/e2e-tests/test-applications/sveltekit-test-app/src/app.html +0 -11
- package/e2e-tests/test-applications/sveltekit-test-app/src/lib/index.ts +0 -1
- package/e2e-tests/test-applications/sveltekit-test-app/src/routes/+page.svelte +0 -2
- package/e2e-tests/test-applications/sveltekit-test-app/svelte.config.js +0 -18
- package/e2e-tests/test-applications/sveltekit-test-app/vite.config.ts +0 -6
- package/e2e-tests/tests/flutter.test.ts +0 -127
- package/e2e-tests/tests/nextjs.test.ts +0 -161
- package/e2e-tests/tests/nuxt-3.test.ts +0 -189
- package/e2e-tests/tests/nuxt-4.test.ts +0 -188
- package/e2e-tests/tests/remix.test.ts +0 -277
- package/e2e-tests/tests/sveltekit.test.ts +0 -284
- package/e2e-tests/utils/index.ts +0 -456
- package/index.ts +0 -2
- package/lib/Constants.ts +0 -118
- package/lib/Helper/BottomBar.ts +0 -28
- package/lib/Helper/Env.ts +0 -7
- package/lib/Helper/File.ts +0 -65
- package/lib/Helper/Git.ts +0 -39
- package/lib/Helper/Logging.ts +0 -44
- package/lib/Helper/MergeConfig.ts +0 -19
- package/lib/Helper/Package.ts +0 -80
- package/lib/Helper/SentryCli.ts +0 -139
- package/lib/Helper/Wizard.ts +0 -58
- package/lib/Helper/__tests__/File.ts +0 -15
- package/lib/Helper/__tests__/MergeConfig.ts +0 -98
- package/lib/Helper/__tests__/SentryCli.ts +0 -86
- package/lib/Helper/test-fixtures/next.config.1-merged.js +0 -18
- package/lib/Helper/test-fixtures/next.config.1.js +0 -6
- package/lib/Helper/test-fixtures/next.config.2.js +0 -8
- package/lib/Helper/test-fixtures/next.config.3-merged.js +0 -21
- package/lib/Helper/test-fixtures/next.config.3.js +0 -9
- package/lib/Helper/test-fixtures/next.config.4-merged.js +0 -21
- package/lib/Helper/test-fixtures/next.config.4.js +0 -9
- package/lib/Setup.ts +0 -40
- package/lib/Steps/BaseStep.ts +0 -25
- package/lib/Steps/ChooseIntegration.ts +0 -144
- package/lib/Steps/ConfigureProject.ts +0 -10
- package/lib/Steps/Initial.ts +0 -35
- package/lib/Steps/Integrations/BaseIntegration.ts +0 -42
- package/lib/Steps/Integrations/Cordova.ts +0 -283
- package/lib/Steps/Integrations/Electron.ts +0 -164
- package/lib/Steps/Integrations/MobileProject.ts +0 -72
- package/lib/Steps/OpenSentry.ts +0 -80
- package/lib/Steps/PromptForParameters.ts +0 -200
- package/lib/Steps/Result.ts +0 -22
- package/lib/Steps/SentryProjectSelector.ts +0 -83
- package/lib/Steps/ShouldConfigure.ts +0 -10
- package/lib/Steps/WaitForSentry.ts +0 -56
- package/lib/Steps/Welcome.ts +0 -21
- package/lib/Steps/index.ts +0 -10
- package/lib/__tests__/Env.ts +0 -29
- package/scripts/NextJs/configs/_error.js +0 -39
- package/scripts/NextJs/configs/next.config.js +0 -36
- package/scripts/NextJs/configs/next.config.template.js +0 -12
- package/scripts/NextJs/configs/sentry.client.config.js +0 -17
- package/scripts/NextJs/configs/sentry.edge.config.js +0 -17
- package/scripts/NextJs/configs/sentry.server.config.js +0 -17
- package/scripts/NextJs/sentry_sample_error.js +0 -47
- package/scripts/craft-pre-release.sh +0 -10
- package/src/android/android-wizard.ts +0 -192
- package/src/android/code-tools.ts +0 -170
- package/src/android/gradle.ts +0 -250
- package/src/android/manifest.ts +0 -180
- package/src/android/templates.ts +0 -86
- package/src/apple/apple-wizard.ts +0 -269
- package/src/apple/cocoapod.ts +0 -73
- package/src/apple/code-tools.ts +0 -147
- package/src/apple/fastlane.ts +0 -170
- package/src/apple/templates.ts +0 -65
- package/src/apple/xcode-manager.ts +0 -404
- package/src/flutter/code-tools.ts +0 -284
- package/src/flutter/flutter-wizard.ts +0 -164
- package/src/flutter/templates.ts +0 -90
- package/src/nextjs/nextjs-wizard.ts +0 -1007
- package/src/nextjs/templates.ts +0 -525
- package/src/nextjs/utils.ts +0 -21
- package/src/nuxt/nuxt-wizard.ts +0 -188
- package/src/nuxt/sdk-example.ts +0 -135
- package/src/nuxt/sdk-setup.ts +0 -352
- package/src/nuxt/templates.ts +0 -303
- package/src/nuxt/types.ts +0 -8
- package/src/nuxt/utils.ts +0 -42
- package/src/react-native/expo-env-file.ts +0 -55
- package/src/react-native/expo-metro.ts +0 -212
- package/src/react-native/expo.ts +0 -175
- package/src/react-native/git.ts +0 -25
- package/src/react-native/glob.ts +0 -13
- package/src/react-native/gradle.ts +0 -26
- package/src/react-native/javascript.ts +0 -103
- package/src/react-native/metro.ts +0 -599
- package/src/react-native/options.ts +0 -5
- package/src/react-native/react-native-wizard.ts +0 -512
- package/src/react-native/uninstall.ts +0 -109
- package/src/react-native/xcode.ts +0 -302
- package/src/remix/codemods/express-server.ts +0 -44
- package/src/remix/codemods/handle-error.ts +0 -118
- package/src/remix/codemods/root-common.ts +0 -63
- package/src/remix/codemods/root-v1.ts +0 -41
- package/src/remix/codemods/root-v2.ts +0 -153
- package/src/remix/remix-wizard.ts +0 -261
- package/src/remix/sdk-example.ts +0 -120
- package/src/remix/sdk-setup.ts +0 -546
- package/src/remix/templates.ts +0 -11
- package/src/remix/utils.ts +0 -96
- package/src/run.ts +0 -211
- package/src/sourcemaps/sourcemaps-wizard.ts +0 -364
- package/src/sourcemaps/tools/angular.ts +0 -42
- package/src/sourcemaps/tools/create-react-app.ts +0 -19
- package/src/sourcemaps/tools/esbuild.ts +0 -65
- package/src/sourcemaps/tools/nextjs.ts +0 -114
- package/src/sourcemaps/tools/remix.ts +0 -90
- package/src/sourcemaps/tools/rollup.ts +0 -67
- package/src/sourcemaps/tools/sentry-cli.ts +0 -287
- package/src/sourcemaps/tools/tsc.ts +0 -144
- package/src/sourcemaps/tools/types.ts +0 -11
- package/src/sourcemaps/tools/vite.ts +0 -300
- package/src/sourcemaps/tools/webpack.ts +0 -383
- package/src/sourcemaps/utils/detect-tool.ts +0 -46
- package/src/sourcemaps/utils/other-wizards.ts +0 -167
- package/src/sourcemaps/utils/sdk-version.ts +0 -266
- package/src/sveltekit/sdk-example.ts +0 -56
- package/src/sveltekit/sdk-setup.ts +0 -667
- package/src/sveltekit/sveltekit-wizard.ts +0 -192
- package/src/sveltekit/templates.ts +0 -185
- package/src/sveltekit/utils.ts +0 -50
- package/src/telemetry.ts +0 -144
- package/src/utils/ast-utils.ts +0 -270
- package/src/utils/bash.ts +0 -57
- package/src/utils/clack-utils.ts +0 -1536
- package/src/utils/debug.ts +0 -20
- package/src/utils/package-json.ts +0 -51
- package/src/utils/package-manager.ts +0 -172
- package/src/utils/release-registry.ts +0 -19
- package/src/utils/semver.ts +0 -33
- package/src/utils/sentrycli-utils.ts +0 -24
- package/src/utils/string.ts +0 -7
- package/src/utils/types.ts +0 -77
- package/src/utils/url.ts +0 -27
- package/src/utils/vendor/is-unicorn-supported.ts +0 -29
- package/test/android/code-tools.test.ts +0 -49
- package/test/apple/cocoapod.test.ts +0 -310
- package/test/apple/code-tools.test.ts +0 -1042
- package/test/apple/fastfile.test.ts +0 -555
- package/test/apple/templates.test.ts +0 -191
- package/test/apple/xcode-manager.test.ts +0 -1068
- package/test/flutter/code-tools.test.ts +0 -212
- package/test/flutter/templates.test.ts +0 -100
- package/test/nextjs/templates.test.ts +0 -429
- package/test/nuxt/templates.test.ts +0 -255
- package/test/react-native/expo-metro.test.ts +0 -81
- package/test/react-native/expo.test.ts +0 -86
- package/test/react-native/gradle.test.ts +0 -310
- package/test/react-native/javascript.test.ts +0 -134
- package/test/react-native/metro.test.ts +0 -396
- package/test/react-native/xcode.test.ts +0 -401
- package/test/remix/client-entry.test.ts +0 -122
- package/test/remix/server-instrumentation.test.ts +0 -36
- package/test/sourcemaps/tools/sentry-cli.test.ts +0 -57
- package/test/sourcemaps/tools/tsc.test.ts +0 -181
- package/test/sourcemaps/tools/vite.test.ts +0 -149
- package/test/sourcemaps/tools/webpack.test.ts +0 -303
- package/test/sveltekit/templates.test.ts +0 -152
- package/test/utils/ast-utils.test.ts +0 -264
- package/test/utils/clack-utils.test.ts +0 -224
- package/types/read-env.d.ts +0 -3
- package/types/xcode.d.ts +0 -527
package/src/nextjs/templates.ts
DELETED
|
@@ -1,525 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { makeCodeSnippet } from '../utils/clack-utils';
|
|
3
|
-
|
|
4
|
-
type WithSentryConfigOptions = {
|
|
5
|
-
orgSlug: string;
|
|
6
|
-
projectSlug: string;
|
|
7
|
-
selfHosted: boolean;
|
|
8
|
-
sentryUrl: string;
|
|
9
|
-
tunnelRoute: boolean;
|
|
10
|
-
reactComponentAnnotation: boolean;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export function getWithSentryConfigOptionsTemplate({
|
|
14
|
-
orgSlug,
|
|
15
|
-
projectSlug,
|
|
16
|
-
selfHosted,
|
|
17
|
-
tunnelRoute,
|
|
18
|
-
reactComponentAnnotation,
|
|
19
|
-
sentryUrl,
|
|
20
|
-
}: WithSentryConfigOptions): string {
|
|
21
|
-
return `{
|
|
22
|
-
// For all available options, see:
|
|
23
|
-
// https://github.com/getsentry/sentry-webpack-plugin#options
|
|
24
|
-
|
|
25
|
-
org: "${orgSlug}",
|
|
26
|
-
project: "${projectSlug}",${
|
|
27
|
-
selfHosted ? `\n sentryUrl: "${sentryUrl}",` : ''
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Only print logs for uploading source maps in CI
|
|
31
|
-
silent: !process.env.CI,
|
|
32
|
-
|
|
33
|
-
// For all available options, see:
|
|
34
|
-
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
|
|
35
|
-
|
|
36
|
-
// Upload a larger set of source maps for prettier stack traces (increases build time)
|
|
37
|
-
widenClientFileUpload: true,${
|
|
38
|
-
reactComponentAnnotation
|
|
39
|
-
? `\n
|
|
40
|
-
// Automatically annotate React components to show their full name in breadcrumbs and session replay
|
|
41
|
-
reactComponentAnnotation: {
|
|
42
|
-
enabled: true,
|
|
43
|
-
},`
|
|
44
|
-
: ''
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// ${
|
|
48
|
-
tunnelRoute ? 'Route' : 'Uncomment to route'
|
|
49
|
-
} browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
|
|
50
|
-
// This can increase your server load as well as your hosting bill.
|
|
51
|
-
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
|
|
52
|
-
// side errors will fail.
|
|
53
|
-
${tunnelRoute ? '' : '// '}tunnelRoute: "/monitoring",
|
|
54
|
-
|
|
55
|
-
// Automatically tree-shake Sentry logger statements to reduce bundle size
|
|
56
|
-
disableLogger: true,
|
|
57
|
-
|
|
58
|
-
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
|
|
59
|
-
// See the following for more information:
|
|
60
|
-
// https://docs.sentry.io/product/crons/
|
|
61
|
-
// https://vercel.com/docs/cron-jobs
|
|
62
|
-
automaticVercelMonitors: true,
|
|
63
|
-
}`;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function getNextjsConfigCjsTemplate(
|
|
67
|
-
withSentryConfigOptionsTemplate: string,
|
|
68
|
-
): string {
|
|
69
|
-
return `const { withSentryConfig } = require("@sentry/nextjs");
|
|
70
|
-
|
|
71
|
-
/** @type {import('next').NextConfig} */
|
|
72
|
-
const nextConfig = {};
|
|
73
|
-
|
|
74
|
-
module.exports = withSentryConfig(
|
|
75
|
-
nextConfig,
|
|
76
|
-
${withSentryConfigOptionsTemplate}
|
|
77
|
-
);
|
|
78
|
-
`;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function getNextjsConfigMjsTemplate(
|
|
82
|
-
withSentryConfigOptionsTemplate: string,
|
|
83
|
-
): string {
|
|
84
|
-
return `import { withSentryConfig } from "@sentry/nextjs";
|
|
85
|
-
|
|
86
|
-
/** @type {import('next').NextConfig} */
|
|
87
|
-
const nextConfig = {};
|
|
88
|
-
|
|
89
|
-
export default withSentryConfig(
|
|
90
|
-
nextConfig,
|
|
91
|
-
${withSentryConfigOptionsTemplate}
|
|
92
|
-
);
|
|
93
|
-
`;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export function getNextjsConfigCjsAppendix(
|
|
97
|
-
withSentryConfigOptionsTemplate: string,
|
|
98
|
-
): string {
|
|
99
|
-
return `
|
|
100
|
-
|
|
101
|
-
// Injected content via Sentry wizard below
|
|
102
|
-
|
|
103
|
-
const { withSentryConfig } = require("@sentry/nextjs");
|
|
104
|
-
|
|
105
|
-
module.exports = withSentryConfig(
|
|
106
|
-
module.exports,
|
|
107
|
-
${withSentryConfigOptionsTemplate}
|
|
108
|
-
);
|
|
109
|
-
`;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export function getNextjsConfigEsmCopyPasteSnippet(
|
|
113
|
-
withSentryConfigOptionsTemplate: string,
|
|
114
|
-
): string {
|
|
115
|
-
return `
|
|
116
|
-
|
|
117
|
-
// next.config.mjs
|
|
118
|
-
import { withSentryConfig } from "@sentry/nextjs";
|
|
119
|
-
|
|
120
|
-
export default withSentryConfig(
|
|
121
|
-
yourNextConfig,
|
|
122
|
-
${withSentryConfigOptionsTemplate}
|
|
123
|
-
);
|
|
124
|
-
`;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function getClientIntegrationsSnippet(features: { replay: boolean }) {
|
|
128
|
-
if (features.replay) {
|
|
129
|
-
return `
|
|
130
|
-
|
|
131
|
-
// Add optional integrations for additional features
|
|
132
|
-
integrations: [
|
|
133
|
-
Sentry.replayIntegration(),
|
|
134
|
-
],`;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return '';
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export function getSentryConfigContents(
|
|
141
|
-
dsn: string,
|
|
142
|
-
config: 'server' | 'client' | 'edge',
|
|
143
|
-
selectedFeaturesMap: {
|
|
144
|
-
replay: boolean;
|
|
145
|
-
performance: boolean;
|
|
146
|
-
},
|
|
147
|
-
): string {
|
|
148
|
-
let primer;
|
|
149
|
-
if (config === 'server') {
|
|
150
|
-
primer = `// This file configures the initialization of Sentry on the server.
|
|
151
|
-
// The config you add here will be used whenever the server handles a request.
|
|
152
|
-
// https://docs.sentry.io/platforms/javascript/guides/nextjs/`;
|
|
153
|
-
} else if (config === 'client') {
|
|
154
|
-
primer = `// This file configures the initialization of Sentry on the client.
|
|
155
|
-
// The config you add here will be used whenever a users loads a page in their browser.
|
|
156
|
-
// https://docs.sentry.io/platforms/javascript/guides/nextjs/`;
|
|
157
|
-
} else if (config === 'edge') {
|
|
158
|
-
primer = `// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
|
|
159
|
-
// The config you add here will be used whenever one of the edge features is loaded.
|
|
160
|
-
// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.
|
|
161
|
-
// https://docs.sentry.io/platforms/javascript/guides/nextjs/`;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const integrationsOptions = getClientIntegrationsSnippet({
|
|
165
|
-
replay: config === 'client' && selectedFeaturesMap.replay,
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
let replayOptions = '';
|
|
169
|
-
if (config === 'client') {
|
|
170
|
-
if (selectedFeaturesMap.replay) {
|
|
171
|
-
replayOptions += `
|
|
172
|
-
|
|
173
|
-
// Define how likely Replay events are sampled.
|
|
174
|
-
// This sets the sample rate to be 10%. You may want this to be 100% while
|
|
175
|
-
// in development and sample at a lower rate in production
|
|
176
|
-
replaysSessionSampleRate: 0.1,
|
|
177
|
-
|
|
178
|
-
// Define how likely Replay events are sampled when an error occurs.
|
|
179
|
-
replaysOnErrorSampleRate: 1.0,`;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
let performanceOptions = '';
|
|
184
|
-
if (selectedFeaturesMap.performance) {
|
|
185
|
-
performanceOptions += `
|
|
186
|
-
|
|
187
|
-
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
|
|
188
|
-
tracesSampleRate: 1,`;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
192
|
-
return `${primer}
|
|
193
|
-
|
|
194
|
-
import * as Sentry from "@sentry/nextjs";
|
|
195
|
-
|
|
196
|
-
Sentry.init({
|
|
197
|
-
dsn: "${dsn}",${integrationsOptions}${performanceOptions}${replayOptions}
|
|
198
|
-
|
|
199
|
-
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
200
|
-
debug: false,
|
|
201
|
-
});
|
|
202
|
-
`;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
export function getSentryExamplePageContents(options: {
|
|
206
|
-
selfHosted: boolean;
|
|
207
|
-
sentryUrl: string;
|
|
208
|
-
orgSlug: string;
|
|
209
|
-
projectId: string;
|
|
210
|
-
useClient: boolean;
|
|
211
|
-
}): string {
|
|
212
|
-
const issuesPageLink = options.selfHosted
|
|
213
|
-
? `${options.sentryUrl}organizations/${options.orgSlug}/issues/?project=${options.projectId}`
|
|
214
|
-
: `https://${options.orgSlug}.sentry.io/issues/?project=${options.projectId}`;
|
|
215
|
-
|
|
216
|
-
return `${
|
|
217
|
-
options.useClient ? '"use client";\n\n' : ''
|
|
218
|
-
}import Head from "next/head";
|
|
219
|
-
import * as Sentry from "@sentry/nextjs";
|
|
220
|
-
|
|
221
|
-
export default function Page() {
|
|
222
|
-
return (
|
|
223
|
-
<div>
|
|
224
|
-
<Head>
|
|
225
|
-
<title>Sentry Onboarding</title>
|
|
226
|
-
<meta name="description" content="Test Sentry for your Next.js app!" />
|
|
227
|
-
</Head>
|
|
228
|
-
|
|
229
|
-
<main
|
|
230
|
-
style={{
|
|
231
|
-
minHeight: "100vh",
|
|
232
|
-
display: "flex",
|
|
233
|
-
flexDirection: "column",
|
|
234
|
-
justifyContent: "center",
|
|
235
|
-
alignItems: "center",
|
|
236
|
-
}}
|
|
237
|
-
>
|
|
238
|
-
<h1 style={{ fontSize: "4rem", margin: "14px 0" }}>
|
|
239
|
-
<svg
|
|
240
|
-
style={{
|
|
241
|
-
height: "1em",
|
|
242
|
-
}}
|
|
243
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
244
|
-
viewBox="0 0 200 44"
|
|
245
|
-
>
|
|
246
|
-
<path
|
|
247
|
-
fill="currentColor"
|
|
248
|
-
d="M124.32,28.28,109.56,9.22h-3.68V34.77h3.73V15.19l15.18,19.58h3.26V9.22h-3.73ZM87.15,23.54h13.23V20.22H87.14V12.53h14.93V9.21H83.34V34.77h18.92V31.45H87.14ZM71.59,20.3h0C66.44,19.06,65,18.08,65,15.7c0-2.14,1.89-3.59,4.71-3.59a12.06,12.06,0,0,1,7.07,2.55l2-2.83a14.1,14.1,0,0,0-9-3c-5.06,0-8.59,3-8.59,7.27,0,4.6,3,6.19,8.46,7.52C74.51,24.74,76,25.78,76,28.11s-2,3.77-5.09,3.77a12.34,12.34,0,0,1-8.3-3.26l-2.25,2.69a15.94,15.94,0,0,0,10.42,3.85c5.48,0,9-2.95,9-7.51C79.75,23.79,77.47,21.72,71.59,20.3ZM195.7,9.22l-7.69,12-7.64-12h-4.46L186,24.67V34.78h3.84V24.55L200,9.22Zm-64.63,3.46h8.37v22.1h3.84V12.68h8.37V9.22H131.08ZM169.41,24.8c3.86-1.07,6-3.77,6-7.63,0-4.91-3.59-8-9.38-8H154.67V34.76h3.8V25.58h6.45l6.48,9.2h4.44l-7-9.82Zm-10.95-2.5V12.6h7.17c3.74,0,5.88,1.77,5.88,4.84s-2.29,4.86-5.84,4.86Z M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z"
|
|
249
|
-
></path>
|
|
250
|
-
</svg>
|
|
251
|
-
</h1>
|
|
252
|
-
|
|
253
|
-
<p>Get started by sending us a sample error:</p>
|
|
254
|
-
<button
|
|
255
|
-
type="button"
|
|
256
|
-
style={{
|
|
257
|
-
padding: "12px",
|
|
258
|
-
cursor: "pointer",
|
|
259
|
-
backgroundColor: "#AD6CAA",
|
|
260
|
-
borderRadius: "4px",
|
|
261
|
-
border: "none",
|
|
262
|
-
color: "white",
|
|
263
|
-
fontSize: "14px",
|
|
264
|
-
margin: "18px",
|
|
265
|
-
}}
|
|
266
|
-
onClick={async () => {
|
|
267
|
-
await Sentry.startSpan({
|
|
268
|
-
name: 'Example Frontend Span',
|
|
269
|
-
op: 'test'
|
|
270
|
-
}, async () => {
|
|
271
|
-
const res = await fetch("/api/sentry-example-api");
|
|
272
|
-
if (!res.ok) {
|
|
273
|
-
throw new Error("Sentry Example Frontend Error");
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
}}
|
|
277
|
-
>
|
|
278
|
-
Throw error!
|
|
279
|
-
</button>
|
|
280
|
-
|
|
281
|
-
<p>
|
|
282
|
-
Next, look for the error on the{" "}
|
|
283
|
-
<a href="${issuesPageLink}">Issues Page</a>.
|
|
284
|
-
</p>
|
|
285
|
-
<p style={{ marginTop: "24px" }}>
|
|
286
|
-
For more information, see{" "}
|
|
287
|
-
<a href="https://docs.sentry.io/platforms/javascript/guides/nextjs/">
|
|
288
|
-
https://docs.sentry.io/platforms/javascript/guides/nextjs/
|
|
289
|
-
</a>
|
|
290
|
-
</p>
|
|
291
|
-
</main>
|
|
292
|
-
</div>
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
`;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
export function getSentryExamplePagesDirApiRoute() {
|
|
299
|
-
return `// A faulty API route to test Sentry's error monitoring
|
|
300
|
-
export default function handler(_req, res) {
|
|
301
|
-
throw new Error("Sentry Example API Route Error");
|
|
302
|
-
res.status(200).json({ name: "John Doe" });
|
|
303
|
-
}
|
|
304
|
-
`;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
export function getSentryExampleAppDirApiRoute() {
|
|
308
|
-
return `import { NextResponse } from "next/server";
|
|
309
|
-
|
|
310
|
-
export const dynamic = "force-dynamic";
|
|
311
|
-
|
|
312
|
-
// A faulty API route to test Sentry's error monitoring
|
|
313
|
-
export function GET() {
|
|
314
|
-
throw new Error("Sentry Example API Route Error");
|
|
315
|
-
return NextResponse.json({ data: "Testing Sentry Error..." });
|
|
316
|
-
}
|
|
317
|
-
`;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
export function getSentryDefaultUnderscoreErrorPage() {
|
|
321
|
-
return `import * as Sentry from "@sentry/nextjs";
|
|
322
|
-
import Error from "next/error";
|
|
323
|
-
|
|
324
|
-
const CustomErrorComponent = (props) => {
|
|
325
|
-
return <Error statusCode={props.statusCode} />;
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
CustomErrorComponent.getInitialProps = async (contextData) => {
|
|
329
|
-
// In case this is running in a serverless function, await this in order to give Sentry
|
|
330
|
-
// time to send the error before the lambda exits
|
|
331
|
-
await Sentry.captureUnderscoreErrorException(contextData);
|
|
332
|
-
|
|
333
|
-
// This will contain the status code of the response
|
|
334
|
-
return Error.getInitialProps(contextData);
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
export default CustomErrorComponent;
|
|
338
|
-
`;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
export function getSimpleUnderscoreErrorCopyPasteSnippet() {
|
|
342
|
-
return `
|
|
343
|
-
${chalk.green(`import * as Sentry from '@sentry/nextjs';`)}
|
|
344
|
-
${chalk.green(`import Error from "next/error";`)}
|
|
345
|
-
|
|
346
|
-
${chalk.dim(
|
|
347
|
-
'// Replace "YourCustomErrorComponent" with your custom error component!',
|
|
348
|
-
)}
|
|
349
|
-
YourCustomErrorComponent.getInitialProps = async (${chalk.green(
|
|
350
|
-
'contextData',
|
|
351
|
-
)}) => {
|
|
352
|
-
${chalk.green('await Sentry.captureUnderscoreErrorException(contextData);')}
|
|
353
|
-
|
|
354
|
-
${chalk.dim('// ...other getInitialProps code')}
|
|
355
|
-
|
|
356
|
-
return Error.getInitialProps(contextData);
|
|
357
|
-
};
|
|
358
|
-
`;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
export function getFullUnderscoreErrorCopyPasteSnippet(isTs: boolean) {
|
|
362
|
-
return `
|
|
363
|
-
import * as Sentry from '@sentry/nextjs';${
|
|
364
|
-
isTs ? '\nimport type { NextPageContext } from "next";' : ''
|
|
365
|
-
}
|
|
366
|
-
import Error from "next/error";
|
|
367
|
-
|
|
368
|
-
${chalk.dim(
|
|
369
|
-
'// Replace "YourCustomErrorComponent" with your custom error component!',
|
|
370
|
-
)}
|
|
371
|
-
YourCustomErrorComponent.getInitialProps = async (contextData${
|
|
372
|
-
isTs ? ': NextPageContext' : ''
|
|
373
|
-
}) => {
|
|
374
|
-
await Sentry.captureUnderscoreErrorException(contextData);
|
|
375
|
-
|
|
376
|
-
return Error.getInitialProps(contextData);
|
|
377
|
-
};
|
|
378
|
-
`;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
export function getInstrumentationHookContent(
|
|
382
|
-
instrumentationHookLocation: 'src' | 'root',
|
|
383
|
-
) {
|
|
384
|
-
return `import * as Sentry from '@sentry/nextjs';
|
|
385
|
-
|
|
386
|
-
export async function register() {
|
|
387
|
-
if (process.env.NEXT_RUNTIME === 'nodejs') {
|
|
388
|
-
await import('${
|
|
389
|
-
instrumentationHookLocation === 'root' ? '.' : '..'
|
|
390
|
-
}/sentry.server.config');
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
if (process.env.NEXT_RUNTIME === 'edge') {
|
|
394
|
-
await import('${
|
|
395
|
-
instrumentationHookLocation === 'root' ? '.' : '..'
|
|
396
|
-
}/sentry.edge.config');
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
export const onRequestError = Sentry.captureRequestError;
|
|
401
|
-
`;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
export function getInstrumentationHookCopyPasteSnippet(
|
|
405
|
-
instrumentationHookLocation: 'src' | 'root',
|
|
406
|
-
) {
|
|
407
|
-
return makeCodeSnippet(true, (unchanged, plus) => {
|
|
408
|
-
return unchanged(`${plus("import * as Sentry from '@sentry/nextjs';")}
|
|
409
|
-
|
|
410
|
-
export ${plus('async')} function register() {
|
|
411
|
-
${plus(`if (process.env.NEXT_RUNTIME === 'nodejs') {
|
|
412
|
-
await import('${
|
|
413
|
-
instrumentationHookLocation === 'root' ? '.' : '..'
|
|
414
|
-
}/sentry.server.config');
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
if (process.env.NEXT_RUNTIME === 'edge') {
|
|
418
|
-
await import('${
|
|
419
|
-
instrumentationHookLocation === 'root' ? '.' : '..'
|
|
420
|
-
}/sentry.edge.config');
|
|
421
|
-
}`)}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
${plus('export const onRequestError = Sentry.captureRequestError;')}
|
|
425
|
-
`);
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
export function getSentryDefaultGlobalErrorPage(isTs: boolean) {
|
|
430
|
-
return isTs
|
|
431
|
-
? `"use client";
|
|
432
|
-
|
|
433
|
-
import * as Sentry from "@sentry/nextjs";
|
|
434
|
-
import NextError from "next/error";
|
|
435
|
-
import { useEffect } from "react";
|
|
436
|
-
|
|
437
|
-
export default function GlobalError({ error }: { error: Error & { digest?: string } }) {
|
|
438
|
-
useEffect(() => {
|
|
439
|
-
Sentry.captureException(error);
|
|
440
|
-
}, [error]);
|
|
441
|
-
|
|
442
|
-
return (
|
|
443
|
-
<html>
|
|
444
|
-
<body>
|
|
445
|
-
{/* \`NextError\` is the default Next.js error page component. Its type
|
|
446
|
-
definition requires a \`statusCode\` prop. However, since the App Router
|
|
447
|
-
does not expose status codes for errors, we simply pass 0 to render a
|
|
448
|
-
generic error message. */}
|
|
449
|
-
<NextError statusCode={0} />
|
|
450
|
-
</body>
|
|
451
|
-
</html>
|
|
452
|
-
);
|
|
453
|
-
}`
|
|
454
|
-
: `"use client";
|
|
455
|
-
|
|
456
|
-
import * as Sentry from "@sentry/nextjs";
|
|
457
|
-
import NextError from "next/error";
|
|
458
|
-
import { useEffect } from "react";
|
|
459
|
-
|
|
460
|
-
export default function GlobalError({ error }) {
|
|
461
|
-
useEffect(() => {
|
|
462
|
-
Sentry.captureException(error);
|
|
463
|
-
}, [error]);
|
|
464
|
-
|
|
465
|
-
return (
|
|
466
|
-
<html>
|
|
467
|
-
<body>
|
|
468
|
-
{/* \`NextError\` is the default Next.js error page component. Its type
|
|
469
|
-
definition requires a \`statusCode\` prop. However, since the App Router
|
|
470
|
-
does not expose status codes for errors, we simply pass 0 to render a
|
|
471
|
-
generic error message. */}
|
|
472
|
-
<NextError statusCode={0} />
|
|
473
|
-
</body>
|
|
474
|
-
</html>
|
|
475
|
-
);
|
|
476
|
-
}
|
|
477
|
-
`;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
export function getGlobalErrorCopyPasteSnippet(isTs: boolean) {
|
|
481
|
-
if (isTs) {
|
|
482
|
-
return `"use client";
|
|
483
|
-
|
|
484
|
-
${chalk.green('import * as Sentry from "@sentry/nextjs";')}
|
|
485
|
-
${chalk.green('import Error from "next/error";')}
|
|
486
|
-
${chalk.green('import { useEffect } from "react";')}
|
|
487
|
-
|
|
488
|
-
export default function GlobalError(${chalk.green(
|
|
489
|
-
'{ error }: { error: Error }',
|
|
490
|
-
)}) {
|
|
491
|
-
${chalk.green(`useEffect(() => {
|
|
492
|
-
Sentry.captureException(error);
|
|
493
|
-
}, [error]);`)}
|
|
494
|
-
|
|
495
|
-
return (
|
|
496
|
-
<html>
|
|
497
|
-
<body>
|
|
498
|
-
{/* Your Error component here... */}
|
|
499
|
-
</body>
|
|
500
|
-
</html>
|
|
501
|
-
);
|
|
502
|
-
}
|
|
503
|
-
`;
|
|
504
|
-
}
|
|
505
|
-
return `"use client";
|
|
506
|
-
|
|
507
|
-
${chalk.green('import * as Sentry from "@sentry/nextjs";')}
|
|
508
|
-
${chalk.green('import Error from "next/error";')}
|
|
509
|
-
${chalk.green('import { useEffect } from "react";')}
|
|
510
|
-
|
|
511
|
-
export default function GlobalError(${chalk.green('{ error }')}) {
|
|
512
|
-
${chalk.green(`useEffect(() => {
|
|
513
|
-
Sentry.captureException(error);
|
|
514
|
-
}, [error]);`)}
|
|
515
|
-
|
|
516
|
-
return (
|
|
517
|
-
<html>
|
|
518
|
-
<body>
|
|
519
|
-
{/* Your Error component here... */}
|
|
520
|
-
</body>
|
|
521
|
-
</html>
|
|
522
|
-
);
|
|
523
|
-
}
|
|
524
|
-
`;
|
|
525
|
-
}
|
package/src/nextjs/utils.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { major, minVersion } from 'semver';
|
|
2
|
-
|
|
3
|
-
export function getNextJsVersionBucket(version: string | undefined) {
|
|
4
|
-
if (!version) {
|
|
5
|
-
return 'none';
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
try {
|
|
9
|
-
const minVer = minVersion(version);
|
|
10
|
-
if (!minVer) {
|
|
11
|
-
return 'invalid';
|
|
12
|
-
}
|
|
13
|
-
const majorVersion = major(minVer);
|
|
14
|
-
if (majorVersion >= 11) {
|
|
15
|
-
return `${majorVersion}.x`;
|
|
16
|
-
}
|
|
17
|
-
return '<11.0.0';
|
|
18
|
-
} catch {
|
|
19
|
-
return 'unknown';
|
|
20
|
-
}
|
|
21
|
-
}
|