update node modules
This commit is contained in:
9
node_modules/tr46/README.md
generated
vendored
9
node_modules/tr46/README.md
generated
vendored
@@ -1,13 +1,15 @@
|
||||
# tr46.js
|
||||
# tr46
|
||||
|
||||
> An implementation of the [Unicode TR46 specification](http://unicode.org/reports/tr46/).
|
||||
An JavaScript implementation of [Unicode Technical Standard #46: Unicode IDNA Compatibility Processing](https://unicode.org/reports/tr46/).
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
[Node.js](http://nodejs.org) `>= 6` is required. To install, type this at the command line:
|
||||
[Node.js](http://nodejs.org) ≥ 8 is required. To install, type this at the command line:
|
||||
```shell
|
||||
npm install tr46
|
||||
# or
|
||||
yarn add tr46
|
||||
```
|
||||
|
||||
|
||||
@@ -33,6 +35,7 @@ Available options:
|
||||
* [`checkBidi`](#checkBidi)
|
||||
* [`checkHyphens`](#checkHyphens)
|
||||
* [`checkJoiners`](#checkJoiners)
|
||||
* [`processingOption`](#processingOption)
|
||||
* [`useSTD3ASCIIRules`](#useSTD3ASCIIRules)
|
||||
|
||||
|
||||
|
38
node_modules/tr46/index.js
generated
vendored
38
node_modules/tr46/index.js
generated
vendored
@@ -3,6 +3,7 @@
|
||||
const punycode = require("punycode");
|
||||
const regexes = require("./lib/regexes.js");
|
||||
const mappingTable = require("./lib/mappingTable.json");
|
||||
const { STATUS_MAPPING } = require("./lib/statusMapping.js");
|
||||
|
||||
function containsNonASCII(str) {
|
||||
return /[^\x00-\x7F]/.test(str);
|
||||
@@ -16,13 +17,21 @@ function findStatus(val, { useSTD3ASCIIRules }) {
|
||||
const mid = Math.floor((start + end) / 2);
|
||||
|
||||
const target = mappingTable[mid];
|
||||
if (target[0][0] <= val && target[0][1] >= val) {
|
||||
if (target[1].startsWith("disallowed_STD3_")) {
|
||||
const newStatus = useSTD3ASCIIRules ? "disallowed" : target[1].slice(16);
|
||||
return [newStatus, ...target.slice(2)];
|
||||
const min = Array.isArray(target[0]) ? target[0][0] : target[0];
|
||||
const max = Array.isArray(target[0]) ? target[0][1] : target[0];
|
||||
|
||||
if (min <= val && max >= val) {
|
||||
if (useSTD3ASCIIRules &&
|
||||
(target[1] === STATUS_MAPPING.disallowed_STD3_valid || target[1] === STATUS_MAPPING.disallowed_STD3_mapped)) {
|
||||
return [STATUS_MAPPING.disallowed, ...target.slice(2)];
|
||||
} else if (target[1] === STATUS_MAPPING.disallowed_STD3_valid) {
|
||||
return [STATUS_MAPPING.valid, ...target.slice(2)];
|
||||
} else if (target[1] === STATUS_MAPPING.disallowed_STD3_mapped) {
|
||||
return [STATUS_MAPPING.mapped, ...target.slice(2)];
|
||||
}
|
||||
|
||||
return target.slice(1);
|
||||
} else if (target[0][0] > val) {
|
||||
} else if (min > val) {
|
||||
end = mid - 1;
|
||||
} else {
|
||||
start = mid + 1;
|
||||
@@ -40,23 +49,23 @@ function mapChars(domainName, { useSTD3ASCIIRules, processingOption }) {
|
||||
const [status, mapping] = findStatus(ch.codePointAt(0), { useSTD3ASCIIRules });
|
||||
|
||||
switch (status) {
|
||||
case "disallowed":
|
||||
case STATUS_MAPPING.disallowed:
|
||||
hasError = true;
|
||||
processed += ch;
|
||||
break;
|
||||
case "ignored":
|
||||
case STATUS_MAPPING.ignored:
|
||||
break;
|
||||
case "mapped":
|
||||
case STATUS_MAPPING.mapped:
|
||||
processed += mapping;
|
||||
break;
|
||||
case "deviation":
|
||||
case STATUS_MAPPING.deviation:
|
||||
if (processingOption === "transitional") {
|
||||
processed += mapping;
|
||||
} else {
|
||||
processed += ch;
|
||||
}
|
||||
break;
|
||||
case "valid":
|
||||
case STATUS_MAPPING.valid:
|
||||
processed += ch;
|
||||
break;
|
||||
}
|
||||
@@ -89,9 +98,9 @@ function validateLabel(label, { checkHyphens, checkBidi, checkJoiners, processin
|
||||
|
||||
for (const ch of codePoints) {
|
||||
const [status] = findStatus(ch.codePointAt(0), { useSTD3ASCIIRules });
|
||||
if ((processingOption === "transitional" && status !== "valid") ||
|
||||
if ((processingOption === "transitional" && status !== STATUS_MAPPING.valid) ||
|
||||
(processingOption === "nontransitional" &&
|
||||
status !== "valid" && status !== "deviation")) {
|
||||
status !== STATUS_MAPPING.valid && status !== STATUS_MAPPING.deviation)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -265,10 +274,11 @@ function toUnicode(domainName, {
|
||||
checkHyphens = false,
|
||||
checkBidi = false,
|
||||
checkJoiners = false,
|
||||
useSTD3ASCIIRules = false
|
||||
useSTD3ASCIIRules = false,
|
||||
processingOption = "nontransitional"
|
||||
} = {}) {
|
||||
const result = processing(domainName, {
|
||||
processingOption: "nontransitional",
|
||||
processingOption,
|
||||
checkHyphens,
|
||||
checkBidi,
|
||||
checkJoiners,
|
||||
|
2
node_modules/tr46/lib/mappingTable.json
generated
vendored
2
node_modules/tr46/lib/mappingTable.json
generated
vendored
File diff suppressed because one or more lines are too long
22
node_modules/tr46/lib/regexes.js
generated
vendored
22
node_modules/tr46/lib/regexes.js
generated
vendored
File diff suppressed because one or more lines are too long
11
node_modules/tr46/lib/statusMapping.js
generated
vendored
Normal file
11
node_modules/tr46/lib/statusMapping.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
module.exports.STATUS_MAPPING = {
|
||||
mapped: 1,
|
||||
valid: 2,
|
||||
disallowed: 3,
|
||||
disallowed_STD3_valid: 4, // eslint-disable-line camelcase
|
||||
disallowed_STD3_mapped: 5, // eslint-disable-line camelcase
|
||||
deviation: 6,
|
||||
ignored: 7
|
||||
};
|
69
node_modules/tr46/package.json
generated
vendored
69
node_modules/tr46/package.json
generated
vendored
@@ -1,60 +1,69 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"tr46@1.0.1",
|
||||
"D:\\Projects\\vanillajs-seed"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "tr46@1.0.1",
|
||||
"_id": "tr46@1.0.1",
|
||||
"_from": "tr46@^2.0.2",
|
||||
"_id": "tr46@2.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=",
|
||||
"_integrity": "sha512-3n1qG+/5kg+jrbTzwAykB5yRYtQCTqOGKq5U5PE3b0a1/mzo6snDhjGS0zJVJunO0NrT3Dg1MLy5TjWP/UJppg==",
|
||||
"_location": "/tr46",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "tr46@1.0.1",
|
||||
"raw": "tr46@^2.0.2",
|
||||
"name": "tr46",
|
||||
"escapedName": "tr46",
|
||||
"rawSpec": "1.0.1",
|
||||
"rawSpec": "^2.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.1"
|
||||
"fetchSpec": "^2.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/whatwg-url"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz",
|
||||
"_spec": "1.0.1",
|
||||
"_where": "D:\\Projects\\vanillajs-seed",
|
||||
"_resolved": "https://registry.npmjs.org/tr46/-/tr46-2.0.2.tgz",
|
||||
"_shasum": "03273586def1595ae08fedb38d7733cee91d2479",
|
||||
"_spec": "tr46@^2.0.2",
|
||||
"_where": "D:\\Projects\\vanillajs-seed\\node_modules\\whatwg-url",
|
||||
"author": {
|
||||
"name": "Sebastian Mayr",
|
||||
"email": "npm@smayr.name"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Sebmaster/tr46.js/issues"
|
||||
"url": "https://github.com/jsdom/tr46/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Timothy Gu",
|
||||
"email": "timothygu99@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"punycode": "^2.1.0"
|
||||
"punycode": "^2.1.1"
|
||||
},
|
||||
"description": "An implementation of the Unicode TR46 spec",
|
||||
"deprecated": false,
|
||||
"description": "An implementation of the Unicode UTS #46: Unicode IDNA Compatibility Processing",
|
||||
"devDependencies": {
|
||||
"eslint": "^3.13.0",
|
||||
"mocha": "^3.2.0",
|
||||
"regenerate": "^1.3.2",
|
||||
"request": "^2.79.0",
|
||||
"unicode-10.0.0": "^0.7.4"
|
||||
"eslint": "^6.8.0",
|
||||
"mocha": "^6.2.2",
|
||||
"node-fetch": "^2.6.0",
|
||||
"pump": "^3.0.0",
|
||||
"regenerate": "^1.4.0",
|
||||
"unicode-12.1.0": "^0.8.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib/mappingTable.json",
|
||||
"lib/regexes.js"
|
||||
"lib/regexes.js",
|
||||
"lib/statusMapping.js"
|
||||
],
|
||||
"homepage": "https://github.com/Sebmaster/tr46.js#readme",
|
||||
"homepage": "https://github.com/jsdom/tr46#readme",
|
||||
"keywords": [
|
||||
"unicode",
|
||||
"tr46",
|
||||
"uts46",
|
||||
"punycode",
|
||||
"url",
|
||||
"whatwg"
|
||||
],
|
||||
@@ -63,7 +72,7 @@
|
||||
"name": "tr46",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Sebmaster/tr46.js.git"
|
||||
"url": "git+https://github.com/jsdom/tr46.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
@@ -71,6 +80,6 @@
|
||||
"pretest": "node scripts/getLatestTests.js",
|
||||
"test": "mocha"
|
||||
},
|
||||
"unicodeVersion": "10.0.0",
|
||||
"version": "1.0.1"
|
||||
"unicodeVersion": "12.1.0",
|
||||
"version": "2.0.2"
|
||||
}
|
||||
|
Reference in New Issue
Block a user