UNPKG

@sentry/wizard

Version:

Sentry wizard helping you to configure your project

63 lines 2.77 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.isNuxtV4 = void 0; // @ts-expect-error - clack is ESM and TS complains about that. It works though const clack = __importStar(require("@clack/prompts")); const semver_1 = require("semver"); // @ts-expect-error - magicast is ESM and TS complains about that. It works though const magicast_1 = require("magicast"); const clack_1 = require("../utils/clack"); async function isNuxtV4(nuxtConfig, packageVersion) { if (!packageVersion) { return false; } const minVer = (0, semver_1.minVersion)(packageVersion); if (minVer && (0, semver_1.gte)(minVer, '4.0.0')) { return true; } // At the time of writing, nuxt 4 is not on its own // major yet. We must read the `compatibilityVersion` // from the nuxt config. try { // Magicast is hard to type correctly so we disable these rules /* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */ const mod = await (0, magicast_1.loadFile)(nuxtConfig); const config = mod.exports.default.$type === 'function-call' ? mod.exports.default.$args[0] : mod.exports.default; if (config && config.future && config.future.compatibilityVersion === 4) { return true; } /* eslint-enable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */ } catch { // If we cannot parse their config, just ask. return await (0, clack_1.abortIfCancelled)(clack.confirm({ message: 'Are you using Nuxt version 4?' })); } return false; } exports.isNuxtV4 = isNuxtV4; //# sourceMappingURL=utils.js.map