@node-minify/yui 8.0.6 → 9.0.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Rodolphe Stoclin
3
+ Copyright (c) 2024 Rodolphe Stoclin
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -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 minifyYUI: {
10
+ ({ settings, content, callback, index }: MinifierOptions): void;
11
+ default: any;
12
+ };
13
+
14
+ export { minifyYUI as default };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { MinifierOptions } from '@node-minify/types';
2
2
 
3
3
  /*!
4
4
  * node-minify
5
- * Copyright(c) 2011-2023 Rodolphe Stoclin
5
+ * Copyright(c) 2011-2024 Rodolphe Stoclin
6
6
  * MIT Licensed
7
7
  */
8
8
 
package/dist/index.js CHANGED
@@ -23,22 +23,24 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  ));
24
24
 
25
25
  // src/index.ts
26
- var import_es_dirname = __toESM(require("es-dirname"));
27
- var import_utils = require("@node-minify/utils");
28
26
  var import_run = require("@node-minify/run");
27
+ var import_utils = require("@node-minify/utils");
28
+ var import_es_dirname = __toESM(require("es-dirname"));
29
29
  var binYui = `${(0, import_es_dirname.default)()}/binaries/yuicompressor-2.4.7.jar`;
30
30
  var minifyYUI = ({ settings, content, callback, index }) => {
31
+ if (!settings?.type || settings.type !== "js" && settings.type !== "css") {
32
+ throw new Error("You must specify a type: js or css");
33
+ }
31
34
  return (0, import_run.runCommandLine)({
32
- args: yuiCommand(settings?.type, settings?.options),
35
+ args: yuiCommand(settings.type, settings?.options ?? {}),
33
36
  data: content,
34
37
  settings,
35
38
  callback: (err, content2) => {
36
39
  if (err) {
37
40
  if (callback) {
38
41
  return callback(err);
39
- } else {
40
- throw err;
41
42
  }
43
+ throw err;
42
44
  }
43
45
  if (settings && !settings.content && settings.output) {
44
46
  import_utils.utils.writeFile({ file: settings.output, content: content2, index });
@@ -50,14 +52,16 @@ var minifyYUI = ({ settings, content, callback, index }) => {
50
52
  }
51
53
  });
52
54
  };
53
- var yuiCommand = (type = "js", options) => {
54
- return ["-jar", "-Xss2048k", binYui, "--type", type].concat(import_utils.utils.buildArgs(options ?? {}));
55
+ var yuiCommand = (type, options) => {
56
+ return ["-jar", "-Xss2048k", binYui, "--type", type].concat(
57
+ import_utils.utils.buildArgs(options)
58
+ );
55
59
  };
56
60
  minifyYUI.default = minifyYUI;
57
61
  module.exports = minifyYUI;
58
62
  /*!
59
63
  * node-minify
60
- * Copyright(c) 2011-2023 Rodolphe Stoclin
64
+ * Copyright(c) 2011-2024 Rodolphe Stoclin
61
65
  * MIT Licensed
62
66
  */
63
67
  //# 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-2023 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\n\n// import path from 'path';\nimport dirname from 'es-dirname';\nimport { utils } from '@node-minify/utils';\nimport { runCommandLine } from '@node-minify/run';\nimport { MinifierOptions } from '@node-minify/types';\n\n/**\n * Module variables.\n */\nconst binYui = `${dirname()}/binaries/yuicompressor-2.4.7.jar`;\n\n/**\n * Run YUI Compressor.\n *\n * @param {Object} settings\n * @param {String} content\n * @param {Function} callback\n */\nconst minifyYUI = ({ settings, content, callback, index }: MinifierOptions) => {\n return runCommandLine({\n args: yuiCommand(settings?.type, settings?.options),\n data: content,\n settings,\n callback: (err: unknown, content?: string) => {\n if (err) {\n if (callback) {\n return callback(err);\n } else {\n throw err;\n }\n }\n if (settings && !settings.content && settings.output) {\n utils.writeFile({ file: settings.output, content, index });\n }\n if (callback) {\n return callback(null, content);\n }\n return content;\n }\n });\n};\n\n/**\n * YUI Compressor CSS command line.\n */\nconst yuiCommand = (type = 'js', options: any) => {\n return ['-jar', '-Xss2048k', binYui, '--type', type].concat(utils.buildArgs(options ?? {}));\n};\n\n/**\n * Expose `minifyYUI()`.\n */\nminifyYUI.default = minifyYUI;\nexport = minifyYUI;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAWA,wBAAoB;AACpB,mBAAsB;AACtB,iBAA+B;AAM/B,IAAM,SAAS,OAAG,kBAAAA,SAAQ;AAS1B,IAAM,YAAY,CAAC,EAAE,UAAU,SAAS,UAAU,MAAM,MAAuB;AAC7E,aAAO,2BAAe;AAAA,IACpB,MAAM,WAAW,UAAU,MAAM,UAAU,OAAO;AAAA,IAClD,MAAM;AAAA,IACN;AAAA,IACA,UAAU,CAAC,KAAcC,aAAqB;AAC5C,UAAI,KAAK;AACP,YAAI,UAAU;AACZ,iBAAO,SAAS,GAAG;AAAA,QACrB,OAAO;AACL,gBAAM;AAAA,QACR;AAAA,MACF;AACA,UAAI,YAAY,CAAC,SAAS,WAAW,SAAS,QAAQ;AACpD,2BAAM,UAAU,EAAE,MAAM,SAAS,QAAQ,SAAAA,UAAS,MAAM,CAAC;AAAA,MAC3D;AACA,UAAI,UAAU;AACZ,eAAO,SAAS,MAAMA,QAAO;AAAA,MAC/B;AACA,aAAOA;AAAA,IACT;AAAA,EACF,CAAC;AACH;AAKA,IAAM,aAAa,CAAC,OAAO,MAAM,YAAiB;AAChD,SAAO,CAAC,QAAQ,aAAa,QAAQ,UAAU,IAAI,EAAE,OAAO,mBAAM,UAAU,WAAW,CAAC,CAAC,CAAC;AAC5F;AAKA,UAAU,UAAU;AACpB,iBAAS;","names":["dirname","content"]}
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 */\n\nimport { runCommandLine } from \"@node-minify/run\";\nimport type { MinifierOptions, Options } from \"@node-minify/types\";\nimport { utils } from \"@node-minify/utils\";\nimport dirname from \"es-dirname\";\n\n/**\n * Module variables.\n */\nconst binYui = `${dirname()}/binaries/yuicompressor-2.4.7.jar`;\n\n/**\n * Run YUI Compressor.\n * @param settings YUI Compressor 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 minifyYUI = ({ settings, content, callback, index }: MinifierOptions) => {\n if (\n !settings?.type ||\n (settings.type !== \"js\" && settings.type !== \"css\")\n ) {\n throw new Error(\"You must specify a type: js or css\");\n }\n return runCommandLine({\n args: yuiCommand(settings.type, settings?.options ?? {}),\n data: content,\n settings,\n callback: (err: unknown, content?: string) => {\n if (err) {\n if (callback) {\n return callback(err);\n }\n throw err;\n }\n if (settings && !settings.content && settings.output) {\n utils.writeFile({ file: settings.output, content, index });\n }\n if (callback) {\n return callback(null, content);\n }\n return content;\n },\n });\n};\n\n/**\n * YUI Compressor CSS command line.\n */\nconst yuiCommand = (type: \"js\" | \"css\", options: Options) => {\n return [\"-jar\", \"-Xss2048k\", binYui, \"--type\", type].concat(\n utils.buildArgs(options)\n );\n};\n\n/**\n * Expose `minifyYUI()`.\n */\nminifyYUI.default = minifyYUI;\nexport = minifyYUI;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAUA,iBAA+B;AAE/B,mBAAsB;AACtB,wBAAoB;AAKpB,IAAM,SAAS,OAAG,kBAAAA,SAAQ,CAAC;AAU3B,IAAM,YAAY,CAAC,EAAE,UAAU,SAAS,UAAU,MAAM,MAAuB;AAC3E,MACI,CAAC,UAAU,QACV,SAAS,SAAS,QAAQ,SAAS,SAAS,OAC/C;AACE,UAAM,IAAI,MAAM,oCAAoC;AAAA,EACxD;AACA,aAAO,2BAAe;AAAA,IAClB,MAAM,WAAW,SAAS,MAAM,UAAU,WAAW,CAAC,CAAC;AAAA,IACvD,MAAM;AAAA,IACN;AAAA,IACA,UAAU,CAAC,KAAcC,aAAqB;AAC1C,UAAI,KAAK;AACL,YAAI,UAAU;AACV,iBAAO,SAAS,GAAG;AAAA,QACvB;AACA,cAAM;AAAA,MACV;AACA,UAAI,YAAY,CAAC,SAAS,WAAW,SAAS,QAAQ;AAClD,2BAAM,UAAU,EAAE,MAAM,SAAS,QAAQ,SAAAA,UAAS,MAAM,CAAC;AAAA,MAC7D;AACA,UAAI,UAAU;AACV,eAAO,SAAS,MAAMA,QAAO;AAAA,MACjC;AACA,aAAOA;AAAA,IACX;AAAA,EACJ,CAAC;AACL;AAKA,IAAM,aAAa,CAAC,MAAoB,YAAqB;AACzD,SAAO,CAAC,QAAQ,aAAa,QAAQ,UAAU,IAAI,EAAE;AAAA,IACjD,mBAAM,UAAU,OAAO;AAAA,EAC3B;AACJ;AAKA,UAAU,UAAU;AACpB,iBAAS;","names":["dirname","content"]}
package/dist/index.mjs CHANGED
@@ -4,24 +4,26 @@ var __commonJS = (cb, mod) => function __require() {
4
4
  };
5
5
 
6
6
  // src/index.ts
7
- import dirname from "es-dirname";
8
- import { utils } from "@node-minify/utils";
9
7
  import { runCommandLine } from "@node-minify/run";
8
+ import { utils } from "@node-minify/utils";
9
+ import dirname from "es-dirname";
10
10
  var require_src = __commonJS({
11
11
  "src/index.ts"(exports, module) {
12
12
  var binYui = `${dirname()}/binaries/yuicompressor-2.4.7.jar`;
13
13
  var minifyYUI = ({ settings, content, callback, index }) => {
14
+ if (!settings?.type || settings.type !== "js" && settings.type !== "css") {
15
+ throw new Error("You must specify a type: js or css");
16
+ }
14
17
  return runCommandLine({
15
- args: yuiCommand(settings?.type, settings?.options),
18
+ args: yuiCommand(settings.type, settings?.options ?? {}),
16
19
  data: content,
17
20
  settings,
18
21
  callback: (err, content2) => {
19
22
  if (err) {
20
23
  if (callback) {
21
24
  return callback(err);
22
- } else {
23
- throw err;
24
25
  }
26
+ throw err;
25
27
  }
26
28
  if (settings && !settings.content && settings.output) {
27
29
  utils.writeFile({ file: settings.output, content: content2, index });
@@ -33,8 +35,10 @@ var require_src = __commonJS({
33
35
  }
34
36
  });
35
37
  };
36
- var yuiCommand = (type = "js", options) => {
37
- return ["-jar", "-Xss2048k", binYui, "--type", type].concat(utils.buildArgs(options ?? {}));
38
+ var yuiCommand = (type, options) => {
39
+ return ["-jar", "-Xss2048k", binYui, "--type", type].concat(
40
+ utils.buildArgs(options)
41
+ );
38
42
  };
39
43
  minifyYUI.default = minifyYUI;
40
44
  module.exports = minifyYUI;
@@ -43,7 +47,7 @@ var require_src = __commonJS({
43
47
  export default require_src();
44
48
  /*!
45
49
  * node-minify
46
- * Copyright(c) 2011-2023 Rodolphe Stoclin
50
+ * Copyright(c) 2011-2024 Rodolphe Stoclin
47
51
  * MIT Licensed
48
52
  */
49
53
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2023 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\n\n// import path from 'path';\nimport dirname from 'es-dirname';\nimport { utils } from '@node-minify/utils';\nimport { runCommandLine } from '@node-minify/run';\nimport { MinifierOptions } from '@node-minify/types';\n\n/**\n * Module variables.\n */\nconst binYui = `${dirname()}/binaries/yuicompressor-2.4.7.jar`;\n\n/**\n * Run YUI Compressor.\n *\n * @param {Object} settings\n * @param {String} content\n * @param {Function} callback\n */\nconst minifyYUI = ({ settings, content, callback, index }: MinifierOptions) => {\n return runCommandLine({\n args: yuiCommand(settings?.type, settings?.options),\n data: content,\n settings,\n callback: (err: unknown, content?: string) => {\n if (err) {\n if (callback) {\n return callback(err);\n } else {\n throw err;\n }\n }\n if (settings && !settings.content && settings.output) {\n utils.writeFile({ file: settings.output, content, index });\n }\n if (callback) {\n return callback(null, content);\n }\n return content;\n }\n });\n};\n\n/**\n * YUI Compressor CSS command line.\n */\nconst yuiCommand = (type = 'js', options: any) => {\n return ['-jar', '-Xss2048k', binYui, '--type', type].concat(utils.buildArgs(options ?? {}));\n};\n\n/**\n * Expose `minifyYUI()`.\n */\nminifyYUI.default = minifyYUI;\nexport = minifyYUI;\n"],"mappings":";;;;;;AAWA,OAAO,aAAa;AACpB,SAAS,aAAa;AACtB,SAAS,sBAAsB;AAb/B;AAAA;AAmBA,QAAM,SAAS,GAAG,QAAQ;AAS1B,QAAM,YAAY,CAAC,EAAE,UAAU,SAAS,UAAU,MAAM,MAAuB;AAC7E,aAAO,eAAe;AAAA,QACpB,MAAM,WAAW,UAAU,MAAM,UAAU,OAAO;AAAA,QAClD,MAAM;AAAA,QACN;AAAA,QACA,UAAU,CAAC,KAAcA,aAAqB;AAC5C,cAAI,KAAK;AACP,gBAAI,UAAU;AACZ,qBAAO,SAAS,GAAG;AAAA,YACrB,OAAO;AACL,oBAAM;AAAA,YACR;AAAA,UACF;AACA,cAAI,YAAY,CAAC,SAAS,WAAW,SAAS,QAAQ;AACpD,kBAAM,UAAU,EAAE,MAAM,SAAS,QAAQ,SAAAA,UAAS,MAAM,CAAC;AAAA,UAC3D;AACA,cAAI,UAAU;AACZ,mBAAO,SAAS,MAAMA,QAAO;AAAA,UAC/B;AACA,iBAAOA;AAAA,QACT;AAAA,MACF,CAAC;AAAA,IACH;AAKA,QAAM,aAAa,CAAC,OAAO,MAAM,YAAiB;AAChD,aAAO,CAAC,QAAQ,aAAa,QAAQ,UAAU,IAAI,EAAE,OAAO,MAAM,UAAU,WAAW,CAAC,CAAC,CAAC;AAAA,IAC5F;AAKA,cAAU,UAAU;AACpB,qBAAS;AAAA;AAAA;","names":["content"]}
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 */\n\nimport { runCommandLine } from \"@node-minify/run\";\nimport type { MinifierOptions, Options } from \"@node-minify/types\";\nimport { utils } from \"@node-minify/utils\";\nimport dirname from \"es-dirname\";\n\n/**\n * Module variables.\n */\nconst binYui = `${dirname()}/binaries/yuicompressor-2.4.7.jar`;\n\n/**\n * Run YUI Compressor.\n * @param settings YUI Compressor 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 minifyYUI = ({ settings, content, callback, index }: MinifierOptions) => {\n if (\n !settings?.type ||\n (settings.type !== \"js\" && settings.type !== \"css\")\n ) {\n throw new Error(\"You must specify a type: js or css\");\n }\n return runCommandLine({\n args: yuiCommand(settings.type, settings?.options ?? {}),\n data: content,\n settings,\n callback: (err: unknown, content?: string) => {\n if (err) {\n if (callback) {\n return callback(err);\n }\n throw err;\n }\n if (settings && !settings.content && settings.output) {\n utils.writeFile({ file: settings.output, content, index });\n }\n if (callback) {\n return callback(null, content);\n }\n return content;\n },\n });\n};\n\n/**\n * YUI Compressor CSS command line.\n */\nconst yuiCommand = (type: \"js\" | \"css\", options: Options) => {\n return [\"-jar\", \"-Xss2048k\", binYui, \"--type\", type].concat(\n utils.buildArgs(options)\n );\n};\n\n/**\n * Expose `minifyYUI()`.\n */\nminifyYUI.default = minifyYUI;\nexport = minifyYUI;\n"],"mappings":";;;;;;AAUA,SAAS,sBAAsB;AAE/B,SAAS,aAAa;AACtB,OAAO,aAAa;AAbpB;AAAA;AAkBA,QAAM,SAAS,GAAG,QAAQ,CAAC;AAU3B,QAAM,YAAY,CAAC,EAAE,UAAU,SAAS,UAAU,MAAM,MAAuB;AAC3E,UACI,CAAC,UAAU,QACV,SAAS,SAAS,QAAQ,SAAS,SAAS,OAC/C;AACE,cAAM,IAAI,MAAM,oCAAoC;AAAA,MACxD;AACA,aAAO,eAAe;AAAA,QAClB,MAAM,WAAW,SAAS,MAAM,UAAU,WAAW,CAAC,CAAC;AAAA,QACvD,MAAM;AAAA,QACN;AAAA,QACA,UAAU,CAAC,KAAcA,aAAqB;AAC1C,cAAI,KAAK;AACL,gBAAI,UAAU;AACV,qBAAO,SAAS,GAAG;AAAA,YACvB;AACA,kBAAM;AAAA,UACV;AACA,cAAI,YAAY,CAAC,SAAS,WAAW,SAAS,QAAQ;AAClD,kBAAM,UAAU,EAAE,MAAM,SAAS,QAAQ,SAAAA,UAAS,MAAM,CAAC;AAAA,UAC7D;AACA,cAAI,UAAU;AACV,mBAAO,SAAS,MAAMA,QAAO;AAAA,UACjC;AACA,iBAAOA;AAAA,QACX;AAAA,MACJ,CAAC;AAAA,IACL;AAKA,QAAM,aAAa,CAAC,MAAoB,YAAqB;AACzD,aAAO,CAAC,QAAQ,aAAa,QAAQ,UAAU,IAAI,EAAE;AAAA,QACjD,MAAM,UAAU,OAAO;AAAA,MAC3B;AAAA,IACJ;AAKA,cAAU,UAAU;AACpB,qBAAS;AAAA;AAAA;","names":["content"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/yui",
3
- "version": "8.0.6",
3
+ "version": "9.0.1",
4
4
  "description": "yui - yahoo compressor 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/yui#readme",
13
13
  "license": "MIT",
14
14
  "engines": {
15
- "node": ">=16.0.0"
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
- "require": "./dist/index.js",
26
- "import": "./dist/index.mjs",
27
- "types": "./dist/index.d.ts"
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.mjs",
28
+ "require": "./dist/index.js"
29
+ }
28
30
  },
29
31
  "files": [
30
32
  "dist/**/*"
@@ -39,19 +41,21 @@
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
- "postbuild": "pnpm dlx copyfiles -u 1 src/binaries/*.jar dist/",
46
- "prepublishOnly": "pnpm build"
47
- },
48
44
  "dependencies": {
49
- "@node-minify/run": "8.0.6",
50
- "@node-minify/utils": "8.0.6",
51
- "es-dirname": "0.1.0"
45
+ "es-dirname": "0.1.0",
46
+ "@node-minify/run": "9.0.1",
47
+ "@node-minify/utils": "9.0.1"
52
48
  },
53
49
  "devDependencies": {
54
- "@node-minify/types": "8.0.6"
50
+ "@node-minify/types": "9.0.0"
55
51
  },
56
- "gitHead": "9fb532af458cb6416ecfb7abfb9cc0a3b9cb42e1"
57
- }
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
+ "postbuild": "pnpm dlx copyfiles -u 1 src/binaries/*.jar dist/",
57
+ "test": "vitest run",
58
+ "test:ci": "vitest run --coverage",
59
+ "test:watch": "vitest"
60
+ }
61
+ }