refactor(Location): out of router and into platform/common
closes https://github.com/angular/angular/issues/4943 BREAKING CHANGE: `Location` and other related providers have been moved out of `router` and into `platform/common`. `BrowserPlatformLocation` is not meant to be used directly however advanced configurations may use it via the following import change. Before: ``` import { PlatformLocation, Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, APP_BASE_HREF} from 'angular2/router'; import {BrowserPlatformLocation} from 'angular2/src/router/location/browser_platform_location'; ``` After: ``` import { PlatformLocation, Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, APP_BASE_HREF} from 'angular2/platform/common'; import {BrowserPlatformLocation} from 'angular2/src/platform/browser/location/browser_platform_location'; ``` Closes #7962
This commit is contained in:
@@ -13,11 +13,10 @@ import {
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
import {IS_DART, isPresent, stringify} from 'angular2/src/facade/lang';
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {bootstrap, BROWSER_PROVIDERS, BROWSER_APP_PROVIDERS} from 'angular2/platform/browser';
|
||||
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
||||
import {Console} from 'angular2/src/core/console';
|
||||
import {Component, Directive, OnDestroy, platform} from 'angular2/core';
|
||||
import {BROWSER_PROVIDERS, BROWSER_APP_PROVIDERS} from 'angular2/platform/browser';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens';
|
||||
import {PromiseWrapper, TimerWrapper} from 'angular2/src/facade/async';
|
||||
|
||||
@@ -311,6 +311,17 @@ var NG_PLATFORM_BROWSER = [
|
||||
'inspectNativeElement'
|
||||
];
|
||||
|
||||
var NG_PLATFORM_COMMON = [
|
||||
'APP_BASE_HREF',
|
||||
'HashLocationStrategy',
|
||||
'Location',
|
||||
'LocationStrategy',
|
||||
'PathLocationStrategy',
|
||||
'PlatformLocation',
|
||||
'UrlChangeEvent:dart',
|
||||
'UrlChangeListener:dart'
|
||||
];
|
||||
|
||||
var NG_UPGRADE = [
|
||||
'UpgradeAdapter',
|
||||
'UpgradeAdapterRef',
|
||||
@@ -322,6 +333,7 @@ var NG_API = {
|
||||
ngCore: NG_CORE,
|
||||
ngInstrumentation: NG_INSTRUMENTATION,
|
||||
ngPlatformBrowser: NG_PLATFORM_BROWSER,
|
||||
ngPlatformCommon: NG_PLATFORM_COMMON,
|
||||
ngUpgrade: NG_UPGRADE
|
||||
};
|
||||
|
||||
@@ -336,8 +348,15 @@ export function main() {
|
||||
*/
|
||||
|
||||
describe('public API', () => {
|
||||
var barrelList =
|
||||
['ngCommon', 'ngCompiler', 'ngCore', 'ngInstrumentation', 'ngPlatformBrowser', 'ngUpgrade'];
|
||||
var barrelList = [
|
||||
'ngCommon',
|
||||
'ngCompiler',
|
||||
'ngCore',
|
||||
'ngInstrumentation',
|
||||
'ngPlatformBrowser',
|
||||
'ngPlatformCommon',
|
||||
'ngUpgrade'
|
||||
];
|
||||
|
||||
if (IS_DART) {
|
||||
barrelList = barrelList.filter(b => b !== 'ngUpgrade');
|
||||
|
||||
@@ -18,9 +18,9 @@ import {SpyRouter, SpyLocation} from '../spies';
|
||||
|
||||
import {provide, Component} from 'angular2/core';
|
||||
import {By} from 'angular2/platform/common_dom';
|
||||
import {Location} from 'angular2/platform/common';
|
||||
|
||||
import {
|
||||
Location,
|
||||
Router,
|
||||
RouteRegistry,
|
||||
RouterLink,
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {APP_BASE_HREF, LocationStrategy} from 'angular2/platform/common';
|
||||
import {Component, Directive} from 'angular2/src/core/metadata';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {Console} from 'angular2/src/core/console';
|
||||
@@ -33,9 +34,7 @@ import {
|
||||
ROUTER_PRIMARY_COMPONENT,
|
||||
RouteParams,
|
||||
Router,
|
||||
APP_BASE_HREF,
|
||||
ROUTER_DIRECTIVES,
|
||||
LocationStrategy
|
||||
ROUTER_DIRECTIVES
|
||||
} from 'angular2/router';
|
||||
|
||||
import {MockLocationStrategy} from 'angular2/src/mock/mock_location_strategy';
|
||||
|
||||
@@ -12,12 +12,12 @@ import {
|
||||
xit,
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
|
||||
import {By} from 'angular2/platform/common_dom';
|
||||
import {Location} from 'angular2/platform/common';
|
||||
|
||||
import {specs, compile, TEST_ROUTER_PROVIDERS, clickOnElement, getHref} from '../util';
|
||||
|
||||
import {Router, AsyncRoute, Route, Location} from 'angular2/router';
|
||||
import {Router, AsyncRoute, Route} from 'angular2/router';
|
||||
|
||||
import {
|
||||
HelloCmp,
|
||||
|
||||
@@ -16,9 +16,10 @@ import {
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {By} from 'angular2/platform/common_dom';
|
||||
import {Location} from 'angular2/platform/common';
|
||||
import {provide, Component, Injector, Inject} from 'angular2/core';
|
||||
|
||||
import {Router, ROUTER_DIRECTIVES, RouteParams, RouteData, Location} from 'angular2/router';
|
||||
import {Router, ROUTER_DIRECTIVES, RouteParams, RouteData} from 'angular2/router';
|
||||
import {
|
||||
RouteConfig,
|
||||
Route,
|
||||
|
||||
@@ -15,7 +15,8 @@ import {
|
||||
import {specs, compile, TEST_ROUTER_PROVIDERS, clickOnElement, getHref} from '../util';
|
||||
|
||||
import {By} from 'angular2/platform/common_dom';
|
||||
import {Router, Route, Location} from 'angular2/router';
|
||||
import {Location} from 'angular2/platform/common';
|
||||
import {Router, Route} from 'angular2/router';
|
||||
|
||||
import {
|
||||
HelloCmp,
|
||||
|
||||
@@ -16,9 +16,10 @@ import {
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {provide, Component, Injector, Inject} from 'angular2/core';
|
||||
import {Location} from 'angular2/platform/common';
|
||||
import {PromiseWrapper, TimerWrapper} from 'angular2/src/facade/async';
|
||||
|
||||
import {Router, RouterOutlet, RouterLink, RouteParams, RouteData, Location} from 'angular2/router';
|
||||
import {Router, RouterOutlet, RouterLink, RouteParams, RouteData} from 'angular2/router';
|
||||
import {
|
||||
RouteConfig,
|
||||
Route,
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {Router, RouterOutlet, RouterLink, RouteParams, RouteData, Location} from 'angular2/router';
|
||||
import {Router, RouterOutlet, RouterLink, RouteParams, RouteData} from 'angular2/router';
|
||||
import {
|
||||
RouteConfig,
|
||||
Route,
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
AsyncRoute,
|
||||
Redirect
|
||||
} from 'angular2/src/router/route_config/route_config_decorator';
|
||||
import {Location} from 'angular2/platform/common';
|
||||
|
||||
import {TEST_ROUTER_PROVIDERS, RootCmp, compile} from './util';
|
||||
import {HelloCmp, GoodbyeCmp, RedirectToParentCmp} from './impl/fixture_components';
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {By} from 'angular2/platform/common_dom';
|
||||
import {Location} from 'angular2/platform/common';
|
||||
import {NumberWrapper} from 'angular2/src/facade/lang';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
@@ -26,7 +27,6 @@ import {provide, Component} from 'angular2/core';
|
||||
|
||||
import {SpyLocation} from 'angular2/src/mock/location_mock';
|
||||
import {
|
||||
Location,
|
||||
Router,
|
||||
RouteRegistry,
|
||||
RouterLink,
|
||||
|
||||
@@ -21,7 +21,7 @@ import {RootRouter} from 'angular2/src/router/router';
|
||||
import {Router, ROUTER_DIRECTIVES, ROUTER_PRIMARY_COMPONENT} from 'angular2/router';
|
||||
|
||||
import {SpyLocation} from 'angular2/src/mock/location_mock';
|
||||
import {Location} from 'angular2/src/router/location/location';
|
||||
import {Location} from 'angular2/platform/common';
|
||||
import {RouteRegistry} from 'angular2/src/router/route_registry';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
export {ComponentFixture} from 'angular2/testing_internal';
|
||||
|
||||
@@ -14,9 +14,7 @@ import {
|
||||
|
||||
import {Injector, provide} from 'angular2/core';
|
||||
|
||||
import {PlatformLocation} from 'angular2/src/router/location/platform_location';
|
||||
import {APP_BASE_HREF} from 'angular2/src/router/location/location_strategy';
|
||||
import {HashLocationStrategy} from 'angular2/src/router/location/hash_location_strategy';
|
||||
import {PlatformLocation, APP_BASE_HREF, HashLocationStrategy} from 'angular2/platform/common';
|
||||
import {SpyPlatformLocation} from '../spies';
|
||||
|
||||
export function main() {
|
||||
|
||||
@@ -15,8 +15,7 @@ import {
|
||||
import {Injector, provide} from 'angular2/core';
|
||||
import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||
|
||||
import {Location} from 'angular2/src/router/location/location';
|
||||
import {LocationStrategy, APP_BASE_HREF} from 'angular2/src/router/location/location_strategy';
|
||||
import {Location, LocationStrategy, APP_BASE_HREF} from 'angular2/platform/common';
|
||||
import {MockLocationStrategy} from 'angular2/src/mock/mock_location_strategy';
|
||||
|
||||
export function main() {
|
||||
|
||||
@@ -15,9 +15,12 @@ import {
|
||||
import {Injector, provide} from 'angular2/core';
|
||||
import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||
|
||||
import {PlatformLocation} from 'angular2/src/router/location/platform_location';
|
||||
import {LocationStrategy, APP_BASE_HREF} from 'angular2/src/router/location/location_strategy';
|
||||
import {PathLocationStrategy} from 'angular2/src/router/location/path_location_strategy';
|
||||
import {
|
||||
PlatformLocation,
|
||||
LocationStrategy,
|
||||
PathLocationStrategy,
|
||||
APP_BASE_HREF
|
||||
} from 'angular2/platform/common';
|
||||
import {SpyPlatformLocation} from '../spies';
|
||||
|
||||
export function main() {
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {bootstrap} from 'angular2/platform/browser';
|
||||
import {APP_BASE_HREF, LocationStrategy} from 'angular2/platform/common';
|
||||
import {Component, Directive} from 'angular2/src/core/metadata';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {Console} from 'angular2/src/core/console';
|
||||
@@ -19,16 +20,9 @@ import {provide} from 'angular2/core';
|
||||
import {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens';
|
||||
import {Type, IS_DART} from 'angular2/src/facade/lang';
|
||||
|
||||
import {
|
||||
ROUTER_PROVIDERS,
|
||||
Router,
|
||||
RouteConfig,
|
||||
APP_BASE_HREF,
|
||||
ROUTER_DIRECTIVES
|
||||
} from 'angular2/router';
|
||||
import {ROUTER_PROVIDERS, Router, RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
|
||||
|
||||
import {ExceptionHandler} from 'angular2/src/facade/exceptions';
|
||||
import {LocationStrategy} from 'angular2/src/router/location/location_strategy';
|
||||
import {MockLocationStrategy} from 'angular2/src/mock/mock_location_strategy';
|
||||
|
||||
class _ArrayLogger {
|
||||
|
||||
@@ -18,7 +18,7 @@ import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {Router, RootRouter} from 'angular2/src/router/router';
|
||||
import {SpyLocation} from 'angular2/src/mock/location_mock';
|
||||
import {Location} from 'angular2/src/router/location/location';
|
||||
import {Location} from 'angular2/platform/common';
|
||||
|
||||
import {RouteRegistry, ROUTER_PRIMARY_COMPONENT} from 'angular2/src/router/route_registry';
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
library router.spies;
|
||||
|
||||
import 'package:angular2/platform/common.dart' show PlatformLocation, Location;
|
||||
import 'package:angular2/router.dart';
|
||||
import 'package:angular2/testing_internal.dart';
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {Router, RouterOutlet, Location, PlatformLocation} from 'angular2/router';
|
||||
import {Location} from 'angular2/platform/common';
|
||||
import {Router, RouterOutlet} from 'angular2/router';
|
||||
import {SpyObject, proxy} from 'angular2/testing_internal';
|
||||
|
||||
export class SpyRouter extends SpyObject {
|
||||
|
||||
@@ -23,7 +23,8 @@ const LIB_MAP = const {
|
||||
'ngCompiler': 'angular2.compiler',
|
||||
'ngCore': 'angular2.core',
|
||||
'ngInstrumentation': 'angular2.instrumentation',
|
||||
'ngPlatformBrowser': 'angular2.platform.browser'
|
||||
'ngPlatformBrowser': 'angular2.platform.browser',
|
||||
'ngPlatformCommon': 'angular2.platform.common'
|
||||
};
|
||||
|
||||
// Have this list here to trick dart to force import.
|
||||
|
||||
@@ -4,6 +4,7 @@ import * as ngCompiler from 'angular2/compiler';
|
||||
import * as ngCore from 'angular2/core';
|
||||
import * as ngInstrumentation from 'angular2/instrumentation';
|
||||
import * as ngPlatformBrowser from 'angular2/platform/browser';
|
||||
import * as ngPlatformCommon from 'angular2/platform/common';
|
||||
import * as ngUpgrade from 'angular2/upgrade';
|
||||
|
||||
const LIB_MAP = {
|
||||
@@ -13,6 +14,7 @@ const LIB_MAP = {
|
||||
ngCore,
|
||||
ngInstrumentation,
|
||||
ngPlatformBrowser,
|
||||
ngPlatformCommon,
|
||||
ngUpgrade
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user