ee-bin 4.2.0 → 5.0.0-beta.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/dist/cjs/config/bin_default.js +149 -0
- package/dist/cjs/config/bin_default.js.map +1 -0
- package/dist/cjs/index.js +98 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/lib/extend.js +48 -0
- package/dist/cjs/lib/extend.js.map +1 -0
- package/dist/cjs/lib/helpers.js +92 -0
- package/dist/cjs/lib/helpers.js.map +1 -0
- package/dist/cjs/lib/utils.js +108 -0
- package/dist/cjs/lib/utils.js.map +1 -0
- package/dist/cjs/tools/encrypt.js +121 -0
- package/dist/cjs/tools/encrypt.js.map +1 -0
- package/dist/cjs/tools/iconGen.js +140 -0
- package/dist/cjs/tools/iconGen.js.map +1 -0
- package/dist/cjs/tools/incrUpdater.js +187 -0
- package/dist/cjs/tools/incrUpdater.js.map +1 -0
- package/dist/cjs/tools/move.js +56 -0
- package/dist/cjs/tools/move.js.map +1 -0
- package/dist/cjs/tools/serve.js +286 -0
- package/dist/cjs/tools/serve.js.map +1 -0
- package/dist/esm/config/bin_default.d.ts +148 -0
- package/dist/esm/config/bin_default.d.ts.map +1 -0
- package/dist/esm/config/bin_default.js +149 -0
- package/dist/esm/config/bin_default.js.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +98 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/extend.d.ts +3 -0
- package/dist/esm/lib/extend.d.ts.map +1 -0
- package/dist/esm/lib/extend.js +48 -0
- package/dist/esm/lib/extend.js.map +1 -0
- package/dist/esm/lib/helpers.d.ts +23 -0
- package/dist/esm/lib/helpers.d.ts.map +1 -0
- package/dist/esm/lib/helpers.js +92 -0
- package/dist/esm/lib/helpers.js.map +1 -0
- package/dist/esm/lib/utils.d.ts +11 -0
- package/dist/esm/lib/utils.d.ts.map +1 -0
- package/dist/esm/lib/utils.js +108 -0
- package/dist/esm/lib/utils.js.map +1 -0
- package/dist/esm/tools/encrypt.d.ts +11 -0
- package/dist/esm/tools/encrypt.d.ts.map +1 -0
- package/dist/esm/tools/encrypt.js +121 -0
- package/dist/esm/tools/encrypt.js.map +1 -0
- package/dist/esm/tools/iconGen.d.ts +2 -0
- package/dist/esm/tools/iconGen.d.ts.map +1 -0
- package/dist/esm/tools/iconGen.js +140 -0
- package/dist/esm/tools/iconGen.js.map +1 -0
- package/dist/esm/tools/incrUpdater.d.ts +32 -0
- package/dist/esm/tools/incrUpdater.d.ts.map +1 -0
- package/dist/esm/tools/incrUpdater.js +187 -0
- package/dist/esm/tools/incrUpdater.js.map +1 -0
- package/dist/esm/tools/move.d.ts +7 -0
- package/dist/esm/tools/move.d.ts.map +1 -0
- package/dist/esm/tools/move.js +56 -0
- package/dist/esm/tools/move.js.map +1 -0
- package/dist/esm/tools/serve.d.ts +42 -0
- package/dist/esm/tools/serve.d.ts.map +1 -0
- package/dist/esm/tools/serve.js +286 -0
- package/dist/esm/tools/serve.js.map +1 -0
- package/package.json +67 -33
- package/config/bin_default.js +0 -182
- package/index.js +0 -122
- package/lib/extend.js +0 -78
- package/lib/pargv.js +0 -263
- package/lib/utils.js +0 -255
- package/readme.md +0 -1
- package/tools/encrypt.js +0 -179
- package/tools/iconGen.js +0 -183
- package/tools/incrUpdater.js +0 -226
- package/tools/move.js +0 -69
- package/tools/serve.js +0 -346
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
dev: {
|
|
5
|
+
frontend: {
|
|
6
|
+
directory: './frontend',
|
|
7
|
+
cmd: 'npm',
|
|
8
|
+
args: ['run', 'dev'],
|
|
9
|
+
protocol: 'http://',
|
|
10
|
+
hostname: 'localhost',
|
|
11
|
+
port: 8080,
|
|
12
|
+
indexPath: 'index.html',
|
|
13
|
+
force: false,
|
|
14
|
+
sync: false,
|
|
15
|
+
},
|
|
16
|
+
electron: {
|
|
17
|
+
directory: './',
|
|
18
|
+
cmd: 'electron',
|
|
19
|
+
args: ['.', '--env=local', '--debugger=false'],
|
|
20
|
+
loadingPage: '/public/html/loading.html',
|
|
21
|
+
watch: false,
|
|
22
|
+
sync: false,
|
|
23
|
+
delay: 1000,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
build: {
|
|
27
|
+
frontend: {
|
|
28
|
+
directory: './frontend',
|
|
29
|
+
cmd: 'npm',
|
|
30
|
+
args: ['run', 'build'],
|
|
31
|
+
},
|
|
32
|
+
electron: {
|
|
33
|
+
type: 'javascript',
|
|
34
|
+
bundler: 'esbuild',
|
|
35
|
+
bundleType: 'bundle',
|
|
36
|
+
javascript: {
|
|
37
|
+
entryPoints: ['./electron/**/*.js'],
|
|
38
|
+
platform: 'node',
|
|
39
|
+
bundle: false,
|
|
40
|
+
minify: false,
|
|
41
|
+
outdir: 'public/electron',
|
|
42
|
+
packages: 'external',
|
|
43
|
+
sourcemap: false,
|
|
44
|
+
sourcesContent: false,
|
|
45
|
+
},
|
|
46
|
+
typescript: {
|
|
47
|
+
entryPoints: ['./electron/**/*.ts'],
|
|
48
|
+
tsconfig: './tsconfig.json',
|
|
49
|
+
platform: 'node',
|
|
50
|
+
format: 'cjs',
|
|
51
|
+
bundle: false,
|
|
52
|
+
minify: false,
|
|
53
|
+
outdir: 'public/electron',
|
|
54
|
+
packages: 'external',
|
|
55
|
+
sourcemap: false,
|
|
56
|
+
sourcesContent: false,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
win32: {
|
|
60
|
+
cmd: 'electron-builder',
|
|
61
|
+
directory: './',
|
|
62
|
+
args: ['--config=./cmd/builder.json', '-w=nsis', '--ia32'],
|
|
63
|
+
},
|
|
64
|
+
win64: {
|
|
65
|
+
cmd: 'electron-builder',
|
|
66
|
+
directory: './',
|
|
67
|
+
args: ['--config=./cmd/builder.json', '-w=nsis', '--x64'],
|
|
68
|
+
},
|
|
69
|
+
win_e: {
|
|
70
|
+
cmd: 'electron-builder',
|
|
71
|
+
directory: './',
|
|
72
|
+
args: ['--config=./cmd/builder.json', '-w=portable', '--x64'],
|
|
73
|
+
},
|
|
74
|
+
win_7z: {
|
|
75
|
+
cmd: 'electron-builder',
|
|
76
|
+
directory: './',
|
|
77
|
+
args: ['--config=./cmd/builder.json', '-w=7z', '--x64'],
|
|
78
|
+
},
|
|
79
|
+
mac: {
|
|
80
|
+
cmd: 'electron-builder',
|
|
81
|
+
directory: './',
|
|
82
|
+
args: ['--config=./cmd/builder-mac.json', '-m'],
|
|
83
|
+
},
|
|
84
|
+
mac_arm64: {
|
|
85
|
+
cmd: 'electron-builder',
|
|
86
|
+
directory: './',
|
|
87
|
+
args: ['--config=./cmd/builder-mac-arm64.json', '-m', '--arm64'],
|
|
88
|
+
},
|
|
89
|
+
linux: {
|
|
90
|
+
cmd: 'electron-builder',
|
|
91
|
+
directory: './',
|
|
92
|
+
args: ['--config=./cmd/builder-linux.json', '-l=deb', '--x64'],
|
|
93
|
+
},
|
|
94
|
+
linux_arm64: {
|
|
95
|
+
cmd: 'electron-builder',
|
|
96
|
+
directory: './',
|
|
97
|
+
args: ['--config=./cmd/builder-linux.json', '-l=deb', '--arm64'],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
move: {
|
|
101
|
+
frontend_dist: {
|
|
102
|
+
src: './frontend/dist',
|
|
103
|
+
dest: './public/dist',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
start: {
|
|
107
|
+
directory: './',
|
|
108
|
+
cmd: 'electron',
|
|
109
|
+
args: ['.', '--env=prod'],
|
|
110
|
+
},
|
|
111
|
+
encrypt: {
|
|
112
|
+
frontend: {
|
|
113
|
+
type: 'none',
|
|
114
|
+
files: ['./public/dist/**/*.(js|json)'],
|
|
115
|
+
fileExt: ['.js'],
|
|
116
|
+
cleanFiles: ['./public/dist'],
|
|
117
|
+
specificFiles: [],
|
|
118
|
+
encryptDir: './',
|
|
119
|
+
confusionOptions: {
|
|
120
|
+
compact: true,
|
|
121
|
+
stringArray: true,
|
|
122
|
+
stringArrayEncoding: ['none'],
|
|
123
|
+
deadCodeInjection: false,
|
|
124
|
+
stringArrayCallsTransform: true,
|
|
125
|
+
numbersToExpressions: true,
|
|
126
|
+
target: 'browser',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
electron: {
|
|
130
|
+
type: 'none',
|
|
131
|
+
files: ['./public/electron/**/*.(js|json)'],
|
|
132
|
+
fileExt: ['.js'],
|
|
133
|
+
cleanFiles: ['./public/electron'],
|
|
134
|
+
specificFiles: ['./public/electron/preload/bridge.js'],
|
|
135
|
+
encryptDir: './',
|
|
136
|
+
confusionOptions: {
|
|
137
|
+
compact: true,
|
|
138
|
+
stringArray: true,
|
|
139
|
+
stringArrayEncoding: ['rc4'],
|
|
140
|
+
deadCodeInjection: false,
|
|
141
|
+
stringArrayCallsTransform: true,
|
|
142
|
+
numbersToExpressions: true,
|
|
143
|
+
target: 'node',
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
exec: {},
|
|
148
|
+
};
|
|
149
|
+
//# sourceMappingURL=bin_default.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin_default.js","sourceRoot":"","sources":["../../../src/config/bin_default.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,GAAG,EAAE;QACH,QAAQ,EAAE;YACR,SAAS,EAAE,YAAY;YACvB,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;YACpB,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE,WAAW;YACrB,IAAI,EAAE,IAAI;YACV,SAAS,EAAE,YAAY;YACvB,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,KAAK;SACZ;QACD,QAAQ,EAAE;YACR,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,UA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ChB,OAAO,EAAE,IAAI;gBACb,WAAW,EAAE,IAAI;gBACjB,mBAAmB,EAAE,CAAC,MAAM,CAAC;gBAC7B,iBAAiB,EAAE,KAAK;gBACxB,yBAAyB,EAAE,IAAI;gBAC/B,oBAAoB,EAAE,IAAI;gBAC1B,MAAM,EAAE,SAAS;aAClB;SACF;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,CAAC,kCAAkC,CAAC;YAC3C,OAAO,EAAE,CAAC,KAAK,CAAC;YAChB,UAAU,EAAE,CAAC,mBAAmB,CAAC;YACjC,aAAa,EAAE,CAAC,qCAAqC,CAAC;YACtD,UAAU,EAAE,IAAI;YAChB,gBAAgB,EAAE;gBAChB,OAAO,EAAE,IAAI;gBACb,WAAW,EAAE,IAAI;gBACjB,mBAAmB,EAAE,CAAC,KAAK,CAAC;gBAC5B,iBAAiB,EAAE,KAAK;gBACxB,yBAAyB,EAAE,IAAI;gBAC/B,oBAAoB,EAAE,IAAI;gBAC1B,MAAM,EAAE,MAAM;aACf;SACF;KACF;IAED,IAAI,EAAE,EAAE;CACT,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const helpers_js_1 = require("./lib/helpers.js");
|
|
6
|
+
const serve_js_1 = require("./tools/serve.js");
|
|
7
|
+
const move_js_1 = require("./tools/move.js");
|
|
8
|
+
const encrypt_js_1 = require("./tools/encrypt.js");
|
|
9
|
+
const incrUpdater_js_1 = require("./tools/incrUpdater.js");
|
|
10
|
+
const iconGen_js_1 = require("./tools/iconGen.js");
|
|
11
|
+
commander_1.program
|
|
12
|
+
.name('ee-bin')
|
|
13
|
+
.description('CLI for ee development')
|
|
14
|
+
.version('5.0.0');
|
|
15
|
+
commander_1.program
|
|
16
|
+
.command('dev')
|
|
17
|
+
.description('create frontend-serve and electron-serve')
|
|
18
|
+
.option('--config <folder>', 'config file')
|
|
19
|
+
.option('--serve <mode>', 'serve mode')
|
|
20
|
+
.action(function () {
|
|
21
|
+
serve_js_1.serveProcess.dev(this.opts());
|
|
22
|
+
});
|
|
23
|
+
commander_1.program
|
|
24
|
+
.command('build')
|
|
25
|
+
.description('building multiple resources')
|
|
26
|
+
.option('--config <folder>', 'config file')
|
|
27
|
+
.option('--cmds <flag>', 'custom commands')
|
|
28
|
+
.option('--env <env>', 'environment')
|
|
29
|
+
.action(function () {
|
|
30
|
+
serve_js_1.serveProcess.build(this.opts());
|
|
31
|
+
});
|
|
32
|
+
commander_1.program
|
|
33
|
+
.command('start')
|
|
34
|
+
.description('preview effect')
|
|
35
|
+
.option('--config <folder>', 'config file')
|
|
36
|
+
.action(function () {
|
|
37
|
+
serve_js_1.serveProcess.start(this.opts());
|
|
38
|
+
});
|
|
39
|
+
commander_1.program
|
|
40
|
+
.command('exec')
|
|
41
|
+
.description('execute custom commands')
|
|
42
|
+
.option('--config <folder>', 'config file')
|
|
43
|
+
.option('--cmds <flag>', 'custom commands')
|
|
44
|
+
.action(function () {
|
|
45
|
+
serve_js_1.serveProcess.exec(this.opts());
|
|
46
|
+
});
|
|
47
|
+
commander_1.program
|
|
48
|
+
.command('move')
|
|
49
|
+
.description('Move multip resources')
|
|
50
|
+
.option('--config <folder>', 'config file')
|
|
51
|
+
.option('--flag <flag>', 'resource flag')
|
|
52
|
+
.action(function () {
|
|
53
|
+
(0, move_js_1.move)(this.opts());
|
|
54
|
+
});
|
|
55
|
+
commander_1.program
|
|
56
|
+
.command('encrypt')
|
|
57
|
+
.description('Code encryption')
|
|
58
|
+
.option('--config <folder>', 'config file')
|
|
59
|
+
.option('--out <folder>', 'output directory')
|
|
60
|
+
.action(function () {
|
|
61
|
+
(0, encrypt_js_1.encrypt)(this.opts());
|
|
62
|
+
});
|
|
63
|
+
commander_1.program
|
|
64
|
+
.command('clean')
|
|
65
|
+
.description('Clear the encrypted code')
|
|
66
|
+
.option('-d, --dir <folder>', 'clean directory')
|
|
67
|
+
.action(function () {
|
|
68
|
+
(0, encrypt_js_1.cleanEncrypt)(this.opts());
|
|
69
|
+
});
|
|
70
|
+
commander_1.program
|
|
71
|
+
.command('icon')
|
|
72
|
+
.description('Generate logo')
|
|
73
|
+
.option('-i, --input <file>', 'image file default /public/images/logo.png')
|
|
74
|
+
.option('-o, --output <folder>', 'output directory default /build/icons/')
|
|
75
|
+
.option('-s, --size <flag>', 'generate size default 16,32,64,256,512')
|
|
76
|
+
.option('-c, --clear', 'clear output directory first')
|
|
77
|
+
.option('-m, --images <flag>', 'Win window icon/tray image generation path default /public/images/')
|
|
78
|
+
.action(function () {
|
|
79
|
+
(0, iconGen_js_1.run)(this.opts());
|
|
80
|
+
});
|
|
81
|
+
commander_1.program
|
|
82
|
+
.command('updater')
|
|
83
|
+
.description('updater commands')
|
|
84
|
+
.option('--config <folder>', 'config file')
|
|
85
|
+
.option('--asar-file <file>', 'asar file path')
|
|
86
|
+
.option('--platform <flag>', 'platform')
|
|
87
|
+
.option('--force <flag>', 'force update full')
|
|
88
|
+
.action(async function () {
|
|
89
|
+
await incrUpdater_js_1.incrUpdater.run(this.opts());
|
|
90
|
+
});
|
|
91
|
+
commander_1.program.parse();
|
|
92
|
+
if (!process.argv.slice(2).length) {
|
|
93
|
+
commander_1.program.outputHelp((text) => {
|
|
94
|
+
console.log(helpers_js_1.chalk.green(text));
|
|
95
|
+
return text;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAEA,yCAA6C;AAC7C,iDAAyC;AACzC,+CAAgD;AAChD,6CAAuC;AACvC,mDAA2D;AAC3D,2DAAqD;AACrD,mDAAuD;AAEvD,mBAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,W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AAM,CAAC,oBAAoB,EAAE,gBAAgB,CAAC;KAC9C,MAAM,CAAC,mBAAmB,EAAE,UAAU,CAAC;KACvC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;KAC7C,MAAM,CAAC,KAAK;IACX,MAAM,4BAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AACrC,CAAC,CAAC,CAAC;AAEL,mBAAO,CAAC,KAAK,EAAE,CAAC;AAEhB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,mBAAO,CAAC,UAAU,CAAC,CAAC,IAAY,EAAE,EAAE;QAClC,OAAO,CAAC,GAAG,CAAC,kBAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPlainObject = isPlainObject;
|
|
4
|
+
exports.extend = extend;
|
|
5
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
6
|
+
const toStr = Object.prototype.toString;
|
|
7
|
+
function isPlainObject(obj) {
|
|
8
|
+
if (!obj || toStr.call(obj) !== '[object Object]') {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
const plainObj = obj;
|
|
12
|
+
const hasOwnConstructor = hasOwn.call(plainObj, 'constructor');
|
|
13
|
+
const hasIsPrototypeOf = plainObj.constructor &&
|
|
14
|
+
plainObj.constructor.prototype &&
|
|
15
|
+
hasOwn.call(plainObj.constructor.prototype, 'isPrototypeOf');
|
|
16
|
+
if (plainObj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
let key;
|
|
20
|
+
for (key in plainObj) {
|
|
21
|
+
// empty
|
|
22
|
+
}
|
|
23
|
+
return typeof key === 'undefined' || hasOwn.call(plainObj, key);
|
|
24
|
+
}
|
|
25
|
+
function extend(deep, target, ...sources) {
|
|
26
|
+
let result = { ...target };
|
|
27
|
+
for (const options of sources) {
|
|
28
|
+
if (!options)
|
|
29
|
+
continue;
|
|
30
|
+
for (const name of Object.keys(options)) {
|
|
31
|
+
if (name === '__proto__')
|
|
32
|
+
continue;
|
|
33
|
+
const src = result[name];
|
|
34
|
+
const copy = options[name];
|
|
35
|
+
if (result === copy)
|
|
36
|
+
continue;
|
|
37
|
+
if (deep && copy && isPlainObject(copy)) {
|
|
38
|
+
const clone = src && isPlainObject(src) ? src : {};
|
|
39
|
+
result[name] = extend(true, clone, copy);
|
|
40
|
+
}
|
|
41
|
+
else if (typeof copy !== 'undefined') {
|
|
42
|
+
result[name] = copy;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=extend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extend.js","sourceRoot":"","sources":["../../../src/lib/extend.ts"],"names":[],"mappings":";;AAGA,sCAsBC;AAED,wBA4BC;AAvDD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;AAExC,SAAgB,aAAa,CAAC,GAAY;IACxC,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,iBAAiB,EAAE,CAAC;QAClD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,QAAQ,GAAG,GAA8B,CAAC;IAChD,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAC/D,MAAM,gBAAgB,GACpB,QAAQ,CAAC,WAAW;QACnB,QAAQ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,KAAK,WAAW,EAAE,CAAC;gBACvC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Local helpers replacing unnecessary npm dependencies.
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.chalk = exports.is = void 0;
|
|
10
|
+
exports.copyDirSync = copyDirSync;
|
|
11
|
+
exports.createDebug = createDebug;
|
|
12
|
+
exports.formatCmds = formatCmds;
|
|
13
|
+
const fs_1 = __importDefault(require("fs"));
|
|
14
|
+
const path_1 = __importDefault(require("path"));
|
|
15
|
+
// ─── type checks (replacing is-type-of) ────────────────────
|
|
16
|
+
exports.is = {
|
|
17
|
+
function(val) {
|
|
18
|
+
return typeof val === 'function';
|
|
19
|
+
},
|
|
20
|
+
class(val) {
|
|
21
|
+
return typeof val === 'function' && val.toString().startsWith('class ');
|
|
22
|
+
},
|
|
23
|
+
string(val) {
|
|
24
|
+
return typeof val === 'string';
|
|
25
|
+
},
|
|
26
|
+
array(val) {
|
|
27
|
+
return Array.isArray(val);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
// ─── chalk (ANSI escape codes) ─────────────────────────────
|
|
31
|
+
const RESET = '\x1b[0m';
|
|
32
|
+
function ansi(code, text) {
|
|
33
|
+
return code + text + RESET;
|
|
34
|
+
}
|
|
35
|
+
exports.chalk = {
|
|
36
|
+
blue: (text) => ansi('\x1b[34m', text),
|
|
37
|
+
green: (text) => ansi('\x1b[32m', text),
|
|
38
|
+
red: (text) => ansi('\x1b[31m', text),
|
|
39
|
+
cyan: (text) => ansi('\x1b[36m', text),
|
|
40
|
+
magenta: (text) => ansi('\x1b[35m', text),
|
|
41
|
+
yellow: (text) => ansi('\x1b[33m', text),
|
|
42
|
+
bgRed: (text) => ansi('\x1b[41m', text),
|
|
43
|
+
bgYellow: (text) => ansi('\x1b[43m', text),
|
|
44
|
+
};
|
|
45
|
+
// ─── fs-extra ──────────────────────────────────────────────
|
|
46
|
+
function copyDirSync(src, dest) {
|
|
47
|
+
if (fs_1.default.statSync(src).isFile()) {
|
|
48
|
+
fs_1.default.mkdirSync(path_1.default.dirname(dest), { recursive: true });
|
|
49
|
+
fs_1.default.copyFileSync(src, dest);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
_copyDirRecursive(src, dest);
|
|
53
|
+
}
|
|
54
|
+
function _copyDirRecursive(src, dest) {
|
|
55
|
+
fs_1.default.mkdirSync(dest, { recursive: true });
|
|
56
|
+
const entries = fs_1.default.readdirSync(src, { withFileTypes: true });
|
|
57
|
+
for (const entry of entries) {
|
|
58
|
+
const srcPath = path_1.default.join(src, entry.name);
|
|
59
|
+
const destPath = path_1.default.join(dest, entry.name);
|
|
60
|
+
if (entry.isDirectory()) {
|
|
61
|
+
_copyDirRecursive(srcPath, destPath);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
fs_1.default.copyFileSync(srcPath, destPath);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// ─── debug ─────────────────────────────────────────────────
|
|
69
|
+
function createDebug(namespace) {
|
|
70
|
+
const enabled = () => {
|
|
71
|
+
const dbg = process.env.DEBUG || '';
|
|
72
|
+
return dbg === '*' || dbg.split(',').some((ns) => {
|
|
73
|
+
if (ns.endsWith(':*'))
|
|
74
|
+
return namespace.startsWith(ns.slice(0, -1));
|
|
75
|
+
return ns === namespace;
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
return (...args) => {
|
|
79
|
+
if (enabled()) {
|
|
80
|
+
console.log(namespace, ...args);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
// ─── formatCmds ────────────────────────────────────────────
|
|
85
|
+
function formatCmds(command) {
|
|
86
|
+
const cmdString = command.trim();
|
|
87
|
+
if (cmdString.includes(',')) {
|
|
88
|
+
return cmdString.split(',');
|
|
89
|
+
}
|
|
90
|
+
return [cmdString];
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;AA2CH,kCAOC;AAkBD,kCAcC;AAID,gCAMC;AA1FD,4CAAoB;AACpB,gDAAwB;AAExB,8DAA8D;AAEjD,QAAA,EAAE,GAAG;IAChB,QAAQ,CAAC,GAAY;QACnB,OAAO,OAAO,GAAG,KAAK,UAAU,CAAC;IACnC,CAAC;IACD,KAAK,CAAC,GAAY;QAChB,OAAO,OAAO,GAAG,KAAK,UAAU,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC1E,CAAC;IACD,MAAM,CAAC,GAAY;QACjB,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC;IACjC,CAAC;IACD,KAAK,CAAC,GAAY;QAChB,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;CACF,CAAC;AAEF,8DAA8D;AAE9D,MAAM,KAAK,GAAG,SAAS,CAAC;AAExB,SAAS,IAAI,CAAC,IAAY,EAAE,IAAY;IACtC,OAAO,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAC7B,CAAC;AAEY,QAAA,KAAK,GAAG;IACnB,IAAI,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC;IAC9C,KAAK,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE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AAC;QAC5B,OAAO,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,CAAC,SAAS,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.loadConfig = loadConfig;
|
|
7
|
+
exports.loadFile = loadFile;
|
|
8
|
+
exports.rm = rm;
|
|
9
|
+
exports.readJsonSync = readJsonSync;
|
|
10
|
+
exports.writeJsonSync = writeJsonSync;
|
|
11
|
+
exports.getArgumentByName = getArgumentByName;
|
|
12
|
+
exports.getPlatform = getPlatform;
|
|
13
|
+
const helpers_js_1 = require("./helpers.js");
|
|
14
|
+
const path_1 = __importDefault(require("path"));
|
|
15
|
+
const fs_1 = __importDefault(require("fs"));
|
|
16
|
+
const helpers_js_2 = require("./helpers.js");
|
|
17
|
+
const helpers_js_3 = require("./helpers.js");
|
|
18
|
+
const json5_1 = __importDefault(require("json5"));
|
|
19
|
+
const bin_default_js_1 = __importDefault(require("../config/bin_default.js"));
|
|
20
|
+
const extend_js_1 = require("./extend.js");
|
|
21
|
+
const log = (0, helpers_js_1.createDebug)('ee-bin:lib:utils');
|
|
22
|
+
const _basePath = process.cwd();
|
|
23
|
+
const userBin = './cmd/bin.js';
|
|
24
|
+
function loadConfig(binFile) {
|
|
25
|
+
const binPath = binFile || userBin;
|
|
26
|
+
const userConfig = loadFile(binPath);
|
|
27
|
+
const result = (0, extend_js_1.extend)(true, { ...bin_default_js_1.default }, userConfig);
|
|
28
|
+
log('[loadConfig] bin:%j', result);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
function loadFile(filepath) {
|
|
32
|
+
const configFile = path_1.default.join(_basePath, filepath);
|
|
33
|
+
if (!fs_1.default.existsSync(configFile)) {
|
|
34
|
+
const errorTips = 'file ' + helpers_js_2.chalk.blue(`${configFile}`) + ' does not exist !';
|
|
35
|
+
throw new Error(errorTips);
|
|
36
|
+
}
|
|
37
|
+
let result;
|
|
38
|
+
if (configFile.endsWith('.json5') || configFile.endsWith('.json')) {
|
|
39
|
+
const data = fs_1.default.readFileSync(configFile, 'utf8');
|
|
40
|
+
return json5_1.default.parse(data);
|
|
41
|
+
}
|
|
42
|
+
if (configFile.endsWith('.js') || configFile.endsWith('.cjs')) {
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- dynamic user config loading
|
|
44
|
+
const mod = require(configFile);
|
|
45
|
+
result = mod.default != null ? mod.default : mod;
|
|
46
|
+
}
|
|
47
|
+
if (helpers_js_3.is.function(result) && !helpers_js_3.is.class(result)) {
|
|
48
|
+
result = result();
|
|
49
|
+
}
|
|
50
|
+
return result || {};
|
|
51
|
+
}
|
|
52
|
+
function rm(name) {
|
|
53
|
+
if (!fs_1.default.existsSync(name)) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
fs_1.default.rmSync(name, { recursive: true, force: true });
|
|
57
|
+
}
|
|
58
|
+
function readJsonSync(filepath, encoding = 'utf8') {
|
|
59
|
+
if (!fs_1.default.existsSync(filepath)) {
|
|
60
|
+
throw new Error(filepath + ' is not found');
|
|
61
|
+
}
|
|
62
|
+
return JSON.parse(fs_1.default.readFileSync(filepath, { encoding }));
|
|
63
|
+
}
|
|
64
|
+
function writeJsonSync(filepath, str, options) {
|
|
65
|
+
const opt = options || {};
|
|
66
|
+
if (!('space' in opt)) {
|
|
67
|
+
opt.space = 2;
|
|
68
|
+
}
|
|
69
|
+
fs_1.default.mkdirSync(path_1.default.dirname(filepath), { recursive: true });
|
|
70
|
+
let data;
|
|
71
|
+
if (typeof str === 'object') {
|
|
72
|
+
data = JSON.stringify(str, opt.replacer, opt.space) + '\n';
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
data = String(str);
|
|
76
|
+
}
|
|
77
|
+
fs_1.default.writeFileSync(filepath, data);
|
|
78
|
+
}
|
|
79
|
+
function getArgumentByName(name, args) {
|
|
80
|
+
if (!args) {
|
|
81
|
+
args = process.argv;
|
|
82
|
+
}
|
|
83
|
+
for (let i = 0; i < args.length; i++) {
|
|
84
|
+
const item = args[i];
|
|
85
|
+
if (!item)
|
|
86
|
+
continue;
|
|
87
|
+
const prefixKey = `--${name}=`;
|
|
88
|
+
if (item.indexOf(prefixKey) !== -1) {
|
|
89
|
+
return item.substring(prefixKey.length);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
function getPlatform(delimiter = '_', isDiffArch = false) {
|
|
95
|
+
if (process.platform === 'win32') {
|
|
96
|
+
let os = 'windows';
|
|
97
|
+
if (isDiffArch) {
|
|
98
|
+
os += delimiter + (process.arch === 'x64' ? '64' : '32');
|
|
99
|
+
}
|
|
100
|
+
return os;
|
|
101
|
+
}
|
|
102
|
+
if (process.platform === 'darwin') {
|
|
103
|
+
const core = process.arch === 'arm64' ? 'apple' : 'intel';
|
|
104
|
+
return 'macos' + delimiter + core;
|
|
105
|
+
}
|
|
106
|
+
return 'linux';
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":";;;;;AAaA,gCAOC;AAED,4BAqBC;AAED,gBAKC;AAED,oCAKC;AAED,sCAeC;AAED,8CAaC;AAED,kCAaC;AAxGD,6CAA2C;AAC3C,gDAAwB;AACxB,4CAAoB;AACpB,6CAAqC;AACrC,6CAAkC;AAClC,kDAA4B;AAC5B,8EAAqD;AACrD,2CAAqC;AAErC,MAAM,GAAG,GAAG,IAAA,wBAAW,EAAC,kBAAkB,CAAC,CAAC;AAC5C,MAAM,SAAS,GAAG,OAAO,CA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Z,CAAC;IACD,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QAC1D,OAAO,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IACpC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.encrypt = encrypt;
|
|
7
|
+
exports.cleanEncrypt = cleanEncrypt;
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const helpers_js_1 = require("../lib/helpers.js");
|
|
11
|
+
const bytenode_1 = __importDefault(require("bytenode"));
|
|
12
|
+
const javascript_obfuscator_1 = __importDefault(require("javascript-obfuscator"));
|
|
13
|
+
const globby_1 = __importDefault(require("globby"));
|
|
14
|
+
const utils_js_1 = require("../lib/utils.js");
|
|
15
|
+
const extend_js_1 = require("../lib/extend.js");
|
|
16
|
+
const EncryptTypes = ['bytecode', 'confusion', 'strict'];
|
|
17
|
+
class Encrypt {
|
|
18
|
+
constructor(options = {}) {
|
|
19
|
+
const { config, out, target } = options;
|
|
20
|
+
this.basePath = process.cwd();
|
|
21
|
+
this.target = target || 'electron';
|
|
22
|
+
const conf = ((0, utils_js_1.loadConfig)(config).encrypt || {});
|
|
23
|
+
this.config = conf[this.target] || {};
|
|
24
|
+
const outputFolder = out || this.config.encryptDir || './';
|
|
25
|
+
this.encryptDir = path_1.default.join(this.basePath, outputFolder);
|
|
26
|
+
this.filesExt = this.config.fileExt || ['.js'];
|
|
27
|
+
this.type = this.config.type || 'none';
|
|
28
|
+
this.bOpt = this.config.bytecodeOptions || {};
|
|
29
|
+
this.cOpt = this.config.confusionOptions || {};
|
|
30
|
+
this.patterns = this.config.files || null;
|
|
31
|
+
this.specFiles = this.config.specificFiles || [];
|
|
32
|
+
this.codefiles = this._initCodeFiles();
|
|
33
|
+
}
|
|
34
|
+
_initCodeFiles() {
|
|
35
|
+
if (!this.patterns)
|
|
36
|
+
return undefined;
|
|
37
|
+
const files = globby_1.default.sync(this.patterns, { cwd: this.basePath });
|
|
38
|
+
return files;
|
|
39
|
+
}
|
|
40
|
+
encrypt() {
|
|
41
|
+
if (!EncryptTypes.includes(this.type))
|
|
42
|
+
return;
|
|
43
|
+
if (this.target === 'frontend' && (this.type === 'bytecode' || this.type === 'strict'))
|
|
44
|
+
return;
|
|
45
|
+
console.log(helpers_js_1.chalk.blue('[ee-bin] [encrypt] ') + `start ciphering ${this.target}`);
|
|
46
|
+
if (!this.codefiles)
|
|
47
|
+
return;
|
|
48
|
+
for (const file of this.codefiles) {
|
|
49
|
+
const fullpath = path_1.default.join(this.encryptDir, file);
|
|
50
|
+
if (!fs_1.default.statSync(fullpath).isFile())
|
|
51
|
+
continue;
|
|
52
|
+
if (this.specFiles.includes(file)) {
|
|
53
|
+
this.generate(fullpath, 'confusion');
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
this.generate(fullpath);
|
|
57
|
+
}
|
|
58
|
+
console.log(helpers_js_1.chalk.blue('[ee-bin] [encrypt] ') + 'end ciphering');
|
|
59
|
+
}
|
|
60
|
+
generate(curPath, type) {
|
|
61
|
+
const encryptType = type || this.type;
|
|
62
|
+
const tips = helpers_js_1.chalk.blue('[ee-bin] [encrypt] ') +
|
|
63
|
+
'file: ' +
|
|
64
|
+
helpers_js_1.chalk.green(`${curPath}`) +
|
|
65
|
+
' ' +
|
|
66
|
+
helpers_js_1.chalk.cyan(`(${encryptType})`);
|
|
67
|
+
console.log(tips);
|
|
68
|
+
if (encryptType === 'strict') {
|
|
69
|
+
this.generateJSConfuseFile(curPath);
|
|
70
|
+
this.generateBytecodeFile(curPath);
|
|
71
|
+
}
|
|
72
|
+
else if (encryptType === 'bytecode') {
|
|
73
|
+
this.generateBytecodeFile(curPath);
|
|
74
|
+
}
|
|
75
|
+
else if (encryptType === 'confusion') {
|
|
76
|
+
this.generateJSConfuseFile(curPath);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
generateJSConfuseFile(file) {
|
|
80
|
+
const opt = Object.assign({
|
|
81
|
+
compact: true,
|
|
82
|
+
stringArray: true,
|
|
83
|
+
stringArrayThreshold: 1,
|
|
84
|
+
}, this.cOpt);
|
|
85
|
+
const code = fs_1.default.readFileSync(file, 'utf8');
|
|
86
|
+
const result = javascript_obfuscator_1.default.obfuscate(code, opt);
|
|
87
|
+
fs_1.default.writeFileSync(file, result.getObfuscatedCode(), 'utf8');
|
|
88
|
+
}
|
|
89
|
+
generateBytecodeFile(curPath) {
|
|
90
|
+
if (path_1.default.extname(curPath) !== '.js') {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const jscFile = curPath + 'c';
|
|
94
|
+
const opt = Object.assign({
|
|
95
|
+
filename: curPath,
|
|
96
|
+
output: jscFile,
|
|
97
|
+
electron: true,
|
|
98
|
+
}, this.bOpt);
|
|
99
|
+
bytenode_1.default.compileFile(opt);
|
|
100
|
+
fs_1.default.rmSync(curPath, { recursive: true, force: true });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function encrypt(options = {}) {
|
|
104
|
+
const electronOpt = (0, extend_js_1.extend)(true, { target: 'electron' }, options);
|
|
105
|
+
const electronEpt = new Encrypt(electronOpt);
|
|
106
|
+
electronEpt.encrypt();
|
|
107
|
+
const frontendOpt = (0, extend_js_1.extend)(true, { target: 'frontend' }, options);
|
|
108
|
+
const frontendEpt = new Encrypt(frontendOpt);
|
|
109
|
+
frontendEpt.encrypt();
|
|
110
|
+
}
|
|
111
|
+
function cleanEncrypt(options = {}) {
|
|
112
|
+
const dirs = options.dir !== undefined ? (helpers_js_1.is.array(options.dir) ? options.dir : [options.dir]) : ['./public/electron'];
|
|
113
|
+
for (const dir of dirs) {
|
|
114
|
+
const tmpFile = path_1.default.join(process.cwd(), dir);
|
|
115
|
+
if (fs_1.default.existsSync(tmpFile)) {
|
|
116
|
+
fs_1.default.rmSync(tmpFile, { recursive: true, force: true });
|
|
117
|
+
console.log(helpers_js_1.chalk.blue('[ee-bin] [encrypt] ') + 'clean up tmp files: ' + helpers_js_1.chalk.magenta(`${tmpFile}`));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=encrypt.js.map
|