This commit is contained in:
2022-09-30 05:39:11 +00:00
parent 41ee9463ae
commit 4687fa49bc
11418 changed files with 1312504 additions and 0 deletions

3
buildfiles/node_modules/utf8-byte-length/.gitmodules generated vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "vendor/big-list-of-naughty-strings"]
path = vendor/big-list-of-naughty-strings
url = https://github.com/minimaxir/big-list-of-naughty-strings.git

1
buildfiles/node_modules/utf8-byte-length/.npmignore generated vendored Normal file
View File

@ -0,0 +1 @@
vendor/

12
buildfiles/node_modules/utf8-byte-length/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,12 @@
language: node_js
node_js:
- "0.10"
- "0.12"
- "1"
- "2"
- "3"
- "4"
- "5"
- "node"
before_install:
- npm install -g npm

2
buildfiles/node_modules/utf8-byte-length/AUTHORS generated vendored Normal file
View File

@ -0,0 +1,2 @@
Carl Xiong <xiongc05@gmail.com>
Parsha Pourkhomami <parshap@gmail.com>

28
buildfiles/node_modules/utf8-byte-length/README.md generated vendored Normal file
View File

@ -0,0 +1,28 @@
# utf8-byte-length [![build status](https://secure.travis-ci.org/parshap/utf8-byte-length.svg?branch=master)](http://travis-ci.org/parshap/utf8-byte-length)
Get the utf8 byte length of a string, taking into account multi-byte
characters and surrogate pairs.
By default, this module defers to `Buffer.byteLength`. A browser
implementation is also provided that doesn't use `Buffer.byteLength`
minimize build size.
## Example
```js
var getLength = require("utf8-byte-length")
console.log(truncate("a☃", 2)) // a = 1 byte, ☃ = 3 bytes
// -> 4
```
## API
### `var getLength = require("utf8-byte-length")`
*When using browserify or webpack*, this automatically resolves to an
implementation that does not use `Buffer.byteLength`.
### `getLength(string)`
Returns the byte length of `string`. Throws an error if `string` is not
a string.

47
buildfiles/node_modules/utf8-byte-length/browser.js generated vendored Normal file
View File

@ -0,0 +1,47 @@
'use strict';
function isHighSurrogate(codePoint) {
return codePoint >= 0xd800 && codePoint <= 0xdbff;
}
function isLowSurrogate(codePoint) {
return codePoint >= 0xdc00 && codePoint <= 0xdfff;
}
// Truncate string by size in bytes
module.exports = function getByteLength(string) {
if (typeof string !== "string") {
throw new Error("Input must be string");
}
var charLength = string.length;
var byteLength = 0;
var codePoint = null;
var prevCodePoint = null;
for (var i = 0; i < charLength; i++) {
codePoint = string.charCodeAt(i);
// handle 4-byte non-BMP chars
// low surrogate
if (isLowSurrogate(codePoint)) {
// when parsing previous hi-surrogate, 3 is added to byteLength
if (prevCodePoint != null && isHighSurrogate(prevCodePoint)) {
byteLength += 1;
}
else {
byteLength += 3;
}
}
else if (codePoint <= 0x7f ) {
byteLength += 1;
}
else if (codePoint >= 0x80 && codePoint <= 0x7ff) {
byteLength += 2;
}
else if (codePoint >= 0x800 && codePoint <= 0xffff) {
byteLength += 3;
}
prevCodePoint = codePoint;
}
return byteLength;
};

8
buildfiles/node_modules/utf8-byte-length/index.js generated vendored Normal file
View File

@ -0,0 +1,8 @@
"use strict";
module.exports = function getByteLength(string) {
if (typeof string !== "string") {
throw new Error("Input must be string");
}
return Buffer.byteLength(string, "utf8");
};

64
buildfiles/node_modules/utf8-byte-length/package.json generated vendored Normal file
View File

@ -0,0 +1,64 @@
{
"_from": "utf8-byte-length@^1.0.1",
"_id": "utf8-byte-length@1.0.4",
"_inBundle": false,
"_integrity": "sha1-9F8VDExm7uloGGUFq5P8u4rWv2E=",
"_location": "/utf8-byte-length",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "utf8-byte-length@^1.0.1",
"name": "utf8-byte-length",
"escapedName": "utf8-byte-length",
"rawSpec": "^1.0.1",
"saveSpec": null,
"fetchSpec": "^1.0.1"
},
"_requiredBy": [
"/truncate-utf8-bytes"
],
"_resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz",
"_shasum": "f45f150c4c66eee968186505ab93fcbb8ad6bf61",
"_spec": "utf8-byte-length@^1.0.1",
"_where": "/home/shihaam/www/freezer.shihaam.me/node_modules/truncate-utf8-bytes",
"author": {
"name": "Carl Xiong",
"email": "xiongc05@gmail.com"
},
"browser": "browser.js",
"bugs": {
"url": "https://github.com/parshap/utf8-byte-length/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Carl Xiong",
"email": "xiongc05@gmail.com"
},
{
"name": "Parsha Pourkhomami",
"email": "parshap@gmail.com"
}
],
"deprecated": false,
"description": "Get utf8 byte length of string",
"devDependencies": {
"tape": "^4.2.2"
},
"homepage": "https://github.com/parshap/utf8-byte-length#readme",
"keywords": [
"utf8"
],
"license": "WTFPL",
"main": "index.js",
"name": "utf8-byte-length",
"repository": {
"type": "git",
"url": "git+https://github.com/parshap/utf8-byte-length.git"
},
"scripts": {
"test": "tape test.js"
},
"version": "1.0.4"
}

67
buildfiles/node_modules/utf8-byte-length/test.js generated vendored Normal file
View File

@ -0,0 +1,67 @@
"use strict";
var test = require("tape");
var getLength = require("./index");
var browserGetLength = require("./browser");
function repeat(string, times) {
return new Array(times + 1).join(string);
}
// Test writing files to the fs
//
try {
var blns = require("./vendor/big-list-of-naughty-strings/blns.json");
}
catch (err) {
console.error("Error: Cannot load file './vendor/big-list-of-naughty-strings/blns.json'");
console.error();
console.error("Make sure you've initialized git submodules by running");
console.error();
console.error(" git submodule update --init");
console.error();
process.exit(1);
}
// 8-byte, 4-character string
var THUMB = "👍🏽";
// Tests run against both implementations
[getLength, browserGetLength].forEach(function(getLength) {
// Strings with known lengths
[
["", 0],
["a", 1],
["☃", 3],
["a☃", 4],
[repeat("a", 250) + '\uD800\uDC00', 254],
[repeat("a", 251) + '\uD800\uDC00', 255],
[repeat("a", 252) + '\uD800\uDC00', 256],
[THUMB, 8],
[THUMB[0], 3],
[THUMB[1], 3],
[THUMB[2], 3],
[THUMB[3], 3],
[THUMB.slice(0, 2), 4],
[THUMB.slice(2, 4), 4],
[THUMB.slice(1, 3), 6],
].forEach(function(desc) {
var string = desc[0];
var length = desc[1];
test(JSON.stringify(string) + "=" + length, function(t) {
t.equal(getLength(string), length);
t.end();
});
});
// Make sure result matches Buffer.byteLength for various strings
blns.forEach(function(str) {
test(JSON.stringify(str), function(t) {
t.equal(getLength(str), Buffer.byteLength(str));
t.end();
});
});
});