Set up comprehensive frontend testing infrastructure
- Install Jest for unit testing with React Testing Library - Install Playwright for end-to-end testing - Configure Jest with proper TypeScript support and module mapping - Create test setup files and utilities for both unit and e2e tests Components: * Jest configuration with coverage thresholds * Playwright configuration with browser automation * Unit tests for LoginForm, AuthContext, and useSocketIO hook * E2E tests for authentication, dashboard, and agents workflows * GitHub Actions workflow for automated testing * Mock data and API utilities for consistent testing * Test documentation with best practices Testing features: - Unit tests with 70% coverage threshold - E2E tests with API mocking and user journey testing - CI/CD integration for automated test runs - Cross-browser testing support with Playwright - Authentication system testing end-to-end 🚀 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
13
frontend/node_modules/tldts-core/LICENSE
generated
vendored
Normal file
13
frontend/node_modules/tldts-core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright (c) 2017 Thomas Parisot, 2018 Rémi Berson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
3
frontend/node_modules/tldts-core/README.md
generated
vendored
Normal file
3
frontend/node_modules/tldts-core/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# `tldts-core`
|
||||
|
||||
> core building blocks of tldts, used by both `tldts` and `tldts-experimental` packages.
|
||||
561
frontend/node_modules/tldts-core/dist/cjs/index.js
generated
vendored
Normal file
561
frontend/node_modules/tldts-core/dist/cjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,561 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Check if `vhost` is a valid suffix of `hostname` (top-domain)
|
||||
*
|
||||
* It means that `vhost` needs to be a suffix of `hostname` and we then need to
|
||||
* make sure that: either they are equal, or the character preceding `vhost` in
|
||||
* `hostname` is a '.' (it should not be a partial label).
|
||||
*
|
||||
* * hostname = 'not.evil.com' and vhost = 'vil.com' => not ok
|
||||
* * hostname = 'not.evil.com' and vhost = 'evil.com' => ok
|
||||
* * hostname = 'not.evil.com' and vhost = 'not.evil.com' => ok
|
||||
*/
|
||||
function shareSameDomainSuffix(hostname, vhost) {
|
||||
if (hostname.endsWith(vhost)) {
|
||||
return (hostname.length === vhost.length ||
|
||||
hostname[hostname.length - vhost.length - 1] === '.');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Given a hostname and its public suffix, extract the general domain.
|
||||
*/
|
||||
function extractDomainWithSuffix(hostname, publicSuffix) {
|
||||
// Locate the index of the last '.' in the part of the `hostname` preceding
|
||||
// the public suffix.
|
||||
//
|
||||
// examples:
|
||||
// 1. not.evil.co.uk => evil.co.uk
|
||||
// ^ ^
|
||||
// | | start of public suffix
|
||||
// | index of the last dot
|
||||
//
|
||||
// 2. example.co.uk => example.co.uk
|
||||
// ^ ^
|
||||
// | | start of public suffix
|
||||
// |
|
||||
// | (-1) no dot found before the public suffix
|
||||
const publicSuffixIndex = hostname.length - publicSuffix.length - 2;
|
||||
const lastDotBeforeSuffixIndex = hostname.lastIndexOf('.', publicSuffixIndex);
|
||||
// No '.' found, then `hostname` is the general domain (no sub-domain)
|
||||
if (lastDotBeforeSuffixIndex === -1) {
|
||||
return hostname;
|
||||
}
|
||||
// Extract the part between the last '.'
|
||||
return hostname.slice(lastDotBeforeSuffixIndex + 1);
|
||||
}
|
||||
/**
|
||||
* Detects the domain based on rules and upon and a host string
|
||||
*/
|
||||
function getDomain(suffix, hostname, options) {
|
||||
// Check if `hostname` ends with a member of `validHosts`.
|
||||
if (options.validHosts !== null) {
|
||||
const validHosts = options.validHosts;
|
||||
for (const vhost of validHosts) {
|
||||
if ( /*@__INLINE__*/shareSameDomainSuffix(hostname, vhost)) {
|
||||
return vhost;
|
||||
}
|
||||
}
|
||||
}
|
||||
let numberOfLeadingDots = 0;
|
||||
if (hostname.startsWith('.')) {
|
||||
while (numberOfLeadingDots < hostname.length &&
|
||||
hostname[numberOfLeadingDots] === '.') {
|
||||
numberOfLeadingDots += 1;
|
||||
}
|
||||
}
|
||||
// If `hostname` is a valid public suffix, then there is no domain to return.
|
||||
// Since we already know that `getPublicSuffix` returns a suffix of `hostname`
|
||||
// there is no need to perform a string comparison and we only compare the
|
||||
// size.
|
||||
if (suffix.length === hostname.length - numberOfLeadingDots) {
|
||||
return null;
|
||||
}
|
||||
// To extract the general domain, we start by identifying the public suffix
|
||||
// (if any), then consider the domain to be the public suffix with one added
|
||||
// level of depth. (e.g.: if hostname is `not.evil.co.uk` and public suffix:
|
||||
// `co.uk`, then we take one more level: `evil`, giving the final result:
|
||||
// `evil.co.uk`).
|
||||
return /*@__INLINE__*/ extractDomainWithSuffix(hostname, suffix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the part of domain without suffix.
|
||||
*
|
||||
* Example: for domain 'foo.com', the result would be 'foo'.
|
||||
*/
|
||||
function getDomainWithoutSuffix(domain, suffix) {
|
||||
// Note: here `domain` and `suffix` cannot have the same length because in
|
||||
// this case we set `domain` to `null` instead. It is thus safe to assume
|
||||
// that `suffix` is shorter than `domain`.
|
||||
return domain.slice(0, -suffix.length - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param url - URL we want to extract a hostname from.
|
||||
* @param urlIsValidHostname - hint from caller; true if `url` is already a valid hostname.
|
||||
*/
|
||||
function extractHostname(url, urlIsValidHostname) {
|
||||
let start = 0;
|
||||
let end = url.length;
|
||||
let hasUpper = false;
|
||||
// If url is not already a valid hostname, then try to extract hostname.
|
||||
if (!urlIsValidHostname) {
|
||||
// Special handling of data URLs
|
||||
if (url.startsWith('data:')) {
|
||||
return null;
|
||||
}
|
||||
// Trim leading spaces
|
||||
while (start < url.length && url.charCodeAt(start) <= 32) {
|
||||
start += 1;
|
||||
}
|
||||
// Trim trailing spaces
|
||||
while (end > start + 1 && url.charCodeAt(end - 1) <= 32) {
|
||||
end -= 1;
|
||||
}
|
||||
// Skip scheme.
|
||||
if (url.charCodeAt(start) === 47 /* '/' */ &&
|
||||
url.charCodeAt(start + 1) === 47 /* '/' */) {
|
||||
start += 2;
|
||||
}
|
||||
else {
|
||||
const indexOfProtocol = url.indexOf(':/', start);
|
||||
if (indexOfProtocol !== -1) {
|
||||
// Implement fast-path for common protocols. We expect most protocols
|
||||
// should be one of these 4 and thus we will not need to perform the
|
||||
// more expansive validity check most of the time.
|
||||
const protocolSize = indexOfProtocol - start;
|
||||
const c0 = url.charCodeAt(start);
|
||||
const c1 = url.charCodeAt(start + 1);
|
||||
const c2 = url.charCodeAt(start + 2);
|
||||
const c3 = url.charCodeAt(start + 3);
|
||||
const c4 = url.charCodeAt(start + 4);
|
||||
if (protocolSize === 5 &&
|
||||
c0 === 104 /* 'h' */ &&
|
||||
c1 === 116 /* 't' */ &&
|
||||
c2 === 116 /* 't' */ &&
|
||||
c3 === 112 /* 'p' */ &&
|
||||
c4 === 115 /* 's' */) ;
|
||||
else if (protocolSize === 4 &&
|
||||
c0 === 104 /* 'h' */ &&
|
||||
c1 === 116 /* 't' */ &&
|
||||
c2 === 116 /* 't' */ &&
|
||||
c3 === 112 /* 'p' */) ;
|
||||
else if (protocolSize === 3 &&
|
||||
c0 === 119 /* 'w' */ &&
|
||||
c1 === 115 /* 's' */ &&
|
||||
c2 === 115 /* 's' */) ;
|
||||
else if (protocolSize === 2 &&
|
||||
c0 === 119 /* 'w' */ &&
|
||||
c1 === 115 /* 's' */) ;
|
||||
else {
|
||||
// Check that scheme is valid
|
||||
for (let i = start; i < indexOfProtocol; i += 1) {
|
||||
const lowerCaseCode = url.charCodeAt(i) | 32;
|
||||
if (!(((lowerCaseCode >= 97 && lowerCaseCode <= 122) || // [a, z]
|
||||
(lowerCaseCode >= 48 && lowerCaseCode <= 57) || // [0, 9]
|
||||
lowerCaseCode === 46 || // '.'
|
||||
lowerCaseCode === 45 || // '-'
|
||||
lowerCaseCode === 43) // '+'
|
||||
)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Skip 0, 1 or more '/' after ':/'
|
||||
start = indexOfProtocol + 2;
|
||||
while (url.charCodeAt(start) === 47 /* '/' */) {
|
||||
start += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Detect first occurrence of '/', '?' or '#'. We also keep track of the
|
||||
// last occurrence of '@', ']' or ':' to speed-up subsequent parsing of
|
||||
// (respectively), identifier, ipv6 or port.
|
||||
let indexOfIdentifier = -1;
|
||||
let indexOfClosingBracket = -1;
|
||||
let indexOfPort = -1;
|
||||
for (let i = start; i < end; i += 1) {
|
||||
const code = url.charCodeAt(i);
|
||||
if (code === 35 || // '#'
|
||||
code === 47 || // '/'
|
||||
code === 63 // '?'
|
||||
) {
|
||||
end = i;
|
||||
break;
|
||||
}
|
||||
else if (code === 64) {
|
||||
// '@'
|
||||
indexOfIdentifier = i;
|
||||
}
|
||||
else if (code === 93) {
|
||||
// ']'
|
||||
indexOfClosingBracket = i;
|
||||
}
|
||||
else if (code === 58) {
|
||||
// ':'
|
||||
indexOfPort = i;
|
||||
}
|
||||
else if (code >= 65 && code <= 90) {
|
||||
hasUpper = true;
|
||||
}
|
||||
}
|
||||
// Detect identifier: '@'
|
||||
if (indexOfIdentifier !== -1 &&
|
||||
indexOfIdentifier > start &&
|
||||
indexOfIdentifier < end) {
|
||||
start = indexOfIdentifier + 1;
|
||||
}
|
||||
// Handle ipv6 addresses
|
||||
if (url.charCodeAt(start) === 91 /* '[' */) {
|
||||
if (indexOfClosingBracket !== -1) {
|
||||
return url.slice(start + 1, indexOfClosingBracket).toLowerCase();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else if (indexOfPort !== -1 && indexOfPort > start && indexOfPort < end) {
|
||||
// Detect port: ':'
|
||||
end = indexOfPort;
|
||||
}
|
||||
}
|
||||
// Trim trailing dots
|
||||
while (end > start + 1 && url.charCodeAt(end - 1) === 46 /* '.' */) {
|
||||
end -= 1;
|
||||
}
|
||||
const hostname = start !== 0 || end !== url.length ? url.slice(start, end) : url;
|
||||
if (hasUpper) {
|
||||
return hostname.toLowerCase();
|
||||
}
|
||||
return hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a hostname is an IP. You should be aware that this only works
|
||||
* because `hostname` is already garanteed to be a valid hostname!
|
||||
*/
|
||||
function isProbablyIpv4(hostname) {
|
||||
// Cannot be shorted than 1.1.1.1
|
||||
if (hostname.length < 7) {
|
||||
return false;
|
||||
}
|
||||
// Cannot be longer than: 255.255.255.255
|
||||
if (hostname.length > 15) {
|
||||
return false;
|
||||
}
|
||||
let numberOfDots = 0;
|
||||
for (let i = 0; i < hostname.length; i += 1) {
|
||||
const code = hostname.charCodeAt(i);
|
||||
if (code === 46 /* '.' */) {
|
||||
numberOfDots += 1;
|
||||
}
|
||||
else if (code < 48 /* '0' */ || code > 57 /* '9' */) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return (numberOfDots === 3 &&
|
||||
hostname.charCodeAt(0) !== 46 /* '.' */ &&
|
||||
hostname.charCodeAt(hostname.length - 1) !== 46 /* '.' */);
|
||||
}
|
||||
/**
|
||||
* Similar to isProbablyIpv4.
|
||||
*/
|
||||
function isProbablyIpv6(hostname) {
|
||||
if (hostname.length < 3) {
|
||||
return false;
|
||||
}
|
||||
let start = hostname.startsWith('[') ? 1 : 0;
|
||||
let end = hostname.length;
|
||||
if (hostname[end - 1] === ']') {
|
||||
end -= 1;
|
||||
}
|
||||
// We only consider the maximum size of a normal IPV6. Note that this will
|
||||
// fail on so-called "IPv4 mapped IPv6 addresses" but this is a corner-case
|
||||
// and a proper validation library should be used for these.
|
||||
if (end - start > 39) {
|
||||
return false;
|
||||
}
|
||||
let hasColon = false;
|
||||
for (; start < end; start += 1) {
|
||||
const code = hostname.charCodeAt(start);
|
||||
if (code === 58 /* ':' */) {
|
||||
hasColon = true;
|
||||
}
|
||||
else if (!(((code >= 48 && code <= 57) || // 0-9
|
||||
(code >= 97 && code <= 102) || // a-f
|
||||
(code >= 65 && code <= 90)) // A-F
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return hasColon;
|
||||
}
|
||||
/**
|
||||
* Check if `hostname` is *probably* a valid ip addr (either ipv6 or ipv4).
|
||||
* This *will not* work on any string. We need `hostname` to be a valid
|
||||
* hostname.
|
||||
*/
|
||||
function isIp(hostname) {
|
||||
return isProbablyIpv6(hostname) || isProbablyIpv4(hostname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements fast shallow verification of hostnames. This does not perform a
|
||||
* struct check on the content of labels (classes of Unicode characters, etc.)
|
||||
* but instead check that the structure is valid (number of labels, length of
|
||||
* labels, etc.).
|
||||
*
|
||||
* If you need stricter validation, consider using an external library.
|
||||
*/
|
||||
function isValidAscii(code) {
|
||||
return ((code >= 97 && code <= 122) || (code >= 48 && code <= 57) || code > 127);
|
||||
}
|
||||
/**
|
||||
* Check if a hostname string is valid. It's usually a preliminary check before
|
||||
* trying to use getDomain or anything else.
|
||||
*
|
||||
* Beware: it does not check if the TLD exists.
|
||||
*/
|
||||
function isValidHostname (hostname) {
|
||||
if (hostname.length > 255) {
|
||||
return false;
|
||||
}
|
||||
if (hostname.length === 0) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
/*@__INLINE__*/ !isValidAscii(hostname.charCodeAt(0)) &&
|
||||
hostname.charCodeAt(0) !== 46 && // '.' (dot)
|
||||
hostname.charCodeAt(0) !== 95 // '_' (underscore)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
// Validate hostname according to RFC
|
||||
let lastDotIndex = -1;
|
||||
let lastCharCode = -1;
|
||||
const len = hostname.length;
|
||||
for (let i = 0; i < len; i += 1) {
|
||||
const code = hostname.charCodeAt(i);
|
||||
if (code === 46 /* '.' */) {
|
||||
if (
|
||||
// Check that previous label is < 63 bytes long (64 = 63 + '.')
|
||||
i - lastDotIndex > 64 ||
|
||||
// Check that previous character was not already a '.'
|
||||
lastCharCode === 46 ||
|
||||
// Check that the previous label does not end with a '-' (dash)
|
||||
lastCharCode === 45 ||
|
||||
// Check that the previous label does not end with a '_' (underscore)
|
||||
lastCharCode === 95) {
|
||||
return false;
|
||||
}
|
||||
lastDotIndex = i;
|
||||
}
|
||||
else if (!( /*@__INLINE__*/(isValidAscii(code) || code === 45 || code === 95))) {
|
||||
// Check if there is a forbidden character in the label
|
||||
return false;
|
||||
}
|
||||
lastCharCode = code;
|
||||
}
|
||||
return (
|
||||
// Check that last label is shorter than 63 chars
|
||||
len - lastDotIndex - 1 <= 63 &&
|
||||
// Check that the last character is an allowed trailing label character.
|
||||
// Since we already checked that the char is a valid hostname character,
|
||||
// we only need to check that it's different from '-'.
|
||||
lastCharCode !== 45);
|
||||
}
|
||||
|
||||
function setDefaultsImpl({ allowIcannDomains = true, allowPrivateDomains = false, detectIp = true, extractHostname = true, mixedInputs = true, validHosts = null, validateHostname = true, }) {
|
||||
return {
|
||||
allowIcannDomains,
|
||||
allowPrivateDomains,
|
||||
detectIp,
|
||||
extractHostname,
|
||||
mixedInputs,
|
||||
validHosts,
|
||||
validateHostname,
|
||||
};
|
||||
}
|
||||
const DEFAULT_OPTIONS = /*@__INLINE__*/ setDefaultsImpl({});
|
||||
function setDefaults(options) {
|
||||
if (options === undefined) {
|
||||
return DEFAULT_OPTIONS;
|
||||
}
|
||||
return /*@__INLINE__*/ setDefaultsImpl(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the subdomain of a hostname string
|
||||
*/
|
||||
function getSubdomain(hostname, domain) {
|
||||
// If `hostname` and `domain` are the same, then there is no sub-domain
|
||||
if (domain.length === hostname.length) {
|
||||
return '';
|
||||
}
|
||||
return hostname.slice(0, -domain.length - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement a factory allowing to plug different implementations of suffix
|
||||
* lookup (e.g.: using a trie or the packed hashes datastructures). This is used
|
||||
* and exposed in `tldts.ts` and `tldts-experimental.ts` bundle entrypoints.
|
||||
*/
|
||||
function getEmptyResult() {
|
||||
return {
|
||||
domain: null,
|
||||
domainWithoutSuffix: null,
|
||||
hostname: null,
|
||||
isIcann: null,
|
||||
isIp: null,
|
||||
isPrivate: null,
|
||||
publicSuffix: null,
|
||||
subdomain: null,
|
||||
};
|
||||
}
|
||||
function resetResult(result) {
|
||||
result.domain = null;
|
||||
result.domainWithoutSuffix = null;
|
||||
result.hostname = null;
|
||||
result.isIcann = null;
|
||||
result.isIp = null;
|
||||
result.isPrivate = null;
|
||||
result.publicSuffix = null;
|
||||
result.subdomain = null;
|
||||
}
|
||||
function parseImpl(url, step, suffixLookup, partialOptions, result) {
|
||||
const options = /*@__INLINE__*/ setDefaults(partialOptions);
|
||||
// Very fast approximate check to make sure `url` is a string. This is needed
|
||||
// because the library will not necessarily be used in a typed setup and
|
||||
// values of arbitrary types might be given as argument.
|
||||
if (typeof url !== 'string') {
|
||||
return result;
|
||||
}
|
||||
// Extract hostname from `url` only if needed. This can be made optional
|
||||
// using `options.extractHostname`. This option will typically be used
|
||||
// whenever we are sure the inputs to `parse` are already hostnames and not
|
||||
// arbitrary URLs.
|
||||
//
|
||||
// `mixedInput` allows to specify if we expect a mix of URLs and hostnames
|
||||
// as input. If only hostnames are expected then `extractHostname` can be
|
||||
// set to `false` to speed-up parsing. If only URLs are expected then
|
||||
// `mixedInputs` can be set to `false`. The `mixedInputs` is only a hint
|
||||
// and will not change the behavior of the library.
|
||||
if (!options.extractHostname) {
|
||||
result.hostname = url;
|
||||
}
|
||||
else if (options.mixedInputs) {
|
||||
result.hostname = extractHostname(url, isValidHostname(url));
|
||||
}
|
||||
else {
|
||||
result.hostname = extractHostname(url, false);
|
||||
}
|
||||
if (step === 0 /* FLAG.HOSTNAME */ || result.hostname === null) {
|
||||
return result;
|
||||
}
|
||||
// Check if `hostname` is a valid ip address
|
||||
if (options.detectIp) {
|
||||
result.isIp = isIp(result.hostname);
|
||||
if (result.isIp) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// Perform optional hostname validation. If hostname is not valid, no need to
|
||||
// go further as there will be no valid domain or sub-domain.
|
||||
if (options.validateHostname &&
|
||||
options.extractHostname &&
|
||||
!isValidHostname(result.hostname)) {
|
||||
result.hostname = null;
|
||||
return result;
|
||||
}
|
||||
// Extract public suffix
|
||||
suffixLookup(result.hostname, options, result);
|
||||
if (step === 2 /* FLAG.PUBLIC_SUFFIX */ || result.publicSuffix === null) {
|
||||
return result;
|
||||
}
|
||||
// Extract domain
|
||||
result.domain = getDomain(result.publicSuffix, result.hostname, options);
|
||||
if (step === 3 /* FLAG.DOMAIN */ || result.domain === null) {
|
||||
return result;
|
||||
}
|
||||
// Extract subdomain
|
||||
result.subdomain = getSubdomain(result.hostname, result.domain);
|
||||
if (step === 4 /* FLAG.SUB_DOMAIN */) {
|
||||
return result;
|
||||
}
|
||||
// Extract domain without suffix
|
||||
result.domainWithoutSuffix = getDomainWithoutSuffix(result.domain, result.publicSuffix);
|
||||
return result;
|
||||
}
|
||||
|
||||
function fastPath (hostname, options, out) {
|
||||
// Fast path for very popular suffixes; this allows to by-pass lookup
|
||||
// completely as well as any extra allocation or string manipulation.
|
||||
if (!options.allowPrivateDomains && hostname.length > 3) {
|
||||
const last = hostname.length - 1;
|
||||
const c3 = hostname.charCodeAt(last);
|
||||
const c2 = hostname.charCodeAt(last - 1);
|
||||
const c1 = hostname.charCodeAt(last - 2);
|
||||
const c0 = hostname.charCodeAt(last - 3);
|
||||
if (c3 === 109 /* 'm' */ &&
|
||||
c2 === 111 /* 'o' */ &&
|
||||
c1 === 99 /* 'c' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'com';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 103 /* 'g' */ &&
|
||||
c2 === 114 /* 'r' */ &&
|
||||
c1 === 111 /* 'o' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'org';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 117 /* 'u' */ &&
|
||||
c2 === 100 /* 'd' */ &&
|
||||
c1 === 101 /* 'e' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'edu';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 118 /* 'v' */ &&
|
||||
c2 === 111 /* 'o' */ &&
|
||||
c1 === 103 /* 'g' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'gov';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 116 /* 't' */ &&
|
||||
c2 === 101 /* 'e' */ &&
|
||||
c1 === 110 /* 'n' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'net';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 101 /* 'e' */ &&
|
||||
c2 === 100 /* 'd' */ &&
|
||||
c1 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'de';
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
exports.fastPathLookup = fastPath;
|
||||
exports.getEmptyResult = getEmptyResult;
|
||||
exports.parseImpl = parseImpl;
|
||||
exports.resetResult = resetResult;
|
||||
exports.setDefaults = setDefaults;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/cjs/index.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/cjs/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
15
frontend/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js
generated
vendored
Normal file
15
frontend/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = getDomainWithoutSuffix;
|
||||
/**
|
||||
* Return the part of domain without suffix.
|
||||
*
|
||||
* Example: for domain 'foo.com', the result would be 'foo'.
|
||||
*/
|
||||
function getDomainWithoutSuffix(domain, suffix) {
|
||||
// Note: here `domain` and `suffix` cannot have the same length because in
|
||||
// this case we set `domain` to `null` instead. It is thus safe to assume
|
||||
// that `suffix` is shorter than `domain`.
|
||||
return domain.slice(0, -suffix.length - 1);
|
||||
}
|
||||
//# sourceMappingURL=domain-without-suffix.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"domain-without-suffix.js","sourceRoot":"","sources":["../../../src/domain-without-suffix.ts"],"names":[],"mappings":";;AAKA,yCAQC;AAbD;;;;GAIG;AACH,SAAwB,sBAAsB,CAC5C,MAAc,EACd,MAAc;IAEd,0EAA0E;IAC1E,yEAAyE;IACzE,0CAA0C;IAC1C,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
||||
83
frontend/node_modules/tldts-core/dist/cjs/src/domain.js
generated
vendored
Normal file
83
frontend/node_modules/tldts-core/dist/cjs/src/domain.js
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = getDomain;
|
||||
/**
|
||||
* Check if `vhost` is a valid suffix of `hostname` (top-domain)
|
||||
*
|
||||
* It means that `vhost` needs to be a suffix of `hostname` and we then need to
|
||||
* make sure that: either they are equal, or the character preceding `vhost` in
|
||||
* `hostname` is a '.' (it should not be a partial label).
|
||||
*
|
||||
* * hostname = 'not.evil.com' and vhost = 'vil.com' => not ok
|
||||
* * hostname = 'not.evil.com' and vhost = 'evil.com' => ok
|
||||
* * hostname = 'not.evil.com' and vhost = 'not.evil.com' => ok
|
||||
*/
|
||||
function shareSameDomainSuffix(hostname, vhost) {
|
||||
if (hostname.endsWith(vhost)) {
|
||||
return (hostname.length === vhost.length ||
|
||||
hostname[hostname.length - vhost.length - 1] === '.');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Given a hostname and its public suffix, extract the general domain.
|
||||
*/
|
||||
function extractDomainWithSuffix(hostname, publicSuffix) {
|
||||
// Locate the index of the last '.' in the part of the `hostname` preceding
|
||||
// the public suffix.
|
||||
//
|
||||
// examples:
|
||||
// 1. not.evil.co.uk => evil.co.uk
|
||||
// ^ ^
|
||||
// | | start of public suffix
|
||||
// | index of the last dot
|
||||
//
|
||||
// 2. example.co.uk => example.co.uk
|
||||
// ^ ^
|
||||
// | | start of public suffix
|
||||
// |
|
||||
// | (-1) no dot found before the public suffix
|
||||
const publicSuffixIndex = hostname.length - publicSuffix.length - 2;
|
||||
const lastDotBeforeSuffixIndex = hostname.lastIndexOf('.', publicSuffixIndex);
|
||||
// No '.' found, then `hostname` is the general domain (no sub-domain)
|
||||
if (lastDotBeforeSuffixIndex === -1) {
|
||||
return hostname;
|
||||
}
|
||||
// Extract the part between the last '.'
|
||||
return hostname.slice(lastDotBeforeSuffixIndex + 1);
|
||||
}
|
||||
/**
|
||||
* Detects the domain based on rules and upon and a host string
|
||||
*/
|
||||
function getDomain(suffix, hostname, options) {
|
||||
// Check if `hostname` ends with a member of `validHosts`.
|
||||
if (options.validHosts !== null) {
|
||||
const validHosts = options.validHosts;
|
||||
for (const vhost of validHosts) {
|
||||
if ( /*@__INLINE__*/shareSameDomainSuffix(hostname, vhost)) {
|
||||
return vhost;
|
||||
}
|
||||
}
|
||||
}
|
||||
let numberOfLeadingDots = 0;
|
||||
if (hostname.startsWith('.')) {
|
||||
while (numberOfLeadingDots < hostname.length &&
|
||||
hostname[numberOfLeadingDots] === '.') {
|
||||
numberOfLeadingDots += 1;
|
||||
}
|
||||
}
|
||||
// If `hostname` is a valid public suffix, then there is no domain to return.
|
||||
// Since we already know that `getPublicSuffix` returns a suffix of `hostname`
|
||||
// there is no need to perform a string comparison and we only compare the
|
||||
// size.
|
||||
if (suffix.length === hostname.length - numberOfLeadingDots) {
|
||||
return null;
|
||||
}
|
||||
// To extract the general domain, we start by identifying the public suffix
|
||||
// (if any), then consider the domain to be the public suffix with one added
|
||||
// level of depth. (e.g.: if hostname is `not.evil.co.uk` and public suffix:
|
||||
// `co.uk`, then we take one more level: `evil`, giving the final result:
|
||||
// `evil.co.uk`).
|
||||
return /*@__INLINE__*/ extractDomainWithSuffix(hostname, suffix);
|
||||
}
|
||||
//# sourceMappingURL=domain.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/cjs/src/domain.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/cjs/src/domain.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../src/domain.ts"],"names":[],"mappings":";;AA4DA,4BAuCC;AAjGD;;;;;;;;;;GAUG;AACH,SAAS,qBAAqB,CAAC,QAAgB,EAAE,KAAa;IAC5D,IAAI,QAAQ,CAAC,QAAQ,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AED,IAAI,mBAAmB,GAAG,CAAC,CAAC;IAC5B,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,OACE,mBAAmB,GAAG,QAAQ,CAAC,MAAM;YACrC,QAAQ,CAAC,mBAAmB,CAAC,KAAK,GAAG,EACrC,CAAC;YACD,mBAAmB,IAAI,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,6EAA6E;IAC7E,8EAA8E;IAC9E,0EAA0E;IAC1E,QAAQ;IACR,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,GAAG,mBAAmB,EAAE,CAAC;QAC5D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,2EAA2E;IAC3E,4EAA4E;IAC5E,4EAA4E;IAC5E,yEAAyE;IACzE,iBAAiB;IACjB,OAAO,eAAe,CAAC,uBAAuB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACnE,CAAC"}
|
||||
149
frontend/node_modules/tldts-core/dist/cjs/src/extract-hostname.js
generated
vendored
Normal file
149
frontend/node_modules/tldts-core/dist/cjs/src/extract-hostname.js
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = extractHostname;
|
||||
/**
|
||||
* @param url - URL we want to extract a hostname from.
|
||||
* @param urlIsValidHostname - hint from caller; true if `url` is already a valid hostname.
|
||||
*/
|
||||
function extractHostname(url, urlIsValidHostname) {
|
||||
let start = 0;
|
||||
let end = url.length;
|
||||
let hasUpper = false;
|
||||
// If url is not already a valid hostname, then try to extract hostname.
|
||||
if (!urlIsValidHostname) {
|
||||
// Special handling of data URLs
|
||||
if (url.startsWith('data:')) {
|
||||
return null;
|
||||
}
|
||||
// Trim leading spaces
|
||||
while (start < url.length && url.charCodeAt(start) <= 32) {
|
||||
start += 1;
|
||||
}
|
||||
// Trim trailing spaces
|
||||
while (end > start + 1 && url.charCodeAt(end - 1) <= 32) {
|
||||
end -= 1;
|
||||
}
|
||||
// Skip scheme.
|
||||
if (url.charCodeAt(start) === 47 /* '/' */ &&
|
||||
url.charCodeAt(start + 1) === 47 /* '/' */) {
|
||||
start += 2;
|
||||
}
|
||||
else {
|
||||
const indexOfProtocol = url.indexOf(':/', start);
|
||||
if (indexOfProtocol !== -1) {
|
||||
// Implement fast-path for common protocols. We expect most protocols
|
||||
// should be one of these 4 and thus we will not need to perform the
|
||||
// more expansive validity check most of the time.
|
||||
const protocolSize = indexOfProtocol - start;
|
||||
const c0 = url.charCodeAt(start);
|
||||
const c1 = url.charCodeAt(start + 1);
|
||||
const c2 = url.charCodeAt(start + 2);
|
||||
const c3 = url.charCodeAt(start + 3);
|
||||
const c4 = url.charCodeAt(start + 4);
|
||||
if (protocolSize === 5 &&
|
||||
c0 === 104 /* 'h' */ &&
|
||||
c1 === 116 /* 't' */ &&
|
||||
c2 === 116 /* 't' */ &&
|
||||
c3 === 112 /* 'p' */ &&
|
||||
c4 === 115 /* 's' */) {
|
||||
// https
|
||||
}
|
||||
else if (protocolSize === 4 &&
|
||||
c0 === 104 /* 'h' */ &&
|
||||
c1 === 116 /* 't' */ &&
|
||||
c2 === 116 /* 't' */ &&
|
||||
c3 === 112 /* 'p' */) {
|
||||
// http
|
||||
}
|
||||
else if (protocolSize === 3 &&
|
||||
c0 === 119 /* 'w' */ &&
|
||||
c1 === 115 /* 's' */ &&
|
||||
c2 === 115 /* 's' */) {
|
||||
// wss
|
||||
}
|
||||
else if (protocolSize === 2 &&
|
||||
c0 === 119 /* 'w' */ &&
|
||||
c1 === 115 /* 's' */) {
|
||||
// ws
|
||||
}
|
||||
else {
|
||||
// Check that scheme is valid
|
||||
for (let i = start; i < indexOfProtocol; i += 1) {
|
||||
const lowerCaseCode = url.charCodeAt(i) | 32;
|
||||
if (!(((lowerCaseCode >= 97 && lowerCaseCode <= 122) || // [a, z]
|
||||
(lowerCaseCode >= 48 && lowerCaseCode <= 57) || // [0, 9]
|
||||
lowerCaseCode === 46 || // '.'
|
||||
lowerCaseCode === 45 || // '-'
|
||||
lowerCaseCode === 43) // '+'
|
||||
)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Skip 0, 1 or more '/' after ':/'
|
||||
start = indexOfProtocol + 2;
|
||||
while (url.charCodeAt(start) === 47 /* '/' */) {
|
||||
start += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Detect first occurrence of '/', '?' or '#'. We also keep track of the
|
||||
// last occurrence of '@', ']' or ':' to speed-up subsequent parsing of
|
||||
// (respectively), identifier, ipv6 or port.
|
||||
let indexOfIdentifier = -1;
|
||||
let indexOfClosingBracket = -1;
|
||||
let indexOfPort = -1;
|
||||
for (let i = start; i < end; i += 1) {
|
||||
const code = url.charCodeAt(i);
|
||||
if (code === 35 || // '#'
|
||||
code === 47 || // '/'
|
||||
code === 63 // '?'
|
||||
) {
|
||||
end = i;
|
||||
break;
|
||||
}
|
||||
else if (code === 64) {
|
||||
// '@'
|
||||
indexOfIdentifier = i;
|
||||
}
|
||||
else if (code === 93) {
|
||||
// ']'
|
||||
indexOfClosingBracket = i;
|
||||
}
|
||||
else if (code === 58) {
|
||||
// ':'
|
||||
indexOfPort = i;
|
||||
}
|
||||
else if (code >= 65 && code <= 90) {
|
||||
hasUpper = true;
|
||||
}
|
||||
}
|
||||
// Detect identifier: '@'
|
||||
if (indexOfIdentifier !== -1 &&
|
||||
indexOfIdentifier > start &&
|
||||
indexOfIdentifier < end) {
|
||||
start = indexOfIdentifier + 1;
|
||||
}
|
||||
// Handle ipv6 addresses
|
||||
if (url.charCodeAt(start) === 91 /* '[' */) {
|
||||
if (indexOfClosingBracket !== -1) {
|
||||
return url.slice(start + 1, indexOfClosingBracket).toLowerCase();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else if (indexOfPort !== -1 && indexOfPort > start && indexOfPort < end) {
|
||||
// Detect port: ':'
|
||||
end = indexOfPort;
|
||||
}
|
||||
}
|
||||
// Trim trailing dots
|
||||
while (end > start + 1 && url.charCodeAt(end - 1) === 46 /* '.' */) {
|
||||
end -= 1;
|
||||
}
|
||||
const hostname = start !== 0 || end !== url.length ? url.slice(start, end) : url;
|
||||
if (hasUpper) {
|
||||
return hostname.toLowerCase();
|
||||
}
|
||||
return hostname;
|
||||
}
|
||||
//# sourceMappingURL=extract-hostname.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/cjs/src/extract-hostname.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/cjs/src/extract-hostname.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"extract-hostname.js","sourceRoot":"","sources":["../../../src/extract-hostname.ts"],"names":[],"mappings":";;AAIA,kCAqKC;AAzKD;;;GAGG;AACH,SAAwB,eAAe,CACrC,GAAW,EACX,kBAA2B;IAE3B,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,GAAG,GAAW,GAAG,CAAC,MAAM,CAAC;IAC7B,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,wEAAwE;IACxE,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,gCAAgC;QAChC,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,sBAAsB;QACtB,OAAO,KAAK,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;YACzD,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;QAED,uBAAuB;QACvB,OAAO,GAAG,GAAG,KAAK,GAAG,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YACxD,GAAG,IAAI,CAAC,CAAC;QACX,CAAC;QAED,eAAe;QACf,IACE,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,SAAS;YACtC,GAAG,CAAC,U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,CAAC;QACd,CAAC;aAAM,IAAI,WAAW,KAAK,CAAC,CAAC,IAAI,WAAW,GAAG,KAAK,IAAI,WAAW,GAAG,GAAG,EAAE,CAAC;YAC1E,mBAAmB;YACnB,GAAG,GAAG,WAAW,CAAC;QACpB,CAAC;IACH,CAAC;IAED,qBAAqB;IACrB,OAAO,GAAG,GAAG,KAAK,GAAG,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,CAAC;QACnE,GAAG,IAAI,CAAC,CAAC;IACX,CAAC;IAED,MAAM,QAAQ,GACZ,KAAK,KAAK,CAAC,IAAI,GAAG,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAElE,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;IAChC,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
||||
104
frontend/node_modules/tldts-core/dist/cjs/src/factory.js
generated
vendored
Normal file
104
frontend/node_modules/tldts-core/dist/cjs/src/factory.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Implement a factory allowing to plug different implementations of suffix
|
||||
* lookup (e.g.: using a trie or the packed hashes datastructures). This is used
|
||||
* and exposed in `tldts.ts` and `tldts-experimental.ts` bundle entrypoints.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getEmptyResult = getEmptyResult;
|
||||
exports.resetResult = resetResult;
|
||||
exports.parseImpl = parseImpl;
|
||||
const domain_1 = require("./domain");
|
||||
const domain_without_suffix_1 = require("./domain-without-suffix");
|
||||
const extract_hostname_1 = require("./extract-hostname");
|
||||
const is_ip_1 = require("./is-ip");
|
||||
const is_valid_1 = require("./is-valid");
|
||||
const options_1 = require("./options");
|
||||
const subdomain_1 = require("./subdomain");
|
||||
function getEmptyResult() {
|
||||
return {
|
||||
domain: null,
|
||||
domainWithoutSuffix: null,
|
||||
hostname: null,
|
||||
isIcann: null,
|
||||
isIp: null,
|
||||
isPrivate: null,
|
||||
publicSuffix: null,
|
||||
subdomain: null,
|
||||
};
|
||||
}
|
||||
function resetResult(result) {
|
||||
result.domain = null;
|
||||
result.domainWithoutSuffix = null;
|
||||
result.hostname = null;
|
||||
result.isIcann = null;
|
||||
result.isIp = null;
|
||||
result.isPrivate = null;
|
||||
result.publicSuffix = null;
|
||||
result.subdomain = null;
|
||||
}
|
||||
function parseImpl(url, step, suffixLookup, partialOptions, result) {
|
||||
const options = /*@__INLINE__*/ (0, options_1.setDefaults)(partialOptions);
|
||||
// Very fast approximate check to make sure `url` is a string. This is needed
|
||||
// because the library will not necessarily be used in a typed setup and
|
||||
// values of arbitrary types might be given as argument.
|
||||
if (typeof url !== 'string') {
|
||||
return result;
|
||||
}
|
||||
// Extract hostname from `url` only if needed. This can be made optional
|
||||
// using `options.extractHostname`. This option will typically be used
|
||||
// whenever we are sure the inputs to `parse` are already hostnames and not
|
||||
// arbitrary URLs.
|
||||
//
|
||||
// `mixedInput` allows to specify if we expect a mix of URLs and hostnames
|
||||
// as input. If only hostnames are expected then `extractHostname` can be
|
||||
// set to `false` to speed-up parsing. If only URLs are expected then
|
||||
// `mixedInputs` can be set to `false`. The `mixedInputs` is only a hint
|
||||
// and will not change the behavior of the library.
|
||||
if (!options.extractHostname) {
|
||||
result.hostname = url;
|
||||
}
|
||||
else if (options.mixedInputs) {
|
||||
result.hostname = (0, extract_hostname_1.default)(url, (0, is_valid_1.default)(url));
|
||||
}
|
||||
else {
|
||||
result.hostname = (0, extract_hostname_1.default)(url, false);
|
||||
}
|
||||
if (step === 0 /* FLAG.HOSTNAME */ || result.hostname === null) {
|
||||
return result;
|
||||
}
|
||||
// Check if `hostname` is a valid ip address
|
||||
if (options.detectIp) {
|
||||
result.isIp = (0, is_ip_1.default)(result.hostname);
|
||||
if (result.isIp) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// Perform optional hostname validation. If hostname is not valid, no need to
|
||||
// go further as there will be no valid domain or sub-domain.
|
||||
if (options.validateHostname &&
|
||||
options.extractHostname &&
|
||||
!(0, is_valid_1.default)(result.hostname)) {
|
||||
result.hostname = null;
|
||||
return result;
|
||||
}
|
||||
// Extract public suffix
|
||||
suffixLookup(result.hostname, options, result);
|
||||
if (step === 2 /* FLAG.PUBLIC_SUFFIX */ || result.publicSuffix === null) {
|
||||
return result;
|
||||
}
|
||||
// Extract domain
|
||||
result.domain = (0, domain_1.default)(result.publicSuffix, result.hostname, options);
|
||||
if (step === 3 /* FLAG.DOMAIN */ || result.domain === null) {
|
||||
return result;
|
||||
}
|
||||
// Extract subdomain
|
||||
result.subdomain = (0, subdomain_1.default)(result.hostname, result.domain);
|
||||
if (step === 4 /* FLAG.SUB_DOMAIN */) {
|
||||
return result;
|
||||
}
|
||||
// Extract domain without suffix
|
||||
result.domainWithoutSuffix = (0, domain_without_suffix_1.default)(result.domain, result.publicSuffix);
|
||||
return result;
|
||||
}
|
||||
//# sourceMappingURL=factory.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/cjs/src/factory.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/cjs/src/factory.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/factory.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAgCH,wCAWC;AAED,kCASC;AAeD,8BAsFC;AAzJD,qCAAiC;AACjC,mEAA6D;AAC7D,yDAAiD;AACjD,mCAA2B;AAC3B,yCAAyC;AAEzC,uCAAkD;AAClD,2CAAuC;AAuBvC,SAAgB,cAAc;IAC5B,OAAO;QACL,MAAM,EAAE,IAAI;QACZ,mBAAmB,EAAE,IAAI;QACzB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;QACb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,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,gCAAgC;IAChC,MAAM,CAAC,mBAAmB,GAAG,IAAA,+BAAsB,EACjD,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,YAAY,CACpB,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
||||
72
frontend/node_modules/tldts-core/dist/cjs/src/is-ip.js
generated
vendored
Normal file
72
frontend/node_modules/tldts-core/dist/cjs/src/is-ip.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = isIp;
|
||||
/**
|
||||
* Check if a hostname is an IP. You should be aware that this only works
|
||||
* because `hostname` is already garanteed to be a valid hostname!
|
||||
*/
|
||||
function isProbablyIpv4(hostname) {
|
||||
// Cannot be shorted than 1.1.1.1
|
||||
if (hostname.length < 7) {
|
||||
return false;
|
||||
}
|
||||
// Cannot be longer than: 255.255.255.255
|
||||
if (hostname.length > 15) {
|
||||
return false;
|
||||
}
|
||||
let numberOfDots = 0;
|
||||
for (let i = 0; i < hostname.length; i += 1) {
|
||||
const code = hostname.charCodeAt(i);
|
||||
if (code === 46 /* '.' */) {
|
||||
numberOfDots += 1;
|
||||
}
|
||||
else if (code < 48 /* '0' */ || code > 57 /* '9' */) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return (numberOfDots === 3 &&
|
||||
hostname.charCodeAt(0) !== 46 /* '.' */ &&
|
||||
hostname.charCodeAt(hostname.length - 1) !== 46 /* '.' */);
|
||||
}
|
||||
/**
|
||||
* Similar to isProbablyIpv4.
|
||||
*/
|
||||
function isProbablyIpv6(hostname) {
|
||||
if (hostname.length < 3) {
|
||||
return false;
|
||||
}
|
||||
let start = hostname.startsWith('[') ? 1 : 0;
|
||||
let end = hostname.length;
|
||||
if (hostname[end - 1] === ']') {
|
||||
end -= 1;
|
||||
}
|
||||
// We only consider the maximum size of a normal IPV6. Note that this will
|
||||
// fail on so-called "IPv4 mapped IPv6 addresses" but this is a corner-case
|
||||
// and a proper validation library should be used for these.
|
||||
if (end - start > 39) {
|
||||
return false;
|
||||
}
|
||||
let hasColon = false;
|
||||
for (; start < end; start += 1) {
|
||||
const code = hostname.charCodeAt(start);
|
||||
if (code === 58 /* ':' */) {
|
||||
hasColon = true;
|
||||
}
|
||||
else if (!(((code >= 48 && code <= 57) || // 0-9
|
||||
(code >= 97 && code <= 102) || // a-f
|
||||
(code >= 65 && code <= 90)) // A-F
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return hasColon;
|
||||
}
|
||||
/**
|
||||
* Check if `hostname` is *probably* a valid ip addr (either ipv6 or ipv4).
|
||||
* This *will not* work on any string. We need `hostname` to be a valid
|
||||
* hostname.
|
||||
*/
|
||||
function isIp(hostname) {
|
||||
return isProbablyIpv6(hostname) || isProbablyIpv4(hostname);
|
||||
}
|
||||
//# sourceMappingURL=is-ip.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/cjs/src/is-ip.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/cjs/src/is-ip.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"is-ip.js","sourceRoot":"","sources":["../../../src/is-ip.ts"],"names":[],"mappings":";;AAoFA,uBAEC;AAtFD;;;GAGG;AACH,SAAS,cAAc,CAAC,QAAgB;IACtC,iCAAiC;IACjC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,yCAAyC;IACzC,IAAI,QAAQ,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,GAAG,QAA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AAK,EAAE,CAAC,SAAS,EAAE,CAAC;YAC1B,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC;aAAM,IACL,CAAC,CACC,CACE,CAAC,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,IAAI,MAAM;YACpC,CAAC,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,GAAG,CAAC,IAAI,MAAM;YACrC,CAAC,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,CAC3B,CAAC,MAAM;SACT,EACD,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,SAAwB,IAAI,CAAC,QAAgB;IAC3C,OAAO,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAC;AAC9D,CAAC"}
|
||||
69
frontend/node_modules/tldts-core/dist/cjs/src/is-valid.js
generated
vendored
Normal file
69
frontend/node_modules/tldts-core/dist/cjs/src/is-valid.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Implements fast shallow verification of hostnames. This does not perform a
|
||||
* struct check on the content of labels (classes of Unicode characters, etc.)
|
||||
* but instead check that the structure is valid (number of labels, length of
|
||||
* labels, etc.).
|
||||
*
|
||||
* If you need stricter validation, consider using an external library.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
function isValidAscii(code) {
|
||||
return ((code >= 97 && code <= 122) || (code >= 48 && code <= 57) || code > 127);
|
||||
}
|
||||
/**
|
||||
* Check if a hostname string is valid. It's usually a preliminary check before
|
||||
* trying to use getDomain or anything else.
|
||||
*
|
||||
* Beware: it does not check if the TLD exists.
|
||||
*/
|
||||
function default_1(hostname) {
|
||||
if (hostname.length > 255) {
|
||||
return false;
|
||||
}
|
||||
if (hostname.length === 0) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
/*@__INLINE__*/ !isValidAscii(hostname.charCodeAt(0)) &&
|
||||
hostname.charCodeAt(0) !== 46 && // '.' (dot)
|
||||
hostname.charCodeAt(0) !== 95 // '_' (underscore)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
// Validate hostname according to RFC
|
||||
let lastDotIndex = -1;
|
||||
let lastCharCode = -1;
|
||||
const len = hostname.length;
|
||||
for (let i = 0; i < len; i += 1) {
|
||||
const code = hostname.charCodeAt(i);
|
||||
if (code === 46 /* '.' */) {
|
||||
if (
|
||||
// Check that previous label is < 63 bytes long (64 = 63 + '.')
|
||||
i - lastDotIndex > 64 ||
|
||||
// Check that previous character was not already a '.'
|
||||
lastCharCode === 46 ||
|
||||
// Check that the previous label does not end with a '-' (dash)
|
||||
lastCharCode === 45 ||
|
||||
// Check that the previous label does not end with a '_' (underscore)
|
||||
lastCharCode === 95) {
|
||||
return false;
|
||||
}
|
||||
lastDotIndex = i;
|
||||
}
|
||||
else if (!( /*@__INLINE__*/(isValidAscii(code) || code === 45 || code === 95))) {
|
||||
// Check if there is a forbidden character in the label
|
||||
return false;
|
||||
}
|
||||
lastCharCode = code;
|
||||
}
|
||||
return (
|
||||
// Check that last label is shorter than 63 chars
|
||||
len - lastDotIndex - 1 <= 63 &&
|
||||
// Check that the last character is an allowed trailing label character.
|
||||
// Since we already checked that the char is a valid hostname character,
|
||||
// we only need to check that it's different from '-'.
|
||||
lastCharCode !== 45);
|
||||
}
|
||||
//# sourceMappingURL=is-valid.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/cjs/src/is-valid.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/cjs/src/is-valid.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"is-valid.js","sourceRoot":"","sources":["../../../src/is-valid.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAcH,4BAyDC;AArED,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,CACL,CAAC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AAC;YAED,YAAY,GAAG,CAAC,CAAC;QACnB,CAAC;aAAM,IACL,CAAC,EAAC,eAAgB,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,EACrE,CAAC;YACD,uDAAuD;YACvD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,YAAY,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,OAAO;IACL,iDAAiD;IACjD,GAAG,GAAG,YAAY,GAAG,CAAC,IAAI,EAAE;QAC5B,wEAAwE;QACxE,wEAAwE;QACxE,sDAAsD;QACtD,YAAY,KAAK,EAAE,CACpB,CAAC;AACJ,CAAC"}
|
||||
69
frontend/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js
generated
vendored
Normal file
69
frontend/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
function default_1(hostname, options, out) {
|
||||
// Fast path for very popular suffixes; this allows to by-pass lookup
|
||||
// completely as well as any extra allocation or string manipulation.
|
||||
if (!options.allowPrivateDomains && hostname.length > 3) {
|
||||
const last = hostname.length - 1;
|
||||
const c3 = hostname.charCodeAt(last);
|
||||
const c2 = hostname.charCodeAt(last - 1);
|
||||
const c1 = hostname.charCodeAt(last - 2);
|
||||
const c0 = hostname.charCodeAt(last - 3);
|
||||
if (c3 === 109 /* 'm' */ &&
|
||||
c2 === 111 /* 'o' */ &&
|
||||
c1 === 99 /* 'c' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'com';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 103 /* 'g' */ &&
|
||||
c2 === 114 /* 'r' */ &&
|
||||
c1 === 111 /* 'o' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'org';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 117 /* 'u' */ &&
|
||||
c2 === 100 /* 'd' */ &&
|
||||
c1 === 101 /* 'e' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'edu';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 118 /* 'v' */ &&
|
||||
c2 === 111 /* 'o' */ &&
|
||||
c1 === 103 /* 'g' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'gov';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 116 /* 't' */ &&
|
||||
c2 === 101 /* 'e' */ &&
|
||||
c1 === 110 /* 'n' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'net';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 101 /* 'e' */ &&
|
||||
c2 === 100 /* 'd' */ &&
|
||||
c1 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'de';
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//# sourceMappingURL=fast-path.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fast-path.js","sourceRoot":"","sources":["../../../../src/lookup/fast-path.ts"],"names":[],"mappings":";;AAEA,4BA6EC;AA7ED,mBACE,QAAgB,EAChB,OAA6B,EAC7B,GAAkB;IAElB,qEAAqE;IACrE,qEAAqE;IACrE,IAAI,CAAC,OAAO,CAAC,mBAAmB,IAAI,QAAQ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O,GAAG,IAAI,CAAC;YACnB,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC;YACtB,GAAG,CAAC,YAAY,GAAG,KAAK,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;aAAM,IACL,EAAE,KAAK,GAAG,CAAC,SAAS;YACpB,EAAE,KAAK,GAAG,CAAC,SAAS;YACpB,EAAE,KAAK,GAAG,CAAC,SAAS;YACpB,EAAE,KAAK,EAAE,CAAC,SAAS,EACnB,CAAC;YACD,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;YACnB,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC;YACtB,GAAG,CAAC,YAAY,GAAG,KAAK,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;aAAM,IACL,EAAE,KAAK,GAAG,CAAC,SAAS;YACpB,EAAE,KAAK,GAAG,CAAC,SAAS;YACpB,EAAE,KAAK,GAAG,CAAC,SAAS;YACpB,EAAE,KAAK,EAAE,CAAC,SAAS,EACnB,CAAC;YACD,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;YACnB,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC;YACtB,GAAG,CAAC,YAAY,GAAG,KAAK,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;aAAM,IACL,EAAE,KAAK,GAAG,CAAC,SAAS;YACpB,EAAE,KAAK,GAAG,CAAC,SAAS;YACpB,EAAE,KAAK,EAAE,CAAC,SAAS,EACnB,CAAC;YACD,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;YACnB,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC;YACtB,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC;YACxB,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
||||
3
frontend/node_modules/tldts-core/dist/cjs/src/lookup/interface.js
generated
vendored
Normal file
3
frontend/node_modules/tldts-core/dist/cjs/src/lookup/interface.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=interface.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/cjs/src/lookup/interface.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/cjs/src/lookup/interface.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/lookup/interface.ts"],"names":[],"mappings":""}
|
||||
22
frontend/node_modules/tldts-core/dist/cjs/src/options.js
generated
vendored
Normal file
22
frontend/node_modules/tldts-core/dist/cjs/src/options.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.setDefaults = setDefaults;
|
||||
function setDefaultsImpl({ allowIcannDomains = true, allowPrivateDomains = false, detectIp = true, extractHostname = true, mixedInputs = true, validHosts = null, validateHostname = true, }) {
|
||||
return {
|
||||
allowIcannDomains,
|
||||
allowPrivateDomains,
|
||||
detectIp,
|
||||
extractHostname,
|
||||
mixedInputs,
|
||||
validHosts,
|
||||
validateHostname,
|
||||
};
|
||||
}
|
||||
const DEFAULT_OPTIONS = /*@__INLINE__*/ setDefaultsImpl({});
|
||||
function setDefaults(options) {
|
||||
if (options === undefined) {
|
||||
return DEFAULT_OPTIONS;
|
||||
}
|
||||
return /*@__INLINE__*/ setDefaultsImpl(options);
|
||||
}
|
||||
//# sourceMappingURL=options.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/cjs/src/options.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/cjs/src/options.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/options.ts"],"names":[],"mappings":";;AAgCA,kCAMC;AA5BD,SAAS,eAAe,CAAC,EACvB,iBAAiB,GAAG,IAAI,EACxB,mBAAmB,GAAG,KAAK,EAC3B,QAAQ,GAAG,IAAI,EACf,eAAe,GAAG,IAAI,EACtB,WAAW,GAAG,IAAI,EAClB,UAAU,GAAG,IAAI,EACjB,gBAAgB,GAAG,IAAI,GACL;IAClB,OAAO;QACL,iBAAiB;QACjB,mBAAmB;QACnB,QAAQ;QACR,eAAe;QACf,WAAW;QACX,UAAU;QACV,gBAAgB;KACjB,CAAC;AACJ,CAAC;AAED,MAAM,eAAe,GAAG,eAAe,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AAE5D,SAAgB,WAAW,CAAC,OAA2B;IACrD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,OAAO,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;AAClD,CAAC"}
|
||||
14
frontend/node_modules/tldts-core/dist/cjs/src/subdomain.js
generated
vendored
Normal file
14
frontend/node_modules/tldts-core/dist/cjs/src/subdomain.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = getSubdomain;
|
||||
/**
|
||||
* Returns the subdomain of a hostname string
|
||||
*/
|
||||
function getSubdomain(hostname, domain) {
|
||||
// If `hostname` and `domain` are the same, then there is no sub-domain
|
||||
if (domain.length === hostname.length) {
|
||||
return '';
|
||||
}
|
||||
return hostname.slice(0, -domain.length - 1);
|
||||
}
|
||||
//# sourceMappingURL=subdomain.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/cjs/src/subdomain.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/cjs/src/subdomain.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"subdomain.js","sourceRoot":"","sources":["../../../src/subdomain.ts"],"names":[],"mappings":";;AAGA,+BAOC;AAVD;;GAEG;AACH,SAAwB,YAAY,CAAC,QAAgB,EAAE,MAAc;IACnE,uEAAuE;IACvE,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
||||
1
frontend/node_modules/tldts-core/dist/cjs/tsconfig.tsbuildinfo
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/cjs/tsconfig.tsbuildinfo
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
frontend/node_modules/tldts-core/dist/es6/index.js
generated
vendored
Normal file
4
frontend/node_modules/tldts-core/dist/es6/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export { parseImpl, getEmptyResult, resetResult, } from './src/factory';
|
||||
export { default as fastPathLookup } from './src/lookup/fast-path';
|
||||
export { setDefaults } from './src/options';
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/es6/index.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/es6/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAET,cAAc,EACd,WAAW,GACZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAY,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
||||
12
frontend/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js
generated
vendored
Normal file
12
frontend/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Return the part of domain without suffix.
|
||||
*
|
||||
* Example: for domain 'foo.com', the result would be 'foo'.
|
||||
*/
|
||||
export default function getDomainWithoutSuffix(domain, suffix) {
|
||||
// Note: here `domain` and `suffix` cannot have the same length because in
|
||||
// this case we set `domain` to `null` instead. It is thus safe to assume
|
||||
// that `suffix` is shorter than `domain`.
|
||||
return domain.slice(0, -suffix.length - 1);
|
||||
}
|
||||
//# sourceMappingURL=domain-without-suffix.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"domain-without-suffix.js","sourceRoot":"","sources":["../../../src/domain-without-suffix.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,MAAc,EACd,MAAc;IAEd,0EAA0E;IAC1E,yEAAyE;IACzE,0CAA0C;IAC1C,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
||||
80
frontend/node_modules/tldts-core/dist/es6/src/domain.js
generated
vendored
Normal file
80
frontend/node_modules/tldts-core/dist/es6/src/domain.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Check if `vhost` is a valid suffix of `hostname` (top-domain)
|
||||
*
|
||||
* It means that `vhost` needs to be a suffix of `hostname` and we then need to
|
||||
* make sure that: either they are equal, or the character preceding `vhost` in
|
||||
* `hostname` is a '.' (it should not be a partial label).
|
||||
*
|
||||
* * hostname = 'not.evil.com' and vhost = 'vil.com' => not ok
|
||||
* * hostname = 'not.evil.com' and vhost = 'evil.com' => ok
|
||||
* * hostname = 'not.evil.com' and vhost = 'not.evil.com' => ok
|
||||
*/
|
||||
function shareSameDomainSuffix(hostname, vhost) {
|
||||
if (hostname.endsWith(vhost)) {
|
||||
return (hostname.length === vhost.length ||
|
||||
hostname[hostname.length - vhost.length - 1] === '.');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Given a hostname and its public suffix, extract the general domain.
|
||||
*/
|
||||
function extractDomainWithSuffix(hostname, publicSuffix) {
|
||||
// Locate the index of the last '.' in the part of the `hostname` preceding
|
||||
// the public suffix.
|
||||
//
|
||||
// examples:
|
||||
// 1. not.evil.co.uk => evil.co.uk
|
||||
// ^ ^
|
||||
// | | start of public suffix
|
||||
// | index of the last dot
|
||||
//
|
||||
// 2. example.co.uk => example.co.uk
|
||||
// ^ ^
|
||||
// | | start of public suffix
|
||||
// |
|
||||
// | (-1) no dot found before the public suffix
|
||||
const publicSuffixIndex = hostname.length - publicSuffix.length - 2;
|
||||
const lastDotBeforeSuffixIndex = hostname.lastIndexOf('.', publicSuffixIndex);
|
||||
// No '.' found, then `hostname` is the general domain (no sub-domain)
|
||||
if (lastDotBeforeSuffixIndex === -1) {
|
||||
return hostname;
|
||||
}
|
||||
// Extract the part between the last '.'
|
||||
return hostname.slice(lastDotBeforeSuffixIndex + 1);
|
||||
}
|
||||
/**
|
||||
* Detects the domain based on rules and upon and a host string
|
||||
*/
|
||||
export default function getDomain(suffix, hostname, options) {
|
||||
// Check if `hostname` ends with a member of `validHosts`.
|
||||
if (options.validHosts !== null) {
|
||||
const validHosts = options.validHosts;
|
||||
for (const vhost of validHosts) {
|
||||
if ( /*@__INLINE__*/shareSameDomainSuffix(hostname, vhost)) {
|
||||
return vhost;
|
||||
}
|
||||
}
|
||||
}
|
||||
let numberOfLeadingDots = 0;
|
||||
if (hostname.startsWith('.')) {
|
||||
while (numberOfLeadingDots < hostname.length &&
|
||||
hostname[numberOfLeadingDots] === '.') {
|
||||
numberOfLeadingDots += 1;
|
||||
}
|
||||
}
|
||||
// If `hostname` is a valid public suffix, then there is no domain to return.
|
||||
// Since we already know that `getPublicSuffix` returns a suffix of `hostname`
|
||||
// there is no need to perform a string comparison and we only compare the
|
||||
// size.
|
||||
if (suffix.length === hostname.length - numberOfLeadingDots) {
|
||||
return null;
|
||||
}
|
||||
// To extract the general domain, we start by identifying the public suffix
|
||||
// (if any), then consider the domain to be the public suffix with one added
|
||||
// level of depth. (e.g.: if hostname is `not.evil.co.uk` and public suffix:
|
||||
// `co.uk`, then we take one more level: `evil`, giving the final result:
|
||||
// `evil.co.uk`).
|
||||
return /*@__INLINE__*/ extractDomainWithSuffix(hostname, suffix);
|
||||
}
|
||||
//# sourceMappingURL=domain.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/es6/src/domain.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/es6/src/domain.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../src/domain.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,SAAS,qBAAqB,CAAC,QAAgB,EAAE,KAAa;IAC5D,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,CACL,QAAQ,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;YAChC,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,CACrD,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,SAAS,uBAAuB,CAC9B,QAAgB,EAChB,YAAoB;IAEpB,2EAA2E;IAC3E,qBAAqB;IACrB,EAAE;IACF,YAAY;IACZ,qCAAqC;IACrC,iBAAiB;IACjB,wCAAwC;IACxC,kCAAkC;IAClC,EAAE;IACF,wCAAwC;IACxC,gBAAgB;IAChB,uCAAuC;IACvC,QAAQ;IACR,mDAAmD;IACnD,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IACpE,MAAM,wBAAwB,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;IAE9E,sEAAsE;IACtE,IAAI,wBAAwB,KAAK,CAAC,CAAC,EAAE,CAAC;QACpC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,wCAAwC;IACxC,OAAO,QAAQ,CAAC,KAAK,CAAC,wBAAwB,GAAG,CAAC,CAAC,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,MAAc,EACd,QAAgB,EAChB,OAAiB;IAEjB,0DAA0D;IAC1D,IAAI,OAAO,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;QAChC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACtC,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;YAC/B,KAAI,eAAgB,qBAAqB,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC;gBAC3D,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,mBAAmB,GAAG,CAAC,CAAC;IAC5B,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,OACE,mBAAmB,GAAG,QAAQ,CAAC,MAAM;YACrC,QAAQ,CAAC,mBAAmB,CAAC,KAAK,GAAG,EACrC,CAAC;YACD,mBAAmB,IAAI,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,6EAA6E;IAC7E,8EAA8E;IAC9E,0EAA0E;IAC1E,QAAQ;IACR,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,GAAG,mBAAmB,EAAE,CAAC;QAC5D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,2EAA2E;IAC3E,4EAA4E;IAC5E,4EAA4E;IAC5E,yEAAyE;IACzE,iBAAiB;IACjB,OAAO,eAAe,CAAC,uBAAuB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACnE,CAAC"}
|
||||
146
frontend/node_modules/tldts-core/dist/es6/src/extract-hostname.js
generated
vendored
Normal file
146
frontend/node_modules/tldts-core/dist/es6/src/extract-hostname.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
/**
|
||||
* @param url - URL we want to extract a hostname from.
|
||||
* @param urlIsValidHostname - hint from caller; true if `url` is already a valid hostname.
|
||||
*/
|
||||
export default function extractHostname(url, urlIsValidHostname) {
|
||||
let start = 0;
|
||||
let end = url.length;
|
||||
let hasUpper = false;
|
||||
// If url is not already a valid hostname, then try to extract hostname.
|
||||
if (!urlIsValidHostname) {
|
||||
// Special handling of data URLs
|
||||
if (url.startsWith('data:')) {
|
||||
return null;
|
||||
}
|
||||
// Trim leading spaces
|
||||
while (start < url.length && url.charCodeAt(start) <= 32) {
|
||||
start += 1;
|
||||
}
|
||||
// Trim trailing spaces
|
||||
while (end > start + 1 && url.charCodeAt(end - 1) <= 32) {
|
||||
end -= 1;
|
||||
}
|
||||
// Skip scheme.
|
||||
if (url.charCodeAt(start) === 47 /* '/' */ &&
|
||||
url.charCodeAt(start + 1) === 47 /* '/' */) {
|
||||
start += 2;
|
||||
}
|
||||
else {
|
||||
const indexOfProtocol = url.indexOf(':/', start);
|
||||
if (indexOfProtocol !== -1) {
|
||||
// Implement fast-path for common protocols. We expect most protocols
|
||||
// should be one of these 4 and thus we will not need to perform the
|
||||
// more expansive validity check most of the time.
|
||||
const protocolSize = indexOfProtocol - start;
|
||||
const c0 = url.charCodeAt(start);
|
||||
const c1 = url.charCodeAt(start + 1);
|
||||
const c2 = url.charCodeAt(start + 2);
|
||||
const c3 = url.charCodeAt(start + 3);
|
||||
const c4 = url.charCodeAt(start + 4);
|
||||
if (protocolSize === 5 &&
|
||||
c0 === 104 /* 'h' */ &&
|
||||
c1 === 116 /* 't' */ &&
|
||||
c2 === 116 /* 't' */ &&
|
||||
c3 === 112 /* 'p' */ &&
|
||||
c4 === 115 /* 's' */) {
|
||||
// https
|
||||
}
|
||||
else if (protocolSize === 4 &&
|
||||
c0 === 104 /* 'h' */ &&
|
||||
c1 === 116 /* 't' */ &&
|
||||
c2 === 116 /* 't' */ &&
|
||||
c3 === 112 /* 'p' */) {
|
||||
// http
|
||||
}
|
||||
else if (protocolSize === 3 &&
|
||||
c0 === 119 /* 'w' */ &&
|
||||
c1 === 115 /* 's' */ &&
|
||||
c2 === 115 /* 's' */) {
|
||||
// wss
|
||||
}
|
||||
else if (protocolSize === 2 &&
|
||||
c0 === 119 /* 'w' */ &&
|
||||
c1 === 115 /* 's' */) {
|
||||
// ws
|
||||
}
|
||||
else {
|
||||
// Check that scheme is valid
|
||||
for (let i = start; i < indexOfProtocol; i += 1) {
|
||||
const lowerCaseCode = url.charCodeAt(i) | 32;
|
||||
if (!(((lowerCaseCode >= 97 && lowerCaseCode <= 122) || // [a, z]
|
||||
(lowerCaseCode >= 48 && lowerCaseCode <= 57) || // [0, 9]
|
||||
lowerCaseCode === 46 || // '.'
|
||||
lowerCaseCode === 45 || // '-'
|
||||
lowerCaseCode === 43) // '+'
|
||||
)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Skip 0, 1 or more '/' after ':/'
|
||||
start = indexOfProtocol + 2;
|
||||
while (url.charCodeAt(start) === 47 /* '/' */) {
|
||||
start += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Detect first occurrence of '/', '?' or '#'. We also keep track of the
|
||||
// last occurrence of '@', ']' or ':' to speed-up subsequent parsing of
|
||||
// (respectively), identifier, ipv6 or port.
|
||||
let indexOfIdentifier = -1;
|
||||
let indexOfClosingBracket = -1;
|
||||
let indexOfPort = -1;
|
||||
for (let i = start; i < end; i += 1) {
|
||||
const code = url.charCodeAt(i);
|
||||
if (code === 35 || // '#'
|
||||
code === 47 || // '/'
|
||||
code === 63 // '?'
|
||||
) {
|
||||
end = i;
|
||||
break;
|
||||
}
|
||||
else if (code === 64) {
|
||||
// '@'
|
||||
indexOfIdentifier = i;
|
||||
}
|
||||
else if (code === 93) {
|
||||
// ']'
|
||||
indexOfClosingBracket = i;
|
||||
}
|
||||
else if (code === 58) {
|
||||
// ':'
|
||||
indexOfPort = i;
|
||||
}
|
||||
else if (code >= 65 && code <= 90) {
|
||||
hasUpper = true;
|
||||
}
|
||||
}
|
||||
// Detect identifier: '@'
|
||||
if (indexOfIdentifier !== -1 &&
|
||||
indexOfIdentifier > start &&
|
||||
indexOfIdentifier < end) {
|
||||
start = indexOfIdentifier + 1;
|
||||
}
|
||||
// Handle ipv6 addresses
|
||||
if (url.charCodeAt(start) === 91 /* '[' */) {
|
||||
if (indexOfClosingBracket !== -1) {
|
||||
return url.slice(start + 1, indexOfClosingBracket).toLowerCase();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else if (indexOfPort !== -1 && indexOfPort > start && indexOfPort < end) {
|
||||
// Detect port: ':'
|
||||
end = indexOfPort;
|
||||
}
|
||||
}
|
||||
// Trim trailing dots
|
||||
while (end > start + 1 && url.charCodeAt(end - 1) === 46 /* '.' */) {
|
||||
end -= 1;
|
||||
}
|
||||
const hostname = start !== 0 || end !== url.length ? url.slice(start, end) : url;
|
||||
if (hasUpper) {
|
||||
return hostname.toLowerCase();
|
||||
}
|
||||
return hostname;
|
||||
}
|
||||
//# sourceMappingURL=extract-hostname.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/es6/src/extract-hostname.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/es6/src/extract-hostname.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"extract-hostname.js","sourceRoot":"","sources":["../../../src/extract-hostname.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,GAAW,EACX,kBAA2B;IAE3B,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,GAAG,GAAW,GAAG,CAAC,MAAM,CAAC;IAC7B,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,wEAAwE;IACxE,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,gCAAgC;QAChC,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,OAA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AC;QACH,CAAC;QAED,yBAAyB;QACzB,IACE,iBAAiB,KAAK,CAAC,CAAC;YACxB,iBAAiB,GAAG,KAAK;YACzB,iBAAiB,GAAG,GAAG,EACvB,CAAC;YACD,KAAK,GAAG,iBAAiB,GAAG,CAAC,CAAC;QAChC,CAAC;QAED,wBAAwB;QACxB,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,CAAC;YAC3C,IAAI,qBAAqB,KAAK,CAAC,CAAC,EAAE,CAAC;gBACjC,OAAO,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,qBAAqB,CAAC,CAAC,WAAW,EAAE,CAAC;YACnE,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;aAAM,IAAI,WAAW,KAAK,CAAC,CAAC,IAAI,WAAW,GAAG,KAAK,IAAI,WAAW,GAAG,GAAG,EAAE,CAAC;YAC1E,mBAAmB;YACnB,GAAG,GAAG,WAAW,CAAC;QACpB,CAAC;IACH,CAAC;IAED,qBAAqB;IACrB,OAAO,GAAG,GAAG,KAAK,GAAG,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,CAAC;QACnE,GAAG,IAAI,CAAC,CAAC;IACX,CAAC;IAED,MAAM,QAAQ,GACZ,KAAK,KAAK,CAAC,IAAI,GAAG,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAElE,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;IAChC,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
||||
99
frontend/node_modules/tldts-core/dist/es6/src/factory.js
generated
vendored
Normal file
99
frontend/node_modules/tldts-core/dist/es6/src/factory.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* Implement a factory allowing to plug different implementations of suffix
|
||||
* lookup (e.g.: using a trie or the packed hashes datastructures). This is used
|
||||
* and exposed in `tldts.ts` and `tldts-experimental.ts` bundle entrypoints.
|
||||
*/
|
||||
import getDomain from './domain';
|
||||
import getDomainWithoutSuffix from './domain-without-suffix';
|
||||
import extractHostname from './extract-hostname';
|
||||
import isIp from './is-ip';
|
||||
import isValidHostname from './is-valid';
|
||||
import { setDefaults } from './options';
|
||||
import getSubdomain from './subdomain';
|
||||
export function getEmptyResult() {
|
||||
return {
|
||||
domain: null,
|
||||
domainWithoutSuffix: null,
|
||||
hostname: null,
|
||||
isIcann: null,
|
||||
isIp: null,
|
||||
isPrivate: null,
|
||||
publicSuffix: null,
|
||||
subdomain: null,
|
||||
};
|
||||
}
|
||||
export function resetResult(result) {
|
||||
result.domain = null;
|
||||
result.domainWithoutSuffix = null;
|
||||
result.hostname = null;
|
||||
result.isIcann = null;
|
||||
result.isIp = null;
|
||||
result.isPrivate = null;
|
||||
result.publicSuffix = null;
|
||||
result.subdomain = null;
|
||||
}
|
||||
export function parseImpl(url, step, suffixLookup, partialOptions, result) {
|
||||
const options = /*@__INLINE__*/ setDefaults(partialOptions);
|
||||
// Very fast approximate check to make sure `url` is a string. This is needed
|
||||
// because the library will not necessarily be used in a typed setup and
|
||||
// values of arbitrary types might be given as argument.
|
||||
if (typeof url !== 'string') {
|
||||
return result;
|
||||
}
|
||||
// Extract hostname from `url` only if needed. This can be made optional
|
||||
// using `options.extractHostname`. This option will typically be used
|
||||
// whenever we are sure the inputs to `parse` are already hostnames and not
|
||||
// arbitrary URLs.
|
||||
//
|
||||
// `mixedInput` allows to specify if we expect a mix of URLs and hostnames
|
||||
// as input. If only hostnames are expected then `extractHostname` can be
|
||||
// set to `false` to speed-up parsing. If only URLs are expected then
|
||||
// `mixedInputs` can be set to `false`. The `mixedInputs` is only a hint
|
||||
// and will not change the behavior of the library.
|
||||
if (!options.extractHostname) {
|
||||
result.hostname = url;
|
||||
}
|
||||
else if (options.mixedInputs) {
|
||||
result.hostname = extractHostname(url, isValidHostname(url));
|
||||
}
|
||||
else {
|
||||
result.hostname = extractHostname(url, false);
|
||||
}
|
||||
if (step === 0 /* FLAG.HOSTNAME */ || result.hostname === null) {
|
||||
return result;
|
||||
}
|
||||
// Check if `hostname` is a valid ip address
|
||||
if (options.detectIp) {
|
||||
result.isIp = isIp(result.hostname);
|
||||
if (result.isIp) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// Perform optional hostname validation. If hostname is not valid, no need to
|
||||
// go further as there will be no valid domain or sub-domain.
|
||||
if (options.validateHostname &&
|
||||
options.extractHostname &&
|
||||
!isValidHostname(result.hostname)) {
|
||||
result.hostname = null;
|
||||
return result;
|
||||
}
|
||||
// Extract public suffix
|
||||
suffixLookup(result.hostname, options, result);
|
||||
if (step === 2 /* FLAG.PUBLIC_SUFFIX */ || result.publicSuffix === null) {
|
||||
return result;
|
||||
}
|
||||
// Extract domain
|
||||
result.domain = getDomain(result.publicSuffix, result.hostname, options);
|
||||
if (step === 3 /* FLAG.DOMAIN */ || result.domain === null) {
|
||||
return result;
|
||||
}
|
||||
// Extract subdomain
|
||||
result.subdomain = getSubdomain(result.hostname, result.domain);
|
||||
if (step === 4 /* FLAG.SUB_DOMAIN */) {
|
||||
return result;
|
||||
}
|
||||
// Extract domain without suffix
|
||||
result.domainWithoutSuffix = getDomainWithoutSuffix(result.domain, result.publicSuffix);
|
||||
return result;
|
||||
}
|
||||
//# sourceMappingURL=factory.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/es6/src/factory.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/es6/src/factory.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/factory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,SAAS,MAAM,UAAU,CAAC;AACjC,OAAO,s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AAY,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACzE,IAAI,IAAI,wBAAgB,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QACnD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,oBAAoB;IACpB,MAAM,CAAC,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAChE,IAAI,IAAI,4BAAoB,EAAE,CAAC;QAC7B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,gCAAgC;IAChC,MAAM,CAAC,mBAAmB,GAAG,sBAAsB,CACjD,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,YAAY,CACpB,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
||||
69
frontend/node_modules/tldts-core/dist/es6/src/is-ip.js
generated
vendored
Normal file
69
frontend/node_modules/tldts-core/dist/es6/src/is-ip.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* Check if a hostname is an IP. You should be aware that this only works
|
||||
* because `hostname` is already garanteed to be a valid hostname!
|
||||
*/
|
||||
function isProbablyIpv4(hostname) {
|
||||
// Cannot be shorted than 1.1.1.1
|
||||
if (hostname.length < 7) {
|
||||
return false;
|
||||
}
|
||||
// Cannot be longer than: 255.255.255.255
|
||||
if (hostname.length > 15) {
|
||||
return false;
|
||||
}
|
||||
let numberOfDots = 0;
|
||||
for (let i = 0; i < hostname.length; i += 1) {
|
||||
const code = hostname.charCodeAt(i);
|
||||
if (code === 46 /* '.' */) {
|
||||
numberOfDots += 1;
|
||||
}
|
||||
else if (code < 48 /* '0' */ || code > 57 /* '9' */) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return (numberOfDots === 3 &&
|
||||
hostname.charCodeAt(0) !== 46 /* '.' */ &&
|
||||
hostname.charCodeAt(hostname.length - 1) !== 46 /* '.' */);
|
||||
}
|
||||
/**
|
||||
* Similar to isProbablyIpv4.
|
||||
*/
|
||||
function isProbablyIpv6(hostname) {
|
||||
if (hostname.length < 3) {
|
||||
return false;
|
||||
}
|
||||
let start = hostname.startsWith('[') ? 1 : 0;
|
||||
let end = hostname.length;
|
||||
if (hostname[end - 1] === ']') {
|
||||
end -= 1;
|
||||
}
|
||||
// We only consider the maximum size of a normal IPV6. Note that this will
|
||||
// fail on so-called "IPv4 mapped IPv6 addresses" but this is a corner-case
|
||||
// and a proper validation library should be used for these.
|
||||
if (end - start > 39) {
|
||||
return false;
|
||||
}
|
||||
let hasColon = false;
|
||||
for (; start < end; start += 1) {
|
||||
const code = hostname.charCodeAt(start);
|
||||
if (code === 58 /* ':' */) {
|
||||
hasColon = true;
|
||||
}
|
||||
else if (!(((code >= 48 && code <= 57) || // 0-9
|
||||
(code >= 97 && code <= 102) || // a-f
|
||||
(code >= 65 && code <= 90)) // A-F
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return hasColon;
|
||||
}
|
||||
/**
|
||||
* Check if `hostname` is *probably* a valid ip addr (either ipv6 or ipv4).
|
||||
* This *will not* work on any string. We need `hostname` to be a valid
|
||||
* hostname.
|
||||
*/
|
||||
export default function isIp(hostname) {
|
||||
return isProbablyIpv6(hostname) || isProbablyIpv4(hostname);
|
||||
}
|
||||
//# sourceMappingURL=is-ip.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/es6/src/is-ip.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/es6/src/is-ip.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"is-ip.js","sourceRoot":"","sources":["../../../src/is-ip.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,SAAS,cAAc,CAAC,QAAgB;IACtC,iCAAiC;IACjC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,yCAAyC;IACzC,IAAI,QAAQ,CAAC,MAAM,GAA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AC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,OAAO,KAAK,GAAG,GAAG,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAExC,IAAI,IAAI,KAAK,EAAE,CAAC,SAAS,EAAE,CAAC;YAC1B,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC;aAAM,IACL,CAAC,CACC,CACE,CAAC,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,IAAI,MAAM;YACpC,CAAC,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,GAAG,CAAC,IAAI,MAAM;YACrC,CAAC,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,CAC3B,CAAC,MAAM;SACT,EACD,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,QAAgB;IAC3C,OAAO,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAC;AAC9D,CAAC"}
|
||||
66
frontend/node_modules/tldts-core/dist/es6/src/is-valid.js
generated
vendored
Normal file
66
frontend/node_modules/tldts-core/dist/es6/src/is-valid.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* Implements fast shallow verification of hostnames. This does not perform a
|
||||
* struct check on the content of labels (classes of Unicode characters, etc.)
|
||||
* but instead check that the structure is valid (number of labels, length of
|
||||
* labels, etc.).
|
||||
*
|
||||
* If you need stricter validation, consider using an external library.
|
||||
*/
|
||||
function isValidAscii(code) {
|
||||
return ((code >= 97 && code <= 122) || (code >= 48 && code <= 57) || code > 127);
|
||||
}
|
||||
/**
|
||||
* Check if a hostname string is valid. It's usually a preliminary check before
|
||||
* trying to use getDomain or anything else.
|
||||
*
|
||||
* Beware: it does not check if the TLD exists.
|
||||
*/
|
||||
export default function (hostname) {
|
||||
if (hostname.length > 255) {
|
||||
return false;
|
||||
}
|
||||
if (hostname.length === 0) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
/*@__INLINE__*/ !isValidAscii(hostname.charCodeAt(0)) &&
|
||||
hostname.charCodeAt(0) !== 46 && // '.' (dot)
|
||||
hostname.charCodeAt(0) !== 95 // '_' (underscore)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
// Validate hostname according to RFC
|
||||
let lastDotIndex = -1;
|
||||
let lastCharCode = -1;
|
||||
const len = hostname.length;
|
||||
for (let i = 0; i < len; i += 1) {
|
||||
const code = hostname.charCodeAt(i);
|
||||
if (code === 46 /* '.' */) {
|
||||
if (
|
||||
// Check that previous label is < 63 bytes long (64 = 63 + '.')
|
||||
i - lastDotIndex > 64 ||
|
||||
// Check that previous character was not already a '.'
|
||||
lastCharCode === 46 ||
|
||||
// Check that the previous label does not end with a '-' (dash)
|
||||
lastCharCode === 45 ||
|
||||
// Check that the previous label does not end with a '_' (underscore)
|
||||
lastCharCode === 95) {
|
||||
return false;
|
||||
}
|
||||
lastDotIndex = i;
|
||||
}
|
||||
else if (!( /*@__INLINE__*/(isValidAscii(code) || code === 45 || code === 95))) {
|
||||
// Check if there is a forbidden character in the label
|
||||
return false;
|
||||
}
|
||||
lastCharCode = code;
|
||||
}
|
||||
return (
|
||||
// Check that last label is shorter than 63 chars
|
||||
len - lastDotIndex - 1 <= 63 &&
|
||||
// Check that the last character is an allowed trailing label character.
|
||||
// Since we already checked that the char is a valid hostname character,
|
||||
// we only need to check that it's different from '-'.
|
||||
lastCharCode !== 45);
|
||||
}
|
||||
//# sourceMappingURL=is-valid.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/es6/src/is-valid.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/es6/src/is-valid.js.map
generated
vendored
Normal file
@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G,EAAE;gBACrB,sDAAsD;gBACtD,YAAY,KAAK,EAAE;gBACnB,+DAA+D;gBAC/D,YAAY,KAAK,EAAE;gBACnB,qEAAqE;gBACrE,YAAY,KAAK,EAAE,EACnB,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;YAED,YAAY,GAAG,CAAC,CAAC;QACnB,CAAC;aAAM,IACL,CAAC,EAAC,eAAgB,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,EACrE,CAAC;YACD,uDAAuD;YACvD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,YAAY,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,OAAO;IACL,iDAAiD;IACjD,GAAG,GAAG,YAAY,GAAG,CAAC,IAAI,EAAE;QAC5B,wEAAwE;QACxE,wEAAwE;QACxE,sDAAsD;QACtD,YAAY,KAAK,EAAE,CACpB,CAAC;AACJ,CAAC"}
|
||||
66
frontend/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js
generated
vendored
Normal file
66
frontend/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
export default function (hostname, options, out) {
|
||||
// Fast path for very popular suffixes; this allows to by-pass lookup
|
||||
// completely as well as any extra allocation or string manipulation.
|
||||
if (!options.allowPrivateDomains && hostname.length > 3) {
|
||||
const last = hostname.length - 1;
|
||||
const c3 = hostname.charCodeAt(last);
|
||||
const c2 = hostname.charCodeAt(last - 1);
|
||||
const c1 = hostname.charCodeAt(last - 2);
|
||||
const c0 = hostname.charCodeAt(last - 3);
|
||||
if (c3 === 109 /* 'm' */ &&
|
||||
c2 === 111 /* 'o' */ &&
|
||||
c1 === 99 /* 'c' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'com';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 103 /* 'g' */ &&
|
||||
c2 === 114 /* 'r' */ &&
|
||||
c1 === 111 /* 'o' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'org';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 117 /* 'u' */ &&
|
||||
c2 === 100 /* 'd' */ &&
|
||||
c1 === 101 /* 'e' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'edu';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 118 /* 'v' */ &&
|
||||
c2 === 111 /* 'o' */ &&
|
||||
c1 === 103 /* 'g' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'gov';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 116 /* 't' */ &&
|
||||
c2 === 101 /* 'e' */ &&
|
||||
c1 === 110 /* 'n' */ &&
|
||||
c0 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'net';
|
||||
return true;
|
||||
}
|
||||
else if (c3 === 101 /* 'e' */ &&
|
||||
c2 === 100 /* 'd' */ &&
|
||||
c1 === 46 /* '.' */) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'de';
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//# sourceMappingURL=fast-path.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fast-path.js","sourceRoot":"","sources":["../../../../src/lookup/fast-path.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,WACZ,QAAgB,EA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_modules/tldts-core/dist/es6/src/lookup/interface.js
generated
vendored
Normal file
2
frontend/node_modules/tldts-core/dist/es6/src/lookup/interface.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=interface.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/es6/src/lookup/interface.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/es6/src/lookup/interface.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/lookup/interface.ts"],"names":[],"mappings":""}
|
||||
19
frontend/node_modules/tldts-core/dist/es6/src/options.js
generated
vendored
Normal file
19
frontend/node_modules/tldts-core/dist/es6/src/options.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
function setDefaultsImpl({ allowIcannDomains = true, allowPrivateDomains = false, detectIp = true, extractHostname = true, mixedInputs = true, validHosts = null, validateHostname = true, }) {
|
||||
return {
|
||||
allowIcannDomains,
|
||||
allowPrivateDomains,
|
||||
detectIp,
|
||||
extractHostname,
|
||||
mixedInputs,
|
||||
validHosts,
|
||||
validateHostname,
|
||||
};
|
||||
}
|
||||
const DEFAULT_OPTIONS = /*@__INLINE__*/ setDefaultsImpl({});
|
||||
export function setDefaults(options) {
|
||||
if (options === undefined) {
|
||||
return DEFAULT_OPTIONS;
|
||||
}
|
||||
return /*@__INLINE__*/ setDefaultsImpl(options);
|
||||
}
|
||||
//# sourceMappingURL=options.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/es6/src/options.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/es6/src/options.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/options.ts"],"names":[],"mappings":"AAUA,SAAS,eAAe,CAAC,EACvB,iBAAiB,GAAG,IAAI,EACxB,mBAAmB,GAAG,KAAK,EAC3B,QAAQ,GAAG,IAAI,EACf,eAAe,GAAG,IAAI,EACtB,WAAW,GAAG,IAAI,EAClB,UAAU,GAAG,IAAI,EACjB,gBAAgB,GAAG,IAAI,GACL;IAClB,OAAO;QACL,iBAAiB;QACjB,mBAAmB;QACnB,QAAQ;QACR,eAAe;QACf,WAAW;QACX,UAAU;QACV,gBAAgB;KACjB,CAAC;AACJ,CAAC;AAED,MAAM,eAAe,GAAG,eAAe,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AAE5D,MAAM,UAAU,WAAW,CAAC,OAA2B;IACrD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,OAAO,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;AAClD,CAAC"}
|
||||
11
frontend/node_modules/tldts-core/dist/es6/src/subdomain.js
generated
vendored
Normal file
11
frontend/node_modules/tldts-core/dist/es6/src/subdomain.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Returns the subdomain of a hostname string
|
||||
*/
|
||||
export default function getSubdomain(hostname, domain) {
|
||||
// If `hostname` and `domain` are the same, then there is no sub-domain
|
||||
if (domain.length === hostname.length) {
|
||||
return '';
|
||||
}
|
||||
return hostname.slice(0, -domain.length - 1);
|
||||
}
|
||||
//# sourceMappingURL=subdomain.js.map
|
||||
1
frontend/node_modules/tldts-core/dist/es6/src/subdomain.js.map
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/es6/src/subdomain.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"subdomain.js","sourceRoot":"","sources":["../../../src/subdomain.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,QAAgB,EAAE,MAAc;IACnE,uEAAuE;IACvE,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
||||
1
frontend/node_modules/tldts-core/dist/es6/tsconfig.bundle.tsbuildinfo
generated
vendored
Normal file
1
frontend/node_modules/tldts-core/dist/es6/tsconfig.bundle.tsbuildinfo
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
frontend/node_modules/tldts-core/dist/types/index.d.ts
generated
vendored
Normal file
4
frontend/node_modules/tldts-core/dist/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export { FLAG, parseImpl, IResult, getEmptyResult, resetResult, } from './src/factory';
|
||||
export { IPublicSuffix, ISuffixLookupOptions } from './src/lookup/interface';
|
||||
export { default as fastPathLookup } from './src/lookup/fast-path';
|
||||
export { IOptions, setDefaults } from './src/options';
|
||||
6
frontend/node_modules/tldts-core/dist/types/src/domain-without-suffix.d.ts
generated
vendored
Normal file
6
frontend/node_modules/tldts-core/dist/types/src/domain-without-suffix.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Return the part of domain without suffix.
|
||||
*
|
||||
* Example: for domain 'foo.com', the result would be 'foo'.
|
||||
*/
|
||||
export default function getDomainWithoutSuffix(domain: string, suffix: string): string;
|
||||
5
frontend/node_modules/tldts-core/dist/types/src/domain.d.ts
generated
vendored
Normal file
5
frontend/node_modules/tldts-core/dist/types/src/domain.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { IOptions } from './options';
|
||||
/**
|
||||
* Detects the domain based on rules and upon and a host string
|
||||
*/
|
||||
export default function getDomain(suffix: string, hostname: string, options: IOptions): string | null;
|
||||
5
frontend/node_modules/tldts-core/dist/types/src/extract-hostname.d.ts
generated
vendored
Normal file
5
frontend/node_modules/tldts-core/dist/types/src/extract-hostname.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* @param url - URL we want to extract a hostname from.
|
||||
* @param urlIsValidHostname - hint from caller; true if `url` is already a valid hostname.
|
||||
*/
|
||||
export default function extractHostname(url: string, urlIsValidHostname: boolean): string | null;
|
||||
28
frontend/node_modules/tldts-core/dist/types/src/factory.d.ts
generated
vendored
Normal file
28
frontend/node_modules/tldts-core/dist/types/src/factory.d.ts
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Implement a factory allowing to plug different implementations of suffix
|
||||
* lookup (e.g.: using a trie or the packed hashes datastructures). This is used
|
||||
* and exposed in `tldts.ts` and `tldts-experimental.ts` bundle entrypoints.
|
||||
*/
|
||||
import { IPublicSuffix, ISuffixLookupOptions } from './lookup/interface';
|
||||
import { IOptions } from './options';
|
||||
export interface IResult {
|
||||
hostname: string | null;
|
||||
isIp: boolean | null;
|
||||
subdomain: string | null;
|
||||
domain: string | null;
|
||||
publicSuffix: string | null;
|
||||
domainWithoutSuffix: string | null;
|
||||
isIcann: boolean | null;
|
||||
isPrivate: boolean | null;
|
||||
}
|
||||
export declare function getEmptyResult(): IResult;
|
||||
export declare function resetResult(result: IResult): void;
|
||||
export declare const enum FLAG {
|
||||
HOSTNAME = 0,
|
||||
IS_VALID = 1,
|
||||
PUBLIC_SUFFIX = 2,
|
||||
DOMAIN = 3,
|
||||
SUB_DOMAIN = 4,
|
||||
ALL = 5
|
||||
}
|
||||
export declare function parseImpl(url: string, step: FLAG, suffixLookup: (_1: string, _2: ISuffixLookupOptions, _3: IPublicSuffix) => void, partialOptions: Partial<IOptions>, result: IResult): IResult;
|
||||
6
frontend/node_modules/tldts-core/dist/types/src/is-ip.d.ts
generated
vendored
Normal file
6
frontend/node_modules/tldts-core/dist/types/src/is-ip.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Check if `hostname` is *probably* a valid ip addr (either ipv6 or ipv4).
|
||||
* This *will not* work on any string. We need `hostname` to be a valid
|
||||
* hostname.
|
||||
*/
|
||||
export default function isIp(hostname: string): boolean;
|
||||
15
frontend/node_modules/tldts-core/dist/types/src/is-valid.d.ts
generated
vendored
Normal file
15
frontend/node_modules/tldts-core/dist/types/src/is-valid.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Implements fast shallow verification of hostnames. This does not perform a
|
||||
* struct check on the content of labels (classes of Unicode characters, etc.)
|
||||
* but instead check that the structure is valid (number of labels, length of
|
||||
* labels, etc.).
|
||||
*
|
||||
* If you need stricter validation, consider using an external library.
|
||||
*/
|
||||
/**
|
||||
* Check if a hostname string is valid. It's usually a preliminary check before
|
||||
* trying to use getDomain or anything else.
|
||||
*
|
||||
* Beware: it does not check if the TLD exists.
|
||||
*/
|
||||
export default function (hostname: string): boolean;
|
||||
2
frontend/node_modules/tldts-core/dist/types/src/lookup/fast-path.d.ts
generated
vendored
Normal file
2
frontend/node_modules/tldts-core/dist/types/src/lookup/fast-path.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { IPublicSuffix, ISuffixLookupOptions } from './interface';
|
||||
export default function (hostname: string, options: ISuffixLookupOptions, out: IPublicSuffix): boolean;
|
||||
9
frontend/node_modules/tldts-core/dist/types/src/lookup/interface.d.ts
generated
vendored
Normal file
9
frontend/node_modules/tldts-core/dist/types/src/lookup/interface.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export interface IPublicSuffix {
|
||||
isIcann: boolean | null;
|
||||
isPrivate: boolean | null;
|
||||
publicSuffix: string | null;
|
||||
}
|
||||
export interface ISuffixLookupOptions {
|
||||
allowIcannDomains: boolean;
|
||||
allowPrivateDomains: boolean;
|
||||
}
|
||||
10
frontend/node_modules/tldts-core/dist/types/src/options.d.ts
generated
vendored
Normal file
10
frontend/node_modules/tldts-core/dist/types/src/options.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export interface IOptions {
|
||||
allowIcannDomains: boolean;
|
||||
allowPrivateDomains: boolean;
|
||||
detectIp: boolean;
|
||||
extractHostname: boolean;
|
||||
mixedInputs: boolean;
|
||||
validHosts: string[] | null;
|
||||
validateHostname: boolean;
|
||||
}
|
||||
export declare function setDefaults(options?: Partial<IOptions>): IOptions;
|
||||
4
frontend/node_modules/tldts-core/dist/types/src/subdomain.d.ts
generated
vendored
Normal file
4
frontend/node_modules/tldts-core/dist/types/src/subdomain.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* Returns the subdomain of a hostname string
|
||||
*/
|
||||
export default function getSubdomain(hostname: string, domain: string): string;
|
||||
10
frontend/node_modules/tldts-core/index.ts
generated
vendored
Normal file
10
frontend/node_modules/tldts-core/index.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export {
|
||||
FLAG,
|
||||
parseImpl,
|
||||
IResult,
|
||||
getEmptyResult,
|
||||
resetResult,
|
||||
} from './src/factory';
|
||||
export { IPublicSuffix, ISuffixLookupOptions } from './src/lookup/interface';
|
||||
export { default as fastPathLookup } from './src/lookup/fast-path';
|
||||
export { IOptions, setDefaults } from './src/options';
|
||||
68
frontend/node_modules/tldts-core/package.json
generated
vendored
Normal file
68
frontend/node_modules/tldts-core/package.json
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"name": "tldts-core",
|
||||
"version": "6.1.86",
|
||||
"description": "tldts core primitives (internal module)",
|
||||
"author": {
|
||||
"name": "Rémi Berson"
|
||||
},
|
||||
"contributors": [
|
||||
"Alexei <alexeiatyahoodotcom@gmail.com>",
|
||||
"Alexey <kureev-mail@ya.ru>",
|
||||
"Andrew <chefandrew@seomoz.org>",
|
||||
"Johannes Ewald <johannes.ewald@peerigon.com>",
|
||||
"Jérôme Desboeufs <jerome.desboeufs@gmail.com>",
|
||||
"Kelly Campbell <kelly.a.campbell@gmail.com>",
|
||||
"Kiko Beats <josefrancisco.verdu@gmail.com>",
|
||||
"Kris Reeves <krisreeves@searchfanatics.com>",
|
||||
"Krzysztof Jan Modras <chrmod@chrmod.net>",
|
||||
"Olivier Melcher <olivier.melcher@gmail.com>",
|
||||
"Rémi Berson <remi.berson@pm.me>",
|
||||
"Saad Rashid <srashid@lendinghome.com>",
|
||||
"Thomas Parisot <hi@oncletom.io>",
|
||||
"Timo Tijhof <krinklemail@gmail.com>",
|
||||
"Xavier Damman <xdamman@gmail.com>",
|
||||
"Yehezkiel Syamsuhadi <yehezkielbs@gmail.com>"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/remusao/tldts#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/remusao/tldts/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/remusao/tldts.git"
|
||||
},
|
||||
"main": "dist/cjs/index.js",
|
||||
"module": "dist/es6/index.js",
|
||||
"types": "dist/types/index.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"src",
|
||||
"index.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"build": "tsc --build ./tsconfig.json",
|
||||
"bundle": "tsc --build ./tsconfig.bundle.json && rollup --config ./rollup.config.ts --configPlugin typescript",
|
||||
"prepack": "yarn run bundle",
|
||||
"test": "nyc mocha --config ../../.mocharc.cjs"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-node-resolve": "^16.0.0",
|
||||
"@rollup/plugin-typescript": "^12.1.0",
|
||||
"@types/chai": "^4.2.18",
|
||||
"@types/mocha": "^10.0.0",
|
||||
"@types/node": "^22.0.0",
|
||||
"chai": "^4.4.1",
|
||||
"mocha": "^11.0.1",
|
||||
"nyc": "^17.0.0",
|
||||
"rimraf": "^5.0.1",
|
||||
"rollup": "^4.1.0",
|
||||
"rollup-plugin-sourcemaps": "^0.6.1",
|
||||
"typescript": "^5.0.4"
|
||||
},
|
||||
"gitHead": "94251baa0e4ee46df6fd06fcd3749fcdf9b14ebc"
|
||||
}
|
||||
14
frontend/node_modules/tldts-core/src/domain-without-suffix.ts
generated
vendored
Normal file
14
frontend/node_modules/tldts-core/src/domain-without-suffix.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Return the part of domain without suffix.
|
||||
*
|
||||
* Example: for domain 'foo.com', the result would be 'foo'.
|
||||
*/
|
||||
export default function getDomainWithoutSuffix(
|
||||
domain: string,
|
||||
suffix: string,
|
||||
): string {
|
||||
// Note: here `domain` and `suffix` cannot have the same length because in
|
||||
// this case we set `domain` to `null` instead. It is thus safe to assume
|
||||
// that `suffix` is shorter than `domain`.
|
||||
return domain.slice(0, -suffix.length - 1);
|
||||
}
|
||||
100
frontend/node_modules/tldts-core/src/domain.ts
generated
vendored
Normal file
100
frontend/node_modules/tldts-core/src/domain.ts
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
import { IOptions } from './options';
|
||||
|
||||
/**
|
||||
* Check if `vhost` is a valid suffix of `hostname` (top-domain)
|
||||
*
|
||||
* It means that `vhost` needs to be a suffix of `hostname` and we then need to
|
||||
* make sure that: either they are equal, or the character preceding `vhost` in
|
||||
* `hostname` is a '.' (it should not be a partial label).
|
||||
*
|
||||
* * hostname = 'not.evil.com' and vhost = 'vil.com' => not ok
|
||||
* * hostname = 'not.evil.com' and vhost = 'evil.com' => ok
|
||||
* * hostname = 'not.evil.com' and vhost = 'not.evil.com' => ok
|
||||
*/
|
||||
function shareSameDomainSuffix(hostname: string, vhost: string): boolean {
|
||||
if (hostname.endsWith(vhost)) {
|
||||
return (
|
||||
hostname.length === vhost.length ||
|
||||
hostname[hostname.length - vhost.length - 1] === '.'
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a hostname and its public suffix, extract the general domain.
|
||||
*/
|
||||
function extractDomainWithSuffix(
|
||||
hostname: string,
|
||||
publicSuffix: string,
|
||||
): string {
|
||||
// Locate the index of the last '.' in the part of the `hostname` preceding
|
||||
// the public suffix.
|
||||
//
|
||||
// examples:
|
||||
// 1. not.evil.co.uk => evil.co.uk
|
||||
// ^ ^
|
||||
// | | start of public suffix
|
||||
// | index of the last dot
|
||||
//
|
||||
// 2. example.co.uk => example.co.uk
|
||||
// ^ ^
|
||||
// | | start of public suffix
|
||||
// |
|
||||
// | (-1) no dot found before the public suffix
|
||||
const publicSuffixIndex = hostname.length - publicSuffix.length - 2;
|
||||
const lastDotBeforeSuffixIndex = hostname.lastIndexOf('.', publicSuffixIndex);
|
||||
|
||||
// No '.' found, then `hostname` is the general domain (no sub-domain)
|
||||
if (lastDotBeforeSuffixIndex === -1) {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
// Extract the part between the last '.'
|
||||
return hostname.slice(lastDotBeforeSuffixIndex + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects the domain based on rules and upon and a host string
|
||||
*/
|
||||
export default function getDomain(
|
||||
suffix: string,
|
||||
hostname: string,
|
||||
options: IOptions,
|
||||
): string | null {
|
||||
// Check if `hostname` ends with a member of `validHosts`.
|
||||
if (options.validHosts !== null) {
|
||||
const validHosts = options.validHosts;
|
||||
for (const vhost of validHosts) {
|
||||
if (/*@__INLINE__*/ shareSameDomainSuffix(hostname, vhost)) {
|
||||
return vhost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let numberOfLeadingDots = 0;
|
||||
if (hostname.startsWith('.')) {
|
||||
while (
|
||||
numberOfLeadingDots < hostname.length &&
|
||||
hostname[numberOfLeadingDots] === '.'
|
||||
) {
|
||||
numberOfLeadingDots += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// If `hostname` is a valid public suffix, then there is no domain to return.
|
||||
// Since we already know that `getPublicSuffix` returns a suffix of `hostname`
|
||||
// there is no need to perform a string comparison and we only compare the
|
||||
// size.
|
||||
if (suffix.length === hostname.length - numberOfLeadingDots) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// To extract the general domain, we start by identifying the public suffix
|
||||
// (if any), then consider the domain to be the public suffix with one added
|
||||
// level of depth. (e.g.: if hostname is `not.evil.co.uk` and public suffix:
|
||||
// `co.uk`, then we take one more level: `evil`, giving the final result:
|
||||
// `evil.co.uk`).
|
||||
return /*@__INLINE__*/ extractDomainWithSuffix(hostname, suffix);
|
||||
}
|
||||
170
frontend/node_modules/tldts-core/src/extract-hostname.ts
generated
vendored
Normal file
170
frontend/node_modules/tldts-core/src/extract-hostname.ts
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
/**
|
||||
* @param url - URL we want to extract a hostname from.
|
||||
* @param urlIsValidHostname - hint from caller; true if `url` is already a valid hostname.
|
||||
*/
|
||||
export default function extractHostname(
|
||||
url: string,
|
||||
urlIsValidHostname: boolean,
|
||||
): string | null {
|
||||
let start = 0;
|
||||
let end: number = url.length;
|
||||
let hasUpper = false;
|
||||
|
||||
// If url is not already a valid hostname, then try to extract hostname.
|
||||
if (!urlIsValidHostname) {
|
||||
// Special handling of data URLs
|
||||
if (url.startsWith('data:')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Trim leading spaces
|
||||
while (start < url.length && url.charCodeAt(start) <= 32) {
|
||||
start += 1;
|
||||
}
|
||||
|
||||
// Trim trailing spaces
|
||||
while (end > start + 1 && url.charCodeAt(end - 1) <= 32) {
|
||||
end -= 1;
|
||||
}
|
||||
|
||||
// Skip scheme.
|
||||
if (
|
||||
url.charCodeAt(start) === 47 /* '/' */ &&
|
||||
url.charCodeAt(start + 1) === 47 /* '/' */
|
||||
) {
|
||||
start += 2;
|
||||
} else {
|
||||
const indexOfProtocol = url.indexOf(':/', start);
|
||||
if (indexOfProtocol !== -1) {
|
||||
// Implement fast-path for common protocols. We expect most protocols
|
||||
// should be one of these 4 and thus we will not need to perform the
|
||||
// more expansive validity check most of the time.
|
||||
const protocolSize = indexOfProtocol - start;
|
||||
const c0 = url.charCodeAt(start);
|
||||
const c1 = url.charCodeAt(start + 1);
|
||||
const c2 = url.charCodeAt(start + 2);
|
||||
const c3 = url.charCodeAt(start + 3);
|
||||
const c4 = url.charCodeAt(start + 4);
|
||||
|
||||
if (
|
||||
protocolSize === 5 &&
|
||||
c0 === 104 /* 'h' */ &&
|
||||
c1 === 116 /* 't' */ &&
|
||||
c2 === 116 /* 't' */ &&
|
||||
c3 === 112 /* 'p' */ &&
|
||||
c4 === 115 /* 's' */
|
||||
) {
|
||||
// https
|
||||
} else if (
|
||||
protocolSize === 4 &&
|
||||
c0 === 104 /* 'h' */ &&
|
||||
c1 === 116 /* 't' */ &&
|
||||
c2 === 116 /* 't' */ &&
|
||||
c3 === 112 /* 'p' */
|
||||
) {
|
||||
// http
|
||||
} else if (
|
||||
protocolSize === 3 &&
|
||||
c0 === 119 /* 'w' */ &&
|
||||
c1 === 115 /* 's' */ &&
|
||||
c2 === 115 /* 's' */
|
||||
) {
|
||||
// wss
|
||||
} else if (
|
||||
protocolSize === 2 &&
|
||||
c0 === 119 /* 'w' */ &&
|
||||
c1 === 115 /* 's' */
|
||||
) {
|
||||
// ws
|
||||
} else {
|
||||
// Check that scheme is valid
|
||||
for (let i = start; i < indexOfProtocol; i += 1) {
|
||||
const lowerCaseCode = url.charCodeAt(i) | 32;
|
||||
if (
|
||||
!(
|
||||
(
|
||||
(lowerCaseCode >= 97 && lowerCaseCode <= 122) || // [a, z]
|
||||
(lowerCaseCode >= 48 && lowerCaseCode <= 57) || // [0, 9]
|
||||
lowerCaseCode === 46 || // '.'
|
||||
lowerCaseCode === 45 || // '-'
|
||||
lowerCaseCode === 43
|
||||
) // '+'
|
||||
)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Skip 0, 1 or more '/' after ':/'
|
||||
start = indexOfProtocol + 2;
|
||||
while (url.charCodeAt(start) === 47 /* '/' */) {
|
||||
start += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Detect first occurrence of '/', '?' or '#'. We also keep track of the
|
||||
// last occurrence of '@', ']' or ':' to speed-up subsequent parsing of
|
||||
// (respectively), identifier, ipv6 or port.
|
||||
let indexOfIdentifier = -1;
|
||||
let indexOfClosingBracket = -1;
|
||||
let indexOfPort = -1;
|
||||
for (let i = start; i < end; i += 1) {
|
||||
const code: number = url.charCodeAt(i);
|
||||
if (
|
||||
code === 35 || // '#'
|
||||
code === 47 || // '/'
|
||||
code === 63 // '?'
|
||||
) {
|
||||
end = i;
|
||||
break;
|
||||
} else if (code === 64) {
|
||||
// '@'
|
||||
indexOfIdentifier = i;
|
||||
} else if (code === 93) {
|
||||
// ']'
|
||||
indexOfClosingBracket = i;
|
||||
} else if (code === 58) {
|
||||
// ':'
|
||||
indexOfPort = i;
|
||||
} else if (code >= 65 && code <= 90) {
|
||||
hasUpper = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Detect identifier: '@'
|
||||
if (
|
||||
indexOfIdentifier !== -1 &&
|
||||
indexOfIdentifier > start &&
|
||||
indexOfIdentifier < end
|
||||
) {
|
||||
start = indexOfIdentifier + 1;
|
||||
}
|
||||
|
||||
// Handle ipv6 addresses
|
||||
if (url.charCodeAt(start) === 91 /* '[' */) {
|
||||
if (indexOfClosingBracket !== -1) {
|
||||
return url.slice(start + 1, indexOfClosingBracket).toLowerCase();
|
||||
}
|
||||
return null;
|
||||
} else if (indexOfPort !== -1 && indexOfPort > start && indexOfPort < end) {
|
||||
// Detect port: ':'
|
||||
end = indexOfPort;
|
||||
}
|
||||
}
|
||||
|
||||
// Trim trailing dots
|
||||
while (end > start + 1 && url.charCodeAt(end - 1) === 46 /* '.' */) {
|
||||
end -= 1;
|
||||
}
|
||||
|
||||
const hostname: string =
|
||||
start !== 0 || end !== url.length ? url.slice(start, end) : url;
|
||||
|
||||
if (hasUpper) {
|
||||
return hostname.toLowerCase();
|
||||
}
|
||||
|
||||
return hostname;
|
||||
}
|
||||
160
frontend/node_modules/tldts-core/src/factory.ts
generated
vendored
Normal file
160
frontend/node_modules/tldts-core/src/factory.ts
generated
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
/**
|
||||
* Implement a factory allowing to plug different implementations of suffix
|
||||
* lookup (e.g.: using a trie or the packed hashes datastructures). This is used
|
||||
* and exposed in `tldts.ts` and `tldts-experimental.ts` bundle entrypoints.
|
||||
*/
|
||||
|
||||
import getDomain from './domain';
|
||||
import getDomainWithoutSuffix from './domain-without-suffix';
|
||||
import extractHostname from './extract-hostname';
|
||||
import isIp from './is-ip';
|
||||
import isValidHostname from './is-valid';
|
||||
import { IPublicSuffix, ISuffixLookupOptions } from './lookup/interface';
|
||||
import { IOptions, setDefaults } from './options';
|
||||
import getSubdomain from './subdomain';
|
||||
|
||||
export interface IResult {
|
||||
// `hostname` is either a registered name (including but not limited to a
|
||||
// hostname), or an IP address. IPv4 addresses must be in dot-decimal
|
||||
// notation, and IPv6 addresses must be enclosed in brackets ([]). This is
|
||||
// directly extracted from the input URL.
|
||||
hostname: string | null;
|
||||
|
||||
// Is `hostname` an IP? (IPv4 or IPv6)
|
||||
isIp: boolean | null;
|
||||
|
||||
// `hostname` split between subdomain, domain and its public suffix (if any)
|
||||
subdomain: string | null;
|
||||
domain: string | null;
|
||||
publicSuffix: string | null;
|
||||
domainWithoutSuffix: string | null;
|
||||
|
||||
// Specifies if `publicSuffix` comes from the ICANN or PRIVATE section of the list
|
||||
isIcann: boolean | null;
|
||||
isPrivate: boolean | null;
|
||||
}
|
||||
|
||||
export function getEmptyResult(): IResult {
|
||||
return {
|
||||
domain: null,
|
||||
domainWithoutSuffix: null,
|
||||
hostname: null,
|
||||
isIcann: null,
|
||||
isIp: null,
|
||||
isPrivate: null,
|
||||
publicSuffix: null,
|
||||
subdomain: null,
|
||||
};
|
||||
}
|
||||
|
||||
export function resetResult(result: IResult): void {
|
||||
result.domain = null;
|
||||
result.domainWithoutSuffix = null;
|
||||
result.hostname = null;
|
||||
result.isIcann = null;
|
||||
result.isIp = null;
|
||||
result.isPrivate = null;
|
||||
result.publicSuffix = null;
|
||||
result.subdomain = null;
|
||||
}
|
||||
|
||||
// Flags representing steps in the `parse` function. They are used to implement
|
||||
// an early stop mechanism (simulating some form of laziness) to avoid doing
|
||||
// more work than necessary to perform a given action (e.g.: we don't need to
|
||||
// extract the domain and subdomain if we are only interested in public suffix).
|
||||
export const enum FLAG {
|
||||
HOSTNAME,
|
||||
IS_VALID,
|
||||
PUBLIC_SUFFIX,
|
||||
DOMAIN,
|
||||
SUB_DOMAIN,
|
||||
ALL,
|
||||
}
|
||||
|
||||
export function parseImpl(
|
||||
url: string,
|
||||
step: FLAG,
|
||||
suffixLookup: (
|
||||
_1: string,
|
||||
_2: ISuffixLookupOptions,
|
||||
_3: IPublicSuffix,
|
||||
) => void,
|
||||
partialOptions: Partial<IOptions>,
|
||||
result: IResult,
|
||||
): IResult {
|
||||
const options: IOptions = /*@__INLINE__*/ setDefaults(partialOptions);
|
||||
|
||||
// Very fast approximate check to make sure `url` is a string. This is needed
|
||||
// because the library will not necessarily be used in a typed setup and
|
||||
// values of arbitrary types might be given as argument.
|
||||
if (typeof url !== 'string') {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Extract hostname from `url` only if needed. This can be made optional
|
||||
// using `options.extractHostname`. This option will typically be used
|
||||
// whenever we are sure the inputs to `parse` are already hostnames and not
|
||||
// arbitrary URLs.
|
||||
//
|
||||
// `mixedInput` allows to specify if we expect a mix of URLs and hostnames
|
||||
// as input. If only hostnames are expected then `extractHostname` can be
|
||||
// set to `false` to speed-up parsing. If only URLs are expected then
|
||||
// `mixedInputs` can be set to `false`. The `mixedInputs` is only a hint
|
||||
// and will not change the behavior of the library.
|
||||
if (!options.extractHostname) {
|
||||
result.hostname = url;
|
||||
} else if (options.mixedInputs) {
|
||||
result.hostname = extractHostname(url, isValidHostname(url));
|
||||
} else {
|
||||
result.hostname = extractHostname(url, false);
|
||||
}
|
||||
|
||||
if (step === FLAG.HOSTNAME || result.hostname === null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Check if `hostname` is a valid ip address
|
||||
if (options.detectIp) {
|
||||
result.isIp = isIp(result.hostname);
|
||||
if (result.isIp) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// Perform optional hostname validation. If hostname is not valid, no need to
|
||||
// go further as there will be no valid domain or sub-domain.
|
||||
if (
|
||||
options.validateHostname &&
|
||||
options.extractHostname &&
|
||||
!isValidHostname(result.hostname)
|
||||
) {
|
||||
result.hostname = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Extract public suffix
|
||||
suffixLookup(result.hostname, options, result);
|
||||
if (step === FLAG.PUBLIC_SUFFIX || result.publicSuffix === null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Extract domain
|
||||
result.domain = getDomain(result.publicSuffix, result.hostname, options);
|
||||
if (step === FLAG.DOMAIN || result.domain === null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Extract subdomain
|
||||
result.subdomain = getSubdomain(result.hostname, result.domain);
|
||||
if (step === FLAG.SUB_DOMAIN) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Extract domain without suffix
|
||||
result.domainWithoutSuffix = getDomainWithoutSuffix(
|
||||
result.domain,
|
||||
result.publicSuffix,
|
||||
);
|
||||
|
||||
return result;
|
||||
}
|
||||
87
frontend/node_modules/tldts-core/src/is-ip.ts
generated
vendored
Normal file
87
frontend/node_modules/tldts-core/src/is-ip.ts
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Check if a hostname is an IP. You should be aware that this only works
|
||||
* because `hostname` is already garanteed to be a valid hostname!
|
||||
*/
|
||||
function isProbablyIpv4(hostname: string): boolean {
|
||||
// Cannot be shorted than 1.1.1.1
|
||||
if (hostname.length < 7) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Cannot be longer than: 255.255.255.255
|
||||
if (hostname.length > 15) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let numberOfDots = 0;
|
||||
|
||||
for (let i = 0; i < hostname.length; i += 1) {
|
||||
const code = hostname.charCodeAt(i);
|
||||
|
||||
if (code === 46 /* '.' */) {
|
||||
numberOfDots += 1;
|
||||
} else if (code < 48 /* '0' */ || code > 57 /* '9' */) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
numberOfDots === 3 &&
|
||||
hostname.charCodeAt(0) !== 46 /* '.' */ &&
|
||||
hostname.charCodeAt(hostname.length - 1) !== 46 /* '.' */
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to isProbablyIpv4.
|
||||
*/
|
||||
function isProbablyIpv6(hostname: string): boolean {
|
||||
if (hostname.length < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let start = hostname.startsWith('[') ? 1 : 0;
|
||||
let end = hostname.length;
|
||||
|
||||
if (hostname[end - 1] === ']') {
|
||||
end -= 1;
|
||||
}
|
||||
|
||||
// We only consider the maximum size of a normal IPV6. Note that this will
|
||||
// fail on so-called "IPv4 mapped IPv6 addresses" but this is a corner-case
|
||||
// and a proper validation library should be used for these.
|
||||
if (end - start > 39) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let hasColon = false;
|
||||
|
||||
for (; start < end; start += 1) {
|
||||
const code = hostname.charCodeAt(start);
|
||||
|
||||
if (code === 58 /* ':' */) {
|
||||
hasColon = true;
|
||||
} else if (
|
||||
!(
|
||||
(
|
||||
(code >= 48 && code <= 57) || // 0-9
|
||||
(code >= 97 && code <= 102) || // a-f
|
||||
(code >= 65 && code <= 90)
|
||||
) // A-F
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return hasColon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if `hostname` is *probably* a valid ip addr (either ipv6 or ipv4).
|
||||
* This *will not* work on any string. We need `hostname` to be a valid
|
||||
* hostname.
|
||||
*/
|
||||
export default function isIp(hostname: string): boolean {
|
||||
return isProbablyIpv6(hostname) || isProbablyIpv4(hostname);
|
||||
}
|
||||
79
frontend/node_modules/tldts-core/src/is-valid.ts
generated
vendored
Normal file
79
frontend/node_modules/tldts-core/src/is-valid.ts
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* Implements fast shallow verification of hostnames. This does not perform a
|
||||
* struct check on the content of labels (classes of Unicode characters, etc.)
|
||||
* but instead check that the structure is valid (number of labels, length of
|
||||
* labels, etc.).
|
||||
*
|
||||
* If you need stricter validation, consider using an external library.
|
||||
*/
|
||||
|
||||
function isValidAscii(code: number): boolean {
|
||||
return (
|
||||
(code >= 97 && code <= 122) || (code >= 48 && code <= 57) || code > 127
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a hostname string is valid. It's usually a preliminary check before
|
||||
* trying to use getDomain or anything else.
|
||||
*
|
||||
* Beware: it does not check if the TLD exists.
|
||||
*/
|
||||
export default function (hostname: string): boolean {
|
||||
if (hostname.length > 255) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hostname.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
/*@__INLINE__*/ !isValidAscii(hostname.charCodeAt(0)) &&
|
||||
hostname.charCodeAt(0) !== 46 && // '.' (dot)
|
||||
hostname.charCodeAt(0) !== 95 // '_' (underscore)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validate hostname according to RFC
|
||||
let lastDotIndex = -1;
|
||||
let lastCharCode = -1;
|
||||
const len = hostname.length;
|
||||
|
||||
for (let i = 0; i < len; i += 1) {
|
||||
const code = hostname.charCodeAt(i);
|
||||
if (code === 46 /* '.' */) {
|
||||
if (
|
||||
// Check that previous label is < 63 bytes long (64 = 63 + '.')
|
||||
i - lastDotIndex > 64 ||
|
||||
// Check that previous character was not already a '.'
|
||||
lastCharCode === 46 ||
|
||||
// Check that the previous label does not end with a '-' (dash)
|
||||
lastCharCode === 45 ||
|
||||
// Check that the previous label does not end with a '_' (underscore)
|
||||
lastCharCode === 95
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
lastDotIndex = i;
|
||||
} else if (
|
||||
!(/*@__INLINE__*/ (isValidAscii(code) || code === 45 || code === 95))
|
||||
) {
|
||||
// Check if there is a forbidden character in the label
|
||||
return false;
|
||||
}
|
||||
|
||||
lastCharCode = code;
|
||||
}
|
||||
|
||||
return (
|
||||
// Check that last label is shorter than 63 chars
|
||||
len - lastDotIndex - 1 <= 63 &&
|
||||
// Check that the last character is an allowed trailing label character.
|
||||
// Since we already checked that the char is a valid hostname character,
|
||||
// we only need to check that it's different from '-'.
|
||||
lastCharCode !== 45
|
||||
);
|
||||
}
|
||||
80
frontend/node_modules/tldts-core/src/lookup/fast-path.ts
generated
vendored
Normal file
80
frontend/node_modules/tldts-core/src/lookup/fast-path.ts
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
import { IPublicSuffix, ISuffixLookupOptions } from './interface';
|
||||
|
||||
export default function (
|
||||
hostname: string,
|
||||
options: ISuffixLookupOptions,
|
||||
out: IPublicSuffix,
|
||||
): boolean {
|
||||
// Fast path for very popular suffixes; this allows to by-pass lookup
|
||||
// completely as well as any extra allocation or string manipulation.
|
||||
if (!options.allowPrivateDomains && hostname.length > 3) {
|
||||
const last: number = hostname.length - 1;
|
||||
const c3: number = hostname.charCodeAt(last);
|
||||
const c2: number = hostname.charCodeAt(last - 1);
|
||||
const c1: number = hostname.charCodeAt(last - 2);
|
||||
const c0: number = hostname.charCodeAt(last - 3);
|
||||
|
||||
if (
|
||||
c3 === 109 /* 'm' */ &&
|
||||
c2 === 111 /* 'o' */ &&
|
||||
c1 === 99 /* 'c' */ &&
|
||||
c0 === 46 /* '.' */
|
||||
) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'com';
|
||||
return true;
|
||||
} else if (
|
||||
c3 === 103 /* 'g' */ &&
|
||||
c2 === 114 /* 'r' */ &&
|
||||
c1 === 111 /* 'o' */ &&
|
||||
c0 === 46 /* '.' */
|
||||
) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'org';
|
||||
return true;
|
||||
} else if (
|
||||
c3 === 117 /* 'u' */ &&
|
||||
c2 === 100 /* 'd' */ &&
|
||||
c1 === 101 /* 'e' */ &&
|
||||
c0 === 46 /* '.' */
|
||||
) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'edu';
|
||||
return true;
|
||||
} else if (
|
||||
c3 === 118 /* 'v' */ &&
|
||||
c2 === 111 /* 'o' */ &&
|
||||
c1 === 103 /* 'g' */ &&
|
||||
c0 === 46 /* '.' */
|
||||
) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'gov';
|
||||
return true;
|
||||
} else if (
|
||||
c3 === 116 /* 't' */ &&
|
||||
c2 === 101 /* 'e' */ &&
|
||||
c1 === 110 /* 'n' */ &&
|
||||
c0 === 46 /* '.' */
|
||||
) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'net';
|
||||
return true;
|
||||
} else if (
|
||||
c3 === 101 /* 'e' */ &&
|
||||
c2 === 100 /* 'd' */ &&
|
||||
c1 === 46 /* '.' */
|
||||
) {
|
||||
out.isIcann = true;
|
||||
out.isPrivate = false;
|
||||
out.publicSuffix = 'de';
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
10
frontend/node_modules/tldts-core/src/lookup/interface.ts
generated
vendored
Normal file
10
frontend/node_modules/tldts-core/src/lookup/interface.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export interface IPublicSuffix {
|
||||
isIcann: boolean | null;
|
||||
isPrivate: boolean | null;
|
||||
publicSuffix: string | null;
|
||||
}
|
||||
|
||||
export interface ISuffixLookupOptions {
|
||||
allowIcannDomains: boolean;
|
||||
allowPrivateDomains: boolean;
|
||||
}
|
||||
39
frontend/node_modules/tldts-core/src/options.ts
generated
vendored
Normal file
39
frontend/node_modules/tldts-core/src/options.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
export interface IOptions {
|
||||
allowIcannDomains: boolean;
|
||||
allowPrivateDomains: boolean;
|
||||
detectIp: boolean;
|
||||
extractHostname: boolean;
|
||||
mixedInputs: boolean;
|
||||
validHosts: string[] | null;
|
||||
validateHostname: boolean;
|
||||
}
|
||||
|
||||
function setDefaultsImpl({
|
||||
allowIcannDomains = true,
|
||||
allowPrivateDomains = false,
|
||||
detectIp = true,
|
||||
extractHostname = true,
|
||||
mixedInputs = true,
|
||||
validHosts = null,
|
||||
validateHostname = true,
|
||||
}: Partial<IOptions>): IOptions {
|
||||
return {
|
||||
allowIcannDomains,
|
||||
allowPrivateDomains,
|
||||
detectIp,
|
||||
extractHostname,
|
||||
mixedInputs,
|
||||
validHosts,
|
||||
validateHostname,
|
||||
};
|
||||
}
|
||||
|
||||
const DEFAULT_OPTIONS = /*@__INLINE__*/ setDefaultsImpl({});
|
||||
|
||||
export function setDefaults(options?: Partial<IOptions>): IOptions {
|
||||
if (options === undefined) {
|
||||
return DEFAULT_OPTIONS;
|
||||
}
|
||||
|
||||
return /*@__INLINE__*/ setDefaultsImpl(options);
|
||||
}
|
||||
11
frontend/node_modules/tldts-core/src/subdomain.ts
generated
vendored
Normal file
11
frontend/node_modules/tldts-core/src/subdomain.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Returns the subdomain of a hostname string
|
||||
*/
|
||||
export default function getSubdomain(hostname: string, domain: string): string {
|
||||
// If `hostname` and `domain` are the same, then there is no sub-domain
|
||||
if (domain.length === hostname.length) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return hostname.slice(0, -domain.length - 1);
|
||||
}
|
||||
Reference in New Issue
Block a user