Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gatsbyjs/gatsby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: gatsby-plugin-feed@4.11.0
Choose a base ref
...
head repository: gatsbyjs/gatsby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: gatsby-plugin-feed@4.11.1
Choose a head ref
  • 5 commits
  • 51 files changed
  • 4 contributors

Commits on Mar 30, 2022

  1. update yarn.lock

    wardpeet committed Mar 30, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    dc30f40 View commit details

Commits on Mar 31, 2022

  1. fix(gatsby): use gatsby root instead of process.cwd (#35263) (#35264)

    Co-authored-by: Ward Peeters <ward@coding-tech.com>
    gatsbybot and wardpeet authored Mar 31, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c0da030 View commit details
  2. fix(gatsby-plugin-sharp,gatsby-core-utils): windows quirks (#35246) (#…

    …35268)
    
    Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
    (cherry picked from commit 392d6bc)
    
    Co-authored-by: Ward Peeters <ward@coding-tech.com>
    gatsbybot and wardpeet authored Mar 31, 2022
    Copy the full SHA
    a527891 View commit details
  3. fix(gatsby-source-contentful): handle backreferences on data updates …

    …properly (#35214) (#35269)
    
    Co-authored-by: axe312ger <opensource@axe312.dev>
    (cherry picked from commit cf98027)
    
    Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
    gatsbybot and pieh authored Mar 31, 2022
    Copy the full SHA
    b5f0197 View commit details
  4. chore(release): Publish

     - babel-plugin-remove-graphql-queries@4.11.1
     - babel-preset-gatsby@2.11.1
     - create-gatsby@2.11.1
     - gatsby-cli@4.11.1
     - gatsby-core-utils@3.11.1
     - gatsby-link@4.11.1
     - gatsby-page-utils@2.11.1
     - gatsby-plugin-benchmark-reporting@2.11.1
     - gatsby-plugin-cxs@4.11.1
     - gatsby-plugin-feed@4.11.1
     - gatsby-plugin-flow@3.11.1
     - gatsby-plugin-gatsby-cloud@4.11.1
     - gatsby-plugin-google-tagmanager@4.11.1
     - gatsby-plugin-image@2.11.1
     - gatsby-plugin-manifest@4.11.1
     - gatsby-plugin-mdx@3.11.1
     - gatsby-plugin-offline@5.11.1
     - gatsby-plugin-page-creator@4.11.1
     - gatsby-plugin-preload-fonts@3.11.1
     - gatsby-plugin-sass@5.11.1
     - gatsby-plugin-sharp@4.11.1
     - gatsby-plugin-sitemap@5.11.1
     - gatsby-plugin-twitter@4.11.1
     - gatsby-plugin-typescript@4.11.1
     - gatsby-plugin-utils@3.5.1
     - gatsby-remark-autolink-headers@5.11.1
     - gatsby-remark-images@6.11.1
     - gatsby-source-contentful@7.9.1
     - gatsby-source-drupal@5.11.1
     - gatsby-source-filesystem@4.11.1
     - gatsby-source-graphql@4.11.1
     - gatsby-source-shopify@7.0.1
     - gatsby-source-wordpress@6.11.1
     - gatsby-telemetry@3.11.1
     - gatsby-transformer-remark@5.11.1
     - gatsby-transformer-sqip@4.11.1
     - gatsby@4.11.1
    marvinjude committed Mar 31, 2022
    Copy the full SHA
    ad8c330 View commit details
Showing with 723 additions and 408 deletions.
  1. +2 −2 packages/babel-plugin-remove-graphql-queries/package.json
  2. +2 −2 packages/babel-preset-gatsby/package.json
  3. +2 −2 packages/create-gatsby/package.json
  4. +4 −4 packages/gatsby-cli/package.json
  5. +1 −1 packages/gatsby-core-utils/package.json
  6. +167 −77 packages/gatsby-core-utils/src/__tests__/fetch-remote-file.js
  7. +1 −1 packages/gatsby-core-utils/src/fetch-remote-file.ts
  8. +2 −2 packages/gatsby-link/package.json
  9. +2 −2 packages/gatsby-page-utils/package.json
  10. +2 −2 packages/gatsby-plugin-benchmark-reporting/package.json
  11. +2 −2 packages/gatsby-plugin-cxs/package.json
  12. +2 −2 packages/gatsby-plugin-feed/package.json
  13. +2 −2 packages/gatsby-plugin-flow/package.json
  14. +3 −3 packages/gatsby-plugin-gatsby-cloud/package.json
  15. +2 −2 packages/gatsby-plugin-google-tagmanager/package.json
  16. +3 −3 packages/gatsby-plugin-image/package.json
  17. +3 −3 packages/gatsby-plugin-manifest/package.json
  18. +3 −3 packages/gatsby-plugin-mdx/package.json
  19. +3 −3 packages/gatsby-plugin-offline/package.json
  20. +5 −5 packages/gatsby-plugin-page-creator/package.json
  21. +2 −2 packages/gatsby-plugin-preload-fonts/package.json
  22. +2 −2 packages/gatsby-plugin-sass/package.json
  23. +5 −5 packages/gatsby-plugin-sharp/package.json
  24. +174 −140 packages/gatsby-plugin-sharp/src/__tests__/trace-svg.js
  25. +1 −1 packages/gatsby-plugin-sharp/src/gatsby-node.js
  26. +1 −1 packages/gatsby-plugin-sharp/src/gatsby-worker.js
  27. +1 −1 packages/gatsby-plugin-sharp/src/index.js
  28. +3 −1 packages/gatsby-plugin-sharp/src/process-file.js
  29. +5 −4 packages/gatsby-plugin-sharp/src/trace-svg.js
  30. +2 −2 packages/gatsby-plugin-sitemap/package.json
  31. +2 −2 packages/gatsby-plugin-twitter/package.json
  32. +2 −2 packages/gatsby-plugin-typescript/package.json
  33. +2 −2 packages/gatsby-plugin-utils/package.json
  34. +2 −2 packages/gatsby-remark-autolink-headers/package.json
  35. +3 −3 packages/gatsby-remark-images/package.json
  36. +4 −4 packages/gatsby-source-contentful/package.json
  37. +101 −11 packages/gatsby-source-contentful/src/__tests__/gatsby-node.js
  38. +6 −13 packages/gatsby-source-contentful/src/normalize.js
  39. +136 −28 packages/gatsby-source-contentful/src/source-nodes.js
  40. +2 −2 packages/gatsby-source-drupal/package.json
  41. +2 −2 packages/gatsby-source-filesystem/package.json
  42. +2 −2 packages/gatsby-source-graphql/package.json
  43. +5 −5 packages/gatsby-source-shopify/package.json
  44. +6 −6 packages/gatsby-source-wordpress/package.json
  45. +2 −2 packages/gatsby-telemetry/package.json
  46. +3 −3 packages/gatsby-transformer-remark/package.json
  47. +3 −3 packages/gatsby-transformer-sqip/package.json
  48. +11 −11 packages/gatsby/package.json
  49. +13 −0 packages/gatsby/src/utils/__tests__/cache.ts
  50. +6 −1 packages/gatsby/src/utils/cache.ts
  51. +1 −22 yarn.lock
4 changes: 2 additions & 2 deletions packages/babel-plugin-remove-graphql-queries/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-plugin-remove-graphql-queries",
"version": "4.11.0",
"version": "4.11.1",
"author": "Jason Quense <monastic.panic@gmail.com>",
"repository": {
"type": "git",
@@ -10,7 +10,7 @@
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/babel-plugin-remove-graphql-queries#readme",
"dependencies": {
"@babel/runtime": "^7.15.4",
"gatsby-core-utils": "^3.11.0"
"gatsby-core-utils": "^3.11.1"
},
"devDependencies": {
"@babel/cli": "^7.15.4",
4 changes: 2 additions & 2 deletions packages/babel-preset-gatsby/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-preset-gatsby",
"version": "2.11.0",
"version": "2.11.1",
"author": "Philipp Spiess <hello@philippspiess.com>",
"repository": {
"type": "git",
@@ -22,7 +22,7 @@
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-macros": "^2.8.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"gatsby-core-utils": "^3.11.0",
"gatsby-core-utils": "^3.11.1",
"gatsby-legacy-polyfills": "^2.11.0"
},
"peerDependencies": {
4 changes: 2 additions & 2 deletions packages/create-gatsby/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-gatsby",
"version": "2.11.0",
"version": "2.11.1",
"main": "lib/index.js",
"bin": "cli.js",
"license": "MIT",
@@ -28,7 +28,7 @@
"eslint": "^7.32.0",
"execa": "^5.1.1",
"fs-extra": "^10.0.0",
"gatsby-plugin-utils": "^3.5.0",
"gatsby-plugin-utils": "^3.5.1",
"joi": "^17.4.2",
"microbundle": "^0.14.2",
"node-fetch": "^2.6.6",
8 changes: 4 additions & 4 deletions packages/gatsby-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby-cli",
"description": "Gatsby command-line interface for creating new sites and running Gatsby commands",
"version": "4.11.0",
"version": "4.11.1",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"bin": {
"gatsby": "cli.js"
@@ -26,13 +26,13 @@
"common-tags": "^1.8.2",
"configstore": "^5.0.1",
"convert-hrtime": "^3.0.0",
"create-gatsby": "^2.11.0",
"create-gatsby": "^2.11.1",
"envinfo": "^7.8.1",
"execa": "^5.1.1",
"fs-exists-cached": "^1.0.0",
"fs-extra": "^10.0.0",
"gatsby-core-utils": "^3.11.0",
"gatsby-telemetry": "^3.11.0",
"gatsby-core-utils": "^3.11.1",
"gatsby-telemetry": "^3.11.1",
"hosted-git-info": "^3.0.8",
"is-valid-path": "^0.1.1",
"joi": "^17.4.2",
2 changes: 1 addition & 1 deletion packages/gatsby-core-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-core-utils",
"version": "3.11.0",
"version": "3.11.1",
"description": "A collection of gatsby utils used in different gatsby packages",
"keywords": [
"gatsby",
244 changes: 167 additions & 77 deletions packages/gatsby-core-utils/src/__tests__/fetch-remote-file.js
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import { setupServer } from "msw/node"
import { Writable } from "stream"
import got from "got"
import fs from "fs-extra"
import { slash } from "gatsby-core-utils/path"
import { fetchRemoteFile } from "../fetch-remote-file"
import * as storage from "../utils/get-storage"

@@ -132,6 +133,7 @@ const server = setupServer(
ctx.body(content)
)
}),

rest.get(`http://external.com/dog`, async (req, res, ctx) => {
const { content, contentLength } = await getFileContent(
path.join(__dirname, `./fixtures/dog-thumbnail.jpg`),
@@ -175,6 +177,19 @@ const server = setupServer(
ctx.body(content)
)
}),
rest.get(`http://external.com/dog-*.jpg`, async (req, res, ctx) => {
const { content, contentLength } = await getFileContent(
path.join(__dirname, `./fixtures/dog-thumbnail.jpg`),
req
)

return res(
ctx.set(`Content-Type`, `image/jpg`),
ctx.set(`Content-Length`, contentLength),
ctx.status(200),
ctx.body(content)
)
}),
rest.get(`http://external.com/404.jpg`, async (req, res, ctx) => {
const content = `Page not found`

@@ -456,96 +471,171 @@ Fetch details:
`)
})

it(`should not re-download file if cache is set`, async () => {
const filePath = await fetchRemoteFile({
url: `http://external.com/dog.jpg`,
cache,
cacheKey: `1`,
})
const cachedFilePath = await fetchRemoteFile({
url: `http://external.com/dog.jpg`,
cache,
cacheKey: `1`,
})
let cacheVersion = 0
describe.each([false, true])(`with excludeDigest %s`, excludeDigest => {
function getExternalUrl(cacheVersion) {
return `http://external.com/dog-${cacheVersion}.jpg?v=${cacheVersion}`
}

expect(filePath).toBe(cachedFilePath)
expect(gotStream).toBeCalledTimes(1)
expect(fs.pathExists).toBeCalledTimes(1)
expect(fs.copy).not.toBeCalled()
})
it(`should not re-download file if cache is set`, async () => {
const filePath = await fetchRemoteFile({
url: getExternalUrl(++cacheVersion),
cache,
cacheKey: `${cacheVersion}`,
excludeDigest,
})
const cachedFilePath = await fetchRemoteFile({
url: getExternalUrl(cacheVersion),
cache,
cacheKey: `${cacheVersion}`,
excludeDigest,
})

it(`should not re-download and use same path if ouputDir is not inside public folder`, async () => {
const filePath = await fetchRemoteFile({
url: `http://external.com/dog.jpg`,
directory: cache.directory,
cacheKey: `2`,
})
const cachedFilePath = await fetchRemoteFile({
url: `http://external.com/dog.jpg`,
directory: path.join(cache.directory, `diff`),
cacheKey: `2`,
expect(filePath).toBe(cachedFilePath)
expect(gotStream).toBeCalledTimes(1)
expect(fs.pathExists).toBeCalledTimes(1)
expect(fs.copy).not.toBeCalled()
})

expect(filePath).toBe(cachedFilePath)
expect(gotStream).toBeCalledTimes(1)
expect(fs.pathExists).toBeCalledTimes(1)
expect(fs.copy).not.toBeCalled()
})
it(`should not re-download and use same path if ouputDir is not inside public folder`, async () => {
const filePath = await fetchRemoteFile({
url: getExternalUrl(++cacheVersion),
directory: cache.directory,
cacheKey: `${cacheVersion}`,
excludeDigest,
})
const cachedFilePath = await fetchRemoteFile({
url: getExternalUrl(cacheVersion),
directory: path.join(cache.directory, `diff`),
cacheKey: `${cacheVersion}`,
excludeDigest,
})

it(`should not re-download but copy file to public folder`, async () => {
const currentGlobal = global.__GATSBY
global.__GATSBY = {
root: cache.directory,
}
await fs.ensureDir(path.join(cache.directory, `public`))
const filePath = await fetchRemoteFile({
url: `http://external.com/dog.jpg`,
directory: cache.directory,
cacheKey: `3`,
expect(filePath).toBe(cachedFilePath)
expect(gotStream).toBeCalledTimes(1)
expect(fs.pathExists).toBeCalledTimes(1)
expect(fs.copy).not.toBeCalled()
})
const cachedFilePath = await fetchRemoteFile({
url: `http://external.com/dog.jpg`,
directory: path.join(cache.directory, `public`),
cacheKey: `3`,

it(`should not re-download but copy file to public folder`, async () => {
const currentGlobal = global.__GATSBY
global.__GATSBY = {
root: cache.directory,
}
await fs.ensureDir(path.join(cache.directory, `public`))
const filePath = await fetchRemoteFile({
url: getExternalUrl(++cacheVersion),
directory: cache.directory,
cacheKey: `${cacheVersion}`,
excludeDigest,
})
const cachedFilePath = await fetchRemoteFile({
url: getExternalUrl(cacheVersion),
directory: path.join(cache.directory, `public`),
cacheKey: `${cacheVersion}`,
excludeDigest,
})

expect(filePath).not.toBe(cachedFilePath)
expect(cachedFilePath).toStartWith(path.join(cache.directory, `public`))
expect(gotStream).toBeCalledTimes(1)
expect(fs.pathExists).toBeCalledTimes(1)
expect(fs.copy).toBeCalledTimes(1)
expect(await fs.pathExists(cachedFilePath)).toBe(true)
global.__GATSBY = currentGlobal
})

expect(filePath).not.toBe(cachedFilePath)
expect(cachedFilePath).toStartWith(path.join(cache.directory, `public`))
expect(gotStream).toBeCalledTimes(1)
expect(fs.pathExists).toBeCalledTimes(1)
expect(fs.copy).toBeCalledTimes(1)
expect(await fs.pathExists(cachedFilePath)).toBe(true)
global.__GATSBY = currentGlobal
})
it(`should not re-download but copy file to public folder (with slashes)`, async () => {
const currentGlobal = global.__GATSBY
global.__GATSBY = {
root: cache.directory,
}
await fs.ensureDir(path.join(cache.directory, `public`))
const filePath = await fetchRemoteFile({
url: getExternalUrl(++cacheVersion),
directory: slash(cache.directory),
cacheKey: `${cacheVersion}`,
excludeDigest,
})
const cachedFilePath = await fetchRemoteFile({
url: getExternalUrl(cacheVersion),
directory: slash(path.join(cache.directory, `public`)),
cacheKey: `${cacheVersion}`,
excludeDigest,
})

it(`should not re-download but copy file to public folder when the same url is requested`, async () => {
const currentGlobal = global.__GATSBY
global.__GATSBY = {
root: cache.directory,
}
await fs.ensureDir(path.join(cache.directory, `public`))
const filePathPromise = fetchRemoteFile({
url: `http://external.com/dog.jpg?v=4`,
directory: cache.directory,
cacheKey: `4`,
expect(filePath).not.toBe(cachedFilePath)
expect(cachedFilePath).toStartWith(path.join(cache.directory, `public`))
expect(gotStream).toBeCalledTimes(1)
expect(fs.pathExists).toBeCalledTimes(1)
expect(fs.copy).toBeCalledTimes(1)
expect(await fs.pathExists(cachedFilePath)).toBe(true)
global.__GATSBY = currentGlobal
})
const cachedFilePathPromise = fetchRemoteFile({
url: `http://external.com/dog.jpg?v=4`,
directory: path.join(cache.directory, `public`),
cacheKey: `4`,

it(`should not re-download but copy file to public folder when the same url is requested`, async () => {
const currentGlobal = global.__GATSBY
global.__GATSBY = {
root: cache.directory,
}
await fs.ensureDir(path.join(cache.directory, `public`))
const filePathPromise = fetchRemoteFile({
url: getExternalUrl(++cacheVersion),
directory: cache.directory,
cacheKey: `${cacheVersion}`,
excludeDigest,
})
const cachedFilePathPromise = fetchRemoteFile({
url: getExternalUrl(cacheVersion),
directory: path.join(cache.directory, `public`),
cacheKey: `${cacheVersion}`,
excludeDigest,
})

const [filePath, cachedFilePath] = await Promise.all([
filePathPromise,
cachedFilePathPromise,
])

expect(filePath).not.toBe(cachedFilePath)
expect(cachedFilePath).toStartWith(path.join(cache.directory, `public`))
expect(gotStream).toBeCalledTimes(1)
expect(fs.pathExists).toBeCalledTimes(0)
expect(fs.copy).toBeCalledTimes(1)
global.__GATSBY = currentGlobal
})

const [filePath, cachedFilePath] = await Promise.all([
filePathPromise,
cachedFilePathPromise,
])
it(`should not re-download but copy file to public folder when the same url is requested (with slashes)`, async () => {
const currentGlobal = global.__GATSBY
global.__GATSBY = {
root: cache.directory,
}
await fs.ensureDir(path.join(cache.directory, `public`))
const filePathPromise = fetchRemoteFile({
url: getExternalUrl(++cacheVersion),
directory: slash(cache.directory),
cacheKey: `${cacheVersion}`,
excludeDigest,
})
const cachedFilePathPromise = fetchRemoteFile({
url: getExternalUrl(cacheVersion),
directory: slash(path.join(cache.directory, `public`)),
cacheKey: `${cacheVersion}`,
excludeDigest,
})

expect(filePath).not.toBe(cachedFilePath)
expect(cachedFilePath).toStartWith(path.join(cache.directory, `public`))
expect(gotStream).toBeCalledTimes(1)
expect(fs.pathExists).toBeCalledTimes(0)
expect(fs.copy).toBeCalledTimes(1)
global.__GATSBY = currentGlobal
const [filePath, cachedFilePath] = await Promise.all([
filePathPromise,
cachedFilePathPromise,
])

expect(filePath).not.toBe(cachedFilePath)
expect(cachedFilePath).toStartWith(path.join(cache.directory, `public`))
expect(gotStream).toBeCalledTimes(1)
expect(fs.pathExists).toBeCalledTimes(0)
expect(fs.copy).toBeCalledTimes(1)
global.__GATSBY = currentGlobal
})
})

describe(`retries the download`, () => {
2 changes: 1 addition & 1 deletion packages/gatsby-core-utils/src/fetch-remote-file.ts
Original file line number Diff line number Diff line change
@@ -158,7 +158,7 @@ async function fetchFile({
try {
const digest = createContentDigest(url)
const finalDirectory = excludeDigest
? fileDirectory
? path.resolve(fileDirectory)
: path.join(fileDirectory, digest)

if (!name) {
4 changes: 2 additions & 2 deletions packages/gatsby-link/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "gatsby-link",
"description": "An enhanced Link component for Gatsby sites with support for resource prefetching",
"version": "4.11.0",
"version": "4.11.1",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
},
"dependencies": {
"@babel/runtime": "^7.15.4",
"@types/reach__router": "^1.3.10",
"gatsby-page-utils": "^2.11.0",
"gatsby-page-utils": "^2.11.1",
"prop-types": "^15.7.2"
},
"devDependencies": {
Loading