docs:更新文档

This commit is contained in:
张益铭
2021-03-01 15:06:11 +08:00
parent 1542135ab0
commit 9064b372e8
5835 changed files with 904126 additions and 161722 deletions

21
node_modules/brotli-size/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Erwin Mombay <erwin.mombay@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.

37
node_modules/brotli-size/README.md generated vendored Normal file
View File

@@ -0,0 +1,37 @@
brotli-size
> Get the brotli compressed size of a string or buffer.
## Install
```
$ npm install --save brotli-size
```
## Usage
```js
var brotliSize = require('brotli-size');
var str = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam feugiat, mauris non aliquam pretium, libero nulla ultrices lacus, nec varius est purus sit amet dolor.';
console.log(str.length); // 165
console.log(brotliSize.sync(str)); // 118
```
## API
### brotliSize.sync(input)
#### input
Type: `string`, `buffer`
### brotliSize.stream()
Returns a passthrough stream. The stream emits a `brotli-size` event and
has a `brotliSize` property.
## Related
- [gzip-size](https://github.com/sindresorhus/gzip-size) - Heavily inspired by
this module. Thank you for the inspiration!

35
node_modules/brotli-size/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
/// <reference types="node" />
import { PassThrough as PassThroughStream } from 'stream';
export interface BrotliEncodeParams {
mode?: number;
quality?: number;
}
/**
* @param incoming Either a Buffer or string of the value to encode.
* @param options Subset of Encoding Parameters.
* @return Promise that resolves with the encoded Buffer length.
*/
export default function size(incoming: Buffer | string, options?: BrotliEncodeParams): Promise<number>;
/**
* @param incoming Either a Buffer or string of the value to encode.
* @param options Subset of Encoding Parameters.
* @return Length of encoded Buffer.
*/
export declare function sync(incoming: Buffer | string, options?: BrotliEncodeParams): number;
/**
* @param options
* @return PassThroughStream for the contents being compressed
*/
export declare function stream(options?: BrotliEncodeParams): PassThroughStream;
/**
* @param path File Path for the file to compress.
* @param options Subset of Encoding Parameters.
* @return Promise that resolves with size of encoded file.
*/
export declare function file(path: string, options?: BrotliEncodeParams): Promise<number>;
/**
* @param path File Path for the file to compress.
* @param options Subset of Encoding Parameters.
* @return size of encoded file.
*/
export declare function fileSync(path: string, options?: BrotliEncodeParams): number;

90
node_modules/brotli-size/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,90 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const zlib_1 = require("zlib");
const stream_1 = require("stream");
const fs_1 = require("fs");
const util_1 = require("util");
const duplexer = require('duplexer');
const readFilePromise = util_1.promisify(fs_1.readFile);
const bufferFormatter = (incoming) => typeof incoming === 'string' ? Buffer.from(incoming, 'utf8') : incoming;
const optionFormatter = (passed, toEncode) => ({
params: {
[zlib_1.constants.BROTLI_PARAM_MODE]: passed && 'mode' in passed && passed.mode || zlib_1.constants.BROTLI_DEFAULT_MODE,
[zlib_1.constants.BROTLI_PARAM_QUALITY]: passed && 'quality' in passed && passed.quality || zlib_1.constants.BROTLI_MAX_QUALITY,
[zlib_1.constants.BROTLI_PARAM_SIZE_HINT]: toEncode ? toEncode.byteLength : 0,
}
});
/**
* @param incoming Either a Buffer or string of the value to encode.
* @param options Subset of Encoding Parameters.
* @return Promise that resolves with the encoded Buffer length.
*/
async function size(incoming, options) {
const buffer = bufferFormatter(incoming);
return new Promise(function (resolve, reject) {
zlib_1.brotliCompress(buffer, optionFormatter(options, buffer), (error, result) => {
if (error !== null) {
reject(error);
}
resolve(result.byteLength);
});
});
}
exports.default = size;
/**
* @param incoming Either a Buffer or string of the value to encode.
* @param options Subset of Encoding Parameters.
* @return Length of encoded Buffer.
*/
function sync(incoming, options) {
const buffer = bufferFormatter(incoming);
return zlib_1.brotliCompressSync(buffer, optionFormatter(options, buffer)).byteLength;
}
exports.sync = sync;
/**
* @param options
* @return PassThroughStream for the contents being compressed
*/
function stream(options) {
const input = new stream_1.PassThrough();
const output = new stream_1.PassThrough();
const wrapper = duplexer(input, output);
let size = 0;
const brotli = zlib_1.createBrotliCompress(optionFormatter(options))
.on('data', buf => {
size += buf.length;
})
.on('error', () => {
wrapper.brotliSize = 0;
})
.on('end', () => {
wrapper.brotliSize = size;
wrapper.emit('brotli-size', size);
output.end();
});
input.pipe(brotli);
input.pipe(output, { end: false });
return wrapper;
}
exports.stream = stream;
/**
* @param path File Path for the file to compress.
* @param options Subset of Encoding Parameters.
* @return Promise that resolves with size of encoded file.
*/
async function file(path, options) {
const file = await readFilePromise(path);
return (await size(file, options));
}
exports.file = file;
/**
* @param path File Path for the file to compress.
* @param options Subset of Encoding Parameters.
* @return size of encoded file.
*/
function fileSync(path, options) {
const file = fs_1.readFileSync(path);
return sync(file, options);
}
exports.fileSync = fileSync;
//# sourceMappingURL=index.js.map

1
node_modules/brotli-size/dist/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,+BAA2H;AAC3H,mCAAwD;AACxD,2BAA0C;AAC1C,+BAA+B;AAE/B,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACrC,MAAM,eAAe,GAAG,gBAAS,CAAC,aA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AAC,MAAM,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;AACrC,CAAC;AAHD,oBAGC;AAED;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAA4B;IACjE,MAAM,IAAI,GAAG,iBAAY,CAAC,IAAI,CAAC,CAAC;IAChC,OAAO,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC7B,CAAC;AAHD,4BAGC"}

1949
node_modules/brotli-size/dist/tsconfig.tsbuildinfo generated vendored Normal file

File diff suppressed because it is too large Load Diff

76
node_modules/brotli-size/package.json generated vendored Normal file
View File

@@ -0,0 +1,76 @@
{
"_args": [
[
"brotli-size@4.0.0",
"J:\\Github\\CURD-TS"
]
],
"_development": true,
"_from": "brotli-size@4.0.0",
"_id": "brotli-size@4.0.0",
"_inBundle": false,
"_integrity": "sha1-oF7j+q08DnAKLy2oJrprTXbmnl4=",
"_location": "/brotli-size",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "brotli-size@4.0.0",
"name": "brotli-size",
"escapedName": "brotli-size",
"rawSpec": "4.0.0",
"saveSpec": null,
"fetchSpec": "4.0.0"
},
"_requiredBy": [
"/vite"
],
"_resolved": "http://192.168.250.101:4873/brotli-size/-/brotli-size-4.0.0.tgz",
"_spec": "4.0.0",
"_where": "J:\\Github\\CURD-TS",
"author": {
"name": "Erwin Mombay",
"email": "erwin.mombay@gmail.com"
},
"bugs": {
"url": "https://github.com/erwinmombay/brotli-size/issues"
},
"dependencies": {
"duplexer": "0.1.1"
},
"description": "Get the brotli compressed size of a string or buffer",
"devDependencies": {
"@types/node": "12.7.1",
"ava": "2.2.0",
"np": "5.0.3",
"typescript": "3.5.2"
},
"engines": {
"node": ">= 10.16.0"
},
"files": [
"dist"
],
"homepage": "https://github.com/erwinmombay/brotli-size#readme",
"keywords": [
"size",
"tool",
"brotli",
"compressed"
],
"license": "MIT",
"main": "dist/index.js",
"name": "brotli-size",
"repository": {
"type": "git",
"url": "git+https://github.com/erwinmombay/brotli-size.git"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"prepublishOnly": "npm run build",
"pretest": "npm run build",
"release": "np",
"test": "ava -v"
},
"version": "4.0.0"
}