From 06bc5ef5e2be7612e0416ca39e0a5a3e95e5c723 Mon Sep 17 00:00:00 2001 From: Michael <184316+muescha@users.noreply.github.com> Date: Mon, 16 Dec 2019 08:04:25 +0100 Subject: [PATCH] chore(gatsby-plugin-sharp): Use createContentDigest helper (#20076) --- packages/gatsby-plugin-sharp/src/trace-svg.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/gatsby-plugin-sharp/src/trace-svg.js b/packages/gatsby-plugin-sharp/src/trace-svg.js index f888f8fe79e6a..574a0bf061dd6 100644 --- a/packages/gatsby-plugin-sharp/src/trace-svg.js +++ b/packages/gatsby-plugin-sharp/src/trace-svg.js @@ -1,5 +1,4 @@ const { promisify } = require(`bluebird`) -const crypto = require(`crypto`) const _ = require(`lodash`) const tmpDir = require(`os`).tmpdir() const sharp = require(`./safe-sharp`) @@ -7,6 +6,7 @@ const sharp = require(`./safe-sharp`) const duotone = require(`./duotone`) const { getPluginOptions, healOptions } = require(`./plugin-options`) const { reportError } = require(`./report-error`) +const { createContentDigest } = require(`gatsby-core-utils`) exports.notMemoizedPrepareTraceSVGInputFile = async ({ file, @@ -90,12 +90,9 @@ exports.notMemoizedtraceSVG = async ({ file, args, fileArgs, reporter }) => { file.extension ) - const tmpFilePath = `${tmpDir}/${file.internal.contentDigest}-${ - file.name - }-${crypto - .createHash(`md5`) - .update(JSON.stringify(options)) - .digest(`hex`)}.${file.extension}` + const optionsHash = createContentDigest(options) + + const tmpFilePath = `${tmpDir}/${file.internal.contentDigest}-${file.name}-${optionsHash}.${file.extension}` try { await exports.memoizedPrepareTraceSVGInputFile({