This commit is contained in:
Stephen Franceschelli 2019-07-30 13:41:05 -04:00
parent 596a6da241
commit c1a589c5b6
7078 changed files with 1882834 additions and 319 deletions

199
node_modules/uri-js/README.md generated vendored Normal file
View file

@ -0,0 +1,199 @@
# URI.js
URI.js is an [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt) compliant, scheme extendable URI parsing/validating/resolving library for all JavaScript environments (browsers, Node.js, etc).
It is also compliant with the IRI ([RFC 3987](http://www.ietf.org/rfc/rfc3987.txt)), IDNA ([RFC 5890](http://www.ietf.org/rfc/rfc5890.txt)), IPv6 Address ([RFC 5952](http://www.ietf.org/rfc/rfc5952.txt)), IPv6 Zone Identifier ([RFC 6874](http://www.ietf.org/rfc/rfc6874.txt)) specifications.
URI.js has an extensive test suite, and works in all (Node.js, web) environments. It weighs in at 6.2kb (gzipped, 16kb deflated).
## API
### Parsing
URI.parse("uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body");
//returns:
//{
// scheme : "uri",
// userinfo : "user:pass",
// host : "example.com",
// port : 123,
// path : "/one/two.three",
// query : "q1=a1&q2=a2",
// fragment : "body"
//}
### Serializing
URI.serialize({scheme : "http", host : "example.com", fragment : "footer"}) === "http://example.com/#footer"
### Resolving
URI.resolve("uri://a/b/c/d?q", "../../g") === "uri://a/g"
### Normalizing
URI.normalize("HTTP://ABC.com:80/%7Esmith/home.html") === "http://abc.com/~smith/home.html"
### Comparison
URI.equal("example://a/b/c/%7Bfoo%7D", "eXAMPLE://a/./b/../b/%63/%7bfoo%7d") === true
### IP Support
//IPv4 normalization
URI.normalize("//192.068.001.000") === "//192.68.1.0"
//IPv6 normalization
URI.normalize("//[2001:0:0DB8::0:0001]") === "//[2001:0:db8::1]"
//IPv6 zone identifier support
URI.parse("//[2001:db8::7%25en1]");
//returns:
//{
// host : "2001:db8::7%en1"
//}
### IRI Support
//convert IRI to URI
URI.serialize(URI.parse("http://examplé.org/rosé")) === "http://xn--exampl-gva.org/ros%C3%A9"
//convert URI to IRI
URI.serialize(URI.parse("http://xn--exampl-gva.org/ros%C3%A9"), {iri:true}) === "http://examplé.org/rosé"
### Options
All of the above functions can accept an additional options argument that is an object that can contain one or more of the following properties:
* `scheme` (string)
Indicates the scheme that the URI should be treated as, overriding the URI's normal scheme parsing behavior.
* `reference` (string)
If set to `"suffix"`, it indicates that the URI is in the suffix format, and the validator will use the option's `scheme` property to determine the URI's scheme.
* `tolerant` (boolean, false)
If set to `true`, the parser will relax URI resolving rules.
* `absolutePath` (boolean, false)
If set to `true`, the serializer will not resolve a relative `path` component.
* `iri` (boolean, false)
If set to `true`, the serializer will unescape non-ASCII characters as per [RFC 3987](http://www.ietf.org/rfc/rfc3987.txt).
* `unicodeSupport` (boolean, false)
If set to `true`, the parser will unescape non-ASCII characters in the parsed output as per [RFC 3987](http://www.ietf.org/rfc/rfc3987.txt).
* `domainHost` (boolean, false)
If set to `true`, the library will treat the `host` component as a domain name, and convert IDNs (International Domain Names) as per [RFC 5891](http://www.ietf.org/rfc/rfc5891.txt).
## Scheme Extendable
URI.js supports inserting custom [scheme](http://en.wikipedia.org/wiki/URI_scheme) dependent processing rules. Currently, URI.js has built in support for the following schemes:
* http \[[RFC 2616](http://www.ietf.org/rfc/rfc2616.txt)\]
* https \[[RFC 2818](http://www.ietf.org/rfc/rfc2818.txt)\]
* mailto \[[RFC 6068](http://www.ietf.org/rfc/rfc6068.txt)\]
* urn \[[RFC 2141](http://www.ietf.org/rfc/rfc2141.txt)\]
* urn:uuid \[[RFC 4122](http://www.ietf.org/rfc/rfc4122.txt)\]
### HTTP Support
URI.equal("HTTP://ABC.COM:80", "http://abc.com/") === true
### Mailto Support
URI.parse("mailto:alpha@example.com,bravo@example.com?subject=SUBSCRIBE&body=Sign%20me%20up!");
//returns:
//{
// scheme : "mailto",
// to : ["alpha@example.com", "bravo@example.com"],
// subject : "SUBSCRIBE",
// body : "Sign me up!"
//}
URI.serialize({
scheme : "mailto",
to : ["alpha@example.com"],
subject : "REMOVE",
body : "Please remove me",
headers : {
cc : "charlie@example.com"
}
}) === "mailto:alpha@example.com?cc=charlie@example.com&subject=REMOVE&body=Please%20remove%20me"
### URN Support
URI.parse("urn:example:foo");
//returns:
//{
// scheme : "urn",
// nid : "example",
// nss : "foo",
//}
#### URN UUID Support
URI.parse("urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6");
//returns:
//{
// scheme : "urn",
// nid : "example",
// uuid : "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
//}
## Usage
To load in a browser, use the following tag:
<script type="text/javascript" src="uri-js/dist/es5/uri.all.min.js"></script>
To load in a CommonJS (Node.js) environment, first install with npm by running on the command line:
npm install uri-js
Then, in your code, load it using:
const URI = require("uri-js");
If you are writing your code in ES6+ (ESNEXT) or TypeScript, you would load it using:
import * as URI from "uri-js";
Or you can load just what you need using named exports:
import { parse, serialize, resolve, resolveComponents, normalize, equal, removeDotSegments, pctEncChar, pctDecChars, escapeComponent, unescapeComponent } from "uri-js";
## Breaking changes
### Breaking changes from 3.x
URN parsing has been completely changed to better align with the specification. Scheme is now always `urn`, but has two new properties: `nid` which contains the Namspace Identifier, and `nss` which contains the Namespace Specific String. The `nss` property will be removed by higher order scheme handlers, such as the UUID URN scheme handler.
The UUID of a URN can now be found in the `uuid` property.
### Breaking changes from 2.x
URI validation has been removed as it was slow, exposed a vulnerabilty, and was generally not useful.
### Breaking changes from 1.x
The `errors` array on parsed components is now an `error` string.
## License ([Simplified BSD](http://en.wikipedia.org/wiki/BSD_licenses#2-clause))
Copyright 2011 Gary Court. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY GARY COURT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Gary Court.

47
node_modules/uri-js/bower.json generated vendored Normal file
View file

@ -0,0 +1,47 @@
{
"name": "uri-js",
"description": "An RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.",
"main": "dist/es5/uri.all.js",
"moduleType": [
"globals",
"amd",
"node",
"es6"
],
"authors": [
"Gary Court <gary.court@gmail.com>"
],
"license": "BSD-2-Clause",
"keywords": [
"URI",
"IRI",
"IDN",
"URN",
"HTTP",
"HTTPS",
"MAILTO",
"RFC3986",
"RFC3987",
"RFC5891",
"RFC2616",
"RFC2818",
"RFC2141",
"RFC4122",
"RFC6068"
],
"homepage": "https://github.com/garycourt/uri-js",
"repository": {
"type": "git",
"url": "http://github.com/garycourt/uri-js"
},
"dependencies": {
"punycode": "^2.1.0"
},
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}

59
node_modules/uri-js/dist/es5/uri.all.d.ts generated vendored Normal file
View file

@ -0,0 +1,59 @@
export interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
}
export interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
}
export interface URISchemeHandler<Components extends URIComponents = URIComponents, Options extends URIOptions = URIOptions, ParentComponents extends URIComponents = URIComponents> {
scheme: string;
parse(components: ParentComponents, options: Options): Components;
serialize(components: Components, options: Options): ParentComponents;
unicodeSupport?: boolean;
domainHost?: boolean;
absolutePath?: boolean;
}
export interface URIRegExps {
NOT_SCHEME: RegExp;
NOT_USERINFO: RegExp;
NOT_HOST: RegExp;
NOT_PATH: RegExp;
NOT_PATH_NOSCHEME: RegExp;
NOT_QUERY: RegExp;
NOT_FRAGMENT: RegExp;
ESCAPE: RegExp;
UNRESERVED: RegExp;
OTHER_CHARS: RegExp;
PCT_ENCODED: RegExp;
IPV4ADDRESS: RegExp;
IPV6ADDRESS: RegExp;
}
export declare const SCHEMES: {
[scheme: string]: URISchemeHandler;
};
export declare function pctEncChar(chr: string): string;
export declare function pctDecChars(str: string): string;
export declare function parse(uriString: string, options?: URIOptions): URIComponents;
export declare function removeDotSegments(input: string): string;
export declare function serialize(components: URIComponents, options?: URIOptions): string;
export declare function resolveComponents(base: URIComponents, relative: URIComponents, options?: URIOptions, skipNormalization?: boolean): URIComponents;
export declare function resolve(baseURI: string, relativeURI: string, options?: URIOptions): string;
export declare function normalize(uri: string, options?: URIOptions): string;
export declare function normalize(uri: URIComponents, options?: URIOptions): URIComponents;
export declare function equal(uriA: string, uriB: string, options?: URIOptions): boolean;
export declare function equal(uriA: URIComponents, uriB: URIComponents, options?: URIOptions): boolean;
export declare function escapeComponent(str: string, options?: URIOptions): string;
export declare function unescapeComponent(str: string, options?: URIOptions): string;

1389
node_modules/uri-js/dist/es5/uri.all.js generated vendored Normal file

File diff suppressed because it is too large Load diff

1
node_modules/uri-js/dist/es5/uri.all.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

59
node_modules/uri-js/dist/es5/uri.all.min.d.ts generated vendored Normal file
View file

@ -0,0 +1,59 @@
export interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
}
export interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
}
export interface URISchemeHandler<Components extends URIComponents = URIComponents, Options extends URIOptions = URIOptions, ParentComponents extends URIComponents = URIComponents> {
scheme: string;
parse(components: ParentComponents, options: Options): Components;
serialize(components: Components, options: Options): ParentComponents;
unicodeSupport?: boolean;
domainHost?: boolean;
absolutePath?: boolean;
}
export interface URIRegExps {
NOT_SCHEME: RegExp;
NOT_USERINFO: RegExp;
NOT_HOST: RegExp;
NOT_PATH: RegExp;
NOT_PATH_NOSCHEME: RegExp;
NOT_QUERY: RegExp;
NOT_FRAGMENT: RegExp;
ESCAPE: RegExp;
UNRESERVED: RegExp;
OTHER_CHARS: RegExp;
PCT_ENCODED: RegExp;
IPV4ADDRESS: RegExp;
IPV6ADDRESS: RegExp;
}
export declare const SCHEMES: {
[scheme: string]: URISchemeHandler;
};
export declare function pctEncChar(chr: string): string;
export declare function pctDecChars(str: string): string;
export declare function parse(uriString: string, options?: URIOptions): URIComponents;
export declare function removeDotSegments(input: string): string;
export declare function serialize(components: URIComponents, options?: URIOptions): string;
export declare function resolveComponents(base: URIComponents, relative: URIComponents, options?: URIOptions, skipNormalization?: boolean): URIComponents;
export declare function resolve(baseURI: string, relativeURI: string, options?: URIOptions): string;
export declare function normalize(uri: string, options?: URIOptions): string;
export declare function normalize(uri: URIComponents, options?: URIOptions): URIComponents;
export declare function equal(uriA: string, uriB: string, options?: URIOptions): boolean;
export declare function equal(uriA: URIComponents, uriB: URIComponents, options?: URIOptions): boolean;
export declare function escapeComponent(str: string, options?: URIOptions): string;
export declare function unescapeComponent(str: string, options?: URIOptions): string;

3
node_modules/uri-js/dist/es5/uri.all.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/uri-js/dist/es5/uri.all.min.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/uri-js/dist/esnext/index.d.ts generated vendored Normal file
View file

@ -0,0 +1 @@
export * from "./uri";

13
node_modules/uri-js/dist/esnext/index.js generated vendored Normal file
View file

@ -0,0 +1,13 @@
import { SCHEMES } from "./uri";
import http from "./schemes/http";
SCHEMES[http.scheme] = http;
import https from "./schemes/https";
SCHEMES[https.scheme] = https;
import mailto from "./schemes/mailto";
SCHEMES[mailto.scheme] = mailto;
import urn from "./schemes/urn";
SCHEMES[urn.scheme] = urn;
import uuid from "./schemes/urn-uuid";
SCHEMES[uuid.scheme] = uuid;
export * from "./uri";
//# sourceMappingURL=index.js.map

1
node_modules/uri-js/dist/esnext/index.js.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAE5B,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;AAE9B,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAEhC,OAAO,GAAG,MAAM,eAAe,CAAC;AAChC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;AAE1B,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAE5B,cAAc,OAAO,CAAC"}

3
node_modules/uri-js/dist/esnext/regexps-iri.d.ts generated vendored Normal file
View file

@ -0,0 +1,3 @@
import { URIRegExps } from "./uri";
declare const _default: URIRegExps;
export default _default;

3
node_modules/uri-js/dist/esnext/regexps-iri.js generated vendored Normal file
View file

@ -0,0 +1,3 @@
import { buildExps } from "./regexps-uri";
export default buildExps(true);
//# sourceMappingURL=regexps-iri.js.map

1
node_modules/uri-js/dist/esnext/regexps-iri.js.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"regexps-iri.js","sourceRoot":"","sources":["../../src/regexps-iri.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,eAAe,SAAS,CAAC,IAAI,CAAC,CAAC"}

4
node_modules/uri-js/dist/esnext/regexps-uri.d.ts generated vendored Normal file
View file

@ -0,0 +1,4 @@
import { URIRegExps } from "./uri";
export declare function buildExps(isIRI: boolean): URIRegExps;
declare const _default: URIRegExps;
export default _default;

42
node_modules/uri-js/dist/esnext/regexps-uri.js generated vendored Normal file
View file

@ -0,0 +1,42 @@
import { merge, subexp } from "./util";
export function buildExps(isIRI) {
const ALPHA$$ = "[A-Za-z]", CR$ = "[\\x0D]", DIGIT$$ = "[0-9]", DQUOTE$$ = "[\\x22]", HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"), //case-insensitive
LF$$ = "[\\x0A]", SP$$ = "[\\x20]", PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)), //expanded
GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]", SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$), UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", //subset, excludes bidi control characters
IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]", //subset
UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$), SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"), USERINFO$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*"), DEC_OCTET$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("[1-9]" + DIGIT$$) + "|" + DIGIT$$), DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$), //relaxed parsing rules
IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$), H16$ = subexp(HEXDIG$$ + "{1,4}"), LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$), IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$), // 6( h16 ":" ) ls32
IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$), // "::" 5( h16 ":" ) ls32
IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$), //[ h16 ] "::" 4( h16 ":" ) ls32
IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$), //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$), //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$), //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$), //[ *4( h16 ":" ) h16 ] "::" ls32
IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$), //[ *5( h16 ":" ) h16 ] "::" h16
IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"), //[ *6( h16 ":" ) h16 ] "::"
IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")), ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+"), //RFC 6874
IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + "\\%25" + ZONEID$), //RFC 6874
IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + ZONEID$), //RFC 6874, with relaxed parsing rules
IPVFUTURE$ = subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+"), IP_LITERAL$ = subexp("\\[" + subexp(IPV6ADDRZ_RELAXED$ + "|" + IPV6ADDRESS$ + "|" + IPVFUTURE$) + "\\]"), //RFC 6874
REG_NAME$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*"), HOST$ = subexp(IP_LITERAL$ + "|" + IPV4ADDRESS$ + "(?!" + REG_NAME$ + ")" + "|" + REG_NAME$), PORT$ = subexp(DIGIT$$ + "*"), AUTHORITY$ = subexp(subexp(USERINFO$ + "@") + "?" + HOST$ + subexp("\\:" + PORT$) + "?"), PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]")), SEGMENT$ = subexp(PCHAR$ + "*"), SEGMENT_NZ$ = subexp(PCHAR$ + "+"), SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+"), PATH_ABEMPTY$ = subexp(subexp("\\/" + SEGMENT$) + "*"), PATH_ABSOLUTE$ = subexp("\\/" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + "?"), //simplified
PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$), //simplified
PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$), //simplified
PATH_EMPTY$ = "(?!" + PCHAR$ + ")", PATH$ = subexp(PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), QUERY$ = subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"), FRAGMENT$ = subexp(subexp(PCHAR$ + "|[\\/\\?]") + "*"), HIER_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$), URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), RELATIVE_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$), RELATIVE$ = subexp(RELATIVE_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"), URI_REFERENCE$ = subexp(URI$ + "|" + RELATIVE$), ABSOLUTE_URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?"), GENERIC_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", RELATIVE_REF$ = "^(){0}" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", ABSOLUTE_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?$", SAMEDOC_REF$ = "^" + subexp("\\#(" + FRAGMENT$ + ")") + "?$", AUTHORITY_REF$ = "^" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?$";
return {
NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
UNRESERVED: new RegExp(UNRESERVED$$, "g"),
OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
};
}
export default buildExps(false);
//# sourceMappingURL=regexps-uri.js.map

