@nexus-ioc/graph-analyzer 0.1.0 → 0.2.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 (97) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +63 -26
  3. package/dist/analyzer/circular-dependency-detector.d.ts +29 -9
  4. package/dist/analyzer/circular-dependency-detector.js +106 -63
  5. package/dist/analyzer/circular-dependency-detector.js.map +1 -1
  6. package/dist/analyzer/module-depth-analyzer.d.ts +10 -13
  7. package/dist/analyzer/module-depth-analyzer.js +40 -52
  8. package/dist/analyzer/module-depth-analyzer.js.map +1 -1
  9. package/dist/analyzer/provider-scope-analyzer.d.ts +7 -44
  10. package/dist/analyzer/provider-scope-analyzer.js +13 -84
  11. package/dist/analyzer/provider-scope-analyzer.js.map +1 -1
  12. package/dist/analyzer/unused-provider-detector.d.ts +11 -9
  13. package/dist/analyzer/unused-provider-detector.js +35 -55
  14. package/dist/analyzer/unused-provider-detector.js.map +1 -1
  15. package/dist/cli.js +34 -129
  16. package/dist/cli.js.map +1 -1
  17. package/dist/config/config-loader.js +3 -27
  18. package/dist/config/config-loader.js.map +1 -1
  19. package/dist/config/config-schema.d.ts +2 -16
  20. package/dist/config/config-schema.js +0 -18
  21. package/dist/config/config-schema.js.map +1 -1
  22. package/dist/graph/build-nexus-graph-model.d.ts +13 -0
  23. package/dist/graph/build-nexus-graph-model.js +202 -0
  24. package/dist/graph/build-nexus-graph-model.js.map +1 -0
  25. package/dist/graph/nexus-graph-model.d.ts +112 -0
  26. package/dist/graph/nexus-graph-model.js +10 -0
  27. package/dist/graph/nexus-graph-model.js.map +1 -0
  28. package/dist/graph/scope-resolution.d.ts +16 -0
  29. package/dist/graph/scope-resolution.js +46 -0
  30. package/dist/graph/scope-resolution.js.map +1 -0
  31. package/dist/index.d.ts +27 -29
  32. package/dist/index.js +34 -34
  33. package/dist/index.js.map +1 -1
  34. package/dist/interfaces/graph-output.interface.d.ts +49 -14
  35. package/dist/utils/error-formatter.js +1 -6
  36. package/dist/utils/error-formatter.js.map +1 -1
  37. package/dist/utils/validator.d.ts +0 -5
  38. package/dist/utils/validator.js +0 -60
  39. package/dist/utils/validator.js.map +1 -1
  40. package/dist/visualize/json-formatter.d.ts +5 -6
  41. package/dist/visualize/json-formatter.js +49 -47
  42. package/dist/visualize/json-formatter.js.map +1 -1
  43. package/package.json +5 -4
  44. package/dist/interfaces/providers.interface.d.ts +0 -10
  45. package/dist/interfaces/providers.interface.js +0 -3
  46. package/dist/interfaces/providers.interface.js.map +0 -1
  47. package/dist/parser/dependency-extractor.d.ts +0 -88
  48. package/dist/parser/dependency-extractor.js +0 -334
  49. package/dist/parser/dependency-extractor.js.map +0 -1
  50. package/dist/parser/parse-entry-file.d.ts +0 -15
  51. package/dist/parser/parse-entry-file.js +0 -46
  52. package/dist/parser/parse-entry-file.js.map +0 -1
  53. package/dist/parser/parse-imports.d.ts +0 -15
  54. package/dist/parser/parse-imports.js +0 -65
  55. package/dist/parser/parse-imports.js.map +0 -1
  56. package/dist/parser/parse-ns-module.d.ts +0 -39
  57. package/dist/parser/parse-ns-module.js +0 -122
  58. package/dist/parser/parse-ns-module.js.map +0 -1
  59. package/dist/parser/parse-provider.d.ts +0 -2
  60. package/dist/parser/parse-provider.js +0 -7
  61. package/dist/parser/parse-provider.js.map +0 -1
  62. package/dist/parser/parse-ts-config.d.ts +0 -10
  63. package/dist/parser/parse-ts-config.js +0 -40
  64. package/dist/parser/parse-ts-config.js.map +0 -1
  65. package/dist/parser/parser-rec.d.ts +0 -1
  66. package/dist/parser/parser-rec.js +0 -52
  67. package/dist/parser/parser-rec.js.map +0 -1
  68. package/dist/parser/parser.d.ts +0 -1
  69. package/dist/parser/parser.js +0 -61
  70. package/dist/parser/parser.js.map +0 -1
  71. package/dist/parser/provider/class-parser.d.ts +0 -20
  72. package/dist/parser/provider/class-parser.js +0 -137
  73. package/dist/parser/provider/class-parser.js.map +0 -1
  74. package/dist/parser/provider/providers-parser.d.ts +0 -9
  75. package/dist/parser/provider/providers-parser.js +0 -32
  76. package/dist/parser/provider/providers-parser.js.map +0 -1
  77. package/dist/parser/provider/use-class-parser.d.ts +0 -25
  78. package/dist/parser/provider/use-class-parser.js +0 -161
  79. package/dist/parser/provider/use-class-parser.js.map +0 -1
  80. package/dist/parser/provider/use-factory-parser.d.ts +0 -15
  81. package/dist/parser/provider/use-factory-parser.js +0 -53
  82. package/dist/parser/provider/use-factory-parser.js.map +0 -1
  83. package/dist/parser/provider/use-value-parser.d.ts +0 -13
  84. package/dist/parser/provider/use-value-parser.js +0 -41
  85. package/dist/parser/provider/use-value-parser.js.map +0 -1
  86. package/dist/parser/rules.d.ts +0 -10
  87. package/dist/parser/rules.js +0 -37
  88. package/dist/parser/rules.js.map +0 -1
  89. package/dist/visualize/generator.d.ts +0 -26
  90. package/dist/visualize/generator.js +0 -75
  91. package/dist/visualize/generator.js.map +0 -1
  92. package/dist/visualize/graph-analyzer.d.ts +0 -126
  93. package/dist/visualize/graph-analyzer.js +0 -199
  94. package/dist/visualize/graph-analyzer.js.map +0 -1
  95. package/dist/visualize/html-generator.d.ts +0 -71
  96. package/dist/visualize/html-generator.js +0 -1312
  97. package/dist/visualize/html-generator.js.map +0 -1
