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 pub.dart_forwarding_transformer; | |
6 | |
7 import 'dart:async'; | 5 import 'dart:async'; |
8 | 6 |
9 import 'package:barback/barback.dart'; | 7 import 'package:barback/barback.dart'; |
10 | 8 |
11 import '../utils.dart'; | 9 import '../utils.dart'; |
12 | 10 |
13 /// A single transformer that just forwards any ".dart" file as an output when | 11 /// A single transformer that just forwards any ".dart" file as an output when |
14 /// not in release mode. | 12 /// not in release mode. |
15 /// | 13 /// |
16 /// Since the [Dart2JSTransformer] consumes its inputs, this is used in | 14 /// Since the [Dart2JSTransformer] consumes its inputs, this is used in |
17 /// parallel to make sure the original Dart file is still available for use by | 15 /// parallel to make sure the original Dart file is still available for use by |
18 /// Dartium. | 16 /// Dartium. |
19 class DartForwardingTransformer extends Transformer { | 17 class DartForwardingTransformer extends Transformer { |
20 DartForwardingTransformer(); | 18 DartForwardingTransformer(); |
21 | 19 |
22 String get allowedExtensions => ".dart"; | 20 String get allowedExtensions => ".dart"; |
23 | 21 |
24 Future apply(Transform transform) { | 22 Future apply(Transform transform) { |
25 return newFuture(() { | 23 return newFuture(() { |
26 transform.addOutput(transform.primaryInput); | 24 transform.addOutput(transform.primaryInput); |
27 }); | 25 }); |
28 } | 26 } |
29 } | 27 } |
OLD | NEW |