MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / importedFiles

Function importedFiles

__tests__/commonjs-require-imports.test.ts:73–78  ·  view source on GitHub ↗
(file: string)

Source from the content-addressed store, hash-verified

71});
72
73const importedFiles = (file: string) => {
74 const ids = cg.getNodesInFile(file).map((n) => n.id);
75 return [...new Set(cg.getOutgoingEdgesFrom(ids, ['imports'])
76 .map((e) => cg.getNode(e.target)!.filePath)
77 .filter((p) => p !== file))].sort();
78};
79
80describe('CommonJS require', () => {
81 it('imports the files a module requires, used as values or not, and no package', () => {

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesFromMethod · 0.45

Tested by

no test coverage detected