@domainlang/language 0.1.20
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/README.md +163 -0
- package/out/ast-augmentation.d.ts +6 -0
- package/out/ast-augmentation.js +2 -0
- package/out/ast-augmentation.js.map +1 -0
- package/out/domain-lang-module.d.ts +57 -0
- package/out/domain-lang-module.js +67 -0
- package/out/domain-lang-module.js.map +1 -0
- package/out/generated/ast.d.ts +759 -0
- package/out/generated/ast.js +556 -0
- package/out/generated/ast.js.map +1 -0
- package/out/generated/grammar.d.ts +6 -0
- package/out/generated/grammar.js +2407 -0
- package/out/generated/grammar.js.map +1 -0
- package/out/generated/module.d.ts +13 -0
- package/out/generated/module.js +21 -0
- package/out/generated/module.js.map +1 -0
- package/out/index.d.ts +16 -0
- package/out/index.js +22 -0
- package/out/index.js.map +1 -0
- package/out/lsp/domain-lang-code-actions.d.ts +55 -0
- package/out/lsp/domain-lang-code-actions.js +143 -0
- package/out/lsp/domain-lang-code-actions.js.map +1 -0
- package/out/lsp/domain-lang-completion.d.ts +37 -0
- package/out/lsp/domain-lang-completion.js +452 -0
- package/out/lsp/domain-lang-completion.js.map +1 -0
- package/out/lsp/domain-lang-formatter.d.ts +15 -0
- package/out/lsp/domain-lang-formatter.js +43 -0
- package/out/lsp/domain-lang-formatter.js.map +1 -0
- package/out/lsp/domain-lang-naming.d.ts +34 -0
- package/out/lsp/domain-lang-naming.js +49 -0
- package/out/lsp/domain-lang-naming.js.map +1 -0
- package/out/lsp/domain-lang-scope.d.ts +59 -0
- package/out/lsp/domain-lang-scope.js +102 -0
- package/out/lsp/domain-lang-scope.js.map +1 -0
- package/out/lsp/domain-lang-workspace-manager.d.ts +21 -0
- package/out/lsp/domain-lang-workspace-manager.js +93 -0
- package/out/lsp/domain-lang-workspace-manager.js.map +1 -0
- package/out/lsp/hover/ddd-pattern-explanations.d.ts +50 -0
- package/out/lsp/hover/ddd-pattern-explanations.js +196 -0
- package/out/lsp/hover/ddd-pattern-explanations.js.map +1 -0
- package/out/lsp/hover/domain-lang-hover.d.ts +19 -0
- package/out/lsp/hover/domain-lang-hover.js +302 -0
- package/out/lsp/hover/domain-lang-hover.js.map +1 -0
- package/out/lsp/hover/domain-lang-keywords.d.ts +13 -0
- package/out/lsp/hover/domain-lang-keywords.js +47 -0
- package/out/lsp/hover/domain-lang-keywords.js.map +1 -0
- package/out/lsp/manifest-diagnostics.d.ts +82 -0
- package/out/lsp/manifest-diagnostics.js +230 -0
- package/out/lsp/manifest-diagnostics.js.map +1 -0
- package/out/main-browser.d.ts +1 -0
- package/out/main-browser.js +11 -0
- package/out/main-browser.js.map +1 -0
- package/out/main.d.ts +1 -0
- package/out/main.js +74 -0
- package/out/main.js.map +1 -0
- package/out/sdk/ast-augmentation.d.ts +136 -0
- package/out/sdk/ast-augmentation.js +62 -0
- package/out/sdk/ast-augmentation.js.map +1 -0
- package/out/sdk/index.d.ts +94 -0
- package/out/sdk/index.js +97 -0
- package/out/sdk/index.js.map +1 -0
- package/out/sdk/indexes.d.ts +16 -0
- package/out/sdk/indexes.js +97 -0
- package/out/sdk/indexes.js.map +1 -0
- package/out/sdk/loader-node.d.ts +51 -0
- package/out/sdk/loader-node.js +119 -0
- package/out/sdk/loader-node.js.map +1 -0
- package/out/sdk/loader.d.ts +49 -0
- package/out/sdk/loader.js +85 -0
- package/out/sdk/loader.js.map +1 -0
- package/out/sdk/patterns.d.ts +93 -0
- package/out/sdk/patterns.js +123 -0
- package/out/sdk/patterns.js.map +1 -0
- package/out/sdk/query.d.ts +90 -0
- package/out/sdk/query.js +679 -0
- package/out/sdk/query.js.map +1 -0
- package/out/sdk/resolution.d.ts +52 -0
- package/out/sdk/resolution.js +68 -0
- package/out/sdk/resolution.js.map +1 -0
- package/out/sdk/types.d.ts +280 -0
- package/out/sdk/types.js +8 -0
- package/out/sdk/types.js.map +1 -0
- package/out/services/dependency-analyzer.d.ts +58 -0
- package/out/services/dependency-analyzer.js +254 -0
- package/out/services/dependency-analyzer.js.map +1 -0
- package/out/services/dependency-resolver.d.ts +146 -0
- package/out/services/dependency-resolver.js +452 -0
- package/out/services/dependency-resolver.js.map +1 -0
- package/out/services/git-url-resolver.browser.d.ts +10 -0
- package/out/services/git-url-resolver.browser.js +19 -0
- package/out/services/git-url-resolver.browser.js.map +1 -0
- package/out/services/git-url-resolver.d.ts +158 -0
- package/out/services/git-url-resolver.js +416 -0
- package/out/services/git-url-resolver.js.map +1 -0
- package/out/services/governance-validator.d.ts +44 -0
- package/out/services/governance-validator.js +153 -0
- package/out/services/governance-validator.js.map +1 -0
- package/out/services/import-resolver.d.ts +77 -0
- package/out/services/import-resolver.js +240 -0
- package/out/services/import-resolver.js.map +1 -0
- package/out/services/performance-optimizer.d.ts +60 -0
- package/out/services/performance-optimizer.js +140 -0
- package/out/services/performance-optimizer.js.map +1 -0
- package/out/services/relationship-inference.d.ts +11 -0
- package/out/services/relationship-inference.js +98 -0
- package/out/services/relationship-inference.js.map +1 -0
- package/out/services/semver.d.ts +98 -0
- package/out/services/semver.js +195 -0
- package/out/services/semver.js.map +1 -0
- package/out/services/types.d.ts +340 -0
- package/out/services/types.js +46 -0
- package/out/services/types.js.map +1 -0
- package/out/services/workspace-manager.d.ts +123 -0
- package/out/services/workspace-manager.js +489 -0
- package/out/services/workspace-manager.js.map +1 -0
- package/out/syntaxes/domain-lang.monarch.d.ts +76 -0
- package/out/syntaxes/domain-lang.monarch.js +29 -0
- package/out/syntaxes/domain-lang.monarch.js.map +1 -0
- package/out/utils/import-utils.d.ts +49 -0
- package/out/utils/import-utils.js +128 -0
- package/out/utils/import-utils.js.map +1 -0
- package/out/validation/bounded-context.d.ts +11 -0
- package/out/validation/bounded-context.js +79 -0
- package/out/validation/bounded-context.js.map +1 -0
- package/out/validation/classification.d.ts +3 -0
- package/out/validation/classification.js +3 -0
- package/out/validation/classification.js.map +1 -0
- package/out/validation/constants.d.ts +180 -0
- package/out/validation/constants.js +235 -0
- package/out/validation/constants.js.map +1 -0
- package/out/validation/domain-lang-validator.d.ts +2 -0
- package/out/validation/domain-lang-validator.js +27 -0
- package/out/validation/domain-lang-validator.js.map +1 -0
- package/out/validation/domain.d.ts +11 -0
- package/out/validation/domain.js +63 -0
- package/out/validation/domain.js.map +1 -0
- package/out/validation/import.d.ts +68 -0
- package/out/validation/import.js +237 -0
- package/out/validation/import.js.map +1 -0
- package/out/validation/manifest.d.ts +144 -0
- package/out/validation/manifest.js +327 -0
- package/out/validation/manifest.js.map +1 -0
- package/out/validation/maps.d.ts +21 -0
- package/out/validation/maps.js +60 -0
- package/out/validation/maps.js.map +1 -0
- package/out/validation/metadata.d.ts +7 -0
- package/out/validation/metadata.js +16 -0
- package/out/validation/metadata.js.map +1 -0
- package/out/validation/model.d.ts +12 -0
- package/out/validation/model.js +29 -0
- package/out/validation/model.js.map +1 -0
- package/out/validation/relationships.d.ts +12 -0
- package/out/validation/relationships.js +94 -0
- package/out/validation/relationships.js.map +1 -0
- package/out/validation/shared.d.ts +6 -0
- package/out/validation/shared.js +12 -0
- package/out/validation/shared.js.map +1 -0
- package/package.json +110 -0
- package/src/ast-augmentation.ts +5 -0
- package/src/domain-lang-module.ts +112 -0
- package/src/domain-lang.langium +351 -0
- package/src/generated/ast.ts +986 -0
- package/src/generated/grammar.ts +2409 -0
- package/src/generated/module.ts +25 -0
- package/src/index.ts +24 -0
- package/src/lsp/domain-lang-code-actions.ts +189 -0
- package/src/lsp/domain-lang-completion.ts +514 -0
- package/src/lsp/domain-lang-formatter.ts +51 -0
- package/src/lsp/domain-lang-naming.ts +56 -0
- package/src/lsp/domain-lang-scope.ts +137 -0
- package/src/lsp/domain-lang-workspace-manager.ts +104 -0
- package/src/lsp/hover/ddd-pattern-explanations.ts +237 -0
- package/src/lsp/hover/domain-lang-hover.ts +338 -0
- package/src/lsp/hover/domain-lang-keywords.ts +50 -0
- package/src/lsp/manifest-diagnostics.ts +290 -0
- package/src/main-browser.ts +15 -0
- package/src/main.ts +85 -0
- package/src/sdk/README.md +297 -0
- package/src/sdk/ast-augmentation.ts +157 -0
- package/src/sdk/index.ts +126 -0
- package/src/sdk/indexes.ts +155 -0
- package/src/sdk/loader-node.ts +146 -0
- package/src/sdk/loader.ts +99 -0
- package/src/sdk/patterns.ts +147 -0
- package/src/sdk/query.ts +802 -0
- package/src/sdk/resolution.ts +78 -0
- package/src/sdk/types.ts +323 -0
- package/src/services/dependency-analyzer.ts +321 -0
- package/src/services/dependency-resolver.ts +551 -0
- package/src/services/git-url-resolver.browser.ts +26 -0
- package/src/services/git-url-resolver.ts +517 -0
- package/src/services/governance-validator.ts +177 -0
- package/src/services/import-resolver.ts +292 -0
- package/src/services/performance-optimizer.ts +170 -0
- package/src/services/relationship-inference.ts +121 -0
- package/src/services/semver.ts +213 -0
- package/src/services/types.ts +415 -0
- package/src/services/workspace-manager.ts +607 -0
- package/src/syntaxes/domain-lang.monarch.ts +29 -0
- package/src/utils/import-utils.ts +152 -0
- package/src/validation/bounded-context.ts +99 -0
- package/src/validation/classification.ts +5 -0
- package/src/validation/constants.ts +304 -0
- package/src/validation/domain-lang-validator.ts +33 -0
- package/src/validation/domain.ts +77 -0
- package/src/validation/import.ts +295 -0
- package/src/validation/manifest.ts +439 -0
- package/src/validation/maps.ts +76 -0
- package/src/validation/metadata.ts +18 -0
- package/src/validation/model.ts +37 -0
- package/src/validation/relationships.ts +154 -0
- package/src/validation/shared.ts +14 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
keywords: string[];
|
|
3
|
+
operators: string[];
|
|
4
|
+
symbols: RegExp;
|
|
5
|
+
tokenizer: {
|
|
6
|
+
initial: ({
|
|
7
|
+
regex: RegExp;
|
|
8
|
+
action: {
|
|
9
|
+
cases: {
|
|
10
|
+
'@keywords': {
|
|
11
|
+
token: string;
|
|
12
|
+
};
|
|
13
|
+
'@default': {
|
|
14
|
+
token: string;
|
|
15
|
+
};
|
|
16
|
+
'@operators'?: undefined;
|
|
17
|
+
};
|
|
18
|
+
token?: undefined;
|
|
19
|
+
};
|
|
20
|
+
include?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
regex: RegExp;
|
|
23
|
+
action: {
|
|
24
|
+
token: string;
|
|
25
|
+
cases?: undefined;
|
|
26
|
+
};
|
|
27
|
+
include?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
include: string;
|
|
30
|
+
regex?: undefined;
|
|
31
|
+
action?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
regex: RegExp;
|
|
34
|
+
action: {
|
|
35
|
+
cases: {
|
|
36
|
+
'@operators': {
|
|
37
|
+
token: string;
|
|
38
|
+
};
|
|
39
|
+
'@default': {
|
|
40
|
+
token: string;
|
|
41
|
+
};
|
|
42
|
+
'@keywords'?: undefined;
|
|
43
|
+
};
|
|
44
|
+
token?: undefined;
|
|
45
|
+
};
|
|
46
|
+
include?: undefined;
|
|
47
|
+
})[];
|
|
48
|
+
whitespace: ({
|
|
49
|
+
regex: RegExp;
|
|
50
|
+
action: {
|
|
51
|
+
token: string;
|
|
52
|
+
next?: undefined;
|
|
53
|
+
};
|
|
54
|
+
} | {
|
|
55
|
+
regex: RegExp;
|
|
56
|
+
action: {
|
|
57
|
+
token: string;
|
|
58
|
+
next: string;
|
|
59
|
+
};
|
|
60
|
+
})[];
|
|
61
|
+
comment: ({
|
|
62
|
+
regex: RegExp;
|
|
63
|
+
action: {
|
|
64
|
+
token: string;
|
|
65
|
+
next?: undefined;
|
|
66
|
+
};
|
|
67
|
+
} | {
|
|
68
|
+
regex: RegExp;
|
|
69
|
+
action: {
|
|
70
|
+
token: string;
|
|
71
|
+
next: string;
|
|
72
|
+
};
|
|
73
|
+
})[];
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Monarch syntax highlighting for the domain-lang language.
|
|
2
|
+
export default {
|
|
3
|
+
keywords: [
|
|
4
|
+
'ACL', 'AntiCorruptionLayer', 'BBoM', 'BigBallOfMud', 'BoundedContext', 'CF', 'Classification', 'Conformist', 'ContextMap', 'CustomerSupplier', 'Decision', 'Domain', 'DomainMap', 'Import', 'Metadata', 'Namespace', 'OHS', 'OpenHostService', 'P', 'PL', 'Partnership', 'Policy', 'PublishedLanguage', 'Rule', 'SK', 'SeparateWays', 'SharedKernel', 'Team', 'Term', 'UpstreamDownstream', 'aka', 'archetype', 'as', 'bc', 'businessModel', 'by', 'classification', 'cmap', 'contains', 'decision', 'decisions', 'description', 'dmap', 'dom', 'evolution', 'examples', 'for', 'glossary', 'import', 'in', 'integrations', 'is', 'meta', 'metadata', 'ns', 'policy', 'relationships', 'rule', 'rules', 'synonyms', 'team', 'term', 'terminology', 'this', 'type', 'vision'
|
|
5
|
+
],
|
|
6
|
+
operators: [
|
|
7
|
+
',', '->', '.', ':', '<-', '<->', '=', '><'
|
|
8
|
+
],
|
|
9
|
+
symbols: /,|->|\.|:|<-|<->|=|><|\[|\]|\{|\}/,
|
|
10
|
+
tokenizer: {
|
|
11
|
+
initial: [
|
|
12
|
+
{ regex: /[_a-zA-Z][\w_-]*/, action: { cases: { '@keywords': { "token": "keyword" }, '@default': { "token": "ID" } } } },
|
|
13
|
+
{ regex: /"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/, action: { "token": "string" } },
|
|
14
|
+
{ include: '@whitespace' },
|
|
15
|
+
{ regex: /@symbols/, action: { cases: { '@operators': { "token": "operator" }, '@default': { "token": "" } } } },
|
|
16
|
+
],
|
|
17
|
+
whitespace: [
|
|
18
|
+
{ regex: /\s+/, action: { "token": "white" } },
|
|
19
|
+
{ regex: /\/\*/, action: { "token": "comment", "next": "@comment" } },
|
|
20
|
+
{ regex: /\/\/[^\n\r]*/, action: { "token": "comment" } },
|
|
21
|
+
],
|
|
22
|
+
comment: [
|
|
23
|
+
{ regex: /[^/\*]+/, action: { "token": "comment" } },
|
|
24
|
+
{ regex: /\*\//, action: { "token": "comment", "next": "@pop" } },
|
|
25
|
+
{ regex: /[/\*]/, action: { "token": "comment" } },
|
|
26
|
+
],
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=domain-lang.monarch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-lang.monarch.js","sourceRoot":"","sources":["../../src/syntaxes/domain-lang.monarch.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,eAAe;IACX,QAAQ,EAAE;QACN,KAAK,EAAC,qBAAqB,EAAC,MAAM,EAAC,cAAc,EAAC,gBAAgB,EAAC,IAAI,EAAC,gBAAgB,EAAC,YAAY,EAAC,YAAY,EAAC,kBAAkB,EAAC,UAAU,EAAC,QAAQ,EAAC,WAAW,EAAC,QAAQ,EAAC,UAAU,EAAC,WAAW,EAAC,KAAK,EAAC,iBAAiB,EAAC,GAAG,EAAC,IAAI,EAAC,aAAa,EAAC,QAAQ,EAAC,mBAAmB,EAAC,MAAM,EAAC,IAAI,EAAC,cAAc,EAAC,cAAc,EAAC,MAAM,EAAC,MAAM,EAAC,oBAAoB,EAAC,KAAK,EAAC,WAAW,EAAC,IAAI,EAAC,IAAI,EAAC,eAAe,EAAC,IAAI,EAAC,gBAAgB,EAAC,MAAM,EAAC,UAAU,EAAC,UAAU,EAAC,WAAW,EAAC,aAAa,EAAC,MAAM,EAAC,KAAK,EAAC,WAAW,EAAC,UAAU,EAAC,KAAK,EAAC,UAAU,EAAC,QAAQ,EAAC,IAAI,EAAC,cAAc,EAAC,IAAI,EAAC,MAAM,EAAC,UAAU,EAAC,IAAI,EAAC,QAAQ,EAAC,eAAe,EAAC,MAAM,EAAC,OAAO,EAAC,UAAU,EAAC,MAAM,EAAC,MAAM,EAAC,aAAa,EAAC,MAAM,EAAC,MAAM,EAAC,QAAQ;KAC9qB;IACD,SAAS,EAAE;QACP,GAAG,EAAC,IAAI,EAAC,GAAG,EAAC,GAAG,EAAC,IAAI,EAAC,KAAK,EAAC,GAAG,EAAC,IAAI;KACvC;IACD,OAAO,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from 'langium';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves an import path to an absolute file URI.
|
|
4
|
+
*
|
|
5
|
+
* Delegates to ImportResolver which implements PRS-010 semantics:
|
|
6
|
+
* - File imports (with .dlang extension): Direct file access
|
|
7
|
+
* - Module imports (no extension): Requires model.yaml in directory
|
|
8
|
+
* - External dependencies: Resolved via manifest and lock file
|
|
9
|
+
*
|
|
10
|
+
* @param importingDoc - The document containing the import statement
|
|
11
|
+
* @param rawImportPath - The raw import path from the import statement
|
|
12
|
+
* @returns Resolved URI to the imported file
|
|
13
|
+
* @throws {Error} If the import cannot be resolved
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveImportPath(importingDoc: LangiumDocument, rawImportPath: string): Promise<URI>;
|
|
16
|
+
/**
|
|
17
|
+
* Ensures the import graph is loaded from an entry file.
|
|
18
|
+
*
|
|
19
|
+
* @param entryFilePath - Absolute or workspace-relative path to entry file
|
|
20
|
+
* @param langiumDocuments - The Langium documents manager
|
|
21
|
+
* @returns Set of URIs (as strings) for all documents in the import graph
|
|
22
|
+
* @throws {Error} If entry file cannot be resolved or loaded
|
|
23
|
+
*/
|
|
24
|
+
export declare function ensureImportGraphFromEntryFile(entryFilePath: string, langiumDocuments: LangiumDocuments): Promise<Set<string>>;
|
|
25
|
+
/**
|
|
26
|
+
* Recursively builds the import graph from a document.
|
|
27
|
+
*
|
|
28
|
+
* @param document - The starting document
|
|
29
|
+
* @param langiumDocuments - The Langium documents manager
|
|
30
|
+
* @returns Set of URIs (as strings) for all documents in the import graph
|
|
31
|
+
*/
|
|
32
|
+
export declare function ensureImportGraphFromDocument(document: LangiumDocument, langiumDocuments: LangiumDocuments): Promise<Set<string>>;
|
|
33
|
+
/**
|
|
34
|
+
* Gets cache statistics for git imports.
|
|
35
|
+
*
|
|
36
|
+
* @returns Cache statistics including size and number of cached repositories
|
|
37
|
+
*/
|
|
38
|
+
export declare function getGitCacheStats(startDir?: string): Promise<{
|
|
39
|
+
totalSize: number;
|
|
40
|
+
repoCount: number;
|
|
41
|
+
cacheDir: string;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Clears the git import cache.
|
|
45
|
+
*
|
|
46
|
+
* @param startDir - Starting directory for workspace resolution
|
|
47
|
+
* @returns Promise that resolves when cache is cleared
|
|
48
|
+
*/
|
|
49
|
+
export declare function clearGitCache(startDir?: string): Promise<void>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { URI } from 'langium';
|
|
3
|
+
import { WorkspaceManager } from '../services/workspace-manager.js';
|
|
4
|
+
import { ImportResolver } from '../services/import-resolver.js';
|
|
5
|
+
/**
|
|
6
|
+
* Lazily initialized workspace manager for standalone (non-LSP) usage.
|
|
7
|
+
* Used by import graph building when services aren't available from DI.
|
|
8
|
+
*/
|
|
9
|
+
let standaloneWorkspaceManager;
|
|
10
|
+
let standaloneImportResolver;
|
|
11
|
+
let lastInitializedDir;
|
|
12
|
+
/**
|
|
13
|
+
* Gets or creates a standalone import resolver for non-LSP contexts.
|
|
14
|
+
* Creates its own WorkspaceManager if not previously initialized for this directory.
|
|
15
|
+
*
|
|
16
|
+
* NOTE: In LSP contexts, prefer using services.imports.ImportResolver directly.
|
|
17
|
+
* This function exists for utilities that don't have access to the service container.
|
|
18
|
+
*
|
|
19
|
+
* @param startDir - Directory to start workspace search from
|
|
20
|
+
* @returns Promise resolving to the import resolver
|
|
21
|
+
*/
|
|
22
|
+
async function getStandaloneImportResolver(startDir) {
|
|
23
|
+
// Re-initialize if directory changed (workspace boundary)
|
|
24
|
+
if (lastInitializedDir !== startDir || !standaloneImportResolver) {
|
|
25
|
+
standaloneWorkspaceManager = new WorkspaceManager({ autoResolve: false, allowNetwork: false });
|
|
26
|
+
try {
|
|
27
|
+
await standaloneWorkspaceManager.initialize(startDir);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.warn(`Failed to initialize workspace: ${error instanceof Error ? error.message : String(error)}`);
|
|
31
|
+
}
|
|
32
|
+
const services = {
|
|
33
|
+
imports: { WorkspaceManager: standaloneWorkspaceManager }
|
|
34
|
+
};
|
|
35
|
+
standaloneImportResolver = new ImportResolver(services);
|
|
36
|
+
lastInitializedDir = startDir;
|
|
37
|
+
}
|
|
38
|
+
return standaloneImportResolver;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Gets the git URL resolver from a workspace manager.
|
|
42
|
+
*
|
|
43
|
+
* @param startDir - Directory to start workspace search from
|
|
44
|
+
* @returns Promise resolving to the git URL resolver
|
|
45
|
+
*/
|
|
46
|
+
async function getGitResolver(startDir) {
|
|
47
|
+
const workspaceManager = new WorkspaceManager({ autoResolve: false, allowNetwork: false });
|
|
48
|
+
await workspaceManager.initialize(startDir);
|
|
49
|
+
return workspaceManager.getGitResolver();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Resolves an import path to an absolute file URI.
|
|
53
|
+
*
|
|
54
|
+
* Delegates to ImportResolver which implements PRS-010 semantics:
|
|
55
|
+
* - File imports (with .dlang extension): Direct file access
|
|
56
|
+
* - Module imports (no extension): Requires model.yaml in directory
|
|
57
|
+
* - External dependencies: Resolved via manifest and lock file
|
|
58
|
+
*
|
|
59
|
+
* @param importingDoc - The document containing the import statement
|
|
60
|
+
* @param rawImportPath - The raw import path from the import statement
|
|
61
|
+
* @returns Resolved URI to the imported file
|
|
62
|
+
* @throws {Error} If the import cannot be resolved
|
|
63
|
+
*/
|
|
64
|
+
export async function resolveImportPath(importingDoc, rawImportPath) {
|
|
65
|
+
const baseDir = path.dirname(importingDoc.uri.fsPath);
|
|
66
|
+
const resolver = await getStandaloneImportResolver(baseDir);
|
|
67
|
+
return resolver.resolveFrom(baseDir, rawImportPath);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Ensures the import graph is loaded from an entry file.
|
|
71
|
+
*
|
|
72
|
+
* @param entryFilePath - Absolute or workspace-relative path to entry file
|
|
73
|
+
* @param langiumDocuments - The Langium documents manager
|
|
74
|
+
* @returns Set of URIs (as strings) for all documents in the import graph
|
|
75
|
+
* @throws {Error} If entry file cannot be resolved or loaded
|
|
76
|
+
*/
|
|
77
|
+
export async function ensureImportGraphFromEntryFile(entryFilePath, langiumDocuments) {
|
|
78
|
+
const entryUri = URI.file(path.resolve(entryFilePath));
|
|
79
|
+
const entryDoc = await langiumDocuments.getOrCreateDocument(entryUri);
|
|
80
|
+
return ensureImportGraphFromDocument(entryDoc, langiumDocuments);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Recursively builds the import graph from a document.
|
|
84
|
+
*
|
|
85
|
+
* @param document - The starting document
|
|
86
|
+
* @param langiumDocuments - The Langium documents manager
|
|
87
|
+
* @returns Set of URIs (as strings) for all documents in the import graph
|
|
88
|
+
*/
|
|
89
|
+
export async function ensureImportGraphFromDocument(document, langiumDocuments) {
|
|
90
|
+
const visited = new Set();
|
|
91
|
+
async function visit(doc) {
|
|
92
|
+
const uriString = doc.uri.toString();
|
|
93
|
+
if (visited.has(uriString))
|
|
94
|
+
return;
|
|
95
|
+
visited.add(uriString);
|
|
96
|
+
const model = doc.parseResult.value;
|
|
97
|
+
for (const imp of model.imports ?? []) {
|
|
98
|
+
if (!imp.uri)
|
|
99
|
+
continue;
|
|
100
|
+
// Use new resolveImportPath that supports git URLs
|
|
101
|
+
const resolvedUri = await resolveImportPath(doc, imp.uri);
|
|
102
|
+
const childDoc = await langiumDocuments.getOrCreateDocument(resolvedUri);
|
|
103
|
+
await visit(childDoc);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
await visit(document);
|
|
107
|
+
return visited;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Gets cache statistics for git imports.
|
|
111
|
+
*
|
|
112
|
+
* @returns Cache statistics including size and number of cached repositories
|
|
113
|
+
*/
|
|
114
|
+
export async function getGitCacheStats(startDir = process.cwd()) {
|
|
115
|
+
const resolver = await getGitResolver(startDir);
|
|
116
|
+
return await resolver.getCacheStats();
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Clears the git import cache.
|
|
120
|
+
*
|
|
121
|
+
* @param startDir - Starting directory for workspace resolution
|
|
122
|
+
* @returns Promise that resolves when cache is cleared
|
|
123
|
+
*/
|
|
124
|
+
export async function clearGitCache(startDir = process.cwd()) {
|
|
125
|
+
const resolver = await getGitResolver(startDir);
|
|
126
|
+
return await resolver.clearCache();
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=import-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-utils.js","sourceRoot":"","sources":["../../src/utils/import-utils.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,GAAG,EAA+C,MAAM,SAAS,CAAC;AAG3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGhE;;;GAGG;AACH,IAAI,0BAAwD,CAAC;AAC7D,IAAI,wBAAoD,CAAC;AACzD,IAAI,kBAAsC,CAAC;AAE3C;;;;;;;;;GASG;AACH,KAAK,UAAU,2BAA2B,CAAC,QAAgB;IACzD,0DAA0D;IAC1D,IAAI,kBAAkB,KAAK,QAAQ,IAAI,CAAC,wBAAwB,EAAE,CAAC;QACjE,0BAA0B,GAAG,IAAI,gBAAgB,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/F,IAAI,CAAC;YACH,MAAM,0BAA0B,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,mCAAmC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC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|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ValidationAcceptor } from 'langium';
|
|
2
|
+
import type { BoundedContext } from '../generated/ast.js';
|
|
3
|
+
/**
|
|
4
|
+
* Validates that a bounded context has a description.
|
|
5
|
+
*
|
|
6
|
+
* @param bc - The bounded context to validate
|
|
7
|
+
* @param accept - The validation acceptor for reporting issues
|
|
8
|
+
*/
|
|
9
|
+
declare function validateBoundedContextHasDescription(bc: BoundedContext, accept: ValidationAcceptor): void;
|
|
10
|
+
export declare const boundedContextChecks: (typeof validateBoundedContextHasDescription)[];
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ValidationMessages, buildCodeDescription } from './constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates that a bounded context has a description.
|
|
4
|
+
*
|
|
5
|
+
* @param bc - The bounded context to validate
|
|
6
|
+
* @param accept - The validation acceptor for reporting issues
|
|
7
|
+
*/
|
|
8
|
+
function validateBoundedContextHasDescription(bc, accept) {
|
|
9
|
+
if (!bc.description) {
|
|
10
|
+
accept('warning', ValidationMessages.BOUNDED_CONTEXT_NO_DESCRIPTION(bc.name), {
|
|
11
|
+
node: bc,
|
|
12
|
+
keyword: 'BoundedContext',
|
|
13
|
+
codeDescription: buildCodeDescription('language.md', 'bounded-contexts')
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Validates that a bounded context belongs to a domain.
|
|
19
|
+
* A BoundedContext must have a 'for Domain' clause.
|
|
20
|
+
*
|
|
21
|
+
* @param bc - The bounded context to validate
|
|
22
|
+
* @param accept - The validation acceptor for reporting issues
|
|
23
|
+
*/
|
|
24
|
+
function validateBoundedContextHasDomain(bc, accept) {
|
|
25
|
+
if (!bc.domain) {
|
|
26
|
+
accept('warning', ValidationMessages.BOUNDED_CONTEXT_NO_DOMAIN(bc.name), {
|
|
27
|
+
node: bc,
|
|
28
|
+
keyword: 'for',
|
|
29
|
+
codeDescription: buildCodeDescription('language.md', 'bounded-contexts')
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Validates conflicts between inline and block classification assignment.
|
|
35
|
+
* Warns when both inline ('as') and block ('classification:') are used.
|
|
36
|
+
* Inline values take precedence per PRS-008.
|
|
37
|
+
*
|
|
38
|
+
* FR-9.2: Inline/Block Conflict Validation
|
|
39
|
+
*/
|
|
40
|
+
function validateBoundedContextClassificationConflict(bc, accept) {
|
|
41
|
+
if (bc.classification.length > 1) {
|
|
42
|
+
const inlineClassificationName = bc.classification[0].ref?.name;
|
|
43
|
+
const blockClassificationName = bc.classification[1].ref?.name;
|
|
44
|
+
// Warn if defined multiple times
|
|
45
|
+
accept('warning', ValidationMessages.BOUNDED_CONTEXT_CLASSIFICATION_CONFLICT(bc.name, inlineClassificationName, blockClassificationName), {
|
|
46
|
+
node: bc,
|
|
47
|
+
property: 'classification',
|
|
48
|
+
index: 1,
|
|
49
|
+
codeDescription: buildCodeDescription('language.md', 'bounded-contexts')
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Validates conflicts between inline and block team assignment.
|
|
55
|
+
* Warns when both inline ('by') and block ('team:') are used.
|
|
56
|
+
* Inline values take precedence per PRS-008.
|
|
57
|
+
*
|
|
58
|
+
* FR-2.3: Inline/Block Conflict Validation
|
|
59
|
+
*/
|
|
60
|
+
function validateBoundedContextTeamConflict(bc, accept) {
|
|
61
|
+
if (bc.team.length > 1) {
|
|
62
|
+
const inlineTeamName = bc.team[0].ref?.name;
|
|
63
|
+
const blockTeamName = bc.team[1].ref?.name;
|
|
64
|
+
// Warn if defined multiple times
|
|
65
|
+
accept('warning', ValidationMessages.BOUNDED_CONTEXT_TEAM_CONFLICT(bc.name, inlineTeamName, blockTeamName), {
|
|
66
|
+
node: bc,
|
|
67
|
+
property: 'team',
|
|
68
|
+
index: 1,
|
|
69
|
+
codeDescription: buildCodeDescription('language.md', 'bounded-contexts')
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export const boundedContextChecks = [
|
|
74
|
+
validateBoundedContextHasDescription,
|
|
75
|
+
validateBoundedContextHasDomain,
|
|
76
|
+
validateBoundedContextClassificationConflict,
|
|
77
|
+
validateBoundedContextTeamConflict
|
|
78
|
+
];
|
|
79
|
+
//# sourceMappingURL=bounded-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounded-context.js","sourceRoot":"","sources":["../../src/validation/bounded-context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE1E;;;;;GAKG;AACH,SAAS,oCAAoC,CACzC,EAAkB,EAClB,MAA0B;IAE1B,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;QAClB,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC,8BAA8B,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE;YAC1E,IAAI,EAAE,EAAE;YACR,OAAO,EAAE,gBAAgB;YACzB,eAAe,EAAE,oBAAoB,CAAC,aAAa,EAAE,kBAAkB,CAAC;SAC3E,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAS,+BAA+B,CACpC,EAAkB,EAClB,MAA0B;IAE1B,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;QACb,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC,yBAAyB,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE;YACrE,IAAI,EAAE,EAAE;YACR,OAAO,EAAE,KAAK;YACd,eAAe,EAAE,oBAAoB,CAAC,aAAa,EAAE,kBAAkB,CAAC;SAC3E,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAS,4CAA4C,CACjD,EAAkB,EAClB,MAA0B;IAE1B,IAAI,EAAE,CAA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IAC5C,kCAAkC;CACrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classification.js","sourceRoot":"","sources":["../../src/validation/classification.ts"],"names":[],"mappings":"AAGA,4DAA4D;AAC5D,MAAM,CAAC,MAAM,oBAAoB,GAAsC,EAAE,CAAC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation message constants for DomainLang.
|
|
3
|
+
*
|
|
4
|
+
* Centralizes all validation messages to ensure consistency
|
|
5
|
+
* and facilitate internationalization in the future.
|
|
6
|
+
*
|
|
7
|
+
* Messages follow VS Code conventions:
|
|
8
|
+
* - Clear problem statement
|
|
9
|
+
* - Brief DDD context explaining why it matters
|
|
10
|
+
* - Inline example showing the fix
|
|
11
|
+
* - Clickable documentation link via CodeDescription
|
|
12
|
+
*/
|
|
13
|
+
import type { CodeDescription } from 'vscode-languageserver-types';
|
|
14
|
+
/**
|
|
15
|
+
* Diagnostic codes used to identify validation issues.
|
|
16
|
+
* Code actions match on these codes to provide quick fixes.
|
|
17
|
+
*
|
|
18
|
+
* Naming convention: CATEGORY_SPECIFIC_ISSUE
|
|
19
|
+
*/
|
|
20
|
+
export declare const IssueCodes: {
|
|
21
|
+
readonly ImportMissingUri: "import-missing-uri";
|
|
22
|
+
readonly ImportRequiresManifest: "import-requires-manifest";
|
|
23
|
+
readonly ImportNotInManifest: "import-not-in-manifest";
|
|
24
|
+
readonly ImportNotInstalled: "import-not-installed";
|
|
25
|
+
readonly ImportConflictingSourcePath: "import-conflicting-source-path";
|
|
26
|
+
readonly ImportMissingSourceOrPath: "import-missing-source-or-path";
|
|
27
|
+
readonly ImportMissingRef: "import-missing-ref";
|
|
28
|
+
readonly ImportAbsolutePath: "import-absolute-path";
|
|
29
|
+
readonly ImportEscapesWorkspace: "import-escapes-workspace";
|
|
30
|
+
readonly DomainNoVision: "domain-no-vision";
|
|
31
|
+
readonly DomainCircularHierarchy: "domain-circular-hierarchy";
|
|
32
|
+
readonly BoundedContextNoDescription: "bounded-context-no-description";
|
|
33
|
+
readonly BoundedContextNoDomain: "bounded-context-no-domain";
|
|
34
|
+
readonly BoundedContextClassificationConflict: "bounded-context-classification-conflict";
|
|
35
|
+
readonly BoundedContextTeamConflict: "bounded-context-team-conflict";
|
|
36
|
+
readonly SharedKernelNotBidirectional: "shared-kernel-not-bidirectional";
|
|
37
|
+
readonly AclOnWrongSide: "acl-on-wrong-side";
|
|
38
|
+
readonly ConformistOnWrongSide: "conformist-on-wrong-side";
|
|
39
|
+
readonly TooManyPatterns: "too-many-patterns";
|
|
40
|
+
readonly ContextMapNoContexts: "context-map-no-contexts";
|
|
41
|
+
readonly ContextMapNoRelationships: "context-map-no-relationships";
|
|
42
|
+
readonly DomainMapNoDomains: "domain-map-no-domains";
|
|
43
|
+
readonly MetadataMissingName: "metadata-missing-name";
|
|
44
|
+
readonly DuplicateElement: "duplicate-element";
|
|
45
|
+
};
|
|
46
|
+
export type IssueCode = typeof IssueCodes[keyof typeof IssueCodes];
|
|
47
|
+
/**
|
|
48
|
+
* Creates a CodeDescription for clickable documentation links in VS Code.
|
|
49
|
+
* @param docPath - Relative path from docs/ folder
|
|
50
|
+
* @param anchor - Optional section anchor (without #)
|
|
51
|
+
*/
|
|
52
|
+
export declare const buildCodeDescription: (docPath: string, anchor?: string) => CodeDescription;
|
|
53
|
+
export declare const ValidationMessages: {
|
|
54
|
+
/**
|
|
55
|
+
* Warning message when a domain lacks a vision statement.
|
|
56
|
+
* @param name - The name of the domain
|
|
57
|
+
*/
|
|
58
|
+
readonly DOMAIN_NO_VISION: (name: string) => string;
|
|
59
|
+
/**
|
|
60
|
+
* Error message when a circular domain hierarchy is detected.
|
|
61
|
+
* @param cycle - Array of domain names forming the cycle
|
|
62
|
+
*/
|
|
63
|
+
readonly DOMAIN_CIRCULAR_HIERARCHY: (cycle: string[]) => string;
|
|
64
|
+
/**
|
|
65
|
+
* Warning message when a bounded context lacks a description.
|
|
66
|
+
* @param name - The name of the bounded context
|
|
67
|
+
*/
|
|
68
|
+
readonly BOUNDED_CONTEXT_NO_DESCRIPTION: (name: string) => string;
|
|
69
|
+
/**
|
|
70
|
+
* Warning message when a bounded context lacks a domain reference.
|
|
71
|
+
* @param name - The name of the bounded context
|
|
72
|
+
*/
|
|
73
|
+
readonly BOUNDED_CONTEXT_NO_DOMAIN: (name: string) => string;
|
|
74
|
+
/**
|
|
75
|
+
* Warning when classification is specified both inline and in a block.
|
|
76
|
+
* Inline value takes precedence.
|
|
77
|
+
* @param bcName - The name of the bounded context
|
|
78
|
+
* @param inlineClassification - The inline classification name (from 'as')
|
|
79
|
+
* @param blockClassification - The block classification name (from 'classification:')
|
|
80
|
+
*/
|
|
81
|
+
readonly BOUNDED_CONTEXT_CLASSIFICATION_CONFLICT: (bcName: string, inlineClassification?: string, blockClassification?: string) => string;
|
|
82
|
+
/**
|
|
83
|
+
* Warning when team is specified both inline and in a block.
|
|
84
|
+
* Inline value takes precedence.
|
|
85
|
+
* @param bcName - The name of the bounded context
|
|
86
|
+
* @param inlineTeam - The inline team name (from 'by')
|
|
87
|
+
* @param blockTeam - The block team name (from 'team:')
|
|
88
|
+
*/
|
|
89
|
+
readonly BOUNDED_CONTEXT_TEAM_CONFLICT: (bcName: string, inlineTeam?: string, blockTeam?: string) => string;
|
|
90
|
+
/**
|
|
91
|
+
* Error message when an element is defined multiple times.
|
|
92
|
+
* @param fqn - The fully qualified name of the duplicate element
|
|
93
|
+
*/
|
|
94
|
+
readonly DUPLICATE_ELEMENT: (fqn: string) => string;
|
|
95
|
+
/**
|
|
96
|
+
* Warning when SharedKernel pattern uses incorrect arrow direction.
|
|
97
|
+
* SharedKernel requires bidirectional relationship.
|
|
98
|
+
*/
|
|
99
|
+
readonly SHARED_KERNEL_MUST_BE_BIDIRECTIONAL: (leftContext: string, rightContext: string, arrow: string) => string;
|
|
100
|
+
/**
|
|
101
|
+
* Warning when Anti-Corruption Layer is on the wrong side of relationship.
|
|
102
|
+
* ACL should protect the consuming context (downstream).
|
|
103
|
+
*/
|
|
104
|
+
readonly ACL_ON_WRONG_SIDE: (context: string, side: "left" | "right") => string;
|
|
105
|
+
/**
|
|
106
|
+
* Warning when Conformist pattern is on the wrong side.
|
|
107
|
+
* Conformist accepts upstream model without translation.
|
|
108
|
+
*/
|
|
109
|
+
readonly CONFORMIST_ON_WRONG_SIDE: (context: string, side: "left" | "right") => string;
|
|
110
|
+
/**
|
|
111
|
+
* Info message when relationship has too many integration patterns.
|
|
112
|
+
* Suggests possible syntax confusion.
|
|
113
|
+
*/
|
|
114
|
+
readonly TOO_MANY_PATTERNS: (count: number, side: "left" | "right") => string;
|
|
115
|
+
/**
|
|
116
|
+
* Error when import statement has no URI.
|
|
117
|
+
*/
|
|
118
|
+
readonly IMPORT_MISSING_URI: () => string;
|
|
119
|
+
/**
|
|
120
|
+
* Error when external dependency requires model.yaml but none exists.
|
|
121
|
+
* @param specifier - The import specifier (e.g., "core", "domainlang/patterns")
|
|
122
|
+
*/
|
|
123
|
+
readonly IMPORT_REQUIRES_MANIFEST: (specifier: string) => string;
|
|
124
|
+
/**
|
|
125
|
+
* Error when import specifier not found in manifest dependencies.
|
|
126
|
+
* @param alias - The dependency alias/specifier
|
|
127
|
+
*/
|
|
128
|
+
readonly IMPORT_NOT_IN_MANIFEST: (alias: string) => string;
|
|
129
|
+
/**
|
|
130
|
+
* Error when dependency not installed (no lock file entry).
|
|
131
|
+
* @param alias - The dependency alias
|
|
132
|
+
*/
|
|
133
|
+
readonly IMPORT_NOT_INSTALLED: (alias: string) => string;
|
|
134
|
+
/**
|
|
135
|
+
* Error when dependency has conflicting source and path definitions.
|
|
136
|
+
* @param alias - The dependency alias
|
|
137
|
+
*/
|
|
138
|
+
readonly IMPORT_CONFLICTING_SOURCE_PATH: (alias: string) => string;
|
|
139
|
+
/**
|
|
140
|
+
* Error when dependency is missing both source and path.
|
|
141
|
+
* @param alias - The dependency alias
|
|
142
|
+
*/
|
|
143
|
+
readonly IMPORT_MISSING_SOURCE_OR_PATH: (alias: string) => string;
|
|
144
|
+
/**
|
|
145
|
+
* Error when git dependency is missing ref (tag, branch, or commit).
|
|
146
|
+
* @param alias - The dependency alias
|
|
147
|
+
*/
|
|
148
|
+
readonly IMPORT_MISSING_REF: (alias: string) => string;
|
|
149
|
+
/**
|
|
150
|
+
* Error when local path uses absolute path.
|
|
151
|
+
* @param alias - The dependency alias
|
|
152
|
+
* @param absolutePath - The absolute path that was specified
|
|
153
|
+
*/
|
|
154
|
+
readonly IMPORT_ABSOLUTE_PATH: (alias: string, absolutePath: string) => string;
|
|
155
|
+
/**
|
|
156
|
+
* Error when local path escapes workspace boundary.
|
|
157
|
+
* @param alias - The dependency alias
|
|
158
|
+
*/
|
|
159
|
+
readonly IMPORT_ESCAPES_WORKSPACE: (alias: string) => string;
|
|
160
|
+
/**
|
|
161
|
+
* Warning when context map contains no bounded contexts.
|
|
162
|
+
* @param name - The context map name
|
|
163
|
+
*/
|
|
164
|
+
readonly CONTEXT_MAP_NO_CONTEXTS: (name: string) => string;
|
|
165
|
+
/**
|
|
166
|
+
* Info when context map has multiple contexts but no relationships.
|
|
167
|
+
* @param name - The context map name
|
|
168
|
+
* @param count - Number of contexts
|
|
169
|
+
*/
|
|
170
|
+
readonly CONTEXT_MAP_NO_RELATIONSHIPS: (name: string, count: number) => string;
|
|
171
|
+
/**
|
|
172
|
+
* Warning when domain map contains no domains.
|
|
173
|
+
* @param name - The domain map name
|
|
174
|
+
*/
|
|
175
|
+
readonly DOMAIN_MAP_NO_DOMAINS: (name: string) => string;
|
|
176
|
+
/**
|
|
177
|
+
* Error when metadata is missing a name.
|
|
178
|
+
*/
|
|
179
|
+
readonly METADATA_MISSING_NAME: () => string;
|
|
180
|
+
};
|