@@ -4,6 +4,7 @@ import fs from "fs";
44import { getLanguagePlugin } from "../languagesPlugins" ;
55import { localConfigSchema } from "../config/localConfig" ;
66import z from "zod" ;
7+ import UnknownPlugin from "../languagesPlugins/unknown" ;
78
89export class ProjectOverview {
910 files : AuditFile [ ] = [ ] ;
@@ -15,9 +16,15 @@ export class ProjectOverview {
1516 #init( dir : string , config : z . infer < typeof localConfigSchema > ) {
1617 const files = this . #getFiles( dir ) ;
1718
18- this . files = files . map ( ( file ) => {
19+ files . forEach ( ( file ) => {
1920 const plugin = getLanguagePlugin ( file . path , file . path ) ;
2021
22+ if ( plugin . constructor === UnknownPlugin ) {
23+ // TODO log something
24+ console . log ( 1111111111111 , file . path ) ;
25+ return ;
26+ }
27+
2128 const tree = plugin . parser . parse ( file . sourceCode ) ;
2229
2330 const depImports = plugin . getImports ( file . path , tree . rootNode ) ;
@@ -26,7 +33,7 @@ export class ProjectOverview {
2633 . filter ( ( depImport ) => ! depImport . isExternal )
2734 . map ( ( depImport ) => depImport . source ) ;
2835
29- return {
36+ this . files . push ( {
3037 path : file . path ,
3138 sourceCode : file . sourceCode ,
3239 importSources,
@@ -59,7 +66,7 @@ export class ProjectOverview {
5966 isUnused : false ,
6067 circularDependencySources : [ ] ,
6168 } ,
62- } ;
69+ } ) ;
6370 } ) ;
6471
6572 this . #checkForUnusedFiles( ) ;
0 commit comments