@lionweb/io-lionweb-mps-specific 0.7.0-beta.9 → 0.7.0

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.
@@ -1,7 +1,12 @@
1
1
  import { M3Concept } from "@lionweb/core";
2
+ import { LionWebJsonChunk } from "@lionweb/json";
2
3
  import { IoLionWebMpsSpecificAnnotation } from "./implementation.js";
3
4
  /**
4
5
  * @return the `io.lionweb.mps.specific` annotations present on the given node.
5
6
  */
6
7
  export declare const ioLionWebMpsSpecificAnnotationsFrom: (node: M3Concept) => IoLionWebMpsSpecificAnnotation[];
8
+ /**
9
+ * Replaces stated version "0" of language "io-lionweb-mps-specific" with its actual version.
10
+ */
11
+ export declare const repairIoLionWebMpsSpecificAnnotations: (serializationChunk: LionWebJsonChunk) => void;
7
12
  //# sourceMappingURL=annotations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../src/annotations.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAA;AAEpE;;GAEG;AACH,eAAO,MAAM,mCAAmC,SAAU,SAAS,KAAG,8BAA8B,EAGqB,CAAA"}
1
+ {"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../src/annotations.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAA0B,MAAM,eAAe,CAAA;AAExE,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAA;AAIpE;;GAEG;AACH,eAAO,MAAM,mCAAmC,GAAI,MAAM,SAAS,KAAG,8BAA8B,EAGqB,CAAA;AAGzH;;GAEG;AACH,eAAO,MAAM,qCAAqC,GAAI,oBAAoB,gBAAgB,SAuBzF,CAAA"}
@@ -15,10 +15,38 @@
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
  import { IoLionWebMpsSpecificAnnotation } from "./implementation.js";
18
+ import { ioLionWebMpsSpecificLanguage } from "./definition.js";
18
19
  /**
19
20
  * @return the `io.lionweb.mps.specific` annotations present on the given node.
20
21
  */
21
22
  export const ioLionWebMpsSpecificAnnotationsFrom = (node) => node
22
23
  .annotations
23
24
  .filter((annotation) => annotation instanceof IoLionWebMpsSpecificAnnotation);
25
+ /**
26
+ * Replaces stated version "0" of language "io-lionweb-mps-specific" with its actual version.
27
+ */
28
+ export const repairIoLionWebMpsSpecificAnnotations = (serializationChunk) => {
29
+ serializationChunk.languages.forEach((usedLanguage) => {
30
+ if (usedLanguage.key === ioLionWebMpsSpecificLanguage.key) {
31
+ usedLanguage.version = ioLionWebMpsSpecificLanguage.version;
32
+ }
33
+ });
34
+ const repairMetaPointer = (metaPointer) => {
35
+ if (metaPointer.language === ioLionWebMpsSpecificLanguage.key) {
36
+ metaPointer.version = ioLionWebMpsSpecificLanguage.version;
37
+ }
38
+ };
39
+ serializationChunk.nodes.forEach((node) => {
40
+ repairMetaPointer(node.classifier);
41
+ node.properties.forEach((propertySetting) => {
42
+ repairMetaPointer(propertySetting.property);
43
+ });
44
+ node.containments.forEach((containmentSetting) => {
45
+ repairMetaPointer(containmentSetting.containment);
46
+ });
47
+ node.references.forEach((referenceSetting) => {
48
+ repairMetaPointer(referenceSetting.reference);
49
+ });
50
+ });
51
+ };
24
52
  //# sourceMappingURL=annotations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotations.js","sourceRoot":"","sources":["../src/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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AAK,4BAA4B,CAAC,GAAG,EAAE,CAAC;YAC5D,WAAW,CAAC,OAAO,GAAG,4BAA4B,CAAC,OAAO,CAAA;QAC9D,CAAC;IACL,CAAC,CAAA;IACD,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACtC,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAClC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,EAAE;YACxC,iBAAiB,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAA;QAC/C,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,kBAAkB,EAAE,EAAE;YAC7C,iBAAiB,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAA;QACrD,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,gBAAgB,EAAE,EAAE;YACzC,iBAAiB,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAA;QACjD,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACN,CAAC,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { Annotation } from "@lionweb/core";
