@teambit/workspace 0.0.918 → 0.0.920

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.
@@ -0,0 +1,45 @@
1
+ import { Graph } from '@teambit/graph.cleargraph';
2
+ import { ComponentID } from '@teambit/component';
3
+ import { ComponentDependency, DependencyResolverMain } from '@teambit/dependency-resolver';
4
+ import { DepEdgeType } from '@teambit/graph';
5
+ import { Logger } from '@teambit/logger';
6
+ import { Workspace } from './workspace';
7
+ export declare function lifecycleToDepType(compDep: ComponentDependency): DepEdgeType;
8
+ export declare class GraphIdsFromFsBuilder {
9
+ private workspace;
10
+ private logger;
11
+ private dependencyResolver;
12
+ private shouldThrowOnMissingDep;
13
+ private graph;
14
+ private completed;
15
+ private depth;
16
+ private consumer;
17
+ private loadedComponents;
18
+ private importedIds;
19
+ constructor(workspace: Workspace, logger: Logger, dependencyResolver: DependencyResolverMain, shouldThrowOnMissingDep?: boolean);
20
+ /**
21
+ * create a graph with all dependencies and flattened dependencies of the given components.
22
+ * the nodes are component-ids and the edges has a label of the dependency type.
23
+ * to get some info about this the graph build take a look into build-graph-from-fs.buildGraph() docs.
24
+ */
25
+ buildGraph(ids: ComponentID[]): Promise<Graph<ComponentID, DepEdgeType>>;
26
+ private processManyComponents;
27
+ /**
28
+ * only for components from the workspace that can be modified to add/remove dependencies, we need to make sure that
29
+ * all their dependencies are imported.
30
+ * once a component from scope is imported, we know that either we have its dependency graph or all flattened deps
31
+ */
32
+ private importObjects;
33
+ private processOneComponent;
34
+ /**
35
+ * this is tricky.
36
+ * the component is in the workspace so it can be modified. dependencies can be added/removed/updated/downgraded.
37
+ * we have the graph-dependencies from the last snap, so we prefer to use it whenever possible for performance reasons.
38
+ * if we can't use it, we have to recursively load dependencies components and get the data from there.
39
+ * to maximize the performance, we iterate the direct dependencies, if we find a dep with the same id in the graph,
40
+ * then ask the graph for all its successors. otherwise, if it's not there, fallback to load the deps components.
41
+ */
42
+ private processCompFromWorkspaceWithGraph;
43
+ private addDepEdge;
44
+ private loadManyComponents;
45
+ }
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ require("core-js/modules/es.array.iterator.js");
5
+ require("core-js/modules/es.promise.js");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.GraphIdsFromFsBuilder = void 0;
10
+ exports.lifecycleToDepType = lifecycleToDepType;
11
+ function _defineProperty2() {
12
+ const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+ _defineProperty2 = function () {
14
+ return data;
15
+ };
16
+ return data;
17
+ }
18
+ function _pMapSeries() {
19
+ const data = _interopRequireDefault(require("p-map-series"));
20
+ _pMapSeries = function () {
21
+ return data;
22
+ };
23
+ return data;
24
+ }
25
+ function _graph() {
26
+ const data = require("@teambit/graph.cleargraph");
27
+ _graph = function () {
28
+ return data;
29
+ };
30
+ return data;
31
+ }
32
+ function _lodash() {
33
+ const data = require("lodash");
34
+ _lodash = function () {
35
+ return data;
36
+ };
37
+ return data;
38
+ }
39
+ function _bitIds() {
40
+ const data = _interopRequireDefault(require("@teambit/legacy/dist/bit-id/bit-ids"));
41
+ _bitIds = function () {
42
+ return data;
43
+ };
44
+ return data;
45
+ }
46
+ function _exceptions() {
47
+ const data = require("@teambit/legacy/dist/scope/exceptions");
48
+ _exceptions = function () {
49
+ return data;
50
+ };
51
+ return data;
52
+ }
53
+ function _scope() {
54
+ const data = require("@teambit/scope");
55
+ _scope = function () {
56
+ return data;
57
+ };
58
+ return data;
59
+ }
60
+ function _lodash2() {
61
+ const data = _interopRequireDefault(require("lodash.compact"));
62
+ _lodash2 = function () {
63
+ return data;
64
+ };
65
+ return data;
66
+ }
67
+ function _bitError() {
68
+ const data = require("@teambit/bit-error");
69
+ _bitError = function () {
70
+ return data;
71
+ };
72
+ return data;
73
+ }
74
+ function lifecycleToDepType(compDep) {
75
+ if (compDep.isExtension) return 'ext';
76
+ switch (compDep.lifecycle) {
77
+ case 'dev':
78
+ return 'dev';
79
+ case 'runtime':
80
+ return 'prod';
81
+ default:
82
+ throw new Error(`lifecycle ${compDep.lifecycle} is not support`);
83
+ }
84
+ }
85
+ class GraphIdsFromFsBuilder {
86
+ constructor(workspace, logger, dependencyResolver, shouldThrowOnMissingDep = true) {
87
+ this.workspace = workspace;
88
+ this.logger = logger;
89
+ this.dependencyResolver = dependencyResolver;
90
+ this.shouldThrowOnMissingDep = shouldThrowOnMissingDep;
91
+ (0, _defineProperty2().default)(this, "graph", new (_graph().Graph)());
92
+ (0, _defineProperty2().default)(this, "completed", []);
93
+ (0, _defineProperty2().default)(this, "depth", 1);
94
+ (0, _defineProperty2().default)(this, "consumer", void 0);
95
+ (0, _defineProperty2().default)(this, "loadedComponents", {});
96
+ (0, _defineProperty2().default)(this, "importedIds", []);
97
+ this.consumer = this.workspace.consumer;
98
+ }
99
+
100
+ /**
101
+ * create a graph with all dependencies and flattened dependencies of the given components.
102
+ * the nodes are component-ids and the edges has a label of the dependency type.
103
+ * to get some info about this the graph build take a look into build-graph-from-fs.buildGraph() docs.
104
+ */
105
+ async buildGraph(ids) {
106
+ this.logger.debug(`GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders`);
107
+ const start = Date.now();
108
+ const components = await this.loadManyComponents(ids);
109
+ await this.processManyComponents(components);
110
+ this.logger.debug(`GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`);
111
+ return this.graph;
112
+ }
113
+ async processManyComponents(components) {
114
+ this.logger.debug(`GraphIdsFromFsBuilder.processManyComponents depth ${this.depth}, ${components.length} components`);
115
+ this.depth += 1;
116
+ await this.importObjects(components);
117
+ const allDependencies = await (0, _pMapSeries().default)(components, component => this.processOneComponent(component));
118
+ const allDependenciesFlattened = (0, _lodash().flatten)(allDependencies);
119
+ if (allDependenciesFlattened.length) await this.processManyComponents(allDependenciesFlattened);
120
+ }
121
+
122
+ /**
123
+ * only for components from the workspace that can be modified to add/remove dependencies, we need to make sure that
124
+ * all their dependencies are imported.
125
+ * once a component from scope is imported, we know that either we have its dependency graph or all flattened deps
126
+ */
127
+ async importObjects(components) {
128
+ const workspaceIds = await this.workspace.listIds();
129
+ const compOnWorkspaceOnly = components.filter(comp => workspaceIds.find(id => id.isEqual(comp.id)));
130
+ const notImported = compOnWorkspaceOnly.map(c => c.id).filter(id => !this.importedIds.includes(id.toString()));
131
+ const withScope = notImported.map(id => id._legacy).filter(dep => dep.hasScope());
132
+ const scopeComponentsImporter = this.consumer.scope.scopeImporter;
133
+ await scopeComponentsImporter.importMany({
134
+ ids: _bitIds().default.uniqFromArray(withScope),
135
+ throwForDependencyNotFound: this.shouldThrowOnMissingDep,
136
+ throwForSeederNotFound: this.shouldThrowOnMissingDep,
137
+ reFetchUnBuiltVersion: false,
138
+ preferDependencyGraph: true
139
+ });
140
+ notImported.map(id => this.importedIds.push(id.toString()));
141
+ }
142
+ async processOneComponent(component) {
143
+ const idStr = component.id.toString();
144
+ if (this.completed.includes(idStr)) return [];
145
+ const graphFromScope = await this.workspace.getSavedGraphOfComponentIfExist(component);
146
+ if (graphFromScope !== null && graphFromScope !== void 0 && graphFromScope.edges.length) {
147
+ const isOnWorkspace = await this.workspace.hasId(component.id);
148
+ if (isOnWorkspace) {
149
+ const allDependenciesComps = await this.processCompFromWorkspaceWithGraph(graphFromScope, component);
150
+ this.completed.push(idStr);
151
+ return allDependenciesComps;
152
+ }
153
+ this.graph.merge([graphFromScope]);
154
+ this.completed.push(idStr);
155
+ return [];
156
+ }
157
+ const deps = await this.dependencyResolver.getComponentDependencies(component);
158
+ const allDepsIds = deps.map(d => d.componentId);
159
+ const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);
160
+ deps.forEach(dep => this.addDepEdge(idStr, dep));
161
+ this.completed.push(idStr);
162
+ return allDependenciesComps;
163
+ }
164
+
165
+ /**
166
+ * this is tricky.
167
+ * the component is in the workspace so it can be modified. dependencies can be added/removed/updated/downgraded.
168
+ * we have the graph-dependencies from the last snap, so we prefer to use it whenever possible for performance reasons.
169
+ * if we can't use it, we have to recursively load dependencies components and get the data from there.
170
+ * to maximize the performance, we iterate the direct dependencies, if we find a dep with the same id in the graph,
171
+ * then ask the graph for all its successors. otherwise, if it's not there, fallback to load the deps components.
172
+ */
173
+ async processCompFromWorkspaceWithGraph(graphFromScope, component) {
174
+ const deps = await this.dependencyResolver.getComponentDependencies(component);
175
+ const [depsInScopeGraph, depsNotInScopeGraph] = (0, _lodash().partition)(deps, dep => graphFromScope.hasNode(dep.componentId.toString()));
176
+ const subGraphs = depsInScopeGraph.map(dep => graphFromScope.successorsSubgraph([dep.componentId.toString()]));
177
+ this.graph.merge(subGraphs);
178
+ const allDepsIds = depsNotInScopeGraph.map(d => d.componentId);
179
+ const idStr = component.id.toString();
180
+ const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);
181
+ deps.forEach(dep => this.addDepEdge(idStr, dep));
182
+ return allDependenciesComps;
183
+ }
184
+ addDepEdge(idStr, dep) {
185
+ const depId = dep.componentId;
186
+ if (!this.graph.hasNode(depId.toString())) {
187
+ if (this.shouldThrowOnMissingDep) {
188
+ throw new Error(`buildOneComponent: missing node of ${depId.toString()}`);
189
+ }
190
+ this.logger.warn(`ignoring missing ${depId.toString()}`);
191
+ return;
192
+ }
193
+ this.graph.setEdge(new (_graph().Edge)(idStr, depId.toString(), lifecycleToDepType(dep)));
194
+ }
195
+ async loadManyComponents(componentsIds, dependenciesOf) {
196
+ const components = await (0, _pMapSeries().default)(componentsIds, async comp => {
197
+ const idStr = comp.toString();
198
+ const fromCache = this.loadedComponents[idStr];
199
+ if (fromCache) return fromCache;
200
+ try {
201
+ const component = await this.workspace.get(comp);
202
+ this.loadedComponents[idStr] = component;
203
+ this.graph.setNode(new (_graph().Node)(idStr, component.id));
204
+ return component;
205
+ } catch (err) {
206
+ if (err instanceof _exceptions().ComponentNotFound || err instanceof _scope().ComponentNotFound || err instanceof _exceptions().ScopeNotFound) {
207
+ if (dependenciesOf && !this.shouldThrowOnMissingDep) {
208
+ this.logger.warn(`component ${idStr}, dependency of ${dependenciesOf} was not found. continuing without it`);
209
+ return null;
210
+ }
211
+ throw new (_bitError().BitError)(`error: component "${idStr}" was not found.\nthis component is a dependency of "${dependenciesOf || '<none>'}" and is needed as part of the graph generation`);
212
+ }
213
+ if (dependenciesOf) this.logger.error(`failed loading dependencies of ${dependenciesOf}`);
214
+ throw err;
215
+ }
216
+ });
217
+ return (0, _lodash2().default)(components);
218
+ }
219
+ }
220
+ exports.GraphIdsFromFsBuilder = GraphIdsFromFsBuilder;
221
+
222
+ //# sourceMappingURL=build-graph-ids-from-fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["lifecycleToDepType","compDep","isExtension","lifecycle","Error","GraphIdsFromFsBuilder","constructor","workspace","logger","dependencyResolver","shouldThrowOnMissingDep","Graph","consumer","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","withScope","_legacy","dep","hasScope","scopeComponentsImporter","scope","scopeImporter","importMany","BitIds","uniqFromArray","throwForDependencyNotFound","throwForSeederNotFound","reFetchUnBuiltVersion","preferDependencyGraph","push","idStr","completed","graphFromScope","getSavedGraphOfComponentIfExist","edges","isOnWorkspace","hasId","allDependenciesComps","processCompFromWorkspaceWithGraph","merge","deps","getComponentDependencies","allDepsIds","d","componentId","forEach","addDepEdge","depsInScopeGraph","depsNotInScopeGraph","partition","hasNode","subGraphs","successorsSubgraph","depId","warn","setEdge","Edge","componentsIds","dependenciesOf","fromCache","loadedComponents","get","setNode","Node","err","ComponentNotFound","ComponentNotFoundInScope","ScopeNotFound","BitError","error","compact"],"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 { Consumer } from '@teambit/legacy/dist/consumer';\nimport { Component, ComponentID } from '@teambit/component';\nimport BitIds from '@teambit/legacy/dist/bit-id/bit-ids';\nimport { ComponentDependency, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { CompIdGraph, DepEdgeType } from '@teambit/graph';\nimport { ComponentNotFound, ScopeNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport { ComponentNotFound as ComponentNotFoundInScope } from '@teambit/scope';\nimport compact from 'lodash.compact';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { 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 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 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 }\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 = await 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 withScope = notImported.map((id) => id._legacy).filter((dep) => dep.hasScope());\n const scopeComponentsImporter = this.consumer.scope.scopeImporter;\n await scopeComponentsImporter.importMany({\n ids: BitIds.uniqFromArray(withScope),\n throwForDependencyNotFound: this.shouldThrowOnMissingDep,\n throwForSeederNotFound: this.shouldThrowOnMissingDep,\n reFetchUnBuiltVersion: false,\n preferDependencyGraph: true,\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 = await 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 * then ask the graph for all its successors. otherwise, if it's not there, fallback to load the deps components.\n */\n private async processCompFromWorkspaceWithGraph(\n graphFromScope: CompIdGraph,\n component: Component\n ): Promise<Component[]> {\n const deps = await this.dependencyResolver.getComponentDependencies(component);\n const [depsInScopeGraph, depsNotInScopeGraph] = partition(deps, (dep) =>\n graphFromScope.hasNode(dep.componentId.toString())\n );\n const subGraphs = depsInScopeGraph.map((dep) => graphFromScope.successorsSubgraph([dep.componentId.toString()]));\n this.graph.merge(subGraphs);\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 (comp) => {\n const idStr = comp.toString();\n const fromCache = this.loadedComponents[idStr];\n if (fromCache) return fromCache;\n try {\n const component = await this.workspace.get(comp);\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 ${idStr}, dependency of ${dependenciesOf} was not found. continuing without it`\n );\n return null;\n }\n throw new BitError(\n `error: component \"${idStr}\" 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 (dependenciesOf) this.logger.error(`failed loading dependencies of ${dependenciesOf}`);\n throw err;\n }\n });\n return compact(components);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,SAASA,kBAAkB,CAACC,OAA4B,EAAe;EAC5E,IAAIA,OAAO,CAACC,WAAW,EAAE,OAAO,KAAK;EACrC,QAAQD,OAAO,CAACE,SAAS;IACvB,KAAK,KAAK;MACR,OAAO,KAAK;IACd,KAAK,SAAS;MACZ,OAAO,MAAM;IACf;MACE,MAAM,IAAIC,KAAK,CAAE,aAAYH,OAAO,CAACE,SAAU,iBAAgB,CAAC;EAAC;AAEvE;AAEO,MAAME,qBAAqB,CAAC;EAOjCC,WAAW,CACDC,SAAoB,EACpBC,MAAc,EACdC,kBAA0C,EAC1CC,uBAAuB,GAAG,IAAI,EACtC;IAAA,KAJQH,SAAoB,GAApBA,SAAoB;IAAA,KACpBC,MAAc,GAAdA,MAAc;IAAA,KACdC,kBAA0C,GAA1CA,kBAA0C;IAAA,KAC1CC,uBAAuB,GAAvBA,uBAAuB;IAAA,+CAVjB,KAAIC,cA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,EAAE,IAAI,CAACjF,MAAM,CAAC4F,KAAK,CAAE,kCAAiCX,cAAe,EAAC,CAAC;QACzF,MAAMM,GAAG;MACX;IACF,CAAC,CAAC;IACF,OAAO,IAAAM,kBAAO,EAACjF,UAAU,CAAC;EAC5B;AACF;AAAC"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.918/dist/workspace.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.918/dist/workspace.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.920/dist/workspace.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.920/dist/workspace.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -309,7 +309,7 @@ class WorkspaceComponentLoader {
309
309
  const envsData = await this.workspace.getEnvSystemDescriptor(component);
