| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library barback.asset_provider; | 5 library barback.asset_provider; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'asset.dart'; | 9 import 'asset.dart'; |
| 10 import 'asset_id.dart'; | 10 import 'asset_id.dart'; |
| 11 import 'transformer.dart'; |
| 11 | 12 |
| 12 /// API for locating and accessing packages on disk. | 13 /// API for locating and accessing packages on disk. |
| 13 /// | 14 /// |
| 14 /// Implemented by pub and provided to barback so that it isn't coupled | 15 /// Implemented by pub and provided to barback so that it isn't coupled |
| 15 /// directly to pub. | 16 /// directly to pub. |
| 16 abstract class AssetProvider { | 17 abstract class AssetProvider { |
| 17 /// The names of all packages that can be provided by this provider. | 18 /// The names of all packages that can be provided by this provider. |
| 18 /// | 19 /// |
| 19 /// This is equal to the transitive closure of the entrypoint package | 20 /// This is equal to the transitive closure of the entrypoint package |
| 20 /// dependencies. | 21 /// dependencies. |
| 21 Iterable<String> get packages; | 22 Iterable<String> get packages; |
| 22 | 23 |
| 23 // TODO(rnystrom): Make this async. | 24 // TODO(rnystrom): Make this async. |
| 24 /// The paths of all available asset files in [package], relative to the | 25 /// The paths of all available asset files in [package], relative to the |
| 25 /// package's root directory. | 26 /// package's root directory. |
| 26 /// | 27 /// |
| 27 /// You can pass [within], which should be the relative path to a directory | 28 /// You can pass [within], which should be the relative path to a directory |
| 28 /// within the package, to only return the files within that subdirectory. | 29 /// within the package, to only return the files within that subdirectory. |
| 29 List<AssetId> listAssets(String package, {String within}); | 30 List<AssetId> listAssets(String package, {String within}); |
| 30 | 31 |
| 32 /// Returns the list of transformer phases that are applicable to [package]. |
| 33 /// |
| 34 /// The phases will be run in sequence, with the outputs of one pipelined into |
| 35 /// the next. All [Transformer]s in a single phase will be run in parallel. |
| 36 Iterable<Iterable<Transformer>> getTransformers(String package); |
| 37 |
| 31 Future<Asset> getAsset(AssetId id); | 38 Future<Asset> getAsset(AssetId id); |
| 32 } | 39 } |
| OLD | NEW |