Open source changelog

Follow the evolution of Gatsby.

Subscribe to updates

Description

This PR fixes an issue with the incorrect detection of changed dependencies in the case when local dependencies are not installed.

Say we have this in project package.json and dependencies are not installed (so no node_modules folder):

"dependencies": {
  "gatsby": "next"
}

In this case gatsby-dev-cli attempts to load package details from unpkg to compare against dependencies in the monorepo:

https://github.com/gatsbyj…

Description

This moves emitting file nodes earlier and also fixes incremental builds not emitting updates.

Related Issues

[ch39979]

Description

With the way we have our 404 (and now 500) canonical pages setup (/404.html / /500.html) we clone page object from some conventional paths like (/404/) but we don't attach same isCreatedByStatefulCreatePages flag as original page. This required some workarounds (like skipping /404.html when decidiing which pages should no longer be there), but they had some of their own issue. Instead of that if we will guarantee same state on child page then pages cleanup for child page will be the same as parent page and this is what we want instead of workarounds.

edit {mdx.slug}.js query to use query variable 'id' instead of 'slug'

The first example Link is a 404 link as the repo has been rewritten in another Framework

Description

Documentation

Related Issues

--> Related to #33545
Before : Use the GatsbyImage component if the image source is changes for different instances of your component (like if it gets passed in as a prop).

After : Use the GatsbyImage component if the image source changes for different instances of your component (like if it gets passed in as a prop).

Fixes https://github.com/gatsbyjs/gatsby/issues/33545

Description

The pathsPrefix docs were missing usage of the PATHS_PREFIX environment variable. This adds it.

Description

Since adding subplugins handling mdx plugin was wrongly passing empty options. This fixes that to be on par with what gatsby-transformer-remark does - https://github.com/gatsbyjs/gatsby/blob/eb7fb9afaa52be3679a08dfc04ff2959392946ec/packages/gatsby-transformer-remark/src/extend-node-type.js#L130

Related Issues

[ch39918]

Description

gif of snape saying "silence"

Tested it with running tests. They were printing both a bunch of times, now only once.

Point people to correct docs

Description

Seems like for the ___NODE deprecation we need verbose support so I converted warnOnce to reportOnce.

This PR adds the sourcing guide for Prepr (prepr.io) headless CMS.

Description

Don't ingest remote schema in workers but use cache instead

Documentation

Related Issues

Description

I think related to https://github.com/gatsbyjs/gatsby/pull/33476, the change we are currently doing in this test suit now doesn't result in change of output, as import just get removed.

Description

This pull request is a proposed solution to issue:#28846

Creates the key publicId on the object if the key id is present before the object is transformed

Fixes #28846

Description

This pull request is a proposed solution to issue:#28846

Creates the key publicId on the object if the key id is present before the object is transformed

Fixes #28846

Documentation

Update a few docs that reference gatsby-image and move them to gatsby-plugin-image

Related Issues

Part of [ch32168]

This PR adds support to gatsby-source-contentful for the upcoming Content Sync preview on Gatsby Cloud. Content Sync handles loading state, errors, and redirection to preview content for preview builds.

The highlighted line (import { graphql } from 'gatsby') doesn't change: remove highlight syntax

Description

Remove highlight syntax

Documentation

Related Issues

Description

Grammatical error (improper usage of prepositions) has been fixed. I'm sorry if it appears nitpicking.

Description

Documentation

Related Issues

Problem

One problem we've noticed with engines that could be reproduced when:

  1. A page has links to many DSG pages
  2. Some of those DSG pages have images

In this case, pre-fetching of page-data files for all those DSG pages can be really slow because every page generates its own image transformation jobs BUT then each page-data request awaits for all jobs to complete before resolving.

In other words, the slowest page blocks HTTP responses for all other pages.

Solution

This PR adds an optimization that should allow engines to wait for only jobs created by the GraphQL query of this specific page. The implementation uses of NodeJS.

It wor…

