@teambit/objects 0.0.701 → 0.0.703
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/models/version.d.ts +5 -5
- package/dist/objects/object-list-to-graph.d.ts +3 -3
- package/dist/objects/object-list-to-graph.js +3 -13
- package/dist/objects/object-list-to-graph.js.map +1 -1
- package/objects/object-list-to-graph.ts +7 -10
- package/package.json +3 -4
- /package/dist/{preview-1790954643627.js → preview-1790963186429.js} +0 -0
package/dist/models/version.d.ts
CHANGED
|
@@ -192,6 +192,11 @@ export default class Version extends BitObject {
|
|
|
192
192
|
private filesToObject;
|
|
193
193
|
private logToObject;
|
|
194
194
|
toObject(): import("lodash").Dictionary<string | boolean | string[] | import("@teambit/component-id").ComponentIdObj[] | Doclet[] | Log[] | Record<string, any>[] | {
|
|
195
|
+
file: string;
|
|
196
|
+
relativePath: string;
|
|
197
|
+
name: string;
|
|
198
|
+
test: boolean;
|
|
199
|
+
}[] | {
|
|
195
200
|
extensionId: ComponentID | import("@teambit/component-id").ComponentIdObj | undefined;
|
|
196
201
|
config: {
|
|
197
202
|
[key: string]: any;
|
|
@@ -202,11 +207,6 @@ export default class Version extends BitObject {
|
|
|
202
207
|
legacyId: string | undefined;
|
|
203
208
|
name: string | undefined;
|
|
204
209
|
newExtensionId: ComponentID | undefined;
|
|
205
|
-
}[] | {
|
|
206
|
-
file: string;
|
|
207
|
-
relativePath: string;
|
|
208
|
-
name: string;
|
|
209
|
-
test: boolean;
|
|
210
210
|
}[] | Record<string, any> | VersionOrigin | {
|
|
211
211
|
[key: string]: string;
|
|
212
212
|
} | {
|
|
@@ -2,10 +2,10 @@ import { Graph, Node, Edge } from '@teambit/graph.cleargraph';
|
|
|
2
2
|
import type { ComponentID } from '@teambit/component-id';
|
|
3
3
|
import type { ObjectList } from './object-list';
|
|
4
4
|
import type { BitObjectList } from './bit-object-list';
|
|
5
|
-
import { Dependency } from '@teambit/graph';
|
|
6
5
|
type BitIdNode = Node<ComponentID>;
|
|
7
|
-
type
|
|
8
|
-
|
|
6
|
+
type DependencyType = 'runtime' | 'dev' | 'peer';
|
|
7
|
+
type DependencyEdge = Edge<DependencyType>;
|
|
8
|
+
export declare class IdGraph extends Graph<ComponentID, DependencyType> {
|
|
9
9
|
constructor(nodes?: BitIdNode[], edges?: DependencyEdge[]);
|
|
10
10
|
}
|
|
11
11
|
export declare function objectListToGraph(objectList: ObjectList): Promise<IdGraph>;
|
|
@@ -27,13 +27,6 @@ function _component() {
|
|
|
27
27
|
};
|
|
28
28
|
return data;
|
|
29
29
|
}
|
|
30
|
-
function _graph2() {
|
|
31
|
-
const data = require("@teambit/graph");
|
|
32
|
-
_graph2 = function () {
|
|
33
|
-
return data;
|
|
34
|
-
};
|
|
35
|
-
return data;
|
|
36
|
-
}
|
|
37
30
|
class IdGraph extends _graph().Graph {
|
|
38
31
|
constructor(nodes = [], edges = []) {
|
|
39
32
|
super(nodes, edges);
|
|
@@ -77,12 +70,9 @@ async function bitObjectListToGraph(bitObjectsList) {
|
|
|
77
70
|
nodes.push(new (_graph().Node)(depIdStr, depId));
|
|
78
71
|
edges.push(new (_graph().Edge)(idStr, depIdStr, edge));
|
|
79
72
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
dependencies.forEach(depId => addDep(depId, runTime));
|
|
84
|
-
[...devDependencies, ...extensionDependencies].forEach(depId => addDep(depId, dev));
|
|
85
|
-
peerDependencies.forEach(depId => addDep(depId, peer));
|
|
73
|
+
dependencies.forEach(depId => addDep(depId, 'runtime'));
|
|
74
|
+
[...devDependencies, ...extensionDependencies].forEach(depId => addDep(depId, 'dev'));
|
|
75
|
+
peerDependencies.forEach(depId => addDep(depId, 'peer'));
|
|
86
76
|
});
|
|
87
77
|
}));
|
|
88
78
|
const uniqNodes = (0, _lodash().uniqBy)(nodes, 'id');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_graph","data","require","_lodash","_component","
|
|
1
|
+
{"version":3,"names":["_graph","data","require","_lodash","_component","IdGraph","Graph","constructor","nodes","edges","exports","objectListToGraph","objectList","bitObjectsList","toBitObjects","bitObjectListToGraph","exportMetadata","getExportMetadata","components","getComponents","versions","getVersions","Promise","all","map","component","compFromMetadata","exportVersions","find","c","id","isEqualWithoutVersion","toComponentId","startFrom","head","versionsInfo","getAllVersionsInfo","modelComponent","versionObjects","throws","forEach","versionInfo","changeVersion","tag","ref","toString","idStr","push","Node","version","dependencies","devDependencies","peerDependencies","extensionDependencies","depsIdsGroupedByType","addDep","depId","edge","depIdStr","Edge","uniqNodes","uniqBy","idGraph"],"sources":["object-list-to-graph.ts"],"sourcesContent":["import { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { uniqBy } from 'lodash';\nimport type { ComponentID } from '@teambit/component-id';\nimport type { ObjectList } from './object-list';\nimport type { BitObjectList } from './bit-object-list';\nimport { getAllVersionsInfo } from '@teambit/component.snap-distance';\n\ntype BitIdNode = Node<ComponentID>;\ntype DependencyType = 'runtime' | 'dev' | 'peer';\ntype DependencyEdge = Edge<DependencyType>;\n\nexport class IdGraph extends Graph<ComponentID, DependencyType> {\n constructor(nodes: BitIdNode[] = [], edges: DependencyEdge[] = []) {\n super(nodes, edges);\n }\n}\n\nexport async function objectListToGraph(objectList: ObjectList): Promise<IdGraph> {\n const bitObjectsList = await objectList.toBitObjects();\n\n return bitObjectListToGraph(bitObjectsList);\n}\n\nexport async function bitObjectListToGraph(bitObjectsList: BitObjectList): Promise<IdGraph> {\n const exportMetadata = bitObjectsList.getExportMetadata();\n const components = bitObjectsList.getComponents();\n const versions = bitObjectsList.getVersions();\n const nodes: BitIdNode[] = [];\n const edges: DependencyEdge[] = [];\n await Promise.all(\n components.map(async (component) => {\n const compFromMetadata = exportMetadata?.exportVersions.find((c) =>\n c.id.isEqualWithoutVersion(component.toComponentId())\n );\n const startFrom = compFromMetadata?.head;\n const versionsInfo = await getAllVersionsInfo({\n modelComponent: component,\n versionObjects: versions,\n startFrom,\n throws: false,\n });\n versionsInfo.forEach((versionInfo) => {\n const id = component.toComponentId().changeVersion(versionInfo.tag || versionInfo.ref.toString());\n const idStr = id.toString();\n nodes.push(new Node(idStr, id));\n if (!versionInfo.version) {\n return;\n }\n const { dependencies, devDependencies, peerDependencies, extensionDependencies } =\n versionInfo.version.depsIdsGroupedByType;\n const addDep = (depId: ComponentID, edge: DependencyType) => {\n const depIdStr = depId.toString();\n nodes.push(new Node(depIdStr, depId));\n edges.push(new Edge(idStr, depIdStr, edge));\n };\n dependencies.forEach((depId) => addDep(depId, 'runtime'));\n [...devDependencies, ...extensionDependencies].forEach((depId) => addDep(depId, 'dev'));\n peerDependencies.forEach((depId) => addDep(depId, 'peer'));\n });\n })\n );\n const uniqNodes = uniqBy(nodes, 'id');\n const idGraph = new IdGraph(uniqNodes, edges);\n\n return idGraph;\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMO,MAAMI,OAAO,SAASC,cAAK,CAA8B;EAC9DC,WAAWA,CAACC,KAAkB,GAAG,EAAE,EAAEC,KAAuB,GAAG,EAAE,EAAE;IACjE,KAAK,CAACD,KAAK,EAAEC,KAAK,CAAC;EACrB;AACF;AAACC,OAAA,CAAAL,OAAA,GAAAA,OAAA;AAEM,eAAeM,iBAAiBA,CAACC,UAAsB,EAAoB;EAChF,MAAMC,cAAc,GAAG,MAAMD,UAAU,CAAC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Ae;QAAEC,gBAAgB;QAAEC;MAAsB,CAAC,GAC9EZ,WAAW,CAACQ,OAAO,CAACK,oBAAoB;MAC1C,MAAMC,MAAM,GAAGA,CAACC,KAAkB,EAAEC,IAAoB,KAAK;QAC3D,MAAMC,QAAQ,GAAGF,KAAK,CAACX,QAAQ,CAAC,CAAC;QACjCrC,KAAK,CAACuC,IAAI,CAAC,KAAIC,aAAI,EAACU,QAAQ,EAAEF,KAAK,CAAC,CAAC;QACrC/C,KAAK,CAACsC,IAAI,CAAC,KAAIY,aAAI,EAACb,KAAK,EAAEY,QAAQ,EAAED,IAAI,CAAC,CAAC;MAC7C,CAAC;MACDP,YAAY,CAACV,OAAO,CAAEgB,KAAK,IAAKD,MAAM,CAACC,KAAK,EAAE,SAAS,CAAC,CAAC;MACzD,CAAC,GAAGL,eAAe,EAAE,GAAGE,qBAAqB,CAAC,CAACb,OAAO,CAAEgB,KAAK,IAAKD,MAAM,CAACC,KAAK,EAAE,KAAK,CAAC,CAAC;MACvFJ,gBAAgB,CAACZ,OAAO,CAAEgB,KAAK,IAAKD,MAAM,CAACC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC,CAAC;EACJ,CAAC,CACH,CAAC;EACD,MAAMI,SAAS,GAAG,IAAAC,gBAAM,EAACrD,KAAK,EAAE,IAAI,CAAC;EACrC,MAAMsD,OAAO,GAAG,IAAIzD,OAAO,CAACuD,SAAS,EAAEnD,KAAK,CAAC;EAE7C,OAAOqD,OAAO;AAChB","ignoreList":[]}
|
|
@@ -4,12 +4,12 @@ import type { ComponentID } from '@teambit/component-id';
|
|
|
4
4
|
import type { ObjectList } from './object-list';
|
|
5
5
|
import type { BitObjectList } from './bit-object-list';
|
|
6
6
|
import { getAllVersionsInfo } from '@teambit/component.snap-distance';
|
|
7
|
-
import { Dependency } from '@teambit/graph';
|
|
8
7
|
|
|
9
8
|
type BitIdNode = Node<ComponentID>;
|
|
10
|
-
type
|
|
9
|
+
type DependencyType = 'runtime' | 'dev' | 'peer';
|
|
10
|
+
type DependencyEdge = Edge<DependencyType>;
|
|
11
11
|
|
|
12
|
-
export class IdGraph extends Graph<ComponentID,
|
|
12
|
+
export class IdGraph extends Graph<ComponentID, DependencyType> {
|
|
13
13
|
constructor(nodes: BitIdNode[] = [], edges: DependencyEdge[] = []) {
|
|
14
14
|
super(nodes, edges);
|
|
15
15
|
}
|
|
@@ -48,17 +48,14 @@ export async function bitObjectListToGraph(bitObjectsList: BitObjectList): Promi
|
|
|
48
48
|
}
|
|
49
49
|
const { dependencies, devDependencies, peerDependencies, extensionDependencies } =
|
|
50
50
|
versionInfo.version.depsIdsGroupedByType;
|
|
51
|
-
const addDep = (depId: ComponentID, edge:
|
|
51
|
+
const addDep = (depId: ComponentID, edge: DependencyType) => {
|
|
52
52
|
const depIdStr = depId.toString();
|
|
53
53
|
nodes.push(new Node(depIdStr, depId));
|
|
54
54
|
edges.push(new Edge(idStr, depIdStr, edge));
|
|
55
55
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
dependencies.forEach((depId) => addDep(depId, runTime));
|
|
60
|
-
[...devDependencies, ...extensionDependencies].forEach((depId) => addDep(depId, dev));
|
|
61
|
-
peerDependencies.forEach((depId) => addDep(depId, peer));
|
|
56
|
+
dependencies.forEach((depId) => addDep(depId, 'runtime'));
|
|
57
|
+
[...devDependencies, ...extensionDependencies].forEach((depId) => addDep(depId, 'dev'));
|
|
58
|
+
peerDependencies.forEach((depId) => addDep(depId, 'peer'));
|
|
62
59
|
});
|
|
63
60
|
})
|
|
64
61
|
);
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/objects",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.703",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/scope/objects",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.scope",
|
|
8
8
|
"name": "objects",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.703"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lodash": "4.17.21",
|
|
@@ -47,8 +47,7 @@
|
|
|
47
47
|
"@teambit/pkg.modules.semver-helper": "0.0.36",
|
|
48
48
|
"@teambit/toolbox.array.duplications-finder": "0.0.16",
|
|
49
49
|
"@teambit/bit.get-bit-version": "0.0.29",
|
|
50
|
-
"@teambit/semantics.doc-parser": "0.0.181"
|
|
51
|
-
"@teambit/graph": "1.0.1194"
|
|
50
|
+
"@teambit/semantics.doc-parser": "0.0.181"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
53
|
"@types/lodash": "4.14.165",
|
|
File without changes
|