UNPKG

2.27 kBTypeScriptView Raw
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/**
15 * These are a set of entirely-compile time types, used to help us manage the
16 * lifecycle of a URL in the system, to ensure that we primarily deal with
17 * canonical urls internally in the project.
18 *
19 * These types should be project-level concerns and should not impact users.
20 */
21/**
22 * A URL that must be resolved relative to a specific base url.
23 *
24 * Note that it might still be an absolute URL, or even a url with a full
25 * protocol and host.
26 *
27 * This is mostly used to type urls extracted from import statements taken
28 * directly out of documents. For example, in `import * as foo from "./foo.js"`
29 * `./foo.js` is relative to the containing document.
30 *
31 * Use UrlResolver#resolve to transform it to a ResolvedUrl.
32 * Use UrlResolver#relative to transform ResolvedUrls to FileRelativeUrls.
33 */
34export declare type FileRelativeUrl = string & FileRelativeUrlBrand;
35/**
36 * A URL that must be resolved relative to the package itself.
37 *
38 * Note it might still be an absolute URL, or even a url with a full protocol
39 * and host.
40 *
41 * This is the assumed format of user input to Analyzer methods.
42 *
43 * Use UrlResolver#resolve to transform it to a ResolvedUrl.
44 */
45export declare type PackageRelativeUrl = string & PackageRelativeUrlBrand;
46/**
47 * A URL that has been resolved to its canonical and loadable form, by passing
48 * through the project's URL Resolver.
49 *
50 * Use AnalysisContext#resolve to get a ResolvedUrl.
51 */
52export declare type ResolvedUrl = string & ResolvedUrlBrand;
53export declare class ResolvedUrlBrand {
54 private ResolvedUrlBrand;
55}
56export declare class PackageRelativeUrlBrand {
57 private PackageRelativeUrlBrand;
58}
59export declare class FileRelativeUrlBrand {
60 private FileRelativeUrlBrand;
61}