style(dart/transform): Rename .ngDeps.dart => .ng_deps.dart
Update to conform with file naming conventions. Closes #975
This commit is contained in:
parent
91398c3425
commit
d10df7de44
|
@ -10,7 +10,7 @@ import 'package:barback/barback.dart';
|
|||
|
||||
import 'generator.dart';
|
||||
|
||||
/// Transformer responsible for reading .ngDeps.dart files and generating
|
||||
/// Transformer responsible for reading .ng_deps.dart files and generating
|
||||
/// setters from the "annotations" information in the generated
|
||||
/// `registerType` calls.
|
||||
///
|
||||
|
|
|
@ -2,6 +2,6 @@ library angular2.src.transform.common.names;
|
|||
|
||||
const SETUP_METHOD_NAME = 'setupReflection';
|
||||
const REFLECTOR_VAR_NAME = 'reflector';
|
||||
const DEPS_EXTENSION = '.ngDeps.dart';
|
||||
const DEPS_EXTENSION = '.ng_deps.dart';
|
||||
const REGISTER_TYPE_METHOD_NAME = 'registerType';
|
||||
const REGISTER_SETTERS_METHOD_NAME = 'registerSetters';
|
||||
|
|
|
@ -37,8 +37,8 @@ class Parser {
|
|||
return ngDeps;
|
||||
}
|
||||
|
||||
/// Parses the `.ngDeps.dart` file represented by [id] into an [NgDeps]
|
||||
/// object. All `.ngDeps.dart` files imported by [id] are then parsed. The
|
||||
/// Parses the `.ng_deps.dart` file represented by [id] into an [NgDeps]
|
||||
/// object. All `.ng_deps.dart` files imported by [id] are then parsed. The
|
||||
/// results are added to [allDeps].
|
||||
Future<List<NgDeps>> _recurse(AssetId id,
|
||||
[List<NgDeps> allDeps, Set<AssetId> seen]) async {
|
||||
|
|
|
@ -10,7 +10,7 @@ import 'package:barback/barback.dart';
|
|||
|
||||
import 'linker.dart';
|
||||
|
||||
/// Transformer responsible for processing .ngDeps.dart files created by
|
||||
/// Transformer responsible for processing .ng_deps.dart files created by
|
||||
/// [DirectiveProcessor] and ensuring that the generated calls to
|
||||
/// `setupReflection` call the necessary `setupReflection` method in all
|
||||
/// dependencies.
|
||||
|
|
|
@ -31,7 +31,7 @@ String createNgDeps(String code, String path, {bool forceGenerate: false}) {
|
|||
}
|
||||
|
||||
/// Visitor responsible for processing [CompilationUnit] and creating an
|
||||
/// associated .ngDeps.dart file.
|
||||
/// associated .ng_deps.dart file.
|
||||
class CreateNgDepsVisitor extends Object
|
||||
with SimpleAstVisitor<Object>, VisitorMixin {
|
||||
final PrintWriter writer;
|
||||
|
|
|
@ -11,10 +11,10 @@ import 'package:barback/barback.dart';
|
|||
import 'rewriter.dart';
|
||||
|
||||
/// Transformer responsible for processing all .dart assets and creating
|
||||
/// .ngDeps.dart files which register @Injectable annotated classes with the
|
||||
/// .ng_deps.dart files which register @Injectable annotated classes with the
|
||||
/// reflector.
|
||||
///
|
||||
/// This will also create .ngDeps.dart files for classes annotated
|
||||
/// This will also create .ng_deps.dart files for classes annotated
|
||||
/// with @Component, @Template, @Decorator, etc.
|
||||
///
|
||||
/// This transformer is the first phase in a two-phase transform. It should
|
||||
|
|
|
@ -14,9 +14,9 @@ import 'remove_reflection_capabilities.dart';
|
|||
/// The goal of this is to break the app's dependency on dart:mirrors.
|
||||
///
|
||||
/// This transformer assumes that [DirectiveProcessor] and [DirectiveLinker]
|
||||
/// have already been run and that a .ngDeps.dart file has been generated for
|
||||
/// have already been run and that a .ng_deps.dart file has been generated for
|
||||
/// [options.entryPoint]. The instantiation of [ReflectionCapabilities] is
|
||||
/// replaced by calling `setupReflection` in that .ngDeps.dart file.
|
||||
/// replaced by calling `setupReflection` in that .ng_deps.dart file.
|
||||
class ReflectionRemover extends Transformer {
|
||||
final TransformerOptions options;
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ void allTests() {
|
|||
|
||||
test('should generate a setter for a `bind` property in an annotation.',
|
||||
() async {
|
||||
var inputPath = 'bind_generator/basic_bind_files/bar.ngDeps.dart';
|
||||
var inputPath = 'bind_generator/basic_bind_files/bar.ng_deps.dart';
|
||||
var expected = formatter.format(
|
||||
readFile('bind_generator/basic_bind_files/expected/bar.ngDeps.dart'));
|
||||
readFile('bind_generator/basic_bind_files/expected/bar.ng_deps.dart'));
|
||||
|
||||
var output = formatter
|
||||
.format(await createNgSetters(reader, new AssetId('a', inputPath)));
|
||||
|
@ -30,9 +30,10 @@ void allTests() {
|
|||
|
||||
test('should generate a single setter when multiple annotations bind to the '
|
||||
'same property.', () async {
|
||||
var inputPath = 'bind_generator/duplicate_bind_name_files/soup.ngDeps.dart';
|
||||
var inputPath =
|
||||
'bind_generator/duplicate_bind_name_files/soup.ng_deps.dart';
|
||||
var expected = formatter.format(readFile(
|
||||
'bind_generator/duplicate_bind_name_files/expected/soup.ngDeps.dart'));
|
||||
'bind_generator/duplicate_bind_name_files/expected/soup.ng_deps.dart'));
|
||||
|
||||
var output = formatter
|
||||
.format(await createNgSetters(reader, new AssetId('a', inputPath)));
|
||||
|
|
|
@ -17,7 +17,7 @@ var formatter = new DartFormatter();
|
|||
void allTests() {
|
||||
test('should preserve parameter annotations as const instances.', () {
|
||||
var inputPath = 'parameter_metadata/soup.dart';
|
||||
var expected = _readFile('parameter_metadata/expected/soup.ngDeps.dart');
|
||||
var expected = _readFile('parameter_metadata/expected/soup.ng_deps.dart');
|
||||
var output =
|
||||
formatter.format(createNgDeps(_readFile(inputPath), inputPath));
|
||||
expect(output, equals(expected));
|
||||
|
|
|
@ -47,10 +47,10 @@ void allTests() {
|
|||
'a|web/bar.dart': 'simple_annotation_files/bar.dart'
|
||||
},
|
||||
outputs: {
|
||||
'a|web/bar.ngDeps.dart':
|
||||
'simple_annotation_files/expected/bar.ngDeps.dart',
|
||||
'a|web/index.ngDeps.dart':
|
||||
'simple_annotation_files/expected/index.ngDeps.dart'
|
||||
'a|web/bar.ng_deps.dart':
|
||||
'simple_annotation_files/expected/bar.ng_deps.dart',
|
||||
'a|web/index.ng_deps.dart':
|
||||
'simple_annotation_files/expected/index.ng_deps.dart'
|
||||
}),
|
||||
new IntegrationTestConfig(
|
||||
'should generate proper code for a Component using a selector defined '
|
||||
|
@ -61,7 +61,7 @@ void allTests() {
|
|||
'a|web/bar.dart': 'two_deps_files/bar.dart'
|
||||
},
|
||||
outputs: {
|
||||
'a|web/bar.ngDeps.dart': 'two_deps_files/expected/bar.ngDeps.dart'
|
||||
'a|web/bar.ng_deps.dart': 'two_deps_files/expected/bar.ng_deps.dart'
|
||||
}),
|
||||
new IntegrationTestConfig(
|
||||
'should generate proper code for a Component declaring a '
|
||||
|
@ -72,7 +72,7 @@ void allTests() {
|
|||
'a|web/bar.dart': 'list_of_types_files/bar.dart'
|
||||
},
|
||||
outputs: {
|
||||
'a|web/bar.ngDeps.dart': 'list_of_types_files/expected/bar.ngDeps.dart'
|
||||
'a|web/bar.ng_deps.dart': 'list_of_types_files/expected/bar.ng_deps.dart'
|
||||
}),
|
||||
new IntegrationTestConfig(
|
||||
'should generate a factory for a class with no declared ctor.',
|
||||
|
@ -81,7 +81,7 @@ void allTests() {
|
|||
'a|web/bar.dart': 'synthetic_ctor_files/bar.dart'
|
||||
},
|
||||
outputs: {
|
||||
'a|web/bar.ngDeps.dart': 'synthetic_ctor_files/expected/bar.ngDeps.dart'
|
||||
'a|web/bar.ng_deps.dart': 'synthetic_ctor_files/expected/bar.ng_deps.dart'
|
||||
}),
|
||||
new IntegrationTestConfig('should preserve multiple annotations.',
|
||||
inputs: {
|
||||
|
@ -91,7 +91,8 @@ void allTests() {
|
|||
'../../../lib/src/core/annotations/template.dart'
|
||||
},
|
||||
outputs: {
|
||||
'a|web/bar.ngDeps.dart': 'two_annotations_files/expected/bar.ngDeps.dart'
|
||||
'a|web/bar.ng_deps.dart':
|
||||
'two_annotations_files/expected/bar.ng_deps.dart'
|
||||
}),
|
||||
new IntegrationTestConfig(
|
||||
'should ensure that dependencies are property chained.',
|
||||
|
@ -101,8 +102,8 @@ void allTests() {
|
|||
'a|web/bar.dart': 'chained_deps_files/bar.dart'
|
||||
},
|
||||
outputs: {
|
||||
'a|web/bar.ngDeps.dart': 'chained_deps_files/expected/bar.ngDeps.dart',
|
||||
'a|web/foo.ngDeps.dart': 'chained_deps_files/expected/foo.ngDeps.dart'
|
||||
'a|web/bar.ng_deps.dart': 'chained_deps_files/expected/bar.ng_deps.dart',
|
||||
'a|web/foo.ng_deps.dart': 'chained_deps_files/expected/foo.ng_deps.dart'
|
||||
})
|
||||
];
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ library bar;
|
|||
import 'bar.dart';
|
||||
import 'package:angular2/src/core/annotations/annotations.dart';
|
||||
import 'foo.dart' as dep;
|
||||
import 'foo.ngDeps.dart' as i0;
|
||||
import 'foo.ng_deps.dart' as i0;
|
||||
|
||||
bool _visited = false;
|
||||
void setupReflection(reflector) {
|
|
@ -3,7 +3,7 @@ library web_foo;
|
|||
import 'package:angular2/src/core/application.dart';
|
||||
import 'package:angular2/src/reflection/reflection_capabilities.dart';
|
||||
import 'bar.dart';
|
||||
import 'a:web/bar.ngDeps.dart' as i0;
|
||||
import 'a:web/bar.ng_deps.dart' as i0;
|
||||
|
||||
bool _visited = false;
|
||||
void setupReflection(reflector) {
|
|
@ -5,7 +5,7 @@ import 'package:angular2/src/core/application.dart';
|
|||
import 'package:angular2/src/reflection/reflection.dart';
|
||||
import 'package:angular2/src/reflection/reflection_capabilities.dart';
|
||||
import 'bar.dart';
|
||||
import 'bar.ngDeps.dart' as i0;
|
||||
import 'bar.ng_deps.dart' as i0;
|
||||
|
||||
bool _visited = false;
|
||||
void setupReflection(reflector) {
|
|
@ -9,7 +9,7 @@ import 'reflection_remover_files/expected/index.dart' as expected;
|
|||
import '../common/read_file.dart';
|
||||
|
||||
void allTests() {
|
||||
var codegen = new Codegen('web/index.dart', 'web/index.ngDeps.dart');
|
||||
var codegen = new Codegen('web/index.dart', 'web/index.ng_deps.dart');
|
||||
|
||||
test('should remove uses of mirrors & insert calls to generated code.', () {
|
||||
var code =
|
||||
|
|
|
@ -13,7 +13,7 @@ library web_foo;
|
|||
|
||||
import 'package:angular2/src/core/application.dart';
|
||||
import 'package:angular2/src/reflection/reflection.dart';
|
||||
import 'package:angular2/src/reflection/reflection_capabilities.dart';import 'index.ngDeps.dart' as ngStaticInit;
|
||||
import 'package:angular2/src/reflection/reflection_capabilities.dart';import 'index.ng_deps.dart' as ngStaticInit;
|
||||
|
||||
void main() {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();ngStaticInit.setupReflection(reflector);
|
||||
|
|
Loading…
Reference in New Issue