1
node_modules/uri-js/dist/esnext/regexps-uri.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

3
node_modules/uri-js/dist/esnext/schemes/http.d.ts generated vendored Normal file
View file

@ -0,0 +1,3 @@
import { URISchemeHandler } from "../uri";
declare const handler: URISchemeHandler;
export default handler;

27
node_modules/uri-js/dist/esnext/schemes/http.js generated vendored Normal file
View file

@ -0,0 +1,27 @@
const handler = {
scheme: "http",
domainHost: true,
parse: function (components, options) {
//report missing host
if (!components.host) {
components.error = components.error || "HTTP URIs must have a host.";
}
return components;
},
serialize: function (components, options) {
//normalize the default port
if (components.port === (String(components.scheme).toLowerCase() !== "https" ? 80 : 443) || components.port === "") {
components.port = undefined;
}
//normalize the empty path
if (!components.path) {
components.path = "/";
}
//NOTE: We do not parse query strings for HTTP URIs
//as WWW Form Url Encoded query strings are part of the HTML4+ spec,
//and not the HTTP spec.
return components;
}
};
export default handler;
//# sourceMappingURL=http.js.map

1
node_modules/uri-js/dist/esnext/schemes/http.js.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/schemes/http.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAoB;IAChC,MAAM,EAAG,MAAM;IAEf,UAAU,EAAG,IAAI;IAEjB,KAAK,EAAG,UAAU,UAAwB,EAAE,OAAkB;QAC7D,qBAAqB;QACrB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACrB,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,6BAA6B,CAAC;SACrE;QAED,OAAO,UAAU,CAAC;IACnB,CAAC;IAED,SAAS,EAAG,UAAU,UAAwB,EAAE,OAAkB;QACjE,4BAA4B;QAC5B,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,IAAI,KAAK,EAAE,EAAE;YACnH,UAAU,CAAC,IAAI,GAAG,SAAS,CAAC;SAC5B;QAED,0BAA0B;QAC1B,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACrB,UAAU,CAAC,IAAI,GAAG,GAAG,CAAC;SACtB;QAED,mDAAmD;QACnD,oEAAoE;QACpE,wBAAwB;QAExB,OAAO,UAAU,CAAC;IACnB,CAAC;CACD,CAAC;AAEF,eAAe,OAAO,CAAC"}

3
node_modules/uri-js/dist/esnext/schemes/https.d.ts generated vendored Normal file
View file

@ -0,0 +1,3 @@
import { URISchemeHandler } from "../uri";
declare const handler: URISchemeHandler;
export default handler;

9
node_modules/uri-js/dist/esnext/schemes/https.js generated vendored Normal file
View file

@ -0,0 +1,9 @@
import http from "./http";
const handler = {
scheme: "https",
domainHost: http.domainHost,
parse: http.parse,
serialize: http.serialize
};
export default handler;
//# sourceMappingURL=https.js.map

1
node_modules/uri-js/dist/esnext/schemes/https.js.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"https.js","sourceRoot":"","sources":["../../../src/schemes/https.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,MAAM,OAAO,GAAoB;IAChC,MAAM,EAAG,OAAO;IAChB,UAAU,EAAG,IAAI,CAAC,UAAU;IAC5B,KAAK,EAAG,IAAI,CAAC,KAAK;IAClB,SAAS,EAAG,IAAI,CAAC,SAAS;CAC1B,CAAA;AAED,eAAe,OAAO,CAAC"}

12
node_modules/uri-js/dist/esnext/schemes/mailto.d.ts generated vendored Normal file
View file

@ -0,0 +1,12 @@
import { URISchemeHandler, URIComponents } from "../uri";
export interface MailtoHeaders {
[hfname: string]: string;
}
export interface MailtoComponents extends URIComponents {
to: Array<string>;
headers?: MailtoHeaders;
subject?: string;
body?: string;
}
declare const handler: URISchemeHandler<MailtoComponents>;
export default handler;

148
node_modules/uri-js/dist/esnext/schemes/mailto.js generated vendored Normal file
View file

@ -0,0 +1,148 @@
import { pctEncChar, pctDecChars, unescapeComponent } from "../uri";
import punycode from "punycode";
import { merge, subexp, toUpperCase, toArray } from "../util";
const O = {};
const isIRI = true;
//RFC 3986
const UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + (isIRI ? "\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" : "") + "]";
const HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
const PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
//const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
//const WSP$$ = "[\\x20\\x09]";
//const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
//const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
//const VCHAR$$ = "[\\x21-\\x7E]";
//const WSP$$ = "[\\x20\\x09]";
//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
const ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
const QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
const VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
const DOT_ATOM_TEXT$ = subexp(ATEXT$$ + "+" + subexp("\\." + ATEXT$$ + "+") + "*");
const QUOTED_PAIR$ = subexp("\\\\" + VCHAR$$);
const QCONTENT$ = subexp(QTEXT$$ + "|" + QUOTED_PAIR$);
const QUOTED_STRING$ = subexp('\\"' + QCONTENT$ + "*" + '\\"');
//RFC 6068
const DTEXT_NO_OBS$$ = "[\\x21-\\x5A\\x5E-\\x7E]"; //%d33-90 / %d94-126
const SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
const QCHAR$ = subexp(UNRESERVED$$ + "|" + PCT_ENCODED$ + "|" + SOME_DELIMS$$);
const DOMAIN$ = subexp(DOT_ATOM_TEXT$ + "|" + "\\[" + DTEXT_NO_OBS$$ + "*" + "\\]");
const LOCAL_PART$ = subexp(DOT_ATOM_TEXT$ + "|" + QUOTED_STRING$);
const ADDR_SPEC$ = subexp(LOCAL_PART$ + "\\@" + DOMAIN$);
const TO$ = subexp(ADDR_SPEC$ + subexp("\\," + ADDR_SPEC$) + "*");
const HFNAME$ = subexp(QCHAR$ + "*");
const HFVALUE$ = HFNAME$;
const HFIELD$ = subexp(HFNAME$ + "\\=" + HFVALUE$);
const HFIELDS2$ = subexp(HFIELD$ + subexp("\\&" + HFIELD$) + "*");
const HFIELDS$ = subexp("\\?" + HFIELDS2$);
const MAILTO_URI = new RegExp("^mailto\\:" + TO$ + "?" + HFIELDS$ + "?$");
const UNRESERVED = new RegExp(UNRESERVED$$, "g");
const PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
const NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
const NOT_DOMAIN = new RegExp(merge("[^]", ATEXT$$, "[\\.]", "[\\[]", DTEXT_NO_OBS$$, "[\\]]"), "g");
const NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
const NOT_HFVALUE = NOT_HFNAME;
const TO = new RegExp("^" + TO$ + "$");
const HFIELDS = new RegExp("^" + HFIELDS2$ + "$");
function decodeUnreserved(str) {
const decStr = pctDecChars(str);
return (!decStr.match(UNRESERVED) ? str : decStr);
}
const handler = {
scheme: "mailto",
parse: function (components, options) {
const mailtoComponents = components;
const to = mailtoComponents.to = (mailtoComponents.path ? mailtoComponents.path.split(",") : []);
mailtoComponents.path = undefined;
if (mailtoComponents.query) {
let unknownHeaders = false;
const headers = {};
const hfields = mailtoComponents.query.split("&");
for (let x = 0, xl = hfields.length; x < xl; ++x) {
const hfield = hfields[x].split("=");
switch (hfield[0]) {
case "to":
const toAddrs = hfield[1].split(",");
for (let x = 0, xl = toAddrs.length; x < xl; ++x) {
to.push(toAddrs[x]);
}
break;
case "subject":
mailtoComponents.subject = unescapeComponent(hfield[1], options);
break;
case "body":
mailtoComponents.body = unescapeComponent(hfield[1], options);
break;
default:
unknownHeaders = true;
headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
break;
}
}
if (unknownHeaders)
mailtoComponents.headers = headers;
}
mailtoComponents.query = undefined;
for (let x = 0, xl = to.length; x < xl; ++x) {
const addr = to[x].split("@");
addr[0] = unescapeComponent(addr[0]);
if (!options.unicodeSupport) {
//convert Unicode IDN -> ASCII IDN
try {
addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
}
catch (e) {
mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
}
}
else {
addr[1] = unescapeComponent(addr[1], options).toLowerCase();
}
to[x] = addr.join("@");
}
return mailtoComponents;
},
serialize: function (mailtoComponents, options) {
const components = mailtoComponents;
const to = toArray(mailtoComponents.to);
if (to) {
for (let x = 0, xl = to.length; x < xl; ++x) {
const toAddr = String(to[x]);
const atIdx = toAddr.lastIndexOf("@");
const localPart = (toAddr.slice(0, atIdx)).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
let domain = toAddr.slice(atIdx + 1);
//convert IDN via punycode
try {
domain = (!options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain));
}
catch (e) {
components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
}
to[x] = localPart + "@" + domain;
}
components.path = to.join(",");
}
const headers = mailtoComponents.headers = mailtoComponents.headers || {};
if (mailtoComponents.subject)
headers["subject"] = mailtoComponents.subject;
if (mailtoComponents.body)
headers["body"] = mailtoComponents.body;
const fields = [];
for (const name in headers) {
if (headers[name] !== O[name]) {
fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) +
"=" +
headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar));
}
}
if (fields.length) {
components.query = fields.join("&");
}
return components;
}
};
export default handler;
//# sourceMappingURL=mailto.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,7 @@
import { URISchemeHandler, URIOptions } from "../uri";
import { URNComponents } from "./urn";
export interface UUIDComponents extends URNComponents {
uuid?: string;
}
declare const handler: URISchemeHandler<UUIDComponents, URIOptions, URNComponents>;
export default handler;

23
node_modules/uri-js/dist/esnext/schemes/urn-uuid.js generated vendored Normal file
View file

@ -0,0 +1,23 @@
const UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
const UUID_PARSE = /^[0-9A-Fa-f\-]{36}/;
//RFC 4122
const handler = {
scheme: "urn:uuid",
parse: function (urnComponents, options) {
const uuidComponents = urnComponents;
uuidComponents.uuid = uuidComponents.nss;
uuidComponents.nss = undefined;
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
uuidComponents.error = uuidComponents.error || "UUID is not valid.";
}
return uuidComponents;
},
serialize: function (uuidComponents, options) {
const urnComponents = uuidComponents;
//normalize UUID
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
return urnComponents;
},
};
export default handler;
//# sourceMappingURL=urn-uuid.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"urn-uuid.js","sourceRoot":"","sources":["../../../src/schemes/urn-uuid.ts"],"names":[],"mappings":"AAQA,MAAM,IAAI,GAAG,0DAA0D,CAAC;AACxE,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAExC,UAAU;AACV,MAAM,OAAO,GAA+D;IAC3E,MAAM,EAAG,UAAU;IAEnB,KAAK,EAAG,UAAU,aAA2B,EAAE,OAAkB;QAChE,MAAM,cAAc,GAAG,aAA+B,CAAC;QACvD,cAAc,CAAC,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC;QACzC,cAAc,CAAC,GAAG,GAAG,SAAS,CAAC;QAE/B,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE;YACpF,cAAc,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,IAAI,oBAAoB,CAAC;SACpE;QAED,OAAO,cAAc,CAAC;IACvB,CAAC;IAED,SAAS,EAAG,UAAU,cAA6B,EAAE,OAAkB;QACtE,MAAM,aAAa,GAAG,cAA+B,CAAC;QACtD,gBAAgB;QAChB,aAAa,CAAC,GAAG,GAAG,CAAC,cAAc,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QAC9D,OAAO,aAAa,CAAC;IACtB,CAAC;CACD,CAAC;AAEF,eAAe,OAAO,CAAC"}

10
node_modules/uri-js/dist/esnext/schemes/urn.d.ts generated vendored Normal file
View file

@ -0,0 +1,10 @@
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
export interface URNComponents extends URIComponents {
nid?: string;
nss?: string;
}
export interface URNOptions extends URIOptions {
nid?: string;
}
declare const handler: URISchemeHandler<URNComponents, URNOptions>;
export default handler;

49
node_modules/uri-js/dist/esnext/schemes/urn.js generated vendored Normal file
View file

