'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ISOLATED_ENV_ROOT = exports.LICENSE_FILENAME = exports.SKIP_UPDATE_FLAG = exports.DEFAULT_REGISTRY_URL = exports.RELEASE_SERVER = exports.BIT_INSTALL_METHOD = exports.BIT_VERSION = exports.DEFAULT_RESOLVER = exports.SCOPE_JSON = exports.COMPONENTES_DEPENDECIES_REGEX = exports.ASTERISK = exports.LATEST_TESTED_MARK = exports.BIT_CACHE_DIRNAME = exports.BIT_TMP_DIRNAME = exports.BIT_SOURCES_DIRNAME = exports.DEPENDENCY_DELIMITER = exports.LATEST = exports.BIT_REGISTRY = exports.MODULES_CACHE_FILENAME = exports.DOT_GIT_DIR = exports.BIT_GIT_DIR = exports.BIT_HIDDEN_DIR = exports.GLOBAL_REMOTES = exports.SOURCES_MAP = exports.EXTERNAL_MAP = exports.SOURCES_JSON = exports.GLOBAL_CONFIG_FILE = exports.GLOBAL_LOGS = exports.GLOBAL_CONFIG = exports.APP_CACHE_DIR = exports.MODULES_CACHE_DIR = exports.CACHE_ROOT = exports.HOOKS_NAMES = exports.POST_REMOVE_REMOTE = exports.PRE_REMOVE_REMOTE = exports.POST_DEPRECATE_REMOTE = exports.PRE_DEPRECATE_REMOTE = exports.POST_RECEIVE_OBJECTS = exports.PRE_RECEIVE_OBJECTS = exports.POST_SEND_OBJECTS = exports.PRE_SEND_OBJECTS = exports.POST_EXPORT_HOOK = exports.PRE_EXPORT_HOOK = exports.POST_IMPORT_HOOK = exports.PRE_IMPORT_HOOK = exports.POST_TAG_ALL_HOOK = exports.PRE_TAG_ALL_HOOK = exports.POST_TAG_HOOK = exports.PRE_TAG_HOOK = exports.GIT_HOOKS_NAMES = exports.POST_MERGE = exports.POST_CHECKOUT = exports.CFG_CI_ENABLE_KEY = exports.CFG_CI_FUNCTION_PATH_KEY = exports.CFG_POST_IMPORT_HOOK_KEY = exports.CFG_POST_EXPORT_HOOK_KEY = exports.CFG_REGISTRY_DOMAIN_PREFIX = exports.CFG_ANALYTICS_USERID_KEY = exports.CFG_ANALYTICS_ENVIRONMENT_KEY = exports.CFG_ANALYTICS_ERROR_REPORTS_KEY = exports.CFG_ANALYTICS_REPORTING_KEY = exports.CFG_ANALYTICS_ANONYMOUS_KEY = exports.CFG_ANALYTICS_DOMAIN_KEY = exports.CFG_HUB_LOGIN_KEY = exports.CFG_HUB_DOMAIN_KEY = exports.CFG_SSH_KEY_FILE_KEY = exports.CFG_REGISTRY_URL_KEY = exports.CFG_USER_NAME_KEY = exports.CFG_USER_TOKEN_KEY = exports.CFG_USER_EMAIL_KEY = exports.IGNORE_LIST = exports.DEFAULT_SSH_READY_TIMEOUT = exports.DEFAULT_SSH_KEY_FILE = exports.SEARCH_DOMAIN = exports.DEFAULT_REGISTRY_DOMAIN_PREFIX = exports.DEFAULT_ANALYTICS_DOMAIN = exports.DEFAULT_BIT_ENV = exports.DEFAULT_HUB_LOGIN = exports.BASE_DOCS_DOMAIN = exports.DEFAULT_HUB_DOMAIN = exports.SPINNER_TYPE = exports.DEFAULT_DEPENDENCIES = exports.DEFAULT_REMOTES = exports.BIT_EXTERNAL_DIRNAME = exports.DEPENDENCIES_DIR = exports.DEPENDENCY_MAP_FILENAME = exports.VERSION_DELIMITER = exports.DEFAULT_BOX_NAME = exports.SPACE_DELIMITER = exports.NULL_BYTE = exports.OBJECTS_DIR = exports.LATEST_BIT_VERSION = exports.DEFAULT_SEPARATOR = exports.DEFAULT_EJECTED_ENVS_DIR_PATH = exports.DEFAULT_EJECTED_DIR_ENVS = exports.DEFAULT_DEPENDENCIES_DIR_PATH = exports.DEFAULT_DIR_DEPENDENCIES = exports.DEFAULT_COMPONENTES_DIR_PATH = exports.NODE_PATH_SEPARATOR = exports.DEFAULT_BINDINGS_PREFIX = exports.DEFAULT_LANGUAGE = exports.DEFAULT_BIT_RELEASE_TYPE = exports.DEFAULT_BIT_VERSION = exports.DEFAULT_BUNDLE_FILENAME = exports.DEFAULT_DIST_DIRNAME = exports.DEFAULT_EXTENSIONS = exports.DEFAULT_PACKAGE_MANAGER = exports.DEFAULT_TESTER_ID = exports.DEFAULT_COMPILER_ID = exports.NO_PLUGIN_TYPE = exports.DEFAULT_SPECS_NAME = exports.DEFAULT_INDEX_EXTS = exports.DEFAULT_INDEX_NAME = exports.DEFAULT_IMPL_NAME = exports.TESTS_FORK_LEVEL = exports.COMPONENT_ORIGINS = exports.OLD_BIT_MAP = exports.BIT_MAP = exports.GIT_IGNORE = exports.BIT_JSON = exports.BITS_DIRNAME = exports.BIT_USAGE = exports.BIT_DESCRIPTION = exports.AUTO_GENERATED_MSG = exports.AUTO_GENERATED_STAMP = undefined;

