@alveolus/arch 0.1.0-alpha.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/dist/bin.mjs +1 -1
- package/dist/cli-CwPCGjDg.mjs +2810 -0
- package/dist/cli-CwPCGjDg.mjs.map +1 -0
- package/dist/index.d.mts +480 -168
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/package.json +20 -3
- package/dist/cli-CW1zAnrP.mjs +0 -1229
- package/dist/cli-CW1zAnrP.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,80 +1,253 @@
|
|
|
1
1
|
import { Project } from "ts-morph";
|
|
2
|
-
//#region src/
|
|
3
|
-
type
|
|
4
|
-
|
|
2
|
+
//#region src/architecture/allowed-packages.d.ts
|
|
3
|
+
type PackageDependencies = Readonly<Record<string, true | readonly string[]>>;
|
|
4
|
+
export declare class AllowedPackages {
|
|
5
|
+
private readonly packages;
|
|
6
|
+
constructor(packages?: PackageDependencies);
|
|
7
|
+
has(packageName: string): boolean;
|
|
8
|
+
forbiddenNames(packageName: string, names: readonly string[]): readonly string[];
|
|
9
|
+
allowedNames(packageName: string): readonly string[];
|
|
10
|
+
with(other: AllowedPackages): AllowedPackages;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/conventions/core-api.d.ts
|
|
14
|
+
declare const coreKinds: readonly ["AggregateRoot", "Entity", "ValueObject", "Identifier", "DomainEvent", "DomainError", "DomainService", "Port", "CommandRepository", "QueryRepository", "CommandHandler", "QueryHandler", "EventTranslator", "EventPublisher", "Outbox", "UnitOfWork"];
|
|
15
|
+
type CoreKind = (typeof coreKinds)[number];
|
|
16
|
+
declare const coreMarkers: readonly ["OpenHostService", "AntiCorruptionLayer"];
|
|
17
|
+
type CoreMarker = (typeof coreMarkers)[number];
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/conventions/layers.d.ts
|
|
20
|
+
declare const layers: readonly ["domain", "application", "published-language", "driven", "driving"];
|
|
21
|
+
type Layer = (typeof layers)[number];
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/conventions/building-blocks.d.ts
|
|
24
|
+
interface PlaceSpec {
|
|
25
|
+
readonly layer: Layer;
|
|
26
|
+
readonly folder?: string;
|
|
27
|
+
readonly suffix?: string;
|
|
28
|
+
}
|
|
5
29
|
//#endregion
|
|
6
|
-
//#region src/
|
|
7
|
-
|
|
30
|
+
//#region src/model/classes/named-type.d.ts
|
|
31
|
+
interface NamedType {
|
|
8
32
|
readonly name: string;
|
|
33
|
+
readonly packageName: string | undefined;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/model/classes/class-type.d.ts
|
|
37
|
+
declare class ClassType {
|
|
38
|
+
readonly name: string;
|
|
39
|
+
readonly declaredIn: string | undefined;
|
|
40
|
+
readonly lineage: readonly NamedType[];
|
|
41
|
+
constructor(name: string, declaredIn: string | undefined, lineage: readonly NamedType[]);
|
|
42
|
+
get key(): string;
|
|
43
|
+
get isInstalled(): boolean;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/model/classes/heritage.d.ts
|
|
47
|
+
interface TypeArgument {
|
|
48
|
+
readonly parameter: string;
|
|
9
49
|
readonly line: number;
|
|
10
|
-
readonly
|
|
11
|
-
|
|
50
|
+
readonly types: readonly ClassType[];
|
|
51
|
+
}
|
|
52
|
+
interface Heritage {
|
|
53
|
+
readonly isByName: boolean;
|
|
54
|
+
readonly typeArguments: readonly TypeArgument[];
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/model/classes/return-shape.d.ts
|
|
58
|
+
interface ReturnShape {
|
|
59
|
+
readonly alias: NamedType | undefined;
|
|
60
|
+
readonly union: readonly NamedType[];
|
|
12
61
|
}
|
|
13
62
|
//#endregion
|
|
14
|
-
//#region src/
|
|
15
|
-
|
|
16
|
-
|
|
63
|
+
//#region src/model/classes/member.d.ts
|
|
64
|
+
type MemberKind = "field" | "constructor parameter" | "method" | "getter" | "setter";
|
|
65
|
+
type Visibility = "public" | "protected" | "private";
|
|
66
|
+
interface MemberProps {
|
|
67
|
+
readonly name: string;
|
|
17
68
|
readonly line: number;
|
|
18
|
-
readonly
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
69
|
+
readonly kind: MemberKind;
|
|
70
|
+
readonly visibility: Visibility;
|
|
71
|
+
readonly isStatic: boolean;
|
|
72
|
+
readonly isParameterProperty: boolean;
|
|
73
|
+
readonly isCallable: boolean;
|
|
74
|
+
readonly valueTypes: readonly ClassType[];
|
|
75
|
+
readonly parameterTypes: readonly ClassType[];
|
|
76
|
+
readonly returns: ReturnShape | undefined;
|
|
77
|
+
}
|
|
78
|
+
declare class Member {
|
|
79
|
+
readonly name: string;
|
|
80
|
+
readonly line: number;
|
|
81
|
+
readonly kind: MemberKind;
|
|
82
|
+
readonly visibility: Visibility;
|
|
83
|
+
readonly isStatic: boolean;
|
|
84
|
+
readonly isParameterProperty: boolean;
|
|
85
|
+
readonly isCallable: boolean;
|
|
86
|
+
readonly valueTypes: readonly ClassType[];
|
|
87
|
+
readonly parameterTypes: readonly ClassType[];
|
|
88
|
+
readonly returns: ReturnShape | undefined;
|
|
89
|
+
constructor(props: MemberProps);
|
|
90
|
+
get isPublicInstance(): boolean;
|
|
91
|
+
get isField(): boolean;
|
|
22
92
|
}
|
|
23
93
|
//#endregion
|
|
24
|
-
//#region src/
|
|
25
|
-
interface
|
|
94
|
+
//#region src/model/classes/class-declaration.d.ts
|
|
95
|
+
interface ClassDeclarationProps {
|
|
26
96
|
readonly name: string;
|
|
27
97
|
readonly line: number;
|
|
28
98
|
readonly isAbstract: boolean;
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
33
|
-
readonly publicMethods: readonly Method[];
|
|
99
|
+
readonly type: ClassType;
|
|
100
|
+
readonly heritage: Heritage | undefined;
|
|
101
|
+
readonly implemented: readonly NamedType[];
|
|
102
|
+
readonly members: readonly Member[];
|
|
34
103
|
}
|
|
35
|
-
declare class
|
|
104
|
+
declare class ClassDeclaration {
|
|
36
105
|
readonly name: string;
|
|
37
106
|
readonly line: number;
|
|
38
107
|
readonly isAbstract: boolean;
|
|
39
|
-
readonly
|
|
40
|
-
readonly
|
|
41
|
-
readonly
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
get
|
|
48
|
-
get
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
//#
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
108
|
+
readonly type: ClassType;
|
|
109
|
+
readonly heritage: Heritage | undefined;
|
|
110
|
+
readonly implemented: readonly NamedType[];
|
|
111
|
+
readonly members: readonly Member[];
|
|
112
|
+
constructor(props: ClassDeclarationProps);
|
|
113
|
+
get heldMembers(): Member[];
|
|
114
|
+
get publicSurface(): Member[];
|
|
115
|
+
get typeArguments(): readonly TypeArgument[];
|
|
116
|
+
get extendsByName(): boolean;
|
|
117
|
+
get isStaticOnly(): boolean;
|
|
118
|
+
private isDeclared;
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/model/dependencies/dependency.d.ts
|
|
122
|
+
type DependencyForm = "import" | "re-export" | "inline type" | "dynamic import" | "require" | "global";
|
|
123
|
+
type TargetVisibility = "analysed" | "ignored" | "unresolved";
|
|
124
|
+
type DependencyTarget = {
|
|
125
|
+
readonly kind: "file";
|
|
126
|
+
readonly path: string;
|
|
127
|
+
readonly visibility: TargetVisibility;
|
|
128
|
+
} | {
|
|
129
|
+
readonly kind: "package";
|
|
55
130
|
readonly name: string;
|
|
131
|
+
};
|
|
132
|
+
declare class Dependency {
|
|
56
133
|
readonly line: number;
|
|
57
|
-
|
|
134
|
+
readonly form: DependencyForm;
|
|
135
|
+
readonly specifier: string;
|
|
136
|
+
readonly names: readonly string[];
|
|
137
|
+
readonly target: DependencyTarget;
|
|
138
|
+
constructor(line: number, form: DependencyForm, specifier: string, names: readonly string[], target: DependencyTarget);
|
|
139
|
+
get label(): string;
|
|
140
|
+
isOnPackage(name: string): boolean;
|
|
58
141
|
}
|
|
59
142
|
//#endregion
|
|
60
|
-
//#region src/
|
|
61
|
-
type
|
|
143
|
+
//#region src/model/dependencies/global-use.d.ts
|
|
144
|
+
type GlobalOrigin = "ecmascript" | "host";
|
|
145
|
+
type GlobalEffect = "clock" | "randomness";
|
|
146
|
+
declare class GlobalUse {
|
|
147
|
+
readonly line: number;
|
|
148
|
+
readonly name: string;
|
|
149
|
+
readonly origin: GlobalOrigin;
|
|
150
|
+
readonly effect: GlobalEffect | undefined;
|
|
151
|
+
constructor(line: number, name: string, origin: GlobalOrigin, effect: GlobalEffect | undefined);
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/model/statements/disable-comment.d.ts
|
|
155
|
+
declare class DisableComment {
|
|
156
|
+
readonly line: number;
|
|
157
|
+
readonly text: string;
|
|
158
|
+
constructor(line: number, text: string);
|
|
159
|
+
get target(): number;
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/model/statements/throw.d.ts
|
|
163
|
+
type ThrowForm = "throw" | "Promise.reject";
|
|
164
|
+
declare class Throw {
|
|
165
|
+
readonly line: number;
|
|
166
|
+
readonly form: ThrowForm;
|
|
167
|
+
constructor(line: number, form: ThrowForm);
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/model/statements/top-level-statement.d.ts
|
|
171
|
+
type StatementKind = "function" | "enum" | "namespace" | "mutable variable" | "computed constant" | "class expression" | "statement";
|
|
172
|
+
declare class TopLevelStatement {
|
|
173
|
+
readonly kind: StatementKind;
|
|
174
|
+
readonly name: string;
|
|
175
|
+
readonly line: number;
|
|
176
|
+
constructor(kind: StatementKind, name: string, line: number);
|
|
177
|
+
}
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/model/source-file.d.ts
|
|
180
|
+
interface SourceFileProps {
|
|
181
|
+
readonly path: string;
|
|
182
|
+
readonly text: string;
|
|
183
|
+
readonly dependencies: readonly Dependency[];
|
|
184
|
+
readonly classes: readonly ClassDeclaration[];
|
|
185
|
+
readonly statements: readonly TopLevelStatement[];
|
|
186
|
+
readonly throws: readonly Throw[];
|
|
187
|
+
readonly globals: readonly GlobalUse[];
|
|
188
|
+
readonly disables: readonly DisableComment[];
|
|
189
|
+
}
|
|
190
|
+
declare class SourceFile {
|
|
191
|
+
readonly path: string;
|
|
192
|
+
readonly dependencies: readonly Dependency[];
|
|
193
|
+
readonly classes: readonly ClassDeclaration[];
|
|
194
|
+
readonly statements: readonly TopLevelStatement[];
|
|
195
|
+
readonly throws: readonly Throw[];
|
|
196
|
+
readonly globals: readonly GlobalUse[];
|
|
197
|
+
readonly disables: readonly DisableComment[];
|
|
198
|
+
private readonly lines;
|
|
199
|
+
constructor(props: SourceFileProps);
|
|
200
|
+
lineText(line: number): string;
|
|
201
|
+
disableAbove(line: number): DisableComment | undefined;
|
|
202
|
+
classNamed(name: string): ClassDeclaration | undefined;
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/model/project.d.ts
|
|
206
|
+
declare class Project$1 {
|
|
207
|
+
readonly directory: string;
|
|
208
|
+
readonly files: readonly SourceFile[];
|
|
209
|
+
private readonly filesByPath;
|
|
210
|
+
constructor(directory: string, files: readonly SourceFile[]);
|
|
211
|
+
file(path: string): SourceFile | undefined;
|
|
212
|
+
classOf(type: ClassType): ClassDeclaration | undefined;
|
|
213
|
+
relativePath(path: string): string;
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/architecture/core-api.d.ts
|
|
217
|
+
declare class CoreApi {
|
|
218
|
+
get packageName(): string;
|
|
219
|
+
kindsOf(type: ClassType): CoreKind[];
|
|
220
|
+
markersOf(implemented: readonly NamedType[]): CoreMarker[];
|
|
221
|
+
isResult(shape: ReturnShape): boolean;
|
|
222
|
+
isDomainSymbol(name: string): boolean;
|
|
223
|
+
isPublishedLanguageSymbol(name: string): boolean;
|
|
224
|
+
private isKind;
|
|
225
|
+
private isMarker;
|
|
226
|
+
private isCore;
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/architecture/paths/location.d.ts
|
|
62
230
|
type Area = "context" | "shared-kernel" | "root" | "outside";
|
|
231
|
+
type Unseen = "ignored" | "unresolved";
|
|
63
232
|
interface LocationProps {
|
|
64
233
|
readonly area: Area;
|
|
65
234
|
readonly context?: string;
|
|
66
235
|
readonly layer?: Layer;
|
|
67
236
|
readonly folder?: string;
|
|
237
|
+
readonly foldersInLayer?: readonly string[];
|
|
68
238
|
readonly fileName: string;
|
|
69
239
|
readonly isCompositionRoot?: boolean;
|
|
240
|
+
readonly unseen?: Unseen;
|
|
70
241
|
}
|
|
71
242
|
declare class Location {
|
|
72
243
|
readonly area: Area;
|
|
73
244
|
readonly context: string | undefined;
|
|
74
245
|
readonly layer: Layer | undefined;
|
|
75
246
|
readonly folder: string | undefined;
|
|
247
|
+
readonly foldersInLayer: readonly string[];
|
|
76
248
|
readonly fileName: string;
|
|
77
249
|
readonly isCompositionRoot: boolean;
|
|
250
|
+
readonly unseen: Unseen | undefined;
|
|
78
251
|
constructor(props: LocationProps);
|
|
79
252
|
get isInBoundedContext(): boolean;
|
|
80
253
|
get isInSharedKernel(): boolean;
|
|
@@ -83,174 +256,275 @@ declare class Location {
|
|
|
83
256
|
get isInLayer(): boolean;
|
|
84
257
|
isSameContextAs(other: Location): boolean;
|
|
85
258
|
isOtherBoundedContextThan(other: Location): boolean;
|
|
86
|
-
describe(): string;
|
|
87
259
|
}
|
|
88
260
|
//#endregion
|
|
89
|
-
//#region src/
|
|
90
|
-
|
|
91
|
-
readonly
|
|
92
|
-
readonly
|
|
93
|
-
readonly
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
readonly name: string;
|
|
97
|
-
};
|
|
98
|
-
declare class Import {
|
|
99
|
-
readonly line: number;
|
|
100
|
-
readonly specifier: string;
|
|
101
|
-
readonly names: readonly string[];
|
|
102
|
-
readonly target: ImportTarget;
|
|
103
|
-
constructor(line: number, specifier: string, names: readonly string[], target: ImportTarget);
|
|
104
|
-
get label(): string;
|
|
105
|
-
isFromPackage(name: string): boolean;
|
|
261
|
+
//#region src/architecture/paths/place.d.ts
|
|
262
|
+
declare class Place {
|
|
263
|
+
readonly layer: Layer;
|
|
264
|
+
readonly folder: string | undefined;
|
|
265
|
+
readonly suffix: string | undefined;
|
|
266
|
+
constructor(spec: PlaceSpec);
|
|
267
|
+
fits(location: Location): boolean;
|
|
106
268
|
}
|
|
107
269
|
//#endregion
|
|
108
|
-
//#region src/
|
|
109
|
-
interface
|
|
110
|
-
readonly
|
|
111
|
-
readonly
|
|
112
|
-
readonly imports: readonly Import[];
|
|
113
|
-
readonly classes: readonly CodeClass[];
|
|
114
|
-
readonly declarations: readonly Declaration[];
|
|
115
|
-
readonly domainErrorThrows: readonly number[];
|
|
270
|
+
//#region src/architecture/building-blocks.d.ts
|
|
271
|
+
interface MarkedPlace {
|
|
272
|
+
readonly marker: CoreMarker;
|
|
273
|
+
readonly place: Place;
|
|
116
274
|
}
|
|
117
|
-
declare class
|
|
118
|
-
readonly
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
readonly domainErrorThrows: readonly number[];
|
|
124
|
-
constructor(props: CodeFileProps);
|
|
125
|
-
declaresOpenHostService(name: string): boolean;
|
|
126
|
-
get declaresAntiCorruptionLayer(): boolean;
|
|
275
|
+
declare class BuildingBlocks {
|
|
276
|
+
private readonly core;
|
|
277
|
+
constructor(core: CoreApi);
|
|
278
|
+
placeOf(declaration: ClassDeclaration): Place | undefined;
|
|
279
|
+
markedPlacesOf(declaration: ClassDeclaration): MarkedPlace[];
|
|
280
|
+
foldersOf(layer: "domain" | "application"): readonly string[];
|
|
127
281
|
}
|
|
128
282
|
//#endregion
|
|
129
|
-
//#region src/
|
|
130
|
-
type
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
283
|
+
//#region src/architecture/context-map.d.ts
|
|
284
|
+
type Upstreams = Readonly<Record<string, readonly string[]>>;
|
|
285
|
+
declare class ContextMap {
|
|
286
|
+
private readonly upstreams;
|
|
287
|
+
constructor(upstreams: Upstreams);
|
|
288
|
+
static ofEdges(edges: readonly {
|
|
289
|
+
readonly from: string;
|
|
290
|
+
readonly to: string;
|
|
291
|
+
}[]): ContextMap;
|
|
292
|
+
get contexts(): string[];
|
|
293
|
+
allows(from: string, to: string): boolean;
|
|
294
|
+
cycle(): string[] | undefined;
|
|
295
|
+
cycleThrough(from: string, to: string): boolean;
|
|
296
|
+
private cycleFrom;
|
|
297
|
+
private reaches;
|
|
140
298
|
}
|
|
141
299
|
//#endregion
|
|
142
|
-
//#region src/
|
|
300
|
+
//#region src/architecture/layers.d.ts
|
|
301
|
+
declare class Layers {
|
|
302
|
+
isLayer(name: string): name is Layer;
|
|
303
|
+
importableFrom(layer: Exclude<Layer, "domain">): readonly Layer[];
|
|
304
|
+
}
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/architecture/settings.d.ts
|
|
143
307
|
interface ContextFolder {
|
|
144
308
|
readonly name: string;
|
|
145
309
|
readonly dir: string;
|
|
146
310
|
readonly isSharedKernel: boolean;
|
|
147
311
|
}
|
|
148
|
-
|
|
149
|
-
|
|
312
|
+
type ExtraFolders = Readonly<Partial<Record<"domain" | "application", readonly string[]>>>;
|
|
313
|
+
interface Settings {
|
|
150
314
|
readonly rootDir: string;
|
|
151
|
-
readonly compositionRoot: string;
|
|
152
|
-
readonly domainDependencies: readonly string[];
|
|
153
315
|
readonly contextFolders: readonly ContextFolder[];
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
316
|
+
readonly compositionRoot: string;
|
|
317
|
+
readonly extraFolders: ExtraFolders;
|
|
318
|
+
readonly contextMap: ContextMap | undefined;
|
|
319
|
+
readonly domainDependencies: AllowedPackages;
|
|
320
|
+
readonly applicationDependencies: AllowedPackages;
|
|
159
321
|
}
|
|
160
322
|
//#endregion
|
|
161
|
-
//#region src/
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
323
|
+
//#region src/architecture/paths/layer-shape.d.ts
|
|
324
|
+
type ShapeIssue = {
|
|
325
|
+
readonly kind: "directlyInLayer" | "tooDeep";
|
|
326
|
+
readonly layer: "domain" | "application";
|
|
327
|
+
readonly example: string;
|
|
328
|
+
} | {
|
|
329
|
+
readonly kind: "unknownFolder";
|
|
330
|
+
readonly layer: "domain" | "application";
|
|
331
|
+
readonly folder: string;
|
|
332
|
+
readonly folders: readonly string[];
|
|
333
|
+
} | {
|
|
334
|
+
readonly kind: "nestedPublishedLanguage" | "drivenWithoutTechnology" | "drivenTooDeep" | "drivingWithoutTechnology";
|
|
335
|
+
};
|
|
336
|
+
//#endregion
|
|
337
|
+
//#region src/architecture/architecture.d.ts
|
|
338
|
+
type FileTarget$1 = Extract<DependencyTarget, {
|
|
339
|
+
kind: "file";
|
|
340
|
+
}>;
|
|
341
|
+
export declare class Architecture {
|
|
342
|
+
readonly project: Project$1;
|
|
343
|
+
private readonly settings;
|
|
344
|
+
readonly core: CoreApi;
|
|
345
|
+
readonly layers: Layers;
|
|
346
|
+
readonly blocks: BuildingBlocks;
|
|
347
|
+
private readonly shape;
|
|
348
|
+
private readonly layout;
|
|
349
|
+
private readonly locations;
|
|
350
|
+
constructor(project: Project$1, settings: Settings);
|
|
351
|
+
get files(): readonly SourceFile[];
|
|
352
|
+
get domainDependencies(): AllowedPackages;
|
|
353
|
+
get applicationDependencies(): AllowedPackages;
|
|
354
|
+
get contextMap(): ContextMap | undefined;
|
|
355
|
+
locationOf(file: SourceFile): Location;
|
|
356
|
+
locationOfTarget(target: FileTarget$1): Location;
|
|
357
|
+
shapeIssueOf(location: Location): ShapeIssue | undefined;
|
|
358
|
+
relativePath(path: string): string;
|
|
359
|
+
kindsOf(subject: ClassType | ClassDeclaration): CoreKind[];
|
|
360
|
+
kindOf(subject: ClassType | ClassDeclaration): CoreKind | undefined;
|
|
361
|
+
is(subject: ClassType | ClassDeclaration, kind: CoreKind): boolean;
|
|
362
|
+
isBuildingBlock(subject: ClassType | ClassDeclaration): boolean;
|
|
363
|
+
implementsMarker(declaration: ClassDeclaration, marker: CoreMarker): boolean;
|
|
364
|
+
returnsResult(member: Member): boolean;
|
|
365
|
+
classOf(type: ClassType): ClassDeclaration | undefined;
|
|
366
|
+
private locate;
|
|
367
|
+
private typeOf;
|
|
166
368
|
}
|
|
167
369
|
//#endregion
|
|
168
|
-
//#region src/
|
|
169
|
-
|
|
370
|
+
//#region src/rules/framework/finding.d.ts
|
|
371
|
+
type FindingData = Readonly<Record<string, string | number>>;
|
|
372
|
+
interface Finding<MessageId extends string = string> {
|
|
373
|
+
readonly file: SourceFile;
|
|
374
|
+
readonly line: number;
|
|
375
|
+
readonly symbol: string;
|
|
376
|
+
readonly messageId: MessageId;
|
|
377
|
+
readonly data: FindingData;
|
|
378
|
+
}
|
|
170
379
|
//#endregion
|
|
171
|
-
//#region src/
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
380
|
+
//#region src/rules/framework/wording.d.ts
|
|
381
|
+
type FileTarget = Extract<DependencyTarget, {
|
|
382
|
+
kind: "file";
|
|
383
|
+
}>;
|
|
384
|
+
declare class Wording {
|
|
385
|
+
target(target: FileTarget, architecture: Architecture): string;
|
|
386
|
+
location(location: Location): string;
|
|
387
|
+
place(place: Place): string;
|
|
179
388
|
}
|
|
180
389
|
//#endregion
|
|
181
|
-
//#region src/
|
|
182
|
-
|
|
183
|
-
|
|
390
|
+
//#region src/rules/framework/rule.d.ts
|
|
391
|
+
interface RuleMeta<Id extends string, MessageId extends string> {
|
|
392
|
+
readonly id: Id;
|
|
393
|
+
readonly description: string;
|
|
394
|
+
readonly messages: Readonly<Record<MessageId, string>>;
|
|
395
|
+
}
|
|
396
|
+
export declare abstract class Rule<Id extends string = string, MessageId extends string = string> {
|
|
397
|
+
abstract readonly meta: RuleMeta<Id, MessageId>;
|
|
398
|
+
protected readonly wording: Wording;
|
|
399
|
+
abstract check(architecture: Architecture): Finding<MessageId>[];
|
|
400
|
+
protected finding(file: SourceFile, line: number, symbol: string, messageId: MessageId, data?: FindingData): Finding<MessageId>;
|
|
184
401
|
}
|
|
185
402
|
//#endregion
|
|
186
|
-
//#region src/
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
private readonly
|
|
190
|
-
|
|
191
|
-
constructor(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
private
|
|
195
|
-
private declarationsOf;
|
|
196
|
-
private moduleDeclarationsOf;
|
|
197
|
-
private readImport;
|
|
198
|
-
private importedNames;
|
|
199
|
-
private targetOf;
|
|
200
|
-
private packageNameOf;
|
|
201
|
-
private domainErrorThrowsOf;
|
|
202
|
-
private isInside;
|
|
403
|
+
//#region src/rules/tooling/no-loose-disable.rule.d.ts
|
|
404
|
+
type MessageId = "noRule" | "unknownRule" | "noReason" | "unused";
|
|
405
|
+
declare class NoLooseDisableRule extends Rule<"tooling/no-loose-disable", MessageId> {
|
|
406
|
+
private readonly knownRules;
|
|
407
|
+
readonly meta: RuleMeta<"tooling/no-loose-disable", MessageId>;
|
|
408
|
+
constructor(knownRules: readonly string[]);
|
|
409
|
+
check(architecture: Architecture): Finding<MessageId>[];
|
|
410
|
+
unused(file: SourceFile, comment: DisableComment): Finding<MessageId>;
|
|
411
|
+
private malformed;
|
|
203
412
|
}
|
|
204
413
|
//#endregion
|
|
205
|
-
//#region src/rules/
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
readonly
|
|
414
|
+
//#region src/rules/registry.d.ts
|
|
415
|
+
declare const ruleIds: readonly ["strategic/no-cross-context-import", "strategic/no-leaky-host-service", "strategic/no-unmapped-context", "strategic/no-fat-shared-kernel", "layers/no-impure-domain", "layers/no-outward-import", "layers/no-portless-adapter", "layers/no-driving-shortcut", "tactical/no-aggregate-reference", "tactical/no-public-field", "tactical/no-foreign-command-dependency", "tactical/no-foreign-query-dependency", "tactical/no-stateful-service", "tactical/no-thrown-failure", "tactical/no-misplaced-class", "tactical/no-loose-code", "tooling/no-loose-disable"];
|
|
416
|
+
type RuleId = (typeof ruleIds)[number];
|
|
417
|
+
export declare class RuleRegistry {
|
|
418
|
+
readonly rules: readonly Rule<RuleId>[];
|
|
419
|
+
get looseDisable(): NoLooseDisableRule;
|
|
420
|
+
get ids(): RuleId[];
|
|
210
421
|
}
|
|
211
422
|
//#endregion
|
|
212
|
-
//#region src/
|
|
423
|
+
//#region src/check/violation.d.ts
|
|
424
|
+
type Severity = "error" | "warn" | "info";
|
|
213
425
|
interface Violation {
|
|
214
426
|
readonly rule: RuleId;
|
|
427
|
+
readonly severity: Severity;
|
|
215
428
|
readonly file: string;
|
|
216
429
|
readonly line: number;
|
|
217
430
|
readonly symbol: string;
|
|
218
431
|
readonly message: string;
|
|
432
|
+
readonly fingerprint: string;
|
|
219
433
|
}
|
|
220
434
|
//#endregion
|
|
221
|
-
//#region src/
|
|
222
|
-
export declare abstract class Rule {
|
|
223
|
-
abstract readonly id: RuleId;
|
|
224
|
-
abstract check(codebase: Codebase): Violation[];
|
|
225
|
-
protected violation(codebase: Codebase, file: CodeFile, problem: Problem): Violation;
|
|
226
|
-
}
|
|
227
|
-
//#endregion
|
|
228
|
-
//#region src/rules/rules.d.ts
|
|
229
|
-
export declare class Rules {
|
|
230
|
-
static all(): Rule[];
|
|
231
|
-
}
|
|
232
|
-
//#endregion
|
|
233
|
-
//#region src/baseline/baseline.d.ts
|
|
435
|
+
//#region src/check/baseline.d.ts
|
|
234
436
|
export declare class Baseline {
|
|
235
437
|
private readonly entries;
|
|
236
438
|
static readonly fileName = "alveolus.baseline.json";
|
|
237
439
|
private constructor();
|
|
238
440
|
static of(violations: readonly Violation[]): Baseline;
|
|
239
441
|
static load(path: string): Promise<Baseline>;
|
|
442
|
+
get size(): number;
|
|
443
|
+
get outdatedEntries(): number;
|
|
240
444
|
newViolations(violations: readonly Violation[]): Violation[];
|
|
445
|
+
staleEntries(violations: readonly Violation[]): number;
|
|
446
|
+
private match;
|
|
241
447
|
save(path: string): Promise<void>;
|
|
242
448
|
private keyOf;
|
|
243
449
|
}
|
|
244
450
|
//#endregion
|
|
245
|
-
//#region src/
|
|
246
|
-
|
|
247
|
-
|
|
451
|
+
//#region src/importer/importer.d.ts
|
|
452
|
+
interface ImportScope {
|
|
453
|
+
readonly projectDir: string;
|
|
454
|
+
readonly rootDir: string;
|
|
455
|
+
isIgnored(path: string): boolean;
|
|
456
|
+
}
|
|
457
|
+
export declare abstract class Importer {
|
|
458
|
+
abstract read(scope: ImportScope): Project$1;
|
|
459
|
+
abstract resolves(packageName: string, scope: ImportScope): boolean;
|
|
460
|
+
}
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/importer/ts-morph/ts-morph-importer.d.ts
|
|
463
|
+
export declare class TsMorphImporter extends Importer {
|
|
464
|
+
private readonly sources;
|
|
465
|
+
private readonly classes;
|
|
466
|
+
private readonly statements;
|
|
467
|
+
private readonly disables;
|
|
468
|
+
private readonly throws;
|
|
469
|
+
constructor(sources: Project);
|
|
470
|
+
static fromTsConfig(tsConfigFilePath: string): TsMorphImporter;
|
|
471
|
+
resolves(packageName: string, scope: ImportScope): boolean;
|
|
472
|
+
read(scope: ImportScope): Project$1;
|
|
473
|
+
private readFile;
|
|
474
|
+
private globalUsesOf;
|
|
475
|
+
private isInside;
|
|
476
|
+
}
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/check/checker.d.ts
|
|
479
|
+
interface CheckSettings extends ImportScope, Settings {
|
|
480
|
+
severityOf(rule: RuleId): Severity | "off";
|
|
481
|
+
}
|
|
482
|
+
interface Suppressed {
|
|
483
|
+
readonly violation: Violation;
|
|
484
|
+
readonly reason: string;
|
|
485
|
+
}
|
|
486
|
+
interface CheckOutcome {
|
|
487
|
+
readonly files: number;
|
|
488
|
+
readonly violations: Violation[];
|
|
489
|
+
readonly suppressed: Suppressed[];
|
|
490
|
+
}
|
|
491
|
+
export declare class Checker {
|
|
492
|
+
private readonly importer;
|
|
248
493
|
private readonly rules;
|
|
249
|
-
|
|
250
|
-
|
|
494
|
+
private readonly fingerprint;
|
|
495
|
+
constructor(importer: Importer, rules: readonly Rule<RuleId>[]);
|
|
496
|
+
check(settings: CheckSettings): CheckOutcome;
|
|
497
|
+
run(rule: Rule<RuleId>, architecture: Architecture): Violation[];
|
|
498
|
+
private collect;
|
|
499
|
+
private collectUnusedDisables;
|
|
500
|
+
private violationOf;
|
|
501
|
+
private messageOf;
|
|
502
|
+
private fill;
|
|
251
503
|
private compare;
|
|
252
504
|
}
|
|
253
505
|
//#endregion
|
|
506
|
+
//#region src/check/report.d.ts
|
|
507
|
+
interface ReportInput {
|
|
508
|
+
readonly files: number;
|
|
509
|
+
readonly violations: readonly Violation[];
|
|
510
|
+
readonly suppressed: readonly Suppressed[];
|
|
511
|
+
readonly baselined: number;
|
|
512
|
+
readonly stale: number;
|
|
513
|
+
}
|
|
514
|
+
export declare class Report {
|
|
515
|
+
private readonly input;
|
|
516
|
+
private readonly colors;
|
|
517
|
+
constructor(input: ReportInput, colored?: boolean);
|
|
518
|
+
text(): string;
|
|
519
|
+
json(): string;
|
|
520
|
+
sarif(rules: readonly RuleMeta<string, string>[]): string;
|
|
521
|
+
private byFile;
|
|
522
|
+
private block;
|
|
523
|
+
private severity;
|
|
524
|
+
private summary;
|
|
525
|
+
private counts;
|
|
526
|
+
}
|
|
527
|
+
//#endregion
|
|
254
528
|
//#region src/cli/cli.d.ts
|
|
255
529
|
interface Output {
|
|
256
530
|
write(text: string): unknown;
|
|
@@ -266,22 +540,60 @@ export declare class Cli {
|
|
|
266
540
|
private program;
|
|
267
541
|
private withOptions;
|
|
268
542
|
private check;
|
|
543
|
+
private render;
|
|
544
|
+
private warnOutdated;
|
|
269
545
|
private baseline;
|
|
270
546
|
private analyze;
|
|
271
547
|
private fail;
|
|
272
548
|
}
|
|
273
549
|
//#endregion
|
|
274
|
-
//#region src/
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
550
|
+
//#region src/config/alveolus-config.d.ts
|
|
551
|
+
type RuleSetting = "error" | "warn" | "info" | "off";
|
|
552
|
+
interface LayoutConfig {
|
|
553
|
+
readonly extraFolders?: Readonly<Partial<Record<"domain" | "application", readonly string[]>>>;
|
|
554
|
+
}
|
|
555
|
+
interface AlveolusConfig {
|
|
556
|
+
readonly root: string;
|
|
557
|
+
readonly tsconfig?: string;
|
|
558
|
+
readonly boundedContexts: Readonly<Record<string, string>>;
|
|
559
|
+
readonly sharedKernel?: string;
|
|
560
|
+
readonly contextMap?: Upstreams;
|
|
561
|
+
readonly compositionRoot?: string;
|
|
562
|
+
readonly domainDependencies?: PackageDependencies;
|
|
563
|
+
readonly applicationDependencies?: PackageDependencies;
|
|
564
|
+
readonly ignore?: readonly string[];
|
|
565
|
+
readonly layout?: LayoutConfig;
|
|
566
|
+
readonly rules?: Readonly<Partial<Record<RuleId, RuleSetting>>>;
|
|
284
567
|
}
|
|
285
568
|
//#endregion
|
|
286
|
-
|
|
569
|
+
//#region src/config/config.d.ts
|
|
570
|
+
export declare class Config implements CheckSettings {
|
|
571
|
+
readonly projectDir: string;
|
|
572
|
+
readonly rootDir: string;
|
|
573
|
+
readonly tsConfigPath: string;
|
|
574
|
+
readonly compositionRoot: string;
|
|
575
|
+
readonly domainDependencies: AllowedPackages;
|
|
576
|
+
readonly applicationDependencies: AllowedPackages;
|
|
577
|
+
readonly contextFolders: readonly ContextFolder[];
|
|
578
|
+
readonly extraFolders: ExtraFolders;
|
|
579
|
+
readonly contextMap: ContextMap | undefined;
|
|
580
|
+
private readonly ignored;
|
|
581
|
+
private readonly rules;
|
|
582
|
+
constructor(config: AlveolusConfig, projectDir: string);
|
|
583
|
+
private validContextMap;
|
|
584
|
+
isIgnored(path: string): boolean;
|
|
585
|
+
severityOf(rule: RuleId): Severity | "off";
|
|
586
|
+
}
|
|
587
|
+
//#endregion
|
|
588
|
+
//#region src/config/config-loader.d.ts
|
|
589
|
+
export declare class ConfigLoader {
|
|
590
|
+
static readonly fileName = "alveolus.config.ts";
|
|
591
|
+
load(projectDir: string, configFile?: string): Promise<Config>;
|
|
592
|
+
private validate;
|
|
593
|
+
}
|
|
594
|
+
//#endregion
|
|
595
|
+
//#region src/config/define-config.d.ts
|
|
596
|
+
export declare function defineConfig(config: AlveolusConfig): AlveolusConfig;
|
|
597
|
+
//#endregion
|
|
598
|
+
export type { AlveolusConfig, CheckSettings, Finding, FindingData, ImportScope, PackageDependencies, RuleId, RuleMeta, RuleSetting, Settings, Violation };
|
|
287
599
|
//# sourceMappingURL=index.d.mts.map
|