mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-02 20:00:05 +02:00
update node modules
This commit is contained in:
9
node_modules/abab/CHANGELOG.md
generated
vendored
9
node_modules/abab/CHANGELOG.md
generated
vendored
@@ -1,3 +1,12 @@
|
||||
## 2.0.0
|
||||
|
||||
Modernization updates thanks to @TimothyGu:
|
||||
|
||||
- Use jsdom's eslint config, remove jscs
|
||||
- Move syntax to ES6
|
||||
- Remove Babel
|
||||
- Via: https://github.com/jsdom/abab/pull/26
|
||||
|
||||
## 1.0.4
|
||||
|
||||
- Added license file
|
||||
|
16
node_modules/abab/README.md
generated
vendored
16
node_modules/abab/README.md
generated
vendored
@@ -1,10 +1,8 @@
|
||||
# abab
|
||||
# abab [](https://www.npmjs.com/package/abab) [](https://travis-ci.org/jsdom/abab)
|
||||
|
||||
[](https://www.npmjs.com/package/abab) [](https://travis-ci.org/jsdom/abab)
|
||||
A JavaScript module that implements `window.atob` and `window.btoa` according the forgiving-base64 algorithm in the [Infra Standard](https://infra.spec.whatwg.org/#forgiving-base64). The original code was forked from [w3c/web-platform-tests](https://github.com/w3c/web-platform-tests/blob/master/html/webappapis/atob/base64.html).
|
||||
|
||||
A module that implements `window.atob` and `window.btoa` according to the [WHATWG spec](https://html.spec.whatwg.org/multipage/webappapis.html#atob). The code is originally from [w3c/web-platform-tests](https://github.com/w3c/web-platform-tests/blob/master/html/webappapis/atob/base64.html).
|
||||
|
||||
Compatibility: Node.js version 3+ and all major browsers (using browserify or webpack)
|
||||
Compatibility: Node.js version 3+ and all major browsers.
|
||||
|
||||
Install with `npm`:
|
||||
|
||||
@@ -17,14 +15,14 @@ npm install abab
|
||||
### `btoa` (base64 encode)
|
||||
|
||||
```js
|
||||
const btoa = require('abab').btoa;
|
||||
const { btoa } = require('abab');
|
||||
btoa('Hello, world!'); // 'SGVsbG8sIHdvcmxkIQ=='
|
||||
```
|
||||
|
||||
### `atob` (base64 decode)
|
||||
|
||||
```js
|
||||
const atob = require('abab').atob;
|
||||
const { atob } = require('abab');
|
||||
atob('SGVsbG8sIHdvcmxkIQ=='); // 'Hello, world!'
|
||||
```
|
||||
|
||||
@@ -37,8 +35,8 @@ atob('SGVsbG8sIHdvcmxkIQ=='); // 'Hello, world!'
|
||||
If you want to include just one of the methods to save bytes in your client-side code, you can `require` the desired module directly.
|
||||
|
||||
```js
|
||||
var atob = require('abab/lib/atob');
|
||||
var btoa = require('abab/lib/btoa');
|
||||
const atob = require('abab/lib/atob');
|
||||
const btoa = require('abab/lib/btoa');
|
||||
```
|
||||
|
||||
-----
|
||||
|
10
node_modules/abab/index.js
generated
vendored
10
node_modules/abab/index.js
generated
vendored
@@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
var atob = require('./lib/atob');
|
||||
var btoa = require('./lib/btoa');
|
||||
const atob = require("./lib/atob");
|
||||
const btoa = require("./lib/btoa");
|
||||
|
||||
module.exports = {
|
||||
atob: atob,
|
||||
btoa: btoa
|
||||
atob,
|
||||
btoa
|
||||
};
|
||||
|
118
node_modules/abab/lib/atob.js
generated
vendored
118
node_modules/abab/lib/atob.js
generated
vendored
@@ -1,81 +1,78 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Implementation of atob() according to the HTML spec, except that instead of
|
||||
* throwing INVALID_CHARACTER_ERR we return null.
|
||||
* Implementation of atob() according to the HTML and Infra specs, except that
|
||||
* instead of throwing INVALID_CHARACTER_ERR we return null.
|
||||
*/
|
||||
function atob(input) {
|
||||
// WebIDL requires DOMStrings to just be converted using ECMAScript
|
||||
// ToString, which in our case amounts to calling String().
|
||||
input = String(input);
|
||||
// "Remove all space characters from input."
|
||||
input = input.replace(/[ \t\n\f\r]/g, '');
|
||||
// "If the length of input divides by 4 leaving no remainder, then: if
|
||||
// input ends with one or two U+003D EQUALS SIGN (=) characters, remove
|
||||
// them from input."
|
||||
if (input.length % 4 == 0 && /==?$/.test(input)) {
|
||||
input = input.replace(/==?$/, '');
|
||||
function atob(data) {
|
||||
// Web IDL requires DOMStrings to just be converted using ECMAScript
|
||||
// ToString, which in our case amounts to using a template literal.
|
||||
data = `${data}`;
|
||||
// "Remove all ASCII whitespace from data."
|
||||
data = data.replace(/[ \t\n\f\r]/g, "");
|
||||
// "If data's length divides by 4 leaving no remainder, then: if data ends
|
||||
// with one or two U+003D (=) code points, then remove them from data."
|
||||
if (data.length % 4 === 0) {
|
||||
data = data.replace(/==?$/, "");
|
||||
}
|
||||
// "If the length of input divides by 4 leaving a remainder of 1, throw an
|
||||
// INVALID_CHARACTER_ERR exception and abort these steps."
|
||||
// "If data's length divides by 4 leaving a remainder of 1, then return
|
||||
// failure."
|
||||
//
|
||||
// "If input contains a character that is not in the following list of
|
||||
// characters and character ranges, throw an INVALID_CHARACTER_ERR
|
||||
// exception and abort these steps:
|
||||
// "If data contains a code point that is not one of
|
||||
//
|
||||
// U+002B PLUS SIGN (+)
|
||||
// U+002F SOLIDUS (/)
|
||||
// U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9)
|
||||
// U+0041 LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER Z
|
||||
// U+0061 LATIN SMALL LETTER A to U+007A LATIN SMALL LETTER Z"
|
||||
if (input.length % 4 == 1 || !/^[+/0-9A-Za-z]*$/.test(input)) {
|
||||
// U+002B (+)
|
||||
// U+002F (/)
|
||||
// ASCII alphanumeric
|
||||
//
|
||||
// then return failure."
|
||||
if (data.length % 4 === 1 || /[^+/0-9A-Za-z]/.test(data)) {
|
||||
return null;
|
||||
}
|
||||
// "Let output be a string, initially empty."
|
||||
var output = '';
|
||||
// "Let buffer be a buffer that can have bits appended to it, initially
|
||||
// empty."
|
||||
// "Let output be an empty byte sequence."
|
||||
let output = "";
|
||||
// "Let buffer be an empty buffer that can have bits appended to it."
|
||||
//
|
||||
// We append bits via left-shift and or. accumulatedBits is used to track
|
||||
// when we've gotten to 24 bits.
|
||||
var buffer = 0;
|
||||
var accumulatedBits = 0;
|
||||
// "While position does not point past the end of input, run these
|
||||
// substeps:"
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
// "Find the character pointed to by position in the first column of
|
||||
// the following table. Let n be the number given in the second cell of
|
||||
// the same row."
|
||||
let buffer = 0;
|
||||
let accumulatedBits = 0;
|
||||
// "Let position be a position variable for data, initially pointing at the
|
||||
// start of data."
|
||||
//
|
||||
// "While position does not point past the end of data:"
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
// "Find the code point pointed to by position in the second column of
|
||||
// Table 1: The Base 64 Alphabet of RFC 4648. Let n be the number given in
|
||||
// the first cell of the same row.
|
||||
//
|
||||
// "Append to buffer the six bits corresponding to number, most
|
||||
// significant bit first."
|
||||
// "Append to buffer the six bits corresponding to n, most significant bit
|
||||
// first."
|
||||
//
|
||||
// atobLookup() implements the table from the spec.
|
||||
// atobLookup() implements the table from RFC 4648.
|
||||
buffer <<= 6;
|
||||
buffer |= atobLookup(input[i]);
|
||||
// "If buffer has accumulated 24 bits, interpret them as three 8-bit
|
||||
// big-endian numbers. Append the three characters with code points
|
||||
// equal to those numbers to output, in the same order, and then empty
|
||||
// buffer."
|
||||
buffer |= atobLookup(data[i]);
|
||||
accumulatedBits += 6;
|
||||
if (accumulatedBits == 24) {
|
||||
// "If buffer has accumulated 24 bits, interpret them as three 8-bit
|
||||
// big-endian numbers. Append three bytes with values equal to those
|
||||
// numbers to output, in the same order, and then empty buffer."
|
||||
if (accumulatedBits === 24) {
|
||||
output += String.fromCharCode((buffer & 0xff0000) >> 16);
|
||||
output += String.fromCharCode((buffer & 0xff00) >> 8);
|
||||
output += String.fromCharCode(buffer & 0xff);
|
||||
buffer = accumulatedBits = 0;
|
||||
}
|
||||
// "Advance position by one character."
|
||||
// "Advance position by 1."
|
||||
}
|
||||
// "If buffer is not empty, it contains either 12 or 18 bits. If it
|
||||
// contains 12 bits, discard the last four and interpret the remaining
|
||||
// eight as an 8-bit big-endian number. If it contains 18 bits, discard the
|
||||
// last two and interpret the remaining 16 as two 8-bit big-endian numbers.
|
||||
// Append the one or two characters with code points equal to those one or
|
||||
// two numbers to output, in the same order."
|
||||
if (accumulatedBits == 12) {
|
||||
// "If buffer is not empty, it contains either 12 or 18 bits. If it contains
|
||||
// 12 bits, then discard the last four and interpret the remaining eight as
|
||||
// an 8-bit big-endian number. If it contains 18 bits, then discard the last
|
||||
// two and interpret the remaining 16 as two 8-bit big-endian numbers. Append
|
||||
// the one or two bytes with values equal to those one or two numbers to
|
||||
// output, in the same order."
|
||||
if (accumulatedBits === 12) {
|
||||
buffer >>= 4;
|
||||
output += String.fromCharCode(buffer);
|
||||
} else if (accumulatedBits == 18) {
|
||||
} else if (accumulatedBits === 18) {
|
||||
buffer >>= 2;
|
||||
output += String.fromCharCode((buffer & 0xff00) >> 8);
|
||||
output += String.fromCharCode(buffer & 0xff);
|
||||
@@ -89,21 +86,22 @@ function atob(input) {
|
||||
*/
|
||||
function atobLookup(chr) {
|
||||
if (/[A-Z]/.test(chr)) {
|
||||
return chr.charCodeAt(0) - 'A'.charCodeAt(0);
|
||||
return chr.charCodeAt(0) - "A".charCodeAt(0);
|
||||
}
|
||||
if (/[a-z]/.test(chr)) {
|
||||
return chr.charCodeAt(0) - 'a'.charCodeAt(0) + 26;
|
||||
return chr.charCodeAt(0) - "a".charCodeAt(0) + 26;
|
||||
}
|
||||
if (/[0-9]/.test(chr)) {
|
||||
return chr.charCodeAt(0) - '0'.charCodeAt(0) + 52;
|
||||
return chr.charCodeAt(0) - "0".charCodeAt(0) + 52;
|
||||
}
|
||||
if (chr == '+') {
|
||||
if (chr === "+") {
|
||||
return 62;
|
||||
}
|
||||
if (chr == '/') {
|
||||
if (chr === "/") {
|
||||
return 63;
|
||||
}
|
||||
// Throw exception; should not be hit in tests
|
||||
return undefined;
|
||||
}
|
||||
|
||||
module.exports = atob;
|
||||
|
41
node_modules/abab/lib/btoa.js
generated
vendored
41
node_modules/abab/lib/btoa.js
generated
vendored
@@ -1,23 +1,23 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* btoa() as defined by the HTML5 spec, which mostly just references RFC4648.
|
||||
* btoa() as defined by the HTML and Infra specs, which mostly just references
|
||||
* RFC 4648.
|
||||
*/
|
||||
function btoa(s) {
|
||||
var i;
|
||||
// String conversion as required by WebIDL.
|
||||
s = String(s);
|
||||
// "The btoa() method must throw an INVALID_CHARACTER_ERR exception if the
|
||||
// method's first argument contains any character whose code point is
|
||||
// greater than U+00FF."
|
||||
let i;
|
||||
// String conversion as required by Web IDL.
|
||||
s = `${s}`;
|
||||
// "The btoa() method must throw an "InvalidCharacterError" DOMException if
|
||||
// data contains any character whose code point is greater than U+00FF."
|
||||
for (i = 0; i < s.length; i++) {
|
||||
if (s.charCodeAt(i) > 255) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
var out = '';
|
||||
let out = "";
|
||||
for (i = 0; i < s.length; i += 3) {
|
||||
var groupsOfSix = [undefined, undefined, undefined, undefined];
|
||||
const groupsOfSix = [undefined, undefined, undefined, undefined];
|
||||
groupsOfSix[0] = s.charCodeAt(i) >> 2;
|
||||
groupsOfSix[1] = (s.charCodeAt(i) & 0x03) << 4;
|
||||
if (s.length > i + 1) {
|
||||
@@ -28,9 +28,9 @@ function btoa(s) {
|
||||
groupsOfSix[2] |= s.charCodeAt(i + 2) >> 6;
|
||||
groupsOfSix[3] = s.charCodeAt(i + 2) & 0x3f;
|
||||
}
|
||||
for (var j = 0; j < groupsOfSix.length; j++) {
|
||||
if (typeof groupsOfSix[j] == 'undefined') {
|
||||
out += '=';
|
||||
for (let j = 0; j < groupsOfSix.length; j++) {
|
||||
if (typeof groupsOfSix[j] === "undefined") {
|
||||
out += "=";
|
||||
} else {
|
||||
out += btoaLookup(groupsOfSix[j]);
|
||||
}
|
||||
@@ -45,21 +45,22 @@ function btoa(s) {
|
||||
*/
|
||||
function btoaLookup(idx) {
|
||||
if (idx < 26) {
|
||||
return String.fromCharCode(idx + 'A'.charCodeAt(0));
|
||||
return String.fromCharCode(idx + "A".charCodeAt(0));
|
||||
}
|
||||
if (idx < 52) {
|
||||
return String.fromCharCode(idx - 26 + 'a'.charCodeAt(0));
|
||||
return String.fromCharCode(idx - 26 + "a".charCodeAt(0));
|
||||
}
|
||||
if (idx < 62) {
|
||||
return String.fromCharCode(idx - 52 + '0'.charCodeAt(0));
|
||||
return String.fromCharCode(idx - 52 + "0".charCodeAt(0));
|
||||
}
|
||||
if (idx == 62) {
|
||||
return '+';
|
||||
if (idx === 62) {
|
||||
return "+";
|
||||
}
|
||||
if (idx == 63) {
|
||||
return '/';
|
||||
if (idx === 63) {
|
||||
return "/";
|
||||
}
|
||||
// Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the tests.
|
||||
return undefined;
|
||||
}
|
||||
|
||||
module.exports = btoa;
|
||||
|
47
node_modules/abab/package.json
generated
vendored
47
node_modules/abab/package.json
generated
vendored
@@ -1,28 +1,28 @@
|
||||
{
|
||||
"_from": "abab@^1.0.4",
|
||||
"_id": "abab@1.0.4",
|
||||
"_from": "abab@^2.0.0",
|
||||
"_id": "abab@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=",
|
||||
"_integrity": "sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w==",
|
||||
"_location": "/abab",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "abab@^1.0.4",
|
||||
"raw": "abab@^2.0.0",
|
||||
"name": "abab",
|
||||
"escapedName": "abab",
|
||||
"rawSpec": "^1.0.4",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.4"
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/data-urls",
|
||||
"/jsdom"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz",
|
||||
"_shasum": "5faad9c2c07f60dd76770f71cf025b62a63cfd4e",
|
||||
"_spec": "abab@^1.0.4",
|
||||
"_where": "/home/s2/Documents/Code/minifyfromhtml/node_modules/jsdom",
|
||||
"_resolved": "https://registry.npmjs.org/abab/-/abab-2.0.0.tgz",
|
||||
"_shasum": "aba0ab4c5eee2d4c79d3487d85450fb2376ebb0f",
|
||||
"_spec": "abab@^2.0.0",
|
||||
"_where": "E:\\projects\\p\\minifyfromhtml\\node_modules\\jsdom",
|
||||
"author": {
|
||||
"name": "Jeff Carpenter",
|
||||
"email": "gcarpenterv@gmail.com"
|
||||
@@ -34,19 +34,14 @@
|
||||
"deprecated": false,
|
||||
"description": "WHATWG spec-compliant implementations of window.atob and window.btoa.",
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.1.4",
|
||||
"babel-loader": "^6.1.0",
|
||||
"babel-preset-es2015": "^6.1.4",
|
||||
"eslint": "^1.3.1",
|
||||
"jscs": "^2.1.1",
|
||||
"karma": "^0.13.10",
|
||||
"karma-cli": "^0.1.1",
|
||||
"karma-firefox-launcher": "^0.1.6",
|
||||
"karma-mocha": "^0.2.0",
|
||||
"karma-sauce-launcher": "^0.2.14",
|
||||
"karma-webpack": "^1.7.0",
|
||||
"mocha": "^2.2.5",
|
||||
"webpack": "^1.12.2"
|
||||
"eslint": "^4.19.1",
|
||||
"karma": "^2.0.0",
|
||||
"karma-cli": "^1.0.1",
|
||||
"karma-firefox-launcher": "^1.1.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"karma-webpack": "^3.0.0",
|
||||
"mocha": "^5.1.0",
|
||||
"webpack": "^4.5.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
@@ -58,7 +53,7 @@
|
||||
"btoa",
|
||||
"browser"
|
||||
],
|
||||
"license": "ISC",
|
||||
"license": "SEE LICENSE IN LICENSE.md",
|
||||
"main": "index.js",
|
||||
"name": "abab",
|
||||
"repository": {
|
||||
@@ -67,9 +62,9 @@
|
||||
},
|
||||
"scripts": {
|
||||
"karma": "karma start",
|
||||
"lint": "jscs . && eslint .",
|
||||
"lint": "eslint .",
|
||||
"mocha": "mocha test/node",
|
||||
"test": "npm run lint && npm run mocha && npm run karma"
|
||||
},
|
||||
"version": "1.0.4"
|
||||
"version": "2.0.0"
|
||||
}
|
||||
|
Reference in New Issue
Block a user