MCPcopy
hub / github.com/jonaskello/tsconfig-paths / createMatchPath

Function createMatchPath

src/match-path-sync.ts:27–53  ·  view source on GitHub ↗
(
  absoluteBaseUrl: string,
  paths: { [key: string]: Array<string> },
  mainFields: (string | string[])[] = ["main"],
  addMatchAll: boolean = true
)

Source from the content-addressed store, hash-verified

25 * @returns a function that can resolve paths.
26 */
27export 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.

Callers 4

main.tsFile · 0.90
main.tsFile · 0.90
registerFunction · 0.90

Calls 1

matchFromAbsolutePathsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…