Jeff Cross 88a5b8da0f chore(transform): move transform module to modules_dart
The build/pure-packages.dart gulp task has also been updated to move the files into the angular2 tree.
Closes #3729
2015-08-24 03:39:07 +00:00

29 lines
908 B
Dart

library angular2.transform.common.asset_reader;
import 'dart:async';
import 'dart:convert';
import 'package:barback/barback.dart';
/// A class that allows fetching code using {@link AssetId}s without all the
/// additional baggage of a {@link Transform}.
abstract class AssetReader {
Future<String> readAsString(AssetId id, {Encoding encoding});
Future<bool> hasInput(AssetId id);
/// Creates an {@link AssetReader} using the `transform`, which should be a
/// {@link Transform} or {@link AggregateTransform}.
factory AssetReader.fromTransform(dynamic transform) =>
new _TransformAssetReader(transform);
}
class _TransformAssetReader implements AssetReader {
final dynamic t;
_TransformAssetReader(this.t);
Future<String> readAsString(AssetId id, {Encoding encoding}) =>
t.readInputAsString(id, encoding: encoding);
Future<bool> hasInput(AssetId id) => t.hasInput(id);
}