Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Side by Side Diff: pkg/barback/lib/src/transformer.dart

Issue 25376003: Add support for transformer clusters to barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Expose the Operator class. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698