diff --git a/docs/typescript-definition-package/index.js b/docs/typescript-definition-package/index.js index c1669cbd34..a0b73f08ef 100644 --- a/docs/typescript-definition-package/index.js +++ b/docs/typescript-definition-package/index.js @@ -52,11 +52,9 @@ module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage, id: 'angular2/angular2', references: ['../es6-promise/es6-promise.d.ts', '../rx/rx.d.ts'], modules: { - 'angular2/angular2': {namespace: 'ng', id: 'angular2/angular2'} - /* TODO(jeffbcross): re-implement with @jteplitz as part of #3926, + 'angular2/angular2': {namespace: 'ng', id: 'angular2/angular2'}, 'angular2/web_worker/worker': {namespace: 'ngWorker', id: 'angular2/web_worker/worker'}, 'angular2/web_worker/ui': {namespace: 'ngUi', id: 'angular2/web_worker/ui'} - */ } }, { diff --git a/docs/typescript-definition-package/processors/code_gen.js b/docs/typescript-definition-package/processors/code_gen.js index 04136e4d69..a55d4b9636 100644 --- a/docs/typescript-definition-package/processors/code_gen.js +++ b/docs/typescript-definition-package/processors/code_gen.js @@ -5,6 +5,7 @@ function DtsSerializer(remap) { } DtsSerializer.prototype = { + _initializerRegex: /\s*=[^>][^,}]*/g, constructor: DtsSerializer, @@ -18,15 +19,21 @@ DtsSerializer.prototype = { } if (ast.parameters) { buffer.push('('); - buffer.push(ast.parameters.join(', ')); + var parameters = ast.parameters; + for (var i = 0; i < parameters.length; i++) { + parameters[i] = parameters[i].replace(this._initializerRegex, ''); + } + buffer.push(parameters.join(', ')); buffer.push(')'); } - if (ast.returnType) { - buffer.push(': ', ast.returnType); - } else if (ast.parameters) { - buffer.push(': void'); - } else { - buffer.push(': any'); + if (!isConstructor(ast)) { + if (ast.returnType) { + buffer.push(': ', ast.returnType); + } else if (ast.parameters) { + buffer.push(': void'); + } else { + buffer.push(': any'); + } } buffer.push(';\n'); }, @@ -58,6 +65,7 @@ DtsSerializer.prototype = { buffer.indent(); if (ast.newMember) this.member(buffer, ast.newMember); if (ast.callMember) this.member(buffer, ast.callMember); + if (ast.constructorDoc) this.member(buffer, ast.constructorDoc); ast.statics.forEach(function(staticMember) { this.member(buffer, staticMember); @@ -144,7 +152,6 @@ DtsSerializer.prototype = { } }; - function Buffer() { this._globalBuffer = []; this._indentedBuffer = []; @@ -191,7 +198,11 @@ Buffer.prototype = { } }; +function isConstructor(ast) { + return ast.parameters && ast.name === "constructor"; +} module.exports = { DtsSerializer: DtsSerializer }; + diff --git a/docs/typescript-package/processors/readTypeScriptModules.js b/docs/typescript-package/processors/readTypeScriptModules.js index f0cfc87036..7e68beff7c 100644 --- a/docs/typescript-package/processors/readTypeScriptModules.js +++ b/docs/typescript-package/processors/readTypeScriptModules.js @@ -150,6 +150,7 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo, function createExportDoc(name, exportSymbol, moduleDoc, basePath, typeChecker) { var typeParamString = ''; var heritageString = ''; + var typeDefinition = ''; exportSymbol.declarations.forEach(function(decl) { var sourceFile = ts.getSourceFileOfNode(decl); @@ -158,6 +159,10 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo, typeParamString = '<' + getText(sourceFile, decl.typeParameters) + '>'; } + if (decl.symbol.flags & ts.SymbolFlags.TypeAlias) { + typeDefinition = getText(sourceFile, decl.type); + } + if (decl.heritageClauses) { decl.heritageClauses.forEach(function(heritage) { @@ -215,6 +220,9 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo, if(exportSymbol.flags & ts.SymbolFlags.Value) { exportDoc.returnType = getReturnType(typeChecker, exportSymbol); } + if (exportSymbol.flags & ts.SymbolFlags.TypeAlias) { + exportDoc.typeDefinition = typeDefinition; + } return exportDoc; } diff --git a/modules/angular2/angular2.ts b/modules/angular2/angular2.ts index 6cf3a5f6de..2f2a1ebc4c 100644 --- a/modules/angular2/angular2.ts +++ b/modules/angular2/angular2.ts @@ -1,4 +1,4 @@ export * from './core'; export * from './profile'; export * from './lifecycle_hooks'; -export * from './bootstrap'; \ No newline at end of file +export * from './bootstrap'; diff --git a/modules/angular2/core.ts b/modules/angular2/core.ts index 8ce24ae25e..940145c09e 100644 --- a/modules/angular2/core.ts +++ b/modules/angular2/core.ts @@ -18,3 +18,8 @@ export * from './src/core/directives'; export * from './src/core/forms'; export * from './src/core/debug'; export * from './src/core/change_detection'; +export {Reflector, ReflectionInfo} from './src/core/reflection/reflection'; +export { + PlatformReflectionCapabilities +} from './src/core/reflection/platform_reflection_capabilities'; +export {SetterFn, GetterFn, MethodFn} from './src/core/reflection/types'; diff --git a/modules/angular2/http.ts b/modules/angular2/http.ts index 6bb008b357..f88c6d7c18 100644 --- a/modules/angular2/http.ts +++ b/modules/angular2/http.ts @@ -30,6 +30,7 @@ export {BaseRequestOptions, RequestOptions} from './src/http/base_request_option export {BaseResponseOptions, ResponseOptions} from './src/http/base_response_options'; export {XHRBackend, XHRConnection} from './src/http/backends/xhr_backend'; export {JSONPBackend, JSONPConnection} from './src/http/backends/jsonp_backend'; +export {BrowserJsonp} from './src/http/backends/browser_jsonp'; export {Http, Jsonp} from './src/http/http'; export {Headers} from './src/http/headers'; diff --git a/modules/angular2/router.ts b/modules/angular2/router.ts index 7beb32465c..c448616e8a 100644 --- a/modules/angular2/router.ts +++ b/modules/angular2/router.ts @@ -7,12 +7,47 @@ export {Router, RootRouter} from './src/router/router'; export {RouterOutlet} from './src/router/router_outlet'; +export { + DynamicComponentLoader, + ComponentRef, + ElementRef, + Compiler, + AppViewManager, + ViewRef, + HostViewRef, + ProtoViewRef, + ViewContainerRef, + TemplateRef +} from './core'; +export { + Renderer, + RenderElementRef, + RenderViewRef, + RenderProtoViewRef, + RenderEventDispatcher, + RenderFragmentRef, + RenderViewWithFragments +} from './render'; +export { + Binding, + Injector, + ResolvedBinding, + Key, + Dependency, + ProtoInjector, + DependencyProvider, + BindingWithVisibility, + Visibility, + ResolvedFactory +} from './src/core/di'; export {RouterLink} from './src/router/router_link'; export {RouteParams} from './src/router/instruction'; export {RouteRegistry} from './src/router/route_registry'; export {LocationStrategy} from './src/router/location_strategy'; export {HashLocationStrategy} from './src/router/hash_location_strategy'; export {PathLocationStrategy} from './src/router/path_location_strategy'; +export {PathRecognizer, PathMatch} from './src/router/path_recognizer'; +export {RouteHandler} from './src/router/route_handler'; export {Location, APP_BASE_HREF} from './src/router/location'; export {Pipeline} from './src/router/pipeline'; export * from './src/router/route_config_decorator'; @@ -73,6 +108,8 @@ export const ROUTER_BINDINGS: any[] = CONST_EXPR([ })) ]); +export interface InjectableReference {} + function routerFactory(registry, pipeline, location, appRoot) { return new RootRouter(registry, pipeline, location, appRoot); } diff --git a/modules/angular2/src/core/change_detection.ts b/modules/angular2/src/core/change_detection.ts index b131dcfb66..2107bcedcd 100644 --- a/modules/angular2/src/core/change_detection.ts +++ b/modules/angular2/src/core/change_detection.ts @@ -22,6 +22,13 @@ export { IterableDifferFactory, KeyValueDiffers, KeyValueDiffer, - KeyValueDifferFactory - -} from './change_detection/change_detection'; + KeyValueDifferFactory, + Lexer, + Parser, + ChangeDispatcher, + BindingTarget, + DirectiveIndex, + DebugContext, + ProtoChangeDetector +} from 'angular2/src/core/change_detection/change_detection'; +export * from 'angular2/src/core/change_detection/parser/ast'; diff --git a/modules/angular2/src/core/change_detection/change_detection.ts b/modules/angular2/src/core/change_detection/change_detection.ts index 19c69e8bd4..73a1c0139b 100644 --- a/modules/angular2/src/core/change_detection/change_detection.ts +++ b/modules/angular2/src/core/change_detection/change_detection.ts @@ -21,14 +21,7 @@ import { assertionsEnabled } from 'angular2/src/core/facade/lang'; -export { - ASTWithSource, - AST, - AstTransformer, - PropertyRead, - LiteralArray, - ImplicitReceiver -} from './parser/ast'; +export * from './parser/ast'; export {Lexer} from './parser/lexer'; export {Parser} from './parser/parser'; diff --git a/modules/angular2/src/core/compiler.ts b/modules/angular2/src/core/compiler.ts index 11be5c9879..2892b411eb 100644 --- a/modules/angular2/src/core/compiler.ts +++ b/modules/angular2/src/core/compiler.ts @@ -19,4 +19,14 @@ export {ElementRef} from './compiler/element_ref'; export {TemplateRef} from './compiler/template_ref'; export {ViewRef, HostViewRef, ProtoViewRef} from './compiler/view_ref'; export {ViewContainerRef} from './compiler/view_container_ref'; +export {AppView, AppProtoView, AppProtoViewMergeMapping, AppViewContainer} from './compiler/view'; export {ComponentRef} from './compiler/dynamic_component_loader'; +export { + ElementInjector, + PreBuiltObjects, + TreeNode, + ProtoElementInjector, + DirectiveBinding, + EventEmitterAccessor +} from './compiler/element_injector'; +export {ElementBinder} from './compiler/element_binder'; diff --git a/modules/angular2/src/core/pipes.ts b/modules/angular2/src/core/pipes.ts index 2b918fe845..04845d61f3 100644 --- a/modules/angular2/src/core/pipes.ts +++ b/modules/angular2/src/core/pipes.ts @@ -12,3 +12,5 @@ export {LimitToPipe} from './pipes/limit_to_pipe'; export {LowerCasePipe} from './pipes/lowercase_pipe'; export {NumberPipe, DecimalPipe, PercentPipe, CurrencyPipe} from './pipes/number_pipe'; export {UpperCasePipe} from './pipes/uppercase_pipe'; +export {ProtoPipes} from './pipes/pipes'; +export {PipeBinding} from './pipes/pipe_binding'; diff --git a/modules/angular2/src/core/render.ts b/modules/angular2/src/core/render.ts index 1aaa3c872d..79c2ce5a82 100644 --- a/modules/angular2/src/core/render.ts +++ b/modules/angular2/src/core/render.ts @@ -12,5 +12,12 @@ export { ViewDefinition, DOCUMENT, APP_ID, - MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE + MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE, + EventManager, + SharedStylesHost, + DomSharedStylesHost, + TemplateCloner, + ViewType, + RenderProtoViewMergeMapping, + EventManagerPlugin } from './render/render'; diff --git a/modules/angular2/src/core/render/render.ts b/modules/angular2/src/core/render/render.ts index f15db9027c..c41358e15d 100644 --- a/modules/angular2/src/core/render/render.ts +++ b/modules/angular2/src/core/render/render.ts @@ -10,4 +10,7 @@ export * from './dom/compiler/compiler'; export * from './dom/dom_renderer'; export * from './dom/dom_tokens'; export * from './dom/template_cloner'; +export * from './dom/events/event_manager'; +export * from './dom/view/shared_styles_host'; +export * from './dom/template_cloner'; export * from './api'; diff --git a/modules/angular2/test/core/render/dom/compiler/selector_spec.ts b/modules/angular2/test/core/render/dom/compiler/selector_spec.ts index d209303982..5bb1304f46 100644 --- a/modules/angular2/test/core/render/dom/compiler/selector_spec.ts +++ b/modules/angular2/test/core/render/dom/compiler/selector_spec.ts @@ -2,7 +2,6 @@ import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {SelectorMatcher} from 'angular2/src/core/render/dom/compiler/selector'; import {CssSelector} from 'angular2/src/core/render/dom/compiler/selector'; -import {ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; export function main() { describe('SelectorMatcher', () => { diff --git a/modules/angular2/test/core/render/dom/compiler/style_encapsulator_spec.ts b/modules/angular2/test/core/render/dom/compiler/style_encapsulator_spec.ts index aa5c7af39d..9afebb955e 100644 --- a/modules/angular2/test/core/render/dom/compiler/style_encapsulator_spec.ts +++ b/modules/angular2/test/core/render/dom/compiler/style_encapsulator_spec.ts @@ -15,7 +15,6 @@ import { import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {CompilePipeline} from 'angular2/src/core/render/dom/compiler/compile_pipeline'; -import {MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import { ProtoViewBuilder, ElementBinderBuilder diff --git a/modules/angular2/test/core/render/dom/compiler/text_interpolation_parser_spec.ts b/modules/angular2/test/core/render/dom/compiler/text_interpolation_parser_spec.ts index a4fc646db4..87206d861c 100644 --- a/modules/angular2/test/core/render/dom/compiler/text_interpolation_parser_spec.ts +++ b/modules/angular2/test/core/render/dom/compiler/text_interpolation_parser_spec.ts @@ -3,7 +3,6 @@ import { TextInterpolationParser } from 'angular2/src/core/render/dom/compiler/text_interpolation_parser'; import {CompilePipeline} from 'angular2/src/core/render/dom/compiler/compile_pipeline'; -import {MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import {Lexer, Parser, ASTWithSource} from 'angular2/src/core/change_detection/change_detection'; import {IgnoreChildrenStep} from './pipeline_spec'; import { diff --git a/modules/angular2/test/core/render/dom/compiler/view_loader_spec.ts b/modules/angular2/test/core/render/dom/compiler/view_loader_spec.ts index 64122563b8..b063725ceb 100644 --- a/modules/angular2/test/core/render/dom/compiler/view_loader_spec.ts +++ b/modules/angular2/test/core/render/dom/compiler/view_loader_spec.ts @@ -16,7 +16,6 @@ import {StyleUrlResolver} from 'angular2/src/core/render/dom/compiler/style_url_ import {UrlResolver} from 'angular2/src/core/services/url_resolver'; import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async'; -import {MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import {XHR} from 'angular2/src/core/render/xhr'; import {MockXHR} from 'angular2/src/core/render/xhr_mock'; import {ViewDefinition} from 'angular2/src/core/render/api'; diff --git a/modules/angular2/test/core/render/dom/dom_renderer_integration_spec.ts b/modules/angular2/test/core/render/dom/dom_renderer_integration_spec.ts index 1a92ec154b..7580573265 100644 --- a/modules/angular2/test/core/render/dom/dom_renderer_integration_spec.ts +++ b/modules/angular2/test/core/render/dom/dom_renderer_integration_spec.ts @@ -13,7 +13,6 @@ import { SpyObject, } from 'angular2/test_lib'; -import {MapWrapper} from 'angular2/src/core/facade/collection'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {DomTestbed, TestRootView, elRef} from './dom_testbed'; diff --git a/modules/angular2/test/router/route_recognizer_spec.ts b/modules/angular2/test/router/route_recognizer_spec.ts index df4bf15b6e..bdbe5329a0 100644 --- a/modules/angular2/test/router/route_recognizer_spec.ts +++ b/modules/angular2/test/router/route_recognizer_spec.ts @@ -10,8 +10,6 @@ import { SpyObject } from 'angular2/test_lib'; -import {Map, StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection'; - import {RouteRecognizer} from 'angular2/src/router/route_recognizer'; import {ComponentInstruction} from 'angular2/src/router/instruction'; diff --git a/modules/angular2/test_lib.ts b/modules/angular2/test_lib.ts index 081e0fe211..1d705e3d74 100644 --- a/modules/angular2/test_lib.ts +++ b/modules/angular2/test_lib.ts @@ -2,3 +2,9 @@ export * from './test'; export * from './src/test_lib/utils'; export * from './src/test_lib/fake_async'; +export {ComponentRef, HostViewRef} from './src/core/compiler'; + +// This interface is referenced by TestComponents, however we can't export it directly from router +// because router pulls in dart:html & dart:js and we import test_lib in standalone VM tests +// so we re-create the interface here. +export interface InjectableReference {} diff --git a/modules/angular2/web_worker/ui.ts b/modules/angular2/web_worker/ui.ts index 3cb30cd1bd..83ca7d34bd 100644 --- a/modules/angular2/web_worker/ui.ts +++ b/modules/angular2/web_worker/ui.ts @@ -1,4 +1,15 @@ export * from "../src/web_workers/ui/application"; +export * from '../src/core/zone'; export * from "../src/web_workers/shared/client_message_broker"; export * from "../src/web_workers/shared/service_message_broker"; export * from "../src/web_workers/shared/serializer"; +export * from '../src/web_workers/shared/render_proto_view_ref_store'; +export * from '../src/web_workers/shared/render_view_with_fragments_store'; +export * from '../src/core/render/api'; +export * from '../src/core/change_detection'; +export * from '../src/core/di'; +export {Reflector, ReflectionInfo} from '../src/core/reflection/reflection'; +export { + PlatformReflectionCapabilities +} from '../src/core/reflection/platform_reflection_capabilities'; +export {SetterFn, GetterFn, MethodFn} from '../src/core/reflection/types'; diff --git a/modules/angular2/web_worker/worker.ts b/modules/angular2/web_worker/worker.ts index 4296e93cd9..a40255abbb 100644 --- a/modules/angular2/web_worker/worker.ts +++ b/modules/angular2/web_worker/worker.ts @@ -14,14 +14,22 @@ export * from '../src/core/zone'; // Do not export render in web_worker // export * from '../src/core/render'; // Add special import for just render API +export * from '../src/core/application_ref'; +export * from '../src/core/application_tokens'; export * from '../src/core/render/api'; export * from '../src/core/directives'; export * from '../src/core/forms'; export * from '../src/core/debug'; export * from '../src/core/change_detection'; - export * from '../profile'; export * from '../src/web_workers/worker/application'; export * from '../src/web_workers/shared/client_message_broker'; export * from '../src/web_workers/shared/service_message_broker'; export * from '../src/web_workers/shared/serializer'; +export * from '../src/web_workers/shared/render_proto_view_ref_store'; +export * from '../src/web_workers/shared/render_view_with_fragments_store'; +export {Reflector, ReflectionInfo} from '../src/core/reflection/reflection'; +export { + PlatformReflectionCapabilities +} from '../src/core/reflection/platform_reflection_capabilities'; +export {SetterFn, GetterFn, MethodFn} from '../src/core/reflection/types'; diff --git a/modules/examples/src/web_workers/message_broker/index.ts b/modules/examples/src/web_workers/message_broker/index.ts index e4bb79f8e0..836729ba7c 100644 --- a/modules/examples/src/web_workers/message_broker/index.ts +++ b/modules/examples/src/web_workers/message_broker/index.ts @@ -8,14 +8,8 @@ var broker = instance.app.createClientMessageBroker(ECHO_CHANNEL, false); document.getElementById("send_echo") .addEventListener("click", (e) => { var val = (document.getElementById("echo_input")).value; - // TODO(jteplitz602): Replace default constructors with real constructors - // once they're in the .d.ts file (#3926) - var args = new UiArguments(); - args.method = "echo"; - var fnArg = new FnArg(); - fnArg.value = val; - fnArg.type = PRIMITIVE; - args.args = [fnArg]; + var fnArg = new FnArg(val, PRIMITIVE); + var args = new UiArguments("echo", [fnArg]); broker.runOnService(args, PRIMITIVE) .then((echo_result: string) => { diff --git a/modules_dart/transform/lib/src/transform/common/directive_metadata_reader.dart b/modules_dart/transform/lib/src/transform/common/directive_metadata_reader.dart index bfa5233183..f9fa4f5578 100644 --- a/modules_dart/transform/lib/src/transform/common/directive_metadata_reader.dart +++ b/modules_dart/transform/lib/src/transform/common/directive_metadata_reader.dart @@ -3,7 +3,8 @@ library angular2.transform.common.directive_metadata_reader; import 'package:analyzer/analyzer.dart'; import 'package:analyzer/src/generated/element.dart'; import 'package:angular2/src/core/render/api.dart'; -import 'package:angular2/src/core/change_detection/change_detection.dart'; +import 'package:angular2/src/core/change_detection/change_detection.dart' + show ChangeDetectionStrategy; /// Reads [RenderDirectiveMetadata] from the `node`. `node` is expected to be an /// instance of [ClassDeclaration] (a class which may have a [Directive] or