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