-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove barrel dependency from modules
- Loading branch information
1 parent
2a876d4
commit 2c11b0b
Showing
10 changed files
with
303 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 14 additions & 17 deletions
31
packages/core/src/lib/modules/internal/find-module-paths-with-barrel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
import { logger } from "../../log"; | ||
import { FsPath } from "../../file-info/fs-path"; | ||
import getFs from "../../fs/getFs"; | ||
|
||
const log = logger('core.modules.find-path'); | ||
|
||
export function findModulePathsWithBarrel(projectDirs: FsPath[], barrelFileName: string): Set<FsPath> { | ||
const fs = getFs(); | ||
let modules: FsPath[] = []; | ||
|
||
for (const projectDir of projectDirs) { | ||
modules = modules.concat(fs.findFiles(projectDir, barrelFileName)); | ||
} | ||
|
||
log.info(modules.join(', ')); | ||
return new Set(modules); | ||
}; | ||
import { FsPath, toFsPath } from '../../file-info/fs-path'; | ||
import getFs from '../../fs/getFs'; | ||
|
||
export function findModulePathsWithBarrel( | ||
projectDirs: FsPath[], | ||
barrelFileName: string, | ||
): FsPath[] { | ||
return projectDirs.flatMap((projectDir) => | ||
getFs() | ||
.findFiles(projectDir, barrelFileName) | ||
.map((path) => path.slice(0, -(barrelFileName.length + 1))) | ||
.map(toFsPath), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.