MCPcopy Index your code
hub / github.com/callstack/agent-device / resolveRelativeImportPath

Function resolveRelativeImportPath

src/daemon/code-signature.ts:74–90  ·  view source on GitHub ↗
(fromPath: string, specifier: string)

Source from the content-addressed store, hash-verified

72}
73
74function resolveRelativeImportPath(fromPath: string, specifier: string): string | null {
75 const basePath = path.resolve(path.dirname(fromPath), specifier);
76 const direct = resolveExistingFile(basePath);
77 if (direct) return direct;
78
79 for (const extension of RESOLVABLE_EXTENSIONS) {
80 const withExtension = resolveExistingFile(`${basePath}${extension}`);
81 if (withExtension) return withExtension;
82 }
83
84 for (const extension of RESOLVABLE_EXTENSIONS) {
85 const indexPath = resolveExistingFile(path.join(basePath, `index${extension}`));
86 if (indexPath) return indexPath;
87 }
88
89 return null;
90}
91
92function resolveExistingFile(candidatePath: string): string | null {
93 try {

Callers 1

Calls 1

resolveExistingFileFunction · 0.85

Tested by

no test coverage detected