2
- export declare const ioLionWebMpsSpecificLanguage: import("@lionweb/core/dist/m3/types.js").Language;
2
+ export declare const ioLionWebMpsSpecificLanguage: import("@lionweb/core").Language;
3
3
  export declare const ioLionWebMpsSpecificClassifiers: {
4
4
  ConceptDescription: Annotation;
5
5
  Deprecated: Annotation;
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../src/definition.ts"],"names":[],"mappings":"AAiBA,OAAO,EACH,UAAU,EAMb,MAAM,eAAe,CAAA;AAmCtB,eAAO,MAAM,4BAA4B,mDAAmB,CAAA;AAG5D,eAAO,MAAM,+BAA+B;;;;;;CAM3C,CAAA"}
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../src/definition.ts"],"names":[],"mappings":"AAiBA,OAAO,EACH,UAAU,EAMb,MAAM,eAAe,CAAA;AAmCtB,eAAO,MAAM,4BAA4B,kCAAmB,CAAA;AAG5D,eAAO,MAAM,+BAA+B;;;;;;CAM3C,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"deserializer.d.ts","sourceRoot":"","sources":["../src/deserializer.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAIH,QAAQ,EAIR,iBAAiB,EACpB,MAAM,eAAe,CAAA;AAKtB;;;;GAIG;AACH,eAAO,MAAM,4CAA4C,uBAAwB,gBAAgB,mBAAkB,iBAAiB,eAQtE,CAAA"}
1
+ {"version":3,"file":"deserializer.d.ts","sourceRoot":"","sources":["../src/deserializer.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAIH,QAAQ,EAIR,iBAAiB,EACpB,MAAM,eAAe,CAAA;AAKtB;;;;GAIG;AACH,eAAO,MAAM,4CAA4C,GAAI,oBAAoB,gBAAgB,EAAE,iBAAgB,iBAA4C,KAQ3G,QAAQ,EAAE,CAAA"}
@@ -14,7 +14,7 @@
14
14
  //
15
15
  // SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
16
16
  // SPDX-License-Identifier: Apache-2.0
17
- import { DefaultPrimitiveTypeDeserializer, defaultSimplisticHandler, deserializeChunk, Language, lioncore, lioncoreBuiltins, nodesExtractorUsing } from "@lionweb/core";
17
+ import { builtinPropertyValueDeserializer, defaultSimplisticHandler, deserializeChunk, Language, lioncore, lioncoreBuiltins, nodesExtractorUsing } from "@lionweb/core";
18
18
  import { lioncoreExtractionFacade } from "@lionweb/core/dist/m3/facade.js";
19
19
  import { ioLionWebMpsSpecificLanguage } from "./definition.js";
20
20
  import { combinedWriter } from "./facade.js";
@@ -23,5 +23,5 @@ import { combinedWriter } from "./facade.js";
23
23
  * Any LionCore/M3 node can be annotated using annotations from the `io.lionweb.mps.specific` language.
24
24
  * Problems are reported through the given {@link SimplisticHandler} which defaults to {@link defaultSimplisticHandler}.
25
25
  */
26
- export const deserializeLanguagesWithIoLionWebMpsSpecific = (serializationChunk, problemHandler = defaultSimplisticHandler) => deserializeChunk(serializationChunk, combinedWriter, [lioncore, ioLionWebMpsSpecificLanguage], [lioncore, lioncoreBuiltins].flatMap(nodesExtractorUsing(lioncoreExtractionFacade)), new DefaultPrimitiveTypeDeserializer(), problemHandler).filter((node) => node instanceof Language);
26
+ export const deserializeLanguagesWithIoLionWebMpsSpecific = (serializationChunk, problemHandler = defaultSimplisticHandler) => deserializeChunk(serializationChunk, combinedWriter, [lioncore, ioLionWebMpsSpecificLanguage], [lioncore, lioncoreBuiltins].flatMap(nodesExtractorUsing(lioncoreExtractionFacade)), builtinPropertyValueDeserializer, problemHandler).filter((node) => node instanceof Language);
27
27
  //# sourceMappingURL=deserializer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deserializer.js","sourceRoot":"","sources":["../src/deserializer.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;AAGtC,OAAO,EACH,gCAAgC,EAChC,wBAAwB,EACxB,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EAEtB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,4CAA4C,G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c,CACjB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,YAAY,QAAQ,CAAe,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"textualizer.d.ts","sourceRoot":"","sources":["../src/textualizer.ts"],"names":[],"mappings":"AAiBA,OAAO,EAKH,QAAQ,EAKX,MAAM,eAAe,CAAA;AAsMtB;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,cAAe,QAAQ,EAAE,KAAG,MACH,CAAA"}
1
+ {"version":3,"file":"textualizer.d.ts","sourceRoot":"","sources":["../src/textualizer.ts"],"names":[],"mappings":"AAiBA,OAAO,EAKH,QAAQ,EAKX,MAAM,eAAe,CAAA;AAyMtB;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,GAAI,WAAW,QAAQ,EAAE,KAAG,MACH,CAAA"}
@@ -16,6 +16,7 @@
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
  import { Classifier, Enumeration, EnumerationLiteral, Feature, Language, LanguageEntity, PrimitiveType } from "@lionweb/core";
18
18
  import { indent, withFirstLower } from "@lionweb/textgen-utils";
19
+ import { keepDefineds } from "@lionweb/ts-utils";
19
20
  import { asString, when } from "littoral-templates";
20
21
  import { ConceptDescription, Deprecated, KeyedDescription, ShortDescription, VirtualPackage } from "./implementation.js";
21
22
  import { ioLionWebMpsSpecificAnnotationsFrom } from "./annotations.js";
@@ -48,12 +49,10 @@ const textualizationOfAnnotation = (annotation) => {
48
49
  ? undefined
49
50
  : `${displayName}: ${value}`;
50
51
  };
51
- const textualizePropertiesWithDisplayNames = (properties) => Object.entries(properties)
52
- .map(([displayName, propertyName]) => textualizeProperty(propertyName, displayName))
53
- .filter((optStr) => optStr !== undefined);
54
- const textualizeProperties = (...propertyNames) => propertyNames
55
- .map((propertyName) => textualizeProperty(propertyName, propertyName))
56
- .filter((optStr) => optStr !== undefined);
52
+ const textualizePropertiesWithDisplayNames = (properties) => keepDefineds(Object.entries(properties)
53
+ .map(([displayName, propertyName]) => textualizeProperty(propertyName, displayName)));
54
+ const textualizeProperties = (...propertyNames) => keepDefineds(propertyNames
55
+ .map((propertyName) => textualizeProperty(propertyName, propertyName)));
57
56
  if (annotation instanceof ConceptDescription) {
58
57
  const fragments = textualizePropertiesWithDisplayNames({ "short description": "conceptShortDescription", "alias": "conceptAlias", "help URL": "helpUrl" });
59
58
  return fragments.length === 0
@@ -1 +1 @@
1
- {"version":3,"file":"textualizer.js","sourceRoot":"","sources":["../src/textualizer.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,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,QAAQ,EACR,cAAc,EAGd,aAAa,EAChB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAY,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EACH,kBAAkB,EAClB,UAAU,EAEV,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACjB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,mCAAmC,EAAE,MAAM,kBAAkB,CAAA;AAGtE;;;GAGG;AACH,MAAM,MAAM,GAAG,CAAC,IAAU,EAAU,EAAE;IAClC,IAAI,IAAI,YAAY,cAAc,EAAE,CAAC;QACjC,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAA;IACxF,CAAC;IACD,IAAI,IAAI,YAAY,kBAAkB,EA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web-mps-specific",
3
- "version": "0.7.0-beta.9",
4
- "description": "TypeScript implementation of the io.lionweb.mps.specific language",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "typings": "dist/index.d.ts",
8
- "type": "module",
9
- "license": "Apache-2.0",
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/LionWeb-io/lionweb-typescript.git"
13
- },
14
- "bugs": {
15
- "url": "https://github.com/LionWeb-io/lionweb-typescript/issues"
16
- },
17
- "dependencies": {
18
- "@lionweb/core": "0.7.0-beta.9",
19
- "@lionweb/json": "0.7.0-beta.9",
20
- "@lionweb/textgen-utils": "0.7.0-beta.9",
21
- "@lionweb/ts-utils": "0.7.0-beta.9",
22
- "littoral-templates": "0.5.0",
23
- "nanoid": "5.0.9"
24
- },
25
- "scripts": {
26
- "clean": "npx rimraf dist node_modules -g lionweb-io-lionweb-mps-specific-*.tgz",
27
- "build": "tsc",
28
- "lint": "eslint src",
29
- "prep:pre-release": "npm run clean && npm install && npm run build",
30
- "prerelease-alpha": "npm run prep:pre-release",
31
- "release-alpha": "npm publish --tag alpha",
32
- "prerelease-beta": "npm run prep:pre-release",
33
- "release-beta": "npm publish --tag beta",
34
- "prerelease": "npm run prep:pre-release",
35
- "release": "npm publish"
36
- }
2
+ "name": "@lionweb/io-lionweb-mps-specific",
3
+ "version": "0.7.0",
4
+ "description": "TypeScript implementation of the io.lionweb.mps.specific language",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "typings": "dist/index.d.ts",
8
+ "type": "module",
9
+ "license": "Apache-2.0",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/LionWeb-io/lionweb-typescript.git"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/LionWeb-io/lionweb-typescript/issues"
16
+ },
17
+ "dependencies": {
18
+ "@lionweb/core": "0.7.0",
19
+ "@lionweb/json": "0.7.0",
20
+ "@lionweb/textgen-utils": "0.7.0",
21
+ "@lionweb/ts-utils": "0.7.0",
22
+ "littoral-templates": "0.5.1"
23
+ },
24
+ "scripts": {
25
+ "clean": "npx rimraf dist node_modules -g lionweb-io-lionweb-mps-specific-*.tgz",
26
+ "build": "tsc",
27
+ "lint": "eslint src",
28
+ "prep:pre-release": "npm run clean && npm install && npm run build",
29
+ "prerelease-alpha": "npm run prep:pre-release",
30
+ "release-alpha": "npm publish --tag alpha",
31
+ "prerelease-beta": "npm run prep:pre-release",
32
+ "release-beta": "npm publish --tag beta",
33
+ "prerelease": "npm run prep:pre-release",
34
+ "release": "npm publish"
35
+ }
37
36
  }
@@ -0,0 +1,61 @@
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 { M3Concept } from "@lionweb/core"
19
+ import { LionWebJsonChunk, LionWebJsonMetaPointer } from "@lionweb/json"
20
+
21
+ import { IoLionWebMpsSpecificAnnotation } from "./implementation.js"
22
+ import { ioLionWebMpsSpecificLanguage } from "./definition.js"
23
+
24
+
25
+ /**
26
+ * @return the `io.lionweb.mps.specific` annotations present on the given node.
27
+ */
28
+ export const ioLionWebMpsSpecificAnnotationsFrom = (node: M3Concept): IoLionWebMpsSpecificAnnotation[] =>
29
+ node
30
+ .annotations
31
+ .filter((annotation) => annotation instanceof IoLionWebMpsSpecificAnnotation) as IoLionWebMpsSpecificAnnotation[]
32
+
33
+
34
+ /**
35
+ * Replaces stated version "0" of language "io-lionweb-mps-specific" with its actual version.
36
+ */
37
+ export const repairIoLionWebMpsSpecificAnnotations = (serializationChunk: LionWebJsonChunk) => {
38
+ serializationChunk.languages.forEach((usedLanguage) => {
39
+ if (usedLanguage.key === ioLionWebMpsSpecificLanguage.key) {
40
+ usedLanguage.version = ioLionWebMpsSpecificLanguage.version
41
+ }
42
+ })
43
+ const repairMetaPointer = (metaPointer: LionWebJsonMetaPointer): void => {
44
+ if (metaPointer.language === ioLionWebMpsSpecificLanguage.key) {
45
+ metaPointer.version = ioLionWebMpsSpecificLanguage.version
46
+ }
47
+ }
48
+ serializationChunk.nodes.forEach((node) => {
49
+ repairMetaPointer(node.classifier)
50
+ node.properties.forEach((propertySetting) => {
51
+ repairMetaPointer(propertySetting.property)
52
+ })
53
+ node.containments.forEach((containmentSetting) => {
54
+ repairMetaPointer(containmentSetting.containment)
55
+ })
56
+ node.references.forEach((referenceSetting) => {
57
+ repairMetaPointer(referenceSetting.reference)
58
+ })
59
+ })
60
+ }
61
+
@@ -0,0 +1,70 @@
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 {
19
+ Annotation,
20
+ builtinClassifiers,
21
+ builtinPrimitives,
22
+ Classifier,
23
+ LanguageFactory,
24
+ metaConcepts
25
+ } from "@lionweb/core"
26
+ import { StringsMapper } from "@lionweb/ts-utils"
27
+
28
+ const languageName = "io.lionweb.mps.specific"
29
+ const dashedLanguageName = languageName.replaceAll(".", "-")
30
+
31
+ const idKeyGen: StringsMapper = (...names) =>
32
+ names.length === 1
33
+ ? names[0]
34
+ : names.slice(1).join("-")
35
+
36
+ const factory = new LanguageFactory(dashedLanguageName, "2024-01", idKeyGen, idKeyGen)
37
+
38
+
39
+ const defineAnnotation = (nameOfAnnotation: string, annotates: Classifier, ...namesOfOptionalStringProperties: string[]): Annotation => {
40
+ const annotation = factory.annotation(nameOfAnnotation).annotating(annotates)
41
+ namesOfOptionalStringProperties.forEach((name) => {
42
+ factory.property(annotation, name).ofType(builtinPrimitives.stringDatatype).isOptional()
43
+ })
44
+ return annotation
45
+ }
46
+
47
+
48
+ const ConceptDescription = defineAnnotation("ConceptDescription", metaConcepts.classifier, "conceptAlias", "conceptShortDescription", "helpUrl")
49
+
50
+ const Deprecated = defineAnnotation("Deprecated", metaConcepts.ikeyed, "comment", "build")
51
+
52
+ const KeyedDescription = defineAnnotation("KeyedDescription", metaConcepts.ikeyed, "documentation")
53
+ factory.reference(KeyedDescription, "seeAlso").ofType(builtinClassifiers.node).isMultiple().isOptional()
54
+
55
+ const ShortDescription = defineAnnotation("ShortDescription", builtinClassifiers.node, "description")
56
+
57
+ const VirtualPackage = defineAnnotation("VirtualPackage", builtinClassifiers.node).implementing(builtinClassifiers.inamed)
58
+
59
+
60
+ export const ioLionWebMpsSpecificLanguage = factory.language
61
+ ioLionWebMpsSpecificLanguage.name = languageName
62
+
63
+ export const ioLionWebMpsSpecificClassifiers = {
64
+ ConceptDescription,
65
+ Deprecated,
66
+ KeyedDescription,
67
+ ShortDescription,
68
+ VirtualPackage
69
+ }
70
+
@@ -0,0 +1,47 @@
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 { LionWebJsonChunk } from "@lionweb/json"
19
+ import {
20
+ builtinPropertyValueDeserializer,
21
+ defaultSimplisticHandler,
22
+ deserializeChunk,
23
+ Language,
24
+ lioncore,
25
+ lioncoreBuiltins,
26
+ nodesExtractorUsing,
27
+ SimplisticHandler
28
+ } from "@lionweb/core"
29
+ import { lioncoreExtractionFacade } from "@lionweb/core/dist/m3/facade.js"
30
+ import { ioLionWebMpsSpecificLanguage } from "./definition.js"
31
+ import { combinedWriter } from "./facade.js"
32
+
33
+ /**
34
+ * @return the deserialization of the given {@link LionWebJsonChunk serialization chunk} as an array of {@link Language languages}.
35
+ * Any LionCore/M3 node can be annotated using annotations from the `io.lionweb.mps.specific` language.
36
+ * Problems are reported through the given {@link SimplisticHandler} which defaults to {@link defaultSimplisticHandler}.
37
+ */
38
+ export const deserializeLanguagesWithIoLionWebMpsSpecific = (serializationChunk: LionWebJsonChunk, problemHandler: SimplisticHandler = defaultSimplisticHandler) =>
39
+ deserializeChunk(
40
+ serializationChunk,
41
+ combinedWriter,
42
+ [lioncore, ioLionWebMpsSpecificLanguage],
43
+ [lioncore, lioncoreBuiltins].flatMap(nodesExtractorUsing(lioncoreExtractionFacade)),
44
+ builtinPropertyValueDeserializer,
45
+ problemHandler
46
+ ).filter((node) => node instanceof Language) as Language[]
47
+
package/src/facade.ts ADDED
@@ -0,0 +1,100 @@
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 {
19
+ areSameClassifiers,
20
+ areSameLanguages,
21
+ Classifier,
22
+ InstantiationFacade,
23
+ lioncore,
24
+ lioncoreWriter,
25
+ M3Concept,
26
+ M3Node,
27
+ Node,
28
+ updateSettingsNameBased
29
+ } from "@lionweb/core"
30
+ import { LionWebId, LionWebKey } from "@lionweb/json"
31
+
32
+ import { ioLionWebMpsSpecificClassifiers, ioLionWebMpsSpecificLanguage } from "./definition.js"
33
+ import {
34
+ ConceptDescription,
35
+ Deprecated,
36
+ IoLionWebMpsSpecificAnnotation,
37
+ KeyedDescription,
38
+ ShortDescription,
39
+ VirtualPackage
40
+ } from "./implementation.js"
41
+
42
+ const ioLionWebMpsSpecificFactory = (parent: Node | undefined, classifier: Classifier, id: LionWebId, propertySettings: { [propertyKey: LionWebKey]: unknown }) => {
43
+
44
+ const setProperties = <T extends IoLionWebMpsSpecificAnnotation>(node: T, ...namesOfOptionalStringProperties: (keyof T)[]) => {
45
+ namesOfOptionalStringProperties.forEach((propertyName) => {
46
+ node[propertyName] = propertySettings[`${node.classifier.name}-${String(propertyName)}`] as T[typeof propertyName]
47
+ })
48
+ }
49
+
50
+ if (areSameClassifiers(classifier, ioLionWebMpsSpecificClassifiers.ConceptDescription)) {
51
+ const node = new ConceptDescription(id)
52
+ node.parent = parent
53
+ setProperties(node, "conceptAlias", "conceptShortDescription", "helpUrl")
54
+ return node
55
+ }
56
+ if (areSameClassifiers(classifier, ioLionWebMpsSpecificClassifiers.Deprecated)) {
57
+ const node = new Deprecated(id)
58
+ node.parent = parent
59
+ setProperties(node, "build", "comment")
60
+ return node
61
+ }
62
+ if (areSameClassifiers(classifier, ioLionWebMpsSpecificClassifiers.KeyedDescription)) {
63
+ const node = new KeyedDescription(id)
64
+ node.parent = parent
65
+ setProperties(node, "documentation")
66
+ return node
67
+ }
68
+ if (areSameClassifiers(classifier, ioLionWebMpsSpecificClassifiers.ShortDescription)) {
69
+ const node = new ShortDescription(id)
70
+ node.parent = parent
71
+ setProperties(node, "description")
72
+ return node
73
+ }
74
+ if (areSameClassifiers(classifier, ioLionWebMpsSpecificClassifiers.VirtualPackage)) {
75
+ const node = new VirtualPackage(id)
76
+ node.parent = parent
77
+ setProperties(node, "name")
78
+ return node
79
+ }
80
+
81
+ throw new Error(`don't know how to instantiate a ${classifier.name}`)
82
+ }
83
+
84
+
85
+ export const combinedWriter: InstantiationFacade<M3Node | IoLionWebMpsSpecificAnnotation, Node> = {
86
+ encodingOf: (_literal) => undefined, // (there are no literals in either LionCore/M3 or io.lionweb.mps.specific)
87
+ nodeFor: (parent, classifier, id, propertySettings) => {
88
+ if (areSameLanguages(classifier.language, ioLionWebMpsSpecificLanguage)) {
89
+ return ioLionWebMpsSpecificFactory(parent, classifier, id, propertySettings)
90
+ }
91
+ if (areSameLanguages(classifier.language, lioncore)) {
92
+ return lioncoreWriter.nodeFor(parent as M3Concept, classifier, id, propertySettings)
93
+ }
94
+ throw new Error(`don't know how to instantiate a ${classifier.name} from language ${classifier.language.name} (${classifier.language.key}, ${classifier.language.version})`)
95
+ },
96
+ setFeatureValue: (node, feature, value) => {
97
+ updateSettingsNameBased(node as unknown as Record<string, unknown>, feature, value)
98
+ }
99
+ }
100
+
@@ -0,0 +1,75 @@
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, INamed, Node } from "@lionweb/core"
19
+ import { ioLionWebMpsSpecificClassifiers } from "./definition.js"
20
+
21
+ export abstract class IoLionWebMpsSpecificAnnotation implements Node {
22
+ protected constructor(public readonly id: string, public readonly classifier: Classifier) {
23
+ }
24
+ public parent?: Node
25
+ public readonly annotations: Node[] = []
26
+ }
27
+
28
+ export class ConceptDescription extends IoLionWebMpsSpecificAnnotation {
29
+ constructor(id: string) {
30
+ super(id, ioLionWebMpsSpecificClassifiers.ConceptDescription)
31
+ }
32
+ public conceptAlias?: string
33
+ public conceptShortDescription?: string
34
+ public helpUrl?: string
35
+ }
36
+
37
+ export class Deprecated extends IoLionWebMpsSpecificAnnotation {
38
+ constructor(id: string) {
39
+ super(id, ioLionWebMpsSpecificClassifiers.Deprecated)
40
+ }
41
+ public comment?: string
42
+ public build?: string
43
+ }
44
+
45
+ export class KeyedDescription extends IoLionWebMpsSpecificAnnotation {
46
+ constructor(id: string) {
47
+ super(id, ioLionWebMpsSpecificClassifiers.KeyedDescription)
48
+ }
49
+ public documentation?: string
50
+ public readonly seeAlso: Node[] = []
51
+ }
52
+
53
+ export class ShortDescription extends IoLionWebMpsSpecificAnnotation {
54
+ constructor(id: string) {
55
+ super(id, ioLionWebMpsSpecificClassifiers.ShortDescription)
56
+ }
57
+ public description?: string
58
+ }
59
+
60
+ export class VirtualPackage extends IoLionWebMpsSpecificAnnotation implements INamed {
61
+ constructor(id: string) {
62
+ super(id, ioLionWebMpsSpecificClassifiers.VirtualPackage)
63
+ }
64
+ private _name?: string
65
+ get name() {
66
+ if (this._name === undefined) {
67
+ throw new Error(`trying to read unset "name" property of instance of "VirtualPackage" annotation`)
68
+ }
69
+ return this._name
70
+ }
71
+ set name(newName: string) {
72
+ this._name = newName
73
+ }
74
+ }
75
+
package/src/index.ts ADDED
@@ -0,0 +1,23 @@
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
+ export * from "./annotations.js"
19
+ export * from "./definition.js"
20
+ export * from "./deserializer.js"
21
+ export * from "./implementation.js"
22
+ export * from "./textualizer.js"
23
+
@@ -0,0 +1,236 @@
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 {
19
+ Classifier,
20
+ Enumeration,
21
+ EnumerationLiteral,
22
+ Feature,
23
+ Language,
24
+ LanguageEntity,
25
+ M3Concept,
26
+ Node,
27
+ PrimitiveType
28
+ } from "@lionweb/core"
29
+ import { indent, withFirstLower } from "@lionweb/textgen-utils"
30
+ import { keepDefineds } from "@lionweb/ts-utils"
31
+ import { asString, Template, when } from "littoral-templates"
32
+ import {
33
+ ConceptDescription,
34
+ Deprecated,
35
+ IoLionWebMpsSpecificAnnotation,
36
+ KeyedDescription,
37
+ ShortDescription,
38
+ VirtualPackage
39
+ } from "./implementation.js"
40
+ import { ioLionWebMpsSpecificAnnotationsFrom } from "./annotations.js"
41
+
42
+
43
+ /**
44
+ * @return human-readable text of the location/“path to” the given {@link Node node},
45
+ * which is *assumed* to be a language element – i.e., a {@link M3Concept}.
46
+ */
47
+ const pathTo = (node: Node): string => {
48
+ if (node instanceof LanguageEntity) {
49
+ return `${withFirstLower(node.metaType())} ${node.name} in ${pathTo(node.language)}`
50
+ }
51
+ if (node instanceof EnumerationLiteral) {
52
+ return `literal ${node.name} of ${pathTo(node.enumeration)}`
53
+ }
54
+ if (node instanceof Feature) {
55
+ return `${withFirstLower(node.metaType())} ${node.name} of ${pathTo(node.classifier)}`
56
+ }
57
+ if (node instanceof Language) {
58
+ return `language ${node.name}`
59
+ }
60
+ throw new Error(`don't know how to handle an instance of ${node.constructor.name}`)
61
+ }
62
+
63
+
64
+ /**
65
+ * @return a textualization of the given io.lionweb.mps.specific annotation.
66
+ */
67
+ const textualizationOfAnnotation = (annotation: IoLionWebMpsSpecificAnnotation): Template => {
68
+
69
+ const textualizeProperty = <T extends IoLionWebMpsSpecificAnnotation>(propertyName: keyof T, displayName: string): (string | undefined) => {
70
+ const value = (annotation as T)[propertyName]
71
+ return value === undefined
72
+ ? undefined
73
+ : `${displayName}: ${value}`
74
+ }
75
+
76
+ const textualizePropertiesWithDisplayNames = <T extends IoLionWebMpsSpecificAnnotation>(properties: { [displayName: string]: keyof T}): string[] =>
77
+ keepDefineds(
78
+ Object.entries(properties)
79
+ .map(([displayName, propertyName]) => textualizeProperty(propertyName, displayName))
80
+ )
81
+
82
+ const textualizeProperties = <T extends IoLionWebMpsSpecificAnnotation>(...propertyNames: (keyof T)[]): string[] =>
83
+ keepDefineds(
84
+ propertyNames
85
+ .map((propertyName) => textualizeProperty(propertyName, propertyName as string))
86
+ )
87
+
88
+
89
+ if (annotation instanceof ConceptDescription) {
90
+ const fragments = textualizePropertiesWithDisplayNames<ConceptDescription>({ "short description": "conceptShortDescription", "alias": "conceptAlias", "help URL": "helpUrl" })
91
+ return fragments.length === 0
92
+ ? `@ConceptDescription: (no info)`
93
+ : [
94
+ `@ConceptDescription:`,
95
+ indent(fragments)
96
+ ]
97
+ }
98
+
99
+ if (annotation instanceof Deprecated) {
100
+ const fragments = textualizeProperties<Deprecated>("comment", "build")
101
+ return fragments.length === 0
102
+ ? `@Deprecated: (no info)`
103
+ : [
104
+ `@Deprecated:`,
105
+ indent(fragments)
106
+ ]
107
+ }
108
+
109
+ if (annotation instanceof KeyedDescription) {
110
+ const fragments = textualizeProperties<KeyedDescription>("documentation")
111
+ return (fragments.length === 0 && annotation.seeAlso.length === 0)
112
+ ? `@KeyedDescription: (no info)`
113
+ : [
114
+ `@KeyedDescription: `,
115
+ indent([
116
+ fragments,
117
+ when(annotation.seeAlso.length > 0)([
118
+ `see also:`,
119
+ indent(annotation.seeAlso.map(pathTo))
120
+ ])
121
+ ])
122
+ ]
123
+ }
124
+
125
+ if (annotation instanceof ShortDescription) {
126
+ const fragments = textualizeProperties<ShortDescription>("description")
127
+ return fragments.length === 0
128
+ ? `@ShortDescription: (no info)`
129
+ : [
130
+ `@ShortDescription:`,
131
+ indent(fragments)
132
+ ]
133
+ }
134
+
135
+ if (annotation instanceof VirtualPackage) {
136
+ const fragments = textualizeProperties<VirtualPackage>("name")
137
+ return fragments.length === 0
138
+ ? `@VirtualPackage: (no info)`
139
+ : [
140
+ `@VirtualPackage:`,
141
+ indent(fragments)
142
+ ]
143
+ }
144
+
145
+ throw new Error(`don't know how to handle an instance of ${annotation.constructor.name}`)
146
+ }
147
+
148
+
149
+ /**
150
+ * @return textualization of the given {@link M3Concept language element} provided it either has (1 or more) annotations itself,
151
+ * or if any of its nested language elements – i.e.: descendants – have (1 or more) annotations.
152
+ * Otherwise, it returns an empty array `[]`.
153
+ */
154
+ const textualizationOfAnnotationsInM3Concept = (node: M3Concept): Template => {
155
+ const annotations = ioLionWebMpsSpecificAnnotationsFrom(node)
156
+
157
+ if (node instanceof Classifier) {
158
+ const annotatedFeatures = node.features.flatMap((feature) => textualizationOfAnnotationsInM3Concept(feature as M3Concept))
159
+ return (annotations.length > 0 || annotatedFeatures.length > 0)
160
+ ? [
161
+ `${withFirstLower(node.metaType())} ${node.name}:`,
162
+ indent([
163
+ annotations.map(textualizationOfAnnotation),
164
+ annotatedFeatures
165
+ ])
166
+ ]
167
+ : []
168
+ }
169
+
170
+ if (node instanceof Enumeration) {
171
+ const annotatedLiterals = node.literals.flatMap((literal) => textualizationOfAnnotationsInM3Concept(literal))
172
+ return (annotations.length > 0 || annotatedLiterals.length > 0)
173
+ ? [
174
+ `enumeration ${node.name}:`,
175
+ indent([
176
+ annotations.map(textualizationOfAnnotation),
177
+ annotatedLiterals
178
+ ])
179
+ ]
180
+ : []
181
+ }
182
+
183
+ if (node instanceof EnumerationLiteral) {
184
+ return annotations.length > 0
185
+ ? [
186
+ `enumeration literal ${node.name}:`,
187
+ indent(annotations.map(textualizationOfAnnotation))
188
+ ]
189
+ : []
190
+ }
191
+
192
+ if (node instanceof Feature) {
193
+ return annotations.length > 0
194
+ ? [
195
+ `${withFirstLower(node.metaType())} ${node.name}:`,
196
+ indent(annotations.map(textualizationOfAnnotation))
197
+ ]
198
+ : []
199
+ }
200
+
201
+ if (node instanceof Language) {
202
+ const annotatedEntities = node.entities.flatMap((entity) => textualizationOfAnnotationsInM3Concept(entity))
203
+ return (annotations.length > 0 || annotatedEntities.length > 0)
204
+ ? [
205
+ `language ${node.name}:`,
206
+ indent([
207
+ annotations.map(textualizationOfAnnotation),
208
+ annotatedEntities
209
+ ])
210
+ ]
211
+ : []
212
+ }
213
+
214
+ if (node instanceof PrimitiveType) {
215
+ return annotations.length > 0
216
+ ? [
217
+ `primitive type ${node.name}:`,
218
+ indent(annotations.map(textualizationOfAnnotation))
219
+ ]
220
+ : []
221
+ }
222
+
223
+ // can't happen as node has type 'never' at this point, because of type exhaustion,
224
+ // but need to return a Template:
225
+ return []
226
+ }
227
+
228
+
229
+ /**
230
+ * @return textualization of all instances of io.lionweb.mps.specific annotations, in the given languages' tree structure.
231
+ * **Note**: only language elements having annotations (at any nesting depth) are rendered.
232
+ * This is useful to get a quick overview of the annotations.
233
+ */
234
+ export const textualizationOfAnnotationsIn = (languages: Language[]): string =>
235
+ asString(languages.map(textualizationOfAnnotationsInM3Concept))
236
+