+4
-4
| { | ||
| "name": "cssnano", | ||
| "version": "8.0.6", | ||
| "version": "8.0.7", | ||
| "description": "A modular CSS minifier, built on top of the PostCSS ecosystem.", | ||
@@ -31,3 +31,3 @@ "exports": { | ||
| "lilconfig": "^3.1.3", | ||
| "cssnano-preset-default": "^8.0.6" | ||
| "cssnano-preset-default": "^8.0.7" | ||
| }, | ||
@@ -59,4 +59,4 @@ "homepage": "https://github.com/cssnano/cssnano", | ||
| "postcss-font-magician": "^4.0.0", | ||
| "cssnano-preset-advanced": "^8.0.6", | ||
| "cssnano-preset-lite": "^5.0.4" | ||
| "cssnano-preset-advanced": "^8.0.7", | ||
| "cssnano-preset-lite": "^5.0.5" | ||
| }, | ||
@@ -63,0 +63,0 @@ "peerDependencies": { |
+23
-13
@@ -9,3 +9,9 @@ 'use strict'; | ||
| /** @typedef {{preset?: any, plugins?: any[], configFile?: string}} Options */ | ||
| /** @typedef {boolean | { exclude?: boolean } | void | undefined} PluginOptions */ | ||
| /** @typedef {import('postcss').PluginCreator<any>} PluginCreator */ | ||
| /** @typedef {[PluginCreator, PluginOptions]} PresetPlugin */ | ||
| /** @typedef {(options?: any) => { plugins: PresetPlugin[] }} PresetFactory */ | ||
| /** @typedef {string | PresetFactory | [string | PresetFactory, object] | { plugins: PresetPlugin[] }} PresetSpec */ | ||
| /** @typedef {string | PluginCreator | [string | PluginCreator, object?]} PluginSpec */ | ||
| /** @typedef {{ preset?: PresetSpec, plugins?: PluginSpec[], configFile?: string }} Options */ | ||
| /** | ||
@@ -32,3 +38,3 @@ * @param {string} moduleId | ||
| * @param {unknown} preset | ||
| * @return {[import('postcss').PluginCreator<any>, boolean | Record<string, any> | undefined][]}} | ||
| * @return {PresetPlugin[]} | ||
| */ | ||
@@ -126,12 +132,13 @@ function resolvePreset(preset) { | ||
| function cssnanoPlugin(options = {}) { | ||
| if (Array.isArray(/** @type {Options} */ (options).plugins)) { | ||
| /** @typedef {Options & { preset: { plugins: PresetPlugin[] } }} MutableOptions */ | ||
| if (Array.isArray(/** @type {MutableOptions} */ (options).plugins)) { | ||
| if ( | ||
| !(/** @type {Options} */ (options).preset) || | ||
| !(/** @type {Options} */ (options).preset.plugins) | ||
| !(/** @type {MutableOptions} */ (options).preset) || | ||
| !(/** @type {MutableOptions} */ (options).preset.plugins) | ||
| ) { | ||
| /** @type {Options} */ (options).preset = { plugins: [] }; | ||
| /** @type {MutableOptions} */ (options).preset = { plugins: [] }; | ||
| } | ||
| const inputPlugins = /** @type {any[]} */ ( | ||
| /** @type {Options} */ (options).plugins | ||
| const inputPlugins = /** @type {PluginSpec[]} */ ( | ||
| /** @type {MutableOptions} */ (options).plugins | ||
| ); | ||
@@ -142,3 +149,3 @@ for (const plugin of inputPlugins) { | ||
| if (typeof pluginDef === 'string' && isResolvable(pluginDef)) { | ||
| /** @type {Options} */ (options).preset.plugins.push([ | ||
| /** @type {MutableOptions} */ (options).preset.plugins.push([ | ||
| require(pluginDef), | ||
@@ -148,4 +155,4 @@ opts, | ||
| } else { | ||
| /** @type {Options} */ (options).preset.plugins.push([ | ||
| pluginDef, | ||
| /** @type {MutableOptions} */ (options).preset.plugins.push([ | ||
| /** @type {PluginCreator} */ (pluginDef), | ||
| opts, | ||
@@ -155,3 +162,3 @@ ]); | ||
| } else if (typeof plugin === 'string' && isResolvable(plugin)) { | ||
| /** @type {Options} */ (options).preset.plugins.push([ | ||
| /** @type {MutableOptions} */ (options).preset.plugins.push([ | ||
| require(plugin), | ||
@@ -161,3 +168,6 @@ {}, | ||
| } else { | ||
| /** @type {Options} */ (options).preset.plugins.push([plugin, {}]); | ||
| /** @type {MutableOptions} */ (options).preset.plugins.push([ | ||
| /** @type {PluginCreator} */ (plugin), | ||
| {}, | ||
| ]); | ||
| } | ||
@@ -164,0 +174,0 @@ } |
+14
-2
| export = cssnanoPlugin; | ||
| import postcss = require('postcss'); | ||
| export type PluginOptions = boolean | { | ||
| exclude?: boolean; | ||
| } | void | undefined; | ||
| export type PluginCreator = import('postcss').PluginCreator<any>; | ||
| export type PresetPlugin = [PluginCreator, PluginOptions]; | ||
| export type PresetFactory = (options?: any) => { | ||
| plugins: PresetPlugin[]; | ||
| }; | ||
| export type PresetSpec = string | PresetFactory | [string | PresetFactory, object] | { | ||
| plugins: PresetPlugin[]; | ||
| }; | ||
| export type PluginSpec = string | PluginCreator | [string | PluginCreator, object?]; | ||
| export type Options = { | ||
| preset?: any; | ||
| plugins?: any[]; | ||
| preset?: PresetSpec; | ||
| plugins?: PluginSpec[]; | ||
| configFile?: string; | ||
@@ -7,0 +19,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"SAkLiB,aAAa;OAhLxB,OAAO,WAAW,SAAS;AAM7B,YAAgE,OAAO,GAA7D;IAAC,MAAM,CAAC,EAAE,GAAG,CAAC;IAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAC,CAAS;AA6G3E;;;;GAIG;AACH,iBAAS,aAAa,CAAC,OAAO,KAAK,qBAqDlC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"SA4LiB,aAAa;OA1LxB,OAAO,WAAW,SAAS;AAM7B,YAA8D,aAAa,GAAjE,OAAO,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,CAAe;AAC3E,YAAgD,aAAa,GAAnD,OAAO,SAAS,EAAE,aAAa,CAAC,GAAG,CAAC,CAAe;AAC7D,YAA0C,YAAY,GAA5C,CAAC,aAAa,EAAE,aAAa,CAAC,CAAc;AACtD,YAA0D,aAAa,GAA7D,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK;IAAE,OAAO,EAAE,YAAY,EAAE,CAAA;CAAE,CAAe;AACvE,YAAmG,UAAU,GAAnG,MAAM,GAAG,aAAa,GAAG,CAAC,MAAM,GAAG,aAA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