Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getLoader() {
// FIXME refactor getLoader to not rely on class instantiation to avoid type conflict or implement an default Ora Loader Class definition
return logger.isVerbose() ? OraNoop : (ora as any);
}
metroConfig.transformer.assetPlugins = args.assetPlugins.map(plugin =>
require.resolve(plugin),
);
}
const middlewareManager = new MiddlewareManager({
host: args.host,
port: metroConfig.server.port,
watchFolders: metroConfig.watchFolders,
});
middlewareManager.getConnectInstance().use(
// @ts-ignore morgan and connect types mismatch
morgan(
'combined',
!logger.isVerbose()
? {
skip: (_req, res) => res.statusCode < 400,
}
: undefined,
),
);
metroConfig.watchFolders.forEach(
middlewareManager.serveStatic.bind(middlewareManager),
);
const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;
metroConfig.server.enhanceMiddleware = (middleware: any, server: unknown) => {
if (customEnhanceMiddleware) {
middleware = customEnhanceMiddleware(middleware, server);
buildProcess.stdout.on('data', (data: Buffer) => {
const stringData = data.toString();
buildOutput += stringData;
if (xcpretty) {
xcpretty.stdin.write(data);
} else {
if (logger.isVerbose()) {
logger.debug(stringData);
} else {
process.stdout.write('.');
}
}
});
buildProcess.stderr.on('data', (data: Buffer) => {
function executeCommand(
command: string,
args: Array,
options: Options,
) {
return execa(command, args, {
stdio: options.silent && !logger.isVerbose() ? 'pipe' : 'inherit',
cwd: options.root,
});
}