| 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.transformer; | 5 library barback.transformer; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'asset.dart'; | 9 import 'asset.dart'; |
| 10 import 'operator.dart'; |
| 10 import 'transform.dart'; | 11 import 'transform.dart'; |
| 11 | 12 |
| 12 /// A [Transformer] represents a processor that takes in one or more input | 13 /// A [Transformer] represents a processor that takes in one or more input |
| 13 /// assets and uses them to generate one or more output assets. | 14 /// assets and uses them to generate one or more output assets. |
| 14 /// | 15 /// |
| 15 /// Dart2js, a SASS->CSS processor, a CSS spriter, and a tool to concatenate | 16 /// Dart2js, a SASS->CSS processor, a CSS spriter, and a tool to concatenate |
| 16 /// files are all examples of transformers. To define your own transformation | 17 /// files are all examples of transformers. To define your own transformation |
| 17 /// step, extend (or implement) this class. | 18 /// step, extend (or implement) this class. |
| 18 abstract class Transformer { | 19 abstract class Transformer implements Operator { |
| 19 /// Override this to return a space-separated list of file extensions | 20 /// Override this to return a space-separated list of file extensions |
| 20 /// (with leading `.`) that are allowed for the primary inputs to this | 21 /// (with leading `.`) that are allowed for the primary inputs to this |
| 21 /// transformer. | 22 /// transformer. |
| 22 /// | 23 /// |
| 23 /// If you don't override [isPrimary] yourself, it defaults to allowing any | 24 /// If you don't override [isPrimary] yourself, it defaults to allowing any |
| 24 /// asset whose extension matches one of the ones returned by this. If you | 25 /// asset whose extension matches one of the ones returned by this. If you |
| 25 /// don't override [isPrimary] *or* this, it allows all files. | 26 /// don't override [isPrimary] *or* this, it allows all files. |
| 26 String get allowedExtensions => null; | 27 String get allowedExtensions => null; |
| 27 | 28 |
| 28 /// Returns `true` if [input] can be a primary input for this transformer. | 29 /// Returns `true` if [input] can be a primary input for this transformer. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 /// generated assets back to the system. Either can be called multiple times, | 61 /// generated assets back to the system. Either can be called multiple times, |
| 61 /// in any order. | 62 /// in any order. |
| 62 /// | 63 /// |
| 63 /// In other words, a Transformer's job is to find all inputs for a | 64 /// In other words, a Transformer's job is to find all inputs for a |
| 64 /// transform, starting at the primary input, then generate all output assets | 65 /// transform, starting at the primary input, then generate all output assets |
| 65 /// and yield them back to the transform. | 66 /// and yield them back to the transform. |
| 66 Future apply(Transform transform); | 67 Future apply(Transform transform); |
| 67 | 68 |
| 68 String toString() => runtimeType.toString().replaceAll("Transformer", ""); | 69 String toString() => runtimeType.toString().replaceAll("Transformer", ""); |
| 69 } | 70 } |
| OLD | NEW |