1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | (function (factory) {
|
---|
9 | if (typeof module === "object" && typeof module.exports === "object") {
|
---|
10 | var v = factory(require, exports);
|
---|
11 | if (v !== undefined) module.exports = v;
|
---|
12 | }
|
---|
13 | else if (typeof define === "function" && define.amd) {
|
---|
14 | define("@angular/compiler/src/url_resolver", ["require", "exports"], factory);
|
---|
15 | }
|
---|
16 | })(function (require, exports) {
|
---|
17 | "use strict";
|
---|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
19 | exports.getUrlScheme = exports.UrlResolver = exports.createOfflineCompileUrlResolver = exports.createUrlResolverWithoutPackagePrefix = void 0;
|
---|
20 | /**
|
---|
21 | * Create a {@link UrlResolver} with no package prefix.
|
---|
22 | */
|
---|
23 | function createUrlResolverWithoutPackagePrefix() {
|
---|
24 | return new exports.UrlResolver();
|
---|
25 | }
|
---|
26 | exports.createUrlResolverWithoutPackagePrefix = createUrlResolverWithoutPackagePrefix;
|
---|
27 | function createOfflineCompileUrlResolver() {
|
---|
28 | return new exports.UrlResolver('.');
|
---|
29 | }
|
---|
30 | exports.createOfflineCompileUrlResolver = createOfflineCompileUrlResolver;
|
---|
31 | exports.UrlResolver = /** @class */ (function () {
|
---|
32 | function UrlResolverImpl(_packagePrefix) {
|
---|
33 | if (_packagePrefix === void 0) { _packagePrefix = null; }
|
---|
34 | this._packagePrefix = _packagePrefix;
|
---|
35 | }
|
---|
36 | /**
|
---|
37 | * Resolves the `url` given the `baseUrl`:
|
---|
38 | * - when the `url` is null, the `baseUrl` is returned,
|
---|
39 | * - if `url` is relative ('path/to/here', './path/to/here'), the resolved url is a combination of
|
---|
40 | * `baseUrl` and `url`,
|
---|
41 | * - if `url` is absolute (it has a scheme: 'http://', 'https://' or start with '/'), the `url` is
|
---|
42 | * returned as is (ignoring the `baseUrl`)
|
---|
43 | */
|
---|
44 | UrlResolverImpl.prototype.resolve = function (baseUrl, url) {
|
---|
45 | var resolvedUrl = url;
|
---|
46 | if (baseUrl != null && baseUrl.length > 0) {
|
---|
47 | resolvedUrl = _resolveUrl(baseUrl, resolvedUrl);
|
---|
48 | }
|
---|
49 | var resolvedParts = _split(resolvedUrl);
|
---|
50 | var prefix = this._packagePrefix;
|
---|
51 | if (prefix != null && resolvedParts != null &&
|
---|
52 | resolvedParts[_ComponentIndex.Scheme] == 'package') {
|
---|
53 | var path = resolvedParts[_ComponentIndex.Path];
|
---|
54 | prefix = prefix.replace(/\/+$/, '');
|
---|
55 | path = path.replace(/^\/+/, '');
|
---|
56 | return prefix + "/" + path;
|
---|
57 | }
|
---|
58 | return resolvedUrl;
|
---|
59 | };
|
---|
60 | return UrlResolverImpl;
|
---|
61 | }());
|
---|
62 | /**
|
---|
63 | * Extract the scheme of a URL.
|
---|
64 | */
|
---|
65 | function getUrlScheme(url) {
|
---|
66 | var match = _split(url);
|
---|
67 | return (match && match[_ComponentIndex.Scheme]) || '';
|
---|
68 | }
|
---|
69 | exports.getUrlScheme = getUrlScheme;
|
---|
70 | // The code below is adapted from Traceur:
|
---|
71 | // https://github.com/google/traceur-compiler/blob/9511c1dafa972bf0de1202a8a863bad02f0f95a8/src/runtime/url.js
|
---|
72 | /**
|
---|
73 | * Builds a URI string from already-encoded parts.
|
---|
74 | *
|
---|
75 | * No encoding is performed. Any component may be omitted as either null or
|
---|
76 | * undefined.
|
---|
77 | *
|
---|
78 | * @param opt_scheme The scheme such as 'http'.
|
---|
79 | * @param opt_userInfo The user name before the '@'.
|
---|
80 | * @param opt_domain The domain such as 'www.google.com', already
|
---|
81 | * URI-encoded.
|
---|
82 | * @param opt_port The port number.
|
---|
83 | * @param opt_path The path, already URI-encoded. If it is not
|
---|
84 | * empty, it must begin with a slash.
|
---|
85 | * @param opt_queryData The URI-encoded query data.
|
---|
86 | * @param opt_fragment The URI-encoded fragment identifier.
|
---|
87 | * @return The fully combined URI.
|
---|
88 | */
|
---|
89 | function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) {
|
---|
90 | var out = [];
|
---|
91 | if (opt_scheme != null) {
|
---|
92 | out.push(opt_scheme + ':');
|
---|
93 | }
|
---|
94 | if (opt_domain != null) {
|
---|
95 | out.push('//');
|
---|
96 | if (opt_userInfo != null) {
|
---|
97 | out.push(opt_userInfo + '@');
|
---|
98 | }
|
---|
99 | out.push(opt_domain);
|
---|
100 | if (opt_port != null) {
|
---|
101 | out.push(':' + opt_port);
|
---|
102 | }
|
---|
103 | }
|
---|
104 | if (opt_path != null) {
|
---|
105 | out.push(opt_path);
|
---|
106 | }
|
---|
107 | if (opt_queryData != null) {
|
---|
108 | out.push('?' + opt_queryData);
|
---|
109 | }
|
---|
110 | if (opt_fragment != null) {
|
---|
111 | out.push('#' + opt_fragment);
|
---|
112 | }
|
---|
113 | return out.join('');
|
---|
114 | }
|
---|
115 | /**
|
---|
116 | * A regular expression for breaking a URI into its component parts.
|
---|
117 | *
|
---|
118 | * {@link https://tools.ietf.org/html/rfc3986#appendix-B} says
|
---|
119 | * As the "first-match-wins" algorithm is identical to the "greedy"
|
---|
120 | * disambiguation method used by POSIX regular expressions, it is natural and
|
---|
121 | * commonplace to use a regular expression for parsing the potential five
|
---|
122 | * components of a URI reference.
|
---|
123 | *
|
---|
124 | * The following line is the regular expression for breaking-down a
|
---|
125 | * well-formed URI reference into its components.
|
---|
126 | *
|
---|
127 | * <pre>
|
---|
128 | * ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
|
---|
129 | * 12 3 4 5 6 7 8 9
|
---|
130 | * </pre>
|
---|
131 | *
|
---|
132 | * The numbers in the second line above are only to assist readability; they
|
---|
133 | * indicate the reference points for each subexpression (i.e., each paired
|
---|
134 | * parenthesis). We refer to the value matched for subexpression <n> as $<n>.
|
---|
135 | * For example, matching the above expression to
|
---|
136 | * <pre>
|
---|
137 | * http://www.ics.uci.edu/pub/ietf/uri/#Related
|
---|
138 | * </pre>
|
---|
139 | * results in the following subexpression matches:
|
---|
140 | * <pre>
|
---|
141 | * $1 = http:
|
---|
142 | * $2 = http
|
---|
143 | * $3 = //www.ics.uci.edu
|
---|
144 | * $4 = www.ics.uci.edu
|
---|
145 | * $5 = /pub/ietf/uri/
|
---|
146 | * $6 = <undefined>
|
---|
147 | * $7 = <undefined>
|
---|
148 | * $8 = #Related
|
---|
149 | * $9 = Related
|
---|
150 | * </pre>
|
---|
151 | * where <undefined> indicates that the component is not present, as is the
|
---|
152 | * case for the query component in the above example. Therefore, we can
|
---|
153 | * determine the value of the five components as
|
---|
154 | * <pre>
|
---|
155 | * scheme = $2
|
---|
156 | * authority = $4
|
---|
157 | * path = $5
|
---|
158 | * query = $7
|
---|
159 | * fragment = $9
|
---|
160 | * </pre>
|
---|
161 | *
|
---|
162 | * The regular expression has been modified slightly to expose the
|
---|
163 | * userInfo, domain, and port separately from the authority.
|
---|
164 | * The modified version yields
|
---|
165 | * <pre>
|
---|
166 | * $1 = http scheme
|
---|
167 | * $2 = <undefined> userInfo -\
|
---|
168 | * $3 = www.ics.uci.edu domain | authority
|
---|
169 | * $4 = <undefined> port -/
|
---|
170 | * $5 = /pub/ietf/uri/ path
|
---|
171 | * $6 = <undefined> query without ?
|
---|
172 | * $7 = Related fragment without #
|
---|
173 | * </pre>
|
---|
174 | * @internal
|
---|
175 | */
|
---|
176 | var _splitRe = new RegExp('^' +
|
---|
177 | '(?:' +
|
---|
178 | '([^:/?#.]+)' + // scheme - ignore special characters
|
---|
179 | // used by other URL parts such as :,
|
---|
180 | // ?, /, #, and .
|
---|
181 | ':)?' +
|
---|
182 | '(?://' +
|
---|
183 | '(?:([^/?#]*)@)?' + // userInfo
|
---|
184 | '([\\w\\d\\-\\u0100-\\uffff.%]*)' + // domain - restrict to letters,
|
---|
185 | // digits, dashes, dots, percent
|
---|
186 | // escapes, and unicode characters.
|
---|
187 | '(?::([0-9]+))?' + // port
|
---|
188 | ')?' +
|
---|
189 | '([^?#]+)?' + // path
|
---|
190 | '(?:\\?([^#]*))?' + // query
|
---|
191 | '(?:#(.*))?' + // fragment
|
---|
192 | '$');
|
---|
193 | /**
|
---|
194 | * The index of each URI component in the return value of goog.uri.utils.split.
|
---|
195 | * @enum {number}
|
---|
196 | */
|
---|
197 | var _ComponentIndex;
|
---|
198 | (function (_ComponentIndex) {
|
---|
199 | _ComponentIndex[_ComponentIndex["Scheme"] = 1] = "Scheme";
|
---|
200 | _ComponentIndex[_ComponentIndex["UserInfo"] = 2] = "UserInfo";
|
---|
201 | _ComponentIndex[_ComponentIndex["Domain"] = 3] = "Domain";
|
---|
202 | _ComponentIndex[_ComponentIndex["Port"] = 4] = "Port";
|
---|
203 | _ComponentIndex[_ComponentIndex["Path"] = 5] = "Path";
|
---|
204 | _ComponentIndex[_ComponentIndex["QueryData"] = 6] = "QueryData";
|
---|
205 | _ComponentIndex[_ComponentIndex["Fragment"] = 7] = "Fragment";
|
---|
206 | })(_ComponentIndex || (_ComponentIndex = {}));
|
---|
207 | /**
|
---|
208 | * Splits a URI into its component parts.
|
---|
209 | *
|
---|
210 | * Each component can be accessed via the component indices; for example:
|
---|
211 | * <pre>
|
---|
212 | * goog.uri.utils.split(someStr)[goog.uri.utils.CompontentIndex.QUERY_DATA];
|
---|
213 | * </pre>
|
---|
214 | *
|
---|
215 | * @param uri The URI string to examine.
|
---|
216 | * @return Each component still URI-encoded.
|
---|
217 | * Each component that is present will contain the encoded value, whereas
|
---|
218 | * components that are not present will be undefined or empty, depending
|
---|
219 | * on the browser's regular expression implementation. Never null, since
|
---|
220 | * arbitrary strings may still look like path names.
|
---|
221 | */
|
---|
222 | function _split(uri) {
|
---|
223 | return uri.match(_splitRe);
|
---|
224 | }
|
---|
225 | /**
|
---|
226 | * Removes dot segments in given path component, as described in
|
---|
227 | * RFC 3986, section 5.2.4.
|
---|
228 | *
|
---|
229 | * @param path A non-empty path component.
|
---|
230 | * @return Path component with removed dot segments.
|
---|
231 | */
|
---|
232 | function _removeDotSegments(path) {
|
---|
233 | if (path == '/')
|
---|
234 | return '/';
|
---|
235 | var leadingSlash = path[0] == '/' ? '/' : '';
|
---|
236 | var trailingSlash = path[path.length - 1] === '/' ? '/' : '';
|
---|
237 | var segments = path.split('/');
|
---|
238 | var out = [];
|
---|
239 | var up = 0;
|
---|
240 | for (var pos = 0; pos < segments.length; pos++) {
|
---|
241 | var segment = segments[pos];
|
---|
242 | switch (segment) {
|
---|
243 | case '':
|
---|
244 | case '.':
|
---|
245 | break;
|
---|
246 | case '..':
|
---|
247 | if (out.length > 0) {
|
---|
248 | out.pop();
|
---|
249 | }
|
---|
250 | else {
|
---|
251 | up++;
|
---|
252 | }
|
---|
253 | break;
|
---|
254 | default:
|
---|
255 | out.push(segment);
|
---|
256 | }
|
---|
257 | }
|
---|
258 | if (leadingSlash == '') {
|
---|
259 | while (up-- > 0) {
|
---|
260 | out.unshift('..');
|
---|
261 | }
|
---|
262 | if (out.length === 0)
|
---|
263 | out.push('.');
|
---|
264 | }
|
---|
265 | return leadingSlash + out.join('/') + trailingSlash;
|
---|
266 | }
|
---|
267 | /**
|
---|
268 | * Takes an array of the parts from split and canonicalizes the path part
|
---|
269 | * and then joins all the parts.
|
---|
270 | */
|
---|
271 | function _joinAndCanonicalizePath(parts) {
|
---|
272 | var path = parts[_ComponentIndex.Path];
|
---|
273 | path = path == null ? '' : _removeDotSegments(path);
|
---|
274 | parts[_ComponentIndex.Path] = path;
|
---|
275 | return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);
|
---|
276 | }
|
---|
277 | /**
|
---|
278 | * Resolves a URL.
|
---|
279 | * @param base The URL acting as the base URL.
|
---|
280 | * @param to The URL to resolve.
|
---|
281 | */
|
---|
282 | function _resolveUrl(base, url) {
|
---|
283 | var parts = _split(encodeURI(url));
|
---|
284 | var baseParts = _split(base);
|
---|
285 | if (parts[_ComponentIndex.Scheme] != null) {
|
---|
286 | return _joinAndCanonicalizePath(parts);
|
---|
287 | }
|
---|
288 | else {
|
---|
289 | parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme];
|
---|
290 | }
|
---|
291 | for (var i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) {
|
---|
292 | if (parts[i] == null) {
|
---|
293 | parts[i] = baseParts[i];
|
---|
294 | }
|
---|
295 | }
|
---|
296 | if (parts[_ComponentIndex.Path][0] == '/') {
|
---|
297 | return _joinAndCanonicalizePath(parts);
|
---|
298 | }
|
---|
299 | var path = baseParts[_ComponentIndex.Path];
|
---|
300 | if (path == null)
|
---|
301 | path = '/';
|
---|
302 | var index = path.lastIndexOf('/');
|
---|
303 | path = path.substring(0, index + 1) + parts[_ComponentIndex.Path];
|
---|
304 | parts[_ComponentIndex.Path] = path;
|
---|
305 | return _joinAndCanonicalizePath(parts);
|
---|
306 | }
|
---|
307 | });
|
---|
308 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXJsX3Jlc29sdmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZXIvc3JjL3VybF9yZXNvbHZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7Ozs7Ozs7Ozs7Ozs7SUFFSDs7T0FFRztJQUNILFNBQWdCLHFDQUFxQztRQUNuRCxPQUFPLElBQUksbUJBQVcsRUFBRSxDQUFDO0lBQzNCLENBQUM7SUFGRCxzRkFFQztJQUVELFNBQWdCLCtCQUErQjtRQUM3QyxPQUFPLElBQUksbUJBQVcsQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUM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gJDEgPSBodHRwICAgICAgICAgICAgICBzY2hlbWVcbiAqICAgICQyID0gPHVuZGVmaW5lZD4gICAgICAgdXNlckluZm8gLVxcXG4gKiAgICAkMyA9IHd3dy5pY3MudWNpLmVkdSAgIGRvbWFpbiAgICAgfCBhdXRob3JpdHlcbiAqICAgICQ0ID0gPHVuZGVmaW5lZD4gICAgICAgcG9ydCAgICAgLS9cbiAqICAgICQ1ID0gL3B1Yi9pZXRmL3VyaS8gICAgcGF0aFxuICogICAgJDYgPSA8dW5kZWZpbmVkPiAgICAgICBxdWVyeSB3aXRob3V0ID9cbiAqICAgICQ3ID0gUmVsYXRlZCAgICAgICAgICAgZnJhZ21lbnQgd2l0aG91dCAjXG4gKiA8L3ByZT5cbiAqIEBpbnRlcm5hbFxuICovXG5jb25zdCBfc3BsaXRSZSA9IG5ldyBSZWdFeHAoXG4gICAgJ14nICtcbiAgICAnKD86JyArXG4gICAgJyhbXjovPyMuXSspJyArICAvLyBzY2hlbWUgLSBpZ25vcmUgc3BlY2lhbCBjaGFyYWN0ZXJzXG4gICAgICAgICAgICAgICAgICAgICAvLyB1c2VkIGJ5IG90aGVyIFVSTCBwYXJ0cyBzdWNoIGFzIDosXG4gICAgICAgICAgICAgICAgICAgICAvLyA/LCAvLCAjLCBhbmQgLlxuICAgICc6KT8nICtcbiAgICAnKD86Ly8nICtcbiAgICAnKD86KFteLz8jXSopQCk/JyArICAgICAgICAgICAgICAgICAgLy8gdXNlckluZm9cbiAgICAnKFtcXFxcd1xcXFxkXFxcXC1cXFxcdTAxMDAtXFxcXHVmZmZmLiVdKiknICsgIC8vIGRvbWFpbiAtIHJlc3RyaWN0IHRvIGxldHRlcnMsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGRpZ2l0cywgZGFzaGVzLCBkb3RzLCBwZXJjZW50XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGVzY2FwZXMsIGFuZCB1bmljb2Rl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