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.barback; | 5 library barback.barback; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'asset/asset.dart'; | 9 import 'asset/asset.dart'; |
10 import 'asset/asset_id.dart'; | 10 import 'asset/asset_id.dart'; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 /// This will not emit programming errors from barback itself. Those will be | 64 /// This will not emit programming errors from barback itself. Those will be |
65 /// emitted through the [results] stream's error channel. | 65 /// emitted through the [results] stream's error channel. |
66 Stream get errors => _graph.errors; | 66 Stream get errors => _graph.errors; |
67 | 67 |
68 /// The stream of [LogEntry] objects used to report transformer log entries. | 68 /// The stream of [LogEntry] objects used to report transformer log entries. |
69 /// | 69 /// |
70 /// If this stream has listeners, then log entries will go to that. | 70 /// If this stream has listeners, then log entries will go to that. |
71 /// Otherwise, a default logger will display them. | 71 /// Otherwise, a default logger will display them. |
72 Stream<LogEntry> get log => _graph.log; | 72 Stream<LogEntry> get log => _graph.log; |
73 | 73 |
74 Barback(PackageProvider provider) | 74 Barback(PackageProvider provider) : _graph = new PackageGraph(provider); |
75 : _graph = new PackageGraph(provider); | |
76 | 75 |
77 /// Gets the asset identified by [id]. | 76 /// Gets the asset identified by [id]. |
78 /// | 77 /// |
79 /// If [id] is for a generated or transformed asset, this will wait until | 78 /// If [id] is for a generated or transformed asset, this will wait until |
80 /// it has been created and return it. If the asset cannot be found, throws | 79 /// it has been created and return it. If the asset cannot be found, throws |
81 /// [AssetNotFoundException]. | 80 /// [AssetNotFoundException]. |
82 Future<Asset> getAssetById(AssetId id) { | 81 Future<Asset> getAssetById(AssetId id) { |
83 return _graph.getAssetNode(id).then((node) { | 82 return _graph.getAssetNode(id).then((node) { |
84 if (node == null) throw new AssetNotFoundException(id); | 83 if (node == null) throw new AssetNotFoundException(id); |
85 return node.asset; | 84 return node.asset; |
(...skipping 22 matching lines...) Expand all Loading... |
108 /// Sets the transformer phases for [package]'s assets to [transformers]. | 107 /// Sets the transformer phases for [package]'s assets to [transformers]. |
109 /// | 108 /// |
110 /// To the extent that [transformers] is similar to the previous transformer | 109 /// To the extent that [transformers] is similar to the previous transformer |
111 /// phases for [package], the existing asset graph will be preserved. | 110 /// phases for [package], the existing asset graph will be preserved. |
112 /// | 111 /// |
113 /// Elements of the inner iterable of [transformers] must be [Transformer]s, | 112 /// Elements of the inner iterable of [transformers] must be [Transformer]s, |
114 /// [TransformerGroup]s, or [AggregateTransformer]s. | 113 /// [TransformerGroup]s, or [AggregateTransformer]s. |
115 void updateTransformers(String package, Iterable<Iterable> transformers) => | 114 void updateTransformers(String package, Iterable<Iterable> transformers) => |
116 _graph.updateTransformers(package, transformers); | 115 _graph.updateTransformers(package, transformers); |
117 } | 116 } |
OLD | NEW |