laymos 0.0.2 → 0.0.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/package.json +3 -3
- package/dist/architecture/analyze-project/analyze-project.d.ts +0 -9
- package/dist/architecture/analyze-project/analyze-project.d.ts.map +0 -1
- package/dist/architecture/analyze-project/analyze-project.js +0 -47
- package/dist/architecture/analyze-project/index.d.ts +0 -3
- package/dist/architecture/analyze-project/index.d.ts.map +0 -1
- package/dist/architecture/analyze-project/index.js +0 -1
- package/dist/architecture/build-report/build-report.d.ts +0 -7
- package/dist/architecture/build-report/build-report.d.ts.map +0 -1
- package/dist/architecture/build-report/build-report.js +0 -80
- package/dist/architecture/build-report/index.d.ts +0 -2
- package/dist/architecture/build-report/index.d.ts.map +0 -1
- package/dist/architecture/build-report/index.js +0 -1
- package/dist/architecture/errors.d.ts +0 -11
- package/dist/architecture/errors.d.ts.map +0 -1
- package/dist/architecture/errors.js +0 -3
- package/dist/architecture/extract-dependencies/extract-dependencies.d.ts +0 -12
- package/dist/architecture/extract-dependencies/extract-dependencies.d.ts.map +0 -1
- package/dist/architecture/extract-dependencies/extract-dependencies.js +0 -162
- package/dist/architecture/extract-dependencies/index.d.ts +0 -3
- package/dist/architecture/extract-dependencies/index.d.ts.map +0 -1
- package/dist/architecture/extract-dependencies/index.js +0 -1
- package/dist/architecture/resolve-architecture/index.d.ts +0 -3
- package/dist/architecture/resolve-architecture/index.d.ts.map +0 -1
- package/dist/architecture/resolve-architecture/index.js +0 -1
- package/dist/architecture/resolve-architecture/resolve-architecture.d.ts +0 -24
- package/dist/architecture/resolve-architecture/resolve-architecture.d.ts.map +0 -1
- package/dist/architecture/resolve-architecture/resolve-architecture.js +0 -74
- package/dist/architecture/validate-rules/index.d.ts +0 -3
- package/dist/architecture/validate-rules/index.d.ts.map +0 -1
- package/dist/architecture/validate-rules/index.js +0 -1
- package/dist/architecture/validate-rules/validate-rules.d.ts +0 -10
- package/dist/architecture/validate-rules/validate-rules.d.ts.map +0 -1
- package/dist/architecture/validate-rules/validate-rules.js +0 -80
- package/dist/cli/deps/dependency-tree.d.ts +0 -3
- package/dist/cli/deps/dependency-tree.d.ts.map +0 -1
- package/dist/cli/deps/dependency-tree.js +0 -39
- package/dist/cli/deps/deps.d.ts +0 -7
- package/dist/cli/deps/deps.d.ts.map +0 -1
- package/dist/cli/deps/deps.js +0 -26
- package/dist/cli/deps/index.d.ts +0 -2
- package/dist/cli/deps/index.d.ts.map +0 -1
- package/dist/cli/deps/index.js +0 -2
- package/dist/config/define-config.d.ts +0 -8
- package/dist/config/define-config.d.ts.map +0 -1
- package/dist/config/define-config.js +0 -373
- package/dist/config/index.d.ts +0 -11
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -6
- package/dist/config/layer-graph.d.ts +0 -7
- package/dist/config/layer-graph.d.ts.map +0 -1
- package/dist/config/layer-graph.js +0 -26
- package/dist/config/layer.d.ts +0 -5
- package/dist/config/layer.d.ts.map +0 -1
- package/dist/config/layer.js +0 -8
- package/dist/config/load-config/index.d.ts +0 -2
- package/dist/config/load-config/index.d.ts.map +0 -1
- package/dist/config/load-config/index.js +0 -1
- package/dist/config/load-config/load-config.d.ts +0 -34
- package/dist/config/load-config/load-config.d.ts.map +0 -1
- package/dist/config/load-config/load-config.js +0 -127
- package/dist/config/module.d.ts +0 -11
- package/dist/config/module.d.ts.map +0 -1
- package/dist/config/module.js +0 -22
- package/dist/config/path.d.ts +0 -4
- package/dist/config/path.d.ts.map +0 -1
- package/dist/config/path.js +0 -32
- package/dist/config/project-narrative.d.ts +0 -15
- package/dist/config/project-narrative.d.ts.map +0 -1
- package/dist/config/project-narrative.js +0 -11
- package/dist/config/types.d.ts +0 -38
- package/dist/config/types.d.ts.map +0 -1
- package/dist/config/types.js +0 -1
- package/dist/domain/architecture-analysis/modules/unexposed-modules.d.ts +0 -3
- package/dist/domain/architecture-analysis/modules/unexposed-modules.d.ts.map +0 -1
- package/dist/domain/architecture-analysis/modules/unexposed-modules.js +0 -10
- package/dist/domain/project-config/validation/modules/containment.d.ts +0 -3
- package/dist/domain/project-config/validation/modules/containment.d.ts.map +0 -1
- package/dist/domain/project-config/validation/modules/containment.js +0 -24
- package/dist/domain/project-config/validation/modules/kinds.d.ts +0 -3
- package/dist/domain/project-config/validation/modules/kinds.d.ts.map +0 -1
- package/dist/domain/project-config/validation/modules/kinds.js +0 -18
- package/dist/domain/project-config/validation/modules/nested.d.ts +0 -3
- package/dist/domain/project-config/validation/modules/nested.d.ts.map +0 -1
- package/dist/domain/project-config/validation/modules/nested.js +0 -34
- package/dist/domain/project-config/validation/modules/subpaths.d.ts +0 -3
- package/dist/domain/project-config/validation/modules/subpaths.d.ts.map +0 -1
- package/dist/domain/project-config/validation/modules/subpaths.js +0 -40
- package/dist/entrypoints/cli/cli.d.ts +0 -3
- package/dist/entrypoints/cli/cli.d.ts.map +0 -1
- package/dist/entrypoints/cli/cli.js +0 -6
- package/dist/entrypoints/cli/run.d.ts +0 -13
- package/dist/entrypoints/cli/run.d.ts.map +0 -1
- package/dist/entrypoints/cli/run.js +0 -155
- package/dist/entrypoints/cli/test-output.d.ts +0 -17
- package/dist/entrypoints/cli/test-output.d.ts.map +0 -1
- package/dist/entrypoints/cli/test-output.js +0 -244
- package/dist/entrypoints/node/index.d.ts +0 -24
- package/dist/entrypoints/node/index.d.ts.map +0 -1
- package/dist/entrypoints/node/index.js +0 -27
- package/dist/entrypoints/report/index.d.ts +0 -2
- package/dist/entrypoints/report/index.d.ts.map +0 -1
- package/dist/entrypoints/report/index.js +0 -1
- package/dist/markdown/index.d.ts +0 -3
- package/dist/markdown/index.d.ts.map +0 -1
- package/dist/markdown/index.js +0 -1
- package/dist/markdown/markdown.d.ts +0 -7
- package/dist/markdown/markdown.d.ts.map +0 -1
- package/dist/markdown/markdown.js +0 -13
- package/dist/orchestrator/query-dependencies/index.d.ts +0 -3
- package/dist/orchestrator/query-dependencies/index.d.ts.map +0 -1
- package/dist/orchestrator/query-dependencies/index.js +0 -4
- package/dist/orchestrator/query-dependencies/query-dependencies.d.ts +0 -12
- package/dist/orchestrator/query-dependencies/query-dependencies.d.ts.map +0 -1
- package/dist/orchestrator/query-dependencies/query-dependencies.js +0 -20
- package/dist/report/architecture.d.ts +0 -104
- package/dist/report/architecture.d.ts.map +0 -1
- package/dist/report/architecture.js +0 -1
- package/dist/report/index.d.ts +0 -4
- package/dist/report/index.d.ts.map +0 -1
- package/dist/report/index.js +0 -2
- package/dist/report/tests.d.ts +0 -411
- package/dist/report/tests.d.ts.map +0 -1
- package/dist/report/tests.js +0 -102
- package/dist/tests/authoring/index.d.ts +0 -72
- package/dist/tests/authoring/index.d.ts.map +0 -1
- package/dist/tests/authoring/index.js +0 -312
- package/dist/tests/run-tests/index.d.ts +0 -3
- package/dist/tests/run-tests/index.d.ts.map +0 -1
- package/dist/tests/run-tests/index.js +0 -1
- package/dist/tests/run-tests/run-tests.d.ts +0 -26
- package/dist/tests/run-tests/run-tests.d.ts.map +0 -1
- package/dist/tests/run-tests/run-tests.js +0 -284
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { resolve } from 'node:path';
|
|
3
|
-
import { Data, Effect, Match, Option, Schema } from 'effect';
|
|
4
|
-
import { createJiti } from 'jiti';
|
|
5
|
-
import { validateConfig } from '../define-config.js';
|
|
6
|
-
const ErrorMessageSchema = Schema.Struct({ message: Schema.String });
|
|
7
|
-
const UnknownRecordSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
8
|
-
export class ConfigNotFoundError extends Data.TaggedError('ConfigNotFoundError') {
|
|
9
|
-
}
|
|
10
|
-
export class ConfigImportError extends Data.TaggedError('ConfigImportError') {
|
|
11
|
-
}
|
|
12
|
-
export class ConfigValidationError extends Data.TaggedError('ConfigValidationError') {
|
|
13
|
-
}
|
|
14
|
-
/** Loads and validates the Laymos config at the project root. */
|
|
15
|
-
export const loadConfig = ({ projectDir, }) => {
|
|
16
|
-
return Effect.gen(function* () {
|
|
17
|
-
const located = yield* Effect.sync(() => {
|
|
18
|
-
const path = resolve(projectDir, 'laymos.config.ts');
|
|
19
|
-
return { path, exists: existsSync(path) };
|
|
20
|
-
});
|
|
21
|
-
return yield* Match.value(located.exists).pipe(Match.when(false, () => Effect.fail(new ConfigNotFoundError({ path: located.path }))), Match.when(true, () => importAndValidateConfig(located.path)), Match.exhaustive);
|
|
22
|
-
}).pipe(Effect.withSpan('config.load'));
|
|
23
|
-
};
|
|
24
|
-
const importAndValidateConfig = (path) => Effect.gen(function* () {
|
|
25
|
-
const config = yield* Effect.tryPromise({
|
|
26
|
-
try: async () => {
|
|
27
|
-
const jiti = createJiti(import.meta.url, {
|
|
28
|
-
interopDefault: true,
|
|
29
|
-
moduleCache: false,
|
|
30
|
-
});
|
|
31
|
-
const imported = (await jiti.import(path));
|
|
32
|
-
return imported.default;
|
|
33
|
-
},
|
|
34
|
-
catch: (cause) => new ConfigImportError({
|
|
35
|
-
path,
|
|
36
|
-
message: errorMessage(cause),
|
|
37
|
-
}),
|
|
38
|
-
});
|
|
39
|
-
return yield* Match.value(isLaymosConfig(config)).pipe(Match.when(false, () => Effect.fail(new ConfigValidationError({
|
|
40
|
-
path,
|
|
41
|
-
issues: [
|
|
42
|
-
'Config must default-export a value created with defineConfig()',
|
|
43
|
-
],
|
|
44
|
-
message: `Invalid Laymos config at "${path}"`,
|
|
45
|
-
}))), Match.when(true, () => validateConfigurationSemantics(path, config)), Match.exhaustive);
|
|
46
|
-
});
|
|
47
|
-
const validateConfigurationSemantics = (path, config) => {
|
|
48
|
-
const validation = validateConfig(config);
|
|
49
|
-
return Match.value(validation.issues.length > 0).pipe(Match.when(true, () => Effect.fail(new ConfigValidationError({
|
|
50
|
-
path,
|
|
51
|
-
issues: validation.issues,
|
|
52
|
-
message: `Invalid Laymos config at "${path}":\n${validation.issues.map((issue) => `- ${issue}`).join('\n')}`,
|
|
53
|
-
}))), Match.when(false, () => Effect.succeed(validation.config)), Match.exhaustive);
|
|
54
|
-
};
|
|
55
|
-
function isLaymosConfig(value) {
|
|
56
|
-
if (!isRecord(value))
|
|
57
|
-
return false;
|
|
58
|
-
return (isStringArray(value.sourceRoots) &&
|
|
59
|
-
Array.isArray(value.graphs) &&
|
|
60
|
-
value.graphs.every(isLayerGraph) &&
|
|
61
|
-
(value.modules === undefined ||
|
|
62
|
-
(Array.isArray(value.modules) && value.modules.every(isModule))) &&
|
|
63
|
-
(value.moduleRules === undefined ||
|
|
64
|
-
(Array.isArray(value.moduleRules) &&
|
|
65
|
-
value.moduleRules.every(isModuleRules))) &&
|
|
66
|
-
(value.ignore === undefined || isStringArray(value.ignore)) &&
|
|
67
|
-
(value.project === undefined || isProjectNarrative(value.project)));
|
|
68
|
-
}
|
|
69
|
-
function isLayerGraph(value) {
|
|
70
|
-
return (isRecord(value) &&
|
|
71
|
-
value.kind === 'layer-graph' &&
|
|
72
|
-
typeof value.name === 'string' &&
|
|
73
|
-
typeof value.description === 'string' &&
|
|
74
|
-
Array.isArray(value.layers) &&
|
|
75
|
-
value.layers.every(isLayer) &&
|
|
76
|
-
Array.isArray(value.edges) &&
|
|
77
|
-
value.edges.every(isLayerEdge));
|
|
78
|
-
}
|
|
79
|
-
function isLayer(value) {
|
|
80
|
-
return (isRecord(value) &&
|
|
81
|
-
value.kind === 'layer' &&
|
|
82
|
-
typeof value.name === 'string' &&
|
|
83
|
-
typeof value.description === 'string' &&
|
|
84
|
-
isStringArray(value.paths));
|
|
85
|
-
}
|
|
86
|
-
function isLayerEdge(value) {
|
|
87
|
-
return isRecord(value) && isLayer(value.from) && isLayer(value.to);
|
|
88
|
-
}
|
|
89
|
-
function isModule(value) {
|
|
90
|
-
return (isRecord(value) &&
|
|
91
|
-
value.kind === 'module' &&
|
|
92
|
-
typeof value.path === 'string' &&
|
|
93
|
-
typeof value.description === 'string' &&
|
|
94
|
-
(value.documentation === undefined ||
|
|
95
|
-
isMarkdownContent(value.documentation)));
|
|
96
|
-
}
|
|
97
|
-
function isModuleRules(value) {
|
|
98
|
-
return (isRecord(value) &&
|
|
99
|
-
value.kind === 'module-rules' &&
|
|
100
|
-
isModule(value.module) &&
|
|
101
|
-
(value.canImport === undefined ||
|
|
102
|
-
(Array.isArray(value.canImport) && value.canImport.every(isModule))) &&
|
|
103
|
-
(value.canImportedBy === undefined ||
|
|
104
|
-
(Array.isArray(value.canImportedBy) &&
|
|
105
|
-
value.canImportedBy.every(isModule))));
|
|
106
|
-
}
|
|
107
|
-
function isProjectNarrative(value) {
|
|
108
|
-
return (isRecord(value) &&
|
|
109
|
-
value.kind === 'project-narrative' &&
|
|
110
|
-
typeof value.name === 'string' &&
|
|
111
|
-
isMarkdownContent(value.content));
|
|
112
|
-
}
|
|
113
|
-
function isMarkdownContent(value) {
|
|
114
|
-
return (isRecord(value) &&
|
|
115
|
-
value.kind === 'markdown' &&
|
|
116
|
-
typeof value.content === 'string');
|
|
117
|
-
}
|
|
118
|
-
function isStringArray(value) {
|
|
119
|
-
return (Array.isArray(value) && value.every((item) => typeof item === 'string'));
|
|
120
|
-
}
|
|
121
|
-
function isRecord(value) {
|
|
122
|
-
return Schema.is(UnknownRecordSchema)(value);
|
|
123
|
-
}
|
|
124
|
-
function errorMessage(cause) {
|
|
125
|
-
const decoded = Schema.decodeUnknownOption(ErrorMessageSchema)(cause);
|
|
126
|
-
return Option.isSome(decoded) ? decoded.value.message : String(cause);
|
|
127
|
-
}
|
package/dist/config/module.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ModuleDef, ModuleRules } from './types.js';
|
|
2
|
-
import type { MarkdownContent } from '../markdown/index.js';
|
|
3
|
-
export declare function module(path: string, options: {
|
|
4
|
-
readonly description: string;
|
|
5
|
-
readonly documentation?: MarkdownContent;
|
|
6
|
-
}): ModuleDef;
|
|
7
|
-
export declare function rules(module: ModuleDef, constraints: {
|
|
8
|
-
canImport?: readonly ModuleDef[];
|
|
9
|
-
canImportedBy?: readonly ModuleDef[];
|
|
10
|
-
}): ModuleRules;
|
|
11
|
-
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/config/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,wBAAgB,MAAM,CACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IACP,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,eAAe,CAAC;CAC1C,GACA,SAAS,CASX;AAED,wBAAgB,KAAK,CACnB,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE;IACX,SAAS,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IACjC,aAAa,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CACtC,GACA,WAAW,CAWb"}
|
package/dist/config/module.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export function module(path, options) {
|
|
2
|
-
return {
|
|
3
|
-
kind: 'module',
|
|
4
|
-
path,
|
|
5
|
-
description: options.description,
|
|
6
|
-
...(options.documentation === undefined
|
|
7
|
-
? {}
|
|
8
|
-
: { documentation: options.documentation }),
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export function rules(module, constraints) {
|
|
12
|
-
return {
|
|
13
|
-
kind: 'module-rules',
|
|
14
|
-
module,
|
|
15
|
-
...(constraints.canImport !== undefined
|
|
16
|
-
? { canImport: constraints.canImport }
|
|
17
|
-
: {}),
|
|
18
|
-
...(constraints.canImportedBy !== undefined
|
|
19
|
-
? { canImportedBy: constraints.canImportedBy }
|
|
20
|
-
: {}),
|
|
21
|
-
};
|
|
22
|
-
}
|
package/dist/config/path.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/config/path.ts"],"names":[],"mappings":"AAGA,sEAAsE;AACtE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA0BxD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnE"}
|
package/dist/config/path.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const globSyntax = /[*?{}[\]]/;
|
|
2
|
-
const windowsAbsolutePath = /^[a-zA-Z]:\//;
|
|
3
|
-
/** Converts a configured path to project-root-relative POSIX form. */
|
|
4
|
-
export function normalizeConfigPath(path) {
|
|
5
|
-
if (path.length === 0) {
|
|
6
|
-
throw new Error('Path must not be empty');
|
|
7
|
-
}
|
|
8
|
-
const unixPath = path.replaceAll('\\', '/');
|
|
9
|
-
if (unixPath.startsWith('/') || windowsAbsolutePath.test(unixPath)) {
|
|
10
|
-
throw new Error(`Path "${path}" must be relative to the project root`);
|
|
11
|
-
}
|
|
12
|
-
if (globSyntax.test(unixPath)) {
|
|
13
|
-
throw new Error(`Path "${path}" must be a plain path, not a glob`);
|
|
14
|
-
}
|
|
15
|
-
const segments = [];
|
|
16
|
-
for (const segment of unixPath.split('/')) {
|
|
17
|
-
if (segment.length === 0 || segment === '.')
|
|
18
|
-
continue;
|
|
19
|
-
if (segment === '..') {
|
|
20
|
-
if (segments.length === 0) {
|
|
21
|
-
throw new Error(`Path "${path}" escapes the project root`);
|
|
22
|
-
}
|
|
23
|
-
segments.pop();
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
segments.push(segment);
|
|
27
|
-
}
|
|
28
|
-
return segments.join('/') || '.';
|
|
29
|
-
}
|
|
30
|
-
export function pathContains(parent, child) {
|
|
31
|
-
return parent === '.' || child === parent || child.startsWith(`${parent}/`);
|
|
32
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { MarkdownContent } from '../markdown/index.js';
|
|
2
|
-
export interface ProjectNarrativeDef {
|
|
3
|
-
readonly kind: 'project-narrative';
|
|
4
|
-
readonly name: string;
|
|
5
|
-
readonly content: MarkdownContent;
|
|
6
|
-
}
|
|
7
|
-
export interface ProjectNarrative {
|
|
8
|
-
readonly kind: 'project-narrative';
|
|
9
|
-
readonly name: string;
|
|
10
|
-
readonly content: string;
|
|
11
|
-
}
|
|
12
|
-
/** Declares the optional project-level human account. */
|
|
13
|
-
export declare function projectNarrative(name: string, content: MarkdownContent): ProjectNarrativeDef;
|
|
14
|
-
export declare function serializeProjectNarrative(narrative: ProjectNarrativeDef): ProjectNarrative;
|
|
15
|
-
//# sourceMappingURL=project-narrative.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-narrative.d.ts","sourceRoot":"","sources":["../../src/config/project-narrative.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;CACnC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,yDAAyD;AACzD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,eAAe,GACvB,mBAAmB,CAErB;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,mBAAmB,GAC7B,gBAAgB,CAMlB"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Declares the optional project-level human account. */
|
|
2
|
-
export function projectNarrative(name, content) {
|
|
3
|
-
return { kind: 'project-narrative', name, content };
|
|
4
|
-
}
|
|
5
|
-
export function serializeProjectNarrative(narrative) {
|
|
6
|
-
return {
|
|
7
|
-
kind: narrative.kind,
|
|
8
|
-
name: narrative.name,
|
|
9
|
-
content: narrative.content.content,
|
|
10
|
-
};
|
|
11
|
-
}
|
package/dist/config/types.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export interface Layer {
|
|
2
|
-
readonly kind: 'layer';
|
|
3
|
-
readonly name: string;
|
|
4
|
-
readonly paths: readonly string[];
|
|
5
|
-
readonly description: string;
|
|
6
|
-
}
|
|
7
|
-
export interface LayerEdge {
|
|
8
|
-
readonly from: Layer;
|
|
9
|
-
readonly to: Layer;
|
|
10
|
-
}
|
|
11
|
-
export interface LayerGraph {
|
|
12
|
-
readonly kind: 'layer-graph';
|
|
13
|
-
readonly name: string;
|
|
14
|
-
readonly layers: readonly Layer[];
|
|
15
|
-
readonly edges: readonly LayerEdge[];
|
|
16
|
-
readonly description: string;
|
|
17
|
-
}
|
|
18
|
-
export interface ModuleDef {
|
|
19
|
-
readonly kind: 'module';
|
|
20
|
-
readonly path: string;
|
|
21
|
-
readonly description: string;
|
|
22
|
-
readonly documentation?: import('../markdown/index.js').MarkdownContent;
|
|
23
|
-
}
|
|
24
|
-
export interface ModuleRules {
|
|
25
|
-
readonly kind: 'module-rules';
|
|
26
|
-
readonly module: ModuleDef;
|
|
27
|
-
readonly canImport?: readonly ModuleDef[];
|
|
28
|
-
readonly canImportedBy?: readonly ModuleDef[];
|
|
29
|
-
}
|
|
30
|
-
export interface LaymosConfig {
|
|
31
|
-
readonly sourceRoots: readonly string[];
|
|
32
|
-
readonly graphs: readonly LayerGraph[];
|
|
33
|
-
readonly modules?: readonly ModuleDef[];
|
|
34
|
-
readonly moduleRules?: readonly ModuleRules[];
|
|
35
|
-
readonly ignore?: readonly string[];
|
|
36
|
-
readonly project?: import('./project-narrative.js').ProjectNarrativeDef;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,sBAAsB,EAAE,eAAe,CAAC;CACzE;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,wBAAwB,EAAE,mBAAmB,CAAC;CACzE"}
|
package/dist/config/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unexposed-modules.d.ts","sourceRoot":"","sources":["../../../../src/domain/architecture-analysis/modules/unexposed-modules.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,EACvB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,GAClD,WAAW,CAAC,MAAM,CAAC,CAarB"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { posix } from 'node:path';
|
|
2
|
-
export function findUnexposedModules(files, modules) {
|
|
3
|
-
const knownFiles = new Set(files);
|
|
4
|
-
return new Set(Object.entries(modules)
|
|
5
|
-
.filter(([root, definition]) => !knownFiles.has(root) &&
|
|
6
|
-
!knownFiles.has(posix.join(root, 'index.ts')) &&
|
|
7
|
-
!definition.shared &&
|
|
8
|
-
definition.nested.length === 0)
|
|
9
|
-
.map(([root]) => root));
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"containment.d.ts","sourceRoot":"","sources":["../../../../../src/domain/project-config/validation/modules/containment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAE7E,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,GACb,SAAS,qBAAqB,EAAE,CAuBlC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export function findContainmentIssues(config) {
|
|
2
|
-
return Object.keys(config.modules).flatMap((root) => {
|
|
3
|
-
const layerScopes = Object.entries(config.layers).flatMap(([layer, definition]) => definition.paths
|
|
4
|
-
.filter((scope) => contains(scope, root))
|
|
5
|
-
.map((scope) => ({ layer, scope })));
|
|
6
|
-
const issues = [];
|
|
7
|
-
if (layerScopes.length !== 1) {
|
|
8
|
-
issues.push({
|
|
9
|
-
kind: 'module',
|
|
10
|
-
message: `Module ${root} must be contained by exactly one Layer scope`,
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
if (config.ignoredPaths.some((ignored) => contains(ignored, root))) {
|
|
14
|
-
issues.push({
|
|
15
|
-
kind: 'module',
|
|
16
|
-
message: `Module ${root} is wholly ignored`,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return issues;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
function contains(parent, child) {
|
|
23
|
-
return parent === '.' || child === parent || child.startsWith(`${parent}/`);
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../../../../../src/domain/project-config/validation/modules/kinds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAE7E,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,GACb,SAAS,qBAAqB,EAAE,CAkBlC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export function findAllSharedLayerIssues(config) {
|
|
2
|
-
return Object.entries(config.layers).flatMap(([layer, definition]) => {
|
|
3
|
-
const modules = Object.entries(config.modules).filter(([root]) => definition.paths.some((scope) => contains(scope, root)));
|
|
4
|
-
if (modules.length === 0 ||
|
|
5
|
-
modules.some(([, module]) => module.kind !== 'shared')) {
|
|
6
|
-
return [];
|
|
7
|
-
}
|
|
8
|
-
return [
|
|
9
|
-
{
|
|
10
|
-
kind: 'module',
|
|
11
|
-
message: `Layer ${layer} cannot contain only Shared Modules`,
|
|
12
|
-
},
|
|
13
|
-
];
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
function contains(parent, child) {
|
|
17
|
-
return parent === '.' || child === parent || child.startsWith(`${parent}/`);
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nested.d.ts","sourceRoot":"","sources":["../../../../../src/domain/project-config/validation/modules/nested.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAE7E,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,GACb,SAAS,qBAAqB,EAAE,CA+BlC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { posix } from 'node:path';
|
|
2
|
-
export function findNestedIssues(config) {
|
|
3
|
-
return Object.entries(config.modules).flatMap(([root, definition]) => {
|
|
4
|
-
const issues = [];
|
|
5
|
-
const seen = new Set();
|
|
6
|
-
for (const nested of definition.nested) {
|
|
7
|
-
const path = posix.join(root, nested);
|
|
8
|
-
if (seen.has(nested)) {
|
|
9
|
-
issues.push({
|
|
10
|
-
kind: 'module',
|
|
11
|
-
message: `Module ${root} contains duplicate nested path ${nested}`,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
seen.add(nested);
|
|
15
|
-
if (config.ignoredPaths.some((ignored) => contains(ignored, path))) {
|
|
16
|
-
issues.push({
|
|
17
|
-
kind: 'module',
|
|
18
|
-
message: `Nested public entry point ${path} is wholly ignored`,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
const otherRoot = Object.keys(config.modules).find((candidate) => candidate !== root && contains(candidate, path));
|
|
22
|
-
if (otherRoot !== undefined) {
|
|
23
|
-
issues.push({
|
|
24
|
-
kind: 'module',
|
|
25
|
-
message: `Nested public entry point ${path} points into Module ${otherRoot}`,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return issues;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
function contains(parent, child) {
|
|
33
|
-
return parent === '.' || child === parent || child.startsWith(`${parent}/`);
|
|
34
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subpaths.d.ts","sourceRoot":"","sources":["../../../../../src/domain/project-config/validation/modules/subpaths.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAE7E,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,GACb,SAAS,qBAAqB,EAAE,CAqClC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { posix } from 'node:path';
|
|
2
|
-
export function findSubpathIssues(config) {
|
|
3
|
-
return Object.entries(config.modules).flatMap(([root, definition]) => {
|
|
4
|
-
const issues = [];
|
|
5
|
-
if (definition.kind === 'entry' && definition.subpaths.length > 0) {
|
|
6
|
-
issues.push({
|
|
7
|
-
kind: 'module',
|
|
8
|
-
message: `Entry Module ${root} cannot expose Subpaths`,
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
const seen = new Set();
|
|
12
|
-
for (const subpath of definition.subpaths) {
|
|
13
|
-
const path = posix.join(root, subpath);
|
|
14
|
-
if (seen.has(subpath)) {
|
|
15
|
-
issues.push({
|
|
16
|
-
kind: 'module',
|
|
17
|
-
message: `Module ${root} contains duplicate Subpath ${subpath}`,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
seen.add(subpath);
|
|
21
|
-
if (config.ignoredPaths.some((ignored) => contains(ignored, path))) {
|
|
22
|
-
issues.push({
|
|
23
|
-
kind: 'module',
|
|
24
|
-
message: `Subpath ${path} is wholly ignored`,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
const otherRoot = Object.keys(config.modules).find((candidate) => candidate !== root && contains(candidate, path));
|
|
28
|
-
if (otherRoot !== undefined) {
|
|
29
|
-
issues.push({
|
|
30
|
-
kind: 'module',
|
|
31
|
-
message: `Subpath ${path} points into Module ${otherRoot}`,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return issues;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function contains(parent, child) {
|
|
39
|
-
return parent === '.' || child === parent || child.startsWith(`${parent}/`);
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/cli/cli.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { Effect } from 'effect';
|
|
3
|
-
import * as NodeRuntime from '@effect/platform-node/NodeRuntime';
|
|
4
|
-
import * as NodeServices from '@effect/platform-node/NodeServices';
|
|
5
|
-
import { cli } from './run.js';
|
|
6
|
-
cli.pipe(Effect.provide(NodeServices.layer), NodeRuntime.runMain());
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Effect, FileSystem, Path } from 'effect';
|
|
2
|
-
import { Command } from 'effect/unstable/cli';
|
|
3
|
-
import type { LaymosReport } from '../../report/index.js';
|
|
4
|
-
export declare function lintPasses(report: Pick<LaymosReport, 'violations'>): boolean;
|
|
5
|
-
export declare const command: Command.Command<"laymos", {
|
|
6
|
-
readonly color: boolean;
|
|
7
|
-
} | {
|
|
8
|
-
readonly color: boolean;
|
|
9
|
-
}, {
|
|
10
|
-
readonly color: boolean;
|
|
11
|
-
}, never, FileSystem.FileSystem | Path.Path>;
|
|
12
|
-
export declare const cli: Effect.Effect<void, import("effect/unstable/cli/CliError").CliError, Command.Environment>;
|
|
13
|
-
//# sourceMappingURL=run.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/cli/run.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAU,IAAI,EAAU,MAAM,QAAQ,CAAC;AAClE,OAAO,EAAY,OAAO,EAAQ,MAAM,qBAAqB,CAAC;AAG9D,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,uBAAuB,CAAC;AAUrE,wBAAgB,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,GAAG,OAAO,CAE5E;AA+KD,eAAO,MAAM,OAAO;;;;;;4CAEnB,CAAC;AAEF,eAAO,MAAM,GAAG,2FAAkD,CAAC"}
|