fix: public api surface fixes + stability markers
- ts-api-guardian will now error if a new public symbol is added with a stability marker (`@stable`, `@experimental`, `@deprecated`) - DomEventsPlugin and KeyEventsPlugin were removed from public api surface - these classes is an implementation detail - deprecated BROWSER_PROVIDERS was removed completely - `@angular/compiler` was removed from the ts-api-guardian check since this package shouldn't contain anything that users need to directly import - the rest of the api surface was conservatively marked as stable or experimental BREAKING CHANGES: DomEventsPlugin and KeyEventsPlugin previously exported from core are no longer public - these classes are implementation detail. Previously deprecated BROWSER_PROVIDERS was completely removed from platform-browser. Closes #9236 Closes #9235 Ref #9234
This commit is contained in:
@ -18,6 +18,9 @@ import {DefaultUrlSerializer, UrlSerializer} from './url_tree';
|
||||
export const ROUTER_CONFIG = new OpaqueToken('ROUTER_CONFIG');
|
||||
export const ROUTER_OPTIONS = new OpaqueToken('ROUTER_OPTIONS');
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface ExtraOptions { enableTracing?: boolean; }
|
||||
|
||||
export function setupRouter(
|
||||
@ -76,6 +79,8 @@ export function setupRouterInitializer(injector: Injector) {
|
||||
*
|
||||
* bootstrap(AppCmp, [provideRouter(router)]);
|
||||
* ```
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export function provideRouter(_config: RouterConfig, _opts: ExtraOptions): any[] {
|
||||
return [
|
||||
|
@ -8,14 +8,29 @@
|
||||
|
||||
import {Type} from '@angular/core';
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export type RouterConfig = Route[];
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export type Data = {
|
||||
[name: string]: any
|
||||
};
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export type ResolveData = {
|
||||
[name: string]: any
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface Route {
|
||||
path?: string;
|
||||
|
||||
@ -65,4 +80,4 @@ function validateNode(route: Route): void {
|
||||
throw new Error(
|
||||
`Invalid route configuration of route '{path: "${route.path}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ import {ActivatedRouteSnapshot, RouterStateSnapshot} from './router_state';
|
||||
|
||||
/**
|
||||
* An interface a class can implement to be a guard deciding if a route can be activated.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export interface CanActivate {
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot):
|
||||
@ -19,12 +21,17 @@ export interface CanActivate {
|
||||
|
||||
/**
|
||||
* An interface a class can implement to be a guard deciding if a route can be deactivated.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export interface CanDeactivate<T> {
|
||||
canDeactivate(component: T, route: ActivatedRouteSnapshot, state: RouterStateSnapshot):
|
||||
Observable<boolean>|boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface Resolve<T> {
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<any>|any;
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ export interface NavigationExtras {
|
||||
|
||||
/**
|
||||
* An event triggered when a navigation starts
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export class NavigationStart {
|
||||
constructor(public id: number, public url: string) {}
|
||||
@ -52,6 +54,8 @@ export class NavigationStart {
|
||||
|
||||
/**
|
||||
* An event triggered when a navigation ends successfully
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export class NavigationEnd {
|
||||
constructor(public id: number, public url: string, public urlAfterRedirects: string) {}
|
||||
@ -63,6 +67,8 @@ export class NavigationEnd {
|
||||
|
||||
/**
|
||||
* An event triggered when a navigation is canceled
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export class NavigationCancel {
|
||||
constructor(public id: number, public url: string) {}
|
||||
@ -72,6 +78,8 @@ export class NavigationCancel {
|
||||
|
||||
/**
|
||||
* An event triggered when a navigation fails due to unexpected error
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export class NavigationError {
|
||||
constructor(public id: number, public url: string, public error: any) {}
|
||||
@ -83,6 +91,8 @@ export class NavigationError {
|
||||
|
||||
/**
|
||||
* An event triggered when routes are recognized
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export class RoutesRecognized {
|
||||
constructor(
|
||||
@ -94,10 +104,15 @@ export class RoutesRecognized {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export type Event = NavigationStart | NavigationEnd | NavigationCancel | NavigationError;
|
||||
|
||||
/**
|
||||
* The `Router` is responsible for mapping URLs to components.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export class Router {
|
||||
private currentUrlTree: UrlTree;
|
||||
@ -350,9 +365,16 @@ export class Router {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
class CanActivate {
|
||||
constructor(public route: ActivatedRouteSnapshot) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
class CanDeactivate {
|
||||
constructor(public component: Object, public route: ActivatedRouteSnapshot) {}
|
||||
}
|
||||
|
@ -8,6 +8,9 @@
|
||||
|
||||
import {RouterOutlet} from './directives/router_outlet';
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export class RouterOutletMap {
|
||||
/** @internal */
|
||||
_outlets: {[name: string]: RouterOutlet} = {};
|
||||
|
@ -30,6 +30,8 @@ import {RouterConfig} from './config';
|
||||
*
|
||||
* bootstrap(AppCmp, [provideRouter(router)]);
|
||||
* ```
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export function provideRouter(config: RouterConfig, opts: ExtraOptions = {}): any[] {
|
||||
return [
|
||||
|
@ -31,6 +31,8 @@ import {Tree, TreeNode} from './utils/tree';
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export class RouterState extends Tree<ActivatedRoute> {
|
||||
/**
|
||||
@ -85,6 +87,8 @@ function createEmptyStateSnapshot(urlTree: UrlTree, rootComponent: Type): Router
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export class ActivatedRoute {
|
||||
/** @internal */
|
||||
@ -137,6 +141,8 @@ export class InheritedResolve {
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export class ActivatedRouteSnapshot {
|
||||
/**
|
||||
@ -188,6 +194,8 @@ export class ActivatedRouteSnapshot {
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export class RouterStateSnapshot extends Tree<ActivatedRouteSnapshot> {
|
||||
/**
|
||||
@ -227,4 +235,4 @@ export function advanceActivatedRoute(route: ActivatedRoute): void {
|
||||
route.snapshot = route._futureSnapshot;
|
||||
(<any>route.data).next(route._futureSnapshot.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,11 +9,15 @@
|
||||
/**
|
||||
* Name of the primary outlet.
|
||||
* @type {string}
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export const PRIMARY_OUTLET = 'PRIMARY_OUTLET';
|
||||
|
||||
/**
|
||||
* A collection of parameters.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export type Params = {
|
||||
[key: string]: any
|
||||
|
@ -62,6 +62,8 @@ function containsSegmentHelper(
|
||||
|
||||
/**
|
||||
* A URL in the tree form.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export class UrlTree {
|
||||
/**
|
||||
@ -96,6 +98,10 @@ export class UrlSegment {
|
||||
toString(): string { return serializePaths(this); }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export class UrlPathWithParams {
|
||||
constructor(public path: string, public parameters: {[key: string]: string}) {}
|
||||
toString(): string { return serializePath(this); }
|
||||
@ -153,6 +159,8 @@ export function mapChildrenIntoArray<T>(
|
||||
|
||||
/**
|
||||
* Defines a way to serialize/deserialize a url tree.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export abstract class UrlSerializer {
|
||||
/**
|
||||
@ -168,6 +176,8 @@ export abstract class UrlSerializer {
|
||||
|
||||
/**
|
||||
* A default implementation of the serialization.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export class DefaultUrlSerializer implements UrlSerializer {
|
||||
parse(url: string): UrlTree {
|
||||
@ -427,4 +437,4 @@ class UrlParser {
|
||||
|
||||
return segments;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user