mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-02 12:00:03 +02:00
update packages to latest version
This commit is contained in:
2
node_modules/whatwg-mimetype/LICENSE.txt
generated
vendored
2
node_modules/whatwg-mimetype/LICENSE.txt
generated
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright © 2017–2018 Domenic Denicola <d@domenic.me>
|
||||
Copyright © 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:
|
||||
|
||||
|
4
node_modules/whatwg-mimetype/README.md
generated
vendored
4
node_modules/whatwg-mimetype/README.md
generated
vendored
@@ -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 [126286a](https://github.com/whatwg/mimesniff/commit/126286ab2dcf3e2d541349ed93539a88bf394ad5).
|
||||
This package's algorithms conform to those of the WHATWG [MIME Sniffing Standard](https://mimesniff.spec.whatwg.org/), and is aligned up to commit [8e9a7dd](https://github.com/whatwg/mimesniff/commit/8e9a7dd90717c595a4e4d982cd216e4411d33736).
|
||||
|
||||
## `MIMEType` API
|
||||
|
||||
@@ -52,7 +52,7 @@ As an alternative to the constructor, you can use `MIMEType.parse(string)`. The
|
||||
- `toString()` serializes the MIME type to a string
|
||||
- `isHTML()`: returns true if this instance represents [a HTML MIME type](https://mimesniff.spec.whatwg.org/#html-mime-type)
|
||||
- `isXML()`: returns true if this instance represents [an XML MIME type](https://mimesniff.spec.whatwg.org/#xml-mime-type)
|
||||
- `isJavaScript({ allowParameters })`: returns true if this instance represents [a JavaScript MIME type](https://html.spec.whatwg.org/multipage/scripting.html#javascript-mime-type); `allowParameters` can be set to true to allow arbitrary parameters, instead of their presence causing the method to return `false`
|
||||
- `isJavaScript({ prohibitParameters })`: returns true if this instance represents [a JavaScript MIME type](https://html.spec.whatwg.org/multipage/scripting.html#javascript-mime-type). `prohibitParameters` can be set to true to disallow any parameters, i.e. to test if the MIME type's serialization is a [JavaScript MIME type essence match](https://mimesniff.spec.whatwg.org/#javascript-mime-type-essence-match).
|
||||
|
||||
_Note: the `isHTML()`, `isXML()`, and `isJavaScript()` methods are speculative, and may be removed or changed in future major versions. See [whatwg/mimesniff#48](https://github.com/whatwg/mimesniff/issues/48) for brainstorming in this area. Currently we implement these mainly because they are useful in jsdom._
|
||||
|
||||
|
70
node_modules/whatwg-mimetype/lib/mime-type-parameters.js
generated
vendored
Normal file
70
node_modules/whatwg-mimetype/lib/mime-type-parameters.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
const {
|
||||
asciiLowercase,
|
||||
solelyContainsHTTPTokenCodePoints,
|
||||
soleyContainsHTTPQuotedStringTokenCodePoints
|
||||
} = require("./utils.js");
|
||||
|
||||
module.exports = class MIMETypeParameters {
|
||||
constructor(map) {
|
||||
this._map = map;
|
||||
}
|
||||
|
||||
get size() {
|
||||
return this._map.size;
|
||||
}
|
||||
|
||||
get(name) {
|
||||
name = asciiLowercase(String(name));
|
||||
return this._map.get(name);
|
||||
}
|
||||
|
||||
has(name) {
|
||||
name = asciiLowercase(String(name));
|
||||
return this._map.has(name);
|
||||
}
|
||||
|
||||
set(name, value) {
|
||||
name = asciiLowercase(String(name));
|
||||
value = String(value);
|
||||
|
||||
if (!solelyContainsHTTPTokenCodePoints(name)) {
|
||||
throw new Error(`Invalid MIME type parameter name "${name}": only HTTP token code points are valid.`);
|
||||
}
|
||||
if (!soleyContainsHTTPQuotedStringTokenCodePoints(value)) {
|
||||
throw new Error(`Invalid MIME type parameter value "${value}": only HTTP quoted-string token code points are ` +
|
||||
`valid.`);
|
||||
}
|
||||
|
||||
return this._map.set(name, value);
|
||||
}
|
||||
|
||||
clear() {
|
||||
this._map.clear();
|
||||
}
|
||||
|
||||
delete(name) {
|
||||
name = asciiLowercase(String(name));
|
||||
return this._map.delete(name);
|
||||
}
|
||||
|
||||
forEach(callbackFn, thisArg) {
|
||||
this._map.forEach(callbackFn, thisArg);
|
||||
}
|
||||
|
||||
keys() {
|
||||
return this._map.keys();
|
||||
}
|
||||
|
||||
values() {
|
||||
return this._map.values();
|
||||
}
|
||||
|
||||
entries() {
|
||||
return this._map.entries();
|
||||
}
|
||||
|
||||
[Symbol.iterator]() {
|
||||
return this._map[Symbol.iterator]();
|
||||
}
|
||||
};
|
74
node_modules/whatwg-mimetype/lib/mime-type.js
generated
vendored
74
node_modules/whatwg-mimetype/lib/mime-type.js
generated
vendored
@@ -1,10 +1,10 @@
|
||||
"use strict";
|
||||
const MIMETypeParameters = require("./mime-type-parameters.js");
|
||||
const parse = require("./parser.js");
|
||||
const serialize = require("./serializer.js");
|
||||
const {
|
||||
asciiLowercase,
|
||||
solelyContainsHTTPTokenCodePoints,
|
||||
soleyContainsHTTPQuotedStringTokenCodePoints
|
||||
solelyContainsHTTPTokenCodePoints
|
||||
} = require("./utils.js");
|
||||
|
||||
module.exports = class MIMEType {
|
||||
@@ -76,7 +76,7 @@ module.exports = class MIMEType {
|
||||
return serialize(this);
|
||||
}
|
||||
|
||||
isJavaScript({ allowParameters = false } = {}) {
|
||||
isJavaScript({ prohibitParameters = false } = {}) {
|
||||
switch (this._type) {
|
||||
case "text": {
|
||||
switch (this._subtype) {
|
||||
@@ -92,7 +92,7 @@ module.exports = class MIMEType {
|
||||
case "livescript":
|
||||
case "x-ecmascript":
|
||||
case "x-javascript": {
|
||||
return allowParameters || this._parameters.size === 0;
|
||||
return !prohibitParameters || this._parameters.size === 0;
|
||||
}
|
||||
default: {
|
||||
return false;
|
||||
@@ -105,7 +105,7 @@ module.exports = class MIMEType {
|
||||
case "javascript":
|
||||
case "x-ecmascript":
|
||||
case "x-javascript": {
|
||||
return allowParameters || this._parameters.size === 0;
|
||||
return !prohibitParameters || this._parameters.size === 0;
|
||||
}
|
||||
default: {
|
||||
return false;
|
||||
@@ -125,67 +125,3 @@ module.exports = class MIMEType {
|
||||
return this._subtype === "html" && this._type === "text";
|
||||
}
|
||||
};
|
||||
|
||||
class MIMETypeParameters {
|
||||
constructor(map) {
|
||||
this._map = map;
|
||||
}
|
||||
|
||||
get size() {
|
||||
return this._map.size;
|
||||
}
|
||||
|
||||
get(name) {
|
||||
name = asciiLowercase(String(name));
|
||||
return this._map.get(name);
|
||||
}
|
||||
|
||||
has(name) {
|
||||
name = asciiLowercase(String(name));
|
||||
return this._map.has(name);
|
||||
}
|
||||
|
||||
set(name, value) {
|
||||
name = asciiLowercase(String(name));
|
||||
value = String(value);
|
||||
|
||||
if (!solelyContainsHTTPTokenCodePoints(name)) {
|
||||
throw new Error(`Invalid MIME type parameter name "${name}": only HTTP token code points are valid.`);
|
||||
}
|
||||
if (!soleyContainsHTTPQuotedStringTokenCodePoints(value)) {
|
||||
throw new Error(`Invalid MIME type parameter value "${value}": only HTTP quoted-string token code points are ` +
|
||||
`valid.`);
|
||||
}
|
||||
|
||||
return this._map.set(name, value);
|
||||
}
|
||||
|
||||
clear() {
|
||||
this._map.clear();
|
||||
}
|
||||
|
||||
delete(name) {
|
||||
name = asciiLowercase(String(name));
|
||||
return this._map.delete(name);
|
||||
}
|
||||
|
||||
forEach(callbackFn, thisArg) {
|
||||
this._map.forEach(callbackFn, thisArg);
|
||||
}
|
||||
|
||||
keys() {
|
||||
return this._map.keys();
|
||||
}
|
||||
|
||||
values() {
|
||||
return this._map.values();
|
||||
}
|
||||
|
||||
entries() {
|
||||
return this._map.entries();
|
||||
}
|
||||
|
||||
[Symbol.iterator]() {
|
||||
return this._map[Symbol.iterator]();
|
||||
}
|
||||
}
|
||||
|
29
node_modules/whatwg-mimetype/lib/parser.js
generated
vendored
29
node_modules/whatwg-mimetype/lib/parser.js
generated
vendored
@@ -5,7 +5,8 @@ const {
|
||||
isHTTPWhitespaceChar,
|
||||
solelyContainsHTTPTokenCodePoints,
|
||||
soleyContainsHTTPQuotedStringTokenCodePoints,
|
||||
asciiLowercase
|
||||
asciiLowercase,
|
||||
collectAnHTTPQuotedString
|
||||
} = require("./utils.js");
|
||||
|
||||
module.exports = input => {
|
||||
@@ -71,35 +72,15 @@ module.exports = input => {
|
||||
++position;
|
||||
}
|
||||
|
||||
let parameterValue = "";
|
||||
let parameterValue = null;
|
||||
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;
|
||||
}
|
||||
}
|
||||
[parameterValue, position] = collectAnHTTPQuotedString(input, position);
|
||||
|
||||
while (position < input.length && input[position] !== ";") {
|
||||
++position;
|
||||
}
|
||||
} else {
|
||||
parameterValue = "";
|
||||
while (position < input.length && input[position] !== ";") {
|
||||
parameterValue += input[position];
|
||||
++position;
|
||||
|
2
node_modules/whatwg-mimetype/lib/serializer.js
generated
vendored
2
node_modules/whatwg-mimetype/lib/serializer.js
generated
vendored
@@ -14,7 +14,7 @@ module.exports = mimeType => {
|
||||
serialization += "=";
|
||||
|
||||
if (!solelyContainsHTTPTokenCodePoints(value) || value.length === 0) {
|
||||
value = value.replace(/(["\\])/g, "\\$1");
|
||||
value = value.replace(/(["\\])/ug, "\\$1");
|
||||
value = `"${value}"`;
|
||||
}
|
||||
|
||||
|
45
node_modules/whatwg-mimetype/lib/utils.js
generated
vendored
45
node_modules/whatwg-mimetype/lib/utils.js
generated
vendored
@@ -1,11 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
exports.removeLeadingAndTrailingHTTPWhitespace = string => {
|
||||
return string.replace(/^[ \t\n\r]+/, "").replace(/[ \t\n\r]+$/, "");
|
||||
return string.replace(/^[ \t\n\r]+/u, "").replace(/[ \t\n\r]+$/u, "");
|
||||
};
|
||||
|
||||
exports.removeTrailingHTTPWhitespace = string => {
|
||||
return string.replace(/[ \t\n\r]+$/, "");
|
||||
return string.replace(/[ \t\n\r]+$/u, "");
|
||||
};
|
||||
|
||||
exports.isHTTPWhitespaceChar = char => {
|
||||
@@ -13,13 +13,48 @@ exports.isHTTPWhitespaceChar = char => {
|
||||
};
|
||||
|
||||
exports.solelyContainsHTTPTokenCodePoints = string => {
|
||||
return /^[-!#$%&'*+.^_`|~A-Za-z0-9]*$/.test(string);
|
||||
return /^[-!#$%&'*+.^_`|~A-Za-z0-9]*$/u.test(string);
|
||||
};
|
||||
|
||||
exports.soleyContainsHTTPQuotedStringTokenCodePoints = string => {
|
||||
return /^[\t\u0020-\u007E\u0080-\u00FF]*$/.test(string);
|
||||
return /^[\t\u0020-\u007E\u0080-\u00FF]*$/u.test(string);
|
||||
};
|
||||
|
||||
exports.asciiLowercase = string => {
|
||||
return string.replace(/[A-Z]/g, l => l.toLowerCase());
|
||||
return string.replace(/[A-Z]/ug, l => l.toLowerCase());
|
||||
};
|
||||
|
||||
// This variant only implements it with the extract-value flag set.
|
||||
exports.collectAnHTTPQuotedString = (input, position) => {
|
||||
let value = "";
|
||||
|
||||
position++;
|
||||
|
||||
while (true) {
|
||||
while (position < input.length && input[position] !== "\"" && input[position] !== "\\") {
|
||||
value += input[position];
|
||||
++position;
|
||||
}
|
||||
|
||||
if (position >= input.length) {
|
||||
break;
|
||||
}
|
||||
|
||||
const quoteOrBackslash = input[position];
|
||||
++position;
|
||||
|
||||
if (quoteOrBackslash === "\\") {
|
||||
if (position >= input.length) {
|
||||
value += "\\";
|
||||
break;
|
||||
}
|
||||
|
||||
value += input[position];
|
||||
++position;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return [value, position];
|
||||
};
|
||||
|
32
node_modules/whatwg-mimetype/package.json
generated
vendored
32
node_modules/whatwg-mimetype/package.json
generated
vendored
@@ -1,27 +1,27 @@
|
||||
{
|
||||
"_from": "whatwg-mimetype@^2.3.0",
|
||||
"_id": "whatwg-mimetype@2.3.0",
|
||||
"_from": "whatwg-mimetype@^3.0.0",
|
||||
"_id": "whatwg-mimetype@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==",
|
||||
"_integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==",
|
||||
"_location": "/whatwg-mimetype",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "whatwg-mimetype@^2.3.0",
|
||||
"raw": "whatwg-mimetype@^3.0.0",
|
||||
"name": "whatwg-mimetype",
|
||||
"escapedName": "whatwg-mimetype",
|
||||
"rawSpec": "^2.3.0",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.3.0"
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/data-urls",
|
||||
"/jsdom"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz",
|
||||
"_shasum": "3d4b1e0312d2079879f826aff18dbeeca5960fbf",
|
||||
"_spec": "whatwg-mimetype@^2.3.0",
|
||||
"_resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz",
|
||||
"_shasum": "5fa1a7623867ff1af6ca3dc72ad6b8a4208beba7",
|
||||
"_spec": "whatwg-mimetype@^3.0.0",
|
||||
"_where": "D:\\Projects\\minifyfromhtml\\node_modules\\jsdom",
|
||||
"author": {
|
||||
"name": "Domenic Denicola",
|
||||
@@ -35,11 +35,15 @@
|
||||
"deprecated": false,
|
||||
"description": "Parses, serializes, and manipulates MIME types, according to the WHATWG MIME Sniffing Standard",
|
||||
"devDependencies": {
|
||||
"eslint": "^5.9.0",
|
||||
"jest": "^23.6.0",
|
||||
"@domenic/eslint-config": "^1.4.0",
|
||||
"eslint": "^7.32.0",
|
||||
"jest": "^27.2.0",
|
||||
"minipass-fetch": "^1.4.1",
|
||||
"printable-string": "^0.3.0",
|
||||
"request": "^2.88.0",
|
||||
"whatwg-encoding": "^1.0.5"
|
||||
"whatwg-encoding": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"files": [
|
||||
"lib/"
|
||||
@@ -76,5 +80,5 @@
|
||||
"pretest": "node scripts/get-latest-platform-tests.js",
|
||||
"test": "jest"
|
||||
},
|
||||
"version": "2.3.0"
|
||||
"version": "3.0.0"
|
||||
}
|
||||
|
Reference in New Issue
Block a user