Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.on('data', (message: YarnStdOutMessage) => {
switch (message.type) {
case 'step':
logger.progress(
prefix(
`[${message.data.current}/${message.data.total}] ${message.data.message}`,
),
);
return;
case 'success':
case 'info':
logger.info({
origin: '@parcel/package-manager',
message: prefix(message.data),
});
return;
default:
// ignore
}
});
bus.on('logEvent', (e: LogEvent) => {
switch (e.level) {
case 'info':
invariant(typeof e.message === 'string');
Logger.info(e.message);
break;
case 'progress':
invariant(typeof e.message === 'string');
Logger.progress(e.message);
break;
case 'verbose':
invariant(typeof e.message === 'string');
Logger.verbose(e.message);
break;
case 'warn':
Logger.warn(e.message);
break;
case 'error':
Logger.error(e.message);
break;
default:
async report(event: ReporterEvent, options: ParcelOptions) {
let logLevelFilter = options.logLevel || 'info';
if (
event.type !== 'buildSuccess' ||
LOG_LEVELS[logLevelFilter] < LOG_LEVELS.info
) {
return;
}
event.bundleGraph.getBundles();
Logger.info(
'Number of lines: ' + (await lineCounter(event.bundleGraph.getBundles()))
);
}
});
var profiles = await Promise.all(promises);
let trace = new Trace();
let filename = `profile-${profileId++}.trace`;
let stream = trace.pipe(fs.createWriteStream(filename));
for (let profile of profiles) {
trace.addCPUProfile(names.shift(), profile);
}
trace.flush();
await new Promise(resolve => {
stream.once('finish', resolve);
});
logger.info({
origin: '@parcel/workers',
message: `Wrote profile to ${filename}`,
});
}