From 222920b1db3a3cc80631dde3c1ad0550ed8551fb Mon Sep 17 00:00:00 2001 From: Ward Peeters Date: Fri, 24 Jul 2020 20:37:11 +0200 Subject: [PATCH] fix: do not augment plugin-options (#26006) --- packages/gatsby-plugin-sharp/src/trace-svg.js | 2 +- packages/gatsby-remark-copy-linked-files/src/index.js | 2 +- packages/gatsby-remark-images-contentful/src/index.js | 2 +- packages/gatsby-remark-images/src/index.js | 2 +- packages/gatsby-remark-responsive-iframe/src/index.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/gatsby-plugin-sharp/src/trace-svg.js b/packages/gatsby-plugin-sharp/src/trace-svg.js index 23b998691468a..eaa26670804c7 100644 --- a/packages/gatsby-plugin-sharp/src/trace-svg.js +++ b/packages/gatsby-plugin-sharp/src/trace-svg.js @@ -130,7 +130,7 @@ exports.notMemoizedtraceSVG = async ({ file, args, fileArgs, reporter }) => { turnPolicy: potrace.Potrace.TURNPOLICY_MAJORITY, } - const optionsSVG = _.defaults(args, defaultArgs) + const optionsSVG = _.defaults({}, args, defaultArgs) // `srcset` attribute rejects URIs with literal spaces const encodeSpaces = str => str.replace(/ /gi, `%20`) diff --git a/packages/gatsby-remark-copy-linked-files/src/index.js b/packages/gatsby-remark-copy-linked-files/src/index.js index 4ffb7ef948154..d623a52ef3e6d 100644 --- a/packages/gatsby-remark-copy-linked-files/src/index.js +++ b/packages/gatsby-remark-copy-linked-files/src/index.js @@ -85,7 +85,7 @@ module.exports = ( if (!validateDestinationDir(destinationDir)) return Promise.reject(invalidDestinationDirMessage(destinationDir)) - const options = _.defaults(pluginOptions, defaults) + const options = _.defaults({}, pluginOptions, defaults) const filesToCopy = new Map() // Copy linked files to the destination directory and modify the AST to point diff --git a/packages/gatsby-remark-images-contentful/src/index.js b/packages/gatsby-remark-images-contentful/src/index.js index 7132bf74d691b..0550704eeaad6 100644 --- a/packages/gatsby-remark-images-contentful/src/index.js +++ b/packages/gatsby-remark-images-contentful/src/index.js @@ -58,7 +58,7 @@ module.exports = async ( const srcSplit = node.url.split(`/`) const fileName = srcSplit[srcSplit.length - 1] - const options = _.defaults(pluginOptions, defaults) + const options = _.defaults({}, pluginOptions, defaults) const optionsHash = createContentDigest(options) diff --git a/packages/gatsby-remark-images/src/index.js b/packages/gatsby-remark-images/src/index.js index fc66a37ff635e..eb26eb7898998 100644 --- a/packages/gatsby-remark-images/src/index.js +++ b/packages/gatsby-remark-images/src/index.js @@ -35,7 +35,7 @@ module.exports = ( }, pluginOptions ) => { - const options = _.defaults(pluginOptions, { pathPrefix }, DEFAULT_OPTIONS) + const options = _.defaults({}, pluginOptions, { pathPrefix }, DEFAULT_OPTIONS) const findParentLinks = ({ children }) => children.some( diff --git a/packages/gatsby-remark-responsive-iframe/src/index.js b/packages/gatsby-remark-responsive-iframe/src/index.js index 6677d68cb52ea..d1ace1459b670 100644 --- a/packages/gatsby-remark-responsive-iframe/src/index.js +++ b/packages/gatsby-remark-responsive-iframe/src/index.js @@ -26,7 +26,7 @@ module.exports = async ({ markdownAST }, pluginOptions = {}) => { const defaults = { wrapperStyle: ``, } - const options = _.defaults(pluginOptions, defaults) + const options = _.defaults({}, pluginOptions, defaults) visit(markdownAST, [`html`, `jsx`], node => { const $ = cheerio.load(node.value) const iframe = $(`iframe, object`)