first commit
This commit is contained in:
9
node_modules/psl/LICENSE
generated
vendored
Normal file
9
node_modules/psl/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Lupo Montero lupomontero@gmail.com
|
||||
|
||||
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.
|
260
node_modules/psl/README.md
generated
vendored
Normal file
260
node_modules/psl/README.md
generated
vendored
Normal file
@@ -0,0 +1,260 @@
|
||||
# psl (Public Suffix List)
|
||||
|
||||
[](https://github.com/lupomontero/psl/actions/workflows/node.js.yml)
|
||||
|
||||
`psl` is a `JavaScript` domain name parser based on the
|
||||
[Public Suffix List](https://publicsuffix.org/).
|
||||
|
||||
This implementation is tested against the
|
||||
[test data hosted by Mozilla](http://mxr.mozilla.org/mozilla-central/source/netwerk/test/unit/data/test_psl.txt?raw=1)
|
||||
and kindly provided by [Comodo](https://www.comodo.com/).
|
||||
|
||||
Cross browser testing provided by
|
||||
[<img alt="BrowserStack" width="160" src="./browserstack-logo.svg" />](https://www.browserstack.com/)
|
||||
|
||||
## What is the Public Suffix List?
|
||||
|
||||
The Public Suffix List is a cross-vendor initiative to provide an accurate list
|
||||
of domain name suffixes.
|
||||
|
||||
The Public Suffix List is an initiative of the Mozilla Project, but is
|
||||
maintained as a community resource. It is available for use in any software,
|
||||
but was originally created to meet the needs of browser manufacturers.
|
||||
|
||||
A "public suffix" is one under which Internet users can directly register names.
|
||||
Some examples of public suffixes are ".com", ".co.uk" and "pvt.k12.wy.us". The
|
||||
Public Suffix List is a list of all known public suffixes.
|
||||
|
||||
Source: http://publicsuffix.org
|
||||
|
||||
## Installation
|
||||
|
||||
This module is available both for Node.js and the browser. See below for more
|
||||
details.
|
||||
|
||||
### Node.js
|
||||
|
||||
This module is tested on Node.js v8, v10, v12, v14, v16, v18, v20 and v22. See
|
||||
[`.github/workflows/node.js.yml`](.github/workflows/node.js.yml).
|
||||
|
||||
```sh
|
||||
npm install psl
|
||||
```
|
||||
|
||||
#### ESM
|
||||
|
||||
From version `v1.13.0` you can now import `psl` as ESM.
|
||||
|
||||
```js
|
||||
import psl from 'psl';
|
||||
```
|
||||
|
||||
#### CommonJS
|
||||
|
||||
If your project still uses CommonJS, you can continue importing the module like
|
||||
in previous versions.
|
||||
|
||||
```js
|
||||
const psl = require('psl');
|
||||
```
|
||||
|
||||
### Browser
|
||||
|
||||
#### Using a bundler
|
||||
|
||||
If you are using a bundler to build your app, you should be able to `import`
|
||||
and/or `require` the module just like in Node.js.
|
||||
|
||||
#### ESM (using a CDN)
|
||||
|
||||
In modern browsers you can also import the ESM directly from a `CDN`. For
|
||||
example:
|
||||
|
||||
```js
|
||||
import psl from 'https://unpkg.com/psl@latest/dist/psl.mjs';
|
||||
```
|
||||
|
||||
#### UMD / CommonJS
|
||||
|
||||
Finally, you can still download [`dist/psl.umd.cjs`](https://raw.githubusercontent.com/lupomontero/psl/main/dist/psl.umd.cjs)
|
||||
and include it in a script tag.
|
||||
|
||||
```html
|
||||
<script src="psl.umd.cjs"></script>
|
||||
```
|
||||
|
||||
This script is bundled and wrapped in a [umd](https://github.com/umdjs/umd)
|
||||
wrapper so you should be able to use it standalone or together with a module
|
||||
loader.
|
||||
|
||||
The script is also available on most popular CDNs. For example:
|
||||
|
||||
* https://unpkg.com/psl@latest/dist/psl.umd.cjs
|
||||
|
||||
## API
|
||||
|
||||
### `psl.parse(domain)`
|
||||
|
||||
Parse domain based on Public Suffix List. Returns an `Object` with the following
|
||||
properties:
|
||||
|
||||
* `tld`: Top level domain (this is the _public suffix_).
|
||||
* `sld`: Second level domain (the first private part of the domain name).
|
||||
* `domain`: The domain name is the `sld` + `tld`.
|
||||
* `subdomain`: Optional parts left of the domain.
|
||||
|
||||
#### Examples
|
||||
|
||||
Parse domain without subdomain:
|
||||
|
||||
```js
|
||||
import psl from 'psl';
|
||||
|
||||
const parsed = psl.parse('google.com');
|
||||
console.log(parsed.tld); // 'com'
|
||||
console.log(parsed.sld); // 'google'
|
||||
console.log(parsed.domain); // 'google.com'
|
||||
console.log(parsed.subdomain); // null
|
||||
```
|
||||
|
||||
Parse domain with subdomain:
|
||||
|
||||
```js
|
||||
import psl from 'psl';
|
||||
|
||||
const parsed = psl.parse('www.google.com');
|
||||
console.log(parsed.tld); // 'com'
|
||||
console.log(parsed.sld); // 'google'
|
||||
console.log(parsed.domain); // 'google.com'
|
||||
console.log(parsed.subdomain); // 'www'
|
||||
```
|
||||
|
||||
Parse domain with nested subdomains:
|
||||
|
||||
```js
|
||||
import psl from 'psl';
|
||||
|
||||
const parsed = psl.parse('a.b.c.d.foo.com');
|
||||
console.log(parsed.tld); // 'com'
|
||||
console.log(parsed.sld); // 'foo'
|
||||
console.log(parsed.domain); // 'foo.com'
|
||||
console.log(parsed.subdomain); // 'a.b.c.d'
|
||||
```
|
||||
|
||||
### `psl.get(domain)`
|
||||
|
||||
Get domain name, `sld` + `tld`. Returns `null` if not valid.
|
||||
|
||||
#### Examples
|
||||
|
||||
```js
|
||||
import psl from 'psl';
|
||||
|
||||
// null input.
|
||||
psl.get(null); // null
|
||||
|
||||
// Mixed case.
|
||||
psl.get('COM'); // null
|
||||
psl.get('example.COM'); // 'example.com'
|
||||
psl.get('WwW.example.COM'); // 'example.com'
|
||||
|
||||
// Unlisted TLD.
|
||||
psl.get('example'); // null
|
||||
psl.get('example.example'); // 'example.example'
|
||||
psl.get('b.example.example'); // 'example.example'
|
||||
psl.get('a.b.example.example'); // 'example.example'
|
||||
|
||||
// TLD with only 1 rule.
|
||||
psl.get('biz'); // null
|
||||
psl.get('domain.biz'); // 'domain.biz'
|
||||
psl.get('b.domain.biz'); // 'domain.biz'
|
||||
psl.get('a.b.domain.biz'); // 'domain.biz'
|
||||
|
||||
// TLD with some 2-level rules.
|
||||
psl.get('uk.com'); // null);
|
||||
psl.get('example.uk.com'); // 'example.uk.com');
|
||||
psl.get('b.example.uk.com'); // 'example.uk.com');
|
||||
|
||||
// More complex TLD.
|
||||
psl.get('c.kobe.jp'); // null
|
||||
psl.get('b.c.kobe.jp'); // 'b.c.kobe.jp'
|
||||
psl.get('a.b.c.kobe.jp'); // 'b.c.kobe.jp'
|
||||
psl.get('city.kobe.jp'); // 'city.kobe.jp'
|
||||
psl.get('www.city.kobe.jp'); // 'city.kobe.jp'
|
||||
|
||||
// IDN labels.
|
||||
psl.get('食狮.com.cn'); // '食狮.com.cn'
|
||||
psl.get('食狮.公司.cn'); // '食狮.公司.cn'
|
||||
psl.get('www.食狮.公司.cn'); // '食狮.公司.cn'
|
||||
|
||||
// Same as above, but punycoded.
|
||||
psl.get('xn--85x722f.com.cn'); // 'xn--85x722f.com.cn'
|
||||
psl.get('xn--85x722f.xn--55qx5d.cn'); // 'xn--85x722f.xn--55qx5d.cn'
|
||||
psl.get('www.xn--85x722f.xn--55qx5d.cn'); // 'xn--85x722f.xn--55qx5d.cn'
|
||||
```
|
||||
|
||||
### `psl.isValid(domain)`
|
||||
|
||||
Check whether a domain has a valid Public Suffix. Returns a `Boolean` indicating
|
||||
whether the domain has a valid Public Suffix.
|
||||
|
||||
#### Example
|
||||
|
||||
```js
|
||||
import psl from 'psl';
|
||||
|
||||
psl.isValid('google.com'); // true
|
||||
psl.isValid('www.google.com'); // true
|
||||
psl.isValid('x.yz'); // false
|
||||
```
|
||||
|
||||
## Testing and Building
|
||||
|
||||
There are tests both for Node.js and the browser (using [Playwright](https://playwright.dev)
|
||||
and [BrowserStack](https://www.browserstack.com/)).
|
||||
|
||||
```sh
|
||||
# Run tests in node.
|
||||
npm test
|
||||
# Run tests in browserstack.
|
||||
npm run test:browserstack
|
||||
|
||||
# Update rules from publicsuffix.org
|
||||
npm run update-rules
|
||||
|
||||
# Build ESM, CJS and UMD and create dist files
|
||||
npm run build
|
||||
```
|
||||
|
||||
Feel free to fork if you see possible improvements!
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
* Mozilla Foundation's [Public Suffix List](https://publicsuffix.org/)
|
||||
* Thanks to Rob Stradling of [Comodo](https://www.comodo.com/) for providing
|
||||
test data.
|
||||
* Inspired by [weppos/publicsuffix-ruby](https://github.com/weppos/publicsuffix-ruby)
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2024 Lupo Montero <lupomontero@gmail.com>
|
||||
|
||||
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.
|
13
node_modules/psl/SECURITY.md
generated
vendored
Normal file
13
node_modules/psl/SECURITY.md
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 1.x | :white_check_mark: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
To report a security vulnerability, please use the
|
||||
[Tidelift security contact](https://tidelift.com/security).
|
||||
Tidelift will coordinate the fix and disclosure.
|
90
node_modules/psl/browserstack-logo.svg
generated
vendored
Normal file
90
node_modules/psl/browserstack-logo.svg
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 490.1 105.6" style="enable-background:new 0 0 490.1 105.6;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#F4B960;}
|
||||
.st1{fill:#E66F32;}
|
||||
.st2{fill:#E43C41;}
|
||||
.st3{fill:#BDD041;}
|
||||
.st4{fill:#6DB54C;}
|
||||
.st5{fill:#AEDAE6;}
|
||||
.st6{fill:#56B8DE;}
|
||||
.st7{fill:#00B1D5;}
|
||||
.st8{fill:url(#SVGID_1_);}
|
||||
.st9{fill:#221F1F;}
|
||||
.st10{fill:#FFFFFF;}
|
||||
.st11{fill:#000111;}
|
||||
</style>
|
||||
<title>Browserstack-logo-white</title>
|
||||
<circle class="st0" cx="52.8" cy="52.8" r="52.8"/>
|
||||
<circle class="st1" cx="47.5" cy="47.5" r="47.5"/>
|
||||
<circle class="st2" cx="53.8" cy="41.1" r="41.1"/>
|
||||
<circle class="st3" cx="57.1" cy="44.4" r="37.8"/>
|
||||
<circle class="st4" cx="54.3" cy="47.2" r="35.1"/>
|
||||
<circle class="st5" cx="48.8" cy="41.7" r="29.5"/>
|
||||
<circle class="st6" cx="53.6" cy="36.8" r="24.7"/>
|
||||
<circle class="st7" cx="56.6" cy="39.9" r="21.7"/>
|
||||
<radialGradient id="SVGID_1_" cx="53.45" cy="63.02" r="18.57" gradientTransform="matrix(1 0 0 -1 0 106)" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" style="stop-color:#797979"/>
|
||||
<stop offset="1" style="stop-color:#4C4C4C"/>
|
||||
</radialGradient>
|
||||
<circle class="st8" cx="53.5" cy="43" r="18.6"/>
|
||||
<circle class="st9" cx="53.5" cy="43" r="18.6"/>
|
||||
<ellipse transform="matrix(0.4094 -0.9123 0.9123 0.4094 2.8913 76.9251)" class="st10" cx="60.9" cy="36.2" rx="5.7" ry="3.7"/>
|
||||
<path class="st11" d="M122.5,32.6c0-0.3,0.3-0.6,0.6-0.6c0,0,0,0,0.1,0h16.6c9.5,0,13.9,4.4,13.9,11c0.2,3.7-1.8,7.2-5.2,8.8v0.1
|
||||
c3.7,1.5,6.1,5.2,6,9.3c0,8.2-5.6,12.2-15.4,12.2h-16c-0.3,0-0.6-0.2-0.7-0.5c0,0,0,0,0-0.1L122.5,32.6L122.5,32.6z M139.6,49.1
|
||||
c3.9,0,6.4-2.2,6.4-5.4s-2.4-5.5-6.4-5.5h-8.9c-0.2,0-0.4,0.1-0.4,0.3c0,0,0,0,0,0.1v10.2c0,0.2,0.1,0.3,0.3,0.4c0,0,0,0,0.1,0
|
||||
H139.6L139.6,49.1z M130.6,66.9h9.3c4.3,0,6.8-2.3,6.8-5.8s-2.4-5.7-6.7-5.7h-9.3c-0.2,0-0.4,0.1-0.4,0.3c0,0,0,0,0,0.1v10.7
|
||||
C130.3,66.8,130.4,66.9,130.6,66.9C130.6,66.9,130.6,66.9,130.6,66.9L130.6,66.9z"/>
|
||||
<path class="st11" d="M159.9,73.3c-0.3,0-0.6-0.2-0.7-0.5c0,0,0,0,0-0.1V44.6c0-0.3,0.3-0.6,0.6-0.6c0,0,0,0,0.1,0h6
|
||||
c0.3,0,0.6,0.2,0.7,0.5c0,0,0,0,0,0.1v2.5h0.1c1.5-2.2,4.2-3.8,8.2-3.8c2.4,0,4.8,0.8,6.6,2.4c0.3,0.3,0.4,0.5,0.1,0.8l-3.5,4.1
|
||||
c-0.2,0.3-0.6,0.4-0.9,0.2c0,0,0,0-0.1,0c-1.4-0.9-3-1.4-4.7-1.4c-4.1,0-6,2.7-6,7.4v15.9c0,0.3-0.3,0.6-0.6,0.6c0,0,0,0-0.1,0
|
||||
H159.9L159.9,73.3z"/>
|
||||
<path class="st11" d="M182.9,65.8c-0.8-2.3-1.1-4.8-1.1-7.2c-0.1-2.5,0.3-4.9,1.1-7.2c1.8-5.1,6.6-8.1,13.1-8.1s11.2,3,13,8.1
|
||||
c0.8,2.3,1.1,4.8,1.1,7.2c0.1,2.5-0.3,4.9-1.1,7.2c-1.8,5.1-6.6,8.1-13,8.1S184.7,71,182.9,65.8z M201.9,64c0.5-1.7,0.8-3.6,0.7-5.4
|
||||
c0.1-1.8-0.1-3.7-0.7-5.4c-0.9-2.5-3.3-4-5.9-3.8c-2.6-0.2-5.1,1.4-6,3.8c-0.5,1.8-0.8,3.6-0.7,5.4c-0.1,1.8,0.1,3.7,0.7,5.4
|
||||
c0.9,2.5,3.4,4,6,3.8C198.6,68,201,66.5,201.9,64L201.9,64z"/>
|
||||
<path class="st11" d="M241.9,73.3c-0.4,0-0.7-0.3-0.8-0.6L235,53.9h-0.1l-6.2,18.7c-0.1,0.4-0.4,0.6-0.8,0.6h-5.4
|
||||
c-0.4,0-0.7-0.3-0.8-0.6l-10-28.1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,0.1,0h6c0.3,0,0.6,0.2,0.7,0.5c0,0,0,0,0,0.1v23.8
|
||||
l10.8-11.8c0.3-0.4,0.8-0.6,1.2-0.6h6.7c0.2,0,0.4,0.1,0.4,0.3c0,0.1,0,0.3-0.1,0.3l-10.1,10.7L490,72.7c0.1,0.2,0.1,0.4,0,0.5
|
||||
c-0.1,0.1-0.2,0.1-0.3,0.1H482.8L482.8,73.3z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 7.4 KiB |
9778
node_modules/psl/data/rules.js
generated
vendored
Normal file
9778
node_modules/psl/data/rules.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/psl/dist/psl.cjs
generated
vendored
Normal file
1
node_modules/psl/dist/psl.cjs
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
10008
node_modules/psl/dist/psl.mjs
generated
vendored
Normal file
10008
node_modules/psl/dist/psl.mjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/psl/dist/psl.umd.cjs
generated
vendored
Normal file
1
node_modules/psl/dist/psl.umd.cjs
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
247
node_modules/psl/index.js
generated
vendored
Normal file
247
node_modules/psl/index.js
generated
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
import punycode from 'punycode/punycode.js';
|
||||
import rules from './data/rules.js';
|
||||
|
||||
//
|
||||
// Parse rules from file.
|
||||
//
|
||||
const rulesByPunySuffix = rules.reduce(
|
||||
(map, rule) => {
|
||||
const suffix = rule.replace(/^(\*\.|\!)/, '');
|
||||
const punySuffix = punycode.toASCII(suffix);
|
||||
const firstChar = rule.charAt(0);
|
||||
|
||||
if (map.has(punySuffix)) {
|
||||
throw new Error(`Multiple rules found for ${rule} (${punySuffix})`);
|
||||
}
|
||||
|
||||
map.set(punySuffix, {
|
||||
rule,
|
||||
suffix,
|
||||
punySuffix,
|
||||
wildcard: firstChar === '*',
|
||||
exception: firstChar === '!'
|
||||
});
|
||||
|
||||
return map;
|
||||
},
|
||||
new Map(),
|
||||
);
|
||||
|
||||
//
|
||||
// Find rule for a given domain.
|
||||
//
|
||||
const findRule = (domain) => {
|
||||
const punyDomain = punycode.toASCII(domain);
|
||||
const punyDomainChunks = punyDomain.split('.');
|
||||
|
||||
for (let i = 0; i < punyDomainChunks.length; i++) {
|
||||
const suffix = punyDomainChunks.slice(i).join('.');
|
||||
const matchingRules = rulesByPunySuffix.get(suffix);
|
||||
if (matchingRules) {
|
||||
return matchingRules;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
//
|
||||
// Error codes and messages.
|
||||
//
|
||||
export const errorCodes = {
|
||||
DOMAIN_TOO_SHORT: 'Domain name too short.',
|
||||
DOMAIN_TOO_LONG: 'Domain name too long. It should be no more than 255 chars.',
|
||||
LABEL_STARTS_WITH_DASH: 'Domain name label can not start with a dash.',
|
||||
LABEL_ENDS_WITH_DASH: 'Domain name label can not end with a dash.',
|
||||
LABEL_TOO_LONG: 'Domain name label should be at most 63 chars long.',
|
||||
LABEL_TOO_SHORT: 'Domain name label should be at least 1 character long.',
|
||||
LABEL_INVALID_CHARS: 'Domain name label can only contain alphanumeric characters or dashes.'
|
||||
};
|
||||
|
||||
//
|
||||
// Validate domain name and throw if not valid.
|
||||
//
|
||||
// From wikipedia:
|
||||
//
|
||||
// Hostnames are composed of series of labels concatenated with dots, as are all
|
||||
// domain names. Each label must be between 1 and 63 characters long, and the
|
||||
// entire hostname (including the delimiting dots) has a maximum of 255 chars.
|
||||
//
|
||||
// Allowed chars:
|
||||
//
|
||||
// * `a-z`
|
||||
// * `0-9`
|
||||
// * `-` but not as a starting or ending character
|
||||
// * `.` as a separator for the textual portions of a domain name
|
||||
//
|
||||
// * http://en.wikipedia.org/wiki/Domain_name
|
||||
// * http://en.wikipedia.org/wiki/Hostname
|
||||
//
|
||||
const validate = (input) => {
|
||||
// Before we can validate we need to take care of IDNs with unicode chars.
|
||||
const ascii = punycode.toASCII(input);
|
||||
|
||||
if (ascii.length < 1) {
|
||||
return 'DOMAIN_TOO_SHORT';
|
||||
}
|
||||
if (ascii.length > 255) {
|
||||
return 'DOMAIN_TOO_LONG';
|
||||
}
|
||||
|
||||
// Check each part's length and allowed chars.
|
||||
const labels = ascii.split('.');
|
||||
let label;
|
||||
|
||||
for (let i = 0; i < labels.length; ++i) {
|
||||
label = labels[i];
|
||||
if (!label.length) {
|
||||
return 'LABEL_TOO_SHORT';
|
||||
}
|
||||
if (label.length > 63) {
|
||||
return 'LABEL_TOO_LONG';
|
||||
}
|
||||
if (label.charAt(0) === '-') {
|
||||
return 'LABEL_STARTS_WITH_DASH';
|
||||
}
|
||||
if (label.charAt(label.length - 1) === '-') {
|
||||
return 'LABEL_ENDS_WITH_DASH';
|
||||
}
|
||||
if (!/^[a-z0-9\-_]+$/.test(label)) {
|
||||
return 'LABEL_INVALID_CHARS';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Public API
|
||||
//
|
||||
|
||||
//
|
||||
// Parse domain.
|
||||
//
|
||||
export const parse = (input) => {
|
||||
if (typeof input !== 'string') {
|
||||
throw new TypeError('Domain name must be a string.');
|
||||
}
|
||||
|
||||
// Force domain to lowercase.
|
||||
let domain = input.slice(0).toLowerCase();
|
||||
|
||||
// Handle FQDN.
|
||||
// TODO: Simply remove trailing dot?
|
||||
if (domain.charAt(domain.length - 1) === '.') {
|
||||
domain = domain.slice(0, domain.length - 1);
|
||||
}
|
||||
|
||||
// Validate and sanitise input.
|
||||
const error = validate(domain);
|
||||
if (error) {
|
||||
return {
|
||||
input: input,
|
||||
error: {
|
||||
message: errorCodes[error],
|
||||
code: error
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const parsed = {
|
||||
input: input,
|
||||
tld: null,
|
||||
sld: null,
|
||||
domain: null,
|
||||
subdomain: null,
|
||||
listed: false
|
||||
};
|
||||
|
||||
const domainParts = domain.split('.');
|
||||
|
||||
// Non-Internet TLD
|
||||
if (domainParts[domainParts.length - 1] === 'local') {
|
||||
return parsed;
|
||||
}
|
||||
|
||||
const handlePunycode = () => {
|
||||
if (!/xn--/.test(domain)) {
|
||||
return parsed;
|
||||
}
|
||||
if (parsed.domain) {
|
||||
parsed.domain = punycode.toASCII(parsed.domain);
|
||||
}
|
||||
if (parsed.subdomain) {
|
||||
parsed.subdomain = punycode.toASCII(parsed.subdomain);
|
||||
}
|
||||
return parsed;
|
||||
};
|
||||
|
||||
const rule = findRule(domain);
|
||||
|
||||
// Unlisted tld.
|
||||
if (!rule) {
|
||||
if (domainParts.length < 2) {
|
||||
return parsed;
|
||||
}
|
||||
parsed.tld = domainParts.pop();
|
||||
parsed.sld = domainParts.pop();
|
||||
parsed.domain = [parsed.sld, parsed.tld].join('.');
|
||||
if (domainParts.length) {
|
||||
parsed.subdomain = domainParts.pop();
|
||||
}
|
||||
|
||||
return handlePunycode();
|
||||
}
|
||||
|
||||
// At this point we know the public suffix is listed.
|
||||
parsed.listed = true;
|
||||
|
||||
const tldParts = rule.suffix.split('.');
|
||||
const privateParts = domainParts.slice(0, domainParts.length - tldParts.length);
|
||||
|
||||
if (rule.exception) {
|
||||
privateParts.push(tldParts.shift());
|
||||
}
|
||||
|
||||
parsed.tld = tldParts.join('.');
|
||||
|
||||
if (!privateParts.length) {
|
||||
return handlePunycode();
|
||||
}
|
||||
|
||||
if (rule.wildcard) {
|
||||
tldParts.unshift(privateParts.pop());
|
||||
parsed.tld = tldParts.join('.');
|
||||
}
|
||||
|
||||
if (!privateParts.length) {
|
||||
return handlePunycode();
|
||||
}
|
||||
|
||||
parsed.sld = privateParts.pop();
|
||||
parsed.domain = [parsed.sld, parsed.tld].join('.');
|
||||
|
||||
if (privateParts.length) {
|
||||
parsed.subdomain = privateParts.join('.');
|
||||
}
|
||||
|
||||
return handlePunycode();
|
||||
};
|
||||
|
||||
//
|
||||
// Get domain.
|
||||
//
|
||||
export const get = (domain) => {
|
||||
if (!domain) {
|
||||
return null;
|
||||
}
|
||||
return parse(domain).domain || null;
|
||||
};
|
||||
|
||||
//
|
||||
// Check whether domain belongs to a known public suffix.
|
||||
//
|
||||
export const isValid = (domain) => {
|
||||
const parsed = parse(domain);
|
||||
return Boolean(parsed.domain && parsed.listed);
|
||||
};
|
||||
|
||||
export default { parse, get, isValid };
|
51
node_modules/psl/package.json
generated
vendored
Normal file
51
node_modules/psl/package.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "psl",
|
||||
"version": "1.15.0",
|
||||
"description": "Domain name parser based on the Public Suffix List",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:lupomontero/psl.git"
|
||||
},
|
||||
"type": "module",
|
||||
"main": "./dist/psl.cjs",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/psl.mjs",
|
||||
"require": "./dist/psl.cjs"
|
||||
}
|
||||
},
|
||||
"types": "types/index.d.ts",
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "mocha test/*.spec.js",
|
||||
"test:browserstack": "browserstack-node-sdk playwright test",
|
||||
"watch": "mocha test/*.spec.js --watch",
|
||||
"update-rules": "./scripts/update-rules.js",
|
||||
"build": "vite build",
|
||||
"postbuild": "ln -s ./psl.umd.cjs dist/psl.js && ln -s ./psl.umd.cjs dist/psl.min.js",
|
||||
"benchmark": "node --experimental-vm-modules --no-warnings benchmark/suite.js",
|
||||
"changelog": "git log $(git describe --tags --abbrev=0)..HEAD --oneline --format=\"%h %s (%an <%ae>)\""
|
||||
},
|
||||
"keywords": [
|
||||
"publicsuffix",
|
||||
"publicsuffixlist"
|
||||
],
|
||||
"author": "Lupo Montero <lupomontero@gmail.com> (https://lupomontero.com/)",
|
||||
"funding": "https://github.com/sponsors/lupomontero",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"punycode": "^2.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.16.0",
|
||||
"@playwright/test": "^1.49.0",
|
||||
"@types/eslint__js": "^8.42.3",
|
||||
"benchmark": "^2.1.4",
|
||||
"browserstack-node-sdk": "^1.34.27",
|
||||
"eslint": "^9.16.0",
|
||||
"mocha": "^10.8.2",
|
||||
"typescript": "^5.7.2",
|
||||
"typescript-eslint": "^8.16.0",
|
||||
"vite": "^6.0.2"
|
||||
}
|
||||
}
|
52
node_modules/psl/types/index.d.ts
generated
vendored
Normal file
52
node_modules/psl/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/**
|
||||
* Result returned when a given domain name was not parsable (not exported)
|
||||
*/
|
||||
export type ErrorResult<T extends keyof errorCodes> = {
|
||||
input: string;
|
||||
error: {
|
||||
code: T;
|
||||
message: errorCodes[T];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Error codes and descriptions for domain name parsing errors
|
||||
*/
|
||||
export const enum errorCodes {
|
||||
DOMAIN_TOO_SHORT = 'Domain name too short',
|
||||
DOMAIN_TOO_LONG = 'Domain name too long. It should be no more than 255 chars.',
|
||||
LABEL_STARTS_WITH_DASH = 'Domain name label can not start with a dash.',
|
||||
LABEL_ENDS_WITH_DASH = 'Domain name label can not end with a dash.',
|
||||
LABEL_TOO_LONG = 'Domain name label should be at most 63 chars long.',
|
||||
LABEL_TOO_SHORT = 'Domain name label should be at least 1 character long.',
|
||||
LABEL_INVALID_CHARS = 'Domain name label can only contain alphanumeric characters or dashes.'
|
||||
}
|
||||
|
||||
// Export the browser global variable name additionally to the CJS/AMD exports below
|
||||
export as namespace psl;
|
||||
|
||||
export type ParsedDomain = {
|
||||
input: string;
|
||||
tld: string | null;
|
||||
sld: string | null;
|
||||
domain: string | null;
|
||||
subdomain: string | null;
|
||||
listed: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a domain name and return its components
|
||||
*/
|
||||
export function parse(input: string): ParsedDomain | ErrorResult<keyof errorCodes>;
|
||||
|
||||
/**
|
||||
* Get the base domain for full domain name
|
||||
*/
|
||||
export function get(domain: string): string | null;
|
||||
|
||||
/**
|
||||
* Check whether the given domain belongs to a known public suffix
|
||||
*/
|
||||
export function isValid(domain: string): boolean;
|
14
node_modules/psl/types/test.ts
generated
vendored
Normal file
14
node_modules/psl/types/test.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as psl from 'psl';
|
||||
import type { ParsedDomain, ErrorResult, errorCodes } from './index.d.ts';
|
||||
|
||||
const x = (a: ParsedDomain | ErrorResult<keyof errorCodes>) => {
|
||||
return a;
|
||||
};
|
||||
|
||||
console.log(x(psl.parse('')));
|
||||
|
||||
// $ExpectType string | null
|
||||
console.log(psl.get('example.com'));
|
||||
|
||||
// $ExpectType boolean
|
||||
console.log(psl.isValid('example.com'));
|
22
node_modules/psl/types/tsconfig.json
generated
vendored
Normal file
22
node_modules/psl/types/tsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es5"
|
||||
],
|
||||
"strict": true,
|
||||
"noEmit": false,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
// Expose module under its CJS/AMD name
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"psl": [
|
||||
"./index.d.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
20
node_modules/psl/vite.config.js
generated
vendored
Normal file
20
node_modules/psl/vite.config.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { resolve } from 'node:path';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
target: 'es2015',
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'index.js'),
|
||||
name: 'psl',
|
||||
formats: ['es', 'cjs', 'umd'],
|
||||
fileName: format => (
|
||||
format === 'umd'
|
||||
? 'psl.umd.cjs'
|
||||
: format === 'cjs'
|
||||
? 'psl.cjs'
|
||||
: 'psl.mjs'
|
||||
),
|
||||
},
|
||||
},
|
||||
});
|
Reference in New Issue
Block a user