Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ import 'package:barback/barback.dart';
///
/// The returned value wraps the [NgDepsModel] at `assetId` as well as these
/// created objects.
///
/// `platformDirectives` is an optional [List] containing names of [Directive]s
/// which should be available to all [View]s in this app.
///
/// `platformPipes` is an optional [List] containing names of [Pipe]s which
/// should be available to all [View]s in this app.
Future<CompileDataResults> createCompileData(
AssetReader reader,
AssetId assetId,
Expand Down Expand Up @@ -65,9 +71,17 @@ class _CompileDataCreator {
NgDepsModel get ngDeps => ngMeta.ngDeps;

Future<CompileDataResults> createCompileData() async {
if (ngDeps == null || ngDeps.reflectables == null) {
return new CompileDataResults._(ngMeta, const {});
}
var hasTemplate = ngDeps != null &&
ngDeps.reflectables != null &&
ngDeps.reflectables.any((reflectable) {
if (ngMeta.types.containsKey(reflectable.name)) {
final metadata = ngMeta.types[reflectable.name];
return metadata is CompileDirectiveMetadata &&
metadata.template != null;
}
return false;
});
if (!hasTemplate) return new CompileDataResults._(ngMeta, const {});

final compileData =
<ReflectionInfoModel, NormalizedComponentWithViewDirectives>{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ import 'reflection/processor.dart' as reg;
import 'reflection/reflection_capabilities.dart';
import 'compile_data_creator.dart';

/// Reads the `.ng_deps.dart` file represented by `assetId` and parses any
/// Angular 2 `View` annotations it declares to generate `getter`s,
/// `setter`s, and `method`s that would otherwise be reflectively accessed.
/// Generates `.ng_deps.dart` files to initialize the Angular2 system.
///
/// Processes the `.ng_summary.json` file represented by `assetId`
/// `createCompileData`.
/// Uses the resulting `NgMeta` object to generate
/// `getter`s, `setter`s, and `method`s that would otherwise need to be
/// reflectively accessed.
/// Passes the resulting `NormalizedComponentWithViewDirectives` instances
/// to the `TemplateCompiler` to generate compiled template(s).
/// Uses the resulting `NgDeps` object to generate a .ng_deps.dart file which
/// initializes the Angular2 reflective system.
///
/// This method assumes a {@link DomAdapter} has been registered.
Future<Outputs> processTemplates(AssetReader reader, AssetId assetId,
Expand Down