import { puppeteerBrowser } from './puppeteer' ; import type { Browser , ScreenshotOptions } from 'puppeteer' ; import { ImageResolution , ImageTemplate , ParamValues } from '@resoc/core' ; import createImgCore from '@resoc/create-img-core' ; type LocalTemplateOptions = { cache ? : boolean ; browser ? : Browser ; } ; export const createImage = async ( templateManifestPath , paramValues , resolution , imagePath , options ? ) : Promise < string > => ( createImgCore . createImage ( templateManifestPath , paramValues , resolution , imagePath , options ?. browser || await puppeteerBrowser ( ) , options ?. cache || false ) ) ; export const compileLocalTemplate = createImage ; export const createImageFromTemplate = async ( template , paramValues , resolution , imagePath , resourcePath ? , browser ? ) : Promise < void > => ( createImgCore . createImageFromTemplate ( template , paramValues , resolution , imagePath , resourcePath , browser || await puppeteerBrowser ( ) ) ) ; export const createAnyImageFromTemplate = async ( template , paramValues , resolution , outputOptions , resourcePath ? , browser ? ) : Promise < string | Buffer | void > => { if ( ! browser ) { browser = await puppeteerBrowser ( ) ; } return createAnyImageFromTemplate ( template , paramValues , resolution , outputOptions , resourcePath , browser ) ; } ; export const compileTemplate = createImageFromTemplate ;