1
0
mirror of https://github.com/S2-/minifyfromhtml.git synced 2025-08-02 12:00:03 +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,4 +1,4 @@
Copyright © 2017 Domenic Denicola <d@domenic.me>
Copyright © 20172018 Domenic Denicola <d@domenic.me>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View File

@@ -24,7 +24,7 @@ console.assert(mimeType.isXML() === false);
Parsing is a fairly complex process; see [the specification](https://mimesniff.spec.whatwg.org/#parsing-a-mime-type) for details (and similarly [for serialization](https://mimesniff.spec.whatwg.org/#serializing-a-mime-type)).
This package's algorithms conform to those of the WHATWG [MIME Sniffing Standard](https://mimesniff.spec.whatwg.org/), and is aligned up to commit [cc81ec4](https://github.com/whatwg/mimesniff/commit/cc81ec48288944562c4554069da1d74a71e199fb).
This package's algorithms conform to those of the WHATWG [MIME Sniffing Standard](https://mimesniff.spec.whatwg.org/), and is aligned up to commit [126286a](https://github.com/whatwg/mimesniff/commit/126286ab2dcf3e2d541349ed93539a88bf394ad5).
## `MIMEType` API

View File

@@ -1,15 +1,15 @@
"use strict";
const {
removeLeadingAndTrailingASCIIWhitespace,
removeTrailingASCIIWhitespace,
isASCIIWhitespaceChar,
removeLeadingAndTrailingHTTPWhitespace,
removeTrailingHTTPWhitespace,
isHTTPWhitespaceChar,
solelyContainsHTTPTokenCodePoints,
soleyContainsHTTPQuotedStringTokenCodePoints,
asciiLowercase
} = require("./utils.js");
module.exports = input => {
input = removeLeadingAndTrailingASCIIWhitespace(input);
input = removeLeadingAndTrailingHTTPWhitespace(input);
let position = 0;
let type = "";
@@ -35,7 +35,7 @@ module.exports = input => {
++position;
}
subtype = removeTrailingASCIIWhitespace(subtype);
subtype = removeTrailingHTTPWhitespace(subtype);
if (subtype.length === 0 || !solelyContainsHTTPTokenCodePoints(subtype)) {
return null;
@@ -51,7 +51,7 @@ module.exports = input => {
// Skip past ";"
++position;
while (isASCIIWhitespaceChar(input[position])) {
while (isHTTPWhitespaceChar(input[position])) {
++position;
}
@@ -72,46 +72,47 @@ module.exports = input => {
}
let parameterValue = "";
if (position < input.length) {
if (input[position] === "\"") {
++position;
if (input[position] === "\"") {
++position;
while (true) {
while (position < input.length && input[position] !== "\"" && input[position] !== "\\") {
parameterValue += input[position];
++position;
}
if (position < input.length && input[position] === "\\") {
++position;
if (position < input.length) {
parameterValue += input[position];
++position;
continue;
} else {
parameterValue += "\\";
break;
}
} else {
break;
}
}
while (position < input.length && input[position] !== ";") {
++position;
}
} else {
while (position < input.length && input[position] !== ";") {
while (true) {
while (position < input.length && input[position] !== "\"" && input[position] !== "\\") {
parameterValue += input[position];
++position;
}
parameterValue = removeTrailingASCIIWhitespace(parameterValue);
if (position < input.length && input[position] === "\\") {
++position;
if (position < input.length) {
parameterValue += input[position];
++position;
continue;
} else {
parameterValue += "\\";
break;
}
} else {
break;
}
}
while (position < input.length && input[position] !== ";") {
++position;
}
} else {
while (position < input.length && input[position] !== ";") {
parameterValue += input[position];
++position;
}
parameterValue = removeTrailingHTTPWhitespace(parameterValue);
if (parameterValue === "") {
continue;
}
}
if (parameterName.length > 0 &&
parameterValue.length > 0 &&
solelyContainsHTTPTokenCodePoints(parameterName) &&
soleyContainsHTTPQuotedStringTokenCodePoints(parameterValue) &&
!mimeType.parameters.has(parameterName)) {

View File

@@ -13,7 +13,7 @@ module.exports = mimeType => {
serialization += name;
serialization += "=";
if (!solelyContainsHTTPTokenCodePoints(value)) {
if (!solelyContainsHTTPTokenCodePoints(value) || value.length === 0) {
value = value.replace(/(["\\])/g, "\\$1");
value = `"${value}"`;
}

View File

@@ -1,23 +1,23 @@
"use strict";
exports.removeLeadingAndTrailingASCIIWhitespace = string => {
return string.replace(/^[ \t\n\f\r]+/, "").replace(/[ \t\n\f\r]+$/, "");
exports.removeLeadingAndTrailingHTTPWhitespace = string => {
return string.replace(/^[ \t\n\r]+/, "").replace(/[ \t\n\r]+$/, "");
};
exports.removeTrailingASCIIWhitespace = string => {
return string.replace(/[ \t\n\f\r]+$/, "");
exports.removeTrailingHTTPWhitespace = string => {
return string.replace(/[ \t\n\r]+$/, "");
};
exports.isASCIIWhitespaceChar = char => {
return char === " " || char === "\t" || char === "\n" || char === "\f" || char === "\r";
exports.isHTTPWhitespaceChar = char => {
return char === " " || char === "\t" || char === "\n" || char === "\r";
};
exports.solelyContainsHTTPTokenCodePoints = string => {
return /^[-!#$%&'*+.^_`|~A-Za-z0-9]+$/.test(string);
return /^[-!#$%&'*+.^_`|~A-Za-z0-9]*$/.test(string);
};
exports.soleyContainsHTTPQuotedStringTokenCodePoints = string => {
return /^[\t\u0020-\u007E\u0080-\u00FF]+$/.test(string);
return /^[\t\u0020-\u007E\u0080-\u00FF]*$/.test(string);
};
exports.asciiLowercase = string => {

View File

@@ -1,28 +1,28 @@
{
"_from": "whatwg-mimetype@^2.1.0",
"_id": "whatwg-mimetype@2.1.0",
"_from": "whatwg-mimetype@^2.3.0",
"_id": "whatwg-mimetype@2.3.0",
"_inBundle": false,
"_integrity": "sha512-FKxhYLytBQiUKjkYteN71fAUA3g6KpNXoho1isLiLSB3N1G4F35Q5vUxWfKFhBwi5IWF27VE6WxhrnnC+m0Mew==",
"_integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==",
"_location": "/whatwg-mimetype",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "whatwg-mimetype@^2.1.0",
"raw": "whatwg-mimetype@^2.3.0",
"name": "whatwg-mimetype",
"escapedName": "whatwg-mimetype",
"rawSpec": "^2.1.0",
"rawSpec": "^2.3.0",
"saveSpec": null,
"fetchSpec": "^2.1.0"
"fetchSpec": "^2.3.0"
},
"_requiredBy": [
"/data-urls",
"/jsdom"
],
"_resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.1.0.tgz",
"_shasum": "f0f21d76cbba72362eb609dbed2a30cd17fcc7d4",
"_spec": "whatwg-mimetype@^2.1.0",
"_where": "/home/s2/Documents/Code/minifyfromhtml/node_modules/jsdom",
"_resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz",
"_shasum": "3d4b1e0312d2079879f826aff18dbeeca5960fbf",
"_spec": "whatwg-mimetype@^2.3.0",
"_where": "E:\\projects\\p\\minifyfromhtml\\node_modules\\jsdom",
"author": {
"name": "Domenic Denicola",
"email": "d@domenic.me",
@@ -35,11 +35,11 @@
"deprecated": false,
"description": "Parses, serializes, and manipulates MIME types, according to the WHATWG MIME Sniffing Standard",
"devDependencies": {
"eslint": "^4.12.1",
"jest": "^21.2.1",
"eslint": "^5.9.0",
"jest": "^23.6.0",
"printable-string": "^0.3.0",
"request": "^2.83.0",
"whatwg-encoding": "^1.0.3"
"request": "^2.88.0",
"whatwg-encoding": "^1.0.5"
},
"files": [
"lib/"
@@ -76,5 +76,5 @@
"pretest": "node scripts/get-latest-platform-tests.js",
"test": "jest"
},
"version": "2.1.0"
"version": "2.3.0"
}