@lionweb/class-core-generator 0.6.13-beta.7 → 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 +7 -0
- package/dist/api/entity-types.templates.d.ts +3 -3
- package/dist/api/entity-types.templates.d.ts.map +1 -1
- package/dist/api/entity-types.templates.js +10 -9
- package/dist/api/entity-types.templates.js.map +1 -1
- package/dist/api/generation-headers.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/classifiers.d.ts.map +1 -1
- package/dist/api/helpers/classifiers.js +1 -1
- package/dist/api/helpers/classifiers.js.map +1 -1
- package/dist/api/helpers/dependencies.d.ts.map +1 -1
- package/dist/api/helpers/dependencies.js +2 -2
- package/dist/api/helpers/dependencies.js.map +1 -1
- package/dist/api/helpers/entities.d.ts.map +1 -1
- package/dist/api/helpers/entities.js.map +1 -1
- package/dist/api/helpers/features.d.ts.map +1 -1
- package/dist/api/helpers/features.js +3 -3
- package/dist/api/helpers/features.js.map +1 -1
- package/dist/api/helpers/imports-tracking.d.ts +3 -0
- package/dist/api/helpers/imports-tracking.d.ts.map +1 -1
- package/dist/api/helpers/imports-tracking.js +8 -0
- package/dist/api/helpers/imports-tracking.js.map +1 -1
- package/dist/api/helpers/index.d.ts +1 -2
- package/dist/api/helpers/index.d.ts.map +1 -1
- package/dist/api/helpers/index.js +1 -2
- package/dist/api/helpers/index.js.map +1 -1
- package/dist/api/helpers/{types.d.ts → primitive-types.d.ts} +1 -1
- package/dist/api/helpers/primitive-types.d.ts.map +1 -0
- package/dist/api/helpers/{types.js → primitive-types.js} +9 -5
- package/dist/api/helpers/primitive-types.js.map +1 -0
- package/dist/api/index-ts.d.ts.map +1 -1
- package/dist/api/index-ts.js +5 -6
- package/dist/api/index-ts.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 +8 -13
- 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 +6 -9
- package/dist/api/mega-factory.templates.js.map +1 -1
- package/dist/api/reflective-layer.templates.d.ts.map +1 -1
- package/dist/api/reflective-layer.templates.js +19 -34
- package/dist/api/reflective-layer.templates.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/textgen.d.ts.map +1 -1
- package/dist/utils/textgen.js.map +1 -1
- package/package.json +14 -9
- package/src/api/entity-types.templates.ts +11 -15
- package/src/api/generation-headers.ts +1 -1
- package/src/api/generator.ts +9 -12
- package/src/api/helpers/classifiers.ts +3 -15
- package/src/api/helpers/dependencies.ts +4 -4
- package/src/api/helpers/entities.ts +2 -8
- package/src/api/helpers/features.ts +5 -5
- package/src/api/helpers/imports-tracking.ts +12 -5
- package/src/api/helpers/index.ts +1 -2
- package/src/api/helpers/{types.ts → primitive-types.ts} +9 -6
- package/src/api/index-ts.ts +26 -16
- package/src/api/index.ts +1 -2
- package/src/api/language-file.templates.ts +12 -19
- package/src/api/mega-factory.templates.ts +21 -27
- package/src/api/reflective-layer.templates.ts +46 -69
- package/src/utils/index.ts +0 -1
- package/src/utils/textgen.ts +1 -1
- 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/dist/api/helpers/types.d.ts.map +0 -1
- package/dist/api/helpers/types.js.map +0 -1
- package/dist/utils/string-sorting.d.ts +0 -4
- package/dist/utils/string-sorting.d.ts.map +0 -1
- package/dist/utils/string-sorting.js +0 -23
- package/dist/utils/string-sorting.js.map +0 -1
- package/dist/utils/toposort.d.ts +0 -6
- package/dist/utils/toposort.d.ts.map +0 -1
- package/dist/utils/toposort.js +0 -41
- package/dist/utils/toposort.js.map +0 -1
- package/src/api/helpers/mps-annotations.ts +0 -69
- package/src/utils/string-sorting.ts +0 -29
- package/src/utils/toposort.ts +0 -49
package/dist/utils/toposort.js
DELETED
|
@@ -1,41 +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
|
-
* Computes the topological order of the transitive closure of the graph with the given vertices and edges given by the edge function,
|
|
19
|
-
* or returns {@code false} if there's a cycle.
|
|
20
|
-
*/
|
|
21
|
-
export const dependencyOrderOf = (vertices, edgesOf) => {
|
|
22
|
-
const ordered = [];
|
|
23
|
-
const visit = (current, chain) => {
|
|
24
|
-
if (ordered.indexOf(current) > -1) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
if (chain.indexOf(current) > -1) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
const extendedChain = [...chain, current];
|
|
31
|
-
const hasCycle = edgesOf(current).some((edge) => visit(edge, extendedChain));
|
|
32
|
-
ordered.push(current);
|
|
33
|
-
if (hasCycle) {
|
|
34
|
-
console.dir(ordered);
|
|
35
|
-
}
|
|
36
|
-
return hasCycle;
|
|
37
|
-
};
|
|
38
|
-
const hasCycle = vertices.some((vertex) => visit(vertex, []));
|
|
39
|
-
return hasCycle ? false : ordered;
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=toposort.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toposort.js","sourceRoot":"","sources":["../../src/utils/toposort.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;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAI,QAAa,EAAE,OAA2B,EAAe,EAAE;IAC5F,MAAM,OAAO,GAAQ,EAAE,CAAA;IAEvB,MAAM,KAAK,GAAG,CAAC,OAAU,EAAE,KAAU,EAAE,EAAE;QACrC,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAChC,OAAO,KAAK,CAAA;QAChB,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAA;QACf,CAAC;QACD,MAAM,aAAa,GAAG,CAAE,GAAG,KAAK,EAAE,OAAO,CAAE,CAAA;QAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAClC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,CAAC,CACvC,CAAA;QACD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACrB,IAAI,QAAQ,EAAE,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACxB,CAAC;QACD,OAAO,QAAQ,CAAA;IACnB,CAAC,CAAA;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAC1B,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,CAChC,CAAA;IAED,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;AACrC,CAAC,CAAA"}
|
|
@@ -1,69 +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 {Id, SerializationChunk} from "@lionweb/core"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export abstract class MpsAnnotation {
|
|
22
|
-
constructor(public readonly annotatedNodeId: Id) {
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export class ConceptDescription extends MpsAnnotation {
|
|
27
|
-
constructor(annotatedNodeId: Id, public readonly shortDescription: string | null, public readonly alias: string | null) {
|
|
28
|
-
super(annotatedNodeId)
|
|
29
|
-
}
|
|
30
|
-
toString() {
|
|
31
|
-
return `<ConceptDescription> annotatedNodeId=${this.annotatedNodeId}, shortDescription="${this.shortDescription}"`
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export class Deprecated extends MpsAnnotation {
|
|
36
|
-
constructor(annotatedNodeId: Id, public readonly comment: string | null, public readonly build: string | null) {
|
|
37
|
-
super(annotatedNodeId)
|
|
38
|
-
}
|
|
39
|
-
toString() {
|
|
40
|
-
return `<Deprecated> annotatedNodeId=${this.annotatedNodeId}, comment="${this.comment}", build="${this.build}"`
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export const extractedMpsAnnotations = ({nodes}: SerializationChunk): MpsAnnotation[] =>
|
|
46
|
-
nodes.flatMap<MpsAnnotation>(({classifier, properties, parent}) => {
|
|
47
|
-
const propertyValue = (key: string): string | null => {
|
|
48
|
-
const property = properties.find(({property}) => property.key === key)
|
|
49
|
-
return property === undefined
|
|
50
|
-
? null
|
|
51
|
-
: property.value
|
|
52
|
-
}
|
|
53
|
-
if (classifier.language !== "io-lionweb-mps-specific" || classifier.version !== "0") {
|
|
54
|
-
return []
|
|
55
|
-
}
|
|
56
|
-
switch (classifier.key) {
|
|
57
|
-
case "ConceptDescription": {
|
|
58
|
-
return [new ConceptDescription(parent!, propertyValue("ConceptDescription-conceptShortDescription"), propertyValue("ConceptDescription-conceptAlias"))]
|
|
59
|
-
}
|
|
60
|
-
case "Deprecated": {
|
|
61
|
-
return [new Deprecated(parent!, propertyValue("Deprecated-comment"), propertyValue("Deprecated-build"))]
|
|
62
|
-
}
|
|
63
|
-
default: {
|
|
64
|
-
console.log(`couldn't handle MPS annotation with key ${classifier.key}`)
|
|
65
|
-
return []
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
|
|
@@ -1,29 +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
|
-
export type StringSorter = (strings: string[]) => string[]
|
|
19
|
-
|
|
20
|
-
const sortedStringsWith = (strMap: (str: string) => string): StringSorter =>
|
|
21
|
-
(strings) => {
|
|
22
|
-
strings.sort((l, r) => strMap(l).localeCompare(strMap(r)))
|
|
23
|
-
return strings
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const sortedStrings = sortedStringsWith((str) => str)
|
|
27
|
-
|
|
28
|
-
export const sortedStringsByUppercase = sortedStringsWith((str) => str.toUpperCase())
|
|
29
|
-
|
package/src/utils/toposort.ts
DELETED
|
@@ -1,49 +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
|
-
/**
|
|
19
|
-
* Computes the topological order of the transitive closure of the graph with the given vertices and edges given by the edge function,
|
|
20
|
-
* or returns {@code false} if there's a cycle.
|
|
21
|
-
*/
|
|
22
|
-
export const dependencyOrderOf = <T>(vertices: T[], edgesOf: (vertex: T) => T[]): T[] | false => {
|
|
23
|
-
const ordered: T[] = []
|
|
24
|
-
|
|
25
|
-
const visit = (current: T, chain: T[]) => {
|
|
26
|
-
if (ordered.indexOf(current) > -1) {
|
|
27
|
-
return false
|
|
28
|
-
}
|
|
29
|
-
if (chain.indexOf(current) > -1) {
|
|
30
|
-
return true
|
|
31
|
-
}
|
|
32
|
-
const extendedChain = [ ...chain, current ]
|
|
33
|
-
const hasCycle = edgesOf(current).some(
|
|
34
|
-
(edge) => visit(edge, extendedChain)
|
|
35
|
-
)
|
|
36
|
-
ordered.push(current)
|
|
37
|
-
if (hasCycle) {
|
|
38
|
-
console.dir(ordered)
|
|
39
|
-
}
|
|
40
|
-
return hasCycle
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const hasCycle = vertices.some(
|
|
44
|
-
(vertex) => visit(vertex, [])
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
return hasCycle ? false : ordered
|
|
48
|
-
}
|
|
49
|
-
|