Reporter
A plugin type: Listen to events of the build
Reporters receive events as they happen and can output to stdout/stderr, or perform other actions.
import {Reporter} from '@parcel/plugin';
export default new Reporter({
async report({ event: { type, ... } }) {
// ...
}
});
¶ Relevant API
ProgressLogEvent website/generate-api-docs/example.flow:1122
type ProgressLogEvent = {|
+type: "log",
+level: "progress",
+phase?: string,
+message: string,
|}
Referenced by:
LogEventDiagnosticLogEvent website/generate-api-docs/example.flow:1133
A log event with a rich diagnostic
type DiagnosticLogEvent = {|
+type: "log",
+level: "error" | "warn" | "info" | "verbose",
+diagnostics: Array<Diagnostic>,
|}
Referenced by:
LogEventTextLogEvent website/generate-api-docs/example.flow:1142
type TextLogEvent = {|
+type: "log",
+level: "success",
+message: string,
|}
Referenced by:
LogEventLogEvent website/generate-api-docs/example.flow:1151
Type
type LogEvent = ProgressLogEvent | DiagnosticLogEvent | TextLogEvent;
Referenced by:
ReporterEventBuildStartEvent website/generate-api-docs/example.flow:1157
The build just started.
type BuildStartEvent = {|
+type: "buildStart",
|}
Referenced by:
ReporterEventWatchStartEvent website/generate-api-docs/example.flow:1165
The build just started in watch mode.
type WatchStartEvent = {|
+type: "watchStart",
|}
Referenced by:
ReporterEventWatchEndEvent website/generate-api-docs/example.flow:1173
The build just ended in watch mode.
type WatchEndEvent = {|
+type: "watchEnd",
|}
Referenced by:
ReporterEventResolvingProgressEvent website/generate-api-docs/example.flow:1181
A new Dependency is being resolved.
type ResolvingProgressEvent = {|
+type: "buildProgress",
+phase: "resolving",
+dependency: Dependency,
|}
Referenced by:
BuildProgressEventTransformingProgressEvent website/generate-api-docs/example.flow:1191
A new Asset is being transformed.
type TransformingProgressEvent = {|
+type: "buildProgress",
+phase: "transforming",
+filePath: FilePath,
|}
Referenced by:
BuildProgressEventBundlingProgressEvent website/generate-api-docs/example.flow:1201
The BundleGraph is generated.
type BundlingProgressEvent = {|
+type: "buildProgress",
+phase: "bundling",
|}
Referenced by:
BuildProgressEventPackagingProgressEvent website/generate-api-docs/example.flow:1210
A new Bundle is being packaged.
type PackagingProgressEvent = {|
+type: "buildProgress",
+phase: "packaging",
+bundle: NamedBundle,
|}
Referenced by:
BuildProgressEventOptimizingProgressEvent website/generate-api-docs/example.flow:1220
A new Bundle is being optimized.
type OptimizingProgressEvent = {|
+type: "buildProgress",
+phase: "optimizing",
+bundle: NamedBundle,
|}
Referenced by:
BuildProgressEventBuildProgressEvent website/generate-api-docs/example.flow:1229
Type
type BuildProgressEvent = ResolvingProgressEvent | TransformingProgressEvent | BundlingProgressEvent | PackagingProgressEvent | OptimizingProgressEvent;
Referenced by:
ReporterEventBuildSuccessEvent website/generate-api-docs/example.flow:1240
The build was successful.
type BuildSuccessEvent = {|
+type: "buildSuccess",
+bundleGraph: BundleGraph<NamedBundle>,
+buildTime: number,
+changedAssets: Map<string, Asset>,
|}
Referenced by:
BuildEvent, ReporterEventBuildFailureEvent website/generate-api-docs/example.flow:1251
The build failed.
type BuildFailureEvent = {|
+type: "buildFailure",
+diagnostics: Array<Diagnostic>,
|}
Referenced by:
BuildEvent, ReporterEventBuildEvent website/generate-api-docs/example.flow:1259
Type
type BuildEvent = BuildFailureEvent | BuildSuccessEvent;
ValidationEvent website/generate-api-docs/example.flow:1265
A new file is being validated.
type ValidationEvent = {|
+type: "validation",
+filePath: FilePath,
|}
Referenced by:
ReporterEventReporterEvent website/generate-api-docs/example.flow:1273
Type
type ReporterEvent = LogEvent | BuildStartEvent | BuildProgressEvent | BuildSuccessEvent | BuildFailureEvent | WatchStartEvent | WatchEndEvent | ValidationEvent;
Referenced by:
ReporterReporter website/generate-api-docs/example.flow:1287
A build event listener
type Reporter = {|
report({|
event: ReporterEvent,
options: PluginOptions,
logger: PluginLogger,
|}): Async<void>,
|}