ee-bin 5.0.0-beta.1 → 5.0.0-beta.5

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.
Files changed (73) hide show
  1. package/dist/cjs/config/bin_default.js +69 -29
  2. package/dist/cjs/config/bin_default.js.map +1 -1
  3. package/dist/cjs/index.js +125 -4
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/cjs/lib/extend.js +49 -15
  6. package/dist/cjs/lib/extend.js.map +1 -1
  7. package/dist/cjs/lib/helpers.js +71 -22
  8. package/dist/cjs/lib/helpers.js.map +1 -1
  9. package/dist/cjs/lib/utils.js +71 -30
  10. package/dist/cjs/lib/utils.js.map +1 -1
  11. package/dist/cjs/plugins/bundle_registry_plugin.js +156 -0
  12. package/dist/cjs/plugins/bundle_registry_plugin.js.map +1 -0
  13. package/dist/cjs/tools/encrypt.js +190 -29
  14. package/dist/cjs/tools/encrypt.js.map +1 -1
  15. package/dist/cjs/tools/iconGen.js +118 -30
  16. package/dist/cjs/tools/iconGen.js.map +1 -1
  17. package/dist/cjs/tools/incrUpdater.js +95 -33
  18. package/dist/cjs/tools/incrUpdater.js.map +1 -1
  19. package/dist/cjs/tools/move.js +71 -11
  20. package/dist/cjs/tools/move.js.map +1 -1
  21. package/dist/cjs/tools/serve.js +406 -81
  22. package/dist/cjs/tools/serve.js.map +1 -1
  23. package/dist/cjs/types/config.js +13 -0
  24. package/dist/cjs/types/config.js.map +1 -0
  25. package/dist/esm/config/bin_default.d.ts +19 -147
  26. package/dist/esm/config/bin_default.d.ts.map +1 -1
  27. package/dist/esm/config/bin_default.js +69 -29
  28. package/dist/esm/config/bin_default.js.map +1 -1
  29. package/dist/esm/index.d.ts +20 -0
  30. package/dist/esm/index.d.ts.map +1 -1
  31. package/dist/esm/index.js +125 -4
  32. package/dist/esm/index.js.map +1 -1
  33. package/dist/esm/lib/extend.d.ts +33 -0
  34. package/dist/esm/lib/extend.d.ts.map +1 -1
  35. package/dist/esm/lib/extend.js +49 -15
  36. package/dist/esm/lib/extend.js.map +1 -1
  37. package/dist/esm/lib/helpers.d.ts +44 -3
  38. package/dist/esm/lib/helpers.d.ts.map +1 -1
  39. package/dist/esm/lib/helpers.js +71 -22
  40. package/dist/esm/lib/helpers.js.map +1 -1
  41. package/dist/esm/lib/utils.d.ts +57 -3
  42. package/dist/esm/lib/utils.d.ts.map +1 -1
  43. package/dist/esm/lib/utils.js +71 -30
  44. package/dist/esm/lib/utils.js.map +1 -1
  45. package/dist/esm/plugins/bundle_registry_plugin.d.ts +33 -0
  46. package/dist/esm/plugins/bundle_registry_plugin.d.ts.map +1 -0
  47. package/dist/esm/plugins/bundle_registry_plugin.js +156 -0
  48. package/dist/esm/plugins/bundle_registry_plugin.js.map +1 -0
  49. package/dist/esm/tools/encrypt.d.ts +37 -1
  50. package/dist/esm/tools/encrypt.d.ts.map +1 -1
  51. package/dist/esm/tools/encrypt.js +190 -29
  52. package/dist/esm/tools/encrypt.js.map +1 -1
  53. package/dist/esm/tools/iconGen.d.ts +27 -1
  54. package/dist/esm/tools/iconGen.d.ts.map +1 -1
  55. package/dist/esm/tools/iconGen.js +118 -30
  56. package/dist/esm/tools/iconGen.js.map +1 -1
  57. package/dist/esm/tools/incrUpdater.d.ts +60 -13
  58. package/dist/esm/tools/incrUpdater.d.ts.map +1 -1
  59. package/dist/esm/tools/incrUpdater.js +95 -33
  60. package/dist/esm/tools/incrUpdater.js.map +1 -1
  61. package/dist/esm/tools/move.d.ts +41 -0
  62. package/dist/esm/tools/move.d.ts.map +1 -1
  63. package/dist/esm/tools/move.js +71 -11
  64. package/dist/esm/tools/move.js.map +1 -1
  65. package/dist/esm/tools/serve.d.ts +162 -25
  66. package/dist/esm/tools/serve.d.ts.map +1 -1
  67. package/dist/esm/tools/serve.js +406 -81
  68. package/dist/esm/tools/serve.js.map +1 -1
  69. package/dist/esm/types/config.d.ts +211 -0
  70. package/dist/esm/types/config.d.ts.map +1 -0
  71. package/dist/esm/types/config.js +13 -0
  72. package/dist/esm/types/config.js.map +1 -0
  73. package/package.json +16 -13