When the lint tests fail on CI it's a bit painful to search through all the warnings to find the errors. The --quiet flag doesn't print warnings making it easier to spot which package needs to be formatted.

Description

Documentation

Related Issues

This is maintenance PR and a replacement for #32351 and should be merged after #33207

  • applies ts-check
  • moves code to es-module syntax
  • improves some variable names

This replaces all custom asset download code with gatsby-core-utils from Gatsby v4.

Primarily as companion for #33461.

We might only merge this for now and see how it behaves, but I am pretty sure we at least need reload on 429s and 503s in core which AFAICS is not in Gatsby core yet.

Description

  • Remove GATSBY_BUILD_STAGE environment variable
  • Throw warning when ___NODE convention is used
  • Remove TODO: In Gatsby v2, the NodeInput.id field is of type String, not ID. since decided to keep it

Preview:

image

Documentation

  • The removal of GATSBY_BUILD_STAGE will be added to migration guide after merged

Description

During PQR we should ground sharp to 1 core anyway to make sure cores can get utilized fully.

Description

Follow up to https://github.com/gatsbyjs/gatsby/pull/33455

Right now it seems like building from cold cache doesn't actually filter out non-SSG pages correctly.

Description

scheduleJob is v2 api that got replaced with createJobV2. This PR removes the old code path

Description

With SSR and DSG there is possibility of runtime failures to render a page, so Gatsby now needs to support way to present 500 status page to visitors. This PR adjusts 404 handling and expends it to cover 500 as well and also ensures that those status pages will have SSG mode.

Related Issues

[ch39515]

Replacement of #32351

  • [x] cleanup: The plugin filled up sourceNodes with a bunch of things. This PR cleans this up, moves large chunks of the code in separate files and their correct GatsbyJS API hooks.
  • [x] GATSBY_CONTENTFUL_EXPERIMENTAL_FORCE_CACHE got removed
  • [x] plugin options: forceFullSync removed as it wasn't supported for a while and added enableTags to validation
  • [x] e2e: update the snapshots to align with the just merged 33236 which enforces https for images
  • [x] e2e: update schema.gql for later comparision with new schema generation
  • ~cleanup: enable t…

Description

This PR updates the default starter to Gatsby 4 and includes examples for SSR and DSG.

I shamelessly borrowed the random dog example from the docs for the SSR page — which I think actually works nicely from a consistency standpoint.

I do feel like we could maybe do more with the DSG page example, but I didn't want to overthink it. Super open to hearing ideas for a better example use case here (and with the SSR page).

Related Issues

sc-38257

Switch from using path-to-regexp to @reach/router to do matches so we're we use the same route matching lib as the client and to add support for named splats e.g. /foo/[...bar].js (path-to-regexp nameless splats like /foo/[...].js.

Fix typo

docs

Description

IMHO most is an incorrect word to use in the given context, so I changed it to Almost.

Description

Remove global bindings if they are unused when using babel-plugin-remove-api. The following example now works in develop by removing execa from the javascript bundle. When building it was already working correctly as Webpack's production mode would remove them anyway.

import execa from 'execa';

export defa…

Description

A follow up for #33398

This PR enables hot reloading for page mode, so when a user adds getServerData page mode switches to SSR in develop (and back to SSG if getServerData gets removed).

It also contains an initial infrastructure to (eventually) enable defer for File System Routes via component-level config export (see TODO items in code).

[ch39430]

Description

In order to "force" people to good practices in querying our store (really important with LMDB now) we're adding two new methods on the context.nodeModel: findOne and findAll.

So instead of fetching everything and then filtering we want to point people to already filter in LMDB for example.

Documentation

Follow up for this PR could be more extensive docs but for now every current occurrence of the old code is updated at least.

Related Issues

[ch39749]

Description

