0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

19
web/node_modules/html-entities/LICENSE generated vendored Normal file
View file

@ -0,0 +1,19 @@
Copyright (c) 2013 Dulin Marat
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.

63
web/node_modules/html-entities/README.md generated vendored Normal file
View file

@ -0,0 +1,63 @@
html-entities
=============
[![Build Status](https://travis-ci.org/mdevils/node-html-entities.svg?branch=master)](https://travis-ci.org/mdevils/node-html-entities)
[![Coverage Status](https://coveralls.io/repos/mdevils/node-html-entities/badge.svg?branch=master&service=github)](https://coveralls.io/github/mdevils/node-html-entities?branch=master)
Fast html entities library.
Installation
------------
```bash
$ npm install html-entities
```
Usage
-----
**XML entities**
HTML validity and XSS attack prevention you can achieve from XmlEntities class.
```javascript
const Entities = require('html-entities').XmlEntities;
const entities = new Entities();
console.log(entities.encode('<>"\'&©®')); // &lt;&gt;&quot;&apos;&amp;©®
console.log(entities.encodeNonUTF('<>"\'&©®')); // &lt;&gt;&quot;&apos;&amp;&#169;&#174;
console.log(entities.encodeNonASCII('<>"\'&©®')); // <>"\'&©®
console.log(entities.decode('&lt;&gt;&quot;&apos;&amp;&copy;&reg;&#8710;')); // <>"'&&copy;&reg;
```
**All HTML entities encoding/decoding**
```javascript
const Entities = require('html-entities').AllHtmlEntities;
const entities = new Entities();
console.log(entities.encode('<>"&©®∆')); // &lt;&gt;&quot;&amp;&copy;&reg;
console.log(entities.encodeNonUTF('<>"&©®∆')); // &lt;&gt;&quot;&amp;&copy;&reg;&#8710;
console.log(entities.encodeNonASCII('<>"&©®∆')); // <>"&©®&#8710;
console.log(entities.decode('&lt;&gt;&quot;&amp;&copy;&reg;')); // <>"&©®
```
**Available classes**
```javascript
const XmlEntities = require('html-entities').XmlEntities, // <>"'& + &#...; decoding
Html4Entities = require('html-entities').Html4Entities, // HTML4 entities.
Html5Entities = require('html-entities').Html5Entities, // HTML5 entities.
AllHtmlEntities = require('html-entities').AllHtmlEntities; // Synonym for HTML5 entities.
```
Supports four methods for every class:
* encode — encodes, replacing characters to its entity representations. Ignores UTF characters with no entity representation.
* encodeNonUTF — encodes, replacing characters to its entity representations. Inserts numeric entities for UTF characters.
* encodeNonASCII — encodes, replacing only non-ASCII characters to its numeric entity representations.
* decode — decodes, replacing entities to characters. Unknown entities are left as is.

10
web/node_modules/html-entities/lib/html4-entities.d.ts generated vendored Normal file
View file

@ -0,0 +1,10 @@
export declare class Html4Entities {
decode(str: string): string;
static decode(str: string): string;
encode(str: string): string;
static encode(str: string): string;
encodeNonUTF(str: string): string;
static encodeNonUTF(str: string): string;
encodeNonASCII(str: string): string;
static encodeNonASCII(str: string): string;
}

128
web/node_modules/html-entities/lib/html4-entities.js generated vendored Normal file
View file

@ -0,0 +1,128 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var surrogate_pairs_1 = require("./surrogate-pairs");
var HTML_ALPHA = ['apos', 'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', 'brvbar', 'sect', 'uml', 'copy', 'ordf', 'laquo', 'not', 'shy', 'reg', 'macr', 'deg', 'plusmn', 'sup2', 'sup3', 'acute', 'micro', 'para', 'middot', 'cedil', 'sup1', 'ordm', 'raquo', 'frac14', 'frac12', 'frac34', 'iquest', 'Agrave', 'Aacute', 'Acirc', 'Atilde', 'Auml', 'Aring', 'AElig', 'Ccedil', 'Egrave', 'Eacute', 'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml', 'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', 'Ouml', 'times', 'Oslash', 'Ugrave', 'Uacute', 'Ucirc', 'Uuml', 'Yacute', 'THORN', 'szlig', 'agrave', 'aacute', 'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil', 'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', 'icirc', 'iuml', 'eth', 'ntilde', 'ograve', 'oacute', 'ocirc', 'otilde', 'ouml', 'divide', 'oslash', 'ugrave', 'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml', 'quot', 'amp', 'lt', 'gt', 'OElig', 'oelig', 'Scaron', 'scaron', 'Yuml', 'circ', 'tilde', 'ensp', 'emsp', 'thinsp', 'zwnj', 'zwj', 'lrm', 'rlm', 'ndash', 'mdash', 'lsquo', 'rsquo', 'sbquo', 'ldquo', 'rdquo', 'bdquo', 'dagger', 'Dagger', 'permil', 'lsaquo', 'rsaquo', 'euro', 'fnof', 'Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta', 'Eta', 'Theta', 'Iota', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Xi', 'Omicron', 'Pi', 'Rho', 'Sigma', 'Tau', 'Upsilon', 'Phi', 'Chi', 'Psi', 'Omega', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'omicron', 'pi', 'rho', 'sigmaf', 'sigma', 'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega', 'thetasym', 'upsih', 'piv', 'bull', 'hellip', 'prime', 'Prime', 'oline', 'frasl', 'weierp', 'image', 'real', 'trade', 'alefsym', 'larr', 'uarr', 'rarr', 'darr', 'harr', 'crarr', 'lArr', 'uArr', 'rArr', 'dArr', 'hArr', 'forall', 'part', 'exist', 'empty', 'nabla', 'isin', 'notin', 'ni', 'prod', 'sum', 'minus', 'lowast', 'radic', 'prop', 'infin', 'ang', 'and', 'or', 'cap', 'cup', 'int', 'there4', 'sim', 'cong', 'asymp', 'ne', 'equiv', 'le', 'ge', 'sub', 'sup', 'nsub', 'sube', 'supe', 'oplus', 'otimes', 'perp', 'sdot', 'lceil', 'rceil', 'lfloor', 'rfloor', 'lang', 'rang', 'loz', 'spades', 'clubs', 'hearts', 'diams'];
var HTML_CODES = [39, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 34, 38, 60, 62, 338, 339, 352, 353, 376, 710, 732, 8194, 8195, 8201, 8204, 8205, 8206, 8207, 8211, 8212, 8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8240, 8249, 8250, 8364, 402, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 977, 978, 982, 8226, 8230, 8242, 8243, 8254, 8260, 8472, 8465, 8476, 8482, 8501, 8592, 8593, 8594, 8595, 8596, 8629, 8656, 8657, 8658, 8659, 8660, 8704, 8706, 8707, 8709, 8711, 8712, 8713, 8715, 8719, 8721, 8722, 8727, 8730, 8733, 8734, 8736, 8743, 8744, 8745, 8746, 8747, 8756, 8764, 8773, 8776, 8800, 8801, 8804, 8805, 8834, 8835, 8836, 8838, 8839, 8853, 8855, 8869, 8901, 8968, 8969, 8970, 8971, 9001, 9002, 9674, 9824, 9827, 9829, 9830];
var alphaIndex = {};
var numIndex = {};
(function () {
var i = 0;
var length = HTML_ALPHA.length;
while (i < length) {
var a = HTML_ALPHA[i];
var c = HTML_CODES[i];
alphaIndex[a] = String.fromCharCode(c);
numIndex[c] = a;
i++;
}
})();
var Html4Entities = /** @class */ (function () {
function Html4Entities() {
}
Html4Entities.prototype.decode = function (str) {
if (!str || !str.length) {
return '';
}
return str.replace(/&(#?[\w\d]+);?/g, function (s, entity) {
var chr;
if (entity.charAt(0) === "#") {
var code = entity.charAt(1).toLowerCase() === 'x' ?
parseInt(entity.substr(2), 16) :
parseInt(entity.substr(1));
if (!isNaN(code) || code >= -32768) {
if (code <= 65535) {
chr = String.fromCharCode(code);
}
else {
chr = surrogate_pairs_1.fromCodePoint(code);
}
}
}
else {
chr = alphaIndex[entity];
}
return chr || s;
});
};
Html4Entities.decode = function (str) {
return new Html4Entities().decode(str);
};
Html4Entities.prototype.encode = function (str) {
if (!str || !str.length) {
return '';
}
var strLength = str.length;
var result = '';
var i = 0;
while (i < strLength) {
var alpha = numIndex[str.charCodeAt(i)];
result += alpha ? "&" + alpha + ";" : str.charAt(i);
i++;
}
return result;
};
Html4Entities.encode = function (str) {
return new Html4Entities().encode(str);
};
Html4Entities.prototype.encodeNonUTF = function (str) {
if (!str || !str.length) {
return '';
}
var strLength = str.length;
var result = '';
var i = 0;
while (i < strLength) {
var cc = str.charCodeAt(i);
var alpha = numIndex[cc];
if (alpha) {
result += "&" + alpha + ";";
}
else if (cc < 32 || cc > 126) {
if (cc >= surrogate_pairs_1.highSurrogateFrom && cc <= surrogate_pairs_1.highSurrogateTo) {
result += '&#' + surrogate_pairs_1.getCodePoint(str, i) + ';';
i++;
}
else {
result += '&#' + cc + ';';
}
}
else {
result += str.charAt(i);
}
i++;
}
return result;
};
Html4Entities.encodeNonUTF = function (str) {
return new Html4Entities().encodeNonUTF(str);
};
Html4Entities.prototype.encodeNonASCII = function (str) {
if (!str || !str.length) {
return '';
}
var strLength = str.length;
var result = '';
var i = 0;
while (i < strLength) {
var c = str.charCodeAt(i);
if (c <= 255) {
result += str[i++];
continue;
}
if (c >= surrogate_pairs_1.highSurrogateFrom && c <= surrogate_pairs_1.highSurrogateTo) {
result += '&#' + surrogate_pairs_1.getCodePoint(str, i) + ';';
i++;
}
else {
result += '&#' + c + ';';
}
i++;
}
return result;
};
Html4Entities.encodeNonASCII = function (str) {
return new Html4Entities().encodeNonASCII(str);
};
return Html4Entities;
}());
exports.Html4Entities = Html4Entities;

10
web/node_modules/html-entities/lib/html5-entities.d.ts generated vendored Normal file
View file

@ -0,0 +1,10 @@
export declare class Html5Entities {
decode(str: string): string;
static decode(str: string): string;
encode(str: string): string;
static encode(str: string): string;
encodeNonUTF(str: string): string;
static encodeNonUTF(str: string): string;
encodeNonASCII(str: string): string;
static encodeNonASCII(str: string): string;
}

167
web/node_modules/html-entities/lib/html5-entities.js generated vendored Normal file

File diff suppressed because one or more lines are too long

3
web/node_modules/html-entities/lib/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,3 @@
export { XmlEntities } from './xml-entities';
export { Html4Entities } from './html4-entities';
export { Html5Entities, Html5Entities as AllHtmlEntities } from './html5-entities';

9
web/node_modules/html-entities/lib/index.js generated vendored Normal file
View file

@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var xml_entities_1 = require("./xml-entities");
exports.XmlEntities = xml_entities_1.XmlEntities;
var html4_entities_1 = require("./html4-entities");
exports.Html4Entities = html4_entities_1.Html4Entities;
var html5_entities_1 = require("./html5-entities");
exports.Html5Entities = html5_entities_1.Html5Entities;
exports.AllHtmlEntities = html5_entities_1.Html5Entities;

View file

@ -0,0 +1,4 @@
export declare const fromCodePoint: (...codePoints: number[]) => string;
export declare const getCodePoint: (input: string, position: number) => number | undefined;
export declare const highSurrogateFrom = 55296;
export declare const highSurrogateTo = 56319;

15
web/node_modules/html-entities/lib/surrogate-pairs.js generated vendored Normal file
View file

@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromCodePoint = String.fromCodePoint || function (astralCodePoint) {
return String.fromCharCode(Math.floor((astralCodePoint - 0x10000) / 0x400) + 0xD800, (astralCodePoint - 0x10000) % 0x400 + 0xDC00);
};
exports.getCodePoint = String.prototype.codePointAt ?
function (input, position) {
return input.codePointAt(position);
} :
function (input, position) {
return (input.charCodeAt(position) - 0xD800) * 0x400
+ input.charCodeAt(position + 1) - 0xDC00 + 0x10000;
};
exports.highSurrogateFrom = 0xD800;
exports.highSurrogateTo = 0xDBFF;

10
web/node_modules/html-entities/lib/xml-entities.d.ts generated vendored Normal file
View file

@ -0,0 +1,10 @@
export declare class XmlEntities {
encode(str: string): string;
static encode(str: string): string;
decode(str: string): string;
static decode(str: string): string;
encodeNonUTF(str: string): string;
static encodeNonUTF(str: string): string;
encodeNonASCII(str: string): string;
static encodeNonASCII(str: string): string;
}

132
web/node_modules/html-entities/lib/xml-entities.js generated vendored Normal file
View file

@ -0,0 +1,132 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var surrogate_pairs_1 = require("./surrogate-pairs");
var ALPHA_INDEX = {
'&lt': '<',
'&gt': '>',
'&quot': '"',
'&apos': '\'',
'&amp': '&',
'&lt;': '<',
'&gt;': '>',
'&quot;': '"',
'&apos;': '\'',
'&amp;': '&'
};
var CHAR_INDEX = {
60: 'lt',
62: 'gt',
34: 'quot',
39: 'apos',
38: 'amp'
};
var CHAR_S_INDEX = {
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&apos;',
'&': '&amp;'
};
var XmlEntities = /** @class */ (function () {
function XmlEntities() {
}
XmlEntities.prototype.encode = function (str) {
if (!str || !str.length) {
return '';
}
return str.replace(/[<>"'&]/g, function (s) {
return CHAR_S_INDEX[s];
});
};
XmlEntities.encode = function (str) {
return new XmlEntities().encode(str);
};
XmlEntities.prototype.decode = function (str) {
if (!str || !str.length) {
return '';
}
return str.replace(/&#?[0-9a-zA-Z]+;?/g, function (s) {
if (s.charAt(1) === '#') {
var code = s.charAt(2).toLowerCase() === 'x' ?
parseInt(s.substr(3), 16) :
parseInt(s.substr(2));
if (!isNaN(code) || code >= -32768) {
if (code <= 65535) {
return String.fromCharCode(code);
}
else {
return surrogate_pairs_1.fromCodePoint(code);
}
}
return '';
}
return ALPHA_INDEX[s] || s;
});
};
XmlEntities.decode = function (str) {
return new XmlEntities().decode(str);
};
XmlEntities.prototype.encodeNonUTF = function (str) {
if (!str || !str.length) {
return '';
}
var strLength = str.length;
var result = '';
var i = 0;
while (i < strLength) {
var c = str.charCodeAt(i);
var alpha = CHAR_INDEX[c];
if (alpha) {
result += "&" + alpha + ";";
i++;
continue;
}
if (c < 32 || c > 126) {
if (c >= surrogate_pairs_1.highSurrogateFrom && c <= surrogate_pairs_1.highSurrogateTo) {
result += '&#' + surrogate_pairs_1.getCodePoint(str, i) + ';';
i++;
}
else {
result += '&#' + c + ';';
}
}
else {
result += str.charAt(i);
}
i++;
}
return result;
};
XmlEntities.encodeNonUTF = function (str) {
return new XmlEntities().encodeNonUTF(str);
};
XmlEntities.prototype.encodeNonASCII = function (str) {
if (!str || !str.length) {
return '';
}
var strLength = str.length;
var result = '';
var i = 0;
while (i < strLength) {
var c = str.charCodeAt(i);
if (c <= 255) {
result += str[i++];
continue;
}
if (c >= surrogate_pairs_1.highSurrogateFrom && c <= surrogate_pairs_1.highSurrogateTo) {
result += '&#' + surrogate_pairs_1.getCodePoint(str, i) + ';';
i++;
}
else {
result += '&#' + c + ';';
}
i++;
}
return result;
};
XmlEntities.encodeNonASCII = function (str) {
return new XmlEntities().encodeNonASCII(str);
};
return XmlEntities;
}());
exports.XmlEntities = XmlEntities;

53
web/node_modules/html-entities/package.json generated vendored Normal file
View file

@ -0,0 +1,53 @@
{
"name": "html-entities",
"version": "1.4.0",
"description": "Faster HTML entities encode/decode library.",
"keywords": [
"html",
"html entities",
"html entities encode",
"html entities decode",
"entities",
"entities encode",
"entities decode"
],
"author": {
"name": "Marat Dulin",
"email": "mdevils@yandex.ru"
},
"dependencies": {},
"devDependencies": {
"@types/benchmark": "^2.1.0",
"@types/chai": "^4.2.11",
"@types/mocha": "^7.0.2",
"@types/node": "^13.13.4",
"benchmark": "^2.1.4",
"chai": "^4.2.0",
"coveralls": "^3.1.0",
"entities": "^2.0.0",
"mocha": "^7.1.2",
"node-html-encoder": "^0.0.2",
"ts-node": "^8.9.1",
"typescript": "^3.8.3"
},
"repository": {
"type": "git",
"url": "https://github.com/mdevils/node-html-entities.git"
},
"main": "./lib/index.js",
"typings": "./lib/index.d.ts",
"types": "./lib/index.d.ts",
"scripts": {
"test": "mocha --recursive -r ts-node/register test/**/*.ts",
"benchmark": "ts-node benchmark/benchmark",
"travis": "yarn test",
"build": "tsc",
"prepublishOnly": "yarn build"
},
"files": [
"index.js",
"lib",
"LICENSE"
],
"license": "MIT"
}