@node-minify/csso 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 +44 -0
- package/dist/index.mjs +22 -0
- package/package.json +22 -6
- package/lib/csso.js +0 -46
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 csso.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} settings
|
|
13
|
+
* @param {String} content
|
|
14
|
+
* @param {Function} callback
|
|
15
|
+
*/
|
|
16
|
+
declare const minifyCSSO: ({ settings, content, callback, index }: MinifierOptions) => any;
|
|
17
|
+
|
|
18
|
+
export { minifyCSSO as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/index.ts
|
|
20
|
+
var src_exports = {};
|
|
21
|
+
__export(src_exports, {
|
|
22
|
+
default: () => src_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(src_exports);
|
|
25
|
+
var import_csso = require("csso");
|
|
26
|
+
var import_utils = require("@node-minify/utils");
|
|
27
|
+
var minifyCSSO = ({ settings, content, callback, index }) => {
|
|
28
|
+
const contentMinified = (0, import_csso.minify)(content || "", settings && settings.options);
|
|
29
|
+
if (settings && !settings.content) {
|
|
30
|
+
import_utils.utils.writeFile({ file: settings.output, content: contentMinified.css, index });
|
|
31
|
+
}
|
|
32
|
+
if (callback) {
|
|
33
|
+
return callback(null, contentMinified.css);
|
|
34
|
+
}
|
|
35
|
+
return contentMinified.css;
|
|
36
|
+
};
|
|
37
|
+
var src_default = minifyCSSO;
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {});
|
|
40
|
+
/*!
|
|
41
|
+
* node-minify
|
|
42
|
+
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
43
|
+
* MIT Licensed
|
|
44
|
+
*/
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { minify } from "csso";
|
|
3
|
+
import { utils } from "@node-minify/utils";
|
|
4
|
+
var minifyCSSO = ({ settings, content, callback, index }) => {
|
|
5
|
+
const contentMinified = minify(content || "", settings && settings.options);
|
|
6
|
+
if (settings && !settings.content) {
|
|
7
|
+
utils.writeFile({ file: settings.output, content: contentMinified.css, index });
|
|
8
|
+
}
|
|
9
|
+
if (callback) {
|
|
10
|
+
return callback(null, contentMinified.css);
|
|
11
|
+
}
|
|
12
|
+
return contentMinified.css;
|
|
13
|
+
};
|
|
14
|
+
var src_default = minifyCSSO;
|
|
15
|
+
export {
|
|
16
|
+
src_default as default
|
|
17
|
+
};
|
|
18
|
+
/*!
|
|
19
|
+
* node-minify
|
|
20
|
+
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
21
|
+
* MIT Licensed
|
|
22
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-minify/csso",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-beta.0",
|
|
4
4
|
"description": "csso 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/csso#readme",
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"main": "lib/csso.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
|
"csso": "5.0.5"
|
|
38
50
|
},
|
|
39
|
-
"
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@node-minify/types": "8.0.0-beta.0",
|
|
53
|
+
"@types/csso": "^5.0.0"
|
|
54
|
+
},
|
|
55
|
+
"gitHead": "0507c6190577e1939997a8231b07952ba167a780"
|
|
40
56
|
}
|
package/lib/csso.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _csso = _interopRequireDefault(require("csso"));
|
|
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 csso.
|
|
18
|
-
*
|
|
19
|
-
* @param {Object} settings
|
|
20
|
-
* @param {String} content
|
|
21
|
-
* @param {Function} callback
|
|
22
|
-
*/
|
|
23
|
-
const minifyCSSO = ({
|
|
24
|
-
settings,
|
|
25
|
-
content,
|
|
26
|
-
callback,
|
|
27
|
-
index
|
|
28
|
-
}) => {
|
|
29
|
-
const contentMinified = _csso.default.minify(content, settings.options.restructureOff);
|
|
30
|
-
if (!settings.content) {
|
|
31
|
-
_utils.utils.writeFile({
|
|
32
|
-
file: settings.output,
|
|
33
|
-
content: contentMinified.css,
|
|
34
|
-
index
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
if (callback) {
|
|
38
|
-
return callback(null, contentMinified.css);
|
|
39
|
-
}
|
|
40
|
-
return contentMinified.css;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Expose `minifyCSSO()`.
|
|
45
|
-
*/
|
|
46
|
-
module.exports = minifyCSSO;
|