From 1b78342e23f00ed5c6494e7d192a7356c841d7cb Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 26 Oct 2015 20:17:46 -0700 Subject: [PATCH] chore(ngUpgrade): Move into Angular2 This is moving ngUpgrade into the main repository per #4838. The ngUpgrade is published from the main import consistent with https://docs.google.com/document/d/1rbVTKTYLz6p2smQNYI8h4-QN-m2PS6F3iQIDmSzn0Ww/edit#heading=h.6cxvr9awtf5r Closes #4931 --- modules/angular2/angular2.ts | 1 + modules/angular2/src/upgrade/angular_js.ts | 123 ++++++++++++++++++ .../src => angular2/src/upgrade}/constants.ts | 0 .../src/upgrade}/downgrade_ng2_adapter.ts | 9 +- .../src => angular2/src/upgrade}/metadata.ts | 11 +- .../src/upgrade}/upgrade_adapter.ts | 18 ++- .../src/upgrade}/upgrade_ng1_adapter.ts | 17 +-- .../src => angular2/src/upgrade}/util.ts | 0 modules/angular2/test/public_api_spec.ts | 18 ++- .../test/upgrade}/metadata_spec.ts | 4 +- .../test/upgrade/upgrade_spec.ts} | 5 +- modules/angular2/upgrade.ts | 6 + modules/playground/src/upgrade/index.ts | 3 +- modules/upgrade/src/angular.d.ts | 115 ---------------- modules/upgrade/tsconfig.json | 17 --- modules/upgrade/upgrade.ts | 1 - test-main.js | 3 +- tools/broccoli/html-replace/SCRIPTS.html | 1 - tools/broccoli/trees/dart_tree.ts | 6 +- 19 files changed, 183 insertions(+), 175 deletions(-) create mode 100644 modules/angular2/src/upgrade/angular_js.ts rename modules/{upgrade/src => angular2/src/upgrade}/constants.ts (100%) rename modules/{upgrade/src => angular2/src/upgrade}/downgrade_ng2_adapter.ts (98%) rename modules/{upgrade/src => angular2/src/upgrade}/metadata.ts (83%) rename modules/{upgrade/src => angular2/src/upgrade}/upgrade_adapter.ts (97%) rename modules/{upgrade/src => angular2/src/upgrade}/upgrade_ng1_adapter.ts (96%) rename modules/{upgrade/src => angular2/src/upgrade}/util.ts (100%) rename modules/{upgrade/test => angular2/test/upgrade}/metadata_spec.ts (92%) rename modules/{upgrade/test/integration_spec.ts => angular2/test/upgrade/upgrade_spec.ts} (99%) create mode 100644 modules/angular2/upgrade.ts delete mode 100644 modules/upgrade/src/angular.d.ts delete mode 100644 modules/upgrade/tsconfig.json delete mode 100644 modules/upgrade/upgrade.ts diff --git a/modules/angular2/angular2.ts b/modules/angular2/angular2.ts index 2f2a1ebc4c..fb3ffaab93 100644 --- a/modules/angular2/angular2.ts +++ b/modules/angular2/angular2.ts @@ -2,3 +2,4 @@ export * from './core'; export * from './profile'; export * from './lifecycle_hooks'; export * from './bootstrap'; +export * from './upgrade'; diff --git a/modules/angular2/src/upgrade/angular_js.ts b/modules/angular2/src/upgrade/angular_js.ts new file mode 100644 index 0000000000..817815094f --- /dev/null +++ b/modules/angular2/src/upgrade/angular_js.ts @@ -0,0 +1,123 @@ +export interface IModule { + config(fn: any): IModule; + directive(selector: string, factory: any): IModule; + controller(name: string, type: any): IModule; + factory(key: string, factoryFn: any): IModule; + value(key: string, value: any): IModule; + run(a: any): void; +} +export interface ICompileService { + (element: Element | NodeList | string, transclude?: Function): ILinkFn; +} +export interface ILinkFn { + (scope: IScope, cloneAttachFn?: Function, options?: ILinkFnOptions): void; +} +export interface ILinkFnOptions { + parentBoundTranscludeFn?: Function; + transcludeControllers?: {[key: string]: any}; + futureParentElement?: Node; +} +export interface IRootScopeService { + $new(isolate?: boolean): IScope; + $id: string; + $watch(expr: any, fn?: (a1?: any, a2?: any) => void): Function; + $apply(): any; + $apply(exp: string): any; + $apply(exp: Function): any; + $$childTail: IScope; + $$childHead: IScope; + $$nextSibling: IScope; +} +export interface IScope extends IRootScopeService {} +export interface IAngularBootstrapConfig {} +export interface IDirective { + compile?: IDirectiveCompileFn; + controller?: any; + controllerAs?: string; + bindToController?: boolean | Object; + link?: IDirectiveLinkFn | IDirectivePrePost; + name?: string; + priority?: number; + replace?: boolean; + require?: any; + restrict?: string; + scope?: any; + template?: any; + templateUrl?: any; + terminal?: boolean; + transclude?: any; +} +export interface IDirectiveCompileFn { + (templateElement: IAugmentedJQuery, templateAttributes: IAttributes, + transclude: ITranscludeFunction): IDirectivePrePost; +} +export interface IDirectivePrePost { + pre?: IDirectiveLinkFn; + post?: IDirectiveLinkFn; +} +export interface IDirectiveLinkFn { + (scope: IScope, instanceElement: IAugmentedJQuery, instanceAttributes: IAttributes, + controller: any, transclude: ITranscludeFunction): void; +} +export interface IAttributes { $observe(attr: string, fn: (v: string) => void): void; } +export interface ITranscludeFunction { + // If the scope is provided, then the cloneAttachFn must be as well. + (scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery; + // If one argument is provided, then it's assumed to be the cloneAttachFn. + (cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; +} +export interface ICloneAttachFunction { + // Let's hint but not force cloneAttachFn's signature + (clonedElement?: IAugmentedJQuery, scope?: IScope): any; +} +export interface IAugmentedJQuery { + bind(name: string, fn: () => void): void; + data(name: string, value?: any): any; + inheritedData(name: string, value?: any): any; + contents(): IAugmentedJQuery; + parent(): IAugmentedJQuery; + length: number; + [index: number]: Node; +} +export interface IParseService { (expression: string): ICompiledExpression; } +export interface ICompiledExpression { assign(context: any, value: any): any; } +export interface IHttpBackendService { + (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, + withCredentials?: boolean): void; +} +export interface ICacheObject { + put(key: string, value?: T): T; + get(key: string): any; +} +export interface ITemplateCacheService extends ICacheObject {} +export interface IControllerService { + (controllerConstructor: Function, locals?: any, later?: any, ident?: any): any; + (controllerName: string, locals?: any): any; +} + +export interface IInjectorService { get(key: string): any; } + +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} +} = {bootstrap: noNg, module: noNg, element: noNg, version: noNg}; + + +try { + if (window.hasOwnProperty('angular')) { + angular = (window).angular; + } +} catch (e) { + // ignore in CJS mode. +} + +export var bootstrap = angular.bootstrap; +export var module = angular.module; +export var element = angular.element; +export var version = angular.version; diff --git a/modules/upgrade/src/constants.ts b/modules/angular2/src/upgrade/constants.ts similarity index 100% rename from modules/upgrade/src/constants.ts rename to modules/angular2/src/upgrade/constants.ts diff --git a/modules/upgrade/src/downgrade_ng2_adapter.ts b/modules/angular2/src/upgrade/downgrade_ng2_adapter.ts similarity index 98% rename from modules/upgrade/src/downgrade_ng2_adapter.ts rename to modules/angular2/src/upgrade/downgrade_ng2_adapter.ts index 50324e88a6..f4e9ec4903 100644 --- a/modules/upgrade/src/downgrade_ng2_adapter.ts +++ b/modules/angular2/src/upgrade/downgrade_ng2_adapter.ts @@ -6,13 +6,12 @@ import { HostViewRef, Injector, ProtoViewRef, - SimpleChange, - ViewRef + SimpleChange } from 'angular2/angular2'; import {NG1_SCOPE} from './constants'; import {ComponentInfo} from './metadata'; -import {ViewRef_} from "../../angular2/src/core/linker/view_ref"; import Element = protractor.Element; +import * as angular from './angular_js'; const INITIAL_VALUE = { __UNINITIALIZED__: true @@ -50,7 +49,7 @@ export class DowngradeNg2ComponentAdapter { this.contentInserctionPoint = renderer.rootContentInsertionPoints[0]; } - setupInputs() { + setupInputs(): void { var attrs = this.attrs; var inputs = this.info.inputs; for (var i = 0; i < inputs.length; i++) { @@ -67,7 +66,7 @@ export class DowngradeNg2ComponentAdapter { prevValue = value; } this.component[prop] = value; - } + }; })(input.prop); attrs.$observe(input.attr, observeFn); } else if (attrs.hasOwnProperty(input.bindAttr)) { diff --git a/modules/upgrade/src/metadata.ts b/modules/angular2/src/upgrade/metadata.ts similarity index 83% rename from modules/upgrade/src/metadata.ts rename to modules/angular2/src/upgrade/metadata.ts index feddc2e3c9..9f74cf6814 100644 --- a/modules/upgrade/src/metadata.ts +++ b/modules/angular2/src/upgrade/metadata.ts @@ -1,19 +1,10 @@ import {Type, ComponentMetadata, DirectiveResolver, DirectiveMetadata} from 'angular2/angular2'; -import {stringify} from 'upgrade/src/util'; +import {stringify} from './util'; var COMPONENT_SELECTOR = /^[\w|-]*$/; var SKEWER_CASE = /-(\w)/g; var directiveResolver = new DirectiveResolver(); -interface Reflect { - getOwnMetadata(name: string, type: Function): any; - defineMetadata(name: string, value: any, cls: Type): void; -} -var Reflect: Reflect = (window).Reflect; -if (!(Reflect && (Reflect)['getOwnMetadata'])) { - throw 'reflect-metadata shim is required when using class decorators'; -} - export interface AttrProp { prop: string; attr: string; diff --git a/modules/upgrade/src/upgrade_adapter.ts b/modules/angular2/src/upgrade/upgrade_adapter.ts similarity index 97% rename from modules/upgrade/src/upgrade_adapter.ts rename to modules/angular2/src/upgrade/upgrade_adapter.ts index d96d462de7..0655e9f97e 100644 --- a/modules/upgrade/src/upgrade_adapter.ts +++ b/modules/angular2/src/upgrade/upgrade_adapter.ts @@ -1,5 +1,3 @@ -/// - import { bind, provide, @@ -36,6 +34,7 @@ import { } from './constants'; import {DowngradeNg2ComponentAdapter} from './downgrade_ng2_adapter'; import {UpgradeNg1ComponentAdapterBuilder} from './upgrade_ng1_adapter'; +import * as angular from './angular_js'; var upgradeCount: number = 0; @@ -295,7 +294,7 @@ export class UpgradeAdapter { bootstrap(element: Element, modules?: any[], config?: angular.IAngularBootstrapConfig): UpgradeAdapterRef { var upgrade = new UpgradeAdapterRef(); - var ng1Injector: angular.auto.IInjectorService = null; + var ng1Injector: angular.IInjectorService = null; var platformRef: PlatformRef = platform(); var applicationRef: ApplicationRef = platformRef.application([ applicationCommonProviders(), @@ -341,7 +340,7 @@ export class UpgradeAdapter { .run([ '$injector', '$rootScope', - (injector: angular.auto.IInjectorService, rootScope: angular.IRootScopeService) => { + (injector: angular.IInjectorService, rootScope: angular.IRootScopeService) => { ng1Injector = injector; ngZone.overrideOnTurnDone(() => rootScope.$apply()); ng1compilePromise = @@ -440,7 +439,7 @@ export class UpgradeAdapter { public upgradeNg1Provider(name: string, options?: {asToken: any}) { var token = options && options.asToken || name; this.providers.push(provide(token, { - useFactory: (ng1Injector: angular.auto.IInjectorService) => ng1Injector.get(name), + useFactory: (ng1Injector: angular.IInjectorService) => ng1Injector.get(name), deps: [NG1_INJECTOR] })); } @@ -469,7 +468,7 @@ export class UpgradeAdapter { */ public downgradeNg2Provider(token: any): Function { var factory = function(injector: Injector) { return injector.get(token); }; - factory.$inject = [NG2_INJECTOR]; + (factory).$inject = [NG2_INJECTOR]; return factory; } @@ -496,7 +495,7 @@ interface ProtoViewRefMap { } function ng1ComponentDirective(info: ComponentInfo, idPrefix: string): Function { - directiveFactory.$inject = [NG2_PROTO_VIEW_REF_MAP, NG2_APP_VIEW_MANAGER, NG1_PARSE]; + (directiveFactory).$inject = [NG2_PROTO_VIEW_REF_MAP, NG2_APP_VIEW_MANAGER, NG1_PARSE]; function directiveFactory(protoViewRefMap: ProtoViewRefMap, viewManager: AppViewManager, parse: angular.IParseService): angular.IDirective { var protoView: ProtoViewRef = protoViewRefMap[info.selector]; @@ -532,13 +531,12 @@ export class UpgradeAdapterRef { private _readyFn: (upgradeAdapterRef?: UpgradeAdapterRef) => void = null; public ng1RootScope: angular.IRootScopeService = null; - public ng1Injector: angular.auto.IInjectorService = null; + public ng1Injector: angular.IInjectorService = null; public ng2ApplicationRef: ApplicationRef = null; public ng2Injector: Injector = null; /* @internal */ - private _bootstrapDone(applicationRef: ApplicationRef, - ng1Injector: angular.auto.IInjectorService) { + private _bootstrapDone(applicationRef: ApplicationRef, ng1Injector: angular.IInjectorService) { this.ng2ApplicationRef = applicationRef; this.ng2Injector = applicationRef.injector; this.ng1Injector = ng1Injector; diff --git a/modules/upgrade/src/upgrade_ng1_adapter.ts b/modules/angular2/src/upgrade/upgrade_ng1_adapter.ts similarity index 96% rename from modules/upgrade/src/upgrade_ng1_adapter.ts rename to modules/angular2/src/upgrade/upgrade_ng1_adapter.ts index e9924fa820..e3d34695aa 100644 --- a/modules/upgrade/src/upgrade_ng1_adapter.ts +++ b/modules/angular2/src/upgrade/upgrade_ng1_adapter.ts @@ -16,6 +16,7 @@ import { NG1_CONTROLLER } from './constants'; import {controllerKey} from './util'; +import * as angular from './angular_js'; const CAMEL_CASE = /([A-Z])/g; const INITIAL_VALUE = { @@ -57,7 +58,7 @@ export class UpgradeNg1ComponentAdapterBuilder { }); } - extractDirective(injector: angular.auto.IInjectorService): angular.IDirective { + extractDirective(injector: angular.IInjectorService): angular.IDirective { var directives: angular.IDirective[] = injector.get(this.name + 'Directive'); if (directives.length > 1) { throw new Error('Only support single directive definition for: ' + this.name); @@ -141,7 +142,7 @@ export class UpgradeNg1ComponentAdapterBuilder { throw new Error(`Directive '${this.name}' is not a component, it is missing template.`); } return null; - function compileHtml(html) { + function compileHtml(html): angular.ILinkFn { var div = document.createElement('div'); div.innerHTML = html; return compile(div.childNodes); @@ -149,7 +150,7 @@ export class UpgradeNg1ComponentAdapterBuilder { } static resolve(exportedComponents: {[name: string]: UpgradeNg1ComponentAdapterBuilder}, - injector: angular.auto.IInjectorService): Promise { + injector: angular.IInjectorService): Promise { var promises = []; var compile: angular.ICompileService = injector.get(NG1_COMPILE); var templateCache: angular.ITemplateCacheService = injector.get(NG1_TEMPLATE_CACHE); @@ -162,7 +163,7 @@ export class UpgradeNg1ComponentAdapterBuilder { exportedComponent.$controller = $controller; exportedComponent.extractBindings(); var promise = exportedComponent.compileTemplate(compile, templateCache, httpBackend); - if (promise) promises.push(promise) + if (promise) promises.push(promise); } } return Promise.all(promises); @@ -208,7 +209,7 @@ class UpgradeNg1ComponentAdapter implements OnChanges, DoCheck { for (var i = 0, ii = clonedElement.length; i < ii; i++) { element.appendChild(clonedElement[i]); } - }, {parentBoundTranscludeFn: (scope, cloneAttach) => { cloneAttach(childNodes) }}); + }, {parentBoundTranscludeFn: (scope, cloneAttach) => { cloneAttach(childNodes); }}); for (var i = 0; i < inputs.length; i++) { this[inputs[i]] = null; @@ -223,16 +224,16 @@ class UpgradeNg1ComponentAdapter implements OnChanges, DoCheck { } } - onChanges(changes) { + onChanges(changes: {[name: string]: SimpleChange}) { for (var name in changes) { - if (changes.hasOwnProperty(name)) { + if ((changes).hasOwnProperty(name)) { var change: SimpleChange = changes[name]; this.setComponentProperty(name, change.currentValue); } } } - doCheck() { + doCheck(): number { var count = 0; var destinationObj = this.destinationObj; var lastValues = this.checkLastValues; diff --git a/modules/upgrade/src/util.ts b/modules/angular2/src/upgrade/util.ts similarity index 100% rename from modules/upgrade/src/util.ts rename to modules/angular2/src/upgrade/util.ts diff --git a/modules/angular2/test/public_api_spec.ts b/modules/angular2/test/public_api_spec.ts index d444bea3dd..453761fba9 100644 --- a/modules/angular2/test/public_api_spec.ts +++ b/modules/angular2/test/public_api_spec.ts @@ -25,7 +25,7 @@ import {SymbolsDiff} from './symbol_inspector/symbol_differ'; // ================================================================================================= // ================================================================================================= -var NG_API = [ +var NG_ALL = [ 'APP_COMPONENT', 'APP_ID', 'AbstractProviderError', @@ -1450,6 +1450,22 @@ var NG_API = [ 'Stream.where():dart', ]; +var NG_UPGRADE = [ + 'UpgradeAdapter:js', + 'UpgradeAdapter.addProvider():js', + 'UpgradeAdapter.bootstrap():js', + 'UpgradeAdapter.compileNg2Components():js', + 'UpgradeAdapter.downgradeNg2Component():js', + 'UpgradeAdapter.downgradeNg2Provider():js', + 'UpgradeAdapter.upgradeNg1Component():js', + 'UpgradeAdapter.upgradeNg1Provider():js', + 'UpgradeAdapterRef:js', + 'UpgradeAdapterRef.dispose():js', + 'UpgradeAdapterRef.ready():js' +]; + +var NG_API = [].concat(NG_ALL).concat(NG_UPGRADE); + export function main() { /** var x = getSymbolsFromLibrary('ng'); diff --git a/modules/upgrade/test/metadata_spec.ts b/modules/angular2/test/upgrade/metadata_spec.ts similarity index 92% rename from modules/upgrade/test/metadata_spec.ts rename to modules/angular2/test/upgrade/metadata_spec.ts index f3e814803b..b888453803 100644 --- a/modules/upgrade/test/metadata_spec.ts +++ b/modules/angular2/test/upgrade/metadata_spec.ts @@ -12,9 +12,11 @@ import { } from 'angular2/testing_internal'; import {Component, View} from 'angular2/angular2'; -import {getComponentInfo, parseFields} from 'upgrade/src/metadata'; +import {getComponentInfo, parseFields} from 'angular2/src/upgrade/metadata'; +import {DOM} from 'angular2/src/core/dom/dom_adapter'; export function main() { + if (!DOM.supportsDOMEvents()) return; describe('upgrade metadata', () => { it('should extract component selector', () => { expect(getComponentInfo(ElementNameComponent).selector).toEqual('elementNameDashed'); diff --git a/modules/upgrade/test/integration_spec.ts b/modules/angular2/test/upgrade/upgrade_spec.ts similarity index 99% rename from modules/upgrade/test/integration_spec.ts rename to modules/angular2/test/upgrade/upgrade_spec.ts index 7362cfd45b..33bf30d166 100644 --- a/modules/upgrade/test/integration_spec.ts +++ b/modules/angular2/test/upgrade/upgrade_spec.ts @@ -10,11 +10,14 @@ import { xdescribe, xit, } from 'angular2/testing_internal'; +import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {Component, Class, Inject, EventEmitter, ApplicationRef, provide} from 'angular2/angular2'; -import {UpgradeAdapter} from 'upgrade/upgrade'; +import {UpgradeAdapter} from 'angular2/upgrade'; +import * as angular from 'angular2/src/upgrade/angular_js'; export function main() { + if (!DOM.supportsDOMEvents()) return; describe('adapter: ng1 to ng2', () => { it('should have angular 1 loaded', () => expect(angular.version.major).toBe(1)); diff --git a/modules/angular2/upgrade.ts b/modules/angular2/upgrade.ts new file mode 100644 index 0000000000..b936a5ea13 --- /dev/null +++ b/modules/angular2/upgrade.ts @@ -0,0 +1,6 @@ +/** + * @module + * @description + * Adapter allowing AngularJS v1 and Angular v2 to run side by side in the same application. + */ +export {UpgradeAdapter, UpgradeAdapterRef} from './src/upgrade/upgrade_adapter'; diff --git a/modules/playground/src/upgrade/index.ts b/modules/playground/src/upgrade/index.ts index 8680421ab2..62765c380d 100644 --- a/modules/playground/src/upgrade/index.ts +++ b/modules/playground/src/upgrade/index.ts @@ -1,5 +1,6 @@ import {Component, Input, Output, EventEmitter} from 'angular2/angular2'; -import {UpgradeAdapter} from 'upgrade/upgrade'; +import {UpgradeAdapter} from 'angular2/angular2'; +import * as angular from '../../../angular2/src/upgrade/angular_js'; var styles = [ ` diff --git a/modules/upgrade/src/angular.d.ts b/modules/upgrade/src/angular.d.ts deleted file mode 100644 index 10f713ca19..0000000000 --- a/modules/upgrade/src/angular.d.ts +++ /dev/null @@ -1,115 +0,0 @@ -declare namespace angular { - function module(prefix: string, dependencies?: string[]); - interface IModule { - config(fn: any): IModule; - directive(selector: string, factory: any): IModule; - value(key: string, value: any): IModule; - run(a: any); - } - interface ICompileService { - (element: Element | NodeList | string, transclude?: Function): ILinkFn; - } - interface ILinkFn { - (scope: IScope, cloneAttachFn?: Function, options?: ILinkFnOptions): void - } - interface ILinkFnOptions { - parentBoundTranscludeFn?: Function, transcludeControllers?: {[key: string]: any}, - futureParentElement?: Node - } - interface IRootScopeService { - $new(isolate?: boolean): IScope; - $id: string; - $watch(expr: any, fn?: (a1?: any, a2?: any) => void); - $apply(): any; - $apply(exp: string): any; - $apply(exp: Function): any; - $$childTail: IScope; - $$childHead: IScope; - $$nextSibling: IScope; - } - interface IScope extends IRootScopeService {} - interface IAngularBootstrapConfig {} - interface IDirective { - compile?: IDirectiveCompileFn; - controller?: any; - controllerAs?: string; - bindToController?: boolean | Object; - link?: IDirectiveLinkFn | IDirectivePrePost; - name?: string; - priority?: number; - replace?: boolean; - require?: any; - restrict?: string; - scope?: any; - template?: any; - templateUrl?: any; - terminal?: boolean; - transclude?: any; - } - interface IDirectiveCompileFn { - (templateElement: IAugmentedJQuery, templateAttributes: IAttributes, - transclude: ITranscludeFunction): IDirectivePrePost; - } - interface IDirectivePrePost { - pre?: IDirectiveLinkFn; - post?: IDirectiveLinkFn; - } - interface IDirectiveLinkFn { - (scope: IScope, instanceElement: IAugmentedJQuery, instanceAttributes: IAttributes, - controller: any, transclude: ITranscludeFunction): void; - } - interface IAttributes { - $observe(attr: string, fn: (v: string) => void); - } - interface ITranscludeFunction { - // If the scope is provided, then the cloneAttachFn must be as well. - (scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery; - // If one argument is provided, then it's assumed to be the cloneAttachFn. - (cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; - } - interface ICloneAttachFunction { - // Let's hint but not force cloneAttachFn's signature - (clonedElement?: IAugmentedJQuery, scope?: IScope): any; - } - interface IAugmentedJQuery { - bind(name: string, fn: () => void); - data(name: string, value?: any); - inheritedData(name: string, value?: any); - contents(): IAugmentedJQuery; - parent(): IAugmentedJQuery; - length: number; - [index: number]: Node; - } - interface IParseService { - (expression: string): ICompiledExpression; - } - interface ICompiledExpression { - assign(context: any, value: any): any; - } - function element(e: Element): IAugmentedJQuery; - function bootstrap(e: Element, modules: string[], config: IAngularBootstrapConfig); - interface IHttpBackendService { - (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, - withCredentials?: boolean): void; - } - interface ICacheObject { - put(key: string, value?: T): T; - get(key: string): any; - } - interface ITemplateCacheService extends ICacheObject {} - interface IControllerService { - (controllerConstructor: Function, locals?: any, later?: any, ident?: any): any; - (controllerName: string, locals?: any): any; - } - - namespace auto { - interface IInjectorService { - get(key: string): any; - } - } - var version: {major: number}; -} - -interface Function { - $inject?: string[]; -} diff --git a/modules/upgrade/tsconfig.json b/modules/upgrade/tsconfig.json deleted file mode 100644 index e49a4cb114..0000000000 --- a/modules/upgrade/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es3", - "noImplicitAny": false, - "rootDir": ".", - "sourceMap": false, - "noEmit": true - }, - "files": [ - "src/angular.d.ts", - "upgrade.ts" - ], - "exclude": [ - "node_modules" - ] -} diff --git a/modules/upgrade/upgrade.ts b/modules/upgrade/upgrade.ts deleted file mode 100644 index 9ae1c1f71c..0000000000 --- a/modules/upgrade/upgrade.ts +++ /dev/null @@ -1 +0,0 @@ -export {UpgradeAdapter} from './src/upgrade_adapter'; diff --git a/test-main.js b/test-main.js index fef0e3d686..40c4be42eb 100644 --- a/test-main.js +++ b/test-main.js @@ -14,8 +14,7 @@ System.config({ 'benchpress/*': 'dist/js/dev/es5/benchpress/*.js', 'angular2/*': 'dist/js/dev/es5/angular2/*.js', 'angular2_material/*': 'dist/js/dev/es5/angular2_material/*.js', - '@reactivex/rxjs/*': 'node_modules/@reactivex/rxjs/*.js', - 'upgrade/*': 'dist/js/dev/es5/upgrade/*.js' + '@reactivex/rxjs/*': 'node_modules/@reactivex/rxjs/*.js' } }); diff --git a/tools/broccoli/html-replace/SCRIPTS.html b/tools/broccoli/html-replace/SCRIPTS.html index 9f4e94729a..0402ad59c7 100644 --- a/tools/broccoli/html-replace/SCRIPTS.html +++ b/tools/broccoli/html-replace/SCRIPTS.html @@ -5,7 +5,6 @@ baseURL: '/', packages: { 'angular2_material': {defaultExtension: 'js'}, - 'upgrade': {defaultExtension: 'js'}, 'benchmarks': {defaultExtension: 'js'}, 'playground': {defaultExtension: 'js'}, // TODO(rado): These helpers don't end up in the bundle, thus they should diff --git a/tools/broccoli/trees/dart_tree.ts b/tools/broccoli/trees/dart_tree.ts index 3b1c7698c5..69c9fe9409 100644 --- a/tools/broccoli/trees/dart_tree.ts +++ b/tools/broccoli/trees/dart_tree.ts @@ -15,14 +15,16 @@ import replace from '../broccoli-replace'; var global_excludes = [ 'angular2/http*', + 'angular2/upgrade*', 'angular2/examples/*/ts/**/*', 'angular2/src/http/**/*', 'angular2/test/http/**/*', + 'angular2/src/upgrade/**/*', + 'angular2/test/upgrade/**/*', 'playground/src/http/**/*', 'playground/test/http/**/*', 'playground/src/jsonp/**/*', - 'playground/test/jsonp/**/*', - 'upgrade/**/*' + 'playground/test/jsonp/**/*' ];