cssnano 8.0.2 → 8.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE-MIT CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)
1
+ Copyright (c) Ben Briggs <beneb.info@gmail.com> (https://beneb.info)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "cssnano",
3
- "version": "8.0.2",
3
+ "version": "8.0.4",
4
4
  "description": "A modular minifier, built on top of the PostCSS ecosystem.",
5
- "main": "src/index.js",
6
- "types": "types/index.d.ts",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./types/index.d.ts",
8
+ "default": "./src/index.js"
9
+ },
10
+ "./src": "./src/index.js",
11
+ "./src/index": "./src/index.js",
12
+ "./src/index.js": "./src/index.js",
13
+ "./package.json": "./package.json"
14
+ },
7
15
  "funding": {
8
16
  "type": "opencollective",
9
17
  "url": "https://opencollective.com/cssnano"
@@ -20,15 +28,18 @@
20
28
  "license": "MIT",
21
29
  "dependencies": {
22
30
  "lilconfig": "^3.1.3",
23
- "cssnano-preset-default": "^8.0.2"
31
+ "cssnano-preset-default": "^8.0.4"
24
32
  },
25
33
  "homepage": "https://github.com/cssnano/cssnano",
26
34
  "author": {
27
35
  "name": "Ben Briggs",
28
36
  "email": "beneb.info@gmail.com",
29
- "url": "http://beneb.info"
37
+ "url": "https://beneb.info"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "cssnano/cssnano"
30
42
  },
31
- "repository": "cssnano/cssnano",
32
43
  "files": [
33
44
  "src",
34
45
  "LICENSE-MIT",
@@ -41,12 +52,13 @@
41
52
  "node": "^22.11.0 || ^24.11.0 || >=26.0"
42
53
  },
43
54
  "devDependencies": {
44
- "autoprefixer": "^10.5.0",
45
- "postcss": "^8.5.15",
46
- "cssnano-preset-advanced": "^8.0.2",
47
- "cssnano-preset-lite": "^5.0.1"
55
+ "autoprefixer": "^10.5.4",
56
+ "postcss": "^8.5.25",
57
+ "postcss-font-magician": "^4.0.0",
58
+ "cssnano-preset-advanced": "^8.0.4",
59
+ "cssnano-preset-lite": "^5.0.2"
48
60
  },
49
61
  "peerDependencies": {
50
- "postcss": "^8.5.15"
62
+ "postcss": "^8.5.25"
51
63
  }
52
64
  }
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
- const path = require('path');
2
+ const path = require('node:path');
3
3
  /** @type {any} */
4
4
  const postcss = require('postcss');
5
5
  const { lilconfigSync } = require('lilconfig');
@@ -122,25 +122,39 @@ function resolveConfig(options) {
122
122
  * @return {import('postcss').Processor}
123
123
  */
124
124
  function cssnanoPlugin(options = {}) {
125
- if (Array.isArray(options.plugins)) {
126
- if (!options.preset || !options.preset.plugins) {
127
- options.preset = { plugins: [] };
125
+ if (Array.isArray(/** @type {Options} */ (options).plugins)) {
126
+ if (
127
+ !(/** @type {Options} */ (options).preset) ||
128
+ !(/** @type {Options} */ (options).preset.plugins)
129
+ ) {
130
+ /** @type {Options} */ (options).preset = { plugins: [] };
128
131
  }
129
132
 
130
- options.plugins.forEach((plugin) => {
131
- if (Array.isArray(plugin)) {
132
- const [pluginDef, opts = {}] = plugin;
133
- if (typeof pluginDef === 'string' && isResolvable(pluginDef)) {
134
- options.preset.plugins.push([require(pluginDef), opts]);
133
+ // prettier-ignore
134
+ /** @type {any[]} */ (/** @type {Options} */ (options).plugins)
135
+ .forEach((plugin) => {
136
+ if (Array.isArray(plugin)) {
137
+ const [pluginDef, opts = {}] = plugin;
138
+ if (typeof pluginDef === 'string' && isResolvable(pluginDef)) {
139
+ /** @type {Options} */ (options).preset.plugins.push([
140
+ require(pluginDef),
141
+ opts,
142
+ ]);
143
+ } else {
144
+ /** @type {Options} */ (options).preset.plugins.push([
145
+ pluginDef,
146
+ opts,
147
+ ]);
148
+ }
149
+ } else if (typeof plugin === 'string' && isResolvable(plugin)) {
150
+ /** @type {Options} */ (options).preset.plugins.push([
151
+ require(plugin),
152
+ {},
153
+ ]);
135
154
  } else {
136
- options.preset.plugins.push([pluginDef, opts]);
155
+ /** @type {Options} */ (options).preset.plugins.push([plugin, {}]);
137
156
  }
138
- } else if (typeof plugin === 'string' && isResolvable(plugin)) {
139
- options.preset.plugins.push([require(plugin), {}]);
140
- } else {
141
- options.preset.plugins.push([plugin, {}]);
142
- }
143
- });
157
+ });
144
158
  }
145
159
  const plugins = [];
146
160
  const nanoPlugins = resolveConfig(options);
package/types/index.d.ts CHANGED
@@ -1,17 +1,13 @@
1
1
  export = cssnanoPlugin;
2
+ export type Options = {
3
+ preset?: any;
4
+ plugins?: any[];
5
+ configFile?: string;
6
+ };
2
7
  /**
3
8
  * @type {import('postcss').PluginCreator<Options>}
4
9
  * @param {Options=} options
5
10
  * @return {import('postcss').Processor}
6
11
  */
7
- declare function cssnanoPlugin(options?: Options | undefined): import("postcss").Processor;
8
- declare namespace cssnanoPlugin {
9
- export { postcss, Options };
10
- }
11
- declare var postcss: true;
12
- type Options = {
13
- preset?: any;
14
- plugins?: any[];
15
- configFile?: string;
16
- };
12
+ declare function cssnanoPlugin(options?: {}): any;
17
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AAsHA;;;;GAIG;AACH,yCAHW,OAAO,YAAC,GACP,OAAO,SAAS,EAAE,SAAS,CAwCtC;;;;;eAxJa;IAAC,MAAM,CAAC,EAAE,GAAG,CAAC;IAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"SAkLiB,aAAa;AAzK1B,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,OAoDlC"}