@node-minify/clean-css 7.1.0 → 8.0.0-beta.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/dist/index.d.ts +18 -0
- package/dist/index.js +62 -0
- package/dist/index.mjs +34 -0
- package/package.json +22 -6
- package/lib/clean-css.js +0 -58
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MinifierOptions } from '@node-minify/types';
|
|
2
|
+
|
|
3
|
+
/*!
|
|
4
|
+
* node-minify
|
|
5
|
+
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
6
|
+
* MIT Licensed
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Run clean-css.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} settings
|
|
13
|
+
* @param {String} content
|
|
14
|
+
* @param {Function} callback
|
|
15
|
+
*/
|
|
16
|
+
declare const minifyCleanCSS: ({ settings, content, callback, index }: MinifierOptions) => any;
|
|
17
|
+
|
|
18
|
+
export { minifyCleanCSS as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
|
|
25
|
+
// src/index.ts
|
|
26
|
+
var src_exports = {};
|
|
27
|
+
__export(src_exports, {
|
|
28
|
+
default: () => src_default
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(src_exports);
|
|
31
|
+
var import_clean_css = __toESM(require("clean-css"));
|
|
32
|
+
var import_utils = require("@node-minify/utils");
|
|
33
|
+
var minifyCleanCSS = ({ settings, content, callback, index }) => {
|
|
34
|
+
if (settings && settings.options && settings.options.sourceMap) {
|
|
35
|
+
settings.options._sourceMap = settings.options.sourceMap;
|
|
36
|
+
settings.options.sourceMap = true;
|
|
37
|
+
}
|
|
38
|
+
const _cleanCSS = new import_clean_css.default(settings && settings.options).minify(content || "");
|
|
39
|
+
const contentMinified = _cleanCSS.styles;
|
|
40
|
+
if (_cleanCSS.sourceMap && settings && settings.options && settings.options._sourceMap) {
|
|
41
|
+
import_utils.utils.writeFile({
|
|
42
|
+
file: settings.options._sourceMap !== true && settings.options._sourceMap.url ? settings.options._sourceMap.url : null,
|
|
43
|
+
content: _cleanCSS.sourceMap.toString(),
|
|
44
|
+
index
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
if (settings && !settings.content) {
|
|
48
|
+
import_utils.utils.writeFile({ file: settings.output, content: contentMinified, index });
|
|
49
|
+
}
|
|
50
|
+
if (callback) {
|
|
51
|
+
return callback(null, contentMinified);
|
|
52
|
+
}
|
|
53
|
+
return contentMinified;
|
|
54
|
+
};
|
|
55
|
+
var src_default = minifyCleanCSS;
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {});
|
|
58
|
+
/*!
|
|
59
|
+
* node-minify
|
|
60
|
+
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
61
|
+
* MIT Licensed
|
|
62
|
+
*/
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import CleanCSS from "clean-css";
|
|
3
|
+
import { utils } from "@node-minify/utils";
|
|
4
|
+
var minifyCleanCSS = ({ settings, content, callback, index }) => {
|
|
5
|
+
if (settings && settings.options && settings.options.sourceMap) {
|
|
6
|
+
settings.options._sourceMap = settings.options.sourceMap;
|
|
7
|
+
settings.options.sourceMap = true;
|
|
8
|
+
}
|
|
9
|
+
const _cleanCSS = new CleanCSS(settings && settings.options).minify(content || "");
|
|
10
|
+
const contentMinified = _cleanCSS.styles;
|
|
11
|
+
if (_cleanCSS.sourceMap && settings && settings.options && settings.options._sourceMap) {
|
|
12
|
+
utils.writeFile({
|
|
13
|
+
file: settings.options._sourceMap !== true && settings.options._sourceMap.url ? settings.options._sourceMap.url : null,
|
|
14
|
+
content: _cleanCSS.sourceMap.toString(),
|
|
15
|
+
index
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
if (settings && !settings.content) {
|
|
19
|
+
utils.writeFile({ file: settings.output, content: contentMinified, index });
|
|
20
|
+
}
|
|
21
|
+
if (callback) {
|
|
22
|
+
return callback(null, contentMinified);
|
|
23
|
+
}
|
|
24
|
+
return contentMinified;
|
|
25
|
+
};
|
|
26
|
+
var src_default = minifyCleanCSS;
|
|
27
|
+
export {
|
|
28
|
+
src_default as default
|
|
29
|
+
};
|
|
30
|
+
/*!
|
|
31
|
+
* node-minify
|
|
32
|
+
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
33
|
+
* MIT Licensed
|
|
34
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-minify/clean-css",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-beta.0",
|
|
4
4
|
"description": "clean-css plugin for @node-minify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compressor",
|
|
@@ -11,16 +11,23 @@
|
|
|
11
11
|
"author": "Rodolphe Stoclin <srodolphe@gmail.com>",
|
|
12
12
|
"homepage": "https://github.com/srod/node-minify/tree/master/packages/clean-css#readme",
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"main": "lib/clean-css.js",
|
|
15
14
|
"engines": {
|
|
16
15
|
"node": ">=14.0.0"
|
|
17
16
|
},
|
|
18
17
|
"directories": {
|
|
19
|
-
"lib": "
|
|
18
|
+
"lib": "dist",
|
|
20
19
|
"test": "__tests__"
|
|
21
20
|
},
|
|
21
|
+
"main": "./dist/index.js",
|
|
22
|
+
"module": "./dist/index.mjs",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
"require": "./dist/index.js",
|
|
26
|
+
"import": "./dist/index.mjs",
|
|
27
|
+
"types": "./dist/index.d.ts"
|
|
28
|
+
},
|
|
22
29
|
"files": [
|
|
23
|
-
"
|
|
30
|
+
"dist/**/*"
|
|
24
31
|
],
|
|
25
32
|
"publishConfig": {
|
|
26
33
|
"access": "public"
|
|
@@ -32,9 +39,18 @@
|
|
|
32
39
|
"bugs": {
|
|
33
40
|
"url": "https://github.com/srod/node-minify/issues"
|
|
34
41
|
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"clean": "pnpm dlx rimraf dist",
|
|
44
|
+
"build": "npm run clean && tsup src/index.ts --format cjs,esm --dts --clean",
|
|
45
|
+
"prepublishOnly": "npm run build"
|
|
46
|
+
},
|
|
35
47
|
"dependencies": {
|
|
36
|
-
"@node-minify/utils": "
|
|
48
|
+
"@node-minify/utils": "8.0.0-beta.0",
|
|
37
49
|
"clean-css": "5.3.1"
|
|
38
50
|
},
|
|
39
|
-
"
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@node-minify/types": "8.0.0-beta.0",
|
|
53
|
+
"@types/clean-css": "^4.2.6"
|
|
54
|
+
},
|
|
55
|
+
"gitHead": "0507c6190577e1939997a8231b07952ba167a780"
|
|
40
56
|
}
|
package/lib/clean-css.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _cleanCss = _interopRequireDefault(require("clean-css"));
|
|
4
|
-
var _utils = require("@node-minify/utils");
|
|
5
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
|
-
/*!
|
|
7
|
-
* node-minify
|
|
8
|
-
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
9
|
-
* MIT Licensed
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Module dependencies.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Run clean-css.
|
|
18
|
-
*
|
|
19
|
-
* @param {Object} settings
|
|
20
|
-
* @param {String} content
|
|
21
|
-
* @param {Function} callback
|
|
22
|
-
*/
|
|
23
|
-
const minifyCleanCSS = ({
|
|
24
|
-
settings,
|
|
25
|
-
content,
|
|
26
|
-
callback,
|
|
27
|
-
index
|
|
28
|
-
}) => {
|
|
29
|
-
if (settings.options.sourceMap) {
|
|
30
|
-
settings.options._sourceMap = settings.options.sourceMap;
|
|
31
|
-
settings.options.sourceMap = true;
|
|
32
|
-
}
|
|
33
|
-
const _cleanCSS = new _cleanCss.default(settings.options).minify(content);
|
|
34
|
-
const contentMinified = _cleanCSS.styles;
|
|
35
|
-
if (_cleanCSS.sourceMap && settings.options._sourceMap) {
|
|
36
|
-
_utils.utils.writeFile({
|
|
37
|
-
file: settings.options._sourceMap.url,
|
|
38
|
-
content: _cleanCSS.sourceMap.toString(),
|
|
39
|
-
index
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
if (!settings.content) {
|
|
43
|
-
_utils.utils.writeFile({
|
|
44
|
-
file: settings.output,
|
|
45
|
-
content: contentMinified,
|
|
46
|
-
index
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
if (callback) {
|
|
50
|
-
return callback(null, contentMinified);
|
|
51
|
-
}
|
|
52
|
-
return contentMinified;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Expose `minifyCleanCSS()`.
|
|
57
|
-
*/
|
|
58
|
-
module.exports = minifyCleanCSS;
|