@ -0,0 +1,49 @@
import { SCHEMES } from "../uri";
const NID$ = "(?:[0-9A-Za-z][0-9A-Za-z\\-]{1,31})";
const PCT_ENCODED$ = "(?:\\%[0-9A-Fa-f]{2})";
const TRANS$$ = "[0-9A-Za-z\\(\\)\\+\\,\\-\\.\\:\\=\\@\\;\\$\\_\\!\\*\\'\\/\\?\\#]";
const NSS$ = "(?:(?:" + PCT_ENCODED$ + "|" + TRANS$$ + ")+)";
const URN_SCHEME = new RegExp("^urn\\:(" + NID$ + ")$");
const URN_PATH = new RegExp("^(" + NID$ + ")\\:(" + NSS$ + ")$");
const URN_PARSE = /^([^\:]+)\:(.*)/;
const URN_EXCLUDED = /[\x00-\x20\\\"\&\<\>\[\]\^\`\{\|\}\~\x7F-\xFF]/g;
//RFC 2141
const handler = {
scheme: "urn",
parse: function (components, options) {
const matches = components.path && components.path.match(URN_PARSE);
let urnComponents = components;
if (matches) {
const scheme = options.scheme || urnComponents.scheme || "urn";
const nid = matches[1].toLowerCase();
const nss = matches[2];
const urnScheme = `${scheme}:${options.nid || nid}`;
const schemeHandler = SCHEMES[urnScheme];
urnComponents.nid = nid;
urnComponents.nss = nss;
urnComponents.path = undefined;
if (schemeHandler) {
urnComponents = schemeHandler.parse(urnComponents, options);
}
}
else {
urnComponents.error = urnComponents.error || "URN can not be parsed.";
}
return urnComponents;
},
serialize: function (urnComponents, options) {
const scheme = options.scheme || urnComponents.scheme || "urn";
const nid = urnComponents.nid;
const urnScheme = `${scheme}:${options.nid || nid}`;
const schemeHandler = SCHEMES[urnScheme];
if (schemeHandler) {
urnComponents = schemeHandler.serialize(urnComponents, options);
}
const uriComponents = urnComponents;
const nss = urnComponents.nss;
uriComponents.path = `${nid || options.nid}:${nss}`;
return uriComponents;
},
};
export default handler;
//# sourceMappingURL=urn.js.map

1
node_modules/uri-js/dist/esnext/schemes/urn.js.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"urn.js","sourceRoot":"","sources":["../../../src/schemes/urn.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,OAAO,EAAE,MAAM,QAAQ,CAAC;AAW7C,MAAM,IAAI,GAAG,qCAAqC,CAAC;AACnD,MAAM,YAAY,GAAG,uBAAuB,CAAC;AAC7C,MAAM,OAAO,GAAG,mEAAmE,CAAC;AACpF,MAAM,IAAI,GAAG,QAAQ,GAAG,YAAY,GAAG,GAAG,GAAG,OAAO,GAAG,KAAK,CAAC;AAC7D,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AACxD,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AACjE,MAAM,SAAS,GAAG,iBAAiB,CAAC;AACpC,MAAM,YAAY,GAAG,iDAAiD,CAAC;AAEvE,UAAU;AACV,MAAM,OAAO,GAA8C;IAC1D,MAAM,EAAG,KAAK;IAEd,KAAK,EAAG,UAAU,UAAwB,EAAE,OAAkB;QAC7D,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACpE,IAAI,aAAa,GAAG,UAA2B,CAAC;QAEhD,IAAI,OAAO,EAAE;YACZ,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,IAAI,KAAK,CAAC;YAC/D,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YACrC,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YACvB,MAAM,SAAS,GAAG,GAAG,MAAM,IAAI,OAAO,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;YACpD,MAAM,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;YAEzC,aAAa,CAAC,GAAG,GAAG,GAAG,CAAC;YACxB,aAAa,CAAC,GAAG,GAAG,GAAG,CAAC;YACxB,aAAa,CAAC,IAAI,GAAG,SAAS,CAAC;YAE/B,IAAI,aAAa,EAAE;gBAClB,aAAa,GAAG,aAAa,CAAC,KAAK,CAAC,aAAa,EAAE,OAAO,CAAkB,CAAC;aAC7E;SACD;aAAM;YACN,aAAa,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,IAAI,wBAAwB,CAAC;SACtE;QAED,OAAO,aAAa,CAAC;IACtB,CAAC;IAED,SAAS,EAAG,UAAU,aAA2B,EAAE,OAAkB;QACpE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,IAAI,KAAK,CAAC;QAC/D,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC;QAC9B,MAAM,SAAS,GAAG,GAAG,MAAM,IAAI,OAAO,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;QACpD,MAAM,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAEzC,IAAI,aAAa,EAAE;YAClB,aAAa,GAAG,aAAa,CAAC,SAAS,CAAC,aAAa,EAAE,OAAO,CAAkB,CAAC;SACjF;QAED,MAAM,aAAa,GAAG,aAA8B,CAAC;QACrD,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC;QAC9B,aAAa,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,OAAO,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;QAEpD,OAAO,aAAa,CAAC;IACtB,CAAC;CACD,CAAC;AAEF,eAAe,OAAO,CAAC"}

59
node_modules/uri-js/dist/esnext/uri.d.ts generated vendored Normal file
View file

@ -0,0 +1,59 @@
export interface URIComponents {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
}
export interface URIOptions {
scheme?: string;
reference?: string;
tolerant?: boolean;
absolutePath?: boolean;
iri?: boolean;
unicodeSupport?: boolean;
domainHost?: boolean;
}
export interface URISchemeHandler<Components extends URIComponents = URIComponents, Options extends URIOptions = URIOptions, ParentComponents extends URIComponents = URIComponents> {
scheme: string;
parse(components: ParentComponents, options: Options): Components;
serialize(components: Components, options: Options): ParentComponents;
unicodeSupport?: boolean;
domainHost?: boolean;
absolutePath?: boolean;
}
export interface URIRegExps {
NOT_SCHEME: RegExp;
NOT_USERINFO: RegExp;
NOT_HOST: RegExp;
NOT_PATH: RegExp;
NOT_PATH_NOSCHEME: RegExp;
NOT_QUERY: RegExp;
NOT_FRAGMENT: RegExp;
ESCAPE: RegExp;
UNRESERVED: RegExp;
OTHER_CHARS: RegExp;
PCT_ENCODED: RegExp;
IPV4ADDRESS: RegExp;
IPV6ADDRESS: RegExp;
}
export declare const SCHEMES: {
[scheme: string]: URISchemeHandler;
};
export declare function pctEncChar(chr: string): string;
export declare function pctDecChars(str: string): string;
export declare function parse(uriString: string, options?: URIOptions): URIComponents;
export declare function removeDotSegments(input: string): string;
export declare function serialize(components: URIComponents, options?: URIOptions): string;
export declare function resolveComponents(base: URIComponents, relative: URIComponents, options?: URIOptions, skipNormalization?: boolean): URIComponents;
export declare function resolve(baseURI: string, relativeURI: string, options?: URIOptions): string;
export declare function normalize(uri: string, options?: URIOptions): string;
export declare function normalize(uri: URIComponents, options?: URIOptions): URIComponents;
export declare function equal(uriA: string, uriB: string, options?: URIOptions): boolean;
export declare function equal(uriA: URIComponents, uriB: URIComponents, options?: URIOptions): boolean;
export declare function escapeComponent(str: string, options?: URIOptions): string;
export declare function unescapeComponent(str: string, options?: URIOptions): string;

480
node_modules/uri-js/dist/esnext/uri.js generated vendored Normal file
View file

@ -0,0 +1,480 @@
/**
* URI.js
*
* @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
* @see http://github.com/garycourt/uri-js
*/
/**
* Copyright 2011 Gary Court. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of Gary Court.
*/
import URI_PROTOCOL from "./regexps-uri";
import IRI_PROTOCOL from "./regexps-iri";
import punycode from "punycode";
import { toUpperCase, typeOf, assign } from "./util";
export const SCHEMES = {};
export function pctEncChar(chr) {
const c = chr.charCodeAt(0);
let e;
if (c < 16)
e = "%0" + c.toString(16).toUpperCase();
else if (c < 128)
e = "%" + c.toString(16).toUpperCase();
else if (c < 2048)
e = "%" + ((c >> 6) | 192).toString(16).toUpperCase() + "%" + ((c & 63) | 128).toString(16).toUpperCase();
else
e = "%" + ((c >> 12) | 224).toString(16).toUpperCase() + "%" + (((c >> 6) & 63) | 128).toString(16).toUpperCase() + "%" + ((c & 63) | 128).toString(16).toUpperCase();
return e;
}
export function pctDecChars(str) {
let newStr = "";
let i = 0;
const il = str.length;
while (i < il) {
const c = parseInt(str.substr(i + 1, 2), 16);
if (c < 128) {
newStr += String.fromCharCode(c);
i += 3;
}
else if (c >= 194 && c < 224) {
if ((il - i) >= 6) {
const c2 = parseInt(str.substr(i + 4, 2), 16);
newStr += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
}
else {
newStr += str.substr(i, 6);
}
i += 6;
}
else if (c >= 224) {
if ((il - i) >= 9) {
const c2 = parseInt(str.substr(i + 4, 2), 16);
const c3 = parseInt(str.substr(i + 7, 2), 16);
newStr += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
}
else {
newStr += str.substr(i, 9);
}
i += 9;
}
else {
newStr += str.substr(i, 3);
i += 3;
}
}
return newStr;
}
function _normalizeComponentEncoding(components, protocol) {
function decodeUnreserved(str) {
const decStr = pctDecChars(str);
return (!decStr.match(protocol.UNRESERVED) ? str : decStr);
}
if (components.scheme)
components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
if (components.userinfo !== undefined)
components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
if (components.host !== undefined)
components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
if (components.path !== undefined)
components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace((components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME), pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
if (components.query !== undefined)
components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
if (components.fragment !== undefined)
components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
return components;
}
;
function _stripLeadingZeros(str) {
return str.replace(/^0*(.*)/, "$1") || "0";
}
function _normalizeIPv4(host, protocol) {
const matches = host.match(protocol.IPV4ADDRESS) || [];
const [, address] = matches;
if (address) {
return address.split(".").map(_stripLeadingZeros).join(".");
}
else {
return host;
}
}
function _normalizeIPv6(host, protocol) {
const matches = host.match(protocol.IPV6ADDRESS) || [];
const [, address, zone] = matches;
if (address) {
const [last, first] = address.toLowerCase().split('::').reverse();
const firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
const lastFields = last.split(":").map(_stripLeadingZeros);
const isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
const fieldCount = isLastFieldIPv4Address ? 7 : 8;
const lastFieldsStart = lastFields.length - fieldCount;
const fields = Array(fieldCount);
for (let x = 0; x < fieldCount; ++x) {
fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
}
if (isLastFieldIPv4Address) {
fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
}
const allZeroFields = fields.reduce((acc, field, index) => {
if (!field || field === "0") {
const lastLongest = acc[acc.length - 1];
if (lastLongest && lastLongest.index + lastLongest.length === index) {
lastLongest.length++;
}
else {
acc.push({ index, length: 1 });
}
}
return acc;
}, []);
const longestZeroFields = allZeroFields.sort((a, b) => b.length - a.length)[0];
let newHost;
if (longestZeroFields && longestZeroFields.length > 1) {
const newFirst = fields.slice(0, longestZeroFields.index);
const newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
newHost = newFirst.join(":") + "::" + newLast.join(":");
}
else {
newHost = fields.join(":");
}
if (zone) {
newHost += "%" + zone;
}
return newHost;
}
else {
return host;
}
}
const URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
const NO_MATCH_IS_UNDEFINED = ("").match(/(){0}/)[1] === undefined;
export function parse(uriString, options = {}) {
const components = {};
const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
if (options.reference === "suffix")
uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
const matches = uriString.match(URI_PARSE);
if (matches) {
if (NO_MATCH_IS_UNDEFINED) {
//store each component
components.scheme = matches[1];
components.userinfo = matches[3];
components.host = matches[4];
components.port = parseInt(matches[5], 10);
components.path = matches[6] || "";
components.query = matches[7];
components.fragment = matches[8];
//fix port number
if (isNaN(components.port)) {
components.port = matches[5];
}
}
else { //IE FIX for improper RegExp matching
//store each component
components.scheme = matches[1] || undefined;
components.userinfo = (uriString.indexOf("@") !== -1 ? matches[3] : undefined);
components.host = (uriString.indexOf("//") !== -1 ? matches[4] : undefined);
components.port = parseInt(matches[5], 10);
components.path = matches[6] || "";
components.query = (uriString.indexOf("?") !== -1 ? matches[7] : undefined);
components.fragment = (uriString.indexOf("#") !== -1 ? matches[8] : undefined);
//fix port number
if (isNaN(components.port)) {
components.port = (uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined);
}
}
if (components.host) {
//normalize IP hosts
components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
}
//determine reference type
if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
components.reference = "same-document";
}
else if (components.scheme === undefined) {
components.reference = "relative";
}
else if (components.fragment === undefined) {
components.reference = "absolute";
}
else {
components.reference = "uri";
}
//check for reference errors
if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
components.error = components.error || "URI is not a " + options.reference + " reference.";
}
//find scheme handler
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
//check if scheme can't handle IRIs
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
//if host component is a domain name
if (components.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost))) {
//convert Unicode IDN -> ASCII IDN
try {
components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
}
catch (e) {
components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
}
}
//convert IRI -> URI
_normalizeComponentEncoding(components, URI_PROTOCOL);
}
else {
//normalize encodings
_normalizeComponentEncoding(components, protocol);
}
//perform scheme specific parsing
if (schemeHandler && schemeHandler.parse) {
schemeHandler.parse(components, options);
}
}
else {
components.error = components.error || "URI can not be parsed.";
}
return components;
}
;
function _recomposeAuthority(components, options) {
const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens = [];
if (components.userinfo !== undefined) {
uriTokens.push(components.userinfo);
uriTokens.push("@");
}
if (components.host !== undefined) {
//normalize IP hosts, add brackets and escape zone separator for IPv6
uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, (_, $1, $2) => "[" + $1 + ($2 ? "%25" + $2 : "") + "]"));
}
if (typeof components.port === "number") {
uriTokens.push(":");
uriTokens.push(components.port.toString(10));
}
return uriTokens.length ? uriTokens.join("") : undefined;
}
;
const RDS1 = /^\.\.?\//;
const RDS2 = /^\/\.(\/|$)/;
const RDS3 = /^\/\.\.(\/|$)/;
const RDS4 = /^\.\.?$/;
const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
export function removeDotSegments(input) {
const output = [];
while (input.length) {
if (input.match(RDS1)) {
input = input.replace(RDS1, "");
}
else if (input.match(RDS2)) {
input = input.replace(RDS2, "/");
}
else if (input.match(RDS3)) {
input = input.replace(RDS3, "/");
output.pop();
}
else if (input === "." || input === "..") {
input = "";
}
else {
const im = input.match(RDS5);
if (im) {
const s = im[0];
input = input.slice(s.length);
output.push(s);
}
else {
throw new Error("Unexpected dot segment condition");
}
}
}
return output.join("");
}
;
export function serialize(components, options = {}) {
const protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens = [];
//find scheme handler
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
//perform scheme specific serialization
if (schemeHandler && schemeHandler.serialize)
schemeHandler.serialize(components, options);
if (components.host) {
//if host component is an IPv6 address
if (protocol.IPV6ADDRESS.test(components.host)) {
//TODO: normalize IPv6 address as per RFC 5952
}
//if host component is a domain name
else if (options.domainHost || (schemeHandler && schemeHandler.domainHost)) {
//convert IDN via punycode
try {
components.host = (!options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host));
}
catch (e) {
components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
}
}
}
//normalize encoding
_normalizeComponentEncoding(components, protocol);
if (options.reference !== "suffix" && components.scheme) {
uriTokens.push(components.scheme);
uriTokens.push(":");
}
const authority = _recomposeAuthority(components, options);
if (authority !== undefined) {
if (options.reference !== "suffix") {
uriTokens.push("//");
}
uriTokens.push(authority);
if (components.path && components.path.charAt(0) !== "/") {
uriTokens.push("/");
}
}
if (components.path !== undefined) {
let s = components.path;
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
s = removeDotSegments(s);
}
if (authority === undefined) {
s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
}
uriTokens.push(s);
}
if (components.query !== undefined) {
uriTokens.push("?");
uriTokens.push(components.query);
}
if (components.fragment !== undefined) {
uriTokens.push("#");
uriTokens.push(components.fragment);
}
return uriTokens.join(""); //merge tokens into a string
}
;
export function resolveComponents(base, relative, options = {}, skipNormalization) {
const target = {};
if (!skipNormalization) {
base = parse(serialize(base, options), options); //normalize base components
relative = parse(serialize(relative, options), options); //normalize relative components
}
options = options || {};
if (!options.tolerant && relative.scheme) {
target.scheme = relative.scheme;
//target.authority = relative.authority;
target.userinfo = relative.userinfo;
target.host = relative.host;
target.port = relative.port;
target.path = removeDotSegments(relative.path || "");
target.query = relative.query;
}
else {
if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
//target.authority = relative.authority;
target.userinfo = relative.userinfo;
target.host = relative.host;
target.port = relative.port;
target.path = removeDotSegments(relative.path || "");
target.query = relative.query;
}
else {
if (!relative.path) {
target.path = base.path;
if (relative.query !== undefined) {
target.query = relative.query;
}
else {
target.query = base.query;
}
}
else {
if (relative.path.charAt(0) === "/") {
target.path = removeDotSegments(relative.path);
}
else {
if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
target.path = "/" + relative.path;
}
else if (!base.path) {
target.path = relative.path;
}
else {
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
}
target.path = removeDotSegments(target.path);
}
target.query = relative.query;
}
//target.authority = base.authority;
target.userinfo = base.userinfo;
target.host = base.host;
target.port = base.port;
}
target.scheme = base.scheme;
}
target.fragment = relative.fragment;
return target;
}
;
export function resolve(baseURI, relativeURI, options) {
const schemelessOptions = assign({ scheme: 'null' }, options);
return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
}
;
export function normalize(uri, options) {
if (typeof uri === "string") {
uri = serialize(parse(uri, options), options);
}
else if (typeOf(uri) === "object") {
uri = parse(serialize(uri, options), options);
}
return uri;
}
;
export function equal(uriA, uriB, options) {
if (typeof uriA === "string") {
uriA = serialize(parse(uriA, options), options);
}
else if (typeOf(uriA) === "object") {
uriA = serialize(uriA, options);
}
if (typeof uriB === "string") {
uriB = serialize(parse(uriB, options), options);
}
else if (typeOf(uriB) === "object") {
uriB = serialize(uriB, options);
}
return uriA === uriB;
}
;
export function escapeComponent(str, options) {
return str && str.toString().replace((!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE), pctEncChar);
}
;
export function unescapeComponent(str, options) {
return str && str.toString().replace((!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED), pctDecChars);
}
;
//# sourceMappingURL=uri.js.map

