New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@expo/image-utils

Package Overview
Dependencies
Maintainers
28
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@expo/image-utils - npm Package Compare versions

Comparing version 0.6.6-canary-20250219-4a5dade to 0.6.6-canary-20250221-ef26fed

16

build/Cache.js

@@ -8,3 +8,3 @@ "use strict";

const crypto_1 = __importDefault(require("crypto"));
const fs_extra_1 = require("fs-extra");
const fs_1 = __importDefault(require("fs"));
const path_1 = require("path");

@@ -15,3 +15,3 @@ const CACHE_LOCATION = '.expo/web/cache/production/images';

function calculateHash(filePath) {
const contents = filePath.startsWith('http') ? filePath : (0, fs_extra_1.readFileSync)(filePath);
const contents = filePath.startsWith('http') ? filePath : fs_1.default.readFileSync(filePath);
return crypto_1.default.createHash('sha256').update(contents).digest('hex');

@@ -39,3 +39,3 @@ }

const cacheFolder = (0, path_1.join)(projectRoot, CACHE_LOCATION, type, cacheKey);
await (0, fs_extra_1.ensureDir)(cacheFolder);
await fs_1.default.promises.mkdir(cacheFolder, { recursive: true });
return cacheFolder;

@@ -46,3 +46,3 @@ }

try {
return await (0, fs_extra_1.readFile)((0, path_1.resolve)(cacheKeys[cacheKey], fileName));
return await fs_1.default.promises.readFile((0, path_1.resolve)(cacheKeys[cacheKey], fileName));
}

@@ -56,3 +56,3 @@ catch {

try {
await (0, fs_extra_1.writeFile)((0, path_1.resolve)(cacheKeys[cacheKey], fileName), buffer);
await fs_1.default.promises.writeFile((0, path_1.resolve)(cacheKeys[cacheKey], fileName), buffer);
}

@@ -67,4 +67,4 @@ catch (error) {

const cacheFolder = (0, path_1.join)(projectRoot, CACHE_LOCATION, type);
await (0, fs_extra_1.ensureDir)(cacheFolder);
const currentCaches = (0, fs_extra_1.readdirSync)(cacheFolder);
await fs_1.default.promises.mkdir(cacheFolder, { recursive: true });
const currentCaches = await fs_1.default.promises.readdir(cacheFolder);
if (!Array.isArray(currentCaches)) {

@@ -82,3 +82,3 @@ console.warn('Failed to read the icon cache');

if (!(cache in cacheKeys)) {
deleteCachePromises.push((0, fs_extra_1.remove)((0, path_1.join)(cacheFolder, cache)));
deleteCachePromises.push(fs_1.default.promises.rm((0, path_1.join)(cacheFolder, cache), { force: true, recursive: true }));
}

@@ -85,0 +85,0 @@ }

@@ -7,3 +7,3 @@ "use strict";

exports.downloadImage = exports.downloadOrUseCachedImage = void 0;
const fs_extra_1 = __importDefault(require("fs-extra"));
const fs_1 = __importDefault(require("fs"));
// @ts-ignore

@@ -23,3 +23,3 @@ const jimp_compact_1 = __importDefault(require("jimp-compact"));

const directory = path_1.default.join(temp_dir_1.default, (0, unique_string_1.default)());
fs_extra_1.default.mkdirSync(directory);
fs_1.default.mkdirSync(directory, { recursive: true });
return directory;

@@ -54,3 +54,3 @@ }

const readableBody = stream_1.default.Readable.fromWeb(response.body);
await streamPipeline(readableBody, fs_extra_1.default.createWriteStream(localPath));
await streamPipeline(readableBody, fs_1.default.createWriteStream(localPath));
// If an image URL doesn't have a name, get the mime type and move the file.

@@ -61,3 +61,8 @@ const img = await jimp_compact_1.default.read(localPath);

const newPath = path_1.default.join(outputPath, `image.${mime}`);
await fs_extra_1.default.move(localPath, newPath);
const parentPath = path_1.default.dirname(newPath);
if (!fs_1.default.existsSync(parentPath)) {
await fs_1.default.promises.mkdir(parentPath, { recursive: true });
}
// NOTE: EXDEV can't happen since we're just renaming the file in the same directory
await fs_1.default.promises.rename(localPath, newPath);
return newPath;

@@ -64,0 +69,0 @@ }

@@ -30,3 +30,3 @@ "use strict";

exports.resize = exports.getJimpImageAsync = exports.createSquareAsync = exports.circleAsync = exports.isFolderAsync = exports.jimpAsync = exports.convertFormat = exports.resizeBufferAsync = void 0;
const fs_extra_1 = __importDefault(require("fs-extra"));
const fs_1 = __importDefault(require("fs"));
// @ts-ignore

@@ -83,6 +83,6 @@ const jimp_compact_1 = __importDefault(require("jimp-compact"));

if (await isFolderAsync(options.output)) {
await fs_extra_1.default.writeFile(path.join(options.output, path.basename(options.originalInput)), imgBuffer);
await fs_1.default.promises.writeFile(path.join(options.output, path.basename(options.originalInput)), imgBuffer);
}
else {
await fs_extra_1.default.writeFile(options.output, imgBuffer);
await fs_1.default.promises.writeFile(options.output, imgBuffer);
}

@@ -95,3 +95,3 @@ }

try {
return (await fs_extra_1.default.stat(path)).isDirectory();
return (await fs_1.default.promises.stat(path)).isDirectory();
}

@@ -98,0 +98,0 @@ catch {

{
"name": "@expo/image-utils",
"version": "0.6.6-canary-20250219-4a5dade",
"version": "0.6.6-canary-20250221-ef26fed",
"description": "A package used by Expo CLI for processing images",

@@ -36,3 +36,2 @@ "main": "build/index.js",

"chalk": "^4.0.0",
"fs-extra": "9.0.0",
"getenv": "^1.0.0",

@@ -47,11 +46,9 @@ "jimp-compact": "0.16.1",

"devDependencies": {
"@types/fs-extra": "^9.0.1",
"@types/getenv": "^0.7.0",
"@types/semver": "^6.0.0",
"expo-module-scripts": "4.0.5-canary-20250219-4a5dade"
"expo-module-scripts": "4.0.5-canary-20250221-ef26fed"
},
"publishConfig": {
"access": "public"
},
"gitHead": "4a5daded61d3d8b9d501059039ac74c09c25675b"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc