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:
@ -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() {}';
|
||||
|
Reference in New Issue
Block a user