@bemoje/cli 5.0.3 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs CHANGED
@@ -91,11 +91,7 @@ __name(filterObject, "filterObject");
91
91
  // ../object/src/objSortKeys.ts
92
92
  function objSortKeys(o, compare) {
93
93
  const entries = Object.entries(o);
94
- if (compare) {
95
- entries.sort(compare);
96
- } else {
97
- entries.sort((a, b) => a[0].localeCompare(b[0]));
98
- }
94
+ entries.sort(compare ? compare : (a, b) => a[0].localeCompare(b[0]));
99
95
  return Object.fromEntries(entries);
100
96
  }
101
97
  __name(objSortKeys, "objSortKeys");
@@ -259,7 +255,7 @@ var TimeoutWeakMap = class {
259
255
  };
260
256
  function memoizeSync(arg = {}) {
261
257
  const opts = typeof arg === "object" ? arg : {
262
- maxAge: typeof arg === "number" ? arg : enhancedMs.ms(arg)
258
+ maxAge: typeof arg === "number" ? arg : enhancedMs.ms(arg) ?? 0
263
259
  };
264
260
  return /* @__PURE__ */ __name(function decorator(target, key, descriptor) {
265
261
  if (!descriptor) {
@@ -287,7 +283,7 @@ function memoizeSync(arg = {}) {
287
283
  __name(memoizeSync, "memoizeSync");
288
284
  function lazyProp(targetOrTimeout, key, descriptor) {
289
285
  if (typeof targetOrTimeout === "number" || typeof targetOrTimeout === "string") {
290
- const maxAge = typeof targetOrTimeout === "number" ? targetOrTimeout : enhancedMs.ms(targetOrTimeout);
286
+ const maxAge = typeof targetOrTimeout === "number" ? targetOrTimeout : enhancedMs.ms(targetOrTimeout) ?? 0;
291
287
  return createLazyPropDecorator(new TimeoutWeakMap(maxAge));
292
288
  } else {
293
289
  const decorator = createLazyPropDecorator(/* @__PURE__ */ new WeakMap());
@@ -315,13 +311,22 @@ __name(createLazyPropDecorator, "createLazyPropDecorator");
315
311
  // src/lib/Help.ts
316
312
  function _ts_decorate(decorators, target, key, desc) {
317
313
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
318
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
319
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
314
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
315
+ r = Reflect.decorate(decorators, target, key, desc);
316
+ } else {
317
+ for (var i = decorators.length - 1; i >= 0; i--) {
318
+ if (d = decorators[i]) {
319
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
320
+ }
321
+ }
322
+ }
320
323
  return c > 3 && r && Object.defineProperty(target, key, r), r;
321
324
  }
322
325
  __name(_ts_decorate, "_ts_decorate");
323
- function _ts_metadata(k, v) {
324
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
326
+ function _ts_metadata(metadataKey, metadataValue) {
327
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
328
+ return Reflect.metadata(metadataKey, metadataValue);
329
+ }
325
330
  }
326
331
  __name(_ts_metadata, "_ts_metadata");
327
332
  var Help = class {
@@ -481,10 +486,7 @@ var Help = class {
481
486
  }
482
487
  if (extraInfo.length > 0) {
483
488
  const extraDescription = `(${extraInfo.join(", ")})`;
484
- if (option.description) {
485
- return `${option.description} ${extraDescription}`;
486
- }
487
- return extraDescription;
489
+ return option.description ? `${option.description} ${extraDescription}` : extraDescription;
488
490
  }
489
491
  return option.description ?? "";
490
492
  }
@@ -507,10 +509,7 @@ var Help = class {
507
509
  }
508
510
  if (extraInfo.length > 0) {
509
511
  const extraDescription = `(${extraInfo.join(", ")})`;
510
- if (argument.description) {
511
- return `${argument.description} ${extraDescription}`;
512
- }
513
- return extraDescription;
512
+ return argument.description ? `${argument.description} ${extraDescription}` : extraDescription;
514
513
  }
515
514
  return argument.description ?? "";
516
515
  }
@@ -518,10 +517,7 @@ var Help = class {
518
517
  * Format a list of items, given a heading and an array of formatted items.
519
518
  */
520
519
  formatItemList(heading, items) {
521
- if (items.length === 0) {
522
- return [];
523
- }
524
- return [
520
+ return items.length === 0 ? [] : [
525
521
  this.styleTitle(heading),
526
522
  ...items,
527
523
  ""
@@ -1059,7 +1055,7 @@ __name(createOption, "createOption");
1059
1055
 
1060
1056
  // src/lib/internal/findSubcommandIndex.ts
1061
1057
  function findSubcommandIndex(cmd, argv) {
1062
- const takesNext = /* @__PURE__ */ __name((next) => next !== void 0 && !isOptionLike(next) ? 1 : 0, "takesNext");
1058
+ const takesNext = /* @__PURE__ */ __name((next) => next === void 0 || isOptionLike(next) ? 0 : 1, "takesNext");
1063
1059
  for (let i = 0; i < argv.length; i++) {
1064
1060
  const word = argv[i];
1065
1061
  if (word === "--") {
@@ -1206,10 +1202,7 @@ function timer(arg, task) {
1206
1202
  log.start(description);
1207
1203
  }
1208
1204
  const retval = task(log, name);
1209
- if (!types.isPromise(retval)) {
1210
- return done(retval);
1211
- }
1212
- return retval.then((result) => done(result));
1205
+ return types.isPromise(retval) ? retval.then((result) => done(result)) : done(retval);
1213
1206
  function done(retval2) {
1214
1207
  if (process.exitCode) {
1215
1208
  return retval2;
@@ -1256,13 +1249,22 @@ __name(validateParsed, "validateParsed");
1256
1249
  // src/lib/Command.ts
1257
1250
  function _ts_decorate2(decorators, target, key, desc) {
1258
1251
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1259
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1260
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1252
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1253
+ r = Reflect.decorate(decorators, target, key, desc);
1254
+ } else {
1255
+ for (var i = decorators.length - 1; i >= 0; i--) {
1256
+ if (d = decorators[i]) {
1257
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1258
+ }
1259
+ }
1260
+ }
1261
1261
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1262
1262
  }
1263
1263
  __name(_ts_decorate2, "_ts_decorate");
1264
- function _ts_metadata2(k, v) {
1265
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1264
+ function _ts_metadata2(metadataKey, metadataValue) {
1265
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1266
+ return Reflect.metadata(metadataKey, metadataValue);
1267
+ }
1266
1268
  }
1267
1269
  __name(_ts_metadata2, "_ts_metadata");
1268
1270
  var builtinOptions = /* @__PURE__ */ new WeakSet();