ee-bin 5.0.0-beta.2 → 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
@@ -1,11 +1,30 @@
1
1
  "use strict";
2
+ /**
3
+ * ee-bin Default Configuration
4
+ *
5
+ * This module defines the default configuration values for the ee-bin CLI tool.
6
+ * It serves as the base layer for configuration merging — user-provided config
7
+ * from ./cmd/bin.js is deep-merged on top of these defaults via extend(), so
8
+ * user values always override corresponding default fields.
9
+ *
10
+ * Configuration structure (corresponds to BinConfig type):
11
+ * dev → Dev mode subprocess configs (frontend + Electron)
12
+ * build → Build configs (frontend build + Electron bundle + platform packaging commands)
13
+ * move → Resource move configs (frontend output → public directory)
14
+ * start → Production start config
15
+ * encrypt → Code encryption configs (frontend obfuscation + Electron obfuscation/bytecode)
16
+ * exec → Custom command configs (empty by default, user-defined)
17
+ */
2
18
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {
19
+ const config = {
20
+ // Dev mode configuration — each sub-command is independently configured.
21
+ // formatCmds() parses the command name and starts the corresponding process.
4
22
  dev: {
5
23
  frontend: {
6
24
  directory: './frontend',
7
25
  cmd: 'npm',
8
26
  args: ['run', 'dev'],
27
+ // Frontend dev server protocol. 'http://' means served via HTTP dev server.
9
28
  protocol: 'http://',
10
29
  hostname: 'localhost',
11
30
  port: 8080,
@@ -16,46 +35,40 @@ exports.default = {
16
35
  electron: {
17
36
  directory: './',
18
37
  cmd: 'electron',
19
- args: ['.', '--env=local', '--debugger=false'],
38
+ args: ['.', '--env=local'],
20
39
  loadingPage: '/public/html/loading.html',
40
+ // Whether to watch the electron directory for changes and auto-rebuild + restart
21
41
  watch: false,
22
42
  sync: false,
43
+ // Debounce delay in watch mode (milliseconds). Prevents rapid successive
44
+ // file changes from triggering multiple rebuilds.
23
45
  delay: 1000,
24
46
  },
25
47
  },
48
+ // Build configuration — the "electron" key is BundleConfig (esbuild bundling),
49
+ // all other keys are ExecConfig (command execution via child_process).
26
50
  build: {
51
+ // Frontend build: runs npm run build to produce dist output
27
52
  frontend: {
28
53
  directory: './frontend',
29
54
  cmd: 'npm',
30
55
  args: ['run', 'build'],
31
56
  },
57
+ // Electron main process bundle configuration
32
58
  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
- },
59
+ bundleType: 'bundle', // 'bundle' uses esbuild to bundle into a single file, 'copy' copies the directory as-is
60
+ external: [], // User-defined esbuild external packages (framework externals are added automatically by the bundler)
61
+ sourcemap: false, // false = auto mode (dev→inline sourcemap, prod→disabled); 'inline' | 'external' to force
62
+ minify: false, // Minify whitespace/identifiers/syntax (recommended for production)
63
+ keepNames: false, // Preserve original function/class names when minifying (eases error tracing)
64
+ drop: [], // Statement types to strip, e.g. ['console', 'debugger'] for production
65
+ legalComments: 'none', // License comment handling: 'inline' | 'eof' | 'none'
66
+ define: {}, // Compile-time global constants, e.g. { 'process.env.MY_VERSION': '"1.0.0"' }
67
+ copy: [], // Extra electron/ dirs/files copied to output (kept out of main.js); scripts transpiled, others verbatim
68
+ format: 'cjs', // Output format: 'cjs' (recommended for Electron main process) | 'esm'
58
69
  },
70
+ // Platform packaging commands — executed via electron-builder.
71
+ // Each platform has its own builder config file in ./cmd/.
59
72
  win32: {
60
73
  cmd: 'electron-builder',
61
74
  directory: './',
@@ -97,28 +110,38 @@ exports.default = {
97
110
  args: ['--config=./cmd/builder-linux.json', '-l=deb', '--arm64'],
98
111
  },
99
112
  },
113
+ // Resource move configuration — copies frontend build output to the public
114
+ // directory so Electron can load it as static assets.
100
115
  move: {
101
116
  frontend_dist: {
102
117
  src: './frontend/dist',
103
118
  dest: './public/dist',
104
119
  },
105
120
  },
121
+ // Production start configuration — runs Electron with prod environment
106
122
  start: {
107
123
  directory: './',
108
124
  cmd: 'electron',
109
125
  args: ['.', '--env=prod'],
110
126
  },
127
+ // Encryption configuration — frontend and electron each have independent strategies
111
128
  encrypt: {
129
+ // Frontend encryption: only supports 'confusion' (obfuscation), not 'bytecode'.
130
+ // Reason: bytecode compiles to V8 bytecode, but the browser renderer process
131
+ // runs a different V8 version than the compile-time V8, making bytecode incompatible.
112
132
  frontend: {
113
133
  type: 'none',
114
- files: ['./public/dist/**/*.(js|json)'],
134
+ files: ['./public/dist/**/*.js'],
115
135
  fileExt: ['.js'],
116
136
  cleanFiles: ['./public/dist'],
117
137
  specificFiles: [],
118
138
  encryptDir: './',
139
+ // Suppress javascript-obfuscator's promotional banner during confusion
140
+ silent: false,
119
141
  confusionOptions: {
120
142
  compact: true,
121
143
  stringArray: true,
144
+ // Frontend code is performance-sensitive, use 'none' encoding to avoid decode overhead
122
145
  stringArrayEncoding: ['none'],
123
146
  deadCodeInjection: false,
124
147
  stringArrayCallsTransform: true,
@@ -126,24 +149,41 @@ exports.default = {
126
149
  target: 'browser',
127
150
  },
128
151
  },
152
+ // Electron encryption: supports both 'confusion' and 'bytecode' (and 'strict' = both combined).
153
+ // target: 'node' because the Electron main process runs in a Node.js environment.
129
154
  electron: {
130
155
  type: 'none',
131
- files: ['./public/electron/**/*.(js|json)'],
156
+ files: ['./public/electron/**/*.js'],
132
157
  fileExt: ['.js'],
133
158
  cleanFiles: ['./public/electron'],
159
+ // bridge.js is a BrowserWindow preload script that must remain in readable format,
160
+ // so it is specifically listed to use confusion instead of bytecode.
134
161
  specificFiles: ['./public/electron/preload/bridge.js'],
162
+ // Electron's package entry must remain main.js; in bytecode/strict mode it becomes
163
+ // a tiny bytenode loader shell that requires main.jsc.
164
+ entryFiles: ['./public/electron/main.js'],
135
165
  encryptDir: './',
166
+ // Suppress javascript-obfuscator's promotional banner during confusion
167
+ silent: false,
136
168
  confusionOptions: {
137
169
  compact: true,
138
170
  stringArray: true,
171
+ // Electron main process can tolerate decode overhead, use 'rc4' encryption for stronger protection
139
172
  stringArrayEncoding: ['rc4'],
140
173
  deadCodeInjection: false,
141
174
  stringArrayCallsTransform: true,
142
175
  numbersToExpressions: true,
143
176
  target: 'node',
144
177
  },
178
+ // bytenode options for 'bytecode'/'strict' types. electron:true enables V8 bytecode
179
+ // compatibility for the Electron runtime; filename/output are set per-file by the encrypt module.
180
+ bytecodeOptions: {
181
+ electron: true,
182
+ },
145
183
  },
146
184
  },
185
+ // Custom command configuration — empty by default, user defines in ./cmd/bin.js
147
186
  exec: {},
148
187
  };
188
+ exports.default = config;
149
189
  //# sourceMappingURL=bin_default.js.map
@@ -1 +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,UAAU;YACf,IAAI,EAAE,CAAC,GAAG,EAAE,aAAa,EAAE,kBAAkB,CAAC;YAC9C,WAAW,EAAE,2BAA2B;YACxC,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,IAAI;SACZ;KACF;IAED,KAAK,EAAE;QACL,QAAQ,EAAE;YACR,SAAS,EAAE,YAAY;YACvB,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,CAAC,KAAK,E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,QAAQ,EAAE;YACR,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,CAAC,2BAA2B,CAAC;YACpC,OAAO,EAAE,CAAC,KAAK,CAAC;YAChB,UAAU,EAAE,CAAC,mBAAmB,CAAC;YACjC,mFAAmF;YACnF,qEAAqE;YACrE,aAAa,EAAE,CAAC,qCAAqC,CAAC;YACtD,mFAAmF;YACnF,uDAAuD;YACvD,UAAU,EAAE,CAAC,2BAA2B,CAAC;YACzC,UAAU,EAAE,IAAI;YAChB,uEAAuE;YACvE,MAAM,EAAE,KAAK;YACb,gBAAgB,EAAE;gBAChB,OAAO,EAAE,IAAI;gBACb,WAAW,EAAE,IAAI;gBACjB,mGAAmG;gBACnG,mBAAmB,EAAE,CAAC,KAAK,CAAC;gBAC5B,iBAAiB,EAAE,KAAK;gBACxB,yBAAyB,EAAE,IAAI;gBAC/B,oBAAoB,EAAE,IAAI;gBAC1B,MAAM,EAAE,MAAM;aACf;YACD,oFAAoF;YACpF,kGAAkG;YAClG,eAAe,EAAE;gBACf,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IAED,gFAAgF;IAChF,IAAI,EAAE,EAAE;CACT,CAAC;AAEF,kBAAe,MAAM,CAAC"}
package/dist/cjs/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,CAAC;AAEL,mBAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,mBAAmB,EAAE,aAAa,CAAC;KAC1C,MAAM,CAAC,eAAe,EAAE,iBAAiB,CAAC;KAC1C,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC;KACpC,MAAM,CAAC;IACN,uBAAY,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC;AAEL,mBAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,gBAAgB,CAAC;KAC7B,MAAM,CAAC,mBAAmB,EAAE,aAAa,CAAC;KAC1C,MAAM,CAAC;IACN,uBAAY,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AAClC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C,CAAC;AAChC,CAAC,CAAC,CAAC;AAEL;;;;;;;;;;;;GAYG;AACH,mBAAO;KACJ,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,kBAAkB,CAAC;KAC/B,MAAM,CAAC,mBAAmB,EAAE,aAAa,CAAC;KAC1C,MAAM,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,6DAA6D;AAC7D,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"}
@@ -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,CAAC,WAAW,CAAC,SAAS,EAAE,eAAe,CAAC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