|
1 | 1 | import * as fs from 'fs';
|
2 | 2 | import { ArrayUtils, Config, FileSystemUtils } from "@src";
|
3 |
| -import { Component, Directive, Injectable, NamedEntity, Pipe, Project } from '@model'; |
4 |
| - |
5 |
| -export class NgModule { |
6 |
| - public imports: string[] = []; |
7 |
| - public exports: string[] = []; |
8 |
| - public declarations: string[] = []; |
9 |
| - public entryComponents: string[] = []; |
10 |
| - public providers: string[] = []; |
11 |
| - public bootstrap: string[] = []; |
12 |
| - public filename: string = ''; |
13 |
| - public moduleName: string = ''; |
14 |
| - public moduleStats(): number[] { |
15 |
| - return [ |
16 |
| - this.declarations === undefined ? 0 : ArrayUtils.arrayLength(this.declarations), |
17 |
| - this.imports === undefined ? 0 : ArrayUtils.arrayLength(this.imports), |
18 |
| - this.exports === undefined ? 0 : ArrayUtils.arrayLength(this.exports), |
19 |
| - this.bootstrap === undefined ? 0 : ArrayUtils.arrayLength(this.bootstrap), |
20 |
| - this.providers === undefined ? 0 : ArrayUtils.arrayLength(this.providers), |
21 |
| - this.entryComponents === undefined ? 0 : ArrayUtils.arrayLength(this.entryComponents), |
22 |
| - ]; |
23 |
| - } |
24 |
| -} |
| 3 | +import { Component, Directive, Injectable, NamedEntity, NgModule, Pipe, Project } from '@model'; |
25 | 4 |
|
26 | 5 | export class ModuleManager {
|
27 | 6 |
|
@@ -63,9 +42,16 @@ export class ModuleManager {
|
63 | 42 | const module: NgModule = this.parseModuleContents(moduleContents);
|
64 | 43 | module.filename = filename;
|
65 | 44 | module.moduleName = moduleName;
|
| 45 | + |
| 46 | + regex = /:\s+routes\s+=\s+\[.*?\]/ims; |
| 47 | + match = regex.exec(fileContents.toString()); |
| 48 | + if (match !== null) { |
| 49 | + module.isRoutingModule = true; |
| 50 | + } |
| 51 | + |
66 | 52 | return module;
|
67 | 53 | } catch (ex) {
|
68 |
| - errors.push(`ModuleName: ${moduleName}\nFilename: ${filename}\nException: ${ex}\n${match[1]}\n`); |
| 54 | + errors.push(`ModuleName: ${moduleName}\nFilename: ${filename}\nException: ${ex}\n${moduleContents}\n`); |
69 | 55 | return undefined;
|
70 | 56 | }
|
71 | 57 | }
|
|
0 commit comments