()
| 72 | * so this always uses sharp directly. |
| 73 | */ |
| 74 | export async function getImageCreator(): Promise<SharpCreator> { |
| 75 | if (imageCreatorModule) { |
| 76 | return imageCreatorModule.default |
| 77 | } |
| 78 | |
| 79 | const imported = (await import( |
| 80 | 'sharp' |
| 81 | )) as unknown as MaybeDefault<SharpCreator> |
| 82 | const sharp = unwrapDefault(imported) |
| 83 | imageCreatorModule = { default: sharp } |
| 84 | return sharp |
| 85 | } |
| 86 | |
| 87 | // Dynamic import shape varies by module interop mode — ESM yields { default: fn }, CJS yields fn directly. |
| 88 | type MaybeDefault<T> = T | { default: T } |
nothing calls this directly
no test coverage detected