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:
@ -5,18 +5,15 @@ import {
|
||||
DynamicComponentLoader,
|
||||
ElementRef,
|
||||
View
|
||||
} from 'angular2/angular2';
|
||||
} from 'angular2/bootstrap';
|
||||
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
|
||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util';
|
||||
import {NgIf, NgFor} from 'angular2/directives';
|
||||
|
||||
var testList = null;
|
||||
|
||||
export function main() {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
var size = getIntParameter('size');
|
||||
testList = ListWrapper.createFixedSize(size);
|
||||
|
||||
|
@ -14,6 +14,7 @@ export function main() {
|
||||
BrowserDomAdapter.makeCurrent();
|
||||
var iterations = getIntParameter('iterations');
|
||||
|
||||
// This benchmark does not use bootstrap and needs to create a reflector
|
||||
setupReflector();
|
||||
var bindings = [A, B, C, D, E];
|
||||
var injector = Injector.resolveAndCreate(bindings);
|
||||
|
@ -1,9 +1,7 @@
|
||||
import {bootstrap, Component, Directive, View} from 'angular2/angular2';
|
||||
import {bootstrap, Component, Directive, View} from 'angular2/bootstrap';
|
||||
|
||||
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
|
||||
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {window, document, gc} from 'angular2/src/facade/browser';
|
||||
import {
|
||||
@ -22,6 +20,7 @@ import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {bind} from 'angular2/di';
|
||||
import {Inject} from 'angular2/src/di/decorators';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
|
||||
export const BENCHMARK_TYPE = 'LargetableComponent.benchmarkType';
|
||||
export const LARGETABLE_ROWS = 'LargetableComponent.rows';
|
||||
@ -41,8 +40,6 @@ function _createBindings() {
|
||||
var BASELINE_LARGETABLE_TEMPLATE;
|
||||
|
||||
function setupReflector() {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
|
||||
// TODO(kegluneq): Generate these.
|
||||
reflector.registerGetters({
|
||||
'benchmarktype': (o) => o.benchmarktype,
|
||||
@ -62,8 +59,6 @@ export function main() {
|
||||
var totalColumns = getIntParameter('columns');
|
||||
BASELINE_LARGETABLE_TEMPLATE = DOM.createTemplate('<table></table>');
|
||||
|
||||
setupReflector();
|
||||
|
||||
var app;
|
||||
var lifecycle;
|
||||
var baselineRootLargetableComponent;
|
||||
@ -132,6 +127,7 @@ export function main() {
|
||||
bindAction('#ng2UpdateDomProfile', profile(ng2CreateDom, noop, 'ng2-update'));
|
||||
bindAction('#ng2CreateDomProfile', profile(ng2CreateDom, ng2DestroyDom, 'ng2-create'));
|
||||
});
|
||||
setupReflector();
|
||||
}
|
||||
|
||||
function baselineDestroyDom() { baselineRootLargetableComponent.update(buildTable(0, 0)); }
|
||||
|
@ -1,8 +1,7 @@
|
||||
import {MapWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {bootstrap} from 'angular2/angular2';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
|
||||
import {App} from './app';
|
||||
|
||||
@ -10,8 +9,8 @@ import {APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/compiler/view_pool';
|
||||
import {bind} from 'angular2/di';
|
||||
|
||||
export function main() {
|
||||
setupReflector();
|
||||
bootstrap(App, createBindings());
|
||||
setupReflector();
|
||||
}
|
||||
|
||||
function createBindings(): List {
|
||||
@ -19,8 +18,6 @@ function createBindings(): List {
|
||||
}
|
||||
|
||||
export function setupReflector() {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
|
||||
// TODO(kegluneq): Generate this.
|
||||
reflector.registerSetters({
|
||||
'style': (o, m) => {
|
||||
|
@ -1,4 +1,11 @@
|
||||
import {bootstrap, Compiler, Component, Directive, View, ViewContainerRef} from 'angular2/angular2';
|
||||
import {
|
||||
bootstrap,
|
||||
Compiler,
|
||||
Component,
|
||||
Directive,
|
||||
View,
|
||||
ViewContainerRef
|
||||
} from 'angular2/bootstrap';
|
||||
|
||||
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
|
@ -1,8 +1,13 @@
|
||||
import {bootstrap, Compiler, Component, Directive, View, ViewContainerRef} from 'angular2/angular2';
|
||||
import {
|
||||
bootstrap,
|
||||
Compiler,
|
||||
Component,
|
||||
Directive,
|
||||
View,
|
||||
ViewContainerRef
|
||||
} from 'angular2/bootstrap';
|
||||
|
||||
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {List} from 'angular2/src/facade/collection';
|
||||
@ -24,10 +29,6 @@ function createBindings(): List<Binding> {
|
||||
return [bind(APP_VIEW_POOL_CAPACITY).toValue(viewCacheCapacity)];
|
||||
}
|
||||
|
||||
function setupReflector() {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
}
|
||||
|
||||
var BASELINE_TREE_TEMPLATE;
|
||||
var BASELINE_IF_TEMPLATE;
|
||||
|
||||
@ -35,8 +36,6 @@ export function main() {
|
||||
BrowserDomAdapter.makeCurrent();
|
||||
var maxDepth = getIntParameter('depth');
|
||||
|
||||
setupReflector();
|
||||
|
||||
BASELINE_TREE_TEMPLATE = DOM.createTemplate(
|
||||
'<span>_<template class="ng-binding"></template><template class="ng-binding"></template></span>');
|
||||
BASELINE_IF_TEMPLATE = DOM.createTemplate('<span template="if"><tree></tree></span>');
|
||||
|
Reference in New Issue
Block a user