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

128 lines (94 loc) 2.85 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.ScopeExtension = 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; } function _harmony() { const data = require("@teambit/harmony"); _harmony = function () { return data; }; return data; } function _component() { const data = require("../component"); _component = function () { return data; }; return data; } function _scopeLoader() { const data = require("../../scope/scope-loader"); _scopeLoader = function () { return data; }; return data; } class ScopeExtension { constructor(legacyScope, tagRegistry) { this.legacyScope = legacyScope; this.tagRegistry = tagRegistry; } /** * register to the tag slot. */ onTag(tagFn) { this.legacyScope.onTag.push(tagFn); this.tagRegistry.register(tagFn); } /** * Will fetch a list of components into the current scope. * This will only fetch the object and won't write the files to the actual FS * * @param {ComponentsIds} ids list of ids to fetch */ fetch(ids) {} // eslint-disable-line @typescript-eslint/no-unused-vars /** * This function will get a component and sealed it's current state into the scope * * @param {Component[]} components A list of components to seal with specific persist options (such as message and version number) * @param {PersistOptions} persistGeneralOptions General persistence options such as verbose */ persist(components, options) {} // eslint-disable-line @typescript-eslint/no-unused-vars /** * get a component from scope * @param id component ID */ get(id) { return (0, _bluebird().coroutine)(function* () { // eslint-disable-next-line @typescript-eslint/no-unused-vars const componentId = typeof id === 'string' ? _component().ComponentID.fromString(id) : id; return undefined; })(); } /** * declare the slots of scope extension. */ static provider(deps, config, [tagSlot]) { return (0, _bluebird().coroutine)(function* () { const legacyScope = yield (0, _scopeLoader().loadScopeIfExist)(); if (!legacyScope) { return undefined; } return new ScopeExtension(legacyScope, tagSlot); })(); } } exports.ScopeExtension = ScopeExtension; (0, _defineProperty2().default)(ScopeExtension, "id", '@teambit/scope'); (0, _defineProperty2().default)(ScopeExtension, "slots", [_harmony().Slot.withType()]);