eslint-plugin-obsidian 2.23.0 → 2.24.0-alph.3
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.
- package/dist/dto/callExpression.d.ts +0 -1
- package/dist/dto/callExpression.d.ts.map +1 -1
- package/dist/dto/callExpression.js +0 -3
- package/dist/dto/callExpression.js.map +1 -1
- package/dist/dto/class.d.ts +5 -5
- package/dist/dto/class.d.ts.map +1 -1
- package/dist/dto/class.js +16 -22
- package/dist/dto/class.js.map +1 -1
- package/dist/dto/decorator.d.ts +0 -2
- package/dist/dto/decorator.d.ts.map +1 -1
- package/dist/dto/decorator.js +0 -6
- package/dist/dto/decorator.js.map +1 -1
- package/dist/dto/file.d.ts +2 -13
- package/dist/dto/file.d.ts.map +1 -1
- package/dist/dto/file.js +1 -53
- package/dist/dto/file.js.map +1 -1
- package/dist/dto/method.d.ts +2 -0
- package/dist/dto/method.d.ts.map +1 -1
- package/dist/dto/method.js +6 -0
- package/dist/dto/method.js.map +1 -1
- package/dist/rules/unresolvedProviderDependencies/createRule.d.ts +2 -3
- package/dist/rules/unresolvedProviderDependencies/createRule.d.ts.map +1 -1
- package/dist/rules/unresolvedProviderDependencies/createRule.js +3 -12
- package/dist/rules/unresolvedProviderDependencies/createRule.js.map +1 -1
- package/dist/rules/unresolvedProviderDependencies/graphHandler.d.ts +6 -8
- package/dist/rules/unresolvedProviderDependencies/graphHandler.d.ts.map +1 -1
- package/dist/rules/unresolvedProviderDependencies/graphHandler.js +21 -12
- package/dist/rules/unresolvedProviderDependencies/graphHandler.js.map +1 -1
- package/dist/rules/unresolvedProviderDependencies/index.d.ts +1 -2
- package/dist/rules/unresolvedProviderDependencies/index.d.ts.map +1 -1
- package/dist/rules/unresolvedProviderDependencies/index.js +4 -4
- package/dist/rules/unresolvedProviderDependencies/index.js.map +1 -1
- package/dist/ts/adapters/classAdapter.d.ts +10 -0
- package/dist/ts/adapters/classAdapter.d.ts.map +1 -0
- package/dist/ts/adapters/classAdapter.js +27 -0
- package/dist/ts/adapters/classAdapter.js.map +1 -0
- package/dist/ts/projectRegistry.d.ts +3 -0
- package/dist/ts/projectRegistry.d.ts.map +1 -0
- package/dist/ts/projectRegistry.js +6 -0
- package/dist/ts/projectRegistry.js.map +1 -0
- package/package.json +9 -3
- package/dist/dto/classFile.d.ts +0 -10
- package/dist/dto/classFile.d.ts.map +0 -1
- package/dist/dto/classFile.js +0 -15
- package/dist/dto/classFile.js.map +0 -1
- package/dist/dto/property.d.ts +0 -7
- package/dist/dto/property.d.ts.map +0 -1
- package/dist/dto/property.js +0 -13
- package/dist/dto/property.js.map +0 -1
- package/dist/framework/fileReader.d.ts +0 -9
- package/dist/framework/fileReader.d.ts.map +0 -1
- package/dist/framework/fileReader.js +0 -68
- package/dist/framework/fileReader.js.map +0 -1
- package/dist/framework/pathResolver.d.ts +0 -4
- package/dist/framework/pathResolver.d.ts.map +0 -1
- package/dist/framework/pathResolver.js +0 -11
- package/dist/framework/pathResolver.js.map +0 -1
- package/dist/rules/unresolvedProviderDependencies/classResolver.d.ts +0 -8
- package/dist/rules/unresolvedProviderDependencies/classResolver.d.ts.map +0 -1
- package/dist/rules/unresolvedProviderDependencies/classResolver.js +0 -14
- package/dist/rules/unresolvedProviderDependencies/classResolver.js.map +0 -1
- package/dist/rules/unresolvedProviderDependencies/dependencyResolver.d.ts +0 -15
- package/dist/rules/unresolvedProviderDependencies/dependencyResolver.d.ts.map +0 -1
- package/dist/rules/unresolvedProviderDependencies/dependencyResolver.js +0 -36
- package/dist/rules/unresolvedProviderDependencies/dependencyResolver.js.map +0 -1
- package/dist/rules/unresolvedProviderDependencies/errorReporter.d.ts +0 -8
- package/dist/rules/unresolvedProviderDependencies/errorReporter.d.ts.map +0 -1
- package/dist/rules/unresolvedProviderDependencies/errorReporter.js +0 -9
- package/dist/rules/unresolvedProviderDependencies/errorReporter.js.map +0 -1
- package/dist/rules/unresolvedProviderDependencies/subgraphResolver.d.ts +0 -19
- package/dist/rules/unresolvedProviderDependencies/subgraphResolver.d.ts.map +0 -1
- package/dist/rules/unresolvedProviderDependencies/subgraphResolver.js +0 -82
- package/dist/rules/unresolvedProviderDependencies/subgraphResolver.js.map +0 -1
|
@@ -6,7 +6,6 @@ export declare class CallExpression {
|
|
|
6
6
|
constructor(node: TSESTree.CallExpression);
|
|
7
7
|
isExpression(name: string): boolean;
|
|
8
8
|
get name(): string;
|
|
9
|
-
get parent(): TSESTree.Node;
|
|
10
9
|
get arguments(): Identifier[];
|
|
11
10
|
get generics(): Generics | undefined;
|
|
12
11
|
private get callee();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callExpression.d.ts","sourceRoot":"","sources":["../../src/dto/callExpression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAa,cAAc;IACb,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc;gBAA7B,IAAI,EAAE,QAAQ,CAAC,cAAc;IAE3C,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1C,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,
|
|
1
|
+
{"version":3,"file":"callExpression.d.ts","sourceRoot":"","sources":["../../src/dto/callExpression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAa,cAAc;IACb,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc;gBAA7B,IAAI,EAAE,QAAQ,CAAC,cAAc;IAE3C,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1C,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,SAAS,IAAI,UAAU,EAAE,CAE5B;IAED,IAAI,QAAQ,yBAIX;IAED,OAAO,KAAK,MAAM,GAEjB;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callExpression.js","sourceRoot":"","sources":["../../src/dto/callExpression.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAC1C,yCAAsC;AAEtC,MAAa,cAAc;IACzB,YAAqB,IAA6B;QAA7B,SAAI,GAAJ,IAAI,CAAyB;IAAI,CAAC;IAEhD,YAAY,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;IAC5B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED,IAAI,
|
|
1
|
+
{"version":3,"file":"callExpression.js","sourceRoot":"","sources":["../../src/dto/callExpression.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAC1C,yCAAsC;AAEtC,MAAa,cAAc;IACzB,YAAqB,IAA6B;QAA7B,SAAI,GAAJ,IAAI,CAAyB;IAAI,CAAC;IAEhD,YAAY,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;IAC5B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,uBAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC9B,IAAI,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;YACvC,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACvE,CAAC;IAED,IAAY,MAAM;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,MAA6B,CAAC;IACjD,CAAC;CACF;AAxBD,wCAwBC"}
|
package/dist/dto/class.d.ts
CHANGED
|
@@ -4,15 +4,15 @@ import { Method } from './method';
|
|
|
4
4
|
export declare class Clazz {
|
|
5
5
|
node: TSESTree.ClassDeclaration;
|
|
6
6
|
constructor(node: TSESTree.ClassDeclaration);
|
|
7
|
-
get
|
|
7
|
+
get isGraph(): boolean;
|
|
8
8
|
isDecoratedWithIgnoreCase(decoratorName: string): boolean;
|
|
9
|
+
requireMethodParameter(methodName: string, parameterName: string): import("./parameter").Parameter;
|
|
10
|
+
requireMethod(name: string): Method;
|
|
11
|
+
findMethod(name: string): Method | undefined;
|
|
9
12
|
get decoratorNames(): string[];
|
|
10
13
|
get decorators(): Decorator[];
|
|
11
|
-
get superClass(): string | null;
|
|
12
14
|
get body(): TSESTree.ClassElement[];
|
|
13
|
-
mapDecoratedMethods<T>(decoratorName: string, mapper: (method: Method) => T): T[];
|
|
14
15
|
getDecoratedMethods(decoratorName: string): Method[];
|
|
15
|
-
|
|
16
|
-
get name(): string | undefined;
|
|
16
|
+
getMethods(): Method[];
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=class.d.ts.map
|
package/dist/dto/class.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../src/dto/class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../src/dto/class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,KAAK;IACG,IAAI,EAAE,QAAQ,CAAC,gBAAgB;gBAA/B,IAAI,EAAE,QAAQ,CAAC,gBAAgB;IAIlD,IAAI,OAAO,YAEV;IAEM,yBAAyB,CAAC,aAAa,EAAE,MAAM;IAI/C,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IAIhE,aAAa,CAAC,IAAI,EAAE,MAAM;IAI1B,UAAU,CAAC,IAAI,EAAE,MAAM;IAI9B,IAAI,cAAc,aAIjB;IAED,IAAI,UAAU,gBAIb;IAED,IAAI,IAAI,4BAEP;IAEM,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE;IAKpD,UAAU,IAAI,MAAM,EAAE;CAK9B"}
|
package/dist/dto/class.js
CHANGED
|
@@ -5,18 +5,26 @@ const decorator_1 = require("./decorator");
|
|
|
5
5
|
const assertions_1 = require("../utils/assertions");
|
|
6
6
|
const ast_1 = require("../utils/ast");
|
|
7
7
|
const method_1 = require("./method");
|
|
8
|
-
const identifier_1 = require("./identifier");
|
|
9
8
|
class Clazz {
|
|
10
9
|
constructor(node) {
|
|
11
10
|
this.node = node;
|
|
12
11
|
(0, assertions_1.assertDefined)(this.node);
|
|
13
12
|
}
|
|
14
|
-
get
|
|
15
|
-
return this.
|
|
13
|
+
get isGraph() {
|
|
14
|
+
return this.isDecoratedWithIgnoreCase('Graph');
|
|
16
15
|
}
|
|
17
16
|
isDecoratedWithIgnoreCase(decoratorName) {
|
|
18
17
|
return this.decoratorNames.some(name => name.toLowerCase() === decoratorName.toLowerCase());
|
|
19
18
|
}
|
|
19
|
+
requireMethodParameter(methodName, parameterName) {
|
|
20
|
+
return this.requireMethod(methodName).requireParameter(parameterName);
|
|
21
|
+
}
|
|
22
|
+
requireMethod(name) {
|
|
23
|
+
return this.findMethod(name);
|
|
24
|
+
}
|
|
25
|
+
findMethod(name) {
|
|
26
|
+
return this.getMethods().find(method => method.name === name);
|
|
27
|
+
}
|
|
20
28
|
get decoratorNames() {
|
|
21
29
|
return this.decorators.map((decorator) => {
|
|
22
30
|
return decorator.expression.callee.name;
|
|
@@ -28,31 +36,17 @@ class Clazz {
|
|
|
28
36
|
return new decorator_1.Decorator(decorator);
|
|
29
37
|
});
|
|
30
38
|
}
|
|
31
|
-
get superClass() {
|
|
32
|
-
return this.node.superClass && new identifier_1.Identifier(this.node.superClass).name;
|
|
33
|
-
}
|
|
34
39
|
get body() {
|
|
35
40
|
return this.node.body.body;
|
|
36
41
|
}
|
|
37
|
-
mapDecoratedMethods(decoratorName, mapper) {
|
|
38
|
-
return this.getDecoratedMethods(decoratorName).map(mapper);
|
|
39
|
-
}
|
|
40
42
|
getDecoratedMethods(decoratorName) {
|
|
41
|
-
return this.
|
|
42
|
-
.filter(ast_1.isMethodDefinition)
|
|
43
|
-
.map((node) => new method_1.Method(node))
|
|
43
|
+
return this.getMethods()
|
|
44
44
|
.filter(method => method.isDecoratedWithIgnoreCase(decoratorName));
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
(0, assertions_1.assertDefined)(decorator, `Decorator ${name} not found on class ${this.name}`);
|
|
51
|
-
return decorator;
|
|
52
|
-
}
|
|
53
|
-
get name() {
|
|
54
|
-
var _a;
|
|
55
|
-
return (_a = this.node.id) === null || _a === void 0 ? void 0 : _a.name;
|
|
46
|
+
getMethods() {
|
|
47
|
+
return this.body
|
|
48
|
+
.filter(ast_1.isMethodDefinition)
|
|
49
|
+
.map((node) => new method_1.Method(node));
|
|
56
50
|
}
|
|
57
51
|
}
|
|
58
52
|
exports.Clazz = Clazz;
|
package/dist/dto/class.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../src/dto/class.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AACxC,oDAAoD;AACpD,sCAAkD;AAClD,qCAAkC;
|
|
1
|
+
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../src/dto/class.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AACxC,oDAAoD;AACpD,sCAAkD;AAClD,qCAAkC;AAElC,MAAa,KAAK;IAChB,YAAmB,IAA+B;QAA/B,SAAI,GAAJ,IAAI,CAA2B;QAChD,IAAA,0BAAa,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAEM,yBAAyB,CAAC,aAAqB;QACpD,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9F,CAAC;IAEM,sBAAsB,CAAC,UAAkB,EAAE,aAAqB;QACrE,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IACxE,CAAC;IAEM,aAAa,CAAC,IAAY;QAC/B,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAE,CAAC;IAChC,CAAC;IAEM,UAAU,CAAC,IAAY;QAC5B,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAoB,EAAE,EAAE;YAClD,OAAO,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC;QAC1C,CAAC,CAAC,IAAI,EAAE,CAAC;IACX,CAAC;IAED,IAAI,UAAU;;QACZ,OAAO,CAAC,MAAA,IAAI,CAAC,IAAI,CAAC,UAAU,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,SAA6B,EAAE,EAAE;YACxE,OAAO,IAAI,qBAAS,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAC7B,CAAC;IAEM,mBAAmB,CAAC,aAAqB;QAC9C,OAAO,IAAI,CAAC,UAAU,EAAE;aACrB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,yBAAyB,CAAC,aAAa,CAAC,CAAC,CAAC;IACvE,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,IAAI;aACb,MAAM,CAAC,wBAAkB,CAAC;aAC1B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,eAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACrC,CAAC;CACF;AAnDD,sBAmDC"}
|
package/dist/dto/decorator.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { TSESTree } from '@typescript-eslint/types';
|
|
2
|
-
import { Property } from './property';
|
|
3
2
|
interface CallExpression extends TSESTree.CallExpression {
|
|
4
3
|
callee: TSESTree.Identifier;
|
|
5
4
|
}
|
|
@@ -7,7 +6,6 @@ export declare class Decorator {
|
|
|
7
6
|
private node;
|
|
8
7
|
constructor(node: TSESTree.Decorator);
|
|
9
8
|
get expression(): CallExpression;
|
|
10
|
-
getProperty(name: string): Property | undefined;
|
|
11
9
|
}
|
|
12
10
|
export {};
|
|
13
11
|
//# sourceMappingURL=decorator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../src/dto/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,
|
|
1
|
+
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../src/dto/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,UAAU,cAAe,SAAQ,QAAQ,CAAC,cAAc;IACtD,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC;CAC7B;AAED,qBAAa,SAAS;IACR,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,QAAQ,CAAC,SAAS;IAE5C,IAAI,UAAU,IACmB,cAAc,CAC9C;CACF"}
|
package/dist/dto/decorator.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Decorator = void 0;
|
|
4
|
-
const ast_1 = require("../utils/ast");
|
|
5
|
-
const property_1 = require("./property");
|
|
6
4
|
class Decorator {
|
|
7
5
|
constructor(node) {
|
|
8
6
|
this.node = node;
|
|
@@ -10,10 +8,6 @@ class Decorator {
|
|
|
10
8
|
get expression() {
|
|
11
9
|
return this.node.expression;
|
|
12
10
|
}
|
|
13
|
-
getProperty(name) {
|
|
14
|
-
const property = (0, ast_1.getDecoratorProperty)(this.node, name);
|
|
15
|
-
return property && new property_1.Property(property);
|
|
16
|
-
}
|
|
17
11
|
}
|
|
18
12
|
exports.Decorator = Decorator;
|
|
19
13
|
//# sourceMappingURL=decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../src/dto/decorator.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../src/dto/decorator.ts"],"names":[],"mappings":";;;AAMA,MAAa,SAAS;IACpB,YAAoB,IAAwB;QAAxB,SAAI,GAAJ,IAAI,CAAoB;IAAG,CAAC;IAEhD,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,UAA4B,CAAC;IAChD,CAAC;CACF;AAND,8BAMC"}
|
package/dist/dto/file.d.ts
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
import type { TSESTree } from '@typescript-eslint/types';
|
|
2
|
-
import { Clazz } from './class';
|
|
3
|
-
import { Import } from './import';
|
|
4
|
-
import { ClassFile } from './classFile';
|
|
5
2
|
import { Variable } from './variable';
|
|
6
3
|
export declare class File {
|
|
7
|
-
private program;
|
|
8
|
-
|
|
9
|
-
constructor(program: TSESTree.Program, path?: string);
|
|
10
|
-
requireGraph(name: string): Clazz;
|
|
11
|
-
private get classNodes();
|
|
4
|
+
private readonly program;
|
|
5
|
+
constructor(program: TSESTree.Program);
|
|
12
6
|
private get body();
|
|
13
|
-
toClassWithImports(): ClassFile[];
|
|
14
|
-
get imports(): Import[];
|
|
15
|
-
get graphs(): Clazz[];
|
|
16
|
-
findClass(byName: string): ClassFile | undefined;
|
|
17
|
-
private get classes();
|
|
18
7
|
get variables(): Variable[];
|
|
19
8
|
}
|
|
20
9
|
//# sourceMappingURL=file.d.ts.map
|
package/dist/dto/file.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/dto/file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/dto/file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAa,IAAI;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,QAAQ,CAAC,OAAO;IAEtD,OAAO,KAAK,IAAI,GAEf;IAED,IAAI,SAAS,eAMZ;CACF"}
|
package/dist/dto/file.js
CHANGED
|
@@ -1,67 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.File = void 0;
|
|
4
|
-
const class_1 = require("./class");
|
|
5
4
|
const ast_1 = require("../utils/ast");
|
|
6
|
-
const import_1 = require("./import");
|
|
7
|
-
const classFile_1 = require("./classFile");
|
|
8
|
-
const assertions_1 = require("../utils/assertions");
|
|
9
5
|
const variable_1 = require("./variable");
|
|
10
6
|
class File {
|
|
11
|
-
constructor(program
|
|
7
|
+
constructor(program) {
|
|
12
8
|
this.program = program;
|
|
13
|
-
this.path = path;
|
|
14
|
-
}
|
|
15
|
-
requireGraph(name) {
|
|
16
|
-
const graph = this.classNodes.find((node) => {
|
|
17
|
-
var _a;
|
|
18
|
-
return ((_a = node === null || node === void 0 ? void 0 : node.id) === null || _a === void 0 ? void 0 : _a.name) === name;
|
|
19
|
-
});
|
|
20
|
-
(0, assertions_1.assertDefined)(graph, `Graph ${name} not found in file`);
|
|
21
|
-
return new class_1.Clazz(graph);
|
|
22
|
-
}
|
|
23
|
-
get classNodes() {
|
|
24
|
-
return this.body
|
|
25
|
-
.filter(ast_1.isClassLike)
|
|
26
|
-
.map(ast_1.getClassDeclaration);
|
|
27
9
|
}
|
|
28
10
|
get body() {
|
|
29
11
|
return this.program.body;
|
|
30
12
|
}
|
|
31
|
-
toClassWithImports() {
|
|
32
|
-
return this.graphs.map((graph) => {
|
|
33
|
-
return new classFile_1.ClassFile(graph, this.imports, this.path);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
get imports() {
|
|
37
|
-
return this.body
|
|
38
|
-
.filter(ast_1.isImportDeclaration)
|
|
39
|
-
.map((node) => new import_1.Import(node));
|
|
40
|
-
}
|
|
41
|
-
get graphs() {
|
|
42
|
-
return this.body
|
|
43
|
-
.filter(ast_1.isClassLike)
|
|
44
|
-
.map((node) => {
|
|
45
|
-
const clazz = (0, ast_1.getClassDeclaration)(node);
|
|
46
|
-
return clazz && new class_1.Clazz(clazz);
|
|
47
|
-
})
|
|
48
|
-
.filter((clazz) => {
|
|
49
|
-
return clazz ? clazz.isDecoratedWithIgnoreCase('Graph') : false;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
findClass(byName) {
|
|
53
|
-
const clazz = this.classes.find(($clazz) => $clazz.name === byName);
|
|
54
|
-
return clazz && new classFile_1.ClassFile(clazz, this.imports, this.path);
|
|
55
|
-
}
|
|
56
|
-
get classes() {
|
|
57
|
-
return this.body
|
|
58
|
-
.filter(ast_1.isClassLike)
|
|
59
|
-
.map((node) => {
|
|
60
|
-
const clazz = (0, ast_1.getClassDeclaration)(node);
|
|
61
|
-
return clazz && new class_1.Clazz(clazz);
|
|
62
|
-
})
|
|
63
|
-
.filter(Boolean);
|
|
64
|
-
}
|
|
65
13
|
get variables() {
|
|
66
14
|
return this.body
|
|
67
15
|
.filter(ast_1.isVariableDeclaration)
|
package/dist/dto/file.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/dto/file.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/dto/file.ts"],"names":[],"mappings":";;;AACA,sCAAqD;AACrD,yCAAsC;AAEtC,MAAa,IAAI;IACf,YAA6B,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;IAAI,CAAC;IAE3D,IAAY,IAAI;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,IAAI;aACb,MAAM,CAAC,2BAAqB,CAAC;aAC7B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC;aAChC,IAAI,EAAE;aACN,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,mBAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC;CACF;AAdD,oBAcC"}
|
package/dist/dto/method.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export declare class Method {
|
|
|
4
4
|
readonly node: TSESTree.MethodDefinition;
|
|
5
5
|
constructor(node: TSESTree.MethodDefinition);
|
|
6
6
|
get name(): string;
|
|
7
|
+
requireParameter(name: string): Parameter;
|
|
8
|
+
findParameter(name: string): Parameter | undefined;
|
|
7
9
|
get parameters(): Parameter[];
|
|
8
10
|
isDecoratedWithIgnoreCase(decoratorName: string): boolean;
|
|
9
11
|
private get decorators();
|
package/dist/dto/method.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../src/dto/method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,MAAM;aAEW,IAAI,EAAE,QAAQ,CAAC,gBAAgB;gBAA/B,IAAI,EAAE,QAAQ,CAAC,gBAAgB;IAE3D,IAAI,IAAI,WAEP;
|
|
1
|
+
{"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../src/dto/method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,MAAM;aAEW,IAAI,EAAE,QAAQ,CAAC,gBAAgB;gBAA/B,IAAI,EAAE,QAAQ,CAAC,gBAAgB;IAE3D,IAAI,IAAI,WAEP;IAEM,gBAAgB,CAAC,IAAI,EAAE,MAAM;IAI7B,aAAa,CAAC,IAAI,EAAE,MAAM;IAIjC,IAAI,UAAU,gBAEb;IAED,yBAAyB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;IAMzD,OAAO,KAAK,UAAU,GAIrB;CACF"}
|
package/dist/dto/method.js
CHANGED
|
@@ -10,6 +10,12 @@ class Method {
|
|
|
10
10
|
get name() {
|
|
11
11
|
return this.node.key.name;
|
|
12
12
|
}
|
|
13
|
+
requireParameter(name) {
|
|
14
|
+
return this.findParameter(name);
|
|
15
|
+
}
|
|
16
|
+
findParameter(name) {
|
|
17
|
+
return this.parameters.find(param => param.name === name);
|
|
18
|
+
}
|
|
13
19
|
get parameters() {
|
|
14
20
|
return this.node.value.params.map((param) => new parameter_1.Parameter(param));
|
|
15
21
|
}
|
package/dist/dto/method.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method.js","sourceRoot":"","sources":["../../src/dto/method.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AACxC,2CAAwC;AAExC,MAAa,MAAM;IAEjB,YAA4B,IAA+B;QAA/B,SAAI,GAAJ,IAAI,CAA2B;IAAG,CAAC;IAE/D,IAAI,IAAI;QACN,OAAQ,IAAI,CAAC,IAAI,CAAC,GAA2B,CAAC,IAAI,CAAC;IACrD,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,qBAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,yBAAyB,CAAC,aAAqB;QAC7C,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;YACxC,OAAO,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC,WAAW,EAAE,CAAC;QACxF,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAY,UAAU;;QACpB,OAAO,CAAC,MAAA,IAAI,CAAC,IAAI,CAAC,UAAU,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YACpD,OAAO,IAAI,qBAAS,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC,CAAC,IAAI,EAAE,CAAC;IACX,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"method.js","sourceRoot":"","sources":["../../src/dto/method.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AACxC,2CAAwC;AAExC,MAAa,MAAM;IAEjB,YAA4B,IAA+B;QAA/B,SAAI,GAAJ,IAAI,CAA2B;IAAG,CAAC;IAE/D,IAAI,IAAI;QACN,OAAQ,IAAI,CAAC,IAAI,CAAC,GAA2B,CAAC,IAAI,CAAC;IACrD,CAAC;IAEM,gBAAgB,CAAC,IAAY;QAClC,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAE,CAAC;IACnC,CAAC;IAEM,aAAa,CAAC,IAAY;QAC/B,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAC5D,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,qBAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,yBAAyB,CAAC,aAAqB;QAC7C,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;YACxC,OAAO,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC,WAAW,EAAE,CAAC;QACxF,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAY,UAAU;;QACpB,OAAO,CAAC,MAAA,IAAI,CAAC,IAAI,CAAC,UAAU,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YACpD,OAAO,IAAI,qBAAS,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC,CAAC,IAAI,EAAE,CAAC;IACX,CAAC;CACF;AA/BD,wBA+BC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { TSESTree } from '@typescript-eslint/types';
|
|
2
2
|
import { Context } from '../../dto/context';
|
|
3
|
-
import {
|
|
4
|
-
export declare function create(context: Context,
|
|
5
|
-
ImportDeclaration(node: TSESTree.ImportDeclaration): void;
|
|
3
|
+
import { ClassAdapter } from '../../ts/adapters/classAdapter';
|
|
4
|
+
export declare function create(context: Context, classAdapter: ClassAdapter): {
|
|
6
5
|
ClassDeclaration(node: TSESTree.ClassDeclaration): void;
|
|
7
6
|
};
|
|
8
7
|
//# sourceMappingURL=createRule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRule.d.ts","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/createRule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"createRule.d.ts","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/createRule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY;2BAIxC,QAAQ,CAAC,gBAAgB;EAInD"}
|
|
@@ -3,20 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.create = create;
|
|
4
4
|
const class_1 = require("../../dto/class");
|
|
5
5
|
const graphHandler_1 = require("./graphHandler");
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const subgraphResolver_1 = require("./subgraphResolver");
|
|
9
|
-
const classResolver_1 = require("./classResolver");
|
|
10
|
-
function create(context, fileReader) {
|
|
11
|
-
const imports = [];
|
|
12
|
-
const dependencyResolver = new dependencyResolver_1.DependencyResolver(new subgraphResolver_1.SubgraphResolver(fileReader, new classResolver_1.ClassResolver(fileReader)), new classResolver_1.ClassResolver(fileReader));
|
|
13
|
-
const graphHandler = new graphHandler_1.GraphHandler(context, dependencyResolver);
|
|
6
|
+
function create(context, classAdapter) {
|
|
7
|
+
const graphHandler = new graphHandler_1.GraphHandler(context, classAdapter);
|
|
14
8
|
return {
|
|
15
|
-
ImportDeclaration(node) {
|
|
16
|
-
imports.push(new import_1.Import(node));
|
|
17
|
-
},
|
|
18
9
|
ClassDeclaration(node) {
|
|
19
|
-
graphHandler.handle(new class_1.Clazz(node)
|
|
10
|
+
graphHandler.handle(new class_1.Clazz(node));
|
|
20
11
|
},
|
|
21
12
|
};
|
|
22
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRule.js","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/createRule.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"createRule.js","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/createRule.ts"],"names":[],"mappings":";;AAMA,wBAQC;AAbD,2CAAwC;AAExC,iDAA8C;AAG9C,SAAgB,MAAM,CAAC,OAAgB,EAAE,YAA0B;IACjE,MAAM,YAAY,GAAG,IAAI,2BAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAE7D,OAAO;QACL,gBAAgB,CAAC,IAA+B;YAC9C,YAAY,CAAC,MAAM,CAAC,IAAI,aAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACvC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { Clazz } from '../../dto/class';
|
|
2
2
|
import type { Context } from '../../dto/context';
|
|
3
|
-
import
|
|
4
|
-
import type { Import } from '../../dto/import';
|
|
5
|
-
import { ResolvedDependencyChecker } from './resolvedDependencyChecker';
|
|
3
|
+
import { ClassAdapter } from '../../ts/adapters/classAdapter';
|
|
6
4
|
export declare class GraphHandler {
|
|
7
5
|
private context;
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
private
|
|
6
|
+
private classAdapter;
|
|
7
|
+
constructor(context: Context, classAdapter: ClassAdapter);
|
|
8
|
+
handle(clazz: Clazz): void;
|
|
9
|
+
private findUnresolvedDependency;
|
|
10
|
+
private reportError;
|
|
13
11
|
}
|
|
14
12
|
//# sourceMappingURL=graphHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphHandler.d.ts","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/graphHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"graphHandler.d.ts","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/graphHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG9D,qBAAa,YAAY;IACX,OAAO,CAAC,OAAO;IAAW,OAAO,CAAC,YAAY;gBAAtC,OAAO,EAAE,OAAO,EAAU,YAAY,EAAE,YAAY;IAEjE,MAAM,CAAC,KAAK,EAAE,KAAK;IAO1B,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,WAAW;CAWpB"}
|
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GraphHandler = void 0;
|
|
4
|
-
const errorReporter_1 = require("./errorReporter");
|
|
5
|
-
const resolvedDependencyChecker_1 = require("./resolvedDependencyChecker");
|
|
6
4
|
class GraphHandler {
|
|
7
|
-
constructor(context,
|
|
5
|
+
constructor(context, classAdapter) {
|
|
8
6
|
this.context = context;
|
|
9
|
-
this.
|
|
10
|
-
this.resolvedDependencyChecker = resolvedDependencyChecker;
|
|
7
|
+
this.classAdapter = classAdapter;
|
|
11
8
|
}
|
|
12
|
-
handle(clazz
|
|
13
|
-
if (
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
(0, errorReporter_1.reportErrorIfDependencyIsUnresolved)(this.context, resolvedDependenciesCheck);
|
|
9
|
+
handle(clazz) {
|
|
10
|
+
if (clazz.isGraph) {
|
|
11
|
+
const unresolvedDependency = this.findUnresolvedDependency(clazz);
|
|
12
|
+
this.reportError(this.context, clazz, unresolvedDependency);
|
|
17
13
|
}
|
|
18
14
|
}
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
findUnresolvedDependency(clazz) {
|
|
16
|
+
const graph = this.classAdapter.classToGraph(clazz.node, this.context.currentFilePath);
|
|
17
|
+
const providers = graph.resolveProviders();
|
|
18
|
+
for (const provider of graph.getProviders()) {
|
|
19
|
+
const unresolvedDep = provider.dependencies.find(dep => dep.isNotProvided(providers));
|
|
20
|
+
if (unresolvedDep)
|
|
21
|
+
return { provider, unresolvedDep };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
reportError(context, clazz, providerToUnresolvedDependency) {
|
|
25
|
+
if (providerToUnresolvedDependency) {
|
|
26
|
+
const { provider, unresolvedDep } = providerToUnresolvedDependency;
|
|
27
|
+
const parameter = clazz.requireMethodParameter(provider.name, unresolvedDep.name);
|
|
28
|
+
context.reportError(parameter.node, 'unresolved-provider-dependencies', { dependencyName: unresolvedDep.name });
|
|
29
|
+
}
|
|
21
30
|
}
|
|
22
31
|
}
|
|
23
32
|
exports.GraphHandler = GraphHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphHandler.js","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/graphHandler.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"graphHandler.js","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/graphHandler.ts"],"names":[],"mappings":";;;AAKA,MAAa,YAAY;IACvB,YAAoB,OAAgB,EAAU,YAA0B;QAApD,YAAO,GAAP,OAAO,CAAS;QAAU,iBAAY,GAAZ,YAAY,CAAc;IAAI,CAAC;IAEtE,MAAM,CAAC,KAAY;QACxB,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,oBAAoB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;YAClE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAEO,wBAAwB,CAAC,KAAY;QAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAE,CAAC;QACxF,MAAM,SAAS,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC3C,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,YAAY,EAAE,EAAE,CAAC;YAC5C,MAAM,aAAa,GAAG,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;YACtF,IAAI,aAAa;gBAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;QACxD,CAAC;IACH,CAAC;IAEO,WAAW,CACjB,OAAgB,EAChB,KAAY,EACZ,8BAA+E;QAE/E,IAAI,8BAA8B,EAAE,CAAC;YACnC,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,8BAA8B,CAAC;YACnE,MAAM,SAAS,GAAG,KAAK,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;YAClF,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,EAAE,kCAAkC,EAAE,EAAC,cAAc,EAAE,aAAa,CAAC,IAAI,EAAC,CAAC,CAAC;QAChH,CAAC;IACH,CAAC;CACF;AA9BD,oCA8BC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
|
|
3
|
-
export declare const unresolvedProviderDependenciesGenerator: (pathResolver?: PathResolver) => ESLintUtils.RuleModule<"unresolved-provider-dependencies", [], ESLintUtils.RuleListener>;
|
|
2
|
+
export declare const unresolvedProviderDependenciesGenerator: () => ESLintUtils.RuleModule<"unresolved-provider-dependencies", [], ESLintUtils.RuleListener>;
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,0BAA0B,CAAC;AAatE,eAAO,MAAM,uCAAuC,gGAmBnD,CAAC"}
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.unresolvedProviderDependenciesGenerator = void 0;
|
|
4
4
|
const utils_1 = require("@typescript-eslint/utils");
|
|
5
5
|
const createRule_1 = require("./createRule");
|
|
6
|
-
const pathResolver_1 = require("../../framework/pathResolver");
|
|
7
|
-
const fileReader_1 = require("../../framework/fileReader");
|
|
8
6
|
const context_1 = require("../../dto/context");
|
|
7
|
+
const projectRegistry_1 = require("../../ts/projectRegistry");
|
|
8
|
+
const classAdapter_1 = require("../../ts/adapters/classAdapter");
|
|
9
9
|
const createRule = utils_1.ESLintUtils.RuleCreator((name) => `https://wix-incubator.github.io/obsidian/docs/documentation/meta/eslint#${name}`);
|
|
10
|
-
const unresolvedProviderDependenciesGenerator = (
|
|
10
|
+
const unresolvedProviderDependenciesGenerator = () => {
|
|
11
11
|
return createRule({
|
|
12
12
|
create: (context) => {
|
|
13
|
-
return (0, createRule_1.create)(new context_1.Context(context), new
|
|
13
|
+
return (0, createRule_1.create)(new context_1.Context(context), new classAdapter_1.ClassAdapter(projectRegistry_1.projectRegistry));
|
|
14
14
|
},
|
|
15
15
|
name: 'unresolved-provider-dependencies',
|
|
16
16
|
meta: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/index.ts"],"names":[],"mappings":";;;AAAA,oDAAsE;AAEtE,6CAAsC;AACtC,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/index.ts"],"names":[],"mappings":";;;AAAA,oDAAsE;AAEtE,6CAAsC;AACtC,+CAA0C;AAC1C,8DAA2D;AAC3D,iEAA8D;AAI9D,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,CAAC,IAAI,EAAE,EAAE,CAAC,2EAA2E,IAAI,EAAE,CAC5F,CAAC;AAEK,MAAM,uCAAuC,GAAG,GAAG,EAAE;IAC1D,OAAO,UAAU,CAAC;QAChB,MAAM,EAAE,CAAC,OAA4D,EAAE,EAAE;YACvE,OAAO,IAAA,mBAAM,EAAC,IAAI,iBAAO,CAAC,OAAO,CAAC,EAAE,IAAI,2BAAY,CAAC,iCAAe,CAAC,CAAC,CAAC;QACzE,CAAC;QACD,IAAI,EAAE,kCAAkC;QACxC,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,WAAW,EAAE,6DAA6D;gBAC1E,WAAW,EAAE,QAAQ;aACtB;YACD,QAAQ,EAAE;gBACR,kCAAkC,EAAE,gDAAgD;aACrF;YACD,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,SAAS;SAChB;QACD,cAAc,EAAE,EAAE;KACnB,CAAgB,CAAC;AACpB,CAAC,CAAC;AAnBW,QAAA,uCAAuC,2CAmBlD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ProjectRegistry, Graph } from 'ts-morph-extensions';
|
|
2
|
+
import type { TSESTree } from '@typescript-eslint/types';
|
|
3
|
+
export declare class ClassAdapter {
|
|
4
|
+
private readonly projectRegistry;
|
|
5
|
+
constructor(projectRegistry: ProjectRegistry);
|
|
6
|
+
classToGraph(node: TSESTree.ClassDeclaration, filePath: string): Graph | undefined;
|
|
7
|
+
private topLevelClass;
|
|
8
|
+
private nestedClass;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=classAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classAdapter.d.ts","sourceRoot":"","sources":["../../../src/ts/adapters/classAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAG,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,eAAe;IAEtD,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS;IAOzF,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,WAAW;CAIpB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClassAdapter = void 0;
|
|
4
|
+
const ts_morph_extensions_1 = require("ts-morph-extensions");
|
|
5
|
+
const ts_morph_1 = require("ts-morph");
|
|
6
|
+
class ClassAdapter {
|
|
7
|
+
constructor(projectRegistry) {
|
|
8
|
+
this.projectRegistry = projectRegistry;
|
|
9
|
+
}
|
|
10
|
+
classToGraph(node, filePath) {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
if (!((_a = node.id) === null || _a === void 0 ? void 0 : _a.name))
|
|
13
|
+
return;
|
|
14
|
+
const sourceFile = this.projectRegistry.getSourceFile(filePath);
|
|
15
|
+
let clazz = (_b = this.topLevelClass(sourceFile, node.id.name)) !== null && _b !== void 0 ? _b : this.nestedClass(sourceFile, node.id.name);
|
|
16
|
+
return clazz && new ts_morph_extensions_1.Graph(clazz);
|
|
17
|
+
}
|
|
18
|
+
topLevelClass(sourceFile, className) {
|
|
19
|
+
return sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.getClass(className);
|
|
20
|
+
}
|
|
21
|
+
nestedClass(sourceFile, className) {
|
|
22
|
+
const allClasses = sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.getDescendantsOfKind(ts_morph_1.SyntaxKind.ClassDeclaration);
|
|
23
|
+
return allClasses === null || allClasses === void 0 ? void 0 : allClasses.find(c => c.getName() === className);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.ClassAdapter = ClassAdapter;
|
|
27
|
+
//# sourceMappingURL=classAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classAdapter.js","sourceRoot":"","sources":["../../../src/ts/adapters/classAdapter.ts"],"names":[],"mappings":";;;AAAA,6DAA8D;AAE9D,uCAAkD;AAElD,MAAa,YAAY;IACvB,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAI,CAAC;IAE3D,YAAY,CAAC,IAA+B,EAAE,QAAgB;;QACnE,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,EAAE,0CAAE,IAAI,CAAA;YAAE,OAAO;QAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChE,IAAI,KAAK,GAAG,MAAA,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,mCAAI,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QACvG,OAAO,KAAK,IAAI,IAAI,2BAAK,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAEO,aAAa,CAAC,UAAkC,EAAE,SAAiB;QACzE,OAAO,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAEO,WAAW,CAAC,UAAkC,EAAE,SAAiB;QACvE,MAAM,UAAU,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,oBAAoB,CAAC,qBAAU,CAAC,gBAAgB,CAAC,CAAC;QACjF,OAAO,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,SAAS,CAAC,CAAC;IAC1D,CAAC;CACF;AAlBD,oCAkBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectRegistry.d.ts","sourceRoot":"","sources":["../../src/ts/projectRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,eAAO,MAAM,eAAe,iBAAwB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.projectRegistry = void 0;
|
|
4
|
+
const ts_morph_extensions_1 = require("ts-morph-extensions");
|
|
5
|
+
exports.projectRegistry = new ts_morph_extensions_1.ProjectRegistry();
|
|
6
|
+
//# sourceMappingURL=projectRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectRegistry.js","sourceRoot":"","sources":["../../src/ts/projectRegistry.ts"],"names":[],"mappings":";;;AAAA,6DAAsD;AAEzC,QAAA,eAAe,GAAG,IAAI,qCAAe,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
"name": "eslint-plugin-obsidian",
|
|
3
3
|
"description": "ESLint rules for Obsidian",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.24.0-alph.3",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "npx tsc --project tsconfig.prod.json",
|
|
8
8
|
"test": "npx jest",
|
|
9
|
-
"lint": "eslint src --ignore-pattern '*.d.ts' --ext .ts,.tsx,.js"
|
|
9
|
+
"lint": "eslint src --ignore-pattern '*.d.ts' --ext .ts,.tsx,.js",
|
|
10
|
+
"prepublishOnly": "yarn build"
|
|
10
11
|
},
|
|
11
12
|
"author": "Orly Dadashev",
|
|
12
13
|
"files": [
|
|
@@ -22,7 +23,9 @@
|
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"@typescript-eslint/parser": "^7.18.0",
|
|
24
25
|
"@typescript-eslint/utils": "^7.18.0",
|
|
25
|
-
"lodash": "^4.17.21"
|
|
26
|
+
"lodash": "^4.17.21",
|
|
27
|
+
"ts-morph": "^25.0.1",
|
|
28
|
+
"ts-morph-extensions": "workspace:^2.24.0-alpha.3"
|
|
26
29
|
},
|
|
27
30
|
"devDependencies": {
|
|
28
31
|
"@babel/core": "7.26.10",
|
|
@@ -48,8 +51,11 @@
|
|
|
48
51
|
"eslint-plugin-import-newlines": "^1.1.5",
|
|
49
52
|
"eslint-plugin-jest-formatting": "^3.1.0",
|
|
50
53
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
54
|
+
"external-lib-a": "file:./tests/fixtures/external-lib-a",
|
|
55
|
+
"external-lib-b": "file:./tests/fixtures/external-lib-b",
|
|
51
56
|
"jest": "^29.7.0",
|
|
52
57
|
"jest-extended": "^4.0.2",
|
|
58
|
+
"react-obsidian": "workspace:*",
|
|
53
59
|
"typescript": "^5.8.0"
|
|
54
60
|
},
|
|
55
61
|
"keywords": [
|
package/dist/dto/classFile.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Clazz } from './class';
|
|
2
|
-
import type { Import } from './import';
|
|
3
|
-
export declare class ClassFile {
|
|
4
|
-
readonly clazz: Clazz;
|
|
5
|
-
readonly imports: Import[];
|
|
6
|
-
readonly path: string;
|
|
7
|
-
constructor(clazz: Clazz, imports: Import[], path: string);
|
|
8
|
-
get superClass(): string | null;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=classFile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classFile.d.ts","sourceRoot":"","sources":["../../src/dto/classFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,qBAAa,SAAS;aAGF,KAAK,EAAE,KAAK;aACZ,OAAO,EAAE,MAAM,EAAE;aACjB,IAAI,EAAE,MAAM;gBAFZ,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,MAAM;IAG9B,IAAI,UAAU,kBAEb;CACF"}
|
package/dist/dto/classFile.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClassFile = void 0;
|
|
4
|
-
class ClassFile {
|
|
5
|
-
constructor(clazz, imports, path) {
|
|
6
|
-
this.clazz = clazz;
|
|
7
|
-
this.imports = imports;
|
|
8
|
-
this.path = path;
|
|
9
|
-
}
|
|
10
|
-
get superClass() {
|
|
11
|
-
return this.clazz.superClass;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.ClassFile = ClassFile;
|
|
15
|
-
//# sourceMappingURL=classFile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classFile.js","sourceRoot":"","sources":["../../src/dto/classFile.ts"],"names":[],"mappings":";;;AAGA,MAAa,SAAS;IAEpB,YACkB,KAAY,EACZ,OAAiB,EACjB,IAAY;QAFZ,UAAK,GAAL,KAAK,CAAO;QACZ,YAAO,GAAP,OAAO,CAAU;QACjB,SAAI,GAAJ,IAAI,CAAQ;IAC3B,CAAC;IAEJ,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;IAC/B,CAAC;CACF;AAXD,8BAWC"}
|
package/dist/dto/property.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../src/dto/property.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,qBAAa,QAAQ;IACP,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,QAAQ,CAAC,QAAQ;IAE3C,QAAQ,CAAC,CAAC,KACkB,CAAC;CAE9B"}
|
package/dist/dto/property.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Property = void 0;
|
|
4
|
-
class Property {
|
|
5
|
-
constructor(node) {
|
|
6
|
-
this.node = node;
|
|
7
|
-
}
|
|
8
|
-
getValue() {
|
|
9
|
-
return this.node.value;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.Property = Property;
|
|
13
|
-
//# sourceMappingURL=property.js.map
|
package/dist/dto/property.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"property.js","sourceRoot":"","sources":["../../src/dto/property.ts"],"names":[],"mappings":";;;AAEA,MAAa,QAAQ;IACnB,YAAoB,IAAuB;QAAvB,SAAI,GAAJ,IAAI,CAAmB;IAAG,CAAC;IAE/C,QAAQ;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,KAAU,CAAC;IAC9B,CAAC;CACF;AAND,4BAMC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { PathResolver } from './pathResolver';
|
|
2
|
-
import { File } from '../dto/file';
|
|
3
|
-
export declare class FileReader {
|
|
4
|
-
private pathResolver;
|
|
5
|
-
constructor(pathResolver: PathResolver);
|
|
6
|
-
read(baseFilePath: string, relativeFilePath: string): File;
|
|
7
|
-
private parse;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=fileReader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fileReader.d.ts","sourceRoot":"","sources":["../../src/framework/fileReader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,qBAAa,UAAU;IACT,OAAO,CAAC,YAAY;gBAAZ,YAAY,EAAE,YAAY;IAEvC,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM;IAO1D,OAAO,CAAC,KAAK;CAmBd"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.FileReader = void 0;
|
|
37
|
-
const fs = __importStar(require("fs"));
|
|
38
|
-
const parser_1 = require("@typescript-eslint/parser");
|
|
39
|
-
const file_1 = require("../dto/file");
|
|
40
|
-
class FileReader {
|
|
41
|
-
constructor(pathResolver) {
|
|
42
|
-
this.pathResolver = pathResolver;
|
|
43
|
-
}
|
|
44
|
-
read(baseFilePath, relativeFilePath) {
|
|
45
|
-
const filePath = this.pathResolver.resolve(baseFilePath, relativeFilePath);
|
|
46
|
-
const fileContent = fs.readFileSync(filePath, { encoding: 'utf8' });
|
|
47
|
-
const fileAST = this.parse(fileContent, filePath);
|
|
48
|
-
return new file_1.File(fileAST, filePath);
|
|
49
|
-
}
|
|
50
|
-
parse(content, filePath) {
|
|
51
|
-
return (0, parser_1.parse)(content, {
|
|
52
|
-
ecmaVersion: 9,
|
|
53
|
-
ecmaFeatures: {
|
|
54
|
-
globalReturn: false,
|
|
55
|
-
jsx: true,
|
|
56
|
-
},
|
|
57
|
-
sourceType: 'module',
|
|
58
|
-
comment: true,
|
|
59
|
-
attachComment: true,
|
|
60
|
-
tokens: true,
|
|
61
|
-
loc: true,
|
|
62
|
-
range: true,
|
|
63
|
-
filePath,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.FileReader = FileReader;
|
|
68
|
-
//# sourceMappingURL=fileReader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fileReader.js","sourceRoot":"","sources":["../../src/framework/fileReader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,sDAAkD;AAElD,sCAAmC;AAEnC,MAAa,UAAU;IACrB,YAAoB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAI,CAAC;IAE5C,IAAI,CAAC,YAAoB,EAAE,gBAAwB;QACxD,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;QAC3E,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QACpE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAClD,OAAO,IAAI,WAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACrC,CAAC;IAEO,KAAK,CAAC,OAAe,EAAE,QAAgB;QAC7C,OAAO,IAAA,cAAK,EACV,OAAO,EACP;YACE,WAAW,EAAE,CAAC;YACd,YAAY,EAAE;gBACZ,YAAY,EAAE,KAAK;gBACnB,GAAG,EAAE,IAAI;aACV;YACD,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE,IAAI;YACb,aAAa,EAAE,IAAI;YACnB,MAAM,EAAE,IAAI;YACZ,GAAG,EAAE,IAAI;YACT,KAAK,EAAE,IAAI;YACX,QAAQ;SACT,CACF,CAAC;IACJ,CAAC;CACF;AA7BD,gCA6BC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pathResolver.d.ts","sourceRoot":"","sources":["../../src/framework/pathResolver.ts"],"names":[],"mappings":"AAEA,qBAAa,YAAY;IAChB,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM;CAG9D"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PathResolver = void 0;
|
|
4
|
-
const path = require("path");
|
|
5
|
-
class PathResolver {
|
|
6
|
-
resolve(baseFilePath, relativeFilePath) {
|
|
7
|
-
return path.resolve(path.dirname(baseFilePath), `${relativeFilePath}.ts`);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.PathResolver = PathResolver;
|
|
11
|
-
//# sourceMappingURL=pathResolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pathResolver.js","sourceRoot":"","sources":["../../src/framework/pathResolver.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAE/B,MAAa,YAAY;IAChB,OAAO,CAAC,YAAoB,EAAE,gBAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,GAAG,gBAAgB,KAAK,CAAC,CAAC;IAC5E,CAAC;CACF;AAJD,oCAIC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ClassFile } from '../../dto/classFile';
|
|
2
|
-
import type { FileReader } from '../../framework/fileReader';
|
|
3
|
-
export declare class ClassResolver {
|
|
4
|
-
private fileReader;
|
|
5
|
-
constructor(fileReader: FileReader);
|
|
6
|
-
resolve(clazz: string, from: ClassFile): ClassFile | undefined;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=classResolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classResolver.d.ts","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/classResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,qBAAa,aAAa;IACZ,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEnC,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS;CAI9C"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClassResolver = void 0;
|
|
4
|
-
class ClassResolver {
|
|
5
|
-
constructor(fileReader) {
|
|
6
|
-
this.fileReader = fileReader;
|
|
7
|
-
}
|
|
8
|
-
resolve(clazz, from) {
|
|
9
|
-
const classPath = from.imports.find(($import) => $import.includes(clazz));
|
|
10
|
-
return classPath && this.fileReader.read(from.path, classPath.path).findClass(clazz);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.ClassResolver = ClassResolver;
|
|
14
|
-
//# sourceMappingURL=classResolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classResolver.js","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/classResolver.ts"],"names":[],"mappings":";;;AAGA,MAAa,aAAa;IACxB,YAAoB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAI,CAAC;IAExC,OAAO,CAAC,KAAa,EAAE,IAAe;QAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1E,OAAO,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACvF,CAAC;CACF;AAPD,sCAOC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Import } from '../../dto/import';
|
|
2
|
-
import type { Clazz } from '../../dto/class';
|
|
3
|
-
import type { SubgraphResolver } from './subgraphResolver';
|
|
4
|
-
import type { Context } from '../../dto/context';
|
|
5
|
-
import type { ClassResolver } from './classResolver';
|
|
6
|
-
export declare class DependencyResolver {
|
|
7
|
-
private subgraphResolver;
|
|
8
|
-
private classResolver;
|
|
9
|
-
constructor(subgraphResolver: SubgraphResolver, classResolver: ClassResolver);
|
|
10
|
-
resolve(context: Context, clazz: Clazz, imports: Import[]): string[];
|
|
11
|
-
private getDependenciesFromSubgraphs;
|
|
12
|
-
private getGraphDependencies;
|
|
13
|
-
private getDependenciesFromSuperClass;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=dependencyResolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependencyResolver.d.ts","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/dependencyResolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,qBAAa,kBAAkB;IAE3B,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,aAAa;gBADb,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,aAAa;IAG/B,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE;IAShE,OAAO,CAAC,4BAA4B;IAMpC,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,6BAA6B;CAOtC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DependencyResolver = void 0;
|
|
4
|
-
const classFile_1 = require("../../dto/classFile");
|
|
5
|
-
class DependencyResolver {
|
|
6
|
-
constructor(subgraphResolver, classResolver) {
|
|
7
|
-
this.subgraphResolver = subgraphResolver;
|
|
8
|
-
this.classResolver = classResolver;
|
|
9
|
-
}
|
|
10
|
-
resolve(context, clazz, imports) {
|
|
11
|
-
const classWithImports = new classFile_1.ClassFile(clazz, imports, context.currentFilePath);
|
|
12
|
-
return [
|
|
13
|
-
...this.getGraphDependencies(classWithImports),
|
|
14
|
-
...this.getDependenciesFromSubgraphs(classWithImports),
|
|
15
|
-
...this.getDependenciesFromSuperClass(classWithImports),
|
|
16
|
-
];
|
|
17
|
-
}
|
|
18
|
-
getDependenciesFromSubgraphs(clazz) {
|
|
19
|
-
return this.subgraphResolver
|
|
20
|
-
.resolve(clazz)
|
|
21
|
-
.flatMap(this.getGraphDependencies);
|
|
22
|
-
}
|
|
23
|
-
getGraphDependencies({ clazz }) {
|
|
24
|
-
var _a;
|
|
25
|
-
return (_a = clazz.mapDecoratedMethods('Provides', (method) => method.name)) !== null && _a !== void 0 ? _a : [];
|
|
26
|
-
}
|
|
27
|
-
getDependenciesFromSuperClass(clazz) {
|
|
28
|
-
var _a, _b, _c;
|
|
29
|
-
if (!clazz.superClass || clazz.superClass === 'ObjectGraph')
|
|
30
|
-
return [];
|
|
31
|
-
return (_c = (_b = (_a = this.classResolver
|
|
32
|
-
.resolve(clazz.superClass, clazz)) === null || _a === void 0 ? void 0 : _a.clazz) === null || _b === void 0 ? void 0 : _b.mapDecoratedMethods('Provides', (method) => method.name)) !== null && _c !== void 0 ? _c : [];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.DependencyResolver = DependencyResolver;
|
|
36
|
-
//# sourceMappingURL=dependencyResolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependencyResolver.js","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/dependencyResolver.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAOhD,MAAa,kBAAkB;IAC7B,YACU,gBAAkC,EAClC,aAA4B;QAD5B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,kBAAa,GAAb,aAAa,CAAe;IAClC,CAAC;IAEE,OAAO,CAAC,OAAgB,EAAE,KAAY,EAAE,OAAiB;QAC9D,MAAM,gBAAgB,GAAG,IAAI,qBAAS,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;QAChF,OAAO;YACL,GAAG,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC;YAC9C,GAAG,IAAI,CAAC,4BAA4B,CAAC,gBAAgB,CAAC;YACtD,GAAG,IAAI,CAAC,6BAA6B,CAAC,gBAAgB,CAAC;SACxD,CAAC;IACJ,CAAC;IAEO,4BAA4B,CAAC,KAAgB;QACnD,OAAO,IAAI,CAAC,gBAAgB;aACzB,OAAO,CAAC,KAAK,CAAC;aACd,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAEO,oBAAoB,CAAC,EAAE,KAAK,EAAa;;QAC/C,OAAO,MAAA,KAAK,CAAC,mBAAmB,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC;IAC9E,CAAC;IAEO,6BAA6B,CAAC,KAAgB;;QACpD,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,KAAK,aAAa;YAAE,OAAO,EAAE,CAAC;QACvE,OAAO,MAAA,MAAA,MAAA,IAAI,CAAC,aAAa;aACtB,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,0CAC/B,KAAK,0CACL,mBAAmB,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC;IACrE,CAAC;CACF;AAhCD,gDAgCC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { TSESTree } from '@typescript-eslint/types';
|
|
2
|
-
import type { Context } from '../../dto/context';
|
|
3
|
-
export declare function reportErrorIfDependencyIsUnresolved(context: Context, { error, param, node }: {
|
|
4
|
-
error: boolean;
|
|
5
|
-
param?: string;
|
|
6
|
-
node?: TSESTree.Node;
|
|
7
|
-
}): void;
|
|
8
|
-
//# sourceMappingURL=errorReporter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errorReporter.d.ts","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/errorReporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,OAAO,EAChB,EAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAC,EAAE;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAA;CAAC,QAK7E"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reportErrorIfDependencyIsUnresolved = reportErrorIfDependencyIsUnresolved;
|
|
4
|
-
function reportErrorIfDependencyIsUnresolved(context, { error, param, node }) {
|
|
5
|
-
if (error && node) {
|
|
6
|
-
context.reportError(node, 'unresolved-provider-dependencies', { dependencyName: param });
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=errorReporter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errorReporter.js","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/errorReporter.ts"],"names":[],"mappings":";;AAGA,kFAOC;AAPD,SAAgB,mCAAmC,CACjD,OAAgB,EAChB,EAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAyD;IAE5E,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,kCAAkC,EAAE,EAAC,cAAc,EAAE,KAAK,EAAC,CAAC,CAAC;IACzF,CAAC;AACH,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ClassFile } from '../../dto/classFile';
|
|
2
|
-
import type { FileReader } from '../../framework/fileReader';
|
|
3
|
-
import { ClassResolver } from './classResolver';
|
|
4
|
-
export declare class SubgraphResolver {
|
|
5
|
-
private fileReader;
|
|
6
|
-
private classResolver;
|
|
7
|
-
constructor(fileReader: FileReader, classResolver: ClassResolver);
|
|
8
|
-
resolve(clazz: ClassFile): ClassFile[];
|
|
9
|
-
private getImportedGraphs;
|
|
10
|
-
private getImportedSubgraphClasses;
|
|
11
|
-
private getLocalGraphs;
|
|
12
|
-
private getExtendedGraphs;
|
|
13
|
-
private getSubgraphsPropertyFromGraphDecorator;
|
|
14
|
-
private getLocalSubgraphClasses;
|
|
15
|
-
private createLocalGraphClasses;
|
|
16
|
-
private getSubgraphNamesFromDecoratorProperty;
|
|
17
|
-
private getLocalGraphNames;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=subgraphResolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subgraphResolver.d.ts","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/subgraphResolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,qBAAa,gBAAgB;IACf,OAAO,CAAC,UAAU;IAAc,OAAO,CAAC,aAAa;gBAA7C,UAAU,EAAE,UAAU,EAAU,aAAa,EAAE,aAAa;IAEzE,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,EAAE;IAU7C,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,0BAA0B;IAclC,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,sCAAsC;IAM9C,OAAO,CAAC,uBAAuB;IAO/B,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,qCAAqC;IAO7C,OAAO,CAAC,kBAAkB;CAO3B"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SubgraphResolver = void 0;
|
|
4
|
-
const ast_1 = require("../../utils/ast");
|
|
5
|
-
const classFile_1 = require("../../dto/classFile");
|
|
6
|
-
const file_1 = require("../../dto/file");
|
|
7
|
-
const filter_1 = require("../../utils/filter");
|
|
8
|
-
class SubgraphResolver {
|
|
9
|
-
constructor(fileReader, classResolver) {
|
|
10
|
-
this.fileReader = fileReader;
|
|
11
|
-
this.classResolver = classResolver;
|
|
12
|
-
}
|
|
13
|
-
resolve(clazz) {
|
|
14
|
-
return [
|
|
15
|
-
...this.getImportedGraphs(clazz),
|
|
16
|
-
...this.getLocalGraphs(clazz),
|
|
17
|
-
...this.getExtendedGraphs(clazz),
|
|
18
|
-
]
|
|
19
|
-
.filter(filter_1.nonNull)
|
|
20
|
-
.flatMap((g) => [g, ...this.resolve(g)]);
|
|
21
|
-
}
|
|
22
|
-
getImportedGraphs(clazz) {
|
|
23
|
-
const subgraphs = this.getSubgraphsPropertyFromGraphDecorator(clazz);
|
|
24
|
-
return this.getImportedSubgraphClasses(clazz, subgraphs);
|
|
25
|
-
}
|
|
26
|
-
getImportedSubgraphClasses(clazz, subgraphs) {
|
|
27
|
-
if (!subgraphs)
|
|
28
|
-
return [];
|
|
29
|
-
const subgraphNames = this.getSubgraphNamesFromDecoratorProperty(subgraphs);
|
|
30
|
-
const classes = [];
|
|
31
|
-
clazz.imports.forEach(($import) => {
|
|
32
|
-
subgraphNames.forEach((subgraphName) => {
|
|
33
|
-
if ($import.includes(subgraphName)) {
|
|
34
|
-
classes.push(...this.fileReader.read(clazz.path, $import.path).toClassWithImports());
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
return classes;
|
|
39
|
-
}
|
|
40
|
-
getLocalGraphs(clazz) {
|
|
41
|
-
const subgraphs = this.getSubgraphsPropertyFromGraphDecorator(clazz);
|
|
42
|
-
return this.getLocalSubgraphClasses(subgraphs, clazz);
|
|
43
|
-
}
|
|
44
|
-
getExtendedGraphs(clazz) {
|
|
45
|
-
if (!clazz.superClass || clazz.superClass === 'ObjectGraph')
|
|
46
|
-
return [];
|
|
47
|
-
return [this.classResolver.resolve(clazz.superClass, clazz)];
|
|
48
|
-
}
|
|
49
|
-
getSubgraphsPropertyFromGraphDecorator({ clazz }) {
|
|
50
|
-
if (clazz.isAbstract)
|
|
51
|
-
return undefined;
|
|
52
|
-
const graphDecorator = clazz.requireDecoratorIgnoreCase('Graph');
|
|
53
|
-
return graphDecorator.getProperty('subgraphs');
|
|
54
|
-
}
|
|
55
|
-
getLocalSubgraphClasses(subgraphs, clazz) {
|
|
56
|
-
if (!subgraphs)
|
|
57
|
-
return [];
|
|
58
|
-
const allSubgraphs = this.getSubgraphNamesFromDecoratorProperty(subgraphs);
|
|
59
|
-
const localGraphNames = this.getLocalGraphNames(allSubgraphs, clazz);
|
|
60
|
-
return this.createLocalGraphClasses(clazz, localGraphNames);
|
|
61
|
-
}
|
|
62
|
-
createLocalGraphClasses({ clazz, imports, path }, localGraphNames) {
|
|
63
|
-
if (localGraphNames.length === 0)
|
|
64
|
-
return [];
|
|
65
|
-
const parent = new file_1.File((0, ast_1.requireProgram)(clazz.node), path);
|
|
66
|
-
return localGraphNames.map((localGraphName) => {
|
|
67
|
-
return new classFile_1.ClassFile(parent.requireGraph(localGraphName), imports, path);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
getSubgraphNamesFromDecoratorProperty(subgraphs) {
|
|
71
|
-
return (0, ast_1.mapArrayExpression)(subgraphs.getValue(), (el) => el.name);
|
|
72
|
-
}
|
|
73
|
-
getLocalGraphNames(subgraphs, { imports }) {
|
|
74
|
-
return subgraphs.filter((subgraph) => {
|
|
75
|
-
return imports.some(($import) => {
|
|
76
|
-
return $import.includes(subgraph);
|
|
77
|
-
}) === false;
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.SubgraphResolver = SubgraphResolver;
|
|
82
|
-
//# sourceMappingURL=subgraphResolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subgraphResolver.js","sourceRoot":"","sources":["../../../src/rules/unresolvedProviderDependencies/subgraphResolver.ts"],"names":[],"mappings":"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"}
|