Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
error(input: Diagnostifiable, realOrigin?: string): void {
// $FlowFixMe origin is undefined on PluginInputDiagnostic
let diagnostic = anyToDiagnostic(input);
if (typeof realOrigin === 'string') {
diagnostic = Array.isArray(diagnostic)
? diagnostic.map(d => {
return {...d, origin: realOrigin};
})
: {
...diagnostic,
origin: realOrigin,
};
}
this.#logEmitter.emit({
type: 'log',
level: 'error',
diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic],
});
error(input: Diagnostifiable, realOrigin?: string): void {
// $FlowFixMe origin is undefined on PluginInputDiagnostic
let diagnostic = anyToDiagnostic(input);
if (typeof realOrigin === 'string') {
diagnostic = Array.isArray(diagnostic)
? diagnostic.map(d => {
return {...d, origin: realOrigin};
})
: {
...diagnostic,
origin: realOrigin,
};
}
this.#logEmitter.emit({
type: 'log',
level: 'error',
diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic],
});
]),
),
bundleGraph: new BundleGraph(bundleGraph, options),
buildTime: Date.now() - startTime,
};
this.#reporterRunner.report(event);
await this.#assetGraphBuilder.validate();
return event;
} catch (e) {
if (e instanceof BuildAbortError) {
throw e;
}
let diagnostic = anyToDiagnostic(e);
let event = {
type: 'buildFailure',
diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic],
};
await this.#reporterRunner.report(event);
return event;
} finally {
if (options.profile) {
await this.#farm.endProfile();
}
}
}
const errorResponseFromError = (e: Error): WorkerErrorResponse => ({
idx,
child,
type: 'response',
contentType: 'error',
content: anyToDiagnostic(e),
});
const errorResponseFromError = (e: Error): WorkerErrorResponse => ({
idx,
type: 'response',
contentType: 'error',
content: anyToDiagnostic(e),
});