mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 20:30:04 +02:00
update packages to latest version
This commit is contained in:
15
node_modules/data-urls/lib/parser.js
generated
vendored
15
node_modules/data-urls/lib/parser.js
generated
vendored
@@ -1,12 +1,7 @@
|
||||
"use strict";
|
||||
const MIMEType = require("whatwg-mimetype");
|
||||
const { parseURL, serializeURL } = require("whatwg-url");
|
||||
const {
|
||||
stripLeadingAndTrailingASCIIWhitespace,
|
||||
stringPercentDecode,
|
||||
isomorphicDecode,
|
||||
forgivingBase64Decode
|
||||
} = require("./utils.js");
|
||||
const { parseURL, serializeURL, percentDecodeString } = require("whatwg-url");
|
||||
const { stripLeadingAndTrailingASCIIWhitespace, isomorphicDecode, forgivingBase64Decode } = require("./utils.js");
|
||||
|
||||
module.exports = stringInput => {
|
||||
const urlRecord = parseURL(stringInput);
|
||||
@@ -42,10 +37,10 @@ module.exports.fromURLRecord = urlRecord => {
|
||||
|
||||
const encodedBody = input.substring(position);
|
||||
|
||||
let body = stringPercentDecode(encodedBody);
|
||||
let body = percentDecodeString(encodedBody);
|
||||
|
||||
// Can't use /i regexp flag because it isn't restricted to ASCII.
|
||||
const mimeTypeBase64MatchResult = /(.*); *[Bb][Aa][Ss][Ee]64$/.exec(mimeType);
|
||||
const mimeTypeBase64MatchResult = /(.*); *[Bb][Aa][Ss][Ee]64$/u.exec(mimeType);
|
||||
if (mimeTypeBase64MatchResult) {
|
||||
const stringBody = isomorphicDecode(body);
|
||||
body = forgivingBase64Decode(stringBody);
|
||||
@@ -57,7 +52,7 @@ module.exports.fromURLRecord = urlRecord => {
|
||||
}
|
||||
|
||||
if (mimeType.startsWith(";")) {
|
||||
mimeType = "text/plain" + mimeType;
|
||||
mimeType = `text/plain${mimeType}`;
|
||||
}
|
||||
|
||||
let mimeTypeRecord;
|
||||
|
11
node_modules/data-urls/lib/utils.js
generated
vendored
11
node_modules/data-urls/lib/utils.js
generated
vendored
@@ -1,17 +1,12 @@
|
||||
"use strict";
|
||||
const { percentDecode } = require("whatwg-url");
|
||||
const { atob } = require("abab");
|
||||
|
||||
exports.stripLeadingAndTrailingASCIIWhitespace = string => {
|
||||
return string.replace(/^[ \t\n\f\r]+/, "").replace(/[ \t\n\f\r]+$/, "");
|
||||
};
|
||||
|
||||
exports.stringPercentDecode = input => {
|
||||
return percentDecode(Buffer.from(input, "utf-8"));
|
||||
return string.replace(/^[ \t\n\f\r]+/u, "").replace(/[ \t\n\f\r]+$/u, "");
|
||||
};
|
||||
|
||||
exports.isomorphicDecode = input => {
|
||||
return input.toString("binary");
|
||||
return Array.from(input, byte => String.fromCodePoint(byte)).join("");
|
||||
};
|
||||
|
||||
exports.forgivingBase64Decode = data => {
|
||||
@@ -19,5 +14,5 @@ exports.forgivingBase64Decode = data => {
|
||||
if (asString === null) {
|
||||
return null;
|
||||
}
|
||||
return Buffer.from(asString, "binary");
|
||||
return Uint8Array.from(asString, c => c.codePointAt(0));
|
||||
};
|
||||
|
Reference in New Issue
Block a user