MCPcopy
hub / github.com/nestjs/nest / insertModule

Method insertModule

packages/core/scanner.ts:182–215  ·  view source on GitHub ↗
(
    moduleDefinition: any,
    scope: Type<unknown>[],
  )

Source from the content-addressed store, hash-verified

180 }
181
182 public async insertModule(
183 moduleDefinition: any,
184 scope: Type<unknown>[],
185 ): Promise<
186 | {
187 moduleRef: Module;
188 inserted: boolean;
189 }
190 | undefined
191 > {
192 const moduleToAdd = this.isForwardReference(moduleDefinition)
193 ? moduleDefinition.forwardRef()
194 : moduleDefinition;
195
196 if (this.isInjectable(moduleToAdd)) {
197 throw new InvalidClassModuleException(
198 moduleDefinition,
199 scope,
200 'provider',
201 );
202 }
203 if (this.isController(moduleToAdd)) {
204 throw new InvalidClassModuleException(
205 moduleDefinition,
206 scope,
207 'controller',
208 );
209 }
210 if (this.isExceptionFilter(moduleToAdd)) {
211 throw new InvalidClassModuleException(moduleDefinition, scope, 'filter');
212 }
213
214 return this.container.addModule(moduleToAdd, scope);
215 }
216
217 public async scanModulesForDependencies(
218 modules: Map<string, Module> = this.container.getModules(),

Callers 2

scanner.spec.tsFile · 0.80

Calls 6

isForwardReferenceMethod · 0.95
isInjectableMethod · 0.95
isControllerMethod · 0.95
isExceptionFilterMethod · 0.95
addModuleMethod · 0.80
forwardRefMethod · 0.45

Tested by

no test coverage detected