@expo/image-utils
Advanced tools
Comparing version 0.3.22 to 0.3.23
@@ -35,2 +35,3 @@ "use strict"; | ||
const Ico = __importStar(require("./Ico")); | ||
const env_1 = require("./env"); | ||
const Jimp = __importStar(require("./jimp")); | ||
@@ -65,4 +66,4 @@ const Sharp = __importStar(require("./sharp")); | ||
} | ||
const imgBuffer = await jimp.getBufferAsync(jimp.getMIME()); | ||
return imgBuffer; | ||
// Convert to png buffer | ||
return jimp.getBufferAsync('image/png'); | ||
} | ||
@@ -97,4 +98,4 @@ try { | ||
if (imageOptions.borderRadius) { | ||
const mask = Buffer.from(`<svg><rect x="0" y="0" width="${width}" height="${height}" | ||
rx="${imageOptions.borderRadius}" ry="${imageOptions.borderRadius}" | ||
const mask = Buffer.from(`<svg><rect x="0" y="0" width="${width}" height="${height}" | ||
rx="${imageOptions.borderRadius}" ry="${imageOptions.borderRadius}" | ||
fill="${backgroundColor && backgroundColor !== 'transparent' ? backgroundColor : 'none'}" /></svg>`); | ||
@@ -122,3 +123,3 @@ sharpBuffer.composite([{ input: mask, blend: 'dest-in' }]); | ||
// Putting the warning here will prevent the warning from showing if all images were reused from the cache | ||
if (!hasWarned && !(await Sharp.isAvailableAsync())) { | ||
if (env_1.env.EXPO_IMAGE_UTILS_DEBUG && !hasWarned && !(await Sharp.isAvailableAsync())) { | ||
hasWarned = true; | ||
@@ -125,0 +126,0 @@ console.warn(chalk_1.default.yellow(`Using node to generate images. This is much slower than using native packages.\n\u203A Optionally you can stop the process and try again after successfully running \`npm install -g sharp-cli\`.\n`)); |
@@ -8,6 +8,6 @@ "use strict"; | ||
const spawn_async_1 = __importDefault(require("@expo/spawn-async")); | ||
const getenv_1 = require("getenv"); | ||
const path_1 = __importDefault(require("path")); | ||
const resolve_from_1 = __importDefault(require("resolve-from")); | ||
const semver_1 = __importDefault(require("semver")); | ||
const env_1 = require("./env"); | ||
const SHARP_HELP_PATTERN = /\n\nSpecify --help for available options/g; | ||
@@ -30,3 +30,2 @@ const SHARP_REQUIRED_VERSION = '^2.1.0'; | ||
exports.resizeBufferAsync = resizeBufferAsync; | ||
const isSharpDisabled = (0, getenv_1.boolish)('EXPO_IMAGE_UTILS_NO_SHARP', false); | ||
/** | ||
@@ -37,3 +36,3 @@ * Returns `true` if a global sharp instance can be found. | ||
async function isAvailableAsync() { | ||
if (isSharpDisabled) { | ||
if (env_1.env.EXPO_IMAGE_UTILS_NO_SHARP) { | ||
return false; | ||
@@ -142,3 +141,3 @@ } | ||
async function findSharpInstanceAsync() { | ||
if (isSharpDisabled) { | ||
if (env_1.env.EXPO_IMAGE_UTILS_NO_SHARP) { | ||
throw new Error('Global instance of sharp-cli cannot be retrieved because sharp-cli has been disabled with the environment variable `EXPO_IMAGE_UTILS_NO_SHARP`'); | ||
@@ -145,0 +144,0 @@ } |
{ | ||
"name": "@expo/image-utils", | ||
"version": "0.3.22", | ||
"version": "0.3.23", | ||
"description": "A package used by Expo CLI for processing images", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
105230
33
1025