UNPKG

bit-bin

Version:

<a href="https://opensource.org/licenses/Apache-2.0"><img alt="apache" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a> <a href="https://github.com/teambit/bit/blob/master/CONTRIBUTING.md"><img alt="prs" src="https://img.shields.io/b

60 lines (47 loc) 1.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.flattenDependencies = flattenDependencies; exports.flattenDependencyIds = flattenDependencyIds; function _bluebird() { const data = require("bluebird"); _bluebird = function () { return data; }; return data; } function _utils() { const data = require("../utils"); _utils = function () { return data; }; return data; } function _bitId() { const data = require("../bit-id"); _bitId = function () { return data; }; return data; } function flattenDependencies(dependencies) { return Object.values((0, _utils().flatten)(dependencies.map(dep => dep.allDependencies.concat(dep.component))).reduce((components, component) => { components[component.id.toString()] = component; return components; }, {})); } function flattenDependencyIds(_x, _x2) { return _flattenDependencyIds.apply(this, arguments); } function _flattenDependencyIds() { _flattenDependencyIds = (0, _bluebird().coroutine)(function* (dependencies, repo) { const ids = yield Promise.all(dependencies.map(dep => { const depCompId = dep.component.id.changeScope(dep.sourceScope); return dep.component.flattenedDependencies(repo).then(flattenedDeps => flattenedDeps.concat(depCompId)); })); const flattenedIds = (0, _utils().flatten)(ids); return _bitId().BitIds.uniqFromArray(flattenedIds); }); return _flattenDependencyIds.apply(this, arguments); }