@node-minify/clean-css 9.0.0 → 10.0.0-next.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.cjs ADDED
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ default: () => src_default
34
+ });
35
+ module.exports = __toCommonJS(src_exports);
36
+ var import_utils = require("@node-minify/utils");
37
+ var import_clean_css = __toESM(require("clean-css"), 1);
38
+ var minifyCleanCSS = ({
39
+ settings,
40
+ content,
41
+ callback,
42
+ index
43
+ }) => {
44
+ if (settings?.options?.sourceMap) {
45
+ settings.options._sourceMap = settings.options.sourceMap;
46
+ settings.options.sourceMap = true;
47
+ }
48
+ const _cleanCSS = new import_clean_css.default(
49
+ settings && { returnPromise: false, ...settings.options }
50
+ ).minify(content ?? "");
51
+ const contentMinified = _cleanCSS.styles;
52
+ if (_cleanCSS.sourceMap && typeof settings?.options?._sourceMap === "object" && "url" in settings.options._sourceMap) {
53
+ import_utils.utils.writeFile({
54
+ file: typeof settings.options._sourceMap.url === "string" ? settings.options._sourceMap.url : "",
55
+ content: _cleanCSS.sourceMap.toString(),
56
+ index
57
+ });
58
+ }
59
+ if (settings && !settings.content && settings.output) {
60
+ settings.output && import_utils.utils.writeFile({
61
+ file: settings.output,
62
+ content: contentMinified,
63
+ index
64
+ });
65
+ }
66
+ if (callback) {
67
+ return callback(null, contentMinified);
68
+ }
69
+ return contentMinified;
70
+ };
71
+ minifyCleanCSS.default = minifyCleanCSS;
72
+ var src_default = minifyCleanCSS;
73
+ /*!
74
+ * node-minify
75
+ * Copyright(c) 2011-2024 Rodolphe Stoclin
76
+ * MIT Licensed
77
+ */
78
+
79
+ // fix-cjs-exports
80
+ if (module.exports.default) {
81
+ Object.assign(module.exports.default, module.exports);
82
+ module.exports = module.exports.default;
83
+ delete module.exports.default;
84
+ }
@@ -12,3 +12,4 @@ declare const minifyCleanCSS: {
12
12
  };
13
13
 
14
14
  export { minifyCleanCSS as default };
15
+ export = minifyCleanCSS
package/dist/index.d.ts CHANGED
@@ -12,3 +12,4 @@ declare const minifyCleanCSS: {
12
12
  };
13
13
 
14
14
  export { minifyCleanCSS as default };
15
+ export = minifyCleanCSS
package/dist/index.js CHANGED
@@ -1,30 +1,6 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
-
25
1
  // src/index.ts
