@@ -35,12 +35,12 @@ if (!isWorker()) {
3535 const rootParent = path . resolve ( __dirParent , '..' ) ;
3636 const dbPathParent = path . join ( rootParent , '.codegraph' , 'graph.db' ) ;
3737
38- const { statsData : parentStats } = await import ( srcImport ( parentSrcDir , 'queries.js' ) ) ;
38+ const { statsData : parentStats } = await import ( srcImport ( parentSrcDir , 'domain/ queries.js' ) ) ;
3939 const { resolveImportsBatch : parentBatch , resolveImportPathJS : parentJS } = await import (
40- srcImport ( parentSrcDir , 'resolve.js' )
40+ srcImport ( parentSrcDir , 'domain/graph/ resolve.js' )
4141 ) ;
4242 const { isNativeAvailable : parentNativeCheck } = await import (
43- srcImport ( parentSrcDir , 'native.js' )
43+ srcImport ( parentSrcDir , 'infrastructure/ native.js' )
4444 ) ;
4545
4646 const RUNS = 3 ;
@@ -52,18 +52,22 @@ if (!isWorker()) {
5252 function round1 ( n ) { return Math . round ( n * 10 ) / 10 ; }
5353
5454 function collectImportPairs ( ) {
55- const srcDir = path . join ( rootParent , 'src' ) ;
56- const files = fs . readdirSync ( srcDir ) . filter ( ( f ) => f . endsWith ( '.js' ) ) ;
55+ const srcRoot = path . join ( rootParent , 'src' ) ;
5756 const importRe = / (?: ^ | \n ) \s * i m p o r t \s + .* ?\s + f r o m \s + [ ' " ] ( [ ^ ' " ] + ) [ ' " ] / g;
5857 const pairs = [ ] ;
59- for ( const file of files ) {
60- const absFile = path . join ( srcDir , file ) ;
61- const content = fs . readFileSync ( absFile , 'utf8' ) ;
62- let match ;
63- while ( ( match = importRe . exec ( content ) ) !== null ) {
64- pairs . push ( { fromFile : absFile , importSource : match [ 1 ] } ) ;
58+ function walk ( dir ) {
59+ for ( const entry of fs . readdirSync ( dir , { withFileTypes : true } ) ) {
60+ if ( entry . isDirectory ( ) ) { walk ( path . join ( dir , entry . name ) ) ; continue ; }
61+ if ( ! entry . name . endsWith ( '.js' ) ) continue ;
62+ const absFile = path . join ( dir , entry . name ) ;
63+ const content = fs . readFileSync ( absFile , 'utf8' ) ;
64+ let match ;
65+ while ( ( match = importRe . exec ( content ) ) !== null ) {
66+ pairs . push ( { fromFile : absFile , importSource : match [ 1 ] } ) ;
67+ }
6568 }
6669 }
70+ walk ( srcRoot ) ;
6771 return pairs ;
6872 }
6973
@@ -138,14 +142,14 @@ const root = path.resolve(__dirname, '..');
138142const { srcDir, cleanup } = await resolveBenchmarkSource ( ) ;
139143const dbPath = path . join ( root , '.codegraph' , 'graph.db' ) ;
140144
141- const { buildGraph } = await import ( srcImport ( srcDir , 'builder.js' ) ) ;
145+ const { buildGraph } = await import ( srcImport ( srcDir , 'domain/graph/ builder.js' ) ) ;
142146
143147// Redirect console.log to stderr so only JSON goes to stdout
144148const origLog = console . log ;
145149console . log = ( ...args ) => console . error ( ...args ) ;
146150
147151const RUNS = 3 ;
148- const PROBE_FILE = path . join ( root , 'src' , 'queries.js' ) ;
152+ const PROBE_FILE = path . join ( root , 'src' , 'domain' , ' queries.js') ;
149153
150154function median ( arr ) {
151155 const sorted = [ ...arr ] . sort ( ( a , b ) => a - b ) ;
0 commit comments