Interface: OutputTask<T>
index.OutputTask
A task that has a “last modified” date.
Type parameters
Name |
---|
T |
Hierarchy
Table of contents
Properties
Methods
Properties
path
• Readonly
path: Path
The filesystem location associated with the build artifact produced by this task.
Inherited from
Defined in
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
Inherited from
Defined in
build
▸ build(options
): Promise
<void
>
Parameters
Name | Type |
---|---|
options | BuilderOptions |
Returns
Promise
<void
>
Inherited from
Defined in
dest
▸ dest(baseOrPath
, fragment?
): OutputTask
<string
| Buffer
>
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 | Description |
---|---|---|
baseOrPath | null | string | Path | PathMapping | New base path; if this is the sole argument, then the source path will be replaced entirely by this path. You can also pass in a callback function which transforms the path. If null or undefined is passed, then the base path is unmodified. |
fragment? | null | string | New fragment. This is appended to the base path. This is required if the first argument is null or undefined. |
Returns
OutputTask
<string
| Buffer
>
Inherited from
Defined in
getName
▸ getName(): string
Returns
string
Inherited from
Defined in
isModified
▸ isModified(): Promise
<boolean
>
Returns
Promise
<boolean
>
Inherited from
Defined in
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 | Description |
---|---|---|
taskGen | (input : OutputTask <T >) => Dependant | A function which creates a new task, given a reference to this task. |
Returns
Dependant
A new Task which transforms the output when run.
Inherited from
Defined in
read
▸ read(): Promise
<T
>
Returns a Promise that resolves to the data output by this task. This is generally called by pipeline operators to read the data from the previous step, however operators are not required to do this.
Returns
Promise
<T
>
Inherited from
Defined in
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 | Description |
---|---|---|
transform | TransformFnAsync <T , Out > | A function which accepts the input type and returns the output type. |
Returns
Task
<Out
>
A new Task which transforms the output when run.