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
136 lines (100 loc) • 3.16 kB
JavaScript
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 _ramda() {
const data = _interopRequireDefault(require("ramda"));
_ramda = function () {
return data;
};
return data;
}
function _scope() {
const data = require("../../../scope");
_scope = function () {
return data;
};
return data;
}
function _componentObjects() {
const data = _interopRequireDefault(require("../../../scope/component-objects"));
_componentObjects = 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 _exportScopeComponents() {
const data = require("../../../scope/component-ops/export-scope-components");
_exportScopeComponents = function () {
return data;
};
return data;
}
function _checkVersionCompatibility() {
const data = require("../../../scope/network/check-version-compatibility");
_checkVersionCompatibility = function () {
return data;
};
return data;
}
const HooksManagerInstance = _hooks().default.getInstance();
var _default = /*#__PURE__*/function () {
var _put = (0, _bluebird().coroutine)(function* ({
path,
componentObjects
}, headers) {
if (typeof componentObjects === 'string') {
componentObjects = _componentObjects().default.manyFromString(componentObjects);
} // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
yield HooksManagerInstance.triggerHook(_constants().PRE_RECEIVE_OBJECTS, {
path,
componentObjects
}, headers);
const scope = yield (0, _scope().loadScope)(path); // @todo: remove this once v15 is out.
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
const clientIsOld = Boolean(headers && headers.version && (0, _checkVersionCompatibility().isClientHasVersionBefore)('14.1.1', headers.version));
const componentsBitIds = yield (0, _exportScopeComponents().exportManyBareScope)(scope, componentObjects, clientIsOld);
const componentsIds = componentsBitIds.map(id => id.toString());
let uniqComponentsIds = componentsIds;
if (componentsIds && componentsIds.length) {
uniqComponentsIds = _ramda().default.uniq(componentsIds);
}
yield HooksManagerInstance.triggerHook(_constants().POST_RECEIVE_OBJECTS, {
componentObjects,
componentsIds: uniqComponentsIds,
scopePath: path,
scopeName: scope.scopeJson.name
}, // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
headers);
return componentsIds;
});
function put(_x, _x2) {
return _put.apply(this, arguments);
}
return put;
}();
exports.default = _default;
;