1
node_modules/uri-js/dist/esnext/uri.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

6
node_modules/uri-js/dist/esnext/util.d.ts generated vendored Normal file
View file

@ -0,0 +1,6 @@
export declare function merge(...sets: Array<string>): string;
export declare function subexp(str: string): string;
export declare function typeOf(o: any): string;
export declare function toUpperCase(str: string): string;
export declare function toArray(obj: any): Array<any>;
export declare function assign(target: object, source: any): any;

36
node_modules/uri-js/dist/esnext/util.js generated vendored Normal file
View file

@ -0,0 +1,36 @@
export function merge(...sets) {
if (sets.length > 1) {
sets[0] = sets[0].slice(0, -1);
const xl = sets.length - 1;
for (let x = 1; x < xl; ++x) {
sets[x] = sets[x].slice(1, -1);
}
sets[xl] = sets[xl].slice(1);
return sets.join('');
}
else {
return sets[0];
}
}
export function subexp(str) {
return "(?:" + str + ")";
}
export function typeOf(o) {
return o === undefined ? "undefined" : (o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase());
}
export function toUpperCase(str) {
return str.toUpperCase();
}
export function toArray(obj) {
return obj !== undefined && obj !== null ? (obj instanceof Array ? obj : (typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj))) : [];
}
export function assign(target, source) {
const obj = target;
if (source) {
for (const key in source) {
obj[key] = source[key];
}
}
return obj;
}
//# sourceMappingURL=util.js.map

1
node_modules/uri-js/dist/esnext/util.js.map generated vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG,IAAkB;IAC1C,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QACpB,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YAC5B,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SAC/B;QACD,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KACrB;SAAM;QACN,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;KACf;AACF,CAAC;AAED,MAAM,iBAAiB,GAAU;IAChC,OAAO,KAAK,GAAG,GAAG,GAAG,GAAG,CAAC;AAC1B,CAAC;AAED,MAAM,iBAAiB,CAAK;IAC3B,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AACpJ,CAAC;AAED,MAAM,sBAAsB,GAAU;IACrC,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,kBAAkB,GAAO;IAC9B,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACvM,CAAC;AAGD,MAAM,iBAAiB,MAAc,EAAE,MAAW;IACjD,MAAM,GAAG,GAAG,MAAa,CAAC;IAC1B,IAAI,MAAM,EAAE;QACX,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;YACzB,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;SACvB;KACD;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}

93
node_modules/uri-js/package.json generated vendored Normal file
View file

@ -0,0 +1,93 @@
{
"_from": "uri-js@^4.2.2",
"_id": "uri-js@4.2.2",
"_inBundle": false,
"_integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
"_location": "/uri-js",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "uri-js@^4.2.2",
"name": "uri-js",
"escapedName": "uri-js",
"rawSpec": "^4.2.2",
"saveSpec": null,
"fetchSpec": "^4.2.2"
},
"_requiredBy": [
"/ajv"
],
"_resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
"_shasum": "94c540e1ff772956e2299507c010aea6c8838eb0",
"_spec": "uri-js@^4.2.2",
"_where": "E:\\github\\setup-java\\node_modules\\ajv",
"author": {
"name": "Gary Court",
"email": "gary.court@gmail.com"
},
"bugs": {
"url": "https://github.com/garycourt/uri-js/issues"
},
"bundleDependencies": false,
"dependencies": {
"punycode": "^2.1.0"
},
"deprecated": false,
"description": "An RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-latest": "^6.24.1",
"mocha": "^3.2.0",
"mocha-qunit-ui": "^0.1.3",
"rollup": "^0.41.6",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-node-resolve": "^2.0.0",
"sorcery": "^0.10.0",
"typescript": "^2.8.1",
"uglify-js": "^2.8.14"
},
"directories": {
"test": "tests"
},
"homepage": "https://github.com/garycourt/uri-js",
"keywords": [
"URI",
"IRI",
"IDN",
"URN",
"UUID",
"HTTP",
"HTTPS",
"MAILTO",
"RFC3986",
"RFC3987",
"RFC5891",
"RFC2616",
"RFC2818",
"RFC2141",
"RFC4122",
"RFC4291",
"RFC5952",
"RFC6068",
"RFC6874"
],
"license": "BSD-2-Clause",
"main": "dist/es5/uri.all.js",
"name": "uri-js",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/garycourt/uri-js.git"
},
"scripts": {
"build": "npm run build:esnext && npm run build:es5 && npm run build:es5:min",
"build:es5": "rollup -c && cp dist/esnext/uri.d.ts dist/es5/uri.all.d.ts && npm run build:es5:fix-sourcemap",
"build:es5:fix-sourcemap": "sorcery -i dist/es5/uri.all.js",
"build:es5:min": "uglifyjs dist/es5/uri.all.js --support-ie8 --output dist/es5/uri.all.min.js --in-source-map dist/es5/uri.all.js.map --source-map uri.all.min.js.map --comments --compress --mangle --pure-funcs merge subexp && mv uri.all.min.js.map dist/es5/ && cp dist/es5/uri.all.d.ts dist/es5/uri.all.min.d.ts",
"build:esnext": "tsc",
"test": "mocha -u mocha-qunit-ui dist/es5/uri.all.js tests/tests.js"
},
"types": "dist/es5/uri.all.d.ts",
"version": "4.2.2"
}

32
node_modules/uri-js/rollup.config.js generated vendored Normal file
View file

@ -0,0 +1,32 @@
import resolve from 'rollup-plugin-node-resolve';
import babel from 'rollup-plugin-babel';
const packageJson = require('./package.json');
export default {
entry : "dist/esnext/index.js",
format : "umd",
moduleName : "URI",
plugins: [
resolve({
module: true,
jsnext: true,
preferBuiltins: false
}),
babel({
"presets": [
["latest", {
"es2015": {
"modules": false
}
}]
],
"plugins": ["external-helpers"],
"externalHelpers": false
}
)
],
dest : "dist/es5/uri.all.js",
sourceMap: true,
banner: "/** @license URI.js v" + packageJson.version + " (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */"
}

18
node_modules/uri-js/src/index.ts generated vendored Normal file
View file

@ -0,0 +1,18 @@
import { SCHEMES } from "./uri";
import http from "./schemes/http";
SCHEMES[http.scheme] = http;
import https from "./schemes/https";
SCHEMES[https.scheme] = https;
import mailto from "./schemes/mailto";
SCHEMES[mailto.scheme] = mailto;
import urn from "./schemes/urn";
SCHEMES[urn.scheme] = urn;
import uuid from "./schemes/urn-uuid";
SCHEMES[uuid.scheme] = uuid;
export * from "./uri";

24
node_modules/uri-js/src/punycode.d.ts generated vendored Normal file
View file

@ -0,0 +1,24 @@
declare module 'punycode' {
function ucs2decode(string:string):Array<number>;
function ucs2encode(array:Array<number>):string;
function decode(string:string):string;
function encode(string:string):string;
function toASCII(string:string):string;
function toUnicode(string:string):string;
interface Punycode {
'version': '2.2.0';
'ucs2': {
'decode': typeof ucs2decode;
'encode': typeof ucs2encode;
},
'decode': typeof decode;
'encode': typeof encode;
'toASCII': typeof toASCII;
'toUnicode': typeof toUnicode;
}
const punycode:Punycode;
export default punycode;
}

4
node_modules/uri-js/src/regexps-iri.ts generated vendored Normal file
View file

@ -0,0 +1,4 @@
import { URIRegExps } from "./uri";
import { buildExps } from "./regexps-uri";
export default buildExps(true);

89
node_modules/uri-js/src/regexps-uri.ts generated vendored Normal file
View file

@ -0,0 +1,89 @@
import { URIRegExps } from "./uri";
import { merge, subexp } from "./util";
export function buildExps(isIRI:boolean):URIRegExps {
const
ALPHA$$ = "[A-Za-z]",
CR$ = "[\\x0D]",
DIGIT$$ = "[0-9]",
DQUOTE$$ = "[\\x22]",
HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"), //case-insensitive
LF$$ = "[\\x0A]",
SP$$ = "[\\x20]",
PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)), //expanded
GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", //subset, excludes bidi control characters
IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]", //subset
UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$),
SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"),
USERINFO$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*"),
DEC_OCTET$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("[1-9]" + DIGIT$$) + "|" + DIGIT$$),
DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$), //relaxed parsing rules
IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
H16$ = subexp(HEXDIG$$ + "{1,4}"),
LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
IPV6ADDRESS1$ = subexp( subexp(H16$ + "\\:") + "{6}" + LS32$), // 6( h16 ":" ) ls32
IPV6ADDRESS2$ = subexp( "\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$), // "::" 5( h16 ":" ) ls32
IPV6ADDRESS3$ = subexp(subexp( H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$), //[ h16 ] "::" 4( h16 ":" ) ls32
IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$), //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$), //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$), //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$), //[ *4( h16 ":" ) h16 ] "::" ls32
IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$ ), //[ *5( h16 ":" ) h16 ] "::" h16
IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:" ), //[ *6( h16 ":" ) h16 ] "::"
IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+"), //RFC 6874
IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + "\\%25" + ZONEID$), //RFC 6874
IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + ZONEID$), //RFC 6874, with relaxed parsing rules
IPVFUTURE$ = subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+"),
IP_LITERAL$ = subexp("\\[" + subexp(IPV6ADDRZ_RELAXED$ + "|" + IPV6ADDRESS$ + "|" + IPVFUTURE$) + "\\]"), //RFC 6874
REG_NAME$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*"),
HOST$ = subexp(IP_LITERAL$ + "|" + IPV4ADDRESS$ + "(?!" + REG_NAME$ + ")" + "|" + REG_NAME$),
PORT$ = subexp(DIGIT$$ + "*"),
AUTHORITY$ = subexp(subexp(USERINFO$ + "@") + "?" + HOST$ + subexp("\\:" + PORT$) + "?"),
PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]")),
SEGMENT$ = subexp(PCHAR$ + "*"),
SEGMENT_NZ$ = subexp(PCHAR$ + "+"),
SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+"),
PATH_ABEMPTY$ = subexp(subexp("\\/" + SEGMENT$) + "*"),
PATH_ABSOLUTE$ = subexp("\\/" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + "?"), //simplified
PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$), //simplified
PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$), //simplified
PATH_EMPTY$ = "(?!" + PCHAR$ + ")",
PATH$ = subexp(PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$),
QUERY$ = subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"),
FRAGMENT$ = subexp(subexp(PCHAR$ + "|[\\/\\?]") + "*"),
HIER_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$),
URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"),
RELATIVE_PART$ = subexp(subexp("\\/\\/" + AUTHORITY$ + PATH_ABEMPTY$) + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$),
RELATIVE$ = subexp(RELATIVE_PART$ + subexp("\\?" + QUERY$) + "?" + subexp("\\#" + FRAGMENT$) + "?"),
URI_REFERENCE$ = subexp(URI$ + "|" + RELATIVE$),
ABSOLUTE_URI$ = subexp(SCHEME$ + "\\:" + HIER_PART$ + subexp("\\?" + QUERY$) + "?"),
GENERIC_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",
RELATIVE_REF$ = "^(){0}" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_NOSCHEME$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",
ABSOLUTE_REF$ = "^(" + SCHEME$ + ")\\:" + subexp(subexp("\\/\\/(" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?)") + "?(" + PATH_ABEMPTY$ + "|" + PATH_ABSOLUTE$ + "|" + PATH_ROOTLESS$ + "|" + PATH_EMPTY$ + ")") + subexp("\\?(" + QUERY$ + ")") + "?$",
SAMEDOC_REF$ = "^" + subexp("\\#(" + FRAGMENT$ + ")") + "?$",
AUTHORITY_REF$ = "^" + subexp("(" + USERINFO$ + ")@") + "?(" + HOST$ + ")" + subexp("\\:(" + PORT$ + ")") + "?$"
;
return {
NOT_SCHEME : new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
NOT_USERINFO : new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
NOT_HOST : new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
NOT_PATH : new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
NOT_PATH_NOSCHEME : new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
NOT_QUERY : new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
NOT_FRAGMENT : new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
ESCAPE : new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
UNRESERVED : new RegExp(UNRESERVED$$, "g"),
OTHER_CHARS : new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
PCT_ENCODED : new RegExp(PCT_ENCODED$, "g"),
IPV4ADDRESS : new RegExp("^(" + IPV4ADDRESS$ + ")$"),
IPV6ADDRESS : new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
};
}
export default buildExps(false);

36
node_modules/uri-js/src/schemes/http.ts generated vendored Normal file
View file

@ -0,0 +1,36 @@
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
const handler:URISchemeHandler = {
scheme : "http",
domainHost : true,
parse : function (components:URIComponents, options:URIOptions):URIComponents {
//report missing host
if (!components.host) {
components.error = components.error || "HTTP URIs must have a host.";
}
return components;
},
serialize : function (components:URIComponents, options:URIOptions):URIComponents {
//normalize the default port
if (components.port === (String(components.scheme).toLowerCase() !== "https" ? 80 : 443) || components.port === "") {
components.port = undefined;
}
//normalize the empty path
if (!components.path) {
components.path = "/";
}
//NOTE: We do not parse query strings for HTTP URIs
//as WWW Form Url Encoded query strings are part of the HTML4+ spec,
//and not the HTTP spec.
return components;
}
};
export default handler;

