uapte
This commit is contained in:
17
node_modules/liftoff/lib/build_config_name.js
generated
vendored
17
node_modules/liftoff/lib/build_config_name.js
generated
vendored
@@ -1,17 +0,0 @@
|
||||
module.exports = function (opts) {
|
||||
opts = opts || {};
|
||||
var configName = opts.configName;
|
||||
var extensions = opts.extensions;
|
||||
if (!configName) {
|
||||
throw new Error('Please specify a configName.');
|
||||
}
|
||||
if (configName instanceof RegExp) {
|
||||
return [configName];
|
||||
}
|
||||
if (!Array.isArray(extensions)) {
|
||||
throw new Error('Please provide an array of valid extensions.');
|
||||
}
|
||||
return extensions.map(function (ext) {
|
||||
return configName + ext;
|
||||
});
|
||||
};
|
||||
14
node_modules/liftoff/lib/file_search.js
generated
vendored
14
node_modules/liftoff/lib/file_search.js
generated
vendored
@@ -1,14 +0,0 @@
|
||||
const findup = require('findup-sync');
|
||||
|
||||
module.exports = function (search, paths) {
|
||||
var path;
|
||||
var len = paths.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (path) {
|
||||
break;
|
||||
} else {
|
||||
path = findup(search, {cwd: paths[i], nocase: true});
|
||||
}
|
||||
}
|
||||
return path;
|
||||
};
|
||||
25
node_modules/liftoff/lib/find_config.js
generated
vendored
25
node_modules/liftoff/lib/find_config.js
generated
vendored
@@ -1,25 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fileSearch = require('./file_search');
|
||||
|
||||
module.exports = function (opts) {
|
||||
opts = opts || {};
|
||||
var configNameSearch = opts.configNameSearch;
|
||||
var configPath = opts.configPath;
|
||||
var searchPaths = opts.searchPaths;
|
||||
// only search for a config if a path to one wasn't explicitly provided
|
||||
if (!configPath) {
|
||||
if (!Array.isArray(searchPaths)) {
|
||||
throw new Error('Please provide an array of paths to search for config in.');
|
||||
}
|
||||
if (!configNameSearch) {
|
||||
throw new Error('Please provide a configNameSearch.');
|
||||
}
|
||||
configPath = fileSearch(configNameSearch, searchPaths);
|
||||
}
|
||||
// confirm the configPath exists and return an absolute path to it
|
||||
if (fs.existsSync(configPath)) {
|
||||
return path.resolve(configPath);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
18
node_modules/liftoff/lib/find_cwd.js
generated
vendored
18
node_modules/liftoff/lib/find_cwd.js
generated
vendored
@@ -1,18 +0,0 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = function (opts) {
|
||||
if (!opts) {
|
||||
opts = {};
|
||||
}
|
||||
var cwd = opts.cwd;
|
||||
var configPath = opts.configPath;
|
||||
// if a path to the desired config was specified
|
||||
// but no cwd was provided, use configPath dir
|
||||
if (typeof configPath === 'string' && !cwd) {
|
||||
cwd = path.dirname(path.resolve(configPath));
|
||||
}
|
||||
if (typeof cwd === 'string') {
|
||||
return path.resolve(cwd);
|
||||
}
|
||||
return process.cwd();
|
||||
};
|
||||
30
node_modules/liftoff/lib/get_node_flags.js
generated
vendored
30
node_modules/liftoff/lib/get_node_flags.js
generated
vendored
@@ -1,30 +0,0 @@
|
||||
function arrayOrFunction(arrayOrFunc, env) {
|
||||
if (typeof arrayOrFunc === 'function') {
|
||||
return arrayOrFunc.call(this, env);
|
||||
}
|
||||
if (Array.isArray(arrayOrFunc)) {
|
||||
return arrayOrFunc;
|
||||
}
|
||||
if (typeof arrayOrFunc === 'string') {
|
||||
return [arrayOrFunc];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
function fromReorderedArgv(reorderedArgv) {
|
||||
var nodeFlags = [];
|
||||
for (var i = 1, n = reorderedArgv.length; i < n; i++) {
|
||||
var arg = reorderedArgv[i];
|
||||
if (!/^-/.test(arg) || arg === '--') {
|
||||
break;
|
||||
}
|
||||
nodeFlags.push(arg);
|
||||
}
|
||||
return nodeFlags;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
arrayOrFunction: arrayOrFunction,
|
||||
fromReorderedArgv: fromReorderedArgv,
|
||||
};
|
||||
|
||||
35
node_modules/liftoff/lib/parse_options.js
generated
vendored
35
node_modules/liftoff/lib/parse_options.js
generated
vendored
@@ -1,35 +0,0 @@
|
||||
const extend = require('extend');
|
||||
|
||||
module.exports = function (opts) {
|
||||
var defaults = {
|
||||
extensions: {
|
||||
'.js': null,
|
||||
'.json': null
|
||||
},
|
||||
searchPaths: []
|
||||
};
|
||||
if (!opts) {
|
||||
opts = {};
|
||||
}
|
||||
if (opts.name) {
|
||||
if (!opts.processTitle) {
|
||||
opts.processTitle = opts.name;
|
||||
}
|
||||
if (!opts.configName) {
|
||||
opts.configName = opts.name + 'file';
|
||||
}
|
||||
if (!opts.moduleName) {
|
||||
opts.moduleName = opts.name;
|
||||
}
|
||||
}
|
||||
if (!opts.processTitle) {
|
||||
throw new Error('You must specify a processTitle.');
|
||||
}
|
||||
if (!opts.configName) {
|
||||
throw new Error('You must specify a configName.');
|
||||
}
|
||||
if (!opts.moduleName) {
|
||||
throw new Error('You must specify a moduleName.');
|
||||
}
|
||||
return extend(defaults, opts);
|
||||
};
|
||||
24
node_modules/liftoff/lib/register_loader.js
generated
vendored
24
node_modules/liftoff/lib/register_loader.js
generated
vendored
@@ -1,24 +0,0 @@
|
||||
const rechoir = require('rechoir');
|
||||
|
||||
module.exports = function(eventEmitter, extensions, configPath, cwd) {
|
||||
extensions = extensions || {};
|
||||
|
||||
if (typeof configPath !== 'string') {
|
||||
return;
|
||||
}
|
||||
|
||||
var autoloads = rechoir.prepare(extensions, configPath, cwd, true);
|
||||
if (autoloads instanceof Error) {
|
||||
autoloads = autoloads.failures;
|
||||
}
|
||||
|
||||
if (Array.isArray(autoloads)) {
|
||||
autoloads.forEach(function (attempt) {
|
||||
if (attempt.error) {
|
||||
eventEmitter.emit('requireFail', attempt.moduleName, attempt.error);
|
||||
} else {
|
||||
eventEmitter.emit('require', attempt.moduleName, attempt.module);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
5
node_modules/liftoff/lib/silent_require.js
generated
vendored
5
node_modules/liftoff/lib/silent_require.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
module.exports = function (path) {
|
||||
try {
|
||||
return require(path);
|
||||
} catch (e) {}
|
||||
};
|
||||
Reference in New Issue
Block a user