X Tutup
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions docs/typescript-definition-package/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
*/
}
},
{
Expand Down
27 changes: 19 additions & 8 deletions docs/typescript-definition-package/processors/code_gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ function DtsSerializer(remap) {
}

DtsSerializer.prototype = {
_initializerRegex: /\s*=[^>][^,}]*/g,

constructor: DtsSerializer,

Expand All @@ -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');
},
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -144,7 +152,6 @@ DtsSerializer.prototype = {
}
};


function Buffer() {
this._globalBuffer = [];
this._indentedBuffer = [];
Expand Down Expand Up @@ -191,7 +198,11 @@ Buffer.prototype = {
}
};

function isConstructor(ast) {
return ast.parameters && ast.name === "constructor";
}

module.exports = {
DtsSerializer: DtsSerializer
};

8 changes: 8 additions & 0 deletions docs/typescript-package/processors/readTypeScriptModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/angular2.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './core';
export * from './profile';
export * from './lifecycle_hooks';
export * from './bootstrap';
export * from './bootstrap';
5 changes: 5 additions & 0 deletions modules/angular2/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
1 change: 1 addition & 0 deletions modules/angular2/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
37 changes: 37 additions & 0 deletions modules/angular2/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
}
13 changes: 10 additions & 3 deletions modules/angular2/src/core/change_detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
10 changes: 10 additions & 0 deletions modules/angular2/src/core/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
2 changes: 2 additions & 0 deletions modules/angular2/src/core/pipes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
9 changes: 8 additions & 1 deletion modules/angular2/src/core/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
3 changes: 3 additions & 0 deletions modules/angular2/src/core/render/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 0 additions & 2 deletions modules/angular2/test/router/route_recognizer_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
6 changes: 6 additions & 0 deletions modules/angular2/test_lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
11 changes: 11 additions & 0 deletions modules/angular2/web_worker/ui.ts
Original file line number Diff line number Diff line change
@@ -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';
10 changes: 9 additions & 1 deletion modules/angular2/web_worker/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
10 changes: 2 additions & 8 deletions modules/examples/src/web_workers/message_broker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@ var broker = instance.app.createClientMessageBroker(ECHO_CHANNEL, false);
document.getElementById("send_echo")
.addEventListener("click", (e) => {
var val = (<HTMLInputElement>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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
X Tutup