11
node_modules/uri-js/src/schemes/https.ts generated vendored Normal file
View file

@ -0,0 +1,11 @@
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
import http from "./http";
const handler:URISchemeHandler = {
scheme : "https",
domainHost : http.domainHost,
parse : http.parse,
serialize : http.serialize
}
export default handler;

182
node_modules/uri-js/src/schemes/mailto.ts generated vendored Normal file
View file

@ -0,0 +1,182 @@
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
import { pctEncChar, pctDecChars, unescapeComponent } from "../uri";
import punycode from "punycode";
import { merge, subexp, toUpperCase, toArray } from "../util";
export interface MailtoHeaders {
[hfname:string]:string
}
export interface MailtoComponents extends URIComponents {
to:Array<string>,
headers?:MailtoHeaders,
subject?:string,
body?:string
}
const O:MailtoHeaders = {};
const isIRI = true;
//RFC 3986
const UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + (isIRI ? "\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" : "") + "]";
const HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
const PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
//const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
//const WSP$$ = "[\\x20\\x09]";
//const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
//const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
//const VCHAR$$ = "[\\x21-\\x7E]";
//const WSP$$ = "[\\x20\\x09]";
//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
const ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
const QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
const VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
const DOT_ATOM_TEXT$ = subexp(ATEXT$$ + "+" + subexp("\\." + ATEXT$$ + "+") + "*");
const QUOTED_PAIR$ = subexp("\\\\" + VCHAR$$);
const QCONTENT$ = subexp(QTEXT$$ + "|" + QUOTED_PAIR$);
const QUOTED_STRING$ = subexp('\\"' + QCONTENT$ + "*" + '\\"');
//RFC 6068
const DTEXT_NO_OBS$$ = "[\\x21-\\x5A\\x5E-\\x7E]"; //%d33-90 / %d94-126
const SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
const QCHAR$ = subexp(UNRESERVED$$ + "|" + PCT_ENCODED$ + "|" + SOME_DELIMS$$);
const DOMAIN$ = subexp(DOT_ATOM_TEXT$ + "|" + "\\[" + DTEXT_NO_OBS$$ + "*" + "\\]");
const LOCAL_PART$ = subexp(DOT_ATOM_TEXT$ + "|" + QUOTED_STRING$);
const ADDR_SPEC$ = subexp(LOCAL_PART$ + "\\@" + DOMAIN$);
const TO$ = subexp(ADDR_SPEC$ + subexp("\\," + ADDR_SPEC$) + "*");
const HFNAME$ = subexp(QCHAR$ + "*");
const HFVALUE$ = HFNAME$;
const HFIELD$ = subexp(HFNAME$ + "\\=" + HFVALUE$);
const HFIELDS2$ = subexp(HFIELD$ + subexp("\\&" + HFIELD$) + "*");
const HFIELDS$ = subexp("\\?" + HFIELDS2$);
const MAILTO_URI = new RegExp("^mailto\\:" + TO$ + "?" + HFIELDS$ + "?$");
const UNRESERVED = new RegExp(UNRESERVED$$, "g");
const PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
const NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
const NOT_DOMAIN = new RegExp(merge("[^]", ATEXT$$, "[\\.]", "[\\[]", DTEXT_NO_OBS$$, "[\\]]"), "g");
const NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
const NOT_HFVALUE = NOT_HFNAME;
const TO = new RegExp("^" + TO$ + "$");
const HFIELDS = new RegExp("^" + HFIELDS2$ + "$");
function decodeUnreserved(str:string):string {
const decStr = pctDecChars(str);
return (!decStr.match(UNRESERVED) ? str : decStr);
}
const handler:URISchemeHandler<MailtoComponents> = {
scheme : "mailto",
parse : function (components:URIComponents, options:URIOptions):MailtoComponents {
const mailtoComponents = components as MailtoComponents;
const to = mailtoComponents.to = (mailtoComponents.path ? mailtoComponents.path.split(",") : []);
mailtoComponents.path = undefined;
if (mailtoComponents.query) {
let unknownHeaders = false
const headers:MailtoHeaders = {};
const hfields = mailtoComponents.query.split("&");
for (let x = 0, xl = hfields.length; x < xl; ++x) {
const hfield = hfields[x].split("=");
switch (hfield[0]) {
case "to":
const toAddrs = hfield[1].split(",");
for (let x = 0, xl = toAddrs.length; x < xl; ++x) {
to.push(toAddrs[x]);
}
break;
case "subject":
mailtoComponents.subject = unescapeComponent(hfield[1], options);
break;
case "body":
mailtoComponents.body = unescapeComponent(hfield[1], options);
break;
default:
unknownHeaders = true;
headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
break;
}
}
if (unknownHeaders) mailtoComponents.headers = headers;
}
mailtoComponents.query = undefined;
for (let x = 0, xl = to.length; x < xl; ++x) {
const addr = to[x].split("@");
addr[0] = unescapeComponent(addr[0]);
if (!options.unicodeSupport) {
//convert Unicode IDN -> ASCII IDN
try {
addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
} catch (e) {
mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
}
} else {
addr[1] = unescapeComponent(addr[1], options).toLowerCase();
}
to[x] = addr.join("@");
}
return mailtoComponents;
},
serialize : function (mailtoComponents:MailtoComponents, options:URIOptions):URIComponents {
const components = mailtoComponents as URIComponents;
const to = toArray(mailtoComponents.to);
if (to) {
for (let x = 0, xl = to.length; x < xl; ++x) {
const toAddr = String(to[x]);
const atIdx = toAddr.lastIndexOf("@");
const localPart = (toAddr.slice(0, atIdx)).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
let domain = toAddr.slice(atIdx + 1);
//convert IDN via punycode
try {
domain = (!options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain));
} catch (e) {
components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
}
to[x] = localPart + "@" + domain;
}
components.path = to.join(",");
}
const headers = mailtoComponents.headers = mailtoComponents.headers || {};
if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
const fields = [];
for (const name in headers) {
if (headers[name] !== O[name]) {
fields.push(
name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) +
"=" +
headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar)
);
}
}
if (fields.length) {
components.query = fields.join("&");
}
return components;
}
}
export default handler;

36
node_modules/uri-js/src/schemes/urn-uuid.ts generated vendored Normal file
View file

@ -0,0 +1,36 @@
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
import { URNComponents } from "./urn";
import { SCHEMES } from "../uri";
export interface UUIDComponents extends URNComponents {
uuid?: string;
}
const UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
const UUID_PARSE = /^[0-9A-Fa-f\-]{36}/;
//RFC 4122
const handler:URISchemeHandler<UUIDComponents, URIOptions, URNComponents> = {
scheme : "urn:uuid",
parse : function (urnComponents:URNComponents, options:URIOptions):UUIDComponents {
const uuidComponents = urnComponents as UUIDComponents;
uuidComponents.uuid = uuidComponents.nss;
uuidComponents.nss = undefined;
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
uuidComponents.error = uuidComponents.error || "UUID is not valid.";
}
return uuidComponents;
},
serialize : function (uuidComponents:UUIDComponents, options:URIOptions):URNComponents {
const urnComponents = uuidComponents as URNComponents;
//normalize UUID
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
return urnComponents;
},
};
export default handler;

69
node_modules/uri-js/src/schemes/urn.ts generated vendored Normal file
View file

@ -0,0 +1,69 @@
import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
import { pctEncChar, SCHEMES } from "../uri";
export interface URNComponents extends URIComponents {
nid?:string;
nss?:string;
}
export interface URNOptions extends URIOptions {
nid?:string;
}
const NID$ = "(?:[0-9A-Za-z][0-9A-Za-z\\-]{1,31})";
const PCT_ENCODED$ = "(?:\\%[0-9A-Fa-f]{2})";
const TRANS$$ = "[0-9A-Za-z\\(\\)\\+\\,\\-\\.\\:\\=\\@\\;\\$\\_\\!\\*\\'\\/\\?\\#]";
const NSS$ = "(?:(?:" + PCT_ENCODED$ + "|" + TRANS$$ + ")+)";
const URN_SCHEME = new RegExp("^urn\\:(" + NID$ + ")$");
const URN_PATH = new RegExp("^(" + NID$ + ")\\:(" + NSS$ + ")$");
const URN_PARSE = /^([^\:]+)\:(.*)/;
const URN_EXCLUDED = /[\x00-\x20\\\"\&\<\>\[\]\^\`\{\|\}\~\x7F-\xFF]/g;
//RFC 2141
const handler:URISchemeHandler<URNComponents,URNOptions> = {
scheme : "urn",
parse : function (components:URIComponents, options:URNOptions):URNComponents {
const matches = components.path && components.path.match(URN_PARSE);
let urnComponents = components as URNComponents;
if (matches) {
const scheme = options.scheme || urnComponents.scheme || "urn";
const nid = matches[1].toLowerCase();
const nss = matches[2];
const urnScheme = `${scheme}:${options.nid || nid}`;
const schemeHandler = SCHEMES[urnScheme];
urnComponents.nid = nid;
urnComponents.nss = nss;
urnComponents.path = undefined;
if (schemeHandler) {
urnComponents = schemeHandler.parse(urnComponents, options) as URNComponents;
}
} else {
urnComponents.error = urnComponents.error || "URN can not be parsed.";
}
return urnComponents;
},
serialize : function (urnComponents:URNComponents, options:URNOptions):URIComponents {
const scheme = options.scheme || urnComponents.scheme || "urn";
const nid = urnComponents.nid;
const urnScheme = `${scheme}:${options.nid || nid}`;
const schemeHandler = SCHEMES[urnScheme];
if (schemeHandler) {
urnComponents = schemeHandler.serialize(urnComponents, options) as URNComponents;
}
const uriComponents = urnComponents as URIComponents;
const nss = urnComponents.nss;
uriComponents.path = `${nid || options.nid}:${nss}`;
return uriComponents;
},
};
export default handler;

556
node_modules/uri-js/src/uri.ts generated vendored Normal file
View file

@ -0,0 +1,556 @@
/**
* URI.js
*
* @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
* @see http://github.com/garycourt/uri-js
*/
/**
* Copyright 2011 Gary Court. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of Gary Court.
*/
import URI_PROTOCOL from "./regexps-uri";
import IRI_PROTOCOL from "./regexps-iri";
import punycode from "punycode";
import { toUpperCase, typeOf, assign } from "./util";
export interface URIComponents {
scheme?:string;
userinfo?:string;
host?:string;
port?:number|string;
path?:string;
query?:string;
fragment?:string;
reference?:string;
error?:string;
}
export interface URIOptions {
scheme?:string;
reference?:string;
tolerant?:boolean;
absolutePath?:boolean;
iri?:boolean;
unicodeSupport?:boolean;
domainHost?:boolean;
}
export interface URISchemeHandler<Components extends URIComponents = URIComponents, Options extends URIOptions = URIOptions, ParentComponents extends URIComponents = URIComponents> {
scheme:string;
parse(components:ParentComponents, options:Options):Components;
serialize(components:Components, options:Options):ParentComponents;
unicodeSupport?:boolean;
domainHost?:boolean;
absolutePath?:boolean;
}
export interface URIRegExps {
NOT_SCHEME : RegExp,
NOT_USERINFO : RegExp,
NOT_HOST : RegExp,
NOT_PATH : RegExp,
NOT_PATH_NOSCHEME : RegExp,
NOT_QUERY : RegExp,
NOT_FRAGMENT : RegExp,
ESCAPE : RegExp,
UNRESERVED : RegExp,
OTHER_CHARS : RegExp,
PCT_ENCODED : RegExp,
IPV4ADDRESS : RegExp,
IPV6ADDRESS : RegExp,
}
export const SCHEMES:{[scheme:string]:URISchemeHandler} = {};
export function pctEncChar(chr:string):string {
const c = chr.charCodeAt(0);
let e:string;
if (c < 16) e = "%0" + c.toString(16).toUpperCase();
else if (c < 128) e = "%" + c.toString(16).toUpperCase();
else if (c < 2048) e = "%" + ((c >> 6) | 192).toString(16).toUpperCase() + "%" + ((c & 63) | 128).toString(16).toUpperCase();
else e = "%" + ((c >> 12) | 224).toString(16).toUpperCase() + "%" + (((c >> 6) & 63) | 128).toString(16).toUpperCase() + "%" + ((c & 63) | 128).toString(16).toUpperCase();
return e;
}
export function pctDecChars(str:string):string {
let newStr = "";
let i = 0;
const il = str.length;
while (i < il) {
const c = parseInt(str.substr(i + 1, 2), 16);
if (c < 128) {
newStr += String.fromCharCode(c);
i += 3;
}
else if (c >= 194 && c < 224) {
if ((il - i) >= 6) {
const c2 = parseInt(str.substr(i + 4, 2), 16);
newStr += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
} else {
newStr += str.substr(i, 6);
}
i += 6;
}
else if (c >= 224) {
if ((il - i) >= 9) {
const c2 = parseInt(str.substr(i + 4, 2), 16);
const c3 = parseInt(str.substr(i + 7, 2), 16);
newStr += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
} else {
newStr += str.substr(i, 9);
}
i += 9;
}
else {
newStr += str.substr(i, 3);
i += 3;
}
}
return newStr;
}
function _normalizeComponentEncoding(components:URIComponents, protocol:URIRegExps) {
function decodeUnreserved(str:string):string {
const decStr = pctDecChars(str);
return (!decStr.match(protocol.UNRESERVED) ? str : decStr);
}
if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace((components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME), pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
return components;
};
function _stripLeadingZeros(str:string):string {
return str.replace(/^0*(.*)/, "$1") || "0";
}
function _normalizeIPv4(host:string, protocol:URIRegExps):string {
const matches = host.match(protocol.IPV4ADDRESS) || [];
const [, address] = matches;
if (address) {
return address.split(".").map(_stripLeadingZeros).join(".");
} else {
return host;
}
}
function _normalizeIPv6(host:string, protocol:URIRegExps):string {
const matches = host.match(protocol.IPV6ADDRESS) || [];
const [, address, zone] = matches;
if (address) {
const [last, first] = address.toLowerCase().split('::').reverse();
const firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
const lastFields = last.split(":").map(_stripLeadingZeros);
const isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
const fieldCount = isLastFieldIPv4Address ? 7 : 8;
const lastFieldsStart = lastFields.length - fieldCount;
const fields = Array<string>(fieldCount);
for (let x = 0; x < fieldCount; ++x) {
fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
}
if (isLastFieldIPv4Address) {
fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
}
const allZeroFields = fields.reduce<Array<{index:number,length:number}>>((acc, field, index) => {
if (!field || field === "0") {
const lastLongest = acc[acc.length - 1];
if (lastLongest && lastLongest.index + lastLongest.length === index) {
lastLongest.length++;
} else {
acc.push({ index, length : 1 });
}
}
return acc;
}, []);
const longestZeroFields = allZeroFields.sort((a, b) => b.length - a.length)[0];
let newHost:string;
if (longestZeroFields && longestZeroFields.length > 1) {
const newFirst = fields.slice(0, longestZeroFields.index) ;
const newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
newHost = newFirst.join(":") + "::" + newLast.join(":");
} else {
newHost = fields.join(":");
}
if (zone) {
newHost += "%" + zone;
}
return newHost;
} else {
return host;
}
}
const URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
const NO_MATCH_IS_UNDEFINED = (<RegExpMatchArray>("").match(/(){0}/))[1] === undefined;
export function parse(uriString:string, options:URIOptions = {}):URIComponents {
const components:URIComponents = {};
const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
const matches = uriString.match(URI_PARSE);
if (matches) {
if (NO_MATCH_IS_UNDEFINED) {
//store each component
components.scheme = matches[1];
components.userinfo = matches[3];
components.host = matches[4];
components.port = parseInt(matches[5], 10);
components.path = matches[6] || "";
components.query = matches[7];
components.fragment = matches[8];
//fix port number
if (isNaN(components.port)) {
components.port = matches[5];
}
} else { //IE FIX for improper RegExp matching
//store each component
components.scheme = matches[1] || undefined;
components.userinfo = (uriString.indexOf("@") !== -1 ? matches[3] : undefined);
components.host = (uriString.indexOf("//") !== -1 ? matches[4] : undefined);
components.port = parseInt(matches[5], 10);
components.path = matches[6] || "";
components.query = (uriString.indexOf("?") !== -1 ? matches[7] : undefined);
components.fragment = (uriString.indexOf("#") !== -1 ? matches[8] : undefined);
//fix port number
if (isNaN(components.port)) {
components.port = (uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined);
}
}
if (components.host) {
//normalize IP hosts
components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
}
//determine reference type
if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
components.reference = "same-document";
} else if (components.scheme === undefined) {
components.reference = "relative";
} else if (components.fragment === undefined) {
components.reference = "absolute";
} else {
components.reference = "uri";
}
//check for reference errors
if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
components.error = components.error || "URI is not a " + options.reference + " reference.";
}
//find scheme handler
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
//check if scheme can't handle IRIs
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
//if host component is a domain name
if (components.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost))) {
//convert Unicode IDN -> ASCII IDN
try {
components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
} catch (e) {
components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
}
}
//convert IRI -> URI
_normalizeComponentEncoding(components, URI_PROTOCOL);
} else {
//normalize encodings
_normalizeComponentEncoding(components, protocol);
}
//perform scheme specific parsing
if (schemeHandler && schemeHandler.parse) {
schemeHandler.parse(components, options);
}
} else {
components.error = components.error || "URI can not be parsed.";
}
return components;
};
function _recomposeAuthority(components:URIComponents, options:URIOptions):string|undefined {
const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
if (components.userinfo !== undefined) {
uriTokens.push(components.userinfo);
uriTokens.push("@");
}
if (components.host !== undefined) {
//normalize IP hosts, add brackets and escape zone separator for IPv6
uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, (_, $1, $2) => "[" + $1 + ($2 ? "%25" + $2 : "") + "]"));
}
if (typeof components.port === "number") {
uriTokens.push(":");
uriTokens.push(components.port.toString(10));
}
return uriTokens.length ? uriTokens.join("") : undefined;
};
const RDS1 = /^\.\.?\//;
const RDS2 = /^\/\.(\/|$)/;
const RDS3 = /^\/\.\.(\/|$)/;
const RDS4 = /^\.\.?$/;
const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
export function removeDotSegments(input:string):string {
const output:Array<string> = [];
while (input.length) {
if (input.match(RDS1)) {
input = input.replace(RDS1, "");
} else if (input.match(RDS2)) {
input = input.replace(RDS2, "/");
} else if (input.match(RDS3)) {
input = input.replace(RDS3, "/");
output.pop();
} else if (input === "." || input === "..") {
input = "";
} else {
const im = input.match(RDS5);
if (im) {
const s = im[0];
input = input.slice(s.length);
output.push(s);
} else {
throw new Error("Unexpected dot segment condition");
}
}
}
return output.join("");
};
export function serialize(components:URIComponents, options:URIOptions = {}):string {
const protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens:Array<string> = [];
//find scheme handler
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
//perform scheme specific serialization
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
if (components.host) {
//if host component is an IPv6 address
if (protocol.IPV6ADDRESS.test(components.host)) {
//TODO: normalize IPv6 address as per RFC 5952
}
//if host component is a domain name
else if (options.domainHost || (schemeHandler && schemeHandler.domainHost)) {
//convert IDN via punycode
try {
components.host = (!options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host));
} catch (e) {
components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
}
}
}
//normalize encoding
_normalizeComponentEncoding(components, protocol);
if (options.reference !== "suffix" && components.scheme) {
uriTokens.push(components.scheme);
uriTokens.push(":");
}
const authority = _recomposeAuthority(components, options);
if (authority !== undefined) {
if (options.reference !== "suffix") {
uriTokens.push("//");
}
uriTokens.push(authority);
if (components.path && components.path.charAt(0) !== "/") {
uriTokens.push("/");
}
}
if (components.path !== undefined) {
let s = components.path;
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
s = removeDotSegments(s);
}
if (authority === undefined) {
s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
}
uriTokens.push(s);
}
if (components.query !== undefined) {
uriTokens.push("?");
uriTokens.push(components.query);
}
if (components.fragment !== undefined) {
uriTokens.push("#");
uriTokens.push(components.fragment);
}
return uriTokens.join(""); //merge tokens into a string
};
export function resolveComponents(base:URIComponents, relative:URIComponents, options:URIOptions = {}, skipNormalization?:boolean):URIComponents {
const target:URIComponents = {};
if (!skipNormalization) {
base = parse(serialize(base, options), options); //normalize base components
relative = parse(serialize(relative, options), options); //normalize relative components
}
options = options || {};
if (!options.tolerant && relative.scheme) {
target.scheme = relative.scheme;
//target.authority = relative.authority;
target.userinfo = relative.userinfo;
target.host = relative.host;
target.port = relative.port;
target.path = removeDotSegments(relative.path || "");
target.query = relative.query;
} else {
if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
//target.authority = relative.authority;
target.userinfo = relative.userinfo;
target.host = relative.host;
target.port = relative.port;
target.path = removeDotSegments(relative.path || "");
target.query = relative.query;
} else {
if (!relative.path) {
target.path = base.path;
if (relative.query !== undefined) {
target.query = relative.query;
} else {
target.query = base.query;
}
} else {
if (relative.path.charAt(0) === "/") {
target.path = removeDotSegments(relative.path);
} else {
if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
target.path = "/" + relative.path;
} else if (!base.path) {
target.path = relative.path;
} else {
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
}
target.path = removeDotSegments(target.path);
}
target.query = relative.query;
}
//target.authority = base.authority;
target.userinfo = base.userinfo;
target.host = base.host;
target.port = base.port;
}
target.scheme = base.scheme;
}
target.fragment = relative.fragment;
return target;
};
export function resolve(baseURI:string, relativeURI:string, options?:URIOptions):string {
const schemelessOptions = assign({ scheme : 'null' }, options);
return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
};
export function normalize(uri:string, options?:URIOptions):string;
export function normalize(uri:URIComponents, options?:URIOptions):URIComponents;
export function normalize(uri:any, options?:URIOptions):any {
if (typeof uri === "string") {
uri = serialize(parse(uri, options), options);
} else if (typeOf(uri) === "object") {
uri = parse(serialize(<URIComponents>uri, options), options);
}
return uri;
};
export function equal(uriA:string, uriB:string, options?: URIOptions):boolean;
export function equal(uriA:URIComponents, uriB:URIComponents, options?:URIOptions):boolean;
export function equal(uriA:any, uriB:any, options?:URIOptions):boolean {
if (typeof uriA === "string") {
uriA = serialize(parse(uriA, options), options);
} else if (typeOf(uriA) === "object") {
uriA = serialize(<URIComponents>uriA, options);
}
if (typeof uriB === "string") {
uriB = serialize(parse(uriB, options), options);
} else if (typeOf(uriB) === "object") {
uriB = serialize(<URIComponents>uriB, options);
}
return uriA === uriB;
};
export function escapeComponent(str:string, options?:URIOptions):string {
return str && str.toString().replace((!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE), pctEncChar);
};
export function unescapeComponent(str:string, options?:URIOptions):string {
return str && str.toString().replace((!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED), pctDecChars);
};

