| Index: pkg/barback/lib/src/base_transform.dart
|
| diff --git a/pkg/barback/lib/src/base_transform.dart b/pkg/barback/lib/src/base_transform.dart
|
| index d03f4b3a98ceb0cc669e9b9ea420e72fb23fb26f..64945ee72eaac2decbc065e04992a52302e038a1 100644
|
| --- a/pkg/barback/lib/src/base_transform.dart
|
| +++ b/pkg/barback/lib/src/base_transform.dart
|
| @@ -24,6 +24,11 @@ import 'utils.dart';
|
| abstract class BaseTransform {
|
| final TransformNode _node;
|
|
|
| + /// Whether the primary input should be consumed.
|
| + ///
|
| + /// This is exposed via [BaseTransformController].
|
| + bool _consumePrimary = false;
|
| +
|
| /// The controller for the stream of log entries emitted by the transformer.
|
| ///
|
| /// This is exposed via [BaseTransformController].
|
| @@ -94,6 +99,17 @@ abstract class BaseTransform {
|
| /// If the asset was created from a [String], this returns its UTF-8 encoding.
|
| Stream<List<int>> readInput(AssetId id) =>
|
| futureStream(getInput(id).then((input) => input.read()));
|
| +
|
| + /// Consume the primary input so that it doesn't get processed by future
|
| + /// phases or emitted once processing has finished.
|
| + ///
|
| + /// Normally the primary input will automatically be forwarded unless the
|
| + /// transformer overwrites it by emitting an input with the same id. This
|
| + /// allows the transformer to tell barback not to forward the primary input
|
| + /// even if it's not overwritten.
|
| + void consumePrimary() {
|
| + _consumePrimary = true;
|
| + }
|
| }
|
|
|
| /// The base class for controllers of subclasses of [BaseTransform].
|
| @@ -104,6 +120,9 @@ abstract class BaseTransformController {
|
| /// The [BaseTransform] controlled by this controller.
|
| final BaseTransform transform;
|
|
|
| + /// Whether the primary input should be consumed.
|
| + bool get consumePrimary => transform._consumePrimary;
|
| +
|
| /// The stream of log entries emitted by the transformer during a run.
|
| Stream<LogEntry> get onLog => transform._onLogController.stream;
|
|
|
|
|