(metadata: ModulePlusMetadata)
| 54 | >(); |
| 55 | |
| 56 | export function Module(metadata: ModulePlusMetadata) { |
| 57 | return function (module: any) { |
| 58 | // Prepare metadata |
| 59 | |
| 60 | if (metadata.controllers?.length === 0) { |
| 61 | delete metadata.controllers; |
| 62 | } |
| 63 | |
| 64 | metadata.imports ??= []; |
| 65 | metadata.imports.push(JwtModule); |
| 66 | |
| 67 | // All module imports |
| 68 | |
| 69 | const moduleInfo = getModuleInfo(module); |
| 70 | |
| 71 | for (let i = 0; i < metadata.imports.length; i++) { |
| 72 | const childImport = metadata.imports[i] as any; |
| 73 | |
| 74 | let childModule; |
| 75 | |
| 76 | if (childImport?.prefix != null) { |
| 77 | childModule = childImport.module; |
| 78 | } else { |
| 79 | childModule = childImport; |
| 80 | } |
| 81 | |
| 82 | const childData = getModuleInfo(childModule); |
| 83 | |
| 84 | moduleInfo.children ??= []; |
| 85 | moduleInfo.children.push(childModule); |
| 86 | |
| 87 | childData.parent = module; |
| 88 | childData.prefix = childImport?.prefix; |
| 89 | |
| 90 | metadata.imports[i] = childModule; |
| 91 | } |
| 92 | |
| 93 | // RouteModule |
| 94 | |
| 95 | for (let i = 0; i < metadata.imports.length; i++) { |
| 96 | if (metadata.imports[i] !== RouterModule) { |
| 97 | continue; |
| 98 | } |
| 99 | |
| 100 | metadata.imports[i] = RouterModule.register(_generateRoutes(module)); |
| 101 | } |
| 102 | |
| 103 | // Controllers |
| 104 | |
| 105 | moduleInfo.controllers = metadata.controllers; |
| 106 | moduleInfo.providers = metadata.providers; |
| 107 | |
| 108 | Module_(metadata as any)(module); |
| 109 | }; |
| 110 | } |
| 111 | |
| 112 | function _getDescendantModules(module: any) { |
| 113 | const descendantModules: NestModule[] = []; |
nothing calls this directly
no test coverage detected