Skip to main content
Version: 2x

Class: Reporter

Class that handles all reporting, logging and compilation progress handling.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Reporter(config?)

Create new instance of Reporter. If Reporter is running as a non-worker, it will start outputting to terminal.

Parameters

NameTypeDescription
configReporterConfigReporter configuration. Defaults to empty object.

Defined in

packages/repack/src/Reporter.ts:107

Properties

isVerbose

Readonly isVerbose: boolean

Whether reporter is running in verbose mode.

Defined in

packages/repack/src/Reporter.ts:91


isWorker

Readonly isWorker: boolean

Whether reporter is running as a worker.

Defined in

packages/repack/src/Reporter.ts:89

Methods

attachResponse

attachResponse(res, platform): void

attach bundle request for later use.

Parameters

NameType
resMultipartResponse
platformstring

Returns

void

Defined in

packages/repack/src/Reporter.ts:118


enableFileLogging

enableFileLogging(filename): void

Enable reporting to file alongside reporting to terminal.

Parameters

NameTypeDescription
filenamestringAbsolute path to file to which write logs.

Returns

void

Defined in

packages/repack/src/Reporter.ts:145


flushFileLogs

flushFileLogs(): void

Flush all buffered logs to a file provided that file reporting was enabled with enableFileLogging.

Returns

void

Defined in

packages/repack/src/Reporter.ts:153


getLogBuffer

getLogBuffer(): LogEntry[]

Get buffered server logs.

Returns

LogEntry[]

Array of server log entries.

Defined in

packages/repack/src/Reporter.ts:127


getPrettyProgress

getPrettyProgress(rawProgress, type?): null | RegExpExecArray

get done & total from progress message rawProgress examples: "4/8 entries 47/78 dependencies 8/36 modules"

Parameters

NameTypeDefault value
rawProgressstringundefined
type"entries" | "dependencies" | "modules"'modules'

Returns

null | RegExpExecArray

Defined in

packages/repack/src/Reporter.ts:263


process

process(logEntry): void

Process new log entry and report it to terminal and file if file reporting was enabled with enableFileLogging.

Parameters

NameTypeDescription
logEntryLogEntryLog entry to process & report.

Returns

void

Defined in

packages/repack/src/Reporter.ts:166


stop

stop(): void

Stop reporting and perform cleanup.

Returns

void

Defined in

packages/repack/src/Reporter.ts:134


colorizeText

Static colorizeText(logType, text): string

Apply ANSI colors to given text.

internal

Parameters

NameTypeDescription
logTypeLogTypeLog type for the text, based on which different colors will be applied.
textstringText to apply the color onto.

Returns

string

Text wrapped in ANSI color sequences.

Defined in

packages/repack/src/Reporter.ts:78


getSymbolForType

Static getSymbolForType(logType): string

Get message symbol for given log type.

internal

Parameters

NameTypeDescription
logTypeLogTypeLog type.

Returns

string

String with the symbol.

Defined in

packages/repack/src/Reporter.ts:61