| 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 initialize.build.loader_replacer; | |
| 5 | |
| 6 import 'dart:async'; | |
| 7 import 'package:barback/barback.dart'; | |
| 8 | |
| 9 /// Removes `mirror_loader.dart` and replaces it with `static_loader.dart`. | |
| 10 class LoaderReplacer extends Transformer { | |
| 11 LoaderReplacer.asPlugin(); | |
| 12 | |
| 13 bool isPrimary(AssetId id) => | |
| 14 id.package == 'initialize' && id.path == 'lib/initialize.dart'; | |
| 15 | |
| 16 Future apply(Transform transform) { | |
| 17 var id = transform.primaryInput.id; | |
| 18 return transform.primaryInput.readAsString().then((code) { | |
| 19 transform.addOutput(new Asset.fromString( | |
| 20 id, code.replaceFirst('mirror_loader.dart', 'static_loader.dart'))); | |
| 21 }); | |
| 22 } | |
| 23 } | |
| OLD | NEW |