40
node_modules/uri-js/src/util.ts generated vendored Normal file
View file

@ -0,0 +1,40 @@
export function merge(...sets:Array<string>):string {
if (sets.length > 1) {
sets[0] = sets[0].slice(0, -1);
const xl = sets.length - 1;
for (let x = 1; x < xl; ++x) {
sets[x] = sets[x].slice(1, -1);
}
sets[xl] = sets[xl].slice(1);
return sets.join('');
} else {
return sets[0];
}
}
export function subexp(str:string):string {
return "(?:" + str + ")";
}
export function typeOf(o:any):string {
return o === undefined ? "undefined" : (o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase());
}
export function toUpperCase(str:string):string {
return str.toUpperCase();
}
export function toArray(obj:any):Array<any> {
return obj !== undefined && obj !== null ? (obj instanceof Array ? obj : (typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj))) : [];
}
export function assign(target: object, source: any): any {
const obj = target as any;
if (source) {
for (const key in source) {
obj[key] = source[key];
}
}
return obj;
}

118
node_modules/uri-js/tests/qunit.css generated vendored Normal file
View file

@ -0,0 +1,118 @@
ol#qunit-tests {
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
margin:0;
padding:0;
list-style-position:inside;
font-size: smaller;
}
ol#qunit-tests li{
padding:0.4em 0.5em 0.4em 2.5em;
border-bottom:1px solid #fff;
font-size:small;
list-style-position:inside;
}
ol#qunit-tests li ol{
box-shadow: inset 0px 2px 13px #999;
-moz-box-shadow: inset 0px 2px 13px #999;
-webkit-box-shadow: inset 0px 2px 13px #999;
margin-top:0.5em;
margin-left:0;
padding:0.5em;
background-color:#fff;
border-radius:15px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
}
ol#qunit-tests li li{
border-bottom:none;
margin:0.5em;
background-color:#fff;
list-style-position: inside;
padding:0.4em 0.5em 0.4em 0.5em;
}
ol#qunit-tests li li.pass{
border-left:26px solid #C6E746;
background-color:#fff;
color:#5E740B;
}
ol#qunit-tests li li.fail{
border-left:26px solid #EE5757;
background-color:#fff;
color:#710909;
}
ol#qunit-tests li.pass{
background-color:#D2E0E6;
color:#528CE0;
}
ol#qunit-tests li.fail{
background-color:#EE5757;
color:#000;
}
ol#qunit-tests li strong {
cursor:pointer;
}
h1#qunit-header{
background-color:#0d3349;
margin:0;
padding:0.5em 0 0.5em 1em;
color:#fff;
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
border-top-right-radius:15px;
border-top-left-radius:15px;
-moz-border-radius-topright:15px;
-moz-border-radius-topleft:15px;
-webkit-border-top-right-radius:15px;
-webkit-border-top-left-radius:15px;
text-shadow: rgba(0, 0, 0, 0.5) 4px 4px 1px;
}
h2#qunit-banner{
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
height:5px;
margin:0;
padding:0;
}
h2#qunit-banner.qunit-pass{
background-color:#C6E746;
}
h2#qunit-banner.qunit-fail, #qunit-testrunner-toolbar {
background-color:#EE5757;
}
#qunit-testrunner-toolbar {
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
padding:0;
/*width:80%;*/
padding:0em 0 0.5em 2em;
font-size: small;
}
h2#qunit-userAgent {
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
background-color:#2b81af;
margin:0;
padding:0;
color:#fff;
font-size: small;
padding:0.5em 0 0.5em 2.5em;
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
}
p#qunit-testresult{
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
margin:0;
font-size: small;
color:#2b81af;
border-bottom-right-radius:15px;
border-bottom-left-radius:15px;
-moz-border-radius-bottomright:15px;
-moz-border-radius-bottomleft:15px;
-webkit-border-bottom-right-radius:15px;
-webkit-border-bottom-left-radius:15px;
background-color:#D2E0E6;
padding:0.5em 0.5em 0.5em 2.5em;
}
strong b.fail{
color:#710909;
}
strong b.pass{
color:#5E740B;
}

1042
node_modules/uri-js/tests/qunit.js generated vendored Normal file

File diff suppressed because it is too large Load diff

17
node_modules/uri-js/tests/test-es5-min.html generated vendored Normal file
View file

@ -0,0 +1,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="qunit.css" type="text/css"/>
<script type="text/javascript" src="qunit.js"></script>
<script type="text/javascript" src="../dist/es5/uri.all.min.js"></script>
<script type="text/javascript" src="tests.js"></script>
</head>
<body>
<h1 id="qunit-header">URI.js Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</body>
</html>

17
node_modules/uri-js/tests/test-es5.html generated vendored Normal file
View file

@ -0,0 +1,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="qunit.css" type="text/css"/>
<script type="text/javascript" src="qunit.js"></script>
<script type="text/javascript" src="../dist/es5/uri.all.js"></script>
<script type="text/javascript" src="tests.js"></script>
</head>
<body>
<h1 id="qunit-header">URI.js Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</body>
</html>

774
node_modules/uri-js/tests/tests.js generated vendored Normal file
View file

