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

Function collectModuleControllers

src/resolution/frameworks/nestjs.ts:601–611  ·  view source on GitHub ↗

* Walk every `@Module(...)` decorator and populate `out` with * `Controller → enclosingModuleClassName`, based on the decorator's * `controllers: [...]` field and the class declaration that follows the * decorator (skipping stacked decorators and export/default/abstract * modifiers).

(safe: string, out: Map<string, string>)

Source from the content-addressed store, hash-verified

599 * modifiers).
600 */
601function collectModuleControllers(safe: string, out: Map<string, string>): void {
602 for (const hit of findDecorators(safe, ['Module'])) {
603 const className = classNameAfter(safe, hit.end);
604 if (!className) continue;
605 for (const controller of parseControllersField(hit.args)) {
606 // First-write-wins, same as RouterModule, so a controller listed in two
607 // modules picks up the one declared earliest in source.
608 if (!out.has(controller)) out.set(controller, className);
609 }
610 }
611}
612
613function parseControllersField(args: string): string[] {
614 const inner = parseArrayField(args, 'controllers');

Callers 1

postExtractFunction · 0.85

Calls 5

findDecoratorsFunction · 0.85
classNameAfterFunction · 0.85
parseControllersFieldFunction · 0.85
hasMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected