mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-04 12:40:05 +02:00
update node modules
This commit is contained in:
2
node_modules/asn1/lib/ber/errors.js
generated
vendored
2
node_modules/asn1/lib/ber/errors.js
generated
vendored
@@ -3,7 +3,7 @@
|
||||
|
||||
module.exports = {
|
||||
|
||||
newInvalidAsn1Error: function(msg) {
|
||||
newInvalidAsn1Error: function (msg) {
|
||||
var e = new Error();
|
||||
e.name = 'InvalidAsn1Error';
|
||||
e.message = msg || '';
|
||||
|
2
node_modules/asn1/lib/ber/index.js
generated
vendored
2
node_modules/asn1/lib/ber/index.js
generated
vendored
@@ -7,7 +7,7 @@ var Reader = require('./reader');
|
||||
var Writer = require('./writer');
|
||||
|
||||
|
||||
///--- Exports
|
||||
// --- Exports
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
37
node_modules/asn1/lib/ber/reader.js
generated
vendored
37
node_modules/asn1/lib/ber/reader.js
generated
vendored
@@ -1,18 +1,19 @@
|
||||
// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
|
||||
|
||||
var assert = require('assert');
|
||||
var Buffer = require('safer-buffer').Buffer;
|
||||
|
||||
var ASN1 = require('./types');
|
||||
var errors = require('./errors');
|
||||
|
||||
|
||||
///--- Globals
|
||||
// --- Globals
|
||||
|
||||
var newInvalidAsn1Error = errors.newInvalidAsn1Error;
|
||||
|
||||
|
||||
|
||||
///--- API
|
||||
// --- API
|
||||
|
||||
function Reader(data) {
|
||||
if (!data || !Buffer.isBuffer(data))
|
||||
@@ -52,7 +53,7 @@ Object.defineProperty(Reader.prototype, 'buffer', {
|
||||
* @param {Boolean} peek true means don't move offset.
|
||||
* @return {Number} the next byte, null if not enough data.
|
||||
*/
|
||||
Reader.prototype.readByte = function(peek) {
|
||||
Reader.prototype.readByte = function (peek) {
|
||||
if (this._size - this._offset < 1)
|
||||
return null;
|
||||
|
||||
@@ -65,7 +66,7 @@ Reader.prototype.readByte = function(peek) {
|
||||
};
|
||||
|
||||
|
||||
Reader.prototype.peek = function() {
|
||||
Reader.prototype.peek = function () {
|
||||
return this.readByte(true);
|
||||
};
|
||||
|
||||
@@ -81,7 +82,7 @@ Reader.prototype.peek = function() {
|
||||
* @return {Number} the amount of offset to advance the buffer.
|
||||
* @throws {InvalidAsn1Error} on bad ASN.1
|
||||
*/
|
||||
Reader.prototype.readLength = function(offset) {
|
||||
Reader.prototype.readLength = function (offset) {
|
||||
if (offset === undefined)
|
||||
offset = this._offset;
|
||||
|
||||
@@ -92,10 +93,10 @@ Reader.prototype.readLength = function(offset) {
|
||||
if (lenB === null)
|
||||
return null;
|
||||
|
||||
if ((lenB & 0x80) == 0x80) {
|
||||
if ((lenB & 0x80) === 0x80) {
|
||||
lenB &= 0x7f;
|
||||
|
||||
if (lenB == 0)
|
||||
if (lenB === 0)
|
||||
throw newInvalidAsn1Error('Indefinite length not supported');
|
||||
|
||||
if (lenB > 4)
|
||||
@@ -124,7 +125,7 @@ Reader.prototype.readLength = function(offset) {
|
||||
*
|
||||
* @return {Number} the sequence's tag.
|
||||
*/
|
||||
Reader.prototype.readSequence = function(tag) {
|
||||
Reader.prototype.readSequence = function (tag) {
|
||||
var seq = this.peek();
|
||||
if (seq === null)
|
||||
return null;
|
||||
@@ -141,22 +142,22 @@ Reader.prototype.readSequence = function(tag) {
|
||||
};
|
||||
|
||||
|
||||
Reader.prototype.readInt = function() {
|
||||
Reader.prototype.readInt = function () {
|
||||
return this._readTag(ASN1.Integer);
|
||||
};
|
||||
|
||||
|
||||
Reader.prototype.readBoolean = function() {
|
||||
Reader.prototype.readBoolean = function () {
|
||||
return (this._readTag(ASN1.Boolean) === 0 ? false : true);
|
||||
};
|
||||
|
||||
|
||||
Reader.prototype.readEnumeration = function() {
|
||||
Reader.prototype.readEnumeration = function () {
|
||||
return this._readTag(ASN1.Enumeration);
|
||||
};
|
||||
|
||||
|
||||
Reader.prototype.readString = function(tag, retbuf) {
|
||||
Reader.prototype.readString = function (tag, retbuf) {
|
||||
if (!tag)
|
||||
tag = ASN1.OctetString;
|
||||
|
||||
@@ -179,7 +180,7 @@ Reader.prototype.readString = function(tag, retbuf) {
|
||||
this._offset = o;
|
||||
|
||||
if (this.length === 0)
|
||||
return retbuf ? new Buffer(0) : '';
|
||||
return retbuf ? Buffer.alloc(0) : '';
|
||||
|
||||
var str = this._buf.slice(this._offset, this._offset + this.length);
|
||||
this._offset += this.length;
|
||||
@@ -187,7 +188,7 @@ Reader.prototype.readString = function(tag, retbuf) {
|
||||
return retbuf ? str : str.toString('utf8');
|
||||
};
|
||||
|
||||
Reader.prototype.readOID = function(tag) {
|
||||
Reader.prototype.readOID = function (tag) {
|
||||
if (!tag)
|
||||
tag = ASN1.OID;
|
||||
|
||||
@@ -203,7 +204,7 @@ Reader.prototype.readOID = function(tag) {
|
||||
|
||||
value <<= 7;
|
||||
value += byte & 0x7f;
|
||||
if ((byte & 0x80) == 0) {
|
||||
if ((byte & 0x80) === 0) {
|
||||
values.push(value);
|
||||
value = 0;
|
||||
}
|
||||
@@ -217,7 +218,7 @@ Reader.prototype.readOID = function(tag) {
|
||||
};
|
||||
|
||||
|
||||
Reader.prototype._readTag = function(tag) {
|
||||
Reader.prototype._readTag = function (tag) {
|
||||
assert.ok(tag !== undefined);
|
||||
|
||||
var b = this.peek();
|
||||
@@ -248,7 +249,7 @@ Reader.prototype._readTag = function(tag) {
|
||||
value |= (this._buf[this._offset++] & 0xff);
|
||||
}
|
||||
|
||||
if ((fb & 0x80) == 0x80 && i !== 4)
|
||||
if ((fb & 0x80) === 0x80 && i !== 4)
|
||||
value -= (1 << (i * 8));
|
||||
|
||||
return value >> 0;
|
||||
@@ -256,6 +257,6 @@ Reader.prototype._readTag = function(tag) {
|
||||
|
||||
|
||||
|
||||
///--- Exported API
|
||||
// --- Exported API
|
||||
|
||||
module.exports = Reader;
|
||||
|
93
node_modules/asn1/lib/ber/writer.js
generated
vendored
93
node_modules/asn1/lib/ber/writer.js
generated
vendored
@@ -1,11 +1,12 @@
|
||||
// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
|
||||
|
||||
var assert = require('assert');
|
||||
var Buffer = require('safer-buffer').Buffer;
|
||||
var ASN1 = require('./types');
|
||||
var errors = require('./errors');
|
||||
|
||||
|
||||
///--- Globals
|
||||
// --- Globals
|
||||
|
||||
var newInvalidAsn1Error = errors.newInvalidAsn1Error;
|
||||
|
||||
@@ -15,16 +16,16 @@ var DEFAULT_OPTS = {
|
||||
};
|
||||
|
||||
|
||||
///--- Helpers
|
||||
// --- Helpers
|
||||
|
||||
function merge(from, to) {
|
||||
assert.ok(from);
|
||||
assert.equal(typeof(from), 'object');
|
||||
assert.equal(typeof (from), 'object');
|
||||
assert.ok(to);
|
||||
assert.equal(typeof(to), 'object');
|
||||
assert.equal(typeof (to), 'object');
|
||||
|
||||
var keys = Object.getOwnPropertyNames(from);
|
||||
keys.forEach(function(key) {
|
||||
keys.forEach(function (key) {
|
||||
if (to[key])
|
||||
return;
|
||||
|
||||
@@ -37,12 +38,12 @@ function merge(from, to) {
|
||||
|
||||
|
||||
|
||||
///--- API
|
||||
// --- API
|
||||
|
||||
function Writer(options) {
|
||||
options = merge(DEFAULT_OPTS, options || {});
|
||||
|
||||
this._buf = new Buffer(options.size || 1024);
|
||||
this._buf = Buffer.alloc(options.size || 1024);
|
||||
this._size = this._buf.length;
|
||||
this._offset = 0;
|
||||
this._options = options;
|
||||
@@ -55,14 +56,14 @@ function Writer(options) {
|
||||
Object.defineProperty(Writer.prototype, 'buffer', {
|
||||
get: function () {
|
||||
if (this._seq.length)
|
||||
throw new InvalidAsn1Error(this._seq.length + ' unended sequence(s)');
|
||||
throw newInvalidAsn1Error(this._seq.length + ' unended sequence(s)');
|
||||
|
||||
return (this._buf.slice(0, this._offset));
|
||||
}
|
||||
});
|
||||
|
||||
Writer.prototype.writeByte = function(b) {
|
||||
if (typeof(b) !== 'number')
|
||||
Writer.prototype.writeByte = function (b) {
|
||||
if (typeof (b) !== 'number')
|
||||
throw new TypeError('argument must be a Number');
|
||||
|
||||
this._ensure(1);
|
||||
@@ -70,22 +71,22 @@ Writer.prototype.writeByte = function(b) {
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeInt = function(i, tag) {
|
||||
if (typeof(i) !== 'number')
|
||||
Writer.prototype.writeInt = function (i, tag) {
|
||||
if (typeof (i) !== 'number')
|
||||
throw new TypeError('argument must be a Number');
|
||||
if (typeof(tag) !== 'number')
|
||||
if (typeof (tag) !== 'number')
|
||||
tag = ASN1.Integer;
|
||||
|
||||
var sz = 4;
|
||||
|
||||
while ((((i & 0xff800000) === 0) || ((i & 0xff800000) === 0xff800000 >> 0)) &&
|
||||
(sz > 1)) {
|
||||
(sz > 1)) {
|
||||
sz--;
|
||||
i <<= 8;
|
||||
}
|
||||
|
||||
if (sz > 4)
|
||||
throw new InvalidAsn1Error('BER ints cannot be > 0xffffffff');
|
||||
throw newInvalidAsn1Error('BER ints cannot be > 0xffffffff');
|
||||
|
||||
this._ensure(2 + sz);
|
||||
this._buf[this._offset++] = tag;
|
||||
@@ -99,26 +100,26 @@ Writer.prototype.writeInt = function(i, tag) {
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeNull = function() {
|
||||
Writer.prototype.writeNull = function () {
|
||||
this.writeByte(ASN1.Null);
|
||||
this.writeByte(0x00);
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeEnumeration = function(i, tag) {
|
||||
if (typeof(i) !== 'number')
|
||||
Writer.prototype.writeEnumeration = function (i, tag) {
|
||||
if (typeof (i) !== 'number')
|
||||
throw new TypeError('argument must be a Number');
|
||||
if (typeof(tag) !== 'number')
|
||||
if (typeof (tag) !== 'number')
|
||||
tag = ASN1.Enumeration;
|
||||
|
||||
return this.writeInt(i, tag);
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeBoolean = function(b, tag) {
|
||||
if (typeof(b) !== 'boolean')
|
||||
Writer.prototype.writeBoolean = function (b, tag) {
|
||||
if (typeof (b) !== 'boolean')
|
||||
throw new TypeError('argument must be a Boolean');
|
||||
if (typeof(tag) !== 'number')
|
||||
if (typeof (tag) !== 'number')
|
||||
tag = ASN1.Boolean;
|
||||
|
||||
this._ensure(3);
|
||||
@@ -128,10 +129,10 @@ Writer.prototype.writeBoolean = function(b, tag) {
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeString = function(s, tag) {
|
||||
if (typeof(s) !== 'string')
|
||||
throw new TypeError('argument must be a string (was: ' + typeof(s) + ')');
|
||||
if (typeof(tag) !== 'number')
|
||||
Writer.prototype.writeString = function (s, tag) {
|
||||
if (typeof (s) !== 'string')
|
||||
throw new TypeError('argument must be a string (was: ' + typeof (s) + ')');
|
||||
if (typeof (tag) !== 'number')
|
||||
tag = ASN1.OctetString;
|
||||
|
||||
var len = Buffer.byteLength(s);
|
||||
@@ -145,8 +146,8 @@ Writer.prototype.writeString = function(s, tag) {
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeBuffer = function(buf, tag) {
|
||||
if (typeof(tag) !== 'number')
|
||||
Writer.prototype.writeBuffer = function (buf, tag) {
|
||||
if (typeof (tag) !== 'number')
|
||||
throw new TypeError('tag must be a number');
|
||||
if (!Buffer.isBuffer(buf))
|
||||
throw new TypeError('argument must be a buffer');
|
||||
@@ -159,21 +160,21 @@ Writer.prototype.writeBuffer = function(buf, tag) {
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeStringArray = function(strings) {
|
||||
Writer.prototype.writeStringArray = function (strings) {
|
||||
if ((!strings instanceof Array))
|
||||
throw new TypeError('argument must be an Array[String]');
|
||||
|
||||
var self = this;
|
||||
strings.forEach(function(s) {
|
||||
strings.forEach(function (s) {
|
||||
self.writeString(s);
|
||||
});
|
||||
};
|
||||
|
||||
// This is really to solve DER cases, but whatever for now
|
||||
Writer.prototype.writeOID = function(s, tag) {
|
||||
if (typeof(s) !== 'string')
|
||||
Writer.prototype.writeOID = function (s, tag) {
|
||||
if (typeof (s) !== 'string')
|
||||
throw new TypeError('argument must be a string');
|
||||
if (typeof(tag) !== 'number')
|
||||
if (typeof (tag) !== 'number')
|
||||
tag = ASN1.OID;
|
||||
|
||||
if (!/^([0-9]+\.){3,}[0-9]+$/.test(s))
|
||||
@@ -206,7 +207,7 @@ Writer.prototype.writeOID = function(s, tag) {
|
||||
var tmp = s.split('.');
|
||||
var bytes = [];
|
||||
bytes.push(parseInt(tmp[0], 10) * 40 + parseInt(tmp[1], 10));
|
||||
tmp.slice(2).forEach(function(b) {
|
||||
tmp.slice(2).forEach(function (b) {
|
||||
encodeOctet(bytes, parseInt(b, 10));
|
||||
});
|
||||
|
||||
@@ -214,14 +215,14 @@ Writer.prototype.writeOID = function(s, tag) {
|
||||
this._ensure(2 + bytes.length);
|
||||
this.writeByte(tag);
|
||||
this.writeLength(bytes.length);
|
||||
bytes.forEach(function(b) {
|
||||
bytes.forEach(function (b) {
|
||||
self.writeByte(b);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.writeLength = function(len) {
|
||||
if (typeof(len) !== 'number')
|
||||
Writer.prototype.writeLength = function (len) {
|
||||
if (typeof (len) !== 'number')
|
||||
throw new TypeError('argument must be a Number');
|
||||
|
||||
this._ensure(4);
|
||||
@@ -241,12 +242,12 @@ Writer.prototype.writeLength = function(len) {
|
||||
this._buf[this._offset++] = len >> 8;
|
||||
this._buf[this._offset++] = len;
|
||||
} else {
|
||||
throw new InvalidAsn1ERror('Length too long (> 4 bytes)');
|
||||
throw newInvalidAsn1Error('Length too long (> 4 bytes)');
|
||||
}
|
||||
};
|
||||
|
||||
Writer.prototype.startSequence = function(tag) {
|
||||
if (typeof(tag) !== 'number')
|
||||
Writer.prototype.startSequence = function (tag) {
|
||||
if (typeof (tag) !== 'number')
|
||||
tag = ASN1.Sequence | ASN1.Constructor;
|
||||
|
||||
this.writeByte(tag);
|
||||
@@ -256,7 +257,7 @@ Writer.prototype.startSequence = function(tag) {
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype.endSequence = function() {
|
||||
Writer.prototype.endSequence = function () {
|
||||
var seq = this._seq.pop();
|
||||
var start = seq + 3;
|
||||
var len = this._offset - start;
|
||||
@@ -279,12 +280,12 @@ Writer.prototype.endSequence = function() {
|
||||
this._buf[seq + 2] = len >> 8;
|
||||
this._buf[seq + 3] = len;
|
||||
} else {
|
||||
throw new InvalidAsn1Error('Sequence too long');
|
||||
throw newInvalidAsn1Error('Sequence too long');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Writer.prototype._shift = function(start, len, shift) {
|
||||
Writer.prototype._shift = function (start, len, shift) {
|
||||
assert.ok(start !== undefined);
|
||||
assert.ok(len !== undefined);
|
||||
assert.ok(shift);
|
||||
@@ -293,7 +294,7 @@ Writer.prototype._shift = function(start, len, shift) {
|
||||
this._offset += shift;
|
||||
};
|
||||
|
||||
Writer.prototype._ensure = function(len) {
|
||||
Writer.prototype._ensure = function (len) {
|
||||
assert.ok(len);
|
||||
|
||||
if (this._size - this._offset < len) {
|
||||
@@ -301,7 +302,7 @@ Writer.prototype._ensure = function(len) {
|
||||
if (sz - this._offset < len)
|
||||
sz += len;
|
||||
|
||||
var buf = new Buffer(sz);
|
||||
var buf = Buffer.alloc(sz);
|
||||
|
||||
this._buf.copy(buf, 0, 0, this._offset);
|
||||
this._buf = buf;
|
||||
@@ -311,6 +312,6 @@ Writer.prototype._ensure = function(len) {
|
||||
|
||||
|
||||
|
||||
///--- Exported API
|
||||
// --- Exported API
|
||||
|
||||
module.exports = Writer;
|
||||
|
Reference in New Issue
Block a user