1
0
mirror of https://github.com/S2-/minifyfromhtml.git synced 2025-08-03 04:10: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

@@ -31,17 +31,18 @@
'use strict';
var net = require('net');
var urlParse = require('url').parse;
var pubsuffix = require('./pubsuffix');
var util = require('util');
var pubsuffix = require('./pubsuffix-psl');
var Store = require('./store').Store;
var MemoryCookieStore = require('./memstore').MemoryCookieStore;
var pathMatch = require('./pathMatch').pathMatch;
var VERSION = require('../package.json').version;
var VERSION = require('./version');
var punycode;
try {
punycode = require('punycode');
} catch(e) {
console.warn("cookie: can't load punycode; won't use punycode for domain normalization");
console.warn("tough-cookie: can't load punycode; won't use punycode for domain normalization");
}
// From RFC6265 S4.1.1
@@ -756,6 +757,12 @@ Cookie.prototype.inspect = function inspect() {
'"';
};
// Use the new custom inspection symbol to add the custom inspect function if
// available.
if (util.inspect.custom) {
Cookie.prototype[util.inspect.custom] = Cookie.prototype.inspect;
}
Cookie.prototype.toJSON = function() {
var obj = {};
@@ -1364,7 +1371,6 @@ CookieJar.deserializeSync = function(strOrObj, store) {
};
CookieJar.fromJSON = CookieJar.deserializeSync;
CAN_BE_SYNC.push('clone');
CookieJar.prototype.clone = function(newStore, cb) {
if (arguments.length === 1) {
cb = newStore;
@@ -1375,10 +1381,61 @@ CookieJar.prototype.clone = function(newStore, cb) {
if (err) {
return cb(err);
}
CookieJar.deserialize(newStore, serialized, cb);
CookieJar.deserialize(serialized, newStore, cb);
});
};
CAN_BE_SYNC.push('removeAllCookies');
CookieJar.prototype.removeAllCookies = function(cb) {
var store = this.store;
// Check that the store implements its own removeAllCookies(). The default
// implementation in Store will immediately call the callback with a "not
// implemented" Error.
if (store.removeAllCookies instanceof Function &&
store.removeAllCookies !== Store.prototype.removeAllCookies)
{
return store.removeAllCookies(cb);
}
store.getAllCookies(function(err, cookies) {
if (err) {
return cb(err);
}
if (cookies.length === 0) {
return cb(null);
}
var completedCount = 0;
var removeErrors = [];
function removeCookieCb(removeErr) {
if (removeErr) {
removeErrors.push(removeErr);
}
completedCount++;
if (completedCount === cookies.length) {
return cb(removeErrors.length ? removeErrors[0] : null);
}
}
cookies.forEach(function(cookie) {
store.removeCookie(cookie.domain, cookie.path, cookie.key, removeCookieCb);
});
});
};
CookieJar.prototype._cloneSync = syncWrap('clone');
CookieJar.prototype.cloneSync = function(newStore) {
if (!newStore.synchronous) {
throw new Error('CookieJar clone destination store is not synchronous; use async API instead.');
}
return this._cloneSync(newStore);
};
// Use a closure to provide a true imperative API for synchronous stores.
function syncWrap(method) {
return function() {
@@ -1406,21 +1463,20 @@ CAN_BE_SYNC.forEach(function(method) {
CookieJar.prototype[method+'Sync'] = syncWrap(method);
});
module.exports = {
CookieJar: CookieJar,
Cookie: Cookie,
Store: Store,
MemoryCookieStore: MemoryCookieStore,
parseDate: parseDate,
formatDate: formatDate,
parse: parse,
fromJSON: fromJSON,
domainMatch: domainMatch,
defaultPath: defaultPath,
pathMatch: pathMatch,
getPublicSuffix: pubsuffix.getPublicSuffix,
cookieCompare: cookieCompare,
permuteDomain: require('./permuteDomain').permuteDomain,
permutePath: permutePath,
canonicalDomain: canonicalDomain
};
exports.version = VERSION;
exports.CookieJar = CookieJar;
exports.Cookie = Cookie;
exports.Store = Store;
exports.MemoryCookieStore = MemoryCookieStore;
exports.parseDate = parseDate;
exports.formatDate = formatDate;
exports.parse = parse;
exports.fromJSON = fromJSON;
exports.domainMatch = domainMatch;
exports.defaultPath = defaultPath;
exports.pathMatch = pathMatch;
exports.getPublicSuffix = pubsuffix.getPublicSuffix;
exports.cookieCompare = cookieCompare;
exports.permuteDomain = require('./permuteDomain').permuteDomain;
exports.permutePath = permutePath;
exports.canonicalDomain = canonicalDomain;