@xylabs/ts-scripts-yarn3 7.4.10 → 7.4.11

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 (32) hide show
  1. package/dist/actions/deplint/checkPackage/checkPackage.mjs +115 -16
  2. package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
  3. package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +2 -1
  4. package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -1
  5. package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs +114 -20
  6. package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs.map +1 -1
  7. package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs +2 -1
  8. package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs.map +1 -1
  9. package/dist/actions/deplint/checkPackage/index.mjs +115 -16
  10. package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
  11. package/dist/actions/deplint/deplint.mjs +166 -38
  12. package/dist/actions/deplint/deplint.mjs.map +1 -1
  13. package/dist/actions/deplint/getCliReferencedPackagesFromFiles.mjs +140 -0
  14. package/dist/actions/deplint/getCliReferencedPackagesFromFiles.mjs.map +1 -0
  15. package/dist/actions/deplint/getScriptReferencedPackages.mjs +3 -1
  16. package/dist/actions/deplint/getScriptReferencedPackages.mjs.map +1 -1
  17. package/dist/actions/deplint/index.mjs +166 -38
  18. package/dist/actions/deplint/index.mjs.map +1 -1
  19. package/dist/actions/index.mjs +147 -40
  20. package/dist/actions/index.mjs.map +1 -1
  21. package/dist/bin/xy.mjs +251 -117
  22. package/dist/bin/xy.mjs.map +1 -1
  23. package/dist/index.d.ts +23 -2
  24. package/dist/index.mjs +155 -42
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/xy/index.mjs +251 -117
  27. package/dist/xy/index.mjs.map +1 -1
  28. package/dist/xy/xy.mjs +251 -117
  29. package/dist/xy/xy.mjs.map +1 -1
  30. package/dist/xy/xyLintCommands.mjs +205 -71
  31. package/dist/xy/xyLintCommands.mjs.map +1 -1
  32. package/package.json +2 -2
package/dist/xy/xy.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  // src/xy/xy.ts
2
- import chalk28 from "chalk";
2
+ import chalk29 from "chalk";
3
3
 
4
4
  // src/actions/build.ts
5
- import chalk7 from "chalk";
5
+ import chalk8 from "chalk";
6
6
 
7
7
  // src/lib/checkResult.ts
8
8
  import chalk from "chalk";
@@ -324,10 +324,31 @@ var generateIgnoreFiles = (filename3, pkg) => {
324
324
  return succeeded ? 0 : 1;
325
325
  };
326
326
 
327
+ // src/lib/loadConfig.ts
328
+ import chalk5 from "chalk";
329
+ import { cosmiconfig } from "cosmiconfig";
330
+ import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
331
+ import deepmerge from "deepmerge";
332
+ var config;
333
+ var loadConfig = async (params) => {
334
+ if (config === void 0) {
335
+ const cosmicConfigResult = await cosmiconfig("xy", { cache: true, loaders: { ".ts": TypeScriptLoader() } }).search();
336
+ config = cosmicConfigResult?.config;
337
+ const configFilePath = cosmicConfigResult?.filepath;
338
+ if (configFilePath !== void 0) {
339
+ console.log(chalk5.green(`Loaded config from ${configFilePath}`));
340
+ if (config.verbose) {
341
+ console.log(chalk5.gray(`${JSON.stringify(config, null, 2)}`));
342
+ }
343
+ }
344
+ }
345
+ return deepmerge(config, params ?? {});
346
+ };
347
+
327
348
  // src/lib/parsedPackageJSON.ts
328
349
  import { readFileSync as readFileSync3 } from "fs";
