@11ty/eleventy-img
Advanced tools
Comparing version 5.0.0-beta.10 to 5.0.0
16
img.js
@@ -371,7 +371,13 @@ const path = require("path"); | ||
// remove all newlines for hashing for better cross-OS hash compatibility (Issue #122) | ||
let fileContentsStr = fileContents.toString(); | ||
let firstFour = fileContentsStr.trim().slice(0, 5); | ||
if(firstFour === "<svg " || firstFour === "<?xml") { | ||
fileContents = fileContentsStr.replace(/\r|\n/g, ''); | ||
// If the file starts with whitespace or the '<' character, it might be SVG. | ||
// Otherwise, skip the expensive buffer.toString() call | ||
// (no point in unicode encoding a binary file) | ||
let fileContentsPrefix = fileContents?.slice(0, 1)?.toString()?.trim(); | ||
if (!fileContentsPrefix || fileContentsPrefix[0] == "<") { | ||
// remove all newlines for hashing for better cross-OS hash compatibility (Issue #122) | ||
let fileContentsStr = fileContents.toString(); | ||
let firstFour = fileContentsStr.trim().slice(0, 5); | ||
if(firstFour === "<svg " || firstFour === "<?xml") { | ||
fileContents = fileContentsStr.replace(/\r|\n/g, ''); | ||
} | ||
} | ||
@@ -378,0 +384,0 @@ |
{ | ||
"name": "@11ty/eleventy-img", | ||
"version": "5.0.0-beta.10", | ||
"version": "5.0.0", | ||
"description": "Low level utility to perform build-time image transformations.", | ||
@@ -43,10 +43,10 @@ "publishConfig": { | ||
"brotli-size": "^4.0.0", | ||
"debug": "^4.3.5", | ||
"debug": "^4.3.7", | ||
"entities": "^5.0.0", | ||
"image-size": "^1.1.1", | ||
"p-queue": "^6.6.2", | ||
"sharp": "^0.33.4" | ||
"sharp": "^0.33.5" | ||
}, | ||
"devDependencies": { | ||
"@11ty/eleventy": "3.0.0-alpha.10", | ||
"@11ty/eleventy": "^3.0.0", | ||
"@11ty/eleventy-plugin-webc": "^0.11.2", | ||
@@ -53,0 +53,0 @@ "ava": "^6.1.3", |
@@ -86,3 +86,3 @@ const path = require("path"); | ||
tree.match({ tag: 'img' }, (node) => { | ||
if(isIgnored(node)) { | ||
if(isIgnored(node) || node?.attrs?.src?.startsWith("data:")) { | ||
cleanTag(node); | ||
@@ -89,0 +89,0 @@ } else { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
63341
1403
0
Updateddebug@^4.3.7
Updatedsharp@^0.33.5