MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / isLikelyEntryPoint

Function isLikelyEntryPoint

src/tools/codegraph/find-dead-code.ts:100–115  ·  view source on GitHub ↗
(rel: string, packageJson: any)

Source from the content-addressed store, hash-verified

98}
99
100function isLikelyEntryPoint(rel: string, packageJson: any): boolean {
101 if (ENTRY_HINT_PATTERNS.some(p => p.test(rel))) return true;
102 if (packageJson) {
103 if (packageJson.main && rel === packageJson.main.replace(/^\.\//, '')) return true;
104 if (packageJson.module && rel === packageJson.module.replace(/^\.\//, '')) return true;
105 if (packageJson.bin) {
106 const bins = typeof packageJson.bin === 'string' ? [packageJson.bin] : Object.values(packageJson.bin);
107 if (bins.some((b: any) => typeof b === 'string' && rel === b.replace(/^\.\//, ''))) return true;
108 }
109 if (Array.isArray(packageJson.files) && packageJson.files.some((f: string) => rel.startsWith(f))) {
110 // listed in `files` — meant to ship to npm, treat as potential entry
111 return true;
112 }
113 }
114 return false;
115}
116
117/** Build the set of "anything that looks like an import or reference TO `target`'s stem". */
118function buildReferencePatterns(targetRel: string): string[] {

Callers 1

executeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected