revert(format): Revert "chore(format): update to latest formatter"

This reverts commit 03627aa84d.
This commit is contained in:
Alex Rickabaugh
2016-04-12 09:41:01 -07:00
parent 03627aa84d
commit 60727c4d2b
527 changed files with 19246 additions and 13969 deletions
+18 -17
View File
@@ -8,7 +8,7 @@ export interface IModule {
run(a: any): void;
}
export interface ICompileService {
(element: Element|NodeList|string, transclude?: Function): ILinkFn;
(element: Element | NodeList | string, transclude?: Function): ILinkFn;
}
export interface ILinkFn {
(scope: IScope, cloneAttachFn?: Function, options?: ILinkFnOptions): void;
@@ -35,8 +35,8 @@ export interface IDirective {
compile?: IDirectiveCompileFn;
controller?: any;
controllerAs?: string;
bindToController?: boolean|Object;
link?: IDirectiveLinkFn|IDirectivePrePost;
bindToController?: boolean | Object;
link?: IDirectiveLinkFn | IDirectivePrePost;
name?: string;
priority?: number;
replace?: boolean;
@@ -119,20 +119,21 @@ function noNg() {
throw new Error('AngularJS v1.x is not loaded!');
}
var angular: {
bootstrap: (e: Element, modules: string[], config: IAngularBootstrapConfig) => void,
module: (prefix: string, dependencies?: string[]) => IModule,
element: (e: Element) => IAugmentedJQuery,
version: {major: number}, resumeBootstrap?: () => void,
getTestability: (e: Element) => ITestabilityService
} = <any>{
bootstrap: noNg,
module: noNg,
element: noNg,
version: noNg,
resumeBootstrap: noNg,
getTestability: noNg
};
var angular:
{
bootstrap: (e: Element, modules: string[], config: IAngularBootstrapConfig) => void,
module: (prefix: string, dependencies?: string[]) => IModule,
element: (e: Element) => IAugmentedJQuery,
version: {major: number}, resumeBootstrap?: () => void,
getTestability: (e: Element) => ITestabilityService
} = <any>{
bootstrap: noNg,
module: noNg,
element: noNg,
version: noNg,
resumeBootstrap: noNg,
getTestability: noNg
};
try {
@@ -1,4 +1,13 @@
import {provide, AppViewManager, ChangeDetectorRef, HostViewRef, Injector, OnChanges, HostViewFactoryRef, SimpleChange} from 'angular2/core';
import {
provide,
AppViewManager,
ChangeDetectorRef,
HostViewRef,
Injector,
OnChanges,
HostViewFactoryRef,
SimpleChange
} from 'angular2/core';
import {NG1_SCOPE} from './constants';
import {ComponentInfo} from './metadata';
import Element = protractor.Element;
@@ -18,11 +27,11 @@ export class DowngradeNg2ComponentAdapter {
childNodes: Node[];
contentInsertionPoint: Node = null;
constructor(
private id: string, private info: ComponentInfo, private element: angular.IAugmentedJQuery,
private attrs: angular.IAttributes, private scope: angular.IScope,
private parentInjector: Injector, private parse: angular.IParseService,
private viewManager: AppViewManager, private hostViewFactory: HostViewFactoryRef) {
constructor(private id: string, private info: ComponentInfo,
private element: angular.IAugmentedJQuery, private attrs: angular.IAttributes,
private scope: angular.IScope, private parentInjector: Injector,
private parse: angular.IParseService, private viewManager: AppViewManager,
private hostViewFactory: HostViewFactoryRef) {
(<any>this.element[0]).id = id;
this.componentScope = scope.$new();
this.childNodes = <Node[]><any>element.contents();
@@ -114,9 +123,10 @@ export class DowngradeNg2ComponentAdapter {
var bindonAttr =
output.bindonAttr ? output.bindonAttr.substring(0, output.bindonAttr.length - 6) : null;
var bracketParenAttr = output.bracketParenAttr ?
`[(${output.bracketParenAttr.substring(2, output.bracketParenAttr.length - 8)})]` :
null;
var bracketParenAttr =
output.bracketParenAttr ?
`[(${output.bracketParenAttr.substring(2, output.bracketParenAttr.length - 8)})]` :
null;
if (attrs.hasOwnProperty(output.onAttr)) {
expr = attrs[output.onAttr];
+53 -23
View File
@@ -1,11 +1,38 @@
import {provide, platform, ApplicationRef, AppViewManager, Compiler, Injector, NgZone, PlatformRef, HostViewFactoryRef, Provider, Type, Testability, APPLICATION_COMMON_PROVIDERS} from 'angular2/core';
import {
provide,
platform,
ApplicationRef,
AppViewManager,
Compiler,
Injector,
NgZone,
PlatformRef,
HostViewFactoryRef,
Provider,
Type,
Testability,
APPLICATION_COMMON_PROVIDERS
} from 'angular2/core';
import {global} from 'angular2/src/facade/lang';
import {ObservableWrapper} from 'angular2/src/facade/async';
import {BROWSER_PROVIDERS, BROWSER_APP_PROVIDERS} from 'angular2/platform/browser';
import {getComponentInfo, ComponentInfo} from './metadata';
import {onError, controllerKey} from './util';
import {NG1_COMPILE, NG1_INJECTOR, NG1_PARSE, NG1_ROOT_SCOPE, NG1_SCOPE, NG1_TESTABILITY, NG2_APP_VIEW_MANAGER, NG2_COMPILER, NG2_INJECTOR, NG2_HOST_VIEW_FACTORY_REF_MAP, NG2_ZONE, REQUIRE_INJECTOR} from './constants';
import {
NG1_COMPILE,
NG1_INJECTOR,
NG1_PARSE,
NG1_ROOT_SCOPE,
NG1_SCOPE,
NG1_TESTABILITY,
NG2_APP_VIEW_MANAGER,
NG2_COMPILER,
NG2_INJECTOR,
NG2_HOST_VIEW_FACTORY_REF_MAP,
NG2_ZONE,
REQUIRE_INJECTOR
} from './constants';
import {DowngradeNg2ComponentAdapter} from './downgrade_ng2_adapter';
import {UpgradeNg1ComponentAdapterBuilder} from './upgrade_ng1_adapter';
import * as angular from './angular_js';
@@ -89,7 +116,7 @@ export class UpgradeAdapter {
/* @internal */
private downgradedComponents: {[name: string]: UpgradeNg1ComponentAdapterBuilder} = {};
/* @internal */
private providers: Array<Type|Provider|any[]> = [];
private providers: Array<Type | Provider | any[]> = [];
/**
* Allows Angular v2 Component to be used from AngularJS v1.
@@ -265,14 +292,16 @@ export class UpgradeAdapter {
* });
* ```
*/
bootstrap(element: Element, modules?: any[], config?: angular.IAngularBootstrapConfig):
UpgradeAdapterRef {
bootstrap(element: Element, modules?: any[],
config?: angular.IAngularBootstrapConfig): UpgradeAdapterRef {
var upgrade = new UpgradeAdapterRef();
var ng1Injector: angular.IInjectorService = null;
var platformRef: PlatformRef = platform(BROWSER_PROVIDERS);
var applicationRef: ApplicationRef = platformRef.application([
BROWSER_APP_PROVIDERS, provide(NG1_INJECTOR, {useFactory: () => ng1Injector}),
provide(NG1_COMPILE, {useFactory: () => ng1Injector.get(NG1_COMPILE)}), this.providers
BROWSER_APP_PROVIDERS,
provide(NG1_INJECTOR, {useFactory: () => ng1Injector}),
provide(NG1_COMPILE, {useFactory: () => ng1Injector.get(NG1_COMPILE)}),
this.providers
]);
var injector: Injector = applicationRef.injector;
var ngZone: NgZone = injector.get(NgZone);
@@ -301,7 +330,7 @@ export class UpgradeAdapter {
original$applyFn = rootScopePrototype.$apply;
rootScopePrototype.$apply = (exp) => delayApplyExps.push(exp);
} else {
throw new Error('Failed to find \'$apply\' on \'$rootScope\'!');
throw new Error("Failed to find '$apply' on '$rootScope'!");
}
return rootScope = rootScopeDelegate;
}
@@ -332,11 +361,12 @@ export class UpgradeAdapter {
ng1compilePromise = new Promise((resolve, reject) => {
ng1Module.run([
'$injector', '$rootScope',
'$injector',
'$rootScope',
(injector: angular.IInjectorService, rootScope: angular.IRootScopeService) => {
ng1Injector = injector;
ObservableWrapper.subscribe(
ngZone.onMicrotaskEmpty, (_) => ngZone.runOutsideAngular(() => rootScope.$apply()));
ObservableWrapper.subscribe(ngZone.onMicrotaskEmpty,
(_) => ngZone.runOutsideAngular(() => rootScope.$apply()));
UpgradeNg1ComponentAdapterBuilder.resolve(this.downgradedComponents, injector)
.then(resolve, reject);
}
@@ -362,11 +392,11 @@ export class UpgradeAdapter {
}
});
Promise
.all([
this.compileNg2Components(compiler, hostViewFactoryRefMap), ng1BootstrapPromise,
ng1compilePromise
])
Promise.all([
this.compileNg2Components(compiler, hostViewFactoryRefMap),
ng1BootstrapPromise,
ng1compilePromise
])
.then(() => {
ngZone.run(() => {
if (rootScopePrototype) {
@@ -418,7 +448,7 @@ export class UpgradeAdapter {
* adapter.bootstrap(document.body, ['myExample']);
*```
*/
public addProvider(provider: Type|Provider|any[]): void { this.providers.push(provider); }
public addProvider(provider: Type | Provider | any[]): void { this.providers.push(provider); }
/**
* Allows AngularJS v1 service to be accessible from Angular v2.
@@ -513,9 +543,9 @@ interface HostViewFactoryRefMap {
function ng1ComponentDirective(info: ComponentInfo, idPrefix: string): Function {
(<any>directiveFactory).$inject =
[NG2_HOST_VIEW_FACTORY_REF_MAP, NG2_APP_VIEW_MANAGER, NG1_PARSE];
function directiveFactory(
hostViewFactoryRefMap: HostViewFactoryRefMap, viewManager: AppViewManager,
parse: angular.IParseService): angular.IDirective {
function directiveFactory(hostViewFactoryRefMap: HostViewFactoryRefMap,
viewManager: AppViewManager,
parse: angular.IParseService): angular.IDirective {
var hostViewFactory: HostViewFactoryRef = hostViewFactoryRefMap[info.selector];
if (!hostViewFactory) throw new Error('Expecting HostViewFactoryRef for: ' + info.selector);
var idCount = 0;
@@ -526,9 +556,9 @@ function ng1ComponentDirective(info: ComponentInfo, idPrefix: string): Function
post: (scope: angular.IScope, element: angular.IAugmentedJQuery, attrs: angular.IAttributes,
parentInjector: any, transclude: angular.ITranscludeFunction): void => {
var domElement = <any>element[0];
var facade = new DowngradeNg2ComponentAdapter(
idPrefix + (idCount++), info, element, attrs, scope, <Injector>parentInjector, parse,
viewManager, hostViewFactory);
var facade = new DowngradeNg2ComponentAdapter(idPrefix + (idCount++), info, element,
attrs, scope, <Injector>parentInjector,
parse, viewManager, hostViewFactory);
facade.setupInputs();
facade.bootstrapNg2();
facade.projectContent();
@@ -1,5 +1,20 @@
import {Directive, DoCheck, ElementRef, EventEmitter, Inject, OnChanges, SimpleChange, Type} from 'angular2/core';
import {NG1_COMPILE, NG1_SCOPE, NG1_HTTP_BACKEND, NG1_TEMPLATE_CACHE, NG1_CONTROLLER} from './constants';
import {
Directive,
DoCheck,
ElementRef,
EventEmitter,
Inject,
OnChanges,
SimpleChange,
Type
} from 'angular2/core';
import {
NG1_COMPILE,
NG1_SCOPE,
NG1_HTTP_BACKEND,
NG1_TEMPLATE_CACHE,
NG1_CONTROLLER
} from './constants';
import {controllerKey} from './util';
import * as angular from './angular_js';
@@ -30,7 +45,8 @@ export class UpgradeNg1ComponentAdapterBuilder {
Directive({selector: selector, inputs: this.inputsRename, outputs: this.outputsRename})
.Class({
constructor: [
new Inject(NG1_SCOPE), ElementRef,
new Inject(NG1_SCOPE),
ElementRef,
function(scope: angular.IScope, elementRef: ElementRef) {
return new UpgradeNg1ComponentAdapter(
self.linkFn, scope, self.directive, elementRef, self.$controller, self.inputs,
@@ -112,9 +128,8 @@ export class UpgradeNg1ComponentAdapterBuilder {
}
}
compileTemplate(
compile: angular.ICompileService, templateCache: angular.ITemplateCacheService,
httpBackend: angular.IHttpBackendService): Promise<any> {
compileTemplate(compile: angular.ICompileService, templateCache: angular.ITemplateCacheService,
httpBackend: angular.IHttpBackendService): Promise<any> {
if (this.directive.template !== undefined) {
this.linkFn = compileHtml(this.directive.template);
} else if (this.directive.templateUrl) {
@@ -144,9 +159,8 @@ export class UpgradeNg1ComponentAdapterBuilder {
}
}
static resolve(
exportedComponents: {[name: string]: UpgradeNg1ComponentAdapterBuilder},
injector: angular.IInjectorService): Promise<any> {
static resolve(exportedComponents: {[name: string]: UpgradeNg1ComponentAdapterBuilder},
injector: angular.IInjectorService): Promise<any> {
var promises = [];
var compile: angular.ICompileService = injector.get(NG1_COMPILE);
var templateCache: angular.ITemplateCacheService = injector.get(NG1_TEMPLATE_CACHE);
@@ -170,11 +184,10 @@ class UpgradeNg1ComponentAdapter implements OnChanges, DoCheck {
destinationObj: any = null;
checkLastValues: any[] = [];
constructor(
linkFn: angular.ILinkFn, scope: angular.IScope, private directive: angular.IDirective,
elementRef: ElementRef, $controller: angular.IControllerService, private inputs: string[],
private outputs: string[], private propOuts: string[], private checkProperties: string[],
private propertyMap: {[key: string]: string}) {
constructor(linkFn: angular.ILinkFn, scope: angular.IScope, private directive: angular.IDirective,
elementRef: ElementRef, $controller: angular.IControllerService,
private inputs: string[], private outputs: string[], private propOuts: string[],
private checkProperties: string[], private propertyMap: {[key: string]: string}) {
var element: Element = elementRef.nativeElement;
var childNodes: Node[] = [];
var childNode;
@@ -197,8 +210,8 @@ class UpgradeNg1ComponentAdapter implements OnChanges, DoCheck {
var attrs: angular.IAttributes = NOT_SUPPORTED;
var transcludeFn: angular.ITranscludeFunction = NOT_SUPPORTED;
var linkController = this.resolveRequired($element, directive.require);
(<angular.IDirectiveLinkFn>directive.link)(
componentScope, $element, attrs, linkController, transcludeFn);
(<angular.IDirectiveLinkFn>directive.link)(componentScope, $element, attrs, linkController,
transcludeFn);
}
this.destinationObj = directive.bindToController && controller ? controller : componentScope;
@@ -261,7 +274,7 @@ class UpgradeNg1ComponentAdapter implements OnChanges, DoCheck {
this.destinationObj[this.propertyMap[name]] = value;
}
private resolveRequired($element: angular.IAugmentedJQuery, require: string|string[]): any {
private resolveRequired($element: angular.IAugmentedJQuery, require: string | string[]): any {
if (!require) {
return undefined;
} else if (typeof require == 'string') {