@xylabs/ts-scripts-yarn3 7.4.2 → 7.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +85 -91
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +5 -5
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +2 -2
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs +7 -10
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +85 -91
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +85 -91
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/findFiles.mjs +29 -14
- package/dist/actions/deplint/findFiles.mjs.map +1 -1
- package/dist/actions/deplint/findFilesByGlob.mjs +7 -2
- package/dist/actions/deplint/findFilesByGlob.mjs.map +1 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +19 -25
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
- package/dist/actions/deplint/getImportsFromFile.mjs +3 -2
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
- package/dist/actions/deplint/implicitDevDependencies.mjs +2 -2
- package/dist/actions/deplint/implicitDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +85 -91
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/index.mjs +89 -95
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy.mjs +85 -91
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +89 -95
- package/dist/index.mjs.map +1 -1
- package/dist/xy/index.mjs +85 -91
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +85 -91
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +85 -91
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +4 -3
package/dist/xy/xy.mjs
CHANGED
|
@@ -602,33 +602,48 @@ var dead = () => {
|
|
|
602
602
|
// src/actions/deplint/deplint.ts
|
|
603
603
|
import chalk16 from "chalk";
|
|
604
604
|
|
|
605
|
+
// src/actions/deplint/findFiles.ts
|
|
606
|
+
import fs2 from "fs";
|
|
607
|
+
|
|
605
608
|
// src/actions/deplint/findFilesByGlob.ts
|
|
606
609
|
import { globSync } from "glob";
|
|
607
|
-
function findFilesByGlob(cwd, pattern) {
|
|
608
|
-
return globSync(pattern, {
|
|
610
|
+
function findFilesByGlob(cwd, pattern, ignore) {
|
|
611
|
+
return globSync(pattern, {
|
|
612
|
+
cwd,
|
|
613
|
+
absolute: true,
|
|
614
|
+
ignore,
|
|
615
|
+
nodir: true
|
|
616
|
+
});
|
|
609
617
|
}
|
|
610
618
|
|
|
611
619
|
// src/actions/deplint/findFiles.ts
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
};
|
|
620
|
+
var codeExtensions = "*.{ts,tsx,mts,cts,js,mjs,cjs}";
|
|
621
|
+
function getWorkspaceIgnores(location) {
|
|
622
|
+
try {
|
|
623
|
+
const raw = fs2.readFileSync(`${location}/package.json`, "utf8");
|
|
624
|
+
const pkg = JSON.parse(raw);
|
|
625
|
+
return pkg.workspaces ?? [];
|
|
626
|
+
} catch {
|
|
627
|
+
return [];
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
function findFiles(location) {
|
|
631
|
+
const workspaceIgnores = getWorkspaceIgnores(location).map((w) => `${w}/**`);
|
|
632
|
+
const ignore = ["**/node_modules/**", "dist/**", ...workspaceIgnores];
|
|
633
|
+
const allFiles = findFilesByGlob(location, `./**/${codeExtensions}`, ignore);
|
|
634
|
+
const distFiles = [
|
|
635
|
+
...findFilesByGlob(location, "./dist/**/*.d.ts"),
|
|
636
|
+
...findFilesByGlob(location, `./dist/**/${codeExtensions}`)
|
|
637
|
+
];
|
|
638
|
+
return { allFiles, distFiles };
|
|
624
639
|
}
|
|
625
640
|
|
|
626
641
|
// src/actions/deplint/getDependenciesFromPackageJson.ts
|
|
627
|
-
import
|
|
642
|
+
import fs3 from "fs";
|
|
628
643
|
import path3 from "path";
|
|
629
644
|
function getDependenciesFromPackageJson(packageJsonPath) {
|
|
630
645
|
const packageJsonFullPath = path3.resolve(packageJsonPath);
|
|
631
|
-
const rawContent =
|
|
646
|
+
const rawContent = fs3.readFileSync(packageJsonFullPath, "utf8");
|
|
632
647
|
const packageJson = JSON.parse(rawContent);
|
|
633
648
|
const dependencies = packageJson.dependencies ? Object.keys(packageJson.dependencies) : [];
|
|
634
649
|
const devDependencies = packageJson.devDependencies ? Object.keys(packageJson.devDependencies) : [];
|
|
@@ -641,7 +656,7 @@ function getDependenciesFromPackageJson(packageJsonPath) {
|
|
|
641
656
|
}
|
|
642
657
|
|
|
643
658
|
// src/actions/deplint/getExtendsFromTsconfigs.ts
|
|
644
|
-
import
|
|
659
|
+
import fs4 from "fs";
|
|
645
660
|
import { globSync as globSync2 } from "glob";
|
|
646
661
|
|
|
647
662
|
// src/actions/deplint/getBasePackageName.ts
|
|
@@ -666,7 +681,7 @@ function getExtendsFromTsconfigs(location) {
|
|
|
666
681
|
const packages = /* @__PURE__ */ new Set();
|
|
667
682
|
for (const file of tsconfigFiles) {
|
|
668
683
|
try {
|
|
669
|
-
const content =
|
|
684
|
+
const content = fs4.readFileSync(file, "utf8");
|
|
670
685
|
const cleaned = content.replaceAll(/\/\/.*/g, "").replaceAll(/,\s*([}\]])/g, "$1");
|
|
671
686
|
const parsed = JSON.parse(cleaned);
|
|
672
687
|
const refs = parseExtendsField(parsed.extends);
|
|
@@ -682,7 +697,7 @@ function getExtendsFromTsconfigs(location) {
|
|
|
682
697
|
}
|
|
683
698
|
|
|
684
699
|
// src/actions/deplint/getImportsFromFile.ts
|
|
685
|
-
import
|
|
700
|
+
import fs5 from "fs";
|
|
686
701
|
import path4 from "path";
|
|
687
702
|
import ts from "typescript";
|
|
688
703
|
function isTypeOnlyImportClause(clause) {
|
|
@@ -697,7 +712,7 @@ function isTypeOnlyImportClause(clause) {
|
|
|
697
712
|
return clause.isTypeOnly;
|
|
698
713
|
}
|
|
699
714
|
function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
700
|
-
const sourceCode =
|
|
715
|
+
const sourceCode = fs5.readFileSync(filePath, "utf8");
|
|
701
716
|
const isMjsFile = filePath.endsWith(".mjs");
|
|
702
717
|
const sourceFile = ts.createSourceFile(
|
|
703
718
|
path4.basename(filePath),
|
|
@@ -708,14 +723,14 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
708
723
|
);
|
|
709
724
|
const imports = [];
|
|
710
725
|
const typeImports = [];
|
|
711
|
-
const
|
|
726
|
+
const isDeclarationFile2 = filePath.endsWith(".d.ts");
|
|
712
727
|
function visit(node) {
|
|
713
728
|
if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
|
|
714
729
|
const moduleSpecifier = node.moduleSpecifier?.getFullText();
|
|
715
730
|
const isTypeImport = ts.isImportDeclaration(node) ? isTypeOnlyImportClause(node.importClause) : false;
|
|
716
731
|
if (typeof moduleSpecifier === "string") {
|
|
717
732
|
const trimmed = moduleSpecifier.replaceAll("'", "").replaceAll('"', "").trim();
|
|
718
|
-
if (isTypeImport ||
|
|
733
|
+
if (isTypeImport || isDeclarationFile2) {
|
|
719
734
|
typeImports.push(trimmed);
|
|
720
735
|
} else {
|
|
721
736
|
imports.push(trimmed);
|
|
@@ -732,8 +747,9 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
732
747
|
}
|
|
733
748
|
visit(sourceFile);
|
|
734
749
|
const importsStartsWithExcludes = [".", "#", "node:"];
|
|
735
|
-
const
|
|
736
|
-
const
|
|
750
|
+
const isValidImport = (imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc)) && !imp.includes("*") && !imp.includes("!");
|
|
751
|
+
const cleanedImports = imports.filter(isValidImport).map(getBasePackageName);
|
|
752
|
+
const cleanedTypeImports = typeImports.filter(isValidImport).map(getBasePackageName);
|
|
737
753
|
for (const imp of cleanedImports) {
|
|
738
754
|
importPaths[imp] = importPaths[imp] ?? [];
|
|
739
755
|
importPaths[imp].push(filePath);
|
|
@@ -750,41 +766,34 @@ var internalImportPrefixes = [".", "#", "node:"];
|
|
|
750
766
|
var removeInternalImports = (imports) => {
|
|
751
767
|
return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
|
|
752
768
|
};
|
|
769
|
+
var isDeclarationFile = (file) => file.endsWith(".d.ts") || file.endsWith(".d.cts") || file.endsWith(".d.mts");
|
|
753
770
|
function getExternalImportsFromFiles({
|
|
754
|
-
|
|
771
|
+
allFiles,
|
|
755
772
|
distFiles,
|
|
756
|
-
configFiles = [],
|
|
757
773
|
tsconfigExtends = []
|
|
758
774
|
}) {
|
|
759
|
-
const
|
|
775
|
+
const allImportPaths = {};
|
|
760
776
|
const distImportPaths = {};
|
|
761
777
|
const distTypeImportPaths = {};
|
|
762
|
-
const
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
const distTypeFiles = distFiles.filter((file) => file.endsWith(".d.ts") || file.endsWith(".d.cts") || file.endsWith(".d.mts"));
|
|
766
|
-
const distCodeFiles = distFiles.filter((file) => !(file.endsWith(".d.ts") || file.endsWith(".d.cts") || file.endsWith(".d.mts")));
|
|
778
|
+
for (const path7 of allFiles) getImportsFromFile(path7, allImportPaths, allImportPaths).flat();
|
|
779
|
+
const distTypeFiles = distFiles.filter(isDeclarationFile);
|
|
780
|
+
const distCodeFiles = distFiles.filter((file) => !isDeclarationFile(file));
|
|
767
781
|
for (const path7 of distCodeFiles) getImportsFromFile(path7, distImportPaths, distImportPaths).flat();
|
|
768
782
|
for (const path7 of distTypeFiles) getImportsFromFile(path7, distTypeImportPaths, distTypeImportPaths).flat();
|
|
769
|
-
const
|
|
783
|
+
const allImports = Object.keys(allImportPaths);
|
|
770
784
|
const distImports = Object.keys(distImportPaths);
|
|
771
|
-
const
|
|
772
|
-
const externalSrcImports = removeInternalImports(srcImports);
|
|
785
|
+
const externalAllImports = removeInternalImports(allImports);
|
|
773
786
|
const externalDistImports = removeInternalImports(distImports);
|
|
774
|
-
const externalDistTypeImports = removeInternalImports(
|
|
775
|
-
const externalConfigImports = removeInternalImports(Object.keys(configImportPaths));
|
|
787
|
+
const externalDistTypeImports = removeInternalImports(Object.keys(distTypeImportPaths));
|
|
776
788
|
for (const ext of tsconfigExtends) {
|
|
777
|
-
if (!
|
|
778
|
-
if (!externalConfigImports.includes(ext)) externalConfigImports.push(ext);
|
|
789
|
+
if (!externalAllImports.includes(ext)) externalAllImports.push(ext);
|
|
779
790
|
}
|
|
780
791
|
return {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
srcImportPaths,
|
|
784
|
-
externalConfigImports,
|
|
785
|
-
externalSrcImports,
|
|
786
|
-
distImports,
|
|
792
|
+
allImportPaths,
|
|
793
|
+
allImports,
|
|
787
794
|
distImportPaths,
|
|
795
|
+
distImports,
|
|
796
|
+
externalAllImports,
|
|
788
797
|
externalDistImports,
|
|
789
798
|
externalDistTypeImports
|
|
790
799
|
};
|
|
@@ -836,17 +845,17 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
836
845
|
dependencies,
|
|
837
846
|
peerDependencies
|
|
838
847
|
}, {
|
|
839
|
-
|
|
840
|
-
|
|
848
|
+
allImportPaths,
|
|
849
|
+
externalAllImports,
|
|
841
850
|
distImports
|
|
842
851
|
}) {
|
|
843
852
|
let unlistedDevDependencies = 0;
|
|
844
|
-
for (const imp of
|
|
853
|
+
for (const imp of externalAllImports) {
|
|
845
854
|
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)) {
|
|
846
855
|
unlistedDevDependencies++;
|
|
847
856
|
console.log(`[${chalk12.blue(name)}] Missing devDependency in package.json: ${chalk12.red(imp)}`);
|
|
848
|
-
if (
|
|
849
|
-
console.log(` ${
|
|
857
|
+
if (allImportPaths[imp]) {
|
|
858
|
+
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
850
859
|
}
|
|
851
860
|
}
|
|
852
861
|
}
|
|
@@ -863,13 +872,13 @@ import chalk13 from "chalk";
|
|
|
863
872
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
864
873
|
externalDistImports,
|
|
865
874
|
externalDistTypeImports,
|
|
866
|
-
|
|
875
|
+
externalAllImports
|
|
867
876
|
}) {
|
|
868
877
|
let unusedDependencies = 0;
|
|
869
878
|
for (const dep of dependencies) {
|
|
870
879
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
871
880
|
unusedDependencies++;
|
|
872
|
-
if (
|
|
881
|
+
if (externalAllImports.includes(dep)) {
|
|
873
882
|
console.log(`[${chalk13.blue(name)}] dependency should be devDependency in package.json: ${chalk13.red(dep)}`);
|
|
874
883
|
} else {
|
|
875
884
|
console.log(`[${chalk13.blue(name)}] Unused dependency in package.json: ${chalk13.red(dep)}`);
|
|
@@ -888,13 +897,13 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
|
888
897
|
import chalk14 from "chalk";
|
|
889
898
|
|
|
890
899
|
// src/actions/deplint/getRequiredPeerDependencies.ts
|
|
891
|
-
import
|
|
900
|
+
import fs6 from "fs";
|
|
892
901
|
import path5 from "path";
|
|
893
902
|
function findDepPackageJson(location, dep) {
|
|
894
903
|
let dir = location;
|
|
895
904
|
while (true) {
|
|
896
905
|
const candidate = path5.join(dir, "node_modules", dep, "package.json");
|
|
897
|
-
if (
|
|
906
|
+
if (fs6.existsSync(candidate)) return candidate;
|
|
898
907
|
const parent = path5.dirname(dir);
|
|
899
908
|
if (parent === dir) return void 0;
|
|
900
909
|
dir = parent;
|
|
@@ -906,7 +915,7 @@ function getRequiredPeerDependencies(location, allDeps) {
|
|
|
906
915
|
const depPkgPath = findDepPackageJson(location, dep);
|
|
907
916
|
if (!depPkgPath) continue;
|
|
908
917
|
try {
|
|
909
|
-
const raw =
|
|
918
|
+
const raw = fs6.readFileSync(depPkgPath, "utf8");
|
|
910
919
|
const pkg = JSON.parse(raw);
|
|
911
920
|
if (pkg.peerDependencies) {
|
|
912
921
|
for (const peer of Object.keys(pkg.peerDependencies)) {
|
|
@@ -920,13 +929,13 @@ function getRequiredPeerDependencies(location, allDeps) {
|
|
|
920
929
|
}
|
|
921
930
|
|
|
922
931
|
// src/actions/deplint/getScriptReferencedPackages.ts
|
|
923
|
-
import
|
|
932
|
+
import fs7 from "fs";
|
|
924
933
|
import path6 from "path";
|
|
925
934
|
function getBinNames(location, dep) {
|
|
926
935
|
const depPkgPath = findDepPackageJson(location, dep);
|
|
927
936
|
if (!depPkgPath) return [];
|
|
928
937
|
try {
|
|
929
|
-
const raw =
|
|
938
|
+
const raw = fs7.readFileSync(depPkgPath, "utf8");
|
|
930
939
|
const pkg = JSON.parse(raw);
|
|
931
940
|
if (!pkg.bin) return [];
|
|
932
941
|
if (typeof pkg.bin === "string") return [pkg.name?.split("/").pop() ?? dep];
|
|
@@ -942,7 +951,7 @@ function getScriptReferencedPackages(location, allDeps) {
|
|
|
942
951
|
const pkgPath = path6.join(location, "package.json");
|
|
943
952
|
let scripts = {};
|
|
944
953
|
try {
|
|
945
|
-
const raw =
|
|
954
|
+
const raw = fs7.readFileSync(pkgPath, "utf8");
|
|
946
955
|
const pkg = JSON.parse(raw);
|
|
947
956
|
scripts = pkg.scripts ?? {};
|
|
948
957
|
} catch {
|
|
@@ -972,14 +981,14 @@ function getScriptReferencedPackages(location, allDeps) {
|
|
|
972
981
|
}
|
|
973
982
|
|
|
974
983
|
// src/actions/deplint/implicitDevDependencies.ts
|
|
975
|
-
import
|
|
984
|
+
import fs8 from "fs";
|
|
976
985
|
var hasFileWithExtension = (files, extensions) => files.some((f) => extensions.some((ext) => f.endsWith(ext)));
|
|
977
986
|
var tsExtensions = [".ts", ".tsx", ".mts", ".cts"];
|
|
978
|
-
var hasTypescriptFiles = ({
|
|
987
|
+
var hasTypescriptFiles = ({ allFiles }) => hasFileWithExtension(allFiles, tsExtensions);
|
|
979
988
|
var decoratorPattern = /^\s*@[a-zA-Z]\w*/m;
|
|
980
|
-
var hasDecorators = ({
|
|
989
|
+
var hasDecorators = ({ allFiles }) => allFiles.filter((f) => tsExtensions.some((ext) => f.endsWith(ext))).some((file) => {
|
|
981
990
|
try {
|
|
982
|
-
const content =
|
|
991
|
+
const content = fs8.readFileSync(file, "utf8");
|
|
983
992
|
return decoratorPattern.test(content);
|
|
984
993
|
} catch {
|
|
985
994
|
return false;
|
|
@@ -992,7 +1001,7 @@ function hasImportPlugin({ location, allDependencies }) {
|
|
|
992
1001
|
const pkgPath = findDepPackageJson(location, dep);
|
|
993
1002
|
if (!pkgPath) continue;
|
|
994
1003
|
try {
|
|
995
|
-
const pkg = JSON.parse(
|
|
1004
|
+
const pkg = JSON.parse(fs8.readFileSync(pkgPath, "utf8"));
|
|
996
1005
|
const transitiveDeps = [
|
|
997
1006
|
...Object.keys(pkg.dependencies ?? {}),
|
|
998
1007
|
...Object.keys(pkg.peerDependencies ?? {})
|
|
@@ -1029,18 +1038,15 @@ function getImplicitDevDependencies(context) {
|
|
|
1029
1038
|
|
|
1030
1039
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1031
1040
|
var allExternalImports = ({
|
|
1032
|
-
|
|
1041
|
+
externalAllImports,
|
|
1033
1042
|
externalDistImports,
|
|
1034
|
-
externalDistTypeImports
|
|
1035
|
-
externalConfigImports
|
|
1043
|
+
externalDistTypeImports
|
|
1036
1044
|
}) => {
|
|
1037
|
-
|
|
1038
|
-
...
|
|
1045
|
+
return /* @__PURE__ */ new Set([
|
|
1046
|
+
...externalAllImports,
|
|
1039
1047
|
...externalDistImports,
|
|
1040
|
-
...externalDistTypeImports
|
|
1041
|
-
...externalConfigImports
|
|
1048
|
+
...externalDistTypeImports
|
|
1042
1049
|
]);
|
|
1043
|
-
return all;
|
|
1044
1050
|
};
|
|
1045
1051
|
function isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs) {
|
|
1046
1052
|
if (implicitDeps.has(dep)) return true;
|
|
@@ -1105,18 +1111,15 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1105
1111
|
}
|
|
1106
1112
|
|
|
1107
1113
|
// src/actions/deplint/checkPackage/checkPackage.ts
|
|
1108
|
-
function logVerbose(name, location,
|
|
1114
|
+
function logVerbose(name, location, allFiles, distFiles, tsconfigExtends) {
|
|
1109
1115
|
console.info(`Checking package: ${name} at ${location}`);
|
|
1110
|
-
console.info(`
|
|
1111
|
-
for (const file of
|
|
1112
|
-
console.info(`
|
|
1116
|
+
console.info(`All files: ${allFiles.length}, Distribution files: ${distFiles.length}`);
|
|
1117
|
+
for (const file of allFiles) {
|
|
1118
|
+
console.info(`File: ${file}`);
|
|
1113
1119
|
}
|
|
1114
1120
|
for (const file of distFiles) {
|
|
1115
1121
|
console.info(`Distribution file: ${file}`);
|
|
1116
1122
|
}
|
|
1117
|
-
for (const file of configFiles) {
|
|
1118
|
-
console.info(`Config file: ${file}`);
|
|
1119
|
-
}
|
|
1120
1123
|
for (const ext of tsconfigExtends) {
|
|
1121
1124
|
console.info(`Tsconfig extends: ${ext}`);
|
|
1122
1125
|
}
|
|
@@ -1129,33 +1132,24 @@ function checkPackage({
|
|
|
1129
1132
|
peerDeps = false,
|
|
1130
1133
|
verbose = false
|
|
1131
1134
|
}) {
|
|
1132
|
-
const {
|
|
1133
|
-
srcFiles,
|
|
1134
|
-
distFiles,
|
|
1135
|
-
configFiles
|
|
1136
|
-
} = findFiles(location);
|
|
1135
|
+
const { allFiles, distFiles } = findFiles(location);
|
|
1137
1136
|
const tsconfigExtends = getExtendsFromTsconfigs(location);
|
|
1138
1137
|
if (verbose) {
|
|
1139
|
-
logVerbose(name, location,
|
|
1138
|
+
logVerbose(name, location, allFiles, distFiles, tsconfigExtends);
|
|
1140
1139
|
}
|
|
1141
1140
|
const checkDeps = deps || !(deps || devDeps || peerDeps);
|
|
1142
1141
|
const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
|
|
1143
1142
|
const checkPeerDeps = peerDeps;
|
|
1144
1143
|
const sourceParams = getExternalImportsFromFiles({
|
|
1145
|
-
|
|
1144
|
+
allFiles,
|
|
1146
1145
|
distFiles,
|
|
1147
|
-
configFiles,
|
|
1148
1146
|
tsconfigExtends
|
|
1149
1147
|
});
|
|
1150
1148
|
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
1151
1149
|
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1152
1150
|
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1153
1151
|
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1154
|
-
const fileContext = {
|
|
1155
|
-
configFiles,
|
|
1156
|
-
distFiles,
|
|
1157
|
-
srcFiles
|
|
1158
|
-
};
|
|
1152
|
+
const fileContext = { allFiles, distFiles };
|
|
1159
1153
|
const unusedDevDependencies = checkDevDeps ? getUnusedDevDependencies({ name, location }, packageParams, sourceParams, fileContext) : 0;
|
|
1160
1154
|
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1161
1155
|
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedDevDependencies + unusedPeerDependencies;
|