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 parcel/packages/core/types/index.js:1202

type ProgressLogEvent = {|
  +type: 'log',
  +level: 'progress',
  +phase?: string,
  +message: string,
|}
Referenced by:
LogEvent

DiagnosticLogEvent parcel/packages/core/types/index.js:1213

A log event with a rich diagnostic

type DiagnosticLogEvent = {|
  +type: 'log',
  +level: 'error' | 'warn' | 'info' | 'verbose',
  +diagnostics: Array<Diagnostic>,
|}
Referenced by:
LogEvent

TextLogEvent parcel/packages/core/types/index.js:1222

type TextLogEvent = {|
  +type: 'log',
  +level: 'success',
  +message: string,
|}
Referenced by:
LogEvent

BuildStartEvent parcel/packages/core/types/index.js:1237

The build just started.

type BuildStartEvent = {|
  +type: 'buildStart',
|}
Referenced by:
ReporterEvent

WatchStartEvent parcel/packages/core/types/index.js:1245

The build just started in watch mode.

type WatchStartEvent = {|
  +type: 'watchStart',
|}
Referenced by:
ReporterEvent

WatchEndEvent parcel/packages/core/types/index.js:1253

The build just ended in watch mode.

type WatchEndEvent = {|
  +type: 'watchEnd',
|}
Referenced by:
ReporterEvent

ResolvingProgressEvent parcel/packages/core/types/index.js:1261

A new Dependency is being resolved.

type ResolvingProgressEvent = {|
  +type: 'buildProgress',
  +phase: 'resolving',
  +dependency: Dependency,
|}
Referenced by:
BuildProgressEvent

TransformingProgressEvent parcel/packages/core/types/index.js:1271

A new Asset is being transformed.

type TransformingProgressEvent = {|
  +type: 'buildProgress',
  +phase: 'transforming',
  +filePath: FilePath,
|}
Referenced by:
BuildProgressEvent

BundlingProgressEvent parcel/packages/core/types/index.js:1281

The BundleGraph is generated.

type BundlingProgressEvent = {|
  +type: 'buildProgress',
  +phase: 'bundling',
|}
Referenced by:
BuildProgressEvent

PackagingProgressEvent parcel/packages/core/types/index.js:1290

A new Bundle is being packaged.

type PackagingProgressEvent = {|
  +type: 'buildProgress',
  +phase: 'packaging',
  +bundle: NamedBundle,
|}
Referenced by:
BuildProgressEvent

OptimizingProgressEvent parcel/packages/core/types/index.js:1300

A new Bundle is being optimized.

type OptimizingProgressEvent = {|
  +type: 'buildProgress',
  +phase: 'optimizing',
  +bundle: NamedBundle,
|}
Referenced by:
BuildProgressEvent

BuildSuccessEvent parcel/packages/core/types/index.js:1320

The build was successful.

type BuildSuccessEvent = {|
  +type: 'buildSuccess',
  +bundleGraph: BundleGraph<NamedBundle>,
  +buildTime: number,
  +changedAssets: Map<string, Asset>,
|}
Referenced by:
BuildEvent, ReporterEvent

BuildFailureEvent parcel/packages/core/types/index.js:1331

The build failed.

type BuildFailureEvent = {|
  +type: 'buildFailure',
  +diagnostics: Array<Diagnostic>,
|}
Referenced by:
BuildEvent, ReporterEvent

ValidationEvent parcel/packages/core/types/index.js:1345

A new file is being validated.

type ValidationEvent = {|
  +type: 'validation',
  +filePath: FilePath,
|}
Referenced by:
ReporterEvent

Reporter parcel/packages/core/types/index.js:1366

type Reporter = {|
  report({|
    event: ReporterEvent,
    options: PluginOptions,
    logger: PluginLogger,
  |}): Async<void>,
|}