@visulima/cerebro 1.1.39 → 1.1.40

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/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## @visulima/cerebro [1.1.40](https://github.com/visulima/visulima/compare/@visulima/cerebro@1.1.39...@visulima/cerebro@1.1.40) (2025-03-07)
2
+
3
+ ### Bug Fixes
4
+
5
+ * updated @visulima/packem and other dev deps, for better bundling size ([e940581](https://github.com/visulima/visulima/commit/e9405812201594e54dd81d17ddb74177df5f3c24))
6
+
7
+
8
+ ### Dependencies
9
+
10
+ * **@visulima/boxen:** upgraded to 1.0.30
11
+ * **@visulima/colorize:** upgraded to 1.4.21
12
+ * **@visulima/find-cache-dir:** upgraded to 1.0.28
13
+ * **@visulima/pail:** upgraded to 2.1.22
14
+ * **@visulima/path:** upgraded to 1.3.5
15
+
1
16
  ## @visulima/cerebro [1.1.39](https://github.com/visulima/visulima/compare/@visulima/cerebro@1.1.38...@visulima/cerebro@1.1.39) (2025-03-03)
2
17
 
3
18
  ### Bug Fixes
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const _default = require('./packem_shared/default-F355sbNC.cjs');
3
+ const _default = require('./packem_shared/default-Dh6tpT9Q.cjs');
4
4
 
5
5
 
6
6
 
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { Cli as default } from './packem_shared/default-E15sg8JS.mjs';
1
+ export { Cli as default } from './packem_shared/default-BkGsvBYT.mjs';
@@ -162,7 +162,7 @@ var __name$2 = (target, value) => __defProp$2(target, "name", { value, configura
162
162
  const FILE_NAME = "last-update-check.json";
163
163
  const getConfigFile = /* @__PURE__ */ __name$2((packageName) => {
164
164
  const cacheDirectory = findCacheDir.findCacheDirSync(packageName);
165
- if (cacheDirectory === undefined) {
165
+ if (cacheDirectory === void 0) {
166
166
  throw new Error("Could not find cache directory");
167
167
  }
168
168
  return join(cacheDirectory, FILE_NAME);
@@ -171,12 +171,12 @@ const getLastUpdate = /* @__PURE__ */ __name$2((packageName) => {
171
171
  const configFile = getConfigFile(packageName);
172
172
  try {
173
173
  if (!node_fs.existsSync(configFile)) {
174
- return undefined;
174
+ return void 0;
175
175
  }
176
176
  const { lastUpdateCheck } = JSON.parse(node_fs.readFileSync(configFile, "utf8"));
177
177
  return lastUpdateCheck;
178
178
  } catch {
179
- return undefined;
179
+ return void 0;
180
180
  }
181
181
  }, "getLastUpdate");
182
182
  const saveLastUpdate = /* @__PURE__ */ __name$2((packageName) => {
@@ -1,4 +1,4 @@
1
- import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'node:fs';
1
+ import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'node:fs';
2
2
  import { findCacheDirSync } from '@visulima/find-cache-dir';
3
3
  import { get } from 'node:https';
4
4
 
@@ -158,7 +158,7 @@ var __name$2 = (target, value) => __defProp$2(target, "name", { value, configura
158
158
  const FILE_NAME = "last-update-check.json";
159
159
  const getConfigFile = /* @__PURE__ */ __name$2((packageName) => {
160
160
  const cacheDirectory = findCacheDirSync(packageName);
161
- if (cacheDirectory === undefined) {
161
+ if (cacheDirectory === void 0) {
162
162
  throw new Error("Could not find cache directory");
163
163
  }
164
164
  return join(cacheDirectory, FILE_NAME);
@@ -167,12 +167,12 @@ const getLastUpdate = /* @__PURE__ */ __name$2((packageName) => {
167
167
  const configFile = getConfigFile(packageName);
168
168
  try {
169
169
  if (!existsSync(configFile)) {
170
- return undefined;
170
+ return void 0;
171
171
  }
172
172
  const { lastUpdateCheck } = JSON.parse(readFileSync(configFile, "utf8"));
173
173
  return lastUpdateCheck;
174
174
  } catch {
175
- return undefined;
175
+ return void 0;
176
176
  }
177
177
  }, "getLastUpdate");
178
178
  const saveLastUpdate = /* @__PURE__ */ __name$2((packageName) => {
@@ -1,4 +1,4 @@
1
- import { argv, cwd, env, execPath, execArgv, exit } from 'node:process';
1
+ import { cwd, argv, env, execPath, execArgv, exit } from 'node:process';
2
2
  import { boxen } from '@visulima/boxen';
3
3
  import { bold, dim, reset, green, yellow } from '@visulima/colorize';
4
4
  import { MessageFormatterProcessor, CallerProcessor } from '@visulima/pail/processor';
@@ -299,7 +299,7 @@ class OptionListSection extends BaseSection {
299
299
  definitions = definitions.filter((definition) => {
300
300
  const noGroupMatch = groups.includes("_none") && !definition.group;
301
301
  const groupMatch = this.intersect(Array.isArray(definition.group) ? definition.group : [definition.group], groups);
302
- return noGroupMatch || groupMatch ? definition : undefined;
302
+ return noGroupMatch || groupMatch ? definition : void 0;
303
303
  });
304
304
  }
305
305
  const table = new CliTable3({
@@ -421,7 +421,7 @@ const printGeneralHelp = /* @__PURE__ */ __name$g((logger, runtime, commands, gr
421
421
  commands.has("help") ? {
422
422
  header: "{inverse.yellow Command Options }",
423
423
  optionList: commands.get("help").options?.filter((option) => !option.hidden)
424
- } : undefined,
424
+ } : void 0,
425
425
  { header: "{inverse.yellow Global Options }", optionList: defaultOptions },
426
426
  {
427
427
  content: `Run "{cyan ${runtime.getCliName()}} {green help <command>}" or "{cyan ${runtime.getCliName()}} {green <command>} {yellow --help}" for help with a specific command.`,
@@ -452,7 +452,7 @@ const printCommandHelp = /* @__PURE__ */ __name$g((logger, runtime, commands, na
452
452
  });
453
453
  }
454
454
  usageGroups.push({ header: "{inverse.yellow Global Options }", optionList: defaultOptions });
455
- if (command.alias !== undefined && command.alias.length > 0) {
455
+ if (command.alias !== void 0 && command.alias.length > 0) {
456
456
  let alias = command.alias;
457
457
  if (typeof command.alias === "string") {
458
458
  alias = [command.alias];
@@ -510,7 +510,7 @@ const VersionCommand = {
510
510
  description: "Output the version number",
511
511
  execute: /* @__PURE__ */ __name$f(({ logger, runtime }) => {
512
512
  const version = runtime.getPackageVersion();
513
- if (version === undefined) {
513
+ if (version === void 0) {
514
514
  logger.warn("Unknown version");
515
515
  logger.debug("The version number was not provided by the cli constructor.");
516
516
  } else {
@@ -573,7 +573,7 @@ const getParameterOption = /* @__PURE__ */ __name$c((argument, options) => {
573
573
  }
574
574
  const nameOrAlias = regExpResult[1];
575
575
  const option = options.find((o) => o.name === nameOrAlias || o.alias === nameOrAlias);
576
- if (option !== undefined) {
576
+ if (option !== void 0) {
577
577
  return { argName: option.name, argValue: regExpResult[3], option };
578
578
  }
579
579
  return {};
@@ -586,7 +586,7 @@ const isBoolean = /* @__PURE__ */ __name$b((option) => option.type?.name === "Bo
586
586
  var __defProp$a = Object.defineProperty;
587
587
  var __name$a = (target, value) => __defProp$a(target, "name", { value, configurable: true });
588
588
  const convertType = /* @__PURE__ */ __name$a((value, option) => {
589
- if (option.type === undefined) {
589
+ if (option.type === void 0) {
590
590
  return value;
591
591
  }
592
592
  if (option.type.name === "Boolean") {
@@ -857,7 +857,7 @@ class Cli {
857
857
  option.__camelCaseName__ = camelCase(option.name);
858
858
  });
859
859
  this.commands.set(command.name, command);
860
- if (command.alias !== undefined) {
860
+ if (command.alias !== void 0) {
861
861
  let aliases = command.alias;
862
862
  if (typeof command.alias === "string") {
863
863
  aliases = [command.alias];
@@ -961,13 +961,13 @@ class Cli {
961
961
  } else {
962
962
  this.logger.error(error);
963
963
  }
964
- return shouldExitProcess ? exit(1) : undefined;
964
+ return shouldExitProcess ? exit(1) : void 0;
965
965
  }
966
966
  const commandName = parsedArguments.command ?? this.defaultCommand;
967
967
  const command = this.commands.get(commandName);
968
968
  if (typeof command.execute !== "function") {
969
969
  this.logger.error(`Command "${command.name}" has no function to execute.`);
970
- return shouldExitProcess ? exit(1) : undefined;
970
+ return shouldExitProcess ? exit(1) : void 0;
971
971
  }
972
972
  const commandArguments = parsedArguments.argv;
973
973
  this.logger.debug(`command '${commandName}' found, parsing command args: ${commandArguments.join(", ")}`);
@@ -1020,7 +1020,7 @@ class Cli {
1020
1020
  this.logger.debug("command argument parsed from argument:");
1021
1021
  this.logger.debug(JSON.stringify(toolbox.argument, null, 2));
1022
1022
  await this.prepareToolboxResult(commandArgs, toolbox, command);
1023
- return shouldExitProcess ? exit(0) : undefined;
1023
+ return shouldExitProcess ? exit(0) : void 0;
1024
1024
  }
1025
1025
  // eslint-disable-next-line class-methods-use-this,@typescript-eslint/no-explicit-any
1026
1026
  validateDoubleOptions(command) {
@@ -1138,13 +1138,13 @@ class Cli {
1138
1138
  }
1139
1139
  // eslint-disable-next-line class-methods-use-this,@typescript-eslint/no-explicit-any
1140
1140
  validateCommandArgsForConflicts(arguments_, commandArguments, command) {
1141
- const conflicts = arguments_.filter((argument) => argument.conflicts !== undefined);
1141
+ const conflicts = arguments_.filter((argument) => argument.conflicts !== void 0);
1142
1142
  if (conflicts.length > 0) {
1143
1143
  const conflict = conflicts.find((argument) => {
1144
1144
  if (Array.isArray(argument.conflicts)) {
1145
- return argument.conflicts.some((c) => commandArguments[c] !== undefined) && commandArguments[argument.name] !== undefined;
1145
+ return argument.conflicts.some((c) => commandArguments[c] !== void 0) && commandArguments[argument.name] !== void 0;
1146
1146
  }
1147
- return commandArguments[argument.conflicts] !== undefined && commandArguments[argument.name] !== undefined;
1147
+ return commandArguments[argument.conflicts] !== void 0 && commandArguments[argument.name] !== void 0;
1148
1148
  });
1149
1149
  if (conflict) {
1150
1150
  throw new Error(
@@ -1164,7 +1164,7 @@ class Cli {
1164
1164
  }
1165
1165
  const negatedOption = {
1166
1166
  ...option,
1167
- defaultValue: option.defaultValue === undefined ? true : !option.defaultValue,
1167
+ defaultValue: option.defaultValue === void 0 ? true : !option.defaultValue,
1168
1168
  name: `${option.name.replace("no-", "")}`
1169
1169
  };
1170
1170
  command.options.push(negatedOption);
@@ -1207,16 +1207,16 @@ class Cli {
1207
1207
  Object.keys(toolbox.options).forEach((optionKey) => {
1208
1208
  const option = command.options?.find(
1209
1209
  // eslint-disable-next-line no-underscore-dangle
1210
- (o) => o.__camelCaseName__ === optionKey && o.__negated__ === undefined && o.implies !== undefined
1210
+ (o) => o.__camelCaseName__ === optionKey && o.__negated__ === void 0 && o.implies !== void 0
1211
1211
  );
1212
1212
  if (option?.implies) {
1213
1213
  const implies = option.implies;
1214
1214
  Object.entries(implies).forEach(([key, value]) => {
1215
- if (toolbox.options[key] === undefined) {
1215
+ if (toolbox.options[key] === void 0) {
1216
1216
  toolbox.options[key] = value;
1217
1217
  } else {
1218
1218
  const impliedOption = command.options?.find((cOption) => cOption.name === key);
1219
- if (impliedOption?.defaultValue === undefined || toolbox.options[key] === impliedOption.defaultValue) {
1219
+ if (impliedOption?.defaultValue === void 0 || toolbox.options[key] === impliedOption.defaultValue) {
1220
1220
  toolbox.options[key] = value;
1221
1221
  }
1222
1222
  }
@@ -310,7 +310,7 @@ class OptionListSection extends BaseSection {
310
310
  definitions = definitions.filter((definition) => {
311
311
  const noGroupMatch = groups.includes("_none") && !definition.group;
312
312
  const groupMatch = this.intersect(Array.isArray(definition.group) ? definition.group : [definition.group], groups);
313
- return noGroupMatch || groupMatch ? definition : undefined;
313
+ return noGroupMatch || groupMatch ? definition : void 0;
314
314
  });
315
315
  }
316
316
  const table = new CliTable3__default({
@@ -432,7 +432,7 @@ const printGeneralHelp = /* @__PURE__ */ __name$g((logger, runtime, commands, gr
432
432
  commands.has("help") ? {
433
433
  header: "{inverse.yellow Command Options }",
434
434
  optionList: commands.get("help").options?.filter((option) => !option.hidden)
435
- } : undefined,
435
+ } : void 0,
436
436
  { header: "{inverse.yellow Global Options }", optionList: defaultOptions },
437
437
  {
438
438
  content: `Run "{cyan ${runtime.getCliName()}} {green help <command>}" or "{cyan ${runtime.getCliName()}} {green <command>} {yellow --help}" for help with a specific command.`,
@@ -463,7 +463,7 @@ const printCommandHelp = /* @__PURE__ */ __name$g((logger, runtime, commands, na
463
463
  });
464
464
  }
465
465
  usageGroups.push({ header: "{inverse.yellow Global Options }", optionList: defaultOptions });
466
- if (command.alias !== undefined && command.alias.length > 0) {
466
+ if (command.alias !== void 0 && command.alias.length > 0) {
467
467
  let alias = command.alias;
468
468
  if (typeof command.alias === "string") {
469
469
  alias = [command.alias];
@@ -521,7 +521,7 @@ const VersionCommand = {
521
521
  description: "Output the version number",
522
522
  execute: /* @__PURE__ */ __name$f(({ logger, runtime }) => {
523
523
  const version = runtime.getPackageVersion();
524
- if (version === undefined) {
524
+ if (version === void 0) {
525
525
  logger.warn("Unknown version");
526
526
  logger.debug("The version number was not provided by the cli constructor.");
527
527
  } else {
@@ -584,7 +584,7 @@ const getParameterOption = /* @__PURE__ */ __name$c((argument, options) => {
584
584
  }
585
585
  const nameOrAlias = regExpResult[1];
586
586
  const option = options.find((o) => o.name === nameOrAlias || o.alias === nameOrAlias);
587
- if (option !== undefined) {
587
+ if (option !== void 0) {
588
588
  return { argName: option.name, argValue: regExpResult[3], option };
589
589
  }
590
590
  return {};
@@ -597,7 +597,7 @@ const isBoolean = /* @__PURE__ */ __name$b((option) => option.type?.name === "Bo
597
597
  var __defProp$a = Object.defineProperty;
598
598
  var __name$a = (target, value) => __defProp$a(target, "name", { value, configurable: true });
599
599
  const convertType = /* @__PURE__ */ __name$a((value, option) => {
600
- if (option.type === undefined) {
600
+ if (option.type === void 0) {
601
601
  return value;
602
602
  }
603
603
  if (option.type.name === "Boolean") {
@@ -868,7 +868,7 @@ class Cli {
868
868
  option.__camelCaseName__ = camelCase(option.name);
869
869
  });
870
870
  this.commands.set(command.name, command);
871
- if (command.alias !== undefined) {
871
+ if (command.alias !== void 0) {
872
872
  let aliases = command.alias;
873
873
  if (typeof command.alias === "string") {
874
874
  aliases = [command.alias];
@@ -972,13 +972,13 @@ class Cli {
972
972
  } else {
973
973
  this.logger.error(error);
974
974
  }
975
- return shouldExitProcess ? node_process.exit(1) : undefined;
975
+ return shouldExitProcess ? node_process.exit(1) : void 0;
976
976
  }
977
977
  const commandName = parsedArguments.command ?? this.defaultCommand;
978
978
  const command = this.commands.get(commandName);
979
979
  if (typeof command.execute !== "function") {
980
980
  this.logger.error(`Command "${command.name}" has no function to execute.`);
981
- return shouldExitProcess ? node_process.exit(1) : undefined;
981
+ return shouldExitProcess ? node_process.exit(1) : void 0;
982
982
  }
983
983
  const commandArguments = parsedArguments.argv;
984
984
  this.logger.debug(`command '${commandName}' found, parsing command args: ${commandArguments.join(", ")}`);
@@ -1031,7 +1031,7 @@ class Cli {
1031
1031
  this.logger.debug("command argument parsed from argument:");
1032
1032
  this.logger.debug(JSON.stringify(toolbox.argument, null, 2));
1033
1033
  await this.prepareToolboxResult(commandArgs, toolbox, command);
1034
- return shouldExitProcess ? node_process.exit(0) : undefined;
1034
+ return shouldExitProcess ? node_process.exit(0) : void 0;
1035
1035
  }
1036
1036
  // eslint-disable-next-line class-methods-use-this,@typescript-eslint/no-explicit-any
1037
1037
  validateDoubleOptions(command) {
@@ -1149,13 +1149,13 @@ class Cli {
1149
1149
  }
1150
1150
  // eslint-disable-next-line class-methods-use-this,@typescript-eslint/no-explicit-any
1151
1151
  validateCommandArgsForConflicts(arguments_, commandArguments, command) {
1152
- const conflicts = arguments_.filter((argument) => argument.conflicts !== undefined);
1152
+ const conflicts = arguments_.filter((argument) => argument.conflicts !== void 0);
1153
1153
  if (conflicts.length > 0) {
1154
1154
  const conflict = conflicts.find((argument) => {
1155
1155
  if (Array.isArray(argument.conflicts)) {
1156
- return argument.conflicts.some((c) => commandArguments[c] !== undefined) && commandArguments[argument.name] !== undefined;
1156
+ return argument.conflicts.some((c) => commandArguments[c] !== void 0) && commandArguments[argument.name] !== void 0;
1157
1157
  }
1158
- return commandArguments[argument.conflicts] !== undefined && commandArguments[argument.name] !== undefined;
1158
+ return commandArguments[argument.conflicts] !== void 0 && commandArguments[argument.name] !== void 0;
1159
1159
  });
1160
1160
  if (conflict) {
1161
1161
  throw new Error(
@@ -1175,7 +1175,7 @@ class Cli {
1175
1175
  }
1176
1176
  const negatedOption = {
1177
1177
  ...option,
1178
- defaultValue: option.defaultValue === undefined ? true : !option.defaultValue,
1178
+ defaultValue: option.defaultValue === void 0 ? true : !option.defaultValue,
1179
1179
  name: `${option.name.replace("no-", "")}`
1180
1180
  };
1181
1181
  command.options.push(negatedOption);
@@ -1218,16 +1218,16 @@ class Cli {
1218
1218
  Object.keys(toolbox.options).forEach((optionKey) => {
1219
1219
  const option = command.options?.find(
1220
1220
  // eslint-disable-next-line no-underscore-dangle
1221
- (o) => o.__camelCaseName__ === optionKey && o.__negated__ === undefined && o.implies !== undefined
1221
+ (o) => o.__camelCaseName__ === optionKey && o.__negated__ === void 0 && o.implies !== void 0
1222
1222
  );
1223
1223
  if (option?.implies) {
1224
1224
  const implies = option.implies;
1225
1225
  Object.entries(implies).forEach(([key, value]) => {
1226
- if (toolbox.options[key] === undefined) {
1226
+ if (toolbox.options[key] === void 0) {
1227
1227
  toolbox.options[key] = value;
1228
1228
  } else {
1229
1229
  const impliedOption = command.options?.find((cOption) => cOption.name === key);
1230
- if (impliedOption?.defaultValue === undefined || toolbox.options[key] === impliedOption.defaultValue) {
1230
+ if (impliedOption?.defaultValue === void 0 || toolbox.options[key] === impliedOption.defaultValue) {
1231
1231
  toolbox.options[key] = value;
1232
1232
  }
1233
1233
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/cerebro",
3
- "version": "1.1.39",
3
+ "version": "1.1.40",
4
4
  "description": "A delightful toolkit for building Node-powered CLIs.",
5
5
  "keywords": [
6
6
  "command",
@@ -86,10 +86,10 @@
86
86
  "LICENSE.md"
87
87
  ],
88
88
  "dependencies": {
89
- "@visulima/boxen": "1.0.29",
90
- "@visulima/colorize": "1.4.20",
91
- "@visulima/find-cache-dir": "1.0.27",
92
- "@visulima/pail": "2.1.21",
89
+ "@visulima/boxen": "1.0.30",
90
+ "@visulima/colorize": "1.4.21",
91
+ "@visulima/find-cache-dir": "1.0.28",
92
+ "@visulima/pail": "2.1.22",
93
93
  "cli-table3": "^0.6.5",
94
94
  "command-line-args": "^6.0.0",
95
95
  "fastest-levenshtein": "^1.0.16"