@teambit/workspace 0.0.826 → 0.0.827

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.
@@ -237,17 +237,9 @@ class GraphFromFsBuilder {
237
237
  }
238
238
 
239
239
  async loadComponent(componentId) {
240
- const componentMap = this.consumer.bitMap.getComponentIfExist(componentId);
241
- const isOnWorkspace = Boolean(componentMap);
242
-
243
- if (isOnWorkspace) {
244
- return this.consumer.loadComponent(componentId);
245
- } // a dependency might have been installed as a package in the workspace, and as such doesn't
246
- // have a componentMap.
247
-
248
-
249
- const componentFromModel = await this.consumer.loadComponentFromModel(componentId);
250
- return componentFromModel.clone();
240
+ const compId = await this.workspace.resolveComponentId(componentId);
241
+ const comp = await this.workspace.get(compId);
242
+ return comp.state._consumer;
251
243
  }
252
244
 
253
245
  }
@@ -1 +1 @@
1
- {"version":3,"names":["GraphFromFsBuilder","constructor","workspace","logger","ignoreIds","BitIds","shouldLoadItsDeps","LegacyGraph","consumer","buildGraph","ids","debug","length","start","Date","now","components","loadManyComponents","processManyComponents","graph","getAllDepsUnfiltered","component","getAllDependenciesIds","difference","getAllDepsFiltered","depsWithoutIgnore","shouldLoadFunc","deps","mapSeries","depId","shouldLoad","push","fromArray","compact","depth","importObjects","allDependencies","processOneComponent","allDependenciesFlattened","flatten","allDeps","map","c","flat","allDepsWithScope","filter","dep","hasScope","scopeComponentsImporter","ScopeComponentsImporter","scope","importMany","uniqFromArray","throwForDependencyNotFound","shouldThrowOnMissingDep","idStr","id","toString","completed","includes","allIds","Object","entries","depsIdsGroupedByType","forEach","depType","depsIds","has","hasNode","Error","setEdge","componentsIds","dependenciesOf","comp","fromGraph","node","loadComponent","setNode","err","ComponentNotFound","BitError","error","componentId","componentMap","bitMap","getComponentIfExist","isOnWorkspace","Boolean","componentFromModel","loadComponentFromModel","clone"],"sources":["build-graph-from-fs.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { flatten } from 'lodash';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport BitIds from '@teambit/legacy/dist/bit-id/bit-ids';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport LegacyGraph from '@teambit/legacy/dist/scope/graph/graph';\nimport ScopeComponentsImporter from '@teambit/legacy/dist/scope/component-ops/scope-components-importer';\nimport compact from 'lodash.compact';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { Logger } from '@teambit/logger';\nimport { ComponentNotFound } from '@teambit/scope';\nimport { BitError } from '@teambit/bit-error';\nimport { Workspace } from './workspace';\n\nexport type ShouldLoadFunc = (bitId: BitId) => Promise<boolean>;\n\nexport class GraphFromFsBuilder {\n private graph = new LegacyGraph();\n private completed: string[] = [];\n private depth = 1;\n private shouldThrowOnMissingDep = true;\n private consumer: Consumer;\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private ignoreIds = new BitIds(),\n private shouldLoadItsDeps?: ShouldLoadFunc\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 components and the edges has a label of the dependency type.\n *\n * the way how it is done is iterations by depths. each depth we gather all the dependencies of\n * that depths, make sure all objects exist and then check their dependencies for the next depth.\n * once there is no dependency left, we're on the last depth level and the graph is ready.\n *\n * for example, imagine the following graph:\n * A1 -> A2 -> A3\n * B1 -> B2 -> B3\n * C1 -> C2 -> C3\n *\n * where the buildGraph is given [A1, B1, C1].\n * first, it saves all these components as nodes in the graph. then, it finds the dependencies of\n * the next level, in this case they're [A2, B2, C2]. it runs `importMany` in case some objects\n * are missing. then, it loads them all (some from FS, some from the model) and sets the edges\n * between the component and the dependencies.\n * once done, it finds all their dependencies, which are [A3, B3, C3] and repeat the process\n * above. since there are no more dependencies, the graph is completed.\n * in this case, the total depth levels are 3.\n *\n * even with a huge project, there are not many depth levels. by iterating through depth levels\n * we keep performance sane as the importMany doesn't run multiple time and therefore the round\n * trips to the remotes are minimal.\n *\n * normally, one importMany of the seeders is enough as importMany knows to fetch all flattened.\n * however, since this buildGraph is performed on the workspace, a dependency may be new or\n * modified and as such, we don't know its flattened yet.\n */\n async buildGraph(ids: BitId[]): Promise<LegacyGraph> {\n this.logger.debug(`GraphFromFsBuilder, buildGraph with ${ids.length} seeders`);\n const start = Date.now();\n const components = await this.loadManyComponents(ids, '<none>');\n await this.processManyComponents(components);\n this.logger.debug(\n `GraphFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`\n );\n return this.graph;\n }\n\n private getAllDepsUnfiltered(component: Component) {\n return component.getAllDependenciesIds().difference(this.ignoreIds);\n }\n\n private async getAllDepsFiltered(component: Component): Promise<BitIds> {\n const depsWithoutIgnore = this.getAllDepsUnfiltered(component);\n const shouldLoadFunc = this.shouldLoadItsDeps;\n if (!shouldLoadFunc) return depsWithoutIgnore;\n const deps = await mapSeries(depsWithoutIgnore, async (depId) => {\n const shouldLoad = await shouldLoadFunc(depId);\n if (!shouldLoad) this.ignoreIds.push(depId);\n return shouldLoad ? depId : null;\n });\n return BitIds.fromArray(compact(deps));\n }\n\n private async processManyComponents(components: Component[]) {\n this.logger.debug(`GraphFromFsBuilder.processManyComponents depth ${this.depth}, ${components.length} components`);\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 private async importObjects(components: Component[]) {\n const allDeps = components.map((c) => this.getAllDepsUnfiltered(c)).flat();\n const allDepsWithScope = allDeps.filter((dep) => dep.hasScope());\n const scopeComponentsImporter = new ScopeComponentsImporter(this.consumer.scope);\n await scopeComponentsImporter.importMany({\n ids: BitIds.uniqFromArray(allDepsWithScope),\n throwForDependencyNotFound: this.shouldThrowOnMissingDep,\n });\n }\n\n private async processOneComponent(component: Component) {\n const idStr = component.id.toString();\n if (this.completed.includes(idStr)) return [];\n const allIds = await this.getAllDepsFiltered(component);\n\n const allDependencies = await this.loadManyComponents(allIds, idStr);\n Object.entries(component.depsIdsGroupedByType).forEach(([depType, depsIds]) => {\n depsIds.forEach((depId) => {\n if (this.ignoreIds.has(depId)) return;\n if (!this.graph.hasNode(depId.toString())) {\n throw new Error(`buildOneComponent: missing node of ${depId.toString()}`);\n }\n this.graph.setEdge(idStr, depId.toString(), depType);\n });\n });\n this.completed.push(idStr);\n return allDependencies;\n }\n\n private async loadManyComponents(componentsIds: BitId[], dependenciesOf: string): Promise<Component[]> {\n const components = await mapSeries(componentsIds, async (comp: BitId) => {\n const idStr = comp.toString();\n const fromGraph = this.graph.node(idStr);\n if (fromGraph) return fromGraph;\n try {\n const component = await this.loadComponent(comp);\n this.graph.setNode(idStr, component);\n return component;\n } catch (err: any) {\n if (err instanceof ComponentNotFound) {\n throw new BitError(\n `error: component \"${idStr}\" was not found.\\nthis component is a dependency of \"${dependenciesOf}\" and is needed as part of the graph generation`\n );\n }\n this.logger.error(`failed loading dependencies of ${dependenciesOf}`);\n throw err;\n }\n });\n return components;\n }\n private async loadComponent(componentId: BitId): Promise<Component> {\n const componentMap = this.consumer.bitMap.getComponentIfExist(componentId);\n const isOnWorkspace = Boolean(componentMap);\n if (isOnWorkspace) {\n return this.consumer.loadComponent(componentId);\n }\n // a dependency might have been installed as a package in the workspace, and as such doesn't\n // have a componentMap.\n const componentFromModel = await this.consumer.loadComponentFromModel(componentId);\n return componentFromModel.clone();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;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;;AAGA;EAAA;;EAAA;IAAA;EA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CP,WAArC,CAAjC;IACA,OAAOM,kBAAkB,CAACE,KAAnB,EAAP;EACD;;AA7I6B"}
1
+ {"version":3,"names":["GraphFromFsBuilder","constructor","workspace","logger","ignoreIds","BitIds","shouldLoadItsDeps","LegacyGraph","consumer","buildGraph","ids","debug","length","start","Date","now","components","loadManyComponents","processManyComponents","graph","getAllDepsUnfiltered","component","getAllDependenciesIds","difference","getAllDepsFiltered","depsWithoutIgnore","shouldLoadFunc","deps","mapSeries","depId","shouldLoad","push","fromArray","compact","depth","importObjects","allDependencies","processOneComponent","allDependenciesFlattened","flatten","allDeps","map","c","flat","allDepsWithScope","filter","dep","hasScope","scopeComponentsImporter","ScopeComponentsImporter","scope","importMany","uniqFromArray","throwForDependencyNotFound","shouldThrowOnMissingDep","idStr","id","toString","completed","includes","allIds","Object","entries","depsIdsGroupedByType","forEach","depType","depsIds","has","hasNode","Error","setEdge","componentsIds","dependenciesOf","comp","fromGraph","node","loadComponent","setNode","err","ComponentNotFound","BitError","error","componentId","compId","resolveComponentId","get","state","_consumer"],"sources":["build-graph-from-fs.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { flatten } from 'lodash';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport BitIds from '@teambit/legacy/dist/bit-id/bit-ids';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport LegacyGraph from '@teambit/legacy/dist/scope/graph/graph';\nimport ScopeComponentsImporter from '@teambit/legacy/dist/scope/component-ops/scope-components-importer';\nimport compact from 'lodash.compact';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { Logger } from '@teambit/logger';\nimport { ComponentNotFound } from '@teambit/scope';\nimport { BitError } from '@teambit/bit-error';\nimport { Workspace } from './workspace';\n\nexport type ShouldLoadFunc = (bitId: BitId) => Promise<boolean>;\n\nexport class GraphFromFsBuilder {\n private graph = new LegacyGraph();\n private completed: string[] = [];\n private depth = 1;\n private shouldThrowOnMissingDep = true;\n private consumer: Consumer;\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private ignoreIds = new BitIds(),\n private shouldLoadItsDeps?: ShouldLoadFunc\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 components and the edges has a label of the dependency type.\n *\n * the way how it is done is iterations by depths. each depth we gather all the dependencies of\n * that depths, make sure all objects exist and then check their dependencies for the next depth.\n * once there is no dependency left, we're on the last depth level and the graph is ready.\n *\n * for example, imagine the following graph:\n * A1 -> A2 -> A3\n * B1 -> B2 -> B3\n * C1 -> C2 -> C3\n *\n * where the buildGraph is given [A1, B1, C1].\n * first, it saves all these components as nodes in the graph. then, it finds the dependencies of\n * the next level, in this case they're [A2, B2, C2]. it runs `importMany` in case some objects\n * are missing. then, it loads them all (some from FS, some from the model) and sets the edges\n * between the component and the dependencies.\n * once done, it finds all their dependencies, which are [A3, B3, C3] and repeat the process\n * above. since there are no more dependencies, the graph is completed.\n * in this case, the total depth levels are 3.\n *\n * even with a huge project, there are not many depth levels. by iterating through depth levels\n * we keep performance sane as the importMany doesn't run multiple time and therefore the round\n * trips to the remotes are minimal.\n *\n * normally, one importMany of the seeders is enough as importMany knows to fetch all flattened.\n * however, since this buildGraph is performed on the workspace, a dependency may be new or\n * modified and as such, we don't know its flattened yet.\n */\n async buildGraph(ids: BitId[]): Promise<LegacyGraph> {\n this.logger.debug(`GraphFromFsBuilder, buildGraph with ${ids.length} seeders`);\n const start = Date.now();\n const components = await this.loadManyComponents(ids, '<none>');\n await this.processManyComponents(components);\n this.logger.debug(\n `GraphFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`\n );\n return this.graph;\n }\n\n private getAllDepsUnfiltered(component: Component) {\n return component.getAllDependenciesIds().difference(this.ignoreIds);\n }\n\n private async getAllDepsFiltered(component: Component): Promise<BitIds> {\n const depsWithoutIgnore = this.getAllDepsUnfiltered(component);\n const shouldLoadFunc = this.shouldLoadItsDeps;\n if (!shouldLoadFunc) return depsWithoutIgnore;\n const deps = await mapSeries(depsWithoutIgnore, async (depId) => {\n const shouldLoad = await shouldLoadFunc(depId);\n if (!shouldLoad) this.ignoreIds.push(depId);\n return shouldLoad ? depId : null;\n });\n return BitIds.fromArray(compact(deps));\n }\n\n private async processManyComponents(components: Component[]) {\n this.logger.debug(`GraphFromFsBuilder.processManyComponents depth ${this.depth}, ${components.length} components`);\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 private async importObjects(components: Component[]) {\n const allDeps = components.map((c) => this.getAllDepsUnfiltered(c)).flat();\n const allDepsWithScope = allDeps.filter((dep) => dep.hasScope());\n const scopeComponentsImporter = new ScopeComponentsImporter(this.consumer.scope);\n await scopeComponentsImporter.importMany({\n ids: BitIds.uniqFromArray(allDepsWithScope),\n throwForDependencyNotFound: this.shouldThrowOnMissingDep,\n });\n }\n\n private async processOneComponent(component: Component) {\n const idStr = component.id.toString();\n if (this.completed.includes(idStr)) return [];\n const allIds = await this.getAllDepsFiltered(component);\n\n const allDependencies = await this.loadManyComponents(allIds, idStr);\n Object.entries(component.depsIdsGroupedByType).forEach(([depType, depsIds]) => {\n depsIds.forEach((depId) => {\n if (this.ignoreIds.has(depId)) return;\n if (!this.graph.hasNode(depId.toString())) {\n throw new Error(`buildOneComponent: missing node of ${depId.toString()}`);\n }\n this.graph.setEdge(idStr, depId.toString(), depType);\n });\n });\n this.completed.push(idStr);\n return allDependencies;\n }\n\n private async loadManyComponents(componentsIds: BitId[], dependenciesOf: string): Promise<Component[]> {\n const components = await mapSeries(componentsIds, async (comp: BitId) => {\n const idStr = comp.toString();\n const fromGraph = this.graph.node(idStr);\n if (fromGraph) return fromGraph;\n try {\n const component = await this.loadComponent(comp);\n this.graph.setNode(idStr, component);\n return component;\n } catch (err: any) {\n if (err instanceof ComponentNotFound) {\n throw new BitError(\n `error: component \"${idStr}\" was not found.\\nthis component is a dependency of \"${dependenciesOf}\" and is needed as part of the graph generation`\n );\n }\n this.logger.error(`failed loading dependencies of ${dependenciesOf}`);\n throw err;\n }\n });\n return components;\n }\n private async loadComponent(componentId: BitId): Promise<Component> {\n const compId = await this.workspace.resolveComponentId(componentId);\n const comp = await this.workspace.get(compId);\n return comp.state._consumer;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;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;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAKO,MAAMA,kBAAN,CAAyB;EAM9BC,WAAW,CACDC,SADC,EAEDC,MAFC,EAGDC,SAAS,GAAG,KAAIC,iBAAJ,GAHX,EAIDC,iBAJC,EAKT;IAAA,KAJQJ,SAIR,GAJQA,SAIR;IAAA,KAHQC,MAGR,GAHQA,MAGR;IAAA,KAFQC,SAER,GAFQA,SAER;IAAA,KADQE,iBACR,GADQA,iBACR;IAAA,+CAVc,KAAIC,gBAAJ,GAUd;IAAA,mDAT4B,EAS5B;IAAA,+CARc,CAQd;IAAA,iEAPgC,IAOhC;IAAA;IACA,KAAKC,QAAL,GAAgB,KAAKN,SAAL,CAAeM,QAA/B;EACD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;EACkB,MAAVC,UAAU,C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ACpC,MAAM,KAAIC,oBAAJ,EACH,qBAAoBzB,KAAM,wDAAuDiB,cAAe,iDAD7F,CAAN;QAGD;;QACD,KAAKrE,MAAL,CAAY8E,KAAZ,CAAmB,kCAAiCT,cAAe,EAAnE;QACA,MAAMM,GAAN;MACD;IACF,CAjBwB,CAAzB;IAkBA,OAAO9D,UAAP;EACD;;EAC0B,MAAb4D,aAAa,CAACM,WAAD,EAAyC;IAClE,MAAMC,MAAM,GAAG,MAAM,KAAKjF,SAAL,CAAekF,kBAAf,CAAkCF,WAAlC,CAArB;IACA,MAAMT,IAAI,GAAG,MAAM,KAAKvE,SAAL,CAAemF,GAAf,CAAmBF,MAAnB,CAAnB;IACA,OAAOV,IAAI,CAACa,KAAL,CAAWC,SAAlB;EACD;;AAvI6B"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/workspace",
3
- "version": "0.0.826",
3
+ "version": "0.0.827",
4
4
  "homepage": "https://bit.dev/teambit/workspace/workspace",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.workspace",
8
8
  "name": "workspace",
9
- "version": "0.0.826"
9
+ "version": "0.0.827"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -38,49 +38,49 @@
38
38
  "@teambit/base-ui.surfaces.split-pane.split-pane": "1.0.0",
39
39
  "@teambit/bit-error": "0.0.394",
40
40
  "@teambit/component-id": "0.0.405",
41
- "@teambit/lane-id": "0.0.73",
41
+ "@teambit/lane-id": "0.0.74",
42
42
  "@teambit/legacy-bit-id": "0.0.402",
43
- "@teambit/logger": "0.0.647",
44
- "@teambit/scope": "0.0.826",
45
- "@teambit/cli": "0.0.554",
46
- "@teambit/isolator": "0.0.826",
47
- "@teambit/component-tree": "0.0.614",
43
+ "@teambit/logger": "0.0.648",
44
+ "@teambit/scope": "0.0.827",
45
+ "@teambit/cli": "0.0.555",
46
+ "@teambit/isolator": "0.0.827",
47
+ "@teambit/component-tree": "0.0.615",
48
48
  "@teambit/component.ui.component-status-resolver": "0.0.493",
49
- "@teambit/lanes.hooks.use-lanes": "0.0.7",
49
+ "@teambit/lanes.hooks.use-lanes": "0.0.8",
50
50
  "@teambit/harmony.modules.resolved-component": "0.0.484",
51
- "@teambit/dependency-resolver": "0.0.826",
52
- "@teambit/compiler": "0.0.826",
53
- "@teambit/component": "0.0.826",
54
- "@teambit/graphql": "0.0.826",
55
- "@teambit/aspect-loader": "0.0.826",
56
- "@teambit/bundler": "0.0.826",
57
- "@teambit/community": "0.0.102",
58
- "@teambit/envs": "0.0.826",
59
- "@teambit/pubsub": "0.0.826",
60
- "@teambit/ui": "0.0.826",
61
- "@teambit/variants": "0.0.651",
51
+ "@teambit/dependency-resolver": "0.0.827",
52
+ "@teambit/compiler": "0.0.827",
53
+ "@teambit/component": "0.0.827",
54
+ "@teambit/graphql": "0.0.827",
55
+ "@teambit/aspect-loader": "0.0.827",
56
+ "@teambit/bundler": "0.0.827",
57
+ "@teambit/community": "0.0.103",
58
+ "@teambit/envs": "0.0.827",
59
+ "@teambit/pubsub": "0.0.827",
60
+ "@teambit/ui": "0.0.827",
61
+ "@teambit/variants": "0.0.652",
62
62
  "@teambit/component-issues": "0.0.60",
63
- "@teambit/config": "0.0.567",
63
+ "@teambit/config": "0.0.568",
64
64
  "@teambit/harmony.modules.requireable-component": "0.0.484",
65
- "@teambit/importer": "0.0.255",
65
+ "@teambit/importer": "0.0.256",
66
66
  "@teambit/workspace.modules.match-pattern": "0.0.489",
67
- "@teambit/component.ui.component-drawer": "0.0.103",
67
+ "@teambit/component.ui.component-drawer": "0.0.104",
68
68
  "@teambit/design.ui.tree": "0.0.6",
69
- "@teambit/ui-foundation.ui.side-bar": "0.0.620",
70
- "@teambit/command-bar": "0.0.826",
69
+ "@teambit/ui-foundation.ui.side-bar": "0.0.621",
70
+ "@teambit/command-bar": "0.0.827",
71
71
  "@teambit/component.ui.component-filters.component-filter-context": "0.0.1",
72
72
  "@teambit/component.ui.component-filters.deprecate-filter": "0.0.1",
73
73
  "@teambit/component.ui.component-filters.env-filter": "0.0.1",
74
- "@teambit/graph": "0.0.826",
75
- "@teambit/sidebar": "0.0.826",
74
+ "@teambit/graph": "0.0.827",
75
+ "@teambit/sidebar": "0.0.827",
76
76
  "@teambit/ui-foundation.ui.main-dropdown": "0.0.487",
77
77
  "@teambit/ui-foundation.ui.menu": "0.0.487",
78
78
  "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.490",
79
79
  "@teambit/ui-foundation.ui.tree.drawer": "0.0.499",
80
80
  "@teambit/toolbox.time.time-format": "0.0.483",
81
81
  "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.489",
82
- "@teambit/component-descriptor": "0.0.117",
83
- "@teambit/deprecation": "0.0.826",
82
+ "@teambit/component-descriptor": "0.0.118",
83
+ "@teambit/deprecation": "0.0.827",
84
84
  "@teambit/ui-foundation.ui.constants.z-indexes": "0.0.488",
85
85
  "@teambit/ui-foundation.ui.buttons.collapser": "0.0.195",
86
86
  "@teambit/ui-foundation.ui.corner": "0.0.498",
@@ -107,7 +107,7 @@
107
107
  "peerDependencies": {
108
108
  "react-router-dom": "^6.0.0",
109
109
  "@apollo/client": "^3.4.0",
110
- "@teambit/legacy": "1.0.337",
110
+ "@teambit/legacy": "1.0.338",
111
111
  "react-dom": "^16.8.0 || ^17.0.0",
112
112
  "react": "^16.8.0 || ^17.0.0"
113
113
  },
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.826/dist/workspace.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.826/dist/workspace.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.827/dist/workspace.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.827/dist/workspace.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];