Comparing version
{ | ||
"name": "cssnano", | ||
"version": "5.0.17", | ||
"version": "5.1.0", | ||
"description": "A modular minifier, built on top of the PostCSS ecosystem.", | ||
"main": "src/index.js", | ||
"types": "types/index.d.ts", | ||
"funding": { | ||
@@ -21,3 +22,3 @@ "type": "opencollective", | ||
"dependencies": { | ||
"cssnano-preset-default": "^5.1.12", | ||
"cssnano-preset-default": "^5.2.0", | ||
"lilconfig": "^2.0.3", | ||
@@ -35,3 +36,4 @@ "yaml": "^1.10.2" | ||
"src", | ||
"LICENSE-MIT" | ||
"LICENSE-MIT", | ||
"types" | ||
], | ||
@@ -46,4 +48,4 @@ "bugs": { | ||
"autoprefixer": "^10.3.7", | ||
"cssnano-preset-advanced": "^5.1.12", | ||
"cssnano-preset-lite": "^2.0.3", | ||
"cssnano-preset-advanced": "^5.2.0", | ||
"cssnano-preset-lite": "^2.1.0", | ||
"postcss": "^8.2.15" | ||
@@ -50,0 +52,0 @@ }, |
'use strict'; | ||
const path = require('path'); | ||
/** @type {any} */ | ||
const postcss = require('postcss'); | ||
@@ -9,3 +10,4 @@ const yaml = require('yaml'); | ||
/* | ||
/** @typedef {{preset?: any, plugins?: any[], configFile?: string}} Options */ | ||
/** | ||
* @param {string} moduleId | ||
@@ -23,3 +25,3 @@ * @returns {boolean} | ||
/* | ||
/** | ||
* preset can be one of four possibilities: | ||
@@ -30,4 +32,6 @@ * preset = 'default' | ||
* preset = {plugins: []} <- already invoked function | ||
* | ||
* @param {any} preset | ||
* @return {[import('postcss').PluginCreator<any>, boolean | Record<string, any> | undefined][]}} | ||
*/ | ||
function resolvePreset(preset) { | ||
@@ -77,8 +81,9 @@ let fn, options; | ||
/* | ||
/** | ||
* cssnano will look for configuration firstly as options passed | ||
* directly to it, and failing this it will use lilconfig to | ||
* load an external file. | ||
* @param {Options} options | ||
*/ | ||
function resolveConfig(options) { | ||
@@ -89,7 +94,8 @@ if (options.preset) { | ||
/** @type {string | undefined} */ | ||
let searchPath = process.cwd(); | ||
let configPath = null; | ||
let configPath = undefined; | ||
if (options.configFile) { | ||
searchPath = null; | ||
searchPath = undefined; | ||
configPath = path.resolve(process.cwd(), options.configFile); | ||
@@ -124,3 +130,8 @@ } | ||
const cssnanoPlugin = (options = {}) => { | ||
/** | ||
* @type {import('postcss').PluginCreator<Options>} | ||
* @param {Options=} options | ||
* @return {import('postcss').Plugin} | ||
*/ | ||
function cssnanoPlugin(options = {}) { | ||
if (Array.isArray(options.plugins)) { | ||
@@ -163,5 +174,5 @@ if (!options.preset || !options.preset.plugins) { | ||
return postcss(plugins); | ||
}; | ||
} | ||
cssnanoPlugin.postcss = true; | ||
module.exports = cssnanoPlugin; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
7400
13.53%5
25%166
20.29%0
-100%