@lionweb/utilities 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 +5 -0
- package/dist/m3/dependencies.d.ts +11 -0
- package/dist/m3/dependencies.d.ts.map +1 -0
- package/dist/m3/dependencies.js +52 -0
- package/dist/m3/dependencies.js.map +1 -0
- package/dist/m3/index.d.ts +1 -0
- package/dist/m3/index.d.ts.map +1 -1
- package/dist/m3/index.js +1 -0
- package/dist/m3/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/m3/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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
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 "./ts-generation/textgen.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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/m3/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,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAGnD;;GAEG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,QAAkB,EAAE,EAAE,CACzE,YAAY,CACR,QAAQ,CAAC,QAAQ;KACZ,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,YAAY,UAAU,CAAC;KAChD,OAAO,CAAC,CAAC,MAAM,EAAE,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lantUML-generator.js";
|
|
3
|
+
export * from "./dependencies.js";
|
|
3
4
|
export * from "./infer-languages.js";
|
|
4
5
|
export * from "./textualizer.js";
|
|
5
6
|
export * from "./ts-generation/ts-types-generator.js";
|
package/dist/m3/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/m3/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA;AAChD,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,uCAAuC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/m3/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA;AAChD,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,uCAAuC,CAAA"}
|
package/dist/m3/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./diagrams/Mermaid-generator.js";
|
|
2
2
|
export * from "./diagrams/PlantUML-generator.js";
|
|
3
|
+
export * from "./dependencies.js";
|
|
3
4
|
export * from "./infer-languages.js";
|
|
4
5
|
export * from "./textualizer.js";
|
|
5
6
|
export * from "./ts-generation/ts-types-generator.js";
|
package/dist/m3/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/m3/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA;AAChD,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,uCAAuC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/m3/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA;AAChD,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,uCAAuC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lionweb/utilities",
|
|
3
|
-
"version": "0.7.0-alpha.
|
|
3
|
+
"version": "0.7.0-alpha.5",
|
|
4
4
|
"description": "LionWeb utilities",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"url": "https://github.com/LionWeb-io/lionweb-typescript/issues"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@lionweb/core": "0.7.0-alpha.
|
|
19
|
-
"@lionweb/json": "0.7.0-alpha.
|
|
20
|
-
"@lionweb/ts-utils": "0.7.0-alpha.
|
|
18
|
+
"@lionweb/core": "0.7.0-alpha.5",
|
|
19
|
+
"@lionweb/json": "0.7.0-alpha.5",
|
|
20
|
+
"@lionweb/ts-utils": "0.7.0-alpha.5",
|
|
21
21
|
"littoral-templates": "0.3.0",
|
|
22
22
|
"nanoid": "5.0.9"
|
|
23
23
|
},
|