@lionweb/class-core-generator 0.7.0-alpha.3 → 0.7.0-alpha.5
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/CHANGELOG.md +2 -1
- package/dist/api/entity-types.templates.d.ts.map +1 -1
- package/dist/api/entity-types.templates.js +25 -6
- package/dist/api/entity-types.templates.js.map +1 -1
- package/dist/api/helpers/index.d.ts +0 -1
- package/dist/api/helpers/index.d.ts.map +1 -1
- package/dist/api/helpers/index.js +0 -1
- package/dist/api/helpers/index.js.map +1 -1
- package/dist/api/index-ts.d.ts.map +1 -1
- package/dist/api/index-ts.js +2 -1
- package/dist/api/index-ts.js.map +1 -1
- package/package.json +6 -6
- package/src/api/entity-types.templates.ts +44 -6
- package/src/api/helpers/index.ts +0 -1
- package/src/api/index-ts.ts +3 -2
- package/dist/api/helpers/dependencies.d.ts +0 -11
- package/dist/api/helpers/dependencies.d.ts.map +0 -1
- package/dist/api/helpers/dependencies.js +0 -52
- package/dist/api/helpers/dependencies.js.map +0 -1
- package/src/api/helpers/dependencies.ts +0 -62
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## 0.7.0
|
|
4
4
|
|
|
5
|
-
*
|
|
5
|
+
* Remove everything specific to annotations coming from the `io.lionweb.mps.specific` language, in favor of using the types and functionality provided by the `@lionweb/io-lionweb-mps-specific` package.
|
|
6
6
|
**Note**: this slightly breaks the API of the generator, but in such a trivial way (because of the use of defaults) that it doesn't warrant an increment in major version, IOHO.
|
|
7
|
+
* Move `dependenciesThroughDirectInheritanceOf` and `verboseDependencies` functions from `class-core-generator` to `utilities` package.
|
|
7
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-types.templates.d.ts","sourceRoot":"","sources":["../../src/api/entity-types.templates.ts"],"names":[],"mappings":"AAiBA,OAAO,EAUH,cAAc,
|
|
1
|
+
{"version":3,"file":"entity-types.templates.d.ts","sourceRoot":"","sources":["../../src/api/entity-types.templates.ts"],"names":[],"mappings":"AAiBA,OAAO,EAUH,cAAc,EASjB,MAAM,eAAe,CAAA;AAYtB,OAAO,EAKH,OAAO,EAQV,MAAM,oBAAoB,CAAA;AAc3B,eAAO,MAAM,qBAAqB,YAAa,OAAO,cAkMlC,cAAc,4CAoBjC,CAAA"}
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
//
|
|
15
15
|
// SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
|
|
16
16
|
// SPDX-License-Identifier: Apache-2.0
|
|
17
|
-
import { builtinClassifiers, Classifier, Enumeration, featureMetaType, Interface, isContainment, isProperty, isReference, Link, nameSorted, PrimitiveType, Property, Reference } from "@lionweb/core";
|
|
18
|
-
import { ConceptDescription, Deprecated, ioLionWebMpsSpecificAnnotationsFrom } from "@lionweb/io-lionweb-mps-specific";
|
|
17
|
+
import { builtinClassifiers, Classifier, Enumeration, featureMetaType, Interface, isContainment, isProperty, isReference, LanguageEntity, Link, nameSorted, PrimitiveType, Property, Reference } from "@lionweb/core";
|
|
18
|
+
import { ConceptDescription, Deprecated, ioLionWebMpsSpecificAnnotationsFrom, KeyedDescription, ShortDescription, VirtualPackage } from "@lionweb/io-lionweb-mps-specific";
|
|
19
19
|
import { commaSeparated, when, withNewlineAppended } from "littoral-templates";
|
|
20
20
|
import { indent, switchOrIf, withFirstUpper, wrapInIf } from "../utils/textgen.js";
|
|
21
21
|
import { entityMetaType, extendsFrom, featuresToConcretelyImplementOf, implementsFrom, isAbstract, optionalityPostfix, tsFieldTypeForFeature, tsTypeForClassifier, tsTypeForDatatype, tsTypeForPrimitiveType, tsTypeForValueManager } from "./helpers/index.js";
|
|
@@ -35,6 +35,7 @@ export const typeForLanguageEntity = (imports) => {
|
|
|
35
35
|
const { name, type } = property;
|
|
36
36
|
return [
|
|
37
37
|
`private readonly _${name}: ${imports.generic(valueManagerFor(property))}<${tsTypeForDatatype(type, imports)}>;`,
|
|
38
|
+
jsDocFor(property),
|
|
38
39
|
`get ${name}(): ${tsTypeForDatatype(type, imports)}${optionalityPostfix(property)} {`,
|
|
39
40
|
indent(`return this._${name}.get();`),
|
|
40
41
|
`}`,
|
|
@@ -49,6 +50,7 @@ export const typeForLanguageEntity = (imports) => {
|
|
|
49
50
|
const { name, type, multiple } = link;
|
|
50
51
|
return [
|
|
51
52
|
`private readonly _${name}: ${imports.generic(valueManagerFor(link))}<${tsTypeForClassifier(type, imports)}>;`,
|
|
53
|
+
jsDocFor(link),
|
|
52
54
|
`get ${name}(): ${tsTypeForLink(link)} {`,
|
|
53
55
|
indent(`return this._${name}.get();`),
|
|
54
56
|
`}`,
|
|
@@ -141,12 +143,29 @@ export const typeForLanguageEntity = (imports) => {
|
|
|
141
143
|
const jsDocFor = (entity) => {
|
|
142
144
|
const annotations = ioLionWebMpsSpecificAnnotationsFrom(entity);
|
|
143
145
|
const conceptDescription = annotations.find((annotation) => annotation instanceof ConceptDescription);
|
|
144
|
-
const hasShortConceptDescription = !!(conceptDescription?.conceptShortDescription);
|
|
145
146
|
const deprecated = annotations.find((annotation) => annotation instanceof Deprecated);
|
|
146
|
-
|
|
147
|
+
const keyedDescription = annotations.find((annotation) => annotation instanceof KeyedDescription);
|
|
148
|
+
const shortDescription = annotations.find((annotation) => annotation instanceof ShortDescription);
|
|
149
|
+
const virtualPackage = annotations.find((annotation) => annotation instanceof VirtualPackage);
|
|
150
|
+
const requiresJsDoc = !!(conceptDescription?.conceptShortDescription)
|
|
151
|
+
|| !!(shortDescription?.description)
|
|
152
|
+
|| keyedDescription !== undefined
|
|
153
|
+
|| deprecated !== undefined
|
|
154
|
+
|| !!(virtualPackage?.name);
|
|
155
|
+
const linkName = (node) => node instanceof LanguageEntity
|
|
156
|
+
? node.name
|
|
157
|
+
: "??? (not a language's entity)";
|
|
158
|
+
return when(requiresJsDoc)([
|
|
147
159
|
`/**`,
|
|
148
|
-
when(
|
|
149
|
-
when(
|
|
160
|
+
when(!!(conceptDescription?.conceptShortDescription))(() => ` * ${conceptDescription.conceptShortDescription}`),
|
|
161
|
+
when(!!(conceptDescription?.helpUrl))(() => ` * {@see} ${conceptDescription.helpUrl}`),
|
|
162
|
+
when(!!(shortDescription?.description))(() => ` * ${shortDescription.description}`),
|
|
163
|
+
when(keyedDescription !== undefined)(() => [
|
|
164
|
+
when(keyedDescription.documentation !== undefined)(` * ${keyedDescription.documentation}`),
|
|
165
|
+
keyedDescription.seeAlso.map((seeAlso) => ` * {@see} {@link ${linkName(seeAlso)}}`)
|
|
166
|
+
]),
|
|
167
|
+
when(deprecated !== undefined)(() => ` * @deprecated ${deprecated.comment ?? ""}${deprecated.build === undefined ? "" : ` (build: ${deprecated.build})`}`),
|
|
168
|
+
when(!!(virtualPackage?.name))(() => `(virtual package: ${virtualPackage.name})`),
|
|
150
169
|
` */`
|
|
151
170
|
]);
|
|
152
171
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-types.templates.js","sourceRoot":"","sources":["../../src/api/entity-types.templates.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAEtC,OAAO,EACH,kBAAkB,EAClB,UAAU,EACV,WAAW,EAEX,eAAe,EACf,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,
|
|
1
|
+
{"version":3,"file":"entity-types.templates.js","sourceRoot":"","sources":["../../src/api/entity-types.templates.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sE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E;KACP,CAAA;AAET,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/helpers/index.ts"],"names":[],"mappings":"AAiBA,cAAc,kBAAkB,CAAA;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/helpers/index.ts"],"names":[],"mappings":"AAiBA,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA"}
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
// SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
|
|
16
16
|
// SPDX-License-Identifier: Apache-2.0
|
|
17
17
|
export * from "./classifiers.js";
|
|
18
|
-
export * from "./dependencies.js";
|
|
19
18
|
export * from "./entities.js";
|
|
20
19
|
export * from "./features.js";
|
|
21
20
|
export * from "./imports-tracking.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/helpers/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAEtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/helpers/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAEtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-ts.d.ts","sourceRoot":"","sources":["../../src/api/index-ts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index-ts.d.ts","sourceRoot":"","sources":["../../src/api/index-ts.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAMxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAGjD,eAAO,MAAM,UAAU,cAAe,QAAQ,EAAE,WAAW,gBAAgB,WA0C1E,CAAA"}
|
package/dist/api/index-ts.js
CHANGED
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
// SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
|
|
16
16
|
// SPDX-License-Identifier: Apache-2.0
|
|
17
17
|
import { dependencyOrderOf } from "@lionweb/ts-utils";
|
|
18
|
+
import { dependenciesThroughDirectInheritanceOf } from "@lionweb/utilities";
|
|
18
19
|
import { asString, commaSeparated } from "littoral-templates";
|
|
19
20
|
import { indent } from "../utils/textgen.js";
|
|
20
|
-
import {
|
|
21
|
+
import { importRenamingForLanguage, nameOfBaseClassForLanguage } from "./helpers/index.js";
|
|
21
22
|
export const indexTsFor = (languages, options) => {
|
|
22
23
|
const dependenciesInOrderOfDirectInheritance = dependencyOrderOf(languages, dependenciesThroughDirectInheritanceOf);
|
|
23
24
|
if (dependenciesInOrderOfDirectInheritance === false) {
|
package/dist/api/index-ts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-ts.js","sourceRoot":"","sources":["../../src/api/index-ts.ts"],"names":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
4
4
|
"description": "Generator for implementations of languages based on the class-core package",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"release": "npm publish"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@lionweb/core": "0.7.0-alpha.
|
|
31
|
-
"@lionweb/io-lionweb-mps-specific": "0.7.0-alpha.
|
|
32
|
-
"@lionweb/json": "0.7.0-alpha.
|
|
33
|
-
"@lionweb/ts-utils": "0.7.0-alpha.
|
|
34
|
-
"@lionweb/utilities": "0.7.0-alpha.
|
|
30
|
+
"@lionweb/core": "0.7.0-alpha.5",
|
|
31
|
+
"@lionweb/io-lionweb-mps-specific": "0.7.0-alpha.5",
|
|
32
|
+
"@lionweb/json": "0.7.0-alpha.5",
|
|
33
|
+
"@lionweb/ts-utils": "0.7.0-alpha.5",
|
|
34
|
+
"@lionweb/utilities": "0.7.0-alpha.5",
|
|
35
35
|
"@types/node": "22.15.21",
|
|
36
36
|
"littoral-templates": "0.3.0",
|
|
37
37
|
"typescript": "5.3.3"
|
|
@@ -27,13 +27,22 @@ import {
|
|
|
27
27
|
isReference,
|
|
28
28
|
LanguageEntity,
|
|
29
29
|
Link,
|
|
30
|
+
M3Node,
|
|
30
31
|
nameSorted,
|
|
32
|
+
Node,
|
|
31
33
|
PrimitiveType,
|
|
32
34
|
Property,
|
|
33
35
|
Reference,
|
|
34
36
|
SingleRef
|
|
35
37
|
} from "@lionweb/core"
|
|
36
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
ConceptDescription,
|
|
40
|
+
Deprecated,
|
|
41
|
+
ioLionWebMpsSpecificAnnotationsFrom,
|
|
42
|
+
KeyedDescription,
|
|
43
|
+
ShortDescription,
|
|
44
|
+
VirtualPackage
|
|
45
|
+
} from "@lionweb/io-lionweb-mps-specific"
|
|
37
46
|
import { commaSeparated, when, withNewlineAppended } from "littoral-templates"
|
|
38
47
|
|
|
39
48
|
import { indent, switchOrIf, withFirstUpper, wrapInIf } from "../utils/textgen.js"
|
|
@@ -76,6 +85,7 @@ export const typeForLanguageEntity = (imports: Imports) => {
|
|
|
76
85
|
const {name, type} = property
|
|
77
86
|
return [
|
|
78
87
|
`private readonly _${name}: ${imports.generic(valueManagerFor(property))}<${tsTypeForDatatype(type, imports)}>;`,
|
|
88
|
+
jsDocFor(property),
|
|
79
89
|
`get ${name}(): ${tsTypeForDatatype(type, imports)}${optionalityPostfix(property)} {`,
|
|
80
90
|
indent(`return this._${name}.get();`),
|
|
81
91
|
`}`,
|
|
@@ -93,6 +103,7 @@ export const typeForLanguageEntity = (imports: Imports) => {
|
|
|
93
103
|
const {name, type, multiple} = link
|
|
94
104
|
return [
|
|
95
105
|
`private readonly _${name}: ${imports.generic(valueManagerFor(link))}<${tsTypeForClassifier(type, imports)}>;`,
|
|
106
|
+
jsDocFor(link),
|
|
96
107
|
`get ${name}(): ${tsTypeForLink(link)} {`,
|
|
97
108
|
indent(`return this._${name}.get();`),
|
|
98
109
|
`}`,
|
|
@@ -212,18 +223,45 @@ export const typeForLanguageEntity = (imports: Imports) => {
|
|
|
212
223
|
const typeForPrimitiveType = (primitiveType: PrimitiveType) =>
|
|
213
224
|
`export type ${primitiveType.name} = ${tsTypeForPrimitiveType(primitiveType)};`
|
|
214
225
|
|
|
215
|
-
const jsDocFor = (entity:
|
|
226
|
+
const jsDocFor = (entity: M3Node) => {
|
|
216
227
|
const annotations = ioLionWebMpsSpecificAnnotationsFrom(entity)
|
|
217
228
|
const conceptDescription = annotations.find((annotation) => annotation instanceof ConceptDescription) as ConceptDescription
|
|
218
|
-
const hasShortConceptDescription = !!(conceptDescription?.conceptShortDescription)
|
|
219
229
|
const deprecated = annotations.find((annotation) => annotation instanceof Deprecated) as Deprecated
|
|
220
|
-
|
|
230
|
+
const keyedDescription = annotations.find((annotation) => annotation instanceof KeyedDescription) as KeyedDescription
|
|
231
|
+
const shortDescription = annotations.find((annotation) => annotation instanceof ShortDescription) as ShortDescription
|
|
232
|
+
const virtualPackage = annotations.find((annotation) => annotation instanceof VirtualPackage) as VirtualPackage
|
|
233
|
+
const requiresJsDoc =
|
|
234
|
+
!!(conceptDescription?.conceptShortDescription)
|
|
235
|
+
|| !!(shortDescription?.description)
|
|
236
|
+
|| keyedDescription !== undefined
|
|
237
|
+
|| deprecated !== undefined
|
|
238
|
+
|| !!(virtualPackage?.name)
|
|
239
|
+
const linkName = (node: Node) =>
|
|
240
|
+
node instanceof LanguageEntity
|
|
241
|
+
? node.name
|
|
242
|
+
: "??? (not a language's entity)"
|
|
243
|
+
return when(requiresJsDoc)([
|
|
221
244
|
`/**`,
|
|
222
|
-
when(
|
|
245
|
+
when(!!(conceptDescription?.conceptShortDescription))(
|
|
223
246
|
() => ` * ${conceptDescription.conceptShortDescription}`
|
|
224
247
|
),
|
|
248
|
+
when(!!(conceptDescription?.helpUrl))(
|
|
249
|
+
() => ` * {@see} ${conceptDescription.helpUrl}`
|
|
250
|
+
),
|
|
251
|
+
when(!!(shortDescription?.description))(
|
|
252
|
+
() => ` * ${shortDescription.description}`
|
|
253
|
+
),
|
|
254
|
+
when(keyedDescription !== undefined)(
|
|
255
|
+
() => [
|
|
256
|
+
when(keyedDescription.documentation !== undefined)(` * ${keyedDescription.documentation}`),
|
|
257
|
+
keyedDescription.seeAlso.map((seeAlso) => ` * {@see} {@link ${linkName(seeAlso)}}`)
|
|
258
|
+
]
|
|
259
|
+
),
|
|
225
260
|
when(deprecated !== undefined)(
|
|
226
|
-
() => ` * @deprecated ${deprecated.comment ?? ""}${deprecated.build ===
|
|
261
|
+
() => ` * @deprecated ${deprecated.comment ?? ""}${deprecated.build === undefined ? "" : ` (build: ${deprecated.build})`}`
|
|
262
|
+
),
|
|
263
|
+
when(!!(virtualPackage?.name))(
|
|
264
|
+
() => `(virtual package: ${virtualPackage.name})`
|
|
227
265
|
),
|
|
228
266
|
` */`
|
|
229
267
|
])
|
package/src/api/helpers/index.ts
CHANGED
package/src/api/index-ts.ts
CHANGED
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
// SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
|
|
16
16
|
// SPDX-License-Identifier: Apache-2.0
|
|
17
17
|
|
|
18
|
-
import { dependencyOrderOf } from "@lionweb/ts-utils"
|
|
19
18
|
import { Language } from "@lionweb/core"
|
|
19
|
+
import { dependencyOrderOf } from "@lionweb/ts-utils"
|
|
20
|
+
import { dependenciesThroughDirectInheritanceOf } from "@lionweb/utilities"
|
|
20
21
|
import { asString, commaSeparated } from "littoral-templates"
|
|
21
22
|
|
|
22
23
|
import { indent } from "../utils/textgen.js"
|
|
23
24
|
import { GeneratorOptions } from "./generator.js"
|
|
24
|
-
import {
|
|
25
|
+
import { importRenamingForLanguage, nameOfBaseClassForLanguage } from "./helpers/index.js"
|
|
25
26
|
|
|
26
27
|
export const indexTsFor = (languages: Language[], options: GeneratorOptions) => {
|
|
27
28
|
const dependenciesInOrderOfDirectInheritance = dependencyOrderOf(languages, dependenciesThroughDirectInheritanceOf)
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Language } from "@lionweb/core";
|
|
2
|
-
/**
|
|
3
|
-
* @return all languages that any {@link Classifier classifier} of the given {@link Language language} depends on through direct inheritance.
|
|
4
|
-
*/
|
|
5
|
-
export declare const dependenciesThroughDirectInheritanceOf: (language: Language) => Language[];
|
|
6
|
-
/**
|
|
7
|
-
* @return the – currently only those arising from direct inheritance on classifier-level – dependencies of the given {@link Language languages},
|
|
8
|
-
* as a human-readable text
|
|
9
|
-
*/
|
|
10
|
-
export declare const verboseDependencies: (languages: Language[]) => string;
|
|
11
|
-
//# sourceMappingURL=dependencies.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../src/api/helpers/dependencies.ts"],"names":[],"mappings":"AAiBA,OAAO,EAA4B,QAAQ,EAAsB,MAAM,eAAe,CAAA;AAMtF;;GAEG;AACH,eAAO,MAAM,sCAAsC,aAAc,QAAQ,eAOpE,CAAA;AAGL;;;GAGG;AACH,eAAO,MAAM,mBAAmB,cAAe,QAAQ,EAAE,KAAG,MAoB3D,CAAA"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 TRUMPF Laser SE and other contributors
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License")
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
|
|
16
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
17
|
-
import { Classifier, inheritsFrom, nameOf, nameSorted } from "@lionweb/core";
|
|
18
|
-
import { cycleWith, uniquesAmong } from "@lionweb/ts-utils";
|
|
19
|
-
import { asString, when } from "littoral-templates";
|
|
20
|
-
import { indent } from "../../utils/index.js";
|
|
21
|
-
/**
|
|
22
|
-
* @return all languages that any {@link Classifier classifier} of the given {@link Language language} depends on through direct inheritance.
|
|
23
|
-
*/
|
|
24
|
-
export const dependenciesThroughDirectInheritanceOf = (language) => uniquesAmong(language.entities
|
|
25
|
-
.filter((entity) => entity instanceof Classifier)
|
|
26
|
-
.flatMap((entity) => inheritsFrom(entity))
|
|
27
|
-
.map((classifier) => classifier.language)
|
|
28
|
-
.filter((depLanguage) => depLanguage !== language));
|
|
29
|
-
/**
|
|
30
|
-
* @return the – currently only those arising from direct inheritance on classifier-level – dependencies of the given {@link Language languages},
|
|
31
|
-
* as a human-readable text
|
|
32
|
-
*/
|
|
33
|
-
export const verboseDependencies = (languages) => {
|
|
34
|
-
const nameSortedLanguages = nameSorted(languages);
|
|
35
|
-
return asString([
|
|
36
|
-
nameSortedLanguages.map((language) => {
|
|
37
|
-
const deps = dependenciesThroughDirectInheritanceOf(language);
|
|
38
|
-
const what = `direct type-wise dependencies (through inheritance)`;
|
|
39
|
-
const cycle = cycleWith(language, dependenciesThroughDirectInheritanceOf);
|
|
40
|
-
return deps.length === 0
|
|
41
|
-
? `language ${language.name} has no ${what}`
|
|
42
|
-
: [
|
|
43
|
-
`language ${language.name} has the following ${what}:`,
|
|
44
|
-
indent([
|
|
45
|
-
nameSorted(dependenciesThroughDirectInheritanceOf(language)).map(nameOf),
|
|
46
|
-
when(cycle.length > 0)(`⚠ language "${language.name}" is part of the following cycle through type-wise (through direct inheritance): ${cycle.map(nameOf).join(" -> ")}`)
|
|
47
|
-
])
|
|
48
|
-
];
|
|
49
|
-
})
|
|
50
|
-
]);
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=dependencies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../src/api/helpers/dependencies.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAY,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACtF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACnD,OA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AC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CACnJ;qBACJ,CAAC;iBACL,CAAA;QACT,CAAC,CAAC;KACL,CAAC,CAAA;AACN,CAAC,CAAA"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 TRUMPF Laser SE and other contributors
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License")
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
|
|
16
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
17
|
-
|
|
18
|
-
import { Classifier, inheritsFrom, Language, nameOf, nameSorted } from "@lionweb/core"
|
|
19
|
-
import { cycleWith, uniquesAmong } from "@lionweb/ts-utils"
|
|
20
|
-
import { asString, when } from "littoral-templates"
|
|
21
|
-
import { indent } from "../../utils/index.js"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @return all languages that any {@link Classifier classifier} of the given {@link Language language} depends on through direct inheritance.
|
|
26
|
-
*/
|
|
27
|
-
export const dependenciesThroughDirectInheritanceOf = (language: Language) =>
|
|
28
|
-
uniquesAmong(
|
|
29
|
-
language.entities
|
|
30
|
-
.filter((entity) => entity instanceof Classifier)
|
|
31
|
-
.flatMap((entity) => inheritsFrom(entity as Classifier))
|
|
32
|
-
.map((classifier) => classifier.language)
|
|
33
|
-
.filter((depLanguage) => depLanguage !== language)
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @return the – currently only those arising from direct inheritance on classifier-level – dependencies of the given {@link Language languages},
|
|
39
|
-
* as a human-readable text
|
|
40
|
-
*/
|
|
41
|
-
export const verboseDependencies = (languages: Language[]): string => {
|
|
42
|
-
const nameSortedLanguages = nameSorted(languages)
|
|
43
|
-
return asString([
|
|
44
|
-
nameSortedLanguages.map((language) => {
|
|
45
|
-
const deps = dependenciesThroughDirectInheritanceOf(language)
|
|
46
|
-
const what = `direct type-wise dependencies (through inheritance)`
|
|
47
|
-
const cycle = cycleWith(language, dependenciesThroughDirectInheritanceOf)
|
|
48
|
-
return deps.length === 0
|
|
49
|
-
? `language ${language.name} has no ${what}`
|
|
50
|
-
: [
|
|
51
|
-
`language ${language.name} has the following ${what}:`,
|
|
52
|
-
indent([
|
|
53
|
-
nameSorted(dependenciesThroughDirectInheritanceOf(language)).map(nameOf),
|
|
54
|
-
when(cycle.length > 0)(
|
|
55
|
-
`⚠ language "${language.name}" is part of the following cycle through type-wise (through direct inheritance): ${cycle.map(nameOf).join(" -> ")}`
|
|
56
|
-
)
|
|
57
|
-
])
|
|
58
|
-
]
|
|
59
|
-
})
|
|
60
|
-
])
|
|
61
|
-
}
|
|
62
|
-
|