@xylabs/ts-scripts-yarn3 7.3.1 → 7.4.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.
Files changed (41) hide show
  1. package/dist/actions/cycle.mjs +1 -1
  2. package/dist/actions/cycle.mjs.map +1 -1
  3. package/dist/actions/deplint/checkPackage/checkPackage.mjs +278 -35
  4. package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
  5. package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +13 -6
  6. package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -1
  7. package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +3 -1
  8. package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -1
  9. package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs +175 -0
  10. package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs.map +1 -0
  11. package/dist/actions/deplint/checkPackage/index.mjs +278 -35
  12. package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
  13. package/dist/actions/deplint/deplint.mjs +281 -38
  14. package/dist/actions/deplint/deplint.mjs.map +1 -1
  15. package/dist/actions/deplint/findFiles.mjs +8 -2
  16. package/dist/actions/deplint/findFiles.mjs.map +1 -1
  17. package/dist/actions/deplint/getExtendsFromTsconfigs.mjs +44 -0
  18. package/dist/actions/deplint/getExtendsFromTsconfigs.mjs.map +1 -0
  19. package/dist/actions/deplint/getExternalImportsFromFiles.mjs +15 -1
  20. package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
  21. package/dist/actions/deplint/getRequiredPeerDependencies.mjs +36 -0
  22. package/dist/actions/deplint/getRequiredPeerDependencies.mjs.map +1 -0
  23. package/dist/actions/deplint/getScriptReferencedPackages.mjs +81 -0
  24. package/dist/actions/deplint/getScriptReferencedPackages.mjs.map +1 -0
  25. package/dist/actions/deplint/implicitDevDependencies.mjs +25 -0
  26. package/dist/actions/deplint/implicitDevDependencies.mjs.map +1 -0
  27. package/dist/actions/deplint/index.mjs +281 -38
  28. package/dist/actions/deplint/index.mjs.map +1 -1
  29. package/dist/actions/index.mjs +385 -142
  30. package/dist/actions/index.mjs.map +1 -1
  31. package/dist/bin/xy.mjs +328 -85
  32. package/dist/bin/xy.mjs.map +1 -1
  33. package/dist/index.mjs +397 -154
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/xy/index.mjs +328 -85
  36. package/dist/xy/index.mjs.map +1 -1
  37. package/dist/xy/xy.mjs +328 -85
  38. package/dist/xy/xy.mjs.map +1 -1
  39. package/dist/xy/xyLintCommands.mjs +301 -58
  40. package/dist/xy/xyLintCommands.mjs.map +1 -1
  41. package/package.json +15 -16
@@ -315,8 +315,8 @@ var loadConfig = async (params) => {
315
315
 
316
316
  // src/lib/parsedPackageJSON.ts
317
317
  import { readFileSync as readFileSync2 } from "fs";
318
- var parsedPackageJSON = (path11) => {
319
- const pathToPackageJSON = path11 ?? process.env.npm_package_json ?? "";
318
+ var parsedPackageJSON = (path13) => {
319
+ const pathToPackageJSON = path13 ?? process.env.npm_package_json ?? "";
320
320
  const packageJSON = readFileSync2(pathToPackageJSON).toString();
321
321
  return JSON.parse(packageJSON);
322
322
  };
@@ -598,7 +598,7 @@ var cycleAll = async ({ verbose = false }) => {
598
598
  combinedDependencies: true,
599
599
  outputType: verbose ? "text" : "err"
600
600
  };
601
- const target = "**/src";
601
+ const target = "**/packages/*/src";
602
602
  console.log(`Checking for circular dependencies in ${target}...`);
603
603
  const result = await cruise([target], cruiseOptions);
604
604
  if (result.output) {
@@ -618,7 +618,7 @@ var dead = () => {
618
618
  };
619
619
 
620
620
  // src/actions/deplint/deplint.ts
621
- import chalk16 from "chalk";
621
+ import chalk17 from "chalk";
622
622
 
623
623
  // src/actions/deplint/findFilesByGlob.ts
624
624
  import { globSync } from "glob";
@@ -627,12 +627,18 @@ function findFilesByGlob(cwd5, pattern) {
627
627
  }
628
628
 
629
629
  // src/actions/deplint/findFiles.ts
630
- function findFiles(path11) {
631
- const allSourceInclude = ["./src/**/*.{ts,tsx}"];
630
+ function findFiles(path13) {
631
+ const allSourceInclude = ["./src/**/*.{ts,tsx,mts,cts,js,mjs,cjs}"];
632
632
  const allDistInclude = ["./dist/**/*.d.ts", "./dist/**/*.{mjs,js,cjs}"];
633
- const srcFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path11, pattern));
634
- const distFiles = allDistInclude.flatMap((pattern) => findFilesByGlob(path11, pattern));
635
- return { srcFiles, distFiles };
633
+ const allConfigInclude = ["./*.config.{ts,mts,mjs,js}"];
634
+ const srcFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path13, pattern));
635
+ const distFiles = allDistInclude.flatMap((pattern) => findFilesByGlob(path13, pattern));
636
+ const configFiles = allConfigInclude.flatMap((pattern) => findFilesByGlob(path13, pattern));
637
+ return {
638
+ srcFiles,
639
+ distFiles,
640
+ configFiles
641
+ };
636
642
  }
637
643
 
638
644
  // src/actions/deplint/getDependenciesFromPackageJson.ts
@@ -652,10 +658,9 @@ function getDependenciesFromPackageJson(packageJsonPath) {
652
658
  };
653
659
  }
654
660
 
655
- // src/actions/deplint/getImportsFromFile.ts
661
+ // src/actions/deplint/getExtendsFromTsconfigs.ts
656
662
  import fs3 from "fs";
657
- import path4 from "path";
658
- import ts from "typescript";
663
+ import { globSync as globSync2 } from "glob";
659
664
 
660
665
  // src/actions/deplint/getBasePackageName.ts
661
666
  function getBasePackageName(importName) {
@@ -667,7 +672,37 @@ function getBasePackageName(importName) {
667
672
  return importNameScrubbed.split("/")[0];
668
673
  }
669
674
 
675
+ // src/actions/deplint/getExtendsFromTsconfigs.ts
676
+ var isExternalReference = (ref) => !ref.startsWith(".") && !ref.startsWith("/");
677
+ function parseExtendsField(value) {
678
+ if (typeof value === "string") return [value];
679
+ if (Array.isArray(value)) return value.filter((v) => typeof v === "string");
680
+ return [];
681
+ }
682
+ function getExtendsFromTsconfigs(location) {
683
+ const tsconfigFiles = globSync2("./tsconfig*.json", { cwd: location, absolute: true });
684
+ const packages = /* @__PURE__ */ new Set();
685
+ for (const file of tsconfigFiles) {
686
+ try {
687
+ const content = fs3.readFileSync(file, "utf8");
688
+ const cleaned = content.replaceAll(/\/\/.*/g, "").replaceAll(/,\s*([}\]])/g, "$1");
689
+ const parsed = JSON.parse(cleaned);
690
+ const refs = parseExtendsField(parsed.extends);
691
+ for (const ref of refs) {
692
+ if (isExternalReference(ref)) {
693
+ packages.add(getBasePackageName(ref));
694
+ }
695
+ }
696
+ } catch {
697
+ }
698
+ }
699
+ return [...packages];
700
+ }
701
+
670
702
  // src/actions/deplint/getImportsFromFile.ts
