@nmakarov/cli-toolkit 0.16.0 → 0.18.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/dist/init.js CHANGED
@@ -2126,6 +2126,7 @@ var ALL_LEVELS = [
2126
2126
  "response",
2127
2127
  "progress"
2128
2128
  ];
2129
+ var DEFAULT_LEVELS = ALL_LEVELS.filter((l) => l !== "silly");
2129
2130
  var MAX_LEVEL_LENGTH = Math.max(...ALL_LEVELS.map((level) => level.toUpperCase().length));
2130
2131
  var LEVEL_COLORS = {
2131
2132
  error: chalk.red.bold,
@@ -2211,7 +2212,7 @@ var Logger = class _Logger {
2211
2212
  silent: false,
2212
2213
  showLevel: false,
2213
2214
  timestamp: false,
2214
- levels: ALL_LEVELS,
2215
+ levels: DEFAULT_LEVELS,
2215
2216
  progressTimes: false,
2216
2217
  progressThrottle: void 0
2217
2218
  };
@@ -2371,15 +2372,17 @@ var Logger = class _Logger {
2371
2372
  }
2372
2373
  normalizeLevels(levels) {
2373
2374
  if (!levels || !levels.length) {
2374
- return ALL_LEVELS;
2375
+ return DEFAULT_LEVELS;
2375
2376
  }
2376
- const includes = levels.filter((level) => !level.startsWith("-"));
2377
- const excludes = levels.filter((level) => level.startsWith("-")).map((level) => level.slice(1));
2378
- const unknown = [...includes, ...excludes].filter((level) => !ALL_LEVELS.includes(level));
2377
+ const tokens = levels.map((t) => String(t).trim()).filter(Boolean);
2378
+ const explicitIncludes = tokens.filter((t) => !t.startsWith("+") && !t.startsWith("-")).map((t) => t);
2379
+ const addIncludes = tokens.filter((t) => t.startsWith("+")).map((t) => t.slice(1));
2380
+ const excludes = tokens.filter((t) => t.startsWith("-")).map((t) => t.slice(1));
2381
+ const unknown = [...explicitIncludes, ...addIncludes, ...excludes].filter((level) => !ALL_LEVELS.includes(level));
2379
2382
  if (unknown.length) {
2380
2383
  console.warn(`[Logger] Unknown level(s): ${unknown.join(", ")}`);
2381
2384
  }
2382
- const base = includes.length ? includes : ALL_LEVELS;
2385
+ const base = explicitIncludes.length ? explicitIncludes : Array.from(/* @__PURE__ */ new Set([...DEFAULT_LEVELS, ...addIncludes]));
2383
2386
  return base.filter((level) => !excludes.includes(level));
2384
2387
  }
2385
2388
  isValidMode(mode) {