Skip to content

Commit f14b212

Browse files
committed
refactor: export core APIs from angular2/core
This change moves many APIs to the angular2/core export. This change also automatically adds FORM_BINDINGS in the application root injector. BREAKING CHANGE: Many dependencies that were previously exported from specific APIs are now exported from angular2/core. Affected exports, which should now be included from angular2/core include: angular2/forms angular2/di angular2/directives angular2/change_detection angular2/bootstrap (except for dart users) angular2/render angular2/metadata angular2/debug angular2/pipes Closes angular#3977
1 parent 6d13cf9 commit f14b212

File tree

286 files changed

+738
-689
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

286 files changed

+738
-689
lines changed

docs/public-docs-package/index.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,10 @@ module.exports = new Package('angular-v2-public-docs', [basePackage])
66
.config(function(readTypeScriptModules) {
77
readTypeScriptModules.sourceFiles = [
88
'angular2/lifecycle_hooks.ts',
9-
'angular2/metadata.ts',
10-
'angular2/change_detection.ts',
119
'angular2/core.ts',
12-
'angular2/di.ts',
13-
'angular2/directives.ts',
1410
'angular2/http.ts',
15-
'angular2/forms.ts',
1611
'angular2/router.ts',
17-
'angular2/test.ts',
18-
'angular2/pipes.ts'
12+
'angular2/test.ts'
1913
];
2014
readTypeScriptModules.hidePrivateMembers = true;
2115
})

docs/typescript-definition-package/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage,
5252
id: 'angular2/angular2',
5353
references: ['../es6-promise/es6-promise.d.ts', '../rx/rx.d.ts'],
5454
modules: {
55-
'angular2/angular2': {namespace: 'ng', id: 'angular2/angular2'},
55+
'angular2/angular2': {namespace: 'ng', id: 'angular2/angular2'}
56+
/* TODO(jeffbcross): re-implement with @jteplitz as part of #3926,
5657
'angular2/web_worker/worker': {namespace: 'ngWorker', id: 'angular2/web_worker/worker'},
5758
'angular2/web_worker/ui': {namespace: 'ngUi', id: 'angular2/web_worker/ui'}
59+
*/
5860
}
5961
},
6062
{
@@ -79,7 +81,7 @@ module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage,
7981
Injector: 'ng.Injector',
8082
Predicate: 'ng.Predicate',
8183
ElementRef: 'ng.ElementRef',
82-
84+
DebugElement: 'ng.DebugElement'
8385
},
8486
modules: {'angular2/test_lib': {namespace: 'ngTestLib', id: 'angular2/test_lib'}}
8587
}

modules/angular2/angular2.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ library angular2;
55
*
66
* This library does not include `bootstrap`. Import `bootstrap.dart` instead.
77
*/
8-
export 'package:angular2/angular2_exports.dart';
8+
export 'package:angular2/core.dart';

modules/angular2/angular2.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
1-
/**
2-
* The `angular2` is the single place to import all of the individual types.
3-
*/
4-
5-
// TODO(someone familiar with systemjs): the exports below are copied from
6-
// angular2_exports.ts. Re-exporting from angular2_exports.ts causes systemjs
7-
// to resolve imports very very very slowly. See also a similar notice in
8-
// bootstrap.ts
9-
export * from './metadata';
10-
export * from './change_detection';
111
export * from './core';
12-
export * from './di';
13-
export * from './directives';
14-
export * from './forms';
15-
export * from './render';
162
export * from './profile';
17-
export {bootstrap} from 'angular2/src/core/application';
183
export * from './lifecycle_hooks';
4+
export * from './bootstrap';

modules/angular2/bootstrap.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
/**
2-
* Contains everything you need to bootstrap your application.
2+
* This file is only used for dart applications and for internal examples
3+
* that compile with both JavaScript and Dart.
34
*/
4-
export {bootstrap} from 'angular2/src/core/application';
5-
6-
// TODO(someone familiar with systemjs): the exports below are copied from
7-
// angular2_exports.ts. Re-exporting from angular2_exports.ts causes systemjs
8-
// to resolve imports very very very slowly. See also a similar notice in
9-
// angular2.ts
10-
export * from './metadata';
11-
export * from './change_detection';
12-
export * from './core';
13-
export * from './di';
14-
export * from './directives';
15-
export * from './forms';
16-
export * from './render';
5+
export {bootstrap} from 'angular2/src/core/bootstrap';
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
library angular2.bootstrap_static;
22

3-
export 'angular2_exports.dart';
43
export 'src/core/application_static.dart';

modules/angular2/core.dart

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,21 @@
11
library angular2.core;
22