703
+ import fs4 from "fs";
704
+ import path4 from "path";
705
+ import ts from "typescript";
671
706
  function isTypeOnlyImportClause(clause) {
672
707
  if (clause === void 0) {
673
708
  return false;
@@ -680,7 +715,7 @@ function isTypeOnlyImportClause(clause) {
680
715
  return clause.isTypeOnly;
681
716
  }
682
717
  function getImportsFromFile(filePath, importPaths, typeImportPaths) {
683
- const sourceCode = fs3.readFileSync(filePath, "utf8");
718
+ const sourceCode = fs4.readFileSync(filePath, "utf8");
684
719
  const isMjsFile = filePath.endsWith(".mjs");
685
720
  const sourceFile = ts.createSourceFile(
686
721
  path4.basename(filePath),
@@ -733,24 +768,38 @@ var internalImportPrefixes = [".", "#", "node:"];
733
768
  var removeInternalImports = (imports) => {
734
769
  return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
735
770
  };
736
- function getExternalImportsFromFiles({ srcFiles, distFiles }) {
771
+ function getExternalImportsFromFiles({
772
+ srcFiles,
773
+ distFiles,
774
+ configFiles = [],
775
+ tsconfigExtends = []
776
+ }) {
737
777
  const srcImportPaths = {};
738
778
  const distImportPaths = {};
739
779
  const distTypeImportPaths = {};
740
- for (const path11 of srcFiles) getImportsFromFile(path11, srcImportPaths, srcImportPaths).flat();
780
+ const configImportPaths = {};
781
+ for (const path13 of srcFiles) getImportsFromFile(path13, srcImportPaths, srcImportPaths).flat();
782
+ for (const path13 of configFiles) getImportsFromFile(path13, configImportPaths, configImportPaths).flat();
741
783
  const distTypeFiles = distFiles.filter((file) => file.endsWith(".d.ts") || file.endsWith(".d.cts") || file.endsWith(".d.mts"));
742
784
  const distCodeFiles = distFiles.filter((file) => !(file.endsWith(".d.ts") || file.endsWith(".d.cts") || file.endsWith(".d.mts")));
743
- for (const path11 of distCodeFiles) getImportsFromFile(path11, distImportPaths, distImportPaths).flat();
744
- for (const path11 of distTypeFiles) getImportsFromFile(path11, distTypeImportPaths, distTypeImportPaths).flat();
785
+ for (const path13 of distCodeFiles) getImportsFromFile(path13, distImportPaths, distImportPaths).flat();
786
+ for (const path13 of distTypeFiles) getImportsFromFile(path13, distTypeImportPaths, distTypeImportPaths).flat();
745
787
  const srcImports = Object.keys(srcImportPaths);
746
788
  const distImports = Object.keys(distImportPaths);
747
789
  const distTypeImports = Object.keys(distTypeImportPaths);
748
790
  const externalSrcImports = removeInternalImports(srcImports);
749
791
  const externalDistImports = removeInternalImports(distImports);
750
792
  const externalDistTypeImports = removeInternalImports(distTypeImports);
793
+ const externalConfigImports = removeInternalImports(Object.keys(configImportPaths));
794
+ for (const ext of tsconfigExtends) {
795
+ if (!externalSrcImports.includes(ext)) externalSrcImports.push(ext);
796
+ if (!externalConfigImports.includes(ext)) externalConfigImports.push(ext);
797
+ }
751
798
  return {
799
+ configImportPaths,
752
800
  srcImports,
753
801
  srcImportPaths,
802
+ externalConfigImports,
754
803
  externalSrcImports,
755
804
  distImports,
756
805
  distImportPaths,
@@ -762,6 +811,15 @@ function getExternalImportsFromFiles({ srcFiles, distFiles }) {
762
811
  // src/actions/deplint/checkPackage/getUnlistedDependencies.ts
763
812
  import { builtinModules } from "module";
764
813
  import chalk12 from "chalk";
814
+ function isListedOrBuiltin(imp, name, dependencies, peerDependencies) {
815
+ return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp) || builtinModules.includes(`@types/${imp}`);
816
+ }
817
+ function logMissing(name, imp, importPaths) {
818
+ console.log(`[${chalk12.blue(name)}] Missing dependency in package.json: ${chalk12.red(imp)}`);
819
+ if (importPaths[imp]) {
820
+ console.log(` ${importPaths[imp].join("\n ")}`);
821
+ }
822
+ }
765
823
  function getUnlistedDependencies({ name, location }, { dependencies, peerDependencies }, {
766
824
  externalDistImports,
767
825
  externalDistTypeImports,
@@ -769,17 +827,15 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
769
827
  }) {
770
828
  let unlistedDependencies = 0;
771
829
  for (const imp of externalDistImports) {
772
- if (!dependencies.includes(imp) && imp !== name && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !builtinModules.includes(imp) && !builtinModules.includes(`@types/${imp}`)) {
830
+ if (!isListedOrBuiltin(imp, name, dependencies, peerDependencies)) {
773
831
  unlistedDependencies++;
774
- console.log(`[${chalk12.blue(name)}] Missing dependency in package.json: ${chalk12.red(imp)}`);
775
- console.log(` ${distImportPaths[imp].join("\n ")}`);
832
+ logMissing(name, imp, distImportPaths);
776
833
  }
777
834
  }
778
835
  for (const imp of externalDistTypeImports) {
779
- if (!dependencies.includes(imp) && imp !== name && dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && peerDependencies.includes(`@types/${imp}`) && !builtinModules.includes(imp) && builtinModules.includes(`@types/${imp}`)) {
836
+ if (!isListedOrBuiltin(imp, name, dependencies, peerDependencies)) {
780
837
  unlistedDependencies++;
781
- console.log(`[${chalk12.blue(name)}] Missing dependency in package.json: ${chalk12.red(imp)}`);
782
- console.log(` ${distImportPaths[imp].join("\n ")}`);
838
+ logMissing(name, imp, distImportPaths);
783
839
  }
784
840
  }
785
841
  if (unlistedDependencies > 0) {
@@ -807,7 +863,9 @@ function getUnlistedDevDependencies({ name, location }, {
807
863
  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)) {
808
864
  unlistedDevDependencies++;
809
865
  console.log(`[${chalk13.blue(name)}] Missing devDependency in package.json: ${chalk13.red(imp)}`);
810
- console.log(` ${srcImportPaths[imp].join("\n ")}`);
866
+ if (srcImportPaths[imp]) {
867
+ console.log(` ${srcImportPaths[imp].join("\n ")}`);
868
+ }
811
869
  }
812
870
  }
813
871
  if (unlistedDevDependencies > 0) {
@@ -844,29 +902,205 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
844
902
  return unusedDependencies;
845
903
  }
846
904
 
847
- // src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
905
+ // src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
848
906
  import chalk15 from "chalk";
907
+
908
+ // src/actions/deplint/getRequiredPeerDependencies.ts
909
+ import fs5 from "fs";
910
+ import path5 from "path";
911
+ function findDepPackageJson(location, dep) {
912
+ let dir = location;
913
+ while (true) {
914
+ const candidate = path5.join(dir, "node_modules", dep, "package.json");
915
+ if (fs5.existsSync(candidate)) return candidate;
916
+ const parent = path5.dirname(dir);
917
+ if (parent === dir) return void 0;
918
+ dir = parent;
919
+ }
920
+ }
921
+ function getRequiredPeerDependencies(location, allDeps) {
922
+ const required = /* @__PURE__ */ new Set();
923
+ for (const dep of allDeps) {
924
+ const depPkgPath = findDepPackageJson(location, dep);
925
+ if (!depPkgPath) continue;
926
+ try {
927
+ const raw = fs5.readFileSync(depPkgPath, "utf8");
928
+ const pkg = JSON.parse(raw);
929
+ if (pkg.peerDependencies) {
930
+ for (const peer of Object.keys(pkg.peerDependencies)) {
931
+ required.add(peer);
932
+ }
933
+ }
934
+ } catch {
935
+ }
936
+ }
937
+ return required;
938
+ }
939
+
940
+ // src/actions/deplint/getScriptReferencedPackages.ts
941
+ import fs6 from "fs";
942
+ import path6 from "path";
943
+ function getBinNames(location, dep) {
944
+ const depPkgPath = findDepPackageJson(location, dep);
945
+ if (!depPkgPath) return [];
946
+ try {
947
+ const raw = fs6.readFileSync(depPkgPath, "utf8");
948
+ const pkg = JSON.parse(raw);
949
+ if (!pkg.bin) return [];
950
+ if (typeof pkg.bin === "string") return [pkg.name?.split("/").pop() ?? dep];
951
+ return Object.keys(pkg.bin);
952
+ } catch {
953
+ return [];
954
+ }
955
+ }
956
+ function tokenizeScript(script) {
957
+ return script.split(/[&|;$()"`\s]+/).map((t) => t.trim()).filter(Boolean);
958
+ }
959
+ function getScriptReferencedPackages(location, allDeps) {
960
+ const pkgPath = path6.join(location, "package.json");
961
+ let scripts = {};
962
+ try {
963
+ const raw = fs6.readFileSync(pkgPath, "utf8");
964
+ const pkg = JSON.parse(raw);
965
+ scripts = pkg.scripts ?? {};
966
+ } catch {
967
+ return /* @__PURE__ */ new Set();
968
+ }
969
+ const scriptText = Object.values(scripts).join(" ");
970
+ const tokens = new Set(tokenizeScript(scriptText));
971
+ const binToPackage = /* @__PURE__ */ new Map();
972
+ for (const dep of allDeps) {
973
+ const bins = getBinNames(location, dep);
974
+ for (const bin of bins) {
975
+ binToPackage.set(bin, dep);
976
+ }
977
+ }
978
+ const referenced = /* @__PURE__ */ new Set();
979
+ for (const token of tokens) {
980
+ const baseName = getBasePackageName(token);
981
+ if (allDeps.includes(baseName)) {
982
+ referenced.add(baseName);
983
+ }
984
+ const pkg = binToPackage.get(token);
985
+ if (pkg) {
986
+ referenced.add(pkg);
987
+ }
988
+ }
989
+ return referenced;
990
+ }
991
+
992
+ // src/actions/deplint/implicitDevDependencies.ts
993
+ var hasFileWithExtension = (files, extensions) => files.some((f) => extensions.some((ext) => f.endsWith(ext)));
994
+ var rules = [
995
+ {
996
+ package: "typescript",
997
+ isNeeded: ({ srcFiles, configFiles }) => hasFileWithExtension([...srcFiles, ...configFiles], [".ts", ".tsx", ".mts", ".cts"])
998
+ },
999
+ {
1000
+ package: "eslint-import-resolver-typescript",
1001
+ isNeeded: ({ srcFiles, configFiles }) => hasFileWithExtension([...srcFiles, ...configFiles], [".ts", ".tsx", ".mts", ".cts"])
1002
+ }
1003
+ ];
1004
+ function getImplicitDevDependencies(context) {
1005
+ const implicit = /* @__PURE__ */ new Set();
1006
+ for (const rule of rules) {
1007
+ if (rule.isNeeded(context)) {
1008
+ implicit.add(rule.package);
1009
+ }
1010
+ }
1011
+ return implicit;
1012
+ }
1013
+
1014
+ // src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
1015
+ var allExternalImports = ({
1016
+ externalSrcImports,
1017
+ externalDistImports,
1018
+ externalDistTypeImports,
1019
+ externalConfigImports
1020
+ }) => {
1021
+ const all = /* @__PURE__ */ new Set([
1022
+ ...externalSrcImports,
1023
+ ...externalDistImports,
1024
+ ...externalDistTypeImports,
1025
+ ...externalConfigImports
1026
+ ]);
1027
+ return all;
1028
+ };
1029
+ function isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs) {
1030
+ if (implicitDeps.has(dep)) return true;
1031
+ if (requiredPeers.has(dep)) return true;
1032
+ if (scriptRefs.has(dep)) return true;
1033
+ if (dep.startsWith("@types/")) {
1034
+ const baseName = dep.replace(/^@types\//, "");
1035
+ return allImports.has(baseName) || allImports.has(dep) || implicitDeps.has(baseName);
1036
+ }
1037
+ return allImports.has(dep);
1038
+ }
1039
+ function getUnusedDevDependencies({ name, location }, {
1040
+ devDependencies,
1041
+ dependencies,
1042
+ peerDependencies
1043
+ }, sourceParams, fileContext) {
1044
+ const allImports = allExternalImports(sourceParams);
1045
+ const implicitDeps = getImplicitDevDependencies(fileContext);
1046
+ const allDeps = [...dependencies, ...devDependencies, ...peerDependencies];
1047
+ const requiredPeers = getRequiredPeerDependencies(location, allDeps);
1048
+ const scriptRefs = getScriptReferencedPackages(location, allDeps);
1049
+ let unusedDevDependencies = 0;
1050
+ for (const dep of devDependencies) {
1051
+ if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
1052
+ if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs)) {
1053
+ unusedDevDependencies++;
1054
+ console.log(`[${chalk15.blue(name)}] Unused devDependency in package.json: ${chalk15.red(dep)}`);
1055
+ }
1056
+ }
1057
+ if (unusedDevDependencies > 0) {
1058
+ const packageLocation = `${location}/package.json`;
1059
+ console.log(` ${chalk15.yellow(packageLocation)}
1060
+ `);
1061
+ }
1062
+ return unusedDevDependencies;
1063
+ }
1064
+
1065
+ // src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
1066
+ import chalk16 from "chalk";
849
1067
  function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
850
1068
  let unusedDependencies = 0;
851
1069
  for (const dep of peerDependencies) {
852
1070
  if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
853
1071
  unusedDependencies++;
854
1072
  if (dependencies.includes(dep)) {
855
- console.log(`[${chalk15.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk15.red(dep)}`);
1073
+ console.log(`[${chalk16.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk16.red(dep)}`);
856
1074
  } else {
857
- console.log(`[${chalk15.blue(name)}] Unused peerDependency in package.json: ${chalk15.red(dep)}`);
1075
+ console.log(`[${chalk16.blue(name)}] Unused peerDependency in package.json: ${chalk16.red(dep)}`);
858
1076
  }
859
1077
  }
860
1078
  }
861
1079
  if (unusedDependencies > 0) {
862
1080
  const packageLocation = `${location}/package.json`;
863
- console.log(` ${chalk15.yellow(packageLocation)}
1081
+ console.log(` ${chalk16.yellow(packageLocation)}
864
1082
  `);
865
1083
  }
866
1084
  return unusedDependencies;
867
1085
  }
868
1086
 
869
1087
  // src/actions/deplint/checkPackage/checkPackage.ts
1088
+ function logVerbose(name, location, srcFiles, distFiles, configFiles, tsconfigExtends) {
1089
+ console.info(`Checking package: ${name} at ${location}`);
1090
+ console.info(`Source files: ${srcFiles.length}, Distribution files: ${distFiles.length}, Config files: ${configFiles.length}`);
1091
+ for (const file of srcFiles) {
1092
+ console.info(`Source file: ${file}`);
1093
+ }
1094
+ for (const file of distFiles) {
1095
+ console.info(`Distribution file: ${file}`);
1096
+ }
1097
+ for (const file of configFiles) {
1098
+ console.info(`Config file: ${file}`);
1099
+ }
1100
+ for (const ext of tsconfigExtends) {
1101
+ console.info(`Tsconfig extends: ${ext}`);
1102
+ }
1103
+ }
870
1104
  function checkPackage({
871
1105
  name,
872
1106
  location,
@@ -875,27 +1109,36 @@ function checkPackage({
875
1109
  peerDeps = false,
876
1110
  verbose = false
877
1111
  }) {
878
- const { srcFiles, distFiles } = findFiles(location);
1112
+ const {
1113
+ srcFiles,
1114
+ distFiles,
1115
+ configFiles
1116
+ } = findFiles(location);
1117
+ const tsconfigExtends = getExtendsFromTsconfigs(location);
879
1118
  if (verbose) {
880
- console.info(`Checking package: ${name} at ${location}`);
881
- console.info(`Source files: ${srcFiles.length}, Distribution files: ${distFiles.length}`);
882
- for (const file of srcFiles) {
883
- console.info(`Source file: ${file}`);
884
- }
885
- for (const file of distFiles) {
886
- console.info(`Distribution file: ${file}`);
887
- }
1119
+ logVerbose(name, location, srcFiles, distFiles, configFiles, tsconfigExtends);
888
1120
  }
889
1121
  const checkDeps = deps || !(deps || devDeps || peerDeps);
890
1122
  const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
891
1123
  const checkPeerDeps = peerDeps;
892
- const sourceParams = getExternalImportsFromFiles({ srcFiles, distFiles });
1124
+ const sourceParams = getExternalImportsFromFiles({
1125
+ srcFiles,
1126
+ distFiles,
1127
+ configFiles,
1128
+ tsconfigExtends
1129
+ });
893
1130
  const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
894
1131
  const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
895
1132
  const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
896
1133
  const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
1134
+ const fileContext = {
1135
+ configFiles,
1136
+ distFiles,
1137
+ srcFiles
1138
+ };
1139
+ const unusedDevDependencies = checkDevDeps ? getUnusedDevDependencies({ name, location }, packageParams, sourceParams, fileContext) : 0;
897
1140
  const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
898
- const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedPeerDependencies;
1141
+ const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedDevDependencies + unusedPeerDependencies;
899
1142
  return totalErrors;
900
1143
  }
901
1144
 
@@ -933,9 +1176,9 @@ var deplint = ({
933
1176
  });
934
1177
  }
935
1178
  if (totalErrors > 0) {
936
- console.warn(`Deplint: Found ${chalk16.red(totalErrors)} dependency problems. ${chalk16.red("\u2716")}`);
1179
+ console.warn(`Deplint: Found ${chalk17.red(totalErrors)} dependency problems. ${chalk17.red("\u2716")}`);
937
1180
  } else {
938
- console.info(`Deplint: Found no dependency problems. ${chalk16.green("\u2714")}`);
1181
+ console.info(`Deplint: Found no dependency problems. ${chalk17.green("\u2714")}`);
939
1182
  }
940
1183
  return 0;
941
1184
  };
@@ -1037,22 +1280,22 @@ var deployNext = () => {
1037
1280
  };
1038
1281
 
1039
1282
  // src/actions/dupdeps.ts
1040
- import chalk17 from "chalk";
1283
+ import chalk18 from "chalk";
1041
1284
  var dupdeps = () => {
1042
- console.log(chalk17.green("Checking all Dependencies for Duplicates"));
1285
+ console.log(chalk18.green("Checking all Dependencies for Duplicates"));
1043
1286
  const allDependencies = parsedPackageJSON()?.dependencies;
1044
1287
  const dependencies = Object.entries(allDependencies).map(([k]) => k);
1045
1288
  return detectDuplicateDependencies(dependencies);
1046
1289
  };
1047
1290
 
1048
1291
  // src/actions/lint.ts
1049
- import chalk18 from "chalk";
1292
+ import chalk19 from "chalk";
1050
1293
  var lintPackage = ({
1051
1294
  pkg,
1052
1295
  fix: fix2,
1053
1296
  verbose
1054
1297
  }) => {
1055
- console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1298
+ console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1056
1299
  const start = Date.now();
1057
1300
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
1058
1301
  ["yarn", [
@@ -1062,7 +1305,7 @@ var lintPackage = ({
1062
1305
  fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
1063
1306
  ]]
1064
1307
  ]);
1065
- console.log(chalk18.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`));
1308
+ console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1066
1309
  return result;
1067
1310
  };
1068
1311
  var lint = ({
@@ -1082,13 +1325,13 @@ var lint = ({
1082
1325
  });
1083
1326
  };
1084
1327
  var lintAllPackages = ({ fix: fix2 = false } = {}) => {
1085
- console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1328
+ console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1086
1329
  const start = Date.now();
1087
1330
  const fixOptions = fix2 ? ["--fix"] : [];
1088
1331
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1089
1332
  ["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
1090
1333
  ]);
1091
- console.log(chalk18.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`));
1334
+ console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1092
1335
  return result;
1093
1336
  };
1094
1337
 
@@ -1116,7 +1359,7 @@ var filename = ".gitignore";
1116
1359
  var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
1117
1360
 
1118
1361
  // src/actions/gitlint.ts
1119
- import chalk19 from "chalk";
1362
+ import chalk20 from "chalk";
1120
1363
  import ParseGitConfig from "parse-git-config";
1121
1364
  var gitlint = () => {
1122
1365
  console.log(`
@@ -1127,7 +1370,7 @@ Gitlint Start [${process.cwd()}]
1127
1370
  const errors = 0;
1128
1371
  const gitConfig = ParseGitConfig.sync();
1129
1372
  const warn = (message) => {
1130
- console.warn(chalk19.yellow(`Warning: ${message}`));
1373
+ console.warn(chalk20.yellow(`Warning: ${message}`));
1131
1374
  warnings++;
1132
1375
  };
1133
1376
  if (gitConfig.core.ignorecase) {
@@ -1147,13 +1390,13 @@ Gitlint Start [${process.cwd()}]
1147
1390
  }
1148
1391
  const resultMessages = [];
1149
1392
  if (valid > 0) {
1150
- resultMessages.push(chalk19.green(`Passed: ${valid}`));
1393
+ resultMessages.push(chalk20.green(`Passed: ${valid}`));
1151
1394
  }
1152
1395
  if (warnings > 0) {
1153
- resultMessages.push(chalk19.yellow(`Warnings: ${warnings}`));
1396
+ resultMessages.push(chalk20.yellow(`Warnings: ${warnings}`));
1154
1397
  }
1155
1398
  if (errors > 0) {
1156
- resultMessages.push(chalk19.red(` Errors: ${errors}`));
1399
+ resultMessages.push(chalk20.red(` Errors: ${errors}`));
1157
1400
  }
1158
1401
  console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
1159
1402
  `);
@@ -1162,7 +1405,7 @@ Gitlint Start [${process.cwd()}]
1162
1405
 
1163
1406
  // src/actions/gitlint-fix.ts
1164
1407
  import { execSync as execSync2 } from "child_process";
1165
- import chalk20 from "chalk";
1408
+ import chalk21 from "chalk";
1166
1409
  import ParseGitConfig2 from "parse-git-config";
1167
1410
  var gitlintFix = () => {
1168
1411
  console.log(`
@@ -1171,15 +1414,15 @@ Gitlint Fix Start [${process.cwd()}]
1171
1414
  const gitConfig = ParseGitConfig2.sync();
1172
1415
  if (gitConfig.core.ignorecase) {
1173
1416
  execSync2("git config core.ignorecase false", { stdio: "inherit" });
1174
- console.warn(chalk20.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
1417
+ console.warn(chalk21.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
1175
1418
  }
1176
1419
  if (gitConfig.core.autocrlf !== false) {
1177
1420
  execSync2("git config core.autocrlf false", { stdio: "inherit" });
1178
- console.warn(chalk20.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
1421
+ console.warn(chalk21.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
1179
1422
  }
1180
1423
  if (gitConfig.core.eol !== "lf") {
1181
1424
  execSync2("git config core.eol lf", { stdio: "inherit" });
1182
- console.warn(chalk20.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
1425
+ console.warn(chalk21.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
1183
1426
  }
1184
1427
  return 1;
1185
1428
  };
@@ -1190,7 +1433,7 @@ var knip = () => {
1190
1433
  };
1191
1434
 
1192
1435
  // src/actions/license.ts
1193
- import chalk21 from "chalk";
1436
+ import chalk22 from "chalk";
1194
1437
  import { init } from "license-checker";
1195
1438
  var license = async (pkg) => {
1196
1439
  const workspaces = yarnWorkspaces();
@@ -1215,18 +1458,18 @@ var license = async (pkg) => {
1215
1458
  "LGPL-3.0-or-later",
1216
1459
  "Python-2.0"
1217
1460
  ]);
1218
- console.log(chalk21.green("License Checker"));
1461
+ console.log(chalk22.green("License Checker"));
1219
1462
  return (await Promise.all(
1220
1463
  workspaceList.map(({ location, name }) => {
1221
1464
  return new Promise((resolve) => {
1222
1465
  init({ production: true, start: location }, (error, packages) => {
1223
1466
  if (error) {
1224
- console.error(chalk21.red(`License Checker [${name}] Error`));
1225
- console.error(chalk21.gray(error));
1467
+ console.error(chalk22.red(`License Checker [${name}] Error`));
1468
+ console.error(chalk22.gray(error));
1226
1469
  console.log("\n");
1227
1470
  resolve(1);
1228
1471
  } else {
1229
- console.log(chalk21.green(`License Checker [${name}]`));
1472
+ console.log(chalk22.green(`License Checker [${name}]`));
1230
1473
  let count = 0;
1231
1474
  for (const [name2, info] of Object.entries(packages)) {
1232
1475
  const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
@@ -1242,7 +1485,7 @@ var license = async (pkg) => {
1242
1485
  }
1243
1486
  if (!orLicenseFound) {
1244
1487
  count++;
1245
- console.warn(chalk21.yellow(`${name2}: Package License not allowed [${license2}]`));
1488
+ console.warn(chalk22.yellow(`${name2}: Package License not allowed [${license2}]`));
1246
1489
  }
1247
1490
  }
1248
1491
  }
@@ -1261,13 +1504,13 @@ var filename2 = ".npmignore";
1261
1504
  var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
1262
1505
 
1263
1506
  // src/actions/package/clean-outputs.ts
1264
- import path5 from "path";
1265
- import chalk22 from "chalk";
1507
+ import path7 from "path";
1508
+ import chalk23 from "chalk";
1266
1509
  var packageCleanOutputs = () => {
1267
1510
  const pkg = process.env.INIT_CWD ?? ".";
1268
1511
  const pkgName = process.env.npm_package_name;
1269
- const folders = [path5.join(pkg, "dist"), path5.join(pkg, "build"), path5.join(pkg, "docs")];
1270
- console.log(chalk22.green(`Cleaning Outputs [${pkgName}]`));
1512
+ const folders = [path7.join(pkg, "dist"), path7.join(pkg, "build"), path7.join(pkg, "docs")];
1513
+ console.log(chalk23.green(`Cleaning Outputs [${pkgName}]`));
1271
1514
  for (let folder of folders) {
1272
1515
  deleteGlob(folder);
1273
1516
  }
@@ -1275,13 +1518,13 @@ var packageCleanOutputs = () => {
1275
1518
  };
1276
1519
 
1277
1520
  // src/actions/package/clean-typescript.ts
1278
- import path6 from "path";
1279
- import chalk23 from "chalk";
1521
+ import path8 from "path";
1522
+ import chalk24 from "chalk";
1280
1523
  var packageCleanTypescript = () => {
1281
1524
  const pkg = process.env.INIT_CWD ?? ".";
1282
1525
  const pkgName = process.env.npm_package_name;
1283
- console.log(chalk23.green(`Cleaning Typescript [${pkgName}]`));
1284
- const files = [path6.join(pkg, "*.tsbuildinfo"), path6.join(pkg, ".tsconfig.*"), path6.join(pkg, ".eslintcache")];
1526
+ console.log(chalk24.green(`Cleaning Typescript [${pkgName}]`));
1527
+ const files = [path8.join(pkg, "*.tsbuildinfo"), path8.join(pkg, ".tsconfig.*"), path8.join(pkg, ".eslintcache")];
1285
1528
  for (let file of files) {
1286
1529
  deleteGlob(file);
1287
1530
  }
@@ -1294,26 +1537,26 @@ var packageClean = async () => {
1294
1537
  };
1295
1538
 
1296
1539
  // src/actions/package/compile/compile.ts
1297
- import chalk28 from "chalk";
1540
+ import chalk29 from "chalk";
1298
1541
 
1299
1542
  // src/actions/package/compile/packageCompileTsup.ts
1300
- import chalk27 from "chalk";
1543
+ import chalk28 from "chalk";
1301
1544
  import { build as build2, defineConfig } from "tsup";
1302
1545
 
1303
1546
  // src/actions/package/compile/inputs.ts
1304
- import chalk24 from "chalk";
1547
+ import chalk25 from "chalk";
1305
1548
  import { glob as glob2 } from "glob";
1306
1549
  var getAllInputs = (srcDir, verbose = false) => {
1307
1550
  return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
1308
1551
  const result = file.slice(Math.max(0, srcDir.length + 1));
1309
1552
  if (verbose) {
1310
- console.log(chalk24.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
1553
+ console.log(chalk25.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
1311
1554
  }
1312
1555
  return result;
1313
1556
  }), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
1314
1557
  const result = file.slice(Math.max(0, srcDir.length + 1));
1315
1558
  if (verbose) {
1316
- console.log(chalk24.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
1559
+ console.log(chalk25.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
1317
1560
  }
1318
1561
  return result;
1319
1562
  })];
@@ -1372,7 +1615,7 @@ function deepMergeObjects(objects) {
1372
1615
 
1373
1616
  // src/actions/package/compile/packageCompileTsc.ts
1374
1617
  import { cwd as cwd2 } from "process";
1375
- import chalk25 from "chalk";
1618
+ import chalk26 from "chalk";
1376
1619
  import { createProgramFromConfig } from "tsc-prog";
1377
1620
  import ts2, {
1378
1621
  DiagnosticCategory,
@@ -1394,7 +1637,7 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
1394
1637
  var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
1395
1638
  const pkg = process.env.INIT_CWD ?? cwd2();
1396
1639
  if (verbose) {
1397
- console.log(chalk25.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
1640
+ console.log(chalk26.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
1398
1641
  }
1399
1642
  const configFilePath = ts2.findConfigFile(
1400
1643
  "./",
@@ -1417,10 +1660,10 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
1417
1660
  emitDeclarationOnly: true,
1418
1661
  noEmit: false
1419
1662
  };
1420
- console.log(chalk25.cyan(`Validating Files: ${entries.length}`));
1663
+ console.log(chalk26.cyan(`Validating Files: ${entries.length}`));
1421
1664
  if (verbose) {
1422
1665
  for (const entry of entries) {
1423
- console.log(chalk25.grey(`Validating: ${entry}`));
1666
+ console.log(chalk26.grey(`Validating: ${entry}`));
1424
1667
  }
1425
1668
  }
1426
1669
  try {
@@ -1450,22 +1693,22 @@ var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", com
1450
1693
  return 0;
1451
1694
  } finally {
1452
1695
  if (verbose) {
1453
- console.log(chalk25.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
1696
+ console.log(chalk26.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
1454
1697
  }
1455
1698
  }
1456
1699
  };
1457
1700
 
1458
1701
  // src/actions/package/compile/packageCompileTscTypes.ts
1459
- import path7 from "path";
1702
+ import path9 from "path";
1460
1703
  import { cwd as cwd3 } from "process";
1461
- import chalk26 from "chalk";
1704
+ import chalk27 from "chalk";
1462
1705
  import { rollup } from "rollup";
1463
1706
  import dts from "rollup-plugin-dts";
1464
1707
  import nodeExternals from "rollup-plugin-node-externals";
1465
1708
  var ignoredWarningCodes = /* @__PURE__ */ new Set(["EMPTY_BUNDLE", "UNRESOLVED_IMPORT"]);
1466
1709
  async function bundleDts(inputPath, outputPath, platform, options, verbose = false) {
1467
1710
  const pkg = process.env.INIT_CWD ?? cwd3();
1468
- const tsconfigPath = path7.resolve(pkg, "tsconfig.json");
1711
+ const tsconfigPath = path9.resolve(pkg, "tsconfig.json");
1469
1712
  const nodePlugIns = platform === "node" ? [nodeExternals()] : [];
1470
1713
  try {
1471
1714
  const bundle = await rollup({
@@ -1483,8 +1726,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
1483
1726
  if (ignoredWarningCodes.has(warning.code ?? "")) {
1484
1727
  return;
1485
1728
  }
1486
- console.warn(chalk26.yellow(`[${warning.code}] ${warning.message}`));
1487
- console.warn(chalk26.gray(inputPath));
1729
+ console.warn(chalk27.yellow(`[${warning.code}] ${warning.message}`));
1730
+ console.warn(chalk27.gray(inputPath));
1488
1731
  warn(warning);
1489
1732
  }
1490
1733
  });
@@ -1494,8 +1737,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
1494
1737
  });
1495
1738
  } catch (ex) {
1496
1739
  const error = ex;
1497
- console.warn(chalk26.red(error));
1498
- console.warn(chalk26.gray(inputPath));
1740
+ console.warn(chalk27.red(error));
1741
+ console.warn(chalk27.gray(inputPath));
1499
1742
  }
1500
1743
  if (verbose) {
1501
1744
  console.log(`Bundled declarations written to ${outputPath}`);
@@ -1503,7 +1746,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
1503
1746
  }
1504
1747
  var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
1505
1748
  if (verbose) {
1506
- console.log(chalk26.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
1749
+ console.log(chalk27.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
1507
1750
  console.log(`Entries: ${entries.join(", ")}`);
1508
1751
  }
1509
1752
  const pkg = process.env.INIT_CWD ?? cwd3();
@@ -1527,7 +1770,7 @@ var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build",
1527
1770
  await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
1528
1771
  }));
1529
1772
  if (verbose) {
1530
- console.log(chalk26.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
1773
+ console.log(chalk27.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
1531
1774
  }
1532
1775
  return 0;
1533
1776
  };
@@ -1539,15 +1782,15 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
1539
1782
  console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
1540
1783
  }
1541
1784
  if (entries.length === 0) {
1542
- console.warn(chalk27.yellow(`No entries found in ${srcDir} to compile`));
1785
+ console.warn(chalk28.yellow(`No entries found in ${srcDir} to compile`));
1543
1786
  return 0;
1544
1787
  }
1545
1788
  if (verbose) {
1546
- console.log(chalk27.gray(`buildDir [${buildDir}]`));
1789
+ console.log(chalk28.gray(`buildDir [${buildDir}]`));
1547
1790
  }
1548
1791
  const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
1549
1792
  if (validationResult !== 0) {
1550
- console.error(chalk27.red(`Compile:Validation had ${validationResult} errors`));
1793
+ console.error(chalk28.red(`Compile:Validation had ${validationResult} errors`));
1551
1794
  return validationResult;
1552
1795
  }
1553
1796
  const optionsParams = tsupOptions([{
@@ -1572,12 +1815,12 @@ var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = fal
1572
1815
  })
1573
1816
  )).flat();
1574
1817
  if (verbose) {
1575
- console.log(chalk27.cyan(`TSUP:build:start [${srcDir}]`));
1576
- console.log(chalk27.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
1818
+ console.log(chalk28.cyan(`TSUP:build:start [${srcDir}]`));
1819
+ console.log(chalk28.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
1577
1820
  }
1578
1821
  await Promise.all(optionsList.map((options2) => build2(options2)));
1579
1822
  if (verbose) {
1580
- console.log(chalk27.cyan(`TSUP:build:stop [${srcDir}]`));
1823
+ console.log(chalk28.cyan(`TSUP:build:stop [${srcDir}]`));
1581
1824
  }
1582
1825
  if (bundleTypes) {
1583
1826
  await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
@@ -1688,14 +1931,14 @@ var packageCompileTsup = async (config2) => {
1688
1931
  // src/actions/package/compile/compile.ts
1689
1932
  var packageCompile = async (inConfig = {}) => {
1690
1933
  const pkg = process.env.INIT_CWD;
1691
- console.log(chalk28.green(`Compiling ${pkg}`));
1934
+ console.log(chalk29.green(`Compiling ${pkg}`));
1692
1935
  const config2 = await loadConfig(inConfig);
1693
1936
  return await packageCompileTsup(config2);
1694
1937
  };
1695
1938
 
1696
1939
  // src/actions/package/copy-assets.ts
1697
- import path8 from "path/posix";
1698
- import chalk29 from "chalk";
1940
+ import path10 from "path/posix";
1941
+ import chalk30 from "chalk";
1699
1942
  import cpy2 from "cpy";
1700
1943
  var copyTargetAssets2 = async (target, name, location) => {
1701
1944
  try {
@@ -1703,12 +1946,12 @@ var copyTargetAssets2 = async (target, name, location) => {
1703
1946
  ["**/*.jpg", "**/*.png", "**/*.gif", "**/*.svg", "**/*.webp", "**/*.sass", "**/*.scss", "**/*.gif", "**/*.css"],
1704
1947
  `../dist/${target}`,
1705
1948
  {
1706
- cwd: path8.join(location, "src"),
1949
+ cwd: path10.join(location, "src"),
1707
1950
  flat: false
1708
1951
  }
1709
1952
  );
1710
1953
  if (values.length > 0) {
1711
- console.log(chalk29.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
1954
+ console.log(chalk30.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
1712
1955
  }
1713
1956
  for (const value of values) {
1714
1957
  console.log(`${value.split("/").pop()} => ./dist/${target}`);
@@ -1774,8 +2017,8 @@ var packageCycle = async () => {
1774
2017
 
1775
2018
  // src/actions/package/gen-docs.ts
1776
2019
  import { existsSync as existsSync4 } from "fs";
1777
- import path9 from "path";
1778
- import chalk30 from "chalk";
2020
+ import path11 from "path";
2021
+ import chalk31 from "chalk";
1779
2022
  import {
1780
2023
  Application,
1781
2024
  ArgumentsReader,
@@ -1793,7 +2036,7 @@ var ExitCodes = {
1793
2036
  };
1794
2037
  var packageGenDocs = async () => {
1795
2038
  const pkg = process.env.INIT_CWD;
1796
- if (pkg !== void 0 && !existsSync4(path9.join(pkg, "typedoc.json"))) {
2039
+ if (pkg !== void 0 && !existsSync4(path11.join(pkg, "typedoc.json"))) {
1797
2040
  return;
1798
2041
  }
1799
2042
  const app = await Application.bootstrap({
@@ -1879,16 +2122,16 @@ var runTypeDoc = async (app) => {
1879
2122
  return ExitCodes.OutputError;
1880
2123
  }
1881
2124
  }
1882
- console.log(chalk30.green(`${pkgName} - Ok`));
2125
+ console.log(chalk31.green(`${pkgName} - Ok`));
1883
2126
  return ExitCodes.Ok;
1884
2127
  };
1885
2128
 
1886
2129
  // src/actions/package/lint.ts
1887
2130
  import { readdirSync } from "fs";
1888
- import path10 from "path";
2131
+ import path12 from "path";
1889
2132
  import { cwd as cwd4 } from "process";
1890
2133
  import { pathToFileURL } from "url";
1891
- import chalk31 from "chalk";
2134
+ import chalk32 from "chalk";
1892
2135
  import { ESLint } from "eslint";
1893
2136
  import { findUp } from "find-up";
1894
2137
  import picomatch from "picomatch";
@@ -1897,14 +2140,14 @@ var dumpMessages = (lintResults) => {
1897
2140
  const severity = ["none", "warning", "error"];
1898
2141
  for (const lintResult of lintResults) {
1899
2142
  if (lintResult.messages.length > 0) {
1900
- console.log(chalk31.gray(`
2143
+ console.log(chalk32.gray(`
1901
2144
  ${lintResult.filePath}`));
1902
2145
  for (const message of lintResult.messages) {
1903
2146
  console.log(
1904
- chalk31.gray(` ${message.line}:${message.column}`),
1905
- chalk31[colors[message.severity]](` ${severity[message.severity]}`),
1906
- chalk31.white(` ${message.message}`),
1907
- chalk31.gray(` ${message.ruleId}`)
2147
+ chalk32.gray(` ${message.line}:${message.column}`),
2148
+ chalk32[colors[message.severity]](` ${severity[message.severity]}`),
2149
+ chalk32.white(` ${message.message}`),
2150
+ chalk32.gray(` ${message.ruleId}`)
1908
2151
  );
1909
2152
  }
1910
2153
  }
@@ -1922,7 +2165,7 @@ function getFiles(dir, ignoreFolders) {
1922
2165
  const subDirectory = dir.split(currentDirectory)[1]?.split("/")[1];
1923
2166
  if (ignoreFolders.includes(subDirectory)) return [];
1924
2167
  return readdirSync(dir, { withFileTypes: true }).flatMap((dirent) => {
1925
- const res = path10.resolve(dir, dirent.name);
2168
+ const res = path12.resolve(dir, dirent.name);
1926
2169
  const relativePath = subDirectory === void 0 ? dirent.name : `${subDirectory}/${dirent.name}`;
1927
2170
  const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
1928
2171
  if (ignoreMatchers.some((isMatch) => isMatch(relativePath))) return [];
@@ -1942,10 +2185,10 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
1942
2185
  cache
1943
2186
  });
1944
2187
  const files = getFiles(cwd4(), ignoreFolders);
1945
- console.log(chalk31.green(`Linting ${pkg} [files = ${files.length}]`));
2188
+ console.log(chalk32.green(`Linting ${pkg} [files = ${files.length}]`));
1946
2189
  if (verbose) {
1947
2190
  for (const file of files) {
1948
- console.log(chalk31.gray(` ${file}`));
2191
+ console.log(chalk32.gray(` ${file}`));
1949
2192
  }
1950
2193
  }
1951
2194
  const lintResults = await engine.lintFiles(files);
@@ -1956,43 +2199,43 @@ var packageLint = async (fix2 = false, verbose = false, cache = true) => {
1956
2199
  const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
1957
2200
  const lintTime = Date.now() - start;
1958
2201
  const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
1959
- console.log(chalk31.white(`Linted ${chalk31[filesCountColor](files.length)} files in ${chalk31[lintTimeColor](lintTime)}ms`));
2202
+ console.log(chalk32.white(`Linted ${chalk32[filesCountColor](files.length)} files in ${chalk32[lintTimeColor](lintTime)}ms`));
1960
2203
  return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
1961
2204
  };
1962
2205
 
1963
2206
  // src/actions/package/publint.ts
1964
- import { promises as fs4 } from "fs";
1965
- import chalk32 from "chalk";
2207
+ import { promises as fs7 } from "fs";
2208
+ import chalk33 from "chalk";
1966
2209
  import sortPackageJson from "sort-package-json";
1967
2210
  var customPubLint = (pkg) => {
1968
2211
  let errorCount = 0;
1969
2212
  let warningCount = 0;
1970
2213
  if (pkg.files === void 0) {
1971
- console.warn(chalk32.yellow('Publint [custom]: "files" field is missing'));
2214
+ console.warn(chalk33.yellow('Publint [custom]: "files" field is missing'));
1972
2215
  warningCount++;
1973
2216
  }
1974
2217
  if (pkg.main !== void 0) {
1975
- console.warn(chalk32.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
2218
+ console.warn(chalk33.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
1976
2219
  warningCount++;
1977
2220
  }
1978
2221
  if (pkg.sideEffects !== false) {
1979
- console.warn(chalk32.yellow('Publint [custom]: "sideEffects" field should be set to false'));
2222
+ console.warn(chalk33.yellow('Publint [custom]: "sideEffects" field should be set to false'));
1980
2223
  warningCount++;
1981
2224
  }
1982
2225
  if (pkg.resolutions !== void 0) {
1983
- console.warn(chalk32.yellow('Publint [custom]: "resolutions" in use'));
1984
- console.warn(chalk32.gray(JSON.stringify(pkg.resolutions, null, 2)));
2226
+ console.warn(chalk33.yellow('Publint [custom]: "resolutions" in use'));
2227
+ console.warn(chalk33.gray(JSON.stringify(pkg.resolutions, null, 2)));
1985
2228
  warningCount++;
1986
2229
  }
1987
2230
  return [errorCount, warningCount];
1988
2231
  };
1989
2232
  var packagePublint = async ({ strict = true, verbose = false } = {}) => {
1990
2233
  const pkgDir = process.env.INIT_CWD;
1991
- const sortedPkg = sortPackageJson(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
1992
- await fs4.writeFile(`${pkgDir}/package.json`, sortedPkg);
1993
- const pkg = JSON.parse(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
1994
- console.log(chalk32.green(`Publint: ${pkg.name}`));
1995
- console.log(chalk32.gray(pkgDir));
2234
+ const sortedPkg = sortPackageJson(await fs7.readFile(`${pkgDir}/package.json`, "utf8"));
2235
+ await fs7.writeFile(`${pkgDir}/package.json`, sortedPkg);
2236
+ const pkg = JSON.parse(await fs7.readFile(`${pkgDir}/package.json`, "utf8"));
2237
+ console.log(chalk33.green(`Publint: ${pkg.name}`));
2238
+ console.log(chalk33.gray(pkgDir));
1996
2239
  const { publint: publint2 } = await import("publint");
1997
2240
  const { messages } = await publint2({
1998
2241
  level: "suggestion",
@@ -2003,22 +2246,22 @@ var packagePublint = async ({ strict = true, verbose = false } = {}) => {
2003
2246
  for (const message of messages) {
2004
2247
  switch (message.type) {
2005
2248
  case "error": {
2006
- console.error(chalk32.red(`[${message.code}] ${formatMessage(message, pkg)}`));
2249
+ console.error(chalk33.red(`[${message.code}] ${formatMessage(message, pkg)}`));
2007
2250
  break;
2008
2251
  }
2009
2252
  case "warning": {
2010
- console.warn(chalk32.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
2253
+ console.warn(chalk33.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
2011
2254
  break;
2012
2255
  }
2013
2256
  default: {
2014
- console.log(chalk32.white(`[${message.code}] ${formatMessage(message, pkg)}`));
2257
+ console.log(chalk33.white(`[${message.code}] ${formatMessage(message, pkg)}`));
2015
2258
  break;
2016
2259
  }
2017
2260
  }
2018
2261
  }
2019
2262
  const [errorCount, warningCount] = customPubLint(pkg);
2020
2263
  if (verbose) {
2021
- console.log(chalk32.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
2264
+ console.log(chalk33.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
2022
2265
  }
2023
2266
  return messages.filter((message) => message.type === "error").length + errorCount;
2024
2267
  };
@@ -2054,7 +2297,7 @@ var rebuild = ({ target }) => {
2054
2297
  };
2055
2298
 
2056
2299
  // src/actions/recompile.ts
2057
- import chalk33 from "chalk";
2300
+ import chalk34 from "chalk";
2058
2301
  var recompile = async ({
2059
2302
  verbose,
2060
2303
  target,
@@ -2090,7 +2333,7 @@ var recompileAll = async ({
2090
2333
  const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
2091
2334
  const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
2092
2335
  if (jobs) {
2093
- console.log(chalk33.blue(`Jobs set to [${jobs}]`));
2336
+ console.log(chalk34.blue(`Jobs set to [${jobs}]`));
2094
2337
  }
2095
2338
  const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
2096
2339
  [
@@ -2121,7 +2364,7 @@ var recompileAll = async ({
2121
2364
  ]
2122
2365
  ]);
2123
2366
  console.log(
2124
- `${chalk33.gray("Recompiled in")} [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`
2367
+ `${chalk34.gray("Recompiled in")} [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`
2125
2368
  );
2126
2369
  return result;
2127
2370
  };
@@ -2152,13 +2395,13 @@ var reinstall = () => {
2152
2395
  };
2153
2396
 
2154
2397
  // src/actions/relint.ts
2155
- import chalk34 from "chalk";
2398
+ import chalk35 from "chalk";
2156
2399
  var relintPackage = ({
2157
2400
  pkg,
2158
2401
  fix: fix2,
2159
2402
  verbose
2160
2403
  }) => {
2161
- console.log(chalk34.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
2404
+ console.log(chalk35.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
2162
2405
  const start = Date.now();
2163
2406
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
2164
2407
  ["yarn", [
@@ -2168,7 +2411,7 @@ var relintPackage = ({
2168
2411
  fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
2169
2412
  ]]
2170
2413
  ]);
2171
- console.log(chalk34.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`));
2414
+ console.log(chalk35.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk35.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk35.gray("seconds")}`));
2172
2415
  return result;
2173
2416
  };
2174
2417
  var relint = ({
@@ -2188,13 +2431,13 @@ var relint = ({
2188
2431
  });
2189
2432
  };
2190
2433
  var relintAllPackages = ({ fix: fix2 = false } = {}) => {
2191
- console.log(chalk34.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
2434
+ console.log(chalk35.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
2192
2435
  const start = Date.now();
2193
2436
  const fixOptions = fix2 ? ["--fix"] : [];
2194
2437
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
2195
2438
  ["yarn", ["eslint", ...fixOptions]]
2196
2439
  ]);
2197
- console.log(chalk34.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`));
2440
+ console.log(chalk35.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk35.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk35.gray("seconds")}`));
2198
2441
  return result;
2199
2442
  };
2200
2443
 
@@ -2212,10 +2455,10 @@ var sonar = () => {
2212
2455
  };
2213
2456
 
2214
2457
  // src/actions/statics.ts
2215
- import chalk35 from "chalk";
2458
+ import chalk36 from "chalk";
2216
2459
  var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
2217
2460
  var statics = () => {
2218
- console.log(chalk35.green("Check Required Static Dependencies"));
2461
+ console.log(chalk36.green("Check Required Static Dependencies"));
2219
2462
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
2220
2463
  return detectDuplicateDependencies(statics2, DefaultDependencies);
2221
2464
  };