2015-02-18 12:51:12 -08:00
|
|
|
library angular2.src.transform;
|
2015-02-17 08:38:54 -08:00
|
|
|
|
|
|
|
import 'package:barback/barback.dart';
|
2015-02-27 14:42:21 -08:00
|
|
|
import 'package:dart_style/dart_style.dart';
|
2015-02-17 08:38:54 -08:00
|
|
|
|
2015-02-27 14:42:21 -08:00
|
|
|
import 'directive_linker/transformer.dart';
|
|
|
|
import 'directive_processor/transformer.dart';
|
|
|
|
import 'bind_generator/transformer.dart';
|
|
|
|
import 'reflection_remover/transformer.dart';
|
2015-03-13 13:55:49 -07:00
|
|
|
import 'template_compiler/transformer.dart';
|
2015-02-27 14:42:21 -08:00
|
|
|
import 'common/formatter.dart' as formatter;
|
|
|
|
import 'common/options.dart';
|
2015-02-17 08:38:54 -08:00
|
|
|
|
2015-02-27 14:42:21 -08:00
|
|
|
export 'common/options.dart';
|
2015-02-17 08:38:54 -08:00
|
|
|
|
2015-03-13 13:55:49 -07:00
|
|
|
/// Replaces Angular 2 mirror use with generated code.
|
2015-02-27 14:42:21 -08:00
|
|
|
class AngularTransformerGroup extends TransformerGroup {
|
|
|
|
AngularTransformerGroup(TransformerOptions options) : super([
|
|
|
|
[new DirectiveProcessor(options)],
|
|
|
|
[new DirectiveLinker(options)],
|
2015-03-13 13:55:49 -07:00
|
|
|
[new BindGenerator(options)],
|
|
|
|
[new TemplateComplier(options)],
|
|
|
|
[new ReflectionRemover(options)]
|
2015-02-27 14:42:21 -08:00
|
|
|
]) {
|
|
|
|
formatter.init(new DartFormatter());
|
2015-02-17 08:38:54 -08:00
|
|
|
}
|
|
|
|
|
2015-02-27 14:42:21 -08:00
|
|
|
factory AngularTransformerGroup.asPlugin(BarbackSettings settings) {
|
|
|
|
return new AngularTransformerGroup(_parseOptions(settings));
|
2015-02-17 08:38:54 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-27 14:42:21 -08:00
|
|
|
TransformerOptions _parseOptions(BarbackSettings settings) {
|
|
|
|
var config = settings.configuration;
|
|
|
|
return new TransformerOptions(config[ENTRY_POINT_PARAM],
|
|
|
|
reflectionEntryPoint: config[REFLECTION_ENTRY_POINT_PARAM]);
|
2015-02-17 08:38:54 -08:00
|
|
|
}
|