@node-minify/yui 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,83 @@
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_run = require("@node-minify/run");
37
+ var import_utils = require("@node-minify/utils");
38
+ var import_es_dirname = __toESM(require("es-dirname"), 1);
39
+ var binYui = `${(0, import_es_dirname.default)()}/binaries/yuicompressor-2.4.7.jar`;
40
+ var minifyYUI = ({ settings, content, callback, index }) => {
41
+ if (!settings?.type || settings.type !== "js" && settings.type !== "css") {
42
+ throw new Error("You must specify a type: js or css");
43
+ }
44
+ return (0, import_run.runCommandLine)({
45
+ args: yuiCommand(settings.type, settings?.options ?? {}),
46
+ data: content,
47
+ settings,
48
+ callback: (err, content2) => {
49
+ if (err) {
50
+ if (callback) {
51
+ return callback(err);
52
+ }
53
+ throw err;
54
+ }
55
+ if (settings && !settings.content && settings.output) {
56
+ import_utils.utils.writeFile({ file: settings.output, content: content2, index });
57
+ }
58
+ if (callback) {
59
+ return callback(null, content2);
60
+ }
61
+ return content2;
62
+ }
63
+ });
64
+ };
65
+ var yuiCommand = (type, options) => {
66
+ return ["-jar", "-Xss2048k", binYui, "--type", type].concat(
67
+ import_utils.utils.buildArgs(options)
68
+ );
69
+ };
70
+ minifyYUI.default = minifyYUI;
71
+ var src_default = minifyYUI;
72
+ /*!
73
+ * node-minify
74
+ * Copyright(c) 2011-2024 Rodolphe Stoclin
75
+ * MIT Licensed
76
+ */
77
+
78
+ // fix-cjs-exports
79
+ if (module.exports.default) {
80
+ Object.assign(module.exports.default, module.exports);
81
+ module.exports = module.exports.default;
82
+ delete module.exports.default;
83
+ }
@@ -12,3 +12,4 @@ declare const minifyYUI: {
12
12
  };
13
13
 
14
14
  export { minifyYUI as default };
15
+ export = minifyYUI
package/dist/index.d.ts CHANGED
@@ -12,3 +12,4 @@ declare const minifyYUI: {
12
12
  };
13
13
 
14
14
  export { minifyYUI as default };
