@teambit/snapping 1.0.330 → 1.0.332

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.
@@ -18,9 +18,9 @@ function _componentId() {
18
18
  };
19
19
  return data;
20
20
  }
21
- function _promiseWithConcurrent() {
22
- const data = require("@teambit/legacy/dist/utils/promise-with-concurrent");
23
- _promiseWithConcurrent = function () {
21
+ function _toolboxPromise() {
22
+ const data = require("@teambit/toolbox.promise.map-pool");
23
+ _toolboxPromise = function () {
24
24
  return data;
25
25
  };
26
26
  return data;
@@ -145,7 +145,7 @@ class FlattenedEdgesGetter {
145
145
  }
146
146
  async addPreviousGraphs() {
147
147
  const flattenedDeps = [];
148
- await (0, _promiseWithConcurrent().pMapPool)(this.consumerComponents, async comp => {
148
+ await (0, _toolboxPromise().pMapPool)(this.consumerComponents, async comp => {
149
149
  const previousVersion = comp.previouslyUsedVersion;
150
150
  if (!previousVersion) return;
151
151
  const modelComponent = comp.modelComponent || (await this.scope.legacyScope.getModelComponent(comp.id.changeVersion(undefined)));
@@ -1 +1 @@
1
- {"version":3,"names":["_graph","data","require","_componentId","_promiseWithConcurrent","_bitError","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","FlattenedEdgesGetter","constructor","scope","consumerComponents","logger","lane","Graph","buildGraph","debug","buildTheFirstLevel","populateMissingFromGraph","missingFromGraph","length","graph","addPreviousGraphs","importMissingAndAddToGraph","addComponentsWithMissingFlattenedEdges","populateFlattenedAndEdgesForComp","component","graphFromIds","successorsSubgraph","id","toString","edgesFromGraph","edges","map","edge","source","ComponentID","fromString","sourceId","target","targetId","type","attr","flattenedFromGraphIncludeItself","nodes","node","flattenedFromGraph","filter","isEqual","forEach","dep","throwWhenDepNotIncluded","flattenedDependencies","ComponentIdList","fromArray","flattenedEdges","idsWithoutGraphList","legacyScope","scopeImporter","importWithoutDeps","cache","componentsAndVersions","getComponentsAndVersions","missingEdges","Promise","all","version","versionStr","getFlattenedEdges","objects","push","toComponentId","changeVersion","addFlattenedEdgesToGraph","flattenedDeps","pMapPool","comp","previousVersion","previouslyUsedVersion","modelComponent","getModelComponent","undefined","loadVersion","concurrency","flattenedDepsUniq","uniqFromArray","flat","has","warn","join","missingEdgesList","results","importMany","ids","preferDependencyGraph","allFlattened","result","allFlattenedUniq","compId","setNode","Node","addEdges","dependencies","devDependencies","extensionDependencies","setEdge","Edge","allIds","currentlySnappedIds","filteredIds","label","get","exports","componentId","dependencyId","hasScope","hasVersion","BitError"],"sources":["flattened-edges.ts"],"sourcesContent":["import { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { DepEdgeType } from '@teambit/graph';\nimport { ScopeMain } from '@teambit/scope';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { DepEdge } from '@teambit/legacy/dist/scope/models/version';\nimport { Logger } from '@teambit/logger';\nimport { pMapPool } from '@teambit/legacy/dist/utils/promise-with-concurrent';\nimport { BitError } from '@teambit/bit-error';\n\n/**\n * the goal of this class is to determine the graph dependencies of a given set of components with minimal effort.\n * it takes advantage of the fact that we save the dependency graph in the `Version` object and tries to reuse it.\n *\n * to optimize it as much as possible, we do it in 4 steps. each step we check whether the graph has missing ids,\n * and if so, continue to the next step.\n *\n * * * First step * * *\n * we have two groups in this graph.\n * 1. components that are now versioned (this.consumerComponents). they have the new version (which is not in the scope yet).\n * 2. component that are not part of the current snap/tag.\n * it's not possible that this group has new components that never been into the scope, otherwise the tag/snap is failing.\n * so we know we can always find the version-object of these components in the scope or import them.\n *\n * given the above. we can simply get the first level of dependencies of the first group.\n * start the graph by adding them all as nodes and edges.\n *\n * this dependencies array may contain components from the first group. we can filter them out. (we don't care about\n * them, they're part of the graph already)\n * we're left with the dependencies that are part of the second group. there are the `missingFromGraph`.\n *\n * * * Second step * * *\n * instead of import these components, we can more efficiently get their previous version from the scope.\n * it must be already in the scope because these are the components we load in the first place.\n * chances are that 99% of the dependencies of the current components objects are identical to the previous version.\n * by adding the flattenedEdges of the previous versions we can probably finish the graph without importing a single\n * component. It's ok that this graph of previous versions has ids that are not relevant to this graph. for example, if\n * we now tag bar@0.0.2, this graph will have bar@0.0.1 although it's not relevant. it's ok, because finally we don't\n * use this graph as a whole. we only pick a component and get its sub-graph, so all irrelevant ids are ignored.\n *\n * * * Third step * * *\n * in case the graph above wasn't enough. we can import the missing components and get their flattenedEdges.\n * all components that were snapped/tagged since around 0.0.8000 have the flattenedEdges saved in the version.\n * older components don't have them and that's why the last step is needed.\n *\n * * * Fourth step * * *\n * this is the worst scenario. we have some old dependencies without flattenedEdges, we have to import them with\n * all their flattened dependencies.\n * once we have all these objects we can iterate them and add them to the graph.\n */\nexport class FlattenedEdgesGetter {\n private graph = new Graph<ComponentID, DepEdgeType>();\n private missingFromGraph: ComponentID[] = [];\n constructor(\n private scope: ScopeMain,\n private consumerComponents: ConsumerComponent[],\n private logger: Logger,\n private lane?: Lane\n ) {}\n\n async buildGraph() {\n this.logger.debug('FlattenedEdgesGetter, start');\n this.buildTheFirstLevel();\n this.populateMissingFromGraph();\n if (!this.missingFromGraph.length) {\n return this.graph;\n }\n this.logger.debug(\n `FlattenedEdgesGetter, total ${this.missingFromGraph.length} components missing from graph, trying to find them in previous versions`\n );\n await this.addPreviousGraphs();\n if (!this.missingFromGraph.length) {\n this.logger.debug(`FlattenedEdgesGetter, all missing ids were found in previous versions`);\n return this.graph;\n }\n this.logger.debug(\n `FlattenedEdgesGetter, total ${this.missingFromGraph.length} components missing from graph, trying to import them and load their flattenedEdges`\n );\n await this.importMissingAndAddToGraph();\n if (!this.missingFromGraph.length) {\n this.logger.debug(`FlattenedEdgesGetter, successfully found flattened edges for all components without graph`);\n return this.graph;\n }\n this.logger.debug(\n `FlattenedEdgesGetter, total ${this.missingFromGraph.length} components without graph and their version-objects has no flattened edges, no choice but to import all their flattened deps`\n );\n await this.addComponentsWithMissingFlattenedEdges();\n return this.graph;\n }\n\n populateFlattenedAndEdgesForComp(component: ConsumerComponent) {\n const graphFromIds = this.graph.successorsSubgraph(component.id.toString());\n const edgesFromGraph = graphFromIds.edges.map((edge) => {\n return {\n source: ComponentID.fromString(edge.sourceId),\n target: ComponentID.fromString(edge.targetId),\n type: edge.attr as DepEdgeType,\n };\n });\n\n const flattenedFromGraphIncludeItself = graphFromIds.nodes.map((node) => node.attr);\n const flattenedFromGraph = flattenedFromGraphIncludeItself.filter((id) => !id.isEqual(component.id));\n flattenedFromGraph.forEach((dep) => throwWhenDepNotIncluded(component.id, dep));\n\n component.flattenedDependencies = ComponentIdList.fromArray(flattenedFromGraph);\n component.flattenedEdges = edgesFromGraph;\n }\n\n private async importMissingAndAddToGraph() {\n const idsWithoutGraphList = ComponentIdList.fromArray(this.missingFromGraph);\n await this.scope.legacyScope.scopeImporter.importWithoutDeps(idsWithoutGraphList, {\n cache: true,\n lane: this.lane,\n });\n const componentsAndVersions = await this.scope.legacyScope.getComponentsAndVersions(idsWithoutGraphList);\n const missingEdges: ComponentID[] = [];\n await Promise.all(\n componentsAndVersions.map(async ({ component, version, versionStr }) => {\n const flattenedEdges = await version.getFlattenedEdges(this.scope.legacyScope.objects);\n if (!flattenedEdges.length && version.flattenedDependencies.length) {\n missingEdges.push(component.toComponentId().changeVersion(versionStr));\n }\n this.addFlattenedEdgesToGraph(flattenedEdges);\n })\n );\n this.missingFromGraph = missingEdges;\n }\n\n private async addPreviousGraphs() {\n const flattenedDeps: ComponentID[][] = [];\n await pMapPool(\n this.consumerComponents,\n async (comp) => {\n const previousVersion = comp.previouslyUsedVersion;\n if (!previousVersion) return;\n const modelComponent =\n comp.modelComponent || (await this.scope.legacyScope.getModelComponent(comp.id.changeVersion(undefined)));\n const version = await modelComponent.loadVersion(previousVersion, this.scope.legacyScope.objects, true);\n const flattenedEdges = await version.getFlattenedEdges(this.scope.legacyScope.objects);\n if (flattenedEdges.length) flattenedDeps.push(version.flattenedDependencies);\n this.addFlattenedEdgesToGraph(flattenedEdges);\n },\n { concurrency: 50 }\n );\n\n const flattenedDepsUniq = ComponentIdList.uniqFromArray(flattenedDeps.flat());\n this.missingFromGraph = this.missingFromGraph.filter((id) => !flattenedDepsUniq.has(id));\n }\n\n private async addComponentsWithMissingFlattenedEdges() {\n const missingEdges = this.missingFromGraph;\n this.logger.warn(`FlattenedEdgesGetter, found ${missingEdges.length} components with missing flattened edges:\n${missingEdges.map((e) => e.toString()).join('\\n')}`);\n const missingEdgesList = ComponentIdList.fromArray(missingEdges);\n const results = await this.scope.legacyScope.scopeImporter.importMany({\n ids: missingEdgesList,\n cache: true,\n lane: this.lane,\n preferDependencyGraph: false, // we know it does not have a dependency graph\n });\n const allFlattened = results.map((result) => result.version.flattenedDependencies);\n allFlattened.push(missingEdgesList);\n const allFlattenedUniq = ComponentIdList.uniqFromArray(allFlattened.flat());\n const componentsAndVersions = await this.scope.legacyScope.getComponentsAndVersions(\n ComponentIdList.fromArray(allFlattenedUniq)\n );\n componentsAndVersions.forEach(({ component, version, versionStr }) => {\n const compId = component.toComponentId().changeVersion(versionStr);\n this.graph.setNode(new Node(compId.toString(), compId));\n this.addEdges(compId, version.dependencies, 'prod');\n this.addEdges(compId, version.devDependencies, 'dev');\n this.addEdges(compId, version.extensionDependencies, 'ext');\n });\n }\n\n private addFlattenedEdgesToGraph(flattenedEdges: DepEdge[]) {\n flattenedEdges.forEach(({ source, target, type }) => {\n this.graph.setNode(new Node(source.toString(), source));\n this.graph.setNode(new Node(target.toString(), target));\n this.graph.setEdge(new Edge(source.toString(), target.toString(), type));\n });\n }\n\n private populateMissingFromGraph() {\n const allIds = this.graph.nodes.map((node) => node.attr);\n const currentlySnappedIds = ComponentIdList.fromArray(this.consumerComponents.map((comp) => comp.id));\n const filteredIds = allIds.filter((id) => !currentlySnappedIds.has(id));\n this.missingFromGraph = filteredIds;\n }\n\n private buildTheFirstLevel() {\n this.consumerComponents.forEach((comp) => {\n const id = comp.id;\n this.graph.setNode(new Node(id.toString(), id));\n this.addEdges(comp.id, comp.dependencies, 'prod');\n this.addEdges(comp.id, comp.devDependencies, 'dev');\n this.addEdges(comp.id, comp.extensionDependencies, 'ext');\n });\n }\n\n private addEdges(compId: ComponentID, dependencies: ConsumerComponent['dependencies'], label: DepEdgeType) {\n dependencies.get().forEach((dep) => {\n this.graph.setNode(new Node(dep.id.toString(), dep.id));\n this.graph.setEdge(new Edge(compId.toString(), dep.id.toString(), label));\n });\n }\n}\n\nfunction throwWhenDepNotIncluded(componentId: ComponentID, dependencyId: ComponentID) {\n if (!dependencyId.hasScope() && !dependencyId.hasVersion()) {\n throw new BitError(`fatal: \"${componentId.toString()}\" has a dependency \"${dependencyId.toString()}\".\nthis dependency was not included in the tag command.`);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,uBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,sBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAK,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,E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EAAEoB,GAAG,CAACrB,EAAE,CAACC,QAAQ,CAAC,CAAC,EAAEgF,KAAK,CAAC,CAAC;IAC3E,CAAC,CAAC;EACJ;AACF;AAACE,OAAA,CAAAxG,oBAAA,GAAAA,oBAAA;AAED,SAAS2C,uBAAuBA,CAAC8D,WAAwB,EAAEC,YAAyB,EAAE;EACpF,IAAI,CAACA,YAAY,CAACC,QAAQ,CAAC,CAAC,IAAI,CAACD,YAAY,CAACE,UAAU,CAAC,CAAC,EAAE;IAC1D,MAAM,KAAIC,oBAAQ,EAAC,WAAWJ,WAAW,CAACnF,QAAQ,CAAC,CAAC,uBAAuBoF,YAAY,CAACpF,QAAQ,CAAC,CAAC;AACtG,qDAAqD,CAAC;EACpD;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_graph","data","require","_componentId","_toolboxPromise","_bitError","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","FlattenedEdgesGetter","constructor","scope","consumerComponents","logger","lane","Graph","buildGraph","debug","buildTheFirstLevel","populateMissingFromGraph","missingFromGraph","length","graph","addPreviousGraphs","importMissingAndAddToGraph","addComponentsWithMissingFlattenedEdges","populateFlattenedAndEdgesForComp","component","graphFromIds","successorsSubgraph","id","toString","edgesFromGraph","edges","map","edge","source","ComponentID","fromString","sourceId","target","targetId","type","attr","flattenedFromGraphIncludeItself","nodes","node","flattenedFromGraph","filter","isEqual","forEach","dep","throwWhenDepNotIncluded","flattenedDependencies","ComponentIdList","fromArray","flattenedEdges","idsWithoutGraphList","legacyScope","scopeImporter","importWithoutDeps","cache","componentsAndVersions","getComponentsAndVersions","missingEdges","Promise","all","version","versionStr","getFlattenedEdges","objects","push","toComponentId","changeVersion","addFlattenedEdgesToGraph","flattenedDeps","pMapPool","comp","previousVersion","previouslyUsedVersion","modelComponent","getModelComponent","undefined","loadVersion","concurrency","flattenedDepsUniq","uniqFromArray","flat","has","warn","join","missingEdgesList","results","importMany","ids","preferDependencyGraph","allFlattened","result","allFlattenedUniq","compId","setNode","Node","addEdges","dependencies","devDependencies","extensionDependencies","setEdge","Edge","allIds","currentlySnappedIds","filteredIds","label","get","exports","componentId","dependencyId","hasScope","hasVersion","BitError"],"sources":["flattened-edges.ts"],"sourcesContent":["import { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { DepEdgeType } from '@teambit/graph';\nimport { ScopeMain } from '@teambit/scope';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { DepEdge } from '@teambit/legacy/dist/scope/models/version';\nimport { Logger } from '@teambit/logger';\nimport { pMapPool } from '@teambit/toolbox.promise.map-pool';\nimport { BitError } from '@teambit/bit-error';\n\n/**\n * the goal of this class is to determine the graph dependencies of a given set of components with minimal effort.\n * it takes advantage of the fact that we save the dependency graph in the `Version` object and tries to reuse it.\n *\n * to optimize it as much as possible, we do it in 4 steps. each step we check whether the graph has missing ids,\n * and if so, continue to the next step.\n *\n * * * First step * * *\n * we have two groups in this graph.\n * 1. components that are now versioned (this.consumerComponents). they have the new version (which is not in the scope yet).\n * 2. component that are not part of the current snap/tag.\n * it's not possible that this group has new components that never been into the scope, otherwise the tag/snap is failing.\n * so we know we can always find the version-object of these components in the scope or import them.\n *\n * given the above. we can simply get the first level of dependencies of the first group.\n * start the graph by adding them all as nodes and edges.\n *\n * this dependencies array may contain components from the first group. we can filter them out. (we don't care about\n * them, they're part of the graph already)\n * we're left with the dependencies that are part of the second group. there are the `missingFromGraph`.\n *\n * * * Second step * * *\n * instead of import these components, we can more efficiently get their previous version from the scope.\n * it must be already in the scope because these are the components we load in the first place.\n * chances are that 99% of the dependencies of the current components objects are identical to the previous version.\n * by adding the flattenedEdges of the previous versions we can probably finish the graph without importing a single\n * component. It's ok that this graph of previous versions has ids that are not relevant to this graph. for example, if\n * we now tag bar@0.0.2, this graph will have bar@0.0.1 although it's not relevant. it's ok, because finally we don't\n * use this graph as a whole. we only pick a component and get its sub-graph, so all irrelevant ids are ignored.\n *\n * * * Third step * * *\n * in case the graph above wasn't enough. we can import the missing components and get their flattenedEdges.\n * all components that were snapped/tagged since around 0.0.8000 have the flattenedEdges saved in the version.\n * older components don't have them and that's why the last step is needed.\n *\n * * * Fourth step * * *\n * this is the worst scenario. we have some old dependencies without flattenedEdges, we have to import them with\n * all their flattened dependencies.\n * once we have all these objects we can iterate them and add them to the graph.\n */\nexport class FlattenedEdgesGetter {\n private graph = new Graph<ComponentID, DepEdgeType>();\n private missingFromGraph: ComponentID[] = [];\n constructor(\n private scope: ScopeMain,\n private consumerComponents: ConsumerComponent[],\n private logger: Logger,\n private lane?: Lane\n ) {}\n\n async buildGraph() {\n this.logger.debug('FlattenedEdgesGetter, start');\n this.buildTheFirstLevel();\n this.populateMissingFromGraph();\n if (!this.missingFromGraph.length) {\n return this.graph;\n }\n this.logger.debug(\n `FlattenedEdgesGetter, total ${this.missingFromGraph.length} components missing from graph, trying to find them in previous versions`\n );\n await this.addPreviousGraphs();\n if (!this.missingFromGraph.length) {\n this.logger.debug(`FlattenedEdgesGetter, all missing ids were found in previous versions`);\n return this.graph;\n }\n this.logger.debug(\n `FlattenedEdgesGetter, total ${this.missingFromGraph.length} components missing from graph, trying to import them and load their flattenedEdges`\n );\n await this.importMissingAndAddToGraph();\n if (!this.missingFromGraph.length) {\n this.logger.debug(`FlattenedEdgesGetter, successfully found flattened edges for all components without graph`);\n return this.graph;\n }\n this.logger.debug(\n `FlattenedEdgesGetter, total ${this.missingFromGraph.length} components without graph and their version-objects has no flattened edges, no choice but to import all their flattened deps`\n );\n await this.addComponentsWithMissingFlattenedEdges();\n return this.graph;\n }\n\n populateFlattenedAndEdgesForComp(component: ConsumerComponent) {\n const graphFromIds = this.graph.successorsSubgraph(component.id.toString());\n const edgesFromGraph = graphFromIds.edges.map((edge) => {\n return {\n source: ComponentID.fromString(edge.sourceId),\n target: ComponentID.fromString(edge.targetId),\n type: edge.attr as DepEdgeType,\n };\n });\n\n const flattenedFromGraphIncludeItself = graphFromIds.nodes.map((node) => node.attr);\n const flattenedFromGraph = flattenedFromGraphIncludeItself.filter((id) => !id.isEqual(component.id));\n flattenedFromGraph.forEach((dep) => throwWhenDepNotIncluded(component.id, dep));\n\n component.flattenedDependencies = ComponentIdList.fromArray(flattenedFromGraph);\n component.flattenedEdges = edgesFromGraph;\n }\n\n private async importMissingAndAddToGraph() {\n const idsWithoutGraphList = ComponentIdList.fromArray(this.missingFromGraph);\n await this.scope.legacyScope.scopeImporter.importWithoutDeps(idsWithoutGraphList, {\n cache: true,\n lane: this.lane,\n });\n const componentsAndVersions = await this.scope.legacyScope.getComponentsAndVersions(idsWithoutGraphList);\n const missingEdges: ComponentID[] = [];\n await Promise.all(\n componentsAndVersions.map(async ({ component, version, versionStr }) => {\n const flattenedEdges = await version.getFlattenedEdges(this.scope.legacyScope.objects);\n if (!flattenedEdges.length && version.flattenedDependencies.length) {\n missingEdges.push(component.toComponentId().changeVersion(versionStr));\n }\n this.addFlattenedEdgesToGraph(flattenedEdges);\n })\n );\n this.missingFromGraph = missingEdges;\n }\n\n private async addPreviousGraphs() {\n const flattenedDeps: ComponentID[][] = [];\n await pMapPool(\n this.consumerComponents,\n async (comp) => {\n const previousVersion = comp.previouslyUsedVersion;\n if (!previousVersion) return;\n const modelComponent =\n comp.modelComponent || (await this.scope.legacyScope.getModelComponent(comp.id.changeVersion(undefined)));\n const version = await modelComponent.loadVersion(previousVersion, this.scope.legacyScope.objects, true);\n const flattenedEdges = await version.getFlattenedEdges(this.scope.legacyScope.objects);\n if (flattenedEdges.length) flattenedDeps.push(version.flattenedDependencies);\n this.addFlattenedEdgesToGraph(flattenedEdges);\n },\n { concurrency: 50 }\n );\n\n const flattenedDepsUniq = ComponentIdList.uniqFromArray(flattenedDeps.flat());\n this.missingFromGraph = this.missingFromGraph.filter((id) => !flattenedDepsUniq.has(id));\n }\n\n private async addComponentsWithMissingFlattenedEdges() {\n const missingEdges = this.missingFromGraph;\n this.logger.warn(`FlattenedEdgesGetter, found ${missingEdges.length} components with missing flattened edges:\n${missingEdges.map((e) => e.toString()).join('\\n')}`);\n const missingEdgesList = ComponentIdList.fromArray(missingEdges);\n const results = await this.scope.legacyScope.scopeImporter.importMany({\n ids: missingEdgesList,\n cache: true,\n lane: this.lane,\n preferDependencyGraph: false, // we know it does not have a dependency graph\n });\n const allFlattened = results.map((result) => result.version.flattenedDependencies);\n allFlattened.push(missingEdgesList);\n const allFlattenedUniq = ComponentIdList.uniqFromArray(allFlattened.flat());\n const componentsAndVersions = await this.scope.legacyScope.getComponentsAndVersions(\n ComponentIdList.fromArray(allFlattenedUniq)\n );\n componentsAndVersions.forEach(({ component, version, versionStr }) => {\n const compId = component.toComponentId().changeVersion(versionStr);\n this.graph.setNode(new Node(compId.toString(), compId));\n this.addEdges(compId, version.dependencies, 'prod');\n this.addEdges(compId, version.devDependencies, 'dev');\n this.addEdges(compId, version.extensionDependencies, 'ext');\n });\n }\n\n private addFlattenedEdgesToGraph(flattenedEdges: DepEdge[]) {\n flattenedEdges.forEach(({ source, target, type }) => {\n this.graph.setNode(new Node(source.toString(), source));\n this.graph.setNode(new Node(target.toString(), target));\n this.graph.setEdge(new Edge(source.toString(), target.toString(), type));\n });\n }\n\n private populateMissingFromGraph() {\n const allIds = this.graph.nodes.map((node) => node.attr);\n const currentlySnappedIds = ComponentIdList.fromArray(this.consumerComponents.map((comp) => comp.id));\n const filteredIds = allIds.filter((id) => !currentlySnappedIds.has(id));\n this.missingFromGraph = filteredIds;\n }\n\n private buildTheFirstLevel() {\n this.consumerComponents.forEach((comp) => {\n const id = comp.id;\n this.graph.setNode(new Node(id.toString(), id));\n this.addEdges(comp.id, comp.dependencies, 'prod');\n this.addEdges(comp.id, comp.devDependencies, 'dev');\n this.addEdges(comp.id, comp.extensionDependencies, 'ext');\n });\n }\n\n private addEdges(compId: ComponentID, dependencies: ConsumerComponent['dependencies'], label: DepEdgeType) {\n dependencies.get().forEach((dep) => {\n this.graph.setNode(new Node(dep.id.toString(), dep.id));\n this.graph.setEdge(new Edge(compId.toString(), dep.id.toString(), label));\n });\n }\n}\n\nfunction throwWhenDepNotIncluded(componentId: ComponentID, dependencyId: ComponentID) {\n if (!dependencyId.hasScope() && !dependencyId.hasVersion()) {\n throw new BitError(`fatal: \"${componentId.toString()}\" has a dependency \"${dependencyId.toString()}\".\nthis dependency was not included in the tag command.`);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,gBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,eAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAK,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAA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AI,CAACA,YAAY,CAACC,QAAQ,CAAC,CAAC,IAAI,CAACD,YAAY,CAACE,UAAU,CAAC,CAAC,EAAE;IAC1D,MAAM,KAAIC,oBAAQ,EAAC,WAAWJ,WAAW,CAACnF,QAAQ,CAAC,CAAC,uBAAuBoF,YAAY,CAACpF,QAAQ,CAAC,CAAC;AACtG,qDAAqD,CAAC;EACpD;AACF","ignoreList":[]}
@@ -81,13 +81,6 @@ function _pMapSeries() {
81
81
  };
82
82
  return data;
83
83
  }
84
- function _semverHelper() {
85
- const data = require("@teambit/legacy/dist/utils/semver-helper");
86
- _semverHelper = function () {
87
- return data;
88
- };
89
- return data;
90
- }
91
84
  function _loader() {
92
85
  const data = _interopRequireDefault(require("@teambit/legacy/dist/cli/loader"));
93
86
  _loader = function () {
@@ -96,7 +89,7 @@ function _loader() {
96
89
  return data;
97
90
  }
98
91
  function _componentsPendingImport() {
99
- const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component-ops/exceptions/components-pending-import"));
92
+ const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/exceptions/components-pending-import"));
100
93
  _componentsPendingImport = function () {
101
94
  return data;
102
95
  };
@@ -130,9 +123,16 @@ function _insights() {
130
123
  };
131
124
  return data;
132
125
  }
133
- function _concurrency() {
134
- const data = require("@teambit/legacy/dist/utils/concurrency");
135
- _concurrency = function () {
126
+ function _pkgModules() {
127
+ const data = require("@teambit/pkg.modules.semver-helper");
128
+ _pkgModules = function () {
129
+ return data;
130
+ };
131
+ return data;
132
+ }
133
+ function _harmonyModules() {
134
+ const data = require("@teambit/harmony.modules.concurrency");
135
+ _harmonyModules = function () {
136
136
  return data;
137
137
  };
138
138
  return data;
@@ -398,7 +398,7 @@ class SnappingMain {
398
398
  if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
399
399
  const idsHasPattern = this.workspace.hasPattern(ids);
400
400
  const isAll = Boolean(!ids.length || idsHasPattern);
401
- const validExactVersion = (0, _semverHelper().validateVersion)(exactVersion);
401
+ const validExactVersion = (0, _pkgModules().validateVersion)(exactVersion);
402
402
  const consumer = this.workspace.consumer;
403
403
  const componentsList = new (_componentsList().default)(consumer);
404
404
  _loader().default.start('determine components to tag...');
@@ -1200,7 +1200,7 @@ another option, in case this dependency is not in main yet is to remove all refe
1200
1200
  }));
1201
1201
  };
1202
1202
  await (0, _pMap().default)(components, component => throwForComponent(component), {
1203
- concurrency: (0, _concurrency().concurrentComponentsLimit)()
1203
+ concurrency: (0, _harmonyModules().concurrentComponentsLimit)()
1204
1204
  });
1205
1205
  }
1206
1206