26
- var import_utils = require("@node-minify/utils");
27
- var import_clean_css = __toESM(require("clean-css"));
2
+ import { utils } from "@node-minify/utils";
3
+ import CleanCSS from "clean-css";
28
4
  var minifyCleanCSS = ({
29
5
  settings,
30
6
  content,
@@ -35,19 +11,19 @@ var minifyCleanCSS = ({
35
11
  settings.options._sourceMap = settings.options.sourceMap;
36
12
  settings.options.sourceMap = true;
37
13
  }
38
- const _cleanCSS = new import_clean_css.default(
14
+ const _cleanCSS = new CleanCSS(
39
15
  settings && { returnPromise: false, ...settings.options }
40
16
  ).minify(content ?? "");
41
17
  const contentMinified = _cleanCSS.styles;
42
18
  if (_cleanCSS.sourceMap && typeof settings?.options?._sourceMap === "object" && "url" in settings.options._sourceMap) {
43
- import_utils.utils.writeFile({
19
+ utils.writeFile({
44
20
  file: typeof settings.options._sourceMap.url === "string" ? settings.options._sourceMap.url : "",
45
21
  content: _cleanCSS.sourceMap.toString(),
46
22
  index
47
23
  });
48
24
  }
49
25
  if (settings && !settings.content && settings.output) {
50
- settings.output && import_utils.utils.writeFile({
26
+ settings.output && utils.writeFile({
51
27
  file: settings.output,
52
28
  content: contentMinified,
53
29
  index
@@ -59,10 +35,12 @@ var minifyCleanCSS = ({
59
35
  return contentMinified;
60
36
  };
61
37
  minifyCleanCSS.default = minifyCleanCSS;
62
- module.exports = minifyCleanCSS;
38
+ var src_default = minifyCleanCSS;
39
+ export {
40
+ src_default as default
41
+ };
63
42
  /*!
64
43
  * node-minify
65
44
  * Copyright(c) 2011-2024 Rodolphe Stoclin
66
45
  * MIT Licensed
67
46
  */
68
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/clean-css",
3
- "version": "9.0.0",
3
+ "version": "10.0.0-next.0",
4
4
  "description": "clean-css plugin for @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
@@ -9,22 +9,22 @@
9
9
  "clean-css"
10
10
  ],
11
11
  "author": "Rodolphe Stoclin <srodolphe@gmail.com>",
12
- "homepage": "https://github.com/srod/node-minify/tree/master/packages/clean-css#readme",
12
+ "homepage": "https://github.com/srod/node-minify/tree/main/packages/clean-css#readme",
13
13
  "license": "MIT",
14
+ "type": "module",
14
15
  "engines": {
15
- "node": ">=18.0.0"
16
+ "node": ">=22.0.0"
16
17
  },
17
18
  "directories": {
18
19
  "lib": "dist",
19
20
  "test": "__tests__"
20
21
  },
21
- "main": "./dist/index.js",
22
- "module": "./dist/index.mjs",
23
- "types": "./dist/index.d.ts",
22
+ "main": "./dist/index.cjs",
23
+ "module": "./dist/index.js",
24
24
  "exports": {
25
+ "./package.json": "./package.json",
25
26
  ".": {
26
- "types": "./dist/index.d.ts",
27
- "import": "./dist/index.mjs",
27
+ "import": "./dist/index.js",
28
28
  "require": "./dist/index.cjs"
29
29
  }
30
30
  },
@@ -41,20 +41,22 @@
41
41
  "bugs": {
42
42
  "url": "https://github.com/srod/node-minify/issues"
43
43
  },
44
- "dependencies": {
45
- "clean-css": "5.3.3",
46
- "@node-minify/utils": "9.0.0"
47
- },
48
- "devDependencies": {
49
- "@types/clean-css": "^4.2.6",
50
- "@node-minify/types": "9.0.0"
51
- },
52
44
  "scripts": {
53
- "clean": "pnpm dlx rimraf dist",
54
- "build": "pnpm clean && tsup src/index.ts --format cjs,esm --dts --clean --sourcemap",
45
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean && bunx fix-tsup-cjs",
46
+ "check-exports": "attw --pack .",
47
+ "format:check": "biome check .",
55
48
  "lint": "biome lint .",
49
+ "prepublishOnly": "bun run build",
56
50
  "test": "vitest run",
57
51
  "test:ci": "vitest run --coverage",
58
52
  "test:watch": "vitest"
53
+ },
54
+ "dependencies": {
55
+ "@node-minify/utils": "workspace:*",
56
+ "clean-css": "5.3.3"
57
+ },
58
+ "devDependencies": {
59
+ "@node-minify/types": "workspace:*",
60
+ "@types/clean-css": "^4.2.11"
59
61
  }
60
- }
62
+ }
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
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 DELETED
@@ -1,54 +0,0 @@
1
- var __getOwnPropNames = Object.getOwnPropertyNames;
2
- var __commonJS = (cb, mod) => function __require() {
3
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
- };
5
-
6
- // src/index.ts
7
- import { utils } from "@node-minify/utils";
8
- import CleanCSS from "clean-css";
9
- var require_src = __commonJS({
10
- "src/index.ts"(exports, module) {
11
- var minifyCleanCSS = ({
12
- settings,
13
- content,
14
- callback,
15
- index
16
- }) => {
17
- if (settings?.options?.sourceMap) {
18
- settings.options._sourceMap = settings.options.sourceMap;
19
- settings.options.sourceMap = true;
20
- }
21
- const _cleanCSS = new CleanCSS(
22
- settings && { returnPromise: false, ...settings.options }
23
- ).minify(content ?? "");
24
- const contentMinified = _cleanCSS.styles;
25
- if (_cleanCSS.sourceMap && typeof settings?.options?._sourceMap === "object" && "url" in settings.options._sourceMap) {
26
- utils.writeFile({
27
- file: typeof settings.options._sourceMap.url === "string" ? settings.options._sourceMap.url : "",
28
- content: _cleanCSS.sourceMap.toString(),
29
- index
30
- });
31
- }
32
- if (settings && !settings.content && settings.output) {
33
- settings.output && utils.writeFile({
34
- file: settings.output,
35
- content: contentMinified,
36
- index
37
- });
38
- }
39
- if (callback) {
40
- return callback(null, contentMinified);
41
- }
42
- return contentMinified;
43
- };
44
- minifyCleanCSS.default = minifyCleanCSS;
45
- module.exports = minifyCleanCSS;
46
- }
47
- });
48
- export default require_src();
49
- /*!
50
- * node-minify
51
- * Copyright(c) 2011-2024 Rodolphe Stoclin
52
- * MIT Licensed
53
- */
54
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
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":[]}