fix(packages): use ES modules for primary build (#11120)

This commit is contained in:
Miško Hevery
2016-08-30 18:07:40 -07:00
committed by Victor Berchet
parent 8cb1046ce9
commit 979657989b
249 changed files with 1929 additions and 1463 deletions
+5 -12
View File
@@ -76,21 +76,14 @@ export function createPlatform(injector: Injector): PlatformRef {
return _platform;
}
/**
* Factory for a platform.
*
* @experimental
*/
export type PlatformFactory = (extraProviders?: Provider[]) => PlatformRef;
/**
* Creates a factory for a platform
*
* @experimental APIs related to application bootstrap are currently under review.
*/
export function createPlatformFactory(
parentPlaformFactory: PlatformFactory, name: string,
providers: Provider[] = []): PlatformFactory {
parentPlaformFactory: (extraProviders?: Provider[]) => PlatformRef, name: string,
providers: Provider[] = []): (extraProviders?: Provider[]) => PlatformRef {
const marker = new OpaqueToken(`Platform: ${name}`);
return (extraProviders: Provider[] = []) => {
if (!getPlatform()) {
@@ -221,7 +214,7 @@ export abstract class PlatformRef {
get destroyed(): boolean { throw unimplemented(); }
}
function _callAndReportToExceptionHandler(errorHandler: ErrorHandler, callback: () => any): any {
function _callAndReportToErrorHandler(errorHandler: ErrorHandler, callback: () => any): any {
try {
const result = callback();
if (isPromise(result)) {
@@ -283,11 +276,11 @@ export class PlatformRef_ extends PlatformRef {
const moduleRef = <NgModuleInjector<M>>moduleFactory.create(ngZoneInjector);
const exceptionHandler: ErrorHandler = moduleRef.injector.get(ErrorHandler, null);
if (!exceptionHandler) {
throw new Error('No ExceptionHandler. Is platform module (BrowserModule) included?');
throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?');
}
moduleRef.onDestroy(() => ListWrapper.remove(this._modules, moduleRef));
ngZone.onError.subscribe({next: (error: any) => { exceptionHandler.handleError(error); }});
return _callAndReportToExceptionHandler(exceptionHandler, () => {
return _callAndReportToErrorHandler(exceptionHandler, () => {
const initStatus: ApplicationInitStatus = moduleRef.injector.get(ApplicationInitStatus);
return initStatus.donePromise.then(() => {
this._moduleDoBootstrap(moduleRef);
+37
View File
@@ -0,0 +1,37 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point from which you should import all public core APIs.
*/
export * from './metadata';
export * from './util';
export * from './di';
export {createPlatform, assertPlatform, destroyPlatform, getPlatform, PlatformRef, ApplicationRef, enableProdMode, isDevMode, createPlatformFactory} from './application_ref';
export {APP_ID, PACKAGE_ROOT_URL, PLATFORM_INITIALIZER, APP_BOOTSTRAP_LISTENER} from './application_tokens';
export {APP_INITIALIZER, ApplicationInitStatus} from './application_init';
export * from './zone';
export * from './render';
export * from './linker';
export {DebugElement, DebugNode, asNativeElements, getDebugNode} from './debug/debug_node';
export {GetTestability, Testability, TestabilityRegistry, setTestabilityGetter} from './testability/testability';
export * from './change_detection';
export * from './platform_core_providers';
export {TRANSLATIONS, TRANSLATIONS_FORMAT, LOCALE_ID} from './i18n/tokens';
export {ApplicationModule} from './application_module';
export {wtfCreateScope, wtfLeave, wtfStartTimeRange, wtfEndTimeRange, WtfScopeFn} from './profile/profile';
export {Type} from './type';
export {EventEmitter} from './facade/async';
export {ErrorHandler} from './error_handler';
export * from './core_private_export';
export * from './animation/metadata';
export {AnimationTransitionEvent} from './animation/animation_transition_event';
export {AnimationPlayer} from './animation/animation_player';
export {Sanitizer, SecurityContext} from './security';
@@ -0,0 +1,186 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ANY_STATE as ANY_STATE_, DEFAULT_STATE as DEFAULT_STATE_, EMPTY_STATE as EMPTY_STATE_, FILL_STYLE_FLAG as FILL_STYLE_FLAG_} from './animation/animation_constants';
import {AnimationGroupPlayer as AnimationGroupPlayer_} from './animation/animation_group_player';
import {AnimationKeyframe as AnimationKeyframe_} from './animation/animation_keyframe';
import {AnimationOutput as AnimationOutput_} from './animation/animation_output';
import {AnimationPlayer as AnimationPlayer_, NoOpAnimationPlayer as NoOpAnimationPlayer_} from './animation/animation_player';
import {AnimationSequencePlayer as AnimationSequencePlayer_} from './animation/animation_sequence_player';
import * as animationUtils from './animation/animation_style_util';
import {AnimationStyles as AnimationStyles_} from './animation/animation_styles';
import * as change_detection_util from './change_detection/change_detection_util';
import * as constants from './change_detection/constants';
import * as console from './console';
import * as debug from './debug/debug_renderer';
import * as reflective_provider from './di/reflective_provider';
import {ComponentStillLoadingError} from './linker/compiler';
import * as component_factory_resolver from './linker/component_factory_resolver';
import * as debug_context from './linker/debug_context';
import * as element from './linker/element';
import * as ng_module_factory from './linker/ng_module_factory';
import * as template_ref from './linker/template_ref';
import * as view from './linker/view';
import * as view_type from './linker/view_type';
import * as view_utils from './linker/view_utils';
import * as lifecycle_hooks from './metadata/lifecycle_hooks';
import * as metadata_view from './metadata/view';
import * as reflection from './reflection/reflection';
// We need to import this name separately from the above wildcard, because this symbol is exposed.
import {Reflector} from './reflection/reflection'; // tslint:disable-line
import * as reflection_capabilities from './reflection/reflection_capabilities';
import * as reflector_reader from './reflection/reflector_reader';
import * as reflection_types from './reflection/types';
import * as api from './render/api';
import * as decorators from './util/decorators';
export var __core_private__: {
isDefaultChangeDetectionStrategy: typeof constants.isDefaultChangeDetectionStrategy,
ChangeDetectorStatus: typeof constants.ChangeDetectorStatus,
_ChangeDetectorStatus?: constants.ChangeDetectorStatus,
CHANGE_DETECTION_STRATEGY_VALUES: typeof constants.CHANGE_DETECTION_STRATEGY_VALUES,
constructDependencies: typeof reflective_provider.constructDependencies,
LifecycleHooks: typeof lifecycle_hooks.LifecycleHooks,
_LifecycleHooks?: lifecycle_hooks.LifecycleHooks,
LIFECYCLE_HOOKS_VALUES: typeof lifecycle_hooks.LIFECYCLE_HOOKS_VALUES,
ReflectorReader: typeof reflector_reader.ReflectorReader,
_ReflectorReader?: reflector_reader.ReflectorReader,
_SetterFn?: reflection_types.SetterFn;
_GetterFn?: reflection_types.GetterFn;
_MethodFn?: reflection_types.MethodFn;
CodegenComponentFactoryResolver:
typeof component_factory_resolver.CodegenComponentFactoryResolver,
_CodegenComponentFactoryResolver?: component_factory_resolver.CodegenComponentFactoryResolver,
AppElement: typeof element.AppElement, _AppElement?: element.AppElement,
AppView: typeof view.AppView, _AppView?: view.AppView<any>,
DebugAppView: typeof view.DebugAppView, _DebugAppView?: view.DebugAppView<any>,
NgModuleInjector: typeof ng_module_factory.NgModuleInjector,
_NgModuleInjector?: ng_module_factory.NgModuleInjector<any>,
ViewType: typeof view_type.ViewType, _ViewType?: view_type.ViewType,
MAX_INTERPOLATION_VALUES: typeof view_utils.MAX_INTERPOLATION_VALUES,
checkBinding: typeof view_utils.checkBinding,
flattenNestedViewRenderNodes: typeof view_utils.flattenNestedViewRenderNodes,
interpolate: typeof view_utils.interpolate,
ViewUtils: typeof view_utils.ViewUtils, _ViewUtils?: view_utils.ViewUtils,
VIEW_ENCAPSULATION_VALUES: typeof metadata_view.VIEW_ENCAPSULATION_VALUES,
ViewMetadata: typeof metadata_view.ViewMetadata, _ViewMetadata?: metadata_view.ViewMetadata,
DebugContext: typeof debug_context.DebugContext, _DebugContext?: debug_context.DebugContext,
StaticNodeDebugInfo: typeof debug_context.StaticNodeDebugInfo,
_StaticNodeDebugInfo?: debug_context.StaticNodeDebugInfo,
devModeEqual: typeof change_detection_util.devModeEqual,
UNINITIALIZED: typeof change_detection_util.UNINITIALIZED,
ValueUnwrapper: typeof change_detection_util.ValueUnwrapper,
_ValueUnwrapper?: change_detection_util.ValueUnwrapper,
RenderDebugInfo: typeof api.RenderDebugInfo, _RenderDebugInfo?: api.RenderDebugInfo,
TemplateRef_: typeof template_ref.TemplateRef_, _TemplateRef_?: template_ref.TemplateRef_<any>,
ReflectionCapabilities: typeof reflection_capabilities.ReflectionCapabilities,
_ReflectionCapabilities?: reflection_capabilities.ReflectionCapabilities,
makeDecorator: typeof decorators.makeDecorator,
DebugDomRootRenderer: typeof debug.DebugDomRootRenderer,
_DebugDomRootRenderer?: debug.DebugDomRootRenderer,
EMPTY_ARRAY: typeof view_utils.EMPTY_ARRAY,
EMPTY_MAP: typeof view_utils.EMPTY_MAP,
pureProxy1: typeof view_utils.pureProxy1,
pureProxy2: typeof view_utils.pureProxy2,
pureProxy3: typeof view_utils.pureProxy3,
pureProxy4: typeof view_utils.pureProxy4,
pureProxy5: typeof view_utils.pureProxy5,
pureProxy6: typeof view_utils.pureProxy6,
pureProxy7: typeof view_utils.pureProxy7,
pureProxy8: typeof view_utils.pureProxy8,
pureProxy9: typeof view_utils.pureProxy9,
pureProxy10: typeof view_utils.pureProxy10,
castByValue: typeof view_utils.castByValue,
Console: typeof console.Console, _Console?: console.Console,
reflector: typeof reflection.reflector,
Reflector: typeof reflection.Reflector, _Reflector?: reflection.Reflector,
NoOpAnimationPlayer: typeof NoOpAnimationPlayer_, _NoOpAnimationPlayer?: NoOpAnimationPlayer_,
AnimationPlayer: typeof AnimationPlayer_, _AnimationPlayer?: AnimationPlayer_,
AnimationSequencePlayer: typeof AnimationSequencePlayer_,
_AnimationSequencePlayer?: AnimationSequencePlayer_,
AnimationGroupPlayer: typeof AnimationGroupPlayer_, _AnimationGroupPlayer?: AnimationGroupPlayer_,
AnimationKeyframe: typeof AnimationKeyframe_, _AnimationKeyframe?: AnimationKeyframe_,
prepareFinalAnimationStyles: typeof animationUtils.prepareFinalAnimationStyles,
balanceAnimationKeyframes: typeof animationUtils.balanceAnimationKeyframes,
flattenStyles: typeof animationUtils.flattenStyles,
clearStyles: typeof animationUtils.clearStyles,
renderStyles: typeof animationUtils.renderStyles,
collectAndResolveStyles: typeof animationUtils.collectAndResolveStyles,
AnimationStyles: typeof AnimationStyles_, _AnimationStyles?: AnimationStyles_,
AnimationOutput: typeof AnimationOutput_, _AnimationOutput?: AnimationOutput_,
ANY_STATE: typeof ANY_STATE_,
DEFAULT_STATE: typeof DEFAULT_STATE_,
EMPTY_STATE: typeof EMPTY_STATE_,
FILL_STYLE_FLAG: typeof FILL_STYLE_FLAG_, _ComponentStillLoadingError?: ComponentStillLoadingError
ComponentStillLoadingError: typeof ComponentStillLoadingError
} = {
isDefaultChangeDetectionStrategy: constants.isDefaultChangeDetectionStrategy,
ChangeDetectorStatus: constants.ChangeDetectorStatus,
CHANGE_DETECTION_STRATEGY_VALUES: constants.CHANGE_DETECTION_STRATEGY_VALUES,
constructDependencies: reflective_provider.constructDependencies,
LifecycleHooks: lifecycle_hooks.LifecycleHooks,
LIFECYCLE_HOOKS_VALUES: lifecycle_hooks.LIFECYCLE_HOOKS_VALUES,
ReflectorReader: reflector_reader.ReflectorReader,
CodegenComponentFactoryResolver: component_factory_resolver.CodegenComponentFactoryResolver,
AppElement: element.AppElement,
AppView: view.AppView,
DebugAppView: view.DebugAppView,
NgModuleInjector: ng_module_factory.NgModuleInjector,
ViewType: view_type.ViewType,
MAX_INTERPOLATION_VALUES: view_utils.MAX_INTERPOLATION_VALUES,
checkBinding: view_utils.checkBinding,
flattenNestedViewRenderNodes: view_utils.flattenNestedViewRenderNodes,
interpolate: view_utils.interpolate,
ViewUtils: view_utils.ViewUtils,
VIEW_ENCAPSULATION_VALUES: metadata_view.VIEW_ENCAPSULATION_VALUES,
ViewMetadata: metadata_view.ViewMetadata,
DebugContext: debug_context.DebugContext,
StaticNodeDebugInfo: debug_context.StaticNodeDebugInfo,
devModeEqual: change_detection_util.devModeEqual,
UNINITIALIZED: change_detection_util.UNINITIALIZED,
ValueUnwrapper: change_detection_util.ValueUnwrapper,
RenderDebugInfo: api.RenderDebugInfo,
TemplateRef_: template_ref.TemplateRef_,
ReflectionCapabilities: reflection_capabilities.ReflectionCapabilities,
makeDecorator: decorators.makeDecorator,
DebugDomRootRenderer: debug.DebugDomRootRenderer,
EMPTY_ARRAY: view_utils.EMPTY_ARRAY,
EMPTY_MAP: view_utils.EMPTY_MAP,
pureProxy1: view_utils.pureProxy1,
pureProxy2: view_utils.pureProxy2,
pureProxy3: view_utils.pureProxy3,
pureProxy4: view_utils.pureProxy4,
pureProxy5: view_utils.pureProxy5,
pureProxy6: view_utils.pureProxy6,
pureProxy7: view_utils.pureProxy7,
pureProxy8: view_utils.pureProxy8,
pureProxy9: view_utils.pureProxy9,
pureProxy10: view_utils.pureProxy10,
castByValue: view_utils.castByValue,
Console: console.Console,
reflector: reflection.reflector,
Reflector: reflection.Reflector,
NoOpAnimationPlayer: NoOpAnimationPlayer_,
AnimationPlayer: AnimationPlayer_,
AnimationSequencePlayer: AnimationSequencePlayer_,
AnimationGroupPlayer: AnimationGroupPlayer_,
AnimationKeyframe: AnimationKeyframe_,
prepareFinalAnimationStyles: animationUtils.prepareFinalAnimationStyles,
balanceAnimationKeyframes: animationUtils.balanceAnimationKeyframes,
flattenStyles: animationUtils.flattenStyles,
clearStyles: animationUtils.clearStyles,
renderStyles: animationUtils.renderStyles,
collectAndResolveStyles: animationUtils.collectAndResolveStyles,
AnimationStyles: AnimationStyles_,
AnimationOutput: AnimationOutput_,
ANY_STATE: ANY_STATE_,
DEFAULT_STATE: DEFAULT_STATE_,
EMPTY_STATE: EMPTY_STATE_,
FILL_STYLE_FLAG: FILL_STYLE_FLAG_,
ComponentStillLoadingError: ComponentStillLoadingError
};
+1 -1
View File
@@ -19,7 +19,7 @@ import {WrappedError} from './facade/errors';
*
* ```javascript
*
* class MyExceptionHandler implements ErrorHandler {
* class MyErrorHandler implements ErrorHandler {
* call(error, stackTrace = null, reason = null) {
* // do something with the exception
* }
@@ -1,12 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* This is here because DART requires it. It is noop in JS.
*/
export function wtfInit() {}