15
+ export = minifyYUI
package/dist/index.js CHANGED
@@ -1,37 +1,13 @@
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_run = require("@node-minify/run");
27
- var import_utils = require("@node-minify/utils");
28
- var import_es_dirname = __toESM(require("es-dirname"));
29
- var binYui = `${(0, import_es_dirname.default)()}/binaries/yuicompressor-2.4.7.jar`;
2
+ import { runCommandLine } from "@node-minify/run";
3
+ import { utils } from "@node-minify/utils";
4
+ import dirname from "es-dirname";
5
+ var binYui = `${dirname()}/binaries/yuicompressor-2.4.7.jar`;
30
6
  var minifyYUI = ({ settings, content, callback, index }) => {
31
7
  if (!settings?.type || settings.type !== "js" && settings.type !== "css") {
32
8
  throw new Error("You must specify a type: js or css");
33
9
  }
34
- return (0, import_run.runCommandLine)({
10
+ return runCommandLine({
35
11
  args: yuiCommand(settings.type, settings?.options ?? {}),
36
12
  data: content,
37
13
  settings,
@@ -43,7 +19,7 @@ var minifyYUI = ({ settings, content, callback, index }) => {
43
19
  throw err;
44
20
  }
45
21
  if (settings && !settings.content && settings.output) {
46
- import_utils.utils.writeFile({ file: settings.output, content: content2, index });
22
+ utils.writeFile({ file: settings.output, content: content2, index });
47
23
  }
48
24
  if (callback) {
49
25
  return callback(null, content2);
@@ -54,14 +30,16 @@ var minifyYUI = ({ settings, content, callback, index }) => {
54
30
  };
55
31
  var yuiCommand = (type, options) => {
56
32
  return ["-jar", "-Xss2048k", binYui, "--type", type].concat(
57
- import_utils.utils.buildArgs(options)
33
+ utils.buildArgs(options)
58
34
  );
59
35
  };
60
36
  minifyYUI.default = minifyYUI;
61
- module.exports = minifyYUI;
37
+ var src_default = minifyYUI;
38
+ export {
39
+ src_default as default
40
+ };
62
41
  /*!
63
42
  * node-minify
64
43
  * Copyright(c) 2011-2024 Rodolphe Stoclin
65
44
  * MIT Licensed
66
45
  */
67
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/yui",
3
- "version": "9.0.0",
3
+ "version": "10.0.0-next.0",
4
4
  "description": "yui - yahoo compressor plugin for @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
@@ -9,23 +9,22 @@
9
9
  "yui"
10
10
  ],
11
11
  "author": "Rodolphe Stoclin <srodolphe@gmail.com>",
12
- "homepage": "https://github.com/srod/node-minify/tree/master/packages/yui#readme",
12
+ "homepage": "https://github.com/srod/node-minify/tree/main/packages/yui#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",
24
23
  "exports": {
24
+ "./package.json": "./package.json",
25
25
  ".": {
26
- "types": "./dist/index.d.ts",
27
- "import": "./dist/index.mjs",
28
- "require": "./dist/index.cjs"
26
+ "import": "./dist/index.js",
27
+ "default": "./dist/index.cjs"
29
28
  }
30
29
  },
31
30
  "files": [
@@ -41,21 +40,23 @@
41
40
  "bugs": {
42
41
  "url": "https://github.com/srod/node-minify/issues"
43
42
  },
44
- "dependencies": {
45
- "es-dirname": "0.1.0",
46
- "@node-minify/utils": "9.0.0",
47
- "@node-minify/run": "9.0.0"
48
- },
49
- "devDependencies": {
50
- "@node-minify/types": "9.0.0"
51
- },
52
43
  "scripts": {
53
- "clean": "pnpm dlx rimraf dist",
54
- "build": "pnpm clean && tsup src/index.ts --format cjs,esm --dts --clean --sourcemap",
44
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean && bunx fix-tsup-cjs",
45
+ "check-exports": "attw --pack .",
46
+ "format:check": "biome check .",
55
47
  "lint": "biome lint .",
56
- "postbuild": "pnpm dlx copyfiles -u 1 src/binaries/*.jar dist/",
48
+ "postbuild": "bunx copyfiles -u 1 src/binaries/*.jar dist/",
49
+ "prepublishOnly": "bun run build",
57
50
  "test": "vitest run",
58
51
  "test:ci": "vitest run --coverage",
59
52
  "test:watch": "vitest"
53
+ },
54
+ "dependencies": {
55
+ "@node-minify/run": "workspace:*",
56
+ "@node-minify/utils": "workspace:*",
57
+ "es-dirname": "0.1.0"
58
+ },
59
+ "devDependencies": {
60
+ "@node-minify/types": "workspace:*"
60
61
  }
61
- }
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 */\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 DELETED
@@ -1,53 +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 { runCommandLine } from "@node-minify/run";
8
- import { utils } from "@node-minify/utils";
9
- import dirname from "es-dirname";
10
- var require_src = __commonJS({
11
- "src/index.ts"(exports, module) {
12
- var binYui = `${dirname()}/binaries/yuicompressor-2.4.7.jar`;
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
- }
17
- return runCommandLine({
18
- args: yuiCommand(settings.type, settings?.options ?? {}),
19
- data: content,
20
- settings,
21
- callback: (err, content2) => {
22
- if (err) {
23
- if (callback) {
24
- return callback(err);
25
- }
26
- throw err;
27
- }
28
- if (settings && !settings.content && settings.output) {
29
- utils.writeFile({ file: settings.output, content: content2, index });
30
- }
31
- if (callback) {
32
- return callback(null, content2);
33
- }
34
- return content2;
35
- }
36
- });
37
- };
38
- var yuiCommand = (type, options) => {
39
- return ["-jar", "-Xss2048k", binYui, "--type", type].concat(
40
- utils.buildArgs(options)
41
- );
42
- };
43
- minifyYUI.default = minifyYUI;
44
- module.exports = minifyYUI;
45
- }
46
- });
47
- export default require_src();
48
- /*!
49
- * node-minify
50
- * Copyright(c) 2011-2024 Rodolphe Stoclin
51
- * MIT Licensed
52
- */
53
- //# 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 */\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"]}