fix(common): add upgrade sub-package to ng_package rule for @angular/common (#30117)

Follow-up to #30055 to include @angular/common/upgrade in the npm package

Closes #30116

PR Close #30117
This commit is contained in:
Brandon Roberts
2019-04-25 09:36:49 -05:00
committed by Andrew Kushnir
parent 61365a94ed
commit 6de4cbdd41
11 changed files with 49 additions and 14 deletions

View File

@ -7,7 +7,7 @@
*/
import {LocationChangeEvent, LocationChangeListener, PlatformLocation} from '@angular/common';
import {Injectable, InjectionToken, Optional} from '@angular/core';
import {Inject, Injectable, InjectionToken, Optional} from '@angular/core';
import {Subject} from 'rxjs';
/**
@ -78,11 +78,21 @@ function parseUrl(urlStr: string, baseHref: string) {
};
}
/**
* Mock platform location config
*
* @publicApi
*/
export interface MockPlatformLocationConfig {
startUrl?: string;
appBaseHref?: string;
}
/**
* Provider for mock platform location config
*
* @publicApi
*/
export const MOCK_PLATFORM_LOCATION_CONFIG = new InjectionToken('MOCK_PLATFORM_LOCATION_CONFIG');
/**
@ -104,7 +114,8 @@ export class MockPlatformLocation implements PlatformLocation {
state: unknown
}[] = [{hostname: '', protocol: '', port: '', pathname: '/', search: '', hash: '', state: null}];
constructor(@Optional() config?: MockPlatformLocationConfig) {
constructor(@Inject(MOCK_PLATFORM_LOCATION_CONFIG) @Optional() config?:
MockPlatformLocationConfig) {
if (config) {
this.baseHref = config.appBaseHref || '';