@expo/image-utils
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import { ImageOptions } from './Image.types'; | ||
@@ -2,0 +3,0 @@ export declare function createCacheKey(fileSource: string, properties: string[]): string; |
@@ -6,8 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createCacheKey = createCacheKey; | ||
exports.createCacheKeyWithDirectoryAsync = createCacheKeyWithDirectoryAsync; | ||
exports.ensureCacheDirectory = ensureCacheDirectory; | ||
exports.getImageFromCacheAsync = getImageFromCacheAsync; | ||
exports.cacheImageAsync = cacheImageAsync; | ||
exports.clearUnusedCachesAsync = clearUnusedCachesAsync; | ||
exports.clearUnusedCachesAsync = exports.cacheImageAsync = exports.getImageFromCacheAsync = exports.ensureCacheDirectory = exports.createCacheKeyWithDirectoryAsync = exports.createCacheKey = void 0; | ||
const crypto_1 = __importDefault(require("crypto")); | ||
@@ -28,2 +23,3 @@ const fs_extra_1 = require("fs-extra"); | ||
} | ||
exports.createCacheKey = createCacheKey; | ||
async function createCacheKeyWithDirectoryAsync(projectRoot, type, icon) { | ||
@@ -36,2 +32,3 @@ const cacheKey = `${type}-${createCacheKey(icon.src, [icon.resizeMode, icon.backgroundColor])}`; | ||
} | ||
exports.createCacheKeyWithDirectoryAsync = createCacheKeyWithDirectoryAsync; | ||
async function ensureCacheDirectory(projectRoot, type, cacheKey) { | ||
@@ -42,2 +39,3 @@ const cacheFolder = (0, path_1.join)(projectRoot, CACHE_LOCATION, type, cacheKey); | ||
} | ||
exports.ensureCacheDirectory = ensureCacheDirectory; | ||
async function getImageFromCacheAsync(fileName, cacheKey) { | ||
@@ -51,2 +49,3 @@ try { | ||
} | ||
exports.getImageFromCacheAsync = getImageFromCacheAsync; | ||
async function cacheImageAsync(fileName, buffer, cacheKey) { | ||
@@ -60,2 +59,3 @@ try { | ||
} | ||
exports.cacheImageAsync = cacheImageAsync; | ||
async function clearUnusedCachesAsync(projectRoot, type) { | ||
@@ -83,2 +83,3 @@ // Clean up any old caches | ||
} | ||
exports.clearUnusedCachesAsync = clearUnusedCachesAsync; | ||
//# sourceMappingURL=Cache.js.map |
@@ -6,4 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.downloadOrUseCachedImage = downloadOrUseCachedImage; | ||
exports.downloadImage = downloadImage; | ||
exports.downloadImage = exports.downloadOrUseCachedImage = void 0; | ||
const fs_extra_1 = __importDefault(require("fs-extra")); | ||
@@ -34,2 +33,3 @@ // @ts-ignore | ||
} | ||
exports.downloadOrUseCachedImage = downloadOrUseCachedImage; | ||
async function downloadImage(url) { | ||
@@ -55,2 +55,3 @@ const outputPath = tempy_1.default.directory(); | ||
} | ||
exports.downloadImage = downloadImage; | ||
//# sourceMappingURL=Download.js.map |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
export declare function generateAsync(buffers: Buffer[]): Promise<Buffer>; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateAsync = generateAsync; | ||
exports.generateAsync = void 0; | ||
// Inspired by https://github.com/kevva/to-ico but reuses existing packages to keep bundle size small. | ||
@@ -98,2 +98,3 @@ const parse_png_1 = __importDefault(require("parse-png")); | ||
} | ||
exports.generateAsync = generateAsync; | ||
//# sourceMappingURL=Ico.js.map |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import { ImageOptions } from './Image.types'; | ||
@@ -2,0 +3,0 @@ export declare function getMimeType(srcPath: string): string | null; |
@@ -29,7 +29,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getMimeType = getMimeType; | ||
exports.generateImageAsync = generateImageAsync; | ||
exports.generateFaviconAsync = generateFaviconAsync; | ||
exports.compositeImagesAsync = compositeImagesAsync; | ||
exports.getPngInfo = getPngInfo; | ||
exports.getPngInfo = exports.compositeImagesAsync = exports.generateFaviconAsync = exports.generateImageAsync = exports.getMimeType = void 0; | ||
const chalk_1 = __importDefault(require("chalk")); | ||
@@ -157,2 +153,3 @@ const fs_1 = __importDefault(require("fs")); | ||
} | ||
exports.getMimeType = getMimeType; | ||
async function ensureImageOptionsAsync(imageOptions) { | ||
@@ -192,2 +189,3 @@ const icon = { | ||
} | ||
exports.generateImageAsync = generateImageAsync; | ||
async function generateFaviconAsync(pngImageBuffer, sizes = [16, 32, 48]) { | ||
@@ -197,2 +195,3 @@ const buffers = await resizeImagesAsync(pngImageBuffer, sizes); | ||
} | ||
exports.generateFaviconAsync = generateFaviconAsync; | ||
/** | ||
@@ -216,5 +215,7 @@ * Layers the provided foreground image over the provided background image. | ||
} | ||
exports.compositeImagesAsync = compositeImagesAsync; | ||
async function getPngInfo(src) { | ||
return await (0, parse_png_1.default)(fs_1.default.readFileSync(src)); | ||
} | ||
exports.getPngInfo = getPngInfo; | ||
//# sourceMappingURL=Image.js.map |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import * as Cache from './Cache'; | ||
@@ -2,0 +3,0 @@ import { compositeImagesAsync, generateFaviconAsync, generateImageAsync, getPngInfo } from './Image'; |
@@ -26,4 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getPngInfo = exports.compositeImagesAsync = exports.Cache = exports.generateFaviconAsync = exports.generateImageAsync = exports.sharpAsync = exports.isAvailableAsync = exports.findSharpInstanceAsync = exports.createSquareAsync = exports.jimpAsync = void 0; | ||
exports.imageAsync = imageAsync; | ||
exports.getPngInfo = exports.compositeImagesAsync = exports.Cache = exports.generateFaviconAsync = exports.generateImageAsync = exports.sharpAsync = exports.isAvailableAsync = exports.findSharpInstanceAsync = exports.createSquareAsync = exports.jimpAsync = exports.imageAsync = void 0; | ||
const Cache = __importStar(require("./Cache")); | ||
@@ -49,2 +48,3 @@ exports.Cache = Cache; | ||
} | ||
exports.imageAsync = imageAsync; | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import Jimp from 'jimp-compact'; | ||
@@ -2,0 +3,0 @@ import { ResizeOptions, SharpCommandOptions, SharpGlobalOptions } from './sharp.types'; |
@@ -29,10 +29,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resizeBufferAsync = resizeBufferAsync; | ||
exports.convertFormat = convertFormat; | ||
exports.jimpAsync = jimpAsync; | ||
exports.isFolderAsync = isFolderAsync; | ||
exports.circleAsync = circleAsync; | ||
exports.createSquareAsync = createSquareAsync; | ||
exports.getJimpImageAsync = getJimpImageAsync; | ||
exports.resize = resize; | ||
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")); | ||
@@ -51,2 +44,3 @@ // @ts-ignore | ||
} | ||
exports.resizeBufferAsync = resizeBufferAsync; | ||
function convertFormat(format) { | ||
@@ -66,2 +60,3 @@ if (typeof format === 'undefined') | ||
} | ||
exports.convertFormat = convertFormat; | ||
async function jimpAsync(options, commands = []) { | ||
@@ -98,2 +93,3 @@ if (commands.length) { | ||
} | ||
exports.jimpAsync = jimpAsync; | ||
async function isFolderAsync(path) { | ||
@@ -107,2 +103,3 @@ try { | ||
} | ||
exports.isFolderAsync = isFolderAsync; | ||
function circleAsync(jimp) { | ||
@@ -127,2 +124,3 @@ const radius = Math.min(jimp.bitmap.width, jimp.bitmap.height) / 2; | ||
} | ||
exports.circleAsync = circleAsync; | ||
/** | ||
@@ -136,2 +134,3 @@ * Create a square image of a given size and color. Defaults to a white PNG. | ||
} | ||
exports.createSquareAsync = createSquareAsync; | ||
async function getJimpImageAsync(input) { | ||
@@ -143,2 +142,3 @@ // @ts-ignore: Jimp types are broken | ||
} | ||
exports.getJimpImageAsync = getJimpImageAsync; | ||
async function resize({ input, quality = 100 }, { background, position, fit, width, height }) { | ||
@@ -176,2 +176,3 @@ let initialImage = await getJimpImageAsync(input); | ||
} | ||
exports.resize = resize; | ||
async function flatten({ input, quality = 100 }, { background }) { | ||
@@ -178,0 +179,0 @@ const initialImage = await getJimpImageAsync(input); |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import { SharpCommandOptions, SharpGlobalOptions } from './sharp.types'; | ||
@@ -2,0 +3,0 @@ export declare function resizeBufferAsync(buffer: Buffer, sizes: number[]): Promise<Buffer[]>; |
@@ -6,6 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resizeBufferAsync = resizeBufferAsync; | ||
exports.isAvailableAsync = isAvailableAsync; | ||
exports.sharpAsync = sharpAsync; | ||
exports.findSharpInstanceAsync = findSharpInstanceAsync; | ||
exports.findSharpInstanceAsync = exports.sharpAsync = exports.isAvailableAsync = exports.resizeBufferAsync = void 0; | ||
const spawn_async_1 = __importDefault(require("@expo/spawn-async")); | ||
@@ -32,2 +29,3 @@ const path_1 = __importDefault(require("path")); | ||
} | ||
exports.resizeBufferAsync = resizeBufferAsync; | ||
/** | ||
@@ -48,2 +46,3 @@ * Returns `true` if a global sharp instance can be found. | ||
} | ||
exports.isAvailableAsync = isAvailableAsync; | ||
async function sharpAsync(options, commands = []) { | ||
@@ -71,2 +70,3 @@ const bin = await findSharpBinAsync(); | ||
} | ||
exports.sharpAsync = sharpAsync; | ||
function getOptions(options) { | ||
@@ -195,2 +195,3 @@ const args = []; | ||
} | ||
exports.findSharpInstanceAsync = findSharpInstanceAsync; | ||
function notFoundError(requiredCliVersion) { | ||
@@ -197,0 +198,0 @@ return new Error(`This command requires version ${requiredCliVersion} of \`sharp-cli\`. \n` + |
{ | ||
"name": "@expo/image-utils", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "A package used by Expo CLI for processing images", | ||
@@ -55,3 +55,3 @@ "main": "build/index.js", | ||
}, | ||
"gitHead": "4165b8d72e1b9a1889c2767534cc619e21468110" | ||
"gitHead": "ee4f30ef3b5fa567ad1bf94794197f7683fdd481" | ||
} |
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
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
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
1083
76234