/**
* Load every image a document references, before anything is compiled.
*
* A DOCX embeds images by value, so the bytes have to be in hand to build one —
* and fetching them is asynchronous, while compiling to IR is not. Keeping the
* compiler synchronous is worth a pre-pass: it makes compilation a pure
* function of the document plus this map, which is what lets the IR be compared,
* cached and snapshotted.
*
* Sources are deduplicated, so the same image used ten times is fetched once
* and embedded once.
*/
///
///
import type { ComponentDefinition } from '../types';
export interface LoadedImage {
bytes: Buffer;
/** From the HTTP response, when the source was fetched over the network. */
contentType?: string;
/** Pixel size as stored, when it could be read. */
intrinsic?: {
width: number;
height: number;
};
}
/**
* Images by source string.
*
* A source that could not be loaded is absent rather than recorded as an
* error: the compiler reports it against the component's own path, which is
* more use than an error attached to a URL. Why it failed is kept beside the
* images, so that report can say — and so a source that was tried and failed
* can be told from one the walk never reached.
*/
export interface ImageResources extends ReadonlyMap {
/** What each source that did not load threw. */
readonly failures?: ReadonlyMap;
}
/** Load every image source in `components`, following nested content. */
export declare function loadImageResources(components: Iterable): Promise;
//# sourceMappingURL=imageResources.d.ts.map