From fa2277f8dd671543512f7c32260914a90ffca7bc Mon Sep 17 00:00:00 2001 From: Ward Peeters Date: Thu, 17 Feb 2022 11:24:45 +0100 Subject: [PATCH] feat(gatsby-core-utils): improve fetch-remote-file (#34758) * feat(gatsby-core-utils): improve fetch-remote-file * feat: use cacheKey in fetch-remote-file * use async file operations * Improve tests + low hanging fruit * revert wordpress * feat: make sure 304 works * fix jest config wordpress * add integration test * update tests --- src/__tests__/create-remote-file-node.js | 4 ++-- src/create-remote-file-node.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/__tests__/create-remote-file-node.js b/src/__tests__/create-remote-file-node.js index b64bf6d21c6fe..e90addb78ecc8 100644 --- a/src/__tests__/create-remote-file-node.js +++ b/src/__tests__/create-remote-file-node.js @@ -22,7 +22,7 @@ jest.mock(`got`, () => { } }) -jest.mock(`gatsby-core-utils`, () => { +jest.mock(`gatsby-core-utils/fetch-remote-file`, () => { return { fetchRemoteFile: jest.fn(), } @@ -37,7 +37,7 @@ const reporter = {} const createRemoteFileNode = require(`../create-remote-file-node`) const { createFileNode } = require(`../create-file-node`) -const { fetchRemoteFile } = require(`gatsby-core-utils`) +const { fetchRemoteFile } = require(`gatsby-core-utils/fetch-remote-file`) const createMockCache = () => { return { diff --git a/src/create-remote-file-node.js b/src/create-remote-file-node.js index bfb4574d79eed..66655132bec74 100644 --- a/src/create-remote-file-node.js +++ b/src/create-remote-file-node.js @@ -1,4 +1,4 @@ -const { fetchRemoteFile } = require(`gatsby-core-utils`) +const { fetchRemoteFile } = require(`gatsby-core-utils/fetch-remote-file`) const { isWebUri } = require(`valid-url`) const { createFileNode } = require(`./create-file-node`)