refactor(dart/transform): Remove deprecated angular2/bootstrap

BREAKING CHANGE

Remove the deprecated angular2/bootstrap.ts &
angular2/bootstrap_static.ts libraries.

Browser entry points should import angular2/platform/browser which
supplies the `bootstrap` function.

Closes #7650
This commit is contained in:
Tim Blasi 2016-03-18 09:05:21 -07:00 committed by Timothy Blasi
parent 9a1959f77a
commit 26a3390549
8 changed files with 6 additions and 46 deletions

View File

@ -1,6 +0,0 @@
/**
* See {@link bootstrap} for more information.
* @deprecated
*/
export {bootstrap} from 'angular2/platform/browser';
export {AngularEntrypoint} from 'angular2/src/core/angular_entrypoint';

View File

@ -1,6 +0,0 @@
/**
* See {@link bootstrap} for more information.
* @deprecated
*/
export {bootstrapStatic} from 'angular2/platform/browser_static';
export {AngularEntrypoint} from 'angular2/src/core/angular_entrypoint';

View File

@ -15,7 +15,6 @@ const _INJECTABLES = const [
const ClassDescriptor('Injectable', 'package:angular2/core.dart'), const ClassDescriptor('Injectable', 'package:angular2/core.dart'),
const ClassDescriptor('Injectable', 'package:angular2/src/core/di.dart'), const ClassDescriptor('Injectable', 'package:angular2/src/core/di.dart'),
const ClassDescriptor('Injectable', 'package:angular2/angular2.dart'), const ClassDescriptor('Injectable', 'package:angular2/angular2.dart'),
const ClassDescriptor('Injectable', 'package:angular2/bootstrap_static.dart'),
const ClassDescriptor( const ClassDescriptor(
'Injectable', 'package:angular2/web_worker/worker.dart'), 'Injectable', 'package:angular2/web_worker/worker.dart'),
]; ];
@ -65,7 +64,6 @@ const _PIPES = const [
const _VIEWS = const [ const _VIEWS = const [
const ClassDescriptor('View', 'package:angular2/angular2.dart'), const ClassDescriptor('View', 'package:angular2/angular2.dart'),
const ClassDescriptor('View', 'package:angular2/web_worker/worker.dart'), const ClassDescriptor('View', 'package:angular2/web_worker/worker.dart'),
const ClassDescriptor('View', 'package:angular2/bootstrap_static.dart'),
const ClassDescriptor('View', 'package:angular2/core.dart'), const ClassDescriptor('View', 'package:angular2/core.dart'),
const ClassDescriptor('View', 'package:angular2/src/core/metadata/view.dart'), const ClassDescriptor('View', 'package:angular2/src/core/metadata/view.dart'),
const ClassDescriptor('View', 'package:angular2/src/core/metadata.dart'), const ClassDescriptor('View', 'package:angular2/src/core/metadata.dart'),
@ -74,9 +72,6 @@ const _VIEWS = const [
const _ENTRYPOINTS = const [ const _ENTRYPOINTS = const [
const ClassDescriptor('AngularEntrypoint', 'package:angular2/angular2.dart'), const ClassDescriptor('AngularEntrypoint', 'package:angular2/angular2.dart'),
const ClassDescriptor('AngularEntrypoint', 'package:angular2/core.dart'), const ClassDescriptor('AngularEntrypoint', 'package:angular2/core.dart'),
const ClassDescriptor('AngularEntrypoint', 'package:angular2/bootstrap.dart'),
const ClassDescriptor(
'AngularEntrypoint', 'package:angular2/bootstrap_static.dart'),
const ClassDescriptor( const ClassDescriptor(
'AngularEntrypoint', 'package:angular2/platform/browser.dart'), 'AngularEntrypoint', 'package:angular2/platform/browser.dart'),
const ClassDescriptor( const ClassDescriptor(

View File

@ -3,14 +3,11 @@ library angular2.transform.common.mirror_matcher;
import 'package:analyzer/src/generated/ast.dart'; import 'package:analyzer/src/generated/ast.dart';
import 'package:angular2/src/transform/common/names.dart'; import 'package:angular2/src/transform/common/names.dart';
/// Files from which `bootstrap` is exported. /// File from which `bootstrap` is exported.
/// ///
/// These files transitively imports dart:mirrors. /// This file transitively imports dart:mirrors.
/// They should be replaced with [BOOTSTRAP_STATIC_URI] in production apps. /// It should be replaced with [BOOTSTRAP_STATIC_URI] in production apps.
const _BOOTSTRAP_URIS = const <String>[ const _BOOTSTRAP_URI = 'package:angular2/platform/browser.dart';
'package:angular2/bootstrap.dart',
'package:angular2/platform/browser.dart',
];
/// File from which `ReflectionCapabilities` is exported. /// File from which `ReflectionCapabilities` is exported.
/// ///
@ -23,7 +20,7 @@ const _REFLECTION_CAPABILITIES_URI =
/// File from which `bootstrapStatic` is exported. /// File from which `bootstrapStatic` is exported.
/// ///
/// This file does not transitively import dart:mirrors. /// This file does not transitively import dart:mirrors.
/// It should be used in place of [_BOOTSTRAP_URIS] in production apps. /// It should be used in place of [_BOOTSTRAP_URI] in production apps.
const BOOTSTRAP_STATIC_URI = 'package:angular2/platform/browser_static.dart'; const BOOTSTRAP_STATIC_URI = 'package:angular2/platform/browser_static.dart';
/// Syntactially checks for code related to the use of `dart:mirrors`. /// Syntactially checks for code related to the use of `dart:mirrors`.
@ -42,5 +39,5 @@ class MirrorMatcher {
} }
bool hasBootstrapUri(UriBasedDirective node) => bool hasBootstrapUri(UriBasedDirective node) =>
_BOOTSTRAP_URIS.contains(node.uri.stringValue); _BOOTSTRAP_URI == node.uri.stringValue;
} }

View File

@ -71,17 +71,6 @@ void allTests() {
}); });
describe('`bootstrap` import and call', () { describe('`bootstrap` import and call', () {
// TODO(kegluneq): Remove when we remove angular2/bootstrap.dart
it('deprecated import should be rewritten to `bootstrapStatic`.', () {
final bootstrapCode =
readFile('reflection_remover/deprecated_bootstrap_files/index.dart')
.replaceAll('\r\n', '\n');
var output = new Rewriter(bootstrapCode, codegen, entrypointMatcher,
writeStaticInit: true)
.rewrite(parseCompilationUnit(bootstrapCode));
expect(output).toEqual(bootstrap_expected.code);
});
it('should be rewritten to `bootstrapStatic`.', () { it('should be rewritten to `bootstrapStatic`.', () {
final bootstrapCode = final bootstrapCode =
readFile('reflection_remover/bootstrap_files/index.dart') readFile('reflection_remover/bootstrap_files/index.dart')

View File

@ -1,7 +0,0 @@
library web_foo;
import 'package:angular2/platform/browser.dart';
void main() async {
var appRef = await bootstrap(MyComponent);
}

View File

@ -9,7 +9,6 @@
// not even be in src/*. Move them! // not even be in src/*. Move them!
'angular2/src/testing/benchmark_util', 'angular2/src/testing/benchmark_util',
'angular2/src/facade/browser', 'angular2/src/facade/browser',
'angular2/bootstrap',
'rxjs' 'rxjs'
]; ];
if (@@USE_BUNDLES) { if (@@USE_BUNDLES) {

View File

@ -10,7 +10,6 @@
// not even be in src/*. Move them! // not even be in src/*. Move them!
'angular2/src/testing/benchmark_util', 'angular2/src/testing/benchmark_util',
'angular2/src/facade/browser', 'angular2/src/facade/browser',
'angular2/bootstrap',
'rxjs' 'rxjs'
]; ];
if (@@USE_BUNDLES) { if (@@USE_BUNDLES) {