310
310
 
311
311
  // Move to deps resolver main runtime once we switch ws<> deps resolver direction
312
- const policy = await this.dependencyResolver.mergeVariantPolicies(component.config.extensions, component.id._legacy);
312
+ const policy = await this.dependencyResolver.mergeVariantPolicies(component.config.extensions, component.id._legacy, component.state._consumer.files);
313
313
  const dependenciesList = await this.dependencyResolver.extractDepsFromLegacy(component, policy);
314
314
  let dependenciesFromUnmergedHead;
315
315
  // Get dependencies from unmerged head if needed
@@ -1 +1 @@
1
- {"version":3,"names":["WorkspaceComponentLoader","constructor","workspace","logger","dependencyResolver","envs","componentsCache","createInMemoryCache","maxSize","getMaxSizeForComponents","getMany","ids","loadOpts","idsWithoutEmpty","compact","errors","longProcessLogger","createLongProcessLogger","length","componentsP","mapSeries","id","logProgress","toString","get","undefined","catch","err","isComponentNotExistsError","push","components","forEach","console","warn","filteredComponents","end","getInvalid","consumer","loadComponent","_legacy","ConsumerComponent","isComponentInvalidByErrorType","componentId","legacyComponent","useCache","storeInCache","bitIdWithVersion","getLatestVersionNumber","bitmapIdsFromCurrentLane","version","changeVersion","fromCache","getFromCache","consumerComponent","getConsumerComponent","updatedId","ComponentID","fromLegacy","scope","component","loadOne","addMultipleEnvsIssueIfNeeded","saveInCache","getIfExist","getAllEnvsConfiguredOnComponent","envIds","uniq","map","env","state","issues","getOrCreate","IssuesClasses","MultipleEnvs","data","clearCache","deleteAll","clearComponentCache","idStr","cacheKey","keys","startsWith","delete","componentFromScope","MissingBitMapComponent","extensions","componentExtensions","extensionsFromConsumerComponent","ExtensionDataList","extensionDataList","mergeConfigs","filterRemovedExtensions","State","Config","mainFile","createAspectList","ComponentFS","fromVinyls","files","dependencies","workspaceComponent","WorkspaceComponent","head","tags","updatedComp","executeLoadSlot","newComponentFromState","createComponentCacheKey","set","isEqual","debug","name","message","ComponentNotFound","ComponentNotFoundInPath","_consumer","removed","envsData","getEnvSystemDescriptor","policy","mergeVariantPolicies","config","dependenciesList","extractDepsFromLegacy","dependenciesFromUnmergedHead","unmergedComponent","getUnmergedComponent","mergedDependencies","DependencyList","merge","depResolverData","serialize","Promise","all","upsertExtensionData","EnvsAspect","DependencyResolverAspect","aspectListWithEnvsAndDeps","aspects","entries","onComponentLoadSlot","toArray","promises","extension","onLoad","updatedAspectList","TagMap","existingExtension","findExtension","Object","assign","getDataEntry","ExtensionDataEntry","JSON","stringify","sortKeys","obj","fromPairs","sort","k1","k2","localeCompare"],"sources":["workspace-component-loader.ts"],"sourcesContent":["import { Component, ComponentFS, ComponentID, Config, InvalidComponent, State, TagMap } from '@teambit/component';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport mapSeries from 'p-map-series';\nimport { compact, fromPairs, uniq } from 'lodash';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { MissingBitMapComponent } from '@teambit/legacy/dist/consumer/bit-map/exceptions';\nimport { getLatestVersionNumber } from '@teambit/legacy/dist/utils';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { ComponentNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport { DependencyList, DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { Logger } from '@teambit/logger';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config';\nimport { getMaxSizeForComponents, InMemoryCache } from '@teambit/legacy/dist/cache/in-memory-cache';\nimport { createInMemoryCache } from '@teambit/legacy/dist/cache/cache-factory';\nimport ComponentNotFoundInPath from '@teambit/legacy/dist/consumer/component/exceptions/component-not-found-in-path';\nimport { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';\nimport { Workspace } from '../workspace';\nimport { WorkspaceComponent } from './workspace-component';\n\nexport class WorkspaceComponentLoader {\n private componentsCache: InMemoryCache<Component>; // cache loaded components\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private envs: EnvsMain\n ) {\n this.componentsCache = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n }\n\n async getMany(ids: Array<ComponentID>, loadOpts?: ComponentLoadOptions): Promise<Component[]> {\n const idsWithoutEmpty = compact(ids);\n const errors: { id: ComponentID; err: Error }[] = [];\n const longProcessLogger = this.logger.createLongProcessLogger('loading components', ids.length);\n const componentsP = mapSeries(idsWithoutEmpty, async (id: ComponentID) => {\n longProcessLogger.logProgress(id.toString());\n return this.get(id, undefined, undefined, undefined, loadOpts).catch((err) => {\n if (this.isComponentNotExistsError(err)) {\n errors.push({\n id,\n err,\n });\n return undefined;\n }\n throw err;\n });\n });\n const components = await componentsP;\n errors.forEach((err) => {\n this.logger.console(`failed loading component ${err.id.toString()}, see full error in debug.log file`);\n this.logger.warn(`failed loading component ${err.id.toString()}`, err.err);\n });\n // remove errored components\n const filteredComponents: Component[] = compact(components);\n longProcessLogger.end();\n return filteredComponents;\n }\n\n async getInvalid(ids: Array<ComponentID>): Promise<InvalidComponent[]> {\n const idsWithoutEmpty = compact(ids);\n const errors: InvalidComponent[] = [];\n const longProcessLogger = this.logger.createLongProcessLogger('loading components', ids.length);\n await mapSeries(idsWithoutEmpty, async (id: ComponentID) => {\n longProcessLogger.logProgress(id.toString());\n try {\n await this.workspace.consumer.loadComponent(id._legacy);\n } catch (err: any) {\n if (ConsumerComponent.isComponentInvalidByErrorType(err)) {\n errors.push({\n id,\n err,\n });\n return;\n }\n throw err;\n }\n });\n return errors;\n }\n\n async get(\n componentId: ComponentID,\n legacyComponent?: ConsumerComponent,\n useCache = true,\n storeInCache = true,\n loadOpts?: ComponentLoadOptions\n ): Promise<Component> {\n const bitIdWithVersion: BitId = getLatestVersionNumber(\n this.workspace.consumer.bitmapIdsFromCurrentLane,\n componentId._legacy\n );\n const id = bitIdWithVersion.version ? componentId.changeVersion(bitIdWithVersion.version) : componentId;\n const fromCache = this.getFromCache(id, loadOpts);\n if (fromCache && useCache) {\n return fromCache;\n }\n const consumerComponent = legacyComponent || (await this.getConsumerComponent(id));\n // in case of out-of-sync, the id may changed during the load process\n const updatedId = consumerComponent ? ComponentID.fromLegacy(consumerComponent.id, id.scope) : id;\n const component = await this.loadOne(updatedId, consumerComponent, loadOpts);\n if (storeInCache) {\n this.addMultipleEnvsIssueIfNeeded(component); // it's in storeInCache block, otherwise, it wasn't fully loaded\n this.saveInCache(component, loadOpts);\n }\n return component;\n }\n\n async getIfExist(componentId: ComponentID) {\n try {\n return await this.get(componentId);\n } catch (err: any) {\n if (this.isComponentNotExistsError(err)) {\n return undefined;\n }\n throw err;\n }\n }\n\n private addMultipleEnvsIssueIfNeeded(component: Component) {\n const envs = this.envs.getAllEnvsConfiguredOnComponent(component);\n const envIds = uniq(envs.map((env) => env.id));\n if (envIds.length < 2) {\n return;\n }\n component.state.issues.getOrCreate(IssuesClasses.MultipleEnvs).data = envIds;\n }\n\n clearCache() {\n this.componentsCache.deleteAll();\n }\n clearComponentCache(id: ComponentID) {\n const idStr = id.toString();\n for (const cacheKey of this.componentsCache.keys()) {\n if (cacheKey === idStr || cacheKey.startsWith(`${idStr}:`)) {\n this.componentsCache.delete(cacheKey);\n }\n }\n }\n\n private async loadOne(id: ComponentID, consumerComponent?: ConsumerComponent, loadOpts?: ComponentLoadOptions) {\n const componentFromScope = await this.workspace.scope.get(id);\n if (!consumerComponent) {\n if (!componentFromScope) throw new MissingBitMapComponent(id.toString());\n return componentFromScope;\n }\n const { extensions } = await this.workspace.componentExtensions(id, componentFromScope);\n const extensionsFromConsumerComponent = consumerComponent.extensions || new ExtensionDataList();\n // Merge extensions added by the legacy code in memory (for example data of dependency resolver)\n const extensionDataList = ExtensionDataList.mergeConfigs([\n extensionsFromConsumerComponent,\n extensions,\n ]).filterRemovedExtensions();\n\n // temporarily mutate consumer component extensions until we remove all direct access from legacy to extensions data\n // TODO: remove this once we remove all direct access from legacy code to extensions data\n consumerComponent.extensions = extensionDataList;\n\n const state = new State(\n new Config(consumerComponent.mainFile, extensionDataList),\n await this.workspace.createAspectList(extensionDataList),\n ComponentFS.fromVinyls(consumerComponent.files),\n consumerComponent.dependencies,\n consumerComponent\n );\n if (componentFromScope) {\n // Removed by @gilad. do not mutate the component from the scope\n // componentFromScope.state = state;\n // const workspaceComponent = WorkspaceComponent.fromComponent(componentFromScope, this.workspace);\n const workspaceComponent = new WorkspaceComponent(\n componentFromScope.id,\n componentFromScope.head,\n state,\n componentFromScope.tags,\n this.workspace\n );\n const updatedComp = await this.executeLoadSlot(workspaceComponent, loadOpts);\n return updatedComp;\n }\n return this.executeLoadSlot(this.newComponentFromState(id, state), loadOpts);\n }\n\n private saveInCache(component: Component, loadOpts?: ComponentLoadOptions): void {\n const cacheKey = createComponentCacheKey(component.id, loadOpts);\n this.componentsCache.set(cacheKey, component);\n }\n\n /**\n * make sure that not only the id-str match, but also the legacy-id.\n * this is needed because the ComponentID.toString() is the same whether or not the legacy-id has\n * scope-name, as it includes the defaultScope if the scope is empty.\n * as a result, when out-of-sync is happening and the id is changed to include scope-name in the\n * legacy-id, the component is the cache has the old id.\n */\n private getFromCache(id: ComponentID, loadOpts?: ComponentLoadOptions): Component | undefined {\n const cacheKey = createComponentCacheKey(id, loadOpts);\n const fromCache = this.componentsCache.get(cacheKey);\n if (fromCache && fromCache.id._legacy.isEqual(id._legacy)) {\n return fromCache;\n }\n return undefined;\n }\n\n private async getConsumerComponent(id: ComponentID): Promise<ConsumerComponent | undefined> {\n try {\n return await this.workspace.consumer.loadComponent(id._legacy);\n } catch (err: any) {\n // don't return undefined for any error. otherwise, if the component is invalid (e.g. main\n // file is missing) it returns the model component later unexpectedly, or if it's new, it\n // shows MissingBitMapComponent error incorrectly.\n if (this.isComponentNotExistsError(err)) {\n this.logger.debug(\n `failed loading component \"${id.toString()}\" from the workspace due to \"${err.name}\" error\\n${err.message}`\n );\n return undefined;\n }\n throw err;\n }\n }\n\n private isComponentNotExistsError(err: Error): boolean {\n return (\n err instanceof ComponentNotFound ||\n err instanceof MissingBitMapComponent ||\n err instanceof ComponentNotFoundInPath\n );\n }\n\n private async executeLoadSlot(component: Component, loadOpts?: ComponentLoadOptions) {\n if (component.state._consumer.removed) {\n // if it was soft-removed now, the component is not in the FS. loading aspects such as composition ends up with\n // errors as they try to read component files from the filesystem.\n return component;\n }\n\n // Special load events which runs from the workspace but should run from the correct aspect\n // TODO: remove this once those extensions dependent on workspace\n const envsData = await this.workspace.getEnvSystemDescriptor(component);\n\n // Move to deps resolver main runtime once we switch ws<> deps resolver direction\n const policy = await this.dependencyResolver.mergeVariantPolicies(\n component.config.extensions,\n component.id._legacy\n );\n const dependenciesList = await this.dependencyResolver.extractDepsFromLegacy(component, policy);\n let dependenciesFromUnmergedHead;\n // Get dependencies from unmerged head if needed\n // we take it from there, as they might not be installed yet and we need to get their versions from the model\n const unmergedComponent = await this.workspace.getUnmergedComponent(component.id);\n if (unmergedComponent) {\n dependenciesFromUnmergedHead = await this.dependencyResolver.extractDepsFromLegacy(unmergedComponent, policy);\n }\n const mergedDependencies = dependenciesFromUnmergedHead\n ? DependencyList.merge([dependenciesList, dependenciesFromUnmergedHead])\n : dependenciesList;\n\n const depResolverData = {\n dependencies: mergedDependencies.serialize(),\n policy: policy.serialize(),\n };\n\n // Make sure we are adding the envs / deps data first because other on load events might depend on it\n await Promise.all([\n this.upsertExtensionData(component, EnvsAspect.id, envsData),\n this.upsertExtensionData(component, DependencyResolverAspect.id, depResolverData),\n ]);\n\n // We are updating the component state with the envs and deps data here, so in case we have other slots that depend on this data\n // they will be able to get it, as it's very common use case that during on load someone want to access to the component env for example\n const aspectListWithEnvsAndDeps = await this.workspace.createAspectList(component.state.config.extensions);\n component.state.aspects = aspectListWithEnvsAndDeps;\n\n const entries = this.workspace.onComponentLoadSlot.toArray();\n const promises = entries.map(async ([extension, onLoad]) => {\n const data = await onLoad(component, loadOpts);\n return this.upsertExtensionData(component, extension, data);\n });\n\n await Promise.all(promises);\n\n // Update the aspect list to have changes happened during the on load slot (new data added above)\n const updatedAspectList = await this.workspace.createAspectList(component.state.config.extensions);\n component.state.aspects = updatedAspectList;\n return component;\n }\n\n private newComponentFromState(id: ComponentID, state: State): Component {\n return new WorkspaceComponent(id, null, state, new TagMap(), this.workspace);\n }\n\n private async upsertExtensionData(component: Component, extension: string, data: any) {\n if (!data) return;\n const existingExtension = component.state.config.extensions.findExtension(extension);\n if (existingExtension) {\n // Only merge top level of extension data\n Object.assign(existingExtension.data, data);\n return;\n }\n component.state.config.extensions.push(await this.getDataEntry(extension, data));\n }\n\n private async getDataEntry(extension: string, data: { [key: string]: any }): Promise<ExtensionDataEntry> {\n // TODO: @gilad we need to refactor the extension data entry api.\n return new ExtensionDataEntry(undefined, undefined, extension, undefined, data);\n }\n}\n\nfunction createComponentCacheKey(id: ComponentID, loadOpts?: ComponentLoadOptions): string {\n return `${id.toString()}:${JSON.stringify(sortKeys(loadOpts ?? {}))}`;\n}\n\nfunction sortKeys(obj: Object) {\n return fromPairs(Object.entries(obj).sort(([k1], [k2]) => k1.localeCompare(k2)));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,wBAAwB,CAAC;EACe;EACnDC,WAAW,CACDC,SAAoB,EACpBC,MAAc,EACdC,kBAA0C,EAC1CC,IAAc,EACtB;IAAA,KAJQH,SAAoB,GAApBA,SAAoB;IAAA,KACpBC,MAAc,GAAdA,MAAc;IAAA,KACdC,kBAA0C,GAA1CA,kBAA0C;IAAA,KAC1CC,IAAc,GAAdA,IAAc;IAAA;IAEtB,IAAI,CAACC,eAAe,GAAG,IAAAC,mCAAmB,EAAC;MAAEC,OAAO,EAAE,IAAAC,wCAAuB;IAAG,CAAC,CAAC;EACpF;EAEA,MAAM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EAAC;AACvE;AAEA,SAAS+I,QAAQ,CAACC,GAAW,EAAE;EAC7B,OAAO,IAAAC,mBAAS,EAACR,MAAM,CAACV,OAAO,CAACiB,GAAG,CAAC,CAACE,IAAI,CAAC,CAAC,CAACC,EAAE,CAAC,EAAE,CAACC,EAAE,CAAC,KAAKD,EAAE,CAACE,aAAa,CAACD,EAAE,CAAC,CAAC,CAAC;AAClF"}
1
+ {"version":3,"names":["WorkspaceComponentLoader","constructor","workspace","logger","dependencyResolver","envs","componentsCache","createInMemoryCache","maxSize","getMaxSizeForComponents","getMany","ids","loadOpts","idsWithoutEmpty","compact","errors","longProcessLogger","createLongProcessLogger","length","componentsP","mapSeries","id","logProgress","toString","get","undefined","catch","err","isComponentNotExistsError","push","components","forEach","console","warn","filteredComponents","end","getInvalid","consumer","loadComponent","_legacy","ConsumerComponent","isComponentInvalidByErrorType","componentId","legacyComponent","useCache","storeInCache","bitIdWithVersion","getLatestVersionNumber","bitmapIdsFromCurrentLane","version","changeVersion","fromCache","getFromCache","consumerComponent","getConsumerComponent","updatedId","ComponentID","fromLegacy","scope","component","loadOne","addMultipleEnvsIssueIfNeeded","saveInCache","getIfExist","getAllEnvsConfiguredOnComponent","envIds","uniq","map","env","state","issues","getOrCreate","IssuesClasses","MultipleEnvs","data","clearCache","deleteAll","clearComponentCache","idStr","cacheKey","keys","startsWith","delete","componentFromScope","MissingBitMapComponent","extensions","componentExtensions","extensionsFromConsumerComponent","ExtensionDataList","extensionDataList","mergeConfigs","filterRemovedExtensions","State","Config","mainFile","createAspectList","ComponentFS","fromVinyls","files","dependencies","workspaceComponent","WorkspaceComponent","head","tags","updatedComp","executeLoadSlot","newComponentFromState","createComponentCacheKey","set","isEqual","debug","name","message","ComponentNotFound","ComponentNotFoundInPath","_consumer","removed","envsData","getEnvSystemDescriptor","policy","mergeVariantPolicies","config","dependenciesList","extractDepsFromLegacy","dependenciesFromUnmergedHead","unmergedComponent","getUnmergedComponent","mergedDependencies","DependencyList","merge","depResolverData","serialize","Promise","all","upsertExtensionData","EnvsAspect","DependencyResolverAspect","aspectListWithEnvsAndDeps","aspects","entries","onComponentLoadSlot","toArray","promises","extension","onLoad","updatedAspectList","TagMap","existingExtension","findExtension","Object","assign","getDataEntry","ExtensionDataEntry","JSON","stringify","sortKeys","obj","fromPairs","sort","k1","k2","localeCompare"],"sources":["workspace-component-loader.ts"],"sourcesContent":["import { Component, ComponentFS, ComponentID, Config, InvalidComponent, State, TagMap } from '@teambit/component';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport mapSeries from 'p-map-series';\nimport { compact, fromPairs, uniq } from 'lodash';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { MissingBitMapComponent } from '@teambit/legacy/dist/consumer/bit-map/exceptions';\nimport { getLatestVersionNumber } from '@teambit/legacy/dist/utils';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { ComponentNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport { DependencyList, DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { Logger } from '@teambit/logger';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config';\nimport { getMaxSizeForComponents, InMemoryCache } from '@teambit/legacy/dist/cache/in-memory-cache';\nimport { createInMemoryCache } from '@teambit/legacy/dist/cache/cache-factory';\nimport ComponentNotFoundInPath from '@teambit/legacy/dist/consumer/component/exceptions/component-not-found-in-path';\nimport { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';\nimport { Workspace } from '../workspace';\nimport { WorkspaceComponent } from './workspace-component';\n\nexport class WorkspaceComponentLoader {\n private componentsCache: InMemoryCache<Component>; // cache loaded components\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private envs: EnvsMain\n ) {\n this.componentsCache = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n }\n\n async getMany(ids: Array<ComponentID>, loadOpts?: ComponentLoadOptions): Promise<Component[]> {\n const idsWithoutEmpty = compact(ids);\n const errors: { id: ComponentID; err: Error }[] = [];\n const longProcessLogger = this.logger.createLongProcessLogger('loading components', ids.length);\n const componentsP = mapSeries(idsWithoutEmpty, async (id: ComponentID) => {\n longProcessLogger.logProgress(id.toString());\n return this.get(id, undefined, undefined, undefined, loadOpts).catch((err) => {\n if (this.isComponentNotExistsError(err)) {\n errors.push({\n id,\n err,\n });\n return undefined;\n }\n throw err;\n });\n });\n const components = await componentsP;\n errors.forEach((err) => {\n this.logger.console(`failed loading component ${err.id.toString()}, see full error in debug.log file`);\n this.logger.warn(`failed loading component ${err.id.toString()}`, err.err);\n });\n // remove errored components\n const filteredComponents: Component[] = compact(components);\n longProcessLogger.end();\n return filteredComponents;\n }\n\n async getInvalid(ids: Array<ComponentID>): Promise<InvalidComponent[]> {\n const idsWithoutEmpty = compact(ids);\n const errors: InvalidComponent[] = [];\n const longProcessLogger = this.logger.createLongProcessLogger('loading components', ids.length);\n await mapSeries(idsWithoutEmpty, async (id: ComponentID) => {\n longProcessLogger.logProgress(id.toString());\n try {\n await this.workspace.consumer.loadComponent(id._legacy);\n } catch (err: any) {\n if (ConsumerComponent.isComponentInvalidByErrorType(err)) {\n errors.push({\n id,\n err,\n });\n return;\n }\n throw err;\n }\n });\n return errors;\n }\n\n async get(\n componentId: ComponentID,\n legacyComponent?: ConsumerComponent,\n useCache = true,\n storeInCache = true,\n loadOpts?: ComponentLoadOptions\n ): Promise<Component> {\n const bitIdWithVersion: BitId = getLatestVersionNumber(\n this.workspace.consumer.bitmapIdsFromCurrentLane,\n componentId._legacy\n );\n const id = bitIdWithVersion.version ? componentId.changeVersion(bitIdWithVersion.version) : componentId;\n const fromCache = this.getFromCache(id, loadOpts);\n if (fromCache && useCache) {\n return fromCache;\n }\n const consumerComponent = legacyComponent || (await this.getConsumerComponent(id));\n // in case of out-of-sync, the id may changed during the load process\n const updatedId = consumerComponent ? ComponentID.fromLegacy(consumerComponent.id, id.scope) : id;\n const component = await this.loadOne(updatedId, consumerComponent, loadOpts);\n if (storeInCache) {\n this.addMultipleEnvsIssueIfNeeded(component); // it's in storeInCache block, otherwise, it wasn't fully loaded\n this.saveInCache(component, loadOpts);\n }\n return component;\n }\n\n async getIfExist(componentId: ComponentID) {\n try {\n return await this.get(componentId);\n } catch (err: any) {\n if (this.isComponentNotExistsError(err)) {\n return undefined;\n }\n throw err;\n }\n }\n\n private addMultipleEnvsIssueIfNeeded(component: Component) {\n const envs = this.envs.getAllEnvsConfiguredOnComponent(component);\n const envIds = uniq(envs.map((env) => env.id));\n if (envIds.length < 2) {\n return;\n }\n component.state.issues.getOrCreate(IssuesClasses.MultipleEnvs).data = envIds;\n }\n\n clearCache() {\n this.componentsCache.deleteAll();\n }\n clearComponentCache(id: ComponentID) {\n const idStr = id.toString();\n for (const cacheKey of this.componentsCache.keys()) {\n if (cacheKey === idStr || cacheKey.startsWith(`${idStr}:`)) {\n this.componentsCache.delete(cacheKey);\n }\n }\n }\n\n private async loadOne(id: ComponentID, consumerComponent?: ConsumerComponent, loadOpts?: ComponentLoadOptions) {\n const componentFromScope = await this.workspace.scope.get(id);\n if (!consumerComponent) {\n if (!componentFromScope) throw new MissingBitMapComponent(id.toString());\n return componentFromScope;\n }\n const { extensions } = await this.workspace.componentExtensions(id, componentFromScope);\n const extensionsFromConsumerComponent = consumerComponent.extensions || new ExtensionDataList();\n // Merge extensions added by the legacy code in memory (for example data of dependency resolver)\n const extensionDataList = ExtensionDataList.mergeConfigs([\n extensionsFromConsumerComponent,\n extensions,\n ]).filterRemovedExtensions();\n\n // temporarily mutate consumer component extensions until we remove all direct access from legacy to extensions data\n // TODO: remove this once we remove all direct access from legacy code to extensions data\n consumerComponent.extensions = extensionDataList;\n\n const state = new State(\n new Config(consumerComponent.mainFile, extensionDataList),\n await this.workspace.createAspectList(extensionDataList),\n ComponentFS.fromVinyls(consumerComponent.files),\n consumerComponent.dependencies,\n consumerComponent\n );\n if (componentFromScope) {\n // Removed by @gilad. do not mutate the component from the scope\n // componentFromScope.state = state;\n // const workspaceComponent = WorkspaceComponent.fromComponent(componentFromScope, this.workspace);\n const workspaceComponent = new WorkspaceComponent(\n componentFromScope.id,\n componentFromScope.head,\n state,\n componentFromScope.tags,\n this.workspace\n );\n const updatedComp = await this.executeLoadSlot(workspaceComponent, loadOpts);\n return updatedComp;\n }\n return this.executeLoadSlot(this.newComponentFromState(id, state), loadOpts);\n }\n\n private saveInCache(component: Component, loadOpts?: ComponentLoadOptions): void {\n const cacheKey = createComponentCacheKey(component.id, loadOpts);\n this.componentsCache.set(cacheKey, component);\n }\n\n /**\n * make sure that not only the id-str match, but also the legacy-id.\n * this is needed because the ComponentID.toString() is the same whether or not the legacy-id has\n * scope-name, as it includes the defaultScope if the scope is empty.\n * as a result, when out-of-sync is happening and the id is changed to include scope-name in the\n * legacy-id, the component is the cache has the old id.\n */\n private getFromCache(id: ComponentID, loadOpts?: ComponentLoadOptions): Component | undefined {\n const cacheKey = createComponentCacheKey(id, loadOpts);\n const fromCache = this.componentsCache.get(cacheKey);\n if (fromCache && fromCache.id._legacy.isEqual(id._legacy)) {\n return fromCache;\n }\n return undefined;\n }\n\n private async getConsumerComponent(id: ComponentID): Promise<ConsumerComponent | undefined> {\n try {\n return await this.workspace.consumer.loadComponent(id._legacy);\n } catch (err: any) {\n // don't return undefined for any error. otherwise, if the component is invalid (e.g. main\n // file is missing) it returns the model component later unexpectedly, or if it's new, it\n // shows MissingBitMapComponent error incorrectly.\n if (this.isComponentNotExistsError(err)) {\n this.logger.debug(\n `failed loading component \"${id.toString()}\" from the workspace due to \"${err.name}\" error\\n${err.message}`\n );\n return undefined;\n }\n throw err;\n }\n }\n\n private isComponentNotExistsError(err: Error): boolean {\n return (\n err instanceof ComponentNotFound ||\n err instanceof MissingBitMapComponent ||\n err instanceof ComponentNotFoundInPath\n );\n }\n\n private async executeLoadSlot(component: Component, loadOpts?: ComponentLoadOptions) {\n if (component.state._consumer.removed) {\n // if it was soft-removed now, the component is not in the FS. loading aspects such as composition ends up with\n // errors as they try to read component files from the filesystem.\n return component;\n }\n\n // Special load events which runs from the workspace but should run from the correct aspect\n // TODO: remove this once those extensions dependent on workspace\n const envsData = await this.workspace.getEnvSystemDescriptor(component);\n\n // Move to deps resolver main runtime once we switch ws<> deps resolver direction\n const policy = await this.dependencyResolver.mergeVariantPolicies(\n component.config.extensions,\n component.id._legacy,\n component.state._consumer.files\n );\n const dependenciesList = await this.dependencyResolver.extractDepsFromLegacy(component, policy);\n let dependenciesFromUnmergedHead;\n // Get dependencies from unmerged head if needed\n // we take it from there, as they might not be installed yet and we need to get their versions from the model\n const unmergedComponent = await this.workspace.getUnmergedComponent(component.id);\n if (unmergedComponent) {\n dependenciesFromUnmergedHead = await this.dependencyResolver.extractDepsFromLegacy(unmergedComponent, policy);\n }\n const mergedDependencies = dependenciesFromUnmergedHead\n ? DependencyList.merge([dependenciesList, dependenciesFromUnmergedHead])\n : dependenciesList;\n\n const depResolverData = {\n dependencies: mergedDependencies.serialize(),\n policy: policy.serialize(),\n };\n\n // Make sure we are adding the envs / deps data first because other on load events might depend on it\n await Promise.all([\n this.upsertExtensionData(component, EnvsAspect.id, envsData),\n this.upsertExtensionData(component, DependencyResolverAspect.id, depResolverData),\n ]);\n\n // We are updating the component state with the envs and deps data here, so in case we have other slots that depend on this data\n // they will be able to get it, as it's very common use case that during on load someone want to access to the component env for example\n const aspectListWithEnvsAndDeps = await this.workspace.createAspectList(component.state.config.extensions);\n component.state.aspects = aspectListWithEnvsAndDeps;\n\n const entries = this.workspace.onComponentLoadSlot.toArray();\n const promises = entries.map(async ([extension, onLoad]) => {\n const data = await onLoad(component, loadOpts);\n return this.upsertExtensionData(component, extension, data);\n });\n\n await Promise.all(promises);\n\n // Update the aspect list to have changes happened during the on load slot (new data added above)\n const updatedAspectList = await this.workspace.createAspectList(component.state.config.extensions);\n component.state.aspects = updatedAspectList;\n return component;\n }\n\n private newComponentFromState(id: ComponentID, state: State): Component {\n return new WorkspaceComponent(id, null, state, new TagMap(), this.workspace);\n }\n\n private async upsertExtensionData(component: Component, extension: string, data: any) {\n if (!data) return;\n const existingExtension = component.state.config.extensions.findExtension(extension);\n if (existingExtension) {\n // Only merge top level of extension data\n Object.assign(existingExtension.data, data);\n return;\n }\n component.state.config.extensions.push(await this.getDataEntry(extension, data));\n }\n\n private async getDataEntry(extension: string, data: { [key: string]: any }): Promise<ExtensionDataEntry> {\n // TODO: @gilad we need to refactor the extension data entry api.\n return new ExtensionDataEntry(undefined, undefined, extension, undefined, data);\n }\n}\n\nfunction createComponentCacheKey(id: ComponentID, loadOpts?: ComponentLoadOptions): string {\n return `${id.toString()}:${JSON.stringify(sortKeys(loadOpts ?? {}))}`;\n}\n\nfunction sortKeys(obj: Object) {\n return fromPairs(Object.entries(obj).sort(([k1], [k2]) => k1.localeCompare(k2)));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA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AC,MAAM,IAAI,CAAC0H,YAAY,CAACR,SAAS,EAAErE,IAAI,CAAC,CAAC;EAClF;EAEA,MAAc6E,YAAY,CAACR,SAAiB,EAAErE,IAA4B,EAA+B;IACvG;IACA,OAAO,KAAI8E,4BAAkB,EAAC/H,SAAS,EAAEA,SAAS,EAAEsH,SAAS,EAAEtH,SAAS,EAAEiD,IAAI,CAAC;EACjF;AACF;AAAC;AAED,SAASiC,uBAAuB,CAACtF,EAAe,EAAET,QAA+B,EAAU;EACzF,OAAQ,GAAES,EAAE,CAACE,QAAQ,EAAG,IAAGkI,IAAI,CAACC,SAAS,CAACC,QAAQ,CAAC/I,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAI,CAAC,CAAC,CAAC,CAAE,EAAC;AACvE;AAEA,SAAS+I,QAAQ,CAACC,GAAW,EAAE;EAC7B,OAAO,IAAAC,mBAAS,EAACR,MAAM,CAACV,OAAO,CAACiB,GAAG,CAAC,CAACE,IAAI,CAAC,CAAC,CAACC,EAAE,CAAC,EAAE,CAACC,EAAE,CAAC,KAAKD,EAAE,CAACE,aAAa,CAACD,EAAE,CAAC,CAAC,CAAC;AAClF"}
@@ -20,6 +20,7 @@ import type { AddActionResults, Warnings } from '@teambit/legacy/dist/consumer/c
20
20
  import ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';
21
21
  import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';
22
22
  import { PathOsBased, PathOsBasedRelative, PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';
23
+ import { CompIdGraph, DepEdgeType } from '@teambit/graph';
23
24
  import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
24
25
  import type { ComponentLog } from '@teambit/legacy/dist/scope/models/model-component';
25
26
  import { CompilationInitiator } from '@teambit/compiler';
@@ -228,6 +229,8 @@ export declare class Workspace implements ComponentFactory {
228
229
  newAndModified(): Promise<Component[]>;
229
230
  getLogs(id: ComponentID, shortHash?: boolean, startsFrom?: string): Promise<ComponentLog[]>;
230
231
  getGraph(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean): Promise<Graph<Component, string>>;
232
+ getGraphIds(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean): Promise<CompIdGraph>;
233
+ getSavedGraphOfComponentIfExist(component: Component): Promise<Graph<ComponentID, DepEdgeType> | null>;
231
234
  /**
232
235
  * given component ids, find their dependents in the workspace
233
236
  */
@@ -413,7 +416,6 @@ export declare class Workspace implements ComponentFactory {
413
416
  */
414
417
  loadAspects(ids?: string[], throwOnError?: boolean, neededFor?: string): Promise<string[]>;
415
418
  /**
416
- * Note - this gets called from Harmony only.
417
419
  * returns one graph that includes all dependencies types. each edge has a label of the dependency
418
420
  * type. the nodes content is the Component object.
419
421
  */
package/dist/workspace.js CHANGED
@@ -32,6 +32,13 @@ function _pMapSeries() {
32
32
  };
33
33
  return data;
34
34
  }
35
+ function _graph() {
36
+ const data = require("@teambit/graph.cleargraph");
37
+ _graph = function () {
38
+ return data;
39
+ };
40
+ return data;
41
+ }
35
42
  function _aspectLoader() {
36
43
  const data = require("@teambit/aspect-loader");
37
44
  _aspectLoader = function () {
@@ -298,6 +305,13 @@ function _workspace() {
298
305
  };
299
306
  return data;
300
307
  }
308
+ function _buildGraphIdsFromFs() {
309
+ const data = require("./build-graph-ids-from-fs");
310
+ _buildGraphIdsFromFs = function () {
311
+ return data;
312
+ };
313
+ return data;
314
+ }
301
315
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
302
316
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
303
317
  const AspectSpecificField = '__specific';
@@ -586,6 +600,44 @@ class Workspace {
586
600
  if (!ids || ids.length < 1) ids = await this.listIds();
587
601
  return this.buildOneGraphForComponents(ids, undefined, undefined, shouldThrowOnMissingDep);
588
602
  }
603
+ async getGraphIds(ids, shouldThrowOnMissingDep = true) {
604
+ if (!ids || ids.length < 1) ids = await this.listIds();
605
+ const graphIdsFromFsBuilder = new (_buildGraphIdsFromFs().GraphIdsFromFsBuilder)(this, this.logger, this.dependencyResolver, shouldThrowOnMissingDep);
606
+ return graphIdsFromFsBuilder.buildGraph(ids);
607
+ }
608
+ async getSavedGraphOfComponentIfExist(component) {
609
+ let versionObj;
610
+ try {
611
+ versionObj = await this.scope.legacyScope.getVersionInstance(component.id._legacy);
612
+ } catch (err) {
613
+ return null;
614
+ }
615
+ const flattenedEdges = versionObj.flattenedEdges;
616
+ if (!flattenedEdges.length && versionObj.flattenedDependencies.length) {
617
+ // there are flattenedDependencies, so must be edges, if they're empty, it's because the component was tagged
618
+ // with a version < ~0.0.901, so this flattenedEdges wasn't exist.
619
+ return null;
620
+ }
621
+ const flattenedBitIdCompIdMap = {};
622
+ flattenedBitIdCompIdMap[component.id._legacy.toString()] = component.id;
623
+ await Promise.all(versionObj.flattenedDependencies.map(async bitId => {
624
+ flattenedBitIdCompIdMap[bitId.toString()] = await this.resolveComponentId(bitId);
625
+ }));
626
+ const getCompIdByIdStr = idStr => {
627
+ const compId = flattenedBitIdCompIdMap[idStr];
628
+ if (!compId) throw new Error(`id ${idStr} exists in flattenedEdges but not in flattened`);
629
+ return compId;
630
+ };
631
+ const nodes = Object.values(flattenedBitIdCompIdMap);
632
+ const edges = flattenedEdges.map(edge => _objectSpread(_objectSpread({}, edge), {}, {
633
+ source: getCompIdByIdStr(edge.source.toString()),
634
+ target: getCompIdByIdStr(edge.target.toString())
635
+ }));
636
+ const graph = new (_graph().Graph)();
637
+ nodes.forEach(node => graph.setNode(new (_graph().Node)(node.toString(), node)));
638
+ edges.forEach(edge => graph.setEdge(new (_graph().Edge)(edge.source.toString(), edge.target.toString(), edge.type)));
639
+ return graph;
640
+ }
589
641
 
590
642
  /**
591
643
  * given component ids, find their dependents in the workspace
@@ -649,12 +701,12 @@ class Workspace {
649
701
  async getEnvSystemDescriptor(component) {
650
702
  const env = this.envs.calculateEnv(component);
651
703
  if (env.env.__getDescriptor && typeof env.env.__getDescriptor === 'function') {
652
- var _services;
704
+ var _this$aspectLoader$ge, _services;
653
705
  const systemDescriptor = await env.env.__getDescriptor();
654
706
  // !important persist services only on the env itself.
655
707
  let services;
656
708
  if (this.envs.isEnvRegistered(component.id.toString())) services = this.envs.getServices(env);
657
- const icon = this.aspectLoader.getDescriptor(env.id).icon || env.env.icon;
709
+ const icon = ((_this$aspectLoader$ge = this.aspectLoader.getDescriptor(env.id)) === null || _this$aspectLoader$ge === void 0 ? void 0 : _this$aspectLoader$ge.icon) || env.env.icon;
658
710
  return {
659
711
  type: systemDescriptor.type,
660
712
  // Make sure to store the env id in the data without the version
@@ -1614,7 +1666,6 @@ needed-for: ${neededFor || '<unknown>'}`);
1614
1666
  }
1615
1667
 
1616
1668
  /**
1617
- * Note - this gets called from Harmony only.
1618
1669
  * returns one graph that includes all dependencies types. each edge has a label of the dependency
1619
1670
  * type. the nodes content is the Component object.
1620
1671
  */
@@ -1649,9 +1700,11 @@ needed-for: ${neededFor || '<unknown>'}`);
1649
1700
  missingPaths = true;
1650
1701
  }
1651
1702
  const runtimePath = runtimeName ? await this.aspectLoader.getRuntimePath(component, localPath, runtimeName) : null;
1703
+ const aspectFilePath = await this.aspectLoader.getAspectFilePath(component, localPath);
1652
1704
  this.logger.debug(`workspace resolveAspects, resolving id: ${compStringId}, localPath: ${localPath}, runtimePath: ${runtimePath}`);
1653
1705
  return {
1654
1706
  aspectPath: localPath,
1707
+ aspectFilePath,
1655
1708
  runtimePath
1656
1709
  };
1657
1710
  });