feat(bootstrap): remove the need for explicit reflection setup in bootstrap code
BREAKING CHANGES: Dart applications and TypeScript applications meant to transpile to Dart must now import `package:angular2/bootstrap.dart` instead of `package:angular2/angular2.dart` in their bootstrap code. `package:angular2/angular2.dart` no longer export the bootstrap function. The transformer rewrites imports of `bootstrap.dart` and calls to `bootstrap` to `bootstrap_static.dart` and `bootstrapStatic` respectively.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
Tests that the reflection removal step:
|
||||
1. Comments out the import of reflection_capabilities.dart
|
||||
2. Comments out the instantiation of `ReflectionCapabilities`
|
||||
3. Adds the appropriate import.
|
||||
4. Adds the call to `initReflector`
|
||||
5. Does not change line numbers in the source.
|
||||
6. Makes minimal changes to source offsets.
|
||||
* Adds the appropriate ng_deps import.
|
||||
* Adds the call to `initReflector`
|
||||
* Does not change line numbers in the source.
|
||||
* Makes minimal changes to source offsets.
|
||||
|
||||
@@ -11,12 +11,12 @@ library angular2.test.transform.debug_reflection_remover_files;
|
||||
var code = """
|
||||
library web_foo;
|
||||
|
||||
import 'package:angular2/src/core/application.dart';
|
||||
import 'package:angular2/bootstrap.dart';import 'index.ng_deps.dart' as ngStaticInit0;
|
||||
import 'package:angular2/src/reflection/reflection.dart';
|
||||
import 'package:angular2/src/reflection/debug_reflection_capabilities.dart';import 'index.ng_deps.dart' as ngStaticInit0;
|
||||
import 'package:angular2/src/reflection/debug_reflection_capabilities.dart';
|
||||
|
||||
void main() {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();ngStaticInit0.initReflector();
|
||||
bootstrap(MyComponent);
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
ngStaticInit0.initReflector();bootstrap(MyComponent);
|
||||
}
|
||||
""";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
library web_foo;
|
||||
|
||||
import 'package:angular2/src/core/application.dart';
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/src/reflection/reflection.dart';
|
||||
import 'package:angular2/src/reflection/reflection_capabilities.dart';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user