feat(dart/transform): Remove unnecessary .ng_deps.dart files

Removes `.ng_deps.dart` files which

1. Do not register any `@Injectable` classes
2. Do not call `initReflector` on any other `.ng_deps.dart` files.

Closes #1929
This commit is contained in:
Tim Blasi
2015-05-22 14:15:18 -07:00
parent cda35101df
commit c065fb1422
15 changed files with 166 additions and 65 deletions

View File

@ -50,13 +50,18 @@ void _testNgDeps(String name, String inputPath,
reader.addAsset(assetId, await reader.readAsString(inputId));
inputId = assetId;
}
var annotationMatcher = new AnnotationMatcher()..addAll(customDescriptors);
var output = formatter
.format(await createNgDeps(reader, inputId, annotationMatcher));
var expectedPath = path.join(path.dirname(inputPath), 'expected',
path.basename(inputPath).replaceFirst('.dart', '.ng_deps.dart'));
var expectedId = _assetIdForPath(expectedPath);
expect(output).toEqual(await reader.readAsString(expectedId));
var annotationMatcher = new AnnotationMatcher()..addAll(customDescriptors);
var output = await createNgDeps(reader, inputId, annotationMatcher);
if (output == null) {
expect(await reader.hasInput(expectedId)).toBeFalse();
} else {
expect(formatter.format(output))
.toEqual(await reader.readAsString(expectedId));
}
});
}

View File

@ -1,9 +0,0 @@
library dinner.bad_soup.ng_deps.dart;
import 'bad_soup.dart';
var _visited = false;
void initReflector(reflector) {
if (_visited) return;
_visited = true;
}