329
- var parsedPackageJSON = (path7) => {
330
- const pathToPackageJSON = path7 ?? process.env.npm_package_json ?? "";
350
+ var parsedPackageJSON = (path8) => {
351
+ const pathToPackageJSON = path8 ?? process.env.npm_package_json ?? "";
331
352
  const packageJSON = readFileSync3(pathToPackageJSON).toString();
332
353
  return JSON.parse(packageJSON);
333
354
  };
@@ -335,22 +356,22 @@ var parsedPackageJSON = (path7) => {
335
356
  // src/lib/runSteps.ts
336
357
  import { spawnSync as spawnSync3 } from "child_process";
337
358
  import { existsSync as existsSync2 } from "fs";
338
- import chalk5 from "chalk";
359
+ import chalk6 from "chalk";
339
360
  var runSteps = (name, steps, exitOnFail = true, messages) => {
340
361
  return safeExit(() => {
341
362
  const pkgName = process.env.npm_package_name;
342
- console.log(chalk5.green(`${name} [${pkgName}]`));
363
+ console.log(chalk6.green(`${name} [${pkgName}]`));
343
364
  let totalStatus = 0;
344
- for (const [i, [command, args, config]] of steps.entries()) {
365
+ for (const [i, [command, args, config2]] of steps.entries()) {
345
366
  if (messages?.[i]) {
346
- console.log(chalk5.gray(messages?.[i]));
367
+ console.log(chalk6.gray(messages?.[i]));
347
368
  }
348
369
  const argList = Array.isArray(args) ? args : args.split(" ");
349
370
  if (command === "node" && !existsSync2(argList[0])) {
350
371
  throw new Error(`File not found [${argList[0]}]`);
351
372
  }
352
373
  const status = spawnSync3(command, Array.isArray(args) ? args : args.split(" "), {
353
- ...config,
374
+ ...config2,
354
375
  encoding: "utf8",
355
376
  env: { FORCE_COLOR: "3", ...process.env },
356
377
  shell: true,
@@ -366,27 +387,27 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
366
387
  // src/lib/runStepsAsync.ts
367
388
  import { spawn } from "child_process";
368
389
  import { existsSync as existsSync3 } from "fs";
369
- import chalk6 from "chalk";
390
+ import chalk7 from "chalk";
370
391
  var runStepAsync = (name, step, exitOnFail = true, message) => {
371
392
  return new Promise((resolve) => {
372
- const [command, args, config] = step;
393
+ const [command, args, config2] = step;
373
394
  if (message) {
374
- console.log(chalk6.gray(message));
395
+ console.log(chalk7.gray(message));
375
396
  }
376
397
  const argList = Array.isArray(args) ? args : args.split(" ");
377
398
  if (command === "node" && !existsSync3(argList[0])) {
378
399
  throw new Error(`File not found [${argList[0]}]`);
379
400
  }
380
401
  spawn(command, Array.isArray(args) ? args : args.split(" "), {
381
- ...config,
402
+ ...config2,
382
403
  env: { FORCE_COLOR: "3", ...process.env },
383
404
  shell: true,
384
405
  stdio: "inherit"
385
406
  }).on("close", (code) => {
386
407
  if (code) {
387
408
  console.error(
388
- chalk6.red(
389
- `Command Exited With Non-Zero Result [${chalk6.gray(code)}] | ${chalk6.yellow(command)} ${chalk6.white(
409
+ chalk7.red(
410
+ `Command Exited With Non-Zero Result [${chalk7.gray(code)}] | ${chalk7.yellow(command)} ${chalk7.white(
390
411
  Array.isArray(args) ? args.join(" ") : args
391
412
  )}`
392
413
  )
@@ -402,7 +423,7 @@ var runStepAsync = (name, step, exitOnFail = true, message) => {
402
423
  var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
403
424
  return await safeExitAsync(async () => {
404
425
  const pkgName = process.env.npm_package_name;
405
- console.log(chalk6.green(`${name} [${pkgName}]`));
426
+ console.log(chalk7.green(`${name} [${pkgName}]`));
406
427
  let result = 0;
407
428
  for (const [i, step] of steps.entries()) {
408
429
  result += await runStepAsync(name, step, exitOnFail, messages?.[i]);
@@ -426,7 +447,7 @@ var build = async ({
426
447
  const targetOptions = target === void 0 ? [] : ["-t", target];
427
448
  const jobsOptions = jobs === void 0 ? [] : ["-j", `${jobs}`];
428
449
  if (jobs !== void 0) {
429
- console.log(chalk7.blue(`Jobs set to [${jobs}]`));
450
+ console.log(chalk8.blue(`Jobs set to [${jobs}]`));
430
451
  }
431
452
  const result = await runStepsAsync(`Build${incremental ? "-Incremental" : ""} [${pkg ?? "All"}]`, [
432
453
  ["yarn", ["xy", "compile", ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, "--types", "tsup"]],
@@ -434,7 +455,7 @@ var build = async ({
434
455
  ["yarn", ["xy", "deplint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
435
456
  ["yarn", ["xy", "lint", ...pkgOptions, ...verboseOptions, ...incrementalOptions]]
436
457
  ]);
437
- console.log(`${chalk7.gray("Built in")} [${chalk7.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk7.gray("seconds")}`);
458
+ console.log(`${chalk8.gray("Built in")} [${chalk8.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk8.gray("seconds")}`);
438
459
  return result;
439
460
  };
440
461
 
@@ -448,7 +469,7 @@ import {
448
469
  writeFileSync as writeFileSync2
449
470
  } from "fs";
450
471
  import PATH2 from "path";
451
- import chalk8 from "chalk";
472
+ import chalk9 from "chalk";
452
473
  var syncCommandFiles = (commandsDir) => {
453
474
  const templates = claudeCommandTemplates();
454
475
  const templateNames = new Set(Object.keys(templates));
@@ -489,9 +510,9 @@ var logCommandsResult = (created, updated, removed) => {
489
510
  updated ? `${updated} updated` : "",
490
511
  removed ? `${removed} removed` : ""
491
512
  ].filter(Boolean);
492
- console.log(chalk8.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
513
+ console.log(chalk9.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
493
514
  } else {
494
- console.log(chalk8.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
515
+ console.log(chalk9.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
495
516
  }
496
517
  };
497
518
  var claudeCommands = () => {
@@ -518,7 +539,7 @@ import {
518
539
  writeFileSync as writeFileSync3
519
540
  } from "fs";
520
541
  import PATH3 from "path";
521
- import chalk9 from "chalk";
542
+ import chalk10 from "chalk";
522
543
  var syncRuleFiles = (rulesDir) => {
523
544
  const templates = claudeMdRuleTemplates();
524
545
  const templateNames = new Set(Object.keys(templates));
@@ -559,21 +580,21 @@ var logRulesResult = (created, updated, removed) => {
559
580
  updated ? `${updated} updated` : "",
560
581
  removed ? `${removed} removed` : ""
561
582
  ].filter(Boolean);
562
- console.log(chalk9.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
583
+ console.log(chalk10.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
563
584
  } else {
564
- console.log(chalk9.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
585
+ console.log(chalk10.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
565
586
  }
566
587
  };
567
588
  var ensureProjectClaudeMd = (cwd, force) => {
568
589
  const projectPath = PATH3.resolve(cwd, "CLAUDE.md");
569
590
  if (!existsSync5(projectPath) || force) {
570
591
  if (force && existsSync5(projectPath)) {
571
- console.log(chalk9.yellow("Overwriting existing CLAUDE.md"));
592
+ console.log(chalk10.yellow("Overwriting existing CLAUDE.md"));
572
593
  }
573
594
  writeFileSync3(projectPath, claudeMdProjectTemplate(), "utf8");
574
- console.log(chalk9.green("Generated CLAUDE.md"));
595
+ console.log(chalk10.green("Generated CLAUDE.md"));
575
596
  } else {
576
- console.log(chalk9.gray("CLAUDE.md already exists (skipped)"));
597
+ console.log(chalk10.gray("CLAUDE.md already exists (skipped)"));
577
598
  }
578
599
  };
579
600
  var claudeRules = ({ force } = {}) => {
@@ -605,16 +626,16 @@ var cleanAll = ({ verbose }) => {
605
626
 
606
627
  // src/actions/clean-docs.ts
607
628
  import path from "path";
608
- import chalk10 from "chalk";
629
+ import chalk11 from "chalk";
609
630
  var cleanDocs = () => {
610
631
  const pkgName = process.env.npm_package_name;
611
- console.log(chalk10.green(`Cleaning Docs [${pkgName}]`));
632
+ console.log(chalk11.green(`Cleaning Docs [${pkgName}]`));
612
633
  for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
613
634
  return 0;
614
635
  };
615
636
 
616
637
  // src/actions/compile.ts
617
- import chalk11 from "chalk";
638
+ import chalk12 from "chalk";
618
639
  var compile = ({
619
640
  verbose,
620
641
  target,
@@ -655,7 +676,7 @@ var compileAll = ({
655
676
  const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
656
677
  const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
657
678
  if (jobs) {
658
- console.log(chalk11.blue(`Jobs set to [${jobs}]`));
679
+ console.log(chalk12.blue(`Jobs set to [${jobs}]`));
659
680
  }
660
681
  const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
661
682
  ["yarn", [
@@ -669,13 +690,13 @@ var compileAll = ({
669
690
  ...targetOptions
670
691
  ]]
671
692
  ]);
672
- console.log(`${chalk11.gray("Compiled in")} [${chalk11.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk11.gray("seconds")}`);
693
+ console.log(`${chalk12.gray("Compiled in")} [${chalk12.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk12.gray("seconds")}`);
673
694
  return result;
674
695
  };
675
696
 
676
697
  // src/actions/copy-assets.ts
677
698
  import path2 from "path/posix";
678
- import chalk12 from "chalk";
699
+ import chalk13 from "chalk";
679
700
  import cpy from "cpy";
680
701
  var copyPackageTargetAssets = async (target, name, location) => {
681
702
  try {
@@ -698,7 +719,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
698
719
  };
699
720
  var copyTargetAssets = async (target, pkg) => {
700
721
  const workspaces = yarnWorkspaces();
701
- console.log(chalk12.green(`Copying Assets [${target.toUpperCase()}]`));
722
+ console.log(chalk13.green(`Copying Assets [${target.toUpperCase()}]`));
702
723
  const workspaceList = workspaces.filter(({ name }) => {
703
724
  return pkg === void 0 || name === pkg;
704
725
  });
@@ -782,7 +803,7 @@ var dead = () => {
782
803
  };
783
804
 
784
805
  // src/actions/deplint/deplint.ts
785
- import chalk18 from "chalk";
806
+ import chalk19 from "chalk";
786
807
 
787
808
  // src/actions/deplint/findFiles.ts
788
809
  import fs2 from "fs";
@@ -958,11 +979,11 @@ function getExternalImportsFromFiles({
958
979
  const allImportPaths = {};
959
980
  const distImportPaths = {};
960
981
  const distTypeImportPaths = {};
961
- for (const path7 of allFiles) getImportsFromFile(path7, allImportPaths, allImportPaths).flat();
982
+ for (const path8 of allFiles) getImportsFromFile(path8, allImportPaths, allImportPaths).flat();
962
983
  const distTypeFiles = distFiles.filter(isDeclarationFile);
963
984
  const distCodeFiles = distFiles.filter((file) => !isDeclarationFile(file));
964
- for (const path7 of distCodeFiles) getImportsFromFile(path7, distImportPaths, distImportPaths).flat();
965
- for (const path7 of distTypeFiles) getImportsFromFile(path7, distTypeImportPaths, distTypeImportPaths).flat();
985
+ for (const path8 of distCodeFiles) getImportsFromFile(path8, distImportPaths, distImportPaths).flat();
986
+ for (const path8 of distTypeFiles) getImportsFromFile(path8, distTypeImportPaths, distTypeImportPaths).flat();
966
987
  const allImports = Object.keys(allImportPaths);
967
988
  const distImports = Object.keys(distImportPaths);
968
989
  const externalAllImports = removeInternalImports(allImports);
@@ -984,12 +1005,12 @@ function getExternalImportsFromFiles({
984
1005
 
985
1006
  // src/actions/deplint/checkPackage/getUnlistedDependencies.ts
986
1007
  import { builtinModules } from "module";
987
- import chalk13 from "chalk";
1008
+ import chalk14 from "chalk";
988
1009
  function isListedOrBuiltin(imp, name, dependencies, peerDependencies) {
989
1010
  return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp) || builtinModules.includes(`@types/${imp}`);
990
1011
  }
991
1012
  function logMissing(name, imp, importPaths) {
992
- console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
1013
+ console.log(`[${chalk14.blue(name)}] Missing dependency in package.json: ${chalk14.red(imp)}`);
993
1014
  if (importPaths[imp]) {
994
1015
  console.log(` ${importPaths[imp].join("\n ")}`);
995
1016
  }
@@ -1014,7 +1035,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
1014
1035
  }
1015
1036
  if (unlistedDependencies > 0) {
1016
1037
  const packageLocation = `${location}/package.json`;
1017
- console.log(` ${chalk13.yellow(packageLocation)}
1038
+ console.log(` ${chalk14.yellow(packageLocation)}
1018
1039
  `);
1019
1040
  }
1020
1041
  return unlistedDependencies;
@@ -1022,7 +1043,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
1022
1043
 
1023
1044
  // src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
1024
1045
  import { builtinModules as builtinModules2 } from "module";
1025
- import chalk14 from "chalk";
1046
+ import chalk15 from "chalk";
1026
1047
  function getUnlistedDevDependencies({ name, location }, {
1027
1048
  devDependencies,
1028
1049
  dependencies,
@@ -1036,7 +1057,7 @@ function getUnlistedDevDependencies({ name, location }, {
1036
1057
  for (const imp of externalAllImports) {
1037
1058
  if (!distImports.includes(imp) && imp !== name && !dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`) && !builtinModules2.includes(imp)) {
1038
1059
  unlistedDevDependencies++;
1039
- console.log(`[${chalk14.blue(name)}] Missing devDependency in package.json: ${chalk14.red(imp)}`);
1060
+ console.log(`[${chalk15.blue(name)}] Missing devDependency in package.json: ${chalk15.red(imp)}`);
1040
1061
  if (allImportPaths[imp]) {
1041
1062
  console.log(` ${allImportPaths[imp].join("\n ")}`);
1042
1063
  }
@@ -1044,40 +1065,50 @@ function getUnlistedDevDependencies({ name, location }, {
1044
1065
  }
1045
1066
  if (unlistedDevDependencies > 0) {
1046
1067
  const packageLocation = `${location}/package.json`;
1047
- console.log(` ${chalk14.yellow(packageLocation)}
1068
+ console.log(` ${chalk15.yellow(packageLocation)}
1048
1069
  `);
1049
1070
  }
1050
1071
  return unlistedDevDependencies;
1051
1072
  }
1052
1073
 
1053
1074
  // src/actions/deplint/checkPackage/getUnusedDependencies.ts
1054
- import chalk15 from "chalk";
1075
+ import chalk16 from "chalk";
1055
1076
  function getUnusedDependencies({ name, location }, { dependencies }, {
1056
1077
  externalDistImports,
1057
1078
  externalDistTypeImports,
1058
1079
  externalAllImports
1059
- }) {
1080
+ }, exclude) {
1060
1081
  let unusedDependencies = 0;
1061
1082
  for (const dep of dependencies) {
1083
+ if (exclude?.has(dep)) continue;
1062
1084
  if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
1063
1085
  unusedDependencies++;
1064
1086
  if (externalAllImports.includes(dep)) {
1065
- console.log(`[${chalk15.blue(name)}] dependency should be devDependency in package.json: ${chalk15.red(dep)}`);
1087
+ console.log(`[${chalk16.blue(name)}] dependency should be devDependency in package.json: ${chalk16.red(dep)}`);
1066
1088
  } else {
1067
- console.log(`[${chalk15.blue(name)}] Unused dependency in package.json: ${chalk15.red(dep)}`);
1089
+ console.log(`[${chalk16.blue(name)}] Unused dependency in package.json: ${chalk16.red(dep)}`);
1068
1090
  }
1069
1091
  }
1070
1092
  }
1071
1093
  if (unusedDependencies > 0) {
1072
1094
  const packageLocation = `${location}/package.json`;
1073
- console.log(` ${chalk15.yellow(packageLocation)}
1095
+ console.log(` ${chalk16.yellow(packageLocation)}
1074
1096
  `);
1075
1097
  }
1076
1098
  return unusedDependencies;
1077
1099
  }
1078
1100
 
1079
1101
  // src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
1080
- import chalk16 from "chalk";
1102
+ import chalk17 from "chalk";
1103
+
1104
+ // src/actions/deplint/getCliReferencedPackagesFromFiles.ts
1105
+ import fs8 from "fs";
1106
+ import path7 from "path";
1107
+ import ts2 from "typescript";
1108
+
1109
+ // src/actions/deplint/getScriptReferencedPackages.ts
1110
+ import fs7 from "fs";
1111
+ import path6 from "path";
1081
1112
 
1082
1113
  // src/actions/deplint/getRequiredPeerDependencies.ts
1083
1114
  import fs6 from "fs";
@@ -1112,8 +1143,6 @@ function getRequiredPeerDependencies(location, allDeps) {
1112
1143
  }
1113
1144
 
1114
1145
  // src/actions/deplint/getScriptReferencedPackages.ts
1115
- import fs7 from "fs";
1116
- import path6 from "path";
1117
1146
  function getBinNames(location, dep) {
1118
1147
  const depPkgPath = findDepPackageJson(location, dep);
1119
1148
  if (!depPkgPath) return [];
@@ -1163,15 +1192,101 @@ function getScriptReferencedPackages(location, allDeps) {
1163
1192
  return referenced;
1164
1193
  }
1165
1194
 
1195
+ // src/actions/deplint/getCliReferencedPackagesFromFiles.ts
1196
+ var shellCommandFunctions = /* @__PURE__ */ new Set(["execSync", "exec"]);
1197
+ var directExecFunctions = /* @__PURE__ */ new Set(["spawn", "spawnSync", "execFile", "execFileSync"]);
1198
+ var allExecFunctions = /* @__PURE__ */ new Set([...shellCommandFunctions, ...directExecFunctions]);
1199
+ function getCommandTokensFromFile(filePath) {
1200
+ const tokens = /* @__PURE__ */ new Set();
1201
+ let sourceCode;
1202
+ try {
1203
+ sourceCode = fs8.readFileSync(filePath, "utf8");
1204
+ } catch {
1205
+ return tokens;
1206
+ }
1207
+ const isMjsFile = filePath.endsWith(".mjs");
1208
+ const sourceFile = ts2.createSourceFile(
1209
+ path7.basename(filePath),
1210
+ sourceCode,
1211
+ ts2.ScriptTarget.Latest,
1212
+ true,
1213
+ isMjsFile ? ts2.ScriptKind.JS : void 0
1214
+ );
1215
+ function visit(node) {
1216
+ if (ts2.isCallExpression(node) && node.arguments.length > 0) {
1217
+ const fnName = getFunctionName(node.expression);
1218
+ if (fnName && allExecFunctions.has(fnName)) {
1219
+ const firstArg = node.arguments[0];
1220
+ if (ts2.isStringLiteral(firstArg) || ts2.isNoSubstitutionTemplateLiteral(firstArg)) {
1221
+ const value = firstArg.text;
1222
+ if (shellCommandFunctions.has(fnName)) {
1223
+ for (const token of tokenizeScript(value)) {
1224
+ tokens.add(token);
1225
+ }
1226
+ } else {
1227
+ tokens.add(value);
1228
+ }
1229
+ } else if (ts2.isTemplateExpression(firstArg)) {
1230
+ const head = firstArg.head.text;
1231
+ if (head) {
1232
+ for (const token of tokenizeScript(head)) {
1233
+ tokens.add(token);
1234
+ }
1235
+ }
1236
+ }
1237
+ }
1238
+ }
1239
+ ts2.forEachChild(node, visit);
1240
+ }
1241
+ visit(sourceFile);
1242
+ return tokens;
1243
+ }
1244
+ function getFunctionName(expr) {
1245
+ if (ts2.isIdentifier(expr)) {
1246
+ return expr.text;
1247
+ }
1248
+ if (ts2.isPropertyAccessExpression(expr) && ts2.isIdentifier(expr.name)) {
1249
+ return expr.name.text;
1250
+ }
1251
+ return void 0;
1252
+ }
1253
+ function getCliReferencedPackagesFromFiles(allFiles, location, allDeps) {
1254
+ const allTokens = /* @__PURE__ */ new Set();
1255
+ for (const file of allFiles) {
1256
+ for (const token of getCommandTokensFromFile(file)) {
1257
+ allTokens.add(token);
1258
+ }
1259
+ }
1260
+ if (allTokens.size === 0) return /* @__PURE__ */ new Set();
1261
+ const binToPackage = /* @__PURE__ */ new Map();
1262
+ for (const dep of allDeps) {
1263
+ for (const bin of getBinNames(location, dep)) {
1264
+ binToPackage.set(bin, dep);
1265
+ }
1266
+ }
1267
+ const referenced = /* @__PURE__ */ new Set();
1268
+ for (const token of allTokens) {
1269
+ const baseName = getBasePackageName(token);
1270
+ if (allDeps.includes(baseName)) {
1271
+ referenced.add(baseName);
1272
+ }
1273
+ const pkg = binToPackage.get(token);
1274
+ if (pkg) {
1275
+ referenced.add(pkg);
1276
+ }
1277
+ }
1278
+ return referenced;
1279
+ }
1280
+
1166
1281
  // src/actions/deplint/implicitDevDependencies.ts
1167
- import fs8 from "fs";
1282
+ import fs9 from "fs";
1168
1283
  var hasFileWithExtension = (files, extensions) => files.some((f) => extensions.some((ext) => f.endsWith(ext)));
1169
1284
  var tsExtensions = [".ts", ".tsx", ".mts", ".cts"];
1170
1285
  var hasTypescriptFiles = ({ allFiles }) => hasFileWithExtension(allFiles, tsExtensions);
1171
1286
  var decoratorPattern = /^\s*@[a-zA-Z]\w*/m;
1172
1287
  var hasDecorators = ({ allFiles }) => allFiles.filter((f) => tsExtensions.some((ext) => f.endsWith(ext))).some((file) => {
1173
1288
  try {
1174
- const content = fs8.readFileSync(file, "utf8");
1289
+ const content = fs9.readFileSync(file, "utf8");
1175
1290
  return decoratorPattern.test(content);
1176
1291
  } catch {
1177
1292
  return false;
@@ -1184,7 +1299,7 @@ function hasImportPlugin({ location, allDependencies }) {
1184
1299
  const pkgPath = findDepPackageJson(location, dep);
1185
1300
  if (!pkgPath) continue;
1186
1301
  try {
1187
- const pkg = JSON.parse(fs8.readFileSync(pkgPath, "utf8"));
1302
+ const pkg = JSON.parse(fs9.readFileSync(pkgPath, "utf8"));
1188
1303
  const transitiveDeps = [
1189
1304
  ...Object.keys(pkg.dependencies ?? {}),
1190
1305
  ...Object.keys(pkg.peerDependencies ?? {})
@@ -1236,10 +1351,11 @@ var allExternalImports = ({
1236
1351
  ...externalDistTypeImports
1237
1352
  ]);
1238
1353
  };
1239
- function isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs) {
1354
+ function isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs) {
1240
1355
  if (implicitDeps.has(dep)) return true;
1241
1356
  if (requiredPeers.has(dep)) return true;
1242
1357
  if (scriptRefs.has(dep)) return true;
1358
+ if (cliRefs.has(dep)) return true;
1243
1359
  if (dep.startsWith("@types/")) {
1244
1360
  const baseName = dep.replace(/^@types\//, "");
1245
1361
  return allImports.has(baseName) || allImports.has(dep) || implicitDeps.has(baseName);
@@ -1250,7 +1366,7 @@ function getUnusedDevDependencies({ name, location }, {
1250
1366
  devDependencies,
1251
1367
  dependencies,
1252
1368
  peerDependencies
1253
- }, sourceParams, fileContext) {
1369
+ }, sourceParams, fileContext, exclude) {
1254
1370
  const allImports = allExternalImports(sourceParams);
1255
1371
  const allDeps = [...dependencies, ...devDependencies, ...peerDependencies];
1256
1372
  const implicitDeps = getImplicitDevDependencies({
@@ -1260,39 +1376,42 @@ function getUnusedDevDependencies({ name, location }, {
1260
1376
  });
1261
1377
  const requiredPeers = getRequiredPeerDependencies(location, allDeps);
1262
1378
  const scriptRefs = getScriptReferencedPackages(location, allDeps);
1379
+ const cliRefs = getCliReferencedPackagesFromFiles(fileContext.allFiles, location, allDeps);
1263
1380
  let unusedDevDependencies = 0;
1264
1381
  for (const dep of devDependencies) {
1382
+ if (exclude?.has(dep)) continue;
1265
1383
  if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
1266
- if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs)) {
1384
+ if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
1267
1385
  unusedDevDependencies++;
1268
- console.log(`[${chalk16.blue(name)}] Unused devDependency in package.json: ${chalk16.red(dep)}`);
1386
+ console.log(`[${chalk17.blue(name)}] Unused devDependency in package.json: ${chalk17.red(dep)}`);
1269
1387
  }
1270
1388
  }
1271
1389
  if (unusedDevDependencies > 0) {
1272
1390
  const packageLocation = `${location}/package.json`;
1273
- console.log(` ${chalk16.yellow(packageLocation)}
1391
+ console.log(` ${chalk17.yellow(packageLocation)}
1274
1392
  `);
1275
1393
  }
1276
1394
  return unusedDevDependencies;
1277
1395
  }
1278
1396
 
1279
1397
  // src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
1280
- import chalk17 from "chalk";
1281
- function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
1398
+ import chalk18 from "chalk";
1399
+ function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
1282
1400
  let unusedDependencies = 0;
1283
1401
  for (const dep of peerDependencies) {
1402
+ if (exclude?.has(dep)) continue;
1284
1403
  if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
1285
1404
  unusedDependencies++;
1286
1405
  if (dependencies.includes(dep)) {
1287
- console.log(`[${chalk17.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk17.red(dep)}`);
1406
+ console.log(`[${chalk18.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk18.red(dep)}`);
1288
1407
  } else {
1289
- console.log(`[${chalk17.blue(name)}] Unused peerDependency in package.json: ${chalk17.red(dep)}`);
1408
+ console.log(`[${chalk18.blue(name)}] Unused peerDependency in package.json: ${chalk18.red(dep)}`);
1290
1409
  }
1291
1410
  }
1292
1411
  }
1293
1412
  if (unusedDependencies > 0) {
1294
1413
  const packageLocation = `${location}/package.json`;
1295
- console.log(` ${chalk17.yellow(packageLocation)}
1414
+ console.log(` ${chalk18.yellow(packageLocation)}
1296
1415
  `);
1297
1416
  }
1298
1417
  return unusedDependencies;
@@ -1317,6 +1436,7 @@ function checkPackage({
1317
1436
  location,
1318
1437
  deps = false,
1319
1438
  devDeps = false,
1439
+ exclude,
1320
1440
  peerDeps = false,
1321
1441
  verbose = false
1322
1442
  }) {
@@ -1335,23 +1455,29 @@ function checkPackage({
1335
1455
  });
1336
1456
  const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
1337
1457
  const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
1338
- const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
1458
+ const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams, exclude) : 0;
1339
1459
  const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
1340
1460
  const fileContext = { allFiles, distFiles };
1341
- const unusedDevDependencies = checkDevDeps ? getUnusedDevDependencies({ name, location }, packageParams, sourceParams, fileContext) : 0;
1342
- const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
1461
+ const unusedDevDependencies = checkDevDeps ? getUnusedDevDependencies({ name, location }, packageParams, sourceParams, fileContext, exclude) : 0;
1462
+ const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams, exclude) : 0;
1343
1463
  const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedDevDependencies + unusedPeerDependencies;
1344
1464
  return totalErrors;
1345
1465
  }
1346
1466
 
1347
1467
  // src/actions/deplint/deplint.ts
1348
- var deplint = ({
1468
+ var deplint = async ({
1349
1469
  pkg,
1350
1470
  deps,
1351
1471
  devDeps,
1352
1472
  peerDeps,
1353
- verbose
1473
+ verbose,
1474
+ cliExclude
1354
1475
  }) => {
1476
+ const config2 = await loadConfig();
1477
+ const exclude = /* @__PURE__ */ new Set([
1478
+ ...config2.deplint?.exclude ?? [],
1479
+ ...cliExclude ?? []
1480
+ ]);
1355
1481
  let totalErrors = 0;
1356
1482
  if (pkg === void 0) {
1357
1483
  const workspaces = yarnWorkspaces();
@@ -1361,6 +1487,7 @@ var deplint = ({
1361
1487
  ...workspace,
1362
1488
  deps,
1363
1489
  devDeps,
1490
+ exclude,
1364
1491
  peerDeps,
1365
1492
  verbose
1366
1493
  });
@@ -1373,14 +1500,15 @@ var deplint = ({
1373
1500
  location,
1374
1501
  devDeps,
1375
1502
  deps,
1503
+ exclude,
1376
1504
  peerDeps,
1377
1505
  verbose
1378
1506
  });
1379
1507
  }
1380
1508
  if (totalErrors > 0) {
1381
- console.warn(`Deplint: Found ${chalk18.red(totalErrors)} dependency problems. ${chalk18.red("\u2716")}`);
1509
+ console.warn(`Deplint: Found ${chalk19.red(totalErrors)} dependency problems. ${chalk19.red("\u2716")}`);
1382
1510
  } else {
1383
- console.info(`Deplint: Found no dependency problems. ${chalk18.green("\u2714")}`);
1511
+ console.info(`Deplint: Found no dependency problems. ${chalk19.green("\u2714")}`);
1384
1512
  }
1385
1513
  return 0;
1386
1514
  };
@@ -1482,22 +1610,22 @@ var deployNext = () => {
1482
1610
  };
1483
1611
 
1484
1612
  // src/actions/dupdeps.ts
1485
- import chalk19 from "chalk";
1613
+ import chalk20 from "chalk";
1486
1614
  var dupdeps = () => {
1487
- console.log(chalk19.green("Checking all Dependencies for Duplicates"));
1615
+ console.log(chalk20.green("Checking all Dependencies for Duplicates"));
1488
1616
  const allDependencies = parsedPackageJSON()?.dependencies;
1489
1617
  const dependencies = Object.entries(allDependencies).map(([k]) => k);
1490
1618
  return detectDuplicateDependencies(dependencies);
1491
1619
  };
1492
1620
 
1493
1621
  // src/actions/lint.ts
1494
- import chalk20 from "chalk";
1622
+ import chalk21 from "chalk";
1495
1623
  var lintPackage = ({
1496
1624
  pkg,
1497
1625
  fix: fix2,
1498
1626
  verbose
1499
1627
  }) => {
1500
- console.log(chalk20.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1628
+ console.log(chalk21.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1501
1629
  const start = Date.now();
1502
1630
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
1503
1631
  ["yarn", [
@@ -1507,7 +1635,7 @@ var lintPackage = ({
1507
1635
  fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
1508
1636
  ]]
1509
1637
  ]);
1510
- console.log(chalk20.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk20.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk20.gray("seconds")}`));
1638
+ console.log(chalk21.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk21.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk21.gray("seconds")}`));
1511
1639
  return result;
1512
1640
  };
1513
1641
  var lint = ({
@@ -1527,13 +1655,13 @@ var lint = ({
1527
1655
  });
1528
1656
  };
1529
1657
  var lintAllPackages = ({ fix: fix2 = false } = {}) => {
1530
- console.log(chalk20.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1658
+ console.log(chalk21.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1531
1659
  const start = Date.now();
1532
1660
  const fixOptions = fix2 ? ["--fix"] : [];
1533
1661
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1534
1662
  ["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
1535
1663
  ]);
1536
- console.log(chalk20.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk20.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk20.gray("seconds")}`));
1664
+ console.log(chalk21.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk21.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk21.gray("seconds")}`));
1537
1665
  return result;
1538
1666
  };
1539
1667
 
@@ -1561,7 +1689,7 @@ var filename = ".gitignore";
1561
1689
  var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
1562
1690
 
1563
1691
  // src/actions/gitlint.ts
1564
- import chalk21 from "chalk";
1692
+ import chalk22 from "chalk";
1565
1693
  import ParseGitConfig from "parse-git-config";
1566
1694
  var gitlint = () => {
1567
1695
  console.log(`
@@ -1572,7 +1700,7 @@ Gitlint Start [${process.cwd()}]
1572
1700
  const errors = 0;
1573
1701
  const gitConfig = ParseGitConfig.sync();
1574
1702
  const warn = (message) => {
1575
- console.warn(chalk21.yellow(`Warning: ${message}`));
1703
+ console.warn(chalk22.yellow(`Warning: ${message}`));
1576
1704
  warnings++;
1577
1705
  };
1578
1706
  if (gitConfig.core.ignorecase) {
@@ -1592,13 +1720,13 @@ Gitlint Start [${process.cwd()}]
1592
1720
  }
1593
1721
  const resultMessages = [];
1594
1722
  if (valid > 0) {
1595
- resultMessages.push(chalk21.green(`Passed: ${valid}`));
1723
+ resultMessages.push(chalk22.green(`Passed: ${valid}`));
1596
1724
  }
1597
1725
  if (warnings > 0) {
1598
- resultMessages.push(chalk21.yellow(`Warnings: ${warnings}`));
1726
+ resultMessages.push(chalk22.yellow(`Warnings: ${warnings}`));
1599
1727
  }
1600
1728
  if (errors > 0) {
1601
- resultMessages.push(chalk21.red(` Errors: ${errors}`));
1729
+ resultMessages.push(chalk22.red(` Errors: ${errors}`));
1602
1730
  }
1603
1731
  console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
1604
1732
  `);
@@ -1607,7 +1735,7 @@ Gitlint Start [${process.cwd()}]
1607
1735
 
1608
1736
  // src/actions/gitlint-fix.ts
1609
1737
  import { execSync as execSync2 } from "child_process";
1610
- import chalk22 from "chalk";
1738
+ import chalk23 from "chalk";
1611
1739
  import ParseGitConfig2 from "parse-git-config";
1612
1740
  var gitlintFix = () => {
1613
1741
  console.log(`
@@ -1616,15 +1744,15 @@ Gitlint Fix Start [${process.cwd()}]
1616
1744
  const gitConfig = ParseGitConfig2.sync();
1617
1745
  if (gitConfig.core.ignorecase) {
1618
1746
  execSync2("git config core.ignorecase false", { stdio: "inherit" });
1619
- console.warn(chalk22.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
1747
+ console.warn(chalk23.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
1620
1748
  }
1621
1749
  if (gitConfig.core.autocrlf !== false) {
1622
1750
  execSync2("git config core.autocrlf false", { stdio: "inherit" });
1623
- console.warn(chalk22.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
1751
+ console.warn(chalk23.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
1624
1752
  }
1625
1753
  if (gitConfig.core.eol !== "lf") {
1626
1754
  execSync2("git config core.eol lf", { stdio: "inherit" });
1627
- console.warn(chalk22.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
1755
+ console.warn(chalk23.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
1628
1756
  }
1629
1757
  return 1;
1630
1758
  };
@@ -1635,7 +1763,7 @@ var knip = () => {
1635
1763
  };
1636
1764
 
1637
1765
  // src/actions/license.ts
1638
- import chalk23 from "chalk";
1766
+ import chalk24 from "chalk";
1639
1767
  import { init } from "license-checker";
1640
1768
  var license = async (pkg) => {
1641
1769
  const workspaces = yarnWorkspaces();
@@ -1660,18 +1788,18 @@ var license = async (pkg) => {
1660
1788
  "LGPL-3.0-or-later",
1661
1789
  "Python-2.0"
1662
1790
  ]);
1663
- console.log(chalk23.green("License Checker"));
1791
+ console.log(chalk24.green("License Checker"));
1664
1792
  return (await Promise.all(
1665
1793
  workspaceList.map(({ location, name }) => {
1666
1794
  return new Promise((resolve) => {
1667
1795
  init({ production: true, start: location }, (error, packages) => {
1668
1796
  if (error) {
1669
- console.error(chalk23.red(`License Checker [${name}] Error`));
1670
- console.error(chalk23.gray(error));
1797
+ console.error(chalk24.red(`License Checker [${name}] Error`));
1798
+ console.error(chalk24.gray(error));
1671
1799
  console.log("\n");
1672
1800
  resolve(1);
1673
1801
  } else {
1674
- console.log(chalk23.green(`License Checker [${name}]`));
1802
+ console.log(chalk24.green(`License Checker [${name}]`));
1675
1803
  let count = 0;
1676
1804
  for (const [name2, info] of Object.entries(packages)) {
1677
1805
  const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
@@ -1687,7 +1815,7 @@ var license = async (pkg) => {
1687
1815
  }
1688
1816
  if (!orLicenseFound) {
1689
1817
  count++;
1690
- console.warn(chalk23.yellow(`${name2}: Package License not allowed [${license2}]`));
1818
+ console.warn(chalk24.yellow(`${name2}: Package License not allowed [${license2}]`));
1691
1819
  }
1692
1820
  }
1693
1821
  }
@@ -1731,7 +1859,7 @@ var rebuild = ({ target }) => {
1731
1859
  };
1732
1860
 
1733
1861
  // src/actions/recompile.ts
1734
- import chalk24 from "chalk";
1862
+ import chalk25 from "chalk";
1735
1863
  var recompile = async ({
1736
1864
  verbose,
1737
1865
  target,
@@ -1767,7 +1895,7 @@ var recompileAll = async ({
1767
1895
  const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
1768
1896
  const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
1769
1897
  if (jobs) {
1770
- console.log(chalk24.blue(`Jobs set to [${jobs}]`));
1898
+ console.log(chalk25.blue(`Jobs set to [${jobs}]`));
1771
1899
  }
1772
1900
  const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
1773
1901
  [
@@ -1798,7 +1926,7 @@ var recompileAll = async ({
1798
1926
  ]
1799
1927
  ]);
1800
1928
  console.log(
1801
- `${chalk24.gray("Recompiled in")} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`
1929
+ `${chalk25.gray("Recompiled in")} [${chalk25.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk25.gray("seconds")}`
1802
1930
  );
1803
1931
  return result;
1804
1932
  };
@@ -1829,13 +1957,13 @@ var reinstall = () => {
1829
1957
  };
1830
1958
 
1831
1959
  // src/actions/relint.ts
1832
- import chalk25 from "chalk";
1960
+ import chalk26 from "chalk";
1833
1961
  var relintPackage = ({
1834
1962
  pkg,
1835
1963
  fix: fix2,
1836
1964
  verbose
1837
1965
  }) => {
1838
- console.log(chalk25.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1966
+ console.log(chalk26.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1839
1967
  const start = Date.now();
1840
1968
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
1841
1969
  ["yarn", [
@@ -1845,7 +1973,7 @@ var relintPackage = ({
1845
1973
  fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
1846
1974
  ]]
1847
1975
  ]);
1848
- console.log(chalk25.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk25.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk25.gray("seconds")}`));
1976
+ console.log(chalk26.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk26.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk26.gray("seconds")}`));
1849
1977
  return result;
1850
1978
  };
1851
1979
  var relint = ({
@@ -1865,13 +1993,13 @@ var relint = ({
1865
1993
  });
1866
1994
  };
1867
1995
  var relintAllPackages = ({ fix: fix2 = false } = {}) => {
1868
- console.log(chalk25.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1996
+ console.log(chalk26.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1869
1997
  const start = Date.now();
1870
1998
  const fixOptions = fix2 ? ["--fix"] : [];
1871
1999
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1872
2000
  ["yarn", ["eslint", ...fixOptions]]
1873
2001
  ]);
1874
- console.log(chalk25.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk25.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk25.gray("seconds")}`));
2002
+ console.log(chalk26.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk26.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk26.gray("seconds")}`));
1875
2003
  return result;
1876
2004
  };
1877
2005
 
@@ -1889,10 +2017,10 @@ var sonar = () => {
1889
2017
  };
1890
2018
 
1891
2019
  // src/actions/statics.ts
1892
- import chalk26 from "chalk";
2020
+ import chalk27 from "chalk";
1893
2021
  var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
1894
2022
  var statics = () => {
1895
- console.log(chalk26.green("Check Required Static Dependencies"));
2023
+ console.log(chalk27.green("Check Required Static Dependencies"));
1896
2024
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
1897
2025
  return detectDuplicateDependencies(statics2, DefaultDependencies);
1898
2026
  };
@@ -2315,7 +2443,7 @@ var xyInstallCommands = (args) => {
2315
2443
  };
2316
2444
 
2317
2445
  // src/xy/xyLintCommands.ts
2318
- import chalk27 from "chalk";
2446
+ import chalk28 from "chalk";
2319
2447
  var xyLintCommands = (args) => {
2320
2448
  return args.command(
2321
2449
  "cycle [package]",
@@ -2327,7 +2455,7 @@ var xyLintCommands = (args) => {
2327
2455
  const start = Date.now();
2328
2456
  if (argv.verbose) console.log("Cycle");
2329
2457
  process.exitCode = await cycle({ pkg: argv.package });
2330
- console.log(chalk27.blue(`Finished in ${Date.now() - start}ms`));
2458
+ console.log(chalk28.blue(`Finished in ${Date.now() - start}ms`));
2331
2459
  }
2332
2460
  ).command(
2333
2461
  "lint [package]",
@@ -2357,7 +2485,7 @@ var xyLintCommands = (args) => {
2357
2485
  cache: argv.cache,
2358
2486
  verbose: !!argv.verbose
2359
2487
  });
2360
- console.log(chalk27.blue(`Finished in ${Date.now() - start}ms`));
2488
+ console.log(chalk28.blue(`Finished in ${Date.now() - start}ms`));
2361
2489
  }
2362
2490
  ).command(
2363
2491
  "deplint [package]",
@@ -2378,19 +2506,25 @@ var xyLintCommands = (args) => {
2378
2506
  default: false,
2379
2507
  description: "Check peerDependencies",
2380
2508
  type: "boolean"
2509
+ }).option("exclude", {
2510
+ alias: "e",
2511
+ description: "Package names to exclude from unused checks (comma-separated or repeated)",
2512
+ type: "array"
2381
2513
  });
2382
2514
  },
2383
- (argv) => {
2515
+ async (argv) => {
2384
2516
  if (argv.verbose) console.log("Deplint");
2385
2517
  const start = Date.now();
2386
- process.exitCode = deplint({
2518
+ const cliExclude = argv.exclude?.flatMap((v) => String(v).split(",")).map((v) => v.trim()).filter(Boolean);
2519
+ process.exitCode = await deplint({
2520
+ cliExclude,
2387
2521
  pkg: argv.package,
2388
2522
  deps: !!argv.deps,
2389
2523
  devDeps: !!argv.devDeps,
2390
2524
  peerDeps: !!argv.peerDeps,
2391
2525
  verbose: !!argv.verbose
2392
2526
  });
2393
- console.log(chalk27.blue(`Finished in ${Date.now() - start}ms`));
2527
+ console.log(chalk28.blue(`Finished in ${Date.now() - start}ms`));
2394
2528
  }
2395
2529
  ).command(
2396
2530
  "fix [package]",
@@ -2402,7 +2536,7 @@ var xyLintCommands = (args) => {
2402
2536
  const start = Date.now();
2403
2537
  if (argv.verbose) console.log("Fix");
2404
2538
  process.exitCode = fix();
2405
- console.log(chalk27.blue(`Finished in ${Date.now() - start}ms`));
2539
+ console.log(chalk28.blue(`Finished in ${Date.now() - start}ms`));
2406
2540
  }
2407
2541
  ).command(
2408
2542
  "relint [package]",
@@ -2414,7 +2548,7 @@ var xyLintCommands = (args) => {
2414
2548
  if (argv.verbose) console.log("Relinting");
2415
2549
  const start = Date.now();
2416
2550
  process.exitCode = relint();
2417
- console.log(chalk27.blue(`Finished in ${Date.now() - start}ms`));
2551
+ console.log(chalk28.blue(`Finished in ${Date.now() - start}ms`));
2418
2552
  }
2419
2553
  ).command(
2420
2554
  "publint [package]",
@@ -2426,7 +2560,7 @@ var xyLintCommands = (args) => {
2426
2560
  if (argv.verbose) console.log("Publint");
2427
2561
  const start = Date.now();
2428
2562
  process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
2429
- console.log(chalk27.blue(`Finished in ${Date.now() - start}ms`));
2563
+ console.log(chalk28.blue(`Finished in ${Date.now() - start}ms`));
2430
2564
  }
2431
2565
  ).command(
2432
2566
  "knip",
@@ -2438,7 +2572,7 @@ var xyLintCommands = (args) => {
2438
2572
  if (argv.verbose) console.log("Knip");
2439
2573
  const start = Date.now();
2440
2574
  process.exitCode = knip();
2441
- console.log(chalk27.blue(`Knip finished in ${Date.now() - start}ms`));
2575
+ console.log(chalk28.blue(`Knip finished in ${Date.now() - start}ms`));
2442
2576
  }
2443
2577
  ).command(
2444
2578
  "sonar",
@@ -2450,7 +2584,7 @@ var xyLintCommands = (args) => {
2450
2584
  const start = Date.now();
2451
2585
  if (argv.verbose) console.log("Sonar Check");
2452
2586
  process.exitCode = sonar();
2453
- console.log(chalk27.blue(`Finished in ${Date.now() - start}ms`));
2587
+ console.log(chalk28.blue(`Finished in ${Date.now() - start}ms`));
2454
2588
  }
2455
2589
  );
2456
2590
  };
@@ -2486,8 +2620,8 @@ var xyParseOptions = () => {
2486
2620
  var xy = async () => {
2487
2621
  const options = xyParseOptions();
2488
2622
  return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
2489
- console.error(chalk28.yellow(`Command not found [${chalk28.magenta(process.argv[2])}]`));
2490
- console.log(chalk28.gray("Try 'yarn xy --help' for list of commands"));
2623
+ console.error(chalk29.yellow(`Command not found [${chalk29.magenta(process.argv[2])}]`));
2624
+ console.log(chalk29.gray("Try 'yarn xy --help' for list of commands"));
2491
2625
  }).version().help().argv;
2492
2626
  };
2493
2627
  export {