@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.js CHANGED
@@ -83,11 +83,7 @@ __name(filterObject, "filterObject");
83
83
  // ../object/src/objSortKeys.ts
84
84
  function objSortKeys(o, compare) {
85
85
  const entries = Object.entries(o);
86
- if (compare) {
87
- entries.sort(compare);
88
- } else {
89
- entries.sort((a, b) => a[0].localeCompare(b[0]));
90
- }
86
+ entries.sort(compare ? compare : (a, b) => a[0].localeCompare(b[0]));
91
87
  return Object.fromEntries(entries);
92
88
  }
93
89
  __name(objSortKeys, "objSortKeys");
@@ -251,7 +247,7 @@ var TimeoutWeakMap = class {
251
247
  };
252
248
  function memoizeSync(arg = {}) {
253
249
  const opts = typeof arg === "object" ? arg : {
254
- maxAge: typeof arg === "number" ? arg : ms(arg)
250
+ maxAge: typeof arg === "number" ? arg : ms(arg) ?? 0
255
251
  };
256
252
  return /* @__PURE__ */ __name(function decorator(target, key, descriptor) {
257
253
  if (!descriptor) {
@@ -279,7 +275,7 @@ function memoizeSync(arg = {}) {
279
275
  __name(memoizeSync, "memoizeSync");
280
276
  function lazyProp(targetOrTimeout, key, descriptor) {
281
277
  if (typeof targetOrTimeout === "number" || typeof targetOrTimeout === "string") {
282
- const maxAge = typeof targetOrTimeout === "number" ? targetOrTimeout : ms(targetOrTimeout);
278
+ const maxAge = typeof targetOrTimeout === "number" ? targetOrTimeout : ms(targetOrTimeout) ?? 0;
283
279
  return createLazyPropDecorator(new TimeoutWeakMap(maxAge));
284
280
  } else {
285
281
  const decorator = createLazyPropDecorator(/* @__PURE__ */ new WeakMap());
@@ -307,13 +303,22 @@ __name(createLazyPropDecorator, "createLazyPropDecorator");
307
303
  // src/lib/Help.ts
308
304
  function _ts_decorate(decorators, target, key, desc) {
309
305
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
310
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
311
- 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;
306
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
307
+ r = Reflect.decorate(decorators, target, key, desc);
308
+ } else {
309
+ for (var i = decorators.length - 1; i >= 0; i--) {
310
+ if (d = decorators[i]) {
311
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
312
+ }
313
+ }
314
+ }
312
315
  return c > 3 && r && Object.defineProperty(target, key, r), r;
313
316
  }
314
317
  __name(_ts_decorate, "_ts_decorate");
315
- function _ts_metadata(k, v) {
316
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
318
+ function _ts_metadata(metadataKey, metadataValue) {
319
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
320
+ return Reflect.metadata(metadataKey, metadataValue);
321
+ }
317
322
  }
318
323
  __name(_ts_metadata, "_ts_metadata");
319
324
  var Help = class {
@@ -473,10 +478,7 @@ var Help = class {
473
478
  }
474
479
  if (extraInfo.length > 0) {
475
480
  const extraDescription = `(${extraInfo.join(", ")})`;
476
- if (option.description) {
477
- return `${option.description} ${extraDescription}`;
478
- }
479
- return extraDescription;
481
+ return option.description ? `${option.description} ${extraDescription}` : extraDescription;
480
482
  }
481
483
  return option.description ?? "";
482
484
  }
@@ -499,10 +501,7 @@ var Help = class {
499
501
  }
500
502
  if (extraInfo.length > 0) {
501
503
  const extraDescription = `(${extraInfo.join(", ")})`;
502
- if (argument.description) {
503
- return `${argument.description} ${extraDescription}`;
504
- }
505
- return extraDescription;
504
+ return argument.description ? `${argument.description} ${extraDescription}` : extraDescription;
506
505
  }
507
506
  return argument.description ?? "";
508
507
  }
@@ -510,10 +509,7 @@ var Help = class {
510
509
  * Format a list of items, given a heading and an array of formatted items.
511
510
  */
512
511
  formatItemList(heading, items) {
513
- if (items.length === 0) {
514
- return [];
515
- }
516
- return [
512
+ return items.length === 0 ? [] : [
517
513
  this.styleTitle(heading),
518
514
  ...items,
519
515
  ""
@@ -1051,7 +1047,7 @@ __name(createOption, "createOption");
1051
1047
 
1052
1048
  // src/lib/internal/findSubcommandIndex.ts
1053
1049
  function findSubcommandIndex(cmd, argv) {
1054
- const takesNext = /* @__PURE__ */ __name((next) => next !== void 0 && !isOptionLike(next) ? 1 : 0, "takesNext");
1050
+ const takesNext = /* @__PURE__ */ __name((next) => next === void 0 || isOptionLike(next) ? 0 : 1, "takesNext");
1055
1051
  for (let i = 0; i < argv.length; i++) {
1056
1052
  const word = argv[i];
1057
1053
  if (word === "--") {
@@ -1198,10 +1194,7 @@ function timer(arg, task) {
1198
1194
  log.start(description);
1199
1195
  }
1200
1196
  const retval = task(log, name);
1201
- if (!isPromise(retval)) {
1202
- return done(retval);
1203
- }
1204
- return retval.then((result) => done(result));
1197
+ return isPromise(retval) ? retval.then((result) => done(result)) : done(retval);
1205
1198
  function done(retval2) {
1206
1199
  if (process.exitCode) {
1207
1200
  return retval2;
@@ -1248,13 +1241,22 @@ __name(validateParsed, "validateParsed");
1248
1241
  // src/lib/Command.ts
1249
1242
  function _ts_decorate2(decorators, target, key, desc) {
1250
1243
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1251
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1252
- 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;
1244
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1245
+ r = Reflect.decorate(decorators, target, key, desc);
1246
+ } else {
1247
+ for (var i = decorators.length - 1; i >= 0; i--) {
1248
+ if (d = decorators[i]) {
1249
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1250
+ }
1251
+ }
1252
+ }
1253
1253
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1254
1254
  }
1255
1255
  __name(_ts_decorate2, "_ts_decorate");
1256
- function _ts_metadata2(k, v) {
1257
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1256
+ function _ts_metadata2(metadataKey, metadataValue) {
1257
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1258
+ return Reflect.metadata(metadataKey, metadataValue);
1259
+ }
1258
1260
  }
1259
1261
  __name(_ts_metadata2, "_ts_metadata");
1260
1262
  var builtinOptions = /* @__PURE__ */ new WeakSet();