This implements our Fast Refresh overlay for getServerData. It's treated as a runtime error (as it is) so people can't dismiss it (as it wouldn't help anyways).

The passing of the error and handling reloads etc. are handled through a new key on the page-data.json object. We've tried using the WebsocketManager but this eventually didn't work out when we had use cases that involved errors on other pages or reloading.

image

Documentation

I've updated the image in our Fast Refresh docs to…

URL Address with SSH key require this new syntax. More info on this Github page.

Description

Small memory improvement by only loading the necessary logger instead of all of them.

Description

Sssh renovate - we only need you on the scheduled times

Description

On windows engines validation failed because of / check. Windows uses \.

Description

Updating building-an-ecommerce-site-with-shopify docs because now we have priceRangeV2 instead of priceRange

Documentation

https://github.com/gatsbyjs/gatsby/blob/master/docs/docs/building-an-ecommerce-site-with-shopify.md

Related Issues

Related to #33298

Description

We should also include default gatsby-node inside the query-engine for people who have schema APIs in their root.

This can make engines less reliable when people are doing fs.readFile in the global scope, dsg/ssr will not be able to find these files. I tried doing tr…

Description

Few grammatical errors that I noticed have been fixed.

Related Issues

Since this is a minor change, I chose not to open an issue for this. Lemme know if y'all would like to have an issue opened for this.

Description

Not needed anymore to check for that fake node + removal of flag

Documentation

Added it to the v4 migration guide

Related Issues

[ch39713]

Description

We've deprecated the option in the last version and now it's time to remove it

Documentation

Updated every occurrence of this. Also added this to the v4 migration guide in the v4-docs branch

Related Issues

[ch39711]

Description

This applies similar logic as engines do when producing path in page-data ( https://github.com/gatsbyjs/gatsby/blob/fb55ff6b0f325118e34aa6269dff45f5bf03fa36/packages/gatsby/src/utils/page-ssr-module/entry.ts#L141-L143 ):

If page has matchPath, use deduced path from potentialPagePath (note that this will be / for page-data/index/page-data.json (as opposed to index that requestedPagePath might be set to). But otherwise just use path defined for page we alr…

Description

This removes the plugin "gatsby-plugin-gatsby-cloud" that appears in tutorial page 5 but not anywhere else in the tutorial, for consistency.

Documentation

https://www.gatsbyjs.com/docs/tutorial/part-5/ <!-- Where is this feature or API documented?

Minor updates

Description

Engines are igornig query execution errors now (not even logging them out). This just make sure that errors like that are thrown and page-data / html generation fails (same as it would do during regular build). It's up to engine integrations to handle them (most likely 500 status and in the future serve 500.html page - not in this PR).

Example error output in terminal:

➜  cop git:(main) ✗ gatsby serve                                 
⠀
You can now view gatsby-starter-hello-world in the browser.
⠀
  http://localhost:9000/


 ERROR 

Rendering html for "/error-field/" failed. Cannot read property 'field' of null

   1 | query MyQuery56 {
   …

Description

In v3 we deprecated the @nodeInterface GraphQL extension. People should use implements Node now.

Documentation

This is already explained/added to the v4 migration guide.

Related Issues

[ch39580]

Description

In some cases bundling engines will work, the bundles however might be borked if they try to require npm packages or some other local files that won't be present in environment running engines. This just speeds up feedback loop to get those errors during the build and not later when trying to actually use them.

This is done by spawning short lived process and intercepting module loading that allows just builtins and engines themselves failing (throwing) on everything else. If code is prepped with fallbacks (require surrounded by try/catch), validation will be succesful (rationale being if there are fallbacks, code should work without access to those modules - this should be things like ""

Description

One line&word change for gatsby-plugin-sitemap README.

Description

When lmdb-store is used, the cache is kept in .cache/caches-lmdb instead of .cache/json. However, even if .cache/json is not used in this case, the initialize function checks for the existence of that file and if it doesn't exist then deletes all existing HTML and CSS files.

Documentation

Related Issues

Fixes #33262

I'm wanting to add a link to the doc on stuck status warnings to this error message to make it easier for people to understand how to resolve.

Screen Shot 2021-10-06 at 12 14 54 PM

Description

Remove graphql-query-compress as it has tokenizr dependency that doesn't play well with DSG. We should definilty fix the underlying issue but this gets us through the door

Documentation

Related Issues

Updated changelogs of the following packages:

  • gatsby
  • gatsby-cli
  • gatsby-plugin-image
  • gatsby-plugin-sharp
  • gatsby-source-drupal
  • gatsby-source-shopify
  • gatsby-source-wordpress
  • gatsby-transformer-sqip

Description

This PR adds rudimentary support for hot reloading of getServerData function in develop.

The logic is as follows: 1. Listen for webpack invalid event and if a modified file has getServerData content that is different from the last time it was checked - triggers SSR bundle rebuilding 2. When re-building is finished - emits websocket event to force reloading of page-data for the current page 3. Ensures page-data express handler always uses fresh SSR bundle

Out of scope

This won't change the SSR mode of the page when getServerData export is added or removed. This should be covered by a follow-up PR.

Description

This PR allows Gatsby apps to use more than one source that uses gatsby-plugin-image.

For example, users can use gatsby-source-prismic and gatsby-source-shopify together on the same app with this PR.

Without this PR, using multiple sources that use gatsby-plugin-image results in the following error during Gatsby's bootstrap phase:

[ Truncated log ]

success Checking for changed pages - 0.001s
success source and transform nodes - 12.721s

 ERROR

Missing onError handler for invocation 'building-schema', error was 'Error: Schema must contain uniquely nam…

Description

Adds a bash script to automate changing into each of the examples/ directories and try to run npm i and gatsby build.

This script is useful for trying to identify which of the example sites aren't working with the latest version of Gatsby (using the next tag).

Some caveats:

  • This script is SLOW. It currently takes hours to run, because it's building each example individually.
  • Some of the builds will fail because the folder structure for that example is different. e.g., examples/creating-source-plugins/ contains multiple Gatsby sites, each in their own folder.
    • This script won

Several changes: - better logging for fastbuild updates (most useful is it links to URL of changed entity) - skip running fastbuilds sync API call if lastFetched isn't set as this call is a) pointless as we know we need to do a full-fetch and b) pretty expensive. - only call touchNodes on the first call to sourceNodes as Gatsby (currently) doesn't update that information for subsequent calls so we can save some time there. - more tests for relationships updating code

This PR removes the plugin removeAttrs for postcss-svgo. The main reason behind this change is to remove warnings while building a Gatsby site with SVGs (see below). The removeAttrs plugin expect a pattern to remove matching attributes from the SVG, if none is provided the plugin is useless (see https://github.com/svg/svgo/pull/1582).

With the current version of svgo:

$ gatsby build
[...]
warn Css Minimizer Plugin: postcss-svgo:
/Users/samuel.vaillant/Work/gatsby-svgo/styles.d07168f9038428354f1a.css:2:3: TypeError:
Cannot read properties of undefined (reading 'includes')
[...]
✨ …

Description

In watch mode rewriting those files without changes causes unnecesary recompilations, this just prevents them if nothing actually changed

Description

This is a follow-up for #33319. Disables inference for other internal types. Still keeps inference for File type as it will be a bigger lift - requires changing all user plugins to incorporate @childOf directive for children types.

Also still keeps inference for Site type - it is inexpensive and disabling inference for it means adding type definition manually to basically every site out there.

Description

Added explicit statement for required contentful_id field when querying for references in rich text.

Documentation

@gatsbyjs/documentation

Related Issues

Description

SSR allows making use of query params but our runtime is right now adjusted to make it work well: - initial page load will have html that make use of serverData produced with proper query params, but later we fetch page-data without those params and there is potential flicker ( https://github.com/gatsbyjs/gatsby/pull/33134 doesn't work with it without doing more changes) - client side navigation (with gatsby-link) just strips query params and make use of pathname

[ch38142]

Description

Some links like https://www.w3.org/TR/appmanifest/#dfn-directionality-capable-members are broken. Update them may be good.

Minor updates