Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: audit @angular/core API classification #8808

Merged
merged 1 commit into from May 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/@angular/compiler/core_private.ts
Expand Up @@ -58,7 +58,8 @@ export var pureProxy10: typeof t.pureProxy10 = r.pureProxy10;
export var castByValue: typeof t.castByValue = r.castByValue;
export type Console = t.Console;
export var Console: typeof t.Console = r.Console;

export var reflector: t.Reflector = r.reflector;
export type Reflector = t.Reflector;
export type NoOpAnimationPlayer = t.NoOpAnimationPlayer;
export var NoOpAnimationPlayer: typeof t.NoOpAnimationPlayer = r.NoOpAnimationPlayer;
export type AnimationPlayer = t.AnimationPlayer;
Expand Down
3 changes: 2 additions & 1 deletion modules/@angular/compiler/src/compile_metadata.ts
@@ -1,4 +1,5 @@
import {ChangeDetectionStrategy, ViewEncapsulation, reflector} from '@angular/core';
import {ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';
import {reflector} from '../core_private';
import {
CHANGE_DETECTION_STRATEGY_VALUES,
VIEW_ENCAPSULATION_VALUES,
Expand Down
Expand Up @@ -7,9 +7,8 @@ import {
AfterContentChecked,
AfterViewInit,
AfterViewChecked,
reflector
} from '@angular/core';
import {LifecycleHooks} from '../core_private';
import {reflector, LifecycleHooks} from '../core_private';

import {Type} from '../src/facade/lang';
import {MapWrapper} from '../src/facade/collection';
Expand Down
3 changes: 1 addition & 2 deletions modules/@angular/compiler/src/directive_resolver.ts
Expand Up @@ -11,9 +11,8 @@ import {
ViewChildrenMetadata,
ContentChildMetadata,
ViewChildMetadata,
reflector
} from '@angular/core';
import {ReflectorReader} from '../core_private';
import {ReflectorReader, reflector} from '../core_private';

import {Type, isPresent, stringify} from '../src/facade/lang';
import {BaseException} from '../src/facade/exceptions';
Expand Down
5 changes: 1 addition & 4 deletions modules/@angular/compiler/src/metadata_resolver.ts
@@ -1,6 +1,5 @@
import {
AttributeMetadata,
ReflectiveDependency,
OptionalMetadata,
ComponentMetadata,
SelfMetadata,
Expand All @@ -9,18 +8,16 @@ import {
Provider,
PLATFORM_DIRECTIVES,
PLATFORM_PIPES,
reflector,
Injectable,
Inject,
Optional,
ViewMetadata,
NoAnnotationError,
QueryMetadata,
resolveForwardRef,
InjectMetadata,
ViewQueryMetadata
} from '@angular/core';
import {constructDependencies, LIFECYCLE_HOOKS_VALUES, ReflectorReader} from '../core_private';
import {LIFECYCLE_HOOKS_VALUES, ReflectorReader, reflector} from '../core_private';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge with other imports

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

import {
Type,
isBlank,
Expand Down
2 changes: 1 addition & 1 deletion modules/@angular/compiler/src/output/output_interpreter.ts
@@ -1,4 +1,4 @@
import {reflector} from '@angular/core';
import {reflector} from '../../core_private';
import {isPresent, IS_DART, FunctionWrapper} from '../../src/facade/lang';
import {ObservableWrapper} from '../../src/facade/async';
import {BaseException, unimplemented} from '../../src/facade/exceptions';
Expand Down
4 changes: 2 additions & 2 deletions modules/@angular/compiler/src/pipe_resolver.ts
@@ -1,6 +1,6 @@
import {resolveForwardRef, Injectable, PipeMetadata, reflector} from '@angular/core';
import {resolveForwardRef, Injectable, PipeMetadata} from '@angular/core';

import {ReflectorReader} from '../core_private';
import {ReflectorReader, reflector} from '../core_private';

import {Type, isPresent, stringify} from '../src/facade/lang';
import {BaseException} from '../src/facade/exceptions';
Expand Down
3 changes: 1 addition & 2 deletions modules/@angular/compiler/src/view_resolver.ts
Expand Up @@ -2,10 +2,9 @@ import {
Injectable,
ViewMetadata,
ComponentMetadata,
reflector,
} from '@angular/core';

import {ReflectorReader} from '../core_private';
import {ReflectorReader, reflector} from '../core_private';

import {Type, stringify, isBlank, isPresent} from '../src/facade/lang';
import {BaseException} from '../src/facade/exceptions';
Expand Down
2 changes: 2 additions & 0 deletions modules/@angular/compiler_cli/src/core_private.ts
Expand Up @@ -5,3 +5,5 @@ export var ReflectorReader: typeof t.ReflectorReader = r.ReflectorReader;

export type ReflectionCapabilities = t.ReflectionCapabilities;
export var ReflectionCapabilities: typeof t.ReflectionCapabilities = r.ReflectionCapabilities;

export var reflector: typeof t.reflector = r.reflector;
@@ -1,5 +1,4 @@
import {reflector} from '@angular/core';
import {ReflectionCapabilities} from './core_private';
import {ReflectionCapabilities, reflector} from './core_private';
import {StaticReflector} from './static_reflector';

export class StaticAndDynamicReflectionCapabilities {
Expand Down Expand Up @@ -39,4 +38,4 @@ export class StaticAndDynamicReflectionCapabilities {

function isStaticType(type: any): boolean {
return typeof type === 'object' && type.name && type.filePath;
}
}
1 change: 0 additions & 1 deletion modules/@angular/core/index.ts
Expand Up @@ -32,7 +32,6 @@ export * from './src/change_detection';
export * from './src/platform_directives_and_pipes';
export * from './src/platform_common_providers';
export * from './src/application_common_providers';
export * from './src/reflection/reflection';
export {
wtfCreateScope,
wtfLeave,
Expand Down
7 changes: 7 additions & 0 deletions modules/@angular/core/private_export.ts
Expand Up @@ -20,6 +20,8 @@ import * as debug from './src/debug/debug_renderer';
import * as provider_util from './src/di/provider_util';
import * as console from './src/console';
import {Provider} from './index';
import * as reflection from './src/reflection/reflection';
import {Reflector} from './src/reflection/reflection';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out that I can't do that. Get some weird error which I don't understand.

modules/@angular/core/private_export.ts(138,12): error TS4023: Exported variable '__core_private__' has or is using name 'Reflector' from external module "/Users/misko/work/angular/modules/@angular/core/src/reflection/reflector" but cannot be named.
modules/@angular/platform-browser/src/browser.ts(16,3): error TS2305: Module '"/Users/misko/work/angular/modules/@angular/core/index"' has no exported member 'reflector'.


import {
NoOpAnimationPlayer as NoOpAnimationPlayer_,
Expand Down Expand Up @@ -103,6 +105,9 @@ export declare namespace __core_private_types__ {
export var castByValue: typeof view_utils.castByValue;
export type Console = console.Console;
export var Console: typeof console.Console;
export var reflector: typeof reflection.reflector;
export type Reflector = reflection.Reflector;
export var Reflector: typeof reflection.Reflector;
export type NoOpAnimationPlayer = NoOpAnimationPlayer_;
export var NoOpAnimationPlayer: typeof NoOpAnimationPlayer_;
export type AnimationPlayer = AnimationPlayer_;
Expand Down Expand Up @@ -178,6 +183,8 @@ export var __core_private__ = {
pureProxy10: view_utils.pureProxy10,
castByValue: view_utils.castByValue,
Console: console.Console,
reflector: reflection.reflector,
Reflector: reflection.Reflector,
NoOpAnimationPlayer: NoOpAnimationPlayer_,
AnimationPlayer: AnimationPlayer_,
NoOpAnimationDriver: NoOpAnimationDriver_,
Expand Down
1 change: 1 addition & 0 deletions modules/@angular/core/src/application_common_providers.ts
Expand Up @@ -16,6 +16,7 @@ let __unused: Type; // avoid unused import when Type union types are erased
/**
* A default set of providers which should be included in any Angular
* application, regardless of the platform it runs onto.
* @stable
*/
export const APPLICATION_COMMON_PROVIDERS: Array<Type | {[k: string]: any} | any[]> =
/*@ts2dart_const*/[
Expand Down
9 changes: 9 additions & 0 deletions modules/@angular/core/src/application_ref.ts
Expand Up @@ -14,6 +14,7 @@ import {ChangeDetectorRef} from './change_detection/change_detector_ref';

/**
* Create an Angular zone.
* @experimental
*/
export function createNgZone(): NgZone {
return new NgZone({enableLongStackTrace: assertionsEnabled()});
Expand All @@ -25,6 +26,7 @@ var _inPlatformCreate: boolean = false;
/**
* Creates a platform.
* Platforms have to be eagerly created via this function.
* @experimental
*/
export function createPlatform(injector: Injector): PlatformRef {
if (_inPlatformCreate) {
Expand All @@ -47,6 +49,7 @@ export function createPlatform(injector: Injector): PlatformRef {
/**
* Checks that there currently is a platform
* which contains the given token as a provider.
* @experimental
*/
export function assertPlatform(requiredToken: any): PlatformRef {
var platform = getPlatform();
Expand All @@ -62,6 +65,7 @@ export function assertPlatform(requiredToken: any): PlatformRef {

/**
* Dispose the existing platform.
* @experimental
*/
export function disposePlatform(): void {
if (isPresent(_platform) && !_platform.disposed) {
Expand All @@ -71,6 +75,7 @@ export function disposePlatform(): void {

/**
* Returns the current platform.
* @experimental
*/
export function getPlatform(): PlatformRef {
return isPresent(_platform) && !_platform.disposed ? _platform : null;
Expand All @@ -79,6 +84,7 @@ export function getPlatform(): PlatformRef {
/**
* Shortcut for ApplicationRef.bootstrap.
* Requires a platform to be created first.
* @experimental
*/
export function coreBootstrap<C>(componentFactory: ComponentFactory<C>,
injector: Injector): ComponentRef<C> {
Expand All @@ -90,6 +96,7 @@ export function coreBootstrap<C>(componentFactory: ComponentFactory<C>,
* Resolves the componentFactory for the given component,
* waits for asynchronous initializers and bootstraps the component.
* Requires a platform to be created first.
* @experimental
*/
export function coreLoadAndBootstrap(componentType: Type,
injector: Injector): Promise<ComponentRef<any>> {
Expand All @@ -109,6 +116,7 @@ export function coreLoadAndBootstrap(componentType: Type,
*
* A page's platform is initialized implicitly when {@link bootstrap}() is called, or
* explicitly by calling {@link createPlatform}().
* @stable
*/
export abstract class PlatformRef {
/**
Expand Down Expand Up @@ -170,6 +178,7 @@ export class PlatformRef_ extends PlatformRef {
* A reference to an Angular application running on a page.
*
* For more about Angular applications, see the documentation for {@link bootstrap}.
* @stable
*/
export abstract class ApplicationRef {
/**
Expand Down
5 changes: 5 additions & 0 deletions modules/@angular/core/src/application_tokens.ts
Expand Up @@ -9,6 +9,7 @@ import {Math, StringWrapper} from '../src/facade/lang';
* If you need to avoid randomly generated value to be used as an application id, you can provide
* a custom value via a DI provider <!-- TODO: provider --> configuring the root {@link Injector}
* using this token.
* @experimental
*/
export const APP_ID: any = /*@ts2dart_const*/ new OpaqueToken('AppId');

Expand All @@ -18,6 +19,7 @@ function _appIdRandomProviderFactory() {

/**
* Providers that will generate a random APP_ID_TOKEN.
* @experimental
*/
export const APP_ID_RANDOM_PROVIDER =
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
Expand All @@ -32,18 +34,21 @@ function _randomChar(): string {

/**
* A function that will be executed when a platform is initialized.
* @experimental
*/
export const PLATFORM_INITIALIZER: any =
/*@ts2dart_const*/ new OpaqueToken("Platform Initializer");

/**
* A function that will be executed when an application is initialized.
* @experimental
*/
export const APP_INITIALIZER: any =
/*@ts2dart_const*/ new OpaqueToken("Application Initializer");

/**
* A token which indicates the root directory of the application
* @experimental
*/
export const PACKAGE_ROOT_URL: any =
/*@ts2dart_const*/ new OpaqueToken("Application Packages Root URL");
Expand Up @@ -34,6 +34,7 @@ export function devModeEqual(a: any, b: any): boolean {
* return WrappedValue.wrap(this._latestValue); // this will force update
* }
* ```
* @stable
*/
export class WrappedValue {
constructor(public wrapped: any) {}
Expand All @@ -60,6 +61,7 @@ export class ValueUnwrapper {

/**
* Represents a basic change from a previous to a new value.
* @stable
*/
export class SimpleChange {
constructor(public previousValue: any, public currentValue: any) {}
Expand Down
@@ -1,3 +1,6 @@
/**
* @stable
*/
export abstract class ChangeDetectorRef {
/**
* Marks all {@link ChangeDetectionStrategy#OnPush} ancestors as to be checked.
Expand Down
1 change: 1 addition & 0 deletions modules/@angular/core/src/change_detection/constants.ts
Expand Up @@ -28,6 +28,7 @@ export enum ChangeDetectorState {
/**
* Describes within the change detector which strategy will be used the next time change
* detection is triggered.
* @stable
*/
export enum ChangeDetectionStrategy {
/**
Expand Down
Expand Up @@ -24,6 +24,9 @@ export class DefaultIterableDifferFactory implements IterableDifferFactory {

var trackByIdentity = (index: number, item: any) => item;

/**
* @stable
*/
export class DefaultIterableDiffer implements IterableDiffer {
private _length: number = null;
private _collection = null;
Expand Down Expand Up @@ -532,6 +535,9 @@ export class DefaultIterableDiffer implements IterableDiffer {
}
}

/**
* @stable
*/
export class CollectionChangeRecord {
currentIndex: number = null;
previousIndex: number = null;
Expand Down
Expand Up @@ -335,6 +335,9 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
}


/**
* @stable
*/
export class KeyValueChangeRecord {
previousValue: any = null;
currentValue: any = null;
Expand Down
Expand Up @@ -7,6 +7,8 @@ import {Provider, SkipSelfMetadata, OptionalMetadata} from '../../di';
/**
* A strategy for tracking changes over time to an iterable. Used for {@link NgFor} to
* respond to changes in an iterable by effecting equivalent changes in the DOM.
*
* @stable
*/
export interface IterableDiffer {
diff(object: any): any;
Expand All @@ -31,6 +33,7 @@ export interface IterableDifferFactory {
/**
* A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
* @ts2dart_const
* @stable
*/
export class IterableDiffers {
/*@ts2dart_const*/
Expand Down
Expand Up @@ -23,6 +23,7 @@ export interface KeyValueDifferFactory {
/**
* A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
* @ts2dart_const
* @stable
*/
export class KeyValueDiffers {
/*@ts2dart_const*/
Expand Down
12 changes: 12 additions & 0 deletions modules/@angular/core/src/debug/debug_node.ts
Expand Up @@ -5,6 +5,9 @@ import {RenderDebugInfo} from '../render/api';

export class EventListener { constructor(public name: string, public callback: Function){}; }

/**
* @experimental
*/
export class DebugNode {
nativeNode: any;
listeners: EventListener[];
Expand Down Expand Up @@ -46,6 +49,9 @@ export class DebugNode {
inject(token: any): any { return this.injector.get(token); }
}

/**
* @experimental
*/
export class DebugElement extends DebugNode {
name: string;
properties: {[key: string]: string};
Expand Down Expand Up @@ -129,6 +135,9 @@ export class DebugElement extends DebugNode {
}
}

/**
* @experimental
*/
export function asNativeElements(debugEls: DebugElement[]): any {
return debugEls.map((el) => el.nativeElement);
}
Expand Down Expand Up @@ -162,6 +171,9 @@ function _queryNodeChildren(parentNode: DebugNode, predicate: Predicate<DebugNod
// Need to keep the nodes in a global Map so that multiple angular apps are supported.
var _nativeNodeToDebugNode = new Map<any, DebugNode>();

/**
* @experimental
*/
export function getDebugNode(nativeNode: any): DebugNode {
return _nativeNodeToDebugNode.get(nativeNode);
}
Expand Down