1 | /**
|
2 | * @license
|
3 | * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
4 | * This code may only be used under the BSD style license found at
|
5 | * http://polymer.github.io/LICENSE.txt
|
6 | * The complete set of authors may be found at
|
7 | * http://polymer.github.io/AUTHORS.txt
|
8 | * The complete set of contributors may be found at
|
9 | * http://polymer.github.io/CONTRIBUTORS.txt
|
10 | * Code distributed by Google as part of the polymer project is also
|
11 | * subject to an additional IP rights grant found at
|
12 | * http://polymer.github.io/PATENTS.txt
|
13 | */
|
14 | import { PackageRelativeUrl, UrlResolver } from '../index';
|
15 | import { FileRelativeUrl, ResolvedUrl } from '../model/url';
|
16 | import { FsUrlResolver } from './fs-url-resolver';
|
17 | /**
|
18 | * A URL resolver for very large codebases where source files map in an
|
19 | * arbitrary but predetermined fashion onto URL space.
|
20 | *
|
21 | * It also separates the root directory – the root of all source code that's
|
22 | * legal to load – from the package directory, which is how the user refers to
|
23 | * files on the CLI or the IDE.
|
24 | */
|
25 | export declare class IndirectUrlResolver extends FsUrlResolver implements UrlResolver {
|
26 | protected readonly protocol: string;
|
27 | private readonly runtimeUrlToResolvedUrl;
|
28 | private readonly resolvedUrlToRuntimeUrl;
|
29 | /**
|
30 | * @param rootPath All loadable source code must be a descendent of this
|
31 | * directory. Should be the same as FsUrlLoader's rootPath.
|
32 | * @param packagePath The base directory for package-relative paths. Usually
|
33 | * the current working directory.
|
34 | * @param indirectionMap Maps the runtime URL space to the paths for those
|
35 | * files on the filesystem.
|
36 | *
|
37 | * The keys must be relative paths, like `paper-button/paper-button.html`.
|
38 | * The filesystem paths must be be relative Fs paths from `rootPath` to
|
39 | * the file on disk that corresponds to the runtime URL.
|
40 | */
|
41 | constructor(rootPath: string, packagePath: string, indirectionMap: Map<string, string>, protocol?: string);
|
42 | resolve(firstHref: ResolvedUrl | PackageRelativeUrl, secondHref?: FileRelativeUrl): ResolvedUrl | undefined;
|
43 | private runtimeResolve;
|
44 | relative(to: ResolvedUrl): PackageRelativeUrl;
|
45 | relative(from: ResolvedUrl, to: ResolvedUrl, _kind?: string): FileRelativeUrl;
|
46 | private relativeImpl;
|
47 | }
|