OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 library web_components.build.mirrors_remover; |
| 5 |
| 6 import 'dart:async'; |
| 7 import 'package:barback/barback.dart'; |
| 8 |
| 9 /// Removes `mirror_initializer.dart` and replaces it with |
| 10 /// `static_initializer.dart`. |
| 11 class MirrorsRemoverTransformer extends Transformer { |
| 12 MirrorsRemoverTransformer(); |
| 13 MirrorsRemoverTransformer.asPlugin(BarbackSettings settings); |
| 14 |
| 15 bool isPrimary(AssetId id) => id.path == 'lib/src/init.dart'; |
| 16 |
| 17 @override |
| 18 Future apply(Transform transform) async { |
| 19 String source = await transform.primaryInput.readAsString(); |
| 20 source = source.replaceFirst( |
| 21 'mirror_initializer.dart', 'static_initializer.dart'); |
| 22 transform.addOutput( |
| 23 new Asset.fromString(transform.primaryInput.id, source)); |
| 24 } |
| 25 } |
OLD | NEW |