package/dist/esm/index.js CHANGED
@@ -1,5 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ /**
4
+ * ee-bin CLI Entry Point
5
+ *
6
+ * This is the main entry point for the ee-bin command-line tool. It defines all
7
+ * available CLI commands using the Commander.js framework and delegates execution
8
+ * to the appropriate tool modules.
9
+ *
10
+ * Available commands:
11
+ * dev - Start development mode (frontend dev server + Electron process)
12
+ * build - Build multiple resources (frontend, Electron bundle, platform packages)
13
+ * start - Start the application in production mode
14
+ * exec - Execute user-defined custom commands
15
+ * move - Move/copy resources (e.g. frontend dist to public directory)
16
+ * encrypt - Apply code encryption (obfuscation and/or bytecode compilation)
17
+ * clean - Remove encrypted output files
18
+ * icon - Generate application icons from a source image
19
+ * updater - Generate incremental update packages
20
+ *
21
+ * When invoked without any subcommand, the help text is displayed in green.
22
+ */
3
23
  Object.defineProperty(exports, "__esModule", { value: true });
4
24
  const commander_1 = require("commander");
5
25
  const helpers_js_1 = require("./lib/helpers.js");
@@ -12,6 +32,17 @@ commander_1.program
12
32
  .name('ee-bin')
13
33
  .description('CLI for ee development')
14
34
  .version('5.0.0');
35
+ /**
36
+ * dev command - Start development mode
37
+ *
38
+ * Launches both the frontend dev server and the Electron process concurrently.
39
+ * In dev mode, Electron code is first bundled via esbuild, then the process
40
+ * is spawned. Optionally enables file watching with auto-rebuild.
41
+ *
42
+ * Options:
43
+ * --config <folder> Path to custom bin.js config file
44
+ * --serve <mode> Comma-separated list of services to start (e.g. "frontend,electron")
45
+ */
15
46
  commander_1.program
16
47
  .command('dev')
17
48
  .description('create frontend-serve and electron-serve')
@@ -20,6 +51,18 @@ commander_1.program
20
51
  .action(function () {
21
52
  serve_js_1.serveProcess.dev(this.opts());
22
53
  });
54
+ /**
55
+ * build command - Build multiple resources
56
+ *
57
+ * Orchestrates the build pipeline: frontend build, Electron bundling, and
58
+ * platform-specific packaging via electron-builder. The --cmds flag specifies
59
+ * which build steps to execute (e.g. "frontend,electron,win64").
60
+ *
61
+ * Options:
62
+ * --config <folder> Path to custom bin.js config file
63
+ * --cmds <flag> Comma-separated build commands to execute
64
+ * --env <env> Node environment (default: "prod")
65
+ */
23
66
  commander_1.program
24
67
  .command('build')
25
68
  .description('building multiple resources')
@@ -29,6 +72,15 @@ commander_1.program
29
72
  .action(function () {
30
73
  serve_js_1.serveProcess.build(this.opts());
31
74
  });
