HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //opt/LC/node_modules/babel-plugin-root-import/build/helper.js
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.transformRelativeToRootPath = exports.hasRootPathPrefixInString = undefined;

var _slash = require('slash');

var _slash2 = _interopRequireDefault(_slash);

var _path = require('path');

var _path2 = _interopRequireDefault(_path);

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

var defaultRoot = (0, _slash2.default)(global.rootPath || process.cwd());

var hasRootPathPrefixInString = exports.hasRootPathPrefixInString = function hasRootPathPrefixInString(importPath) {
  var rootPathPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '~';

  return !!(typeof importPath === 'string' && importPath.indexOf(rootPathPrefix) === 0);
};

var transformRelativeToRootPath = exports.transformRelativeToRootPath = function transformRelativeToRootPath(importPath, rootPathSuffix, rootPathPrefix) {
  var _sourceFile = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';

  var _root = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : defaultRoot;

  var sourceFile = (0, _slash2.default)(_sourceFile);
  if (hasRootPathPrefixInString(importPath, rootPathPrefix)) {
    var withoutRootPathPrefix = importPath.replace(rootPathPrefix, '');

    var suffix = rootPathSuffix ? rootPathSuffix : './';
    var root = typeof _root === 'function' ? _root(sourceFile) : _root;
    var absolutePath = _path2.default.resolve(root, suffix + '/' + withoutRootPathPrefix);

    var sourcePath = sourceFile.substring(0, sourceFile.lastIndexOf('/'));

    var relativePath = _path2.default.relative(_path2.default.resolve(sourcePath), absolutePath).replace(/\\/g, '/');

    // if file is located in the same folder
    if (relativePath.indexOf('../') !== 0) {
      relativePath = './' + relativePath;
    }

    // if the entry has a slash, keep it
    if (importPath[importPath.length - 1] === '/') {
      relativePath += '/';
    }

    return relativePath;
  }

  if (typeof importPath === 'string') {
    return importPath;
  }

  throw new Error('ERROR: No path passed');
};