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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/barback/dart_forwarding_transformer.dart

Issue 141113011: Support directories other than "web" in pub build. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 6 years, 10 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 pub.dart_forwarding_transformer; 5 library pub.dart_forwarding_transformer;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:barback/barback.dart'; 9 import 'package:barback/barback.dart';
10 10
11 import '../utils.dart'; 11 import '../utils.dart';
12 12
13 /// A single transformer that just forwards any ".dart" file as an output when 13 /// A single transformer that just forwards any ".dart" file as an output when
14 /// not in release mode. 14 /// not in release mode.
15 /// 15 ///
16 /// Since the [Dart2JSTransformer] consumes its inputs, this is used in 16 /// 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 17 /// parallel to make sure the original Dart file is still available for use by
18 /// Dartium. In release mode, it's used to the do the exact opposite: it 18 /// Dartium.
19 /// ensures that no Dart files are emitted, since all that is deployed is the
20 /// compiled JavaScript.
21 class DartForwardingTransformer extends Transformer { 19 class DartForwardingTransformer extends Transformer {
22 /// The mode that the transformer is running in. 20 /// The mode that the transformer is running in.
23 final BarbackMode _mode; 21 final BarbackMode _mode;
24 22
25 DartForwardingTransformer(this._mode); 23 DartForwardingTransformer(this._mode);
26 24
27 String get allowedExtensions => ".dart"; 25 String get allowedExtensions => ".dart";
28 26
29 Future apply(Transform transform) { 27 Future apply(Transform transform) {
30 return newFuture(() { 28 return newFuture(() {
31 if (_mode != BarbackMode.RELEASE) { 29 transform.addOutput(transform.primaryInput);
32 transform.addOutput(transform.primaryInput);
33 }
34 }); 30 });
35 } 31 }
36 } 32 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698