@ -0,0 +1,774 @@
//
//
// Tests
//
//
if (typeof URI === "undefined") {
var URI = require("../dist/es5/uri.all");
}
test("Acquire URI", function () {
//URI = require("./uri").URI;
ok(URI);
});
test("URI Parsing", function () {
var components;
//scheme
components = URI.parse("uri:");
strictEqual(components.error, undefined, "scheme errors");
strictEqual(components.scheme, "uri", "scheme");
//strictEqual(components.authority, undefined, "authority");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, undefined, "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
//userinfo
components = URI.parse("//@");
strictEqual(components.error, undefined, "userinfo errors");
strictEqual(components.scheme, undefined, "scheme");
//strictEqual(components.authority, "@", "authority");
strictEqual(components.userinfo, "", "userinfo");
strictEqual(components.host, "", "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
//host
components = URI.parse("//");
strictEqual(components.error, undefined, "host errors");
strictEqual(components.scheme, undefined, "scheme");
//strictEqual(components.authority, "", "authority");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, "", "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
//port
components = URI.parse("//:");
strictEqual(components.error, undefined, "port errors");
strictEqual(components.scheme, undefined, "scheme");
//strictEqual(components.authority, ":", "authority");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, "", "host");
strictEqual(components.port, "", "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
//path
components = URI.parse("");
strictEqual(components.error, undefined, "path errors");
strictEqual(components.scheme, undefined, "scheme");
//strictEqual(components.authority, undefined, "authority");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, undefined, "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
//query
components = URI.parse("?");
strictEqual(components.error, undefined, "query errors");
strictEqual(components.scheme, undefined, "scheme");
//strictEqual(components.authority, undefined, "authority");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, undefined, "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, "", "query");
strictEqual(components.fragment, undefined, "fragment");
//fragment
components = URI.parse("#");
strictEqual(components.error, undefined, "fragment errors");
strictEqual(components.scheme, undefined, "scheme");
//strictEqual(components.authority, undefined, "authority");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, undefined, "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, "", "fragment");
//fragment with character tabulation
components = URI.parse("#\t");
strictEqual(components.error, undefined, "path errors");
strictEqual(components.scheme, undefined, "scheme");
//strictEqual(components.authority, undefined, "authority");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, undefined, "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, "%09", "fragment");
//fragment with line feed
components = URI.parse("#\n");
strictEqual(components.error, undefined, "path errors");
strictEqual(components.scheme, undefined, "scheme");
//strictEqual(components.authority, undefined, "authority");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, undefined, "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, "%0A", "fragment");
//fragment with line tabulation
components = URI.parse("#\v");
strictEqual(components.error, undefined, "path errors");
strictEqual(components.scheme, undefined, "scheme");
//strictEqual(components.authority, undefined, "authority");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, undefined, "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, "%0B", "fragment");
//fragment with form feed
components = URI.parse("#\f");
strictEqual(components.error, undefined, "path errors");
strictEqual(components.scheme, undefined, "scheme");
//strictEqual(components.authority, undefined, "authority");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, undefined, "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, "%0C", "fragment");
//fragment with carriage return
components = URI.parse("#\r");
strictEqual(components.error, undefined, "path errors");
strictEqual(components.scheme, undefined, "scheme");
//strictEqual(components.authority, undefined, "authority");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, undefined, "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, "%0D", "fragment");
//all
components = URI.parse("uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body");
strictEqual(components.error, undefined, "all errors");
strictEqual(components.scheme, "uri", "scheme");
//strictEqual(components.authority, "user:pass@example.com:123", "authority");
strictEqual(components.userinfo, "user:pass", "userinfo");
strictEqual(components.host, "example.com", "host");
strictEqual(components.port, 123, "port");
strictEqual(components.path, "/one/two.three", "path");
strictEqual(components.query, "q1=a1&q2=a2", "query");
strictEqual(components.fragment, "body", "fragment");
//IPv4address
components = URI.parse("//10.10.10.10");
strictEqual(components.error, undefined, "IPv4address errors");
strictEqual(components.scheme, undefined, "scheme");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, "10.10.10.10", "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
//IPv6address
components = URI.parse("//[2001:db8::7]");
strictEqual(components.error, undefined, "IPv4address errors");
strictEqual(components.scheme, undefined, "scheme");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, "2001:db8::7", "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
//mixed IPv4address & IPv6address
components = URI.parse("//[::ffff:129.144.52.38]");
strictEqual(components.error, undefined, "IPv4address errors");
strictEqual(components.scheme, undefined, "scheme");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, "::ffff:129.144.52.38", "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
//mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4)
components = URI.parse("uri://10.10.10.10.example.com/en/process");
strictEqual(components.error, undefined, "mixed errors");
strictEqual(components.scheme, "uri", "scheme");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, "10.10.10.10.example.com", "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "/en/process", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
//IPv6address, example from bkw (https://github.com/garycourt/uri-js/pull/16)
components = URI.parse("//[2606:2800:220:1:248:1893:25c8:1946]/test");
strictEqual(components.error, undefined, "IPv6address errors");
strictEqual(components.scheme, undefined, "scheme");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, "2606:2800:220:1:248:1893:25c8:1946", "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "/test", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
//IPv6address, example from RFC 5952
components = URI.parse("//[2001:db8::1]:80");
strictEqual(components.error, undefined, "IPv6address errors");
strictEqual(components.scheme, undefined, "scheme");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, "2001:db8::1", "host");
strictEqual(components.port, 80, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
//IPv6address with zone identifier, RFC 6874
components = URI.parse("//[fe80::a%25en1]");
strictEqual(components.error, undefined, "IPv4address errors");
strictEqual(components.scheme, undefined, "scheme");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, "fe80::a%en1", "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
//IPv6address with an unescaped interface specifier, example from pekkanikander (https://github.com/garycourt/uri-js/pull/22)
components = URI.parse("//[2001:db8::7%en0]");
strictEqual(components.error, undefined, "IPv6address interface errors");
strictEqual(components.scheme, undefined, "scheme");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, "2001:db8::7%en0", "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, "", "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
});
test("URI Serialization", function () {
var components = {
scheme : undefined,
userinfo : undefined,
host : undefined,
port : undefined,
path : undefined,
query : undefined,
fragment : undefined
};
strictEqual(URI.serialize(components), "", "Undefined Components");
components = {
scheme : "",
userinfo : "",
host : "",
port : 0,
path : "",
query : "",
fragment : ""
};
strictEqual(URI.serialize(components), "//@:0?#", "Empty Components");
components = {
scheme : "uri",
userinfo : "foo:bar",
host : "example.com",
port : 1,
path : "path",
query : "query",
fragment : "fragment"
};
strictEqual(URI.serialize(components), "uri://foo:bar@example.com:1/path?query#fragment", "All Components");
strictEqual(URI.serialize({path:"//path"}), "/%2Fpath", "Double slash path");
strictEqual(URI.serialize({path:"foo:bar"}), "foo%3Abar", "Colon path");
strictEqual(URI.serialize({path:"?query"}), "%3Fquery", "Query path");
//mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4)
strictEqual(URI.serialize({host:"10.10.10.10.example.com"}), "//10.10.10.10.example.com", "Mixed IPv4address & reg-name");
//IPv6address
strictEqual(URI.serialize({host:"2001:db8::7"}), "//[2001:db8::7]", "IPv6 Host");
strictEqual(URI.serialize({host:"::ffff:129.144.52.38"}), "//[::ffff:129.144.52.38]", "IPv6 Mixed Host");
strictEqual(URI.serialize({host:"2606:2800:220:1:248:1893:25c8:1946"}), "//[2606:2800:220:1:248:1893:25c8:1946]", "IPv6 Full Host");
//IPv6address with zone identifier, RFC 6874
strictEqual(URI.serialize({host:"fe80::a%en1"}), "//[fe80::a%25en1]", "IPv6 Zone Unescaped Host");
strictEqual(URI.serialize({host:"fe80::a%25en1"}), "//[fe80::a%25en1]", "IPv6 Zone Escaped Host");
});
test("URI Resolving", function () {
//normal examples from RFC 3986
var base = "uri://a/b/c/d;p?q";
strictEqual(URI.resolve(base, "g:h"), "g:h", "g:h");
strictEqual(URI.resolve(base, "g:h"), "g:h", "g:h");
strictEqual(URI.resolve(base, "g"), "uri://a/b/c/g", "g");
strictEqual(URI.resolve(base, "./g"), "uri://a/b/c/g", "./g");
strictEqual(URI.resolve(base, "g/"), "uri://a/b/c/g/", "g/");
strictEqual(URI.resolve(base, "/g"), "uri://a/g", "/g");
strictEqual(URI.resolve(base, "//g"), "uri://g", "//g");
strictEqual(URI.resolve(base, "?y"), "uri://a/b/c/d;p?y", "?y");
strictEqual(URI.resolve(base, "g?y"), "uri://a/b/c/g?y", "g?y");
strictEqual(URI.resolve(base, "#s"), "uri://a/b/c/d;p?q#s", "#s");
strictEqual(URI.resolve(base, "g#s"), "uri://a/b/c/g#s", "g#s");
strictEqual(URI.resolve(base, "g?y#s"), "uri://a/b/c/g?y#s", "g?y#s");
strictEqual(URI.resolve(base, ";x"), "uri://a/b/c/;x", ";x");
strictEqual(URI.resolve(base, "g;x"), "uri://a/b/c/g;x", "g;x");
strictEqual(URI.resolve(base, "g;x?y#s"), "uri://a/b/c/g;x?y#s", "g;x?y#s");
strictEqual(URI.resolve(base, ""), "uri://a/b/c/d;p?q", "");
strictEqual(URI.resolve(base, "."), "uri://a/b/c/", ".");
strictEqual(URI.resolve(base, "./"), "uri://a/b/c/", "./");
strictEqual(URI.resolve(base, ".."), "uri://a/b/", "..");
strictEqual(URI.resolve(base, "../"), "uri://a/b/", "../");
strictEqual(URI.resolve(base, "../g"), "uri://a/b/g", "../g");
strictEqual(URI.resolve(base, "../.."), "uri://a/", "../..");
strictEqual(URI.resolve(base, "../../"), "uri://a/", "../../");
strictEqual(URI.resolve(base, "../../g"), "uri://a/g", "../../g");
//abnormal examples from RFC 3986
strictEqual(URI.resolve(base, "../../../g"), "uri://a/g", "../../../g");
strictEqual(URI.resolve(base, "../../../../g"), "uri://a/g", "../../../../g");
strictEqual(URI.resolve(base, "/./g"), "uri://a/g", "/./g");
strictEqual(URI.resolve(base, "/../g"), "uri://a/g", "/../g");
strictEqual(URI.resolve(base, "g."), "uri://a/b/c/g.", "g.");
strictEqual(URI.resolve(base, ".g"), "uri://a/b/c/.g", ".g");
strictEqual(URI.resolve(base, "g.."), "uri://a/b/c/g..", "g..");
strictEqual(URI.resolve(base, "..g"), "uri://a/b/c/..g", "..g");
strictEqual(URI.resolve(base, "./../g"), "uri://a/b/g", "./../g");
strictEqual(URI.resolve(base, "./g/."), "uri://a/b/c/g/", "./g/.");
strictEqual(URI.resolve(base, "g/./h"), "uri://a/b/c/g/h", "g/./h");
strictEqual(URI.resolve(base, "g/../h"), "uri://a/b/c/h", "g/../h");
strictEqual(URI.resolve(base, "g;x=1/./y"), "uri://a/b/c/g;x=1/y", "g;x=1/./y");
strictEqual(URI.resolve(base, "g;x=1/../y"), "uri://a/b/c/y", "g;x=1/../y");
strictEqual(URI.resolve(base, "g?y/./x"), "uri://a/b/c/g?y/./x", "g?y/./x");
strictEqual(URI.resolve(base, "g?y/../x"), "uri://a/b/c/g?y/../x", "g?y/../x");
strictEqual(URI.resolve(base, "g#s/./x"), "uri://a/b/c/g#s/./x", "g#s/./x");
strictEqual(URI.resolve(base, "g#s/../x"), "uri://a/b/c/g#s/../x", "g#s/../x");
strictEqual(URI.resolve(base, "uri:g"), "uri:g", "uri:g");
strictEqual(URI.resolve(base, "uri:g", {tolerant:true}), "uri://a/b/c/g", "uri:g");
//examples by PAEz
strictEqual(URI.resolve("//www.g.com/","/adf\ngf"), "//www.g.com/adf%0Agf", "/adf\\ngf");
strictEqual(URI.resolve("//www.g.com/error\n/bleh/bleh",".."), "//www.g.com/error%0A/", "//www.g.com/error\\n/bleh/bleh");
});
test("URI Normalizing", function () {
//test from RFC 3987
strictEqual(URI.normalize("uri://www.example.org/red%09ros\xE9#red"), "uri://www.example.org/red%09ros%C3%A9#red");
//IPv4address
strictEqual(URI.normalize("//192.068.001.000"), "//192.68.1.0");
//IPv6address, example from RFC 3513
strictEqual(URI.normalize("http://[1080::8:800:200C:417A]/"), "http://[1080::8:800:200c:417a]/");
//IPv6address, examples from RFC 5952
strictEqual(URI.normalize("//[2001:0db8::0001]/"), "//[2001:db8::1]/");
strictEqual(URI.normalize("//[2001:db8::1:0000:1]/"), "//[2001:db8::1:0:1]/");
strictEqual(URI.normalize("//[2001:db8:0:0:0:0:2:1]/"), "//[2001:db8::2:1]/");
strictEqual(URI.normalize("//[2001:db8:0:1:1:1:1:1]/"), "//[2001:db8:0:1:1:1:1:1]/");
strictEqual(URI.normalize("//[2001:0:0:1:0:0:0:1]/"), "//[2001:0:0:1::1]/");
strictEqual(URI.normalize("//[2001:db8:0:0:1:0:0:1]/"), "//[2001:db8::1:0:0:1]/");
strictEqual(URI.normalize("//[2001:DB8::1]/"), "//[2001:db8::1]/");
strictEqual(URI.normalize("//[0:0:0:0:0:ffff:192.0.2.1]/"), "//[::ffff:192.0.2.1]/");
//Mixed IPv4 and IPv6 address
strictEqual(URI.normalize("//[1:2:3:4:5:6:192.0.2.1]/"), "//[1:2:3:4:5:6:192.0.2.1]/");
strictEqual(URI.normalize("//[1:2:3:4:5:6:192.068.001.000]/"), "//[1:2:3:4:5:6:192.68.1.0]/");
});
test("URI Equals", function () {
//test from RFC 3986
strictEqual(URI.equal("example://a/b/c/%7Bfoo%7D", "eXAMPLE://a/./b/../b/%63/%7bfoo%7d"), true);
//test from RFC 3987
strictEqual(URI.equal("http://example.org/~user", "http://example.org/%7euser"), true);
});
test("Escape Component", function () {
var chr;
for (var d = 0; d <= 129; ++d) {
chr = String.fromCharCode(d);
if (!chr.match(/[\$\&\+\,\;\=]/)) {
strictEqual(URI.escapeComponent(chr), encodeURIComponent(chr));
} else {
strictEqual(URI.escapeComponent(chr), chr);
}
}
strictEqual(URI.escapeComponent("\u00c0"), encodeURIComponent("\u00c0"));
strictEqual(URI.escapeComponent("\u07ff"), encodeURIComponent("\u07ff"));
strictEqual(URI.escapeComponent("\u0800"), encodeURIComponent("\u0800"));
strictEqual(URI.escapeComponent("\u30a2"), encodeURIComponent("\u30a2"));
});
test("Unescape Component", function () {
var chr;
for (var d = 0; d <= 129; ++d) {
chr = String.fromCharCode(d);
strictEqual(URI.unescapeComponent(encodeURIComponent(chr)), chr);
}
strictEqual(URI.unescapeComponent(encodeURIComponent("\u00c0")), "\u00c0");
strictEqual(URI.unescapeComponent(encodeURIComponent("\u07ff")), "\u07ff");
strictEqual(URI.unescapeComponent(encodeURIComponent("\u0800")), "\u0800");
strictEqual(URI.unescapeComponent(encodeURIComponent("\u30a2")), "\u30a2");
});
//
// IRI
//
var IRI_OPTION = { iri : true, unicodeSupport : true };
test("IRI Parsing", function () {
var components = URI.parse("uri://us\xA0er:pa\uD7FFss@example.com:123/o\uF900ne/t\uFDCFwo.t\uFDF0hree?q1=a1\uF8FF\uE000&q2=a2#bo\uFFEFdy", IRI_OPTION);
strictEqual(components.error, undefined, "all errors");
strictEqual(components.scheme, "uri", "scheme");
//strictEqual(components.authority, "us\xA0er:pa\uD7FFss@example.com:123", "authority");
strictEqual(components.userinfo, "us\xA0er:pa\uD7FFss", "userinfo");
strictEqual(components.host, "example.com", "host");
strictEqual(components.port, 123, "port");
strictEqual(components.path, "/o\uF900ne/t\uFDCFwo.t\uFDF0hree", "path");
strictEqual(components.query, "q1=a1\uF8FF\uE000&q2=a2", "query");
strictEqual(components.fragment, "bo\uFFEFdy", "fragment");
});
test("IRI Serialization", function () {
var components = {
scheme : "uri",
userinfo : "us\xA0er:pa\uD7FFss",
host : "example.com",
port : 123,
path : "/o\uF900ne/t\uFDCFwo.t\uFDF0hree",
query : "q1=a1\uF8FF\uE000&q2=a2",
fragment : "bo\uFFEFdy\uE001"
};
strictEqual(URI.serialize(components, IRI_OPTION), "uri://us\xA0er:pa\uD7FFss@example.com:123/o\uF900ne/t\uFDCFwo.t\uFDF0hree?q1=a1\uF8FF\uE000&q2=a2#bo\uFFEFdy%EE%80%81");
});
test("IRI Normalizing", function () {
strictEqual(URI.normalize("uri://www.example.org/red%09ros\xE9#red", IRI_OPTION), "uri://www.example.org/red%09ros\xE9#red");
});
test("IRI Equals", function () {
//example from RFC 3987
strictEqual(URI.equal("example://a/b/c/%7Bfoo%7D/ros\xE9", "eXAMPLE://a/./b/../b/%63/%7bfoo%7d/ros%C3%A9", IRI_OPTION), true);
});
test("Convert IRI to URI", function () {
//example from RFC 3987
strictEqual(URI.serialize(URI.parse("uri://www.example.org/red%09ros\xE9#red", IRI_OPTION)), "uri://www.example.org/red%09ros%C3%A9#red");
//Internationalized Domain Name conversion via punycode example from RFC 3987
strictEqual(URI.serialize(URI.parse("uri://r\xE9sum\xE9.example.org", {iri:true, domainHost:true}), {domainHost:true}), "uri://xn--rsum-bpad.example.org");
});
test("Convert URI to IRI", function () {
//examples from RFC 3987
strictEqual(URI.serialize(URI.parse("uri://www.example.org/D%C3%BCrst"), IRI_OPTION), "uri://www.example.org/D\xFCrst");
strictEqual(URI.serialize(URI.parse("uri://www.example.org/D%FCrst"), IRI_OPTION), "uri://www.example.org/D%FCrst");
strictEqual(URI.serialize(URI.parse("uri://xn--99zt52a.example.org/%e2%80%ae"), IRI_OPTION), "uri://xn--99zt52a.example.org/%E2%80%AE"); //or uri://\u7D0D\u8C46.example.org/%E2%80%AE
//Internationalized Domain Name conversion via punycode example from RFC 3987
strictEqual(URI.serialize(URI.parse("uri://xn--rsum-bpad.example.org", {domainHost:true}), {iri:true, domainHost:true}), "uri://r\xE9sum\xE9.example.org");
});
//
// HTTP
//
if (URI.SCHEMES["http"]) {
//module("HTTP");
test("HTTP Equals", function () {
//test from RFC 2616
strictEqual(URI.equal("http://abc.com:80/~smith/home.html", "http://abc.com/~smith/home.html"), true);
strictEqual(URI.equal("http://ABC.com/%7Esmith/home.html", "http://abc.com/~smith/home.html"), true);
strictEqual(URI.equal("http://ABC.com:/%7esmith/home.html", "http://abc.com/~smith/home.html"), true);
strictEqual(URI.equal("HTTP://ABC.COM", "http://abc.com/"), true);
//test from RFC 3986
strictEqual(URI.equal("http://example.com:/", "http://example.com:80/"), true);
});
}
if (URI.SCHEMES["https"]) {
//module("HTTPS");
test("HTTPS Equals", function () {
strictEqual(URI.equal("https://example.com", "https://example.com:443/"), true);
strictEqual(URI.equal("https://example.com:/", "https://example.com:443/"), true);
});
}
//
// URN
//
if (URI.SCHEMES["urn"]) {
//module("URN");
test("URN Parsing", function () {
//example from RFC 2141
var components = URI.parse("urn:foo:a123,456");
strictEqual(components.error, undefined, "errors");
strictEqual(components.scheme, "urn", "scheme");
//strictEqual(components.authority, undefined, "authority");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, undefined, "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, undefined, "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
strictEqual(components.nid, "foo", "nid");
strictEqual(components.nss, "a123,456", "nss");
});
test("URN Serialization", function () {
//example from RFC 2141
var components = {
scheme : "urn",
nid : "foo",
nss : "a123,456"
};
strictEqual(URI.serialize(components), "urn:foo:a123,456");
});
test("URN Equals", function () {
//test from RFC 2141
strictEqual(URI.equal("urn:foo:a123,456", "urn:foo:a123,456"), true);
strictEqual(URI.equal("urn:foo:a123,456", "URN:foo:a123,456"), true);
strictEqual(URI.equal("urn:foo:a123,456", "urn:FOO:a123,456"), true);
strictEqual(URI.equal("urn:foo:a123,456", "urn:foo:A123,456"), false);
strictEqual(URI.equal("urn:foo:a123%2C456", "URN:FOO:a123%2c456"), true);
});
test("URN Resolving", function () {
//example from epoberezkin
strictEqual(URI.resolve('', 'urn:some:ip:prop'), 'urn:some:ip:prop');
strictEqual(URI.resolve('#', 'urn:some:ip:prop'), 'urn:some:ip:prop');
strictEqual(URI.resolve('urn:some:ip:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop');
strictEqual(URI.resolve('urn:some:other:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop');
});
//
// URN UUID
//
test("UUID Parsing", function () {
//example from RFC 4122
var components = URI.parse("urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6");
strictEqual(components.error, undefined, "errors");
strictEqual(components.scheme, "urn", "scheme");
//strictEqual(components.authority, undefined, "authority");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, undefined, "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, undefined, "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
strictEqual(components.nid, "uuid", "nid");
strictEqual(components.nss, undefined, "nss");
strictEqual(components.uuid, "f81d4fae-7dec-11d0-a765-00a0c91e6bf6", "uuid");
components = URI.parse("urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6");
notStrictEqual(components.error, undefined, "errors");
});
test("UUID Serialization", function () {
//example from RFC 4122
var components = {
scheme : "urn",
nid : "uuid",
uuid : "f81d4fae-7dec-11d0-a765-00a0c91e6bf6"
};
strictEqual(URI.serialize(components), "urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6");
components = {
scheme : "urn",
nid : "uuid",
uuid : "notauuid-7dec-11d0-a765-00a0c91e6bf6"
};
strictEqual(URI.serialize(components), "urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6");
});
test("UUID Equals", function () {
strictEqual(URI.equal("URN:UUID:F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6", "urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6"), true);
});
test("URN NID Override", function () {
var components = URI.parse("urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6", {nid:"uuid"});
strictEqual(components.error, undefined, "errors");
strictEqual(components.scheme, "urn", "scheme");
strictEqual(components.path, undefined, "path");
strictEqual(components.nid, "foo", "nid");
strictEqual(components.nss, undefined, "nss");
strictEqual(components.uuid, "f81d4fae-7dec-11d0-a765-00a0c91e6bf6", "uuid");
var components = {
scheme : "urn",
nid : "foo",
uuid : "f81d4fae-7dec-11d0-a765-00a0c91e6bf6"
};
strictEqual(URI.serialize(components, {nid:"uuid"}), "urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6");
});
}
//
// Mailto
//
if (URI.SCHEMES["mailto"]) {
//module("Mailto");
test("Mailto Parse", function () {
var components;
//tests from RFC 6068
components = URI.parse("mailto:chris@example.com");
strictEqual(components.error, undefined, "error");
strictEqual(components.scheme, "mailto", "scheme");
strictEqual(components.userinfo, undefined, "userinfo");
strictEqual(components.host, undefined, "host");
strictEqual(components.port, undefined, "port");
strictEqual(components.path, undefined, "path");
strictEqual(components.query, undefined, "query");
strictEqual(components.fragment, undefined, "fragment");
deepEqual(components.to, ["chris@example.com"], "to");
strictEqual(components.subject, undefined, "subject");
strictEqual(components.body, undefined, "body");
strictEqual(components.headers, undefined, "headers");
components = URI.parse("mailto:infobot@example.com?subject=current-issue");
deepEqual(components.to, ["infobot@example.com"], "to");
strictEqual(components.subject, "current-issue", "subject");
components = URI.parse("mailto:infobot@example.com?body=send%20current-issue");
deepEqual(components.to, ["infobot@example.com"], "to");
strictEqual(components.body, "send current-issue", "body");
components = URI.parse("mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index");
deepEqual(components.to, ["infobot@example.com"], "to");
strictEqual(components.body, "send current-issue\x0D\x0Asend index", "body");
components = URI.parse("mailto:list@example.org?In-Reply-To=%3C3469A91.D10AF4C@example.com%3E");
deepEqual(components.to, ["list@example.org"], "to");
deepEqual(components.headers, {"In-Reply-To":"<3469A91.D10AF4C@example.com>"}, "headers");
components = URI.parse("mailto:majordomo@example.com?body=subscribe%20bamboo-l");
deepEqual(components.to, ["majordomo@example.com"], "to");
strictEqual(components.body, "subscribe bamboo-l", "body");
components = URI.parse("mailto:joe@example.com?cc=bob@example.com&body=hello");
deepEqual(components.to, ["joe@example.com"], "to");
strictEqual(components.body, "hello", "body");
deepEqual(components.headers, {"cc":"bob@example.com"}, "headers");
components = URI.parse("mailto:joe@example.com?cc=bob@example.com?body=hello");
if (URI.VALIDATE_SUPPORT) ok(components.error, "invalid header fields");
components = URI.parse("mailto:gorby%25kremvax@example.com");
deepEqual(components.to, ["gorby%kremvax@example.com"], "to gorby%kremvax@example.com");
components = URI.parse("mailto:unlikely%3Faddress@example.com?blat=foop");
deepEqual(components.to, ["unlikely?address@example.com"], "to unlikely?address@example.com");
deepEqual(components.headers, {"blat":"foop"}, "headers");
components = URI.parse("mailto:Mike%26family@example.org");
deepEqual(components.to, ["Mike&family@example.org"], "to Mike&family@example.org");
components = URI.parse("mailto:%22not%40me%22@example.org");
deepEqual(components.to, ['"not@me"@example.org'], "to " + '"not@me"@example.org');
components = URI.parse("mailto:%22oh%5C%5Cno%22@example.org");
deepEqual(components.to, ['"oh\\\\no"@example.org'], "to " + '"oh\\\\no"@example.org');
components = URI.parse("mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org");
deepEqual(components.to, ['"\\\\\\"it\'s\\ ugly\\\\\\""@example.org'], "to " + '"\\\\\\"it\'s\\ ugly\\\\\\""@example.org');
components = URI.parse("mailto:user@example.org?subject=caf%C3%A9");
deepEqual(components.to, ["user@example.org"], "to");
strictEqual(components.subject, "caf\xE9", "subject");
components = URI.parse("mailto:user@example.org?subject=%3D%3Futf-8%3FQ%3Fcaf%3DC3%3DA9%3F%3D");
deepEqual(components.to, ["user@example.org"], "to");
strictEqual(components.subject, "=?utf-8?Q?caf=C3=A9?=", "subject"); //TODO: Verify this
components = URI.parse("mailto:user@example.org?subject=%3D%3Fiso-8859-1%3FQ%3Fcaf%3DE9%3F%3D");
deepEqual(components.to, ["user@example.org"], "to");
strictEqual(components.subject, "=?iso-8859-1?Q?caf=E9?=", "subject"); //TODO: Verify this
components = URI.parse("mailto:user@example.org?subject=caf%C3%A9&body=caf%C3%A9");
deepEqual(components.to, ["user@example.org"], "to");
strictEqual(components.subject, "caf\xE9", "subject");
strictEqual(components.body, "caf\xE9", "body");
if (URI.IRI_SUPPORT) {
components = URI.parse("mailto:user@%E7%B4%8D%E8%B1%86.example.org?subject=Test&body=NATTO");
deepEqual(components.to, ["user@xn--99zt52a.example.org"], "to");
strictEqual(components.subject, "Test", "subject");
strictEqual(components.body, "NATTO", "body");
}
});
test("Mailto Serialize", function () {
var components;
//tests from RFC 6068
strictEqual(URI.serialize({scheme : "mailto", to : ["chris@example.com"]}), "mailto:chris@example.com");
strictEqual(URI.serialize({scheme : "mailto", to : ["infobot@example.com"], body : "current-issue"}), "mailto:infobot@example.com?body=current-issue");
strictEqual(URI.serialize({scheme : "mailto", to : ["infobot@example.com"], body : "send current-issue"}), "mailto:infobot@example.com?body=send%20current-issue");
strictEqual(URI.serialize({scheme : "mailto", to : ["infobot@example.com"], body : "send current-issue\x0D\x0Asend index"}), "mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index");
strictEqual(URI.serialize({scheme : "mailto", to : ["list@example.org"], headers : {"In-Reply-To" : "<3469A91.D10AF4C@example.com>"}}), "mailto:list@example.org?In-Reply-To=%3C3469A91.D10AF4C@example.com%3E");
strictEqual(URI.serialize({scheme : "mailto", to : ["majordomo@example.com"], body : "subscribe bamboo-l"}), "mailto:majordomo@example.com?body=subscribe%20bamboo-l");
strictEqual(URI.serialize({scheme : "mailto", to : ["joe@example.com"], headers : {"cc" : "bob@example.com", "body" : "hello"}}), "mailto:joe@example.com?cc=bob@example.com&body=hello");
strictEqual(URI.serialize({scheme : "mailto", to : ["gorby%25kremvax@example.com"]}), "mailto:gorby%25kremvax@example.com");
strictEqual(URI.serialize({scheme : "mailto", to : ["unlikely%3Faddress@example.com"], headers : {"blat" : "foop"}}), "mailto:unlikely%3Faddress@example.com?blat=foop");
strictEqual(URI.serialize({scheme : "mailto", to : ["Mike&family@example.org"]}), "mailto:Mike%26family@example.org");
strictEqual(URI.serialize({scheme : "mailto", to : ['"not@me"@example.org']}), "mailto:%22not%40me%22@example.org");
strictEqual(URI.serialize({scheme : "mailto", to : ['"oh\\\\no"@example.org']}), "mailto:%22oh%5C%5Cno%22@example.org");
strictEqual(URI.serialize({scheme : "mailto", to : ['"\\\\\\"it\'s\\ ugly\\\\\\""@example.org']}), "mailto:%22%5C%5C%5C%22it's%5C%20ugly%5C%5C%5C%22%22@example.org");
strictEqual(URI.serialize({scheme : "mailto", to : ["user@example.org"], subject : "caf\xE9"}), "mailto:user@example.org?subject=caf%C3%A9");
strictEqual(URI.serialize({scheme : "mailto", to : ["user@example.org"], subject : "=?utf-8?Q?caf=C3=A9?="}), "mailto:user@example.org?subject=%3D%3Futf-8%3FQ%3Fcaf%3DC3%3DA9%3F%3D");
strictEqual(URI.serialize({scheme : "mailto", to : ["user@example.org"], subject : "=?iso-8859-1?Q?caf=E9?="}), "mailto:user@example.org?subject=%3D%3Fiso-8859-1%3FQ%3Fcaf%3DE9%3F%3D");
strictEqual(URI.serialize({scheme : "mailto", to : ["user@example.org"], subject : "caf\xE9", body : "caf\xE9"}), "mailto:user@example.org?subject=caf%C3%A9&body=caf%C3%A9");
if (URI.IRI_SUPPORT) {
strictEqual(URI.serialize({scheme : "mailto", to : ["us\xE9r@\u7d0d\u8c46.example.org"], subject : "Test", body : "NATTO"}), "mailto:us%C3%A9r@xn--99zt52a.example.org?subject=Test&body=NATTO");
}
});
test("Mailto Equals", function () {
//tests from RFC 6068
strictEqual(URI.equal("mailto:addr1@an.example,addr2@an.example", "mailto:?to=addr1@an.example,addr2@an.example"), true);
strictEqual(URI.equal("mailto:?to=addr1@an.example,addr2@an.example", "mailto:addr1@an.example?to=addr2@an.example"), true);
});
}

20
node_modules/uri-js/tsconfig.json generated vendored Normal file
View file

@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "es2015",
"target": "esnext",
"noImplicitAny": true,
"sourceMap": true,
"alwaysStrict": true,
"declaration": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"outDir": "dist/esnext",
"strictNullChecks": true
},
"include": [
"src/**/*"
]
}

1902
node_modules/uri-js/yarn.lock generated vendored Normal file

File diff suppressed because it is too large Load diff