diff options
Diffstat (limited to 'node_modules/iconv-lite')
-rw-r--r-- | node_modules/iconv-lite/.npmignore | 6 | ||||
-rw-r--r-- | node_modules/iconv-lite/.travis.yml | 23 | ||||
-rw-r--r-- | node_modules/iconv-lite/Changelog.md | 28 | ||||
-rw-r--r-- | node_modules/iconv-lite/README.md | 6 | ||||
-rw-r--r-- | node_modules/iconv-lite/encodings/dbcs-codec.js | 12 | ||||
-rw-r--r-- | node_modules/iconv-lite/encodings/internal.js | 12 | ||||
-rw-r--r-- | node_modules/iconv-lite/encodings/sbcs-codec.js | 11 | ||||
-rw-r--r-- | node_modules/iconv-lite/encodings/sbcs-data.js | 5 | ||||
-rw-r--r-- | node_modules/iconv-lite/encodings/utf16.js | 6 | ||||
-rw-r--r-- | node_modules/iconv-lite/encodings/utf7.js | 22 | ||||
-rw-r--r-- | node_modules/iconv-lite/lib/extend-node.js | 4 | ||||
-rw-r--r-- | node_modules/iconv-lite/lib/index.d.ts | 4 | ||||
-rw-r--r-- | node_modules/iconv-lite/lib/index.js | 11 | ||||
-rw-r--r-- | node_modules/iconv-lite/package.json | 27 |
14 files changed, 86 insertions, 91 deletions
diff --git a/node_modules/iconv-lite/.npmignore b/node_modules/iconv-lite/.npmignore deleted file mode 100644 index 5cd2673c9..000000000 --- a/node_modules/iconv-lite/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -*~ -*sublime-* -generation -test -wiki -coverage diff --git a/node_modules/iconv-lite/.travis.yml b/node_modules/iconv-lite/.travis.yml deleted file mode 100644 index 3eab7fdb3..000000000 --- a/node_modules/iconv-lite/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ - sudo: false - language: node_js - node_js: - - "0.10" - - "0.11" - - "0.12" - - "iojs" - - "4" - - "6" - - "8" - - "node" - - - env: - - CXX=g++-4.8 - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - gcc-4.8 - - g++-4.8 - diff --git a/node_modules/iconv-lite/Changelog.md b/node_modules/iconv-lite/Changelog.md index 64aae34b1..f252313f8 100644 --- a/node_modules/iconv-lite/Changelog.md +++ b/node_modules/iconv-lite/Changelog.md @@ -1,3 +1,31 @@ +# 0.4.24 / 2018-08-22 + + * Added MIK encoding (#196, by @Ivan-Kalatchev) + + +# 0.4.23 / 2018-05-07 + + * Fix deprecation warning in Node v10 due to the last usage of `new Buffer` (#185, by @felixbuenemann) + * Switched from NodeBuffer to Buffer in typings (#155 by @felixfbecker, #186 by @larssn) + + +# 0.4.22 / 2018-05-05 + + * Use older semver style for dependencies to be compatible with Node version 0.10 (#182, by @dougwilson) + * Fix tests to accomodate fixes in Node v10 (#182, by @dougwilson) + + +# 0.4.21 / 2018-04-06 + + * Fix encoding canonicalization (#156) + * Fix the paths in the "browser" field in package.json (#174 by @LMLB) + * Removed "contributors" section in package.json - see Git history instead. + + +# 0.4.20 / 2018-04-06 + + * Updated `new Buffer()` usages with recommended replacements as it's being deprecated in Node v10 (#176, #178 by @ChALkeR) + # 0.4.19 / 2017-09-09 diff --git a/node_modules/iconv-lite/README.md b/node_modules/iconv-lite/README.md index 767daedef..c981c3708 100644 --- a/node_modules/iconv-lite/README.md +++ b/node_modules/iconv-lite/README.md @@ -20,7 +20,7 @@ var iconv = require('iconv-lite'); // Convert from an encoded buffer to js string. -str = iconv.decode(new Buffer([0x68, 0x65, 0x6c, 0x6c, 0x6f]), 'win1251'); +str = iconv.decode(Buffer.from([0x68, 0x65, 0x6c, 0x6c, 0x6f]), 'win1251'); // Convert from js string to an encoded buffer. buf = iconv.encode("Sample input string", 'win1251'); @@ -154,7 +154,3 @@ $ # To view test coverage: $ npm run coverage $ open coverage/lcov-report/index.html ``` - -## Adoption -[](https://nodei.co/npm/iconv-lite/) -[](https://www.codeship.com/projects/29053) diff --git a/node_modules/iconv-lite/encodings/dbcs-codec.js b/node_modules/iconv-lite/encodings/dbcs-codec.js index 7b3c980b3..1fe3e1601 100644 --- a/node_modules/iconv-lite/encodings/dbcs-codec.js +++ b/node_modules/iconv-lite/encodings/dbcs-codec.js @@ -1,5 +1,5 @@ "use strict"; -var Buffer = require("buffer").Buffer; +var Buffer = require("safer-buffer").Buffer; // Multibyte codec. In this scheme, a character is represented by 1 or more bytes. // Our codec supports UTF-16 surrogates, extensions for GB18030 and unicode sequences. @@ -281,7 +281,7 @@ function DBCSEncoder(options, codec) { } DBCSEncoder.prototype.write = function(str) { - var newBuf = new Buffer(str.length * (this.gb18030 ? 4 : 3)), + var newBuf = Buffer.alloc(str.length * (this.gb18030 ? 4 : 3)), leadSurrogate = this.leadSurrogate, seqObj = this.seqObj, nextChar = -1, i = 0, j = 0; @@ -404,7 +404,7 @@ DBCSEncoder.prototype.end = function() { if (this.leadSurrogate === -1 && this.seqObj === undefined) return; // All clean. Most often case. - var newBuf = new Buffer(10), j = 0; + var newBuf = Buffer.alloc(10), j = 0; if (this.seqObj) { // We're in the sequence. var dbcsCode = this.seqObj[DEF_CHAR]; @@ -440,7 +440,7 @@ DBCSEncoder.prototype.findIdx = findIdx; function DBCSDecoder(options, codec) { // Decoder state this.nodeIdx = 0; - this.prevBuf = new Buffer(0); + this.prevBuf = Buffer.alloc(0); // Static data this.decodeTables = codec.decodeTables; @@ -450,7 +450,7 @@ function DBCSDecoder(options, codec) { } DBCSDecoder.prototype.write = function(buf) { - var newBuf = new Buffer(buf.length*2), + var newBuf = Buffer.alloc(buf.length*2), nodeIdx = this.nodeIdx, prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length, seqStart = -this.prevBuf.length, // idx of the start of current parsed sequence. @@ -527,7 +527,7 @@ DBCSDecoder.prototype.end = function() { var buf = this.prevBuf.slice(1); // Parse remaining as usual. - this.prevBuf = new Buffer(0); + this.prevBuf = Buffer.alloc(0); this.nodeIdx = 0; if (buf.length > 0) ret += this.write(buf); diff --git a/node_modules/iconv-lite/encodings/internal.js b/node_modules/iconv-lite/encodings/internal.js index b0adf6a92..05ce38b27 100644 --- a/node_modules/iconv-lite/encodings/internal.js +++ b/node_modules/iconv-lite/encodings/internal.js @@ -1,5 +1,5 @@ "use strict"; -var Buffer = require("buffer").Buffer; +var Buffer = require("safer-buffer").Buffer; // Export Node.js internal encodings. @@ -33,7 +33,7 @@ function InternalCodec(codecOptions, iconv) { this.encoder = InternalEncoderCesu8; // Add decoder for versions of Node not supporting CESU-8 - if (new Buffer('eda0bdedb2a9', 'hex').toString() !== '💩') { + if (Buffer.from('eda0bdedb2a9', 'hex').toString() !== '💩') { this.decoder = InternalDecoderCesu8; this.defaultCharUnicode = iconv.defaultCharUnicode; } @@ -67,7 +67,7 @@ function InternalEncoder(options, codec) { } InternalEncoder.prototype.write = function(str) { - return new Buffer(str, this.enc); + return Buffer.from(str, this.enc); } InternalEncoder.prototype.end = function() { @@ -87,11 +87,11 @@ InternalEncoderBase64.prototype.write = function(str) { this.prevStr = str.slice(completeQuads); str = str.slice(0, completeQuads); - return new Buffer(str, "base64"); + return Buffer.from(str, "base64"); } InternalEncoderBase64.prototype.end = function() { - return new Buffer(this.prevStr, "base64"); + return Buffer.from(this.prevStr, "base64"); } @@ -102,7 +102,7 @@ function InternalEncoderCesu8(options, codec) { } InternalEncoderCesu8.prototype.write = function(str) { - var buf = new Buffer(str.length * 3), bufIdx = 0; + var buf = Buffer.alloc(str.length * 3), bufIdx = 0; for (var i = 0; i < str.length; i++) { var charCode = str.charCodeAt(i); // Naive implementation, but it works because CESU-8 is especially easy diff --git a/node_modules/iconv-lite/encodings/sbcs-codec.js b/node_modules/iconv-lite/encodings/sbcs-codec.js index 7789e00ed..abac5ffaa 100644 --- a/node_modules/iconv-lite/encodings/sbcs-codec.js +++ b/node_modules/iconv-lite/encodings/sbcs-codec.js @@ -1,5 +1,5 @@ "use strict"; -var Buffer = require("buffer").Buffer; +var Buffer = require("safer-buffer").Buffer; // Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that // correspond to encoded bytes (if 128 - then lower half is ASCII). @@ -20,11 +20,10 @@ function SBCSCodec(codecOptions, iconv) { codecOptions.chars = asciiString + codecOptions.chars; } - this.decodeBuf = new Buffer(codecOptions.chars, 'ucs2'); + this.decodeBuf = Buffer.from(codecOptions.chars, 'ucs2'); // Encoding buffer. - var encodeBuf = new Buffer(65536); - encodeBuf.fill(iconv.defaultCharSingleByte.charCodeAt(0)); + var encodeBuf = Buffer.alloc(65536, iconv.defaultCharSingleByte.charCodeAt(0)); for (var i = 0; i < codecOptions.chars.length; i++) encodeBuf[codecOptions.chars.charCodeAt(i)] = i; @@ -41,7 +40,7 @@ function SBCSEncoder(options, codec) { } SBCSEncoder.prototype.write = function(str) { - var buf = new Buffer(str.length); + var buf = Buffer.alloc(str.length); for (var i = 0; i < str.length; i++) buf[i] = this.encodeBuf[str.charCodeAt(i)]; @@ -59,7 +58,7 @@ function SBCSDecoder(options, codec) { SBCSDecoder.prototype.write = function(buf) { // Strings are immutable in JS -> we use ucs2 buffer to speed up computations. var decodeBuf = this.decodeBuf; - var newBuf = new Buffer(buf.length*2); + var newBuf = Buffer.alloc(buf.length*2); var idx1 = 0, idx2 = 0; for (var i = 0; i < buf.length; i++) { idx1 = buf[i]*2; idx2 = i*2; diff --git a/node_modules/iconv-lite/encodings/sbcs-data.js b/node_modules/iconv-lite/encodings/sbcs-data.js index 2d6f846ad..fdb81a39a 100644 --- a/node_modules/iconv-lite/encodings/sbcs-data.js +++ b/node_modules/iconv-lite/encodings/sbcs-data.js @@ -17,6 +17,11 @@ module.exports = { "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№€■ " }, + "mik": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя└┴┬├─┼╣║╚╔╩╦╠═╬┐░▒▓│┤№§╗╝┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + // Aliases of generated encodings. "ascii8bit": "ascii", "usascii": "ascii", diff --git a/node_modules/iconv-lite/encodings/utf16.js b/node_modules/iconv-lite/encodings/utf16.js index 7e8f1591a..54765aeee 100644 --- a/node_modules/iconv-lite/encodings/utf16.js +++ b/node_modules/iconv-lite/encodings/utf16.js @@ -1,5 +1,5 @@ "use strict"; -var Buffer = require("buffer").Buffer; +var Buffer = require("safer-buffer").Buffer; // Note: UTF16-LE (or UCS2) codec is Node.js native. See encodings/internal.js @@ -20,7 +20,7 @@ function Utf16BEEncoder() { } Utf16BEEncoder.prototype.write = function(str) { - var buf = new Buffer(str, 'ucs2'); + var buf = Buffer.from(str, 'ucs2'); for (var i = 0; i < buf.length; i += 2) { var tmp = buf[i]; buf[i] = buf[i+1]; buf[i+1] = tmp; } @@ -41,7 +41,7 @@ Utf16BEDecoder.prototype.write = function(buf) { if (buf.length == 0) return ''; - var buf2 = new Buffer(buf.length + 1), + var buf2 = Buffer.alloc(buf.length + 1), i = 0, j = 0; if (this.overflowByte !== -1) { diff --git a/node_modules/iconv-lite/encodings/utf7.js b/node_modules/iconv-lite/encodings/utf7.js index 19b7194aa..b7631c23a 100644 --- a/node_modules/iconv-lite/encodings/utf7.js +++ b/node_modules/iconv-lite/encodings/utf7.js @@ -1,5 +1,5 @@ "use strict"; -var Buffer = require("buffer").Buffer; +var Buffer = require("safer-buffer").Buffer; // UTF-7 codec, according to https://tools.ietf.org/html/rfc2152 // See also below a UTF-7-IMAP codec, according to http://tools.ietf.org/html/rfc3501#section-5.1.3 @@ -26,7 +26,7 @@ function Utf7Encoder(options, codec) { Utf7Encoder.prototype.write = function(str) { // Naive implementation. // Non-direct chars are encoded as "+<base64>-"; single "+" char is encoded as "+-". - return new Buffer(str.replace(nonDirectChars, function(chunk) { + return Buffer.from(str.replace(nonDirectChars, function(chunk) { return "+" + (chunk === '+' ? '' : this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, '')) + "-"; @@ -75,7 +75,7 @@ Utf7Decoder.prototype.write = function(buf) { res += "+"; } else { var b64str = base64Accum + buf.slice(lastI, i).toString(); - res += this.iconv.decode(new Buffer(b64str, 'base64'), "utf16-be"); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); } if (buf[i] != minusChar) // Minus is absorbed after base64. @@ -97,7 +97,7 @@ Utf7Decoder.prototype.write = function(buf) { base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. b64str = b64str.slice(0, canBeDecoded); - res += this.iconv.decode(new Buffer(b64str, 'base64'), "utf16-be"); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); } this.inBase64 = inBase64; @@ -109,7 +109,7 @@ Utf7Decoder.prototype.write = function(buf) { Utf7Decoder.prototype.end = function() { var res = ""; if (this.inBase64 && this.base64Accum.length > 0) - res = this.iconv.decode(new Buffer(this.base64Accum, 'base64'), "utf16-be"); + res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); this.inBase64 = false; this.base64Accum = ''; @@ -144,7 +144,7 @@ Utf7IMAPCodec.prototype.bomAware = true; function Utf7IMAPEncoder(options, codec) { this.iconv = codec.iconv; this.inBase64 = false; - this.base64Accum = new Buffer(6); + this.base64Accum = Buffer.alloc(6); this.base64AccumIdx = 0; } @@ -152,7 +152,7 @@ Utf7IMAPEncoder.prototype.write = function(str) { var inBase64 = this.inBase64, base64Accum = this.base64Accum, base64AccumIdx = this.base64AccumIdx, - buf = new Buffer(str.length*5 + 10), bufIdx = 0; + buf = Buffer.alloc(str.length*5 + 10), bufIdx = 0; for (var i = 0; i < str.length; i++) { var uChar = str.charCodeAt(i); @@ -198,7 +198,7 @@ Utf7IMAPEncoder.prototype.write = function(str) { } Utf7IMAPEncoder.prototype.end = function() { - var buf = new Buffer(10), bufIdx = 0; + var buf = Buffer.alloc(10), bufIdx = 0; if (this.inBase64) { if (this.base64AccumIdx > 0) { bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); @@ -246,7 +246,7 @@ Utf7IMAPDecoder.prototype.write = function(buf) { res += "&"; } else { var b64str = base64Accum + buf.slice(lastI, i).toString().replace(/,/g, '/'); - res += this.iconv.decode(new Buffer(b64str, 'base64'), "utf16-be"); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); } if (buf[i] != minusChar) // Minus may be absorbed after base64. @@ -268,7 +268,7 @@ Utf7IMAPDecoder.prototype.write = function(buf) { base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. b64str = b64str.slice(0, canBeDecoded); - res += this.iconv.decode(new Buffer(b64str, 'base64'), "utf16-be"); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); } this.inBase64 = inBase64; @@ -280,7 +280,7 @@ Utf7IMAPDecoder.prototype.write = function(buf) { Utf7IMAPDecoder.prototype.end = function() { var res = ""; if (this.inBase64 && this.base64Accum.length > 0) - res = this.iconv.decode(new Buffer(this.base64Accum, 'base64'), "utf16-be"); + res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); this.inBase64 = false; this.base64Accum = ''; diff --git a/node_modules/iconv-lite/lib/extend-node.js b/node_modules/iconv-lite/lib/extend-node.js index a120400be..87f5394a4 100644 --- a/node_modules/iconv-lite/lib/extend-node.js +++ b/node_modules/iconv-lite/lib/extend-node.js @@ -1,5 +1,6 @@ "use strict"; var Buffer = require("buffer").Buffer; +// Note: not polyfilled with safer-buffer on a purpose, as overrides Buffer // == Extend Node primitives to use iconv-lite ================================= @@ -8,7 +9,8 @@ module.exports = function (iconv) { // Node authors rewrote Buffer internals to make it compatible with // Uint8Array and we cannot patch key functions since then. - iconv.supportsNodeEncodingsExtension = !(new Buffer(0) instanceof Uint8Array); + // Note: this does use older Buffer API on a purpose + iconv.supportsNodeEncodingsExtension = !(Buffer.from || new Buffer(0) instanceof Uint8Array); iconv.extendNodeEncodings = function extendNodeEncodings() { if (original) return; diff --git a/node_modules/iconv-lite/lib/index.d.ts b/node_modules/iconv-lite/lib/index.d.ts index b9c83613e..0547eb346 100644 --- a/node_modules/iconv-lite/lib/index.d.ts +++ b/node_modules/iconv-lite/lib/index.d.ts @@ -6,9 +6,9 @@ *--------------------------------------------------------------------------------------------*/ declare module 'iconv-lite' { - export function decode(buffer: NodeBuffer, encoding: string, options?: Options): string; + export function decode(buffer: Buffer, encoding: string, options?: Options): string; - export function encode(content: string, encoding: string, options?: Options): NodeBuffer; + export function encode(content: string, encoding: string, options?: Options): Buffer; export function encodingExists(encoding: string): boolean; diff --git a/node_modules/iconv-lite/lib/index.js b/node_modules/iconv-lite/lib/index.js index 9a5247212..5391919ca 100644 --- a/node_modules/iconv-lite/lib/index.js +++ b/node_modules/iconv-lite/lib/index.js @@ -2,7 +2,7 @@ // Some environments don't have global Buffer (e.g. React Native). // Solution would be installing npm modules "buffer" and "stream" explicitly. -var Buffer = require("buffer").Buffer; +var Buffer = require("safer-buffer").Buffer; var bomHandling = require("./bom-handling"), iconv = module.exports; @@ -34,7 +34,7 @@ iconv.decode = function decode(buf, encoding, options) { iconv.skipDecodeWarning = true; } - buf = new Buffer("" + (buf || ""), "binary"); // Ensure buffer. + buf = Buffer.from("" + (buf || ""), "binary"); // Ensure buffer. } var decoder = iconv.getDecoder(encoding, options); @@ -65,7 +65,7 @@ iconv.getCodec = function getCodec(encoding) { iconv.encodings = require("../encodings"); // Lazy load all encoding definitions. // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. - var enc = (''+encoding).toLowerCase().replace(/[^0-9a-z]|:\d{4}$/g, ""); + var enc = iconv._canonicalizeEncoding(encoding); // Traverse iconv.encodings to find actual codec. var codecOptions = {}; @@ -108,6 +108,11 @@ iconv.getCodec = function getCodec(encoding) { } } +iconv._canonicalizeEncoding = function(encoding) { + // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. + return (''+encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, ""); +} + iconv.getEncoder = function getEncoder(encoding, options) { var codec = iconv.getCodec(encoding), encoder = new codec.encoder(options, codec); diff --git a/node_modules/iconv-lite/package.json b/node_modules/iconv-lite/package.json index 459dca348..a7c74fcc2 100644 --- a/node_modules/iconv-lite/package.json +++ b/node_modules/iconv-lite/package.json @@ -1,7 +1,7 @@ { "name": "iconv-lite", "description": "Convert character encodings in pure javascript.", - "version": "0.4.19", + "version": "0.4.24", "license": "MIT", "keywords": [ "iconv", @@ -10,20 +10,6 @@ "icu" ], "author": "Alexander Shtuchkin <ashtuchkin@gmail.com>", - "contributors": [ - "Jinwu Zhan (https://github.com/jenkinv)", - "Adamansky Anton (https://github.com/adamansky)", - "George Stagas (https://github.com/stagas)", - "Mike D Pilsbury (https://github.com/pekim)", - "Niggler (https://github.com/Niggler)", - "wychi (https://github.com/wychi)", - "David Kuo (https://github.com/david50407)", - "ChangZhuo Chen (https://github.com/czchen)", - "Lee Treveil (https://github.com/leetreveil)", - "Brian White (https://github.com/mscdex)", - "Mithgol (https://github.com/Mithgol)", - "Nazar Leush (https://github.com/nleush)" - ], "main": "./lib/index.js", "typings": "./lib/index.d.ts", "homepage": "https://github.com/ashtuchkin/iconv-lite", @@ -41,17 +27,20 @@ "test": "mocha --reporter spec --grep ." }, "browser": { - "./extend-node": false, - "./streams": false + "./lib/extend-node": false, + "./lib/streams": false }, "devDependencies": { - "mocha": "*", - "request": "*", + "mocha": "^3.1.0", + "request": "~2.87.0", "unorm": "*", "errto": "*", "async": "*", "istanbul": "*", "semver": "*", "iconv": "*" + }, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" } } |