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@2.30.1
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@2.30.2
Choose a head ref
  • 8 commits
  • 34 files changed
  • 6 contributors

Commits on Jan 12, 2021

  1. fix(gatsby-source-filesystem): fix broken stream with gzipped files (#…

    …28913)
    
    (cherry picked from commit a8b516f)
    wardpeet authored and vladar committed Jan 12, 2021

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    38c0f42 View commit details
  2. Revert "fix(gatsby-source-filesystem): fix broken stream with gzipped…

    … files (#28913)"
    
    This reverts commit 38c0f42
    vladar committed Jan 12, 2021

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    7e9ee09 View commit details

Commits on Jan 13, 2021

  1. perf(develop): don't use debug config for bluebird (#28957) (#28993)

    * perf(develop): don't use debug config for bluebird
    
    * Update api-runner-node.js
    
    (cherry picked from commit 125f571)
    
    Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
    GatsbyJS Bot and pieh authored Jan 13, 2021

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    f632c0a View commit details
  2. fix(gatsby): fix stale query results on data updates (#28986) (#28994)

    * Add failing test
    
    * fix(gatsby): fix stale query results on data updates
    
    * narrow the scope of the change
    
    * Address review comments
    
    * remove accidentally added stuff
    
    (cherry picked from commit 811c2a8)
    
    Co-authored-by: Vladimir Razuvaev <vladimir.razuvaev@gmail.com>
    GatsbyJS Bot and vladar authored Jan 13, 2021

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    c172848 View commit details
  3. chore(telemetry): allow sharing tags in a file and read it only when …

    …things change (#28953) (#28992)
    
    * chore(telemetry): allow sharing tags in a file and read it only when
    things change
    
    * Types
    
    (cherry picked from commit 9cb8eeb)
    
    Co-authored-by: Jarmo Isotalo <jamo@isotalo.fi>
    GatsbyJS Bot and jamo authored Jan 13, 2021

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    1617c6c View commit details
  4. fix(gatsby-plugin-sharp): PathPrefix isn't being passed/set for Gatsb…

    …yImage (#28845) (#28991)
    
    * fix for path-prefix in GatsbyImage
    
    * add e2e test for path prefix cases
    
    * update tests
    
    * forgot to save
    
    * refactor
    
    * add curlys
    
    (cherry picked from commit 5874414)
    
    Co-authored-by: LB <laurie@gatsbyjs.com>
    GatsbyJS Bot and LB authored Jan 13, 2021

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    c762050 View commit details
  5. Fix(gatsby-plugin-image): Render LayoutWrapper prior to loading of la…

    …zy-hydrate (#28841) (#28990)
    
    * add layoutwrapper to intial render when lazy-hydrate hasn't yet run
    
    * calculate sizer string
    
    (cherry picked from commit 78e5e47)
    
    Co-authored-by: LB <laurie@gatsbyjs.com>
    GatsbyJS Bot and LB authored Jan 13, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    be7ad3b View commit details
  6. chore(release): Publish

     - gatsby-admin@0.6.2
     - gatsby-cli@2.17.1
     - gatsby-plugin-image@0.5.1
     - gatsby-plugin-page-creator@2.8.1
     - gatsby-plugin-sharp@2.12.1
     - gatsby-recipes@0.7.1
     - gatsby-telemetry@1.8.1
     - gatsby-transformer-sharp@2.10.1
     - gatsby-transformer-sqip@2.9.1
     - gatsby@2.30.2
    vladar committed Jan 13, 2021
    Copy the full SHA
    c15af99 View commit details
Showing with 415 additions and 59 deletions.
  1. +20 −0 e2e-tests/path-prefix/cypress/integration/path-prefix.js
  2. +7 −0 e2e-tests/path-prefix/gatsby-config.js
  3. +3 −1 e2e-tests/path-prefix/package.json
  4. BIN e2e-tests/path-prefix/src/images/citrus-fruits.jpg
  5. +51 −32 e2e-tests/path-prefix/src/pages/index.js
  6. +4 −0 packages/gatsby-admin/CHANGELOG.md
  7. +2 −2 packages/gatsby-admin/package.json
  8. +4 −0 packages/gatsby-cli/CHANGELOG.md
  9. +3 −3 packages/gatsby-cli/package.json
  10. +4 −0 packages/gatsby-plugin-image/CHANGELOG.md
  11. +1 −1 packages/gatsby-plugin-image/package.json
  12. +6 −1 packages/gatsby-plugin-image/src/components/gatsby-image.browser.tsx
  13. +17 −1 packages/gatsby-plugin-image/src/components/layout-wrapper.tsx
  14. +4 −0 packages/gatsby-plugin-page-creator/CHANGELOG.md
  15. +2 −2 packages/gatsby-plugin-page-creator/package.json
  16. +6 −0 packages/gatsby-plugin-sharp/CHANGELOG.md
  17. +3 −3 packages/gatsby-plugin-sharp/package.json
  18. +9 −1 packages/gatsby-plugin-sharp/src/image-data.ts
  19. +4 −0 packages/gatsby-recipes/CHANGELOG.md
  20. +2 −2 packages/gatsby-recipes/package.json
  21. +4 −0 packages/gatsby-telemetry/CHANGELOG.md
  22. +1 −1 packages/gatsby-telemetry/package.json
  23. +119 −0 packages/gatsby-telemetry/src/__tests__/telemetry.ts
  24. +24 −0 packages/gatsby-telemetry/src/telemetry.ts
  25. +6 −0 packages/gatsby-transformer-sharp/CHANGELOG.md
  26. +1 −1 packages/gatsby-transformer-sharp/package.json
  27. +2 −2 packages/gatsby-transformer-sharp/src/customize-schema.js
  28. +4 −0 packages/gatsby-transformer-sqip/CHANGELOG.md
  29. +2 −2 packages/gatsby-transformer-sqip/package.json
  30. +10 −0 packages/gatsby/CHANGELOG.md
  31. +4 −4 packages/gatsby/package.json
  32. +64 −0 packages/gatsby/src/query/__tests__/data-tracking.js
  33. +13 −0 packages/gatsby/src/schema/node-model.js
  34. +9 −0 packages/gatsby/src/utils/api-runner-node.js
20 changes: 20 additions & 0 deletions e2e-tests/path-prefix/cypress/integration/path-prefix.js
Original file line number Diff line number Diff line change
@@ -11,6 +11,26 @@ describe(`Production pathPrefix`, () => {
cy.location(`pathname`).should(`eq`, withTrailingSlash(pathPrefix))
})

it(`renders static image`, () => {
cy.getTestElement(`static-image`)
.should(`have.attr`, `srcset`)
.and(srcset => {
srcset.split(/\s*,\s*/).forEach(part => {
expect(part).to.contain(`/blog`)
})
})
})

it(`renders dynamic image`, () => {
cy.getTestElement(`gatsby-image`)
.should(`have.attr`, `srcset`)
.and(srcset => {
srcset.split(/\s*,\s*/).forEach(part => {
expect(part).to.contain(`/blog`)
})
})
})

describe(`navigation`, () => {
it(`prefixes link with /blog`, () => {
cy.getTestElement(`page-2-link`)
7 changes: 7 additions & 0 deletions e2e-tests/path-prefix/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -21,8 +21,15 @@ module.exports = {
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/src/images/`,
},
},
`gatsby-plugin-sitemap`,
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`,
`gatsby-plugin-image`,
{
resolve: `gatsby-plugin-feed`,
4 changes: 3 additions & 1 deletion e2e-tests/path-prefix/package.json
Original file line number Diff line number Diff line change
@@ -7,12 +7,14 @@
"cypress": "^3.1.0",
"gatsby": "^2.3.34",
"gatsby-plugin-feed": "^2.1.2",
"gatsby-plugin-image": "~1.0.0",
"gatsby-plugin-image": "^0.4.0",
"gatsby-plugin-manifest": "^2.0.17",
"gatsby-plugin-offline": "^2.0.23",
"gatsby-plugin-react-helmet": "^3.0.6",
"gatsby-plugin-sharp": "^2.0.37",
"gatsby-plugin-sitemap": "^2.0.12",
"gatsby-source-filesystem": "^2.8.1",
"gatsby-transformer-sharp": "^2.9.0",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-helmet": "^5.2.0"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 51 additions & 32 deletions e2e-tests/path-prefix/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,57 @@
import * as React from "react"
import { Link, navigate } from "gatsby"
import { StaticImage } from "gatsby-plugin-image"
import { Link, navigate, graphql } from "gatsby"
import { StaticImage, GatsbyImage, getImage } from "gatsby-plugin-image"

import Layout from "../components/layout"

const IndexPage = () => (
<Layout>
<h1>Hi people</h1>
<StaticImage
src="../images/gatsby-icon.png"
alt="Gatsby icon"
layout="fixed"
/>
<p>Welcome to your new Gatsby site.</p>
<p>Now go build something great.</p>
<Link data-testid="page-2-link" to="/page-2/">
Go to page 2
</Link>
<Link data-testid="page-blogtest-link" to="/blogtest/">
Go to blogtest
</Link>
<button
data-testid="page-2-button-link"
onClick={() => navigate(`/page-2/`)}
>
Go to page 2 with navigate()
</button>
<Link data-testid="404-link" to="/not-existing-page">
Go to not existing page
</Link>
<Link data-testid="subdir-link" to="subdirectory/page-1">
Go to subdirectory
</Link>
</Layout>
)
const IndexPage = ({ data }) => {
const image = getImage(data.file)
return (
<Layout>
<h1>Hi people</h1>
<StaticImage
src="../images/gatsby-icon.png"
alt="Gatsby icon"
layout="fixed"
data-testid="static-image"
/>
<GatsbyImage
image={image}
alt="Citrus Fruits"
data-testid="gatsby-image"
/>
<p>Welcome to your new Gatsby site.</p>
<p>Now go build something great.</p>
<Link data-testid="page-2-link" to="/page-2/">
Go to page 2
</Link>
<Link data-testid="page-blogtest-link" to="/blogtest/">
Go to blogtest
</Link>
<button
data-testid="page-2-button-link"
onClick={() => navigate(`/page-2/`)}
>
Go to page 2 with navigate()
</button>
<Link data-testid="404-link" to="/not-existing-page">
Go to not existing page
</Link>
<Link data-testid="subdir-link" to="subdirectory/page-1">
Go to subdirectory
</Link>
</Layout>
)
}

export const query = graphql`
query {
file(relativePath: { eq: "citrus-fruits.jpg" }) {
childImageSharp {
gatsbyImageData
}
}
}
`

export default IndexPage
4 changes: 4 additions & 0 deletions packages/gatsby-admin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.6.2](https://github.com/gatsbyjs/gatsby/compare/gatsby-admin@0.6.1...gatsby-admin@0.6.2) (2021-01-13)

**Note:** Version bump only for package gatsby-admin

## [0.6.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-admin@0.6.0...gatsby-admin@0.6.1) (2021-01-06)

### Bug Fixes
4 changes: 2 additions & 2 deletions packages/gatsby-admin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-admin",
"version": "0.6.1",
"version": "0.6.2",
"main": "index.js",
"author": "Max Stoiber",
"license": "MIT",
@@ -20,7 +20,7 @@
"@typescript-eslint/parser": "^2.34.0",
"csstype": "^2.6.13",
"formik": "^2.2.5",
"gatsby": "^2.30.1",
"gatsby": "^2.30.2",
"gatsby-interface": "^0.0.225",
"gatsby-plugin-typescript": "^2.10.0",
"gatsby-plugin-webfonts": "^1.1.3",
4 changes: 4 additions & 0 deletions packages/gatsby-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.17.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-cli@2.17.0...gatsby-cli@2.17.1) (2021-01-13)

**Note:** Version bump only for package gatsby-cli

# [2.17.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-cli@2.17.0-next.5...gatsby-cli@2.17.0) (2021-01-05)

**Note:** Version bump only for package gatsby-cli
6 changes: 3 additions & 3 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": "2.17.0",
"version": "2.17.1",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"bin": {
"gatsby": "cli.js"
@@ -25,8 +25,8 @@
"fs-exists-cached": "^1.0.0",
"fs-extra": "^8.1.0",
"gatsby-core-utils": "^1.8.0",
"gatsby-recipes": "^0.7.0",
"gatsby-telemetry": "^1.8.0",
"gatsby-recipes": "^0.7.1",
"gatsby-telemetry": "^1.8.1",
"hosted-git-info": "^3.0.6",
"is-valid-path": "^0.1.1",
"lodash": "^4.17.20",
4 changes: 4 additions & 0 deletions packages/gatsby-plugin-image/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.5.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-image@0.5.0...gatsby-plugin-image@0.5.1) (2021-01-13)

**Note:** Version bump only for package gatsby-plugin-image

# [0.5.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-image@0.5.0-next.6...gatsby-plugin-image@0.5.0) (2021-01-05)

### Bug Fixes
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-image/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-plugin-image",
"version": "0.5.0",
"version": "0.5.1",
"scripts": {
"build": "npm-run-all -s clean -p build:*",
"build:gatsby-node": "tsc --jsx react --downlevelIteration true --skipLibCheck true --esModuleInterop true --outDir dist/ src/gatsby-node.ts src/babel-plugin-parse-static-images.ts src/resolver-utils.ts src/types.d.ts",
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ import {
import { PlaceholderProps } from "./placeholder"
import { MainImageProps } from "./main-image"
import { Layout } from "../image-utils"
import { getSizer } from "./layout-wrapper"

// eslint-disable-next-line @typescript-eslint/interface-name-prefix
export interface GatsbyImageProps
@@ -193,6 +194,8 @@ export const GatsbyImageHydrator: FunctionComponent<GatsbyImageProps> = function
props,
])

const sizer = getSizer(layout, width, height)

return (
<Type
{...wrapperProps}
@@ -203,7 +206,9 @@ export const GatsbyImageHydrator: FunctionComponent<GatsbyImageProps> = function
}}
className={`${wClass}${className ? ` ${className}` : ``}`}
ref={root}
dangerouslySetInnerHTML={{ __html: `` }}
dangerouslySetInnerHTML={{
__html: sizer,
}}
suppressHydrationWarning
/>
)
18 changes: 17 additions & 1 deletion packages/gatsby-plugin-image/src/components/layout-wrapper.tsx
Original file line number Diff line number Diff line change
@@ -39,6 +39,23 @@ if (hasNativeLazyLoadSupport) {
/>
)

export function getSizer(
layout: Layout,
width: number,
height: number
): string {
let sizer: string | null = null
if (layout === `fluid`) {
sizer = `<div aria-hidden="true" style="padding-top: ${
(height / width) * 100
}%;"></div>`
}
if (layout === `constrained`) {
sizer = `<div style="max-width: ${width}px; display: block;"><img alt="" role="presentation" aria-hidden="true" src="data:image/svg+xml;charset=utf-8,%3Csvg height='${height}' width='${width}' xmlns='http://www.w3.org/2000/svg' version='1.1'%3E%3C/svg%3E" style="max-width: 100%; display: block; position: static;"></div>`
}
return sizer
}

export const LayoutWrapper: FunctionComponent<ILayoutWrapperProps> = function LayoutWrapper({
layout,
width,
@@ -68,7 +85,6 @@ export const LayoutWrapper: FunctionComponent<ILayoutWrapperProps> = function La
</div>
)
}

return (
<Fragment>
{sizer}
4 changes: 4 additions & 0 deletions packages/gatsby-plugin-page-creator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.8.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-page-creator@2.8.0...gatsby-plugin-page-creator@2.8.1) (2021-01-13)

**Note:** Version bump only for package gatsby-plugin-page-creator

# [2.8.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-page-creator@2.8.0-next.2...gatsby-plugin-page-creator@2.8.0) (2021-01-05)

**Note:** Version bump only for package gatsby-plugin-page-creator
4 changes: 2 additions & 2 deletions packages/gatsby-plugin-page-creator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-plugin-page-creator",
"version": "2.8.0",
"version": "2.8.1",
"description": "Gatsby plugin that automatically creates pages from React components in specified directories",
"main": "index.js",
"scripts": {
@@ -29,7 +29,7 @@
"chokidar": "^3.4.2",
"fs-exists-cached": "^1.0.0",
"gatsby-page-utils": "^0.7.0",
"gatsby-telemetry": "^1.8.0",
"gatsby-telemetry": "^1.8.1",
"globby": "^11.0.1",
"lodash": "^4.17.20"
},
6 changes: 6 additions & 0 deletions packages/gatsby-plugin-sharp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.12.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-sharp@2.12.0...gatsby-plugin-sharp@2.12.1) (2021-01-13)

### Bug Fixes

- **gatsby-plugin-sharp:** PathPrefix isn't being passed/set for GatsbyImage ([#28845](https://github.com/gatsbyjs/gatsby/issues/28845)) ([#28991](https://github.com/gatsbyjs/gatsby/issues/28991)) ([c762050](https://github.com/gatsbyjs/gatsby/commit/c76205061e83d372bc205690ea1b970273f673dc))

# [2.12.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-sharp@2.12.0-next.6...gatsby-plugin-sharp@2.12.0) (2021-01-05)

### Bug Fixes
6 changes: 3 additions & 3 deletions packages/gatsby-plugin-sharp/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby-plugin-sharp",
"description": "Wrapper of the Sharp image manipulation library for Gatsby plugins",
"version": "2.12.0",
"version": "2.12.1",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
@@ -12,7 +12,7 @@
"bluebird": "^3.7.2",
"fs-extra": "^9.0.1",
"gatsby-core-utils": "^1.8.0",
"gatsby-telemetry": "^1.8.0",
"gatsby-telemetry": "^1.8.1",
"got": "^10.7.0",
"imagemin": "^7.0.1",
"imagemin-mozjpeg": "^9.0.0",
@@ -33,7 +33,7 @@
"@types/sharp": "^0.26.1",
"babel-preset-gatsby-package": "^0.10.0",
"cross-env": "^7.0.3",
"gatsby-plugin-image": "^0.5.0"
"gatsby-plugin-image": "^0.5.1"
},
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-sharp#readme",
"keywords": [
10 changes: 9 additions & 1 deletion packages/gatsby-plugin-sharp/src/image-data.ts
Original file line number Diff line number Diff line change
@@ -200,7 +200,9 @@ export async function generateImageData({
toFormat: primaryFormat,
})

if (pathPrefix) transform.pathPrefix = pathPrefix
if (pathPrefix) {
transform.pathPrefix = pathPrefix
}
return transform
})

@@ -256,6 +258,9 @@ export async function generateImageData({
height: Math.round(width / imageSizes.aspectRatio),
toFormat: `avif`,
})
if (pathPrefix) {
transform.pathPrefix = pathPrefix
}
return transform
})

@@ -285,6 +290,9 @@ export async function generateImageData({
height: Math.round(width / imageSizes.aspectRatio),
toFormat: `webp`,
})
if (pathPrefix) {
transform.pathPrefix = pathPrefix
}
return transform
})

4 changes: 4 additions & 0 deletions packages/gatsby-recipes/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.7.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-recipes@0.7.0...gatsby-recipes@0.7.1) (2021-01-13)

**Note:** Version bump only for package gatsby-recipes

# [0.7.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-recipes@0.7.0-next.2...gatsby-recipes@0.7.0) (2021-01-05)

**Note:** Version bump only for package gatsby-recipes
Loading