fix(dart/transform): Handle empty .ng_deps.dart files

Handle the situation where a `.dart` file generates a `.ng_meta.json`
file but does not register any reflective information.

An example of this would be a file that defines a const list that looks
like a directive alias. The transformer keeps track of this, and creates
a `.ng_meta.json` file but never creates a `.ng_deps.dart` file, which
can result in other files being linked to it and it not defining an
`initReflector` method.
This commit is contained in:
Tim Blasi
2015-10-13 17:58:09 -07:00
parent 115ad4d062
commit 5a505975bf
6 changed files with 53 additions and 1 deletions

View File

@ -64,7 +64,8 @@ class DirectiveMetadataLinker extends Transformer
transform
.addOutput(new Asset.fromString(depsAssetId, formattedCode));
} else {
transform.addOutput(new Asset.fromString(depsAssetId, ''));
transform.addOutput(
new Asset.fromString(depsAssetId, _emptyNgDepsContents));
}
}
});
@ -74,3 +75,5 @@ class DirectiveMetadataLinker extends Transformer
AssetId _depsAssetId(AssetId primaryId) =>
new AssetId(primaryId.package, toDepsExtension(primaryId.path));
const _emptyNgDepsContents = 'initReflector() {}';