UNPKG

1.55 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright (c) 2016 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 */
14import { FileRelativeUrl, PackageRelativeUrl } from '../index';
15import { ResolvedUrl } from '../model/url';
16import { FsUrlResolver } from './fs-url-resolver';
17export interface PackageUrlResolverOptions {
18 packageDir?: string;
19 componentDir?: string;
20 host?: string;
21 protocol?: string;
22}
23/**
24 * Resolves a URL to a canonical URL within a package.
25 */
26export declare class PackageUrlResolver extends FsUrlResolver {
27 readonly componentDir: string;
28 private readonly resolvedComponentDir;
29 constructor(options?: PackageUrlResolverOptions);
30 protected modifyFsPath(path: string): string;
31 relative(to: ResolvedUrl): PackageRelativeUrl;
32 relative(from: ResolvedUrl, to: ResolvedUrl, _kind?: string): FileRelativeUrl;
33 private relativeImpl;
34 /**
35 * If the given URL is a file url inside our dependencies (e.g.
36 * bower_components) then return a resolved posix path to its file.
37 * Otherwise return undefined.
38 */
39 private pathnameForComponentDirUrl;
40}