UNPKG

@adonis-agora/media

Version:

Media-library for AdonisJS — owner collections (MIME whitelist, single-file replace, ordering), image conversions (eager/lazy), pluggable content transformers (HLS video via mediabunny, metadata probe, image blur-up placeholder), and column attachments, a

21 lines • 1 kB
import { TransformerRuntimeMissingError } from '../errors.js'; /** * Load the mediabunny-backed engine module, translating a missing optional peer into the typed * {@link TransformerRuntimeMissingError} instead of a raw `ERR_MODULE_NOT_FOUND` five imports deep. * Import happens here — at first transform — never at boot: configuring a transformer must not * load its engine (the same laziness `processors.sharp()` and `disks.s3()` follow). */ export async function loadMediabunny(transformerName) { try { return await import('./mediabunny.js'); } catch (error) { if (error.code === 'ERR_MODULE_NOT_FOUND' && error instanceof Error && error.message.includes('mediabunny')) { throw new TransformerRuntimeMissingError(transformerName, "the optional peer dependency 'mediabunny'", 'Install it (`pnpm add mediabunny`) or inject a custom `engine`.'); } throw error; } } //# sourceMappingURL=mediabunny_loader.js.map