File tree Expand file tree Collapse file tree 2 files changed +28
-6
lines changed
modules_dart/transform/lib/src/transform/template_compiler Expand file tree Collapse file tree 2 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ import 'package:barback/barback.dart';
1919///
2020/// The returned value wraps the [NgDepsModel] at `assetId` as well as these
2121/// created objects.
22+ ///
23+ /// `platformDirectives` is an optional [List] containing names of [Directive] s
24+ /// which should be available to all [View] s in this app.
25+ ///
26+ /// `platformPipes` is an optional [List] containing names of [Pipe] s which
27+ /// should be available to all [View] s in this app.
2228Future <CompileDataResults > createCompileData (
2329 AssetReader reader,
2430 AssetId assetId,
@@ -65,9 +71,17 @@ class _CompileDataCreator {
6571 NgDepsModel get ngDeps => ngMeta.ngDeps;
6672
6773 Future <CompileDataResults > createCompileData () async {
68- if (ngDeps == null || ngDeps.reflectables == null ) {
69- return new CompileDataResults ._(ngMeta, const {});
70- }
74+ var hasTemplate = ngDeps != null &&
75+ ngDeps.reflectables != null &&
76+ ngDeps.reflectables.any ((reflectable) {
77+ if (ngMeta.types.containsKey (reflectable.name)) {
78+ final metadata = ngMeta.types[reflectable.name];
79+ return metadata is CompileDirectiveMetadata &&
80+ metadata.template != null ;
81+ }
82+ return false ;
83+ });
84+ if (! hasTemplate) return new CompileDataResults ._(ngMeta, const {});
7185
7286 final compileData =
7387 < ReflectionInfoModel , NormalizedComponentWithViewDirectives > {};
Original file line number Diff line number Diff line change @@ -22,9 +22,17 @@ import 'reflection/processor.dart' as reg;
2222import 'reflection/reflection_capabilities.dart' ;
2323import 'compile_data_creator.dart' ;
2424
25- /// Reads the `.ng_deps.dart` file represented by `assetId` and parses any
26- /// Angular 2 `View` annotations it declares to generate `getter` s,
27- /// `setter` s, and `method` s that would otherwise be reflectively accessed.
25+ /// Generates `.ng_deps.dart` files to initialize the Angular2 system.
26+ ///
27+ /// Processes the `.ng_summary.json` file represented by `assetId`
28+ /// `createCompileData` .
29+ /// Uses the resulting `NgMeta` object to generate
30+ /// `getter` s, `setter` s, and `method` s that would otherwise need to be
31+ /// reflectively accessed.
32+ /// Passes the resulting `NormalizedComponentWithViewDirectives` instances
33+ /// to the `TemplateCompiler` to generate compiled template(s).
34+ /// Uses the resulting `NgDeps` object to generate a .ng_deps.dart file which
35+ /// initializes the Angular2 reflective system.
2836///
2937/// This method assumes a {@link DomAdapter} has been registered.
3038Future <Outputs > processTemplates (AssetReader reader, AssetId assetId,
You can’t perform that action at this time.
0 commit comments