@node-minify/clean-css 8.0.6 → 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/LICENSE +1 -1
- package/dist/index.d.mts +14 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -16
package/LICENSE
CHANGED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MinifierOptions } from '@node-minify/types';
|
|
2
|
+
|
|
3
|
+
/*!
|
|
4
|
+
* node-minify
|
|
5
|
+
* Copyright(c) 2011-2024 Rodolphe Stoclin
|
|
6
|
+
* MIT Licensed
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
declare const minifyCleanCSS: {
|
|
10
|
+
({ settings, content, callback, index, }: MinifierOptions): string | void;
|
|
11
|
+
default: any;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { minifyCleanCSS as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { MinifierOptions } from '@node-minify/types';
|
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
4
|
* node-minify
|
|
5
|
-
* Copyright(c) 2011-
|
|
5
|
+
* Copyright(c) 2011-2024 Rodolphe Stoclin
|
|
6
6
|
* MIT Licensed
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
declare const minifyCleanCSS: {
|
|
10
|
-
({ settings, content, callback, index }: MinifierOptions): string | void;
|
|
10
|
+
({ settings, content, callback, index, }: MinifierOptions): string | void;
|
|
11
11
|
default: any;
|
|
12
12
|
};
|
|
13
13
|
|
package/dist/index.js
CHANGED
|
@@ -23,16 +23,23 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
));
|
|
24
24
|
|
|
25
25
|
// src/index.ts
|
|
26
|
-
var import_clean_css = __toESM(require("clean-css"));
|
|
27
26
|
var import_utils = require("@node-minify/utils");
|
|
28
|
-
var
|
|
27
|
+
var import_clean_css = __toESM(require("clean-css"));
|
|
28
|
+
var minifyCleanCSS = ({
|
|
29
|
+
settings,
|
|
30
|
+
content,
|
|
31
|
+
callback,
|
|
32
|
+
index
|
|
33
|
+
}) => {
|
|
29
34
|
if (settings?.options?.sourceMap) {
|
|
30
35
|
settings.options._sourceMap = settings.options.sourceMap;
|
|
31
36
|
settings.options.sourceMap = true;
|
|
32
37
|
}
|
|
33
|
-
const _cleanCSS = new import_clean_css.default(
|
|
38
|
+
const _cleanCSS = new import_clean_css.default(
|
|
39
|
+
settings && { returnPromise: false, ...settings.options }
|
|
40
|
+
).minify(content ?? "");
|
|
34
41
|
const contentMinified = _cleanCSS.styles;
|
|
35
|
-
if (_cleanCSS.sourceMap && typeof settings?.options?._sourceMap === "object") {
|
|
42
|
+
if (_cleanCSS.sourceMap && typeof settings?.options?._sourceMap === "object" && "url" in settings.options._sourceMap) {
|
|
36
43
|
import_utils.utils.writeFile({
|
|
37
44
|
file: typeof settings.options._sourceMap.url === "string" ? settings.options._sourceMap.url : "",
|
|
38
45
|
content: _cleanCSS.sourceMap.toString(),
|
|
@@ -40,7 +47,11 @@ var minifyCleanCSS = ({ settings, content, callback, index }) => {
|
|
|
40
47
|
});
|
|
41
48
|
}
|
|
42
49
|
if (settings && !settings.content && settings.output) {
|
|
43
|
-
settings.output && import_utils.utils.writeFile({
|
|
50
|
+
settings.output && import_utils.utils.writeFile({
|
|
51
|
+
file: settings.output,
|
|
52
|
+
content: contentMinified,
|
|
53
|
+
index
|
|
54
|
+
});
|
|
44
55
|
}
|
|
45
56
|
if (callback) {
|
|
46
57
|
return callback(null, contentMinified);
|
|
@@ -51,7 +62,7 @@ minifyCleanCSS.default = minifyCleanCSS;
|
|
|
51
62
|
module.exports = minifyCleanCSS;
|
|
52
63
|
/*!
|
|
53
64
|
* node-minify
|
|
54
|
-
* Copyright(c) 2011-
|
|
65
|
+
* Copyright(c) 2011-2024 Rodolphe Stoclin
|
|
55
66
|
* MIT Licensed
|
|
56
67
|
*/
|
|
57
68
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2024 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { MinifierOptions } from \"@node-minify/types\";\nimport { utils } from \"@node-minify/utils\";\nimport CleanCSS from \"clean-css\";\n\n// type OptionsPossibleCleanCSS = string | boolean | Record<string, string> | { url: string };\n\n// type OptionsCleanCSS = {\n// // _sourceMap: boolean | { url: string };\n// // sourceMap: boolean | { url: string };\n// [Key: string]: OptionsPossibleCleanCSS | Record<string, OptionsPossibleCleanCSS>;\n// };\n\n// type SettingsCleanCSS = {\n// options: OptionsCleanCSS;\n// };\n\n// type MinifierOptionsCleanCSS = {\n// settings: SettingsCleanCSS;\n// };\n\n/**\n * Run clean-css.\n * @param settings Clean-css options\n * @param content Content to minify\n * @param callback Callback\n * @param index Index of current file in array\n * @returns Minified content\n */\nconst minifyCleanCSS = ({\n settings,\n content,\n callback,\n index,\n}: MinifierOptions) => {\n if (settings?.options?.sourceMap) {\n settings.options._sourceMap = settings.options.sourceMap;\n settings.options.sourceMap = true;\n }\n const _cleanCSS = new CleanCSS(\n settings && { returnPromise: false, ...settings.options }\n ).minify(content ?? \"\");\n const contentMinified = _cleanCSS.styles;\n if (\n _cleanCSS.sourceMap &&\n typeof settings?.options?._sourceMap === \"object\" &&\n \"url\" in settings.options._sourceMap\n ) {\n utils.writeFile({\n file:\n typeof settings.options._sourceMap.url === \"string\"\n ? settings.options._sourceMap.url\n : \"\",\n content: _cleanCSS.sourceMap.toString(),\n index,\n });\n }\n if (settings && !settings.content && settings.output) {\n settings.output &&\n utils.writeFile({\n file: settings.output,\n content: contentMinified,\n index,\n });\n }\n if (callback) {\n return callback(null, contentMinified);\n }\n return contentMinified;\n};\n\n/**\n * Expose `minifyCleanCSS()`.\n */\nminifyCleanCSS.default = minifyCleanCSS;\nexport = minifyCleanCSS;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAUA,mBAAsB;AACtB,uBAAqB;AA0BrB,IAAM,iBAAiB,CAAC;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,MAAuB;AACnB,MAAI,UAAU,SAAS,WAAW;AAC9B,aAAS,QAAQ,aAAa,SAAS,QAAQ;AAC/C,aAAS,QAAQ,YAAY;AAAA,EACjC;AACA,QAAM,YAAY,IAAI,iBAAAA;AAAA,IAClB,YAAY,EAAE,eAAe,OAAO,GAAG,SAAS,QAAQ;AAAA,EAC5D,EAAE,OAAO,WAAW,EAAE;AACtB,QAAM,kBAAkB,UAAU;AAClC,MACI,UAAU,aACV,OAAO,UAAU,SAAS,eAAe,YACzC,SAAS,SAAS,QAAQ,YAC5B;AACE,uBAAM,UAAU;AAAA,MACZ,MACI,OAAO,SAAS,QAAQ,WAAW,QAAQ,WACrC,SAAS,QAAQ,WAAW,MAC5B;AAAA,MACV,SAAS,UAAU,UAAU,SAAS;AAAA,MACtC;AAAA,IACJ,CAAC;AAAA,EACL;AACA,MAAI,YAAY,CAAC,SAAS,WAAW,SAAS,QAAQ;AAClD,aAAS,UACL,mBAAM,UAAU;AAAA,MACZ,MAAM,SAAS;AAAA,MACf,SAAS;AAAA,MACT;AAAA,IACJ,CAAC;AAAA,EACT;AACA,MAAI,UAAU;AACV,WAAO,SAAS,MAAM,eAAe;AAAA,EACzC;AACA,SAAO;AACX;AAKA,eAAe,UAAU;AACzB,iBAAS;","names":["CleanCSS"]}
|
package/dist/index.mjs
CHANGED
|
@@ -4,18 +4,25 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
// src/index.ts
|
|
7
|
-
import CleanCSS from "clean-css";
|
|
8
7
|
import { utils } from "@node-minify/utils";
|
|
8
|
+
import CleanCSS from "clean-css";
|
|
9
9
|
var require_src = __commonJS({
|
|
10
10
|
"src/index.ts"(exports, module) {
|
|
11
|
-
var minifyCleanCSS = ({
|
|
11
|
+
var minifyCleanCSS = ({
|
|
12
|
+
settings,
|
|
13
|
+
content,
|
|
14
|
+
callback,
|
|
15
|
+
index
|
|
16
|
+
}) => {
|
|
12
17
|
if (settings?.options?.sourceMap) {
|
|
13
18
|
settings.options._sourceMap = settings.options.sourceMap;
|
|
14
19
|
settings.options.sourceMap = true;
|
|
15
20
|
}
|
|
16
|
-
const _cleanCSS = new CleanCSS(
|
|
21
|
+
const _cleanCSS = new CleanCSS(
|
|
22
|
+
settings && { returnPromise: false, ...settings.options }
|
|
23
|
+
).minify(content ?? "");
|
|
17
24
|
const contentMinified = _cleanCSS.styles;
|
|
18
|
-
if (_cleanCSS.sourceMap && typeof settings?.options?._sourceMap === "object") {
|
|
25
|
+
if (_cleanCSS.sourceMap && typeof settings?.options?._sourceMap === "object" && "url" in settings.options._sourceMap) {
|
|
19
26
|
utils.writeFile({
|
|
20
27
|
file: typeof settings.options._sourceMap.url === "string" ? settings.options._sourceMap.url : "",
|
|
21
28
|
content: _cleanCSS.sourceMap.toString(),
|
|
@@ -23,7 +30,11 @@ var require_src = __commonJS({
|
|
|
23
30
|
});
|
|
24
31
|
}
|
|
25
32
|
if (settings && !settings.content && settings.output) {
|
|
26
|
-
settings.output && utils.writeFile({
|
|
33
|
+
settings.output && utils.writeFile({
|
|
34
|
+
file: settings.output,
|
|
35
|
+
content: contentMinified,
|
|
36
|
+
index
|
|
37
|
+
});
|
|
27
38
|
}
|
|
28
39
|
if (callback) {
|
|
29
40
|
return callback(null, contentMinified);
|
|
@@ -37,7 +48,7 @@ var require_src = __commonJS({
|
|
|
37
48
|
export default require_src();
|
|
38
49
|
/*!
|
|
39
50
|
* node-minify
|
|
40
|
-
* Copyright(c) 2011-
|
|
51
|
+
* Copyright(c) 2011-2024 Rodolphe Stoclin
|
|
41
52
|
* MIT Licensed
|
|
42
53
|
*/
|
|
43
54
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2024 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { MinifierOptions } from \"@node-minify/types\";\nimport { utils } from \"@node-minify/utils\";\nimport CleanCSS from \"clean-css\";\n\n// type OptionsPossibleCleanCSS = string | boolean | Record<string, string> | { url: string };\n\n// type OptionsCleanCSS = {\n// // _sourceMap: boolean | { url: string };\n// // sourceMap: boolean | { url: string };\n// [Key: string]: OptionsPossibleCleanCSS | Record<string, OptionsPossibleCleanCSS>;\n// };\n\n// type SettingsCleanCSS = {\n// options: OptionsCleanCSS;\n// };\n\n// type MinifierOptionsCleanCSS = {\n// settings: SettingsCleanCSS;\n// };\n\n/**\n * Run clean-css.\n * @param settings Clean-css options\n * @param content Content to minify\n * @param callback Callback\n * @param index Index of current file in array\n * @returns Minified content\n */\nconst minifyCleanCSS = ({\n settings,\n content,\n callback,\n index,\n}: MinifierOptions) => {\n if (settings?.options?.sourceMap) {\n settings.options._sourceMap = settings.options.sourceMap;\n settings.options.sourceMap = true;\n }\n const _cleanCSS = new CleanCSS(\n settings && { returnPromise: false, ...settings.options }\n ).minify(content ?? \"\");\n const contentMinified = _cleanCSS.styles;\n if (\n _cleanCSS.sourceMap &&\n typeof settings?.options?._sourceMap === \"object\" &&\n \"url\" in settings.options._sourceMap\n ) {\n utils.writeFile({\n file:\n typeof settings.options._sourceMap.url === \"string\"\n ? settings.options._sourceMap.url\n : \"\",\n content: _cleanCSS.sourceMap.toString(),\n index,\n });\n }\n if (settings && !settings.content && settings.output) {\n settings.output &&\n utils.writeFile({\n file: settings.output,\n content: contentMinified,\n index,\n });\n }\n if (callback) {\n return callback(null, contentMinified);\n }\n return contentMinified;\n};\n\n/**\n * Expose `minifyCleanCSS()`.\n */\nminifyCleanCSS.default = minifyCleanCSS;\nexport = minifyCleanCSS;\n"],"mappings":";;;;;;AAUA,SAAS,aAAa;AACtB,OAAO,cAAc;AAXrB;AAAA;AAqCA,QAAM,iBAAiB,CAAC;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,MAAuB;AACnB,UAAI,UAAU,SAAS,WAAW;AAC9B,iBAAS,QAAQ,aAAa,SAAS,QAAQ;AAC/C,iBAAS,QAAQ,YAAY;AAAA,MACjC;AACA,YAAM,YAAY,IAAI;AAAA,QAClB,YAAY,EAAE,eAAe,OAAO,GAAG,SAAS,QAAQ;AAAA,MAC5D,EAAE,OAAO,WAAW,EAAE;AACtB,YAAM,kBAAkB,UAAU;AAClC,UACI,UAAU,aACV,OAAO,UAAU,SAAS,eAAe,YACzC,SAAS,SAAS,QAAQ,YAC5B;AACE,cAAM,UAAU;AAAA,UACZ,MACI,OAAO,SAAS,QAAQ,WAAW,QAAQ,WACrC,SAAS,QAAQ,WAAW,MAC5B;AAAA,UACV,SAAS,UAAU,UAAU,SAAS;AAAA,UACtC;AAAA,QACJ,CAAC;AAAA,MACL;AACA,UAAI,YAAY,CAAC,SAAS,WAAW,SAAS,QAAQ;AAClD,iBAAS,UACL,MAAM,UAAU;AAAA,UACZ,MAAM,SAAS;AAAA,UACf,SAAS;AAAA,UACT;AAAA,QACJ,CAAC;AAAA,MACT;AACA,UAAI,UAAU;AACV,eAAO,SAAS,MAAM,eAAe;AAAA,MACzC;AACA,aAAO;AAAA,IACX;AAKA,mBAAe,UAAU;AACzB,qBAAS;AAAA;AAAA;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-minify/clean-css",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "clean-css plugin for @node-minify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compressor",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"homepage": "https://github.com/srod/node-minify/tree/master/packages/clean-css#readme",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"engines": {
|
|
15
|
-
"node": ">=
|
|
15
|
+
"node": ">=18.0.0"
|
|
16
16
|
},
|
|
17
17
|
"directories": {
|
|
18
18
|
"lib": "dist",
|
|
@@ -22,9 +22,11 @@
|
|
|
22
22
|
"module": "./dist/index.mjs",
|
|
23
23
|
"types": "./dist/index.d.ts",
|
|
24
24
|
"exports": {
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.mjs",
|
|
28
|
+
"require": "./dist/index.cjs"
|
|
29
|
+
}
|
|
28
30
|
},
|
|
29
31
|
"files": [
|
|
30
32
|
"dist/**/*"
|
|
@@ -39,18 +41,20 @@
|
|
|
39
41
|
"bugs": {
|
|
40
42
|
"url": "https://github.com/srod/node-minify/issues"
|
|
41
43
|
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"clean": "pnpm dlx rimraf dist",
|
|
44
|
-
"build": "pnpm clean && tsup src/index.ts --format cjs,esm --dts --clean --sourcemap",
|
|
45
|
-
"prepublishOnly": "pnpm build"
|
|
46
|
-
},
|
|
47
44
|
"dependencies": {
|
|
48
|
-
"
|
|
49
|
-
"
|
|
45
|
+
"clean-css": "5.3.3",
|
|
46
|
+
"@node-minify/utils": "9.0.0"
|
|
50
47
|
},
|
|
51
48
|
"devDependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@types
|
|
49
|
+
"@types/clean-css": "^4.2.6",
|
|
50
|
+
"@node-minify/types": "9.0.0"
|
|
54
51
|
},
|
|
55
|
-
"
|
|
56
|
-
|
|
52
|
+
"scripts": {
|
|
53
|
+
"clean": "pnpm dlx rimraf dist",
|
|
54
|
+
"build": "pnpm clean && tsup src/index.ts --format cjs,esm --dts --clean --sourcemap",
|
|
55
|
+
"lint": "biome lint .",
|
|
56
|
+
"test": "vitest run",
|
|
57
|
+
"test:ci": "vitest run --coverage",
|
|
58
|
+
"test:watch": "vitest"
|
|
59
|
+
}
|
|
60
|
+
}
|