Skip to content

Commit

Permalink
chore(gatsby-plugin-sharp): Use createContentDigest helper (#20076)
Browse files Browse the repository at this point in the history
  • Loading branch information
muescha authored and GatsbyJS Bot committed Dec 16, 2019
1 parent e993369 commit 06bc5ef
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/gatsby-plugin-sharp/src/trace-svg.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const { promisify } = require(`bluebird`)
const crypto = require(`crypto`)
const _ = require(`lodash`)
const tmpDir = require(`os`).tmpdir()
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,
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit 06bc5ef

Please sign in to comment.