@lionweb/class-core-generator 0.7.0-alpha.1 → 0.7.0-alpha.2
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 +3 -0
- package/dist/api/entity-types.templates.d.ts +2 -3
- package/dist/api/entity-types.templates.d.ts.map +1 -1
- package/dist/api/entity-types.templates.js +8 -7
- package/dist/api/entity-types.templates.js.map +1 -1
- package/dist/api/generator.d.ts +0 -2
- package/dist/api/generator.d.ts.map +1 -1
- package/dist/api/generator.js +0 -1
- package/dist/api/generator.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.d.ts +0 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +0 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/language-file.templates.d.ts.map +1 -1
- package/dist/api/language-file.templates.js +2 -3
- package/dist/api/language-file.templates.js.map +1 -1
- package/dist/api/mega-factory.templates.d.ts +1 -2
- package/dist/api/mega-factory.templates.d.ts.map +1 -1
- package/dist/api/mega-factory.templates.js +3 -3
- package/dist/api/mega-factory.templates.js.map +1 -1
- package/package.json +6 -5
- package/src/api/entity-types.templates.ts +7 -10
- package/src/api/generator.ts +0 -3
- package/src/api/helpers/index.ts +0 -1
- package/src/api/index.ts +1 -2
- package/src/api/language-file.templates.ts +2 -4
- package/src/api/mega-factory.templates.ts +3 -3
- package/dist/api/helpers/mps-annotations.d.ts +0 -19
- package/dist/api/helpers/mps-annotations.d.ts.map +0 -1
- package/dist/api/helpers/mps-annotations.js +0 -65
- package/dist/api/helpers/mps-annotations.js.map +0 -1
- package/src/api/helpers/mps-annotations.ts +0 -67
package/CHANGELOG.md
CHANGED
|
@@ -2,3 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
## 0.7.0
|
|
4
4
|
|
|
5
|
+
* Removed 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
|
+
**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
|
+
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { LanguageEntity } from "@lionweb/core";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare const typeForLanguageEntity: (imports: Imports, mpsAnnotationsPerId: Record<LionWebId, MpsAnnotation[]>) => (entity: LanguageEntity) => import("littoral-templates").Template[];
|
|
2
|
+
import { Imports } from "./helpers/index.js";
|
|
3
|
+
export declare const typeForLanguageEntity: (imports: Imports) => (entity: LanguageEntity) => import("littoral-templates").Template[];
|
|
5
4
|
//# sourceMappingURL=entity-types.templates.d.ts.map
|
|
@@ -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,EAOjB,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"entity-types.templates.d.ts","sourceRoot":"","sources":["../../src/api/entity-types.templates.ts"],"names":[],"mappings":"AAiBA,OAAO,EAUH,cAAc,EAOjB,MAAM,eAAe,CAAA;AAKtB,OAAO,EAKH,OAAO,EAQV,MAAM,oBAAoB,CAAA;AAc3B,eAAO,MAAM,qBAAqB,YAAa,OAAO,cAqKlC,cAAc,4CAoBjC,CAAA"}
|
|
@@ -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 { 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";
|
|
18
19
|
import { commaSeparated, when, withNewlineAppended } from "littoral-templates";
|
|
19
20
|
import { indent, switchOrIf, withFirstUpper, wrapInIf } from "../utils/textgen.js";
|
|
20
|
-
import {
|
|
21
|
+
import { entityMetaType, extendsFrom, featuresToConcretelyImplementOf, implementsFrom, isAbstract, optionalityPostfix, tsFieldTypeForFeature, tsTypeForClassifier, tsTypeForDatatype, tsTypeForPrimitiveType, tsTypeForValueManager } from "./helpers/index.js";
|
|
21
22
|
const cardinalityPrefix = (feature) => {
|
|
22
23
|
if (feature instanceof Property) {
|
|
23
24
|
return feature.optional ? "Optional" : "Required";
|
|
@@ -27,7 +28,7 @@ const cardinalityPrefix = (feature) => {
|
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
30
|
const valueManagerFor = (feature) => `${cardinalityPrefix(feature)}${featureMetaType(feature)}ValueManager`;
|
|
30
|
-
export const typeForLanguageEntity = (imports
|
|
31
|
+
export const typeForLanguageEntity = (imports) => {
|
|
31
32
|
const sortedSuperTypesCond = (ts, prefix) => ts.length === 0 ? `` : `${prefix}${nameSorted(ts).map((t) => imports.entity(t)).join(", ")}`;
|
|
32
33
|
const extendsCond = (ref) => ` extends ${ref === builtinClassifiers.node ? imports.generic("NodeBase") : imports.entity(ref)}`;
|
|
33
34
|
const classMembersForProperty = (property) => {
|
|
@@ -138,13 +139,13 @@ export const typeForLanguageEntity = (imports, mpsAnnotationsPerId) => {
|
|
|
138
139
|
];
|
|
139
140
|
const typeForPrimitiveType = (primitiveType) => `export type ${primitiveType.name} = ${tsTypeForPrimitiveType(primitiveType)};`;
|
|
140
141
|
const jsDocFor = (entity) => {
|
|
141
|
-
const
|
|
142
|
-
const conceptDescription =
|
|
143
|
-
const hasShortConceptDescription = !!(conceptDescription?.
|
|
144
|
-
const deprecated =
|
|
142
|
+
const annotations = ioLionWebMpsSpecificAnnotationsFrom(entity);
|
|
143
|
+
const conceptDescription = annotations.find((annotation) => annotation instanceof ConceptDescription);
|
|
144
|
+
const hasShortConceptDescription = !!(conceptDescription?.conceptShortDescription);
|
|
145
|
+
const deprecated = annotations.find((annotation) => annotation instanceof Deprecated);
|
|
145
146
|
return when(hasShortConceptDescription || deprecated !== undefined)([
|
|
146
147
|
`/**`,
|
|
147
|
-
when(hasShortConceptDescription)(() => ` * ${conceptDescription.
|
|
148
|
+
when(hasShortConceptDescription)(() => ` * ${conceptDescription.conceptShortDescription}`),
|
|
148
149
|
when(deprecated !== undefined)(() => ` * @deprecated ${deprecated.comment ?? ""}${deprecated.build === null ? "" : ` (build: ${deprecated.build})`}`),
|
|
149
150
|
` */`
|
|
150
151
|
]);
|
|
@@ -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,EAEX,IAAI,EACJ,UAAU,EACV,aAAa,EACb,QAAQ,EACR,SAAS,EAEZ,MAAM,eAAe,CAAA;
|
|
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,sEA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ChE,KAAK;YACL,IAAI,CAAC,0BAA0B,CAAC,CAC5B,GAAG,EAAE,CAAC,MAAM,kBAAkB,CAAC,uBAAuB,EAAE,CAC3D;YACD,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAC1B,GAAG,EAAE,CAAC,kBAAkB,UAAU,CAAC,OAAO,IAAI,EAAE,GAAG,UAAU,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,UAAU,CAAC,KAAK,GAAG,EAAE,CACxH;YACD,KAAK;SACR,CAAC,CAAA;IACN,CAAC,CAAA;IAED,OAAO,CAAC,MAAsB,EAAE,EAAE,CAC9B;QACI,QAAQ,CAAC,MAAM,CAAC;QAChB,CAAC,GAAG,EAAE;YACF,IAAI,MAAM,YAAY,SAAS,EAAE,CAAC;gBAC9B,OAAO,YAAY,CAAC,MAAM,CAAC,CAAA;YAC/B,CAAC;YACD,IAAI,MAAM,YAAY,UAAU,EAAE,CAAC;gBAC/B,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAA;YAC7C,CAAC;YACD,IAAI,MAAM,YAAY,WAAW,EAAE,CAAC;gBAChC,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAA;YACrC,CAAC;YACD,IAAI,MAAM,YAAY,aAAa,EAAE,CAAC;gBAClC,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAA;YACvC,CAAC;YACD,OAAO,iCAAiC,cAAc,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,IAAI,GAAG,CAAA;QACrF,CAAC,CAAC,EAAE;KACP,CAAA;AAET,CAAC,CAAA"}
|
package/dist/api/generator.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/api/generator.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAwB,QAAQ,EAAY,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/api/generator.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAwB,QAAQ,EAAY,MAAM,eAAe,CAAA;AAaxE,MAAM,MAAM,gBAAgB,GAAG;IAC3B,qBAAqB,EAAE,MAAM,CAAA;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AASD,eAAO,MAAM,gBAAgB,aAAc,QAAQ,kBAAkB,MAAM,YAAY,QAAQ,gBAAgB,CAAC,KAAG,MAKlH,CAAA;AAGD,eAAO,MAAM,4BAA4B,sBAAuB,MAAM,kBAAkB,MAAM,YAAY,QAAQ,gBAAgB,CAAC,SAQlI,CAAA;AAGD,eAAO,MAAM,wBAAwB,cAAe,QAAQ,EAAE,kBAAkB,MAAM,iBAAiB,QAAQ,gBAAgB,CAAC,SAkB/H,CAAA"}
|
package/dist/api/generator.js
CHANGED
|
@@ -23,7 +23,6 @@ import { indexTsFor } from "./index-ts.js";
|
|
|
23
23
|
import { languageFileFor } from "./language-file.templates.js";
|
|
24
24
|
const properGenericImportLocation = "@lionweb/class-core";
|
|
25
25
|
const withDefaults = (options) => ({
|
|
26
|
-
mpsAnnotations: options?.mpsAnnotations ?? [],
|
|
27
26
|
genericImportLocation: options?.genericImportLocation ?? properGenericImportLocation,
|
|
28
27
|
header: options?.header
|
|
29
28
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/api/generator.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,oBAAoB,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAo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AAQ,GAAG,gBAAgB,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,CAAC,CAAA;QACpE,OAAO,CAAC,GAAG,CAAC,UAAU,QAAQ,iBAAiB,IAAI,aAAa,OAAO,SAAS,GAAG,QAAQ,EAAE,GAAG,CAAC,CAAA;IACrG,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACrB,OAAO,CAAC,GAAG,EAAE,CAAA;AACjB,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,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/helpers/index.ts"],"names":[],"mappings":"AAiBA,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA"}
|
|
@@ -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,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA
|
|
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,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA"}
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { generateLanguage, generateApiFromLanguages, generateApiFromLanguagesJson } from "./generator.js";
|
|
2
2
|
export * from "./generation-headers.js";
|
|
3
|
-
export * from "./helpers/mps-annotations.js";
|
|
4
3
|
export * from "./mega-factory.templates.js";
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAiBA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AACzG,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA"}
|
package/dist/api/index.js
CHANGED
|
@@ -16,6 +16,5 @@
|
|
|
16
16
|
// SPDX-License-Identifier: Apache-2.0
|
|
17
17
|
export { generateLanguage, generateApiFromLanguages, generateApiFromLanguagesJson } from "./generator.js";
|
|
18
18
|
export * from "./generation-headers.js";
|
|
19
|
-
export * from "./helpers/mps-annotations.js";
|
|
20
19
|
export * from "./mega-factory.templates.js";
|
|
21
20
|
//# sourceMappingURL=index.js.map
|
package/dist/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/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,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/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,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AACzG,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"language-file.templates.d.ts","sourceRoot":"","sources":["../../src/api/language-file.templates.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAW,QAAQ,EAAE,MAAM,eAAe,CAAA;AAMjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAQjD,eAAO,MAAM,eAAe,aAAc,QAAQ,WAAW,gBAAgB,
|
|
1
|
+
{"version":3,"file":"language-file.templates.d.ts","sourceRoot":"","sources":["../../src/api/language-file.templates.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAW,QAAQ,EAAE,MAAM,eAAe,CAAA;AAMjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAQjD,eAAO,MAAM,eAAe,aAAc,QAAQ,WAAW,gBAAgB,WAsC5E,CAAA"}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// SPDX-License-Identifier: Apache-2.0
|
|
17
17
|
import { sortedStringsByUppercase } from "@lionweb/ts-utils";
|
|
18
18
|
import { Concept } from "@lionweb/core";
|
|
19
|
-
import { dependencyOrderOf
|
|
19
|
+
import { dependencyOrderOf } from "@lionweb/ts-utils";
|
|
20
20
|
import { asString, commaSeparated, when, withNewlineAppended } from "littoral-templates";
|
|
21
21
|
import { indent } from "../utils/textgen.js";
|
|
22
22
|
import { typeForLanguageEntity } from "./entity-types.templates.js";
|
|
@@ -30,7 +30,6 @@ export const languageFileFor = (language, options) => {
|
|
|
30
30
|
if (typeof orderedEntities === "boolean") {
|
|
31
31
|
throw new Error(`language ${name} has a cycle among the graph of entities with edges formed by the inheritance dependency`);
|
|
32
32
|
}
|
|
33
|
-
const mpsAnnotationsPerId = groupBy(options.mpsAnnotations, ({ annotatedNodeId }) => annotatedNodeId);
|
|
34
33
|
const postImportsPart = [
|
|
35
34
|
``,
|
|
36
35
|
reflectiveClassFor(imports)(language),
|
|
@@ -38,7 +37,7 @@ export const languageFileFor = (language, options) => {
|
|
|
38
37
|
``,
|
|
39
38
|
orderedEntities
|
|
40
39
|
.filter((entity) => entity.language === language)
|
|
41
|
-
.map(withNewlineAppended(typeForLanguageEntity(imports
|
|
40
|
+
.map(withNewlineAppended(typeForLanguageEntity(imports)))
|
|
42
41
|
];
|
|
43
42
|
return asString([
|
|
44
43
|
options?.header ?? [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"language-file.templates.js","sourceRoot":"","sources":["../../src/api/language-file.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,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAY,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"language-file.templates.js","sourceRoot":"","sources":["../../src/api/language-file.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,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAY,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAEnE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAEpE,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,KAAe,EAAE,EAAE,CACrD,IAAI,CAAC,KAAK,CAAC,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,WAAW,CAAC;QACrD,eAAe,CAAC,eAAe,EAAE,OAAO,CAAC,WAAW,CAAC;QACrD,eAAe,CAAC,OAAO,CAAC,qBAAqB,EAAE,OAAO,CAAC,cAAc,CAAC;QACtE,eAAe,CAAC,cAAc,EAAE,OAAO,CAAC,eAAe,CAAC;QACxD,eAAe;KAClB,CAAC,CAAA;AACN,CAAC,CAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { Language } from "@lionweb/core";
|
|
2
|
-
|
|
3
|
-
export declare const megaFactoryFor: (megaFactoryName: string, languages: Language[], mpsAnnotations?: MpsAnnotation[], header?: string) => string;
|
|
2
|
+
export declare const megaFactoryFor: (megaFactoryName: string, languages: Language[], header?: string) => string;
|
|
4
3
|
//# sourceMappingURL=mega-factory.templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mega-factory.templates.d.ts","sourceRoot":"","sources":["../../src/api/mega-factory.templates.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAc,QAAQ,EAAkB,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"mega-factory.templates.d.ts","sourceRoot":"","sources":["../../src/api/mega-factory.templates.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAc,QAAQ,EAAkB,MAAM,eAAe,CAAA;AAMpE,eAAO,MAAM,cAAc,oBAAqB,MAAM,aAAa,QAAQ,EAAE,WAAW,MAAM,WAgD7F,CAAA"}
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
import { isConcrete } from "@lionweb/core";
|
|
18
18
|
import { asString, commaSeparated } from "littoral-templates";
|
|
19
19
|
import { asJSIdentifier, indent } from "../utils/textgen.js";
|
|
20
|
-
import { Deprecated } from "
|
|
21
|
-
export const megaFactoryFor = (megaFactoryName, languages,
|
|
22
|
-
const isNotDeprecated = (entity) => !
|
|
20
|
+
import { Deprecated, ioLionWebMpsSpecificAnnotationsFrom } from "@lionweb/io-lionweb-mps-specific";
|
|
21
|
+
export const megaFactoryFor = (megaFactoryName, languages, header) => {
|
|
22
|
+
const isNotDeprecated = (entity) => !ioLionWebMpsSpecificAnnotationsFrom(entity).some((annotation) => annotation instanceof Deprecated);
|
|
23
23
|
const requiresFactoryMethod = (entity) => isConcrete(entity) && isNotDeprecated(entity);
|
|
24
24
|
const factoryFor = (language) => [
|
|
25
25
|
`${asJSIdentifier(language.name)}Factory = {`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mega-factory.templates.js","sourceRoot":"","sources":["../../src/api/mega-factory.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,EAAE,UAAU,EAA4B,MAAM,eAAe,CAAA;AACpE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"mega-factory.templates.js","sourceRoot":"","sources":["../../src/api/mega-factory.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,EAAE,UAAU,EAA4B,MAAM,eAAe,CAAA;AACpE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAE7D,OAAO,EAAE,cAAc,EAA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F,wBAAwB;QACxB,EAAE;QACF,oCAAoC;QACpC,EAAE;QACF,EAAE;QACF,gBAAgB,eAAe,IAAI;QACnC,MAAM,CAAC;YACH,EAAE;YACF,cAAc;YACd,MAAM,CAAC,CAAC,4CAA4C,CAAC,CAAC;YACtD,KAAK;YACL,GAAG;YACH,EAAE;YACF,2BAA2B,CAAC,GAAG,CAAC,UAAU,CAAC;SAC9C,CAAC;QACF,GAAG;QACH,EAAE;KACL,CAAC,CAAA;AACN,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lionweb/class-core-generator",
|
|
3
|
-
"version": "0.7.0-alpha.
|
|
3
|
+
"version": "0.7.0-alpha.2",
|
|
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,10 +27,11 @@
|
|
|
27
27
|
"release": "npm publish"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@lionweb/core": "0.7.0-alpha.
|
|
31
|
-
"@lionweb/
|
|
32
|
-
"@lionweb/
|
|
33
|
-
"@lionweb/
|
|
30
|
+
"@lionweb/core": "0.7.0-alpha.2",
|
|
31
|
+
"@lionweb/io-lionweb-mps-specific": "0.7.0-alpha.2",
|
|
32
|
+
"@lionweb/json": "0.7.0-alpha.2",
|
|
33
|
+
"@lionweb/ts-utils": "0.7.0-alpha.2",
|
|
34
|
+
"@lionweb/utilities": "0.7.0-alpha.2",
|
|
34
35
|
"@types/node": "22.15.21",
|
|
35
36
|
"littoral-templates": "0.3.0",
|
|
36
37
|
"typescript": "5.3.3"
|
|
@@ -33,20 +33,17 @@ import {
|
|
|
33
33
|
Reference,
|
|
34
34
|
SingleRef
|
|
35
35
|
} from "@lionweb/core"
|
|
36
|
-
import {
|
|
36
|
+
import { ConceptDescription, Deprecated, ioLionWebMpsSpecificAnnotationsFrom } from "@lionweb/io-lionweb-mps-specific"
|
|
37
37
|
import { commaSeparated, when, withNewlineAppended } from "littoral-templates"
|
|
38
38
|
|
|
39
39
|
import { indent, switchOrIf, withFirstUpper, wrapInIf } from "../utils/textgen.js"
|
|
40
40
|
import {
|
|
41
|
-
ConceptDescription,
|
|
42
|
-
Deprecated,
|
|
43
41
|
entityMetaType,
|
|
44
42
|
extendsFrom,
|
|
45
43
|
featuresToConcretelyImplementOf,
|
|
46
44
|
implementsFrom,
|
|
47
45
|
Imports,
|
|
48
46
|
isAbstract,
|
|
49
|
-
MpsAnnotation,
|
|
50
47
|
optionalityPostfix,
|
|
51
48
|
tsFieldTypeForFeature,
|
|
52
49
|
tsTypeForClassifier,
|
|
@@ -67,7 +64,7 @@ const cardinalityPrefix = (feature: Feature) => {
|
|
|
67
64
|
const valueManagerFor = (feature: Feature) =>
|
|
68
65
|
`${cardinalityPrefix(feature)}${featureMetaType(feature)}ValueManager`
|
|
69
66
|
|
|
70
|
-
export const typeForLanguageEntity = (imports: Imports
|
|
67
|
+
export const typeForLanguageEntity = (imports: Imports) => {
|
|
71
68
|
|
|
72
69
|
const sortedSuperTypesCond = <T extends Classifier>(ts: T[], prefix: string): string =>
|
|
73
70
|
ts.length === 0 ? `` : `${prefix}${nameSorted(ts).map((t) => imports.entity(t)).join(", ")}`
|
|
@@ -216,14 +213,14 @@ export const typeForLanguageEntity = (imports: Imports, mpsAnnotationsPerId: Rec
|
|
|
216
213
|
`export type ${primitiveType.name} = ${tsTypeForPrimitiveType(primitiveType)};`
|
|
217
214
|
|
|
218
215
|
const jsDocFor = (entity: LanguageEntity) => {
|
|
219
|
-
const
|
|
220
|
-
const conceptDescription =
|
|
221
|
-
const hasShortConceptDescription = !!(conceptDescription?.
|
|
222
|
-
const deprecated =
|
|
216
|
+
const annotations = ioLionWebMpsSpecificAnnotationsFrom(entity)
|
|
217
|
+
const conceptDescription = annotations.find((annotation) => annotation instanceof ConceptDescription) as ConceptDescription
|
|
218
|
+
const hasShortConceptDescription = !!(conceptDescription?.conceptShortDescription)
|
|
219
|
+
const deprecated = annotations.find((annotation) => annotation instanceof Deprecated) as Deprecated
|
|
223
220
|
return when(hasShortConceptDescription || deprecated !== undefined)([
|
|
224
221
|
`/**`,
|
|
225
222
|
when(hasShortConceptDescription)(
|
|
226
|
-
() => ` * ${conceptDescription.
|
|
223
|
+
() => ` * ${conceptDescription.conceptShortDescription}`
|
|
227
224
|
),
|
|
228
225
|
when(deprecated !== undefined)(
|
|
229
226
|
() => ` * @deprecated ${deprecated.comment ?? ""}${deprecated.build === null ? "" : ` (build: ${deprecated.build})`}`
|
package/src/api/generator.ts
CHANGED
|
@@ -21,7 +21,6 @@ import { readFileAsJson } from "@lionweb/utilities"
|
|
|
21
21
|
import { writeFileSync } from "fs"
|
|
22
22
|
import { join } from "path"
|
|
23
23
|
import { cwd } from "process"
|
|
24
|
-
import { MpsAnnotation } from "./helpers/index.js"
|
|
25
24
|
|
|
26
25
|
import { indexTsFor } from "./index-ts.js"
|
|
27
26
|
import { languageFileFor } from "./language-file.templates.js"
|
|
@@ -30,14 +29,12 @@ const properGenericImportLocation = "@lionweb/class-core"
|
|
|
30
29
|
|
|
31
30
|
|
|
32
31
|
export type GeneratorOptions = {
|
|
33
|
-
mpsAnnotations: MpsAnnotation[]
|
|
34
32
|
genericImportLocation: string
|
|
35
33
|
header?: string
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
|
|
39
37
|
const withDefaults = (options?: Partial<GeneratorOptions>): GeneratorOptions => ({
|
|
40
|
-
mpsAnnotations: options?.mpsAnnotations ?? [],
|
|
41
38
|
genericImportLocation: options?.genericImportLocation ?? properGenericImportLocation,
|
|
42
39
|
header: options?.header
|
|
43
40
|
})
|
package/src/api/helpers/index.ts
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -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
|
|
|
18
|
-
export {generateLanguage, generateApiFromLanguages, generateApiFromLanguagesJson} from "./generator.js"
|
|
18
|
+
export { generateLanguage, generateApiFromLanguages, generateApiFromLanguagesJson } from "./generator.js"
|
|
19
19
|
export * from "./generation-headers.js"
|
|
20
|
-
export * from "./helpers/mps-annotations.js"
|
|
21
20
|
export * from "./mega-factory.templates.js"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { sortedStringsByUppercase } from "@lionweb/ts-utils"
|
|
19
19
|
import { Concept, Language } from "@lionweb/core"
|
|
20
|
-
import { dependencyOrderOf
|
|
20
|
+
import { dependencyOrderOf } from "@lionweb/ts-utils"
|
|
21
21
|
import { asString, commaSeparated, when, withNewlineAppended } from "littoral-templates"
|
|
22
22
|
import { indent } from "../utils/textgen.js"
|
|
23
23
|
|
|
@@ -41,8 +41,6 @@ export const languageFileFor = (language: Language, options: GeneratorOptions) =
|
|
|
41
41
|
throw new Error(`language ${name} has a cycle among the graph of entities with edges formed by the inheritance dependency`)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
const mpsAnnotationsPerId = groupBy(options.mpsAnnotations, ({annotatedNodeId}) => annotatedNodeId)
|
|
45
|
-
|
|
46
44
|
const postImportsPart = [
|
|
47
45
|
``,
|
|
48
46
|
reflectiveClassFor(imports)(language),
|
|
@@ -50,7 +48,7 @@ export const languageFileFor = (language: Language, options: GeneratorOptions) =
|
|
|
50
48
|
``,
|
|
51
49
|
orderedEntities
|
|
52
50
|
.filter((entity) => entity.language === language)
|
|
53
|
-
.map(withNewlineAppended(typeForLanguageEntity(imports
|
|
51
|
+
.map(withNewlineAppended(typeForLanguageEntity(imports)))
|
|
54
52
|
]
|
|
55
53
|
|
|
56
54
|
return asString([
|
|
@@ -19,11 +19,11 @@ import { isConcrete, Language, LanguageEntity } from "@lionweb/core"
|
|
|
19
19
|
import { asString, commaSeparated } from "littoral-templates"
|
|
20
20
|
|
|
21
21
|
import { asJSIdentifier, indent } from "../utils/textgen.js"
|
|
22
|
-
import { Deprecated,
|
|
22
|
+
import { Deprecated, ioLionWebMpsSpecificAnnotationsFrom } from "@lionweb/io-lionweb-mps-specific"
|
|
23
23
|
|
|
24
|
-
export const megaFactoryFor = (megaFactoryName: string, languages: Language[],
|
|
24
|
+
export const megaFactoryFor = (megaFactoryName: string, languages: Language[], header?: string) => {
|
|
25
25
|
const isNotDeprecated = (entity: LanguageEntity) =>
|
|
26
|
-
!
|
|
26
|
+
!ioLionWebMpsSpecificAnnotationsFrom(entity).some((annotation) => annotation instanceof Deprecated)
|
|
27
27
|
|
|
28
28
|
const requiresFactoryMethod = (entity: LanguageEntity) => isConcrete(entity) && isNotDeprecated(entity)
|
|
29
29
|
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { LionWebId, LionWebJsonChunk } from "@lionweb/json";
|
|
2
|
-
export declare abstract class MpsAnnotation {
|
|
3
|
-
readonly annotatedNodeId: LionWebId;
|
|
4
|
-
constructor(annotatedNodeId: LionWebId);
|
|
5
|
-
}
|
|
6
|
-
export declare class ConceptDescription extends MpsAnnotation {
|
|
7
|
-
readonly shortDescription: string | null;
|
|
8
|
-
readonly alias: string | null;
|
|
9
|
-
constructor(annotatedNodeId: LionWebId, shortDescription: string | null, alias: string | null);
|
|
10
|
-
toString(): string;
|
|
11
|
-
}
|
|
12
|
-
export declare class Deprecated extends MpsAnnotation {
|
|
13
|
-
readonly comment: string | null;
|
|
14
|
-
readonly build: string | null;
|
|
15
|
-
constructor(annotatedNodeId: LionWebId, comment: string | null, build: string | null);
|
|
16
|
-
toString(): string;
|
|
17
|
-
}
|
|
18
|
-
export declare const extractedMpsAnnotations: ({ nodes }: LionWebJsonChunk) => MpsAnnotation[];
|
|
19
|
-
//# sourceMappingURL=mps-annotations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mps-annotations.d.ts","sourceRoot":"","sources":["../../../src/api/helpers/mps-annotations.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAc,MAAM,eAAe,CAAA;AAEvE,8BAAsB,aAAa;aACH,eAAe,EAAE,SAAS;gBAA1B,eAAe,EAAE,SAAS;CACzD;AAED,qBAAa,kBAAmB,SAAQ,aAAa;aACO,gBAAgB,EAAE,MAAM,GAAG,IAAI;aAAkB,KAAK,EAAE,MAAM,GAAG,IAAI;gBAAjH,eAAe,EAAE,SAAS,EAAkB,gBAAgB,EAAE,MAAM,GAAG,IAAI,EAAkB,KAAK,EAAE,MAAM,GAAG,IAAI;IAG7H,QAAQ;CAGX;AAED,qBAAa,UAAW,SAAQ,aAAa;aACe,OAAO,EAAE,MAAM,GAAG,IAAI;aAAkB,KAAK,EAAE,MAAM,GAAG,IAAI;gBAAxG,eAAe,EAAE,SAAS,EAAkB,OAAO,EAAE,MAAM,GAAG,IAAI,EAAkB,KAAK,EAAE,MAAM,GAAG,IAAI;IAGpH,QAAQ;CAGX;AAGD,eAAO,MAAM,uBAAuB,cAAa,gBAAgB,KAAG,aAAa,EAuB3E,CAAA"}
|
|
@@ -1,65 +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
|
-
export class MpsAnnotation {
|
|
18
|
-
constructor(annotatedNodeId) {
|
|
19
|
-
this.annotatedNodeId = annotatedNodeId;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export class ConceptDescription extends MpsAnnotation {
|
|
23
|
-
constructor(annotatedNodeId, shortDescription, alias) {
|
|
24
|
-
super(annotatedNodeId);
|
|
25
|
-
this.shortDescription = shortDescription;
|
|
26
|
-
this.alias = alias;
|
|
27
|
-
}
|
|
28
|
-
toString() {
|
|
29
|
-
return `<ConceptDescription> annotatedNodeId=${this.annotatedNodeId}, shortDescription="${this.shortDescription}"`;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export class Deprecated extends MpsAnnotation {
|
|
33
|
-
constructor(annotatedNodeId, comment, build) {
|
|
34
|
-
super(annotatedNodeId);
|
|
35
|
-
this.comment = comment;
|
|
36
|
-
this.build = build;
|
|
37
|
-
}
|
|
38
|
-
toString() {
|
|
39
|
-
return `<Deprecated> annotatedNodeId=${this.annotatedNodeId}, comment="${this.comment}", build="${this.build}"`;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
export const extractedMpsAnnotations = ({ nodes }) => nodes.flatMap(({ classifier, properties, parent }) => {
|
|
43
|
-
const propertyValue = (key) => {
|
|
44
|
-
const property = properties.find(({ property }) => property.key === key);
|
|
45
|
-
return property === undefined
|
|
46
|
-
? null
|
|
47
|
-
: property.value;
|
|
48
|
-
};
|
|
49
|
-
if (classifier.language !== "io-lionweb-mps-specific" || classifier.version !== "0") {
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
switch (classifier.key) {
|
|
53
|
-
case "ConceptDescription": {
|
|
54
|
-
return [new ConceptDescription(parent, propertyValue("ConceptDescription-conceptShortDescription"), propertyValue("ConceptDescription-conceptAlias"))];
|
|
55
|
-
}
|
|
56
|
-
case "Deprecated": {
|
|
57
|
-
return [new Deprecated(parent, propertyValue("Deprecated-comment"), propertyValue("Deprecated-build"))];
|
|
58
|
-
}
|
|
59
|
-
default: {
|
|
60
|
-
console.log(`couldn't handle MPS annotation with key ${classifier.key}`);
|
|
61
|
-
return [];
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
//# sourceMappingURL=mps-annotations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mps-annotations.js","sourceRoot":"","sources":["../../../src/api/helpers/mps-annotations.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;AAItC,MAAM,OAAgB,aAAa;IAC/B,YAA4B,eAA0B;QAA1B,oBAAe,GAAf,eAAe,CAAW;IAAG,CAAC;CAC7D;AAED,MAAM,OAAO,kBAAmB,SAAQ,aAAa;IACjD,YAAY,eAA0B,EAAkB,gBAA+B,EAAkB,KAAoB;QACzH,KAAK,CAAC,eAAe,CAAC,CAAA;QAD8B,qBAAgB,GAAhB,gBAAgB,CAAe;QAAkB,UAAK,GAAL,KAAK,CAAe;IAE7H,CAAC;IACD,QAAQ;QACJ,OAAO,wCAAwC,IAAI,CAAC,eAAe,uBAAuB,IAAI,CAAC,gBAAgB,GAAG,CAAA;IACtH,CAAC;CACJ;AAED,MAAM,OAAO,UAAW,SAAQ,aAAa;IACzC,YAAY,eAA0B,EAAkB,OAAsB,EAAkB,KAAoB;QAChH,KAAK,CAAC,eAAe,CAAC,CAAA;QAD8B,YAAO,GAAP,OAAO,CAAe;QAAkB,UAAK,GAAL,KAAK,CAAe;IAEpH,CAAC;IACD,QAAQ;QACJ,OAAO,gCAAgC,IAAI,CAAC,eAAe,cAAc,IAAI,CAAC,OAAO,aAAa,IAAI,CAAC,KAAK,GAAG,CAAA;IACnH,CA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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 { LionWebId, LionWebJsonChunk, LionWebKey } from "@lionweb/json"
|
|
19
|
-
|
|
20
|
-
export abstract class MpsAnnotation {
|
|
21
|
-
constructor(public readonly annotatedNodeId: LionWebId) {}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export class ConceptDescription extends MpsAnnotation {
|
|
25
|
-
constructor(annotatedNodeId: LionWebId, public readonly shortDescription: string | null, public readonly alias: string | null) {
|
|
26
|
-
super(annotatedNodeId)
|
|
27
|
-
}
|
|
28
|
-
toString() {
|
|
29
|
-
return `<ConceptDescription> annotatedNodeId=${this.annotatedNodeId}, shortDescription="${this.shortDescription}"`
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export class Deprecated extends MpsAnnotation {
|
|
34
|
-
constructor(annotatedNodeId: LionWebId, public readonly comment: string | null, public readonly build: string | null) {
|
|
35
|
-
super(annotatedNodeId)
|
|
36
|
-
}
|
|
37
|
-
toString() {
|
|
38
|
-
return `<Deprecated> annotatedNodeId=${this.annotatedNodeId}, comment="${this.comment}", build="${this.build}"`
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export const extractedMpsAnnotations = ({nodes}: LionWebJsonChunk): MpsAnnotation[] =>
|
|
44
|
-
nodes.flatMap<MpsAnnotation>(({classifier, properties, parent}) => {
|
|
45
|
-
const propertyValue = (key: LionWebKey): string | null => {
|
|
46
|
-
const property = properties.find(({property}) => property.key === key)
|
|
47
|
-
return property === undefined
|
|
48
|
-
? null
|
|
49
|
-
: property.value
|
|
50
|
-
}
|
|
51
|
-
if (classifier.language !== "io-lionweb-mps-specific" || classifier.version !== "0") {
|
|
52
|
-
return []
|
|
53
|
-
}
|
|
54
|
-
switch (classifier.key) {
|
|
55
|
-
case "ConceptDescription": {
|
|
56
|
-
return [new ConceptDescription(parent!, propertyValue("ConceptDescription-conceptShortDescription"), propertyValue("ConceptDescription-conceptAlias"))]
|
|
57
|
-
}
|
|
58
|
-
case "Deprecated": {
|
|
59
|
-
return [new Deprecated(parent!, propertyValue("Deprecated-comment"), propertyValue("Deprecated-build"))]
|
|
60
|
-
}
|
|
61
|
-
default: {
|
|
62
|
-
console.log(`couldn't handle MPS annotation with key ${classifier.key}`)
|
|
63
|
-
return []
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
|