@@ -1,88 +0,0 @@
1
- import * as ts from "typescript";
2
- /**
3
- * Represents a dependency extracted from a class
4
- */
5
- export interface Dependency {
6
- /** Type of dependency: constructor parameter or property */
7
- type: "constructor" | "property";
8
- /** Parameter index (for constructor dependencies) */
9
- index?: number;
10
- /** Property key (for property dependencies) */
11
- key?: string;
12
- /** The dependency token (class name, string, or symbol) */
13
- token: string;
14
- /** Type of the token */
15
- tokenType: "class" | "string" | "symbol";
16
- /** Whether the dependency is optional */
17
- optional: boolean;
18
- /** Whether the dependency has an explicit @Inject decorator */
19
- hasExplicitDecorator: boolean;
20
- /** Raw AST text for debugging */
21
- raw?: string;
22
- }
23
- /**
24
- * Extracts dependency injection metadata from TypeScript class declarations
25
- * using static AST parsing (no runtime execution required)
26
- */
27
- export declare class DependencyExtractor {
28
- /**
29
- * Extract all dependencies from a class declaration
30
- * @param classDeclaration The TypeScript class declaration node
31
- * @param sourceFile The source file containing the class
32
- * @returns Array of extracted dependencies
33
- */
34
- extractDependencies(classDeclaration: ts.ClassDeclaration, sourceFile: ts.SourceFile): Dependency[];
35
- /**
36
- * Extract dependencies from constructor parameters with @Inject decorators
37
- * or from TypeScript type annotations (Reflection-based DI)
38
- */
39
- private extractConstructorDependencies;
40
- /**
41
- * Extract dependencies from class properties with @Inject decorators
42
- */
43
- private extractPropertyDependencies;
44
- /**
45
- * Extract dependencies from TC39 Stage 3 static dependencies array
46
- * Example: static dependencies = [{ index: 0, token: DatabaseService, optional: false }]
47
- */
48
- private extractStaticDependencies;
49
- /**
50
- * Parse a single static dependency object
51
- * Example: { index: 0, token: DatabaseService, optional: false }
52
- */
53
- private parseStaticDependencyObject;
54
- /**
55
- * Find the constructor in a class declaration
56
- */
57
- private findConstructor;
58
- /**
59
- * Find @Inject decorator on a parameter or property
60
- */
61
- private findInjectDecorator;
62
- /**
63
- * Check if a parameter or property has @Optional decorator
64
- */
65
- private hasOptionalDecorator;
66
- /**
67
- * Extract the token from @Inject decorator
68
- * Handles: @Inject(ClassName), @Inject('string'), @Inject(Symbol.for('key'))
69
- */
70
- private extractTokenFromDecorator;
71
- /**
72
- * Get property name from a property declaration or assignment
73
- */
74
- private getPropertyName;
75
- /**
76
- * Check if a property has static modifier
77
- */
78
- private hasStaticModifier;
79
- /**
80
- * Extract type information from a constructor parameter's type annotation
81
- * Used for Reflection-based DI when no @Inject decorator is present
82
- */
83
- private extractTypeFromParameter;
84
- /**
85
- * Check if a parameter is optional (has ? modifier or default value)
86
- */
87
- private isParameterOptional;
88
- }
@@ -1,334 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DependencyExtractor = void 0;
4
- const tslib_1 = require("tslib");
5
- const ts = tslib_1.__importStar(require("typescript"));
6
- /**
7
- * Extracts dependency injection metadata from TypeScript class declarations
8
- * using static AST parsing (no runtime execution required)
9
- */
10
- class DependencyExtractor {
11
- /**
12
- * Extract all dependencies from a class declaration
13
- * @param classDeclaration The TypeScript class declaration node
14
- * @param sourceFile The source file containing the class
15
- * @returns Array of extracted dependencies
16
- */
17
- extractDependencies(classDeclaration, sourceFile) {
18
- const dependencies = [];
19
- // Extract constructor dependencies
20
- const constructorDeps = this.extractConstructorDependencies(classDeclaration, sourceFile);
21
- dependencies.push(...constructorDeps);
22
- // Extract property dependencies
23
- const propertyDeps = this.extractPropertyDependencies(classDeclaration, sourceFile);
24
- dependencies.push(...propertyDeps);
25
- // Extract TC39 Stage 3 static dependencies (if present)
26
- const staticDeps = this.extractStaticDependencies(classDeclaration, sourceFile);
27
- if (staticDeps.length > 0) {
28
- // Static dependencies override decorator-based dependencies
29
- return staticDeps;
30
- }
31
- return dependencies;
32
- }
33
- /**
34
- * Extract dependencies from constructor parameters with @Inject decorators
35
- * or from TypeScript type annotations (Reflection-based DI)
36
- */
37
- extractConstructorDependencies(classDeclaration, sourceFile) {
38
- const dependencies = [];
39
- const constructorNode = this.findConstructor(classDeclaration);
40
- if (!constructorNode || !constructorNode.parameters) {
41
- return dependencies;
42
- }
43
- constructorNode.parameters.forEach((param, index) => {
44
- const injectDecorator = this.findInjectDecorator(param);
45
- if (injectDecorator) {
46
- // Explicit @Inject decorator found
47
- const { token, tokenType } = this.extractTokenFromDecorator(injectDecorator, sourceFile);
48
- const optional = this.hasOptionalDecorator(param);
49
- dependencies.push({
50
- type: "constructor",
51
- index,
52
- token,
53
- tokenType,
54
- optional,
55
- hasExplicitDecorator: true,
56
- raw: param.getText(sourceFile),
57
- });
58
- }
59
- else {
60
- // No @Inject decorator - try to extract from TypeScript type annotation
61
- // This supports Reflection-based DI (emitDecoratorMetadata)
62
- const typeInfo = this.extractTypeFromParameter(param, sourceFile);
63
- if (typeInfo) {
64
- const optional = this.isParameterOptional(param);
65
- dependencies.push({
66
- type: "constructor",
67
- index,
68
- token: typeInfo.token,
69
- tokenType: typeInfo.tokenType,
70
- optional,
71
- hasExplicitDecorator: false,
72
- raw: param.getText(sourceFile),
73
- });
74
- }
75
- }
76
- });
77
- return dependencies;
78
- }
79
- /**
80
- * Extract dependencies from class properties with @Inject decorators
81
- */
82
- extractPropertyDependencies(classDeclaration, sourceFile) {
83
- const dependencies = [];
84
- for (const member of classDeclaration.members) {
85
- if (!ts.isPropertyDeclaration(member)) {
86
- continue;
87
- }
88
- const injectDecorator = this.findInjectDecorator(member);
89
- if (injectDecorator) {
90
- const { token, tokenType } = this.extractTokenFromDecorator(injectDecorator, sourceFile);
91
- const optional = this.hasOptionalDecorator(member);
92
- const key = this.getPropertyName(member);
93
- if (key) {
94
- dependencies.push({
95
- type: "property",
96
- key,
97
- token,
98
- tokenType,
99
- optional,
100
- hasExplicitDecorator: true,
101
- raw: member.getText(sourceFile),
102
- });
103
- }
104
- }
105
- }
106
- return dependencies;
107
- }
108
- /**
109
- * Extract dependencies from TC39 Stage 3 static dependencies array
110
- * Example: static dependencies = [{ index: 0, token: DatabaseService, optional: false }]
111
- */
112
- extractStaticDependencies(classDeclaration, sourceFile) {
113
- const dependencies = [];
114
- for (const member of classDeclaration.members) {
115
- if (!ts.isPropertyDeclaration(member) ||
116
- !this.hasStaticModifier(member)) {
117
- continue;
118
- }
119
- const propertyName = this.getPropertyName(member);
120
- if (propertyName !== "dependencies") {
121
- continue;
122
- }
123
- // Found static dependencies property
124
- if (member.initializer &&
125
- ts.isArrayLiteralExpression(member.initializer)) {
126
- for (const element of member.initializer.elements) {
127
- if (ts.isObjectLiteralExpression(element)) {
128
- const dep = this.parseStaticDependencyObject(element, sourceFile);
129
- if (dep) {
130
- dependencies.push(dep);
131
- }
132
- }
133
- }
134
- }
135
- }
136
- return dependencies;
137
- }
138
- /**
139
- * Parse a single static dependency object
140
- * Example: { index: 0, token: DatabaseService, optional: false }
141
- */
142
- parseStaticDependencyObject(obj, sourceFile) {
143
- let index;
144
- let token;
145
- let tokenType = "class";
146
- let optional = false;
147
- for (const prop of obj.properties) {
148
- if (!ts.isPropertyAssignment(prop)) {
149
- continue;
150
- }
151
- const name = this.getPropertyName(prop);
152
- const value = prop.initializer;
153
- if (name === "index" && ts.isNumericLiteral(value)) {
154
- index = Number.parseInt(value.text, 10);
155
- }
156
- else if (name === "token") {
157
- if (ts.isIdentifier(value)) {
158
- token = value.text;
159
- tokenType = "class";
160
- }
161
- else if (ts.isStringLiteral(value)) {
162
- token = value.text;
163
- tokenType = "string";
164
- }
165
- }
166
- else if (name === "optional" &&
167
- value.kind === ts.SyntaxKind.TrueKeyword) {
168
- optional = true;
169
- }
170
- }
171
- if (index !== undefined && token) {
172
- return {
173
- type: "constructor",
174
- index,
175
- token,
176
- tokenType,
177
- optional,
178
- hasExplicitDecorator: true, // Static dependencies are explicit
179
- raw: obj.getText(sourceFile),
180
- };
181
- }
182
- return null;
183
- }
184
- /**
185
- * Find the constructor in a class declaration
186
- */
187
- findConstructor(classDeclaration) {
188
- for (const member of classDeclaration.members) {
189
- if (ts.isConstructorDeclaration(member)) {
190
- return member;
191
- }
192
- }
193
- return undefined;
194
- }
195
- /**
196
- * Find @Inject decorator on a parameter or property
197
- */
198
- findInjectDecorator(node) {
199
- if (!node.modifiers) {
200
- return undefined;
201
- }
202
- for (const modifier of node.modifiers) {
203
- if (ts.isDecorator(modifier)) {
204
- const expression = modifier.expression;
205
- if (ts.isCallExpression(expression)) {
206
- const identifier = expression.expression;
207
- if (ts.isIdentifier(identifier) && identifier.text === "Inject") {
208
- return modifier;
209
- }
210
- }
211
- }
212
- }
213
- return undefined;
214
- }
215
- /**
216
- * Check if a parameter or property has @Optional decorator
217
- */
218
- hasOptionalDecorator(node) {
219
- if (!node.modifiers) {
220
- return false;
221
- }
222
- for (const modifier of node.modifiers) {
223
- if (ts.isDecorator(modifier)) {
224
- const expression = modifier.expression;
225
- if (ts.isCallExpression(expression)) {
226
- const identifier = expression.expression;
227
- if (ts.isIdentifier(identifier) && identifier.text === "Optional") {
228
- return true;
229
- }
230
- }
231
- else if (ts.isIdentifier(expression) &&
232
- expression.text === "Optional") {
233
- return true;
234
- }
235
- }
236
- }
237
- return false;
238
- }
239
- /**
240
- * Extract the token from @Inject decorator
241
- * Handles: @Inject(ClassName), @Inject('string'), @Inject(Symbol.for('key'))
242
- */
243
- extractTokenFromDecorator(decorator, sourceFile) {
244
- const expression = decorator.expression;
245
- if (!ts.isCallExpression(expression) || expression.arguments.length === 0) {
246
- return { token: "unknown", tokenType: "class" };
247
- }
248
- const arg = expression.arguments[0];
249
- // String literal: @Inject('TOKEN')
250
- if (ts.isStringLiteral(arg)) {
251
- return { token: arg.text, tokenType: "string" };
252
- }
253
- // Identifier (class): @Inject(DatabaseService)
254
- if (ts.isIdentifier(arg)) {
255
- return { token: arg.text, tokenType: "class" };
256
- }
257
- // Symbol: @Inject(Symbol.for('key'))
258
- if (ts.isCallExpression(arg)) {
259
- const callExpr = arg;
260
- if (ts.isPropertyAccessExpression(callExpr.expression) &&
261
- ts.isIdentifier(callExpr.expression.expression) &&
262
- callExpr.expression.expression.text === "Symbol") {
263
- // Extract the symbol key
264
- if (callExpr.arguments.length > 0 &&
265
- ts.isStringLiteral(callExpr.arguments[0])) {
266
- return {
267
- token: `Symbol.for('${callExpr.arguments[0].text}')`,
268
- tokenType: "symbol",
269
- };
270
- }
271
- }
272
- }
273
- // Fallback: use the full text
274
- return { token: arg.getText(sourceFile), tokenType: "class" };
275
- }
276
- /**
277
- * Get property name from a property declaration or assignment
278
- */
279
- getPropertyName(node) {
280
- if (ts.isIdentifier(node.name)) {
281
- return node.name.text;
282
- }
283
- if (ts.isStringLiteral(node.name)) {
284
- return node.name.text;
285
- }
286
- return undefined;
287
- }
288
- /**
289
- * Check if a property has static modifier
290
- */
291
- hasStaticModifier(node) {
292
- if (!node.modifiers) {
293
- return false;
294
- }
295
- return node.modifiers.some((modifier) => modifier.kind === ts.SyntaxKind.StaticKeyword);
296
- }
297
- /**
298
- * Extract type information from a constructor parameter's type annotation
299
- * Used for Reflection-based DI when no @Inject decorator is present
300
- */
301
- extractTypeFromParameter(param, _sourceFile) {
302
- if (!param.type) {
303
- return null;
304
- }
305
- // Handle TypeReference (e.g., DatabaseService, LoggerService)
306
- if (ts.isTypeReferenceNode(param.type)) {
307
- const typeName = param.type.typeName;
308
- if (ts.isIdentifier(typeName)) {
309
- return {
310
- token: typeName.text,
311
- tokenType: "class",
312
- };
313
- }
314
- }
315
- // Handle other type nodes if needed
316
- return null;
317
- }
318
- /**
319
- * Check if a parameter is optional (has ? modifier or default value)
320
- */
321
- isParameterOptional(param) {
322
- // Check for ? modifier (e.g., param?: Type)
323
- if (param.questionToken) {
324
- return true;
325
- }
326
- // Check for default value (e.g., param = defaultValue)
327
- if (param.initializer) {
328
- return true;
329
- }
330
- return false;
331
- }
332
- }
333
- exports.DependencyExtractor = DependencyExtractor;
334
- //# sourceMappingURL=dependency-extractor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dependency-extractor.js","sourceRoot":"","sources":["../../src/parser/dependency-extractor.ts"],"names":[],"mappings":";;;;AAAA,uDAAiC;AAwBjC;;;GAGG;AACH,MAAa,mBAAmB;IAC/B;;;;;OAKG;IACI,mBAAmB,CACzB,gBAAqC,EACrC,UAAyB;QAEzB,MAAM,YAAY,GAAiB,EAAE,CAAC;QAEtC,mCAAmC;QACnC,MAAM,eAAe,GAAG,IAAI,CAAC,8BAA8B,CAC1D,gBAAgB,EAChB,UAAU,CACV,CAAC;QACF,YAAY,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC;QAEtC,gCAAgC;QAChC,MAAM,YAAY,GAAG,IAAI,CAAC,2BAA2B,CACpD,gBAAgB,EAChB,UAAU,CACV,CAAC;QACF,YAAY,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;QAEnC,wDAAwD;QACxD,MAAM,UAAU,GAAG,IAAI,CAAC,yBAAyB,CAChD,gBAAgB,EAChB,UAAU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8B,EAC9B,WAA0B;QAE1B,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YACjB,OAAO,IAAI,CAAC;QACb,CAAC;QAED,8DAA8D;QAC9D,IAAI,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACxC,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;YACrC,IAAI,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/B,OAAO;oBACN,KAAK,EAAE,QAAQ,CAAC,IAAI;oBACpB,SAAS,EAAE,OAAO;iBAClB,CAAC;YACH,CAAC;QACF,CAAC;QAED,oCAAoC;QACpC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;OAEG;IACK,mBAAmB,CAAC,KAA8B;QACzD,4CAA4C;QAC5C,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QACb,CAAC;QAED,uDAAuD;QACvD,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC;QACb,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AAzaD,kDAyaC"}
@@ -1,15 +0,0 @@
1
- import type * as ts from "typescript";
2
- import type { ParseTsConfig } from "./parse-ts-config";
3
- export declare class ParseEntryFile {
4
- private readonly sourceFile;
5
- private readonly _currentFilePath;
6
- private readonly tsConfig;
7
- private readonly _imports;
8
- private _name;
9
- constructor(sourceFile: ts.SourceFile, _currentFilePath: string, tsConfig: ParseTsConfig);
10
- parse(): string;
11
- private findNsModulesImports;
12
- get filePath(): string;
13
- get imports(): string[];
14
- get name(): string | null;
15
- }
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ParseEntryFile = void 0;
4
- const tsquery_1 = require("@phenomnomnominal/tsquery");
5
- const parse_imports_1 = require("./parse-imports");
6
- class ParseEntryFile {
7
- constructor(sourceFile, _currentFilePath, tsConfig) {
8
- this.sourceFile = sourceFile;
9
- this._currentFilePath = _currentFilePath;
10
- this.tsConfig = tsConfig;
11
- this._imports = [];
12
- this._name = null;
13
- }
14
- parse() {
15
- const sourceText = this.sourceFile.text;
16
- const nodes = (0, tsquery_1.query)((0, tsquery_1.ast)(sourceText), "CallExpression");
17
- let entryModule = null;
18
- for (const node of nodes) {
19
- const text = node.getText();
20
- const match = text.match(/\.create\((\w+)\)/);
21
- if (match) {
22
- entryModule = match[1];
23
- }
24
- }
25
- if (!entryModule) {
26
- throw new Error("No entry module");
27
- }
28
- this._name = entryModule;
29
- this._imports.push(...this.findNsModulesImports([entryModule]));
30
- return entryModule;
31
- }
32
- findNsModulesImports(imports) {
33
- return new parse_imports_1.ParseImports(this.sourceFile, this._currentFilePath, this.tsConfig).findAllNsModuleImports(imports);
34
- }
35
- get filePath() {
36
- return this._currentFilePath;
37
- }
38
- get imports() {
39
- return this._imports;
40
- }
41
- get name() {
42
- return this._name;
43
- }
44
- }
45
- exports.ParseEntryFile = ParseEntryFile;
46
- //# sourceMappingURL=parse-entry-file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-entry-file.js","sourceRoot":"","sources":["../../src/parser/parse-entry-file.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AAEvD,mDAA+C;AAG/C,MAAa,cAAc;IAI1B,YACkB,UAAyB,EACzB,gBAAwB,EACxB,QAAuB;QAFvB,eAAU,GAAV,UAAU,CAAe;QACzB,qBAAgB,GAAhB,gBAAgB,CAAQ;QACxB,aAAQ,GAAR,QAAQ,CAAe;QANxB,aAAQ,GAAa,EAAE,CAAC;QACjC,UAAK,GAAkB,IAAI,CAAC;IAMjC,CAAC;IAEJ,KAAK;QACJ,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QACxC,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,IAAA,aAAG,EAAC,UAAU,CAAC,EAAE,gBAAgB,CAAC,CAAC;QACvD,IAAI,WAAW,GAAkB,IAAI,CAAC;QAEtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;YAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;YAE9C,IAAI,KAAK,EAAE,CAAC;gBACX,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACxB,CAAC;QACF,CAAC;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACpC,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC;QACzB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,oBAAoB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAEhE,OAAO,WAAW,CAAC;IACpB,CAAC;IAEO,oBAAoB,CAAC,OAAiB;QAC7C,OAAO,IAAI,4BAAY,CACtB,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,QAAQ,CACb,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,QAAQ;QACX,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC9B,CAAC;IAED,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAED,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;CACD;AArDD,wCAqDC"}
@@ -1,15 +0,0 @@
1
- import * as ts from "typescript";
2
- import type { ParseTsConfig } from "./parse-ts-config";
3
- export declare class ParseImports {
4
- readonly sourceFile: ts.SourceFile;
5
- private readonly currentFilePath;
6
- private readonly tsConfig;
7
- private readonly nsModuleImportPattern;
8
- private readonly ast;
9
- constructor(sourceFile: ts.SourceFile, currentFilePath: string, tsConfig: ParseTsConfig);
10
- findAllNsModuleImports(moduleDeps: string[]): string[];
11
- private isRelativeImport;
12
- private checkExtension;
13
- private checkFilePath;
14
- parse(): void;
15
- }
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ParseImports = void 0;
4
- const tslib_1 = require("tslib");
5
- const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
6
- const node_path_1 = tslib_1.__importDefault(require("node:path"));
7
- const tsquery_1 = require("@phenomnomnominal/tsquery");
8
- const ts = tslib_1.__importStar(require("typescript"));
9
- const extensions = ["ts", "tsx"];
10
- class ParseImports {
11
- constructor(sourceFile, currentFilePath, tsConfig) {
12
- this.sourceFile = sourceFile;
13
- this.currentFilePath = currentFilePath;
14
- this.tsConfig = tsConfig;
15
- this.nsModuleImportPattern = (moduleName) => `ImportDeclaration:has(NamedImports:has(ImportSpecifier:has(Identifier[name="${moduleName}"])))`;
16
- this.ast = (0, tsquery_1.ast)(sourceFile.text);
17
- }
18
- findAllNsModuleImports(moduleDeps) {
19
- const moduleImports = [];
20
- for (const moduleName of moduleDeps) {
21
- const [moduleImport] = (0, tsquery_1.query)(this.ast, this.nsModuleImportPattern(moduleName)) || [];
22
- if (!moduleImport) {
23
- throw new Error(`"${moduleName}" module import not found in "${this.currentFilePath}"`);
24
- }
25
- if (!(ts.isImportDeclaration(moduleImport) &&
26
- ts.isStringLiteral(moduleImport.moduleSpecifier))) {
27
- throw new Error(`Module ${moduleImport} not correct in ${this.currentFilePath}`);
28
- }
29
- const actualPath = this.checkFilePath(moduleImport.moduleSpecifier.text, this.currentFilePath);
30
- const importPath = node_path_1.default.resolve(node_path_1.default.dirname(this.currentFilePath), actualPath);
31
- moduleImports.push(importPath);
32
- }
33
- return moduleImports;
34
- }
35
- isRelativeImport(path) {
36
- return path.startsWith(".");
37
- }
38
- checkExtension(importPath, baseDir) {
39
- for (const extension of extensions) {
40
- const importTSFilePath = node_path_1.default.resolve(baseDir, `${importPath}.${extension}`);
41
- const importIndexFilePath = node_path_1.default.resolve(baseDir, importPath, `index.${extension}`);
42
- if (node_fs_1.default.existsSync(importTSFilePath)) {
43
- return importTSFilePath;
44
- }
45
- if (node_fs_1.default.existsSync(importIndexFilePath)) {
46
- return importIndexFilePath;
47
- }
48
- }
49
- return importPath;
50
- }
51
- checkFilePath(importPath, currentFilePath) {
52
- if (this.isRelativeImport(importPath)) {
53
- if (extensions.find((extension) => importPath.endsWith(`.${extension}`))) {
54
- return importPath;
55
- }
56
- const baseDir = node_path_1.default.dirname(currentFilePath);
57
- return this.checkExtension(importPath, baseDir);
58
- }
59
- const basePath = this.tsConfig.getSrcBasePath();
60
- return this.checkExtension(this.tsConfig.resolveAliasPath(importPath), basePath);
61
- }
62
- parse() { }
63
- }
64
- exports.ParseImports = ParseImports;
65
- //# sourceMappingURL=parse-imports.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-imports.js","sourceRoot":"","sources":["../../src/parser/parse-imports.ts"],"names":[],"mappings":";;;;AAAA,8DAAyB;AACzB,kEAA6B;AAC7B,uDAAuD;AACvD,uDAAiC;AAGjC,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAEjC,MAAa,YAAY;IAKxB,YACU,UAAyB,EACjB,eAAuB,EACvB,QAAuB;QAF/B,eAAU,GAAV,UAAU,CAAe;QACjB,oBAAe,GAAf,eAAe,CAAQ;QACvB,aAAQ,GAAR,QAAQ,CAAe;QAPxB,0BAAqB,GAAG,CAAC,UAAkB,EAAE,EAAE,CAC/D,+EAA+E,UAAU,OAAO,CAAC;QAQjG,IAAI,CAAC,GAAG,GAAG,IAAA,aAAG,EAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAEM,sBAAsB,CAAC,UAAoB;QACjD,MAAM,aAAa,GAAa,EAAE,CAAC;QAEnC,KAAK,MAAM,UAAU,IAAI,UAAU,EAAE,CAAC;YACrC,MAAM,CAAC,YAAY,CA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gBAAgB,CAAC,EAAE,CAAC;gBACrC,OAAO,gBAAgB,CAAC;YACzB,CAAC;YAED,IAAI,iBAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,CAAC;gBACxC,OAAO,mBAAmB,CAAC;YAC5B,CAAC;QACF,CAAC;QAED,OAAO,UAAU,CAAC;IACnB,CAAC;IAEO,aAAa,CAAC,UAAkB,EAAE,eAAuB;QAChE,IAAI,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,CAAC;YACvC,IACC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,EACnE,CAAC;gBACF,OAAO,UAAU,CAAC;YACnB,CAAC;YAED,MAAM,OAAO,GAAG,mBAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;YAE9C,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACjD,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC;QAEhD,OAAO,IAAI,CAAC,cAAc,CACzB,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAC1C,QAAQ,CACR,CAAC;IACH,CAAC;IAEM,KAAK,KAAI,CAAC;CACjB;AAtGD,oCAsGC"}
@@ -1,39 +0,0 @@
1
- import * as ts from "typescript";
2
- import type { ProvidersInterface } from "../interfaces/providers.interface";
3
- import type { ParseTsConfig } from "./parse-ts-config";
4
- type NsModuleArgs = {
5
- imports: string[];
6
- exports: string[];
7
- providers: string[];
8
- };
9
- export declare class ParseNsModule {
10
- private readonly sourceFile;
11
- private readonly _currentFilePath;
12
- private readonly tsConfig;
13
- private readonly classNodeWithNsModuleDecorator;
14
- private readonly classNodeWithGlobalDecorator;
15
- private readonly ast;
16
- private readonly _imports;
17
- private readonly _providers;
18
- private readonly _exports;
19
- private readonly _deps;
20
- private _name;
21
- private _isGlobal;
22
- private readonly _modules;
23
- constructor(sourceFile: ts.SourceFile, _currentFilePath: string, tsConfig: ParseTsConfig);
24
- private findNsModulesImports;
25
- private findClassWithNsModule;
26
- private parseNsModuleProperties;
27
- private parseProviders;
28
- private isNsModuleGlobal;
29
- parse(): void;
30
- get imports(): string[];
31
- get modules(): Map<string, NsModuleArgs>;
32
- get providers(): ProvidersInterface[];
33
- get exports(): string[];
34
- get deps(): string[];
35
- get filePath(): string;
36
- get name(): string | null;
37
- get isGlobal(): boolean;
38
- }
39
- export {};