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
196 lines (144 loc) • 4.36 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.listScope = listScope;
exports.getRemoteBitIdsByWildcards = getRemoteBitIdsByWildcards;
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 _consumer() {
const data = require("../../../consumer");
_consumer = function () {
return data;
};
return data;
}
function _loader() {
const data = _interopRequireDefault(require("../../../cli/loader"));
_loader = function () {
return data;
};
return data;
}
function _loaderMessages() {
const data = require("../../../cli/loader/loader-messages");
_loaderMessages = function () {
return data;
};
return data;
}
function _componentsList() {
const data = _interopRequireDefault(require("../../../consumer/component/components-list"));
_componentsList = function () {
return data;
};
return data;
}
function _exceptions() {
const data = require("../../../consumer/exceptions");
_exceptions = function () {
return data;
};
return data;
}
function _generalError() {
const data = _interopRequireDefault(require("../../../error/general-error"));
_generalError = function () {
return data;
};
return data;
}
function _noIdMatchWildcard() {
const data = _interopRequireDefault(require("./exceptions/no-id-match-wildcard"));
_noIdMatchWildcard = function () {
return data;
};
return data;
}
function _getRemoteByName() {
const data = _interopRequireDefault(require("../../../remotes/get-remote-by-name"));
_getRemoteByName = function () {
return data;
};
return data;
}
function listScope(_x) {
return _listScope.apply(this, arguments);
}
function _listScope() {
_listScope = (0, _bluebird().coroutine)(function* ({
scopeName,
showAll,
// include nested
showRemoteVersion,
namespacesUsingWildcards,
strategiesNames
}) {
const consumer = yield (0, _consumer().loadConsumerIfExist)();
if (scopeName) {
return remoteList();
}
return scopeList();
function remoteList() {
return _remoteList.apply(this, arguments);
}
function _remoteList() {
_remoteList = (0, _bluebird().coroutine)(function* () {
const remote = yield (0, _getRemoteByName().default)(scopeName, consumer);
_loader().default.start(_loaderMessages().BEFORE_REMOTE_LIST);
return remote.list(namespacesUsingWildcards, strategiesNames);
});
return _remoteList.apply(this, arguments);
}
function scopeList() {
return _scopeList.apply(this, arguments);
}
function _scopeList() {
_scopeList = (0, _bluebird().coroutine)(function* () {
if (!consumer) {
throw new (_exceptions().ConsumerNotFound)();
}
_loader().default.start(_loaderMessages().BEFORE_LOCAL_LIST);
const componentsList = new (_componentsList().default)(consumer); // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
return componentsList.listScope(showRemoteVersion, showAll, namespacesUsingWildcards);
});
return _scopeList.apply(this, arguments);
}
});
return _listScope.apply(this, arguments);
}
function getRemoteBitIdsByWildcards(_x2) {
return _getRemoteBitIdsByWildcards.apply(this, arguments);
}
function _getRemoteBitIdsByWildcards() {
_getRemoteBitIdsByWildcards = (0, _bluebird().coroutine)(function* (idStr) {
if (!idStr.includes('/')) {
throw new (_generalError().default)(`import with wildcards expects full scope-name before the wildcards, instead, got "${idStr}"`);
}
const idSplit = idStr.split('/');
const scopeName = idSplit[0];
const namespacesUsingWildcards = _ramda().default.tail(idSplit).join('/');
const listResult = yield listScope({
scopeName,
namespacesUsingWildcards
});
if (!listResult.length) {
throw new (_noIdMatchWildcard().default)([idStr]);
}
return listResult.map(result => result.id);
});
return _getRemoteBitIdsByWildcards.apply(this, arguments);
}
;