@domainlang/language 0.1.20 → 0.1.82
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/out/domain-lang-module.d.ts +0 -2
- package/out/domain-lang-module.js +3 -11
- package/out/domain-lang-module.js.map +1 -1
- package/out/generated/ast.d.ts +19 -8
- package/out/generated/ast.js +10 -1
- package/out/generated/ast.js.map +1 -1
- package/out/generated/grammar.d.ts +1 -1
- package/out/generated/grammar.js +123 -28
- package/out/generated/grammar.js.map +1 -1
- package/out/generated/module.d.ts +1 -1
- package/out/generated/module.js +1 -1
- package/out/index.d.ts +0 -3
- package/out/index.js +0 -5
- package/out/index.js.map +1 -1
- package/out/lsp/hover/domain-lang-hover.js +4 -0
- package/out/lsp/hover/domain-lang-hover.js.map +1 -1
- package/out/sdk/index.d.ts +1 -1
- package/out/sdk/loader-node.d.ts +3 -7
- package/out/sdk/loader-node.js +9 -24
- package/out/sdk/loader-node.js.map +1 -1
- package/out/sdk/types.d.ts +21 -0
- package/out/services/dependency-analyzer.d.ts +39 -3
- package/out/services/dependency-analyzer.js +47 -22
- package/out/services/dependency-analyzer.js.map +1 -1
- package/out/services/dependency-resolver.d.ts +45 -68
- package/out/services/dependency-resolver.js +43 -243
- package/out/services/dependency-resolver.js.map +1 -1
- package/out/services/git-url-resolver.browser.d.ts +12 -4
- package/out/services/git-url-resolver.browser.js +1 -5
- package/out/services/git-url-resolver.browser.js.map +1 -1
- package/out/services/git-url-resolver.d.ts +56 -22
- package/out/services/git-url-resolver.js +36 -70
- package/out/services/git-url-resolver.js.map +1 -1
- package/out/services/governance-validator.d.ts +37 -1
- package/out/services/governance-validator.js +10 -4
- package/out/services/governance-validator.js.map +1 -1
- package/out/services/import-resolver.d.ts +6 -65
- package/out/services/import-resolver.js +5 -223
- package/out/services/import-resolver.js.map +1 -1
- package/out/services/performance-optimizer.d.ts +1 -1
- package/out/services/workspace-manager.d.ts +10 -57
- package/out/services/workspace-manager.js +21 -187
- package/out/services/workspace-manager.js.map +1 -1
- package/out/syntaxes/domain-lang.monarch.js +1 -1
- package/out/syntaxes/domain-lang.monarch.js.map +1 -1
- package/out/utils/import-utils.d.ts +12 -4
- package/out/utils/import-utils.js +135 -35
- package/out/utils/import-utils.js.map +1 -1
- package/out/validation/constants.d.ts +0 -103
- package/out/validation/constants.js +1 -140
- package/out/validation/constants.js.map +1 -1
- package/out/validation/domain.js +1 -46
- package/out/validation/domain.js.map +1 -1
- package/out/validation/import.d.ts +22 -46
- package/out/validation/import.js +85 -187
- package/out/validation/import.js.map +1 -1
- package/out/validation/maps.js +6 -10
- package/out/validation/maps.js.map +1 -1
- package/out/validation/metadata.js +1 -5
- package/out/validation/metadata.js.map +1 -1
- package/package.json +6 -8
- package/src/domain-lang-module.ts +6 -18
- package/src/domain-lang.langium +12 -7
- package/src/generated/ast.ts +20 -7
- package/src/generated/grammar.ts +123 -28
- package/src/generated/module.ts +1 -1
- package/src/index.ts +0 -7
- package/src/lsp/hover/domain-lang-hover.ts +2 -0
- package/src/sdk/index.ts +2 -0
- package/src/sdk/loader-node.ts +9 -29
- package/src/sdk/types.ts +23 -0
- package/src/services/dependency-analyzer.ts +84 -24
- package/src/services/dependency-resolver.ts +84 -301
- package/src/services/git-url-resolver.browser.ts +14 -9
- package/src/services/git-url-resolver.ts +93 -86
- package/src/services/governance-validator.ts +47 -5
- package/src/services/import-resolver.ts +8 -270
- package/src/services/performance-optimizer.ts +1 -1
- package/src/services/workspace-manager.ts +46 -237
- package/src/syntaxes/domain-lang.monarch.ts +1 -1
- package/src/utils/import-utils.ts +160 -38
- package/src/validation/constants.ts +1 -181
- package/src/validation/domain.ts +1 -54
- package/src/validation/import.ts +104 -228
- package/src/validation/maps.ts +6 -10
- package/src/validation/metadata.ts +1 -5
- package/out/lsp/domain-lang-code-actions.d.ts +0 -55
- package/out/lsp/domain-lang-code-actions.js +0 -143
- package/out/lsp/domain-lang-code-actions.js.map +0 -1
- package/out/lsp/domain-lang-workspace-manager.d.ts +0 -21
- package/out/lsp/domain-lang-workspace-manager.js +0 -93
- package/out/lsp/domain-lang-workspace-manager.js.map +0 -1
- package/out/lsp/manifest-diagnostics.d.ts +0 -82
- package/out/lsp/manifest-diagnostics.js +0 -230
- package/out/lsp/manifest-diagnostics.js.map +0 -1
- package/out/services/semver.d.ts +0 -98
- package/out/services/semver.js +0 -195
- package/out/services/semver.js.map +0 -1
- package/out/services/types.d.ts +0 -340
- package/out/services/types.js +0 -46
- package/out/services/types.js.map +0 -1
- package/out/validation/manifest.d.ts +0 -144
- package/out/validation/manifest.js +0 -327
- package/out/validation/manifest.js.map +0 -1
- package/src/lsp/domain-lang-code-actions.ts +0 -189
- package/src/lsp/domain-lang-workspace-manager.ts +0 -104
- package/src/lsp/manifest-diagnostics.ts +0 -290
- package/src/services/semver.ts +0 -213
- package/src/services/types.ts +0 -415
- package/src/validation/manifest.ts +0 -439
|
@@ -2,9 +2,8 @@ import { type Module, inject } from 'langium';
|
|
|
2
2
|
import type {
|
|
3
3
|
DefaultSharedModuleContext,
|
|
4
4
|
LangiumServices,
|
|
5
|
-
LangiumSharedServices,
|
|
6
|
-
PartialLangiumServices
|
|
7
|
-
PartialLangiumSharedServices
|
|
5
|
+
LangiumSharedServices,
|
|
6
|
+
PartialLangiumServices
|
|
8
7
|
} from 'langium/lsp';
|
|
9
8
|
import { createDefaultModule, createDefaultSharedModule } from 'langium/lsp';
|
|
10
9
|
import { DomainLangGeneratedModule, DomainLangGeneratedSharedModule } from './generated/module.js';
|
|
@@ -14,10 +13,8 @@ import { DomainLangScopeComputation } from './lsp/domain-lang-scope.js';
|
|
|
14
13
|
import { DomainLangFormatter } from './lsp/domain-lang-formatter.js';
|
|
15
14
|
import { DomainLangHoverProvider } from './lsp/hover/domain-lang-hover.js';
|
|
16
15
|
import { DomainLangCompletionProvider } from './lsp/domain-lang-completion.js';
|
|
17
|
-
import { DomainLangCodeActionProvider } from './lsp/domain-lang-code-actions.js';
|
|
18
16
|
import { ImportResolver } from './services/import-resolver.js';
|
|
19
17
|
import { WorkspaceManager } from './services/workspace-manager.js';
|
|
20
|
-
import { DomainLangWorkspaceManager } from './lsp/domain-lang-workspace-manager.js';
|
|
21
18
|
|
|
22
19
|
/**
|
|
23
20
|
* Declaration of custom services - add your own service classes here.
|
|
@@ -33,8 +30,7 @@ export type DomainLangAddedServices = {
|
|
|
33
30
|
lsp: {
|
|
34
31
|
Formatter: DomainLangFormatter,
|
|
35
32
|
HoverProvider: DomainLangHoverProvider,
|
|
36
|
-
CompletionProvider: DomainLangCompletionProvider
|
|
37
|
-
CodeActionProvider: DomainLangCodeActionProvider
|
|
33
|
+
CompletionProvider: DomainLangCompletionProvider
|
|
38
34
|
}
|
|
39
35
|
}
|
|
40
36
|
|
|
@@ -44,12 +40,6 @@ export type DomainLangAddedServices = {
|
|
|
44
40
|
*/
|
|
45
41
|
export type DomainLangServices = LangiumServices & DomainLangAddedServices
|
|
46
42
|
|
|
47
|
-
const DomainLangSharedModule: Module<LangiumSharedServices, PartialLangiumSharedServices> = {
|
|
48
|
-
workspace: {
|
|
49
|
-
WorkspaceManager: (services: LangiumSharedServices) => new DomainLangWorkspaceManager(services)
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
43
|
/**
|
|
54
44
|
* Dependency injection module that overrides Langium default services and contributes the
|
|
55
45
|
* declared custom services. The Langium defaults can be partially specified to override only
|
|
@@ -58,7 +48,7 @@ const DomainLangSharedModule: Module<LangiumSharedServices, PartialLangiumShared
|
|
|
58
48
|
export const DomainLangModule: Module<DomainLangServices, PartialLangiumServices & DomainLangAddedServices> = {
|
|
59
49
|
imports: {
|
|
60
50
|
ImportResolver: (services) => new ImportResolver(services),
|
|
61
|
-
WorkspaceManager: () => new WorkspaceManager(
|
|
51
|
+
WorkspaceManager: () => new WorkspaceManager()
|
|
62
52
|
},
|
|
63
53
|
references: {
|
|
64
54
|
ScopeComputation: (services) => new DomainLangScopeComputation(services),
|
|
@@ -67,8 +57,7 @@ export const DomainLangModule: Module<DomainLangServices, PartialLangiumServices
|
|
|
67
57
|
lsp: {
|
|
68
58
|
Formatter: () => new DomainLangFormatter(),
|
|
69
59
|
HoverProvider: (services) => new DomainLangHoverProvider(services),
|
|
70
|
-
CompletionProvider: (services) => new DomainLangCompletionProvider(services)
|
|
71
|
-
CodeActionProvider: () => new DomainLangCodeActionProvider()
|
|
60
|
+
CompletionProvider: (services) => new DomainLangCompletionProvider(services)
|
|
72
61
|
},
|
|
73
62
|
};
|
|
74
63
|
|
|
@@ -93,8 +82,7 @@ export function createDomainLangServices(context: DefaultSharedModuleContext): {
|
|
|
93
82
|
} {
|
|
94
83
|
const shared = inject(
|
|
95
84
|
createDefaultSharedModule(context),
|
|
96
|
-
DomainLangGeneratedSharedModule
|
|
97
|
-
DomainLangSharedModule
|
|
85
|
+
DomainLangGeneratedSharedModule
|
|
98
86
|
);
|
|
99
87
|
const DomainLang = inject(
|
|
100
88
|
createDefaultModule({ shared }),
|
package/src/domain-lang.langium
CHANGED
|
@@ -292,18 +292,23 @@ BusinessRule:
|
|
|
292
292
|
// ============================================================================
|
|
293
293
|
|
|
294
294
|
/**
|
|
295
|
-
* Import Statement -
|
|
295
|
+
* Import Statement - Git-native import system inspired by Go modules and Deno.
|
|
296
296
|
*
|
|
297
|
-
*
|
|
298
|
-
* - External dependencies (from manifest): import "core" as Core
|
|
297
|
+
* Supported formats:
|
|
299
298
|
* - Local files: import "./shared/types.dlang"
|
|
300
299
|
* - Workspace-relative: import "~/contexts/sales.dlang"
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
300
|
+
* - GitHub packages: import "owner/repo@v1.0.0"
|
|
301
|
+
* - GitLab/Git URLs: import "https://gitlab.com/owner/repo@v1.0.0"
|
|
302
|
+
* - With aliases: import "ddd-patterns/core@v2.1.0" as DDD
|
|
303
|
+
* - Named imports: import { OrderContext } from "./contexts.dlang"
|
|
304
304
|
*/
|
|
305
305
|
ImportStatement:
|
|
306
|
-
/** Imports types or namespaces from another file or module, enabling reuse and modularity. */ ('Import' | 'import')
|
|
306
|
+
/** Imports types or namespaces from another file or module, enabling reuse and modularity. */ ('Import' | 'import') (
|
|
307
|
+
'{' symbols+=ID (',' symbols+=ID)* '}' 'from' uri=STRING
|
|
308
|
+
| uri=STRING
|
|
309
|
+
('integrity' integrity=STRING)?
|
|
310
|
+
('as' alias=ID)?
|
|
311
|
+
)
|
|
307
312
|
;
|
|
308
313
|
|
|
309
314
|
/**
|
package/src/generated/ast.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 4.
|
|
2
|
+
* This file was generated by langium-cli 4.1.0.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
|
|
@@ -74,10 +74,12 @@ export type DomainLangKeywordNames =
|
|
|
74
74
|
| "evolution"
|
|
75
75
|
| "examples"
|
|
76
76
|
| "for"
|
|
77
|
+
| "from"
|
|
77
78
|
| "glossary"
|
|
78
79
|
| "import"
|
|
79
80
|
| "in"
|
|
80
81
|
| "integrations"
|
|
82
|
+
| "integrity"
|
|
81
83
|
| "is"
|
|
82
84
|
| "meta"
|
|
83
85
|
| "metadata"
|
|
@@ -350,26 +352,30 @@ export function isDomainTerm(item: unknown): item is DomainTerm {
|
|
|
350
352
|
}
|
|
351
353
|
|
|
352
354
|
/**
|
|
353
|
-
* Import Statement -
|
|
355
|
+
* Import Statement - Git-native import system inspired by Go modules and Deno.
|
|
354
356
|
*
|
|
355
|
-
*
|
|
356
|
-
* - External dependencies (from manifest): import "core" as Core
|
|
357
|
+
* Supported formats:
|
|
357
358
|
* - Local files: import "./shared/types.dlang"
|
|
358
359
|
* - Workspace-relative: import "~/contexts/sales.dlang"
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
360
|
+
* - GitHub packages: import "owner/repo@v1.0.0"
|
|
361
|
+
* - GitLab/Git URLs: import "https://gitlab.com/owner/repo@v1.0.0"
|
|
362
|
+
* - With aliases: import "ddd-patterns/core@v2.1.0" as DDD
|
|
363
|
+
* - Named imports: import { OrderContext } from "./contexts.dlang"
|
|
362
364
|
*/
|
|
363
365
|
export interface ImportStatement extends langium.AstNode {
|
|
364
366
|
readonly $container: Model;
|
|
365
367
|
readonly $type: 'ImportStatement';
|
|
366
368
|
alias?: string;
|
|
369
|
+
integrity?: string;
|
|
370
|
+
symbols: Array<string>;
|
|
367
371
|
uri: string;
|
|
368
372
|
}
|
|
369
373
|
|
|
370
374
|
export const ImportStatement = {
|
|
371
375
|
$type: 'ImportStatement',
|
|
372
376
|
alias: 'alias',
|
|
377
|
+
integrity: 'integrity',
|
|
378
|
+
symbols: 'symbols',
|
|
373
379
|
uri: 'uri'
|
|
374
380
|
} as const;
|
|
375
381
|
|
|
@@ -846,6 +852,13 @@ export class DomainLangAstReflection extends langium.AbstractAstReflection {
|
|
|
846
852
|
alias: {
|
|
847
853
|
name: ImportStatement.alias
|
|
848
854
|
},
|
|
855
|
+
integrity: {
|
|
856
|
+
name: ImportStatement.integrity
|
|
857
|
+
},
|
|
858
|
+
symbols: {
|
|
859
|
+
name: ImportStatement.symbols,
|
|
860
|
+
defaultValue: []
|
|
861
|
+
},
|
|
849
862
|
uri: {
|
|
850
863
|
name: ImportStatement.uri
|
|
851
864
|
}
|
package/src/generated/grammar.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 4.
|
|
2
|
+
* This file was generated by langium-cli 4.1.0.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
|
|
@@ -2160,38 +2160,133 @@ export const DomainLangGrammar = (): Grammar => loadedDomainLangGrammar ?? (load
|
|
|
2160
2160
|
"$comment": "/** Imports types or namespaces from another file or module, enabling reuse and modularity. */"
|
|
2161
2161
|
},
|
|
2162
2162
|
{
|
|
2163
|
-
"$type": "
|
|
2164
|
-
"feature": "uri",
|
|
2165
|
-
"operator": "=",
|
|
2166
|
-
"terminal": {
|
|
2167
|
-
"$type": "RuleCall",
|
|
2168
|
-
"rule": {
|
|
2169
|
-
"$ref": "#/rules@28"
|
|
2170
|
-
},
|
|
2171
|
-
"arguments": []
|
|
2172
|
-
}
|
|
2173
|
-
},
|
|
2174
|
-
{
|
|
2175
|
-
"$type": "Group",
|
|
2163
|
+
"$type": "Alternatives",
|
|
2176
2164
|
"elements": [
|
|
2177
2165
|
{
|
|
2178
|
-
"$type": "
|
|
2179
|
-
"
|
|
2166
|
+
"$type": "Group",
|
|
2167
|
+
"elements": [
|
|
2168
|
+
{
|
|
2169
|
+
"$type": "Keyword",
|
|
2170
|
+
"value": "{"
|
|
2171
|
+
},
|
|
2172
|
+
{
|
|
2173
|
+
"$type": "Assignment",
|
|
2174
|
+
"feature": "symbols",
|
|
2175
|
+
"operator": "+=",
|
|
2176
|
+
"terminal": {
|
|
2177
|
+
"$type": "RuleCall",
|
|
2178
|
+
"rule": {
|
|
2179
|
+
"$ref": "#/rules@27"
|
|
2180
|
+
},
|
|
2181
|
+
"arguments": []
|
|
2182
|
+
}
|
|
2183
|
+
},
|
|
2184
|
+
{
|
|
2185
|
+
"$type": "Group",
|
|
2186
|
+
"elements": [
|
|
2187
|
+
{
|
|
2188
|
+
"$type": "Keyword",
|
|
2189
|
+
"value": ","
|
|
2190
|
+
},
|
|
2191
|
+
{
|
|
2192
|
+
"$type": "Assignment",
|
|
2193
|
+
"feature": "symbols",
|
|
2194
|
+
"operator": "+=",
|
|
2195
|
+
"terminal": {
|
|
2196
|
+
"$type": "RuleCall",
|
|
2197
|
+
"rule": {
|
|
2198
|
+
"$ref": "#/rules@27"
|
|
2199
|
+
},
|
|
2200
|
+
"arguments": []
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
],
|
|
2204
|
+
"cardinality": "*"
|
|
2205
|
+
},
|
|
2206
|
+
{
|
|
2207
|
+
"$type": "Keyword",
|
|
2208
|
+
"value": "}"
|
|
2209
|
+
},
|
|
2210
|
+
{
|
|
2211
|
+
"$type": "Keyword",
|
|
2212
|
+
"value": "from"
|
|
2213
|
+
},
|
|
2214
|
+
{
|
|
2215
|
+
"$type": "Assignment",
|
|
2216
|
+
"feature": "uri",
|
|
2217
|
+
"operator": "=",
|
|
2218
|
+
"terminal": {
|
|
2219
|
+
"$type": "RuleCall",
|
|
2220
|
+
"rule": {
|
|
2221
|
+
"$ref": "#/rules@28"
|
|
2222
|
+
},
|
|
2223
|
+
"arguments": []
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
]
|
|
2180
2227
|
},
|
|
2181
2228
|
{
|
|
2182
|
-
"$type": "
|
|
2183
|
-
"
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
"
|
|
2229
|
+
"$type": "Group",
|
|
2230
|
+
"elements": [
|
|
2231
|
+
{
|
|
2232
|
+
"$type": "Assignment",
|
|
2233
|
+
"feature": "uri",
|
|
2234
|
+
"operator": "=",
|
|
2235
|
+
"terminal": {
|
|
2236
|
+
"$type": "RuleCall",
|
|
2237
|
+
"rule": {
|
|
2238
|
+
"$ref": "#/rules@28"
|
|
2239
|
+
},
|
|
2240
|
+
"arguments": []
|
|
2241
|
+
}
|
|
2189
2242
|
},
|
|
2190
|
-
|
|
2191
|
-
|
|
2243
|
+
{
|
|
2244
|
+
"$type": "Group",
|
|
2245
|
+
"elements": [
|
|
2246
|
+
{
|
|
2247
|
+
"$type": "Keyword",
|
|
2248
|
+
"value": "integrity"
|
|
2249
|
+
},
|
|
2250
|
+
{
|
|
2251
|
+
"$type": "Assignment",
|
|
2252
|
+
"feature": "integrity",
|
|
2253
|
+
"operator": "=",
|
|
2254
|
+
"terminal": {
|
|
2255
|
+
"$type": "RuleCall",
|
|
2256
|
+
"rule": {
|
|
2257
|
+
"$ref": "#/rules@28"
|
|
2258
|
+
},
|
|
2259
|
+
"arguments": []
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
],
|
|
2263
|
+
"cardinality": "?"
|
|
2264
|
+
},
|
|
2265
|
+
{
|
|
2266
|
+
"$type": "Group",
|
|
2267
|
+
"elements": [
|
|
2268
|
+
{
|
|
2269
|
+
"$type": "Keyword",
|
|
2270
|
+
"value": "as"
|
|
2271
|
+
},
|
|
2272
|
+
{
|
|
2273
|
+
"$type": "Assignment",
|
|
2274
|
+
"feature": "alias",
|
|
2275
|
+
"operator": "=",
|
|
2276
|
+
"terminal": {
|
|
2277
|
+
"$type": "RuleCall",
|
|
2278
|
+
"rule": {
|
|
2279
|
+
"$ref": "#/rules@27"
|
|
2280
|
+
},
|
|
2281
|
+
"arguments": []
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
],
|
|
2285
|
+
"cardinality": "?"
|
|
2286
|
+
}
|
|
2287
|
+
]
|
|
2192
2288
|
}
|
|
2193
|
-
]
|
|
2194
|
-
"cardinality": "?"
|
|
2289
|
+
]
|
|
2195
2290
|
}
|
|
2196
2291
|
],
|
|
2197
2292
|
"$comment": "/** Imports types or namespaces from another file or module, enabling reuse and modularity. */"
|
|
@@ -2199,7 +2294,7 @@ export const DomainLangGrammar = (): Grammar => loadedDomainLangGrammar ?? (load
|
|
|
2199
2294
|
"entry": false,
|
|
2200
2295
|
"fragment": false,
|
|
2201
2296
|
"parameters": [],
|
|
2202
|
-
"$comment": "/**\\n * Import Statement -
|
|
2297
|
+
"$comment": "/**\\n * Import Statement - Git-native import system inspired by Go modules and Deno.\\n * \\n * Supported formats:\\n * - Local files: import \\"./shared/types.dlang\\"\\n * - Workspace-relative: import \\"~/contexts/sales.dlang\\"\\n * - GitHub packages: import \\"owner/repo@v1.0.0\\"\\n * - GitLab/Git URLs: import \\"https://gitlab.com/owner/repo@v1.0.0\\"\\n * - With aliases: import \\"ddd-patterns/core@v2.1.0\\" as DDD\\n * - Named imports: import { OrderContext } from \\"./contexts.dlang\\"\\n */"
|
|
2203
2298
|
},
|
|
2204
2299
|
{
|
|
2205
2300
|
"$type": "ParserRule",
|
package/src/generated/module.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli 4.
|
|
2
|
+
* This file was generated by langium-cli 4.1.0.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
|
package/src/index.ts
CHANGED
|
@@ -6,9 +6,6 @@ export * from './generated/module.js';
|
|
|
6
6
|
// and creates a connection when imported, which breaks CLI/SDK standalone usage
|
|
7
7
|
export * from './ast-augmentation.js';
|
|
8
8
|
|
|
9
|
-
// Export centralized types (canonical source for all service types)
|
|
10
|
-
export * from './services/types.js';
|
|
11
|
-
|
|
12
9
|
// Export services
|
|
13
10
|
export * from './services/workspace-manager.js';
|
|
14
11
|
export * from './services/dependency-resolver.js';
|
|
@@ -18,7 +15,3 @@ export * from './services/import-resolver.js';
|
|
|
18
15
|
export * from './services/relationship-inference.js';
|
|
19
16
|
export * from './services/git-url-resolver.js';
|
|
20
17
|
export * from './services/performance-optimizer.js';
|
|
21
|
-
export * from './services/semver.js';
|
|
22
|
-
|
|
23
|
-
// Export LSP services
|
|
24
|
-
export * from './lsp/manifest-diagnostics.js';
|
|
@@ -276,7 +276,9 @@ export class DomainLangHoverProvider extends AstNodeHoverProvider {
|
|
|
276
276
|
if (ast.isImportStatement && ast.isImportStatement(node)) {
|
|
277
277
|
const fields: string[] = [];
|
|
278
278
|
fields.push(`**URI:** \`${node.uri}\``);
|
|
279
|
+
if (node.symbols.length) fields.push(`**Imports:** ${node.symbols.map(s => `\`${s}\``).join(', ')}`);
|
|
279
280
|
if (node.alias) fields.push(`**Alias:** \`${node.alias}\``);
|
|
281
|
+
if (node.integrity) fields.push(`**Integrity:** \`${node.integrity}\``);
|
|
280
282
|
return (commentBlock ? `${commentBlock}\n\n---\n\n` : '') +
|
|
281
283
|
`📦 **\`(import)\`**\n\n` +
|
|
282
284
|
fields.join('\n\n');
|
package/src/sdk/index.ts
CHANGED
package/src/sdk/loader-node.ts
CHANGED
|
@@ -25,16 +25,14 @@ import { isModel } from '../generated/ast.js';
|
|
|
25
25
|
import { createDomainLangServices } from '../domain-lang-module.js';
|
|
26
26
|
import type { LoadOptions, QueryContext } from './types.js';
|
|
27
27
|
import { fromModel, augmentModel } from './query.js';
|
|
28
|
-
import { ensureImportGraphFromDocument } from '../utils/import-utils.js';
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
30
|
* Loads a DomainLang model from a file on disk.
|
|
32
31
|
*
|
|
33
32
|
* **Node.js only** - uses file system APIs.
|
|
34
33
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* to see all loaded files.
|
|
34
|
+
* Note: This loads a single file. For multi-file models with imports,
|
|
35
|
+
* consider using the WorkspaceManager or hosting an LSP server.
|
|
38
36
|
*
|
|
39
37
|
* @param entryFile - Path to the entry .dlang file
|
|
40
38
|
* @param options - Optional load configuration
|
|
@@ -45,16 +43,13 @@ import { ensureImportGraphFromDocument } from '../utils/import-utils.js';
|
|
|
45
43
|
* ```typescript
|
|
46
44
|
* import { loadModel } from '@domainlang/language/sdk/loader-node';
|
|
47
45
|
*
|
|
48
|
-
* const { query, model
|
|
46
|
+
* const { query, model } = await loadModel('./domains.dlang', {
|
|
49
47
|
* workspaceDir: process.cwd()
|
|
50
48
|
* });
|
|
51
49
|
*
|
|
52
|
-
* // Query spans all imported files
|
|
53
50
|
* for (const bc of query.boundedContexts()) {
|
|
54
51
|
* console.log(bc.name);
|
|
55
52
|
* }
|
|
56
|
-
*
|
|
57
|
-
* console.log(`Loaded ${documents.length} files`);
|
|
58
53
|
* ```
|
|
59
54
|
*/
|
|
60
55
|
export async function loadModel(
|
|
@@ -94,19 +89,9 @@ export async function loadModel(
|
|
|
94
89
|
|
|
95
90
|
// Register document and build it
|
|
96
91
|
shared.workspace.LangiumDocuments.addDocument(document);
|
|
97
|
-
await shared.workspace.DocumentBuilder.build([document], { validation:
|
|
98
|
-
|
|
99
|
-
// Traverse import graph to load all imported files
|
|
100
|
-
const importedUris = await ensureImportGraphFromDocument(
|
|
101
|
-
document,
|
|
102
|
-
shared.workspace.LangiumDocuments
|
|
103
|
-
);
|
|
92
|
+
await shared.workspace.DocumentBuilder.build([document], { validation: true });
|
|
104
93
|
|
|
105
|
-
//
|
|
106
|
-
const allDocuments = Array.from(shared.workspace.LangiumDocuments.all);
|
|
107
|
-
await shared.workspace.DocumentBuilder.build(allDocuments, { validation: true });
|
|
108
|
-
|
|
109
|
-
// Wait for entry document to be fully processed
|
|
94
|
+
// Wait for document to be fully processed
|
|
110
95
|
if (document.state < DocumentState.Validated) {
|
|
111
96
|
throw new Error(`Document not fully processed: ${absolutePath}`);
|
|
112
97
|
}
|
|
@@ -127,16 +112,11 @@ export async function loadModel(
|
|
|
127
112
|
throw new Error(`Document root is not a Model: ${entryFile}`);
|
|
128
113
|
}
|
|
129
114
|
|
|
130
|
-
// Augment AST nodes with SDK properties
|
|
131
|
-
|
|
132
|
-
const docModel = doc.parseResult.value;
|
|
133
|
-
if (isModel(docModel)) {
|
|
134
|
-
augmentModel(docModel);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
115
|
+
// Augment AST nodes with SDK properties
|
|
116
|
+
augmentModel(model);
|
|
137
117
|
|
|
138
|
-
// Collect all document URIs
|
|
139
|
-
const documentUris: URI[] = Array.from(
|
|
118
|
+
// Collect all document URIs
|
|
119
|
+
const documentUris: URI[] = Array.from(shared.workspace.LangiumDocuments.all).map(doc => doc.uri);
|
|
140
120
|
|
|
141
121
|
return {
|
|
142
122
|
model,
|
package/src/sdk/types.ts
CHANGED
|
@@ -305,6 +305,29 @@ export interface RelationshipView {
|
|
|
305
305
|
readonly astNode: Relationship;
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
+
/**
|
|
309
|
+
* Augmented BoundedContext with SDK-resolved properties.
|
|
310
|
+
* These properties are computed during model loading using precedence rules.
|
|
311
|
+
*
|
|
312
|
+
* Property names follow the PRS design: natural names that "just work" with
|
|
313
|
+
* IDE autocomplete. Use `resolved*` prefix to avoid conflicts with existing
|
|
314
|
+
* AST properties while maintaining discoverability.
|
|
315
|
+
*
|
|
316
|
+
* @deprecated Since SDK now uses module augmentation in ast-augmentation.ts,
|
|
317
|
+
* this type alias is only kept for backwards compatibility. Use BoundedContext
|
|
318
|
+
* directly after importing the SDK.
|
|
319
|
+
*/
|
|
320
|
+
export type AugmentedBoundedContext = BoundedContext;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Augmented Domain with SDK-resolved properties.
|
|
324
|
+
*
|
|
325
|
+
* @deprecated Since SDK now uses module augmentation in ast-augmentation.ts,
|
|
326
|
+
* this type alias is only kept for backwards compatibility. Use Domain
|
|
327
|
+
* directly after importing the SDK.
|
|
328
|
+
*/
|
|
329
|
+
export type AugmentedDomain = Domain;
|
|
330
|
+
|
|
308
331
|
/**
|
|
309
332
|
* Internal index structure for O(1) lookups.
|
|
310
333
|
* Not exported from public API.
|