Fix code quality violations for publish
Progressive breadcrumb resolution with caching, fix double headers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
9
node_modules/psl/LICENSE
generated
vendored
Executable file
9
node_modules/psl/LICENSE
generated
vendored
Executable 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
Executable file
260
node_modules/psl/README.md
generated
vendored
Executable 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
Executable file
13
node_modules/psl/SECURITY.md
generated
vendored
Executable 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
Executable file
90
node_modules/psl/browserstack-logo.svg
generated
vendored
Executable 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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,0,0,0-0.1,0h-6
|
||||
c-0.3,0-0.6-0.2-0.7-0.5c0,0,0,0,0-0.1V32.6c0-0.3,0.3-0.6,0.6-0.6c0,0,0,0,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
Executable file
1
node_modules/psl/dist/psl.cjs
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
10008
node_modules/psl/dist/psl.mjs
generated
vendored
Executable file
10008
node_modules/psl/dist/psl.mjs
generated
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1
node_modules/psl/dist/psl.umd.cjs
generated
vendored
Executable file
1
node_modules/psl/dist/psl.umd.cjs
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
247
node_modules/psl/index.js
generated
vendored
Executable file
247
node_modules/psl/index.js
generated
vendored
Executable 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 };
|
||||
20
node_modules/psl/node_modules/punycode/LICENSE-MIT.txt
generated
vendored
Executable file
20
node_modules/psl/node_modules/punycode/LICENSE-MIT.txt
generated
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
Copyright Mathias Bynens <https://mathiasbynens.be/>
|
||||
|
||||
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.
|
||||
148
node_modules/psl/node_modules/punycode/README.md
generated
vendored
Executable file
148
node_modules/psl/node_modules/punycode/README.md
generated
vendored
Executable file
@@ -0,0 +1,148 @@
|
||||
# Punycode.js [](https://www.npmjs.com/package/punycode) [](https://www.jsdelivr.com/package/npm/punycode)
|
||||
|
||||
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
||||
|
||||
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
||||
|
||||
* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C)
|
||||
* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c)
|
||||
* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c)
|
||||
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
||||
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
||||
|
||||
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
||||
|
||||
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install punycode --save
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
> ⚠️ Note that userland modules don't hide core modules.
|
||||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.
|
||||
> Use `require('punycode/')` to import userland modules rather than core modules.
|
||||
|
||||
```js
|
||||
const punycode = require('punycode/');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `punycode.decode(string)`
|
||||
|
||||
Converts a Punycode string of ASCII symbols to a string of Unicode symbols.
|
||||
|
||||
```js
|
||||
// decode domain name parts
|
||||
punycode.decode('maana-pta'); // 'mañana'
|
||||
punycode.decode('--dqo34k'); // '☃-⌘'
|
||||
```
|
||||
|
||||
### `punycode.encode(string)`
|
||||
|
||||
Converts a string of Unicode symbols to a Punycode string of ASCII symbols.
|
||||
|
||||
```js
|
||||
// encode domain name parts
|
||||
punycode.encode('mañana'); // 'maana-pta'
|
||||
punycode.encode('☃-⌘'); // '--dqo34k'
|
||||
```
|
||||
|
||||
### `punycode.toUnicode(input)`
|
||||
|
||||
Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.
|
||||
|
||||
```js
|
||||
// decode domain names
|
||||
punycode.toUnicode('xn--maana-pta.com');
|
||||
// → 'mañana.com'
|
||||
punycode.toUnicode('xn----dqo34k.com');
|
||||
// → '☃-⌘.com'
|
||||
|
||||
// decode email addresses
|
||||
punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');
|
||||
// → 'джумла@джpумлатест.bрфa'
|
||||
```
|
||||
|
||||
### `punycode.toASCII(input)`
|
||||
|
||||
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII.
|
||||
|
||||
```js
|
||||
// encode domain names
|
||||
punycode.toASCII('mañana.com');
|
||||
// → 'xn--maana-pta.com'
|
||||
punycode.toASCII('☃-⌘.com');
|
||||
// → 'xn----dqo34k.com'
|
||||
|
||||
// encode email addresses
|
||||
punycode.toASCII('джумла@джpумлатест.bрфa');
|
||||
// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'
|
||||
```
|
||||
|
||||
### `punycode.ucs2`
|
||||
|
||||
#### `punycode.ucs2.decode(string)`
|
||||
|
||||
Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.
|
||||
|
||||
```js
|
||||
punycode.ucs2.decode('abc');
|
||||
// → [0x61, 0x62, 0x63]
|
||||
// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:
|
||||
punycode.ucs2.decode('\uD834\uDF06');
|
||||
// → [0x1D306]
|
||||
```
|
||||
|
||||
#### `punycode.ucs2.encode(codePoints)`
|
||||
|
||||
Creates a string based on an array of numeric code point values.
|
||||
|
||||
```js
|
||||
punycode.ucs2.encode([0x61, 0x62, 0x63]);
|
||||
// → 'abc'
|
||||
punycode.ucs2.encode([0x1D306]);
|
||||
// → '\uD834\uDF06'
|
||||
```
|
||||
|
||||
### `punycode.version`
|
||||
|
||||
A string representing the current Punycode.js version number.
|
||||
|
||||
## For maintainers
|
||||
|
||||
### How to publish a new release
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.
|
||||
|
||||
## Author
|
||||
|
||||
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|
||||
58
node_modules/psl/node_modules/punycode/package.json
generated
vendored
Executable file
58
node_modules/psl/node_modules/punycode/package.json
generated
vendored
Executable file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "punycode",
|
||||
"version": "2.3.1",
|
||||
"description": "A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.",
|
||||
"homepage": "https://mths.be/punycode",
|
||||
"main": "punycode.js",
|
||||
"jsnext:main": "punycode.es6.js",
|
||||
"module": "punycode.es6.js",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"keywords": [
|
||||
"punycode",
|
||||
"unicode",
|
||||
"idn",
|
||||
"idna",
|
||||
"dns",
|
||||
"url",
|
||||
"domain"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mathiasbynens/punycode.js.git"
|
||||
},
|
||||
"bugs": "https://github.com/mathiasbynens/punycode.js/issues",
|
||||
"files": [
|
||||
"LICENSE-MIT.txt",
|
||||
"punycode.js",
|
||||
"punycode.es6.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "mocha tests",
|
||||
"build": "node scripts/prepublish.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"codecov": "^3.8.3",
|
||||
"nyc": "^15.1.0",
|
||||
"mocha": "^10.2.0"
|
||||
},
|
||||
"jspm": {
|
||||
"map": {
|
||||
"./punycode.js": {
|
||||
"node": "@node/punycode"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
444
node_modules/psl/node_modules/punycode/punycode.es6.js
generated
vendored
Executable file
444
node_modules/psl/node_modules/punycode/punycode.es6.js
generated
vendored
Executable file
@@ -0,0 +1,444 @@
|
||||
'use strict';
|
||||
|
||||
/** Highest positive signed 32-bit float value */
|
||||
const maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
|
||||
|
||||
/** Bootstring parameters */
|
||||
const base = 36;
|
||||
const tMin = 1;
|
||||
const tMax = 26;
|
||||
const skew = 38;
|
||||
const damp = 700;
|
||||
const initialBias = 72;
|
||||
const initialN = 128; // 0x80
|
||||
const delimiter = '-'; // '\x2D'
|
||||
|
||||
/** Regular expressions */
|
||||
const regexPunycode = /^xn--/;
|
||||
const regexNonASCII = /[^\0-\x7F]/; // Note: U+007F DEL is excluded too.
|
||||
const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
|
||||
|
||||
/** Error messages */
|
||||
const errors = {
|
||||
'overflow': 'Overflow: input needs wider integers to process',
|
||||
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
||||
'invalid-input': 'Invalid input'
|
||||
};
|
||||
|
||||
/** Convenience shortcuts */
|
||||
const baseMinusTMin = base - tMin;
|
||||
const floor = Math.floor;
|
||||
const stringFromCharCode = String.fromCharCode;
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* A generic error utility function.
|
||||
* @private
|
||||
* @param {String} type The error type.
|
||||
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
||||
*/
|
||||
function error(type) {
|
||||
throw new RangeError(errors[type]);
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic `Array#map` utility function.
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Function} callback The function that gets called for every array
|
||||
* item.
|
||||
* @returns {Array} A new array of values returned by the callback function.
|
||||
*/
|
||||
function map(array, callback) {
|
||||
const result = [];
|
||||
let length = array.length;
|
||||
while (length--) {
|
||||
result[length] = callback(array[length]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
||||
* addresses.
|
||||
* @private
|
||||
* @param {String} domain The domain name or email address.
|
||||
* @param {Function} callback The function that gets called for every
|
||||
* character.
|
||||
* @returns {String} A new string of characters returned by the callback
|
||||
* function.
|
||||
*/
|
||||
function mapDomain(domain, callback) {
|
||||
const parts = domain.split('@');
|
||||
let result = '';
|
||||
if (parts.length > 1) {
|
||||
// In email addresses, only the domain name should be punycoded. Leave
|
||||
// the local part (i.e. everything up to `@`) intact.
|
||||
result = parts[0] + '@';
|
||||
domain = parts[1];
|
||||
}
|
||||
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
||||
domain = domain.replace(regexSeparators, '\x2E');
|
||||
const labels = domain.split('.');
|
||||
const encoded = map(labels, callback).join('.');
|
||||
return result + encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array containing the numeric code points of each Unicode
|
||||
* character in the string. While JavaScript uses UCS-2 internally,
|
||||
* this function will convert a pair of surrogate halves (each of which
|
||||
* UCS-2 exposes as separate characters) into a single code point,
|
||||
* matching UTF-16.
|
||||
* @see `punycode.ucs2.encode`
|
||||
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||||
* @memberOf punycode.ucs2
|
||||
* @name decode
|
||||
* @param {String} string The Unicode input string (UCS-2).
|
||||
* @returns {Array} The new array of code points.
|
||||
*/
|
||||
function ucs2decode(string) {
|
||||
const output = [];
|
||||
let counter = 0;
|
||||
const length = string.length;
|
||||
while (counter < length) {
|
||||
const value = string.charCodeAt(counter++);
|
||||
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
||||
// It's a high surrogate, and there is a next character.
|
||||
const extra = string.charCodeAt(counter++);
|
||||
if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.
|
||||
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
||||
} else {
|
||||
// It's an unmatched surrogate; only append this code unit, in case the
|
||||
// next code unit is the high surrogate of a surrogate pair.
|
||||
output.push(value);
|
||||
counter--;
|
||||
}
|
||||
} else {
|
||||
output.push(value);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string based on an array of numeric code points.
|
||||
* @see `punycode.ucs2.decode`
|
||||
* @memberOf punycode.ucs2
|
||||
* @name encode
|
||||
* @param {Array} codePoints The array of numeric code points.
|
||||
* @returns {String} The new Unicode string (UCS-2).
|
||||
*/
|
||||
const ucs2encode = codePoints => String.fromCodePoint(...codePoints);
|
||||
|
||||
/**
|
||||
* Converts a basic code point into a digit/integer.
|
||||
* @see `digitToBasic()`
|
||||
* @private
|
||||
* @param {Number} codePoint The basic numeric code point value.
|
||||
* @returns {Number} The numeric value of a basic code point (for use in
|
||||
* representing integers) in the range `0` to `base - 1`, or `base` if
|
||||
* the code point does not represent a value.
|
||||
*/
|
||||
const basicToDigit = function(codePoint) {
|
||||
if (codePoint >= 0x30 && codePoint < 0x3A) {
|
||||
return 26 + (codePoint - 0x30);
|
||||
}
|
||||
if (codePoint >= 0x41 && codePoint < 0x5B) {
|
||||
return codePoint - 0x41;
|
||||
}
|
||||
if (codePoint >= 0x61 && codePoint < 0x7B) {
|
||||
return codePoint - 0x61;
|
||||
}
|
||||
return base;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a digit/integer into a basic code point.
|
||||
* @see `basicToDigit()`
|
||||
* @private
|
||||
* @param {Number} digit The numeric value of a basic code point.
|
||||
* @returns {Number} The basic code point whose value (when used for
|
||||
* representing integers) is `digit`, which needs to be in the range
|
||||
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
||||
* used; else, the lowercase form is used. The behavior is undefined
|
||||
* if `flag` is non-zero and `digit` has no uppercase form.
|
||||
*/
|
||||
const digitToBasic = function(digit, flag) {
|
||||
// 0..25 map to ASCII a..z or A..Z
|
||||
// 26..35 map to ASCII 0..9
|
||||
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
||||
};
|
||||
|
||||
/**
|
||||
* Bias adaptation function as per section 3.4 of RFC 3492.
|
||||
* https://tools.ietf.org/html/rfc3492#section-3.4
|
||||
* @private
|
||||
*/
|
||||
const adapt = function(delta, numPoints, firstTime) {
|
||||
let k = 0;
|
||||
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
||||
delta += floor(delta / numPoints);
|
||||
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
|
||||
delta = floor(delta / baseMinusTMin);
|
||||
}
|
||||
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
||||
* symbols.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The Punycode string of ASCII-only symbols.
|
||||
* @returns {String} The resulting string of Unicode symbols.
|
||||
*/
|
||||
const decode = function(input) {
|
||||
// Don't use UCS-2.
|
||||
const output = [];
|
||||
const inputLength = input.length;
|
||||
let i = 0;
|
||||
let n = initialN;
|
||||
let bias = initialBias;
|
||||
|
||||
// Handle the basic code points: let `basic` be the number of input code
|
||||
// points before the last delimiter, or `0` if there is none, then copy
|
||||
// the first basic code points to the output.
|
||||
|
||||
let basic = input.lastIndexOf(delimiter);
|
||||
if (basic < 0) {
|
||||
basic = 0;
|
||||
}
|
||||
|
||||
for (let j = 0; j < basic; ++j) {
|
||||
// if it's not a basic code point
|
||||
if (input.charCodeAt(j) >= 0x80) {
|
||||
error('not-basic');
|
||||
}
|
||||
output.push(input.charCodeAt(j));
|
||||
}
|
||||
|
||||
// Main decoding loop: start just after the last delimiter if any basic code
|
||||
// points were copied; start at the beginning otherwise.
|
||||
|
||||
for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
|
||||
|
||||
// `index` is the index of the next character to be consumed.
|
||||
// Decode a generalized variable-length integer into `delta`,
|
||||
// which gets added to `i`. The overflow checking is easier
|
||||
// if we increase `i` as we go, then subtract off its starting
|
||||
// value at the end to obtain `delta`.
|
||||
const oldi = i;
|
||||
for (let w = 1, k = base; /* no condition */; k += base) {
|
||||
|
||||
if (index >= inputLength) {
|
||||
error('invalid-input');
|
||||
}
|
||||
|
||||
const digit = basicToDigit(input.charCodeAt(index++));
|
||||
|
||||
if (digit >= base) {
|
||||
error('invalid-input');
|
||||
}
|
||||
if (digit > floor((maxInt - i) / w)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
i += digit * w;
|
||||
const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||||
|
||||
if (digit < t) {
|
||||
break;
|
||||
}
|
||||
|
||||
const baseMinusT = base - t;
|
||||
if (w > floor(maxInt / baseMinusT)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
w *= baseMinusT;
|
||||
|
||||
}
|
||||
|
||||
const out = output.length + 1;
|
||||
bias = adapt(i - oldi, out, oldi == 0);
|
||||
|
||||
// `i` was supposed to wrap around from `out` to `0`,
|
||||
// incrementing `n` each time, so we'll fix that now:
|
||||
if (floor(i / out) > maxInt - n) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
n += floor(i / out);
|
||||
i %= out;
|
||||
|
||||
// Insert `n` at position `i` of the output.
|
||||
output.splice(i++, 0, n);
|
||||
|
||||
}
|
||||
|
||||
return String.fromCodePoint(...output);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
||||
* Punycode string of ASCII-only symbols.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The string of Unicode symbols.
|
||||
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
||||
*/
|
||||
const encode = function(input) {
|
||||
const output = [];
|
||||
|
||||
// Convert the input in UCS-2 to an array of Unicode code points.
|
||||
input = ucs2decode(input);
|
||||
|
||||
// Cache the length.
|
||||
const inputLength = input.length;
|
||||
|
||||
// Initialize the state.
|
||||
let n = initialN;
|
||||
let delta = 0;
|
||||
let bias = initialBias;
|
||||
|
||||
// Handle the basic code points.
|
||||
for (const currentValue of input) {
|
||||
if (currentValue < 0x80) {
|
||||
output.push(stringFromCharCode(currentValue));
|
||||
}
|
||||
}
|
||||
|
||||
const basicLength = output.length;
|
||||
let handledCPCount = basicLength;
|
||||
|
||||
// `handledCPCount` is the number of code points that have been handled;
|
||||
// `basicLength` is the number of basic code points.
|
||||
|
||||
// Finish the basic string with a delimiter unless it's empty.
|
||||
if (basicLength) {
|
||||
output.push(delimiter);
|
||||
}
|
||||
|
||||
// Main encoding loop:
|
||||
while (handledCPCount < inputLength) {
|
||||
|
||||
// All non-basic code points < n have been handled already. Find the next
|
||||
// larger one:
|
||||
let m = maxInt;
|
||||
for (const currentValue of input) {
|
||||
if (currentValue >= n && currentValue < m) {
|
||||
m = currentValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
||||
// but guard against overflow.
|
||||
const handledCPCountPlusOne = handledCPCount + 1;
|
||||
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
delta += (m - n) * handledCPCountPlusOne;
|
||||
n = m;
|
||||
|
||||
for (const currentValue of input) {
|
||||
if (currentValue < n && ++delta > maxInt) {
|
||||
error('overflow');
|
||||
}
|
||||
if (currentValue === n) {
|
||||
// Represent delta as a generalized variable-length integer.
|
||||
let q = delta;
|
||||
for (let k = base; /* no condition */; k += base) {
|
||||
const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||||
if (q < t) {
|
||||
break;
|
||||
}
|
||||
const qMinusT = q - t;
|
||||
const baseMinusT = base - t;
|
||||
output.push(
|
||||
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
||||
);
|
||||
q = floor(qMinusT / baseMinusT);
|
||||
}
|
||||
|
||||
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
||||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
|
||||
delta = 0;
|
||||
++handledCPCount;
|
||||
}
|
||||
}
|
||||
|
||||
++delta;
|
||||
++n;
|
||||
|
||||
}
|
||||
return output.join('');
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Punycode string representing a domain name or an email address
|
||||
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
||||
* it doesn't matter if you call it on a string that has already been
|
||||
* converted to Unicode.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The Punycoded domain name or email address to
|
||||
* convert to Unicode.
|
||||
* @returns {String} The Unicode representation of the given Punycode
|
||||
* string.
|
||||
*/
|
||||
const toUnicode = function(input) {
|
||||
return mapDomain(input, function(string) {
|
||||
return regexPunycode.test(string)
|
||||
? decode(string.slice(4).toLowerCase())
|
||||
: string;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Unicode string representing a domain name or an email address to
|
||||
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
||||
* i.e. it doesn't matter if you call it with a domain that's already in
|
||||
* ASCII.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The domain name or email address to convert, as a
|
||||
* Unicode string.
|
||||
* @returns {String} The Punycode representation of the given domain name or
|
||||
* email address.
|
||||
*/
|
||||
const toASCII = function(input) {
|
||||
return mapDomain(input, function(string) {
|
||||
return regexNonASCII.test(string)
|
||||
? 'xn--' + encode(string)
|
||||
: string;
|
||||
});
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/** Define the public API */
|
||||
const punycode = {
|
||||
/**
|
||||
* A string representing the current Punycode.js version number.
|
||||
* @memberOf punycode
|
||||
* @type String
|
||||
*/
|
||||
'version': '2.3.1',
|
||||
/**
|
||||
* An object of methods to convert from JavaScript's internal character
|
||||
* representation (UCS-2) to Unicode code points, and back.
|
||||
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||||
* @memberOf punycode
|
||||
* @type Object
|
||||
*/
|
||||
'ucs2': {
|
||||
'decode': ucs2decode,
|
||||
'encode': ucs2encode
|
||||
},
|
||||
'decode': decode,
|
||||
'encode': encode,
|
||||
'toASCII': toASCII,
|
||||
'toUnicode': toUnicode
|
||||
};
|
||||
|
||||
export { ucs2decode, ucs2encode, decode, encode, toASCII, toUnicode };
|
||||
export default punycode;
|
||||
443
node_modules/psl/node_modules/punycode/punycode.js
generated
vendored
Executable file
443
node_modules/psl/node_modules/punycode/punycode.js
generated
vendored
Executable file
@@ -0,0 +1,443 @@
|
||||
'use strict';
|
||||
|
||||
/** Highest positive signed 32-bit float value */
|
||||
const maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
|
||||
|
||||
/** Bootstring parameters */
|
||||
const base = 36;
|
||||
const tMin = 1;
|
||||
const tMax = 26;
|
||||
const skew = 38;
|
||||
const damp = 700;
|
||||
const initialBias = 72;
|
||||
const initialN = 128; // 0x80
|
||||
const delimiter = '-'; // '\x2D'
|
||||
|
||||
/** Regular expressions */
|
||||
const regexPunycode = /^xn--/;
|
||||
const regexNonASCII = /[^\0-\x7F]/; // Note: U+007F DEL is excluded too.
|
||||
const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
|
||||
|
||||
/** Error messages */
|
||||
const errors = {
|
||||
'overflow': 'Overflow: input needs wider integers to process',
|
||||
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
||||
'invalid-input': 'Invalid input'
|
||||
};
|
||||
|
||||
/** Convenience shortcuts */
|
||||
const baseMinusTMin = base - tMin;
|
||||
const floor = Math.floor;
|
||||
const stringFromCharCode = String.fromCharCode;
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* A generic error utility function.
|
||||
* @private
|
||||
* @param {String} type The error type.
|
||||
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
||||
*/
|
||||
function error(type) {
|
||||
throw new RangeError(errors[type]);
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic `Array#map` utility function.
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Function} callback The function that gets called for every array
|
||||
* item.
|
||||
* @returns {Array} A new array of values returned by the callback function.
|
||||
*/
|
||||
function map(array, callback) {
|
||||
const result = [];
|
||||
let length = array.length;
|
||||
while (length--) {
|
||||
result[length] = callback(array[length]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
||||
* addresses.
|
||||
* @private
|
||||
* @param {String} domain The domain name or email address.
|
||||
* @param {Function} callback The function that gets called for every
|
||||
* character.
|
||||
* @returns {String} A new string of characters returned by the callback
|
||||
* function.
|
||||
*/
|
||||
function mapDomain(domain, callback) {
|
||||
const parts = domain.split('@');
|
||||
let result = '';
|
||||
if (parts.length > 1) {
|
||||
// In email addresses, only the domain name should be punycoded. Leave
|
||||
// the local part (i.e. everything up to `@`) intact.
|
||||
result = parts[0] + '@';
|
||||
domain = parts[1];
|
||||
}
|
||||
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
||||
domain = domain.replace(regexSeparators, '\x2E');
|
||||
const labels = domain.split('.');
|
||||
const encoded = map(labels, callback).join('.');
|
||||
return result + encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array containing the numeric code points of each Unicode
|
||||
* character in the string. While JavaScript uses UCS-2 internally,
|
||||
* this function will convert a pair of surrogate halves (each of which
|
||||
* UCS-2 exposes as separate characters) into a single code point,
|
||||
* matching UTF-16.
|
||||
* @see `punycode.ucs2.encode`
|
||||
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||||
* @memberOf punycode.ucs2
|
||||
* @name decode
|
||||
* @param {String} string The Unicode input string (UCS-2).
|
||||
* @returns {Array} The new array of code points.
|
||||
*/
|
||||
function ucs2decode(string) {
|
||||
const output = [];
|
||||
let counter = 0;
|
||||
const length = string.length;
|
||||
while (counter < length) {
|
||||
const value = string.charCodeAt(counter++);
|
||||
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
||||
// It's a high surrogate, and there is a next character.
|
||||
const extra = string.charCodeAt(counter++);
|
||||
if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.
|
||||
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
||||
} else {
|
||||
// It's an unmatched surrogate; only append this code unit, in case the
|
||||
// next code unit is the high surrogate of a surrogate pair.
|
||||
output.push(value);
|
||||
counter--;
|
||||
}
|
||||
} else {
|
||||
output.push(value);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string based on an array of numeric code points.
|
||||
* @see `punycode.ucs2.decode`
|
||||
* @memberOf punycode.ucs2
|
||||
* @name encode
|
||||
* @param {Array} codePoints The array of numeric code points.
|
||||
* @returns {String} The new Unicode string (UCS-2).
|
||||
*/
|
||||
const ucs2encode = codePoints => String.fromCodePoint(...codePoints);
|
||||
|
||||
/**
|
||||
* Converts a basic code point into a digit/integer.
|
||||
* @see `digitToBasic()`
|
||||
* @private
|
||||
* @param {Number} codePoint The basic numeric code point value.
|
||||
* @returns {Number} The numeric value of a basic code point (for use in
|
||||
* representing integers) in the range `0` to `base - 1`, or `base` if
|
||||
* the code point does not represent a value.
|
||||
*/
|
||||
const basicToDigit = function(codePoint) {
|
||||
if (codePoint >= 0x30 && codePoint < 0x3A) {
|
||||
return 26 + (codePoint - 0x30);
|
||||
}
|
||||
if (codePoint >= 0x41 && codePoint < 0x5B) {
|
||||
return codePoint - 0x41;
|
||||
}
|
||||
if (codePoint >= 0x61 && codePoint < 0x7B) {
|
||||
return codePoint - 0x61;
|
||||
}
|
||||
return base;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a digit/integer into a basic code point.
|
||||
* @see `basicToDigit()`
|
||||
* @private
|
||||
* @param {Number} digit The numeric value of a basic code point.
|
||||
* @returns {Number} The basic code point whose value (when used for
|
||||
* representing integers) is `digit`, which needs to be in the range
|
||||
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
||||
* used; else, the lowercase form is used. The behavior is undefined
|
||||
* if `flag` is non-zero and `digit` has no uppercase form.
|
||||
*/
|
||||
const digitToBasic = function(digit, flag) {
|
||||
// 0..25 map to ASCII a..z or A..Z
|
||||
// 26..35 map to ASCII 0..9
|
||||
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
||||
};
|
||||
|
||||
/**
|
||||
* Bias adaptation function as per section 3.4 of RFC 3492.
|
||||
* https://tools.ietf.org/html/rfc3492#section-3.4
|
||||
* @private
|
||||
*/
|
||||
const adapt = function(delta, numPoints, firstTime) {
|
||||
let k = 0;
|
||||
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
||||
delta += floor(delta / numPoints);
|
||||
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
|
||||
delta = floor(delta / baseMinusTMin);
|
||||
}
|
||||
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
||||
* symbols.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The Punycode string of ASCII-only symbols.
|
||||
* @returns {String} The resulting string of Unicode symbols.
|
||||
*/
|
||||
const decode = function(input) {
|
||||
// Don't use UCS-2.
|
||||
const output = [];
|
||||
const inputLength = input.length;
|
||||
let i = 0;
|
||||
let n = initialN;
|
||||
let bias = initialBias;
|
||||
|
||||
// Handle the basic code points: let `basic` be the number of input code
|
||||
// points before the last delimiter, or `0` if there is none, then copy
|
||||
// the first basic code points to the output.
|
||||
|
||||
let basic = input.lastIndexOf(delimiter);
|
||||
if (basic < 0) {
|
||||
basic = 0;
|
||||
}
|
||||
|
||||
for (let j = 0; j < basic; ++j) {
|
||||
// if it's not a basic code point
|
||||
if (input.charCodeAt(j) >= 0x80) {
|
||||
error('not-basic');
|
||||
}
|
||||
output.push(input.charCodeAt(j));
|
||||
}
|
||||
|
||||
// Main decoding loop: start just after the last delimiter if any basic code
|
||||
// points were copied; start at the beginning otherwise.
|
||||
|
||||
for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
|
||||
|
||||
// `index` is the index of the next character to be consumed.
|
||||
// Decode a generalized variable-length integer into `delta`,
|
||||
// which gets added to `i`. The overflow checking is easier
|
||||
// if we increase `i` as we go, then subtract off its starting
|
||||
// value at the end to obtain `delta`.
|
||||
const oldi = i;
|
||||
for (let w = 1, k = base; /* no condition */; k += base) {
|
||||
|
||||
if (index >= inputLength) {
|
||||
error('invalid-input');
|
||||
}
|
||||
|
||||
const digit = basicToDigit(input.charCodeAt(index++));
|
||||
|
||||
if (digit >= base) {
|
||||
error('invalid-input');
|
||||
}
|
||||
if (digit > floor((maxInt - i) / w)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
i += digit * w;
|
||||
const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||||
|
||||
if (digit < t) {
|
||||
break;
|
||||
}
|
||||
|
||||
const baseMinusT = base - t;
|
||||
if (w > floor(maxInt / baseMinusT)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
w *= baseMinusT;
|
||||
|
||||
}
|
||||
|
||||
const out = output.length + 1;
|
||||
bias = adapt(i - oldi, out, oldi == 0);
|
||||
|
||||
// `i` was supposed to wrap around from `out` to `0`,
|
||||
// incrementing `n` each time, so we'll fix that now:
|
||||
if (floor(i / out) > maxInt - n) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
n += floor(i / out);
|
||||
i %= out;
|
||||
|
||||
// Insert `n` at position `i` of the output.
|
||||
output.splice(i++, 0, n);
|
||||
|
||||
}
|
||||
|
||||
return String.fromCodePoint(...output);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
||||
* Punycode string of ASCII-only symbols.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The string of Unicode symbols.
|
||||
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
||||
*/
|
||||
const encode = function(input) {
|
||||
const output = [];
|
||||
|
||||
// Convert the input in UCS-2 to an array of Unicode code points.
|
||||
input = ucs2decode(input);
|
||||
|
||||
// Cache the length.
|
||||
const inputLength = input.length;
|
||||
|
||||
// Initialize the state.
|
||||
let n = initialN;
|
||||
let delta = 0;
|
||||
let bias = initialBias;
|
||||
|
||||
// Handle the basic code points.
|
||||
for (const currentValue of input) {
|
||||
if (currentValue < 0x80) {
|
||||
output.push(stringFromCharCode(currentValue));
|
||||
}
|
||||
}
|
||||
|
||||
const basicLength = output.length;
|
||||
let handledCPCount = basicLength;
|
||||
|
||||
// `handledCPCount` is the number of code points that have been handled;
|
||||
// `basicLength` is the number of basic code points.
|
||||
|
||||
// Finish the basic string with a delimiter unless it's empty.
|
||||
if (basicLength) {
|
||||
output.push(delimiter);
|
||||
}
|
||||
|
||||
// Main encoding loop:
|
||||
while (handledCPCount < inputLength) {
|
||||
|
||||
// All non-basic code points < n have been handled already. Find the next
|
||||
// larger one:
|
||||
let m = maxInt;
|
||||
for (const currentValue of input) {
|
||||
if (currentValue >= n && currentValue < m) {
|
||||
m = currentValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
||||
// but guard against overflow.
|
||||
const handledCPCountPlusOne = handledCPCount + 1;
|
||||
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
delta += (m - n) * handledCPCountPlusOne;
|
||||
n = m;
|
||||
|
||||
for (const currentValue of input) {
|
||||
if (currentValue < n && ++delta > maxInt) {
|
||||
error('overflow');
|
||||
}
|
||||
if (currentValue === n) {
|
||||
// Represent delta as a generalized variable-length integer.
|
||||
let q = delta;
|
||||
for (let k = base; /* no condition */; k += base) {
|
||||
const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||||
if (q < t) {
|
||||
break;
|
||||
}
|
||||
const qMinusT = q - t;
|
||||
const baseMinusT = base - t;
|
||||
output.push(
|
||||
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
||||
);
|
||||
q = floor(qMinusT / baseMinusT);
|
||||
}
|
||||
|
||||
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
||||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
|
||||
delta = 0;
|
||||
++handledCPCount;
|
||||
}
|
||||
}
|
||||
|
||||
++delta;
|
||||
++n;
|
||||
|
||||
}
|
||||
return output.join('');
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Punycode string representing a domain name or an email address
|
||||
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
||||
* it doesn't matter if you call it on a string that has already been
|
||||
* converted to Unicode.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The Punycoded domain name or email address to
|
||||
* convert to Unicode.
|
||||
* @returns {String} The Unicode representation of the given Punycode
|
||||
* string.
|
||||
*/
|
||||
const toUnicode = function(input) {
|
||||
return mapDomain(input, function(string) {
|
||||
return regexPunycode.test(string)
|
||||
? decode(string.slice(4).toLowerCase())
|
||||
: string;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Unicode string representing a domain name or an email address to
|
||||
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
||||
* i.e. it doesn't matter if you call it with a domain that's already in
|
||||
* ASCII.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The domain name or email address to convert, as a
|
||||
* Unicode string.
|
||||
* @returns {String} The Punycode representation of the given domain name or
|
||||
* email address.
|
||||
*/
|
||||
const toASCII = function(input) {
|
||||
return mapDomain(input, function(string) {
|
||||
return regexNonASCII.test(string)
|
||||
? 'xn--' + encode(string)
|
||||
: string;
|
||||
});
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/** Define the public API */
|
||||
const punycode = {
|
||||
/**
|
||||
* A string representing the current Punycode.js version number.
|
||||
* @memberOf punycode
|
||||
* @type String
|
||||
*/
|
||||
'version': '2.3.1',
|
||||
/**
|
||||
* An object of methods to convert from JavaScript's internal character
|
||||
* representation (UCS-2) to Unicode code points, and back.
|
||||
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||||
* @memberOf punycode
|
||||
* @type Object
|
||||
*/
|
||||
'ucs2': {
|
||||
'decode': ucs2decode,
|
||||
'encode': ucs2encode
|
||||
},
|
||||
'decode': decode,
|
||||
'encode': encode,
|
||||
'toASCII': toASCII,
|
||||
'toUnicode': toUnicode
|
||||
};
|
||||
|
||||
module.exports = punycode;
|
||||
51
node_modules/psl/package.json
generated
vendored
Executable file
51
node_modules/psl/package.json
generated
vendored
Executable 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
Executable file
20
node_modules/psl/vite.config.js
generated
vendored
Executable 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