@node-minify/yui 7.0.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 +68 -0
- package/dist/index.mjs +40 -0
- package/package.json +22 -7
- package/lib/binaries/yuicompressor-2.4.7.jar +0 -0
- package/lib/yui.js +0 -82
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 YUI Compressor.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} settings
|
|
13
|
+
* @param {String} content
|
|
14
|
+
* @param {Function} callback
|
|
15
|
+
*/
|
|
16
|
+
declare const minifyYUI: ({ settings, content, callback, index }: MinifierOptions) => any;
|
|
17
|
+
|
|
18
|
+
export { minifyYUI as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
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_path = __toESM(require("path"));
|
|
32
|
+
var import_utils = require("@node-minify/utils");
|
|
33
|
+
var import_run = require("@node-minify/run");
|
|
34
|
+
var binYui = import_path.default.normalize(__dirname + "/binaries/yuicompressor-2.4.7.jar");
|
|
35
|
+
var minifyYUI = ({ settings, content, callback, index }) => {
|
|
36
|
+
return (0, import_run.runCommandLine)({
|
|
37
|
+
args: yuiCommand(settings && settings.type, settings && settings.options),
|
|
38
|
+
data: content,
|
|
39
|
+
settings,
|
|
40
|
+
callback: (err, content2) => {
|
|
41
|
+
if (err) {
|
|
42
|
+
if (callback) {
|
|
43
|
+
return callback(err);
|
|
44
|
+
} else {
|
|
45
|
+
throw err;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (settings && !settings.content) {
|
|
49
|
+
import_utils.utils.writeFile({ file: settings.output, content: content2, index });
|
|
50
|
+
}
|
|
51
|
+
if (callback) {
|
|
52
|
+
return callback(null, content2);
|
|
53
|
+
}
|
|
54
|
+
return content2;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
var yuiCommand = (type = "js", options) => {
|
|
59
|
+
return ["-jar", "-Xss2048k", binYui, "--type", type].concat(import_utils.utils.buildArgs(options || {}));
|
|
60
|
+
};
|
|
61
|
+
var src_default = minifyYUI;
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {});
|
|
64
|
+
/*!
|
|
65
|
+
* node-minify
|
|
66
|
+
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
67
|
+
* MIT Licensed
|
|
68
|
+
*/
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { utils } from "@node-minify/utils";
|
|
4
|
+
import { runCommandLine } from "@node-minify/run";
|
|
5
|
+
var binYui = path.normalize(__dirname + "/binaries/yuicompressor-2.4.7.jar");
|
|
6
|
+
var minifyYUI = ({ settings, content, callback, index }) => {
|
|
7
|
+
return runCommandLine({
|
|
8
|
+
args: yuiCommand(settings && settings.type, settings && settings.options),
|
|
9
|
+
data: content,
|
|
10
|
+
settings,
|
|
11
|
+
callback: (err, content2) => {
|
|
12
|
+
if (err) {
|
|
13
|
+
if (callback) {
|
|
14
|
+
return callback(err);
|
|
15
|
+
} else {
|
|
16
|
+
throw err;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (settings && !settings.content) {
|
|
20
|
+
utils.writeFile({ file: settings.output, content: content2, index });
|
|
21
|
+
}
|
|
22
|
+
if (callback) {
|
|
23
|
+
return callback(null, content2);
|
|
24
|
+
}
|
|
25
|
+
return content2;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
var yuiCommand = (type = "js", options) => {
|
|
30
|
+
return ["-jar", "-Xss2048k", binYui, "--type", type].concat(utils.buildArgs(options || {}));
|
|
31
|
+
};
|
|
32
|
+
var src_default = minifyYUI;
|
|
33
|
+
export {
|
|
34
|
+
src_default as default
|
|
35
|
+
};
|
|
36
|
+
/*!
|
|
37
|
+
* node-minify
|
|
38
|
+
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
39
|
+
* MIT Licensed
|
|
40
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-minify/yui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-beta.0",
|
|
4
4
|
"description": "yui - yahoo compressor 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/yui#readme",
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"main": "lib/yui.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,17 @@
|
|
|
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/run": "
|
|
37
|
-
"@node-minify/utils": "
|
|
48
|
+
"@node-minify/run": "8.0.0-beta.0",
|
|
49
|
+
"@node-minify/utils": "8.0.0-beta.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@node-minify/types": "8.0.0-beta.0"
|
|
38
53
|
},
|
|
39
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "0507c6190577e1939997a8231b07952ba167a780"
|
|
40
55
|
}
|
|
Binary file
|
package/lib/yui.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _path = _interopRequireDefault(require("path"));
|
|
4
|
-
|
|
5
|
-
var _utils = require("@node-minify/utils");
|
|
6
|
-
|
|
7
|
-
var _run = require("@node-minify/run");
|
|
8
|
-
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
/*!
|
|
12
|
-
* node-minify
|
|
13
|
-
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
14
|
-
* MIT Licensed
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Module dependencies.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Module variables.
|
|
23
|
-
*/
|
|
24
|
-
const binYui = _path.default.normalize(__dirname + '/binaries/yuicompressor-2.4.7.jar');
|
|
25
|
-
/**
|
|
26
|
-
* Run YUI Compressor.
|
|
27
|
-
*
|
|
28
|
-
* @param {Object} settings
|
|
29
|
-
* @param {String} content
|
|
30
|
-
* @param {Function} callback
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const minifyYUI = ({
|
|
35
|
-
settings,
|
|
36
|
-
content,
|
|
37
|
-
callback,
|
|
38
|
-
index
|
|
39
|
-
}) => {
|
|
40
|
-
return (0, _run.runCommandLine)({
|
|
41
|
-
args: yuiCommand(settings.type, settings.options),
|
|
42
|
-
data: content,
|
|
43
|
-
settings,
|
|
44
|
-
callback: (err, content) => {
|
|
45
|
-
if (err) {
|
|
46
|
-
if (callback) {
|
|
47
|
-
return callback(err);
|
|
48
|
-
} else {
|
|
49
|
-
throw err;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (!settings.content) {
|
|
54
|
-
_utils.utils.writeFile({
|
|
55
|
-
file: settings.output,
|
|
56
|
-
content,
|
|
57
|
-
index
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (callback) {
|
|
62
|
-
return callback(null, content);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return content;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* YUI Compressor CSS command line.
|
|
71
|
-
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const yuiCommand = (type = 'js', options) => {
|
|
75
|
-
return ['-jar', '-Xss2048k', binYui, '--type', type].concat(_utils.utils.buildArgs(options || {}));
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* Expose `minifyYUI()`.
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
module.exports = minifyYUI;
|