fix: 微信登录补充保存username和role
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Agent
2026-04-04 07:35:21 +00:00
parent 756444ef2b
commit d12eea7693
10597 changed files with 817047 additions and 3 deletions

21
node_modules/load-bmfont/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Jam3
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.

61
node_modules/load-bmfont/README.md generated vendored Normal file
View File

@@ -0,0 +1,61 @@
# load-bmfont
[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)
Loads an [AngelCode BMFont](http://www.angelcode.com/products/bmfont/) file in browser (with XHR) and node (with fs and [phin](https://github.com/ethanent/phin)), returning a [JSON representation](json-spec.md).
```js
var load = require("load-bmfont");
load("fonts/Arial-32.fnt", function (err, font) {
if (err) throw err;
//The BMFont spec in JSON form
console.log(font.common.lineHeight);
console.log(font.info);
console.log(font.chars);
console.log(font.kernings);
});
```
Currently supported BMFont formats:
- ASCII (text)
- JSON
- XML
- binary
## See Also
See [text-modules](https://github.com/mattdesl/text-modules) for related modules.
## Usage
[![NPM](https://nodei.co/npm/load-bmfont.png)](https://www.npmjs.com/package/load-bmfont)
#### `load(opt, cb)`
Loads a BMFont file with the `opt` settings and fires the callback with `(err, font)` params once finished. If `opt` is a string, it is used as the URI. Otherwise the options can be:
- `uri` or `url` the path (in Node) or URI
- `binary` boolean, whether the data should be read as binary, default false
- (in node) options for `fs.readFile` or [phin](https://www.npmjs.com/package/phin)
- (in browser) options for [xhr](https://github.com/Raynos/xhr)
To support binary files in the browser and Node, you should use `binary: true`. Otherwise the XHR request might come in the form of a UTF8 string, which will not work with binary files. This also sets up the XHR object to override mime type in older browsers.
```js
load(
{
uri: "fonts/Arial.bin",
binary: true,
},
function (err, font) {
console.log(font);
}
);
```
## License
MIT, see [LICENSE.md](http://github.com/Jam3/load-bmfont/blob/master/LICENSE.md) for details.

97
node_modules/load-bmfont/browser.js generated vendored Normal file
View File

@@ -0,0 +1,97 @@
var xhr = require('xhr')
var noop = function(){}
var parseASCII = require('parse-bmfont-ascii')
var parseXML = require('parse-bmfont-xml')
var readBinary = require('parse-bmfont-binary')
var isBinaryFormat = require('./lib/is-binary')
var xtend = require('xtend')
var xml2 = (function hasXML2() {
return self.XMLHttpRequest && "withCredentials" in new XMLHttpRequest
})()
module.exports = function(opt, cb) {
cb = typeof cb === 'function' ? cb : noop
if (typeof opt === 'string')
opt = { uri: opt }
else if (!opt)
opt = {}
var expectBinary = opt.binary
if (expectBinary)
opt = getBinaryOpts(opt)
xhr(opt, function(err, res, body) {
if (err)
return cb(err)
if (!/^2/.test(res.statusCode))
return cb(new Error('http status code: '+res.statusCode))
if (!body)
return cb(new Error('no body result'))
var binary = false
//if the response type is an array buffer,
//we need to convert it into a regular Buffer object
if (isArrayBuffer(body)) {
var array = new Uint8Array(body)
body = Buffer.from(array, 'binary')
}
//now check the string/Buffer response
//and see if it has a binary BMF header
if (isBinaryFormat(body)) {
binary = true
//if we have a string, turn it into a Buffer
if (typeof body === 'string')
body = Buffer.from(body, 'binary')
}
//we are not parsing a binary format, just ASCII/XML/etc
if (!binary) {
//might still be a buffer if responseType is 'arraybuffer'
if (Buffer.isBuffer(body))
body = body.toString(opt.encoding)
body = body.trim()
}
var result
try {
var type = res.headers['content-type']
if (binary)
result = readBinary(body)
else if (/json/.test(type) || body.charAt(0) === '{')
result = JSON.parse(body)
else if (/xml/.test(type) || body.charAt(0) === '<')
result = parseXML(body)
else
result = parseASCII(body)
} catch (e) {
cb(new Error('error parsing font '+e.message))
cb = noop
}
cb(null, result)
})
}
function isArrayBuffer(arr) {
var str = Object.prototype.toString
return str.call(arr) === '[object ArrayBuffer]'
}
function getBinaryOpts(opt) {
//IE10+ and other modern browsers support array buffers
if (xml2)
return xtend(opt, { responseType: 'arraybuffer' })
if (typeof self.XMLHttpRequest === 'undefined')
throw new Error('your browser does not support XHR loading')
//IE9 and XML1 browsers could still use an override
var req = new self.XMLHttpRequest()
req.overrideMimeType('text/plain; charset=x-user-defined')
return xtend({
xhr: req
}, opt)
}

57
node_modules/load-bmfont/index.js generated vendored Normal file
View File

@@ -0,0 +1,57 @@
var fs = require('fs')
var url = require('url')
var path = require('path')
var request = require('phin')
var parseASCII = require('parse-bmfont-ascii')
var parseXML = require('parse-bmfont-xml')
var readBinary = require('parse-bmfont-binary')
var mime = require('mime')
var noop = function() {}
var isBinary = require('./lib/is-binary')
function parseFont(file, data, cb) {
var result, binary
if (isBinary(data)) {
if (typeof data === 'string') data = Buffer.from(data, 'binary')
binary = true
} else data = data.toString().trim()
try {
if (binary) result = readBinary(data)
else if (/json/.test(mime.lookup(file)) || data.charAt(0) === '{')
result = JSON.parse(data)
else if (/xml/.test(mime.lookup(file)) || data.charAt(0) === '<')
result = parseXML(data)
else result = parseASCII(data)
} catch (e) {
cb(e)
cb = noop
}
cb(null, result)
}
module.exports = function loadFont(opt, cb) {
cb = typeof cb === 'function' ? cb : noop
if (typeof opt === 'string') opt = { uri: opt, url: opt }
else if (!opt) opt = {}
var file = opt.uri || opt.url
function handleData(err, data) {
if (err) return cb(err)
parseFont(file, data.body || data, cb)
}
if (url.parse(file).host) {
request(opt).then(function (res) {
handleData(null, res)
}).catch(function (err) {
handleData(err)
})
} else {
fs.readFile(file, opt, handleData)
}
}

84
node_modules/load-bmfont/json-spec.md generated vendored Normal file
View File

@@ -0,0 +1,84 @@
The spec for the JSON output is consistent with the rest of the [BMFont file spec](http://www.angelcode.com/products/bmfont/doc/file_format.html).
Here is what a typical output looks like, omitting the full list of glyphs/kernings for brevity.
```json
{
"pages": [
"sheet.png"
],
"chars": [
{
"id": 10,
"x": 281,
"y": 9,
"width": 0,
"height": 0,
"xoffset": 0,
"yoffset": 24,
"xadvance": 8,
"page": 0,
"chnl": 0
},
{
"id": 32,
"x": 0,
"y": 0,
"width": 0,
"height": 0,
"xoffset": 0,
"yoffset": 0,
"xadvance": 9,
"page": 0,
"chnl": 0
},
...
],
"kernings": [
{
"first": 34,
"second": 65,
"amount": -2
},
{
"first": 34,
"second": 67,
"amount": 1
},
...
],
"info": {
"face": "Nexa Light",
"size": 32,
"bold": 0,
"italic": 0,
"charset": "",
"unicode": 1,
"stretchH": 100,
"smooth": 1,
"aa": 2,
"padding": [
0,
0,
0,
0
],
"spacing": [
0,
0
]
},
"common": {
"lineHeight": 32,
"base": 24,
"scaleW": 1024,
"scaleH": 2048,
"pages": 1,
"packed": 0,
"alphaChnl": 0,
"redChnl": 0,
"greenChnl": 0,
"blueChnl": 0
}
}
```

8
node_modules/load-bmfont/lib/is-binary.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
var equal = require('buffer-equal')
var HEADER = Buffer.from([66, 77, 70, 3])
module.exports = function(buf) {
if (typeof buf === 'string')
return buf.substring(0, 3) === 'BMF'
return buf.length > 4 && equal(buf.slice(0, 4), HEADER)
}

1
node_modules/load-bmfont/node_modules/.bin/mime generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../mime/cli.js

View File

164
node_modules/load-bmfont/node_modules/mime/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,164 @@
# Changelog
## v1.6.0 (24/11/2017)
*No changelog for this release.*
---
## v2.0.4 (24/11/2017)
- [**closed**] Switch to mime-score module for resolving extension contention issues. [#182](https://github.com/broofa/node-mime/issues/182)
- [**closed**] Update mime-db to 1.31.0 in v1.x branch [#181](https://github.com/broofa/node-mime/issues/181)
---
## v1.5.0 (22/11/2017)
- [**closed**] need ES5 version ready in npm package [#179](https://github.com/broofa/node-mime/issues/179)
- [**closed**] mime-db no trace of iWork - pages / numbers / etc. [#178](https://github.com/broofa/node-mime/issues/178)
- [**closed**] How it works in brownser ? [#176](https://github.com/broofa/node-mime/issues/176)
- [**closed**] Missing `./Mime` [#175](https://github.com/broofa/node-mime/issues/175)
- [**closed**] Vulnerable Regular Expression [#167](https://github.com/broofa/node-mime/issues/167)
---
## v2.0.3 (25/09/2017)
*No changelog for this release.*
---
## v1.4.1 (25/09/2017)
- [**closed**] Issue when bundling with webpack [#172](https://github.com/broofa/node-mime/issues/172)
---
## v2.0.2 (15/09/2017)
- [**V2**] fs.readFileSync is not a function [#165](https://github.com/broofa/node-mime/issues/165)
- [**closed**] The extension for video/quicktime should map to .mov, not .qt [#164](https://github.com/broofa/node-mime/issues/164)
- [**V2**] [v2 Feedback request] Mime class API [#163](https://github.com/broofa/node-mime/issues/163)
- [**V2**] [v2 Feedback request] Resolving conflicts over extensions [#162](https://github.com/broofa/node-mime/issues/162)
- [**V2**] Allow callers to load module with official, full, or no defined types. [#161](https://github.com/broofa/node-mime/issues/161)
- [**V2**] Use "facets" to resolve extension conflicts [#160](https://github.com/broofa/node-mime/issues/160)
- [**V2**] Remove fs and path dependencies [#152](https://github.com/broofa/node-mime/issues/152)
- [**V2**] Default content-type should not be application/octet-stream [#139](https://github.com/broofa/node-mime/issues/139)
- [**V2**] reset mime-types [#124](https://github.com/broofa/node-mime/issues/124)
- [**V2**] Extensionless paths should return null or false [#113](https://github.com/broofa/node-mime/issues/113)
---
## v2.0.1 (14/09/2017)
- [**closed**] Changelog for v2.0 does not mention breaking changes [#171](https://github.com/broofa/node-mime/issues/171)
- [**closed**] MIME breaking with 'class' declaration as it is without 'use strict mode' [#170](https://github.com/broofa/node-mime/issues/170)
---
## v2.0.0 (12/09/2017)
- [**closed**] woff and woff2 [#168](https://github.com/broofa/node-mime/issues/168)
---
## v1.4.0 (28/08/2017)
- [**closed**] support for ac3 voc files [#159](https://github.com/broofa/node-mime/issues/159)
- [**closed**] Help understanding change from application/xml to text/xml [#158](https://github.com/broofa/node-mime/issues/158)
- [**closed**] no longer able to override mimetype [#157](https://github.com/broofa/node-mime/issues/157)
- [**closed**] application/vnd.adobe.photoshop [#147](https://github.com/broofa/node-mime/issues/147)
- [**closed**] Directories should appear as something other than application/octet-stream [#135](https://github.com/broofa/node-mime/issues/135)
- [**closed**] requested features [#131](https://github.com/broofa/node-mime/issues/131)
- [**closed**] Make types.json loading optional? [#129](https://github.com/broofa/node-mime/issues/129)
- [**closed**] Cannot find module './types.json' [#120](https://github.com/broofa/node-mime/issues/120)
- [**V2**] .wav files show up as "audio/x-wav" instead of "audio/x-wave" [#118](https://github.com/broofa/node-mime/issues/118)
- [**closed**] Don't be a pain in the ass for node community [#108](https://github.com/broofa/node-mime/issues/108)
- [**closed**] don't make default_type global [#78](https://github.com/broofa/node-mime/issues/78)
- [**closed**] mime.extension() fails if the content-type is parameterized [#74](https://github.com/broofa/node-mime/issues/74)
---
## v1.3.6 (11/05/2017)
- [**closed**] .md should be text/markdown as of March 2016 [#154](https://github.com/broofa/node-mime/issues/154)
- [**closed**] Error while installing mime [#153](https://github.com/broofa/node-mime/issues/153)
- [**closed**] application/manifest+json [#149](https://github.com/broofa/node-mime/issues/149)
- [**closed**] Dynamic adaptive streaming over HTTP (DASH) file extension typo [#141](https://github.com/broofa/node-mime/issues/141)
- [**closed**] charsets image/png undefined [#140](https://github.com/broofa/node-mime/issues/140)
- [**closed**] Mime-db dependency out of date [#130](https://github.com/broofa/node-mime/issues/130)
- [**closed**] how to support plist [#126](https://github.com/broofa/node-mime/issues/126)
- [**closed**] how does .types file format look like? [#123](https://github.com/broofa/node-mime/issues/123)
- [**closed**] Feature: support for expanding MIME patterns [#121](https://github.com/broofa/node-mime/issues/121)
- [**closed**] DEBUG_MIME doesn't work [#117](https://github.com/broofa/node-mime/issues/117)
---
## v1.3.4 (06/02/2015)
*No changelog for this release.*
---
## v1.3.3 (06/02/2015)
*No changelog for this release.*
---
## v1.3.1 (05/02/2015)
- [**closed**] Consider adding support for Handlebars .hbs file ending [#111](https://github.com/broofa/node-mime/issues/111)
- [**closed**] Consider adding support for hjson. [#110](https://github.com/broofa/node-mime/issues/110)
- [**closed**] Add mime type for Opus audio files [#94](https://github.com/broofa/node-mime/issues/94)
- [**closed**] Consider making the `Requesting New Types` information more visible [#77](https://github.com/broofa/node-mime/issues/77)
---
## v1.3.0 (05/02/2015)
- [**closed**] Add common name? [#114](https://github.com/broofa/node-mime/issues/114)
- [**closed**] application/x-yaml [#104](https://github.com/broofa/node-mime/issues/104)
- [**closed**] Add mime type for WOFF file format 2.0 [#102](https://github.com/broofa/node-mime/issues/102)
- [**closed**] application/x-msi for .msi [#99](https://github.com/broofa/node-mime/issues/99)
- [**closed**] Add mimetype for gettext translation files [#98](https://github.com/broofa/node-mime/issues/98)
- [**closed**] collaborators [#88](https://github.com/broofa/node-mime/issues/88)
- [**closed**] getting errot in installation of mime module...any1 can help? [#87](https://github.com/broofa/node-mime/issues/87)
- [**closed**] should application/json's charset be utf8? [#86](https://github.com/broofa/node-mime/issues/86)
- [**closed**] Add "license" and "licenses" to package.json [#81](https://github.com/broofa/node-mime/issues/81)
- [**closed**] lookup with extension-less file on Windows returns wrong type [#68](https://github.com/broofa/node-mime/issues/68)
---
## v1.2.11 (15/08/2013)
- [**closed**] Update mime.types [#65](https://github.com/broofa/node-mime/issues/65)
- [**closed**] Publish a new version [#63](https://github.com/broofa/node-mime/issues/63)
- [**closed**] README should state upfront that "application/octet-stream" is default for unknown extension [#55](https://github.com/broofa/node-mime/issues/55)
- [**closed**] Suggested improvement to the charset API [#52](https://github.com/broofa/node-mime/issues/52)
---
## v1.2.10 (25/07/2013)
- [**closed**] Mime type for woff files should be application/font-woff and not application/x-font-woff [#62](https://github.com/broofa/node-mime/issues/62)
- [**closed**] node.types in conflict with mime.types [#51](https://github.com/broofa/node-mime/issues/51)
---
## v1.2.9 (17/01/2013)
- [**closed**] Please update "mime" NPM [#49](https://github.com/broofa/node-mime/issues/49)
- [**closed**] Please add semicolon [#46](https://github.com/broofa/node-mime/issues/46)
- [**closed**] parse full mime types [#43](https://github.com/broofa/node-mime/issues/43)
---
## v1.2.8 (10/01/2013)
- [**closed**] /js directory mime is application/javascript. Is it correct? [#47](https://github.com/broofa/node-mime/issues/47)
- [**closed**] Add mime types for lua code. [#45](https://github.com/broofa/node-mime/issues/45)
---
## v1.2.7 (19/10/2012)
- [**closed**] cannot install 1.2.7 via npm [#41](https://github.com/broofa/node-mime/issues/41)
- [**closed**] Transfer ownership to @broofa [#36](https://github.com/broofa/node-mime/issues/36)
- [**closed**] it's wrong to set charset to UTF-8 for text [#30](https://github.com/broofa/node-mime/issues/30)
- [**closed**] Allow multiple instances of MIME types container [#27](https://github.com/broofa/node-mime/issues/27)
---
## v1.2.5 (16/02/2012)
- [**closed**] When looking up a types, check hasOwnProperty [#23](https://github.com/broofa/node-mime/issues/23)
- [**closed**] Bump version to 1.2.2 [#18](https://github.com/broofa/node-mime/issues/18)
- [**closed**] No license [#16](https://github.com/broofa/node-mime/issues/16)
- [**closed**] Some types missing that are used by html5/css3 [#13](https://github.com/broofa/node-mime/issues/13)
- [**closed**] npm install fails for 1.2.1 [#12](https://github.com/broofa/node-mime/issues/12)
- [**closed**] image/pjpeg + image/x-png [#10](https://github.com/broofa/node-mime/issues/10)
- [**closed**] symlink [#8](https://github.com/broofa/node-mime/issues/8)
- [**closed**] gzip [#2](https://github.com/broofa/node-mime/issues/2)
- [**closed**] ALL CAPS filenames return incorrect mime type [#1](https://github.com/broofa/node-mime/issues/1)

21
node_modules/load-bmfont/node_modules/mime/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2010 Benjamin Thomas, Robert Kieffer
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.

90
node_modules/load-bmfont/node_modules/mime/README.md generated vendored Normal file
View File

@@ -0,0 +1,90 @@
# mime
Comprehensive MIME type mapping API based on mime-db module.
## Install
Install with [npm](http://github.com/isaacs/npm):
npm install mime
## Contributing / Testing
npm run test
## Command Line
mime [path_string]
E.g.
> mime scripts/jquery.js
application/javascript
## API - Queries
### mime.lookup(path)
Get the mime type associated with a file, if no mime type is found `application/octet-stream` is returned. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g.
```js
var mime = require('mime');
mime.lookup('/path/to/file.txt'); // => 'text/plain'
mime.lookup('file.txt'); // => 'text/plain'
mime.lookup('.TXT'); // => 'text/plain'
mime.lookup('htm'); // => 'text/html'
```
### mime.default_type
Sets the mime type returned when `mime.lookup` fails to find the extension searched for. (Default is `application/octet-stream`.)
### mime.extension(type)
Get the default extension for `type`
```js
mime.extension('text/html'); // => 'html'
mime.extension('application/octet-stream'); // => 'bin'
```
### mime.charsets.lookup()
Map mime-type to charset
```js
mime.charsets.lookup('text/plain'); // => 'UTF-8'
```
(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)
## API - Defining Custom Types
Custom type mappings can be added on a per-project basis via the following APIs.
### mime.define()
Add custom mime/extension mappings
```js
mime.define({
'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],
'application/x-my-type': ['x-mt', 'x-mtt'],
// etc ...
});
mime.lookup('x-sft'); // => 'text/x-some-format'
```
The first entry in the extensions array is returned by `mime.extension()`. E.g.
```js
mime.extension('text/x-some-format'); // => 'x-sf'
```
### mime.load(filepath)
Load mappings from an Apache ".types" format file
```js
mime.load('./my_project.types');
```
The .types file format is simple - See the `types` dir for examples.

8
node_modules/load-bmfont/node_modules/mime/cli.js generated vendored Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env node
var mime = require('./mime.js');
var file = process.argv[2];
var type = mime.lookup(file);
process.stdout.write(type + '\n');

108
node_modules/load-bmfont/node_modules/mime/mime.js generated vendored Normal file
View File

@@ -0,0 +1,108 @@
var path = require('path');
var fs = require('fs');
function Mime() {
// Map of extension -> mime type
this.types = Object.create(null);
// Map of mime type -> extension
this.extensions = Object.create(null);
}
/**
* Define mimetype -> extension mappings. Each key is a mime-type that maps
* to an array of extensions associated with the type. The first extension is
* used as the default extension for the type.
*
* e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
*
* @param map (Object) type definitions
*/
Mime.prototype.define = function (map) {
for (var type in map) {
var exts = map[type];
for (var i = 0; i < exts.length; i++) {
if (process.env.DEBUG_MIME && this.types[exts[i]]) {
console.warn((this._loading || "define()").replace(/.*\//, ''), 'changes "' + exts[i] + '" extension type from ' +
this.types[exts[i]] + ' to ' + type);
}
this.types[exts[i]] = type;
}
// Default extension is the first one we encounter
if (!this.extensions[type]) {
this.extensions[type] = exts[0];
}
}
};
/**
* Load an Apache2-style ".types" file
*
* This may be called multiple times (it's expected). Where files declare
* overlapping types/extensions, the last file wins.
*
* @param file (String) path of file to load.
*/
Mime.prototype.load = function(file) {
this._loading = file;
// Read file and split into lines
var map = {},
content = fs.readFileSync(file, 'ascii'),
lines = content.split(/[\r\n]+/);
lines.forEach(function(line) {
// Clean up whitespace/comments, and split into fields
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/);
map[fields.shift()] = fields;
});
this.define(map);
this._loading = null;
};
/**
* Lookup a mime type based on extension
*/
Mime.prototype.lookup = function(path, fallback) {
var ext = path.replace(/^.*[\.\/\\]/, '').toLowerCase();
return this.types[ext] || fallback || this.default_type;
};
/**
* Return file extension associated with a mime type
*/
Mime.prototype.extension = function(mimeType) {
var type = mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase();
return this.extensions[type];
};
// Default instance
var mime = new Mime();
// Define built-in types
mime.define(require('./types.json'));
// Default type
mime.default_type = mime.lookup('bin');
//
// Additional API specific to the default instance
//
mime.Mime = Mime;
/**
* Lookup a charset based on mime type.
*/
mime.charsets = {
lookup: function(mimeType, fallback) {
// Assume text types are utf8
return (/^text\/|^application\/(javascript|json)/).test(mimeType) ? 'UTF-8' : fallback;
}
};
module.exports = mime;

View File

@@ -0,0 +1,44 @@
{
"author": {
"name": "Robert Kieffer",
"url": "http://github.com/broofa",
"email": "robert@broofa.com"
},
"bin": {
"mime": "cli.js"
},
"engines": {
"node": ">=4"
},
"contributors": [
{
"name": "Benjamin Thomas",
"url": "http://github.com/bentomas",
"email": "benjamin@benjaminthomas.org"
}
],
"description": "A comprehensive library for mime-type mapping",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"github-release-notes": "0.13.1",
"mime-db": "1.31.0",
"mime-score": "1.1.0"
},
"scripts": {
"prepare": "node src/build.js",
"changelog": "gren changelog --tags=all --generate --override",
"test": "node src/test.js"
},
"keywords": [
"util",
"mime"
],
"main": "mime.js",
"name": "mime",
"repository": {
"url": "https://github.com/broofa/node-mime",
"type": "git"
},
"version": "1.6.0"
}

53
node_modules/load-bmfont/node_modules/mime/src/build.js generated vendored Executable file
View File

@@ -0,0 +1,53 @@
#!/usr/bin/env node
'use strict';
const fs = require('fs');
const path = require('path');
const mimeScore = require('mime-score');
let db = require('mime-db');
let chalk = require('chalk');
const STANDARD_FACET_SCORE = 900;
const byExtension = {};
// Clear out any conflict extensions in mime-db
for (let type in db) {
let entry = db[type];
entry.type = type;
if (!entry.extensions) continue;
entry.extensions.forEach(ext => {
if (ext in byExtension) {
const e0 = entry;
const e1 = byExtension[ext];
e0.pri = mimeScore(e0.type, e0.source);
e1.pri = mimeScore(e1.type, e1.source);
let drop = e0.pri < e1.pri ? e0 : e1;
let keep = e0.pri >= e1.pri ? e0 : e1;
drop.extensions = drop.extensions.filter(e => e !== ext);
console.log(`${ext}: Keeping ${chalk.green(keep.type)} (${keep.pri}), dropping ${chalk.red(drop.type)} (${drop.pri})`);
}
byExtension[ext] = entry;
});
}
function writeTypesFile(types, path) {
fs.writeFileSync(path, JSON.stringify(types));
}
// Segregate into standard and non-standard types based on facet per
// https://tools.ietf.org/html/rfc6838#section-3.1
const types = {};
Object.keys(db).sort().forEach(k => {
const entry = db[k];
types[entry.type] = entry.extensions;
});
writeTypesFile(types, path.join(__dirname, '..', 'types.json'));

60
node_modules/load-bmfont/node_modules/mime/src/test.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
/**
* Usage: node test.js
*/
var mime = require('../mime');
var assert = require('assert');
var path = require('path');
//
// Test mime lookups
//
assert.equal('text/plain', mime.lookup('text.txt')); // normal file
assert.equal('text/plain', mime.lookup('TEXT.TXT')); // uppercase
assert.equal('text/plain', mime.lookup('dir/text.txt')); // dir + file
assert.equal('text/plain', mime.lookup('.text.txt')); // hidden file
assert.equal('text/plain', mime.lookup('.txt')); // nameless
assert.equal('text/plain', mime.lookup('txt')); // extension-only
assert.equal('text/plain', mime.lookup('/txt')); // extension-less ()
assert.equal('text/plain', mime.lookup('\\txt')); // Windows, extension-less
assert.equal('application/octet-stream', mime.lookup('text.nope')); // unrecognized
assert.equal('fallback', mime.lookup('text.fallback', 'fallback')); // alternate default
//
// Test extensions
//
assert.equal('txt', mime.extension(mime.types.text));
assert.equal('html', mime.extension(mime.types.htm));
assert.equal('bin', mime.extension('application/octet-stream'));
assert.equal('bin', mime.extension('application/octet-stream '));
assert.equal('html', mime.extension(' text/html; charset=UTF-8'));
assert.equal('html', mime.extension('text/html; charset=UTF-8 '));
assert.equal('html', mime.extension('text/html; charset=UTF-8'));
assert.equal('html', mime.extension('text/html ; charset=UTF-8'));
assert.equal('html', mime.extension('text/html;charset=UTF-8'));
assert.equal('html', mime.extension('text/Html;charset=UTF-8'));
assert.equal(undefined, mime.extension('unrecognized'));
//
// Test node.types lookups
//
assert.equal('font/woff', mime.lookup('file.woff'));
assert.equal('application/octet-stream', mime.lookup('file.buffer'));
// TODO: Uncomment once #157 is resolved
// assert.equal('audio/mp4', mime.lookup('file.m4a'));
assert.equal('font/otf', mime.lookup('file.otf'));
//
// Test charsets
//
assert.equal('UTF-8', mime.charsets.lookup('text/plain'));
assert.equal('UTF-8', mime.charsets.lookup(mime.types.js));
assert.equal('UTF-8', mime.charsets.lookup(mime.types.json));
assert.equal(undefined, mime.charsets.lookup(mime.types.bin));
assert.equal('fallback', mime.charsets.lookup('application/octet-stream', 'fallback'));
console.log('\nAll tests passed');

File diff suppressed because one or more lines are too long

21
node_modules/load-bmfont/node_modules/phin/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Ethan Davis
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.

129
node_modules/load-bmfont/node_modules/phin/README.md generated vendored Normal file
View File

@@ -0,0 +1,129 @@
<p align="center" style="text-align: center"><img src="https://raw.githubusercontent.com/ethanent/phin/master/media/phin-textIncluded.png" width="250" alt="phin logo"/></p>
---
> The lightweight Node.js HTTP client
[Full documentation](https://ethanent.github.io/phin/global.html) | [GitHub](https://github.com/ethanent/phin) | [NPM](https://www.npmjs.com/package/phin)
## Deprecated
This package is deprecated and should not be used. Please see [#91](https://github.com/ethanent/phin/issues/91) for more information.
## Simple Usage
```javascript
const p = require('phin')
const res = await p('https://ethanent.me')
console.log(res.body)
```
Note that the above should be in an async context! Phin also provides an unpromisified version of the library.
## Install
```
npm install phin
```
## Why Phin?
Phin is relied upon by important projects and large companies. The hundreds of contributors at [Less](https://github.com/less/less.js), for example, depend on Phin as part of their development process.
Also, Phin is very lightweight. To compare to other libraries, see [Phin vs. the Competition](https://github.com/ethanent/phin/blob/master/README.md#phin-vs-the-competition).
## Quick Demos
Simple POST:
```js
await p({
url: 'https://ethanent.me',
method: 'POST',
data: {
hey: 'hi'
}
})
```
### Unpromisified Usage
```js
const p = require('phin').unpromisified
p('https://ethanent.me', (err, res) => {
if (!err) console.log(res.body)
})
```
Simple parsing of JSON:
```js
// (In async function in this case.)
const res = await p({
'url': 'https://ethanent.me/name',
'parse': 'json'
})
console.log(res.body.first)
```
### Default Options
```js
const ppostjson = p.defaults({
'method': 'POST',
'parse': 'json',
'timeout': 2000
})
// In async function...
const res = await ppostjson('https://ethanent.me/somejson')
// ^ An options object could also be used here to set other options.
// Do things with res.body?
```
### Custom Core HTTP Options
Phin allows you to set [core HTTP options](https://nodejs.org/api/http.html#http_http_request_url_options_callback).
```js
await p({
'url': 'https://ethanent.me/name',
'core': {
'agent': myAgent // Assuming you'd already created myAgent earlier.
}
})
```
## Full Documentation
There's a lot more which can be done with the Phin library.
See [the Phin documentation](https://ethanent.github.io/phin/global.html).
## Phin vs. the Competition
Phin is a very lightweight library, yet it contains all of the common HTTP client features included in competing libraries!
Here's a size comparison table:
Package | Size
--- | ---
request | [![request package size](https://packagephobia.now.sh/badge?p=request)](https://packagephobia.now.sh/result?p=request)
superagent | [![superagent package size](https://packagephobia.now.sh/badge?p=superagent)](https://packagephobia.now.sh/result?p=superagent)
got | [![got package size](https://packagephobia.now.sh/badge?p=got)](https://packagephobia.now.sh/result?p=got)
axios | [![axios package size](https://packagephobia.now.sh/badge?p=axios)](https://packagephobia.now.sh/result?p=axios)
isomorphic-fetch | [![isomorphic-fetch package size](https://packagephobia.now.sh/badge?p=isomorphic-fetch)](https://packagephobia.now.sh/result?p=isomorphic-fetch)
r2 | [![r2 package size](https://packagephobia.now.sh/badge?p=r2)](https://packagephobia.now.sh/result?p=r2)
node-fetch | [![node-fetch package size](https://packagephobia.now.sh/badge?p=node-fetch)](https://packagephobia.now.sh/result?p=node-fetch)
phin | [![phin package size](https://packagephobia.now.sh/badge?p=phin)](https://packagephobia.now.sh/result?p=phin)

121
node_modules/load-bmfont/node_modules/phin/lib/phin.js generated vendored Normal file
View File

@@ -0,0 +1,121 @@
const {URL} = require('url')
const centra = require('centra')
const unspecifiedFollowRedirectsDefault = 20
/**
* phin options object. phin also supports all options from <a href="https://nodejs.org/api/http.html#http_http_request_options_callback">http.request(options, callback)</a> by passing them on to this method (or similar).
* @typedef {Object} phinOptions
* @property {string} url - URL to request (autodetect infers from this URL)
* @property {string} [method=GET] - Request method ('GET', 'POST', etc.)
* @property {string|Buffer|object} [data] - Data to send as request body (phin may attempt to convert this data to a string if it isn't already)
* @property {Object} [form] - Object to send as form data (sets 'Content-Type' and 'Content-Length' headers, as well as request body) (overwrites 'data' option if present)
* @property {Object} [headers={}] - Request headers
* @property {Object} [core={}] - Custom core HTTP options
* @property {string} [parse=none] - Response parsing. Errors will be given if the response can't be parsed. 'none' returns body as a `Buffer`, 'json' attempts to parse the body as JSON, and 'string' attempts to parse the body as a string
* @property {boolean} [followRedirects=false] - Enable HTTP redirect following
* @property {boolean} [stream=false] - Enable streaming of response. (Removes body property)
* @property {boolean} [compression=false] - Enable compression for request
* @property {?number} [timeout=null] - Request timeout in milliseconds
* @property {string} [hostname=autodetect] - URL hostname
* @property {Number} [port=autodetect] - URL port
* @property {string} [path=autodetect] - URL path
*/
/**
* Response data
* @callback phinResponseCallback
* @param {?(Error|string)} error - Error if any occurred in request, otherwise null.
* @param {?http.serverResponse} phinResponse - phin response object. Like <a href='https://nodejs.org/api/http.html#http_class_http_serverresponse'>http.ServerResponse</a> but has a body property containing response body, unless stream. If stream option is enabled, a stream property will be provided to callback with a readable stream.
*/
/**
* Sends an HTTP request
* @param {phinOptions|string} options - phin options object (or string for auto-detection)
* @returns {Promise<http.serverResponse>} - phin-adapted response object
*/
const phin = async (opts) => {
if (typeof(opts) !== 'string') {
if (!opts.hasOwnProperty('url')) {
throw new Error('Missing url option from options for request method.')
}
}
const req = centra(typeof opts === 'object' ? opts.url : opts, opts.method || 'GET')
if (opts.headers) req.header(opts.headers)
if (opts.stream) req.stream()
if (opts.timeout) req.timeout(opts.timeout)
if (opts.data) req.body(opts.data)
if (opts.form) req.body(opts.form, 'form')
if (opts.compression) req.compress()
if (opts.followRedirects) {
if (opts.followRedirects === true) {
req.followRedirects(unspecifiedFollowRedirectsDefault)
} else if (typeof opts.followRedirects === 'number') {
req.followRedirects(opts.followRedirects)
}
}
if (typeof opts.core === 'object') {
Object.keys(opts.core).forEach((optName) => {
req.option(optName, opts.core[optName])
})
}
const res = await req.send()
if (opts.stream) {
res.stream = res
return res
}
else {
res.coreRes.body = res.body
if (opts.parse) {
if (opts.parse === 'json') {
res.coreRes.body = await res.json()
return res.coreRes
}
else if (opts.parse === 'string') {
res.coreRes.body = res.coreRes.body.toString()
return res.coreRes
}
}
return res.coreRes
}
}
// If we're running Node.js 8+, let's promisify it
phin.promisified = phin
phin.unpromisified = (opts, cb) => {
phin(opts).then((data) => {
if (cb) cb(null, data)
}).catch((err) => {
if (cb) cb(err, null)
})
}
// Defaults
phin.defaults = (defaultOpts) => async (opts) => {
const nops = typeof opts === 'string' ? {'url': opts} : opts
Object.keys(defaultOpts).forEach((doK) => {
if (!nops.hasOwnProperty(doK) || nops[doK] === null) {
nops[doK] = defaultOpts[doK]
}
})
return await phin(nops)
}
module.exports = phin

View File

@@ -0,0 +1,40 @@
{
"name": "phin",
"version": "3.7.1",
"description": "The ultra-lightweight Node.js HTTP client",
"main": "lib/phin.js",
"types": "types.d.ts",
"scripts": {
"test": "node ./tests/test.js",
"prepublishOnly": "npm test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ethanent/phin.git"
},
"keywords": [
"http",
"https",
"request",
"fetch",
"ajax",
"url",
"uri"
],
"author": "Ethan Davis",
"license": "MIT",
"bugs": {
"url": "https://github.com/ethanent/phin/issues"
},
"homepage": "https://github.com/ethanent/phin",
"files": [
"lib/phin.js",
"types.d.ts"
],
"engines": {
"node": ">= 8"
},
"dependencies": {
"centra": "^2.7.0"
}
}

122
node_modules/load-bmfont/node_modules/phin/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,122 @@
// Default Options feature is not supported because it's basically impossible to write strongly-typed definitions for it.
import * as http from 'http'
import { URL } from 'url';
interface IOptionsBase {
url: string | URL
method?: string
headers?: object
core?: http.ClientRequestArgs
followRedirects?: boolean
stream?: boolean
compression?: boolean
timeout?: number
hostname?: string
port?: number
path?: string
}
declare function phin<T>(options:
phin.IJSONResponseOptions |
phin.IWithData<phin.IJSONResponseOptions> |
phin.IWithForm<phin.IJSONResponseOptions>): Promise<phin.IJSONResponse<T>>
declare function phin(options:
phin.IStringResponseOptions |
phin.IWithData<phin.IStringResponseOptions> |
phin.IWithForm<phin.IStringResponseOptions>): Promise<phin.IStringResponse>
declare function phin(options:
phin.IStreamResponseOptions |
phin.IWithData<phin.IStreamResponseOptions> |
phin.IWithForm<phin.IStreamResponseOptions>): Promise<phin.IStreamResponse>
declare function phin(options:
phin.IOptions |
phin.IWithData<phin.IOptions> |
phin.IWithForm<phin.IOptions> |
string): Promise<phin.IResponse>
declare namespace phin {
// Form and data property has been written this way so they're mutually exclusive.
export type IWithData<T extends IOptionsBase> = T & {
data: string | Buffer | object;
}
export type IWithForm<T extends IOptionsBase> = T & {
form: {
[index: string]: string
}
}
export interface IJSONResponseOptions extends IOptionsBase {
parse: 'json'
}
export interface IStringResponseOptions extends IOptionsBase {
parse: 'string';
}
export interface IStreamResponseOptions extends IOptionsBase {
stream: true
}
export interface IOptions extends IOptionsBase {
parse?: 'none'
}
export interface IJSONResponse<T> extends http.IncomingMessage {
body: T
}
export interface IStringResponse extends http.IncomingMessage {
body: string;
}
export interface IStreamResponse extends http.IncomingMessage {
stream: http.IncomingMessage
}
export interface IResponse extends http.IncomingMessage {
body: Buffer;
}
// NOTE: Typescript cannot infer type of union callback on the consumer side
// https://github.com/Microsoft/TypeScript/pull/17819#issuecomment-363636904
type IErrorCallback = (error: Error | string, response: null) => void
type ICallback<T> = (error: null, response: NonNullable<T>) => void
export let promisified: typeof phin
export function unpromisified<T>(
options:
IJSONResponseOptions |
IWithData<IJSONResponseOptions> |
IWithForm<IJSONResponseOptions>,
callback: IErrorCallback | ICallback<IJSONResponse<T>>): void
export function unpromisified(
options:
IStringResponseOptions |
IWithData<IStringResponseOptions> |
IWithForm<IStringResponseOptions>,
callback: IErrorCallback | ICallback<IStringResponse>): void
export function unpromisified(
options:
IStreamResponseOptions |
IWithData<IStreamResponseOptions> |
IWithForm<IStreamResponseOptions>,
callback: IErrorCallback | ICallback<IStreamResponse>): void
export function unpromisified(
options:
IOptions |
IWithData<IOptions> |
IWithForm<IOptions> |
string,
callback: IErrorCallback | ICallback<IResponse>): void
}
export = phin

55
node_modules/load-bmfont/package.json generated vendored Normal file
View File

@@ -0,0 +1,55 @@
{
"name": "load-bmfont",
"version": "1.4.2",
"description": "loads a BMFont file in Node and the browser",
"main": "index.js",
"browser": "browser.js",
"license": "MIT",
"author": {
"name": "Matt DesLauriers",
"email": "dave.des@gmail.com",
"url": "https://github.com/mattdesl"
},
"dependencies": {
"buffer-equal": "0.0.1",
"mime": "^1.3.4",
"parse-bmfont-ascii": "^1.0.3",
"parse-bmfont-binary": "^1.0.5",
"parse-bmfont-xml": "^1.1.4",
"phin": "^3.7.1",
"xhr": "^2.0.1",
"xtend": "^4.0.0"
},
"devDependencies": {
"browserify": "^9.0.3",
"tap-spec": "^2.2.2",
"tape": "^3.5.0",
"testling": "^1.7.1"
},
"scripts": {
"test-node": "(node test.js; node test-server.js) | tap-spec",
"test-browser": "browserify test.js | testling | tap-spec",
"test": "npm run test-node && npm run test-browser"
},
"keywords": [
"bmfont",
"bitmap",
"font",
"angel",
"code",
"angelcode",
"parse",
"ascii",
"xml",
"text",
"json"
],
"repository": {
"type": "git",
"url": "git://github.com/Jam3/load-bmfont.git"
},
"homepage": "https://github.com/Jam3/load-bmfont",
"bugs": {
"url": "https://github.com/Jam3/load-bmfont/issues"
}
}

26
node_modules/load-bmfont/test-server.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
var test = require('tape')
var load = require('./')
var expectedArial = require('./fnt/Arial.json')
var fs = require('fs')
var http = require('http')
var arialBin = fs.readFileSync('fnt/Arial.bin')
test('should load from server URL', function (t) {
t.plan(1)
const server = http.createServer((req,res) => {
res.end(arialBin)
})
server.listen(8003, () => {
load({
url: 'http://localhost:8003',
binary: true
}, (err, res) => {
if (err) t.fail(err)
else t.deepEqual(res, expectedArial)
server.close()
})
})
})