75
+ /**
76
+ * start command - Preview the production build
77
+ *
78
+ * Starts the Electron application in production mode (NODE_ENV=prod).
79
+ * Assumes the project has already been built via the build command.
80
+ *
81
+ * Options:
82
+ * --config <folder> Path to custom bin.js config file
83
+ */
32
84
  commander_1.program
33
85
  .command('start')
34
86
  .description('preview effect')
@@ -36,6 +88,16 @@ commander_1.program
36
88
  .action(function () {
37
89
  serve_js_1.serveProcess.start(this.opts());
38
90
  });
91
+ /**
92
+ * exec command - Execute user-defined custom commands
93
+ *
94
+ * Runs arbitrary commands defined in the "exec" section of the user's bin.js
95
+ * configuration. Useful for project-specific scripts and tooling.
96
+ *
97
+ * Options:
98
+ * --config <folder> Path to custom bin.js config file
99
+ * --cmds <flag> Comma-separated command names to execute
100
+ */
39
101
  commander_1.program
40
102
  .command('exec')
41
103
  .description('execute custom commands')
@@ -44,6 +106,17 @@ commander_1.program
44
106
  .action(function () {
45
107
  serve_js_1.serveProcess.exec(this.opts());
46
108
  });
109
+ /**
110
+ * move command - Move/copy resources between directories
111
+ *
112
+ * Copies files or directories as specified in the "move" section of bin.js.
113
+ * Typically used to move frontend build output to the public directory
114
+ * so Electron can load it.
115
+ *
116
+ * Options:
117
+ * --config <folder> Path to custom bin.js config file
118
+ * --flag <flag> Comma-separated move config keys to execute
119
+ */
47
120
  commander_1.program
48
121
  .command('move')
49
122
  .description('Move multip resources')
@@ -52,14 +125,34 @@ commander_1.program
52
125
  .action(function () {
53
126
  (0, move_js_1.move)(this.opts());
54
127
  });
128
+ /**
129
+ * encrypt command - Apply code encryption
130
+ *
131
+ * Encrypts JavaScript files using obfuscation (javascript-obfuscator) and/or
132
+ * bytecode compilation (bytenode). Processes both frontend and Electron targets
133
+ * independently, each with its own encryption strategy.
134
+ *
135
+ * Options:
136
+ * --config <folder> Path to custom bin.js config file
137
+ * --out <folder> Output directory override (defaults to encryptDir from config)
138
+ */
55
139
  commander_1.program
56
140
  .command('encrypt')
57
141
  .description('Code encryption')
58
142
  .option('--config <folder>', 'config file')
59
143
  .option('--out <folder>', 'output directory')
60
- .action(function () {
61
- (0, encrypt_js_1.encrypt)(this.opts());
144
+ .action(async function () {
145
+ await (0, encrypt_js_1.encrypt)(this.opts());
62
146
  });
147
+ /**
148
+ * clean command - Remove encrypted output files
149
+ *
150
+ * Deletes the directories containing encrypted/compiled output files,
151
+ * restoring the project to its pre-encryption state.
152
+ *
153
+ * Options:
154
+ * -d, --dir <folder> Directory to clean (defaults to "./public/electron")
155
+ */
63
156
  commander_1.program
64
157
  .command('clean')
65
158
  .description('Clear the encrypted code')
@@ -67,6 +160,20 @@ commander_1.program
67
160
  .action(function () {
68
161
  (0, encrypt_js_1.cleanEncrypt)(this.opts());
69
162
  });
163
+ /**
164
+ * icon command - Generate application icons
165
+ *
166
+ * Takes a source image (typically a PNG) and generates all required icon sizes
167
+ * for the target platforms: .ico for Windows, .icns for macOS, and various
168
+ * PNG sizes. Also produces tray icons and window icons for the Electron app.
169
+ *
170
+ * Options:
171
+ * -i, --input <file> Source image file (default: /public/images/logo.png)
172
+ * -o, --output <folder> Output directory (default: /build/icons/)
173
+ * -s, --size <flag> Comma-separated icon sizes (default: 16,32,64,256,512)
174
+ * -c, --clear Clear output directory before generating
175
+ * -m, --images <flag> Path for Win window icon/tray images (default: /public/images/)
176
+ */
70
177
  commander_1.program
71
178
  .command('icon')
72
179
  .description('Generate logo')
@@ -75,9 +182,22 @@ commander_1.program
75
182
  .option('-s, --size <flag>', 'generate size default 16,32,64,256,512')
76
183
  .option('-c, --clear', 'clear output directory first')
77
184
  .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());
185
+ .action(async function () {
186
+ await (0, iconGen_js_1.run)(this.opts());
80
187
  });
188
+ /**
189
+ * updater command - Generate incremental update packages
190
+ *
191
+ * Creates incremental update zip files containing only the changed files from
192
+ * the asar package, along with JSON metadata for the update checker. Supports
193
+ * per-platform configuration and optional full-update forcing.
194
+ *
195
+ * Options:
196
+ * --config <folder> Path to custom bin.js config file
197
+ * --asar-file <file> Path to the asar package file
198
+ * --platform <flag> Target platform (e.g. "mac", "win64", "linux")
199
+ * --force <flag> Force full update ("true" to enable)
200
+ */
81
201
  commander_1.program
82
202
  .command('updater')
83
203
  .description('updater commands')
@@ -89,6 +209,7 @@ commander_1.program
89
209
  await incrUpdater_js_1.incrUpdater.run(this.opts());
90
210
  });
