@nexus-ioc/graph-analyzer 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/LICENSE +21 -0
  3. package/README.md +742 -0
  4. package/dist/analyzer/circular-dependency-detector.d.ts +94 -0
  5. package/dist/analyzer/circular-dependency-detector.js +203 -0
  6. package/dist/analyzer/circular-dependency-detector.js.map +1 -0
  7. package/dist/analyzer/module-depth-analyzer.d.ts +117 -0
  8. package/dist/analyzer/module-depth-analyzer.js +221 -0
  9. package/dist/analyzer/module-depth-analyzer.js.map +1 -0
  10. package/dist/analyzer/provider-scope-analyzer.d.ts +91 -0
  11. package/dist/analyzer/provider-scope-analyzer.js +137 -0
  12. package/dist/analyzer/provider-scope-analyzer.js.map +1 -0
  13. package/dist/analyzer/unused-provider-detector.d.ts +73 -0
  14. package/dist/analyzer/unused-provider-detector.js +147 -0
  15. package/dist/analyzer/unused-provider-detector.js.map +1 -0
  16. package/dist/cli.d.ts +2 -0
  17. package/dist/cli.js +537 -0
  18. package/dist/cli.js.map +1 -0
  19. package/dist/config/config-loader.d.ts +27 -0
  20. package/dist/config/config-loader.js +205 -0
  21. package/dist/config/config-loader.js.map +1 -0
  22. package/dist/config/config-schema.d.ts +83 -0
  23. package/dist/config/config-schema.js +97 -0
  24. package/dist/config/config-schema.js.map +1 -0
  25. package/dist/index.d.ts +41 -0
  26. package/dist/index.js +50 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/interfaces/graph-output.interface.d.ts +126 -0
  29. package/dist/interfaces/graph-output.interface.js +3 -0
  30. package/dist/interfaces/graph-output.interface.js.map +1 -0
  31. package/dist/interfaces/providers.interface.d.ts +10 -0
  32. package/dist/interfaces/providers.interface.js +3 -0
  33. package/dist/interfaces/providers.interface.js.map +1 -0
  34. package/dist/parser/dependency-extractor.d.ts +88 -0
  35. package/dist/parser/dependency-extractor.js +334 -0
  36. package/dist/parser/dependency-extractor.js.map +1 -0
  37. package/dist/parser/parse-entry-file.d.ts +15 -0
  38. package/dist/parser/parse-entry-file.js +46 -0
  39. package/dist/parser/parse-entry-file.js.map +1 -0
  40. package/dist/parser/parse-imports.d.ts +15 -0
  41. package/dist/parser/parse-imports.js +65 -0
  42. package/dist/parser/parse-imports.js.map +1 -0
  43. package/dist/parser/parse-ns-module.d.ts +39 -0
  44. package/dist/parser/parse-ns-module.js +122 -0
  45. package/dist/parser/parse-ns-module.js.map +1 -0
  46. package/dist/parser/parse-provider.d.ts +2 -0
  47. package/dist/parser/parse-provider.js +7 -0
  48. package/dist/parser/parse-provider.js.map +1 -0
  49. package/dist/parser/parse-ts-config.d.ts +10 -0
  50. package/dist/parser/parse-ts-config.js +40 -0
  51. package/dist/parser/parse-ts-config.js.map +1 -0
  52. package/dist/parser/parser-rec.d.ts +1 -0
  53. package/dist/parser/parser-rec.js +52 -0
  54. package/dist/parser/parser-rec.js.map +1 -0
  55. package/dist/parser/parser.d.ts +1 -0
  56. package/dist/parser/parser.js +61 -0
  57. package/dist/parser/parser.js.map +1 -0
  58. package/dist/parser/provider/class-parser.d.ts +20 -0
  59. package/dist/parser/provider/class-parser.js +137 -0
  60. package/dist/parser/provider/class-parser.js.map +1 -0
  61. package/dist/parser/provider/providers-parser.d.ts +9 -0
  62. package/dist/parser/provider/providers-parser.js +32 -0
  63. package/dist/parser/provider/providers-parser.js.map +1 -0
  64. package/dist/parser/provider/use-class-parser.d.ts +25 -0
  65. package/dist/parser/provider/use-class-parser.js +161 -0
  66. package/dist/parser/provider/use-class-parser.js.map +1 -0
  67. package/dist/parser/provider/use-factory-parser.d.ts +15 -0
  68. package/dist/parser/provider/use-factory-parser.js +53 -0
  69. package/dist/parser/provider/use-factory-parser.js.map +1 -0
  70. package/dist/parser/provider/use-value-parser.d.ts +13 -0
  71. package/dist/parser/provider/use-value-parser.js +41 -0
  72. package/dist/parser/provider/use-value-parser.js.map +1 -0
  73. package/dist/parser/rules.d.ts +10 -0
  74. package/dist/parser/rules.js +37 -0
  75. package/dist/parser/rules.js.map +1 -0
  76. package/dist/utils/error-formatter.d.ts +27 -0
  77. package/dist/utils/error-formatter.js +177 -0
  78. package/dist/utils/error-formatter.js.map +1 -0
  79. package/dist/utils/validator.d.ts +45 -0
  80. package/dist/utils/validator.js +252 -0
  81. package/dist/utils/validator.js.map +1 -0
  82. package/dist/visualize/generator.d.ts +26 -0
  83. package/dist/visualize/generator.js +75 -0
  84. package/dist/visualize/generator.js.map +1 -0
  85. package/dist/visualize/graph-analyzer.d.ts +126 -0
  86. package/dist/visualize/graph-analyzer.js +199 -0
  87. package/dist/visualize/graph-analyzer.js.map +1 -0
  88. package/dist/visualize/html-generator.d.ts +71 -0
  89. package/dist/visualize/html-generator.js +1312 -0
  90. package/dist/visualize/html-generator.js.map +1 -0
  91. package/dist/visualize/json-formatter.d.ts +106 -0
  92. package/dist/visualize/json-formatter.js +252 -0
  93. package/dist/visualize/json-formatter.js.map +1 -0
  94. package/docs/API_REFERENCE.md +747 -0
  95. package/docs/ARCHITECTURE.md +486 -0
  96. package/docs/CLI_GUIDE.md +576 -0
  97. package/docs/HTML_VISUALIZATION.md +365 -0
  98. package/package.json +85 -0
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UseClassParser = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fs = tslib_1.__importStar(require("node:fs"));
6
+ const path = tslib_1.__importStar(require("node:path"));
7
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
8
+ const ts = tslib_1.__importStar(require("typescript"));
9
+ const dependency_extractor_1 = require("../dependency-extractor");
10
+ const provideRegexp = /provide:\s*([^,\s]+)/;
11
+ const useClassRegexp = /useClass:\s*([A-Za-z_][A-Za-z0-9_]*)/;
12
+ const scopeRegexp = /scope:\s*([A-Za-z_][\w.]*)/;
13
+ class UseClassParser {
14
+ constructor(provider, sourceFile, currentFilePath) {
15
+ this.provider = provider;
16
+ this.sourceFile = sourceFile;
17
+ this.currentFilePath = currentFilePath;
18
+ this.type = "UseClass";
19
+ this._token = null;
20
+ this._value = null;
21
+ this._scope = null;
22
+ this._dependencies = [];
23
+ this.dependencyExtractor = new dependency_extractor_1.DependencyExtractor();
24
+ }
25
+ parse() {
26
+ const token = this.provider.match(provideRegexp);
27
+ const useClass = this.provider.match(useClassRegexp);
28
+ const scope = this.provider.match(scopeRegexp);
29
+ if (token) {
30
+ this._token = token[1];
31
+ }
32
+ if (useClass) {
33
+ this._value = useClass[1];
34
+ // Extract dependencies from the class
35
+ if (this.sourceFile && this._value) {
36
+ this._dependencies = this.extractDependenciesFromClass(this._value);
37
+ }
38
+ }
39
+ if (scope) {
40
+ this._scope = scope[1];
41
+ }
42
+ return this;
43
+ }
44
+ extractDependenciesFromClass(className) {
45
+ if (!this.sourceFile) {
46
+ return [];
47
+ }
48
+ // First, try to find the class in the current file (module file)
49
+ let classDeclaration = this.findClassDeclaration(className, this.sourceFile);
50
+ let targetSourceFile = this.sourceFile;
51
+ // If not found, try to find the import and load the actual class file
52
+ if (!classDeclaration && this.currentFilePath) {
53
+ const classSourceFile = this.findAndLoadClassFile(className);
54
+ if (classSourceFile) {
55
+ classDeclaration = this.findClassDeclaration(className, classSourceFile);
56
+ targetSourceFile = classSourceFile;
57
+ }
58
+ }
59
+ if (!classDeclaration) {
60
+ return [];
61
+ }
62
+ // Extract dependencies using the DependencyExtractor
63
+ return this.dependencyExtractor.extractDependencies(classDeclaration, targetSourceFile);
64
+ }
65
+ findAndLoadClassFile(className) {
66
+ if (!this.sourceFile || !this.currentFilePath) {
67
+ return undefined;
68
+ }
69
+ // Find the import statement for this class
70
+ const importPath = this.findImportPathForClass(className);
71
+ if (!importPath) {
72
+ return undefined;
73
+ }
74
+ // Resolve the full path
75
+ const fullPath = this.resolveImportPath(importPath);
76
+ if (!fullPath || !fs.existsSync(fullPath)) {
77
+ return undefined;
78
+ }
79
+ // Load and parse the file
80
+ try {
81
+ const content = fs.readFileSync(fullPath, "utf8");
82
+ return ts.createSourceFile(fullPath, content, ts.ScriptTarget.Latest, true);
83
+ }
84
+ catch (_error) {
85
+ return undefined;
86
+ }
87
+ }
88
+ findImportPathForClass(className) {
89
+ if (!this.sourceFile) {
90
+ return undefined;
91
+ }
92
+ // Find import declarations that include this class
93
+ const importDeclarations = (0, tsquery_1.query)(this.sourceFile, "ImportDeclaration");
94
+ for (const node of importDeclarations) {
95
+ if (!ts.isImportDeclaration(node)) {
96
+ continue;
97
+ }
98
+ const importClause = node.importClause;
99
+ if (!importClause || !importClause.namedBindings) {
100
+ continue;
101
+ }
102
+ // Check named imports
103
+ if (ts.isNamedImports(importClause.namedBindings)) {
104
+ for (const element of importClause.namedBindings.elements) {
105
+ if (element.name.text === className) {
106
+ // Found the import!
107
+ if (ts.isStringLiteral(node.moduleSpecifier)) {
108
+ return node.moduleSpecifier.text;
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ return undefined;
115
+ }
116
+ resolveImportPath(importPath) {
117
+ if (!this.currentFilePath) {
118
+ return undefined;
119
+ }
120
+ // Skip node_modules
121
+ if (!importPath.startsWith(".")) {
122
+ return undefined;
123
+ }
124
+ const dir = path.dirname(this.currentFilePath);
125
+ const resolved = path.resolve(dir, importPath);
126
+ // Try different extensions
127
+ const extensions = [".ts", ".tsx", "/index.ts", "/index.tsx"];
128
+ for (const ext of extensions) {
129
+ const fullPath = resolved.endsWith(".ts") ? resolved : resolved + ext;
130
+ if (fs.existsSync(fullPath)) {
131
+ return fullPath;
132
+ }
133
+ }
134
+ return undefined;
135
+ }
136
+ findClassDeclaration(className, sourceFile) {
137
+ // Use tsquery to find the class declaration
138
+ const selector = `ClassDeclaration[name.name="${className}"]`;
139
+ const nodes = (0, tsquery_1.query)(sourceFile, selector);
140
+ for (const node of nodes) {
141
+ if (ts.isClassDeclaration(node)) {
142
+ return node;
143
+ }
144
+ }
145
+ return undefined;
146
+ }
147
+ get token() {
148
+ return this._token;
149
+ }
150
+ get value() {
151
+ return this._value;
152
+ }
153
+ get scope() {
154
+ return this._scope;
155
+ }
156
+ get dependencies() {
157
+ return this._dependencies;
158
+ }
159
+ }
160
+ exports.UseClassParser = UseClassParser;
161
+ //# sourceMappingURL=use-class-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-class-parser.js","sourceRoot":"","sources":["../../../src/parser/provider/use-class-parser.ts"],"names":[],"mappings":";;;;AAAA,oDAA8B;AAC9B,wDAAkC;AAClC,uDAAkD;AAClD,uDAAiC;AAEjC,kEAA+E;AAE/E,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAC7C,MAAM,cAAc,GAAG,sCAAsC,CAAC;AAC9D,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAEjD,MAAa,cAAc;IAQ1B,YACkB,QAAgB,EAChB,UAA0B,EAC1B,eAAwB;QAFxB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,eAAU,GAAV,UAAU,CAAgB;QAC1B,oBAAe,GAAf,eAAe,CAAS;QAV1B,SAAI,GAAG,UAAU,CAAC;QAC1B,WAAM,GAAkB,IAAI,CAAC;QAC7B,WAAM,GAAkB,IAAI,CAAC;QAC7B,WAAM,GAAkB,IAAI,CAAC;QAC7B,kBAAa,GAAiB,EAAE,CAAC;QACjC,wBAAmB,GAAG,IAAI,0CAAmB,EAAE,CAAC;IAMrD,CAAC;IAEJ,KAAK;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAE/C,IAAI,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC;QAED,IAAI,QAAQ,EAAE,C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YACjB,CAAC;QACF,CAAC;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;IAEO,oBAAoB,CAC3B,SAAiB,EACjB,UAAyB;QAEzB,4CAA4C;QAC5C,MAAM,QAAQ,GAAG,+BAA+B,SAAS,IAAI,CAAC;QAC9D,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAE1C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YAC1B,IAAI,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;gBACjC,OAAO,IAAI,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,IAAI,YAAY;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD;AApMD,wCAoMC"}
@@ -0,0 +1,15 @@
1
+ import type { ProvidersInterface } from "../../interfaces/providers.interface";
2
+ export declare class UseFactoryParser implements ProvidersInterface {
3
+ private readonly provider;
4
+ readonly type = "UseFactory";
5
+ private _token;
6
+ private _value;
7
+ private _inject;
8
+ private _scope;
9
+ constructor(provider: string);
10
+ parse(): this;
11
+ get token(): string | null;
12
+ get value(): string | null;
13
+ get inject(): string[];
14
+ get scope(): string | null;
15
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UseFactoryParser = void 0;
4
+ const provideRegexp = /provide:\s*"([^"]+)"/;
5
+ const useFactoryRegexp = /useFactory:\s*((?:\([^)]*\)\s*=>\s*\{[^}]*\}))/;
6
+ const injectRegexp = /inject:\s*\[([^\]]+)\]/;
7
+ const scopeRegexp = /scope:\s*([^,}]+)/;
8
+ class UseFactoryParser {
9
+ constructor(provider) {
10
+ this.provider = provider;
11
+ this.type = "UseFactory";
12
+ this._token = null;
13
+ this._value = null;
14
+ this._inject = [];
15
+ this._scope = null;
16
+ }
17
+ parse() {
18
+ const token = this.provider.match(provideRegexp);
19
+ const useFactory = this.provider.match(useFactoryRegexp);
20
+ const inject = this.provider.match(injectRegexp);
21
+ const scope = this.provider.match(scopeRegexp);
22
+ if (token) {
23
+ this._token = token[1];
24
+ }
25
+ if (useFactory) {
26
+ this._value = useFactory[1];
27
+ }
28
+ if (inject) {
29
+ this._inject = inject[1]
30
+ .split(",")
31
+ .map((inject) => inject.trim())
32
+ .map((inject) => inject.replace(/^["']|["']$/g, "")); // Remove surrounding quotes
33
+ }
34
+ if (scope) {
35
+ this._scope = scope[1].trim();
36
+ }
37
+ return this;
38
+ }
39
+ get token() {
40
+ return this._token;
41
+ }
42
+ get value() {
43
+ return this._value;
44
+ }
45
+ get inject() {
46
+ return this._inject;
47
+ }
48
+ get scope() {
49
+ return this._scope;
50
+ }
51
+ }
52
+ exports.UseFactoryParser = UseFactoryParser;
53
+ //# sourceMappingURL=use-factory-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-factory-parser.js","sourceRoot":"","sources":["../../../src/parser/provider/use-factory-parser.ts"],"names":[],"mappings":";;;AAEA,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAC7C,MAAM,gBAAgB,GAAG,gDAAgD,CAAC;AAC1E,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAC9C,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAExC,MAAa,gBAAgB;IAO5B,YAA6B,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;QAN7B,SAAI,GAAG,YAAY,CAAC;QAC5B,WAAM,GAAkB,IAAI,CAAC;QAC7B,WAAM,GAAkB,IAAI,CAAC;QAC7B,YAAO,GAAa,EAAE,CAAC;QACvB,WAAM,GAAkB,IA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;IAED,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;CACD;AApDD,4CAoDC"}
@@ -0,0 +1,13 @@
1
+ import type { ProvidersInterface } from "../../interfaces/providers.interface";
2
+ export declare class UseValueParser implements ProvidersInterface {
3
+ private readonly provider;
4
+ readonly type = "UseValue";
5
+ private _token;
6
+ private _value;
7
+ private _scope;
8
+ constructor(provider: string);
9
+ parse(): this;
10
+ get token(): string | null;
11
+ get value(): string | null;
12
+ get scope(): string | null;
13
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UseValueParser = void 0;
4
+ const provideRegexp = /provide:\s*"([^"]+)"/;
5
+ const useValueRegexp = /useValue:\s*"([^"]+)"/;
6
+ const scopeRegexp = /scope:\s*([^,}]+)/;
7
+ class UseValueParser {
8
+ constructor(provider) {
9
+ this.provider = provider;
10
+ this.type = "UseValue";
11
+ this._token = null;
12
+ this._value = null;
13
+ this._scope = null;
14
+ }
15
+ parse() {
16
+ const token = this.provider.match(provideRegexp);
17
+ const useValue = this.provider.match(useValueRegexp);
18
+ const scope = this.provider.match(scopeRegexp);
19
+ if (token) {
20
+ this._token = token[1];
21
+ }
22
+ if (useValue) {
23
+ this._value = useValue[1];
24
+ }
25
+ if (scope) {
26
+ this._scope = scope[1].trim();
27
+ }
28
+ return this;
29
+ }
30
+ get token() {
31
+ return this._token;
32
+ }
33
+ get value() {
34
+ return this._value;
35
+ }
36
+ get scope() {
37
+ return this._scope;
38
+ }
39
+ }
40
+ exports.UseValueParser = UseValueParser;
41
+ //# sourceMappingURL=use-value-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-value-parser.js","sourceRoot":"","sources":["../../../src/parser/provider/use-value-parser.ts"],"names":[],"mappings":";;;AAEA,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAC7C,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAC/C,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAExC,MAAa,cAAc;IAM1B,YAA6B,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;QAL7B,SAAI,GAAG,UAAU,CAAC;QAC1B,WAAM,GAAkB,IAAI,CAAC;QAC7B,WAAM,GAAkB,IAAI,CAAC;QAC7B,WAAM,GAAkB,IAAI,CAAC;IAEW,CAAC;IAEjD,KAAK;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAE/C,IAAI,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YACd,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;QAED,IAAI,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC/B,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;CACD;AAvCD,wCAuCC"}
@@ -0,0 +1,10 @@
1
+ import type * as ts from "typescript";
2
+ export declare const rules: ({
3
+ rule: string;
4
+ callback(nodes: ts.Node[], _file: ts.SourceFile): void;
5
+ name?: undefined;
6
+ } | {
7
+ name: string;
8
+ rule: string;
9
+ callback(nodes: ts.Node[], _file: ts.SourceFile): void;
10
+ })[];
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rules = void 0;
4
+ let entryModule = null;
5
+ exports.rules = [
6
+ {
7
+ rule: "CallExpression",
8
+ callback(nodes, _file) {
9
+ if (entryModule) {
10
+ return;
11
+ }
12
+ for (const node of nodes) {
13
+ const text = node.getText();
14
+ const match = text.match(/\.create\((\w+)\)/);
15
+ if (match) {
16
+ entryModule = match[1];
17
+ return;
18
+ }
19
+ }
20
+ },
21
+ },
22
+ {
23
+ name: "findNsModuleDecorators",
24
+ rule: 'Decorator[expression.expression.name="NsModule"]',
25
+ callback(nodes, _file) {
26
+ for (const node of nodes) {
27
+ const text = node.getText();
28
+ const match = text.match(/imports:\s*\[([^\]]+)\]/);
29
+ if (match) {
30
+ const modules = match[1].split(",").map((m) => m.trim());
31
+ console.log("modules: ", modules);
32
+ }
33
+ }
34
+ },
35
+ },
36
+ ];
37
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/parser/rules.ts"],"names":[],"mappings":";;;AAEA,IAAI,WAAW,GAAkB,IAAI,CAAC;AAEzB,QAAA,KAAK,GAAG;IACpB;QACC,IAAI,EAAE,gBAAgB;QACtB,QAAQ,CAAC,KAAgB,EAAE,KAAoB;YAC9C,IAAI,WAAW,EAAE,CAAC;gBACjB,OAAO;YACR,CAAC;YAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;gBAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;gBAE9C,IAAI,KAAK,EAAE,CAAC;oBACX,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;oBACvB,OAAO;gBACR,CAAC;YACF,CAAC;QACF,CAAC;KACD;IACD;QACC,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,kDAAkD;QACxD,QAAQ,CAAC,KAAgB,EAAE,KAAoB;YAC9C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;gBAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;gBAEpD,IAAI,KAAK,EAAE,CAAC;oBACX,MAAM,OAAO,GAAa,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;oBAEnE,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;gBACnC,CAAC;YACF,CAAC;QACF,CAAC;KACD;CACD,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { ValidationError } from "./validator";
2
+ export declare class ErrorFormatter {
3
+ /**
4
+ * Format a validation error with clear sections
5
+ */
6
+ static formatValidationError(error: ValidationError): string;
7
+ /**
8
+ * Format a generic error with context-aware suggestions
9
+ */
10
+ static formatError(error: Error): string;
11
+ /**
12
+ * Get context-aware suggestions based on error message
13
+ */
14
+ private static getSuggestionsForError;
15
+ /**
16
+ * Format a success message
17
+ */
18
+ static formatSuccess(message: string): string;
19
+ /**
20
+ * Format a warning message
21
+ */
22
+ static formatWarning(message: string): string;
23
+ /**
24
+ * Format an info message
25
+ */
26
+ static formatInfo(message: string): string;
27
+ }
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ErrorFormatter = void 0;
4
+ class ErrorFormatter {
5
+ /**
6
+ * Format a validation error with clear sections
7
+ */
8
+ static formatValidationError(error) {
9
+ const lines = [];
10
+ // Header
11
+ lines.push("");
12
+ lines.push("=".repeat(50));
13
+ lines.push("❌ Error");
14
+ lines.push("=".repeat(50));
15
+ lines.push("");
16
+ // Error message
17
+ lines.push(error.message);
18
+ lines.push("");
19
+ // Details if available
20
+ if (error.details) {
21
+ lines.push("Details:");
22
+ lines.push(` ${error.details}`);
23
+ lines.push("");
24
+ }
25
+ // Suggestions
26
+ if (error.suggestions && error.suggestions.length > 0) {
27
+ lines.push("Suggestions:");
28
+ for (const suggestion of error.suggestions) {
29
+ if (suggestion === "") {
30
+ lines.push("");
31
+ }
32
+ else {
33
+ lines.push(` • ${suggestion}`);
34
+ }
35
+ }
36
+ lines.push("");
37
+ }
38
+ // Footer
39
+ lines.push("For more help, run: graph-analyzer --help");
40
+ lines.push("");
41
+ return lines.join("\n");
42
+ }
43
+ /**
44
+ * Format a generic error with context-aware suggestions
45
+ */
46
+ static formatError(error) {
47
+ const lines = [];
48
+ const errorMessage = error.message;
49
+ // Header
50
+ lines.push("");
51
+ lines.push("=".repeat(50));
52
+ lines.push("❌ Error");
53
+ lines.push("=".repeat(50));
54
+ lines.push("");
55
+ // Error message
56
+ lines.push(errorMessage);
57
+ lines.push("");
58
+ // Add context-aware suggestions
59
+ const suggestions = ErrorFormatter.getSuggestionsForError(errorMessage);
60
+ if (suggestions.length > 0) {
61
+ lines.push("Suggestions:");
62
+ for (const suggestion of suggestions) {
63
+ if (suggestion === "") {
64
+ lines.push("");
65
+ }
66
+ else {
67
+ lines.push(` • ${suggestion}`);
68
+ }
69
+ }
70
+ lines.push("");
71
+ }
72
+ // Footer
73
+ lines.push("For more help, run: graph-analyzer --help");
74
+ lines.push("");
75
+ return lines.join("\n");
76
+ }
77
+ /**
78
+ * Get context-aware suggestions based on error message
79
+ */
80
+ static getSuggestionsForError(errorMessage) {
81
+ const suggestions = [];
82
+ // Decorator errors (check before "not found" to avoid false matches)
83
+ if (errorMessage.toLowerCase().includes("decorator")) {
84
+ suggestions.push("Ensure decorators are enabled in tsconfig.json:");
85
+ suggestions.push(' "experimentalDecorators": true');
86
+ suggestions.push(' "emitDecoratorMetadata": true');
87
+ }
88
+ // File not found errors
89
+ else if (errorMessage.includes("not found") ||
90
+ errorMessage.includes("ENOENT")) {
91
+ suggestions.push("Check if the file path is correct");
92
+ suggestions.push("Make sure you're in the project root directory");
93
+ suggestions.push("Use an absolute path or relative path from current directory");
94
+ suggestions.push(`Current directory: ${process.cwd()}`);
95
+ }
96
+ // No entry module errors
97
+ else if (errorMessage.includes("No entry module")) {
98
+ suggestions.push("Make sure your entry file contains a NexusFactory.create() call");
99
+ suggestions.push("Check that the root module is properly decorated with @NsModule");
100
+ suggestions.push("");
101
+ suggestions.push("Example entry file:");
102
+ suggestions.push(" import { NexusFactory } from '@nexus-ioc/core';");
103
+ suggestions.push(" import { AppModule } from './app.module';");
104
+ suggestions.push("");
105
+ suggestions.push(" const app = NexusFactory.create(AppModule);");
106
+ }
107
+ // Invalid format errors
108
+ else if (errorMessage.includes("Invalid format")) {
109
+ suggestions.push("Use one of: json, png, html, or both");
110
+ suggestions.push("Example: graph-analyzer -f json src/main.ts");
111
+ }
112
+ // Invalid configuration errors
113
+ else if (errorMessage.includes("Invalid configuration")) {
114
+ suggestions.push("Check your configuration file syntax");
115
+ suggestions.push("Ensure all values match the expected types");
116
+ suggestions.push("Run: graph-analyzer --init to generate a valid config");
117
+ }
118
+ // Configuration file errors
119
+ else if (errorMessage.includes("Configuration file")) {
120
+ suggestions.push("Check if the configuration file exists");
121
+ suggestions.push("Verify the file path is correct");
122
+ suggestions.push("Run: graph-analyzer --init to create a new config");
123
+ }
124
+ // TypeScript compilation errors
125
+ else if (errorMessage.includes("Cannot read properties") ||
126
+ errorMessage.includes("undefined")) {
127
+ suggestions.push("Check your TypeScript configuration (tsconfig.json)");
128
+ suggestions.push("Ensure all required compiler options are set");
129
+ suggestions.push("Verify that your entry file is valid TypeScript");
130
+ suggestions.push("");
131
+ suggestions.push("Try specifying tsconfig.json explicitly:");
132
+ suggestions.push(" graph-analyzer -c ./tsconfig.json src/main.ts");
133
+ }
134
+ // Permission errors
135
+ else if (errorMessage.includes("EACCES") ||
136
+ errorMessage.includes("permission")) {
137
+ suggestions.push("Check file and directory permissions");
138
+ suggestions.push("Make sure you have read/write access");
139
+ suggestions.push("Try running with appropriate permissions");
140
+ }
141
+ // Module resolution errors
142
+ else if (errorMessage.includes("Cannot find module") ||
143
+ errorMessage.includes("Module not found")) {
144
+ suggestions.push("Check that all dependencies are installed");
145
+ suggestions.push("Run: npm install or yarn install");
146
+ suggestions.push("Verify import paths in your code");
147
+ suggestions.push("Check your tsconfig.json paths configuration");
148
+ }
149
+ // Generic fallback
150
+ else {
151
+ suggestions.push("Check the error message above for details");
152
+ suggestions.push("Verify your configuration and file paths");
153
+ suggestions.push("Try running with --verbose for more information");
154
+ }
155
+ return suggestions;
156
+ }
157
+ /**
158
+ * Format a success message
159
+ */
160
+ static formatSuccess(message) {
161
+ return `✓ ${message}`;
162
+ }
163
+ /**
164
+ * Format a warning message
165
+ */
166
+ static formatWarning(message) {
167
+ return `⚠ ${message}`;
168
+ }
169
+ /**
170
+ * Format an info message
171
+ */
172
+ static formatInfo(message) {
173
+ return `ℹ ${message}`;
174
+ }
175
+ }
176
+ exports.ErrorFormatter = ErrorFormatter;
177
+ //# sourceMappingURL=error-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-formatter.js","sourceRoot":"","sources":["../../src/utils/error-formatter.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAc;IAC1B;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAAC,KAAsB;QAClD,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,SAAS;QACT,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3B,KAAK,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C3C,YAAY,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EACxC,CAAC;YACF,WAAW,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;YAC9D,WAAW,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;YACrD,WAAW,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;YACrD,WAAW,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QAED,mBAAmB;aACd,CAAC;YACL,WAAW,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;YAC9D,WAAW,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;YAC7D,WAAW,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,WAAW,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,OAAe;QACnC,OAAO,KAAK,OAAO,EAAE,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,OAAe;QACnC,OAAO,KAAK,OAAO,EAAE,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,OAAe;QAChC,OAAO,KAAK,OAAO,EAAE,CAAC;IACvB,CAAC;CACD;AAlND,wCAkNC"}
@@ -0,0 +1,45 @@
1
+ export interface ValidationError {
2
+ type: string;
3
+ message: string;
4
+ suggestions: string[];
5
+ details?: string;
6
+ }
7
+ export declare class Validator {
8
+ /**
9
+ * Validate that a file exists
10
+ */
11
+ static validateFileExists(filePath: string): ValidationError | null;
12
+ /**
13
+ * Validate that a file has a valid TypeScript extension
14
+ */
15
+ static validateTypeScriptFile(filePath: string): ValidationError | null;
16
+ /**
17
+ * Validate that a file is readable
18
+ */
19
+ static validateFileReadable(filePath: string): ValidationError | null;
20
+ /**
21
+ * Validate that tsconfig.json exists if specified
22
+ */
23
+ static validateTsConfig(tsConfigPath: string | undefined): ValidationError | null;
24
+ /**
25
+ * Check if Graphviz is installed (required for PNG generation)
26
+ */
27
+ static validateGraphvizInstalled(format: string | undefined): ValidationError | null;
28
+ /**
29
+ * Validate entry file comprehensively
30
+ */
31
+ static validateEntryFile(filePath: string): ValidationError | null;
32
+ /**
33
+ * Validate output directory is writable
34
+ */
35
+ static validateOutputDirectory(outputPath: string): ValidationError | null;
36
+ /**
37
+ * Run all pre-flight validations
38
+ */
39
+ static runPreflightChecks(options: {
40
+ entryFile: string;
41
+ tsConfig?: string;
42
+ output?: string;
43
+ format?: string;
44
+ }): ValidationError | null;
45
+ }