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

117 lines (84 loc) 2.8 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; function _bluebird() { const data = require("bluebird"); _bluebird = function () { return data; }; return data; } function _scope() { const data = require("../../../scope"); _scope = function () { return data; }; return data; } function _bitId() { const data = require("../../../bit-id"); _bitId = function () { return data; }; return data; } function _constants() { const data = require("../../../constants"); _constants = function () { return data; }; return data; } function _hooks() { const data = _interopRequireDefault(require("../../../hooks")); _hooks = function () { return data; }; return data; } function _scopeComponentsImporter() { const data = _interopRequireDefault(require("../../../scope/component-ops/scope-components-importer")); _scopeComponentsImporter = function () { return data; }; return data; } // import logger from '../../../logger/logger'; const HooksManagerInstance = _hooks().default.getInstance(); var _default = /*#__PURE__*/function () { var _fetch = (0, _bluebird().coroutine)(function* (path, ids, noDependencies = false, headers) { const bitIds = _bitId().BitIds.deserialize(ids); const args = { path, bitIds, noDependencies }; // This might be undefined in case of fork process like during bit test command if (HooksManagerInstance) { // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! HooksManagerInstance.triggerHook(_constants().PRE_SEND_OBJECTS, args, headers); } const scope = yield (0, _scope().loadScope)(path); const scopeComponentsImporter = _scopeComponentsImporter().default.getInstance(scope); const importedComponents = noDependencies ? yield scopeComponentsImporter.importManyWithoutDependencies(bitIds, false) : yield scopeComponentsImporter.importMany(bitIds); // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! const clientVersion = headers ? headers.version : null; const componentObjects = yield scopeComponentsImporter.componentsToComponentsObjects(importedComponents, clientVersion); if (HooksManagerInstance) { yield HooksManagerInstance.triggerHook(_constants().POST_SEND_OBJECTS, { componentObjects, scopePath: path, componentsIds: bitIds.serialize(), scopeName: scope.scopeJson.name }, // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! headers); } return componentObjects; }); function fetch(_x, _x2) { return _fetch.apply(this, arguments); } return fetch; }(); exports.default = _default;