feat(dart/transform): Use angular2/platform/browser as bootstrap lib
Update the Angular 2 transformer to recognize `package:angular2/platform/browser.dart` as the library which exports the `bootstrap` function. Update playground, examples, benchmarks, & tests to import bootstrap from platform/browser. Closes #7647
This commit is contained in:
parent
c194f6695d
commit
b6507e37ef
|
@ -4,7 +4,7 @@ Bootstrapping
|
|||
@description
|
||||
{@target ts}`import {bootstrap} from 'angular2/platform/browser';`{@endtarget}
|
||||
{@target js}Available from the `ng.platform.browser` namespace{@endtarget}
|
||||
{@target dart}`import 'package:angular2/bootstrap.dart';`{@endtarget}
|
||||
{@target dart}`import 'package:angular2/platform/browser.dart';`{@endtarget}
|
||||
|
||||
@cheatsheetItem
|
||||
syntax(ts dart):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {provide} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {UrlResolver} from 'angular2/compiler';
|
||||
|
||||
var MyApp: any;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {NG_VALIDATORS} from 'angular2/common';
|
||||
import {Provider} from 'angular2/core';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, provide} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Observable, Subscriber} from 'rxjs/Rx';
|
||||
|
||||
// #docregion AsyncPipe
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, provide} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
|
||||
// #docregion DatePipe
|
||||
@Component({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, provide} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
|
||||
// #docregion JsonPipe
|
||||
@Component({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, provide} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
|
||||
// #docregion LowerUpperPipe
|
||||
@Component({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, provide} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
|
||||
// #docregion NumberPipe
|
||||
@Component({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, provide} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
|
||||
// #docregion SlicePipe_string
|
||||
@Component({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// #docregion enableProdMode
|
||||
import {enableProdMode} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {MyComponent} from './my_component';
|
||||
|
||||
enableProdMode();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {provide, Component} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {
|
||||
CanActivate,
|
||||
RouteConfig,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {provide, Component} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {
|
||||
CanDeactivate,
|
||||
RouteConfig,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, provide} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {
|
||||
OnActivate,
|
||||
ComponentInstruction,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, Injectable, provide} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {
|
||||
OnDeactivate,
|
||||
ComponentInstruction,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, provide} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {
|
||||
CanActivate,
|
||||
RouteConfig,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {BrowserDomAdapter} from 'angular2/src/platform/browser/browser_adapter';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Component, Directive, DynamicComponentLoader, ElementRef} from 'angular2/core';
|
||||
import {NgIf, NgFor} from 'angular2/common';
|
||||
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
windowProfile,
|
||||
windowProfileEnd
|
||||
} from 'angular2/src/testing/benchmark_util';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Component, Directive, bind, provide} from 'angular2/core';
|
||||
import {NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault} from 'angular2/common';
|
||||
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
|
||||
import {App} from './app';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {NgIf} from 'angular2/common';
|
||||
import {
|
||||
Compiler,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {
|
||||
Compiler,
|
||||
Component,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
|
||||
@Component({
|
||||
selector: 'hello-app',
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {AnimateApp} from './animate-app';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
|
||||
export function main() {
|
||||
bootstrap(AnimateApp);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Component} from 'angular2/core';
|
||||
import {NgIf} from 'angular2/common';
|
||||
import {TimerWrapper} from 'angular2/src/facade/async';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Component} from 'angular2/core';
|
||||
|
||||
@Component({selector: 'gestures-app', templateUrl: 'template.html'})
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, provide} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {
|
||||
RouteConfig,
|
||||
Route,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Renderer, ElementRef, Component, Directive, Injectable} from 'angular2/core';
|
||||
|
||||
export function main() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {HTTP_PROVIDERS} from 'angular2/http';
|
||||
import {HttpCmp} from './http_comp';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {JSONP_PROVIDERS} from 'angular2/http';
|
||||
import {JsonpCmp} from './jsonp_comp';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Component} from 'angular2/core';
|
||||
import {KeyEventsPlugin} from 'angular2/src/platform/dom/events/key_events';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {
|
||||
FORM_DIRECTIVES,
|
||||
ControlGroup,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {
|
||||
Component,
|
||||
Directive,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Component, Directive, Host, forwardRef, Provider, Injectable} from 'angular2/core';
|
||||
import {NgIf, NgFor, FORM_DIRECTIVES} from 'angular2/common';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
|
||||
import {Renderer, ElementRef, Component, Directive, Injectable} from 'angular2/core';
|
||||
import {MyCmp} from './my_cmp/my_cmp';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {InboxApp} from './inbox-app';
|
||||
import {provide} from 'angular2/core';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {ROUTER_PROVIDERS, HashLocationStrategy, LocationStrategy} from 'angular2/router';
|
||||
|
||||
export function main() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Component} from 'angular2/core';
|
||||
|
||||
@Component({
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Component} from 'angular2/core';
|
||||
|
||||
@Component({selector: '[svg-group]', template: `<svg:text x="20" y="20">Hello</svg:text>`})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Component, Directive, Host, forwardRef, Provider} from 'angular2/core';
|
||||
import {
|
||||
ControlGroup,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Component} from 'angular2/core';
|
||||
import {NgFor} from 'angular2/common';
|
||||
import {Store, Todo, TodoFactory} from './services/TodoStore';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from "angular2/bootstrap";
|
||||
import {bootstrap} from "angular2/platform/browser";
|
||||
import {ImageDemo} from "./index_common";
|
||||
|
||||
export function main() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {Component} from 'angular2/core';
|
||||
import {Zippy} from './zippy';
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
library hello_world.index;
|
||||
|
||||
import "package:angular2/bootstrap.dart" show AngularEntrypoint, bootstrap;
|
||||
import "package:angular2/platform/browser.dart"
|
||||
show AngularEntrypoint, bootstrap;
|
||||
import "package:angular2/angular2.dart"
|
||||
show Component, Directive, ElementRef, Injectable, Renderer;
|
||||
|
||||
|
|
|
@ -3,11 +3,29 @@ library angular2.transform.common.mirror_matcher;
|
|||
import 'package:analyzer/src/generated/ast.dart';
|
||||
import 'package:angular2/src/transform/common/names.dart';
|
||||
|
||||
const BOOTSTRAP_STATIC_URI = 'package:angular2/bootstrap_static.dart';
|
||||
const BOOTSTRAP_URI = 'package:angular2/bootstrap.dart';
|
||||
const REFLECTION_CAPABILITIES_URI =
|
||||
/// Files from which `bootstrap` is exported.
|
||||
///
|
||||
/// These files transitively imports dart:mirrors.
|
||||
/// They should be replaced with [BOOTSTRAP_STATIC_URI] in production apps.
|
||||
const _BOOTSTRAP_URIS = const <String>[
|
||||
'package:angular2/bootstrap.dart',
|
||||
'package:angular2/platform/browser.dart',
|
||||
];
|
||||
|
||||
/// File from which `ReflectionCapabilities` is exported.
|
||||
///
|
||||
/// This file transitively imports dart:mirrors and should be removed from
|
||||
/// production apps. The Angular2 reflection framework should be initialized
|
||||
/// with generated code such that no reflection is necessary.
|
||||
const _REFLECTION_CAPABILITIES_URI =
|
||||
'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
|
||||
/// File from which `bootstrapStatic` is exported.
|
||||
///
|
||||
/// This file does not transitively import dart:mirrors.
|
||||
/// It should be used in place of [_BOOTSTRAP_URIS] in production apps.
|
||||
const BOOTSTRAP_STATIC_URI = 'package:angular2/platform/browser_static.dart';
|
||||
|
||||
/// Syntactially checks for code related to the use of `dart:mirrors`.
|
||||
///
|
||||
/// Checks various [AstNode]s to determine if they are
|
||||
|
@ -20,10 +38,9 @@ class MirrorMatcher {
|
|||
'${node.constructorName.type.name}' == REFLECTION_CAPABILITIES_NAME;
|
||||
|
||||
bool hasReflectionCapabilitiesUri(UriBasedDirective node) {
|
||||
return node.uri.stringValue == REFLECTION_CAPABILITIES_URI;
|
||||
return node.uri.stringValue == _REFLECTION_CAPABILITIES_URI;
|
||||
}
|
||||
|
||||
bool hasBootstrapUri(UriBasedDirective node) {
|
||||
return node.uri.stringValue == BOOTSTRAP_URI;
|
||||
}
|
||||
bool hasBootstrapUri(UriBasedDirective node) =>
|
||||
_BOOTSTRAP_URIS.contains(node.uri.stringValue);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
import 'bar.dart';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
import 'bar.dart';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
import 'bar.dart';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
import 'bar.dart';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ library web_foo.template.dart;
|
|||
|
||||
import 'index.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||
import 'package:angular2/bootstrap_static.dart' show bootstrapStatic;
|
||||
import 'package:angular2/platform/browser_static.dart' show bootstrapStatic;
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'bar.dart';
|
||||
import 'bar.template.dart' as i0;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart' show bootstrap;
|
||||
import 'package:angular2/platform/browser.dart' show bootstrap;
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
import 'bar.dart';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
import 'bar.dart';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
import 'bar.dart';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
import 'bar.dart';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
|
||||
abstract class TestBootstrapper {
|
||||
@AngularEntrypoint()
|
||||
|
|
|
@ -48,7 +48,8 @@ void allTests() {
|
|||
'should replace uses of mirrors with the debug implementation & '
|
||||
'insert calls to generated code in `MirrorMode.debug`.', () {
|
||||
var output = new Rewriter(code, codegen, entrypointMatcher,
|
||||
mirrorMode: MirrorMode.debug).rewrite(parseCompilationUnit(code));
|
||||
mirrorMode: MirrorMode.debug)
|
||||
.rewrite(parseCompilationUnit(code));
|
||||
expect(output).toEqual(debug_mirrors.code);
|
||||
});
|
||||
|
||||
|
@ -56,24 +57,38 @@ void allTests() {
|
|||
'should replace uses of mirrors with the verbose implementation '
|
||||
'in `MirrorMode.verbose`.', () {
|
||||
var output = new Rewriter(code, codegen, entrypointMatcher,
|
||||
mirrorMode: MirrorMode.verbose).rewrite(parseCompilationUnit(code));
|
||||
mirrorMode: MirrorMode.verbose)
|
||||
.rewrite(parseCompilationUnit(code));
|
||||
expect(output).toEqual(verbose_mirrors.code);
|
||||
});
|
||||
|
||||
it('should not initialize the reflector when `writeStaticInit` is `false`.',
|
||||
() {
|
||||
var output = new Rewriter(code, codegen, entrypointMatcher,
|
||||
writeStaticInit: false).rewrite(parseCompilationUnit(code));
|
||||
var output =
|
||||
new Rewriter(code, codegen, entrypointMatcher, writeStaticInit: false)
|
||||
.rewrite(parseCompilationUnit(code));
|
||||
expect(output).toEqual(log_mirrors.code);
|
||||
});
|
||||
|
||||
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`.', () {
|
||||
final bootstrapCode =
|
||||
readFile('reflection_remover/bootstrap_files/index.dart')
|
||||
.replaceAll('\r\n', '\n');
|
||||
var output = new Rewriter(bootstrapCode, codegen, entrypointMatcher,
|
||||
writeStaticInit: true).rewrite(parseCompilationUnit(bootstrapCode));
|
||||
writeStaticInit: true)
|
||||
.rewrite(parseCompilationUnit(bootstrapCode));
|
||||
expect(output).toEqual(bootstrap_expected.code);
|
||||
});
|
||||
|
||||
|
@ -81,7 +96,8 @@ void allTests() {
|
|||
final bootstrapCode =
|
||||
readFile('reflection_remover/deferred_bootstrap_files/index.dart');
|
||||
var output = new Rewriter(bootstrapCode, codegen, entrypointMatcher,
|
||||
writeStaticInit: true).rewrite(parseCompilationUnit(bootstrapCode));
|
||||
writeStaticInit: true)
|
||||
.rewrite(parseCompilationUnit(bootstrapCode));
|
||||
expect(output).toEqual(deferred_bootstrap_expected.code);
|
||||
});
|
||||
|
||||
|
@ -89,7 +105,8 @@ void allTests() {
|
|||
final bootstrapCode =
|
||||
readFile('reflection_remover/combinator_files/index.dart');
|
||||
var output = new Rewriter(bootstrapCode, codegen, entrypointMatcher,
|
||||
writeStaticInit: true).rewrite(parseCompilationUnit(bootstrapCode));
|
||||
writeStaticInit: true)
|
||||
.rewrite(parseCompilationUnit(bootstrapCode));
|
||||
expect(output).toEqual(combinator_expected.code);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.reflection_remover.reflection_remover_files;
|
|||
var code = """
|
||||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||
import 'package:angular2/platform/browser_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||
|
||||
void main() async {
|
||||
var appRef = await bootstrapStatic(MyComponent, null, () { ngStaticInit.initReflector(); });
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
|
||||
void main() async {
|
||||
var appRef = await bootstrap(MyComponent);
|
||||
|
|
|
@ -9,7 +9,7 @@ library angular2.test.transform.reflection_remover.combinator_files;
|
|||
// those we are removing.
|
||||
|
||||
var code = """
|
||||
import 'package:angular2/bootstrap_static.dart' show bootstrapStatic, initReflector;import 'index.template.dart' as ngStaticInit;
|
||||
import 'package:angular2/platform/browser_static.dart' show bootstrapStatic, initReflector;import 'index.template.dart' as ngStaticInit;
|
||||
|
||||
void main() {
|
||||
bootstrapStatic(MyComponent, null, () { ngStaticInit.initReflector(); });
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:angular2/bootstrap.dart' show bootstrap;
|
||||
import 'package:angular2/platform/browser.dart' show bootstrap;
|
||||
|
||||
void main() {
|
||||
bootstrap(MyComponent);
|
||||
|
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.debug_reflection_remover_files;
|
|||
var code = """
|
||||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';import 'index.template.dart' as ngStaticInit;
|
||||
import 'package:angular2/platform/browser.dart';import 'index.template.dart' as ngStaticInit;
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'package:angular2/src/core/reflection/debug_reflection_capabilities.dart';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.reflection_remover.debug_mirrors_files.expected;
|
|||
var code = """
|
||||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||
import 'package:angular2/platform/browser_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'package:angular2/src/core/reflection/debug_reflection_capabilities.dart';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ library angular2.test.transform.reflection_remover.deferred_bootstrap_files;
|
|||
// those we are removing.
|
||||
|
||||
var code = """
|
||||
import 'package:angular2/bootstrap_static.dart' deferred as ng;import 'index.template.dart' as ngStaticInit;
|
||||
import 'package:angular2/platform/browser_static.dart' deferred as ng;import 'index.template.dart' as ngStaticInit;
|
||||
|
||||
void main() {
|
||||
ng.loadLibrary().then((_) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:angular2/bootstrap.dart' deferred as ng;
|
||||
import 'package:angular2/platform/browser.dart' deferred as ng;
|
||||
|
||||
void main() {
|
||||
ng.loadLibrary().then((_) {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
|
||||
void main() async {
|
||||
var appRef = await bootstrap(MyComponent);
|
||||
}
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.reflection_remover.function_annotation_files;
|
|||
const code = """
|
||||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||
import 'package:angular2/platform/browser_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
/*import 'package:angular2/src/core/reflection/reflection_capabilities.dart';*/
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.log_mirrors_files.expected;
|
|||
var code = """
|
||||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
/*import 'package:angular2/src/core/reflection/reflection_capabilities.dart';*/
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.reflection_remover.method_annotation_files;
|
|||
const code = """
|
||||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||
import 'package:angular2/platform/browser_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||
|
||||
class TestBootstrapper {
|
||||
@AngularEntrypoint("Method entrypoint")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
|
||||
class TestBootstrapper {
|
||||
@AngularEntrypoint("Method entrypoint")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.reflection_remover.reflection_remover_files;
|
|||
var code = """
|
||||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||
import 'package:angular2/platform/browser_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
/*import 'package:angular2/src/core/reflection/reflection_capabilities.dart';*/
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.reflection_remover.verbose_files.expected;
|
|||
var code = """
|
||||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||
import 'package:angular2/platform/browser_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'package:angular2/src/core/reflection/debug_reflection_capabilities.dart';
|
||||
|
||||
|
|
Loading…
Reference in New Issue