From 6784f5e744c4ebd058b6fe136f73fc168158db8d Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Wed, 14 Sep 2016 15:54:20 -0500 Subject: [PATCH] fix(exports): update module exports --- src/components/tap-click/tap-click.ts | 13 ---- src/config/config.ts | 15 ----- src/index.ts | 5 +- src/module.ts | 88 +++++++++++++++++++-------- src/navigation/deep-linker.ts | 21 +------ src/platform/platform.ts | 16 ----- src/platform/query-params.ts | 10 --- src/util/events.ts | 13 ---- 8 files changed, 67 insertions(+), 114 deletions(-) diff --git a/src/components/tap-click/tap-click.ts b/src/components/tap-click/tap-click.ts index 5858f6e8b6..ea1b1842dc 100644 --- a/src/components/tap-click/tap-click.ts +++ b/src/components/tap-click/tap-click.ts @@ -230,16 +230,3 @@ export function setupTapClick(config: Config, app: App, zone: NgZone) { return new TapClick(config, app, zone); }; } - -export function provideTapClick() { - return { - provide: APP_INITIALIZER, - useFactory: setupTapClick, - deps: [ - Config, - App, - NgZone - ], - multi: true - }; -} diff --git a/src/config/config.ts b/src/config/config.ts index fa2858be53..05f1773291 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -376,18 +376,3 @@ export function setupConfig(userConfig: any, queryParams: QueryParams, platform: config.init(userConfig, queryParams, platform); return config; } - -export function provideConfig(userConfig: any): any { - return [ - { provide: UserConfig, useValue: userConfig }, - { - provide: Config, - useFactory: setupConfig, - deps: [ - UserConfig, - QueryParams, - Platform - ] - } - ]; -} diff --git a/src/index.ts b/src/index.ts index 37dd8d9dae..61725f1f0d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,5 @@ -export { Config } from './config/config'; -export { IonicModule } from './module'; - +export * from './module'; export * from './directives'; export * from './gestures/drag-gesture'; @@ -10,6 +8,7 @@ export * from './gestures/slide-edge-gesture'; export * from './gestures/slide-gesture'; export * from './gestures/gesture-controller'; +export * from './config/config'; export * from './platform/platform'; export * from './storage/storage'; export * from './storage/sql'; diff --git a/src/module.ts b/src/module.ts index 0c4c8fccde..69e058ad33 100644 --- a/src/module.ts +++ b/src/module.ts @@ -1,17 +1,18 @@ -import { ANALYZE_FOR_ENTRY_COMPONENTS, ModuleWithProviders, NgModule } from '@angular/core'; +import { ANALYZE_FOR_ENTRY_COMPONENTS, APP_INITIALIZER, ModuleWithProviders, NgModule, NgZone } from '@angular/core'; +import { Location, LocationStrategy, HashLocationStrategy } from '@angular/common'; import { BrowserModule, HAMMER_GESTURE_CONFIG } from '@angular/platform-browser'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; - /** * Import Providers */ import { ActionSheetController } from './components/action-sheet/action-sheet'; import { AlertController } from './components/alert/alert'; import { App } from './components/app/app'; -import { provideConfig } from './config/config'; -import { provideEvents } from './util/events'; +import { Config, UserConfig, setupConfig } from './config/config'; +import { DeepLinker, setupDeepLinker, UserDeepLinkConfig } from './navigation/deep-linker'; +import { setupProvideEvents } from './util/events'; import { FeatureDetect } from './util/feature-detect'; import { Form } from './util/form'; import { GestureController } from './gestures/gesture-controller'; @@ -21,26 +22,19 @@ import { LoadingController } from './components/loading/loading'; import { MenuController } from './components/menu/menu-controller'; import { ModalController } from './components/modal/modal'; import { PickerController } from './components/picker/picker'; -import { providePlatform, UserAgent, UserNavigatorPlatform, UserDir, UserLang } from './platform/platform'; +import { Platform, setupPlatform, UserAgent, UserNavigatorPlatform, UserDir, UserLang } from './platform/platform'; import { PopoverController } from './components/popover/popover'; -import { provideDeepLinker } from './navigation/deep-linker'; -import { provideQueryParams, UserUrl } from './platform/query-params'; -import { TapClick, provideTapClick } from './components/tap-click/tap-click'; +import { QueryParams, setupQueryParams, UserUrl } from './platform/query-params'; +import { TapClick, setupTapClick } from './components/tap-click/tap-click'; import { ToastController } from './components/toast/toast'; import { Translate } from './translation/translate'; import { TransitionController } from './transitions/transition-controller'; import { UserRoot } from './components/app/app-root'; - +import { UrlSerializer } from './navigation/url-serializer'; /** - * Export Providers + * Import Overlay Entry Components */ -export { DeepLinker, provideDeepLinker } from './navigation/deep-linker'; -export { NavController } from './navigation/nav-controller'; -export { NavParams } from './navigation/nav-params'; -export { NavLink, NavOptions, DeepLink, DeepLinkConfig } from './navigation/nav-util'; -export { ViewController } from './navigation/view-controller'; - import { ActionSheetCmp } from './components/action-sheet/action-sheet-component'; import { AlertCmp } from './components/alert/alert-component'; import { IONIC_DIRECTIVES } from './directives'; @@ -51,6 +45,16 @@ import { PickerCmp } from './components/picker/picker-component'; import { PopoverCmp } from './components/popover/popover-component'; import { ToastCmp } from './components/toast/toast-component'; +/** + * Export Providers + */ +export { DeepLinker, UserDeepLinkConfig } from './navigation/deep-linker'; +export { NavController } from './navigation/nav-controller'; +export { NavParams } from './navigation/nav-params'; +export { NavLink, NavOptions, DeepLink, DeepLinkConfig } from './navigation/nav-util'; +export { UrlSerializer } from './navigation/url-serializer'; +export { ViewController } from './navigation/view-controller'; + @NgModule({ imports: [BrowserModule, HttpModule, FormsModule, ReactiveFormsModule], @@ -83,20 +87,54 @@ export class IonicModule { ngModule: IonicModule, providers: [ { provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: userAppRoot, multi: true }, + { provide: APP_INITIALIZER, useFactory: setupTapClick, + deps: [ + Config, + App, + NgZone + ], + multi: true + }, + { provide: APP_INITIALIZER, useFactory: setupProvideEvents, deps: [ Platform ], multi: true }, + { provide: Config, useFactory: setupConfig, + deps: [ + UserConfig, + QueryParams, + Platform + ] + }, + { provide: DeepLinker, useFactory: setupDeepLinker, + deps: [ + App, + UrlSerializer, + Location + ] + }, { provide: HAMMER_GESTURE_CONFIG, useClass: IonicGestureConfig }, + { provide: LocationStrategy, useClass: HashLocationStrategy }, + { provide: Platform, useFactory: setupPlatform, + deps: [ + QueryParams, + UserAgent, + UserNavigatorPlatform, + UserDir, + UserLang, + NgZone + ] + }, + { provide: QueryParams, useFactory: setupQueryParams, + deps: [ + UserUrl + ] + }, { provide: UserAgent, useFactory: getWindowUserAgent }, { provide: UserDir, useFactory: getDocumentDir }, { provide: UserLang, useFactory: getDocumentLang }, { provide: UserNavigatorPlatform, useFactory: getWindowPlatform }, { provide: UserRoot, useValue: userAppRoot }, { provide: UserUrl, useFactory: getWindowLocation }, - - provideConfig(userConfig), - provideDeepLinker(userDeepLinkConfig), - provideEvents(), - providePlatform(), - provideQueryParams(), - provideTapClick(), + { provide: UserConfig, useValue: userConfig }, + { provide: UserDeepLinkConfig, useValue: userDeepLinkConfig }, ActionSheetController, AlertController, @@ -106,6 +144,7 @@ export class IonicModule { GestureController, Keyboard, LoadingController, + Location, MenuController, ModalController, PickerController, @@ -113,7 +152,8 @@ export class IonicModule { TapClick, ToastController, Translate, - TransitionController + TransitionController, + UrlSerializer ] }; } diff --git a/src/navigation/deep-linker.ts b/src/navigation/deep-linker.ts index a851e1eff2..0825cb2212 100644 --- a/src/navigation/deep-linker.ts +++ b/src/navigation/deep-linker.ts @@ -1,5 +1,5 @@ import { Injectable, OpaqueToken } from '@angular/core'; -import { Location, LocationStrategy, HashLocationStrategy } from '@angular/common'; +import { Location } from '@angular/common'; import { App } from '../components/app/app'; import { convertToViews, isNav, isTab, isTabs, NavSegment, DIRECTION_BACK } from './nav-util'; @@ -418,25 +418,6 @@ export function setupDeepLinker(app: App, serializer: UrlSerializer, location: L export const UserDeepLinkConfig = new OpaqueToken('USERLINKS'); -export function provideDeepLinker(userDeepLinkConfig: any): any[] { - return [ - UrlSerializer, - Location, - { provide: UserDeepLinkConfig, useValue: userDeepLinkConfig }, - { provide: LocationStrategy, useClass: HashLocationStrategy }, - { - provide: DeepLinker, - useFactory: setupDeepLinker, - deps: [ - App, - UrlSerializer, - Location - ] - }, - ]; -} - - export function normalizeUrl(browserUrl: string): string { browserUrl = browserUrl.trim(); if (browserUrl.charAt(0) !== '/') { diff --git a/src/platform/platform.ts b/src/platform/platform.ts index 8467c8b83e..222a3f0c9f 100644 --- a/src/platform/platform.ts +++ b/src/platform/platform.ts @@ -844,19 +844,3 @@ export const UserAgent = new OpaqueToken('USERAGENT'); export const UserNavigatorPlatform = new OpaqueToken('USERNAVPLT'); export const UserDir = new OpaqueToken('USERDIR'); export const UserLang = new OpaqueToken('USERLANG'); - - -export function providePlatform(): any { - return { - provide: Platform, - useFactory: setupPlatform, - deps: [ - QueryParams, - UserAgent, - UserNavigatorPlatform, - UserDir, - UserLang, - NgZone - ] - }; -} diff --git a/src/platform/query-params.ts b/src/platform/query-params.ts index 2b60955424..14f5b6d36d 100644 --- a/src/platform/query-params.ts +++ b/src/platform/query-params.ts @@ -32,13 +32,3 @@ export const UserUrl = new OpaqueToken('USERURL'); export function setupQueryParams(url: string): QueryParams { return new QueryParams(url); } - -export function provideQueryParams(): any { - return { - provide: QueryParams, - useFactory: setupQueryParams, - deps: [ - UserUrl - ] - }; -} diff --git a/src/util/events.ts b/src/util/events.ts index 74503d6700..5be2c08591 100644 --- a/src/util/events.ts +++ b/src/util/events.ts @@ -1,5 +1,3 @@ -import { APP_INITIALIZER } from '@angular/core'; - import { nativeTimeout } from '../util/dom'; import { Platform } from '../platform/platform'; import { ScrollView } from '../util/scroll-view'; @@ -152,14 +150,3 @@ export function setupProvideEvents(platform: Platform) { return setupEvents(platform); }; } - -export function provideEvents() { - return { - provide: APP_INITIALIZER, - useFactory: setupProvideEvents, - deps: [ - Platform - ], - multi: true - }; -}