cssnano 4.1.11 → 5.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/CHANGELOG.md +131 -3
- package/dist/index.js +108 -87
- package/package.json +58 -55
- package/quickstart.js +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,136 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# [5.0.0](https://github.com/cssnano/cssnano/compare/cssnano@5.0.0-rc.2...cssnano@5.0.0) (2021-04-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package cssnano
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [5.0.0-rc.2](https://github.com/cssnano/cssnano/compare/cssnano@5.0.0-rc.1...cssnano@5.0.0-rc.2) (2021-03-15)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* update SVGO ([aa07cfd](https://github.com/cssnano/cssnano/commit/aa07cfd62c82ed4b1e87219eea8d0ed99635e4ca))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [5.0.0-rc.1](https://github.com/cssnano/cssnano/compare/cssnano@5.0.0-rc.0...cssnano@5.0.0-rc.1) (2021-03-04)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package cssnano
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# 5.0.0-rc.0 (2021-02-19)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* **postcss-ordered-values:** columns transform returning string instead of the AST ([#928](https://github.com/cssnano/cssnano/issues/928)) ([a5d6d36](https://github.com/cssnano/cssnano/commit/a5d6d364e0815ecb198a95de301f3554ccce4f78))
|
|
39
|
+
* **unique-selector:** removed sorting and involving selector comments ([#857](https://github.com/cssnano/cssnano/issues/857)) ([3fa875d](https://github.com/cssnano/cssnano/commit/3fa875dade2138e1a531dce1f8b79814cb39dbc9))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### chore
|
|
43
|
+
|
|
44
|
+
* minimum require version of node is 10.13 ([#871](https://github.com/cssnano/cssnano/issues/871)) ([28bda24](https://github.com/cssnano/cssnano/commit/28bda243e32ce3ba89b3c358a5f78727b3732f11))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
* css declaration sorter ([#855](https://github.com/cssnano/cssnano/issues/855)) ([613d562](https://github.com/cssnano/cssnano/commit/613d562ae79e7e169c80b523b7c2c9b0093bc1d8))
|
|
50
|
+
* migarete to PostCSS 8 ([#975](https://github.com/cssnano/cssnano/issues/975)) ([40b82dc](https://github.com/cssnano/cssnano/commit/40b82dca7f53ac02cd4fe62846dec79b898ccb49))
|
|
51
|
+
* **postcss-reduce-transforms:** improve optimizations ([#745](https://github.com/cssnano/cssnano/issues/745)) ([b0f0d89](https://github.com/cssnano/cssnano/commit/b0f0d892316d7b77e8033a6dc8d67745043a5072))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### BREAKING CHANGES
|
|
55
|
+
|
|
56
|
+
* minimum supported `postcss` version is `8.2.1`
|
|
57
|
+
* minimum require version of node is 10.13
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## 4.1.10 (2019-02-14)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## 4.1.9 (2019-02-12)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Bug Fixes
|
|
69
|
+
|
|
70
|
+
* initial loading time ([#654](https://github.com/cssnano/cssnano/issues/654)) ([de2ef07](https://github.com/cssnano/cssnano/commit/de2ef074a0c7da94c22a5b0336e6c4ca2a94f1b5))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 4.1.7 (2018-10-22)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## 4.1.6 (2018-10-22)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## 4.1.5 (2018-10-17)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### Bug Fixes
|
|
86
|
+
|
|
87
|
+
* toggling of plugins in presets using boolean configuration option ([#622](https://github.com/cssnano/cssnano/issues/622)) ([15076f1](https://github.com/cssnano/cssnano/commit/15076f145118507e010722cc9ed548ffe1b91f8c))
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## 4.1.4 (2018-09-27)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
## 4.1.3 (2018-09-25)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
## 4.1.2 (2018-09-25)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
## 4.1.1 (2018-09-24)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### Bug Fixes
|
|
107
|
+
|
|
108
|
+
* parse error with iPhone X feature ([#614](https://github.com/cssnano/cssnano/issues/614)) ([a3704a7](https://github.com/cssnano/cssnano/commit/a3704a76a631b1cd907ab0c0a8637a622769676d))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
# 4.1.0 (2018-08-24)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
## 4.0.5 (2018-07-30)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## 4.0.4 (2018-07-25)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
## 4.0.3 (2018-07-18)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### Bug Fixes
|
|
128
|
+
|
|
129
|
+
* **postcss-merge-longhand:** not mangle border output ([#555](https://github.com/cssnano/cssnano/issues/555)) ([9a70605](https://github.com/cssnano/cssnano/commit/9a706050b621e7795a9bf74eb7110b5c81804ffe)), closes [#553](https://github.com/cssnano/cssnano/issues/553) [#554](https://github.com/cssnano/cssnano/issues/554)
|
|
130
|
+
|
|
131
|
+
|
|
2
132
|
|
|
3
|
-
## Bug Fixes
|
|
4
133
|
|
|
5
|
-
* fix [CVE-2021-28092](https://nvd.nist.gov/vuln/detail/CVE-2021-28092)
|
|
6
134
|
|
|
7
135
|
# 4.1.10
|
|
8
136
|
|
package/dist/index.js
CHANGED
|
@@ -1,42 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
4
|
+
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.default = void 0;
|
|
6
7
|
|
|
7
|
-
var _path = require(
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
8
9
|
|
|
9
|
-
var
|
|
10
|
+
var _postcss = _interopRequireDefault(require("postcss"));
|
|
10
11
|
|
|
11
|
-
var
|
|
12
|
+
var _cosmiconfig = require("cosmiconfig");
|
|
12
13
|
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
var _cosmiconfig = require('cosmiconfig');
|
|
16
|
-
|
|
17
|
-
var _cosmiconfig2 = _interopRequireDefault(_cosmiconfig);
|
|
18
|
-
|
|
19
|
-
var _isResolvable = require('is-resolvable');
|
|
20
|
-
|
|
21
|
-
var _isResolvable2 = _interopRequireDefault(_isResolvable);
|
|
14
|
+
var _isResolvable = _interopRequireDefault(require("is-resolvable"));
|
|
22
15
|
|
|
23
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
17
|
|
|
25
18
|
const cssnano = 'cssnano';
|
|
26
|
-
|
|
27
|
-
function initializePlugin(plugin, css, result) {
|
|
28
|
-
if (Array.isArray(plugin)) {
|
|
29
|
-
const [processor, opts] = plugin;
|
|
30
|
-
if (typeof opts === 'undefined' || typeof opts === 'object' && !opts.exclude || typeof opts === 'boolean' && opts === true) {
|
|
31
|
-
return Promise.resolve(processor(opts)(css, result));
|
|
32
|
-
}
|
|
33
|
-
} else {
|
|
34
|
-
return Promise.resolve(plugin()(css, result));
|
|
35
|
-
}
|
|
36
|
-
// Handle excluded plugins
|
|
37
|
-
return Promise.resolve();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
19
|
/*
|
|
41
20
|
* preset can be one of four possibilities:
|
|
42
21
|
* preset = 'default'
|
|
@@ -46,77 +25,119 @@ function initializePlugin(plugin, css, result) {
|
|
|
46
25
|
*/
|
|
47
26
|
|
|
48
27
|
function resolvePreset(preset) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
// Try loading a preset from node_modules
|
|
70
|
-
if ((0, _isResolvable2.default)(fn)) {
|
|
71
|
-
return Promise.resolve(require(fn)(options).plugins);
|
|
72
|
-
}
|
|
73
|
-
const sugar = `cssnano-preset-${fn}`;
|
|
74
|
-
// Try loading a preset from node_modules (sugar)
|
|
75
|
-
if ((0, _isResolvable2.default)(sugar)) {
|
|
76
|
-
return Promise.resolve(require(sugar)(options).plugins);
|
|
77
|
-
}
|
|
78
|
-
// If all else fails, we probably have a typo in the config somewhere
|
|
79
|
-
throw new Error(`Cannot load preset "${fn}". Please check your configuration for errors and try again.`);
|
|
80
|
-
}
|
|
28
|
+
let fn, options;
|
|
29
|
+
|
|
30
|
+
if (Array.isArray(preset)) {
|
|
31
|
+
fn = preset[0];
|
|
32
|
+
options = preset[1];
|
|
33
|
+
} else {
|
|
34
|
+
fn = preset;
|
|
35
|
+
options = {};
|
|
36
|
+
} // For JS setups where we invoked the preset already
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
if (preset.plugins) {
|
|
40
|
+
return preset.plugins;
|
|
41
|
+
} // Provide an alias for the default preset, as it is built-in.
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
if (fn === 'default') {
|
|
45
|
+
return require("cssnano-preset-default")(options).plugins;
|
|
46
|
+
} // For non-JS setups; we'll need to invoke the preset ourselves.
|
|
81
47
|
|
|
48
|
+
|
|
49
|
+
if (typeof fn === 'function') {
|
|
50
|
+
return fn(options).plugins;
|
|
51
|
+
} // Try loading a preset from node_modules
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
if ((0, _isResolvable.default)(fn)) {
|
|
55
|
+
return require(fn)(options).plugins;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const sugar = `cssnano-preset-${fn}`; // Try loading a preset from node_modules (sugar)
|
|
59
|
+
|
|
60
|
+
if ((0, _isResolvable.default)(sugar)) {
|
|
61
|
+
return require(sugar)(options).plugins;
|
|
62
|
+
} // If all else fails, we probably have a typo in the config somewhere
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
throw new Error(`Cannot load preset "${fn}". Please check your configuration for errors and try again.`);
|
|
66
|
+
}
|
|
82
67
|
/*
|
|
83
68
|
* cssnano will look for configuration firstly as options passed
|
|
84
69
|
* directly to it, and failing this it will use cosmiconfig to
|
|
85
70
|
* load an external file.
|
|
86
71
|
*/
|
|
87
72
|
|
|
88
|
-
function resolveConfig(css, result, options) {
|
|
89
|
-
if (options.preset) {
|
|
90
|
-
return resolvePreset(options.preset);
|
|
91
|
-
}
|
|
92
73
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
74
|
+
function resolveConfig(options) {
|
|
75
|
+
if (options.preset) {
|
|
76
|
+
return resolvePreset(options.preset);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let searchPath = process.cwd();
|
|
80
|
+
let configPath = null;
|
|
81
|
+
|
|
82
|
+
if (options.configFile) {
|
|
83
|
+
searchPath = null;
|
|
84
|
+
configPath = _path.default.resolve(process.cwd(), options.configFile);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const configExplorer = (0, _cosmiconfig.cosmiconfigSync)(cssnano);
|
|
88
|
+
const config = configPath ? configExplorer.load(configPath) : configExplorer.search(searchPath);
|
|
96
89
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
if (config === null) {
|
|
91
|
+
return resolvePreset('default');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return resolvePreset(config.config.preset || config.config);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const cssnanoPlugin = (options = {}) => {
|
|
98
|
+
if (Array.isArray(options.plugins)) {
|
|
99
|
+
if (!options.preset || !options.preset.plugins) {
|
|
100
|
+
options.preset = {
|
|
101
|
+
plugins: []
|
|
102
|
+
};
|
|
100
103
|
}
|
|
101
104
|
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
options.plugins.forEach(plugin => {
|
|
106
|
+
if (Array.isArray(plugin)) {
|
|
107
|
+
const [pluginDef, opts = {}] = plugin;
|
|
104
108
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
if (typeof pluginDef === 'string' && (0, _isResolvable.default)(pluginDef)) {
|
|
110
|
+
options.preset.plugins.push([require(pluginDef), opts]);
|
|
111
|
+
} else {
|
|
112
|
+
options.preset.plugins.push([pluginDef, opts]);
|
|
108
113
|
}
|
|
109
|
-
|
|
114
|
+
} else if (typeof plugin === 'string' && (0, _isResolvable.default)(plugin)) {
|
|
115
|
+
options.preset.plugins.push([require(plugin), {}]);
|
|
116
|
+
} else {
|
|
117
|
+
options.preset.plugins.push([plugin, {}]);
|
|
118
|
+
}
|
|
110
119
|
});
|
|
111
|
-
}
|
|
120
|
+
}
|
|
112
121
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
const plugins = [];
|
|
123
|
+
const nanoPlugins = resolveConfig(options);
|
|
124
|
+
|
|
125
|
+
for (const nanoPlugin of nanoPlugins) {
|
|
126
|
+
if (Array.isArray(nanoPlugin)) {
|
|
127
|
+
const [processor, opts] = nanoPlugin;
|
|
128
|
+
|
|
129
|
+
if (typeof opts === 'undefined' || typeof opts === 'object' && !opts.exclude || typeof opts === 'boolean' && opts === true) {
|
|
130
|
+
plugins.push(processor(opts));
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
plugins.push(nanoPlugin);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return (0, _postcss.default)(plugins);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
cssnanoPlugin.postcss = true;
|
|
141
|
+
var _default = cssnanoPlugin;
|
|
142
|
+
exports.default = _default;
|
|
143
|
+
module.exports = exports.default;
|
package/package.json
CHANGED
|
@@ -1,57 +1,60 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
2
|
+
"name": "cssnano",
|
|
3
|
+
"version": "5.0.0",
|
|
4
|
+
"description": "A modular minifier, built on top of the PostCSS ecosystem.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"bundle-size": "webpack --json --config src/__tests__/_webpack.config.js | webpack-bundle-size-analyzer",
|
|
8
|
+
"prebuild": "del-cli dist",
|
|
9
|
+
"build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.js --out-dir dist --ignore \"**/__tests__/\"",
|
|
10
|
+
"prepublish": "yarn build",
|
|
11
|
+
"postinstall": "opencollective-postinstall"
|
|
12
|
+
},
|
|
13
|
+
"collective": {
|
|
14
|
+
"type": "opencollective",
|
|
15
|
+
"url": "https://opencollective.com/cssnano"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"css",
|
|
19
|
+
"compress",
|
|
20
|
+
"minify",
|
|
21
|
+
"optimise",
|
|
22
|
+
"optimisation",
|
|
23
|
+
"postcss",
|
|
24
|
+
"postcss-plugin"
|
|
25
|
+
],
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"cosmiconfig": "^7.0.0",
|
|
29
|
+
"cssnano-preset-default": "^5.0.0",
|
|
30
|
+
"is-resolvable": "^1.1.0",
|
|
31
|
+
"opencollective-postinstall": "^2.0.2"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/cssnano/cssnano",
|
|
34
|
+
"author": {
|
|
35
|
+
"name": "Ben Briggs",
|
|
36
|
+
"email": "beneb.info@gmail.com",
|
|
37
|
+
"url": "http://beneb.info"
|
|
38
|
+
},
|
|
39
|
+
"repository": "cssnano/cssnano",
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"LICENSE-MIT",
|
|
43
|
+
"quickstart.js"
|
|
44
|
+
],
|
|
45
|
+
"tonicExampleFilename": "quickstart.js",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/cssnano/cssnano/issues"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": "^10 || ^12 || >=14.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"autoprefixer": "^10.0.2",
|
|
54
|
+
"postcss": "^8.2.1"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"postcss": "^8.2.1"
|
|
58
|
+
},
|
|
59
|
+
"gitHead": "0e2c3bf5835bafcdc8783bef66f730a24194c8f3"
|
|
57
60
|
}
|
package/quickstart.js
CHANGED
|
@@ -23,9 +23,9 @@ h1 {
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
const postcssOpts = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
// from: 'app.css',
|
|
27
|
+
// to: 'app.min.css',
|
|
28
|
+
// map: {inline: true},
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
/*
|
|
@@ -35,13 +35,14 @@ const postcssOpts = {
|
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
const cssnanoOpts = {
|
|
38
|
-
|
|
38
|
+
preset: 'default',
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
/*
|
|
42
42
|
* Compress the CSS asynchronously and log it to the console.
|
|
43
43
|
*/
|
|
44
44
|
|
|
45
|
-
cssnano.process(css, postcssOpts, cssnanoOpts).then(result => {
|
|
46
|
-
|
|
45
|
+
cssnano.process(css, postcssOpts, cssnanoOpts).then((result) => {
|
|
46
|
+
// eslint-disable-next-line no-console
|
|
47
|
+
console.log(result.css);
|
|
47
48
|
});
|