Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function restart(): Promise {
if (restarting) {
return;
} else {
restarting = true;
}
if (server) {
// eslint-disable-next-line no-console
console.log('Configuration changed. Restarting the server...');
await promisify(server.close).call(server);
}
const config = await loadConfig(argv);
server = await MetroApi.runServer(config, argv);
restarting = false;
}
async function restart(): Promise {
if (restarting) {
return;
} else {
restarting = true;
}
if (server) {
// eslint-disable-next-line no-console
console.log('Configuration changed. Restarting the server...');
await promisify(server.close).call(server);
}
const config = await loadConfig(argv);
server = await MetroApi.runServer(config, argv);
restarting = false;
}
async function configure(flags) {
const reactNativePath = path.dirname(require.resolve('react-native/package.json'));
const config = await loadConfig();
const custom = {
resolver: {},
serializer: {},
transformer: {},
cacheStores: [
new FileStore({
root: flags['cache-location']
})
]
};
//
// We need to create a fake package name that we will point to the root
// of the users directory so we can resolve their requires and test files
// without having to rely on `package.json` based resolve due to poor
// handling of absolute and relative paths.
handler: makeAsyncCommand(async (argv: any) => {
const config = await loadConfig(argv);
await MetroApi.runBuild(config, {
...argv,
onBegin: (): void => {
updateReporter.update({
buildID: '$',
type: 'bundle_build_started',
bundleDetails: {
entryFile: argv.entry,
platform: argv.platform,
dev: !!argv.dev,
minify: !!argv.optimize,
bundleType: 'Bundle',
},
});
},
handler: makeAsyncCommand(async (argv: any) => {
const config = await loadConfig(argv);
await dependencies(argv, config);
}),
});
handler: makeAsyncCommand(async (argv: any) => {
const config = await loadConfig(argv);
await MetroApi.runBuild(config, {
...argv,
onBegin: (): void => {
updateReporter.update({
buildID: '$',
type: 'bundle_build_started',
bundleDetails: {
entryFile: argv.entry,
platform: argv.platform,
dev: !!argv.dev,
minify: !!argv.optimize,
bundleType: 'Bundle',
},
});
},
export default async function load(
ctx: ContextT,
options?: ConfigOptionsT = {}
): Promise {
const defaultConfig = getDefaultConfig(ctx);
const config = await loadConfig(
{
cwd: ctx.root,
...options,
},
defaultConfig
);
return config;
}
export default function load(
ctx: Config,
options?: ConfigOptionsT,
): Promise {
const defaultConfig = getDefaultConfig(ctx);
if (options && options.reporter) {
defaultConfig.reporter = options.reporter;
}
return loadConfig({cwd: ctx.root, ...options}, defaultConfig);
}
async load(configFile: ?string): Promise {
const argv = {cwd: getProjectRoot()};
return await loadConfig(
configFile ? {...argv, config: configFile} : argv,
this.DEFAULT,
);
},
};
async load(configFile: ?string): Promise {
const argv = {cwd: getProjectRoot()};
return await loadConfig(
configFile ? {...argv, config: configFile} : argv,
this.DEFAULT,
);
},
};