import { GenerateUrlsOptions, ResolverOptions, Route, RouteContext, RouteResult, UrlGenerator } from './types'; /** * Universal Router (https://www.kriasoft.com/universal-router/) * * Copyright (c) 2015-present Kriasoft. * * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree. */ export declare class Resolver { baseUrl: string; errorHandler?: (error: Error) => RouteResult; resolveRoute: (context: RouteContext) => RouteResult | Promise | undefined | Promise; context: Partial & { resolver: Resolver; }; root: Route; constructor(routes: Route | Route[], options?: ResolverOptions); /** * Returns the current list of routes (as a shallow copy). Adding / removing * routes to / from the returned array does not affect the routing config, * but modifying the route objects does. * * @return */ getRoutes(): Route[]; /** * Sets the routing config (replacing the existing one). * * @param routes a single route or an array of those * (the array is shallow copied) */ setRoutes(routes: Route | Route[]): void; /** * Appends one or several routes to the routing config and returns the * effective routing config after the operation. * * @param routes a single route or an array of those * (the array is shallow copied) * @return * @protected */ addRoutes(routes: Route | Route[]): Route[]; /** * Removes all existing routes from the routing config. */ removeRoutes(): void; /** * Asynchronously resolves the given pathname, i.e. finds all routes matching * the pathname and tries resolving them one after another in the order they * are listed in the routes config until the first non-null result. * * Returns a promise that is fulfilled with the return value of an object that consists of the first * route handler result that returns something other than `null` or `undefined` and context used to get this result. * * If no route handlers return a non-null result, or if no route matches the * given pathname the returned promise is rejected with a 'page not found' * `Error`. * * @param pathnameOrContext the pathname to * resolve or a context object with a `pathname` property and other * properties to pass to the route resolver functions. * @return */ resolve(pathnameOrContext: string | Partial): Promise; static __createUrl(url: string, base: string): URL; __getEffectiveBaseUrl(): string; __normalizePathname(pathname: string): string | undefined; } export declare function generateUrls(router: Resolver, options?: GenerateUrlsOptions): UrlGenerator;