cssnano-preset-advanced 8.0.9 → 9.0.0

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/README.md CHANGED
@@ -62,32 +62,28 @@ If you don't have npm then [check out this installation tutorial](https://npmjs.
62
62
 
63
63
  ### Configuration
64
64
 
65
- If you would like to use the preset in its default configuration, specify a section in your `package.json`:
66
-
67
- ```diff
68
- {
69
- "name": "awesome-application",
70
- + "cssnano": {
71
- + "preset": "advanced"
72
- + }
73
- }
65
+ If you would like to use the preset in its default configuration, add it to your `cssnano.config.js`:
66
+
67
+ ```js
68
+ // cssnano.config.js
69
+ module.exports = {
70
+ preset: 'advanced',
71
+ };
74
72
  ```
75
73
 
76
74
  But should you wish to customise this, you can pass an array with the second parameter as the options object to use. For example, to remove all comments:
77
75
 
78
- ```diff
79
- {
80
- "name": "awesome-application",
81
- + "cssnano": {
82
- + "preset": [
83
- + "advanced",
84
- + {"discardComments": {"removeAll": true}}
85
- + ]
86
- + }
87
- }
76
+ ```js
77
+ // cssnano.config.js
78
+ module.exports = {
79
+ preset: [
80
+ 'advanced',
81
+ { discardComments: { removeAll: true } },
82
+ ],
83
+ };
88
84
  ```
89
85
 
90
- Depending on your usage, the JSON configuration might not work for you, such as in cases where you would like to use options with customisable function parameters. For this use case, we recommend a `cssnano.config.js` at the same location as your `package.json`. You can then load a preset and export it with your custom parameters:
86
+ For options with customisable function parameters, use a `cssnano.config.js` at the same location as your `package.json`. You can then load a preset and export it with your custom parameters:
91
87
 
