push the uni-demo project

This commit is contained in:
2022-06-21 10:55:37 +08:00
parent 37ca848bb6
commit 333705f703
8034 changed files with 1388875 additions and 0 deletions

8
uni-demo/node_modules/encoding/.prettierrc.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
module.exports = {
printWidth: 160,
tabWidth: 4,
singleQuote: true,
endOfLine: 'lf',
trailingComma: 'none',
arrowParens: 'avoid'
};

25
uni-demo/node_modules/encoding/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,25 @@
language: node_js
sudo: false
node_js:
- "0.10"
- 0.12
- iojs
- 4
- 5
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
notifications:
email:
- andris@kreata.ee
webhooks:
urls:
- https://webhooks.gitter.im/e/0ed18fd9b3e529b3c2cc
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: false # default: false

16
uni-demo/node_modules/encoding/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,16 @@
Copyright (c) 2012-2014 Andris Reinman
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 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.

41
uni-demo/node_modules/encoding/README.md generated vendored Normal file
View File

@@ -0,0 +1,41 @@
# Encoding
**encoding** is a simple wrapper around [iconv-lite](https://github.com/ashtuchkin/iconv-lite/) to convert strings from one encoding to another.
[![Build Status](https://secure.travis-ci.org/andris9/encoding.svg)](http://travis-ci.org/andris9/Nodemailer)
[![npm version](https://badge.fury.io/js/encoding.svg)](http://badge.fury.io/js/encoding)
Initially _encoding_ was a wrapper around _node-iconv_ (main) and _iconv-lite_ (fallback) and was used as the encoding layer for Nodemailer/mailparser. Somehow it also ended up as a dependency for a bunch of other project, none of these actually using _node-iconv_. The loading mechanics caused issues for front-end projects and Nodemailer/malparser had moved on, so _node-iconv_ was removed.
## Install
Install through npm
npm install encoding
## Usage
Require the module
var encoding = require("encoding");
Convert with encoding.convert()
var resultBuffer = encoding.convert(text, toCharset, fromCharset);
Where
- **text** is either a Buffer or a String to be converted
- **toCharset** is the characterset to convert the string
- **fromCharset** (_optional_, defaults to UTF-8) is the source charset
Output of the conversion is always a Buffer object.
Example
var result = encoding.convert("ÕÄÖÜ", "Latin_1");
console.log(result); //<Buffer d5 c4 d6 dc>
## License
**MIT**

83
uni-demo/node_modules/encoding/lib/encoding.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
'use strict';
var iconvLite = require('iconv-lite');
// Expose to the world
module.exports.convert = convert;
/**
* Convert encoding of an UTF-8 string or a buffer
*
* @param {String|Buffer} str String to be converted
* @param {String} to Encoding to be converted to
* @param {String} [from='UTF-8'] Encoding to be converted from
* @return {Buffer} Encoded string
*/
function convert(str, to, from) {
from = checkEncoding(from || 'UTF-8');
to = checkEncoding(to || 'UTF-8');
str = str || '';
var result;
if (from !== 'UTF-8' && typeof str === 'string') {
str = Buffer.from(str, 'binary');
}
if (from === to) {
if (typeof str === 'string') {
result = Buffer.from(str);
} else {
result = str;
}
} else {
try {
result = convertIconvLite(str, to, from);
} catch (E) {
console.error(E);
result = str;
}
}
if (typeof result === 'string') {
result = Buffer.from(result, 'utf-8');
}
return result;
}
/**
* Convert encoding of astring with iconv-lite
*
* @param {String|Buffer} str String to be converted
* @param {String} to Encoding to be converted to
* @param {String} [from='UTF-8'] Encoding to be converted from
* @return {Buffer} Encoded string
*/
function convertIconvLite(str, to, from) {
if (to === 'UTF-8') {
return iconvLite.decode(str, from);
} else if (from === 'UTF-8') {
return iconvLite.encode(str, to);
} else {
return iconvLite.encode(iconvLite.decode(str, from), to);
}
}
/**
* Converts charset name if needed
*
* @param {String} name Character set
* @return {String} Character set name
*/
function checkEncoding(name) {
return (name || '')
.toString()
.trim()
.replace(/^latin[\-_]?(\d+)$/i, 'ISO-8859-$1')
.replace(/^win(?:dows)?[\-_]?(\d+)$/i, 'WINDOWS-$1')
.replace(/^utf[\-_]?(\d+)$/i, 'UTF-$1')
.replace(/^ks_c_5601\-1987$/i, 'CP949')
.replace(/^us[\-_]?ascii$/i, 'ASCII')
.toUpperCase();
}

18
uni-demo/node_modules/encoding/package.json generated vendored Normal file
View File

@@ -0,0 +1,18 @@
{
"name": "encoding",
"version": "0.1.13",
"description": "Convert encodings, uses iconv-lite",
"main": "lib/encoding.js",
"scripts": {
"test": "nodeunit test"
},
"repository": "https://github.com/andris9/encoding.git",
"author": "Andris Reinman",
"license": "MIT",
"dependencies": {
"iconv-lite": "^0.6.2"
},
"devDependencies": {
"nodeunit": "0.11.3"
}
}

49
uni-demo/node_modules/encoding/test/test.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
'use strict';
var encoding = require('../lib/encoding');
exports['General tests'] = {
'From UTF-8 to Latin_1': function (test) {
var input = 'ÕÄÖÜ',
expected = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc]);
test.deepEqual(encoding.convert(input, 'latin1'), expected);
test.done();
},
'From Latin_1 to UTF-8': function (test) {
var input = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc]),
expected = 'ÕÄÖÜ';
test.deepEqual(encoding.convert(input, 'utf-8', 'latin1').toString(), expected);
test.done();
},
'From UTF-8 to UTF-8': function (test) {
var input = 'ÕÄÖÜ',
expected = Buffer.from('ÕÄÖÜ');
test.deepEqual(encoding.convert(input, 'utf-8', 'utf-8'), expected);
test.done();
},
'From Latin_13 to Latin_15': function (test) {
var input = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc, 0xd0]),
expected = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc, 0xa6]);
test.deepEqual(encoding.convert(input, 'latin_15', 'latin13'), expected);
test.done();
}
/*
// ISO-2022-JP is not supported by iconv-lite
"From ISO-2022-JP to UTF-8 with Iconv": function (test) {
var input = Buffer.from(
"GyRCM1g5OzU7PVEwdzgmPSQ4IUYkMnFKczlwGyhC",
"base64"
),
expected = Buffer.from(
"5a2m5qCh5oqA6KGT5ZOh56CU5L+u5qSc6KiO5Lya5aCx5ZGK",
"base64"
);
test.deepEqual(encoding.convert(input, "utf-8", "ISO-2022-JP"), expected);
test.done();
},
*/
};