yeet
This commit is contained in:
21
node_modules/load-bmfont/LICENSE.md
generated
vendored
Normal file
21
node_modules/load-bmfont/LICENSE.md
generated
vendored
Normal 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.
|
||||
|
59
node_modules/load-bmfont/README.md
generated
vendored
Normal file
59
node_modules/load-bmfont/README.md
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
# load-bmfont
|
||||
|
||||
[](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
|
||||
|
||||
[](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`
|
||||
- (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
97
node_modules/load-bmfont/browser.js
generated
vendored
Normal 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)
|
||||
}
|
53
node_modules/load-bmfont/index.js
generated
vendored
Normal file
53
node_modules/load-bmfont/index.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
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, handleData)
|
||||
} else {
|
||||
fs.readFile(file, opt, handleData)
|
||||
}
|
||||
}
|
84
node_modules/load-bmfont/json-spec.md
generated
vendored
Normal file
84
node_modules/load-bmfont/json-spec.md
generated
vendored
Normal 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
8
node_modules/load-bmfont/lib/is-binary.js
generated
vendored
Normal 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
1
node_modules/load-bmfont/node_modules/.bin/mime
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../mime/cli.js
|
0
node_modules/load-bmfont/node_modules/mime/.npmignore
generated
vendored
Normal file
0
node_modules/load-bmfont/node_modules/mime/.npmignore
generated
vendored
Normal file
164
node_modules/load-bmfont/node_modules/mime/CHANGELOG.md
generated
vendored
Normal file
164
node_modules/load-bmfont/node_modules/mime/CHANGELOG.md
generated
vendored
Normal 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
21
node_modules/load-bmfont/node_modules/mime/LICENSE
generated
vendored
Normal 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
90
node_modules/load-bmfont/node_modules/mime/README.md
generated
vendored
Normal 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
8
node_modules/load-bmfont/node_modules/mime/cli.js
generated
vendored
Executable 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
108
node_modules/load-bmfont/node_modules/mime/mime.js
generated
vendored
Normal 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;
|
44
node_modules/load-bmfont/node_modules/mime/package.json
generated
vendored
Normal file
44
node_modules/load-bmfont/node_modules/mime/package.json
generated
vendored
Normal 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
53
node_modules/load-bmfont/node_modules/mime/src/build.js
generated
vendored
Executable 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
60
node_modules/load-bmfont/node_modules/mime/src/test.js
generated
vendored
Normal 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');
|
1
node_modules/load-bmfont/node_modules/mime/types.json
generated
vendored
Normal file
1
node_modules/load-bmfont/node_modules/mime/types.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
55
node_modules/load-bmfont/package.json
generated
vendored
Normal file
55
node_modules/load-bmfont/package.json
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "load-bmfont",
|
||||
"version": "1.4.1",
|
||||
"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": "^2.9.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 | 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"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user