Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/cosmiconfig/lib/ |
Upload File : |
'use strict'; var path = require('path'); var isDir = require('is-directory'); var loadPackageProp = require('./loadPackageProp'); var loadRc = require('./loadRc'); var loadJs = require('./loadJs'); var loadDefinedFile = require('./loadDefinedFile'); module.exports = function (options) { // These cache Promises that resolve with results, not the results themselves var fileCache = (options.cache) ? new Map() : null; var directoryCache = (options.cache) ? new Map() : null; var transform = options.transform || identityPromise; function clearFileCache() { if (fileCache) fileCache.clear(); } function clearDirectoryCache() { if (directoryCache) directoryCache.clear(); } function clearCaches() { clearFileCache(); clearDirectoryCache(); } function load(searchPath, configPath) { if (!configPath && options.configPath) { configPath = options.configPath; } if (configPath) { var absoluteConfigPath = path.resolve(process.cwd(), configPath); if (fileCache && fileCache.has(absoluteConfigPath)) { return fileCache.get(absoluteConfigPath); } var result = loadDefinedFile(absoluteConfigPath, options) .then(transform); if (fileCache) fileCache.set(absoluteConfigPath, result); return result; } if (!searchPath) return Promise.resolve(null); var absoluteSearchPath = path.resolve(process.cwd(), searchPath); return isDirectory(absoluteSearchPath) .then(function (searchPathIsDirectory) { var directory = (searchPathIsDirectory) ? absoluteSearchPath : path.dirname(absoluteSearchPath); return searchDirectory(directory); }); } function searchDirectory(directory) { if (directoryCache && directoryCache.has(directory)) { return directoryCache.get(directory); } var result = Promise.resolve() .then(function () { if (!options.packageProp) return; return loadPackageProp(directory, options); }) .then(function (result) { if (result || !options.rc) return result; return loadRc(path.join(directory, options.rc), options); }) .then(function (result) { if (result || !options.js) return result; return loadJs(path.join(directory, options.js)); }) .then(function (result) { if (result) return result; var splitPath = directory.split(path.sep); var nextDirectory = (splitPath.length > 1) ? splitPath.slice(0, -1).join(path.sep) : null; if (!nextDirectory || directory === options.stopDir) return null; return searchDirectory(nextDirectory); }) .then(transform); if (directoryCache) directoryCache.set(directory, result); return result; } return { load: load, clearFileCache: clearFileCache, clearDirectoryCache: clearDirectoryCache, clearCaches: clearCaches, }; }; function isDirectory(filepath) { return new Promise(function (resolve, reject) { return isDir(filepath, function (err, dir) { if (err) return reject(err); return resolve(dir); }); }); } function identityPromise(x) { return Promise.resolve(x); }