cssnano 5.0.12 → 5.0.16
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/dist/index.js +19 -6
- package/package.json +58 -57
package/dist/index.js
CHANGED
|
@@ -13,11 +13,23 @@ var _yaml = _interopRequireDefault(require("yaml"));
|
|
|
13
13
|
|
|
14
14
|
var _lilconfig = require("lilconfig");
|
|
15
15
|
|
|
16
|
-
var _isResolvable = _interopRequireDefault(require("is-resolvable"));
|
|
17
|
-
|
|
18
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
17
|
|
|
20
18
|
const cssnano = 'cssnano';
|
|
19
|
+
/*
|
|
20
|
+
* @param {string} moduleId
|
|
21
|
+
* @returns {boolean}
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
function isResolvable(moduleId) {
|
|
25
|
+
try {
|
|
26
|
+
require.resolve(moduleId);
|
|
27
|
+
|
|
28
|
+
return true;
|
|
29
|
+
} catch (e) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
21
33
|
/*
|
|
22
34
|
* preset can be one of four possibilities:
|
|
23
35
|
* preset = 'default'
|
|
@@ -26,6 +38,7 @@ const cssnano = 'cssnano';
|
|
|
26
38
|
* preset = {plugins: []} <- already invoked function
|
|
27
39
|
*/
|
|
28
40
|
|
|
41
|
+
|
|
29
42
|
function resolvePreset(preset) {
|
|
30
43
|
let fn, options;
|
|
31
44
|
|
|
@@ -53,13 +66,13 @@ function resolvePreset(preset) {
|
|
|
53
66
|
} // Try loading a preset from node_modules
|
|
54
67
|
|
|
55
68
|
|
|
56
|
-
if ((
|
|
69
|
+
if (isResolvable(fn)) {
|
|
57
70
|
return require(fn)(options).plugins;
|
|
58
71
|
}
|
|
59
72
|
|
|
60
73
|
const sugar = `cssnano-preset-${fn}`; // Try loading a preset from node_modules (sugar)
|
|
61
74
|
|
|
62
|
-
if ((
|
|
75
|
+
if (isResolvable(sugar)) {
|
|
63
76
|
return require(sugar)(options).plugins;
|
|
64
77
|
} // If all else fails, we probably have a typo in the config somewhere
|
|
65
78
|
|
|
@@ -114,12 +127,12 @@ const cssnanoPlugin = (options = {}) => {
|
|
|
114
127
|
if (Array.isArray(plugin)) {
|
|
115
128
|
const [pluginDef, opts = {}] = plugin;
|
|
116
129
|
|
|
117
|
-
if (typeof pluginDef === 'string' && (
|
|
130
|
+
if (typeof pluginDef === 'string' && isResolvable(pluginDef)) {
|
|
118
131
|
options.preset.plugins.push([require(pluginDef), opts]);
|
|
119
132
|
} else {
|
|
120
133
|
options.preset.plugins.push([pluginDef, opts]);
|
|
121
134
|
}
|
|
122
|
-
} else if (typeof plugin === 'string' && (
|
|
135
|
+
} else if (typeof plugin === 'string' && isResolvable(plugin)) {
|
|
123
136
|
options.preset.plugins.push([require(plugin), {}]);
|
|
124
137
|
} else {
|
|
125
138
|
options.preset.plugins.push([plugin, {}]);
|
package/package.json
CHANGED
|
@@ -1,58 +1,59 @@
|
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
2
|
+
"name": "cssnano",
|
|
3
|
+
"version": "5.0.16",
|
|
4
|
+
"description": "A modular minifier, built on top of the PostCSS ecosystem.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"funding": {
|
|
7
|
+
"type": "opencollective",
|
|
8
|
+
"url": "https://opencollective.com/cssnano"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"css",
|
|
12
|
+
"compress",
|
|
13
|
+
"minify",
|
|
14
|
+
"optimise",
|
|
15
|
+
"optimisation",
|
|
16
|
+
"postcss",
|
|
17
|
+
"postcss-plugin"
|
|
18
|
+
],
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"cssnano-preset-default": "^5.1.11",
|
|
22
|
+
"lilconfig": "^2.0.3",
|
|
23
|
+
"yaml": "^1.10.2"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/cssnano/cssnano",
|
|
26
|
+
"author": {
|
|
27
|
+
"name": "Ben Briggs",
|
|
28
|
+
"email": "beneb.info@gmail.com",
|
|
29
|
+
"url": "http://beneb.info"
|
|
30
|
+
},
|
|
31
|
+
"repository": "cssnano/cssnano",
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"LICENSE-MIT",
|
|
35
|
+
"quickstart.js"
|
|
36
|
+
],
|
|
37
|
+
"tonicExampleFilename": "quickstart.js",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/cssnano/cssnano/issues"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": "^10 || ^12 || >=14.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"autoprefixer": "^10.3.7",
|
|
46
|
+
"cssnano-preset-advanced": "^5.1.11",
|
|
47
|
+
"cssnano-preset-lite": "^2.0.2",
|
|
48
|
+
"postcss": "^8.2.15"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"postcss": "^8.2.15"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"bundle-size": "webpack --json --config src/__tests__/_webpack.config.js | webpack-bundle-size-analyzer",
|
|
55
|
+
"prebuild": "rimraf dist",
|
|
56
|
+
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\""
|
|
57
|
+
},
|
|
58
|
+
"readme": "# cssnano\n\nFor documentation, please see the following links:\n\n* Repository: https://github.com/cssnano/cssnano\n* Website: http://cssnano.co\n"
|
|
59
|
+
}
|