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

137 lines (106 loc) 3.35 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.deprecate = deprecate; exports.undeprecate = undeprecate; 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 _componentsDeprecation() { const data = require("../../../scope/component-ops/components-deprecation"); _componentsDeprecation = function () { return data; }; return data; } const HooksManagerInstance = _hooks().default.getInstance(); function deprecate(_x, _x2) { return _deprecate.apply(this, arguments); } function _deprecate() { _deprecate = (0, _bluebird().coroutine)(function* ({ path, ids }, headers) { const bitIds = _bitId().BitIds.deserialize(ids); const args = { path, bitIds }; // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! HooksManagerInstance.triggerHook(_constants().PRE_DEPRECATE_REMOTE, args, headers); const scope = yield (0, _scope().loadScope)(path); const deprecationResult = yield (0, _componentsDeprecation().deprecateMany)(scope, bitIds); const hookArgs = { deprecatedComponentsIds: deprecationResult.bitIds, missingComponentsIds: deprecationResult.missingComponents, scopePath: path, componentsIds: bitIds.serialize(), scopeName: scope.scopeJson.name }; // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! yield HooksManagerInstance.triggerHook(_constants().POST_DEPRECATE_REMOTE, hookArgs, headers); return deprecationResult; }); return _deprecate.apply(this, arguments); } function undeprecate(_x3, _x4) { return _undeprecate.apply(this, arguments); } function _undeprecate() { _undeprecate = (0, _bluebird().coroutine)(function* ({ path, ids }, headers) { const bitIds = _bitId().BitIds.deserialize(ids); const args = { path, bitIds }; // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! HooksManagerInstance.triggerHook(_constants().PRE_UNDEPRECATE_REMOTE, args, headers); const scope = yield (0, _scope().loadScope)(path); const deprecationResult = yield (0, _componentsDeprecation().undeprecateMany)(scope, bitIds); const hookArgs = { deprecatedComponentsIds: deprecationResult.bitIds, missingComponentsIds: deprecationResult.missingComponents, scopePath: path, componentsIds: bitIds.serialize(), scopeName: scope.scopeJson.name }; // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! yield HooksManagerInstance.triggerHook(_constants().POST_UNDEPRECATE_REMOTE, hookArgs, headers); return deprecationResult; }); return _undeprecate.apply(this, arguments); }