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
94 lines (71 loc) • 1.97 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 _defineProperty2() {
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
_defineProperty2 = function () {
return data;
};
return data;
}
class Core {
constructor(harmony, config, logger, scope, workspace) {
this.harmony = harmony;
this.config = config;
this.logger = logger;
this.scope = scope;
this.workspace = workspace;
(0, _defineProperty2().default)(this, "host", void 0);
if (workspace) {
this.host = workspace;
} else {
// TODO: implement the ComponentHost interface by scope (then remove the ts-ignore)
// @ts-ignore
this.host = scope;
}
}
/**
* bit's current version
*/
get version() {
return '1.0.0';
}
/**
* Load all unloaded extensions (3rd party extensions) registered in the config file
*/
init() {
var _this = this;
return (0, _bluebird().coroutine)(function* () {
if (_this.config && _this.config.extensions) {
const extensions = _this.config.extensions._filterLegacy();
return _this.loadExtensions(extensions);
}
return undefined;
})();
}
/**
* Load all unloaded extensions from a list
* @param extensions list of extensions with config to load
*/
loadExtensions(extensions) {
var _this2 = this;
return (0, _bluebird().coroutine)(function* () {
// TODO: remove this condition once scope implements ComponentHost
if (_this2.host && _this2.host.loadExtensions) {
return _this2.host.loadExtensions(extensions);
}
return undefined;
})();
}
}
exports.default = Core;