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

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

View File

@@ -50,6 +50,12 @@ MemoryCookieStore.prototype.inspect = function() {
return "{ idx: "+util.inspect(this.idx, false, 2)+' }';
};
// Use the new custom inspection symbol to add the custom inspect function if
// available.
if (util.inspect.custom) {
MemoryCookieStore.prototype[util.inspect.custom] = MemoryCookieStore.prototype.inspect;
}
MemoryCookieStore.prototype.findCookie = function(domain, path, key, cb) {
if (!this.idx[domain]) {
return cb(null,undefined);
@@ -143,6 +149,11 @@ MemoryCookieStore.prototype.removeCookies = function(domain, path, cb) {
return cb(null);
};
MemoryCookieStore.prototype.removeAllCookies = function(cb) {
this.idx = {};
return cb(null);
}
MemoryCookieStore.prototype.getAllCookies = function(cb) {
var cookies = [];
var idx = this.idx;

View File

@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
"use strict";
var pubsuffix = require('./pubsuffix');
var pubsuffix = require('./pubsuffix-psl');
// Gives the permutation of all possible domainMatch()es of a given domain. The
// array is in shortest-to-longest order. Handy for indexing.

38
node_modules/tough-cookie/lib/pubsuffix-psl.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
/*!
* Copyright (c) 2018, Salesforce.com, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of Salesforce.com nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
'use strict';
var psl = require('psl');
function getPublicSuffix(domain) {
return psl.get(domain);
}
exports.getPublicSuffix = getPublicSuffix;

File diff suppressed because one or more lines are too long

View File

@@ -66,6 +66,10 @@ Store.prototype.removeCookies = function(domain, path, cb) {
throw new Error('removeCookies is not implemented');
};
Store.prototype.removeAllCookies = function(cb) {
throw new Error('removeAllCookies is not implemented');
}
Store.prototype.getAllCookies = function(cb) {
throw new Error('getAllCookies is not implemented (therefore jar cannot be serialized)');
};

2
node_modules/tough-cookie/lib/version.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
// generated by genversion
module.exports = '2.5.0'