1
0
mirror of https://github.com/S2-/minifyfromhtml.git synced 2025-08-03 12:20:04 +02:00

update node modules

This commit is contained in:
s2
2019-03-29 15:56:41 +01:00
parent f114871153
commit 89c32fb4e6
8347 changed files with 390123 additions and 159877 deletions

View File

@@ -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);

View File

@@ -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

View File

@@ -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;

View File

@@ -17,6 +17,11 @@ module.exports = {
"chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№€■ "
},
"mik": {
"type": "_sbcs",
"chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя└┴┬├─┼╣║╚╔╩╦╠═╬┐░▒▓│┤№§╗╝┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "
},
// Aliases of generated encodings.
"ascii8bit": "ascii",
"usascii": "ascii",

View File

@@ -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) {

View File

@@ -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 = '';