@likec4/core 0.28.3 → 0.29.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.
- package/dist/compute-view/compute-element-view.js +3 -3
- package/dist/errors/_base.d.ts +10 -0
- package/dist/errors/_base.js +11 -0
- package/dist/errors/index.d.ts +3 -0
- package/dist/errors/index.js +3 -0
- package/dist/errors/invariant.d.ts +3 -0
- package/dist/errors/invariant.js +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/model-index/ModelIndex.js +1 -1
- package/dist/utils/compute-node-levels.js +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { anyPass, filter, uniq, isNil } from 'rambdax';
|
|
2
|
-
import { DefaultThemeColor, DefaultElementShape
|
|
2
|
+
import { DefaultThemeColor, DefaultElementShape } from '../types';
|
|
3
3
|
import * as Expr from '../types/expression';
|
|
4
4
|
import { isViewRuleAutoLayout, isViewRuleExpression, isViewRuleStyle } from '../types/view';
|
|
5
5
|
import { compareByFqnHierarchically, failExpectedNever, ignoreNeverInRuntime, isAncestor, isSameHierarchy, parentFqn, Relations } from '../utils';
|
|
@@ -8,7 +8,7 @@ import { EdgeBuilder } from './EdgeBuilder';
|
|
|
8
8
|
import { sortNodes } from './utils/sortNodes';
|
|
9
9
|
import { ComputeCtx } from './compute-ctx';
|
|
10
10
|
import { anyPossibleRelations } from './utils/anyPossibleRelations';
|
|
11
|
-
import invariant from '
|
|
11
|
+
import { invariant } from '../errors';
|
|
12
12
|
function transformToNodes(elementsIterator) {
|
|
13
13
|
return Array.from(elementsIterator)
|
|
14
14
|
.sort(compareByFqnHierarchically)
|
|
@@ -33,7 +33,7 @@ function transformToNodes(elementsIterator) {
|
|
|
33
33
|
color: color ?? DefaultThemeColor,
|
|
34
34
|
shape: shape ?? DefaultElementShape,
|
|
35
35
|
children: [],
|
|
36
|
-
...(description ? { description } : {})
|
|
36
|
+
...(description ? { description } : {})
|
|
37
37
|
};
|
|
38
38
|
map.set(id, node);
|
|
39
39
|
return map;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for all errors in the LikeC4 library.
|
|
3
|
+
*/
|
|
4
|
+
export declare const BaseError: import("modern-errors").ErrorSubclassCore<[], {}, import("modern-errors").CustomClass>;
|
|
5
|
+
/**
|
|
6
|
+
* Unknown error, mosly probably a bug, unhandled case or coming from a third-party library.
|
|
7
|
+
*/
|
|
8
|
+
export declare const UnknownError: import("modern-errors").ErrorSubclassCore<[], {}, import("modern-errors").CustomClass>;
|
|
9
|
+
export declare const RelationRefError: import("modern-errors").ErrorSubclassCore<[], {}, import("modern-errors").CustomClass>;
|
|
10
|
+
//# sourceMappingURL=_base.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import ModernError from 'modern-errors';
|
|
2
|
+
/**
|
|
3
|
+
* Base class for all errors in the LikeC4 library.
|
|
4
|
+
*/
|
|
5
|
+
export const BaseError = ModernError.subclass('BaseError');
|
|
6
|
+
/**
|
|
7
|
+
* Unknown error, mosly probably a bug, unhandled case or coming from a third-party library.
|
|
8
|
+
*/
|
|
9
|
+
export const UnknownError = BaseError.subclass('UnknownError');
|
|
10
|
+
export const RelationRefError = BaseError.subclass('RelationRefError');
|
|
11
|
+
//# sourceMappingURL=_base.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseError } from './_base';
|
|
2
|
+
export const InvariantError = BaseError.subclass('InvariantError');
|
|
3
|
+
// Throw an error if the condition fails
|
|
4
|
+
// > Not providing an inline default argument for message as the result is smaller
|
|
5
|
+
export function invariant(
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
condition,
|
|
8
|
+
// Can provide a string, or a function that returns a string for cases where
|
|
9
|
+
// the message takes a fair amount of effort to compute
|
|
10
|
+
message) {
|
|
11
|
+
if (condition) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
throw new InvariantError(message ?? 'Invariant failed');
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=invariant.js.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
6
6
|
"homepage": "https://likec4.dev",
|
|
@@ -91,9 +91,9 @@
|
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@dagrejs/graphlib": "^2.1.13",
|
|
94
|
+
"modern-errors": "^6.0.0",
|
|
94
95
|
"rambdax": "^9.1.1",
|
|
95
|
-
"remeda": "^1.23.0"
|
|
96
|
-
"tiny-invariant": "^1.3.1"
|
|
96
|
+
"remeda": "^1.23.0"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"typescript": "^5.1.6"
|