3-
export 'package:angular2/src/core/application_tokens.dart' show APP_COMPONENT;
4-
export 'package:angular2/src/core/application_ref.dart' show ApplicationRef;
5-
6-
// Compiler Related Dependencies.
7-
export 'package:angular2/src/core/services/app_root_url.dart' show AppRootUrl;
8-
export 'package:angular2/src/core/services/url_resolver.dart' show UrlResolver;
9-
export 'package:angular2/src/core/compiler/component_url_mapper.dart'
10-
show ComponentUrlMapper;
11-
export 'package:angular2/src/core/compiler/directive_resolver.dart'
12-
show DirectiveResolver;
13-
export 'package:angular2/src/core/compiler/compiler.dart' show Compiler;
14-
15-
export 'package:angular2/src/core/compiler/view_manager.dart' show AppViewManager;
16-
export 'package:angular2/src/core/compiler/query_list.dart' show QueryList;
17-
export 'package:angular2/src/core/compiler/dynamic_component_loader.dart'
18-
show DynamicComponentLoader;
19-
export 'package:angular2/src/core/life_cycle/life_cycle.dart' show LifeCycle;
20-
21-
export 'package:angular2/src/core/compiler/element_ref.dart' show ElementRef;
22-
export 'package:angular2/src/core/compiler/template_ref.dart' show TemplateRef;
23-
export 'package:angular2/src/core/compiler/view_ref.dart'
24-
show ViewRef, HostViewRef, ProtoViewRef;
25-
export 'package:angular2/src/core/compiler/view_container_ref.dart'
26-
show ViewContainerRef;
27-
export 'package:angular2/src/core/compiler/dynamic_component_loader.dart'
28-
show ComponentRef;
29-
30-
export 'package:angular2/src/core/zone/ng_zone.dart' show NgZone;
31-
export 'package:angular2/src/core/facade/async.dart' show Stream, EventEmitter;
3+
// Public Core API
4+
export 'package:angular2/src/core/util.dart';
5+
export 'package:angular2/src/core/di.dart';
6+
export 'package:angular2/src/core/pipes.dart';
7+
export 'package:angular2/src/core/facade.dart';
8+
// Do not export application for dart. Must import from angular2/bootstrap
9+
//export 'package:angular2/src/core/application.dart';
10+
export 'package:angular2/src/core/services.dart';
11+
export 'package:angular2/src/core/compiler.dart';
12+
export 'package:angular2/src/core/lifecycle.dart';
13+
export 'package:angular2/src/core/zone.dart';
14+
//Do not export render for dart. Must import from angular2/render
15+
//export 'package:angular2/src/core/render.dart';
16+
export 'package:angular2/src/core/directives.dart';
17+
export 'package:angular2/src/core/forms.dart';
18+
//Do not export debug for dart.
19+
//export 'package:angular2/src/core/debug.dart';
20+
export 'package:angular2/src/core/metadata.dart';
21+
export 'package:angular2/src/core/change_detection.dart';

modules/angular2/core.ts

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,20 @@
11
/**
22
* @module
33
* @description
4-
* Define angular core API here.
4+
* Starting point to import all public core APIs.
55
*/
6-
export {APP_COMPONENT} from 'angular2/src/core/application_tokens';
7-
export {Type} from 'angular2/src/core/facade/lang';
8-
export {ApplicationRef} from 'angular2/src/core/application_ref';
9-
10-
11-
// Compiler Related Dependencies.
12-
export {AppRootUrl} from 'angular2/src/core/services/app_root_url';
13-
export {UrlResolver} from 'angular2/src/core/services/url_resolver';
14-
export {ComponentUrlMapper} from 'angular2/src/core/compiler/component_url_mapper';
15-
export {DirectiveResolver} from 'angular2/src/core/compiler/directive_resolver';
16-
export {Compiler} from 'angular2/src/core/compiler/compiler';
17-
18-
export {AppViewManager} from 'angular2/src/core/compiler/view_manager';
19-
export {QueryList} from 'angular2/src/core/compiler/query_list';
20-
export {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_component_loader';
21-
export {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
22-
23-
export {ElementRef} from 'angular2/src/core/compiler/element_ref';
24-
export {TemplateRef} from 'angular2/src/core/compiler/template_ref';
25-
export {ViewRef, HostViewRef, ProtoViewRef} from 'angular2/src/core/compiler/view_ref';
26-
export {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
27-
export {ComponentRef} from 'angular2/src/core/compiler/dynamic_component_loader';
28-
29-
export {NgZone} from 'angular2/src/core/zone/ng_zone';
30-
export {Observable, EventEmitter} from 'angular2/src/core/facade/async';
31-
export {Predicate} from 'angular2/src/core/facade/collection';
6+
export * from './src/core/metadata';
7+
export * from './src/core/util';
8+
export * from './src/core/di';
9+
export * from './src/core/pipes';
10+
export * from './src/core/facade';
11+
export * from './src/core/application';
12+
export * from './src/core/services';
13+
export * from './src/core/compiler';
14+
export * from './src/core/lifecycle';
15+
export * from './src/core/zone';
16+
export * from './src/core/render';
17+
export * from './src/core/directives';
18+
export * from './src/core/forms';
19+
export * from './src/core/debug';
20+
export * from './src/core/change_detection';

modules/angular2/http.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* The http module provides services to perform http requests. To get started, see the {@link Http}
55
* class.
66
*/
7-
import {bind, Binding} from 'angular2/di';
7+
import {bind, Binding} from 'angular2/core';
88
import {Http, Jsonp} from './src/http/http';
99
import {XHRBackend, XHRConnection} from './src/http/backends/xhr_backend';
1010
import {JSONPBackend, JSONPConnection} from './src/http/backends/jsonp_backend';

modules/angular2/render.ts

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
11
/**
2-
* @module
3-
* @description
4-
* This module provides advanced support for extending dom strategy.
2+
* This file is only used for dart applications and for internal examples
3+
* that compile with both JavaScript and Dart.
4+
*
5+
* JavaScript users should import from angular2/core.
56
*/
6-
7-
export {
8-
RenderDirectiveMetadata,
9-
DomRenderer,
10-
RenderEventDispatcher,
11-
Renderer,
12-
RenderElementRef,
13-
RenderViewRef,
14-
RenderProtoViewRef,
15-
RenderFragmentRef,
16-
RenderViewWithFragments,
17-
ViewDefinition,
18-
DOCUMENT,
19-
APP_ID,
20-
MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE
21-
} from './src/core/render/render';
7+
export * from './src/core/render';

0 commit comments

Comments
 (0)