@teambit/workspace 1.0.1209 → 1.0.1211
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/build-graph-ids-from-fs.d.ts +14 -2
- package/dist/build-graph-ids-from-fs.js +48 -1
- package/dist/build-graph-ids-from-fs.js.map +1 -1
- package/dist/{preview-1791405980305.js → preview-1791556468133.js} +2 -2
- package/dist/workspace.d.ts +2 -2
- package/dist/workspace.js +5 -4
- package/dist/workspace.js.map +1 -1
- package/package.json +51 -51
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Graph } from '@teambit/graph.cleargraph';
|
|
2
|
-
import type { ComponentID } from '@teambit/component';
|
|
2
|
+
import type { ComponentID, GetGraphIdsOpts } from '@teambit/component';
|
|
3
3
|
import type { ComponentDependency, DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
4
4
|
import type { DepEdgeType } from '@teambit/graph';
|
|
5
5
|
import type { Logger } from '@teambit/logger';
|
|
@@ -16,6 +16,7 @@ export declare class GraphIdsFromFsBuilder {
|
|
|
16
16
|
private consumer;
|
|
17
17
|
private loadedComponents;
|
|
18
18
|
private importedIds;
|
|
19
|
+
private currentDepsIds;
|
|
19
20
|
private shouldThrowOnInvalidDeps;
|
|
20
21
|
constructor(workspace: Workspace, logger: Logger, dependencyResolver: DependencyResolverMain, shouldThrowOnMissingDep?: boolean);
|
|
21
22
|
/**
|
|
@@ -23,7 +24,7 @@ export declare class GraphIdsFromFsBuilder {
|
|
|
23
24
|
* the nodes are component-ids and the edges has a label of the dependency type.
|
|
24
25
|
* to get some info about this the graph build take a look into build-graph-from-fs.buildGraph() docs.
|
|
25
26
|
*/
|
|
26
|
-
buildGraph(ids: ComponentID[]): Promise<Graph<ComponentID, DepEdgeType>>;
|
|
27
|
+
buildGraph(ids: ComponentID[], opts?: GetGraphIdsOpts): Promise<Graph<ComponentID, DepEdgeType>>;
|
|
27
28
|
private processManyComponents;
|
|
28
29
|
/**
|
|
29
30
|
* only for components from the workspace that can be modified to add/remove dependencies, we need to make sure that
|
|
@@ -43,6 +44,17 @@ export declare class GraphIdsFromFsBuilder {
|
|
|
43
44
|
* and get its dependencies.
|
|
44
45
|
*/
|
|
45
46
|
private processCompFromWorkspaceWithGraph;
|
|
47
|
+
/**
|
|
48
|
+
* a modified workspace component is represented by its last snap/tag version (e.g. "scope/comp@1.0.0"). published
|
|
49
|
+
* components that depend on exactly this version point to the same node, although they depend on the old version,
|
|
50
|
+
* not on the modified one. also, the saved graphs merged from the scope may carry the old outgoing edges of it.
|
|
51
|
+
* once the modified component is snapped, it gets a new version and these edges don't apply to it anymore, so they
|
|
52
|
+
* can create cycles that don't really exist. the same goes for its workspace dependents, which get auto-snapped.
|
|
53
|
+
* for these components, keep only the incoming edges from components processed from the workspace (their edges are
|
|
54
|
+
* the current ones) and only the outgoing edges that are current deps.
|
|
55
|
+
*/
|
|
56
|
+
private removeOutdatedEdgesOfModified;
|
|
57
|
+
private setCurrentDeps;
|
|
46
58
|
private addDepEdge;
|
|
47
59
|
private loadManyComponents;
|
|
48
60
|
}
|
|
@@ -68,10 +68,18 @@ function _bitError() {
|
|
|
68
68
|
};
|
|
69
69
|
return data;
|
|
70
70
|
}
|
|
71
|
+
function _componentIssues() {
|
|
72
|
+
const data = require("@teambit/component-issues");
|
|
73
|
+
_componentIssues = function () {
|
|
74
|
+
return data;
|
|
75
|
+
};
|
|
76
|
+
return data;
|
|
77
|
+
}
|
|
71
78
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
72
79
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
73
80
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
74
81
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
82
|
+
const DEPS_NOT_RESOLVED_ISSUES = [_componentIssues().IssuesClasses.MissingPackagesDependenciesOnFs, _componentIssues().IssuesClasses.MissingDependenciesOnFs, _componentIssues().IssuesClasses.MissingLinksFromNodeModulesToSrc, _componentIssues().IssuesClasses.UntrackedDependencies, _componentIssues().IssuesClasses.ParseErrors, _componentIssues().IssuesClasses.ResolveErrors];
|
|
75
83
|
function lifecycleToDepType(compDep) {
|
|
76
84
|
if (compDep.isExtension) return 'ext';
|
|
77
85
|
switch (compDep.lifecycle) {
|
|
@@ -98,6 +106,8 @@ class GraphIdsFromFsBuilder {
|
|
|
98
106
|
_defineProperty(this, "consumer", void 0);
|
|
99
107
|
_defineProperty(this, "loadedComponents", {});
|
|
100
108
|
_defineProperty(this, "importedIds", []);
|
|
109
|
+
// the dependencies each processed component has right now (not from its saved graph), keyed by the component id-str
|
|
110
|
+
_defineProperty(this, "currentDepsIds", {});
|
|
101
111
|
_defineProperty(this, "shouldThrowOnInvalidDeps", true);
|
|
102
112
|
this.consumer = this.workspace.consumer;
|
|
103
113
|
this.shouldThrowOnInvalidDeps = this.shouldThrowOnMissingDep;
|
|
@@ -108,11 +118,12 @@ class GraphIdsFromFsBuilder {
|
|
|
108
118
|
* the nodes are component-ids and the edges has a label of the dependency type.
|
|
109
119
|
* to get some info about this the graph build take a look into build-graph-from-fs.buildGraph() docs.
|
|
110
120
|
*/
|
|
111
|
-
async buildGraph(ids) {
|
|
121
|
+
async buildGraph(ids, opts = {}) {
|
|
112
122
|
this.logger.debug(`GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders`);
|
|
113
123
|
const start = Date.now();
|
|
114
124
|
const components = await this.loadManyComponents(ids);
|
|
115
125
|
await this.processManyComponents(components);
|
|
126
|
+
if (opts.excludeOutdatedEdgesOfModified) await this.removeOutdatedEdgesOfModified();
|
|
116
127
|
this.logger.debug(`GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`);
|
|
117
128
|
return this.graph;
|
|
118
129
|
}
|
|
@@ -165,6 +176,7 @@ class GraphIdsFromFsBuilder {
|
|
|
165
176
|
const allDepsIds = deps.map(d => d.componentId);
|
|
166
177
|
const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);
|
|
167
178
|
deps.forEach(dep => this.addDepEdge(idStr, dep));
|
|
179
|
+
this.setCurrentDeps(idStr, deps);
|
|
168
180
|
this.completed.push(idStr);
|
|
169
181
|
return allDependenciesComps;
|
|
170
182
|
}
|
|
@@ -200,8 +212,43 @@ class GraphIdsFromFsBuilder {
|
|
|
200
212
|
const idStr = component.id.toString();
|
|
201
213
|
const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);
|
|
202
214
|
deps.forEach(dep => this.addDepEdge(idStr, dep));
|
|
215
|
+
this.setCurrentDeps(idStr, deps);
|
|
203
216
|
return allDependenciesComps;
|
|
204
217
|
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* a modified workspace component is represented by its last snap/tag version (e.g. "scope/comp@1.0.0"). published
|
|
221
|
+
* components that depend on exactly this version point to the same node, although they depend on the old version,
|
|
222
|
+
* not on the modified one. also, the saved graphs merged from the scope may carry the old outgoing edges of it.
|
|
223
|
+
* once the modified component is snapped, it gets a new version and these edges don't apply to it anymore, so they
|
|
224
|
+
* can create cycles that don't really exist. the same goes for its workspace dependents, which get auto-snapped.
|
|
225
|
+
* for these components, keep only the incoming edges from components processed from the workspace (their edges are
|
|
226
|
+
* the current ones) and only the outgoing edges that are current deps.
|
|
227
|
+
*/
|
|
228
|
+
async removeOutdatedEdgesOfModified() {
|
|
229
|
+
// components processed from the workspace. the edges of other nodes came from saved graphs, so they are the
|
|
230
|
+
// published ones, even when the id is in the workspace.
|
|
231
|
+
const processedIdsStr = new Set(this.workspace.listIds().map(id => id.toString()).filter(idStr => this.currentDepsIds[idStr]));
|
|
232
|
+
const getOutdatedEdges = idStr => [...this.graph.inEdges(idStr).filter(edge => !processedIdsStr.has(edge.sourceId)), ...this.graph.outEdges(idStr).filter(edge => !this.currentDepsIds[idStr].has(edge.targetId))];
|
|
233
|
+
// checking whether a component is modified is expensive. skip it when no edge would be removed anyway.
|
|
234
|
+
if (!Array.from(processedIdsStr).some(idStr => getOutdatedEdges(idStr).length)) return;
|
|
235
|
+
// when some dependencies can't be resolved, the current deps are incomplete, so keep the edges as is.
|
|
236
|
+
const hasUnresolvedDeps = idStr => DEPS_NOT_RESOLVED_ISSUES.some(issue => this.loadedComponents[idStr].state.issues.getIssue(issue));
|
|
237
|
+
const changingIdsStr = new Set();
|
|
238
|
+
await (0, _pMapSeries().default)(Array.from(processedIdsStr), async idStr => {
|
|
239
|
+
if (hasUnresolvedDeps(idStr)) return;
|
|
240
|
+
if (await this.workspace.isModified(this.loadedComponents[idStr])) changingIdsStr.add(idStr);
|
|
241
|
+
});
|
|
242
|
+
// workspace dependents of modified components get auto-snapped, so they get a new version as well.
|
|
243
|
+
const isAutoSnapped = node => processedIdsStr.has(node.id) && !hasUnresolvedDeps(node.id);
|
|
244
|
+
Array.from(changingIdsStr).forEach(idStr => this.graph.predecessors(idStr, {
|
|
245
|
+
nodeFilter: isAutoSnapped
|
|
246
|
+
}).forEach(node => changingIdsStr.add(node.id)));
|
|
247
|
+
changingIdsStr.forEach(idStr => getOutdatedEdges(idStr).forEach(edge => this.graph.deleteEdge(edge.sourceId, edge.targetId)));
|
|
248
|
+
}
|
|
249
|
+
setCurrentDeps(idStr, deps) {
|
|
250
|
+
this.currentDepsIds[idStr] = new Set(deps.map(dep => dep.componentId.toString()));
|
|
251
|
+
}
|
|
205
252
|
addDepEdge(idStr, dep) {
|
|
206
253
|
const depId = dep.componentId;
|
|
207
254
|
if (!this.graph.hasNode(depId.toString())) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_graph","_lodash","_legacy","_componentId","_legacy2","_scope","_lodash2","_bitError","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","lifecycleToDepType","compDep","isExtension","lifecycle","Error","GraphIdsFromFsBuilder","constructor","workspace","logger","dependencyResolver","shouldThrowOnMissingDep","Graph","consumer","shouldThrowOnInvalidDeps","buildGraph","ids","debug","length","start","Date","now","components","loadManyComponents","processManyComponents","graph","depth","importObjects","allDependencies","mapSeries","component","processOneComponent","allDependenciesFlattened","flatten","workspaceIds","listIds","compOnWorkspaceOnly","filter","comp","find","id","isEqual","notImported","map","c","importedIds","includes","toString","exportedDeps","dep","isExported","scopeComponentsImporter","scope","scopeImporter","importMany","ComponentIdList","uniqFromArray","throwForDependencyNotFound","throwForSeederNotFound","reFetchUnBuiltVersion","lane","getCurrentLaneObject","reason","push","idStr","completed","graphFromScope","getSavedGraphOfComponentIfExist","edges","isOnWorkspace","hasId","allDependenciesComps","processCompFromWorkspaceWithGraph","merge","deps","getComponentDependencies","allDepsIds","d","componentId","forEach","addDepEdge","workspaceIdsStr","depsInScopeGraph","depsNotInScopeGraph","partition","hasNode","depsInScopeGraphIds","depsInScopeGraphIdsNotCompleted","subGraphs","successorsSubgraph","edge","sourceId","deleteEdge","targetId","depId","warn","setEdge","Edge","componentsIds","dependenciesOf","compId","idStrPotentiallyWithoutVersion","fromCache","loadedComponents","get","setNode","Node","err","ComponentNotFound","ComponentNotFoundInScope","ScopeNotFound","BitError","ConsumerComponent","isComponentInvalidByErrorType","message","error","compact","exports"],"sources":["build-graph-ids-from-fs.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { flatten, partition } from 'lodash';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport type { Component, ComponentID } from '@teambit/component';\nimport { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { ComponentIdList } from '@teambit/component-id';\nimport type { ComponentDependency, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport type { CompIdGraph, DepEdgeType } from '@teambit/graph';\nimport { ComponentNotFound, ScopeNotFound } from '@teambit/legacy.scope';\nimport { ComponentNotFound as ComponentNotFoundInScope } from '@teambit/scope';\nimport compact from 'lodash.compact';\nimport type { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport type { Workspace } from './workspace';\n\nexport function lifecycleToDepType(compDep: ComponentDependency): DepEdgeType {\n if (compDep.isExtension) return 'ext';\n switch (compDep.lifecycle) {\n case 'dev':\n return 'dev';\n case 'runtime':\n return 'prod';\n case 'peer':\n return 'peer';\n default:\n throw new Error(`lifecycle ${compDep.lifecycle} is not support`);\n }\n}\n\nexport class GraphIdsFromFsBuilder {\n private graph = new Graph<ComponentID, DepEdgeType>();\n private completed: string[] = [];\n private depth = 1;\n private consumer: Consumer;\n private loadedComponents: { [idStr: string]: Component } = {};\n private importedIds: string[] = [];\n private shouldThrowOnInvalidDeps = true; // for now it has the same value as shouldThrowOnMissingDep. change if needed\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private shouldThrowOnMissingDep = true\n ) {\n this.consumer = this.workspace.consumer;\n this.shouldThrowOnInvalidDeps = this.shouldThrowOnMissingDep;\n }\n\n /**\n * create a graph with all dependencies and flattened dependencies of the given components.\n * the nodes are component-ids and the edges has a label of the dependency type.\n * to get some info about this the graph build take a look into build-graph-from-fs.buildGraph() docs.\n */\n async buildGraph(ids: ComponentID[]): Promise<Graph<ComponentID, DepEdgeType>> {\n this.logger.debug(`GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders`);\n const start = Date.now();\n const components = await this.loadManyComponents(ids);\n await this.processManyComponents(components);\n this.logger.debug(\n `GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`\n );\n return this.graph;\n }\n\n private async processManyComponents(components: Component[]) {\n this.logger.debug(\n `GraphIdsFromFsBuilder.processManyComponents depth ${this.depth}, ${components.length} components`\n );\n this.depth += 1;\n await this.importObjects(components);\n const allDependencies = await mapSeries(components, (component) => this.processOneComponent(component));\n const allDependenciesFlattened = flatten(allDependencies);\n if (allDependenciesFlattened.length) await this.processManyComponents(allDependenciesFlattened);\n }\n\n /**\n * only for components from the workspace that can be modified to add/remove dependencies, we need to make sure that\n * all their dependencies are imported.\n * once a component from scope is imported, we know that either we have its dependency graph or all flattened deps\n */\n private async importObjects(components: Component[]) {\n const workspaceIds = this.workspace.listIds();\n const compOnWorkspaceOnly = components.filter((comp) => workspaceIds.find((id) => id.isEqual(comp.id)));\n const notImported = compOnWorkspaceOnly.map((c) => c.id).filter((id) => !this.importedIds.includes(id.toString()));\n const exportedDeps = notImported.filter((dep) => this.workspace.isExported(dep));\n const scopeComponentsImporter = this.consumer.scope.scopeImporter;\n await scopeComponentsImporter.importMany({\n ids: ComponentIdList.uniqFromArray(exportedDeps),\n throwForDependencyNotFound: this.shouldThrowOnMissingDep,\n throwForSeederNotFound: this.shouldThrowOnMissingDep,\n reFetchUnBuiltVersion: false,\n lane: await this.workspace.getCurrentLaneObject(),\n reason: 'for building graph-ids from the workspace',\n });\n notImported.map((id) => this.importedIds.push(id.toString()));\n }\n\n private async processOneComponent(component: Component) {\n const idStr = component.id.toString();\n if (this.completed.includes(idStr)) return [];\n const graphFromScope = await this.workspace.getSavedGraphOfComponentIfExist(component);\n if (graphFromScope?.edges.length) {\n const isOnWorkspace = await this.workspace.hasId(component.id);\n if (isOnWorkspace) {\n const allDependenciesComps = await this.processCompFromWorkspaceWithGraph(graphFromScope, component);\n this.completed.push(idStr);\n return allDependenciesComps;\n }\n this.graph.merge([graphFromScope]);\n this.completed.push(idStr);\n return [];\n }\n\n const deps = this.dependencyResolver.getComponentDependencies(component);\n const allDepsIds = deps.map((d) => d.componentId);\n const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);\n\n deps.forEach((dep) => this.addDepEdge(idStr, dep));\n this.completed.push(idStr);\n\n return allDependenciesComps;\n }\n\n /**\n * this is tricky.\n * the component is in the workspace so it can be modified. dependencies can be added/removed/updated/downgraded.\n * we have the graph-dependencies from the last snap, so we prefer to use it whenever possible for performance reasons.\n * if we can't use it, we have to recursively load dependencies components and get the data from there.\n * to maximize the performance, we iterate the direct dependencies, if we find a dep with the same id in the graph,\n * and that id is not in the workspace then ask the graph for all its successors. otherwise, if it's not there, or\n * it's there but it's also in the workspace (which therefore can be modified), we recursively load the dep components\n * and get its dependencies.\n */\n private async processCompFromWorkspaceWithGraph(\n graphFromScope: CompIdGraph,\n component: Component\n ): Promise<Component[]> {\n const deps = this.dependencyResolver.getComponentDependencies(component);\n const workspaceIds = this.workspace.listIds();\n const workspaceIdsStr = workspaceIds.map((id) => id.toString());\n const [depsInScopeGraph, depsNotInScopeGraph] = partition(\n deps,\n (dep) =>\n graphFromScope.hasNode(dep.componentId.toString()) && !workspaceIdsStr.includes(dep.componentId.toString())\n );\n\n const depsInScopeGraphIds = depsInScopeGraph.map((dep) => dep.componentId.toString());\n const depsInScopeGraphIdsNotCompleted = depsInScopeGraphIds.filter((id) => !this.completed.includes(id));\n if (depsInScopeGraphIdsNotCompleted.length) {\n const subGraphs = graphFromScope.successorsSubgraph(depsInScopeGraphIdsNotCompleted);\n // delete any edge that its source is from the workspace. if this component is modified, this edge could be\n // incorrect. we don't need these edges anyway because we add them directly.\n subGraphs.edges.forEach((edge) => {\n if (workspaceIdsStr.includes(edge.sourceId)) subGraphs.deleteEdge(edge.sourceId, edge.targetId);\n });\n this.graph.merge([subGraphs]);\n this.completed.push(...depsInScopeGraphIdsNotCompleted);\n }\n\n const allDepsIds = depsNotInScopeGraph.map((d) => d.componentId);\n const idStr = component.id.toString();\n const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);\n deps.forEach((dep) => this.addDepEdge(idStr, dep));\n return allDependenciesComps;\n }\n\n private addDepEdge(idStr: string, dep: ComponentDependency) {\n const depId = dep.componentId;\n if (!this.graph.hasNode(depId.toString())) {\n if (this.shouldThrowOnMissingDep) {\n throw new Error(`buildOneComponent: missing node of ${depId.toString()}`);\n }\n this.logger.warn(`ignoring missing ${depId.toString()}`);\n return;\n }\n this.graph.setEdge(new Edge(idStr, depId.toString(), lifecycleToDepType(dep)));\n }\n\n private async loadManyComponents(componentsIds: ComponentID[], dependenciesOf?: string): Promise<Component[]> {\n const components = await mapSeries(componentsIds, async (compId) => {\n const idStrPotentiallyWithoutVersion = compId.toString();\n const fromCache = this.loadedComponents[idStrPotentiallyWithoutVersion];\n if (fromCache) return fromCache;\n try {\n const component = await this.workspace.get(compId);\n const idStr = component.id.toString();\n this.loadedComponents[idStr] = component;\n this.graph.setNode(new Node(idStr, component.id));\n return component;\n } catch (err: any) {\n if (\n err instanceof ComponentNotFound ||\n err instanceof ComponentNotFoundInScope ||\n err instanceof ScopeNotFound\n ) {\n if (dependenciesOf && !this.shouldThrowOnMissingDep) {\n this.logger.warn(\n `component ${idStrPotentiallyWithoutVersion}, dependency of ${dependenciesOf} was not found. continuing without it`\n );\n return null;\n }\n throw new BitError(\n `error: component \"${idStrPotentiallyWithoutVersion}\" was not found.\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (ConsumerComponent.isComponentInvalidByErrorType(err)) {\n if (dependenciesOf && !this.shouldThrowOnInvalidDeps) {\n this.logger.warn(\n `component ${idStrPotentiallyWithoutVersion}, dependency of ${dependenciesOf} is invalid. continuing without it`\n );\n return null;\n }\n throw new BitError(\n `error: component \"${idStrPotentiallyWithoutVersion}\" is invalid (${err.message}).\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (dependenciesOf) this.logger.error(`failed loading dependencies of ${dependenciesOf}`);\n throw err;\n }\n });\n return compact(components);\n }\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBA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R,cAAc,IAAI,CAAC,IAAI,CAACrF,wBAAwB,EAAE;YACpD,IAAI,CAACL,MAAM,CAACsF,IAAI,CACd,aAAaM,8BAA8B,mBAAmBF,cAAc,oCAC9E,CAAC;YACD,OAAO,IAAI;UACb;UACA,MAAM,KAAIY,oBAAQ,EAChB,qBAAqBV,8BAA8B,iBAAiBM,GAAG,CAACO,OAAO,0CAC7Ef,cAAc,IAAI,QAAQ,iDAE9B,CAAC;QACH;QACA,IAAIA,cAAc,EAAE,IAAI,CAAC1F,MAAM,CAAC0G,KAAK,CAAC,kCAAkChB,cAAc,EAAE,CAAC;QACzF,MAAMQ,GAAG;MACX;IACF,CAAC,CAAC;IACF,OAAO,IAAAS,kBAAO,EAAC9F,UAAU,CAAC;EAC5B;AACF;AAAC+F,OAAA,CAAA/G,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_graph","_lodash","_legacy","_componentId","_legacy2","_scope","_lodash2","_bitError","_componentIssues","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DEPS_NOT_RESOLVED_ISSUES","IssuesClasses","MissingPackagesDependenciesOnFs","MissingDependenciesOnFs","MissingLinksFromNodeModulesToSrc","UntrackedDependencies","ParseErrors","ResolveErrors","lifecycleToDepType","compDep","isExtension","lifecycle","Error","GraphIdsFromFsBuilder","constructor","workspace","logger","dependencyResolver","shouldThrowOnMissingDep","Graph","consumer","shouldThrowOnInvalidDeps","buildGraph","ids","opts","debug","length","start","Date","now","components","loadManyComponents","processManyComponents","excludeOutdatedEdgesOfModified","removeOutdatedEdgesOfModified","graph","depth","importObjects","allDependencies","mapSeries","component","processOneComponent","allDependenciesFlattened","flatten","workspaceIds","listIds","compOnWorkspaceOnly","filter","comp","find","id","isEqual","notImported","map","c","importedIds","includes","toString","exportedDeps","dep","isExported","scopeComponentsImporter","scope","scopeImporter","importMany","ComponentIdList","uniqFromArray","throwForDependencyNotFound","throwForSeederNotFound","reFetchUnBuiltVersion","lane","getCurrentLaneObject","reason","push","idStr","completed","graphFromScope","getSavedGraphOfComponentIfExist","edges","isOnWorkspace","hasId","allDependenciesComps","processCompFromWorkspaceWithGraph","merge","deps","getComponentDependencies","allDepsIds","d","componentId","forEach","addDepEdge","setCurrentDeps","workspaceIdsStr","depsInScopeGraph","depsNotInScopeGraph","partition","hasNode","depsInScopeGraphIds","depsInScopeGraphIdsNotCompleted","subGraphs","successorsSubgraph","edge","sourceId","deleteEdge","targetId","processedIdsStr","Set","currentDepsIds","getOutdatedEdges","inEdges","has","outEdges","Array","from","some","hasUnresolvedDeps","issue","loadedComponents","state","issues","getIssue","changingIdsStr","isModified","add","isAutoSnapped","node","predecessors","nodeFilter","depId","warn","setEdge","Edge","componentsIds","dependenciesOf","compId","idStrPotentiallyWithoutVersion","fromCache","get","setNode","Node","err","ComponentNotFound","ComponentNotFoundInScope","ScopeNotFound","BitError","ConsumerComponent","isComponentInvalidByErrorType","message","error","compact","exports"],"sources":["build-graph-ids-from-fs.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { flatten, partition } from 'lodash';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport type { Component, ComponentID, GetGraphIdsOpts } from '@teambit/component';\nimport { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { ComponentIdList } from '@teambit/component-id';\nimport type { ComponentDependency, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport type { CompIdGraph, DepEdgeType } from '@teambit/graph';\nimport { ComponentNotFound, ScopeNotFound } from '@teambit/legacy.scope';\nimport { ComponentNotFound as ComponentNotFoundInScope } from '@teambit/scope';\nimport compact from 'lodash.compact';\nimport type { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport type { ComponentIssue } from '@teambit/component-issues';\nimport type { Workspace } from './workspace';\n\nconst DEPS_NOT_RESOLVED_ISSUES: Array<new () => ComponentIssue> = [\n IssuesClasses.MissingPackagesDependenciesOnFs,\n IssuesClasses.MissingDependenciesOnFs,\n IssuesClasses.MissingLinksFromNodeModulesToSrc,\n IssuesClasses.UntrackedDependencies,\n IssuesClasses.ParseErrors,\n IssuesClasses.ResolveErrors,\n];\n\nexport function lifecycleToDepType(compDep: ComponentDependency): DepEdgeType {\n if (compDep.isExtension) return 'ext';\n switch (compDep.lifecycle) {\n case 'dev':\n return 'dev';\n case 'runtime':\n return 'prod';\n case 'peer':\n return 'peer';\n default:\n throw new Error(`lifecycle ${compDep.lifecycle} is not support`);\n }\n}\n\nexport class GraphIdsFromFsBuilder {\n private graph = new Graph<ComponentID, DepEdgeType>();\n private completed: string[] = [];\n private depth = 1;\n private consumer: Consumer;\n private loadedComponents: { [idStr: string]: Component } = {};\n private importedIds: string[] = [];\n // the dependencies each processed component has right now (not from its saved graph), keyed by the component id-str\n private currentDepsIds: { [idStr: string]: Set<string> } = {};\n private shouldThrowOnInvalidDeps = true; // for now it has the same value as shouldThrowOnMissingDep. change if needed\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private shouldThrowOnMissingDep = true\n ) {\n this.consumer = this.workspace.consumer;\n this.shouldThrowOnInvalidDeps = this.shouldThrowOnMissingDep;\n }\n\n /**\n * create a graph with all dependencies and flattened dependencies of the given components.\n * the nodes are component-ids and the edges has a label of the dependency type.\n * to get some info about this the graph build take a look into build-graph-from-fs.buildGraph() docs.\n */\n async buildGraph(ids: ComponentID[], opts: GetGraphIdsOpts = {}): Promise<Graph<ComponentID, DepEdgeType>> {\n this.logger.debug(`GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders`);\n const start = Date.now();\n const components = await this.loadManyComponents(ids);\n await this.processManyComponents(components);\n if (opts.excludeOutdatedEdgesOfModified) await this.removeOutdatedEdgesOfModified();\n this.logger.debug(\n `GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`\n );\n return this.graph;\n }\n\n private async processManyComponents(components: Component[]) {\n this.logger.debug(\n `GraphIdsFromFsBuilder.processManyComponents depth ${this.depth}, ${components.length} components`\n );\n this.depth += 1;\n await this.importObjects(components);\n const allDependencies = await mapSeries(components, (component) => this.processOneComponent(component));\n const allDependenciesFlattened = flatten(allDependencies);\n if (allDependenciesFlattened.length) await this.processManyComponents(allDependenciesFlattened);\n }\n\n /**\n * only for components from the workspace that can be modified to add/remove dependencies, we need to make sure that\n * all their dependencies are imported.\n * once a component from scope is imported, we know that either we have its dependency graph or all flattened deps\n */\n private async importObjects(components: Component[]) {\n const workspaceIds = this.workspace.listIds();\n const compOnWorkspaceOnly = components.filter((comp) => workspaceIds.find((id) => id.isEqual(comp.id)));\n const notImported = compOnWorkspaceOnly.map((c) => c.id).filter((id) => !this.importedIds.includes(id.toString()));\n const exportedDeps = notImported.filter((dep) => this.workspace.isExported(dep));\n const scopeComponentsImporter = this.consumer.scope.scopeImporter;\n await scopeComponentsImporter.importMany({\n ids: ComponentIdList.uniqFromArray(exportedDeps),\n throwForDependencyNotFound: this.shouldThrowOnMissingDep,\n throwForSeederNotFound: this.shouldThrowOnMissingDep,\n reFetchUnBuiltVersion: false,\n lane: await this.workspace.getCurrentLaneObject(),\n reason: 'for building graph-ids from the workspace',\n });\n notImported.map((id) => this.importedIds.push(id.toString()));\n }\n\n private async processOneComponent(component: Component) {\n const idStr = component.id.toString();\n if (this.completed.includes(idStr)) return [];\n const graphFromScope = await this.workspace.getSavedGraphOfComponentIfExist(component);\n if (graphFromScope?.edges.length) {\n const isOnWorkspace = await this.workspace.hasId(component.id);\n if (isOnWorkspace) {\n const allDependenciesComps = await this.processCompFromWorkspaceWithGraph(graphFromScope, component);\n this.completed.push(idStr);\n return allDependenciesComps;\n }\n this.graph.merge([graphFromScope]);\n this.completed.push(idStr);\n return [];\n }\n\n const deps = this.dependencyResolver.getComponentDependencies(component);\n const allDepsIds = deps.map((d) => d.componentId);\n const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);\n\n deps.forEach((dep) => this.addDepEdge(idStr, dep));\n this.setCurrentDeps(idStr, deps);\n this.completed.push(idStr);\n\n return allDependenciesComps;\n }\n\n /**\n * this is tricky.\n * the component is in the workspace so it can be modified. dependencies can be added/removed/updated/downgraded.\n * we have the graph-dependencies from the last snap, so we prefer to use it whenever possible for performance reasons.\n * if we can't use it, we have to recursively load dependencies components and get the data from there.\n * to maximize the performance, we iterate the direct dependencies, if we find a dep with the same id in the graph,\n * and that id is not in the workspace then ask the graph for all its successors. otherwise, if it's not there, or\n * it's there but it's also in the workspace (which therefore can be modified), we recursively load the dep components\n * and get its dependencies.\n */\n private async processCompFromWorkspaceWithGraph(\n graphFromScope: CompIdGraph,\n component: Component\n ): Promise<Component[]> {\n const deps = this.dependencyResolver.getComponentDependencies(component);\n const workspaceIds = this.workspace.listIds();\n const workspaceIdsStr = workspaceIds.map((id) => id.toString());\n const [depsInScopeGraph, depsNotInScopeGraph] = partition(\n deps,\n (dep) =>\n graphFromScope.hasNode(dep.componentId.toString()) && !workspaceIdsStr.includes(dep.componentId.toString())\n );\n\n const depsInScopeGraphIds = depsInScopeGraph.map((dep) => dep.componentId.toString());\n const depsInScopeGraphIdsNotCompleted = depsInScopeGraphIds.filter((id) => !this.completed.includes(id));\n if (depsInScopeGraphIdsNotCompleted.length) {\n const subGraphs = graphFromScope.successorsSubgraph(depsInScopeGraphIdsNotCompleted);\n // delete any edge that its source is from the workspace. if this component is modified, this edge could be\n // incorrect. we don't need these edges anyway because we add them directly.\n subGraphs.edges.forEach((edge) => {\n if (workspaceIdsStr.includes(edge.sourceId)) subGraphs.deleteEdge(edge.sourceId, edge.targetId);\n });\n this.graph.merge([subGraphs]);\n this.completed.push(...depsInScopeGraphIdsNotCompleted);\n }\n\n const allDepsIds = depsNotInScopeGraph.map((d) => d.componentId);\n const idStr = component.id.toString();\n const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);\n deps.forEach((dep) => this.addDepEdge(idStr, dep));\n this.setCurrentDeps(idStr, deps);\n return allDependenciesComps;\n }\n\n /**\n * a modified workspace component is represented by its last snap/tag version (e.g. \"scope/comp@1.0.0\"). published\n * components that depend on exactly this version point to the same node, although they depend on the old version,\n * not on the modified one. also, the saved graphs merged from the scope may carry the old outgoing edges of it.\n * once the modified component is snapped, it gets a new version and these edges don't apply to it anymore, so they\n * can create cycles that don't really exist. the same goes for its workspace dependents, which get auto-snapped.\n * for these components, keep only the incoming edges from components processed from the workspace (their edges are\n * the current ones) and only the outgoing edges that are current deps.\n */\n private async removeOutdatedEdgesOfModified() {\n // components processed from the workspace. the edges of other nodes came from saved graphs, so they are the\n // published ones, even when the id is in the workspace.\n const processedIdsStr = new Set(\n this.workspace\n .listIds()\n .map((id) => id.toString())\n .filter((idStr) => this.currentDepsIds[idStr])\n );\n const getOutdatedEdges = (idStr: string) => [\n ...this.graph.inEdges(idStr).filter((edge) => !processedIdsStr.has(edge.sourceId)),\n ...this.graph.outEdges(idStr).filter((edge) => !this.currentDepsIds[idStr].has(edge.targetId)),\n ];\n // checking whether a component is modified is expensive. skip it when no edge would be removed anyway.\n if (!Array.from(processedIdsStr).some((idStr) => getOutdatedEdges(idStr).length)) return;\n // when some dependencies can't be resolved, the current deps are incomplete, so keep the edges as is.\n const hasUnresolvedDeps = (idStr: string) =>\n DEPS_NOT_RESOLVED_ISSUES.some((issue) => this.loadedComponents[idStr].state.issues.getIssue(issue));\n const changingIdsStr = new Set<string>();\n await mapSeries(Array.from(processedIdsStr), async (idStr) => {\n if (hasUnresolvedDeps(idStr)) return;\n if (await this.workspace.isModified(this.loadedComponents[idStr])) changingIdsStr.add(idStr);\n });\n // workspace dependents of modified components get auto-snapped, so they get a new version as well.\n const isAutoSnapped = (node: Node<ComponentID>) => processedIdsStr.has(node.id) && !hasUnresolvedDeps(node.id);\n Array.from(changingIdsStr).forEach((idStr) =>\n this.graph.predecessors(idStr, { nodeFilter: isAutoSnapped }).forEach((node) => changingIdsStr.add(node.id))\n );\n changingIdsStr.forEach((idStr) =>\n getOutdatedEdges(idStr).forEach((edge) => this.graph.deleteEdge(edge.sourceId, edge.targetId))\n );\n }\n\n private setCurrentDeps(idStr: string, deps: ComponentDependency[]) {\n this.currentDepsIds[idStr] = new Set(deps.map((dep) => dep.componentId.toString()));\n }\n\n private addDepEdge(idStr: string, dep: ComponentDependency) {\n const depId = dep.componentId;\n if (!this.graph.hasNode(depId.toString())) {\n if (this.shouldThrowOnMissingDep) {\n throw new Error(`buildOneComponent: missing node of ${depId.toString()}`);\n }\n this.logger.warn(`ignoring missing ${depId.toString()}`);\n return;\n }\n this.graph.setEdge(new Edge(idStr, depId.toString(), lifecycleToDepType(dep)));\n }\n\n private async loadManyComponents(componentsIds: ComponentID[], dependenciesOf?: string): Promise<Component[]> {\n const components = await mapSeries(componentsIds, async (compId) => {\n const idStrPotentiallyWithoutVersion = compId.toString();\n const fromCache = this.loadedComponents[idStrPotentiallyWithoutVersion];\n if (fromCache) return fromCache;\n try {\n const component = await this.workspace.get(compId);\n const idStr = component.id.toString();\n this.loadedComponents[idStr] = component;\n this.graph.setNode(new Node(idStr, component.id));\n return component;\n } catch (err: any) {\n if (\n err instanceof ComponentNotFound ||\n err instanceof ComponentNotFoundInScope ||\n err instanceof ScopeNotFound\n ) {\n if (dependenciesOf && !this.shouldThrowOnMissingDep) {\n this.logger.warn(\n `component ${idStrPotentiallyWithoutVersion}, dependency of ${dependenciesOf} was not found. continuing without it`\n );\n return null;\n }\n throw new BitError(\n `error: component \"${idStrPotentiallyWithoutVersion}\" was not found.\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (ConsumerComponent.isComponentInvalidByErrorType(err)) {\n if (dependenciesOf && !this.shouldThrowOnInvalidDeps) {\n this.logger.warn(\n `component ${idStrPotentiallyWithoutVersion}, dependency of ${dependenciesOf} is invalid. continuing without it`\n );\n return null;\n }\n throw new BitError(\n `error: component \"${idStrPotentiallyWithoutVersion}\" is invalid (${err.message}).\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (dependenciesOf) this.logger.error(`failed loading dependencies of ${dependenciesOf}`);\n throw err;\n }\n });\n return compact(components);\n }\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,aAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,OAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,MAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,SAAA;EAAA,MAAAT,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAA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AAACwH,OAAA,CAAAzI,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.1211/dist/workspace.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.1211/dist/workspace.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/dist/workspace.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Graph } from '@teambit/graph.cleargraph';
|
|
2
2
|
import type { IssuesList } from '@teambit/component-issues';
|
|
3
3
|
import type { AspectLoaderMain, AspectDefinition } from '@teambit/aspect-loader';
|
|
4
|
-
import type { ComponentMain, Component, ComponentFactory, InvalidComponent, ResolveAspectsOptions, AspectList } from '@teambit/component';
|
|
4
|
+
import type { ComponentMain, Component, ComponentFactory, InvalidComponent, ResolveAspectsOptions, AspectList, GetGraphIdsOpts } from '@teambit/component';
|
|
5
5
|
import type { ComponentScopeDirMap, WorkspaceConfig } from '@teambit/config';
|
|
6
6
|
import type { CurrentPkg, DependencyResolverMain, DependencyList, VariantPolicyConfigObject, VariantPolicyConfigArr } from '@teambit/dependency-resolver';
|
|
7
7
|
import type { EnvsMain, EnvJsonc } from '@teambit/envs';
|
|
@@ -308,7 +308,7 @@ export declare class Workspace implements ComponentFactory {
|
|
|
308
308
|
*/
|
|
309
309
|
private applyStagedDeprecation;
|
|
310
310
|
getGraph(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean): Promise<Graph<Component, string>>;
|
|
311
|
-
getGraphIds(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean): Promise<CompIdGraph>;
|
|
311
|
+
getGraphIds(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean, opts?: GetGraphIdsOpts): Promise<CompIdGraph>;
|
|
312
312
|
getUnavailableOnMainComponents(): Promise<ComponentID[]>;
|
|
313
313
|
getDependencies(component: Component): DependencyList;
|
|
314
314
|
getSavedGraphOfComponentIfExist(component: Component): Promise<Graph<ComponentID, DepEdgeType> | null>;
|
package/dist/workspace.js
CHANGED
|
@@ -786,10 +786,10 @@ class Workspace {
|
|
|
786
786
|
if (!ids || ids.length < 1) ids = this.listIds();
|
|
787
787
|
return this.buildOneGraphForComponents(ids, undefined, undefined, shouldThrowOnMissingDep);
|
|
788
788
|
}
|
|
789
|
-
async getGraphIds(ids, shouldThrowOnMissingDep = true) {
|
|
789
|
+
async getGraphIds(ids, shouldThrowOnMissingDep = true, opts = {}) {
|
|
790
790
|
if (!ids || ids.length < 1) ids = this.listIds();
|
|
791
791
|
const graphIdsFromFsBuilder = new (_buildGraphIdsFromFs().GraphIdsFromFsBuilder)(this, this.logger, this.dependencyResolver, shouldThrowOnMissingDep);
|
|
792
|
-
return graphIdsFromFsBuilder.buildGraph(ids);
|
|
792
|
+
return graphIdsFromFsBuilder.buildGraph(ids, opts);
|
|
793
793
|
}
|
|
794
794
|
async getUnavailableOnMainComponents() {
|
|
795
795
|
const currentLaneId = this.consumer.getCurrentLaneId();
|
|
@@ -816,7 +816,8 @@ class Workspace {
|
|
|
816
816
|
const flattenedEdges = await this.scope.getFlattenedEdges(component.id);
|
|
817
817
|
const versionObj = await this.scope.getBitObjectVersionById(component.id);
|
|
818
818
|
if (!flattenedEdges || !versionObj) return null;
|
|
819
|
-
|
|
819
|
+
const flattenedDependencies = await versionObj.loadFlattenedDependencies(this.scope.legacyScope.objects);
|
|
820
|
+
if (!flattenedEdges.length && flattenedDependencies.length) {
|
|
820
821
|
// there are flattenedDependencies, so must be edges, if they're empty, it's because the component was tagged
|
|
821
822
|
// with a version < ~0.0.901, so this flattenedEdges wasn't exist.
|
|
822
823
|
return null;
|
|
@@ -832,7 +833,7 @@ class Workspace {
|
|
|
832
833
|
};
|
|
833
834
|
const currentVersion = getCurrentVersionAsTagIfPossible();
|
|
834
835
|
flattenedBitIdCompIdMap[component.id.changeVersion(currentVersion).toString()] = component.id;
|
|
835
|
-
|
|
836
|
+
flattenedDependencies.forEach(bitId => {
|
|
836
837
|
flattenedBitIdCompIdMap[bitId.toString()] = bitId;
|
|
837
838
|
});
|
|
838
839
|
const getCompIdByIdStr = idStr => {
|