UNPKG

@openscript/unplugin-favicons

Version:

Generate favicons for your project with caching for blazing fast rebuilds.

20 lines 869 B
import { readFileSync } from "node:fs"; import stringify from "fast-json-stable-stringify"; import { computeKey as cacheComputeKey } from "../utils/cache.js"; /** * @private * * Provided a JobConfig object, returns a cache key computed using any * configuration options for the job and a hash of the source file's contents. */ const generateCacheKeyForJob = async (jobConfig) => // Generate a cache key for the current icon any its configuration, but modify // the 'source' property of the job configuration to contain a hash of the // source file's contents rather than its name. cacheComputeKey(stringify({ ...jobConfig, // eslint-disable-next-line security/detect-non-literal-fs-filename source: readFileSync(jobConfig.source, { encoding: "utf8" }), })); export default generateCacheKeyForJob; //# sourceMappingURL=generate-cache-key-for-job.js.map