Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getExplorer = _.memoize(opts =>
cosmiconfig(
RC_NAMESPACE,
_.defaultsDeep(
{
// @ts-ignore
loaders: {noExt: cosmiconfig.loadJs}
},
opts
)
)
);
}
const explorer = cosmiconfig('metro', {
searchPlaces: [
'metro.config.js',
'metro.config.json',
'package.json',
'rn-cli.config.js',
],
loaders: {
'.json': cosmiconfig.loadJson,
'.yaml': cosmiconfig.loadYaml,
'.yml': cosmiconfig.loadYaml,
'.js': cosmiconfig.loadJs,
'.es6': cosmiconfig.loadJs,
noExt: cosmiconfig.loadYaml,
},
});
async function resolveConfig(
path?: string,
cwd?: string,
): Promise {
if (path) {
return explorer.load(path);
}
const result = await explorer.search(cwd);
if (result == null) {
// No config file found, return a default
return {
return arg;
}
const explorer = cosmiconfig('metro', {
searchPlaces: [
'metro.config.js',
'metro.config.json',
'package.json',
'rn-cli.config.js',
],
loaders: {
'.json': cosmiconfig.loadJson,
'.yaml': cosmiconfig.loadYaml,
'.yml': cosmiconfig.loadYaml,
'.js': cosmiconfig.loadJs,
'.es6': cosmiconfig.loadJs,
noExt: cosmiconfig.loadYaml,
},
});
async function resolveConfig(
path?: string,
cwd?: string,
): Promise {
if (path) {
return explorer.load(path);
}
const result = await explorer.search(cwd);
if (result == null) {
// No config file found, return a default
// flowlint ambiguous-object-type:error
'use strict';
const cosmiconfig = require('cosmiconfig');
import type {Config} from '../relay-compiler/bin/RelayCompilerMain';
const explorer = cosmiconfig('relay', {
searchPlaces: ['relay.config.js', 'relay.config.json', 'package.json'],
loaders: {
'.json': cosmiconfig.loadJson,
'.yaml': cosmiconfig.loadYaml,
'.yml': cosmiconfig.loadYaml,
'.js': cosmiconfig.loadJs,
'.es6': cosmiconfig.loadJs,
noExt: cosmiconfig.loadYaml,
},
});
function loadConfig(): ?Config {
const result = explorer.searchSync();
if (result) {
return result.config;
}
}
module.exports = {loadConfig};
return arg;
}
const explorer = cosmiconfig("metro", {
searchPlaces: [
"metro.config.js",
"metro.config.json",
"package.json",
"rn-cli.config.js"
],
loaders: {
".json": cosmiconfig.loadJson,
".yaml": cosmiconfig.loadYaml,
".yml": cosmiconfig.loadYaml,
".js": cosmiconfig.loadJs,
".es6": cosmiconfig.loadJs,
noExt: cosmiconfig.loadYaml
}
});
function resolveConfig(_x, _x2) {
return _resolveConfig.apply(this, arguments);
}
function _resolveConfig() {
_resolveConfig = _asyncToGenerator(function*(path, cwd) {
if (path) {
return explorer.load(path);
}
const result = yield explorer.search(cwd);
return arg;
}
const explorer = cosmiconfig("metro", {
searchPlaces: [
"metro.config.js",
"metro.config.json",
"package.json",
"rn-cli.config.js"
],
loaders: {
".json": cosmiconfig.loadJson,
".yaml": cosmiconfig.loadYaml,
".yml": cosmiconfig.loadYaml,
".js": cosmiconfig.loadJs,
".es6": cosmiconfig.loadJs,
noExt: cosmiconfig.loadYaml
}
});
function resolveConfig(_x, _x2) {
return _resolveConfig.apply(this, arguments);
}
function _resolveConfig() {
_resolveConfig = _asyncToGenerator(function*(path, cwd) {
if (path) {
return explorer.load(path);
}
const result = yield explorer.search(cwd);
const MODULE_NAME = 'gqless'
const defaultFileNames = [
'package.json',
`.${MODULE_NAME}rc`,
`.${MODULE_NAME}rc.json`,
`.${MODULE_NAME}rc.yaml`,
`.${MODULE_NAME}rc.yml`,
`${MODULE_NAME}.config.js`,
`${MODULE_NAME}.config.ts`,
]
const loaders = {
'.json': cosmiconfig.loadJson,
'.yaml': cosmiconfig.loadYaml,
'.yml': cosmiconfig.loadYaml,
'.js': cosmiconfig.loadJs,
'.ts': {
async: TypeScriptLoader,
},
noExt: cosmiconfig.loadYaml
}
export const getConfig = async (path?: string) => {
const configPath = path && parse(resolve(path)).dir
const explorer = cosmiconfig(MODULE_NAME, {
searchPlaces: path ? [path] : defaultFileNames,
loaders,
})
let loadedConfig
try {
loadedConfig = await explorer.search(configPath)
return arg;
}
const explorer = cosmiconfig("metro", {
searchPlaces: [
"metro.config.js",
"metro.config.json",
"package.json",
"rn-cli.config.js"
],
loaders: {
".json": cosmiconfig.loadJson,
".yaml": cosmiconfig.loadYaml,
".yml": cosmiconfig.loadYaml,
".js": cosmiconfig.loadJs,
".es6": cosmiconfig.loadJs,
noExt: cosmiconfig.loadYaml
}
});
function resolveConfig(_x, _x2) {
return _resolveConfig.apply(this, arguments);
}
function _resolveConfig() {
_resolveConfig = _asyncToGenerator(function*(path, cwd) {
if (path) {
return explorer.load(path);
}
const result = yield explorer.search(cwd);
'use strict';
const cosmiconfig = require('cosmiconfig');
import type {Config} from '../relay-compiler/bin/RelayCompilerMain';
const explorer = cosmiconfig('relay', {
searchPlaces: ['relay.config.js', 'relay.config.json', 'package.json'],
loaders: {
'.json': cosmiconfig.loadJson,
'.yaml': cosmiconfig.loadYaml,
'.yml': cosmiconfig.loadYaml,
'.js': cosmiconfig.loadJs,
'.es6': cosmiconfig.loadJs,
noExt: cosmiconfig.loadYaml,
},
});
function loadConfig(): ?Config {
const result = explorer.searchSync();
if (result) {
return result.config;
}
}
module.exports = {loadConfig};
return arg;
}
const explorer = cosmiconfig("metro", {
searchPlaces: [
"metro.config.js",
"metro.config.json",
"package.json",
"rn-cli.config.js"
],
loaders: {
".json": cosmiconfig.loadJson,
".yaml": cosmiconfig.loadYaml,
".yml": cosmiconfig.loadYaml,
".js": cosmiconfig.loadJs,
".es6": cosmiconfig.loadJs,
noExt: cosmiconfig.loadYaml
}
});
function resolveConfig(_x, _x2) {
return _resolveConfig.apply(this, arguments);
}
function _resolveConfig() {
_resolveConfig = _asyncToGenerator(function*(path, cwd) {
if (path) {
return explorer.load(path);
}
const result = yield explorer.search(cwd);