@alveolus/arch 0.1.0-alpha.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +42 -0
- package/dist/bin.mjs +1 -1
- package/dist/cli-P5PwH9OE.mjs +2874 -0
- package/dist/cli-P5PwH9OE.mjs.map +1 -0
- package/dist/index.d.mts +500 -176
- 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,256 +1,540 @@
|
|
|
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[];
|
|
12
55
|
}
|
|
13
56
|
//#endregion
|
|
14
|
-
//#region src/
|
|
15
|
-
|
|
16
|
-
readonly
|
|
57
|
+
//#region src/model/classes/return-shape.d.ts
|
|
58
|
+
interface ReturnShape {
|
|
59
|
+
readonly alias: NamedType | undefined;
|
|
60
|
+
readonly union: readonly NamedType[];
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
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;
|
|
68
|
+
readonly line: number;
|
|
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;
|
|
17
80
|
readonly line: number;
|
|
18
|
-
readonly
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 {
|
|
133
|
+
readonly line: number;
|
|
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;
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
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 {
|
|
56
156
|
readonly line: number;
|
|
57
|
-
|
|
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;
|
|
58
203
|
}
|
|
59
204
|
//#endregion
|
|
60
|
-
//#region src/
|
|
61
|
-
|
|
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/context-map.d.ts
|
|
230
|
+
type Upstreams = Readonly<Record<string, readonly string[]>>;
|
|
231
|
+
declare class ContextMap {
|
|
232
|
+
private readonly upstreams;
|
|
233
|
+
constructor(upstreams: Upstreams);
|
|
234
|
+
static ofEdges(edges: readonly {
|
|
235
|
+
readonly from: string;
|
|
236
|
+
readonly to: string;
|
|
237
|
+
}[]): ContextMap;
|
|
238
|
+
get contexts(): string[];
|
|
239
|
+
allows(from: string, to: string): boolean;
|
|
240
|
+
cycle(): string[] | undefined;
|
|
241
|
+
cycleThrough(from: string, to: string): boolean;
|
|
242
|
+
private cycleFrom;
|
|
243
|
+
private reaches;
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/architecture/settings.d.ts
|
|
247
|
+
type SubdomainType = "core" | "supporting" | "generic";
|
|
248
|
+
type Subdomains = Readonly<Partial<Record<SubdomainType, readonly string[]>>>;
|
|
249
|
+
interface ContextFolder {
|
|
250
|
+
readonly name: string;
|
|
251
|
+
readonly dir: string;
|
|
252
|
+
readonly isSharedKernel: boolean;
|
|
253
|
+
readonly subdomain?: SubdomainType;
|
|
254
|
+
}
|
|
255
|
+
type ExtraFolders = Readonly<Partial<Record<"domain" | "application", readonly string[]>>>;
|
|
256
|
+
interface Settings {
|
|
257
|
+
readonly rootDir: string;
|
|
258
|
+
readonly contextFolders: readonly ContextFolder[];
|
|
259
|
+
readonly compositionRoot: string;
|
|
260
|
+
readonly extraFolders: ExtraFolders;
|
|
261
|
+
readonly contextMap: ContextMap | undefined;
|
|
262
|
+
readonly domainDependencies: AllowedPackages;
|
|
263
|
+
readonly applicationDependencies: AllowedPackages;
|
|
264
|
+
}
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/architecture/paths/location.d.ts
|
|
62
267
|
type Area = "context" | "shared-kernel" | "root" | "outside";
|
|
268
|
+
type Unseen = "ignored" | "unresolved";
|
|
63
269
|
interface LocationProps {
|
|
64
270
|
readonly area: Area;
|
|
65
271
|
readonly context?: string;
|
|
272
|
+
readonly subdomain?: SubdomainType;
|
|
66
273
|
readonly layer?: Layer;
|
|
67
274
|
readonly folder?: string;
|
|
275
|
+
readonly foldersInLayer?: readonly string[];
|
|
68
276
|
readonly fileName: string;
|
|
69
277
|
readonly isCompositionRoot?: boolean;
|
|
278
|
+
readonly unseen?: Unseen;
|
|
70
279
|
}
|
|
71
280
|
declare class Location {
|
|
72
281
|
readonly area: Area;
|
|
73
282
|
readonly context: string | undefined;
|
|
283
|
+
readonly subdomain: SubdomainType | undefined;
|
|
74
284
|
readonly layer: Layer | undefined;
|
|
75
285
|
readonly folder: string | undefined;
|
|
286
|
+
readonly foldersInLayer: readonly string[];
|
|
76
287
|
readonly fileName: string;
|
|
77
288
|
readonly isCompositionRoot: boolean;
|
|
289
|
+
readonly unseen: Unseen | undefined;
|
|
78
290
|
constructor(props: LocationProps);
|
|
79
291
|
get isInBoundedContext(): boolean;
|
|
292
|
+
get isInCoreDomain(): boolean;
|
|
80
293
|
get isInSharedKernel(): boolean;
|
|
81
294
|
get isAtRoot(): boolean;
|
|
82
295
|
get isOutside(): boolean;
|
|
83
296
|
get isInLayer(): boolean;
|
|
84
297
|
isSameContextAs(other: Location): boolean;
|
|
85
298
|
isOtherBoundedContextThan(other: Location): boolean;
|
|
86
|
-
describe(): string;
|
|
87
299
|
}
|
|
88
300
|
//#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;
|
|
301
|
+
//#region src/architecture/paths/place.d.ts
|
|
302
|
+
declare class Place {
|
|
303
|
+
readonly layer: Layer;
|
|
304
|
+
readonly folder: string | undefined;
|
|
305
|
+
readonly suffix: string | undefined;
|
|
306
|
+
constructor(spec: PlaceSpec);
|
|
307
|
+
fits(location: Location): boolean;
|
|
106
308
|
}
|
|
107
309
|
//#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[];
|
|
310
|
+
//#region src/architecture/building-blocks.d.ts
|
|
311
|
+
interface MarkedPlace {
|
|
312
|
+
readonly marker: CoreMarker;
|
|
313
|
+
readonly place: Place;
|
|
116
314
|
}
|
|
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;
|
|
315
|
+
declare class BuildingBlocks {
|
|
316
|
+
private readonly core;
|
|
317
|
+
constructor(core: CoreApi);
|
|
318
|
+
placeOf(declaration: ClassDeclaration): Place | undefined;
|
|
319
|
+
markedPlacesOf(declaration: ClassDeclaration): MarkedPlace[];
|
|
320
|
+
foldersOf(layer: "domain" | "application"): readonly string[];
|
|
127
321
|
}
|
|
128
322
|
//#endregion
|
|
129
|
-
//#region src/
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
readonly root: string;
|
|
134
|
-
readonly boundedContexts: Readonly<Record<string, string>>;
|
|
135
|
-
readonly sharedKernel?: string;
|
|
136
|
-
readonly compositionRoot?: string;
|
|
137
|
-
readonly domainDependencies?: readonly string[];
|
|
138
|
-
readonly ignore?: readonly string[];
|
|
139
|
-
readonly rules?: Readonly<Partial<Record<RuleId, RuleSetting>>>;
|
|
323
|
+
//#region src/architecture/layers.d.ts
|
|
324
|
+
declare class Layers {
|
|
325
|
+
isLayer(name: string): name is Layer;
|
|
326
|
+
importableFrom(layer: Exclude<Layer, "domain">): readonly Layer[];
|
|
140
327
|
}
|
|
141
328
|
//#endregion
|
|
142
|
-
//#region src/
|
|
143
|
-
|
|
144
|
-
readonly
|
|
145
|
-
readonly
|
|
146
|
-
readonly
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
readonly
|
|
150
|
-
readonly
|
|
151
|
-
readonly
|
|
152
|
-
|
|
153
|
-
readonly
|
|
154
|
-
|
|
155
|
-
private readonly rules;
|
|
156
|
-
constructor(config: AlveolusConfig, projectDir: string);
|
|
157
|
-
isIgnored(path: string): boolean;
|
|
158
|
-
isEnabled(rule: RuleId): boolean;
|
|
159
|
-
}
|
|
329
|
+
//#region src/architecture/paths/layer-shape.d.ts
|
|
330
|
+
type ShapeIssue = {
|
|
331
|
+
readonly kind: "directlyInLayer" | "tooDeep";
|
|
332
|
+
readonly layer: "domain" | "application";
|
|
333
|
+
readonly example: string;
|
|
334
|
+
} | {
|
|
335
|
+
readonly kind: "unknownFolder";
|
|
336
|
+
readonly layer: "domain" | "application";
|
|
337
|
+
readonly folder: string;
|
|
338
|
+
readonly folders: readonly string[];
|
|
339
|
+
} | {
|
|
340
|
+
readonly kind: "nestedPublishedLanguage" | "drivenWithoutTechnology" | "drivenTooDeep" | "drivingWithoutTechnology";
|
|
341
|
+
};
|
|
160
342
|
//#endregion
|
|
161
|
-
//#region src/
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
343
|
+
//#region src/architecture/architecture.d.ts
|
|
344
|
+
type FileTarget$1 = Extract<DependencyTarget, {
|
|
345
|
+
kind: "file";
|
|
346
|
+
}>;
|
|
347
|
+
export declare class Architecture {
|
|
348
|
+
readonly project: Project$1;
|
|
349
|
+
private readonly settings;
|
|
350
|
+
readonly core: CoreApi;
|
|
351
|
+
readonly layers: Layers;
|
|
352
|
+
readonly blocks: BuildingBlocks;
|
|
353
|
+
private readonly shape;
|
|
354
|
+
private readonly layout;
|
|
355
|
+
private readonly locations;
|
|
356
|
+
constructor(project: Project$1, settings: Settings);
|
|
357
|
+
get files(): readonly SourceFile[];
|
|
358
|
+
get domainDependencies(): AllowedPackages;
|
|
359
|
+
get applicationDependencies(): AllowedPackages;
|
|
360
|
+
get contextMap(): ContextMap | undefined;
|
|
361
|
+
locationOf(file: SourceFile): Location;
|
|
362
|
+
locationOfTarget(target: FileTarget$1): Location;
|
|
363
|
+
shapeIssueOf(location: Location): ShapeIssue | undefined;
|
|
364
|
+
relativePath(path: string): string;
|
|
365
|
+
kindsOf(subject: ClassType | ClassDeclaration): CoreKind[];
|
|
366
|
+
kindOf(subject: ClassType | ClassDeclaration): CoreKind | undefined;
|
|
367
|
+
is(subject: ClassType | ClassDeclaration, kind: CoreKind): boolean;
|
|
368
|
+
isBuildingBlock(subject: ClassType | ClassDeclaration): boolean;
|
|
369
|
+
implementsMarker(declaration: ClassDeclaration, marker: CoreMarker): boolean;
|
|
370
|
+
returnsResult(member: Member): boolean;
|
|
371
|
+
classOf(type: ClassType): ClassDeclaration | undefined;
|
|
372
|
+
private locate;
|
|
373
|
+
private typeOf;
|
|
166
374
|
}
|
|
167
375
|
//#endregion
|
|
168
|
-
//#region src/
|
|
169
|
-
|
|
376
|
+
//#region src/rules/framework/finding.d.ts
|
|
377
|
+
type FindingData = Readonly<Record<string, string | number>>;
|
|
378
|
+
interface Finding<MessageId extends string = string> {
|
|
379
|
+
readonly file: SourceFile;
|
|
380
|
+
readonly line: number;
|
|
381
|
+
readonly symbol: string;
|
|
382
|
+
readonly messageId: MessageId;
|
|
383
|
+
readonly data: FindingData;
|
|
384
|
+
}
|
|
170
385
|
//#endregion
|
|
171
|
-
//#region src/
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
386
|
+
//#region src/rules/framework/wording.d.ts
|
|
387
|
+
type FileTarget = Extract<DependencyTarget, {
|
|
388
|
+
kind: "file";
|
|
389
|
+
}>;
|
|
390
|
+
declare class Wording {
|
|
391
|
+
target(target: FileTarget, architecture: Architecture): string;
|
|
392
|
+
location(location: Location): string;
|
|
393
|
+
place(place: Place): string;
|
|
179
394
|
}
|
|
180
395
|
//#endregion
|
|
181
|
-
//#region src/
|
|
182
|
-
|
|
183
|
-
|
|
396
|
+
//#region src/rules/framework/rule.d.ts
|
|
397
|
+
type RuleContexts = "every" | "core";
|
|
398
|
+
interface RuleMeta<Id extends string, MessageId extends string> {
|
|
399
|
+
readonly id: Id;
|
|
400
|
+
readonly contexts: RuleContexts;
|
|
401
|
+
readonly description: string;
|
|
402
|
+
readonly messages: Readonly<Record<MessageId, string>>;
|
|
403
|
+
}
|
|
404
|
+
export declare abstract class Rule<Id extends string = string, MessageId extends string = string> {
|
|
405
|
+
abstract readonly meta: RuleMeta<Id, MessageId>;
|
|
406
|
+
protected readonly wording: Wording;
|
|
407
|
+
abstract check(architecture: Architecture): Finding<MessageId>[];
|
|
408
|
+
protected filesOf(architecture: Architecture): SourceFile[];
|
|
409
|
+
private checks;
|
|
410
|
+
protected finding(file: SourceFile, line: number, symbol: string, messageId: MessageId, data?: FindingData): Finding<MessageId>;
|
|
184
411
|
}
|
|
185
412
|
//#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;
|
|
413
|
+
//#region src/rules/tooling/no-loose-disable.rule.d.ts
|
|
414
|
+
type MessageId = "noRule" | "unknownRule" | "noReason" | "unused";
|
|
415
|
+
declare class NoLooseDisableRule extends Rule<"tooling/no-loose-disable", MessageId> {
|
|
416
|
+
private readonly knownRules;
|
|
417
|
+
readonly meta: RuleMeta<"tooling/no-loose-disable", MessageId>;
|
|
418
|
+
constructor(knownRules: readonly string[]);
|
|
419
|
+
check(architecture: Architecture): Finding<MessageId>[];
|
|
420
|
+
unused(file: SourceFile, comment: DisableComment): Finding<MessageId>;
|
|
421
|
+
private malformed;
|
|
203
422
|
}
|
|
204
423
|
//#endregion
|
|
205
|
-
//#region src/rules/
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
readonly
|
|
424
|
+
//#region src/rules/registry.d.ts
|
|
425
|
+
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"];
|
|
426
|
+
type RuleId = (typeof ruleIds)[number];
|
|
427
|
+
export declare class RuleRegistry {
|
|
428
|
+
readonly rules: readonly Rule<RuleId>[];
|
|
429
|
+
get looseDisable(): NoLooseDisableRule;
|
|
430
|
+
get ids(): RuleId[];
|
|
210
431
|
}
|
|
211
432
|
//#endregion
|
|
212
|
-
//#region src/
|
|
433
|
+
//#region src/check/violation.d.ts
|
|
434
|
+
type Severity = "error" | "warn" | "info";
|
|
213
435
|
interface Violation {
|
|
214
436
|
readonly rule: RuleId;
|
|
437
|
+
readonly severity: Severity;
|
|
215
438
|
readonly file: string;
|
|
216
439
|
readonly line: number;
|
|
217
440
|
readonly symbol: string;
|
|
218
441
|
readonly message: string;
|
|
442
|
+
readonly fingerprint: string;
|
|
219
443
|
}
|
|
220
444
|
//#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
|
|
445
|
+
//#region src/check/baseline.d.ts
|
|
234
446
|
export declare class Baseline {
|
|
235
447
|
private readonly entries;
|
|
236
448
|
static readonly fileName = "alveolus.baseline.json";
|
|
237
449
|
private constructor();
|
|
238
450
|
static of(violations: readonly Violation[]): Baseline;
|
|
239
451
|
static load(path: string): Promise<Baseline>;
|
|
452
|
+
get size(): number;
|
|
453
|
+
get outdatedEntries(): number;
|
|
240
454
|
newViolations(violations: readonly Violation[]): Violation[];
|
|
455
|
+
staleEntries(violations: readonly Violation[]): number;
|
|
456
|
+
private match;
|
|
241
457
|
save(path: string): Promise<void>;
|
|
242
458
|
private keyOf;
|
|
243
459
|
}
|
|
244
460
|
//#endregion
|
|
245
|
-
//#region src/
|
|
246
|
-
|
|
247
|
-
|
|
461
|
+
//#region src/importer/importer.d.ts
|
|
462
|
+
interface ImportScope {
|
|
463
|
+
readonly projectDir: string;
|
|
464
|
+
readonly rootDir: string;
|
|
465
|
+
isIgnored(path: string): boolean;
|
|
466
|
+
}
|
|
467
|
+
export declare abstract class Importer {
|
|
468
|
+
abstract read(scope: ImportScope): Project$1;
|
|
469
|
+
abstract resolves(packageName: string, scope: ImportScope): boolean;
|
|
470
|
+
}
|
|
471
|
+
//#endregion
|
|
472
|
+
//#region src/importer/ts-morph/ts-morph-importer.d.ts
|
|
473
|
+
export declare class TsMorphImporter extends Importer {
|
|
474
|
+
private readonly sources;
|
|
475
|
+
private readonly classes;
|
|
476
|
+
private readonly statements;
|
|
477
|
+
private readonly disables;
|
|
478
|
+
private readonly throws;
|
|
479
|
+
constructor(sources: Project);
|
|
480
|
+
static fromTsConfig(tsConfigFilePath: string): TsMorphImporter;
|
|
481
|
+
resolves(packageName: string, scope: ImportScope): boolean;
|
|
482
|
+
read(scope: ImportScope): Project$1;
|
|
483
|
+
private readFile;
|
|
484
|
+
private globalUsesOf;
|
|
485
|
+
private isInside;
|
|
486
|
+
}
|
|
487
|
+
//#endregion
|
|
488
|
+
//#region src/check/checker.d.ts
|
|
489
|
+
interface CheckSettings extends ImportScope, Settings {
|
|
490
|
+
severityOf(rule: RuleId): Severity | "off";
|
|
491
|
+
}
|
|
492
|
+
interface Suppressed {
|
|
493
|
+
readonly violation: Violation;
|
|
494
|
+
readonly reason: string;
|
|
495
|
+
}
|
|
496
|
+
interface CheckOutcome {
|
|
497
|
+
readonly files: number;
|
|
498
|
+
readonly violations: Violation[];
|
|
499
|
+
readonly suppressed: Suppressed[];
|
|
500
|
+
}
|
|
501
|
+
export declare class Checker {
|
|
502
|
+
private readonly importer;
|
|
248
503
|
private readonly rules;
|
|
249
|
-
|
|
250
|
-
|
|
504
|
+
private readonly fingerprint;
|
|
505
|
+
constructor(importer: Importer, rules: readonly Rule<RuleId>[]);
|
|
506
|
+
check(settings: CheckSettings): CheckOutcome;
|
|
507
|
+
run(rule: Rule<RuleId>, architecture: Architecture): Violation[];
|
|
508
|
+
private collect;
|
|
509
|
+
private collectUnusedDisables;
|
|
510
|
+
private violationOf;
|
|
511
|
+
private messageOf;
|
|
512
|
+
private fill;
|
|
251
513
|
private compare;
|
|
252
514
|
}
|
|
253
515
|
//#endregion
|
|
516
|
+
//#region src/check/report.d.ts
|
|
517
|
+
interface ReportInput {
|
|
518
|
+
readonly files: number;
|
|
519
|
+
readonly violations: readonly Violation[];
|
|
520
|
+
readonly suppressed: readonly Suppressed[];
|
|
521
|
+
readonly baselined: number;
|
|
522
|
+
readonly stale: number;
|
|
523
|
+
}
|
|
524
|
+
export declare class Report {
|
|
525
|
+
private readonly input;
|
|
526
|
+
private readonly colors;
|
|
527
|
+
constructor(input: ReportInput, colored?: boolean);
|
|
528
|
+
text(): string;
|
|
529
|
+
json(): string;
|
|
530
|
+
sarif(rules: readonly RuleMeta<string, string>[]): string;
|
|
531
|
+
private byFile;
|
|
532
|
+
private block;
|
|
533
|
+
private severity;
|
|
534
|
+
private summary;
|
|
535
|
+
private counts;
|
|
536
|
+
}
|
|
537
|
+
//#endregion
|
|
254
538
|
//#region src/cli/cli.d.ts
|
|
255
539
|
interface Output {
|
|
256
540
|
write(text: string): unknown;
|
|
@@ -266,22 +550,62 @@ export declare class Cli {
|
|
|
266
550
|
private program;
|
|
267
551
|
private withOptions;
|
|
268
552
|
private check;
|
|
553
|
+
private render;
|
|
554
|
+
private warnOutdated;
|
|
269
555
|
private baseline;
|
|
270
556
|
private analyze;
|
|
271
557
|
private fail;
|
|
272
558
|
}
|
|
273
559
|
//#endregion
|
|
274
|
-
//#region src/
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
560
|
+
//#region src/config/alveolus-config.d.ts
|
|
561
|
+
type RuleSetting = "error" | "warn" | "info" | "off";
|
|
562
|
+
interface LayoutConfig {
|
|
563
|
+
readonly extraFolders?: Readonly<Partial<Record<"domain" | "application", readonly string[]>>>;
|
|
564
|
+
}
|
|
565
|
+
interface AlveolusConfig {
|
|
566
|
+
readonly root: string;
|
|
567
|
+
readonly tsconfig?: string;
|
|
568
|
+
readonly boundedContexts: Readonly<Record<string, string>>;
|
|
569
|
+
readonly sharedKernel?: string;
|
|
570
|
+
readonly subdomains?: Subdomains;
|
|
571
|
+
readonly contextMap?: Upstreams;
|
|
572
|
+
readonly compositionRoot?: string;
|
|
573
|
+
readonly domainDependencies?: PackageDependencies;
|
|
574
|
+
readonly applicationDependencies?: PackageDependencies;
|
|
575
|
+
readonly ignore?: readonly string[];
|
|
576
|
+
readonly layout?: LayoutConfig;
|
|
577
|
+
readonly rules?: Readonly<Partial<Record<RuleId, RuleSetting>>>;
|
|
284
578
|
}
|
|
285
579
|
//#endregion
|
|
286
|
-
|
|
580
|
+
//#region src/config/config.d.ts
|
|
581
|
+
export declare class Config implements CheckSettings {
|
|
582
|
+
readonly projectDir: string;
|
|
583
|
+
readonly rootDir: string;
|
|
584
|
+
readonly tsConfigPath: string;
|
|
585
|
+
readonly compositionRoot: string;
|
|
586
|
+
readonly domainDependencies: AllowedPackages;
|
|
587
|
+
readonly applicationDependencies: AllowedPackages;
|
|
588
|
+
readonly contextFolders: readonly ContextFolder[];
|
|
589
|
+
readonly extraFolders: ExtraFolders;
|
|
590
|
+
readonly contextMap: ContextMap | undefined;
|
|
591
|
+
private readonly ignored;
|
|
592
|
+
private readonly rules;
|
|
593
|
+
constructor(config: AlveolusConfig, projectDir: string);
|
|
594
|
+
private classifiedContexts;
|
|
595
|
+
private validContextMap;
|
|
596
|
+
isIgnored(path: string): boolean;
|
|
597
|
+
severityOf(rule: RuleId): Severity | "off";
|
|
598
|
+
}
|
|
599
|
+
//#endregion
|
|
600
|
+
//#region src/config/config-loader.d.ts
|
|
601
|
+
export declare class ConfigLoader {
|
|
602
|
+
static readonly fileName = "alveolus.config.ts";
|
|
603
|
+
load(projectDir: string, configFile?: string): Promise<Config>;
|
|
604
|
+
private validate;
|
|
605
|
+
}
|
|
606
|
+
//#endregion
|
|
607
|
+
//#region src/config/define-config.d.ts
|
|
608
|
+
export declare function defineConfig(config: AlveolusConfig): AlveolusConfig;
|
|
609
|
+
//#endregion
|
|
610
|
+
export type { AlveolusConfig, CheckSettings, Finding, FindingData, ImportScope, PackageDependencies, RuleId, RuleMeta, RuleSetting, Settings, Violation };
|
|
287
611
|
//# sourceMappingURL=index.d.mts.map
|