92
88
  ```js
93
89
  const advancedPreset = require('cssnano-preset-advanced');
package/package.json CHANGED
@@ -1,16 +1,12 @@
1
1
  {
2
2
  "name": "cssnano-preset-advanced",
3
- "version": "8.0.9",
3
+ "version": "9.0.0",
4
4
  "description": "Advanced optimisations for cssnano; may or may not break your CSS!",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./types/index.d.ts",
8
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"
9
+ }
14
10
  },
15
11
  "files": [
16
12
  "LICENSE-MIT",
@@ -21,11 +17,11 @@
21
17
  "dependencies": {
22
18
  "autoprefixer": "^10.5.4",
23
19
  "css-declaration-sorter": "^7.4.0",
24
- "cssnano-preset-default": "^8.0.9",
25
- "postcss-discard-unused": "^8.0.4",
26
- "postcss-merge-idents": "^8.0.4",
27
- "postcss-reduce-idents": "^8.0.4",
28
- "postcss-zindex": "^8.0.4"
20
+ "cssnano-preset-default": "^9.0.0",
21
+ "postcss-discard-unused": "^9.0.0",
22
+ "postcss-merge-idents": "^9.0.0",
23
+ "postcss-reduce-idents": "^9.0.0",
24
+ "postcss-zindex": "^9.0.0"
29
25
  },
30
26
  "author": {
31
27
  "name": "Ben Briggs",
@@ -41,7 +37,7 @@
41
37
  "url": "https://github.com/cssnano/cssnano/issues"
42
38
  },
43
39
  "engines": {
44
- "node": "^22.11.0 || ^24.11.0 || >=26.0"
40
+ "node": "^22.22.3 || ^24.15.0 || >=26.0"
45
41
  },
46
42
  "devDependencies": {
47
43
  "postcss": "^8.5.26"
@@ -49,6 +45,7 @@
49
45
  "peerDependencies": {
50
46
  "postcss": "^8.5.26"
51
47
  },
48
+ "type": "module",
52
49
  "scripts": {
53
50
  "test": "node --test"
54
51
  }
package/src/index.js CHANGED
@@ -1,12 +1,10 @@
1
- 'use strict';
2
-
3
- const defaultPreset = require('cssnano-preset-default');
4
- const cssDeclarationSorter = require('css-declaration-sorter');
5
- const postcssDiscardUnused = require('postcss-discard-unused');
6
- const postcssMergeIdents = require('postcss-merge-idents');
7
- const postcssReduceIdents = require('postcss-reduce-idents');
8
- const postcssZindex = require('postcss-zindex');
9
- const autoprefixer = require('autoprefixer');
1
+ import defaultPreset from 'cssnano-preset-default';
2
+ import cssDeclarationSorter from 'css-declaration-sorter';
3
+ import postcssDiscardUnused from 'postcss-discard-unused';
4
+ import postcssMergeIdents from 'postcss-merge-idents';
5
+ import postcssReduceIdents from 'postcss-reduce-idents';
6
+ import postcssZindex from 'postcss-zindex';
7
+ import autoprefixer from 'autoprefixer';
10
8
 
11
9
  /**
12
10
  * @template {object | void} [OptionsExtends=void]
@@ -24,9 +22,9 @@ const autoprefixer = require('autoprefixer');
24
22
  */
25
23
 
26
24
  /**
27
- * @typedef {defaultPreset.AutoprefixerOptions} AutoprefixerOptions
28
- * @typedef {defaultPreset.BrowserslistOptions} BrowserslistOptions
29
- * @typedef {defaultPreset.Options & AdvancedOptions} Options
25
+ * @typedef {import('cssnano-preset-default').AutoprefixerOptions} AutoprefixerOptions
26
+ * @typedef {import('cssnano-preset-default').BrowserslistOptions} BrowserslistOptions
27
+ * @typedef {import('cssnano-preset-default').Options & AdvancedOptions} Options
30
28
  */
31
29
  /**
32
30
  * @param {[import('postcss').PluginCreator<any>, keyof AdvancedOptions][]} plugins
@@ -104,5 +102,6 @@ function advancedPreset(opts = {}) {
104
102
  ],
105
103
  };
106
104
  }
105
+ const moduleExports = advancedPreset;
107
106
 
108
- module.exports = advancedPreset;
107
+ export { moduleExports as default, moduleExports as 'module.exports' };
package/types/index.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- export = advancedPreset;
2
- import defaultPreset = require('cssnano-preset-default');
3
- import cssDeclarationSorter = require('css-declaration-sorter');
4
- import autoprefixer = require('autoprefixer');
1
+ import cssDeclarationSorter from 'css-declaration-sorter';
2
+ import autoprefixer from 'autoprefixer';
5
3
  export type SimpleOptions<OptionsExtends extends object | void = void> = false | (OptionsExtends & {
6
4
  exclude?: true;
7
5
  });
@@ -13,9 +11,9 @@ export type AdvancedOptions = {
13
11
  reduceIdents?: SimpleOptions<import('postcss-reduce-idents').Options>;
14
12
  zindex?: SimpleOptions<import('postcss-zindex').Options>;
15
13
  };
16
- export type AutoprefixerOptions = defaultPreset.AutoprefixerOptions;
17
- export type BrowserslistOptions = defaultPreset.BrowserslistOptions;
18
- export type Options = defaultPreset.Options & AdvancedOptions;
14
+ export type AutoprefixerOptions = import('cssnano-preset-default').AutoprefixerOptions;
15
+ export type BrowserslistOptions = import('cssnano-preset-default').BrowserslistOptions;
16
+ export type Options = import('cssnano-preset-default').Options & AdvancedOptions;
19
17
  /**
20
18
  * Advanced optimisations for cssnano; may or may not break your CSS!
21
19
  *
@@ -25,4 +23,6 @@ export type Options = defaultPreset.Options & AdvancedOptions;
25
23
  declare function advancedPreset(opts?: Options & AutoprefixerOptions & BrowserslistOptions): {
26
24
  plugins: [import('postcss').PluginCreator<any>, Options[keyof Options]][];
27
25
  };
26
+ declare const moduleExports: typeof advancedPreset;
27
+ export { moduleExports as default, moduleExports as 'module.exports' };
28
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"SA2GiB,cAAc;OAzGzB,aAAa,WAAW,wBAAwB;OAChD,oBAAoB,WAAW,wBAAwB;OAKvD,YAAY,WAAW,cAAc;AAIxC,YAAqD,aAAa,CADvC,cAAc,SAA9B,MAAM,GAAG,IAAI,GAAkB,IAAK,IACrC,KAAK,IAAG,cAAc,GAAG;IAAC,OAAO,CAAC,EAAE,IAAI,CAAA;CAAC,CAAA,CAAe;AAIlE,YAAkB,eAAe,GACjC;IAAuE,oBAAoB,AAA3F,CACA,EADW,aAAa,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CACpE;IAAkC,YAAY,AAA9C,CACA,EADW,YAAY,CAAC,OAAO,CAC/B;IAAqE,aAAa,AAAlF,CACA,EADW,aAAa,CAAC,OAAO,wBAAwB,EAAE,OAAO,CAAC,CAClE;IAA2B,WAAW,AAAtC,CACA,EADW,aAAa,CACxB;IAAoE,YAAY,AAAhF,CACA,EADW,aAAa,CAAC,OAAO,uBAAuB,EAAE,OAAO,CAAC,CACjE;IAA6D,MAAM,AAAnE,CAAoE,EAAzD,aAAa,CAAC,OAAO,gBAA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