91
211
  commander_1.program.parse();
212
+ // Display help text in green when invoked with no subcommand
92
213
  if (!process.argv.slice(2).length) {
93
214
  commander_1.program.outputHelp((text) => {
94
215
  console.log(helpers_js_1.chalk.green(text));
@@ -1 +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,WAAW,CAAC,wBAAwB,CAAC;KACrC,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,mBAAO;KACJ,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,0CAA0C,CAAC;KACvD,MAAM,CAAC,mBAAmB,EAAE,aAAa,CAAC;KAC1C,MAAM,CAAC,gBAAgB,EAAE,YAAY,CAAC;KACtC,MAAM,CAAC;IACN,uBAAY,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AAChC,CAAC,CAAC,CA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AI,CAAC,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,3 +1,36 @@
1
+ /**
2
+ * Deep Merge Utility — replaces lodash.merge
3
+ *
4
+ * Why a custom implementation instead of lodash:
5
+ * 1. lodash.merge merges array indices (merging [a] and [b] yields [a+b] instead of [b]),
6
+ * which is not the expected behavior for config merging — user config should fully
7
+ * override default arrays, not merge them element-by-element.
8
+ * 2. lodash does not have built-in prototype pollution protection; extra configuration needed.
9
+ * 3. Only deep merge is needed — importing the entire lodash package is not worth it.
10
+ *
11
+ * Behavior of this implementation:
12
+ * - Object-type properties → recursively deep merge
13
+ * - Non-object-type properties → direct override (arrays are also overridden, not index-merged)
14
+ * - Safety guard → rejects __proto__, constructor, prototype keys to prevent prototype pollution
15
+ */
16
+ /**
17
+ * Check whether a value is a plain object (created via {} or Object.create(null)).
18
+ * Excludes arrays, Date, RegExp, Map, Set, and other objects with special prototype chains.
19
+ */
1
20
  export declare function isPlainObject(obj: unknown): obj is Record<string, unknown>;
21
+ /**
22
+ * Recursively deep merge configuration objects
23
+ *
24
+ * @param deep - true for deep merge (recursive for objects), false for shallow merge (direct override)
25
+ * @param target - Merge target (typically the default config)
26
+ * @param sources - Merge sources (typically the user config); undefined/null sources are skipped
27
+ * @returns A new merged object (does not mutate the original target)
28
+ *
29
+ * Key behaviors:
30
+ * - Non-object properties in source directly override target properties (including arrays)
31
+ * - Plain object properties in source are recursively merged with plain object properties in target
32
+ * - If the target property is not a plain object, the source object completely overrides it (no merge)
33
+ * - Filters __proto__/constructor/prototype keys to prevent prototype pollution attacks
34
+ */
2
35
  export declare function extend<T extends Record<string, unknown>>(deep: boolean, target: T, ...sources: Array<Record<string, unknown> | undefined | null>): T;
3
36
  //# sourceMappingURL=extend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extend.d.ts","sourceRoot":"","sources":["../../../src/lib/extend.ts"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsB1E;AAED,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtD,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,CAAC,EACT,GAAG,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,GAC5D,CAAC,CAwBH"}
1
+ {"version":3,"file":"extend.d.ts","sourceRoot":"","sources":["../../../src/lib/extend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAY1E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtD,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,CAAC,EACT,GAAG,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,GAC5D,CAAC,CAgCH"}
@@ -1,44 +1,78 @@
1
1
  "use strict";
2
+ /**
3
+ * Deep Merge Utility — replaces lodash.merge
4
+ *
5
+ * Why a custom implementation instead of lodash:
6
+ * 1. lodash.merge merges array indices (merging [a] and [b] yields [a+b] instead of [b]),
7
+ * which is not the expected behavior for config merging — user config should fully
8
+ * override default arrays, not merge them element-by-element.
9
+ * 2. lodash does not have built-in prototype pollution protection; extra configuration needed.
10
+ * 3. Only deep merge is needed — importing the entire lodash package is not worth it.
11
+ *
12
+ * Behavior of this implementation:
13
+ * - Object-type properties → recursively deep merge
14
+ * - Non-object-type properties → direct override (arrays are also overridden, not index-merged)
15
+ * - Safety guard → rejects __proto__, constructor, prototype keys to prevent prototype pollution
16
+ */
2
17
  Object.defineProperty(exports, "__esModule", { value: true });
3
18
  exports.isPlainObject = isPlainObject;
4
19
  exports.extend = extend;
5
- const hasOwn = Object.prototype.hasOwnProperty;
6
20
  const toStr = Object.prototype.toString;
21
+ /**
22
+ * Check whether a value is a plain object (created via {} or Object.create(null)).
23
+ * Excludes arrays, Date, RegExp, Map, Set, and other objects with special prototype chains.
24
+ */
7
25
  function isPlainObject(obj) {
8
26
  if (!obj || toStr.call(obj) !== '[object Object]') {
9
27
  return false;
10
28
  }
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);
29
+ const proto = Object.getPrototypeOf(obj);
30
+ // Objects created via Object.create(null) have no prototype, treat as plain object
31
+ if (proto === null)
32
+ return true;
33
+ // Plain objects have constructor === Object (excludes custom class instances, Date, etc.)
34
+ const Ctor = proto.constructor;
35
+ return typeof Ctor === 'function' && Ctor === Object;
24
36
  }
37
+ /**
38
+ * Recursively deep merge configuration objects
39
+ *
40
+ * @param deep - true for deep merge (recursive for objects), false for shallow merge (direct override)
41
+ * @param target - Merge target (typically the default config)
42
+ * @param sources - Merge sources (typically the user config); undefined/null sources are skipped
43
+ * @returns A new merged object (does not mutate the original target)
44
+ *
45
+ * Key behaviors:
46
+ * - Non-object properties in source directly override target properties (including arrays)
47
+ * - Plain object properties in source are recursively merged with plain object properties in target
48
+ * - If the target property is not a plain object, the source object completely overrides it (no merge)
49
+ * - Filters __proto__/constructor/prototype keys to prevent prototype pollution attacks
50
+ */
25
51
  function extend(deep, target, ...sources) {
26
52
  let result = { ...target };
27
53
  for (const options of sources) {
28
54
  if (!options)
29
55
  continue;
30
56
  for (const name of Object.keys(options)) {
31
- if (name === '__proto__')
57
+ // Block prototype pollution keys:
58
+ // __proto__ can modify object prototype,
59
+ // constructor can override the constructor function,
60
+ // prototype can pollute the global prototype chain.
61
+ if (name === '__proto__' || name === 'constructor' || name === 'prototype')
32
62
  continue;
33
63
  const src = result[name];
34
64
  const copy = options[name];
65
+ // Prevent infinite recursion from circular references
35
66
  if (result === copy)
36
67
  continue;
37
68
  if (deep && copy && isPlainObject(copy)) {
69
+ // Deep merge: if target property is also a plain object, recursively merge;
70
+ // otherwise use an empty {} as base (ensures all source properties take effect)
38
71
  const clone = src && isPlainObject(src) ? src : {};
39
72
  result[name] = extend(true, clone, copy);
40
73
  }
41
74
  else if (typeof copy !== 'undefined') {
75
+ // Non-deep merge or non-plain-object: direct override (arrays, strings, numbers, etc.)
42
76
  result[name] = copy;
43
77
  }
44
78
  }
@@ -1 +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,CAAC,WAAW,CAAC,SAAqC;QAC3D,MAAM,CAAC,IAAI,CAAC,QAAQ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ACzB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;YAE3B,sDAAsD;YACtD,IAAI,MAAM,KAAK,IAAI;gBAAE,SAAS;YAE9B,IAAI,IAAI,IAAI,IAAI,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxC,4EAA4E;gBAC5E,gFAAgF;gBAChF,MAAM,KAAK,GAAG,GAAG,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnD,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;YAC3C,CAAC;iBAAM,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE,CAAC;gBACvC,uFAAuF;gBACvF,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAW,CAAC;AACrB,CAAC"}
@@ -1,12 +1,27 @@
1
1
  /**
2
- * Local helpers replacing unnecessary npm dependencies.
2
+ * Local Helper Utilities — replaces unnecessary npm dependencies
3
+ *
4
+ * This module provides lightweight local implementations as alternatives to four npm packages,
5
+ * reducing dependency size and security risk:
6
+ * - is-type-of → is.function / is.class (only two checks needed)
7
+ * - chalk → ANSI escape code-based colored output (8 colors suffice)
8
+ * - fs-extra → copyDirSync recursive directory copy (only this one method needed)
9
+ * - debug → createDebug environment variable-based debug logging (with cache optimization)
10
+ *
11
+ * Also provides formatCmds for comma-separated command string parsing.
3
12
  */
4
13
  export declare const is: {
14
+ /** Check whether a value is a function (including async functions and generators) */
5
15
  function(val: unknown): boolean;
16
+ /**
17
+ * Check whether a value is an ES6 class.
18
+ * Uses toString() to check if the source code starts with 'class ', and verifies
19
+ * the prototype property exists. This double-check prevents false positives for
20
+ * regular functions (arrow functions and bound functions have no prototype).
21
+ */
6
22
  class(val: unknown): boolean;
7
- string(val: unknown): boolean;
8
- array(val: unknown): boolean;
9
23
  };
24
+ /** Minimal chalk replacement, providing the 8 colors needed for ee-bin logging */
10
25
  export declare const chalk: {
11
26
  blue: (text: string) => string;
12
27
  green: (text: string) => string;
@@ -17,7 +32,33 @@ export declare const chalk: {
17
32
  bgRed: (text: string) => string;
18
33
  bgYellow: (text: string) => string;
19
34
  };
35
+ /**
36
+ * Synchronously copy a file or directory.
37
+ * Automatically determines src type: files are copied directly, directories are copied recursively.
38
+ */
20
39
  export declare function copyDirSync(src: string, dest: string): void;
40
+ /**
41
+ * Create a namespace-scoped debug log function
42
+ *
43
+ * Controlled by the process.env.DEBUG environment variable:
44
+ * - DEBUG=* → enable all namespaces
45
+ * - DEBUG=ee-bin:* → enable all ee-bin sub-namespaces
46
+ * - DEBUG=ee-bin:serve → enable only the serve namespace
47
+ *
48
+ * Includes cache optimization: the enabled state is only recalculated when
49
+ * the DEBUG environment variable changes, avoiding re-parsing the env string
50
+ * on every log call.
51
+ */
21
52
  export declare function createDebug(namespace: string): (...args: unknown[]) => void;
53
+ /**
54
+ * Parse a comma-separated command string into an array of commands
55
+ *
56
+ * Processing rules:
57
+ * - Empty string → []
58
+ * - No comma → single-element array
59
+ * - With comma → split, trim each item, and filter out empty values
60
+ * Example: "frontend, electron" → ["frontend", "electron"]
61
+ * Example: "frontend,,electron" → ["frontend", "electron"]
62
+ */
22
63
  export declare function formatCmds(command: string): string[];
23
64
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,eAAO,MAAM,EAAE;kBACC,OAAO,GAAG,OAAO;eAGpB,OAAO,GAAG,OAAO;gBAGhB,OAAO,GAAG,OAAO;eAGlB,OAAO,GAAG,OAAO;CAG7B,CAAC;AAUF,eAAO,MAAM,KAAK;iBACH,MAAM;kBACL,MAAM;gBACR,MAAM;iBACL,MAAM;oBACH,MAAM;mBACP,MAAM;kBACP,MAAM;qBACH,MAAM;CACxB,CAAC;AAIF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAO3D;AAkBD,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAc3E;AAID,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAMpD"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,eAAO,MAAM,EAAE;IACb,qFAAqF;kBACvE,OAAO,GAAG,OAAO;IAG/B;;;;;OAKG;eACQ,OAAO,GAAG,OAAO;CAG7B,CAAC;AAWF,kFAAkF;AAClF,eAAO,MAAM,KAAK;iBACH,MAAM;kBACL,MAAM;gBACR,MAAM;iBACL,MAAM;oBACH,MAAM;mBACP,MAAM;kBACP,MAAM;qBACH,MAAM;CACxB,CAAC;AAIF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAO3D;AAmBD;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAuB3E;AAID;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAOpD"}
@@ -1,6 +1,15 @@
1
1
  "use strict";
2
2
  /**
3
- * Local helpers replacing unnecessary npm dependencies.
3
+ * Local Helper Utilities — replaces unnecessary npm dependencies
4
+ *
5
+ * This module provides lightweight local implementations as alternatives to four npm packages,
6
+ * reducing dependency size and security risk:
7
+ * - is-type-of → is.function / is.class (only two checks needed)
8
+ * - chalk → ANSI escape code-based colored output (8 colors suffice)
9
+ * - fs-extra → copyDirSync recursive directory copy (only this one method needed)
10
+ * - debug → createDebug environment variable-based debug logging (with cache optimization)
11
+ *
12
+ * Also provides formatCmds for comma-separated command string parsing.
4
13
  */
5
14
  var __importDefault = (this && this.__importDefault) || function (mod) {
6
15
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -12,26 +21,29 @@ exports.createDebug = createDebug;
12
21
  exports.formatCmds = formatCmds;
13
22
  const fs_1 = __importDefault(require("fs"));
14
23
  const path_1 = __importDefault(require("path"));
15
- // ─── type checks (replacing is-type-of) ────────────────────
24
+ // ─── Type checking (replaces is-type-of) ──────────────────────────
16
25
  exports.is = {
26
+ /** Check whether a value is a function (including async functions and generators) */
17
27
  function(val) {
18
28
  return typeof val === 'function';
19
29
  },
30
+ /**
31
+ * Check whether a value is an ES6 class.
32
+ * Uses toString() to check if the source code starts with 'class ', and verifies
33
+ * the prototype property exists. This double-check prevents false positives for
34
+ * regular functions (arrow functions and bound functions have no prototype).
35
+ */
20
36
  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);
37
+ return typeof val === 'function' && val.toString().startsWith('class ') && !!val.prototype;
28
38
  },
29
39
  };
30
- // ─── chalk (ANSI escape codes) ─────────────────────────────
40
+ // ─── Colored output (replaces chalk, based on ANSI escape codes) ──
31
41
  const RESET = '\x1b[0m';
42
+ /** Wrap text with ANSI escape codes: prefix color code + content + reset code */
32
43
  function ansi(code, text) {
33
44
  return code + text + RESET;
34
45
  }
46
+ /** Minimal chalk replacement, providing the 8 colors needed for ee-bin logging */
35
47
  exports.chalk = {
36
48
  blue: (text) => ansi('\x1b[34m', text),
37
49
  green: (text) => ansi('\x1b[32m', text),
@@ -42,7 +54,11 @@ exports.chalk = {
42
54
  bgRed: (text) => ansi('\x1b[41m', text),
43
55
  bgYellow: (text) => ansi('\x1b[43m', text),
44
56
  };
45
- // ─── fs-extra ──────────────────────────────────────────────
57
+ // ─── Recursive directory copy (replaces fs-extra) ─────────────────
58
+ /**
59
+ * Synchronously copy a file or directory.
60
+ * Automatically determines src type: files are copied directly, directories are copied recursively.
61
+ */
46
62
  function copyDirSync(src, dest) {
47
63
  if (fs_1.default.statSync(src).isFile()) {
48
64
  fs_1.default.mkdirSync(path_1.default.dirname(dest), { recursive: true });
@@ -51,6 +67,7 @@ function copyDirSync(src, dest) {
51
67
  }
52
68
  _copyDirRecursive(src, dest);
53
69
  }
70
+ /** Recursively copy directory contents (internal implementation) */
54
71
  function _copyDirRecursive(src, dest) {
55
72
  fs_1.default.mkdirSync(dest, { recursive: true });
56
73
  const entries = fs_1.default.readdirSync(src, { withFileTypes: true });
@@ -65,27 +82,59 @@ function _copyDirRecursive(src, dest) {
65
82
  }
66
83
  }
67
84
  }
68
- // ─── debug ─────────────────────────────────────────────────
85
+ // ─── Debug logging (replaces debug npm package) ───────────────────
86
+ /**
87
+ * Create a namespace-scoped debug log function
88
+ *
89
+ * Controlled by the process.env.DEBUG environment variable:
90
+ * - DEBUG=* → enable all namespaces
91
+ * - DEBUG=ee-bin:* → enable all ee-bin sub-namespaces
92
+ * - DEBUG=ee-bin:serve → enable only the serve namespace
93
+ *
94
+ * Includes cache optimization: the enabled state is only recalculated when
95
+ * the DEBUG environment variable changes, avoiding re-parsing the env string
96
+ * on every log call.
97
+ */
69
98
  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
- });
99
+ let cachedDebugEnv;
100
+ let cachedEnabled = false;
101
+ /** Check whether the current DEBUG env enables this namespace (with caching) */
102
+ const checkEnabled = () => {
103
+ const currentEnv = process.env.DEBUG;
104
+ if (currentEnv !== cachedDebugEnv) {
105
+ cachedDebugEnv = currentEnv;
106
+ const dbg = currentEnv || '';
107
+ cachedEnabled = dbg === '*' || dbg.split(',').some((ns) => {
108
+ if (ns.endsWith(':*'))
109
+ return namespace.startsWith(ns.slice(0, -1));
110
+ return ns === namespace;
111
+ });
112
+ }
113
+ return cachedEnabled;
77
114
  };
78
115
  return (...args) => {
79
- if (enabled()) {
116
+ if (checkEnabled()) {
80
117
  console.log(namespace, ...args);
81
118
  }
82
119
  };
83
120
  }
84
- // ─── formatCmds ────────────────────────────────────────────
121
+ // ─── Command string parsing ───────────────────────────────────────
122
+ /**
123
+ * Parse a comma-separated command string into an array of commands
124
+ *
125
+ * Processing rules:
126
+ * - Empty string → []
127
+ * - No comma → single-element array
128
+ * - With comma → split, trim each item, and filter out empty values
129
+ * Example: "frontend, electron" → ["frontend", "electron"]
130
+ * Example: "frontend,,electron" → ["frontend", "electron"]
131
+ */
85
132
  function formatCmds(command) {
86
133
  const cmdString = command.trim();
134
+ if (cmdString === '')
135
+ return [];
87
136
  if (cmdString.includes(',')) {
88
- return cmdString.split(',');
137
+ return cmdString.split(',').map(s => s.trim()).filter(s => s.length > 0);
89
138
  }
90
139
  return [cmdString];
91
140
  }
@@ -1 +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;QACh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