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

Function collectModuleControllers

src/resolution/frameworks/nestjs.ts:821–831  ·  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

819 * modifiers).
820 */
821function collectModuleControllers(safe: string, out: Map<string, string>): void {
822 for (const hit of findDecorators(safe, ['Module'])) {
823 const className = classNameAfter(safe, hit.end);
824 if (!className) continue;
825 for (const controller of parseControllersField(hit.args)) {
826 // First-write-wins, same as RouterModule, so a controller listed in two
827 // modules picks up the one declared earliest in source.
828 if (!out.has(controller)) out.set(controller, className);
829 }
830 }
831}
832
833function parseControllersField(args: string): string[] {
834 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