UNPKG

@nx/next

Version:

The Next.js plugin for Nx contains executors and generators for managing Next.js applications and libraries within an Nx workspace. It provides: - Scaffolding for creating, building, serving, linting, and testing Next.js applications. - Integration wit

68 lines (67 loc) 2.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.nextSpecificStyleDependenciesSwc = exports.nextSpecificStyleDependenciesBabel = void 0; exports.addStyleDependencies = addStyleDependencies; const devkit_1 = require("@nx/devkit"); const versions_1 = require("@nx/react/src/utils/versions"); const styled_1 = require("@nx/react/src/utils/styled"); const versions_2 = require("./versions"); const nextSpecificStyleDependenciesCommon = { css: { dependencies: {}, devDependencies: {}, }, scss: { dependencies: {}, devDependencies: { sass: versions_2.sassVersion }, }, less: { dependencies: {}, devDependencies: { less: versions_1.lessVersion, 'less-loader': versions_2.lessLoader, }, }, }; exports.nextSpecificStyleDependenciesBabel = { ...nextSpecificStyleDependenciesCommon, 'styled-components': { dependencies: styled_1.cssInJsDependenciesBabel['styled-components'].dependencies, devDependencies: { ...styled_1.cssInJsDependenciesBabel['styled-components'].devDependencies, 'babel-plugin-styled-components': versions_2.babelPluginStyledComponentsVersion, }, }, '@emotion/styled': { dependencies: { ...styled_1.cssInJsDependenciesBabel['@emotion/styled'].dependencies, '@emotion/server': versions_2.emotionServerVersion, }, devDependencies: styled_1.cssInJsDependenciesBabel['@emotion/styled'].devDependencies, }, }; exports.nextSpecificStyleDependenciesSwc = { ...nextSpecificStyleDependenciesCommon, 'styled-components': { dependencies: styled_1.cssInJsDependenciesSwc['styled-components'].dependencies, devDependencies: { ...styled_1.cssInJsDependenciesSwc['styled-components'].devDependencies, 'babel-plugin-styled-components': versions_2.babelPluginStyledComponentsVersion, }, }, '@emotion/styled': { dependencies: { ...styled_1.cssInJsDependenciesSwc['@emotion/styled'].dependencies, '@emotion/server': versions_2.emotionServerVersion, }, devDependencies: styled_1.cssInJsDependenciesSwc['@emotion/styled'].devDependencies, }, }; function addStyleDependencies(host, options) { const extraDependencies = options.swc ? exports.nextSpecificStyleDependenciesSwc[options.style] : exports.nextSpecificStyleDependenciesBabel[options.style]; return extraDependencies ? (0, devkit_1.addDependenciesToPackageJson)(host, extraDependencies.dependencies, extraDependencies.devDependencies) : () => { }; }