(
absoluteBaseUrl: string,
paths: { [key: string]: Array<string> },
mainFields: (string | string[])[] = ["main"],
addMatchAll: boolean = true
)
| 25 | * @returns a function that can resolve paths. |
| 26 | */ |
| 27 | export function createMatchPath( |
| 28 | absoluteBaseUrl: string, |
| 29 | paths: { [key: string]: Array<string> }, |
| 30 | mainFields: (string | string[])[] = ["main"], |
| 31 | addMatchAll: boolean = true |
| 32 | ): MatchPath { |
| 33 | const absolutePaths = MappingEntry.getAbsoluteMappingEntries( |
| 34 | absoluteBaseUrl, |
| 35 | paths, |
| 36 | addMatchAll |
| 37 | ); |
| 38 | |
| 39 | return ( |
| 40 | requestedModule: string, |
| 41 | readJson?: Filesystem.ReadJsonSync, |
| 42 | fileExists?: Filesystem.FileExistsSync, |
| 43 | extensions?: Array<string> |
| 44 | ) => |
| 45 | matchFromAbsolutePaths( |
| 46 | absolutePaths, |
| 47 | requestedModule, |
| 48 | readJson, |
| 49 | fileExists, |
| 50 | extensions, |
| 51 | mainFields |
| 52 | ); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Finds a path from tsconfig that matches a module load request. |
no test coverage detected
searching dependent graphs…