@sentry/wizard 3.42.0 → 4.0.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/.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/CHANGELOG.md +30 -0
- package/COPYING +3575 -0
- package/bin.ts +85 -80
- package/dist/bin.js +44 -35
- package/dist/bin.js.map +1 -1
- package/dist/e2e-tests/jest.config.js +1 -1
- package/dist/e2e-tests/jest.config.js.map +1 -1
- package/dist/e2e-tests/tests/flutter.test.js +62 -147
- package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs.test.js +77 -175
- package/dist/e2e-tests/tests/nextjs.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js +61 -162
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +62 -163
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +147 -189
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit.test.js +133 -187
- package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
- package/dist/e2e-tests/utils/index.d.ts +1 -1
- package/dist/e2e-tests/utils/index.js +113 -195
- package/dist/e2e-tests/utils/index.js.map +1 -1
- package/dist/lib/Constants.js +5 -5
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Helper/BottomBar.d.ts +1 -1
- package/dist/lib/Helper/BottomBar.js +14 -15
- package/dist/lib/Helper/BottomBar.js.map +1 -1
- package/dist/lib/Helper/Env.js +5 -2
- package/dist/lib/Helper/Env.js.map +1 -1
- package/dist/lib/Helper/File.js +14 -27
- package/dist/lib/Helper/File.js.map +1 -1
- package/dist/lib/Helper/Git.js +24 -59
- package/dist/lib/Helper/Git.js.map +1 -1
- package/dist/lib/Helper/Logging.js +2 -2
- package/dist/lib/Helper/Logging.js.map +1 -1
- package/dist/lib/Helper/MergeConfig.js +4 -4
- package/dist/lib/Helper/MergeConfig.js.map +1 -1
- package/dist/lib/Helper/Package.d.ts +4 -1
- package/dist/lib/Helper/Package.js +12 -38
- package/dist/lib/Helper/Package.js.map +1 -1
- package/dist/lib/Helper/SentryCli.js +77 -149
- package/dist/lib/Helper/SentryCli.js.map +1 -1
- package/dist/lib/Helper/Wizard.js +29 -124
- package/dist/lib/Helper/Wizard.js.map +1 -1
- package/dist/lib/Helper/__tests__/File.js +4 -4
- package/dist/lib/Helper/__tests__/File.js.map +1 -1
- package/dist/lib/Helper/__tests__/MergeConfig.js +24 -24
- package/dist/lib/Helper/__tests__/MergeConfig.js.map +1 -1
- package/dist/lib/Helper/__tests__/SentryCli.js +33 -23
- package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
- package/dist/lib/Setup.js +23 -85
- package/dist/lib/Setup.js.map +1 -1
- package/dist/lib/Steps/BaseStep.js +8 -8
- package/dist/lib/Steps/BaseStep.js.map +1 -1
- package/dist/lib/Steps/ChooseIntegration.js +80 -125
- package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
- package/dist/lib/Steps/ConfigureProject.js +6 -66
- package/dist/lib/Steps/ConfigureProject.js.map +1 -1
- package/dist/lib/Steps/Initial.js +16 -104
- package/dist/lib/Steps/Initial.js.map +1 -1
- package/dist/lib/Steps/Integrations/BaseIntegration.js +24 -118
- package/dist/lib/Steps/Integrations/BaseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/Cordova.js +95 -183
- package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.js +87 -145
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/lib/Steps/Integrations/MobileProject.js +40 -148
- package/dist/lib/Steps/Integrations/MobileProject.js.map +1 -1
- package/dist/lib/Steps/OpenSentry.js +63 -126
- package/dist/lib/Steps/OpenSentry.js.map +1 -1
- package/dist/lib/Steps/PromptForParameters.js +110 -206
- package/dist/lib/Steps/PromptForParameters.js.map +1 -1
- package/dist/lib/Steps/Result.js +19 -79
- package/dist/lib/Steps/Result.js.map +1 -1
- package/dist/lib/Steps/SentryProjectSelector.js +57 -148
- package/dist/lib/Steps/SentryProjectSelector.js.map +1 -1
- package/dist/lib/Steps/ShouldConfigure.js +6 -66
- package/dist/lib/Steps/ShouldConfigure.js.map +1 -1
- package/dist/lib/Steps/WaitForSentry.js +43 -120
- package/dist/lib/Steps/WaitForSentry.js.map +1 -1
- package/dist/lib/Steps/Welcome.js +17 -76
- package/dist/lib/Steps/Welcome.js.map +1 -1
- package/dist/lib/__tests__/Env.js +3 -3
- package/dist/lib/__tests__/Env.js.map +1 -1
- package/dist/src/android/android-wizard.js +100 -176
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/android/code-tools.js +24 -33
- package/dist/src/android/code-tools.js.map +1 -1
- package/dist/src/android/gradle.js +106 -165
- package/dist/src/android/gradle.js.map +1 -1
- package/dist/src/android/manifest.js +26 -27
- package/dist/src/android/manifest.js.map +1 -1
- package/dist/src/android/templates.js +76 -23
- package/dist/src/android/templates.js.map +1 -1
- package/dist/src/apple/apple-wizard.js +129 -225
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/apple/cocoapod.js +47 -109
- package/dist/src/apple/cocoapod.js.map +1 -1
- package/dist/src/apple/code-tools.js +32 -35
- package/dist/src/apple/code-tools.js.map +1 -1
- package/dist/src/apple/fastlane.js +51 -97
- package/dist/src/apple/fastlane.js.map +1 -1
- package/dist/src/apple/templates.js +41 -5
- package/dist/src/apple/templates.js.map +1 -1
- package/dist/src/apple/xcode-manager.d.ts +2 -2
- package/dist/src/apple/xcode-manager.js +93 -108
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/flutter/code-tools.js +79 -127
- package/dist/src/flutter/code-tools.js.map +1 -1
- package/dist/src/flutter/flutter-wizard.js +75 -136
- package/dist/src/flutter/flutter-wizard.js.map +1 -1
- package/dist/src/flutter/templates.js +48 -12
- package/dist/src/flutter/templates.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +527 -805
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.js +380 -40
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nextjs/utils.js +5 -5
- package/dist/src/nextjs/utils.js.map +1 -1
- package/dist/src/nuxt/nuxt-wizard.js +91 -188
- package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
- package/dist/src/nuxt/sdk-example.js +68 -137
- package/dist/src/nuxt/sdk-example.js.map +1 -1
- package/dist/src/nuxt/sdk-setup.d.ts +4 -4
- package/dist/src/nuxt/sdk-setup.js +180 -336
- package/dist/src/nuxt/sdk-setup.js.map +1 -1
- package/dist/src/nuxt/templates.js +195 -18
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/nuxt/utils.js +29 -76
- package/dist/src/nuxt/utils.js.map +1 -1
- package/dist/src/react-native/expo-env-file.js +41 -94
- package/dist/src/react-native/expo-env-file.js.map +1 -1
- package/dist/src/react-native/expo-metro.d.ts +1 -1
- package/dist/src/react-native/expo-metro.js +75 -130
- package/dist/src/react-native/expo-metro.js.map +1 -1
- package/dist/src/react-native/expo.js +61 -114
- package/dist/src/react-native/expo.js.map +1 -1
- package/dist/src/react-native/git.js +23 -56
- package/dist/src/react-native/git.js.map +1 -1
- package/dist/src/react-native/glob.js +3 -3
- package/dist/src/react-native/glob.js.map +1 -1
- package/dist/src/react-native/gradle.js +4 -4
- package/dist/src/react-native/gradle.js.map +1 -1
- package/dist/src/react-native/javascript.js +51 -95
- package/dist/src/react-native/javascript.js.map +1 -1
- package/dist/src/react-native/metro.js +176 -296
- package/dist/src/react-native/metro.js.map +1 -1
- package/dist/src/react-native/react-native-wizard.js +267 -418
- package/dist/src/react-native/react-native-wizard.js.map +1 -1
- package/dist/src/react-native/uninstall.js +37 -80
- package/dist/src/react-native/uninstall.js.map +1 -1
- package/dist/src/react-native/xcode.js +57 -55
- package/dist/src/react-native/xcode.js.map +1 -1
- package/dist/src/remix/codemods/express-server.js +27 -82
- package/dist/src/remix/codemods/express-server.js.map +1 -1
- package/dist/src/remix/codemods/handle-error.js +28 -31
- package/dist/src/remix/codemods/handle-error.js.map +1 -1
- package/dist/src/remix/codemods/root-common.js +11 -11
- package/dist/src/remix/codemods/root-common.js.map +1 -1
- package/dist/src/remix/codemods/root-v1.js +17 -67
- package/dist/src/remix/codemods/root-v1.js.map +1 -1
- package/dist/src/remix/codemods/root-v2.js +89 -140
- package/dist/src/remix/codemods/root-v2.js.map +1 -1
- package/dist/src/remix/remix-wizard.js +181 -343
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/remix/sdk-example.js +84 -66
- package/dist/src/remix/sdk-example.js.map +1 -1
- package/dist/src/remix/sdk-setup.js +161 -293
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/remix/templates.js +10 -2
- package/dist/src/remix/templates.js.map +1 -1
- package/dist/src/remix/utils.js +13 -14
- package/dist/src/remix/utils.js.map +1 -1
- package/dist/src/run.js +106 -178
- package/dist/src/run.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.js +248 -372
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/angular.js +32 -66
- package/dist/src/sourcemaps/tools/angular.js.map +1 -1
- package/dist/src/sourcemaps/tools/create-react-app.js +14 -59
- package/dist/src/sourcemaps/tools/create-react-app.js.map +1 -1
- package/dist/src/sourcemaps/tools/esbuild.js +34 -77
- package/dist/src/sourcemaps/tools/esbuild.js.map +1 -1
- package/dist/src/sourcemaps/tools/nextjs.d.ts +2 -2
- package/dist/src/sourcemaps/tools/nextjs.js +75 -102
- package/dist/src/sourcemaps/tools/nextjs.js.map +1 -1
- package/dist/src/sourcemaps/tools/remix.js +53 -93
- package/dist/src/sourcemaps/tools/remix.js.map +1 -1
- package/dist/src/sourcemaps/tools/rollup.js +35 -76
- package/dist/src/sourcemaps/tools/rollup.js.map +1 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js +157 -289
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/tools/tsc.js +68 -134
- package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
- package/dist/src/sourcemaps/tools/vite.js +111 -196
- package/dist/src/sourcemaps/tools/vite.js.map +1 -1
- package/dist/src/sourcemaps/tools/webpack.d.ts +1 -1
- package/dist/src/sourcemaps/tools/webpack.js +158 -260
- package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
- package/dist/src/sourcemaps/utils/detect-tool.js +9 -54
- package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
- package/dist/src/sourcemaps/utils/other-wizards.js +77 -144
- package/dist/src/sourcemaps/utils/other-wizards.js.map +1 -1
- package/dist/src/sourcemaps/utils/sdk-version.js +112 -191
- package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -1
- package/dist/src/sveltekit/sdk-example.js +20 -70
- package/dist/src/sveltekit/sdk-example.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup.js +250 -411
- package/dist/src/sveltekit/sdk-setup.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +107 -191
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/sveltekit/templates.js +147 -13
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/sveltekit/utils.js +3 -3
- package/dist/src/sveltekit/utils.js.map +1 -1
- package/dist/src/telemetry.d.ts +2 -2
- package/dist/src/telemetry.js +58 -108
- package/dist/src/telemetry.js.map +1 -1
- package/dist/src/utils/ast-utils.js +39 -54
- package/dist/src/utils/ast-utils.js.map +1 -1
- package/dist/src/utils/bash.js +28 -75
- package/dist/src/utils/bash.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +3 -7
- package/dist/src/utils/clack-utils.js +688 -1083
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/utils/debug.js +6 -10
- package/dist/src/utils/debug.js.map +1 -1
- package/dist/src/utils/package-json.js +5 -6
- package/dist/src/utils/package-json.js.map +1 -1
- package/dist/src/utils/package-manager.js +65 -139
- package/dist/src/utils/package-manager.js.map +1 -1
- package/dist/src/utils/release-registry.js +12 -59
- package/dist/src/utils/release-registry.js.map +1 -1
- package/dist/src/utils/semver.js +3 -4
- package/dist/src/utils/semver.js.map +1 -1
- package/dist/src/utils/sentrycli-utils.js +4 -4
- package/dist/src/utils/sentrycli-utils.js.map +1 -1
- package/dist/src/utils/url.js +5 -6
- package/dist/src/utils/url.js.map +1 -1
- package/dist/test/android/code-tools.test.js +18 -18
- package/dist/test/android/code-tools.test.js.map +1 -1
- package/dist/test/apple/cocoapod.test.js +154 -299
- package/dist/test/apple/cocoapod.test.js.map +1 -1
- package/dist/test/apple/code-tools.test.js +375 -263
- package/dist/test/apple/code-tools.test.js.map +1 -1
- package/dist/test/apple/fastfile.test.js +319 -271
- package/dist/test/apple/fastfile.test.js.map +1 -1
- package/dist/test/apple/templates.test.js +114 -30
- package/dist/test/apple/templates.test.js.map +1 -1
- package/dist/test/apple/xcode-manager.test.js +230 -234
- package/dist/test/apple/xcode-manager.test.js.map +1 -1
- package/dist/test/flutter/code-tools.test.js +119 -48
- package/dist/test/flutter/code-tools.test.js.map +1 -1
- package/dist/test/flutter/templates.test.js +63 -20
- package/dist/test/flutter/templates.test.js.map +1 -1
- package/dist/test/nextjs/templates.test.js +332 -43
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/nuxt/templates.test.js +161 -33
- package/dist/test/nuxt/templates.test.js.map +1 -1
- package/dist/test/react-native/expo-metro.test.js +61 -15
- package/dist/test/react-native/expo-metro.test.js.map +1 -1
- package/dist/test/react-native/expo.test.js +37 -17
- package/dist/test/react-native/expo.test.js.map +1 -1
- package/dist/test/react-native/gradle.test.js +260 -28
- package/dist/test/react-native/gradle.test.js.map +1 -1
- package/dist/test/react-native/javascript.test.js +85 -19
- package/dist/test/react-native/javascript.test.js.map +1 -1
- package/dist/test/react-native/metro.test.js +261 -187
- package/dist/test/react-native/metro.test.js.map +1 -1
- package/dist/test/react-native/xcode.test.js +243 -62
- package/dist/test/react-native/xcode.test.js.map +1 -1
- package/dist/test/remix/client-entry.test.js +81 -21
- package/dist/test/remix/client-entry.test.js.map +1 -1
- package/dist/test/remix/server-instrumentation.test.js +21 -8
- package/dist/test/remix/server-instrumentation.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/sentry-cli.test.js +20 -72
- package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/tsc.test.js +142 -68
- package/dist/test/sourcemaps/tools/tsc.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/vite.test.js +106 -75
- package/dist/test/sourcemaps/tools/vite.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/webpack.test.js +226 -102
- package/dist/test/sourcemaps/tools/webpack.test.js.map +1 -1
- package/dist/test/sveltekit/templates.test.js +117 -18
- package/dist/test/sveltekit/templates.test.js.map +1 -1
- package/dist/test/utils/ast-utils.test.js +99 -58
- package/dist/test/utils/ast-utils.test.js.map +1 -1
- package/dist/test/utils/clack-utils.test.js +142 -247
- package/dist/test/utils/clack-utils.test.js.map +1 -1
- package/e2e-tests/package.json +1 -1
- package/e2e-tests/tests/flutter.test.ts +20 -20
- package/e2e-tests/tests/nextjs.test.ts +2 -2
- package/e2e-tests/tests/nuxt-3.test.ts +4 -4
- package/e2e-tests/tests/nuxt-4.test.ts +3 -3
- package/e2e-tests/tests/remix.test.ts +3 -3
- package/e2e-tests/tests/sveltekit.test.ts +3 -3
- package/e2e-tests/utils/index.ts +33 -15
- package/lib/Helper/BottomBar.ts +1 -1
- package/lib/Helper/Env.ts +1 -1
- package/lib/Helper/Package.ts +12 -10
- package/lib/Helper/SentryCli.ts +18 -27
- package/lib/Helper/Wizard.ts +1 -2
- package/lib/Setup.ts +4 -5
- package/lib/Steps/ChooseIntegration.ts +40 -8
- package/lib/Steps/Initial.ts +17 -26
- package/lib/Steps/Integrations/BaseIntegration.ts +2 -8
- package/lib/Steps/Integrations/Cordova.ts +9 -15
- package/lib/Steps/Integrations/Electron.ts +23 -20
- package/lib/Steps/Integrations/MobileProject.ts +18 -15
- package/lib/Steps/OpenSentry.ts +12 -7
- package/lib/Steps/PromptForParameters.ts +12 -19
- package/lib/Steps/SentryProjectSelector.ts +30 -29
- package/lib/Steps/WaitForSentry.ts +29 -23
- package/package.json +12 -8
- package/src/apple/xcode-manager.ts +10 -10
- package/src/nextjs/templates.ts +2 -6
- package/src/nuxt/sdk-setup.ts +21 -18
- package/src/react-native/expo-metro.ts +2 -2
- package/src/react-native/react-native-wizard.ts +1 -2
- package/src/react-native/uninstall.ts +1 -2
- package/src/react-native/xcode.ts +1 -1
- package/src/run.ts +12 -5
- package/src/sourcemaps/tools/nextjs.ts +2 -5
- package/src/sourcemaps/tools/webpack.ts +3 -3
- package/src/telemetry.ts +27 -7
- package/src/utils/clack-utils.ts +50 -47
- package/test/apple/cocoapod.test.ts +4 -0
- package/test/apple/fastfile.test.ts +12 -7
- package/test/apple/xcode-manager.test.ts +13 -11
- package/test/nextjs/templates.test.ts +0 -12
- package/test/utils/clack-utils.test.ts +40 -50
- package/types/read-env.d.ts +3 -0
- package/types/xcode.d.ts +1 -0
- package/dist/package.json +0 -128
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/nuxt/sdk-setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,oDAAwC;AACxC,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B,EAAE;wBACpC,gFAAgF;wBAChF,sBAAO;qBACR;oBAEK,OAAO,GACX,+GAA+G,CAAC;oBAElH,KAAK,CAAC,GAAG,CAAC,IAAI,CACZ,oDAA6C,eAAK,CAAC,IAAI,CACrD,UAAU,CACX,6FAAmF,eAAK,CAAC,SAAS,CACjG,OAAO,CACR,CAAE,CACJ,CAAC;oBAEqB,qBAAM,IAAA,8BAAgB,EAC3C,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAAC,CAC5D,EAAA;;oBAFK,cAAc,GAAG,SAEtB;oBAED,MAAM,CAAC,MAAM,CAAC,8BAA8B,EAAE,cAAc,CAAC,CAAC;oBAE9D,IAAI,cAAc,EAAE;wBAClB,IAAA,iBAAG,EAAC,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC;4BAClC,iGAAiG;wBACnG,CAAC,CAAC,CAAC;qBACJ;;;;;CACF;AAjCD,sDAiCC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as Sentry from '@sentry/node';\nimport chalk from 'chalk';\nimport fs from 'fs';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { loadFile, generateCode } from 'magicast';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { addNuxtModule } from 'magicast/helpers';\nimport path from 'path';\nimport {\n getConfigBody,\n getDefaultNuxtConfig,\n getNuxtModuleFallbackTemplate,\n getSentryConfigContents,\n} from './templates';\nimport {\n abortIfCancelled,\n askShouldAddPackageOverride,\n askShouldInstallPackage,\n featureSelectionPrompt,\n installPackage,\n isUsingTypeScript,\n opn,\n} from '../utils/clack-utils';\nimport { traceStep } from '../telemetry';\nimport { lt, SemVer } from 'semver';\nimport { PackageManager, PNPM } from '../utils/package-manager';\nimport { hasPackageInstalled, PackageDotJson } from '../utils/package-json';\nimport { deploymentPlatforms, DeploymentPlatform } from './types';\n\nconst possibleNuxtConfig = [\n 'nuxt.config.js',\n 'nuxt.config.mjs',\n 'nuxt.config.cjs',\n 'nuxt.config.ts',\n 'nuxt.config.mts',\n 'nuxt.config.cts',\n];\n\nexport async function getNuxtConfig(): Promise<string> {\n let configFile = possibleNuxtConfig.find((fileName) =>\n fs.existsSync(path.join(process.cwd(), fileName)),\n );\n\n if (!configFile) {\n clack.log.info('No Nuxt config file found, creating a new one.');\n Sentry.setTag('nuxt-config-strategy', 'create');\n // nuxt recommends its config to be .ts by default\n configFile = 'nuxt.config.ts';\n\n await fs.promises.writeFile(\n path.join(process.cwd(), configFile),\n getDefaultNuxtConfig(),\n { encoding: 'utf-8', flag: 'w' },\n );\n\n clack.log.success(`Created ${chalk.cyan('nuxt.config.ts')}.`);\n }\n\n return path.join(process.cwd(), configFile);\n}\n\nexport async function askDeploymentPlatform(): Promise<\n DeploymentPlatform | symbol\n> {\n return await abortIfCancelled(\n clack.select({\n message: 'Please select your deployment platform.',\n options: deploymentPlatforms.map((platform) => ({\n value: platform,\n label: `${platform.charAt(0).toUpperCase()}${platform.slice(1)}`,\n })),\n }),\n );\n}\n\nexport async function addSDKModule(\n config: string,\n options: { org: string; project: string; url: string; selfHosted: boolean },\n deploymentPlatform: DeploymentPlatform | symbol,\n): Promise<void> {\n const shouldTopLevelImport =\n deploymentPlatform === 'vercel' || deploymentPlatform === 'netlify';\n\n if (shouldTopLevelImport) {\n clack.log.warn(\n `Sentry needs to be initialized before the application starts. ${chalk.cyan(\n `${deploymentPlatform\n .charAt(0)\n .toUpperCase()}${deploymentPlatform.slice(1)}`,\n )} does not support this yet.\\n\\nWe will inject the Sentry server-side config at the top of your Nuxt server entry file instead.\\n\\nThis comes with some restrictions, for more info see:\\n\\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/install/top-level-import/',\n )} `,\n );\n }\n\n try {\n const mod = await loadFile(config);\n\n addNuxtModule(mod, '@sentry/nuxt/module', 'sentry', {\n sourceMapsUploadOptions: {\n org: options.org,\n project: options.project,\n ...(options.selfHosted && { url: options.url }),\n },\n ...(shouldTopLevelImport && {\n autoInjectServerSentry: 'top-level-import',\n }),\n });\n addNuxtModule(mod, '@sentry/nuxt/module', 'sourcemap', {\n client: 'hidden',\n });\n\n const { code } = generateCode(mod);\n\n await fs.promises.writeFile(config, code, { encoding: 'utf-8', flag: 'w' });\n\n clack.log.success(\n `Added Sentry Nuxt Module to ${chalk.cyan(path.basename(config))}.`,\n );\n } catch (e: unknown) {\n clack.log.error(\n 'Error while adding the Sentry Nuxt Module to the Nuxt config.',\n );\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n Sentry.captureException(\n 'Error while setting up the Nuxt Module in nuxt config',\n );\n\n clack.log.warn(\n `Please add the following settings to ${chalk.cyan(\n path.basename(config),\n )}:`,\n );\n // eslint-disable-next-line no-console\n console.log(\n `\\n\\n${getNuxtModuleFallbackTemplate(options, shouldTopLevelImport)}\\n\\n`,\n );\n }\n}\n\nexport async function createConfigFiles(dsn: string) {\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 'Sentry 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 const typeScriptDetected = isUsingTypeScript();\n\n const configVariants = ['server', 'client'] as const;\n\n for (const configVariant of configVariants) {\n await traceStep(`create-sentry-${configVariant}-config`, async () => {\n const jsConfig = `sentry.${configVariant}.config.js`;\n const tsConfig = `sentry.${configVariant}.config.ts`;\n\n const jsConfigExists = fs.existsSync(path.join(process.cwd(), jsConfig));\n const tsConfigExists = fs.existsSync(path.join(process.cwd(), tsConfig));\n\n let shouldWriteFile = true;\n\n if (jsConfigExists || tsConfigExists) {\n const existingConfigs = [];\n\n if (jsConfigExists) {\n existingConfigs.push(jsConfig);\n }\n\n if (tsConfigExists) {\n existingConfigs.push(tsConfig);\n }\n\n const overwriteExistingConfigs = await abortIfCancelled(\n clack.confirm({\n message: `Found existing Sentry ${configVariant} config (${existingConfigs.join(\n ', ',\n )}). Overwrite ${existingConfigs.length > 1 ? 'them' : 'it'}?`,\n }),\n );\n Sentry.setTag(\n `overwrite-${configVariant}-config`,\n overwriteExistingConfigs,\n );\n\n shouldWriteFile = overwriteExistingConfigs;\n\n if (overwriteExistingConfigs) {\n if (jsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), jsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(jsConfig)}.`);\n }\n if (tsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), tsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(tsConfig)}.`);\n }\n }\n }\n\n if (shouldWriteFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), typeScriptDetected ? tsConfig : jsConfig),\n getSentryConfigContents(dsn, configVariant, selectedFeatures),\n { encoding: 'utf8', flag: 'w' },\n );\n clack.log.success(\n `Created new ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )}.`,\n );\n Sentry.setTag(`created-${configVariant}-config`, true);\n } else {\n clack.log.info(\n `Okay, here are the changes your ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )} should contain:`,\n );\n // eslint-disable-next-line no-console\n console.log(\n '\\n\\n ' +\n getConfigBody(dsn, configVariant, selectedFeatures) +\n '\\n\\n',\n );\n }\n });\n }\n}\n\nexport async function addNuxtOverrides(\n packageJson: PackageDotJson,\n packageManager: PackageManager,\n nuxtMinVer: SemVer | null,\n forceInstall?: boolean,\n) {\n const isPNPM = PNPM.detect();\n\n const overrides = [\n {\n pkgName: '@vercel/nft',\n pkgVersion: '^0.27.4',\n },\n ...(nuxtMinVer && lt(nuxtMinVer, '3.14.0')\n ? [{ pkgName: 'ofetch', pkgVersion: '^1.4.0' }]\n : []),\n ];\n\n clack.log.warn(\n `To ensure Sentry can properly instrument your code it needs to add version overrides for some Nuxt dependencies${\n isPNPM ? ` and install ${chalk.cyan('import-in-the-middle')}.` : '.'\n }\\n\\nFor more info see: ${chalk.underline(\n 'https://github.com/getsentry/sentry-javascript/issues/14514',\n )}${\n isPNPM\n ? `\\n\\nand ${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle',\n )}`\n : ''\n }`,\n );\n\n for (const { pkgName, pkgVersion } of overrides) {\n const shouldAddOverride = await askShouldAddPackageOverride(\n pkgName,\n pkgVersion,\n );\n\n if (shouldAddOverride) {\n await packageManager.addOverride(pkgName, pkgVersion);\n }\n }\n\n if (PNPM.detect()) {\n // For pnpm, we want to install iitm\n // See: https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle\n const iitmAlreadyInstalled = hasPackageInstalled(\n 'import-in-the-middle',\n packageJson,\n );\n Sentry.setTag('iitm-already-installed', iitmAlreadyInstalled);\n\n const shouldInstallIitm = await askShouldInstallPackage(\n 'import-in-the-middle',\n );\n\n if (shouldInstallIitm) {\n await installPackage({\n packageName: 'import-in-the-middle',\n alreadyInstalled: iitmAlreadyInstalled,\n packageManager,\n forceInstall,\n });\n }\n }\n}\n\nexport async function confirmReadImportDocs(\n deploymentPlatform: DeploymentPlatform | symbol,\n) {\n const canImportSentryServerConfigFile =\n deploymentPlatform !== 'vercel' && deploymentPlatform !== 'netlify';\n\n if (!canImportSentryServerConfigFile) {\n // Nothing to do, users have been set up with automatic top-level-import instead\n return;\n }\n\n const docsUrl =\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/install/cli-import/#initializing-sentry-with---import';\n\n clack.log.info(\n `After building your Nuxt app, you need to ${chalk.bold(\n '--import',\n )} the Sentry server config file when running your app.\\n\\nFor more info, see:\\n\\n${chalk.underline(\n docsUrl,\n )}`,\n );\n\n const shouldOpenDocs = await abortIfCancelled(\n clack.confirm({ message: 'Do you want to open the docs?' }),\n );\n\n Sentry.setTag('init-with-import-docs-opened', shouldOpenDocs);\n\n if (shouldOpenDocs) {\n opn(docsUrl, { wait: false }).catch(() => {\n // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/nuxt/sdk-setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAC7B,+EAA+E;AAC/E,sDAAwC;AACxC,qDAAuC;AACvC,kDAA0B;AAC1B,kFAAkF;AAClF,uCAAkD;AAClD,kFAAkF;AAClF,8CAAiD;AACjD,8CAAsB;AACtB,mCAAyC;AACzC,4CAAyC;AACzC,sDAO8B;AAC9B,wDAG+B;AAC/B,8DAAqE;AACrE,2CAKqB;AACrB,mCAAuE;AAEvE,MAAM,kBAAkB,GAAG;IACzB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;CAClB,CAAC;AAEK,KAAK,UAAU,aAAa;IACjC,IAAI,UAAU,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CACpD,iBAAE,CAAC,UAAU,CAAC,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC,CAClD,CAAC;IAEF,IAAI,CAAC,UAAU,EAAE;QACf,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;QACjE,MAAM,CAAC,MAAM,CAAC,sBAAsB,EAAE,QAAQ,CAAC,CAAC;QAChD,kDAAkD;QAClD,UAAU,GAAG,gBAAgB,CAAC;QAE9B,MAAM,iBAAE,CAAC,QAAQ,CAAC,SAAS,CACz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SACJ;KACF;AACH,CAAC;AAjED,4CAiEC;AAEM,KAAK,UAAU,qBAAqB,CACzC,kBAA+C;IAE/C,MAAM,+BAA+B,GACnC,kBAAkB,KAAK,QAAQ,IAAI,kBAAkB,KAAK,SAAS,CAAC;IAEtE,IAAI,CAAC,+BAA+B,EAAE;QACpC,gFAAgF;QAChF,OAAO;KACR;IAED,MAAM,OAAO,GACX,+GAA+G,CAAC;IAElH,KAAK,CAAC,GAAG,CAAC,IAAI,CACZ,6CAA6C,eAAK,CAAC,IAAI,CACrD,UAAU,CACX,mFAAmF,eAAK,CAAC,SAAS,CACjG,OAAO,CACR,EAAE,CACJ,CAAC;IAEF,MAAM,cAAc,GAAG,MAAM,IAAA,8BAAgB,EAC3C,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAAC,CAC5D,CAAC;IAEF,MAAM,CAAC,MAAM,CAAC,8BAA8B,EAAE,cAAc,CAAC,CAAC;IAE9D,IAAI,cAAc,EAAE;QAClB,iGAAiG;QACjG,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,2DAA2D;QAClF,IAAA,aAAG,EAAC,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;KACxE;AACH,CAAC;AAjCD,sDAiCC","sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as Sentry from '@sentry/node';\nimport chalk from 'chalk';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { generateCode, loadFile } from 'magicast';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { addNuxtModule } from 'magicast/helpers';\nimport opn from 'opn';\nimport { type SemVer, lt } from 'semver';\nimport { traceStep } from '../telemetry';\nimport {\n abortIfCancelled,\n askShouldAddPackageOverride,\n askShouldInstallPackage,\n featureSelectionPrompt,\n installPackage,\n isUsingTypeScript,\n} from '../utils/clack-utils';\nimport {\n type PackageDotJson,\n hasPackageInstalled,\n} from '../utils/package-json';\nimport { PNPM, type PackageManager } from '../utils/package-manager';\nimport {\n getConfigBody,\n getDefaultNuxtConfig,\n getNuxtModuleFallbackTemplate,\n getSentryConfigContents,\n} from './templates';\nimport { type DeploymentPlatform, deploymentPlatforms } from './types';\n\nconst possibleNuxtConfig = [\n 'nuxt.config.js',\n 'nuxt.config.mjs',\n 'nuxt.config.cjs',\n 'nuxt.config.ts',\n 'nuxt.config.mts',\n 'nuxt.config.cts',\n];\n\nexport async function getNuxtConfig(): Promise<string> {\n let configFile = possibleNuxtConfig.find((fileName) =>\n fs.existsSync(path.join(process.cwd(), fileName)),\n );\n\n if (!configFile) {\n clack.log.info('No Nuxt config file found, creating a new one.');\n Sentry.setTag('nuxt-config-strategy', 'create');\n // nuxt recommends its config to be .ts by default\n configFile = 'nuxt.config.ts';\n\n await fs.promises.writeFile(\n path.join(process.cwd(), configFile),\n getDefaultNuxtConfig(),\n { encoding: 'utf-8', flag: 'w' },\n );\n\n clack.log.success(`Created ${chalk.cyan('nuxt.config.ts')}.`);\n }\n\n return path.join(process.cwd(), configFile);\n}\n\nexport async function askDeploymentPlatform(): Promise<\n DeploymentPlatform | symbol\n> {\n return await abortIfCancelled(\n clack.select({\n message: 'Please select your deployment platform.',\n options: deploymentPlatforms.map((platform) => ({\n value: platform,\n label: `${platform.charAt(0).toUpperCase()}${platform.slice(1)}`,\n })),\n }),\n );\n}\n\nexport async function addSDKModule(\n config: string,\n options: { org: string; project: string; url: string; selfHosted: boolean },\n deploymentPlatform: DeploymentPlatform | symbol,\n): Promise<void> {\n const shouldTopLevelImport =\n deploymentPlatform === 'vercel' || deploymentPlatform === 'netlify';\n\n if (shouldTopLevelImport) {\n clack.log.warn(\n `Sentry needs to be initialized before the application starts. ${chalk.cyan(\n `${deploymentPlatform\n .charAt(0)\n .toUpperCase()}${deploymentPlatform.slice(1)}`,\n )} does not support this yet.\\n\\nWe will inject the Sentry server-side config at the top of your Nuxt server entry file instead.\\n\\nThis comes with some restrictions, for more info see:\\n\\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/install/top-level-import/',\n )} `,\n );\n }\n\n try {\n const mod = await loadFile(config);\n\n addNuxtModule(mod, '@sentry/nuxt/module', 'sentry', {\n sourceMapsUploadOptions: {\n org: options.org,\n project: options.project,\n ...(options.selfHosted && { url: options.url }),\n },\n ...(shouldTopLevelImport && {\n autoInjectServerSentry: 'top-level-import',\n }),\n });\n addNuxtModule(mod, '@sentry/nuxt/module', 'sourcemap', {\n client: 'hidden',\n });\n\n const { code } = generateCode(mod);\n\n await fs.promises.writeFile(config, code, { encoding: 'utf-8', flag: 'w' });\n\n clack.log.success(\n `Added Sentry Nuxt Module to ${chalk.cyan(path.basename(config))}.`,\n );\n } catch (e: unknown) {\n clack.log.error(\n 'Error while adding the Sentry Nuxt Module to the Nuxt config.',\n );\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n Sentry.captureException(\n 'Error while setting up the Nuxt Module in nuxt config',\n );\n\n clack.log.warn(\n `Please add the following settings to ${chalk.cyan(\n path.basename(config),\n )}:`,\n );\n // eslint-disable-next-line no-console\n console.log(\n `\\n\\n${getNuxtModuleFallbackTemplate(options, shouldTopLevelImport)}\\n\\n`,\n );\n }\n}\n\nexport async function createConfigFiles(dsn: string) {\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 'Sentry 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 const typeScriptDetected = isUsingTypeScript();\n\n const configVariants = ['server', 'client'] as const;\n\n for (const configVariant of configVariants) {\n await traceStep(`create-sentry-${configVariant}-config`, async () => {\n const jsConfig = `sentry.${configVariant}.config.js`;\n const tsConfig = `sentry.${configVariant}.config.ts`;\n\n const jsConfigExists = fs.existsSync(path.join(process.cwd(), jsConfig));\n const tsConfigExists = fs.existsSync(path.join(process.cwd(), tsConfig));\n\n let shouldWriteFile = true;\n\n if (jsConfigExists || tsConfigExists) {\n const existingConfigs = [];\n\n if (jsConfigExists) {\n existingConfigs.push(jsConfig);\n }\n\n if (tsConfigExists) {\n existingConfigs.push(tsConfig);\n }\n\n const overwriteExistingConfigs = await abortIfCancelled(\n clack.confirm({\n message: `Found existing Sentry ${configVariant} config (${existingConfigs.join(\n ', ',\n )}). Overwrite ${existingConfigs.length > 1 ? 'them' : 'it'}?`,\n }),\n );\n Sentry.setTag(\n `overwrite-${configVariant}-config`,\n overwriteExistingConfigs,\n );\n\n shouldWriteFile = overwriteExistingConfigs;\n\n if (overwriteExistingConfigs) {\n if (jsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), jsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(jsConfig)}.`);\n }\n if (tsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), tsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(tsConfig)}.`);\n }\n }\n }\n\n if (shouldWriteFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), typeScriptDetected ? tsConfig : jsConfig),\n getSentryConfigContents(dsn, configVariant, selectedFeatures),\n { encoding: 'utf8', flag: 'w' },\n );\n clack.log.success(\n `Created new ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )}.`,\n );\n Sentry.setTag(`created-${configVariant}-config`, true);\n } else {\n clack.log.info(\n `Okay, here are the changes your ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )} should contain:`,\n );\n // eslint-disable-next-line no-console\n console.log(\n '\\n\\n ' +\n getConfigBody(dsn, configVariant, selectedFeatures) +\n '\\n\\n',\n );\n }\n });\n }\n}\n\nexport async function addNuxtOverrides(\n packageJson: PackageDotJson,\n packageManager: PackageManager,\n nuxtMinVer: SemVer | null,\n forceInstall?: boolean,\n) {\n const isPNPM = PNPM.detect();\n\n const overrides = [\n {\n pkgName: '@vercel/nft',\n pkgVersion: '^0.27.4',\n },\n ...(nuxtMinVer && lt(nuxtMinVer, '3.14.0')\n ? [{ pkgName: 'ofetch', pkgVersion: '^1.4.0' }]\n : []),\n ];\n\n clack.log.warn(\n `To ensure Sentry can properly instrument your code it needs to add version overrides for some Nuxt dependencies${\n isPNPM ? ` and install ${chalk.cyan('import-in-the-middle')}.` : '.'\n }\\n\\nFor more info see: ${chalk.underline(\n 'https://github.com/getsentry/sentry-javascript/issues/14514',\n )}${\n isPNPM\n ? `\\n\\nand ${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle',\n )}`\n : ''\n }`,\n );\n\n for (const { pkgName, pkgVersion } of overrides) {\n const shouldAddOverride = await askShouldAddPackageOverride(\n pkgName,\n pkgVersion,\n );\n\n if (shouldAddOverride) {\n await packageManager.addOverride(pkgName, pkgVersion);\n }\n }\n\n if (PNPM.detect()) {\n // For pnpm, we want to install iitm\n // See: https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle\n const iitmAlreadyInstalled = hasPackageInstalled(\n 'import-in-the-middle',\n packageJson,\n );\n Sentry.setTag('iitm-already-installed', iitmAlreadyInstalled);\n\n const shouldInstallIitm = await askShouldInstallPackage(\n 'import-in-the-middle',\n );\n\n if (shouldInstallIitm) {\n await installPackage({\n packageName: 'import-in-the-middle',\n alreadyInstalled: iitmAlreadyInstalled,\n packageManager,\n forceInstall,\n });\n }\n }\n}\n\nexport async function confirmReadImportDocs(\n deploymentPlatform: DeploymentPlatform | symbol,\n) {\n const canImportSentryServerConfigFile =\n deploymentPlatform !== 'vercel' && deploymentPlatform !== 'netlify';\n\n if (!canImportSentryServerConfigFile) {\n // Nothing to do, users have been set up with automatic top-level-import instead\n return;\n }\n\n const docsUrl =\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/install/cli-import/#initializing-sentry-with---import';\n\n clack.log.info(\n `After building your Nuxt app, you need to ${chalk.bold(\n '--import',\n )} the Sentry server config file when running your app.\\n\\nFor more info, see:\\n\\n${chalk.underline(\n docsUrl,\n )}`,\n );\n\n const shouldOpenDocs = await abortIfCancelled(\n clack.confirm({ message: 'Do you want to open the docs?' }),\n );\n\n Sentry.setTag('init-with-import-docs-opened', shouldOpenDocs);\n\n if (shouldOpenDocs) {\n // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here\n const noop = () => {}; // eslint-disable-line @typescript-eslint/no-empty-function\n opn(docsUrl, { wait: false }).then((cp) => cp.on('error', noop), noop);\n }\n}\n"]}
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSentryErrorButtonTemplate = exports.getSentryExampleApiTemplate = exports.getSentryExamplePageTemplate = exports.getIndexRouteTemplate = exports.getConfigBody = exports.getSentryConfigContents = exports.getNuxtModuleFallbackTemplate = exports.getDefaultNuxtConfig = void 0;
|
|
4
|
-
|
|
4
|
+
const url_1 = require("../utils/url");
|
|
5
5
|
function getDefaultNuxtConfig() {
|
|
6
|
-
return
|
|
6
|
+
return `// https://nuxt.com/docs/api/configuration/nuxt-config
|
|
7
|
+
export default defineNuxtConfig({
|
|
8
|
+
compatibilityDate: '2024-04-03',
|
|
9
|
+
devtools: { enabled: true }
|
|
10
|
+
})
|
|
11
|
+
`;
|
|
7
12
|
}
|
|
8
13
|
exports.getDefaultNuxtConfig = getDefaultNuxtConfig;
|
|
9
14
|
function getNuxtModuleFallbackTemplate(options, shouldTopLevelImport) {
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
return ` modules: ["@sentry/nuxt/module"],
|
|
16
|
+
sentry: {
|
|
17
|
+
sourceMapsUploadOptions: {
|
|
18
|
+
org: "${options.org}",
|
|
19
|
+
project: "${options.project}",${options.selfHosted ? `\n url: "${options.url}",` : ''}
|
|
20
|
+
},${shouldTopLevelImport
|
|
21
|
+
? `\n autoInjectServerSentry: "top-level-import",`
|
|
22
|
+
: ''}
|
|
23
|
+
},
|
|
24
|
+
sourcemap: { client: "hidden" },`;
|
|
13
25
|
}
|
|
14
26
|
exports.getNuxtModuleFallbackTemplate = getNuxtModuleFallbackTemplate;
|
|
15
27
|
function getSentryConfigContents(dsn, config, selectedFeatures) {
|
|
@@ -19,7 +31,7 @@ function getSentryConfigContents(dsn, config, selectedFeatures) {
|
|
|
19
31
|
return getSentryServerConfigContents(dsn, selectedFeatures);
|
|
20
32
|
}
|
|
21
33
|
exports.getSentryConfigContents = getSentryConfigContents;
|
|
22
|
-
|
|
34
|
+
const featuresConfigMap = {
|
|
23
35
|
performance: [
|
|
24
36
|
' // We recommend adjusting this value in production, or using tracesSampler',
|
|
25
37
|
' // for finer control',
|
|
@@ -38,16 +50,15 @@ var featuresConfigMap = {
|
|
|
38
50
|
' integrations: [Sentry.replayIntegration()],',
|
|
39
51
|
].join('\n'),
|
|
40
52
|
};
|
|
41
|
-
|
|
53
|
+
const featuresMap = {
|
|
42
54
|
client: ['performance', 'replay'],
|
|
43
55
|
server: ['performance'],
|
|
44
56
|
};
|
|
45
57
|
function getConfigBody(dsn, variant, selectedFeatures) {
|
|
46
58
|
return [
|
|
47
|
-
|
|
59
|
+
`dsn: "${dsn}",`,
|
|
48
60
|
Object.entries(selectedFeatures)
|
|
49
|
-
.map(
|
|
50
|
-
var feature = _a[0], activated = _a[1];
|
|
61
|
+
.map(([feature, activated]) => {
|
|
51
62
|
return featuresMap[variant].includes(feature) && activated
|
|
52
63
|
? featuresConfigMap[feature]
|
|
53
64
|
: null;
|
|
@@ -60,27 +71,193 @@ function getConfigBody(dsn, variant, selectedFeatures) {
|
|
|
60
71
|
}
|
|
61
72
|
exports.getConfigBody = getConfigBody;
|
|
62
73
|
function getSentryClientConfigContents(dsn, selectedFeatures) {
|
|
63
|
-
return
|
|
74
|
+
return `import * as Sentry from "@sentry/nuxt";
|
|
75
|
+
|
|
76
|
+
Sentry.init({
|
|
77
|
+
// If set up, you can use your runtime config here
|
|
78
|
+
// dsn: useRuntimeConfig().public.sentry.dsn,
|
|
79
|
+
${getConfigBody(dsn, 'client', selectedFeatures)}
|
|
80
|
+
|
|
81
|
+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
82
|
+
debug: false,
|
|
83
|
+
});
|
|
84
|
+
`;
|
|
64
85
|
}
|
|
65
86
|
function getSentryServerConfigContents(dsn, selectedFeatures) {
|
|
66
|
-
return
|
|
87
|
+
return `import * as Sentry from "@sentry/nuxt";
|
|
88
|
+
|
|
89
|
+
Sentry.init({
|
|
90
|
+
${getConfigBody(dsn, 'server', selectedFeatures)}
|
|
91
|
+
|
|
92
|
+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
93
|
+
debug: false,
|
|
94
|
+
});
|
|
95
|
+
`;
|
|
67
96
|
}
|
|
68
97
|
function getIndexRouteTemplate() {
|
|
69
|
-
return
|
|
98
|
+
return `<!--
|
|
99
|
+
This is just to verify the sentry-example-page.
|
|
100
|
+
Feel free to delete this file.
|
|
101
|
+
-->
|
|
102
|
+
|
|
103
|
+
<template></template>`;
|
|
70
104
|
}
|
|
71
105
|
exports.getIndexRouteTemplate = getIndexRouteTemplate;
|
|
72
106
|
function getSentryExamplePageTemplate(options) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return
|
|
107
|
+
const { url, org, projectId } = options;
|
|
108
|
+
const issuesPageLink = (0, url_1.getIssueStreamUrl)({ url, orgSlug: org, projectId });
|
|
109
|
+
return `<!--
|
|
110
|
+
This is just a very simple page with a button to throw an example error.
|
|
111
|
+
Feel free to delete this file.
|
|
112
|
+
-->
|
|
113
|
+
|
|
114
|
+
<script setup>
|
|
115
|
+
import * as Sentry from '@sentry/nuxt';
|
|
116
|
+
import { useFetch} from '#imports'
|
|
117
|
+
|
|
118
|
+
function getSentryData() {
|
|
119
|
+
Sentry.startSpan(
|
|
120
|
+
{
|
|
121
|
+
name: 'Example Frontend Span',
|
|
122
|
+
op: 'test'
|
|
123
|
+
},
|
|
124
|
+
async () => {
|
|
125
|
+
const { error } = await useFetch('/api/sentry-example-api');
|
|
126
|
+
if (error.value) {
|
|
127
|
+
throw new Error('Sentry Example Frontend Error');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<template>
|
|
135
|
+
<title>Sentry Onboarding</title>
|
|
136
|
+
<div>
|
|
137
|
+
<main>
|
|
138
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 44">
|
|
139
|
+
<path
|
|
140
|
+
fill="currentColor"
|
|
141
|
+
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"
|
|
142
|
+
/>
|
|
143
|
+
</svg>
|
|
144
|
+
<p>
|
|
145
|
+
Get Started with this <strong>simple Example:</strong>
|
|
146
|
+
</p>
|
|
147
|
+
|
|
148
|
+
<p>1. Send us a sample error:</p>
|
|
149
|
+
<button type="button" @click="getSentryData"> Throw error! </button>
|
|
150
|
+
|
|
151
|
+
<p>
|
|
152
|
+
2. Look for the error on the
|
|
153
|
+
<a href="${issuesPageLink}">Issues Page</a>.
|
|
154
|
+
</p>
|
|
155
|
+
<p style="margin-top: 24px;">
|
|
156
|
+
For more information, take a look at the
|
|
157
|
+
<a href="https://docs.sentry.io/platforms/javascript/guides/nuxt/">
|
|
158
|
+
Sentry Nuxt Documentation
|
|
159
|
+
</a>
|
|
160
|
+
</p>
|
|
161
|
+
</main>
|
|
162
|
+
</div>
|
|
163
|
+
</template>
|
|
164
|
+
|
|
165
|
+
<style scoped>
|
|
166
|
+
main {
|
|
167
|
+
display: flex;
|
|
168
|
+
flex-direction: column;
|
|
169
|
+
justify-content: center;
|
|
170
|
+
align-items: center;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
svg {
|
|
174
|
+
font-size: 4rem;
|
|
175
|
+
margin: 14px 0;
|
|
176
|
+
height: 1em;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
button {
|
|
180
|
+
padding: 12px;
|
|
181
|
+
cursor: pointer;
|
|
182
|
+
background-color: rgb(54, 45, 89);
|
|
183
|
+
border-radius: 4px;
|
|
184
|
+
border: none;
|
|
185
|
+
color: white;
|
|
186
|
+
font-size: 1em;
|
|
187
|
+
margin: 1em;
|
|
188
|
+
transition: all 0.25s ease-in-out;
|
|
189
|
+
}
|
|
190
|
+
button:hover {
|
|
191
|
+
background-color: #8c5393;
|
|
192
|
+
box-shadow: 4px;
|
|
193
|
+
box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);
|
|
194
|
+
}
|
|
195
|
+
button:active {
|
|
196
|
+
background-color: #c73852;
|
|
197
|
+
}
|
|
198
|
+
</style>
|
|
199
|
+
`;
|
|
76
200
|
}
|
|
77
201
|
exports.getSentryExamplePageTemplate = getSentryExamplePageTemplate;
|
|
78
202
|
function getSentryExampleApiTemplate() {
|
|
79
|
-
return
|
|
203
|
+
return `// This is just a very simple API route that throws an example error.
|
|
204
|
+
// Feel free to delete this file.
|
|
205
|
+
import { defineEventHandler } from '#imports';
|
|
206
|
+
|
|
207
|
+
export default defineEventHandler(() => {
|
|
208
|
+
throw new Error("Sentry Example API Route Error");
|
|
209
|
+
});
|
|
210
|
+
`;
|
|
80
211
|
}
|
|
81
212
|
exports.getSentryExampleApiTemplate = getSentryExampleApiTemplate;
|
|
82
213
|
function getSentryErrorButtonTemplate() {
|
|
83
|
-
return
|
|
214
|
+
return `<!--
|
|
215
|
+
This is just a very simple component that throws an example error.
|
|
216
|
+
Feel free to delete this file.
|
|
217
|
+
-->
|
|
218
|
+
|
|
219
|
+
<script setup>
|
|
220
|
+
import * as Sentry from '@sentry/nuxt';
|
|
221
|
+
|
|
222
|
+
const throwError = () => {
|
|
223
|
+
Sentry.startSpan(
|
|
224
|
+
{
|
|
225
|
+
name: 'Example Frontend Span',
|
|
226
|
+
op: 'test'
|
|
227
|
+
},
|
|
228
|
+
() => {
|
|
229
|
+
throw new Error('Sentry Example Error');
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
};
|
|
233
|
+
</script>
|
|
234
|
+
|
|
235
|
+
<template>
|
|
236
|
+
<button id="errorBtn" @click="throwError"> Throw Error! </button>
|
|
237
|
+
</template>
|
|
238
|
+
|
|
239
|
+
<style scoped>
|
|
240
|
+
button {
|
|
241
|
+
padding: 12px;
|
|
242
|
+
cursor: pointer;
|
|
243
|
+
background-color: rgb(54, 45, 89);
|
|
244
|
+
border-radius: 4px;
|
|
245
|
+
border: none;
|
|
246
|
+
color: white;
|
|
247
|
+
font-size: 1em;
|
|
248
|
+
margin: 1em;
|
|
249
|
+
transition: all 0.25s ease-in-out;
|
|
250
|
+
}
|
|
251
|
+
button:hover {
|
|
252
|
+
background-color: #8c5393;
|
|
253
|
+
box-shadow: 4px;
|
|
254
|
+
box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);
|
|
255
|
+
}
|
|
256
|
+
button:active {
|
|
257
|
+
background-color: #c73852;
|
|
258
|
+
}
|
|
259
|
+
</style>
|
|
260
|
+
`;
|
|
84
261
|
}
|
|
85
262
|
exports.getSentryErrorButtonTemplate = getSentryErrorButtonTemplate;
|
|
86
263
|
//# sourceMappingURL=templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/nuxt/templates.ts"],"names":[],"mappings":";;;AAAA,oCAAiD;AAOjD,SAAgB,oBAAoB;IAClC,OAAO,oKAKR,CAAC;AACF,CAAC;AAPD,oDAOC;AAED,SAAgB,6BAA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,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,SAAS;gBACxD,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC;gBAC5B,CAAC,CAAC,IAAI,CAAC;QACX,CAAC,CAAC;aACD,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,MAAM,CAAC;KAChB;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC;AAlBD,sCAkBC;AAED,SAAS,6BAA6B,CACpC,GAAW,EACX,gBAAwC;IAExC,OAAO,+KAKL,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,gBAAgB,CAAC,gJAKjD,CAAC;AACF,CAAC;AAED,SAAS,6BAA6B,CACpC,GAAW,EACX,gBAAwC;IAExC,OAAO,yEAGL,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,gBAAgB,CAAC,gJAKjD,CAAC;AACF,CAAC;AAED,SAAgB,qBAAqB;IACnC,OAAO,qHAKa,CAAC;AACvB,CAAC;AAPD,sDAOC;AAED,SAAgB,4BAA4B,CAAC,OAI5C;IACS,IAAA,GAAG,GAAqB,OAAO,IAA5B,EAAE,GAAG,GAAgB,OAAO,IAAvB,EAAE,SAAS,GAAK,OAAO,UAAZ,CAAa;IACxC,IAAM,cAAc,GAAG,IAAA,uBAAiB,EAAC,EAAE,GAAG,KAAA,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,WAAA,EAAE,CAAC,CAAC;IAE3E,OAAO,k1EA4CQ,cAAc,m7BA8C9B,CAAC;AACF,CAAC;AAnGD,oEAmGC;AAED,SAAgB,2BAA2B;IACzC,OAAO,sQAOR,CAAC;AACF,CAAC;AATD,kEASC;AAED,SAAgB,4BAA4B;IAC1C,OAAO,y8BA8CR,CAAC;AACF,CAAC;AAhDD,oEAgDC","sourcesContent":["import { getIssueStreamUrl } from '../utils/url';\n\ntype SelectedSentryFeatures = {\n performance: boolean;\n replay: boolean;\n};\n\nexport function getDefaultNuxtConfig(): string {\n return `// https://nuxt.com/docs/api/configuration/nuxt-config\nexport default defineNuxtConfig({\n compatibilityDate: '2024-04-03',\n devtools: { enabled: true }\n})\n`;\n}\n\nexport function getNuxtModuleFallbackTemplate(\n options: {\n org: string;\n project: string;\n url: string;\n selfHosted: boolean;\n },\n shouldTopLevelImport: boolean,\n): string {\n return ` modules: [\"@sentry/nuxt/module\"],\n sentry: {\n sourceMapsUploadOptions: {\n org: \"${options.org}\",\n project: \"${options.project}\",${\n options.selfHosted ? `\\n url: \"${options.url}\",` : ''\n }\n },${\n shouldTopLevelImport\n ? `\\n autoInjectServerSentry: \"top-level-import\",`\n : ''\n }\n },\n sourcemap: { client: \"hidden\" },`;\n}\n\nexport function getSentryConfigContents(\n dsn: string,\n config: 'client' | 'server',\n selectedFeatures: SelectedSentryFeatures,\n): string {\n if (config === 'client') {\n return getSentryClientConfigContents(dsn, selectedFeatures);\n }\n\n return getSentryServerConfigContents(dsn, selectedFeatures);\n}\n\nconst featuresConfigMap: Record<keyof SelectedSentryFeatures, string> = {\n performance: [\n ' // We recommend adjusting this value in production, or using tracesSampler',\n ' // for finer control',\n ' tracesSampleRate: 1.0,',\n ].join('\\n'),\n replay: [\n ' // This sets the sample rate to be 10%. You may want this to be 100% while',\n ' // in development and sample at a lower rate in production',\n ' replaysSessionSampleRate: 0.1,',\n ' ',\n ' // If the entire session is not sampled, use the below sample rate to sample',\n ' // sessions when an error occurs.',\n ' replaysOnErrorSampleRate: 1.0,',\n ' ',\n \" // If you don't want to use Session Replay, just remove the line below:\",\n ' integrations: [Sentry.replayIntegration()],',\n ].join('\\n'),\n};\n\nconst featuresMap: Record<\n 'client' | 'server',\n Array<keyof SelectedSentryFeatures>\n> = {\n client: ['performance', 'replay'],\n server: ['performance'],\n};\n\nexport function getConfigBody(\n dsn: string,\n variant: 'client' | 'server',\n selectedFeatures: SelectedSentryFeatures,\n) {\n return [\n `dsn: \"${dsn}\",`,\n Object.entries(selectedFeatures)\n .map(([feature, activated]: [keyof SelectedSentryFeatures, boolean]) => {\n return featuresMap[variant].includes(feature) && activated\n ? featuresConfigMap[feature]\n : null;\n })\n .filter(Boolean)\n .join('\\n\\n'),\n ]\n .filter(Boolean)\n .join('\\n\\n');\n}\n\nfunction getSentryClientConfigContents(\n dsn: string,\n selectedFeatures: SelectedSentryFeatures,\n): string {\n return `import * as Sentry from \"@sentry/nuxt\";\n\nSentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n ${getConfigBody(dsn, 'client', selectedFeatures)}\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n});\n`;\n}\n\nfunction getSentryServerConfigContents(\n dsn: string,\n selectedFeatures: SelectedSentryFeatures,\n): string {\n return `import * as Sentry from \"@sentry/nuxt\";\n \nSentry.init({\n ${getConfigBody(dsn, 'server', selectedFeatures)}\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n});\n`;\n}\n\nexport function getIndexRouteTemplate(): string {\n return `<!--\nThis is just to verify the sentry-example-page.\nFeel free to delete this file.\n-->\n\n<template></template>`;\n}\n\nexport function getSentryExamplePageTemplate(options: {\n url: string;\n org: string;\n projectId: string;\n}): string {\n const { url, org, projectId } = options;\n const issuesPageLink = getIssueStreamUrl({ url, orgSlug: org, projectId });\n\n return `<!--\nThis is just a very simple page with a button to throw an example error.\nFeel free to delete this file.\n-->\n\n<script setup>\n import * as Sentry from '@sentry/nuxt';\n import { useFetch} from '#imports'\n \n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const { error } = await useFetch('/api/sentry-example-api');\n if (error.value) {\n throw new Error('Sentry Example Frontend Error');\n }\n }\n )\n }\n</script>\n\n<template>\n <title>Sentry Onboarding</title>\n <div>\n <main>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 200 44\">\n <path\n fill=\"currentColor\"\n 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\"\n />\n </svg>\n <p>\n Get Started with this <strong>simple Example:</strong>\n </p>\n\n <p>1. Send us a sample error:</p>\n <button type=\"button\" @click=\"getSentryData\"> Throw error! </button>\n\n <p>\n 2. Look for the error on the\n <a href=\"${issuesPageLink}\">Issues Page</a>.\n </p>\n <p style=\"margin-top: 24px;\">\n For more information, take a look at the\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/nuxt/\">\n Sentry Nuxt Documentation\n </a>\n </p>\n </main>\n</div>\n</template>\n\n<style scoped>\n main {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n svg {\n font-size: 4rem;\n margin: 14px 0;\n height: 1em;\n }\n\n button {\n padding: 12px;\n cursor: pointer;\n background-color: rgb(54, 45, 89);\n border-radius: 4px;\n border: none;\n color: white;\n font-size: 1em;\n margin: 1em;\n transition: all 0.25s ease-in-out;\n }\n button:hover {\n background-color: #8c5393;\n box-shadow: 4px;\n box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);\n }\n button:active {\n background-color: #c73852;\n }\n</style>\n`;\n}\n\nexport function getSentryExampleApiTemplate() {\n return `// This is just a very simple API route that throws an example error.\n// Feel free to delete this file.\nimport { defineEventHandler } from '#imports';\n\nexport default defineEventHandler(() => {\n throw new Error(\"Sentry Example API Route Error\");\n});\n`;\n}\n\nexport function getSentryErrorButtonTemplate() {\n return `<!--\nThis is just a very simple component that throws an example error.\nFeel free to delete this file.\n-->\n\n<script setup>\n import * as Sentry from '@sentry/nuxt';\n \n const throwError = () => {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n () => {\n throw new Error('Sentry Example Error');\n }\n )\n };\n</script>\n\n<template>\n <button id=\"errorBtn\" @click=\"throwError\"> Throw Error! </button>\n</template>\n\n<style scoped>\n button {\n padding: 12px;\n cursor: pointer;\n background-color: rgb(54, 45, 89);\n border-radius: 4px;\n border: none;\n color: white;\n font-size: 1em;\n margin: 1em;\n transition: all 0.25s ease-in-out;\n }\n button:hover {\n background-color: #8c5393;\n box-shadow: 4px;\n box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);\n }\n button:active {\n background-color: #c73852;\n }\n</style>\n`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/nuxt/templates.ts"],"names":[],"mappings":";;;AAAA,sCAAiD;AAOjD,SAAgB,oBAAoB;IAClC,OAAO;;;;;CAKR,CAAC;AACF,CAAC;AAPD,oDAOC;AAED,SAAgB,6BAA6B,CAC3C,OAKC,EACD,oBAA6B;IAE7B,OAAO;;;cAGK,OAAO,CAAC,GAAG;kBACP,OAAO,CAAC,OAAO,KAC7B,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,EAC1D;QAEI,oBAAoB;QAClB,CAAC,CAAC,mDAAmD;QACrD,CAAC,CAAC,EACN;;mCAE+B,CAAC;AACpC,CAAC;AAvBD,sEAuBC;AAED,SAAgB,uBAAuB,CACrC,GAAW,EACX,MAA2B,EAC3B,gBAAwC;IAExC,IAAI,MAAM,KAAK,QAAQ,EAAE;QACvB,OAAO,6BAA6B,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;KAC7D;IAED,OAAO,6BAA6B,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AAC9D,CAAC;AAVD,0DAUC;AAED,MAAM,iBAAiB,GAAiD;IACtE,WAAW,EAAE;QACX,8EAA8E;QAC9E,wBAAwB;QACxB,0BAA0B;KAC3B,CAAC,IAAI,CAAC,IAAI,CAAC;IACZ,MAAM,EAAE;QACN,8EAA8E;QAC9E,8DAA8D;QAC9D,kCAAkC;QAClC,IAAI;QACJ,gFAAgF;QAChF,qCAAqC;QACrC,kCAAkC;QAClC,IAAI;QACJ,2EAA2E;QAC3E,+CAA+C;KAChD,CAAC,IAAI,CAAC,IAAI,CAAC;CACb,CAAC;AAEF,MAAM,WAAW,GAGb;IACF,MAAM,EAAE,CAAC,aA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;;;;;;;;;;;;;;;;;;;;;;iBA4CQ,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8C9B,CAAC;AACF,CAAC;AAnGD,oEAmGC;AAED,SAAgB,2BAA2B;IACzC,OAAO;;;;;;;CAOR,CAAC;AACF,CAAC;AATD,kEASC;AAED,SAAgB,4BAA4B;IAC1C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CR,CAAC;AACF,CAAC;AAhDD,oEAgDC","sourcesContent":["import { getIssueStreamUrl } from '../utils/url';\n\ntype SelectedSentryFeatures = {\n performance: boolean;\n replay: boolean;\n};\n\nexport function getDefaultNuxtConfig(): string {\n return `// https://nuxt.com/docs/api/configuration/nuxt-config\nexport default defineNuxtConfig({\n compatibilityDate: '2024-04-03',\n devtools: { enabled: true }\n})\n`;\n}\n\nexport function getNuxtModuleFallbackTemplate(\n options: {\n org: string;\n project: string;\n url: string;\n selfHosted: boolean;\n },\n shouldTopLevelImport: boolean,\n): string {\n return ` modules: [\"@sentry/nuxt/module\"],\n sentry: {\n sourceMapsUploadOptions: {\n org: \"${options.org}\",\n project: \"${options.project}\",${\n options.selfHosted ? `\\n url: \"${options.url}\",` : ''\n }\n },${\n shouldTopLevelImport\n ? `\\n autoInjectServerSentry: \"top-level-import\",`\n : ''\n }\n },\n sourcemap: { client: \"hidden\" },`;\n}\n\nexport function getSentryConfigContents(\n dsn: string,\n config: 'client' | 'server',\n selectedFeatures: SelectedSentryFeatures,\n): string {\n if (config === 'client') {\n return getSentryClientConfigContents(dsn, selectedFeatures);\n }\n\n return getSentryServerConfigContents(dsn, selectedFeatures);\n}\n\nconst featuresConfigMap: Record<keyof SelectedSentryFeatures, string> = {\n performance: [\n ' // We recommend adjusting this value in production, or using tracesSampler',\n ' // for finer control',\n ' tracesSampleRate: 1.0,',\n ].join('\\n'),\n replay: [\n ' // This sets the sample rate to be 10%. You may want this to be 100% while',\n ' // in development and sample at a lower rate in production',\n ' replaysSessionSampleRate: 0.1,',\n ' ',\n ' // If the entire session is not sampled, use the below sample rate to sample',\n ' // sessions when an error occurs.',\n ' replaysOnErrorSampleRate: 1.0,',\n ' ',\n \" // If you don't want to use Session Replay, just remove the line below:\",\n ' integrations: [Sentry.replayIntegration()],',\n ].join('\\n'),\n};\n\nconst featuresMap: Record<\n 'client' | 'server',\n Array<keyof SelectedSentryFeatures>\n> = {\n client: ['performance', 'replay'],\n server: ['performance'],\n};\n\nexport function getConfigBody(\n dsn: string,\n variant: 'client' | 'server',\n selectedFeatures: SelectedSentryFeatures,\n) {\n return [\n `dsn: \"${dsn}\",`,\n Object.entries(selectedFeatures)\n .map(([feature, activated]: [keyof SelectedSentryFeatures, boolean]) => {\n return featuresMap[variant].includes(feature) && activated\n ? featuresConfigMap[feature]\n : null;\n })\n .filter(Boolean)\n .join('\\n\\n'),\n ]\n .filter(Boolean)\n .join('\\n\\n');\n}\n\nfunction getSentryClientConfigContents(\n dsn: string,\n selectedFeatures: SelectedSentryFeatures,\n): string {\n return `import * as Sentry from \"@sentry/nuxt\";\n\nSentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n ${getConfigBody(dsn, 'client', selectedFeatures)}\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n});\n`;\n}\n\nfunction getSentryServerConfigContents(\n dsn: string,\n selectedFeatures: SelectedSentryFeatures,\n): string {\n return `import * as Sentry from \"@sentry/nuxt\";\n \nSentry.init({\n ${getConfigBody(dsn, 'server', selectedFeatures)}\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n});\n`;\n}\n\nexport function getIndexRouteTemplate(): string {\n return `<!--\nThis is just to verify the sentry-example-page.\nFeel free to delete this file.\n-->\n\n<template></template>`;\n}\n\nexport function getSentryExamplePageTemplate(options: {\n url: string;\n org: string;\n projectId: string;\n}): string {\n const { url, org, projectId } = options;\n const issuesPageLink = getIssueStreamUrl({ url, orgSlug: org, projectId });\n\n return `<!--\nThis is just a very simple page with a button to throw an example error.\nFeel free to delete this file.\n-->\n\n<script setup>\n import * as Sentry from '@sentry/nuxt';\n import { useFetch} from '#imports'\n \n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const { error } = await useFetch('/api/sentry-example-api');\n if (error.value) {\n throw new Error('Sentry Example Frontend Error');\n }\n }\n )\n }\n</script>\n\n<template>\n <title>Sentry Onboarding</title>\n <div>\n <main>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 200 44\">\n <path\n fill=\"currentColor\"\n 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\"\n />\n </svg>\n <p>\n Get Started with this <strong>simple Example:</strong>\n </p>\n\n <p>1. Send us a sample error:</p>\n <button type=\"button\" @click=\"getSentryData\"> Throw error! </button>\n\n <p>\n 2. Look for the error on the\n <a href=\"${issuesPageLink}\">Issues Page</a>.\n </p>\n <p style=\"margin-top: 24px;\">\n For more information, take a look at the\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/nuxt/\">\n Sentry Nuxt Documentation\n </a>\n </p>\n </main>\n</div>\n</template>\n\n<style scoped>\n main {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n svg {\n font-size: 4rem;\n margin: 14px 0;\n height: 1em;\n }\n\n button {\n padding: 12px;\n cursor: pointer;\n background-color: rgb(54, 45, 89);\n border-radius: 4px;\n border: none;\n color: white;\n font-size: 1em;\n margin: 1em;\n transition: all 0.25s ease-in-out;\n }\n button:hover {\n background-color: #8c5393;\n box-shadow: 4px;\n box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);\n }\n button:active {\n background-color: #c73852;\n }\n</style>\n`;\n}\n\nexport function getSentryExampleApiTemplate() {\n return `// This is just a very simple API route that throws an example error.\n// Feel free to delete this file.\nimport { defineEventHandler } from '#imports';\n\nexport default defineEventHandler(() => {\n throw new Error(\"Sentry Example API Route Error\");\n});\n`;\n}\n\nexport function getSentryErrorButtonTemplate() {\n return `<!--\nThis is just a very simple component that throws an example error.\nFeel free to delete this file.\n-->\n\n<script setup>\n import * as Sentry from '@sentry/nuxt';\n \n const throwError = () => {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n () => {\n throw new Error('Sentry Example Error');\n }\n )\n };\n</script>\n\n<template>\n <button id=\"errorBtn\" @click=\"throwError\"> Throw Error! </button>\n</template>\n\n<style scoped>\n button {\n padding: 12px;\n cursor: pointer;\n background-color: rgb(54, 45, 89);\n border-radius: 4px;\n border: none;\n color: white;\n font-size: 1em;\n margin: 1em;\n transition: all 0.25s ease-in-out;\n }\n button:hover {\n background-color: #8c5393;\n box-shadow: 4px;\n box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);\n }\n button:active {\n background-color: #c73852;\n }\n</style>\n`;\n}\n"]}
|
package/dist/src/nuxt/utils.js
CHANGED
|
@@ -22,86 +22,39 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
-
function step(op) {
|
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
-
switch (op[0]) {
|
|
44
|
-
case 0: case 1: t = op; break;
|
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
-
default:
|
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
-
if (t[2]) _.ops.pop();
|
|
54
|
-
_.trys.pop(); continue;
|
|
55
|
-
}
|
|
56
|
-
op = body.call(thisArg, _);
|
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
26
|
exports.isNuxtV4 = void 0;
|
|
63
27
|
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
64
|
-
|
|
65
|
-
|
|
28
|
+
const clack = __importStar(require("@clack/prompts"));
|
|
29
|
+
const semver_1 = require("semver");
|
|
66
30
|
// @ts-expect-error - magicast is ESM and TS complains about that. It works though
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
function isNuxtV4(nuxtConfig, packageVersion) {
|
|
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
|
-
return [3 /*break*/, 5];
|
|
95
|
-
case 3:
|
|
96
|
-
_a = _b.sent();
|
|
97
|
-
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(clack.confirm({ message: 'Are you using Nuxt version 4?' }))];
|
|
98
|
-
case 4:
|
|
99
|
-
// If we cannot parse their config, just ask.
|
|
100
|
-
return [2 /*return*/, _b.sent()];
|
|
101
|
-
case 5: return [2 /*return*/, false];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
31
|
+
const magicast_1 = require("magicast");
|
|
32
|
+
const clack_utils_1 = require("../utils/clack-utils");
|
|
33
|
+
async function isNuxtV4(nuxtConfig, packageVersion) {
|
|
34
|
+
if (!packageVersion) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const minVer = (0, semver_1.minVersion)(packageVersion);
|
|
38
|
+
if (minVer && (0, semver_1.gte)(minVer, '4.0.0')) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
// At the time of writing, nuxt 4 is not on its own
|
|
42
|
+
// major yet. We must read the `compatibilityVersion`
|
|
43
|
+
// from the nuxt config.
|
|
44
|
+
try {
|
|
45
|
+
const mod = await (0, magicast_1.loadFile)(nuxtConfig);
|
|
46
|
+
const config = mod.exports.default.$type === 'function-call'
|
|
47
|
+
? mod.exports.default.$args[0]
|
|
48
|
+
: mod.exports.default;
|
|
49
|
+
if (config && config.future && config.future.compatibilityVersion === 4) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// If we cannot parse their config, just ask.
|
|
55
|
+
return await (0, clack_utils_1.abortIfCancelled)(clack.confirm({ message: 'Are you using Nuxt version 4?' }));
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
105
58
|
}
|
|
106
59
|
exports.isNuxtV4 = isNuxtV4;
|
|
107
60
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/nuxt/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/nuxt/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,sDAAwC;AACxC,mCAAyC;AACzC,kFAAkF;AAClF,uCAAoC;AACpC,sDAAwD;AAEjD,KAAK,UAAU,QAAQ,CAC5B,UAAkB,EAClB,cAAkC;IAElC,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,KAAK,CAAC;KACd;IAED,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,cAAc,CAAC,CAAC;IAC1C,IAAI,MAAM,IAAI,IAAA,YAAG,EAAC,MAAM,EAAE,OAAO,CAAC,EAAE;QAClC,OAAO,IAAI,CAAC;KACb;IAED,mDAAmD;IACnD,qDAAqD;IACrD,wBAAwB;IACxB,IAAI;QACF,MAAM,GAAG,GAAG,MAAM,IAAA,mBAAQ,EAAC,UAAU,CAAC,CAAC;QACvC,MAAM,MAAM,GACV,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,KAAK,eAAe;YAC3C,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YAC9B,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC;QAE1B,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,oBAAoB,KAAK,CAAC,EAAE;YACvE,OAAO,IAAI,CAAC;SACb;KACF;IAAC,MAAM;QACN,6CAA6C;QAC7C,OAAO,MAAM,IAAA,8BAAgB,EAC3B,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAAC,CAC5D,CAAC;KACH;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAlCD,4BAkCC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport { gte, minVersion } from 'semver';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { loadFile } from 'magicast';\nimport { abortIfCancelled } from '../utils/clack-utils';\n\nexport async function isNuxtV4(\n nuxtConfig: string,\n packageVersion: string | undefined,\n) {\n if (!packageVersion) {\n return false;\n }\n\n const minVer = minVersion(packageVersion);\n if (minVer && gte(minVer, '4.0.0')) {\n return true;\n }\n\n // At the time of writing, nuxt 4 is not on its own\n // major yet. We must read the `compatibilityVersion`\n // from the nuxt config.\n try {\n const mod = await loadFile(nuxtConfig);\n const config =\n mod.exports.default.$type === 'function-call'\n ? mod.exports.default.$args[0]\n : mod.exports.default;\n\n if (config && config.future && config.future.compatibilityVersion === 4) {\n return true;\n }\n } catch {\n // If we cannot parse their config, just ask.\n return await abortIfCancelled(\n clack.confirm({ message: 'Are you using Nuxt version 4?' }),\n );\n }\n\n return false;\n}\n"]}
|