Skip to main content Link Menu Expand (external link) Document Search Copy Copied

overrun / index / SourceFileTask

Class: SourceFileTask

index.SourceFileTask

A task which reads a source file and returns a buffer.

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new SourceFileTask(path, stats?)

Parameters

Name Type
path Path
stats? Stats

Overrides

AbstractTask.constructor

Defined in

SourceFileTask.ts:13

Properties

path

Readonly path: Path

The filesystem location associated with the build artifact produced by this task.

Inherited from

AbstractTask.path

Methods

addDependent

addDependent(dependent, dependencies): void

Mark a task as being dependent on this task, meaning that the target is considered to be out of date when any of its dependencies are out of date.

Parameters

Name Type
dependent Task<unknown>
dependencies Set<SourceTask>

Returns

void

Overrides

AbstractTask.addDependent

Defined in

SourceFileTask.ts:20


dest

dest(baseOrPath, fragment?): OutputFileTask

Create an output task that writes to a specified location. This method is only valid if the output type of the task is a string or Buffer object.

Examples:

path.dest(newPath);
path.dest(newBase, null);
path.dest(null, newFragment);
path.dest(path => path.withBase(newBase));

Parameters

Name Type
baseOrPath null | string | Path | PathMapping
fragment? null | string

Returns

OutputFileTask

Inherited from

AbstractTask.dest

Defined in

AbstractTask.ts:24


getModTime

getModTime(): Promise<Date>

Return the modification date of this source file.

Returns

Promise<Date>

Defined in

SourceFileTask.ts:26


pipe

pipe<Out, Dependant>(taskGen): Dependant

Pipe the output of this task through another task. Similar to transform(), except that it allows more flexibility in processing.

Type parameters

Name Type
Out Out
Dependant extends Task<Out, Dependant>

Parameters

Name Type
taskGen (input: SourceFileTask) => Dependant

Returns

Dependant

Inherited from

AbstractTask.pipe

Defined in

AbstractTask.ts:20


read

read(): Promise<Buffer>

Return the output of the task.

Returns

Promise<Buffer>

Overrides

AbstractTask.read

Defined in

SourceFileTask.ts:31


transform

transform<Out>(transform): Task<Out>

Creates a new task which transforms the output of this task’s data. The transform argument is a function which accepts the task’s output as an argument, and which returns either the transformed data or a promise which resolves to that data.

The task created will list the current task as a dependency, so if the source file is changed the transform task will be re-run.

Type parameters

Name
Out

Parameters

Name Type
transform (input: Buffer) => Out | Promise<Out>

Returns

Task<Out>

Inherited from

AbstractTask.transform

Defined in

AbstractTask.ts:16