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

71 lines (54 loc) 1.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = linkAction; function _bluebird() { const data = require("bluebird"); _bluebird = function () { return data; }; return data; } function _consumer() { const data = require("../../../consumer"); _consumer = function () { return data; }; return data; } function _links() { const data = require("../../../links"); _links = function () { return data; }; return data; } function _codemodComponents() { const data = require("../../../consumer/component-ops/codemod-components"); _codemodComponents = function () { return data; }; return data; } function linkAction(_x, _x2) { return _linkAction.apply(this, arguments); } function _linkAction() { _linkAction = (0, _bluebird().coroutine)(function* (ids, changeRelativeToModulePaths) { const consumer = yield (0, _consumer().loadConsumer)(); const bitIds = ids.map(id => consumer.getParsedId(id)); let codemodResults; if (changeRelativeToModulePaths) { codemodResults = yield (0, _codemodComponents().changeCodeFromRelativeToModulePaths)(consumer, bitIds); consumer.componentLoader.clearComponentsCache(); } const linksResults = yield (0, _links().linkAllToNodeModules)(consumer, bitIds); yield consumer.onDestroy(); return { linksResults, codemodResults }; }); return _linkAction.apply(this, arguments); }