var _cliSpinners;

function _load_cliSpinners() {
  return _cliSpinners = _interopRequireDefault(require('cli-spinners'));
}

var _os;

function _load_os() {
  return _os = _interopRequireDefault(require('os'));
}

var _path;

function _load_path() {
  return _path = _interopRequireDefault(require('path'));
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var userHome = require('user-home');

var packageFile = require('../package.json');

var isWindows = (_os || _load_os()).default.platform() === 'win32';

function getDirectory() {
  if (process.platform === 'win32' && process.env.LOCALAPPDATA) {
    return (_path || _load_path()).default.join(process.env.LOCALAPPDATA, 'Bit');
  }

  return (_path || _load_path()).default.join(userHome, '.bit');
}

function getCacheDirectory() {
  if (process.platform === 'darwin' || process.platform === 'linux') {
    return (_path || _load_path()).default.join(userHome, 'Library', 'Caches', 'Bit');
  }

  return getDirectory();
}

var AUTO_GENERATED_STAMP = exports.AUTO_GENERATED_STAMP = 'BIT-AUTO-GENERATED';
var AUTO_GENERATED_MSG = exports.AUTO_GENERATED_MSG = `/* THIS IS A ${AUTO_GENERATED_STAMP} FILE. DO NOT EDIT THIS FILE DIRECTLY. */\n\n`;

var BIT_DESCRIPTION = exports.BIT_DESCRIPTION = 'bit is a free and open source tool designed for easy use, maintenance and discovery of code components.';

var BIT_USAGE = exports.BIT_USAGE = '[--version] [--help] <command> [<args>]';

var BITS_DIRNAME = exports.BITS_DIRNAME = 'components';

var BIT_JSON = exports.BIT_JSON = 'bit.json';

var GIT_IGNORE = exports.GIT_IGNORE = '.gitignore';

var BIT_MAP = exports.BIT_MAP = '.bitmap';

var OLD_BIT_MAP = exports.OLD_BIT_MAP = '.bit.map.json';

var COMPONENT_ORIGINS = exports.COMPONENT_ORIGINS = {
  IMPORTED: 'IMPORTED',
  AUTHORED: 'AUTHORED',
  NESTED: 'NESTED' // which is a nested dependency
};

var TESTS_FORK_LEVEL = exports.TESTS_FORK_LEVEL = {
  NONE: 'NONE',
  ONE: 'ONE',
  COMPONENT: 'COMPONENT'
};

var DEFAULT_IMPL_NAME = exports.DEFAULT_IMPL_NAME = 'impl.js';

var DEFAULT_INDEX_NAME = exports.DEFAULT_INDEX_NAME = 'index'; // todo: move to bit-javascript

var DEFAULT_INDEX_EXTS = exports.DEFAULT_INDEX_EXTS = ['js', 'ts', 'jsx', 'tsx', 'css', 'scss', 'less', 'sass']; // todo: move to bit-javascript

var DEFAULT_SPECS_NAME = exports.DEFAULT_SPECS_NAME = 'spec.js';

var NO_PLUGIN_TYPE = exports.NO_PLUGIN_TYPE = 'none';

var DEFAULT_COMPILER_ID = exports.DEFAULT_COMPILER_ID = NO_PLUGIN_TYPE;

var DEFAULT_TESTER_ID = exports.DEFAULT_TESTER_ID = NO_PLUGIN_TYPE;

var DEFAULT_PACKAGE_MANAGER = exports.DEFAULT_PACKAGE_MANAGER = 'npm';

var DEFAULT_EXTENSIONS = exports.DEFAULT_EXTENSIONS = {
  'ext-docs-parser': {
    rawConfig: {},
    options: {
      core: true
    }
  }
};

var DEFAULT_DIST_DIRNAME = exports.DEFAULT_DIST_DIRNAME = 'dist';

var DEFAULT_BUNDLE_FILENAME = exports.DEFAULT_BUNDLE_FILENAME = 'dist.js';

var DEFAULT_BIT_VERSION = exports.DEFAULT_BIT_VERSION = '0.0.1';

var DEFAULT_BIT_RELEASE_TYPE = exports.DEFAULT_BIT_RELEASE_TYPE = 'patch'; // release type of semver (patch, minor, major)

var DEFAULT_LANGUAGE = exports.DEFAULT_LANGUAGE = 'javascript';

var DEFAULT_BINDINGS_PREFIX = exports.DEFAULT_BINDINGS_PREFIX = '@bit';

var NODE_PATH_SEPARATOR = exports.NODE_PATH_SEPARATOR = '.';

var DEFAULT_COMPONENTES_DIR_PATH = exports.DEFAULT_COMPONENTES_DIR_PATH = `${BITS_DIRNAME}/{namespace}/{name}`;

var DEFAULT_DIR_DEPENDENCIES = exports.DEFAULT_DIR_DEPENDENCIES = '.dependencies';

var DEFAULT_DEPENDENCIES_DIR_PATH = exports.DEFAULT_DEPENDENCIES_DIR_PATH = `${BITS_DIRNAME}/${DEFAULT_DIR_DEPENDENCIES}`;

var DEFAULT_EJECTED_DIR_ENVS = exports.DEFAULT_EJECTED_DIR_ENVS = '@bit-envs';

var DEFAULT_EJECTED_ENVS_DIR_PATH = exports.DEFAULT_EJECTED_ENVS_DIR_PATH = `${DEFAULT_EJECTED_DIR_ENVS}/{envType}`;

var DEFAULT_SEPARATOR = exports.DEFAULT_SEPARATOR = '/';

var LATEST_BIT_VERSION = exports.LATEST_BIT_VERSION = 'latest';

var OBJECTS_DIR = exports.OBJECTS_DIR = 'objects';

var NULL_BYTE = exports.NULL_BYTE = '\u0000';

var SPACE_DELIMITER = exports.SPACE_DELIMITER = ' ';

var DEFAULT_BOX_NAME = exports.DEFAULT_BOX_NAME = 'global';

var VERSION_DELIMITER = exports.VERSION_DELIMITER = '@';

var DEPENDENCY_MAP_FILENAME = exports.DEPENDENCY_MAP_FILENAME = 'dependencies.json';

var DEPENDENCIES_DIR = exports.DEPENDENCIES_DIR = 'dependencies';

var BIT_EXTERNAL_DIRNAME = exports.BIT_EXTERNAL_DIRNAME = 'external';

var DEFAULT_REMOTES = exports.DEFAULT_REMOTES = {};

var DEFAULT_DEPENDENCIES = exports.DEFAULT_DEPENDENCIES = {};

var SPINNER_TYPE = exports.SPINNER_TYPE = isWindows ? (_cliSpinners || _load_cliSpinners()).default.line : (_cliSpinners || _load_cliSpinners()).default.dots12;

var DEFAULT_HUB_DOMAIN = exports.DEFAULT_HUB_DOMAIN = 'hub.bitsrc.io';

var BASE_DOCS_DOMAIN = exports.BASE_DOCS_DOMAIN = 'docs.bitsrc.io';

var DEFAULT_HUB_LOGIN = exports.DEFAULT_HUB_LOGIN = 'https://bitsrc.io/bit-login';

var DEFAULT_BIT_ENV = exports.DEFAULT_BIT_ENV = 'production';

var DEFAULT_ANALYTICS_DOMAIN = exports.DEFAULT_ANALYTICS_DOMAIN = 'https://analytics.bitsrc.io/';

var DEFAULT_REGISTRY_DOMAIN_PREFIX = exports.DEFAULT_REGISTRY_DOMAIN_PREFIX = '@bit';

var SEARCH_DOMAIN = exports.SEARCH_DOMAIN = 'api.bitsrc.io';

var DEFAULT_SSH_KEY_FILE = exports.DEFAULT_SSH_KEY_FILE = `${userHome}/.ssh/id_rsa`;

// Setting this to 99999 to prevent this issue:
// https://github.com/mscdex/ssh2/issues/142
var DEFAULT_SSH_READY_TIMEOUT = exports.DEFAULT_SSH_READY_TIMEOUT = 99999;

var IGNORE_LIST = exports.IGNORE_LIST = ['**/.bit.map.json', '**/.bitmap', '**/.gitignore', '**/bit.json', '**/bitBindings.js', '**/node_modules/**', `**/${DEFAULT_EJECTED_DIR_ENVS}/**`, '**/package.json', '**/package-lock.json', '**/yarn.lock', '**/LICENSE'];

/**
 * bit global config keys
 */
var CFG_USER_EMAIL_KEY = exports.CFG_USER_EMAIL_KEY = 'user.email';

var CFG_USER_TOKEN_KEY = exports.CFG_USER_TOKEN_KEY = 'user.token';

var CFG_USER_NAME_KEY = exports.CFG_USER_NAME_KEY = 'user.name';

var CFG_REGISTRY_URL_KEY = exports.CFG_REGISTRY_URL_KEY = 'registry';

var CFG_SSH_KEY_FILE_KEY = exports.CFG_SSH_KEY_FILE_KEY = 'ssh_key_file';

var CFG_HUB_DOMAIN_KEY = exports.CFG_HUB_DOMAIN_KEY = 'hub_domain';

var CFG_HUB_LOGIN_KEY = exports.CFG_HUB_LOGIN_KEY = 'hub_domain_login';

var CFG_ANALYTICS_DOMAIN_KEY = exports.CFG_ANALYTICS_DOMAIN_KEY = 'analytics_domain';

var CFG_ANALYTICS_ANONYMOUS_KEY = exports.CFG_ANALYTICS_ANONYMOUS_KEY = 'anonymous_reporting';

var CFG_ANALYTICS_REPORTING_KEY = exports.CFG_ANALYTICS_REPORTING_KEY = 'analytics_reporting';

var CFG_ANALYTICS_ERROR_REPORTS_KEY = exports.CFG_ANALYTICS_ERROR_REPORTS_KEY = 'error_reporting';

var CFG_ANALYTICS_ENVIRONMENT_KEY = exports.CFG_ANALYTICS_ENVIRONMENT_KEY = 'bit_environment';

var CFG_ANALYTICS_USERID_KEY = exports.CFG_ANALYTICS_USERID_KEY = 'analytics_id';

var CFG_REGISTRY_DOMAIN_PREFIX = exports.CFG_REGISTRY_DOMAIN_PREFIX = 'registry_domain_prefix';

var CFG_POST_EXPORT_HOOK_KEY = exports.CFG_POST_EXPORT_HOOK_KEY = 'post_export_hook';

var CFG_POST_IMPORT_HOOK_KEY = exports.CFG_POST_IMPORT_HOOK_KEY = 'post_import_hook';

var CFG_CI_FUNCTION_PATH_KEY = exports.CFG_CI_FUNCTION_PATH_KEY = 'ci_function_path';

var CFG_CI_ENABLE_KEY = exports.CFG_CI_ENABLE_KEY = 'ci_enable';

/**
 * git hooks
 */
var POST_CHECKOUT = exports.POST_CHECKOUT = 'post-checkout';

var POST_MERGE = exports.POST_MERGE = 'post-merge';

var GIT_HOOKS_NAMES = exports.GIT_HOOKS_NAMES = [POST_CHECKOUT, POST_MERGE];

/**
 * bit hooks
 */
var PRE_TAG_HOOK = exports.PRE_TAG_HOOK = 'pre-tag';

var POST_TAG_HOOK = exports.POST_TAG_HOOK = 'post-tag';

var PRE_TAG_ALL_HOOK = exports.PRE_TAG_ALL_HOOK = 'pre-tag-all';

var POST_TAG_ALL_HOOK = exports.POST_TAG_ALL_HOOK = 'post-tag-all';

var PRE_IMPORT_HOOK = exports.PRE_IMPORT_HOOK = 'pre-import';

var POST_IMPORT_HOOK = exports.POST_IMPORT_HOOK = 'post-import';

var PRE_EXPORT_HOOK = exports.PRE_EXPORT_HOOK = 'pre-export';

var POST_EXPORT_HOOK = exports.POST_EXPORT_HOOK = 'post-export';

var PRE_SEND_OBJECTS = exports.PRE_SEND_OBJECTS = 'pre-send-objects'; // pre-fetch

var POST_SEND_OBJECTS = exports.POST_SEND_OBJECTS = 'post-send-objects'; // post-fetch

var PRE_RECEIVE_OBJECTS = exports.PRE_RECEIVE_OBJECTS = 'pre-receive-objects'; // pre-put

var POST_RECEIVE_OBJECTS = exports.POST_RECEIVE_OBJECTS = 'post-receive-objects'; // post-put

var PRE_DEPRECATE_REMOTE = exports.PRE_DEPRECATE_REMOTE = 'pre-deprecate-remote';

var POST_DEPRECATE_REMOTE = exports.POST_DEPRECATE_REMOTE = 'post-deprecate-remote';

var PRE_REMOVE_REMOTE = exports.PRE_REMOVE_REMOTE = 'pre-remove-remote';

var POST_REMOVE_REMOTE = exports.POST_REMOVE_REMOTE = 'post-remove-remote';

var HOOKS_NAMES = exports.HOOKS_NAMES = [PRE_TAG_HOOK, POST_TAG_HOOK, PRE_TAG_ALL_HOOK, POST_TAG_ALL_HOOK, PRE_IMPORT_HOOK, POST_IMPORT_HOOK, PRE_EXPORT_HOOK, POST_EXPORT_HOOK, PRE_SEND_OBJECTS, POST_SEND_OBJECTS, PRE_RECEIVE_OBJECTS, POST_RECEIVE_OBJECTS, PRE_DEPRECATE_REMOTE, POST_DEPRECATE_REMOTE, PRE_REMOVE_REMOTE, POST_REMOVE_REMOTE];

/**
 * cache root directory
 */
var CACHE_ROOT = exports.CACHE_ROOT = getCacheDirectory();

/**
 * modules cache directory
 */
var MODULES_CACHE_DIR = exports.MODULES_CACHE_DIR = (_path || _load_path()).default.join(CACHE_ROOT, 'modules');

/**
 * app cache directory
 */
var APP_CACHE_DIR = exports.APP_CACHE_DIR = (_path || _load_path()).default.join(CACHE_ROOT, 'app');

/**
 * glboal config directories
 */
var GLOBAL_CONFIG = exports.GLOBAL_CONFIG = (_path || _load_path()).default.join(CACHE_ROOT, 'config');

var GLOBAL_LOGS = exports.GLOBAL_LOGS = (_path || _load_path()).default.join(CACHE_ROOT, 'logs');

var GLOBAL_CONFIG_FILE = exports.GLOBAL_CONFIG_FILE = 'config.json';

var SOURCES_JSON = exports.SOURCES_JSON = 'sources.json';

var EXTERNAL_MAP = exports.EXTERNAL_MAP = 'externals.json';

var SOURCES_MAP = exports.SOURCES_MAP = 'sources.json';

var GLOBAL_REMOTES = exports.GLOBAL_REMOTES = 'global-remotes.json';

var BIT_HIDDEN_DIR = exports.BIT_HIDDEN_DIR = '.bit';

var BIT_GIT_DIR = exports.BIT_GIT_DIR = 'bit';

var DOT_GIT_DIR = exports.DOT_GIT_DIR = '.git';

/**
 * modules cache filename
 */
var MODULES_CACHE_FILENAME = exports.MODULES_CACHE_FILENAME = (_path || _load_path()).default.join(MODULES_CACHE_DIR, '.roadrunner.json');

/**
 * bit registry default URL.
 */
var BIT_REGISTRY = exports.BIT_REGISTRY = '';

var LATEST = exports.LATEST = 'latest';

var DEPENDENCY_DELIMITER = exports.DEPENDENCY_DELIMITER = '/';

var BIT_SOURCES_DIRNAME = exports.BIT_SOURCES_DIRNAME = 'source';

var BIT_TMP_DIRNAME = exports.BIT_TMP_DIRNAME = 'tmp';

var BIT_CACHE_DIRNAME = exports.BIT_CACHE_DIRNAME = 'cache';

var LATEST_TESTED_MARK = exports.LATEST_TESTED_MARK = '*';

var ASTERISK = exports.ASTERISK = '*';

var COMPONENTES_DEPENDECIES_REGEX = exports.COMPONENTES_DEPENDECIES_REGEX = '/*/*/*/*';

var SCOPE_JSON = exports.SCOPE_JSON = 'scope.json';

var DEFAULT_RESOLVER = exports.DEFAULT_RESOLVER = function DEFAULT_RESOLVER() {
  return '';
};

/**
 * current bit application version
 */
var BIT_VERSION = exports.BIT_VERSION = packageFile.version;

var BIT_INSTALL_METHOD = exports.BIT_INSTALL_METHOD = packageFile.installationMethod;

var RELEASE_SERVER = exports.RELEASE_SERVER = 'https://api.bitsrc.io/release';

var DEFAULT_REGISTRY_URL = exports.DEFAULT_REGISTRY_URL = 'https://node.bitsrc.io';

var SKIP_UPDATE_FLAG = exports.SKIP_UPDATE_FLAG = '--skip-update';

var LICENSE_FILENAME = exports.LICENSE_FILENAME = 'LICENSE';

var ISOLATED_ENV_ROOT = exports.ISOLATED_ENV_ROOT = 'environment';