UNPKG

@nx/angular

Version:

The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: - Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Playwright and Cypre

46 lines (45 loc) 2.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateOptions = validateOptions; const semver_1 = require("semver"); const angular_version_utils_1 = require("../../utilities/angular-version-utils"); function validateOptions(options) { const { version: angularVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)(); if ((0, semver_1.lt)(angularVersion, '19.0.0')) { if (options.outputMode) { throw new Error(`The "outputMode" option requires Angular version 19.0.0 or greater. You are currently using version ${angularVersion}.`); } if (options.stylePreprocessorOptions?.sass) { throw new Error(`The "stylePreprocessorOptions.sass" option requires Angular version 19.0.0 or greater. You are currently using version ${angularVersion}.`); } if (typeof options.ssr === 'object' && options.ssr?.experimentalPlatform) { throw new Error(`The "ssr.experimentalPlatform" option requires Angular version 19.0.0 or greater. You are currently using version ${angularVersion}.`); } if (options.security !== undefined) { throw new Error(`The "security" option requires Angular version 19.0.0 or greater. You are currently using version ${angularVersion}.`); } if (typeof options.server === 'boolean' && options.server === false) { throw new Error(`The "false" value for the "server" option requires Angular version 19.0.0 or greater. You are currently using version ${angularVersion}.`); } } if ((0, semver_1.lt)(angularVersion, '20.0.0')) { if (options.sourceMap && typeof options.sourceMap === 'object' && options.sourceMap.sourcesContent === false) { throw new Error(`The "sourceMap.sourcesContent" option requires Angular version 20.0.0 or greater. You are currently using version ${angularVersion}.`); } if (options.conditions) { throw new Error(`The "conditions" option requires Angular version 20.0.0 or greater. You are currently using version ${angularVersion}.`); } } if ((0, semver_1.lt)(angularVersion, '20.1.0')) { if (options.loader) { const invalidLoaders = Array.from(new Set(Object.values(options.loader).filter((l) => l === 'dataurl' || l === 'base64'))); if (invalidLoaders.length) { throw new Error(`Using the ${invalidLoaders .map((l) => `"${l}"`) .join(' and ')} loader${invalidLoaders.length > 1 ? 's' : ''} requires Angular version 20.1.0 or greater. You are currently using version ${angularVersion}.`); } } } }